UNPKG

gill

Version:

a modern javascript/typescript client library for interacting with the Solana blockchain

44 lines 2.64 kB
import type { ITransactionMessageWithFeePayer, TransactionMessageWithBlockhashLifetime, TransactionSigner, TransactionVersion } from "@solana/kit"; import type { FullTransaction, Simplify } from "../../../types"; import { type GetTransferTokensInstructionsArgs } from "../instructions"; import type { TransactionBuilderInput } from "./types"; type GetTransferTokensTransactionInput = Simplify<Omit<GetTransferTokensInstructionsArgs, "sourceAta" | "destinationAta"> & Partial<Pick<GetTransferTokensInstructionsArgs, "sourceAta" | "destinationAta">>>; /** * 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` * * @remarks * * - transferring without creating the ata is generally < 10_000cu * - validating the ata onchain during creation results in a ~15000cu fluctuation * * @example * ``` * const destination = address(...); * * const transferTokensTx = await buildTransferTokensTransaction({ * feePayer: signer, * latestBlockhash, * mint, * authority: signer, * amount: 900, // note: be sure to consider the mint's `decimals` value * // if decimals=2 => this will transfer 9.00 tokens * // if decimals=4 => this will transfer 0.090 tokens * destination, * // use the correct token program for the `mint` * tokenProgram, // default=TOKEN_PROGRAM_ADDRESS * // default cu limit set to be optimized, but can be overridden here * // computeUnitLimit?: number, * // obtain from your favorite priority fee api * // computeUnitPrice?: number, // no default set * }); * ``` */ export declare function buildTransferTokensTransaction<TVersion extends TransactionVersion = "legacy", TFeePayer extends TransactionSigner = TransactionSigner>(args: TransactionBuilderInput<TVersion, TFeePayer> & GetTransferTokensTransactionInput): Promise<FullTransaction<TVersion, ITransactionMessageWithFeePayer>>; export declare function buildTransferTokensTransaction<TVersion extends TransactionVersion = "legacy", TFeePayer extends TransactionSigner = TransactionSigner, TLifetimeConstraint extends TransactionMessageWithBlockhashLifetime["lifetimeConstraint"] = TransactionMessageWithBlockhashLifetime["lifetimeConstraint"]>(args: TransactionBuilderInput<TVersion, TFeePayer, TLifetimeConstraint> & GetTransferTokensTransactionInput): Promise<FullTransaction<TVersion, ITransactionMessageWithFeePayer, TransactionMessageWithBlockhashLifetime>>; export {}; //# sourceMappingURL=transfer-tokens.d.ts.map