@arkade-os/sdk 0.4.42 → 0.4.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +65 -0
  2. package/dist/adapters/expo.cjs +4 -4
  3. package/dist/adapters/expo.d.cts +2 -2
  4. package/dist/adapters/expo.d.ts +2 -2
  5. package/dist/adapters/expo.js +2 -2
  6. package/dist/adapters/indexedDB.cjs +3 -3
  7. package/dist/adapters/indexedDB.js +2 -2
  8. package/dist/{ark-CKDWpuGL.d.cts → ark-I8jfe5VE.d.cts} +157 -2
  9. package/dist/{ark-CKDWpuGL.d.ts → ark-I8jfe5VE.d.ts} +157 -2
  10. package/dist/{asyncStorageTaskQueue-BB2MffwG.d.ts → asyncStorageTaskQueue-BtSOVZFn.d.ts} +2 -2
  11. package/dist/{asyncStorageTaskQueue-BpN8RRHR.d.cts → asyncStorageTaskQueue-Dap7qUlF.d.cts} +2 -2
  12. package/dist/{chunk-V3FCNVJE.js → chunk-FMI2GKYO.js} +2158 -502
  13. package/dist/chunk-FMI2GKYO.js.map +1 -0
  14. package/dist/{chunk-FLPPSRYH.js → chunk-LCQQPOIT.js} +3 -3
  15. package/dist/{chunk-FLPPSRYH.js.map → chunk-LCQQPOIT.js.map} +1 -1
  16. package/dist/{chunk-5X5YMZHB.js → chunk-LJ35HPJW.js} +39 -5
  17. package/dist/chunk-LJ35HPJW.js.map +1 -0
  18. package/dist/{chunk-HHPUCCB3.cjs → chunk-RJ6XVCX4.cjs} +7 -7
  19. package/dist/{chunk-HHPUCCB3.cjs.map → chunk-RJ6XVCX4.cjs.map} +1 -1
  20. package/dist/{chunk-YEF5FL6E.cjs → chunk-UBYY2TPK.cjs} +39 -4
  21. package/dist/chunk-UBYY2TPK.cjs.map +1 -0
  22. package/dist/{chunk-2V3BU2X6.js → chunk-V7WIZR2B.js} +3 -3
  23. package/dist/{chunk-2V3BU2X6.js.map → chunk-V7WIZR2B.js.map} +1 -1
  24. package/dist/{chunk-T2ACJD22.cjs → chunk-X37EKDIH.cjs} +11 -11
  25. package/dist/{chunk-T2ACJD22.cjs.map → chunk-X37EKDIH.cjs.map} +1 -1
  26. package/dist/{chunk-ED7JDFX4.cjs → chunk-XIVCG6EP.cjs} +2248 -578
  27. package/dist/chunk-XIVCG6EP.cjs.map +1 -0
  28. package/dist/contracts/handlers/index.d.cts +3 -3
  29. package/dist/contracts/handlers/index.d.ts +3 -3
  30. package/dist/{delegate-yjhcR9n4.d.cts → delegate-BRqbh2fW.d.cts} +1 -1
  31. package/dist/{delegate-DllAQ3Eu.d.ts → delegate-CgjVjYOP.d.ts} +1 -1
  32. package/dist/{index-D1te-ZR6.d.cts → index-DHuXlDEg.d.cts} +2 -2
  33. package/dist/{index-DVdCGyyH.d.ts → index-DvWNB_rl.d.ts} +2 -2
  34. package/dist/index.cjs +162 -118
  35. package/dist/index.d.cts +344 -9
  36. package/dist/index.d.ts +344 -9
  37. package/dist/index.js +2 -2
  38. package/dist/repositories/realm/index.cjs +268 -12
  39. package/dist/repositories/realm/index.cjs.map +1 -1
  40. package/dist/repositories/realm/index.d.cts +101 -3
  41. package/dist/repositories/realm/index.d.ts +101 -3
  42. package/dist/repositories/realm/index.js +254 -4
  43. package/dist/repositories/realm/index.js.map +1 -1
  44. package/dist/repositories/sqlite/index.cjs +366 -40
  45. package/dist/repositories/sqlite/index.cjs.map +1 -1
  46. package/dist/repositories/sqlite/index.d.cts +52 -6
  47. package/dist/repositories/sqlite/index.d.ts +52 -6
  48. package/dist/repositories/sqlite/index.js +353 -32
  49. package/dist/repositories/sqlite/index.js.map +1 -1
  50. package/dist/{taskRunner-BdiRy4iI.d.ts → taskRunner-Bptw9UMa.d.ts} +2 -2
  51. package/dist/{taskRunner-CuTk8RYg.d.cts → taskRunner-CeFxKhSH.d.cts} +2 -2
  52. package/dist/wallet/expo/background.cjs +12 -12
  53. package/dist/wallet/expo/background.d.cts +3 -3
  54. package/dist/wallet/expo/background.d.ts +3 -3
  55. package/dist/wallet/expo/background.js +4 -4
  56. package/dist/wallet/expo/index.cjs +12 -12
  57. package/dist/wallet/expo/index.d.cts +4 -4
  58. package/dist/wallet/expo/index.d.ts +4 -4
  59. package/dist/wallet/expo/index.js +3 -3
  60. package/dist/{wallet-CyPOQ0oM.d.cts → wallet-BsqRU8KM.d.cts} +29 -5
  61. package/dist/{wallet-CrIVUQMb.d.ts → wallet-D9z7wssl.d.ts} +29 -5
  62. package/dist/worker/expo/index.cjs +7 -7
  63. package/dist/worker/expo/index.d.cts +4 -4
  64. package/dist/worker/expo/index.d.ts +4 -4
  65. package/dist/worker/expo/index.js +3 -3
  66. package/package.json +2 -2
  67. package/dist/chunk-5X5YMZHB.js.map +0 -1
  68. package/dist/chunk-ED7JDFX4.cjs.map +0 -1
  69. package/dist/chunk-V3FCNVJE.js.map +0 -1
  70. package/dist/chunk-YEF5FL6E.cjs.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { K as ReadonlyIdentity, a as Identity, a7 as DescriptorSigningRequest, a8 as Transaction, a1 as SignerSession, W as WalletRepository, E as ExtendedVirtualCoin, a4 as VtxoRepositoryKey, d as ExtendedCoin, A as ArkTransaction, a5 as WalletState, t as Contract, C as ContractRepository, a6 as ContractFilter, a9 as IntentFeeConfig, aa as OffchainInput, ab as FeeAmount, ac as OnchainInput, ad as FeeOutput, o as ArkProvider, $ as SettlementConfig, ae as ContractWatcherConfig, I as IWallet, af as FeeInfo, j as SettlementEvent, H as DescriptorProvider, i as SettleParams, S as SendBitcoinParams, G as GetVtxosFilter, ag as CreateContractParams, ah as GetContractsFilter, s as VirtualCoin, ai as GetSpendablePathsOptions, aj as GetAllSpendingPathsOptions, R as Recipient, ak as IssuanceParams, al as ReissuanceParams, am as BurnParams, an as RenewVtxosOptions, c as WalletBalance, ao as ContractWithVtxos, ap as PathSelection, aq as ContractEvent, ar as AssetDetails, as as IssuanceResult, at as DelegateInfo, au as MigrationGlobalSkipReason, av as MigrationLegSkipReason, aw as SignerStatus, J as IReadonlyWallet, e as ActivityRegistry, P as IReadonlyAssetManager, ax as StorageConfig, f as Activity, g as IContractManager, k as IAssetManager, h as IDelegateManager, ay as IVtxoManager, O as OnchainProvider, N as Network, Q as NetworkName, Y as Coin, az as ExplorerTransaction, r as TapLeafScript, aA as EncodedVtxoScript, _ as CSVMultisigTapscript, q as RelativeTimelock, V as VtxoScript, aB as Status, aC as Outpoint, aD as ChainTx, p as IndexerProvider, v as TxTree, aE as PathContext } from './ark-CKDWpuGL.cjs';
