@arkade-os/sdk 0.5.0-rc.9 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +232 -51
  2. package/dist/adapters/expo.cjs +5 -5
  3. package/dist/adapters/expo.d.cts +5 -5
  4. package/dist/adapters/expo.d.ts +5 -5
  5. package/dist/adapters/expo.js +3 -3
  6. package/dist/{asyncStorageTaskQueue-DZYrAWN8.d.ts → asyncStorageTaskQueue-CdWheMqT.d.ts} +1 -1
  7. package/dist/{asyncStorageTaskQueue-ChKX-D51.d.cts → asyncStorageTaskQueue-DFt5LgW5.d.cts} +1 -1
  8. package/dist/{chunk-R4KRWX7R.js → chunk-3M22PJVB.js} +427 -1078
  9. package/dist/chunk-3M22PJVB.js.map +1 -0
  10. package/dist/{chunk-J2K7WWMJ.js → chunk-6MIGYYWB.js} +112 -243
  11. package/dist/chunk-6MIGYYWB.js.map +1 -0
  12. package/dist/{chunk-FQCMEAWN.js → chunk-FXVEOEYB.js} +32 -39
  13. package/dist/chunk-FXVEOEYB.js.map +1 -0
  14. package/dist/{chunk-7OL2P5TV.cjs → chunk-GQUFPTN7.cjs} +39 -46
  15. package/dist/chunk-GQUFPTN7.cjs.map +1 -0
  16. package/dist/{chunk-VMVHRKXM.cjs → chunk-GW42FS2X.cjs} +494 -1122
  17. package/dist/chunk-GW42FS2X.cjs.map +1 -0
  18. package/dist/{chunk-V4JZOFYT.cjs → chunk-HQNQ3CLQ.cjs} +124 -254
  19. package/dist/chunk-HQNQ3CLQ.cjs.map +1 -0
  20. package/dist/{chunk-PO2ZDZZC.cjs → chunk-JJ6QKTFZ.cjs} +12 -10
  21. package/dist/chunk-JJ6QKTFZ.cjs.map +1 -0
  22. package/dist/{chunk-3TCWQPAC.js → chunk-NKKJEA3Z.js} +5842 -4284
  23. package/dist/chunk-NKKJEA3Z.js.map +1 -0
  24. package/dist/{chunk-JFZBKPSV.js → chunk-QFB55EOZ.js} +541 -400
  25. package/dist/chunk-QFB55EOZ.js.map +1 -0
  26. package/dist/{chunk-PKD5VPYX.cjs → chunk-QKNSMVBW.cjs} +6143 -4565
  27. package/dist/chunk-QKNSMVBW.cjs.map +1 -0
  28. package/dist/{chunk-VTXMC4N7.cjs → chunk-XLHUGP3G.cjs} +548 -399
  29. package/dist/chunk-XLHUGP3G.cjs.map +1 -0
  30. package/dist/{chunk-Z3QM5XFY.js → chunk-XQRIY5K5.js} +7 -5
  31. package/dist/chunk-XQRIY5K5.js.map +1 -0
  32. package/dist/contracts/handlers/index.cjs +9 -9
  33. package/dist/contracts/handlers/index.d.cts +5 -5
  34. package/dist/contracts/handlers/index.d.ts +5 -5
  35. package/dist/contracts/handlers/index.js +2 -2
  36. package/dist/{delegate-CyBnNY9v.d.ts → delegate-BSbGQabI.d.ts} +1 -1
  37. package/dist/{delegate-Cyv2suFd.d.cts → delegate-CFCfrReG.d.cts} +1 -1
  38. package/dist/{index-BIL9boGL.d.ts → index-B3fRWO5i.d.cts} +1652 -2291
  39. package/dist/{index-BIL9boGL.d.cts → index-B3fRWO5i.d.ts} +1652 -2291
  40. package/dist/index-CzUVvIxA.d.ts +645 -0
  41. package/dist/index-Fpf4mQZr.d.cts +645 -0
  42. package/dist/index.cjs +399 -311
  43. package/dist/index.d.cts +957 -1124
  44. package/dist/index.d.ts +957 -1124
  45. package/dist/index.js +4 -4
  46. package/dist/repositories/realm/index.cjs +165 -103
  47. package/dist/repositories/realm/index.cjs.map +1 -1
  48. package/dist/repositories/realm/index.d.cts +18 -14
  49. package/dist/repositories/realm/index.d.ts +18 -14
  50. package/dist/repositories/realm/index.js +153 -91
  51. package/dist/repositories/realm/index.js.map +1 -1
  52. package/dist/repositories/sqlite/index.cjs +226 -184
  53. package/dist/repositories/sqlite/index.cjs.map +1 -1
  54. package/dist/repositories/sqlite/index.d.cts +22 -21
  55. package/dist/repositories/sqlite/index.d.ts +22 -21
  56. package/dist/repositories/sqlite/index.js +218 -176
  57. package/dist/repositories/sqlite/index.js.map +1 -1
  58. package/dist/{taskRunner-Cu4uO1to.d.ts → taskRunner-CdfoCMaw.d.ts} +1 -1
  59. package/dist/{taskRunner-DxpSuKmh.d.cts → taskRunner-Dk6oDAtd.d.cts} +1 -1
  60. package/dist/wallet/expo/background.cjs +14 -14
  61. package/dist/wallet/expo/background.cjs.map +1 -1
  62. package/dist/wallet/expo/background.d.cts +10 -16
  63. package/dist/wallet/expo/background.d.ts +10 -16
  64. package/dist/wallet/expo/background.js +6 -6
  65. package/dist/wallet/expo/background.js.map +1 -1
  66. package/dist/wallet/expo/index.cjs +19 -14
  67. package/dist/wallet/expo/index.cjs.map +1 -1
  68. package/dist/wallet/expo/index.d.cts +8 -6
  69. package/dist/wallet/expo/index.d.ts +8 -6
  70. package/dist/wallet/expo/index.js +10 -5
  71. package/dist/wallet/expo/index.js.map +1 -1
  72. package/dist/wallet-BQHNgc_v.d.ts +1874 -0
  73. package/dist/wallet-D9dvXu-K.d.cts +1874 -0
  74. package/dist/worker/expo/index.cjs +9 -9
  75. package/dist/worker/expo/index.d.cts +6 -6
  76. package/dist/worker/expo/index.d.ts +6 -6
  77. package/dist/worker/expo/index.js +5 -5
  78. package/package.json +10 -11
  79. package/dist/chunk-3TCWQPAC.js.map +0 -1
  80. package/dist/chunk-7OL2P5TV.cjs.map +0 -1
  81. package/dist/chunk-FQCMEAWN.js.map +0 -1
  82. package/dist/chunk-J2K7WWMJ.js.map +0 -1
  83. package/dist/chunk-JFZBKPSV.js.map +0 -1
  84. package/dist/chunk-PKD5VPYX.cjs.map +0 -1
  85. package/dist/chunk-PO2ZDZZC.cjs.map +0 -1
  86. package/dist/chunk-R4KRWX7R.js.map +0 -1
  87. package/dist/chunk-V4JZOFYT.cjs.map +0 -1
  88. package/dist/chunk-VMVHRKXM.cjs.map +0 -1
  89. package/dist/chunk-VTXMC4N7.cjs.map +0 -1
  90. package/dist/chunk-Z3QM5XFY.js.map +0 -1
  91. package/dist/hdWalletCapable-D1ImQqlu.d.cts +0 -2214
  92. package/dist/hdWalletCapable-DvumVrKW.d.ts +0 -2214
  93. package/dist/index-DleNQcz5.d.cts +0 -850
  94. package/dist/index-QVhQgYvU.d.ts +0 -850
package/dist/index.d.ts CHANGED
@@ -1,18 +1,23 @@
1
- import { a7 as ReadonlyIdentity, a as Identity, at as DescriptorSigningRequest, au as Transaction, ap as SignerSession, a5 as DescriptorProvider, av as IntentFeeConfig, aw as OffchainInput, ax as FeeAmount, ay as OnchainInput, az as FeeOutput, H as IntentRepository, J as ArkIntent, K as IntentFilter, O as Outpoint, L as VirtualTxRepository, M as VirtualTx, P as VtxoBranch, W as WalletRepository, z as ExtendedVirtualCoin, B as VtxoRepositoryKey, E as ExtendedCoin, g as ArkTransaction, D as WalletState, y as Contract, C as ContractRepository, F as ContractFilter, I as IWallet, t as ArkProvider, an as SettlementConfig, aA as ContractWatcherConfig, aB as Asset, R as Recipient, aC as FeeInfo, n as SettlementEvent, S as SettleParams, G as GetArkadeInfoOptions, aD as GetVtxosOptions, aE as PaginationOptions, f as GetVtxosFilter, aF as CreateContractParams, aG as GetContractsFilter, x as VirtualCoin, aH as GetSpendablePathsOptions, aI as GetAllSpendingPathsOptions, k as GetNewAddressesOptions, aJ as IssuanceParams, aK as ReissuanceParams, aL as BurnParams, aM as RenewVtxosOptions, A as ArkadeInfo, aN as NormalizedVtxoPage, c as ArkadeReader, d as ArkadeBroadcaster, e as WalletBalance, ae as ContractSyncState, ai as ContractWithVtxos, aO as WatchedScript, aP as PathSelection, l as NewAddress, aQ as ContractEvent, aR as AssetDetails, aS as IssuanceResult, aT as DelegateInfo, aU as MigrationGlobalSkipReason, aV as MigrationLegSkipReason, aW as SignerStatus, a6 as IReadonlyWallet, h as ActivityRegistry, ad as IReadonlyAssetManager, aX as StorageConfig, i as Activity, N as NormalizedExtendedVirtualCoin, j as IContractManager, p as IAssetManager, o as SendParams, m as IDelegateManager, aY as IVtxoManager, a8 as OnchainProvider, U as Network, ag as NetworkName, ak as Coin, aZ as SendBitcoinParams, a_ as ExplorerTransaction, aq as SignedIntent, ar as Intent, a$ as TreeNonces, b0 as TreePartialSigs, T as TxNotificationEvent, b1 as PendingTx, w as TapLeafScript, b2 as EncodedVtxoScript, X as CSVMultisigTapscript, v as RelativeTimelock, V as VtxoScript, b3 as Status, ah as ArkAddress, b4 as ChainTx, u as IndexerProvider, _ as TxTree, b5 as PathContext } from './index-BIL9boGL.js';
2
- export { b6 as ActivityIntent, b7 as ActivityResolver, b8 as ArkIntentState, b9 as ArkTapscript, ba as AssetMetadata, bb as BITCOIN_EMULATOR_PUBKEY, bc as BaseWalletConfig, a2 as BatchFailedEvent, a0 as BatchFinalizationEvent, a1 as BatchFinalizedEvent, bd as BatchInfo, be as BatchSignableIdentity, Y as BatchStartedEvent, bf as CLTVMultisigTapscript, bg as CandidateDeps, bh as ChainTxType, Q as ChainedTxType, bi as CommitmentTx, bj as ConditionCSVMultisigTapscript, bk as ConditionMultisigTapscript, bl as ContractBalance, bm as ContractEventCallback, bn as ContractHandler, al as ContractManager, am as ContractManagerConfig, bo as ContractState, bp as ContractVtxo, bq as ContractVtxoEvent, br as ContractWatcher, bs as DEFAULT_VTXO_PAGE_SIZE, bt as DelegateManagerImpl, bu as DelegateOptions, a9 as DelegateProvider, bv as DeprecatedSignerMigrationReport, bw as DeprecatedSignerReport, bx as DigestMismatchError, by as Discoverable, bz as DiscoveredContract, bA as DiscoveryDeps, bB as ESPLORA_URL, bC as EsploraProvider, bD as EventSourceCapable, bE as EventSourceFactory, bF as EventSourceLike, bG as EventSourceUnavailableError, ab as ExitCaptureMode, bH as ExitChainResolver, ac as ExitDataSource, bI as ExtendedContractVtxo, bJ as GroupMembership, bK as HandlerError, bL as INTENT_TERMINAL_STATES, bM as IndexerTxType, bN as IntentCoin, bO as KnownMetadata, bP as MUTINYNET_EMULATOR_PUBKEY, bQ as MigrateDeprecatedSignerOptions, bR as MigrationLegReport, bS as MigrationVtxoRef, bT as MultisigTapscript, bU as NewAddressType, bV as Nonces, bW as Output, bX as PageResponse, bY as PartialSig, bZ as PrevTxSource, b_ as PrevTxUnavailableError, b$ as ProviderClass, c0 as REGTEST_EMULATOR_PUBKEY, c1 as RawTxSource, aa as ReadonlyWalletConfig, af as RecipientArkadeAddressContext, q as RestArkProvider, c2 as RestDelegateProvider, r as RestIndexerProvider, c3 as ScanContractsOptions, c4 as ScanResult, c5 as ScheduledSession, c6 as SettlementEventType, c7 as SignRequest, c8 as SignerClassification, c9 as SignerSet, ca as SubscriptionEvent, cb as SubscriptionHeartbeat, s as SubscriptionResponse, cc as SweepTxNotification, cd as TapLeaves, ce as TapTreeCoder, cf as TapscriptType, as as TimeHeight, $ as TreeNoncesEvent, a4 as TreeSignatureEvent, Z as TreeSigningStartedEvent, a3 as TreeTxEvent, cg as Tx, ch as TxHistoryRecord, ci as TxKey, cj as TxNotification, ck as TxTag, cl as TxTreeNode, cm as TxType, cn as Vtxo, co as VtxoChain, ao as VtxoManager, cp as VtxoType, b as WalletConfig, cq as WalletMode, cr as WithPrevTx, cs as assertAllowedSighashTypes, ct as assertRecipientArkadeAddress, cu as assetMintResolver, cv as attachPrevArkTxs, cw as attachPrevoutTxs, cx as boardingResolver, cy as canRecoverOnchain, cz as canSpendOffchain, cA as canSweepOnchain, cB as classifyAgainstSignerSet, cC as classifyContractSigner, cD as collabExitResolver, cE as configureEventSource, cF as createDefaultActivityRegistry, cG as createExitChainResolver, cH as decodeTapscript, cI as defaultEmulatorPubkey, cJ as getAllNormalizedVtxos, cK as getConfiguredEventSource, cL as getNetwork, cM as getNormalizedVtxos, cN as getRandomId, cO as getSequence, cP as hasCandidates, cQ as hasTerminalSpend, cR as isBatchSignable, cS as isContractVtxoEvent, cT as isCooperativelyMigratable, cU as isDiscoverable, cV as isEventSourceUnavailableError, cW as isPastExpiry, cX as isSigningIdentity, cY as isSubdust, cZ as isTerminalIntentState, c_ as isVirtualCoin, c$ as isVtxoExpiringSoon, d0 as networkFromArkadeInfo, d1 as networks, d2 as resolveEmulatorPubkey, d3 as resolveEventSource, d4 as resolvePrevTxs, d5 as scriptFromTapLeafScript, d6 as signerSetFromInfo, d7 as toXOnlySignerHex, d8 as withPrevTxs } from './index-BIL9boGL.js';
3
- import { W as Wallet, R as ReadonlyWallet, b as ReceiveRotatorFactory, c as ReceiveRotatorBootOpts, d as ReceiveRotatorBoot, P as ProviderConnectionState, H as HDWalletCapable, a as HDAllocationCapable, A as AddressAllocationCapable, B as BatchExpiryPolicy, e as Batch } from './hdWalletCapable-DvumVrKW.js';
4
- export { f as AbortError, g as ArkError, h as ArkErrorName, i as ArkadeCashClaimResult, j as ArkadeCashCreateError, k as ArkadeCashUnclaimedReason, l as ArkadeCashUnclaimedVtxo, m as BoardingUtxoGroup, C as CheckpointExitDelayPolicy, D as DEFAULT_MIN_BATCH_EXPIRY_SECONDS, n as DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, F as ForeignDescriptorError, I as IncomingFunds, M as MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD, o as MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, p as ProviderKind, q as ProviderUnavailableError, r as REGTEST_MIN_BATCH_EXPIRY_SECONDS, s as REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, S as SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, t as ServerInfoSource, u as ServerResponseMismatchError, v as WaitForIncomingFundsOptions, w as WalletCannotAllocateAddressError, x as assertValidBatchExpiry, y as assertValidServerUnrollScript, z as defaultBatchExpiryPolicy, E as defaultCheckpointExitDelayPolicy, G as isAddressAllocationCapable, J as isArkError, K as isHDAllocationCapable, L as isHDWalletCapable, N as maybeArkError, O as resolveBatchExpiryPolicy, Q as resolveCheckpointExitDelayPolicy, T as resolveDescriptorSigner, U as selectVirtualCoins, V as signingDescriptorIndex, X as strictSigningDescriptorIndex, Y as waitForIncomingFunds } from './hdWalletCapable-DvumVrKW.js';
5
- import { P as Program, A as ArkadeParamValue, a as ArkadeProgramScript, b as ProgramKeys, c as ArkadeArgValue, C as CompiledProgramFunction, d as ArkadeFunction, I as InputRef, e as InputDef, f as ArkadeValueType, g as ArkadeArgType, h as ArkadeContractParams, i as ArkadeSegment, j as AsmToken, S as SUPPORTED_PROGRAM_VERSION, k as SignerRef, T as TapscriptSegment, W as WitnessRef, l as deserializeArkadeContractParams, p as parseArtifact, r as resolveAsm, s as serializeArkadeContractParams, m as stringifyArtifact, v as validateProgram, w as witnessRefToBytes } from './index-QVhQgYvU.js';
6
- export { n as ArkadeContractHandler, B as BoardingContractHandler, o as BoardingContractParams, D as DefaultContractHandler, q as DefaultContractParams, t as DelegateContractHandler, u as DelegateContractParams, V as VHTLC, x as VHTLCContractHandler, y as VHTLCContractParams, z as VHTLCV2ContractHandler, E as VHTLCV2ContractParams, F as contractHandlers } from './index-QVhQgYvU.js';
7
- import { D as DefaultVtxo } from './delegate-CyBnNY9v.js';
8
- export { a as DelegateVtxo } from './delegate-CyBnNY9v.js';
1
+ import { ah as ReadonlyIdentity, a as Identity, a4 as DescriptorSigningRequest, a5 as Transaction, aB as SignerSession, a3 as DescriptorProvider, aF as IntentFeeConfig, aG as OffchainInput, aH as FeeAmount, aI as OnchainInput, aJ as FeeOutput, Y as IntentRepository, Z as ArkIntent, _ as IntentPageFilter, P as PageRequest, F as PageResult, O as Outpoint, $ as VirtualTxRepository, a0 as VirtualTx, a1 as VtxoBranch, W as WalletRepository, D as ExtendedVirtualCoin, H as ScriptVtxoCursor, J as ScriptVtxoPageOptions, K as StoredVtxo, L as VtxoRepositoryKey, E as ExtendedCoin, M as TransactionHistoryPageFilter, Q as TransactionHistoryPageCursor, h as ArkTransaction, U as WalletState, B as Contract, C as ContractRepository, X as ContractFilter, I as IWallet, v as ArkProvider, ar as NetworkName, ai as OnchainProvider, az as SettlementConfig, aK as ContractWatcherConfig, aL as Asset, R as Recipient, aM as FeeInfo, o as SettlementEvent, N as NormalizedExtendedVirtualCoin, S as SettleParams, G as GetArkadeInfoOptions, aN as GetVtxosOptions, aO as PaginationOptions, f as GetVtxosFilter, g as GetSpendableVtxosFilter, aP as CreateContractParams, aQ as GetContractsFilter, z as VirtualCoin, aR as GetSpendablePathsOptions, aS as GetAllSpendingPathsOptions, l as GetNewAddressesOptions, aT as InputExpiryFloor, aU as IssuanceParams, aV as ReissuanceParams, aW as BurnParams, aX as RenewVtxosOptions, A as ArkadeInfo, aY as NormalizedVtxoPage, c as ArkadeReader, d as ArkadeBroadcaster, e as WalletBalance, ao as ContractSyncState, at as ContractWithVtxos, aZ as WatchedScript, a_ as PathSelection, m as NewAddress, a$ as ContractEvent, b0 as AssetDetails, b1 as IssuanceResult, b2 as DelegateInfo, b3 as MigrationGlobalSkipReason, b4 as MigrationLegSkipReason, b5 as SignerStatus, ag as IReadonlyWallet, i as ActivityRegistry, an as IReadonlyAssetManager, b6 as StorageConfig, j as Activity, k as IContractManager, q as IAssetManager, p as SendParams, n as IDelegateManager, b7 as IVtxoManager, a6 as Network, av as Coin, b8 as SendBitcoinParams, b9 as ExplorerTransaction, aC as SignedIntent, aD as Intent, ba as TreeNonces, bb as TreePartialSigs, T as TxNotificationEvent, bc as PendingTx, y as TapLeafScript, bd as EncodedVtxoScript, ay as CSVMultisigTapscript, x as RelativeTimelock, be as EmulatorProvider, V as VtxoScript, bf as Status, as as ArkAddress, bg as ChainTx, w as IndexerProvider, a9 as TxTree, bh as ArkadeService, bi as ContractVtxoEvent, bj as ExtendedContractVtxo, bk as ResolvedArkadeService, bl as resolveArkadeService, bm as PathContext } from './index-B3fRWO5i.js';
2
+ export { bn as ActivityIntent, bo as ActivityResolver, bp as ArkIntentState, bq as ArkTapscript, br as AssetMetadata, bs as BITCOIN_EMULATOR_PUBKEY, bt as BaseWalletConfig, ad as BatchFailedEvent, ab as BatchFinalizationEvent, ac as BatchFinalizedEvent, bu as BatchInfo, bv as BatchSignableIdentity, a7 as BatchStartedEvent, bw as CLTVMultisigTapscript, bx as CandidateDeps, by as ChainTxType, a2 as ChainedTxType, bz as CommitmentTx, bA as ConditionCSVMultisigTapscript, bB as ConditionMultisigTapscript, bC as ConnectorTreeNode, bD as ContractBalance, bE as ContractEventCallback, bF as ContractHandler, aw as ContractManager, ax as ContractManagerConfig, bG as ContractState, bH as ContractVtxo, bI as ContractWatcher, bJ as ContractWatcherEventCallback, bK as DEFAULT_ARKADE_EMULATOR_URL, bL as DEFAULT_VTXO_PAGE_SIZE, bM as DelegateManagerImpl, bN as DelegateOptions, aj as DelegateProvider, bO as DeprecatedSignerMigrationReport, bP as DeprecatedSignerReport, bQ as DigestMismatchError, bR as Discoverable, bS as DiscoveredContract, bT as DiscoveryDeps, bU as ESPLORA_URL, bV as EmulatorInfo, aq as EsploraProvider, bW as EventSourceCapable, bX as EventSourceFactory, bY as EventSourceLike, bZ as EventSourceUnavailableError, al as ExitCaptureMode, b_ as ExitChainResolver, am as ExitDataSource, b$ as GroupMembership, c0 as HandlerError, c1 as INTENT_TERMINAL_STATES, c2 as IndexerTxType, c3 as IntentCoin, c4 as IntentFilter, c5 as KnownMetadata, c6 as MAX_PAGE_SIZE, c7 as MUTINYNET_EMULATOR_PUBKEY, c8 as MigrateDeprecatedSignerOptions, c9 as MigrationLegReport, ca as MigrationVtxoRef, cb as MultisigTapscript, cc as NewAddressType, cd as Nonces, ce as Output, cf as PageResponse, cg as PartialSig, ch as PrevTxSource, ci as PrevTxUnavailableError, cj as ProviderClass, ck as REGTEST_EMULATOR_PUBKEY, cl as RawTxSource, ak as ReadonlyWalletConfig, ap as RecipientArkadeAddressContext, cm as RenewalSplit, cn as RenewalSplitContext, r as RestArkProvider, co as RestDelegateProvider, cp as RestEmulatorProvider, s as RestIndexerProvider, cq as ScanContractsOptions, cr as ScanResult, cs as ScheduledSession, ct as SettlementEventType, cu as SignRequest, cv as SignerClassification, cw as SignerSet, t as SubscriptionEvent, cx as SubscriptionFilter, u as SubscriptionHeartbeat, cy as SubscriptionResponse, cz as SweepTxNotification, cA as TapLeaves, cB as TapTreeCoder, cC as TapscriptType, aE as TimeHeight, aa as TreeNoncesEvent, af as TreeSignatureEvent, a8 as TreeSigningStartedEvent, ae as TreeTxEvent, cD as Tx, cE as TxHistoryRecord, cF as TxKey, cG as TxNotification, cH as TxTag, cI as TxTreeNode, cJ as TxType, cK as Vtxo, cL as VtxoChain, aA as VtxoManager, cM as VtxoType, b as WalletConfig, cN as WalletMode, cO as WithPrevTx, cP as assertAllowedSighashTypes, cQ as assertPageRequest, cR as assertRecipientArkadeAddress, cS as assetMintResolver, cT as attachPrevArkTxs, cU as attachPrevoutTxs, cV as boardingResolver, cW as canRecoverOnchain, cX as canSpendOffchain, cY as canSweepOnchain, cZ as classifyAgainstSignerSet, c_ as classifyContractSigner, c$ as collabExitResolver, d0 as collectContracts, d1 as collectIntents, d2 as collectPages, d3 as collectScriptVtxos, d4 as collectTransactionHistory, d5 as collectUtxos, d6 as collectVtxos, d7 as configureEventSource, d8 as createDefaultActivityRegistry, d9 as createExitChainResolver, da as decodeTapscript, db as defaultEmulatorPubkey, dc as getAllNormalizedVtxos, dd as getConfiguredEventSource, de as getNetwork, df as getNormalizedVtxos, dg as getRandomId, dh as getSequence, di as hasCandidates, dj as isBatchSignable, dk as isContractVtxoEvent, dl as isCooperativelyMigratable, dm as isDiscoverable, dn as isEventSourceUnavailableError, dp as isPastExpiry, dq as isSigningIdentity, dr as isSubdust, ds as isTerminalIntentState, dt as isVirtualCoin, du as isVtxoExpiringSoon, dv as isVtxoSpent, dw as iteratePages, dx as networkFromArkadeInfo, dy as networks, dz as pageResult, dA as resolveEmulatorPubkey, dB as resolveEventSource, dC as resolvePrevTxs, dD as scriptFromTapLeafScript, dE as signerSetFromInfo, dF as toOffchainInputFeeParams, dG as toXOnlySignerHex, dH as withPrevTxs } from './index-B3fRWO5i.js';
3
+ import { W as Wallet, R as ReadonlyWallet, b as ReceiveRotatorFactory, c as ReceiveRotatorBootOpts, d as ReceiveRotatorBoot, P as ProviderConnectionState, H as HDWalletCapable, a as HDAllocationCapable, A as AddressAllocationCapable, B as BatchExpiryPolicy, e as Batch } from './wallet-BQHNgc_v.js';
4
+ export { f as AbortError, g as ArkError, h as ArkErrorName, i as ArkadeCashClaimResult, j as ArkadeCashCreateError, k as ArkadeCashOperatorMismatchError, l as ArkadeCashUnclaimedReason, m as ArkadeCashUnclaimedVtxo, n as ArkadeCashVtxoRef, o as BoardingUtxoGroup, D as DEFAULT_MIN_BATCH_EXPIRY_SECONDS, F as ForeignDescriptorError, I as IncomingFunds, p as IndexedDBWalletRepository, K as KeyringDescriptorProvider, M as MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD, q as ProviderKind, r as ProviderUnavailableError, s as REGTEST_MIN_BATCH_EXPIRY_SECONDS, S as ServerInfoSource, t as ServerResponseMismatchError, V as VtxoReservation, u as VtxoReservedError, v as WaitForIncomingFundsOptions, w as WalletCannotAllocateAddressError, x as assertValidBatchExpiry, y as defaultBatchExpiryPolicy, z as isAddressAllocationCapable, C as isArkError, E as isHDAllocationCapable, G as isHDWalletCapable, J as maybeArkError, L as resolveBatchExpiryPolicy, N as resolveDescriptorSigner, O as selectVirtualCoins, Q as signingDescriptorIndex, T as strictSigningDescriptorIndex, U as waitForIncomingFunds } from './wallet-BQHNgc_v.js';
5
+ import { P as Program, A as ArkadeParamValue, a as ArkadeProgramScript, b as ProgramKeys, c as ArkadeArgValue, C as CompiledProgramFunction, d as ArkadeFunction, I as InputDef, e as ArkadeValueType, f as ArkadeArgType, g as ArkadeContractParams, h as ArkadeSegment, i as AsmToken, j as InputRef, S as SUPPORTED_PROGRAM_VERSION, k as SignerRef, T as TapscriptSegment, l as TweakedSigner, U as UnsupportedProgramVersionError, W as WitnessRef, m as deserializeArkadeContractParams, p as parseArtifact, r as resolveAsm, s as serializeArkadeContractParams, n as stringifyArtifact, v as validateProgram, w as witnessRefToBytes } from './index-CzUVvIxA.js';
6
+ export { o as ArkadeContractHandler, B as BoardingContractHandler, q as BoardingContractParams, D as DefaultContractHandler, t as DefaultContractParams, u as DelegateContractHandler, x as DelegateContractParams, V as VHTLC, y as VHTLCContractHandler, z as VHTLCContractParams, E as VHTLCV2ContractHandler, F as VHTLCV2ContractParams, G as contractHandlers } from './index-CzUVvIxA.js';
7
+ import { D as DefaultVtxo } from './delegate-BSbGQabI.js';
8
+ export { a as DelegateVtxo } from './delegate-BSbGQabI.js';
9
9
  import { Bytes, BTC_NETWORK } from '@scure/btc-signer/utils.js';
