UNPKG

solana-token-extension-boost

Version:

SDK for Solana Token Extensions with wallet adapter support

83 lines (82 loc) 3.07 kB
import { Connection, Keypair, PublicKey, TransactionInstruction } from "@solana/web3.js"; import { Token } from "../../core/token"; /** * NonTransferableToken - Extension for non-transferable tokens * * This extension prevents tokens from being transferred after they've been minted. * Useful for credentials, certificates, soulbound tokens, and other non-transferable assets. */ export declare class NonTransferableToken extends Token { constructor(connection: Connection, mint: PublicKey); /** * Create instructions for a new NonTransferableToken * * @param connection - Connection to Solana cluster * @param payer - Public key of the transaction fee payer * @param params - Initialization parameters including: * - decimals: Number of decimal places * - mintAuthority: Authority allowed to mint tokens * - freezeAuthority: Optional authority allowed to freeze accounts * @returns Instructions, signers and mint address for the new token */ static createInstructions(connection: Connection, payer: PublicKey, params: { decimals: number; mintAuthority: PublicKey; freezeAuthority?: PublicKey | null; }): Promise<{ instructions: TransactionInstruction[]; signers: Keypair[]; mint: PublicKey; }>; /** * Create instructions to mint to an account * * @param destination - Token account address to receive tokens * @param authority - Authority allowed to mint tokens * @param amount - Amount of tokens to mint * @returns Object containing instructions */ createMintToInstructions(destination: PublicKey, authority: PublicKey, amount: bigint): { instructions: TransactionInstruction[]; }; /** * Create instructions to mint to an account (extended version) * * @param owner - Token account owner * @param amount - Amount of tokens to mint * @param mintAuthority - Authority allowed to mint tokens * @returns Instructions and token account address */ createMintToInstructionsWithAddress(owner: PublicKey, amount: bigint, mintAuthority: PublicKey): Promise<{ instructions: TransactionInstruction[]; address: PublicKey; }>; /** * Check if the token is non-transferable * * @returns Promise resolving to boolean */ isNonTransferable(): Promise<boolean>; /** * Get mint information * * @returns Mint information */ getMintInfo(): Promise<any>; /** * Get non-transferable information * * @returns Object with isNonTransferable property */ getNonTransferableInfo(): Promise<{ isNonTransferable: boolean; }>; /** * Check if tokens can be transferred from a token account * For non-transferable tokens, this will always return false * * @param tokenAccount - Token account to check * @returns Boolean indicating if tokens can be transferred */ canTransferTokens(tokenAccount: PublicKey): Promise<boolean>; }