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.
1    """2    Send an asset transfer transaction of 1 asset with asset id 1234 from account_a to account_b3
4    Parameters for an asset transfer transaction.5    - sender: The address of the account that will send the asset6    - asset_id: The asset id of the asset to transfer7    - amount: Amount of the asset to transfer (smallest divisible unit)8    - receiver: The address of the account to send the asset to9    """10    txn_result = algorand_client.send.asset_transfer(11        AssetTransferParams(12            sender=account_a.address,13            asset_id=1234,14            receiver=account_b.address,15            amount=1,16        )17    )const xferTxn = algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject({  from: creator.addr,  to: receiver.addr,  suggestedParams,  assetIndex,  amount: 1,});
const signedXferTxn = xferTxn.signTxn(creator.privateKey);await algodClient.sendRawTransaction(signedXferTxn).do();await algosdk.waitForConfirmation(algodClient, xferTxn.txID().toString(), 3);goal asset send -a <asset-amount> --asset <asset-name> -f <asset-sender> -t <asset-receiver> --creator <asset-creator> -d dataSee 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)