2
- export { aF as ActivityIntent, aG as ActivityResolver, X as ArkAddress, U as ArkInfo, aH as ArkTapscript, aI as Asset, aJ as AssetMetadata, aK as BaseWalletConfig, z as BatchFailedEvent, x as BatchFinalizationEvent, y as BatchFinalizedEvent, aL as BatchInfo, aM as BatchSignableIdentity, B as BatchStartedEvent, aN as CLTVMultisigTapscript, aO as ChainTxType, aP as CommitmentTx, aQ as ConditionCSVMultisigTapscript, aR as ConditionMultisigTapscript, aS as ContractBalance, aT as ContractEventCallback, aU as ContractHandler, Z as ContractManager, aV as ContractManagerConfig, aW as ContractState, aX as ContractVtxo, aY as ContractWatcher, aZ as DelegateManagerImpl, a_ as DelegateOptions, L as DelegateProvider, a$ as DelegatorManagerImpl, b0 as DelegatorProvider, b1 as DeprecatedSignerMigrationReport, b2 as DeprecatedSignerReport, b3 as DigestMismatchError, b4 as Discoverable, b5 as DiscoveredContract, b6 as DiscoveryDeps, b7 as ESPLORA_URL, b8 as EsploraProvider, b9 as ExtendedContractVtxo, ba as GroupMembership, bb as HandlerError, bc as IDelegatorManager, bd as IndexerTxType, a3 as Intent, be as KnownMetadata, bf as MigrateDeprecatedSignerOptions, bg as MigrationLegReport, bh as MigrationVtxoRef, bi as MultisigTapscript, bj as Nonces, bk as Output, bl as PageResponse, bm as PaginationOptions, bn as PartialSig, bo as ProviderClass, M as ReadonlyWalletConfig, l as RestArkProvider, bp as RestDelegateProvider, bq as RestDelegatorProvider, m as RestIndexerProvider, br as ScanContractsOptions, bs as ScanResult, bt as ScheduledSession, bu as SettlementEventType, bv as SignRequest, a2 as SignedIntent, bw as SignerClassification, bx as SignerSet, by as SubscriptionEvent, bz as SubscriptionHeartbeat, n as SubscriptionResponse, bA as TapLeaves, bB as TapTreeCoder, bC as TapscriptType, bD as TreeNonces, w as TreeNoncesEvent, bE as TreePartialSigs, F as TreeSignatureEvent, u as TreeSigningStartedEvent, D as TreeTxEvent, bF as Tx, bG as TxHistoryRecord, bH as TxKey, T as TxNotification, bI as TxTreeNode, bJ as TxType, bK as VirtualStatus, bL as Vtxo, bM as VtxoChain, a0 as VtxoManager, bN as VtxoType, b as WalletConfig, bO as WalletMode, bP as boardingResolver, bQ as classifyAgainstSignerSet, bR as classifyContractSigner, bS as createDefaultActivityRegistry, bT as decodeTapscript, bU as getNetwork, bV as getSequence, bW as isBatchSignable, bX as isCooperativelyMigratable, bY as isDiscoverable, bZ as isExpired, b_ as isRecoverable, b$ as isSpendable, c0 as isSubdust, c1 as isVtxoExpiringSoon, c2 as networks, c3 as signerSetFromInfo, c4 as toXOnlySignerHex } from './ark-CKDWpuGL.cjs';
3
- export { B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, V as VHTLC, e as VHTLCContractHandler, f as VHTLCContractParams, g as contractHandlers } from './index-D1te-ZR6.cjs';
4
- export { D as DefaultVtxo, a as DelegateVtxo } from './delegate-yjhcR9n4.cjs';
5
- import { W as Wallet, R as ReadonlyWallet, a as ReceiveRotatorFactory, b as ReceiveRotatorBootOpts, c as ReceiveRotatorBoot } from './wallet-CyPOQ0oM.cjs';
6
- export { B as Batch, d as BoardingUtxoGroup, I as IncomingFunds, w as waitForIncomingFunds } from './wallet-CyPOQ0oM.cjs';
1
+ import { K as ReadonlyIdentity, a as Identity, af as DescriptorSigningRequest, ag as Transaction, a3 as SignerSession, P as IntentRepository, a9 as ArkIntent, aa as IntentFilter, ab as Outpoint, Q as VirtualTxRepository, ac as VirtualTx, ad as VtxoBranch, W as WalletRepository, E as ExtendedVirtualCoin, a6 as VtxoRepositoryKey, d as ExtendedCoin, A as ArkTransaction, a7 as WalletState, t as Contract, C as ContractRepository, a8 as ContractFilter, ah as IntentFeeConfig, ai as OffchainInput, aj as FeeAmount, ak as OnchainInput, al as FeeOutput, o as ArkProvider, a1 as SettlementConfig, am as ContractWatcherConfig, I as IWallet, an as FeeInfo, j as SettlementEvent, H as DescriptorProvider, i as SettleParams, S as SendBitcoinParams, G as GetVtxosFilter, ao as CreateContractParams, ap as GetContractsFilter, s as VirtualCoin, aq as GetSpendablePathsOptions, ar as GetAllSpendingPathsOptions, R as Recipient, as as IssuanceParams, at as ReissuanceParams, au as BurnParams, av as RenewVtxosOptions, c as WalletBalance, aw as ContractWithVtxos, ax as PathSelection, ay as ContractEvent, az as AssetDetails, aA as IssuanceResult, aB as DelegateInfo, aC as MigrationGlobalSkipReason, aD as MigrationLegSkipReason, aE as SignerStatus, J as IReadonlyWallet, e as ActivityRegistry, U as IReadonlyAssetManager, aF as StorageConfig, f as Activity, g as IContractManager, k as IAssetManager, h as IDelegateManager, aG as IVtxoManager, O as OnchainProvider, N as Network, X as NetworkName, _ as Coin, aH as ExplorerTransaction, r as TapLeafScript, aI as EncodedVtxoScript, a0 as CSVMultisigTapscript, q as RelativeTimelock, V as VtxoScript, aJ as Status, aK as ChainTx, p as IndexerProvider, v as TxTree, aL as PathContext } from './ark-I8jfe5VE.cjs';
2
+ export { aM as ActivityIntent, aN as ActivityResolver, Z as ArkAddress, Y as ArkInfo, aO as ArkIntentState, aP as ArkTapscript, aQ as Asset, aR as AssetMetadata, aS as BaseWalletConfig, z as BatchFailedEvent, x as BatchFinalizationEvent, y as BatchFinalizedEvent, aT as BatchInfo, aU as BatchSignableIdentity, B as BatchStartedEvent, aV as CLTVMultisigTapscript, aW as ChainTxType, ae as ChainedTxType, aX as CommitmentTx, aY as ConditionCSVMultisigTapscript, aZ as ConditionMultisigTapscript, a_ as ContractBalance, a$ as ContractEventCallback, b0 as ContractHandler, $ as ContractManager, b1 as ContractManagerConfig, b2 as ContractState, b3 as ContractVtxo, b4 as ContractWatcher, b5 as DelegateManagerImpl, b6 as DelegateOptions, L as DelegateProvider, b7 as DelegatorManagerImpl, b8 as DelegatorProvider, b9 as DeprecatedSignerMigrationReport, ba as DeprecatedSignerReport, bb as DigestMismatchError, bc as Discoverable, bd as DiscoveredContract, be as DiscoveryDeps, bf as ESPLORA_URL, bg as EsploraProvider, bh as ExtendedContractVtxo, bi as GroupMembership, bj as HandlerError, bk as IDelegatorManager, bl as INTENT_TERMINAL_STATES, bm as IndexerTxType, a5 as Intent, bn as KnownMetadata, bo as MigrateDeprecatedSignerOptions, bp as MigrationLegReport, bq as MigrationVtxoRef, br as MultisigTapscript, bs as Nonces, bt as Output, bu as PageResponse, bv as PaginationOptions, bw as PartialSig, bx as ProviderClass, M as ReadonlyWalletConfig, l as RestArkProvider, by as RestDelegateProvider, bz as RestDelegatorProvider, m as RestIndexerProvider, bA as ScanContractsOptions, bB as ScanResult, bC as ScheduledSession, bD as SettlementEventType, bE as SignRequest, a4 as SignedIntent, bF as SignerClassification, bG as SignerSet, bH as SubscriptionEvent, bI as SubscriptionHeartbeat, n as SubscriptionResponse, bJ as TapLeaves, bK as TapTreeCoder, bL as TapscriptType, bM as TreeNonces, w as TreeNoncesEvent, bN as TreePartialSigs, F as TreeSignatureEvent, u as TreeSigningStartedEvent, D as TreeTxEvent, bO as Tx, bP as TxHistoryRecord, bQ as TxKey, T as TxNotification, bR as TxTreeNode, bS as TxType, bT as VirtualStatus, bU as Vtxo, bV as VtxoChain, a2 as VtxoManager, bW as VtxoType, b as WalletConfig, bX as WalletMode, bY as boardingResolver, bZ as classifyAgainstSignerSet, b_ as classifyContractSigner, b$ as createDefaultActivityRegistry, c0 as decodeTapscript, c1 as getNetwork, c2 as getSequence, c3 as isBatchSignable, c4 as isCooperativelyMigratable, c5 as isDiscoverable, c6 as isExpired, c7 as isRecoverable, c8 as isSpendable, c9 as isSubdust, ca as isTerminalIntentState, cb as isVtxoExpiringSoon, cc as networks, cd as signerSetFromInfo, ce as toXOnlySignerHex } from './ark-I8jfe5VE.cjs';
3
+ export { B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, V as VHTLC, e as VHTLCContractHandler, f as VHTLCContractParams, g as contractHandlers } from './index-DHuXlDEg.cjs';
4
+ export { D as DefaultVtxo, a as DelegateVtxo } from './delegate-BRqbh2fW.cjs';
5
+ import { W as Wallet, R as ReadonlyWallet, a as ReceiveRotatorFactory, b as ReceiveRotatorBootOpts, c as ReceiveRotatorBoot } from './wallet-BsqRU8KM.cjs';
6
+ export { B as Batch, d as BoardingUtxoGroup, I as IncomingFunds, w as waitForIncomingFunds } from './wallet-BsqRU8KM.cjs';
7
7
  import { Bytes, BTC_NETWORK } from '@scure/btc-signer/utils.js';
