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

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 (118) hide show
  1. package/README.md +12 -67
  2. package/dist/adapters/expo.cjs +5 -6
  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 -4
  6. package/dist/{asyncStorageTaskQueue-C5rBYlru.d.ts → asyncStorageTaskQueue-BCiOgs5x.d.ts} +2 -2
  7. package/dist/{asyncStorageTaskQueue-BuDvgWh6.d.cts → asyncStorageTaskQueue-CTIwKrt5.d.cts} +2 -2
  8. package/dist/{chunk-3R476TDV.js → chunk-4EZOMPAO.js} +14 -38
  9. package/dist/chunk-4EZOMPAO.js.map +1 -0
  10. package/dist/{chunk-D25O4EGY.cjs → chunk-5NLJUXXQ.cjs} +10 -10
  11. package/dist/{chunk-D25O4EGY.cjs.map → chunk-5NLJUXXQ.cjs.map} +1 -1
  12. package/dist/{chunk-JZWLXNHV.cjs → chunk-C5Y2R63Z.cjs} +25 -71
  13. package/dist/chunk-C5Y2R63Z.cjs.map +1 -0
  14. package/dist/{chunk-6DNR46C7.js → chunk-CIBGIZUW.js} +4 -4
  15. package/dist/{chunk-6DNR46C7.js.map → chunk-CIBGIZUW.js.map} +1 -1
  16. package/dist/{chunk-43FKNLX4.cjs → chunk-F7HJO5GT.cjs} +61 -85
  17. package/dist/chunk-F7HJO5GT.cjs.map +1 -0
  18. package/dist/{chunk-ISO4TI5J.js → chunk-GLZNJFAT.js} +25 -67
  19. package/dist/chunk-GLZNJFAT.js.map +1 -0
  20. package/dist/{chunk-HLCGYOIH.cjs → chunk-GPJSGLWM.cjs} +17 -17
  21. package/dist/{chunk-HLCGYOIH.cjs.map → chunk-GPJSGLWM.cjs.map} +1 -1
  22. package/dist/{chunk-ZOTXDOS5.js → chunk-MOWSLXGO.js} +4 -4
  23. package/dist/{chunk-ZOTXDOS5.js.map → chunk-MOWSLXGO.js.map} +1 -1
  24. package/dist/{chunk-ZRNQV6HV.js → chunk-PYTAH2NY.js} +167 -703
  25. package/dist/chunk-PYTAH2NY.js.map +1 -0
  26. package/dist/{chunk-NVZJSKZS.cjs → chunk-SYRQJS5N.cjs} +18 -19
  27. package/dist/chunk-SYRQJS5N.cjs.map +1 -0
  28. package/dist/{chunk-4PKLULWT.js → chunk-XHASFSDU.js} +3 -4
  29. package/dist/chunk-XHASFSDU.js.map +1 -0
  30. package/dist/{chunk-GMZZQXV5.cjs → chunk-ZHLYFRYY.cjs} +583 -1128
  31. package/dist/chunk-ZHLYFRYY.cjs.map +1 -0
  32. package/dist/contracts/handlers/index.cjs +9 -10
  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 -3
  36. package/dist/{delegate-1yp1HyP7.d.cts → delegate-CpQIgTs7.d.cts} +1 -1
  37. package/dist/{delegate-BAX5QftB.d.ts → delegate-Dv-us16c.d.ts} +1 -1
  38. package/dist/{hdWalletCapable-CmEU0NP1.d.ts → hdWalletCapable-BC4Fmmht.d.ts} +7 -25
  39. package/dist/{hdWalletCapable-eJgaT-ec.d.cts → hdWalletCapable-DotEa5rZ.d.cts} +7 -25
  40. package/dist/{index-DUxufw76.d.ts → index-Czz9HSqE.d.cts} +21 -220
  41. package/dist/{index-DUxufw76.d.cts → index-Czz9HSqE.d.ts} +21 -220
  42. package/dist/{index-Bem5vKzX.d.ts → index-DUkvXxpt.d.ts} +3 -3
  43. package/dist/{index-W_oMcOmG.d.cts → index-DdJt5fRc.d.cts} +3 -3
  44. package/dist/index.cjs +291 -340
  45. package/dist/index.d.cts +58 -223
  46. package/dist/index.d.ts +58 -223
  47. package/dist/index.js +4 -5
  48. package/dist/repositories/realm/index.cjs +57 -24
  49. package/dist/repositories/realm/index.cjs.map +1 -1
  50. package/dist/repositories/realm/index.d.cts +12 -4
  51. package/dist/repositories/realm/index.d.ts +12 -4
  52. package/dist/repositories/realm/index.js +43 -10
  53. package/dist/repositories/realm/index.js.map +1 -1
  54. package/dist/repositories/sqlite/index.cjs +103 -33
  55. package/dist/repositories/sqlite/index.cjs.map +1 -1
  56. package/dist/repositories/sqlite/index.d.cts +12 -2
  57. package/dist/repositories/sqlite/index.d.ts +12 -2
  58. package/dist/repositories/sqlite/index.js +90 -20
  59. package/dist/repositories/sqlite/index.js.map +1 -1
  60. package/dist/{taskRunner-Dr3NStc0.d.cts → taskRunner-7E_Rx8bD.d.cts} +2 -2
  61. package/dist/{taskRunner-D_iPiZIi.d.ts → taskRunner-DUId1UJ8.d.ts} +2 -2
  62. package/dist/wallet/expo/background.cjs +14 -15
  63. package/dist/wallet/expo/background.cjs.map +1 -1
  64. package/dist/wallet/expo/background.d.cts +3 -3
  65. package/dist/wallet/expo/background.d.ts +3 -3
  66. package/dist/wallet/expo/background.js +6 -7
  67. package/dist/wallet/expo/background.js.map +1 -1
  68. package/dist/wallet/expo/index.cjs +15 -23
  69. package/dist/wallet/expo/index.cjs.map +1 -1
  70. package/dist/wallet/expo/index.d.cts +4 -7
  71. package/dist/wallet/expo/index.d.ts +4 -7
  72. package/dist/wallet/expo/index.js +7 -15
  73. package/dist/wallet/expo/index.js.map +1 -1
  74. package/dist/worker/expo/index.cjs +9 -10
  75. package/dist/worker/expo/index.cjs.map +1 -1
  76. package/dist/worker/expo/index.d.cts +4 -4
  77. package/dist/worker/expo/index.d.ts +4 -4
  78. package/dist/worker/expo/index.js +5 -6
  79. package/dist/worker/expo/index.js.map +1 -1
  80. package/package.json +4 -42
  81. package/dist/adapters/asyncStorage.cjs +0 -48
  82. package/dist/adapters/asyncStorage.cjs.map +0 -1
  83. package/dist/adapters/asyncStorage.d.cts +0 -16
  84. package/dist/adapters/asyncStorage.d.ts +0 -16
  85. package/dist/adapters/asyncStorage.js +0 -46
  86. package/dist/adapters/asyncStorage.js.map +0 -1
  87. package/dist/adapters/fileSystem.cjs +0 -116
  88. package/dist/adapters/fileSystem.cjs.map +0 -1
  89. package/dist/adapters/fileSystem.d.cts +0 -17
  90. package/dist/adapters/fileSystem.d.ts +0 -17
  91. package/dist/adapters/fileSystem.js +0 -93
  92. package/dist/adapters/fileSystem.js.map +0 -1
  93. package/dist/adapters/indexedDB.cjs +0 -103
  94. package/dist/adapters/indexedDB.cjs.map +0 -1
  95. package/dist/adapters/indexedDB.d.cts +0 -18
  96. package/dist/adapters/indexedDB.d.ts +0 -18
  97. package/dist/adapters/indexedDB.js +0 -101
  98. package/dist/adapters/indexedDB.js.map +0 -1
  99. package/dist/adapters/localStorage.cjs +0 -50
  100. package/dist/adapters/localStorage.cjs.map +0 -1
  101. package/dist/adapters/localStorage.d.cts +0 -14
  102. package/dist/adapters/localStorage.d.ts +0 -14
  103. package/dist/adapters/localStorage.js +0 -48
  104. package/dist/adapters/localStorage.js.map +0 -1
  105. package/dist/chunk-3R476TDV.js.map +0 -1
  106. package/dist/chunk-43FKNLX4.cjs.map +0 -1
  107. package/dist/chunk-4PKLULWT.js.map +0 -1
  108. package/dist/chunk-5BLDMQED.cjs +0 -18
  109. package/dist/chunk-5BLDMQED.cjs.map +0 -1
  110. package/dist/chunk-GMZZQXV5.cjs.map +0 -1
  111. package/dist/chunk-ISO4TI5J.js.map +0 -1
  112. package/dist/chunk-JZWLXNHV.cjs.map +0 -1
  113. package/dist/chunk-NSBPE2FW.js +0 -15
  114. package/dist/chunk-NSBPE2FW.js.map +0 -1
  115. package/dist/chunk-NVZJSKZS.cjs.map +0 -1
  116. package/dist/chunk-ZRNQV6HV.js.map +0 -1
  117. package/dist/index-C0IanN1m.d.cts +0 -11
  118. package/dist/index-C0IanN1m.d.ts +0 -11
