Options
All
  • Public
  • Public/Protected
  • All
Menu

@solana/spl-token

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

TODO: docs

RawMultisig: Omit<Multisig, "address">

Multisig as stored by the program

Variables

ACCOUNT_SIZE: number = AccountLayout.span

Byte length of a token account

ASSOCIATED_TOKEN_PROGRAM_ID: PublicKey = ...

Address of the SPL Associated Token Account program

AccountLayout: Structure<RawAccount> = ...

Buffer layout for de/serializing a token account

MINT_SIZE: number = MintLayout.span

Byte length of a mint

MULTISIG_SIZE: number = MultisigLayout.span

Byte length of a multisig

MintLayout: Structure<RawMint> = ...

Buffer layout for de/serializing a mint

MultisigLayout: Structure<RawMultisig> = ...

Buffer layout for de/serializing a multisig

NATIVE_MINT: PublicKey = ...

Address of the special mint for wrapped native SOL

TOKEN_PROGRAM_ID: PublicKey = ...

Address of the SPL Token program

approveCheckedInstructionData: Structure<ApproveCheckedInstructionData> = ...

TODO: docs

approveInstructionData: Structure<ApproveInstructionData> = ...

TODO: docs

burnCheckedInstructionData: Structure<BurnCheckedInstructionData> = ...

TODO: docs

burnInstructionData: Structure<BurnInstructionData> = ...

TODO: docs

closeAccountInstructionData: Structure<CloseAccountInstructionData> = ...

TODO: docs

freezeAccountInstructionData: Structure<FreezeAccountInstructionData> = ...

TODO: docs

initializeAccountInstructionData: Structure<InitializeAccountInstructionData> = ...

TODO: docs

initializeMintInstructionData: Structure<InitializeMintInstructionData> = ...

TODO: docs

initializeMultisigInstructionData: Structure<InitializeMultisigInstructionData> = ...

TODO: docs

mintToCheckedInstructionData: Structure<MintToCheckedInstructionData> = ...

TODO: docs

mintToInstructionData: Structure<MintToInstructionData> = ...

TODO: docs

revokeInstructionData: Structure<RevokeInstructionData> = ...

TODO: docs

setAuthorityInstructionData: Structure<SetAuthorityInstructionData> = ...

TODO: docs

syncNativeInstructionData: Structure<SyncNativeInstructionData> = ...

TODO: docs

thawAccountInstructionData: Structure<ThawAccountInstructionData> = ...

TODO: docs

transferCheckedInstructionData: Structure<TransferCheckedInstructionData> = ...

TODO: docs

transferInstructionData: Structure<TransferInstructionData> = ...

TODO: docs

