@arkade-os/sdk 0.4.15 → 0.4.17

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 (197) hide show
  1. package/README.md +102 -96
  2. package/dist/cjs/arkfee/estimator.js +1 -1
  3. package/dist/cjs/arkfee/types.js +2 -1
  4. package/dist/cjs/arknote/index.js +43 -4
  5. package/dist/cjs/bip322/index.js +1 -1
  6. package/dist/cjs/contracts/arkcontract.js +1 -1
  7. package/dist/cjs/contracts/contractManager.js +60 -28
  8. package/dist/cjs/contracts/contractWatcher.js +29 -22
  9. package/dist/cjs/contracts/handlers/default.js +1 -1
  10. package/dist/cjs/contracts/handlers/delegate.js +1 -1
  11. package/dist/cjs/contracts/handlers/helpers.js +1 -1
  12. package/dist/cjs/extension/asset/assetGroup.js +92 -5
  13. package/dist/cjs/extension/asset/assetId.js +67 -3
  14. package/dist/cjs/extension/asset/assetInput.js +18 -0
  15. package/dist/cjs/extension/asset/assetOutput.js +15 -0
  16. package/dist/cjs/extension/asset/assetRef.js +66 -0
  17. package/dist/cjs/extension/asset/metadata.js +15 -0
  18. package/dist/cjs/extension/asset/packet.js +4 -1
  19. package/dist/cjs/extension/index.js +1 -1
  20. package/dist/cjs/forfeit.js +14 -0
  21. package/dist/cjs/identity/seedIdentity.js +2 -2
  22. package/dist/cjs/identity/singleKey.js +4 -0
  23. package/dist/cjs/intent/index.js +28 -12
  24. package/dist/cjs/providers/ark.js +3 -2
  25. package/dist/cjs/providers/delegator.js +20 -1
  26. package/dist/cjs/providers/expoArk.js +2 -2
  27. package/dist/cjs/providers/indexer.js +2 -2
  28. package/dist/cjs/providers/onchain.js +2 -1
  29. package/dist/cjs/repositories/realm/schemas.js +2 -2
  30. package/dist/cjs/repositories/realm/types.js +1 -1
  31. package/dist/cjs/script/address.js +37 -6
  32. package/dist/cjs/script/base.js +70 -1
  33. package/dist/cjs/script/default.js +3 -0
  34. package/dist/cjs/script/delegate.js +4 -0
  35. package/dist/cjs/script/tapscript.js +17 -2
  36. package/dist/cjs/script/vhtlc.js +35 -27
  37. package/dist/cjs/storage/fileSystem.js +1 -1
  38. package/dist/cjs/storage/inMemory.js +1 -1
  39. package/dist/cjs/storage/indexedDB.js +1 -1
  40. package/dist/cjs/storage/localStorage.js +1 -1
  41. package/dist/cjs/tree/validation.js +1 -1
  42. package/dist/cjs/utils/arkTransaction.js +5 -5
  43. package/dist/cjs/utils/bip21.js +16 -3
  44. package/dist/cjs/utils/syncCursors.js +4 -4
  45. package/dist/cjs/utils/transaction.js +1 -1
  46. package/dist/cjs/utils/transactionHistory.js +11 -11
  47. package/dist/cjs/utils/unknownFields.js +3 -3
  48. package/dist/cjs/wallet/asset-manager.js +4 -4
  49. package/dist/cjs/wallet/batch.js +5 -5
  50. package/dist/cjs/wallet/delegator.js +9 -8
  51. package/dist/cjs/wallet/expo/background.js +3 -3
  52. package/dist/cjs/wallet/expo/wallet.js +7 -7
  53. package/dist/cjs/wallet/index.js +43 -0
  54. package/dist/cjs/wallet/onchain.js +43 -5
  55. package/dist/cjs/wallet/ramps.js +44 -14
  56. package/dist/cjs/wallet/serviceWorker/wallet-message-handler.js +22 -22
  57. package/dist/cjs/wallet/serviceWorker/wallet.js +28 -24
  58. package/dist/cjs/wallet/unroll.js +12 -8
  59. package/dist/cjs/wallet/utils.js +1 -1
  60. package/dist/cjs/wallet/vtxo-manager.js +122 -82
  61. package/dist/cjs/wallet/wallet.js +140 -77
  62. package/dist/cjs/worker/expo/asyncStorageTaskQueue.js +1 -1
  63. package/dist/cjs/worker/expo/processors/contractPollProcessor.js +2 -2
  64. package/dist/cjs/worker/expo/taskRunner.js +3 -3
  65. package/dist/cjs/worker/messageBus.js +3 -0
  66. package/dist/esm/arkfee/estimator.js +1 -1
  67. package/dist/esm/arkfee/types.js +2 -1
  68. package/dist/esm/arknote/index.js +43 -4
  69. package/dist/esm/bip322/index.js +1 -1
  70. package/dist/esm/contracts/arkcontract.js +1 -1
  71. package/dist/esm/contracts/contractManager.js +60 -28
  72. package/dist/esm/contracts/contractWatcher.js +29 -22
  73. package/dist/esm/contracts/handlers/default.js +1 -1
  74. package/dist/esm/contracts/handlers/delegate.js +1 -1
  75. package/dist/esm/contracts/handlers/helpers.js +1 -1
  76. package/dist/esm/extension/asset/assetGroup.js +92 -5
  77. package/dist/esm/extension/asset/assetId.js +67 -3
  78. package/dist/esm/extension/asset/assetInput.js +18 -0
  79. package/dist/esm/extension/asset/assetOutput.js +15 -0
  80. package/dist/esm/extension/asset/assetRef.js +66 -0
  81. package/dist/esm/extension/asset/metadata.js +15 -0
  82. package/dist/esm/extension/asset/packet.js +4 -1
  83. package/dist/esm/extension/index.js +1 -1
  84. package/dist/esm/forfeit.js +14 -0
  85. package/dist/esm/identity/seedIdentity.js +2 -2
  86. package/dist/esm/identity/singleKey.js +4 -0
  87. package/dist/esm/index.js +1 -1
  88. package/dist/esm/intent/index.js +28 -12
  89. package/dist/esm/providers/ark.js +3 -2
  90. package/dist/esm/providers/delegator.js +20 -1
  91. package/dist/esm/providers/expoArk.js +2 -2
  92. package/dist/esm/providers/indexer.js +2 -2
  93. package/dist/esm/providers/onchain.js +2 -1
  94. package/dist/esm/repositories/realm/schemas.js +2 -2
  95. package/dist/esm/repositories/realm/types.js +1 -1
  96. package/dist/esm/script/address.js +37 -6
  97. package/dist/esm/script/base.js +70 -1
  98. package/dist/esm/script/default.js +3 -0
  99. package/dist/esm/script/delegate.js +4 -0
  100. package/dist/esm/script/tapscript.js +17 -2
  101. package/dist/esm/script/vhtlc.js +35 -27
  102. package/dist/esm/storage/fileSystem.js +1 -1
  103. package/dist/esm/storage/inMemory.js +1 -1
  104. package/dist/esm/storage/indexedDB.js +1 -1
  105. package/dist/esm/storage/localStorage.js +1 -1
  106. package/dist/esm/tree/validation.js +1 -1
  107. package/dist/esm/utils/arkTransaction.js +5 -5
  108. package/dist/esm/utils/bip21.js +16 -3
  109. package/dist/esm/utils/syncCursors.js +4 -4
  110. package/dist/esm/utils/transaction.js +1 -1
  111. package/dist/esm/utils/transactionHistory.js +11 -11
  112. package/dist/esm/utils/unknownFields.js +3 -3
  113. package/dist/esm/wallet/asset-manager.js +4 -4
  114. package/dist/esm/wallet/batch.js +5 -5
  115. package/dist/esm/wallet/delegator.js +9 -8
  116. package/dist/esm/wallet/expo/background.js +3 -3
  117. package/dist/esm/wallet/expo/wallet.js +7 -7
  118. package/dist/esm/wallet/index.js +43 -0
  119. package/dist/esm/wallet/onchain.js +43 -5
  120. package/dist/esm/wallet/ramps.js +44 -14
  121. package/dist/esm/wallet/serviceWorker/wallet-message-handler.js +22 -22
  122. package/dist/esm/wallet/serviceWorker/wallet.js +28 -24
  123. package/dist/esm/wallet/unroll.js +12 -8
  124. package/dist/esm/wallet/utils.js +1 -1
  125. package/dist/esm/wallet/vtxo-manager.js +121 -81
  126. package/dist/esm/wallet/wallet.js +140 -77
  127. package/dist/esm/worker/expo/asyncStorageTaskQueue.js +1 -1
  128. package/dist/esm/worker/expo/processors/contractPollProcessor.js +2 -2
  129. package/dist/esm/worker/expo/taskRunner.js +3 -3
  130. package/dist/esm/worker/messageBus.js +3 -0
  131. package/dist/types/arkfee/estimator.d.ts +1 -1
  132. package/dist/types/arkfee/types.d.ts +2 -1
  133. package/dist/types/arknote/index.d.ts +44 -4
  134. package/dist/types/bip322/index.d.ts +1 -1
  135. package/dist/types/contracts/arkcontract.d.ts +1 -1
  136. package/dist/types/contracts/contractManager.d.ts +39 -65
  137. package/dist/types/contracts/contractWatcher.d.ts +39 -18
  138. package/dist/types/contracts/handlers/default.d.ts +1 -1
  139. package/dist/types/contracts/handlers/delegate.d.ts +1 -1
  140. package/dist/types/contracts/handlers/helpers.d.ts +1 -1
  141. package/dist/types/contracts/types.d.ts +36 -26
  142. package/dist/types/extension/asset/assetGroup.d.ts +92 -1
  143. package/dist/types/extension/asset/assetId.d.ts +67 -3
  144. package/dist/types/extension/asset/assetInput.d.ts +18 -0
  145. package/dist/types/extension/asset/assetOutput.d.ts +15 -0
  146. package/dist/types/extension/asset/assetRef.d.ts +66 -0
  147. package/dist/types/extension/asset/metadata.d.ts +15 -0
  148. package/dist/types/extension/asset/packet.d.ts +4 -1
  149. package/dist/types/extension/index.d.ts +1 -1
  150. package/dist/types/forfeit.d.ts +14 -0
  151. package/dist/types/identity/index.d.ts +16 -0
  152. package/dist/types/identity/seedIdentity.d.ts +8 -6
  153. package/dist/types/identity/singleKey.d.ts +4 -0
  154. package/dist/types/intent/index.d.ts +19 -6
  155. package/dist/types/providers/ark.d.ts +40 -2
  156. package/dist/types/providers/delegator.d.ts +54 -1
  157. package/dist/types/providers/expoArk.d.ts +2 -2
  158. package/dist/types/providers/indexer.d.ts +105 -2
  159. package/dist/types/providers/onchain.d.ts +62 -1
  160. package/dist/types/repositories/realm/schemas.d.ts +2 -2
  161. package/dist/types/repositories/realm/types.d.ts +2 -2
  162. package/dist/types/repositories/walletRepository.d.ts +16 -0
  163. package/dist/types/script/address.d.ts +35 -2
  164. package/dist/types/script/base.d.ts +66 -1
  165. package/dist/types/script/default.d.ts +3 -0
  166. package/dist/types/script/delegate.d.ts +4 -0
  167. package/dist/types/script/tapscript.d.ts +17 -2
  168. package/dist/types/script/vhtlc.d.ts +35 -27
  169. package/dist/types/storage/fileSystem.d.ts +1 -1
  170. package/dist/types/storage/inMemory.d.ts +1 -1
  171. package/dist/types/storage/index.d.ts +1 -1
  172. package/dist/types/storage/indexedDB.d.ts +1 -1
  173. package/dist/types/storage/localStorage.d.ts +1 -1
  174. package/dist/types/utils/arkTransaction.d.ts +3 -3
  175. package/dist/types/utils/bip21.d.ts +17 -0
  176. package/dist/types/utils/syncCursors.d.ts +4 -4
  177. package/dist/types/utils/transaction.d.ts +1 -1
  178. package/dist/types/utils/transactionHistory.d.ts +3 -3
  179. package/dist/types/utils/unknownFields.d.ts +5 -5
  180. package/dist/types/wallet/asset-manager.d.ts +3 -3
  181. package/dist/types/wallet/batch.d.ts +27 -7
  182. package/dist/types/wallet/delegator.d.ts +10 -0
  183. package/dist/types/wallet/expo/background.d.ts +4 -4
  184. package/dist/types/wallet/expo/wallet.d.ts +10 -10
  185. package/dist/types/wallet/index.d.ts +457 -25
  186. package/dist/types/wallet/onchain.d.ts +42 -4
  187. package/dist/types/wallet/ramps.d.ts +40 -10
  188. package/dist/types/wallet/serviceWorker/wallet-message-handler.d.ts +4 -4
  189. package/dist/types/wallet/serviceWorker/wallet.d.ts +71 -33
  190. package/dist/types/wallet/unroll.d.ts +8 -6
  191. package/dist/types/wallet/vtxo-manager.d.ts +146 -93
  192. package/dist/types/wallet/wallet.d.ts +91 -33
  193. package/dist/types/worker/expo/asyncStorageTaskQueue.d.ts +1 -1
  194. package/dist/types/worker/expo/processors/contractPollProcessor.d.ts +1 -1
  195. package/dist/types/worker/expo/taskRunner.d.ts +6 -6
  196. package/dist/types/worker/messageBus.d.ts +5 -3
  197. package/package.json +1 -1
