getTransferTokensInstructions
function getTransferTokensInstructions(args): Instruction<string, readonly (AccountLookupMeta<string, string> | AccountMeta<string>)[]>[];Create the instructions required to transfer tokens from one wallet to another, including creating the destination ATA if it does not exist
Example
const sourceAta = await getAssociatedTokenAccountAddress(mint, authority, tokenProgram);
const destination = address(...);
const destinationAta = await getAssociatedTokenAccountAddress(mint, destination, tokenProgram);
const instructions = getTransferTokensInstructions({
feePayer: signer,
mint,
amount: 10,
authority: signer, // the source wallet for the tokens to be transferred
sourceAta, // normally derived from the `authority`
destination,
destinationAta, // derived from the `destination`
tokenProgram,
});Parameters
| Parameter | Type |
|---|---|
args | GetTransferTokensInstructionsArgs |
Returns
Instruction<string, readonly (AccountLookupMeta<string, string> | AccountMeta<string>)[]>[]