@dynamic-labs/ethereum 0.17.0-RC.33 → 0.17.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 CHANGED
@@ -1,4 +1,78 @@
1
1
 
2
+ ## [0.17.0](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.33...v0.17.0) (2023-06-13)
3
+
4
+ Dynamic is excited to announce our most amazing SDK update yet (at least since 0.16.0 :-))!
5
+ We have some great things in this version, here are the highlights:
6
+
7
+ ### Breaking Changes
8
+ - In favor of supporting MagicLink Wallets we removed the support for Fortmatic.
9
+
10
+ ### Deprecations
11
+ - `chainName` on EvmNetwork is deprecated in favor of `name`. If you're passing `evmNetworks` to `DynamicContextProvider` or `DynamicWagmiConnector`, you should update your code like so:
12
+ ```ts
13
+ <DynamicContextProvider
14
+ settings={{
15
+ environmentId: 'YOUR_ENV_ID',
16
+ evmNetworks: [
17
+ {
18
+ blockExplorerUrls: [],
19
+ chainId: 1,
20
+ iconUrls: [],
21
+ - chainName: 'Ethereum',
22
+ + name: 'Ethereum',
23
+ nativeCurrency: {
24
+ decimals: 18,
25
+ name: 'Ether',
26
+ symbol: 'ETH',
27
+ },
28
+ networkId: 1,
29
+ rpcUrls: [],
30
+ },
31
+ ],
32
+ }}
33
+ >
34
+ <HomePage />
35
+ </DynamicContextProvider>
36
+ ```
37
+ - the `multiWallet` prop on DynamicContextProvider is deprecated in favor of the Dashboard settings. See [here](https://docs.dynamic.xyz/docs/multi-wallet#setup) for more info
38
+
39
+ ### Highlighted Features
40
+ - Package splitting. You asked for it, and here it is!
41
+ If you want to reduce your package size to include only the chains and the wallets that your app needs, you now have the option to customize your build [See instructions](https://docs.dynamic.xyz/docs/reduce-bundle-size-with-modular-sdk)
42
+
43
+ - Two cool features for Magic Wallets:
44
+ - Support for [social login](https://docs.dynamic.xyz/docs/magic#enable-social-sign-in)
45
+ - Modal for supporting [send balance](https://docs.dynamic.xyz/docs/send-balance-ui).
46
+
47
+
48
+ - Generic types on various connector methods. For example, if you know you are working with an EVM network, you can typecast with `walletConnector.getNetwork<number>()` to work nicely in typescript.
49
+
50
+ - [onRamp with Banxa](https://docs.dynamic.xyz/docs/onramps) (please reach out to us to enable the feature)
51
+
52
+ - Ability to support multiple RPCs with fallbacks when providing the URL to network prop.
53
+
54
+ - Added suffix to the local storage key, in case you are testing multiple local environments locally at the same time.
55
+
56
+ - We have a new global loading state that you can now easily use to tell when the SDK completed loading (`sdkHasLoaded`)
57
+
58
+ And many other minor improvements and bug fixes.
59
+
60
+ Enjoy!
61
+
62
+ ### Features
63
+
64
+ * Add suffix to local storage ([#2227](https://github.com/dynamic-labs/DynamicAuth/issues/2227)) ([b901b9b](https://github.com/dynamic-labs/DynamicAuth/commit/b901b9b43a3eaa80706b9ec0679f668a7b8b2507))
65
+ * Block Self Service so users have to schedule a demo ([#2286](https://github.com/dynamic-labs/DynamicAuth/issues/2286)) ([8a2f19a](https://github.com/dynamic-labs/DynamicAuth/commit/8a2f19a13a91ef0d9b860ff5164d61f6f7664426))
66
+ * dyn 2486 Add support for superb ([#2271](https://github.com/dynamic-labs/DynamicAuth/issues/2271)) ([8ea51e9](https://github.com/dynamic-labs/DynamicAuth/commit/8ea51e93c5d74d02efd47877042d7af05ca55f5c))
67
+ * pass icon theme variant to usages of SocialIcon ([#2303](https://github.com/dynamic-labs/DynamicAuth/issues/2303)) ([da59d6f](https://github.com/dynamic-labs/DynamicAuth/commit/da59d6f22e7ec49cb8cff757baada3cb1e737b99))
68
+
69
+
70
+ ### Bug Fixes
71
+
72
+ * brief red error message as the KYC screen loads ([#2240](https://github.com/dynamic-labs/DynamicAuth/issues/2240)) ([1155e8b](https://github.com/dynamic-labs/DynamicAuth/commit/1155e8bd66ffdc96ae3f9d88f027793217c120a8))
73
+ * account controls hover does not fill the container ([#2300](https://github.com/dynamic-labs/DynamicAuth/issues/2300)) ([fdc984e](https://github.com/dynamic-labs/DynamicAuth/commit/fdc984e2d0b11d9d38dcd9e877c228fbc41c5855))
74
+ * refresh session in walletconnectv2 ([#2294](https://github.com/dynamic-labs/DynamicAuth/issues/2294)) ([d54263e](https://github.com/dynamic-labs/DynamicAuth/commit/d54263ea04c58f842b60b0c13f964fde25be786b))
75
+
2
76
  ## [0.17.0-RC.33](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.32...v0.17.0-RC.33) (2023-06-09)
3
77
 
4
78
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum",
3
- "version": "0.17.0-RC.33",
3
+ "version": "0.17.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -28,14 +28,14 @@
28
28
  "dependencies": {
29
29
  "@walletconnect/client": "1.8.0",
30
30
  "@walletconnect/ethereum-provider": "1.8.0",
31
- "@walletconnect/universal-provider": "2.7.8",
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.17.0-RC.33",
35
- "@dynamic-labs/types": "0.17.0-RC.33",
36
- "@dynamic-labs/utils": "0.17.0-RC.33",
37
- "@dynamic-labs/wallet-book": "0.17.0-RC.33",
38
- "@dynamic-labs/wallet-connector-core": "0.17.0-RC.33"
34
+ "@dynamic-labs/rpc-providers": "0.17.0",
35
+ "@dynamic-labs/types": "0.17.0",
36
+ "@dynamic-labs/utils": "0.17.0",
37
+ "@dynamic-labs/wallet-book": "0.17.0",
38
+ "@dynamic-labs/wallet-connector-core": "0.17.0"
39
39
  },
40
40
  "peerDependencies": {}
41
41
  }
@@ -32,6 +32,9 @@ class EthProviderHelper {
32
32
  if (window.zerionWallet) {
33
33
  ethereumProviders.push(window.zerionWallet);
34
34
  }
35
+ if (window.superb) {
36
+ ethereumProviders.push(window.superb);
37
+ }
35
38
  return ethereumProviders;
36
39
  }
37
40
  static isInstalledHelper(walletName) {
@@ -153,6 +156,7 @@ _a.installedProviderLookup([
153
156
  { flag: 'isPhantom', value: false },
154
157
  { flag: 'isZerion', value: false },
155
158
  { flag: 'isMetaMask', value: true },
159
+ { flag: 'isSuperb', value: false },
156
160
  ]);
157
161
  EthProviderHelper.BraveProvider = () => _a.installedProviderLookup([{ flag: 'isBraveWallet', value: true }]);
158
162
  EthProviderHelper.DawnProvider = () => _a.installedProviderLookup([{ flag: 'isDawn', value: true }]);
@@ -165,6 +169,7 @@ EthProviderHelper.BloctoProvider = () => _a.installedProviderLookup([{ flag: 'is
165
169
  EthProviderHelper.TrustWalletProvider = () => _a.installedProviderLookup([{ flag: 'isTrustWallet', value: true }]);
166
170
  EthProviderHelper.PhantomProvider = () => _a.installedProviderLookup([{ flag: 'isPhantom', value: true }]);
167
171
  EthProviderHelper.ZerionProvider = () => _a.installedProviderLookup([{ flag: 'isZerion', value: true }]);
172
+ EthProviderHelper.SuperbProvider = () => _a.installedProviderLookup([{ flag: 'isSuperb', value: true }]);
168
173
  EthProviderHelper.UnknownInjectedProvider = () => _a.installedProviderLookup([
169
174
  { flag: 'isMetaMask', value: false },
170
175
  { flag: 'isExodus', value: false },
@@ -177,6 +182,7 @@ EthProviderHelper.UnknownInjectedProvider = () => _a.installedProviderLookup([
177
182
  { flag: 'isTrustWallet', value: false },
178
183
  { flag: 'isPhantom', value: false },
179
184
  { flag: 'isZerion', value: false },
185
+ { flag: 'isSuperb', value: false },
180
186
  ]);
181
187
  EthProviderHelper.providers = {
182
188
  bloctoinjected: _a.BloctoProvider,
@@ -190,6 +196,7 @@ EthProviderHelper.providers = {
190
196
  metamask: _a.MetamaskProvider,
191
197
  opera: _a.OperaProvider,
192
198
  phantomevm: _a.PhantomProvider,
199
+ superb: _a.SuperbProvider,
193
200
  trust: _a.TrustWalletProvider,
194
201
  zerion: _a.ZerionProvider,
195
202
  };
@@ -15,6 +15,7 @@ export declare class EthProviderHelper {
15
15
  static TrustWalletProvider: Provider;
16
16
  static PhantomProvider: Provider;
17
17
  static ZerionProvider: Provider;
18
+ static SuperbProvider: Provider;
18
19
  static UnknownInjectedProvider: Provider;
19
20
  static providers: {
20
21
  [wallet: string]: Provider;
@@ -28,6 +28,9 @@ class EthProviderHelper {
28
28
  if (window.zerionWallet) {
29
29
  ethereumProviders.push(window.zerionWallet);
30
30
  }
31
+ if (window.superb) {
32
+ ethereumProviders.push(window.superb);
33
+ }
31
34
  return ethereumProviders;
32
35
  }
33
36
  static isInstalledHelper(walletName) {
@@ -149,6 +152,7 @@ _a.installedProviderLookup([
149
152
  { flag: 'isPhantom', value: false },
150
153
  { flag: 'isZerion', value: false },
151
154
  { flag: 'isMetaMask', value: true },
155
+ { flag: 'isSuperb', value: false },
152
156
  ]);
153
157
  EthProviderHelper.BraveProvider = () => _a.installedProviderLookup([{ flag: 'isBraveWallet', value: true }]);
154
158
  EthProviderHelper.DawnProvider = () => _a.installedProviderLookup([{ flag: 'isDawn', value: true }]);
@@ -161,6 +165,7 @@ EthProviderHelper.BloctoProvider = () => _a.installedProviderLookup([{ flag: 'is
161
165
  EthProviderHelper.TrustWalletProvider = () => _a.installedProviderLookup([{ flag: 'isTrustWallet', value: true }]);
162
166
  EthProviderHelper.PhantomProvider = () => _a.installedProviderLookup([{ flag: 'isPhantom', value: true }]);
163
167
  EthProviderHelper.ZerionProvider = () => _a.installedProviderLookup([{ flag: 'isZerion', value: true }]);
168
+ EthProviderHelper.SuperbProvider = () => _a.installedProviderLookup([{ flag: 'isSuperb', value: true }]);
164
169
  EthProviderHelper.UnknownInjectedProvider = () => _a.installedProviderLookup([
165
170
  { flag: 'isMetaMask', value: false },
166
171
  { flag: 'isExodus', value: false },
@@ -173,6 +178,7 @@ EthProviderHelper.UnknownInjectedProvider = () => _a.installedProviderLookup([
173
178
  { flag: 'isTrustWallet', value: false },
174
179
  { flag: 'isPhantom', value: false },
175
180
  { flag: 'isZerion', value: false },
181
+ { flag: 'isSuperb', value: false },
176
182
  ]);
177
183
  EthProviderHelper.providers = {
178
184
  bloctoinjected: _a.BloctoProvider,
@@ -186,6 +192,7 @@ EthProviderHelper.providers = {
186
192
  metamask: _a.MetamaskProvider,
187
193
  opera: _a.OperaProvider,
188
194
  phantomevm: _a.PhantomProvider,
195
+ superb: _a.SuperbProvider,
189
196
  trust: _a.TrustWalletProvider,
190
197
  zerion: _a.ZerionProvider,
191
198
  };
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var InjectedWalletBase = require('./InjectedWalletBase.cjs');
6
+
7
+ class Superb extends InjectedWalletBase {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.name = 'Superb';
11
+ }
12
+ }
13
+
14
+ exports.Superb = Superb;
@@ -0,0 +1,4 @@
1
+ import InjectedWalletBase from './InjectedWalletBase';
2
+ export declare class Superb extends InjectedWalletBase {
3
+ name: string;
4
+ }
@@ -0,0 +1,10 @@
1
+ import InjectedWalletBase from './InjectedWalletBase.js';
2
+
3
+ class Superb extends InjectedWalletBase {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.name = 'Superb';
7
+ }
8
+ }
9
+
10
+ export { Superb };
@@ -14,6 +14,7 @@ var PhantomEvm = require('./PhantomEvm.cjs');
14
14
  var Trust = require('./Trust.cjs');
15
15
  var UnknownInjectedWallet = require('./UnknownInjectedWallet.cjs');
16
16
  var Zerion = require('./Zerion.cjs');
17
+ var Superb = require('./Superb.cjs');
17
18
 
18
19
  const injectedWallets = [
19
20
  BloctoInjected.BloctoInjected,
@@ -28,6 +29,7 @@ const injectedWallets = [
28
29
  Trust.Trust,
29
30
  UnknownInjectedWallet.UnknownInjectedWallet,
30
31
  Zerion.Zerion,
32
+ Superb.Superb,
31
33
  ];
32
34
 
33
35
  exports.BloctoInjected = BloctoInjected.BloctoInjected;
@@ -22,6 +22,7 @@ import { UnknownInjectedWallet } from './UnknownInjectedWallet.js';
22
22
  export { UnknownInjectedWallet } from './UnknownInjectedWallet.js';
23
23
  import { Zerion } from './Zerion.js';
24
24
  export { Zerion } from './Zerion.js';
25
+ import { Superb } from './Superb.js';
25
26
 
26
27
  const injectedWallets = [
27
28
  BloctoInjected,
@@ -36,6 +37,7 @@ const injectedWallets = [
36
37
  Trust,
37
38
  UnknownInjectedWallet,
38
39
  Zerion,
40
+ Superb,
39
41
  ];
40
42
 
41
43
  export { injectedWallets };
package/src/types.d.ts CHANGED
@@ -7,6 +7,7 @@ declare global {
7
7
  ethereum?: IEthereum;
8
8
  phantom?: IWindowPhantom;
9
9
  zerionWallet?: IEthereum;
10
+ superb?: IEthereum;
10
11
  }
11
12
  }
12
13
  export type IEthereum = {
@@ -17,5 +18,5 @@ export type IEthereum = {
17
18
  method: T;
18
19
  } | object) => Promise<T extends 'eth_requestAccounts' ? [string] : object>;
19
20
  };
20
- export type ProviderFlag = 'isDawn' | 'isBraveWallet' | 'isCoinbaseWallet' | 'isFrame' | 'isGamestop' | 'isMetaMask' | 'isExodus' | 'isOpera' | 'isBlocto' | 'isTrustWallet' | 'isZerion' | 'isPhantom';
21
+ export type ProviderFlag = 'isDawn' | 'isBraveWallet' | 'isCoinbaseWallet' | 'isFrame' | 'isGamestop' | 'isMetaMask' | 'isExodus' | 'isOpera' | 'isBlocto' | 'isTrustWallet' | 'isZerion' | 'isPhantom' | 'isSuperb';
21
22
  export type EthProviderCondition = ProviderCondition<ProviderFlag>;
@@ -25,14 +25,11 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
25
25
  this.name = opts.walletName;
26
26
  this.projectId = opts.projectId;
27
27
  }
28
- initProvider() {
28
+ initConnection() {
29
29
  return _tslib.__awaiter(this, void 0, void 0, function* () {
30
- let { provider } = WalletConnectV2;
30
+ const { provider } = WalletConnectV2;
31
31
  if (!provider) {
32
- provider = yield Provider__default["default"].init({
33
- projectId: this.projectId,
34
- });
35
- WalletConnectV2.provider = provider;
32
+ throw new utils.DynamicError('No provider found (init connection)');
36
33
  }
37
34
  // this means there is already a connection in progress, so don't call connect again
38
35
  if (provider === null || provider === void 0 ? void 0 : provider.uri) {
@@ -59,16 +56,30 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
59
56
  });
60
57
  });
61
58
  }
62
- init() {
59
+ initProvider() {
60
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
61
+ let { provider } = WalletConnectV2;
62
+ if (!provider) {
63
+ provider = yield Provider__default["default"].init({
64
+ projectId: this.projectId,
65
+ });
66
+ WalletConnectV2.provider = provider;
67
+ }
68
+ });
69
+ }
70
+ refreshSession() {
63
71
  var _a, _b, _c, _d;
72
+ if ((_b = (_a = WalletConnectV2.provider) === null || _a === void 0 ? void 0 : _a.session) === null || _b === void 0 ? void 0 : _b.topic) {
73
+ if (localStorage.getItem(this.sessionTopicKey) ===
74
+ ((_d = (_c = WalletConnectV2.provider) === null || _c === void 0 ? void 0 : _c.session) === null || _d === void 0 ? void 0 : _d.topic)) {
75
+ this.session = WalletConnectV2.provider.session;
76
+ }
77
+ }
78
+ }
79
+ init() {
64
80
  return _tslib.__awaiter(this, void 0, void 0, function* () {
65
81
  yield this.initProvider();
66
- if ((_b = (_a = WalletConnectV2.provider) === null || _a === void 0 ? void 0 : _a.session) === null || _b === void 0 ? void 0 : _b.topic) {
67
- if (localStorage.getItem(this.sessionTopicKey) ===
68
- ((_d = (_c = WalletConnectV2.provider) === null || _c === void 0 ? void 0 : _c.session) === null || _d === void 0 ? void 0 : _d.topic)) {
69
- this.session = WalletConnectV2.provider.session;
70
- }
71
- }
82
+ yield this.initConnection();
72
83
  });
73
84
  }
74
85
  get sessionTopicKey() {
@@ -234,6 +245,8 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
234
245
  }
235
246
  getConnectedAccounts() {
236
247
  return _tslib.__awaiter(this, void 0, void 0, function* () {
248
+ yield this.initProvider();
249
+ this.refreshSession();
237
250
  if (!this.session) {
238
251
  return [];
239
252
  }
@@ -17,7 +17,9 @@ export declare class WalletConnectV2 extends EthWalletConnector {
17
17
  private static provider;
18
18
  private projectId?;
19
19
  constructor(opts: WalletConnectorV2Opts);
20
+ private initConnection;
20
21
  private initProvider;
22
+ private refreshSession;
21
23
  init(): Promise<void>;
22
24
  get sessionTopicKey(): string;
23
25
  supportsNetworkSwitching(): boolean;
@@ -3,7 +3,7 @@ import Provider from '@walletconnect/universal-provider';
3
3
  import { ethers } from 'ethers';
4
4
  import { logger, getDeepLink, performPlatformSpecificConnectionMethod, utf8ToHex } from '@dynamic-labs/wallet-connector-core';
5
5
  import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
6
- import { isMobile, DynamicError } from '@dynamic-labs/utils';
6
+ import { DynamicError, isMobile } from '@dynamic-labs/utils';
7
7
  import { EthWalletConnector } from '../EthWalletConnector.js';
8
8
 
9
9
  const sessionTopicKey = (walletName) => `dynamic-wc2-session-topic-${walletName}`;
@@ -17,14 +17,11 @@ class WalletConnectV2 extends EthWalletConnector {
17
17
  this.name = opts.walletName;
18
18
  this.projectId = opts.projectId;
19
19
  }
20
- initProvider() {
20
+ initConnection() {
21
21
  return __awaiter(this, void 0, void 0, function* () {
22
- let { provider } = WalletConnectV2;
22
+ const { provider } = WalletConnectV2;
23
23
  if (!provider) {
24
- provider = yield Provider.init({
25
- projectId: this.projectId,
26
- });
27
- WalletConnectV2.provider = provider;
24
+ throw new DynamicError('No provider found (init connection)');
28
25
  }
29
26
  // this means there is already a connection in progress, so don't call connect again
30
27
  if (provider === null || provider === void 0 ? void 0 : provider.uri) {
@@ -51,16 +48,30 @@ class WalletConnectV2 extends EthWalletConnector {
51
48
  });
52
49
  });
53
50
  }
54
- init() {
51
+ initProvider() {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ let { provider } = WalletConnectV2;
54
+ if (!provider) {
55
+ provider = yield Provider.init({
56
+ projectId: this.projectId,
57
+ });
58
+ WalletConnectV2.provider = provider;
59
+ }
60
+ });
61
+ }
62
+ refreshSession() {
55
63
  var _a, _b, _c, _d;
64
+ if ((_b = (_a = WalletConnectV2.provider) === null || _a === void 0 ? void 0 : _a.session) === null || _b === void 0 ? void 0 : _b.topic) {
65
+ if (localStorage.getItem(this.sessionTopicKey) ===
66
+ ((_d = (_c = WalletConnectV2.provider) === null || _c === void 0 ? void 0 : _c.session) === null || _d === void 0 ? void 0 : _d.topic)) {
67
+ this.session = WalletConnectV2.provider.session;
68
+ }
69
+ }
70
+ }
71
+ init() {
56
72
  return __awaiter(this, void 0, void 0, function* () {
57
73
  yield this.initProvider();
58
- if ((_b = (_a = WalletConnectV2.provider) === null || _a === void 0 ? void 0 : _a.session) === null || _b === void 0 ? void 0 : _b.topic) {
59
- if (localStorage.getItem(this.sessionTopicKey) ===
60
- ((_d = (_c = WalletConnectV2.provider) === null || _c === void 0 ? void 0 : _c.session) === null || _d === void 0 ? void 0 : _d.topic)) {
61
- this.session = WalletConnectV2.provider.session;
62
- }
63
- }
74
+ yield this.initConnection();
64
75
  });
65
76
  }
66
77
  get sessionTopicKey() {
@@ -226,6 +237,8 @@ class WalletConnectV2 extends EthWalletConnector {
226
237
  }
227
238
  getConnectedAccounts() {
228
239
  return __awaiter(this, void 0, void 0, function* () {
240
+ yield this.initProvider();
241
+ this.refreshSession();
229
242
  if (!this.session) {
230
243
  return [];
231
244
  }