Functions

  • approve(connection: Connection, payer: Signer, account: PublicKey, delegate: PublicKey, owner: PublicKey | Signer, amount: number | bigint, multiSigners?: Signer[], confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<TransactionSignature>
  • Approve a delegate to transfer up to a maximum number of tokens from an account

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction fees

    • account: PublicKey

      Address of the token account

    • delegate: PublicKey

      Account authorized to transfer tokens from the account

    • owner: PublicKey | Signer

      Owner of the account

    • amount: number | bigint

      Maximum number of tokens the delegate may transfer

    • multiSigners: Signer[] = []

      Signing accounts if owner is a multisig

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<TransactionSignature>

    Signature of the confirmed transaction

  • approveChecked(connection: Connection, payer: Signer, mint: PublicKey, account: PublicKey, delegate: PublicKey, owner: PublicKey | Signer, amount: number | bigint, decimals: number, multiSigners?: Signer[], confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<TransactionSignature>
  • Approve a delegate to transfer up to a maximum number of tokens from an account, asserting the token mint and decimals

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction fees

    • mint: PublicKey
    • account: PublicKey

      Address of the account

    • delegate: PublicKey

      Account authorized to perform a transfer tokens from the source account

    • owner: PublicKey | Signer

      Owner of the source account

    • amount: number | bigint

      Maximum number of tokens the delegate may transfer

    • decimals: number

      Number of decimals in approve amount

    • multiSigners: Signer[] = []

      Signing accounts if owner is a multisig

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<TransactionSignature>

    Signature of the confirmed transaction

  • burn(connection: Connection, payer: Signer, account: PublicKey, mint: PublicKey, owner: PublicKey | Signer, amount: number | bigint, multiSigners?: Signer[], confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<TransactionSignature>
  • Burn tokens from an account

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction fees

    • account: PublicKey

      Account to burn tokens from

    • mint: PublicKey

      Mint for the account

    • owner: PublicKey | Signer

      Account owner

    • amount: number | bigint

      Amount to burn

    • multiSigners: Signer[] = []

      Signing accounts if owner is a multisig

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<TransactionSignature>

    Signature of the confirmed transaction

  • burnChecked(connection: Connection, payer: Signer, account: PublicKey, mint: PublicKey, owner: PublicKey | Signer, amount: number | bigint, decimals: number, multiSigners?: Signer[], confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<TransactionSignature>
  • Burn tokens from an account, asserting the token mint and decimals

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction fees

    • account: PublicKey

      Account to burn tokens from

    • mint: PublicKey

      Mint for the account

    • owner: PublicKey | Signer

      Account owner

    • amount: number | bigint

      Amount to burn

    • decimals: number

      Number of decimals in amount to burn

    • multiSigners: Signer[] = []

      Signing accounts if owner is a multisig

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<TransactionSignature>

    Signature of the confirmed transaction

  • closeAccount(connection: Connection, payer: Signer, account: PublicKey, destination: PublicKey, authority: PublicKey | Signer, multiSigners?: Signer[], confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<TransactionSignature>
  • Close a token account

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction fees

    • account: PublicKey

      Account to close

    • destination: PublicKey

      Account to receive the remaining balance of the closed account

    • authority: PublicKey | Signer

      Authority which is allowed to close the account

    • multiSigners: Signer[] = []

      Signing accounts if authority is a multisig

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<TransactionSignature>

    Signature of the confirmed transaction

  • createAccount(connection: Connection, payer: Signer, mint: PublicKey, owner: PublicKey, keypair?: Keypair, confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<PublicKey>
  • Create and initialize a new token account

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction and initialization fees

    • mint: PublicKey

      Mint for the account

    • owner: PublicKey

      Owner of the new account

    • Optional keypair: Keypair

      Optional keypair, defaulting to the associated token account for the mint and owner

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<PublicKey>

    Address of the new token account

  • createApproveCheckedInstruction(account: PublicKey, mint: PublicKey, delegate: PublicKey, owner: PublicKey, amount: number | bigint, decimals: number, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction
  • Construct an ApproveChecked instruction

    Parameters

    • account: PublicKey

      Account to set the delegate for

    • mint: PublicKey

      Mint account

    • delegate: PublicKey

      Account authorized to transfer of tokens from the account

    • owner: PublicKey

      Owner of the account

    • amount: number | bigint

      Maximum number of tokens the delegate may transfer

    • decimals: number

      Number of decimals in approve amount

    • multiSigners: Signer[] = []

      Signing accounts if owner is a multisig

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createApproveInstruction(account: PublicKey, delegate: PublicKey, owner: PublicKey, amount: number | bigint, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction
  • Construct an Approve instruction

    Parameters

    • account: PublicKey

      Account to set the delegate for

    • delegate: PublicKey

      Account authorized to transfer tokens from the account

    • owner: PublicKey

      Owner of the account

    • amount: number | bigint

      Maximum number of tokens the delegate may transfer

    • multiSigners: Signer[] = []

      Signing accounts if owner is a multisig

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createAssociatedTokenAccount(connection: Connection, payer: Signer, mint: PublicKey, owner: PublicKey, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey): Promise<PublicKey>
  • Create and initialize a new associated token account

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction and initialization fees

    • mint: PublicKey

      Mint for the account

    • owner: PublicKey

      Owner of the new account

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    • associatedTokenProgramId: PublicKey = ASSOCIATED_TOKEN_PROGRAM_ID

      SPL Associated Token program account

    Returns Promise<PublicKey>

    Address of the new associated token account

  • createAssociatedTokenAccountInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey): TransactionInstruction
  • Construct an AssociatedTokenAccount instruction

    Parameters

    • payer: PublicKey

      Payer of the initialization fees

    • associatedToken: PublicKey

      New associated token account

    • owner: PublicKey

      Owner of the new account

    • mint: PublicKey

      Token mint account

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    • associatedTokenProgramId: PublicKey = ASSOCIATED_TOKEN_PROGRAM_ID

      SPL Associated Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createBurnCheckedInstruction(account: PublicKey, mint: PublicKey, owner: PublicKey, amount: number | bigint, decimals: number, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction
  • Construct a BurnChecked instruction

    Parameters

    • account: PublicKey

      Account to burn tokens from

    • mint: PublicKey

      Mint for the account

    • owner: PublicKey

      Owner of the account

    • amount: number | bigint

      Number of tokens to burn

    • decimals: number

      Number of decimals in burn amount

    • multiSigners: Signer[] = []

      Signing accounts if owner is a multisig

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createBurnInstruction(account: PublicKey, mint: PublicKey, owner: PublicKey, amount: number | bigint, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction
  • Construct a Burn instruction

    Parameters

    • account: PublicKey

      Account to burn tokens from

    • mint: PublicKey

      Mint for the account

    • owner: PublicKey

      Owner of the account

    • amount: number | bigint

      Number of tokens to burn

    • multiSigners: Signer[] = []

      Signing accounts if owner is a multisig

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createCloseAccountInstruction(account: PublicKey, destination: PublicKey, authority: PublicKey, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction
  • Construct a CloseAccount instruction

    Parameters

    • account: PublicKey

      Account to close

    • destination: PublicKey

      Account to receive the remaining balance of the closed account

    • authority: PublicKey

      Account close authority

    • multiSigners: Signer[] = []

      Signing accounts if authority is a multisig

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createFreezeAccountInstruction(account: PublicKey, mint: PublicKey, authority: PublicKey, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction
  • Construct a FreezeAccount instruction

    Parameters

    • account: PublicKey

      Account to freeze

    • mint: PublicKey

      Mint account

    • authority: PublicKey

      Mint freeze authority

    • multiSigners: Signer[] = []

      Signing accounts if authority is a multisig

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createInitializeAccountInstruction(account: PublicKey, mint: PublicKey, owner: PublicKey, programId?: PublicKey): TransactionInstruction
  • Construct an InitializeAccount instruction

    Parameters

    • account: PublicKey

      New token account

    • mint: PublicKey

      Mint account

    • owner: PublicKey

      Owner of the new account

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createInitializeMintInstruction(mint: PublicKey, decimals: number, mintAuthority: PublicKey, freezeAuthority: null | PublicKey, programId?: PublicKey): TransactionInstruction
  • Construct an InitializeMint instruction

    Parameters

    • mint: PublicKey

      Token mint account

    • decimals: number

      Number of decimals in token account amounts

    • mintAuthority: PublicKey

      Minting authority

    • freezeAuthority: null | PublicKey

      Optional authority that can freeze token accounts

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createInitializeMultisigInstruction(account: PublicKey, signers: PublicKey[], m: number, programId?: PublicKey): TransactionInstruction
  • Construct an InitializeMultisig instruction

    Parameters

    • account: PublicKey

      Multisig account

    • signers: PublicKey[]

      Full set of signers

    • m: number

      Number of required signatures

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createMint(connection: Connection, payer: Signer, mintAuthority: PublicKey, freezeAuthority: null | PublicKey, decimals: number, keypair?: Keypair, confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<PublicKey>
  • Create and initialize a new mint

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction and initialization fees

    • mintAuthority: PublicKey

      Account or multisig that will control minting

    • freezeAuthority: null | PublicKey

      Optional account or multisig that can freeze token accounts

    • decimals: number

      Location of the decimal place

    • keypair: Keypair = ...

      Optional keypair, defaulting to a new random one

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<PublicKey>

    Address of the new mint

  • createMintToCheckedInstruction(mint: PublicKey, destination: PublicKey, authority: PublicKey, amount: number | bigint, decimals: number, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction
  • Construct a MintToChecked instruction

    Parameters

    • mint: PublicKey

      Public key of the mint

    • destination: PublicKey

      Address of the token account to mint to

    • authority: PublicKey

      The mint authority

    • amount: number | bigint

      Amount to mint

    • decimals: number

      Number of decimals in amount to mint

    • multiSigners: Signer[] = []

      Signing accounts if authority is a multisig

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createMintToInstruction(mint: PublicKey, destination: PublicKey, authority: PublicKey, amount: number | bigint, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction
  • Construct a MintTo instruction

    Parameters

    • mint: PublicKey

      Public key of the mint

    • destination: PublicKey

      Address of the token account to mint to

    • authority: PublicKey

      The mint authority

    • amount: number | bigint

      Amount to mint

    • multiSigners: Signer[] = []

      Signing accounts if authority is a multisig

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createMultisig(connection: Connection, payer: Signer, signers: PublicKey[], m: number, keypair?: Keypair, confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<PublicKey>
  • Create and initialize a new multisig

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction and initialization fees

    • signers: PublicKey[]

      Full set of signers

    • m: number

      Number of required signatures

    • keypair: Keypair = ...

      Optional keypair, defaulting to a new random one

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<PublicKey>

    Address of the new multisig

  • createRevokeInstruction(account: PublicKey, owner: PublicKey, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction
  • Construct a Revoke instruction

    Parameters

    • account: PublicKey

      Address of the token account

    • owner: PublicKey

      Owner of the account

    • multiSigners: Signer[] = []

      Signing accounts if owner is a multisig

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createSetAuthorityInstruction(account: PublicKey, currentAuthority: PublicKey, authorityType: AuthorityType, newAuthority: null | PublicKey, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction
  • Construct a SetAuthority instruction

    Parameters

    • account: PublicKey

      Address of the token account

    • currentAuthority: PublicKey

      Current authority of the specified type

    • authorityType: AuthorityType

      Type of authority to set

    • newAuthority: null | PublicKey

      New authority of the account

    • multiSigners: Signer[] = []

      Signing accounts if currentAuthority is a multisig

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createSyncNativeInstruction(account: PublicKey, programId?: PublicKey): TransactionInstruction
  • Construct a SyncNative instruction

    Parameters

    • account: PublicKey

      Native account to sync lamports from

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createThawAccountInstruction(account: PublicKey, mint: PublicKey, authority: PublicKey, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction
  • Construct a ThawAccount instruction

    Parameters

    • account: PublicKey

      Account to thaw

    • mint: PublicKey

      Mint account

    • authority: PublicKey

      Mint freeze authority

    • multiSigners: Signer[] = []

      Signing accounts if authority is a multisig

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createTransferCheckedInstruction(source: PublicKey, mint: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, decimals: number, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction
  • Construct a TransferChecked instruction

    Parameters

    • source: PublicKey

      Source account

    • mint: PublicKey

      Mint account

    • destination: PublicKey

      Destination account

    • owner: PublicKey

      Owner of the source account

    • amount: number | bigint

      Number of tokens to transfer

    • decimals: number

      Number of decimals in transfer amount

    • multiSigners: Signer[] = []

      Signing accounts if owner is a multisig

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createTransferInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, multiSigners?: Signer[], programId?: PublicKey): TransactionInstruction
  • Construct a Transfer instruction

    Parameters

    • source: PublicKey

      Source account

    • destination: PublicKey

      Destination account

    • owner: PublicKey

      Owner of the source account

    • amount: number | bigint

      Number of tokens to transfer

    • multiSigners: Signer[] = []

      Signing accounts if owner is a multisig

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns TransactionInstruction

    Instruction to add to a transaction

  • createWrappedNativeAccount(connection: Connection, payer: Signer, owner: PublicKey, amount: number, keypair?: Keypair, confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<PublicKey>
  • Create, initialize, and fund a new wrapped native SOL account

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction and initialization fees

    • owner: PublicKey

      Owner of the new token account

    • amount: number

      Number of lamports to wrap

    • Optional keypair: Keypair

      Optional keypair, defaulting to the associated token account for the native mint and owner

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<PublicKey>

    Address of the new wrapped native SOL account

  • Decode an Approve instruction and validate it

    Parameters

    • instruction: TransactionInstruction

      Transaction instruction to decode

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns DecodedApproveInstruction

    Decoded, valid instruction

  • Decode a Burn instruction and validate it

    Parameters

    • instruction: TransactionInstruction

      Transaction instruction to decode

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns DecodedBurnInstruction

    Decoded, valid instruction

  • decodeInstruction(instruction: TransactionInstruction, programId?: PublicKey): DecodedInstruction
  • Decode a MintTo instruction and validate it

    Parameters

    • instruction: TransactionInstruction

      Transaction instruction to decode

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns DecodedMintToInstruction

    Decoded, valid instruction

  • Decode a Revoke instruction and validate it

    Parameters

    • instruction: TransactionInstruction

      Transaction instruction to decode

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns DecodedRevokeInstruction

    Decoded, valid instruction

  • Decode a Transfer instruction and validate it

    Parameters

    • instruction: TransactionInstruction

      Transaction instruction to decode

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns DecodedTransferInstruction

    Decoded, valid instruction

  • freezeAccount(connection: Connection, payer: Signer, account: PublicKey, mint: PublicKey, authority: PublicKey | Signer, multiSigners?: Signer[], confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<TransactionSignature>
  • Freeze a token account

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction fees

    • account: PublicKey

      Account to freeze

    • mint: PublicKey

      Mint for the account

    • authority: PublicKey | Signer

      Mint freeze authority

    • multiSigners: Signer[] = []

      Signing accounts if authority is a multisig

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<TransactionSignature>

    Signature of the confirmed transaction

  • getAccount(connection: Connection, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<Account>
  • Retrieve information about a token account

    Parameters

    • connection: Connection

      Connection to use

    • address: PublicKey

      Token account

    • Optional commitment: Commitment

      Desired level of commitment for querying the state

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<Account>

    Token account information

  • getAssociatedTokenAddress(mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, programId?: PublicKey, associatedTokenProgramId?: PublicKey): Promise<PublicKey>
  • Get the address of the associated token account for a given mint and owner

    Parameters

    • mint: PublicKey

      Token mint account

    • owner: PublicKey

      Owner of the new account

    • allowOwnerOffCurve: boolean = false

      Allow the owner account to be a PDA (Program Derived Address)

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    • associatedTokenProgramId: PublicKey = ASSOCIATED_TOKEN_PROGRAM_ID

      SPL Associated Token program account

    Returns Promise<PublicKey>

    Address of the associated token account

  • getMinimumBalanceForRentExemptAccount(connection: Connection, commitment?: Commitment): Promise<number>
  • Get the minimum lamport balance for a token account to be rent exempt

    Parameters

    • connection: Connection

      Connection to use

    • Optional commitment: Commitment

      Desired level of commitment for querying the state

    Returns Promise<number>

    Amount of lamports required

  • getMinimumBalanceForRentExemptMint(connection: Connection, commitment?: Commitment): Promise<number>
  • Get the minimum lamport balance for a mint to be rent exempt

    Parameters

    • connection: Connection

      Connection to use

    • Optional commitment: Commitment

      Desired level of commitment for querying the state

    Returns Promise<number>

    Amount of lamports required

  • getMinimumBalanceForRentExemptMultisig(connection: Connection, commitment?: Commitment): Promise<number>
  • Get the minimum lamport balance for a multisig to be rent exempt

    Parameters

    • connection: Connection

      Connection to use

    • Optional commitment: Commitment

      Desired level of commitment for querying the state

    Returns Promise<number>

    Amount of lamports required

  • getMint(connection: Connection, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<Mint>
  • Retrieve information about a mint

    Parameters

    • connection: Connection

      Connection to use

    • address: PublicKey

      Mint account

    • Optional commitment: Commitment

      Desired level of commitment for querying the state

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<Mint>

    Mint information

  • getMultisig(connection: Connection, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<Multisig>
  • Retrieve information about a multisig

    Parameters

    • connection: Connection

      Connection to use

    • address: PublicKey

      Multisig account

    • Optional commitment: Commitment

      Desired level of commitment for querying the state

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<Multisig>

    Multisig information

  • getOrCreateAssociatedTokenAccount(connection: Connection, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, commitment?: Commitment, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey): Promise<Account>
  • Retrieve the associated token account, or create it if it doesn't exist

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction and initialization fees

    • mint: PublicKey

      Mint associated with the account to set or verify

    • owner: PublicKey

      Owner of the account to set or verify

    • allowOwnerOffCurve: boolean = false

      Allow the owner account to be a PDA (Program Derived Address)

    • Optional commitment: Commitment

      Desired level of commitment for querying the state

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    • associatedTokenProgramId: PublicKey = ASSOCIATED_TOKEN_PROGRAM_ID

      SPL Associated Token program account

    Returns Promise<Account>

    Address of the new associated token account

  • mintTo(connection: Connection, payer: Signer, mint: PublicKey, destination: PublicKey, authority: PublicKey | Signer, amount: number | bigint, multiSigners?: Signer[], confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<TransactionSignature>
  • Mint tokens to an account

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction fees

    • mint: PublicKey

      Mint for the account

    • destination: PublicKey

      Address of the account to mint to

    • authority: PublicKey | Signer

      Minting authority

    • amount: number | bigint

      Amount to mint

    • multiSigners: Signer[] = []

      Signing accounts if authority is a multisig

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<TransactionSignature>

    Signature of the confirmed transaction

  • mintToChecked(connection: Connection, payer: Signer, mint: PublicKey, destination: PublicKey, authority: PublicKey | Signer, amount: number | bigint, decimals: number, multiSigners?: Signer[], confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<TransactionSignature>
  • Mint tokens to an account, asserting the token mint and decimals

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction fees

    • mint: PublicKey

      Mint for the account

    • destination: PublicKey

      Address of the account to mint to

    • authority: PublicKey | Signer

      Minting authority

    • amount: number | bigint

      Amount to mint

    • decimals: number

      Number of decimals in amount to mint

    • multiSigners: Signer[] = []

      Signing accounts if authority is a multisig

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<TransactionSignature>

    Signature of the confirmed transaction

  • revoke(connection: Connection, payer: Signer, account: PublicKey, owner: PublicKey | Signer, multiSigners?: Signer[], confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<TransactionSignature>
  • Revoke approval for the transfer of tokens from an account

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction fees

    • account: PublicKey

      Address of the token account

    • owner: PublicKey | Signer

      Owner of the account

    • multiSigners: Signer[] = []

      Signing accounts if owner is a multisig

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<TransactionSignature>

    Signature of the confirmed transaction

  • setAuthority(connection: Connection, payer: Signer, account: PublicKey, currentAuthority: PublicKey | Signer, authorityType: AuthorityType, newAuthority: null | PublicKey, multiSigners?: Signer[], confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<TransactionSignature>
  • Assign a new authority to the account

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction fees

    • account: PublicKey

      Address of the account

    • currentAuthority: PublicKey | Signer

      Current authority of the specified type

    • authorityType: AuthorityType

      Type of authority to set

    • newAuthority: null | PublicKey

      New authority of the account

    • multiSigners: Signer[] = []

      Signing accounts if currentAuthority is a multisig

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<TransactionSignature>

    Signature of the confirmed transaction

  • syncNative(connection: Connection, payer: Signer, account: PublicKey, confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<TransactionSignature>
  • Sync the balance of a native SPL token account to the underlying system account's lamports

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction fees

    • account: PublicKey

      Native account to sync

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<TransactionSignature>

    Signature of the confirmed transaction

  • thawAccount(connection: Connection, payer: Signer, account: PublicKey, mint: PublicKey, authority: PublicKey | Signer, multiSigners?: Signer[], confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<TransactionSignature>
  • Thaw (unfreeze) a token account

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction fees

    • account: PublicKey

      Account to thaw

    • mint: PublicKey

      Mint for the account

    • authority: PublicKey | Signer

      Mint freeze authority

    • multiSigners: Signer[] = []

      Signing accounts if authority is a multisig

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<TransactionSignature>

    Signature of the confirmed transaction

  • transfer(connection: Connection, payer: Signer, source: PublicKey, destination: PublicKey, owner: PublicKey | Signer, amount: number | bigint, multiSigners?: Signer[], confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<TransactionSignature>
  • Transfer tokens from one account to another

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction fees

    • source: PublicKey

      Source account

    • destination: PublicKey

      Destination account

    • owner: PublicKey | Signer

      Owner of the source account

    • amount: number | bigint

      Number of tokens to transfer

    • multiSigners: Signer[] = []

      Signing accounts if owner is a multisig

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<TransactionSignature>

    Signature of the confirmed transaction

  • transferChecked(connection: Connection, payer: Signer, source: PublicKey, mint: PublicKey, destination: PublicKey, owner: PublicKey | Signer, amount: number | bigint, decimals: number, multiSigners?: Signer[], confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<TransactionSignature>
  • Transfer tokens from one account to another, asserting the token mint and decimals

    Parameters

    • connection: Connection

      Connection to use

    • payer: Signer

      Payer of the transaction fees

    • source: PublicKey

      Source account

    • mint: PublicKey

      Mint for the account

    • destination: PublicKey

      Destination account

    • owner: PublicKey | Signer

      Owner of the source account

    • amount: number | bigint

      Number of tokens to transfer

    • decimals: number

      Number of decimals in transfer amount

    • multiSigners: Signer[] = []

      Signing accounts if owner is a multisig

    • Optional confirmOptions: ConfirmOptions

      Options for confirming the transaction

    • programId: PublicKey = TOKEN_PROGRAM_ID

      SPL Token program account

    Returns Promise<TransactionSignature>

    Signature of the confirmed transaction

Generated using TypeDoc