10
10
  import { P2TR } from '@scure/btc-signer/payment.js';
11
11
  import { Transaction as Transaction$1, OP, Script, ScriptType } from '@scure/btc-signer';
12
12
  import { ElectrumWS } from 'ws-electrumx-client';
13
13
  import { TransactionOutput, TransactionInputUpdate } from '@scure/btc-signer/psbt.js';
14
- import { Transaction as Transaction$2 } from '@scure/btc-signer/transaction.js';
15
14
  import * as P from 'micro-packed';
15
+ import '@scure/btc-signer/transaction.js';
16
+
17
+ /** Validate an optional millisecond duration; zero retains its caller-defined meaning. */
18
+ declare function assertNonNegativeMs(name: string, ms: number | undefined): void;
19
+ /** Validate a timer delay without changing whether zero disables or immediately fires it. */
20
+ declare function assertTimerMs(name: string, ms: number | undefined): void;
16
21
 
17
22
  /**
18
23
  * Tagged envelope for a signing identity transported across the
@@ -109,9 +114,8 @@ interface NetworkOptions {
109
114
  /** Used for a caller-supplied account-descriptor template. */
110
115
  interface DescriptorOptions {
111
116
  /**
112
- * Account-descriptor *template* — must end with the BIP-32 wildcard
113
- * suffix `/*)`. Stored as-is on {@link SeedIdentity.descriptor} and
114
- * read by HD providers to rotate through derivation indices.
117
+ * Account-descriptor *template*; must end with the BIP-32 wildcard suffix `/*)`. Stored as-is
118
+ * on {@link SeedIdentity.descriptor} for HD providers to rotate through indices.
115
119
  */
116
120
  descriptor: string;
117
121
  }
@@ -123,32 +127,18 @@ type MnemonicOptions = SeedIdentityOptions & {
123
127
  passphrase?: string;
124
128
  };
125
129
  /**
126
- * Seed-based identity derived from a raw seed and an account descriptor
127
- * *template*.
128
- *
129
- * This is the recommended identity type for most applications. It uses
130
- * standard BIP86 (Taproot) derivation by default; callers that need a
131
- * different path supply the wildcard template directly.
130
+ * Seed-based identity derived from a raw seed and an account descriptor *template*.
132
131
  *
133
- * Prefer this (or @see MnemonicIdentity) over `SingleKey` for new
134
- * integrations — `SingleKey` exists for backward compatibility with
135
- * raw nsec-style keys.
132
+ * The recommended identity type: BIP86 (Taproot) derivation by default, or a caller-supplied
133
+ * wildcard template. Prefer it (or @see MnemonicIdentity) over `SingleKey`, which exists for
134
+ * backward compatibility with raw nsec-style keys.
136
135
  *
137
- * The identity holds the wildcard *template* (e.g.
138
- * `tr([fp/86'/0'/0']xpub/0/*)`) on its public {@link descriptor}
139
- * field. HD rotation reads it directly; consumers that need a
140
- * concrete descriptor at a specific index materialize it themselves
141
- * (see `HDDescriptorProvider` in the wallet layer).
136
+ * {@link descriptor} holds the wildcard template (e.g. `tr([fp/86'/0'/0']xpub/0/*)`); consumers
137
+ * materialize concrete indices themselves (see `HDDescriptorProvider`).
142
138
  *
143
- * Exposes seed-level primitives (signing, derivation, the template)
144
- * but is deliberately NOT a `DescriptorProvider`. Wrap it explicitly
145
- * to get one:
146
- * - `HDDescriptorProvider` for rotating receive addresses.
147
- * - {@link StaticDescriptorProvider} for legacy, single-key behaviour.
148
- *
149
- * The split prevents a SeedIdentity from being silently used as a
150
- * concrete descriptor source, which would defeat HD rotation without
151
- * any compile-time signal that something was wrong.
139
+ * Deliberately NOT a `DescriptorProvider`, so it can't silently be used as a concrete
140
+ * descriptor source and defeat HD rotation. Wrap it in `HDDescriptorProvider` (rotating
141
+ * receive addresses) or {@link StaticDescriptorProvider} (legacy single-key behaviour).
152
142
  *
153
143
  * @example
154
144
  * ```typescript
@@ -166,34 +156,21 @@ type MnemonicOptions = SeedIdentityOptions & {
166
156
  */