@@ -1,22 +1,32 @@
1
1
  import { ExtendedCoin, ExtendedVirtualCoin, IWallet } from ".";
2
2
  import { SettlementEvent } from "../providers/ark";
3
- export declare const DEFAULT_THRESHOLD_MS: number;
3
+ /** Default renewal threshold in seconds (3 days). */
4
4
  export declare const DEFAULT_THRESHOLD_SECONDS: number;
5
5
  /**
6
- * Configuration options for automatic VTXO renewal
7
- * @deprecated Use SettlementConfig instead
6
+ * Default renewal threshold in milliseconds (3 days).
7
+ */
8
+ export declare const DEFAULT_THRESHOLD_MS: number;
9
+ /**
10
+ * Configuration options for automatic virtual output renewal
11
+ *
12
+ * @see DEFAULT_RENEWAL_CONFIG
13
+ * @deprecated Leave `renewalConfig` undefined and use `settlementConfig` instead.
14
+ * @see SettlementConfig
8
15
  */
9
16
  export interface RenewalConfig {
10
17
  /**
11
18
  * Enable automatic renewal monitoring
12
- * @default false
19
+ *
20
+ * @defaultValue `false`
21
+ * @deprecated Explicitly set `settlementConfig` to `false` to disable VTXO renewal.
13
22
  */
14
23
  enabled?: boolean;
15
24
  /**
16
25
  * Threshold in milliseconds to use as threshold for renewal
17
- * E.g., 86400000 means renew when 24 hours until expiry remains
18
- * @default 86400000 (24 hours)
19
- * @deprecated Use SettlementConfig.vtxoThreshold (in seconds) instead
26
+ * E.g., 86_400_000 means renew when 24 hours until expiry remains
27
+ *
28
+ * @defaultValue `259_200_000` (3 days).
29
+ * @deprecated Use `SettlementConfig.vtxoThreshold` (in seconds) instead.
20
30
  */
21
31
  thresholdMs?: number;
22
32
  }
