UNPKG

meta-contract

Version:

Meta Contract SDK

60 lines (59 loc) 2.62 kB
import { ContractAdapter } from '../../common/ContractAdapter'; import { Bytes, FunctionCall, Int, PubKey, Ripemd160, Sig, SigHashPreimage } from '../../scryptlib'; import * as nftProto from '../contract-proto/nft.proto'; import { NFT_OP_TYPE } from '../contract-proto/nft.proto'; declare enum NFT_CODE_VERSION { V1 = 0, V2 = 1 } export declare class Nft extends ContractAdapter { constuctParams: { unlockContractCodeHashArray: Bytes[]; codeVersion: NFT_CODE_VERSION; }; private _formatedDataPart; constructor(constuctParams: { unlockContractCodeHashArray: Bytes[]; codeVersion: NFT_CODE_VERSION; }); clone(): Nft; setFormatedDataPart(dataPart: nftProto.FormatedDataPart): void; getFormatedDataPart(): nftProto.FormatedDataPart; unlock({ txPreimage, prevouts, rabinMsg, rabinPaddingArray, rabinSigArray, rabinPubKeyIndexArray, rabinPubKeyVerifyArray, rabinPubKeyHashArray, prevNftAddress, genesisScript, senderPubKey, senderSig, receiverAddress, nftOutputSatoshis, opReturnScript, changeAddress, changeSatoshis, checkInputIndex, checkScriptTx, checkScriptTxOutIndex, lockContractInputIndex, lockContractTx, lockContractTxOutIndex, operation, }: { txPreimage: SigHashPreimage; prevouts: Bytes; rabinMsg: Bytes; rabinPaddingArray: Bytes[]; rabinSigArray: Int[]; rabinPubKeyIndexArray: number[]; rabinPubKeyVerifyArray: Int[]; rabinPubKeyHashArray: Bytes; prevNftAddress: Bytes; genesisScript?: Bytes; senderPubKey?: PubKey; senderSig?: Sig; receiverAddress?: Bytes; nftOutputSatoshis?: Int; opReturnScript?: Bytes; changeAddress?: Ripemd160; changeSatoshis?: Int; checkInputIndex?: number; checkScriptTx?: Bytes; checkScriptTxOutIndex?: number; lockContractInputIndex?: number; lockContractTx?: Bytes; lockContractTxOutIndex?: number; operation: NFT_OP_TYPE; }): FunctionCall; } export declare class NftFactory { static lockingScriptSize: number; static getLockingScriptSize(): number; static createContractV1(unlockContractCodeHashArray: Bytes[]): Nft; static createContractV2(unlockContractCodeHashArray: Bytes[]): Nft; static createContract(unlockContractCodeHashArray: Bytes[], codehash?: string): Nft; static getDummyInstance(): Nft; static calLockingScriptSize(): number; static calUnlockingScriptSize(bsvInputLen: number, genesisScript: Bytes, opreturnData: any, operation: NFT_OP_TYPE): number; } export {};