@babylonlabs-io/ts-sdk 0.38.0 → 0.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PayoutManager-D29D-K-V.js +250 -0
- package/dist/PayoutManager-D29D-K-V.js.map +1 -0
- package/dist/PayoutManager-DERMRuUU.cjs +2 -0
- package/dist/PayoutManager-DERMRuUU.cjs.map +1 -0
- package/dist/{PeginManager-C1en2vwr.js → PeginManager-Cp2Tn5sH.js} +270 -292
- package/dist/PeginManager-Cp2Tn5sH.js.map +1 -0
- package/dist/PeginManager-DaDs-bGr.cjs +2 -0
- package/dist/PeginManager-DaDs-bGr.cjs.map +1 -0
- package/dist/assertPsbtUnsignedTxMatches-fNkAaZZm.cjs +2 -0
- package/dist/assertPsbtUnsignedTxMatches-fNkAaZZm.cjs.map +1 -0
- package/dist/assertPsbtUnsignedTxMatches-mTAnLhCz.js +340 -0
- package/dist/assertPsbtUnsignedTxMatches-mTAnLhCz.js.map +1 -0
- package/dist/{buildAndBroadcastRefund-vwfVgJeA.js → buildAndBroadcastRefund-B5cOyUzj.js} +138 -132
- package/dist/{buildAndBroadcastRefund-vwfVgJeA.js.map → buildAndBroadcastRefund-B5cOyUzj.js.map} +1 -1
- package/dist/buildAndBroadcastRefund-DVMT-pXQ.cjs +2 -0
- package/dist/{buildAndBroadcastRefund-CEKwFY8l.cjs.map → buildAndBroadcastRefund-DVMT-pXQ.cjs.map} +1 -1
- package/dist/{challengeAssert-D7OCrDIc.js → challengeAssert-CBp4mEs0.js} +2 -2
- package/dist/{challengeAssert-D7OCrDIc.js.map → challengeAssert-CBp4mEs0.js.map} +1 -1
- package/dist/{challengeAssert-CMb7r-je.cjs → challengeAssert-CNRdpCzm.cjs} +2 -2
- package/dist/{challengeAssert-CMb7r-je.cjs.map → challengeAssert-CNRdpCzm.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +27 -27
- package/dist/noPayout-jtZsoOzY.cjs +2 -0
- package/dist/noPayout-jtZsoOzY.cjs.map +1 -0
- package/dist/noPayout-qbaSEKGC.js +145 -0
- package/dist/noPayout-qbaSEKGC.js.map +1 -0
- package/dist/peginInput-BPRB9tUi.js +104 -0
- package/dist/peginInput-BPRB9tUi.js.map +1 -0
- package/dist/peginInput-DH6X4ITS.cjs +2 -0
- package/dist/peginInput-DH6X4ITS.cjs.map +1 -0
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +20 -20
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.js +2 -2
- package/dist/tbv/core/managers/pegin/assertAuthAnchorOpReturn.d.ts +37 -0
- package/dist/tbv/core/managers/pegin/assertAuthAnchorOpReturn.d.ts.map +1 -1
- package/dist/tbv/core/managers/pegin/index.d.ts +1 -1
- package/dist/tbv/core/managers/pegin/index.d.ts.map +1 -1
- package/dist/tbv/core/primitives/index.cjs +1 -1
- package/dist/tbv/core/primitives/index.js +17 -17
- package/dist/tbv/core/primitives/psbt/__tests__/refund.test.d.ts +12 -0
- package/dist/tbv/core/primitives/psbt/__tests__/refund.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/pegin.d.ts +5 -0
- package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
- package/dist/tbv/core/primitives/psbt/refund.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +2 -2
- package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +20 -20
- package/package.json +3 -3
- package/dist/PayoutManager-BfT0V-tm.cjs +0 -2
- package/dist/PayoutManager-BfT0V-tm.cjs.map +0 -1
- package/dist/PayoutManager-Cf51DBcu.js +0 -208
- package/dist/PayoutManager-Cf51DBcu.js.map +0 -1
- package/dist/PeginManager-BRHJZYmE.cjs +0 -2
- package/dist/PeginManager-BRHJZYmE.cjs.map +0 -1
- package/dist/PeginManager-C1en2vwr.js.map +0 -1
- package/dist/assertPsbtUnsignedTxMatches-CagW7XqW.cjs +0 -2
- package/dist/assertPsbtUnsignedTxMatches-CagW7XqW.cjs.map +0 -1
- package/dist/assertPsbtUnsignedTxMatches-Dry5dTfl.js +0 -266
- package/dist/assertPsbtUnsignedTxMatches-Dry5dTfl.js.map +0 -1
- package/dist/buildAndBroadcastRefund-CEKwFY8l.cjs +0 -2
- package/dist/noPayout-B6s8vrW6.cjs +0 -2
- package/dist/noPayout-B6s8vrW6.cjs.map +0 -1
- package/dist/noPayout-BhgknZBx.js +0 -141
- package/dist/noPayout-BhgknZBx.js.map +0 -1
- package/dist/peginInput-57FK2O99.cjs +0 -2
- package/dist/peginInput-57FK2O99.cjs.map +0 -1
- package/dist/peginInput-CYJzbuwA.js +0 -177
- package/dist/peginInput-CYJzbuwA.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noPayout-qbaSEKGC.js","sources":["../src/tbv/core/primitives/psbt/refund.ts","../src/tbv/core/primitives/psbt/noPayout.ts"],"sourcesContent":["/**\n * Refund PSBT Builder Primitive\n *\n * Builds an unsigned refund PSBT for a depositor to reclaim BTC from\n * a timed-out Pre-PegIn HTLC output via the refund script (leaf 1).\n *\n * The refund script enforces a CSV timelock (timelockRefund blocks) and\n * requires only the depositor's Schnorr signature — no vault provider or\n * keeper involvement.\n *\n * @module primitives/psbt/refund\n */\n\nimport {\n getPrePeginHtlcConnectorInfo,\n initWasm,\n tapInternalPubkey,\n WasmPrePeginTx,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\nimport { Buffer } from \"buffer\";\nimport { Psbt, Transaction } from \"bitcoinjs-lib\";\n\nimport { TAPSCRIPT_LEAF_VERSION, hexToUint8Array, uint8ArrayToHex } from \"../utils/bitcoin\";\nimport { normalizeAuthAnchorHash, type PrePeginParams } from \"./pegin\";\n\n/**\n * Parameters for building a refund PSBT\n */\nexport interface BuildRefundPsbtParams {\n /** Same PrePeginParams used when the original Pre-PegIn tx was created */\n prePeginParams: PrePeginParams;\n /** Funded Pre-PegIn transaction hex (the tx whose HTLC output is being refunded) */\n fundedPrePeginTxHex: string;\n /** Index of the HTLC output in the Pre-PegIn transaction */\n htlcVout: number;\n /** Transaction fee in satoshis for the refund transaction */\n refundFee: bigint;\n /** SHA256 hash commitment for the HTLC (64 hex chars, no 0x prefix) */\n hashlock: string;\n}\n\n/**\n * Result of building a refund PSBT\n */\nexport interface BuildRefundPsbtResult {\n /** PSBT hex ready for depositor signing */\n psbtHex: string;\n}\n\n/**\n * Build a PSBT for signing the refund transaction.\n *\n * The refund transaction spends the Pre-PegIn HTLC output via leaf 1\n * (the refund script: `<timelockRefund> CSV DROP <depositorPubkey> CHECKSIG`).\n * The PSBT includes the tapLeafScript entry so the depositor's wallet can\n * sign using Taproot script-path spending.\n *\n * The input's sequence is set to `timelockRefund` by the WASM, enforcing\n * the Bitcoin CSV timelock. The refund broadcast will be rejected by the\n * network if the timelock has not yet expired.\n *\n * @param params - Refund PSBT parameters\n * @returns PSBT hex for depositor signing\n * @throws If the HTLC output at htlcVout is not found\n * @throws If the refund transaction does not have exactly 1 input\n */\nexport async function buildRefundPsbt(\n params: BuildRefundPsbtParams,\n): Promise<BuildRefundPsbtResult> {\n await initWasm();\n\n const { prePeginParams, fundedPrePeginTxHex, htlcVout, refundFee, hashlock } =\n params;\n\n // The 13th positional arg `auth_anchor_hash` is `Option<String>` in\n // the Rust WASM constructor. Production peg-ins (PeginManager) always\n // commit an OP_RETURN <PUSH32 SHA256(authAnchor)> output at\n // `vout = hashlocks.length`; the unfunded template must include it so\n // `fromFundedTransaction` aligns with the funded tx's output shape.\n // Normalize identically to the peg-in primitives (`0x` strip,\n // lowercase, length/charset validation) so a direct primitive caller\n // reusing successful peg-in params doesn't hand unnormalized bytes to\n // WASM. Pass `undefined` for legacy non-auth-anchored Pre-PegIns.\n const normalizedAuthAnchorHash = normalizeAuthAnchorHash(\n prePeginParams.authAnchorHash,\n );\n const unfundedTx = new (WasmPrePeginTx as unknown as new (\n depositor: string,\n vault_provider: string,\n vault_keepers: string[],\n universal_challengers: string[],\n hashlocks: string[],\n pegin_amounts: BigUint64Array,\n timelock_refund: number,\n fee_rate: bigint,\n num_local_challengers: number,\n council_quorum: number,\n council_size: number,\n network: string,\n auth_anchor_hash?: string,\n ) => typeof WasmPrePeginTx.prototype)(\n prePeginParams.depositorPubkey,\n prePeginParams.vaultProviderPubkey,\n prePeginParams.vaultKeeperPubkeys,\n prePeginParams.universalChallengerPubkeys,\n [...prePeginParams.hashlocks],\n new BigUint64Array(prePeginParams.pegInAmounts),\n prePeginParams.timelockRefund,\n prePeginParams.feeRate,\n prePeginParams.numLocalChallengers,\n prePeginParams.councilQuorum,\n prePeginParams.councilSize,\n prePeginParams.network,\n normalizedAuthAnchorHash,\n );\n\n let fundedTx: WasmPrePeginTx | null = null;\n try {\n fundedTx = unfundedTx.fromFundedTransaction(fundedPrePeginTxHex);\n\n const refundTxHex = fundedTx.buildRefundTx(refundFee, htlcVout);\n\n const htlcConnector = await getPrePeginHtlcConnectorInfo({\n depositorPubkey: prePeginParams.depositorPubkey,\n vaultProviderPubkey: prePeginParams.vaultProviderPubkey,\n vaultKeeperPubkeys: prePeginParams.vaultKeeperPubkeys,\n universalChallengerPubkeys: prePeginParams.universalChallengerPubkeys,\n hashlock,\n timelockRefund: prePeginParams.timelockRefund,\n network: prePeginParams.network,\n });\n\n const cleanPrePeginHex = fundedPrePeginTxHex.startsWith(\"0x\")\n ? fundedPrePeginTxHex.slice(2)\n : fundedPrePeginTxHex;\n const prePeginTx = Transaction.fromHex(cleanPrePeginHex);\n\n const htlcOutput = prePeginTx.outs[htlcVout];\n if (!htlcOutput) {\n throw new Error(\n `HTLC output at vout ${htlcVout} not found in funded Pre-PegIn tx ` +\n `(tx has ${prePeginTx.outs.length} outputs)`,\n );\n }\n\n const refundTx = Transaction.fromHex(refundTxHex);\n\n if (refundTx.ins.length !== 1) {\n throw new Error(\n `Refund transaction must have exactly 1 input, got ${refundTx.ins.length}`,\n );\n }\n\n const refundInput = refundTx.ins[0];\n\n // Verify the refund input spends the correct Pre-PegIn HTLC output\n const prePeginTxid = prePeginTx.getId();\n const refundInputTxid = uint8ArrayToHex(\n new Uint8Array(refundInput.hash).slice().reverse(),\n );\n if (refundInputTxid !== prePeginTxid) {\n throw new Error(\n `Refund input does not reference the Pre-PegIn transaction. ` +\n `Expected ${prePeginTxid}, got ${refundInputTxid}`,\n );\n }\n if (refundInput.index !== htlcVout) {\n throw new Error(\n `Refund input index ${refundInput.index} does not match expected htlcVout ${htlcVout}`,\n );\n }\n\n const psbt = new Psbt();\n psbt.setVersion(refundTx.version);\n psbt.setLocktime(refundTx.locktime);\n\n psbt.addInput({\n hash: refundInput.hash,\n index: refundInput.index,\n sequence: refundInput.sequence,\n witnessUtxo: {\n script: htlcOutput.script,\n value: htlcOutput.value,\n },\n tapLeafScript: [\n {\n leafVersion: TAPSCRIPT_LEAF_VERSION,\n script: Buffer.from(hexToUint8Array(htlcConnector.refundScript)),\n controlBlock: Buffer.from(\n hexToUint8Array(htlcConnector.refundControlBlock),\n ),\n },\n ],\n tapInternalKey: Buffer.from(tapInternalPubkey),\n });\n\n for (const output of refundTx.outs) {\n psbt.addOutput({\n script: output.script,\n value: output.value,\n });\n }\n\n return { psbtHex: psbt.toHex() };\n } finally {\n fundedTx?.free();\n unfundedTx.free();\n }\n}\n","/**\n * NoPayout PSBT Builder\n *\n * Builds unsigned PSBTs for the depositor's NoPayout transaction\n * (depositor-as-claimer path, per challenger). The depositor signs input 0\n * using the NoPayout taproot script from WasmAssertPayoutNoPayoutConnector.\n *\n * @module primitives/psbt/noPayout\n * @see btc-vault crates/vault/docs/btc-transactions-spec.md — Assert output 0 NoPayout connector\n */\n\nimport {\n type AssertPayoutNoPayoutConnectorParams,\n type Network,\n getAssertNoPayoutScriptInfo,\n tapInternalPubkey,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\nimport { Buffer } from \"buffer\";\nimport { Psbt, Transaction, payments } from \"bitcoinjs-lib\";\n\nimport {\n TAPSCRIPT_LEAF_VERSION,\n getNetwork,\n hexToUint8Array,\n processPublicKeyToXOnly,\n stripHexPrefix,\n} from \"../utils/bitcoin\";\n\n/**\n * Parameters for building a NoPayout PSBT\n */\nexport interface NoPayoutParams {\n /** NoPayout transaction hex (unsigned) from VP */\n noPayoutTxHex: string;\n /** Challenger's x-only public key (hex encoded) */\n challengerPubkey: string;\n /** Prevouts for all inputs [{script_pubkey, value}] from VP */\n prevouts: Array<{ script_pubkey: string; value: number }>;\n /** Parameters for the Assert Payout/NoPayout connector */\n connectorParams: AssertPayoutNoPayoutConnectorParams;\n}\n\n/**\n * Build unsigned NoPayout PSBT.\n *\n * The NoPayout transaction is specific to each challenger.\n * Input 0 is the one the depositor signs using the NoPayout taproot script path.\n *\n * @param params - NoPayout parameters\n * @returns Unsigned PSBT hex ready for signing\n */\nexport async function buildNoPayoutPsbt(\n params: NoPayoutParams,\n): Promise<string> {\n const noPayoutTxHex = stripHexPrefix(params.noPayoutTxHex);\n const noPayoutTx = Transaction.fromHex(noPayoutTxHex);\n\n // Get NoPayout script and control block for this challenger\n const { noPayoutScript, noPayoutControlBlock } =\n await getAssertNoPayoutScriptInfo(\n params.connectorParams,\n params.challengerPubkey,\n );\n\n const scriptBytes = hexToUint8Array(noPayoutScript);\n const controlBlockBytes = hexToUint8Array(noPayoutControlBlock);\n\n const psbt = new Psbt();\n psbt.setVersion(noPayoutTx.version);\n psbt.setLocktime(noPayoutTx.locktime);\n\n // Add all inputs - depositor signs input 0 only\n for (let i = 0; i < noPayoutTx.ins.length; i++) {\n const input = noPayoutTx.ins[i];\n const prevout = params.prevouts[i];\n\n if (!prevout) {\n throw new Error(`Missing prevout data for input ${i}`);\n }\n\n const inputData: Parameters<typeof psbt.addInput>[0] = {\n hash: input.hash,\n index: input.index,\n sequence: input.sequence,\n witnessUtxo: {\n script: Buffer.from(hexToUint8Array(stripHexPrefix(prevout.script_pubkey))),\n value: prevout.value,\n },\n };\n\n // Input 0: depositor signs using taproot script path\n if (i === 0) {\n inputData.tapLeafScript = [\n {\n leafVersion: TAPSCRIPT_LEAF_VERSION,\n script: Buffer.from(scriptBytes),\n controlBlock: Buffer.from(controlBlockBytes),\n },\n ];\n inputData.tapInternalKey = Buffer.from(tapInternalPubkey);\n }\n\n psbt.addInput(inputData);\n }\n\n // Add outputs\n for (const output of noPayoutTx.outs) {\n psbt.addOutput({\n script: output.script,\n value: output.value,\n });\n }\n\n return psbt.toHex();\n}\n\n/**\n * Validate that a NoPayout transaction pays to the challenger via the\n * protocol-defined output structure: a single BIP-86 P2TR output derived from\n * the challenger's x-only pubkey.\n *\n * Mirrors `assertPayoutOutputMatchesRegistered` for the NoPayout path, where\n * the sink is fixed by the protocol rather than read from on-chain registration\n * (see `crates/vault/src/transactions/nopayout.rs::NoPayoutTx::new`).\n *\n * @param noPayoutTxHex - Raw NoPayout transaction hex\n * @param challengerPubkey - Challenger's x-only public key (hex)\n * @param network - Bitcoin network used to derive the P2TR scriptPubKey\n * @throws If the transaction does not have exactly one output\n * @throws If the single output's scriptPubKey does not equal the BIP-86 P2TR\n * scriptPubKey for the challenger\n */\nexport function assertNoPayoutOutputMatchesChallenger(\n noPayoutTxHex: string,\n challengerPubkey: string,\n network: Network,\n): void {\n const tx = Transaction.fromHex(stripHexPrefix(noPayoutTxHex));\n\n if (tx.outs.length !== 1) {\n throw new Error(\n `NoPayout transaction must have exactly 1 output, got ${tx.outs.length}`,\n );\n }\n\n const xOnly = hexToUint8Array(processPublicKeyToXOnly(challengerPubkey));\n const { output: expectedScript } = payments.p2tr({\n internalPubkey: Buffer.from(xOnly),\n network: getNetwork(network),\n });\n if (!expectedScript) {\n throw new Error(\n \"Failed to derive challenger BIP-86 P2TR scriptPubKey for NoPayout output validation\",\n );\n }\n\n if (!tx.outs[0].script.equals(expectedScript)) {\n throw new Error(\n \"NoPayout transaction does not pay to the expected challenger BIP-86 P2TR address\",\n );\n }\n}\n"],"names":["buildRefundPsbt","params","initWasm","prePeginParams","fundedPrePeginTxHex","htlcVout","refundFee","hashlock","normalizedAuthAnchorHash","normalizeAuthAnchorHash","unfundedTx","WasmPrePeginTx","fundedTx","refundTxHex","htlcConnector","getPrePeginHtlcConnectorInfo","cleanPrePeginHex","prePeginTx","Transaction","htlcOutput","refundTx","refundInput","prePeginTxid","refundInputTxid","uint8ArrayToHex","psbt","Psbt","TAPSCRIPT_LEAF_VERSION","Buffer","hexToUint8Array","tapInternalPubkey","output","buildNoPayoutPsbt","noPayoutTxHex","stripHexPrefix","noPayoutTx","noPayoutScript","noPayoutControlBlock","getAssertNoPayoutScriptInfo","scriptBytes","controlBlockBytes","i","input","prevout","inputData","assertNoPayoutOutputMatchesChallenger","challengerPubkey","network","tx","xOnly","processPublicKeyToXOnly","expectedScript","payments","getNetwork"],"mappings":";;;;;AAkEA,eAAsBA,EACpBC,GACgC;AAChC,QAAMC,EAAA;AAEN,QAAM,EAAE,gBAAAC,GAAgB,qBAAAC,GAAqB,UAAAC,GAAU,WAAAC,GAAW,UAAAC,MAChEN,GAWIO,IAA2BC;AAAA,IAC/BN,EAAe;AAAA,EAAA,GAEXO,IAAa,IAAKC;AAAA,IAetBR,EAAe;AAAA,IACfA,EAAe;AAAA,IACfA,EAAe;AAAA,IACfA,EAAe;AAAA,IACf,CAAC,GAAGA,EAAe,SAAS;AAAA,IAC5B,IAAI,eAAeA,EAAe,YAAY;AAAA,IAC9CA,EAAe;AAAA,IACfA,EAAe;AAAA,IACfA,EAAe;AAAA,IACfA,EAAe;AAAA,IACfA,EAAe;AAAA,IACfA,EAAe;AAAA,IACfK;AAAA,EAAA;AAGF,MAAII,IAAkC;AACtC,MAAI;AACF,IAAAA,IAAWF,EAAW,sBAAsBN,CAAmB;AAE/D,UAAMS,IAAcD,EAAS,cAAcN,GAAWD,CAAQ,GAExDS,IAAgB,MAAMC,EAA6B;AAAA,MACvD,iBAAiBZ,EAAe;A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AC;AAAA,QAC1E,OAAOA,EAAQ;AAAA,MAAA;AAAA,IACjB;AAIF,IAAIF,MAAM,MACRG,EAAU,gBAAgB;AAAA,MACxB;AAAA,QACE,aAAajB;AAAA,QACb,QAAQC,EAAO,KAAKW,CAAW;AAAA,QAC/B,cAAcX,EAAO,KAAKY,CAAiB;AAAA,MAAA;AAAA,IAC7C,GAEFI,EAAU,iBAAiBhB,EAAO,KAAKE,CAAiB,IAG1DL,EAAK,SAASmB,CAAS;AAAA,EACzB;AAGA,aAAWb,KAAUI,EAAW;AAC9B,IAAAV,EAAK,UAAU;AAAA,MACb,QAAQM,EAAO;AAAA,MACf,OAAOA,EAAO;AAAA,IAAA,CACf;AAGH,SAAON,EAAK,MAAA;AACd;AAkBO,SAASoB,EACdZ,GACAa,GACAC,GACM;AACN,QAAMC,IAAK9B,EAAY,QAAQgB,EAAeD,CAAa,CAAC;AAE5D,MAAIe,EAAG,KAAK,WAAW;AACrB,UAAM,IAAI;AAAA,MACR,wDAAwDA,EAAG,KAAK,MAAM;AAAA,IAAA;AAI1E,QAAMC,IAAQpB,EAAgBqB,EAAwBJ,CAAgB,CAAC,GACjE,EAAE,QAAQK,MAAmBC,EAAS,KAAK;AAAA,IAC/C,gBAAgBxB,EAAO,KAAKqB,CAAK;AAAA,IACjC,SAASI,EAAWN,CAAO;AAAA,EAAA,CAC5B;AACD,MAAI,CAACI;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAIJ,MAAI,CAACH,EAAG,KAAK,CAAC,EAAE,OAAO,OAAOG,CAAc;AAC1C,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAGN;"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { getPrePeginHtlcConnectorInfo as k, tapInternalPubkey as y } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
2
|
+
import { Buffer as u } from "buffer";
|
|
3
|
+
import { Transaction as P, Psbt as p } from "bitcoinjs-lib";
|
|
4
|
+
import { s as d, u as x, h as l, T as I } from "./bitcoin-B5aNKtsk.js";
|
|
5
|
+
async function m(t) {
|
|
6
|
+
const r = d(t.peginTxHex), a = d(t.fundedPrePeginTxHex), n = await k({
|
|
7
|
+
depositorPubkey: t.depositorPubkey,
|
|
8
|
+
vaultProviderPubkey: t.vaultProviderPubkey,
|
|
9
|
+
vaultKeeperPubkeys: t.vaultKeeperPubkeys,
|
|
10
|
+
universalChallengerPubkeys: t.universalChallengerPubkeys,
|
|
11
|
+
hashlock: t.hashlock,
|
|
12
|
+
timelockRefund: t.timelockRefund,
|
|
13
|
+
network: t.network
|
|
14
|
+
}), e = P.fromHex(r), i = P.fromHex(a);
|
|
15
|
+
if (e.ins.length !== 1)
|
|
16
|
+
throw new Error(
|
|
17
|
+
`PegIn transaction must have exactly 1 input, got ${e.ins.length}`
|
|
18
|
+
);
|
|
19
|
+
const o = e.ins[0], f = i.getId(), g = x(
|
|
20
|
+
new Uint8Array(o.hash).slice().reverse()
|
|
21
|
+
);
|
|
22
|
+
if (g !== f)
|
|
23
|
+
throw new Error(
|
|
24
|
+
`PegIn input does not reference the Pre-PegIn transaction. Expected ${f}, got ${g}`
|
|
25
|
+
);
|
|
26
|
+
const c = i.outs[o.index];
|
|
27
|
+
if (!c)
|
|
28
|
+
throw new Error(
|
|
29
|
+
`Pre-PegIn output ${o.index} not found (Pre-PegIn has ${i.outs.length} outputs)`
|
|
30
|
+
);
|
|
31
|
+
const S = l(n.hashlockScript), w = l(n.hashlockControlBlock), s = new p();
|
|
32
|
+
s.setVersion(e.version), s.setLocktime(e.locktime), s.addInput({
|
|
33
|
+
hash: o.hash,
|
|
34
|
+
index: o.index,
|
|
35
|
+
sequence: o.sequence,
|
|
36
|
+
witnessUtxo: {
|
|
37
|
+
script: c.script,
|
|
38
|
+
value: c.value
|
|
39
|
+
},
|
|
40
|
+
tapLeafScript: [
|
|
41
|
+
{
|
|
42
|
+
leafVersion: I,
|
|
43
|
+
script: u.from(S),
|
|
44
|
+
controlBlock: u.from(w)
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
tapInternalKey: u.from(y)
|
|
48
|
+
// sighashType omitted — defaults to SIGHASH_DEFAULT (0x00) for Taproot
|
|
49
|
+
});
|
|
50
|
+
for (const h of e.outs)
|
|
51
|
+
s.addOutput({
|
|
52
|
+
script: h.script,
|
|
53
|
+
value: h.value
|
|
54
|
+
});
|
|
55
|
+
return { psbtHex: s.toHex() };
|
|
56
|
+
}
|
|
57
|
+
function B(t, r) {
|
|
58
|
+
const n = p.fromHex(t).data.inputs[0];
|
|
59
|
+
if (!n)
|
|
60
|
+
throw new Error("PegIn PSBT has no inputs");
|
|
61
|
+
if (n.tapScriptSig && n.tapScriptSig.length > 0) {
|
|
62
|
+
const e = u.from(
|
|
63
|
+
l(r)
|
|
64
|
+
);
|
|
65
|
+
for (const i of n.tapScriptSig)
|
|
66
|
+
if (i.pubkey.equals(e))
|
|
67
|
+
return b(i.signature);
|
|
68
|
+
throw new Error(
|
|
69
|
+
`No PegIn input signature found for depositor pubkey: ${r}`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
throw n.finalScriptWitness && n.finalScriptWitness.length > 0 ? new Error(
|
|
73
|
+
"PegIn input PSBT is already finalized. Cannot reliably extract the depositor signature from the witness stack. Ensure the wallet returns a non-finalized PSBT with tapScriptSig entries."
|
|
74
|
+
) : new Error(
|
|
75
|
+
"No tapScriptSig or finalScriptWitness found in signed PegIn input PSBT"
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
function A(t) {
|
|
79
|
+
const r = p.fromHex(t);
|
|
80
|
+
try {
|
|
81
|
+
r.finalizeAllInputs();
|
|
82
|
+
} catch (a) {
|
|
83
|
+
if (!r.data.inputs.every(
|
|
84
|
+
(e) => e.finalScriptWitness || e.finalScriptSig
|
|
85
|
+
))
|
|
86
|
+
throw new Error(
|
|
87
|
+
`PSBT finalization failed and wallet did not auto-finalize: ${a}`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
return r.extractTransaction().toHex();
|
|
91
|
+
}
|
|
92
|
+
function b(t) {
|
|
93
|
+
if (t.length === 64)
|
|
94
|
+
return x(new Uint8Array(t));
|
|
95
|
+
throw t.length === 65 ? new Error(
|
|
96
|
+
`Unexpected sighash byte 0x${t[64].toString(16).padStart(2, "0")} in PegIn input signature. Expected implicit SIGHASH_DEFAULT as a 64-byte signature.`
|
|
97
|
+
) : new Error(`Unexpected PegIn input signature length: ${t.length}`);
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
m as b,
|
|
101
|
+
B as e,
|
|
102
|
+
A as f
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=peginInput-BPRB9tUi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peginInput-BPRB9tUi.js","sources":["../src/tbv/core/primitives/psbt/peginInput.ts"],"sourcesContent":["/**\n * PegIn Input PSBT Builder\n *\n * Builds the PSBT for the depositor to sign the PegIn transaction's HTLC input\n * (Pre-PegIn HTLC leaf 0 — the hashlock + all-party script).\n *\n * This is the \"Sign Pegin transaction HTLC leaf 0 input\" step in the pre-pegin\n * flow. The depositor signs input 0 of the PegIn transaction,\n * which spends output 0 of the funded Pre-PegIn transaction via script-path.\n *\n * @module primitives/psbt/peginInput\n */\n\nimport {\n getPrePeginHtlcConnectorInfo,\n tapInternalPubkey,\n type Network,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\nimport { Buffer } from \"buffer\";\nimport { Psbt, Transaction } from \"bitcoinjs-lib\";\nimport { TAPSCRIPT_LEAF_VERSION, hexToUint8Array, stripHexPrefix, uint8ArrayToHex } from \"../utils/bitcoin\";\n\n/**\n * Parameters for building the PegIn input PSBT\n */\nexport interface BuildPeginInputPsbtParams {\n /**\n * PegIn transaction hex (1 input spending Pre-PegIn HTLC output 0).\n * Returned by buildPeginTxFromFundedPrePegin().\n */\n peginTxHex: string;\n /**\n * Funded Pre-PegIn transaction hex.\n * Used to look up the HTLC output that the PegIn input spends.\n */\n fundedPrePeginTxHex: string;\n /** Depositor's BTC public key (x-only, 64-char hex) */\n depositorPubkey: string;\n /** Vault provider's BTC public key (x-only, 64-char hex) */\n vaultProviderPubkey: string;\n /** Vault keeper BTC public keys (x-only, 64-char hex) */\n vaultKeeperPubkeys: string[];\n /** Universal challenger BTC public keys (x-only, 64-char hex) */\n universalChallengerPubkeys: string[];\n /** SHA256 hash commitment (64 hex chars = 32 bytes) */\n hashlock: string;\n /** CSV timelock in blocks for the HTLC refund path */\n timelockRefund: number;\n /** Bitcoin network */\n network: Network;\n}\n\n/**\n * Result of building the PegIn input PSBT\n */\nexport interface BuildPeginInputPsbtResult {\n /** PSBT hex for the depositor to sign */\n psbtHex: string;\n}\n\n/**\n * Build PSBT for depositor to sign the PegIn transaction's HTLC leaf 0 input.\n *\n * The PegIn transaction spends the Pre-PegIn HTLC output (output 0) via the\n * hashlock + all-party script (leaf 0). The depositor provides one of the required\n * signatures; the vault provider and keepers provide theirs separately via the\n * signPeginInput RPC.\n *\n * The PSBT uses Taproot script-path spending:\n * - witnessUtxo: the Pre-PegIn HTLC output\n * - tapLeafScript: hashlock leaf script + control block\n * - tapInternalKey: NUMS unspendable key (BIP-341 nothing-up-my-sleeve)\n *\n * @param params - PegIn input PSBT parameters\n * @returns PSBT hex ready for depositor signing\n * @throws If PegIn tx does not have exactly 1 input\n * @throws If PegIn input does not reference the Pre-PegIn HTLC output\n * @throws If Pre-PegIn tx output 0 is not found\n */\nexport async function buildPeginInputPsbt(\n params: BuildPeginInputPsbtParams,\n): Promise<BuildPeginInputPsbtResult> {\n const peginTxHex = stripHexPrefix(params.peginTxHex);\n const fundedPrePeginTxHex = stripHexPrefix(params.fundedPrePeginTxHex);\n\n const htlcConnector = await getPrePeginHtlcConnectorInfo({\n depositorPubkey: params.depositorPubkey,\n vaultProviderPubkey: params.vaultProviderPubkey,\n vaultKeeperPubkeys: params.vaultKeeperPubkeys,\n universalChallengerPubkeys: params.universalChallengerPubkeys,\n hashlock: params.hashlock,\n timelockRefund: params.timelockRefund,\n network: params.network,\n });\n\n const peginTx = Transaction.fromHex(peginTxHex);\n const prePeginTx = Transaction.fromHex(fundedPrePeginTxHex);\n\n if (peginTx.ins.length !== 1) {\n throw new Error(\n `PegIn transaction must have exactly 1 input, got ${peginTx.ins.length}`,\n );\n }\n\n const peginInput = peginTx.ins[0];\n\n // Verify PegIn input 0 spends Pre-PegIn output 0\n const prePeginTxid = prePeginTx.getId();\n const peginInputTxid = uint8ArrayToHex(\n new Uint8Array(peginInput.hash).slice().reverse(),\n );\n\n if (peginInputTxid !== prePeginTxid) {\n throw new Error(\n `PegIn input does not reference the Pre-PegIn transaction. ` +\n `Expected ${prePeginTxid}, got ${peginInputTxid}`,\n );\n }\n\n const htlcOutput = prePeginTx.outs[peginInput.index];\n if (!htlcOutput) {\n throw new Error(\n `Pre-PegIn output ${peginInput.index} not found ` +\n `(Pre-PegIn has ${prePeginTx.outs.length} outputs)`,\n );\n }\n\n const hashlockScript = hexToUint8Array(htlcConnector.hashlockScript);\n const hashlockControlBlock = hexToUint8Array(htlcConnector.hashlockControlBlock);\n\n const psbt = new Psbt();\n psbt.setVersion(peginTx.version);\n psbt.setLocktime(peginTx.locktime);\n\n // Input 0: PegIn input spending Pre-PegIn HTLC output 0 via hashlock leaf (leaf 0).\n // The depositor signs using Taproot script-path spending.\n psbt.addInput({\n hash: peginInput.hash,\n index: peginInput.index,\n sequence: peginInput.sequence,\n witnessUtxo: {\n script: htlcOutput.script,\n value: htlcOutput.value,\n },\n tapLeafScript: [\n {\n leafVersion: TAPSCRIPT_LEAF_VERSION,\n script: Buffer.from(hashlockScript),\n controlBlock: Buffer.from(hashlockControlBlock),\n },\n ],\n tapInternalKey: Buffer.from(tapInternalPubkey),\n // sighashType omitted — defaults to SIGHASH_DEFAULT (0x00) for Taproot\n });\n\n for (const output of peginTx.outs) {\n psbt.addOutput({\n script: output.script,\n value: output.value,\n });\n }\n\n return { psbtHex: psbt.toHex() };\n}\n\n/**\n * Extract the depositor's Schnorr signature from a signed PegIn input PSBT.\n *\n * Supports non-finalized PSBTs with tapScriptSig entries. Finalized PSBTs are\n * rejected because the witness stack does not reliably identify the depositor\n * signature by public key.\n *\n * PegIn input signatures must use implicit Taproot SIGHASH_DEFAULT, which is\n * encoded by omitting the sighash byte. Signatures with an appended sighash byte\n * are rejected rather than stripped.\n *\n * @param signedPsbtHex - Signed PSBT hex\n * @param depositorPubkey - Depositor's x-only public key (64-char hex)\n * @returns 64-byte Schnorr signature (128 hex chars, no sighash flag)\n * @throws If no signature is found for the depositor's key\n */\nexport function extractPeginInputSignature(\n signedPsbtHex: string,\n depositorPubkey: string,\n): string {\n const signedPsbt = Psbt.fromHex(signedPsbtHex);\n const input = signedPsbt.data.inputs[0];\n\n if (!input) {\n throw new Error(\"PegIn PSBT has no inputs\");\n }\n\n // Non-finalized PSBT — extract from tapScriptSig\n if (input.tapScriptSig && input.tapScriptSig.length > 0) {\n const depositorPubkeyBytes = Buffer.from(\n hexToUint8Array(depositorPubkey),\n );\n\n for (const sigEntry of input.tapScriptSig) {\n if (sigEntry.pubkey.equals(depositorPubkeyBytes)) {\n return extractSchnorrSig(sigEntry.signature);\n }\n }\n\n throw new Error(\n `No PegIn input signature found for depositor pubkey: ${depositorPubkey}`,\n );\n }\n\n // Finalized PSBT — the witness stack order depends on the wallet's finalizer,\n // so we cannot reliably pick the depositor's signature by position. Require\n // the non-finalized tapScriptSig path which identifies signatures by pubkey.\n if (input.finalScriptWitness && input.finalScriptWitness.length > 0) {\n throw new Error(\n \"PegIn input PSBT is already finalized. Cannot reliably extract the \" +\n \"depositor signature from the witness stack. Ensure the wallet returns \" +\n \"a non-finalized PSBT with tapScriptSig entries.\",\n );\n }\n\n throw new Error(\n \"No tapScriptSig or finalScriptWitness found in signed PegIn input PSBT\",\n );\n}\n\n/**\n * Finalize a signed PegIn input PSBT and return the depositor-signed transaction hex.\n *\n * The default tapscript finalizer builds the full witness stack [sig, script, controlBlock]\n * that vaultd requires when verifying the depositor signature on-chain.\n *\n * @param signedPsbtHex - Non-finalized signed PSBT hex (returned by wallet with autoFinalized: false)\n * @returns Depositor-signed PegIn transaction hex with full taproot witness stack\n */\nexport function finalizePeginInputPsbt(signedPsbtHex: string): string {\n const psbt = Psbt.fromHex(signedPsbtHex);\n\n // Some wallets (UniSat, OKX) ignore autoFinalized: false and return\n // already-finalized PSBTs. finalizeAllInputs() throws in that case,\n // so fall back to verifying the wallet already finalized all inputs.\n try {\n psbt.finalizeAllInputs();\n } catch (e) {\n const allFinalized = psbt.data.inputs.every(\n (inp) => inp.finalScriptWitness || inp.finalScriptSig,\n );\n if (!allFinalized) {\n throw new Error(\n `PSBT finalization failed and wallet did not auto-finalize: ${e}`,\n );\n }\n }\n\n return psbt.extractTransaction().toHex();\n}\n\n/**\n * Extract and validate a 64-byte Schnorr signature.\n * PegIn input signatures must use implicit Taproot SIGHASH_DEFAULT, which is\n * encoded by omitting the sighash byte. Reject 65-byte signatures instead of\n * stripping the sighash byte because it changes the signed Taproot message.\n * @internal\n */\nexport function extractSchnorrSig(sig: Uint8Array): string {\n if (sig.length === 64) {\n return uint8ArrayToHex(new Uint8Array(sig));\n }\n if (sig.length === 65) {\n throw new Error(\n `Unexpected sighash byte 0x${sig[64].toString(16).padStart(2, \"0\")} in PegIn input signature. ` +\n \"Expected implicit SIGHASH_DEFAULT as a 64-byte signature.\",\n );\n }\n throw new Error(`Unexpected PegIn input signature length: ${sig.length}`);\n}\n"],"names":["buildPeginInputPsbt","params","peginTxHex","stripHexPrefix","fundedPrePeginTxHex","htlcConnector","getPrePeginHtlcConnectorInfo","peginTx","Transaction","prePeginTx","peginInput","prePeginTxid","peginInputTxid","uint8ArrayToHex","htlcOutput","hashlockScript","hexToUint8Array","hashlockControlBlock","psbt","Psbt","TAPSCRIPT_LEAF_VERSION","Buffer","tapInternalPubkey","output","extractPeginInputSignature","signedPsbtHex","depositorPubkey","input","depositorPubkeyBytes","sigEntry","extractSchnorrSig","finalizePeginIn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A,EAAI;AAAA,IAAA;AAGvC,YAAM,IAAI;AAAA,QACR,8DAA8DD,CAAC;AAAA,MAAA;AAAA,EAGrE;AAEA,SAAOd,EAAK,mBAAA,EAAqB,MAAA;AACnC;AASO,SAASY,EAAkBI,GAAyB;AACzD,MAAIA,EAAI,WAAW;AACjB,WAAOrB,EAAgB,IAAI,WAAWqB,CAAG,CAAC;AAE5C,QAAIA,EAAI,WAAW,KACX,IAAI;AAAA,IACR,6BAA6BA,EAAI,EAAE,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC;AAAA,EAAA,IAIhE,IAAI,MAAM,4CAA4CA,EAAI,MAAM,EAAE;AAC1E;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const h=require("@babylonlabs-io/babylon-tbv-rust-wasm"),l=require("buffer"),a=require("bitcoinjs-lib"),i=require("./bitcoin-CHfKAhcI.cjs");async function b(t){const r=i.stripHexPrefix(t.peginTxHex),c=i.stripHexPrefix(t.fundedPrePeginTxHex),n=await h.getPrePeginHtlcConnectorInfo({depositorPubkey:t.depositorPubkey,vaultProviderPubkey:t.vaultProviderPubkey,vaultKeeperPubkeys:t.vaultKeeperPubkeys,universalChallengerPubkeys:t.universalChallengerPubkeys,hashlock:t.hashlock,timelockRefund:t.timelockRefund,network:t.network}),e=a.Transaction.fromHex(r),o=a.Transaction.fromHex(c);if(e.ins.length!==1)throw new Error(`PegIn transaction must have exactly 1 input, got ${e.ins.length}`);const s=e.ins[0],f=o.getId(),g=i.uint8ArrayToHex(new Uint8Array(s.hash).slice().reverse());if(g!==f)throw new Error(`PegIn input does not reference the Pre-PegIn transaction. Expected ${f}, got ${g}`);const p=o.outs[s.index];if(!p)throw new Error(`Pre-PegIn output ${s.index} not found (Pre-PegIn has ${o.outs.length} outputs)`);const d=i.hexToUint8Array(n.hashlockScript),x=i.hexToUint8Array(n.hashlockControlBlock),u=new a.Psbt;u.setVersion(e.version),u.setLocktime(e.locktime),u.addInput({hash:s.hash,index:s.index,sequence:s.sequence,witnessUtxo:{script:p.script,value:p.value},tapLeafScript:[{leafVersion:i.TAPSCRIPT_LEAF_VERSION,script:l.Buffer.from(d),controlBlock:l.Buffer.from(x)}],tapInternalKey:l.Buffer.from(h.tapInternalPubkey)});for(const P of e.outs)u.addOutput({script:P.script,value:P.value});return{psbtHex:u.toHex()}}function S(t,r){const n=a.Psbt.fromHex(t).data.inputs[0];if(!n)throw new Error("PegIn PSBT has no inputs");if(n.tapScriptSig&&n.tapScriptSig.length>0){const e=l.Buffer.from(i.hexToUint8Array(r));for(const o of n.tapScriptSig)if(o.pubkey.equals(e))return y(o.signature);throw new Error(`No PegIn input signature found for depositor pubkey: ${r}`)}throw n.finalScriptWitness&&n.finalScriptWitness.length>0?new Error("PegIn input PSBT is already finalized. Cannot reliably extract the depositor signature from the witness stack. Ensure the wallet returns a non-finalized PSBT with tapScriptSig entries."):new Error("No tapScriptSig or finalScriptWitness found in signed PegIn input PSBT")}function w(t){const r=a.Psbt.fromHex(t);try{r.finalizeAllInputs()}catch(c){if(!r.data.inputs.every(e=>e.finalScriptWitness||e.finalScriptSig))throw new Error(`PSBT finalization failed and wallet did not auto-finalize: ${c}`)}return r.extractTransaction().toHex()}function y(t){if(t.length===64)return i.uint8ArrayToHex(new Uint8Array(t));throw t.length===65?new Error(`Unexpected sighash byte 0x${t[64].toString(16).padStart(2,"0")} in PegIn input signature. Expected implicit SIGHASH_DEFAULT as a 64-byte signature.`):new Error(`Unexpected PegIn input signature length: ${t.length}`)}exports.buildPeginInputPsbt=b;exports.extractPeginInputSignature=S;exports.finalizePeginInputPsbt=w;
|
|
2
|
+
//# sourceMappingURL=peginInput-DH6X4ITS.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peginInput-DH6X4ITS.cjs","sources":["../src/tbv/core/primitives/psbt/peginInput.ts"],"sourcesContent":["/**\n * PegIn Input PSBT Builder\n *\n * Builds the PSBT for the depositor to sign the PegIn transaction's HTLC input\n * (Pre-PegIn HTLC leaf 0 — the hashlock + all-party script).\n *\n * This is the \"Sign Pegin transaction HTLC leaf 0 input\" step in the pre-pegin\n * flow. The depositor signs input 0 of the PegIn transaction,\n * which spends output 0 of the funded Pre-PegIn transaction via script-path.\n *\n * @module primitives/psbt/peginInput\n */\n\nimport {\n getPrePeginHtlcConnectorInfo,\n tapInternalPubkey,\n type Network,\n} from \"@babylonlabs-io/babylon-tbv-rust-wasm\";\nimport { Buffer } from \"buffer\";\nimport { Psbt, Transaction } from \"bitcoinjs-lib\";\nimport { TAPSCRIPT_LEAF_VERSION, hexToUint8Array, stripHexPrefix, uint8ArrayToHex } from \"../utils/bitcoin\";\n\n/**\n * Parameters for building the PegIn input PSBT\n */\nexport interface BuildPeginInputPsbtParams {\n /**\n * PegIn transaction hex (1 input spending Pre-PegIn HTLC output 0).\n * Returned by buildPeginTxFromFundedPrePegin().\n */\n peginTxHex: string;\n /**\n * Funded Pre-PegIn transaction hex.\n * Used to look up the HTLC output that the PegIn input spends.\n */\n fundedPrePeginTxHex: string;\n /** Depositor's BTC public key (x-only, 64-char hex) */\n depositorPubkey: string;\n /** Vault provider's BTC public key (x-only, 64-char hex) */\n vaultProviderPubkey: string;\n /** Vault keeper BTC public keys (x-only, 64-char hex) */\n vaultKeeperPubkeys: string[];\n /** Universal challenger BTC public keys (x-only, 64-char hex) */\n universalChallengerPubkeys: string[];\n /** SHA256 hash commitment (64 hex chars = 32 bytes) */\n hashlock: string;\n /** CSV timelock in blocks for the HTLC refund path */\n timelockRefund: number;\n /** Bitcoin network */\n network: Network;\n}\n\n/**\n * Result of building the PegIn input PSBT\n */\nexport interface BuildPeginInputPsbtResult {\n /** PSBT hex for the depositor to sign */\n psbtHex: string;\n}\n\n/**\n * Build PSBT for depositor to sign the PegIn transaction's HTLC leaf 0 input.\n *\n * The PegIn transaction spends the Pre-PegIn HTLC output (output 0) via the\n * hashlock + all-party script (leaf 0). The depositor provides one of the required\n * signatures; the vault provider and keepers provide theirs separately via the\n * signPeginInput RPC.\n *\n * The PSBT uses Taproot script-path spending:\n * - witnessUtxo: the Pre-PegIn HTLC output\n * - tapLeafScript: hashlock leaf script + control block\n * - tapInternalKey: NUMS unspendable key (BIP-341 nothing-up-my-sleeve)\n *\n * @param params - PegIn input PSBT parameters\n * @returns PSBT hex ready for depositor signing\n * @throws If PegIn tx does not have exactly 1 input\n * @throws If PegIn input does not reference the Pre-PegIn HTLC output\n * @throws If Pre-PegIn tx output 0 is not found\n */\nexport async function buildPeginInputPsbt(\n params: BuildPeginInputPsbtParams,\n): Promise<BuildPeginInputPsbtResult> {\n const peginTxHex = stripHexPrefix(params.peginTxHex);\n const fundedPrePeginTxHex = stripHexPrefix(params.fundedPrePeginTxHex);\n\n const htlcConnector = await getPrePeginHtlcConnectorInfo({\n depositorPubkey: params.depositorPubkey,\n vaultProviderPubkey: params.vaultProviderPubkey,\n vaultKeeperPubkeys: params.vaultKeeperPubkeys,\n universalChallengerPubkeys: params.universalChallengerPubkeys,\n hashlock: params.hashlock,\n timelockRefund: params.timelockRefund,\n network: params.network,\n });\n\n const peginTx = Transaction.fromHex(peginTxHex);\n const prePeginTx = Transaction.fromHex(fundedPrePeginTxHex);\n\n if (peginTx.ins.length !== 1) {\n throw new Error(\n `PegIn transaction must have exactly 1 input, got ${peginTx.ins.length}`,\n );\n }\n\n const peginInput = peginTx.ins[0];\n\n // Verify PegIn input 0 spends Pre-PegIn output 0\n const prePeginTxid = prePeginTx.getId();\n const peginInputTxid = uint8ArrayToHex(\n new Uint8Array(peginInput.hash).slice().reverse(),\n );\n\n if (peginInputTxid !== prePeginTxid) {\n throw new Error(\n `PegIn input does not reference the Pre-PegIn transaction. ` +\n `Expected ${prePeginTxid}, got ${peginInputTxid}`,\n );\n }\n\n const htlcOutput = prePeginTx.outs[peginInput.index];\n if (!htlcOutput) {\n throw new Error(\n `Pre-PegIn output ${peginInput.index} not found ` +\n `(Pre-PegIn has ${prePeginTx.outs.length} outputs)`,\n );\n }\n\n const hashlockScript = hexToUint8Array(htlcConnector.hashlockScript);\n const hashlockControlBlock = hexToUint8Array(htlcConnector.hashlockControlBlock);\n\n const psbt = new Psbt();\n psbt.setVersion(peginTx.version);\n psbt.setLocktime(peginTx.locktime);\n\n // Input 0: PegIn input spending Pre-PegIn HTLC output 0 via hashlock leaf (leaf 0).\n // The depositor signs using Taproot script-path spending.\n psbt.addInput({\n hash: peginInput.hash,\n index: peginInput.index,\n sequence: peginInput.sequence,\n witnessUtxo: {\n script: htlcOutput.script,\n value: htlcOutput.value,\n },\n tapLeafScript: [\n {\n leafVersion: TAPSCRIPT_LEAF_VERSION,\n script: Buffer.from(hashlockScript),\n controlBlock: Buffer.from(hashlockControlBlock),\n },\n ],\n tapInternalKey: Buffer.from(tapInternalPubkey),\n // sighashType omitted — defaults to SIGHASH_DEFAULT (0x00) for Taproot\n });\n\n for (const output of peginTx.outs) {\n psbt.addOutput({\n script: output.script,\n value: output.value,\n });\n }\n\n return { psbtHex: psbt.toHex() };\n}\n\n/**\n * Extract the depositor's Schnorr signature from a signed PegIn input PSBT.\n *\n * Supports non-finalized PSBTs with tapScriptSig entries. Finalized PSBTs are\n * rejected because the witness stack does not reliably identify the depositor\n * signature by public key.\n *\n * PegIn input signatures must use implicit Taproot SIGHASH_DEFAULT, which is\n * encoded by omitting the sighash byte. Signatures with an appended sighash byte\n * are rejected rather than stripped.\n *\n * @param signedPsbtHex - Signed PSBT hex\n * @param depositorPubkey - Depositor's x-only public key (64-char hex)\n * @returns 64-byte Schnorr signature (128 hex chars, no sighash flag)\n * @throws If no signature is found for the depositor's key\n */\nexport function extractPeginInputSignature(\n signedPsbtHex: string,\n depositorPubkey: string,\n): string {\n const signedPsbt = Psbt.fromHex(signedPsbtHex);\n const input = signedPsbt.data.inputs[0];\n\n if (!input) {\n throw new Error(\"PegIn PSBT has no inputs\");\n }\n\n // Non-finalized PSBT — extract from tapScriptSig\n if (input.tapScriptSig && input.tapScriptSig.length > 0) {\n const depositorPubkeyBytes = Buffer.from(\n hexToUint8Array(depositorPubkey),\n );\n\n for (const sigEntry of input.tapScriptSig) {\n if (sigEntry.pubkey.equals(depositorPubkeyBytes)) {\n return extractSchnorrSig(sigEntry.signature);\n }\n }\n\n throw new Error(\n `No PegIn input signature found for depositor pubkey: ${depositorPubkey}`,\n );\n }\n\n // Finalized PSBT — the witness stack order depends on the wallet's finalizer,\n // so we cannot reliably pick the depositor's signature by position. Require\n // the non-finalized tapScriptSig path which identifies signatures by pubkey.\n if (input.finalScriptWitness && input.finalScriptWitness.length > 0) {\n throw new Error(\n \"PegIn input PSBT is already finalized. Cannot reliably extract the \" +\n \"depositor signature from the witness stack. Ensure the wallet returns \" +\n \"a non-finalized PSBT with tapScriptSig entries.\",\n );\n }\n\n throw new Error(\n \"No tapScriptSig or finalScriptWitness found in signed PegIn input PSBT\",\n );\n}\n\n/**\n * Finalize a signed PegIn input PSBT and return the depositor-signed transaction hex.\n *\n * The default tapscript finalizer builds the full witness stack [sig, script, controlBlock]\n * that vaultd requires when verifying the depositor signature on-chain.\n *\n * @param signedPsbtHex - Non-finalized signed PSBT hex (returned by wallet with autoFinalized: false)\n * @returns Depositor-signed PegIn transaction hex with full taproot witness stack\n */\nexport function finalizePeginInputPsbt(signedPsbtHex: string): string {\n const psbt = Psbt.fromHex(signedPsbtHex);\n\n // Some wallets (UniSat, OKX) ignore autoFinalized: false and return\n // already-finalized PSBTs. finalizeAllInputs() throws in that case,\n // so fall back to verifying the wallet already finalized all inputs.\n try {\n psbt.finalizeAllInputs();\n } catch (e) {\n const allFinalized = psbt.data.inputs.every(\n (inp) => inp.finalScriptWitness || inp.finalScriptSig,\n );\n if (!allFinalized) {\n throw new Error(\n `PSBT finalization failed and wallet did not auto-finalize: ${e}`,\n );\n }\n }\n\n return psbt.extractTransaction().toHex();\n}\n\n/**\n * Extract and validate a 64-byte Schnorr signature.\n * PegIn input signatures must use implicit Taproot SIGHASH_DEFAULT, which is\n * encoded by omitting the sighash byte. Reject 65-byte signatures instead of\n * stripping the sighash byte because it changes the signed Taproot message.\n * @internal\n */\nexport function extractSchnorrSig(sig: Uint8Array): string {\n if (sig.length === 64) {\n return uint8ArrayToHex(new Uint8Array(sig));\n }\n if (sig.length === 65) {\n throw new Error(\n `Unexpected sighash byte 0x${sig[64].toString(16).padStart(2, \"0\")} in PegIn input signature. ` +\n \"Expected implicit SIGHASH_DEFAULT as a 64-byte signature.\",\n );\n }\n throw new Error(`Unexpected PegIn input signature length: ${sig.length}`);\n}\n"],"names":["buildPeginInputPsbt","params","peginTxHex","stripHexPrefix","fundedPrePeginTxHex","htlcConnector","getPrePeginHtlcConnectorInfo","peginTx","Transaction","prePeginTx","peginInput","prePeginTxid","peginInputTxid","uint8ArrayToHex","htlcOutput","hashlockScript","hexToUint8Array","hashlockControlBlock","psbt","Psbt","TAPSCRIPT_LEAF_VERSION","Buffer","tapInternalPubkey","output","extractPeginInputSignature","signedPsbtHex","depositorPubkey","input","depositorPubkeyBytes","sigEntry","extractSchnorrSig","finalizePeginInputPsbt","e","inp","sig"],"mappings":"yJA+EA,eAAsBA,EACpBC,EACoC,CACpC,MAAMC,EAAaC,EAAAA,eAAeF,EAAO,UAAU,EAC7CG,EAAsBD,EAAAA,eAAeF,EAAO,mBAAmB,EAE/DI,EAAgB,MAAMC,+BAA6B,CACvD,gBAAiBL,EAAO,gBACxB,oBAAqBA,EAAO,oBAC5B,mBAAoBA,EAAO,mBAC3B,2BAA4BA,EAAO,2BACnC,SAAUA,EAAO,SACjB,eAAgBA,EAAO,eACvB,QAASA,EAAO,OAAA,CACjB,EAEKM,EAAUC,EAAAA,YAAY,QAAQN,CAAU,EACxCO,EAAaD,EAAAA,YAAY,QAAQJ,CAAmB,EAE1D,GAAIG,EAAQ,IAAI,SAAW,EACzB,MAAM,IAAI,MACR,oDAAoDA,EAAQ,IAAI,MAAM,EAAA,EAI1E,MAAMG,EAAaH,EAAQ,IAAI,CAAC,EAG1BI,EAAeF,EAAW,MAAA,EAC1BG,EAAiBC,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AWG,KAAYF,EAAM,aAC3B,GAAIE,EAAS,OAAO,OAAOD,CAAoB,EAC7C,OAAOE,EAAkBD,EAAS,SAAS,EAI/C,MAAM,IAAI,MACR,wDAAwDH,CAAe,EAAA,CAE3E,CAKA,MAAIC,EAAM,oBAAsBA,EAAM,mBAAmB,OAAS,EAC1D,IAAI,MACR,0LAAA,EAME,IAAI,MACR,wEAAA,CAEJ,CAWO,SAASI,EAAuBN,EAA+B,CACpE,MAAMP,EAAOC,EAAAA,KAAK,QAAQM,CAAa,EAKvC,GAAI,CACFP,EAAK,kBAAA,CACP,OAASc,EAAG,CAIV,GAAI,CAHiBd,EAAK,KAAK,OAAO,MACnCe,GAAQA,EAAI,oBAAsBA,EAAI,cAAA,EAGvC,MAAM,IAAI,MACR,8DAA8DD,CAAC,EAAA,CAGrE,CAEA,OAAOd,EAAK,mBAAA,EAAqB,MAAA,CACnC,CASO,SAASY,EAAkBI,EAAyB,CACzD,GAAIA,EAAI,SAAW,GACjB,OAAOrB,kBAAgB,IAAI,WAAWqB,CAAG,CAAC,EAE5C,MAAIA,EAAI,SAAW,GACX,IAAI,MACR,6BAA6BA,EAAI,EAAE,EAAE,SAAS,EAAE,EAAE,SAAS,EAAG,GAAG,CAAC,sFAAA,EAIhE,IAAI,MAAM,4CAA4CA,EAAI,MAAM,EAAE,CAC1E"}
|
package/dist/tbv/core/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../../challengeAssert-CNRdpCzm.cjs"),c=require("@babylonlabs-io/babylon-tbv-rust-wasm"),n=require("../../assertPsbtUnsignedTxMatches-fNkAaZZm.cjs"),S=require("../../peginInput-DH6X4ITS.cjs"),E=require("../../noPayout-jtZsoOzY.cjs"),r=require("../../bitcoin-CHfKAhcI.cjs"),_=require("../../signing-Bnsro0hE.cjs"),d=require("../../validation-u8W7Lp2x.cjs"),u=require("../../PeginManager-DaDs-bGr.cjs"),g=require("../../PayoutManager-DERMRuUU.cjs"),R=require("../../ProtocolParams.abi-DQhcqsNr.cjs"),m=require("../../BTCVaultRegistry.abi-CHFGevwa.cjs"),P=require("../../errors-BP73_stm.cjs"),i=require("../../waitForTransactionReceiptSmartAware-tv1mtSIY.cjs"),a=require("../../fundPeginTransaction-BBE3wTjR.cjs"),l=require("../../reservation-hjXStM03.cjs"),s=require("../../mempoolApi-YNkKjQCU.cjs"),t=require("../../vault-registry-reader-CbJHSxVe.cjs"),o=require("../../types-D2jcXfm7.cjs"),A=require("../../errors-Bu0H-dZD.cjs"),e=require("../../buildAndBroadcastRefund-DVMT-pXQ.cjs"),T=require("../../peginState-BijNNT15.cjs");exports.buildChallengeAssertPsbt=p.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=p.buildDepositorPayoutPsbt;exports.computeNumLocalChallengers=p.computeNumLocalChallengers;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>c.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>c.deriveVaultId});Object.defineProperty(exports,"expandAuthAnchor",{enumerable:!0,get:()=>c.expandAuthAnchor});Object.defineProperty(exports,"expandHashlockSecret",{enumerable:!0,get:()=>c.expandHashlockSecret});Object.defineProperty(exports,"expandWotsSeed",{enumerable:!0,get:()=>c.expandWotsSeed});exports.PsbtSubstitutionError=n.PsbtSubstitutionError;exports.assertPayoutOutputMatchesRegistered=n.assertPayoutOutputMatchesRegistered;exports.assertPsbtUnsignedTxMatches=n.assertPsbtUnsignedTxMatches;exports.buildPayoutPsbt=n.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=n.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=n.buildPrePeginPsbt;exports.createPayoutScript=n.createPayoutScript;exports.extractPayoutSignature=n.extractPayoutSignature;exports.buildPeginInputPsbt=S.buildPeginInputPsbt;exports.extractPeginInputSignature=S.extractPeginInputSignature;exports.finalizePeginInputPsbt=S.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=E.buildNoPayoutPsbt;exports.buildRefundPsbt=E.buildRefundPsbt;exports.deriveBip86ScriptPubKeyHex=r.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=r.deriveNativeSegwitAddress;exports.deriveTaprootAddress=r.deriveTaprootAddress;exports.ensureHexPrefix=r.ensureHexPrefix;exports.formatSatoshisToBtc=r.formatSatoshisToBtc;exports.getNetwork=r.getNetwork;exports.getSortedXOnlyPubkeys=r.getSortedXOnlyPubkeys;exports.hexToUint8Array=r.hexToUint8Array;exports.isAddressFromPublicKey=r.isAddressFromPublicKey;exports.isValidHex=r.isValidHex;exports.processPublicKeyToXOnly=r.processPublicKeyToXOnly;exports.stripHexPrefix=r.stripHexPrefix;exports.toXOnly=r.toXOnly;exports.uint8ArrayToHex=r.uint8ArrayToHex;exports.validateWalletPubkey=r.validateWalletPubkey;exports.createTaprootScriptPathSignOptions=_.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=d.BITCOIN_ADDRESS_RE;exports.HEX_RE=d.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=d.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=d.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=d.TXID_RE;exports.PeginManager=u.PeginManager;exports.VAULT_APP_NAME=u.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=u.buildFundingOutpointsCommitment;exports.buildVaultContext=u.buildVaultContext;exports.computeWotsBlockPublicKeysHash=u.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=u.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=u.deriveWotsBlocksFromSeed;exports.PayoutManager=g.PayoutManager;exports.computeHashlock=g.computeHashlock;exports.validateSecretAgainstHashlock=g.validateSecretAgainstHashlock;exports.ApplicationRegistryABI=R.ApplicationRegistryABI;exports.ProtocolParamsABI=R.ProtocolParamsABI;exports.BTCVaultRegistryABI=m.BTCVaultRegistryABI;exports.CONTRACT_ERRORS=P.CONTRACT_ERRORS;exports.extractErrorData=P.extractErrorData;exports.getContractErrorMessage=P.getContractErrorMessage;exports.handleContractError=P.handleContractError;exports.isKnownContractError=P.isKnownContractError;exports.BitcoinScriptType=i.BitcoinScriptType;exports.applyChangeOutputPolicy=i.applyChangeOutputPolicy;exports.calculateBtcTxHash=i.calculateBtcTxHash;exports.computeChangeOutputFeeSats=i.computeChangeOutputFeeSats;exports.computeMaxDeposit=i.computeMaxDeposit;exports.computePeginBaseFeeSats=i.computePeginBaseFeeSats;exports.getDustThreshold=i.getDustThreshold;exports.getPsbtInputFields=i.getPsbtInputFields;exports.getScriptType=i.getScriptType;exports.selectUtxosForPegin=i.selectUtxosForPegin;exports.shouldAddChangeOutput=i.shouldAddChangeOutput;exports.waitForTransactionReceiptSmartAware=i.waitForTransactionReceiptSmartAware;exports.BTC_DUST_SAT=a.BTC_DUST_SAT;exports.DUST_THRESHOLD=a.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=a.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=a.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=a.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=a.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=a.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=a.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=a.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=a.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=a.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=a.fundPeginTransaction;exports.parseUnfundedWasmTransaction=a.parseUnfundedWasmTransaction;exports.peginOutputCount=a.peginOutputCount;exports.rateBasedTxBufferFee=a.rateBasedTxBufferFee;exports.UtxoNotAvailableError=l.UtxoNotAvailableError;exports.assertUtxosAvailable=l.assertUtxosAvailable;exports.collectReservedUtxoRefs=l.collectReservedUtxoRefs;exports.extractInputsFromTransaction=l.extractInputsFromTransaction;exports.selectUtxosForDeposit=l.selectUtxosForDeposit;exports.validateUtxosAvailable=l.validateUtxosAvailable;exports.MEMPOOL_API_URLS=s.MEMPOOL_API_URLS;exports.getAddressTxs=s.getAddressTxs;exports.getAddressUtxos=s.getAddressUtxos;exports.getMempoolApiUrl=s.getMempoolApiUrl;exports.getNetworkFees=s.getNetworkFees;exports.getTxHex=s.getTxHex;exports.getTxInfo=s.getTxInfo;exports.getUtxoInfo=s.getUtxoInfo;exports.pushTx=s.pushTx;exports.ServerIdentityError=t.ServerIdentityError;exports.VaultProviderRpcClient=t.VaultProviderRpcClient;exports.ViemProtocolParamsReader=t.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=t.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=t.ViemVaultKeeperReader;exports.ViemVaultRegistryReader=t.ViemVaultRegistryReader;exports.VpResponseValidationError=t.VpResponseValidationError;exports.VpTokenRegistry=t.VpTokenRegistry;exports.batchPollByProvider=t.batchPollByProvider;exports.createAuthenticatedVpClient=t.createAuthenticatedVpClient;exports.primeVpTokenRegistry=t.primeVpTokenRegistry;exports.resolveProtocolAddresses=t.resolveProtocolAddresses;exports.validateOffchainParams=t.validateOffchainParams;exports.validatePegInConfiguration=t.validatePegInConfiguration;exports.validateRequestDepositorClaimerArtifactsResponse=t.validateRequestDepositorClaimerArtifactsResponse;exports.validateTBVProtocolParams=t.validateTBVProtocolParams;exports.verifyServerIdentity=t.verifyServerIdentity;exports.vpTokenRegistry=t.vpTokenRegistry;exports.DaemonStatus=o.DaemonStatus;exports.JSON_RPC_ERROR_CODES=o.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=o.JsonRpcClient;exports.JsonRpcError=o.JsonRpcError;exports.POST_WOTS_STATUSES=o.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=o.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=o.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=o.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=o.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=o.VP_TRANSIENT_STATUSES;exports.isWotsMismatchError=A.isWotsMismatchError;exports.parseFundingOutpointsFromTx=A.parseFundingOutpointsFromTx;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=e.ClaimerPegoutStatusValue;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.RegisteredVaultVersionMismatchError=e.RegisteredVaultVersionMismatchError;exports.activateVault=e.activateVault;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isPegoutTerminalStatus=e.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=e.isRecognizedPegoutStatus;exports.isRegisteredVaultVersionMismatchError=e.isRegisteredVaultVersionMismatchError;exports.runDepositorPresignFlow=e.runDepositorPresignFlow;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=e.validateOnChainParticipantKeys;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.verifyRegisteredVaultVersions=e.verifyRegisteredVaultVersions;exports.waitForPeginStatus=e.waitForPeginStatus;exports.ContractStatus=T.ContractStatus;exports.PeginAction=T.PeginAction;exports.canPerformAction=T.canPerformAction;exports.getPeginProtocolState=T.getPeginProtocolState;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/tbv/core/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { a as s, b as t, c as r } from "../../challengeAssert-
|
|
1
|
+
import { a as s, b as t, c as r } from "../../challengeAssert-CBp4mEs0.js";
|
|
2
2
|
import { computeMinClaimValue as i, deriveVaultId as n, expandAuthAnchor as u, expandHashlockSecret as l, expandWotsSeed as p } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
|
-
import { c as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { P, c, f as T, d as S, a as g, b as E, g as m, e as R } from "../../assertPsbtUnsignedTxMatches-mTAnLhCz.js";
|
|
4
|
+
import { b as _, e as x, f } from "../../peginInput-BPRB9tUi.js";
|
|
5
|
+
import { a as v, b as I } from "../../noPayout-qbaSEKGC.js";
|
|
6
6
|
import { d as V, a as y, b as O, e as h, f as U, j as F, g as B, h as N, i as D, c as M, p as H, s as L, t as k, u as W, v as X } from "../../bitcoin-B5aNKtsk.js";
|
|
7
7
|
import { c as K } from "../../signing-DaLvGwQe.js";
|
|
8
8
|
import { B as Y, H as Z, K as J, M as j, T as z } from "../../validation-CxqROCno.js";
|
|
9
|
-
import { P as Q, V as $, b as aa, a as ea, c as sa, e as ta, d as ra } from "../../PeginManager-
|
|
10
|
-
import { P as ia, c as na, v as ua } from "../../PayoutManager-
|
|
9
|
+
import { P as Q, V as $, b as aa, a as ea, c as sa, e as ta, d as ra } from "../../PeginManager-Cp2Tn5sH.js";
|
|
10
|
+
import { P as ia, c as na, v as ua } from "../../PayoutManager-D29D-K-V.js";
|
|
11
11
|
import { A as pa, P as da } from "../../ProtocolParams.abi-C2brDWTI.js";
|
|
12
12
|
import { B as ca } from "../../BTCVaultRegistry.abi-Cq9-JlqT.js";
|
|
13
13
|
import { C as Sa, e as ga, g as Ea, h as ma, i as Ra } from "../../errors-CznAK5NB.js";
|
|
@@ -18,7 +18,7 @@ import { M as te, g as re, a as oe, b as ie, c as ne, d as ue, e as le, f as pe,
|
|
|
18
18
|
import { S as ce, V as Te, j as Se, k as ge, l as Ee, m as me, a as Re, d as Ae, b as _e, f as xe, p as fe, r as be, g as ve, h as Ie, v as Ce, i as Ve, c as ye, e as Oe } from "../../vault-registry-reader-BrARgFre.js";
|
|
19
19
|
import { D as Ue, b as Fe, J as Be, a as Ne, d as De, P as Me, R as He, e as Le, c as ke, V as We } from "../../types-TOmEvvRy.js";
|
|
20
20
|
import { i as we, p as Ke } from "../../errors-9AkghWyk.js";
|
|
21
|
-
import { B as Ye, C as Ze, p as Je, R as je, a as ze, n as qe, o as Qe, i as $e, m as as, l as es, j as ss, r as ts, b as rs, s as os, v as is, g as ns, h as us, d as ls, c as ps, e as ds, f as Ps, k as cs, w as Ts } from "../../buildAndBroadcastRefund-
|
|
21
|
+
import { B as Ye, C as Ze, p as Je, R as je, a as ze, n as qe, o as Qe, i as $e, m as as, l as es, j as ss, r as ts, b as rs, s as os, v as is, g as ns, h as us, d as ls, c as ps, e as ds, f as Ps, k as cs, w as Ts } from "../../buildAndBroadcastRefund-B5cOyUzj.js";
|
|
22
22
|
import { C as gs, P as Es, c as ms, g as Rs } from "../../peginState-CBAlxgXk.js";
|
|
23
23
|
export {
|
|
24
24
|
pa as ApplicationRegistryABI,
|
|
@@ -51,7 +51,7 @@ export {
|
|
|
51
51
|
Es as PeginAction,
|
|
52
52
|
Q as PeginManager,
|
|
53
53
|
da as ProtocolParamsABI,
|
|
54
|
-
|
|
54
|
+
P as PsbtSubstitutionError,
|
|
55
55
|
Je as REFUND_VSIZE,
|
|
56
56
|
je as RegisteredVaultVersionMismatchError,
|
|
57
57
|
He as RpcErrorCode,
|
|
@@ -74,20 +74,20 @@ export {
|
|
|
74
74
|
Ka as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
75
75
|
ze as activateVault,
|
|
76
76
|
xa as applyChangeOutputPolicy,
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
c as assertPayoutOutputMatchesRegistered,
|
|
78
|
+
T as assertPsbtUnsignedTxMatches,
|
|
79
79
|
qa as assertUtxosAvailable,
|
|
80
80
|
_e as batchPollByProvider,
|
|
81
81
|
qe as buildAndBroadcastRefund,
|
|
82
82
|
s as buildChallengeAssertPsbt,
|
|
83
83
|
t as buildDepositorPayoutPsbt,
|
|
84
84
|
aa as buildFundingOutpointsCommitment,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
v as buildNoPayoutPsbt,
|
|
86
|
+
S as buildPayoutPsbt,
|
|
87
|
+
_ as buildPeginInputPsbt,
|
|
88
|
+
g as buildPeginTxFromFundedPrePegin,
|
|
89
|
+
E as buildPrePeginPsbt,
|
|
90
|
+
I as buildRefundPsbt,
|
|
91
91
|
ea as buildVaultContext,
|
|
92
92
|
fa as calculateBtcTxHash,
|
|
93
93
|
ms as canPerformAction,
|
|
@@ -100,7 +100,7 @@ export {
|
|
|
100
100
|
Ia as computePeginBaseFeeSats,
|
|
101
101
|
sa as computeWotsBlockPublicKeysHash,
|
|
102
102
|
xe as createAuthenticatedVpClient,
|
|
103
|
-
|
|
103
|
+
m as createPayoutScript,
|
|
104
104
|
K as createTaprootScriptPathSignOptions,
|
|
105
105
|
V as deriveBip86ScriptPubKeyHex,
|
|
106
106
|
y as deriveNativeSegwitAddress,
|
|
@@ -115,9 +115,9 @@ export {
|
|
|
115
115
|
p as expandWotsSeed,
|
|
116
116
|
ga as extractErrorData,
|
|
117
117
|
$a as extractInputsFromTransaction,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
R as extractPayoutSignature,
|
|
119
|
+
x as extractPeginInputSignature,
|
|
120
|
+
f as finalizePeginInputPsbt,
|
|
121
121
|
U as formatSatoshisToBtc,
|
|
122
122
|
Ga as fundPeginTransaction,
|
|
123
123
|
re as getAddressTxs,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../PeginManager-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../PeginManager-DaDs-bGr.cjs"),a=require("../../../PayoutManager-DERMRuUU.cjs");exports.PeginManager=e.PeginManager;exports.PayoutManager=a.PayoutManager;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as e } from "../../../PeginManager-
|
|
2
|
-
import { P } from "../../../PayoutManager-
|
|
1
|
+
import { P as e } from "../../../PeginManager-Cp2Tn5sH.js";
|
|
2
|
+
import { P } from "../../../PayoutManager-D29D-K-V.js";
|
|
3
3
|
export {
|
|
4
4
|
P as PayoutManager,
|
|
5
5
|
e as PeginManager
|
|
@@ -22,4 +22,41 @@
|
|
|
22
22
|
* pushes a payload other than `expectedAuthAnchorHashHex`.
|
|
23
23
|
*/
|
|
24
24
|
export declare function assertAuthAnchorOpReturn(fundedPrePeginTxHex: string, vaultCount: number, expectedAuthAnchorHashHex: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Best-effort reader for the auth-anchor OP_RETURN payload at `vout` of
|
|
27
|
+
* a funded Pre-PegIn transaction.
|
|
28
|
+
*
|
|
29
|
+
* Returns the 32-byte payload as lowercase hex (no `0x` prefix) if the
|
|
30
|
+
* output at `vout` is exactly `OP_RETURN || PUSH32 || <32 bytes>` with
|
|
31
|
+
* a zero value. Returns `undefined` for any structural mismatch —
|
|
32
|
+
* missing output, wrong script shape, non-zero value — so legacy
|
|
33
|
+
* non-auth-anchored Pre-PegIns parse as "no anchor" rather than
|
|
34
|
+
* raising.
|
|
35
|
+
*
|
|
36
|
+
* Used by the refund flow to reconstruct the unfunded WASM template
|
|
37
|
+
* with the same output shape as the on-chain funded transaction.
|
|
38
|
+
* Assertion semantics (compare against an expected value, throw on
|
|
39
|
+
* mismatch) live in {@link assertAuthAnchorOpReturn}.
|
|
40
|
+
*/
|
|
41
|
+
export declare function readAuthAnchorOpReturn(fundedPrePeginTxHex: string, vout: number): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Scan a funded Pre-PegIn transaction for its auth-anchor commitment
|
|
44
|
+
* (an `OP_RETURN || PUSH32 || <32 bytes>` output with value 0).
|
|
45
|
+
*
|
|
46
|
+
* Returns `{ vout, hash }` when exactly one such output is found.
|
|
47
|
+
* Returns `undefined` when:
|
|
48
|
+
* - the hex is unparseable,
|
|
49
|
+
* - no matching output exists (legacy non-auth-anchored Pre-PegIn),
|
|
50
|
+
* - more than one matching output exists (ambiguous / malformed).
|
|
51
|
+
*
|
|
52
|
+
* Used by the refund orchestrator to (a) locate the on-chain anchor
|
|
53
|
+
* regardless of how many HTLCs preceded it and (b) detect multi-vault
|
|
54
|
+
* funded transactions structurally: the single-vault refund path
|
|
55
|
+
* reconstructs only one hashlock and expects the anchor at vout 1, so
|
|
56
|
+
* any other vout signals a layout this call cannot safely refund.
|
|
57
|
+
*/
|
|
58
|
+
export declare function findAuthAnchorOpReturn(fundedPrePeginTxHex: string): {
|
|
59
|
+
vout: number;
|
|
60
|
+
hash: string;
|
|
61
|
+
} | undefined;
|
|
25
62
|
//# sourceMappingURL=assertAuthAnchorOpReturn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertAuthAnchorOpReturn.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/managers/pegin/assertAuthAnchorOpReturn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CACtC,mBAAmB,EAAE,MAAM,EAC3B,UAAU,EAAE,MAAM,EAClB,yBAAyB,EAAE,MAAM,GAChC,IAAI,CAwCN"}
|
|
1
|
+
{"version":3,"file":"assertAuthAnchorOpReturn.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/managers/pegin/assertAuthAnchorOpReturn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CACtC,mBAAmB,EAAE,MAAM,EAC3B,UAAU,EAAE,MAAM,EAClB,yBAAyB,EAAE,MAAM,GAChC,IAAI,CAwCN;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CACpC,mBAAmB,EAAE,MAAM,EAC3B,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAyBpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CACpC,mBAAmB,EAAE,MAAM,GAC1B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CA0B5C"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module managers/pegin
|
|
7
7
|
*/
|
|
8
|
-
export { assertAuthAnchorOpReturn } from './assertAuthAnchorOpReturn';
|
|
8
|
+
export { assertAuthAnchorOpReturn, findAuthAnchorOpReturn, readAuthAnchorOpReturn, } from './assertAuthAnchorOpReturn';
|
|
9
9
|
export { expandPerVaultSecrets, type PerVaultExpansionResult, } from './expandPerVaultSecrets';
|
|
10
10
|
export { normalizePopSignature, normalizeXOnlyPubkey, } from './normalizeWalletInputs';
|
|
11
11
|
export { signPsbtsWithFallback } from './signPsbtsWithFallback';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/managers/pegin/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/managers/pegin/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,qBAAqB,EACrB,KAAK,uBAAuB,GAC7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../../challengeAssert-CNRdpCzm.cjs"),s=require("@babylonlabs-io/babylon-tbv-rust-wasm"),t=require("../../../assertPsbtUnsignedTxMatches-fNkAaZZm.cjs"),r=require("../../../peginInput-DH6X4ITS.cjs"),u=require("../../../noPayout-jtZsoOzY.cjs"),e=require("../../../bitcoin-CHfKAhcI.cjs");exports.buildChallengeAssertPsbt=i.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=i.buildDepositorPayoutPsbt;exports.computeNumLocalChallengers=i.computeNumLocalChallengers;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>s.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>s.deriveVaultId});exports.PsbtSubstitutionError=t.PsbtSubstitutionError;exports.assertPayoutOutputMatchesRegistered=t.assertPayoutOutputMatchesRegistered;exports.assertPsbtUnsignedTxMatches=t.assertPsbtUnsignedTxMatches;exports.buildPayoutPsbt=t.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=t.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=t.buildPrePeginPsbt;exports.createPayoutScript=t.createPayoutScript;exports.extractPayoutSignature=t.extractPayoutSignature;exports.buildPeginInputPsbt=r.buildPeginInputPsbt;exports.extractPeginInputSignature=r.extractPeginInputSignature;exports.finalizePeginInputPsbt=r.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=u.buildNoPayoutPsbt;exports.buildRefundPsbt=u.buildRefundPsbt;exports.deriveBip86ScriptPubKeyHex=e.deriveBip86ScriptPubKeyHex;exports.deriveNativeSegwitAddress=e.deriveNativeSegwitAddress;exports.deriveTaprootAddress=e.deriveTaprootAddress;exports.ensureHexPrefix=e.ensureHexPrefix;exports.formatSatoshisToBtc=e.formatSatoshisToBtc;exports.getSortedXOnlyPubkeys=e.getSortedXOnlyPubkeys;exports.hexToUint8Array=e.hexToUint8Array;exports.isAddressFromPublicKey=e.isAddressFromPublicKey;exports.isValidHex=e.isValidHex;exports.processPublicKeyToXOnly=e.processPublicKeyToXOnly;exports.stripHexPrefix=e.stripHexPrefix;exports.toXOnly=e.toXOnly;exports.uint8ArrayToHex=e.uint8ArrayToHex;exports.validateWalletPubkey=e.validateWalletPubkey;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { a, b as t, c as r } from "../../../challengeAssert-
|
|
1
|
+
import { a, b as t, c as r } from "../../../challengeAssert-CBp4mEs0.js";
|
|
2
2
|
import { computeMinClaimValue as o, deriveVaultId as u } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { P as b, c as d, f as l, d as n, a as p, b as x, g as c, e as g } from "../../../assertPsbtUnsignedTxMatches-mTAnLhCz.js";
|
|
4
|
+
import { b as f, e as m, f as S } from "../../../peginInput-BPRB9tUi.js";
|
|
5
|
+
import { a as v, b as T } from "../../../noPayout-qbaSEKGC.js";
|
|
6
6
|
import { d as H, a as I, b as O, e as C, f as F, g as K, h as M, i as N, c as V, p as X, s as k, t as B, u as R, v as U } from "../../../bitcoin-B5aNKtsk.js";
|
|
7
7
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
b as PsbtSubstitutionError,
|
|
9
|
+
d as assertPayoutOutputMatchesRegistered,
|
|
10
|
+
l as assertPsbtUnsignedTxMatches,
|
|
11
11
|
a as buildChallengeAssertPsbt,
|
|
12
12
|
t as buildDepositorPayoutPsbt,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
v as buildNoPayoutPsbt,
|
|
14
|
+
n as buildPayoutPsbt,
|
|
15
|
+
f as buildPeginInputPsbt,
|
|
16
|
+
p as buildPeginTxFromFundedPrePegin,
|
|
17
|
+
x as buildPrePeginPsbt,
|
|
18
|
+
T as buildRefundPsbt,
|
|
19
19
|
o as computeMinClaimValue,
|
|
20
20
|
r as computeNumLocalChallengers,
|
|
21
|
-
|
|
21
|
+
c as createPayoutScript,
|
|
22
22
|
H as deriveBip86ScriptPubKeyHex,
|
|
23
23
|
I as deriveNativeSegwitAddress,
|
|
24
24
|
O as deriveTaprootAddress,
|
|
25
25
|
u as deriveVaultId,
|
|
26
26
|
C as ensureHexPrefix,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
g as extractPayoutSignature,
|
|
28
|
+
m as extractPeginInputSignature,
|
|
29
|
+
S as finalizePeginInputPsbt,
|
|
30
30
|
F as formatSatoshisToBtc,
|
|
31
31
|
K as getSortedXOnlyPubkeys,
|
|
32
32
|
M as hexToUint8Array,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for buildRefundPsbt — refund PSBT construction over a funded
|
|
3
|
+
* Pre-PegIn HTLC output via the CSV-timelocked refund script (leaf 1).
|
|
4
|
+
*
|
|
5
|
+
* Production peg-ins commit an OP_RETURN <PUSH32 SHA256(authAnchor)>
|
|
6
|
+
* output at `vout = hashlocks.length`, so the refund flow must rebuild
|
|
7
|
+
* the WASM unfunded template with the same output shape — otherwise
|
|
8
|
+
* the reconstructed template doesn't align with the funded tx and
|
|
9
|
+
* refund construction fails or yields an unspendable PSBT.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=refund.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refund.test.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/primitives/psbt/__tests__/refund.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
|
@@ -107,6 +107,11 @@ export interface PeginTxResult {
|
|
|
107
107
|
* @throws If WASM initialization fails or parameters are invalid
|
|
108
108
|
*/
|
|
109
109
|
export declare function buildPrePeginPsbt(params: PrePeginParams): Promise<PrePeginPsbtResult>;
|
|
110
|
+
/**
|
|
111
|
+
* Validate and normalize an `authAnchorHash` hex string before passing
|
|
112
|
+
* it to the WASM boundary. WASM expects exactly 64 lowercase hex chars.
|
|
113
|
+
*/
|
|
114
|
+
export declare function normalizeAuthAnchorHash(value: string | undefined): string | undefined;
|
|
110
115
|
/**
|
|
111
116
|
* Build the PegIn transaction from a funded Pre-PegIn transaction.
|
|
112
117
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pegin.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/pegin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,OAAO,EACb,MAAM,uCAAuC,CAAC;AAI/C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,yEAAyE;IACzE,eAAe,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kEAAkE;IAClE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,0EAA0E;IAC1E,0BAA0B,EAAE,MAAM,EAAE,CAAC;IACrC,+DAA+D;IAC/D,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,sDAAsD;IACtD,cAAc,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,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C,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,iDAAiD;IACjD,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,sEAAsE;IACtE,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,cAAc,EAAE,cAAc,CAAC;IAC/B,wDAAwD;IACxD,aAAa,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,kBAAkB,CAAC,CA2C7B;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,MAAM,GAAG,SAAS,CAapB;AAED;;;;;;;;;GASG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,aAAa,CAAC,CAoCxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refund.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/refund.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"refund.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/refund.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,0EAA0E;IAC1E,cAAc,EAAE,cAAc,CAAC;IAC/B,oFAAoF;IACpF,mBAAmB,EAAE,MAAM,CAAC;IAC5B,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CA4IhC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../../PayoutManager-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../../PayoutManager-DERMRuUU.cjs"),t=require("../../../buildAndBroadcastRefund-DVMT-pXQ.cjs"),e=require("../../../peginState-BijNNT15.cjs");exports.computeHashlock=a.computeHashlock;exports.validateSecretAgainstHashlock=a.validateSecretAgainstHashlock;exports.BIP68NotMatureError=t.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=t.ClaimerPegoutStatusValue;exports.REFUND_VSIZE=t.REFUND_VSIZE;exports.RegisteredVaultVersionMismatchError=t.RegisteredVaultVersionMismatchError;exports.activateVault=t.activateVault;exports.buildAndBroadcastRefund=t.buildAndBroadcastRefund;exports.estimateRefundFeeSats=t.estimateRefundFeeSats;exports.isDepositAmountValid=t.isDepositAmountValid;exports.isPegoutTerminalStatus=t.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=t.isRecognizedPegoutStatus;exports.isRegisteredVaultVersionMismatchError=t.isRegisteredVaultVersionMismatchError;exports.runDepositorPresignFlow=t.runDepositorPresignFlow;exports.signDepositorGraph=t.signDepositorGraph;exports.submitWotsPublicKey=t.submitWotsPublicKey;exports.validateDepositAmount=t.validateDepositAmount;exports.validateMultiVaultDepositInputs=t.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=t.validateOnChainParticipantKeys;exports.validateProviderSelection=t.validateProviderSelection;exports.validateRemainingCapacity=t.validateRemainingCapacity;exports.validateVaultAmounts=t.validateVaultAmounts;exports.validateVaultProviderPubkey=t.validateVaultProviderPubkey;exports.verifyRegisteredVaultVersions=t.verifyRegisteredVaultVersions;exports.waitForPeginStatus=t.waitForPeginStatus;exports.ContractStatus=e.ContractStatus;exports.PeginAction=e.PeginAction;exports.canPerformAction=e.canPerformAction;exports.getPeginProtocolState=e.getPeginProtocolState;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as s, v as e } from "../../../PayoutManager-
|
|
2
|
-
import { B as o, C as r, p as n, R as u, a as l, n as c, o as d, i as g, m, l as P, j as p, r as v, b as V, s as S, v as R, g as f, h, d as A, c as C, e as D, f as b, k as y, w as E } from "../../../buildAndBroadcastRefund-
|
|
1
|
+
import { c as s, v as e } from "../../../PayoutManager-D29D-K-V.js";
|
|
2
|
+
import { B as o, C as r, p as n, R as u, a as l, n as c, o as d, i as g, m, l as P, j as p, r as v, b as V, s as S, v as R, g as f, h, d as A, c as C, e as D, f as b, k as y, w as E } from "../../../buildAndBroadcastRefund-B5cOyUzj.js";
|
|
3
3
|
import { C as F, P as M, c as w, g as x } from "../../../peginState-CBAlxgXk.js";
|
|
4
4
|
export {
|
|
5
5
|
o as BIP68NotMatureError,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildAndBroadcastRefund.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/refund/buildAndBroadcastRefund.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAErE,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;
|
|
1
|
+
{"version":3,"file":"buildAndBroadcastRefund.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/refund/buildAndBroadcastRefund.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAErE,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AA2B3F,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAOnE;AAqBD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,2BAA2B,EAAE,MAAM,CAAC;IACpC,aAAa,EAAE,OAAO,CAAC;IACvB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAC9B,iFAAiF;IACjF,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,qBAAqB;IACpC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,0BAA0B,EAAE,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