@babylonlabs-io/ts-sdk 0.32.0 → 0.33.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.
Files changed (102) hide show
  1. package/dist/PeginManager-D2pBM0E-.cjs +2 -0
  2. package/dist/PeginManager-D2pBM0E-.cjs.map +1 -0
  3. package/dist/{PeginManager-DUR1BTKM.js → PeginManager-LeGYbRN2.js} +137 -125
  4. package/dist/PeginManager-LeGYbRN2.js.map +1 -0
  5. package/dist/{buildAndBroadcastRefund-CIHhUmRv.cjs → buildAndBroadcastRefund-BXjYAqdb.cjs} +2 -2
  6. package/dist/buildAndBroadcastRefund-BXjYAqdb.cjs.map +1 -0
  7. package/dist/{buildAndBroadcastRefund-DwrX_IBf.js → buildAndBroadcastRefund-CK8MbGQh.js} +39 -39
  8. package/dist/buildAndBroadcastRefund-CK8MbGQh.js.map +1 -0
  9. package/dist/challengeAssert-06GLZtV8.cjs +2 -0
  10. package/dist/challengeAssert-06GLZtV8.cjs.map +1 -0
  11. package/dist/{challengeAssert-DSlCIBoT.js → challengeAssert-KGVKQh0J.js} +64 -70
  12. package/dist/challengeAssert-KGVKQh0J.js.map +1 -0
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +75 -71
  15. package/dist/{noPayout-DohtepqZ.js → noPayout-BmMd4NNH.js} +44 -50
  16. package/dist/{noPayout-DohtepqZ.js.map → noPayout-BmMd4NNH.js.map} +1 -1
  17. package/dist/noPayout-Bp2TYA_X.cjs +2 -0
  18. package/dist/{noPayout-CDhbGn_B.cjs.map → noPayout-Bp2TYA_X.cjs.map} +1 -1
  19. package/dist/tbv/core/clients/eth/index.d.ts +1 -1
  20. package/dist/tbv/core/clients/eth/index.d.ts.map +1 -1
  21. package/dist/tbv/core/clients/eth/types.d.ts +13 -0
  22. package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
  23. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +8 -1
  24. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
  25. package/dist/tbv/core/clients/index.cjs +1 -1
  26. package/dist/tbv/core/clients/index.js +30 -27
  27. package/dist/tbv/core/clients/vault-provider/api.d.ts +13 -2
  28. package/dist/tbv/core/clients/vault-provider/api.d.ts.map +1 -1
  29. package/dist/tbv/core/clients/vault-provider/auth/__tests__/createAuthenticatedVpClient.test.d.ts +11 -0
  30. package/dist/tbv/core/clients/vault-provider/auth/__tests__/createAuthenticatedVpClient.test.d.ts.map +1 -0
  31. package/dist/tbv/core/clients/vault-provider/auth/__tests__/tokenRegistry.test.d.ts +2 -0
  32. package/dist/tbv/core/clients/vault-provider/auth/__tests__/tokenRegistry.test.d.ts.map +1 -0
  33. package/dist/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.d.ts +16 -0
  34. package/dist/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.d.ts.map +1 -0
  35. package/dist/tbv/core/clients/vault-provider/auth/gatedMethods.d.ts +10 -0
  36. package/dist/tbv/core/clients/vault-provider/auth/gatedMethods.d.ts.map +1 -0
  37. package/dist/tbv/core/clients/vault-provider/auth/index.d.ts +5 -2
  38. package/dist/tbv/core/clients/vault-provider/auth/index.d.ts.map +1 -1
  39. package/dist/tbv/core/clients/vault-provider/auth/innerTokenClient.d.ts +4 -0
  40. package/dist/tbv/core/clients/vault-provider/auth/innerTokenClient.d.ts.map +1 -0
  41. package/dist/tbv/core/clients/vault-provider/auth/primeVpAuth.d.ts +11 -0
  42. package/dist/tbv/core/clients/vault-provider/auth/primeVpAuth.d.ts.map +1 -0
  43. package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts +18 -23
  44. package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts.map +1 -1
  45. package/dist/tbv/core/clients/vault-provider/auth/tokenRegistry.d.ts +48 -0
  46. package/dist/tbv/core/clients/vault-provider/auth/tokenRegistry.d.ts.map +1 -0
  47. package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts +8 -12
  48. package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts.map +1 -1
  49. package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +14 -0
  50. package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
  51. package/dist/tbv/core/index.cjs +1 -1
  52. package/dist/tbv/core/index.js +66 -62
  53. package/dist/tbv/core/managers/index.d.ts +1 -1
  54. package/dist/tbv/core/primitives/index.cjs +1 -1
  55. package/dist/tbv/core/primitives/index.js +2 -2
  56. package/dist/tbv/core/primitives/psbt/__tests__/peginInput.test.d.ts +3 -3
  57. package/dist/tbv/core/primitives/psbt/payout.d.ts +3 -2
  58. package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -1
  59. package/dist/tbv/core/primitives/psbt/peginInput.d.ts +11 -5
  60. package/dist/tbv/core/primitives/psbt/peginInput.d.ts.map +1 -1
  61. package/dist/tbv/core/services/deposit/__tests__/runDepositorPresignFlow.test.d.ts +2 -0
  62. package/dist/tbv/core/services/deposit/__tests__/runDepositorPresignFlow.test.d.ts.map +1 -0
  63. package/dist/tbv/core/services/deposit/index.d.ts +2 -2
  64. package/dist/tbv/core/services/deposit/index.d.ts.map +1 -1
  65. package/dist/tbv/core/services/deposit/{signAndSubmitPayouts.d.ts → runDepositorPresignFlow.d.ts} +3 -3
  66. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -0
  67. package/dist/tbv/core/services/index.cjs +1 -1
  68. package/dist/tbv/core/services/index.js +11 -11
  69. package/dist/tbv/core/vault-secrets/__tests__/parseFundingOutpoints.test.d.ts +2 -0
  70. package/dist/tbv/core/vault-secrets/__tests__/parseFundingOutpoints.test.d.ts.map +1 -0
  71. package/dist/tbv/core/vault-secrets/index.d.ts +1 -0
  72. package/dist/tbv/core/vault-secrets/index.d.ts.map +1 -1
  73. package/dist/tbv/core/vault-secrets/parseFundingOutpoints.d.ts +3 -0
  74. package/dist/tbv/core/vault-secrets/parseFundingOutpoints.d.ts.map +1 -0
  75. package/dist/tbv/index.cjs +1 -1
  76. package/dist/tbv/index.js +66 -62
  77. package/dist/{types-jmEyzzhY.cjs → types-C2IUB0Jd.cjs} +2 -2
  78. package/dist/types-C2IUB0Jd.cjs.map +1 -0
  79. package/dist/{types-CnG3JsRs.js → types-D1o_3Q__.js} +20 -9
  80. package/dist/types-D1o_3Q__.js.map +1 -0
  81. package/dist/{vault-registry-reader-CG6bea1S.js → vault-registry-reader-BeIEh62N.js} +436 -292
  82. package/dist/vault-registry-reader-BeIEh62N.js.map +1 -0
  83. package/dist/vault-registry-reader-DdUgC5IF.cjs +2 -0
  84. package/dist/vault-registry-reader-DdUgC5IF.cjs.map +1 -0
  85. package/package.json +1 -1
  86. package/dist/PeginManager-CTRPJo8m.cjs +0 -2
  87. package/dist/PeginManager-CTRPJo8m.cjs.map +0 -1
  88. package/dist/PeginManager-DUR1BTKM.js.map +0 -1
  89. package/dist/buildAndBroadcastRefund-CIHhUmRv.cjs.map +0 -1
  90. package/dist/buildAndBroadcastRefund-DwrX_IBf.js.map +0 -1
  91. package/dist/challengeAssert-DSlCIBoT.js.map +0 -1
  92. package/dist/challengeAssert-DuhkzZG-.cjs +0 -2
  93. package/dist/challengeAssert-DuhkzZG-.cjs.map +0 -1
  94. package/dist/noPayout-CDhbGn_B.cjs +0 -2
  95. package/dist/tbv/core/services/deposit/__tests__/signAndSubmitPayouts.test.d.ts +0 -2
  96. package/dist/tbv/core/services/deposit/__tests__/signAndSubmitPayouts.test.d.ts.map +0 -1
  97. package/dist/tbv/core/services/deposit/signAndSubmitPayouts.d.ts.map +0 -1
  98. package/dist/types-CnG3JsRs.js.map +0 -1
  99. package/dist/types-jmEyzzhY.cjs.map +0 -1
  100. package/dist/vault-registry-reader-BBS1_AON.cjs +0 -2
  101. package/dist/vault-registry-reader-BBS1_AON.cjs.map +0 -1
  102. package/dist/vault-registry-reader-CG6bea1S.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,73 +1,73 @@
