UNPKG

@gorbchain-xyz/chaindecode

Version:

GorbchainSDK V1.3+ - Complete Solana development toolkit with advanced cryptography, messaging, and collaboration features. Build secure applications with blockchain, DeFi, and end-to-end encryption.

133 lines (132 loc) 3.53 kB
import type { DecodedInstruction } from './registry.js'; interface NFTInstructionData { programId: string; data: Uint8Array; accounts: string[]; } export interface NFTMetadata { name: string; symbol: string; uri: string; sellerFeeBasisPoints: number; creators: Array<{ address: string; verified: boolean; share: number; }>; collection?: { verified: boolean; key: string; }; uses?: { useMethod: string; remaining: number; total: number; }; } export interface NFTTokenInfo { isNFT: boolean; mintAddress: string; supply: string; decimals: number; metadata?: NFTMetadata; isCollection?: boolean; isMasterEdition?: boolean; } export declare enum MetaplexInstruction { CreateMetadataAccount = 0, UpdateMetadataAccount = 1, DeprecatedCreateMasterEdition = 2, DeprecatedMintNewEditionFromMasterEditionViaPrintingToken = 3, UpdatePrimarySaleHappenedViaToken = 4, DeprecatedSetReservationList = 5, DeprecatedCreateReservationList = 6, SignMetadata = 7, DeprecatedMintPrintingTokensViaToken = 8, DeprecatedMintPrintingTokens = 9, CreateMasterEdition = 10, MintNewEditionFromMasterEditionViaToken = 11, ConvertMasterEditionV1ToV2 = 12, MintNewEditionFromMasterEditionViaVaultProxy = 13, PuffMetadata = 14, UpdateMetadataAccountV2 = 15, CreateMetadataAccountV2 = 16, CreateMasterEditionV3 = 17, VerifyCollection = 18, Utilize = 19, ApproveUseAuthority = 20, RevokeUseAuthority = 21, UnverifyCollection = 22, ApproveCollectionAuthority = 23, RevokeCollectionAuthority = 24, SetAndVerifyCollection = 25, FreezeDelegatedAccount = 26, ThawDelegatedAccount = 27, RemoveCreatorVerification = 28, BurnNft = 29, VerifyCreator = 30, UnverifyCreator = 31, CreateMetadataAccountV3 = 32, SetCollectionSize = 33, SetTokenStandard = 34, BubblegumSetCollectionSize = 35, BurnEditionNft = 36, CreateEscrowAccount = 37, CloseEscrowAccount = 38, TransferOutOfEscrow = 39, Burn = 40, Create = 41, Mint = 42, Delegate = 43, Revoke = 44, Lock = 45, Unlock = 46, Migrate = 47, Transfer = 48, Update = 49, Use = 50, Verify = 51, Unverify = 52 } /** * Main NFT/Metaplex decoder function */ export declare function decodeNFTInstruction(instruction: NFTInstructionData): DecodedInstruction; /** * Enhanced NFT instruction decoder with metadata extraction */ export declare function decodeNFTInstructionWithDetails(data: Uint8Array): { type: string; instruction: string; nftDetails?: { metadataUri?: string; name?: string; symbol?: string; isCollection?: boolean; isMasterEdition?: boolean; }; accounts: string[]; }; /** * Check if a token is an NFT based on its characteristics */ export declare function isNFTToken(tokenInfo: { supply: string; decimals: number; mintAuthority?: string | null; freezeAuthority?: string | null; }): boolean; /** * Check if a token is a strict standard NFT (following Metaplex standards) */ export declare function isStandardNFT(tokenInfo: { supply: string; decimals: number; mintAuthority?: string | null; freezeAuthority?: string | null; }): boolean; /** * Get NFT metadata from URI */ export declare function fetchNFTMetadata(uri: string): Promise<NFTMetadata | null>; export {};