@@ -24,111 +34,142 @@ export interface RenewalConfig {
24
34
  * Configuration for automatic settlement and renewal.
25
35
  *
26
36
  * Controls two behaviors:
27
- * 1. **VTXO renewal**: Automatically renew VTXOs that are close to expiry
28
- * 2. **Boarding UTXO sweep**: Sweep expired boarding UTXOs back to a fresh boarding address
29
- * via the unilateral exit path (on-chain self-spend to restart the timelock)
37
+ * 1. **VTXO renewal**: Automatically renew virtual outputs that are close to expiry
38
+ * 2. **Boarding UTXO sweep**: Sweep expired boarding inputs back to a fresh boarding address
39
+ * via the unilateral exit path (onchain self-spend to restart the timelock)
30
40
  *
31
41
  * Enabled by default when no config is provided.
32
42
  * Pass `false` to explicitly disable all settlement behavior.
33
43
  *
44
+ * @remarks
45
+ * VTXO renewal and boarding UTXO sweep are both coordinated by `VtxoManager`, which periodically
46
+ * inspects wallet virtual outputs and boarding inputs and decides whether action is needed.
47
+ *
48
+ * @see DEFAULT_SETTLEMENT_CONFIG
49
+ *
34
50
  * @example
35
51
  * ```typescript
36
- * // Default behavior: VTXO renewal at 3 days + boarding sweep enabled
52
+ * // Default behavior: virtual output renewal at 3 days, boarding sweep enabled, polling every minute
37
53
  * const wallet = await Wallet.create({
38
- * identity: SingleKey.fromHex('...'),
39
- * arkServerUrl: 'https://ark.example.com',
54
+ * identity: MnemonicIdentity.fromMnemonic('abandon abandon...'),
55
+ * arkServerUrl: 'https://arkade.computer',
40
56
  * });
41
57
  *
42
- * // Custom threshold
58
+ * // Custom expiry threshold of 24 hours
43
59
  * const wallet = await Wallet.create({
44
- * identity: SingleKey.fromHex('...'),
45
- * arkServerUrl: 'https://ark.example.com',
60
+ * identity: MnemonicIdentity.fromMnemonic('abandon abandon...'),
61
+ * arkServerUrl: 'https://arkade.computer',
46
62
  * settlementConfig: {
47
- * vtxoThreshold: 86400, // 24 hours in seconds
63
+ * vtxoThreshold: 60 * 60 * 24, // 24 hours in seconds
48
64
  * },
49
65
  * });
50
66
  *
51
67
  * // Explicitly disable
52
68
  * const wallet = await Wallet.create({
53
- * identity: SingleKey.fromHex('...'),
54
- * arkServerUrl: 'https://ark.example.com',
69
+ * identity: MnemonicIdentity.fromMnemonic('abandon abandon...'),
70
+ * arkServerUrl: 'https://arkade.computer',
55
71
  * settlementConfig: false,
56
72
  * });
57
73
  * ```
58
74
  */
59
75
  export interface SettlementConfig {
60
76
  /**
61
- * Seconds before VTXO expiry to trigger renewal.
62
- * @default 259200 (3 days)
77
+ * Seconds before virtual output expiry to trigger renewal.
78
+ *
79
+ * @defaultValue `259_200` (3 days)
63
80
  */
64
81
  vtxoThreshold?: number;
65
82
  /**
66
- * Sweep expired boarding UTXOs back to a fresh boarding address
67
- * via the unilateral exit path (on-chain self-spend to restart the timelock).
83
+ * Sweep expired boarding inputs back to a fresh boarding address
84
+ * via the unilateral exit path (onchain self-spend to restart the timelock).
85
+ *
86
+ * When enabled, expired boarding inputs are batched into a single onchain
87
+ * transaction with multiple inputs and one output.
68
88
  *
69
- * When enabled, expired boarding UTXOs are batched into a single on-chain transaction
70
- * with multiple inputs and one output. A dust check ensures the sweep is only
71
- * performed when the output after fees is above dust.
89
+ * A dust check ensures the sweep is only performed when the output
90
+ * after fees is above dust.
72
91
  *
73
- * @default true
92
+ * @defaultValue `true`
74
93
  */
75
94
  boardingUtxoSweep?: boolean;
76
95
  /**
77
- * Polling interval in milliseconds for checking boarding UTXOs.
78
- * The poll loop auto-settles new boarding UTXOs into Ark and
96
+ * Polling interval in milliseconds for checking boarding inputs.
97
+ * The poll loop auto-settles new boarding inputs into Arkade and
79
98
  * sweeps expired ones (when boardingUtxoSweep is enabled).
80
99
  *
81
- * @default 60000 (1 minute)
100
+ * @defaultValue `60_000` (1 minute)
82
101
  */
83
102
  pollIntervalMs?: number;
84
103
  }
85
104
  /**
86
- * Default renewal configuration values
87
- * @deprecated Use DEFAULT_SETTLEMENT_CONFIG instead
105
+ * Default renewal configuration values.
106
+ *
107
+ * @see RenewalConfig
108
+ * @deprecated Leave `renewalConfig` undefined and use `settlementConfig` instead.
109
+ * @see SettlementConfig
88
110
  */
89
111
  export declare const DEFAULT_RENEWAL_CONFIG: Required<Omit<RenewalConfig, "enabled">>;
90
112
  /**
91
- * Default settlement configuration values
113
+ * Default settlement configuration values.
114
+ *
115
+ * @see SettlementConfig
116
+ *
117
+ * @example
118
+ * ```typescript
119
+ * const wallet = await Wallet.create({
120
+ * identity,
121
+ * arkServerUrl: 'https://arkade.computer',
122
+ * settlementConfig: DEFAULT_SETTLEMENT_CONFIG,
123
+ * })
124
+ * ```
92
125
  */
93
126
  export declare const DEFAULT_SETTLEMENT_CONFIG: Required<SettlementConfig>;
94
127
  /**
95
- * Check if a VTXO is expiring soon based on threshold
128
+ * Check if a virtual output is expiring soon based on threshold
96
129
  *
97
- * @param vtxo - The virtual coin to check
130
+ * @param vtxo - The virtual output to check
98
131
  * @param thresholdMs - Threshold in milliseconds from now
99
- * @returns true if VTXO expires within threshold, false otherwise
132
+ * @returns true if virtual output expires within threshold, false otherwise
100
133
  */
101
134
  export declare function isVtxoExpiringSoon(vtxo: ExtendedVirtualCoin, thresholdMs: number): boolean;
102
135
  /**
103
- * Filter VTXOs that are expiring soon or are recoverable/subdust
136
+ * Filter virtual outputs that are expiring soon or are recoverable/subdust
104
137
  *
105
- * @param vtxos - Array of virtual coins to check
138
+ * @param vtxos - Array of virtual outputs to check
106
139
  * @param thresholdMs - Threshold in milliseconds from now
107
140
  * @param dustAmount - Dust threshold amount in satoshis
108
- * @returns Array of VTXOs expiring within threshold
141
+ * @returns Array of virtual outputs expiring within threshold
109
142
  */
110
143
  export declare function getExpiringAndRecoverableVtxos(vtxos: ExtendedVirtualCoin[], thresholdMs: number, dustAmount: bigint): ExtendedVirtualCoin[];
111
144
  /**
112
- * VtxoManager is a unified class for managing VTXO lifecycle operations including
113
- * recovery of swept/expired VTXOs and renewal to prevent expiration.
145
+ * VtxoManager is a unified class for managing virtual output lifecycle operations including
146
+ * recovery of swept/expired virtual outputs and renewal to prevent expiration.
114
147
  *
115
148
  * Key Features:
116
- * - **Recovery**: Reclaim swept or expired VTXOs back to the wallet
117
- * - **Renewal**: Refresh VTXO expiration time before they expire
118
- * - **Smart subdust handling**: Automatically includes subdust VTXOs when economically viable
119
- * - **Expiry monitoring**: Check for VTXOs that are expiring soon
149
+ * - **Recovery**: Reclaim swept or expired virtual outputs back to the wallet
150
+ * - **Renewal**: Refresh virtual output expiration time before they expire
151
+ * - **Smart subdust handling**: Automatically includes subdust virtual outputs when economically viable
152
+ * - **Expiry monitoring**: Check for virtual outputs that are expiring soon
120
153
  *
121
- * VTXOs become recoverable when:
122
- * - The Ark server sweeps them (virtualStatus.state === "swept") and they remain spendable
123
- * - They are preconfirmed subdust (to consolidate small amounts without locking liquidity on settled VTXOs)
154
+ * Virtual outputs become recoverable when:
155
+ * - The Arkade server sweeps them (virtualStatus.state === "swept") and they remain spendable
156
+ * - They are preconfirmed subdust (to consolidate small amounts without locking liquidity on settled virtual outputs)
124
157
  *
125
158
  * @example
126
159
  * ```typescript
127
- * // Initialize with renewal config
128
- * const manager = new VtxoManager(wallet, {
129
- * enabled: true,
130
- * thresholdMs: 86400000
160
+ * const wallet = await Wallet.create({
161
+ * identity,
162
+ * arkServerUrl: 'https://arkade.computer',
163
+ * settlementConfig: {
164
+ * // Seconds before virtual output expiry to trigger renewal
165
+ * vtxoThreshold: 259_200, // 3 days
166
+ * // Whether to sweep expired boarding inputs back to a fresh boarding address
167
+ * boardingUtxoSweep: true,
168
+ * // Polling interval in milliseconds for checking boarding inputs
169
+ * pollIntervalMs: 60_000 // 1 minute
170
+ * },
131
171
  * });
172
+ * const manager = await wallet.getVtxoManager();
132
173
  *
133
174
  * // Check recoverable balance
134
175
  * const balance = await manager.getRecoverableBalance();
@@ -137,10 +178,10 @@ export declare function getExpiringAndRecoverableVtxos(vtxos: ExtendedVirtualCoi
137
178
  * const txid = await manager.recoverVtxos();
138
179
  * }
139
180
  *
140
- * // Check for expiring VTXOs
181
+ * // Check for expiring virtual outputs
141
182
  * const expiring = await manager.getExpiringVtxos();
142
183
  * if (expiring.length > 0) {
143
- * console.log(`${expiring.length} VTXOs expiring soon`);
184
+ * console.log(`${expiring.length} virtual outputs expiring soon`);
144
185
  * const txid = await manager.renewVtxos();
145
186
  * }
146
187
  * ```
@@ -183,24 +224,24 @@ export declare class VtxoManager implements AsyncDisposable, IVtxoManager {
183
224
  /** @deprecated Use settlementConfig instead */
184
225
  renewalConfig?: RenewalConfig | undefined, settlementConfig?: SettlementConfig | false);
