@babylonlabs-io/ts-sdk 0.48.0 → 0.48.2

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.
Files changed (80) hide show
  1. package/dist/{PayoutManager-BbemBIo9.js → PayoutManager-D02AePm4.js} +78 -65
  2. package/dist/PayoutManager-D02AePm4.js.map +1 -0
  3. package/dist/PayoutManager-DD1audlx.cjs +2 -0
  4. package/dist/PayoutManager-DD1audlx.cjs.map +1 -0
  5. package/dist/{PeginManager-BMO6R9I9.js → PeginManager-6seoi9mV.js} +217 -198
  6. package/dist/PeginManager-6seoi9mV.js.map +1 -0
  7. package/dist/PeginManager-CHZieoEQ.cjs +2 -0
  8. package/dist/PeginManager-CHZieoEQ.cjs.map +1 -0
  9. package/dist/buildAndBroadcastRefund-Bi07LxuY.cjs +2 -0
  10. package/dist/buildAndBroadcastRefund-Bi07LxuY.cjs.map +1 -0
  11. package/dist/{buildAndBroadcastRefund-sfl7Aac9.js → buildAndBroadcastRefund-DXHs6unL.js} +412 -362
  12. package/dist/buildAndBroadcastRefund-DXHs6unL.js.map +1 -0
  13. package/dist/{challengeAssert-1fy_EzAi.js → challengeAssert-ChvLypwc.js} +7 -7
  14. package/dist/{challengeAssert-1fy_EzAi.js.map → challengeAssert-ChvLypwc.js.map} +1 -1
  15. package/dist/challengeAssert-Culc7DoS.cjs +2 -0
  16. package/dist/{challengeAssert-DEw-z3n9.cjs.map → challengeAssert-Culc7DoS.cjs.map} +1 -1
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.js +170 -169
  19. package/dist/noPayout-CA4-x5vZ.js +174 -0
  20. package/dist/noPayout-CA4-x5vZ.js.map +1 -0
  21. package/dist/noPayout-CJ_Acpl_.cjs +2 -0
  22. package/dist/noPayout-CJ_Acpl_.cjs.map +1 -0
  23. package/dist/tbv/core/index.cjs +1 -1
  24. package/dist/tbv/core/index.js +168 -167
  25. package/dist/tbv/core/managers/PayoutManager.d.ts.map +1 -1
  26. package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
  27. package/dist/tbv/core/managers/index.cjs +1 -1
  28. package/dist/tbv/core/managers/index.js +2 -2
  29. package/dist/tbv/core/primitives/index.cjs +1 -1
  30. package/dist/tbv/core/primitives/index.d.ts +8 -7
  31. package/dist/tbv/core/primitives/index.d.ts.map +1 -1
  32. package/dist/tbv/core/primitives/index.js +30 -29
  33. package/dist/tbv/core/primitives/psbt/__tests__/verifyScriptPathSchnorrSignature.test.d.ts +14 -0
  34. package/dist/tbv/core/primitives/psbt/__tests__/verifyScriptPathSchnorrSignature.test.d.ts.map +1 -0
  35. package/dist/tbv/core/primitives/psbt/refund.d.ts.map +1 -1
  36. package/dist/tbv/core/primitives/psbt/verifyScriptPathSchnorrSignature.d.ts +53 -0
  37. package/dist/tbv/core/primitives/psbt/verifyScriptPathSchnorrSignature.d.ts.map +1 -0
  38. package/dist/tbv/core/services/deposit/signDepositorGraph.d.ts.map +1 -1
  39. package/dist/tbv/core/services/index.cjs +1 -1
  40. package/dist/tbv/core/services/index.js +2 -2
  41. package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts +20 -0
  42. package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts.map +1 -1
  43. package/dist/tbv/index.cjs +1 -1
  44. package/dist/tbv/index.js +168 -167
  45. package/dist/tbv/integrations/aave/clients/__tests__/hub.test.d.ts +2 -0
  46. package/dist/tbv/integrations/aave/clients/__tests__/hub.test.d.ts.map +1 -0
  47. package/dist/tbv/integrations/aave/clients/abis/AaveHub.abi.json.d.ts +24 -0
  48. package/dist/tbv/integrations/aave/clients/hub.d.ts +28 -0
  49. package/dist/tbv/integrations/aave/clients/hub.d.ts.map +1 -0
  50. package/dist/tbv/integrations/aave/clients/index.d.ts +1 -0
  51. package/dist/tbv/integrations/aave/clients/index.d.ts.map +1 -1
  52. package/dist/tbv/integrations/aave/index.cjs +1 -1
  53. package/dist/tbv/integrations/aave/index.cjs.map +1 -1
  54. package/dist/tbv/integrations/aave/index.d.ts +1 -1
  55. package/dist/tbv/integrations/aave/index.d.ts.map +1 -1
  56. package/dist/tbv/integrations/aave/index.js +246 -193
  57. package/dist/tbv/integrations/aave/index.js.map +1 -1
  58. package/dist/verifyScriptPathSchnorrSignature-D43cncKJ.cjs +2 -0
  59. package/dist/verifyScriptPathSchnorrSignature-D43cncKJ.cjs.map +1 -0
  60. package/dist/verifyScriptPathSchnorrSignature-DFJAEleY.js +563 -0
  61. package/dist/verifyScriptPathSchnorrSignature-DFJAEleY.js.map +1 -0
  62. package/package.json +3 -3
  63. package/dist/PayoutManager-BLpgkfOS.cjs +0 -2
  64. package/dist/PayoutManager-BLpgkfOS.cjs.map +0 -1
  65. package/dist/PayoutManager-BbemBIo9.js.map +0 -1
  66. package/dist/PeginManager-BMO6R9I9.js.map +0 -1
  67. package/dist/PeginManager-CfkjDMy7.cjs +0 -2
  68. package/dist/PeginManager-CfkjDMy7.cjs.map +0 -1
  69. package/dist/assertPsbtUnsignedTxMatches-BHyBdtxs.js +0 -481
  70. package/dist/assertPsbtUnsignedTxMatches-BHyBdtxs.js.map +0 -1
  71. package/dist/assertPsbtUnsignedTxMatches-s9H0Qqkl.cjs +0 -2
  72. package/dist/assertPsbtUnsignedTxMatches-s9H0Qqkl.cjs.map +0 -1
  73. package/dist/buildAndBroadcastRefund-sfl7Aac9.js.map +0 -1
  74. package/dist/buildAndBroadcastRefund-tR9sGPwy.cjs +0 -2
  75. package/dist/buildAndBroadcastRefund-tR9sGPwy.cjs.map +0 -1
  76. package/dist/challengeAssert-DEw-z3n9.cjs +0 -2
  77. package/dist/noPayout-5-wtWQ_f.js +0 -154
  78. package/dist/noPayout-5-wtWQ_f.js.map +0 -1
  79. package/dist/noPayout-DNevEzJR.cjs +0 -2
  80. package/dist/noPayout-DNevEzJR.cjs.map +0 -1
