Skip to content
This new developer portal is under construction. For complete documentation, please refer to the old developer portal.

Transferring assets

Authorized by: The account that holds the asset to be transferred.

Assets can be transferred between accounts that have opted-in to receiving the asset. These are analogous to standard payment transactions but for Algorand Standard Assets.

sp = algod_client.suggested_params()
# Create transfer transaction
xfer_txn = transaction.AssetTransferTxn(
sender=acct1.address,
sp=sp,
receiver=acct2.address,
amt=1,
index=created_asset,
)
signed_xfer_txn = xfer_txn.sign(acct1.private_key)
txid = algod_client.send_transaction(signed_xfer_txn)
print(f"Sent transfer transaction with txid: {txid}")
results = transaction.wait_for_confirmation(algod_client, txid, 4)
print(f"Result confirmed in round: {results['confirmed-round']}")

See complete code…

See also

Transfer

transferAsset

The key function to facilitate asset transfers is transferAsset(transfer, algod), which returns a SendTransactionResult and takes a TransferAssetParams:

  • All properties in SendTransactionParams
  • from: SendTransactionFrom - The account that will send the asset
  • to: SendTransactionFrom | string - The account / account address that will receive the asset
  • assetId: number - The asset id that will be transferred
  • amount: number | bigint - The amount to send in the smallest divisible unit
  • transactionParams?: SuggestedParams - The optional transaction parameters
  • clawbackFrom: SendTransactionFrom | string - An optional address of a target account from which to perform a clawback operation. Please note, in such cases senderAccount must be equal to clawback field on ASA metadata.
  • note?: TransactionNote - The transaction note
  • lease?: string | Uint8Array: A lease to assign to the transaction to enforce a mutually exclusive transaction (useful to prevent double-posting and other scenarios)