@babylonlabs-io/ts-sdk 0.19.0 → 0.20.0

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 (161) hide show
  1. package/README.md +56 -12
  2. package/dist/bitcoin-CNnPFU6Y.cjs +2 -0
  3. package/dist/bitcoin-CNnPFU6Y.cjs.map +1 -0
  4. package/dist/{constants-Q7v2O7Ps.js → bitcoin-nOOgeRyl.js} +64 -76
  5. package/dist/bitcoin-nOOgeRyl.js.map +1 -0
  6. package/dist/buildAndBroadcastRefund-DWEQvj9T.cjs +2 -0
  7. package/dist/buildAndBroadcastRefund-DWEQvj9T.cjs.map +1 -0
  8. package/dist/buildAndBroadcastRefund-DnTQkCgG.js +1331 -0
  9. package/dist/buildAndBroadcastRefund-DnTQkCgG.js.map +1 -0
  10. package/dist/challengeAssert-D1lpvuMv.js +283 -0
  11. package/dist/challengeAssert-D1lpvuMv.js.map +1 -0
  12. package/dist/challengeAssert-nYlgeAI8.cjs +2 -0
  13. package/dist/challengeAssert-nYlgeAI8.cjs.map +1 -0
  14. package/dist/errors-BZON3Wmn.cjs +2 -0
  15. package/dist/errors-BZON3Wmn.cjs.map +1 -0
  16. package/dist/{errors-aMocmFr-.js → errors-CHY4WNi-.js} +98 -97
  17. package/dist/errors-CHY4WNi-.js.map +1 -0
  18. package/dist/fundPeginTransaction-BLYXxLBv.js +70 -0
  19. package/dist/fundPeginTransaction-BLYXxLBv.js.map +1 -0
  20. package/dist/fundPeginTransaction-DxNOeyNI.cjs +2 -0
  21. package/dist/fundPeginTransaction-DxNOeyNI.cjs.map +1 -0
  22. package/dist/index-BpXpESWu.cjs +2 -0
  23. package/dist/index-BpXpESWu.cjs.map +1 -0
  24. package/dist/{index-BvFLf3vm.js → index-CFwoGJNQ.js} +146 -518
  25. package/dist/index-CFwoGJNQ.js.map +1 -0
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.js +133 -109
  28. package/dist/payout-DzGsAnhf.js +261 -0
  29. package/dist/payout-DzGsAnhf.js.map +1 -0
  30. package/dist/payout-RFIh7GLN.cjs +2 -0
  31. package/dist/payout-RFIh7GLN.cjs.map +1 -0
  32. package/dist/psbtInputFields-C-zYR1z7.cjs +2 -0
  33. package/dist/psbtInputFields-C-zYR1z7.cjs.map +1 -0
  34. package/dist/psbtInputFields-Dx41_IoI.js +229 -0
  35. package/dist/psbtInputFields-Dx41_IoI.js.map +1 -0
  36. package/dist/signing-DeWVBl7m.js +64 -0
  37. package/dist/signing-DeWVBl7m.js.map +1 -0
  38. package/dist/signing-cl-lowxV.cjs +2 -0
  39. package/dist/signing-cl-lowxV.cjs.map +1 -0
  40. package/dist/tbv/core/clients/index.cjs +1 -1
  41. package/dist/tbv/core/clients/index.js +2 -2
  42. package/dist/tbv/core/index.cjs +1 -1
  43. package/dist/tbv/core/index.d.ts +3 -1
  44. package/dist/tbv/core/index.d.ts.map +1 -1
  45. package/dist/tbv/core/index.js +130 -106
  46. package/dist/tbv/core/managers/PeginManager.d.ts +1 -1
  47. package/dist/tbv/core/primitives/index.cjs +1 -1
  48. package/dist/tbv/core/primitives/index.d.ts +3 -2
  49. package/dist/tbv/core/primitives/index.d.ts.map +1 -1
  50. package/dist/tbv/core/primitives/index.js +24 -23
  51. package/dist/tbv/core/primitives/psbt/__tests__/helpers.d.ts +1 -1
  52. package/dist/tbv/core/primitives/psbt/index.d.ts +1 -1
  53. package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
  54. package/dist/tbv/core/primitives/psbt/pegin.d.ts +2 -3
  55. package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -1
  56. package/dist/tbv/core/primitives/utils/bitcoin.d.ts +4 -0
  57. package/dist/tbv/core/primitives/utils/bitcoin.d.ts.map +1 -1
  58. package/dist/tbv/core/primitives/utils/index.d.ts +1 -1
  59. package/dist/tbv/core/primitives/utils/index.d.ts.map +1 -1
  60. package/dist/tbv/core/services/activation/__tests__/activateVault.test.d.ts +2 -0
  61. package/dist/tbv/core/services/activation/__tests__/activateVault.test.d.ts.map +1 -0
  62. package/dist/tbv/core/services/activation/activateVault.d.ts +77 -0
  63. package/dist/tbv/core/services/activation/activateVault.d.ts.map +1 -0
  64. package/dist/tbv/core/services/activation/index.d.ts +7 -0
  65. package/dist/tbv/core/services/activation/index.d.ts.map +1 -0
  66. package/dist/tbv/core/services/deposit/__tests__/peginState.test.d.ts +2 -0
  67. package/dist/tbv/core/services/deposit/__tests__/peginState.test.d.ts.map +1 -0
  68. package/dist/tbv/core/services/deposit/__tests__/validation.test.d.ts +5 -0
  69. package/dist/tbv/core/services/deposit/__tests__/validation.test.d.ts.map +1 -0
  70. package/dist/tbv/core/services/deposit/index.d.ts +4 -0
  71. package/dist/tbv/core/services/deposit/index.d.ts.map +1 -1
  72. package/dist/tbv/core/services/deposit/peginState.d.ts +93 -0
  73. package/dist/tbv/core/services/deposit/peginState.d.ts.map +1 -0
  74. package/dist/tbv/core/services/deposit/validation.d.ts +114 -0
  75. package/dist/tbv/core/services/deposit/validation.d.ts.map +1 -0
  76. package/dist/tbv/core/services/index.cjs +1 -1
  77. package/dist/tbv/core/services/index.d.ts +3 -0
  78. package/dist/tbv/core/services/index.d.ts.map +1 -1
  79. package/dist/tbv/core/services/index.js +25 -7
  80. package/dist/tbv/core/services/index.js.map +1 -1
  81. package/dist/tbv/core/services/pegout/__tests__/state.test.d.ts +2 -0
  82. package/dist/tbv/core/services/pegout/__tests__/state.test.d.ts.map +1 -0
  83. package/dist/tbv/core/services/pegout/index.d.ts +2 -0
  84. package/dist/tbv/core/services/pegout/index.d.ts.map +1 -0
  85. package/dist/tbv/core/services/pegout/state.d.ts +30 -0
  86. package/dist/tbv/core/services/pegout/state.d.ts.map +1 -0
  87. package/dist/tbv/core/services/refund/__tests__/buildAndBroadcastRefund.test.d.ts +2 -0
  88. package/dist/tbv/core/services/refund/__tests__/buildAndBroadcastRefund.test.d.ts.map +1 -0
  89. package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts +103 -0
  90. package/dist/tbv/core/services/refund/buildAndBroadcastRefund.d.ts.map +1 -0
  91. package/dist/tbv/core/services/refund/errors.d.ts +13 -0
  92. package/dist/tbv/core/services/refund/errors.d.ts.map +1 -0
  93. package/dist/tbv/core/services/refund/index.d.ts +8 -0
  94. package/dist/tbv/core/services/refund/index.d.ts.map +1 -0
  95. package/dist/tbv/core/utils/index.cjs +1 -1
  96. package/dist/tbv/core/utils/index.js +30 -24
  97. package/dist/tbv/core/utils/transaction/fundPeginTransaction.d.ts +1 -1
  98. package/dist/tbv/core/utils/utxo/__tests__/availability.test.d.ts +3 -0
  99. package/dist/tbv/core/utils/utxo/__tests__/availability.test.d.ts.map +1 -0
  100. package/dist/tbv/core/utils/utxo/__tests__/reservation.test.d.ts +3 -0
  101. package/dist/tbv/core/utils/utxo/__tests__/reservation.test.d.ts.map +1 -0
  102. package/dist/tbv/core/utils/utxo/availability.d.ts +62 -0
  103. package/dist/tbv/core/utils/utxo/availability.d.ts.map +1 -0
  104. package/dist/tbv/core/utils/utxo/index.d.ts +2 -0
  105. package/dist/tbv/core/utils/utxo/index.d.ts.map +1 -1
  106. package/dist/tbv/core/utils/utxo/reservation.d.ts +65 -0
  107. package/dist/tbv/core/utils/utxo/reservation.d.ts.map +1 -0
  108. package/dist/tbv/index.cjs +1 -1
  109. package/dist/tbv/index.js +130 -106
  110. package/dist/tbv/integrations/aave/index.cjs +1 -1
  111. package/dist/tbv/integrations/aave/index.cjs.map +1 -1
  112. package/dist/tbv/integrations/aave/index.d.ts +3 -3
  113. package/dist/tbv/integrations/aave/index.d.ts.map +1 -1
  114. package/dist/tbv/integrations/aave/index.js +145 -169
  115. package/dist/tbv/integrations/aave/index.js.map +1 -1
  116. package/dist/tbv/integrations/aave/utils/healthFactor.d.ts +0 -30
  117. package/dist/tbv/integrations/aave/utils/healthFactor.d.ts.map +1 -1
  118. package/dist/tbv/integrations/aave/utils/index.d.ts +2 -2
  119. package/dist/tbv/integrations/aave/utils/index.d.ts.map +1 -1
  120. package/dist/types-B-p4dhEH.cjs +2 -0
  121. package/dist/types-B-p4dhEH.cjs.map +1 -0
  122. package/dist/types-DWjaqVfP.js +608 -0
  123. package/dist/types-DWjaqVfP.js.map +1 -0
  124. package/package.json +5 -1
  125. package/dist/challengeAssert-D_k_ADgP.cjs +0 -2
  126. package/dist/challengeAssert-D_k_ADgP.cjs.map +0 -1
  127. package/dist/challengeAssert-k5_LWUtO.js +0 -362
  128. package/dist/challengeAssert-k5_LWUtO.js.map +0 -1
  129. package/dist/constants-EiyZkXce.cjs +0 -2
  130. package/dist/constants-EiyZkXce.cjs.map +0 -1
  131. package/dist/constants-Q7v2O7Ps.js.map +0 -1
  132. package/dist/errors-DVNYib5y.cjs +0 -2
  133. package/dist/errors-DVNYib5y.cjs.map +0 -1
  134. package/dist/errors-aMocmFr-.js.map +0 -1
  135. package/dist/fundPeginTransaction-DpwnDslW.js +0 -50
  136. package/dist/fundPeginTransaction-DpwnDslW.js.map +0 -1
  137. package/dist/fundPeginTransaction-EbrZzlrh.cjs +0 -2
  138. package/dist/fundPeginTransaction-EbrZzlrh.cjs.map +0 -1
  139. package/dist/index-BX-V3C9t.js +0 -995
  140. package/dist/index-BX-V3C9t.js.map +0 -1
  141. package/dist/index-BgnxXV5G.cjs +0 -2
  142. package/dist/index-BgnxXV5G.cjs.map +0 -1
  143. package/dist/index-BvFLf3vm.js.map +0 -1
  144. package/dist/index-DpKhuCta.cjs +0 -2
  145. package/dist/index-DpKhuCta.cjs.map +0 -1
  146. package/dist/payout-Ce9vSs9e.js +0 -164
  147. package/dist/payout-Ce9vSs9e.js.map +0 -1
  148. package/dist/payout-CfsDnjKI.cjs +0 -2
  149. package/dist/payout-CfsDnjKI.cjs.map +0 -1
  150. package/dist/psbtInputFields-C0nKn_GD.cjs +0 -2
  151. package/dist/psbtInputFields-C0nKn_GD.cjs.map +0 -1
  152. package/dist/psbtInputFields-DO0ELwiv.js +0 -116
  153. package/dist/psbtInputFields-DO0ELwiv.js.map +0 -1
  154. package/dist/signing-Deg5lCoC.cjs +0 -2
  155. package/dist/signing-Deg5lCoC.cjs.map +0 -1
  156. package/dist/signing-Drwr3bXB.js +0 -16
  157. package/dist/signing-Drwr3bXB.js.map +0 -1
  158. package/dist/types-D1rYwwCu.js +0 -235
  159. package/dist/types-D1rYwwCu.js.map +0 -1
  160. package/dist/types-DEWiqXYp.cjs +0 -2
  161. package/dist/types-DEWiqXYp.cjs.map +0 -1