@@ -1,41 +1,42 @@
1
- import { a, b as t, c as r } from "../../../challengeAssert-1fy_EzAi.js";
1
+ import { a, b as t, c as r } from "../../../challengeAssert-ChvLypwc.js";
2
2
  import { computeMinClaimValue as o, computeMinPeginFee as u, deriveVaultId as P } from "@babylonlabs-io/babylon-tbv-rust-wasm";
3
- import { P as d, d as n, c as l, a as p, b as x, f as c, e as g } from "../../../assertPsbtUnsignedTxMatches-BHyBdtxs.js";
4
- import { b as f, e as m, f as S } from "../../../peginInput-BPRB9tUi.js";
5
- import { a as T, b as h } from "../../../noPayout-5-wtWQ_f.js";
6
- import { d as H, a as F, b as I, e as C, f as K, g as M, h as N, i as O, c as V, p as X, s as k, t as B, u as U, v as w } from "../../../bitcoin-B5aNKtsk.js";
3
+ import { P as b, d, f as l, c as p, b as c, a as x, g, e as y } from "../../../verifyScriptPathSchnorrSignature-DFJAEleY.js";
4
+ import { b as m, e as S, f as h } from "../../../peginInput-BPRB9tUi.js";
5
+ import { a as T, b as A } from "../../../noPayout-CA4-x5vZ.js";
6
+ import { d as F, a as I, b as C, e as K, f as M, g as N, h as O, i as V, c as X, p as k, s as B, t as U, u as w, v as z } from "../../../bitcoin-B5aNKtsk.js";
7
7
  export {
8
- d as PsbtSubstitutionError,
9
- n as assertPsbtUnsignedTxMatches,
8
+ b as PsbtSubstitutionError,
9
+ d as assertPsbtUnsignedTxMatches,
10
+ l as assertScriptPathSchnorrSignature,
10
11
  a as buildChallengeAssertPsbt,
11
12
  t as buildDepositorPayoutPsbt,
12
13
  T as buildNoPayoutPsbt,
13
- l as buildPayoutPsbt,
14
- f as buildPeginInputPsbt,
15
- p as buildPeginTxFromFundedPrePegin,
14
+ p as buildPayoutPsbt,
15
+ m as buildPeginInputPsbt,
16
+ c as buildPeginTxFromFundedPrePegin,
16
17
  x as buildPrePeginPsbt,
17
- h as buildRefundPsbt,
18
+ A as buildRefundPsbt,
18
19
  o as computeMinClaimValue,
19
20
  u as computeMinPeginFee,
20
21
  r as computeNumLocalChallengers,
21
- c as createPayoutScript,
22
- H as deriveBip86ScriptPubKeyHex,
23
- F as deriveNativeSegwitAddress,
24
- I as deriveTaprootAddress,
22
+ g as createPayoutScript,
23
+ F as deriveBip86ScriptPubKeyHex,
24
+ I as deriveNativeSegwitAddress,
25
+ C as deriveTaprootAddress,
25
26
  P as deriveVaultId,
26
- C as ensureHexPrefix,
27
- g as extractPayoutSignature,
28
- m as extractPeginInputSignature,
29
- S as finalizePeginInputPsbt,
30
- K as formatSatoshisToBtc,
31
- M as getSortedXOnlyPubkeys,
32
- N as hexToUint8Array,
33
- O as isAddressFromPublicKey,
34
- V as isValidHex,
35
- X as processPublicKeyToXOnly,
36
- k as stripHexPrefix,
37
- B as toXOnly,
38
- U as uint8ArrayToHex,
39
- w as validateWalletPubkey
27
+ K as ensureHexPrefix,
28
+ y as extractPayoutSignature,
29
+ S as extractPeginInputSignature,
30
+ h as finalizePeginInputPsbt,
31
+ M as formatSatoshisToBtc,
32
+ N as getSortedXOnlyPubkeys,
33
+ O as hexToUint8Array,
34
+ V as isAddressFromPublicKey,
35
+ X as isValidHex,
36
+ k as processPublicKeyToXOnly,
37
+ B as stripHexPrefix,
38
+ U as toXOnly,
39
+ w as uint8ArrayToHex,
40
+ z as validateWalletPubkey
40
41
  };