8
8
  import { P2TR } from '@scure/btc-signer/payment.js';
9
9
  import { Transaction as Transaction$1 } from '@scure/btc-signer';
@@ -414,6 +414,73 @@ declare class ReadonlySingleKey implements ReadonlyIdentity {
414
414
  compressedPublicKey(): Promise<Uint8Array>;
415
415
  }
416
416
 
417
+ declare class InMemoryIntentRepository implements IntentRepository {
418
+ readonly version: 1;
419
+ private byId;
420
+ clear(): Promise<void>;
421
+ saveIntent(intent: ArkIntent): Promise<void>;
422
+ getIntents(filter?: IntentFilter): Promise<ArkIntent[]>;
423
+ getLockedVtxoOutpoints(): Promise<Outpoint[]>;
424
+ [Symbol.asyncDispose](): Promise<void>;
425
+ }
426
+
427
+ declare class InMemoryVirtualTxRepository implements VirtualTxRepository {
428
+ readonly version: 1;
429
+ private txs;
430
+ private branches;
431
+ clear(): Promise<void>;
432
+ upsertVirtualTxs(txs: VirtualTx[]): Promise<void>;
433
+ getVirtualTx(txid: string): Promise<VirtualTx | null>;
434
+ setBranch(vtxo: Outpoint, branch: VtxoBranch[]): Promise<void>;
435
+ getBranch(vtxo: Outpoint): Promise<VirtualTx[]>;
436
+ hasBranch(vtxo: Outpoint): Promise<boolean>;
437
+ pruneForSpentVtxo(vtxo: Outpoint): Promise<void>;
438
+ [Symbol.asyncDispose](): Promise<void>;
439
+ }
440
+
441
+ /**
442
+ * @experimental Virtual-tx persistence is inert by default. This repository
443
+ * opens its DB at {@link INTENT_DB_VERSION} and creates the virtualtx stores,
444
+ * so it must be given a *dedicated* `dbName` distinct from the wallet/contract
445
+ * DB until this persistence is activated in the shared schema — otherwise the
446
+ * shared DB's version-conflict guard rejects the mismatched open.
447
+ */
448
+ declare class IndexedDBVirtualTxRepository implements VirtualTxRepository {
449
+ private readonly dbName;
450
+ readonly version: 1;
451
+ private db;
452
+ constructor(dbName?: string);
453
+ private getDB;
454
+ clear(): Promise<void>;
455
+ upsertVirtualTxs(txs: VirtualTx[]): Promise<void>;
456
+ getVirtualTx(txid: string): Promise<VirtualTx | null>;
457
+ setBranch(vtxo: Outpoint, branch: VtxoBranch[]): Promise<void>;
458
+ getBranch(vtxo: Outpoint): Promise<VirtualTx[]>;
459
+ hasBranch(vtxo: Outpoint): Promise<boolean>;
460
+ pruneForSpentVtxo(vtxo: Outpoint): Promise<void>;
461
+ [Symbol.asyncDispose](): Promise<void>;
462
+ }
463
+
464
+ /**
465
+ * @experimental Intent persistence is inert by default. This repository opens
466
+ * its DB at {@link INTENT_DB_VERSION} and creates the intent stores, so it must
467
+ * be given a *dedicated* `dbName` distinct from the wallet/contract DB until
468
+ * intent persistence is activated in the shared schema — otherwise the shared
469
+ * DB's version-conflict guard rejects the mismatched open.
470
+ */
471
+ declare class IndexedDBIntentRepository implements IntentRepository {
472
+ private readonly dbName;
473
+ readonly version: 1;
474
+ private db;
475
+ constructor(dbName?: string);
476
+ private getDB;
477
+ clear(): Promise<void>;
478
+ saveIntent(intent: ArkIntent): Promise<void>;
479
+ getIntents(filter?: IntentFilter): Promise<ArkIntent[]>;
480
+ getLockedVtxoOutpoints(): Promise<Outpoint[]>;
481
+ [Symbol.asyncDispose](): Promise<void>;
482
+ }
483
+
417
484
  /**
418
485
  * In-memory implementation of WalletRepository.
419
486
  * Data is ephemeral and scoped to the instance.
@@ -2187,6 +2254,27 @@ declare class OnchainWallet implements AnchorBumper {
2187
2254
  * @see send
2188
2255
  */
