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

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 +34 -1
  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-CdF_ELX8.d.cts → asyncStorageTaskQueue-BuDvgWh6.d.cts} +1 -1
  9. package/dist/{asyncStorageTaskQueue-BCzN3Y45.d.ts → asyncStorageTaskQueue-C5rBYlru.d.ts} +1 -1
  10. package/dist/{chunk-KTU44AEH.js → chunk-3R476TDV.js} +4 -4
  11. package/dist/{chunk-KTU44AEH.js.map → chunk-3R476TDV.js.map} +1 -1
  12. package/dist/{chunk-HL7EC2Z5.cjs → chunk-43FKNLX4.cjs} +50 -50
  13. package/dist/{chunk-HL7EC2Z5.cjs.map → chunk-43FKNLX4.cjs.map} +1 -1
  14. package/dist/{chunk-FVTJJQNM.js → chunk-4PKLULWT.js} +3 -3
  15. package/dist/{chunk-FVTJJQNM.js.map → chunk-4PKLULWT.js.map} +1 -1
  16. package/dist/{chunk-ABJPM4JF.js → chunk-6DNR46C7.js} +4 -4
  17. package/dist/{chunk-ABJPM4JF.js.map → chunk-6DNR46C7.js.map} +1 -1
  18. package/dist/{chunk-PB5KJI4U.cjs → chunk-D25O4EGY.cjs} +10 -10
  19. package/dist/{chunk-PB5KJI4U.cjs.map → chunk-D25O4EGY.cjs.map} +1 -1
  20. package/dist/{chunk-5MJHZHG7.cjs → chunk-GMZZQXV5.cjs} +863 -484
  21. package/dist/chunk-GMZZQXV5.cjs.map +1 -0
  22. package/dist/{chunk-RXWKCEZP.cjs → chunk-HLCGYOIH.cjs} +17 -17
  23. package/dist/{chunk-RXWKCEZP.cjs.map → chunk-HLCGYOIH.cjs.map} +1 -1
  24. package/dist/{chunk-PPG6W34P.js → chunk-ISO4TI5J.js} +3 -3
  25. package/dist/{chunk-PPG6W34P.js.map → chunk-ISO4TI5J.js.map} +1 -1
  26. package/dist/{chunk-6AFUNKK7.cjs → chunk-JZWLXNHV.cjs} +3 -3
  27. package/dist/{chunk-6AFUNKK7.cjs.map → chunk-JZWLXNHV.cjs.map} +1 -1
  28. package/dist/{chunk-CZ32XADN.cjs → chunk-NVZJSKZS.cjs} +17 -17
  29. package/dist/{chunk-CZ32XADN.cjs.map → chunk-NVZJSKZS.cjs.map} +1 -1
  30. package/dist/{chunk-JYP7YXT2.js → chunk-ZOTXDOS5.js} +4 -4
  31. package/dist/{chunk-JYP7YXT2.js.map → chunk-ZOTXDOS5.js.map} +1 -1
  32. package/dist/{chunk-6F2Q32KA.js → chunk-ZRNQV6HV.js} +425 -52
  33. package/dist/chunk-ZRNQV6HV.js.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-DLIOBQ5x.d.cts → delegate-1yp1HyP7.d.cts} +1 -1
  39. package/dist/{delegate-Dyn5L80J.d.ts → delegate-BAX5QftB.d.ts} +1 -1
  40. package/dist/{hdWalletCapable-Dt3MUiGE.d.cts → hdWalletCapable-CmEU0NP1.d.ts} +49 -5
  41. package/dist/{hdWalletCapable-D9tooZ6F.d.ts → hdWalletCapable-eJgaT-ec.d.cts} +49 -5
  42. package/dist/{index-D9tXd-tN.d.ts → index-Bem5vKzX.d.ts} +2 -2
  43. package/dist/{index-Udm5V2xW.d.cts → index-DUxufw76.d.cts} +53 -1
  44. package/dist/{index-Udm5V2xW.d.ts → index-DUxufw76.d.ts} +53 -1
  45. package/dist/{index-D3hmsuKs.d.cts → index-W_oMcOmG.d.cts} +2 -2
  46. package/dist/index.cjs +318 -294
  47. package/dist/index.d.cts +81 -14
  48. package/dist/index.d.ts +81 -14
  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-ZdS16Ypm.d.ts → taskRunner-D_iPiZIi.d.ts} +1 -1
  59. package/dist/{taskRunner-DxZciNaa.d.cts → taskRunner-Dr3NStc0.d.cts} +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 +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:
