@arkade-os/sdk 0.4.68 → 0.4.70

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 (74) hide show
  1. package/README.md +33 -0
  2. package/dist/adapters/expo.cjs +5 -5
  3. package/dist/adapters/expo.d.cts +2 -2
  4. package/dist/adapters/expo.d.ts +2 -2
  5. package/dist/adapters/expo.js +3 -3
  6. package/dist/adapters/indexedDB.cjs +5 -5
  7. package/dist/adapters/indexedDB.js +4 -4
  8. package/dist/{asyncStorageTaskQueue-DaZlVTbM.d.ts → asyncStorageTaskQueue-BgUJN-3X.d.ts} +1 -1
  9. package/dist/{asyncStorageTaskQueue-B2CcXIHU.d.cts → asyncStorageTaskQueue-Cstx6hS7.d.cts} +1 -1
  10. package/dist/{chunk-PJR63FTK.cjs → chunk-3KW4TWP2.cjs} +17 -17
  11. package/dist/{chunk-PJR63FTK.cjs.map → chunk-3KW4TWP2.cjs.map} +1 -1
  12. package/dist/{chunk-6YUACVX4.cjs → chunk-3OKEUDHU.cjs} +49 -49
  13. package/dist/{chunk-6YUACVX4.cjs.map → chunk-3OKEUDHU.cjs.map} +1 -1
  14. package/dist/{chunk-EJOFL5WH.cjs → chunk-57636V35.cjs} +3 -3
  15. package/dist/{chunk-EJOFL5WH.cjs.map → chunk-57636V35.cjs.map} +1 -1
  16. package/dist/{chunk-45FKMOJH.js → chunk-6UM55KPZ.js} +3 -3
  17. package/dist/{chunk-45FKMOJH.js.map → chunk-6UM55KPZ.js.map} +1 -1
  18. package/dist/{chunk-4KCVS4ZN.cjs → chunk-B73Q75IL.cjs} +10 -10
  19. package/dist/{chunk-4KCVS4ZN.cjs.map → chunk-B73Q75IL.cjs.map} +1 -1
  20. package/dist/{chunk-33Q2RFET.js → chunk-F5E7LI6G.js} +3 -3
  21. package/dist/{chunk-33Q2RFET.js.map → chunk-F5E7LI6G.js.map} +1 -1
  22. package/dist/{chunk-GQ4NMQGR.js → chunk-IUFTICRY.js} +4 -4
  23. package/dist/{chunk-GQ4NMQGR.js.map → chunk-IUFTICRY.js.map} +1 -1
  24. package/dist/{chunk-JGMSZIE4.cjs → chunk-JJ7AXR4O.cjs} +17 -17
  25. package/dist/{chunk-JGMSZIE4.cjs.map → chunk-JJ7AXR4O.cjs.map} +1 -1
  26. package/dist/{chunk-VBHXBI7F.js → chunk-JVHO6XHG.js} +435 -55
  27. package/dist/chunk-JVHO6XHG.js.map +1 -0
  28. package/dist/{chunk-4CMXV5SF.js → chunk-TXSF2DKX.js} +3 -3
  29. package/dist/{chunk-4CMXV5SF.js.map → chunk-TXSF2DKX.js.map} +1 -1
  30. package/dist/{chunk-G4I6PU5H.js → chunk-UG3EZDLF.js} +4 -4
  31. package/dist/{chunk-G4I6PU5H.js.map → chunk-UG3EZDLF.js.map} +1 -1
  32. package/dist/{chunk-WCJVKFAP.cjs → chunk-XTCOSZ34.cjs} +870 -483
  33. package/dist/chunk-XTCOSZ34.cjs.map +1 -0
  34. package/dist/contracts/handlers/index.cjs +9 -9
  35. package/dist/contracts/handlers/index.d.cts +3 -3
  36. package/dist/contracts/handlers/index.d.ts +3 -3
  37. package/dist/contracts/handlers/index.js +2 -2
  38. package/dist/{delegate-AomVWxO_.d.ts → delegate-BPdzTbwN.d.ts} +1 -1
  39. package/dist/{delegate-Bffc5f54.d.cts → delegate-DrwIar11.d.cts} +1 -1
  40. package/dist/{hdWalletCapable-DZdIVa23.d.ts → hdWalletCapable-D4WH35z0.d.cts} +49 -5
  41. package/dist/{hdWalletCapable-B5nRs3RH.d.cts → hdWalletCapable-DyxCiNVE.d.ts} +49 -5
  42. package/dist/{index-nfyQM33h.d.cts → index-BqhpAqqj.d.cts} +2 -2
  43. package/dist/{index-jouvy8FD.d.ts → index-TZJvbIaA.d.ts} +2 -2
  44. package/dist/{index-C7RZCfoY.d.cts → index-dWRqYSdS.d.cts} +53 -1
  45. package/dist/{index-C7RZCfoY.d.ts → index-dWRqYSdS.d.ts} +53 -1
  46. package/dist/index.cjs +318 -290
  47. package/dist/index.d.cts +97 -21
  48. package/dist/index.d.ts +97 -21
  49. package/dist/index.js +4 -4
  50. package/dist/repositories/realm/index.cjs +19 -19
  51. package/dist/repositories/realm/index.d.cts +2 -2
  52. package/dist/repositories/realm/index.d.ts +2 -2
  53. package/dist/repositories/realm/index.js +5 -5
  54. package/dist/repositories/sqlite/index.cjs +18 -18
  55. package/dist/repositories/sqlite/index.d.cts +2 -2
  56. package/dist/repositories/sqlite/index.d.ts +2 -2
  57. package/dist/repositories/sqlite/index.js +5 -5
  58. package/dist/{taskRunner-D2vnpPBT.d.cts → taskRunner-CzYKyJ9c.d.cts} +1 -1
  59. package/dist/{taskRunner-DuwK9t8O.d.ts → taskRunner-D2fnbqYw.d.ts} +1 -1
  60. package/dist/wallet/expo/background.cjs +14 -14
  61. package/dist/wallet/expo/background.d.cts +3 -3
  62. package/dist/wallet/expo/background.d.ts +3 -3
  63. package/dist/wallet/expo/background.js +6 -6
  64. package/dist/wallet/expo/index.cjs +14 -14
  65. package/dist/wallet/expo/index.d.cts +4 -4
  66. package/dist/wallet/expo/index.d.ts +4 -4
  67. package/dist/wallet/expo/index.js +5 -5
  68. package/dist/worker/expo/index.cjs +9 -9
  69. package/dist/worker/expo/index.d.cts +4 -4
  70. package/dist/worker/expo/index.d.ts +4 -4
  71. package/dist/worker/expo/index.js +5 -5
  72. package/package.json +2 -1
  73. package/dist/chunk-VBHXBI7F.js.map +0 -1
  74. package/dist/chunk-WCJVKFAP.cjs.map +0 -1
package/README.md CHANGED
@@ -346,6 +346,39 @@ if (incomingFunds.type === "vtxo") {
346
346
  }
347
347
  ```
348
348
 
349
+ #### Cancelling a wait
350
+
351
+ `waitForIncomingFunds` is **a live subscription, not a one-shot query**. It opens an onchain address watcher plus an indexer stream and holds them until it settles. Cancel it whenever you might not await it to completion — pass a `timeoutMs`, or an `AbortSignal`:
352
+
353
+ ```typescript
354
+ const controller = new AbortController()
355
+
356
+ try {
357
+ const funds = await waitForIncomingFunds(wallet, { signal: controller.signal })
358
+ } catch (error) {
359
+ if ((error as Error).name !== "AbortError") throw error
360
+ // cancelled — watchers already released
361
+ }
362
+
363
+ // or bound the wait directly
364
+ await waitForIncomingFunds(wallet, { timeoutMs: 30_000 })
365
+ ```
366
+
367
+ Do **not** `Promise.race` an uncancelled call against a timer:
368
+
369
+ ```typescript
370
+ // WRONG: race abandons the loser without stopping it. Repeat this on a
371
+ // polling loop and the subscriptions stack until the process exits.
372
+ await Promise.race([sleep(15_000), waitForIncomingFunds(wallet)])
373
+
374
+ // Right: the signal tears the watcher down when the timer wins.
375
+ await waitForIncomingFunds(wallet, { timeoutMs: 15_000 }).catch(() => null)
376
+ ```
377
+
378
+ If you want a plain polling loop, use your own timer plus `wallet.getBalance()` — it observes new funds on the next cycle. If you want to keep a watcher across many iterations, call `wallet.notifyIncomingFunds(cb)` **once** and hold its `stop()` function, rather than resubscribing per tick.
379
+
380
+ Concurrent watchers over the same address set share a single Esplora subscription, so a duplicated or leaked watcher no longer multiplies explorer traffic. That is a safety net, not a licence to skip `stop()`.
381
+
349
382
  ### Onboarding
350
383
 
351
384
  Onboarding allows you to swap onchain funds into virtual outputs:
@@ -1,19 +1,19 @@
1
1
  'use strict';
2
2
 
3
- var chunkJGMSZIE4_cjs = require('../chunk-JGMSZIE4.cjs');
4
- require('../chunk-PJR63FTK.cjs');
5
- require('../chunk-EJOFL5WH.cjs');
3
+ var chunkJJ7AXR4O_cjs = require('../chunk-JJ7AXR4O.cjs');
4
+ require('../chunk-3KW4TWP2.cjs');
5
+ require('../chunk-57636V35.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 chunkJGMSZIE4_cjs.ExpoArkProvider; }
12
+ get: function () { return chunkJJ7AXR4O_cjs.ExpoArkProvider; }
13
13
  });
14
14
  Object.defineProperty(exports, "ExpoIndexerProvider", {
15
15
  enumerable: true,
16
- get: function () { return chunkJGMSZIE4_cjs.ExpoIndexerProvider; }
16
+ get: function () { return chunkJJ7AXR4O_cjs.ExpoIndexerProvider; }
17
17
  });
18
18
  //# sourceMappingURL=expo.cjs.map
19
19
  //# sourceMappingURL=expo.cjs.map
@@ -1,5 +1,5 @@
1
- import { n as RestArkProvider, k as SettlementEvent, T as TxNotificationEvent, o as RestIndexerProvider, p as SubscriptionResponse } from '../index-C7RZCfoY.cjs';
2
- export { q as ArkProvider, r as IndexerProvider } from '../index-C7RZCfoY.cjs';
1
+ import { n as RestArkProvider, k as SettlementEvent, T as TxNotificationEvent, o as RestIndexerProvider, p as SubscriptionResponse } from '../index-dWRqYSdS.cjs';
2
+ export { q as ArkProvider, r as IndexerProvider } from '../index-dWRqYSdS.cjs';
3
3
  import '@scure/btc-signer/utils.js';
4
4
  import '@scure/btc-signer/transaction.js';
5
5
  import '@scure/btc-signer';
@@ -1,5 +1,5 @@
1
- import { n as RestArkProvider, k as SettlementEvent, T as TxNotificationEvent, o as RestIndexerProvider, p as SubscriptionResponse } from '../index-C7RZCfoY.js';
2
- export { q as ArkProvider, r as IndexerProvider } from '../index-C7RZCfoY.js';
1
+ import { n as RestArkProvider, k as SettlementEvent, T as TxNotificationEvent, o as RestIndexerProvider, p as SubscriptionResponse } from '../index-dWRqYSdS.js';
2
+ export { q as ArkProvider, r as IndexerProvider } from '../index-dWRqYSdS.js';
3
3
  import '@scure/btc-signer/utils.js';
4
4
  import '@scure/btc-signer/transaction.js';
5
5
  import '@scure/btc-signer';
@@ -1,6 +1,6 @@
1
- export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-G4I6PU5H.js';
2
- import '../chunk-33Q2RFET.js';
3
- import '../chunk-4CMXV5SF.js';
1
+ export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-UG3EZDLF.js';
2
+ import '../chunk-F5E7LI6G.js';
3
+ import '../chunk-TXSF2DKX.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 chunkWCJVKFAP_cjs = require('../chunk-WCJVKFAP.cjs');
4
- require('../chunk-PJR63FTK.cjs');
5
- require('../chunk-6YUACVX4.cjs');
6
- require('../chunk-EJOFL5WH.cjs');
3
+ var chunkXTCOSZ34_cjs = require('../chunk-XTCOSZ34.cjs');
4
+ require('../chunk-3KW4TWP2.cjs');
5
+ require('../chunk-3OKEUDHU.cjs');
6
+ require('../chunk-57636V35.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 = chunkWCJVKFAP_cjs.DB_VERSION) {
14
+ constructor(dbName, version = chunkXTCOSZ34_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-VBHXBI7F.js';
2
- import '../chunk-33Q2RFET.js';
3
- import '../chunk-45FKMOJH.js';
4
- import '../chunk-4CMXV5SF.js';
1
+ import { DB_VERSION } from '../chunk-JVHO6XHG.js';
2
+ import '../chunk-F5E7LI6G.js';
3
+ import '../chunk-6UM55KPZ.js';
4
+ import '../chunk-TXSF2DKX.js';
5
5
  import '../chunk-NSBPE2FW.js';
6
6
 
7
7
  // src/storage/indexedDB.ts
@@ -1,4 +1,4 @@
1
- import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-DuwK9t8O.js';
1
+ import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-D2fnbqYw.js';
2
2
 
3
3
  /**
4
4
  * Minimal async key-value storage interface.
@@ -1,4 +1,4 @@
1
- import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-D2vnpPBT.cjs';
1
+ import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-CzYKyJ9c.cjs';
2
2
 
3
3
  /**
4
4
  * Minimal async key-value storage interface.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkEJOFL5WH_cjs = require('./chunk-EJOFL5WH.cjs');
3
+ var chunk57636V35_cjs = require('./chunk-57636V35.cjs');
4
4
  var chunk5BLDMQED_cjs = require('./chunk-5BLDMQED.cjs');
5
5
  var base = require('@scure/base');
6
6
  var secp256k1_js = require('@noble/curves/secp256k1.js');
@@ -1420,10 +1420,10 @@ async function indexerFetch(input, init) {
1420
1420
  const lastAttempt = attempt >= maxAttempts;
1421
1421
  let res;
1422
1422
  try {
1423
- res = await chunkEJOFL5WH_cjs.rateGate.runHttp(input, () => chunkEJOFL5WH_cjs.baseFetch(input, init));
1423
+ res = await chunk57636V35_cjs.rateGate.runHttp(input, () => chunk57636V35_cjs.baseFetch(input, init));
1424
1424
  } catch (err) {
1425
- const mapped = chunkEJOFL5WH_cjs.toProviderUnavailable(err, "indexer");
1426
- if (lastAttempt || !(mapped instanceof chunkEJOFL5WH_cjs.ProviderUnavailableError)) throw mapped;
1425
+ const mapped = chunk57636V35_cjs.toProviderUnavailable(err, "indexer");
1426
+ if (lastAttempt || !(mapped instanceof chunk57636V35_cjs.ProviderUnavailableError)) throw mapped;
1427
1427
  await sleep(retryDelayMs(attempt));
1428
1428
  continue;
1429
1429
  }
@@ -1435,7 +1435,7 @@ async function indexerFetch(input, init) {
1435
1435
  body = void 0;
1436
1436
  }
1437
1437
  try {
1438
- chunkEJOFL5WH_cjs.throwIfHttpUnavailable(res, "indexer", body);
1438
+ chunk57636V35_cjs.throwIfHttpUnavailable(res, "indexer", body);
1439
1439
  } catch (err) {
1440
1440
  if (lastAttempt) throw err;
1441
1441
  await sleep(retryDelayMs(attempt));
@@ -1464,7 +1464,7 @@ var ChainTxType = /* @__PURE__ */ ((ChainTxType2) => {
1464
1464
  return ChainTxType2;
1465
1465
  })(ChainTxType || {});
1466
1466
  var RestIndexerProvider = class {
1467
- constructor(serverUrl = chunkEJOFL5WH_cjs.DEFAULT_ARKADE_SERVER_URL, options = {}) {
1467
+ constructor(serverUrl = chunk57636V35_cjs.DEFAULT_ARKADE_SERVER_URL, options = {}) {
1468
1468
  this.serverUrl = serverUrl;
1469
1469
  this.eventSource = options.eventSource;
1470
1470
  }
@@ -1600,8 +1600,8 @@ var RestIndexerProvider = class {
1600
1600
  try {
1601
1601
  while (!abortSignal?.aborted) {
1602
1602
  try {
1603
- const currentIterator = chunkEJOFL5WH_cjs.eventSourceIterator(
1604
- chunkEJOFL5WH_cjs.resolveEventSource(override)(url)
1603
+ const currentIterator = chunk57636V35_cjs.eventSourceIterator(
1604
+ chunk57636V35_cjs.resolveEventSource(override)(url)
1605
1605
  );
1606
1606
  iterator = currentIterator;
1607
1607
  for await (const event of currentIterator) {
@@ -1612,9 +1612,9 @@ var RestIndexerProvider = class {
1612
1612
  yield {
1613
1613
  txid: data.event.txid,
1614
1614
  scripts: data.event.scripts || [],
1615
- newVtxos: (data.event.newVtxos || []).map(chunkEJOFL5WH_cjs.convertVtxo),
1616
- spentVtxos: (data.event.spentVtxos || []).map(chunkEJOFL5WH_cjs.convertVtxo),
1617
- sweptVtxos: (data.event.sweptVtxos || []).map(chunkEJOFL5WH_cjs.convertVtxo),
1615
+ newVtxos: (data.event.newVtxos || []).map(chunk57636V35_cjs.convertVtxo),
1616
+ spentVtxos: (data.event.spentVtxos || []).map(chunk57636V35_cjs.convertVtxo),
1617
+ sweptVtxos: (data.event.sweptVtxos || []).map(chunk57636V35_cjs.convertVtxo),
1618
1618
  tx: data.event.tx,
1619
1619
  checkpointTxs: data.event.checkpointTxs
1620
1620
  };
@@ -1628,14 +1628,14 @@ var RestIndexerProvider = class {
1628
1628
  if (abortSignal?.aborted || error instanceof Error && error.name === "AbortError") {
1629
1629
  break;
1630
1630
  }
1631
- if (chunkEJOFL5WH_cjs.isFetchTimeoutError(error)) {
1631
+ if (chunk57636V35_cjs.isFetchTimeoutError(error)) {
1632
1632
  console.debug("Timeout error ignored");
1633
1633
  continue;
1634
1634
  }
1635
- if (chunkEJOFL5WH_cjs.isEventSourceError(error)) {
1635
+ if (chunk57636V35_cjs.isEventSourceError(error)) {
1636
1636
  throw error;
1637
1637
  }
1638
- if (chunkEJOFL5WH_cjs.isEventSourceUnavailableError(error)) throw error;
1638
+ if (chunk57636V35_cjs.isEventSourceUnavailableError(error)) throw error;
1639
1639
  console.error("Subscription error:", error);
1640
1640
  throw error;
1641
1641
  } finally {
@@ -1786,7 +1786,7 @@ var RestIndexerProvider = class {
1786
1786
  throw new Error("Invalid vtxos data received");
1787
1787
  }
1788
1788
  return {
1789
- vtxos: data.vtxos.map(chunkEJOFL5WH_cjs.convertVtxo),
1789
+ vtxos: data.vtxos.map(chunk57636V35_cjs.convertVtxo),
1790
1790
  page: data.page
1791
1791
  };
1792
1792
  }
@@ -1969,5 +1969,5 @@ exports.Metadata = Metadata;
1969
1969
  exports.Packet = Packet;
1970
1970
  exports.RestIndexerProvider = RestIndexerProvider;
1971
1971
  exports.asset_exports = asset_exports;
1972
- //# sourceMappingURL=chunk-PJR63FTK.cjs.map
1973
- //# sourceMappingURL=chunk-PJR63FTK.cjs.map
1972
+ //# sourceMappingURL=chunk-3KW4TWP2.cjs.map
1973
+ //# sourceMappingURL=chunk-3KW4TWP2.cjs.map