@bennyblader/ddk-ts
Version:
dlcdevkit typescript bindings
128 lines (94 loc) • 5.38 kB
TypeScript
/* auto-generated by NAPI-RS */
/* eslint-disable */
export interface AdaptorSignature {
signature: Buffer
proof: Buffer
}
export declare function addSignatureToTransaction(tx: Transaction, signature: Buffer, pubkey: Buffer, inputIndex: number): Transaction
export interface ChangeOutputAndFees {
changeOutput: TxOutput
fundFee: bigint
cetFee: bigint
}
export declare function convertMnemonicToSeed(mnemonic: string, passphrase?: string | undefined | null): Buffer
export declare function createCet(localOutput: TxOutput, localPayoutSerialId: bigint, remoteOutput: TxOutput, remotePayoutSerialId: bigint, fundTxId: string, fundVout: number, lockTime: number): Transaction
export declare function createCetAdaptorSignatureFromOracleInfo(cet: Transaction, oracleInfo: OracleInfo, fundingSk: Buffer, fundingScriptPubkey: Buffer, totalCollateral: bigint, msgs: Array<Buffer>): AdaptorSignature
export declare function createCetAdaptorSigsFromOracleInfo(cets: Array<Transaction>, oracleInfo: Array<OracleInfo>, fundingSecretKey: Buffer, fundingScriptPubkey: Buffer, fundOutputValue: bigint, msgs: Array<Array<Array<Buffer>>>): Array<AdaptorSignature>
export declare function createCets(fundTxId: string, fundVout: number, localFinalScriptPubkey: Buffer, remoteFinalScriptPubkey: Buffer, outcomes: Array<Payout>, lockTime: number, localSerialId: bigint, remoteSerialId: bigint): Array<Transaction>
export declare function createDlcTransactions(outcomes: Array<Payout>, localParams: PartyParams, remoteParams: PartyParams, refundLocktime: number, feeRate: bigint, fundLockTime: number, cetLockTime: number, fundOutputSerialId: bigint): DlcTransactions
export declare function createFundTxLockingScript(localFundPubkey: Buffer, remoteFundPubkey: Buffer): Buffer
export declare function createRefundTransaction(localFinalScriptPubkey: Buffer, remoteFinalScriptPubkey: Buffer, localAmount: bigint, remoteAmount: bigint, lockTime: number, fundTxId: string, fundVout: number): Transaction
export declare function createSplicedDlcTransactions(outcomes: Array<Payout>, localParams: PartyParams, remoteParams: PartyParams, refundLocktime: number, feeRate: bigint, fundLockTime: number, cetLockTime: number, fundOutputSerialId: bigint): DlcTransactions
export declare function createXprivFromParentPath(xpriv: Buffer, baseDerivationPath: string, network: string, path: string): Buffer
export interface DlcInputInfo {
fundTx: Transaction
fundVout: number
localFundPubkey: Buffer
remoteFundPubkey: Buffer
fundAmount: bigint
maxWitnessLen: number
inputSerialId: bigint
contractId: Buffer
}
export interface DlcTransactions {
fund: Transaction
cets: Array<Transaction>
refund: Transaction
fundingScriptPubkey: Buffer
}
export declare function getChangeOutputAndFees(params: PartyParams, feeRate: bigint): ChangeOutputAndFees
export declare function getRawFundingTransactionInputSignature(fundingTransaction: Transaction, privkey: Buffer, prevTxId: string, prevTxVout: number, value: bigint): Buffer
export declare function getTotalInputVsize(inputs: Array<TxInputInfo>): number
export declare function getXpubFromXpriv(xpriv: Buffer, network: string): Buffer
export declare function isDustOutput(output: TxOutput): boolean
export interface OracleInfo {
publicKey: Buffer
nonces: Array<Buffer>
}
export interface PartyParams {
fundPubkey: Buffer
changeScriptPubkey: Buffer
changeSerialId: bigint
payoutScriptPubkey: Buffer
payoutSerialId: bigint
inputs: Array<TxInputInfo>
inputAmount: bigint
collateral: bigint
dlcInputs: Array<DlcInputInfo>
}
export interface Payout {
offer: bigint
accept: bigint
}
export declare function signCet(cet: Transaction, adaptorSignature: Buffer, oracleSignatures: Array<Buffer>, fundingSecretKey: Buffer, otherPubkey: Buffer, fundingScriptPubkey: Buffer, fundOutputValue: bigint): Transaction
export declare function signFundTransactionInput(fundTransaction: Transaction, privkey: Buffer, prevTxId: string, prevTxVout: number, value: bigint): Transaction
export declare function signMultiSigInput(tx: Transaction, dlcInput: DlcInputInfo, localPrivkey: Buffer, remoteSignature: Buffer): Transaction
export interface Transaction {
version: number
lockTime: number
inputs: Array<TxInput>
outputs: Array<TxOutput>
rawBytes: Buffer
}
export interface TxInput {
txid: string
vout: number
scriptSig: Buffer
sequence: number
witness: Array<Buffer>
}
export interface TxInputInfo {
txid: string
vout: number
scriptSig: Buffer
maxWitnessLength: number
serialId: bigint
}
export interface TxOutput {
value: bigint
scriptPubkey: Buffer
}
export declare function verifyCetAdaptorSigFromOracleInfo(adaptorSig: AdaptorSignature, cet: Transaction, oracleInfo: Array<OracleInfo>, pubkey: Buffer, fundingScriptPubkey: Buffer, totalCollateral: bigint, msgs: Array<Array<Buffer>>): boolean
export declare function verifyCetAdaptorSigsFromOracleInfo(adaptorSigs: Array<AdaptorSignature>, cets: Array<Transaction>, oracleInfo: Array<OracleInfo>, pubkey: Buffer, fundingScriptPubkey: Buffer, totalCollateral: bigint, msgs: Array<Array<Array<Buffer>>>): boolean
export declare function verifyFundTxSignature(fundTx: Transaction, signature: Buffer, pubkey: Buffer, txid: string, vout: number, inputAmount: bigint): boolean
export declare function version(): string