@@ -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';
@@ -7,7 +7,11 @@ import { TAP_LEAF_VERSION } from '@scure/btc-signer/payment.js';
7
7
  import { PSBTOutput } from '@scure/btc-signer/psbt.js';
8
8
  import { schnorr } from '@noble/curves/secp256k1.js';
9
9
 
10
- // src/utils/transaction.ts
10
+ var __defProp = Object.defineProperty;
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
11
15
  var Transaction = class extends Transaction$1 {
12
16
  static ARK_TX_OPTS = {
13
17
  allowUnknown: true,
@@ -1023,7 +1027,7 @@ function resolveEventSource(override) {
1023
1027
  }
1024
1028
 
1025
1029
  // package.json
1026
- var version = "0.5.0-rc.2";
1030
+ var version = "0.5.0-rc.4";
1027
1031
 
1028
1032
  // src/utils/fetch.ts
1029
1033
  var buildVersion = "0.9.9";
@@ -2267,60 +2271,23 @@ function parseWireExpiry(raw) {
2267
2271
  if (ms >= EXPIRY_MIN_PLAUSIBLE_MS) return { expiresAt: new Date(ms) };
2268
2272
  return { expiresAtHeight: n };
2269
2273
  }
2270
- function toBatchExpiry(c) {
2271
- if (c.expiresAt !== void 0) return c.expiresAt.getTime();
2272
- if (c.expiresAtHeight !== void 0) return c.expiresAtHeight * 1e3;
2273
- return void 0;
2274
- }
2275
- function parseLegacyExpiry(batchExpiry) {
2276
- if (batchExpiry === void 0 || batchExpiry <= 0) return {};
2277
- if (batchExpiry >= EXPIRY_MIN_PLAUSIBLE_MS) return { expiresAt: new Date(batchExpiry) };
2278
- return { expiresAtHeight: batchExpiry / 1e3 };
2279
- }
2280
- function toVirtualStatus(c) {
2281
- return {
2282
- // Precedence is load-bearing: consumers bucket on this label, so any other order silently
2283
- // moves VTXOs between buckets.
2284
- state: c.isSpent ? "spent" : c.isSwept ? "swept" : c.isPreconfirmed ? "preconfirmed" : "settled",
2285
- commitmentTxIds: c.commitmentTxIds,
2286
- batchExpiry: toBatchExpiry(c)
2287
- };
2288
- }
2289
2274
  function normalizeVtxo(v) {
2290
- const state = v.virtualStatus?.state;
2291
- const canonicalExpiry = v.expiresAt !== void 0 || v.expiresAtHeight !== void 0;
2292
- const expiry = canonicalExpiry ? (
2293
- // Coerce: a backend that persists through JSON hands back an ISO string, which typechecks
2294
- // as `Date` but returns NaN from `.getTime()` — comparing false against everything.
2295
- {
2296
- expiresAt: v.expiresAt === void 0 ? void 0 : new Date(v.expiresAt),
2297
- expiresAtHeight: v.expiresAtHeight
2298
- }
2299
- ) : parseLegacyExpiry(v.virtualStatus?.batchExpiry);
2300
- const isSpent = v.isSpent ?? state === "spent";
2301
- const isSwept = v.isSwept ?? state === "swept";
2302
- const isPreconfirmed = v.isPreconfirmed ?? state === "preconfirmed";
2303
- const commitmentTxIds = v.commitmentTxIds ?? v.virtualStatus?.commitmentTxIds ?? [];
2275
+ const expiry = {
2276
+ expiresAt: v.expiresAt === void 0 ? void 0 : new Date(v.expiresAt),
2277
+ expiresAtHeight: v.expiresAtHeight
2278
+ };
2304
2279
  return {
2305
2280
  ...v,
2306
- isSpent,
2307
- isSwept,
2308
- isPreconfirmed,
2281
+ isSpent: v.isSpent ?? false,
2282
+ isSwept: v.isSwept ?? false,
2283
+ isPreconfirmed: v.isPreconfirmed ?? false,
2309
2284
  spentBy: v.spentBy ?? "",
2310
- commitmentTxIds,
2311
- ...expiry,
2312
- virtualStatus: v.virtualStatus ?? toVirtualStatus({ isSpent, isSwept, isPreconfirmed, commitmentTxIds, ...expiry })
2285
+ commitmentTxIds: v.commitmentTxIds ?? [],
2286
+ ...expiry
2313
2287
  };
2314
2288
  }
2315
2289
  function convertVtxo(vtxo) {
2316
2290
  const expiry = parseWireExpiry(vtxo.expiresAt);
2317
- const facts = {
2318
- isSpent: vtxo.isSpent,
2319
- isSwept: vtxo.isSwept,
2320
- isPreconfirmed: vtxo.isPreconfirmed,
2321
- commitmentTxIds: vtxo.commitmentTxids,
2322
- ...expiry
2323
- };
2324
2291
  return {
2325
2292
  txid: vtxo.outpoint.txid,
2326
2293
  vout: vtxo.outpoint.vout,
@@ -2329,8 +2296,11 @@ function convertVtxo(vtxo) {
2329
2296
  confirmed: !vtxo.isSwept && !vtxo.isPreconfirmed,
2330
2297
  isLeaf: !vtxo.isPreconfirmed
2331
2298
  },
2332
- ...facts,
2333
- virtualStatus: toVirtualStatus(facts),
2299
+ isSpent: vtxo.isSpent,
2300
+ isSwept: vtxo.isSwept,
2301
+ isPreconfirmed: vtxo.isPreconfirmed,
2302
+ commitmentTxIds: vtxo.commitmentTxids,
2303
+ ...expiry,
2334
2304
  spentBy: vtxo.spentBy ?? "",
2335
2305
  settledBy: vtxo.settledBy,
2336
2306
  arkTxId: vtxo.arkTxid,
@@ -2410,30 +2380,18 @@ function canSweepOnchain(vtxo) {
2410
2380
  return !hasTerminalSpend(n) && !!n.isUnrolled;
2411
2381
  }
2412
2382
  function toOffchainInputFeeParams(vtxo) {
2413
- const batchExpiry = toBatchExpiry(vtxo);
2414
2383
  return {
2415
2384
  amount: BigInt(vtxo.value),
2416
2385
  type: vtxo.isSwept ? "recoverable" : "vtxo",
2417
2386
  weight: 0,
2418
2387
  birth: vtxo.createdAt,
2419
- expiry: batchExpiry ? new Date(batchExpiry) : void 0
2388
+ expiry: vtxo.expiresAt
2420
2389
  };
2421
2390
  }
2422
2391
  function isVirtualCoin(input) {
2423
2392
  return typeof input === "object" && input !== null && typeof input.script === "string";
2424
2393
  }
2425
- function isSpendable(vtxo) {
2426
- return !hasTerminalSpend(vtxo);
2427
- }
2428
- function isRecoverable(vtxo) {
2429
- const n = normalizeVtxo(vtxo);
2430
- return n.isSwept && !hasTerminalSpend(n);
2431
- }
2432
- function isExpired(vtxo) {
2433
- const n = normalizeVtxo(vtxo);
2434
- return n.isSwept || n.expiresAt !== void 0 && n.expiresAt.getTime() <= Date.now();
2435
- }
2436
2394
 
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-ISO4TI5J.js.map
2439
- //# sourceMappingURL=chunk-ISO4TI5J.js.map
2395
+ 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, EXPIRY_MIN_PLAUSIBLE_MS, 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, __export, 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, isFetchTimeoutError, isPastExpiry, isRetryableProviderError, isVirtualCoin, maybeArkError, networkFromArkadeInfo, networks, normalizeVtxo, rateGate, resolveEmulatorPubkey, resolveEventSource, resolveTimeHeight, scriptFromTapLeafScript, sdkVersion, sequenceToTimelock, setArkPsbtField, throwIfHttpUnavailable, timelockToSequence, toOffchainInputFeeParams, toProviderUnavailable };
2396
+ //# sourceMappingURL=chunk-GLZNJFAT.js.map
2397
+ //# sourceMappingURL=chunk-GLZNJFAT.js.map