@arkade-os/sdk 0.5.0-rc.7 → 0.5.0-rc.8

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 (72) hide show
  1. package/README.md +29 -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/{asyncStorageTaskQueue-BHOhjFiF.d.cts → asyncStorageTaskQueue-Bn3FoNkc.d.cts} +2 -2
  7. package/dist/{asyncStorageTaskQueue-BedBOEpT.d.ts → asyncStorageTaskQueue-CeYTmuGU.d.ts} +2 -2
  8. package/dist/{chunk-XOT73T36.cjs → chunk-2AWDPVZI.cjs} +18 -18
  9. package/dist/{chunk-XOT73T36.cjs.map → chunk-2AWDPVZI.cjs.map} +1 -1
  10. package/dist/{chunk-XIPWLWPU.cjs → chunk-56RCBKNF.cjs} +17 -17
  11. package/dist/{chunk-XIPWLWPU.cjs.map → chunk-56RCBKNF.cjs.map} +1 -1
  12. package/dist/{chunk-LFIORZO3.js → chunk-BIRUBLP3.js} +4 -4
  13. package/dist/{chunk-LFIORZO3.js.map → chunk-BIRUBLP3.js.map} +1 -1
  14. package/dist/{chunk-VUR6RP73.cjs → chunk-BMPGUGYZ.cjs} +10 -10
  15. package/dist/{chunk-VUR6RP73.cjs.map → chunk-BMPGUGYZ.cjs.map} +1 -1
  16. package/dist/{chunk-2JU54RGB.js → chunk-G6S4XSFI.js} +3 -3
  17. package/dist/{chunk-2JU54RGB.js.map → chunk-G6S4XSFI.js.map} +1 -1
  18. package/dist/{chunk-4MB3Z33G.js → chunk-INTEA7D3.js} +4 -4
  19. package/dist/{chunk-4MB3Z33G.js.map → chunk-INTEA7D3.js.map} +1 -1
  20. package/dist/{chunk-A2T3GGAK.cjs → chunk-K5RED5VE.cjs} +50 -50
  21. package/dist/{chunk-A2T3GGAK.cjs.map → chunk-K5RED5VE.cjs.map} +1 -1
  22. package/dist/{chunk-7B2QAHQU.js → chunk-LN4ZJZK4.js} +94 -11
  23. package/dist/chunk-LN4ZJZK4.js.map +1 -0
  24. package/dist/{chunk-H7KLBU6G.js → chunk-MTYQXZ2T.js} +4 -4
  25. package/dist/{chunk-H7KLBU6G.js.map → chunk-MTYQXZ2T.js.map} +1 -1
  26. package/dist/{chunk-GLLBSULU.cjs → chunk-NY5FN4VV.cjs} +3 -3
  27. package/dist/{chunk-GLLBSULU.cjs.map → chunk-NY5FN4VV.cjs.map} +1 -1
  28. package/dist/{chunk-L6MGV7ZA.js → chunk-XCNAGBFR.js} +3 -3
  29. package/dist/{chunk-L6MGV7ZA.js.map → chunk-XCNAGBFR.js.map} +1 -1
  30. package/dist/{chunk-EIMOVGBV.cjs → chunk-ZTCDT7KB.cjs} +523 -439
  31. package/dist/chunk-ZTCDT7KB.cjs.map +1 -0
  32. package/dist/contracts/handlers/index.cjs +9 -9
  33. package/dist/contracts/handlers/index.d.cts +3 -3
  34. package/dist/contracts/handlers/index.d.ts +3 -3
  35. package/dist/contracts/handlers/index.js +2 -2
  36. package/dist/{delegate-Hl92NVgS.d.ts → delegate-CyBnNY9v.d.ts} +1 -1
  37. package/dist/{delegate-Dv8aEvSp.d.cts → delegate-Cyv2suFd.d.cts} +1 -1
  38. package/dist/{hdWalletCapable-QiCK1B9d.d.cts → hdWalletCapable-D1ImQqlu.d.cts} +3 -3
  39. package/dist/{hdWalletCapable-Bqcb-XtC.d.ts → hdWalletCapable-DvumVrKW.d.ts} +3 -3
  40. package/dist/{index-F-X4BWxi.d.cts → index-BIL9boGL.d.cts} +14 -1
  41. package/dist/{index-F-X4BWxi.d.ts → index-BIL9boGL.d.ts} +14 -1
  42. package/dist/{index-CeC9FiJt.d.cts → index-DleNQcz5.d.cts} +3 -3
  43. package/dist/{index-BwEO0Yb-.d.ts → index-QVhQgYvU.d.ts} +3 -3
  44. package/dist/index.cjs +294 -290
  45. package/dist/index.d.cts +17 -9
  46. package/dist/index.d.ts +17 -9
  47. package/dist/index.js +4 -4
  48. package/dist/repositories/realm/index.cjs +20 -20
  49. package/dist/repositories/realm/index.d.cts +2 -2
  50. package/dist/repositories/realm/index.d.ts +2 -2
  51. package/dist/repositories/realm/index.js +5 -5
  52. package/dist/repositories/sqlite/index.cjs +19 -19
  53. package/dist/repositories/sqlite/index.d.cts +2 -2
  54. package/dist/repositories/sqlite/index.d.ts +2 -2
  55. package/dist/repositories/sqlite/index.js +5 -5
  56. package/dist/{taskRunner-BdU_d__J.d.ts → taskRunner-CRbuzUXR.d.ts} +2 -2
  57. package/dist/{taskRunner-CDCz7MTW.d.cts → taskRunner-z_BGID85.d.cts} +2 -2
  58. package/dist/wallet/expo/background.cjs +14 -14
  59. package/dist/wallet/expo/background.d.cts +3 -3
  60. package/dist/wallet/expo/background.d.ts +3 -3
  61. package/dist/wallet/expo/background.js +6 -6
  62. package/dist/wallet/expo/index.cjs +14 -14
  63. package/dist/wallet/expo/index.d.cts +4 -4
  64. package/dist/wallet/expo/index.d.ts +4 -4
  65. package/dist/wallet/expo/index.js +5 -5
  66. package/dist/worker/expo/index.cjs +9 -9
  67. package/dist/worker/expo/index.d.cts +4 -4
  68. package/dist/worker/expo/index.d.ts +4 -4
  69. package/dist/worker/expo/index.js +5 -5
  70. package/package.json +1 -1
  71. package/dist/chunk-7B2QAHQU.js.map +0 -1
  72. package/dist/chunk-EIMOVGBV.cjs.map +0 -1
