@anuma/sdk 10.4.2 → 10.5.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.
@@ -15203,6 +15203,7 @@ function notifyKeyAvailable(address) {
15203
15203
  }
15204
15204
  }
15205
15205
  var keyPairStore = /* @__PURE__ */ new Map();
15206
+ var pendingKeyPairRequests = /* @__PURE__ */ new Map();
15206
15207
  function getStoredKeyByVersion(address, version) {
15207
15208
  const keys = encryptionKeyStore.get(address);
15208
15209
  if (!keys) return null;
@@ -15225,6 +15226,7 @@ function clearAllEncryptionState() {
15225
15226
  cryptoKeyCache.clear();
15226
15227
  keyAvailableCallbacks.clear();
15227
15228
  pendingKeyRequests.clear();
15229
+ pendingKeyPairRequests.clear();
15228
15230
  pendingCandidateDerives.clear();
15229
15231
  refreshCandidatesByAddress.clear();
15230
15232
  divergentDeriveAddresses.clear();
@@ -15892,6 +15894,21 @@ async function requestKeyPair(walletAddress, signMessage, embeddedWalletSigner)
15892
15894
  if (existingKeyPair) {
15893
15895
  return;
15894
15896
  }
15897
+ const pending = pendingKeyPairRequests.get(walletAddress);
15898
+ if (pending) {
15899
+ return pending;
15900
+ }
15901
+ const promise = loadOrCreateKeyPair(walletAddress, signMessage, embeddedWalletSigner);
15902
+ pendingKeyPairRequests.set(walletAddress, promise);
15903
+ try {
15904
+ await promise;
15905
+ } finally {
15906
+ if (pendingKeyPairRequests.get(walletAddress) === promise) {
15907
+ pendingKeyPairRequests.delete(walletAddress);
15908
+ }
15909
+ }
15910
+ }
15911
+ async function loadOrCreateKeyPair(walletAddress, signMessage, embeddedWalletSigner) {
15895
15912
  const startEpoch = sessionEpoch;
15896
15913
  try {
15897
15914
  const persistedKeyPair = await loadPersistedKeyPair(walletAddress);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "10.4.2",
3
+ "version": "10.5.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",