2189
2256
  bumpP2A(parent: Transaction): Promise<[string, string]>;
2257
+ /**
2258
+ * Build and sign a CPFP fee child for a parent tx (given as raw hex)
2259
+ * carrying a P2A anchor, funding it from this wallet's **confirmed**
2260
+ * coins, and return the 1P1C package hexes WITHOUT broadcasting.
2261
+ *
2262
+ * This is the graph-mode fee source ({@link ExitFeeWallet}): the exit
2263
+ * executor calls it to bump each transported virtual tx at execution
2264
+ * time, so funding can be deferred rather than pre-signed.
2265
+ *
2266
+ * @param parentHex - Finalized parent transaction, raw network hex
2267
+ * @param feeRate - sat/vB floor for the package (raised to MIN_FEE_RATE)
2268
+ * @returns Tuple of parent hex (unchanged) and signed child hex
2269
+ * @throws If the parent has no anchor, or funding cannot be selected/signed
2270
+ */
2271
+ bumpAnchor(parentHex: string, feeRate: number): Promise<[string, string]>;
2272
+ /**
2273
+ * Shared core of {@link bumpP2A} and {@link bumpAnchor}: probe the package
2274
+ * fee with a single-input child, select coins for it, then build and sign
2275
+ * with the actual selection (the fee grows per extra input).
2276
+ */
2277
+ private buildBumpPackage;
2190
2278
  }