@@ -1,18 +1,19 @@
1
1
  var qt = Object.defineProperty;
2
- var zt = (e, t, n) => t in e ? qt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var x = (e, t, n) => zt(e, typeof t != "symbol" ? t + "" : t, n);
4
- import * as Gt from "bitcoinjs-lib";
2
+ var Gt = (e, t, n) => t in e ? qt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var x = (e, t, n) => Gt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import * as zt from "bitcoinjs-lib";
5
5
  import { Transaction as Zt, Psbt as mt } from "bitcoinjs-lib";
6
6
  import { Buffer as q } from "buffer";
7
- import { createPublicClient as z, http as G, encodeFunctionData as yt, zeroAddress as Yt } from "viem";
8
- import { c as Jt } from "./signing-Drwr3bXB.js";
9
- import { p as Qt, B as $, f as te } from "./index-BvFLf3vm.js";
10
- import { s as E, f as ee, g as wt, e as H, i as ne } from "./constants-Q7v2O7Ps.js";
11
- import { deriveVaultId as bt } from "@babylonlabs-io/babylon-tbv-rust-wasm";
12
- import { b as se, a as oe, d as re, e as ie, f as ae } from "./challengeAssert-k5_LWUtO.js";
13
- import { s as ce, c as Z, d as le } from "./psbtInputFields-DO0ELwiv.js";
14
- import { f as he } from "./fundPeginTransaction-DpwnDslW.js";
15
- import { b as St, d as K, e as S, f as M, g as Bt, H as ue, r as L, h as fe, i as U, u as de, j as xt, k as ge, l as pe, m as me, n as ye, o as we, q as be, t as xe, x as Pt, y as ut, z as Ct } from "./index-BX-V3C9t.js";
7
+ import { createPublicClient as G, http as z, encodeFunctionData as yt, zeroAddress as Jt } from "viem";
8
+ import { c as Yt } from "./signing-DeWVBl7m.js";
9
+ import { deriveVaultId as wt } from "@babylonlabs-io/babylon-tbv-rust-wasm";
10
+ import { b as Qt, a as te, d as ee, e as ne, f as se } from "./challengeAssert-D1lpvuMv.js";
11
+ import { s as E, g as bt, e as H, i as oe } from "./bitcoin-nOOgeRyl.js";
12
+ import { b as re, f as Z, i as ie } from "./psbtInputFields-Dx41_IoI.js";
13
+ import { p as ae, f as ce } from "./fundPeginTransaction-BLYXxLBv.js";
14
+ import { p as le, f as he } from "./index-CFwoGJNQ.js";
15
+ import { B as $ } from "./types-DWjaqVfP.js";
16
+ import { n as St, o as K, q as S, r as M, t as Bt, H as ue, u as U, x as fe, y as L, z as de, A as xt, D as ge, E as pe, F as me, G as ye, I as we, J as be, K as xe, L as Pt, M as ut, N as Ct } from "./buildAndBroadcastRefund-DnTQkCgG.js";
16
17
  const B = {
17
18
  // VaultAlreadyExists()
18
19
  "0x04aabf33": "Vault already exists: This Bitcoin transaction has already been registered. Please select different UTXOs or use a different amount to create a unique transaction.",
@@ -62,14 +63,14 @@ function ft(e) {
62
63
  if (i)
63
64
  return i[1];
64
65
  }
65
- function yn(e) {
66
+ function wn(e) {
66
67
  const t = ft(e);
67
68
  if (t) {
68
69
  const n = t.substring(0, 10);
69
70
  return B[t] ?? B[n];
70
71
  }
71
72
  }
72
- function wn(e) {
73
+ function bn(e) {
73
74
  const t = ft(e);
74
75
  if (t === void 0) return !1;
75
76
  const n = t.substring(0, 10);
@@ -105,10 +106,10 @@ function ke(e, t, n, s) {
105
106
  vout: t,
106
107
  value: o.value,
107
108
  scriptPubKey: o.scriptPubKey
108
- }) : te(e, t, s);
109
+ }) : he(e, t, s);
109
110
  }