package/README.md CHANGED
@@ -1371,6 +1371,35 @@ const swWallet = await ServiceWorkerWallet.setup({
1371
1371
 
1372
1372
  Raise it when the external issuer is expected to burn more than `N` consecutive addresses without any of them being paid — every index in such a run is a miss, and the funded one sits past the band. When that happens the funds are invisible until a `restore()` whose `gapLimit` is large enough to cross the run (`wallet.restore({ gapLimit: 200 })`); a default restore closes its gap window before reaching the funded index. Keep the value modest: the band adds up to `2N + 1` indices × the candidate matrix (typically 1-4 scripts each) to the wallet's subscription.
1373
1373
 
1374
+ #### Restoring plugin state
1375
+
1376
+ `wallet.restore()` is the explicit imported-wallet recovery boundary. It first restores the
1377
+ wallet's own addresses, contracts, history, and balances, then runs every restore hook registered
1378
+ for that wallet instance. `Wallet` and `ServiceWorkerWallet` both follow this ordering, and
1379
+ concurrent calls coalesce until the hooks finish.
1380
+
1381
+ ```typescript
1382
+ import { registerWalletRestoreHook } from '@arkade-os/sdk'
1383
+
1384
+ const unregister = registerWalletRestoreHook(wallet, {
1385
+ id: 'my-plugin',
1386
+ restore: async (restoredWallet) => {
1387
+ await rebuildPluginState(await restoredWallet.getTransactionHistory())
1388
+ },
1389
+ })
1390
+
1391
+ await wallet.restore()
1392
+ ```
1393
+
1394
+ Registering the same `id` again replaces that hook without changing its position. A run uses a
1395
+ stable snapshot, attempts every hook in registration order, and throws an `AggregateError` after
1396
+ all failures have been collected. If core recovery fails, hooks do not run. The returned function
1397
+ removes only that exact registration and is safe to call more than once.
1398
+
1399
+ Hooks do not run during `Wallet.create()`, `ServiceWorkerWallet.setup()`, or ordinary startup. A
1400
+ plugin should register before an application calls `restore()` and keep its normal incremental
1401
+ reconciliation for state that arrives later.
1402
+
1374
1403
  For advanced use cases, you can access the ContractManager directly to register external contracts:
1375
1404
 
1376
1405
  ```typescript
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var chunkXIPWLWPU_cjs = require('../chunk-XIPWLWPU.cjs');
4
- require('../chunk-XOT73T36.cjs');
5
- require('../chunk-GLLBSULU.cjs');
3
+ var chunk56RCBKNF_cjs = require('../chunk-56RCBKNF.cjs');
4
+ require('../chunk-2AWDPVZI.cjs');
5
+ require('../chunk-NY5FN4VV.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "ExpoArkProvider", {
10
10
  enumerable: true,
11
- get: function () { return chunkXIPWLWPU_cjs.ExpoArkProvider; }
11
+ get: function () { return chunk56RCBKNF_cjs.ExpoArkProvider; }
12
12
  });
13
13
  Object.defineProperty(exports, "ExpoIndexerProvider", {
14
14
  enumerable: true,
15
- get: function () { return chunkXIPWLWPU_cjs.ExpoIndexerProvider; }
15
+ get: function () { return chunk56RCBKNF_cjs.ExpoIndexerProvider; }
16
16
  });
17
17
  //# sourceMappingURL=expo.cjs.map
18
18
  //# sourceMappingURL=expo.cjs.map
@@ -1,5 +1,5 @@
1
- import { q as RestArkProvider, n as SettlementEvent, T as TxNotificationEvent, r as RestIndexerProvider, s as SubscriptionResponse } from '../index-F-X4BWxi.cjs';
2
- export { t as ArkProvider, u as IndexerProvider } from '../index-F-X4BWxi.cjs';
1
+ import { q as RestArkProvider, n as SettlementEvent, T as TxNotificationEvent, r as RestIndexerProvider, s as SubscriptionResponse } from '../index-BIL9boGL.cjs';
2
+ export { t as ArkProvider, u as IndexerProvider } from '../index-BIL9boGL.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 { q as RestArkProvider, n as SettlementEvent, T as TxNotificationEvent, r as RestIndexerProvider, s as SubscriptionResponse } from '../index-F-X4BWxi.js';
2
- export { t as ArkProvider, u as IndexerProvider } from '../index-F-X4BWxi.js';
1
+ import { q as RestArkProvider, n as SettlementEvent, T as TxNotificationEvent, r as RestIndexerProvider, s as SubscriptionResponse } from '../index-BIL9boGL.js';
2
+ export { t as ArkProvider, u as IndexerProvider } from '../index-BIL9boGL.js';
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
- export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-4MB3Z33G.js';
2
- import '../chunk-2JU54RGB.js';
3
- import '../chunk-H7KLBU6G.js';
1
+ export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-INTEA7D3.js';
2
+ import '../chunk-G6S4XSFI.js';
3
+ import '../chunk-MTYQXZ2T.js';
4
4
  //# sourceMappingURL=expo.js.map
5
5
  //# sourceMappingURL=expo.js.map
@@ -1,4 +1,4 @@
1
- import { a as TaskQueue, b as TaskItem, c as TaskResult } from './taskRunner-CDCz7MTW.cjs';
1
+ import { c as TaskQueue, b as TaskItem, d as TaskResult } from './taskRunner-z_BGID85.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 { AsyncStorageTaskQueue as A, type AsyncStorageLike as a };
49
+ export { type AsyncStorageLike as A, AsyncStorageTaskQueue as a };
@@ -1,4 +1,4 @@
1
- import { a as TaskQueue, b as TaskItem, c as TaskResult } from './taskRunner-BdU_d__J.js';
1
+ import { c as TaskQueue, b as TaskItem, d as TaskResult } from './taskRunner-CRbuzUXR.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 { AsyncStorageTaskQueue as A, type AsyncStorageLike as a };
49
+ export { type AsyncStorageLike as A, AsyncStorageTaskQueue as a };
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkGLLBSULU_cjs = require('./chunk-GLLBSULU.cjs');
3
+ var chunkNY5FN4VV_cjs = require('./chunk-NY5FN4VV.cjs');
4
4
  var base = require('@scure/base');
5
5
  var secp256k1_js = require('@noble/curves/secp256k1.js');
6
6
  var utils_js = require('@scure/btc-signer/utils.js');
7
7
 
8
8
  // src/extension/asset/index.ts
9
9
  var asset_exports = {};
10
- chunkGLLBSULU_cjs.__export(asset_exports, {
10
+ chunkNY5FN4VV_cjs.__export(asset_exports, {
11
11
  ASSET_ID_VECTORS: () => ASSET_ID_VECTORS,
12
12
  AssetGroup: () => AssetGroup,
13
13
  AssetId: () => AssetId,
@@ -1419,10 +1419,10 @@ async function indexerFetch(input, init) {
1419
1419
  const lastAttempt = attempt >= maxAttempts;
1420
1420
  let res;
1421
1421
  try {
1422
- res = await chunkGLLBSULU_cjs.rateGate.runHttp(input, () => chunkGLLBSULU_cjs.baseFetch(input, init));
1422
+ res = await chunkNY5FN4VV_cjs.rateGate.runHttp(input, () => chunkNY5FN4VV_cjs.baseFetch(input, init));
1423
1423
  } catch (err) {
1424
- const mapped = chunkGLLBSULU_cjs.toProviderUnavailable(err, "indexer");
1425
- if (lastAttempt || !(mapped instanceof chunkGLLBSULU_cjs.ProviderUnavailableError)) throw mapped;
1424
+ const mapped = chunkNY5FN4VV_cjs.toProviderUnavailable(err, "indexer");
1425
+ if (lastAttempt || !(mapped instanceof chunkNY5FN4VV_cjs.ProviderUnavailableError)) throw mapped;
1426
1426
  await sleep(retryDelayMs(attempt));
1427
1427
  continue;
1428
1428
  }
@@ -1434,7 +1434,7 @@ async function indexerFetch(input, init) {
1434
1434
  body = void 0;
1435
1435
  }
1436
1436
  try {
1437
- chunkGLLBSULU_cjs.throwIfHttpUnavailable(res, "indexer", body);
1437
+ chunkNY5FN4VV_cjs.throwIfHttpUnavailable(res, "indexer", body);
1438
1438
  } catch (err) {
1439
1439
  if (lastAttempt) throw err;
1440
1440
  await sleep(retryDelayMs(attempt));
@@ -1463,7 +1463,7 @@ var ChainTxType = /* @__PURE__ */ ((ChainTxType2) => {
1463
1463
  return ChainTxType2;
1464
1464
  })(ChainTxType || {});
1465
1465
  var RestIndexerProvider = class {
1466
- constructor(serverUrl = chunkGLLBSULU_cjs.DEFAULT_ARKADE_SERVER_URL, options = {}) {
1466
+ constructor(serverUrl = chunkNY5FN4VV_cjs.DEFAULT_ARKADE_SERVER_URL, options = {}) {
1467
1467
  this.serverUrl = serverUrl;
1468
1468
  this.eventSource = options.eventSource;
1469
1469
  }
@@ -1601,8 +1601,8 @@ var RestIndexerProvider = class {
1601
1601
  try {
1602
1602
  while (!abortSignal?.aborted) {
1603
1603
  try {
1604
- const currentIterator = chunkGLLBSULU_cjs.eventSourceIterator(
1605
- chunkGLLBSULU_cjs.resolveEventSource(override)(url)
1604
+ const currentIterator = chunkNY5FN4VV_cjs.eventSourceIterator(
1605
+ chunkNY5FN4VV_cjs.resolveEventSource(override)(url)
1606
1606
  );
1607
1607
  iterator = currentIterator;
1608
1608
  for await (const event of currentIterator) {
@@ -1613,9 +1613,9 @@ var RestIndexerProvider = class {
1613
1613
  yield {
1614
1614
  txid: data.event.txid,
1615
1615
  scripts: data.event.scripts || [],
1616
- newVtxos: (data.event.newVtxos || []).map(chunkGLLBSULU_cjs.convertVtxo),
1617
- spentVtxos: (data.event.spentVtxos || []).map(chunkGLLBSULU_cjs.convertVtxo),
1618
- sweptVtxos: (data.event.sweptVtxos || []).map(chunkGLLBSULU_cjs.convertVtxo),
1616
+ newVtxos: (data.event.newVtxos || []).map(chunkNY5FN4VV_cjs.convertVtxo),
1617
+ spentVtxos: (data.event.spentVtxos || []).map(chunkNY5FN4VV_cjs.convertVtxo),
1618
+ sweptVtxos: (data.event.sweptVtxos || []).map(chunkNY5FN4VV_cjs.convertVtxo),
1619
1619
  tx: data.event.tx,
1620
1620
  checkpointTxs: data.event.checkpointTxs
1621
1621
  };
@@ -1629,14 +1629,14 @@ var RestIndexerProvider = class {
1629
1629
  if (abortSignal?.aborted || error instanceof Error && error.name === "AbortError") {
1630
1630
  break;
1631
1631
  }
1632
- if (chunkGLLBSULU_cjs.isFetchTimeoutError(error)) {
1632
+ if (chunkNY5FN4VV_cjs.isFetchTimeoutError(error)) {
1633
1633
  console.debug("Timeout error ignored");
1634
1634
  continue;
1635
1635
  }
1636
- if (chunkGLLBSULU_cjs.isEventSourceError(error)) {
1636
+ if (chunkNY5FN4VV_cjs.isEventSourceError(error)) {
1637
1637
  throw error;
1638
1638
  }
1639
- if (chunkGLLBSULU_cjs.isEventSourceUnavailableError(error)) throw error;
1639
+ if (chunkNY5FN4VV_cjs.isEventSourceUnavailableError(error)) throw error;
1640
1640
  console.error("Subscription error:", error);
1641
1641
  throw error;
1642
1642
  } finally {
@@ -1780,7 +1780,7 @@ var RestIndexerProvider = class {
1780
1780
  }
1781
1781
  const data = await this.fetchVtxosJson(url);
1782
1782
  return {
1783
- vtxos: data.vtxos.map(chunkGLLBSULU_cjs.convertVtxo),
1783
+ vtxos: data.vtxos.map(chunkNY5FN4VV_cjs.convertVtxo),
1784
1784
  page: data.page
1785
1785
  };
1786
1786
  }
@@ -1994,5 +1994,5 @@ exports.Metadata = Metadata;
1994
1994
  exports.Packet = Packet;
1995
1995
  exports.RestIndexerProvider = RestIndexerProvider;
1996
1996
  exports.asset_exports = asset_exports;
1997
- //# sourceMappingURL=chunk-XOT73T36.cjs.map
1998
- //# sourceMappingURL=chunk-XOT73T36.cjs.map
1997
+ //# sourceMappingURL=chunk-2AWDPVZI.cjs.map
1998
+ //# sourceMappingURL=chunk-2AWDPVZI.cjs.map