185
226
  /**
186
- * Recover swept/expired VTXOs by settling them back to the wallet's Ark address.
227
+ * Recover swept/expired virtual outputs by settling them back to the wallet's Arkade address.
187
228
  *
188
229
  * This method:
189
- * 1. Fetches all VTXOs (including recoverable ones)
190
- * 2. Filters for swept but still spendable VTXOs and preconfirmed subdust
191
- * 3. Includes subdust VTXOs if the total value >= dust threshold
192
- * 4. Settles everything back to the wallet's Ark address
230
+ * 1. Fetches all virtual outputs (including recoverable ones)
231
+ * 2. Filters for swept but still spendable virtual outputs and preconfirmed subdust
232
+ * 3. Includes subdust virtual outputs if the total value >= dust threshold
233
+ * 4. Settles everything back to the wallet's Arkade address
193
234
  *
194
- * Note: Settled VTXOs with long expiry are NOT recovered to avoid locking liquidity unnecessarily.
235
+ * Note: Settled virtual outputs with long expiry are NOT recovered to avoid locking liquidity unnecessarily.
195
236
  * Only preconfirmed subdust is recovered to consolidate small amounts.
196
237
  *
197
238
  * @param eventCallback - Optional callback to receive settlement events
198
239
  * @returns Settlement transaction ID
199
- * @throws Error if no recoverable VTXOs found
240
+ * @throws Error if no recoverable virtual outputs found
200
241
  *
201
242
  * @example
202
243
  * ```typescript
203
- * const manager = new VtxoManager(wallet);
244
+ * const manager = await wallet.getVtxoManager();
204
245
  *
205
246
  * // Simple recovery
206
247
  * const txid = await manager.recoverVtxos();
@@ -221,13 +262,13 @@ export declare class VtxoManager implements AsyncDisposable, IVtxoManager {
221
262
  *
222
263
  * @example
223
264
  * ```typescript
224
- * const manager = new VtxoManager(wallet);
265
+ * const manager = await wallet.getVtxoManager();
225
266
  * const balance = await manager.getRecoverableBalance();
226
267
  *
227
268
  * if (balance.recoverable > 0n) {
228
269
  * console.log(`You can recover ${balance.recoverable} sats`);
229
270
  * if (balance.includesSubdust) {
230
- * console.log(`This includes ${balance.subdust} sats from subdust VTXOs`);
271
+ * console.log(`This includes ${balance.subdust} sats from subdust virtual outputs`);
231
272
  * }
232
273
  * }
233
274
  * ```
@@ -239,36 +280,43 @@ export declare class VtxoManager implements AsyncDisposable, IVtxoManager {
239
280
  vtxoCount: number;
240
281
  }>;
241
282
  /**
242
- * Get VTXOs that are expiring soon based on renewal configuration
283
+ * Get virtual outputs that are expiring soon based on renewal configuration
243
284
  *
244
285
  * @param thresholdMs - Optional override for threshold in milliseconds
245
- * @returns Array of expiring VTXOs, empty array if renewal is disabled or no VTXOs expiring
286
+ * @returns Array of expiring virtual outputs, empty array if renewal is disabled or no virtual outputs expiring
246
287
  *
247
288
  * @example
248
289
  * ```typescript
249
- * const manager = new VtxoManager(wallet, { enabled: true, thresholdMs: 86400000 });
290
+ * const wallet = await Wallet.create({
291
+ * identity,
292
+ * arkServerUrl: 'https://arkade.computer',
293
+ * settlementConfig: {
294
+ * vtxoThreshold: 86_400 // 24 hours
295
+ * },
296
+ * });
297
+ * const manager = await wallet.getVtxoManager();
250
298
  * const expiringVtxos = await manager.getExpiringVtxos();
251
299
  * if (expiringVtxos.length > 0) {
252
- * console.log(`${expiringVtxos.length} VTXOs expiring soon`);
300
+ * console.log(`${expiringVtxos.length} virtual outputs expiring soon`);
253
301
  * }
254
302
  * ```
255
303
  */