167
157
  declare class SeedIdentity implements HDCapableIdentity {
168
158
  private readonly derivedKey;
169
- /**
170
- * Wildcard account-descriptor template (e.g.
171
- * `tr([fp/86'/0'/0']xpub/0/*)`). The canonical thing to pass
172
- * through the system; consumers materialize a concrete descriptor
173
- * at a specific index themselves (see `HDDescriptorProvider` in
174
- * the wallet layer for the rotating-counter use case).
175
- */
159
+ /** Wildcard account-descriptor template (e.g. `tr([fp/86'/0'/0']xpub/0/*)`). */
176
160
  readonly descriptor: string;
177
161
  /**
178
- * Constructs a SeedIdentity from a 64-byte seed and either a
179
- * caller-supplied wildcard descriptor (`{ descriptor }`) or the
180
- * default BIP86 path at the requested network (`{ isMainnet }`).
181
- * Prefer the {@link fromSeed} factory for symmetry with
182
- * {@link MnemonicIdentity.fromMnemonic}.
162
+ * Constructs a SeedIdentity from a 64-byte seed and either a wildcard `{ descriptor }` or the
163
+ * default BIP86 path for `{ isMainnet }`. Prefer {@link fromSeed}.
183
164
  *
184
- * Throws on a non-wildcard descriptor, an xpub mismatch with the
185
- * seed, or a missing derivation path.
165
+ * Throws on a non-wildcard descriptor, an xpub mismatch with the seed, or a missing
166
+ * derivation path.
186
167
  */
187
168
  constructor(seed: Uint8Array, opts?: SeedIdentityOptions);
188
169
  /**
189
- * Creates a SeedIdentity from a raw 64-byte seed.
190
- *
191
- * Pass `{ isMainnet }` for default BIP86 derivation, or
192
- * `{ descriptor }` for a caller-supplied account-descriptor
193
- * template (the option's value must end with `/*)`).
170
+ * Creates a SeedIdentity from a raw 64-byte seed: `{ isMainnet }` for default BIP86
171
+ * derivation, or `{ descriptor }` for a template ending in `/*)`.
194
172
  *
195
173
  * @param seed - 64-byte seed (typically from mnemonicToSeedSync)
196
- * @param opts - Network selection or descriptor template.
197
174
  */
198
175
  static fromSeed(seed: Uint8Array, opts?: SeedIdentityOptions): SeedIdentity;
199
176
  xOnlyPublicKey(): Promise<Uint8Array>;
@@ -201,22 +178,13 @@ declare class SeedIdentity implements HDCapableIdentity {
201
178
  sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
202
179
  signMessage(message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
203
180
  /**
204
- * BIP-340 sign `messageHash` with this identity's own key, aux_rand = 0.
205
- *
206
- * The descriptor-less sibling of
207
- * {@link signSchnorrDeterministicWithDescriptor}, for an `auto`-mode wallet
208
- * whose bare `tr(pubkey)` resolves to the identity itself rather than to a
209
- * {@link DescriptorIdentity}. Deliberately NOT routed through
210
- * `signMessage`, whose schnorr branch draws a random aux_rand and would
211
- * make the "deterministic" signature unreproducible.
181
+ * BIP-340 sign `messageHash` with this identity's own key, aux_rand = 0 (for an `auto`-mode
182
+ * wallet whose bare `tr(pubkey)` resolves to the identity itself). NOT via `signMessage`,
183
+ * whose random aux_rand would make the signature unreproducible.
212
184
  */
213
185
  signSchnorrDeterministic(messageHash: Uint8Array): Promise<Uint8Array>;
214
186
  signerSession(): SignerSession;
215
- /**
216
- * Converts to a watch-only identity that cannot sign. Carries the
217
- * template forward, so the readonly side stays HD-capable (can
218
- * derive descriptors at any index without seed access).
219
- */
187
+ /** Watch-only copy; carries the template forward, so it stays HD-capable without the seed. */
220
188
  toReadonly(): Promise<ReadonlyDescriptorIdentity>;
221
189
  /** Returns true when `descriptor` is derived from this identity's seed. */
222
190
  ownsDescriptor(descriptor: string): boolean;
@@ -238,12 +206,8 @@ declare class SeedIdentity implements HDCapableIdentity {
238
206
  private signMessageWithKey;
239
207
  }
240
208
  /**
241
- * Mnemonic-based identity derived from a BIP39 phrase.
242
- *
243
- * This is the most user-friendly identity type — recommended for wallet
244
- * applications where users manage their own backup phrase. Extends
245
- * @see SeedIdentity with mnemonic validation and optional passphrase
246
- * support.
209
+ * Mnemonic-based identity derived from a BIP39 phrase; recommended where users manage their own
210
+ * backup phrase. Extends @see SeedIdentity with mnemonic validation and an optional passphrase.
247
211
  *
248
212
  * @example
249
213
  * ```typescript
@@ -256,27 +220,16 @@ declare class SeedIdentity implements HDCapableIdentity {
256
220
  declare class MnemonicIdentity extends SeedIdentity {
257
221
  private constructor();
258
222
  /**
259
- * Creates a MnemonicIdentity from a BIP39 mnemonic phrase.
260
- *
261
- * Pass `{ isMainnet }` for default BIP86 derivation, or
262
- * `{ descriptor }` for a caller-supplied account-descriptor
263
- * template (the option's value must end with `/*)`).
223
+ * Creates a MnemonicIdentity from a BIP39 phrase: `{ isMainnet }` for default BIP86
224
+ * derivation, or `{ descriptor }` for a template ending in `/*)`, plus optional passphrase.
264
225
  *
265
226
  * @param phrase - BIP39 mnemonic phrase (12 or 24 words)
266
- * @param opts - Network selection or descriptor template, plus optional passphrase
267
227
  */
268
228
  static fromMnemonic(phrase: string, opts?: MnemonicOptions): MnemonicIdentity;
269
229
  }
270
230
  /**
271
- * Watch-only HD identity from a descriptor *template*.
272
- *
273
- * Can derive public keys but cannot sign transactions. Use this for
274
- * watch-only wallets — given just an xpub-based template, the readonly
275
- * side still rotates through HD indices.
276
- *
277
- * Constructed from a wildcard template (e.g.
278
- * `tr([fp/86'/0'/0']xpub.../0/*)`); the {@link descriptor} field
279
- * holds it for HD providers to consume.
231
+ * Watch-only HD identity from a wildcard descriptor template (e.g.
232
+ * `tr([fp/86'/0'/0']xpub.../0/*)`): derives public keys and rotates HD indices, cannot sign.
280
233
  *
281
234
  * @example
282
235
  * ```typescript
@@ -289,26 +242,14 @@ declare class MnemonicIdentity extends SeedIdentity {
289
242
  */
290
243
  declare class ReadonlyDescriptorIdentity implements ReadonlyHDCapableIdentity {
291
244
  /**
292
- * Index-0 expansion of {@link descriptor}. Both the x-only pubkey
293
- * (taproot, returned by the library as 32 bytes) and the compressed
294
- * pubkey (derived through the bip32 node when needed) are read off
295
- * this on demand — no separate caches.
245
+ * Index-0 expansion of {@link descriptor}; the x-only pubkey (32 bytes) and the compressed
246
+ * pubkey (via the bip32 node) are both read off it on demand.
296
247
  */
297
248
  private readonly indexZero;
298
- /**
299
- * Wildcard account-descriptor template (e.g.
300
- * `tr([fp/86'/0'/0']xpub/0/*)`). HD rotation consumers materialize
301
- * a concrete descriptor at a specific index themselves.
302
- */
249
+ /** Wildcard account-descriptor template (e.g. `tr([fp/86'/0'/0']xpub/0/*)`). */
303
250
  readonly descriptor: string;
304
251
  private constructor();
305
- /**
306
- * Creates a ReadonlyDescriptorIdentity from an account-descriptor
307
- * *template* (must end with the BIP-32 wildcard suffix `/*)`).
308
- *
309
- * @param descriptor - Wildcard-suffixed Taproot template
310
- * (`tr([fp/path']xpub.../child/*)`).
311
- */
252
+ /** @param descriptor - Wildcard-suffixed Taproot template (`tr([fp/path']xpub.../child/*)`). */
312
253
  static fromDescriptor(descriptor: string): ReadonlyDescriptorIdentity;
313
254
  xOnlyPublicKey(): Promise<Uint8Array>;
314
255
  compressedPublicKey(): Promise<Uint8Array>;
@@ -430,73 +371,19 @@ declare class DescriptorIdentity implements Identity {
430
371
  }
431
372
 
432
373
  /**
433
- * In-memory single key implementation for Bitcoin transaction signing.
434
- *
435
- * @example
436
- * ```typescript
437
- * // Create from hex string
438
- * const key = SingleKey.fromHex('your_private_key_hex');
439
- *
440
- * // Create from raw bytes
441
- * const key = SingleKey.fromPrivateKey(privateKeyBytes);
442
- *
443
- * // Create random key
444
- * const randomKey = SingleKey.fromRandomBytes();
445
- *
446
- * // Sign a transaction
447
- * const signedTx = await key.sign(transaction);
448
- * ```
374
+ * Wraps a legacy Identity (single-key) as a DescriptorProvider.
375
+ * The descriptor is always a simple tr(pubkey) format.
449
376
  */
450
- declare class SingleKey implements Identity {
451
- private key;
452
- private constructor();
453
- /** Create a signing identity from raw private key bytes. */
454
- static fromPrivateKey(privateKey: Uint8Array): SingleKey;
455
- /** Create a signing identity from a hex-encoded private key. */
456
- static fromHex(privateKeyHex: string): SingleKey;
457
- /** Create a signing identity with a freshly generated random private key. */
458
- static fromRandomBytes(): SingleKey;
459
- /**
460
- * Export the private key as a hex string.
461
- *
462
- * @returns The private key as a hex string
463
- */
464
- toHex(): string;
465
- sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
466
- compressedPublicKey(): Promise<Uint8Array>;
467
- xOnlyPublicKey(): Promise<Uint8Array>;
468
- signerSession(): SignerSession;
469
- signMessage(message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
470
- /**
471
- * BIP-340 sign `messageHash` with aux_rand = 0, so the signature — and
472
- * anything derived from it — is reproducible from the key alone.
473
- *
474
- * What lets a static wallet derive a swap preimage instead of storing one
475
- * (see `wallet/contractSecrets.ts`). Deliberately NOT `signMessage`, whose
476
- * schnorr branch draws a random aux_rand: a preimage derived from that is
477
- * unrecoverable, and the loss would only surface at claim time.
478
- */
479
- signSchnorrDeterministic(messageHash: Uint8Array): Promise<Uint8Array>;
480
- toReadonly(): Promise<ReadonlySingleKey>;
481
- }
482
- declare class ReadonlySingleKey implements ReadonlyIdentity {
483
- private readonly publicKey;
484
- /** Create a readonly identity from a compressed public key. */
485
- constructor(publicKey: Uint8Array);
486
- /**
487
- * Create a ReadonlySingleKey from a compressed public key.
488
- *
489
- * @param publicKey - 33-byte compressed public key (02/03 prefix + 32-byte x coordinate)
490
- * @returns A new ReadonlySingleKey instance
491
- * @example
492
- * ```typescript
493
- * const pubkey = new Uint8Array(33); // your compressed public key
494
- * const readonlyKey = ReadonlySingleKey.fromPublicKey(pubkey);
495
- * ```
496
- */
497
- static fromPublicKey(publicKey: Uint8Array): ReadonlySingleKey;
498
- xOnlyPublicKey(): Promise<Uint8Array>;
499
- compressedPublicKey(): Promise<Uint8Array>;
377
+ declare class StaticDescriptorProvider implements DescriptorProvider {
378
+ private readonly identity;
379
+ private readonly descriptor;
380
+ private readonly pubKeyHex;
381
+ constructor(identity: Identity, pubKeyHex: string);
382
+ static create(identity: Identity): Promise<StaticDescriptorProvider>;
383
+ getNextSigningDescriptor(): Promise<string>;
384
+ isOurs(descriptor: string): boolean;
385
+ signWithDescriptor(requests: DescriptorSigningRequest[]): Promise<Transaction[]>;
386
+ signMessageWithDescriptor(descriptor: string, message: Uint8Array, type?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
500
387
  }
501
388
 
502
389
  /**
@@ -553,7 +440,7 @@ declare class InMemoryIntentRepository implements IntentRepository {
553
440
  private byId;
554
441
  clear(): Promise<void>;
555
442
  saveIntent(intent: ArkIntent): Promise<void>;
556
- getIntents(filter?: IntentFilter): Promise<ArkIntent[]>;
443
+ getIntentsPage(filter: IntentPageFilter | undefined, page: PageRequest): Promise<PageResult<ArkIntent>>;
557
444
  getLockedVtxoOutpoints(): Promise<Outpoint[]>;
558
445
  [Symbol.asyncDispose](): Promise<void>;
559
446
  }
@@ -573,11 +460,8 @@ declare class InMemoryVirtualTxRepository implements VirtualTxRepository {
573
460
  }
574
461
 
575
462
  /**
576
- * @experimental Virtual-tx persistence is inert by default. This repository
577
- * opens its DB at {@link INTENT_DB_VERSION} and creates the virtualtx stores,
578
- * so it must be given a *dedicated* `dbName` distinct from the wallet/contract
579
- * DB until this persistence is activated in the shared schema — otherwise the
580
- * shared DB's version-conflict guard rejects the mismatched open.
463
+ * @experimental Virtual-tx persistence is opt-in. Stored in its own database,
464
+ * {@link BATCHES_DB_NAME} by default, never in the wallet/contract one.
581
465
  */
582
466
  declare class IndexedDBVirtualTxRepository implements VirtualTxRepository {
583
467
  readonly version: 1;
@@ -595,11 +479,8 @@ declare class IndexedDBVirtualTxRepository implements VirtualTxRepository {
595
479
  }
596
480
 
597
481
  /**
598
- * @experimental Intent persistence is inert by default. This repository opens
599
- * its DB at {@link INTENT_DB_VERSION} and creates the intent stores, so it must
600
- * be given a *dedicated* `dbName` distinct from the wallet/contract DB until
601
- * intent persistence is activated in the shared schema — otherwise the shared
602
- * DB's version-conflict guard rejects the mismatched open.
482
+ * @experimental Intent persistence is opt-in. Stored in its own database,
483
+ * {@link BATCHES_DB_NAME} by default, never in the wallet/contract one.
603
484
  */
604
485
  declare class IndexedDBIntentRepository implements IntentRepository {
605
486
  readonly version: 1;
@@ -608,7 +489,7 @@ declare class IndexedDBIntentRepository implements IntentRepository {
608
489
  private getDB;
609
490
  clear(): Promise<void>;
610
491
  saveIntent(intent: ArkIntent): Promise<void>;
611
- getIntents(filter?: IntentFilter): Promise<ArkIntent[]>;
492
+ getIntentsPage(filter: IntentPageFilter | undefined, page: PageRequest): Promise<PageResult<ArkIntent>>;
612
493
  getLockedVtxoOutpoints(): Promise<Outpoint[]>;
613
494
  [Symbol.asyncDispose](): Promise<void>;
614
495
  }
@@ -618,21 +499,21 @@ declare class IndexedDBIntentRepository implements IntentRepository {
618
499
  * Data is ephemeral and scoped to the instance.
619
500
  */
620
501
  declare class InMemoryWalletRepository implements WalletRepository {
621
- readonly version: 1;
502
+ readonly version: 2;
622
503
  private readonly vtxosByAddress;
623
504
  private readonly utxosByAddress;
624
505
  private readonly txsByAddress;
625
506
  private walletState;
626
- getVtxos(address: string): Promise<ExtendedVirtualCoin[]>;
507
+ getVtxosPage(address: string, page: PageRequest<Outpoint>): Promise<PageResult<ExtendedVirtualCoin, Outpoint>>;
627
508
  saveVtxos(address: string, vtxos: ExtendedVirtualCoin[]): Promise<void>;
628
509
  deleteVtxos(address: string): Promise<void>;
629
- getVtxosForScript(script: string): Promise<ExtendedVirtualCoin[]>;
510
+ getVtxosForScriptPage(script: string, page: PageRequest<ScriptVtxoCursor>, options?: ScriptVtxoPageOptions): Promise<PageResult<StoredVtxo, ScriptVtxoCursor>>;
630
511
  saveVtxosForScript(key: VtxoRepositoryKey, vtxos: ExtendedVirtualCoin[]): Promise<void>;
631
512
  deleteVtxosForScript(script: string): Promise<void>;
632
- getUtxos(address: string): Promise<ExtendedCoin[]>;
633
- saveUtxos(address: string, utxos: ExtendedCoin[]): Promise<void>;
513
+ getUtxosPage(address: string, page: PageRequest<Outpoint>): Promise<PageResult<ExtendedCoin, Outpoint>>;
514
+ saveUtxos(addressOrBatch: string | ReadonlyMap<string, ExtendedCoin[]>, utxos?: ExtendedCoin[]): Promise<void>;
634
515
  deleteUtxos(address: string): Promise<void>;
635
- getTransactionHistory(address: string): Promise<ArkTransaction[]>;
516
+ getTransactionHistoryPage(filter: TransactionHistoryPageFilter, page: PageRequest<TransactionHistoryPageCursor>): Promise<PageResult<ArkTransaction, TransactionHistoryPageCursor>>;
636
517
  saveTransactions(address: string, txs: ArkTransaction[]): Promise<void>;
637
518
  deleteTransactions(address: string): Promise<void>;
638
519
  getWalletState(): Promise<WalletState | null>;
@@ -642,11 +523,8 @@ declare class InMemoryWalletRepository implements WalletRepository {
642
523
  }
643
524
 
644
525
  /**
645
- * Whether generic wallet spending may select this contract's VTXOs.
646
- *
647
- * Default closed: a type whose handler declares nothing — a custom type, a
648
- * plugin type, a row whose handler is not registered in this context — is not
649
- * spendable. Every shipped handler answers explicitly.
526
+ * Whether generic wallet spending may select this contract's VTXOs. Default closed: a type whose
527
+ * handler declares nothing, or has no handler registered here, is not spendable.
650
528
  *
651
529
  * @see ContractHandler.isGenericallySpendable
652
530
  */
@@ -665,68 +543,44 @@ type ExcludableVtxo = {
665
543
  /** {@link gatedContracts}' answer, as callers that only read it should take it. */
666
544
  type GatedContracts = ReadonlyMap<string, string>;
667
545
  /**
668
- * Why generic spending skips a VTXO, or `undefined` when it does not — phrased
669
- * to follow the outpoint in a log line.
670
- *
671
- * Generic spending applies three exclusions (the contract gate, pending
672
- * recovery, intent locks) that key on different things — script, script,
673
- * outpoint. Stating each as a reason-or-undefined lets all three report through
674
- * one path, so no exclusion can drop a coin silently while another logs.
546
+ * Why generic spending skips a VTXO, or `undefined` when it does not; phrased to follow the
547
+ * outpoint in a log line. One shape for all exclusions (contract gate, pending recovery, intent
548
+ * locks) so none can drop a coin silently while another logs.
675
549
  */
676
550
  type VtxoExclusion = (vtxo: ExcludableVtxo) => string | undefined;
677
551
  /**
678
- * The contract gate as an exclusion, naming why it closed: a handler ran and
679
- * declined, or this build has no handler for the type at all.
680
- *
681
- * The two want opposite reactions from whoever reads the log. A decline is
682
- * the gate working as designed — nothing to do. A missing handler means a
683
- * contract row this build cannot interpret, e.g. a vendoring or version
684
- * mismatch, which is worth a reader's attention. `contractHandlers` is
685
- * already available here, so the message can tell them apart instead of
686
- * collapsing both into one sentence that reads as the same case either way.
552
+ * The contract gate as an exclusion, distinguishing a handler's decline (working as designed)
553
+ * from a missing handler (a row this build can't interpret, e.g. a version mismatch, worth a
554
+ * reader's attention).
687
555
  */
688
556
  declare function gateExclusion(gated: GatedContracts): VtxoExclusion;
689
557
  /** Outpoints excluded for a shared reason, e.g. an intent-lock set. */
690
558
  declare function outpointExclusion(outpoints: ReadonlySet<string>, reason: string): VtxoExclusion;
691
559
  /**
692
- * Outpoints excluded for individually-named reasons — a per-input timelock,
693
- * where one shared reason would be wrong because the inputs differ.
694
- *
695
- * Unlike {@link gateExclusion}, the reasons are the handlers' own sentences and
696
- * are not rephrased to follow the outpoint: that text is what tells the reader
697
- * when to retry, and a paraphrase here would be a second spelling to keep in
698
- * step with it.
560
+ * Outpoints excluded for per-input reasons (e.g. a per-input timelock). The handlers' own
561
+ * sentences, unparaphrased: they tell the reader when to retry.
699
562
  *
700
563
  * @see outpointExclusion for the shared-reason form.
701
564
  */
702
565
  declare function outpointReasons(reasons: ReadonlyMap<string, string>): VtxoExclusion;
703
566
  /**
704
- * Report VTXOs an exclusion dropped — the only field-diagnosable signal for why
705
- * a coin is missing from a spend, or why an explicitly named one will fail.
706
- * Debug level, one line per VTXO per reason.
567
+ * Report VTXOs an exclusion dropped, the only field-diagnosable signal for a coin missing from a
568
+ * spend. Debug level, one line per VTXO per reason.
707
569
  */
708
570
  declare function logExcludedVtxos(source: string, vtxos: readonly ExcludableVtxo[], exclusions: readonly VtxoExclusion[]): void;
709
571
  /**
710
- * Thrown when a spend names VTXOs whose contract can no longer be annotated —
711
- * its handler is not registered here, its handler rejects the stored params, or
712
- * it has no contract row at all.
713
- *
714
- * Raised before submission on purpose. Spending reads the tapscripts stored on
715
- * each coin rather than re-deriving them, so such a spend would otherwise build
716
- * and broadcast normally and only fail in the bookkeeping afterwards, leaving
717
- * the transaction on the network and the local state behind it.
572
+ * Thrown before submission when a spend names VTXOs whose contract can no longer be annotated
573
+ * (handler unregistered, stored params rejected, or no row). Otherwise the spend would broadcast
574
+ * and fail in the bookkeeping, leaving local state behind the network.
718
575
  */
719
576
  declare class UnannotatableInputError extends Error {
720
577
  readonly name = "UnannotatableInputError";
721
578
  }
722
579
 
723
580
  /**
724
- * Encode a contract to the arkcontract string format.
725
- *
726
- * Format: arkcontract={type}&{key1}={value1}&{key2}={value2}...
727
- *
728
- * This format is compatible with NArk and allows contracts to be
729
- * shared/imported across different Arkade SDKs.
581
+ * Encode a contract to the arkcontract string format:
582
+ * `arkcontract={type}&{key1}={value1}&...`. NArk-compatible, so contracts can be shared
583
+ * across Arkade SDKs.
730
584
  *
731
585
  * @example
732
586
  * ```typescript
@@ -742,27 +596,18 @@ declare class UnannotatableInputError extends Error {
742
596
  */
743
597
  declare function encodeArkContract(contract: Contract): string;
744
598
  /**
745
- * Parsed result from decoding an arkcontract string.
746
- *
747
- * This is a low-level representation. For type-safe contract creation,
748
- * use `contractFromArkContract` or `contractFromArkContractWithAddress`
749
- * which validate params through the handler system.
599
+ * Raw (unvalidated) result of decoding an arkcontract string. For typed contracts use
600
+ * `contractFromArkContract` / `contractFromArkContractWithAddress`, which validate via handlers.
750
601
  */
751
602
  interface ParsedArkContract {
752
603
  /** Contract type (e.g., "vhtlc", "default") */
753
604
  type: string;
754
- /** All key-value pairs from the string */
605
+ /** All other key-value pairs from the string */
755
606
  data: Record<string, string>;
756
607
  }
757
608
  /**
758
- * Decode an arkcontract string into raw type and data.
759
- *
760
- * This is a low-level function that parses the URL-encoded format.
761
- * For creating typed Contract objects, use `contractFromArkContract`
762
- * or `contractFromArkContractWithAddress` instead.
609
+ * Decode an arkcontract string into raw type and data (low-level; see {@link ParsedArkContract}).
763
610
  *
764
- * @param encoded - The arkcontract string
765
- * @returns Parsed type and key-value data
766
611
  * @throws If the string is not a valid arkcontract
767
612
  *
768
613
  * @example
@@ -773,14 +618,9 @@ interface ParsedArkContract {
773
618
  */
774
619
  declare function decodeArkContract(encoded: string): ParsedArkContract;
775
620
  /**
776
- * Create a Contract from an arkcontract string.
621
+ * Create a Contract (without script/address) from an arkcontract string.
777
622
  *
778
- * This requires a handler to be registered for the contract type.
779
- *
780
- * @param encoded - The arkcontract string
781
- * @param options - Additional options for the contract
782
- * @returns A Contract object
783
- * @throws If the string is invalid or no handler exists for the type
623
+ * @throws If the string is invalid or no handler is registered for the type
784
624
  *
785
625
  * @example
786
626
  * ```typescript
@@ -803,56 +643,26 @@ declare function contractFromArkContract(encoded: string, options?: {
803
643
  /**
804
644
  * Create a full Contract with derived script and address.
805
645
  *
806
- * @param encoded - The arkcontract string
807
646
  * @param serverPubKey - Server public key (for address derivation)
808
647
  * @param addressPrefix - Address prefix (e.g., "tark" for testnet)
809
- * @param options - Additional options
810
- * @returns A complete Contract object
811
648
  */
812
649
  declare function contractFromArkContractWithAddress(encoded: string, serverPubKey: Uint8Array, addressPrefix?: string, options?: {
813
650
  label?: string;
814
651
  state?: "active" | "inactive";
815
652
  metadata?: Record<string, unknown>;
816
653
  }): Contract;
817
- /**
818
- * Check if a string is an arkcontract.
819
- */
654
+ /** Check if a string is an arkcontract. */
820
655
  declare function isArkContract(str: string): boolean;
821
656
 
822
- /**
823
- * Thrown when a descriptor-capable contract (default, delegate, or boarding)
824
- * cannot be routed to any signer: its owner key (`params.pubKey`) is not this
825
- * wallet's baseline signing key, and the record carries no
826
- * `metadata.signingDescriptor` to send it to a descriptor-aware signer.
827
- *
828
- * Note that this can arise also when a contract belongs to a different identity (storage reuse).
829
- */
830
- declare class MissingSigningDescriptorError extends Error {
831
- readonly contractScript: string;
832
- readonly contractType: "default" | "delegate" | "boarding";
833
- readonly name = "MissingSigningDescriptorError";
834
- constructor(contractScript: string, contractType: "default" | "delegate" | "boarding");
835
- }
836
- /**
837
- * Thrown when an input needs descriptor-aware signing but no
838
- * DescriptorProvider was wired into the wallet.
839
- */
840
- declare class DescriptorSigningProviderMissingError extends Error {
841
- readonly name = "DescriptorSigningProviderMissingError";
842
- constructor();
843
- }
844
-
845
657
  /**
846
658
  * In-memory implementation of ContractRepository.
847
659
  * Data is ephemeral and scoped to the instance.
848
660
  */
849
661
  declare class InMemoryContractRepository implements ContractRepository {
850
- readonly version: 2;
851
- private readonly contractData;
852
- private readonly collections;
662
+ readonly version: 3;
853
663
  private readonly contractsByScript;
854
664
  clear(): Promise<void>;
855
- getContracts(filter?: ContractFilter): Promise<Contract[]>;
665
+ getContractsPage(filter: ContractFilter | undefined, page: PageRequest): Promise<PageResult<Contract>>;
856
666
  saveContract(contract: Contract): Promise<void>;
857
667
  deleteContract(script: string): Promise<void>;
858
668
  [Symbol.asyncDispose](): Promise<void>;
@@ -864,44 +674,20 @@ declare class InMemoryContractRepository implements ContractRepository {
864
674
  * Data is stored as JSON strings in key/value stores.
865
675
  */
866
676
  declare class IndexedDBContractRepository implements ContractRepository {
867
- readonly version: 2;
677
+ readonly version: 3;
868
678
  private readonly connection;
869
679
  constructor(dbName?: string);
870
680
  clear(): Promise<void>;
871
- getContracts(filter?: ContractFilter): Promise<Contract[]>;
681
+ getContractsPage(filter: ContractFilter | undefined, page: PageRequest): Promise<PageResult<Contract>>;
872
682
  saveContract(contract: Contract): Promise<void>;
873
683
  deleteContract(script: string): Promise<void>;
684
+ /** Up to `limit + 1` rows of `range` that pass `filter`, in key order. */
685
+ private readMatching;
874
686
  private applyContractFilter;
875
687
  private getDB;
876
688
  [Symbol.asyncDispose](): Promise<void>;
877
689
  }
878
690
 
879
- /**
880
- * IndexedDB-based implementation of WalletRepository.
881
- */
882
- declare class IndexedDBWalletRepository implements WalletRepository {
883
- readonly version: 1;
884
- private readonly connection;
885
- constructor(dbName?: string);
886
- clear(): Promise<void>;
887
- [Symbol.asyncDispose](): Promise<void>;
888
- getVtxos(address: string): Promise<ExtendedVirtualCoin[]>;
889
- saveVtxos(address: string, vtxos: ExtendedVirtualCoin[]): Promise<void>;
890
- deleteVtxos(address: string): Promise<void>;
891
- getVtxosForScript(script: string): Promise<ExtendedVirtualCoin[]>;
892
- saveVtxosForScript(key: VtxoRepositoryKey, vtxos: ExtendedVirtualCoin[]): Promise<void>;
893
- deleteVtxosForScript(script: string): Promise<void>;
894
- getUtxos(address: string): Promise<ExtendedCoin[]>;
895
- saveUtxos(address: string, utxos: ExtendedCoin[]): Promise<void>;
896
- deleteUtxos(address: string): Promise<void>;
897
- getTransactionHistory(address: string): Promise<ArkTransaction[]>;
898
- saveTransactions(address: string, txs: ArkTransaction[]): Promise<void>;
899
- deleteTransactions(address: string): Promise<void>;
900
- getWalletState(): Promise<WalletState | null>;
901
- saveWalletState(state: WalletState): Promise<void>;
902
- private getDB;
903
- }
904
-
905
691
  interface WalletRestoreHook {
906
692
  id: string;
907
693
  restore(wallet: IWallet): Promise<void>;
@@ -909,43 +695,98 @@ interface WalletRestoreHook {
909
695
  declare function registerWalletRestoreHook(wallet: IWallet, hook: WalletRestoreHook): () => void;
910
696
 
911
697
  /**
912
- * Domain separator for the preimage derivation.
698
+ * In-memory single key implementation for Bitcoin transaction signing.
699
+ *
700
+ * @example
701
+ * ```typescript
702
+ * // Create from hex string
703
+ * const key = SingleKey.fromHex('your_private_key_hex');
913
704
  *
914
- * Protocol-scoped and versioned, mirroring NArk's `Arkade-Boltz-Preimage-v1`
915
- * (`SwapsManagementService.cs:128`), so any Arkade SDK implementing this
916
- * scheme reproduces the same preimage and can recover an artifact another
917
- * SDK created. Deliberately distinct from the Boltz tag: a shared tag would
918
- * make one wallet key derive one preimage for both corridors.
705
+ * // Create from raw bytes
706
+ * const key = SingleKey.fromPrivateKey(privateKeyBytes);
707
+ *
708
+ * // Create random key
709
+ * const randomKey = SingleKey.fromRandomBytes();
710
+ *
711
+ * // Sign a transaction
712
+ * const signedTx = await key.sign(transaction);
713
+ * ```
714
+ */
715
+ declare class SingleKey implements Identity {
716
+ private key;
717
+ private constructor();
718
+ /** Create a signing identity from raw private key bytes. */
719
+ static fromPrivateKey(privateKey: Uint8Array): SingleKey;
720
+ /** Create a signing identity from a hex-encoded private key. */
721
+ static fromHex(privateKeyHex: string): SingleKey;
722
+ /** Create a signing identity with a freshly generated random private key. */
723
+ static fromRandomBytes(): SingleKey;
724
+ /**
725
+ * Export the private key as a hex string.
726
+ *
727
+ * @returns The private key as a hex string
728
+ */
729
+ toHex(): string;
730
+ sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
731
+ compressedPublicKey(): Promise<Uint8Array>;
732
+ xOnlyPublicKey(): Promise<Uint8Array>;
733
+ signerSession(): SignerSession;
734
+ signMessage(message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
735
+ /**
736
+ * BIP-340 sign `messageHash` with aux_rand = 0, so the signature — and
737
+ * anything derived from it — is reproducible from the key alone.
738
+ *
739
+ * What lets a static wallet derive a swap preimage instead of storing one
740
+ * (see `wallet/contractSecrets.ts`). Deliberately NOT `signMessage`, whose
741
+ * schnorr branch draws a random aux_rand: a preimage derived from that is
742
+ * unrecoverable, and the loss would only surface at claim time.
743
+ */
744
+ signSchnorrDeterministic(messageHash: Uint8Array): Promise<Uint8Array>;
745
+ toReadonly(): Promise<ReadonlySingleKey>;
746
+ }
747
+ declare class ReadonlySingleKey implements ReadonlyIdentity {
748
+ private readonly publicKey;
749
+ /** Create a readonly identity from a compressed public key. */
750
+ constructor(publicKey: Uint8Array);
751
+ /**
752
+ * Create a ReadonlySingleKey from a compressed public key.
753
+ *
754
+ * @param publicKey - 33-byte compressed public key (02/03 prefix + 32-byte x coordinate)
755
+ * @returns A new ReadonlySingleKey instance
756
+ * @example
757
+ * ```typescript
758
+ * const pubkey = new Uint8Array(33); // your compressed public key
759
+ * const readonlyKey = ReadonlySingleKey.fromPublicKey(pubkey);
760
+ * ```
761
+ */
762
+ static fromPublicKey(publicKey: Uint8Array): ReadonlySingleKey;
763
+ xOnlyPublicKey(): Promise<Uint8Array>;
764
+ compressedPublicKey(): Promise<Uint8Array>;
765
+ }
766
+
767
+ /**
768
+ * Domain separator for the preimage derivation. Protocol-scoped and versioned, mirroring NArk's
769
+ * `Arkade-Boltz-Preimage-v1` (`SwapsManagementService.cs:128`), so any Arkade SDK reproduces the
770
+ * same preimage and can recover another SDK's artifact. Deliberately distinct from the Boltz tag:
771
+ * a shared tag would make one wallet key derive one preimage for both corridors.
919
772
  */
920
773
  declare const ARKADE_SWAP_PREIMAGE_TAG = "Arkade-RFQ-Preimage-v1";
921
774
  /**
922
- * Domain separator for the **salted** preimage derivation, used when the
923
- * descriptor repeats across artifacts.
924
- *
925
- * Corridor-generic where {@link ARKADE_SWAP_PREIMAGE_TAG} is not, and that
926
- * asymmetry is deliberate. The v1 tags must be per-corridor
927
- * (`Arkade-RFQ-Preimage-v1` here, NArk's `Arkade-Boltz-Preimage-v1` there)
928
- * because v1 pins its message index, so the tag is the only thing separating
929
- * two corridors that reach the same key. v2 mints a salt per artifact, so no
930
- * two artifacts share a message within a corridor, let alone across two — the
931
- * salt carries the separation, and the tag names the layer it belongs to.
775
+ * Domain separator for the **salted** derivation, used when the descriptor repeats across
776
+ * artifacts. Corridor-generic, unlike {@link ARKADE_SWAP_PREIMAGE_TAG}, deliberately: v1 pins its
777
+ * message index, so its tag is all that separates two corridors reaching the same key; here the
778
+ * per-artifact salt carries that separation.
932
779
  */
933
780
  declare const ARKADE_SALTED_PREIMAGE_TAG = "Arkade-Contract-Preimage-Salted-v1";
934
781
  /**
935
- * `TAG ‖ xonly(32) ‖ u32le(index)` — the message that gets BIP-340 signed.
936
- *
937
- * Anchored on the canonical x-only key rather than the descriptor string: a
938
- * restore reconstructs a bare descriptor that serialises differently from the
939
- * signing descriptor used at creation, and only the key agrees across both.
782
+ * `TAG ‖ xonly(32) ‖ u32le(index)` — the message that gets BIP-340 signed. Anchored on the x-only
783
+ * key, not the descriptor string: a restore rebuilds a descriptor that serialises differently from
784
+ * the one used at creation, and only the key agrees across both.
940
785
  */
941
786
  declare function buildPreimageMessage(xonly: Uint8Array, index: number): Uint8Array;
942
787
  /**
943
- * `TAG ‖ xonly(32) ‖ salt(32)` — the salted message that gets BIP-340 signed.
944
- *
945
- * The salt replaces v1's pinned index as the source of per-artifact
946
- * uniqueness, which is what lets a key that repeats across artifacts still
947
- * derive a distinct preimage for each. It is public: knowing it yields nothing
948
- * without the seed.
788
+ * `TAG ‖ xonly(32) ‖ salt(32)` — the salted message that gets BIP-340 signed. The salt replaces
789
+ * v1's pinned index as the per-artifact uniqueness source; it is public, useless without the seed.
949
790
  */
950
791
  declare function buildSaltedPreimageMessage(xonly: Uint8Array, salt: Uint8Array): Uint8Array;
951
792
  /**
@@ -964,18 +805,14 @@ interface ProvisionedKey {
964
805
  */
965
806
  descriptor: string;
966
807
  /**
967
- * The Ark scriptPubKey that corresponds to this key — the pkScript of the
968
- * wallet's current receive address. Returned alongside {@link pubkey} so
969
- * callers building the lockup script do not need a separate
970
- * {@link IWallet.getAddress} round-trip or an `ArkAddress.decode` call.
808
+ * The pkScript of the wallet's current receive address, so callers building the lockup need
809
+ * no separate {@link IWallet.getAddress} or `ArkAddress.decode`.
971
810
  */
972
811
  pkScript: Uint8Array;
973
812
  /**
974
- * The receive address {@link pkScript} was decoded from, captured in the
975
- * same single {@link IWallet.getAddress} read. The quote-time refund
976
- * address and the covenant's `refundPkScript` must always name the same
977
- * script, and two independent reads of a wallet that rotates its receive
978
- * address would not guarantee that — reuse this, never a second
813
+ * The receive address {@link pkScript} was decoded from, in the same {@link IWallet.getAddress}
814
+ * read. The quote-time refund address and the covenant's `refundPkScript` must name the same
815
+ * script, and two reads of a rotating wallet need not agree — reuse this, never a second
979
816
  * `getAddress()` call.
980
817
  */
981
818
  address: string;
@@ -990,93 +827,61 @@ interface ProvisionedClaimSecret extends Omit<ProvisionedKey, "pkScript" | "addr
990
827
  /** `sha256(preimage)` — what the contract commits to. */
991
828
  paymentHash: Uint8Array;
992
829
  /**
993
- * The salt {@link preimage} was derived from, when it came from the salted
994
- * arm. **Public** — the opposite of {@link preimage} above: persist it with
995
- * the artifact in the clear, because without it a wallet holding the seed
996
- * still cannot re-derive P.
997
- *
998
- * Absent on the other two arms: an HD child descriptor already names one
999
- * artifact, and a stored preimage needs no derivation input.
830
+ * The salt {@link preimage} was derived from, on the salted arm. **Public**, unlike
831
+ * {@link preimage}: persist it in the clear with the artifact — without it even the seed
832
+ * cannot re-derive P. Absent on the other arms.
1000
833
  */
1001
834
  preimageSalt?: Uint8Array;
1002
835
  /**
1003
- * Persist `preimage` with the artifact: this wallet cannot re-derive it.
1004
- * True when the caller supplied P, or when the signer cannot sign
1005
- * deterministically. When false the preimage re-derives from the seed —
1006
- * given {@link preimageSalt}, where there is one — and nothing secret
1007
- * needs to be stored.
836
+ * Persist `preimage` with the artifact: this wallet cannot re-derive it (caller-supplied P,
837
+ * or a signer that cannot sign deterministically). When false, P re-derives from the seed
838
+ * (given {@link preimageSalt}, if any) and nothing secret needs storing.
1008
839
  */
1009
840
  mustPersistPreimage: boolean;
1010
841
  }
1011
842
  /**
1012
- * The key that spends a leg we fund — the refund key of an HTLC, the user key
1013
- * of a covenant's cancel path.
843
+ * The key that spends a leg we fund — an HTLC's refund key, a covenant's cancel-path user key.
1014
844
  *
1015
- * The returned `pubkey` is taken from a signer the wallet produced, never
1016
- * from the descriptor string alone. That is the difference between an
1017
- * invariant and a comment: deriving the leaf key is pure parsing and would
1018
- * succeed just as well for a key this wallet cannot sign for — a descriptor
1019
- * allocated by a worker rebound to another identity, a record restored onto
1020
- * the wrong seed — and the covenant would bind it, the leg would fund, and
1021
- * the failure would surface at refund time with the money already committed.
1022
- * Throws {@link ForeignDescriptorError} instead, before there is a quote.
845
+ * `pubkey` comes from a signer the wallet produced, never the descriptor string alone: parsing
846
+ * succeeds just as well for a key this wallet cannot sign for (a worker rebound to another
847
+ * identity, a record restored onto the wrong seed), and the failure would surface at refund time
848
+ * with the money committed. Throws {@link ForeignDescriptorError} instead, before any quote.
1023
849
  *
1024
- * The wallet's identity key is reused rather than a fresh HD child, so no
1025
- * index is consumed when the artifact is never built — and the covenant's
1026
- * refund path is on the same key as the refund address the caller sends to
1027
- * at quote time.
850
+ * Reuses the identity key rather than a fresh HD child, so no index is consumed for an artifact
851
+ * never built, and the refund path is on the same key as the quote-time refund address.
1028
852
  */
1029
853
  declare function provisionRefundKey(wallet: IWallet): Promise<ProvisionedKey>;
1030
854
  /**
1031
- * The key that spends a leg we claim, plus the preimage that unlocks it.
1032
- *
1033
- * Pass `opts.preimage` to bring your own 32-byte P; it comes back verbatim
1034
- * with `mustPersistPreimage` set, since the wallet cannot re-derive what it
1035
- * did not choose.
855
+ * The key that spends a leg we claim, plus the preimage that unlocks it. Three arms:
1036
856
  *
1037
- * Three arms, and which one a wallet lands in is the whole of this function:
1038
- *
1039
- * 1. **Caller-supplied P.** Returned unchanged, `mustPersistPreimage: true`.
1040
- * 2. **Per-artifact descriptor** (an HD child). Derives from the key alone at
1041
- * the pinned index. Nothing at rest. Raises rather than falling through if
1042
- * the signer cannot sign deterministically — an HD descriptor whose wallet
1043
- * refuses is a broken wallet, not a fallback case.
1044
- * 3. **Anything else** — a static wallet's `tr(pubkey)`, or a constant
1045
- * descriptor from a custom provider. Mints a public per-artifact salt and
1046
- * derives from it, so a key that repeats still yields a distinct P. Only
1047
- * this arm falls back to a stored random preimage, and only when the signer
1048
- * refuses — which is discovered by deriving, never by probing.
857
+ * 1. **Caller-supplied `opts.preimage`** (32 bytes). Returned verbatim with
858
+ * `mustPersistPreimage: true`, since the wallet cannot re-derive what it did not choose.
859
+ * 2. **Per-artifact descriptor** (an HD child). Derives from the key alone at the pinned index;
860
+ * nothing at rest. Raises if the signer cannot sign deterministically — that is a broken HD
861
+ * wallet, not a fallback case.
862
+ * 3. **Anything else** (a static `tr(pubkey)`, a custom provider's constant descriptor). Mints a
863
+ * public per-artifact salt and derives from it. Only this arm falls back to a stored random
864
+ * preimage, and only when the signer refuses — discovered by deriving, never by probing.
1049
865
  */
1050
866
  declare function provisionClaimSecret(wallet: IWallet, opts?: {
1051
867
  preimage?: Uint8Array;
1052
868
  }): Promise<ProvisionedClaimSecret>;
1053
869
  /**
1054
- * The signer for a provisioned descriptor, verified to actually be that
1055
- * descriptor's key.
1056
- *
1057
- * The verification is a public-key equality, never a wallet-type probe: a
1058
- * wallet that answers with the wrong key — another seed's, after a restore
1059
- * mix-up — would sign happily, and the failure would surface only as a
1060
- * counterparty rejection or a dead script.
870
+ * The signer for a provisioned descriptor, verified by public-key equality (never a wallet-type
871
+ * probe) to be that descriptor's key: a wallet answering with another seed's key would sign
872
+ * happily and fail only as a counterparty rejection or a dead script.
1061
873
  *
1062
- * Know its limit. It catches a wallet that substitutes its *baseline*
1063
- * identity, which is the failure this exists for. It cannot catch one that
1064
- * returns a descriptor-scoped identity built over the same descriptor, since
1065
- * such an identity reads its pubkey back out of the descriptor string and the
1066
- * comparison becomes a tautology. What rules that case out is
1067
- * {@link resolveDescriptorSigner}'s `isOurs` test, which both shipped wallets
1068
- * resolve through — so this is the backstop for a hand-rolled `IWallet`, not
1069
- * the primary guarantee.
874
+ * Limit: this catches a wallet substituting its *baseline* identity. A descriptor-scoped identity
875
+ * over the same descriptor reads its pubkey back from the string, making the check a tautology;
876
+ * {@link resolveDescriptorSigner}'s `isOurs` test (used by both shipped wallets) rules that out,
877
+ * so this is the backstop for a hand-rolled `IWallet`, not the primary guarantee.
1070
878
  */
1071
879
  declare function contractSigner(wallet: IWallet, descriptor: string): Promise<Identity>;
1072
880
  /**
1073
- * A wallet that holds a contract's key but cannot sign with it: a watch-only
1074
- * identity, or a remote signer whose transport is absent.
1075
- *
1076
- * Distinct from {@link ForeignDescriptorError} because the remedy differs —
1077
- * that one says "wrong wallet", this one says "this wallet, without its
1078
- * signer". Raised at provisioning as well as at signing, so a wallet that
1079
- * could never spend the leg finds out before it funds one.
881
+ * A wallet that holds a contract's key but cannot sign with it (watch-only, or a remote signer
882
+ * without its transport). Distinct from {@link ForeignDescriptorError} ("wrong wallet") because
883
+ * the remedy differs. Raised at provisioning too, so a wallet that could never spend a leg finds
884
+ * out before funding it.
1080
885
  */
1081
886
  declare class WalletCannotSignError extends Error {
1082
887
  readonly descriptor: string;
@@ -1084,18 +889,12 @@ declare class WalletCannotSignError extends Error {
1084
889
  constructor(descriptor: string);
1085
890
  }
1086
891
  /**
1087
- * The preimage for a provisioned descriptor: `opts.stored` when the artifact
1088
- * kept one, otherwise re-derived from the seed.
892
+ * The preimage for a provisioned descriptor, in the precedence {@link provisionClaimSecret} chose:
1089
893
  *
1090
- * Resolves in one precedence order, mirroring the arms
1091
- * {@link provisionClaimSecret} chose between:
1092
- *
1093
- * 1. `opts.stored` — a caller-supplied P, or one from a wallet that could not
1094
- * derive. Whatever the wallet can do now, a stored P is the artifact's.
894
+ * 1. `opts.stored` — a caller-supplied P, or one a wallet could not derive; always the artifact's.
1095
895
  * 2. a per-artifact descriptor — derive at the pinned index.
1096
896
  * 3. `opts.salt` — derive from the salted message.
1097
- * 4. otherwise throw: a repeating descriptor with neither a stored preimage
1098
- * nor a salt has nothing to derive from that would not collide.
897
+ * 4. otherwise throw: a repeating descriptor with neither has nothing collision-free to derive.
1099
898
  */
1100
899
  declare function contractPreimage(wallet: IWallet, descriptor: string, opts?: {
1101
900
  stored?: Uint8Array;
@@ -1106,33 +905,47 @@ declare function contractPreimage(wallet: IWallet, descriptor: string, opts?: {
1106
905
  * rather than degrading to a random-aux signer. */
1107
906
  interface DeterministicSigner extends ReadonlyIdentity {
1108
907
  /**
1109
- * Implementors wrapping a remote: throw only for a refusal that will
1110
- * repeat. {@link provisionClaimSecret} reads a transient throw — a network
1111
- * hiccup, an extension timeout — as "this signer cannot derive", and falls
1112
- * back to a stored random preimage for the artifact's whole life. That is
1113
- * claimable, but it persists a secret the seed would otherwise have
1114
- * replaced, and nothing surfaces the downgrade to the caller.
908
+ * Implementors wrapping a remote: throw only for a refusal that will repeat.
909
+ * {@link provisionClaimSecret} reads any throw (even a network hiccup) as "cannot derive" and
910
+ * silently falls back to a stored random preimage for the artifact's whole life.
1115
911
  */
1116
912
  signSchnorrDeterministic(messageHash: Uint8Array): Promise<Uint8Array>;
1117
913
  }
1118
914
  declare function isDeterministicSigner(value: unknown): value is DeterministicSigner;
1119
915
  /**
1120
- * Claim a restored artifact's index so a later allocation cannot reissue it —
1121
- * which would derive that artifact's preimage a second time, for a different
1122
- * one.
1123
- *
1124
- * Monotonic, and a no-op wherever there is no index to reserve — a shared-key
1125
- * descriptor, or another seed's artifact. Restores iterate whole histories, so
1126
- * an artifact this wallet has nothing to adopt for must not abort the loop.
916
+ * Claim a restored artifact's index so a later allocation cannot reissue it (which would derive
917
+ * that artifact's preimage again, for a different one).
1127
918
  *
1128
- * Telling "another seed's" apart from a failure needs
1129
- * {@link HDWalletCapable.signerForDescriptor}, so an allocation-capable wallet
1130
- * that does not also implement it gets only the watermark call's own untyped
1131
- * refusal, and a foreign artifact reaches the caller as an error rather than a
1132
- * skip. Every wallet shipped here implements both.
919
+ * Monotonic, and a no-op wherever there is no index to reserve (a shared-key descriptor, another
920
+ * seed's artifact), since restores iterate whole histories. Recognising "another seed's" needs
921
+ * {@link HDWalletCapable.signerForDescriptor}; without it a foreign artifact surfaces as the
922
+ * watermark call's untyped error. Every shipped wallet implements both.
1133
923
  */
1134
924
  declare function adoptContractDescriptor(wallet: IWallet, descriptor: string): Promise<void>;
1135
925
 
926
+ /**
927
+ * Thrown when a descriptor-capable contract (default, delegate, or boarding)
928
+ * cannot be routed to any signer: its owner key (`params.pubKey`) is not this
929
+ * wallet's baseline signing key, and the record carries no
930
+ * `metadata.signingDescriptor` to send it to a descriptor-aware signer.
931
+ *
932
+ * Note that this can arise also when a contract belongs to a different identity (storage reuse).
933
+ */
934
+ declare class MissingSigningDescriptorError extends Error {
935
+ readonly contractScript: string;
936
+ readonly contractType: "default" | "delegate" | "boarding";
937
+ readonly name = "MissingSigningDescriptorError";
938
+ constructor(contractScript: string, contractType: "default" | "delegate" | "boarding");
939
+ }
940
+ /**
941
+ * Thrown when an input needs descriptor-aware signing but no
942
+ * DescriptorProvider was wired into the wallet.
943
+ */
944
+ declare class DescriptorSigningProviderMissingError extends Error {
945
+ readonly name = "DescriptorSigningProviderMissingError";
946
+ constructor();
947
+ }
948
+
1136
949
  type RequestEnvelope = {
1137
950
  tag: string;
1138
951
  id: string;
@@ -1154,6 +967,11 @@ type ResponseEnvelope = {
1154
967
  errorName?: string;
1155
968
  broadcast?: boolean;
1156
969
  };
970
+ type MessageBusServices = {
971
+ arkProvider: ArkProvider;
972
+ wallet?: Wallet;
973
+ readonlyWallet: ReadonlyWallet;
974
+ };
1157
975
  interface MessageHandler<REQ extends RequestEnvelope = RequestEnvelope, RES extends ResponseEnvelope = ResponseEnvelope> {
1158
976
  /**
1159
977
  * A unique identifier for the updater.
@@ -1170,11 +988,7 @@ interface MessageHandler<REQ extends RequestEnvelope = RequestEnvelope, RES exte
1170
988
  * bus re-init or `stop()` it goes inert on its own, so retaining one past
1171
989
  * `stop()` cannot post.
1172
990
  **/
1173
- start(services: {
1174
- arkProvider: ArkProvider;
1175
- wallet?: Wallet;
1176
- readonlyWallet: ReadonlyWallet;
1177
- }, repositories: {
991
+ start(services: MessageBusServices, repositories: {
1178
992
  walletRepository: WalletRepository;
1179
993
  }, channel?: {
1180
994
  broadcast(response: RES): void;
@@ -1220,17 +1034,19 @@ type Options = {
1220
1034
  * `storage.intentRepository`. Same opt-in as a main-thread wallet: without
1221
1035
  * it the worker persists no settlement intent, reconciles none on restart,
1222
1036
  * and counts intent-locked VTXOs as available. Pass the same repository the
1223
- * main thread uses so both sides read one intent state.
1037
+ * main thread uses so both sides read one intent state, but settle from one
1038
+ * side only: reconciliation deletes from the server any pending intent the
1039
+ * worker's wallet is not settling itself.
1224
1040
  *
1225
1041
  * Ignored when `buildServices` is supplied — that override owns `storage`.
1226
1042
  */
1227
1043
  intentRepository?: IntentRepository;
1044
+ /** The worker wallet's onchain provider, per network: an instance cannot cross `postMessage`.
1045
+ * Called on every init and never closed, so return one instance per network. Defaults to
1046
+ * Esplora; ignored when `buildServices` is supplied. */
1047
+ onchainProvider?: (network: NetworkName) => OnchainProvider;
1228
1048
  debug?: boolean;
1229
- buildServices?: (config: Initialize["config"]) => Promise<{
1230
- arkProvider: ArkProvider;
1231
- wallet?: Wallet;
1232
- readonlyWallet: ReadonlyWallet;
1233
- }>;
1049
+ buildServices?: (config: Initialize["config"]) => Promise<MessageBusServices>;
1234
1050
  };
1235
1051
  type Initialize = {
1236
1052
  type: "INITIALIZE_MESSAGE_BUS";
@@ -1243,14 +1059,15 @@ type Initialize = {
1243
1059
  };
1244
1060
  delegateUrl?: string;
1245
1061
  settlementConfig?: SettlementConfig | false;
1062
+ /** @see WalletConfig.concurrentSpending */
1063
+ concurrentSpending?: boolean;
1246
1064
  walletMode?: "auto" | "static" | "hd";
1065
+ lazyInitialization?: boolean;
1247
1066
  watcherConfig?: Partial<Omit<ContractWatcherConfig, "indexerProvider">>;
1248
1067
  /** @see WalletConfig.lookAheadWindow */
1249
1068
  lookAheadWindow?: number;
1250
1069
  /** @see WalletConfig.minBatchExpirySeconds */
1251
1070
  minBatchExpirySeconds?: bigint;
1252
- /** @see WalletConfig.minCheckpointExitDelaySeconds */
1253
- minCheckpointExitDelaySeconds?: bigint;
1254
1071
  /**
1255
1072
  * Page-supplied per-operation timeout map. Keys are message types
1256
1073
  * (e.g. "SETTLE"). Overrides constructor-supplied
@@ -1286,13 +1103,14 @@ declare class MessageBus {
1286
1103
  private readonly buildServicesFn;
1287
1104
  private readonly boundOnMessage;
1288
1105
  private readonly intentRepository?;
1106
+ private readonly onchainProvider?;
1289
1107
  /** Pending broadcasts, drained FIFO by a single {@link drain} loop. */
1290
1108
  private broadcastQueue;
1291
1109
  private draining;
1292
1110
  /** Bumped wherever the generation owning the queued broadcasts ends. */
1293
1111
  private broadcastEpoch;
1294
1112
  /** Create the service-worker message bus with repositories and handler configuration. */
1295
- constructor(walletRepository: WalletRepository, contractRepository: ContractRepository, { messageHandlers, tickIntervalMs, messageTimeoutMs, messageTimeoutOverrides, intentRepository, debug, buildServices, }: Options);
1113
+ constructor(walletRepository: WalletRepository, contractRepository: ContractRepository, { messageHandlers, tickIntervalMs, messageTimeoutMs, messageTimeoutOverrides, intentRepository, onchainProvider, debug, buildServices, }: Options);
1296
1114
  /** Start the message bus and attach service-worker event listeners. */
1297
1115
  start(): Promise<void>;
1298
1116
  /** Stop the message bus, cancel ticks, and stop all registered handlers. */
@@ -1387,51 +1205,22 @@ declare class MessageBus {
1387
1205
  static setup(path: string): Promise<ServiceWorker>;
1388
1206
  }
1389
1207
 
1390
- /**
1391
- * A leaf node in the Taproot script tree, as consumed by
1392
- * `@scure/btc-signer`'s `p2tr(internalKey, tree, ...)`.
1393
- */
1208
+ /** A leaf node in the Taproot script tree, as consumed by `@scure/btc-signer`'s `p2tr`. */
1394
1209
  interface TaprootLeaf {
1395
1210
  script: Bytes;
1396
1211
  leafVersion: number;
1397
1212
  }
1398
- /**
1399
- * Internal tree node shape consumed by `@scure/btc-signer`'s `p2tr`:
1400
- * - A leaf is `{ script, leafVersion }`
1401
- * - A branch is a 2-element tuple `[leftNode, rightNode]` of nodes
1402
- */
1213
+ /** A `p2tr` tree node: a leaf, or a `[left, right]` branch tuple. */
1403
1214
  type TaprootTreeNode = TaprootLeaf | [TaprootTreeNode, TaprootTreeNode];
1404
1215
  /**
1405
- * Assemble a Taproot script tree from a flat list of scripts using the
1406
- * exact algorithm arkd's btcd dependency uses
1407
- * (`txscript.AssembleTaprootScriptTree`, see
1408
- * https://github.com/btcsuite/btcd/blob/master/txscript/taproot.go).
1409
- *
1410
- * The algorithm:
1411
- *
1412
- * Phase 1 — pair leaves left-to-right:
1413
- * for i := 0; i < len(leaves); i += 2:
1414
- * if i is the last index (odd leaf at end):
1415
- * merge with the LAST branch built so far (do NOT pair as a fresh leaf)
1416
- * else:
1417
- * create a new branch from (leaves[i], leaves[i+1])
1216
+ * Assemble a Taproot script tree with btcd's `txscript.AssembleTaprootScriptTree` algorithm
1217
+ * (the one arkd uses).
1418
1218
  *
1419
- * Phase 2 — FIFO-queue merge branches:
1420
- * while branches has ≥ 2 items:
1421
- * take front two, combine into a new branch, push to back of queue
1219
+ * `@scure/btc-signer`'s `taprootListToTree` builds a Huffman tree instead; the two agree only for
1220
+ * power-of-2 leaf counts. Any other count yields a different merkle root → different output key
1221
+ * → arkd rejects spends with `INVALID_PSBT_INPUT`.
1422
1222
  *
1423
- * This matters because `@scure/btc-signer`'s `taprootListToTree` builds a
1424
- * Huffman tree (weight-1 leaves combine by smallest-weight pairs). For
1425
- * power-of-2 leaf counts both algorithms happen to produce the same
1426
- * perfectly-balanced binary tree and agree. For any other count they
1427
- * produce DIFFERENT shapes → different merkle roots → different taproot
1428
- * output keys → arkd rejects spends with `INVALID_PSBT_INPUT`.
1429
- *
1430
- * Reproducing btcd's algorithm here lets the SDK construct taptrees that
1431
- * arkd accepts for arbitrary leaf counts.
1432
- *
1433
- * @param scripts - Raw tapscript bytes for each leaf, in the order they
1434
- * should be encoded in the TapTree PSBT field.
1223
+ * @param scripts - Raw tapscript bytes per leaf, in TapTree PSBT field order.
1435
1224
  * @returns The nested-tuple form `p2tr` accepts.
1436
1225
  */
1437
1226
  declare function assembleBtcdTaprootTree(scripts: Bytes[]): TaprootTreeNode;
@@ -1492,11 +1281,10 @@ declare class AssetId {
1492
1281
  readonly groupIndex: number;
1493
1282
  private constructor();
1494
1283
  /**
1495
- * Create an asset id from a genesis transaction id and group index.
1284
+ * Create a validated asset id from a genesis transaction id and group index.
1496
1285
  *
1497
1286
  * @param txid - Hex-encoded genesis transaction id
1498
1287
  * @param groupIndex - Asset group index within the genesis transaction
1499
- * @returns A validated asset id
1500
1288
  * @throws Error if the txid is missing, malformed, or not 32 bytes long
1501
1289
  * @see fromString
1502
1290
  */
@@ -1504,8 +1292,6 @@ declare class AssetId {
1504
1292
  /**
1505
1293
  * Decode an asset id from its hex string representation.
1506
1294
  *
1507
- * @param s - Hex-encoded asset id
1508
- * @returns Decoded asset id
1509
1295
  * @throws Error if the string is not valid hex or does not encode a valid asset id
1510
1296
  * @see toString
1511
1297
  */
@@ -1513,22 +1299,18 @@ declare class AssetId {
1513
1299
  /**
1514
1300
  * Decode an asset id from its serialized bytes.
1515
1301
  *
1516
- * @param buf - Serialized asset id bytes
1517
- * @returns Decoded asset id
1518
1302
  * @throws Error if the buffer length is invalid
1519
1303
  */
1520
1304
  static fromBytes(buf: Uint8Array): AssetId;
1521
1305
  /**
1522
1306
  * Serialize the asset id to raw bytes.
1523
1307
  *
1524
- * @returns Serialized asset id bytes
1525
1308
  * @see fromBytes
1526
1309
  */
1527
1310
  serialize(): Uint8Array;
1528
1311
  /**
1529
1312
  * Encode the asset id to a hex string.
1530
1313
  *
1531
- * @returns Hex-encoded asset id
1532
1314
  * @see fromString
1533
1315
  */
1534
1316
  toString(): string;
@@ -1539,17 +1321,14 @@ declare class AssetId {
1539
1321
  */
1540
1322
  validate(): void;
1541
1323
  /**
1542
- * Decode an asset id from a binary reader.
1324
+ * Decode an asset id from a binary reader positioned at one.
1543
1325
  *
1544
- * @param reader - Reader positioned at an asset id
1545
- * @returns Decoded asset id
1546
1326
  * @throws Error if the reader does not contain enough bytes
1547
1327
  */
1548
1328
  static fromReader(reader: BufferReader): AssetId;
1549
1329
  /**
1550
1330
  * Serialize the asset id into an existing binary writer.
1551
1331
  *
1552
- * @param writer - Writer to append the asset id to
1553
1332
  * @see serialize
1554
1333
  */
1555
1334
  serializeTo(writer: BufferWriter): void;
@@ -1579,27 +1358,18 @@ declare class AssetRef {
1579
1358
  private constructor();
1580
1359
  /** Reference type discriminator. */
1581
1360
  get type(): AssetRefType;
1582
- /**
1583
- * Create an asset reference that points to a specific asset id.
1584
- *
1585
- * @param assetId - Asset id referenced by this pointer
1586
- * @returns Asset reference by id
1587
- * @see fromGroupIndex
1588
- */
1361
+ /** Reference a specific asset id. @see fromGroupIndex */
1589
1362
  static fromId(assetId: AssetId): AssetRef;
1590
1363
  /**
1591
- * Create an asset reference that points to another asset group by index.
1364
+ * Reference another asset group in the packet.
1592
1365
  *
1593
1366
  * @param groupIndex - Zero-based asset group index in the packet
1594
- * @returns Asset reference by group index
1595
1367
  * @see fromId
1596
1368
  */
1597
1369
  static fromGroupIndex(groupIndex: number): AssetRef;
1598
1370
  /**
1599
- * Decode an asset reference from its hex string form.
1371
+ * Decode an asset reference from hex.
1600
1372
  *
1601
- * @param s - Hex-encoded asset reference
1602
- * @returns Decoded asset reference
1603
1373
  * @throws Error if the string is not valid hex or does not encode a valid asset reference
1604
1374
  * @see toString
1605
1375
  */
@@ -1607,39 +1377,20 @@ declare class AssetRef {
1607
1377
  /**
1608
1378
  * Decode an asset reference from its serialized bytes.
1609
1379
  *
1610
- * @param buf - Serialized asset reference bytes
1611
- * @returns Decoded asset reference
1612
1380
  * @throws Error if the buffer is empty or malformed
1613
1381
  */
1614
1382
  static fromBytes(buf: Uint8Array): AssetRef;
1615
- /**
1616
- * Serialize the asset reference to raw bytes.
1617
- *
1618
- * @returns Serialized asset reference bytes
1619
- * @see fromBytes
1620
- */
1383
+ /** Serialize to raw bytes. @see fromBytes */
1621
1384
  serialize(): Uint8Array;
1622
- /**
1623
- * Encode the asset reference to a hex string.
1624
- *
1625
- * @returns Hex-encoded asset reference
1626
- * @see fromString
1627
- */
1385
+ /** Encode to hex. @see fromString */
1628
1386
  toString(): string;
1629
1387
  /**
1630
- * Decode an asset reference from a binary reader.
1388
+ * Decode an asset reference from a reader positioned at one.
1631
1389
  *
1632
- * @param reader - Reader positioned at an asset reference
1633
- * @returns Decoded asset reference
1634
1390
  * @throws Error if the type is unknown or the reader does not contain enough bytes
1635
1391
  */
1636
1392
  static fromReader(reader: BufferReader): AssetRef;
1637
- /**
1638
- * Serialize the asset reference into an existing binary writer.
1639
- *
1640
- * @param writer - Writer to append the asset reference to
1641
- * @see serialize
1642
- */
1393
+ /** Append the serialized reference to `writer`. @see serialize */
1643
1394
  serializeTo(writer: BufferWriter): void;
1644
1395
  }
1645
1396
 
@@ -1993,15 +1744,9 @@ declare class Packet implements ExtensionPacket {
1993
1744
  * Shipped from `src/` rather than `test/` so consumers outside this package can
1994
1745
  * pin the same bytes: `lightning-swap-service` imports this value, while NArk
1995
1746
  * and go-sdk vendor the backing `assetIdVectors.json` from a pinned revision of
1996
- * this repository.
1997
- *
1998
- * The encoding is implemented in seven places across three repos and every
1999
- * disagreement between them fails silently — a flipped txid makes a covenant
2000
- * unsatisfiable, a flipped group index resolves to a different asset, a case
2001
- * mismatch is a routing miss. None of those name their cause, which is what
2002
- * these vectors are for.
2003
- *
2004
- * @see plans/asset-id-shared-vectors.md
1747
+ * this repository. The encoding is implemented in seven places across three
1748
+ * repos, and every disagreement fails silently (a flipped txid makes a covenant
1749
+ * unsatisfiable, a flipped group index resolves to a different asset).
2005
1750
  */
2006
1751
  interface AssetIdVectors {
2007
1752
  readonly version: number;
@@ -2051,9 +1796,8 @@ interface AssetIdVectors {
2051
1796
  * The asset-id test vectors, deeply frozen.
2052
1797
  *
2053
1798
  * @remarks
2054
- * Frozen all the way down, not just at the top: every value that matters lives
2055
- * inside the nested arrays, and the module is a singleton — one consumer
2056
- * mutating an entry would corrupt it for every other consumer in the process.
1799
+ * Frozen all the way down: the module is a singleton, and one consumer mutating
1800
+ * a nested entry would corrupt it for every other consumer in the process.
2057
1801
  *
2058
1802
  * @example
2059
1803
  * ```typescript
@@ -2123,6 +1867,13 @@ declare class DustChangeError extends Error {
2123
1867
  readonly dustAmount: bigint;
2124
1868
  constructor(change: bigint, dustAmount: bigint);
2125
1869
  }
1870
+ /** Thrown when a collaborative exit's change VTXO is above the server's
1871
+ * per-output ceiling, which arkd answers with `AMOUNT_TOO_HIGH`. */
1872
+ declare class OversizedChangeError extends Error {
1873
+ readonly change: bigint;
1874
+ readonly maxAmount: bigint;
1875
+ constructor(change: bigint, maxAmount: bigint);
1876
+ }
2126
1877
  /**
2127
1878
  * Ramps is a class wrapping `settle` method to provide a more convenient interface for onboarding and offboarding operations.
2128
1879
  *
@@ -2172,6 +1923,10 @@ declare class Ramps {
2172
1923
  * @param feeInfo - The fee info to deduct from the offboard amount.
2173
1924
  * @param amount - The amount to offboard. If not provided, the total amount of virtual outputs will be offboarded.
2174
1925
  * @param eventCallback - Optional callback that receives settlement events
1926
+ * @param vtxos - Specific virtual outputs to spend, mirroring {@link onboard}'s
1927
+ * `boardingUtxos`. Omitted, every spendable one is spent — merging the whole
1928
+ * off-chain balance into a single change output. Taken as given like
1929
+ * `settle({ inputs })`: an `amount` these cannot cover is an error, not a top-up.
2175
1930
  * @returns The Arkade transaction id created by settlement
2176
1931
  * @throws Error if no virtual outputs remain after fee deduction or the destination address cannot be decoded
2177
1932
  * @see IWallet.getSpendableVtxos
@@ -2183,26 +1938,39 @@ declare class Ramps {
2183
1938
  * await ramps.offboard('bc1q...', feeInfo);
2184
1939
  * ```
2185
1940
  */
2186
- offboard(destinationAddress: string, feeInfo: FeeInfo, amount?: bigint, eventCallback?: (event: SettlementEvent) => void): ReturnType<IWallet["settle"]>;
1941
+ offboard(destinationAddress: string, feeInfo: FeeInfo, amount?: bigint, eventCallback?: (event: SettlementEvent) => void, vtxos?: NormalizedExtendedVirtualCoin[]): ReturnType<IWallet["settle"]>;
1942
+ /**
1943
+ * Collaboratively exit with the DESTINATION paid exactly `amount`, pricing the
1944
+ * fee on that output rather than on a grossed-up figure. {@link offboard} keeps
1945
+ * the other anchor, which needs `g - fee(g) = amount` solved — impossible for
1946
+ * a program charging the whole output.
1947
+ */
1948
+ offboardExact(params: {
1949
+ destinationAddress: string;
1950
+ feeInfo: FeeInfo;
1951
+ /** Sats the destination receives, exactly. */
1952
+ amount: bigint;
1953
+ eventCallback?: (event: SettlementEvent) => void;
1954
+ vtxos?: NormalizedExtendedVirtualCoin[];
1955
+ }): ReturnType<IWallet["settle"]>;
1956
+ private offboardInputs;
1957
+ /** Every candidate, or with `concurrentSpending` the shortest covering prefix in send order. */
1958
+ private fundExit;
1959
+ /** Re-runs an SDK-picked exit that lost a coin to a concurrent spend. */
1960
+ private withRepick;
1961
+ /** Fund the change output: pay its own fee, then judge it against both
1962
+ * server-side bounds. `0n` in is `0n` out — no change output at all. */
1963
+ private fundChange;
2187
1964
  }
2188
1965
 
2189
1966
  /**
2190
- * HD-wallet {@link DescriptorProvider} that allocates a fresh signing
2191
- * descriptor on every call. The provider holds no notion of "current" — it
2192
- * is a pure rotating allocator. The question of "which descriptor is the
2193
- * wallet currently bound to?" is answered by querying the contract
2194
- * repository for active contracts, not by asking this provider.
1967
+ * HD-wallet {@link DescriptorProvider} that allocates a fresh signing descriptor on every call.
1968
+ * A pure rotating allocator: which descriptor the wallet is bound to is answered by the contract
1969
+ * repository, not this provider.
2195
1970
  *
2196
- * State is persisted under `WalletRepository.getWalletState().settings.hd` so
2197
- * that no storage-schema migration is required when switching a wallet from
2198
- * single-key to HD. The provider is backed by an {@link HDCapableIdentity},
2199
- * which carries the wildcard account descriptor template (for derivation)
2200
- * and the signing primitives.
2201
- *
2202
- * The read-modify-write of the persisted index runs inside the shared per-
2203
- * repo `updateWalletState` mutex, so two `getNextSigningDescriptor` callers
2204
- * — including those driving separate `HDDescriptorProvider` instances on
2205
- * the same repo — can never observe the same index.
1971
+ * State lives in `settings.hd` of the wallet state, so switching single-key → HD needs no schema
1972
+ * migration. Allocation runs inside the shared per-repo `updateWalletState` mutex, so callers
1973
+ * (even on separate instances over one repo) never observe the same index.
2206
1974
  *
2207
1975
  * @example
2208
1976
  * ```ts
@@ -2218,104 +1986,50 @@ declare class HDDescriptorProvider implements DescriptorProvider, ReceiveRotator
2218
1986
  private readonly walletRepository;
2219
1987
  private constructor();
2220
1988
  /**
2221
- * Construct an HDDescriptorProvider. No I/O is performed here;
2222
- * persisted state is read lazily on the first call to
2223
- * `getNextSigningDescriptor`. A descriptor-mismatch error surfaces on
2224
- * first use rather than at boot.
1989
+ * Construct an HDDescriptorProvider. No I/O: state is read lazily, so a descriptor-mismatch
1990
+ * error surfaces on first use rather than here.
2225
1991
  */
2226
1992
  static create(identity: HDCapableIdentity, walletRepository: WalletRepository): Promise<HDDescriptorProvider>;
2227
- /**
2228
- * Allocate the next descriptor and return it. The first call on a fresh
2229
- * wallet returns descriptor at index 0; subsequent calls return 1, 2, 3,
2230
- * ... in order. Each call is atomic with respect to other rotations on
2231
- * the same repo: two concurrent callers can never observe the same
2232
- * index.
2233
- */
1993
+ /** Allocate and return the next descriptor (index 0, 1, 2, …), atomically per repo. */
2234
1994
  getNextSigningDescriptor(): Promise<string>;
2235
1995
  /**
2236
- * Re-derive the descriptor at the most recently allocated index
2237
- * WITHOUT advancing — i.e. read the same descriptor
2238
- * `getNextSigningDescriptor` last returned. Returns `undefined`
2239
- * when no descriptor has ever been allocated on this repo.
2240
- *
2241
- * Used by the boot path to keep the wallet's display address
2242
- * stable across restarts: when no tagged display contract exists
2243
- * (e.g. a fresh wallet that hasn't rotated yet, or a wallet whose
2244
- * baseline-only repo carries no rotation history), the boot should
2245
- * re-derive the existing index rather than burn a new one.
1996
+ * Re-derive the descriptor `getNextSigningDescriptor` last returned, WITHOUT advancing;
1997
+ * `undefined` if none was ever allocated. Lets boot keep the display address stable across
1998
+ * restarts when no tagged display contract exists, instead of burning a new index.
2246
1999
  */
2247
2000
  getCurrentSigningDescriptor(): Promise<string | undefined>;
2248
- /**
2249
- * The most recently allocated index, or `undefined` when nothing has ever
2250
- * been allocated on this repo. Read-only peek at the watermark that
2251
- * {@link getNextSigningDescriptor} advances.
2252
- */
2001
+ /** Read-only peek at the allocation watermark; `undefined` if nothing was ever allocated. */
2253
2002
  getLastIndexUsed(): Promise<number | undefined>;
2254
2003
  /**
2255
- * Monotonically advance the allocation watermark so the next
2256
- * `getNextSigningDescriptor()` skips indices discovered by a restore
2257
- * scan. Never rewinds: a lower or equal `index` is a no-op.
2258
- *
2259
- * An invalid `index` (non-integer / negative / past the BIP32
2260
- * non-hardened ceiling) is ignored (no-op): persisting it would corrupt
2261
- * `lastIndexUsed` and make the next `parseSettings()` throw, mirroring
2262
- * the validation parseSettings already enforces. The upper bound matters
2263
- * because the damage outlives the call — `materializeDescriptorAt` cannot
2264
- * derive at or above 2^31, so a watermark parked there would fail every
2265
- * subsequent allocation for the life of the repo.
2004
+ * Monotonically advance the watermark past indices found by a restore scan; never rewinds.
2005
+ * An invalid `index` (non-integer, negative, or >= 2^31) is ignored: persisting it would make
2006
+ * `parseSettings()` throw, and a watermark at the hardened ceiling would fail every later
2007
+ * allocation for the life of the repo.
2266
2008
  */
2267
2009
  advanceLastIndexUsed(index: number): Promise<void>;
2268
- /**
2269
- * Returns true when the given descriptor is derivable from this wallet's
2270
- * seed. Delegates to the underlying identity, which handles both HD and
2271
- * simple `tr(pubkey)` descriptors.
2272
- */
2010
+ /** Whether `descriptor` (HD or simple `tr(pubkey)`) is derivable from this wallet's seed. */
2273
2011
  isOurs(descriptor: string): boolean;
2274
- /**
2275
- * Signs each request with the key derived from its descriptor. Delegates
2276
- * to the identity's signing primitives — the identity, not the provider,
2277
- * holds the seed.
2278
- */
2012
+ /** Signs each request with its descriptor's derived key (the identity holds the seed). */
2279
2013
  signWithDescriptor(requests: DescriptorSigningRequest[]): Promise<Transaction[]>;
2280
2014
  /** Signs a message using the key derived from `descriptor`. */
2281
2015
  signMessageWithDescriptor(descriptor: string, message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
2282
- /**
2283
- * HD providers participate in receive rotation. The default
2284
- * factory boot (contract-repo lookup → allocate fresh descriptor)
2285
- * is exactly what we want, so this just delegates to
2286
- * {@link WalletReceiveRotator.defaultBoot}.
2287
- */
2016
+ /** HD providers take part in receive rotation via {@link WalletReceiveRotator.defaultBoot}. */
2288
2017
  createReceiveRotator(opts: ReceiveRotatorBootOpts): Promise<ReceiveRotatorBoot | undefined>;
2289
2018
  /**
2290
- * Substitute the wildcard in the identity's account-descriptor template
2291
- * with a concrete index, going through the descriptors-scure parser
2292
- * rather than ad-hoc string substitution. The parser's `expand({ index })`
2293
- * call validates that the input is a ranged template AND produces a
2294
- * canonical materialized key expression at the given index.
2295
- *
2296
- * This is a pure read: it does NOT advance the allocation watermark.
2297
- * Used by restore's gap-scan to peek descriptors at arbitrary indices
2298
- * without side-effects.
2019
+ * Materialize the account template at `index` via the descriptors-scure parser (validates the
2020
+ * ranged template and yields a canonical key expression) rather than string substitution.
2021
+ * Pure: does NOT advance the watermark, so restore's gap-scan can peek arbitrary indices.
2299
2022
  */
2300
2023
  materializeDescriptorAt(index: number): string;
2301
2024
  /**
2302
- * Run the read-modify-write of HD settings inside the shared per-repo
2303
- * wallet-state mutex. The closure receives a freshly-validated settings
2304
- * snapshot, mutates it, and returns whatever value the caller wants to
2305
- * surface; the mutated settings are then persisted as part of the same
2306
- * atomic update.
2307
- *
2308
- * Doing the read inside the lock is what prevents two providers (or two
2309
- * concurrent callers on the same provider) from racing on a stale index.
2025
+ * Read-modify-write HD settings inside the shared per-repo wallet-state mutex; `fn` mutates a
2026
+ * validated snapshot that is persisted atomically. Reading inside the lock prevents races on a
2027
+ * stale index.
2310
2028
  */
2311
2029
  private mutate;
2312
2030
  /**
2313
- * Validate the persisted HD settings (or initialize a fresh record when
2314
- * absent) and return a clone safe for the caller to mutate.
2315
- *
2316
- * The cast to `HDWalletSettings` trusts storage; a corrupted or
2317
- * partially-migrated repo could otherwise produce `NaN` descriptors.
2318
- * Fail loud rather than silently derive garbage.
2031
+ * Validate persisted HD settings (or init a fresh record) and return a mutable clone. Fails
2032
+ * loud: a corrupt repo would otherwise derive `NaN` descriptors.
2319
2033
  */
2320
2034
  private parseSettings;
2321
2035
  }
@@ -2334,6 +2048,7 @@ type RequestInitWallet = RequestEnvelope & {
2334
2048
  payload: {
2335
2049
  arkServerUrl: string;
2336
2050
  arkServerPublicKey?: string;
2051
+ lazyBoarding?: boolean;
2337
2052
  };
2338
2053
  };
2339
2054
  type ResponseInitWallet = ResponseEnvelope & {
@@ -2443,13 +2158,14 @@ type ResponseGetVtxos = ResponseEnvelope & {
2443
2158
  type RequestGetSpendableVtxos = RequestEnvelope & {
2444
2159
  type: "GET_SPENDABLE_VTXOS";
2445
2160
  payload: {
2446
- filter?: GetVtxosFilter;
2161
+ filter?: GetSpendableVtxosFilter;
2447
2162
  };
2448
2163
  };
2449
2164
  type ResponseGetSpendableVtxos = ResponseEnvelope & {
2450
2165
  type: "SPENDABLE_VTXOS";
2451
2166
  payload: {
2452
2167
  vtxos: Awaited<ReturnType<IWallet["getSpendableVtxos"]>>;
2168
+ filterApplied?: boolean;
2453
2169
  };
2454
2170
  };
2455
2171
  type RequestGetBoardingUtxos = RequestEnvelope & {
@@ -2547,10 +2263,28 @@ type RequestGetContractsWithVtxos = RequestEnvelope & {
2547
2263
  type: "GET_CONTRACTS_WITH_VTXOS";
2548
2264
  payload: {
2549
2265
  filter?: GetContractsFilter;
2266
+ options?: {
2267
+ maxSyncAgeMs?: number;
2268
+ unspentOnly?: boolean;
2269
+ requireSynced?: boolean;
2270
+ };
2550
2271
  };
2551
2272
  };
2552
2273
  type ResponseGetContractsWithVtxos = ResponseEnvelope & {
2553
2274
  type: "CONTRACTS_WITH_VTXOS";
2275
+ payload: {
2276
+ contracts: ContractWithVtxos[];
2277
+ filterApplied?: boolean;
2278
+ };
2279
+ };
2280
+ type RequestGetStoredContractsWithVtxos = RequestEnvelope & {
2281
+ type: "GET_STORED_CONTRACTS_WITH_VTXOS";
2282
+ payload: {
2283
+ filter?: GetContractsFilter;
2284
+ };
2285
+ };
2286
+ type ResponseGetStoredContractsWithVtxos = ResponseEnvelope & {
2287
+ type: "STORED_CONTRACTS_WITH_VTXOS";
2554
2288
  payload: {
2555
2289
  contracts: ContractWithVtxos[];
2556
2290
  };
@@ -2558,26 +2292,26 @@ type ResponseGetContractsWithVtxos = ResponseEnvelope & {
2558
2292
  type RequestWatchScript = RequestEnvelope & {
2559
2293
  type: "WATCH_SCRIPT";
2560
2294
  payload: {
2561
- script: string;
2295
+ script: string | string[];
2562
2296
  label?: string;
2563
2297
  };
2564
2298
  };
2565
2299
  type ResponseWatchScript = ResponseEnvelope & {
2566
2300
  type: "SCRIPT_WATCHED";
2567
2301
  payload: {
2568
- script: string;
2302
+ script: string | string[];
2569
2303
  };
2570
2304
  };
2571
2305
  type RequestUnwatchScript = RequestEnvelope & {
2572
2306
  type: "UNWATCH_SCRIPT";
2573
2307
  payload: {
2574
- script: string;
2308
+ script: string | string[];
2575
2309
  };
2576
2310
  };
2577
2311
  type ResponseUnwatchScript = ResponseEnvelope & {
2578
2312
  type: "SCRIPT_UNWATCHED";
2579
2313
  payload: {
2580
- script: string;
2314
+ script: string | string[];
2581
2315
  };
2582
2316
  };
2583
2317
  type RequestGetWatchedScripts = RequestEnvelope & {
@@ -2607,6 +2341,11 @@ type RequestUpdateContract = RequestEnvelope & {
2607
2341
  payload: {
2608
2342
  script: string;
2609
2343
  updates: Partial<Omit<Contract, "id" | "createdAt">>;
2344
+ /**
2345
+ * Set only by the proxy's `setContractWatchState`, so the worker keeps its
2346
+ * unchanged-state no-op. A worker predating the flag ignores it and writes.
2347
+ */
2348
+ watchStateOnly?: boolean;
2610
2349
  };
2611
2350
  };
2612
2351
  type ResponseUpdateContract = ResponseEnvelope & {
@@ -2615,6 +2354,10 @@ type ResponseUpdateContract = ResponseEnvelope & {
2615
2354
  contract: Contract;
2616
2355
  };
2617
2356
  };
2357
+ /** Answers a `watchStateOnly` update; carries no row, so nothing is re-read. */
2358
+ type ResponseContractWatchStateSet = ResponseEnvelope & {
2359
+ type: "CONTRACT_WATCH_STATE_SET";
2360
+ };
2618
2361
  type RequestDeleteContract = RequestEnvelope & {
2619
2362
  type: "DELETE_CONTRACT";
2620
2363
  payload: {
@@ -2732,6 +2475,15 @@ type ResponseGetAllSpendingPaths = ResponseEnvelope & {
2732
2475
  paths: PathSelection[];
2733
2476
  };
2734
2477
  };
2478
+ type RequestGetUnsupportedContracts = RequestEnvelope & {
2479
+ type: "GET_UNSUPPORTED_CONTRACTS";
2480
+ };
2481
+ type ResponseGetUnsupportedContracts = ResponseEnvelope & {
2482
+ type: "UNSUPPORTED_CONTRACTS";
2483
+ payload: {
2484
+ contracts: Contract[];
2485
+ };
2486
+ };
2735
2487
  type ResponseSettleEvent = ResponseEnvelope & {
2736
2488
  broadcast: true;
2737
2489
  type: "SETTLE_EVENT";
@@ -2778,6 +2530,36 @@ type RequestSend = RequestEnvelope & {
2778
2530
  recipients: [Recipient, ...Recipient[]];
2779
2531
  /** @see SendParams.selectedVtxos */
2780
2532
  selectedVtxos?: ExtendedVirtualCoin[];
2533
+ /** @see SendParams.maxChangeFee */
2534
+ maxChangeFee?: number;
2535
+ };
2536
+ };
2537
+ type RequestSendWithDeadline = RequestEnvelope & {
2538
+ type: "SEND_WITH_DEADLINE";
2539
+ payload: {
2540
+ recipients: [Recipient, ...Recipient[]];
2541
+ selectedVtxos?: ExtendedVirtualCoin[];
2542
+ /** @see SendParams.maxChangeFee */
2543
+ maxChangeFee?: number;
2544
+ validUntil: number;
2545
+ };
2546
+ };
2547
+ type RequestSendWithInputExpiryFloor = RequestEnvelope & {
2548
+ type: "SEND_WITH_INPUT_EXPIRY_FLOOR";
2549
+ payload: {
2550
+ recipients: [Recipient, ...Recipient[]];
2551
+ selectedVtxos?: ExtendedVirtualCoin[];
2552
+ /** @see SendParams.maxChangeFee */
2553
+ maxChangeFee?: number;
2554
+ inputExpiryFloor: InputExpiryFloor;
2555
+ validUntil?: number;
2556
+ };
2557
+ };
2558
+ type ResponseSendDeadlineExceeded = ResponseEnvelope & {
2559
+ type: "SEND_DEADLINE_EXCEEDED";
2560
+ error: Error;
2561
+ payload: {
2562
+ validUntil: number;
2781
2563
  };
2782
2564
  };
2783
2565
  type ResponseSend = ResponseEnvelope & {
@@ -2996,8 +2778,8 @@ type RequestRestoreWallet = RequestEnvelope & {
2996
2778
  type ResponseRestoreWallet = ResponseEnvelope & {
2997
2779
  type: "RESTORE_WALLET_SUCCESS";
2998
2780
  };
2999
- type WalletUpdaterRequest = RequestInitWallet | RequestSettle | RequestGetAddress | RequestGetBoardingAddress | RequestGetArkadeInfo | RequestIndexerGetVtxos | RequestIndexerGetVirtualTxs | RequestSubmitTx | RequestFinalizeTx | RequestGetBalance | RequestGetVtxos | RequestGetSpendableVtxos | RequestGetBoardingUtxos | RequestGetTransactionHistory | RequestGetStatus | RequestGetContractSyncState | RequestClear | RequestReloadWallet | RequestSignTransaction | RequestCreateContract | RequestGetContracts | RequestGetContractsWithVtxos | RequestWatchScript | RequestUnwatchScript | RequestGetWatchedScripts | RequestAnnotateVtxos | RequestUpdateContract | RequestDeleteContract | RequestGetSpendablePaths | RequestGetAllSpendingPaths | RequestIsContractManagerWatching | RequestRefreshVtxos | RequestRefreshOutpoints | RequestGetCurrentSigningDescriptor | RequestGetNextSigningDescriptor | RequestGetNewAddresses | RequestGetUsedSigningDescriptors | RequestAdvanceSigningDescriptorWatermark | RequestSend | RequestGetAssetDetails | RequestIssue | RequestReissue | RequestBurn | RequestDelegate | RequestGetDelegateInfo | RequestRecoverVtxos | RequestGetRecoverableBalance | RequestGetExpiringVtxos | RequestRenewVtxos | RequestGetExpiredBoardingUtxos | RequestSweepExpiredBoardingUtxos | RequestMigrateDeprecatedSignerVtxos | RequestGetDeprecatedSignerStatus | RequestRestoreWallet;
3000
- type WalletUpdaterResponse = ResponseEnvelope & (ResponseInitWallet | ResponseSettle | ResponseSettleEvent | ResponseGetAddress | ResponseGetBoardingAddress | ResponseGetArkadeInfo | ResponseIndexerGetVtxos | ResponseIndexerGetVirtualTxs | ResponseSubmitTx | ResponseFinalizeTx | ResponseGetBalance | ResponseGetVtxos | ResponseGetSpendableVtxos | ResponseGetBoardingUtxos | ResponseGetTransactionHistory | ResponseGetStatus | ResponseGetContractSyncState | ResponseClear | ResponseReloadWallet | ResponseUtxoUpdate | ResponseVtxoUpdate | ResponseSignTransaction | ResponseCreateContract | ResponseGetContracts | ResponseGetContractsWithVtxos | ResponseWatchScript | ResponseUnwatchScript | ResponseGetWatchedScripts | ResponseAnnotateVtxos | ResponseUpdateContract | ResponseDeleteContract | ResponseGetSpendablePaths | ResponseGetAllSpendingPaths | ResponseIsContractManagerWatching | ResponseRefreshVtxos | ResponseRefreshOutpoints | ResponseGetCurrentSigningDescriptor | ResponseGetNextSigningDescriptor | ResponseGetNewAddresses | ResponseGetUsedSigningDescriptors | ResponseAdvanceSigningDescriptorWatermark | ResponseContractEvent | ResponseSend | ResponseGetAssetDetails | ResponseIssue | ResponseReissue | ResponseBurn | ResponseDelegate | ResponseGetDelegateInfo | ResponseRecoverVtxos | ResponseRecoverVtxosEvent | ResponseGetRecoverableBalance | ResponseGetExpiringVtxos | ResponseRenewVtxos | ResponseRenewVtxosEvent | ResponseGetExpiredBoardingUtxos | ResponseSweepExpiredBoardingUtxos | ResponseMigrateDeprecatedSignerVtxos | ResponseMigrateDeprecatedSignerVtxosEvent | ResponseGetDeprecatedSignerStatus | ResponseRestoreWallet);
2781
+ type WalletUpdaterRequest = RequestInitWallet | RequestSettle | RequestGetAddress | RequestGetBoardingAddress | RequestGetArkadeInfo | RequestIndexerGetVtxos | RequestIndexerGetVirtualTxs | RequestSubmitTx | RequestFinalizeTx | RequestGetBalance | RequestGetVtxos | RequestGetSpendableVtxos | RequestGetBoardingUtxos | RequestGetTransactionHistory | RequestGetStatus | RequestGetContractSyncState | RequestClear | RequestReloadWallet | RequestSignTransaction | RequestCreateContract | RequestGetContracts | RequestGetContractsWithVtxos | RequestGetStoredContractsWithVtxos | RequestWatchScript | RequestUnwatchScript | RequestGetWatchedScripts | RequestAnnotateVtxos | RequestUpdateContract | RequestDeleteContract | RequestGetSpendablePaths | RequestGetAllSpendingPaths | RequestGetUnsupportedContracts | RequestIsContractManagerWatching | RequestRefreshVtxos | RequestRefreshOutpoints | RequestGetCurrentSigningDescriptor | RequestGetNextSigningDescriptor | RequestGetNewAddresses | RequestGetUsedSigningDescriptors | RequestAdvanceSigningDescriptorWatermark | RequestSend | RequestSendWithDeadline | RequestSendWithInputExpiryFloor | RequestGetAssetDetails | RequestIssue | RequestReissue | RequestBurn | RequestDelegate | RequestGetDelegateInfo | RequestRecoverVtxos | RequestGetRecoverableBalance | RequestGetExpiringVtxos | RequestRenewVtxos | RequestGetExpiredBoardingUtxos | RequestSweepExpiredBoardingUtxos | RequestMigrateDeprecatedSignerVtxos | RequestGetDeprecatedSignerStatus | RequestRestoreWallet;
2782
+ type WalletUpdaterResponse = ResponseEnvelope & (ResponseInitWallet | ResponseSettle | ResponseSettleEvent | ResponseGetAddress | ResponseGetBoardingAddress | ResponseGetArkadeInfo | ResponseIndexerGetVtxos | ResponseIndexerGetVirtualTxs | ResponseSubmitTx | ResponseFinalizeTx | ResponseGetBalance | ResponseGetVtxos | ResponseGetSpendableVtxos | ResponseGetBoardingUtxos | ResponseGetTransactionHistory | ResponseGetStatus | ResponseGetContractSyncState | ResponseClear | ResponseReloadWallet | ResponseUtxoUpdate | ResponseVtxoUpdate | ResponseSignTransaction | ResponseCreateContract | ResponseGetContracts | ResponseGetContractsWithVtxos | ResponseGetStoredContractsWithVtxos | ResponseWatchScript | ResponseUnwatchScript | ResponseGetWatchedScripts | ResponseAnnotateVtxos | ResponseUpdateContract | ResponseContractWatchStateSet | ResponseDeleteContract | ResponseGetSpendablePaths | ResponseGetAllSpendingPaths | ResponseGetUnsupportedContracts | ResponseIsContractManagerWatching | ResponseRefreshVtxos | ResponseRefreshOutpoints | ResponseGetCurrentSigningDescriptor | ResponseGetNextSigningDescriptor | ResponseGetNewAddresses | ResponseGetUsedSigningDescriptors | ResponseAdvanceSigningDescriptorWatermark | ResponseContractEvent | ResponseSend | ResponseSendDeadlineExceeded | ResponseGetAssetDetails | ResponseIssue | ResponseReissue | ResponseBurn | ResponseDelegate | ResponseGetDelegateInfo | ResponseRecoverVtxos | ResponseRecoverVtxosEvent | ResponseGetRecoverableBalance | ResponseGetExpiringVtxos | ResponseRenewVtxos | ResponseRenewVtxosEvent | ResponseGetExpiredBoardingUtxos | ResponseSweepExpiredBoardingUtxos | ResponseMigrateDeprecatedSignerVtxos | ResponseMigrateDeprecatedSignerVtxosEvent | ResponseGetDeprecatedSignerStatus | ResponseRestoreWallet);
3001
2783
  declare class WalletMessageHandler implements MessageHandler<WalletUpdaterRequest, WalletUpdaterResponse> {
3002
2784
  readonly messageTag: string;
3003
2785
  private wallet;
@@ -3011,6 +2793,7 @@ declare class WalletMessageHandler implements MessageHandler<WalletUpdaterReques
3011
2793
  private channel;
3012
2794
  private incomingFundsEpoch;
3013
2795
  private contractEventsEpoch;
2796
+ private boardingEpoch;
3014
2797
  /** Per-request progress callbacks: ends with the handler, not with a re-init. */
3015
2798
  private requestEpoch;
3016
2799
  /**
@@ -3037,6 +2820,10 @@ declare class WalletMessageHandler implements MessageHandler<WalletUpdaterReques
3037
2820
  isLongRunning(message: WalletUpdaterRequest): boolean;
3038
2821
  handleMessage(message: WalletUpdaterRequest): Promise<WalletUpdaterResponse>;
3039
2822
  private handleInitWallet;
2823
+ /** @see RequestInitWallet.payload.lazyBoarding */
2824
+ private lazyBoardingInit;
2825
+ /** Set once this session has actually fetched the boarding addresses. */
2826
+ private boardingLoaded;
3040
2827
  /**
3041
2828
  * The worker's own balance. Same bucketing rules as `Wallet.getBalance` —
3042
2829
  * both call {@link computeOffchainBalance} — but deliberately a different
@@ -3046,14 +2833,26 @@ declare class WalletMessageHandler implements MessageHandler<WalletUpdaterReques
3046
2833
  * runs over this method's local snapshot instead.
3047
2834
  */
3048
2835
  private handleGetBalance;
3049
- private getAllBoardingUtxos;
2836
+ private getBoardingUtxosForBalance;
3050
2837
  private onWalletInitialized;
3051
2838
  /**
3052
- * Refresh virtual outputs, boarding inputs, and transaction history from cache.
3053
- * Shared by onWalletInitialized (full bootstrap) and reloadWallet
3054
- * (post-refresh), avoiding duplicate subscriptions and VtxoManager restarts.
2839
+ * Refresh boarding inputs and transaction history. The virtual outputs come
2840
+ * from the contract manager, which runs before this. Shared by
2841
+ * onWalletInitialized (full bootstrap) and reloadWallet (post-refresh),
2842
+ * avoiding duplicate subscriptions and VtxoManager restarts.
2843
+ *
2844
+ * Both legs reach the onchain provider, so `lazyBoarding` moves them both
2845
+ * off the caller's path. @see RequestInitWallet.payload.lazyBoarding
3055
2846
  */
3056
2847
  private refreshCachedData;
2848
+ /** @param gen - set by a background caller; each write is skipped once it goes stale. */
2849
+ private refreshHistoryCache;
2850
+ /**
2851
+ * @param gen - set by a background caller; each write here is skipped once it goes stale.
2852
+ * The fetch saves the fetched rows itself, before control returns, so that one write is
2853
+ * outside this check.
2854
+ */
2855
+ private refreshBoardingCache;
3057
2856
  /**
3058
2857
  * Force a full VTXO refresh from the indexer, then refresh cached data.
3059
2858
  * Used by RELOAD_WALLET to ensure fresh data without re-subscribing
@@ -3072,6 +2871,14 @@ declare class WalletMessageHandler implements MessageHandler<WalletUpdaterReques
3072
2871
  /**
3073
2872
  * Read all virtual outputs from the repository, aggregated across all contract
3074
2873
  * addresses and the wallet's primary address, with deduplication.
2874
+ *
2875
+ * Recovery-only contracts (imported by `claimCash` for server-swept
2876
+ * arkcash) are excluded by default, mirroring {@link ReadonlyWallet.getVtxos}:
2877
+ * they are settled in their own isolated intent and must stay out of the
2878
+ * wallet's balance / VTXO / coin-selection / pending-tx views that read this.
2879
+ * The transaction-history caller opts back in via `includeRecoveryOnly` to
2880
+ * match the non-worker `getTransactionHistory`, which reads contracts
2881
+ * directly and does include them.
3075
2882
  */
3076
2883
  private getVtxosFromRepo;
3077
2884
  /**
@@ -3086,6 +2893,9 @@ declare class WalletMessageHandler implements MessageHandler<WalletUpdaterReques
3086
2893
  * VTXOs with no matching row in the gate, and `gatedContracts` lists only
3087
2894
  * what it knows is closed — so the coins of a just-registered escrowed
3088
2895
  * contract would count as available until the next poll.
2896
+ *
2897
+ * Recovery-only contracts are skipped unless `includeRecoveryOnly` (see
2898
+ * {@link getVtxosFromRepo}).
3089
2899
  */
3090
2900
  private repoSnapshot;
3091
2901
  /**
@@ -3138,6 +2948,10 @@ declare const DEFAULT_MESSAGE_TIMEOUTS: Readonly<Record<RequestType, number>>;
3138
2948
  * ```
3139
2949
  */
3140
2950
  interface ServiceWorkerWalletOptions {
2951
+ /** Start contract synchronization in the background; inspect provider connection state. */
2952
+ lazyInitialization?: boolean;
2953
+ /** Defer boarding and history loading; render boarding.loaded=false as unknown. */
2954
+ lazyBoarding?: boolean;
3141
2955
  /** Arkade server endpoint and optional public key. */
3142
2956
  arkServer?: {
3143
2957
  url: string;
@@ -3161,6 +2975,8 @@ interface ServiceWorkerWalletOptions {
3161
2975
  messageBusTimeoutMs?: number;
3162
2976
  /** Optional settlement configuration forwarded to the worker wallet. */
3163
2977
  settlementConfig?: SettlementConfig | false;
2978
+ /** Forwarded to the worker wallet. @see WalletConfig.concurrentSpending */
2979
+ concurrentSpending?: boolean;
3164
2980
  /**
3165
2981
  * Receive-address strategy forwarded to the worker wallet.
3166
2982
  *
@@ -3179,17 +2995,13 @@ interface ServiceWorkerWalletOptions {
3179
2995
  */
3180
2996
  lookAheadWindow?: number;
3181
2997
  /**
3182
- * Timelock floors forwarded to the worker wallet. Lowering either below its
2998
+ * Batch expiry floor forwarded to the worker wallet. Lowering it below its
3183
2999
  * per-network default relaxes a fund-safety bound; intended for local
3184
- * testing. The fast public test networks whose arkd runs below the
3185
- * mainnet-grade checkpoint floor (signet, mutinynet) are defaulted to their
3186
- * own advertised value, so neither needs these set.
3000
+ * testing.
3187
3001
  *
3188
3002
  * @see WalletConfig.minBatchExpirySeconds
3189
3003
  */
3190
3004
  minBatchExpirySeconds?: bigint;
3191
- /** @see WalletConfig.minCheckpointExitDelaySeconds */
3192
- minCheckpointExitDelaySeconds?: bigint;
3193
3005
  /**
3194
3006
  * Per-request timeout overrides for wallet-updater messages.
3195
3007
  * @see DEFAULT_MESSAGE_TIMEOUTS
@@ -3219,6 +3031,7 @@ type ServiceWorkerWalletSetupOptions = ServiceWorkerWalletOptions & {
3219
3031
  serviceWorkerActivationTimeoutMs?: number;
3220
3032
  };
3221
3033
  type MessageBusInitConfig = {
3034
+ lazyInitialization?: boolean;
3222
3035
  wallet: SerializedIdentity;
3223
3036
  arkServer: {
3224
3037
  url: string;
@@ -3227,11 +3040,11 @@ type MessageBusInitConfig = {
3227
3040
  delegateUrl?: string;
3228
3041
  timeoutMs?: number;
3229
3042
  settlementConfig?: SettlementConfig | false;
3043
+ concurrentSpending?: boolean;
3230
3044
  walletMode?: ServiceWorkerWalletMode;
3231
3045
  watcherConfig?: Partial<Omit<ContractWatcherConfig, "indexerProvider">>;
3232
3046
  lookAheadWindow?: number;
3233
3047
  minBatchExpirySeconds?: bigint;
3234
- minCheckpointExitDelaySeconds?: bigint;
3235
3048
  messageTimeouts?: Record<string, number>;
3236
3049
  };
3237
3050
  declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
@@ -3246,13 +3059,6 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
3246
3059
  protected initWalletPayload: RequestInitWallet["payload"] | null;
3247
3060
  protected messageBusTimeoutMs?: number;
3248
3061
  protected messageTimeouts: Record<RequestType, number>;
3249
- protected arkServer?: {
3250
- url: string;
3251
- publicKey?: string;
3252
- };
3253
- protected delegateUrl?: string;
3254
- protected watcherConfig?: Partial<Omit<ContractWatcherConfig, "indexerProvider">>;
3255
- protected settlementConfig?: SettlementConfig | false;
3256
3062
  private reinitPromise;
3257
3063
  private pingPromise;
3258
3064
  private inflightRequests;
@@ -3267,6 +3073,8 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
3267
3073
  * @throws Error if service-worker initialization fails
3268
3074
  */
3269
3075
  static create(options: ServiceWorkerWalletCreateOptions): Promise<ServiceWorkerReadonlyWallet>;
3076
+ /** Shared tail of both `create()` factories: boot the bus, INIT_WALLET, cache for reinit. */
3077
+ protected static bootstrap<W extends ServiceWorkerReadonlyWallet>(wallet: W, options: ServiceWorkerWalletCreateOptions, serializedWallet: SerializedIdentity, busConfig: Omit<MessageBusInitConfig, "wallet" | "arkServer" | "messageTimeouts">): Promise<W>;
3270
3078
  /**
3271
3079
  * Simplified setup method that handles service worker registration
3272
3080
  * and wallet initialization automatically.
@@ -3291,20 +3099,8 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
3291
3099
  onEvent: (response: WalletUpdaterResponse) => void;
3292
3100
  isComplete: (response: WalletUpdaterResponse) => boolean;
3293
3101
  }): Promise<WalletUpdaterResponse>;
3294
- /**
3295
- * Produce a serialized envelope for the wallet's identity. The base
3296
- * class always emits a readonly envelope; `ServiceWorkerWallet`
3297
- * overrides to emit a signing envelope.
3298
- */
3299
- protected serializeIdentity(): Promise<SerializedIdentity>;
3300
- /**
3301
- * Return the cached init config, or rebuild one from live instance
3302
- * state when the cache was never populated. Recovery path for
3303
- * SDK-factory-created wallets; manual constructor bypasses do not
3304
- * retain enough state here and will hit the "never initialized" throw.
3305
- */
3102
+ /** The init config cached by `create()`; manually constructed wallets have none. */
3306
3103
  protected buildInitConfig(): Promise<MessageBusInitConfig>;
3307
- /** Minimal INIT_WALLET payload used on reinitialize when the cache is gone. */
3308
3104
  protected buildInitWalletPayload(): RequestInitWallet["payload"];
3309
3105
  private reinitialize;
3310
3106
  /**
@@ -3360,7 +3156,7 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
3360
3156
  * and falling back to `GET_VTXOS` there would silently spend ungated coins.
3361
3157
  * Fail closed — loud and recoverable — rather than make the gate advisory.
3362
3158
  */
3363
- getSpendableVtxos(filter?: GetVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
3159
+ getSpendableVtxos(filter?: GetSpendableVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
3364
3160
  /**
3365
3161
  * Trigger a wallet reload inside the service worker.
3366
3162
  *
@@ -3377,9 +3173,11 @@ declare class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet implements
3377
3173
  private readonly _assetManager;
3378
3174
  private readonly hasDelegate;
3379
3175
  private _restoreInFlight?;
3176
+ private _concurrentSpending;
3177
+ /** @see WalletConfig.concurrentSpending */
3178
+ get concurrentSpending(): boolean;
3380
3179
  protected constructor(serviceWorker: ServiceWorker, identity: Identity, walletRepository: WalletRepository, contractRepository: ContractRepository, messageTag: string, hasDelegate: boolean);
3381
3180
  get assetManager(): IAssetManager;
3382
- protected serializeIdentity(): Promise<SerializedIdentity>;
3383
3181
  static create(options: ServiceWorkerWalletCreateOptions): Promise<ServiceWorkerWallet>;
3384
3182
  /**
3385
3183
  * Simplified setup method that handles service worker registration
@@ -3467,7 +3265,7 @@ declare class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet implements
3467
3265
  }
3468
3266
 
3469
3267
  /**
3470
- * A zero-value anchor output.
3268
+ * A zero-value anchor output. An ark tx overrides the amount to carry its fee.
3471
3269
  */
3472
3270
  declare const P2A: {
3473
3271
  script: Uint8Array<ArrayBuffer>;
@@ -3486,7 +3284,7 @@ interface AnchorBumper {
3486
3284
  *
3487
3285
  * @example
3488
3286
  * ```typescript
3489
- * const wallet = await OnchainWallet.create(identity, 'mainnet');
3287
+ * const wallet = await OnchainWallet.create(identity, 'bitcoin');
3490
3288
  * const balance = await wallet.getBalance();
3491
3289
  * const txid = await wallet.send({
3492
3290
  * address: 'bc1...',
@@ -3873,6 +3671,13 @@ declare class ElectrumOnchainProvider implements OnchainProvider {
3873
3671
  spent: boolean;
3874
3672
  txid: string;
3875
3673
  }[]>;
3674
+ /** Reads `vout`'s script alone: another output of a tx someone else built (their change, a
3675
+ * service's fee address) can have a history Fulcrum answers empty and electrs refuses. */
3676
+ getTxOutspend(txid: string, vout: number): Promise<{
3677
+ spent: boolean;
3678
+ txid: string;
3679
+ }>;
3680
+ private resolveOutspends;
3876
3681
  getTransactions(address: string): Promise<ExplorerTransaction[]>;
3877
3682
  /**
3878
3683
  * Resolve a list of `{tx_hash, height}` entries (as returned by the
@@ -4112,6 +3917,21 @@ declare function signAndSubmitOffchainTx(params: {
4112
3917
  /** Forwarded to {@link submitOffchainTx}; omitted, nothing is checked. */
4113
3918
  verifyServerSignatures?: VerifyServerSignatures;
4114
3919
  }): Promise<string>;
3920
+ /**
3921
+ * Sign the caller's inputs of a pre-built offchain tx and submit it through the emulator, which
3922
+ * co-signs and finalizes it with arkd. The checkpoints of `inputIndexes` are signed up front: the
3923
+ * emulator verifies them before its own arkd handshake. An emulator-only leaf passes no inputs and
3924
+ * no signer.
3925
+ */
3926
+ declare function submitViaEmulator(emulator: Pick<EmulatorProvider, "submitTx">, offchainTx: OffchainTx, signer: {
3927
+ sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
3928
+ } | undefined, opts: {
3929
+ inputIndexes: number[];
3930
+ }): Promise<{
3931
+ txid: string;
3932
+ signedArkTx: string;
3933
+ signedCheckpointTxs: string[];
3934
+ }>;
4115
3935
  /**
4116
3936
  * Decorate a signer so it reveals `preimage` on every input it signs.
4117
3937
  *
@@ -4366,17 +4186,19 @@ declare class ArkNote implements ExtendedCoin {
4366
4186
  }
4367
4187
 
4368
4188
  /**
4369
- * ArkadeCash is a bearer instrument for the Ark protocol.
4189
+ * ArkadeCash is a bearer instrument for the Arkade.
4370
4190
  * It encodes a private key and contract parameters as a bech32m string,
4371
4191
  * enabling wallet-to-wallet transfers without address exchange.
4372
4192
  *
4373
- * Format: arkadecash1... (bech32m encoded)
4193
+ * Format: arkadecash1... / tarkadecash1... (bech32m encoded)
4374
4194
  * Payload: version (1 byte) + private key (32 bytes) + server pubkey (32 bytes) + csv timelock sequence (4 bytes)
4375
4195
  */
4376
4196
  declare class ArkadeCash {
4377
4197
  readonly csvTimelock: RelativeTimelock;
4378
4198
  readonly hrp: string;
4379
4199
  static readonly DefaultHRP = "arkadecash";
4200
+ /** The only prefixes minted or accepted: mainnet and test networks. */
4201
+ static readonly HRPs: readonly string[];
4380
4202
  static readonly Version = 0;
4381
4203
  static readonly PayloadLength: number;
4382
4204
  private readonly _privateKey;
@@ -4397,82 +4219,6 @@ declare class ArkadeCash {
4397
4219
  address(addressHrp: string): ArkAddress;
4398
4220
  }
4399
4221
 
4400
- /**
4401
- * Emulator REST client.
4402
- *
4403
- * The emulator is a signing service that executes Arkade scripts
4404
- * and co-signs transactions when the scripts pass validation.
4405
- *
4406
- * The read here goes through `baseFetch`, the SDK's shared fetch boundary, so
4407
- * it picks up whatever policy that boundary carries. The four submit calls
4408
- * deliberately do not: aborting a submit would not tell the caller whether the
4409
- * emulator signed, and none of them has a way to find out, so they stay on the
4410
- * global `fetch` with their transport-error type unchanged.
4411
- */
4412
-
4413
- interface EmulatorInfo {
4414
- signerPubkey: string;
4415
- }
4416
- interface EmulatorProvider {
4417
- getInfo(): Promise<EmulatorInfo>;
4418
- submitTx(arkTx: string, checkpointTxs: string[]): Promise<{
4419
- signedArkTx: string;
4420
- signedCheckpointTxs: string[];
4421
- }>;
4422
- submitIntent(intent: {
4423
- proof: string;
4424
- message: Intent.RegisterMessage;
4425
- }): Promise<string>;
4426
- submitFinalization(intent: {
4427
- proof: string;
4428
- message: Intent.RegisterMessage;
4429
- }, forfeits: string[], connectorTree: ConnectorTreeNode[] | null, commitmentTx: string): Promise<{
4430
- signedForfeits: string[];
4431
- signedCommitmentTx?: string;
4432
- }>;
4433
- submitOnchainTx(tx: string): Promise<{
4434
- signedTx: string;
4435
- }>;
4436
- }
4437
- interface ConnectorTreeNode {
4438
- txid: string;
4439
- tx: string;
4440
- children: Record<string, string>;
4441
- }
4442
- /**
4443
- * REST-based emulator client.
4444
- *
4445
- * @example
4446
- * ```typescript
4447
- * const client = new RestEmulatorProvider('http://localhost:7073');
4448
- * const info = await client.getInfo();
4449
- * console.log('Emulator pubkey:', info.signerPubkey);
4450
- * ```
4451
- */
4452
- declare class RestEmulatorProvider implements EmulatorProvider {
4453
- serverUrl: string;
4454
- constructor(serverUrl: string);
4455
- getInfo(): Promise<EmulatorInfo>;
4456
- submitTx(arkTx: string, checkpointTxs: string[]): Promise<{
4457
- signedArkTx: string;
4458
- signedCheckpointTxs: string[];
4459
- }>;
4460
- submitIntent(intent: {
4461
- proof: string;
4462
- message: Intent.RegisterMessage;
4463
- }): Promise<string>;
4464
- submitFinalization(intent: {
4465
- proof: string;
4466
- message: Intent.RegisterMessage;
4467
- }, forfeits: string[], connectorTree: ConnectorTreeNode[] | null, commitmentTx: string): Promise<{
4468
- signedForfeits: string[];
4469
- signedCommitmentTx?: string;
4470
- }>;
4471
- submitOnchainTx(tx: string): Promise<{
4472
- signedTx: string;
4473
- }>;
4474
- }
4475
-
4476
4222
  /**
4477
4223
  * Arkade Batch Handler
4478
4224
  *
@@ -5028,16 +4774,18 @@ declare const UnilateralExit: {
5028
4774
  *
5029
4775
  * Everything else (4xx, invalid JSON, schema violations, network mismatch,
5030
4776
  * unsupported network) is terminal and returns `false`.
5031
- *
5032
- * NOTE (Step 2, Scope 2): this classifies the errors currently produced by the
5033
- * boot-critical `getInfo` path. Normalizing the indexer's per-branch
5034
- * `!res.ok` throws and the remaining Ark RPC methods into
5035
- * {@link ProviderUnavailableError} is the broader Scope-2 work still pending.
5036
4777
  */
5037
4778
  declare function isRetryableProviderError(error: unknown): boolean;
5038
4779
 
4780
+ /** Raised only before provider submission, so callers can release an unsent reservation. */
4781
+ declare class SendDeadlineExceededError extends Error {
4782
+ constructor(validUntil: number);
4783
+ }
4784
+ declare function captureSendDeadline(value: unknown, required?: boolean): number | undefined;
4785
+ declare function assertSendDeadline(validUntil?: number): void;
4786
+
5039
4787
  declare function validateConnectorsTxGraph(settlementTxB64: string, connectorsGraph: TxTree): void;
5040
- declare function validateVtxoTxGraph(graph: TxTree, roundTransaction: Transaction$2, sweepTapTreeRoot: Uint8Array): void;
4788
+ declare function validateVtxoTxGraph(graph: TxTree, roundTransaction: Transaction, sweepTapTreeRoot: Uint8Array): void;
5041
4789
 
5042
4790
  /**
5043
4791
  * Assert the commitment tx received at batch finalization is the one validated
@@ -5070,6 +4818,19 @@ declare function assertFinalCommitmentMatchesValidated(finalCommitmentTx: Transa
5070
4818
  */
5071
4819
  declare function validateBatchRecipients(commitmentTx: Transaction, vtxoTreeLeaves: Transaction[], recipients: Recipient[], network: Network): void;
5072
4820
 
4821
+ /**
4822
+ * Decode and validate a server-supplied `checkpointTapscript`.
4823
+ *
4824
+ * Every offchain send/claim builds its checkpoint outputs' server-claim leaf from this script, so
4825
+ * a sub-floor or wrong-pubkey value lets the operator sweep an in-flight checkpoint before it
4826
+ * settles. This is the sole gate: callers must use the returned script, not decode their own.
4827
+ *
4828
+ * @throws {ServerResponseMismatchError} if the script fails to decode, its
4829
+ * timelock is out of policy, or its pubkey does not match
4830
+ * `advertisedForfeitPubkey` (when set).
4831
+ */
4832
+ declare function assertValidServerUnrollScript(checkpointTapscript: string, network: Network, advertisedForfeitPubkey?: Bytes): CSVMultisigTapscript.Type;
4833
+
5073
4834
  /**
5074
4835
  * Build a forfeit transaction that spends the provided inputs to a single forfeit output.
5075
4836
  *
@@ -5178,14 +4939,16 @@ declare class Extension {
5178
4939
  /**
5179
4940
  * Arkade Script Opcodes
5180
4941
  *
5181
- * This module defines ONLY Arkade-specific opcodes (0xb3, 0xc3-0xf6).
4942
+ * This module defines ONLY Arkade-specific opcodes (0xb3, 0xbb, 0xc3-0xf8).
5182
4943
  * Standard Bitcoin opcodes are imported from @scure/btc-signer.
5183
4944
  *
5184
- * Reference: arkade-os/emulator v0.0.4 pkg/arkade/opcode.go
4945
+ * Reference: arkade-os/emulator pkg/arkade/opcode.go.
4946
+ * Byte 0xdc is OP_CHECKTIME, matching emulator v0.0.8 and compiler artifacts.
5185
4947
  */
5186
4948
 
5187
4949
  declare const ARKADE_OP: {
5188
4950
  readonly MERKLEBRANCHVERIFY: 179;
4951
+ readonly PUT: 187;
5189
4952
  readonly DIGEST: 195;
5190
4953
  readonly SHA256INITIALIZE: 196;
5191
4954
  readonly SHA256UPDATE: 197;
@@ -5209,6 +4972,8 @@ declare const ARKADE_OP: {
5209
4972
  readonly BIN2NUM: 216;
5210
4973
  readonly REVERSEBYTES: 217;
5211
4974
  readonly MODEXP: 218;
4975
+ readonly PUSHEXPIRY: 219;
4976
+ readonly CHECKTIME: 220;
5212
4977
  readonly ECADD: 224;
5213
4978
  readonly ECMUL: 225;
5214
4979
  readonly ECPAIRING: 226;
@@ -5232,6 +4997,8 @@ declare const ARKADE_OP: {
5232
4997
  readonly INSPECTPACKET: 244;
5233
4998
  readonly INSPECTINPUTPACKET: 245;
5234
4999
  readonly SIGHASH: 246;
5000
+ readonly TUNNEL: 247;
5001
+ readonly INSPECTINTENTMESSAGE: 248;
5235
5002
  };
5236
5003
  declare const ARKADE_OPCODES: number[];
5237
5004
  declare const ARKADE_OPCODE_NAMES: Record<number, string>;
@@ -5280,6 +5047,7 @@ declare function getOpcodeValue(name: string): number | undefined;
5280
5047
  */
5281
5048
  declare const ARKADE_OPS: {
5282
5049
  readonly MERKLEBRANCHVERIFY: 179;
5050
+ readonly PUT: 187;
5283
5051
  readonly DIGEST: 195;
5284
5052
  readonly SHA256INITIALIZE: 196;
5285
5053
  readonly SHA256UPDATE: 197;
@@ -5303,6 +5071,8 @@ declare const ARKADE_OPS: {
5303
5071
  readonly BIN2NUM: 216;
5304
5072
  readonly REVERSEBYTES: 217;
5305
5073
  readonly MODEXP: 218;
5074
+ readonly PUSHEXPIRY: 219;
5075
+ readonly CHECKTIME: 220;
5306
5076
  readonly ECADD: 224;
5307
5077
  readonly ECMUL: 225;
5308
5078
  readonly ECPAIRING: 226;
@@ -5326,119 +5096,121 @@ declare const ARKADE_OPS: {
5326
5096
  readonly INSPECTPACKET: 244;
5327
5097
  readonly INSPECTINPUTPACKET: 245;
5328
5098
  readonly SIGHASH: 246;
5329
- readonly OP_0: number;
5330
- readonly PUSHDATA1: number;
5331
- readonly PUSHDATA2: number;
5332
- readonly PUSHDATA4: number;
5333
- readonly '1NEGATE': number;
5334
- readonly RESERVED: number;
5335
- readonly OP_1: number;
5336
- readonly OP_2: number;
5337
- readonly OP_3: number;
5338
- readonly OP_4: number;
5339
- readonly OP_5: number;
5340
- readonly OP_6: number;
5341
- readonly OP_7: number;
5342
- readonly OP_8: number;
5343
- readonly OP_9: number;
5344
- readonly OP_10: number;
5345
- readonly OP_11: number;
5346
- readonly OP_12: number;
5347
- readonly OP_13: number;
5348
- readonly OP_14: number;
5349
- readonly OP_15: number;
5350
- readonly OP_16: number;
5351
- readonly NOP: number;
5352
- readonly VER: number;
5353
- readonly IF: number;
5354
- readonly NOTIF: number;
5355
- readonly VERIF: number;
5356
- readonly VERNOTIF: number;
5357
- readonly ELSE: number;
5358
- readonly ENDIF: number;
5359
- readonly VERIFY: number;
5360
- readonly RETURN: number;
5361
- readonly TOALTSTACK: number;
5362
- readonly FROMALTSTACK: number;
5363
- readonly '2DROP': number;
5364
- readonly '2DUP': number;
5365
- readonly '3DUP': number;
5366
- readonly '2OVER': number;
5367
- readonly '2ROT': number;
5368
- readonly '2SWAP': number;
5369
- readonly IFDUP: number;
5370
- readonly DEPTH: number;
5371
- readonly DROP: number;
5372
- readonly DUP: number;
5373
- readonly NIP: number;
5374
- readonly OVER: number;
5375
- readonly PICK: number;
5376
- readonly ROLL: number;
5377
- readonly ROT: number;
5378
- readonly SWAP: number;
5379
- readonly TUCK: number;
5380
- readonly CAT: number;
5381
- readonly SUBSTR: number;
5382
- readonly LEFT: number;
5383
- readonly RIGHT: number;
5384
- readonly SIZE: number;
5385
- readonly INVERT: number;
5386
- readonly AND: number;
5387
- readonly OR: number;
5388
- readonly XOR: number;
5389
- readonly EQUAL: number;
5390
- readonly EQUALVERIFY: number;
5391
- readonly RESERVED1: number;
5392
- readonly RESERVED2: number;
5393
- readonly '1ADD': number;
5394
- readonly '1SUB': number;
5395
- readonly '2MUL': number;
5396
- readonly '2DIV': number;
5397
- readonly NEGATE: number;
5398
- readonly ABS: number;
5399
- readonly NOT: number;
5400
- readonly '0NOTEQUAL': number;
5401
- readonly ADD: number;
5402
- readonly SUB: number;
5403
- readonly MUL: number;
5404
- readonly DIV: number;
5405
- readonly MOD: number;
5406
- readonly LSHIFT: number;
5407
- readonly RSHIFT: number;
5408
- readonly BOOLAND: number;
5409
- readonly BOOLOR: number;
5410
- readonly NUMEQUAL: number;
5411
- readonly NUMEQUALVERIFY: number;
5412
- readonly NUMNOTEQUAL: number;
5413
- readonly LESSTHAN: number;
5414
- readonly GREATERTHAN: number;
5415
- readonly LESSTHANOREQUAL: number;
5416
- readonly GREATERTHANOREQUAL: number;
5417
- readonly MIN: number;
5418
- readonly MAX: number;
5419
- readonly WITHIN: number;
5420
- readonly RIPEMD160: number;
5421
- readonly SHA1: number;
5422
- readonly SHA256: number;
5423
- readonly HASH160: number;
5424
- readonly HASH256: number;
5425
- readonly CODESEPARATOR: number;
5426
- readonly CHECKSIG: number;
5427
- readonly CHECKSIGVERIFY: number;
5428
- readonly CHECKMULTISIG: number;
5429
- readonly CHECKMULTISIGVERIFY: number;
5430
- readonly NOP1: number;
5431
- readonly CHECKLOCKTIMEVERIFY: number;
5432
- readonly CHECKSEQUENCEVERIFY: number;
5433
- readonly NOP4: number;
5434
- readonly NOP5: number;
5435
- readonly NOP6: number;
5436
- readonly NOP7: number;
5437
- readonly NOP8: number;
5438
- readonly NOP9: number;
5439
- readonly NOP10: number;
5440
- readonly CHECKSIGADD: number;
5441
- readonly INVALID: number;
5099
+ readonly TUNNEL: 247;
5100
+ readonly INSPECTINTENTMESSAGE: 248;
5101
+ readonly OP_0: 0;
5102
+ readonly PUSHDATA1: 76;
5103
+ readonly PUSHDATA2: 77;
5104
+ readonly PUSHDATA4: 78;
5105
+ readonly '1NEGATE': 79;
5106
+ readonly RESERVED: 80;
5107
+ readonly OP_1: 81;
5108
+ readonly OP_2: 82;
5109
+ readonly OP_3: 83;
5110
+ readonly OP_4: 84;
5111
+ readonly OP_5: 85;
5112
+ readonly OP_6: 86;
5113
+ readonly OP_7: 87;
5114
+ readonly OP_8: 88;
5115
+ readonly OP_9: 89;
5116
+ readonly OP_10: 90;
5117
+ readonly OP_11: 91;
5118
+ readonly OP_12: 92;
5119
+ readonly OP_13: 93;
5120
+ readonly OP_14: 94;
5121
+ readonly OP_15: 95;
5122
+ readonly OP_16: 96;
5123
+ readonly NOP: 97;
5124
+ readonly VER: 98;
5125
+ readonly IF: 99;
5126
+ readonly NOTIF: 100;
5127
+ readonly VERIF: 101;
5128
+ readonly VERNOTIF: 102;
5129
+ readonly ELSE: 103;
5130
+ readonly ENDIF: 104;
5131
+ readonly VERIFY: 105;
5132
+ readonly RETURN: 106;
5133
+ readonly TOALTSTACK: 107;
5134
+ readonly FROMALTSTACK: 108;
5135
+ readonly '2DROP': 109;
5136
+ readonly '2DUP': 110;
5137
+ readonly '3DUP': 111;
5138
+ readonly '2OVER': 112;
5139
+ readonly '2ROT': 113;
5140
+ readonly '2SWAP': 114;
5141
+ readonly IFDUP: 115;
5142
+ readonly DEPTH: 116;
5143
+ readonly DROP: 117;
5144
+ readonly DUP: 118;
5145
+ readonly NIP: 119;
5146
+ readonly OVER: 120;
5147
+ readonly PICK: 121;
5148
+ readonly ROLL: 122;
5149
+ readonly ROT: 123;
5150
+ readonly SWAP: 124;
5151
+ readonly TUCK: 125;
5152
+ readonly CAT: 126;
5153
+ readonly SUBSTR: 127;
5154
+ readonly LEFT: 128;
5155
+ readonly RIGHT: 129;
5156
+ readonly SIZE: 130;
5157
+ readonly INVERT: 131;
5158
+ readonly AND: 132;
5159
+ readonly OR: 133;
5160
+ readonly XOR: 134;
5161
+ readonly EQUAL: 135;
5162
+ readonly EQUALVERIFY: 136;
5163
+ readonly RESERVED1: 137;
5164
+ readonly RESERVED2: 138;
5165
+ readonly '1ADD': 139;
5166
+ readonly '1SUB': 140;
5167
+ readonly '2MUL': 141;
5168
+ readonly '2DIV': 142;
5169
+ readonly NEGATE: 143;
5170
+ readonly ABS: 144;
5171
+ readonly NOT: 145;
5172
+ readonly '0NOTEQUAL': 146;
5173
+ readonly ADD: 147;
5174
+ readonly SUB: 148;
5175
+ readonly MUL: 149;
5176
+ readonly DIV: 150;
5177
+ readonly MOD: 151;
5178
+ readonly LSHIFT: 152;
5179
+ readonly RSHIFT: 153;
5180
+ readonly BOOLAND: 154;
5181
+ readonly BOOLOR: 155;
5182
+ readonly NUMEQUAL: 156;
5183
+ readonly NUMEQUALVERIFY: 157;
5184
+ readonly NUMNOTEQUAL: 158;
5185
+ readonly LESSTHAN: 159;
5186
+ readonly GREATERTHAN: 160;
5187
+ readonly LESSTHANOREQUAL: 161;
5188
+ readonly GREATERTHANOREQUAL: 162;
5189
+ readonly MIN: 163;
5190
+ readonly MAX: 164;
5191
+ readonly WITHIN: 165;
5192
+ readonly RIPEMD160: 166;
5193
+ readonly SHA1: 167;
5194
+ readonly SHA256: 168;
5195
+ readonly HASH160: 169;
5196
+ readonly HASH256: 170;
5197
+ readonly CODESEPARATOR: 171;
5198
+ readonly CHECKSIG: 172;
5199
+ readonly CHECKSIGVERIFY: 173;
5200
+ readonly CHECKMULTISIG: 174;
5201
+ readonly CHECKMULTISIGVERIFY: 175;
5202
+ readonly NOP1: 176;
5203
+ readonly CHECKLOCKTIMEVERIFY: 177;
5204
+ readonly CHECKSEQUENCEVERIFY: 178;
5205
+ readonly NOP4: 179;
5206
+ readonly NOP5: 180;
5207
+ readonly NOP6: 181;
5208
+ readonly NOP7: 182;
5209
+ readonly NOP8: 183;
5210
+ readonly NOP9: 184;
5211
+ readonly NOP10: 185;
5212
+ readonly CHECKSIGADD: 186;
5213
+ readonly INVALID: 255;
5442
5214
  };
5443
5215
  /** A single script operation: opcode string key, raw bytes, number, or bigint */
5444
5216
  type ArkadeScriptOP = keyof typeof ARKADE_OPS | Uint8Array | number | bigint;
@@ -5560,53 +5332,80 @@ declare namespace bignum {
5560
5332
  export { bignum_BIGNUM_MAX_BYTES as BIGNUM_MAX_BYTES, bignum_decode as decode, bignum_encode as encode };
5561
5333
  }
5562
5334
 
5335
+ /**
5336
+ * Read the JSON `arkadec` writes into a {@link Program}: `$param` placeholders,
5337
+ * @scure opcode names, and one structured tapleaf per compiler leaf.
5338
+ */
5339
+
5340
+ interface ArtifactParameter {
5341
+ name: string;
5342
+ type: string;
5343
+ }
5344
+ interface ArtifactStruct {
5345
+ name: string;
5346
+ fields: ArtifactParameter[];
5347
+ }
5348
+ interface ArtifactWitnessElement {
5349
+ name: string;
5350
+ type: string;
5351
+ encoding?: string;
5352
+ injected?: boolean;
5353
+ }
5354
+ interface ArtifactLeaf {
5355
+ name: string;
5356
+ witness?: ArtifactWitnessElement[];
5357
+ asm: string[];
5358
+ }
5359
+ interface ArtifactCovenant {
5360
+ inputs: ArtifactParameter[];
5361
+ asm: string[];
5362
+ }
5363
+ interface ArtifactGroup {
5364
+ name: string;
5365
+ arkade?: ArtifactCovenant;
5366
+ leaves: ArtifactLeaf[];
5367
+ }
5368
+ interface ContractArtifact {
5369
+ formatVersion?: number;
5370
+ contractName: string;
5371
+ constructorInputs: ArtifactParameter[];
5372
+ structs?: ArtifactStruct[];
5373
+ functions: ArtifactGroup[];
5374
+ }
5375
+ /** `true` when `value` is an arkadec artifact rather than a Program. */
5376
+ declare function isContractArtifact(value: unknown): value is ContractArtifact;
5377
+ /** Adds `server`, and one param per child-output placeholder for the caller to bind to that output key. */
5378
+ declare function programFromArtifact(artifact: ContractArtifact): Program;
5379
+
5563
5380
  /**
5564
5381
  * Arkade Contract — artifact-driven, high-level covenant API.
5565
5382
  *
5566
- * Implements the Arkade contract model: a contract is a {@link Program} (a set of
5567
- * named functions, each split into a `tapscript` segment enforced on-chain and an
5568
- * `arkadeScript` segment emulated by the co-signing service). The same JS object
5569
- * shape mirrors the compiler artifact, so a hand-written program today and the
5570
- * compiler's JSON output later flow through the identical resolver.
5571
- *
5572
- * The SDK never interprets scripts: it resolves `$param` placeholders into bytes,
5573
- * builds the taproot tree (resolving `$param` signers such as `$server`/`$user` from
5574
- * the constructor args, plus the co-signer key tweaked by the arkade-script hash),
5575
- * and assembles the spend from the per-segment witness layout. All key tweaking,
5576
- * packet encoding and PSBT plumbing is internal — from the caller's side it is just
5577
- * Arkade.
5578
- *
5579
- * Program → script compilation lives in {@link ArkadeProgramScript}
5580
- * (./program.ts) and is shared with the generic `"arkade"` contract handler,
5581
- * so a contract created here can be persisted, watched and re-derived through
5582
- * the standard `src/contracts` pipeline: pass a `contractManager` to
5583
- * {@link Arkade.connect} and call {@link ArkadeContract.register}.
5584
- *
5585
- * Contract functions are strongly typed from the program's literal shape: a
5586
- * function declaring `inputs: [{ name: "preimage", type: "bytes" }]` produces a
5587
- * `functions.claim(preimage: Uint8Array)` call signature. The type flows through
5588
- * `arkade.contract(...)` automatically for inline literals; for a program stored
5589
- * in a variable, annotate it with `satisfies Program` to preserve the literal
5590
- * type (a plain `: Program` annotation would widen it away).
5591
- *
5592
- * Constructor `params` follow the same convention: bare name strings are
5593
- * documentation only, while typed descriptors `{ name, type }` (the form the
5594
- * ArkadeScript compiler emits) make the list authoritative — every declared
5595
- * param must be bound, every `$name` reference must be declared, and bound
5596
- * values are validated against their type at compilation.
5597
- *
5598
- * A covenant spend needs an `indexer`, not just an `emulator`: the co-signing
5599
- * service resolves each input's prevout pkScript from the previous ark tx the
5600
- * PSBT carries, and only the indexer can supply those bytes. Pure tapscript
5601
- * spends go straight to arkd and need neither.
5383
+ * A contract is a {@link Program}: named functions, each split into a `tapscript` segment
5384
+ * enforced on-chain and an `arkadeScript` segment emulated by the co-signing service. Compiler
5385
+ * artifacts are normalized into this model, sharing the resolver with hand-written programs.
5386
+ * The SDK never interprets scripts; it resolves `$param` placeholders and signers, builds the
5387
+ * taproot tree (co-signer key tweaked by the arkade-script hash) and assembles the spend.
5388
+ *
5389
+ * Compilation lives in {@link ArkadeProgramScript} and is shared with the `"arkade"` contract
5390
+ * handler: pass a `contractManager` to {@link Arkade.connect} and call
5391
+ * {@link ArkadeContract.register} to persist and watch a contract.
5392
+ *
5393
+ * Functions are typed from the program's literal shape (`inputs: [{ name: "preimage", type:
5394
+ * "bytes" }]` → `functions.claim(preimage: Uint8Array)`). For a program stored in a variable use
5395
+ * `satisfies Program`; a `: Program` annotation widens the literal type away. Typed `params`
5396
+ * descriptors `{ name, type }` make the list authoritative (every param bound, every `$name`
5397
+ * declared, values type-checked).
5398
+ *
5399
+ * A covenant spend needs an `indexer` as well as an `emulator`: the co-signer resolves each
5400
+ * input's prevout from the previous ark tx the PSBT carries. Pure tapscript spends need neither.
5602
5401
  *
5603
5402
  * @example
5604
5403
  * ```typescript
5605
5404
  * const htlcProgram = {
5606
- * version: 0,
5405
+ * version: 1,
5607
5406
  * name: "htlc", // metadata only — round-tripped, never compiled
5608
5407
  * params: [
5609
- * { name: "hash", type: "hash" },
5408
+ * { name: "hash", type: "bytes20" },
5610
5409
  * { name: "receiver", type: "pubkey" },
5611
5410
  * { name: "amount", type: "int" },
5612
5411
  * { name: "server", type: "pubkey" },
@@ -5630,21 +5429,17 @@ declare namespace bignum {
5630
5429
  * @module arkade/contract
5631
5430
  */
5632
5431
 
5633
- /** The TS type of a single call argument, derived from its {@link InputRef}. */
5634
- type ArgTsType<R> = R extends InputDef ? ArkadeValueType[R["type"]] : ArkadeArgValue;
5635
5432
  /** The argument tuple of a function, derived from its declared `inputs`. */
5636
- type ArgsTuple<I extends readonly InputRef[]> = {
5637
- [K in keyof I]: ArgTsType<I[K]>;
5433
+ type ArgsTuple<I extends readonly InputDef[]> = {
5434
+ [K in keyof I]: ArkadeValueType[I[K]["type"]];
5638
5435
  };
5639
5436
  /** The call signature arguments for one function (nullary when `inputs` is absent). */
5640
5437
  type FnArgs<F extends ArkadeFunction> = F extends {
5641
- inputs: infer I extends readonly InputRef[];
5438
+ inputs: infer I extends readonly InputDef[];
5642
5439
  } ? ArgsTuple<I> : [];
5643
5440
  /**
5644
- * The statically-typed `functions` map of a contract. When the program is a
5645
- * concrete literal (specific function names), each entry is precisely typed from
5646
- * its `inputs`. When the program is the widened {@link Program} (an index
5647
- * signature), it falls back to the loose {@link CallableFunctions}.
5441
+ * The statically-typed `functions` map of a contract: precisely typed per function for a literal
5442
+ * program, the loose {@link CallableFunctions} for the widened {@link Program}.
5648
5443
  */
5649
5444
  type ContractFunctions<P extends Program> = string extends keyof P["functions"] ? CallableFunctions : {
5650
5445
  [K in keyof P["functions"]]: (...args: FnArgs<P["functions"][K]>) => ArkadeTransactionBuilder;
@@ -5655,13 +5450,9 @@ interface Utxo {
5655
5450
  vout: number;
5656
5451
  value: number;
5657
5452
  /**
5658
- * Raw wire bytes of the ark transaction that created this VTXO, attached as
5659
- * the PrevArkTx field on input 0.
5660
- *
5661
- * An override, not the only channel: covenant spends resolve the previous
5662
- * tx of every input through the client's indexer. Supply it when the tx is
5663
- * not yet indexable — a recursive covenant spending the output of an ark tx
5664
- * the caller just built — and the resolved value is suppressed for input 0.
5453
+ * Raw bytes of the ark tx that created this VTXO, attached as input 0's PrevArkTx. Overrides
5454
+ * the indexer-resolved value; supply it when the tx isn't indexable yet (a recursive covenant
5455
+ * spending an ark tx the caller just built).
5665
5456
  */
5666
5457
  sourceTx?: Uint8Array;
5667
5458
  }
@@ -5697,33 +5488,64 @@ interface ArkadeSpendResult {
5697
5488
  }
5698
5489
  /** The callable spending paths of a contract. */
5699
5490
  type CallableFunctions = Record<string, (...args: ArkadeArgValue[]) => ArkadeTransactionBuilder>;
5700
- /**
5701
- * What {@link Arkade} needs from the Arkade server.
5702
- *
5703
- * Only `getInfo` is required — see {@link ArkadeConnectOptions.arkade} for why.
5704
- * Named so a caller building a derivation-only client has a type to import
5705
- * rather than reaching into the options bag.
5706
- */
5491
+ /** What {@link Arkade} needs from the Arkade server; see {@link ArkadeConnectOptions.arkade}. */
5707
5492
  type ArkadeServerProvider = Pick<ArkProvider, "getInfo"> & Partial<ArkadeBroadcaster>;
5708
- /** Options for {@link Arkade.connect}. */
5709
- interface ArkadeConnectOptions {
5493
+ /** Fields shared by both forms of {@link ArkadeConnectOptions}. */
5494
+ interface ArkadeConnectCommonOptions {
5495
+ /** Signer for paths that require a user signature; optional for watch-only. */
5496
+ identity?: Identity;
5710
5497
  /**
5711
- * The Arkade server provider.
5498
+ * Network for address derivation. Defaults to the network the server
5499
+ * reports on `getInfo` — or the SDK default when the server names none.
5500
+ */
5501
+ network?: Network;
5502
+ /**
5503
+ * Co-sign with this emulator key (33-byte compressed hex) instead of the one pinned for
5504
+ * `network`. Needed after a key rotation ahead of this SDK, for a self-hosted emulator, or on
5505
+ * networks with no pinned key (signet, testnet, a hand-built `Network` — those throw without
5506
+ * it). Setting it means trusting that operator as co-signer.
5712
5507
  *
5713
- * Only `getInfo` is required: it is what resolves the server key and
5714
- * checkpoint closure, and it is all a client needs to derive, register and
5715
- * inspect contracts. `submitTx`/`finalizeTx` are needed solely to
5716
- * broadcast, so a client built without them throws at `.send()` — the same
5717
- * deferred, explicit failure an absent `indexer` gives `getUtxos()` and an
5718
- * absent `emulator` gives a covenant spend. That lets a caller that already
5719
- * holds the server info (`wallet.getArkadeInfo()`) connect without a
5720
- * provider of its own, and without a second `/v1/info` round-trip.
5508
+ * @see resolveEmulatorPubkey
5509
+ */
5510
+ emulatorPubkey?: string;
5511
+ /**
5512
+ * The wallet's contract manager (`wallet.getContractManager()`). Enables
5513
+ * {@link ArkadeContract.register} and {@link ArkadeContract.on}, and makes
5514
+ * {@link ArkadeContract.getUtxos} read repository-backed state for registered contracts
5515
+ * instead of the indexer. Never disposed by {@link Arkade.dispose}.
5516
+ */
5517
+ contractManager?: IContractManager;
5518
+ }
5519
+ /**
5520
+ * The one-liner form: name the deployment, and `connect` resolves the providers (and, for
5521
+ * `{ network: "bitcoin" }`, the emulator).
5522
+ */
5523
+ interface ArkadeConnectServiceOptions extends ArkadeConnectCommonOptions {
5524
+ service: ArkadeService;
5525
+ /**
5526
+ * Persist contracts here. The client builds and owns a contract manager over it (with an
5527
+ * in-memory VTXO store), enabling {@link ArkadeContract.register} and
5528
+ * {@link ArkadeContract.on}; {@link Arkade.dispose} stops it. Exclusive with
5529
+ * `contractManager`. Deliberately narrower than the wallet's `StorageConfig`.
5530
+ */
5531
+ storage?: {
5532
+ contractRepository: ContractRepository;
5533
+ };
5534
+ arkade?: never;
5535
+ emulator?: never;
5536
+ indexer?: never;
5537
+ }
5538
+ /** The provider form: hand over providers you already hold (e.g. a wallet's). */
5539
+ interface ArkadeConnectProviderOptions extends ArkadeConnectCommonOptions {
5540
+ /**
5541
+ * The Arkade server provider. Only `getInfo` is required (enough to derive, register and
5542
+ * inspect contracts); without `submitTx`/`finalizeTx`, `.send()` throws. So a caller already
5543
+ * holding `wallet.getArkadeInfo()` can connect without a second `/v1/info` round-trip.
5721
5544
  */
5722
5545
  arkade: ArkadeServerProvider;
5723
5546
  /**
5724
- * The co-signing (introspector/emulator) service. Optional: only required for
5725
- * contracts whose functions have an `arkadeScript` (covenant paths). Pure
5726
- * tapscript contracts (multisig/timelock/hashlock) don't need it.
5547
+ * The co-signing (introspector/emulator) service. Required only for functions with an
5548
+ * `arkadeScript` (covenant paths).
5727
5549
  */
5728
5550
  emulator?: EmulatorProvider;
5729
5551
  /**
@@ -5732,36 +5554,31 @@ interface ArkadeConnectOptions {
5732
5554
  * {@link attachPrevArkTxs}). Required for covenant spends.
5733
5555
  */
5734
5556
  indexer?: Pick<IndexerProvider, "getVtxos" | "getVirtualTxs">;
5735
- /** Signer for paths that require a user signature; optional for watch-only. */
5736
- identity?: Identity;
5737
- /** Network for address derivation; defaults to the SDK default. */
5738
- network?: Network;
5739
- /**
5740
- * Co-sign with this emulator key (33-byte compressed hex) instead of the
5741
- * one pinned for `network`.
5742
- *
5743
- * Needed when a network's emulator key has rotated ahead of this SDK, for a
5744
- * self-hosted emulator, or on a network with no pinned key at all (signet,
5745
- * testnet, a hand-built `Network` — those throw without it). Setting it
5746
- * means trusting that operator as co-signer in place of the network's.
5747
- *
5748
- * @see resolveEmulatorPubkey
5749
- */
5750
- emulatorPubkey?: string;
5751
- /**
5752
- * The wallet's contract manager. When set, contracts created from this
5753
- * client can {@link ArkadeContract.register} themselves into the standard
5754
- * contract pipeline (persistence, watching, events), and
5755
- * {@link ArkadeContract.getUtxos} reads repository-backed state
5756
- * (offline-first) for registered contracts instead of querying the
5757
- * indexer directly. Obtain it via `wallet.getContractManager()`.
5758
- */
5759
- contractManager?: IContractManager;
5557
+ service?: never;
5558
+ storage?: never;
5559
+ }
5560
+ /** Options for {@link Arkade.connect}: `service` and `arkade` are exclusive. */
5561
+ type ArkadeConnectOptions = ArkadeConnectServiceOptions | ArkadeConnectProviderOptions;
5562
+ /** Event types {@link ArkadeContract.on} reports. */
5563
+ type ArkadeContractEventType = "vtxo_received" | "vtxo_spent" | "connection_reset";
5564
+ /** The event an {@link ArkadeContract.on} handle of type `T` receives. */
5565
+ type ArkadeContractEvent<T extends ArkadeContractEventType = ArkadeContractEventType> = T extends "connection_reset" ? Extract<ContractEvent, {
5566
+ type: "connection_reset";
5567
+ }> : Extract<ContractVtxoEvent, {
5568
+ type: T;
5569
+ }>;
5570
+ /** Returned by {@link ArkadeContract.on}. */
5571
+ interface ArkadeContractSubscription {
5572
+ /** Stop delivery to this handle. Idempotent. */
5573
+ off(): void;
5760
5574
  }
5575
+ type EventHandle = {
5576
+ type: ArkadeContractEventType;
5577
+ callback: (event: ArkadeContractEvent) => void | Promise<void>;
5578
+ };
5761
5579
  /**
5762
- * A connected Arkade client. Holds the providers/identity/network and the
5763
- * resolved network constants (server key, co-signer key, checkpoint closure),
5764
- * so spinning up contracts is synchronous.
5580
+ * A connected Arkade client holding the providers and resolved network constants (server key,
5581
+ * co-signer key, checkpoint closure), so creating contracts is synchronous.
5765
5582
  */
5766
5583
  declare class Arkade {
5767
5584
  readonly arkProvider: ArkadeServerProvider;
@@ -5769,15 +5586,13 @@ declare class Arkade {
5769
5586
  readonly emulator: EmulatorProvider | undefined;
5770
5587
  readonly network: Network;
5771
5588
  readonly serverKey: Uint8Array;
5589
+ /** Bare protocol delay (blocks below 512, seconds otherwise), resolved only when needed. */
5590
+ readonly serverExitDelay?: bigint;
5772
5591
  /**
5773
- * The co-signer key covenants are built against (33-byte compressed),
5774
- * present only when an emulator is configured.
5775
- *
5776
- * Resolved from the network — or from `emulatorPubkey` — never from the
5777
- * emulator's own report. When a claim is refused because the co-signer
5778
- * disagrees, compare `hex.encode(arkade.emulatorKey)` against the
5779
- * `signerPubkey` your emulator serves on `/v1/info`: if they differ, the
5780
- * network rotated and this SDK's pin is stale.
5592
+ * The co-signer key covenants are built against (33-byte compressed), present only when an
5593
+ * emulator is configured. Resolved from the network or `emulatorPubkey`, never the emulator's
5594
+ * own report. If a claim is refused, compare it with the emulator's `/v1/info` `signerPubkey`:
5595
+ * a difference means the network rotated and this SDK's pin is stale.
5781
5596
  */
5782
5597
  readonly emulatorKey: Uint8Array | undefined;
5783
5598
  readonly checkpoint: CSVMultisigTapscript.Type;
@@ -5785,20 +5600,46 @@ declare class Arkade {
5785
5600
  readonly identity?: Identity;
5786
5601
  /** The signing identity's x-only public key, resolved at connect — identifies which inputs the wallet signs. */
5787
5602
  readonly userKey?: Uint8Array;
5788
- /** The wallet's contract manager, when contract persistence is wired up. */
5603
+ /** The contract manager, when contract persistence is wired up (passed in or owned). */
5789
5604
  readonly contractManager?: IContractManager;
5605
+ /** Whether {@link connect} built {@link contractManager}, so {@link dispose} must stop it. */
5606
+ private readonly ownsContractManager;
5607
+ /** {@link ArkadeContract.on} handles by contract script (hex). */
5608
+ private readonly handles;
5609
+ /** The single `onContractEvent` subscription fanning out to {@link handles}. */
5610
+ private unsubscribeEvents?;
5611
+ private disposed;
5790
5612
  private constructor();
5791
- /** Connect and resolve the server key, checkpoint closure and (if present) the co-signer key. */
5613
+ /**
5614
+ * Connect and resolve the server key, checkpoint closure and (if present) the co-signer key.
5615
+ *
5616
+ * @example
5617
+ * ```typescript
5618
+ * const arkade = await Arkade.connect({
5619
+ * service: { network: "bitcoin" },
5620
+ * identity,
5621
+ * storage: { contractRepository },
5622
+ * });
5623
+ * ```
5624
+ */
5792
5625
  static connect(opts: ArkadeConnectOptions): Promise<Arkade>;
5793
5626
  /**
5794
- * Instantiate a contract from a program and its constructor arguments. The
5795
- * `program`'s literal type is preserved (`const` inference) so the resulting
5796
- * contract's `functions` map is strongly typed — `functions.<name>(...)`
5797
- * knows each argument's type from the function's `inputs` descriptors.
5627
+ * Stop event delivery to every {@link ArkadeContract.on} handle and, when {@link connect}
5628
+ * built the contract manager (`storage`), dispose it. A caller-passed manager keeps running.
5629
+ */
5630
+ dispose(): void;
5631
+ /**
5632
+ * @internal Add a handle for `script`, subscribing to the manager on first use; the last
5633
+ * handle's `off()` releases the subscription.
5634
+ */
5635
+ addEventHandle(manager: IContractManager, script: string, handle: EventHandle): () => void;
5636
+ private dispatch;
5637
+ /**
5638
+ * Instantiate a contract from a program and its constructor arguments. `const` inference keeps
5639
+ * the program's literal type, so `functions` is strongly typed.
5798
5640
  *
5799
- * When the program declares a `server` or `user` param and the caller does
5800
- * not bind it, it defaults to the client's server key or the identity's
5801
- * key respectively; explicit args always win.
5641
+ * Declared `server`/`user` params default to the client's keys. Compiler
5642
+ * artifacts reserve the server key and exit delay to the connected server.
5802
5643
  */
5803
5644
  contract<const P extends Program>(program: P, args?: Record<string, ArkadeParamValue>): ArkadeContract<P>;
5804
5645
  }
@@ -5817,11 +5658,8 @@ declare class ArkadeContract<P extends Program = Program> {
5817
5658
  private readonly compiled;
5818
5659
  constructor(client: Arkade, program: P, args?: Record<string, ArkadeParamValue>, keys?: ProgramKeys);
5819
5660
  /**
5820
- * Rebuild a callable contract from a persisted `"arkade"` contract row
5821
- * (see {@link ArkadeContract.register}). The stored keys are used for
5822
- * compilation — not the client's current ones — so the derived script and
5823
- * address stay identical to the registered contract even after a server
5824
- * signer rotation.
5661
+ * Rebuild a callable contract from a persisted `"arkade"` row. Compiles with the stored keys,
5662
+ * not the client's current ones, so script and address survive a server signer rotation.
5825
5663
  */
5826
5664
  static fromContract(client: Arkade, contract: Contract): ArkadeContract;
5827
5665
  /** Resolve the {@link TapLeafScript} for a spending path by its index. */
@@ -5830,16 +5668,11 @@ declare class ArkadeContract<P extends Program = Program> {
5830
5668
  get address(): string;
5831
5669
  /** Taproot output script. */
5832
5670
  get pkScript(): Uint8Array;
5833
- /**
5834
- * Callable spending paths: `contract.functions.<name>(...args)`. Strongly
5835
- * typed from the program's literal type — each function's argument types are
5836
- * derived from its `inputs` descriptors (see {@link ContractFunctions}).
5837
- */
5671
+ /** Callable spending paths: `functions.<name>(...args)` (see {@link ContractFunctions}). */
5838
5672
  get functions(): ContractFunctions<P>;
5839
5673
  /**
5840
- * The `createContract` payload for this contract — the serialized program,
5841
- * args and keys plus the derived script/address. Useful when registering
5842
- * through a manager the client does not hold.
5674
+ * The `createContract` payload (serialized program, args, keys, script, address), for
5675
+ * registering through a manager the client does not hold.
5843
5676
  */
5844
5677
  toContractParams(): {
5845
5678
  type: string;
@@ -5848,26 +5681,42 @@ declare class ArkadeContract<P extends Program = Program> {
5848
5681
  address: string;
5849
5682
  };
5850
5683
  /**
5851
- * Persist this contract through the wallet's {@link IContractManager} so it
5852
- * is tracked like any other contract type: stored in the contract
5853
- * repository, watched for VTXO events, counted in repository-backed
5854
- * balances, and re-derivable offline via the `"arkade"` contract handler.
5855
- * Idempotent — re-registering the same script is a no-op.
5684
+ * Persist this contract through the wallet's {@link IContractManager} (stored, watched,
5685
+ * counted in balances, re-derivable via the `"arkade"` handler). Idempotent per script.
5856
5686
  */
5857
5687
  register(options?: {
5858
5688
  label?: string;
5859
5689
  metadata?: Record<string, unknown>;
5860
5690
  }): Promise<Contract>;
5861
5691
  /**
5862
- * Spendable VTXOs locked by this contract.
5692
+ * Report this contract's activity: `vtxo_received`/`vtxo_spent` for its script, and
5693
+ * `connection_reset` when the manager's event stream reconnects. Registers the contract
5694
+ * (idempotent) so it is persisted and watched; requires a contract manager (`storage` or
5695
+ * `contractManager` on {@link Arkade.connect}).
5863
5696
  *
5864
- * When a `contractManager` is configured and this contract is registered,
5865
- * reads the repository-backed state (offline-first, kept fresh by the
5866
- * contract watcher). Otherwise falls back to a direct indexer query.
5697
+ * Activity is reported from subscription on — coins that predate it are not replayed. After
5698
+ * subscribing, and on every `connection_reset` (the manager re-syncs silently), read stored
5699
+ * state with {@link getVtxos}.
5867
5700
  *
5868
- * Both branches refuse a spent or unilaterally exited output. They are not
5869
- * otherwise interchangeable: the fallback asks `spendableOnly`, which also
5870
- * drops swept coins — the manager branch keeps those.
5701
+ * @example
5702
+ * ```typescript
5703
+ * const spent = await htlc.on("vtxo_spent", (e) => console.log(e.vtxos));
5704
+ * const reset = await htlc.on("connection_reset", async () => reconcile(await htlc.getVtxos()));
5705
+ * spent.off();
5706
+ * ```
5707
+ */
5708
+ on<T extends ArkadeContractEventType>(type: T, callback: (event: ArkadeContractEvent<T>) => void | Promise<void>): Promise<ArkadeContractSubscription>;
5709
+ /**
5710
+ * Every stored VTXO of this contract, spent ones included (`getUtxos` hides those), as the
5711
+ * contract manager last synced them. The recovery read for {@link on}. Empty when the
5712
+ * contract is not registered.
5713
+ */
5714
+ getVtxos(): Promise<ExtendedContractVtxo[]>;
5715
+ private requireManager;
5716
+ /**
5717
+ * Spendable VTXOs locked by this contract: repository-backed when registered with a
5718
+ * `contractManager`, otherwise a direct indexer query. Both drop spent and unrolled outputs;
5719
+ * only the indexer branch (`spendableOnly`) also drops swept coins.
5871
5720
  */
5872
5721
  getUtxos(): Promise<VirtualCoin[]>;
5873
5722
  /** Total spendable balance (requires an indexer). */
@@ -5884,6 +5733,7 @@ declare class ArkadeTransactionBuilder {
5884
5733
  private readonly outputs;
5885
5734
  private readonly fundingCoins;
5886
5735
  private readonly assetSpecs;
5736
+ private readonly extraPackets;
5887
5737
  private coin?;
5888
5738
  private changeScript?;
5889
5739
  /** @internal */
@@ -5896,6 +5746,8 @@ declare class ArkadeTransactionBuilder {
5896
5746
  fund(coins: ArkTxInput[]): this;
5897
5747
  /** Transfer an asset group: which inputs supply it and which outputs receive it. */
5898
5748
  withAsset(spec: AssetSpec): this;
5749
+ /** Add an extension packet; reusing the asset or emulator packet's type fails at build. */
5750
+ withPacket(packet: ExtensionPacket): this;
5899
5751
  /** Destination for any surplus (inputs − outputs). Required when the spend is not exact. */
5900
5752
  change(script: Uint8Array): this;
5901
5753
  /** Add an output — `(script, amount)` or a list of outputs. */
@@ -5944,9 +5796,14 @@ declare const index_ArkadeArgType: typeof ArkadeArgType;
5944
5796
  declare const index_ArkadeArgValue: typeof ArkadeArgValue;
5945
5797
  type index_ArkadeBatchInput = ArkadeBatchInput;
5946
5798
  type index_ArkadeConnectOptions = ArkadeConnectOptions;
5799
+ type index_ArkadeConnectProviderOptions = ArkadeConnectProviderOptions;
5800
+ type index_ArkadeConnectServiceOptions = ArkadeConnectServiceOptions;
5947
5801
  type index_ArkadeContract<P extends Program = Program> = ArkadeContract<P>;
5948
5802
  declare const index_ArkadeContract: typeof ArkadeContract;
5803
+ type index_ArkadeContractEvent<T extends ArkadeContractEventType = ArkadeContractEventType> = ArkadeContractEvent<T>;
5804
+ type index_ArkadeContractEventType = ArkadeContractEventType;
5949
5805
  declare const index_ArkadeContractParams: typeof ArkadeContractParams;
5806
+ type index_ArkadeContractSubscription = ArkadeContractSubscription;
5950
5807
  type index_ArkadeExtendedCoin = ArkadeExtendedCoin;
5951
5808
  type index_ArkadeExtendedVirtualCoin = ArkadeExtendedVirtualCoin;
5952
5809
  declare const index_ArkadeFunction: typeof ArkadeFunction;
@@ -5957,6 +5814,7 @@ type index_ArkadeScriptOP = ArkadeScriptOP;
5957
5814
  type index_ArkadeScriptType = ArkadeScriptType;
5958
5815
  declare const index_ArkadeSegment: typeof ArkadeSegment;
5959
5816
  type index_ArkadeServerProvider = ArkadeServerProvider;
5817
+ declare const index_ArkadeService: typeof ArkadeService;
5960
5818
  type index_ArkadeSpendResult = ArkadeSpendResult;
5961
5819
  type index_ArkadeTransactionBuilder = ArkadeTransactionBuilder;
5962
5820
  declare const index_ArkadeTransactionBuilder: typeof ArkadeTransactionBuilder;
@@ -5964,6 +5822,7 @@ declare const index_AsmToken: typeof AsmToken;
5964
5822
  type index_AssetSpec = AssetSpec;
5965
5823
  type index_CallableFunctions = CallableFunctions;
5966
5824
  declare const index_CompiledProgramFunction: typeof CompiledProgramFunction;
5825
+ type index_ContractArtifact = ContractArtifact;
5967
5826
  type index_ContractFunctions<P extends Program> = ContractFunctions<P>;
5968
5827
  declare const index_InputDef: typeof InputDef;
5969
5828
  declare const index_InputRef: typeof InputRef;
@@ -5972,11 +5831,14 @@ declare const index_OPCODE_NAMES: typeof OPCODE_NAMES;
5972
5831
  declare const index_OPCODE_VALUES: typeof OPCODE_VALUES;
5973
5832
  declare const index_Program: typeof Program;
5974
5833
  declare const index_ProgramKeys: typeof ProgramKeys;
5834
+ declare const index_ResolvedArkadeService: typeof ResolvedArkadeService;
5975
5835
  declare const index_SUPPORTED_PROGRAM_VERSION: typeof SUPPORTED_PROGRAM_VERSION;
5976
5836
  declare const index_Script: typeof Script;
5977
5837
  declare const index_ScriptType: typeof ScriptType;
5978
5838
  declare const index_SignerRef: typeof SignerRef;
5979
5839
  declare const index_TapscriptSegment: typeof TapscriptSegment;
5840
+ declare const index_TweakedSigner: typeof TweakedSigner;
5841
+ declare const index_UnsupportedProgramVersionError: typeof UnsupportedProgramVersionError;
5980
5842
  type index_Utxo = Utxo;
5981
5843
  declare const index_WitnessRef: typeof WitnessRef;
5982
5844
  declare const index_arkadeScriptHash: typeof arkadeScriptHash;
@@ -5989,7 +5851,10 @@ declare const index_deserializeArkadeContractParams: typeof deserializeArkadeCon
5989
5851
  declare const index_fromASM: typeof fromASM;
5990
5852
  declare const index_getOpcodeName: typeof getOpcodeName;
5991
5853
  declare const index_getOpcodeValue: typeof getOpcodeValue;
5854
+ declare const index_isContractArtifact: typeof isContractArtifact;
5992
5855
  declare const index_parseArtifact: typeof parseArtifact;
5856
+ declare const index_programFromArtifact: typeof programFromArtifact;
5857
+ declare const index_resolveArkadeService: typeof resolveArkadeService;
5993
5858
  declare const index_resolveAsm: typeof resolveAsm;
5994
5859
  declare const index_serializeArkadeContractParams: typeof serializeArkadeContractParams;
5995
5860
  declare const index_stringifyArtifact: typeof stringifyArtifact;
@@ -5997,7 +5862,7 @@ declare const index_toASM: typeof toASM;
5997
5862
  declare const index_validateProgram: typeof validateProgram;
5998
5863
  declare const index_witnessRefToBytes: typeof witnessRefToBytes;
5999
5864
  declare namespace index {
6000
- export { index_ARKADE_OP as ARKADE_OP, index_ARKADE_OPCODES as ARKADE_OPCODES, index_ARKADE_OPCODE_NAMES as ARKADE_OPCODE_NAMES, index_ARKADE_OPCODE_VALUES as ARKADE_OPCODE_VALUES, index_ARKADE_OPS as ARKADE_OPS, index_Arkade as Arkade, index_ArkadeArgType as ArkadeArgType, index_ArkadeArgValue as ArkadeArgValue, type index_ArkadeBatchInput as ArkadeBatchInput, type index_ArkadeConnectOptions as ArkadeConnectOptions, index_ArkadeContract as ArkadeContract, index_ArkadeContractParams as ArkadeContractParams, type index_ArkadeExtendedCoin as ArkadeExtendedCoin, type index_ArkadeExtendedVirtualCoin as ArkadeExtendedVirtualCoin, index_ArkadeFunction as ArkadeFunction, index_ArkadeParamValue as ArkadeParamValue, index_ArkadeProgramScript as ArkadeProgramScript, index_ArkadeScript as ArkadeScript, type index_ArkadeScriptOP as ArkadeScriptOP, type index_ArkadeScriptType as ArkadeScriptType, index_ArkadeSegment as ArkadeSegment, type index_ArkadeServerProvider as ArkadeServerProvider, type index_ArkadeSpendResult as ArkadeSpendResult, index_ArkadeTransactionBuilder as ArkadeTransactionBuilder, index_AsmToken as AsmToken, type index_AssetSpec as AssetSpec, bignum as BigNum, type index_CallableFunctions as CallableFunctions, index_CompiledProgramFunction as CompiledProgramFunction, type index_ContractFunctions as ContractFunctions, index_InputDef as InputDef, index_InputRef as InputRef, index_OP as OP, index_OPCODE_NAMES as OPCODE_NAMES, index_OPCODE_VALUES as OPCODE_VALUES, index_Program as Program, index_ProgramKeys as ProgramKeys, index_SUPPORTED_PROGRAM_VERSION as SUPPORTED_PROGRAM_VERSION, index_Script as Script, index_ScriptType as ScriptType, index_SignerRef as SignerRef, index_TapscriptSegment as TapscriptSegment, type index_Utxo as Utxo, index_WitnessRef as WitnessRef, index_arkadeScriptHash as arkadeScriptHash, index_arkadeWitnessHash as arkadeWitnessHash, index_asmToBytes as asmToBytes, index_bytesToASM as bytesToASM, index_computeArkadeScriptPublicKey as computeArkadeScriptPublicKey, index_createArkadeBatchHandler as createArkadeBatchHandler, index_deserializeArkadeContractParams as deserializeArkadeContractParams, index_fromASM as fromASM, index_getOpcodeName as getOpcodeName, index_getOpcodeValue as getOpcodeValue, index_parseArtifact as parseArtifact, index_resolveAsm as resolveAsm, index_serializeArkadeContractParams as serializeArkadeContractParams, index_stringifyArtifact as stringifyArtifact, index_toASM as toASM, index_validateProgram as validateProgram, index_witnessRefToBytes as witnessRefToBytes };
5865
+ export { index_ARKADE_OP as ARKADE_OP, index_ARKADE_OPCODES as ARKADE_OPCODES, index_ARKADE_OPCODE_NAMES as ARKADE_OPCODE_NAMES, index_ARKADE_OPCODE_VALUES as ARKADE_OPCODE_VALUES, index_ARKADE_OPS as ARKADE_OPS, index_Arkade as Arkade, index_ArkadeArgType as ArkadeArgType, index_ArkadeArgValue as ArkadeArgValue, type index_ArkadeBatchInput as ArkadeBatchInput, type index_ArkadeConnectOptions as ArkadeConnectOptions, type index_ArkadeConnectProviderOptions as ArkadeConnectProviderOptions, type index_ArkadeConnectServiceOptions as ArkadeConnectServiceOptions, index_ArkadeContract as ArkadeContract, type index_ArkadeContractEvent as ArkadeContractEvent, type index_ArkadeContractEventType as ArkadeContractEventType, index_ArkadeContractParams as ArkadeContractParams, type index_ArkadeContractSubscription as ArkadeContractSubscription, type index_ArkadeExtendedCoin as ArkadeExtendedCoin, type index_ArkadeExtendedVirtualCoin as ArkadeExtendedVirtualCoin, index_ArkadeFunction as ArkadeFunction, index_ArkadeParamValue as ArkadeParamValue, index_ArkadeProgramScript as ArkadeProgramScript, index_ArkadeScript as ArkadeScript, type index_ArkadeScriptOP as ArkadeScriptOP, type index_ArkadeScriptType as ArkadeScriptType, index_ArkadeSegment as ArkadeSegment, type index_ArkadeServerProvider as ArkadeServerProvider, index_ArkadeService as ArkadeService, type index_ArkadeSpendResult as ArkadeSpendResult, index_ArkadeTransactionBuilder as ArkadeTransactionBuilder, index_AsmToken as AsmToken, type index_AssetSpec as AssetSpec, bignum as BigNum, type index_CallableFunctions as CallableFunctions, index_CompiledProgramFunction as CompiledProgramFunction, type index_ContractArtifact as ContractArtifact, type index_ContractFunctions as ContractFunctions, index_InputDef as InputDef, index_InputRef as InputRef, index_OP as OP, index_OPCODE_NAMES as OPCODE_NAMES, index_OPCODE_VALUES as OPCODE_VALUES, index_Program as Program, index_ProgramKeys as ProgramKeys, index_ResolvedArkadeService as ResolvedArkadeService, index_SUPPORTED_PROGRAM_VERSION as SUPPORTED_PROGRAM_VERSION, index_Script as Script, index_ScriptType as ScriptType, index_SignerRef as SignerRef, index_TapscriptSegment as TapscriptSegment, index_TweakedSigner as TweakedSigner, index_UnsupportedProgramVersionError as UnsupportedProgramVersionError, type index_Utxo as Utxo, index_WitnessRef as WitnessRef, index_arkadeScriptHash as arkadeScriptHash, index_arkadeWitnessHash as arkadeWitnessHash, index_asmToBytes as asmToBytes, index_bytesToASM as bytesToASM, index_computeArkadeScriptPublicKey as computeArkadeScriptPublicKey, index_createArkadeBatchHandler as createArkadeBatchHandler, index_deserializeArkadeContractParams as deserializeArkadeContractParams, index_fromASM as fromASM, index_getOpcodeName as getOpcodeName, index_getOpcodeValue as getOpcodeValue, index_isContractArtifact as isContractArtifact, index_parseArtifact as parseArtifact, index_programFromArtifact as programFromArtifact, index_resolveArkadeService as resolveArkadeService, index_resolveAsm as resolveAsm, index_serializeArkadeContractParams as serializeArkadeContractParams, index_stringifyArtifact as stringifyArtifact, index_toASM as toASM, index_validateProgram as validateProgram, index_witnessRefToBytes as witnessRefToBytes };
6001
5866
  }
6002
5867
 
6003
5868
  /** Known BIP21 parameters including Arkade-specific extensions. */
@@ -6075,23 +5940,14 @@ interface PaymentHandle {
6075
5940
  }): Promise<RouteResult>;
6076
5941
  }
6077
5942
  /**
6078
- * A priced route. The three amounts are **receiver-exact** and mean the same
6079
- * thing on every rail, so `options()` can be ranked on cost and a rail swapped
6080
- * without changing what the recipient gets:
5943
+ * A priced route. The amounts are **receiver-exact** on every rail, so options rank on cost and
5944
+ * rails swap without changing what the recipient gets. Rails whose primitive *deducts* its fee
5945
+ * (collaborative exit) gross the amount up; a rail that can't (it doesn't choose the fee) flags
5946
+ * it via `claimFeeDeductedFromPayout`.
6081
5947
  *
6082
- * - `amount` — sats delivered **to the recipient**.
6083
- * - `fee` — sats charged **on top**, by the rail and its counterparty.
6084
- * - `total` — `amount + fee`; the sats that leave the wallet.
6085
- *
6086
- * Rails whose underlying primitive *deducts* its fee (the collaborative exit)
6087
- * gross the amount up to honour this; rails that add it on top pass it through.
6088
- * A rail that does not perform the deducting spend cannot gross up to a fee it
6089
- * never chooses, and flags that instead: see `claimFeeDeductedFromPayout`.
6090
- *
6091
- * `fee` is a pre-send estimate wherever the true cost is only fixed later: the
6092
- * collaborative exit does not include the per-input intent fees, which depend
6093
- * on the VTXO selection made at settlement. Treat it as a display and ranking
6094
- * figure, not a guarantee.
5948
+ * `fee` is an estimate where cost is fixed later: the collaborative exit omits per-input intent
5949
+ * fees unless {@link PaymentRequest.selectedVtxos} is named. A display/ranking figure, not a
5950
+ * guarantee.
6095
5951
  */
6096
5952
  interface RouteQuote {
6097
5953
  railId: string;
@@ -6102,31 +5958,18 @@ interface RouteQuote {
6102
5958
  /** `amount + fee` — what leaves the wallet. */
6103
5959
  total: number;
6104
5960
  /**
6105
- * Unix seconds after which the counterparty stops honouring this quote.
6106
- *
6107
- * Absent means "nothing to observe", not "never expires": a rail with no
6108
- * counterparty and no quote book — an Arkade transfer, an asset transfer, a
6109
- * collaborative exit — has no validity to state. A caller holding a quote
6110
- * across user think-time should read absence as "no check possible", and must
6111
- * still expect {@link send} to refuse either way: the swap rails re-check
6112
- * validity there, which is the only point that can judge it against the
6113
- * moment of spending.
5961
+ * Unix seconds after which the counterparty stops honouring this quote. Absent means "no
5962
+ * check possible" (rails without a counterparty), not "never expires"; {@link send} may
5963
+ * still refuse, since swap rails re-check validity at spend time.
6114
5964
  */
6115
5965
  validUntil?: number;
6116
5966
  /**
6117
- * @experimental The asset shape is provisional. The v2 swap client models
6118
- * assets as `give`/`take`/`amountOn` over `AssetRef`, and the two
6119
- * vocabularies are expected to converge on v0.5; do not treat this field as
6120
- * stable 0.4.x API.
6121
- *
6122
- * The asset view; absent means BTC only. The sats fields keep their
6123
- * meaning — an asset rides a sats-carrying output, so `amount` is the
6124
- * carrier, not zero.
5967
+ * @experimental The asset shape is provisional, expected to converge with the v2 swap
5968
+ * client's `give`/`take`/`amountOn` over `AssetRef` in v0.5; not stable 0.4.x API.
6125
5969
  *
6126
- * A pair, not a triple: on a cross-asset route these name DIFFERENT
6127
- * assets, so `total = amount + fee` cannot hold across the two units —
6128
- * which forces the purchase price into `fee`. Prefer `assets.spent` for a
6129
- * cost display.
5970
+ * The asset view; absent means BTC only. `amount` stays the sats carrier, not zero. On a
5971
+ * cross-asset route `delivered`/`spent` are different assets, so the purchase price lands in
5972
+ * `fee`; prefer `assets.spent` for a cost display.
6130
5973
  */
6131
5974
  assets?: {
6132
5975
  delivered: Asset;
@@ -6164,6 +6007,13 @@ interface PaymentRequest {
6164
6007
  * Additive: an asset transfer also moves sats, so a 500 USDX request
6165
6008
  * legitimately has both. A rail that cannot deliver assets must REFUSE. */
6166
6009
  assets?: Asset[];
6010
+ /**
6011
+ * Spend exactly these (normalized) virtual outputs, as {@link SendParams.selectedVtxos}:
6012
+ * ungated like `settle({ inputs })`, and a shortfall is an error, not a top-up. Only rails
6013
+ * spending the wallet's own coins (`ark`, `ark-asset`, `onchain`) can honour it;
6014
+ * counterparty-funded rails must REFUSE, not ignore it.
6015
+ */
6016
+ selectedVtxos?: NormalizedExtendedVirtualCoin[];
6167
6017
  }
6168
6018
  /** A payment rail — registered by id, mirrors the ActivityRegistry resolver shape. */
6169
6019
  interface PaymentRail {
@@ -6196,10 +6046,11 @@ declare const isLightningInvoice: (raw: string) => boolean;
6196
6046
  /**
6197
6047
  * True for an LNURL or a Lightning address (`user@host`).
6198
6048
  *
6199
- * TODO(lnurl): no rail consumes this yet — LNURL / Lightning-address routing is
6200
- * planned future work. The predicate is exported ahead of the rail so consumers
6201
- * can classify these targets today; until the rail lands, `route()` throws
6202
- * "no rail for" on them. Keep the export (do not flag as unused).
6049
+ * No rail here consumes it, and that is the layering rather than a gap:
6050
+ * routing an LNURL needs an LNURL client, so the rails ship from
6051
+ * `@arkade-os/lnurl-client/arkade` (`lnurlRails`) and are registered by the
6052
+ * app, as the solver rails from `@arkade-os/swap` are. With none registered,
6053
+ * `route()` throws "no rail for" on these targets.
6203
6054
  */
6204
6055
  declare const isLnurl: (raw: string) => boolean;
6205
6056
  /** True for a bech32 (segwit) or base58 (legacy) Bitcoin address, any network —
@@ -6236,6 +6087,11 @@ declare function assetsOf(req: PaymentRequest): Asset[];
6236
6087
  /** For a BTC-only rail: refusing is what leaves the router free to rank an
6237
6088
  * asset-capable one, instead of paying the carrier and dropping the asset. */
6238
6089
  declare function assertNoAssets(railId: string, req: PaymentRequest): void;
6090
+ /** The inputs a request names. An EMPTY array is still a selection, covering nothing. */
6091
+ declare function selectionOf(req: PaymentRequest): NormalizedExtendedVirtualCoin[] | undefined;
6092
+ /** For a rail whose counterparty funds the spend: ignoring a named input set
6093
+ * would spend coins the caller had promised elsewhere, so refuse instead. */
6094
+ declare function assertNoSelection(railId: string, req: PaymentRequest): void;
6239
6095
  /** Exactly one: `Wallet.send` takes a list because one output can carry
6240
6096
  * several, but a routed PAYMENT is one thing being paid. */
6241
6097
  declare function resolveAssetAmount(railId: string, req: PaymentRequest): Asset;
@@ -6314,12 +6170,15 @@ declare const walletFeeSource: (wallet: Wallet) => () => Promise<FeeInfo>;
6314
6170
  * and offboards VTXOs to the address via {@link Ramps.offboard}, which owns
6315
6171
  * fee-aware coin selection, dust-safe change, and settlement.
6316
6172
  *
6317
- * `offboard` deducts its fee from the amount it is handed, so the rail grosses
6318
- * the amount up first: the recipient receives exactly `quote.amount`, matching
6319
- * the receiver-exact semantics of every other rail (see {@link RouteQuote}).
6320
- * `quote.total` is the offboard amount; the per-input intent fees `offboard`
6321
- * shaves off the selected VTXOs are additional and depend on the selection, so
6322
- * they are not part of the quote.
6173
+ * The exit fee is priced on the DESTINATION output — the one arkd charges for —
6174
+ * and met from the balance, so the recipient receives exactly `quote.amount`
6175
+ * (see {@link RouteQuote}). {@link Ramps.offboardExact} carries that; the
6176
+ * gross-up this rail used to do could only approximate it.
6177
+ *
6178
+ * A request naming `selectedVtxos` offboards exactly those — so the exit need not
6179
+ * sweep the whole off-chain balance into one change output — and only then does
6180
+ * the quote carry the per-input intent fees: unselected, the coins are chosen
6181
+ * later at settlement and there is nothing here to price.
6323
6182
  *
6324
6183
  * An explicit amount is mandatory. To sweep the full balance, call
6325
6184
  * `Ramps.offboard(address, feeInfo)` directly — the router has no amountless path.
@@ -6389,9 +6248,7 @@ declare function sequenceToTimelock(sequence: number): RelativeTimelock;
6389
6248
  declare function toXOnly(key: Uint8Array, label?: string): Uint8Array;
6390
6249
 
6391
6250
  declare const buildVersion = "0.9.9";
6392
- /**
6393
- * The SDK's own version string, sourced from package.json
6394
- */
6251
+ /** The SDK's own version string, sourced from package.json */
6395
6252
  declare const sdkVersion: string;
6396
6253
  /**
6397
6254
  * Wraps a transport-level `fetch` rejection (DNS failure, connection refused,
@@ -6410,12 +6267,9 @@ declare class FetchError extends Error {
6410
6267
  });
6411
6268
  }
6412
6269
  /**
6413
- * Deadline applied to a read that carries no `AbortSignal` of its own.
6414
- *
6415
- * `fetch` has no default timeout, so a connection the network dropped silently
6416
- * stays pending until the runtime gives up — and every bound built on top of it
6417
- * waits with it. A retry ladder, a bounded queue or a mutex only work if the
6418
- * call underneath them terminates.
6270
+ * Deadline for a read that carries no `AbortSignal` of its own. `fetch` has no default timeout,
6271
+ * so a silently dropped connection stays pending, and every retry ladder, queue or mutex built on
6272
+ * top of it waits with it.
6419
6273
  */
6420
6274
  declare const READ_TIMEOUT_MS = 30000;
6421
6275
 
@@ -6478,46 +6332,22 @@ interface ManagedConnection extends AsyncDisposable {
6478
6332
  /**
6479
6333
  * The open connection, opening it on first call.
6480
6334
  *
6481
- * Call this once per operation and use the handle for the transaction you
6482
- * start right away — never store it on the repository, and never carry it
6483
- * across an `await`. The connection can be closed underneath you at any
6484
- * time (a `versionchange` from another tab, eviction, "clear site data"),
6485
- * after which every transaction on that handle throws `InvalidStateError`;
6486
- * a later `get()` transparently reopens, but only for callers that ask
6487
- * again. Holding the resolved database is exactly the defect this type
6488
- * exists to remove.
6489
- *
6490
- * ## The dispose boundary
6335
+ * Call once per operation and use the handle for the transaction you start right away —
6336
+ * never store it or carry it across an `await`. It can be closed underneath you at any time
6337
+ * (`versionchange` from another tab, eviction, "clear site data"), after which every
6338
+ * transaction on it throws `InvalidStateError`; a later `get()` transparently reopens.
6491
6339
  *
6492
- * `get()` is valid only before `[Symbol.asyncDispose]`. Afterwards it
6493
- * rejects with {@link ConnectionDisposedError}, permanently: dispose has
6494
- * released this connection's single reference, and reopening would take a
6495
- * refcount nothing is left to release. Disposal is final by design — there
6496
- * is no revive; construct a new repository, which constructs a new
6497
- * connection, instead.
6498
- *
6499
- * Dispose neither awaits nor cancels work already in flight. A transaction
6500
- * started just before it can abort when the underlying handle closes, and
6501
- * an in-flight `get()` may resolve to a database that is closing. So
6502
- * sequence disposal after the operations you care about have settled —
6503
- * `await` the repository's outstanding calls first — rather than racing it
6504
- * against them.
6505
- *
6506
- * Callers must not close the database themselves; the reference this
6507
- * connection holds is released by its own dispose, once.
6340
+ * After `[Symbol.asyncDispose]` it rejects with {@link ConnectionDisposedError}, permanently:
6341
+ * reopening would take a refcount nothing releases, so construct a new repository instead.
6342
+ * Dispose neither awaits nor cancels in-flight work, so `await` outstanding repository calls
6343
+ * before disposing. Callers must not close the database themselves.
6508
6344
  */
6509
6345
  get(): Promise<IDBDatabase>;
6510
6346
  }
6511
6347
  /**
6512
- * Forget-and-reopen around {@link openDatabase}, shared by every IndexedDB
6513
- * repository. Caching the resolved `IDBDatabase` is the defect this exists to
6514
- * remove: once the manager closes on `versionchange`, every later transaction on
6515
- * that handle throws `InvalidStateError` with no path back.
6516
- *
6517
- * Opens nothing until the first {@link ManagedConnection.get} — repositories
6518
- * construct their storage in their own constructors, and an eager open would
6519
- * move the "IndexedDB is not available in this environment" throw to
6520
- * construction time.
6348
+ * Forget-and-reopen around {@link openDatabase}, shared by every IndexedDB repository: a cached
6349
+ * `IDBDatabase` throws `InvalidStateError` forever once the manager closes it on `versionchange`.
6350
+ * Lazy, so the "IndexedDB is not available" throw stays out of repository constructors.
6521
6351
  */
6522
6352
  declare function createManagedConnection(dbName: string, version: number, initDatabase: (db: IDBDatabase, oldVersion: number, transaction: IDBTransaction | null) => void): ManagedConnection;
6523
6353
 
@@ -6591,6 +6421,7 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
6591
6421
  * ```
6592
6422
  */
6593
6423
  issue(params: IssuanceParams): Promise<IssuanceResult>;
6424
+ private issueWith;
6594
6425
  /**
6595
6426
  * Reissue more units of an existing asset.
6596
6427
  * Requires ownership of the control asset.
@@ -6609,6 +6440,7 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
6609
6440
  * ```
6610
6441
  */
6611
6442
  reissue(params: ReissuanceParams): Promise<string>;
6443
+ private reissueWith;
6612
6444
  /**
6613
6445
  * Burn assets.
6614
6446
  * @param params - Parameters for burning
@@ -6625,6 +6457,7 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
6625
6457
  * ```
6626
6458
  */
6627
6459
  burn(params: BurnParams): Promise<string>;
6460
+ private burnWith;
6628
6461
  }
6629
6462
 
6630
- export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, ASSET_CARRIER_SATS, Activity, ActivityRegistry, AddressAllocationCapable, AmbiguousRouteError, type AnchorBumper, ArkAddress, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, type ArkadeBatchInput, ArkadeBroadcaster, ArkadeCash, ArkadeContractParams, type ArkadeExtendedCoin, type ArkadeExtendedVirtualCoin, ArkadeInfo, ArkadeReader, Asset, AssetDetails, AssetManager, BIP21, BIP21Error, type BIP21Params, type BIP21ParseResult, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, BatchExpiryPolicy, BurnParams, CSVMultisigTapscript, CachingArkProvider, ChainTx, Coin, ConditionWitness, ConnectionDisposedError, type ConnectorTreeNode, Contract, ContractEvent, ContractRepository, ContractSyncState, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DatabaseUpgradeBlockedError, DefaultVtxo, DelegateInfo, DelegateNotConfiguredError, DescriptorIdentity, type DescriptorIdentityOptions, type DescriptorOptions, type DescriptorSigner, DescriptorSigningProviderMissingError, type DeterministicSigner, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, type BlockHeader as ElectrumBlockHeader, ElectrumOnchainProvider, type TransactionHistory as ElectrumTransactionHistory, type Unspent as ElectrumUnspent, type EmulatorEntry, type EmulatorInfo, EmulatorPacket, type EmulatorProvider, EncodedVtxoScript, Estimator, type ExcludableVtxo, type ExecutorEvent, type ExecutorOptions, type ExitDelay, type ExitFeeWallet, type ExitMode, type ExitOptions, type ExitPackage, type ExitQuote, type ExitStep, type ExitTotals, type ExitVtxoInfo, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, Extension, ExtensionNotFoundError, type ExtensionPacket, FeeAmount, FeeInfo, FeeOutput, FetchError, GetArkadeInfoOptions, GetNewAddressesOptions, GetVtxosFilter, GetVtxosOptions, HDAllocationCapable, HDDescriptorProvider, type HDDeterministicSignCapable, HDWalletCapable, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, IndexerProvider, Intent, IntentFeeConfig, IntentFilter, IntentRepository, IssuanceParams, IssuanceResult, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, type ManagedConnection, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, MigrationGlobalSkipReason, MigrationLegSkipReason, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, NewAddress, NormalizedVtxoPage, OffchainInput, type OffchainTx, type OnExitObserved, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, P2A, PaginationOptions, type ParsedArkContract, PathContext, PathSelection, type PaymentHandle, type PaymentOption, type PaymentRail, type PaymentRequest, PaymentRouter, type PaymentStatus, PrevArkTxField, PrevoutTxField, ProviderConnectionState, type ProvisionedClaimSecret, type ProvisionedKey, READ_TIMEOUT_MS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, RestEmulatorProvider, type RouteQuote, type RouteResult, type RouterContext, type RouterPreferences, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, SendParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignedIntent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TreeNonces, TreePartialSigs, TxNotificationEvent, TxTree, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, type VSize, type VerifyServerSignatures, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, type VtxoExclusion, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WalletRepository, type WalletRestoreHook, WatchedScript, WsElectrumChainSource, adoptContractDescriptor, arkAssetRail, arkRail, arkTarget, index as arkade, assembleBtcdTaprootTree, assertFinalCommitmentMatchesValidated, assertNoAssets, assertSendableAmount, assertSubmittedArkTxid, index$1 as asset, assetsOf, awaitTransaction, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, buildVersion, claimWithPreimageIdentity, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultPaymentRouter, createManagedConnection, decodeArkContract, deleteByIndex, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, deserializeExitPackage, encodeArkContract, exitObserverFor, gateExclusion, gatedContracts, getAllByIndexValues, getArkPsbtFields, hasBoardingTxExpired, identityDescriptor, invoiceTarget, isArkContract, isBtcAddress, isCltvSatisfied, isContractGenericallySpendable, isCsvSpendable, isDeterministicSigner, isHDDeterministicSignCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isRetryableProviderError, isValidArkAddress, logExcludedVtxos, makeHandle, matchServerCheckpoints, normalizeToDescriptor, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, parseHDDescriptor, promisifyRequest, provisionClaimSecret, provisionRefundKey, registerWalletRestoreHook, resolveAssetAmount, resolveSendAmount, sdkVersion, selectCoinsWithAsset, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, signAndSubmitOffchainTx, timelockToSequence, toXOnly, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, walletFeeSource };
6463
+ export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, ASSET_CARRIER_SATS, Activity, ActivityRegistry, AddressAllocationCapable, AmbiguousRouteError, type AnchorBumper, ArkAddress, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, Arkade, type ArkadeBatchInput, ArkadeBroadcaster, ArkadeCash, ArkadeContractParams, type ArkadeExtendedCoin, type ArkadeExtendedVirtualCoin, ArkadeInfo, ArkadeReader, ArkadeService, Asset, AssetDetails, AssetManager, BIP21, BIP21Error, type BIP21Params, type BIP21ParseResult, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, BatchExpiryPolicy, BurnParams, CSVMultisigTapscript, CachingArkProvider, ChainTx, Coin, ConditionWitness, ConnectionDisposedError, Contract, ContractEvent, ContractFilter, ContractRepository, ContractSyncState, ContractVtxoEvent, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DatabaseUpgradeBlockedError, DefaultVtxo, DelegateInfo, DelegateNotConfiguredError, DescriptorIdentity, type DescriptorIdentityOptions, type DescriptorOptions, DescriptorProvider, type DescriptorSigner, DescriptorSigningProviderMissingError, DescriptorSigningRequest, type DeterministicSigner, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, type BlockHeader as ElectrumBlockHeader, ElectrumOnchainProvider, type TransactionHistory as ElectrumTransactionHistory, type Unspent as ElectrumUnspent, type EmulatorEntry, EmulatorPacket, EmulatorProvider, EncodedVtxoScript, Estimator, type ExcludableVtxo, type ExecutorEvent, type ExecutorOptions, type ExitDelay, type ExitFeeWallet, type ExitMode, type ExitOptions, type ExitPackage, type ExitQuote, type ExitStep, type ExitTotals, type ExitVtxoInfo, ExplorerTransaction, ExtendedCoin, ExtendedContractVtxo, ExtendedVirtualCoin, Extension, ExtensionNotFoundError, type ExtensionPacket, FeeAmount, FeeInfo, FeeOutput, FetchError, GetArkadeInfoOptions, GetNewAddressesOptions, GetSpendableVtxosFilter, GetVtxosFilter, GetVtxosOptions, HDAllocationCapable, HDDescriptorProvider, type HDDeterministicSignCapable, HDWalletCapable, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexerProvider, InputExpiryFloor, Intent, IntentFeeConfig, IntentPageFilter, IntentRepository, IssuanceParams, IssuanceResult, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, type ManagedConnection, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, MigrationGlobalSkipReason, MigrationLegSkipReason, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, NewAddress, NormalizedExtendedVirtualCoin, NormalizedVtxoPage, OffchainInput, type OffchainTx, type OnExitObserved, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, OversizedChangeError, P2A, PageRequest, PageResult, PaginationOptions, type ParsedArkContract, PathContext, PathSelection, type PaymentHandle, type PaymentOption, type PaymentRail, type PaymentRequest, PaymentRouter, type PaymentStatus, PrevArkTxField, PrevoutTxField, ProviderConnectionState, type ProvisionedClaimSecret, type ProvisionedKey, READ_TIMEOUT_MS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, type RouteQuote, type RouteResult, type RouterContext, type RouterPreferences, ScriptVtxoCursor, ScriptVtxoPageOptions, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, SendDeadlineExceededError, SendParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignedIntent, SignerSession, SignerStatus, SingleKey, StaticDescriptorProvider, Status, StorageConfig, StoredVtxo, TapLeafScript, Transaction, TransactionHistoryPageCursor, TransactionHistoryPageFilter, TreeNonces, TreePartialSigs, TxNotificationEvent, TxTree, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, UnsupportedProgramVersionError, type VSize, type VerifyServerSignatures, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, type VtxoExclusion, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WalletRepository, type WalletRestoreHook, WatchedScript, WsElectrumChainSource, adoptContractDescriptor, arkAssetRail, arkRail, arkTarget, index as arkade, assembleBtcdTaprootTree, assertFinalCommitmentMatchesValidated, assertNoAssets, assertNoSelection, assertNonNegativeMs, assertSendDeadline, assertSendableAmount, assertSubmittedArkTxid, assertTimerMs, assertValidServerUnrollScript, index$1 as asset, assetsOf, awaitTransaction, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, buildVersion, captureSendDeadline, claimWithPreimageIdentity, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultPaymentRouter, createManagedConnection, decodeArkContract, deleteByIndex, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, deserializeExitPackage, encodeArkContract, exitObserverFor, gateExclusion, gatedContracts, getAllByIndexValues, getArkPsbtFields, hasBoardingTxExpired, identityDescriptor, invoiceTarget, isArkContract, isBtcAddress, isCltvSatisfied, isContractGenericallySpendable, isCsvSpendable, isDeterministicSigner, isHDDeterministicSignCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isRetryableProviderError, isValidArkAddress, logExcludedVtxos, makeHandle, matchServerCheckpoints, normalizeToDescriptor, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, parseHDDescriptor, promisifyRequest, provisionClaimSecret, provisionRefundKey, registerWalletRestoreHook, resolveAssetAmount, resolveSendAmount, sdkVersion, selectCoinsWithAsset, selectionOf, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, signAndSubmitOffchainTx, submitViaEmulator, timelockToSequence, toXOnly, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, walletFeeSource };