@@ -1137,7 +1170,7 @@ The `StorageAdapter` API is deprecated. Use repositories instead. If you omit `s
1137
1170
 
1138
1171
  #### Repository Versioning
1139
1172
 
1140
- `WalletRepository`, `ContractRepository`, and `SwapRepository` (in
1173
+ `WalletRepository`, `ContractRepository`, and `AssetSwapRepository` (in
1141
1174
  `@arkade-os/swap`) each declare a `readonly version` field with a literal
1142
1175
  type. All built-in implementations set this to the current version. If you
1143
1176
  maintain a custom repository implementation, TypeScript will produce a compile
@@ -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 chunkHLCGYOIH_cjs = require('../chunk-HLCGYOIH.cjs');
4
+ require('../chunk-NVZJSKZS.cjs');
5
+ require('../chunk-JZWLXNHV.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 chunkHLCGYOIH_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 chunkHLCGYOIH_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-DUxufw76.cjs';
2
+ export { u as ArkProvider, v as IndexerProvider } from '../index-DUxufw76.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-DUxufw76.js';
2
+ export { u as ArkProvider, v as IndexerProvider } from '../index-DUxufw76.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-ZOTXDOS5.js';
2
+ import '../chunk-4PKLULWT.js';
3
+ import '../chunk-ISO4TI5J.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 chunkGMZZQXV5_cjs = require('../chunk-GMZZQXV5.cjs');
4
+ require('../chunk-NVZJSKZS.cjs');
5
+ require('../chunk-43FKNLX4.cjs');
6
+ require('../chunk-JZWLXNHV.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 = chunkGMZZQXV5_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-ZRNQV6HV.js';
2
+ import '../chunk-4PKLULWT.js';
3
+ import '../chunk-3R476TDV.js';
4
+ import '../chunk-ISO4TI5J.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-DxZciNaa.cjs';
1
+ import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-Dr3NStc0.cjs';
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-ZdS16Ypm.js';
1
+ import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-D_iPiZIi.js';
2
2
 
3
3
  /**
4
4
  * Minimal async key-value storage interface.
@@ -1,4 +1,4 @@
1
- import { VtxoScript, MultisigTapscript, CSVMultisigTapscript, timelockToSequence, sequenceToTimelock, ConditionMultisigTapscript, CLTVMultisigTapscript, ConditionCSVMultisigTapscript, SCRIPT_QUERY_CHUNK_SIZE, getNormalizedVtxos, DEFAULT_PAGE_SIZE } from './chunk-PPG6W34P.js';
1
+ import { VtxoScript, MultisigTapscript, CSVMultisigTapscript, timelockToSequence, sequenceToTimelock, ConditionMultisigTapscript, CLTVMultisigTapscript, ConditionCSVMultisigTapscript, SCRIPT_QUERY_CHUNK_SIZE, getNormalizedVtxos, DEFAULT_PAGE_SIZE } from './chunk-ISO4TI5J.js';
2
2
  import { __export } from './chunk-NSBPE2FW.js';
3
3
  import { hex } from '@scure/base';
4
4
  import { networks, expand } from '@bitcoinerlab/descriptors-scure';
@@ -2182,7 +2182,7 @@ var VHTLCV2ContractHandler = {
2182
2182
  }
2183
2183
  if (params.strictClaimAmount !== void 0 || params.strictClaimAssetAmount !== void 0) {
2184
2184
  throw new Error(
2185
- "strict claim params on a stored row: the strict claim bound was removed and this row's lockup cannot be re-derived without it \u2014 restore it with the SDK version that wrote it"
2185
+ "strict claim params on a stored row: the strict claim bound was removed in 0.4.68, so this row \u2014 written by 0.4.65-0.4.67 \u2014 locks to a script this build cannot re-derive. To clear it: claim or refund the swap on 0.4.67, then drop the settled row here with `contractManager.deleteContract(script)`. Do not delete it first \u2014 any balance it still holds is only reachable from 0.4.67."
2186
2186
  );
2187
2187
  }
2188
2188
  if (params.nonInteractiveRefundWithoutReceiver !== void 0 && !refund) {
@@ -2987,5 +2987,5 @@ contractHandlers.register(BoardingContractHandler);
2987
2987
  contractHandlers.register(ArkadeContractHandler);
2988
2988
 
2989
2989
  export { ARKADE_OP, ARKADE_OPCODES, ARKADE_OPCODE_NAMES, ARKADE_OPCODE_VALUES, ARKADE_OPS, ArkadeContractHandler, ArkadeProgramScript, ArkadeScript, BoardingContractHandler, DefaultContractHandler, DefaultVtxo, DelegateContractHandler, DelegateVtxo, OPCODE_NAMES, OPCODE_VALUES, SUPPORTED_PROGRAM_VERSION, VHTLC, VHTLCContractHandler, VHTLCV2ContractHandler, WALLET_RECEIVE_SOURCE, arkadeScriptHash, arkadeWitnessHash, asmToBytes, bignum_exports, bytesToASM, computeArkadeScriptPublicKey, contractHandlers, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, descriptorIsOurs, deserializeArkadeContractParams, fromASM, getOpcodeName, getOpcodeValue, identityDescriptor, inputName, isCltvSatisfied, isCsvSpendable, isMainnetDescriptor, normalizeToDescriptor, parseArtifact, parseHDDescriptor, resolveAsm, serializeArkadeContractParams, speculativeReceiveMetadata, stringifyArtifact, toASM, toXOnly, validateProgram, witnessRefToBytes };
2990
- //# sourceMappingURL=chunk-KTU44AEH.js.map
2991
- //# sourceMappingURL=chunk-KTU44AEH.js.map
2990
+ //# sourceMappingURL=chunk-3R476TDV.js.map
2991
+ //# sourceMappingURL=chunk-3R476TDV.js.map