@dynamic-labs/wallet-connect 5.0.0-rc.3 → 5.0.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/CHANGELOG.md +80 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +3 -3
- package/src/getSignClientSingleton/ensureWalletConnectStore.cjs +101 -0
- package/src/getSignClientSingleton/ensureWalletConnectStore.d.ts +15 -0
- package/src/getSignClientSingleton/ensureWalletConnectStore.js +97 -0
- package/src/getSignClientSingleton/getSignClientSingleton.cjs +5 -0
- package/src/getSignClientSingleton/getSignClientSingleton.js +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,84 @@
|
|
|
1
1
|
|
|
2
|
+
## [5.0.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.0.0-rc.4...v5.0.0) (2026-07-29)
|
|
3
|
+
|
|
4
|
+
## 🚀 Dynamic SDK v5 is live
|
|
5
|
+
|
|
6
|
+
This release has been a long time coming. We've cleaned up the architecture, cut support for v1 and v2 embedded wallets from core, shipped a migration path for legacy wallets, and made the SDK story a lot cleaner for both web and mobile devs.
|
|
7
|
+
|
|
8
|
+
### 🔥 Embedded Wallet clean up
|
|
9
|
+
|
|
10
|
+
V1/V2 embedded wallets support has been removed from `@dynamic-labs/sdk-react-core`. Dynamic WaaS (V3) is now the one and only embedded wallet type, all new embedded wallets are V3.
|
|
11
|
+
|
|
12
|
+
### 📦 New: `@dynamic-labs/legacy-embedded-wallet-migration`
|
|
13
|
+
|
|
14
|
+
For users still on V1/V2 embedded wallets, we've got you covered with a dedicated migration package. It owns all the logic for upgrading to V3. This includes recovery flow, session keys, private key export, and the migration UI.
|
|
15
|
+
|
|
16
|
+
Two paths available:
|
|
17
|
+
|
|
18
|
+
- **UI-based** (recommended): Mount `LegacyWalletMigrationProvider` and the upgrade modal opens automatically when a legacy wallet is detected at login. It handles the full flow end-to-end.
|
|
19
|
+
- **Headless**: Call `upgradeToDynamicWaas()` directly if you want a custom migration UX.
|
|
20
|
+
|
|
21
|
+
### 📱 JS SDK for web and React Native are the new default
|
|
22
|
+
|
|
23
|
+
Going forward, we're encouraging all developers building for web and React Native to use the JS SDK. It's the direction we're investing in. Ideally v5 is our final version of the old React SDK. To be clear: **no new features will be added to the old SDKs, including v5. All new feature development is happening in the JS SDK.**
|
|
24
|
+
|
|
25
|
+
### ✏️ Legacy package renames
|
|
26
|
+
|
|
27
|
+
The old packages have been renamed to make their status explicit. Update your `package.json` accordingly:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
@dynamic-labs/client → @dynamic-labs/legacy-client
|
|
31
|
+
@dynamic-labs/react-hooks → @dynamic-labs/legacy-react-hooks
|
|
32
|
+
@dynamic-labs/react-native-extension → @dynamic-labs/legacy-react-native-extension
|
|
33
|
+
@dynamic-labs/web-extension → @dynamic-labs/legacy-web-extension
|
|
34
|
+
@dynamic-labs/solana-extension → @dynamic-labs/legacy-solana-extension
|
|
35
|
+
@dynamic-labs/sui-extension → @dynamic-labs/legacy-sui-extension
|
|
36
|
+
@dynamic-labs/viem-extension → @dynamic-labs/legacy-viem-extension
|
|
37
|
+
@dynamic-labs/zerodev-extension → @dynamic-labs/legacy-zerodev-extension
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### :book: Full migration guide
|
|
41
|
+
|
|
42
|
+
Everything you need to upgrade from v4 → v5: [Upgrade SDK from V4 to V5 - Dynamic](https://www.dynamic.xyz/docs/react/reference/upgrade/v5)
|
|
43
|
+
|
|
44
|
+
Huge props to everyone who contributed to this. :tada:
|
|
45
|
+
|
|
46
|
+
------------------------------------------
|
|
47
|
+
|
|
48
|
+
### ⚠ BREAKING CHANGES
|
|
49
|
+
|
|
50
|
+
* **waas:** move the client key-share store onto the core storage API (#12096)
|
|
51
|
+
* **react-native-extension:** store sensitive information with react-native-keychain (#12092)
|
|
52
|
+
|
|
53
|
+
### Features
|
|
54
|
+
|
|
55
|
+
* **bitcoin:** add sendBitcoinWithConfirmation to show confirm modal on BTC sends ([#12025](https://github.com/dynamic-labs/dynamic-auth/issues/12025)) ([5f992f5](https://github.com/dynamic-labs/dynamic-auth/commit/5f992f5fdaf805f07870ab9248ea2fe06a2fd3bf))
|
|
56
|
+
* **waas:** delegate key shares with initial signer rules [DYNT-1675] ([#12028](https://github.com/dynamic-labs/dynamic-auth/issues/12028)) ([6b1ffc5](https://github.com/dynamic-labs/dynamic-auth/commit/6b1ffc5ee7070d639916a65b6a0aa6ada0167cb8)), closes [dynamic-labs/dynamic-waas-sdk#1500](https://github.com/dynamic-labs/dynamic-waas-sdk/issues/1500) [#10754](https://github.com/dynamic-labs/dynamic-auth/issues/10754) [#10772](https://github.com/dynamic-labs/dynamic-auth/issues/10772) [#646](https://github.com/dynamic-labs/dynamic-auth/issues/646) [#649](https://github.com/dynamic-labs/dynamic-auth/issues/649) [#1500](https://github.com/dynamic-labs/dynamic-auth/issues/1500) [dynamic-labs/dynamic-waas-sdk#1500](https://github.com/dynamic-labs/dynamic-waas-sdk/issues/1500)
|
|
57
|
+
* **waas:** expose rawSign sha256/blake2b in SignMessageContext ([#12075](https://github.com/dynamic-labs/dynamic-auth/issues/12075)) ([20e3d2f](https://github.com/dynamic-labs/dynamic-auth/commit/20e3d2f40d18aa0bdb77e9b00fa4a5dc5dd6e9de))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### Bug Fixes
|
|
61
|
+
|
|
62
|
+
* **bitcoin:** resolve the public key of the active wallet, not the first ([#12091](https://github.com/dynamic-labs/dynamic-auth/issues/12091)) ([ebad70c](https://github.com/dynamic-labs/dynamic-auth/commit/ebad70c37ab9a771ad7051ca8f3c68d52c1d32fa)), closes [#11970](https://github.com/dynamic-labs/dynamic-auth/issues/11970) [#11970](https://github.com/dynamic-labs/dynamic-auth/issues/11970) [#11970](https://github.com/dynamic-labs/dynamic-auth/issues/11970)
|
|
63
|
+
* fallback to local wallet balance when token balances API returns no tokens ([#12059](https://github.com/dynamic-labs/dynamic-auth/issues/12059)) ([26c9022](https://github.com/dynamic-labs/dynamic-auth/commit/26c9022da3371b0da0498ec641157aa9fed356aa))
|
|
64
|
+
* security updates ([#12114](https://github.com/dynamic-labs/dynamic-auth/issues/12114)) ([a4f9bc1](https://github.com/dynamic-labs/dynamic-auth/commit/a4f9bc19870156903b76996c55ecd46a3417f004)) ([#12050](https://github.com/dynamic-labs/dynamic-auth/issues/12050)) ([8eeec92](https://github.com/dynamic-labs/dynamic-auth/commit/8eeec923d0f2f688ade60440e1f92bb1fd646201)) ([#12088](https://github.com/dynamic-labs/dynamic-auth/issues/12088)) ([f11f1f3](https://github.com/dynamic-labs/dynamic-auth/commit/f11f1f384201fa31f58753c0854eaf17f420fb09))
|
|
65
|
+
* replace deprecated polygon-rpc.com RPC with polygon.drpc.org ([#12032](https://github.com/dynamic-labs/dynamic-auth/issues/12032)) ([e1ece53](https://github.com/dynamic-labs/dynamic-auth/commit/e1ece538aedf6127048ca64daf9f9f3cf3a7026e))
|
|
66
|
+
* **sui:** stop using Sui Foundation fullnode URLs in WaaS and extension connectors ([#12108](https://github.com/dynamic-labs/dynamic-auth/issues/12108)) ([b23c85b](https://github.com/dynamic-labs/dynamic-auth/commit/b23c85b7c06f3147705a026ba23f5e8ae1f03b68))
|
|
67
|
+
* **wallet-book:** use Backpack universal link for iOS in-app browser ([#12053](https://github.com/dynamic-labs/dynamic-auth/issues/12053)) ([afba6b1](https://github.com/dynamic-labs/dynamic-auth/commit/afba6b192e4be50aaeca9f5fad88b44808a034a0))
|
|
68
|
+
* **wallet-connect:** recover WalletConnect IndexedDB store when object store is missing ([#12048](https://github.com/dynamic-labs/dynamic-auth/issues/12048)) ([96ff80e](https://github.com/dynamic-labs/dynamic-auth/commit/96ff80e40b28740de15b1702b85f954100fd5f25))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
* **react-native-extension:** store sensitive information with react-native-keychain ([#12092](https://github.com/dynamic-labs/dynamic-auth/issues/12092)) ([10c0f2f](https://github.com/dynamic-labs/dynamic-auth/commit/10c0f2f6c281e300e4a0455aaaa0d452808dcb87))
|
|
72
|
+
* **waas:** move the client key-share store onto the core storage API ([#12096](https://github.com/dynamic-labs/dynamic-auth/issues/12096)) ([778f993](https://github.com/dynamic-labs/dynamic-auth/commit/778f993c5528ec03a7f1446dcb81a041a22db89b)), closes [#12094](https://github.com/dynamic-labs/dynamic-auth/issues/12094) [#12094](https://github.com/dynamic-labs/dynamic-auth/issues/12094) [#12092](https://github.com/dynamic-labs/dynamic-auth/issues/12092) [#12094](https://github.com/dynamic-labs/dynamic-auth/issues/12094)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
## [5.0.0-rc.4](https://github.com/dynamic-labs/dynamic-auth/compare/v5.0.0-rc.3...v5.0.0-rc.4) (2026-07-20)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### Features
|
|
79
|
+
|
|
80
|
+
* **business-accounts:** redesign demo + fix getBusinessAccount arg shape ([#11975](https://github.com/dynamic-labs/dynamic-auth/issues/11975)) ([7c2feaf](https://github.com/dynamic-labs/dynamic-auth/commit/7c2feaf6d0e00b210d67302353b40e90fdc7c8d1))
|
|
81
|
+
|
|
2
82
|
## [5.0.0-rc.3](https://github.com/dynamic-labs/dynamic-auth/compare/v5.0.0-rc.2...v5.0.0-rc.3) (2026-07-17)
|
|
3
83
|
|
|
4
84
|
## [5.0.0-rc.2](https://github.com/dynamic-labs/dynamic-auth/compare/v5.0.0-rc.1...v5.0.0-rc.2) (2026-07-17)
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/wallet-connect",
|
|
3
|
-
"version": "5.0.0
|
|
3
|
+
"version": "5.0.0",
|
|
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": "5.0.0
|
|
21
|
+
"@dynamic-labs/logger": "5.0.0",
|
|
22
22
|
"@walletconnect/sign-client": "2.21.5",
|
|
23
|
-
"@dynamic-labs/assert-package-version": "5.0.0
|
|
23
|
+
"@dynamic-labs/assert-package-version": "5.0.0"
|
|
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: {
|