2191
2279
 
2192
2280
  type SetupServiceWorkerOptions = {
@@ -2895,12 +2983,33 @@ declare namespace Unroll {
2895
2983
  readonly bumper: AnchorBumper;
2896
2984
  readonly explorer: OnchainProvider;
2897
2985
  readonly indexer: IndexerProvider;
2986
+ /**
2987
+ * Optional virtual-tx repository. When provided, each step's raw
2988
+ * tx is read from the repo first and fetched from the indexer on a
2989
+ * miss, then cached best-effort for later exits. Omitted ⇒ exact
2990
+ * previous behaviour (indexer only).
2991
+ */
2992
+ readonly virtualTxRepository?: VirtualTxRepository | undefined;
2898
2993
  /** Create an unroll session from a virtual output outpoint and its dependency chain. */
2899
2994
  constructor(toUnroll: Outpoint & {
2900
2995
  chain: ChainTx[];
2901
- }, bumper: AnchorBumper, explorer: OnchainProvider, indexer: IndexerProvider);
2996
+ }, bumper: AnchorBumper, explorer: OnchainProvider, indexer: IndexerProvider,
2997
+ /**
2998
+ * Optional virtual-tx repository. When provided, each step's raw
2999
+ * tx is read from the repo first and fetched from the indexer on a
3000
+ * miss, then cached best-effort for later exits. Omitted ⇒ exact
3001
+ * previous behaviour (indexer only).
3002
+ */
3003
+ virtualTxRepository?: VirtualTxRepository | undefined);
2902
3004
  /** Create an unroll session by loading the virtual output chain from the indexer. */
