@arkade-os/sdk 0.4.76 → 0.4.77

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 (87) hide show
  1. package/dist/adapters/expo.cjs +5 -5
  2. package/dist/adapters/expo.d.cts +2 -2
  3. package/dist/adapters/expo.d.ts +2 -2
  4. package/dist/adapters/expo.js +3 -3
  5. package/dist/adapters/indexedDB.cjs +3 -5
  6. package/dist/adapters/indexedDB.cjs.map +1 -1
  7. package/dist/adapters/indexedDB.d.cts +1 -1
  8. package/dist/adapters/indexedDB.d.ts +1 -1
  9. package/dist/adapters/indexedDB.js +3 -5
  10. package/dist/adapters/indexedDB.js.map +1 -1
  11. package/dist/{asyncStorageTaskQueue-DrKbfleJ.d.ts → asyncStorageTaskQueue-DTl0WM7E.d.ts} +1 -1
  12. package/dist/{asyncStorageTaskQueue-D7BU-BdP.d.cts → asyncStorageTaskQueue-MmJyAnu-.d.cts} +1 -1
  13. package/dist/{chunk-2KFXM3N5.cjs → chunk-4LP6XOMW.cjs} +17 -17
  14. package/dist/{chunk-2KFXM3N5.cjs.map → chunk-4LP6XOMW.cjs.map} +1 -1
  15. package/dist/{chunk-F6YOCYWU.js → chunk-52OA3UIC.js} +25 -12
  16. package/dist/chunk-52OA3UIC.js.map +1 -0
  17. package/dist/{chunk-7UJLIZQU.js → chunk-ACPANSOX.js} +43 -11
  18. package/dist/chunk-ACPANSOX.js.map +1 -0
  19. package/dist/{chunk-P53OHGXY.cjs → chunk-CJN4CUEU.cjs} +25 -11
  20. package/dist/chunk-CJN4CUEU.cjs.map +1 -0
  21. package/dist/{chunk-T327OEMV.cjs → chunk-H62OOAS4.cjs} +17 -17
  22. package/dist/{chunk-T327OEMV.cjs.map → chunk-H62OOAS4.cjs.map} +1 -1
  23. package/dist/{chunk-54W6QBXL.js → chunk-HKOFYHZP.js} +3 -3
  24. package/dist/{chunk-54W6QBXL.js.map → chunk-HKOFYHZP.js.map} +1 -1
  25. package/dist/{chunk-CQNX4BTA.cjs → chunk-LUWSY2QO.cjs} +89 -57
  26. package/dist/chunk-LUWSY2QO.cjs.map +1 -0
  27. package/dist/{chunk-WMHELOHH.js → chunk-MLOZHTBN.js} +523 -104
  28. package/dist/chunk-MLOZHTBN.js.map +1 -0
  29. package/dist/{chunk-O2BIWLZC.js → chunk-T6MGH4V4.js} +4 -4
  30. package/dist/{chunk-O2BIWLZC.js.map → chunk-T6MGH4V4.js.map} +1 -1
  31. package/dist/{chunk-LQM6RHNT.cjs → chunk-Y4YK44IM.cjs} +10 -10
  32. package/dist/{chunk-LQM6RHNT.cjs.map → chunk-Y4YK44IM.cjs.map} +1 -1
  33. package/dist/{chunk-LHSVPDFJ.cjs → chunk-YJEWWLOQ.cjs} +959 -541
  34. package/dist/chunk-YJEWWLOQ.cjs.map +1 -0
  35. package/dist/{chunk-MUBPGYUE.js → chunk-YKNTUOUG.js} +4 -4
  36. package/dist/{chunk-MUBPGYUE.js.map → chunk-YKNTUOUG.js.map} +1 -1
  37. package/dist/contracts/handlers/index.cjs +9 -9
  38. package/dist/contracts/handlers/index.d.cts +3 -3
  39. package/dist/contracts/handlers/index.d.ts +3 -3
  40. package/dist/contracts/handlers/index.js +2 -2
  41. package/dist/{delegate-BAYpqkEx.d.ts → delegate-CjcysR7s.d.ts} +1 -1
  42. package/dist/{delegate-CR7msIXK.d.cts → delegate-QPCGaD_z.d.cts} +1 -1
  43. package/dist/{hdWalletCapable-BSF29IjK.d.ts → hdWalletCapable--pMncWbC.d.ts} +6 -4
  44. package/dist/{hdWalletCapable-BbZxCUeZ.d.cts → hdWalletCapable-Bp_p0WLj.d.cts} +6 -4
  45. package/dist/{index-4NF3srcg.d.cts → index-BMY272ns.d.cts} +26 -8
  46. package/dist/{index-B_RYn9rg.d.cts → index-Ie_ak2zY.d.cts} +35 -9
  47. package/dist/{index-B_RYn9rg.d.ts → index-Ie_ak2zY.d.ts} +35 -9
  48. package/dist/{index-Dj2yOhQ2.d.ts → index-m-EM-e8D.d.ts} +26 -8
  49. package/dist/index.cjs +307 -303
  50. package/dist/index.d.cts +75 -13
  51. package/dist/index.d.ts +75 -13
  52. package/dist/index.js +4 -4
  53. package/dist/repositories/realm/index.cjs +36 -19
  54. package/dist/repositories/realm/index.cjs.map +1 -1
  55. package/dist/repositories/realm/index.d.cts +6 -3
  56. package/dist/repositories/realm/index.d.ts +6 -3
  57. package/dist/repositories/realm/index.js +22 -5
  58. package/dist/repositories/realm/index.js.map +1 -1
  59. package/dist/repositories/sqlite/index.cjs +42 -18
  60. package/dist/repositories/sqlite/index.cjs.map +1 -1
  61. package/dist/repositories/sqlite/index.d.cts +5 -2
  62. package/dist/repositories/sqlite/index.d.ts +5 -2
  63. package/dist/repositories/sqlite/index.js +29 -5
  64. package/dist/repositories/sqlite/index.js.map +1 -1
  65. package/dist/{taskRunner-DGxde-YU.d.cts → taskRunner-BgRowCqB.d.cts} +1 -1
  66. package/dist/{taskRunner-TzGUhxP-.d.ts → taskRunner-CqrlrJEt.d.ts} +1 -1
  67. package/dist/wallet/expo/background.cjs +14 -14
  68. package/dist/wallet/expo/background.d.cts +3 -3
  69. package/dist/wallet/expo/background.d.ts +3 -3
  70. package/dist/wallet/expo/background.js +6 -6
  71. package/dist/wallet/expo/index.cjs +14 -14
  72. package/dist/wallet/expo/index.cjs.map +1 -1
  73. package/dist/wallet/expo/index.d.cts +5 -5
  74. package/dist/wallet/expo/index.d.ts +5 -5
  75. package/dist/wallet/expo/index.js +5 -5
  76. package/dist/wallet/expo/index.js.map +1 -1
  77. package/dist/worker/expo/index.cjs +9 -9
  78. package/dist/worker/expo/index.d.cts +4 -4
  79. package/dist/worker/expo/index.d.ts +4 -4
  80. package/dist/worker/expo/index.js +5 -5
  81. package/package.json +1 -1
  82. package/dist/chunk-7UJLIZQU.js.map +0 -1
  83. package/dist/chunk-CQNX4BTA.cjs.map +0 -1
  84. package/dist/chunk-F6YOCYWU.js.map +0 -1
  85. package/dist/chunk-LHSVPDFJ.cjs.map +0 -1
  86. package/dist/chunk-P53OHGXY.cjs.map +0 -1
  87. package/dist/chunk-WMHELOHH.js.map +0 -1
