@dynamic-labs/wallet-connect 4.93.0 → 4.93.1

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/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ ### [4.93.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.93.0...v4.93.1) (2026-07-22)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * **wallet-connect:** recover WalletConnect IndexedDB store when object store is missing ([#12048](https://github.com/dynamic-labs/dynamic-auth/issues/12048)) ([#12052](https://github.com/dynamic-labs/dynamic-auth/issues/12052)) ([48286d2](https://github.com/dynamic-labs/dynamic-auth/commit/48286d2beecb11ebe53489a25b83fbf73c9dd5f1))
8
+
2
9
  ## [4.93.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.92.4...v4.93.0) (2026-07-20)
3
10
 
4
11
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.93.0";
6
+ var version = "4.93.1";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.93.0";
2
+ var version = "4.93.1";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/wallet-connect",
3
- "version": "4.93.0",
3
+ "version": "4.93.1",
4
4
  "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -18,9 +18,9 @@
18
18
  },
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
- "@dynamic-labs/logger": "4.93.0",
21
+ "@dynamic-labs/logger": "4.93.1",
22
22
  "@walletconnect/sign-client": "2.21.5",
23
- "@dynamic-labs/assert-package-version": "4.93.0"
23
+ "@dynamic-labs/assert-package-version": "4.93.1"
24
24
  },
25
25
  "peerDependencies": {}
26
26
  }
