@dynamic-labs/ethereum 0.18.0-RC.1 → 0.18.0-RC.2

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,27 @@
1
1
 
2
+ ## [0.18.0-RC.2](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.1...v0.18.0-RC.2) (2023-06-16)
3
+
4
+
5
+ ### Features
6
+
7
+ * add Dynamic Bridge widget ([#2316](https://github.com/dynamic-labs/DynamicAuth/issues/2316)) ([0e71a88](https://github.com/dynamic-labs/DynamicAuth/commit/0e71a88c6dd740583448ed7b45fa335aaa736079))
8
+ * add search bar to bridge wallets view ([#2357](https://github.com/dynamic-labs/DynamicAuth/issues/2357)) ([a8415fc](https://github.com/dynamic-labs/DynamicAuth/commit/a8415fc744216660a78c1443962711699e45429a))
9
+ * bridge flow improvements ([#2367](https://github.com/dynamic-labs/DynamicAuth/issues/2367)) ([38a44be](https://github.com/dynamic-labs/DynamicAuth/commit/38a44be417fd1363b0d8e45ec1834f9aaf680427))
10
+ * **Bridge:** add bridge navigation component ([#2340](https://github.com/dynamic-labs/DynamicAuth/issues/2340)) ([1e9adae](https://github.com/dynamic-labs/DynamicAuth/commit/1e9adaed3682bc9a7aab385221818946cad397f2))
11
+ * **Bridge:** integrate dynamic bridge ui ([#2354](https://github.com/dynamic-labs/DynamicAuth/issues/2354)) ([1465bf8](https://github.com/dynamic-labs/DynamicAuth/commit/1465bf8717cbc9905285c2d867bc3e1d0cd1114b))
12
+ * **DYN-2519:** create state for multiple connected wallets ([#2326](https://github.com/dynamic-labs/DynamicAuth/issues/2326)) ([fc05aa4](https://github.com/dynamic-labs/DynamicAuth/commit/fc05aa4d91b0af8950c5da84c69130557ba36b09)), closes [#2319](https://github.com/dynamic-labs/DynamicAuth/issues/2319)
13
+ * **MultiWalletStepSelectorModal:** add modal to connect multiple wallets ([#2348](https://github.com/dynamic-labs/DynamicAuth/issues/2348)) ([39ce0b2](https://github.com/dynamic-labs/DynamicAuth/commit/39ce0b26fdf6494a4e1ba7867e80bf399d11631f))
14
+ * use wallet-book from CDN ([#2352](https://github.com/dynamic-labs/DynamicAuth/issues/2352)) ([9d1498f](https://github.com/dynamic-labs/DynamicAuth/commit/9d1498f2aec4bb9f3e3d6b386d9cafea3a33bd58))
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * handle email only without primary wallet state ([#2342](https://github.com/dynamic-labs/DynamicAuth/issues/2342)) ([98583bb](https://github.com/dynamic-labs/DynamicAuth/commit/98583bb8820ac80967bf1059cbaf47d04bfd603a))
20
+ * s3 cp for walletbook json ([8127b79](https://github.com/dynamic-labs/DynamicAuth/commit/8127b790333b36f40a2cc230a576c01aaad42196))
21
+ * setting initial view when error in auth flow ([#2345](https://github.com/dynamic-labs/DynamicAuth/issues/2345)) ([85dcefb](https://github.com/dynamic-labs/DynamicAuth/commit/85dcefb54be498b540904b381b53f9ea7e0cd024))
22
+ * typo in github action ([d746bc0](https://github.com/dynamic-labs/DynamicAuth/commit/d746bc01981a3263e3ab4f654debf77b408cda3a))
23
+ * **widget:** add fallback icon when oauth provider does not exist ([#2349](https://github.com/dynamic-labs/DynamicAuth/issues/2349)) ([bd2a505](https://github.com/dynamic-labs/DynamicAuth/commit/bd2a505724affd6f5356c0c4f31586ffd188e539))
24
+
2
25
  ## [0.18.0-RC.1](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.0...v0.18.0-RC.1) (2023-06-14)
3
26
 
4
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum",
3
- "version": "0.18.0-RC.1",
3
+ "version": "0.18.0-RC.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -31,11 +31,11 @@
31
31
  "@walletconnect/universal-provider": "2.8.0",
32
32
  "ethers": "5.7.2",
33
33
  "buffer": "6.0.3",
34
- "@dynamic-labs/rpc-providers": "0.18.0-RC.1",
35
- "@dynamic-labs/types": "0.18.0-RC.1",
36
- "@dynamic-labs/utils": "0.18.0-RC.1",
37
- "@dynamic-labs/wallet-book": "0.18.0-RC.1",
38
- "@dynamic-labs/wallet-connector-core": "0.18.0-RC.1"
34
+ "@dynamic-labs/rpc-providers": "0.18.0-RC.2",
35
+ "@dynamic-labs/types": "0.18.0-RC.2",
36
+ "@dynamic-labs/utils": "0.18.0-RC.2",
37
+ "@dynamic-labs/wallet-book": "0.18.0-RC.2",
38
+ "@dynamic-labs/wallet-connector-core": "0.18.0-RC.2"
39
39
  },
40
40
  "peerDependencies": {}
41
41
  }
@@ -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.name);
20
+ const wallet = walletBook.getWalletBookWallet(this.walletBook, this.name);
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.name);
18
+ const wallet = getWalletBookWallet(this.walletBook, this.name);
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 }));
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var walletBook = require('@dynamic-labs/wallet-book');
6
5
  var walletConnectV2 = require('./walletConnectV2.cjs');
7
6
  var walletConnect = require('./walletConnect.cjs');
8
7
 
@@ -16,31 +15,34 @@ const filteredWalletConnectWallets = [
16
15
  'Keplr',
17
16
  'Zerion',
18
17
  ];
19
- const fetchWalletConnectWallets = ({ isWalletConnectV2Enabled, }) => Object.values(walletBook.useWalletBook().wallets)
20
- .filter((wallet) => wallet.walletConnect &&
21
- !filteredWalletConnectWallets.includes(wallet.shortName || wallet.name))
22
- .map((wallet) => {
18
+ const fetchWalletConnectWallets = ({ isWalletConnectV2Enabled, walletBook, }) => {
23
19
  var _a;
24
- const { shortName } = wallet;
25
- const name = shortName || wallet.name;
26
- // justification: we filtered out null/undefined above
27
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
28
- if (isWalletConnectV2Enabled &&
29
- ((_a = wallet.walletConnect.sdks) === null || _a === void 0 ? void 0 : _a.includes('sign_v2'))) {
30
- return class extends walletConnectV2.WalletConnectV2 {
31
- constructor(props) {
32
- super(Object.assign(Object.assign({}, props), { walletName: name }));
33
- }
34
- };
35
- }
36
- else {
37
- return class extends walletConnect.WalletConnect {
38
- constructor(props) {
39
- super(Object.assign(Object.assign({}, props), { walletName: name }));
40
- }
41
- };
42
- }
43
- });
20
+ return Object.values((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
21
+ .filter((wallet) => wallet.walletConnect &&
22
+ !filteredWalletConnectWallets.includes(wallet.shortName || wallet.name))
23
+ .map((wallet) => {
24
+ var _a;
25
+ const { shortName } = wallet;
26
+ const name = shortName || wallet.name;
27
+ // justification: we filtered out null/undefined above
28
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
29
+ if (isWalletConnectV2Enabled &&
30
+ ((_a = wallet.walletConnect.sdks) === null || _a === void 0 ? void 0 : _a.includes('sign_v2'))) {
31
+ return class extends walletConnectV2.WalletConnectV2 {
32
+ constructor(props) {
33
+ super(Object.assign(Object.assign({}, props), { walletName: name }));
34
+ }
35
+ };
36
+ }
37
+ else {
38
+ return class extends walletConnect.WalletConnect {
39
+ constructor(props) {
40
+ super(Object.assign(Object.assign({}, props), { walletName: name }));
41
+ }
42
+ };
43
+ }
44
+ });
45
+ };
44
46
  const getWalletConnectConnector = ({ isWalletConnectV2Enabled, }) => isWalletConnectV2Enabled
45
47
  ? class extends walletConnectV2.WalletConnectV2 {
46
48
  constructor(props) {
@@ -1,7 +1,9 @@
1
+ import { WalletBookSchema } from '@dynamic-labs/wallet-book';
1
2
  import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
2
3
  export declare const filteredWalletConnectWallets: string[];
3
- export declare const fetchWalletConnectWallets: ({ isWalletConnectV2Enabled, }: {
4
+ export declare const fetchWalletConnectWallets: ({ isWalletConnectV2Enabled, walletBook, }: {
4
5
  isWalletConnectV2Enabled: boolean;
6
+ walletBook: WalletBookSchema;
5
7
  }) => Array<WalletConnectorConstructor>;
6
8
  export declare const getWalletConnectConnector: ({ isWalletConnectV2Enabled, }: {
7
9
  isWalletConnectV2Enabled: boolean;
@@ -1,4 +1,3 @@
1
- import { useWalletBook } from '@dynamic-labs/wallet-book';
2
1
  import { WalletConnectV2 } from './walletConnectV2.js';
3
2
  import { WalletConnect } from './walletConnect.js';
4
3
 
@@ -12,31 +11,34 @@ const filteredWalletConnectWallets = [
12
11
  'Keplr',
13
12
  'Zerion',
14
13
  ];
15
- const fetchWalletConnectWallets = ({ isWalletConnectV2Enabled, }) => Object.values(useWalletBook().wallets)
16
- .filter((wallet) => wallet.walletConnect &&
17
- !filteredWalletConnectWallets.includes(wallet.shortName || wallet.name))
18
- .map((wallet) => {
14
+ const fetchWalletConnectWallets = ({ isWalletConnectV2Enabled, walletBook, }) => {
19
15
  var _a;
20
- const { shortName } = wallet;
21
- const name = shortName || wallet.name;
22
- // justification: we filtered out null/undefined above
23
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
24
- if (isWalletConnectV2Enabled &&
25
- ((_a = wallet.walletConnect.sdks) === null || _a === void 0 ? void 0 : _a.includes('sign_v2'))) {
26
- return class extends WalletConnectV2 {
27
- constructor(props) {
28
- super(Object.assign(Object.assign({}, props), { walletName: name }));
29
- }
30
- };
31
- }
32
- else {
33
- return class extends WalletConnect {
34
- constructor(props) {
35
- super(Object.assign(Object.assign({}, props), { walletName: name }));
36
- }
37
- };
38
- }
39
- });
16
+ return Object.values((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
17
+ .filter((wallet) => wallet.walletConnect &&
18
+ !filteredWalletConnectWallets.includes(wallet.shortName || wallet.name))
19
+ .map((wallet) => {
20
+ var _a;
21
+ const { shortName } = wallet;
22
+ const name = shortName || wallet.name;
23
+ // justification: we filtered out null/undefined above
24
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
25
+ if (isWalletConnectV2Enabled &&
26
+ ((_a = wallet.walletConnect.sdks) === null || _a === void 0 ? void 0 : _a.includes('sign_v2'))) {
27
+ return class extends WalletConnectV2 {
28
+ constructor(props) {
29
+ super(Object.assign(Object.assign({}, props), { walletName: name }));
30
+ }
31
+ };
32
+ }
33
+ else {
34
+ return class extends WalletConnect {
35
+ constructor(props) {
36
+ super(Object.assign(Object.assign({}, props), { walletName: name }));
37
+ }
38
+ };
39
+ }
40
+ });
41
+ };
40
42
  const getWalletConnectConnector = ({ isWalletConnectV2Enabled, }) => isWalletConnectV2Enabled
41
43
  ? class extends WalletConnectV2 {
42
44
  constructor(props) {
@@ -65,7 +65,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
65
65
  }
66
66
  fetchPublicAddress(opts) {
67
67
  return _tslib.__awaiter(this, void 0, void 0, function* () {
68
- return client.fetchWalletConnectEVMPublicAddress(walletBook.getWalletBookWallet(this.name), this.getClient(), Object.assign(Object.assign({}, opts), { onConnect: (payload) => {
68
+ return client.fetchWalletConnectEVMPublicAddress(walletBook.getWalletBookWallet(this.walletBook, this.name), this.getClient(), Object.assign(Object.assign({}, opts), { onConnect: (payload) => {
69
69
  var _a;
70
70
  (_a = opts === null || opts === void 0 ? void 0 : opts.onConnect) === null || _a === void 0 ? void 0 : _a.call(opts, payload);
71
71
  this.connectedChain = payload.params[0].chainId ? 'EVM' : 'SOL';
@@ -74,7 +74,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
74
74
  }
75
75
  getDeepLink() {
76
76
  var _a;
77
- const wallet = walletBook.getWalletBookWallet(this.name);
77
+ const wallet = walletBook.getWalletBookWallet(this.walletBook, this.name);
78
78
  if (!utils.isMobile() && !((_a = wallet.desktop) === null || _a === void 0 ? void 0 : _a.native)) {
79
79
  return undefined;
80
80
  }
@@ -86,7 +86,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
86
86
  }
87
87
  signMessage(messageToSign) {
88
88
  return _tslib.__awaiter(this, void 0, void 0, function* () {
89
- return client.signWalletConnectPersonalMessage(messageToSign, walletBook.getWalletBookWallet(this.name), this.getClient(),
89
+ return client.signWalletConnectPersonalMessage(messageToSign, walletBook.getWalletBookWallet(this.walletBook, this.name), this.getClient(),
90
90
  // don't call getRpcProvider until we really need to
91
91
  () => _tslib.__awaiter(this, void 0, void 0, function* () { return this.getRpcProvider(); }));
92
92
  });
@@ -118,7 +118,7 @@ class WalletConnect extends EthWalletConnector.EthWalletConnector {
118
118
  }
119
119
  if (utils.isMobile()) {
120
120
  const deepLink = walletConnectorCore.getDeepLink({
121
- metadata: walletBook.getWalletBookWallet(this.name),
121
+ metadata: walletBook.getWalletBookWallet(this.walletBook, this.name),
122
122
  mode: 'regular',
123
123
  uri: client.uri,
124
124
  });
@@ -57,7 +57,7 @@ class WalletConnect extends EthWalletConnector {
57
57
  }
58
58
  fetchPublicAddress(opts) {
59
59
  return __awaiter(this, void 0, void 0, function* () {
60
- return fetchWalletConnectEVMPublicAddress(getWalletBookWallet(this.name), this.getClient(), Object.assign(Object.assign({}, opts), { onConnect: (payload) => {
60
+ return fetchWalletConnectEVMPublicAddress(getWalletBookWallet(this.walletBook, this.name), this.getClient(), Object.assign(Object.assign({}, opts), { onConnect: (payload) => {
61
61
  var _a;
62
62
  (_a = opts === null || opts === void 0 ? void 0 : opts.onConnect) === null || _a === void 0 ? void 0 : _a.call(opts, payload);
63
63
  this.connectedChain = payload.params[0].chainId ? 'EVM' : 'SOL';
@@ -66,7 +66,7 @@ class WalletConnect extends EthWalletConnector {
66
66
  }
67
67
  getDeepLink() {
68
68
  var _a;
69
- const wallet = getWalletBookWallet(this.name);
69
+ const wallet = getWalletBookWallet(this.walletBook, this.name);
70
70
  if (!isMobile() && !((_a = wallet.desktop) === null || _a === void 0 ? void 0 : _a.native)) {
71
71
  return undefined;
72
72
  }
@@ -78,7 +78,7 @@ class WalletConnect extends EthWalletConnector {
78
78
  }
79
79
  signMessage(messageToSign) {
80
80
  return __awaiter(this, void 0, void 0, function* () {
81
- return signWalletConnectPersonalMessage(messageToSign, getWalletBookWallet(this.name), this.getClient(),
81
+ return signWalletConnectPersonalMessage(messageToSign, getWalletBookWallet(this.walletBook, this.name), this.getClient(),
82
82
  // don't call getRpcProvider until we really need to
83
83
  () => __awaiter(this, void 0, void 0, function* () { return this.getRpcProvider(); }));
84
84
  });
@@ -110,7 +110,7 @@ class WalletConnect extends EthWalletConnector {
110
110
  }
111
111
  if (isMobile()) {
112
112
  const deepLink = getDeepLink({
113
- metadata: getWalletBookWallet(this.name),
113
+ metadata: getWalletBookWallet(this.walletBook, this.name),
114
114
  mode: 'regular',
115
115
  uri: client.uri,
116
116
  });
@@ -131,7 +131,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
131
131
  var _a, _b;
132
132
  if (!((_a = WalletConnectV2.provider) === null || _a === void 0 ? void 0 : _a.uri))
133
133
  return;
134
- const wallet = walletBook.getWalletBookWallet(this.name);
134
+ const wallet = walletBook.getWalletBookWallet(this.walletBook, this.name);
135
135
  if (!utils.isMobile() && !((_b = wallet.desktop) === null || _b === void 0 ? void 0 : _b.native)) {
136
136
  return undefined;
137
137
  }
@@ -158,7 +158,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
158
158
  if (!WalletConnectV2.provider.uri) {
159
159
  throw new utils.DynamicError('No uri found');
160
160
  }
161
- const metadata = walletBook.getWalletBookWallet(this.name);
161
+ const metadata = walletBook.getWalletBookWallet(this.walletBook, this.name);
162
162
  walletConnectorCore.performPlatformSpecificConnectionMethod(WalletConnectV2.provider.uri, metadata, {
163
163
  onDesktopUri: opts === null || opts === void 0 ? void 0 : opts.onDesktopUri,
164
164
  onDisplayUri: opts === null || opts === void 0 ? void 0 : opts.onDisplayUri,
@@ -187,7 +187,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
187
187
  if (!WalletConnectV2.provider) {
188
188
  throw new utils.DynamicError('No WalletConnect provider found to handle signing');
189
189
  }
190
- const metadata = walletBook.getWalletBookWallet(this.name);
190
+ const metadata = walletBook.getWalletBookWallet(this.walletBook, this.name);
191
191
  if (utils.isMobile()) {
192
192
  // for sign message, no uri is needed because the uri encodes connection details,
193
193
  // and at this point we are already connected
@@ -123,7 +123,7 @@ class WalletConnectV2 extends EthWalletConnector {
123
123
  var _a, _b;
124
124
  if (!((_a = WalletConnectV2.provider) === null || _a === void 0 ? void 0 : _a.uri))
125
125
  return;
126
- const wallet = getWalletBookWallet(this.name);
126
+ const wallet = getWalletBookWallet(this.walletBook, this.name);
127
127
  if (!isMobile() && !((_b = wallet.desktop) === null || _b === void 0 ? void 0 : _b.native)) {
128
128
  return undefined;
129
129
  }
@@ -150,7 +150,7 @@ class WalletConnectV2 extends EthWalletConnector {
150
150
  if (!WalletConnectV2.provider.uri) {
151
151
  throw new DynamicError('No uri found');
152
152
  }
153
- const metadata = getWalletBookWallet(this.name);
153
+ const metadata = getWalletBookWallet(this.walletBook, this.name);
154
154
  performPlatformSpecificConnectionMethod(WalletConnectV2.provider.uri, metadata, {
155
155
  onDesktopUri: opts === null || opts === void 0 ? void 0 : opts.onDesktopUri,
156
156
  onDisplayUri: opts === null || opts === void 0 ? void 0 : opts.onDisplayUri,
@@ -179,7 +179,7 @@ class WalletConnectV2 extends EthWalletConnector {
179
179
  if (!WalletConnectV2.provider) {
180
180
  throw new DynamicError('No WalletConnect provider found to handle signing');
181
181
  }
182
- const metadata = getWalletBookWallet(this.name);
182
+ const metadata = getWalletBookWallet(this.walletBook, this.name);
183
183
  if (isMobile()) {
184
184
  // for sign message, no uri is needed because the uri encodes connection details,
185
185
  // and at this point we are already connected