1
- import { h as e, g as t, d as r, a as o, b as i, c as n, e as l, f as u } from "./challengeAssert-DSlCIBoT.js";
2
- import { computeMinClaimValue as P, deriveVaultId as c } from "@babylonlabs-io/babylon-tbv-rust-wasm";
3
- import { a as p, d as S, c as E, b as A, f as R, e as _ } from "./noPayout-DohtepqZ.js";
4
- import { d as m, a as x, e as b, f as I, g as f, h as v, i as C, b as U, p as O, s as V, t as h, u as N, v as y } from "./bitcoin-0_T6KJON.js";
5
- import { C as B, P as D, a as M, c as H, g as L } from "./signing-BZigafm0.js";
6
- import { B as W, H as X, K, M as w, T as G } from "./validation-CxqROCno.js";
7
- import { B as J, C as Z, P as j, R as z, a as q, m as Q, h as $, n as aa, i as sa, l as ea, k as ta, p as ra, b as oa, s as ia, v as na, g as la, d as ua, c as da, j as Pa, e as ca, f as Ta, w as pa } from "./buildAndBroadcastRefund-DwrX_IBf.js";
1
+ import { h as e, g as t, d as r, a as o, b as i, c as n, e as l, f as u } from "./challengeAssert-KGVKQh0J.js";
2
+ import { computeMinClaimValue as P, deriveVaultId as p } from "@babylonlabs-io/babylon-tbv-rust-wasm";
3
+ import { a as T, d as S, c as E, b as A, f as R, e as g } from "./noPayout-BmMd4NNH.js";
4
+ import { d as m, a as x, e as b, f as I, g as f, h as C, i as v, b as U, p as O, s as V, t as F, u as h, v as y } from "./bitcoin-0_T6KJON.js";
5
+ import { C as D, P as B, a as M, c as H, g as L } from "./signing-BZigafm0.js";
6
+ import { B as W, H as X, K as w, M as K, T as G } from "./validation-CxqROCno.js";
7
+ import { B as J, C as Z, P as j, R as q, a as z, m as Q, h as $, n as aa, i as sa, l as ea, k as ta, r as ra, b as oa, s as ia, v as na, g as la, d as ua, c as da, j as Pa, e as pa, f as ca, w as Ta } from "./buildAndBroadcastRefund-CK8MbGQh.js";
8
8
  import { BitcoinNetworks as Ea } from "./shared/index.js";
