@arkade-os/sdk 0.5.8 → 0.5.9

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 (98) hide show
  1. package/README.md +22 -4
  2. package/dist/adapters/expo.cjs +7 -7
  3. package/dist/adapters/expo.d.cts +2 -2
  4. package/dist/adapters/expo.d.ts +2 -2
  5. package/dist/adapters/expo.js +4 -4
  6. package/dist/{asyncStorageTaskQueue-B5NPtkXo.d.cts → asyncStorageTaskQueue-B6rFkXzW.d.cts} +2 -2
  7. package/dist/{asyncStorageTaskQueue-YPwiJyVA.d.ts → asyncStorageTaskQueue-C0irgPwJ.d.ts} +2 -2
  8. package/dist/{chunk-F5O6JI2H.js → chunk-2657D67V.js} +5 -5
  9. package/dist/{chunk-F5O6JI2H.js.map → chunk-2657D67V.js.map} +1 -1
  10. package/dist/{chunk-E7LKKEVR.js → chunk-3KNSMZWD.js} +17 -12
  11. package/dist/chunk-3KNSMZWD.js.map +1 -0
  12. package/dist/{chunk-XXNPX4MK.js → chunk-4DUTRRXF.js} +3 -3
  13. package/dist/{chunk-XXNPX4MK.js.map → chunk-4DUTRRXF.js.map} +1 -1
  14. package/dist/{chunk-JYQXB7OH.cjs → chunk-4PSM6ZUC.cjs} +55 -57
  15. package/dist/chunk-4PSM6ZUC.cjs.map +1 -0
  16. package/dist/{chunk-FDJ734CH.js → chunk-DPFD5KBK.js} +5 -2
  17. package/dist/chunk-DPFD5KBK.js.map +1 -0
  18. package/dist/{chunk-SOJDUKY6.cjs → chunk-DY24A73N.cjs} +28 -18
  19. package/dist/chunk-DY24A73N.cjs.map +1 -0
  20. package/dist/{chunk-YTOABP6J.js → chunk-FUCKDTH7.js} +21 -12
  21. package/dist/chunk-FUCKDTH7.js.map +1 -0
  22. package/dist/{chunk-H7GT3QC4.js → chunk-GUK33TNC.js} +9 -13
  23. package/dist/chunk-GUK33TNC.js.map +1 -0
  24. package/dist/{chunk-OLKZUJIN.js → chunk-HT35HPXR.js} +3915 -2997
  25. package/dist/chunk-HT35HPXR.js.map +1 -0
  26. package/dist/{chunk-4IDCSOP2.cjs → chunk-ODLSVJRU.cjs} +33 -28
  27. package/dist/chunk-ODLSVJRU.cjs.map +1 -0
  28. package/dist/{chunk-L7OOPAUG.cjs → chunk-OMZZQTDM.cjs} +22 -17
  29. package/dist/chunk-OMZZQTDM.cjs.map +1 -0
  30. package/dist/{chunk-U34GU5RM.js → chunk-PXEFYEKL.js} +16 -11
  31. package/dist/chunk-PXEFYEKL.js.map +1 -0
  32. package/dist/{chunk-5PWL7WOT.cjs → chunk-UPIQZRNJ.cjs} +11 -11
  33. package/dist/{chunk-5PWL7WOT.cjs.map → chunk-UPIQZRNJ.cjs.map} +1 -1
  34. package/dist/{chunk-KWR37J6L.cjs → chunk-UPV4W423.cjs} +14 -18
  35. package/dist/chunk-UPV4W423.cjs.map +1 -0
  36. package/dist/{chunk-EQ3JVVUR.cjs → chunk-V2EU5QWF.cjs} +4499 -3578
  37. package/dist/chunk-V2EU5QWF.cjs.map +1 -0
  38. package/dist/{chunk-FLPWNMX3.cjs → chunk-WIZCF5IX.cjs} +5 -2
  39. package/dist/chunk-WIZCF5IX.cjs.map +1 -0
  40. package/dist/{chunk-JQSHFSME.cjs → chunk-WZJJZGBT.cjs} +20 -20
  41. package/dist/{chunk-JQSHFSME.cjs.map → chunk-WZJJZGBT.cjs.map} +1 -1
  42. package/dist/{chunk-3F5AJ235.js → chunk-Z6WDOZZI.js} +10 -12
  43. package/dist/chunk-Z6WDOZZI.js.map +1 -0
  44. package/dist/compiler.cjs +4 -4
  45. package/dist/compiler.js +3 -3
  46. package/dist/contracts/handlers/index.cjs +11 -11
  47. package/dist/contracts/handlers/index.d.cts +2 -3
  48. package/dist/contracts/handlers/index.d.ts +2 -3
  49. package/dist/contracts/handlers/index.js +4 -4
  50. package/dist/{index-Pk3i_MMU.d.ts → index-Bq349_ly.d.cts} +2322 -99
  51. package/dist/{index-CKzBYoDa.d.cts → index-D4ahI0W6.d.cts} +1 -2
  52. package/dist/{index-czozpKPT.d.cts → index-Mn2POBPj.d.ts} +2322 -99
  53. package/dist/{index-COs69e8T.d.ts → index-Yh5y9G4E.d.ts} +1 -2
  54. package/dist/index.cjs +359 -347
  55. package/dist/index.d.cts +1459 -1357
  56. package/dist/index.d.ts +1459 -1357
  57. package/dist/index.js +7 -7
  58. package/dist/repositories/realm/index.cjs +40 -40
  59. package/dist/repositories/realm/index.d.cts +2 -2
  60. package/dist/repositories/realm/index.d.ts +2 -2
  61. package/dist/repositories/realm/index.js +8 -8
  62. package/dist/repositories/sqlite/index.cjs +38 -38
  63. package/dist/repositories/sqlite/index.d.cts +2 -2
  64. package/dist/repositories/sqlite/index.d.ts +2 -2
  65. package/dist/repositories/sqlite/index.js +8 -8
  66. package/dist/{taskRunner-DBOqvP33.d.ts → taskRunner-BYxEgwM5.d.ts} +2 -2
  67. package/dist/{taskRunner-DXivOJHc.d.cts → taskRunner-Z3LnHfgs.d.cts} +2 -2
  68. package/dist/wallet/expo/background.cjs +17 -17
  69. package/dist/wallet/expo/background.d.cts +3 -3
  70. package/dist/wallet/expo/background.d.ts +3 -3
  71. package/dist/wallet/expo/background.js +9 -9
  72. package/dist/wallet/expo/index.cjs +18 -18
  73. package/dist/wallet/expo/index.d.cts +3 -5
  74. package/dist/wallet/expo/index.d.ts +3 -5
  75. package/dist/wallet/expo/index.js +8 -8
  76. package/dist/worker/expo/index.cjs +12 -12
  77. package/dist/worker/expo/index.d.cts +4 -4
  78. package/dist/worker/expo/index.d.ts +4 -4
  79. package/dist/worker/expo/index.js +8 -8
  80. package/package.json +1 -1
  81. package/dist/chunk-3F5AJ235.js.map +0 -1
  82. package/dist/chunk-4IDCSOP2.cjs.map +0 -1
  83. package/dist/chunk-E7LKKEVR.js.map +0 -1
  84. package/dist/chunk-EQ3JVVUR.cjs.map +0 -1
  85. package/dist/chunk-FDJ734CH.js.map +0 -1
  86. package/dist/chunk-FLPWNMX3.cjs.map +0 -1
  87. package/dist/chunk-H7GT3QC4.js.map +0 -1
  88. package/dist/chunk-JYQXB7OH.cjs.map +0 -1
  89. package/dist/chunk-KWR37J6L.cjs.map +0 -1
  90. package/dist/chunk-L7OOPAUG.cjs.map +0 -1
  91. package/dist/chunk-OLKZUJIN.js.map +0 -1
  92. package/dist/chunk-SOJDUKY6.cjs.map +0 -1
  93. package/dist/chunk-U34GU5RM.js.map +0 -1
  94. package/dist/chunk-YTOABP6J.js.map +0 -1
  95. package/dist/delegate-gGkUnYpi.d.cts +0 -92
  96. package/dist/delegate-iyDum4fw.d.ts +0 -92
  97. package/dist/keyringDescriptorProvider-CbNzWwbS.d.ts +0 -2095
  98. package/dist/keyringDescriptorProvider-nC8fIjBN.d.cts +0 -2095
package/dist/index.d.cts CHANGED
@@ -1,11 +1,8 @@
1
- import { a as Identity, ah as DescriptorProvider, a3 as Transaction, a4 as SignerSession, a5 as ReadonlyIdentity, aF as DescriptorSigningRequest, aG as IntentFeeConfig, aH as OffchainInput, aI as FeeAmount, aJ as OnchainInput, aK as FeeOutput, Y as BatchRegistrationRepository, Z as BatchRegistration, _ as BatchRegistrationPageFilter, P as PageRequest, D as PageResult, B as Outpoint, $ as VirtualTxRepository, a0 as VirtualTx, a1 as VtxoBranch, W as WalletRepository, Q as AtomicWalletState, z as ExtendedVirtualCoin, F as ScriptVtxoCursor, H as ScriptVtxoPageOptions, J as StoredVtxo, K as VtxoRepositoryKey, E as ExtendedCoin, L as TransactionHistoryPageFilter, M as TransactionHistoryPageCursor, g as ArkTransaction, U as WalletState, y as Contract, w as IndexerProvider, aL as ArkadeInfo, aj as OnchainProvider, i as Activity, C as ContractRepository, X as ContractFilter, I as IWallet, x as OperatorProvider, as as NetworkName, ay as SettlementConfig, aM as ContractWatcherConfig, aN as Asset, R as Recipient, aO as FeeInfo, n as SettlementEvent, N as NormalizedExtendedVirtualCoin, S as SettleParams, G as GetOperatorInfoOptions, aP as GetVtxosOptions, aQ as PaginationOptions, e as GetVtxosFilter, f as GetSpendableVtxosFilter, aR as CreateContractParams, aS as GetContractsFilter, V as VirtualCoin, aT as GetSpendablePathsOptions, aU as GetAllSpendingPathsOptions, k as GetNewAddressesOptions, aV as InputExpiryFloor, aW as IssuanceParams, aX as ReissuanceParams, aY as BurnParams, aZ as RenewVtxosOptions, p as SendOnchainParams, O as OperatorInfo, a_ as NormalizedVtxoPage, A as ArkadeReader, c as ArkadeBroadcaster, d as WalletBalance, ap as ContractSyncState, at as ContractWithVtxos, a$ as WatchedScript, b0 as PathSelection, l as NewAddress, b1 as ContractEvent, b2 as AssetDetails, b3 as IssuanceResult, b4 as DelegateInfo, b5 as MigrationGlobalSkipReason, b6 as MigrationLegSkipReason, b7 as SignerStatus, ai as IReadonlyWallet, h as ActivityRegistry, ao as IReadonlyAssetManager, b8 as StorageConfig, j as IContractManager, q as IAssetManager, o as SendParams, m as IDelegateManager, b9 as IVtxoManager, a6 as Network, av as Coin, ba as SendBitcoinParams, bb as ExplorerTransaction, aC as SignedProof, aD as Proof, bc as TreeNonces, bd as TreePartialSigs, T as TxNotificationEvent, be as PendingTx, bf as EmulatorProvider, bg as Status, bh as ChainTx, aa as TxTree, bi as ArkadeService, bj as ContractVtxoEvent, bk as ExtendedContractVtxo, bl as ResolvedArkadeService, bm as resolveArkadeService, bn as PathContext } from './index-czozpKPT.cjs';
2
- export { bo as ActivityIntent, a7 as ActivityResolver, bp as ArkIntent, bq as ArkIntentState, v as ArkProvider, br as AssetMetadata, bs as BATCH_REGISTRATION_TERMINAL_STATES, bt as BITCOIN_EMULATOR_PUBKEY, bu as BaseWalletConfig, ae as BatchFailedEvent, ac as BatchFinalizationEvent, ad as BatchFinalizedEvent, bv as BatchInfo, bw as BatchRegistrationFilter, bx as BatchRegistrationState, by as BatchSignableIdentity, a8 as BatchStartedEvent, bz as CandidateDeps, bA as ChainTxType, a2 as ChainedTxType, bB as CommitmentTx, bC as ConnectorTreeNode, bD as ContractBalance, bE as ContractEventCallback, bF as ContractHandler, aw as ContractManager, ax as ContractManagerConfig, bG as ContractScope, bH as ContractState, bI as ContractVtxo, bJ as ContractWatcher, bK as ContractWatcherEventCallback, bL as DEFAULT_ARKADE_EMULATOR_URL, bM as DEFAULT_VTXO_PAGE_SIZE, bN as DelegateManagerImpl, bO as DelegateOptions, ak as DelegateProvider, bP as DeprecatedSignerMigrationReport, bQ as DeprecatedSignerReport, bR as DigestMismatchError, bS as Discoverable, bT as DiscoveredContract, bU as DiscoveryDeps, bV as ESPLORA_URL, bW as EmulatorInfo, ar as EsploraProvider, bX as EventSourceCapable, bY as EventSourceFactory, bZ as EventSourceLike, b_ as EventSourceUnavailableError, am as ExitCaptureMode, b$ as ExitChainResolver, an as ExitDataSource, c0 as GetArkadeInfoOptions, c1 as GetUtxosOptions, c2 as GroupMembership, c3 as HandlerError, c4 as INTENT_TERMINAL_STATES, c5 as IndexerTxType, c6 as IndexerUtxo, c7 as IndexerUtxosUnsupportedError, aB as Intent, c8 as IntentCoin, c9 as IntentFilter, ca as IntentPageFilter, cb as IntentRepository, cc as KnownMetadata, cd as MAX_PAGE_SIZE, ce as MUTINYNET_EMULATOR_PUBKEY, cf as MigrateDeprecatedSignerOptions, cg as MigrationLegReport, ch as MigrationVtxoRef, ci as NewAddressType, cj as Nonces, ck as OnchainCosignAmbiguousError, cl as OnchainCosignRejectedError, cm as OnchainCosignUnsupportedError, cn as Output, co as PageResponse, cp as PartialSig, cq as PrevTxSource, cr as PrevTxUnavailableError, cs as ProofInput, ct as ProviderClass, cu as REGTEST_EMULATOR_PUBKEY, cv as RawTxSource, al as ReadonlyWalletConfig, aq as RecipientArkadeAddressContext, cw as RenewalSplit, cx as RenewalSplitContext, cy as RestArkProvider, cz as RestDelegateProvider, cA as RestEmulatorProvider, s as RestIndexerProvider, r as RestOperatorProvider, cB as ScanContractsOptions, cC as ScanResult, cD as ScheduledSession, cE as SettlementEventType, cF as SignRequest, aA as SignedIntent, cG as SignerClassification, cH as SignerSet, t as SubscriptionEvent, cI as SubscriptionFilter, u as SubscriptionHeartbeat, cJ as SubscriptionResponse, cK as SweepTxNotification, cL as TapLeaves, aE as TimeHeight, ab as TreeNoncesEvent, ag as TreeSignatureEvent, cM as TreeSignerSession, a9 as TreeSigningStartedEvent, af as TreeTxEvent, cN as Tx, cO as TxHistoryRecord, cP as TxKey, cQ as TxNotification, cR as TxTag, cS as TxTreeNode, cT as TxType, cU as Vtxo, cV as VtxoChain, az as VtxoManager, cW as VtxoType, b as WalletConfig, cX as WalletMode, cY as WithPrevTx, cZ as assertAllowedSighashTypes, c_ as assertPageRequest, c$ as assertRecipientArkadeAddress, d0 as assetMintResolver, d1 as attachPrevArkTxs, d2 as attachPrevoutTxs, d3 as boardingResolver, d4 as canRecoverOnchain, d5 as canSpendOffchain, d6 as canSweepOnchain, d7 as classifyAgainstSignerSet, d8 as classifyContractSigner, d9 as collabExitResolver, da as collectBatchRegistrations, db as collectContracts, dc as collectIntents, dd as collectPages, de as collectScriptVtxos, df as collectTransactionHistory, dg as collectUtxos, dh as collectVtxos, di as configureEventSource, dj as createDefaultActivityRegistry, dk as createExitChainResolver, dl as defaultEmulatorPubkey, dm as getAllNormalizedVtxos, dn as getConfiguredEventSource, dp as getNetwork, dq as getNormalizedVtxos, dr as getRandomId, ds as hasCandidates, dt as isBatchSignable, du as isContractVtxoEvent, dv as isCooperativelyMigratable, dw as isDiscoverable, dx as isEventSourceUnavailableError, dy as isPastExpiry, dz as isSigningIdentity, dA as isSubdust, dB as isTerminalBatchRegistrationState, dC as isTerminalIntentState, dD as isVirtualCoin, dE as isVtxoExpiringSoon, dF as isVtxoSpent, dG as iteratePages, dH as networkFromArkadeInfo, dI as networkFromOperatorInfo, dJ as networks, dK as pageResult, dL as resolveEmulatorPubkey, dM as resolveEventSource, dN as resolvePrevTxs, dO as signerSetFromInfo, dP as toOffchainInputFeeParams, dQ as toXOnlySignerHex, dR as withPrevTxs } from './index-czozpKPT.cjs';
3
- import { b as ArkadeCashTx, c as ArkadeCashRecord, d as ArkadeCashClaimResult, W as Wallet, R as ReadonlyWallet, e as ReceiveRotatorFactory, f as ReceiveRotatorBootOpts, g as ReceiveRotatorBoot, P as ProviderConnectionState, H as HDWalletCapable, a as HDAllocationCapable, A as AddressAllocationCapable, B as BatchExpiryPolicy, h as Batch } from './keyringDescriptorProvider-nC8fIjBN.cjs';
4
- export { i as AbortError, j as ArkError, k as ArkErrorName, l as ArkadeCash, m as ArkadeCashAction, n as ArkadeCashCreateError, o as ArkadeCashOperatorMismatchError, p as ArkadeCashUnclaimedReason, q as ArkadeCashUnclaimedVtxo, r as ArkadeCashVtxoRef, s as BoardingUtxoGroup, D as DEFAULT_MIN_BATCH_EXPIRY_SECONDS, F as ForeignDescriptorError, t as HttpResponseError, I as IncomingFunds, u as IndexedDBWalletRepository, K as KeyringDescriptorProvider, M as MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD, N as NotifiesIncomingFunds, v as ProviderKind, w as ProviderUnavailableError, x as REGTEST_MIN_BATCH_EXPIRY_SECONDS, y as ReadonlySingleKey, S as ServerInfoSource, z as ServerResponseMismatchError, C as SingleKey, V as VtxoReservation, E as VtxoReservedError, G as WaitForIncomingFundsOptions, J as WalletCannotAllocateAddressError, L as addArkadeCashRecord, O as arkadeCashId, Q as arkadeCashResolver, T as assertValidBatchExpiry, U as createArkadeCashTracker, X as defaultBatchExpiryPolicy, Y as isAddressAllocationCapable, Z as isArkError, _ as isHDAllocationCapable, $ as isHDWalletCapable, a0 as maybeArkError, a1 as mergeArkadeCashRecord, a2 as resolveBatchExpiryPolicy, a3 as resolveDescriptorSigner, a4 as selectVirtualCoins, a5 as signingDescriptorIndex, a6 as strictSigningDescriptorIndex, a7 as waitForIncomingFunds } from './keyringDescriptorProvider-nC8fIjBN.cjs';
5
- import { T as TapLeafScript, E as EncodedVtxoScript, C as CSVMultisigTapscript, R as RelativeTimelock, V as VtxoScript } from './base-C-Y5t_0F.cjs';
1
+ import { b as Identity, a8 as DescriptorProvider, a9 as Transaction, aa as SignerSession, ab as ReadonlyIdentity, ac as DescriptorSigningRequest, ad as IntentFeeConfig, ae as OffchainInput, af as FeeAmount, ag as OnchainInput, ah as FeeOutput, ai as VtxoReservationRepository, aj as StoredVtxoReservation, a1 as BatchRegistrationRepository, a2 as BatchRegistration, a3 as BatchRegistrationPageFilter, J as PageRequest, L as PageResult, K as Outpoint, a4 as VirtualTxRepository, a5 as VirtualTx, a6 as VtxoBranch, W as WalletRepository, _ as AtomicWalletState, F as ExtendedVirtualCoin, M as ScriptVtxoCursor, Q as ScriptVtxoPageOptions, U as StoredVtxo, X as VtxoRepositoryKey, E as ExtendedCoin, Y as TransactionHistoryPageFilter, Z as TransactionHistoryPageCursor, j as ArkTransaction, $ as WalletState, D as Contract, ak as ArkadeCashTx, z as IndexerProvider, al as ArkadeInfo, am as OnchainProvider, an as ArkadeCashRecord, ao as ArkadeCashClaimResult, l as Activity, C as ContractRepository, a0 as ContractFilter, I as IWallet, S as SettleParams, G as GetOperatorInfoOptions, ap as GetVtxosOptions, aq as PaginationOptions, h as GetVtxosFilter, i as GetSpendableVtxosFilter, ar as CreateContractParams, as as GetContractsFilter, V as VirtualCoin, at as GetSpendablePathsOptions, au as GetAllSpendingPathsOptions, n as GetNewAddressesOptions, R as Recipient, av as InputExpiryFloor, aw as IssuanceParams, ax as ReissuanceParams, ay as BurnParams, az as RenewVtxosOptions, s as SendOnchainParams, q as SettlementEvent, O as OperatorInfo, aA as NormalizedVtxoPage, e as ArkadeReader, f as ArkadeBroadcaster, g as WalletBalance, P as ProviderConnectionState, aB as ContractSyncState, aC as ContractWithVtxos, aD as WatchedScript, aE as PathSelection, o as NewAddress, aF as ContractEvent, aG as AssetDetails, aH as IssuanceResult, aI as DelegateInfo, aJ as MigrationGlobalSkipReason, aK as MigrationLegSkipReason, aL as SignerStatus, aM as NetworkName, B as OperatorProvider, c as Wallet, aN as ReadonlyWallet, aO as SettlementConfig, aP as ContractWatcherConfig, aQ as Asset, aR as FeeInfo, N as NormalizedExtendedVirtualCoin, aS as ReceiveRotatorFactory, aT as ReceiveRotatorBootOpts, aU as ReceiveRotatorBoot, aV as IReadonlyWallet, k as ActivityRegistry, aW as IReadonlyAssetManager, aX as StorageConfig, m as IContractManager, H as HDWalletCapable, a as HDAllocationCapable, A as AddressAllocationCapable, t as IAssetManager, aY as VtxoReservation, r as SendParams, p as IDelegateManager, aZ as IVtxoManager, a_ as Network, a$ as Coin, b0 as SendBitcoinParams, b1 as ExplorerTransaction, b2 as SignedProof, b3 as Proof, b4 as TreeNonces, b5 as TreePartialSigs, T as TxNotificationEvent, b6 as PendingTx, b7 as EmulatorProvider, b8 as Status, b9 as BatchExpiryPolicy, ba as Batch, bb as ChainTx, bc as TxTree, bd as ArkadeService, be as ContractVtxoEvent, bf as ExtendedContractVtxo, bg as ResolvedArkadeService, bh as resolveArkadeService, bi as PathContext } from './index-Bq349_ly.cjs';
2
+ export { bj as AbortError, bk as ActivityIntent, bl as ActivityResolver, bm as ArkError, bn as ArkErrorName, bo as ArkIntent, bp as ArkIntentState, y as ArkProvider, bq as ArkadeCash, br as ArkadeCashAction, bs as ArkadeCashCreateError, bt as ArkadeCashOperatorMismatchError, bu as ArkadeCashUnclaimedReason, bv as ArkadeCashUnclaimedVtxo, bw as ArkadeCashVtxoRef, bx as AssetMetadata, by as BATCH_REGISTRATION_TERMINAL_STATES, bz as BITCOIN_EMULATOR_PUBKEY, bA as BaseWalletConfig, bB as BatchFailedEvent, bC as BatchFinalizationEvent, bD as BatchFinalizedEvent, bE as BatchInfo, bF as BatchRegistrationFilter, bG as BatchRegistrationState, bH as BatchSignableIdentity, bI as BatchStartedEvent, bJ as BoardingUtxoGroup, bK as CandidateDeps, bL as ChainTxType, a7 as ChainedTxType, bM as CommitmentTx, bN as ConnectorTreeNode, bO as ContractBalance, bP as ContractEventCallback, bQ as ContractHandler, bR as ContractManager, bS as ContractManagerConfig, bT as ContractScope, bU as ContractState, bV as ContractVtxo, bW as ContractWatcher, bX as ContractWatcherEventCallback, bY as DEFAULT_ARKADE_EMULATOR_URL, bZ as DEFAULT_MIN_BATCH_EXPIRY_SECONDS, b_ as DEFAULT_VTXO_PAGE_SIZE, b$ as DefaultVtxo, c0 as DelegateManagerImpl, c1 as DelegateOptions, c2 as DelegateProvider, c3 as DelegateVtxo, c4 as DeprecatedSignerMigrationReport, c5 as DeprecatedSignerReport, c6 as DigestMismatchError, c7 as Discoverable, c8 as DiscoveredContract, c9 as DiscoveryDeps, ca as ESPLORA_URL, cb as EmulatorInfo, cc as EsploraProvider, cd as EventSourceCapable, ce as EventSourceFactory, cf as EventSourceLike, cg as EventSourceUnavailableError, ch as ExitCaptureMode, ci as ExitChainResolver, cj as ExitDataSource, ck as ForeignDescriptorError, cl as GetArkadeInfoOptions, cm as GetUtxosOptions, cn as GroupMembership, co as HandlerError, cp as HttpResponseError, cq as INTENT_TERMINAL_STATES, cr as IncomingFunds, cs as IndexedDBWalletRepository, ct as IndexerTxType, cu as IndexerUtxo, cv as IndexerUtxosUnsupportedError, cw as Intent, cx as IntentCoin, cy as IntentFilter, cz as IntentPageFilter, cA as IntentRepository, cB as KeyringDescriptorProvider, cC as KnownMetadata, cD as MAX_PAGE_SIZE, cE as MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD, cF as MUTINYNET_EMULATOR_PUBKEY, cG as MigrateDeprecatedSignerOptions, cH as MigrationLegReport, cI as MigrationVtxoRef, cJ as NewAddressType, cK as Nonces, cL as NotifiesIncomingFunds, cM as OnchainCosignAmbiguousError, cN as OnchainCosignRejectedError, cO as OnchainCosignUnsupportedError, cP as Output, cQ as PageResponse, cR as PartialSig, cS as PrevTxSource, cT as PrevTxUnavailableError, cU as ProofInput, cV as ProviderClass, cW as ProviderKind, cX as ProviderUnavailableError, cY as REGTEST_EMULATOR_PUBKEY, cZ as REGTEST_MIN_BATCH_EXPIRY_SECONDS, c_ as RawTxSource, c$ as ReadonlySingleKey, d0 as ReadonlyWalletConfig, d1 as RecipientArkadeAddressContext, d2 as RenewalSplit, d3 as RenewalSplitContext, d4 as RestArkProvider, d5 as RestDelegateProvider, d6 as RestEmulatorProvider, v as RestIndexerProvider, u as RestOperatorProvider, d7 as ScanContractsOptions, d8 as ScanResult, d9 as ScheduledSession, da as ServerInfoSource, db as ServerResponseMismatchError, dc as SettlementEventType, dd as SignRequest, de as SignedIntent, df as SignerClassification, dg as SignerSet, dh as SingleKey, w as SubscriptionEvent, di as SubscriptionFilter, x as SubscriptionHeartbeat, dj as SubscriptionResponse, dk as SweepTxNotification, dl as TapLeaves, dm as TimeHeight, dn as TreeNoncesEvent, dp as TreeSignatureEvent, dq as TreeSignerSession, dr as TreeSigningStartedEvent, ds as TreeTxEvent, dt as Tx, du as TxHistoryRecord, dv as TxKey, dw as TxNotification, dx as TxTag, dy as TxTreeNode, dz as TxType, dA as Vtxo, dB as VtxoChain, dC as VtxoManager, dD as VtxoReservedError, dE as VtxoType, dF as WaitForIncomingFundsOptions, dG as WalletCannotAllocateAddressError, d as WalletConfig, dH as WalletMode, dI as WithPrevTx, dJ as addArkadeCashRecord, dK as arkadeCashId, dL as arkadeCashResolver, dM as assertAllowedSighashTypes, dN as assertPageRequest, dO as assertRecipientArkadeAddress, dP as assertValidBatchExpiry, dQ as assetMintResolver, dR as attachPrevArkTxs, dS as attachPrevoutTxs, dT as boardingResolver, dU as canRecoverOnchain, dV as canSpendOffchain, dW as canSweepOnchain, dX as classifyAgainstSignerSet, dY as classifyContractSigner, dZ as collabExitResolver, d_ as collectBatchRegistrations, d$ as collectContracts, e0 as collectIntents, e1 as collectPages, e2 as collectScriptVtxos, e3 as collectTransactionHistory, e4 as collectUtxos, e5 as collectVtxos, e6 as configureEventSource, e7 as createArkadeCashTracker, e8 as createDefaultActivityRegistry, e9 as createExitChainResolver, ea as defaultBatchExpiryPolicy, eb as defaultEmulatorPubkey, ec as getAllNormalizedVtxos, ed as getConfiguredEventSource, ee as getNetwork, ef as getNormalizedVtxos, eg as getRandomId, eh as hasCandidates, ei as isAddressAllocationCapable, ej as isArkError, ek as isBatchSignable, el as isContractVtxoEvent, em as isCooperativelyMigratable, en as isDiscoverable, eo as isEventSourceUnavailableError, ep as isHDAllocationCapable, eq as isHDWalletCapable, er as isPastExpiry, es as isSigningIdentity, et as isSubdust, eu as isTerminalBatchRegistrationState, ev as isTerminalIntentState, ew as isVirtualCoin, ex as isVtxoExpiringSoon, ey as isVtxoSpent, ez as iteratePages, eA as maybeArkError, eB as mergeArkadeCashRecord, eC as networkFromArkadeInfo, eD as networkFromOperatorInfo, eE as networks, eF as pageResult, eG as resolveBatchExpiryPolicy, eH as resolveDescriptorSigner, eI as resolveEmulatorPubkey, eJ as resolveEventSource, eK as resolvePrevTxs, eL as selectVirtualCoins, eM as signerSetFromInfo, eN as signingDescriptorIndex, eO as strictSigningDescriptorIndex, eP as toOffchainInputFeeParams, eQ as toXOnlySignerHex, eR as waitForIncomingFunds, eS as withPrevTxs } from './index-Bq349_ly.cjs';
3
+ import { T as TapLeafScript, E as EncodedVtxoScript, C as CSVMultisigTapscript, V as VtxoScript, R as RelativeTimelock } from './base-C-Y5t_0F.cjs';
6
4
  export { A as ArkAddress, a as ArkTapscript, b as CLTVMultisigTapscript, c as ConditionCSVMultisigTapscript, d as ConditionMultisigTapscript, M as MultisigTapscript, e as TapTreeCoder, f as TapscriptType, g as decodeTapscript, h as getSequence, s as scriptFromTapLeafScript } from './base-C-Y5t_0F.cjs';
