@dynamic-labs/ethereum 0.17.0-RC.16 → 0.17.0-RC.18
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 +37 -0
- package/package.json +5 -5
- package/src/walletConnect/client/client.cjs +8 -17
- package/src/walletConnect/client/client.d.ts +0 -1
- package/src/walletConnect/client/client.js +11 -19
- package/src/walletConnect/walletConnect.cjs +9 -3
- package/src/walletConnect/walletConnect.js +10 -4
- package/src/walletConnect/walletConnectV2.cjs +7 -17
- package/src/walletConnect/walletConnectV2.js +7 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,41 @@
|
|
|
1
1
|
|
|
2
|
+
## [0.17.0-RC.18](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.17...v0.17.0-RC.18) (2023-05-19)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add getReferencedAccount ([#2141](https://github.com/dynamic-labs/DynamicAuth/issues/2141)) ([ac170a6](https://github.com/dynamic-labs/DynamicAuth/commit/ac170a6dfac25ff9911feb390495974aa5dbede6))
|
|
8
|
+
* add reconnectSocialWallet ([#2142](https://github.com/dynamic-labs/DynamicAuth/issues/2142)) ([fefd759](https://github.com/dynamic-labs/DynamicAuth/commit/fefd759b816b286dd8a7673cf6c839fee59768ac))
|
|
9
|
+
* **DYN-2220:** add Transaction Successfully Sent view ([#2134](https://github.com/dynamic-labs/DynamicAuth/issues/2134)) ([7db96ad](https://github.com/dynamic-labs/DynamicAuth/commit/7db96adcd3b84aef29fbabe40a1e048ea629d2bb))
|
|
10
|
+
* **MagicSocialWalletConnector:** store public address from redirect result in local storage ([#2139](https://github.com/dynamic-labs/DynamicAuth/issues/2139)) ([90b60e4](https://github.com/dynamic-labs/DynamicAuth/commit/90b60e485a53ff29a0e52ef27a58383771490974))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* issue when linking from detect_new_wallet ([#2148](https://github.com/dynamic-labs/DynamicAuth/issues/2148)) ([98feb7b](https://github.com/dynamic-labs/DynamicAuth/commit/98feb7bde081a8107577ac7ec70d0f9c4b611a2b))
|
|
16
|
+
* multi-wallet flows ([#2150](https://github.com/dynamic-labs/DynamicAuth/issues/2150)) ([c82ef4a](https://github.com/dynamic-labs/DynamicAuth/commit/c82ef4a5cc75c9f8edb30620e32dd64bbdb0eb7f))
|
|
17
|
+
* starknet getConnectedAccounts should return an empty array if there's no address to return ([#2140](https://github.com/dynamic-labs/DynamicAuth/issues/2140)) ([ce39641](https://github.com/dynamic-labs/DynamicAuth/commit/ce39641a6dbec1d05d8d5cc611a02de8bd756351))
|
|
18
|
+
|
|
19
|
+
## [0.17.0-RC.17](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.16...v0.17.0-RC.17) (2023-05-17)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* distinguish walletconnect deeplink types ([#2093](https://github.com/dynamic-labs/DynamicAuth/issues/2093)) ([dcd29f7](https://github.com/dynamic-labs/DynamicAuth/commit/dcd29f7cfc5e6481aaaae502b3fc4e4d225f1fc1))
|
|
25
|
+
* **social:** pass did token to verify request ([#2124](https://github.com/dynamic-labs/DynamicAuth/issues/2124)) ([60d73a5](https://github.com/dynamic-labs/DynamicAuth/commit/60d73a5f432d488979f33fe29666d1afa8fc0e8e))
|
|
26
|
+
* support optional priority and stalltimeout for customer provided rpc urls ([#2091](https://github.com/dynamic-labs/DynamicAuth/issues/2091)) ([eebacda](https://github.com/dynamic-labs/DynamicAuth/commit/eebacda6a9d6ba583eff4e4e5a38eb9945c4825e))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* add and remove event listeners for Solflare ([#2127](https://github.com/dynamic-labs/DynamicAuth/issues/2127)) ([978c7ba](https://github.com/dynamic-labs/DynamicAuth/commit/978c7ba0e3745e26d9dfc9b7c46a24adc913f02f))
|
|
32
|
+
* get publicKey from provider if no address and publicKey are returned on connect ([#2126](https://github.com/dynamic-labs/DynamicAuth/issues/2126)) ([c9c9b2a](https://github.com/dynamic-labs/DynamicAuth/commit/c9c9b2af81f660aa651fc4b0e01cd3c823bb0229))
|
|
33
|
+
* remove detect known secondary wallet modal ([#2117](https://github.com/dynamic-labs/DynamicAuth/issues/2117)) ([0e8bbd8](https://github.com/dynamic-labs/DynamicAuth/commit/0e8bbd8c385fe528a7af3ccc037812df9d6e0c84))
|
|
34
|
+
* revert changes for select wallet to work with solflare ([#2120](https://github.com/dynamic-labs/DynamicAuth/issues/2120)) ([76cf228](https://github.com/dynamic-labs/DynamicAuth/commit/76cf228c495d6592da4c88b8a0d5a5fc480861ae))
|
|
35
|
+
* setIsVerifying to false when selecting a connector ([#2133](https://github.com/dynamic-labs/DynamicAuth/issues/2133)) ([8ddeba3](https://github.com/dynamic-labs/DynamicAuth/commit/8ddeba377f35dfb4a104cd6bd7ee6315d574710f))
|
|
36
|
+
* setPrimaryWallet and useSyncPrimaryWallet updates ([#2128](https://github.com/dynamic-labs/DynamicAuth/issues/2128)) ([fb47b17](https://github.com/dynamic-labs/DynamicAuth/commit/fb47b17ddc7f41c29f140a1a85a1e47dbf017fff))
|
|
37
|
+
* update text color and add close button on extension not installed prompt ([#2122](https://github.com/dynamic-labs/DynamicAuth/issues/2122)) ([b4848a0](https://github.com/dynamic-labs/DynamicAuth/commit/b4848a0a8094b4ceac67e2667d277a9aa5e2e137))
|
|
38
|
+
|
|
2
39
|
## [0.17.0-RC.16](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.15...v0.17.0-RC.16) (2023-05-15)
|
|
3
40
|
|
|
4
41
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum",
|
|
3
|
-
"version": "0.17.0-RC.
|
|
3
|
+
"version": "0.17.0-RC.18",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"@walletconnect/universal-provider": "2.4.2",
|
|
33
33
|
"ethers": "5.7.2",
|
|
34
34
|
"buffer": "^6.0.3",
|
|
35
|
-
"@dynamic-labs/rpc-providers": "0.17.0-RC.
|
|
36
|
-
"@dynamic-labs/types": "0.17.0-RC.
|
|
37
|
-
"@dynamic-labs/utils": "0.17.0-RC.
|
|
38
|
-
"@dynamic-labs/wallet-connector-core": "0.17.0-RC.
|
|
35
|
+
"@dynamic-labs/rpc-providers": "0.17.0-RC.18",
|
|
36
|
+
"@dynamic-labs/types": "0.17.0-RC.18",
|
|
37
|
+
"@dynamic-labs/utils": "0.17.0-RC.18",
|
|
38
|
+
"@dynamic-labs/wallet-connector-core": "0.17.0-RC.18"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {}
|
|
41
41
|
}
|
|
@@ -84,19 +84,6 @@ const createSession = (client) => _tslib.__awaiter(void 0, void 0, void 0, funct
|
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
|
-
const useDeepLink = (metadata, wcClient, opts) => {
|
|
88
|
-
var _a, _b, _c;
|
|
89
|
-
const deepLink = walletConnectorCore.getDeepLink(wcClient.uri, metadata);
|
|
90
|
-
if (utils.isMobile()) {
|
|
91
|
-
window.location.href = deepLink;
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
if ((_a = metadata === null || metadata === void 0 ? void 0 : metadata.desktop) === null || _a === void 0 ? void 0 : _a.native) {
|
|
95
|
-
(_b = opts === null || opts === void 0 ? void 0 : opts.onDesktopUri) === null || _b === void 0 ? void 0 : _b.call(opts, deepLink);
|
|
96
|
-
}
|
|
97
|
-
(_c = opts === null || opts === void 0 ? void 0 : opts.onDisplayUri) === null || _c === void 0 ? void 0 : _c.call(opts, wcClient.uri);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
87
|
const fetchWalletConnectEVMPublicAddress = (metadata, wcClient, opts) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
101
88
|
var _a;
|
|
102
89
|
if (wcClient.connected) {
|
|
@@ -105,7 +92,10 @@ const fetchWalletConnectEVMPublicAddress = (metadata, wcClient, opts) => _tslib.
|
|
|
105
92
|
}
|
|
106
93
|
// createSession will trigger the QR code...
|
|
107
94
|
yield wcClient.createSession();
|
|
108
|
-
|
|
95
|
+
walletConnectorCore.performPlatformSpecificConnectionMethod(wcClient.uri, metadata, {
|
|
96
|
+
onDesktopUri: opts === null || opts === void 0 ? void 0 : opts.onDesktopUri,
|
|
97
|
+
onDisplayUri: opts === null || opts === void 0 ? void 0 : opts.onDisplayUri,
|
|
98
|
+
});
|
|
109
99
|
const payload = yield createSession(wcClient);
|
|
110
100
|
(_a = opts === null || opts === void 0 ? void 0 : opts.onConnect) === null || _a === void 0 ? void 0 : _a.call(opts, payload);
|
|
111
101
|
const [accountPublicAddress] = payload.params[0].accounts;
|
|
@@ -120,8 +110,10 @@ const signWalletConnectPersonalMessage = (messageToSign, metadata, client, rpcPr
|
|
|
120
110
|
}
|
|
121
111
|
const [accountPublicAddress] = client.accounts;
|
|
122
112
|
if (utils.isMobile()) {
|
|
123
|
-
const deepLink = walletConnectorCore.getDeepLink(
|
|
124
|
-
|
|
113
|
+
const deepLink = walletConnectorCore.getDeepLink({
|
|
114
|
+
metadata,
|
|
115
|
+
mode: 'regular',
|
|
116
|
+
uri: client.uri,
|
|
125
117
|
});
|
|
126
118
|
window.location.href = deepLink;
|
|
127
119
|
}
|
|
@@ -204,4 +196,3 @@ exports.killWalletConnectSession = killWalletConnectSession;
|
|
|
204
196
|
exports.setupWalletConnectEventListeners = setupWalletConnectEventListeners;
|
|
205
197
|
exports.signWalletConnectPersonalMessage = signWalletConnectPersonalMessage;
|
|
206
198
|
exports.teardownWalletConnectEventListeners = teardownWalletConnectEventListeners;
|
|
207
|
-
exports.useDeepLink = useDeepLink;
|
|
@@ -13,6 +13,5 @@ export declare const teardownWalletConnectEventListeners: (client: Client) => vo
|
|
|
13
13
|
*/
|
|
14
14
|
export declare const killWalletConnectSession: (client: Client) => Promise<void>;
|
|
15
15
|
export declare const createSession: (client: Client) => Promise<PayloadParams>;
|
|
16
|
-
export declare const useDeepLink: (metadata: WalletSchema, wcClient: Client, opts?: FetchPublicAddressOpts) => void;
|
|
17
16
|
export declare const fetchWalletConnectEVMPublicAddress: (metadata: WalletSchema, wcClient: Client, opts?: FetchPublicAddressOpts) => Promise<string | undefined>;
|
|
18
17
|
export declare const signWalletConnectPersonalMessage: (messageToSign: string, metadata: WalletSchema, client: Client, rpcProvider?: () => Promise<ethers.providers.JsonRpcProvider | undefined>) => Promise<string | undefined>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
2
2
|
import Client from '@walletconnect/client';
|
|
3
3
|
import { Contract, ethers } from 'ethers';
|
|
4
|
-
import { isSameAddress, logger, getDeepLink } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
-
import { isMobile
|
|
4
|
+
import { isSameAddress, logger, performPlatformSpecificConnectionMethod, getDeepLink } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
+
import { isMobile } from '@dynamic-labs/utils';
|
|
6
6
|
|
|
7
7
|
const initClient = (name, settings) => {
|
|
8
8
|
const storageId = `walletconnect-${name}`;
|
|
@@ -76,19 +76,6 @@ const createSession = (client) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
|
-
const useDeepLink = (metadata, wcClient, opts) => {
|
|
80
|
-
var _a, _b, _c;
|
|
81
|
-
const deepLink = getDeepLink(wcClient.uri, metadata);
|
|
82
|
-
if (isMobile()) {
|
|
83
|
-
window.location.href = deepLink;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
if ((_a = metadata === null || metadata === void 0 ? void 0 : metadata.desktop) === null || _a === void 0 ? void 0 : _a.native) {
|
|
87
|
-
(_b = opts === null || opts === void 0 ? void 0 : opts.onDesktopUri) === null || _b === void 0 ? void 0 : _b.call(opts, deepLink);
|
|
88
|
-
}
|
|
89
|
-
(_c = opts === null || opts === void 0 ? void 0 : opts.onDisplayUri) === null || _c === void 0 ? void 0 : _c.call(opts, wcClient.uri);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
79
|
const fetchWalletConnectEVMPublicAddress = (metadata, wcClient, opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
93
80
|
var _a;
|
|
94
81
|
if (wcClient.connected) {
|
|
@@ -97,7 +84,10 @@ const fetchWalletConnectEVMPublicAddress = (metadata, wcClient, opts) => __await
|
|
|
97
84
|
}
|
|
98
85
|
// createSession will trigger the QR code...
|
|
99
86
|
yield wcClient.createSession();
|
|
100
|
-
|
|
87
|
+
performPlatformSpecificConnectionMethod(wcClient.uri, metadata, {
|
|
88
|
+
onDesktopUri: opts === null || opts === void 0 ? void 0 : opts.onDesktopUri,
|
|
89
|
+
onDisplayUri: opts === null || opts === void 0 ? void 0 : opts.onDisplayUri,
|
|
90
|
+
});
|
|
101
91
|
const payload = yield createSession(wcClient);
|
|
102
92
|
(_a = opts === null || opts === void 0 ? void 0 : opts.onConnect) === null || _a === void 0 ? void 0 : _a.call(opts, payload);
|
|
103
93
|
const [accountPublicAddress] = payload.params[0].accounts;
|
|
@@ -112,8 +102,10 @@ const signWalletConnectPersonalMessage = (messageToSign, metadata, client, rpcPr
|
|
|
112
102
|
}
|
|
113
103
|
const [accountPublicAddress] = client.accounts;
|
|
114
104
|
if (isMobile()) {
|
|
115
|
-
const deepLink = getDeepLink(
|
|
116
|
-
|
|
105
|
+
const deepLink = getDeepLink({
|
|
106
|
+
metadata,
|
|
107
|
+
mode: 'regular',
|
|
108
|
+
uri: client.uri,
|
|
117
109
|
});
|
|
118
110
|
window.location.href = deepLink;
|
|
119
111
|
}
|
|
@@ -189,4 +181,4 @@ const waitForSafeTransaction = (signature, messageToSign, contract) => __awaiter
|
|
|
189
181
|
}
|
|
190
182
|
});
|
|
191
183
|
|
|
192
|
-
export { createSession, fetchWalletConnectEVMPublicAddress, initClient, killWalletConnectSession, setupWalletConnectEventListeners, signWalletConnectPersonalMessage, teardownWalletConnectEventListeners
|
|
184
|
+
export { createSession, fetchWalletConnectEVMPublicAddress, initClient, killWalletConnectSession, setupWalletConnectEventListeners, signWalletConnectPersonalMessage, teardownWalletConnectEventListeners };
|
|
@@ -78,8 +78,10 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
|
|
|
78
78
|
if (!utils.isMobile() && !((_a = wallet.desktop) === null || _a === void 0 ? void 0 : _a.native)) {
|
|
79
79
|
return undefined;
|
|
80
80
|
}
|
|
81
|
-
return walletConnectorCore.getDeepLink(
|
|
82
|
-
|
|
81
|
+
return walletConnectorCore.getDeepLink({
|
|
82
|
+
metadata: wallet,
|
|
83
|
+
mode: 'regular',
|
|
84
|
+
uri: this.getClient().uri,
|
|
83
85
|
});
|
|
84
86
|
}
|
|
85
87
|
signMessage(messageToSign) {
|
|
@@ -115,7 +117,11 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
|
|
|
115
117
|
throw new utils.DynamicError('Client not found');
|
|
116
118
|
}
|
|
117
119
|
if (utils.isMobile()) {
|
|
118
|
-
const deepLink = walletConnectorCore.getDeepLink(
|
|
120
|
+
const deepLink = walletConnectorCore.getDeepLink({
|
|
121
|
+
metadata: walletBook.getWalletBookWallet(this.name),
|
|
122
|
+
mode: 'regular',
|
|
123
|
+
uri: client.uri,
|
|
124
|
+
});
|
|
119
125
|
window.location.href = deepLink;
|
|
120
126
|
}
|
|
121
127
|
return _super.providerSwitchNetwork.call(this, { network, provider });
|
|
@@ -3,7 +3,7 @@ import WalletConnectProvider from '@walletconnect/ethereum-provider';
|
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
4
|
import { normalizeWalletName, getDeepLink } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
6
|
-
import { isMobile,
|
|
6
|
+
import { isMobile, DynamicError } from '@dynamic-labs/utils';
|
|
7
7
|
import { EthWalletConnector } from '../EthWalletConnector.js';
|
|
8
8
|
import { INFURA_ID } from '../constants.js';
|
|
9
9
|
import { initClient, setupWalletConnectEventListeners, teardownWalletConnectEventListeners, fetchWalletConnectEVMPublicAddress, signWalletConnectPersonalMessage, killWalletConnectSession } from './client/client.js';
|
|
@@ -70,8 +70,10 @@ class WalletConnect extends EthWalletConnector {
|
|
|
70
70
|
if (!isMobile() && !((_a = wallet.desktop) === null || _a === void 0 ? void 0 : _a.native)) {
|
|
71
71
|
return undefined;
|
|
72
72
|
}
|
|
73
|
-
return getDeepLink(
|
|
74
|
-
|
|
73
|
+
return getDeepLink({
|
|
74
|
+
metadata: wallet,
|
|
75
|
+
mode: 'regular',
|
|
76
|
+
uri: this.getClient().uri,
|
|
75
77
|
});
|
|
76
78
|
}
|
|
77
79
|
signMessage(messageToSign) {
|
|
@@ -107,7 +109,11 @@ class WalletConnect extends EthWalletConnector {
|
|
|
107
109
|
throw new DynamicError('Client not found');
|
|
108
110
|
}
|
|
109
111
|
if (isMobile()) {
|
|
110
|
-
const deepLink = getDeepLink(
|
|
112
|
+
const deepLink = getDeepLink({
|
|
113
|
+
metadata: getWalletBookWallet(this.name),
|
|
114
|
+
mode: 'regular',
|
|
115
|
+
uri: client.uri,
|
|
116
|
+
});
|
|
111
117
|
window.location.href = deepLink;
|
|
112
118
|
}
|
|
113
119
|
return _super.providerSwitchNetwork.call(this, { network, provider });
|
|
@@ -14,20 +14,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
14
|
|
|
15
15
|
var Provider__default = /*#__PURE__*/_interopDefaultLegacy(Provider);
|
|
16
16
|
|
|
17
|
-
const performPlatformSpecificConnectionMethod = (uri, metadata, opts) => {
|
|
18
|
-
var _a, _b, _c;
|
|
19
|
-
if (utils.isMobile()) {
|
|
20
|
-
const deepLink = walletConnectorCore.getDeepLink(uri, metadata);
|
|
21
|
-
window.location.href = deepLink;
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
if ((_a = metadata === null || metadata === void 0 ? void 0 : metadata.desktop) === null || _a === void 0 ? void 0 : _a.native) {
|
|
25
|
-
const desktopUri = walletConnectorCore.getDeepLink(uri, metadata);
|
|
26
|
-
(_b = opts === null || opts === void 0 ? void 0 : opts.onDesktopUri) === null || _b === void 0 ? void 0 : _b.call(opts, desktopUri);
|
|
27
|
-
}
|
|
28
|
-
(_c = opts === null || opts === void 0 ? void 0 : opts.onDisplayUri) === null || _c === void 0 ? void 0 : _c.call(opts, uri);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
17
|
const sessionTopicKey = (walletName) => `dynamic-wc2-session-topic-${walletName}`;
|
|
32
18
|
class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
33
19
|
constructor(opts) {
|
|
@@ -134,7 +120,11 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
134
120
|
if (!utils.isMobile() && !((_b = wallet.desktop) === null || _b === void 0 ? void 0 : _b.native)) {
|
|
135
121
|
return undefined;
|
|
136
122
|
}
|
|
137
|
-
return walletConnectorCore.getDeepLink(
|
|
123
|
+
return walletConnectorCore.getDeepLink({
|
|
124
|
+
metadata: wallet,
|
|
125
|
+
mode: 'regular',
|
|
126
|
+
uri: WalletConnectV2.provider.uri,
|
|
127
|
+
});
|
|
138
128
|
}
|
|
139
129
|
getWeb3Provider() {
|
|
140
130
|
if (!WalletConnectV2.provider) {
|
|
@@ -154,7 +144,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
154
144
|
if (!WalletConnectV2.provider.uri || !WalletConnectV2.createSession) {
|
|
155
145
|
throw new utils.DynamicError('No uri or approval found');
|
|
156
146
|
}
|
|
157
|
-
performPlatformSpecificConnectionMethod(WalletConnectV2.provider.uri, metadata, {
|
|
147
|
+
walletConnectorCore.performPlatformSpecificConnectionMethod(WalletConnectV2.provider.uri, metadata, {
|
|
158
148
|
onDesktopUri: opts === null || opts === void 0 ? void 0 : opts.onDesktopUri,
|
|
159
149
|
onDisplayUri: opts === null || opts === void 0 ? void 0 : opts.onDisplayUri,
|
|
160
150
|
});
|
|
@@ -204,7 +194,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
204
194
|
if (utils.isMobile()) {
|
|
205
195
|
// for sign message, no uri is needed because the uri encodes connection details,
|
|
206
196
|
// and at this point we are already connected
|
|
207
|
-
const deepLink = walletConnectorCore.getDeepLink(''
|
|
197
|
+
const deepLink = walletConnectorCore.getDeepLink({ metadata, mode: 'regular' });
|
|
208
198
|
window.location.href = deepLink;
|
|
209
199
|
}
|
|
210
200
|
// eslint-disable-next-line prefer-destructuring
|
|
@@ -1,25 +1,11 @@
|
|
|
1
1
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
2
|
import Provider from '@walletconnect/universal-provider';
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
|
-
import { logger, getDeepLink, utf8ToHex } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
+
import { logger, getDeepLink, performPlatformSpecificConnectionMethod, utf8ToHex } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
6
6
|
import { isMobile, DynamicError } from '@dynamic-labs/utils';
|
|
7
7
|
import { EthWalletConnector } from '../EthWalletConnector.js';
|
|
8
8
|
|
|
9
|
-
const performPlatformSpecificConnectionMethod = (uri, metadata, opts) => {
|
|
10
|
-
var _a, _b, _c;
|
|
11
|
-
if (isMobile()) {
|
|
12
|
-
const deepLink = getDeepLink(uri, metadata);
|
|
13
|
-
window.location.href = deepLink;
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
if ((_a = metadata === null || metadata === void 0 ? void 0 : metadata.desktop) === null || _a === void 0 ? void 0 : _a.native) {
|
|
17
|
-
const desktopUri = getDeepLink(uri, metadata);
|
|
18
|
-
(_b = opts === null || opts === void 0 ? void 0 : opts.onDesktopUri) === null || _b === void 0 ? void 0 : _b.call(opts, desktopUri);
|
|
19
|
-
}
|
|
20
|
-
(_c = opts === null || opts === void 0 ? void 0 : opts.onDisplayUri) === null || _c === void 0 ? void 0 : _c.call(opts, uri);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
9
|
const sessionTopicKey = (walletName) => `dynamic-wc2-session-topic-${walletName}`;
|
|
24
10
|
class WalletConnectV2 extends EthWalletConnector {
|
|
25
11
|
constructor(opts) {
|
|
@@ -126,7 +112,11 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
126
112
|
if (!isMobile() && !((_b = wallet.desktop) === null || _b === void 0 ? void 0 : _b.native)) {
|
|
127
113
|
return undefined;
|
|
128
114
|
}
|
|
129
|
-
return getDeepLink(
|
|
115
|
+
return getDeepLink({
|
|
116
|
+
metadata: wallet,
|
|
117
|
+
mode: 'regular',
|
|
118
|
+
uri: WalletConnectV2.provider.uri,
|
|
119
|
+
});
|
|
130
120
|
}
|
|
131
121
|
getWeb3Provider() {
|
|
132
122
|
if (!WalletConnectV2.provider) {
|
|
@@ -196,7 +186,7 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
196
186
|
if (isMobile()) {
|
|
197
187
|
// for sign message, no uri is needed because the uri encodes connection details,
|
|
198
188
|
// and at this point we are already connected
|
|
199
|
-
const deepLink = getDeepLink(''
|
|
189
|
+
const deepLink = getDeepLink({ metadata, mode: 'regular' });
|
|
200
190
|
window.location.href = deepLink;
|
|
201
191
|
}
|
|
202
192
|
// eslint-disable-next-line prefer-destructuring
|