110
111
  const kt = 12e4;
111
- class bn {
112
+ class xn {
112
113
  /**
113
114
  * Creates a new PeginManager instance.
114
115
  *
@@ -127,7 +128,7 @@ class bn {
127
128
  * 2. Build unfunded Pre-PegIn transaction (HTLC output) using primitives
128
129
  * 3. Select UTXOs to cover the HTLC value
129
130
  * 4. Fund the Pre-PegIn transaction
130
- * 5. Derive the PegIn transaction from the funded Pre-PegIn txid
131
+ * 5. Derive the PegIn transaction from the funded Pre-PegIn tx
131
132
  * 6. Build PSBT for signing the PegIn input (HTLC leaf 0)
132
133
  * 7. Sign via BTC wallet and extract depositor signature
133
134
  *
@@ -159,12 +160,12 @@ class bn {
159
160
  councilQuorum: t.councilQuorum,
160
161
  councilSize: t.councilSize,
161
162
  network: this.config.btcNetwork
162
- }, u = await se(d), h = ce(
163
+ }, u = await Qt(d), h = re(
163
164
  [...t.availableUTXOs],
164
165
  u.totalOutputValue,
165
166
  t.mempoolFeeRate,
166
- ee(u.htlcValues.length)
167
- ), m = wt(this.config.btcNetwork), l = he({
167
+ ae(u.htlcValues.length)
168
+ ), m = bt(this.config.btcNetwork), l = ce({
168
169
  unfundedTxHex: u.psbtHex,
169
170
  selectedUTXOs: h.selectedUTXOs,
170
171
  changeAddress: t.changeAddress,
@@ -172,12 +173,12 @@ class bn {
172
173
  network: m
173
174
  }), y = E(Z(l)), p = [], w = [], P = [];
174
175
  for (let g = 0; g < t.hashlocks.length; g++) {
175
- const b = await oe({
176
+ const b = await te({
176
177
  prePeginParams: d,
177
178
  timelockPegin: t.timelockPegin,
178
179
  fundedPrePeginTxHex: l,
179
180
  htlcVout: g
180
- }), T = await re({
181
+ }), T = await ee({
181
182
  peginTxHex: b.txHex,
182
183
  fundedPrePeginTxHex: l,
183
184
  depositorPubkey: s,
@@ -189,7 +190,7 @@ class bn {
189
190
  network: this.config.btcNetwork
190
191
  });
191
192
  p.push(b), w.push(T.psbtHex), P.push(
192
- Jt(n, 1)
193
+ Yt(n, 1)
193
194
  );
194
195
  }
195
196
  const f = await this.signPsbtsWithFallback(
@@ -197,10 +198,10 @@ class bn {
197
198
  P
198
199
  ), c = [];
199
200
  for (let g = 0; g < f.length; g++) {
200
- const b = ie(
201
+ const b = ne(
201
202
  f[g],
202
203
  s
203
- ), T = ae(f[g]);
204
+ ), T = se(f[g]);
204
205
  c.push({
205
206
  htlcVout: g,
206
207
  htlcValue: u.htlcValues[g],
@@ -297,7 +298,7 @@ class bn {
297
298
  `UTXO value mismatch: total input value (${l} sat) is less than total output value (${y} sat). This may indicate the mempool API returned manipulated UTXO data.`
298
299
  );
299
300
  for (const { input: c, utxoData: g, txid: b, vout: T } of m) {
300
- const k = le(
301
+ const k = ie(
301
302
  {
302
303
  value: g.value,
303
304
  scriptPubKey: g.scriptPubKey
@@ -328,7 +329,7 @@ class bn {
328
329
  );
329
330
  }
330
331
  const P = w.extractTransaction().toHex();
331
- return await Qt(P, u);
332
+ return await le(P, u);
332
333
  }
333
334
  /**
334
335
  * Registers a peg-in on Ethereum by calling the BTCVaultRegistry contract.
@@ -369,7 +370,7 @@ class bn {
369
370
  d && await d();
370
371
  const p = H(n), w = H(s), P = H(o), f = await this.resolvePayoutScriptPubKey(
371
372
  u
372
- ), c = Z(P), g = await bt(
373
+ ), c = Z(P), g = await wt(
373
374
  E(c),
374
375
  E(l)
375
376
  ), b = H(g);
@@ -377,9 +378,9 @@ class bn {
377
378
  throw new Error(
378
379
  `Vault already exists (ID: ${b}, peginTxHash: ${c}). Vault IDs are derived from the pegin transaction hash and depositor address. To create a new vault, use different UTXOs or a different amount to generate a unique transaction.`
379
380
  );
380
- const k = z({
381
+ const k = G({
381
382
  chain: this.config.ethChain,
382
- transport: G()
383
+ transport: z()
383
384
  });
384
385
  let v;
385
386
  try {
@@ -418,12 +419,12 @@ class bn {
418
419
  value: v,
419
420
  account: this.config.ethWallet.account.address
420
421
  });
421
- } catch (X) {
422
- _(X);
422
+ } catch (j) {
423
+ _(j);
423
424
  }
424
- let j;
425
+ let X;
425
426
  try {
426
- j = await this.config.ethWallet.sendTransaction({
427
+ X = await this.config.ethWallet.sendTransaction({
427
428
  to: this.config.vaultContracts.btcVaultRegistry,
428
429
  data: C,
429
430
  value: v,
@@ -431,16 +432,16 @@ class bn {
431
432
  chain: this.config.ethChain,
432
433
  gas: A
433
434
  });
434
- } catch (X) {
435
- _(X);
435
+ } catch (j) {
436
+ _(j);
436
437
  }
437
438
  const pt = await k.waitForTransactionReceipt({
438
- hash: j,
439
+ hash: X,
439
440
  timeout: kt
440
441
  });
441
442
  return pt.status === "reverted" && _(
442
443
  new Error(
443
- `Transaction reverted. Hash: ${j}. Check the transaction on block explorer for details.`
444
+ `Transaction reverted. Hash: ${X}. Check the transaction on block explorer for details.`
444
445
  )
445
446
  ), {
446
447
  ethTxHash: pt.transactionHash,
@@ -479,7 +480,7 @@ class bn {
479
480
  for (const c of s) {
480
481
  const g = H(
481
482
  c.depositorSignedPeginTx
482
- ), b = Z(g), T = await bt(
483
+ ), b = Z(g), T = await wt(
483
484
  E(b),
484
485
  E(i)
485
486
  ), k = H(T);
@@ -489,9 +490,9 @@ class bn {
489
490
  );
490
491
  u.push({ vaultId: k, peginTxHash: b });
491
492
  }
492
- const h = z({
493
+ const h = G({
493
494
  chain: this.config.ethChain,
494
- transport: G()
495
+ transport: z()
495
496
  });
496
497
  let m;
497
498
  try {
@@ -569,15 +570,15 @@ class bn {
569
570
  */
570
571
  async checkVaultExists(t) {
571
572
  try {
572
- return (await z({
573
+ return (await G({
573
574
  chain: this.config.ethChain,
574
- transport: G()
575
+ transport: z()
575
576
  }).readContract({
576
577
  address: this.config.vaultContracts.btcVaultRegistry,
577
578
  abi: $,
578
579
  functionName: "getBtcVaultBasicInfo",
579
580
  args: [t]
580
- }))[0] !== Yt;
581
+ }))[0] !== Jt;
581
582
  } catch {
582
583
  return !1;
583
584
  }
@@ -596,7 +597,7 @@ class bn {
596
597
  else {
597
598
  n = await this.config.btcWallet.getAddress();
598
599
  const o = await this.config.btcWallet.getPublicKeyHex();
599
- if (!ne(
600
+ if (!oe(
600
601
  n,
601
602
  o,
602
603
  this.config.btcNetwork
@@ -605,9 +606,9 @@ class bn {
605
606
  "The BTC address from your wallet does not match the wallet's public key. Please ensure your wallet is using a supported address type (Taproot or Native SegWit)."
606
607
  );
607
608
  }
608
- const s = wt(this.config.btcNetwork);
609
+ const s = bt(this.config.btcNetwork);
609
610
  try {
610
- return `0x${Gt.address.toOutputScript(n, s).toString("hex")}`;
611
+ return `0x${zt.address.toOutputScript(n, s).toString("hex")}`;
611
612
  } catch {
612
613
  throw new Error(
613
614
  `Invalid BTC payout address: "${n}". Please provide a valid Bitcoin address for the ${this.config.btcNetwork} network.`
@@ -713,13 +714,13 @@ const Te = /* @__PURE__ */ Uint8Array.from([
713
714
  for (let o of n)
714
715
  o.push(o[s].map((r) => Te[r]));
715
716
  return n;
716
- })(), Rt = Ot[0], Ut = Ot[1], Lt = /* @__PURE__ */ [
717
+ })(), Rt = Ot[0], Lt = Ot[1], Ut = /* @__PURE__ */ [
717
718
  [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
718
719
  [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
719
720
  [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
720
721
  [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
721
722
  [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
722
- ].map((e) => Uint8Array.from(e)), ve = /* @__PURE__ */ Rt.map((e, t) => e.map((n) => Lt[t][n])), Ee = /* @__PURE__ */ Ut.map((e, t) => e.map((n) => Lt[t][n])), He = /* @__PURE__ */ Uint32Array.from([
723
+ ].map((e) => Uint8Array.from(e)), ve = /* @__PURE__ */ Rt.map((e, t) => e.map((n) => Ut[t][n])), Ee = /* @__PURE__ */ Lt.map((e, t) => e.map((n) => Ut[t][n])), He = /* @__PURE__ */ Uint32Array.from([
723
724
  0,
724
725
  1518500249,
725
726
  1859775393,
@@ -757,14 +758,14 @@ class Se extends ue {
757
758
  W[p] = n.getUint32(s, !0);
758
759
  let o = this.h0 | 0, r = o, i = this.h1 | 0, a = i, d = this.h2 | 0, u = d, h = this.h3 | 0, m = h, l = this.h4 | 0, y = l;
759
760
  for (let p = 0; p < 5; p++) {
760
- const w = 4 - p, P = He[p], f = _e[p], c = Rt[p], g = Ut[p], b = ve[p], T = Ee[p];
761
+ const w = 4 - p, P = He[p], f = _e[p], c = Rt[p], g = Lt[p], b = ve[p], T = Ee[p];
761
762
  for (let k = 0; k < 16; k++) {
762
- const v = L(o + Tt(p, i, d, h) + W[c[k]] + P, b[k]) + l | 0;
763
- o = l, l = h, h = L(d, 10) | 0, d = i, i = v;
763
+ const v = U(o + Tt(p, i, d, h) + W[c[k]] + P, b[k]) + l | 0;
764
+ o = l, l = h, h = U(d, 10) | 0, d = i, i = v;
764
765
  }
765
766
  for (let k = 0; k < 16; k++) {
766
- const v = L(r + Tt(w, a, u, m) + W[g[k]] + f, T[k]) + y | 0;
767
- r = y, y = m, m = L(u, 10) | 0, u = a, a = v;
767
+ const v = U(r + Tt(w, a, u, m) + W[g[k]] + f, T[k]) + y | 0;
768
+ r = y, y = m, m = U(u, 10) | 0, u = a, a = v;
768
769
  }
769
770
  }
770
771
  this.set(this.h1 + d + m | 0, this.h2 + h + y | 0, this.h3 + l + r | 0, this.h4 + o + a | 0, this.h0 + i + u | 0);
@@ -784,8 +785,8 @@ for (let e = 0, t = O, n = 1, s = 0; e < 24; e++) {
784
785
  t = (t << O ^ (t >> Ae) * Oe) % $e, t & Ce && (o ^= O << (O << BigInt(r)) - O);
785
786
  Dt.push(o);
786
787
  }
787
- const Kt = fe(Dt, !0), Re = Kt[0], Ue = Kt[1], It = (e, t, n) => n > 32 ? ye(e, t, n) : pe(e, t, n), vt = (e, t, n) => n > 32 ? we(e, t, n) : me(e, t, n);
788
- function Le(e, t = 24) {
788
+ const Kt = fe(Dt, !0), Re = Kt[0], Le = Kt[1], It = (e, t, n) => n > 32 ? ye(e, t, n) : pe(e, t, n), vt = (e, t, n) => n > 32 ? we(e, t, n) : me(e, t, n);
789
+ function Ue(e, t = 24) {
789
790
  const n = new Uint32Array(10);
790
791
  for (let s = 24 - t; s < 24; s++) {
791
792
  for (let i = 0; i < 10; i++)
@@ -806,7 +807,7 @@ function Le(e, t = 24) {
806
807
  for (let a = 0; a < 10; a++)
807
808
  e[i + a] ^= ~n[(a + 2) % 10] & n[(a + 4) % 10];
808
809
  }
809
- e[0] ^= Re[s], e[1] ^= Ue[s];
810
+ e[0] ^= Re[s], e[1] ^= Le[s];
810
811
  }
811
812
  S(n);
812
813
  }
@@ -824,7 +825,7 @@ class dt {
824
825
  x(this, "outputLen");
825
826
  x(this, "enableXOF", !1);
826
827
  x(this, "rounds");
827
- if (this.blockLen = t, this.suffix = n, this.outputLen = s, this.enableXOF = o, this.rounds = r, U(s, "outputLen"), !(0 < t && t < 200))
828
+ if (this.blockLen = t, this.suffix = n, this.outputLen = s, this.enableXOF = o, this.rounds = r, L(s, "outputLen"), !(0 < t && t < 200))
828
829
  throw new Error("only keccak-f1600 function is supported");
829
830
  this.state = new Uint8Array(200), this.state32 = de(this.state);
830
831
  }
@@ -832,7 +833,7 @@ class dt {
832
833
  return this._cloneInto();
833
834
  }
834
835
  keccak() {
835
- xt(this.state32), Le(this.state32, this.rounds), xt(this.state32), this.posOut = 0, this.pos = 0;
836
+ xt(this.state32), Ue(this.state32, this.rounds), xt(this.state32), this.posOut = 0, this.pos = 0;
836
837
  }
837
838
  update(t) {
838
839
  M(this), K(t);
@@ -868,7 +869,7 @@ class dt {
868
869
  return this.writeInto(t);
869
870
  }
870
871
  xof(t) {
871
- return U(t), this.xofInto(new Uint8Array(t));
872
+ return L(t), this.xofInto(new Uint8Array(t));
872
873
  }
873
874
  digestInto(t) {
874
875
  if (ge(t, this), this.finished)
@@ -890,7 +891,7 @@ const We = (e, t, n, s = {}) => Bt(() => new dt(t, e, n), s), Mt = /* @__PURE__
890
891
  function Ve(e, t, n, s) {
891
892
  St(e);
892
893
  const o = xe({ dkLen: 32, asyncTick: 10 }, s), { c: r, dkLen: i, asyncTick: a } = o;
893
- if (U(r, "c"), U(i, "dkLen"), U(a, "asyncTick"), r < 1)
894
+ if (L(r, "c"), L(i, "dkLen"), L(a, "asyncTick"), r < 1)
894
895
  throw new Error("iterations (c) must be >= 1");
895
896
  const d = Pt(t, "password"), u = Pt(n, "salt"), h = new Uint8Array(i), m = N.create(e, d), l = m._cloneInto().update(u);
896
897
  return { c: r, dkLen: i, asyncTick: a, DK: h, PRF: m, PRFSalt: l };
@@ -928,7 +929,7 @@ const Me = (e) => Nt("mnemonic" + e);
928
929
  function Ne(e, t = "") {
929
930
  return De(ut, Ke(e).nfkd, Me(t), { c: 2048, dkLen: 64 });
930
931
  }
931
- const je = 508, Et = 16, V = 32, F = 64, Ht = 5, Xe = 4;
932
+ const Xe = 508, Et = 16, V = 32, F = 64, Ht = 5, je = 4;
932
933
  function R(...e) {
933
934
  const t = e.reduce((o, r) => o + r.length, 0), n = new Uint8Array(t);
934
935
  let s = 0;
@@ -936,11 +937,11 @@ function R(...e) {
936
937
  n.set(o, s), s += o.length;
937
938
  return n;
938
939
  }
939
- function Y(e) {
940
+ function J(e) {
940
941
  return new TextEncoder().encode(e);
941
942
  }
942
- function J(e) {
943
- const t = new Uint8Array(Xe);
943
+ function Y(e) {
944
+ const t = new Uint8Array(je);
944
945
  return new DataView(t.buffer).setUint32(0, e.length, !1), R(t, e);
945
946
  }
946
947
  function Q(e, t) {
@@ -954,7 +955,7 @@ function qe(e) {
954
955
  const t = Ne(e), n = new Uint8Array(t);
955
956
  return t.fill(0), n;
956
957
  }
957
- async function ze(e, t, n, s) {
958
+ async function Ge(e, t, n, s) {
958
959
  if (e.length !== F)
959
960
  throw new Error(
960
961
  `WOTS seed must be ${F} bytes, got ${e.length}`
@@ -963,9 +964,9 @@ async function ze(e, t, n, s) {
963
964
  const o = e.slice(V, F), r = e.slice(0, V), i = [o, r];
964
965
  try {
965
966
  const a = R(
966
- J(Y(t)),
967
- J(Y(n)),
968
- J(Y(s))
967
+ Y(J(t)),
968
+ Y(J(n)),
969
+ Y(J(s))
969
970
  ), d = R(r, a);
970
971
  i.push(d);
971
972
  const u = Q(o, d);
@@ -975,7 +976,7 @@ async function ze(e, t, n, s) {
975
976
  const l = [], y = [], p = [], w = [];
976
977
  let P = !1;
977
978
  try {
978
- for (let f = 0; f < je; f++) {
979
+ for (let f = 0; f < Xe; f++) {
979
980
  const c = new Uint8Array(Ht);
980
981
  c[0] = 0, new DataView(c.buffer).setUint32(1, f, !1);
981
982
  const g = new Uint8Array(Ht);
@@ -1000,13 +1001,13 @@ async function ze(e, t, n, s) {
1000
1001
  a.fill(0);
1001
1002
  }
1002
1003
  }
1003
- function xn(e) {
1004
+ function Pn(e) {
1004
1005
  return {
1005
1006
  false_list: e.falseHashes.map(ct),
1006
1007
  true_list: e.trueHashes.map(ct)
1007
1008
  };
1008
1009
  }
1009
- function Ge(e) {
1010
+ function ze(e) {
1010
1011
  if (e.falseHashes.length === 0 || e.trueHashes.length === 0)
1011
1012
  throw new Error(
1012
1013
  "computeWotsPkHash: keypair hash arrays must not be empty"
@@ -1020,7 +1021,7 @@ function Ge(e) {
1020
1021
  const r = Mt(s);
1021
1022
  return `0x${ct(r)}`;
1022
1023
  }
1023
- const tt = 32, et = 64, Ze = 4, I = 20, lt = 4, jt = 2, Ye = 0, Je = 1, D = [64, 64];
1024
+ const tt = 32, et = 64, Ze = 4, I = 20, lt = 4, Xt = 2, Je = 0, Ye = 1, D = [64, 64];
1024
1025
  function ht(...e) {
1025
1026
  const t = e.reduce((o, r) => o + r.length, 0), n = new Uint8Array(t);
1026
1027
  let s = 0;
@@ -1045,7 +1046,7 @@ function tn(e, t) {
1045
1046
  function gt(e) {
1046
1047
  return Wt(Ct(e));
1047
1048
  }
1048
- function Xt(e) {
1049
+ function jt(e) {
1049
1050
  return (1 << e) - 1;
1050
1051
  }
1051
1052
  function en(e) {
@@ -1054,7 +1055,7 @@ function en(e) {
1054
1055
  return Math.max(t, 2);
1055
1056
  }
1056
1057
  function nn(e) {
1057
- const t = lt, n = Xt(t), s = e * n;
1058
+ const t = lt, n = jt(t), s = e * n;
1058
1059
  return { d: t, n: e, checksum_radix: en(s) };
1059
1060
  }
1060
1061
  function rt(e, t) {
@@ -1075,20 +1076,20 @@ function it(e, t) {
1075
1076
  return n;
1076
1077
  }
1077
1078
  function sn(e, t) {
1078
- const n = Xt(t.d), s = t.checksum_radix - 1, o = Math.floor(t.n * n / t.checksum_radix), r = [];
1079
+ const n = jt(t.d), s = t.checksum_radix - 1, o = Math.floor(t.n * n / t.checksum_radix), r = [];
1079
1080
  for (let h = 0; h < t.n; h++) {
1080
- const m = rt(e, h + jt), l = it(m, n);
1081
+ const m = rt(e, h + Xt), l = it(m, n);
1081
1082
  r.push(Array.from(l));
1082
1083
  }
1083
1084
  const i = rt(
1084
1085
  e,
1085
- Ye
1086
+ Je
1086
1087
  ), a = it(
1087
1088
  i,
1088
1089
  s
1089
1090
  ), d = rt(
1090
1091
  e,
1091
- Je
1092
+ Ye
1092
1093
  ), u = it(
1093
1094
  d,
1094
1095
  o
@@ -1100,7 +1101,7 @@ function sn(e, t) {
1100
1101
  checksum_minor_terminal: Array.from(a)
1101
1102
  };
1102
1103
  }
1103
- async function Pn(e, t, n, s) {
1104
+ async function kn(e, t, n, s) {
1104
1105
  if (e.length !== et)
1105
1106
  throw new Error(
1106
1107
  `WOTS seed must be exactly ${et} bytes, got ${e.length}`
@@ -1161,7 +1162,7 @@ function at(e, t, n) {
1161
1162
  );
1162
1163
  }
1163
1164
  }
1164
- function kn(e) {
1165
+ function Tn(e) {
1165
1166
  if (e.length === 0)
1166
1167
  throw new Error("Public keys array must not be empty");
1167
1168
  for (let r = 0; r < e.length; r++) {
@@ -1172,7 +1173,7 @@ function kn(e) {
1172
1173
  }
1173
1174
  let t = 0;
1174
1175
  for (const r of e)
1175
- t += jt + r.message_terminals.length;
1176
+ t += Xt + r.message_terminals.length;
1176
1177
  const n = new Uint8Array(t * I);
1177
1178
  let s = 0;
1178
1179
  for (const r of e) {
@@ -1183,17 +1184,17 @@ function kn(e) {
1183
1184
  const o = Mt(n);
1184
1185
  return `0x${Qe(o)}`;
1185
1186
  }
1186
- async function Tn(e, t, n, s) {
1187
+ async function In(e, t, n, s) {
1187
1188
  const o = qe(e);
1188
1189
  try {
1189
- const r = await ze(
1190
+ const r = await Ge(
1190
1191
  o,
1191
1192
  t,
1192
1193
  n,
1193
1194
  s
1194
1195
  );
1195
1196
  try {
1196
- return Ge(r);
1197
+ return ze(r);
1197
1198
  } finally {
1198
1199
  for (const i of r.falsePreimages) i.fill(0);
1199
1200
  for (const i of r.truePreimages) i.fill(0);
@@ -1202,24 +1203,24 @@ async function Tn(e, t, n, s) {
1202
1203
  o.fill(0);
1203
1204
  }
1204
1205
  }
1205
- function In(e) {
1206
+ function vn(e) {
1206
1207
  const t = (e instanceof Error ? e.message : typeof e == "string" ? e : "").toLowerCase();
1207
1208
  return t.includes("wots") && t.includes("hash") && t.includes("does not match");
1208
1209
  }
1209
1210
  export {
1210
1211
  B as C,
1211
- bn as P,
1212
- Pn as a,
1213
- kn as b,
1214
- Ge as c,
1215
- ze as d,
1212
+ xn as P,
1213
+ kn as a,
1214
+ Tn as b,
1215
+ ze as c,
1216
+ Ge as d,
1216
1217
  ft as e,
1217
- Tn as f,
1218
- yn as g,
1218
+ In as f,
1219
+ wn as g,
1219
1220
  _ as h,
1220
- wn as i,
1221
- In as j,
1222
- xn as k,
1221
+ bn as i,
1222
+ vn as j,
1223
+ Pn as k,
1223
1224
  qe as m
1224
1225
  };
1225
- //# sourceMappingURL=errors-aMocmFr-.js.map
1226
+ //# sourceMappingURL=errors-CHY4WNi-.js.map