@arkade-os/sdk 0.4.30 → 0.4.31

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 (53) hide show
  1. package/dist/adapters/expo.d.cts +2 -2
  2. package/dist/adapters/expo.d.ts +2 -2
  3. package/dist/adapters/indexedDB.cjs +2 -2
  4. package/dist/adapters/indexedDB.js +1 -1
  5. package/dist/{ark-C0TMXvwO.d.cts → ark-ibLW4Hte.d.cts} +1 -1
  6. package/dist/{ark-C0TMXvwO.d.ts → ark-ibLW4Hte.d.ts} +1 -1
  7. package/dist/{asyncStorageTaskQueue-Iip3xMF_.d.ts → asyncStorageTaskQueue-BEOFPNc0.d.ts} +1 -1
  8. package/dist/{asyncStorageTaskQueue-DHOoNvRy.d.cts → asyncStorageTaskQueue-VGHXWR9F.d.cts} +1 -1
  9. package/dist/{chunk-GRJKJNBO.js → chunk-AXGVYRAL.js} +3 -3
  10. package/dist/{chunk-GRJKJNBO.js.map → chunk-AXGVYRAL.js.map} +1 -1
  11. package/dist/{chunk-XWJFOP5G.cjs → chunk-GPZH5QNA.cjs} +38 -7
  12. package/dist/chunk-GPZH5QNA.cjs.map +1 -0
  13. package/dist/{chunk-6NY27WL6.js → chunk-HJM6JPG4.js} +38 -7
  14. package/dist/chunk-HJM6JPG4.js.map +1 -0
  15. package/dist/{chunk-PCEE6DRL.cjs → chunk-RN2OFLC3.cjs} +7 -7
  16. package/dist/{chunk-PCEE6DRL.cjs.map → chunk-RN2OFLC3.cjs.map} +1 -1
  17. package/dist/contracts/handlers/index.d.cts +3 -3
  18. package/dist/contracts/handlers/index.d.ts +3 -3
  19. package/dist/{delegate-Ds4Hi7Xy.d.ts → delegate-BXaR1RNG.d.ts} +1 -1
  20. package/dist/{delegate-CEk9RHVj.d.cts → delegate-BvNTw44a.d.cts} +1 -1
  21. package/dist/{index-DA9r_7Vg.d.ts → index-BusKawmy.d.ts} +2 -2
  22. package/dist/{index-WIAY0DDn.d.cts → index-C-5Tw7VA.d.cts} +2 -2
  23. package/dist/index.cjs +86 -86
  24. package/dist/index.d.cts +6 -6
  25. package/dist/index.d.ts +6 -6
  26. package/dist/index.js +1 -1
  27. package/dist/repositories/realm/index.cjs +10 -10
  28. package/dist/repositories/realm/index.d.cts +1 -1
  29. package/dist/repositories/realm/index.d.ts +1 -1
  30. package/dist/repositories/realm/index.js +1 -1
  31. package/dist/repositories/sqlite/index.cjs +10 -10
  32. package/dist/repositories/sqlite/index.d.cts +1 -1
  33. package/dist/repositories/sqlite/index.d.ts +1 -1
  34. package/dist/repositories/sqlite/index.js +1 -1
  35. package/dist/{taskRunner-JNjIWWJi.d.ts → taskRunner-B1igKGAo.d.ts} +1 -1
  36. package/dist/{taskRunner-CdEVYgoP.d.cts → taskRunner-By92TQ1m.d.cts} +1 -1
  37. package/dist/wallet/expo/background.cjs +8 -8
  38. package/dist/wallet/expo/background.d.cts +3 -3
  39. package/dist/wallet/expo/background.d.ts +3 -3
  40. package/dist/wallet/expo/background.js +2 -2
  41. package/dist/wallet/expo/index.cjs +9 -9
  42. package/dist/wallet/expo/index.d.cts +4 -4
  43. package/dist/wallet/expo/index.d.ts +4 -4
  44. package/dist/wallet/expo/index.js +2 -2
  45. package/dist/{wallet-CMgzKP0o.d.cts → wallet-B_rxgQTu.d.cts} +2 -2
  46. package/dist/{wallet-BGL6SzKQ.d.ts → wallet-CyM4F7Bs.d.ts} +2 -2
  47. package/dist/worker/expo/index.cjs +6 -6
  48. package/dist/worker/expo/index.d.cts +4 -4
  49. package/dist/worker/expo/index.d.ts +4 -4
  50. package/dist/worker/expo/index.js +2 -2
  51. package/package.json +1 -1
  52. package/dist/chunk-6NY27WL6.js.map +0 -1
  53. package/dist/chunk-XWJFOP5G.cjs.map +0 -1
@@ -2256,27 +2256,57 @@ function extendCoin(wallet, utxo) {
2256
2256
  tapTree: wallet.boardingTapscript.encode()
2257
2257
  };
2258
2258
  }