2903
- static create(toUnroll: Outpoint, bumper: AnchorBumper, explorer: OnchainProvider, indexer: IndexerProvider): Promise<Session>;
3005
+ static create(toUnroll: Outpoint, bumper: AnchorBumper, explorer: OnchainProvider, indexer: IndexerProvider, virtualTxRepository?: VirtualTxRepository): Promise<Session>;
3006
+ /**
3007
+ * Resolve a chain tx's raw PSBT (base64). Repo first when configured;
3008
+ * indexer on a miss, then best-effort cached so a later exit doesn't
3009
+ * re-fetch. Never throws from the cache
3010
+ * write — exit correctness must not depend on persistence.
3011
+ */
3012
+ private resolveVirtualTxBase64;
2904
3013
  /**
2905
3014
  * Get the next step to be executed
2906
3015
  * @returns The next step to be executed + the function to execute it
@@ -2925,6 +3034,216 @@ declare namespace Unroll {
2925
3034
  function completeUnroll(wallet: Wallet, vtxoTxids: string[], outputAddress: string): Promise<string>;
2926
3035
  }
2927
3036
 
3037
+ /** Relative delay before a sweep becomes valid, decoded from BIP-68. */
3038
+ type ExitDelay = {
3039
+ type: "blocks" | "seconds";
3040
+ value: number;
3041
+ };
3042
+ /** Broadcast a single pre-signed transaction (the funding splitter). */
3043
+ type BroadcastStep = {
3044
+ kind: "broadcast";
3045
+ txid: string;
3046
+ hex: string;
3047
+ };
3048
+ /** Broadcast a 1P1C package: virtual tx + its pre-signed CPFP fee child. */
3049
+ type PackageStep = {
3050
+ kind: "package";
3051
+ parentTxid: string;
3052
+ parentHex: string;
3053
+ childTxid: string;
3054
+ childHex: string;
3055
+ /** Outpoints (txid:vout) of the VTXOs this step serves. */
3056
+ forVtxos: string[];
3057
+ };
3058
+ /**
3059
+ * A virtual tx that must go onchain but whose CPFP fee child is NOT
3060
+ * pre-signed (graph mode). The executor builds and signs the child at
3061
+ * execution time using its own fee wallet — this is how "send funds to
3062
+ * this address and we proceed" works: funding is deferred, not baked in.
3063
+ */
3064
+ type BumpStep = {
3065
+ kind: "bump";
3066
+ parentTxid: string;
3067
+ parentHex: string;
3068
+ /** Outpoints (txid:vout) of the VTXOs this step serves. */
3069
+ forVtxos: string[];
3070
+ };
3071
+ /** Broadcast a pre-signed CSV sweep once its dependency matured. */
3072
+ type SweepStep = {
3073
+ kind: "sweep";
3074
+ vtxo: string;
3075
+ txid: string;
3076
+ hex: string;
3077
+ /** The VTXO-creating leaf tx whose confirmation starts the CSV clock. */
3078
+ dependsOnTxid: string;
3079
+ delay: ExitDelay;
3080
+ };
3081
+ type ExitStep = BroadcastStep | PackageStep | BumpStep | SweepStep;
3082
+ /**
3083
+ * How fee funding is provided:
3084
+ * - `"funded"`: a splitter tx (broadcast at prepare time) pre-funds
3085
+ * pre-signed fee children — execution is fully keyless.
3086
+ * - `"graph"`: only the tx graph + sweeps are transported; the executor
3087
+ * funds and signs the CPFP bumps at execution time from its own fee
3088
+ * wallet ("send funds to this address and we proceed").
3089
+ */
3090
+ type ExitMode = "funded" | "graph";
3091
+ /** Per-VTXO metadata; skipped VTXOs carry a human-readable reason. */
3092
+ type ExitVtxoInfo = {
3093
+ outpoint: string;
3094
+ value?: number;
3095
+ sweepFee?: number;
3096
+ /** `${contractType}:${pathLabel}` for observability, e.g. "vhtlc:unilateral". */
3097
+ path?: string;
3098
+ delay?: ExitDelay;
3099
+ skipped?: string;
3100
+ };
3101
+ type ExitTotals = {
3102
+ /** Distinct transactions the executor ensures onchain. */
3103
+ txCount: number;
3104
+ totalFeeSats: number;
3105
+ /** Sats consumed from the onchain wallet by the splitter (fees + funding outputs). */
3106
+ fundingRequiredSats: number;
3107
+ /** Sats arriving at the sweep address once all sweeps confirm. */
3108
+ recoveredSats: number;
3109
+ };
3110
+ /**
3111
+ * Versioned, language-agnostic unilateral exit package.
3112
+ * Everything inside is pre-signed; executing it requires no keys and no
3113
+ * Arkade infrastructure — only an Esplora-compatible API.
3114
+ */
3115
+ type ExitPackage = {
3116
+ version: 1;
3117
+ /** Fee-funding strategy. Absent is treated as "funded" (v1 default). */
3118
+ mode?: ExitMode;
3119
+ network: NetworkName;
3120
+ createdAt: number;
3121
+ /** Min batch expiry (unix seconds) across included txs. Informational. */
3122
+ validUntil?: number;
3123
+ feeRate: number;
3124
+ sweepAddress: string;
3125
+ totals: ExitTotals;
3126
+ vtxos: ExitVtxoInfo[];
3127
+ /** Topologically ordered: a step's txs confirm before dependents proceed. */
3128
+ steps: ExitStep[];
3129
+ };
3130
+ /** Cost/size quote returned by `UnilateralExit.estimate` — no funds needed. */
3131
+ type ExitQuote = {
3132
+ feeRate: number;
3133
+ fundingAddress: string;
3134
+ currentBalanceSats: number;
3135
+ shortfallSats: number;
3136
+ validUntil?: number;
3137
+ totals: ExitTotals;
3138
+ vtxos: ExitVtxoInfo[];
3139
+ };
3140
+ declare function serializeExitPackage(pkg: ExitPackage): string;
3141
+ declare function deserializeExitPackage(json: string): ExitPackage;
3142
+
3143
+ type ExitOptions = {
3144
+ /** Wallet owning the VTXOs: identity (signing) + indexer + onchain provider. */
3145
+ wallet: Wallet;
3146
+ /** Fee funding source and change/funding address. Must share the wallet identity. */
3147
+ onchainWallet: OnchainWallet;
3148
+ /** Destination for the exited funds. */
3149
+ sweepAddress: string;
3150
+ /** sat/vB; defaults to the onchain provider estimate, floored at MIN_FEE_RATE. */
3151
+ feeRate?: number;
3152
+ /** Defaults to all spendable VTXOs. */
3153
+ vtxos?: Outpoint[];
3154
+ /**
3155
+ * Fee-funding strategy (default `"funded"`):
3156
+ * - `"funded"`: broadcast a splitter at prepare time and pre-sign the
3157
+ * fee children — the package executes fully keyless.
3158
+ * - `"graph"`: transport only the tx graph + sweeps; the executor funds
3159
+ * and signs the CPFP bumps at execution time ("send funds to this
3160
+ * address and we proceed"). No splitter, no `onchainWallet` funds used.
3161
+ */
3162
+ mode?: ExitMode;
3163
+ /**
3164
+ * Network label embedded in the package (executor sanity check).
3165
+ * Resolved from the wallet's network when omitted — exact for
3166
+ * "bitcoin" and "regtest"; the tb-family defaults to "testnet", so
3167
+ * pass this explicitly on signet/mutinynet.
3168
+ */
3169
+ networkName?: NetworkName;
3170
+ };
3171
+ /**
3172
+ * Quote a unilateral exit: how many transactions, how many sats of fees,
3173
+ * and how much must be deposited to the funding address. Requires no
3174
+ * onchain funds and signs nothing.
3175
+ */
3176
+ declare function estimate(opts: ExitOptions): Promise<ExitQuote>;
3177
+
3178
+ type ExecutorEvent = {
3179
+ stepIndex: number;
3180
+ kind: ExitStep["kind"];
3181
+ status: "skipped" | "broadcast" | "confirmed" | "waiting_csv" | "failed" | "warning";
3182
+ forVtxos?: string[];
3183
+ txid?: string;
3184
+ reason?: string;
3185
+ /** For waiting_csv with a blocks delay: absolute height at maturity. */
3186
+ maturesAtHeight?: number;
3187
+ /** For waiting_csv with a seconds delay: unix time at maturity. */
3188
+ maturesAtTime?: number;
3189
+ };
3190
+ /**
3191
+ * Fee source for graph-mode `bump` steps. Given a parent tx carrying a P2A
3192
+ * anchor, it builds and signs the CPFP fee child from its own funds and
3193
+ * returns the 1P1C package hexes (parent unchanged, child signed) — WITHOUT
3194
+ * broadcasting; the executor owns broadcast. `OnchainWallet` implements it.
3195
+ */
3196
+ interface ExitFeeWallet {
3197
+ bumpAnchor(parentHex: string, feeRate: number): Promise<[parentHex: string, childHex: string]>;
3198
+ }
3199
+ /**
3200
+ * Keyless, stateless executor for a pre-signed exit package.
3201
+ *
3202
+ * The blockchain is the only state: every action re-checks tx status first,
3203
+ * so the executor can be killed and re-run anywhere at any time. It never
3204
+ * parses transaction hex — it only relays it.
3205
+ */
3206
+ declare class Executor implements AsyncIterable<ExecutorEvent> {
3207
+ readonly pkg: ExitPackage;
3208
+ readonly provider: OnchainProvider;
3209
+ private readonly pollIntervalMs;
3210
+ private readonly feeWallet?;
3211
+ constructor(pkg: ExitPackage, provider: OnchainProvider, opts?: {
3212
+ pollIntervalMs?: number;
3213
+ feeWallet?: ExitFeeWallet;
3214
+ });
3215
+ private sleep;
3216
+ private status;
3217
+ private waitConfirmed;
3218
+ [Symbol.asyncIterator](): AsyncIterator<ExecutorEvent>;
3219
+ }
3220
+
3221
+ /**
3222
+ * Build the fully pre-signed unilateral exit package.
3223
+ *
3224
+ * Signs every transaction needed to land the selected VTXOs onchain and
3225
+ * **broadcasts the funding splitter** as a side effect — reserving the fee
3226
+ * budget so later wallet activity cannot invalidate the package. The
3227
+ * returned package is keyless to execute: hand it to
3228
+ * `UnilateralExit.Executor` (or any Esplora-speaking watchtower).
3229
+ */
3230
+ declare function prepare(opts: ExitOptions): Promise<ExitPackage>;
3231
+
3232
+ /**
3233
+ * Pre-signed unilateral exit.
3234
+ *
3235
+ * `estimate` quotes the cost (tx count, fees, funding required) without
3236
+ * touching funds; `prepare` signs every transaction needed to land the
3237
+ * VTXOs onchain and broadcasts the fee-funding splitter; `Executor` drives
3238
+ * the resulting package to completion with nothing but an
3239
+ * Esplora-compatible endpoint — no keys, no Arkade infrastructure.
3240
+ */
3241
+ declare const UnilateralExit: {
3242
+ readonly estimate: typeof estimate;
3243
+ readonly prepare: typeof prepare;
3244
+ readonly Executor: typeof Executor;
3245
+ };
3246
+
2928
3247
  declare class ArkError extends Error {
2929
3248
  readonly code: number;
2930
3249
  readonly message: string;
@@ -3543,6 +3862,22 @@ declare const buildVersion = "0.9.9";
3543
3862
  * The SDK's own version string, sourced from package.json
3544
3863
  */
3545
3864
  declare const sdkVersion: string;
3865
+ /**
3866
+ * Wraps a transport-level `fetch` rejection (DNS failure, connection refused,
3867
+ * TLS or CORS error) with the request method and URL, preserving the original
3868
+ * as {@link Error.cause}.
3869
+ */
3870
+ declare class FetchError extends Error {
3871
+ /** The request URL that failed, when derivable from the `fetch` input. */
3872
+ readonly url?: string;
3873
+ /** The HTTP method of the failed request (defaults to `"GET"`). */
3874
+ readonly method?: string;
3875
+ constructor(message: string, options: {
3876
+ url?: string;
3877
+ method?: string;
3878
+ cause?: unknown;
3879
+ });
3880
+ }
3546
3881
 
3547
3882
  /**
3548
3883
  * Opens an IndexedDB database and increments the reference count.
@@ -3651,4 +3986,4 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
3651
3986
  burn(params: BurnParams): Promise<string>;
3652
3987
  }
3653
3988
 
3654
- export { Activity, ActivityRegistry, type AnchorBumper, ArkError, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, AssetDetails, AssetManager, BIP322, BurnParams, CSVMultisigTapscript, ChainTx, Coin, ConditionWitness, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DelegateInfo, DelegateNotConfiguredError, DelegatorNotConfiguredError, type DescriptorOptions, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, type BlockHeader as ElectrumBlockHeader, ElectrumOnchainProvider, type TransactionHistory as ElectrumTransactionHistory, type Unspent as ElectrumUnspent, EncodedVtxoScript, Estimator, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, FeeAmount, FeeInfo, FeeOutput, GetVtxosFilter, HDDescriptorProvider, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBWalletRepository, IndexerProvider, IntentFeeConfig, IssuanceParams, IssuanceResult, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, MigrationGlobalSkipReason, MigrationLegSkipReason, type MigrationStatus, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, OffchainInput, type OffchainTx, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, P2A, type ParsedArkContract, PathContext, PathSelection, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TxTree, TxWeightEstimator, Unroll, type VSize, VirtualCoin, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, assembleBtcdTaprootTree, index as asset, buildForfeitTx, buildOffchainTx, buildVersion, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, decodeArkContract, encodeArkContract, getArkPsbtFields, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isCltvSatisfied, isCsvSpendable, isValidArkAddress, maybeArkError, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, sdkVersion, sequenceToTimelock, setArkPsbtField, setupServiceWorker, timelockToSequence, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };
3989
+ export { Activity, ActivityRegistry, type AnchorBumper, ArkError, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, AssetDetails, AssetManager, BIP322, BurnParams, CSVMultisigTapscript, ChainTx, Coin, ConditionWitness, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DelegateInfo, DelegateNotConfiguredError, DelegatorNotConfiguredError, type DescriptorOptions, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, type BlockHeader as ElectrumBlockHeader, ElectrumOnchainProvider, type TransactionHistory as ElectrumTransactionHistory, type Unspent as ElectrumUnspent, EncodedVtxoScript, Estimator, type ExecutorEvent, type ExitDelay, type ExitFeeWallet, type ExitMode, type ExitOptions, type ExitPackage, type ExitQuote, type ExitStep, type ExitTotals, type ExitVtxoInfo, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, FeeAmount, FeeInfo, FeeOutput, FetchError, GetVtxosFilter, HDDescriptorProvider, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, IndexerProvider, IntentFeeConfig, IntentFilter, IntentRepository, IssuanceParams, IssuanceResult, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, MigrationGlobalSkipReason, MigrationLegSkipReason, type MigrationStatus, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, OffchainInput, type OffchainTx, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, P2A, type ParsedArkContract, PathContext, PathSelection, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TxTree, TxWeightEstimator, UnilateralExit, Unroll, type VSize, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, assembleBtcdTaprootTree, index as asset, buildForfeitTx, buildOffchainTx, buildVersion, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, decodeArkContract, deserializeExitPackage, encodeArkContract, getArkPsbtFields, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isCltvSatisfied, isCsvSpendable, isValidArkAddress, maybeArkError, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, sdkVersion, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, timelockToSequence, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };