@arkade-os/sdk 0.4.58 → 0.4.60
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 +34 -6
- package/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{ark-ClaVUg4e.d.cts → ark-D2_yNhfz.d.cts} +1077 -522
- package/dist/{ark-ClaVUg4e.d.ts → ark-D2_yNhfz.d.ts} +1077 -522
- package/dist/{asyncStorageTaskQueue-CnYrhpS-.d.cts → asyncStorageTaskQueue-CqijAAPG.d.cts} +1 -1
- package/dist/{asyncStorageTaskQueue-Bgau-mvD.d.ts → asyncStorageTaskQueue-Vsp6uk8e.d.ts} +1 -1
- package/dist/{chunk-IPPASJE5.js → chunk-2DINXHGQ.js} +1665 -1149
- package/dist/chunk-2DINXHGQ.js.map +1 -0
- package/dist/{chunk-SYZEQF5D.cjs → chunk-2XLNQHG4.cjs} +10 -10
- package/dist/chunk-2XLNQHG4.cjs.map +1 -0
- package/dist/{chunk-AGWZXGG2.js → chunk-3Q7BBUWO.js} +4 -4
- package/dist/{chunk-AGWZXGG2.js.map → chunk-3Q7BBUWO.js.map} +1 -1
- package/dist/{chunk-D6RGHPZ5.cjs → chunk-4A4GRSTB.cjs} +86 -13
- package/dist/chunk-4A4GRSTB.cjs.map +1 -0
- package/dist/{chunk-SGWMB4W2.js → chunk-B66RYHTB.js} +5 -5
- package/dist/chunk-B66RYHTB.js.map +1 -0
- package/dist/{chunk-TV2RLVOB.js → chunk-FSKANUV4.js} +12 -5
- package/dist/chunk-FSKANUV4.js.map +1 -0
- package/dist/{chunk-I4YEGI2R.cjs → chunk-H7JCHFM6.cjs} +17 -17
- package/dist/{chunk-I4YEGI2R.cjs.map → chunk-H7JCHFM6.cjs.map} +1 -1
- package/dist/{chunk-VROHHJL4.js → chunk-JBULXTCC.js} +77 -14
- package/dist/chunk-JBULXTCC.js.map +1 -0
- package/dist/{chunk-6PY4WYXI.cjs → chunk-KNS5MTTI.cjs} +3869 -2935
- package/dist/chunk-KNS5MTTI.cjs.map +1 -0
- package/dist/{chunk-COLJARV4.cjs → chunk-MZNLCMUP.cjs} +1686 -1169
- package/dist/chunk-MZNLCMUP.cjs.map +1 -0
- package/dist/{chunk-F4C67JYB.cjs → chunk-PRFL62ID.cjs} +22 -15
- package/dist/chunk-PRFL62ID.cjs.map +1 -0
- package/dist/{chunk-S3BFUTC5.js → chunk-Y54MUBT7.js} +3512 -2593
- package/dist/chunk-Y54MUBT7.js.map +1 -0
- package/dist/contracts/handlers/index.cjs +12 -8
- 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-CVrkEepn.d.cts → delegate-DNEuM_nK.d.cts} +1 -1
- package/dist/{delegate-YDYq1El_.d.ts → delegate-DidNTsKm.d.ts} +1 -1
- package/dist/{index-BmqkJBAf.d.cts → index-BP8-zniX.d.cts} +182 -26
- package/dist/{index-CuSHBkq7.d.ts → index-DzQbNQUG.d.ts} +182 -26
- package/dist/index.cjs +323 -223
- package/dist/index.d.cts +311 -51
- package/dist/index.d.ts +311 -51
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +43 -23
- package/dist/repositories/realm/index.cjs.map +1 -1
- package/dist/repositories/realm/index.d.cts +21 -9
- package/dist/repositories/realm/index.d.ts +21 -9
- package/dist/repositories/realm/index.js +29 -9
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +48 -23
- package/dist/repositories/sqlite/index.cjs.map +1 -1
- package/dist/repositories/sqlite/index.d.cts +9 -3
- package/dist/repositories/sqlite/index.d.ts +9 -3
- package/dist/repositories/sqlite/index.js +35 -10
- package/dist/repositories/sqlite/index.js.map +1 -1
- package/dist/{taskRunner-CFN61bBM.d.ts → taskRunner-9gnlYEpb.d.ts} +1 -1
- package/dist/{taskRunner-CFkGkD85.d.cts → taskRunner-BEQNFEa4.d.cts} +1 -1
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/index.cjs +17 -14
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +5 -4
- package/dist/wallet/expo/index.d.ts +5 -4
- package/dist/wallet/expo/index.js +8 -5
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/{wallet-hQp2qC_M.d.cts → wallet-C_MYHyOj.d.ts} +176 -17
- package/dist/{wallet-DnK09TtT.d.ts → wallet-ipUA1XCp.d.cts} +176 -17
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +5 -5
- package/dist/worker/expo/index.d.ts +5 -5
- package/dist/worker/expo/index.js +5 -5
- package/package.json +9 -2
- package/dist/chunk-6PY4WYXI.cjs.map +0 -1
- package/dist/chunk-COLJARV4.cjs.map +0 -1
- package/dist/chunk-D6RGHPZ5.cjs.map +0 -1
- package/dist/chunk-F4C67JYB.cjs.map +0 -1
- package/dist/chunk-IPPASJE5.js.map +0 -1
- package/dist/chunk-S3BFUTC5.js.map +0 -1
- package/dist/chunk-SGWMB4W2.js.map +0 -1
- package/dist/chunk-SYZEQF5D.cjs.map +0 -1
- package/dist/chunk-TV2RLVOB.js.map +0 -1
- package/dist/chunk-VROHHJL4.js.map +0 -1
package/README.md
CHANGED
|
@@ -914,6 +914,7 @@ import {
|
|
|
914
914
|
WalletMessageHandler,
|
|
915
915
|
IndexedDBWalletRepository,
|
|
916
916
|
IndexedDBContractRepository,
|
|
917
|
+
IndexedDBIntentRepository,
|
|
917
918
|
} from '@arkade-os/sdk'
|
|
918
919
|
|
|
919
920
|
const walletRepo = new IndexedDBWalletRepository()
|
|
@@ -922,6 +923,10 @@ const contractRepo = new IndexedDBContractRepository()
|
|
|
922
923
|
const bus = new MessageBus(walletRepo, contractRepo, {
|
|
923
924
|
messageHandlers: [new WalletMessageHandler()],
|
|
924
925
|
tickIntervalMs: 10_000, // default 10s
|
|
926
|
+
// Optional, same opt-in as `storage.intentRepository` on a main-thread
|
|
927
|
+
// wallet. Omit it and the worker persists no settlement intent, reconciles
|
|
928
|
+
// none on restart, and counts intent-locked VTXOs as available.
|
|
929
|
+
intentRepository: new IndexedDBIntentRepository(),
|
|
925
930
|
})
|
|
926
931
|
|
|
927
932
|
bus.start()
|
|
@@ -1141,7 +1146,7 @@ const wallet = await Wallet.create({
|
|
|
1141
1146
|
|
|
1142
1147
|
### Using with Node.js
|
|
1143
1148
|
|
|
1144
|
-
Node.js does not provide a global `EventSource` implementation. The SDK relies on `EventSource` for Server-Sent Events during settlement (onboarding/offboarding) and contract watching
|
|
1149
|
+
Node.js does not provide a global `EventSource` implementation (24.x has one behind `--experimental-eventsource`). The SDK relies on `EventSource` for Server-Sent Events during settlement (onboarding/offboarding) and contract watching, so tell it which one to use:
|
|
1145
1150
|
|
|
1146
1151
|
```bash
|
|
1147
1152
|
npm install eventsource
|
|
@@ -1149,12 +1154,15 @@ npm install eventsource
|
|
|
1149
1154
|
|
|
1150
1155
|
```typescript
|
|
1151
1156
|
import { EventSource } from "eventsource";
|
|
1152
|
-
|
|
1157
|
+
import { configureEventSource, Wallet } from "@arkade-os/sdk";
|
|
1153
1158
|
|
|
1154
|
-
|
|
1155
|
-
const { Wallet } = await import("@arkade-os/sdk");
|
|
1159
|
+
configureEventSource((url) => new EventSource(url));
|
|
1156
1160
|
```
|
|
1157
1161
|
|
|
1162
|
+
Order does not matter: the factory is resolved when a stream opens, not when the SDK is imported, so no dynamic-import dance is needed. A single provider can override it — `new RestIndexerProvider(url, { eventSource })` — for a process that needs different transports per connection.
|
|
1163
|
+
|
|
1164
|
+
Assigning `globalThis.EventSource` still works and is still the last resort in the resolution order (per-provider option → `configureEventSource` → global).
|
|
1165
|
+
|
|
1158
1166
|
If you also need IndexedDB persistence (e.g. for `WalletRepository`), set up the shim before any SDK import:
|
|
1159
1167
|
|
|
1160
1168
|
```typescript
|
|
@@ -1168,8 +1176,10 @@ setGlobalVars(null, { checkOrigin: false });
|
|
|
1168
1176
|
```
|
|
1169
1177
|
|
|
1170
1178
|
> **Note:** `eventsource` and `indexeddbshim` are optional peer dependencies.
|
|
1171
|
-
>
|
|
1172
|
-
> `
|
|
1179
|
+
> With no `EventSource` available, settlement fails with a typed
|
|
1180
|
+
> `EventSourceUnavailableError` naming the remedy, and contract watching warns
|
|
1181
|
+
> once and falls back to its failsafe polling — it does not retry a missing
|
|
1182
|
+
> global, and it does not go quiet either.
|
|
1173
1183
|
|
|
1174
1184
|
See [`examples/node/multiple-wallets.ts`](examples/node/multiple-wallets.ts) for a complete working example.
|
|
1175
1185
|
|
|
@@ -1351,6 +1361,24 @@ Contract freshness behavior:
|
|
|
1351
1361
|
- **Failsafe polling** every 20 seconds by default to catch missed events, configurable via `watcherConfig.failsafePollIntervalMs`
|
|
1352
1362
|
- **Manual refresh** through `manager.refreshVtxos()`; pass `{ includeInactive: true }` to sweep every repository contract
|
|
1353
1363
|
|
|
1364
|
+
Which contracts get that coverage is `contract.watch`, and it is independent of
|
|
1365
|
+
`contract.state` (which only governs receive-address selection — a retired
|
|
1366
|
+
receive address stays watched, because it can still be paid):
|
|
1367
|
+
|
|
1368
|
+
```typescript
|
|
1369
|
+
// Watch a one-shot destination only until it is funded; the manager
|
|
1370
|
+
// demotes it to `retained` itself once a VTXO lands.
|
|
1371
|
+
await manager.createContract({ ...params, watch: 'awaiting-funds' })
|
|
1372
|
+
|
|
1373
|
+
// A finished contract — a settled swap lockup, say. The row stays for
|
|
1374
|
+
// history, annotation and restore; it just leaves the subscription and
|
|
1375
|
+
// the poll. Unlike `deleteContract`, nothing is lost.
|
|
1376
|
+
await manager.setContractWatchState(script, 'retained')
|
|
1377
|
+
```
|
|
1378
|
+
|
|
1379
|
+
A row with no `watch` value is `watched`, so contracts written by earlier SDK
|
|
1380
|
+
versions keep the coverage they have today.
|
|
1381
|
+
|
|
1354
1382
|
### Repository Pattern
|
|
1355
1383
|
|
|
1356
1384
|
Most users don't need to touch repositories directly — `Wallet` reads through them and `ContractManager` owns VTXO/contract synchronization into them. They are documented here for advanced integrations (custom storage backends, offline-first apps, repository inspection).
|
package/dist/adapters/expo.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var chunkH7JCHFM6_cjs = require('../chunk-H7JCHFM6.cjs');
|
|
4
|
+
require('../chunk-PRFL62ID.cjs');
|
|
5
|
+
require('../chunk-4A4GRSTB.cjs');
|
|
6
6
|
require('../chunk-5BLDMQED.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "ExpoArkProvider", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkH7JCHFM6_cjs.ExpoArkProvider; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "ExpoIndexerProvider", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkH7JCHFM6_cjs.ExpoIndexerProvider; }
|
|
17
17
|
});
|
|
18
18
|
//# sourceMappingURL=expo.cjs.map
|
|
19
19
|
//# sourceMappingURL=expo.cjs.map
|
package/dist/adapters/expo.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { k as RestArkProvider, i as SettlementEvent, T as TxNotification, l as RestIndexerProvider, m as SubscriptionResponse } from '../ark-
|
|
2
|
-
export { n as ArkProvider, o as IndexerProvider } from '../ark-
|
|
1
|
+
import { k as RestArkProvider, i as SettlementEvent, T as TxNotification, l as RestIndexerProvider, m as SubscriptionResponse } from '../ark-D2_yNhfz.cjs';
|
|
2
|
+
export { n as ArkProvider, o as IndexerProvider } from '../ark-D2_yNhfz.cjs';
|
|
3
3
|
import '@scure/btc-signer/transaction.js';
|
|
4
4
|
import '@scure/btc-signer/utils.js';
|
|
5
5
|
import '@scure/btc-signer/psbt.js';
|
package/dist/adapters/expo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { k as RestArkProvider, i as SettlementEvent, T as TxNotification, l as RestIndexerProvider, m as SubscriptionResponse } from '../ark-
|
|
2
|
-
export { n as ArkProvider, o as IndexerProvider } from '../ark-
|
|
1
|
+
import { k as RestArkProvider, i as SettlementEvent, T as TxNotification, l as RestIndexerProvider, m as SubscriptionResponse } from '../ark-D2_yNhfz.js';
|
|
2
|
+
export { n as ArkProvider, o as IndexerProvider } from '../ark-D2_yNhfz.js';
|
|
3
3
|
import '@scure/btc-signer/transaction.js';
|
|
4
4
|
import '@scure/btc-signer/utils.js';
|
|
5
5
|
import '@scure/btc-signer/psbt.js';
|
package/dist/adapters/expo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-3Q7BBUWO.js';
|
|
2
|
+
import '../chunk-FSKANUV4.js';
|
|
3
|
+
import '../chunk-JBULXTCC.js';
|
|
4
4
|
import '../chunk-NSBPE2FW.js';
|
|
5
5
|
//# sourceMappingURL=expo.js.map
|
|
6
6
|
//# sourceMappingURL=expo.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunkKNS5MTTI_cjs = require('../chunk-KNS5MTTI.cjs');
|
|
4
|
+
require('../chunk-PRFL62ID.cjs');
|
|
5
|
+
require('../chunk-MZNLCMUP.cjs');
|
|
6
|
+
require('../chunk-4A4GRSTB.cjs');
|
|
7
7
|
require('../chunk-5BLDMQED.cjs');
|
|
8
8
|
|
|
9
9
|
// src/storage/indexedDB.ts
|
|
@@ -11,7 +11,7 @@ var IndexedDBStorageAdapter = class {
|
|
|
11
11
|
dbName;
|
|
12
12
|
version;
|
|
13
13
|
db = null;
|
|
14
|
-
constructor(dbName, version =
|
|
14
|
+
constructor(dbName, version = chunkKNS5MTTI_cjs.DB_VERSION) {
|
|
15
15
|
this.dbName = dbName;
|
|
16
16
|
this.version = version;
|
|
17
17
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DB_VERSION } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
import { DB_VERSION } from '../chunk-Y54MUBT7.js';
|
|
2
|
+
import '../chunk-FSKANUV4.js';
|
|
3
|
+
import '../chunk-2DINXHGQ.js';
|
|
4
|
+
import '../chunk-JBULXTCC.js';
|
|
5
5
|
import '../chunk-NSBPE2FW.js';
|
|
6
6
|
|
|
7
7
|
// src/storage/indexedDB.ts
|