256
304
  getExpiringVtxos(thresholdMs?: number): Promise<ExtendedVirtualCoin[]>;
257
305
  /**
258
- * Renew expiring VTXOs by settling them back to the wallet's address
306
+ * Renew expiring virtual outputs by settling them back to the wallet's address
259
307
  *
260
- * This method collects all expiring spendable VTXOs (including recoverable ones) and settles
308
+ * This method collects all expiring spendable virtual outputs (including recoverable ones) and settles
261
309
  * them back to the wallet, effectively refreshing their expiration time. This is the
262
- * primary way to prevent VTXOs from expiring.
310
+ * primary way to prevent virtual outputs from expiring.
263
311
  *
264
312
  * @param eventCallback - Optional callback for settlement events
265
313
  * @returns Settlement transaction ID
266
- * @throws Error if no VTXOs available to renew
314
+ * @throws Error if no virtual outputs available to renew
267
315
  * @throws Error if total amount is below dust threshold
268
316
  *
269
317
  * @example
270
318
  * ```typescript
271
- * const manager = new VtxoManager(wallet);
319
+ * const manager = await wallet.getVtxoManager();
272
320
  *
273
321
  * // Simple renewal
274
322
  * const txid = await manager.renewVtxos();
@@ -281,49 +329,54 @@ export declare class VtxoManager implements AsyncDisposable, IVtxoManager {
281
329
  */