41
42
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Tests for assertScriptPathSchnorrSignature — BIP-340 verification of a
3
+ * wallet-returned Taproot script-path signature against an independently
4
+ * recomputed sighash (Critical Path #7).
5
+ *
6
+ * The positive cases build a PSBT exactly as the SDK does (witnessUtxo on every
7
+ * input, one tapLeafScript on the signed input), compute the real BIP-341
8
+ * script-path sighash, and sign it with a test key. The negative cases model the
9
+ * threat scenarios the guard exists for: a tweaked/wrong-key signature, a tampered
10
+ * signature, and a wallet that keeps the unsigned tx but substitutes prevout
11
+ * metadata.
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=verifyScriptPathSchnorrSignature.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyScriptPathSchnorrSignature.test.d.ts","sourceRoot":"","sources":["../../../../../../src/tbv/core/primitives/psbt/__tests__/verifyScriptPathSchnorrSignature.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
@@ -1 +1 @@
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,CAuKhC"}
1
+ {"version":3,"file":"refund.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/refund.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAkBH,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,CAsOhC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Independent BIP-340 verification of a wallet-returned Taproot script-path
3
+ * Schnorr signature against an independently-recomputed sighash.
4
+ *
5
+ * Critical Path #7 (CLAUDE.md): the SDK requests script-path signatures with
6
+ * `useTweakedSigner: false, autoFinalized: false`. Wallet support for the
7
+ * untweaked-key flag is inconsistent — older OKX / mobile bridges silently sign
8
+ * with the *tweaked* key, Keystone ignores the flag — and a compromised
9
+ * extension can stuff a 64-byte stub into `tapScriptSig`. A bad signature that
10
+ * the SDK forwards is only caught on broadcast; in the worst case it passes the
11
+ * VP off-chain but Bitcoin rejects it, leaving the depositor's BTC locked in the
12
+ * HTLC until `timelockRefund` matures. This guard rejects such signatures before
13
+ * they are trusted.
14
+ *
15
+ * Why verify against the *locally-built* PSBT, not the wallet-returned one:
16
+ * `assertPsbtUnsignedTxMatches` pins the unsigned transaction but deliberately
17
+ * skips per-input metadata (`witnessUtxo`, `tapLeafScript`). A malicious wallet
18
+ * could rewrite those consistently in the returned PSBT so a wrong-message
19
+ * signature self-validates. The trusted prevout scripts/values and leaf script
20
+ * therefore come from the PSBT we built ourselves (derived from on-chain / WASM
21
+ * sources); only the 64-byte signature comes from the wallet.
22
+ *
23
+ * Reuses the exact primitives `bip322Verify.ts` already depends on — no new
24
+ * dependency:
25
+ * - `@bitcoin-js/tiny-secp256k1-asmjs` → `verifySchnorr`
26
+ * - `bitcoinjs-lib` → `Transaction.hashForWitnessV1`, `crypto.taggedHash` (TapLeaf hash)
27
+ *
28
+ * @module tbv/core/primitives/psbt/verifyScriptPathSchnorrSignature
29
+ */
30
+ export interface VerifyScriptPathSchnorrSignatureParams {
31
+ /**
32
+ * Hex of the PSBT we built locally and sent to the wallet (the trusted
33
+ * source of prevout scripts/values and the leaf script). NOT the
34
+ * wallet-returned PSBT.
35
+ */
36
+ requestedPsbtHex: string;
37
+ /** The 64-byte Schnorr signature extracted from the wallet's response (128 hex chars). */
38
+ signatureHex: string;
39
+ /** X-only public key (64 hex chars) the wallet signed the script-path leaf with. */
40
+ signerXOnlyPubkeyHex: string;
41
+ /** Index of the input the signature is for. */
42
+ inputIndex: number;
43
+ }
44
+ /**
45
+ * Assert that `signatureHex` is a valid BIP-340 Schnorr signature by the
46
+ * `signerXOnlyPubkeyHex` key over the Taproot script-path sighash of
47
+ * `requestedPsbtHex` input `inputIndex` (SIGHASH_DEFAULT).
48
+ *
49
+ * @throws If the requested PSBT is malformed, lacks the prevout/leaf data needed
50
+ * to recompute the sighash, or the signature does not verify.
51
+ */
52
+ export declare function assertScriptPathSchnorrSignature(params: VerifyScriptPathSchnorrSignatureParams): void;
53
+ //# sourceMappingURL=verifyScriptPathSchnorrSignature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyScriptPathSchnorrSignature.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/primitives/psbt/verifyScriptPathSchnorrSignature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA4DH,MAAM,WAAW,sCAAsC;IACrD;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,0FAA0F;IAC1F,YAAY,EAAE,MAAM,CAAC;IACrB,oFAAoF;IACpF,oBAAoB,EAAE,MAAM,CAAC;IAC7B,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,sCAAsC,GAC7C,IAAI,CAmGN"}
@@ -1 +1 @@
1
- {"version":3,"file":"signDepositorGraph.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/deposit/signDepositorGraph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAGrE,OAAO,KAAK,EAAE,aAAa,EAAmB,MAAM,uCAAuC,CAAC;AAC5F,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAG3B,MAAM,oCAAoC,CAAC;AAsc5C;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IAC3C,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,8DAA8D;IAC9D,sBAAsB,EAAE,MAAM,CAAC;IAC/B,kEAAkE;IAClE,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,0EAA0E;IAC1E,6BAA6B,EAAE,MAAM,EAAE,CAAC;IACxC,0EAA0E;IAC1E,aAAa,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,4BAA4B,EAAE,MAAM,CAAC;CACtC;AAED,MAAM,WAAW,wBAAwB;IACvC,2CAA2C;IAC3C,cAAc,EAAE,0BAA0B,CAAC;IAC3C,iCAAiC;IACjC,SAAS,EAAE,aAAa,CAAC;IACzB,8DAA8D;IAC9D,cAAc,EAAE,4BAA4B,CAAC;CAC9C;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,+BAA+B,CAAC,CA2C1C"}
1
+ {"version":3,"file":"signDepositorGraph.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/deposit/signDepositorGraph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAGrE,OAAO,KAAK,EACV,aAAa,EAEd,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAG3B,MAAM,oCAAoC,CAAC;AAyd5C;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IAC3C,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,8DAA8D;IAC9D,sBAAsB,EAAE,MAAM,CAAC;IAC/B,kEAAkE;IAClE,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,0EAA0E;IAC1E,6BAA6B,EAAE,MAAM,EAAE,CAAC;IACxC,0EAA0E;IAC1E,aAAa,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,4BAA4B,EAAE,MAAM,CAAC;CACtC;AAED,MAAM,WAAW,wBAAwB;IACvC,2CAA2C;IAC3C,cAAc,EAAE,0BAA0B,CAAC;IAC3C,iCAAiC;IACjC,SAAS,EAAE,aAAa,CAAC;IACzB,8DAA8D;IAC9D,cAAc,EAAE,4BAA4B,CAAC;CAC9C;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,+BAA+B,CAAC,CA2C1C"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../../PayoutManager-BLpgkfOS.cjs"),t=require("../../../buildAndBroadcastRefund-tR9sGPwy.cjs"),e=require("../../../peginState-BijNNT15.cjs");exports.computeHashlock=a.computeHashlock;exports.validateSecretAgainstHashlock=a.validateSecretAgainstHashlock;exports.BIP68NotMatureError=t.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=t.ClaimerPegoutStatusValue;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=t.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=t.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=t.REFUND_MAX_FEE_RATE_SATS_VB;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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../../PayoutManager-DD1audlx.cjs"),t=require("../../../buildAndBroadcastRefund-Bi07LxuY.cjs"),e=require("../../../peginState-BijNNT15.cjs");exports.computeHashlock=a.computeHashlock;exports.validateSecretAgainstHashlock=a.validateSecretAgainstHashlock;exports.BIP68NotMatureError=t.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=t.ClaimerPegoutStatusValue;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=t.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=t.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=t.REFUND_MAX_FEE_RATE_SATS_VB;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-BbemBIo9.js";
2
- import { B as o, C as r, p as u, q as n, t as l, u as c, R as d, a as R, n as g, o as E, i as m, m as A, l as P, j as p, r as v, b as V, s as _, v as F, g as S, h as D, d as N, c as M, e as f, f as C, k as h, w as T } from "../../../buildAndBroadcastRefund-sfl7Aac9.js";
1
+ import { c as s, v as e } from "../../../PayoutManager-D02AePm4.js";
2
+ import { B as o, C as r, p as u, q as n, t as l, u as c, R as d, a as R, n as g, o as E, i as m, m as A, l as P, j as p, r as v, b as V, s as _, v as F, g as S, h as D, d as N, c as M, e as f, f as C, k as h, w as T } from "../../../buildAndBroadcastRefund-DXHs6unL.js";
3
3
  import { C as O, P as b, c as y, g as U } from "../../../peginState-CBAlxgXk.js";
4
4
  export {
5
5
  o as BIP68NotMatureError,
@@ -121,6 +121,26 @@ export interface RefundInput<R extends BtcBroadcastResult = BtcBroadcastResult>
121
121
  /** Checked at every async boundary. */
122
122
  signal?: AbortSignal;
123
123
  }
124
+ /**
125
+ * Re-derive each HTLC's original peg-in amount from its on-chain HTLC output
126
+ * value, inverting the protocol formula
127
+ * `htlcValue = peginAmount + depositorClaimValue + minPeginFee`.
128
+ *
129
+ * The original peg-in amount is not persisted anywhere — only the HTLC output
130
+ * value (`batch[i].amount`) survives on-chain. WASM refund template
131
+ * reconstruction needs the *peg-in amount*, not the HTLC value: feeding the
132
+ * HTLC value would size the template's HTLC output above what the funded tx
133
+ * carries, and `buildRefundPsbt`'s value cross-check would refuse the refund.
134
+ *
135
+ * `depositorClaimValue` and `minPeginFee` are constant across the batch
136
+ * (fixed by the version-pinned protocol params in {@link ctx}), so they are
137
+ * computed once via the same WASM entry points the peg-in path uses, then
138
+ * subtracted from every entry's value. The subtraction is the inverse of the
139
+ * sizing WASM performs internally; `buildRefundPsbt` then re-binds the result
140
+ * to the funded tx bytes, so a wrong derivation fails closed rather than
141
+ * signing a mis-sized refund.
142
+ */
143
+ export declare function deriveRefundPeginAmounts(batch: ReadonlyArray<VaultBatchEntry>, ctx: RefundPrePeginContext): Promise<bigint[]>;
124
144
  /**
125
145
  * Build, sign, and broadcast a refund transaction for an expired vault.
126
146
  *
@@ -1 +1 @@
1
- {"version":3,"file":"buildAndBroadcastRefund.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/refund/buildAndBroadcastRefund.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"buildAndBroadcastRefund.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/refund/buildAndBroadcastRefund.ts"],"names":[],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../challengeAssert-DEw-z3n9.cjs"),l=require("@babylonlabs-io/babylon-tbv-rust-wasm"),u=require("../assertPsbtUnsignedTxMatches-s9H0Qqkl.cjs"),A=require("../peginInput-DH6X4ITS.cjs"),S=require("../noPayout-DNevEzJR.cjs"),r=require("../bitcoin-CHfKAhcI.cjs"),R=require("../signing-Bnsro0hE.cjs"),P=require("../validation-u8W7Lp2x.cjs"),n=require("../PeginManager-CfkjDMy7.cjs"),p=require("../PayoutManager-BLpgkfOS.cjs"),_=require("../ApplicationRegistry.abi-BAPhJch3.cjs"),m=require("../BTCVaultRegistry.abi-JdeqLz4x.cjs"),d=require("../errors-CGcNP0rV.cjs"),o=require("../waitForTransactionReceiptSmartAware-U706oKTc.cjs"),t=require("../fundPeginTransaction-DuMwnytD.cjs"),c=require("../reservation-xTL2a9Q-.cjs"),a=require("../mempoolApi-C_9JhjCI.cjs"),i=require("../primeVpAuth-Br6RwE3r.cjs"),s=require("../types-WA0LrDk1.cjs"),g=require("../errors-Bu0H-dZD.cjs"),e=require("../buildAndBroadcastRefund-tR9sGPwy.cjs"),T=require("../peginState-BijNNT15.cjs");exports.buildChallengeAssertPsbt=E.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=E.buildDepositorPayoutPsbt;exports.computeNumLocalChallengers=E.computeNumLocalChallengers;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>l.computeMinClaimValue});Object.defineProperty(exports,"computeMinPeginFee",{enumerable:!0,get:()=>l.computeMinPeginFee});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>l.deriveVaultId});Object.defineProperty(exports,"expandAuthAnchor",{enumerable:!0,get:()=>l.expandAuthAnchor});Object.defineProperty(exports,"expandHashlockSecret",{enumerable:!0,get:()=>l.expandHashlockSecret});Object.defineProperty(exports,"expandWotsSeed",{enumerable:!0,get:()=>l.expandWotsSeed});exports.PsbtSubstitutionError=u.PsbtSubstitutionError;exports.assertPsbtUnsignedTxMatches=u.assertPsbtUnsignedTxMatches;exports.buildPayoutPsbt=u.buildPayoutPsbt;exports.buildPeginTxFromFundedPrePegin=u.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=u.buildPrePeginPsbt;exports.createPayoutScript=u.createPayoutScript;exports.extractPayoutSignature=u.extractPayoutSignature;exports.buildPeginInputPsbt=A.buildPeginInputPsbt;exports.extractPeginInputSignature=A.extractPeginInputSignature;exports.finalizePeginInputPsbt=A.finalizePeginInputPsbt;exports.buildNoPayoutPsbt=S.buildNoPayoutPsbt;exports.buildRefundPsbt=S.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=R.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=P.BITCOIN_ADDRESS_RE;exports.HEX_RE=P.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=P.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=P.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=P.TXID_RE;exports.PeginManager=n.PeginManager;exports.VAULT_APP_NAME=n.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=n.buildFundingOutpointsCommitment;exports.buildVaultContext=n.buildVaultContext;exports.computeWotsBlockPublicKeysHash=n.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=n.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=n.deriveWotsBlocksFromSeed;exports.estimateSubmitPeginRequestBatchGas=n.estimateSubmitPeginRequestBatchGas;exports.PayoutManager=p.PayoutManager;exports.computeHashlock=p.computeHashlock;exports.validateSecretAgainstHashlock=p.validateSecretAgainstHashlock;exports.ApplicationRegistryABI=_.ApplicationRegistryABI;exports.ProtocolParamsABI=_.ProtocolParamsABI;exports.BTCVaultRegistryABI=m.BTCVaultRegistryABI;exports.CONTRACT_ERRORS=d.CONTRACT_ERRORS;exports.extractErrorData=d.extractErrorData;exports.getContractErrorMessage=d.getContractErrorMessage;exports.handleContractError=d.handleContractError;exports.isKnownContractError=d.isKnownContractError;exports.BitcoinScriptType=o.BitcoinScriptType;exports.applyChangeOutputPolicy=o.applyChangeOutputPolicy;exports.calculateBtcTxHash=o.calculateBtcTxHash;exports.computeChangeOutputFeeSats=o.computeChangeOutputFeeSats;exports.computeMaxDeposit=o.computeMaxDeposit;exports.computePeginBaseFeeSats=o.computePeginBaseFeeSats;exports.getDustThreshold=o.getDustThreshold;exports.getPsbtInputFields=o.getPsbtInputFields;exports.getScriptType=o.getScriptType;exports.selectUtxosForPegin=o.selectUtxosForPegin;exports.shouldAddChangeOutput=o.shouldAddChangeOutput;exports.waitForTransactionReceiptSmartAware=o.waitForTransactionReceiptSmartAware;exports.BTC_DUST_SAT=t.BTC_DUST_SAT;exports.DUST_THRESHOLD=t.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=t.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=t.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=t.MAX_NON_LEGACY_OUTPUT_SIZE;exports.MAX_REASONABLE_PEGIN_VBYTES=t.MAX_REASONABLE_PEGIN_VBYTES;exports.P2TR_INPUT_SIZE=t.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=t.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=t.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=t.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=t.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=t.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=t.fundPeginTransaction;exports.parseUnfundedWasmTransaction=t.parseUnfundedWasmTransaction;exports.peginOutputCount=t.peginOutputCount;exports.rateBasedTxBufferFee=t.rateBasedTxBufferFee;exports.UtxoNotAvailableError=c.UtxoNotAvailableError;exports.assertUtxosAvailable=c.assertUtxosAvailable;exports.extractInputsFromTransaction=c.extractInputsFromTransaction;exports.findOverlappingPendingVaults=c.findOverlappingPendingVaults;exports.validateUtxosAvailable=c.validateUtxosAvailable;exports.MEMPOOL_API_URLS=a.MEMPOOL_API_URLS;exports.ViemVaultRegistryReader=a.ViemVaultRegistryReader;exports.getAddressTxs=a.getAddressTxs;exports.getAddressUtxos=a.getAddressUtxos;exports.getMempoolApiUrl=a.getMempoolApiUrl;exports.getNetworkFees=a.getNetworkFees;exports.getTipHeight=a.getTipHeight;exports.getTxHex=a.getTxHex;exports.getTxInfo=a.getTxInfo;exports.getUtxoInfo=a.getUtxoInfo;exports.pushTx=a.pushTx;exports.validateOffchainParams=a.validateOffchainParams;exports.validatePegInConfiguration=a.validatePegInConfiguration;exports.validateTBVProtocolParams=a.validateTBVProtocolParams;exports.OnChainBtcVaultStatus=i.OnChainBtcVaultStatus;exports.ServerIdentityError=i.ServerIdentityError;exports.VaultProviderRpcClient=i.VaultProviderRpcClient;exports.ViemProtocolParamsReader=i.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=i.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=i.ViemVaultKeeperReader;exports.VpResponseValidationError=i.VpResponseValidationError;exports.VpTokenRegistry=i.VpTokenRegistry;exports.batchPollByProvider=i.batchPollByProvider;exports.createAuthenticatedVpClient=i.createAuthenticatedVpClient;exports.primeVpTokenRegistry=i.primeVpTokenRegistry;exports.resolveProtocolAddresses=i.resolveProtocolAddresses;exports.validateRequestDepositorClaimerArtifactsResponse=i.validateRequestDepositorClaimerArtifactsResponse;exports.verifyServerIdentity=i.verifyServerIdentity;exports.vpTokenRegistry=i.vpTokenRegistry;exports.AUTH_EXPIRED_DATA_KIND=s.AUTH_EXPIRED_DATA_KIND;exports.DaemonStatus=s.DaemonStatus;exports.JSON_RPC_ERROR_CODES=s.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=s.JsonRpcClient;exports.JsonRpcError=s.JsonRpcError;exports.POST_WOTS_STATUSES=s.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=s.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=s.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=s.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=s.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=s.VP_TRANSIENT_STATUSES;exports.isWotsMismatchError=g.isWotsMismatchError;exports.parseFundingOutpointsFromTx=g.parseFundingOutpointsFromTx;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=e.ClaimerPegoutStatusValue;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=e.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=e.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=e.REFUND_MAX_FEE_RATE_SATS_VB;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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../challengeAssert-Culc7DoS.cjs"),l=require("@babylonlabs-io/babylon-tbv-rust-wasm"),n=require("../verifyScriptPathSchnorrSignature-D43cncKJ.cjs"),S=require("../peginInput-DH6X4ITS.cjs"),A=require("../noPayout-CJ_Acpl_.cjs"),r=require("../bitcoin-CHfKAhcI.cjs"),R=require("../signing-Bnsro0hE.cjs"),c=require("../validation-u8W7Lp2x.cjs"),u=require("../PeginManager-CHZieoEQ.cjs"),p=require("../PayoutManager-DD1audlx.cjs"),_=require("../ApplicationRegistry.abi-BAPhJch3.cjs"),m=require("../BTCVaultRegistry.abi-JdeqLz4x.cjs"),P=require("../errors-CGcNP0rV.cjs"),o=require("../waitForTransactionReceiptSmartAware-U706oKTc.cjs"),t=require("../fundPeginTransaction-DuMwnytD.cjs"),d=require("../reservation-xTL2a9Q-.cjs"),a=require("../mempoolApi-C_9JhjCI.cjs"),i=require("../primeVpAuth-Br6RwE3r.cjs"),s=require("../types-WA0LrDk1.cjs"),g=require("../errors-Bu0H-dZD.cjs"),e=require("../buildAndBroadcastRefund-Bi07LxuY.cjs"),T=require("../peginState-BijNNT15.cjs");exports.buildChallengeAssertPsbt=E.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=E.buildDepositorPayoutPsbt;exports.computeNumLocalChallengers=E.computeNumLocalChallengers;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>l.computeMinClaimValue});Object.defineProperty(exports,"computeMinPeginFee",{enumerable:!0,get:()=>l.computeMinPeginFee});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>l.deriveVaultId});Object.defineProperty(exports,"expandAuthAnchor",{enumerable:!0,get:()=>l.expandAuthAnchor});Object.defineProperty(exports,"expandHashlockSecret",{enumerable:!0,get:()=>l.expandHashlockSecret});Object.defineProperty(exports,"expandWotsSeed",{enumerable:!0,get:()=>l.expandWotsSeed});exports.PsbtSubstitutionError=n.PsbtSubstitutionError;exports.assertPsbtUnsignedTxMatches=n.assertPsbtUnsignedTxMatches;exports.assertScriptPathSchnorrSignature=n.assertScriptPathSchnorrSignature;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=A.buildNoPayoutPsbt;exports.buildRefundPsbt=A.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=R.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=c.BITCOIN_ADDRESS_RE;exports.HEX_RE=c.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=c.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=c.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=c.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.estimateSubmitPeginRequestBatchGas=u.estimateSubmitPeginRequestBatchGas;exports.PayoutManager=p.PayoutManager;exports.computeHashlock=p.computeHashlock;exports.validateSecretAgainstHashlock=p.validateSecretAgainstHashlock;exports.ApplicationRegistryABI=_.ApplicationRegistryABI;exports.ProtocolParamsABI=_.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=o.BitcoinScriptType;exports.applyChangeOutputPolicy=o.applyChangeOutputPolicy;exports.calculateBtcTxHash=o.calculateBtcTxHash;exports.computeChangeOutputFeeSats=o.computeChangeOutputFeeSats;exports.computeMaxDeposit=o.computeMaxDeposit;exports.computePeginBaseFeeSats=o.computePeginBaseFeeSats;exports.getDustThreshold=o.getDustThreshold;exports.getPsbtInputFields=o.getPsbtInputFields;exports.getScriptType=o.getScriptType;exports.selectUtxosForPegin=o.selectUtxosForPegin;exports.shouldAddChangeOutput=o.shouldAddChangeOutput;exports.waitForTransactionReceiptSmartAware=o.waitForTransactionReceiptSmartAware;exports.BTC_DUST_SAT=t.BTC_DUST_SAT;exports.DUST_THRESHOLD=t.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=t.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=t.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=t.MAX_NON_LEGACY_OUTPUT_SIZE;exports.MAX_REASONABLE_PEGIN_VBYTES=t.MAX_REASONABLE_PEGIN_VBYTES;exports.P2TR_INPUT_SIZE=t.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=t.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=t.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=t.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=t.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=t.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=t.fundPeginTransaction;exports.parseUnfundedWasmTransaction=t.parseUnfundedWasmTransaction;exports.peginOutputCount=t.peginOutputCount;exports.rateBasedTxBufferFee=t.rateBasedTxBufferFee;exports.UtxoNotAvailableError=d.UtxoNotAvailableError;exports.assertUtxosAvailable=d.assertUtxosAvailable;exports.extractInputsFromTransaction=d.extractInputsFromTransaction;exports.findOverlappingPendingVaults=d.findOverlappingPendingVaults;exports.validateUtxosAvailable=d.validateUtxosAvailable;exports.MEMPOOL_API_URLS=a.MEMPOOL_API_URLS;exports.ViemVaultRegistryReader=a.ViemVaultRegistryReader;exports.getAddressTxs=a.getAddressTxs;exports.getAddressUtxos=a.getAddressUtxos;exports.getMempoolApiUrl=a.getMempoolApiUrl;exports.getNetworkFees=a.getNetworkFees;exports.getTipHeight=a.getTipHeight;exports.getTxHex=a.getTxHex;exports.getTxInfo=a.getTxInfo;exports.getUtxoInfo=a.getUtxoInfo;exports.pushTx=a.pushTx;exports.validateOffchainParams=a.validateOffchainParams;exports.validatePegInConfiguration=a.validatePegInConfiguration;exports.validateTBVProtocolParams=a.validateTBVProtocolParams;exports.OnChainBtcVaultStatus=i.OnChainBtcVaultStatus;exports.ServerIdentityError=i.ServerIdentityError;exports.VaultProviderRpcClient=i.VaultProviderRpcClient;exports.ViemProtocolParamsReader=i.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=i.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=i.ViemVaultKeeperReader;exports.VpResponseValidationError=i.VpResponseValidationError;exports.VpTokenRegistry=i.VpTokenRegistry;exports.batchPollByProvider=i.batchPollByProvider;exports.createAuthenticatedVpClient=i.createAuthenticatedVpClient;exports.primeVpTokenRegistry=i.primeVpTokenRegistry;exports.resolveProtocolAddresses=i.resolveProtocolAddresses;exports.validateRequestDepositorClaimerArtifactsResponse=i.validateRequestDepositorClaimerArtifactsResponse;exports.verifyServerIdentity=i.verifyServerIdentity;exports.vpTokenRegistry=i.vpTokenRegistry;exports.AUTH_EXPIRED_DATA_KIND=s.AUTH_EXPIRED_DATA_KIND;exports.DaemonStatus=s.DaemonStatus;exports.JSON_RPC_ERROR_CODES=s.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=s.JsonRpcClient;exports.JsonRpcError=s.JsonRpcError;exports.POST_WOTS_STATUSES=s.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=s.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=s.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=s.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=s.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=s.VP_TRANSIENT_STATUSES;exports.isWotsMismatchError=g.isWotsMismatchError;exports.parseFundingOutpointsFromTx=g.parseFundingOutpointsFromTx;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=e.ClaimerPegoutStatusValue;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=e.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=e.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=e.REFUND_MAX_FEE_RATE_SATS_VB;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