@@ -0,0 +1,101 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../_virtual/_tslib.cjs');
7
+
8
+ // WalletConnect persists its pairing and session data in this IndexedDB
9
+ // database and object store (see the browser build of
10
+ // @walletconnect/keyvaluestorage). We reference them here so we can repair a
11
+ // missing object store before SignClient opens the connection.
12
+ const WALLET_CONNECT_DB_NAME = 'WALLET_CONNECT_V2_INDEXED_DB';
13
+ const WALLET_CONNECT_STORE_NAME = 'keyvaluestorage';
14
+ // WalletConnect's storage uses an out-of-line object store (idb-keyval's
15
+ // createObjectStore with no keyPath). We must recreate it with the same shape
16
+ // so WalletConnect keeps reading and writing it exactly as before.
17
+ const createStoreIfMissing = (db) => {
18
+ if (!db.objectStoreNames.contains(WALLET_CONNECT_STORE_NAME)) {
19
+ db.createObjectStore(WALLET_CONNECT_STORE_NAME);
20
+ }
21
+ };
22
+ const openConnection = (version) => new Promise((resolve, reject) => {
23
+ const shouldUseCurrentVersion = version === undefined;
24
+ let request;
25
+ if (shouldUseCurrentVersion) {
26
+ request = indexedDB.open(WALLET_CONNECT_DB_NAME);
27
+ }
28
+ else {
29
+ request = indexedDB.open(WALLET_CONNECT_DB_NAME, version);
30
+ }
31
+ // A blocked upgrade rejects the promise, but the open request stays live: if
32
+ // the blocking connection later closes, onsuccess still fires with a real
33
+ // database. We track settlement so that a late success closes that database
34
+ // instead of leaking the connection for the life of the page. A late error
35
+ // or blocked event just rejects an already-settled promise, which is a no-op.
36
+ let hasSettled = false;
37
+ request.onupgradeneeded = () => createStoreIfMissing(request.result);
38
+ request.onsuccess = () => {
39
+ if (hasSettled) {
40
+ request.result.close();
41
+ return;
42
+ }
43
+ hasSettled = true;
44
+ resolve(request.result);
45
+ };
46
+ request.onerror = () => {
47
+ hasSettled = true;
48
+ reject(new Error('Failed to open WalletConnect IndexedDB'));
49
+ };
50
+ // A version-bump upgrade is blocked when another connection (another tab, or
51
+ // WalletConnect's own cached idb-keyval connection) still holds the database
52
+ // open. IndexedDB then fires neither success nor error, so we reject to keep
53
+ // the promise from hanging; the caller swallows it and lets SignClient.init
54
+ // proceed exactly as it would without this repair step.
55
+ request.onblocked = () => {
56
+ hasSettled = true;
57
+ reject(new Error('WalletConnect IndexedDB store upgrade was blocked by another open connection'));
58
+ };
59
+ });
60
+ const repairMissingStore = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
61
+ const db = yield openConnection();
62
+ const hasStore = db.objectStoreNames.contains(WALLET_CONNECT_STORE_NAME);
63
+ const currentVersion = db.version;
64
+ db.close();
65
+ if (hasStore) {
66
+ return;
67
+ }
68
+ // Reopening at the same version won't re-run onupgradeneeded, so the store
69
+ // would stay missing. Bumping the version triggers an upgrade that recreates
70
+ // only the missing store, leaving any other stored data intact.
71
+ const upgradedDb = yield openConnection(currentVersion + 1);
72
+ upgradedDb.close();
73
+ });
74
+ /**
75
+ * Ensures WalletConnect's IndexedDB object store exists before SignClient opens
76
+ * the connection. On iOS WebKit an upgrade interrupted by a webview reload can
77
+ * leave the `WALLET_CONNECT_V2_INDEXED_DB` database committed at its version
78
+ * with the object store never created; every subsequent WalletConnect read or
79
+ * write then throws NotFoundError ("one of the specified object stores was not
80
+ * found") until the store is recreated.
81
+ *
82
+ * The store is recreated with a version bump — the database is never deleted,
83
+ * so no session data is lost. This is a best-effort no-op for healthy databases
84
+ * and for environments without IndexedDB (SSR, React Native), so it cannot
85
+ * regress the default WalletConnect behaviour: on any failure SignClient.init
86
+ * proceeds exactly as it would without this step.
87
+ */
88
+ const ensureWalletConnectStore = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
89
+ if (typeof indexedDB === 'undefined') {
90
+ return;
91
+ }
92
+ try {
93
+ yield repairMissingStore();
94
+ }
95
+ catch (_a) {
96
+ // Best-effort pre-flight repair. Swallowing lets SignClient.init proceed as
97
+ // it would without this step, so WalletConnect is never left worse off.
98
+ }
99
+ });
100
+
101
+ exports.ensureWalletConnectStore = ensureWalletConnectStore;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Ensures WalletConnect's IndexedDB object store exists before SignClient opens
3
+ * the connection. On iOS WebKit an upgrade interrupted by a webview reload can
4
+ * leave the `WALLET_CONNECT_V2_INDEXED_DB` database committed at its version
5
+ * with the object store never created; every subsequent WalletConnect read or
6
+ * write then throws NotFoundError ("one of the specified object stores was not
7
+ * found") until the store is recreated.
8
+ *
9
+ * The store is recreated with a version bump — the database is never deleted,
10
+ * so no session data is lost. This is a best-effort no-op for healthy databases
11
+ * and for environments without IndexedDB (SSR, React Native), so it cannot
12
+ * regress the default WalletConnect behaviour: on any failure SignClient.init
13
+ * proceeds exactly as it would without this step.
14
+ */
15
+ export declare const ensureWalletConnectStore: () => Promise<void>;
@@ -0,0 +1,97 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../_virtual/_tslib.js';
3
+
4
+ // WalletConnect persists its pairing and session data in this IndexedDB
5
+ // database and object store (see the browser build of
6
+ // @walletconnect/keyvaluestorage). We reference them here so we can repair a
7
+ // missing object store before SignClient opens the connection.
8
+ const WALLET_CONNECT_DB_NAME = 'WALLET_CONNECT_V2_INDEXED_DB';
9
+ const WALLET_CONNECT_STORE_NAME = 'keyvaluestorage';
10
+ // WalletConnect's storage uses an out-of-line object store (idb-keyval's
11
+ // createObjectStore with no keyPath). We must recreate it with the same shape
12
+ // so WalletConnect keeps reading and writing it exactly as before.
13
+ const createStoreIfMissing = (db) => {
14
+ if (!db.objectStoreNames.contains(WALLET_CONNECT_STORE_NAME)) {
15
+ db.createObjectStore(WALLET_CONNECT_STORE_NAME);
16
+ }
17
+ };
18
+ const openConnection = (version) => new Promise((resolve, reject) => {
19
+ const shouldUseCurrentVersion = version === undefined;
20
+ let request;
21
+ if (shouldUseCurrentVersion) {
22
+ request = indexedDB.open(WALLET_CONNECT_DB_NAME);
23
+ }
24
+ else {
25
+ request = indexedDB.open(WALLET_CONNECT_DB_NAME, version);
26
+ }
27
+ // A blocked upgrade rejects the promise, but the open request stays live: if
28
+ // the blocking connection later closes, onsuccess still fires with a real
29
+ // database. We track settlement so that a late success closes that database
30
+ // instead of leaking the connection for the life of the page. A late error
31
+ // or blocked event just rejects an already-settled promise, which is a no-op.
32
+ let hasSettled = false;
33
+ request.onupgradeneeded = () => createStoreIfMissing(request.result);
34
+ request.onsuccess = () => {
35
+ if (hasSettled) {
36
+ request.result.close();
37
+ return;
38
+ }
39
+ hasSettled = true;
40
+ resolve(request.result);
41
+ };
42
+ request.onerror = () => {
43
+ hasSettled = true;
44
+ reject(new Error('Failed to open WalletConnect IndexedDB'));
45
+ };
46
+ // A version-bump upgrade is blocked when another connection (another tab, or
47
+ // WalletConnect's own cached idb-keyval connection) still holds the database
48
+ // open. IndexedDB then fires neither success nor error, so we reject to keep
49
+ // the promise from hanging; the caller swallows it and lets SignClient.init
50
+ // proceed exactly as it would without this repair step.
51
+ request.onblocked = () => {
52
+ hasSettled = true;
53
+ reject(new Error('WalletConnect IndexedDB store upgrade was blocked by another open connection'));
54
+ };
55
+ });
56
+ const repairMissingStore = () => __awaiter(void 0, void 0, void 0, function* () {
57
+ const db = yield openConnection();
58
+ const hasStore = db.objectStoreNames.contains(WALLET_CONNECT_STORE_NAME);
59
+ const currentVersion = db.version;
60
+ db.close();
61
+ if (hasStore) {
62
+ return;
63
+ }
64
+ // Reopening at the same version won't re-run onupgradeneeded, so the store
65
+ // would stay missing. Bumping the version triggers an upgrade that recreates
66
+ // only the missing store, leaving any other stored data intact.
67
+ const upgradedDb = yield openConnection(currentVersion + 1);
68
+ upgradedDb.close();
69
+ });
70
+ /**
71
+ * Ensures WalletConnect's IndexedDB object store exists before SignClient opens
72
+ * the connection. On iOS WebKit an upgrade interrupted by a webview reload can
73
+ * leave the `WALLET_CONNECT_V2_INDEXED_DB` database committed at its version
74
+ * with the object store never created; every subsequent WalletConnect read or
75
+ * write then throws NotFoundError ("one of the specified object stores was not
76
+ * found") until the store is recreated.
77
+ *
78
+ * The store is recreated with a version bump — the database is never deleted,
79
+ * so no session data is lost. This is a best-effort no-op for healthy databases
80
+ * and for environments without IndexedDB (SSR, React Native), so it cannot
81
+ * regress the default WalletConnect behaviour: on any failure SignClient.init
82
+ * proceeds exactly as it would without this step.
83
+ */
84
+ const ensureWalletConnectStore = () => __awaiter(void 0, void 0, void 0, function* () {
85
+ if (typeof indexedDB === 'undefined') {
86
+ return;
87
+ }
88
+ try {
89
+ yield repairMissingStore();
90
+ }
91
+ catch (_a) {
92
+ // Best-effort pre-flight repair. Swallowing lets SignClient.init proceed as
93
+ // it would without this step, so WalletConnect is never left worse off.
94
+ }
95
+ });
96
+
97
+ export { ensureWalletConnectStore };
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../_virtual/_tslib.cjs');
7
7
  var SignClient = require('@walletconnect/sign-client');
8
+ var ensureWalletConnectStore = require('./ensureWalletConnectStore.cjs');
8
9
  var reconcileOrphanedPairings = require('./reconcileOrphanedPairings.cjs');
9
10
 
10
11
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -21,6 +22,10 @@ let signClientSingleton = undefined;
21
22
  const getSignClientSingleton = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ projectId, appIcon, appName, redirectUrl, }) {
22
23
  if (!signClientSingleton) {
23
24
  const redirect = redirectUrl ? { native: redirectUrl } : undefined;
25
+ // Repair WalletConnect's IndexedDB object store before SignClient opens it,
26
+ // so an interrupted upgrade (iOS WebKit reload) that left the store missing
27
+ // can't make every subsequent read/write throw NotFoundError.
28
+ yield ensureWalletConnectStore.ensureWalletConnectStore();
24
29
  signClientSingleton = yield SignClient__default["default"].init({
25
30
  customStoragePrefix: `dynamicauth_${projectId}_walletconnect`,
26
31
  metadata: {
@@ -1,6 +1,7 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../_virtual/_tslib.js';
3
3
  import SignClient from '@walletconnect/sign-client';
4
+ import { ensureWalletConnectStore } from './ensureWalletConnectStore.js';
4
5
  import { reconcileOrphanedPairings } from './reconcileOrphanedPairings.js';
5
6
 
6
7
  /**
@@ -13,6 +14,10 @@ let signClientSingleton = undefined;
13
14
  const getSignClientSingleton = (_a) => __awaiter(void 0, [_a], void 0, function* ({ projectId, appIcon, appName, redirectUrl, }) {
14
15
  if (!signClientSingleton) {
15
16
  const redirect = redirectUrl ? { native: redirectUrl } : undefined;
17
+ // Repair WalletConnect's IndexedDB object store before SignClient opens it,
18
+ // so an interrupted upgrade (iOS WebKit reload) that left the store missing
19
+ // can't make every subsequent read/write throw NotFoundError.
20
+ yield ensureWalletConnectStore();
16
21
  signClientSingleton = yield SignClient.init({
17
22
  customStoragePrefix: `dynamicauth_${projectId}_walletconnect`,
18
23
  metadata: {