Skip to content

Commit

Permalink
Create did_based_autonomous_banking_api.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Jul 20, 2024
1 parent b4258b0 commit adb9f01
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions did-module/did_based_autonomous_banking_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# did_module/did_based_autonomous_banking_api.py
import didkit
from pi_nexus_autonomous_banking_network import AutonomousBankingNetwork
from AutonomousBankingSmartContract import AutonomousBankingSmartContract

class DIDBasedAutonomousBankingAPI:
def __init__(self, autonomous_banking_network: AutonomousBankingNetwork):
self.autonomous_banking_network = autonomous_banking_network
self.autonomous_banking_smart_contract = AutonomousBankingSmartContract()

def create_account(self, did: didkit.DID):
# Create an autonomous banking account associated with the DID
account = self.autonomous_banking_network.create_account(did)
return account

def deposit(self, did: didkit.DID, amount: uint256):
# Deposit funds into the autonomous banking account associated with the DID
self.autonomous_banking_smart_contract.deposit(amount)
return True

def withdraw(self, did: didkit.DID, amount: uint256):
# Withdraw funds from the autonomous banking account associated with the DID
self.autonomous_banking_smart_contract.withdraw(amount)
return True

def transfer(self, did: didkit.DID, recipient_did: didkit.DID, amount: uint256):
# Transfer funds to another autonomous banking account associated with the recipient DID
self.autonomous_banking_smart_contract.transfer(recipient_did, amount)
return True

0 comments on commit adb9f01

Please sign in to comment.