@arkade-os/sdk 0.4.66 → 0.4.67

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 (80) hide show
  1. package/README.md +66 -15
  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-BZcIN7sA.d.cts → asyncStorageTaskQueue-LTpeXYaD.d.cts} +2 -2
  9. package/dist/{asyncStorageTaskQueue-B6SijMi3.d.ts → asyncStorageTaskQueue-Za-e_zMk.d.ts} +2 -2
  10. package/dist/{chunk-ZIRFXBKL.cjs → chunk-2JV4VQ7C.cjs} +33 -13
  11. package/dist/chunk-2JV4VQ7C.cjs.map +1 -0
  12. package/dist/{chunk-J33ZEM3A.js → chunk-3WIWNE4P.js} +33 -14
  13. package/dist/chunk-3WIWNE4P.js.map +1 -0
  14. package/dist/{chunk-CYOI4PEA.js → chunk-6TAQF6EV.js} +107 -13
  15. package/dist/chunk-6TAQF6EV.js.map +1 -0
  16. package/dist/{chunk-DSC3G6QZ.js → chunk-AEWJU6NZ.js} +1006 -167
  17. package/dist/chunk-AEWJU6NZ.js.map +1 -0
  18. package/dist/{chunk-3S3JZUEN.cjs → chunk-CO3KKSWM.cjs} +17 -17
  19. package/dist/{chunk-3S3JZUEN.cjs.map → chunk-CO3KKSWM.cjs.map} +1 -1
  20. package/dist/{chunk-55ZZ6RBL.js → chunk-EALWOVHK.js} +4 -4
  21. package/dist/{chunk-55ZZ6RBL.js.map → chunk-EALWOVHK.js.map} +1 -1
  22. package/dist/{chunk-5E6IZNRG.cjs → chunk-MJUTO3PY.cjs} +1413 -563
  23. package/dist/chunk-MJUTO3PY.cjs.map +1 -0
  24. package/dist/{chunk-R5POS3RS.js → chunk-MZFUZUTQ.js} +4 -4
  25. package/dist/{chunk-R5POS3RS.js.map → chunk-MZFUZUTQ.js.map} +1 -1
  26. package/dist/{chunk-PXPPZF5K.cjs → chunk-OIZ2V2VD.cjs} +152 -58
  27. package/dist/chunk-OIZ2V2VD.cjs.map +1 -0
  28. package/dist/{chunk-IM6IKNSL.cjs → chunk-R2YAMONM.cjs} +17 -17
  29. package/dist/{chunk-IM6IKNSL.cjs.map → chunk-R2YAMONM.cjs.map} +1 -1
  30. package/dist/{chunk-2JZGPXU4.js → chunk-X3VEMUVV.js} +3 -3
  31. package/dist/{chunk-2JZGPXU4.js.map → chunk-X3VEMUVV.js.map} +1 -1
  32. package/dist/{chunk-LL47QIHD.cjs → chunk-YDRZDZPP.cjs} +10 -10
  33. package/dist/{chunk-LL47QIHD.cjs.map → chunk-YDRZDZPP.cjs.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-YXupcWWJ.d.cts → delegate-Bz2e2zXY.d.cts} +1 -1
  39. package/dist/{delegate-T-vgxMYZ.d.ts → delegate-cdmzb2f9.d.ts} +1 -1
  40. package/dist/{wallet-CNibc3yJ.d.ts → hdWalletCapable-BSjuUYOO.d.cts} +318 -127
  41. package/dist/{wallet-DJN1QgFt.d.cts → hdWalletCapable-Hi12xjCJ.d.ts} +318 -127
  42. package/dist/{index-e7LYXk1d.d.cts → index-BiACuWaf.d.ts} +109 -13
  43. package/dist/{index-D_FgwLH9.d.ts → index-D2GjZxBr.d.cts} +109 -13
  44. package/dist/{index-uUE_uQPn.d.ts → index-DU5o_hz7.d.cts} +206 -19
  45. package/dist/{index-uUE_uQPn.d.cts → index-DU5o_hz7.d.ts} +206 -19
  46. package/dist/index.cjs +322 -278
  47. package/dist/index.d.cts +291 -41
  48. package/dist/index.d.ts +291 -41
  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-BOVcIH1N.d.cts → taskRunner-BZJMLQ6g.d.cts} +2 -2
  59. package/dist/{taskRunner-DNyD1kXG.d.ts → taskRunner-DATaRQus.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 +18 -14
  65. package/dist/wallet/expo/index.cjs.map +1 -1
  66. package/dist/wallet/expo/index.d.cts +7 -5
  67. package/dist/wallet/expo/index.d.ts +7 -5
  68. package/dist/wallet/expo/index.js +10 -6
  69. package/dist/wallet/expo/index.js.map +1 -1
  70. package/dist/worker/expo/index.cjs +9 -9
  71. package/dist/worker/expo/index.d.cts +4 -4
  72. package/dist/worker/expo/index.d.ts +4 -4
  73. package/dist/worker/expo/index.js +5 -5
  74. package/package.json +3 -3
  75. package/dist/chunk-5E6IZNRG.cjs.map +0 -1
  76. package/dist/chunk-CYOI4PEA.js.map +0 -1
  77. package/dist/chunk-DSC3G6QZ.js.map +0 -1
  78. package/dist/chunk-J33ZEM3A.js.map +0 -1
  79. package/dist/chunk-PXPPZF5K.cjs.map +0 -1
  80. package/dist/chunk-ZIRFXBKL.cjs.map +0 -1
@@ -1010,7 +1010,7 @@ function resolveEventSource(override) {
1010
1010
  }
1011
1011
 
1012
1012
  // package.json
1013
- var version = "0.4.66";
1013
+ var version = "0.4.67";
1014
1014
 
1015
1015
  // src/utils/fetch.ts
1016
1016
  var buildVersion = "0.9.9";
@@ -1327,6 +1327,9 @@ function prepareCoinAsIntentProofInput(coin) {
1327
1327
  if (coin.extraWitness) {
1328
1328
  unknown.push(ConditionWitness.encode(coin.extraWitness));
1329
1329
  }
1330
+ if (coin.prevTx) {
1331
+ unknown.push(PrevArkTxField.encode(coin.prevTx));
1332
+ }
1330
1333
  return {
1331
1334
  txid: hex.decode(coin.txid),
1332
1335
  index: coin.vout,
@@ -1605,17 +1608,17 @@ var RestArkProvider = class {
1605
1608
  /** Overrides {@link configureEventSource} for this provider's streams. */
1606
1609
  eventSource;
1607
1610
  /**
1608
- * Last server-info digest seen (from {@link getInfo}). Sent as `X-Digest`
1609
- * on outgoing requests so arkd can reject a client whose cached info is
1610
- * stale. Empty until the first {@link getInfo}.
1611
+ * Last server-info digest seen from {@link getInfo}. Sent as `X-Digest`
1612
+ * so arkd can reject stale client configuration.
1611
1613
  */
1612
1614
  _digest = "";
1615
+ _hasServerInfo = false;
1616
+ _suppressNextGetInfoChangeEmit = false;
1613
1617
  _serverInfoListeners = /* @__PURE__ */ new Set();
1614
1618
  /**
1615
- * Subscribe to server-info changes. Fired when a request is rejected with
1616
- * `DIGEST_MISMATCH` and fresh info is re-fetched, so consumers (the wallet)
1617
- * can re-derive signer-dependent state mid-session without polling. Returns
1618
- * an unsubscribe function.
1619
+ * Subscribe to server-info changes. Fired after a stale-info
1620
+ * `DIGEST_MISMATCH` refresh or when {@link getInfo} observes a changed digest.
1621
+ * Returns an unsubscribe function.
1619
1622
  */
1620
1623
  onServerInfoChanged(listener) {
1621
1624
  this._serverInfoListeners.add(listener);
@@ -1670,7 +1673,13 @@ var RestArkProvider = class {
1670
1673
  if (!arkError) throwIfHttpUnavailable(response, "arkade");
1671
1674
  if (!isArkError(arkError, ArkErrorName.DIGEST_MISMATCH)) return response;
1672
1675
  this._digest = "";
1673
- const info = await this.getInfo();
1676
+ this._suppressNextGetInfoChangeEmit = true;
1677
+ let info;
1678
+ try {
1679
+ info = await this.getInfo();
1680
+ } finally {
1681
+ this._suppressNextGetInfoChangeEmit = false;
1682
+ }
1674
1683
  this.emitServerInfoChanged(info);
1675
1684
  throw new DigestMismatchError(
1676
1685
  "Arkade server reported a configuration digest mismatch; server info was refreshed. Rebuild and retry the request under the new server info."
@@ -1727,7 +1736,13 @@ var RestArkProvider = class {
1727
1736
  vtxoMaxAmount: BigInt(fromServer.vtxoMaxAmount ?? -1),
1728
1737
  vtxoMinAmount: BigInt(fromServer.vtxoMinAmount ?? 0)
1729
1738
  };
1739
+ const previousDigest = this._digest;
1740
+ const hadServerInfo = this._hasServerInfo;
1730
1741
  this._digest = info.digest;
1742
+ this._hasServerInfo = true;
1743
+ if (hadServerInfo && previousDigest !== info.digest && !this._suppressNextGetInfoChangeEmit) {
1744
+ this.emitServerInfoChanged(info);
1745
+ }
1731
1746
  return info;
1732
1747
  }
1733
1748
  async submitTx(signedArkTx, checkpointTxs) {
@@ -2362,11 +2377,15 @@ function isPastExpiry(vtxo, now) {
2362
2377
  }
2363
2378
  function canSpendOffchain(vtxo, now) {
2364
2379
  const n = normalizeVtxo(vtxo);
2365
- return !hasTerminalSpend(n) && !(n.isSwept || isPastExpiry(n, now));
2380
+ return !hasTerminalSpend(n) && !n.isUnrolled && !(n.isSwept || isPastExpiry(n, now));
2366
2381
  }
2367
2382
  function canRecoverOnchain(vtxo, now) {
2368
2383
  const n = normalizeVtxo(vtxo);
2369
- return !hasTerminalSpend(n) && (n.isSwept || isPastExpiry(n, now));
2384
+ return !hasTerminalSpend(n) && !n.isUnrolled && (n.isSwept || isPastExpiry(n, now));
2385
+ }
2386
+ function canSweepOnchain(vtxo) {
2387
+ const n = normalizeVtxo(vtxo);
2388
+ return !hasTerminalSpend(n) && !!n.isUnrolled;
2370
2389
  }
2371
2390
  function toOffchainInputFeeParams(vtxo) {
2372
2391
  const batchExpiry = toBatchExpiry(vtxo);
@@ -2393,6 +2412,6 @@ function isExpired(vtxo) {
2393
2412
  return n.isSwept || n.expiresAt !== void 0 && n.expiresAt.getTime() <= Date.now();
2394
2413
  }
2395
2414
 
2396
- 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, 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, baseFetch, buildVersion, canRecoverOnchain, canSpendOffchain, configureEventSource, convertVtxo, craftToSpendTx, decodeTapscript, defaultEmulatorPubkey, eventSourceIterator, fetch, fetchVtxoCreatedAtByTxid, getAllNormalizedVtxos, getArkPsbtFields, getConfiguredEventSource, getNetwork, getNormalizedVtxos, getSequence, hasTerminalSpend, isArkError, isEventSourceError, isEventSourceUnavailableError, isExpired, isFetchTimeoutError, isPastExpiry, isRecoverable, isRetryableProviderError, isSpendable, isVirtualCoin, maybeArkError, networks, normalizeVtxo, parseLegacyExpiry, rateGate, resolveEmulatorPubkey, resolveEventSource, resolveTimeHeight, scriptFromTapLeafScript, sdkVersion, sequenceToTimelock, setArkPsbtField, throwIfHttpUnavailable, timelockToSequence, toBatchExpiry, toOffchainInputFeeParams, toProviderUnavailable, toVirtualStatus };
2397
- //# sourceMappingURL=chunk-J33ZEM3A.js.map
2398
- //# sourceMappingURL=chunk-J33ZEM3A.js.map
2415
+ 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, 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, baseFetch, buildVersion, canRecoverOnchain, canSpendOffchain, canSweepOnchain, configureEventSource, convertVtxo, craftToSpendTx, decodeTapscript, defaultEmulatorPubkey, eventSourceIterator, fetch, fetchVtxoCreatedAtByTxid, getAllNormalizedVtxos, getArkPsbtFields, getConfiguredEventSource, getNetwork, getNormalizedVtxos, getSequence, hasTerminalSpend, isArkError, isEventSourceError, isEventSourceUnavailableError, isExpired, isFetchTimeoutError, isPastExpiry, isRecoverable, isRetryableProviderError, isSpendable, isVirtualCoin, maybeArkError, networks, normalizeVtxo, parseLegacyExpiry, rateGate, resolveEmulatorPubkey, resolveEventSource, resolveTimeHeight, scriptFromTapLeafScript, sdkVersion, sequenceToTimelock, setArkPsbtField, throwIfHttpUnavailable, timelockToSequence, toBatchExpiry, toOffchainInputFeeParams, toProviderUnavailable, toVirtualStatus };
2416
+ //# sourceMappingURL=chunk-3WIWNE4P.js.map
2417
+ //# sourceMappingURL=chunk-3WIWNE4P.js.map