@@ -1044,7 +1044,7 @@ function resolveEventSource(override) {
1044
1044
  }
1045
1045
 
1046
1046
  // package.json
1047
- var version = "0.4.76";
1047
+ var version = "0.4.77";
1048
1048
 
1049
1049
  // src/utils/fetch.ts
1050
1050
  var buildVersion = "0.9.9";
@@ -2388,11 +2388,16 @@ async function getNormalizedVtxos(provider, opts) {
2388
2388
  const { vtxos, page } = await provider.getVtxos(opts);
2389
2389
  return { vtxos: vtxos.map(normalizeVtxo), page };
2390
2390
  }
2391
+ var SCRIPT_CHUNK_CONCURRENCY = 4;
2391
2392
  async function getAllNormalizedVtxos(provider, scripts, opts = {}) {
2392
2393
  const { pageSize = DEFAULT_PAGE_SIZE, ...filters } = opts;
2393
2394
  const all = [];
2395
+ const chunks = [];
2394
2396
  for (let i = 0; i < scripts.length; i += SCRIPT_QUERY_CHUNK_SIZE) {
2395
- const chunk = scripts.slice(i, i + SCRIPT_QUERY_CHUNK_SIZE);
2397
+ chunks.push(scripts.slice(i, i + SCRIPT_QUERY_CHUNK_SIZE));
2398
+ }
2399
+ const fetchChunk = async (chunk) => {
2400
+ const result = [];
2396
2401
  let pageIndex = 0;
2397
2402
  let hasMore = true;
2398
2403
  while (hasMore) {
@@ -2402,11 +2407,18 @@ async function getAllNormalizedVtxos(provider, scripts, opts = {}) {
2402
2407
  pageIndex,
2403
2408
  pageSize
2404
2409
  });
2405
- all.push(...vtxos);
2410
+ result.push(...vtxos);
2406
2411
  hasMore = page ? vtxos.length === pageSize : false;
2407
2412
  pageIndex++;
2408
2413
  if (hasMore) await new Promise((r) => setTimeout(r, 500));
2409
2414
  }
2415
+ return result;
2416
+ };
2417
+ for (let i = 0; i < chunks.length; i += SCRIPT_CHUNK_CONCURRENCY) {
2418
+ const batch = await Promise.all(
2419
+ chunks.slice(i, i + SCRIPT_CHUNK_CONCURRENCY).map(fetchChunk)
2420
+ );
2421
+ for (const result of batch) all.push(...result);
2410
2422
  }