7
- export { A as ArkadeContractHandler, B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, V as VHTLC, e as VHTLCContractHandler, f as VHTLCContractParams, g as VHTLCV2ContractHandler, h as VHTLCV2ContractParams, i as contractHandlers } from './index-CKzBYoDa.cjs';
8
- export { D as DefaultVtxo, a as DelegateVtxo } from './delegate-gGkUnYpi.cjs';
5
+ export { A as ArkadeContractHandler, B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, V as VHTLC, e as VHTLCContractHandler, f as VHTLCContractParams, g as VHTLCV2ContractHandler, h as VHTLCV2ContractParams, i as contractHandlers } from './index-D4ahI0W6.cjs';
9
6
  import { Bytes, BTC_NETWORK } from '@scure/btc-signer/utils.js';
10
7
  import { Transaction as Transaction$1, OP, Script, ScriptType } from '@scure/btc-signer';
11
8
  import { P2TR } from '@scure/btc-signer/payment.js';
@@ -321,6 +318,16 @@ declare class Estimator {
321
318
  evaluate(offchainInputs: OffchainInput[], onchainInputs: OnchainInput[], offchainOutputs: FeeOutput[], onchainOutputs: FeeOutput[]): FeeAmount;
322
319
  }
323
320
 
321
+ declare class IndexedDBVtxoReservationRepository implements VtxoReservationRepository, AsyncDisposable {
322
+ readonly version: 1;
323
+ private readonly connection;
324
+ constructor(dbName: string);
325
+ getReservations(): Promise<StoredVtxoReservation[]>;
326
+ saveReservation(reservation: StoredVtxoReservation): Promise<void>;
327
+ deleteReservation(id: string): Promise<void>;
328
+ [Symbol.asyncDispose](): Promise<void>;
329
+ }
330
+
324
331
  declare class InMemoryBatchRegistrationRepository implements BatchRegistrationRepository {
325
332
  readonly version: 1;
326
333
  private byId;
@@ -1080,1163 +1087,65 @@ declare function isDeterministicSigner(value: unknown): value is DeterministicSi
1080
1087
  */
1081
1088
  declare function adoptContractDescriptor(wallet: IWallet, descriptor: string): Promise<void>;
1082
1089
 
1083
- type RequestEnvelope = {
1084
- tag: string;
1085
- id: string;
1086
- broadcast?: boolean;
1090
+ declare class WalletNotInitializedError extends Error {
1091
+ constructor();
1092
+ }
1093
+ declare class ReadonlyWalletError extends Error {
1094
+ constructor();
1095
+ }
1096
+ declare class DelegateNotConfiguredError extends Error {
1097
+ constructor();
1098
+ }
1099
+ type RequestInitWallet = RequestEnvelope & {
1100
+ type: "INIT_WALLET";
1101
+ payload: {
1102
+ arkServerUrl: string;
1103
+ arkServerPublicKey?: string;
1104
+ lazyBoarding?: boolean;
1105
+ };
1087
1106
  };
1088
- type ResponseEnvelope = {
1089
- tag: string;
1090
- id?: string;
1091
- error?: Error;
1092
- /**
1093
- * `error.name`, carried beside the error as an ordinary string. The
1094
- * structured-clone algorithm serializes an Error's `name` only from the
1095
- * built-in whitelist (Error, TypeError, RangeError, …) — a custom name
1096
- * like `ProviderUnavailableError` reaches the page as `"Error"`. A plain
1097
- * property survives verbatim, so the page restores it before rejecting.
1098
- * Absent from workers built before it existed; the page then sees the
1099
- * clone-normalized name, exactly as it always did.
1100
- */
1101
- errorName?: string;
1102
- broadcast?: boolean;
1107
+ type ResponseInitWallet = ResponseEnvelope & {
1108
+ type: "WALLET_INITIALIZED";
1103
1109
  };
1104
- type MessageBusServices = {
1105
- arkProvider: OperatorProvider;
1106
- wallet?: Wallet;
1107
- readonlyWallet: ReadonlyWallet;
1110
+ type RequestSettle = RequestEnvelope & {
1111
+ type: "SETTLE";
1112
+ payload: {
1113
+ params?: SettleParams;
1114
+ };
1108
1115
  };
1109
- interface MessageHandler<REQ extends RequestEnvelope = RequestEnvelope, RES extends ResponseEnvelope = ResponseEnvelope> {
1110
- /**
1111
- * A unique identifier for the updater.
1112
- * This is used to route messages to the correct updater.
1113
- */
1114
- readonly messageTag: string;
1115
- /**
1116
- * Called once when the SW is starting up
1117
- * @param services - Providers and wallet instances available to the handler.
1118
- * @param repositories - Repositories available to the handler.
1119
- * @param channel - Push channel to clients, for responses that answer no
1120
- * request. Use it instead of holding events for the next {@link tick}.
1121
- * The channel is scoped to the generation it was handed out in: after a
1122
- * bus re-init or `stop()` it goes inert on its own, so retaining one past
1123
- * `stop()` cannot post.
1124
- **/
1125
- start(services: MessageBusServices, repositories: {
1126
- walletRepository: WalletRepository;
1127
- }, channel?: {
1128
- broadcast(response: RES): void;
1129
- }): Promise<void>;
1130
- /** Called once when the SW is shutting down */
1131
- stop(): Promise<void>;
1132
- /**
1133
- * Called by the scheduler to perform a tick.
1134
- * Can be used by the updater to perform periodic tasks or return
1135
- * delayed responses (eg: subscriptions).
1136
- * @param now The current time in milliseconds since the epoch.
1137
- **/
1138
- tick(now: number): Promise<RES[]>;
1139
- /**
1140
- * Handle routed messages from the clients
1141
- **/
1142
- handleMessage(message: REQ): Promise<RES | null>;
1143
- /**
1144
- * Optional opt-out from the bus-level message timeout.
1145
- *
1146
- * Long-running flows (e.g. settlement) surrender control to remote peers
1147
- * and can legitimately sit idle for longer than `messageTimeoutMs`. When
1148
- * this returns true, the bus awaits `handleMessage` without a deadline.
1149
- * Defaults to false.
1150
- */
1151
- isLongRunning?(message: REQ): boolean;
1152
- }
1153
- type Options = {
1154
- messageHandlers: MessageHandler[];
1155
- tickIntervalMs?: number;
1156
- messageTimeoutMs?: number;
1157
- /**
1158
- * Per-operation timeout overrides. Keys are either message types
1159
- * (e.g. "SETTLE") or handler tags (e.g. "WALLET_UPDATER"). Message-type
1160
- * matches take precedence over tag matches. Unspecified operations use
1161
- * `messageTimeoutMs`. These are treated as defaults: any map supplied
1162
- * via `INITIALIZE_MESSAGE_BUS` overrides per-key and is re-applied on
1163
- * every (re-)init.
1164
- */
1165
- messageTimeoutOverrides?: Record<string, number>;
1166
- /**
1167
- * Optional intent-lifecycle repository, handed to the worker's wallet as
1168
- * `storage.intentRepository`. Same opt-in as a main-thread wallet: without
1169
- * it the worker persists no settlement intent, reconciles none on restart,
1170
- * and counts intent-locked VTXOs as available. Pass the same repository the
1171
- * main thread uses so both sides read one intent state, but settle from one
1172
- * side only: reconciliation deletes from the server any pending intent the
1173
- * worker's wallet is not settling itself.
1174
- *
1175
- * Ignored when `buildServices` is supplied — that override owns `storage`.
1176
- */
1177
- intentRepository?: BatchRegistrationRepository;
1178
- /** The worker wallet's onchain provider, per network: an instance cannot cross `postMessage`.
1179
- * Called on every init and never closed, so return one instance per network. Defaults to
1180
- * Esplora; ignored when `buildServices` is supplied. */
1181
- onchainProvider?: (network: NetworkName) => OnchainProvider;
1182
- debug?: boolean;
1183
- buildServices?: (config: Initialize["config"]) => Promise<MessageBusServices>;
1116
+ type ResponseSettle = ResponseEnvelope & {
1117
+ type: "SETTLE_SUCCESS";
1118
+ payload: {
1119
+ txid: string;
1120
+ };
1184
1121
  };
1185
- type Initialize = {
1186
- type: "INITIALIZE_MESSAGE_BUS";
1187
- id: string;
1188
- config: {
1189
- wallet: SerializedIdentity;
1190
- arkServer: {
1191
- url: string;
1192
- publicKey?: string;
1193
- };
1194
- delegateUrl?: string;
1195
- settlementConfig?: SettlementConfig | false;
1196
- /** @see WalletConfig.concurrentSpending */
1197
- concurrentSpending?: boolean;
1198
- walletMode?: "auto" | "static" | "hd";
1199
- lazyInitialization?: boolean;
1200
- watcherConfig?: Partial<Omit<ContractWatcherConfig, "indexerProvider">>;
1201
- /** @see WalletConfig.lookAheadWindow */
1202
- lookAheadWindow?: number;
1203
- /** @see WalletConfig.oneShotSubmit */
1204
- oneShotSubmit?: boolean;
1205
- /** @see WalletConfig.minBatchExpirySeconds */
1206
- minBatchExpirySeconds?: bigint;
1207
- /**
1208
- * Page-supplied per-operation timeout map. Keys are message types
1209
- * (e.g. "SETTLE"). Overrides constructor-supplied
1210
- * `messageTimeoutOverrides` per-key; re-applied on every init.
1211
- */
1212
- messageTimeouts?: Record<string, number>;
1122
+ type RequestGetAddress = RequestEnvelope & {
1123
+ type: "GET_ADDRESS";
1124
+ };
1125
+ type ResponseGetAddress = ResponseEnvelope & {
1126
+ type: "ADDRESS";
1127
+ payload: {
1128
+ address: string;
1213
1129
  };
1214
1130
  };
1215
- declare class MessageBus {
1216
- private readonly walletRepository;
1217
- private readonly contractRepository;
1218
- private handlers;
1219
- private tickIntervalMs;
1220
- private messageTimeoutMs;
1221
- private readonly constructorTimeoutOverrides;
1222
- private messageTimeoutOverrides;
1223
- private lateDeliveries;
1224
- private running;
1225
- private tickTimeout;
1226
- private tickInProgress;
1227
- private debug;
1228
- private initialized;
1229
- /**
1230
- * FIFO chain that serializes `INITIALIZE_MESSAGE_BUS` handling. Each init
1231
- * runs to completion in enqueue order.
1232
- */
1233
- private initChain;
1234
- /**
1235
- * Number of inits accepted but not yet settled (queued or running). The
1236
- * bus refuses ordinary wallet messages while this is > 0.
1237
- */
1238
- private pendingInitCount;
1239
- private readonly buildServicesFn;
1240
- private readonly boundOnMessage;
1241
- private readonly intentRepository?;
1242
- private readonly onchainProvider?;
1243
- /** Pending broadcasts, drained FIFO by a single {@link drain} loop. */
1244
- private broadcastQueue;
1245
- private draining;
1246
- /** Bumped wherever the generation owning the queued broadcasts ends. */
1247
- private broadcastEpoch;
1248
- /** Create the service-worker message bus with repositories and handler configuration. */
1249
- constructor(walletRepository: WalletRepository, contractRepository: ContractRepository, { messageHandlers, tickIntervalMs, messageTimeoutMs, messageTimeoutOverrides, intentRepository, onchainProvider, debug, buildServices, }: Options);
1250
- /** Start the message bus and attach service-worker event listeners. */
1251
- start(): Promise<void>;
1252
- /** Stop the message bus, cancel ticks, and stop all registered handlers. */
1253
- stop(): Promise<void>;
1254
- /** Invalidate every broadcast belonging to the outgoing generation. */
1255
- private invalidateBroadcasts;
1256
- private broadcastToClients;
1257
- /**
1258
- * Single fan-out loop, so pushes and tick responses keep one FIFO order.
1259
- * A helper posting per response would race: `clients.matchAll()` gives no
1260
- * cross-call resolution order, and it would de-batch `runTick`.
1261
- */
1262
- private drain;
1263
- /**
1264
- * A dropped batch has no periodic recovery to fall back on now that events
1265
- * no longer ride the tick, so name the loss under {@link Options.debug}.
1266
- */
1267
- private logDroppedBroadcasts;
1268
- private scheduleNextTick;
1269
- private runTick;
1270
- /**
1271
- * Serialize init requests on {@link initChain}.
1272
- * Returns this init's own result.
1273
- */
1274
- private waitForInit;
1275
- /**
1276
- * The bus serves ordinary wallet messages only when it is initialized AND
1277
- * no init is in flight.
1278
- */
1279
- private acceptsWalletMessages;
1280
- private doInit;
1281
- private buildServices;
1282
- private onMessage;
1283
- private processMessage;
1284
- /**
1285
- * Race `promise` against a timeout. Note: this does NOT cancel the
1286
- * underlying work — the original promise keeps running. Call
1287
- * `attachLateDelivery` after catching the timeout to surface the
1288
- * eventual result so the message id does not go silent.
1289
- */
1290
- private withTimeout;
1291
- /**
1292
- * Extract the declared `type` from a request envelope (e.g. "SETTLE").
1293
- * Not every envelope carries a type (PING/INIT are special cased
1294
- * earlier), so this returns undefined for envelopes that lack one.
1295
- */
1296
- private extractMessageType;
1297
- /**
1298
- * Resolve the timeout for an operation. Message-type overrides take
1299
- * precedence over handler-tag overrides, with the bus-wide default
1300
- * (`messageTimeoutMs`) as the final fallback.
1301
- */
1302
- private resolveTimeoutMs;
1303
- /**
1304
- * Build a human-readable label for timeout errors. Format:
1305
- * `"<MESSAGE_TYPE> via <HANDLER_TAG>"` when both are known, else the
1306
- * handler tag alone. Used so timeout errors name the operation the
1307
- * client actually triggered (e.g. SETTLE) rather than just the
1308
- * handler that received it (e.g. WALLET_UPDATER).
1309
- */
1310
- private labelFor;
1311
- /**
1312
- * Post a response to the originating client. When `source` is null
1313
- * (client tab closed, detached frame, etc.) the response cannot be
1314
- * delivered; we log the drop in debug mode so it is not invisible.
1315
- */
1316
- private deliverResponse;
1317
- /**
1318
- * After a handler times out the client has already received a timeout
1319
- * error, but the handler keeps running. Attach a follow-up so the
1320
- * handler's eventual result (or error) is delivered under the same
1321
- * message id, or — if the handler never completes within
1322
- * {@link LATE_DELIVERY_GRACE_MS} — an "Operation abandoned" error is
1323
- * sent so the client's listener (if still attached) does not hang.
1324
- */
1325
- private attachLateDelivery;
1326
- /**
1327
- * Returns the registered SW for the path.
1328
- * It uses the functions in `service-worker-manager.ts` module.
1329
- * @param path
1330
- * @return the Service Worker
1331
- * @throws if not running in a browser environment
1332
- */
1333
- static getServiceWorker(path?: string): Promise<ServiceWorker>;
1334
- /**
1335
- * Set up and register the Service Worker, ensuring it's done once at most.
1336
- * It uses the functions in `service-worker-manager.ts` module.
1337
- * @param path
1338
- * @return the Service Worker
1339
- * @throws if not running in a browser environment
1340
- */
1341
- static setup(path: string): Promise<ServiceWorker>;
1342
- }
1343
-
1344
- /** A leaf node in the Taproot script tree, as consumed by `@scure/btc-signer`'s `p2tr`. */
1345
- interface TaprootLeaf {
1346
- script: Bytes;
1347
- leafVersion: number;
1348
- }
1349
- /** A `p2tr` tree node: a leaf, or a `[left, right]` branch tuple. */
1350
- type TaprootTreeNode = TaprootLeaf | [TaprootTreeNode, TaprootTreeNode];
1351
- /**
1352
- * Assemble a Taproot script tree with btcd's `txscript.AssembleTaprootScriptTree` algorithm
1353
- * (the one arkd uses).
1354
- *
1355
- * `@scure/btc-signer`'s `taprootListToTree` builds a Huffman tree instead; the two agree only for
1356
- * power-of-2 leaf counts. Any other count yields a different merkle root → different output key
1357
- * → arkd rejects spends with `INVALID_PSBT_INPUT`.
1358
- *
1359
- * @param scripts - Raw tapscript bytes per leaf, in TapTree PSBT field order.
1360
- * @returns The nested-tuple form `p2tr` accepts.
1361
- */
1362
- declare function assembleBtcdTaprootTree(scripts: Bytes[]): TaprootTreeNode;
1363
-
1364
- declare enum AssetInputType {
1365
- Unspecified = 0,
1366
- Local = 1,
1367
- /** @deprecated Use {@link AssetInputType.Proof}. */
1368
- Intent = 2,
1369
- Proof = 2
1370
- }
1371
- declare enum AssetRefType {
1372
- Unspecified = 0,
1373
- ByID = 1,
1374
- ByGroup = 2
1375
- }
1376
-
1377
- declare class BufferWriter {
1378
- private buffer;
1379
- write(data: Uint8Array): void;
1380
- writeByte(byte: number): void;
1381
- writeUint16LE(value: number): void;
1382
- writeVarUint(value: bigint | number): void;
1383
- writeVarSlice(data: Uint8Array): void;
1384
- writeCompactSize(value: number): void;
1385
- writeCompactSlice(data: Uint8Array): void;
1386
- toBytes(): Uint8Array;
1387
- }
1388
- declare class BufferReader {
1389
- private view;
1390
- private offset;
1391
- constructor(data: Uint8Array);
1392
- remaining(): number;
1393
- readByte(): number;
1394
- readSlice(size: number): Uint8Array;
1395
- readUint16LE(): number;
1396
- readVarUint(): bigint;
1397
- readVarSlice(): Uint8Array;
1398
- readCompactSize(): number;
1399
- readCompactSlice(): Uint8Array;
1400
- }
1401
-
1402
- /**
1403
- * AssetId identifies a specific asset.
1404
- *
1405
- * @remarks
1406
- * Asset ids are derived from the genesis transaction id plus the asset group index.
1407
- *
1408
- * @see AssetRef
1409
- *
1410
- * @example
1411
- * ```typescript
1412
- * const assetId = AssetId.create('00'.repeat(32), 0)
1413
- * const encoded = assetId.toString()
1414
- * const decoded = AssetId.fromString(encoded)
1415
- * ```
1416
- */
1417
- declare class AssetId {
1418
- readonly txid: Uint8Array;
1419
- readonly groupIndex: number;
1420
- private constructor();
1421
- /**
1422
- * Create a validated asset id from a genesis transaction id and group index.
1423
- *
1424
- * @param txid - Hex-encoded genesis transaction id
1425
- * @param groupIndex - Asset group index within the genesis transaction
1426
- * @throws Error if the txid is missing, malformed, or not 32 bytes long
1427
- * @see fromString
1428
- */
1429
- static create(txid: string, groupIndex: number): AssetId;
1430
- /**
1431
- * Decode an asset id from its hex string representation.
1432
- *
1433
- * @throws Error if the string is not valid hex or does not encode a valid asset id
1434
- * @see toString
1435
- */
1436
- static fromString(s: string): AssetId;
1437
- /**
1438
- * Decode an asset id from its serialized bytes.
1439
- *
1440
- * @throws Error if the buffer length is invalid
1441
- */
1442
- static fromBytes(buf: Uint8Array): AssetId;
1443
- /**
1444
- * Serialize the asset id to raw bytes.
1445
- *
1446
- * @see fromBytes
1447
- */
1448
- serialize(): Uint8Array;
1449
- /**
1450
- * Encode the asset id to a hex string.
1451
- *
1452
- * @see fromString
1453
- */
1454
- toString(): string;
1455
- /**
1456
- * Validate the asset id fields.
1457
- *
1458
- * @throws Error if the txid is empty or the group index is out of range
1459
- */
1460
- validate(): void;
1461
- /**
1462
- * Decode an asset id from a binary reader positioned at one.
1463
- *
1464
- * @throws Error if the reader does not contain enough bytes
1465
- */
1466
- static fromReader(reader: BufferReader): AssetId;
1467
- /**
1468
- * Serialize the asset id into an existing binary writer.
1469
- *
1470
- * @see serialize
1471
- */
1472
- serializeTo(writer: BufferWriter): void;
1473
- }
1474
-
1475
- type AssetRefByID = {
1476
- type: AssetRefType.ByID;
1477
- assetId: AssetId;
1131
+ type RequestGetBoardingAddress = RequestEnvelope & {
1132
+ type: "GET_BOARDING_ADDRESS";
1478
1133
  };
1479
- type AssetRefByGroup = {
1480
- type: AssetRefType.ByGroup;
1481
- groupIndex: number;
1134
+ type ResponseGetBoardingAddress = ResponseEnvelope & {
1135
+ type: "BOARDING_ADDRESS";
1136
+ payload: {
1137
+ address: string;
1138
+ };
1482
1139
  };
1483
- /**
1484
- * Reference to either an explicit asset id or another asset group in the same packet.
1485
- *
1486
- * @see AssetId
1487
- *
1488
- * @example
1489
- * ```typescript
1490
- * const refById = AssetRef.fromId(assetId)
1491
- * const refByGroup = AssetRef.fromGroupIndex(0)
1492
- * ```
1493
- */
1494
- declare class AssetRef {
1495
- readonly ref: AssetRefByID | AssetRefByGroup;
1496
- private constructor();
1497
- /** Reference type discriminator. */
1498
- get type(): AssetRefType;
1499
- /** Reference a specific asset id. @see fromGroupIndex */
1500
- static fromId(assetId: AssetId): AssetRef;
1501
- /**
1502
- * Reference another asset group in the packet.
1503
- *
1504
- * @param groupIndex - Zero-based asset group index in the packet
1505
- * @see fromId
1506
- */
1507
- static fromGroupIndex(groupIndex: number): AssetRef;
1508
- /**
1509
- * Decode an asset reference from hex.
1510
- *
1511
- * @throws Error if the string is not valid hex or does not encode a valid asset reference
1512
- * @see toString
1513
- */
1514
- static fromString(s: string): AssetRef;
1515
- /**
1516
- * Decode an asset reference from its serialized bytes.
1517
- *
1518
- * @throws Error if the buffer is empty or malformed
1519
- */
1520
- static fromBytes(buf: Uint8Array): AssetRef;
1521
- /** Serialize to raw bytes. @see fromBytes */
1522
- serialize(): Uint8Array;
1523
- /** Encode to hex. @see fromString */
1524
- toString(): string;
1525
- /**
1526
- * Decode an asset reference from a reader positioned at one.
1527
- *
1528
- * @throws Error if the type is unknown or the reader does not contain enough bytes
1529
- */
1530
- static fromReader(reader: BufferReader): AssetRef;
1531
- /** Append the serialized reference to `writer`. @see serialize */
1532
- serializeTo(writer: BufferWriter): void;
1533
- }
1534
-
1535
- type AssetInputLocal = {
1536
- type: AssetInputType.Local;
1537
- vin: number;
1538
- amount: bigint;
1140
+ type RequestGetOperatorInfo = RequestEnvelope & {
1141
+ type: "GET_OPERATOR_INFO" | "GET_ARKADE_INFO";
1142
+ payload?: GetOperatorInfoOptions;
1539
1143
  };
1540
- type AssetInputProof = Pick<AssetInputLocal, "vin" | "amount"> & {
1541
- type: AssetInputType.Proof;
1542
- txid: Uint8Array;
1543
- };
1544
- /**
1545
- * AssetInput represents an input of an asset group.
1546
- * a local input references a real transaction input and specify the amount in satoshis.
1547
- * a proof input references an external proof transaction. It is created by the operator to handle batch leaf transaction.
1548
- */
1549
- declare class AssetInput {
1550
- readonly input: AssetInputLocal | AssetInputProof;
1551
- private constructor();
1552
- /** Gets the transaction input index for an asset input, e.g. 0 */
1553
- get vin(): number;
1554
- /** Gets the amount for an input (in most cases, 330 sats) */
1555
- get amount(): bigint;
1556
- /** Create a local asset input that points at a transaction input index. */
1557
- static create(vin: number, amount: bigint | number): AssetInput;
1558
- /** Create a proof-backed asset input referencing an external proof transaction. */
1559
- static createProof(txid: string, vin: number, amount: bigint | number): AssetInput;
1560
- /** @deprecated Use {@link createProof}. */
1561
- static createIntent: typeof AssetInput.createProof;
1562
- /** Decode an asset input from its hex string form. */
1563
- static fromString(s: string): AssetInput;
1564
- /** Decode an asset input from its serialized bytes. */
1565
- static fromBytes(buf: Uint8Array): AssetInput;
1566
- /** Serialize the asset input to raw bytes. */
1567
- serialize(): Uint8Array;
1568
- /** Encode the asset input to a hex string. */
1569
- toString(): string;
1570
- /** Validate the asset input fields. */
1571
- validate(): void;
1572
- /** Decode an asset input from a buffer reader. */
1573
- static fromReader(reader: BufferReader): AssetInput;
1574
- /** Serialize the asset input into an existing buffer writer. */
1575
- serializeTo(writer: BufferWriter): void;
1576
- }
1577
- /**
1578
- * AssetInputs represents a list of asset inputs.
1579
- */
1580
- declare class AssetInputs {
1581
- readonly inputs: AssetInput[];
1582
- private constructor();
1583
- /** Create a validated list of asset inputs. */
1584
- static create(inputs: AssetInput[]): AssetInputs;
1585
- /** Decode an asset input list from its hex string form. */
1586
- static fromString(s: string): AssetInputs;
1587
- /** Serialize the asset input list to raw bytes. */
1588
- serialize(): Uint8Array;
1589
- /** Encode the asset input list to a hex string. */
1590
- toString(): string;
1591
- /** Validate the asset input list. */
1592
- validate(): void;
1593
- /** Decode an asset input list from a buffer reader. */
1594
- static fromReader(reader: BufferReader): AssetInputs;
1595
- /** Serialize the asset input list into an existing buffer writer. */
1596
- serializeTo(writer: BufferWriter): void;
1597
- }
1598
-
1599
- /**
1600
- * AssetOutput references a real transaction output and specify the amount in satoshis.
1601
- * it must be present in an AssetGroup.
1602
- *
1603
- * @param vout - the output index in the transaction
1604
- * @param amount - asset amount in satoshis
1605
- */
1606
- declare class AssetOutput {
1607
- readonly vout: number;
1608
- readonly amount: bigint;
1609
- static readonly TYPE_LOCAL = 1;
1610
- private constructor();
1611
- /** Create a local asset output referencing a transaction output index. */
1612
- static create(vout: number, amount: bigint | number): AssetOutput;
1613
- /** Decode an asset output from its hex string form. */
1614
- static fromString(s: string): AssetOutput;
1615
- /** Decode an asset output from its serialized bytes. */
1616
- static fromBytes(buf: Uint8Array): AssetOutput;
1617
- /** Serialize the asset output to raw bytes. */
1618
- serialize(): Uint8Array;
1619
- /** Encode the asset output to a hex string. */
1620
- toString(): string;
1621
- /** Validate the asset output fields. */
1622
- validate(): void;
1623
- /** Decode an asset output from a buffer reader. */
1624
- static fromReader(reader: BufferReader): AssetOutput;
1625
- /** Serialize the asset output into an existing buffer writer. */
1626
- serializeTo(writer: BufferWriter): void;
1627
- }
1628
- /**
1629
- * AssetOutputs is a list of AssetOutput references.
1630
- * it must be present in an AssetGroup.
1631
- *
1632
- * @param outputs - the list of asset outputs
1633
- */
1634
- declare class AssetOutputs {
1635
- readonly outputs: AssetOutput[];
1636
- private constructor();
1637
- /** Create a validated list of asset outputs. */
1638
- static create(outputs: AssetOutput[]): AssetOutputs;
1639
- /** Decode an asset output list from its hex string form. */
1640
- static fromString(s: string): AssetOutputs;
1641
- /** Serialize the asset output list to raw bytes. */
1642
- serialize(): Uint8Array;
1643
- /** Encode the asset output list to a hex string. */
1644
- toString(): string;
1645
- /** Validate the asset output list. */
1646
- validate(): void;
1647
- /** Decode an asset output list from a buffer reader. */
1648
- static fromReader(reader: BufferReader): AssetOutputs;
1649
- /** Serialize the asset output list into an existing buffer writer. */
1650
- serializeTo(writer: BufferWriter): void;
1651
- }
1652
-
1653
- /**
1654
- * Metadata represents a key-value pair.
1655
- * @param key - the key
1656
- * @param value - the value
1657
- */
1658
- declare class Metadata {
1659
- readonly key: Uint8Array;
1660
- readonly value: Uint8Array;
1661
- private constructor();
1662
- /** Create a metadata entry from raw key and value bytes. */
1663
- static create(key: Bytes, value: Bytes): Metadata;
1664
- /** Decode metadata from its hex string form. */
1665
- static fromString(s: string): Metadata;
1666
- /** Decode metadata from its serialized bytes. */
1667
- static fromBytes(buf: Uint8Array): Metadata;
1668
- /** Serialize metadata to raw bytes. */
1669
- serialize(): Uint8Array;
1670
- /** Encode metadata to a hex string. */
1671
- toString(): string;
1672
- get keyString(): string;
1673
- get valueString(): string;
1674
- /** Validate the metadata key and value. */
1675
- validate(): void;
1676
- /** Decode metadata from a buffer reader. */
1677
- static fromReader(reader: BufferReader): Metadata;
1678
- /** Serialize metadata into an existing buffer writer. */
1679
- serializeTo(writer: BufferWriter): void;
1680
- }
1681
- declare class MetadataList {
1682
- readonly items: Metadata[];
1683
- static readonly ARK_LEAF_TAG = "ArkadeAssetLeaf";
1684
- static readonly ARK_BRANCH_TAG = "ArkadeAssetBranch";
1685
- static readonly ARK_LEAF_VERSION = 0;
1686
- constructor(items: Metadata[]);
1687
- /** Create a metadata list from its hex string form. */
1688
- static fromString(s: string): MetadataList;
1689
- /** Decode a metadata list from its serialized bytes. */
1690
- static fromBytes(buf: Uint8Array): MetadataList;
1691
- /** Decode a metadata list from a buffer reader. */
1692
- static fromReader(reader: BufferReader): MetadataList;
1693
- /** Serialize the metadata list into an existing buffer writer. */
1694
- serializeTo(writer: BufferWriter): void;
1695
- /** Serialize the metadata list to raw bytes. */
1696
- serialize(): Uint8Array;
1697
- /** Iterate through metadata entries in insertion order. */
1698
- [Symbol.iterator](): Iterator<Metadata>;
1699
- get length(): number;
1700
- /** Compute the tagged Merkle root for the metadata list. */
1701
- hash(): Uint8Array;
1702
- }
1703
-
1704
- /**
1705
- * An asset group contains inputs, outputs, and all data related to a given asset id.
1706
- *
1707
- * @see Packet
1708
- * @see AssetId
1709
- * @see AssetRef
1710
- *
1711
- * @example
1712
- * ```typescript
1713
- * const group = AssetGroup.create(
1714
- * null, // asset ID: null for new issuance
1715
- * null, // control asset ID: null when reissuance not needed
1716
- * [], // asset inputs: empty for new issuance
1717
- * [AssetOutput.create(0, 1000)], // asset outputs: 1000 units at vout index 0
1718
- * [] // metadata: can be empty
1719
- * )
1720
- * ```
1721
- */
1722
- declare class AssetGroup {
1723
- readonly assetId: AssetId | null;
1724
- readonly controlAsset: AssetRef | null;
1725
- readonly inputs: AssetInput[];
1726
- readonly outputs: AssetOutput[];
1727
- private readonly metadataList;
1728
- /** @see create */
1729
- constructor(assetId: AssetId | null, controlAsset: AssetRef | null, inputs: AssetInput[], outputs: AssetOutput[], metadata: Metadata[]);
1730
- /**
1731
- * Create and validate an asset group.
1732
- *
1733
- * @param assetId - Asset id for this group, or `null` for fresh issuance
1734
- * @param controlAsset - Optional control asset reference for (re) issuance
1735
- * @param inputs - Asset inputs in the group
1736
- * @param outputs - Asset outputs in the group
1737
- * @param metadata - Metadata entries associated with the group
1738
- * @returns A validated asset group
1739
- * @throws Error if the group fails validation
1740
- * @see validate
1741
- */
1742
- static create(assetId: AssetId | null, controlAsset: AssetRef | null, inputs: AssetInput[], outputs: AssetOutput[], metadata: Metadata[]): AssetGroup;
1743
- /**
1744
- * Decode an asset group from its hex string form.
1745
- *
1746
- * @param s - Hex-encoded asset group
1747
- * @returns Decoded asset group
1748
- * @throws Error if the string is not valid hex or does not encode a valid asset group
1749
- * @see toString
1750
- */
1751
- static fromString(s: string): AssetGroup;
1752
- /**
1753
- * Decode an asset group from its serialized bytes.
1754
- *
1755
- * @param buf - Serialized asset group bytes
1756
- * @returns Decoded asset group
1757
- * @throws Error if the buffer is empty or malformed
1758
- */
1759
- static fromBytes(buf: Uint8Array): AssetGroup;
1760
- /**
1761
- * Return true when the group represents an issuance.
1762
- *
1763
- * @returns `true` when the group has no asset id
1764
- */
1765
- isIssuance(): boolean;
1766
- /**
1767
- * Return true when the group represents a reissuance.
1768
- *
1769
- * @returns `true` when the group has an asset id and outputs exceed local inputs
1770
- * @remarks
1771
- * Only local inputs contribute to the comparison; proof-backed inputs contribute `0` here.
1772
- */
1773
- isReissuance(): boolean;
1774
- /**
1775
- * Serialize the asset group to raw bytes.
1776
- *
1777
- * @returns Serialized asset group bytes
1778
- * @see fromBytes
1779
- */
1780
- serialize(): Uint8Array;
1781
- /**
1782
- * Validate the asset group and its child structures.
1783
- *
1784
- * @throws Error if the group is empty or violates issuance invariants
1785
- */
1786
- validate(): void;
1787
- /**
1788
- * Convert the group into its batch-leaf representation for the given proof txid.
1789
- *
1790
- * @param proofTxid - Proof transaction id used to build the leaf input reference
1791
- * @returns Batch-leaf asset group
1792
- * @see AssetInput.createProof
1793
- */
1794
- toBatchLeafAssetGroup(proofTxid: Uint8Array): AssetGroup;
1795
- /**
1796
- * Encode the asset group to a hex string.
1797
- *
1798
- * @returns Hex-encoded asset group
1799
- * @see fromString
1800
- */
1801
- toString(): string;
1802
- /**
1803
- * Decode an asset group from a binary reader.
1804
- *
1805
- * @param reader - Reader positioned at an asset group
1806
- * @returns Decoded asset group
1807
- * @throws Error if the encoded group is malformed
1808
- */
1809
- static fromReader(reader: BufferReader): AssetGroup;
1810
- /**
1811
- * Serialize the asset group into an existing binary writer.
1812
- *
1813
- * @param writer - Writer to append the asset group to
1814
- */
1815
- serializeTo(writer: BufferWriter): void;
1816
- }
1817
-
1818
- /**
1819
- * ExtensionPacket is the interface that all extension packets must implement.
1820
- * It mirrors the Go extension.Packet interface.
1821
- */
1822
- interface ExtensionPacket {
1823
- /** type returns the 1-byte packet type tag */
1824
- type(): number;
1825
- /** serialize returns the raw bytes of the packet (without type or length prefix) */
1826
- serialize(): Uint8Array;
1827
- }
1828
- /**
1829
- * UnknownPacket holds a packet whose type is not recognized by this implementation.
1830
- * It round-trips opaquely: the raw bytes are preserved as-is.
1831
- */
1832
- declare class UnknownPacket implements ExtensionPacket {
1833
- private readonly packetType;
1834
- private readonly data;
1835
- constructor(packetType: number, data: Uint8Array);
1836
- type(): number;
1837
- serialize(): Uint8Array;
1838
- }
1839
-
1840
- /**
1841
- * Packet represents a collection of asset groups.
1842
- * It encodes/decodes as raw bytes only — OP_RETURN framing is handled by the Extension module.
1843
- */
1844
- declare class Packet implements ExtensionPacket {
1845
- readonly groups: AssetGroup[];
1846
- /** PACKET_TYPE is the 1-byte TLV type tag used in the Extension envelope. */
1847
- static readonly PACKET_TYPE = 0;
1848
- private constructor();
1849
- /** Create a validated asset packet from a list of asset groups. */
1850
- static create(groups: AssetGroup[]): Packet;
1851
- /**
1852
- * fromBytes parses a Packet from raw bytes.
1853
- */
1854
- static fromBytes(buf: Uint8Array): Packet;
1855
- /**
1856
- * fromString parses a Packet from a raw hex string (not an OP_RETURN script).
1857
- */
1858
- static fromString(s: string): Packet;
1859
- /**
1860
- * type returns the TLV packet type tag. Implements ExtensionPacket interface.
1861
- */
1862
- type(): number;
1863
- /** Convert the packet into the batch-leaf form for a specific proof transaction id. */
1864
- leafTxPacket(proofTxid: Uint8Array): Packet;
1865
- /**
1866
- * serialize encodes the packet as raw bytes (varint group count + group data).
1867
- * Does NOT include OP_RETURN, Arkade magic bytes (`ARK`), or TLV type/length; those are
1868
- * added by the Extension module.
1869
- */
1870
- serialize(): Uint8Array;
1871
- /**
1872
- * toString returns the hex-encoded raw packet bytes.
1873
- */
1874
- toString(): string;
1875
- /** Validate packet structure and cross-group references. */
1876
- validate(): void;
1877
- private static fromReader;
1878
- }
1879
-
1880
- /**
1881
- * Cross-repo test vectors for the Arkade Asset ID encodings.
1882
- *
1883
- * @remarks
1884
- * Shipped from `src/` rather than `test/` so consumers outside this package can
1885
- * pin the same bytes: `lightning-swap-service` imports this value, while NArk
1886
- * and go-sdk vendor the backing `assetIdVectors.json` from a pinned revision of
1887
- * this repository. The encoding is implemented in seven places across three
1888
- * repos, and every disagreement fails silently (a flipped txid makes a covenant
1889
- * unsatisfiable, a flipped group index resolves to a different asset).
1890
- */
1891
- interface AssetIdVectors {
1892
- readonly version: number;
1893
- readonly note: string;
1894
- /** Genesis txid in display order — the 32 bytes an id's leading 64 hex chars carry. */
1895
- readonly txid_hex: string;
1896
- /** `txid_hex` reversed: serialization order, what the introspection opcodes match. */
1897
- readonly script_txid_hex: string;
1898
- readonly valid: ReadonlyArray<{
1899
- readonly label: string;
1900
- readonly group_index: number;
1901
- /** `txid_hex` with the group index appended little-endian. */
1902
- readonly asset_id_hex: string;
1903
- /**
1904
- * The group index as a stack item, after script-number encoding and
1905
- * before push framing. Not the raw u16: `65535` is `ffff00` here and
1906
- * `ffff` on the wire, and `0` is the empty item.
1907
- */
1908
- readonly script_group_index_item_hex: string;
1909
- }>;
1910
- /** Refused by the identity rule (`^[0-9a-f]{68}$`), though not necessarily by the decoder. */
1911
- readonly invalid_identity: ReadonlyArray<{
1912
- readonly label: string;
1913
- readonly value: string;
1914
- readonly why: string;
1915
- /** Present when the value still decodes: what `toString()` must return. */
1916
- readonly normalizes_to?: string;
1917
- }>;
1918
- /** Refused by {@link AssetId.fromString} / `fromBytes`. */
1919
- readonly invalid_decode: ReadonlyArray<{
1920
- readonly label: string;
1921
- readonly value: string;
1922
- /** Substring of the thrown message — normative for TS, advisory for other SDKs. */
1923
- readonly expected_error: string;
1924
- }>;
1925
- /** Refused by {@link AssetId.create} / `validate`. */
1926
- readonly invalid_construction: ReadonlyArray<{
1927
- readonly label: string;
1928
- readonly txid_hex: string;
1929
- readonly group_index: number;
1930
- readonly expected_error: string;
1931
- /** Set when the group index cannot be expressed by an SDK whose constructor takes a native u16. */
1932
- readonly outside_uint16?: boolean;
1933
- }>;
1934
- }
1935
- /**
1936
- * The asset-id test vectors, deeply frozen.
1937
- *
1938
- * @remarks
1939
- * Frozen all the way down: the module is a singleton, and one consumer mutating
1940
- * a nested entry would corrupt it for every other consumer in the process.
1941
- *
1942
- * @example
1943
- * ```typescript
1944
- * import { asset } from '@arkade-os/sdk'
1945
- * const { txid_hex, valid } = asset.ASSET_ID_VECTORS
1946
- * expect(AssetId.create(txid_hex, valid[0].group_index).toString()).toBe(valid[0].asset_id_hex)
1947
- * ```
1948
- */
1949
- declare const ASSET_ID_VECTORS: AssetIdVectors;
1950
-
1951
- declare const index$1_ASSET_ID_VECTORS: typeof ASSET_ID_VECTORS;
1952
- type index$1_AssetGroup = AssetGroup;
1953
- declare const index$1_AssetGroup: typeof AssetGroup;
1954
- type index$1_AssetId = AssetId;
1955
- declare const index$1_AssetId: typeof AssetId;
1956
- type index$1_AssetIdVectors = AssetIdVectors;
1957
- type index$1_AssetInput = AssetInput;
1958
- declare const index$1_AssetInput: typeof AssetInput;
1959
- type index$1_AssetInputType = AssetInputType;
1960
- declare const index$1_AssetInputType: typeof AssetInputType;
1961
- type index$1_AssetInputs = AssetInputs;
1962
- declare const index$1_AssetInputs: typeof AssetInputs;
1963
- type index$1_AssetOutput = AssetOutput;
1964
- declare const index$1_AssetOutput: typeof AssetOutput;
1965
- type index$1_AssetOutputs = AssetOutputs;
1966
- declare const index$1_AssetOutputs: typeof AssetOutputs;
1967
- type index$1_AssetRef = AssetRef;
1968
- declare const index$1_AssetRef: typeof AssetRef;
1969
- type index$1_AssetRefType = AssetRefType;
1970
- declare const index$1_AssetRefType: typeof AssetRefType;
1971
- type index$1_Metadata = Metadata;
1972
- declare const index$1_Metadata: typeof Metadata;
1973
- type index$1_MetadataList = MetadataList;
1974
- declare const index$1_MetadataList: typeof MetadataList;
1975
- type index$1_Packet = Packet;
1976
- declare const index$1_Packet: typeof Packet;
1977
- declare namespace index$1 {
1978
- export { index$1_ASSET_ID_VECTORS as ASSET_ID_VECTORS, index$1_AssetGroup as AssetGroup, index$1_AssetId as AssetId, type index$1_AssetIdVectors as AssetIdVectors, index$1_AssetInput as AssetInput, index$1_AssetInputType as AssetInputType, index$1_AssetInputs as AssetInputs, index$1_AssetOutput as AssetOutput, index$1_AssetOutputs as AssetOutputs, index$1_AssetRef as AssetRef, index$1_AssetRefType as AssetRefType, index$1_Metadata as Metadata, index$1_MetadataList as MetadataList, index$1_Packet as Packet };
1979
- }
1980
-
1981
- /**
1982
- * Creates an asset packet from asset inputs and receivers.
1983
- * Groups inputs and outputs by asset ID and creates the Packet object
1984
- * @param assetInputs - map input index -> assets
1985
- * @param receivers - array of recipients with their asset allocations
1986
- * @param changeReceiver - (optional) change receiver containing remaining assets
1987
- * @returns packet containing all asset groups
1988
- */
1989
- declare function createAssetPacket(assetInputs: Map<number, Asset[]>, receivers: Recipient[], changeReceiver?: Recipient): Packet;
1990
- /**
1991
- * Selects coins that contain a specific asset.
1992
- * Returns coins sorted by amount (smallest first for better coin selection).
1993
- */
1994
- declare function selectCoinsWithAsset(coins: ExtendedVirtualCoin[], assetId: string, requiredAmount: bigint): {
1995
- selected: ExtendedVirtualCoin[];
1996
- totalAssetAmount: bigint;
1997
- };
1998
-
1999
- /**
2000
- * Thrown when a collaborative-exit / offboard would leave a change VTXO below
2001
- * the dust threshold. Lets callers (e.g. wallet UI) react with appropriate UX
2002
- * — for instance, offering to exit the full balance — instead of forwarding a
2003
- * server-side dust rejection to the user.
2004
- */
2005
- declare class DustChangeError extends Error {
2006
- readonly change: bigint;
2007
- readonly dustAmount: bigint;
2008
- constructor(change: bigint, dustAmount: bigint);
2009
- }
2010
- /** Thrown when a collaborative exit's change VTXO is above the server's
2011
- * per-output ceiling, which arkd answers with `AMOUNT_TOO_HIGH`. */
2012
- declare class OversizedChangeError extends Error {
2013
- readonly change: bigint;
2014
- readonly maxAmount: bigint;
2015
- constructor(change: bigint, maxAmount: bigint);
2016
- }
2017
- /**
2018
- * Ramps is a class wrapping `settle` method to provide a more convenient interface for onboarding and offboarding operations.
2019
- *
2020
- * @see IWallet.settle
2021
- * @see onboard
2022
- * @see offboard
2023
- *
2024
- * @example
2025
- * ```typescript
2026
- * const ramps = new Ramps(wallet);
2027
- * const feeInfo = { intentFee: {}, txFeeRate: '1' };
2028
- * await ramps.onboard(feeInfo); // onboard all boarding inputs
2029
- * await ramps.offboard('bc1q...', feeInfo); // collaboratively exit all virtual outputs to an onchain address
2030
- * ```
2031
- */
2032
- declare class Ramps {
2033
- readonly wallet: IWallet;
2034
- /**
2035
- * Create convenience wrappers for onboarding and offboarding flows.
2036
- *
2037
- * @param wallet - Wallet used to query funds and execute settlement transactions
2038
- */
2039
- constructor(wallet: IWallet);
2040
- /**
2041
- * Onboard boarding inputs.
2042
- *
2043
- * @param feeInfo - The fee info to deduct from the onboard amount.
2044
- * @param boardingUtxos - Specific boarding inputs to onboard. If not provided, all boarding inputs will be used.
2045
- * @param amount - Amount to onboard. If not provided, the total amount of boarding inputs will be onboarded.
2046
- * @param eventCallback - Optional callback that receives settlement events
2047
- * @returns The Arkade transaction id created by settlement
2048
- * @throws Error if no boarding inputs remain after fee deduction or if `amount` exceeds available value
2049
- * @see IWallet.getBoardingUtxos
2050
- * @see IWallet.settle
2051
- * @example
2052
- * ```typescript
2053
- * const feeInfo = { intentFee: {}, txFeeRate: '1' };
2054
- * const ramps = new Ramps(wallet);
2055
- * await ramps.onboard(feeInfo);
2056
- * ```
2057
- */
2058
- onboard(feeInfo: FeeInfo, boardingUtxos?: ExtendedCoin[], amount?: bigint, eventCallback?: (event: SettlementEvent) => void): ReturnType<IWallet["settle"]>;
2059
- /**
2060
- * Offboard virtual outputs, or collaboratively exit them to an onchain address.
2061
- *
2062
- * @param destinationAddress - The destination address to offboard to.
2063
- * @param feeInfo - The fee info to deduct from the offboard amount.
2064
- * @param amount - The amount to offboard. If not provided, the total amount of virtual outputs will be offboarded.
2065
- * @param eventCallback - Optional callback that receives settlement events
2066
- * @param vtxos - Specific virtual outputs to spend, mirroring {@link onboard}'s
2067
- * `boardingUtxos`. Omitted, every spendable one is spent — merging the whole
2068
- * off-chain balance into a single change output. Taken as given like
2069
- * `settle({ inputs })`: an `amount` these cannot cover is an error, not a top-up.
2070
- * @returns The Arkade transaction id created by settlement
2071
- * @throws Error if no virtual outputs remain after fee deduction or the destination address cannot be decoded
2072
- * @see IWallet.getSpendableVtxos
2073
- * @see IWallet.settle
2074
- * @example
2075
- * ```typescript
2076
- * const feeInfo = { intentFee: {}, txFeeRate: '1' };
2077
- * const ramps = new Ramps(wallet);
2078
- * await ramps.offboard('bc1q...', feeInfo);
2079
- * ```
2080
- */
2081
- offboard(destinationAddress: string, feeInfo: FeeInfo, amount?: bigint, eventCallback?: (event: SettlementEvent) => void, vtxos?: NormalizedExtendedVirtualCoin[]): ReturnType<IWallet["settle"]>;
2082
- /**
2083
- * Collaboratively exit with the DESTINATION paid exactly `amount`, pricing the
2084
- * fee on that output rather than on a grossed-up figure. {@link offboard} keeps
2085
- * the other anchor, which needs `g - fee(g) = amount` solved — impossible for
2086
- * a program charging the whole output.
2087
- *
2088
- * Returns the onchain txid instead when onchain coins alone cover `amount`
2089
- * and were spent via arkd cosigning.
2090
- */
2091
- offboardExact(params: {
2092
- destinationAddress: string;
2093
- feeInfo: FeeInfo;
2094
- /** Sats the destination receives, exactly. */
2095
- amount: bigint;
2096
- eventCallback?: (event: SettlementEvent) => void;
2097
- vtxos?: NormalizedExtendedVirtualCoin[];
2098
- }): ReturnType<IWallet["settle"]>;
2099
- private tryCosign;
2100
- private offboardInputs;
2101
- /** Every candidate, or with `concurrentSpending` the shortest covering prefix in send order. */
2102
- private fundExit;
2103
- /** Re-runs an SDK-picked exit that lost a coin to a concurrent spend. */
2104
- private withRepick;
2105
- /** Fund the change output: pay its own fee, then judge it against both
2106
- * server-side bounds. `0n` in is `0n` out — no change output at all. */
2107
- private fundChange;
2108
- }
2109
-
2110
- /**
2111
- * HD-wallet {@link DescriptorProvider} that allocates a fresh signing descriptor on every call.
2112
- * A pure rotating allocator: which descriptor the wallet is bound to is answered by the contract
2113
- * repository, not this provider.
2114
- *
2115
- * State lives in `settings.hd` of the wallet state, so switching single-key → HD needs no schema
2116
- * migration. Allocation runs inside the shared per-repo `updateWalletState` mutex, so callers
2117
- * (even on separate instances over one repo) never observe the same index.
2118
- *
2119
- * @example
2120
- * ```ts
2121
- * const provider = await HDDescriptorProvider.create(identity, walletRepo);
2122
- * const descriptor = await provider.getNextSigningDescriptor();
2123
- * // descriptor: tr([fp/86'/0'/0']xpub/0/0)
2124
- * const next = await provider.getNextSigningDescriptor();
2125
- * // next: tr([fp/86'/0'/0']xpub/0/1)
2126
- * ```
2127
- */
2128
- declare class HDDescriptorProvider implements DescriptorProvider, ReceiveRotatorFactory {
2129
- private readonly identity;
2130
- private readonly walletRepository;
2131
- private constructor();
2132
- /**
2133
- * Construct an HDDescriptorProvider. No I/O: state is read lazily, so a descriptor-mismatch
2134
- * error surfaces on first use rather than here.
2135
- */
2136
- static create(identity: HDCapableIdentity, walletRepository: WalletRepository): Promise<HDDescriptorProvider>;
2137
- /** Allocate and return the next descriptor (index 0, 1, 2, …), atomically per repo. */
2138
- getNextSigningDescriptor(): Promise<string>;
2139
- /**
2140
- * Re-derive the descriptor `getNextSigningDescriptor` last returned, WITHOUT advancing;
2141
- * `undefined` if none was ever allocated. Lets boot keep the display address stable across
2142
- * restarts when no tagged display contract exists, instead of burning a new index.
2143
- */
2144
- getCurrentSigningDescriptor(): Promise<string | undefined>;
2145
- /** Read-only peek at the allocation watermark; `undefined` if nothing was ever allocated. */
2146
- getLastIndexUsed(): Promise<number | undefined>;
2147
- /**
2148
- * Monotonically advance the watermark past indices found by a restore scan; never rewinds.
2149
- * An invalid `index` (non-integer, negative, or >= 2^31) is ignored: persisting it would make
2150
- * `parseSettings()` throw, and a watermark at the hardened ceiling would fail every later
2151
- * allocation for the life of the repo.
2152
- */
2153
- advanceLastIndexUsed(index: number): Promise<void>;
2154
- /** Whether `descriptor` (HD or simple `tr(pubkey)`) is derivable from this wallet's seed. */
2155
- isOurs(descriptor: string): boolean;
2156
- /** Signs each request with its descriptor's derived key (the identity holds the seed). */
2157
- signWithDescriptor(requests: DescriptorSigningRequest[]): Promise<Transaction[]>;
2158
- /** Signs a message using the key derived from `descriptor`. */
2159
- signMessageWithDescriptor(descriptor: string, message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
2160
- /** HD providers take part in receive rotation via {@link WalletReceiveRotator.defaultBoot}. */
2161
- createReceiveRotator(opts: ReceiveRotatorBootOpts): Promise<ReceiveRotatorBoot | undefined>;
2162
- /**
2163
- * Materialize the account template at `index` via the descriptors-scure parser (validates the
2164
- * ranged template and yields a canonical key expression) rather than string substitution.
2165
- * Pure: does NOT advance the watermark, so restore's gap-scan can peek arbitrary indices.
2166
- */
2167
- materializeDescriptorAt(index: number): string;
2168
- /**
2169
- * Read-modify-write HD settings inside the shared per-repo wallet-state mutex; `fn` mutates a
2170
- * validated snapshot that is persisted atomically. Reading inside the lock prevents races on a
2171
- * stale index.
2172
- */
2173
- private mutate;
2174
- /**
2175
- * Validate persisted HD settings (or init a fresh record) and return a mutable clone. Fails
2176
- * loud: a corrupt repo would otherwise derive `NaN` descriptors.
2177
- */
2178
- private parseSettings;
2179
- }
2180
-
2181
- declare class WalletNotInitializedError extends Error {
2182
- constructor();
2183
- }
2184
- declare class ReadonlyWalletError extends Error {
2185
- constructor();
2186
- }
2187
- declare class DelegateNotConfiguredError extends Error {
2188
- constructor();
2189
- }
2190
- type RequestInitWallet = RequestEnvelope & {
2191
- type: "INIT_WALLET";
2192
- payload: {
2193
- arkServerUrl: string;
2194
- arkServerPublicKey?: string;
2195
- lazyBoarding?: boolean;
2196
- };
2197
- };
2198
- type ResponseInitWallet = ResponseEnvelope & {
2199
- type: "WALLET_INITIALIZED";
2200
- };
2201
- type RequestSettle = RequestEnvelope & {
2202
- type: "SETTLE";
2203
- payload: {
2204
- params?: SettleParams;
2205
- };
2206
- };
2207
- type ResponseSettle = ResponseEnvelope & {
2208
- type: "SETTLE_SUCCESS";
2209
- payload: {
2210
- txid: string;
2211
- };
2212
- };
2213
- type RequestGetAddress = RequestEnvelope & {
2214
- type: "GET_ADDRESS";
2215
- };
2216
- type ResponseGetAddress = ResponseEnvelope & {
2217
- type: "ADDRESS";
2218
- payload: {
2219
- address: string;
2220
- };
2221
- };
2222
- type RequestGetBoardingAddress = RequestEnvelope & {
2223
- type: "GET_BOARDING_ADDRESS";
2224
- };
2225
- type ResponseGetBoardingAddress = ResponseEnvelope & {
2226
- type: "BOARDING_ADDRESS";
2227
- payload: {
2228
- address: string;
2229
- };
2230
- };
2231
- type RequestGetOperatorInfo = RequestEnvelope & {
2232
- type: "GET_OPERATOR_INFO" | "GET_ARKADE_INFO";
2233
- payload?: GetOperatorInfoOptions;
2234
- };
2235
- type ResponseGetOperatorInfo = ResponseEnvelope & {
2236
- type: "OPERATOR_INFO";
2237
- payload: {
2238
- info: OperatorInfo;
2239
- };
1144
+ type ResponseGetOperatorInfo = ResponseEnvelope & {
1145
+ type: "OPERATOR_INFO";
1146
+ payload: {
1147
+ info: OperatorInfo;
1148
+ };
2240
1149
  };
2241
1150
  type RequestIndexerGetVtxos = RequestEnvelope & {
2242
1151
  type: "INDEXER_GET_VTXOS";
@@ -2346,6 +1255,7 @@ type ResponseGetStatus = ResponseEnvelope & {
2346
1255
  payload: {
2347
1256
  walletInitialized: boolean;
2348
1257
  xOnlyPublicKey: Uint8Array | undefined;
1258
+ walletRequestBinding?: WalletRequestBinding;
2349
1259
  providerConnectionState?: ProviderConnectionState;
2350
1260
  };
2351
1261
  };
@@ -2676,6 +1586,29 @@ type ResponseContractEvent = ResponseEnvelope & {
2676
1586
  event: ContractEvent;
2677
1587
  };
2678
1588
  };
1589
+ type RequestReserveVtxos = RequestEnvelope & {
1590
+ type: "RESERVE_SCOPED_VTXOS";
1591
+ payload: {
1592
+ outpoints: Outpoint[];
1593
+ reservationId: string;
1594
+ scope: string;
1595
+ };
1596
+ };
1597
+ type ResponseReserveVtxos = ResponseEnvelope & {
1598
+ type: "VTXOS_RESERVED";
1599
+ };
1600
+ type RequestReleaseVtxos = RequestEnvelope & {
1601
+ type: "RELEASE_SCOPED_VTXOS";
1602
+ /** With `outpoints`, a no-op once the id names other inputs. */
1603
+ payload: {
1604
+ reservationId: string;
1605
+ scope: string;
1606
+ outpoints?: Outpoint[];
1607
+ };
1608
+ };
1609
+ type ResponseReleaseVtxos = ResponseEnvelope & {
1610
+ type: "VTXOS_RELEASED";
1611
+ };
2679
1612
  type RequestSend = RequestEnvelope & {
2680
1613
  type: "SEND";
2681
1614
  payload: {
@@ -2859,239 +1792,1370 @@ type ResponseGetExpiredBoardingUtxos = ResponseEnvelope & {
2859
1792
  type RequestSweepExpiredBoardingUtxos = RequestEnvelope & {
2860
1793
  type: "SWEEP_EXPIRED_BOARDING_UTXOS";
2861
1794
  };
2862
- type ResponseSweepExpiredBoardingUtxos = ResponseEnvelope & {
2863
- type: "SWEEP_EXPIRED_BOARDING_UTXOS_SUCCESS";
2864
- payload: {
2865
- txid: string;
2866
- };
1795
+ type ResponseSweepExpiredBoardingUtxos = ResponseEnvelope & {
1796
+ type: "SWEEP_EXPIRED_BOARDING_UTXOS_SUCCESS";
1797
+ payload: {
1798
+ txid: string;
1799
+ };
1800
+ };
1801
+ type RequestCosignOnchainTx = RequestEnvelope & {
1802
+ type: "COSIGN_ONCHAIN_TX";
1803
+ /** Base64 PSBT. */
1804
+ payload: {
1805
+ psbt: string;
1806
+ };
1807
+ };
1808
+ type ResponseCosignOnchainTx = ResponseEnvelope & {
1809
+ type: "COSIGN_ONCHAIN_TX_SUCCESS";
1810
+ payload: {
1811
+ txid: string;
1812
+ };
1813
+ };
1814
+ type RequestSendOnchain = RequestEnvelope & {
1815
+ type: "SEND_ONCHAIN";
1816
+ payload: SendOnchainParams;
1817
+ };
1818
+ type ResponseSendOnchain = ResponseEnvelope & {
1819
+ type: "SEND_ONCHAIN_SUCCESS";
1820
+ payload: {
1821
+ txid: string;
1822
+ };
1823
+ };
1824
+ type WireMigrationVtxoRef = {
1825
+ txid: string;
1826
+ vout: number;
1827
+ value: number;
1828
+ signerPubKey: string;
1829
+ cutoffDate?: string;
1830
+ };
1831
+ type WireDeprecatedSignerReport = {
1832
+ signerPubKey: string;
1833
+ status: SignerStatus;
1834
+ cutoffDate?: string;
1835
+ secondsUntilCutoff?: number;
1836
+ vtxoCount: number;
1837
+ totalValue: number;
1838
+ boardingCount: number;
1839
+ boardingValue: number;
1840
+ recoverableCount: number;
1841
+ recoverableValue: number;
1842
+ awaitingSweepCount: number;
1843
+ awaitingSweepValue: number;
1844
+ nextSweepEta?: number;
1845
+ };
1846
+ type WireMigrationLegReport = {
1847
+ txid?: string;
1848
+ migrated: WireMigrationVtxoRef[];
1849
+ skipped?: MigrationLegSkipReason;
1850
+ deferred?: number;
1851
+ oversized?: WireMigrationVtxoRef[];
1852
+ error?: string;
1853
+ };
1854
+ type WireDeprecatedSignerMigrationReport = {
1855
+ rotated: boolean;
1856
+ skipped?: MigrationGlobalSkipReason;
1857
+ vtxos?: WireMigrationLegReport;
1858
+ boarding?: WireMigrationLegReport;
1859
+ expired: WireMigrationVtxoRef[];
1860
+ signers: WireDeprecatedSignerReport[];
1861
+ };
1862
+ type RequestMigrateDeprecatedSignerVtxos = RequestEnvelope & {
1863
+ type: "MIGRATE_DEPRECATED_SIGNER_VTXOS";
1864
+ };
1865
+ type ResponseMigrateDeprecatedSignerVtxos = ResponseEnvelope & {
1866
+ type: "MIGRATE_DEPRECATED_SIGNER_VTXOS_SUCCESS";
1867
+ payload: {
1868
+ report: WireDeprecatedSignerMigrationReport;
1869
+ };
1870
+ };
1871
+ type RequestGetDeprecatedSignerStatus = RequestEnvelope & {
1872
+ type: "GET_DEPRECATED_SIGNER_STATUS";
1873
+ };
1874
+ type ResponseGetDeprecatedSignerStatus = ResponseEnvelope & {
1875
+ type: "DEPRECATED_SIGNER_STATUS";
1876
+ payload: {
1877
+ signers: WireDeprecatedSignerReport[];
1878
+ };
1879
+ };
1880
+ type RequestRestoreWallet = RequestEnvelope & {
1881
+ type: "RESTORE_WALLET";
1882
+ payload: {
1883
+ gapLimit?: number;
1884
+ };
1885
+ };
1886
+ type ResponseRestoreWallet = ResponseEnvelope & {
1887
+ type: "RESTORE_WALLET_SUCCESS";
1888
+ };
1889
+ type WalletRequest = RequestInitWallet | RequestSettle | RequestGetAddress | RequestGetBoardingAddress | RequestGetOperatorInfo | 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 | RequestReserveVtxos | RequestReleaseVtxos | RequestSendWithDeadline | RequestSendWithInputExpiryFloor | RequestGetAssetDetails | RequestIssue | RequestReissue | RequestBurn | RequestDelegate | RequestGetDelegateInfo | RequestRecoverVtxos | RequestGetRecoverableBalance | RequestGetExpiringVtxos | RequestRenewVtxos | RequestGetExpiredBoardingUtxos | RequestSweepExpiredBoardingUtxos | RequestCosignOnchainTx | RequestSendOnchain | RequestMigrateDeprecatedSignerVtxos | RequestGetDeprecatedSignerStatus | RequestRestoreWallet | RequestArkadeCash;
1890
+ type ScopedWalletRequest = RequestEnvelope & {
1891
+ type: "SCOPED_WALLET_REQUEST_V1";
1892
+ payload: {
1893
+ binding: WalletRequestBinding;
1894
+ request: WalletRequest;
1895
+ };
1896
+ };
1897
+ type WalletUpdaterRequest = WalletRequest | ScopedWalletRequest;
1898
+ type WalletUpdaterResponse = ResponseEnvelope & {
1899
+ walletRequestBinding?: WalletRequestBinding;
1900
+ } & (ResponseInitWallet | ResponseSettle | ResponseSettleEvent | ResponseGetAddress | ResponseGetBoardingAddress | ResponseGetOperatorInfo | 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 | ResponseReserveVtxos | ResponseReleaseVtxos | ResponseSendDeadlineExceeded | ResponseGetAssetDetails | ResponseIssue | ResponseReissue | ResponseBurn | ResponseDelegate | ResponseGetDelegateInfo | ResponseRecoverVtxos | ResponseRecoverVtxosEvent | ResponseGetRecoverableBalance | ResponseGetExpiringVtxos | ResponseRenewVtxos | ResponseRenewVtxosEvent | ResponseGetExpiredBoardingUtxos | ResponseSweepExpiredBoardingUtxos | ResponseCosignOnchainTx | ResponseSendOnchain | ResponseMigrateDeprecatedSignerVtxos | ResponseMigrateDeprecatedSignerVtxosEvent | ResponseGetDeprecatedSignerStatus | ResponseRestoreWallet | ResponseArkadeCash);
1901
+ declare class WalletMessageHandler implements MessageHandler<WalletUpdaterRequest, WalletUpdaterResponse> {
1902
+ readonly messageTag: string;
1903
+ private wallet;
1904
+ private readonlyWallet;
1905
+ private walletRequestBinding;
1906
+ private readonly inFlightOperations;
1907
+ private readonly longRunningOperations;
1908
+ /** Under the page's re-init retries (~9s) and CLEAR's 10s timeout. */
1909
+ private drainBudgetMs;
1910
+ private arkProvider;
1911
+ private indexerProvider;
1912
+ private walletRepository;
1913
+ private incomingFundsSubscription;
1914
+ private incomingFundsRegistrations;
1915
+ private contractEventsSubscription;
1916
+ private onNextTick;
1917
+ private channel;
1918
+ private incomingFundsEpoch;
1919
+ /**
1920
+ * Supersedes older initializers without touching `incomingFundsEpoch`, so a
1921
+ * re-init that fails before registering leaves the live subscription delivering.
1922
+ */
1923
+ private initEpoch;
1924
+ private contractEventsEpoch;
1925
+ private boardingEpoch;
1926
+ /** Per-request progress callbacks: ends with the handler, not with a re-init. */
1927
+ private requestEpoch;
1928
+ /**
1929
+ * Instantiate a new WalletUpdater.
1930
+ * Can override the default `messageTag` allowing more than one updater to run in parallel.
1931
+ * Note that the default ServiceWorkerWallet sends messages to the default WalletUpdater tag.
1932
+ */
1933
+ constructor(options?: {
1934
+ messageTag?: string;
1935
+ });
1936
+ start(...params: Parameters<MessageHandler<WalletUpdaterRequest, WalletUpdaterResponse>["start"]>): Promise<void>;
1937
+ stop(): Promise<void>;
1938
+ tick(_now: number): Promise<WalletUpdaterResponse[]>;
1939
+ private epochOf;
1940
+ private newGeneration;
1941
+ /**
1942
+ * A handle rather than a `broadcast(response, epoch)` call, because it can
1943
+ * only be written where the closure it guards is created — an epoch passed
1944
+ * at the call site reads identically whether it guards anything or not.
1945
+ */
1946
+ private newEmitter;
1947
+ private requireWallet;
1948
+ private captureRequestContext;
1949
+ private runOwnedOperation;
1950
+ private requireReservationWallet;
1951
+ private tagged;
1952
+ isLongRunning(message: WalletUpdaterRequest): boolean;
1953
+ getRequestType(message: WalletUpdaterRequest): string | undefined;
1954
+ handleMessage(message: WalletUpdaterRequest): Promise<WalletUpdaterResponse>;
1955
+ private dispatchOperation;
1956
+ private handleInitWallet;
1957
+ /** @see RequestInitWallet.payload.lazyBoarding */
1958
+ private lazyBoardingInit;
1959
+ /** Set once this session has actually fetched the boarding addresses. */
1960
+ private boardingLoaded;
1961
+ /**
1962
+ * The worker's own balance. Same bucketing rules as `Wallet.getBalance` —
1963
+ * both call {@link computeOffchainBalance} — but deliberately a different
1964
+ * freshness: this reads the repository directly, with no indexer sync, so a
1965
+ * polling UI never pays for a network round-trip. That rules out
1966
+ * `pendingRecoveryOutpoints()`, whose snapshot syncs; the same classification
1967
+ * runs over this method's local snapshot instead.
1968
+ */
1969
+ private handleGetBalance;
1970
+ private getBoardingUtxosForBalance;
1971
+ private onWalletInitialized;
1972
+ private registerIncomingFunds;
1973
+ /**
1974
+ * Refresh boarding inputs and transaction history. The virtual outputs come
1975
+ * from the contract manager, which runs before this. Shared by
1976
+ * onWalletInitialized (full bootstrap) and reloadWallet (post-refresh),
1977
+ * avoiding duplicate subscriptions and VtxoManager restarts.
1978
+ *
1979
+ * Both legs reach the onchain provider, so `lazyBoarding` moves them both
1980
+ * off the caller's path. @see RequestInitWallet.payload.lazyBoarding
1981
+ */
1982
+ private refreshCachedData;
1983
+ /** History rows plus the address they are stored under. Does not write. */
1984
+ private loadHistoryCache;
1985
+ private storeHistoryCache;
1986
+ /** @param gen - set by a background caller; the refresh is skipped once it goes stale. */
1987
+ private refreshBoardingCache;
1988
+ /**
1989
+ * Force a full VTXO refresh from the indexer, then refresh cached data.
1990
+ * Used by RELOAD_WALLET to ensure fresh data without re-subscribing
1991
+ * to incoming funds or restarting the VtxoManager.
1992
+ */
1993
+ private reloadWallet;
1994
+ private handleSettle;
1995
+ private handleSignTransaction;
1996
+ private handleDelegate;
1997
+ /**
1998
+ * Ungated repository read mirroring `Wallet.getVtxos`, the raw reporting read.
1999
+ */
2000
+ private handleGetVtxos;
2001
+ /** Tear down handler subscriptions, then delegate the full wipe to the wallet. */
2002
+ private clear;
2003
+ /**
2004
+ * Read all virtual outputs from the repository, aggregated across all contract
2005
+ * addresses and the wallet's primary address, with deduplication.
2006
+ *
2007
+ * Recovery-only contracts (imported by `claimCash` for operator-swept
2008
+ * arkcash) are excluded by default, mirroring {@link ReadonlyWallet.getVtxos}:
2009
+ * they are settled in their own isolated intent and must stay out of the
2010
+ * wallet's balance / VTXO / coin-selection / pending-tx views that read this.
2011
+ * Transaction history excludes them too, as does the non-worker
2012
+ * `getTransactionHistory`.
2013
+ */
2014
+ private getVtxosFromRepo;
2015
+ /**
2016
+ * The worker's equivalent of `ReadonlyWallet.contractSnapshot`: contracts
2017
+ * paired with the VTXOs the repository holds for them, plus the flat
2018
+ * deduplicated list. Purely local — unlike the main-thread snapshot it never
2019
+ * syncs against the indexer.
2020
+ *
2021
+ * One read of the contract rows serves both halves. Reading them twice
2022
+ * (once for the VTXO buckets, once for the gate) races the contract
2023
+ * manager's own writes: a contract registered between the two reads yields
2024
+ * VTXOs with no matching row in the gate, and `gatedContracts` lists only
2025
+ * what it knows is closed — so the coins of a just-registered escrowed
2026
+ * contract would count as available until the next poll.
2027
+ *
2028
+ * Recovery-only contracts are skipped (see {@link getVtxosFromRepo}).
2029
+ */
2030
+ private repoSnapshot;
2031
+ /**
2032
+ * Build transaction history from cached virtual outputs, hitting the indexer only for
2033
+ * uncached timestamps. Best-effort, like the plain Wallet path.
2034
+ *
2035
+ * Takes its own {@link repoSnapshot} rather than a caller-supplied VTXO
2036
+ * list: the coins and the gate that judges them have to come off one read
2037
+ * or they answer about different instants, and being the worker's only
2038
+ * history builder means neither caller can supply one without the other.
2039
+ * The snapshot and the boarding read are independent, so they run together
2040
+ * — the same pairing `handleGetBalance` makes.
2041
+ */
2042
+ private buildTransactionHistoryFromCache;
2043
+ private ensureContractEventBroadcasting;
2044
+ }
2045
+
2046
+ type WalletRequestBinding = {
2047
+ readonly scope: string;
2048
+ readonly network: NetworkName;
2049
+ };
2050
+
2051
+ type RequestEnvelope = {
2052
+ tag: string;
2053
+ id: string;
2054
+ broadcast?: boolean;
2867
2055
  };
2868
- type RequestCosignOnchainTx = RequestEnvelope & {
2869
- type: "COSIGN_ONCHAIN_TX";
2870
- /** Base64 PSBT. */
2871
- payload: {
2872
- psbt: string;
2873
- };
2056
+ type ResponseEnvelope = {
2057
+ tag: string;
2058
+ id?: string;
2059
+ error?: Error;
2060
+ /**
2061
+ * `error.name`, carried beside the error as an ordinary string. The
2062
+ * structured-clone algorithm serializes an Error's `name` only from the
2063
+ * built-in whitelist (Error, TypeError, RangeError, …) — a custom name
2064
+ * like `ProviderUnavailableError` reaches the page as `"Error"`. A plain
2065
+ * property survives verbatim, so the page restores it before rejecting.
2066
+ * Absent from workers built before it existed; the page then sees the
2067
+ * clone-normalized name, exactly as it always did.
2068
+ */
2069
+ errorName?: string;
2070
+ broadcast?: boolean;
2874
2071
  };
2875
- type ResponseCosignOnchainTx = ResponseEnvelope & {
2876
- type: "COSIGN_ONCHAIN_TX_SUCCESS";
2877
- payload: {
2878
- txid: string;
2879
- };
2072
+ type MessageBusServices = {
2073
+ arkProvider: OperatorProvider;
2074
+ wallet?: Wallet;
2075
+ readonlyWallet: ReadonlyWallet;
2076
+ vtxoReservationScope?: string;
2077
+ walletRequestBinding?: WalletRequestBinding;
2880
2078
  };
2881
- type RequestSendOnchain = RequestEnvelope & {
2882
- type: "SEND_ONCHAIN";
2883
- payload: SendOnchainParams;
2079
+ interface MessageHandler<REQ extends RequestEnvelope = RequestEnvelope, RES extends ResponseEnvelope = ResponseEnvelope> {
2080
+ /**
2081
+ * A unique identifier for the updater.
2082
+ * This is used to route messages to the correct updater.
2083
+ */
2084
+ readonly messageTag: string;
2085
+ /**
2086
+ * Called once when the SW is starting up
2087
+ * @param services - Providers and wallet instances available to the handler.
2088
+ * @param repositories - Repositories available to the handler.
2089
+ * @param channel - Push channel to clients, for responses that answer no
2090
+ * request. Use it instead of holding events for the next {@link tick}.
2091
+ * The channel is scoped to the generation it was handed out in: after a
2092
+ * bus re-init or `stop()` it goes inert on its own, so retaining one past
2093
+ * `stop()` cannot post.
2094
+ **/
2095
+ start(services: MessageBusServices, repositories: {
2096
+ walletRepository: WalletRepository;
2097
+ }, channel?: {
2098
+ broadcast(response: RES): void;
2099
+ }): Promise<void>;
2100
+ /** Called once when the SW is shutting down */
2101
+ stop(): Promise<void>;
2102
+ /**
2103
+ * Called by the scheduler to perform a tick.
2104
+ * Can be used by the updater to perform periodic tasks or return
2105
+ * delayed responses (eg: subscriptions).
2106
+ * @param now The current time in milliseconds since the epoch.
2107
+ **/
2108
+ tick(now: number): Promise<RES[]>;
2109
+ /**
2110
+ * Handle routed messages from the clients
2111
+ **/
2112
+ handleMessage(message: REQ): Promise<RES | null>;
2113
+ /**
2114
+ * Optional opt-out from the bus-level message timeout.
2115
+ *
2116
+ * Long-running flows (e.g. settlement) surrender control to remote peers
2117
+ * and can legitimately sit idle for longer than `messageTimeoutMs`. When
2118
+ * this returns true, the bus awaits `handleMessage` without a deadline.
2119
+ * Defaults to false.
2120
+ */
2121
+ isLongRunning?(message: REQ): boolean;
2122
+ /** Logical operation for timeout overrides when a handler uses a transport wrapper. */
2123
+ getRequestType?(message: REQ): string | undefined;
2124
+ }
2125
+ type Options = {
2126
+ messageHandlers: MessageHandler[];
2127
+ tickIntervalMs?: number;
2128
+ messageTimeoutMs?: number;
2129
+ /**
2130
+ * Per-operation timeout overrides. Keys are either message types
2131
+ * (e.g. "SETTLE") or handler tags (e.g. "WALLET_UPDATER"). Message-type
2132
+ * matches take precedence over tag matches. Unspecified operations use
2133
+ * `messageTimeoutMs`. These are treated as defaults: any map supplied
2134
+ * via `INITIALIZE_MESSAGE_BUS` overrides per-key and is re-applied on
2135
+ * every (re-)init.
2136
+ */
2137
+ messageTimeoutOverrides?: Record<string, number>;
2138
+ /**
2139
+ * Optional intent-lifecycle repository, handed to the worker's wallet as
2140
+ * `storage.intentRepository`. Same opt-in as a main-thread wallet: without
2141
+ * it the worker persists no settlement intent, reconciles none on restart,
2142
+ * and counts intent-locked VTXOs as available. Pass the same repository the
2143
+ * main thread uses so both sides read one intent state, but settle from one
2144
+ * side only: reconciliation deletes from the server any pending intent the
2145
+ * worker's wallet is not settling itself.
2146
+ *
2147
+ * Ignored when `buildServices` is supplied — that override owns `storage`.
2148
+ */
2149
+ intentRepository?: BatchRegistrationRepository;
2150
+ /** The worker wallet's onchain provider, per network: an instance cannot cross `postMessage`.
2151
+ * Called on every init and never closed, so return one instance per network. Defaults to
2152
+ * Esplora; ignored when `buildServices` is supplied. */
2153
+ onchainProvider?: (network: NetworkName) => OnchainProvider;
2154
+ debug?: boolean;
2155
+ buildServices?: (config: Initialize["config"]) => Promise<MessageBusServices>;
2884
2156
  };
2885
- type ResponseSendOnchain = ResponseEnvelope & {
2886
- type: "SEND_ONCHAIN_SUCCESS";
2887
- payload: {
2888
- txid: string;
2157
+ type Initialize = {
2158
+ type: "INITIALIZE_MESSAGE_BUS";
2159
+ id: string;
2160
+ config: {
2161
+ wallet: SerializedIdentity;
2162
+ arkServer: {
2163
+ url: string;
2164
+ publicKey?: string;
2165
+ };
2166
+ delegateUrl?: string;
2167
+ settlementConfig?: SettlementConfig | false;
2168
+ /** @see WalletConfig.concurrentSpending */
2169
+ concurrentSpending?: boolean;
2170
+ walletMode?: "auto" | "static" | "hd";
2171
+ lazyInitialization?: boolean;
2172
+ watcherConfig?: Partial<Omit<ContractWatcherConfig, "indexerProvider">>;
2173
+ /** @see WalletConfig.lookAheadWindow */
2174
+ lookAheadWindow?: number;
2175
+ /** @see WalletConfig.oneShotSubmit */
2176
+ oneShotSubmit?: boolean;
2177
+ /** @see WalletConfig.minBatchExpirySeconds */
2178
+ minBatchExpirySeconds?: bigint;
2179
+ /**
2180
+ * Page-supplied per-operation timeout map. Keys are message types
2181
+ * (e.g. "SETTLE"). Overrides constructor-supplied
2182
+ * `messageTimeoutOverrides` per-key; re-applied on every init.
2183
+ */
2184
+ messageTimeouts?: Record<string, number>;
2889
2185
  };
2890
2186
  };
2891
- type WireMigrationVtxoRef = {
2892
- txid: string;
2893
- vout: number;
2894
- value: number;
2895
- signerPubKey: string;
2896
- cutoffDate?: string;
2897
- };
2898
- type WireDeprecatedSignerReport = {
2899
- signerPubKey: string;
2900
- status: SignerStatus;
2901
- cutoffDate?: string;
2902
- secondsUntilCutoff?: number;
2903
- vtxoCount: number;
2904
- totalValue: number;
2905
- boardingCount: number;
2906
- boardingValue: number;
2907
- recoverableCount: number;
2908
- recoverableValue: number;
2909
- awaitingSweepCount: number;
2910
- awaitingSweepValue: number;
2911
- nextSweepEta?: number;
2912
- };
2913
- type WireMigrationLegReport = {
2914
- txid?: string;
2915
- migrated: WireMigrationVtxoRef[];
2916
- skipped?: MigrationLegSkipReason;
2917
- deferred?: number;
2918
- oversized?: WireMigrationVtxoRef[];
2919
- error?: string;
2920
- };
2921
- type WireDeprecatedSignerMigrationReport = {
2922
- rotated: boolean;
2923
- skipped?: MigrationGlobalSkipReason;
2924
- vtxos?: WireMigrationLegReport;
2925
- boarding?: WireMigrationLegReport;
2926
- expired: WireMigrationVtxoRef[];
2927
- signers: WireDeprecatedSignerReport[];
2928
- };
2929
- type RequestMigrateDeprecatedSignerVtxos = RequestEnvelope & {
2930
- type: "MIGRATE_DEPRECATED_SIGNER_VTXOS";
2931
- };
2932
- type ResponseMigrateDeprecatedSignerVtxos = ResponseEnvelope & {
2933
- type: "MIGRATE_DEPRECATED_SIGNER_VTXOS_SUCCESS";
2934
- payload: {
2935
- report: WireDeprecatedSignerMigrationReport;
2936
- };
2187
+ declare class MessageBus {
2188
+ private readonly walletRepository;
2189
+ private readonly contractRepository;
2190
+ private handlers;
2191
+ private tickIntervalMs;
2192
+ private messageTimeoutMs;
2193
+ private readonly constructorTimeoutOverrides;
2194
+ private messageTimeoutOverrides;
2195
+ private lateDeliveries;
2196
+ private running;
2197
+ private tickTimeout;
2198
+ private tickInProgress;
2199
+ private debug;
2200
+ private initialized;
2201
+ /**
2202
+ * FIFO chain that serializes `INITIALIZE_MESSAGE_BUS` handling. Each init
2203
+ * runs to completion in enqueue order.
2204
+ */
2205
+ private initChain;
2206
+ /**
2207
+ * Number of inits accepted but not yet settled (queued or running). The
2208
+ * bus refuses ordinary wallet messages while this is > 0.
2209
+ */
2210
+ private pendingInitCount;
2211
+ private readonly buildServicesFn;
2212
+ private readonly boundOnMessage;
2213
+ private readonly intentRepository?;
2214
+ private reservationStore?;
2215
+ private readonly onchainProvider?;
2216
+ /** Pending broadcasts, drained FIFO by a single {@link drain} loop. */
2217
+ private broadcastQueue;
2218
+ private draining;
2219
+ /** Bumped wherever the generation owning the queued broadcasts ends. */
2220
+ private broadcastEpoch;
2221
+ /** Create the service-worker message bus with repositories and handler configuration. */
2222
+ constructor(walletRepository: WalletRepository, contractRepository: ContractRepository, { messageHandlers, tickIntervalMs, messageTimeoutMs, messageTimeoutOverrides, intentRepository, onchainProvider, debug, buildServices, }: Options);
2223
+ /** Start the message bus and attach service-worker event listeners. */
2224
+ start(): Promise<void>;
2225
+ /** Stop the message bus, cancel ticks, and stop all registered handlers. */
2226
+ stop(): Promise<void>;
2227
+ /** Invalidate every broadcast belonging to the outgoing generation. */
2228
+ private invalidateBroadcasts;
2229
+ private broadcastToClients;
2230
+ /**
2231
+ * Single fan-out loop, so pushes and tick responses keep one FIFO order.
2232
+ * A helper posting per response would race: `clients.matchAll()` gives no
2233
+ * cross-call resolution order, and it would de-batch `runTick`.
2234
+ */
2235
+ private drain;
2236
+ /**
2237
+ * A dropped batch has no periodic recovery to fall back on now that events
2238
+ * no longer ride the tick, so name the loss under {@link Options.debug}.
2239
+ */
2240
+ private logDroppedBroadcasts;
2241
+ private scheduleNextTick;
2242
+ private runTick;
2243
+ /**
2244
+ * Serialize init requests on {@link initChain}.
2245
+ * Returns this init's own result.
2246
+ */
2247
+ private waitForInit;
2248
+ /**
2249
+ * The bus serves ordinary wallet messages only when it is initialized AND
2250
+ * no init is in flight.
2251
+ */
2252
+ private acceptsWalletMessages;
2253
+ private doInit;
2254
+ private buildServices;
2255
+ private onMessage;
2256
+ private processMessage;
2257
+ /**
2258
+ * Race `promise` against a timeout. Note: this does NOT cancel the
2259
+ * underlying work — the original promise keeps running. Call
2260
+ * `attachLateDelivery` after catching the timeout to surface the
2261
+ * eventual result so the message id does not go silent.
2262
+ */
2263
+ private withTimeout;
2264
+ /**
2265
+ * Extract the declared `type` from a request envelope (e.g. "SETTLE").
2266
+ * Not every envelope carries a type (PING/INIT are special cased
2267
+ * earlier), so this returns undefined for envelopes that lack one.
2268
+ */
2269
+ private extractMessageType;
2270
+ /**
2271
+ * Resolve the timeout for an operation. Message-type overrides take
2272
+ * precedence over handler-tag overrides, with the bus-wide default
2273
+ * (`messageTimeoutMs`) as the final fallback.
2274
+ */
2275
+ private resolveTimeoutMs;
2276
+ /**
2277
+ * Build a human-readable label for timeout errors. Format:
2278
+ * `"<MESSAGE_TYPE> via <HANDLER_TAG>"` when both are known, else the
2279
+ * handler tag alone. Used so timeout errors name the operation the
2280
+ * client actually triggered (e.g. SETTLE) rather than just the
2281
+ * handler that received it (e.g. WALLET_UPDATER).
2282
+ */
2283
+ private labelFor;
2284
+ /**
2285
+ * Post a response to the originating client. When `source` is null
2286
+ * (client tab closed, detached frame, etc.) the response cannot be
2287
+ * delivered; we log the drop in debug mode so it is not invisible.
2288
+ */
2289
+ private deliverResponse;
2290
+ /**
2291
+ * After a handler times out the client has already received a timeout
2292
+ * error, but the handler keeps running. Attach a follow-up so the
2293
+ * handler's eventual result (or error) is delivered under the same
2294
+ * message id, or — if the handler never completes within
2295
+ * {@link LATE_DELIVERY_GRACE_MS} — an "Operation abandoned" error is
2296
+ * sent so the client's listener (if still attached) does not hang.
2297
+ */
2298
+ private attachLateDelivery;
2299
+ /**
2300
+ * Returns the registered SW for the path.
2301
+ * It uses the functions in `service-worker-manager.ts` module.
2302
+ * @param path
2303
+ * @return the Service Worker
2304
+ * @throws if not running in a browser environment
2305
+ */
2306
+ static getServiceWorker(path?: string): Promise<ServiceWorker>;
2307
+ /**
2308
+ * Set up and register the Service Worker, ensuring it's done once at most.
2309
+ * It uses the functions in `service-worker-manager.ts` module.
2310
+ * @param path
2311
+ * @return the Service Worker
2312
+ * @throws if not running in a browser environment
2313
+ */
2314
+ static setup(path: string): Promise<ServiceWorker>;
2315
+ }
2316
+
2317
+ /** A leaf node in the Taproot script tree, as consumed by `@scure/btc-signer`'s `p2tr`. */
2318
+ interface TaprootLeaf {
2319
+ script: Bytes;
2320
+ leafVersion: number;
2321
+ }
2322
+ /** A `p2tr` tree node: a leaf, or a `[left, right]` branch tuple. */
2323
+ type TaprootTreeNode = TaprootLeaf | [TaprootTreeNode, TaprootTreeNode];
2324
+ /**
2325
+ * Assemble a Taproot script tree with btcd's `txscript.AssembleTaprootScriptTree` algorithm
2326
+ * (the one arkd uses).
2327
+ *
2328
+ * `@scure/btc-signer`'s `taprootListToTree` builds a Huffman tree instead; the two agree only for
2329
+ * power-of-2 leaf counts. Any other count yields a different merkle root → different output key
2330
+ * → arkd rejects spends with `INVALID_PSBT_INPUT`.
2331
+ *
2332
+ * @param scripts - Raw tapscript bytes per leaf, in TapTree PSBT field order.
2333
+ * @returns The nested-tuple form `p2tr` accepts.
2334
+ */
2335
+ declare function assembleBtcdTaprootTree(scripts: Bytes[]): TaprootTreeNode;
2336
+
2337
+ declare enum AssetInputType {
2338
+ Unspecified = 0,
2339
+ Local = 1,
2340
+ /** @deprecated Use {@link AssetInputType.Proof}. */
2341
+ Intent = 2,
2342
+ Proof = 2
2343
+ }
2344
+ declare enum AssetRefType {
2345
+ Unspecified = 0,
2346
+ ByID = 1,
2347
+ ByGroup = 2
2348
+ }
2349
+
2350
+ declare class BufferWriter {
2351
+ private buffer;
2352
+ write(data: Uint8Array): void;
2353
+ writeByte(byte: number): void;
2354
+ writeUint16LE(value: number): void;
2355
+ writeVarUint(value: bigint | number): void;
2356
+ writeVarSlice(data: Uint8Array): void;
2357
+ writeCompactSize(value: number): void;
2358
+ writeCompactSlice(data: Uint8Array): void;
2359
+ toBytes(): Uint8Array;
2360
+ }
2361
+ declare class BufferReader {
2362
+ private view;
2363
+ private offset;
2364
+ constructor(data: Uint8Array);
2365
+ remaining(): number;
2366
+ readByte(): number;
2367
+ readSlice(size: number): Uint8Array;
2368
+ readUint16LE(): number;
2369
+ readVarUint(): bigint;
2370
+ readVarSlice(): Uint8Array;
2371
+ readCompactSize(): number;
2372
+ readCompactSlice(): Uint8Array;
2373
+ }
2374
+
2375
+ /**
2376
+ * AssetId identifies a specific asset.
2377
+ *
2378
+ * @remarks
2379
+ * Asset ids are derived from the genesis transaction id plus the asset group index.
2380
+ *
2381
+ * @see AssetRef
2382
+ *
2383
+ * @example
2384
+ * ```typescript
2385
+ * const assetId = AssetId.create('00'.repeat(32), 0)
2386
+ * const encoded = assetId.toString()
2387
+ * const decoded = AssetId.fromString(encoded)
2388
+ * ```
2389
+ */
2390
+ declare class AssetId {
2391
+ readonly txid: Uint8Array;
2392
+ readonly groupIndex: number;
2393
+ private constructor();
2394
+ /**
2395
+ * Create a validated asset id from a genesis transaction id and group index.
2396
+ *
2397
+ * @param txid - Hex-encoded genesis transaction id
2398
+ * @param groupIndex - Asset group index within the genesis transaction
2399
+ * @throws Error if the txid is missing, malformed, or not 32 bytes long
2400
+ * @see fromString
2401
+ */
2402
+ static create(txid: string, groupIndex: number): AssetId;
2403
+ /**
2404
+ * Decode an asset id from its hex string representation.
2405
+ *
2406
+ * @throws Error if the string is not valid hex or does not encode a valid asset id
2407
+ * @see toString
2408
+ */
2409
+ static fromString(s: string): AssetId;
2410
+ /**
2411
+ * Decode an asset id from its serialized bytes.
2412
+ *
2413
+ * @throws Error if the buffer length is invalid
2414
+ */
2415
+ static fromBytes(buf: Uint8Array): AssetId;
2416
+ /**
2417
+ * Serialize the asset id to raw bytes.
2418
+ *
2419
+ * @see fromBytes
2420
+ */
2421
+ serialize(): Uint8Array;
2422
+ /**
2423
+ * Encode the asset id to a hex string.
2424
+ *
2425
+ * @see fromString
2426
+ */
2427
+ toString(): string;
2428
+ /**
2429
+ * Validate the asset id fields.
2430
+ *
2431
+ * @throws Error if the txid is empty or the group index is out of range
2432
+ */
2433
+ validate(): void;
2434
+ /**
2435
+ * Decode an asset id from a binary reader positioned at one.
2436
+ *
2437
+ * @throws Error if the reader does not contain enough bytes
2438
+ */
2439
+ static fromReader(reader: BufferReader): AssetId;
2440
+ /**
2441
+ * Serialize the asset id into an existing binary writer.
2442
+ *
2443
+ * @see serialize
2444
+ */
2445
+ serializeTo(writer: BufferWriter): void;
2446
+ }
2447
+
2448
+ type AssetRefByID = {
2449
+ type: AssetRefType.ByID;
2450
+ assetId: AssetId;
2937
2451
  };
2938
- type RequestGetDeprecatedSignerStatus = RequestEnvelope & {
2939
- type: "GET_DEPRECATED_SIGNER_STATUS";
2452
+ type AssetRefByGroup = {
2453
+ type: AssetRefType.ByGroup;
2454
+ groupIndex: number;
2940
2455
  };
2941
- type ResponseGetDeprecatedSignerStatus = ResponseEnvelope & {
2942
- type: "DEPRECATED_SIGNER_STATUS";
2943
- payload: {
2944
- signers: WireDeprecatedSignerReport[];
2945
- };
2456
+ /**
2457
+ * Reference to either an explicit asset id or another asset group in the same packet.
2458
+ *
2459
+ * @see AssetId
2460
+ *
2461
+ * @example
2462
+ * ```typescript
2463
+ * const refById = AssetRef.fromId(assetId)
2464
+ * const refByGroup = AssetRef.fromGroupIndex(0)
2465
+ * ```
2466
+ */
2467
+ declare class AssetRef {
2468
+ readonly ref: AssetRefByID | AssetRefByGroup;
2469
+ private constructor();
2470
+ /** Reference type discriminator. */
2471
+ get type(): AssetRefType;
2472
+ /** Reference a specific asset id. @see fromGroupIndex */
2473
+ static fromId(assetId: AssetId): AssetRef;
2474
+ /**
2475
+ * Reference another asset group in the packet.
2476
+ *
2477
+ * @param groupIndex - Zero-based asset group index in the packet
2478
+ * @see fromId
2479
+ */
2480
+ static fromGroupIndex(groupIndex: number): AssetRef;
2481
+ /**
2482
+ * Decode an asset reference from hex.
2483
+ *
2484
+ * @throws Error if the string is not valid hex or does not encode a valid asset reference
2485
+ * @see toString
2486
+ */
2487
+ static fromString(s: string): AssetRef;
2488
+ /**
2489
+ * Decode an asset reference from its serialized bytes.
2490
+ *
2491
+ * @throws Error if the buffer is empty or malformed
2492
+ */
2493
+ static fromBytes(buf: Uint8Array): AssetRef;
2494
+ /** Serialize to raw bytes. @see fromBytes */
2495
+ serialize(): Uint8Array;
2496
+ /** Encode to hex. @see fromString */
2497
+ toString(): string;
2498
+ /**
2499
+ * Decode an asset reference from a reader positioned at one.
2500
+ *
2501
+ * @throws Error if the type is unknown or the reader does not contain enough bytes
2502
+ */
2503
+ static fromReader(reader: BufferReader): AssetRef;
2504
+ /** Append the serialized reference to `writer`. @see serialize */
2505
+ serializeTo(writer: BufferWriter): void;
2506
+ }
2507
+
2508
+ type AssetInputLocal = {
2509
+ type: AssetInputType.Local;
2510
+ vin: number;
2511
+ amount: bigint;
2946
2512
  };
2947
- type RequestRestoreWallet = RequestEnvelope & {
2948
- type: "RESTORE_WALLET";
2949
- payload: {
2950
- gapLimit?: number;
2951
- };
2513
+ type AssetInputProof = Pick<AssetInputLocal, "vin" | "amount"> & {
2514
+ type: AssetInputType.Proof;
2515
+ txid: Uint8Array;
2952
2516
  };
2953
- type ResponseRestoreWallet = ResponseEnvelope & {
2954
- type: "RESTORE_WALLET_SUCCESS";
2517
+ /**
2518
+ * AssetInput represents an input of an asset group.
2519
+ * a local input references a real transaction input and specify the amount in satoshis.
2520
+ * a proof input references an external proof transaction. It is created by the operator to handle batch leaf transaction.
2521
+ */
2522
+ declare class AssetInput {
2523
+ readonly input: AssetInputLocal | AssetInputProof;
2524
+ private constructor();
2525
+ /** Gets the transaction input index for an asset input, e.g. 0 */
2526
+ get vin(): number;
2527
+ /** Gets the amount for an input (in most cases, 330 sats) */
2528
+ get amount(): bigint;
2529
+ /** Create a local asset input that points at a transaction input index. */
2530
+ static create(vin: number, amount: bigint | number): AssetInput;
2531
+ /** Create a proof-backed asset input referencing an external proof transaction. */
2532
+ static createProof(txid: string, vin: number, amount: bigint | number): AssetInput;
2533
+ /** @deprecated Use {@link createProof}. */
2534
+ static createIntent: typeof AssetInput.createProof;
2535
+ /** Decode an asset input from its hex string form. */
2536
+ static fromString(s: string): AssetInput;
2537
+ /** Decode an asset input from its serialized bytes. */
2538
+ static fromBytes(buf: Uint8Array): AssetInput;
2539
+ /** Serialize the asset input to raw bytes. */
2540
+ serialize(): Uint8Array;
2541
+ /** Encode the asset input to a hex string. */
2542
+ toString(): string;
2543
+ /** Validate the asset input fields. */
2544
+ validate(): void;
2545
+ /** Decode an asset input from a buffer reader. */
2546
+ static fromReader(reader: BufferReader): AssetInput;
2547
+ /** Serialize the asset input into an existing buffer writer. */
2548
+ serializeTo(writer: BufferWriter): void;
2549
+ }
2550
+ /**
2551
+ * AssetInputs represents a list of asset inputs.
2552
+ */
2553
+ declare class AssetInputs {
2554
+ readonly inputs: AssetInput[];
2555
+ private constructor();
2556
+ /** Create a validated list of asset inputs. */
2557
+ static create(inputs: AssetInput[]): AssetInputs;
2558
+ /** Decode an asset input list from its hex string form. */
2559
+ static fromString(s: string): AssetInputs;
2560
+ /** Serialize the asset input list to raw bytes. */
2561
+ serialize(): Uint8Array;
2562
+ /** Encode the asset input list to a hex string. */
2563
+ toString(): string;
2564
+ /** Validate the asset input list. */
2565
+ validate(): void;
2566
+ /** Decode an asset input list from a buffer reader. */
2567
+ static fromReader(reader: BufferReader): AssetInputs;
2568
+ /** Serialize the asset input list into an existing buffer writer. */
2569
+ serializeTo(writer: BufferWriter): void;
2570
+ }
2571
+
2572
+ /**
2573
+ * AssetOutput references a real transaction output and specify the amount in satoshis.
2574
+ * it must be present in an AssetGroup.
2575
+ *
2576
+ * @param vout - the output index in the transaction
2577
+ * @param amount - asset amount in satoshis
2578
+ */
2579
+ declare class AssetOutput {
2580
+ readonly vout: number;
2581
+ readonly amount: bigint;
2582
+ static readonly TYPE_LOCAL = 1;
2583
+ private constructor();
2584
+ /** Create a local asset output referencing a transaction output index. */
2585
+ static create(vout: number, amount: bigint | number): AssetOutput;
2586
+ /** Decode an asset output from its hex string form. */
2587
+ static fromString(s: string): AssetOutput;
2588
+ /** Decode an asset output from its serialized bytes. */
2589
+ static fromBytes(buf: Uint8Array): AssetOutput;
2590
+ /** Serialize the asset output to raw bytes. */
2591
+ serialize(): Uint8Array;
2592
+ /** Encode the asset output to a hex string. */
2593
+ toString(): string;
2594
+ /** Validate the asset output fields. */
2595
+ validate(): void;
2596
+ /** Decode an asset output from a buffer reader. */
2597
+ static fromReader(reader: BufferReader): AssetOutput;
2598
+ /** Serialize the asset output into an existing buffer writer. */
2599
+ serializeTo(writer: BufferWriter): void;
2600
+ }
2601
+ /**
2602
+ * AssetOutputs is a list of AssetOutput references.
2603
+ * it must be present in an AssetGroup.
2604
+ *
2605
+ * @param outputs - the list of asset outputs
2606
+ */
2607
+ declare class AssetOutputs {
2608
+ readonly outputs: AssetOutput[];
2609
+ private constructor();
2610
+ /** Create a validated list of asset outputs. */
2611
+ static create(outputs: AssetOutput[]): AssetOutputs;
2612
+ /** Decode an asset output list from its hex string form. */
2613
+ static fromString(s: string): AssetOutputs;
2614
+ /** Serialize the asset output list to raw bytes. */
2615
+ serialize(): Uint8Array;
2616
+ /** Encode the asset output list to a hex string. */
2617
+ toString(): string;
2618
+ /** Validate the asset output list. */
2619
+ validate(): void;
2620
+ /** Decode an asset output list from a buffer reader. */
2621
+ static fromReader(reader: BufferReader): AssetOutputs;
2622
+ /** Serialize the asset output list into an existing buffer writer. */
2623
+ serializeTo(writer: BufferWriter): void;
2624
+ }
2625
+
2626
+ /**
2627
+ * Metadata represents a key-value pair.
2628
+ * @param key - the key
2629
+ * @param value - the value
2630
+ */
2631
+ declare class Metadata {
2632
+ readonly key: Uint8Array;
2633
+ readonly value: Uint8Array;
2634
+ private constructor();
2635
+ /** Create a metadata entry from raw key and value bytes. */
2636
+ static create(key: Bytes, value: Bytes): Metadata;
2637
+ /** Decode metadata from its hex string form. */
2638
+ static fromString(s: string): Metadata;
2639
+ /** Decode metadata from its serialized bytes. */
2640
+ static fromBytes(buf: Uint8Array): Metadata;
2641
+ /** Serialize metadata to raw bytes. */
2642
+ serialize(): Uint8Array;
2643
+ /** Encode metadata to a hex string. */
2644
+ toString(): string;
2645
+ get keyString(): string;
2646
+ get valueString(): string;
2647
+ /** Validate the metadata key and value. */
2648
+ validate(): void;
2649
+ /** Decode metadata from a buffer reader. */
2650
+ static fromReader(reader: BufferReader): Metadata;
2651
+ /** Serialize metadata into an existing buffer writer. */
2652
+ serializeTo(writer: BufferWriter): void;
2653
+ }
2654
+ declare class MetadataList {
2655
+ readonly items: Metadata[];
2656
+ static readonly ARK_LEAF_TAG = "ArkadeAssetLeaf";
2657
+ static readonly ARK_BRANCH_TAG = "ArkadeAssetBranch";
2658
+ static readonly ARK_LEAF_VERSION = 0;
2659
+ constructor(items: Metadata[]);
2660
+ /** Create a metadata list from its hex string form. */
2661
+ static fromString(s: string): MetadataList;
2662
+ /** Decode a metadata list from its serialized bytes. */
2663
+ static fromBytes(buf: Uint8Array): MetadataList;
2664
+ /** Decode a metadata list from a buffer reader. */
2665
+ static fromReader(reader: BufferReader): MetadataList;
2666
+ /** Serialize the metadata list into an existing buffer writer. */
2667
+ serializeTo(writer: BufferWriter): void;
2668
+ /** Serialize the metadata list to raw bytes. */
2669
+ serialize(): Uint8Array;
2670
+ /** Iterate through metadata entries in insertion order. */
2671
+ [Symbol.iterator](): Iterator<Metadata>;
2672
+ get length(): number;
2673
+ /** Compute the tagged Merkle root for the metadata list. */
2674
+ hash(): Uint8Array;
2675
+ }
2676
+
2677
+ /**
2678
+ * An asset group contains inputs, outputs, and all data related to a given asset id.
2679
+ *
2680
+ * @see Packet
2681
+ * @see AssetId
2682
+ * @see AssetRef
2683
+ *
2684
+ * @example
2685
+ * ```typescript
2686
+ * const group = AssetGroup.create(
2687
+ * null, // asset ID: null for new issuance
2688
+ * null, // control asset ID: null when reissuance not needed
2689
+ * [], // asset inputs: empty for new issuance
2690
+ * [AssetOutput.create(0, 1000)], // asset outputs: 1000 units at vout index 0
2691
+ * [] // metadata: can be empty
2692
+ * )
2693
+ * ```
2694
+ */
2695
+ declare class AssetGroup {
2696
+ readonly assetId: AssetId | null;
2697
+ readonly controlAsset: AssetRef | null;
2698
+ readonly inputs: AssetInput[];
2699
+ readonly outputs: AssetOutput[];
2700
+ private readonly metadataList;
2701
+ /** @see create */
2702
+ constructor(assetId: AssetId | null, controlAsset: AssetRef | null, inputs: AssetInput[], outputs: AssetOutput[], metadata: Metadata[]);
2703
+ /**
2704
+ * Create and validate an asset group.
2705
+ *
2706
+ * @param assetId - Asset id for this group, or `null` for fresh issuance
2707
+ * @param controlAsset - Optional control asset reference for (re) issuance
2708
+ * @param inputs - Asset inputs in the group
2709
+ * @param outputs - Asset outputs in the group
2710
+ * @param metadata - Metadata entries associated with the group
2711
+ * @returns A validated asset group
2712
+ * @throws Error if the group fails validation
2713
+ * @see validate
2714
+ */
2715
+ static create(assetId: AssetId | null, controlAsset: AssetRef | null, inputs: AssetInput[], outputs: AssetOutput[], metadata: Metadata[]): AssetGroup;
2716
+ /**
2717
+ * Decode an asset group from its hex string form.
2718
+ *
2719
+ * @param s - Hex-encoded asset group
2720
+ * @returns Decoded asset group
2721
+ * @throws Error if the string is not valid hex or does not encode a valid asset group
2722
+ * @see toString
2723
+ */
2724
+ static fromString(s: string): AssetGroup;
2725
+ /**
2726
+ * Decode an asset group from its serialized bytes.
2727
+ *
2728
+ * @param buf - Serialized asset group bytes
2729
+ * @returns Decoded asset group
2730
+ * @throws Error if the buffer is empty or malformed
2731
+ */
2732
+ static fromBytes(buf: Uint8Array): AssetGroup;
2733
+ /**
2734
+ * Return true when the group represents an issuance.
2735
+ *
2736
+ * @returns `true` when the group has no asset id
2737
+ */
2738
+ isIssuance(): boolean;
2739
+ /**
2740
+ * Return true when the group represents a reissuance.
2741
+ *
2742
+ * @returns `true` when the group has an asset id and outputs exceed local inputs
2743
+ * @remarks
2744
+ * Only local inputs contribute to the comparison; proof-backed inputs contribute `0` here.
2745
+ */
2746
+ isReissuance(): boolean;
2747
+ /**
2748
+ * Serialize the asset group to raw bytes.
2749
+ *
2750
+ * @returns Serialized asset group bytes
2751
+ * @see fromBytes
2752
+ */
2753
+ serialize(): Uint8Array;
2754
+ /**
2755
+ * Validate the asset group and its child structures.
2756
+ *
2757
+ * @throws Error if the group is empty or violates issuance invariants
2758
+ */
2759
+ validate(): void;
2760
+ /**
2761
+ * Convert the group into its batch-leaf representation for the given proof txid.
2762
+ *
2763
+ * @param proofTxid - Proof transaction id used to build the leaf input reference
2764
+ * @returns Batch-leaf asset group
2765
+ * @see AssetInput.createProof
2766
+ */
2767
+ toBatchLeafAssetGroup(proofTxid: Uint8Array): AssetGroup;
2768
+ /**
2769
+ * Encode the asset group to a hex string.
2770
+ *
2771
+ * @returns Hex-encoded asset group
2772
+ * @see fromString
2773
+ */
2774
+ toString(): string;
2775
+ /**
2776
+ * Decode an asset group from a binary reader.
2777
+ *
2778
+ * @param reader - Reader positioned at an asset group
2779
+ * @returns Decoded asset group
2780
+ * @throws Error if the encoded group is malformed
2781
+ */
2782
+ static fromReader(reader: BufferReader): AssetGroup;
2783
+ /**
2784
+ * Serialize the asset group into an existing binary writer.
2785
+ *
2786
+ * @param writer - Writer to append the asset group to
2787
+ */
2788
+ serializeTo(writer: BufferWriter): void;
2789
+ }
2790
+
2791
+ /**
2792
+ * ExtensionPacket is the interface that all extension packets must implement.
2793
+ * It mirrors the Go extension.Packet interface.
2794
+ */
2795
+ interface ExtensionPacket {
2796
+ /** type returns the 1-byte packet type tag */
2797
+ type(): number;
2798
+ /** serialize returns the raw bytes of the packet (without type or length prefix) */
2799
+ serialize(): Uint8Array;
2800
+ }
2801
+ /**
2802
+ * UnknownPacket holds a packet whose type is not recognized by this implementation.
2803
+ * It round-trips opaquely: the raw bytes are preserved as-is.
2804
+ */
2805
+ declare class UnknownPacket implements ExtensionPacket {
2806
+ private readonly packetType;
2807
+ private readonly data;
2808
+ constructor(packetType: number, data: Uint8Array);
2809
+ type(): number;
2810
+ serialize(): Uint8Array;
2811
+ }
2812
+
2813
+ /**
2814
+ * Packet represents a collection of asset groups.
2815
+ * It encodes/decodes as raw bytes only — OP_RETURN framing is handled by the Extension module.
2816
+ */
2817
+ declare class Packet implements ExtensionPacket {
2818
+ readonly groups: AssetGroup[];
2819
+ /** PACKET_TYPE is the 1-byte TLV type tag used in the Extension envelope. */
2820
+ static readonly PACKET_TYPE = 0;
2821
+ private constructor();
2822
+ /** Create a validated asset packet from a list of asset groups. */
2823
+ static create(groups: AssetGroup[]): Packet;
2824
+ /**
2825
+ * fromBytes parses a Packet from raw bytes.
2826
+ */
2827
+ static fromBytes(buf: Uint8Array): Packet;
2828
+ /**
2829
+ * fromString parses a Packet from a raw hex string (not an OP_RETURN script).
2830
+ */
2831
+ static fromString(s: string): Packet;
2832
+ /**
2833
+ * type returns the TLV packet type tag. Implements ExtensionPacket interface.
2834
+ */
2835
+ type(): number;
2836
+ /** Convert the packet into the batch-leaf form for a specific proof transaction id. */
2837
+ leafTxPacket(proofTxid: Uint8Array): Packet;
2838
+ /**
2839
+ * serialize encodes the packet as raw bytes (varint group count + group data).
2840
+ * Does NOT include OP_RETURN, Arkade magic bytes (`ARK`), or TLV type/length; those are
2841
+ * added by the Extension module.
2842
+ */
2843
+ serialize(): Uint8Array;
2844
+ /**
2845
+ * toString returns the hex-encoded raw packet bytes.
2846
+ */
2847
+ toString(): string;
2848
+ /** Validate packet structure and cross-group references. */
2849
+ validate(): void;
2850
+ private static fromReader;
2851
+ }
2852
+
2853
+ /**
2854
+ * Cross-repo test vectors for the Arkade Asset ID encodings.
2855
+ *
2856
+ * @remarks
2857
+ * Shipped from `src/` rather than `test/` so consumers outside this package can
2858
+ * pin the same bytes: `lightning-swap-service` imports this value, while NArk
2859
+ * and go-sdk vendor the backing `assetIdVectors.json` from a pinned revision of
2860
+ * this repository. The encoding is implemented in seven places across three
2861
+ * repos, and every disagreement fails silently (a flipped txid makes a covenant
2862
+ * unsatisfiable, a flipped group index resolves to a different asset).
2863
+ */
2864
+ interface AssetIdVectors {
2865
+ readonly version: number;
2866
+ readonly note: string;
2867
+ /** Genesis txid in display order — the 32 bytes an id's leading 64 hex chars carry. */
2868
+ readonly txid_hex: string;
2869
+ /** `txid_hex` reversed: serialization order, what the introspection opcodes match. */
2870
+ readonly script_txid_hex: string;
2871
+ readonly valid: ReadonlyArray<{
2872
+ readonly label: string;
2873
+ readonly group_index: number;
2874
+ /** `txid_hex` with the group index appended little-endian. */
2875
+ readonly asset_id_hex: string;
2876
+ /**
2877
+ * The group index as a stack item, after script-number encoding and
2878
+ * before push framing. Not the raw u16: `65535` is `ffff00` here and
2879
+ * `ffff` on the wire, and `0` is the empty item.
2880
+ */
2881
+ readonly script_group_index_item_hex: string;
2882
+ }>;
2883
+ /** Refused by the identity rule (`^[0-9a-f]{68}$`), though not necessarily by the decoder. */
2884
+ readonly invalid_identity: ReadonlyArray<{
2885
+ readonly label: string;
2886
+ readonly value: string;
2887
+ readonly why: string;
2888
+ /** Present when the value still decodes: what `toString()` must return. */
2889
+ readonly normalizes_to?: string;
2890
+ }>;
2891
+ /** Refused by {@link AssetId.fromString} / `fromBytes`. */
2892
+ readonly invalid_decode: ReadonlyArray<{
2893
+ readonly label: string;
2894
+ readonly value: string;
2895
+ /** Substring of the thrown message — normative for TS, advisory for other SDKs. */
2896
+ readonly expected_error: string;
2897
+ }>;
2898
+ /** Refused by {@link AssetId.create} / `validate`. */
2899
+ readonly invalid_construction: ReadonlyArray<{
2900
+ readonly label: string;
2901
+ readonly txid_hex: string;
2902
+ readonly group_index: number;
2903
+ readonly expected_error: string;
2904
+ /** Set when the group index cannot be expressed by an SDK whose constructor takes a native u16. */
2905
+ readonly outside_uint16?: boolean;
2906
+ }>;
2907
+ }
2908
+ /**
2909
+ * The asset-id test vectors, deeply frozen.
2910
+ *
2911
+ * @remarks
2912
+ * Frozen all the way down: the module is a singleton, and one consumer mutating
2913
+ * a nested entry would corrupt it for every other consumer in the process.
2914
+ *
2915
+ * @example
2916
+ * ```typescript
2917
+ * import { asset } from '@arkade-os/sdk'
2918
+ * const { txid_hex, valid } = asset.ASSET_ID_VECTORS
2919
+ * expect(AssetId.create(txid_hex, valid[0].group_index).toString()).toBe(valid[0].asset_id_hex)
2920
+ * ```
2921
+ */
2922
+ declare const ASSET_ID_VECTORS: AssetIdVectors;
2923
+
2924
+ declare const index$1_ASSET_ID_VECTORS: typeof ASSET_ID_VECTORS;
2925
+ type index$1_AssetGroup = AssetGroup;
2926
+ declare const index$1_AssetGroup: typeof AssetGroup;
2927
+ type index$1_AssetId = AssetId;
2928
+ declare const index$1_AssetId: typeof AssetId;
2929
+ type index$1_AssetIdVectors = AssetIdVectors;
2930
+ type index$1_AssetInput = AssetInput;
2931
+ declare const index$1_AssetInput: typeof AssetInput;
2932
+ type index$1_AssetInputType = AssetInputType;
2933
+ declare const index$1_AssetInputType: typeof AssetInputType;
2934
+ type index$1_AssetInputs = AssetInputs;
2935
+ declare const index$1_AssetInputs: typeof AssetInputs;
2936
+ type index$1_AssetOutput = AssetOutput;
2937
+ declare const index$1_AssetOutput: typeof AssetOutput;
2938
+ type index$1_AssetOutputs = AssetOutputs;
2939
+ declare const index$1_AssetOutputs: typeof AssetOutputs;
2940
+ type index$1_AssetRef = AssetRef;
2941
+ declare const index$1_AssetRef: typeof AssetRef;
2942
+ type index$1_AssetRefType = AssetRefType;
2943
+ declare const index$1_AssetRefType: typeof AssetRefType;
2944
+ type index$1_Metadata = Metadata;
2945
+ declare const index$1_Metadata: typeof Metadata;
2946
+ type index$1_MetadataList = MetadataList;
2947
+ declare const index$1_MetadataList: typeof MetadataList;
2948
+ type index$1_Packet = Packet;
2949
+ declare const index$1_Packet: typeof Packet;
2950
+ declare namespace index$1 {
2951
+ export { index$1_ASSET_ID_VECTORS as ASSET_ID_VECTORS, index$1_AssetGroup as AssetGroup, index$1_AssetId as AssetId, type index$1_AssetIdVectors as AssetIdVectors, index$1_AssetInput as AssetInput, index$1_AssetInputType as AssetInputType, index$1_AssetInputs as AssetInputs, index$1_AssetOutput as AssetOutput, index$1_AssetOutputs as AssetOutputs, index$1_AssetRef as AssetRef, index$1_AssetRefType as AssetRefType, index$1_Metadata as Metadata, index$1_MetadataList as MetadataList, index$1_Packet as Packet };
2952
+ }
2953
+
2954
+ /**
2955
+ * Creates an asset packet from asset inputs and receivers.
2956
+ * Groups inputs and outputs by asset ID and creates the Packet object
2957
+ * @param assetInputs - map input index -> assets
2958
+ * @param receivers - array of recipients with their asset allocations
2959
+ * @param changeReceiver - (optional) change receiver containing remaining assets
2960
+ * @returns packet containing all asset groups
2961
+ */
2962
+ declare function createAssetPacket(assetInputs: Map<number, Asset[]>, receivers: Recipient[], changeReceiver?: Recipient): Packet;
2963
+ /**
2964
+ * Selects coins that contain a specific asset.
2965
+ * Returns coins sorted by amount (smallest first for better coin selection).
2966
+ */
2967
+ declare function selectCoinsWithAsset(coins: ExtendedVirtualCoin[], assetId: string, requiredAmount: bigint): {
2968
+ selected: ExtendedVirtualCoin[];
2969
+ totalAssetAmount: bigint;
2955
2970
  };
2956
- type WalletUpdaterRequest = RequestInitWallet | RequestSettle | RequestGetAddress | RequestGetBoardingAddress | RequestGetOperatorInfo | 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 | RequestCosignOnchainTx | RequestSendOnchain | RequestMigrateDeprecatedSignerVtxos | RequestGetDeprecatedSignerStatus | RequestRestoreWallet | RequestArkadeCash;
2957
- type WalletUpdaterResponse = ResponseEnvelope & (ResponseInitWallet | ResponseSettle | ResponseSettleEvent | ResponseGetAddress | ResponseGetBoardingAddress | ResponseGetOperatorInfo | 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 | ResponseCosignOnchainTx | ResponseSendOnchain | ResponseMigrateDeprecatedSignerVtxos | ResponseMigrateDeprecatedSignerVtxosEvent | ResponseGetDeprecatedSignerStatus | ResponseRestoreWallet | ResponseArkadeCash);
2958
- declare class WalletMessageHandler implements MessageHandler<WalletUpdaterRequest, WalletUpdaterResponse> {
2959
- readonly messageTag: string;
2960
- private wallet;
2961
- private readonlyWallet;
2962
- private arkProvider;
2963
- private indexerProvider;
2964
- private walletRepository;
2965
- private incomingFundsSubscription;
2966
- private incomingFundsRegistrations;
2967
- private contractEventsSubscription;
2968
- private onNextTick;
2969
- private channel;
2970
- private incomingFundsEpoch;
2971
+
2972
+ /**
2973
+ * Thrown when a collaborative-exit / offboard would leave a change VTXO below
2974
+ * the dust threshold. Lets callers (e.g. wallet UI) react with appropriate UX
2975
+ * — for instance, offering to exit the full balance — instead of forwarding a
2976
+ * server-side dust rejection to the user.
2977
+ */
2978
+ declare class DustChangeError extends Error {
2979
+ readonly change: bigint;
2980
+ readonly dustAmount: bigint;
2981
+ constructor(change: bigint, dustAmount: bigint);
2982
+ }
2983
+ /** Thrown when a collaborative exit's change VTXO is above the server's
2984
+ * per-output ceiling, which arkd answers with `AMOUNT_TOO_HIGH`. */
2985
+ declare class OversizedChangeError extends Error {
2986
+ readonly change: bigint;
2987
+ readonly maxAmount: bigint;
2988
+ constructor(change: bigint, maxAmount: bigint);
2989
+ }
2990
+ /**
2991
+ * Ramps is a class wrapping `settle` method to provide a more convenient interface for onboarding and offboarding operations.
2992
+ *
2993
+ * @see IWallet.settle
2994
+ * @see onboard
2995
+ * @see offboard
2996
+ *
2997
+ * @example
2998
+ * ```typescript
2999
+ * const ramps = new Ramps(wallet);
3000
+ * const feeInfo = { intentFee: {}, txFeeRate: '1' };
3001
+ * await ramps.onboard(feeInfo); // onboard all boarding inputs
3002
+ * await ramps.offboard('bc1q...', feeInfo); // collaboratively exit all virtual outputs to an onchain address
3003
+ * ```
3004
+ */
3005
+ declare class Ramps {
3006
+ readonly wallet: IWallet;
2971
3007
  /**
2972
- * Supersedes older initializers without touching `incomingFundsEpoch`, so a
2973
- * re-init that fails before registering leaves the live subscription delivering.
3008
+ * Create convenience wrappers for onboarding and offboarding flows.
3009
+ *
3010
+ * @param wallet - Wallet used to query funds and execute settlement transactions
2974
3011
  */
2975
- private initEpoch;
2976
- private contractEventsEpoch;
2977
- private boardingEpoch;
2978
- /** Per-request progress callbacks: ends with the handler, not with a re-init. */
2979
- private requestEpoch;
3012
+ constructor(wallet: IWallet);
2980
3013
  /**
2981
- * Instantiate a new WalletUpdater.
2982
- * Can override the default `messageTag` allowing more than one updater to run in parallel.
2983
- * Note that the default ServiceWorkerWallet sends messages to the default WalletUpdater tag.
3014
+ * Onboard boarding inputs.
3015
+ *
3016
+ * @param feeInfo - The fee info to deduct from the onboard amount.
3017
+ * @param boardingUtxos - Specific boarding inputs to onboard. If not provided, all boarding inputs will be used.
3018
+ * @param amount - Amount to onboard. If not provided, the total amount of boarding inputs will be onboarded.
3019
+ * @param eventCallback - Optional callback that receives settlement events
3020
+ * @returns The Arkade transaction id created by settlement
3021
+ * @throws Error if no boarding inputs remain after fee deduction or if `amount` exceeds available value
3022
+ * @see IWallet.getBoardingUtxos
3023
+ * @see IWallet.settle
3024
+ * @example
3025
+ * ```typescript
3026
+ * const feeInfo = { intentFee: {}, txFeeRate: '1' };
3027
+ * const ramps = new Ramps(wallet);
3028
+ * await ramps.onboard(feeInfo);
3029
+ * ```
2984
3030
  */
2985
- constructor(options?: {
2986
- messageTag?: string;
2987
- });
2988
- start(...params: Parameters<MessageHandler<WalletUpdaterRequest, WalletUpdaterResponse>["start"]>): Promise<void>;
2989
- stop(): Promise<void>;
2990
- tick(_now: number): Promise<WalletUpdaterResponse[]>;
2991
- private epochOf;
2992
- private newGeneration;
3031
+ onboard(feeInfo: FeeInfo, boardingUtxos?: ExtendedCoin[], amount?: bigint, eventCallback?: (event: SettlementEvent) => void): ReturnType<IWallet["settle"]>;
2993
3032
  /**
2994
- * A handle rather than a `broadcast(response, epoch)` call, because it can
2995
- * only be written where the closure it guards is created — an epoch passed
2996
- * at the call site reads identically whether it guards anything or not.
3033
+ * Offboard virtual outputs, or collaboratively exit them to an onchain address.
3034
+ *
3035
+ * @param destinationAddress - The destination address to offboard to.
3036
+ * @param feeInfo - The fee info to deduct from the offboard amount.
3037
+ * @param amount - The amount to offboard. If not provided, the total amount of virtual outputs will be offboarded.
3038
+ * @param eventCallback - Optional callback that receives settlement events
3039
+ * @param vtxos - Specific virtual outputs to spend, mirroring {@link onboard}'s
3040
+ * `boardingUtxos`. Omitted, every spendable one is spent — merging the whole
3041
+ * off-chain balance into a single change output. Taken as given like
3042
+ * `settle({ inputs })`: an `amount` these cannot cover is an error, not a top-up.
3043
+ * @returns The Arkade transaction id created by settlement
3044
+ * @throws Error if no virtual outputs remain after fee deduction or the destination address cannot be decoded
3045
+ * @see IWallet.getSpendableVtxos
3046
+ * @see IWallet.settle
3047
+ * @example
3048
+ * ```typescript
3049
+ * const feeInfo = { intentFee: {}, txFeeRate: '1' };
3050
+ * const ramps = new Ramps(wallet);
3051
+ * await ramps.offboard('bc1q...', feeInfo);
3052
+ * ```
2997
3053
  */
2998
- private newEmitter;
2999
- private requireWallet;
3000
- private tagged;
3001
- isLongRunning(message: WalletUpdaterRequest): boolean;
3002
- handleMessage(message: WalletUpdaterRequest): Promise<WalletUpdaterResponse>;
3003
- private handleInitWallet;
3004
- /** @see RequestInitWallet.payload.lazyBoarding */
3005
- private lazyBoardingInit;
3006
- /** Set once this session has actually fetched the boarding addresses. */
3007
- private boardingLoaded;
3054
+ offboard(destinationAddress: string, feeInfo: FeeInfo, amount?: bigint, eventCallback?: (event: SettlementEvent) => void, vtxos?: NormalizedExtendedVirtualCoin[]): ReturnType<IWallet["settle"]>;
3008
3055
  /**
3009
- * The worker's own balance. Same bucketing rules as `Wallet.getBalance` —
3010
- * both call {@link computeOffchainBalance} — but deliberately a different
3011
- * freshness: this reads the repository directly, with no indexer sync, so a
3012
- * polling UI never pays for a network round-trip. That rules out
3013
- * `pendingRecoveryOutpoints()`, whose snapshot syncs; the same classification
3014
- * runs over this method's local snapshot instead.
3056
+ * Collaboratively exit with the DESTINATION paid exactly `amount`, pricing the
3057
+ * fee on that output rather than on a grossed-up figure. {@link offboard} keeps
3058
+ * the other anchor, which needs `g - fee(g) = amount` solved — impossible for
3059
+ * a program charging the whole output.
3060
+ *
3061
+ * Returns the onchain txid instead when onchain coins alone cover `amount`
3062
+ * and were spent via arkd cosigning.
3015
3063
  */
3016
- private handleGetBalance;
3017
- private getBoardingUtxosForBalance;
3018
- private onWalletInitialized;
3019
- private registerIncomingFunds;
3064
+ offboardExact(params: {
3065
+ destinationAddress: string;
3066
+ feeInfo: FeeInfo;
3067
+ /** Sats the destination receives, exactly. */
3068
+ amount: bigint;
3069
+ eventCallback?: (event: SettlementEvent) => void;
3070
+ vtxos?: NormalizedExtendedVirtualCoin[];
3071
+ }): ReturnType<IWallet["settle"]>;
3072
+ private tryCosign;
3073
+ private offboardInputs;
3074
+ /** Every candidate, or with `concurrentSpending` the shortest covering prefix in send order. */
3075
+ private fundExit;
3076
+ /** Re-runs an SDK-picked exit that lost a coin to a concurrent spend. */
3077
+ private withRepick;
3078
+ /** Fund the change output: pay its own fee, then judge it against both
3079
+ * server-side bounds. `0n` in is `0n` out — no change output at all. */
3080
+ private fundChange;
3081
+ }
3082
+
3083
+ /**
3084
+ * HD-wallet {@link DescriptorProvider} that allocates a fresh signing descriptor on every call.
3085
+ * A pure rotating allocator: which descriptor the wallet is bound to is answered by the contract
3086
+ * repository, not this provider.
3087
+ *
3088
+ * State lives in `settings.hd` of the wallet state, so switching single-key → HD needs no schema
3089
+ * migration. Allocation runs inside the shared per-repo `updateWalletState` mutex, so callers
3090
+ * (even on separate instances over one repo) never observe the same index.
3091
+ *
3092
+ * @example
3093
+ * ```ts
3094
+ * const provider = await HDDescriptorProvider.create(identity, walletRepo);
3095
+ * const descriptor = await provider.getNextSigningDescriptor();
3096
+ * // descriptor: tr([fp/86'/0'/0']xpub/0/0)
3097
+ * const next = await provider.getNextSigningDescriptor();
3098
+ * // next: tr([fp/86'/0'/0']xpub/0/1)
3099
+ * ```
3100
+ */
3101
+ declare class HDDescriptorProvider implements DescriptorProvider, ReceiveRotatorFactory {
3102
+ private readonly identity;
3103
+ private readonly walletRepository;
3104
+ private constructor();
3020
3105
  /**
3021
- * Refresh boarding inputs and transaction history. The virtual outputs come
3022
- * from the contract manager, which runs before this. Shared by
3023
- * onWalletInitialized (full bootstrap) and reloadWallet (post-refresh),
3024
- * avoiding duplicate subscriptions and VtxoManager restarts.
3025
- *
3026
- * Both legs reach the onchain provider, so `lazyBoarding` moves them both
3027
- * off the caller's path. @see RequestInitWallet.payload.lazyBoarding
3106
+ * Construct an HDDescriptorProvider. No I/O: state is read lazily, so a descriptor-mismatch
3107
+ * error surfaces on first use rather than here.
3028
3108
  */
3029
- private refreshCachedData;
3030
- /** History rows plus the address they are stored under. Does not write. */
3031
- private loadHistoryCache;
3032
- private storeHistoryCache;
3033
- /** @param gen - set by a background caller; the refresh is skipped once it goes stale. */
3034
- private refreshBoardingCache;
3109
+ static create(identity: HDCapableIdentity, walletRepository: WalletRepository): Promise<HDDescriptorProvider>;
3110
+ /** Allocate and return the next descriptor (index 0, 1, 2, …), atomically per repo. */
3111
+ getNextSigningDescriptor(): Promise<string>;
3035
3112
  /**
3036
- * Force a full VTXO refresh from the indexer, then refresh cached data.
3037
- * Used by RELOAD_WALLET to ensure fresh data without re-subscribing
3038
- * to incoming funds or restarting the VtxoManager.
3113
+ * Re-derive the descriptor `getNextSigningDescriptor` last returned, WITHOUT advancing;
3114
+ * `undefined` if none was ever allocated. Lets boot keep the display address stable across
3115
+ * restarts when no tagged display contract exists, instead of burning a new index.
3039
3116
  */
3040
- private reloadWallet;
3041
- private handleSettle;
3042
- private handleSignTransaction;
3043
- private handleDelegate;
3117
+ getCurrentSigningDescriptor(): Promise<string | undefined>;
3118
+ /** Read-only peek at the allocation watermark; `undefined` if nothing was ever allocated. */
3119
+ getLastIndexUsed(): Promise<number | undefined>;
3044
3120
  /**
3045
- * Ungated repository read mirroring `Wallet.getVtxos`, the raw reporting read.
3121
+ * Monotonically advance the watermark past indices found by a restore scan; never rewinds.
3122
+ * An invalid `index` (non-integer, negative, or >= 2^31) is ignored: persisting it would make
3123
+ * `parseSettings()` throw, and a watermark at the hardened ceiling would fail every later
3124
+ * allocation for the life of the repo.
3046
3125
  */
3047
- private handleGetVtxos;
3048
- /** Tear down handler subscriptions, then delegate the full wipe to the wallet. */
3049
- private clear;
3126
+ advanceLastIndexUsed(index: number): Promise<void>;
3127
+ /** Whether `descriptor` (HD or simple `tr(pubkey)`) is derivable from this wallet's seed. */
3128
+ isOurs(descriptor: string): boolean;
3129
+ /** Signs each request with its descriptor's derived key (the identity holds the seed). */
3130
+ signWithDescriptor(requests: DescriptorSigningRequest[]): Promise<Transaction[]>;
3131
+ /** Signs a message using the key derived from `descriptor`. */
3132
+ signMessageWithDescriptor(descriptor: string, message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
3133
+ /** HD providers take part in receive rotation via {@link WalletReceiveRotator.defaultBoot}. */
3134
+ createReceiveRotator(opts: ReceiveRotatorBootOpts): Promise<ReceiveRotatorBoot | undefined>;
3050
3135
  /**
3051
- * Read all virtual outputs from the repository, aggregated across all contract
3052
- * addresses and the wallet's primary address, with deduplication.
3053
- *
3054
- * Recovery-only contracts (imported by `claimCash` for operator-swept
3055
- * arkcash) are excluded by default, mirroring {@link ReadonlyWallet.getVtxos}:
3056
- * they are settled in their own isolated intent and must stay out of the
3057
- * wallet's balance / VTXO / coin-selection / pending-tx views that read this.
3058
- * Transaction history excludes them too, as does the non-worker
3059
- * `getTransactionHistory`.
3136
+ * Materialize the account template at `index` via the descriptors-scure parser (validates the
3137
+ * ranged template and yields a canonical key expression) rather than string substitution.
3138
+ * Pure: does NOT advance the watermark, so restore's gap-scan can peek arbitrary indices.
3060
3139
  */
3061
- private getVtxosFromRepo;
3140
+ materializeDescriptorAt(index: number): string;
3062
3141
  /**
3063
- * The worker's equivalent of `ReadonlyWallet.contractSnapshot`: contracts
3064
- * paired with the VTXOs the repository holds for them, plus the flat
3065
- * deduplicated list. Purely local — unlike the main-thread snapshot it never
3066
- * syncs against the indexer.
3067
- *
3068
- * One read of the contract rows serves both halves. Reading them twice
3069
- * (once for the VTXO buckets, once for the gate) races the contract
3070
- * manager's own writes: a contract registered between the two reads yields
3071
- * VTXOs with no matching row in the gate, and `gatedContracts` lists only
3072
- * what it knows is closed — so the coins of a just-registered escrowed
3073
- * contract would count as available until the next poll.
3074
- *
3075
- * Recovery-only contracts are skipped (see {@link getVtxosFromRepo}).
3142
+ * Read-modify-write HD settings inside the shared per-repo wallet-state mutex; `fn` mutates a
3143
+ * validated snapshot that is persisted atomically. Reading inside the lock prevents races on a
3144
+ * stale index.
3076
3145
  */
3077
- private repoSnapshot;
3146
+ private mutate;
3078
3147
  /**
3079
- * Build transaction history from cached virtual outputs, hitting the indexer only for
3080
- * uncached timestamps. Best-effort, like the plain Wallet path.
3081
- *
3082
- * Takes its own {@link repoSnapshot} rather than a caller-supplied VTXO
3083
- * list: the coins and the gate that judges them have to come off one read
3084
- * or they answer about different instants, and being the worker's only
3085
- * history builder means neither caller can supply one without the other.
3086
- * The snapshot and the boarding read are independent, so they run together
3087
- * — the same pairing `handleGetBalance` makes.
3148
+ * Validate persisted HD settings (or init a fresh record) and return a mutable clone. Fails
3149
+ * loud: a corrupt repo would otherwise derive `NaN` descriptors.
3088
3150
  */
3089
- private buildTransactionHistoryFromCache;
3090
- private ensureContractEventBroadcasting;
3151
+ private parseSettings;
3091
3152
  }
3092
3153
 
3093
3154
  type RequestType = WalletUpdaterRequest["type"];
3094
3155
  type MessageTimeouts = Partial<Record<RequestType, number>>;
3156
+ type WalletUpdate = Extract<WalletUpdaterResponse, {
3157
+ type: "CONTRACT_EVENT" | "VTXO_UPDATE" | "UTXO_UPDATE";
3158
+ }>;
3095
3159
  type ServiceWorkerWalletMode = "auto" | "static" | "hd";
3096
3160
  declare const DEFAULT_MESSAGE_TIMEOUTS: Readonly<Record<RequestType, number>>;
3097
3161
  /**
@@ -3141,6 +3205,8 @@ interface ServiceWorkerWalletOptions {
3141
3205
  storage?: StorageConfig;
3142
3206
  /** Identity used to derive addresses and optionally sign operations. */
3143
3207
  identity: ReadonlyIdentity | Identity;
3208
+ /** Refuse a worker on another network before exposing a usable proxy. */
3209
+ expectedNetwork?: NetworkName;
3144
3210
  /** Optional delegation service URL. */
3145
3211
  delegateUrl?: string;
3146
3212
  /**
@@ -3238,6 +3304,9 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
3238
3304
  readonly activity: ActivityRegistry;
3239
3305
  private readonly _readonlyAssetManager;
3240
3306
  protected initConfig: MessageBusInitConfig | null;
3307
+ protected expectedWalletScope?: string;
3308
+ protected expectedNetwork?: NetworkName;
3309
+ protected walletRequestBinding?: WalletRequestBinding;
3241
3310
  protected initWalletPayload: RequestInitWallet["payload"] | null;
3242
3311
  protected messageBusTimeoutMs?: number;
3243
3312
  protected messageTimeouts: Record<RequestType, number>;
@@ -3281,6 +3350,7 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
3281
3350
  onEvent: (response: WalletUpdaterResponse) => void;
3282
3351
  isComplete: (response: WalletUpdaterResponse) => boolean;
3283
3352
  }): Promise<WalletUpdaterResponse>;
3353
+ private scopeRequest;
3284
3354
  /** The init config cached by `create()`; manually constructed wallets have none. */
3285
3355
  protected buildInitConfig(): Promise<MessageBusInitConfig>;
3286
3356
  protected buildInitWalletPayload(): RequestInitWallet["payload"];
@@ -3347,6 +3417,8 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
3347
3417
  * @returns `true` when the wallet was reloaded
3348
3418
  */
3349
3419
  reload(): Promise<boolean>;
3420
+ /** Subscribe to contract and coin updates bound to this proxy's wallet. */
3421
+ onWalletUpdate(callback: (update: WalletUpdate) => void): () => void;
3350
3422
  getContractManager(): Promise<IContractManager>;
3351
3423
  }
3352
3424
  declare class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet implements IWallet, HDWalletCapable, HDAllocationCapable, AddressAllocationCapable {
@@ -3444,6 +3516,11 @@ declare class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet implements
3444
3516
  gapLimit?: number;
3445
3517
  }): Promise<void>;
3446
3518
  private _restoreWorkerWallet;
3519
+ /**
3520
+ * Durable across tabs and worker restarts. Persist the application operation id before calling;
3521
+ * release only after proving settlement or non-submission. SDK sends cannot spend this hold.
3522
+ */
3523
+ reserveVtxos(outpoints: readonly Outpoint[], reservationId: string): Promise<VtxoReservation>;
3447
3524
  send(...args: [SendParams] | [Recipient, ...Recipient[]]): Promise<string>;
3448
3525
  cosignOnchainTx(psbt: string | Transaction$1): Promise<string>;
3449
3526
  sendOnchain(params: SendOnchainParams): Promise<string>;
@@ -3919,8 +3996,6 @@ declare class ElectrumOnchainProvider implements OnchainProvider {
3919
3996
  * the orphaned chain's median.
3920
3997
  */
3921
3998
  private medianTimePast;
3922
- /** Degrades to the tip's `nTime` rather than throwing — a caller that
3923
- * cannot read the tip at all is worse off. */
3924
3999
  private readMedianTimePast;
3925
4000
  watchAddresses(addresses: string[], eventCallback: (txs: ExplorerTransaction[]) => void): Promise<() => void>;
3926
4001
  /** Close the underlying WebSocket connection. */
@@ -3991,6 +4066,33 @@ type OffchainTx = {
3991
4066
  */
3992
4067
  declare function buildOffchainTx(inputs: ArkTxInput[], outputs: TransactionOutput[], serverUnrollScript: CSVMultisigTapscript.Type): OffchainTx;
3993
4068
  declare function hasBoardingTxExpired(coin: ExtendedCoin, boardingTimelock: RelativeTimelock, chainTipHeight?: number, chainTipMedianTime?: number, confirmationParentMedianTime?: number): boolean;
4069
+ /**
4070
+ * The CSV exit path of the boarding address a coin sits on, decoded from the coin's own
4071
+ * `tapTree`. Its timelock can differ from the wallet's current boarding delay (a signer rotation
4072
+ * may change it), so expiry and the sweep must read it from the coin, not from the wallet.
4073
+ *
4074
+ * @returns `undefined` when the tree is undecodable or has no CSV leaf.
4075
+ */
4076
+ declare function decodeBoardingExit(coin: ExtendedCoin): {
4077
+ script: VtxoScript;
4078
+ leaf: TapLeafScript;
4079
+ timelock: RelativeTimelock;
4080
+ } | undefined;
4081
+ type BoardingExpiry = {
4082
+ expired: ExtendedCoin[];
4083
+ unknown: ExtendedCoin[];
4084
+ };
4085
+ /**
4086
+ * Splits out the confirmed coins whose own boarding timelock has elapsed, so they can no longer be
4087
+ * settled and leave through the unilateral exit. Seconds-based CSV uses the MTP of the block before
4088
+ * confirmation and the current tip MTP, as required by BIP 68. A coin whose expiry cannot be
4089
+ * established (no block height, no provider MTP lookup, a failed lookup) is `unknown`: callers
4090
+ * must neither settle nor sweep it, but the other coins are still judged.
4091
+ */
4092
+ declare function classifyBoardingExpiry(coins: ExtendedCoin[], getChainTip: () => Promise<{
4093
+ height: number;
4094
+ time: number;
4095
+ }>, getMedianTimePast?: (height: number) => Promise<number>): Promise<BoardingExpiry>;
3994
4096
  /**
3995
4097
  * Verify tapscript signatures on a transaction input
3996
4098
  * @param tx Transaction to verify
@@ -4778,7 +4880,7 @@ type ExitOptions = {
4778
4880
  onchainWallet: OnchainWallet;
4779
4881
  /** Destination for the exited funds. */
4780
4882
  sweepAddress: string;
4781
- /** sat/vB; defaults to the onchain provider estimate, floored at MIN_FEE_RATE. */
4883
+ /** sat/vB, rounded up; 0 or unset: provider rate, floored at MIN_FEE_RATE, capped at 1,000. */
4782
4884
  feeRate?: number;
4783
4885
  /** Defaults to all spendable VTXOs. */
4784
4886
  vtxos?: Outpoint[];
@@ -6797,4 +6899,4 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
6797
6899
  private burnWith;
6798
6900
  }
6799
6901
 
6800
- export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, ASSET_CARRIER_SATS, Activity, ActivityRegistry, AddressAllocationCapable, AmbiguousRouteError, type AnchorBumper, ArkNote, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, Arkade, type ArkadeBatchInput, ArkadeBroadcaster, ArkadeCashClaimResult, ArkadeCashRecord, type ArkadeCashRequest, type ArkadeCashResponse, type ArkadeCashStatus, type ArkadeCashStatusReport, ArkadeCashTx, ArkadeContractParams, type ArkadeExtendedCoin, type ArkadeExtendedVirtualCoin, ArkadeInfo, ArkadeReader, ArkadeService, Asset, AssetDetails, AssetManager, AtomicWalletState, BIP21, BIP21Error, type BIP21Params, type BIP21ParseResult, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, BatchExpiryPolicy, BatchRegistration, BatchRegistrationPageFilter, BatchRegistrationRepository, BurnParams, CSVMultisigTapscript, CachingArkProvider, CachingOperatorProvider, ChainTx, Coin, ConditionWitness, ConnectionDisposedError, Contract, ContractEvent, ContractFilter, ContractRepository, ContractSyncState, ContractVtxoEvent, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DEFAULT_PASSKEY_LABEL, DatabaseUpgradeBlockedError, 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, GetNewAddressesOptions, GetOperatorInfoOptions, GetSpendableVtxosFilter, GetVtxosFilter, GetVtxosOptions, HDAllocationCapable, HDDescriptorProvider, type HDDeterministicSignCapable, HDWalletCapable, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryBatchRegistrationRepository, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBBatchRegistrationRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexerProvider, InputExpiryFloor, IntentFeeConfig, 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, OnchainCosignPreflightError, OnchainInput, OnchainProvider, OnchainWallet, OperatorInfo, OperatorProvider, Outpoint, OversizedChangeError, P2A, PageRequest, PageResult, PaginationOptions, type ParsedArkContract, PasskeyCancelled, type PasskeyMnemonic, type PasskeySource, PasskeyUnconfirmed, PathContext, PathSelection, type PaymentHandle, type PaymentOption, type PaymentRail, type PaymentRequest, PaymentRouter, type PaymentStatus, PrevArkTxField, PrevoutTxField, PrfUnavailable, type PrfUnavailableReason, Proof, ProviderConnectionState, type ProvisionedClaimSecret, type ProvisionedKey, READ_TIMEOUT_MS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, 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, SendOnchainParams, SendParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignedProof, SignerSession, SignerStatus, 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, type WebAuthnClient, 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, createPrfPasskey, decodeArkContract, deleteByIndex, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, deserializeExitPackage, encodeArkContract, evaluatePrf, exitObserverFor, gateExclusion, gatedContracts, getAllByIndexValues, getArkPsbtFields, hasBoardingTxExpired, identityDescriptor, invoiceTarget, isArkContract, isBtcAddress, isCltvSatisfied, isContractGenericallySpendable, isCosignFallback, isCsvSpendable, isDeterministicSigner, isHDDeterministicSignCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isRetryableProviderError, isValidArkAddress, logExcludedVtxos, makeHandle, matchServerCheckpoints, mnemonicFromPrf, normalizeToDescriptor, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, parseHDDescriptor, prfSupport, promisifyRequest, provisionClaimSecret, provisionRefundKey, readArkadeCash, registerWalletRestoreHook, resolveAssetAmount, resolveSendAmount, sdkVersion, selectCoinsWithAsset, selectionOf, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, signAndSubmitOffchainTx, submitViaEmulator, timelockToSequence, toXOnly, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, walletFeeSource };
6902
+ export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, ASSET_CARRIER_SATS, Activity, ActivityRegistry, AddressAllocationCapable, AmbiguousRouteError, type AnchorBumper, ArkNote, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, Arkade, type ArkadeBatchInput, ArkadeBroadcaster, ArkadeCashClaimResult, ArkadeCashRecord, type ArkadeCashRequest, type ArkadeCashResponse, type ArkadeCashStatus, type ArkadeCashStatusReport, ArkadeCashTx, ArkadeContractParams, type ArkadeExtendedCoin, type ArkadeExtendedVirtualCoin, ArkadeInfo, ArkadeReader, ArkadeService, Asset, AssetDetails, AssetManager, AtomicWalletState, BIP21, BIP21Error, type BIP21Params, type BIP21ParseResult, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, BatchExpiryPolicy, BatchRegistration, BatchRegistrationPageFilter, BatchRegistrationRepository, type BoardingExpiry, BurnParams, CSVMultisigTapscript, CachingArkProvider, CachingOperatorProvider, ChainTx, Coin, ConditionWitness, ConnectionDisposedError, Contract, ContractEvent, ContractFilter, ContractRepository, ContractSyncState, ContractVtxoEvent, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DEFAULT_PASSKEY_LABEL, DatabaseUpgradeBlockedError, 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, GetNewAddressesOptions, GetOperatorInfoOptions, GetSpendableVtxosFilter, GetVtxosFilter, GetVtxosOptions, HDAllocationCapable, HDDescriptorProvider, type HDDeterministicSignCapable, HDWalletCapable, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryBatchRegistrationRepository, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBBatchRegistrationRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBVtxoReservationRepository, IndexerProvider, InputExpiryFloor, IntentFeeConfig, 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, OnchainCosignPreflightError, OnchainInput, OnchainProvider, OnchainWallet, OperatorInfo, OperatorProvider, Outpoint, OversizedChangeError, P2A, PageRequest, PageResult, PaginationOptions, type ParsedArkContract, PasskeyCancelled, type PasskeyMnemonic, type PasskeySource, PasskeyUnconfirmed, PathContext, PathSelection, type PaymentHandle, type PaymentOption, type PaymentRail, type PaymentRequest, PaymentRouter, type PaymentStatus, PrevArkTxField, PrevoutTxField, PrfUnavailable, type PrfUnavailableReason, Proof, ProviderConnectionState, type ProvisionedClaimSecret, type ProvisionedKey, READ_TIMEOUT_MS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, 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, SendOnchainParams, SendParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignedProof, SignerSession, SignerStatus, StaticDescriptorProvider, Status, StorageConfig, StoredVtxo, StoredVtxoReservation, TapLeafScript, Transaction, TransactionHistoryPageCursor, TransactionHistoryPageFilter, TreeNonces, TreePartialSigs, TxNotificationEvent, TxTree, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, UnsupportedProgramVersionError, type VSize, type VerifyServerSignatures, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, type VtxoExclusion, VtxoReservation, VtxoReservationRepository, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WalletRepository, type WalletRestoreHook, type WalletUpdate, WatchedScript, type WebAuthnClient, 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, classifyBoardingExpiry, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultPaymentRouter, createManagedConnection, createPrfPasskey, decodeArkContract, decodeBoardingExit, deleteByIndex, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, deserializeExitPackage, encodeArkContract, evaluatePrf, exitObserverFor, gateExclusion, gatedContracts, getAllByIndexValues, getArkPsbtFields, hasBoardingTxExpired, identityDescriptor, invoiceTarget, isArkContract, isBtcAddress, isCltvSatisfied, isContractGenericallySpendable, isCosignFallback, isCsvSpendable, isDeterministicSigner, isHDDeterministicSignCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isRetryableProviderError, isValidArkAddress, logExcludedVtxos, makeHandle, matchServerCheckpoints, mnemonicFromPrf, normalizeToDescriptor, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, parseHDDescriptor, prfSupport, promisifyRequest, provisionClaimSecret, provisionRefundKey, readArkadeCash, registerWalletRestoreHook, resolveAssetAmount, resolveSendAmount, sdkVersion, selectCoinsWithAsset, selectionOf, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, signAndSubmitOffchainTx, submitViaEmulator, timelockToSequence, toXOnly, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, walletFeeSource };