2259
- function extendVtxoFromContract(vtxo, contract) {
2259
+ function deriveContractTapscripts(contract) {
2260
2260
  const handler = contractHandlers.get(contract.type);
2261
2261
  if (!handler) {
2262
2262
  throw new Error(`No handler for contract type '${contract.type}'`);
2263
2263
  }
2264
2264
  const script = handler.createScript(contract.params);
2265
2265
  return {
2266
- ...vtxo,
2267
2266
  forfeitTapLeafScript: script.forfeit(),
2268
2267
  intentTapLeafScript: script.forfeit(),
2269
2268
  tapTree: script.encode()
2270
2269
  };
2271
2270
  }
2272
- function extendVirtualCoinForContract(vtxo, contractOrMap) {
2271
+ function cloneTapLeafScript([
2272
+ controlBlock,
2273
+ script
2274
+ ]) {
2275
+ return [
2276
+ {
2277
+ version: controlBlock.version,
2278
+ internalKey: new Uint8Array(controlBlock.internalKey),
2279
+ merklePath: controlBlock.merklePath.map((hash) => new Uint8Array(hash))
2280
+ },
2281
+ new Uint8Array(script)
2282
+ ];
2283
+ }
2284
+ function cloneContractTapscripts(tapscripts) {
2285
+ return {
2286
+ forfeitTapLeafScript: cloneTapLeafScript(tapscripts.forfeitTapLeafScript),
2287
+ intentTapLeafScript: cloneTapLeafScript(tapscripts.intentTapLeafScript),
2288
+ tapTree: new Uint8Array(tapscripts.tapTree)
2289
+ };
2290
+ }
2291
+ function extendVtxoFromContract(vtxo, contract, cache) {
2292
+ if (!cache) {
2293
+ return { ...vtxo, ...deriveContractTapscripts(contract) };
2294
+ }
2295
+ let tapscripts = cache.get(contract.script);
2296
+ if (!tapscripts) {
2297
+ tapscripts = deriveContractTapscripts(contract);
2298
+ cache.set(contract.script, tapscripts);
2299
+ }
2300
+ return { ...vtxo, ...cloneContractTapscripts(tapscripts) };
2301
+ }
2302
+ function extendVirtualCoinForContract(vtxo, contractOrMap, cache) {
2273
2303
  const contract = resolveContract(vtxo, contractOrMap);
2274
2304
  if (!contract) {
2275
2305
  throw new Error(
2276
2306
  "extendVirtualCoinForContract: no contract matched vtxo.script \u2014 callers must resolve the owning contract before annotating"
2277
2307
  );
2278
2308
  }
2279
- return extendVtxoFromContract(vtxo, contract);
2309
+ return extendVtxoFromContract(vtxo, contract, cache);
2280
2310
  }
2281
2311
  function isContractMap(value) {
2282
2312
  return typeof value.get === "function";
@@ -6689,7 +6719,8 @@ var ContractManager = class _ContractManager {
6689
6719
  for (const contract of contracts) {
6690
6720
  byScript.set(contract.script, contract);
6691
6721
  }
6692
- return vtxos.map((vtxo) => extendVirtualCoinForContract(vtxo, byScript));
6722
+ const tapscriptCache = /* @__PURE__ */ new Map();
6723
+ return vtxos.map((vtxo) => extendVirtualCoinForContract(vtxo, byScript, tapscriptCache));
6693
6724
  }
6694
6725
  buildContractsDbFilter(filter) {
6695
6726
  return {
@@ -13959,5 +13990,5 @@ function isArkContract(str) {
13959
13990
  }
13960
13991
 
13961
13992
  export { ArkNote, AssetManager, BIP322, Batch, ContractManager, ContractRepositoryImpl, ContractWatcher, DB_VERSION, DEFAULT_MESSAGE_TIMEOUTS, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EsploraProvider, Estimator, HDDescriptorProvider, InMemoryContractRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBWalletRepository, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, Unroll, VtxoManager, Wallet2 as Wallet, WalletMessageHandler, WalletNotInitializedError, WalletRepositoryImpl, WsElectrumChainSource, buildForfeitTx, buildOffchainTx, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, decodeArkContract, deserializeAssets, deserializeUtxo, deserializeVtxo, encodeArkContract, extendVirtualCoinForContract, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isBatchSignable, isDiscoverable, isExpired, isRecoverable, isSpendable, isSubdust, isValidArkAddress, isVtxoExpiringSoon, isVtxoForScript, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, saveVtxosForContract, scriptFromArkAddress, serializeAssets, serializeUtxo, serializeVtxo, setupServiceWorker, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, warnAndFilterVtxosForScript };
13962
- //# sourceMappingURL=chunk-6NY27WL6.js.map
13963
- //# sourceMappingURL=chunk-6NY27WL6.js.map
13993
+ //# sourceMappingURL=chunk-HJM6JPG4.js.map
13994
+ //# sourceMappingURL=chunk-HJM6JPG4.js.map