282
330
  renewVtxos(eventCallback?: (event: SettlementEvent) => void): Promise<string>;
283
331
  /**
284
- * Get boarding UTXOs whose timelock has expired.
332
+ * Get boarding inputs whose timelock has expired.
285
333
  *
286
- * These UTXOs can no longer be onboarded cooperatively via `settle()` and
334
+ * These inputs can no longer be onboarded cooperatively via `settle()` and
287
335
  * must be swept back to a fresh boarding address using the unilateral exit path.
288
336
  *
289
- * @returns Array of expired boarding UTXOs
337
+ * @returns Array of expired boarding inputs
290
338
  *
291
339
  * @example
292
340
  * ```typescript
293
- * const manager = new VtxoManager(wallet);
341
+ * const manager = await wallet.getVtxoManager();
294
342
  * const expired = await manager.getExpiredBoardingUtxos();
295
343
  * if (expired.length > 0) {
296
- * console.log(`${expired.length} expired boarding UTXOs to sweep`);
344
+ * console.log(`${expired.length} expired boarding inputs to sweep`);
297
345
  * }
298
346
  * ```
299
347
  */
300
348
  getExpiredBoardingUtxos(prefetchedUtxos?: ExtendedCoin[]): Promise<ExtendedCoin[]>;
301
349
  /**
302
- * Sweep expired boarding UTXOs back to a fresh boarding address via
303
- * the unilateral exit path (on-chain self-spend).
350
+ * Sweep expired boarding inputs back to a fresh boarding address via
351
+ * the unilateral exit path (onchain self-spend).
304
352
  *
305
- * This builds a raw on-chain transaction that:
306
- * - Uses all expired boarding UTXOs as inputs (spent via the CSV exit script path)
353
+ * This builds a raw onchain transaction that:
354
+ * - Uses all expired boarding inputs as inputs (spent via the CSV exit script path)
307
355
  * - Has a single output to the wallet's boarding address (restarts the timelock)
308
- * - Batches multiple expired UTXOs into one transaction
356
+ * - Batches multiple expired boarding inputs into one transaction
309
357
  * - Skips the sweep if the output after fees would be below dust
310
358
  *
311
- * No Ark server involvement is needed — this is a pure on-chain transaction.
359
+ * No Arkade server involvement is needed — this is a pure onchain transaction.
312
360
  *
313
361
  * @returns The broadcast transaction ID
314
- * @throws Error if no expired boarding UTXOs found
362
+ * @throws Error if no expired boarding inputs are found
315
363
  * @throws Error if output after fees is below dust (not economical to sweep)
316
- * @throws Error if boarding UTXO sweep is not enabled in settlementConfig
364
+ * @throws Error if boarding input sweep is not enabled in settlementConfig
317
365
  *
318
366
  * @example
319
367
  * ```typescript
320
- * const manager = new VtxoManager(wallet, undefined, {
321
- * boardingUtxoSweep: true,
368
+ * const wallet = await Wallet.create({
369
+ * identity,
370
+ * arkServerUrl: 'https://arkade.computer',
371
+ * settlementConfig: {
372
+ * boardingUtxoSweep: true,
373
+ * },
322
374
  * });
375
+ * const manager = await wallet.getVtxoManager();
323
376
  *
324
377
  * try {
325
378
  * const txid = await manager.sweepExpiredBoardingUtxos();
326
- * console.log('Swept expired boarding UTXOs:', txid);
379
+ * console.log('Swept expired boarding inputs:', txid);
327
380
  * } catch (e) {
328
381
  * console.log('No sweep needed or not economical');
329
382
  * }
@@ -338,7 +391,7 @@ export declare class VtxoManager implements AsyncDisposable, IVtxoManager {
338
391
  private getBoardingExitLeaf;
339
392
  /** Returns the pkScript (output script) of the boarding tapscript. */
