@babylonlabs-io/ts-sdk 0.72.0 → 0.73.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.
- package/README.md +56 -13
- package/dist/BTCVaultRegistryKeyEpochs.abi-CrQiTLfA.cjs +2 -0
- package/dist/BTCVaultRegistryKeyEpochs.abi-CrQiTLfA.cjs.map +1 -0
- package/dist/BTCVaultRegistryKeyEpochs.abi-D8cIbMtH.js +229 -0
- package/dist/BTCVaultRegistryKeyEpochs.abi-D8cIbMtH.js.map +1 -0
- package/dist/PeginManager-C9RPOd0L.js +1216 -0
- package/dist/PeginManager-C9RPOd0L.js.map +1 -0
- package/dist/PeginManager-E-UHA1un.cjs +2 -0
- package/dist/PeginManager-E-UHA1un.cjs.map +1 -0
- package/dist/bip322Verify-B7_gIhRk.cjs +2 -0
- package/dist/bip322Verify-B7_gIhRk.cjs.map +1 -0
- package/dist/bip322Verify-D6sBBUHE.js +79 -0
- package/dist/bip322Verify-D6sBBUHE.js.map +1 -0
- package/dist/{buildAndBroadcastReclaim-YvWDRAN8.js → buildAndBroadcastReclaim-BXclIcu_.js} +366 -357
- package/dist/buildAndBroadcastReclaim-BXclIcu_.js.map +1 -0
- package/dist/buildAndBroadcastReclaim-U-PyFfDg.cjs +2 -0
- package/dist/buildAndBroadcastReclaim-U-PyFfDg.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +209 -205
- package/dist/index.js.map +1 -1
- package/dist/onChainBtcPubkey-BbxRrbvg.cjs +2 -0
- package/dist/onChainBtcPubkey-BbxRrbvg.cjs.map +1 -0
- package/dist/onChainBtcPubkey-C-6UWpD8.js +34 -0
- package/dist/onChainBtcPubkey-C-6UWpD8.js.map +1 -0
- package/dist/{parseFundingOutpoints-BkgGihaY.cjs → parseFundingOutpoints-B4iQeX6q.cjs} +2 -2
- package/dist/{parseFundingOutpoints-BkgGihaY.cjs.map → parseFundingOutpoints-B4iQeX6q.cjs.map} +1 -1
- package/dist/{parseFundingOutpoints-DlINgQ3X.js → parseFundingOutpoints-B67CoXpF.js} +2 -2
- package/dist/{parseFundingOutpoints-DlINgQ3X.js.map → parseFundingOutpoints-B67CoXpF.js.map} +1 -1
- package/dist/pegin-registration-client-6vLk2itL.cjs +2 -0
- package/dist/pegin-registration-client-6vLk2itL.cjs.map +1 -0
- package/dist/pegin-registration-client-BdRiR8br.js +2635 -0
- package/dist/pegin-registration-client-BdRiR8br.js.map +1 -0
- package/dist/primeVpAuth-DBHohVKM.cjs +2 -0
- package/dist/primeVpAuth-DBHohVKM.cjs.map +1 -0
- package/dist/primeVpAuth-DvaD45q_.js +745 -0
- package/dist/primeVpAuth-DvaD45q_.js.map +1 -0
- package/dist/psbtInputFields-B3e05Xe6.js +171 -0
- package/dist/psbtInputFields-B3e05Xe6.js.map +1 -0
- package/dist/psbtInputFields-BIxBpPj2.cjs +2 -0
- package/dist/psbtInputFields-BIxBpPj2.cjs.map +1 -0
- package/dist/sha2-CrlWM5S8.js +312 -0
- package/dist/{sha2-BYVxyZzX.js.map → sha2-CrlWM5S8.js.map} +1 -1
- package/dist/sha2-DI0-0SHr.cjs +2 -0
- package/dist/{sha2-DsrLC4NM.cjs.map → sha2-DI0-0SHr.cjs.map} +1 -1
- package/dist/{signPsbtsWithFallback-CCFTzE0o.js → signPsbtsWithFallback-0VBALhjS.js} +2 -2
- package/dist/{signPsbtsWithFallback-CCFTzE0o.js.map → signPsbtsWithFallback-0VBALhjS.js.map} +1 -1
- package/dist/{signPsbtsWithFallback-CrkvpSJz.cjs → signPsbtsWithFallback-DMSpIQWH.cjs} +2 -2
- package/dist/{signPsbtsWithFallback-CrkvpSJz.cjs.map → signPsbtsWithFallback-DMSpIQWH.cjs.map} +1 -1
- package/dist/tbv/core/clients/eth/__tests__/eth-import-boundary.test.d.ts +2 -0
- package/dist/tbv/core/clients/eth/__tests__/eth-import-boundary.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/eth/__tests__/onChainBtcPubkey.test.d.ts +2 -0
- package/dist/tbv/core/clients/eth/__tests__/onChainBtcPubkey.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/eth/__tests__/payout-script.test.d.ts +2 -0
- package/dist/tbv/core/clients/eth/__tests__/payout-script.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/eth/__tests__/pegin-registration-calldata.test.d.ts +2 -0
- package/dist/tbv/core/clients/eth/__tests__/pegin-registration-calldata.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/eth/__tests__/pegin-registration-client.test.d.ts +2 -0
- package/dist/tbv/core/clients/eth/__tests__/pegin-registration-client.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/eth/__tests__/pegin-transaction.test.d.ts +2 -0
- package/dist/tbv/core/clients/eth/__tests__/pegin-transaction.test.d.ts.map +1 -0
- package/dist/tbv/core/clients/eth/index.cjs +2 -0
- package/dist/tbv/core/clients/eth/index.cjs.map +1 -0
- package/dist/tbv/core/clients/eth/index.d.ts +4 -0
- package/dist/tbv/core/clients/eth/index.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/index.js +22 -0
- package/dist/tbv/core/clients/eth/index.js.map +1 -0
- package/dist/tbv/core/clients/eth/onChainBtcPubkey.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/operation-key-reader.d.ts +1 -1
- package/dist/tbv/core/clients/eth/operation-key-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/payout-script.d.ts +4 -0
- package/dist/tbv/core/clients/eth/payout-script.d.ts.map +1 -0
- package/dist/tbv/core/clients/eth/pegin-registration-client.d.ts +99 -0
- package/dist/tbv/core/clients/eth/pegin-registration-client.d.ts.map +1 -0
- package/dist/tbv/core/clients/eth/pegin-transaction.d.ts +14 -0
- package/dist/tbv/core/clients/eth/pegin-transaction.d.ts.map +1 -0
- package/dist/tbv/core/clients/eth/protocol-params-reader.d.ts +6 -1
- package/dist/tbv/core/clients/eth/protocol-params-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/signer-set-reader.d.ts +4 -4
- package/dist/tbv/core/clients/eth/signer-set-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/types.d.ts +29 -8
- package/dist/tbv/core/clients/eth/types.d.ts.map +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts +1 -1
- package/dist/tbv/core/clients/eth/vault-registry-reader.d.ts.map +1 -1
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +55 -48
- package/dist/tbv/core/clients/index.js.map +1 -1
- package/dist/tbv/core/clients/mempool/index.cjs +2 -0
- package/dist/tbv/core/clients/mempool/index.cjs.map +1 -0
- package/dist/tbv/core/clients/mempool/index.js +222 -0
- package/dist/tbv/core/clients/mempool/index.js.map +1 -0
- package/dist/tbv/core/contracts/index.cjs +1 -1
- package/dist/tbv/core/contracts/index.cjs.map +1 -1
- package/dist/tbv/core/contracts/index.js +491 -12
- package/dist/tbv/core/contracts/index.js.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.d.ts +1 -0
- package/dist/tbv/core/index.d.ts.map +1 -1
- package/dist/tbv/core/index.js +207 -203
- package/dist/tbv/core/index.js.map +1 -1
- package/dist/tbv/core/managers/PeginManager.d.ts +38 -30
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.d.ts +2 -1
- package/dist/tbv/core/managers/index.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.js +2 -2
- package/dist/tbv/core/services/deposit/validateOnChainParticipantKeys.d.ts +20 -0
- package/dist/tbv/core/services/deposit/validateOnChainParticipantKeys.d.ts.map +1 -1
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +2 -2
- package/dist/tbv/core/services/participants/resolveParticipantKeys.d.ts +8 -0
- package/dist/tbv/core/services/participants/resolveParticipantKeys.d.ts.map +1 -1
- package/dist/tbv/core/utils/eth/index.cjs +2 -0
- package/dist/tbv/core/utils/eth/index.cjs.map +1 -0
- package/dist/tbv/core/utils/eth/index.js +109 -0
- package/dist/tbv/core/utils/eth/index.js.map +1 -0
- package/dist/tbv/core/utils/index.cjs +1 -1
- package/dist/tbv/core/utils/index.js +41 -40
- package/dist/tbv/core/utils/index.js.map +1 -1
- package/dist/tbv/core/vault-secrets/index.cjs +1 -1
- package/dist/tbv/core/vault-secrets/index.js +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +207 -203
- package/dist/tbv/index.js.map +1 -1
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/{toRefundInputs-Df1vi23S.js → toRefundInputs-BkcFhvDp.js} +5 -5
- package/dist/{toRefundInputs-Df1vi23S.js.map → toRefundInputs-BkcFhvDp.js.map} +1 -1
- package/dist/{toRefundInputs-CY9u84U9.cjs → toRefundInputs-CatCKniS.cjs} +2 -2
- package/dist/{toRefundInputs-CY9u84U9.cjs.map → toRefundInputs-CatCKniS.cjs.map} +1 -1
- package/dist/types-CPDLZm3l.js +430 -0
- package/dist/types-CPDLZm3l.js.map +1 -0
- package/dist/types-DSlcXtog.cjs +2 -0
- package/dist/types-DSlcXtog.cjs.map +1 -0
- package/package.json +32 -3
- package/dist/BTCVaultRegistryKeyEpochs.abi-CXjhRZbm.js +0 -111
- package/dist/BTCVaultRegistryKeyEpochs.abi-CXjhRZbm.js.map +0 -1
- package/dist/BTCVaultRegistryKeyEpochs.abi-_NERAdc5.cjs +0 -2
- package/dist/BTCVaultRegistryKeyEpochs.abi-_NERAdc5.cjs.map +0 -1
- package/dist/PeginManager-Bn8FxM35.cjs +0 -2
- package/dist/PeginManager-Bn8FxM35.cjs.map +0 -1
- package/dist/PeginManager-C3ojNTlv.js +0 -1503
- package/dist/PeginManager-C3ojNTlv.js.map +0 -1
- package/dist/ProtocolParams.abi-C0TSRaHV.js +0 -486
- package/dist/ProtocolParams.abi-C0TSRaHV.js.map +0 -1
- package/dist/ProtocolParams.abi-CYZoV2EI.cjs +0 -2
- package/dist/ProtocolParams.abi-CYZoV2EI.cjs.map +0 -1
- package/dist/buildAndBroadcastReclaim-YvWDRAN8.js.map +0 -1
- package/dist/buildAndBroadcastReclaim-zfjDI5__.cjs +0 -2
- package/dist/buildAndBroadcastReclaim-zfjDI5__.cjs.map +0 -1
- package/dist/errors-Blc-JWnI.js +0 -121
- package/dist/errors-Blc-JWnI.js.map +0 -1
- package/dist/errors-CGcNP0rV.cjs +0 -2
- package/dist/errors-CGcNP0rV.cjs.map +0 -1
- package/dist/mempoolApi-CKD_IbrM.js +0 -611
- package/dist/mempoolApi-CKD_IbrM.js.map +0 -1
- package/dist/mempoolApi-DronQ5xn.cjs +0 -2
- package/dist/mempoolApi-DronQ5xn.cjs.map +0 -1
- package/dist/onChainBtcPubkey-B5ZvWCCF.cjs +0 -2
- package/dist/onChainBtcPubkey-B5ZvWCCF.cjs.map +0 -1
- package/dist/onChainBtcPubkey-DATNfAAl.js +0 -19
- package/dist/onChainBtcPubkey-DATNfAAl.js.map +0 -1
- package/dist/primeVpAuth-Cjq6qFHq.cjs +0 -2
- package/dist/primeVpAuth-Cjq6qFHq.cjs.map +0 -1
- package/dist/primeVpAuth-tLRjdHwZ.js +0 -1159
- package/dist/primeVpAuth-tLRjdHwZ.js.map +0 -1
- package/dist/sha2-BYVxyZzX.js +0 -274
- package/dist/sha2-DsrLC4NM.cjs +0 -2
- package/dist/waitForTransactionReceiptSmartAware-DpQ69ySe.cjs +0 -2
- package/dist/waitForTransactionReceiptSmartAware-DpQ69ySe.cjs.map +0 -1
- package/dist/waitForTransactionReceiptSmartAware-z3Xfmo44.js +0 -277
- package/dist/waitForTransactionReceiptSmartAware-z3Xfmo44.js.map +0 -1
|
@@ -105,7 +105,7 @@ export interface VaultRegistryReader {
|
|
|
105
105
|
* Resolves via `getOperationBtcKeyAtEpoch` at epoch 0, so it requires an
|
|
106
106
|
* RFC-006 registry — as does every caller.
|
|
107
107
|
*/
|
|
108
|
-
getVaultProviderGenesisBtcPubKey(vpAddress: Address): Promise<OnChainBtcPubkey>;
|
|
108
|
+
getVaultProviderGenesisBtcPubKey(vpAddress: Address, blockNumber?: bigint): Promise<OnChainBtcPubkey>;
|
|
109
109
|
/** Read the protocol pegin fee (in wei) for a given vault provider. */
|
|
110
110
|
getPegInFee(vaultProvider: Address): Promise<bigint>;
|
|
111
111
|
/**
|
|
@@ -232,7 +232,12 @@ export interface ProtocolParamsReader {
|
|
|
232
232
|
getLatestOffchainParams(): Promise<VersionedOffchainParams>;
|
|
233
233
|
getLatestOffchainParamsVersion(): Promise<number>;
|
|
234
234
|
getTimelockPeginByVersion(version: number): Promise<number>;
|
|
235
|
-
|
|
235
|
+
/**
|
|
236
|
+
* Pass `blockNumber` when the result will shape a Bitcoin lock, so this
|
|
237
|
+
* multicall and the participant-key reads describe the same block. Omit it
|
|
238
|
+
* for display-only reads, where a slightly stale value is harmless.
|
|
239
|
+
*/
|
|
240
|
+
getPegInConfiguration(blockNumber?: bigint): Promise<PegInConfiguration>;
|
|
236
241
|
/**
|
|
237
242
|
* Observation window enforced between a vault's final ACK and its
|
|
238
243
|
* activation, in ETH blocks measured from `verifiedAt`. `0` disables it.
|
|
@@ -256,17 +261,33 @@ export interface AddressBTCKeyPair {
|
|
|
256
261
|
ethAddress: Address;
|
|
257
262
|
btcPubKey: Hex;
|
|
258
263
|
}
|
|
259
|
-
/**
|
|
264
|
+
/**
|
|
265
|
+
* Interface for reading vault keepers from the ApplicationRegistry contract.
|
|
266
|
+
*
|
|
267
|
+
* The reads used to build a peg-in — here and on the sibling reader interfaces
|
|
268
|
+
* — take an optional `blockNumber` that pins them to one block instead of
|
|
269
|
+
* `latest`. Omitting it, the historical behaviour, is correct for every read
|
|
270
|
+
* that resolves against a vault's already-frozen epochs, because those are
|
|
271
|
+
* immutable once stamped. It is NOT correct for a fresh peg-in build: the
|
|
272
|
+
* participant keys, roster versions and protocol params that shape the Bitcoin
|
|
273
|
+
* lock must all describe the same block, or the lock commits to a mixture of
|
|
274
|
+
* chain states that never existed at once. See
|
|
275
|
+
* `services/deposit/validateOnChainParticipantKeys`.
|
|
276
|
+
*
|
|
277
|
+
* The `getCurrent*` roster reads are the exception and take no block. Nothing
|
|
278
|
+
* on the build path uses them — it resolves rosters by version instead — so
|
|
279
|
+
* they were left alone rather than given a pin no caller would pass.
|
|
280
|
+
*/
|
|
260
281
|
export interface VaultKeeperReader {
|
|
261
|
-
getVaultKeepersByVersion(appEntryPoint: Address, version: number): Promise<AddressBTCKeyPair[]>;
|
|
282
|
+
getVaultKeepersByVersion(appEntryPoint: Address, version: number, blockNumber?: bigint): Promise<AddressBTCKeyPair[]>;
|
|
262
283
|
getCurrentVaultKeepers(appEntryPoint: Address): Promise<AddressBTCKeyPair[]>;
|
|
263
|
-
getCurrentVaultKeepersVersion(appEntryPoint: Address): Promise<number>;
|
|
284
|
+
getCurrentVaultKeepersVersion(appEntryPoint: Address, blockNumber?: bigint): Promise<number>;
|
|
264
285
|
}
|
|
265
286
|
/** Interface for reading universal challengers from the ProtocolParams contract. */
|
|
266
287
|
export interface UniversalChallengerReader {
|
|
267
|
-
getUniversalChallengersByVersion(version: number): Promise<AddressBTCKeyPair[]>;
|
|
288
|
+
getUniversalChallengersByVersion(version: number, blockNumber?: bigint): Promise<AddressBTCKeyPair[]>;
|
|
268
289
|
getCurrentUniversalChallengers(): Promise<AddressBTCKeyPair[]>;
|
|
269
|
-
getLatestUniversalChallengersVersion(): Promise<number>;
|
|
290
|
+
getLatestUniversalChallengersVersion(blockNumber?: bigint): Promise<number>;
|
|
270
291
|
}
|
|
271
292
|
/**
|
|
272
293
|
* The participants whose operation keys are being resolved, and the roster
|
|
@@ -329,7 +350,7 @@ export interface OperationKeyReader {
|
|
|
329
350
|
* each registry's `getCurrentOperationBtcKey` resolves its own genesis
|
|
330
351
|
* fallback, so an operator that never rotated yields its registration key.
|
|
331
352
|
*/
|
|
332
|
-
getCurrentOperationKeys(query: OperationKeyQuery): Promise<RawOperationKeys>;
|
|
353
|
+
getCurrentOperationKeys(query: OperationKeyQuery, blockNumber?: bigint): Promise<RawOperationKeys>;
|
|
333
354
|
/**
|
|
334
355
|
* Resolve every participant's operation key bonded at a vault's frozen
|
|
335
356
|
* epochs. Used for every existing-vault path (resume, payout, refund).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/eth/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAMzC,OAAO,CAAC,MAAM,qBAAqB,EAAE,OAAO,MAAM,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG;IACtC,QAAQ,CAAC,CAAC,qBAAqB,CAAC,EAAE,IAAI,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,oBAAY,qBAAqB;IAC/B,OAAO,IAAI;IACX,QAAQ,IAAI;IACZ,MAAM,IAAI;IACV,QAAQ,IAAI;IACZ,OAAO,IAAI;CACZ;AAED,kEAAkE;AAClE,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,GAAG,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,qBAAqB,EAAE,OAAO,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,kEAAkE;AAClE,MAAM,WAAW,iBAAiB;IAChC,sBAAsB,EAAE,GAAG,CAAC;IAC5B,2BAA2B,EAAE,MAAM,CAAC;IACpC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,GAAG,CAAC;IACzB,QAAQ,E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AG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7E;AAMD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAiB;IAChC,uBAAuB,EAAE,OAAO,CAAC;IACjC;;;;;;;;OAQG;IACH,6BAA6B,EAAE,GAAG,CAAC;IACnC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,sEAAsE;IACtE,YAAY,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC3C,0EAA0E;IAC1E,oBAAoB,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACpD;AAED,kFAAkF;AAClF,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,GAAG,CAAC;IACnB,YAAY,EAAE,GAAG,EAAE,CAAC;IACpB,oBAAoB,EAAE,GAAG,EAAE,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,GAAG,CAAC;IACnB,YAAY,EAAE,GAAG,EAAE,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,uBAAuB,CACrB,KAAK,EAAE,iBAAiB,EACxB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC7B;;;OAGG;IACH,wBAAwB,CACtB,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC7B;;;;;;;;OAQG;IACH,wBAAwB,CACtB,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC9B"}
|
|
@@ -36,7 +36,7 @@ export declare class ViemVaultRegistryReader implements VaultRegistryReader {
|
|
|
36
36
|
* Validates length, hex form, and secp256k1 curve membership before minting
|
|
37
37
|
* the brand. Returns 64-char lowercase hex without the `0x` prefix.
|
|
38
38
|
*/
|
|
39
|
-
getVaultProviderGenesisBtcPubKey(vpAddress: Address): Promise<OnChainBtcPubkey>;
|
|
39
|
+
getVaultProviderGenesisBtcPubKey(vpAddress: Address, blockNumber?: bigint): Promise<OnChainBtcPubkey>;
|
|
40
40
|
/**
|
|
41
41
|
* Read a vault provider's *current* RFC-006 operation BTC key.
|
|
42
42
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vault-registry-reader.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/eth/vault-registry-reader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAO,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAM5D,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAwIjB;;;;;;;;GAQG;AACH,qBAAa,uBAAwB,YAAW,mBAAmB;IAE/D,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,eAAe;gBADf,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,OAAO;IAGlC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,gCAAgC,CACpC,SAAS,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"vault-registry-reader.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/eth/vault-registry-reader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAO,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAM5D,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAwIjB;;;;;;;;GAQG;AACH,qBAAa,uBAAwB,YAAW,mBAAmB;IAE/D,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,eAAe;gBADf,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,OAAO;IAGlC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,gCAAgC,CACpC,SAAS,EAAE,OAAO,EAClB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,gBAAgB,CAAC;IAc5B;;;;;;;;;;OAUG;IACG,sCAAsC,CAC1C,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,gBAAgB,CAAC;IAa5B;;;;;;;;;;;;;;;OAeG;IACG,iBAAiB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC;IAWnD,sBAAsB,CAAC,QAAQ,EAAE,SAAS,GAAG,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAkBtE,iBAAiB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC;IAWxD,oBAAoB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAW9D,oBAAoB,CACxB,QAAQ,EAAE,SAAS,GAAG,EAAE,GACvB,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAiC/B;;;OAGG;IACG,WAAW,CAAC,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAS1D;;;;;;OAMG;IACG,0BAA0B,CAAC,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBnE,YAAY,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC;CAqCrD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./mempool/index.cjs"),i=require("../../../types-DSlcXtog.cjs"),s=require("../../../onChainBtcPubkey-BbxRrbvg.cjs"),r=require("../../../pegin-registration-client-6vLk2itL.cjs"),n=require("../../../vaultCoreVersion-DYfw3qed.cjs"),a=require("../../../index-Cs7_Evtk.cjs"),e=require("../../../json-rpc-client-BiAmg_ho.cjs"),o=require("../../../primeVpAuth-DBHohVKM.cjs");exports.MEMPOOL_API_URLS=t.MEMPOOL_API_URLS;exports.getAddressTxs=t.getAddressTxs;exports.getAddressUtxos=t.getAddressUtxos;exports.getMempoolApiUrl=t.getMempoolApiUrl;exports.getNetworkFees=t.getNetworkFees;exports.getOutspend=t.getOutspend;exports.getTipHeight=t.getTipHeight;exports.getTxHex=t.getTxHex;exports.getTxInfo=t.getTxInfo;exports.getUtxoInfo=t.getUtxoInfo;exports.pushTx=t.pushTx;exports.OnChainBtcVaultStatus=i.OnChainBtcVaultStatus;exports.ViemOperationKeyReader=i.ViemOperationKeyReader;exports.ViemProtocolParamsReader=i.ViemProtocolParamsReader;exports.ViemUniversalChallengerReader=i.ViemUniversalChallengerReader;exports.ViemVaultKeeperReader=i.ViemVaultKeeperReader;exports.resolveProtocolAddresses=i.resolveProtocolAddresses;exports.assertOnChainBtcPubkey=s.assertOnChainBtcPubkey;exports.ViemPeginRegistrationClient=r.ViemPeginRegistrationClient;exports.ViemVaultRegistryReader=r.ViemVaultRegistryReader;exports.calculateBtcTxHash=r.calculateBtcTxHash;exports.derivePeginVaultId=r.derivePeginVaultId;exports.validateOffchainParams=r.validateOffchainParams;exports.validatePegInConfiguration=r.validatePegInConfiguration;exports.validateTBVProtocolParams=r.validateTBVProtocolParams;exports.assertValidVaultCoreVersion=n.assertValidVaultCoreVersion;exports.VaultProviderRpcClient=a.VaultProviderRpcClient;exports.VpResponseValidationError=a.VpResponseValidationError;exports.batchPollByProvider=a.batchPollByProvider;exports.validateRequestDepositorClaimerArtifactsResponse=a.validateRequestDepositorClaimerArtifactsResponse;exports.AUTH_REJECTED_RPC_CODE=e.AUTH_REJECTED_RPC_CODE;exports.DaemonStatus=e.DaemonStatus;exports.JSON_RPC_ERROR_CODES=e.JSON_RPC_ERROR_CODES;exports.JsonRpcClient=e.JsonRpcClient;exports.JsonRpcError=e.JsonRpcError;exports.POST_WOTS_STATUSES=e.POST_WOTS_STATUSES;exports.PRE_DEPOSITOR_SIGNATURES_STATES=e.PRE_DEPOSITOR_SIGNATURES_STATES;exports.RpcErrorCode=e.RpcErrorCode;exports.VP_BATCH_MAX_SIZE=e.VP_BATCH_MAX_SIZE;exports.VP_TERMINAL_FAILURE_STATUSES=e.VP_TERMINAL_FAILURE_STATUSES;exports.VP_TRANSIENT_STATUSES=e.VP_TRANSIENT_STATUSES;exports.isAuthRejectedError=e.isAuthRejectedError;exports.ServerIdentityError=o.ServerIdentityError;exports.VpTokenRegistry=o.VpTokenRegistry;exports.createAuthenticatedVpClient=o.createAuthenticatedVpClient;exports.primeVpTokenRegistry=o.primeVpTokenRegistry;exports.verifyServerIdentity=o.verifyServerIdentity;exports.vpTokenRegistry=o.vpTokenRegistry;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,52 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { V as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
1
|
+
import { MEMPOOL_API_URLS as r, getAddressTxs as s, getAddressUtxos as t, getMempoolApiUrl as o, getNetworkFees as i, getOutspend as n, getTipHeight as R, getTxHex as l, getTxInfo as d, getUtxoInfo as p, pushTx as T } from "./mempool/index.js";
|
|
2
|
+
import { O as S, V as P, a as E, b as c, c as m, r as _ } from "../../../types-CPDLZm3l.js";
|
|
3
|
+
import { a as A } from "../../../onChainBtcPubkey-C-6UWpD8.js";
|
|
4
|
+
import { V as f, c as u, f as v, d as x, v as O, a as I, b as U } from "../../../pegin-registration-client-BdRiR8br.js";
|
|
5
|
+
import { a as y } from "../../../vaultCoreVersion-D_fP9P3C.js";
|
|
6
|
+
import { V as b, a as B, b as N, v as k } from "../../../index-LgmJhdEN.js";
|
|
7
|
+
import { A as J, D as M, J as L, a as F, b as K, d as j, P as q, R as w, e as G, c as W, V as X, i as Z } from "../../../json-rpc-client-DuUARJvV.js";
|
|
8
|
+
import { S as Q, V as Y, c as $, p as ee, v as ae, a as re } from "../../../primeVpAuth-DvaD45q_.js";
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
10
|
+
J as AUTH_REJECTED_RPC_CODE,
|
|
11
|
+
M as DaemonStatus,
|
|
12
|
+
L as JSON_RPC_ERROR_CODES,
|
|
13
|
+
F as JsonRpcClient,
|
|
14
|
+
K as JsonRpcError,
|
|
15
|
+
r as MEMPOOL_API_URLS,
|
|
16
|
+
S as OnChainBtcVaultStatus,
|
|
17
|
+
j as POST_WOTS_STATUSES,
|
|
18
|
+
q as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
19
|
+
w as RpcErrorCode,
|
|
20
|
+
Q as ServerIdentityError,
|
|
21
|
+
G as VP_BATCH_MAX_SIZE,
|
|
22
|
+
W as VP_TERMINAL_FAILURE_STATUSES,
|
|
23
|
+
X as VP_TRANSIENT_STATUSES,
|
|
24
|
+
b as VaultProviderRpcClient,
|
|
25
|
+
P as ViemOperationKeyReader,
|
|
26
|
+
f as ViemPeginRegistrationClient,
|
|
27
|
+
E as ViemProtocolParamsReader,
|
|
28
|
+
c as ViemUniversalChallengerReader,
|
|
29
|
+
m as ViemVaultKeeperReader,
|
|
30
|
+
u as ViemVaultRegistryReader,
|
|
31
|
+
B as VpResponseValidationError,
|
|
32
|
+
Y as VpTokenRegistry,
|
|
33
|
+
A as assertOnChainBtcPubkey,
|
|
34
|
+
y as assertValidVaultCoreVersion,
|
|
35
|
+
N as batchPollByProvider,
|
|
36
|
+
v as calculateBtcTxHash,
|
|
37
|
+
$ as createAuthenticatedVpClient,
|
|
38
|
+
x as derivePeginVaultId,
|
|
39
|
+
s as getAddressTxs,
|
|
40
|
+
t as getAddressUtxos,
|
|
41
|
+
o as getMempoolApiUrl,
|
|
42
|
+
i as getNetworkFees,
|
|
36
43
|
n as getOutspend,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
R as getTipHeight,
|
|
45
|
+
l as getTxHex,
|
|
46
|
+
d as getTxInfo,
|
|
47
|
+
p as getUtxoInfo,
|
|
48
|
+
Z as isAuthRejectedError,
|
|
49
|
+
ee as primeVpTokenRegistry,
|
|
50
|
+
T as pushTx,
|
|
51
|
+
_ as resolveProtocolAddresses,
|
|
52
|
+
O as validateOffchainParams,
|
|
53
|
+
I as validatePegInConfiguration,
|
|
54
|
+
k as validateRequestDepositorClaimerArtifactsResponse,
|
|
55
|
+
U as validateTBVProtocolParams,
|
|
56
|
+
ae as verifyServerIdentity,
|
|
57
|
+
re as vpTokenRegistry
|
|
51
58
|
};
|
|
52
59
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../../../../abortSignals-msbmbqFe.cjs"),f=require("../../../../validation-C6XTfZak.cjs"),I=21e6*1e8,w=3e4;async function u(e,r){const t=new AbortController,o=setTimeout(()=>t.abort(),w),s=[t.signal,r==null?void 0:r.signal].filter(Boolean),n=E.combineAbortSignals(s);try{return await fetch(e,{...r,signal:n.signal})}catch(a){throw clearTimeout(o),n.cleanup(),a!=null&&typeof a=="object"&&"name"in a&&a.name==="AbortError"?new Error(`Mempool API request timed out after ${w}ms: ${e}`):a}}const m=1e4;function h(e){return Number.isInteger(e)&&e>0&&e<=I}function T(e){return Number.isInteger(e)&&e>0&&e<=m}function l(e,r){return!Number.isInteger(e)||e<0?!1:r===void 0||e<r}function c(e){if(!f.TXID_RE.test(e))throw new Error(`Invalid transaction ID format: ${e}`)}function d(e){if(!f.BITCOIN_ADDRESS_RE.test(e))throw new Error(`Invalid Bitcoin address format: ${e}`)}function $(e,r){if(!f.HEX_RE.test(e))throw new Error(`Invalid scriptPubKey: not valid hex for ${r}`);if(!f.KNOWN_SCRIPT_PREFIXES.some(o=>e.toLowerCase().startsWith(o)))throw new Error(`Unrecognized scriptPubKey type for ${r}: prefix ${e.slice(0,6)} does not match any known Bitcoin script type`)}const p={mainnet:"https://mempool.space/api",testnet:"https://mempool.space/testnet/api",signet:"https://mempool.space/signet/api"};async function i(e,r){try{const t=await u(e,r);if(!t.ok){const s=await t.text();throw new Error(`Mempool API error (${t.status}): ${s||t.statusText}`)}const o=t.headers.get("content-type");return o!=null&&o.includes("application/json")?await t.json():await t.text()}catch(t){throw t instanceof Error?new Error(`Failed to fetch from mempool API: ${t.message}`):new Error("Failed to fetch from mempool API: Unknown error")}}async function F(e,r){try{const t=await u(`${r}/tx`,{method:"POST",body:e,headers:{"Content-Type":"text/plain"}});if(!t.ok){const s=await t.text();let n;try{const a=JSON.parse(s);n=a.message??a.error}catch{n=s}throw new Error(n||`Failed to broadcast transaction: ${t.statusText}`)}return await t.text()}catch(t){throw t instanceof Error?new Error(`Failed to broadcast BTC transaction: ${t.message}`):new Error("Failed to broadcast BTC transaction: Unknown error")}}async function g(e,r){return c(e),i(`${r}/tx/${e}`)}async function y(e){const r=await i(`${e}/blocks/tip/height`),t=r.trim(),o=/^\d+$/.test(t)?Number.parseInt(t,10):NaN;if(!Number.isSafeInteger(o)||o<0)throw new Error(`Mempool API returned an invalid block tip height: "${r}"`);return o}async function x(e,r,t){if(c(e),!l(r))throw new Error(`Invalid vout ${r} for transaction ${e}`);return i(`${t}/tx/${e}/outspend/${r}`)}async function v(e,r){c(e);try{const t=await u(`${r}/tx/${e}/hex`);if(!t.ok){const o=await t.text();throw new Error(`Mempool API error (${t.status}): ${o||t.statusText}`)}return await t.text()}catch(t){throw t instanceof Error?new Error(`Failed to get transaction hex for ${e}: ${t.message}`):new Error(`Failed to get transaction hex for ${e}: Unknown error`)}}async function b(e,r,t){c(e);const o=await g(e,t);if(!l(r,o.vout.length))throw new Error(`Invalid vout ${r} for transaction ${e} (has ${o.vout.length} outputs)`);const s=o.vout[r];if(!h(s.value))throw new Error(`Invalid UTXO value ${s.value} for ${e}:${r}`);return $(s.scriptpubkey,`${e}:${r}`),{txid:e,vout:r,value:s.value,scriptPubKey:s.scriptpubkey}}async function A(e,r){d(e);try{const t=await i(`${r}/address/${e}/utxo`),o=await i(`${r}/v1/validate-address/${e}`);if(!o.isvalid)throw new Error(`Invalid Bitcoin address: ${e}. Mempool API validation failed.`);$(o.scriptPubKey,e);for(const n of t){if(c(n.txid),!l(n.vout))throw new Error(`Invalid vout ${n.vout} for ${n.txid}`);if(!h(n.value))throw new Error(`Invalid UTXO value ${n.value} for ${n.txid}:${n.vout}`)}return t.sort((n,a)=>a.value-n.value).map(n=>({txid:n.txid,vout:n.vout,value:n.value,scriptPubKey:o.scriptPubKey,confirmed:n.status.confirmed}))}catch(t){throw t instanceof Error?new Error(`Failed to get UTXOs for address ${e}: ${t.message}`):new Error(`Failed to get UTXOs for address ${e}: Unknown error`)}}function P(e){return p[e]}async function O(e,r){return d(e),i(`${r}/address/${e}/txs`)}async function S(e){const r=await u(`${e}/v1/fees/recommended`);if(!r.ok)throw new Error(`Failed to fetch network fees: ${r.status} ${r.statusText}`);const t=await r.json(),o=["fastestFee","halfHourFee","hourFee","economyFee","minimumFee"];for(const s of o)if(!T(t[s]))throw new Error(`Invalid fee rate ${s}=${t[s]} from mempool API: expected a positive number ≤ ${m}`);if(t.minimumFee>t.economyFee||t.economyFee>t.hourFee||t.hourFee>t.halfHourFee||t.halfHourFee>t.fastestFee)throw new Error(`Fee rate ordering violation from mempool API: expected minimumFee (${t.minimumFee}) <= economyFee (${t.economyFee}) <= hourFee (${t.hourFee}) <= halfHourFee (${t.halfHourFee}) <= fastestFee (${t.fastestFee}).`);return t}exports.MEMPOOL_API_URLS=p;exports.getAddressTxs=O;exports.getAddressUtxos=A;exports.getMempoolApiUrl=P;exports.getNetworkFees=S;exports.getOutspend=x;exports.getTipHeight=y;exports.getTxHex=v;exports.getTxInfo=g;exports.getUtxoInfo=b;exports.pushTx=F;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../../src/tbv/core/clients/mempool/mempoolApi.ts"],"sourcesContent":["/**\n * Mempool API Client\n *\n * Client for interacting with mempool.space API for Bitcoin network operations.\n * Used for broadcasting transactions and fetching UTXO data.\n *\n * @module clients/mempool/mempoolApi\n */\n\nimport { combineAbortSignals } from \"../../utils/abortSignals\";\nimport {\n BITCOIN_ADDRESS_RE,\n HEX_RE,\n KNOWN_SCRIPT_PREFIXES,\n TXID_RE,\n} from \"../../utils/validation\";\n\nimport type {\n MempoolUTXO,\n NetworkFees,\n OutspendStatus,\n TxInfo,\n UtxoInfo,\n} from \"./types\";\n\n/** Maximum valid satoshi value: 21 million BTC × 10^8 sats/BTC */\nconst MAX_SATOSHIS = 21_000_000 * 1e8;\n\n/** Timeout for mempool API requests — prevents indefinite hangs from stalled endpoints */\nconst MEMPOOL_REQUEST_TIMEOUT_MS = 30_000;\n\n/**\n * Fetch wrapper with AbortController-based timeout.\n * Ensures all mempool API requests fail bounded rather than hanging indefinitely.\n */\nasync function fetchWithTimeout(\n url: string,\n options?: RequestInit,\n): Promise<Response> {\n const controller = new AbortController();\n const timeoutId = setTimeout(\n () => controller.abort(),\n MEMPOOL_REQUEST_TIMEOUT_MS,\n );\n\n // Compose timeout signal with any caller-supplied signal so both can cancel\n const signals = [controller.signal, options?.signal].filter(\n Boolean,\n ) as AbortSignal[];\n const combined = combineAbortSignals(signals);\n\n try {\n // Don't clear timeout here — let it cover body consumption by callers.\n // For the same reason the composed signal keeps its listeners attached on\n // the success path: detaching them would stop the timeout from aborting a\n // stalled body read.\n return await fetch(url, {\n ...options,\n signal: combined.signal,\n });\n } catch (error) {\n clearTimeout(timeoutId);\n combined.cleanup();\n if (\n error != null &&\n typeof error === \"object\" &&\n \"name\" in error &&\n error.name === \"AbortError\"\n ) {\n throw new Error(\n `Mempool API request timed out after ${MEMPOOL_REQUEST_TIMEOUT_MS}ms: ${url}`,\n );\n }\n throw error;\n }\n}\n\n/**\n * Maximum sane fee rate in sat/vByte.\n * The April 2024 Runes spike peaked around 1,805 sat/vB — 10,000 provides ample headroom.\n */\nconst MAX_FEE_RATE = 10_000;\n\nfunction isValidSatoshiValue(value: number): boolean {\n return Number.isInteger(value) && value > 0 && value <= MAX_SATOSHIS;\n}\n\nfunction isValidFeeRate(value: number): boolean {\n return Number.isInteger(value) && value > 0 && value <= MAX_FEE_RATE;\n}\n\nfunction isValidVout(vout: number, outputCount?: number): boolean {\n if (!Number.isInteger(vout) || vout < 0) return false;\n return outputCount === undefined || vout < outputCount;\n}\n\n\nfunction assertValidTxid(txid: string): void {\n if (!TXID_RE.test(txid)) {\n throw new Error(`Invalid transaction ID format: ${txid}`);\n }\n}\n\nfunction assertValidAddress(address: string): void {\n if (!BITCOIN_ADDRESS_RE.test(address)) {\n throw new Error(`Invalid Bitcoin address format: ${address}`);\n }\n}\n\nfunction assertValidScriptPubKey(scriptPubKey: string, context: string): void {\n if (!HEX_RE.test(scriptPubKey)) {\n throw new Error(\n `Invalid scriptPubKey: not valid hex for ${context}`,\n );\n }\n const matchesKnownType = KNOWN_SCRIPT_PREFIXES.some((prefix) =>\n scriptPubKey.toLowerCase().startsWith(prefix),\n );\n if (!matchesKnownType) {\n throw new Error(\n `Unrecognized scriptPubKey type for ${context}: ` +\n `prefix ${scriptPubKey.slice(0, 6)} does not match any known Bitcoin script type`,\n );\n }\n}\n\n/**\n * Default mempool API URLs by network.\n */\nexport const MEMPOOL_API_URLS = {\n mainnet: \"https://mempool.space/api\",\n testnet: \"https://mempool.space/testnet/api\",\n signet: \"https://mempool.space/signet/api\",\n} as const;\n\n/**\n * Fetch wrapper with error handling.\n */\nasync function fetchApi<T>(\n url: string,\n options?: RequestInit,\n): Promise<T> {\n try {\n const response = await fetchWithTimeout(url, options);\n\n if (!response.ok) {\n const errorText = await response.text();\n throw new Error(\n `Mempool API error (${response.status}): ${errorText || response.statusText}`,\n );\n }\n\n const contentType = response.headers.get(\"content-type\");\n if (contentType?.includes(\"application/json\")) {\n return (await response.json()) as T;\n } else {\n return (await response.text()) as T;\n }\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Failed to fetch from mempool API: ${error.message}`);\n }\n throw new Error(\"Failed to fetch from mempool API: Unknown error\");\n }\n}\n\n/**\n * Push a signed transaction to the Bitcoin network.\n *\n * @param txHex - The signed transaction hex string\n * @param apiUrl - Mempool API base URL\n * @returns The transaction ID\n * @throws Error if broadcasting fails\n */\nexport async function pushTx(txHex: string, apiUrl: string): Promise<string> {\n try {\n const response = await fetchWithTimeout(`${apiUrl}/tx`, {\n method: \"POST\",\n body: txHex,\n headers: {\n \"Content-Type\": \"text/plain\",\n },\n });\n\n if (!response.ok) {\n const errorText = await response.text();\n // Try to extract error message from response using robust JSON parsing\n let message: string | undefined;\n try {\n const errorJson = JSON.parse(errorText);\n message = errorJson.message ?? errorJson.error;\n } catch {\n // Not JSON, use raw text\n message = errorText;\n }\n throw new Error(\n message || `Failed to broadcast transaction: ${response.statusText}`,\n );\n }\n\n // Response is the transaction ID (plain text)\n const txId = await response.text();\n return txId;\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Failed to broadcast BTC transaction: ${error.message}`);\n }\n throw new Error(\"Failed to broadcast BTC transaction: Unknown error\");\n }\n}\n\n/**\n * Get transaction information from mempool.\n *\n * @param txid - The transaction ID\n * @param apiUrl - Mempool API base URL\n * @returns Transaction information\n */\nexport async function getTxInfo(txid: string, apiUrl: string): Promise<TxInfo> {\n assertValidTxid(txid);\n return fetchApi<TxInfo>(`${apiUrl}/tx/${txid}`);\n}\n\n/**\n * Get the current block tip height.\n *\n * Source: mempool.space API — `GET /api/blocks/tip/height` returns the height\n * of the most recent block as a plain-text integer.\n *\n * The digit check alone is not enough to honour the contract below. A long\n * enough run of digits passes `/^\\d+$/` and then parses to a value no caller\n * can use: 400 digits yields `Infinity`, and 20 digits yields a finite but\n * unsafe integer. Callers subtract this from a confirmed block height to get a\n * confirmation depth, so either one produces an enormous depth and clears any\n * threshold it is compared against. Bound it to a safe integer here rather\n * than leaving each caller to discover the gap.\n *\n * @param apiUrl - Mempool API base URL\n * @returns The height of the most recent block\n * @throws Error if the response is not a whole number a caller can compute on\n */\nexport async function getTipHeight(apiUrl: string): Promise<number> {\n const raw = await fetchApi<string>(`${apiUrl}/blocks/tip/height`);\n const trimmed = raw.trim();\n const height = /^\\d+$/.test(trimmed) ? Number.parseInt(trimmed, 10) : NaN;\n if (!Number.isSafeInteger(height) || height < 0) {\n throw new Error(\n `Mempool API returned an invalid block tip height: \"${raw}\"`,\n );\n }\n return height;\n}\n\n/**\n * Get the spend status of a specific transaction output.\n *\n * Calls the esplora-compatible `GET /tx/{txid}/outspend/{vout}` endpoint\n * (mempool.space backend, mempool/electrs `rest.rs`). Returns\n * `{ spent: false }` for an unspent output, or\n * `{ spent: true, txid, vin, status }` when the output has been spent.\n *\n * @param txid - The transaction id whose output is being checked (no 0x prefix)\n * @param vout - The output index\n * @param apiUrl - Mempool API base URL\n * @returns The output's spend status\n */\nexport async function getOutspend(\n txid: string,\n vout: number,\n apiUrl: string,\n): Promise<OutspendStatus> {\n assertValidTxid(txid);\n if (!isValidVout(vout)) {\n throw new Error(`Invalid vout ${vout} for transaction ${txid}`);\n }\n return fetchApi<OutspendStatus>(`${apiUrl}/tx/${txid}/outspend/${vout}`);\n}\n\n/**\n * Get the hex representation of a transaction.\n *\n * @param txid - The transaction ID\n * @param apiUrl - Mempool API base URL\n * @returns The transaction hex string\n * @throws Error if the request fails or transaction is not found\n */\nexport async function getTxHex(txid: string, apiUrl: string): Promise<string> {\n assertValidTxid(txid);\n try {\n const response = await fetchWithTimeout(`${apiUrl}/tx/${txid}/hex`);\n\n if (!response.ok) {\n const errorText = await response.text();\n throw new Error(\n `Mempool API error (${response.status}): ${errorText || response.statusText}`,\n );\n }\n\n return await response.text();\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Failed to get transaction hex for ${txid}: ${error.message}`);\n }\n throw new Error(`Failed to get transaction hex for ${txid}: Unknown error`);\n }\n}\n\n/**\n * Get UTXO information for a specific transaction output.\n *\n * This is used for constructing PSBTs where we need the witnessUtxo data.\n * Only supports Taproot (P2TR) and native SegWit (P2WPKH, P2WSH) script types.\n *\n * @param txid - The transaction ID containing the UTXO\n * @param vout - The output index\n * @param apiUrl - Mempool API base URL\n * @returns UTXO information with value and scriptPubKey\n */\nexport async function getUtxoInfo(\n txid: string,\n vout: number,\n apiUrl: string,\n): Promise<UtxoInfo> {\n assertValidTxid(txid);\n const txInfo = await getTxInfo(txid, apiUrl);\n\n if (!isValidVout(vout, txInfo.vout.length)) {\n throw new Error(\n `Invalid vout ${vout} for transaction ${txid} (has ${txInfo.vout.length} outputs)`,\n );\n }\n\n const output = txInfo.vout[vout];\n if (!isValidSatoshiValue(output.value)) {\n throw new Error(`Invalid UTXO value ${output.value} for ${txid}:${vout}`);\n }\n assertValidScriptPubKey(output.scriptpubkey, `${txid}:${vout}`);\n\n return {\n txid,\n vout,\n value: output.value,\n scriptPubKey: output.scriptpubkey,\n };\n}\n\n/**\n * Get all UTXOs for a Bitcoin address.\n *\n * @param address - The Bitcoin address\n * @param apiUrl - Mempool API base URL\n * @returns Array of UTXOs sorted by value (largest first)\n */\nexport async function getAddressUtxos(\n address: string,\n apiUrl: string,\n): Promise<MempoolUTXO[]> {\n assertValidAddress(address);\n try {\n // Fetch UTXOs for the address\n const utxos = await fetchApi<\n {\n txid: string;\n vout: number;\n value: number;\n status: {\n confirmed: boolean;\n };\n }[]\n >(`${apiUrl}/address/${address}/utxo`);\n\n // Fetch scriptPubKey for the address\n const addressInfo = await fetchApi<{\n isvalid: boolean;\n scriptPubKey: string;\n }>(`${apiUrl}/v1/validate-address/${address}`);\n\n if (!addressInfo.isvalid) {\n throw new Error(\n `Invalid Bitcoin address: ${address}. Mempool API validation failed.`,\n );\n }\n assertValidScriptPubKey(addressInfo.scriptPubKey, address);\n\n // Validate UTXO fields from the listing endpoint.\n // Per-UTXO cross-verification against /tx/{txid} is intentionally NOT done\n // here — it would be expensive (N API calls) and redundant: the broadcast\n // path already verifies each selected input via getUtxoInfo before signing.\n // Both endpoints come from the same mempool API, so cross-checking one\n // against the other on the same server does not add real security.\n for (const utxo of utxos) {\n assertValidTxid(utxo.txid);\n if (!isValidVout(utxo.vout)) {\n throw new Error(`Invalid vout ${utxo.vout} for ${utxo.txid}`);\n }\n if (!isValidSatoshiValue(utxo.value)) {\n throw new Error(\n `Invalid UTXO value ${utxo.value} for ${utxo.txid}:${utxo.vout}`,\n );\n }\n }\n\n // Sort by value (largest first) and map to our UTXO format\n const sortedUTXOs = utxos.sort((a, b) => b.value - a.value);\n\n return sortedUTXOs.map((utxo) => ({\n txid: utxo.txid,\n vout: utxo.vout,\n value: utxo.value,\n scriptPubKey: addressInfo.scriptPubKey,\n confirmed: utxo.status.confirmed,\n }));\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(\n `Failed to get UTXOs for address ${address}: ${error.message}`,\n );\n }\n throw new Error(\n `Failed to get UTXOs for address ${address}: Unknown error`,\n );\n }\n}\n\n/**\n * Get the mempool API URL for a given network.\n *\n * @param network - Bitcoin network (mainnet, testnet, signet)\n * @returns The mempool API URL\n */\nexport function getMempoolApiUrl(\n network: \"mainnet\" | \"testnet\" | \"signet\",\n): string {\n return MEMPOOL_API_URLS[network];\n}\n\n/**\n * Transaction summary from address transactions endpoint.\n */\nexport interface AddressTx {\n txid: string;\n status: {\n confirmed: boolean;\n block_height?: number;\n };\n}\n\n/**\n * Get recent transactions for a Bitcoin address.\n *\n * Returns the last 25 confirmed transactions plus any unconfirmed (mempool) transactions.\n * This is useful for checking if a specific transaction has been broadcast.\n *\n * @param address - The Bitcoin address\n * @param apiUrl - Mempool API base URL\n * @returns Array of recent transactions\n */\nexport async function getAddressTxs(\n address: string,\n apiUrl: string,\n): Promise<AddressTx[]> {\n assertValidAddress(address);\n return fetchApi<AddressTx[]>(`${apiUrl}/address/${address}/txs`);\n}\n\n/**\n * Fetches Bitcoin network fee recommendations from mempool.space API.\n *\n * @param apiUrl - Mempool API base URL\n * @returns Fee rates in sat/vbyte for different confirmation times\n * @throws Error if request fails or returns invalid data\n *\n * @see https://mempool.space/docs/api/rest#get-recommended-fees\n */\nexport async function getNetworkFees(apiUrl: string): Promise<NetworkFees> {\n const response = await fetchWithTimeout(`${apiUrl}/v1/fees/recommended`);\n\n if (!response.ok) {\n throw new Error(\n `Failed to fetch network fees: ${response.status} ${response.statusText}`,\n );\n }\n\n const data = await response.json();\n\n const feeFields = [\n \"fastestFee\",\n \"halfHourFee\",\n \"hourFee\",\n \"economyFee\",\n \"minimumFee\",\n ] as const;\n\n for (const field of feeFields) {\n if (!isValidFeeRate(data[field])) {\n throw new Error(\n `Invalid fee rate ${field}=${data[field]} from mempool API: expected a positive number ≤ ${MAX_FEE_RATE}`,\n );\n }\n }\n\n if (\n data.minimumFee > data.economyFee ||\n data.economyFee > data.hourFee ||\n data.hourFee > data.halfHourFee ||\n data.halfHourFee > data.fastestFee\n ) {\n throw new Error(\n `Fee rate ordering violation from mempool API: expected ` +\n `minimumFee (${data.minimumFee}) <= economyFee (${data.economyFee}) <= ` +\n `hourFee (${data.hourFee}) <= halfHourFee (${data.halfHourFee}) <= ` +\n `fastestFee (${data.fastestFee}).`,\n );\n }\n\n return data as NetworkFees;\n}\n\n"],"names":["MAX_SATOSHIS","MEMPOOL_REQUEST_TIMEOUT_MS","fetchWithTimeout","url","options","controller","timeoutId","signals","combined","combineAbortSignals","error","MAX_FEE_RATE","isValidSatoshiValue","value","isValidFeeRate","isValidVout","vout","outputCount","assertValidTxid","txid","TXID_RE","assertValidAddress","address","BITCOIN_ADDRESS_RE","assertValidScriptPubKey","scriptPubKey","context","HEX_RE","KNOWN_SCRIPT_PREFIXES","prefix","MEMPOOL_API_URLS","fetchApi","response","errorText","contentType","pushTx","txHex","apiUrl","message","errorJson","getTxInfo","getTipHeight","raw","trimmed","height","getOutspend","getTxHex","getUtxoInfo","txInfo","output","getAddressUtxos","utxos","addressInfo","utxo","a","b","getMempoolApiUrl","network","getAddressTxs","getNetworkFees","data","feeFields","field"],"mappings":"0LA0BMA,EAAe,KAAa,IAG5BC,EAA6B,IAMnC,eAAeC,EACbC,EACAC,EACmB,CACnB,MAAMC,EAAa,IAAI,gBACjBC,EAAY,WAChB,IAAMD,EAAW,MAAA,EACjBJ,CAAA,EAIIM,EAAU,CAACF,EAAW,OAAQD,GAAA,YAAAA,EAAS,MAAM,EAAE,OACnD,OAAA,EAEII,EAAWC,EAAAA,oBAAoBF,CAAO,EAE5C,GAAI,CAKF,OAAO,MAAM,MAAMJ,EAAK,CACtB,GAAGC,EACH,OAAQI,EAAS,MAAA,CAClB,CACH,OAASE,EAAO,CAGd,MAFA,aAAaJ,CAAS,EACtBE,EAAS,QAAA,EAEPE,GAAS,MACT,OAAOA,GAAU,UACjB,SAAUA,GACVA,EAAM,OAAS,aAET,IAAI,MACR,uCAAuCT,CAA0B,OAAOE,CAAG,EAAA,EAGzEO,CACR,CACF,CAMA,MAAMC,EAAe,IAErB,SAASC,EAAoBC,EAAwB,CACnD,OAAO,OAAO,UAAUA,CAAK,GAAKA,EAAQ,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EAAS,GACZ,MAAM,IAAI,MACR,iCAAiCA,EAAS,MAAM,IAAIA,EAAS,UAAU,EAAA,EAI3E,MAAM4B,EAAO,MAAM5B,EAAS,KAAA,EAEtB6B,EAAY,CAChB,aACA,cACA,UACA,aACA,YAAA,EAGF,UAAWC,KAASD,EAClB,GAAI,CAAC/C,EAAe8C,EAAKE,CAAK,CAAC,EAC7B,MAAM,IAAI,MACR,oBAAoBA,CAAK,IAAIF,EAAKE,CAAK,CAAC,mDAAmDnD,CAAY,EAAA,EAK7G,GACEiD,EAAK,WAAaA,EAAK,YACvBA,EAAK,WAAaA,EAAK,SACvBA,EAAK,QAAUA,EAAK,aACpBA,EAAK,YAAcA,EAAK,WAExB,MAAM,IAAI,MACR,sEACiBA,EAAK,UAAU,oBAAoBA,EAAK,UAAU,iBACrDA,EAAK,OAAO,qBAAqBA,EAAK,WAAW,oBAC9CA,EAAK,UAAU,IAAA,EAIpC,OAAOA,CACT"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { c as $ } from "../../../../abortSignals-BPpAUL1Z.js";
|
|
2
|
+
import { B as p, H as E, K as g, T as I } from "../../../../validation-OSC0xTHB.js";
|
|
3
|
+
const F = 21e6 * 1e8, l = 3e4;
|
|
4
|
+
async function f(e, r) {
|
|
5
|
+
const t = new AbortController(), o = setTimeout(
|
|
6
|
+
() => t.abort(),
|
|
7
|
+
l
|
|
8
|
+
), a = [t.signal, r == null ? void 0 : r.signal].filter(
|
|
9
|
+
Boolean
|
|
10
|
+
), n = $(a);
|
|
11
|
+
try {
|
|
12
|
+
return await fetch(e, {
|
|
13
|
+
...r,
|
|
14
|
+
signal: n.signal
|
|
15
|
+
});
|
|
16
|
+
} catch (s) {
|
|
17
|
+
throw clearTimeout(o), n.cleanup(), s != null && typeof s == "object" && "name" in s && s.name === "AbortError" ? new Error(
|
|
18
|
+
`Mempool API request timed out after ${l}ms: ${e}`
|
|
19
|
+
) : s;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const m = 1e4;
|
|
23
|
+
function w(e) {
|
|
24
|
+
return Number.isInteger(e) && e > 0 && e <= F;
|
|
25
|
+
}
|
|
26
|
+
function y(e) {
|
|
27
|
+
return Number.isInteger(e) && e > 0 && e <= m;
|
|
28
|
+
}
|
|
29
|
+
function u(e, r) {
|
|
30
|
+
return !Number.isInteger(e) || e < 0 ? !1 : r === void 0 || e < r;
|
|
31
|
+
}
|
|
32
|
+
function c(e) {
|
|
33
|
+
if (!I.test(e))
|
|
34
|
+
throw new Error(`Invalid transaction ID format: ${e}`);
|
|
35
|
+
}
|
|
36
|
+
function h(e) {
|
|
37
|
+
if (!p.test(e))
|
|
38
|
+
throw new Error(`Invalid Bitcoin address format: ${e}`);
|
|
39
|
+
}
|
|
40
|
+
function d(e, r) {
|
|
41
|
+
if (!E.test(e))
|
|
42
|
+
throw new Error(
|
|
43
|
+
`Invalid scriptPubKey: not valid hex for ${r}`
|
|
44
|
+
);
|
|
45
|
+
if (!g.some(
|
|
46
|
+
(o) => e.toLowerCase().startsWith(o)
|
|
47
|
+
))
|
|
48
|
+
throw new Error(
|
|
49
|
+
`Unrecognized scriptPubKey type for ${r}: prefix ${e.slice(0, 6)} does not match any known Bitcoin script type`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
const T = {
|
|
53
|
+
mainnet: "https://mempool.space/api",
|
|
54
|
+
testnet: "https://mempool.space/testnet/api",
|
|
55
|
+
signet: "https://mempool.space/signet/api"
|
|
56
|
+
};
|
|
57
|
+
async function i(e, r) {
|
|
58
|
+
try {
|
|
59
|
+
const t = await f(e, r);
|
|
60
|
+
if (!t.ok) {
|
|
61
|
+
const a = await t.text();
|
|
62
|
+
throw new Error(
|
|
63
|
+
`Mempool API error (${t.status}): ${a || t.statusText}`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
const o = t.headers.get("content-type");
|
|
67
|
+
return o != null && o.includes("application/json") ? await t.json() : await t.text();
|
|
68
|
+
} catch (t) {
|
|
69
|
+
throw t instanceof Error ? new Error(`Failed to fetch from mempool API: ${t.message}`) : new Error("Failed to fetch from mempool API: Unknown error");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async function A(e, r) {
|
|
73
|
+
try {
|
|
74
|
+
const t = await f(`${r}/tx`, {
|
|
75
|
+
method: "POST",
|
|
76
|
+
body: e,
|
|
77
|
+
headers: {
|
|
78
|
+
"Content-Type": "text/plain"
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
if (!t.ok) {
|
|
82
|
+
const a = await t.text();
|
|
83
|
+
let n;
|
|
84
|
+
try {
|
|
85
|
+
const s = JSON.parse(a);
|
|
86
|
+
n = s.message ?? s.error;
|
|
87
|
+
} catch {
|
|
88
|
+
n = a;
|
|
89
|
+
}
|
|
90
|
+
throw new Error(
|
|
91
|
+
n || `Failed to broadcast transaction: ${t.statusText}`
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
return await t.text();
|
|
95
|
+
} catch (t) {
|
|
96
|
+
throw t instanceof Error ? new Error(`Failed to broadcast BTC transaction: ${t.message}`) : new Error("Failed to broadcast BTC transaction: Unknown error");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async function v(e, r) {
|
|
100
|
+
return c(e), i(`${r}/tx/${e}`);
|
|
101
|
+
}
|
|
102
|
+
async function P(e) {
|
|
103
|
+
const r = await i(`${e}/blocks/tip/height`), t = r.trim(), o = /^\d+$/.test(t) ? Number.parseInt(t, 10) : NaN;
|
|
104
|
+
if (!Number.isSafeInteger(o) || o < 0)
|
|
105
|
+
throw new Error(
|
|
106
|
+
`Mempool API returned an invalid block tip height: "${r}"`
|
|
107
|
+
);
|
|
108
|
+
return o;
|
|
109
|
+
}
|
|
110
|
+
async function O(e, r, t) {
|
|
111
|
+
if (c(e), !u(r))
|
|
112
|
+
throw new Error(`Invalid vout ${r} for transaction ${e}`);
|
|
113
|
+
return i(`${t}/tx/${e}/outspend/${r}`);
|
|
114
|
+
}
|
|
115
|
+
async function S(e, r) {
|
|
116
|
+
c(e);
|
|
117
|
+
try {
|
|
118
|
+
const t = await f(`${r}/tx/${e}/hex`);
|
|
119
|
+
if (!t.ok) {
|
|
120
|
+
const o = await t.text();
|
|
121
|
+
throw new Error(
|
|
122
|
+
`Mempool API error (${t.status}): ${o || t.statusText}`
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
return await t.text();
|
|
126
|
+
} catch (t) {
|
|
127
|
+
throw t instanceof Error ? new Error(`Failed to get transaction hex for ${e}: ${t.message}`) : new Error(`Failed to get transaction hex for ${e}: Unknown error`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
async function U(e, r, t) {
|
|
131
|
+
c(e);
|
|
132
|
+
const o = await v(e, t);
|
|
133
|
+
if (!u(r, o.vout.length))
|
|
134
|
+
throw new Error(
|
|
135
|
+
`Invalid vout ${r} for transaction ${e} (has ${o.vout.length} outputs)`
|
|
136
|
+
);
|
|
137
|
+
const a = o.vout[r];
|
|
138
|
+
if (!w(a.value))
|
|
139
|
+
throw new Error(`Invalid UTXO value ${a.value} for ${e}:${r}`);
|
|
140
|
+
return d(a.scriptpubkey, `${e}:${r}`), {
|
|
141
|
+
txid: e,
|
|
142
|
+
vout: r,
|
|
143
|
+
value: a.value,
|
|
144
|
+
scriptPubKey: a.scriptpubkey
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
async function k(e, r) {
|
|
148
|
+
h(e);
|
|
149
|
+
try {
|
|
150
|
+
const t = await i(`${r}/address/${e}/utxo`), o = await i(`${r}/v1/validate-address/${e}`);
|
|
151
|
+
if (!o.isvalid)
|
|
152
|
+
throw new Error(
|
|
153
|
+
`Invalid Bitcoin address: ${e}. Mempool API validation failed.`
|
|
154
|
+
);
|
|
155
|
+
d(o.scriptPubKey, e);
|
|
156
|
+
for (const n of t) {
|
|
157
|
+
if (c(n.txid), !u(n.vout))
|
|
158
|
+
throw new Error(`Invalid vout ${n.vout} for ${n.txid}`);
|
|
159
|
+
if (!w(n.value))
|
|
160
|
+
throw new Error(
|
|
161
|
+
`Invalid UTXO value ${n.value} for ${n.txid}:${n.vout}`
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
return t.sort((n, s) => s.value - n.value).map((n) => ({
|
|
165
|
+
txid: n.txid,
|
|
166
|
+
vout: n.vout,
|
|
167
|
+
value: n.value,
|
|
168
|
+
scriptPubKey: o.scriptPubKey,
|
|
169
|
+
confirmed: n.status.confirmed
|
|
170
|
+
}));
|
|
171
|
+
} catch (t) {
|
|
172
|
+
throw t instanceof Error ? new Error(
|
|
173
|
+
`Failed to get UTXOs for address ${e}: ${t.message}`
|
|
174
|
+
) : new Error(
|
|
175
|
+
`Failed to get UTXOs for address ${e}: Unknown error`
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function M(e) {
|
|
180
|
+
return T[e];
|
|
181
|
+
}
|
|
182
|
+
async function _(e, r) {
|
|
183
|
+
return h(e), i(`${r}/address/${e}/txs`);
|
|
184
|
+
}
|
|
185
|
+
async function N(e) {
|
|
186
|
+
const r = await f(`${e}/v1/fees/recommended`);
|
|
187
|
+
if (!r.ok)
|
|
188
|
+
throw new Error(
|
|
189
|
+
`Failed to fetch network fees: ${r.status} ${r.statusText}`
|
|
190
|
+
);
|
|
191
|
+
const t = await r.json(), o = [
|
|
192
|
+
"fastestFee",
|
|
193
|
+
"halfHourFee",
|
|
194
|
+
"hourFee",
|
|
195
|
+
"economyFee",
|
|
196
|
+
"minimumFee"
|
|
197
|
+
];
|
|
198
|
+
for (const a of o)
|
|
199
|
+
if (!y(t[a]))
|
|
200
|
+
throw new Error(
|
|
201
|
+
`Invalid fee rate ${a}=${t[a]} from mempool API: expected a positive number ≤ ${m}`
|
|
202
|
+
);
|
|
203
|
+
if (t.minimumFee > t.economyFee || t.economyFee > t.hourFee || t.hourFee > t.halfHourFee || t.halfHourFee > t.fastestFee)
|
|
204
|
+
throw new Error(
|
|
205
|
+
`Fee rate ordering violation from mempool API: expected minimumFee (${t.minimumFee}) <= economyFee (${t.economyFee}) <= hourFee (${t.hourFee}) <= halfHourFee (${t.halfHourFee}) <= fastestFee (${t.fastestFee}).`
|
|
206
|
+
);
|
|
207
|
+
return t;
|
|
208
|
+
}
|
|
209
|
+
export {
|
|
210
|
+
T as MEMPOOL_API_URLS,
|
|
211
|
+
_ as getAddressTxs,
|
|
212
|
+
k as getAddressUtxos,
|
|
213
|
+
M as getMempoolApiUrl,
|
|
214
|
+
N as getNetworkFees,
|
|
215
|
+
O as getOutspend,
|
|
216
|
+
P as getTipHeight,
|
|
217
|
+
S as getTxHex,
|
|
218
|
+
v as getTxInfo,
|
|
219
|
+
U as getUtxoInfo,
|
|
220
|
+
A as pushTx
|
|
221
|
+
};
|
|
222
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/tbv/core/clients/mempool/mempoolApi.ts"],"sourcesContent":["/**\n * Mempool API Client\n *\n * Client for interacting with mempool.space API for Bitcoin network operations.\n * Used for broadcasting transactions and fetching UTXO data.\n *\n * @module clients/mempool/mempoolApi\n */\n\nimport { combineAbortSignals } from \"../../utils/abortSignals\";\nimport {\n BITCOIN_ADDRESS_RE,\n HEX_RE,\n KNOWN_SCRIPT_PREFIXES,\n TXID_RE,\n} from \"../../utils/validation\";\n\nimport type {\n MempoolUTXO,\n NetworkFees,\n OutspendStatus,\n TxInfo,\n UtxoInfo,\n} from \"./types\";\n\n/** Maximum valid satoshi value: 21 million BTC × 10^8 sats/BTC */\nconst MAX_SATOSHIS = 21_000_000 * 1e8;\n\n/** Timeout for mempool API requests — prevents indefinite hangs from stalled endpoints */\nconst MEMPOOL_REQUEST_TIMEOUT_MS = 30_000;\n\n/**\n * Fetch wrapper with AbortController-based timeout.\n * Ensures all mempool API requests fail bounded rather than hanging indefinitely.\n */\nasync function fetchWithTimeout(\n url: string,\n options?: RequestInit,\n): Promise<Response> {\n const controller = new AbortController();\n const timeoutId = setTimeout(\n () => controller.abort(),\n MEMPOOL_REQUEST_TIMEOUT_MS,\n );\n\n // Compose timeout signal with any caller-supplied signal so both can cancel\n const signals = [controller.signal, options?.signal].filter(\n Boolean,\n ) as AbortSignal[];\n const combined = combineAbortSignals(signals);\n\n try {\n // Don't clear timeout here — let it cover body consumption by callers.\n // For the same reason the composed signal keeps its listeners attached on\n // the success path: detaching them would stop the timeout from aborting a\n // stalled body read.\n return await fetch(url, {\n ...options,\n signal: combined.signal,\n });\n } catch (error) {\n clearTimeout(timeoutId);\n combined.cleanup();\n if (\n error != null &&\n typeof error === \"object\" &&\n \"name\" in error &&\n error.name === \"AbortError\"\n ) {\n throw new Error(\n `Mempool API request timed out after ${MEMPOOL_REQUEST_TIMEOUT_MS}ms: ${url}`,\n );\n }\n throw error;\n }\n}\n\n/**\n * Maximum sane fee rate in sat/vByte.\n * The April 2024 Runes spike peaked around 1,805 sat/vB — 10,000 provides ample headroom.\n */\nconst MAX_FEE_RATE = 10_000;\n\nfunction isValidSatoshiValue(value: number): boolean {\n return Number.isInteger(value) && value > 0 && value <= MAX_SATOSHIS;\n}\n\nfunction isValidFeeRate(value: number): boolean {\n return Number.isInteger(value) && value > 0 && value <= MAX_FEE_RATE;\n}\n\nfunction isValidVout(vout: number, outputCount?: number): boolean {\n if (!Number.isInteger(vout) || vout < 0) return false;\n return outputCount === undefined || vout < outputCount;\n}\n\n\nfunction assertValidTxid(txid: string): void {\n if (!TXID_RE.test(txid)) {\n throw new Error(`Invalid transaction ID format: ${txid}`);\n }\n}\n\nfunction assertValidAddress(address: string): void {\n if (!BITCOIN_ADDRESS_RE.test(address)) {\n throw new Error(`Invalid Bitcoin address format: ${address}`);\n }\n}\n\nfunction assertValidScriptPubKey(scriptPubKey: string, context: string): void {\n if (!HEX_RE.test(scriptPubKey)) {\n throw new Error(\n `Invalid scriptPubKey: not valid hex for ${context}`,\n );\n }\n const matchesKnownType = KNOWN_SCRIPT_PREFIXES.some((prefix) =>\n scriptPubKey.toLowerCase().startsWith(prefix),\n );\n if (!matchesKnownType) {\n throw new Error(\n `Unrecognized scriptPubKey type for ${context}: ` +\n `prefix ${scriptPubKey.slice(0, 6)} does not match any known Bitcoin script type`,\n );\n }\n}\n\n/**\n * Default mempool API URLs by network.\n */\nexport const MEMPOOL_API_URLS = {\n mainnet: \"https://mempool.space/api\",\n testnet: \"https://mempool.space/testnet/api\",\n signet: \"https://mempool.space/signet/api\",\n} as const;\n\n/**\n * Fetch wrapper with error handling.\n */\nasync function fetchApi<T>(\n url: string,\n options?: RequestInit,\n): Promise<T> {\n try {\n const response = await fetchWithTimeout(url, options);\n\n if (!response.ok) {\n const errorText = await response.text();\n throw new Error(\n `Mempool API error (${response.status}): ${errorText || response.statusText}`,\n );\n }\n\n const contentType = response.headers.get(\"content-type\");\n if (contentType?.includes(\"application/json\")) {\n return (await response.json()) as T;\n } else {\n return (await response.text()) as T;\n }\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Failed to fetch from mempool API: ${error.message}`);\n }\n throw new Error(\"Failed to fetch from mempool API: Unknown error\");\n }\n}\n\n/**\n * Push a signed transaction to the Bitcoin network.\n *\n * @param txHex - The signed transaction hex string\n * @param apiUrl - Mempool API base URL\n * @returns The transaction ID\n * @throws Error if broadcasting fails\n */\nexport async function pushTx(txHex: string, apiUrl: string): Promise<string> {\n try {\n const response = await fetchWithTimeout(`${apiUrl}/tx`, {\n method: \"POST\",\n body: txHex,\n headers: {\n \"Content-Type\": \"text/plain\",\n },\n });\n\n if (!response.ok) {\n const errorText = await response.text();\n // Try to extract error message from response using robust JSON parsing\n let message: string | undefined;\n try {\n const errorJson = JSON.parse(errorText);\n message = errorJson.message ?? errorJson.error;\n } catch {\n // Not JSON, use raw text\n message = errorText;\n }\n throw new Error(\n message || `Failed to broadcast transaction: ${response.statusText}`,\n );\n }\n\n // Response is the transaction ID (plain text)\n const txId = await response.text();\n return txId;\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Failed to broadcast BTC transaction: ${error.message}`);\n }\n throw new Error(\"Failed to broadcast BTC transaction: Unknown error\");\n }\n}\n\n/**\n * Get transaction information from mempool.\n *\n * @param txid - The transaction ID\n * @param apiUrl - Mempool API base URL\n * @returns Transaction information\n */\nexport async function getTxInfo(txid: string, apiUrl: string): Promise<TxInfo> {\n assertValidTxid(txid);\n return fetchApi<TxInfo>(`${apiUrl}/tx/${txid}`);\n}\n\n/**\n * Get the current block tip height.\n *\n * Source: mempool.space API — `GET /api/blocks/tip/height` returns the height\n * of the most recent block as a plain-text integer.\n *\n * The digit check alone is not enough to honour the contract below. A long\n * enough run of digits passes `/^\\d+$/` and then parses to a value no caller\n * can use: 400 digits yields `Infinity`, and 20 digits yields a finite but\n * unsafe integer. Callers subtract this from a confirmed block height to get a\n * confirmation depth, so either one produces an enormous depth and clears any\n * threshold it is compared against. Bound it to a safe integer here rather\n * than leaving each caller to discover the gap.\n *\n * @param apiUrl - Mempool API base URL\n * @returns The height of the most recent block\n * @throws Error if the response is not a whole number a caller can compute on\n */\nexport async function getTipHeight(apiUrl: string): Promise<number> {\n const raw = await fetchApi<string>(`${apiUrl}/blocks/tip/height`);\n const trimmed = raw.trim();\n const height = /^\\d+$/.test(trimmed) ? Number.parseInt(trimmed, 10) : NaN;\n if (!Number.isSafeInteger(height) || height < 0) {\n throw new Error(\n `Mempool API returned an invalid block tip height: \"${raw}\"`,\n );\n }\n return height;\n}\n\n/**\n * Get the spend status of a specific transaction output.\n *\n * Calls the esplora-compatible `GET /tx/{txid}/outspend/{vout}` endpoint\n * (mempool.space backend, mempool/electrs `rest.rs`). Returns\n * `{ spent: false }` for an unspent output, or\n * `{ spent: true, txid, vin, status }` when the output has been spent.\n *\n * @param txid - The transaction id whose output is being checked (no 0x prefix)\n * @param vout - The output index\n * @param apiUrl - Mempool API base URL\n * @returns The output's spend status\n */\nexport async function getOutspend(\n txid: string,\n vout: number,\n apiUrl: string,\n): Promise<OutspendStatus> {\n assertValidTxid(txid);\n if (!isValidVout(vout)) {\n throw new Error(`Invalid vout ${vout} for transaction ${txid}`);\n }\n return fetchApi<OutspendStatus>(`${apiUrl}/tx/${txid}/outspend/${vout}`);\n}\n\n/**\n * Get the hex representation of a transaction.\n *\n * @param txid - The transaction ID\n * @param apiUrl - Mempool API base URL\n * @returns The transaction hex string\n * @throws Error if the request fails or transaction is not found\n */\nexport async function getTxHex(txid: string, apiUrl: string): Promise<string> {\n assertValidTxid(txid);\n try {\n const response = await fetchWithTimeout(`${apiUrl}/tx/${txid}/hex`);\n\n if (!response.ok) {\n const errorText = await response.text();\n throw new Error(\n `Mempool API error (${response.status}): ${errorText || response.statusText}`,\n );\n }\n\n return await response.text();\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Failed to get transaction hex for ${txid}: ${error.message}`);\n }\n throw new Error(`Failed to get transaction hex for ${txid}: Unknown error`);\n }\n}\n\n/**\n * Get UTXO information for a specific transaction output.\n *\n * This is used for constructing PSBTs where we need the witnessUtxo data.\n * Only supports Taproot (P2TR) and native SegWit (P2WPKH, P2WSH) script types.\n *\n * @param txid - The transaction ID containing the UTXO\n * @param vout - The output index\n * @param apiUrl - Mempool API base URL\n * @returns UTXO information with value and scriptPubKey\n */\nexport async function getUtxoInfo(\n txid: string,\n vout: number,\n apiUrl: string,\n): Promise<UtxoInfo> {\n assertValidTxid(txid);\n const txInfo = await getTxInfo(txid, apiUrl);\n\n if (!isValidVout(vout, txInfo.vout.length)) {\n throw new Error(\n `Invalid vout ${vout} for transaction ${txid} (has ${txInfo.vout.length} outputs)`,\n );\n }\n\n const output = txInfo.vout[vout];\n if (!isValidSatoshiValue(output.value)) {\n throw new Error(`Invalid UTXO value ${output.value} for ${txid}:${vout}`);\n }\n assertValidScriptPubKey(output.scriptpubkey, `${txid}:${vout}`);\n\n return {\n txid,\n vout,\n value: output.value,\n scriptPubKey: output.scriptpubkey,\n };\n}\n\n/**\n * Get all UTXOs for a Bitcoin address.\n *\n * @param address - The Bitcoin address\n * @param apiUrl - Mempool API base URL\n * @returns Array of UTXOs sorted by value (largest first)\n */\nexport async function getAddressUtxos(\n address: string,\n apiUrl: string,\n): Promise<MempoolUTXO[]> {\n assertValidAddress(address);\n try {\n // Fetch UTXOs for the address\n const utxos = await fetchApi<\n {\n txid: string;\n vout: number;\n value: number;\n status: {\n confirmed: boolean;\n };\n }[]\n >(`${apiUrl}/address/${address}/utxo`);\n\n // Fetch scriptPubKey for the address\n const addressInfo = await fetchApi<{\n isvalid: boolean;\n scriptPubKey: string;\n }>(`${apiUrl}/v1/validate-address/${address}`);\n\n if (!addressInfo.isvalid) {\n throw new Error(\n `Invalid Bitcoin address: ${address}. Mempool API validation failed.`,\n );\n }\n assertValidScriptPubKey(addressInfo.scriptPubKey, address);\n\n // Validate UTXO fields from the listing endpoint.\n // Per-UTXO cross-verification against /tx/{txid} is intentionally NOT done\n // here — it would be expensive (N API calls) and redundant: the broadcast\n // path already verifies each selected input via getUtxoInfo before signing.\n // Both endpoints come from the same mempool API, so cross-checking one\n // against the other on the same server does not add real security.\n for (const utxo of utxos) {\n assertValidTxid(utxo.txid);\n if (!isValidVout(utxo.vout)) {\n throw new Error(`Invalid vout ${utxo.vout} for ${utxo.txid}`);\n }\n if (!isValidSatoshiValue(utxo.value)) {\n throw new Error(\n `Invalid UTXO value ${utxo.value} for ${utxo.txid}:${utxo.vout}`,\n );\n }\n }\n\n // Sort by value (largest first) and map to our UTXO format\n const sortedUTXOs = utxos.sort((a, b) => b.value - a.value);\n\n return sortedUTXOs.map((utxo) => ({\n txid: utxo.txid,\n vout: utxo.vout,\n value: utxo.value,\n scriptPubKey: addressInfo.scriptPubKey,\n confirmed: utxo.status.confirmed,\n }));\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(\n `Failed to get UTXOs for address ${address}: ${error.message}`,\n );\n }\n throw new Error(\n `Failed to get UTXOs for address ${address}: Unknown error`,\n );\n }\n}\n\n/**\n * Get the mempool API URL for a given network.\n *\n * @param network - Bitcoin network (mainnet, testnet, signet)\n * @returns The mempool API URL\n */\nexport function getMempoolApiUrl(\n network: \"mainnet\" | \"testnet\" | \"signet\",\n): string {\n return MEMPOOL_API_URLS[network];\n}\n\n/**\n * Transaction summary from address transactions endpoint.\n */\nexport interface AddressTx {\n txid: string;\n status: {\n confirmed: boolean;\n block_height?: number;\n };\n}\n\n/**\n * Get recent transactions for a Bitcoin address.\n *\n * Returns the last 25 confirmed transactions plus any unconfirmed (mempool) transactions.\n * This is useful for checking if a specific transaction has been broadcast.\n *\n * @param address - The Bitcoin address\n * @param apiUrl - Mempool API base URL\n * @returns Array of recent transactions\n */\nexport async function getAddressTxs(\n address: string,\n apiUrl: string,\n): Promise<AddressTx[]> {\n assertValidAddress(address);\n return fetchApi<AddressTx[]>(`${apiUrl}/address/${address}/txs`);\n}\n\n/**\n * Fetches Bitcoin network fee recommendations from mempool.space API.\n *\n * @param apiUrl - Mempool API base URL\n * @returns Fee rates in sat/vbyte for different confirmation times\n * @throws Error if request fails or returns invalid data\n *\n * @see https://mempool.space/docs/api/rest#get-recommended-fees\n */\nexport async function getNetworkFees(apiUrl: string): Promise<NetworkFees> {\n const response = await fetchWithTimeout(`${apiUrl}/v1/fees/recommended`);\n\n if (!response.ok) {\n throw new Error(\n `Failed to fetch network fees: ${response.status} ${response.statusText}`,\n );\n }\n\n const data = await response.json();\n\n const feeFields = [\n \"fastestFee\",\n \"halfHourFee\",\n \"hourFee\",\n \"economyFee\",\n \"minimumFee\",\n ] as const;\n\n for (const field of feeFields) {\n if (!isValidFeeRate(data[field])) {\n throw new Error(\n `Invalid fee rate ${field}=${data[field]} from mempool API: expected a positive number ≤ ${MAX_FEE_RATE}`,\n );\n }\n }\n\n if (\n data.minimumFee > data.economyFee ||\n data.economyFee > data.hourFee ||\n data.hourFee > data.halfHourFee ||\n data.halfHourFee > data.fastestFee\n ) {\n throw new Error(\n `Fee rate ordering violation from mempool API: expected ` +\n `minimumFee (${data.minimumFee}) <= economyFee (${data.economyFee}) <= ` +\n `hourFee (${data.hourFee}) <= halfHourFee (${data.halfHourFee}) <= ` +\n `fastestFee (${data.fastestFee}).`,\n );\n }\n\n return data as NetworkFees;\n}\n\n"],"names":["MAX_SATOSHIS","MEMPOOL_REQUEST_TIMEOUT_MS","fetchWithTimeout","url","options","controller","timeoutId","signals","combined","combineAbortSignals","error","MAX_FEE_RATE","isValidSatoshiValue","value","isValidFeeRate","isValidVout","vout","outputCount","assertValidTxid","txid","TXID_RE","assertValidAddress","address","BITCOIN_ADDRESS_RE","assertValidScriptPubKey","scriptPubKey","context","HEX_RE","KNOWN_SCRIPT_PREFIXES","prefix","MEMPOOL_API_URLS","fetchApi","response","errorText","contentType","pushTx","txHex","apiUrl","message","errorJson","getTxInfo","getTipHeight","raw","trimmed","height","getOutspend","getTxHex","getUtxoInfo","txInfo","output","getAddressUtxos","utxos","addressInfo","utxo","a","b","getMempoolApiUrl","network","getAddressTxs","getNetworkFees","data","feeFields","field"],"mappings":";;AA0BA,MAAMA,IAAe,OAAa,KAG5BC,IAA6B;AAMnC,eAAeC,EACbC,GACAC,GACmB;AACnB,QAAMC,IAAa,IAAI,gBAAA,GACjBC,IAAY;AAAA,IAChB,MAAMD,EAAW,MAAA;AAAA,IACjBJ;AAAA,EAAA,GAIIM,IAAU,CAACF,EAAW,QAAQD,KAAA,gBAAAA,EAAS,MAAM,EAAE;AAAA,IACnD;AAAA,EAAA,GAEII,IAAWC,EAAoBF,CAAO;AAE5C,MAAI;AAKF,WAAO,MAAM,MAAMJ,GAAK;AAAA,MACtB,GAAGC;AAAA,MACH,QAAQI,EAAS;AAAA,IAAA,CAClB;AAAA,EACH,SAASE,GAAO;AAGd,UAFA,aAAaJ,CAAS,GACtBE,EAAS,QAAA,GAEPE,KAAS,QACT,OAAOA,KAAU,YACjB,UAAUA,KACVA,EAAM,SAAS,eAET,IAAI;AAAA,MACR,uCAAuCT,CAA0B,OAAOE,CAAG;AAAA,IAAA,IAGzEO;AAAA,EACR;AACF;AAMA,MAAMC,IAAe;AAErB,SAAS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ACb,IAAI;AAAA,MACR,mCAAmCY,CAAO,KAAKZ,EAAM,OAAO;AAAA,IAAA,IAG1D,IAAI;AAAA,MACR,mCAAmCY,CAAO;AAAA,IAAA;AAAA,EAE9C;AACF;AAQO,SAASkC,EACdC,GACQ;AACR,SAAO3B,EAAiB2B,CAAO;AACjC;AAuBA,eAAsBC,EACpBpC,GACAe,GACsB;AACtB,SAAAhB,EAAmBC,CAAO,GACnBS,EAAsB,GAAGM,CAAM,YAAYf,CAAO,MAAM;AACjE;AAWA,eAAsBqC,EAAetB,GAAsC;AACzE,QAAML,IAAW,MAAM9B,EAAiB,GAAGmC,CAAM,sBAAsB;AAEvE,MAAI,CAACL,EAAS;AACZ,UAAM,IAAI;AAAA,MACR,iCAAiCA,EAAS,MAAM,IAAIA,EAAS,UAAU;AAAA,IAAA;AAI3E,QAAM4B,IAAO,MAAM5B,EAAS,KAAA,GAEtB6B,IAAY;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGF,aAAWC,KAASD;AAClB,QAAI,CAAC/C,EAAe8C,EAAKE,CAAK,CAAC;AAC7B,YAAM,IAAI;AAAA,QACR,oBAAoBA,CAAK,IAAIF,EAAKE,CAAK,CAAC,mDAAmDnD,CAAY;AAAA,MAAA;AAK7G,MACEiD,EAAK,aAAaA,EAAK,cACvBA,EAAK,aAAaA,EAAK,WACvBA,EAAK,UAAUA,EAAK,eACpBA,EAAK,cAAcA,EAAK;AAExB,UAAM,IAAI;AAAA,MACR,sEACiBA,EAAK,UAAU,oBAAoBA,EAAK,UAAU,iBACrDA,EAAK,OAAO,qBAAqBA,EAAK,WAAW,oBAC9CA,EAAK,UAAU;AAAA,IAAA;AAIpC,SAAOA;AACT;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../BTCVaultRegistry.abi-z7d_eP22.cjs"),e=require("../../../BTCVaultRegistryKeyEpochs.abi-CrQiTLfA.cjs"),n=[{type:"function",name:"getVaultKeepersByVersion",inputs:[{name:"appEntryPoint",type:"address",internalType:"address"},{name:"versionNumber",type:"uint16",internalType:"uint16"}],outputs:[{name:"",type:"tuple[]",internalType:"struct BTCVaultTypes.AddressBTCKeyPair[]",components:[{name:"ethAddress",type:"address",internalType:"address"},{name:"btcPubKey",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"getCurrentVaultKeepers",inputs:[{name:"appEntryPoint",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct BTCVaultTypes.AddressBTCKeyPair[]",components:[{name:"ethAddress",type:"address",internalType:"address"},{name:"btcPubKey",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"getCurrentVaultKeepersVersion",inputs:[{name:"appEntryPoint",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint16",internalType:"uint16"}],stateMutability:"view"},{type:"function",name:"getCurrentOperationBtcKey",inputs:[{name:"appEntryPoint",type:"address",internalType:"address"},{name:"keeperAdmin",type:"address",internalType:"address"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"getOperationBtcKeyAtEpochOrGenesis",inputs:[{name:"appEntryPoint",type:"address",internalType:"address"},{name:"keeperAdmin",type:"address",internalType:"address"},{name:"epoch",type:"uint64",internalType:"uint64"},{name:"rosterGenesisKey",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"getPayoutScriptAtEpoch",inputs:[{name:"appEntryPoint",type:"address",internalType:"address"},{name:"keeperAdmin",type:"address",internalType:"address"},{name:"epoch",type:"uint64",internalType:"uint64"}],outputs:[{name:"",type:"bytes",internalType:"bytes"}],stateMutability:"view"}],i=[{type:"function",name:"activeVaultCoreVersion",inputs:[],outputs:[{name:"",type:"uint16",internalType:"uint16"}],stateMutability:"view"},{type:"function",name:"getTBVProtocolParams",inputs:[],outputs:[{name:"",type:"tuple",internalType:"struct IProtocolParams.TBVProtocolParams",components:[{name:"minimumPegInAmount",type:"uint64",internalType:"uint64"},{name:"maxPegInAmount",type:"uint64",internalType:"uint64"},{name:"pegInAckTimeout",type:"uint64",internalType:"uint64"},{name:"pegInActivationTimeout",type:"uint64",internalType:"uint64"},{name:"maxHtlcOutputCount",type:"uint8",internalType:"uint8"},{name:"expiredPegInGraceBlocks",type:"uint64",internalType:"uint64"}]}],stateMutability:"view"},{type:"function",name:"getLatestOffchainParams",inputs:[],outputs:[{name:"",type:"tuple",internalType:"struct IProtocolParams.VersionedOffchainParams",components:[{name:"timelockAssert",type:"uint256",internalType:"uint256"},{name:"timelockChallengeAssert",type:"uint256",internalType:"uint256"},{name:"securityCouncilKeys",type:"bytes32[]",internalType:"bytes32[]"},{name:"councilQuorum",type:"uint8",internalType:"uint8"},{name:"feeRate",type:"uint64",internalType:"uint64"},{name:"babeTotalInstances",type:"uint16",internalType:"uint16"},{name:"babeInstancesToFinalize",type:"uint8",internalType:"uint8"},{name:"minVpCommissionBps",type:"uint16",internalType:"uint16"},{name:"tRefund",type:"uint32",internalType:"uint32"},{name:"tStale",type:"uint32",internalType:"uint32"},{name:"minPeginFeeRate",type:"uint64",internalType:"uint64"},{name:"proverCircuitVersion",type:"uint16",internalType:"uint16"},{name:"minPrepeginDepth",type:"uint32",internalType:"uint32"}]}],stateMutability:"view"},{type:"function",name:"getOffchainParamsByVersion",inputs:[{name:"versionNumber",type:"uint16",internalType:"uint16"}],outputs:[{name:"",type:"tuple",internalType:"struct IProtocolParams.VersionedOffchainParams",components:[{name:"timelockAssert",type:"uint256",internalType:"uint256"},{name:"timelockChallengeAssert",type:"uint256",internalType:"uint256"},{name:"securityCouncilKeys",type:"bytes32[]",internalType:"bytes32[]"},{name:"councilQuorum",type:"uint8",internalType:"uint8"},{name:"feeRate",type:"uint64",internalType:"uint64"},{name:"babeTotalInstances",type:"uint16",internalType:"uint16"},{name:"babeInstancesToFinalize",type:"uint8",internalType:"uint8"},{name:"minVpCommissionBps",type:"uint16",internalType:"uint16"},{name:"tRefund",type:"uint32",internalType:"uint32"},{name:"tStale",type:"uint32",internalType:"uint32"},{name:"minPeginFeeRate",type:"uint64",internalType:"uint64"},{name:"proverCircuitVersion",type:"uint16",internalType:"uint16"},{name:"minPrepeginDepth",type:"uint32",internalType:"uint32"}]}],stateMutability:"view"},{type:"function",name:"latestOffchainParamsVersion",inputs:[],outputs:[{name:"",type:"uint16",internalType:"uint16"}],stateMutability:"view"},{type:"function",name:"getUniversalChallengersByVersion",inputs:[{name:"versionNumber",type:"uint16",internalType:"uint16"}],outputs:[{name:"",type:"tuple[]",internalType:"struct BTCVaultTypes.AddressBTCKeyPair[]",components:[{name:"ethAddress",type:"address",internalType:"address"},{name:"btcPubKey",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"getCurrentUniversalChallengers",inputs:[],outputs:[{name:"",type:"tuple[]",internalType:"struct BTCVaultTypes.AddressBTCKeyPair[]",components:[{name:"ethAddress",type:"address",internalType:"address"},{name:"btcPubKey",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"latestUniversalChallengersVersion",inputs:[],outputs:[{name:"",type:"uint16",internalType:"uint16"}],stateMutability:"view"},{type:"function",name:"getCurrentOperationBtcKey",inputs:[{name:"ucAdmin",type:"address",internalType:"address"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"getOperationBtcKeyAtEpochOrGenesis",inputs:[{name:"ucAdmin",type:"address",internalType:"address"},{name:"epoch",type:"uint64",internalType:"uint64"},{name:"rosterGenesisKey",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"peginActivationDelay",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"}];exports.BTCVaultRegistryABI=t.BTCVaultRegistryABI;exports.BTCVaultRegistryKeyEpochsABI=e.BTCVaultRegistryKeyEpochsABI;exports.CONTRACT_ERRORS=e.CONTRACT_ERRORS;exports.extractErrorData=e.extractErrorData;exports.getContractErrorMessage=e.getContractErrorMessage;exports.handleContractError=e.handleContractError;exports.isKnownContractError=e.isKnownContractError;exports.ApplicationRegistryABI=n;exports.ProtocolParamsABI=i;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|