UNPKG

ecash-lib

Version:

Library for eCash transaction building

91 lines 3.32 kB
import { Script } from '../script.js'; import { BURN_STR, GENESIS_STR, GenesisInfo, MINT_STR, SEND_STR, UNKNOWN_STR } from './common.js'; import { SLP_FUNGIBLE, SLP_MINT_VAULT, SLP_NFT1_GROUP, SlpTokenType_Number } from './slp.js'; /** Parsed SLP GENESIS OP_RETURN Script */ export interface SlpGenesis { /** "GENESIS" */ txType: typeof GENESIS_STR; /** Token type of the token to create */ tokenType: SlpTokenType_Number; /** Info about the token */ genesisInfo: GenesisInfo; /** Number of token atoms to initially mint to out_idx=1 */ initialAtoms: bigint; /** Output index to send the mint baton to, or undefined if none */ mintBatonOutIdx?: number; } /** * Parsed SLP MINT (token type 0x01 and 0x81) OP_RETURN Script. * Note: Token type 0x41 has no mint batons. **/ export interface SlpMintClassic { /** "MINT" */ txType: typeof MINT_STR; /** Token type of the token to mint */ tokenType: typeof SLP_FUNGIBLE | typeof SLP_NFT1_GROUP; /** Token ID of the token to mint */ tokenId: string; /** Number of token atoms to mint to out_idx=1 */ additionalAtoms: bigint; /** Output index to send the mint baton to, or undefined to destroy it */ mintBatonOutIdx?: number; } /** Parsed SLP MINT (token type 0x02) OP_RETURN Script */ export interface SlpMintVault { /** "MINT" */ txType: typeof MINT_STR; /** Token type of the token to mint (0x02) */ tokenType: typeof SLP_MINT_VAULT; /** Token ID of the token to mint */ tokenId: string; /** Array of the number of token atoms to mint to the outputs at 1 to N */ additionalAtomsArray: bigint[]; } /** Parsed SLP MINT OP_RETURN Script */ export type SlpMint = SlpMintClassic | SlpMintVault; /** Parsed SLP SEND OP_RETURN Script */ export interface SlpSend { /** "SEND" */ txType: typeof SEND_STR; /** Token type of the token to send */ tokenType: SlpTokenType_Number; /** Token ID of the token to send */ tokenId: string; /** Array of the number of token atoms to send to the outputs at 1 to N */ sendAtomsArray: bigint[]; } /** Parsed SLP BURN OP_RETURN Script */ export interface SlpBurn { /** "BURN" */ txType: typeof BURN_STR; /** Token type of the token to burn */ tokenType: SlpTokenType_Number; /** Token ID of the token to burn */ tokenId: string; /** How many tokens should be burned */ burnAtoms: bigint; } /** New unknown SLP token type or tx type */ export interface SlpUnknown { /** Placeholder for unknown token type or tx type */ txType: typeof UNKNOWN_STR; /** Token type number */ tokenType: number; } /** Parsed SLP OP_RETURN Script */ export type SlpData = SlpGenesis | SlpMint | SlpSend | SlpBurn | SlpUnknown; /** * Parse the given SLP OP_RETURN Script. * * For data that's clearly not SLP it will return `undefined`. * For example, if the OP_RETURN or LOKAD ID is missing. * * For an unknown token type, it'll return SlpUnknown. * * For a known token type, it'll parse the remaining data, or throw an error if * the format is invalid or if there's an unknown tx type. * * This behavior mirrors that of Chronik for consistency. **/ export declare function parseSlp(opreturnScript: Script): SlpData | undefined; //# sourceMappingURL=slp.parse.d.ts.map