@arkade-os/sdk 0.5.0-rc.0 → 0.5.0-rc.1

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-BCzN3Y45.d.ts → asyncStorageTaskQueue-DAs_n1xr.d.ts} +2 -2
  9. package/dist/{asyncStorageTaskQueue-CdF_ELX8.d.cts → asyncStorageTaskQueue-DqGRG66E.d.cts} +2 -2
  10. package/dist/{chunk-PPG6W34P.js → chunk-6COJWPBO.js} +4 -4
  11. package/dist/{chunk-PPG6W34P.js.map → chunk-6COJWPBO.js.map} +1 -1
  12. package/dist/{chunk-RXWKCEZP.cjs → chunk-KB7OP3FG.cjs} +17 -17
  13. package/dist/{chunk-RXWKCEZP.cjs.map → chunk-KB7OP3FG.cjs.map} +1 -1
  14. package/dist/{chunk-ABJPM4JF.js → chunk-LPK4UBNJ.js} +4 -4
  15. package/dist/{chunk-ABJPM4JF.js.map → chunk-LPK4UBNJ.js.map} +1 -1
  16. package/dist/{chunk-JYP7YXT2.js → chunk-MEJSBJVH.js} +4 -4
  17. package/dist/{chunk-JYP7YXT2.js.map → chunk-MEJSBJVH.js.map} +1 -1
  18. package/dist/{chunk-PB5KJI4U.cjs → chunk-MXY23OPP.cjs} +10 -10
  19. package/dist/{chunk-PB5KJI4U.cjs.map → chunk-MXY23OPP.cjs.map} +1 -1
  20. package/dist/{chunk-HL7EC2Z5.cjs → chunk-Q5WQ4Y2I.cjs} +50 -50
  21. package/dist/{chunk-HL7EC2Z5.cjs.map → chunk-Q5WQ4Y2I.cjs.map} +1 -1
  22. package/dist/{chunk-6AFUNKK7.cjs → chunk-RZ2NGS6A.cjs} +3 -3
  23. package/dist/{chunk-6AFUNKK7.cjs.map → chunk-RZ2NGS6A.cjs.map} +1 -1
  24. package/dist/{chunk-FVTJJQNM.js → chunk-SG4XYCS7.js} +3 -3
  25. package/dist/{chunk-FVTJJQNM.js.map → chunk-SG4XYCS7.js.map} +1 -1
  26. package/dist/{chunk-6F2Q32KA.js → chunk-VTE3NYVD.js} +357 -50
  27. package/dist/chunk-VTE3NYVD.js.map +1 -0
  28. package/dist/{chunk-CZ32XADN.cjs → chunk-WQIWUTYS.cjs} +17 -17
  29. package/dist/{chunk-CZ32XADN.cjs.map → chunk-WQIWUTYS.cjs.map} +1 -1
  30. package/dist/{chunk-5MJHZHG7.cjs → chunk-YEUXBECG.cjs} +790 -482
  31. package/dist/chunk-YEUXBECG.cjs.map +1 -0
  32. package/dist/{chunk-KTU44AEH.js → chunk-ZPSUBAWQ.js} +4 -4
  33. package/dist/{chunk-KTU44AEH.js.map → chunk-ZPSUBAWQ.js.map} +1 -1
  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-Dyn5L80J.d.ts → delegate-B9Bmrns7.d.ts} +1 -1
  39. package/dist/{delegate-DLIOBQ5x.d.cts → delegate-CZzIduW4.d.cts} +1 -1
  40. package/dist/{hdWalletCapable-D9tooZ6F.d.ts → hdWalletCapable-BIl3yLVM.d.cts} +49 -5
  41. package/dist/{hdWalletCapable-Dt3MUiGE.d.cts → hdWalletCapable-Cr5nGpK5.d.ts} +49 -5
  42. package/dist/{index-D3hmsuKs.d.cts → index-Ci5MmNnK.d.cts} +3 -3
  43. package/dist/{index-D9tXd-tN.d.ts → index-DQ1Hb2w_.d.ts} +3 -3
  44. package/dist/{index-Udm5V2xW.d.cts → index-DnNIOqHS.d.cts} +54 -2
  45. package/dist/{index-Udm5V2xW.d.ts → index-DnNIOqHS.d.ts} +54 -2
  46. package/dist/index.cjs +298 -294
  47. package/dist/index.d.cts +25 -8
  48. package/dist/index.d.ts +25 -8
  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-DxZciNaa.d.cts → taskRunner-BDb5Ee2J.d.cts} +2 -2
  59. package/dist/{taskRunner-ZdS16Ypm.d.ts → taskRunner-F7wNJcF3.d.ts} +2 -2
  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 +1 -1
  73. package/dist/chunk-5MJHZHG7.cjs.map +0 -1
  74. package/dist/chunk-6F2Q32KA.js.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 chunkRXWKCEZP_cjs = require('../chunk-RXWKCEZP.cjs');