9
- import { B as Ra, D as _a, F as ga, L as ma, M as xa, P as ba, b as Ia, a as fa, S as va, T as Ca, W as Ua, f as Oa, c as Va, p as ha, r as Na } from "./fundPeginTransaction-oV-dNJOU.js";
10
- import { B as Fa, U as Ba, a as Da, f as Ma, c as Ha, e as La, g as ka, i as Wa, h as Xa, s as Ka, b as wa, d as Ga, v as Ya } from "./psbtInputFields-DPCFHgGd.js";
11
- import { C as Za, P as ja, V as za, k as qa, l as Qa, c as $a, m as as, d as ss, b as es, f as ts, j as rs, e as os, g as is, h as ns, i as ls, a as us } from "./PeginManager-DUR1BTKM.js";
12
- import { A as Ps, M as cs, P as Ts, S as ps, V as Ss, k as Es, l as As, m as Rs, n as _s, h as gs, j as ms, g as xs, a as bs, b as Is, c as fs, d as vs, e as Cs, f as Us, p as Os, r as Vs, v as hs, i as Ns } from "./vault-registry-reader-CG6bea1S.js";
13
- import { B as Fs, D as Bs, b as Ds, J as Ms, a as Hs, d as Ls, P as ks, R as Ws, c as Xs, V as Ks } from "./types-CnG3JsRs.js";
9
+ import { B as Ra, D as ga, F as _a, L as ma, M as xa, P as ba, b as Ia, a as fa, S as Ca, T as va, W as Ua, f as Oa, c as Va, p as Fa, r as ha } from "./fundPeginTransaction-oV-dNJOU.js";
10
+ import { B as Na, U as Da, a as Ba, f as Ma, c as Ha, e as La, g as ka, i as Wa, h as Xa, s as wa, b as Ka, d as Ga, v as Ya } from "./psbtInputFields-DPCFHgGd.js";
11
+ import { C as Za, P as ja, V as qa, k as za, l as Qa, c as $a, m as as, d as ss, b as es, f as ts, j as rs, e as os, g as is, h as ns, i as ls, a as us, p as ds } from "./PeginManager-LeGYbRN2.js";
12
+ import { A as ps, M as cs, P as Ts, S as Ss, V as Es, n as As, o as Rs, q as gs, s as _s, h as ms, j as xs, l as bs, g as Is, a as fs, b as Cs, c as vs, d as Us, e as Os, f as Vs, m as Fs, p as hs, r as ys, v as Ns, i as Ds, k as Bs } from "./vault-registry-reader-BeIEh62N.js";
13
+ import { B as Hs, D as Ls, b as ks, J as Ws, a as Xs, d as ws, P as Ks, R as Gs, c as Ys, V as Js } from "./types-D1o_3Q__.js";
14
14
  export {
15
- Ps as ApplicationRegistryABI,
15
+ ps as ApplicationRegistryABI,
16
16
  J as BIP68NotMatureError,
17
17
  W as BITCOIN_ADDRESS_RE,
18
- Fs as BTCVaultRegistryABI,
18
+ Hs as BTCVaultRegistryABI,
19
19
  Ra as BTC_DUST_SAT,
20
20
  Ea as BitcoinNetworks,
21
- Fa as BitcoinScriptType,
21
+ Na as BitcoinScriptType,
22
22
  Za as CONTRACT_ERRORS,
23
23
  Z as ClaimerPegoutStatusValue,
24
- B as ContractStatus,
25
- _a as DUST_THRESHOLD,
26
- Bs as DaemonStatus,
27
- ga as FEE_SAFETY_MARGIN,
24
+ D as ContractStatus,
25
+ ga as DUST_THRESHOLD,
26
+ Ls as DaemonStatus,
27
+ _a as FEE_SAFETY_MARGIN,
28
28
  X as HEX_RE,
29
- Ds as JSON_RPC_ERROR_CODES,
30
- Ms as JsonRpcClient,
31
- Hs as JsonRpcError,
32
- K as KNOWN_SCRIPT_PREFIXES,
29
+ ks as JSON_RPC_ERROR_CODES,
30
+ Ws as JsonRpcClient,
31
+ Xs as JsonRpcError,
32
+ w as KNOWN_SCRIPT_PREFIXES,
33
33
  ma as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
34
34
  xa as MAX_NON_LEGACY_OUTPUT_SIZE,
35
- w as MAX_REASONABLE_FEE_SATS,
35
+ K as MAX_REASONABLE_FEE_SATS,
36
36
  cs as MEMPOOL_API_URLS,
37
37
  ba as P2TR_INPUT_SIZE,
38
38
  Ia as PEGIN_AUTH_ANCHOR_OUTPUTS,
39
39
  fa as PEGIN_FIXED_OUTPUTS,
40
- Ls as POST_WOTS_STATUSES,
41
- ks as PRE_DEPOSITOR_SIGNATURES_STATES,
40
+ ws as POST_WOTS_STATUSES,
41
+ Ks as PRE_DEPOSITOR_SIGNATURES_STATES,
42
42
  j as PayoutManager,
43
- D as PeginAction,
43
+ B as PeginAction,
44
44
  ja as PeginManager,
45
45
  Ts as ProtocolParamsABI,
46
- z as REFUND_VSIZE,
47
- Ws as RpcErrorCode,
48
- va as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
49
- ps as ServerIdentityError,
46
+ q as REFUND_VSIZE,
47
+ Gs as RpcErrorCode,
48
+ Ca as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
49
+ Ss as ServerIdentityError,
50
50
  G as TXID_RE,
51
- Ca as TX_BUFFER_SIZE_OVERHEAD,
52
- Ba as UtxoNotAvailableError,
53
- za as VAULT_APP_NAME,
54
- Xs as VP_TERMINAL_STATUSES,
55
- Ks as VP_TRANSIENT_STATUSES,
56
- Ss as VaultProviderRpcClient,
57
- Es as ViemProtocolParamsReader,
58
- As as ViemUniversalChallengerReader,
59
- Rs as ViemVaultKeeperReader,
51
+ va as TX_BUFFER_SIZE_OVERHEAD,
52
+ Da as UtxoNotAvailableError,
53
+ qa as VAULT_APP_NAME,
54
+ Ys as VP_TERMINAL_STATUSES,
55
+ Js as VP_TRANSIENT_STATUSES,
56
+ Es as VaultProviderRpcClient,
57
+ As as ViemProtocolParamsReader,
58
+ Rs as ViemUniversalChallengerReader,
59
+ gs as ViemVaultKeeperReader,
60
60
  _s as ViemVaultRegistryReader,
61
- gs as VpResponseValidationError,
62
- ms as VpTokenProvider,
61
+ ms as VpResponseValidationError,
62
+ xs as VpTokenRegistry,
63
63
  Ua as WALLET_RELAY_FEE_RATE_THRESHOLD,
64
- q as activateVault,
65
- p as assertPayoutOutputMatchesRegistered,
66
- Da as assertUtxosAvailable,
64
+ z as activateVault,
65
+ T as assertPayoutOutputMatchesRegistered,
66
+ Ba as assertUtxosAvailable,
67
67
  Q as buildAndBroadcastRefund,
68
68
  e as buildChallengeAssertPsbt,
69
69
  t as buildDepositorPayoutPsbt,
70
- qa as buildFundingOutpointsCommitment,
70
+ za as buildFundingOutpointsCommitment,
71
71
  S as buildNoPayoutPsbt,
72
72
  E as buildPayoutPsbt,
73
73
  r as buildPeginInputPsbt,
@@ -82,11 +82,12 @@ export {
82
82
  P as computeMinClaimValue,
83
83
  n as computeNumLocalChallengers,
84
84
  $a as computeWotsBlockPublicKeysHash,
85
+ bs as createAuthenticatedVpClient,
85
86
  R as createPayoutScript,
86
87
  H as createTaprootScriptPathSignOptions,
87
88
  m as deriveNativeSegwitAddress,
88
89
  x as deriveTaprootAddress,
89
- c as deriveVaultId,
90
+ p as deriveVaultId,
90
91
  as as deriveVaultRoot,
91
92
  ss as deriveWotsBlocksFromSeed,
92
93
  b as ensureHexPrefix,
@@ -96,59 +97,62 @@ export {
96
97
  rs as expandWotsSeed,
97
98
  os as extractErrorData,
98
99
  La as extractInputsFromTransaction,
99
- _ as extractPayoutSignature,
100
+ g as extractPayoutSignature,
100
101
  l as extractPeginInputSignature,
101
102
  u as finalizePeginInputPsbt,
102
103
  I as formatSatoshisToBtc,
103
104
  Oa as fundPeginTransaction,
104
- xs as getAddressTxs,
105
- bs as getAddressUtxos,
105
+ Is as getAddressTxs,
106
+ fs as getAddressUtxos,
106
107
  is as getContractErrorMessage,
107
108
  ka as getDustThreshold,
108
- Is as getMempoolApiUrl,
109
+ Cs as getMempoolApiUrl,
109
110
  f as getNetwork,
110
- fs as getNetworkFees,
111
+ vs as getNetworkFees,
111
112
  L as getPeginProtocolState,
112
113
  Wa as getPsbtInputFields,
113
114
  Xa as getScriptType,
114
- vs as getTxHex,
115
- Cs as getTxInfo,
116
- Us as getUtxoInfo,
115
+ Us as getTxHex,
116
+ Os as getTxInfo,
117
+ Vs as getUtxoInfo,
117
118
  ns as handleContractError,
118
- v as hexToUint8Array,
119
- C as isAddressFromPublicKey,
119
+ C as hexToUint8Array,
120
+ v as isAddressFromPublicKey,
120
121
  sa as isDepositAmountValid,
121
122
  ls as isKnownContractError,
122
123
  ea as isPegoutTerminalStatus,
123
124
  ta as isRecognizedPegoutStatus,
124
125
  U as isValidHex,
125
126
  us as isWotsMismatchError,
127
+ ds as parseFundingOutpointsFromTx,
126
128
  Va as parseUnfundedWasmTransaction,
127
- ha as peginOutputCount,
128
- ra as pollAndSignPayouts,
129
+ Fa as peginOutputCount,
130
+ Fs as primeVpTokenRegistry,
129
131
  O as processPublicKeyToXOnly,
130
- Os as pushTx,
131
- Na as rateBasedTxBufferFee,
132
- Vs as resolveProtocolAddresses,
133
- Ka as selectUtxosForDeposit,
134
- wa as selectUtxosForPegin,
132
+ hs as pushTx,
133
+ ha as rateBasedTxBufferFee,
134
+ ys as resolveProtocolAddresses,
135
+ ra as runDepositorPresignFlow,
136
+ wa as selectUtxosForDeposit,
137
+ Ka as selectUtxosForPegin,
135
138
  Ga as shouldAddChangeOutput,
136
139
  oa as signDepositorGraph,
137
140
  V as stripHexPrefix,
138
141
  ia as submitWotsPublicKey,
139
- h as toXOnly,
140
- N as uint8ArrayToHex,
142
+ F as toXOnly,
143
+ h as uint8ArrayToHex,
141
144
  na as validateDepositAmount,
142
145
  la as validateMultiVaultDepositInputs,
143
146
  ua as validateProviderSelection,
144
147
  da as validateRemainingCapacity,
145
- hs as validateRequestDepositorClaimerArtifactsResponse,
148
+ Ns as validateRequestDepositorClaimerArtifactsResponse,
146
149
  Pa as validateSecretAgainstHashlock,
147
150
  Ya as validateUtxosAvailable,
148
- ca as validateVaultAmounts,
149
- Ta as validateVaultProviderPubkey,
151
+ pa as validateVaultAmounts,
152
+ ca as validateVaultProviderPubkey,
150
153
  y as validateWalletPubkey,
151
- Ns as verifyServerIdentity,
152
- pa as waitForPeginStatus
154
+ Ds as verifyServerIdentity,
155
+ Bs as vpTokenRegistry,
156
+ Ta as waitForPeginStatus
153
157
  };
154
158
  //# sourceMappingURL=index.js.map
@@ -1,8 +1,8 @@
1
1
  import { initWasm as I, WasmPrePeginTx as C, getPrePeginHtlcConnectorInfo as A, tapInternalPubkey as T, createPayoutConnector as K, getAssertNoPayoutScriptInfo as O } from "@babylonlabs-io/babylon-tbv-rust-wasm";
2
2
  import { Buffer as l } from "buffer";
3
- import { Transaction as g, Psbt as m, payments as R } from "bitcoinjs-lib";
4
- import { u as b, T as H, h as P, b as L, s as w, p as U, g as q } from "./bitcoin-0_T6KJON.js";
5
- async function G(t) {
3
+ import { Transaction as P, Psbt as S, payments as R } from "bitcoinjs-lib";
4
+ import { u as m, T as E, h as g, b as U, s as w, p as q, g as N } from "./bitcoin-0_T6KJON.js";
5
+ async function z(t) {
6
6
  await I();
7
7
  const { prePeginParams: o, fundedPrePeginTxHex: e, htlcVout: r, refundFee: u, hashlock: i } = t, s = new C(
8
8
  o.depositorPubkey,
@@ -29,28 +29,28 @@ async function G(t) {
29
29
  hashlock: i,
30
30
  timelockRefund: o.timelockRefund,
31
31
  network: o.network
32
- }), p = e.startsWith("0x") ? e.slice(2) : e, c = g.fromHex(p), f = c.outs[r];
32
+ }), p = e.startsWith("0x") ? e.slice(2) : e, c = P.fromHex(p), f = c.outs[r];
33
33
  if (!f)
34
34
  throw new Error(
35
35
  `HTLC output at vout ${r} not found in funded Pre-PegIn tx (tx has ${c.outs.length} outputs)`
36
36
  );
37
- const d = g.fromHex(a);
37
+ const d = P.fromHex(a);
38
38
  if (d.ins.length !== 1)
39
39
  throw new Error(
40
40
  `Refund transaction must have exactly 1 input, got ${d.ins.length}`
41
41
  );
42
- const x = d.ins[0], v = c.getId(), S = b(
42
+ const x = d.ins[0], v = c.getId(), b = m(
43
43
  new Uint8Array(x.hash).slice().reverse()
44
44
  );
45
- if (S !== v)
45
+ if (b !== v)
46
46
  throw new Error(
47
- `Refund input does not reference the Pre-PegIn transaction. Expected ${v}, got ${S}`
47
+ `Refund input does not reference the Pre-PegIn transaction. Expected ${v}, got ${b}`
48
48
  );
49
49
  if (x.index !== r)
50
50
  throw new Error(
51
51
  `Refund input index ${x.index} does not match expected htlcVout ${r}`
52
52
  );
53
- const y = new m();
53
+ const y = new S();
54
54
  y.setVersion(d.version), y.setLocktime(d.locktime), y.addInput({
55
55
  hash: x.hash,
56
56
  index: x.index,
@@ -61,10 +61,10 @@ async function G(t) {
61
61
  },
62
62
  tapLeafScript: [
63
63
  {
64
- leafVersion: H,
65
- script: l.from(P(h.refundScript)),
64
+ leafVersion: E,
65
+ script: l.from(g(h.refundScript)),
66
66
  controlBlock: l.from(
67
- P(h.refundControlBlock)
67
+ g(h.refundControlBlock)
68
68
  )
69
69
  }
70
70
  ],
@@ -80,7 +80,7 @@ async function G(t) {
80
80
  n == null || n.free(), s.free();
81
81
  }
82
82
  }
83
- async function N(t) {
83
+ async function L(t) {
84
84
  const o = await K(
85
85
  {
86
86
  depositor: t.depositor,
@@ -99,33 +99,33 @@ async function N(t) {
99
99
  payoutControlBlock: o.payoutControlBlock
100
100
  };
101
101
  }
102
- const E = 3;
103
- async function z(t) {
104
- const o = w(t.payoutTxHex), e = w(t.peginTxHex), r = w(t.assertTxHex), u = await N({
102
+ const H = 3;
103
+ async function G(t) {
104
+ const o = w(t.payoutTxHex), e = w(t.peginTxHex), r = w(t.assertTxHex), u = await L({
105
105
  depositor: t.depositorBtcPubkey,
106
106
  vaultProvider: t.vaultProviderBtcPubkey,
107
107
  vaultKeepers: t.vaultKeeperBtcPubkeys,
108
108
  universalChallengers: t.universalChallengerBtcPubkeys,
109
109
  timelockPegin: t.timelockPegin,
110
110
  network: t.network
111
- }), i = P(u.payoutScript), s = P(u.payoutControlBlock), n = g.fromHex(o), a = g.fromHex(e), h = g.fromHex(r), p = new m();
111
+ }), i = g(u.payoutScript), s = g(u.payoutControlBlock), n = P.fromHex(o), a = P.fromHex(e), h = P.fromHex(r), p = new S();
112
112
  if (p.setVersion(n.version), p.setLocktime(n.locktime), n.ins.length !== 2)
113
113
  throw new Error(
114
114
  `Payout transaction must have exactly 2 inputs, got ${n.ins.length}`
115
115
  );
116
- const c = n.ins[0], f = n.ins[1], d = b(
116
+ const c = n.ins[0], f = n.ins[1], d = m(
117
117
  new Uint8Array(c.hash).slice().reverse()
118
118
  ), x = a.getId();
119
119
  if (d !== x)
120
120
  throw new Error(
121
121
  `Input 0 does not reference pegin transaction. Expected ${x}, got ${d}`
122
122
  );
123
- const v = b(
123
+ const v = m(
124
124
  new Uint8Array(f.hash).slice().reverse()
125
- ), S = h.getId();
126
- if (v !== S)
125
+ ), b = h.getId();
126
+ if (v !== b)
127
127
  throw new Error(
128
- `Input 1 does not reference assert transaction. Expected ${S}, got ${v}`
128
+ `Input 1 does not reference assert transaction. Expected ${b}, got ${v}`
129
129
  );
130
130
  const y = a.outs[c.index];
131
131
  if (!y)
@@ -147,7 +147,7 @@ async function z(t) {
147
147
  },
148
148
  tapLeafScript: [
149
149
  {
150
- leafVersion: H,
150
+ leafVersion: E,
151
151
  script: l.from(i),
152
152
  controlBlock: l.from(s)
153
153
  }
@@ -174,12 +174,12 @@ async function z(t) {
174
174
  };
175
175
  }
176
176
  function D(t, o) {
177
- if (!L(o))
177
+ if (!U(o))
178
178
  throw new Error("Invalid registeredPayoutScriptPubKey: not valid hex");
179
179
  const e = l.from(
180
180
  w(o),
181
181
  "hex"
182
- ), r = g.fromHex(w(t));
182
+ ), r = P.fromHex(w(t));
183
183
  if (r.outs.length === 0)
184
184
  throw new Error("Payout transaction has no outputs");
185
185
  if (!r.outs.reduce(
@@ -190,14 +190,14 @@ function D(t, o) {
190
190
  );
191
191
  }
192
192
  function Q(t, o, e = 0) {
193
- const r = m.fromHex(t);
193
+ const r = S.fromHex(t);
194
194
  if (e >= r.data.inputs.length)
195
195
  throw new Error(
196
196
  `Input index ${e} out of range (${r.data.inputs.length} inputs)`
197
197
  );
198
198
  const u = r.data.inputs[e];
199
199
  if (u.tapScriptSig && u.tapScriptSig.length > 0) {
200
- const i = P(o);
200
+ const i = g(o);
201
201
  for (const s of u.tapScriptSig)
202
202
  if (s.pubkey.equals(l.from(i)))
203
203
  return B(s.signature, e);
@@ -207,9 +207,9 @@ function Q(t, o, e = 0) {
207
207
  }
208
208
  if (u.finalScriptWitness && u.finalScriptWitness.length > 0) {
209
209
  const i = V(u.finalScriptWitness);
210
- if (i.length !== E)
210
+ if (i.length !== H)
211
211
  throw new Error(
212
- `Unexpected finalized witness stack size at input ${e}: expected ${E} items (signature, script, controlBlock), got ${i.length}`
212
+ `Unexpected finalized witness stack size at input ${e}: expected ${H} items (signature, script, controlBlock), got ${i.length}`
213
213
  );
214
214
  return B(i[0], e);
215
215
  }
@@ -219,16 +219,10 @@ function Q(t, o, e = 0) {
219
219
  }
220
220
  function B(t, o) {
221
221
  if (t.length === 64)
222
- return b(new Uint8Array(t));
223
- if (t.length === 65) {
224
- const e = t[64];
225
- if (e !== g.SIGHASH_ALL)
226
- throw new Error(
227
- `Unexpected sighash type 0x${e.toString(16).padStart(2, "0")} at input ${o}. Expected SIGHASH_ALL (0x01).`
228
- );
229
- return b(new Uint8Array(t.subarray(0, 64)));
230
- }
231
- throw new Error(
222
+ return m(new Uint8Array(t));
223
+ throw t.length === 65 ? new Error(
224
+ `Unexpected sighash byte 0x${t[64].toString(16).padStart(2, "0")} at input ${o}. Expected implicit SIGHASH_DEFAULT as a 64-byte signature.`
225
+ ) : new Error(
232
226
  `Unexpected signature length at input ${o}: ${t.length}`
233
227
  );
234
228
  }
@@ -269,10 +263,10 @@ function V(t) {
269
263
  return o;
270
264
  }
271
265
  async function X(t) {
272
- const o = w(t.noPayoutTxHex), e = g.fromHex(o), { noPayoutScript: r, noPayoutControlBlock: u } = await O(
266
+ const o = w(t.noPayoutTxHex), e = P.fromHex(o), { noPayoutScript: r, noPayoutControlBlock: u } = await O(
273
267
  t.connectorParams,
274
268
  t.challengerPubkey
275
- ), i = P(r), s = P(u), n = new m();
269
+ ), i = g(r), s = g(u), n = new S();
276
270
  n.setVersion(e.version), n.setLocktime(e.locktime);
277
271
  for (let a = 0; a < e.ins.length; a++) {
278
272
  const h = e.ins[a], p = t.prevouts[a];
@@ -283,13 +277,13 @@ async function X(t) {
283
277
  index: h.index,
284
278
  sequence: h.sequence,
285
279
  witnessUtxo: {
286
- script: l.from(P(w(p.script_pubkey))),
280
+ script: l.from(g(w(p.script_pubkey))),
287
281
  value: p.value
288
282
  }
289
283
  };
290
284
  a === 0 && (c.tapLeafScript = [
291
285
  {
292
- leafVersion: H,
286
+ leafVersion: E,
293
287
  script: l.from(i),
294
288
  controlBlock: l.from(s)
295
289
  }
@@ -303,14 +297,14 @@ async function X(t) {
303
297
  return n.toHex();
304
298
  }
305
299
  function Z(t, o, e) {
306
- const r = g.fromHex(w(t));
300
+ const r = P.fromHex(w(t));
307
301
  if (r.outs.length !== 1)
308
302
  throw new Error(
309
303
  `NoPayout transaction must have exactly 1 output, got ${r.outs.length}`
310
304
  );
311
- const u = P(U(o)), { output: i } = R.p2tr({
305
+ const u = g(q(o)), { output: i } = R.p2tr({
312
306
  internalPubkey: l.from(u),
313
- network: q(e)
307
+ network: N(e)
314
308
  });
315
309
  if (!i)
316
310
  throw new Error(
@@ -323,11 +317,11 @@ function Z(t, o, e) {
323
317
  }
324
318
  export {
325
319
  D as a,
326
- G as b,
327
- z as c,
320
+ z as b,
321
+ G as c,
328
322
  X as d,
329
323
  Q as e,
330
- N as f,
324
+ L as f,
331
325
  Z as g
332
326
  };
333
- //# sourceMappingURL=noPayout-DohtepqZ.js.map
327
+ //# sourceMappingURL=noPayout-BmMd4NNH.js.map