@babylonlabs-io/ts-sdk 0.31.0 → 0.33.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 (120) hide show
  1. package/dist/{PeginManager-c44Uvd1N.js → PeginManager-BMrWtTji.js} +137 -125
  2. package/dist/PeginManager-BMrWtTji.js.map +1 -0
  3. package/dist/PeginManager-DUMF84XK.cjs +2 -0
  4. package/dist/PeginManager-DUMF84XK.cjs.map +1 -0
  5. package/dist/{bitcoin-B-Y0DlqR.js → bitcoin-0_T6KJON.js} +32 -28
  6. package/dist/bitcoin-0_T6KJON.js.map +1 -0
  7. package/dist/bitcoin-EYBKDtEW.cjs +2 -0
  8. package/dist/bitcoin-EYBKDtEW.cjs.map +1 -0
  9. package/dist/{buildAndBroadcastRefund-CLLaz8D3.cjs → buildAndBroadcastRefund-6pR681fI.cjs} +2 -2
  10. package/dist/buildAndBroadcastRefund-6pR681fI.cjs.map +1 -0
  11. package/dist/{buildAndBroadcastRefund-BRQaCQrJ.js → buildAndBroadcastRefund-Ba56IKL7.js} +40 -40
  12. package/dist/buildAndBroadcastRefund-Ba56IKL7.js.map +1 -0
  13. package/dist/challengeAssert-DSlCIBoT.js +304 -0
  14. package/dist/challengeAssert-DSlCIBoT.js.map +1 -0
  15. package/dist/challengeAssert-DuhkzZG-.cjs +2 -0
  16. package/dist/challengeAssert-DuhkzZG-.cjs.map +1 -0
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.js +75 -71
  19. package/dist/{noPayout-CwgYkZYs.cjs → noPayout-CDhbGn_B.cjs} +2 -2
  20. package/dist/{noPayout-CwgYkZYs.cjs.map → noPayout-CDhbGn_B.cjs.map} +1 -1
  21. package/dist/{noPayout-B8JiTaYt.js → noPayout-DohtepqZ.js} +2 -2
  22. package/dist/{noPayout-B8JiTaYt.js.map → noPayout-DohtepqZ.js.map} +1 -1
  23. package/dist/{psbtInputFields-CB8hqjQ5.cjs → psbtInputFields-BLi7Ta-T.cjs} +2 -2
  24. package/dist/{psbtInputFields-CB8hqjQ5.cjs.map → psbtInputFields-BLi7Ta-T.cjs.map} +1 -1
  25. package/dist/{psbtInputFields-DeTFSJOq.js → psbtInputFields-DPCFHgGd.js} +2 -2
  26. package/dist/{psbtInputFields-DeTFSJOq.js.map → psbtInputFields-DPCFHgGd.js.map} +1 -1
  27. package/dist/tbv/core/clients/eth/index.d.ts +1 -1
  28. package/dist/tbv/core/clients/eth/index.d.ts.map +1 -1
  29. package/dist/tbv/core/clients/eth/types.d.ts +13 -0
  30. package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
  31. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +8 -1
  32. package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
  33. package/dist/tbv/core/clients/index.cjs +1 -1
  34. package/dist/tbv/core/clients/index.js +30 -27
  35. package/dist/tbv/core/clients/vault-provider/api.d.ts +13 -2
  36. package/dist/tbv/core/clients/vault-provider/api.d.ts.map +1 -1
  37. package/dist/tbv/core/clients/vault-provider/auth/__tests__/createAuthenticatedVpClient.test.d.ts +11 -0
  38. package/dist/tbv/core/clients/vault-provider/auth/__tests__/createAuthenticatedVpClient.test.d.ts.map +1 -0
  39. package/dist/tbv/core/clients/vault-provider/auth/__tests__/tokenRegistry.test.d.ts +2 -0
  40. package/dist/tbv/core/clients/vault-provider/auth/__tests__/tokenRegistry.test.d.ts.map +1 -0
  41. package/dist/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.d.ts +16 -0
  42. package/dist/tbv/core/clients/vault-provider/auth/createAuthenticatedVpClient.d.ts.map +1 -0
  43. package/dist/tbv/core/clients/vault-provider/auth/gatedMethods.d.ts +10 -0
  44. package/dist/tbv/core/clients/vault-provider/auth/gatedMethods.d.ts.map +1 -0
  45. package/dist/tbv/core/clients/vault-provider/auth/index.d.ts +5 -2
  46. package/dist/tbv/core/clients/vault-provider/auth/index.d.ts.map +1 -1
  47. package/dist/tbv/core/clients/vault-provider/auth/innerTokenClient.d.ts +4 -0
  48. package/dist/tbv/core/clients/vault-provider/auth/innerTokenClient.d.ts.map +1 -0
  49. package/dist/tbv/core/clients/vault-provider/auth/primeVpAuth.d.ts +11 -0
  50. package/dist/tbv/core/clients/vault-provider/auth/primeVpAuth.d.ts.map +1 -0
  51. package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts +18 -23
  52. package/dist/tbv/core/clients/vault-provider/auth/tokenProvider.d.ts.map +1 -1
  53. package/dist/tbv/core/clients/vault-provider/auth/tokenRegistry.d.ts +48 -0
  54. package/dist/tbv/core/clients/vault-provider/auth/tokenRegistry.d.ts.map +1 -0
  55. package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts +8 -12
  56. package/dist/tbv/core/clients/vault-provider/json-rpc-client.d.ts.map +1 -1
  57. package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts +14 -0
  58. package/dist/tbv/core/contracts/abis/BTCVaultRegistry.abi.d.ts.map +1 -1
  59. package/dist/tbv/core/index.cjs +1 -1
  60. package/dist/tbv/core/index.js +66 -62
  61. package/dist/tbv/core/managers/index.d.ts +1 -1
  62. package/dist/tbv/core/primitives/index.cjs +1 -1
  63. package/dist/tbv/core/primitives/index.js +3 -3
  64. package/dist/tbv/core/primitives/psbt/challengeAssert.d.ts +10 -7
  65. package/dist/tbv/core/primitives/psbt/challengeAssert.d.ts.map +1 -1
  66. package/dist/tbv/core/primitives/psbt/constants.d.ts +26 -0
  67. package/dist/tbv/core/primitives/psbt/constants.d.ts.map +1 -0
  68. package/dist/tbv/core/primitives/psbt/depositorPayout.d.ts +13 -6
  69. package/dist/tbv/core/primitives/psbt/depositorPayout.d.ts.map +1 -1
  70. package/dist/tbv/core/primitives/utils/bitcoin.d.ts +13 -0
  71. package/dist/tbv/core/primitives/utils/bitcoin.d.ts.map +1 -1
  72. package/dist/tbv/core/services/deposit/__tests__/runDepositorPresignFlow.test.d.ts +2 -0
  73. package/dist/tbv/core/services/deposit/__tests__/runDepositorPresignFlow.test.d.ts.map +1 -0
  74. package/dist/tbv/core/services/deposit/index.d.ts +2 -2
  75. package/dist/tbv/core/services/deposit/index.d.ts.map +1 -1
  76. package/dist/tbv/core/services/deposit/{signAndSubmitPayouts.d.ts → runDepositorPresignFlow.d.ts} +3 -3
  77. package/dist/tbv/core/services/deposit/runDepositorPresignFlow.d.ts.map +1 -0
  78. package/dist/tbv/core/services/index.cjs +1 -1
  79. package/dist/tbv/core/services/index.js +11 -11
  80. package/dist/tbv/core/utils/index.cjs +1 -1
  81. package/dist/tbv/core/utils/index.js +2 -2
  82. package/dist/tbv/core/vault-secrets/__tests__/parseFundingOutpoints.test.d.ts +2 -0
  83. package/dist/tbv/core/vault-secrets/__tests__/parseFundingOutpoints.test.d.ts.map +1 -0
  84. package/dist/tbv/core/vault-secrets/index.d.ts +1 -0
  85. package/dist/tbv/core/vault-secrets/index.d.ts.map +1 -1
  86. package/dist/tbv/core/vault-secrets/parseFundingOutpoints.d.ts +3 -0
  87. package/dist/tbv/core/vault-secrets/parseFundingOutpoints.d.ts.map +1 -0
  88. package/dist/tbv/index.cjs +1 -1
  89. package/dist/tbv/index.js +66 -62
  90. package/dist/testing/index.cjs +1 -1
  91. package/dist/testing/index.js +1 -1
  92. package/dist/{types-jmEyzzhY.cjs → types-C2IUB0Jd.cjs} +2 -2
  93. package/dist/types-C2IUB0Jd.cjs.map +1 -0
  94. package/dist/{types-CnG3JsRs.js → types-D1o_3Q__.js} +20 -9
  95. package/dist/types-D1o_3Q__.js.map +1 -0
  96. package/dist/{vault-registry-reader-BywZhqJL.js → vault-registry-reader-BeIEh62N.js} +436 -292
  97. package/dist/vault-registry-reader-BeIEh62N.js.map +1 -0
  98. package/dist/vault-registry-reader-DdUgC5IF.cjs +2 -0
  99. package/dist/vault-registry-reader-DdUgC5IF.cjs.map +1 -0
  100. package/package.json +1 -1
  101. package/dist/PeginManager-DmVq6ffv.cjs +0 -2
  102. package/dist/PeginManager-DmVq6ffv.cjs.map +0 -1
  103. package/dist/PeginManager-c44Uvd1N.js.map +0 -1
  104. package/dist/bitcoin-B-Y0DlqR.js.map +0 -1
  105. package/dist/bitcoin-DIN0OupO.cjs +0 -2
  106. package/dist/bitcoin-DIN0OupO.cjs.map +0 -1
  107. package/dist/buildAndBroadcastRefund-BRQaCQrJ.js.map +0 -1
  108. package/dist/buildAndBroadcastRefund-CLLaz8D3.cjs.map +0 -1
  109. package/dist/challengeAssert-mYikGC34.js +0 -269
  110. package/dist/challengeAssert-mYikGC34.js.map +0 -1
  111. package/dist/challengeAssert-yYFflBOx.cjs +0 -2
  112. package/dist/challengeAssert-yYFflBOx.cjs.map +0 -1
  113. package/dist/tbv/core/services/deposit/__tests__/signAndSubmitPayouts.test.d.ts +0 -2
  114. package/dist/tbv/core/services/deposit/__tests__/signAndSubmitPayouts.test.d.ts.map +0 -1
  115. package/dist/tbv/core/services/deposit/signAndSubmitPayouts.d.ts.map +0 -1
  116. package/dist/types-CnG3JsRs.js.map +0 -1
  117. package/dist/types-jmEyzzhY.cjs.map +0 -1
  118. package/dist/vault-registry-reader-BywZhqJL.js.map +0 -1
  119. package/dist/vault-registry-reader-DdruADqa.cjs +0 -2
  120. package/dist/vault-registry-reader-DdruADqa.cjs.map +0 -1
