@dynamic-labs/ethereum 0.19.0-alpha.7 → 0.19.0-alpha.8
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 +24 -0
- package/package.json +6 -6
- package/src/injected/InjectedWalletBase.cjs +1 -1
- package/src/injected/InjectedWalletBase.js +1 -1
- package/src/walletConnect/walletConnect.cjs +4 -4
- package/src/walletConnect/walletConnect.js +4 -4
- package/src/walletConnect/walletConnectV2.cjs +11 -6
- package/src/walletConnect/walletConnectV2.d.ts +1 -0
- package/src/walletConnect/walletConnectV2.js +11 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
|
|
2
|
+
## [0.19.0-alpha.8](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.7...v0.19.0-alpha.8) (2023-09-11)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add onSignedMessage callback ([#3118](https://github.com/dynamic-labs/DynamicAuth/issues/3118)) ([acc36f6](https://github.com/dynamic-labs/DynamicAuth/commit/acc36f6cf584eb05a019027475a6e2e413fd6bd5))
|
|
8
|
+
* add social sign-in without embedded wallet ([#3172](https://github.com/dynamic-labs/DynamicAuth/issues/3172)) ([ff1acc6](https://github.com/dynamic-labs/DynamicAuth/commit/ff1acc6d9753ba745ac01c5ef6d26f2e4291b752))
|
|
9
|
+
* show default wallet icon when image breaks ([#3234](https://github.com/dynamic-labs/DynamicAuth/issues/3234)) ([657e6bb](https://github.com/dynamic-labs/DynamicAuth/commit/657e6bbc1cdcd840562d25194a827ea833237c1a))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* catch error sending sdkSettings and log warning ([#3274](https://github.com/dynamic-labs/DynamicAuth/issues/3274)) ([fcbe01b](https://github.com/dynamic-labs/DynamicAuth/commit/fcbe01bc733a73f38aebd6ffb0969b040dd2f781))
|
|
15
|
+
* detect if oauth popup is blocked and throw error ([#3250](https://github.com/dynamic-labs/DynamicAuth/issues/3250)) ([b87ddf3](https://github.com/dynamic-labs/DynamicAuth/commit/b87ddf399104e29c56566abbbecab6ff947992d6))
|
|
16
|
+
* display error message to user if social account already exits ([#3258](https://github.com/dynamic-labs/DynamicAuth/issues/3258)) ([bb52cb4](https://github.com/dynamic-labs/DynamicAuth/commit/bb52cb4ae42d89310d435584ed4ece126f9b6a4a))
|
|
17
|
+
* don't call callbacks if window closed due to oauth process complete ([#3252](https://github.com/dynamic-labs/DynamicAuth/issues/3252)) ([09a3c73](https://github.com/dynamic-labs/DynamicAuth/commit/09a3c73446aa337f24e0875cd4a0af617ea8ca84))
|
|
18
|
+
* issue where unexpected token would occur when bundlers defined process.env ([#3283](https://github.com/dynamic-labs/DynamicAuth/issues/3283)) ([d31d0a4](https://github.com/dynamic-labs/DynamicAuth/commit/d31d0a4011256f59cb3760acdc2c3dfe6c5b504a))
|
|
19
|
+
* login view layout updates ([#3231](https://github.com/dynamic-labs/DynamicAuth/issues/3231)) ([7762d06](https://github.com/dynamic-labs/DynamicAuth/commit/7762d067bdd4b3f313a15308262f18dac0b961ab))
|
|
20
|
+
* **MagicWalletConnector:** remove async from getWeb3Provider method ([#3230](https://github.com/dynamic-labs/DynamicAuth/issues/3230)) ([69356e9](https://github.com/dynamic-labs/DynamicAuth/commit/69356e9b0bd1800acdf24fc96c72b094b595eaa7))
|
|
21
|
+
* remove react component props from sending to sdk api ([#3282](https://github.com/dynamic-labs/DynamicAuth/issues/3282)) ([b0d8f2b](https://github.com/dynamic-labs/DynamicAuth/commit/b0d8f2b9dd0856a5a7bd862f6c3499b65ec29f64))
|
|
22
|
+
* seprate ls checks for dynamiccontext and wagmi settings ([#3275](https://github.com/dynamic-labs/DynamicAuth/issues/3275)) ([aa4e756](https://github.com/dynamic-labs/DynamicAuth/commit/aa4e756a10310ce216b5942d0d6845f7092a89a2))
|
|
23
|
+
* use context to handle social sign-in and display message while processing ([#3216](https://github.com/dynamic-labs/DynamicAuth/issues/3216)) ([0e3ce73](https://github.com/dynamic-labs/DynamicAuth/commit/0e3ce73eafbb8d5725377c9a8cbd86a82d6c525f))
|
|
24
|
+
* **wallet-connect-v2:** use appropriate default chain id with WC v2 ([#3218](https://github.com/dynamic-labs/DynamicAuth/issues/3218)) ([2e6e7be](https://github.com/dynamic-labs/DynamicAuth/commit/2e6e7beb801ea5a8dc7429970bcd1e705610d605))
|
|
25
|
+
|
|
2
26
|
## [0.19.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.6...v0.19.0-alpha.7) (2023-08-31)
|
|
3
27
|
|
|
4
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum",
|
|
3
|
-
"version": "0.19.0-alpha.
|
|
3
|
+
"version": "0.19.0-alpha.8",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"ethers": "5.7.2",
|
|
33
33
|
"eventemitter3": "5.0.1",
|
|
34
34
|
"buffer": "6.0.3",
|
|
35
|
-
"@dynamic-labs/rpc-providers": "0.19.0-alpha.
|
|
36
|
-
"@dynamic-labs/types": "0.19.0-alpha.
|
|
37
|
-
"@dynamic-labs/utils": "0.19.0-alpha.
|
|
38
|
-
"@dynamic-labs/wallet-book": "0.19.0-alpha.
|
|
39
|
-
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.
|
|
35
|
+
"@dynamic-labs/rpc-providers": "0.19.0-alpha.8",
|
|
36
|
+
"@dynamic-labs/types": "0.19.0-alpha.8",
|
|
37
|
+
"@dynamic-labs/utils": "0.19.0-alpha.8",
|
|
38
|
+
"@dynamic-labs/wallet-book": "0.19.0-alpha.8",
|
|
39
|
+
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.8",
|
|
40
40
|
"@ethersproject/providers": "5.7.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {}
|
|
@@ -17,7 +17,7 @@ class InjectedWalletBase extends EthWalletConnector.EthWalletConnector {
|
|
|
17
17
|
getMobileOrInstalledWallet() {
|
|
18
18
|
var _a, _b, _c;
|
|
19
19
|
if (this.walletConnectorFallback && !this.isInstalledOnBrowser()) {
|
|
20
|
-
const wallet = walletBook.getWalletBookWallet(this.walletBook, this.
|
|
20
|
+
const wallet = walletBook.getWalletBookWallet(this.walletBook, this.key);
|
|
21
21
|
if (((_a = this.constructorProps) === null || _a === void 0 ? void 0 : _a.isWalletConnectV2Enabled) &&
|
|
22
22
|
((_c = (_b = wallet.walletConnect) === null || _b === void 0 ? void 0 : _b.sdks) === null || _c === void 0 ? void 0 : _c.includes('sign_v2'))) {
|
|
23
23
|
return new walletConnectV2.WalletConnectV2(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
|
|
@@ -15,7 +15,7 @@ class InjectedWalletBase extends EthWalletConnector {
|
|
|
15
15
|
getMobileOrInstalledWallet() {
|
|
16
16
|
var _a, _b, _c;
|
|
17
17
|
if (this.walletConnectorFallback && !this.isInstalledOnBrowser()) {
|
|
18
|
-
const wallet = getWalletBookWallet(this.walletBook, this.
|
|
18
|
+
const wallet = getWalletBookWallet(this.walletBook, this.key);
|
|
19
19
|
if (((_a = this.constructorProps) === null || _a === void 0 ? void 0 : _a.isWalletConnectV2Enabled) &&
|
|
20
20
|
((_c = (_b = wallet.walletConnect) === null || _b === void 0 ? void 0 : _b.sdks) === null || _c === void 0 ? void 0 : _c.includes('sign_v2'))) {
|
|
21
21
|
return new WalletConnectV2(Object.assign(Object.assign({}, this.constructorProps), { walletName: this.name }));
|
|
@@ -66,7 +66,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
|
|
|
66
66
|
}
|
|
67
67
|
fetchPublicAddress(opts) {
|
|
68
68
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
return client.fetchWalletConnectEVMPublicAddress(walletBook.getWalletBookWallet(this.walletBook, this.
|
|
69
|
+
return client.fetchWalletConnectEVMPublicAddress(walletBook.getWalletBookWallet(this.walletBook, this.key), this.getClient(), this.deepLinkPreference, Object.assign(Object.assign({}, opts), { onConnect: (payload) => {
|
|
70
70
|
var _a;
|
|
71
71
|
(_a = opts === null || opts === void 0 ? void 0 : opts.onConnect) === null || _a === void 0 ? void 0 : _a.call(opts, payload);
|
|
72
72
|
this.connectedChain = payload.params[0].chainId ? 'EVM' : 'SOL';
|
|
@@ -75,7 +75,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
|
|
|
75
75
|
}
|
|
76
76
|
getDeepLink() {
|
|
77
77
|
var _a;
|
|
78
|
-
const wallet = walletBook.getWalletBookWallet(this.walletBook, this.
|
|
78
|
+
const wallet = walletBook.getWalletBookWallet(this.walletBook, this.key);
|
|
79
79
|
if (!utils.isMobile() && !((_a = wallet.desktop) === null || _a === void 0 ? void 0 : _a.native)) {
|
|
80
80
|
return undefined;
|
|
81
81
|
}
|
|
@@ -88,7 +88,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
|
|
|
88
88
|
}
|
|
89
89
|
signMessage(messageToSign) {
|
|
90
90
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
return client.signWalletConnectPersonalMessage(messageToSign, walletBook.getWalletBookWallet(this.walletBook, this.
|
|
91
|
+
return client.signWalletConnectPersonalMessage(messageToSign, walletBook.getWalletBookWallet(this.walletBook, this.key), this.getClient(), this.deepLinkPreference,
|
|
92
92
|
// don't call getRpcProvider until we really need to
|
|
93
93
|
() => _tslib.__awaiter(this, void 0, void 0, function* () { return this.getRpcProvider(); }));
|
|
94
94
|
});
|
|
@@ -120,7 +120,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
|
|
|
120
120
|
}
|
|
121
121
|
if (utils.isMobile()) {
|
|
122
122
|
const deepLink = walletConnectorCore.getDeepLink({
|
|
123
|
-
metadata: walletBook.getWalletBookWallet(this.walletBook, this.
|
|
123
|
+
metadata: walletBook.getWalletBookWallet(this.walletBook, this.key),
|
|
124
124
|
mode: 'regular',
|
|
125
125
|
preference: this.deepLinkPreference,
|
|
126
126
|
uri: client.uri,
|
|
@@ -58,7 +58,7 @@ class WalletConnect extends EthWalletConnector {
|
|
|
58
58
|
}
|
|
59
59
|
fetchPublicAddress(opts) {
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
return fetchWalletConnectEVMPublicAddress(getWalletBookWallet(this.walletBook, this.
|
|
61
|
+
return fetchWalletConnectEVMPublicAddress(getWalletBookWallet(this.walletBook, this.key), this.getClient(), this.deepLinkPreference, Object.assign(Object.assign({}, opts), { onConnect: (payload) => {
|
|
62
62
|
var _a;
|
|
63
63
|
(_a = opts === null || opts === void 0 ? void 0 : opts.onConnect) === null || _a === void 0 ? void 0 : _a.call(opts, payload);
|
|
64
64
|
this.connectedChain = payload.params[0].chainId ? 'EVM' : 'SOL';
|
|
@@ -67,7 +67,7 @@ class WalletConnect extends EthWalletConnector {
|
|
|
67
67
|
}
|
|
68
68
|
getDeepLink() {
|
|
69
69
|
var _a;
|
|
70
|
-
const wallet = getWalletBookWallet(this.walletBook, this.
|
|
70
|
+
const wallet = getWalletBookWallet(this.walletBook, this.key);
|
|
71
71
|
if (!isMobile() && !((_a = wallet.desktop) === null || _a === void 0 ? void 0 : _a.native)) {
|
|
72
72
|
return undefined;
|
|
73
73
|
}
|
|
@@ -80,7 +80,7 @@ class WalletConnect extends EthWalletConnector {
|
|
|
80
80
|
}
|
|
81
81
|
signMessage(messageToSign) {
|
|
82
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
return signWalletConnectPersonalMessage(messageToSign, getWalletBookWallet(this.walletBook, this.
|
|
83
|
+
return signWalletConnectPersonalMessage(messageToSign, getWalletBookWallet(this.walletBook, this.key), this.getClient(), this.deepLinkPreference,
|
|
84
84
|
// don't call getRpcProvider until we really need to
|
|
85
85
|
() => __awaiter(this, void 0, void 0, function* () { return this.getRpcProvider(); }));
|
|
86
86
|
});
|
|
@@ -112,7 +112,7 @@ class WalletConnect extends EthWalletConnector {
|
|
|
112
112
|
}
|
|
113
113
|
if (isMobile()) {
|
|
114
114
|
const deepLink = getDeepLink({
|
|
115
|
-
metadata: getWalletBookWallet(this.walletBook, this.
|
|
115
|
+
metadata: getWalletBookWallet(this.walletBook, this.key),
|
|
116
116
|
mode: 'regular',
|
|
117
117
|
preference: this.deepLinkPreference,
|
|
118
118
|
uri: client.uri,
|
|
@@ -32,8 +32,15 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
32
32
|
this.projectId = opts.projectId;
|
|
33
33
|
this.deepLinkPreference = opts.deepLinkPreference || 'native';
|
|
34
34
|
}
|
|
35
|
+
getDefaultChainId() {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
const etheriumMainnetNetwork = (_a = this.evmNetworks) === null || _a === void 0 ? void 0 : _a.find((network) => network.chainId === 1);
|
|
38
|
+
if (!etheriumMainnetNetwork && ((_b = this.evmNetworks) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
39
|
+
return this.evmNetworks[0].chainId;
|
|
40
|
+
}
|
|
41
|
+
return 1;
|
|
42
|
+
}
|
|
35
43
|
initConnection() {
|
|
36
|
-
var _a;
|
|
37
44
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
38
45
|
const { provider } = WalletConnectV2;
|
|
39
46
|
if (!provider) {
|
|
@@ -43,9 +50,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
43
50
|
if (provider === null || provider === void 0 ? void 0 : provider.uri) {
|
|
44
51
|
return;
|
|
45
52
|
}
|
|
46
|
-
const defaultChain =
|
|
47
|
-
? this.evmNetworks[0].chainId
|
|
48
|
-
: 1;
|
|
53
|
+
const defaultChain = this.getDefaultChainId();
|
|
49
54
|
provider
|
|
50
55
|
.connect({
|
|
51
56
|
namespaces: {
|
|
@@ -200,7 +205,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
200
205
|
throw new utils.DynamicError('No provider found');
|
|
201
206
|
}
|
|
202
207
|
}
|
|
203
|
-
const metadata = walletBook.getWalletBookWallet(this.walletBook, this.
|
|
208
|
+
const metadata = walletBook.getWalletBookWallet(this.walletBook, this.key);
|
|
204
209
|
walletConnectorCore.performPlatformSpecificConnectionMethod(WalletConnectV2.provider.uri, metadata, {
|
|
205
210
|
onDesktopUri: opts === null || opts === void 0 ? void 0 : opts.onDesktopUri,
|
|
206
211
|
onDisplayUri: opts === null || opts === void 0 ? void 0 : opts.onDisplayUri,
|
|
@@ -259,7 +264,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
259
264
|
if (!this.session) {
|
|
260
265
|
return;
|
|
261
266
|
}
|
|
262
|
-
const metadata = walletBook.getWalletBookWallet(this.walletBook, this.
|
|
267
|
+
const metadata = walletBook.getWalletBookWallet(this.walletBook, this.key);
|
|
263
268
|
const deepLink = walletConnectorCore.getDeepLink({
|
|
264
269
|
metadata,
|
|
265
270
|
mode: 'regular',
|
|
@@ -22,6 +22,7 @@ export declare class WalletConnectV2 extends EthWalletConnector {
|
|
|
22
22
|
private projectId?;
|
|
23
23
|
private deepLinkPreference;
|
|
24
24
|
constructor(opts: WalletConnectorV2Opts);
|
|
25
|
+
getDefaultChainId(): number;
|
|
25
26
|
private initConnection;
|
|
26
27
|
private createInitProviderPromise;
|
|
27
28
|
private initProvider;
|
|
@@ -23,8 +23,15 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
23
23
|
this.projectId = opts.projectId;
|
|
24
24
|
this.deepLinkPreference = opts.deepLinkPreference || 'native';
|
|
25
25
|
}
|
|
26
|
+
getDefaultChainId() {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
const etheriumMainnetNetwork = (_a = this.evmNetworks) === null || _a === void 0 ? void 0 : _a.find((network) => network.chainId === 1);
|
|
29
|
+
if (!etheriumMainnetNetwork && ((_b = this.evmNetworks) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
30
|
+
return this.evmNetworks[0].chainId;
|
|
31
|
+
}
|
|
32
|
+
return 1;
|
|
33
|
+
}
|
|
26
34
|
initConnection() {
|
|
27
|
-
var _a;
|
|
28
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
36
|
const { provider } = WalletConnectV2;
|
|
30
37
|
if (!provider) {
|
|
@@ -34,9 +41,7 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
34
41
|
if (provider === null || provider === void 0 ? void 0 : provider.uri) {
|
|
35
42
|
return;
|
|
36
43
|
}
|
|
37
|
-
const defaultChain =
|
|
38
|
-
? this.evmNetworks[0].chainId
|
|
39
|
-
: 1;
|
|
44
|
+
const defaultChain = this.getDefaultChainId();
|
|
40
45
|
provider
|
|
41
46
|
.connect({
|
|
42
47
|
namespaces: {
|
|
@@ -191,7 +196,7 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
191
196
|
throw new DynamicError('No provider found');
|
|
192
197
|
}
|
|
193
198
|
}
|
|
194
|
-
const metadata = getWalletBookWallet(this.walletBook, this.
|
|
199
|
+
const metadata = getWalletBookWallet(this.walletBook, this.key);
|
|
195
200
|
performPlatformSpecificConnectionMethod(WalletConnectV2.provider.uri, metadata, {
|
|
196
201
|
onDesktopUri: opts === null || opts === void 0 ? void 0 : opts.onDesktopUri,
|
|
197
202
|
onDisplayUri: opts === null || opts === void 0 ? void 0 : opts.onDisplayUri,
|
|
@@ -250,7 +255,7 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
250
255
|
if (!this.session) {
|
|
251
256
|
return;
|
|
252
257
|
}
|
|
253
|
-
const metadata = getWalletBookWallet(this.walletBook, this.
|
|
258
|
+
const metadata = getWalletBookWallet(this.walletBook, this.key);
|
|
254
259
|
const deepLink = getDeepLink({
|
|
255
260
|
metadata,
|
|
256
261
|
mode: 'regular',
|