solana-token-extension-boost
Version:
SDK for Solana Token Extensions with wallet adapter support
66 lines (65 loc) • 2.11 kB
TypeScript
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
import { AccountState } from "@solana/spl-token";
export declare class TokenAccount {
connection: Connection;
mint: PublicKey;
owner: PublicKey;
constructor(connection: Connection, mint: PublicKey, owner: PublicKey);
/**
* Create a standard token account
*
* @param payer - Transaction fee payer
* @returns Token account information
*/
createAccount(payer: Keypair): Promise<{
tokenAccount: PublicKey;
tokenAccountKeypair: Keypair;
signature: string;
}>;
/**
* Create a token account with immutable owner extension
*
* @param payer - Transaction fee payer
* @returns Token account information
*/
createAccountWithImmutableOwner(payer: Keypair): Promise<{
tokenAccount: PublicKey;
tokenAccountKeypair: Keypair;
signature: string;
}>;
/**
* Create an Associated Token Account
* Note: ATAs already have immutable owner built-in
*
* @param payer - Transaction fee payer
* @returns Token account information
*/
createAssociatedTokenAccount(payer: Keypair): Promise<{
tokenAccount: PublicKey;
signature: string;
}>;
/**
* Create a token account with immutable owner using the helper function
* Alternative method using the SPL-token helper
*
* @param payer - Transaction fee payer
* @returns Token account information
*/
createAccountWithImmutableOwnerAlt(payer: Keypair): Promise<{
tokenAccount: PublicKey;
signature: string;
}>;
/**
* Create an account with default state
* This allows setting a default state for the account (e.g., frozen)
*
* @param payer - Transaction fee payer
* @param state - Default account state
* @returns Token account information
*/
createAccountWithDefaultState(payer: Keypair, state: AccountState): Promise<{
tokenAccount: PublicKey;
tokenAccountKeypair: Keypair;
signature: string;
}>;
}