Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonpaulos committed Jun 6, 2024
1 parent ce6fb34 commit de3052e
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions algosdk/kmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ def list_wallets(self, **kwargs: Any):
return []

def create_wallet(
self, name, pswd, driver_name="sqlite", master_deriv_key=None, **kwargs: Any
self,
name,
pswd,
driver_name="sqlite",
master_deriv_key=None,
**kwargs: Any
):
"""
Create a new wallet.
Expand Down Expand Up @@ -128,7 +133,9 @@ def get_wallet(self, handle, **kwargs: Any):
"""
req = "/wallet/info"
query = {"wallet_handle_token": handle}
return self.kmd_request("POST", req, data=query, **kwargs)["wallet_handle"]
return self.kmd_request("POST", req, data=query, **kwargs)[
"wallet_handle"
]

def init_wallet_handle(self, id, password, **kwargs: Any):
"""
Expand All @@ -143,7 +150,9 @@ def init_wallet_handle(self, id, password, **kwargs: Any):
"""
req = "/wallet/init"
query = {"wallet_id": id, "wallet_password": password}
return self.kmd_request("POST", req, data=query, **kwargs)["wallet_handle_token"]
return self.kmd_request("POST", req, data=query, **kwargs)[
"wallet_handle_token"
]

def release_wallet_handle(self, handle, **kwargs: Any):
"""
Expand Down Expand Up @@ -172,7 +181,9 @@ def renew_wallet_handle(self, handle, **kwargs: Any):
"""
req = "/wallet/renew"
query = {"wallet_handle_token": handle}
return self.kmd_request("POST", req, data=query, **kwargs)["wallet_handle"]
return self.kmd_request("POST", req, data=query, **kwargs)[
"wallet_handle"
]

def rename_wallet(self, id, password, new_name, **kwargs: Any):
"""
Expand Down Expand Up @@ -243,7 +254,9 @@ def export_key(self, handle, password, address, **kwargs: Any):
"wallet_password": password,
"address": address,
}
return self.kmd_request("POST", req, data=query, **kwargs)["private_key"]
return self.kmd_request("POST", req, data=query, **kwargs)[
"private_key"
]

def generate_key(self, handle, display_mnemonic=True, **kwargs: Any):
"""
Expand Down Expand Up @@ -300,7 +313,9 @@ def list_keys(self, handle, **kwargs: Any):
return result["addresses"]
return []

def sign_transaction(self, handle, password, txn, signing_address=None, **kwargs: Any):
def sign_transaction(
self, handle, password, txn, signing_address=None, **kwargs: Any
):
"""
Sign a transaction.
Expand Down Expand Up @@ -409,7 +424,9 @@ def delete_multisig(self, handle, password, address, **kwargs: Any):
result = self.kmd_request("DELETE", req, data=query, **kwargs)
return result == {}

def sign_multisig_transaction(self, handle, password, public_key, mtx, **kwargs: Any):
def sign_multisig_transaction(
self, handle, password, public_key, mtx, **kwargs: Any
):
"""
Sign a multisig transaction for the given public key.
Expand Down Expand Up @@ -440,7 +457,9 @@ def sign_multisig_transaction(self, handle, password, public_key, mtx, **kwargs:
signer = base64.b64encode(encoding.decode_address(mtx.auth_addr))
query["signer"] = signer.decode()

result = self.kmd_request("POST", req, data=query, **kwargs)["multisig"]
result = self.kmd_request("POST", req, data=query, **kwargs)[
"multisig"
]
msig = encoding.msgpack_decode(result)
mtx.multisig = msig
return mtx

0 comments on commit de3052e

Please sign in to comment.