2411
2423
  return all;
2412
2424
  }
@@ -2429,10 +2441,11 @@ async function fetchVtxoCreatedAtByTxid(provider, txids) {
2429
2441
  }
2430
2442
  return createdAt;
2431
2443
  }
2432
- function hasTerminalSpend(vtxo) {
2444
+ function isVtxoSpent(vtxo) {
2433
2445
  const n = normalizeVtxo(vtxo);
2434
2446
  return !!n.isSpent || !!n.spentBy || !!n.settledBy;
2435
2447
  }
2448
+ var hasTerminalSpend = isVtxoSpent;
2436
2449
  function isPastExpiry(vtxo, now) {
2437
2450
  const n = normalizeVtxo(vtxo);
2438
2451
  if (n.expiresAt !== void 0 && now.timestamp.getTime() >= n.expiresAt.getTime()) return true;
@@ -2440,15 +2453,15 @@ function isPastExpiry(vtxo, now) {
2440
2453
  }
2441
2454
  function canSpendOffchain(vtxo, now) {
2442
2455
  const n = normalizeVtxo(vtxo);
2443
- return !hasTerminalSpend(n) && !n.isUnrolled && !(n.isSwept || isPastExpiry(n, now));
2456
+ return !isVtxoSpent(n) && !n.isUnrolled && !(n.isSwept || isPastExpiry(n, now));
2444
2457
  }
2445
2458
  function canRecoverOnchain(vtxo, now) {
2446
2459
  const n = normalizeVtxo(vtxo);
2447
- return !hasTerminalSpend(n) && !n.isUnrolled && (n.isSwept || isPastExpiry(n, now));
2460
+ return !isVtxoSpent(n) && !n.isUnrolled && (n.isSwept || isPastExpiry(n, now));
2448
2461
  }
2449
2462
  function canSweepOnchain(vtxo) {
2450
2463
  const n = normalizeVtxo(vtxo);
2451
- return !hasTerminalSpend(n) && !!n.isUnrolled;
2464
+ return !isVtxoSpent(n) && !!n.isUnrolled;
2452
2465
  }
2453
2466
  function toOffchainInputFeeParams(vtxo) {
2454
2467
  const batchExpiry = toBatchExpiry(vtxo);
@@ -2464,11 +2477,11 @@ function isVirtualCoin(input) {
2464
2477
  return typeof input === "object" && input !== null && typeof input.script === "string";
2465
2478
  }
2466
2479
  function isSpendable(vtxo) {
2467
- return !hasTerminalSpend(vtxo);
2480
+ return !isVtxoSpent(vtxo);
2468
2481
  }
2469
2482
  function isRecoverable(vtxo) {
2470
2483
  const n = normalizeVtxo(vtxo);
2471
- return n.isSwept && !hasTerminalSpend(n);
2484
+ return n.isSwept && !isVtxoSpent(n);
2472
2485
  }
2473
2486
  function isExpired(vtxo) {
2474
2487
  const n = normalizeVtxo(vtxo);
@@ -2539,6 +2552,7 @@ exports.isRecoverable = isRecoverable;
2539
2552
  exports.isRetryableProviderError = isRetryableProviderError;
2540
2553
  exports.isSpendable = isSpendable;
2541
2554
  exports.isVirtualCoin = isVirtualCoin;
2555
+ exports.isVtxoSpent = isVtxoSpent;
2542
2556
  exports.maybeArkError = maybeArkError;
2543
2557
  exports.networks = networks;
2544
2558
  exports.normalizeVtxo = normalizeVtxo;
@@ -2557,5 +2571,5 @@ exports.toBatchExpiry = toBatchExpiry;
2557
2571
  exports.toOffchainInputFeeParams = toOffchainInputFeeParams;
2558
2572
  exports.toProviderUnavailable = toProviderUnavailable;
2559
2573
  exports.toVirtualStatus = toVirtualStatus;
2560
- //# sourceMappingURL=chunk-P53OHGXY.cjs.map
2561
- //# sourceMappingURL=chunk-P53OHGXY.cjs.map
2574
+ //# sourceMappingURL=chunk-CJN4CUEU.cjs.map
2575
+ //# sourceMappingURL=chunk-CJN4CUEU.cjs.map