@arkade-os/sdk 0.5.0-rc.8 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +231 -50
  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-CeYTmuGU.d.ts → asyncStorageTaskQueue-BFv2O1y1.d.ts} +1 -1
  7. package/dist/{asyncStorageTaskQueue-Bn3FoNkc.d.cts → asyncStorageTaskQueue-qRRQUOE8.d.cts} +1 -1
  8. package/dist/{chunk-ZTCDT7KB.cjs → chunk-AU77RYOC.cjs} +6304 -4613
  9. package/dist/chunk-AU77RYOC.cjs.map +1 -0
  10. package/dist/{chunk-K5RED5VE.cjs → chunk-GN2K4WBP.cjs} +494 -1122
  11. package/dist/chunk-GN2K4WBP.cjs.map +1 -0
  12. package/dist/{chunk-BMPGUGYZ.cjs → chunk-GOM26K6H.cjs} +12 -10
  13. package/dist/chunk-GOM26K6H.cjs.map +1 -0
  14. package/dist/{chunk-LN4ZJZK4.js → chunk-GWJWXVUB.js} +5906 -4235
  15. package/dist/chunk-GWJWXVUB.js.map +1 -0
  16. package/dist/{chunk-G6S4XSFI.js → chunk-HABGVRLF.js} +112 -243
  17. package/dist/chunk-HABGVRLF.js.map +1 -0
  18. package/dist/{chunk-2AWDPVZI.cjs → chunk-IQWLFYT2.cjs} +124 -254
  19. package/dist/chunk-IQWLFYT2.cjs.map +1 -0
  20. package/dist/{chunk-56RCBKNF.cjs → chunk-JT5YVMCJ.cjs} +39 -46
  21. package/dist/chunk-JT5YVMCJ.cjs.map +1 -0
  22. package/dist/{chunk-INTEA7D3.js → chunk-K2E6X6JT.js} +32 -39
  23. package/dist/chunk-K2E6X6JT.js.map +1 -0
  24. package/dist/{chunk-XCNAGBFR.js → chunk-K352GMVL.js} +427 -1078
  25. package/dist/chunk-K352GMVL.js.map +1 -0
  26. package/dist/{chunk-BIRUBLP3.js → chunk-TZSKLERU.js} +7 -5
  27. package/dist/chunk-TZSKLERU.js.map +1 -0
  28. package/dist/{chunk-NY5FN4VV.cjs → chunk-UUSKJOSX.cjs} +548 -399
  29. package/dist/chunk-UUSKJOSX.cjs.map +1 -0
  30. package/dist/{chunk-MTYQXZ2T.js → chunk-ZOEB53NQ.js} +541 -400
  31. package/dist/chunk-ZOEB53NQ.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-Cyv2suFd.d.cts → delegate-B5BmYkEY.d.cts} +1 -1
  37. package/dist/{delegate-CyBnNY9v.d.ts → delegate-DNbiUgy8.d.ts} +1 -1
  38. package/dist/index-B4QuO9sH.d.cts +645 -0
  39. package/dist/index-CYeyT3kn.d.ts +645 -0
  40. package/dist/{index-BIL9boGL.d.cts → index-CZw-MMfY.d.cts} +1644 -2291
  41. package/dist/{index-BIL9boGL.d.ts → index-CZw-MMfY.d.ts} +1644 -2291
  42. package/dist/index.cjs +399 -311
  43. package/dist/index.d.cts +953 -1124
  44. package/dist/index.d.ts +953 -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-z_BGID85.d.cts → taskRunner-B3SLvUfL.d.cts} +1 -1
  59. package/dist/{taskRunner-CRbuzUXR.d.ts → taskRunner-wm1bhmtP.d.ts} +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-DCZ2-Bea.d.cts +1874 -0
  73. package/dist/wallet-DGLXuwXT.d.ts +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-2AWDPVZI.cjs.map +0 -1
  80. package/dist/chunk-56RCBKNF.cjs.map +0 -1
  81. package/dist/chunk-BIRUBLP3.js.map +0 -1
  82. package/dist/chunk-BMPGUGYZ.cjs.map +0 -1
  83. package/dist/chunk-G6S4XSFI.js.map +0 -1
  84. package/dist/chunk-INTEA7D3.js.map +0 -1
  85. package/dist/chunk-K5RED5VE.cjs.map +0 -1
  86. package/dist/chunk-LN4ZJZK4.js.map +0 -1
  87. package/dist/chunk-MTYQXZ2T.js.map +0 -1
  88. package/dist/chunk-NY5FN4VV.cjs.map +0 -1
  89. package/dist/chunk-XCNAGBFR.js.map +0 -1
  90. package/dist/chunk-ZTCDT7KB.cjs.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.cts 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.cjs';
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.cjs';
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-D1ImQqlu.cjs';
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-D1ImQqlu.cjs';
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-DleNQcz5.cjs';
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-DleNQcz5.cjs';
7
- import { D as DefaultVtxo } from './delegate-Cyv2suFd.cjs';
8
- export { a as DelegateVtxo } from './delegate-Cyv2suFd.cjs';
1
+ import { ah as ReadonlyIdentity, a as Identity, a4 as DescriptorSigningRequest, a5 as Transaction, aA as SignerSession, a3 as DescriptorProvider, aE as IntentFeeConfig, aF as OffchainInput, aG as FeeAmount, aH as OnchainInput, aI 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, aq as NetworkName, ai as OnchainProvider, ay as SettlementConfig, aJ as ContractWatcherConfig, aK as Asset, R as Recipient, aL as FeeInfo, o as SettlementEvent, N as NormalizedExtendedVirtualCoin, S as SettleParams, G as GetArkadeInfoOptions, aM as GetVtxosOptions, aN as PaginationOptions, f as GetVtxosFilter, g as GetSpendableVtxosFilter, aO as CreateContractParams, aP as GetContractsFilter, z as VirtualCoin, aQ as GetSpendablePathsOptions, aR as GetAllSpendingPathsOptions, l as GetNewAddressesOptions, aS as InputExpiryFloor, aT as IssuanceParams, aU as ReissuanceParams, aV as BurnParams, aW as RenewVtxosOptions, A as ArkadeInfo, aX as NormalizedVtxoPage, c as ArkadeReader, d as ArkadeBroadcaster, e as WalletBalance, ao as ContractSyncState, as as ContractWithVtxos, aY as WatchedScript, aZ as PathSelection, m as NewAddress, a_ as ContractEvent, a$ as AssetDetails, b0 as IssuanceResult, b1 as DelegateInfo, b2 as MigrationGlobalSkipReason, b3 as MigrationLegSkipReason, b4 as SignerStatus, ag as IReadonlyWallet, i as ActivityRegistry, an as IReadonlyAssetManager, b5 as StorageConfig, j as Activity, k as IContractManager, q as IAssetManager, p as SendParams, n as IDelegateManager, b6 as IVtxoManager, a6 as Network, au as Coin, b7 as SendBitcoinParams, b8 as ExplorerTransaction, aB as SignedIntent, aC as Intent, b9 as TreeNonces, ba as TreePartialSigs, T as TxNotificationEvent, bb as PendingTx, y as TapLeafScript, bc as EncodedVtxoScript, ax as CSVMultisigTapscript, x as RelativeTimelock, bd as EmulatorProvider, V as VtxoScript, be as Status, ar as ArkAddress, bf as ChainTx, w as IndexerProvider, a9 as TxTree, bg as ArkadeService, bh as ContractVtxoEvent, bi as ExtendedContractVtxo, bj as ResolvedArkadeService, bk as resolveArkadeService, bl as PathContext } from './index-CZw-MMfY.cjs';
2
+ export { bm as ActivityIntent, bn as ActivityResolver, bo as ArkIntentState, bp as ArkTapscript, bq as AssetMetadata, br as BITCOIN_EMULATOR_PUBKEY, bs as BaseWalletConfig, ad as BatchFailedEvent, ab as BatchFinalizationEvent, ac as BatchFinalizedEvent, bt as BatchInfo, bu as BatchSignableIdentity, a7 as BatchStartedEvent, bv as CLTVMultisigTapscript, bw as CandidateDeps, bx as ChainTxType, a2 as ChainedTxType, by as CommitmentTx, bz as ConditionCSVMultisigTapscript, bA as ConditionMultisigTapscript, bB as ConnectorTreeNode, bC as ContractBalance, bD as ContractEventCallback, bE as ContractHandler, av as ContractManager, aw as ContractManagerConfig, bF as ContractState, bG as ContractVtxo, bH as ContractWatcher, bI as ContractWatcherEventCallback, bJ as DEFAULT_ARKADE_EMULATOR_URL, bK as DEFAULT_VTXO_PAGE_SIZE, bL as DelegateManagerImpl, bM as DelegateOptions, aj as DelegateProvider, bN as DeprecatedSignerMigrationReport, bO as DeprecatedSignerReport, bP as DigestMismatchError, bQ as Discoverable, bR as DiscoveredContract, bS as DiscoveryDeps, bT as ESPLORA_URL, bU as EmulatorInfo, bV 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, aD 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, az 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-CZw-MMfY.cjs';
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-DCZ2-Bea.cjs';
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-DCZ2-Bea.cjs';
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-B4QuO9sH.cjs';
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-B4QuO9sH.cjs';
7
+ import { D as DefaultVtxo } from './delegate-B5BmYkEY.cjs';
8
+ export { a as DelegateVtxo } from './delegate-B5BmYkEY.cjs';
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.
913
699
  *
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.
700
+ * @example
701
+ * ```typescript
702
+ * // Create from hex string
703
+ * const key = SingleKey.fromHex('your_private_key_hex');
704
+ *
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.
855
+ * The key that spends a leg we claim, plus the preimage that unlocks it. Three arms:
1032
856
  *
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.
1036
- *
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.
1089
- *
1090
- * Resolves in one precedence order, mirroring the arms
1091
- * {@link provisionClaimSecret} chose between:
892
+ * The preimage for a provisioned descriptor, in the precedence {@link provisionClaimSecret} chose:
1092
893
  *
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.
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).
1123
918
  *
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.
1127
- *
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:
1216
+ * Assemble a Taproot script tree with btcd's `txscript.AssembleTaprootScriptTree` algorithm
1217
+ * (the one arkd uses).
1411
1218
  *
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])
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`.
1418
1222
  *
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
1422
- *
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.
2195
- *
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.
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.
2201
1970
  *
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...',
@@ -4085,6 +3883,9 @@ declare function assertSubmittedArkTxid(response: {
4085
3883
  interface VerifyServerSignatures {
4086
3884
  /** The Ark server's key; x-only or compressed, both accepted. */
4087
3885
  serverPubkey: Uint8Array;
3886
+ /** Retired signer keys the server still advertises: a leaf built before a
3887
+ * rotation names one of these, and it is the leaf that decides. */
3888
+ deprecatedServerPubkeys?: Uint8Array[];
4088
3889
  }
4089
3890
  /**
4090
3891
  * Build, sign, submit, and finalize an offchain transaction whose every input
@@ -4109,6 +3910,21 @@ declare function signAndSubmitOffchainTx(params: {
4109
3910
  /** Forwarded to {@link submitOffchainTx}; omitted, nothing is checked. */
4110
3911
  verifyServerSignatures?: VerifyServerSignatures;
4111
3912
  }): Promise<string>;
3913
+ /**
3914
+ * Sign the caller's inputs of a pre-built offchain tx and submit it through the emulator, which
3915
+ * co-signs and finalizes it with arkd. The checkpoints of `inputIndexes` are signed up front: the
3916
+ * emulator verifies them before its own arkd handshake. An emulator-only leaf passes no inputs and
3917
+ * no signer.
3918
+ */
3919
+ declare function submitViaEmulator(emulator: Pick<EmulatorProvider, "submitTx">, offchainTx: OffchainTx, signer: {
3920
+ sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
3921
+ } | undefined, opts: {
3922
+ inputIndexes: number[];
3923
+ }): Promise<{
3924
+ txid: string;
3925
+ signedArkTx: string;
3926
+ signedCheckpointTxs: string[];
3927
+ }>;
4112
3928
  /**
4113
3929
  * Decorate a signer so it reveals `preimage` on every input it signs.
4114
3930
  *
@@ -4363,17 +4179,19 @@ declare class ArkNote implements ExtendedCoin {
4363
4179
  }
4364
4180
 
4365
4181
  /**
4366
- * ArkadeCash is a bearer instrument for the Ark protocol.
4182
+ * ArkadeCash is a bearer instrument for the Arkade.
4367
4183
  * It encodes a private key and contract parameters as a bech32m string,
4368
4184
  * enabling wallet-to-wallet transfers without address exchange.
4369
4185
  *
4370
- * Format: arkadecash1... (bech32m encoded)
4186
+ * Format: arkadecash1... / tarkadecash1... (bech32m encoded)
4371
4187
  * Payload: version (1 byte) + private key (32 bytes) + server pubkey (32 bytes) + csv timelock sequence (4 bytes)
4372
4188
  */
4373
4189
  declare class ArkadeCash {
4374
4190
  readonly csvTimelock: RelativeTimelock;
4375
4191
  readonly hrp: string;
4376
4192
  static readonly DefaultHRP = "arkadecash";
4193
+ /** The only prefixes minted or accepted: mainnet and test networks. */
4194
+ static readonly HRPs: readonly string[];
4377
4195
  static readonly Version = 0;
4378
4196
  static readonly PayloadLength: number;
4379
4197
  private readonly _privateKey;
@@ -4394,82 +4212,6 @@ declare class ArkadeCash {
4394
4212
  address(addressHrp: string): ArkAddress;
4395
4213
  }
4396
4214
 
4397
- /**
4398
- * Emulator REST client.
4399
- *
4400
- * The emulator is a signing service that executes Arkade scripts
4401
- * and co-signs transactions when the scripts pass validation.
4402
- *
4403
- * The read here goes through `baseFetch`, the SDK's shared fetch boundary, so
4404
- * it picks up whatever policy that boundary carries. The four submit calls
4405
- * deliberately do not: aborting a submit would not tell the caller whether the
4406
- * emulator signed, and none of them has a way to find out, so they stay on the
4407
- * global `fetch` with their transport-error type unchanged.
4408
- */
4409
-
4410
- interface EmulatorInfo {
4411
- signerPubkey: string;
4412
- }
4413
- interface EmulatorProvider {
4414
- getInfo(): Promise<EmulatorInfo>;
4415
- submitTx(arkTx: string, checkpointTxs: string[]): Promise<{
4416
- signedArkTx: string;
4417
- signedCheckpointTxs: string[];
4418
- }>;
4419
- submitIntent(intent: {
4420
- proof: string;
4421
- message: Intent.RegisterMessage;
4422
- }): Promise<string>;
4423
- submitFinalization(intent: {
4424
- proof: string;
4425
- message: Intent.RegisterMessage;
4426
- }, forfeits: string[], connectorTree: ConnectorTreeNode[] | null, commitmentTx: string): Promise<{
4427
- signedForfeits: string[];
4428
- signedCommitmentTx?: string;
4429
- }>;
4430
- submitOnchainTx(tx: string): Promise<{
4431
- signedTx: string;
4432
- }>;
4433
- }
4434
- interface ConnectorTreeNode {
4435
- txid: string;
4436
- tx: string;
4437
- children: Record<string, string>;
4438
- }
4439
- /**
4440
- * REST-based emulator client.
4441
- *
4442
- * @example
4443
- * ```typescript
4444
- * const client = new RestEmulatorProvider('http://localhost:7073');
4445
- * const info = await client.getInfo();
4446
- * console.log('Emulator pubkey:', info.signerPubkey);
4447
- * ```
4448
- */
4449
- declare class RestEmulatorProvider implements EmulatorProvider {
4450
- serverUrl: string;
4451
- constructor(serverUrl: string);
4452
- getInfo(): Promise<EmulatorInfo>;
4453
- submitTx(arkTx: string, checkpointTxs: string[]): Promise<{
4454
- signedArkTx: string;
4455
- signedCheckpointTxs: string[];
4456
- }>;
4457
- submitIntent(intent: {
4458
- proof: string;
4459
- message: Intent.RegisterMessage;
4460
- }): Promise<string>;
4461
- submitFinalization(intent: {
4462
- proof: string;
4463
- message: Intent.RegisterMessage;
4464
- }, forfeits: string[], connectorTree: ConnectorTreeNode[] | null, commitmentTx: string): Promise<{
4465
- signedForfeits: string[];
4466
- signedCommitmentTx?: string;
4467
- }>;
4468
- submitOnchainTx(tx: string): Promise<{
4469
- signedTx: string;
4470
- }>;
4471
- }
4472
-
4473
4215
  /**
4474
4216
  * Arkade Batch Handler
4475
4217
  *
@@ -5025,16 +4767,18 @@ declare const UnilateralExit: {
5025
4767
  *
5026
4768
  * Everything else (4xx, invalid JSON, schema violations, network mismatch,
5027
4769
  * unsupported network) is terminal and returns `false`.
5028
- *
5029
- * NOTE (Step 2, Scope 2): this classifies the errors currently produced by the
5030
- * boot-critical `getInfo` path. Normalizing the indexer's per-branch
5031
- * `!res.ok` throws and the remaining Ark RPC methods into
5032
- * {@link ProviderUnavailableError} is the broader Scope-2 work still pending.
5033
4770
  */
5034
4771
  declare function isRetryableProviderError(error: unknown): boolean;
5035
4772
 
4773
+ /** Raised only before provider submission, so callers can release an unsent reservation. */
4774
+ declare class SendDeadlineExceededError extends Error {
4775
+ constructor(validUntil: number);
4776
+ }
4777
+ declare function captureSendDeadline(value: unknown, required?: boolean): number | undefined;
4778
+ declare function assertSendDeadline(validUntil?: number): void;
4779
+
5036
4780
  declare function validateConnectorsTxGraph(settlementTxB64: string, connectorsGraph: TxTree): void;
5037
- declare function validateVtxoTxGraph(graph: TxTree, roundTransaction: Transaction$2, sweepTapTreeRoot: Uint8Array): void;
4781
+ declare function validateVtxoTxGraph(graph: TxTree, roundTransaction: Transaction, sweepTapTreeRoot: Uint8Array): void;
5038
4782
 
5039
4783
  /**
5040
4784
  * Assert the commitment tx received at batch finalization is the one validated
@@ -5067,6 +4811,19 @@ declare function assertFinalCommitmentMatchesValidated(finalCommitmentTx: Transa
5067
4811
  */
5068
4812
  declare function validateBatchRecipients(commitmentTx: Transaction, vtxoTreeLeaves: Transaction[], recipients: Recipient[], network: Network): void;
5069
4813
 
4814
+ /**
4815
+ * Decode and validate a server-supplied `checkpointTapscript`.
4816
+ *
4817
+ * Every offchain send/claim builds its checkpoint outputs' server-claim leaf from this script, so
4818
+ * a sub-floor or wrong-pubkey value lets the operator sweep an in-flight checkpoint before it
4819
+ * settles. This is the sole gate: callers must use the returned script, not decode their own.
4820
+ *
4821
+ * @throws {ServerResponseMismatchError} if the script fails to decode, its
4822
+ * timelock is out of policy, or its pubkey does not match
4823
+ * `advertisedForfeitPubkey` (when set).
4824
+ */
4825
+ declare function assertValidServerUnrollScript(checkpointTapscript: string, network: Network, advertisedForfeitPubkey?: Bytes): CSVMultisigTapscript.Type;
4826
+
5070
4827
  /**
5071
4828
  * Build a forfeit transaction that spends the provided inputs to a single forfeit output.
5072
4829
  *
@@ -5175,14 +4932,16 @@ declare class Extension {
5175
4932
  /**
5176
4933
  * Arkade Script Opcodes
5177
4934
  *
5178
- * This module defines ONLY Arkade-specific opcodes (0xb3, 0xc3-0xf6).
4935
+ * This module defines ONLY Arkade-specific opcodes (0xb3, 0xbb, 0xc3-0xf8).
5179
4936
  * Standard Bitcoin opcodes are imported from @scure/btc-signer.
5180
4937
  *
5181
- * Reference: arkade-os/emulator v0.0.4 pkg/arkade/opcode.go
4938
+ * Reference: arkade-os/emulator pkg/arkade/opcode.go.
4939
+ * Byte 0xdc is OP_CHECKTIME, matching emulator v0.0.8 and compiler artifacts.
5182
4940
  */
5183
4941
 
5184
4942
  declare const ARKADE_OP: {
5185
4943
  readonly MERKLEBRANCHVERIFY: 179;
4944
+ readonly PUT: 187;
5186
4945
  readonly DIGEST: 195;
5187
4946
  readonly SHA256INITIALIZE: 196;
5188
4947
  readonly SHA256UPDATE: 197;
@@ -5206,6 +4965,8 @@ declare const ARKADE_OP: {
5206
4965
  readonly BIN2NUM: 216;
5207
4966
  readonly REVERSEBYTES: 217;
5208
4967
  readonly MODEXP: 218;
4968
+ readonly PUSHEXPIRY: 219;
4969
+ readonly CHECKTIME: 220;
5209
4970
  readonly ECADD: 224;
5210
4971
  readonly ECMUL: 225;
5211
4972
  readonly ECPAIRING: 226;
@@ -5229,6 +4990,8 @@ declare const ARKADE_OP: {
5229
4990
  readonly INSPECTPACKET: 244;
5230
4991
  readonly INSPECTINPUTPACKET: 245;
5231
4992
  readonly SIGHASH: 246;
4993
+ readonly TUNNEL: 247;
4994
+ readonly INSPECTINTENTMESSAGE: 248;
5232
4995
  };
5233
4996
  declare const ARKADE_OPCODES: number[];
5234
4997
  declare const ARKADE_OPCODE_NAMES: Record<number, string>;
@@ -5277,6 +5040,7 @@ declare function getOpcodeValue(name: string): number | undefined;
5277
5040
  */
5278
5041
  declare const ARKADE_OPS: {
5279
5042
  readonly MERKLEBRANCHVERIFY: 179;
5043
+ readonly PUT: 187;
5280
5044
  readonly DIGEST: 195;
5281
5045
  readonly SHA256INITIALIZE: 196;
5282
5046
  readonly SHA256UPDATE: 197;
@@ -5300,6 +5064,8 @@ declare const ARKADE_OPS: {
5300
5064
  readonly BIN2NUM: 216;
5301
5065
  readonly REVERSEBYTES: 217;
5302
5066
  readonly MODEXP: 218;
5067
+ readonly PUSHEXPIRY: 219;
5068
+ readonly CHECKTIME: 220;
5303
5069
  readonly ECADD: 224;
5304
5070
  readonly ECMUL: 225;
5305
5071
  readonly ECPAIRING: 226;
@@ -5323,119 +5089,121 @@ declare const ARKADE_OPS: {
5323
5089
  readonly INSPECTPACKET: 244;
5324
5090
  readonly INSPECTINPUTPACKET: 245;
5325
5091
  readonly SIGHASH: 246;
5326
- readonly OP_0: number;
5327
- readonly PUSHDATA1: number;
5328
- readonly PUSHDATA2: number;
5329
- readonly PUSHDATA4: number;
5330
- readonly '1NEGATE': number;
5331
- readonly RESERVED: number;
5332
- readonly OP_1: number;
5333
- readonly OP_2: number;
5334
- readonly OP_3: number;
5335
- readonly OP_4: number;
5336
- readonly OP_5: number;
5337
- readonly OP_6: number;
5338
- readonly OP_7: number;
5339
- readonly OP_8: number;
5340
- readonly OP_9: number;
5341
- readonly OP_10: number;
5342
- readonly OP_11: number;
5343
- readonly OP_12: number;
5344
- readonly OP_13: number;
5345
- readonly OP_14: number;
5346
- readonly OP_15: number;
5347
- readonly OP_16: number;
5348
- readonly NOP: number;
5349
- readonly VER: number;
5350
- readonly IF: number;
5351
- readonly NOTIF: number;
5352
- readonly VERIF: number;
5353
- readonly VERNOTIF: number;
5354
- readonly ELSE: number;
5355
- readonly ENDIF: number;
5356
- readonly VERIFY: number;
5357
- readonly RETURN: number;
5358
- readonly TOALTSTACK: number;
5359
- readonly FROMALTSTACK: number;
5360
- readonly '2DROP': number;
5361
- readonly '2DUP': number;
5362
- readonly '3DUP': number;
5363
- readonly '2OVER': number;
5364
- readonly '2ROT': number;
5365
- readonly '2SWAP': number;
5366
- readonly IFDUP: number;
5367
- readonly DEPTH: number;
5368
- readonly DROP: number;
5369
- readonly DUP: number;
5370
- readonly NIP: number;
5371
- readonly OVER: number;
5372
- readonly PICK: number;
5373
- readonly ROLL: number;
5374
- readonly ROT: number;
5375
- readonly SWAP: number;
5376
- readonly TUCK: number;
5377
- readonly CAT: number;
5378
- readonly SUBSTR: number;
5379
- readonly LEFT: number;
5380
- readonly RIGHT: number;
5381
- readonly SIZE: number;
5382
- readonly INVERT: number;
5383
- readonly AND: number;
5384
- readonly OR: number;
5385
- readonly XOR: number;
5386
- readonly EQUAL: number;
5387
- readonly EQUALVERIFY: number;
5388
- readonly RESERVED1: number;
5389
- readonly RESERVED2: number;
5390
- readonly '1ADD': number;
5391
- readonly '1SUB': number;
5392
- readonly '2MUL': number;
5393
- readonly '2DIV': number;
5394
- readonly NEGATE: number;
5395
- readonly ABS: number;
5396
- readonly NOT: number;
5397
- readonly '0NOTEQUAL': number;
5398
- readonly ADD: number;
5399
- readonly SUB: number;
5400
- readonly MUL: number;
5401
- readonly DIV: number;
5402
- readonly MOD: number;
5403
- readonly LSHIFT: number;
5404
- readonly RSHIFT: number;
5405
- readonly BOOLAND: number;
5406
- readonly BOOLOR: number;
5407
- readonly NUMEQUAL: number;
5408
- readonly NUMEQUALVERIFY: number;
5409
- readonly NUMNOTEQUAL: number;
5410
- readonly LESSTHAN: number;
5411
- readonly GREATERTHAN: number;
5412
- readonly LESSTHANOREQUAL: number;
5413
- readonly GREATERTHANOREQUAL: number;
5414
- readonly MIN: number;
5415
- readonly MAX: number;
5416
- readonly WITHIN: number;
5417
- readonly RIPEMD160: number;
5418
- readonly SHA1: number;
5419
- readonly SHA256: number;
5420
- readonly HASH160: number;
5421
- readonly HASH256: number;
5422
- readonly CODESEPARATOR: number;
5423
- readonly CHECKSIG: number;
5424
- readonly CHECKSIGVERIFY: number;
5425
- readonly CHECKMULTISIG: number;
5426
- readonly CHECKMULTISIGVERIFY: number;
5427
- readonly NOP1: number;
5428
- readonly CHECKLOCKTIMEVERIFY: number;
5429
- readonly CHECKSEQUENCEVERIFY: number;
5430
- readonly NOP4: number;
5431
- readonly NOP5: number;
5432
- readonly NOP6: number;
5433
- readonly NOP7: number;
5434
- readonly NOP8: number;
5435
- readonly NOP9: number;
5436
- readonly NOP10: number;
5437
- readonly CHECKSIGADD: number;
5438
- readonly INVALID: number;
5092
+ readonly TUNNEL: 247;
5093
+ readonly INSPECTINTENTMESSAGE: 248;
5094
+ readonly OP_0: 0;
5095
+ readonly PUSHDATA1: 76;
5096
+ readonly PUSHDATA2: 77;
5097
+ readonly PUSHDATA4: 78;
5098
+ readonly '1NEGATE': 79;
5099
+ readonly RESERVED: 80;
5100
+ readonly OP_1: 81;
5101
+ readonly OP_2: 82;
5102
+ readonly OP_3: 83;
5103
+ readonly OP_4: 84;
5104
+ readonly OP_5: 85;
5105
+ readonly OP_6: 86;
5106
+ readonly OP_7: 87;
5107
+ readonly OP_8: 88;
5108
+ readonly OP_9: 89;
5109
+ readonly OP_10: 90;
5110
+ readonly OP_11: 91;
5111
+ readonly OP_12: 92;
5112
+ readonly OP_13: 93;
5113
+ readonly OP_14: 94;
5114
+ readonly OP_15: 95;
5115
+ readonly OP_16: 96;
5116
+ readonly NOP: 97;
5117
+ readonly VER: 98;
5118
+ readonly IF: 99;
5119
+ readonly NOTIF: 100;
5120
+ readonly VERIF: 101;
5121
+ readonly VERNOTIF: 102;
5122
+ readonly ELSE: 103;
5123
+ readonly ENDIF: 104;
5124
+ readonly VERIFY: 105;
5125
+ readonly RETURN: 106;
5126
+ readonly TOALTSTACK: 107;
5127
+ readonly FROMALTSTACK: 108;
5128
+ readonly '2DROP': 109;
5129
+ readonly '2DUP': 110;
5130
+ readonly '3DUP': 111;
5131
+ readonly '2OVER': 112;
5132
+ readonly '2ROT': 113;
5133
+ readonly '2SWAP': 114;
5134
+ readonly IFDUP: 115;
5135
+ readonly DEPTH: 116;
5136
+ readonly DROP: 117;
5137
+ readonly DUP: 118;
5138
+ readonly NIP: 119;
5139
+ readonly OVER: 120;
5140
+ readonly PICK: 121;
5141
+ readonly ROLL: 122;
5142
+ readonly ROT: 123;
5143
+ readonly SWAP: 124;
5144
+ readonly TUCK: 125;
5145
+ readonly CAT: 126;
5146
+ readonly SUBSTR: 127;
5147
+ readonly LEFT: 128;
5148
+ readonly RIGHT: 129;
5149
+ readonly SIZE: 130;
5150
+ readonly INVERT: 131;
5151
+ readonly AND: 132;
5152
+ readonly OR: 133;
5153
+ readonly XOR: 134;
5154
+ readonly EQUAL: 135;
5155
+ readonly EQUALVERIFY: 136;
5156
+ readonly RESERVED1: 137;
5157
+ readonly RESERVED2: 138;
5158
+ readonly '1ADD': 139;
5159
+ readonly '1SUB': 140;
5160
+ readonly '2MUL': 141;
5161
+ readonly '2DIV': 142;
5162
+ readonly NEGATE: 143;
5163
+ readonly ABS: 144;
5164
+ readonly NOT: 145;
5165
+ readonly '0NOTEQUAL': 146;
5166
+ readonly ADD: 147;
5167
+ readonly SUB: 148;
5168
+ readonly MUL: 149;
5169
+ readonly DIV: 150;
5170
+ readonly MOD: 151;
5171
+ readonly LSHIFT: 152;
5172
+ readonly RSHIFT: 153;
5173
+ readonly BOOLAND: 154;
5174
+ readonly BOOLOR: 155;
5175
+ readonly NUMEQUAL: 156;
5176
+ readonly NUMEQUALVERIFY: 157;
5177
+ readonly NUMNOTEQUAL: 158;
5178
+ readonly LESSTHAN: 159;
5179
+ readonly GREATERTHAN: 160;
5180
+ readonly LESSTHANOREQUAL: 161;
5181
+ readonly GREATERTHANOREQUAL: 162;
5182
+ readonly MIN: 163;
5183
+ readonly MAX: 164;
5184
+ readonly WITHIN: 165;
5185
+ readonly RIPEMD160: 166;
5186
+ readonly SHA1: 167;
5187
+ readonly SHA256: 168;
5188
+ readonly HASH160: 169;
5189
+ readonly HASH256: 170;
5190
+ readonly CODESEPARATOR: 171;
5191
+ readonly CHECKSIG: 172;
5192
+ readonly CHECKSIGVERIFY: 173;
5193
+ readonly CHECKMULTISIG: 174;
5194
+ readonly CHECKMULTISIGVERIFY: 175;
5195
+ readonly NOP1: 176;
5196
+ readonly CHECKLOCKTIMEVERIFY: 177;
5197
+ readonly CHECKSEQUENCEVERIFY: 178;
5198
+ readonly NOP4: 179;
5199
+ readonly NOP5: 180;
5200
+ readonly NOP6: 181;
5201
+ readonly NOP7: 182;
5202
+ readonly NOP8: 183;
5203
+ readonly NOP9: 184;
5204
+ readonly NOP10: 185;
5205
+ readonly CHECKSIGADD: 186;
5206
+ readonly INVALID: 255;
5439
5207
  };
5440
5208
  /** A single script operation: opcode string key, raw bytes, number, or bigint */
5441
5209
  type ArkadeScriptOP = keyof typeof ARKADE_OPS | Uint8Array | number | bigint;
@@ -5557,53 +5325,80 @@ declare namespace bignum {
5557
5325
  export { bignum_BIGNUM_MAX_BYTES as BIGNUM_MAX_BYTES, bignum_decode as decode, bignum_encode as encode };
5558
5326
  }
5559
5327
 
5328
+ /**
5329
+ * Read the JSON `arkadec` writes into a {@link Program}: `$param` placeholders,
5330
+ * @scure opcode names, and one structured tapleaf per compiler leaf.
5331
+ */
5332
+
5333
+ interface ArtifactParameter {
5334
+ name: string;
5335
+ type: string;
5336
+ }
5337
+ interface ArtifactStruct {
5338
+ name: string;
5339
+ fields: ArtifactParameter[];
5340
+ }
5341
+ interface ArtifactWitnessElement {
5342
+ name: string;
5343
+ type: string;
5344
+ encoding?: string;
5345
+ injected?: boolean;
5346
+ }
5347
+ interface ArtifactLeaf {
5348
+ name: string;
5349
+ witness?: ArtifactWitnessElement[];
5350
+ asm: string[];
5351
+ }
5352
+ interface ArtifactCovenant {
5353
+ inputs: ArtifactParameter[];
5354
+ asm: string[];
5355
+ }
5356
+ interface ArtifactGroup {
5357
+ name: string;
5358
+ arkade?: ArtifactCovenant;
5359
+ leaves: ArtifactLeaf[];
5360
+ }
5361
+ interface ContractArtifact {
5362
+ formatVersion?: number;
5363
+ contractName: string;
5364
+ constructorInputs: ArtifactParameter[];
5365
+ structs?: ArtifactStruct[];
5366
+ functions: ArtifactGroup[];
5367
+ }
5368
+ /** `true` when `value` is an arkadec artifact rather than a Program. */
5369
+ declare function isContractArtifact(value: unknown): value is ContractArtifact;
5370
+ /** Adds `server`, and one param per child-output placeholder for the caller to bind to that output key. */
5371
+ declare function programFromArtifact(artifact: ContractArtifact): Program;
5372
+
5560
5373
  /**
5561
5374
  * Arkade Contract — artifact-driven, high-level covenant API.
5562
5375
  *
5563
- * Implements the Arkade contract model: a contract is a {@link Program} (a set of
5564
- * named functions, each split into a `tapscript` segment enforced on-chain and an
5565
- * `arkadeScript` segment emulated by the co-signing service). The same JS object
5566
- * shape mirrors the compiler artifact, so a hand-written program today and the
5567
- * compiler's JSON output later flow through the identical resolver.
5568
- *
5569
- * The SDK never interprets scripts: it resolves `$param` placeholders into bytes,
5570
- * builds the taproot tree (resolving `$param` signers such as `$server`/`$user` from
5571
- * the constructor args, plus the co-signer key tweaked by the arkade-script hash),
5572
- * and assembles the spend from the per-segment witness layout. All key tweaking,
5573
- * packet encoding and PSBT plumbing is internal — from the caller's side it is just
5574
- * Arkade.
5575
- *
5576
- * Program → script compilation lives in {@link ArkadeProgramScript}
5577
- * (./program.ts) and is shared with the generic `"arkade"` contract handler,
5578
- * so a contract created here can be persisted, watched and re-derived through
5579
- * the standard `src/contracts` pipeline: pass a `contractManager` to
5580
- * {@link Arkade.connect} and call {@link ArkadeContract.register}.
5581
- *
5582
- * Contract functions are strongly typed from the program's literal shape: a
5583
- * function declaring `inputs: [{ name: "preimage", type: "bytes" }]` produces a
5584
- * `functions.claim(preimage: Uint8Array)` call signature. The type flows through
5585
- * `arkade.contract(...)` automatically for inline literals; for a program stored
5586
- * in a variable, annotate it with `satisfies Program` to preserve the literal
5587
- * type (a plain `: Program` annotation would widen it away).
5588
- *
5589
- * Constructor `params` follow the same convention: bare name strings are
5590
- * documentation only, while typed descriptors `{ name, type }` (the form the
5591
- * ArkadeScript compiler emits) make the list authoritative — every declared
5592
- * param must be bound, every `$name` reference must be declared, and bound
5593
- * values are validated against their type at compilation.
5594
- *
5595
- * A covenant spend needs an `indexer`, not just an `emulator`: the co-signing
5596
- * service resolves each input's prevout pkScript from the previous ark tx the
5597
- * PSBT carries, and only the indexer can supply those bytes. Pure tapscript
5598
- * spends go straight to arkd and need neither.
5376
+ * A contract is a {@link Program}: named functions, each split into a `tapscript` segment
5377
+ * enforced on-chain and an `arkadeScript` segment emulated by the co-signing service. Compiler
5378
+ * artifacts are normalized into this model, sharing the resolver with hand-written programs.
5379
+ * The SDK never interprets scripts; it resolves `$param` placeholders and signers, builds the
5380
+ * taproot tree (co-signer key tweaked by the arkade-script hash) and assembles the spend.
5381
+ *
5382
+ * Compilation lives in {@link ArkadeProgramScript} and is shared with the `"arkade"` contract
5383
+ * handler: pass a `contractManager` to {@link Arkade.connect} and call
5384
+ * {@link ArkadeContract.register} to persist and watch a contract.
5385
+ *
5386
+ * Functions are typed from the program's literal shape (`inputs: [{ name: "preimage", type:
5387
+ * "bytes" }]` → `functions.claim(preimage: Uint8Array)`). For a program stored in a variable use
5388
+ * `satisfies Program`; a `: Program` annotation widens the literal type away. Typed `params`
5389
+ * descriptors `{ name, type }` make the list authoritative (every param bound, every `$name`
5390
+ * declared, values type-checked).
5391
+ *
5392
+ * A covenant spend needs an `indexer` as well as an `emulator`: the co-signer resolves each
5393
+ * input's prevout from the previous ark tx the PSBT carries. Pure tapscript spends need neither.
5599
5394
  *
5600
5395
  * @example
5601
5396
  * ```typescript
5602
5397
  * const htlcProgram = {
5603
- * version: 0,
5398
+ * version: 1,
5604
5399
  * name: "htlc", // metadata only — round-tripped, never compiled
5605
5400
  * params: [
5606
- * { name: "hash", type: "hash" },
5401
+ * { name: "hash", type: "bytes20" },
5607
5402
  * { name: "receiver", type: "pubkey" },
5608
5403
  * { name: "amount", type: "int" },
5609
5404
  * { name: "server", type: "pubkey" },
@@ -5627,21 +5422,17 @@ declare namespace bignum {
5627
5422
  * @module arkade/contract
5628
5423
  */
5629
5424
 
5630
- /** The TS type of a single call argument, derived from its {@link InputRef}. */
5631
- type ArgTsType<R> = R extends InputDef ? ArkadeValueType[R["type"]] : ArkadeArgValue;
5632
5425
  /** The argument tuple of a function, derived from its declared `inputs`. */
5633
- type ArgsTuple<I extends readonly InputRef[]> = {
5634
- [K in keyof I]: ArgTsType<I[K]>;
5426
+ type ArgsTuple<I extends readonly InputDef[]> = {
5427
+ [K in keyof I]: ArkadeValueType[I[K]["type"]];
5635
5428
  };
5636
5429
  /** The call signature arguments for one function (nullary when `inputs` is absent). */
5637
5430
  type FnArgs<F extends ArkadeFunction> = F extends {
5638
- inputs: infer I extends readonly InputRef[];
5431
+ inputs: infer I extends readonly InputDef[];
5639
5432
  } ? ArgsTuple<I> : [];
5640
5433
  /**
5641
- * The statically-typed `functions` map of a contract. When the program is a
5642
- * concrete literal (specific function names), each entry is precisely typed from
5643
- * its `inputs`. When the program is the widened {@link Program} (an index
5644
- * signature), it falls back to the loose {@link CallableFunctions}.
5434
+ * The statically-typed `functions` map of a contract: precisely typed per function for a literal
5435
+ * program, the loose {@link CallableFunctions} for the widened {@link Program}.
5645
5436
  */
5646
5437
  type ContractFunctions<P extends Program> = string extends keyof P["functions"] ? CallableFunctions : {
5647
5438
  [K in keyof P["functions"]]: (...args: FnArgs<P["functions"][K]>) => ArkadeTransactionBuilder;
@@ -5652,13 +5443,9 @@ interface Utxo {
5652
5443
  vout: number;
5653
5444
  value: number;
5654
5445
  /**
5655
- * Raw wire bytes of the ark transaction that created this VTXO, attached as
5656
- * the PrevArkTx field on input 0.
5657
- *
5658
- * An override, not the only channel: covenant spends resolve the previous
5659
- * tx of every input through the client's indexer. Supply it when the tx is
5660
- * not yet indexable — a recursive covenant spending the output of an ark tx
5661
- * the caller just built — and the resolved value is suppressed for input 0.
5446
+ * Raw bytes of the ark tx that created this VTXO, attached as input 0's PrevArkTx. Overrides
5447
+ * the indexer-resolved value; supply it when the tx isn't indexable yet (a recursive covenant
5448
+ * spending an ark tx the caller just built).
5662
5449
  */
5663
5450
  sourceTx?: Uint8Array;
5664
5451
  }
@@ -5694,33 +5481,64 @@ interface ArkadeSpendResult {
5694
5481
  }
5695
5482
  /** The callable spending paths of a contract. */
5696
5483
  type CallableFunctions = Record<string, (...args: ArkadeArgValue[]) => ArkadeTransactionBuilder>;
5697
- /**
5698
- * What {@link Arkade} needs from the Arkade server.
5699
- *
5700
- * Only `getInfo` is required — see {@link ArkadeConnectOptions.arkade} for why.
5701
- * Named so a caller building a derivation-only client has a type to import
5702
- * rather than reaching into the options bag.
5703
- */
5484
+ /** What {@link Arkade} needs from the Arkade server; see {@link ArkadeConnectOptions.arkade}. */
5704
5485
  type ArkadeServerProvider = Pick<ArkProvider, "getInfo"> & Partial<ArkadeBroadcaster>;
5705
- /** Options for {@link Arkade.connect}. */
5706
- interface ArkadeConnectOptions {
5486
+ /** Fields shared by both forms of {@link ArkadeConnectOptions}. */
5487
+ interface ArkadeConnectCommonOptions {
5488
+ /** Signer for paths that require a user signature; optional for watch-only. */
5489
+ identity?: Identity;
5490
+ /**
5491
+ * Network for address derivation. Defaults to the network the server
5492
+ * reports on `getInfo` — or the SDK default when the server names none.
5493
+ */
5494
+ network?: Network;
5707
5495
  /**
5708
- * The Arkade server provider.
5496
+ * Co-sign with this emulator key (33-byte compressed hex) instead of the one pinned for
5497
+ * `network`. Needed after a key rotation ahead of this SDK, for a self-hosted emulator, or on
5498
+ * networks with no pinned key (signet, testnet, a hand-built `Network` — those throw without
5499
+ * it). Setting it means trusting that operator as co-signer.
5709
5500
  *
5710
- * Only `getInfo` is required: it is what resolves the server key and
5711
- * checkpoint closure, and it is all a client needs to derive, register and
5712
- * inspect contracts. `submitTx`/`finalizeTx` are needed solely to
5713
- * broadcast, so a client built without them throws at `.send()` — the same
5714
- * deferred, explicit failure an absent `indexer` gives `getUtxos()` and an
5715
- * absent `emulator` gives a covenant spend. That lets a caller that already
5716
- * holds the server info (`wallet.getArkadeInfo()`) connect without a
5717
- * provider of its own, and without a second `/v1/info` round-trip.
5501
+ * @see resolveEmulatorPubkey
5502
+ */
5503
+ emulatorPubkey?: string;
5504
+ /**
5505
+ * The wallet's contract manager (`wallet.getContractManager()`). Enables
5506
+ * {@link ArkadeContract.register} and {@link ArkadeContract.on}, and makes
5507
+ * {@link ArkadeContract.getUtxos} read repository-backed state for registered contracts
5508
+ * instead of the indexer. Never disposed by {@link Arkade.dispose}.
5509
+ */
5510
+ contractManager?: IContractManager;
5511
+ }
5512
+ /**
5513
+ * The one-liner form: name the deployment, and `connect` resolves the providers (and, for
5514
+ * `{ network: "bitcoin" }`, the emulator).
5515
+ */
5516
+ interface ArkadeConnectServiceOptions extends ArkadeConnectCommonOptions {
5517
+ service: ArkadeService;
5518
+ /**
5519
+ * Persist contracts here. The client builds and owns a contract manager over it (with an
5520
+ * in-memory VTXO store), enabling {@link ArkadeContract.register} and
5521
+ * {@link ArkadeContract.on}; {@link Arkade.dispose} stops it. Exclusive with
5522
+ * `contractManager`. Deliberately narrower than the wallet's `StorageConfig`.
5523
+ */
5524
+ storage?: {
5525
+ contractRepository: ContractRepository;
5526
+ };
5527
+ arkade?: never;
5528
+ emulator?: never;
5529
+ indexer?: never;
5530
+ }
5531
+ /** The provider form: hand over providers you already hold (e.g. a wallet's). */
5532
+ interface ArkadeConnectProviderOptions extends ArkadeConnectCommonOptions {
5533
+ /**
5534
+ * The Arkade server provider. Only `getInfo` is required (enough to derive, register and
5535
+ * inspect contracts); without `submitTx`/`finalizeTx`, `.send()` throws. So a caller already
5536
+ * holding `wallet.getArkadeInfo()` can connect without a second `/v1/info` round-trip.
5718
5537
  */
5719
5538
  arkade: ArkadeServerProvider;
5720
5539
  /**
5721
- * The co-signing (introspector/emulator) service. Optional: only required for
5722
- * contracts whose functions have an `arkadeScript` (covenant paths). Pure
5723
- * tapscript contracts (multisig/timelock/hashlock) don't need it.
5540
+ * The co-signing (introspector/emulator) service. Required only for functions with an
5541
+ * `arkadeScript` (covenant paths).
5724
5542
  */
5725
5543
  emulator?: EmulatorProvider;
5726
5544
  /**
@@ -5729,36 +5547,31 @@ interface ArkadeConnectOptions {
5729
5547
  * {@link attachPrevArkTxs}). Required for covenant spends.
5730
5548
  */
5731
5549
  indexer?: Pick<IndexerProvider, "getVtxos" | "getVirtualTxs">;
5732
- /** Signer for paths that require a user signature; optional for watch-only. */
5733
- identity?: Identity;
5734
- /** Network for address derivation; defaults to the SDK default. */
5735
- network?: Network;
5736
- /**
5737
- * Co-sign with this emulator key (33-byte compressed hex) instead of the
5738
- * one pinned for `network`.
5739
- *
5740
- * Needed when a network's emulator key has rotated ahead of this SDK, for a
5741
- * self-hosted emulator, or on a network with no pinned key at all (signet,
5742
- * testnet, a hand-built `Network` — those throw without it). Setting it
5743
- * means trusting that operator as co-signer in place of the network's.
5744
- *
5745
- * @see resolveEmulatorPubkey
5746
- */
5747
- emulatorPubkey?: string;
5748
- /**
5749
- * The wallet's contract manager. When set, contracts created from this
5750
- * client can {@link ArkadeContract.register} themselves into the standard
5751
- * contract pipeline (persistence, watching, events), and
5752
- * {@link ArkadeContract.getUtxos} reads repository-backed state
5753
- * (offline-first) for registered contracts instead of querying the
5754
- * indexer directly. Obtain it via `wallet.getContractManager()`.
5755
- */
5756
- contractManager?: IContractManager;
5550
+ service?: never;
5551
+ storage?: never;
5552
+ }
5553
+ /** Options for {@link Arkade.connect}: `service` and `arkade` are exclusive. */
5554
+ type ArkadeConnectOptions = ArkadeConnectServiceOptions | ArkadeConnectProviderOptions;
5555
+ /** Event types {@link ArkadeContract.on} reports. */
5556
+ type ArkadeContractEventType = "vtxo_received" | "vtxo_spent" | "connection_reset";
5557
+ /** The event an {@link ArkadeContract.on} handle of type `T` receives. */
5558
+ type ArkadeContractEvent<T extends ArkadeContractEventType = ArkadeContractEventType> = T extends "connection_reset" ? Extract<ContractEvent, {
5559
+ type: "connection_reset";
5560
+ }> : Extract<ContractVtxoEvent, {
5561
+ type: T;
5562
+ }>;
5563
+ /** Returned by {@link ArkadeContract.on}. */
5564
+ interface ArkadeContractSubscription {
5565
+ /** Stop delivery to this handle. Idempotent. */
5566
+ off(): void;
5757
5567
  }
5568
+ type EventHandle = {
5569
+ type: ArkadeContractEventType;
5570
+ callback: (event: ArkadeContractEvent) => void | Promise<void>;
5571
+ };
5758
5572
  /**
5759
- * A connected Arkade client. Holds the providers/identity/network and the
5760
- * resolved network constants (server key, co-signer key, checkpoint closure),
5761
- * so spinning up contracts is synchronous.
5573
+ * A connected Arkade client holding the providers and resolved network constants (server key,
5574
+ * co-signer key, checkpoint closure), so creating contracts is synchronous.
5762
5575
  */
5763
5576
  declare class Arkade {
5764
5577
  readonly arkProvider: ArkadeServerProvider;
@@ -5766,15 +5579,13 @@ declare class Arkade {
5766
5579
  readonly emulator: EmulatorProvider | undefined;
5767
5580
  readonly network: Network;
5768
5581
  readonly serverKey: Uint8Array;
5582
+ /** Bare protocol delay (blocks below 512, seconds otherwise), resolved only when needed. */
5583
+ readonly serverExitDelay?: bigint;
5769
5584
  /**
5770
- * The co-signer key covenants are built against (33-byte compressed),
5771
- * present only when an emulator is configured.
5772
- *
5773
- * Resolved from the network — or from `emulatorPubkey` — never from the
5774
- * emulator's own report. When a claim is refused because the co-signer
5775
- * disagrees, compare `hex.encode(arkade.emulatorKey)` against the
5776
- * `signerPubkey` your emulator serves on `/v1/info`: if they differ, the
5777
- * network rotated and this SDK's pin is stale.
5585
+ * The co-signer key covenants are built against (33-byte compressed), present only when an
5586
+ * emulator is configured. Resolved from the network or `emulatorPubkey`, never the emulator's
5587
+ * own report. If a claim is refused, compare it with the emulator's `/v1/info` `signerPubkey`:
5588
+ * a difference means the network rotated and this SDK's pin is stale.
5778
5589
  */
5779
5590
  readonly emulatorKey: Uint8Array | undefined;
5780
5591
  readonly checkpoint: CSVMultisigTapscript.Type;
@@ -5782,20 +5593,46 @@ declare class Arkade {
5782
5593
  readonly identity?: Identity;
5783
5594
  /** The signing identity's x-only public key, resolved at connect — identifies which inputs the wallet signs. */
5784
5595
  readonly userKey?: Uint8Array;
5785
- /** The wallet's contract manager, when contract persistence is wired up. */
5596
+ /** The contract manager, when contract persistence is wired up (passed in or owned). */
5786
5597
  readonly contractManager?: IContractManager;
5598
+ /** Whether {@link connect} built {@link contractManager}, so {@link dispose} must stop it. */
5599
+ private readonly ownsContractManager;
5600
+ /** {@link ArkadeContract.on} handles by contract script (hex). */
5601
+ private readonly handles;
5602
+ /** The single `onContractEvent` subscription fanning out to {@link handles}. */
5603
+ private unsubscribeEvents?;
5604
+ private disposed;
5787
5605
  private constructor();
5788
- /** Connect and resolve the server key, checkpoint closure and (if present) the co-signer key. */
5606
+ /**
5607
+ * Connect and resolve the server key, checkpoint closure and (if present) the co-signer key.
5608
+ *
5609
+ * @example
5610
+ * ```typescript
5611
+ * const arkade = await Arkade.connect({
5612
+ * service: { network: "bitcoin" },
5613
+ * identity,
5614
+ * storage: { contractRepository },
5615
+ * });
5616
+ * ```
5617
+ */
5789
5618
  static connect(opts: ArkadeConnectOptions): Promise<Arkade>;
5790
5619
  /**
5791
- * Instantiate a contract from a program and its constructor arguments. The
5792
- * `program`'s literal type is preserved (`const` inference) so the resulting
5793
- * contract's `functions` map is strongly typed — `functions.<name>(...)`
5794
- * knows each argument's type from the function's `inputs` descriptors.
5620
+ * Stop event delivery to every {@link ArkadeContract.on} handle and, when {@link connect}
5621
+ * built the contract manager (`storage`), dispose it. A caller-passed manager keeps running.
5622
+ */
5623
+ dispose(): void;
5624
+ /**
5625
+ * @internal Add a handle for `script`, subscribing to the manager on first use; the last
5626
+ * handle's `off()` releases the subscription.
5627
+ */
5628
+ addEventHandle(manager: IContractManager, script: string, handle: EventHandle): () => void;
5629
+ private dispatch;
5630
+ /**
5631
+ * Instantiate a contract from a program and its constructor arguments. `const` inference keeps
5632
+ * the program's literal type, so `functions` is strongly typed.
5795
5633
  *
5796
- * When the program declares a `server` or `user` param and the caller does
5797
- * not bind it, it defaults to the client's server key or the identity's
5798
- * key respectively; explicit args always win.
5634
+ * Declared `server`/`user` params default to the client's keys. Compiler
5635
+ * artifacts reserve the server key and exit delay to the connected server.
5799
5636
  */
5800
5637
  contract<const P extends Program>(program: P, args?: Record<string, ArkadeParamValue>): ArkadeContract<P>;
5801
5638
  }
@@ -5814,11 +5651,8 @@ declare class ArkadeContract<P extends Program = Program> {
5814
5651
  private readonly compiled;
5815
5652
  constructor(client: Arkade, program: P, args?: Record<string, ArkadeParamValue>, keys?: ProgramKeys);
5816
5653
  /**
5817
- * Rebuild a callable contract from a persisted `"arkade"` contract row
5818
- * (see {@link ArkadeContract.register}). The stored keys are used for
5819
- * compilation — not the client's current ones — so the derived script and
5820
- * address stay identical to the registered contract even after a server
5821
- * signer rotation.
5654
+ * Rebuild a callable contract from a persisted `"arkade"` row. Compiles with the stored keys,
5655
+ * not the client's current ones, so script and address survive a server signer rotation.
5822
5656
  */
5823
5657
  static fromContract(client: Arkade, contract: Contract): ArkadeContract;
5824
5658
  /** Resolve the {@link TapLeafScript} for a spending path by its index. */
@@ -5827,16 +5661,11 @@ declare class ArkadeContract<P extends Program = Program> {
5827
5661
  get address(): string;
5828
5662
  /** Taproot output script. */
5829
5663
  get pkScript(): Uint8Array;
5830
- /**
5831
- * Callable spending paths: `contract.functions.<name>(...args)`. Strongly
5832
- * typed from the program's literal type — each function's argument types are
5833
- * derived from its `inputs` descriptors (see {@link ContractFunctions}).
5834
- */
5664
+ /** Callable spending paths: `functions.<name>(...args)` (see {@link ContractFunctions}). */
5835
5665
  get functions(): ContractFunctions<P>;
5836
5666
  /**
5837
- * The `createContract` payload for this contract — the serialized program,
5838
- * args and keys plus the derived script/address. Useful when registering
5839
- * through a manager the client does not hold.
5667
+ * The `createContract` payload (serialized program, args, keys, script, address), for
5668
+ * registering through a manager the client does not hold.
5840
5669
  */
5841
5670
  toContractParams(): {
5842
5671
  type: string;
@@ -5845,26 +5674,42 @@ declare class ArkadeContract<P extends Program = Program> {
5845
5674
  address: string;
5846
5675
  };
5847
5676
  /**
5848
- * Persist this contract through the wallet's {@link IContractManager} so it
5849
- * is tracked like any other contract type: stored in the contract
5850
- * repository, watched for VTXO events, counted in repository-backed
5851
- * balances, and re-derivable offline via the `"arkade"` contract handler.
5852
- * Idempotent — re-registering the same script is a no-op.
5677
+ * Persist this contract through the wallet's {@link IContractManager} (stored, watched,
5678
+ * counted in balances, re-derivable via the `"arkade"` handler). Idempotent per script.
5853
5679
  */
5854
5680
  register(options?: {
5855
5681
  label?: string;
5856
5682
  metadata?: Record<string, unknown>;
5857
5683
  }): Promise<Contract>;
5858
5684
  /**
5859
- * Spendable VTXOs locked by this contract.
5685
+ * Report this contract's activity: `vtxo_received`/`vtxo_spent` for its script, and
5686
+ * `connection_reset` when the manager's event stream reconnects. Registers the contract
5687
+ * (idempotent) so it is persisted and watched; requires a contract manager (`storage` or
5688
+ * `contractManager` on {@link Arkade.connect}).
5860
5689
  *
5861
- * When a `contractManager` is configured and this contract is registered,
5862
- * reads the repository-backed state (offline-first, kept fresh by the
5863
- * contract watcher). Otherwise falls back to a direct indexer query.
5690
+ * Activity is reported from subscription on — coins that predate it are not replayed. After
5691
+ * subscribing, and on every `connection_reset` (the manager re-syncs silently), read stored
5692
+ * state with {@link getVtxos}.
5864
5693
  *
5865
- * Both branches refuse a spent or unilaterally exited output. They are not
5866
- * otherwise interchangeable: the fallback asks `spendableOnly`, which also
5867
- * drops swept coins — the manager branch keeps those.
5694
+ * @example
5695
+ * ```typescript
5696
+ * const spent = await htlc.on("vtxo_spent", (e) => console.log(e.vtxos));
5697
+ * const reset = await htlc.on("connection_reset", async () => reconcile(await htlc.getVtxos()));
5698
+ * spent.off();
5699
+ * ```
5700
+ */
5701
+ on<T extends ArkadeContractEventType>(type: T, callback: (event: ArkadeContractEvent<T>) => void | Promise<void>): Promise<ArkadeContractSubscription>;
5702
+ /**
5703
+ * Every stored VTXO of this contract, spent ones included (`getUtxos` hides those), as the
5704
+ * contract manager last synced them. The recovery read for {@link on}. Empty when the
5705
+ * contract is not registered.
5706
+ */
5707
+ getVtxos(): Promise<ExtendedContractVtxo[]>;
5708
+ private requireManager;
5709
+ /**
5710
+ * Spendable VTXOs locked by this contract: repository-backed when registered with a
5711
+ * `contractManager`, otherwise a direct indexer query. Both drop spent and unrolled outputs;
5712
+ * only the indexer branch (`spendableOnly`) also drops swept coins.
5868
5713
  */
5869
5714
  getUtxos(): Promise<VirtualCoin[]>;
5870
5715
  /** Total spendable balance (requires an indexer). */
@@ -5881,6 +5726,7 @@ declare class ArkadeTransactionBuilder {
5881
5726
  private readonly outputs;
5882
5727
  private readonly fundingCoins;
5883
5728
  private readonly assetSpecs;
5729
+ private readonly extraPackets;
5884
5730
  private coin?;
5885
5731
  private changeScript?;
5886
5732
  /** @internal */
@@ -5893,6 +5739,8 @@ declare class ArkadeTransactionBuilder {
5893
5739
  fund(coins: ArkTxInput[]): this;
5894
5740
  /** Transfer an asset group: which inputs supply it and which outputs receive it. */
5895
5741
  withAsset(spec: AssetSpec): this;
5742
+ /** Add an extension packet; reusing the asset or emulator packet's type fails at build. */
5743
+ withPacket(packet: ExtensionPacket): this;
5896
5744
  /** Destination for any surplus (inputs − outputs). Required when the spend is not exact. */
5897
5745
  change(script: Uint8Array): this;
5898
5746
  /** Add an output — `(script, amount)` or a list of outputs. */
@@ -5941,9 +5789,14 @@ declare const index_ArkadeArgType: typeof ArkadeArgType;
5941
5789
  declare const index_ArkadeArgValue: typeof ArkadeArgValue;
5942
5790
  type index_ArkadeBatchInput = ArkadeBatchInput;
5943
5791
  type index_ArkadeConnectOptions = ArkadeConnectOptions;
5792
+ type index_ArkadeConnectProviderOptions = ArkadeConnectProviderOptions;
5793
+ type index_ArkadeConnectServiceOptions = ArkadeConnectServiceOptions;
5944
5794
  type index_ArkadeContract<P extends Program = Program> = ArkadeContract<P>;
5945
5795
  declare const index_ArkadeContract: typeof ArkadeContract;
5796
+ type index_ArkadeContractEvent<T extends ArkadeContractEventType = ArkadeContractEventType> = ArkadeContractEvent<T>;
5797
+ type index_ArkadeContractEventType = ArkadeContractEventType;
5946
5798
  declare const index_ArkadeContractParams: typeof ArkadeContractParams;
5799
+ type index_ArkadeContractSubscription = ArkadeContractSubscription;
5947
5800
  type index_ArkadeExtendedCoin = ArkadeExtendedCoin;
5948
5801
  type index_ArkadeExtendedVirtualCoin = ArkadeExtendedVirtualCoin;
5949
5802
  declare const index_ArkadeFunction: typeof ArkadeFunction;
@@ -5954,6 +5807,7 @@ type index_ArkadeScriptOP = ArkadeScriptOP;
5954
5807
  type index_ArkadeScriptType = ArkadeScriptType;
5955
5808
  declare const index_ArkadeSegment: typeof ArkadeSegment;
5956
5809
  type index_ArkadeServerProvider = ArkadeServerProvider;
5810
+ declare const index_ArkadeService: typeof ArkadeService;
5957
5811
  type index_ArkadeSpendResult = ArkadeSpendResult;
5958
5812
  type index_ArkadeTransactionBuilder = ArkadeTransactionBuilder;
5959
5813
  declare const index_ArkadeTransactionBuilder: typeof ArkadeTransactionBuilder;
@@ -5961,6 +5815,7 @@ declare const index_AsmToken: typeof AsmToken;
5961
5815
  type index_AssetSpec = AssetSpec;
5962
5816
  type index_CallableFunctions = CallableFunctions;
5963
5817
  declare const index_CompiledProgramFunction: typeof CompiledProgramFunction;
5818
+ type index_ContractArtifact = ContractArtifact;
5964
5819
  type index_ContractFunctions<P extends Program> = ContractFunctions<P>;
5965
5820
  declare const index_InputDef: typeof InputDef;
5966
5821
  declare const index_InputRef: typeof InputRef;
@@ -5969,11 +5824,14 @@ declare const index_OPCODE_NAMES: typeof OPCODE_NAMES;
5969
5824
  declare const index_OPCODE_VALUES: typeof OPCODE_VALUES;
5970
5825
  declare const index_Program: typeof Program;
5971
5826
  declare const index_ProgramKeys: typeof ProgramKeys;
5827
+ declare const index_ResolvedArkadeService: typeof ResolvedArkadeService;
5972
5828
  declare const index_SUPPORTED_PROGRAM_VERSION: typeof SUPPORTED_PROGRAM_VERSION;
5973
5829
  declare const index_Script: typeof Script;
5974
5830
  declare const index_ScriptType: typeof ScriptType;
5975
5831
  declare const index_SignerRef: typeof SignerRef;
5976
5832
  declare const index_TapscriptSegment: typeof TapscriptSegment;
5833
+ declare const index_TweakedSigner: typeof TweakedSigner;
5834
+ declare const index_UnsupportedProgramVersionError: typeof UnsupportedProgramVersionError;
5977
5835
  type index_Utxo = Utxo;
5978
5836
  declare const index_WitnessRef: typeof WitnessRef;
5979
5837
  declare const index_arkadeScriptHash: typeof arkadeScriptHash;
@@ -5986,7 +5844,10 @@ declare const index_deserializeArkadeContractParams: typeof deserializeArkadeCon
5986
5844
  declare const index_fromASM: typeof fromASM;
5987
5845
  declare const index_getOpcodeName: typeof getOpcodeName;
5988
5846
  declare const index_getOpcodeValue: typeof getOpcodeValue;
5847
+ declare const index_isContractArtifact: typeof isContractArtifact;
5989
5848
  declare const index_parseArtifact: typeof parseArtifact;
5849
+ declare const index_programFromArtifact: typeof programFromArtifact;
5850
+ declare const index_resolveArkadeService: typeof resolveArkadeService;
5990
5851
  declare const index_resolveAsm: typeof resolveAsm;
5991
5852
  declare const index_serializeArkadeContractParams: typeof serializeArkadeContractParams;
5992
5853
  declare const index_stringifyArtifact: typeof stringifyArtifact;
@@ -5994,7 +5855,7 @@ declare const index_toASM: typeof toASM;
5994
5855
  declare const index_validateProgram: typeof validateProgram;
5995
5856
  declare const index_witnessRefToBytes: typeof witnessRefToBytes;
5996
5857
  declare namespace index {
5997
- 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 };
5858
+ 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 };
5998
5859
  }
5999
5860
 
6000
5861
  /** Known BIP21 parameters including Arkade-specific extensions. */
@@ -6072,23 +5933,14 @@ interface PaymentHandle {
6072
5933
  }): Promise<RouteResult>;
6073
5934
  }
6074
5935
  /**
6075
- * A priced route. The three amounts are **receiver-exact** and mean the same
6076
- * thing on every rail, so `options()` can be ranked on cost and a rail swapped
6077
- * without changing what the recipient gets:
5936
+ * A priced route. The amounts are **receiver-exact** on every rail, so options rank on cost and
5937
+ * rails swap without changing what the recipient gets. Rails whose primitive *deducts* its fee
5938
+ * (collaborative exit) gross the amount up; a rail that can't (it doesn't choose the fee) flags
5939
+ * it via `claimFeeDeductedFromPayout`.
6078
5940
  *
6079
- * - `amount` — sats delivered **to the recipient**.
6080
- * - `fee` — sats charged **on top**, by the rail and its counterparty.
6081
- * - `total` — `amount + fee`; the sats that leave the wallet.
6082
- *
6083
- * Rails whose underlying primitive *deducts* its fee (the collaborative exit)
6084
- * gross the amount up to honour this; rails that add it on top pass it through.
6085
- * A rail that does not perform the deducting spend cannot gross up to a fee it
6086
- * never chooses, and flags that instead: see `claimFeeDeductedFromPayout`.
6087
- *
6088
- * `fee` is a pre-send estimate wherever the true cost is only fixed later: the
6089
- * collaborative exit does not include the per-input intent fees, which depend
6090
- * on the VTXO selection made at settlement. Treat it as a display and ranking
6091
- * figure, not a guarantee.
5941
+ * `fee` is an estimate where cost is fixed later: the collaborative exit omits per-input intent
5942
+ * fees unless {@link PaymentRequest.selectedVtxos} is named. A display/ranking figure, not a
5943
+ * guarantee.
6092
5944
  */
6093
5945
  interface RouteQuote {
6094
5946
  railId: string;
@@ -6099,31 +5951,18 @@ interface RouteQuote {
6099
5951
  /** `amount + fee` — what leaves the wallet. */
6100
5952
  total: number;
6101
5953
  /**
6102
- * Unix seconds after which the counterparty stops honouring this quote.
6103
- *
6104
- * Absent means "nothing to observe", not "never expires": a rail with no
6105
- * counterparty and no quote book — an Arkade transfer, an asset transfer, a
6106
- * collaborative exit — has no validity to state. A caller holding a quote
6107
- * across user think-time should read absence as "no check possible", and must
6108
- * still expect {@link send} to refuse either way: the swap rails re-check
6109
- * validity there, which is the only point that can judge it against the
6110
- * moment of spending.
5954
+ * Unix seconds after which the counterparty stops honouring this quote. Absent means "no
5955
+ * check possible" (rails without a counterparty), not "never expires"; {@link send} may
5956
+ * still refuse, since swap rails re-check validity at spend time.
6111
5957
  */
6112
5958
  validUntil?: number;
6113
5959
  /**
6114
- * @experimental The asset shape is provisional. The v2 swap client models
6115
- * assets as `give`/`take`/`amountOn` over `AssetRef`, and the two
6116
- * vocabularies are expected to converge on v0.5; do not treat this field as
6117
- * stable 0.4.x API.
6118
- *
6119
- * The asset view; absent means BTC only. The sats fields keep their
6120
- * meaning — an asset rides a sats-carrying output, so `amount` is the
6121
- * carrier, not zero.
5960
+ * @experimental The asset shape is provisional, expected to converge with the v2 swap
5961
+ * client's `give`/`take`/`amountOn` over `AssetRef` in v0.5; not stable 0.4.x API.
6122
5962
  *
6123
- * A pair, not a triple: on a cross-asset route these name DIFFERENT
6124
- * assets, so `total = amount + fee` cannot hold across the two units —
6125
- * which forces the purchase price into `fee`. Prefer `assets.spent` for a
6126
- * cost display.
5963
+ * The asset view; absent means BTC only. `amount` stays the sats carrier, not zero. On a
5964
+ * cross-asset route `delivered`/`spent` are different assets, so the purchase price lands in
5965
+ * `fee`; prefer `assets.spent` for a cost display.
6127
5966
  */
6128
5967
  assets?: {
6129
5968
  delivered: Asset;
@@ -6161,6 +6000,13 @@ interface PaymentRequest {
6161
6000
  * Additive: an asset transfer also moves sats, so a 500 USDX request
6162
6001
  * legitimately has both. A rail that cannot deliver assets must REFUSE. */
6163
6002
  assets?: Asset[];
6003
+ /**
6004
+ * Spend exactly these (normalized) virtual outputs, as {@link SendParams.selectedVtxos}:
6005
+ * ungated like `settle({ inputs })`, and a shortfall is an error, not a top-up. Only rails
6006
+ * spending the wallet's own coins (`ark`, `ark-asset`, `onchain`) can honour it;
6007
+ * counterparty-funded rails must REFUSE, not ignore it.
6008
+ */
6009
+ selectedVtxos?: NormalizedExtendedVirtualCoin[];
6164
6010
  }
6165
6011
  /** A payment rail — registered by id, mirrors the ActivityRegistry resolver shape. */
6166
6012
  interface PaymentRail {
@@ -6193,10 +6039,11 @@ declare const isLightningInvoice: (raw: string) => boolean;
6193
6039
  /**
6194
6040
  * True for an LNURL or a Lightning address (`user@host`).
6195
6041
  *
6196
- * TODO(lnurl): no rail consumes this yet — LNURL / Lightning-address routing is
6197
- * planned future work. The predicate is exported ahead of the rail so consumers
6198
- * can classify these targets today; until the rail lands, `route()` throws
6199
- * "no rail for" on them. Keep the export (do not flag as unused).
6042
+ * No rail here consumes it, and that is the layering rather than a gap:
6043
+ * routing an LNURL needs an LNURL client, so the rails ship from
6044
+ * `@arkade-os/lnurl-client/arkade` (`lnurlRails`) and are registered by the
6045
+ * app, as the solver rails from `@arkade-os/swap` are. With none registered,
6046
+ * `route()` throws "no rail for" on these targets.
6200
6047
  */
6201
6048
  declare const isLnurl: (raw: string) => boolean;
6202
6049
  /** True for a bech32 (segwit) or base58 (legacy) Bitcoin address, any network —
@@ -6233,6 +6080,11 @@ declare function assetsOf(req: PaymentRequest): Asset[];
6233
6080
  /** For a BTC-only rail: refusing is what leaves the router free to rank an
6234
6081
  * asset-capable one, instead of paying the carrier and dropping the asset. */
6235
6082
  declare function assertNoAssets(railId: string, req: PaymentRequest): void;
6083
+ /** The inputs a request names. An EMPTY array is still a selection, covering nothing. */
6084
+ declare function selectionOf(req: PaymentRequest): NormalizedExtendedVirtualCoin[] | undefined;
6085
+ /** For a rail whose counterparty funds the spend: ignoring a named input set
6086
+ * would spend coins the caller had promised elsewhere, so refuse instead. */
6087
+ declare function assertNoSelection(railId: string, req: PaymentRequest): void;
6236
6088
  /** Exactly one: `Wallet.send` takes a list because one output can carry
6237
6089
  * several, but a routed PAYMENT is one thing being paid. */
6238
6090
  declare function resolveAssetAmount(railId: string, req: PaymentRequest): Asset;
@@ -6311,12 +6163,15 @@ declare const walletFeeSource: (wallet: Wallet) => () => Promise<FeeInfo>;
6311
6163
  * and offboards VTXOs to the address via {@link Ramps.offboard}, which owns
6312
6164
  * fee-aware coin selection, dust-safe change, and settlement.
6313
6165
  *
6314
- * `offboard` deducts its fee from the amount it is handed, so the rail grosses
6315
- * the amount up first: the recipient receives exactly `quote.amount`, matching
6316
- * the receiver-exact semantics of every other rail (see {@link RouteQuote}).
6317
- * `quote.total` is the offboard amount; the per-input intent fees `offboard`
6318
- * shaves off the selected VTXOs are additional and depend on the selection, so
6319
- * they are not part of the quote.
6166
+ * The exit fee is priced on the DESTINATION output — the one arkd charges for —
6167
+ * and met from the balance, so the recipient receives exactly `quote.amount`
6168
+ * (see {@link RouteQuote}). {@link Ramps.offboardExact} carries that; the
6169
+ * gross-up this rail used to do could only approximate it.
6170
+ *
6171
+ * A request naming `selectedVtxos` offboards exactly those — so the exit need not
6172
+ * sweep the whole off-chain balance into one change output — and only then does
6173
+ * the quote carry the per-input intent fees: unselected, the coins are chosen
6174
+ * later at settlement and there is nothing here to price.
6320
6175
  *
6321
6176
  * An explicit amount is mandatory. To sweep the full balance, call
6322
6177
  * `Ramps.offboard(address, feeInfo)` directly — the router has no amountless path.
@@ -6386,9 +6241,7 @@ declare function sequenceToTimelock(sequence: number): RelativeTimelock;
6386
6241
  declare function toXOnly(key: Uint8Array, label?: string): Uint8Array;
6387
6242
 
6388
6243
  declare const buildVersion = "0.9.9";
6389
- /**
6390
- * The SDK's own version string, sourced from package.json
6391
- */
6244
+ /** The SDK's own version string, sourced from package.json */
6392
6245
  declare const sdkVersion: string;
6393
6246
  /**
6394
6247
  * Wraps a transport-level `fetch` rejection (DNS failure, connection refused,
@@ -6407,12 +6260,9 @@ declare class FetchError extends Error {
6407
6260
  });
6408
6261
  }
6409
6262
  /**
6410
- * Deadline applied to a read that carries no `AbortSignal` of its own.
6411
- *
6412
- * `fetch` has no default timeout, so a connection the network dropped silently
6413
- * stays pending until the runtime gives up — and every bound built on top of it
6414
- * waits with it. A retry ladder, a bounded queue or a mutex only work if the
6415
- * call underneath them terminates.
6263
+ * Deadline for a read that carries no `AbortSignal` of its own. `fetch` has no default timeout,
6264
+ * so a silently dropped connection stays pending, and every retry ladder, queue or mutex built on
6265
+ * top of it waits with it.
6416
6266
  */
6417
6267
  declare const READ_TIMEOUT_MS = 30000;
6418
6268
 
@@ -6475,46 +6325,22 @@ interface ManagedConnection extends AsyncDisposable {
6475
6325
  /**
6476
6326
  * The open connection, opening it on first call.
6477
6327
  *
6478
- * Call this once per operation and use the handle for the transaction you
6479
- * start right away — never store it on the repository, and never carry it
6480
- * across an `await`. The connection can be closed underneath you at any
6481
- * time (a `versionchange` from another tab, eviction, "clear site data"),
6482
- * after which every transaction on that handle throws `InvalidStateError`;
6483
- * a later `get()` transparently reopens, but only for callers that ask
6484
- * again. Holding the resolved database is exactly the defect this type
6485
- * exists to remove.
6486
- *
6487
- * ## The dispose boundary
6328
+ * Call once per operation and use the handle for the transaction you start right away —
6329
+ * never store it or carry it across an `await`. It can be closed underneath you at any time
6330
+ * (`versionchange` from another tab, eviction, "clear site data"), after which every
6331
+ * transaction on it throws `InvalidStateError`; a later `get()` transparently reopens.
6488
6332
  *
6489
- * `get()` is valid only before `[Symbol.asyncDispose]`. Afterwards it
6490
- * rejects with {@link ConnectionDisposedError}, permanently: dispose has
6491
- * released this connection's single reference, and reopening would take a
6492
- * refcount nothing is left to release. Disposal is final by design — there
6493
- * is no revive; construct a new repository, which constructs a new
6494
- * connection, instead.
6495
- *
6496
- * Dispose neither awaits nor cancels work already in flight. A transaction
6497
- * started just before it can abort when the underlying handle closes, and
6498
- * an in-flight `get()` may resolve to a database that is closing. So
6499
- * sequence disposal after the operations you care about have settled —
6500
- * `await` the repository's outstanding calls first — rather than racing it
6501
- * against them.
6502
- *
6503
- * Callers must not close the database themselves; the reference this
6504
- * connection holds is released by its own dispose, once.
6333
+ * After `[Symbol.asyncDispose]` it rejects with {@link ConnectionDisposedError}, permanently:
6334
+ * reopening would take a refcount nothing releases, so construct a new repository instead.
6335
+ * Dispose neither awaits nor cancels in-flight work, so `await` outstanding repository calls
6336
+ * before disposing. Callers must not close the database themselves.
6505
6337
  */
6506
6338
  get(): Promise<IDBDatabase>;
6507
6339
  }
6508
6340
  /**
6509
- * Forget-and-reopen around {@link openDatabase}, shared by every IndexedDB
6510
- * repository. Caching the resolved `IDBDatabase` is the defect this exists to
6511
- * remove: once the manager closes on `versionchange`, every later transaction on
6512
- * that handle throws `InvalidStateError` with no path back.
6513
- *
6514
- * Opens nothing until the first {@link ManagedConnection.get} — repositories
6515
- * construct their storage in their own constructors, and an eager open would
6516
- * move the "IndexedDB is not available in this environment" throw to
6517
- * construction time.
6341
+ * Forget-and-reopen around {@link openDatabase}, shared by every IndexedDB repository: a cached
6342
+ * `IDBDatabase` throws `InvalidStateError` forever once the manager closes it on `versionchange`.
6343
+ * Lazy, so the "IndexedDB is not available" throw stays out of repository constructors.
6518
6344
  */
6519
6345
  declare function createManagedConnection(dbName: string, version: number, initDatabase: (db: IDBDatabase, oldVersion: number, transaction: IDBTransaction | null) => void): ManagedConnection;
6520
6346
 
@@ -6588,6 +6414,7 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
6588
6414
  * ```
6589
6415
  */
6590
6416
  issue(params: IssuanceParams): Promise<IssuanceResult>;
6417
+ private issueWith;
6591
6418
  /**
6592
6419
  * Reissue more units of an existing asset.
6593
6420
  * Requires ownership of the control asset.
@@ -6606,6 +6433,7 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
6606
6433
  * ```
6607
6434
  */
6608
6435
  reissue(params: ReissuanceParams): Promise<string>;
6436
+ private reissueWith;
6609
6437
  /**
6610
6438
  * Burn assets.
6611
6439
  * @param params - Parameters for burning
@@ -6622,6 +6450,7 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
6622
6450
  * ```
6623
6451
  */
6624
6452
  burn(params: BurnParams): Promise<string>;
6453
+ private burnWith;
6625
6454
  }
6626
6455
 
6627
- 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 };
6456
+ 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 };