@dynamic-labs/ethereum 0.17.0-RC.28 → 0.17.0-RC.30
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,20 @@
|
|
|
1
1
|
|
|
2
|
+
## [0.17.0-RC.30](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.29...v0.17.0-RC.30) (2023-06-08)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **view-context:** refactor view context to have initial view ([#2268](https://github.com/dynamic-labs/DynamicAuth/issues/2268)) ([0afe6ae](https://github.com/dynamic-labs/DynamicAuth/commit/0afe6ae469f62fd16fd8471322f9295957f607f6))
|
|
8
|
+
* **wcv2:** upgrade universal provider and refactor wcv2 ([#2163](https://github.com/dynamic-labs/DynamicAuth/issues/2163)) ([e69c67c](https://github.com/dynamic-labs/DynamicAuth/commit/e69c67c95dca0f694c4a554702be96c3f7d3d77e))
|
|
9
|
+
|
|
10
|
+
## [0.17.0-RC.29](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.28...v0.17.0-RC.29) (2023-06-07)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* de-duplicate authSuccess call ([#2269](https://github.com/dynamic-labs/DynamicAuth/issues/2269)) ([00268d0](https://github.com/dynamic-labs/DynamicAuth/commit/00268d001355946c98d285d71d7f7acc96d4c9f7))
|
|
16
|
+
* hide search when filtered wallets equal to number of shown wallets ([#2221](https://github.com/dynamic-labs/DynamicAuth/issues/2221)) ([fb0f629](https://github.com/dynamic-labs/DynamicAuth/commit/fb0f629ae76240fe681db91b485139934026054e))
|
|
17
|
+
|
|
2
18
|
## [0.17.0-RC.28](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.27...v0.17.0-RC.28) (2023-06-06)
|
|
3
19
|
|
|
4
20
|
|
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.30",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@dynamic-labs/wallet-book": "^0.0.18",
|
|
30
29
|
"@walletconnect/client": "1.8.0",
|
|
31
30
|
"@walletconnect/ethereum-provider": "1.8.0",
|
|
32
|
-
"@walletconnect/universal-provider": "2.7.
|
|
31
|
+
"@walletconnect/universal-provider": "2.7.8",
|
|
33
32
|
"ethers": "5.7.2",
|
|
34
33
|
"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-
|
|
34
|
+
"@dynamic-labs/rpc-providers": "0.17.0-RC.30",
|
|
35
|
+
"@dynamic-labs/types": "0.17.0-RC.30",
|
|
36
|
+
"@dynamic-labs/utils": "0.17.0-RC.30",
|
|
37
|
+
"@dynamic-labs/wallet-book": "0.17.0-RC.30",
|
|
38
|
+
"@dynamic-labs/wallet-connector-core": "0.17.0-RC.30"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {}
|
|
41
41
|
}
|
|
@@ -27,32 +27,36 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
27
27
|
}
|
|
28
28
|
initProvider() {
|
|
29
29
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
let { provider } = WalletConnectV2;
|
|
31
|
+
if (!provider) {
|
|
32
|
+
provider = yield Provider__default["default"].init({
|
|
32
33
|
projectId: this.projectId,
|
|
33
34
|
});
|
|
34
|
-
|
|
35
|
-
requiredNamespaces: {
|
|
36
|
-
eip155: {
|
|
37
|
-
chains: this.evmNetworks
|
|
38
|
-
// filtering out Palm for now since it causes Trust to crash
|
|
39
|
-
.filter((network) => network.chainId !== 11297108109)
|
|
40
|
-
.map((network) => `eip155:${network.chainId}`),
|
|
41
|
-
events: ['chainChanged', 'accountsChanged'],
|
|
42
|
-
methods: [
|
|
43
|
-
'eth_sendTransaction',
|
|
44
|
-
'eth_signTransaction',
|
|
45
|
-
'eth_sign',
|
|
46
|
-
'personal_sign',
|
|
47
|
-
'eth_signTypedData',
|
|
48
|
-
],
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
// eslint-disable-next-line prefer-destructuring
|
|
53
|
-
WalletConnectV2.provider.uri = connection.uri;
|
|
54
|
-
WalletConnectV2.createSession = connection.approval;
|
|
35
|
+
WalletConnectV2.provider = provider;
|
|
55
36
|
}
|
|
37
|
+
// this means there is already a connection in progress, so don't call connect again
|
|
38
|
+
if (provider === null || provider === void 0 ? void 0 : provider.uri) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
yield provider.connect({
|
|
42
|
+
namespaces: {
|
|
43
|
+
eip155: {
|
|
44
|
+
chains: this.evmNetworks
|
|
45
|
+
// filtering out Palm for now since it causes Trust to crash
|
|
46
|
+
.filter((network) => network.chainId !== 11297108109)
|
|
47
|
+
.map((network) => `eip155:${network.chainId}`),
|
|
48
|
+
events: ['chainChanged', 'accountsChanged'],
|
|
49
|
+
methods: [
|
|
50
|
+
'eth_sendTransaction',
|
|
51
|
+
'eth_signTransaction',
|
|
52
|
+
'eth_sign',
|
|
53
|
+
'personal_sign',
|
|
54
|
+
'eth_signTypedData',
|
|
55
|
+
],
|
|
56
|
+
rpcMap: this.evmNetworkRpcMap(),
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
56
60
|
});
|
|
57
61
|
}
|
|
58
62
|
init() {
|
|
@@ -137,49 +141,31 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
137
141
|
if (this.session) {
|
|
138
142
|
return this.session.namespaces.eip155.accounts[0].split(':')[2];
|
|
139
143
|
}
|
|
140
|
-
const metadata = walletBook.getWalletBookWallet(this.name);
|
|
141
144
|
if (!WalletConnectV2.provider) {
|
|
142
145
|
throw new utils.DynamicError('No provider found');
|
|
143
146
|
}
|
|
144
|
-
if (!WalletConnectV2.provider.uri
|
|
145
|
-
throw new utils.DynamicError('No uri
|
|
147
|
+
if (!WalletConnectV2.provider.uri) {
|
|
148
|
+
throw new utils.DynamicError('No uri found');
|
|
146
149
|
}
|
|
150
|
+
const metadata = walletBook.getWalletBookWallet(this.name);
|
|
147
151
|
walletConnectorCore.performPlatformSpecificConnectionMethod(WalletConnectV2.provider.uri, metadata, {
|
|
148
152
|
onDesktopUri: opts === null || opts === void 0 ? void 0 : opts.onDesktopUri,
|
|
149
153
|
onDisplayUri: opts === null || opts === void 0 ? void 0 : opts.onDisplayUri,
|
|
150
154
|
});
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
.map((network) => `eip155:${network.chainId}`),
|
|
165
|
-
events: ['chainChanged', 'accountsChanged'],
|
|
166
|
-
methods: [
|
|
167
|
-
'eth_sendTransaction',
|
|
168
|
-
'eth_signTransaction',
|
|
169
|
-
'eth_sign',
|
|
170
|
-
'personal_sign',
|
|
171
|
-
'eth_signTypedData',
|
|
172
|
-
],
|
|
173
|
-
rpcMap: this.evmNetworkRpcMap(),
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
skipPairing: true,
|
|
155
|
+
return new Promise((resolve, reject) => {
|
|
156
|
+
if (!WalletConnectV2.provider) {
|
|
157
|
+
reject(new utils.DynamicError('No provider found'));
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
WalletConnectV2.provider.on('connect', ({ session }) => {
|
|
161
|
+
if (!session) {
|
|
162
|
+
reject(new utils.DynamicError('No session found'));
|
|
163
|
+
}
|
|
164
|
+
this.session = session;
|
|
165
|
+
localStorage.setItem(this.sessionTopicKey, session.topic);
|
|
166
|
+
resolve(this.session.namespaces.eip155.accounts[0].split(':')[2]);
|
|
167
|
+
});
|
|
177
168
|
});
|
|
178
|
-
// THIS LINE IS SUPER IMPORTANT
|
|
179
|
-
// since we are skipping pairing, (see: skipPairing: true above), we need to manually set the session
|
|
180
|
-
// so that future provider requests work (like getNetwork)
|
|
181
|
-
WalletConnectV2.provider.session = session;
|
|
182
|
-
return session.namespaces.eip155.accounts[0].split(':')[2];
|
|
183
169
|
});
|
|
184
170
|
}
|
|
185
171
|
signMessage(messageToSign) {
|
|
@@ -216,7 +202,9 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
216
202
|
}
|
|
217
203
|
try {
|
|
218
204
|
yield WalletConnectV2.provider.disconnect();
|
|
205
|
+
WalletConnectV2.provider.uri = undefined;
|
|
219
206
|
localStorage.removeItem(this.sessionTopicKey);
|
|
207
|
+
this.session = undefined;
|
|
220
208
|
}
|
|
221
209
|
catch (e) {
|
|
222
210
|
walletConnectorCore.logger.debug(e);
|
|
@@ -15,7 +15,6 @@ export declare class WalletConnectV2 extends EthWalletConnector {
|
|
|
15
15
|
canConnectViaQrCode: boolean;
|
|
16
16
|
isWalletConnect: boolean;
|
|
17
17
|
private static provider;
|
|
18
|
-
private static createSession;
|
|
19
18
|
private projectId?;
|
|
20
19
|
constructor(opts: WalletConnectorV2Opts);
|
|
21
20
|
private initProvider;
|
|
@@ -19,32 +19,36 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
19
19
|
}
|
|
20
20
|
initProvider() {
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
let { provider } = WalletConnectV2;
|
|
23
|
+
if (!provider) {
|
|
24
|
+
provider = yield Provider.init({
|
|
24
25
|
projectId: this.projectId,
|
|
25
26
|
});
|
|
26
|
-
|
|
27
|
-
requiredNamespaces: {
|
|
28
|
-
eip155: {
|
|
29
|
-
chains: this.evmNetworks
|
|
30
|
-
// filtering out Palm for now since it causes Trust to crash
|
|
31
|
-
.filter((network) => network.chainId !== 11297108109)
|
|
32
|
-
.map((network) => `eip155:${network.chainId}`),
|
|
33
|
-
events: ['chainChanged', 'accountsChanged'],
|
|
34
|
-
methods: [
|
|
35
|
-
'eth_sendTransaction',
|
|
36
|
-
'eth_signTransaction',
|
|
37
|
-
'eth_sign',
|
|
38
|
-
'personal_sign',
|
|
39
|
-
'eth_signTypedData',
|
|
40
|
-
],
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
// eslint-disable-next-line prefer-destructuring
|
|
45
|
-
WalletConnectV2.provider.uri = connection.uri;
|
|
46
|
-
WalletConnectV2.createSession = connection.approval;
|
|
27
|
+
WalletConnectV2.provider = provider;
|
|
47
28
|
}
|
|
29
|
+
// this means there is already a connection in progress, so don't call connect again
|
|
30
|
+
if (provider === null || provider === void 0 ? void 0 : provider.uri) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
yield provider.connect({
|
|
34
|
+
namespaces: {
|
|
35
|
+
eip155: {
|
|
36
|
+
chains: this.evmNetworks
|
|
37
|
+
// filtering out Palm for now since it causes Trust to crash
|
|
38
|
+
.filter((network) => network.chainId !== 11297108109)
|
|
39
|
+
.map((network) => `eip155:${network.chainId}`),
|
|
40
|
+
events: ['chainChanged', 'accountsChanged'],
|
|
41
|
+
methods: [
|
|
42
|
+
'eth_sendTransaction',
|
|
43
|
+
'eth_signTransaction',
|
|
44
|
+
'eth_sign',
|
|
45
|
+
'personal_sign',
|
|
46
|
+
'eth_signTypedData',
|
|
47
|
+
],
|
|
48
|
+
rpcMap: this.evmNetworkRpcMap(),
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
48
52
|
});
|
|
49
53
|
}
|
|
50
54
|
init() {
|
|
@@ -129,49 +133,31 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
129
133
|
if (this.session) {
|
|
130
134
|
return this.session.namespaces.eip155.accounts[0].split(':')[2];
|
|
131
135
|
}
|
|
132
|
-
const metadata = getWalletBookWallet(this.name);
|
|
133
136
|
if (!WalletConnectV2.provider) {
|
|
134
137
|
throw new DynamicError('No provider found');
|
|
135
138
|
}
|
|
136
|
-
if (!WalletConnectV2.provider.uri
|
|
137
|
-
throw new DynamicError('No uri
|
|
139
|
+
if (!WalletConnectV2.provider.uri) {
|
|
140
|
+
throw new DynamicError('No uri found');
|
|
138
141
|
}
|
|
142
|
+
const metadata = getWalletBookWallet(this.name);
|
|
139
143
|
performPlatformSpecificConnectionMethod(WalletConnectV2.provider.uri, metadata, {
|
|
140
144
|
onDesktopUri: opts === null || opts === void 0 ? void 0 : opts.onDesktopUri,
|
|
141
145
|
onDisplayUri: opts === null || opts === void 0 ? void 0 : opts.onDisplayUri,
|
|
142
146
|
});
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
.map((network) => `eip155:${network.chainId}`),
|
|
157
|
-
events: ['chainChanged', 'accountsChanged'],
|
|
158
|
-
methods: [
|
|
159
|
-
'eth_sendTransaction',
|
|
160
|
-
'eth_signTransaction',
|
|
161
|
-
'eth_sign',
|
|
162
|
-
'personal_sign',
|
|
163
|
-
'eth_signTypedData',
|
|
164
|
-
],
|
|
165
|
-
rpcMap: this.evmNetworkRpcMap(),
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
skipPairing: true,
|
|
147
|
+
return new Promise((resolve, reject) => {
|
|
148
|
+
if (!WalletConnectV2.provider) {
|
|
149
|
+
reject(new DynamicError('No provider found'));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
WalletConnectV2.provider.on('connect', ({ session }) => {
|
|
153
|
+
if (!session) {
|
|
154
|
+
reject(new DynamicError('No session found'));
|
|
155
|
+
}
|
|
156
|
+
this.session = session;
|
|
157
|
+
localStorage.setItem(this.sessionTopicKey, session.topic);
|
|
158
|
+
resolve(this.session.namespaces.eip155.accounts[0].split(':')[2]);
|
|
159
|
+
});
|
|
169
160
|
});
|
|
170
|
-
// THIS LINE IS SUPER IMPORTANT
|
|
171
|
-
// since we are skipping pairing, (see: skipPairing: true above), we need to manually set the session
|
|
172
|
-
// so that future provider requests work (like getNetwork)
|
|
173
|
-
WalletConnectV2.provider.session = session;
|
|
174
|
-
return session.namespaces.eip155.accounts[0].split(':')[2];
|
|
175
161
|
});
|
|
176
162
|
}
|
|
177
163
|
signMessage(messageToSign) {
|
|
@@ -208,7 +194,9 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
208
194
|
}
|
|
209
195
|
try {
|
|
210
196
|
yield WalletConnectV2.provider.disconnect();
|
|
197
|
+
WalletConnectV2.provider.uri = undefined;
|
|
211
198
|
localStorage.removeItem(this.sessionTopicKey);
|
|
199
|
+
this.session = undefined;
|
|
212
200
|
}
|
|
213
201
|
catch (e) {
|
|
214
202
|
logger.debug(e);
|