@tinycloud/node-sdk 2.9.0 → 2.10.0-beta.0

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.
package/dist/core.cjs CHANGED
@@ -3888,6 +3888,7 @@ var _TinyCloudNode = class _TinyCloudNode {
3888
3888
  const address = binding?.address ?? this._address;
3889
3889
  const chainId = binding?.chainId ?? this._chainId;
3890
3890
  const crypto = this.createEncryptionCrypto();
3891
+ const descriptorCache = /* @__PURE__ */ new Map();
3891
3892
  const transport = {
3892
3893
  postDecrypt: async ({ networkId, authorization, canonicalBody, signal }) => {
3893
3894
  graph.assertActive();
@@ -3944,7 +3945,18 @@ var _TinyCloudNode = class _TinyCloudNode {
3944
3945
  node: {
3945
3946
  fetchByNetworkId: async (networkId) => {
3946
3947
  graph.assertActive();
3947
- const descriptor = await this.fetchEncryptionNetworkAt(host, networkId, graph.fetch);
3948
+ let pending = descriptorCache.get(networkId);
3949
+ if (!pending) {
3950
+ pending = this.fetchEncryptionNetworkAt(host, networkId, graph.fetch).then((descriptor2) => {
3951
+ if (descriptor2 === null) descriptorCache.delete(networkId);
3952
+ return descriptor2;
3953
+ }).catch((error) => {
3954
+ descriptorCache.delete(networkId);
3955
+ throw error;
3956
+ });
3957
+ descriptorCache.set(networkId, pending);
3958
+ }
3959
+ const descriptor = await pending;
3948
3960
  graph.assertActive();
3949
3961
  return descriptor;
3950
3962
  }