/* auto-generated by NAPI-RS */
/* eslint-disable */
export interface AdaptorSignature {
  signature: Buffer
  proof: Buffer
}

export declare function addSignature(tx: Transaction, signature: Buffer, pubkey: Buffer, inputIndex: number): Transaction

export interface CetAdaptorSignatureDebugInfo {
  /** The sighash (32 bytes) - this is the message that gets signed */
  sighash: Buffer
  /** The adaptor point (33 bytes compressed public key) */
  adaptorPoint: Buffer
  /** Input index (always 0 for CETs) */
  inputIndex: number
  /** The funding script pubkey used for sighash */
  scriptPubkey: Buffer
  /** The fund output value used for sighash */
  value: bigint
  /** The CET txid */
  cetTxid: string
  /** Raw CET bytes for verification */
  cetRaw: Buffer
}

export declare function cetAdaptorSignatureFromOracleInfo(cet: Transaction, oracleInfo: OracleInfo, fundingSk: Buffer, fundingScriptPubkey: Buffer, totalCollateral: bigint, msgs: Array<Buffer>): AdaptorSignature

/**
 * Get all the inputs that go into creating a CET adaptor signature.
 * Use this to compare values with Fordefi to debug signature mismatches.
 *
 * Returns:
 * - sighash: The 32-byte message that gets signed (BIP143 sighash)
 * - adaptor_point: The 33-byte compressed public key (adaptor point)
 * - input_index: Always 0 for CETs
 * - script_pubkey: The funding script used for sighash calculation
 * - value: The fund output value used for sighash calculation
 * - cet_txid: The CET transaction ID
 * - cet_raw: Raw CET bytes
 */
export declare function cetAdaptorSignatureInputs(cet: Transaction, oracleInfo: Array<OracleInfo>, fundingScriptPubkey: Buffer, fundOutputValue: bigint, msgs: Array<Array<Buffer>>): CetAdaptorSignatureDebugInfo

/**
 * Get the sighash for a CET - the actual 32-byte message that gets signed.
 * This is useful for comparing with Fordefi's sighash calculation.
 */
export declare function cetSighash(cet: Transaction, fundingScriptPubkey: Buffer, fundOutputValue: bigint): Buffer

export declare function changeOutputAndFees(params: PartyParams, feeRate: bigint): ChangeOutputAndFees

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 createCetAdaptorPointsFromOracleInfo(oracleInfo: Array<OracleInfo>, msgs: Array<Array<Array<Buffer>>>): Array<Buffer>

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 createCetAdaptorSigsFromPoints(cets: Array<Transaction>, adaptorPoints: Array<Buffer>, fundingSecretKey: Buffer, fundingScriptPubkey: Buffer, fundOutputValue: bigint): 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, contractFlags: number): DlcTransactions

export declare function createExtkeyFromParentPath(extkey: Buffer, path: string): Buffer

export declare function createExtkeyFromSeed(seed: Buffer, network: string): Buffer

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, contractFlags: number): 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 extractEcdsaSignatureFromOracleSignatures(oracleSignatures: Array<Buffer>, adaptorSignature: Buffer): Buffer

export declare function getPubkeyFromExtkey(extkey: Buffer, network: string): Buffer

export declare function getTotalInputVsize(inputs: Array<TxInputInfo>): number

export declare function getXpubFromXpriv(xpriv: Buffer, network: string): Buffer

export declare function isDust(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 rawFundingInputSignature(fundingTransaction: Transaction, privkey: Buffer, prevTxId: string, prevTxVout: number, value: bigint): Buffer

export declare function signCet(cet: Transaction, adaptorSignature: Buffer, oracleSignatures: Array<Buffer>, fundingSecretKey: Buffer, otherPubkey: Buffer, fundingScriptPubkey: Buffer, fundOutputValue: bigint): Transaction

export declare function signFundInput(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 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 verifyFromOracleInfo(adaptorSig: AdaptorSignature, cet: Transaction, oracleInfo: Array<OracleInfo>, pubkey: Buffer, fundingScriptPubkey: Buffer, totalCollateral: bigint, msgs: Array<Array<Buffer>>): boolean

export declare function verifyFundSignature(fundTx: Transaction, signature: Buffer, pubkey: Buffer, txid: string, vout: number, inputAmount: bigint): boolean

export declare function version(): string
