UNPKG

navio-blsct

Version:

TypeScript bindings for the `libblsct` library used by the [Navio](https://nav.io/) blockchain to construct confidential transactions based on the BLS12-381 curve.

195 lines (194 loc) 11.6 kB
export declare const CTX_ID_SIZE: any; export declare const POINT_SIZE: any; export declare const SCRIPT_SIZE: any; export declare const BLSCT_IN_AMOUNT_ERROR: any; export declare const BLSCT_OUT_AMOUNT_ERROR: any; export declare enum BlsctChain { Mainnet = 0, Testnet = 1, Signet = 2, Regtest = 3 } export declare enum TxOutputType { Normal = 0, StakedCommitment = 1 } export interface BlsctRetVal { value: any; value_size: number; result: number; } export interface BlsctAmountsRetVal { result: number; value: any; } export interface BlsctBoolRetVal { value: boolean; result: number; } export interface BlsctCTxRetVal { result: number; ctx: any; in_amount_err_index: number; out_amount_err_index: number; } export declare const decodeAddress: (addrStr: string) => BlsctRetVal; export declare const encodeAddress: (dpk: any, encoding: number) => BlsctRetVal; export declare const Bech32: any; export declare const Bech32M: any; export declare const getChain: () => BlsctChain; export declare const setChain: (chain: BlsctChain) => void; export declare const fromSeedToChildKey: (seed: any) => any; export declare const fromChildKeyToBlindingKey: (childKey: any) => any; export declare const fromChildKeyToTokenKey: (childKey: any) => any; export declare const fromChildKeyToTxKey: (childKey: any) => any; export declare const addToTxInVec: (vec: any, txIn: any) => void; export declare const addToTxOutVec: (vec: any, txOut: any) => void; export declare const buildCTx: (txIns: any, txOuts: any) => BlsctCTxRetVal; export declare const createTxInVec: () => any; export declare const createTxOutVec: () => any; export declare const deleteTxInVec: (txInVec: any) => any; export declare const deleteTxOutVec: (txOutVec: any) => any; export declare const deleteCTx: (ctx: any) => void; export declare const getCTxId: (ctx: any) => string; export declare const getCTxIns: (ctx: any) => any; export declare const getCTxInAt: (ctxIns: any, i: number) => any; export declare const getCTxInsSize: (ctxIns: any) => number; export declare const getCTxOuts: (ctx: any) => any; export declare const getCTxOutAt: (ctxOuts: any, i: number) => any; export declare const getCTxOutsSize: (ctxOuts: any) => number; export declare const serializeCTxId: (ctxId: any) => string; export declare const getCTxInPrevOutHash: (obj: any) => any; export declare const getCTxInPrevOutN: (obj: any) => number; export declare const getCTxInScriptSig: (obj: any) => any; export declare const getCTxInSequence: (obj: any) => number; export declare const getCTxInScriptWitness: (obj: any) => any; export declare const getCTxOutValue: (obj: any) => number; export declare const getCTxOutScriptPubkey: (obj: any) => any; export declare const getCTxOutTokenId: (obj: any) => any; export declare const getCTxOutVectorPredicate: (obj: any) => BlsctRetVal; export declare const getCTxOutBlindingKey: (obj: any) => any; export declare const getCTxOutEphemeralKey: (obj: any) => any; export declare const getCTxOutSpendingKey: (obj: any) => any; export declare const getCTxOutRangeProof: (obj: any) => BlsctRetVal; export declare const getCTxOutViewTag: (obj: any) => number; export declare const deserializeDpk: (hex: string) => BlsctRetVal; export declare const genDoublePubKey: (pk1: any, pk2: any) => BlsctRetVal; export declare const genDpkWithKeysAcctAddr: (viewKey: any, spendingPubKey: any, account: number, address: number) => any; export declare const serializeDpk: (dpk: any) => string; export declare const calcKeyId: (blindingPubKey: any, spendingPubKey: any, viewKey: any) => any; export declare const deserializeKeyId: (hex: string) => BlsctRetVal; export declare const serializeKeyId: (hashId: any) => string; export declare const freeObj: (obj: any) => void; export declare const hexToMallocedBuf: (hex: string) => any; export declare const runGc: () => Promise<void>; export declare const toHex: (buf: any, size: number) => string; export declare const getValueAsCStr: (rv: BlsctRetVal) => string; export declare const deserializeOutPoint: (hex: string) => BlsctRetVal; export declare const genOutPoint: (serCtxId: string, outIndex: number) => any; export declare const serializeOutPoint: (outPoint: any) => string; export declare const deserializePoint: (hex: string) => BlsctRetVal; export declare const genBasePoint: () => BlsctRetVal; export declare const genRandomPoint: () => BlsctRetVal; export declare const arePointEqual: (a: any, b: any) => boolean; export declare const isValidPoint: (point: any) => boolean; export declare const pointFromScalar: (scalar: any) => any; export declare const pointToStr: (point: any) => any; export declare const serializePoint: (point: any) => string; export declare const calcPrivSpendingKey: (blindingPubKey: any, viewKey: any, spendingKey: any, account: number, address: number) => any; export declare const calcNonce: (blindingPubKey: any, viewKey: any) => any; export declare const genRandomPublicKey: () => BlsctRetVal; export declare const getPublicKeyPoint: (obj: any) => any; export declare const pointToPublicKey: (point: any) => any; export declare const scalarToPubKey: (scalar: any) => any; export declare const addToRangeProofVec: (rangeProofs: any, rangeProof: any, rangeProofSize: number) => void; export declare const addToAmountRecoveryReqVec: (reqs: any[], req: any) => void; export declare const addToUint64Vec: (vec: any, n: number) => void; export declare const buildRangeProof: (amounts: any, nonce: any, msg: any, token_id: any) => BlsctRetVal; export declare const createAmountRecoveryReqVec: () => any; export declare const createRangeProofVec: () => any; export declare const createUint64Vec: () => any; export declare const deserializeRangeProof: (hex: string) => BlsctRetVal; export declare const deleteAmountRecoveryReqVec: (reqs: any) => void; export declare const deleteAmountsRetVal: (rv: BlsctAmountsRetVal) => void; export declare const deleteRangeProofVec: (rangeProofs: any) => void; export declare const deleteUint64Vec: (vec: any) => any; export declare const genAmountRecoveryReq: (rangeProof: any, rangeProofSize: number, nonce: any) => any; export declare const getAmountRecoveryResultAmount: (req: any, i: number) => number; export declare const getAmountRecoveryResultIsSucc: (req: any, i: number) => boolean; export declare const getAmountRecoveryResultMsg: (req: any, i: number) => string; export declare const getAmountRecoveryResultSize: (resVec: any) => number; export declare const getRangeProof_A: (rangeProof: any, rangeProofSize: number) => any; export declare const getRangeProof_alpha_hat: (rangeProof: any, rangeProofSize: number) => any; export declare const getRangeProof_A_wip: (rangeProof: any, rangeProofSize: number) => any; export declare const getRangeProof_B: (rangeProof: any, rangeProofSize: number) => any; export declare const getRangeProof_delta_prime: (rangeProof: any, rangeProofSize: number) => any; export declare const getRangeProof_r_prime: (rangeProof: any, rangeProofSize: number) => any; export declare const getRangeProof_s_prime: (rangeProof: any, rangeProofSize: number) => any; export declare const getRangeProof_tau_x: (rangeProof: any, rangeProofSize: number) => any; export declare const recoverAmount: (vec: any) => BlsctAmountsRetVal; export declare const serializeRangeProof: (rangeProof: any, rangeProofSize: number) => string; export declare const verifyRangeProofs: (rangeProofs: any[]) => BlsctBoolRetVal; export declare const deserializeScalar: (hex: string) => BlsctRetVal; export declare const genRandomScalar: () => BlsctRetVal; export declare const genScalar: (value: number) => BlsctRetVal; export declare const areScalarEqual: (a: any, b: any) => boolean; export declare const scalarToUint64: (scalar: any) => number; export declare const serializeScalar: (scalar: any) => string; export declare const deserializeScript: (hex: string) => any; export declare const serializeScript: (script: any) => string; export declare const deserializeSignature: (hex: string) => any; export declare const serializeSignature: (script: any) => string; export declare const signMessage: (privKey: any, msg: string) => any; export declare const verifyMsgSig: (pubKey: any, msg: string, signature: any) => boolean; export declare const deriveSubAddress: (viewKey: any, spendingPubKey: any, subAddrId: any) => any; export declare const subAddrToDpk: (subAddr: any) => any; export declare const deserializeSubAddr: (hex: string) => any; export declare const dpkToSubAddr: (dpk: any) => BlsctRetVal; export declare const serializeSubAddr: (subAddrId: any) => string; export declare const deserializeSubAddrId: (hex: string) => any; export declare const genSubAddrId: (account: number, address: number) => any; export declare const serializeSubAddrId: (subAddrId: any) => string; export declare const deserializeTokenId: (hex: string) => BlsctRetVal; export declare const genTokenId: (token: number) => BlsctRetVal; export declare const genTokenIdWithSubid: (token: number, subid: number) => BlsctRetVal; export declare const genDefaultTokenId: () => BlsctRetVal; export declare const getTokenIdSubid: (tokenId: any) => number; export declare const getTokenIdToken: (tokenId: any) => number; export declare const serializeTokenId: (tokenId: any) => string; export declare const fromTxKeyToSpendingKey: (txKey: any) => any; export declare const fromTxKeyToViewKey: (txKey: any) => any; export declare const buildTxIn: (amount: number, gamma: number, spendingKey: any, tokenId: any, outPoint: any, isStakedCommitment: boolean, isRbf: boolean) => any; export declare const getTxInAmount: (obj: any) => number; export declare const getTxInGamma: (obj: any) => number; export declare const getTxInSpendingKey: (obj: any) => any; export declare const getTxInTokenId: (obj: any) => any; export declare const getTxInOutPoint: (obj: any) => any; export declare const getTxInStakedCommitment: (obj: any) => boolean; export declare const getTxInRbf: (obj: any) => boolean; export declare const buildTxOut: (subAddr: any, amount: number, memo: string, tokenId: any, outputType: TxOutputType, minStake: number) => any; export declare const getTxOutDestination: (obj: any) => any; export declare const getTxOutAmount: (obj: any) => number; export declare const getTxOutMemo: (obj: any) => string; export declare const getTxOutTokenId: (obj: any) => any; export declare const getTxOutOutputType: (obj: any) => TxOutputType; export declare const getTxOutMinStake: (obj: any) => number; export declare const asString: (obj: string) => any; export declare const castToCTxIn: (obj: any) => any; export declare const castToCTxOut: (obj: any) => any; export declare const castToDpk: (obj: any) => any; export declare const castToKeyId: (obj: any) => any; export declare const castToOutPoint: (obj: any) => any; export declare const castToPoint: (obj: any) => any; export declare const castToPubKey: (obj: any) => any; export declare const castToRangeProof: (obj: any) => any; export declare const castToScalar: (obj: any) => any; export declare const castToScript: (obj: any) => any; export declare const castToSignature: (obj: any) => any; export declare const castToSubAddr: (obj: any) => any; export declare const castToSubAddrId: (obj: any) => any; export declare const castToTokenId: (obj: any) => any; export declare const castToTxIn: (obj: any) => any; export declare const castToTxOut: (obj: any) => any; export declare const castToUint8_tPtr: (obj: any) => any; export declare const calcViewTag: (blindingPubKey: any, viewKey: any) => any;