@@ -44,7 +44,7 @@ export interface PayoutSigningContext {
44
44
  /** On-chain registered depositor payout scriptPubKey (hex) */
45
45
  registeredPayoutScriptPubKey: string;
46
46
  }
47
- export interface PollAndSignPayoutsParams {
47
+ export interface RunDepositorPresignFlowParams {
48
48
  /** VP client implementing the status reader interface */
49
49
  statusReader: PeginStatusReader;
50
50
  /** VP client implementing the presign transaction flow interface */
@@ -72,5 +72,5 @@ export interface PollAndSignPayoutsParams {
72
72
  *
73
73
  * @throws Error on timeout, abort, signing failure, or RPC error
74
74
  */
75
- export declare function pollAndSignPayouts(params: PollAndSignPayoutsParams): Promise<void>;
76
- //# sourceMappingURL=signAndSubmitPayouts.d.ts.map
75
+ export declare function runDepositorPresignFlow(params: RunDepositorPresignFlowParams): Promise<void>;
76
+ //# sourceMappingURL=runDepositorPresignFlow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runDepositorPresignFlow.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/deposit/runDepositorPresignFlow.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAIrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAW3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAQrE;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,sBAAsB,EAAE,MAAM,CAAC;IAC/B,kEAAkE;IAClE,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,0EAA0E;IAC1E,6BAA6B,EAAE,MAAM,EAAE,CAAC;IACxC,yDAAyD;IACzD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,6DAA6D;IAC7D,aAAa,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB;;;;;OAKG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,8DAA8D;IAC9D,4BAA4B,EAAE,MAAM,CAAC;CACtC;AAED,MAAM,WAAW,6BAA6B;IAC5C,yDAAyD;IACzD,YAAY,EAAE,iBAAiB,CAAC;IAChC,oEAAoE;IACpE,aAAa,EAAE,aAAa,CAAC;IAC7B,iCAAiC;IACjC,SAAS,EAAE,aAAa,CAAC;IACzB,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,cAAc,EAAE,oBAAoB,CAAC;IACrC,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,sEAAsE;IACtE,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzD;AAqKD;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,IAAI,CAAC,CAkGf"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../buildAndBroadcastRefund-CLLaz8D3.cjs"),e=require("../../../signing-DHSXjhLM.cjs");exports.BIP68NotMatureError=t.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=t.ClaimerPegoutStatusValue;exports.REFUND_VSIZE=t.REFUND_VSIZE;exports.activateVault=t.activateVault;exports.buildAndBroadcastRefund=t.buildAndBroadcastRefund;exports.computeHashlock=t.computeHashlock;exports.estimateRefundFeeSats=t.estimateRefundFeeSats;exports.isDepositAmountValid=t.isDepositAmountValid;exports.isPegoutTerminalStatus=t.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=t.isRecognizedPegoutStatus;exports.pollAndSignPayouts=t.pollAndSignPayouts;exports.signDepositorGraph=t.signDepositorGraph;exports.submitWotsPublicKey=t.submitWotsPublicKey;exports.validateDepositAmount=t.validateDepositAmount;exports.validateMultiVaultDepositInputs=t.validateMultiVaultDepositInputs;exports.validateProviderSelection=t.validateProviderSelection;exports.validateRemainingCapacity=t.validateRemainingCapacity;exports.validateSecretAgainstHashlock=t.validateSecretAgainstHashlock;exports.validateVaultAmounts=t.validateVaultAmounts;exports.validateVaultProviderPubkey=t.validateVaultProviderPubkey;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 t=require("../../../buildAndBroadcastRefund-6pR681fI.cjs"),e=require("../../../signing-DHSXjhLM.cjs");exports.BIP68NotMatureError=t.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=t.ClaimerPegoutStatusValue;exports.REFUND_VSIZE=t.REFUND_VSIZE;exports.activateVault=t.activateVault;exports.buildAndBroadcastRefund=t.buildAndBroadcastRefund;exports.computeHashlock=t.computeHashlock;exports.estimateRefundFeeSats=t.estimateRefundFeeSats;exports.isDepositAmountValid=t.isDepositAmountValid;exports.isPegoutTerminalStatus=t.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=t.isRecognizedPegoutStatus;exports.runDepositorPresignFlow=t.runDepositorPresignFlow;exports.signDepositorGraph=t.signDepositorGraph;exports.submitWotsPublicKey=t.submitWotsPublicKey;exports.validateDepositAmount=t.validateDepositAmount;exports.validateMultiVaultDepositInputs=t.validateMultiVaultDepositInputs;exports.validateProviderSelection=t.validateProviderSelection;exports.validateRemainingCapacity=t.validateRemainingCapacity;exports.validateSecretAgainstHashlock=t.validateSecretAgainstHashlock;exports.validateVaultAmounts=t.validateVaultAmounts;exports.validateVaultProviderPubkey=t.validateVaultProviderPubkey;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,21 +1,21 @@
1
- import { B as s, C as e, R as i, a as o, m as u, h as l, n, i as r, l as d, k as c, p as P, b as g, s as m, v as p, g as v, d as S, c as A, j as V, e as f, f as R, w as b } from "../../../buildAndBroadcastRefund-BRQaCQrJ.js";
2
- import { C as D, P as h, a as k, g as y } from "../../../signing-BZigafm0.js";
1
+ import { B as s, C as e, R as i, a as o, m as r, h as u, n as l, i as n, l as d, k as c, r as P, b as g, s as m, v as p, g as v, d as S, c as A, j as V, e as f, f as D, w as R } from "../../../buildAndBroadcastRefund-Ba56IKL7.js";
2
+ import { C, P as h, a as k, g as F } from "../../../signing-BZigafm0.js";
3
3
  export {
4
4
  s as BIP68NotMatureError,
5
5
  e as ClaimerPegoutStatusValue,
6
- D as ContractStatus,
6
+ C as ContractStatus,
7
7
  h as PeginAction,
8
8
  i as REFUND_VSIZE,
9
9
  o as activateVault,
10
- u as buildAndBroadcastRefund,
10
+ r as buildAndBroadcastRefund,
11
11
  k as canPerformAction,
12
- l as computeHashlock,
13
- n as estimateRefundFeeSats,
14
- y as getPeginProtocolState,
15
- r as isDepositAmountValid,
12
+ u as computeHashlock,
13
+ l as estimateRefundFeeSats,
14
+ F as getPeginProtocolState,
15
+ n as isDepositAmountValid,
16
16
  d as isPegoutTerminalStatus,
17
17
  c as isRecognizedPegoutStatus,
18
- P as pollAndSignPayouts,
18
+ P as runDepositorPresignFlow,
19
19
  g as signDepositorGraph,
20
20
  m as submitWotsPublicKey,
21
21
  p as validateDepositAmount,
@@ -24,7 +24,7 @@ export {
24
24
  A as validateRemainingCapacity,
25
25
  V as validateSecretAgainstHashlock,
26
26
  f as validateVaultAmounts,
27
- R as validateVaultProviderPubkey,
28
- b as waitForPeginStatus
27
+ D as validateVaultProviderPubkey,
28
+ R as waitForPeginStatus
29
29
  };
30
30
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../signing-DHSXjhLM.cjs"),T=require("../../../validation-u8W7Lp2x.cjs"),t=require("../../../fundPeginTransaction-DaWoYCgO.cjs"),e=require("../../../psbtInputFields-CB8hqjQ5.cjs"),E=require("../../../bitcoin-DIN0OupO.cjs");exports.createTaprootScriptPathSignOptions=_.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=T.BITCOIN_ADDRESS_RE;exports.HEX_RE=T.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=T.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=T.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=T.TXID_RE;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.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.BitcoinScriptType=e.BitcoinScriptType;exports.UtxoNotAvailableError=e.UtxoNotAvailableError;exports.assertUtxosAvailable=e.assertUtxosAvailable;exports.calculateBtcTxHash=e.calculateBtcTxHash;exports.collectReservedUtxoRefs=e.collectReservedUtxoRefs;exports.extractInputsFromTransaction=e.extractInputsFromTransaction;exports.getDustThreshold=e.getDustThreshold;exports.getPsbtInputFields=e.getPsbtInputFields;exports.getScriptType=e.getScriptType;exports.selectUtxosForDeposit=e.selectUtxosForDeposit;exports.selectUtxosForPegin=e.selectUtxosForPegin;exports.shouldAddChangeOutput=e.shouldAddChangeOutput;exports.validateUtxosAvailable=e.validateUtxosAvailable;exports.getNetwork=E.getNetwork;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../signing-DHSXjhLM.cjs"),T=require("../../../validation-u8W7Lp2x.cjs"),t=require("../../../fundPeginTransaction-DaWoYCgO.cjs"),e=require("../../../psbtInputFields-BLi7Ta-T.cjs"),E=require("../../../bitcoin-EYBKDtEW.cjs");exports.createTaprootScriptPathSignOptions=_.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=T.BITCOIN_ADDRESS_RE;exports.HEX_RE=T.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=T.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=T.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=T.TXID_RE;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.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.BitcoinScriptType=e.BitcoinScriptType;exports.UtxoNotAvailableError=e.UtxoNotAvailableError;exports.assertUtxosAvailable=e.assertUtxosAvailable;exports.calculateBtcTxHash=e.calculateBtcTxHash;exports.collectReservedUtxoRefs=e.collectReservedUtxoRefs;exports.extractInputsFromTransaction=e.extractInputsFromTransaction;exports.getDustThreshold=e.getDustThreshold;exports.getPsbtInputFields=e.getPsbtInputFields;exports.getScriptType=e.getScriptType;exports.selectUtxosForDeposit=e.selectUtxosForDeposit;exports.selectUtxosForPegin=e.selectUtxosForPegin;exports.shouldAddChangeOutput=e.shouldAddChangeOutput;exports.validateUtxosAvailable=e.validateUtxosAvailable;exports.getNetwork=E.getNetwork;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,8 +1,8 @@
1
1
  import { c as t } from "../../../signing-BZigafm0.js";
2
2
  import { B as T, H as _, K as E, M as o, T as r } from "../../../validation-CxqROCno.js";
3
3
  import { B as A, D as R, F as U, L as i, M as p, P as I, b as c, a as n, S as F, T as l, W as O, f as P, c as x, p as N, r as u } from "../../../fundPeginTransaction-oV-dNJOU.js";
4
- import { B as f, U as B, a as D, f as L, c as g, e as C, g as H, i as X, h, s as m, b as M, d as b, v } from "../../../psbtInputFields-DeTFSJOq.js";
5
- import { g as Y } from "../../../bitcoin-B-Y0DlqR.js";
4
+ import { B as f, U as B, a as D, f as L, c as g, e as C, g as H, i as X, h, s as m, b as M, d as b, v } from "../../../psbtInputFields-DPCFHgGd.js";
5
+ import { g as Y } from "../../../bitcoin-0_T6KJON.js";
6
6
  export {
7
7
  T as BITCOIN_ADDRESS_RE,
8
8
  A as BTC_DUST_SAT,
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=parseFundingOutpoints.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseFundingOutpoints.test.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/vault-secrets/__tests__/parseFundingOutpoints.test.ts"],"names":[],"mappings":""}
@@ -16,4 +16,5 @@ export { buildFundingOutpointsCommitment, buildVaultContext } from './context';
16
16
  export type { FundingOutpoint, VaultContextInput } from './context';
17
17
  export { deriveVaultRoot, VAULT_APP_NAME } from './deriveVaultRoot';
18
18
  export type { DeriveContextHashCapableWallet } from './deriveVaultRoot';
19
+ export { parseFundingOutpointsFromTx } from './parseFundingOutpoints';
19
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/vault-secrets/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,GACf,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,+BAA+B,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE/E,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEpE,YAAY,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/vault-secrets/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,GACf,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,+BAA+B,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE/E,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEpE,YAAY,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { FundingOutpoint } from './context';
2
+ export declare function parseFundingOutpointsFromTx(unsignedTxHex: string): FundingOutpoint[];
3
+ //# sourceMappingURL=parseFundingOutpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseFundingOutpoints.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/vault-secrets/parseFundingOutpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,MAAM,GACpB,eAAe,EAAE,CAenB"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../challengeAssert-yYFflBOx.cjs"),P=require("@babylonlabs-io/babylon-tbv-rust-wasm"),u=require("../noPayout-CwgYkZYs.cjs"),o=require("../bitcoin-DIN0OupO.cjs"),l=require("../signing-DHSXjhLM.cjs"),d=require("../validation-u8W7Lp2x.cjs"),e=require("../buildAndBroadcastRefund-CLLaz8D3.cjs"),a=require("../fundPeginTransaction-DaWoYCgO.cjs"),i=require("../psbtInputFields-CB8hqjQ5.cjs"),r=require("../PeginManager-DmVq6ffv.cjs"),t=require("../vault-registry-reader-DdruADqa.cjs"),s=require("../types-jmEyzzhY.cjs");exports.buildChallengeAssertPsbt=n.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=n.buildDepositorPayoutPsbt;exports.buildPeginInputPsbt=n.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=n.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=n.buildPrePeginPsbt;exports.computeNumLocalChallengers=n.computeNumLocalChallengers;exports.extractPeginInputSignature=n.extractPeginInputSignature;exports.finalizePeginInputPsbt=n.finalizePeginInputPsbt;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>P.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>P.deriveVaultId});exports.assertPayoutOutputMatchesRegistered=u.assertPayoutOutputMatchesRegistered;exports.buildNoPayoutPsbt=u.buildNoPayoutPsbt;exports.buildPayoutPsbt=u.buildPayoutPsbt;exports.buildRefundPsbt=u.buildRefundPsbt;exports.createPayoutScript=u.createPayoutScript;exports.extractPayoutSignature=u.extractPayoutSignature;exports.deriveNativeSegwitAddress=o.deriveNativeSegwitAddress;exports.deriveTaprootAddress=o.deriveTaprootAddress;exports.ensureHexPrefix=o.ensureHexPrefix;exports.formatSatoshisToBtc=o.formatSatoshisToBtc;exports.getNetwork=o.getNetwork;exports.hexToUint8Array=o.hexToUint8Array;exports.isAddressFromPublicKey=o.isAddressFromPublicKey;exports.isValidHex=o.isValidHex;exports.processPublicKeyToXOnly=o.processPublicKeyToXOnly;exports.stripHexPrefix=o.stripHexPrefix;exports.toXOnly=o.toXOnly;exports.uint8ArrayToHex=o.uint8ArrayToHex;exports.validateWalletPubkey=o.validateWalletPubkey;exports.ContractStatus=l.ContractStatus;exports.PeginAction=l.PeginAction;exports.canPerformAction=l.canPerformAction;exports.createTaprootScriptPathSignOptions=l.createTaprootScriptPathSignOptions;exports.getPeginProtocolState=l.getPeginProtocolState;exports.BITCOIN_ADDRESS_RE=d.BITCOIN_ADDRESS_RE;exports.HEX_RE=d.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=d.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=d.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=d.TXID_RE;exports.BIP68NotMatureError=e.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=e.ClaimerPegoutStatusValue;exports.PayoutManager=e.PayoutManager;exports.REFUND_VSIZE=e.REFUND_VSIZE;exports.activateVault=e.activateVault;exports.buildAndBroadcastRefund=e.buildAndBroadcastRefund;exports.computeHashlock=e.computeHashlock;exports.estimateRefundFeeSats=e.estimateRefundFeeSats;exports.isDepositAmountValid=e.isDepositAmountValid;exports.isPegoutTerminalStatus=e.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=e.isRecognizedPegoutStatus;exports.pollAndSignPayouts=e.pollAndSignPayouts;exports.signDepositorGraph=e.signDepositorGraph;exports.submitWotsPublicKey=e.submitWotsPublicKey;exports.validateDepositAmount=e.validateDepositAmount;exports.validateMultiVaultDepositInputs=e.validateMultiVaultDepositInputs;exports.validateProviderSelection=e.validateProviderSelection;exports.validateRemainingCapacity=e.validateRemainingCapacity;exports.validateSecretAgainstHashlock=e.validateSecretAgainstHashlock;exports.validateVaultAmounts=e.validateVaultAmounts;exports.validateVaultProviderPubkey=e.validateVaultProviderPubkey;exports.waitForPeginStatus=e.waitForPeginStatus;exports.BTC_DUST_SAT=a.BTC_DUST_SAT;exports.DUST_THRESHOLD=a.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=a.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=a.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=a.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=a.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=a.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=a.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=a.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=a.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=a.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=a.fundPeginTransaction;exports.parseUnfundedWasmTransaction=a.parseUnfundedWasmTransaction;exports.peginOutputCount=a.peginOutputCount;exports.rateBasedTxBufferFee=a.rateBasedTxBufferFee;exports.BitcoinScriptType=i.BitcoinScriptType;exports.UtxoNotAvailableError=i.UtxoNotAvailableError;exports.assertUtxosAvailable=i.assertUtxosAvailable;exports.calculateBtcTxHash=i.calculateBtcTxHash;exports.collectReservedUtxoRefs=i.collectReservedUtxoRefs;exports.extractInputsFromTransaction=i.extractInputsFromTransaction;exports.getDustThreshold=i.getDustThreshold;exports.getPsbtInputFields=i.getPsbtInputFields;exports.getScriptType=i.getScriptType;exports.selectUtxosForDeposit=i.selectUtxosForDeposit;exports.selectUtxosForPegin=i.selectUtxosForPegin;exports.shouldAddChangeOutput=i.shouldAddChangeOutput;exports.validateUtxosAvailable=i.validateUtxosAvailable;exports.CONTRACT_ERRORS=r.CONTRACT_ERRORS;exports.PeginManager=r.PeginManager;exports.VAULT_APP_NAME=r.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=r.buildFundingOutpointsCommitment;exports.buildVaultContext=r.buildVaultContext;exports.computeWotsBlockPublicKeysHash=r.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=r.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=r.deriveWotsBlocksFromSeed;exports.expandAuthAnchor=r.expandAuthAnchor;exports.expandHashlockSecret=r.expandHashlockSecret;exports.expandWotsSeed=r.expandWotsSeed;exports.extractErrorData=r.extractErrorData;exports.getContractErrorMessage=r.getContractErrorMessage;exports.handleContractError=r.handleContractError;exports.isKnownContractError=r.isKnownContractError;exports.isWotsMismatchError=r.isWotsMismatchError;exports.ApplicationRegistryABI=t.ApplicationRegistryABI;exports.MEMPOOL_API_URLS=t.MEMPOOL_API_URLS;exports.ProtocolParamsABI=t.ProtocolParamsABI;exports.ServerIdentityError=t.ServerIdentityError;exports.VaultProviderRpcClient=t.VaultProviderRpcClient;exports.ViemProtocolParamsReader=t.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=t.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=t.ViemVaultKeeperReader;exports.ViemVaultRegistryReader=t.ViemVaultRegistryReader;exports.VpResponseValidationError=t.VpResponseValidationError;exports.VpTokenProvider=t.VpTokenProvider;exports.getAddressTxs=t.getAddressTxs;exports.getAddressUtxos=t.getAddressUtxos;exports.getMempoolApiUrl=t.getMempoolApiUrl;exports.getNetworkFees=t.getNetworkFees;exports.getTxHex=t.getTxHex;exports.getTxInfo=t.getTxInfo;exports.getUtxoInfo=t.getUtxoInfo;exports.pushTx=t.pushTx;exports.resolveProtocolAddresses=t.resolveProtocolAddresses;exports.validateRequestDepositorClaimerArtifactsResponse=t.validateRequestDepositorClaimerArtifactsResponse;exports.verifyServerIdentity=t.verifyServerIdentity;exports.BTCVaultRegistryABI=s.BTCVaultRegistryABI;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_TERMINAL_STATUSES=s.VP_TERMINAL_STATUSES;exports.VP_TRANSIENT_STATUSES=s.VP_TRANSIENT_STATUSES;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../challengeAssert-DuhkzZG-.cjs"),P=require("@babylonlabs-io/babylon-tbv-rust-wasm"),u=require("../noPayout-CDhbGn_B.cjs"),i=require("../bitcoin-EYBKDtEW.cjs"),l=require("../signing-DHSXjhLM.cjs"),d=require("../validation-u8W7Lp2x.cjs"),t=require("../buildAndBroadcastRefund-6pR681fI.cjs"),a=require("../fundPeginTransaction-DaWoYCgO.cjs"),o=require("../psbtInputFields-BLi7Ta-T.cjs"),r=require("../PeginManager-DUMF84XK.cjs"),e=require("../vault-registry-reader-DdUgC5IF.cjs"),s=require("../types-C2IUB0Jd.cjs");exports.buildChallengeAssertPsbt=n.buildChallengeAssertPsbt;exports.buildDepositorPayoutPsbt=n.buildDepositorPayoutPsbt;exports.buildPeginInputPsbt=n.buildPeginInputPsbt;exports.buildPeginTxFromFundedPrePegin=n.buildPeginTxFromFundedPrePegin;exports.buildPrePeginPsbt=n.buildPrePeginPsbt;exports.computeNumLocalChallengers=n.computeNumLocalChallengers;exports.extractPeginInputSignature=n.extractPeginInputSignature;exports.finalizePeginInputPsbt=n.finalizePeginInputPsbt;Object.defineProperty(exports,"computeMinClaimValue",{enumerable:!0,get:()=>P.computeMinClaimValue});Object.defineProperty(exports,"deriveVaultId",{enumerable:!0,get:()=>P.deriveVaultId});exports.assertPayoutOutputMatchesRegistered=u.assertPayoutOutputMatchesRegistered;exports.buildNoPayoutPsbt=u.buildNoPayoutPsbt;exports.buildPayoutPsbt=u.buildPayoutPsbt;exports.buildRefundPsbt=u.buildRefundPsbt;exports.createPayoutScript=u.createPayoutScript;exports.extractPayoutSignature=u.extractPayoutSignature;exports.deriveNativeSegwitAddress=i.deriveNativeSegwitAddress;exports.deriveTaprootAddress=i.deriveTaprootAddress;exports.ensureHexPrefix=i.ensureHexPrefix;exports.formatSatoshisToBtc=i.formatSatoshisToBtc;exports.getNetwork=i.getNetwork;exports.hexToUint8Array=i.hexToUint8Array;exports.isAddressFromPublicKey=i.isAddressFromPublicKey;exports.isValidHex=i.isValidHex;exports.processPublicKeyToXOnly=i.processPublicKeyToXOnly;exports.stripHexPrefix=i.stripHexPrefix;exports.toXOnly=i.toXOnly;exports.uint8ArrayToHex=i.uint8ArrayToHex;exports.validateWalletPubkey=i.validateWalletPubkey;exports.ContractStatus=l.ContractStatus;exports.PeginAction=l.PeginAction;exports.canPerformAction=l.canPerformAction;exports.createTaprootScriptPathSignOptions=l.createTaprootScriptPathSignOptions;exports.getPeginProtocolState=l.getPeginProtocolState;exports.BITCOIN_ADDRESS_RE=d.BITCOIN_ADDRESS_RE;exports.HEX_RE=d.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=d.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=d.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=d.TXID_RE;exports.BIP68NotMatureError=t.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=t.ClaimerPegoutStatusValue;exports.PayoutManager=t.PayoutManager;exports.REFUND_VSIZE=t.REFUND_VSIZE;exports.activateVault=t.activateVault;exports.buildAndBroadcastRefund=t.buildAndBroadcastRefund;exports.computeHashlock=t.computeHashlock;exports.estimateRefundFeeSats=t.estimateRefundFeeSats;exports.isDepositAmountValid=t.isDepositAmountValid;exports.isPegoutTerminalStatus=t.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=t.isRecognizedPegoutStatus;exports.runDepositorPresignFlow=t.runDepositorPresignFlow;exports.signDepositorGraph=t.signDepositorGraph;exports.submitWotsPublicKey=t.submitWotsPublicKey;exports.validateDepositAmount=t.validateDepositAmount;exports.validateMultiVaultDepositInputs=t.validateMultiVaultDepositInputs;exports.validateProviderSelection=t.validateProviderSelection;exports.validateRemainingCapacity=t.validateRemainingCapacity;exports.validateSecretAgainstHashlock=t.validateSecretAgainstHashlock;exports.validateVaultAmounts=t.validateVaultAmounts;exports.validateVaultProviderPubkey=t.validateVaultProviderPubkey;exports.waitForPeginStatus=t.waitForPeginStatus;exports.BTC_DUST_SAT=a.BTC_DUST_SAT;exports.DUST_THRESHOLD=a.DUST_THRESHOLD;exports.FEE_SAFETY_MARGIN=a.FEE_SAFETY_MARGIN;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=a.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=a.MAX_NON_LEGACY_OUTPUT_SIZE;exports.P2TR_INPUT_SIZE=a.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=a.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=a.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=a.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=a.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=a.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=a.fundPeginTransaction;exports.parseUnfundedWasmTransaction=a.parseUnfundedWasmTransaction;exports.peginOutputCount=a.peginOutputCount;exports.rateBasedTxBufferFee=a.rateBasedTxBufferFee;exports.BitcoinScriptType=o.BitcoinScriptType;exports.UtxoNotAvailableError=o.UtxoNotAvailableError;exports.assertUtxosAvailable=o.assertUtxosAvailable;exports.calculateBtcTxHash=o.calculateBtcTxHash;exports.collectReservedUtxoRefs=o.collectReservedUtxoRefs;exports.extractInputsFromTransaction=o.extractInputsFromTransaction;exports.getDustThreshold=o.getDustThreshold;exports.getPsbtInputFields=o.getPsbtInputFields;exports.getScriptType=o.getScriptType;exports.selectUtxosForDeposit=o.selectUtxosForDeposit;exports.selectUtxosForPegin=o.selectUtxosForPegin;exports.shouldAddChangeOutput=o.shouldAddChangeOutput;exports.validateUtxosAvailable=o.validateUtxosAvailable;exports.CONTRACT_ERRORS=r.CONTRACT_ERRORS;exports.PeginManager=r.PeginManager;exports.VAULT_APP_NAME=r.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=r.buildFundingOutpointsCommitment;exports.buildVaultContext=r.buildVaultContext;exports.computeWotsBlockPublicKeysHash=r.computeWotsBlockPublicKeysHash;exports.deriveVaultRoot=r.deriveVaultRoot;exports.deriveWotsBlocksFromSeed=r.deriveWotsBlocksFromSeed;exports.expandAuthAnchor=r.expandAuthAnchor;exports.expandHashlockSecret=r.expandHashlockSecret;exports.expandWotsSeed=r.expandWotsSeed;exports.extractErrorData=r.extractErrorData;exports.getContractErrorMessage=r.getContractErrorMessage;exports.handleContractError=r.handleContractError;exports.isKnownContractError=r.isKnownContractError;exports.isWotsMismatchError=r.isWotsMismatchError;exports.parseFundingOutpointsFromTx=r.parseFundingOutpointsFromTx;exports.ApplicationRegistryABI=e.ApplicationRegistryABI;exports.MEMPOOL_API_URLS=e.MEMPOOL_API_URLS;exports.ProtocolParamsABI=e.ProtocolParamsABI;exports.ServerIdentityError=e.ServerIdentityError;exports.VaultProviderRpcClient=e.VaultProviderRpcClient;exports.ViemProtocolParamsReader=e.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=e.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=e.ViemVaultKeeperReader;exports.ViemVaultRegistryReader=e.ViemVaultRegistryReader;exports.VpResponseValidationError=e.VpResponseValidationError;exports.VpTokenRegistry=e.VpTokenRegistry;exports.createAuthenticatedVpClient=e.createAuthenticatedVpClient;exports.getAddressTxs=e.getAddressTxs;exports.getAddressUtxos=e.getAddressUtxos;exports.getMempoolApiUrl=e.getMempoolApiUrl;exports.getNetworkFees=e.getNetworkFees;exports.getTxHex=e.getTxHex;exports.getTxInfo=e.getTxInfo;exports.getUtxoInfo=e.getUtxoInfo;exports.primeVpTokenRegistry=e.primeVpTokenRegistry;exports.pushTx=e.pushTx;exports.resolveProtocolAddresses=e.resolveProtocolAddresses;exports.validateRequestDepositorClaimerArtifactsResponse=e.validateRequestDepositorClaimerArtifactsResponse;exports.verifyServerIdentity=e.verifyServerIdentity;exports.vpTokenRegistry=e.vpTokenRegistry;exports.BTCVaultRegistryABI=s.BTCVaultRegistryABI;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_TERMINAL_STATUSES=s.VP_TERMINAL_STATUSES;exports.VP_TRANSIENT_STATUSES=s.VP_TRANSIENT_STATUSES;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/tbv/index.js CHANGED
@@ -1,66 +1,66 @@
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-mYikGC34.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-B8JiTaYt.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 y, v as F } from "../bitcoin-B-Y0DlqR.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-DSlCIBoT.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-DohtepqZ.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
5
  import { C as D, P as B, a as M, c as H, g as L } from "../signing-BZigafm0.js";
6
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-BRQaCQrJ.js";
8
- import { B as Ea, D as Aa, F as Ra, L as _a, M as ga, P as ma, b as xa, a as ba, S as Ia, T as fa, W as va, f as Ca, c as Ua, p as Oa, r as Va } from "../fundPeginTransaction-oV-dNJOU.js";
9
- import { B as ya, U as Fa, a as Na, f as Da, c as Ba, e as Ma, g as Ha, i as La, h as ka, s as Wa, b as Xa, d as Ka, v as wa } from "../psbtInputFields-DeTFSJOq.js";
10
- import { C as Ya, P as Ja, V as Za, k as ja, l as za, c as qa, m as Qa, d as $a, b as as, f as ss, j as es, e as ts, g as rs, h as os, i as is, a as ns } from "../PeginManager-c44Uvd1N.js";
11
- import { A as us, M as ds, P as Ps, S as cs, V as Ts, k as ps, l as Ss, m as Es, n as As, h as Rs, j as _s, g as gs, a as ms, b as xs, c as bs, d as Is, e as fs, f as vs, p as Cs, r as Us, v as Os, i as Vs } from "../vault-registry-reader-BywZhqJL.js";
12
- import { B as ys, D as Fs, b as Ns, J as Ds, a as Bs, d as Ms, P as Hs, R as Ls, c as ks, V as Ws } from "../types-CnG3JsRs.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-Ba56IKL7.js";
8
+ import { B as Ea, D as Aa, F as Ra, L as ga, M as _a, P as ma, b as xa, a as ba, S as Ia, T as fa, W as Ca, f as va, c as Ua, p as Oa, r as Va } from "../fundPeginTransaction-oV-dNJOU.js";
9
+ import { B as ha, U as ya, a as Na, f as Da, c as Ba, e as Ma, g as Ha, i as La, h as ka, s as Wa, b as Xa, d as Ka, v as wa } from "../psbtInputFields-DPCFHgGd.js";
10
+ import { C as Ya, P as Ja, V as Za, k as ja, l as qa, c as za, m as Qa, d as $a, b as as, f as ss, j as es, e as ts, g as rs, h as os, i as is, a as ns, p as ls } from "../PeginManager-BMrWtTji.js";
11
+ import { A as ds, M as Ps, P as ps, S as cs, V as Ts, n as Ss, o as Es, q as As, s as Rs, h as gs, j as _s, l as ms, g as xs, a as bs, b as Is, c as fs, d as Cs, e as vs, f as Us, m as Os, p as Vs, r as Fs, v as hs, i as ys, k as Ns } from "../vault-registry-reader-BeIEh62N.js";
12
+ import { B as Bs, D as Ms, b as Hs, J as Ls, a as ks, d as Ws, P as Xs, R as Ks, c as ws, V as Gs } from "../types-D1o_3Q__.js";
13
13
  export {
14
- us as ApplicationRegistryABI,
14
+ ds as ApplicationRegistryABI,
15
15
  J as BIP68NotMatureError,
16
16
  W as BITCOIN_ADDRESS_RE,
17
- ys as BTCVaultRegistryABI,
17
+ Bs as BTCVaultRegistryABI,
18
18
  Ea as BTC_DUST_SAT,
19
- ya as BitcoinScriptType,
19
+ ha as BitcoinScriptType,
20
20
  Ya as CONTRACT_ERRORS,
21
21
  Z as ClaimerPegoutStatusValue,
22
22
  D as ContractStatus,
23
23
  Aa as DUST_THRESHOLD,
24
- Fs as DaemonStatus,
24
+ Ms as DaemonStatus,
25
25
  Ra as FEE_SAFETY_MARGIN,
26
26
  X as HEX_RE,
27
- Ns as JSON_RPC_ERROR_CODES,
28
- Ds as JsonRpcClient,
29
- Bs as JsonRpcError,
27
+ Hs as JSON_RPC_ERROR_CODES,
28
+ Ls as JsonRpcClient,
29
+ ks as JsonRpcError,
30
30
  K as KNOWN_SCRIPT_PREFIXES,
31
- _a as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
32
- ga as MAX_NON_LEGACY_OUTPUT_SIZE,
31
+ ga as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
32
+ _a as MAX_NON_LEGACY_OUTPUT_SIZE,
33
33
  w as MAX_REASONABLE_FEE_SATS,
34
- ds as MEMPOOL_API_URLS,
34
+ Ps as MEMPOOL_API_URLS,
35
35
  ma as P2TR_INPUT_SIZE,
36
36
  xa as PEGIN_AUTH_ANCHOR_OUTPUTS,
37
37
  ba as PEGIN_FIXED_OUTPUTS,
38
- Ms as POST_WOTS_STATUSES,
39
- Hs as PRE_DEPOSITOR_SIGNATURES_STATES,
38
+ Ws as POST_WOTS_STATUSES,
39
+ Xs as PRE_DEPOSITOR_SIGNATURES_STATES,
40
40
  j as PayoutManager,
41
41
  B as PeginAction,
42
42
  Ja as PeginManager,
43
- Ps as ProtocolParamsABI,
44
- z as REFUND_VSIZE,
45
- Ls as RpcErrorCode,
43
+ ps as ProtocolParamsABI,
44
+ q as REFUND_VSIZE,
45
+ Ks as RpcErrorCode,
46
46
  Ia as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
47
47
  cs as ServerIdentityError,
48
48
  G as TXID_RE,
49
49
  fa as TX_BUFFER_SIZE_OVERHEAD,
50
- Fa as UtxoNotAvailableError,
50
+ ya as UtxoNotAvailableError,
51
51
  Za as VAULT_APP_NAME,
52
- ks as VP_TERMINAL_STATUSES,
53
- Ws as VP_TRANSIENT_STATUSES,
52
+ ws as VP_TERMINAL_STATUSES,
53
+ Gs as VP_TRANSIENT_STATUSES,
54
54
  Ts as VaultProviderRpcClient,
55
- ps as ViemProtocolParamsReader,
56
- Ss as ViemUniversalChallengerReader,
57
- Es as ViemVaultKeeperReader,
58
- As as ViemVaultRegistryReader,
59
- Rs as VpResponseValidationError,
60
- _s as VpTokenProvider,
61
- va as WALLET_RELAY_FEE_RATE_THRESHOLD,
62
- q as activateVault,
63
- p as assertPayoutOutputMatchesRegistered,
55
+ Ss as ViemProtocolParamsReader,
56
+ Es as ViemUniversalChallengerReader,
57
+ As as ViemVaultKeeperReader,
58
+ Rs as ViemVaultRegistryReader,
59
+ gs as VpResponseValidationError,
60
+ _s as VpTokenRegistry,
61
+ Ca as WALLET_RELAY_FEE_RATE_THRESHOLD,
62
+ z as activateVault,
63
+ T as assertPayoutOutputMatchesRegistered,
64
64
  Na as assertUtxosAvailable,
65
65
  Q as buildAndBroadcastRefund,
66
66
  e as buildChallengeAssertPsbt,
@@ -72,19 +72,20 @@ export {
72
72
  o as buildPeginTxFromFundedPrePegin,
73
73
  i as buildPrePeginPsbt,
74
74
  A as buildRefundPsbt,
75
- za as buildVaultContext,
75
+ qa as buildVaultContext,
76
76
  Da as calculateBtcTxHash,
77
77
  M as canPerformAction,
78
78
  Ba as collectReservedUtxoRefs,
79
79
  $ as computeHashlock,
80
80
  P as computeMinClaimValue,
81
81
  n as computeNumLocalChallengers,
82
- qa as computeWotsBlockPublicKeysHash,
82
+ za as computeWotsBlockPublicKeysHash,
83
+ ms as createAuthenticatedVpClient,
83
84
  R as createPayoutScript,
84
85
  H as createTaprootScriptPathSignOptions,
85
86
  m as deriveNativeSegwitAddress,
86
87
  x as deriveTaprootAddress,
87
- c as deriveVaultId,
88
+ p as deriveVaultId,
88
89
  Qa as deriveVaultRoot,
89
90
  $a as deriveWotsBlocksFromSeed,
90
91
  b as ensureHexPrefix,
@@ -94,59 +95,62 @@ export {
94
95
  es as expandWotsSeed,
95
96
  ts as extractErrorData,
96
97
  Ma as extractInputsFromTransaction,
97
- _ as extractPayoutSignature,
98
+ g as extractPayoutSignature,
98
99
  l as extractPeginInputSignature,
99
100
  u as finalizePeginInputPsbt,
100
101
  I as formatSatoshisToBtc,
101
- Ca as fundPeginTransaction,
102
- gs as getAddressTxs,
103
- ms as getAddressUtxos,
102
+ va as fundPeginTransaction,
103
+ xs as getAddressTxs,
104
+ bs as getAddressUtxos,
104
105
  rs as getContractErrorMessage,
105
106
  Ha as getDustThreshold,
106
- xs as getMempoolApiUrl,
107
+ Is as getMempoolApiUrl,
107
108
  f as getNetwork,
108
- bs as getNetworkFees,
109
+ fs as getNetworkFees,
109
110
  L as getPeginProtocolState,
110
111
  La as getPsbtInputFields,
111
112
  ka as getScriptType,
112
- Is as getTxHex,
113
- fs as getTxInfo,
114
- vs as getUtxoInfo,
113
+ Cs as getTxHex,
114
+ vs as getTxInfo,
115
+ Us as getUtxoInfo,
115
116
  os as handleContractError,
116
- v as hexToUint8Array,
117
- C as isAddressFromPublicKey,
117
+ C as hexToUint8Array,
118
+ v as isAddressFromPublicKey,
118
119
  sa as isDepositAmountValid,
119
120
  is as isKnownContractError,
120
121
  ea as isPegoutTerminalStatus,
121
122
  ta as isRecognizedPegoutStatus,
122
123
  U as isValidHex,
123
124
  ns as isWotsMismatchError,
125
+ ls as parseFundingOutpointsFromTx,
124
126
  Ua as parseUnfundedWasmTransaction,
125
127
  Oa as peginOutputCount,
126
- ra as pollAndSignPayouts,
128
+ Os as primeVpTokenRegistry,
127
129
  O as processPublicKeyToXOnly,
128
- Cs as pushTx,
130
+ Vs as pushTx,
129
131
  Va as rateBasedTxBufferFee,
130
- Us as resolveProtocolAddresses,
132
+ Fs as resolveProtocolAddresses,
133
+ ra as runDepositorPresignFlow,
131
134
  Wa as selectUtxosForDeposit,
132
135
  Xa as selectUtxosForPegin,
133
136
  Ka as shouldAddChangeOutput,
134
137
  oa as signDepositorGraph,
135
138
  V as stripHexPrefix,
136
139
  ia as submitWotsPublicKey,
137
- h as toXOnly,
138
- y as uint8ArrayToHex,
140
+ F as toXOnly,
141
+ h as uint8ArrayToHex,
139
142
  na as validateDepositAmount,
140
143
  la as validateMultiVaultDepositInputs,
141
144
  ua as validateProviderSelection,
142
145
  da as validateRemainingCapacity,
143
- Os as validateRequestDepositorClaimerArtifactsResponse,
146
+ hs as validateRequestDepositorClaimerArtifactsResponse,
144
147
  Pa as validateSecretAgainstHashlock,
145
148
  wa as validateUtxosAvailable,
146
- ca as validateVaultAmounts,
147
- Ta as validateVaultProviderPubkey,
148
- F as validateWalletPubkey,
149
- Vs as verifyServerIdentity,
150
- pa as waitForPeginStatus
149
+ pa as validateVaultAmounts,
150
+ ca as validateVaultProviderPubkey,
151
+ y as validateWalletPubkey,
152
+ ys as verifyServerIdentity,
153
+ Ns as vpTokenRegistry,
154
+ Ta as waitForPeginStatus
151
155
  };
152
156
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.defineProperty;var l=(i,t,e)=>t in i?d(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var r=(i,t,e)=>l(i,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../sha2-CsTynrfJ.cjs"),o=require("buffer"),g=require("../bitcoin-DIN0OupO.cjs"),q=require("../shared/index.cjs"),f=async(i,t)=>{const e=new TextEncoder,n=e.encode(i),s=e.encode(t),a=new Uint8Array(4+n.length+4+s.length),c=new DataView(a.buffer);return c.setUint32(0,n.length),a.set(n,4),c.setUint32(4+n.length,s.length),a.set(s,4+n.length+4),g.uint8ArrayToHex(u.sha256(a))},h={publicKeyHex:"a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2",address:"tb1pqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkx6jks",network:q.BitcoinNetworks.SIGNET,shouldFailSigning:!1,deriveContextHash:f};class b{constructor(t={}){r(this,"config");this.config={...h,...t.publicKeyHex?{publicKeyHex:t.publicKeyHex}:{},...t.address?{address:t.address}:{},...t.network!==void 0?{network:t.network}:{},...t.shouldFailSigning!==void 0?{shouldFailSigning:t.shouldFailSigning}:{},...t.deriveContextHash?{deriveContextHash:t.deriveContextHash}:{}}}async getPublicKeyHex(){return this.config.publicKeyHex}async getAddress(){return this.config.address}async signPsbt(t){if(this.config.shouldFailSigning)throw new Error("Mock signing failed");if(!t||t.length===0)throw new Error("Invalid PSBT: empty hex string");return t+"deadbeef"}async signPsbts(t,e){const n=[];for(const s of t){const a=await this.signPsbt(s);n.push(a)}return n}async signMessage(t,e){if(this.config.shouldFailSigning)throw new Error("Mock signing failed");if(!t||t.length===0)throw new Error("Invalid message: empty string");return o.Buffer.from(`mock-signature-${e}-${t}-${this.config.publicKeyHex}`).toString("base64")}async getNetwork(){return this.config.network}async deriveContextHash(t,e){return this.config.deriveContextHash(t,e)}updateConfig(t){this.config={...this.config,...t}}reset(){this.config={...h}}}class y{constructor(t={}){r(this,"account");r(this,"chain");r(this,"shouldFailOperations");r(this,"transactionDelay");r(this,"nonce",0);this.account={address:t.address||"0x742d35cc6634c0532925a3b844bc9e7595f0beb0"},this.chain={id:t.chainId??11155111},this.shouldFailOperations=t.shouldFailOperations??!1,this.transactionDelay=t.transactionDelay??0,this.signMessage=this.signMessage.bind(this),this.sendTransaction=this.sendTransaction.bind(this)}async signMessage(t){const e=t.message,n=t.account||this.account.address;if(this.shouldFailOperations)throw new Error("Mock signing failed");if(!e||e.length===0)throw new Error("Invalid message: empty string");const s=`personal_sign:${e}-${n}-${this.chain.id}`;return`0x${o.Buffer.from(s).toString("hex").slice(0,130).padEnd(130,"0")}`}async sendTransaction(t){var s;if(this.shouldFailOperations)throw new Error("Mock transaction failed");if(!t.to)throw new Error("Invalid transaction: missing 'to' address");this.transactionDelay>0&&await new Promise(a=>setTimeout(a,this.transactionDelay)),this.nonce++;const e=JSON.stringify({from:this.account.address,to:t.to,value:((s=t.value)==null?void 0:s.toString())||"0",nonce:this.nonce,chainId:this.chain.id});return`0x${o.Buffer.from(e).toString("hex").slice(0,64).padEnd(64,"0")}`}updateConfig(t){t.address!==void 0&&(this.account.address=t.address),t.chainId!==void 0&&(this.chain.id=t.chainId),t.shouldFailOperations!==void 0&&(this.shouldFailOperations=t.shouldFailOperations),t.transactionDelay!==void 0&&(this.transactionDelay=t.transactionDelay)}reset(){this.account.address="0x742d35cc6634c0532925a3b844bc9e7595f0beb0",this.chain.id=11155111,this.shouldFailOperations=!1,this.transactionDelay=0,this.nonce=0}getCurrentNonce(){return this.nonce}}exports.MockBitcoinWallet=b;exports.MockEthereumWallet=y;
1
+ "use strict";var d=Object.defineProperty;var l=(i,t,e)=>t in i?d(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var r=(i,t,e)=>l(i,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../sha2-CsTynrfJ.cjs"),o=require("buffer"),g=require("../bitcoin-EYBKDtEW.cjs"),q=require("../shared/index.cjs"),f=async(i,t)=>{const e=new TextEncoder,n=e.encode(i),s=e.encode(t),a=new Uint8Array(4+n.length+4+s.length),c=new DataView(a.buffer);return c.setUint32(0,n.length),a.set(n,4),c.setUint32(4+n.length,s.length),a.set(s,4+n.length+4),g.uint8ArrayToHex(u.sha256(a))},h={publicKeyHex:"a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2",address:"tb1pqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkx6jks",network:q.BitcoinNetworks.SIGNET,shouldFailSigning:!1,deriveContextHash:f};class b{constructor(t={}){r(this,"config");this.config={...h,...t.publicKeyHex?{publicKeyHex:t.publicKeyHex}:{},...t.address?{address:t.address}:{},...t.network!==void 0?{network:t.network}:{},...t.shouldFailSigning!==void 0?{shouldFailSigning:t.shouldFailSigning}:{},...t.deriveContextHash?{deriveContextHash:t.deriveContextHash}:{}}}async getPublicKeyHex(){return this.config.publicKeyHex}async getAddress(){return this.config.address}async signPsbt(t){if(this.config.shouldFailSigning)throw new Error("Mock signing failed");if(!t||t.length===0)throw new Error("Invalid PSBT: empty hex string");return t+"deadbeef"}async signPsbts(t,e){const n=[];for(const s of t){const a=await this.signPsbt(s);n.push(a)}return n}async signMessage(t,e){if(this.config.shouldFailSigning)throw new Error("Mock signing failed");if(!t||t.length===0)throw new Error("Invalid message: empty string");return o.Buffer.from(`mock-signature-${e}-${t}-${this.config.publicKeyHex}`).toString("base64")}async getNetwork(){return this.config.network}async deriveContextHash(t,e){return this.config.deriveContextHash(t,e)}updateConfig(t){this.config={...this.config,...t}}reset(){this.config={...h}}}class y{constructor(t={}){r(this,"account");r(this,"chain");r(this,"shouldFailOperations");r(this,"transactionDelay");r(this,"nonce",0);this.account={address:t.address||"0x742d35cc6634c0532925a3b844bc9e7595f0beb0"},this.chain={id:t.chainId??11155111},this.shouldFailOperations=t.shouldFailOperations??!1,this.transactionDelay=t.transactionDelay??0,this.signMessage=this.signMessage.bind(this),this.sendTransaction=this.sendTransaction.bind(this)}async signMessage(t){const e=t.message,n=t.account||this.account.address;if(this.shouldFailOperations)throw new Error("Mock signing failed");if(!e||e.length===0)throw new Error("Invalid message: empty string");const s=`personal_sign:${e}-${n}-${this.chain.id}`;return`0x${o.Buffer.from(s).toString("hex").slice(0,130).padEnd(130,"0")}`}async sendTransaction(t){var s;if(this.shouldFailOperations)throw new Error("Mock transaction failed");if(!t.to)throw new Error("Invalid transaction: missing 'to' address");this.transactionDelay>0&&await new Promise(a=>setTimeout(a,this.transactionDelay)),this.nonce++;const e=JSON.stringify({from:this.account.address,to:t.to,value:((s=t.value)==null?void 0:s.toString())||"0",nonce:this.nonce,chainId:this.chain.id});return`0x${o.Buffer.from(e).toString("hex").slice(0,64).padEnd(64,"0")}`}updateConfig(t){t.address!==void 0&&(this.account.address=t.address),t.chainId!==void 0&&(this.chain.id=t.chainId),t.shouldFailOperations!==void 0&&(this.shouldFailOperations=t.shouldFailOperations),t.transactionDelay!==void 0&&(this.transactionDelay=t.transactionDelay)}reset(){this.account.address="0x742d35cc6634c0532925a3b844bc9e7595f0beb0",this.chain.id=11155111,this.shouldFailOperations=!1,this.transactionDelay=0,this.nonce=0}getCurrentNonce(){return this.nonce}}exports.MockBitcoinWallet=b;exports.MockEthereumWallet=y;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -3,7 +3,7 @@ var l = (e, t, s) => t in e ? d(e, t, { enumerable: !0, configurable: !0, writab
3
3
  var o = (e, t, s) => l(e, typeof t != "symbol" ? t + "" : t, s);
4
4
  import { s as g } from "../sha2-6wN58S6R.js";
5
5
  import { Buffer as r } from "buffer";
6
- import { u } from "../bitcoin-B-Y0DlqR.js";
6
+ import { u } from "../bitcoin-0_T6KJON.js";
7
7
  import { BitcoinNetworks as q } from "../shared/index.js";
8
8
  const f = async (e, t) => {
9
9
  const s = new TextEncoder(), n = s.encode(e), i = s.encode(t), a = new Uint8Array(4 + n.length + 4 + i.length), c = new DataView(a.buffer);
@@ -1,2 +1,2 @@
1
- "use strict";var h=Object.defineProperty;var _=(e,t,n)=>t in e?h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var p=(e,t,n)=>_(e,typeof t!="symbol"?t+"":t,n);const N=[{type:"function",name:"submitPeginRequest",inputs:[{name:"depositor",type:"address",internalType:"address"},{name:"depositorBtcPubKey",type:"bytes32",internalType:"bytes32"},{name:"btcPopSignature",type:"bytes",internalType:"bytes"},{name:"unsignedPrePeginTx",type:"bytes",internalType:"bytes"},{name:"depositorSignedPeginTx",type:"bytes",internalType:"bytes"},{name:"vaultProvider",type:"address",internalType:"address"},{name:"hashlock",type:"bytes32",internalType:"bytes32"},{name:"htlcVout",type:"uint8",internalType:"uint8"},{name:"depositorPayoutBtcAddress",type:"bytes",internalType:"bytes"},{name:"depositorWotsPkHash",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"payable"},{type:"function",name:"submitPeginRequest",inputs:[{name:"depositor",type:"address",internalType:"address"},{name:"depositorBtcPubKey",type:"bytes32",internalType:"bytes32"},{name:"btcPopSignature",type:"bytes",internalType:"bytes"},{name:"unsignedPrePeginTx",type:"bytes",internalType:"bytes"},{name:"depositorSignedPeginTx",type:"bytes",internalType:"bytes"},{name:"vaultProvider",type:"address",internalType:"address"},{name:"hashlock",type:"bytes32",internalType:"bytes32"},{name:"htlcVout",type:"uint8",internalType:"uint8"},{name:"referralCode",type:"uint32",internalType:"uint32"},{name:"depositorPayoutBtcAddress",type:"bytes",internalType:"bytes"},{name:"depositorWotsPkHash",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"payable"},{type:"function",name:"submitPeginRequestBatch",inputs:[{name:"depositor",type:"address",internalType:"address"},{name:"vaultProvider",type:"address",internalType:"address"},{name:"requests",type:"tuple[]",internalType:"struct IBTCVaultRegistry.BatchPeginRequest[]",components:[{name:"depositorBtcPubKey",type:"bytes32",internalType:"bytes32"},{name:"btcPopSignature",type:"bytes",internalType:"bytes"},{name:"unsignedPrePeginTx",type:"bytes",internalType:"bytes"},{name:"depositorSignedPeginTx",type:"bytes",internalType:"bytes"},{name:"hashlock",type:"bytes32",internalType:"bytes32"},{name:"htlcVout",type:"uint8",internalType:"uint8"},{name:"referralCode",type:"uint32",internalType:"uint32"},{name:"depositorPayoutBtcAddress",type:"bytes",internalType:"bytes"},{name:"depositorWotsPkHash",type:"bytes32",internalType:"bytes32"}]}],outputs:[{name:"vaultIds",type:"bytes32[]",internalType:"bytes32[]"}],stateMutability:"payable"},{type:"function",name:"activateVaultWithSecret",inputs:[{name:"vaultId",type:"bytes32",internalType:"bytes32"},{name:"s",type:"bytes32",internalType:"bytes32"},{name:"activationMetadata",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"getPegInFee",inputs:[{name:"vaultProvider",type:"address",internalType:"address"}],outputs:[{name:"totalFee",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getBtcVaultBasicInfo",inputs:[{name:"vaultId",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"vBasic",type:"tuple",internalType:"struct BTCVaultTypes.BTCVaultBasicInfo",components:[{name:"depositor",type:"address",internalType:"address"},{name:"depositorBtcPubKey",type:"bytes32",internalType:"bytes32"},{name:"amount",type:"uint256",internalType:"uint256"},{name:"vaultProvider",type:"address",internalType:"address"},{name:"status",type:"uint8",internalType:"enum IBTCVaultRegistry.BTCVaultStatus"},{name:"applicationEntryPoint",type:"address",internalType:"address"},{name:"createdAt",type:"uint256",internalType:"uint256"}]}],stateMutability:"view"},{type:"error",name:"InvalidPeginFee",inputs:[{name:"provided",type:"uint256",internalType:"uint256"},{name:"required",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidSecret",inputs:[]},{type:"error",name:"ActivationDeadlineExpired",inputs:[]},{type:"error",name:"InvalidHashlock",inputs:[]},{type:"error",name:"DuplicateHashlock",inputs:[]},{type:"error",name:"CapExceeded",inputs:[]},{type:"error",name:"InvalidOutputIndex",inputs:[]},{type:"error",name:"PeginSignaturesIncomplete",inputs:[]},{type:"function",name:"getBtcVaultProtocolInfo",inputs:[{name:"vaultId",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"vProtocol",type:"tuple",internalType:"struct BTCVaultRegistryTypes.BTCVaultProtocolInfo",components:[{name:"depositorSignedPeginTx",type:"bytes",internalType:"bytes"},{name:"universalChallengersVersion",type:"uint16",internalType:"uint16"},{name:"appVaultKeepersVersion",type:"uint16",internalType:"uint16"},{name:"offchainParamsVersion",type:"uint16",internalType:"uint16"},{name:"verifiedAt",type:"uint256",internalType:"uint256"},{name:"depositorWotsPkHash",type:"bytes32",internalType:"bytes32"},{name:"hashlock",type:"bytes32",internalType:"bytes32"},{name:"htlcVout",type:"uint8",internalType:"uint8"},{name:"depositorPopSignature",type:"bytes",internalType:"bytes"},{name:"prePeginTxHash",type:"bytes32",internalType:"bytes32"},{name:"vaultProviderCommissionBps",type:"uint16",internalType:"uint16"}]}],stateMutability:"view"},{type:"function",name:"protocolParams",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IProtocolParams"}],stateMutability:"view"},{type:"function",name:"applicationRegistry",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IApplicationRegistry"}],stateMutability:"view"}];class T extends Error{constructor(t,n,r="local",s){super(n),this.code=t,this.source=r,this.data=s,this.name="JsonRpcError"}}const d={TIMEOUT:-32e3,NETWORK:-32001,PROXY_TIMEOUT:-32002,PROXY_UNAVAILABLE:-32003,INVALID_RESPONSE:-32700},O="2.0",g=3,v=1e3,f=new Set([408,429,500,502,503,504]),w=new Set(["vaultProvider_getPeginStatus","vaultProvider_getPegoutStatus","vaultProvider_requestDepositorPresignTransactions"]);function D(e){return w.has(e)}const B="auth_expired";function V(e){if(!(e instanceof T)||e.source!=="wire")return!1;const t=e.data;return t===null||typeof t!="object"?!1:t.kind===B}class L{constructor(t){p(this,"baseUrl");p(this,"timeout");p(this,"headers");p(this,"requestId",0);p(this,"retries");p(this,"retryDelay");p(this,"retryableFor");p(this,"tokenProvider");this.baseUrl=t.baseUrl.replace(/\/$/,""),this.timeout=t.timeout,this.headers={"Content-Type":"application/json",...t.headers},this.retries=t.retries??g,this.retryDelay=t.retryDelay??v,this.retryableFor=t.retryableFor??D,this.tokenProvider=t.tokenProvider}async buildHeaders(t){const n={...this.headers};if(this.tokenProvider){const r=await this.tokenProvider.getToken(t);r&&(n.Authorization=`Bearer ${r}`)}return n}async call(t,n,r){try{return await this.callOnce(t,n,r)}catch(s){if(this.tokenProvider&&V(s))return this.tokenProvider.invalidate(),await this.callOnce(t,n,r);throw s}}async callOnce(t,n,r){const s=await this.fetchWithRetry(t,n,r);let i;try{i=await s.json()}catch{throw new T(d.INVALID_RESPONSE,"Invalid JSON-RPC response: body is not valid JSON","local")}if(i===null||typeof i!="object"||Array.isArray(i))throw new T(d.INVALID_RESPONSE,`Invalid JSON-RPC response: expected an object, got ${typeof i}`,"local");const o=i;if("error"in o&&o.error!=null){const P=o.error;throw new T(P.code??d.INVALID_RESPONSE,P.message??"Unknown RPC error","wire",P.data)}if(!("result"in o))throw new T(d.INVALID_RESPONSE,'Invalid JSON-RPC response: missing "result" field',"local");return o.result}async callRaw(t,n,r){return this.fetchWithRetry(t,n,r)}async fetchWithRetry(t,n,r){const s=++this.requestId,i=this.retryableFor(t)?this.retries:0,P=JSON.stringify({jsonrpc:O,method:t,params:[n],id:s});let b=null;for(let u=0;u<=i;u++){const c=new AbortController,E=setTimeout(()=>c.abort(),this.timeout),l=r?U(r,c.signal):null,A=l?l.signal:c.signal;try{const a=await this.buildHeaders(t),y=await fetch(this.baseUrl,{method:"POST",headers:a,body:P,signal:A});if(clearTimeout(E),l==null||l.cleanup(),!y.ok){if(u<i&&f.has(y.status)){const S=this.retryDelay*Math.pow(2,u);await this.sleep(S,r);continue}throw new Error(`HTTP error: ${y.status} ${y.statusText}`)}return y}catch(a){if(clearTimeout(E),l==null||l.cleanup(),b=a instanceof Error?a:new Error(String(a)),r!=null&&r.aborted)throw new Error("Request aborted");if(a instanceof Error&&a.name==="AbortError"){if(u<i){const y=this.retryDelay*Math.pow(2,u);await this.sleep(y,r);continue}throw new T(d.TIMEOUT,`Request timeout after ${this.timeout}ms (${i+1} attempts)`,"local")}if(a instanceof TypeError){if(u<i){const y=this.retryDelay*Math.pow(2,u);await this.sleep(y,r);continue}throw new T(d.NETWORK,`Network error: ${a.message} (${i+1} attempts)`,"local")}throw a}}throw b||new Error("Unknown error after retries")}sleep(t,n){return new Promise((r,s)=>{if(n!=null&&n.aborted){s(new Error("Request aborted"));return}const i=setTimeout(()=>{n==null||n.removeEventListener("abort",o),r()},t),o=()=>{clearTimeout(i),s(new Error("Request aborted"))};n==null||n.addEventListener("abort",o,{once:!0})})}getBaseUrl(){return this.baseUrl}}function U(e,t){if(e.aborted)return{signal:e,cleanup:()=>{}};if(t.aborted)return{signal:t,cleanup:()=>{}};const n=new AbortController,r=()=>{t.removeEventListener("abort",s),n.abort()},s=()=>{e.removeEventListener("abort",r),n.abort()};e.addEventListener("abort",r,{once:!0}),t.addEventListener("abort",s,{once:!0});const i=()=>{e.removeEventListener("abort",r),t.removeEventListener("abort",s)};return{signal:n.signal,cleanup:i}}var m=(e=>(e.PENDING_INGESTION="PendingIngestion",e.PENDING_DEPOSITOR_WOTS_PK="PendingDepositorWotsPK",e.PENDING_BABE_SETUP="PendingBabeSetup",e.PENDING_CHALLENGER_PRESIGNING="PendingChallengerPresigning",e.PENDING_PEGIN_SIGS_AVAILABILITY="PendingPeginSigsAvailability",e.PENDING_PRE_PEGIN_CONFIRMATIONS="PendingPrePegInConfirmations",e.PENDING_DEPOSITOR_SIGNATURES="PendingDepositorSignatures",e.PENDING_ACKS="PendingACKs",e.PENDING_ACTIVATION="PendingActivation",e.ACTIVATED="Activated",e.EXPIRED="Expired",e.CLAIM_POSTED="ClaimPosted",e.PEGGED_OUT="PeggedOut",e))(m||{});const C=["PendingIngestion","PendingBabeSetup","PendingChallengerPresigning","PendingPeginSigsAvailability","PendingPrePegInConfirmations"],G=["PendingACKs","PendingActivation","Activated"],R=new Set(["PendingBabeSetup","PendingChallengerPresigning","PendingPeginSigsAvailability","PendingPrePegInConfirmations",...G]),k=new Set(["Expired","ClaimPosted","PeggedOut"]),M=new Set([...R,"PendingDepositorSignatures"]);var I=(e=>(e[e.DATABASE_ERROR=-32005]="DATABASE_ERROR",e[e.PRESIGN_ERROR=-32006]="PRESIGN_ERROR",e[e.JSON_SERIALIZATION_ERROR=-32007]="JSON_SERIALIZATION_ERROR",e[e.TX_GRAPH_ERROR=-32008]="TX_GRAPH_ERROR",e[e.INVALID_GRAPH=-32009]="INVALID_GRAPH",e[e.VALIDATION_ERROR=-32010]="VALIDATION_ERROR",e[e.NOT_FOUND=-32011]="NOT_FOUND",e[e.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",e))(I||{});exports.BTCVaultRegistryABI=N;exports.DaemonStatus=m;exports.JSON_RPC_ERROR_CODES=d;exports.JsonRpcClient=L;exports.JsonRpcError=T;exports.POST_WOTS_STATUSES=M;exports.PRE_DEPOSITOR_SIGNATURES_STATES=C;exports.RpcErrorCode=I;exports.VP_TERMINAL_STATUSES=k;exports.VP_TRANSIENT_STATUSES=R;
2
- //# sourceMappingURL=types-jmEyzzhY.cjs.map
1
+ "use strict";var h=Object.defineProperty;var _=(e,t,n)=>t in e?h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var p=(e,t,n)=>_(e,typeof t!="symbol"?t+"":t,n);const N=[{type:"function",name:"submitPeginRequest",inputs:[{name:"depositor",type:"address",internalType:"address"},{name:"depositorBtcPubKey",type:"bytes32",internalType:"bytes32"},{name:"btcPopSignature",type:"bytes",internalType:"bytes"},{name:"unsignedPrePeginTx",type:"bytes",internalType:"bytes"},{name:"depositorSignedPeginTx",type:"bytes",internalType:"bytes"},{name:"vaultProvider",type:"address",internalType:"address"},{name:"hashlock",type:"bytes32",internalType:"bytes32"},{name:"htlcVout",type:"uint8",internalType:"uint8"},{name:"depositorPayoutBtcAddress",type:"bytes",internalType:"bytes"},{name:"depositorWotsPkHash",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"payable"},{type:"function",name:"submitPeginRequest",inputs:[{name:"depositor",type:"address",internalType:"address"},{name:"depositorBtcPubKey",type:"bytes32",internalType:"bytes32"},{name:"btcPopSignature",type:"bytes",internalType:"bytes"},{name:"unsignedPrePeginTx",type:"bytes",internalType:"bytes"},{name:"depositorSignedPeginTx",type:"bytes",internalType:"bytes"},{name:"vaultProvider",type:"address",internalType:"address"},{name:"hashlock",type:"bytes32",internalType:"bytes32"},{name:"htlcVout",type:"uint8",internalType:"uint8"},{name:"referralCode",type:"uint32",internalType:"uint32"},{name:"depositorPayoutBtcAddress",type:"bytes",internalType:"bytes"},{name:"depositorWotsPkHash",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"payable"},{type:"function",name:"submitPeginRequestBatch",inputs:[{name:"depositor",type:"address",internalType:"address"},{name:"vaultProvider",type:"address",internalType:"address"},{name:"requests",type:"tuple[]",internalType:"struct IBTCVaultRegistry.BatchPeginRequest[]",components:[{name:"depositorBtcPubKey",type:"bytes32",internalType:"bytes32"},{name:"btcPopSignature",type:"bytes",internalType:"bytes"},{name:"unsignedPrePeginTx",type:"bytes",internalType:"bytes"},{name:"depositorSignedPeginTx",type:"bytes",internalType:"bytes"},{name:"hashlock",type:"bytes32",internalType:"bytes32"},{name:"htlcVout",type:"uint8",internalType:"uint8"},{name:"referralCode",type:"uint32",internalType:"uint32"},{name:"depositorPayoutBtcAddress",type:"bytes",internalType:"bytes"},{name:"depositorWotsPkHash",type:"bytes32",internalType:"bytes32"}]}],outputs:[{name:"vaultIds",type:"bytes32[]",internalType:"bytes32[]"}],stateMutability:"payable"},{type:"function",name:"activateVaultWithSecret",inputs:[{name:"vaultId",type:"bytes32",internalType:"bytes32"},{name:"s",type:"bytes32",internalType:"bytes32"},{name:"activationMetadata",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"getPegInFee",inputs:[{name:"vaultProvider",type:"address",internalType:"address"}],outputs:[{name:"totalFee",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getVaultProviderBTCKey",inputs:[{name:"vpAddr",type:"address",internalType:"address"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"getBtcVaultBasicInfo",inputs:[{name:"vaultId",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"vBasic",type:"tuple",internalType:"struct BTCVaultTypes.BTCVaultBasicInfo",components:[{name:"depositor",type:"address",internalType:"address"},{name:"depositorBtcPubKey",type:"bytes32",internalType:"bytes32"},{name:"amount",type:"uint256",internalType:"uint256"},{name:"vaultProvider",type:"address",internalType:"address"},{name:"status",type:"uint8",internalType:"enum IBTCVaultRegistry.BTCVaultStatus"},{name:"applicationEntryPoint",type:"address",internalType:"address"},{name:"createdAt",type:"uint256",internalType:"uint256"}]}],stateMutability:"view"},{type:"error",name:"InvalidPeginFee",inputs:[{name:"provided",type:"uint256",internalType:"uint256"},{name:"required",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidSecret",inputs:[]},{type:"error",name:"ActivationDeadlineExpired",inputs:[]},{type:"error",name:"InvalidHashlock",inputs:[]},{type:"error",name:"DuplicateHashlock",inputs:[]},{type:"error",name:"CapExceeded",inputs:[]},{type:"error",name:"InvalidOutputIndex",inputs:[]},{type:"error",name:"PeginSignaturesIncomplete",inputs:[]},{type:"function",name:"getBtcVaultProtocolInfo",inputs:[{name:"vaultId",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"vProtocol",type:"tuple",internalType:"struct BTCVaultRegistryTypes.BTCVaultProtocolInfo",components:[{name:"depositorSignedPeginTx",type:"bytes",internalType:"bytes"},{name:"universalChallengersVersion",type:"uint16",internalType:"uint16"},{name:"appVaultKeepersVersion",type:"uint16",internalType:"uint16"},{name:"offchainParamsVersion",type:"uint16",internalType:"uint16"},{name:"verifiedAt",type:"uint256",internalType:"uint256"},{name:"depositorWotsPkHash",type:"bytes32",internalType:"bytes32"},{name:"hashlock",type:"bytes32",internalType:"bytes32"},{name:"htlcVout",type:"uint8",internalType:"uint8"},{name:"depositorPopSignature",type:"bytes",internalType:"bytes"},{name:"prePeginTxHash",type:"bytes32",internalType:"bytes32"},{name:"vaultProviderCommissionBps",type:"uint16",internalType:"uint16"}]}],stateMutability:"view"},{type:"function",name:"protocolParams",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IProtocolParams"}],stateMutability:"view"},{type:"function",name:"applicationRegistry",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IApplicationRegistry"}],stateMutability:"view"}];class T extends Error{constructor(t,n,r="local",s){super(n),this.code=t,this.source=r,this.data=s,this.name="JsonRpcError"}}const d={TIMEOUT:-32e3,NETWORK:-32001,PROXY_TIMEOUT:-32002,PROXY_UNAVAILABLE:-32003,INVALID_RESPONSE:-32700},O="2.0",g=3,v=1e3,f=new Set([408,429,500,502,503,504]),w=new Set(["vaultProvider_getPeginStatus","vaultProvider_getPegoutStatus","vaultProvider_requestDepositorPresignTransactions"]);function D(e){return w.has(e)}const B="auth_expired";function V(e){if(!(e instanceof T)||e.source!=="wire")return!1;const t=e.data;return t===null||typeof t!="object"?!1:t.kind===B}class L{constructor(t){p(this,"baseUrl");p(this,"timeout");p(this,"headers");p(this,"requestId",0);p(this,"retries");p(this,"retryDelay");p(this,"retryableFor");p(this,"tokenProvider");this.baseUrl=t.baseUrl.replace(/\/$/,""),this.timeout=t.timeout,this.headers={"Content-Type":"application/json",...t.headers},this.retries=t.retries??g,this.retryDelay=t.retryDelay??v,this.retryableFor=t.retryableFor??D,this.tokenProvider=t.tokenProvider}async buildHeaders(t){const n={...this.headers};if(this.tokenProvider){const r=await this.tokenProvider.getToken(t);r&&(n.Authorization=`Bearer ${r}`)}return n}async call(t,n,r){try{return await this.callOnce(t,n,r)}catch(s){if(this.tokenProvider&&V(s))return this.tokenProvider.invalidate(),await this.callOnce(t,n,r);throw s}}async callOnce(t,n,r){const s=await this.fetchWithRetry(t,n,r);let i;try{i=await s.json()}catch{throw new T(d.INVALID_RESPONSE,"Invalid JSON-RPC response: body is not valid JSON","local")}if(i===null||typeof i!="object"||Array.isArray(i))throw new T(d.INVALID_RESPONSE,`Invalid JSON-RPC response: expected an object, got ${typeof i}`,"local");const o=i;if("error"in o&&o.error!=null){const P=o.error;throw new T(P.code??d.INVALID_RESPONSE,P.message??"Unknown RPC error","wire",P.data)}if(!("result"in o))throw new T(d.INVALID_RESPONSE,'Invalid JSON-RPC response: missing "result" field',"local");return o.result}async callRaw(t,n,r){return this.fetchWithRetry(t,n,r)}async fetchWithRetry(t,n,r){const s=++this.requestId,i=this.retryableFor(t)?this.retries:0,P=JSON.stringify({jsonrpc:O,method:t,params:[n],id:s});let b=null;for(let u=0;u<=i;u++){const c=new AbortController,m=setTimeout(()=>c.abort(),this.timeout),l=r?C(r,c.signal):null,A=l?l.signal:c.signal;try{const a=await this.buildHeaders(t),y=await fetch(this.baseUrl,{method:"POST",headers:a,body:P,signal:A});if(clearTimeout(m),l==null||l.cleanup(),!y.ok){if(u<i&&f.has(y.status)){const S=this.retryDelay*Math.pow(2,u);await this.sleep(S,r);continue}throw new Error(`HTTP error: ${y.status} ${y.statusText}`)}return y}catch(a){if(clearTimeout(m),l==null||l.cleanup(),b=a instanceof Error?a:new Error(String(a)),r!=null&&r.aborted)throw new Error("Request aborted");if(a instanceof Error&&a.name==="AbortError"){if(u<i){const y=this.retryDelay*Math.pow(2,u);await this.sleep(y,r);continue}throw new T(d.TIMEOUT,`Request timeout after ${this.timeout}ms (${i+1} attempts)`,"local")}if(a instanceof TypeError){if(u<i){const y=this.retryDelay*Math.pow(2,u);await this.sleep(y,r);continue}throw new T(d.NETWORK,`Network error: ${a.message} (${i+1} attempts)`,"local")}throw a}}throw b||new Error("Unknown error after retries")}sleep(t,n){return new Promise((r,s)=>{if(n!=null&&n.aborted){s(new Error("Request aborted"));return}const i=setTimeout(()=>{n==null||n.removeEventListener("abort",o),r()},t),o=()=>{clearTimeout(i),s(new Error("Request aborted"))};n==null||n.addEventListener("abort",o,{once:!0})})}getBaseUrl(){return this.baseUrl}}function C(e,t){if(e.aborted)return{signal:e,cleanup:()=>{}};if(t.aborted)return{signal:t,cleanup:()=>{}};const n=new AbortController,r=()=>{t.removeEventListener("abort",s),n.abort()},s=()=>{e.removeEventListener("abort",r),n.abort()};e.addEventListener("abort",r,{once:!0}),t.addEventListener("abort",s,{once:!0});const i=()=>{e.removeEventListener("abort",r),t.removeEventListener("abort",s)};return{signal:n.signal,cleanup:i}}var E=(e=>(e.PENDING_INGESTION="PendingIngestion",e.PENDING_DEPOSITOR_WOTS_PK="PendingDepositorWotsPK",e.PENDING_BABE_SETUP="PendingBabeSetup",e.PENDING_CHALLENGER_PRESIGNING="PendingChallengerPresigning",e.PENDING_PEGIN_SIGS_AVAILABILITY="PendingPeginSigsAvailability",e.PENDING_PRE_PEGIN_CONFIRMATIONS="PendingPrePegInConfirmations",e.PENDING_DEPOSITOR_SIGNATURES="PendingDepositorSignatures",e.PENDING_ACKS="PendingACKs",e.PENDING_ACTIVATION="PendingActivation",e.ACTIVATED="Activated",e.EXPIRED="Expired",e.CLAIM_POSTED="ClaimPosted",e.PEGGED_OUT="PeggedOut",e))(E||{});const U=["PendingIngestion","PendingBabeSetup","PendingChallengerPresigning","PendingPeginSigsAvailability","PendingPrePegInConfirmations"],G=["PendingACKs","PendingActivation","Activated"],R=new Set(["PendingBabeSetup","PendingChallengerPresigning","PendingPeginSigsAvailability","PendingPrePegInConfirmations",...G]),k=new Set(["Expired","ClaimPosted","PeggedOut"]),M=new Set([...R,"PendingDepositorSignatures"]);var I=(e=>(e[e.DATABASE_ERROR=-32005]="DATABASE_ERROR",e[e.PRESIGN_ERROR=-32006]="PRESIGN_ERROR",e[e.JSON_SERIALIZATION_ERROR=-32007]="JSON_SERIALIZATION_ERROR",e[e.TX_GRAPH_ERROR=-32008]="TX_GRAPH_ERROR",e[e.INVALID_GRAPH=-32009]="INVALID_GRAPH",e[e.VALIDATION_ERROR=-32010]="VALIDATION_ERROR",e[e.NOT_FOUND=-32011]="NOT_FOUND",e[e.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",e))(I||{});exports.BTCVaultRegistryABI=N;exports.DaemonStatus=E;exports.JSON_RPC_ERROR_CODES=d;exports.JsonRpcClient=L;exports.JsonRpcError=T;exports.POST_WOTS_STATUSES=M;exports.PRE_DEPOSITOR_SIGNATURES_STATES=U;exports.RpcErrorCode=I;exports.VP_TERMINAL_STATUSES=k;exports.VP_TRANSIENT_STATUSES=R;
2
+ //# sourceMappingURL=types-C2IUB0Jd.cjs.map