@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.
- package/README.md +102 -96
- package/dist/cjs/arkfee/estimator.js +1 -1
- package/dist/cjs/arkfee/types.js +2 -1
- package/dist/cjs/arknote/index.js +43 -4
- package/dist/cjs/bip322/index.js +1 -1
- package/dist/cjs/contracts/arkcontract.js +1 -1
- package/dist/cjs/contracts/contractManager.js +60 -28
- package/dist/cjs/contracts/contractWatcher.js +29 -22
- package/dist/cjs/contracts/handlers/default.js +1 -1
- package/dist/cjs/contracts/handlers/delegate.js +1 -1
- package/dist/cjs/contracts/handlers/helpers.js +1 -1
- package/dist/cjs/extension/asset/assetGroup.js +92 -5
- package/dist/cjs/extension/asset/assetId.js +67 -3
- package/dist/cjs/extension/asset/assetInput.js +18 -0
- package/dist/cjs/extension/asset/assetOutput.js +15 -0
- package/dist/cjs/extension/asset/assetRef.js +66 -0
- package/dist/cjs/extension/asset/metadata.js +15 -0
- package/dist/cjs/extension/asset/packet.js +4 -1
- package/dist/cjs/extension/index.js +1 -1
- package/dist/cjs/forfeit.js +14 -0
- package/dist/cjs/identity/seedIdentity.js +2 -2
- package/dist/cjs/identity/singleKey.js +4 -0
- package/dist/cjs/intent/index.js +28 -12
- package/dist/cjs/providers/ark.js +3 -2
- package/dist/cjs/providers/delegator.js +20 -1
- package/dist/cjs/providers/expoArk.js +2 -2
- package/dist/cjs/providers/indexer.js +2 -2
- package/dist/cjs/providers/onchain.js +2 -1
- package/dist/cjs/repositories/realm/schemas.js +2 -2
- package/dist/cjs/repositories/realm/types.js +1 -1
- package/dist/cjs/script/address.js +37 -6
- package/dist/cjs/script/base.js +70 -1
- package/dist/cjs/script/default.js +3 -0
- package/dist/cjs/script/delegate.js +4 -0
- package/dist/cjs/script/tapscript.js +17 -2
- package/dist/cjs/script/vhtlc.js +35 -27
- package/dist/cjs/storage/fileSystem.js +1 -1
- package/dist/cjs/storage/inMemory.js +1 -1
- package/dist/cjs/storage/indexedDB.js +1 -1
- package/dist/cjs/storage/localStorage.js +1 -1
- package/dist/cjs/tree/validation.js +1 -1
- package/dist/cjs/utils/arkTransaction.js +5 -5
- package/dist/cjs/utils/bip21.js +16 -3
- package/dist/cjs/utils/syncCursors.js +4 -4
- package/dist/cjs/utils/transaction.js +1 -1
- package/dist/cjs/utils/transactionHistory.js +11 -11
- package/dist/cjs/utils/unknownFields.js +3 -3
- package/dist/cjs/wallet/asset-manager.js +4 -4
- package/dist/cjs/wallet/batch.js +5 -5
- package/dist/cjs/wallet/delegator.js +9 -8
- package/dist/cjs/wallet/expo/background.js +3 -3
- package/dist/cjs/wallet/expo/wallet.js +7 -7
- package/dist/cjs/wallet/index.js +43 -0
- package/dist/cjs/wallet/onchain.js +43 -5
- package/dist/cjs/wallet/ramps.js +44 -14
- package/dist/cjs/wallet/serviceWorker/wallet-message-handler.js +22 -22
- package/dist/cjs/wallet/serviceWorker/wallet.js +28 -24
- package/dist/cjs/wallet/unroll.js +12 -8
- package/dist/cjs/wallet/utils.js +1 -1
- package/dist/cjs/wallet/vtxo-manager.js +122 -82
- package/dist/cjs/wallet/wallet.js +140 -77
- package/dist/cjs/worker/expo/asyncStorageTaskQueue.js +1 -1
- package/dist/cjs/worker/expo/processors/contractPollProcessor.js +2 -2
- package/dist/cjs/worker/expo/taskRunner.js +3 -3
- package/dist/cjs/worker/messageBus.js +3 -0
- package/dist/esm/arkfee/estimator.js +1 -1
- package/dist/esm/arkfee/types.js +2 -1
- package/dist/esm/arknote/index.js +43 -4
- package/dist/esm/bip322/index.js +1 -1
- package/dist/esm/contracts/arkcontract.js +1 -1
- package/dist/esm/contracts/contractManager.js +60 -28
- package/dist/esm/contracts/contractWatcher.js +29 -22
- package/dist/esm/contracts/handlers/default.js +1 -1
- package/dist/esm/contracts/handlers/delegate.js +1 -1
- package/dist/esm/contracts/handlers/helpers.js +1 -1
- package/dist/esm/extension/asset/assetGroup.js +92 -5
- package/dist/esm/extension/asset/assetId.js +67 -3
- package/dist/esm/extension/asset/assetInput.js +18 -0
- package/dist/esm/extension/asset/assetOutput.js +15 -0
- package/dist/esm/extension/asset/assetRef.js +66 -0
- package/dist/esm/extension/asset/metadata.js +15 -0
- package/dist/esm/extension/asset/packet.js +4 -1
- package/dist/esm/extension/index.js +1 -1
- package/dist/esm/forfeit.js +14 -0
- package/dist/esm/identity/seedIdentity.js +2 -2
- package/dist/esm/identity/singleKey.js +4 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/intent/index.js +28 -12
- package/dist/esm/providers/ark.js +3 -2
- package/dist/esm/providers/delegator.js +20 -1
- package/dist/esm/providers/expoArk.js +2 -2
- package/dist/esm/providers/indexer.js +2 -2
- package/dist/esm/providers/onchain.js +2 -1
- package/dist/esm/repositories/realm/schemas.js +2 -2
- package/dist/esm/repositories/realm/types.js +1 -1
- package/dist/esm/script/address.js +37 -6
- package/dist/esm/script/base.js +70 -1
- package/dist/esm/script/default.js +3 -0
- package/dist/esm/script/delegate.js +4 -0
- package/dist/esm/script/tapscript.js +17 -2
- package/dist/esm/script/vhtlc.js +35 -27
- package/dist/esm/storage/fileSystem.js +1 -1
- package/dist/esm/storage/inMemory.js +1 -1
- package/dist/esm/storage/indexedDB.js +1 -1
- package/dist/esm/storage/localStorage.js +1 -1
- package/dist/esm/tree/validation.js +1 -1
- package/dist/esm/utils/arkTransaction.js +5 -5
- package/dist/esm/utils/bip21.js +16 -3
- package/dist/esm/utils/syncCursors.js +4 -4
- package/dist/esm/utils/transaction.js +1 -1
- package/dist/esm/utils/transactionHistory.js +11 -11
- package/dist/esm/utils/unknownFields.js +3 -3
- package/dist/esm/wallet/asset-manager.js +4 -4
- package/dist/esm/wallet/batch.js +5 -5
- package/dist/esm/wallet/delegator.js +9 -8
- package/dist/esm/wallet/expo/background.js +3 -3
- package/dist/esm/wallet/expo/wallet.js +7 -7
- package/dist/esm/wallet/index.js +43 -0
- package/dist/esm/wallet/onchain.js +43 -5
- package/dist/esm/wallet/ramps.js +44 -14
- package/dist/esm/wallet/serviceWorker/wallet-message-handler.js +22 -22
- package/dist/esm/wallet/serviceWorker/wallet.js +28 -24
- package/dist/esm/wallet/unroll.js +12 -8
- package/dist/esm/wallet/utils.js +1 -1
- package/dist/esm/wallet/vtxo-manager.js +121 -81
- package/dist/esm/wallet/wallet.js +140 -77
- package/dist/esm/worker/expo/asyncStorageTaskQueue.js +1 -1
- package/dist/esm/worker/expo/processors/contractPollProcessor.js +2 -2
- package/dist/esm/worker/expo/taskRunner.js +3 -3
- package/dist/esm/worker/messageBus.js +3 -0
- package/dist/types/arkfee/estimator.d.ts +1 -1
- package/dist/types/arkfee/types.d.ts +2 -1
- package/dist/types/arknote/index.d.ts +44 -4
- package/dist/types/bip322/index.d.ts +1 -1
- package/dist/types/contracts/arkcontract.d.ts +1 -1
- package/dist/types/contracts/contractManager.d.ts +39 -65
- package/dist/types/contracts/contractWatcher.d.ts +39 -18
- package/dist/types/contracts/handlers/default.d.ts +1 -1
- package/dist/types/contracts/handlers/delegate.d.ts +1 -1
- package/dist/types/contracts/handlers/helpers.d.ts +1 -1
- package/dist/types/contracts/types.d.ts +36 -26
- package/dist/types/extension/asset/assetGroup.d.ts +92 -1
- package/dist/types/extension/asset/assetId.d.ts +67 -3
- package/dist/types/extension/asset/assetInput.d.ts +18 -0
- package/dist/types/extension/asset/assetOutput.d.ts +15 -0
- package/dist/types/extension/asset/assetRef.d.ts +66 -0
- package/dist/types/extension/asset/metadata.d.ts +15 -0
- package/dist/types/extension/asset/packet.d.ts +4 -1
- package/dist/types/extension/index.d.ts +1 -1
- package/dist/types/forfeit.d.ts +14 -0
- package/dist/types/identity/index.d.ts +16 -0
- package/dist/types/identity/seedIdentity.d.ts +8 -6
- package/dist/types/identity/singleKey.d.ts +4 -0
- package/dist/types/intent/index.d.ts +19 -6
- package/dist/types/providers/ark.d.ts +40 -2
- package/dist/types/providers/delegator.d.ts +54 -1
- package/dist/types/providers/expoArk.d.ts +2 -2
- package/dist/types/providers/indexer.d.ts +105 -2
- package/dist/types/providers/onchain.d.ts +62 -1
- package/dist/types/repositories/realm/schemas.d.ts +2 -2
- package/dist/types/repositories/realm/types.d.ts +2 -2
- package/dist/types/repositories/walletRepository.d.ts +16 -0
- package/dist/types/script/address.d.ts +35 -2
- package/dist/types/script/base.d.ts +66 -1
- package/dist/types/script/default.d.ts +3 -0
- package/dist/types/script/delegate.d.ts +4 -0
- package/dist/types/script/tapscript.d.ts +17 -2
- package/dist/types/script/vhtlc.d.ts +35 -27
- package/dist/types/storage/fileSystem.d.ts +1 -1
- package/dist/types/storage/inMemory.d.ts +1 -1
- package/dist/types/storage/index.d.ts +1 -1
- package/dist/types/storage/indexedDB.d.ts +1 -1
- package/dist/types/storage/localStorage.d.ts +1 -1
- package/dist/types/utils/arkTransaction.d.ts +3 -3
- package/dist/types/utils/bip21.d.ts +17 -0
- package/dist/types/utils/syncCursors.d.ts +4 -4
- package/dist/types/utils/transaction.d.ts +1 -1
- package/dist/types/utils/transactionHistory.d.ts +3 -3
- package/dist/types/utils/unknownFields.d.ts +5 -5
- package/dist/types/wallet/asset-manager.d.ts +3 -3
- package/dist/types/wallet/batch.d.ts +27 -7
- package/dist/types/wallet/delegator.d.ts +10 -0
- package/dist/types/wallet/expo/background.d.ts +4 -4
- package/dist/types/wallet/expo/wallet.d.ts +10 -10
- package/dist/types/wallet/index.d.ts +457 -25
- package/dist/types/wallet/onchain.d.ts +42 -4
- package/dist/types/wallet/ramps.d.ts +40 -10
- package/dist/types/wallet/serviceWorker/wallet-message-handler.d.ts +4 -4
- package/dist/types/wallet/serviceWorker/wallet.d.ts +71 -33
- package/dist/types/wallet/unroll.d.ts +8 -6
- package/dist/types/wallet/vtxo-manager.d.ts +146 -93
- package/dist/types/wallet/wallet.d.ts +91 -33
- package/dist/types/worker/expo/asyncStorageTaskQueue.d.ts +1 -1
- package/dist/types/worker/expo/processors/contractPollProcessor.d.ts +1 -1
- package/dist/types/worker/expo/taskRunner.d.ts +6 -6
- package/dist/types/worker/messageBus.d.ts +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ The SDK supports read-only wallets that allow you to query wallet state without
|
|
|
45
45
|
#### Creating a Read-Only Wallet
|
|
46
46
|
|
|
47
47
|
```typescript
|
|
48
|
-
import { ReadonlySingleKey, ReadonlyWallet } from '@arkade-os/sdk'
|
|
48
|
+
import { SingleKey, ReadonlySingleKey, ReadonlyWallet } from '@arkade-os/sdk'
|
|
49
49
|
|
|
50
50
|
// Create a read-only identity from a public key
|
|
51
51
|
const identity = SingleKey.fromHex('e09ca...56609')
|
|
@@ -221,8 +221,8 @@ const identity = new MyBrowserWallet()
|
|
|
221
221
|
console.log(isBatchSignable(identity)) // true
|
|
222
222
|
|
|
223
223
|
// Wallet.send() uses one popup instead of N+1
|
|
224
|
-
const wallet = await Wallet.create({ identity, arkServerUrl: '
|
|
225
|
-
await wallet.
|
|
224
|
+
const wallet = await Wallet.create({ identity, arkServerUrl: 'https://arkade.computer' })
|
|
225
|
+
await wallet.send({ address: 'ark1q...', amount: 1000 })
|
|
226
226
|
```
|
|
227
227
|
|
|
228
228
|
Identities without `signMultiple` continue to work unchanged — each checkpoint is signed individually via `sign()`.
|
|
@@ -240,17 +240,17 @@ console.log('Boarding (Mainnet) Address:', boardingAddress)
|
|
|
240
240
|
|
|
241
241
|
const incomingFunds = await waitForIncomingFunds(wallet)
|
|
242
242
|
if (incomingFunds.type === "vtxo") {
|
|
243
|
-
// Virtual
|
|
244
|
-
console.log("VTXOs: ", incomingFunds.
|
|
243
|
+
// Virtual outputs received
|
|
244
|
+
console.log("VTXOs: ", incomingFunds.newVtxos)
|
|
245
245
|
} else if (incomingFunds.type === "utxo") {
|
|
246
|
-
// Boarding
|
|
246
|
+
// Boarding inputs received
|
|
247
247
|
console.log("UTXOs: ", incomingFunds.coins)
|
|
248
248
|
}
|
|
249
249
|
```
|
|
250
250
|
|
|
251
251
|
### Onboarding
|
|
252
252
|
|
|
253
|
-
Onboarding allows you to swap
|
|
253
|
+
Onboarding allows you to swap onchain funds into virtual outputs:
|
|
254
254
|
|
|
255
255
|
```typescript
|
|
256
256
|
import { Ramps } from '@arkade-os/sdk'
|
|
@@ -270,11 +270,11 @@ console.log('Offchain Settled:', balance.settled)
|
|
|
270
270
|
console.log('Offchain Preconfirmed:', balance.preconfirmed)
|
|
271
271
|
console.log('Recoverable:', balance.recoverable)
|
|
272
272
|
|
|
273
|
-
// Get virtual
|
|
274
|
-
const
|
|
273
|
+
// Get virtual outputs (available for offchain spending)
|
|
274
|
+
const vtxos = await wallet.getVtxos()
|
|
275
275
|
|
|
276
|
-
// Get boarding
|
|
277
|
-
const
|
|
276
|
+
// Get boarding inputs
|
|
277
|
+
const boardingInputs = await wallet.getBoardingUtxos()
|
|
278
278
|
```
|
|
279
279
|
|
|
280
280
|
### Sending Bitcoin
|
|
@@ -304,6 +304,9 @@ const { assetId: controlAssetId } = await wallet.assetManager.issue({
|
|
|
304
304
|
const { assetId } = await wallet.assetManager.issue({
|
|
305
305
|
amount: 500,
|
|
306
306
|
controlAssetId,
|
|
307
|
+
metadata: {
|
|
308
|
+
ticker: 'MTK'
|
|
309
|
+
}
|
|
307
310
|
})
|
|
308
311
|
|
|
309
312
|
// Reissue more supply of the asset (requires ownership of the control asset)
|
|
@@ -331,18 +334,18 @@ const assetBalance = assets.find(asset => asset.assetId === assetId)?.amount
|
|
|
331
334
|
|
|
332
335
|
### Batch Settlement
|
|
333
336
|
|
|
334
|
-
The `settle` method can be used to move preconfirmed balances into finalized balances and to manually convert
|
|
337
|
+
The `settle` method can be used to move preconfirmed balances into finalized balances and to manually convert onchain funds to virtual outputs.
|
|
335
338
|
|
|
336
339
|
```typescript
|
|
337
|
-
// Fetch offchain preconfirmed
|
|
338
|
-
const [
|
|
340
|
+
// Fetch offchain preconfirmed outputs and onchain boarding inputs
|
|
341
|
+
const [vtxos, boardingInputs] = await Promise.all([
|
|
339
342
|
wallet.getVtxos(),
|
|
340
343
|
wallet.getBoardingUtxos()
|
|
341
344
|
])
|
|
342
345
|
|
|
343
346
|
// For settling transactions
|
|
344
347
|
const settlementTxId = await wallet.settle({
|
|
345
|
-
inputs: [...
|
|
348
|
+
inputs: [...vtxos, ...boardingInputs],
|
|
346
349
|
// Optional: specify a mainnet output
|
|
347
350
|
outputs: [{
|
|
348
351
|
address: "bc1p...",
|
|
@@ -351,19 +354,21 @@ const settlementTxId = await wallet.settle({
|
|
|
351
354
|
})
|
|
352
355
|
```
|
|
353
356
|
|
|
354
|
-
###
|
|
357
|
+
### Virtual Output Management (Renewal & Recovery)
|
|
358
|
+
|
|
359
|
+
Virtual outputs have an expiration time (batch expiry).
|
|
355
360
|
|
|
356
|
-
|
|
361
|
+
The SDK provides the `VtxoManager` class to handle:
|
|
357
362
|
|
|
358
|
-
- **Renewal**: Renew
|
|
359
|
-
- **Recovery**: Reclaim swept or expired
|
|
360
|
-
- **Boarding
|
|
363
|
+
- **Renewal**: Renew virtual outputs before they expire to maintain unilateral control of the funds.
|
|
364
|
+
- **Recovery**: Reclaim swept or expired virtual outputs back to the wallet in case renewal window was missed.
|
|
365
|
+
- **Boarding Input Sweep**: Sweep expired boarding inputs back to a fresh boarding address to restart the timelock.
|
|
361
366
|
|
|
362
367
|
#### Settlement Configuration
|
|
363
368
|
|
|
364
369
|
The recommended way to configure `VtxoManager` is via `settlementConfig` on the wallet.
|
|
365
370
|
If you omit `settlementConfig`, settlement is enabled with the default behavior:
|
|
366
|
-
|
|
371
|
+
Virtual output renewal at 3 days and boarding input sweep enabled.
|
|
367
372
|
|
|
368
373
|
```typescript
|
|
369
374
|
const wallet = await Wallet.create({
|
|
@@ -371,24 +376,24 @@ const wallet = await Wallet.create({
|
|
|
371
376
|
arkServerUrl: 'https://arkade.computer',
|
|
372
377
|
// Enable settlement with defaults explicitly:
|
|
373
378
|
settlementConfig: {
|
|
374
|
-
// Seconds before
|
|
375
|
-
vtxoThreshold:
|
|
376
|
-
// Whether to sweep expired boarding
|
|
379
|
+
// Seconds before virtual output expiry to trigger renewal
|
|
380
|
+
vtxoThreshold: 60 * 60 * 24 * 3, // 3 days
|
|
381
|
+
// Whether to sweep expired boarding inputs back to a fresh boarding address
|
|
377
382
|
boardingUtxoSweep: true,
|
|
378
|
-
// Polling interval in milliseconds for checking boarding
|
|
379
|
-
pollIntervalMs:
|
|
383
|
+
// Polling interval in milliseconds for checking boarding inputs
|
|
384
|
+
pollIntervalMs: 60_000 // 1 minute
|
|
380
385
|
},
|
|
381
386
|
})
|
|
382
387
|
```
|
|
383
388
|
|
|
384
389
|
```typescript
|
|
385
|
-
// Enable both
|
|
390
|
+
// Enable both virtual output renewal and boarding input sweep
|
|
386
391
|
const wallet = await Wallet.create({
|
|
387
392
|
identity,
|
|
388
393
|
arkServerUrl: 'https://arkade.computer',
|
|
389
394
|
settlementConfig: {
|
|
390
|
-
vtxoThreshold:
|
|
391
|
-
boardingUtxoSweep: true,
|
|
395
|
+
vtxoThreshold: 60 * 60 * 24, // renew when 24 hours remain (in seconds)
|
|
396
|
+
boardingUtxoSweep: true, // sweep expired boarding inputs
|
|
392
397
|
},
|
|
393
398
|
})
|
|
394
399
|
```
|
|
@@ -402,61 +407,55 @@ const wallet = await Wallet.create({
|
|
|
402
407
|
})
|
|
403
408
|
```
|
|
404
409
|
|
|
405
|
-
|
|
410
|
+
Access the `VtxoManager` from the wallet after configuring `settlementConfig`:
|
|
406
411
|
|
|
407
412
|
```typescript
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
const manager = new VtxoManager(
|
|
411
|
-
wallet,
|
|
412
|
-
undefined, // renewalConfig (deprecated)
|
|
413
|
-
wallet.settlementConfig // new settlementConfig
|
|
414
|
-
)
|
|
413
|
+
const manager = await wallet.getVtxoManager()
|
|
415
414
|
```
|
|
416
415
|
|
|
417
|
-
> **Migration from `renewalConfig`:**
|
|
416
|
+
> **Migration from `renewalConfig`:** Directly initializing a `VtxoManager` with `renewalConfig` is still supported but deprecated. Prefer `settlementConfig` where `vtxoThreshold` is expressed in **seconds** instead of milliseconds.
|
|
418
417
|
|
|
419
418
|
#### Renewal: Prevent Expiration
|
|
420
419
|
|
|
421
|
-
Renew
|
|
422
|
-
This settles expiring and recoverable
|
|
420
|
+
Renew virtual outputs before they expire to retain unilateral control of funds.
|
|
421
|
+
This settles expiring and recoverable virtual outputs back to your wallet, refreshing their expiration time.
|
|
423
422
|
|
|
424
423
|
```typescript
|
|
425
|
-
// Renew all
|
|
424
|
+
// Renew all virtual outputs to prevent expiration
|
|
426
425
|
const txid = await manager.renewVtxos()
|
|
427
|
-
// Check which
|
|
426
|
+
// Check which virtual outputs are expiring soon
|
|
428
427
|
const expiringVtxos = await manager.getExpiringVtxos()
|
|
429
|
-
// Override thresholdMs (e.g., get
|
|
428
|
+
// Override thresholdMs (e.g., get virtual outputs expiring in the next 60 seconds)
|
|
430
429
|
const urgentlyExpiring = await manager.getExpiringVtxos(60_000)
|
|
431
430
|
```
|
|
432
431
|
|
|
433
|
-
#### Boarding
|
|
432
|
+
#### Boarding Input Sweep
|
|
434
433
|
|
|
435
|
-
When a boarding
|
|
434
|
+
When a boarding input's CSV timelock expires, it can no longer be onboarded into Arkade cooperatively. The sweep feature detects these expired UTXOs and builds a raw onchain transaction that spends them via the unilateral exit path back to a fresh boarding address, restarting the timelock.
|
|
436
435
|
|
|
437
436
|
- Multiple expired UTXOs are batched into a single transaction (many inputs, one output)
|
|
438
437
|
- A dust check ensures the sweep is skipped if fees would consume the entire value
|
|
439
438
|
|
|
440
439
|
```typescript
|
|
441
|
-
// Check for expired boarding
|
|
440
|
+
// Check for expired boarding inputs
|
|
442
441
|
const expired = await manager.getExpiredBoardingUtxos()
|
|
443
|
-
console.log(`${expired.length} expired boarding
|
|
442
|
+
console.log(`${expired.length} expired boarding inputs`)
|
|
444
443
|
|
|
445
444
|
// Sweep them back to a fresh boarding address (requires boardingUtxoSweep: true)
|
|
446
445
|
try {
|
|
447
446
|
const txid = await manager.sweepExpiredBoardingUtxos()
|
|
448
|
-
console.log('Swept expired boarding
|
|
447
|
+
console.log('Swept expired boarding inputs:', txid)
|
|
449
448
|
} catch (e) {
|
|
450
|
-
// "No expired boarding
|
|
449
|
+
// "No expired boarding inputs to sweep" or "Sweep not economical"
|
|
451
450
|
}
|
|
452
451
|
```
|
|
453
452
|
|
|
454
453
|
#### Recovery: Reclaim Swept VTXOs
|
|
455
454
|
|
|
456
|
-
Recover
|
|
455
|
+
Recover virtual outputs that have been swept by the server or consolidate small amounts (subdust).
|
|
457
456
|
|
|
458
457
|
```typescript
|
|
459
|
-
// Recover swept
|
|
458
|
+
// Recover swept virtual outputs and preconfirmed subdust
|
|
460
459
|
const txid = await manager.recoverVtxos((event) => {
|
|
461
460
|
console.log('Settlement event:', event.type)
|
|
462
461
|
})
|
|
@@ -466,13 +465,17 @@ const balance = await manager.getRecoverableBalance()
|
|
|
466
465
|
```
|
|
467
466
|
|
|
468
467
|
|
|
469
|
-
###
|
|
468
|
+
### Delegation
|
|
469
|
+
|
|
470
|
+
Delegation allows users to outsource virtual output renewal to a third-party delegation service.
|
|
471
|
+
|
|
472
|
+
Instead of the delegating user renewing virtual outputs by themself, their delegate will automatically settle them before they expire, sending the funds back to the delegator's wallet address (minus a service fee).
|
|
470
473
|
|
|
471
|
-
|
|
474
|
+
This is useful for wallets that cannot be online 24/7.
|
|
472
475
|
|
|
473
|
-
When a `delegatorProvider` is configured, the wallet address includes an extra tapscript path that authorizes the
|
|
476
|
+
When a `delegatorProvider` is configured, the wallet address includes an extra tapscript path that authorizes the delegate to co-sign renewals alongside the Arkade server.
|
|
474
477
|
|
|
475
|
-
To run a
|
|
478
|
+
To run a delegation service, you'll need to set up a [Fulmine server](https://github.com/ArkLabsHQ/fulmine) with the [Delegation API](https://github.com/ArkLabsHQ/fulmine?tab=readme-ov-file#-delegate-api) enabled.
|
|
476
479
|
|
|
477
480
|
#### Setting Up a Wallet with Delegation
|
|
478
481
|
|
|
@@ -488,25 +491,28 @@ const wallet = await Wallet.create({
|
|
|
488
491
|
|
|
489
492
|
> **Note:** Adding a `delegatorProvider` changes your wallet address because the offchain tapscript includes an additional delegation path. Funds sent to an address without delegation cannot be delegated, and vice versa.
|
|
490
493
|
|
|
491
|
-
#### Delegating
|
|
494
|
+
#### Delegating Virtual Outputs
|
|
492
495
|
|
|
493
|
-
Once the wallet is configured with a
|
|
496
|
+
Once the wallet is configured with a delegate, use `wallet.delegatorManager` to delegate your virtual outputs:
|
|
494
497
|
|
|
495
498
|
```typescript
|
|
496
|
-
// Get spendable
|
|
497
|
-
const vtxos =
|
|
498
|
-
.filter(v => v.virtualStatus.type === 'confirmed')
|
|
499
|
+
// Get spendable virtual outputs (including recoverable)
|
|
500
|
+
const vtxos = await wallet.getVtxos({ withRecoverable: true })
|
|
499
501
|
|
|
500
|
-
// Delegate all
|
|
502
|
+
// Delegate all virtual outputs — the delegate will renew them before expiry
|
|
501
503
|
const arkadeAddress = await wallet.getAddress()
|
|
502
504
|
const delegatorManager = await wallet.getDelegatorManager();
|
|
503
505
|
const delegationResult = await delegatorManager.delegate(vtxos, arkadeAddress)
|
|
504
506
|
|
|
505
|
-
console.log('Delegated:',
|
|
506
|
-
console.log('Failed:',
|
|
507
|
+
console.log('Delegated:', delegationResult.delegated.length)
|
|
508
|
+
console.log('Failed:', delegationResult.failed.length)
|
|
507
509
|
```
|
|
508
510
|
|
|
509
|
-
The `delegate` method groups
|
|
511
|
+
The `delegate` method groups virtual outputs by expiry date and submits them to the delegation service.
|
|
512
|
+
|
|
513
|
+
By default, delegation is scheduled at 90% of each virtual output's remaining lifetime.
|
|
514
|
+
|
|
515
|
+
You can override this with an explicit date:
|
|
510
516
|
|
|
511
517
|
```typescript
|
|
512
518
|
// Delegate with a specific renewal time
|
|
@@ -516,7 +522,7 @@ await delegatorManager.delegate(vtxos, arkadeAddress, delegateAt)
|
|
|
516
522
|
|
|
517
523
|
#### Service Worker Integration
|
|
518
524
|
|
|
519
|
-
When using a service worker wallet, pass the `delegatorUrl` option. The service worker will automatically delegate
|
|
525
|
+
When using a service worker wallet, pass the `delegatorUrl` option. The service worker will automatically delegate virtual outputs after each update:
|
|
520
526
|
|
|
521
527
|
```typescript
|
|
522
528
|
import { ServiceWorkerWallet, MnemonicIdentity } from '@arkade-os/sdk'
|
|
@@ -529,9 +535,9 @@ const wallet = await ServiceWorkerWallet.setup({
|
|
|
529
535
|
})
|
|
530
536
|
```
|
|
531
537
|
|
|
532
|
-
#### Querying
|
|
538
|
+
#### Querying Delegate Info
|
|
533
539
|
|
|
534
|
-
You can query the
|
|
540
|
+
You can query the delegation service directly to inspect its public key, fee, and payment address:
|
|
535
541
|
|
|
536
542
|
```typescript
|
|
537
543
|
import { RestDelegatorProvider } from '@arkade-os/sdk'
|
|
@@ -539,7 +545,7 @@ import { RestDelegatorProvider } from '@arkade-os/sdk'
|
|
|
539
545
|
const provider = new RestDelegatorProvider('https://delegator.example.com')
|
|
540
546
|
const info = await provider.getDelegateInfo()
|
|
541
547
|
|
|
542
|
-
console.log('
|
|
548
|
+
console.log('Delegate public key:', info.pubkey)
|
|
543
549
|
console.log('Service fee (sats):', info.fee)
|
|
544
550
|
console.log('Fee address:', info.delegatorAddress)
|
|
545
551
|
```
|
|
@@ -590,7 +596,7 @@ const history = await wallet.getTransactionHistory()
|
|
|
590
596
|
|
|
591
597
|
### Offboarding
|
|
592
598
|
|
|
593
|
-
Collaborative exit or "offboarding" allows you to withdraw your virtual funds to an
|
|
599
|
+
Collaborative exit or "offboarding" allows you to withdraw your virtual funds to an onchain address:
|
|
594
600
|
|
|
595
601
|
```typescript
|
|
596
602
|
import { Wallet, MnemonicIdentity, Ramps } from '@arkade-os/sdk'
|
|
@@ -601,11 +607,11 @@ const wallet = await Wallet.create({
|
|
|
601
607
|
})
|
|
602
608
|
|
|
603
609
|
// Get fee information from the server
|
|
604
|
-
const { fees } = await wallet.arkProvider.getInfo();
|
|
610
|
+
const { fees: feeInfo } = await wallet.arkProvider.getInfo();
|
|
605
611
|
|
|
606
612
|
const exitTxid = await new Ramps(wallet).offboard(
|
|
607
613
|
'bc1p...',
|
|
608
|
-
|
|
614
|
+
feeInfo
|
|
609
615
|
);
|
|
610
616
|
```
|
|
611
617
|
|
|
@@ -613,10 +619,10 @@ const exitTxid = await new Ramps(wallet).offboard(
|
|
|
613
619
|
|
|
614
620
|
Unilateral exit allows you to withdraw your funds from the Arkade protocol back to the Bitcoin blockchain without requiring cooperation from the Arkade server. This process involves two main steps:
|
|
615
621
|
|
|
616
|
-
1. **Unrolling**: Broadcasting the transaction chain from
|
|
617
|
-
2. **Completing the exit**: Spending the unrolled
|
|
622
|
+
1. **Unrolling**: Broadcasting the transaction chain from offchain back to onchain
|
|
623
|
+
2. **Completing the exit**: Spending the unrolled virtual outputs after the timelock expires
|
|
618
624
|
|
|
619
|
-
#### Step 1: Unrolling
|
|
625
|
+
#### Step 1: Unrolling Virtual Outputs
|
|
620
626
|
|
|
621
627
|
```typescript
|
|
622
628
|
import { MnemonicIdentity, OnchainWallet, Unroll } from '@arkade-os/sdk'
|
|
@@ -624,11 +630,11 @@ import { MnemonicIdentity, OnchainWallet, Unroll } from '@arkade-os/sdk'
|
|
|
624
630
|
// Create an identity for the onchain wallet
|
|
625
631
|
const onchainIdentity = MnemonicIdentity.fromMnemonic('abandon abandon...')
|
|
626
632
|
|
|
627
|
-
// Create an onchain wallet to pay for P2A outputs in
|
|
633
|
+
// Create an onchain wallet to pay for P2A outputs in virtual output branches
|
|
628
634
|
// OnchainWallet implements the AnchorBumper interface
|
|
629
635
|
const onchainWallet = await OnchainWallet.create(onchainIdentity, 'regtest');
|
|
630
636
|
|
|
631
|
-
// Unroll a specific
|
|
637
|
+
// Unroll a specific virtual output
|
|
632
638
|
const vtxo = { txid: 'your_vtxo_txid', vout: 0 };
|
|
633
639
|
const session = await Unroll.Session.create(
|
|
634
640
|
vtxo,
|
|
@@ -647,7 +653,7 @@ for await (const step of session) {
|
|
|
647
653
|
console.log(`Broadcasting transaction ${step.tx.id}`);
|
|
648
654
|
break;
|
|
649
655
|
case Unroll.StepType.DONE:
|
|
650
|
-
console.log(`Unrolling complete for
|
|
656
|
+
console.log(`Unrolling complete for virtual output ${step.vtxoTxid}`);
|
|
651
657
|
break;
|
|
652
658
|
}
|
|
653
659
|
}
|
|
@@ -656,29 +662,29 @@ for await (const step of session) {
|
|
|
656
662
|
The unrolling process works by:
|
|
657
663
|
|
|
658
664
|
- Traversing the transaction chain from the root (most recent) to the leaf (oldest)
|
|
659
|
-
- Broadcasting each transaction that isn't already
|
|
665
|
+
- Broadcasting each transaction that isn't already onchain
|
|
660
666
|
- Waiting for confirmations between steps
|
|
661
667
|
- Using P2A (Pay-to-Anchor) transactions to pay for fees
|
|
662
668
|
|
|
663
669
|
#### Step 2: Completing the Exit
|
|
664
670
|
|
|
665
|
-
Once
|
|
671
|
+
Once virtual outputs are fully unrolled and the unilateral exit timelock has expired, you can complete the exit:
|
|
666
672
|
|
|
667
673
|
```typescript
|
|
668
|
-
// Complete the exit for specific
|
|
674
|
+
// Complete the exit for specific virtual outputs
|
|
669
675
|
await Unroll.completeUnroll(
|
|
670
676
|
wallet,
|
|
671
|
-
[vtxo.txid], // Array of
|
|
677
|
+
[vtxo.txid], // Array of virtual output transaction IDs to complete
|
|
672
678
|
onchainWallet.address // Address to receive the exit amount
|
|
673
679
|
);
|
|
674
680
|
```
|
|
675
681
|
|
|
676
682
|
**Important Notes:**
|
|
677
683
|
|
|
678
|
-
- Each
|
|
684
|
+
- Each virtual output may require multiple unroll steps depending on the transaction chain length
|
|
679
685
|
- Each unroll step must be confirmed before proceeding to the next
|
|
680
|
-
- The `completeUnroll` method can only be called after
|
|
681
|
-
- You need sufficient
|
|
686
|
+
- The `completeUnroll` method can only be called after all virtual outputs are fully unrolled and the timelock has expired
|
|
687
|
+
- You need sufficient onchain funds in the `OnchainWallet` to pay for P2A transaction fees
|
|
682
688
|
|
|
683
689
|
### Running the wallet in a service worker
|
|
684
690
|
|
|
@@ -970,7 +976,7 @@ const identity = MnemonicIdentity.fromMnemonic('abandon abandon...')
|
|
|
970
976
|
const wallet = await Wallet.create({
|
|
971
977
|
identity: identity,
|
|
972
978
|
arkProvider: new ExpoArkProvider('https://arkade.computer'), // For settlement events and transactions streaming
|
|
973
|
-
indexerProvider: new ExpoIndexerProvider('https://arkade.computer'), // For address subscriptions and
|
|
979
|
+
indexerProvider: new ExpoIndexerProvider('https://arkade.computer'), // For address subscriptions and virtual output state updates
|
|
974
980
|
})
|
|
975
981
|
|
|
976
982
|
// use expo/fetch for streaming support (SSE)
|
|
@@ -982,7 +988,7 @@ const address = await wallet.getAddress()
|
|
|
982
988
|
Both ExpoArkProvider and ExpoIndexerProvider are available as adapters following the SDK's modular architecture pattern. This keeps the main SDK bundle clean while providing opt-in functionality for specific environments:
|
|
983
989
|
|
|
984
990
|
- **ExpoArkProvider**: Handles settlement events and transaction streaming using expo/fetch for Server-Sent Events
|
|
985
|
-
- **ExpoIndexerProvider**: Handles address subscriptions and
|
|
991
|
+
- **ExpoIndexerProvider**: Handles address subscriptions and virtual output state updates using expo/fetch for JSON streaming
|
|
986
992
|
|
|
987
993
|
For persistence in Expo/React Native, use the SQLite repository with `expo-sqlite`:
|
|
988
994
|
|
|
@@ -1032,7 +1038,7 @@ This is required for MuSig2 settlements and cryptographic operations.
|
|
|
1032
1038
|
|
|
1033
1039
|
### Contract Management
|
|
1034
1040
|
|
|
1035
|
-
Both `Wallet` and `ServiceWorkerWallet` use a `ContractManager` internally to watch for
|
|
1041
|
+
Both `Wallet` and `ServiceWorkerWallet` use a `ContractManager` internally to watch for virtual outputs. This provides resilient connection handling with automatic reconnection and failsafe polling - for your wallet's default address and any external contracts you register (Boltz swaps, HTLCs, etc.).
|
|
1036
1042
|
|
|
1037
1043
|
When you call `wallet.notifyIncomingFunds()` or use `waitForIncomingFunds()`, it uses the ContractManager under the hood, giving you automatic reconnection and failsafe polling for free - no code changes needed.
|
|
1038
1044
|
|
|
@@ -1063,10 +1069,10 @@ const contract = await manager.createContract({
|
|
|
1063
1069
|
const unsubscribe = await manager.onContractEvent((event) => {
|
|
1064
1070
|
switch (event.type) {
|
|
1065
1071
|
case 'vtxo_received':
|
|
1066
|
-
console.log(`Received ${event.vtxos.length}
|
|
1072
|
+
console.log(`Received ${event.vtxos.length} virtual outputs to ${event.contractScript}`)
|
|
1067
1073
|
break
|
|
1068
1074
|
case 'vtxo_spent':
|
|
1069
|
-
console.log(`Spent
|
|
1075
|
+
console.log(`Spent virtual outputs from ${event.contractScript}`)
|
|
1070
1076
|
break
|
|
1071
1077
|
case 'contract_expired':
|
|
1072
1078
|
console.log(`Contract ${event.contractScript} expired`)
|
|
@@ -1077,7 +1083,7 @@ const unsubscribe = await manager.onContractEvent((event) => {
|
|
|
1077
1083
|
// Update contract data (e.g., set preimage when revealed)
|
|
1078
1084
|
await manager.updateContractParams(contract.script, { preimage: revealedPreimage })
|
|
1079
1085
|
|
|
1080
|
-
// Check spendable paths (requires a specific
|
|
1086
|
+
// Check spendable paths (requires a specific virtual output)
|
|
1081
1087
|
const [withVtxos] = await manager.getContractsWithVtxos({ script: contract.script })
|
|
1082
1088
|
const vtxo = withVtxos.vtxos[0]
|
|
1083
1089
|
const paths = manager.getSpendablePaths({
|
|
@@ -1091,17 +1097,17 @@ if (paths.length > 0) {
|
|
|
1091
1097
|
}
|
|
1092
1098
|
|
|
1093
1099
|
// Or list all possible paths for the current context (no spendability checks)
|
|
1094
|
-
const allPaths = manager.getAllSpendingPaths({
|
|
1100
|
+
const allPaths = await manager.getAllSpendingPaths({
|
|
1095
1101
|
contractScript: contract.script,
|
|
1096
1102
|
collaborative: true,
|
|
1097
1103
|
walletPubKey: myPubKey,
|
|
1098
1104
|
})
|
|
1099
1105
|
|
|
1100
|
-
//
|
|
1101
|
-
const
|
|
1106
|
+
// Fetch contracts together with their current virtual outputs
|
|
1107
|
+
const contractsWithVtxos = await manager.getContractsWithVtxos()
|
|
1102
1108
|
|
|
1103
|
-
//
|
|
1104
|
-
|
|
1109
|
+
// Force a full refresh from the indexer when needed
|
|
1110
|
+
await manager.refreshVtxos()
|
|
1105
1111
|
|
|
1106
1112
|
// Stop watching
|
|
1107
1113
|
unsubscribe()
|
|
@@ -1117,7 +1123,7 @@ The watcher features:
|
|
|
1117
1123
|
Access low-level data management through repositories:
|
|
1118
1124
|
|
|
1119
1125
|
```typescript
|
|
1120
|
-
//
|
|
1126
|
+
// Virtual output management (automatically cached for performance)
|
|
1121
1127
|
const addr = await wallet.getAddress()
|
|
1122
1128
|
const vtxos = await wallet.walletRepository.getVtxos(addr)
|
|
1123
1129
|
await wallet.walletRepository.saveVtxos(addr, vtxos)
|
|
@@ -4,7 +4,7 @@ exports.Estimator = void 0;
|
|
|
4
4
|
const celenv_js_1 = require("./celenv.js");
|
|
5
5
|
const types_js_1 = require("./types.js");
|
|
6
6
|
/**
|
|
7
|
-
* Estimator evaluates CEL expressions to calculate fees for
|
|
7
|
+
* Estimator evaluates CEL expressions to calculate fees for Arkade intents
|
|
8
8
|
*/
|
|
9
9
|
class Estimator {
|
|
10
10
|
/**
|
package/dist/cjs/arkfee/types.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.FeeAmount = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* FeeAmount is a wrapper around a number that represents a fee amount in satoshis floating point.
|
|
6
6
|
* @param value - The fee amount in floating point.
|
|
7
|
-
* @method satoshis - Returns the fee amount in satoshis as a integer.
|
|
8
7
|
* @example
|
|
9
8
|
* const fee = new FeeAmount(1.23456789);
|
|
10
9
|
* console.log(fee.value); // 1.23456789
|
|
@@ -14,9 +13,11 @@ class FeeAmount {
|
|
|
14
13
|
constructor(value) {
|
|
15
14
|
this.value = value;
|
|
16
15
|
}
|
|
16
|
+
/** Returns the fee amount rounded up to whole satoshis. */
|
|
17
17
|
get satoshis() {
|
|
18
18
|
return this.value ? Math.ceil(this.value) : 0;
|
|
19
19
|
}
|
|
20
|
+
/** Add two fee amounts together. */
|
|
20
21
|
add(other) {
|
|
21
22
|
return new FeeAmount(this.value + other.value);
|
|
22
23
|
}
|
|
@@ -6,10 +6,12 @@ const utils_js_1 = require("@scure/btc-signer/utils.js");
|
|
|
6
6
|
const btc_signer_1 = require("@scure/btc-signer");
|
|
7
7
|
const base_2 = require("../script/base");
|
|
8
8
|
/**
|
|
9
|
-
* ArkNotes are special virtual
|
|
10
|
-
* and spent without requiring any transactions.
|
|
11
|
-
*
|
|
12
|
-
* preimage and value.
|
|
9
|
+
* ArkNotes are special virtual outputs in the Arkade protocol that
|
|
10
|
+
* can be created and spent without requiring any transactions.
|
|
11
|
+
* The server mints them, and they are encoded as base58 strings
|
|
12
|
+
* with a human-readable prefix, a preimage and a value.
|
|
13
|
+
*
|
|
14
|
+
* @see VtxoScript
|
|
13
15
|
*
|
|
14
16
|
* @example
|
|
15
17
|
* ```typescript
|
|
@@ -24,6 +26,13 @@ const base_2 = require("../script/base");
|
|
|
24
26
|
* ```
|
|
25
27
|
*/
|
|
26
28
|
class ArkNote {
|
|
29
|
+
/**
|
|
30
|
+
* Create an ArkNote from a preimage and value.
|
|
31
|
+
*
|
|
32
|
+
* @param preimage - 32-byte preimage revealed to spend the note
|
|
33
|
+
* @param value - Note value in satoshis
|
|
34
|
+
* @param HRP - Optional human-readable prefix for string encoding
|
|
35
|
+
*/
|
|
27
36
|
constructor(preimage, value, HRP = ArkNote.DefaultHRP) {
|
|
28
37
|
this.preimage = preimage;
|
|
29
38
|
this.value = value;
|
|
@@ -40,12 +49,27 @@ class ArkNote {
|
|
|
40
49
|
this.status = { confirmed: true };
|
|
41
50
|
this.extraWitness = [this.preimage];
|
|
42
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Encode the note as raw bytes.
|
|
54
|
+
*
|
|
55
|
+
* @returns Serialized note bytes
|
|
56
|
+
* @see decode
|
|
57
|
+
*/
|
|
43
58
|
encode() {
|
|
44
59
|
const result = new Uint8Array(ArkNote.Length);
|
|
45
60
|
result.set(this.preimage, 0);
|
|
46
61
|
writeUInt32BE(result, this.value, this.preimage.length);
|
|
47
62
|
return result;
|
|
48
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Decode a note from raw bytes.
|
|
66
|
+
*
|
|
67
|
+
* @param data - Serialized note bytes
|
|
68
|
+
* @param hrp - Human-readable prefix expected for future string encoding
|
|
69
|
+
* @returns Decoded ArkNote
|
|
70
|
+
* @throws Error if the payload length is invalid
|
|
71
|
+
* @see encode
|
|
72
|
+
*/
|
|
49
73
|
static decode(data, hrp = ArkNote.DefaultHRP) {
|
|
50
74
|
if (data.length !== ArkNote.Length) {
|
|
51
75
|
throw new Error(`invalid data length: expected ${ArkNote.Length} bytes, got ${data.length}`);
|
|
@@ -54,6 +78,15 @@ class ArkNote {
|
|
|
54
78
|
const value = readUInt32BE(data, ArkNote.PreimageLength);
|
|
55
79
|
return new ArkNote(preimage, value, hrp);
|
|
56
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Decode a note from its base58 string form.
|
|
83
|
+
*
|
|
84
|
+
* @param noteStr - Base58-encoded note string
|
|
85
|
+
* @param hrp - Human-readable prefix expected on the note string
|
|
86
|
+
* @returns Decoded ArkNote
|
|
87
|
+
* @throws Error if the prefix or base58 payload is invalid
|
|
88
|
+
* @see toString
|
|
89
|
+
*/
|
|
57
90
|
static fromString(noteStr, hrp = ArkNote.DefaultHRP) {
|
|
58
91
|
noteStr = noteStr.trim();
|
|
59
92
|
if (!noteStr.startsWith(hrp)) {
|
|
@@ -66,6 +99,12 @@ class ArkNote {
|
|
|
66
99
|
}
|
|
67
100
|
return ArkNote.decode(decoded, hrp);
|
|
68
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Encode the note to its human-readable base58 string form.
|
|
104
|
+
*
|
|
105
|
+
* @returns Base58-encoded note string
|
|
106
|
+
* @see fromString
|
|
107
|
+
*/
|
|
69
108
|
toString() {
|
|
70
109
|
return this.HRP + base_1.base58.encode(this.encode());
|
|
71
110
|
}
|
package/dist/cjs/bip322/index.js
CHANGED
|
@@ -17,7 +17,7 @@ const TAG_BIP322 = "BIP0322-signed-message";
|
|
|
17
17
|
*
|
|
18
18
|
* Reuses the same toSpend/toSign transaction construction as Intent proofs,
|
|
19
19
|
* but with the standard BIP-322 tagged hash ("BIP0322-signed-message")
|
|
20
|
-
* instead of the
|
|
20
|
+
* instead of the Arkade-specific tag.
|
|
21
21
|
*
|
|
22
22
|
* @see https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki
|
|
23
23
|
*
|
|
@@ -17,7 +17,7 @@ const ARKCONTRACT_PREFIX = "arkcontract";
|
|
|
17
17
|
* Format: arkcontract={type}&{key1}={value1}&{key2}={value2}...
|
|
18
18
|
*
|
|
19
19
|
* This format is compatible with NArk and allows contracts to be
|
|
20
|
-
* shared/imported across different
|
|
20
|
+
* shared/imported across different Arkade SDKs.
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```typescript
|