buildTransferTokensTransaction
Call Signature
Create a transaction that can transfer tokens to the desired wallet/owner, including creating their ATA if it does not exist
The transaction has the following defaults:
- Default
version=legacy - Default
computeUnitLimit=31_000
Example
Type Parameters
| Type Parameter | Default type |
|---|---|
TVersion extends TransactionVersion | "legacy" |
TFeePayer extends TransactionSigner | TransactionSigner |
Parameters
| Parameter | Type |
|---|---|
args | { computeUnitLimit?: number | bigint; computeUnitPrice?: number | bigint; latestBlockhash?: undefined; version?: TVersion; } & { amount: number | bigint; authority: Address | TransactionSigner; destination: Address | TransactionSigner; destinationAta?: Address; feePayer: Address | TransactionSigner; mint: Address | KeyPairSigner; sourceAta?: Address; tokenProgram?: Address; } |
Returns
Promise<{
feePayer: Readonly<{
address: Address<TAddress>;
}>;
instructions: readonly Instruction<string, readonly (AccountLookupMeta<string, string> | AccountMeta<string>)[]>[];
version: TVersion;
}>
Remarks
- transferring without creating the ata is generally < 10_000cu
- validating the ata onchain during creation results in a ~15000cu fluctuation
Call Signature
Create a transaction that can transfer tokens to the desired wallet/owner, including creating their ATA if it does not exist
The transaction has the following defaults:
- Default
version=legacy - Default
computeUnitLimit=31_000
Example
Type Parameters
| Type Parameter | Default type |
|---|---|
TVersion extends TransactionVersion | "legacy" |
TFeePayer extends TransactionSigner | TransactionSigner |
TLifetimeConstraint extends Readonly<{ blockhash: Blockhash; lastValidBlockHeight: bigint; }> | Readonly<{ blockhash: Blockhash; lastValidBlockHeight: bigint; }> |
Parameters
| Parameter | Type |
|---|---|
args | { computeUnitLimit?: number | bigint; computeUnitPrice?: number | bigint; latestBlockhash?: TLifetimeConstraint; version?: TVersion; } & { amount: number | bigint; authority: Address | TransactionSigner; destination: Address | TransactionSigner; destinationAta?: Address; feePayer: Address | TransactionSigner; mint: Address | KeyPairSigner; sourceAta?: Address; tokenProgram?: Address; } |
Returns
Promise<{
feePayer: Readonly<{
address: Address<TAddress>;
}>;
instructions: readonly Instruction<string, readonly (AccountLookupMeta<string, string> | AccountMeta<string>)[]>[];
lifetimeConstraint: BlockhashLifetimeConstraint;
version: TVersion;
}>
Remarks
- transferring without creating the ata is generally < 10_000cu
- validating the ata onchain during creation results in a ~15000cu fluctuation