340
393
  private getBoardingOutputScript;
341
- /** Returns the on-chain provider for fee estimation and broadcasting. */
394
+ /** Returns the onchain provider for fee estimation and broadcasting. */
342
395
  private getOnchainProvider;
343
396
  /** Returns the Bitcoin network configuration from the wallet. */
344
397
  private getNetwork;
@@ -349,8 +402,8 @@ export declare class VtxoManager implements AsyncDisposable, IVtxoManager {
349
402
  private getNextPollDelay;
350
403
  /**
351
404
  * Starts a polling loop that:
352
- * 1. Auto-settles new boarding UTXOs into Ark
353
- * 2. Sweeps expired boarding UTXOs (when boardingUtxoSweep is enabled)
405
+ * 1. Auto-settles new boarding inputs into Arkade
406
+ * 2. Sweeps expired boarding inputs (when boardingUtxoSweep is enabled)
354
407
  *
355
408
  * Uses setTimeout chaining (not setInterval) so a slow/blocked poll
356
409
  * cannot stack up and the next delay can incorporate backoff.
@@ -359,7 +412,7 @@ export declare class VtxoManager implements AsyncDisposable, IVtxoManager {
359
412
  private schedulePoll;
360
413
  private pollBoardingUtxos;
361
414
  /**
362
- * Auto-settle new (unexpired) boarding UTXOs into the Ark.
415
+ * Auto-settle new (unexpired) boarding inputs into Arkade.
363
416
  * Skips UTXOs that are already expired (those are handled by sweep).
364
417
  * Only settles UTXOs not already in-flight (tracked in knownBoardingUtxos).
365
418
  * UTXOs are marked as known only after a successful settle, so failed