UNPKG

ecash-lib

Version:

Library for eCash transaction building

73 lines 2.44 kB
import { AlpTokenType_Number, MintData } from './alp.js'; import { BURN_STR, GENESIS_STR, GenesisInfo, MINT_STR, SEND_STR, UNKNOWN_STR } from './common.js'; /** * Parsed ALP GENESIS pushdata. * Note: This must always be the first eMPP pushdata. **/ export interface AlpGenesis { /** "GENESIS" */ txType: typeof GENESIS_STR; /** Token type of the token to create */ tokenType: AlpTokenType_Number; /** Info about the token */ genesisInfo: GenesisInfo; /** Which tokens/mint baton to create initially */ mintData: MintData; } /** Parsed ALP MINT pushdata. */ export interface AlpMint { /** "MINT" */ txType: typeof MINT_STR; /** Token type of the token to mint */ tokenType: AlpTokenType_Number; /** Token ID of the token to mint */ tokenId: string; /** Which tokens/mint baton to create */ mintData: MintData; } /** Parsed ALP SEND pushdata. */ export interface AlpSend { /** "SEND" */ txType: typeof SEND_STR; /** Token type of the token to send */ tokenType: AlpTokenType_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 ALP BURN pushdata */ export interface AlpBurn { /** "BURN" */ txType: typeof BURN_STR; /** Token type of the token to burn */ tokenId: string; /** Token ID of the token to burn */ tokenType: AlpTokenType_Number; /** How many tokens should be burned */ burnAtoms: bigint; } /** New unknown ALP token type */ export interface AlpUnknown { /** Placeholder for unknown token type or tx type */ txType: typeof UNKNOWN_STR; /** Token type number */ tokenType: number; } /** Parsed ALP pushdata */ export type AlpData = AlpGenesis | AlpMint | AlpSend | AlpBurn | AlpUnknown; /** * Parse the given ALP pushdata. eMPP allows multiple pushdata per OP_RETURN. * * For data that's clearly not ALP (i.e. doesn't start with LOKAD ID "SLP2"), * it will return `undefined`. * * For an unknown token type, it'll return AlpUnknown. * * 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 parseAlp(pushdata: Uint8Array): AlpData | undefined; //# sourceMappingURL=alp.parse.d.ts.map