4
- require('../chunk-CZ32XADN.cjs');
5
- require('../chunk-6AFUNKK7.cjs');
3
+ var chunkKB7OP3FG_cjs = require('../chunk-KB7OP3FG.cjs');
4
+ require('../chunk-WQIWUTYS.cjs');
5
+ require('../chunk-RZ2NGS6A.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 chunkRXWKCEZP_cjs.ExpoArkProvider; }
12
+ get: function () { return chunkKB7OP3FG_cjs.ExpoArkProvider; }
13
13
  });
14
14
  Object.defineProperty(exports, "ExpoIndexerProvider", {
15
15
  enumerable: true,
16
- get: function () { return chunkRXWKCEZP_cjs.ExpoIndexerProvider; }
16
+ get: function () { return chunkKB7OP3FG_cjs.ExpoIndexerProvider; }
17
17
  });
18
18
  //# sourceMappingURL=expo.cjs.map
19
19
  //# sourceMappingURL=expo.cjs.map
@@ -1,5 +1,5 @@
1
- import { r as RestArkProvider, o as SettlementEvent, T as TxNotificationEvent, s as RestIndexerProvider, t as SubscriptionResponse } from '../index-Udm5V2xW.cjs';
2
- export { u as ArkProvider, v as IndexerProvider } from '../index-Udm5V2xW.cjs';
1
+ import { r as RestArkProvider, o as SettlementEvent, T as TxNotificationEvent, s as RestIndexerProvider, t as SubscriptionResponse } from '../index-DnNIOqHS.cjs';
2
+ export { u as ArkProvider, v as IndexerProvider } from '../index-DnNIOqHS.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 { r as RestArkProvider, o as SettlementEvent, T as TxNotificationEvent, s as RestIndexerProvider, t as SubscriptionResponse } from '../index-Udm5V2xW.js';
2
- export { u as ArkProvider, v as IndexerProvider } from '../index-Udm5V2xW.js';
1
+ import { r as RestArkProvider, o as SettlementEvent, T as TxNotificationEvent, s as RestIndexerProvider, t as SubscriptionResponse } from '../index-DnNIOqHS.js';
2
+ export { u as ArkProvider, v as IndexerProvider } from '../index-DnNIOqHS.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-JYP7YXT2.js';
2
- import '../chunk-FVTJJQNM.js';
3
- import '../chunk-PPG6W34P.js';
1
+ export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-MEJSBJVH.js';
2
+ import '../chunk-SG4XYCS7.js';
3
+ import '../chunk-6COJWPBO.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 chunk5MJHZHG7_cjs = require('../chunk-5MJHZHG7.cjs');
4
- require('../chunk-CZ32XADN.cjs');
5
- require('../chunk-HL7EC2Z5.cjs');
6
- require('../chunk-6AFUNKK7.cjs');
3
+ var chunkYEUXBECG_cjs = require('../chunk-YEUXBECG.cjs');
4
+ require('../chunk-WQIWUTYS.cjs');
5
+ require('../chunk-Q5WQ4Y2I.cjs');
6
+ require('../chunk-RZ2NGS6A.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 = chunk5MJHZHG7_cjs.DB_VERSION) {
14
+ constructor(dbName, version = chunkYEUXBECG_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-6F2Q32KA.js';
2
- import '../chunk-FVTJJQNM.js';
3
- import '../chunk-KTU44AEH.js';
4
- import '../chunk-PPG6W34P.js';
1
+ import { DB_VERSION } from '../chunk-VTE3NYVD.js';
2
+ import '../chunk-SG4XYCS7.js';
3
+ import '../chunk-ZPSUBAWQ.js';
4
+ import '../chunk-6COJWPBO.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-ZdS16Ypm.js';
1
+ import { c as TaskQueue, a as TaskItem, b as TaskResult } from './taskRunner-F7wNJcF3.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,4 +1,4 @@
1
- import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-DxZciNaa.cjs';
1
+ import { c as TaskQueue, a as TaskItem, b as TaskResult } from './taskRunner-BDb5Ee2J.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 { ScriptNum, OP, p2tr_ms, Script, SigHash, p2tr, TAPROOT_UNSPENDABLE_KEY, Address, RawWitness, Transaction as Transaction$1 } from '@scure/btc-signer';
1
+ import { ScriptNum, OP, p2tr_ms, Script, RawWitness, SigHash, p2tr, TAPROOT_UNSPENDABLE_KEY, Address, Transaction as Transaction$1 } from '@scure/btc-signer';
2
2
  import * as bip68 from 'bip68';
3
3
  import { TEST_NETWORK, NETWORK } from '@scure/btc-signer/utils.js';
4
4
  import { hex, bech32m } from '@scure/base';
@@ -1023,7 +1023,7 @@ function resolveEventSource(override) {
1023
1023
  }
1024
1024
 
1025
1025
  // package.json
1026
- var version = "0.5.0-rc.0";
1026
+ var version = "0.5.0-rc.1";
1027
1027
 
1028
1028
  // src/utils/fetch.ts
1029
1029
  var buildVersion = "0.9.9";
@@ -2435,5 +2435,5 @@ function isExpired(vtxo) {
2435
2435
  }
2436
2436
 
2437
2437
  export { ArkAddress, ArkError, ArkErrorName, ArkPsbtFieldKey, ArkPsbtFieldKeyType, BITCOIN_EMULATOR_PUBKEY, CLTVMultisigTapscript, CSVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, ConditionWitness, CosignerPublicKey, DEFAULT_ARKADE_SERVER_URL, DEFAULT_NETWORK, DEFAULT_NETWORK_NAME, DEFAULT_PAGE_SIZE, DigestMismatchError, EventSourceUnavailableError, FetchError, INFO_FETCH_TIMEOUT_MS, Intent, MUTINYNET_EMULATOR_PUBKEY, MultisigTapscript, OP_RETURN_EMPTY_PKSCRIPT, PrevArkTxField, PrevoutTxField, ProviderUnavailableError, REGTEST_EMULATOR_PUBKEY, RestArkProvider, SCRIPT_QUERY_CHUNK_SIZE, ServerResponseMismatchError, SettlementEventType, TapTreeCoder, Transaction, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, assembleBtcdTaprootTree, assertAllowedSighashTypes, baseFetch, buildVersion, canRecoverOnchain, canSpendOffchain, canSweepOnchain, configureEventSource, convertVtxo, craftToSpendTx, decodeTapscript, defaultEmulatorPubkey, eventSourceIterator, fetch, fetchVtxoCreatedAtByTxid, formatSighash, getAllNormalizedVtxos, getArkPsbtFields, getConfiguredEventSource, getNetwork, getNormalizedVtxos, getSequence, hasTerminalSpend, isArkError, isEventSourceError, isEventSourceUnavailableError, isExpired, isFetchTimeoutError, isPastExpiry, isRecoverable, isRetryableProviderError, isSpendable, isVirtualCoin, maybeArkError, networkFromArkadeInfo, networks, normalizeVtxo, parseLegacyExpiry, rateGate, resolveEmulatorPubkey, resolveEventSource, resolveTimeHeight, scriptFromTapLeafScript, sdkVersion, sequenceToTimelock, setArkPsbtField, throwIfHttpUnavailable, timelockToSequence, toBatchExpiry, toOffchainInputFeeParams, toProviderUnavailable, toVirtualStatus };
2438
- //# sourceMappingURL=chunk-PPG6W34P.js.map
2439
- //# sourceMappingURL=chunk-PPG6W34P.js.map
2438
+ //# sourceMappingURL=chunk-6COJWPBO.js.map
2439
+ //# sourceMappingURL=chunk-6COJWPBO.js.map