@arkade-os/sdk 0.5.2 → 0.5.4
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 +36 -34
- package/dist/adapters/expo.cjs +9 -5
- package/dist/adapters/expo.d.cts +11 -7
- package/dist/adapters/expo.d.ts +11 -7
- package/dist/adapters/expo.js +3 -3
- package/dist/{asyncStorageTaskQueue-DIn7bTqN.d.ts → asyncStorageTaskQueue-DHMIxY04.d.ts} +2 -2
- package/dist/{asyncStorageTaskQueue-BtEc3Qca.d.cts → asyncStorageTaskQueue-DTBa8EH7.d.cts} +2 -2
- package/dist/{chunk-LWRMSC4M.js → chunk-6CUP6ZIF.js} +4 -4
- package/dist/{chunk-LWRMSC4M.js.map → chunk-6CUP6ZIF.js.map} +1 -1
- package/dist/{chunk-HKG26NUT.js → chunk-AG4TFD6F.js} +140 -59
- package/dist/chunk-AG4TFD6F.js.map +1 -0
- package/dist/{chunk-PVFQFQBY.cjs → chunk-B6VNKGIH.cjs} +10 -10
- package/dist/chunk-B6VNKGIH.cjs.map +1 -0
- package/dist/{chunk-U5XG7SWA.js → chunk-BTRCN4JJ.js} +22 -19
- package/dist/chunk-BTRCN4JJ.js.map +1 -0
- package/dist/{chunk-TAIWH3HG.cjs → chunk-DNITZVNG.cjs} +28 -47
- package/dist/chunk-DNITZVNG.cjs.map +1 -0
- package/dist/{chunk-OM6FJ76H.cjs → chunk-E6OOJEHL.cjs} +49 -49
- package/dist/{chunk-OM6FJ76H.cjs.map → chunk-E6OOJEHL.cjs.map} +1 -1
- package/dist/{chunk-2OCYL6BJ.cjs → chunk-F3FAE7VJ.cjs} +850 -652
- package/dist/chunk-F3FAE7VJ.cjs.map +1 -0
- package/dist/{chunk-GGKR4O5X.cjs → chunk-GHUUT54D.cjs} +143 -58
- package/dist/chunk-GHUUT54D.cjs.map +1 -0
- package/dist/{chunk-MOBDJ7U2.js → chunk-MWVAWFX6.js} +4 -4
- package/dist/chunk-MWVAWFX6.js.map +1 -0
- package/dist/{chunk-2QRUQXLS.js → chunk-TUOLZBNC.js} +19 -39
- package/dist/chunk-TUOLZBNC.js.map +1 -0
- package/dist/{chunk-64R7CRKN.cjs → chunk-WXNSISXK.cjs} +37 -34
- package/dist/chunk-WXNSISXK.cjs.map +1 -0
- package/dist/{chunk-AJWXVQYG.js → chunk-ZJHLLDBP.js} +372 -177
- package/dist/chunk-ZJHLLDBP.js.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-CaL8EN4Q.d.cts → delegate-f4_t864Z.d.cts} +1 -1
- package/dist/{delegate-Jd4zs88Q.d.ts → delegate-xrSBNybC.d.ts} +1 -1
- package/dist/{index-D-xqVzf8.d.ts → index-BJDz15ms.d.ts} +5 -5
- package/dist/{index-BwdGzNSn.d.cts → index-BjiVGtp8.d.cts} +5 -5
- package/dist/{index-DdKxfC29.d.cts → index-DRwe0UDN.d.cts} +194 -114
- package/dist/{index-DdKxfC29.d.ts → index-DRwe0UDN.d.ts} +194 -114
- package/dist/index.cjs +333 -313
- package/dist/index.d.cts +80 -45
- package/dist/index.d.ts +80 -45
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +65 -36
- package/dist/repositories/realm/index.cjs.map +1 -1
- package/dist/repositories/realm/index.d.cts +7 -3
- package/dist/repositories/realm/index.d.ts +7 -3
- package/dist/repositories/realm/index.js +35 -6
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +176 -110
- package/dist/repositories/sqlite/index.cjs.map +1 -1
- package/dist/repositories/sqlite/index.d.cts +23 -13
- package/dist/repositories/sqlite/index.d.ts +23 -13
- package/dist/repositories/sqlite/index.js +148 -83
- package/dist/repositories/sqlite/index.js.map +1 -1
- package/dist/{taskRunner-ZyGGjtIq.d.ts → taskRunner-BPPU-YHG.d.cts} +4 -4
- package/dist/{taskRunner-67YSEpsz.d.cts → taskRunner-CDlNeth0.d.ts} +4 -4
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.cjs.map +1 -1
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +7 -7
- package/dist/wallet/expo/background.js.map +1 -1
- package/dist/wallet/expo/index.cjs +18 -15
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +7 -6
- package/dist/wallet/expo/index.d.ts +7 -6
- package/dist/wallet/expo/index.js +9 -6
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/{wallet-bFS7VybL.d.ts → wallet-Oc3Wd5gv.d.ts} +27 -19
- package/dist/{wallet-B8LW7cV1.d.cts → wallet-jVBDQl6R.d.cts} +27 -19
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-2OCYL6BJ.cjs.map +0 -1
- package/dist/chunk-2QRUQXLS.js.map +0 -1
- package/dist/chunk-64R7CRKN.cjs.map +0 -1
- package/dist/chunk-AJWXVQYG.js.map +0 -1
- package/dist/chunk-GGKR4O5X.cjs.map +0 -1
- package/dist/chunk-HKG26NUT.js.map +0 -1
- package/dist/chunk-MOBDJ7U2.js.map +0 -1
- package/dist/chunk-PVFQFQBY.cjs.map +0 -1
- package/dist/chunk-TAIWH3HG.cjs.map +0 -1
- package/dist/chunk-U5XG7SWA.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Arkade TypeScript SDK
|
|
2
2
|
|
|
3
|
-
The Arkade SDK is a TypeScript library for building Bitcoin wallets using
|
|
3
|
+
The Arkade SDK is a TypeScript library for building Bitcoin wallets using Arkade.
|
|
4
4
|
|
|
5
5
|
[](https://arkade-os.github.io/ts-sdk/)
|
|
6
6
|
[](https://deepwiki.com/arkade-os/ts-sdk)
|
|
@@ -32,7 +32,7 @@ const wallet = await Wallet.create({ identity }) // defaults to mainnet
|
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
`Wallet.create` also accepts short spellings: `service` in place of the
|
|
35
|
-
`
|
|
35
|
+
`operatorProvider`/`indexerProvider`/`onchainProvider` trio, `mode` for `walletMode` and
|
|
36
36
|
`settlement` for `settlementConfig`. Setting both spellings of one field throws.
|
|
37
37
|
|
|
38
38
|
### Read-Only Wallets (Watch-Only)
|
|
@@ -183,6 +183,8 @@ const balance = await readonlyWallet.getBalance()
|
|
|
183
183
|
- Coin type 0 for mainnet, 1 for testnet
|
|
184
184
|
- Account 0, external chain, wildcard index — `identity.descriptor` is the wildcard template that drives HD rotation; consumers materialize a concrete descriptor at a specific index when they need one.
|
|
185
185
|
|
|
186
|
+
For custom `Identity` implementations, see [`TreeSignerSession`](./src/tree/signingSession.ts).
|
|
187
|
+
|
|
186
188
|
### Batch Signing for Browser Wallets
|
|
187
189
|
|
|
188
190
|
Arkade send transactions require N+1 PSBT signatures (N checkpoints + 1 main tx). With local identities like `SingleKey` or `SeedIdentity` this is invisible, but browser wallet extensions (Xverse, UniSat, OKX, etc.) show a confirmation popup per signature. The `BatchSignableIdentity` interface lets wallet providers reduce N+1 popups to a single batch confirmation.
|
|
@@ -220,28 +222,28 @@ await wallet.send({ address: 'ark1q...', amount: 1000 })
|
|
|
220
222
|
|
|
221
223
|
Identities without `signMultiple` continue to work unchanged — each checkpoint is signed individually via `sign()`.
|
|
222
224
|
|
|
223
|
-
###
|
|
225
|
+
### Operator Provider Caching
|
|
224
226
|
|
|
225
|
-
`
|
|
226
|
-
with `
|
|
227
|
+
`RestOperatorProvider.getInfo()` fetches current operator parameters on every call. Wrap it
|
|
228
|
+
with `CachingOperatorProvider` when you reuse that response for fee, signer, or limit lookups:
|
|
227
229
|
|
|
228
230
|
```typescript
|
|
229
|
-
import {
|
|
231
|
+
import { CachingOperatorProvider, RestOperatorProvider, Wallet } from '@arkade-os/sdk'
|
|
230
232
|
|
|
231
|
-
const
|
|
232
|
-
new
|
|
233
|
+
const operatorProvider = new CachingOperatorProvider(
|
|
234
|
+
new RestOperatorProvider('https://arkade.computer'),
|
|
233
235
|
60_000, // optional TTL in milliseconds; defaults to 60 seconds
|
|
234
236
|
)
|
|
235
237
|
|
|
236
|
-
const wallet = await Wallet.create({ identity,
|
|
238
|
+
const wallet = await Wallet.create({ identity, operatorProvider })
|
|
237
239
|
```
|
|
238
240
|
|
|
239
|
-
Only `getInfo()` is cached; all other
|
|
240
|
-
after the TTL and updates when the inner provider reports
|
|
241
|
-
signer rotation. Wrapping `
|
|
241
|
+
Only `getInfo()` is cached; all other provider methods pass through. The cache expires
|
|
242
|
+
after the TTL and updates when the inner provider reports operator info changes, including
|
|
243
|
+
signer rotation. Wrapping `RestOperatorProvider` preserves its `serverUrl`, so `Wallet.create`
|
|
242
244
|
can still derive the default indexer URL. Expired refresh failures propagate;
|
|
243
245
|
wallet boot fallback lives in the persisted ArkInfo snapshot. Call `dispose()` if the
|
|
244
|
-
inner provider outlives the wrapper, to drop its
|
|
246
|
+
inner provider outlives the wrapper, to drop its operator info subscription.
|
|
245
247
|
|
|
246
248
|
### Onchain Providers
|
|
247
249
|
|
|
@@ -415,7 +417,7 @@ const balance = await wallet.getBalance()
|
|
|
415
417
|
| `pendingSettlement` | Committed to an in-flight settlement intent; back in `available` when the intent ends. Always `0` without `storage.intentRepository`. |
|
|
416
418
|
| `reserved` | Held by [`reserveVtxos`](#holding-vtxos-for-your-own-use) until released. |
|
|
417
419
|
| `recoverable` | Swept or subdust virtual outputs that [`recoverVtxos`](#recovery-reclaim-swept-vtxos) can reclaim; `getRecoverableBalance()` gives what a batch would return today. |
|
|
418
|
-
| `deprecatedSignerLocked` | Under
|
|
420
|
+
| `deprecatedSignerLocked` | Under an operator signer past its cutoff, which the operator no longer cosigns; recovers once swept and re-settled. |
|
|
419
421
|
| `unrolled` | Already [unilaterally exited](#unilateral-exit): onchain behind its CSV timelock, movable only by `Unroll.completeUnroll`. |
|
|
420
422
|
| `total` | Everything the wallet owns: `boarding.total + settled + preconfirmed + recoverable + deprecatedSignerLocked + unrolled`. |
|
|
421
423
|
| `assets` | Every [asset](#assets-issue-reissue-burn-send) balance the wallet owns. |
|
|
@@ -651,7 +653,7 @@ try {
|
|
|
651
653
|
|
|
652
654
|
#### Recovery: Reclaim Swept VTXOs
|
|
653
655
|
|
|
654
|
-
Recover virtual outputs that have been swept by the
|
|
656
|
+
Recover virtual outputs that have been swept by the operator or consolidate small amounts (subdust).
|
|
655
657
|
|
|
656
658
|
```typescript
|
|
657
659
|
// Recover swept virtual outputs and preconfirmed subdust
|
|
@@ -672,7 +674,7 @@ Instead of the delegating user renewing virtual outputs by themselves, their del
|
|
|
672
674
|
|
|
673
675
|
This is useful for wallets that cannot be online 24/7.
|
|
674
676
|
|
|
675
|
-
When a `delegateProvider` is configured, the wallet address includes an extra tapscript path that authorizes the delegate to
|
|
677
|
+
When a `delegateProvider` is configured, the wallet address includes an extra tapscript path that authorizes the delegate to cosign renewals alongside the operator.
|
|
676
678
|
|
|
677
679
|
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.
|
|
678
680
|
|
|
@@ -822,7 +824,7 @@ exit waits for its batch swap queues until that batch swap finalizes, and an exi
|
|
|
822
824
|
spends every spendable VTXO. Opt in to let spends overlap on disjoint VTXOs:
|
|
823
825
|
|
|
824
826
|
```typescript
|
|
825
|
-
const wallet = await Wallet.create({ identity,
|
|
827
|
+
const wallet = await Wallet.create({ identity, operatorProvider, concurrentSpending: true })
|
|
826
828
|
```
|
|
827
829
|
|
|
828
830
|
With `concurrentSpending`:
|
|
@@ -870,7 +872,7 @@ Limits:
|
|
|
870
872
|
- Deprecated-signer migration and recovery name the VTXOs they move, so they can spend a held VTXO.
|
|
871
873
|
- Renewal skips a held VTXO even once it is inside the renewal threshold, since renewing would
|
|
872
874
|
change the outpoint you are holding. It logs a warning naming each such VTXO; spend or release a
|
|
873
|
-
long-lived hold before the VTXO expires, or the
|
|
875
|
+
long-lived hold before the VTXO expires, or the operator sweeps it and it comes back only through
|
|
874
876
|
recovery.
|
|
875
877
|
- `toReadonly()` views and the service worker's balance reads do not see reservations.
|
|
876
878
|
- `reserveVtxos` is on `Wallet`; the service-worker and Expo wallets accept `concurrentSpending`
|
|
@@ -880,7 +882,7 @@ If your app keeps its own reserved-outpoint set, call `reserveVtxos` where you a
|
|
|
880
882
|
`release()` where you remove, then let the SDK pick: plain `send`, router payments without
|
|
881
883
|
`selectedVtxos`, and exits without `vtxos` all skip what you hold.
|
|
882
884
|
|
|
883
|
-
### Talking to the
|
|
885
|
+
### Talking to the operator through the wallet
|
|
884
886
|
|
|
885
887
|
`getArkadeInfo()` is one of three seams that let a plugin work from a wallet alone, never a
|
|
886
888
|
server URL of its own:
|
|
@@ -897,7 +899,7 @@ const { vtxos } = await reader.getVtxos({ scripts: [covenantScriptHex], spendabl
|
|
|
897
899
|
const { txs } = await reader.getVirtualTxs([spendTxid]);
|
|
898
900
|
```
|
|
899
901
|
|
|
900
|
-
`getVtxos()` here queries the
|
|
902
|
+
`getVtxos()` here queries the operator for an arbitrary script — distinct from
|
|
901
903
|
`wallet.getVtxos()`, which answers the wallet's own outputs from local repositories. Everything
|
|
902
904
|
it returns is normalized, so each VTXO carries its canonical facts.
|
|
903
905
|
|
|
@@ -909,7 +911,7 @@ connection instead of opening a second one outside its rate gate and caches.
|
|
|
909
911
|
|
|
910
912
|
### Unilateral Exit
|
|
911
913
|
|
|
912
|
-
Unilateral exit
|
|
914
|
+
Unilateral exit lets you move your funds from virtual outputs to onchain outputs without cooperation from the operator. This process involves two main steps:
|
|
913
915
|
|
|
914
916
|
1. **Unrolling**: Broadcasting the transaction chain from offchain back to onchain
|
|
915
917
|
2. **Completing the exit**: Spending the unrolled virtual outputs after the timelock expires
|
|
@@ -1085,7 +1087,7 @@ Key properties:
|
|
|
1085
1087
|
|
|
1086
1088
|
### Exit data available offline
|
|
1087
1089
|
|
|
1088
|
-
The exit above resolves a VTXO's transaction chain from the
|
|
1090
|
+
The exit above resolves a VTXO's transaction chain from the Arkade **indexer** at
|
|
1089
1091
|
exit time. To make a unilateral exit work even when the indexer is unreachable,
|
|
1090
1092
|
configure a `virtualTxRepository` (SQLite / Realm / IndexedDB / InMemory): the
|
|
1091
1093
|
wallet then captures each received VTXO's exit branch locally and prunes it on
|
|
@@ -1103,7 +1105,7 @@ const wallet = await Wallet.create({
|
|
|
1103
1105
|
virtualTxRepository: new InMemoryVirtualTxRepository(),
|
|
1104
1106
|
// Optional. `mode` defaults to "lite" (structure only, cheap — most VTXOs
|
|
1105
1107
|
// never exit). Use "full" to also store the pre-signed PSBTs, so an exit
|
|
1106
|
-
// needs no
|
|
1108
|
+
// needs no Arkade indexer (only an Esplora endpoint to broadcast).
|
|
1107
1109
|
exitDataCapture: { mode: 'full' },
|
|
1108
1110
|
},
|
|
1109
1111
|
})
|
|
@@ -1193,7 +1195,7 @@ display after completion; cached reads do not guarantee a change event.
|
|
|
1193
1195
|
`getStoredBalance().boarding.loaded` is false until this wallet instance has fetched
|
|
1194
1196
|
boarding inputs. Call `getBoardingUtxos()` to refresh them. Stored methods are for
|
|
1195
1197
|
display, not transaction inputs; use the normal reads and spending APIs for actions.
|
|
1196
|
-
New contract registration, identity setup, and
|
|
1198
|
+
New contract registration, identity setup, and operator info validation can still
|
|
1197
1199
|
require provider calls even with lazy initialization enabled.
|
|
1198
1200
|
|
|
1199
1201
|
Service-worker factories expose the same `lazyInitialization` option and a separate
|
|
@@ -1415,13 +1417,13 @@ For React Native and Expo applications where standard EventSource and fetch stre
|
|
|
1415
1417
|
|
|
1416
1418
|
```typescript
|
|
1417
1419
|
import { Wallet, MnemonicIdentity } from '@arkade-os/sdk'
|
|
1418
|
-
import {
|
|
1420
|
+
import { ExpoOperatorProvider, ExpoIndexerProvider } from '@arkade-os/sdk/adapters/expo'
|
|
1419
1421
|
|
|
1420
1422
|
const identity = MnemonicIdentity.fromMnemonic('abandon abandon...')
|
|
1421
1423
|
|
|
1422
1424
|
const wallet = await Wallet.create({
|
|
1423
1425
|
identity: identity,
|
|
1424
|
-
|
|
1426
|
+
operatorProvider: new ExpoOperatorProvider('https://arkade.computer'), // For settlement events and transactions streaming
|
|
1425
1427
|
indexerProvider: new ExpoIndexerProvider('https://arkade.computer'), // For address subscriptions and virtual output state updates
|
|
1426
1428
|
})
|
|
1427
1429
|
|
|
@@ -1431,9 +1433,9 @@ const balance = await wallet.getBalance()
|
|
|
1431
1433
|
const address = await wallet.getAddress()
|
|
1432
1434
|
```
|
|
1433
1435
|
|
|
1434
|
-
Both
|
|
1436
|
+
Both ExpoOperatorProvider 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:
|
|
1435
1437
|
|
|
1436
|
-
- **
|
|
1438
|
+
- **ExpoOperatorProvider**: Handles settlement events and transaction streaming using expo/fetch for Server-Sent Events
|
|
1437
1439
|
- **ExpoIndexerProvider**: Handles address subscriptions and virtual output state updates using expo/fetch for JSON streaming
|
|
1438
1440
|
|
|
1439
1441
|
For persistence in Expo/React Native, use the SQLite repository with `expo-sqlite`:
|
|
@@ -1451,7 +1453,7 @@ const executor = {
|
|
|
1451
1453
|
|
|
1452
1454
|
const wallet = await Wallet.create({
|
|
1453
1455
|
identity,
|
|
1454
|
-
|
|
1456
|
+
operatorProvider: new ExpoOperatorProvider('https://arkade.computer'),
|
|
1455
1457
|
indexerProvider: new ExpoIndexerProvider('https://arkade.computer'),
|
|
1456
1458
|
storage: {
|
|
1457
1459
|
walletRepository: new SQLiteWalletRepository(executor),
|
|
@@ -1476,7 +1478,7 @@ global.crypto.getRandomValues = Crypto.getRandomValues;
|
|
|
1476
1478
|
|
|
1477
1479
|
// Now import the SDK
|
|
1478
1480
|
import { Wallet, MnemonicIdentity } from '@arkade-os/sdk';
|
|
1479
|
-
import {
|
|
1481
|
+
import { ExpoOperatorProvider, ExpoIndexerProvider } from '@arkade-os/sdk/adapters/expo';
|
|
1480
1482
|
```
|
|
1481
1483
|
|
|
1482
1484
|
This is required for MuSig2 settlements and cryptographic operations.
|
|
@@ -1495,7 +1497,7 @@ To watch transactions at scripts you don't know in advance (extension packets at
|
|
|
1495
1497
|
|
|
1496
1498
|
Read compiler format v1 JSON with `arkade.programFromArtifact`, which returns a normalized Program at version 1. `arkade.parseArtifact` reads normalized Program JSON and defaults omitted versions to 1. Only version 1 is supported, with typed `{ name, type }` declarations for every constructor parameter and call argument. Explicit version 0 programs, including persisted contracts, are rejected; there is no automatic migration. Older SDKs reject version 1 programs rather than silently reconstructing a different script. An Arkade function and its same-named Taproot leaf share one call, such as `contract.functions.claim(...)`. Standalone Taproot functions use their own names, such as `contract.functions.unilateral()`. Leaf order in the artifact still determines the Taproot tree. This example assumes a `digest: bytes32` constructor and a `claim` function with one `preimage: bytes32` covenant argument; wallet, artifact JSON and matching digest/preimage values are already available.
|
|
1497
1499
|
|
|
1498
|
-
Declarations retain the compiler's native scalar names: `pubkey`, `signature`, `bytes`, `bytes20`, `bytes32`, `asset`, `int`, `bool` and `AssetGroup`. There are no `hash` or `sig` type aliases. Byte types take `Uint8Array`; `int`, `bool` and `AssetGroup` take `bigint | number`, with `bool` restricted to `0` or `1`. Fixed widths follow the type itself, without extra width or boolean flags. The SDK requires every `pubkey` to be a 32-byte x-only key, although the language treats it as a bytes alias. Structs and arrays retain the compiler's flattened scalar field names and ordering.
|
|
1500
|
+
Declarations retain the compiler's native scalar names: `pubkey`, `signature`, `bytes`, `bytes20`, `bytes32`, `asset`, `int`, `bool` and `AssetGroup`. There are no `hash` or `sig` type aliases. Byte types take `Uint8Array`; `int`, `bool` and `AssetGroup` take `bigint | number`, with `bool` restricted to `0` or `1`. Fixed widths follow the type itself, without extra width or boolean flags. The SDK requires every `pubkey` to be a 32-byte x-only key, although the language treats it as a bytes alias. Structs and arrays retain the compiler's flattened scalar field names and ordering in the normalized Program, but deployments and calls take them whole: an object for a struct, an array for a fixed array, nested to any depth.
|
|
1499
1501
|
|
|
1500
1502
|
The normalized Program remains an SDK representation: compiler `constructorInputs` become `params`, spend groups and leaves become named `functions`, and covenant `arkade` becomes `arkadeScript`. `parseArtifact` and `stringifyArtifact` read and write that normalized representation; `programFromArtifact` reads the compiler format. Existing deployment and call methods use the same syntax for imported and hand-written programs.
|
|
1501
1503
|
|
|
@@ -1506,7 +1508,7 @@ import { arkade, Arkade, ArkAddress } from '@arkade-os/sdk'
|
|
|
1506
1508
|
|
|
1507
1509
|
const program = arkade.programFromArtifact(artifactJson)
|
|
1508
1510
|
const client = await Arkade.connect({
|
|
1509
|
-
service: { network: 'bitcoin' }, // operator, indexer, esplora and covenant
|
|
1511
|
+
service: { network: 'bitcoin' }, // operator, indexer, esplora, and covenant cosigner
|
|
1510
1512
|
identity: wallet.identity,
|
|
1511
1513
|
contractManager: await wallet.getContractManager(),
|
|
1512
1514
|
})
|
|
@@ -1526,9 +1528,9 @@ await wallet.send({ address: contract.address, amount: 10_000 })
|
|
|
1526
1528
|
|
|
1527
1529
|
`contract.on('vtxo_received' | 'vtxo_spent' | 'connection_reset', cb)` reports activity from subscription on and returns a handle with `off()`. Coins that predate it are not replayed and a reconnect re-syncs silently, so read `contract.getVtxos()` (every stored VTXO, spent ones included) after subscribing and on each `connection_reset`.
|
|
1528
1530
|
|
|
1529
|
-
The connected
|
|
1531
|
+
The connected operator supplies `<SERVER_KEY>` (the reserved `server` parameter in normalized Programs) and `<SERVER_EXIT_DELAY>`; conflicting overrides fail, and time-based delays that are not multiples of 512 seconds fail rather than changing the advertised delay. Resolved bindings are persisted, so restoring the contract keeps its script through server key or policy changes. A declared constructor named `user` defaults to the connected identity; other constructor keys remain caller-provided. Pass a struct or array param whole by its source name, such as `{ owners: [{ key }, { key }] }`; the flattened names it binds, such as `owners.0.key`, are also accepted, and a missing, extra or duplicated field fails with its full name. Child-output placeholders remain explicit `bytes32` constructor bindings. Leaf call inputs used as script operands cannot produce a fixed address and are rejected; raw CSV operands must be canonical BIP68 encodings.
|
|
1530
1532
|
|
|
1531
|
-
For compiler-derived programs, call arguments are covenant inputs in declaration order, followed by non-signature leaf inputs in declaration order. Same-named inputs in the two scopes remain separate positional arguments. Leaf signatures are PSBT signatures, not condition arguments: `send()` supports the connected identity and infrastructure signers; additional identities and covenant-tweaked leaf keys require explicit PSBT signing via `build()`. Covenant signature arguments remain caller-provided; transaction-bound Arkade `checkSig` signatures require an Arkade-specific digest helper, which is deferred. CSV leaves require aged onchain outputs and cannot use this offchain builder. Typed call validation and these spending limits apply to every normalized Program. The public `SignerRef` union is unchanged; version 1 programs store emulator signer placement in optional `emulatorIndex` metadata.
|
|
1533
|
+
For compiler-derived programs, call arguments are covenant inputs in declaration order, followed by non-signature leaf inputs in declaration order, one argument per source parameter: a struct or array input is passed whole, as in `contract.functions.spend(request, oracles)`. Same-named inputs in the two scopes remain separate positional arguments. Leaf signatures are PSBT signatures, not condition arguments: `send()` supports the connected identity and infrastructure signers; additional identities and covenant-tweaked leaf keys require explicit PSBT signing via `build()`. Covenant signature arguments remain caller-provided; transaction-bound Arkade `checkSig` signatures require an Arkade-specific digest helper, which is deferred. CSV leaves require aged onchain outputs and cannot use this offchain builder. Typed call validation and these spending limits apply to every normalized Program. The public `SignerRef` union is unchanged; version 1 programs store emulator signer placement in optional `emulatorIndex` metadata.
|
|
1532
1534
|
|
|
1533
1535
|
#### HD look-ahead window
|
|
1534
1536
|
|
package/dist/adapters/expo.cjs
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var chunkDNITZVNG_cjs = require('../chunk-DNITZVNG.cjs');
|
|
4
|
+
require('../chunk-WXNSISXK.cjs');
|
|
5
|
+
require('../chunk-GHUUT54D.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "ExpoArkProvider", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkDNITZVNG_cjs.ExpoArkProvider; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "ExpoIndexerProvider", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkDNITZVNG_cjs.ExpoIndexerProvider; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "ExpoOperatorProvider", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkDNITZVNG_cjs.ExpoOperatorProvider; }
|
|
16
20
|
});
|
|
17
21
|
//# sourceMappingURL=expo.cjs.map
|
|
18
22
|
//# sourceMappingURL=expo.cjs.map
|
package/dist/adapters/expo.d.cts
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
export { v as ArkProvider, w as IndexerProvider } from '../index-
|
|
1
|
+
import { r as RestOperatorProvider, o as SettlementEvent, T as TxNotificationEvent, s as RestIndexerProvider, t as SubscriptionEvent, u as SubscriptionHeartbeat } from '../index-DRwe0UDN.cjs';
|
|
2
|
+
export { v as ArkProvider, w as IndexerProvider, O as OperatorProvider } from '../index-DRwe0UDN.cjs';
|
|
3
3
|
import '@scure/btc-signer/utils.js';
|
|
4
4
|
import '@scure/btc-signer/psbt.js';
|
|
5
5
|
import '@scure/btc-signer';
|
|
6
6
|
import '@scure/btc-signer/transaction.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Expo-compatible
|
|
9
|
+
* Expo-compatible operator provider implementation using expo/fetch for SSE support.
|
|
10
10
|
* This provider works specifically in React Native/Expo environments where
|
|
11
11
|
* standard EventSource is not available but expo/fetch provides SSE capabilities.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```typescript
|
|
15
|
-
* import {
|
|
15
|
+
* import { ExpoOperatorProvider } from '@arkade-os/sdk/adapters/expo';
|
|
16
16
|
*
|
|
17
|
-
* const provider = new
|
|
17
|
+
* const provider = new ExpoOperatorProvider('https://arkade.computer');
|
|
18
18
|
* const info = await provider.getInfo();
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
|
-
declare class
|
|
21
|
+
declare class ExpoOperatorProvider extends RestOperatorProvider {
|
|
22
22
|
constructor(serverUrl?: string);
|
|
23
23
|
getEventStream(signal: AbortSignal, topics: string[]): AsyncIterableIterator<SettlementEvent>;
|
|
24
24
|
getTransactionsStream(signal: AbortSignal): AsyncIterableIterator<TxNotificationEvent>;
|
|
25
25
|
}
|
|
26
|
+
/** @deprecated Use {@link ExpoOperatorProvider}. */
|
|
27
|
+
declare const ExpoArkProvider: typeof ExpoOperatorProvider;
|
|
28
|
+
/** @deprecated Use {@link ExpoOperatorProvider}. */
|
|
29
|
+
type ExpoArkProvider = ExpoOperatorProvider;
|
|
26
30
|
|
|
27
31
|
/**
|
|
28
32
|
* Expo-compatible Indexer provider implementation using expo/fetch for streaming support.
|
|
@@ -42,4 +46,4 @@ declare class ExpoIndexerProvider extends RestIndexerProvider {
|
|
|
42
46
|
protected subscriptionStream(url: string, abortSignal: AbortSignal): AsyncIterableIterator<SubscriptionEvent | SubscriptionHeartbeat>;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
|
-
export { ExpoArkProvider, ExpoIndexerProvider };
|
|
49
|
+
export { ExpoArkProvider, ExpoIndexerProvider, ExpoOperatorProvider };
|
package/dist/adapters/expo.d.ts
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
export { v as ArkProvider, w as IndexerProvider } from '../index-
|
|
1
|
+
import { r as RestOperatorProvider, o as SettlementEvent, T as TxNotificationEvent, s as RestIndexerProvider, t as SubscriptionEvent, u as SubscriptionHeartbeat } from '../index-DRwe0UDN.js';
|
|
2
|
+
export { v as ArkProvider, w as IndexerProvider, O as OperatorProvider } from '../index-DRwe0UDN.js';
|
|
3
3
|
import '@scure/btc-signer/utils.js';
|
|
4
4
|
import '@scure/btc-signer/psbt.js';
|
|
5
5
|
import '@scure/btc-signer';
|
|
6
6
|
import '@scure/btc-signer/transaction.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Expo-compatible
|
|
9
|
+
* Expo-compatible operator provider implementation using expo/fetch for SSE support.
|
|
10
10
|
* This provider works specifically in React Native/Expo environments where
|
|
11
11
|
* standard EventSource is not available but expo/fetch provides SSE capabilities.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```typescript
|
|
15
|
-
* import {
|
|
15
|
+
* import { ExpoOperatorProvider } from '@arkade-os/sdk/adapters/expo';
|
|
16
16
|
*
|
|
17
|
-
* const provider = new
|
|
17
|
+
* const provider = new ExpoOperatorProvider('https://arkade.computer');
|
|
18
18
|
* const info = await provider.getInfo();
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
|
-
declare class
|
|
21
|
+
declare class ExpoOperatorProvider extends RestOperatorProvider {
|
|
22
22
|
constructor(serverUrl?: string);
|
|
23
23
|
getEventStream(signal: AbortSignal, topics: string[]): AsyncIterableIterator<SettlementEvent>;
|
|
24
24
|
getTransactionsStream(signal: AbortSignal): AsyncIterableIterator<TxNotificationEvent>;
|
|
25
25
|
}
|
|
26
|
+
/** @deprecated Use {@link ExpoOperatorProvider}. */
|
|
27
|
+
declare const ExpoArkProvider: typeof ExpoOperatorProvider;
|
|
28
|
+
/** @deprecated Use {@link ExpoOperatorProvider}. */
|
|
29
|
+
type ExpoArkProvider = ExpoOperatorProvider;
|
|
26
30
|
|
|
27
31
|
/**
|
|
28
32
|
* Expo-compatible Indexer provider implementation using expo/fetch for streaming support.
|
|
@@ -42,4 +46,4 @@ declare class ExpoIndexerProvider extends RestIndexerProvider {
|
|
|
42
46
|
protected subscriptionStream(url: string, abortSignal: AbortSignal): AsyncIterableIterator<SubscriptionEvent | SubscriptionHeartbeat>;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
|
-
export { ExpoArkProvider, ExpoIndexerProvider };
|
|
49
|
+
export { ExpoArkProvider, ExpoIndexerProvider, ExpoOperatorProvider };
|
package/dist/adapters/expo.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { ExpoArkProvider, ExpoIndexerProvider, ExpoOperatorProvider } from '../chunk-TUOLZBNC.js';
|
|
2
|
+
import '../chunk-BTRCN4JJ.js';
|
|
3
|
+
import '../chunk-AG4TFD6F.js';
|
|
4
4
|
//# sourceMappingURL=expo.js.map
|
|
5
5
|
//# sourceMappingURL=expo.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as TaskQueue, b as TaskItem, d as TaskResult } from './taskRunner-CDlNeth0.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Minimal async key-value storage interface.
|
|
@@ -46,4 +46,4 @@ declare class AsyncStorageTaskQueue implements TaskQueue {
|
|
|
46
46
|
private writeList;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export {
|
|
49
|
+
export { type AsyncStorageLike as A, AsyncStorageTaskQueue as a };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as TaskQueue, b as TaskItem, d as TaskResult } from './taskRunner-BPPU-YHG.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Minimal async key-value storage interface.
|
|
@@ -46,4 +46,4 @@ declare class AsyncStorageTaskQueue implements TaskQueue {
|
|
|
46
46
|
private writeList;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export {
|
|
49
|
+
export { type AsyncStorageLike as A, AsyncStorageTaskQueue as a };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __export, VtxoScript, MultisigTapscript, CSVMultisigTapscript, timelockToSequence, sequenceToTimelock, ConditionMultisigTapscript, CLTVMultisigTapscript, ConditionCSVMultisigTapscript, SCRIPT_QUERY_CHUNK_SIZE, getNormalizedVtxos, DEFAULT_PAGE_SIZE, sequenceToCanonicalTimelock } from './chunk-
|
|
1
|
+
import { __export, VtxoScript, MultisigTapscript, CSVMultisigTapscript, timelockToSequence, sequenceToTimelock, ConditionMultisigTapscript, CLTVMultisigTapscript, ConditionCSVMultisigTapscript, SCRIPT_QUERY_CHUNK_SIZE, getNormalizedVtxos, DEFAULT_PAGE_SIZE, sequenceToCanonicalTimelock } from './chunk-AG4TFD6F.js';
|
|
2
2
|
import { hex } from '@scure/base';
|
|
3
3
|
import { networks, expand } from '@bitcoinerlab/descriptors-scure';
|
|
4
4
|
import { ScriptNum, OP, Script } from '@scure/btc-signer';
|
|
@@ -1539,7 +1539,7 @@ var VHTLCV2ContractHandler = {
|
|
|
1539
1539
|
}
|
|
1540
1540
|
if (claim && refund && hex.encode(claim.emulatorPubkey) !== hex.encode(refund.emulatorPubkey)) {
|
|
1541
1541
|
throw new Error(
|
|
1542
|
-
"emulator covenant params name two different emulator pubkeys: the suite derives both
|
|
1542
|
+
"emulator covenant params name two different emulator pubkeys: the suite derives both covenants from ONE key, so this row cannot be rebuilt as a group"
|
|
1543
1543
|
);
|
|
1544
1544
|
}
|
|
1545
1545
|
if (params.assetTxid === void 0 !== (params.assetGroupIndex === void 0)) {
|
|
@@ -2312,5 +2312,5 @@ contractHandlers.register(BoardingContractHandler);
|
|
|
2312
2312
|
contractHandlers.register(ArkadeContractHandler);
|
|
2313
2313
|
|
|
2314
2314
|
export { ARKADE_OP, ARKADE_OPCODES, ARKADE_OPCODE_NAMES, ARKADE_OPCODE_VALUES, ARKADE_OPS, ARKADE_TYPE_ENCODINGS, ArkadeContractHandler, ArkadeProgramScript, ArkadeScript, BoardingContractHandler, DefaultContractHandler, DefaultVtxo, DelegateContractHandler, DelegateVtxo, OPCODE_NAMES, OPCODE_VALUES, SUPPORTED_PROGRAM_VERSION, UnsupportedProgramVersionError, VHTLC, VHTLCContractHandler, VHTLCV2ContractHandler, WALLET_RECEIVE_SOURCE, arkadeScriptHash, arkadeWitnessHash, asmToBytes, bignum_exports, bytesToASM, computeArkadeScriptPublicKey, contractHandlers, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, descriptorIsOurs, deserializeArkadeContractParams, extractPubKey, fromASM, getOpcodeName, getOpcodeValue, identityDescriptor, isCltvSatisfied, isCsvSpendable, isMainnetDescriptor, normalizeToDescriptor, parseArtifact, parseHDDescriptor, resolveAsm, serializeArkadeContractParams, speculativeReceiveMetadata, stringifyArtifact, toASM, toXOnly, validateParamValue, validateProgram, witnessRefToBytes };
|
|
2315
|
-
//# sourceMappingURL=chunk-
|
|
2316
|
-
//# sourceMappingURL=chunk-
|
|
2315
|
+
//# sourceMappingURL=chunk-6CUP6ZIF.js.map
|
|
2316
|
+
//# sourceMappingURL=chunk-6CUP6ZIF.js.map
|