meta-contract
Version:
Meta Contract SDK
50 lines (49 loc) • 1.91 kB
TypeScript
/// <reference types="node" />
import * as proto from '../../common/protoheader';
import BN = require('../../bn.js');
export type MetaidOutpoint = {
txid: string;
index: number;
};
export type SensibleID = {
txid: string;
index: number;
};
export type FormatedDataPart = {
metaidOutpoint?: MetaidOutpoint;
nftAddress?: string;
totalSupply?: BN;
tokenIndex?: BN;
genesisHash?: string;
sensibleID?: SensibleID;
protoVersion?: number;
protoType?: proto.PROTO_TYPE;
};
export declare enum NFT_OP_TYPE {
TRANSFER = 1,
UNLOCK_FROM_CONTRACT = 2
}
export declare const PROTO_VERSION = 1;
export declare const GENESIS_TOKEN_ID: Buffer;
export declare const EMPTY_ADDRESS: Buffer;
export declare function getGenesisHash(script: Buffer): string;
export declare function getTokenIndex(script: Buffer): BN;
export declare function getNftID(script: Buffer): Buffer;
export declare function getTotalSupply(script: Buffer): BN;
export declare function getNftAddress(script: Buffer): string;
export declare function getContractCode(script: Buffer): Buffer;
export declare function getContractCodeHash(script: Buffer): Buffer;
export declare function getMetaidOutpoint(script0: Buffer): {
txid: string;
index: number;
};
export declare function getSensibleID(script0: Buffer): {
txid: string;
index: number;
};
export declare function newDataPart({ metaidOutpoint, nftAddress, totalSupply, tokenIndex, genesisHash, sensibleID, protoVersion, protoType, }: FormatedDataPart): Buffer;
export declare function parseDataPart(scriptBuf: Buffer): FormatedDataPart;
export declare function updateScript(scriptBuf: Buffer, dataPartObj: FormatedDataPart): Buffer;
export declare function getQueryCodehash(script: Buffer): string;
export declare function getQueryGenesis(script: Buffer): string;
export declare function getQuerySensibleID(script0: Buffer): string;