sensible-sdk
Version:
Sensible-SDK
55 lines (54 loc) • 2.37 kB
TypeScript
import { ContractAdapter } from "../../common/ContractAdapter";
import { Bytes, FunctionCall, Int, Ripemd160, SigHashPreimage } from "../../scryptlib";
import * as proto from "../contract-proto/tokenTransferCheck.proto";
export declare enum TOKEN_TRANSFER_TYPE {
IN_3_OUT_3 = 1,
IN_6_OUT_6 = 2,
IN_10_OUT_10 = 3,
IN_20_OUT_3 = 4,
IN_3_OUT_100 = 5,
UNSUPPORT = 6
}
export declare class TokenTransferCheck extends ContractAdapter {
constuctParams: {
checkType: TOKEN_TRANSFER_TYPE;
};
private _formatedDataPart;
constructor(constuctParams: {
checkType: TOKEN_TRANSFER_TYPE;
});
clone(): TokenTransferCheck;
setFormatedDataPart(dataPart: proto.FormatedDataPart): void;
getFormatedDataPart(): proto.FormatedDataPart;
unlock({ txPreimage, tokenScript, prevouts, rabinMsgArray, rabinPaddingArray, rabinSigArray, rabinPubKeyIndexArray, rabinPubKeyVerifyArray, rabinPubKeyHashArray, inputTokenAddressArray, inputTokenAmountArray, receiverSatoshiArray, changeSatoshis, changeAddress, opReturnScript, }: {
txPreimage: SigHashPreimage;
tokenScript: Bytes;
prevouts: Bytes;
rabinMsgArray: Bytes;
rabinPaddingArray: Bytes;
rabinSigArray: Bytes;
rabinPubKeyIndexArray: number[];
rabinPubKeyVerifyArray: Int[];
rabinPubKeyHashArray: Bytes;
inputTokenAddressArray: Bytes;
inputTokenAmountArray: Bytes;
receiverSatoshiArray: Bytes;
changeSatoshis: Int;
changeAddress: Ripemd160;
opReturnScript: Bytes;
}): FunctionCall;
}
export declare class TokenTransferCheckFactory {
static tokenTransferTypeInfos: {
type: TOKEN_TRANSFER_TYPE;
in: number;
out: number;
lockingScriptSize: number;
}[];
static getLockingScriptSize(checkType: TOKEN_TRANSFER_TYPE): number;
static getOptimumType(inCount: number, outCount: number): TOKEN_TRANSFER_TYPE;
static createContract(tokenTransferType: TOKEN_TRANSFER_TYPE): TokenTransferCheck;
static getDummyInstance(checkType: TOKEN_TRANSFER_TYPE): TokenTransferCheck;
static calLockingScriptSize(checkType: TOKEN_TRANSFER_TYPE): number;
static calUnlockingScriptSize(checkType: TOKEN_TRANSFER_TYPE, bsvInputLen: number, tokenInputLen: number, tokenOutputLen: number, opreturnData: any): number;
}