Skip to content

Commit

Permalink
fix: rekey transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
inaie-makerx committed May 8, 2024
1 parent 5ee3a3b commit 55e1dbe
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/algokit_utils/_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def transfer(client: "AlgodClient", parameters: TransferParameters) -> PaymentTx
params = parameters
params.suggested_params = parameters.suggested_params or client.suggested_params()
from_account = params.from_account
sender = address_from_private_key(from_account.private_key) # type: ignore[no-untyped-call]
sender = _get_address(from_account)
transaction = PaymentTxn(
sender=sender,
receiver=params.to_address,
Expand All @@ -105,7 +105,7 @@ def transfer_asset(client: "AlgodClient", parameters: TransferAssetParameters) -

params = parameters
params.suggested_params = parameters.suggested_params or client.suggested_params()
sender = address_from_private_key(parameters.from_account.private_key) # type: ignore[no-untyped-call]
sender = _get_address(parameters.from_account)
suggested_params = parameters.suggested_params or client.suggested_params()
xfer_txn = AssetTransferTxn(
sp=suggested_params,
Expand Down Expand Up @@ -141,7 +141,14 @@ def _send_transaction(
txid = transaction.get_txid() # type: ignore[no-untyped-call]
logger.debug(
f"Sent transaction {txid} type={transaction.type} from "
f"{address_from_private_key(parameters.from_account.private_key)}" # type: ignore[no-untyped-call]
f"{_get_address(parameters.from_account)}" # type: ignore[no-untyped-call]
)

return transaction

def _get_address(account: Account | AccountTransactionSigner) -> str :
if type(account) is Account:
return account.address
else:
address = address_from_private_key(account.private_key) # type: ignore[no-untyped-call]
return str(address)

0 comments on commit 55e1dbe

Please sign in to comment.