@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Address, Chain, Hex, PublicClient, WalletClient } from 'viem';
|
|
2
2
|
import { BitcoinWallet, Hash } from '../../../shared/wallets';
|
|
3
|
+
import { PopSignature } from '../clients/eth/pegin-registration-client';
|
|
3
4
|
import { WotsBlockPublicKey } from '../clients/vault-provider/types';
|
|
4
5
|
import { DepositTerms } from '../deposit-terms';
|
|
5
6
|
import { Network } from '../primitives';
|
|
@@ -255,20 +256,6 @@ export interface SignAndBroadcastParams {
|
|
|
255
256
|
*/
|
|
256
257
|
depositTerms?: DepositTerms;
|
|
257
258
|
}
|
|
258
|
-
/**
|
|
259
|
-
* BIP-322 BTC Proof-of-Possession binding a depositor's BTC key to their
|
|
260
|
-
* Ethereum account. Produced by {@link PeginManager.signProofOfPossession}
|
|
261
|
-
* and reusable across every register call in the same session — the
|
|
262
|
-
* embedded identities are re-checked at register time.
|
|
263
|
-
*/
|
|
264
|
-
export interface PopSignature {
|
|
265
|
-
/** BIP-322 signature over the PoP message (0x-prefixed hex). */
|
|
266
|
-
btcPopSignature: Hex;
|
|
267
|
-
/** Ethereum address the PoP was signed for. */
|
|
268
|
-
depositorEthAddress: Address;
|
|
269
|
-
/** BTC x-only public key (64-char hex, no 0x prefix). */
|
|
270
|
-
depositorBtcPubkey: string;
|
|
271
|
-
}
|
|
272
259
|
/**
|
|
273
260
|
* Parameters for registering a peg-in on Ethereum.
|
|
274
261
|
*/
|
|
@@ -389,6 +376,41 @@ export interface RegisterPeginBatchResult {
|
|
|
389
376
|
/** Per-vault results (same order as input requests) */
|
|
390
377
|
vaults: BatchPeginResultItem[];
|
|
391
378
|
}
|
|
379
|
+
/**
|
|
380
|
+
* Manager for orchestrating peg-in operations.
|
|
381
|
+
*
|
|
382
|
+
* This manager provides a high-level API for creating peg-in transactions
|
|
383
|
+
* by coordinating between SDK primitives, utilities, and wallet interfaces.
|
|
384
|
+
*
|
|
385
|
+
* @remarks
|
|
386
|
+
* The complete peg-in flow consists of 5 steps:
|
|
387
|
+
*
|
|
388
|
+
* | Step | Method | Description |
|
|
389
|
+
* |------|--------|-------------|
|
|
390
|
+
* | 1 | {@link preparePegin} | Build Pre-PegIn HTLC, fund it, sign PegIn input |
|
|
391
|
+
* | 2 | {@link signProofOfPossession} | Sign BIP-322 PoP (one per deposit session) |
|
|
392
|
+
* | 3 | {@link registerPeginOnChain} | Submit to Ethereum contract |
|
|
393
|
+
* | 4 | {@link signAndBroadcast} | Sign and broadcast Pre-PegIn tx to Bitcoin network |
|
|
394
|
+
* | 5 | {@link PayoutManager} | Sign BOTH payout authorizations |
|
|
395
|
+
*
|
|
396
|
+
* **Important:** Step 5 uses {@link PayoutManager}, not this class. After
|
|
397
|
+
* step 4, the vault provider observes the broadcast Pre-PegIn and prepares
|
|
398
|
+
* 3 transactions per claimer:
|
|
399
|
+
* - `claim_tx` - Claim transaction
|
|
400
|
+
* - `assert_tx` - Assert transaction
|
|
401
|
+
* - `payout_tx` - Payout transaction
|
|
402
|
+
*
|
|
403
|
+
* You must sign the Payout transaction for each claimer:
|
|
404
|
+
* - {@link PayoutManager.signPayoutTransaction} - uses assert_tx as input reference
|
|
405
|
+
*
|
|
406
|
+
* Submit all signatures to the vault provider to drive the contract to
|
|
407
|
+
* `VERIFIED` (and then activate by revealing the HTLC secret, which is a
|
|
408
|
+
* services-layer step outside this manager).
|
|
409
|
+
*
|
|
410
|
+
* @see {@link PayoutManager} - Required for Step 5 (payout authorization)
|
|
411
|
+
* @see {@link buildPrePeginPsbt} - Lower-level primitive for custom implementations
|
|
412
|
+
* @see {@link https://github.com/babylonlabs-io/babylon-toolkit/blob/main/packages/babylon-ts-sdk/docs/quickstart/managers.md | Managers Quickstart}
|
|
413
|
+
*/
|
|
392
414
|
export declare class PeginManager {
|
|
393
415
|
private readonly config;
|
|
394
416
|
/**
|
|
@@ -493,21 +515,7 @@ export declare class PeginManager {
|
|
|
493
515
|
* @returns Batch result with per-vault IDs and single ETH tx hash
|
|
494
516
|
*/
|
|
495
517
|
registerPeginBatchOnChain(params: RegisterPeginBatchParams): Promise<RegisterPeginBatchResult>;
|
|
496
|
-
private
|
|
497
|
-
/**
|
|
498
|
-
* Check if a vault already exists for a given vault ID.
|
|
499
|
-
*
|
|
500
|
-
* The contract returns a default struct (with `depositor === zeroAddress`)
|
|
501
|
-
* when no vault is registered, so existence is signalled in the response,
|
|
502
|
-
* not via a thrown error. RPC/network failures are propagated rather than
|
|
503
|
-
* silently treated as "vault doesn't exist", which would otherwise let
|
|
504
|
-
* downstream calls run with stale assumptions.
|
|
505
|
-
*
|
|
506
|
-
* @param vaultId - The Bitcoin transaction hash (vault ID)
|
|
507
|
-
* @returns True if vault exists, false otherwise
|
|
508
|
-
* @throws If the underlying RPC read fails
|
|
509
|
-
*/
|
|
510
|
-
private checkVaultExists;
|
|
518
|
+
private createRegistrationClient;
|
|
511
519
|
/**
|
|
512
520
|
* Resolve the BTC scriptPubKey to register as the depositor's payout sink.
|
|
513
521
|
*
|
|
@@ -580,7 +588,7 @@ export interface EstimateSubmitPeginRequestBatchGasParams {
|
|
|
580
588
|
* `maxAcceptableCommissionBps` argument so the simulation does not revert on
|
|
581
589
|
* the contract's commission-drift check regardless of the VP's current
|
|
582
590
|
* commission. The real submit path resolves an accurate, drift-checked value
|
|
583
|
-
* via
|
|
591
|
+
* via the registration client's protocol-parameter lookup.
|
|
584
592
|
*
|
|
585
593
|
* Throws if the contract reverts during simulation; callers should treat the
|
|
586
594
|
* thrown error as "unable to estimate" and decide how to surface it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PeginManager.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/managers/PeginManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH,OAAO,
|
|
1
|
+
{"version":3,"file":"PeginManager.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/managers/PeginManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAUd,OAAO,KAAK,EACV,aAAa,EACb,IAA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M,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC;IA+JvE;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,oBAAoB,CACxB,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC;IAyC/B;;;;;;;;;OASG;IACG,yBAAyB,CAC7B,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,wBAAwB,CAAC;IA6CpC,OAAO,CAAC,wBAAwB;IAYhC;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,yBAAyB;IAkDjC;;;;;;;;;;;;OAYG;IACG,qBAAqB,IAAI,OAAO,CAAC,YAAY,CAAC;IA+BpD;;;;;;;OAOG;YACW,yBAAyB;IAkBvC;;;;OAIG;IACH,UAAU,IAAI,OAAO;IAIrB;;;;OAIG;IACH,uBAAuB,IAAI,OAAO;CAGnC;AAmED,MAAM,WAAW,wCAAwC;IACvD,YAAY,EAAE,YAAY,CAAC;IAC3B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,kCAAkC,CACtD,MAAM,EAAE,wCAAwC,GAC/C,OAAO,CAAC,MAAM,CAAC,CA4CjB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../PeginManager-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../PeginManager-E-UHA1un.cjs"),a=require("../../../signPsbtsWithFallback-DMSpIQWH.cjs");exports.PeginManager=e.PeginManager;exports.estimateSubmitPeginRequestBatchGas=e.estimateSubmitPeginRequestBatchGas;exports.PayoutManager=a.PayoutManager;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
* @module managers
|
|
22
22
|
*/
|
|
23
23
|
export { PeginManager, estimateSubmitPeginRequestBatchGas } from './PeginManager';
|
|
24
|
-
export type {
|
|
24
|
+
export type { PreparePeginResult, PreparePeginTransaction, PreparePeginDerivedSecrets, PreparePeginParams, PerVaultPeginData, PeginManagerConfig, RegisterPeginParams, RegisterPeginResult, SignAndBroadcastParams, BatchPeginRequestItem, RegisterPeginBatchParams, BatchPeginResultItem, RegisterPeginBatchResult, EstimateSubmitPeginRequestBatchGasParams, } from './PeginManager';
|
|
25
|
+
export type { PopSignature } from '../clients/eth';
|
|
25
26
|
export { PayoutManager } from './PayoutManager';
|
|
26
27
|
export type { PayoutManagerConfig, PayoutSignatureResult, SignPayoutParams, } from './PayoutManager';
|
|
27
28
|
export type { UTXO } from '../utils/utxo/selectUtxos';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/managers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,YAAY,EAAE,kCAAkC,EAAE,MAAM,gBAAgB,CAAC;AAClF,YAAY,EACV,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/managers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,YAAY,EAAE,kCAAkC,EAAE,MAAM,gBAAgB,CAAC;AAClF,YAAY,EACV,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,wCAAwC,GACzC,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACV,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACtD,YAAY,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,GAChB,MAAM,kDAAkD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as t, e as r } from "../../../PeginManager-
|
|
2
|
-
import { P as o } from "../../../signPsbtsWithFallback-
|
|
1
|
+
import { P as t, e as r } from "../../../PeginManager-C9RPOd0L.js";
|
|
2
|
+
import { P as o } from "../../../signPsbtsWithFallback-0VBALhjS.js";
|
|
3
3
|
export {
|
|
4
4
|
o as PayoutManager,
|
|
5
5
|
t as PeginManager,
|
|
@@ -30,6 +30,26 @@ export interface ValidateOnChainParticipantKeysParams {
|
|
|
30
30
|
* immediately before the throw.
|
|
31
31
|
*/
|
|
32
32
|
onIndexerHintsInconsistent?: (message: string) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Block to resolve every read against, so the roster versions, the roster
|
|
35
|
+
* members and their operation keys all describe one chain state.
|
|
36
|
+
*
|
|
37
|
+
* This function reads in three dependent rounds — versions, then the members
|
|
38
|
+
* at those versions, then those members' operation keys — because each round
|
|
39
|
+
* needs the previous round's output. Left unpinned, each round lands on
|
|
40
|
+
* whatever `latest` happens to be, and a rotation between rounds yields a key
|
|
41
|
+
* set that no single block ever held. The Bitcoin lock built from it would
|
|
42
|
+
* commit to that mixture, and no counterparty would agree with it.
|
|
43
|
+
*
|
|
44
|
+
* Required rather than optional, and deliberately so. This function exists
|
|
45
|
+
* only for the fresh-deposit path, where an unpinned read is never correct —
|
|
46
|
+
* an optional pin would be a silent fallback to `latest`-per-round on a path
|
|
47
|
+
* that builds a Bitcoin lock. Callers must pass the same block to
|
|
48
|
+
* `ProtocolParamsReader.getPegInConfiguration`; the reader interfaces keep
|
|
49
|
+
* their pin optional because their other callers resolve against a vault's
|
|
50
|
+
* already-frozen epochs, where pinning is meaningless.
|
|
51
|
+
*/
|
|
52
|
+
blockNumber: bigint;
|
|
33
53
|
}
|
|
34
54
|
export interface ValidatedOnChainParticipantKeys {
|
|
35
55
|
/** The VP key to build with: its current operation key. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateOnChainParticipantKeys.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/deposit/validateOnChainParticipantKeys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAO,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AASjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,WAAW,oCAAoC;IACnD,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,yBAAyB,EAAE,yBAAyB,CAAC;IACrD,uBAAuB,EAAE,OAAO,CAAC;IACjC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,8BAA8B,EAAE,MAAM,CAAC;IACvC,6BAA6B,EAAE,MAAM,EAAE,CAAC;IACxC,qCAAqC,EAAE,MAAM,EAAE,CAAC;IAChD;;;OAGG;IACH,kBAAkB,EAAE,kBAAkB,CAAC;IACvC;;;;OAIG;IACH,6BAA6B,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D;;;;;;;OAOG;IACH,0BAA0B,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"validateOnChainParticipantKeys.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/deposit/validateOnChainParticipantKeys.ts"],"names":[],"mappings":"AAAA,OAAO,K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8BAA8B,CAClD,MAAM,EAAE,oCAAoC,GAC3C,OAAO,CAAC,+BAA+B,CAAC,CA8J1C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../signPsbtsWithFallback-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../signPsbtsWithFallback-DMSpIQWH.cjs"),t=require("../../../buildAndBroadcastReclaim-U-PyFfDg.cjs"),i=require("../../../peginState-eaQ4IO_R.cjs");exports.computeHashlock=e.computeHashlock;exports.validateSecretAgainstHashlock=e.validateSecretAgainstHashlock;exports.BIP68NotMatureError=t.BIP68NotMatureError;exports.ClaimerPegoutStatusValue=t.ClaimerPegoutStatusValue;exports.PEGIN_ETH_CONFIRMATIONS=t.PEGIN_ETH_CONFIRMATIONS;exports.ParticipantKeyDriftError=t.ParticipantKeyDriftError;exports.PeginRegistrationMissingError=t.PeginRegistrationMissingError;exports.PeginRegistrationNotFinalError=t.PeginRegistrationNotFinalError;exports.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR=t.RECLAIM_MAX_FEE_FRACTION_DENOMINATOR;exports.RECLAIM_MAX_FEE_FRACTION_NUMERATOR=t.RECLAIM_MAX_FEE_FRACTION_NUMERATOR;exports.RECLAIM_MAX_FEE_RATE_SATS_VB=t.RECLAIM_MAX_FEE_RATE_SATS_VB;exports.RECLAIM_WARN_FEE_FRACTION_NUMERATOR=t.RECLAIM_WARN_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_FRACTION_DENOMINATOR=t.REFUND_MAX_FEE_FRACTION_DENOMINATOR;exports.REFUND_MAX_FEE_FRACTION_NUMERATOR=t.REFUND_MAX_FEE_FRACTION_NUMERATOR;exports.REFUND_MAX_FEE_RATE_SATS_VB=t.REFUND_MAX_FEE_RATE_SATS_VB;exports.REFUND_VSIZE=t.REFUND_VSIZE;exports.ReclaimUneconomicalError=t.ReclaimUneconomicalError;exports.RegisteredVaultVersionMismatchError=t.RegisteredVaultVersionMismatchError;exports.activateVault=t.activateVault;exports.activateVaultAndRedeem=t.activateVaultAndRedeem;exports.assertVaultProviderHintAccepted=t.assertVaultProviderHintAccepted;exports.buildAndBroadcastReclaim=t.buildAndBroadcastReclaim;exports.buildAndBroadcastRefund=t.buildAndBroadcastRefund;exports.estimateRefundFeeSats=t.estimateRefundFeeSats;exports.isDepositAmountValid=t.isDepositAmountValid;exports.isHintAccepted=t.isHintAccepted;exports.isParticipantKeyDriftError=t.isParticipantKeyDriftError;exports.isPeginRegistrationMissingError=t.isPeginRegistrationMissingError;exports.isPeginRegistrationNotFinalError=t.isPeginRegistrationNotFinalError;exports.isPegoutTerminalStatus=t.isPegoutTerminalStatus;exports.isRecognizedPegoutStatus=t.isRecognizedPegoutStatus;exports.isRegisteredVaultVersionMismatchError=t.isRegisteredVaultVersionMismatchError;exports.matchKeyHint=t.matchKeyHint;exports.matchKeySetHint=t.matchKeySetHint;exports.resolveCurrentParticipantKeys=t.resolveCurrentParticipantKeys;exports.resolveParticipantKeysAtEpochs=t.resolveParticipantKeysAtEpochs;exports.runDepositorPresignFlow=t.runDepositorPresignFlow;exports.signDepositorGraph=t.signDepositorGraph;exports.submitWotsPublicKey=t.submitWotsPublicKey;exports.validateDepositAmount=t.validateDepositAmount;exports.validateMultiVaultDepositInputs=t.validateMultiVaultDepositInputs;exports.validateOnChainParticipantKeys=t.validateOnChainParticipantKeys;exports.validateProviderSelection=t.validateProviderSelection;exports.validateRemainingCapacity=t.validateRemainingCapacity;exports.validateVaultAmounts=t.validateVaultAmounts;exports.validateVaultProviderPubkey=t.validateVaultProviderPubkey;exports.verifyRegisteredParticipantKeys=t.verifyRegisteredParticipantKeys;exports.verifyRegisteredVaultVersions=t.verifyRegisteredVaultVersions;exports.waitForPeginRegistrationDepth=t.waitForPeginRegistrationDepth;exports.waitForPeginStatus=t.waitForPeginStatus;exports.ContractStatus=i.ContractStatus;exports.PeginAction=i.PeginAction;exports.canPerformAction=i.canPerformAction;exports.getPeginProtocolState=i.getPeginProtocolState;exports.isActivationDeadlinePassedOnChain=i.isActivationDeadlinePassedOnChain;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as s, v as i } from "../../../signPsbtsWithFallback-
|
|
2
|
-
import { H as r, E as o, P as n, o as E, c as R, d as c, S as A, T as l, U as u, V as _, K as d, L as g, M as P, N as F, O as N, R as p, a as M, b as m, y as v, Q as C, I, J as T, g as V, z as O, p as S, i as D, e as y, G as h, F as f, t as K, A as U, B as H, C as b, D as B, r as X, s as L, f as k, h as w, j as x, v as G, k as z, l as W, m as j, n as q, q as J, u as Q, w as Z, x as Y } from "../../../buildAndBroadcastReclaim-
|
|
1
|
+
import { c as s, v as i } from "../../../signPsbtsWithFallback-0VBALhjS.js";
|
|
2
|
+
import { H as r, E as o, P as n, o as E, c as R, d as c, S as A, T as l, U as u, V as _, K as d, L as g, M as P, N as F, O as N, R as p, a as M, b as m, y as v, Q as C, I, J as T, g as V, z as O, p as S, i as D, e as y, G as h, F as f, t as K, A as U, B as H, C as b, D as B, r as X, s as L, f as k, h as w, j as x, v as G, k as z, l as W, m as j, n as q, q as J, u as Q, w as Z, x as Y } from "../../../buildAndBroadcastReclaim-BXclIcu_.js";
|
|
3
3
|
import { C as aa, P as ta, c as sa, g as ia, i as ea } from "../../../peginState-CxDiaKuk.js";
|
|
4
4
|
export {
|
|
5
5
|
r as BIP68NotMatureError,
|
|
@@ -5,10 +5,18 @@ import { ParticipantKeySet } from './types';
|
|
|
5
5
|
*
|
|
6
6
|
* Use for a peg-in being built now. Issues no epoch read, so it never touches
|
|
7
7
|
* the extended `getBtcVaultProtocolInfo` ABI.
|
|
8
|
+
*
|
|
9
|
+
* `blockNumber` pins the resolution to one block, and is required. Pass the
|
|
10
|
+
* same block the rosters in `query` were read at: the roster supplies each
|
|
11
|
+
* participant's address and genesis key, and this call resolves what that
|
|
12
|
+
* participant has rotated to. Reading the two at different blocks can pair a
|
|
13
|
+
* roster member with a key from a different chain state, so there is no
|
|
14
|
+
* correct unpinned call and no default worth having.
|
|
8
15
|
*/
|
|
9
16
|
export declare function resolveCurrentParticipantKeys(params: {
|
|
10
17
|
operationKeyReader: OperationKeyReader;
|
|
11
18
|
query: OperationKeyQuery;
|
|
19
|
+
blockNumber: bigint;
|
|
12
20
|
}): Promise<ParticipantKeySet>;
|
|
13
21
|
/**
|
|
14
22
|
* Resolve every participant's operation key bonded at a vault's frozen epochs.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveParticipantKeys.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/participants/resolveParticipantKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,SAAS,CAAC;AAmHjB
|
|
1
|
+
{"version":3,"file":"resolveParticipantKeys.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/services/participants/resolveParticipantKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,SAAS,CAAC;AAmHjB;;;;;;;;;;;;GAYG;AACH,wBAAsB,6BAA6B,CAAC,MAAM,EAAE;IAC1D,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,KAAK,EAAE,iBAAiB,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAM7B;AAED;;;;;;;GAOG;AACH,wBAAsB,8BAA8B,CAAC,MAAM,EAAE;IAC3D,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,KAAK,EAAE,iBAAiB,CAAC;IACzB,MAAM,EAAE,SAAS,CAAC;CACnB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAS7B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f={1:"https://safe-transaction-mainnet.safe.global",11155111:"https://safe-transaction-sepolia.safe.global"},w=5e3,d=14400*1e3,T=1e4,h="/api/v1/multisig-transactions",p=404,A=500,m=2,_="0xef0100",R=20,g=_.length+m*R;function I(e){return e.length===g&&e.toLowerCase().startsWith(_)}async function F(e){const{publicClient:t,walletAddress:a,hash:r,confirmations:i,timeout:c,safePollTimeoutMs:l=d,safePollIntervalMs:u=w}=e,s=await t.getCode({address:a});if(!(s!==void 0&&s!=="0x"&&!I(s)))return t.waitForTransactionReceipt({hash:r,confirmations:i,timeout:c});const o=await t.getChainId(),n=await L({chainId:o,publicClient:t,safeTxHash:r,pollIntervalMs:u,timeoutMs:l});return n.kind==="not-a-proposal"?t.waitForTransactionReceipt({hash:r,confirmations:i,timeout:c}):t.waitForTransactionReceipt({hash:n.transactionHash,confirmations:i})}async function C(e,t){return await e.getTransaction({hash:t}).catch(()=>null)!==null}async function L({chainId:e,publicClient:t,safeTxHash:a,pollIntervalMs:r,timeoutMs:i}){const c=f[e];if(!c)throw new Error(`Safe Transaction Service not configured for chainId ${e}. Connected wallet appears to be a smart-contract account, but this chain is not in the supported list. Either connect an EOA or extend SAFE_TX_SERVICE_BASE_URLS in waitForTransactionReceiptSmartAware.ts.`);const l=`${c}${h}/${a}/`,u=Date.now()+i;for(;Date.now()<u;){const s=new AbortController,E=setTimeout(()=>s.abort(),T);let o;try{o=await fetch(l,{signal:s.signal})}catch(n){console.warn(`Safe Transaction Service request failed (will retry in ${r}ms): `+(n instanceof Error?n.message:String(n))),await S(r);continue}finally{clearTimeout(E)}if(o.ok){const n=await o.json();if(n.isExecuted){if(n.isSuccessful===!1)throw new Error(`Safe transaction ${a} was executed on chain but reverted. Check the Safe queue UI for details.`);if(n.transactionHash)return{kind:"executed",transactionHash:n.transactionHash}}}else if(o.status===p){if(await C(t,a))return console.warn(`${a} is a real transaction, not a Safe proposal — the connected wallet submits its own transactions despite reporting contract bytecode. Waiting for its receipt directly.`),{kind:"not-a-proposal"}}else if(o.status>=A)console.warn(`Safe Transaction Service returned ${o.status} for ${a}; retrying in ${r}ms.`);else throw new Error(`Safe Transaction Service returned ${o.status} for ${a}.`);await S(r)}throw new Error(`Timed out after ${i}ms waiting for Safe transaction ${a} to reach quorum and execute. The proposal is still pending in the Safe queue — co-signers must sign and execute it before the dApp can proceed.`)}function S(e){return new Promise(t=>{setTimeout(t,e)})}exports.waitForTransactionReceiptSmartAware=F;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../../src/tbv/core/utils/eth/waitForTransactionReceiptSmartAware.ts"],"sourcesContent":["/**\n * Smart-account-aware wrapper around viem's `waitForTransactionReceipt`.\n *\n * Externally Owned Accounts (EOAs) — wallets controlled by a single private\n * key, e.g. MetaMask or a hardware wallet. `eth_sendTransaction` returns a real\n * Ethereum tx hash, which viem can poll directly. This wrapper delegates\n * unchanged for them.\n *\n * Smart-contract accounts (e.g. Safe multisigs) — the wallet address is a\n * deployed contract that decides whether to accept a transaction. WalletConnect's\n * `eth_sendTransaction` returns a `safeTxHash` (an EIP-712 hash of the\n * *proposal*) rather than a real tx hash, and the proposal is held in Safe's\n * off-chain Transaction Service until quorum signs and executes it. We poll\n * that service for the proposal until execution, then wait for receipt on the\n * real Ethereum tx hash exposed in the service's response.\n *\n * The two are told apart by `eth_getCode`, but NOT by \"empty vs non-empty\":\n * an EIP-7702 delegated EOA reports `0xef0100 ‖ <delegate address>` and is\n * still an EOA — it signs and submits its own transactions, so\n * `eth_sendTransaction` returns a real tx hash. MetaMask upgrades accounts to\n * smart accounts this way by default, and treating one as a Safe means polling\n * the Transaction Service for a hash that is not a `safeTxHash`: a permanent\n * 404 that reads as \"proposal not yet indexed\" and hangs for the full poll\n * budget on a transaction that already succeeded. Delegation designators are\n * therefore classified as EOAs. As a backstop for any wallet that behaves this\n * way in future, a 404 from the Transaction Service is also checked against the\n * node: if it knows the hash as a real transaction, we were never waiting on a\n * proposal and switch to waiting for that transaction's receipt.\n *\n * @module utils/eth\n */\n\nimport type { Address, Hash, PublicClient, TransactionReceipt } from \"viem\";\n\n/**\n * Chains where the Safe Transaction Service is supported by this utility.\n * Extend the map as more Safe-enabled chains are needed.\n */\nconst SAFE_TX_SERVICE_BASE_URLS: Record<number, string> = {\n 1: \"https://safe-transaction-mainnet.safe.global\",\n 11155111: \"https://safe-transaction-sepolia.safe.global\",\n};\n\nconst DEFAULT_SAFE_POLL_INTERVAL_MS = 5_000;\nconst DEFAULT_SAFE_POLL_TIMEOUT_MS = 4 * 60 * 60 * 1_000;\nconst SAFE_TX_SERVICE_FETCH_TIMEOUT_MS = 10_000;\n\n/** Safe Transaction Service route for one multisig-transaction proposal. */\nconst SAFE_MULTISIG_TX_PATH = \"/api/v1/multisig-transactions\";\n/** The service answers 404 both for an unindexed proposal and an unknown Safe. */\nconst SAFE_TX_SERVICE_NOT_FOUND = 404;\n/** Statuses at or above this are server-side, so worth retrying. */\nconst SAFE_TX_SERVICE_SERVER_ERROR = 500;\n\n/** Two hex characters encode one byte in an `eth_getCode` result. */\nconst HEX_CHARS_PER_BYTE = 2;\n\n/**\n * EIP-7702 delegation designator: an EOA that has delegated its code to a\n * contract reports exactly `0xef0100 ‖ <20-byte delegate address>` from\n * `eth_getCode` (EIP-7702 §\"Delegation Designation\"). Both the prefix and the\n * exact length are checked so ordinary contract bytecode that merely happens to\n * start with these bytes is not mistaken for a delegation.\n */\nconst EIP_7702_DELEGATION_PREFIX = \"0xef0100\";\nconst EIP_7702_DELEGATION_ADDRESS_BYTES = 20;\nconst EIP_7702_DELEGATION_CODE_LENGTH =\n EIP_7702_DELEGATION_PREFIX.length +\n HEX_CHARS_PER_BYTE * EIP_7702_DELEGATION_ADDRESS_BYTES;\n\n/**\n * True when `eth_getCode` reports an EIP-7702 delegation designator rather than\n * a deployed contract. Such an account is still an EOA for our purposes: it\n * signs and submits its own transactions, so the hash we hold is a real tx hash.\n */\nfunction isEip7702DelegatedEoa(code: string): boolean {\n return (\n code.length === EIP_7702_DELEGATION_CODE_LENGTH &&\n code.toLowerCase().startsWith(EIP_7702_DELEGATION_PREFIX)\n );\n}\n\nexport interface WaitForTransactionReceiptSmartAwareParams {\n publicClient: PublicClient;\n walletAddress: Address;\n hash: Hash;\n /**\n * Forwarded to viem verbatim.\n *\n * MUST NOT be used as a finality/reorg gate. viem fetches the receipt once\n * and then only compares block numbers against that cached copy — it never\n * re-checks that the receipt's block is still canonical, so it resolves\n * happily for a transaction that has been reorged out. Setting this buys a\n * delay, not a guarantee. For peg-in registration finality use\n * `waitForPeginRegistrationDepth`, which re-reads live contract state on\n * every poll.\n */\n confirmations?: number;\n /**\n * Forwarded to viem on the EOA (externally owned account) path, and on the\n * fallback where a supposed smart account turns out to submit its own\n * transactions — that is the EOA case too, however we arrived at it.\n *\n * Ignored only while waiting on a genuine Safe proposal, whose budget is\n * safePollTimeoutMs. It is not forwarded to the receipt wait that follows a\n * proposal's execution either: viem's own default applies there (180s as of\n * viem 2.38.2), so that wait is bounded too — a sufficiently slow node still\n * raises WaitForTransactionReceiptTimeoutError, just on viem's uniform bound\n * rather than on a caller's shorter one.\n */\n timeout?: number;\n /** Total budget for waiting on Safe quorum + execution. Default 4h. */\n safePollTimeoutMs?: number;\n /** Poll cadence against the Safe Transaction Service. Default 5s. */\n safePollIntervalMs?: number;\n}\n\nexport async function waitForTransactionReceiptSmartAware(\n params: WaitForTransactionReceiptSmartAwareParams,\n): Promise<TransactionReceipt> {\n const {\n publicClient,\n walletAddress,\n hash,\n confirmations,\n timeout,\n safePollTimeoutMs = DEFAULT_SAFE_POLL_TIMEOUT_MS,\n safePollIntervalMs = DEFAULT_SAFE_POLL_INTERVAL_MS,\n } = params;\n\n const code = await publicClient.getCode({ address: walletAddress });\n // An EIP-7702 delegated EOA has non-empty code but still submits its own\n // transactions, so it belongs on the EOA path — see the module docblock.\n const isSmartAccount =\n code !== undefined && code !== \"0x\" && !isEip7702DelegatedEoa(code);\n\n if (!isSmartAccount) {\n return publicClient.waitForTransactionReceipt({\n hash,\n confirmations,\n timeout,\n });\n }\n\n const chainId = await publicClient.getChainId();\n const outcome = await pollSafeTransactionServiceUntilExecuted({\n chainId,\n publicClient,\n safeTxHash: hash,\n pollIntervalMs: safePollIntervalMs,\n timeoutMs: safePollTimeoutMs,\n });\n\n // The wallet turned out to submit its own transactions, so this is the EOA\n // case after all — including the caller's `timeout`, which only ever meant to\n // be ignored while waiting on a genuine Safe proposal.\n if (outcome.kind === \"not-a-proposal\") {\n return publicClient.waitForTransactionReceipt({\n hash,\n confirmations,\n timeout,\n });\n }\n\n return publicClient.waitForTransactionReceipt({\n hash: outcome.transactionHash,\n confirmations,\n });\n}\n\n/**\n * How the Safe path ended. The two outcomes are not interchangeable, so they are\n * distinguished rather than both collapsing to a bare hash: `executed` is a real\n * Safe proposal that reached quorum, while `not-a-proposal` means the wallet was\n * never a Safe and we are really on the EOA path — which decides whether the\n * caller's `timeout` applies to the receipt wait that follows.\n */\ntype SafePollOutcome =\n | { kind: \"executed\"; transactionHash: Hash }\n | { kind: \"not-a-proposal\" };\n\ninterface SafeMultisigTransaction {\n isExecuted: boolean;\n isSuccessful: boolean | null;\n transactionHash: Hash | null;\n}\n\n/**\n * Decide whether a 404 from the Transaction Service means \"proposal not indexed\n * yet\" or \"this hash was never a proposal at all\".\n *\n * The Safe indexer cannot answer that: a genuine Safe and its freshly-submitted\n * proposal are both absent from it for a while, so its 404 proves nothing. The\n * NODE can. A `safeTxHash` is an EIP-712 digest of a proposal and is never a\n * transaction on chain, so if the node knows the hash as a real transaction then\n * this was never a proposal and we are on the wrong path entirely.\n *\n * Returns true only on that positive identification. Anything else — the node\n * has not seen it yet, or the lookup fails — is inconclusive and leaves the\n * caller polling, which is the correct behaviour for a Safe that is simply\n * still being indexed.\n */\nasync function hashIsRealTransaction(\n publicClient: PublicClient,\n hash: Hash,\n): Promise<boolean> {\n const transaction = await publicClient\n .getTransaction({ hash })\n .catch(() => null);\n return transaction !== null;\n}\n\nasync function pollSafeTransactionServiceUntilExecuted({\n chainId,\n publicClient,\n safeTxHash,\n pollIntervalMs,\n timeoutMs,\n}: {\n chainId: number;\n publicClient: PublicClient;\n safeTxHash: Hash;\n pollIntervalMs: number;\n timeoutMs: number;\n}): Promise<SafePollOutcome> {\n const baseUrl = SAFE_TX_SERVICE_BASE_URLS[chainId];\n if (!baseUrl) {\n throw new Error(\n `Safe Transaction Service not configured for chainId ${chainId}. ` +\n `Connected wallet appears to be a smart-contract account, but this ` +\n `chain is not in the supported list. Either connect an EOA or extend ` +\n `SAFE_TX_SERVICE_BASE_URLS in waitForTransactionReceiptSmartAware.ts.`,\n );\n }\n\n const url = `${baseUrl}${SAFE_MULTISIG_TX_PATH}/${safeTxHash}/`;\n const deadline = Date.now() + timeoutMs;\n\n while (Date.now() < deadline) {\n const controller = new AbortController();\n const fetchTimeoutId = setTimeout(\n () => controller.abort(),\n SAFE_TX_SERVICE_FETCH_TIMEOUT_MS,\n );\n\n let response: Response;\n try {\n response = await fetch(url, { signal: controller.signal });\n } catch (err) {\n // Transient failure (AbortError on per-request timeout, DNS hiccup,\n // connection reset, etc.). Log and continue to the next poll iteration\n // instead of consuming the entire safePollTimeoutMs budget on one blip.\n // The outer `while (Date.now() < deadline)` is what enforces the overall\n // budget; this catch deliberately preserves it.\n console.warn(\n `Safe Transaction Service request failed (will retry in ${pollIntervalMs}ms): ` +\n (err instanceof Error ? err.message : String(err)),\n );\n await sleep(pollIntervalMs);\n continue;\n } finally {\n clearTimeout(fetchTimeoutId);\n }\n\n if (response.ok) {\n const data = (await response.json()) as SafeMultisigTransaction;\n if (data.isExecuted) {\n if (data.isSuccessful === false) {\n throw new Error(\n `Safe transaction ${safeTxHash} was executed on chain but reverted. ` +\n `Check the Safe queue UI for details.`,\n );\n }\n if (data.transactionHash) {\n return { kind: \"executed\", transactionHash: data.transactionHash };\n }\n }\n } else if (response.status === SAFE_TX_SERVICE_NOT_FOUND) {\n // Usually \"proposal not indexed yet\", so keep polling. But the very same\n // 404 appears when the hash is not a safeTxHash at all — the case that\n // used to burn the whole budget on an already-mined transaction. Ask the\n // node: if it knows this hash, it is a real transaction, so stop treating\n // it as a proposal and let the caller wait on it directly.\n if (await hashIsRealTransaction(publicClient, safeTxHash)) {\n console.warn(\n `${safeTxHash} is a real transaction, not a Safe proposal — the ` +\n `connected wallet submits its own transactions despite reporting ` +\n `contract bytecode. Waiting for its receipt directly.`,\n );\n return { kind: \"not-a-proposal\" };\n }\n } else if (response.status >= SAFE_TX_SERVICE_SERVER_ERROR) {\n // Transient server error — same treatment as a hung connection: log and retry.\n console.warn(\n `Safe Transaction Service returned ${response.status} for ${safeTxHash}; retrying in ${pollIntervalMs}ms.`,\n );\n } else {\n // Other 4xx (403, 410, etc.) is likely permanent — surface immediately.\n throw new Error(\n `Safe Transaction Service returned ${response.status} for ${safeTxHash}.`,\n );\n }\n\n await sleep(pollIntervalMs);\n }\n\n throw new Error(\n `Timed out after ${timeoutMs}ms waiting for Safe transaction ${safeTxHash} ` +\n `to reach quorum and execute. The proposal is still pending in the Safe ` +\n `queue — co-signers must sign and execute it before the dApp can proceed.`,\n );\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n"],"names":["SAFE_TX_SERVICE_BASE_URLS","DEFAULT_SAFE_POLL_INTERVAL_MS","DEFAULT_SAFE_POLL_TIMEOUT_MS","SAFE_TX_SERVICE_FETCH_TIMEOUT_MS","SAFE_MULTISIG_TX_PATH","SAFE_TX_SERVICE_NOT_FOUND","SAFE_TX_SERVICE_SERVER_ERROR","HEX_CHARS_PER_BYTE","EIP_7702_DELEGATION_PREFIX","EIP_7702_DELEGATION_ADDRESS_BYTES","EIP_7702_DELEGATION_CODE_LENGTH","isEip7702DelegatedEoa","code","waitForTransactionReceiptSmartAware","params","publicClient","walletAddress","hash","confirmations","timeout","safePollTimeoutMs","safePollIntervalMs","chainId","outcome","pollSafeTransactionServiceUntilExecuted","hashIsRealTransaction","safeTxHash","pollIntervalMs","timeoutMs","baseUrl","url","deadline","controller","fetchTimeoutId","response","err","sleep","data","ms","resolve"],"mappings":"gFAsCA,MAAMA,EAAoD,CACxD,EAAG,+CACH,SAAU,8CACZ,EAEMC,EAAgC,IAChCC,EAA+B,MAAc,IAC7CC,EAAmC,IAGnCC,EAAwB,gCAExBC,EAA4B,IAE5BC,EAA+B,IAG/BC,EAAqB,EASrBC,EAA6B,WAC7BC,EAAoC,GACpCC,EACJF,EAA2B,OAC3BD,EAAqBE,EAOvB,SAASE,EAAsBC,EAAuB,CACpD,OACEA,EAAK,SAAWF,GAChBE,EAAK,YAAA,EAAc,WAAWJ,CAA0B,CAE5D,CAqCA,eAAsBK,EACpBC,EAC6B,CAC7B,KAAM,CACJ,aAAAC,EACA,cAAAC,EACA,KAAAC,EACA,cAAAC,EACA,QAAAC,EACA,kBAAAC,EAAoBlB,EACpB,mBAAAmB,EAAqBpB,CAAA,EACnBa,EAEEF,EAAO,MAAMG,EAAa,QAAQ,CAAE,QAASC,EAAe,EAMlE,GAAI,EAFFJ,IAAS,QAAaA,IAAS,MAAQ,CAACD,EAAsBC,CAAI,GAGlE,OAAOG,EAAa,0BAA0B,CAC5C,KAAAE,EACA,cAAAC,EACA,QAAAC,CAAA,CACD,EAGH,MAAMG,EAAU,MAAMP,EAAa,WAAA,EAC7BQ,EAAU,MAAMC,EAAwC,CAC5D,QAAAF,EACA,aAAAP,EACA,WAAYE,EACZ,eAAgBI,EAChB,UAAWD,CAAA,CACZ,EAKD,OAAIG,EAAQ,OAAS,iBACZR,EAAa,0BAA0B,CAC5C,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AQ,KACN,GAAGA,CAAU,wKAAA,EAIR,CAAE,KAAM,gBAAA,UAERQ,EAAS,QAAU5B,EAE5B,QAAQ,KACN,qCAAqC4B,EAAS,MAAM,QAAQR,CAAU,iBAAiBC,CAAc,KAAA,MAIvG,OAAM,IAAI,MACR,qCAAqCO,EAAS,MAAM,QAAQR,CAAU,GAAA,EAI1E,MAAMU,EAAMT,CAAc,CAC5B,CAEA,MAAM,IAAI,MACR,mBAAmBC,CAAS,mCAAmCF,CAAU,kJAAA,CAI7E,CAEA,SAASU,EAAME,EAA2B,CACxC,OAAO,IAAI,QAASC,GAAY,CAC9B,WAAWA,EAASD,CAAE,CACxB,CAAC,CACH"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const f = {
|
|
2
|
+
1: "https://safe-transaction-mainnet.safe.global",
|
|
3
|
+
11155111: "https://safe-transaction-sepolia.safe.global"
|
|
4
|
+
}, w = 5e3, d = 14400 * 1e3, T = 1e4, h = "/api/v1/multisig-transactions", p = 404, A = 500, m = 2, _ = "0xef0100", R = 20, g = _.length + m * R;
|
|
5
|
+
function I(e) {
|
|
6
|
+
return e.length === g && e.toLowerCase().startsWith(_);
|
|
7
|
+
}
|
|
8
|
+
async function L(e) {
|
|
9
|
+
const {
|
|
10
|
+
publicClient: t,
|
|
11
|
+
walletAddress: a,
|
|
12
|
+
hash: r,
|
|
13
|
+
confirmations: i,
|
|
14
|
+
timeout: c,
|
|
15
|
+
safePollTimeoutMs: l = d,
|
|
16
|
+
safePollIntervalMs: u = w
|
|
17
|
+
} = e, s = await t.getCode({ address: a });
|
|
18
|
+
if (!(s !== void 0 && s !== "0x" && !I(s)))
|
|
19
|
+
return t.waitForTransactionReceipt({
|
|
20
|
+
hash: r,
|
|
21
|
+
confirmations: i,
|
|
22
|
+
timeout: c
|
|
23
|
+
});
|
|
24
|
+
const o = await t.getChainId(), n = await C({
|
|
25
|
+
chainId: o,
|
|
26
|
+
publicClient: t,
|
|
27
|
+
safeTxHash: r,
|
|
28
|
+
pollIntervalMs: u,
|
|
29
|
+
timeoutMs: l
|
|
30
|
+
});
|
|
31
|
+
return n.kind === "not-a-proposal" ? t.waitForTransactionReceipt({
|
|
32
|
+
hash: r,
|
|
33
|
+
confirmations: i,
|
|
34
|
+
timeout: c
|
|
35
|
+
}) : t.waitForTransactionReceipt({
|
|
36
|
+
hash: n.transactionHash,
|
|
37
|
+
confirmations: i
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async function F(e, t) {
|
|
41
|
+
return await e.getTransaction({ hash: t }).catch(() => null) !== null;
|
|
42
|
+
}
|
|
43
|
+
async function C({
|
|
44
|
+
chainId: e,
|
|
45
|
+
publicClient: t,
|
|
46
|
+
safeTxHash: a,
|
|
47
|
+
pollIntervalMs: r,
|
|
48
|
+
timeoutMs: i
|
|
49
|
+
}) {
|
|
50
|
+
const c = f[e];
|
|
51
|
+
if (!c)
|
|
52
|
+
throw new Error(
|
|
53
|
+
`Safe Transaction Service not configured for chainId ${e}. Connected wallet appears to be a smart-contract account, but this chain is not in the supported list. Either connect an EOA or extend SAFE_TX_SERVICE_BASE_URLS in waitForTransactionReceiptSmartAware.ts.`
|
|
54
|
+
);
|
|
55
|
+
const l = `${c}${h}/${a}/`, u = Date.now() + i;
|
|
56
|
+
for (; Date.now() < u; ) {
|
|
57
|
+
const s = new AbortController(), E = setTimeout(
|
|
58
|
+
() => s.abort(),
|
|
59
|
+
T
|
|
60
|
+
);
|
|
61
|
+
let o;
|
|
62
|
+
try {
|
|
63
|
+
o = await fetch(l, { signal: s.signal });
|
|
64
|
+
} catch (n) {
|
|
65
|
+
console.warn(
|
|
66
|
+
`Safe Transaction Service request failed (will retry in ${r}ms): ` + (n instanceof Error ? n.message : String(n))
|
|
67
|
+
), await S(r);
|
|
68
|
+
continue;
|
|
69
|
+
} finally {
|
|
70
|
+
clearTimeout(E);
|
|
71
|
+
}
|
|
72
|
+
if (o.ok) {
|
|
73
|
+
const n = await o.json();
|
|
74
|
+
if (n.isExecuted) {
|
|
75
|
+
if (n.isSuccessful === !1)
|
|
76
|
+
throw new Error(
|
|
77
|
+
`Safe transaction ${a} was executed on chain but reverted. Check the Safe queue UI for details.`
|
|
78
|
+
);
|
|
79
|
+
if (n.transactionHash)
|
|
80
|
+
return { kind: "executed", transactionHash: n.transactionHash };
|
|
81
|
+
}
|
|
82
|
+
} else if (o.status === p) {
|
|
83
|
+
if (await F(t, a))
|
|
84
|
+
return console.warn(
|
|
85
|
+
`${a} is a real transaction, not a Safe proposal — the connected wallet submits its own transactions despite reporting contract bytecode. Waiting for its receipt directly.`
|
|
86
|
+
), { kind: "not-a-proposal" };
|
|
87
|
+
} else if (o.status >= A)
|
|
88
|
+
console.warn(
|
|
89
|
+
`Safe Transaction Service returned ${o.status} for ${a}; retrying in ${r}ms.`
|
|
90
|
+
);
|
|
91
|
+
else
|
|
92
|
+
throw new Error(
|
|
93
|
+
`Safe Transaction Service returned ${o.status} for ${a}.`
|
|
94
|
+
);
|
|
95
|
+
await S(r);
|
|
96
|
+
}
|
|
97
|
+
throw new Error(
|
|
98
|
+
`Timed out after ${i}ms waiting for Safe transaction ${a} to reach quorum and execute. The proposal is still pending in the Safe queue — co-signers must sign and execute it before the dApp can proceed.`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function S(e) {
|
|
102
|
+
return new Promise((t) => {
|
|
103
|
+
setTimeout(t, e);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
export {
|
|
107
|
+
L as waitForTransactionReceiptSmartAware
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/tbv/core/utils/eth/waitForTransactionReceiptSmartAware.ts"],"sourcesContent":["/**\n * Smart-account-aware wrapper around viem's `waitForTransactionReceipt`.\n *\n * Externally Owned Accounts (EOAs) — wallets controlled by a single private\n * key, e.g. MetaMask or a hardware wallet. `eth_sendTransaction` returns a real\n * Ethereum tx hash, which viem can poll directly. This wrapper delegates\n * unchanged for them.\n *\n * Smart-contract accounts (e.g. Safe multisigs) — the wallet address is a\n * deployed contract that decides whether to accept a transaction. WalletConnect's\n * `eth_sendTransaction` returns a `safeTxHash` (an EIP-712 hash of the\n * *proposal*) rather than a real tx hash, and the proposal is held in Safe's\n * off-chain Transaction Service until quorum signs and executes it. We poll\n * that service for the proposal until execution, then wait for receipt on the\n * real Ethereum tx hash exposed in the service's response.\n *\n * The two are told apart by `eth_getCode`, but NOT by \"empty vs non-empty\":\n * an EIP-7702 delegated EOA reports `0xef0100 ‖ <delegate address>` and is\n * still an EOA — it signs and submits its own transactions, so\n * `eth_sendTransaction` returns a real tx hash. MetaMask upgrades accounts to\n * smart accounts this way by default, and treating one as a Safe means polling\n * the Transaction Service for a hash that is not a `safeTxHash`: a permanent\n * 404 that reads as \"proposal not yet indexed\" and hangs for the full poll\n * budget on a transaction that already succeeded. Delegation designators are\n * therefore classified as EOAs. As a backstop for any wallet that behaves this\n * way in future, a 404 from the Transaction Service is also checked against the\n * node: if it knows the hash as a real transaction, we were never waiting on a\n * proposal and switch to waiting for that transaction's receipt.\n *\n * @module utils/eth\n */\n\nimport type { Address, Hash, PublicClient, TransactionReceipt } from \"viem\";\n\n/**\n * Chains where the Safe Transaction Service is supported by this utility.\n * Extend the map as more Safe-enabled chains are needed.\n */\nconst SAFE_TX_SERVICE_BASE_URLS: Record<number, string> = {\n 1: \"https://safe-transaction-mainnet.safe.global\",\n 11155111: \"https://safe-transaction-sepolia.safe.global\",\n};\n\nconst DEFAULT_SAFE_POLL_INTERVAL_MS = 5_000;\nconst DEFAULT_SAFE_POLL_TIMEOUT_MS = 4 * 60 * 60 * 1_000;\nconst SAFE_TX_SERVICE_FETCH_TIMEOUT_MS = 10_000;\n\n/** Safe Transaction Service route for one multisig-transaction proposal. */\nconst SAFE_MULTISIG_TX_PATH = \"/api/v1/multisig-transactions\";\n/** The service answers 404 both for an unindexed proposal and an unknown Safe. */\nconst SAFE_TX_SERVICE_NOT_FOUND = 404;\n/** Statuses at or above this are server-side, so worth retrying. */\nconst SAFE_TX_SERVICE_SERVER_ERROR = 500;\n\n/** Two hex characters encode one byte in an `eth_getCode` result. */\nconst HEX_CHARS_PER_BYTE = 2;\n\n/**\n * EIP-7702 delegation designator: an EOA that has delegated its code to a\n * contract reports exactly `0xef0100 ‖ <20-byte delegate address>` from\n * `eth_getCode` (EIP-7702 §\"Delegation Designation\"). Both the prefix and the\n * exact length are checked so ordinary contract bytecode that merely happens to\n * start with these bytes is not mistaken for a delegation.\n */\nconst EIP_7702_DELEGATION_PREFIX = \"0xef0100\";\nconst EIP_7702_DELEGATION_ADDRESS_BYTES = 20;\nconst EIP_7702_DELEGATION_CODE_LENGTH =\n EIP_7702_DELEGATION_PREFIX.length +\n HEX_CHARS_PER_BYTE * EIP_7702_DELEGATION_ADDRESS_BYTES;\n\n/**\n * True when `eth_getCode` reports an EIP-7702 delegation designator rather than\n * a deployed contract. Such an account is still an EOA for our purposes: it\n * signs and submits its own transactions, so the hash we hold is a real tx hash.\n */\nfunction isEip7702DelegatedEoa(code: string): boolean {\n return (\n code.length === EIP_7702_DELEGATION_CODE_LENGTH &&\n code.toLowerCase().startsWith(EIP_7702_DELEGATION_PREFIX)\n );\n}\n\nexport interface WaitForTransactionReceiptSmartAwareParams {\n publicClient: PublicClient;\n walletAddress: Address;\n hash: Hash;\n /**\n * Forwarded to viem verbatim.\n *\n * MUST NOT be used as a finality/reorg gate. viem fetches the receipt once\n * and then only compares block numbers against that cached copy — it never\n * re-checks that the receipt's block is still canonical, so it resolves\n * happily for a transaction that has been reorged out. Setting this buys a\n * delay, not a guarantee. For peg-in registration finality use\n * `waitForPeginRegistrationDepth`, which re-reads live contract state on\n * every poll.\n */\n confirmations?: number;\n /**\n * Forwarded to viem on the EOA (externally owned account) path, and on the\n * fallback where a supposed smart account turns out to submit its own\n * transactions — that is the EOA case too, however we arrived at it.\n *\n * Ignored only while waiting on a genuine Safe proposal, whose budget is\n * safePollTimeoutMs. It is not forwarded to the receipt wait that follows a\n * proposal's execution either: viem's own default applies there (180s as of\n * viem 2.38.2), so that wait is bounded too — a sufficiently slow node still\n * raises WaitForTransactionReceiptTimeoutError, just on viem's uniform bound\n * rather than on a caller's shorter one.\n */\n timeout?: number;\n /** Total budget for waiting on Safe quorum + execution. Default 4h. */\n safePollTimeoutMs?: number;\n /** Poll cadence against the Safe Transaction Service. Default 5s. */\n safePollIntervalMs?: number;\n}\n\nexport async function waitForTransactionReceiptSmartAware(\n params: WaitForTransactionReceiptSmartAwareParams,\n): Promise<TransactionReceipt> {\n const {\n publicClient,\n walletAddress,\n hash,\n confirmations,\n timeout,\n safePollTimeoutMs = DEFAULT_SAFE_POLL_TIMEOUT_MS,\n safePollIntervalMs = DEFAULT_SAFE_POLL_INTERVAL_MS,\n } = params;\n\n const code = await publicClient.getCode({ address: walletAddress });\n // An EIP-7702 delegated EOA has non-empty code but still submits its own\n // transactions, so it belongs on the EOA path — see the module docblock.\n const isSmartAccount =\n code !== undefined && code !== \"0x\" && !isEip7702DelegatedEoa(code);\n\n if (!isSmartAccount) {\n return publicClient.waitForTransactionReceipt({\n hash,\n confirmations,\n timeout,\n });\n }\n\n const chainId = await publicClient.getChainId();\n const outcome = await pollSafeTransactionServiceUntilExecuted({\n chainId,\n publicClient,\n safeTxHash: hash,\n pollIntervalMs: safePollIntervalMs,\n timeoutMs: safePollTimeoutMs,\n });\n\n // The wallet turned out to submit its own transactions, so this is the EOA\n // case after all — including the caller's `timeout`, which only ever meant to\n // be ignored while waiting on a genuine Safe proposal.\n if (outcome.kind === \"not-a-proposal\") {\n return publicClient.waitForTransactionReceipt({\n hash,\n confirmations,\n timeout,\n });\n }\n\n return publicClient.waitForTransactionReceipt({\n hash: outcome.transactionHash,\n confirmations,\n });\n}\n\n/**\n * How the Safe path ended. The two outcomes are not interchangeable, so they are\n * distinguished rather than both collapsing to a bare hash: `executed` is a real\n * Safe proposal that reached quorum, while `not-a-proposal` means the wallet was\n * never a Safe and we are really on the EOA path — which decides whether the\n * caller's `timeout` applies to the receipt wait that follows.\n */\ntype SafePollOutcome =\n | { kind: \"executed\"; transactionHash: Hash }\n | { kind: \"not-a-proposal\" };\n\ninterface SafeMultisigTransaction {\n isExecuted: boolean;\n isSuccessful: boolean | null;\n transactionHash: Hash | null;\n}\n\n/**\n * Decide whether a 404 from the Transaction Service means \"proposal not indexed\n * yet\" or \"this hash was never a proposal at all\".\n *\n * The Safe indexer cannot answer that: a genuine Safe and its freshly-submitted\n * proposal are both absent from it for a while, so its 404 proves nothing. The\n * NODE can. A `safeTxHash` is an EIP-712 digest of a proposal and is never a\n * transaction on chain, so if the node knows the hash as a real transaction then\n * this was never a proposal and we are on the wrong path entirely.\n *\n * Returns true only on that positive identification. Anything else — the node\n * has not seen it yet, or the lookup fails — is inconclusive and leaves the\n * caller polling, which is the correct behaviour for a Safe that is simply\n * still being indexed.\n */\nasync function hashIsRealTransaction(\n publicClient: PublicClient,\n hash: Hash,\n): Promise<boolean> {\n const transaction = await publicClient\n .getTransaction({ hash })\n .catch(() => null);\n return transaction !== null;\n}\n\nasync function pollSafeTransactionServiceUntilExecuted({\n chainId,\n publicClient,\n safeTxHash,\n pollIntervalMs,\n timeoutMs,\n}: {\n chainId: number;\n publicClient: PublicClient;\n safeTxHash: Hash;\n pollIntervalMs: number;\n timeoutMs: number;\n}): Promise<SafePollOutcome> {\n const baseUrl = SAFE_TX_SERVICE_BASE_URLS[chainId];\n if (!baseUrl) {\n throw new Error(\n `Safe Transaction Service not configured for chainId ${chainId}. ` +\n `Connected wallet appears to be a smart-contract account, but this ` +\n `chain is not in the supported list. Either connect an EOA or extend ` +\n `SAFE_TX_SERVICE_BASE_URLS in waitForTransactionReceiptSmartAware.ts.`,\n );\n }\n\n const url = `${baseUrl}${SAFE_MULTISIG_TX_PATH}/${safeTxHash}/`;\n const deadline = Date.now() + timeoutMs;\n\n while (Date.now() < deadline) {\n const controller = new AbortController();\n const fetchTimeoutId = setTimeout(\n () => controller.abort(),\n SAFE_TX_SERVICE_FETCH_TIMEOUT_MS,\n );\n\n let response: Response;\n try {\n response = await fetch(url, { signal: controller.signal });\n } catch (err) {\n // Transient failure (AbortError on per-request timeout, DNS hiccup,\n // connection reset, etc.). Log and continue to the next poll iteration\n // instead of consuming the entire safePollTimeoutMs budget on one blip.\n // The outer `while (Date.now() < deadline)` is what enforces the overall\n // budget; this catch deliberately preserves it.\n console.warn(\n `Safe Transaction Service request failed (will retry in ${pollIntervalMs}ms): ` +\n (err instanceof Error ? err.message : String(err)),\n );\n await sleep(pollIntervalMs);\n continue;\n } finally {\n clearTimeout(fetchTimeoutId);\n }\n\n if (response.ok) {\n const data = (await response.json()) as SafeMultisigTransaction;\n if (data.isExecuted) {\n if (data.isSuccessful === false) {\n throw new Error(\n `Safe transaction ${safeTxHash} was executed on chain but reverted. ` +\n `Check the Safe queue UI for details.`,\n );\n }\n if (data.transactionHash) {\n return { kind: \"executed\", transactionHash: data.transactionHash };\n }\n }\n } else if (response.status === SAFE_TX_SERVICE_NOT_FOUND) {\n // Usually \"proposal not indexed yet\", so keep polling. But the very same\n // 404 appears when the hash is not a safeTxHash at all — the case that\n // used to burn the whole budget on an already-mined transaction. Ask the\n // node: if it knows this hash, it is a real transaction, so stop treating\n // it as a proposal and let the caller wait on it directly.\n if (await hashIsRealTransaction(publicClient, safeTxHash)) {\n console.warn(\n `${safeTxHash} is a real transaction, not a Safe proposal — the ` +\n `connected wallet submits its own transactions despite reporting ` +\n `contract bytecode. Waiting for its receipt directly.`,\n );\n return { kind: \"not-a-proposal\" };\n }\n } else if (response.status >= SAFE_TX_SERVICE_SERVER_ERROR) {\n // Transient server error — same treatment as a hung connection: log and retry.\n console.warn(\n `Safe Transaction Service returned ${response.status} for ${safeTxHash}; retrying in ${pollIntervalMs}ms.`,\n );\n } else {\n // Other 4xx (403, 410, etc.) is likely permanent — surface immediately.\n throw new Error(\n `Safe Transaction Service returned ${response.status} for ${safeTxHash}.`,\n );\n }\n\n await sleep(pollIntervalMs);\n }\n\n throw new Error(\n `Timed out after ${timeoutMs}ms waiting for Safe transaction ${safeTxHash} ` +\n `to reach quorum and execute. The proposal is still pending in the Safe ` +\n `queue — co-signers must sign and execute it before the dApp can proceed.`,\n );\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n"],"names":["SAFE_TX_SERVICE_BASE_URLS","DEFAULT_SAFE_POLL_INTERVAL_MS","DEFAULT_SAFE_POLL_TIMEOUT_MS","SAFE_TX_SERVICE_FETCH_TIMEOUT_MS","SAFE_MULTISIG_TX_PATH","SAFE_TX_SERVICE_NOT_FOUND","SAFE_TX_SERVICE_SERVER_ERROR","HEX_CHARS_PER_BYTE","EIP_7702_DELEGATION_PREFIX","EIP_7702_DELEGATION_ADDRESS_BYTES","EIP_7702_DELEGATION_CODE_LENGTH","isEip7702DelegatedEoa","code","waitForTransactionReceiptSmartAware","params","publicClient","walletAddress","hash","confirmations","timeout","safePollTimeoutMs","safePollIntervalMs","chainId","outcome","pollSafeTransactionServiceUntilExecuted","hashIsRealTransaction","safeTxHash","pollIntervalMs","timeoutMs","baseUrl","url","deadline","controller","fetchTimeoutId","response","err","sleep","data","ms","resolve"],"mappings":"AAsCA,MAAMA,IAAoD;AAAA,EACxD,GAAG;AAAA,EACH,UAAU;AACZ,GAEMC,IAAgC,KAChCC,IAA+B,QAAc,KAC7CC,IAAmC,KAGnCC,IAAwB,iCAExBC,IAA4B,KAE5BC,IAA+B,KAG/BC,IAAqB,GASrBC,IAA6B,YAC7BC,IAAoC,IACpCC,IACJF,EAA2B,SAC3BD,IAAqBE;AAOvB,SAASE,EAAsBC,GAAuB;AACpD,SACEA,EAAK,WAAWF,KAChBE,EAAK,YAAA,EAAc,WAAWJ,CAA0B;AAE5D;AAqCA,eAAsBK,EACpBC,GAC6B;AAC7B,QAAM;AAAA,IACJ,cAAAC;AAAA,IACA,eAAAC;AAAA,IACA,MAAA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,EACxB,CAAC;AACH;"}
|
|
@@ -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 i=require("../../../abortSignals-msbmbqFe.cjs"),a=require("../../../signing-BJ3X66b-.cjs"),_=require("../../../validation-C6XTfZak.cjs"),n=require("./eth/index.cjs"),e=require("../../../psbtInputFields-BIxBpPj2.cjs"),t=require("../../../fundPeginTransaction-BLD8FRL9.cjs"),E=require("../../../reservation-Dr2HLCxx.cjs"),T=require("../../../bitcoin-D-O2GjbC.cjs");exports.combineAbortSignals=i.combineAbortSignals;exports.calculateBtcTxHash=a.calculateBtcTxHash;exports.createTaprootScriptPathSignOptions=a.createTaprootScriptPathSignOptions;exports.BITCOIN_ADDRESS_RE=_.BITCOIN_ADDRESS_RE;exports.COMPRESSED_PUBKEY_HEX_LEN=_.COMPRESSED_PUBKEY_HEX_LEN;exports.HEX_RE=_.HEX_RE;exports.KNOWN_SCRIPT_PREFIXES=_.KNOWN_SCRIPT_PREFIXES;exports.MAX_REASONABLE_FEE_SATS=_.MAX_REASONABLE_FEE_SATS;exports.TXID_RE=_.TXID_RE;exports.X_ONLY_PUBKEY_HEX_LEN=_.X_ONLY_PUBKEY_HEX_LEN;exports.waitForTransactionReceiptSmartAware=n.waitForTransactionReceiptSmartAware;exports.BitcoinScriptType=e.BitcoinScriptType;exports.applyChangeOutputPolicy=e.applyChangeOutputPolicy;exports.computeChangeOutputFeeSats=e.computeChangeOutputFeeSats;exports.computeMaxDeposit=e.computeMaxDeposit;exports.computePeginBaseFeeSats=e.computePeginBaseFeeSats;exports.getDustThreshold=e.getDustThreshold;exports.getPsbtInputFields=e.getPsbtInputFields;exports.getScriptType=e.getScriptType;exports.selectUtxosForPegin=e.selectUtxosForPegin;exports.shouldAddChangeOutput=e.shouldAddChangeOutput;exports.BTC_DUST_SAT=t.BTC_DUST_SAT;exports.DUST_THRESHOLD=t.DUST_THRESHOLD;exports.LOW_RATE_ESTIMATION_ACCURACY_BUFFER=t.LOW_RATE_ESTIMATION_ACCURACY_BUFFER;exports.MAX_NON_LEGACY_OUTPUT_SIZE=t.MAX_NON_LEGACY_OUTPUT_SIZE;exports.MAX_REASONABLE_PEGIN_VBYTES=t.MAX_REASONABLE_PEGIN_VBYTES;exports.P2TR_INPUT_SIZE=t.P2TR_INPUT_SIZE;exports.PEGIN_AUTH_ANCHOR_OUTPUTS=t.PEGIN_AUTH_ANCHOR_OUTPUTS;exports.PEGIN_FIXED_OUTPUTS=t.PEGIN_FIXED_OUTPUTS;exports.SPLIT_TX_FEE_SAFETY_MULTIPLIER=t.SPLIT_TX_FEE_SAFETY_MULTIPLIER;exports.TX_BUFFER_SIZE_OVERHEAD=t.TX_BUFFER_SIZE_OVERHEAD;exports.WALLET_RELAY_FEE_RATE_THRESHOLD=t.WALLET_RELAY_FEE_RATE_THRESHOLD;exports.fundPeginTransaction=t.fundPeginTransaction;exports.parseUnfundedWasmTransaction=t.parseUnfundedWasmTransaction;exports.peginOutputCount=t.peginOutputCount;exports.rateBasedTxBufferFee=t.rateBasedTxBufferFee;exports.UtxoNotAvailableError=E.UtxoNotAvailableError;exports.assertUtxosAvailable=E.assertUtxosAvailable;exports.extractInputsFromTransaction=E.extractInputsFromTransaction;exports.findOverlappingPendingVaults=E.findOverlappingPendingVaults;exports.validateUtxosAvailable=E.validateUtxosAvailable;exports.getNetwork=T.getNetwork;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,52 +1,53 @@
|
|
|
1
1
|
import { c as t } from "../../../abortSignals-BPpAUL1Z.js";
|
|
2
2
|
import { c as E, a as _ } from "../../../signing-Cm-McVR2.js";
|
|
3
|
-
import { B as
|
|
4
|
-
import {
|
|
5
|
-
import { B as
|
|
6
|
-
import {
|
|
7
|
-
import { k as
|
|
3
|
+
import { B as r, C as T, H as p, K as S, M as n, T as i, X as A } from "../../../validation-OSC0xTHB.js";
|
|
4
|
+
import { waitForTransactionReceiptSmartAware as P } from "./eth/index.js";
|
|
5
|
+
import { B as R, a as U, c as u, b as I, d as l, g as N, h as B, f as F, s as f, e as g } from "../../../psbtInputFields-B3e05Xe6.js";
|
|
6
|
+
import { B as L, D as m, L as d, M as C, c as D, P as X, b as H, a as h, S as M, T as b, W as Y, f as v, d as W, p as y, r as G } from "../../../fundPeginTransaction-B2wyjqp0.js";
|
|
7
|
+
import { U as w, a as V, e as Z, f as k, v as j } from "../../../reservation-Cj9F0rP9.js";
|
|
8
|
+
import { k as z } from "../../../bitcoin-C-TuHb-v.js";
|
|
8
9
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
r as BITCOIN_ADDRESS_RE,
|
|
11
|
+
L as BTC_DUST_SAT,
|
|
12
|
+
R as BitcoinScriptType,
|
|
13
|
+
T as COMPRESSED_PUBKEY_HEX_LEN,
|
|
14
|
+
m as DUST_THRESHOLD,
|
|
15
|
+
p as HEX_RE,
|
|
16
|
+
S as KNOWN_SCRIPT_PREFIXES,
|
|
16
17
|
d as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
|
|
17
|
-
|
|
18
|
+
C as MAX_NON_LEGACY_OUTPUT_SIZE,
|
|
18
19
|
n as MAX_REASONABLE_FEE_SATS,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
D as MAX_REASONABLE_PEGIN_VBYTES,
|
|
21
|
+
X as P2TR_INPUT_SIZE,
|
|
22
|
+
H as PEGIN_AUTH_ANCHOR_OUTPUTS,
|
|
23
|
+
h as PEGIN_FIXED_OUTPUTS,
|
|
24
|
+
M as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
|
|
24
25
|
i as TXID_RE,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
b as TX_BUFFER_SIZE_OVERHEAD,
|
|
27
|
+
w as UtxoNotAvailableError,
|
|
28
|
+
Y as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
28
29
|
A as X_ONLY_PUBKEY_HEX_LEN,
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
U as applyChangeOutputPolicy,
|
|
31
|
+
V as assertUtxosAvailable,
|
|
31
32
|
E as calculateBtcTxHash,
|
|
32
33
|
t as combineAbortSignals,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
u as computeChangeOutputFeeSats,
|
|
35
|
+
I as computeMaxDeposit,
|
|
36
|
+
l as computePeginBaseFeeSats,
|
|
36
37
|
_ as createTaprootScriptPathSignOptions,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
Z as extractInputsFromTransaction,
|
|
39
|
+
k as findOverlappingPendingVaults,
|
|
40
|
+
v as fundPeginTransaction,
|
|
41
|
+
N as getDustThreshold,
|
|
42
|
+
z as getNetwork,
|
|
43
|
+
B as getPsbtInputFields,
|
|
44
|
+
F as getScriptType,
|
|
45
|
+
W as parseUnfundedWasmTransaction,
|
|
46
|
+
y as peginOutputCount,
|
|
47
|
+
G as rateBasedTxBufferFee,
|
|
48
|
+
f as selectUtxosForPegin,
|
|
49
|
+
g as shouldAddChangeOutput,
|
|
50
|
+
j as validateUtxosAvailable,
|
|
51
|
+
P as waitForTransactionReceiptSmartAware
|
|
51
52
|
};
|
|
52
53
|
//# 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":";;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../wasm/index.cjs"),e=require("../../../parseFundingOutpoints-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../wasm/index.cjs"),e=require("../../../parseFundingOutpoints-B4iQeX6q.cjs");exports.expandAuthAnchor=t.expandAuthAnchor;exports.expandHashlockSecret=t.expandHashlockSecret;exports.expandWotsSeed=t.expandWotsSeed;exports.VAULT_APP_NAME=e.VAULT_APP_NAME;exports.buildFundingOutpointsCommitment=e.buildFundingOutpointsCommitment;exports.buildVaultContext=e.buildVaultContext;exports.deriveVaultRoot=e.deriveVaultRoot;exports.forwardDeriveContextHash=e.forwardDeriveContextHash;exports.parseFundingOutpointsFromTx=e.parseFundingOutpointsFromTx;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expandAuthAnchor as a, expandHashlockSecret as o, expandWotsSeed as n } from "../wasm/index.js";
|
|
2
|
-
import { V as s, b as d, a as i, d as p, f as u, p as x } from "../../../parseFundingOutpoints-
|
|
2
|
+
import { V as s, b as d, a as i, d as p, f as u, p as x } from "../../../parseFundingOutpoints-B67CoXpF.js";
|
|
3
3
|
export {
|
|
4
4
|
s as VAULT_APP_NAME,
|
|
5
5
|
d as buildFundingOutpointsCommitment,
|