@dynamic-labs/ethereum 0.19.0-alpha.0 → 0.19.0-alpha.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 +78 -0
- package/package.json +6 -6
- package/src/EthWalletConnector.d.ts +3 -1
- package/src/ethProviderHelper.cjs +7 -4
- package/src/ethProviderHelper.d.ts +1 -1
- package/src/ethProviderHelper.js +7 -4
- package/src/index.cjs +2 -2
- package/src/index.js +1 -1
- package/src/injected/ExodusEvm.cjs +1 -0
- package/src/injected/ExodusEvm.d.ts +1 -0
- package/src/injected/ExodusEvm.js +1 -0
- package/src/injected/OKX.cjs +15 -0
- package/src/injected/OKX.d.ts +5 -0
- package/src/injected/OKX.js +11 -0
- package/src/injected/index.cjs +3 -3
- package/src/injected/index.d.ts +1 -1
- package/src/injected/index.js +3 -3
- package/src/types.d.ts +2 -1
- package/src/walletConnect/fetchWalletConnectWallets.cjs +2 -1
- package/src/walletConnect/fetchWalletConnectWallets.js +2 -1
- package/src/walletConnect/walletConnectV2.cjs +7 -12
- package/src/walletConnect/walletConnectV2.d.ts +2 -2
- package/src/walletConnect/walletConnectV2.js +7 -12
- package/src/injected/BackpackEvm.cjs +0 -25
- package/src/injected/BackpackEvm.d.ts +0 -5
- package/src/injected/BackpackEvm.js +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,82 @@
|
|
|
1
1
|
|
|
2
|
+
## [0.19.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.1...v0.19.0-alpha.2) (2023-08-21)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* useSocialAccounts: error type changed from string to SocialOAuthError:
|
|
8
|
+
export type SocialOAuthError = {
|
|
9
|
+
code: SocialOAuthErrorCode;
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add ErrorPage when user tries to transfer the last wallet out account when preventOrphanedAccounts is true ([#2919](https://github.com/dynamic-labs/DynamicAuth/issues/2919)) ([7144211](https://github.com/dynamic-labs/DynamicAuth/commit/71442116851ddb22911b7809b45f9c3a49989fdf)), closes [#2924](https://github.com/dynamic-labs/DynamicAuth/issues/2924) [#2956](https://github.com/dynamic-labs/DynamicAuth/issues/2956) [#2960](https://github.com/dynamic-labs/DynamicAuth/issues/2960)
|
|
16
|
+
* add onEmailVerificationX callbacks ([#2859](https://github.com/dynamic-labs/DynamicAuth/issues/2859)) ([1c1c66d](https://github.com/dynamic-labs/DynamicAuth/commit/1c1c66dc47fb1966a2ef8102957dd06b42c9f7dc))
|
|
17
|
+
* add UserFieldEditorView component ([#2873](https://github.com/dynamic-labs/DynamicAuth/issues/2873)) ([7a6d1d7](https://github.com/dynamic-labs/DynamicAuth/commit/7a6d1d7057422e4ff5f4efebbf8f08eb7398c51d))
|
|
18
|
+
* e2e refresh on unsupported network ([#2915](https://github.com/dynamic-labs/DynamicAuth/issues/2915)) ([8504c73](https://github.com/dynamic-labs/DynamicAuth/commit/8504c73d75a057c695fe86b25d8bf42ff071efb4))
|
|
19
|
+
* introduces updateUserWithModal ([#2972](https://github.com/dynamic-labs/DynamicAuth/issues/2972)) ([883f500](https://github.com/dynamic-labs/DynamicAuth/commit/883f500f35e5db9dcaf073e049f67672e0115670))
|
|
20
|
+
* update wallet locked view ([#2892](https://github.com/dynamic-labs/DynamicAuth/issues/2892)) ([e3aaaca](https://github.com/dynamic-labs/DynamicAuth/commit/e3aaaca50c6335498b9e3938674b37524a001b49))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* input's css hiding submit button and label on autocomplete ([#2916](https://github.com/dynamic-labs/DynamicAuth/issues/2916)) ([d07acfc](https://github.com/dynamic-labs/DynamicAuth/commit/d07acfc627dd72fea690c0492190c995be9e6b2c))
|
|
26
|
+
* always enable magic connectors when enabled ([#3014](https://github.com/dynamic-labs/DynamicAuth/issues/3014)) ([ce33b43](https://github.com/dynamic-labs/DynamicAuth/commit/ce33b4336397d5d77863ce32746dc4e975d16f6a))
|
|
27
|
+
* **captcha:** complete sign in with magic and blocto ([#2967](https://github.com/dynamic-labs/DynamicAuth/issues/2967)) ([07e4cf7](https://github.com/dynamic-labs/DynamicAuth/commit/07e4cf7d3f8158e04ed6f78d1cc11b499da50eea))
|
|
28
|
+
* ensure social sign in embedded wallets sync correctly with wagmi ([#3043](https://github.com/dynamic-labs/DynamicAuth/issues/3043)) ([e139d38](https://github.com/dynamic-labs/DynamicAuth/commit/e139d38056bc2f20adbeff458ff6a9731e44a677))
|
|
29
|
+
* fix twitter linking ([#2918](https://github.com/dynamic-labs/DynamicAuth/issues/2918)) ([1511924](https://github.com/dynamic-labs/DynamicAuth/commit/1511924c89bb3bc12a290695a43f5db9e7d475f4))
|
|
30
|
+
* guard against null or undefined provider value when logging in with magic ([#3021](https://github.com/dynamic-labs/DynamicAuth/issues/3021)) ([7c1580a](https://github.com/dynamic-labs/DynamicAuth/commit/7c1580a782f0d6b30931a7f9c84f96416a7236cf))
|
|
31
|
+
* **GVTY-195:** issues with mergeUserAccountsView ([#2943](https://github.com/dynamic-labs/DynamicAuth/issues/2943)) ([b290132](https://github.com/dynamic-labs/DynamicAuth/commit/b29013269df539b4901f1f5fc688905f0f50548e))
|
|
32
|
+
* issue where walletconnectors are instantiated without walletbook ([#3020](https://github.com/dynamic-labs/DynamicAuth/issues/3020)) ([bb91c24](https://github.com/dynamic-labs/DynamicAuth/commit/bb91c24d4f03966f96c960eb04891846807ed49d))
|
|
33
|
+
* **Magic:** improve gas estimate for transactions ([#2929](https://github.com/dynamic-labs/DynamicAuth/issues/2929)) ([13dcb7a](https://github.com/dynamic-labs/DynamicAuth/commit/13dcb7a40a75e088fea81d51865dddf5391bcf83))
|
|
34
|
+
* missing enable isVerificationInProgress ([#2893](https://github.com/dynamic-labs/DynamicAuth/issues/2893)) ([bcd76a5](https://github.com/dynamic-labs/DynamicAuth/commit/bcd76a5b55f9e85872ff3dd9f5353b39ca47053b))
|
|
35
|
+
* **networks:** merge custom network after API networks ([#2925](https://github.com/dynamic-labs/DynamicAuth/issues/2925)) ([c2f53ca](https://github.com/dynamic-labs/DynamicAuth/commit/c2f53ca9ee3485ed26be4e7d7d255dbdb5a952d4))
|
|
36
|
+
* onBeforeConnectSuccessConfirmation is being called multiple times on network change ([#2917](https://github.com/dynamic-labs/DynamicAuth/issues/2917)) ([f873ca4](https://github.com/dynamic-labs/DynamicAuth/commit/f873ca47118796f277e37f5decf810503ee740bd))
|
|
37
|
+
* only use the production api environment of magicLink ([#3022](https://github.com/dynamic-labs/DynamicAuth/issues/3022)) ([cd86753](https://github.com/dynamic-labs/DynamicAuth/commit/cd867534262b8f77f5fa37344182181a7ea8d3c2))
|
|
38
|
+
* **QNTM-249:** broken email update when user is authenticated ([#2931](https://github.com/dynamic-labs/DynamicAuth/issues/2931)) ([5471ab1](https://github.com/dynamic-labs/DynamicAuth/commit/5471ab1b51f9bffdf1e36e1c2fac1fb9af06a067))
|
|
39
|
+
* reformat social sign-in text ([#2956](https://github.com/dynamic-labs/DynamicAuth/issues/2956)) ([0e149db](https://github.com/dynamic-labs/DynamicAuth/commit/0e149db5b661347145928f4de6ce932604ed7184))
|
|
40
|
+
* remove unused provider variable from OKX.spec.ts ([#2959](https://github.com/dynamic-labs/DynamicAuth/issues/2959)) ([6bc9d4d](https://github.com/dynamic-labs/DynamicAuth/commit/6bc9d4d51795ff46779650d929d8e0df3179e0b1))
|
|
41
|
+
* set error if user closes oauth window or if it times out ([#3050](https://github.com/dynamic-labs/DynamicAuth/issues/3050)) ([ef2b189](https://github.com/dynamic-labs/DynamicAuth/commit/ef2b189cbf650bf82382e538e7ce653fb677a22f))
|
|
42
|
+
* switching network in connected state should update wallets to connect list ([#2989](https://github.com/dynamic-labs/DynamicAuth/issues/2989)) ([f0553fd](https://github.com/dynamic-labs/DynamicAuth/commit/f0553fd24c27204e9ec7b7c12d6589ce92910553))
|
|
43
|
+
* sync wagmi correctly in connect-only mode ([#2990](https://github.com/dynamic-labs/DynamicAuth/issues/2990)) ([d15b6d5](https://github.com/dynamic-labs/DynamicAuth/commit/d15b6d5eb7349e872138d4394a1a155fdb67e6b4))
|
|
44
|
+
* **transactions:** send transaction with auto nonce ([#3049](https://github.com/dynamic-labs/DynamicAuth/issues/3049)) ([769cdce](https://github.com/dynamic-labs/DynamicAuth/commit/769cdce50fba786c94ac139fc031073513bbec3a))
|
|
45
|
+
* use ETH currency symbol for STARK chains ([#3005](https://github.com/dynamic-labs/DynamicAuth/issues/3005)) ([a43f184](https://github.com/dynamic-labs/DynamicAuth/commit/a43f184121463844a0934189290c8251db36d3dc))
|
|
46
|
+
* useSyncPrimaryWallet overrides views with "wallet-locked-view" ([#2861](https://github.com/dynamic-labs/DynamicAuth/issues/2861)) ([a21d9e4](https://github.com/dynamic-labs/DynamicAuth/commit/a21d9e42a900201b8f4039038ced50d59c763e8a))
|
|
47
|
+
* **wallet-list:** update key to distinguish wallet and wallet group ([#2909](https://github.com/dynamic-labs/DynamicAuth/issues/2909)) ([ce5055f](https://github.com/dynamic-labs/DynamicAuth/commit/ce5055febab9b8a479505d3f21b1cdf2b5091fd7))
|
|
48
|
+
|
|
49
|
+
## [0.19.0-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.0...v0.19.0-alpha.1) (2023-08-10)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Features
|
|
53
|
+
|
|
54
|
+
* cleaning up email input field - delete continue button ([#2833](https://github.com/dynamic-labs/DynamicAuth/issues/2833)) ([baa399e](https://github.com/dynamic-labs/DynamicAuth/commit/baa399e387bce9570a7e7774d68dc3c92f86be1b))
|
|
55
|
+
* disable social buttons after provider is selected ([#2875](https://github.com/dynamic-labs/DynamicAuth/issues/2875)) ([6296ce1](https://github.com/dynamic-labs/DynamicAuth/commit/6296ce13062a8589cf6fb4741957dc9bf84552a2))
|
|
56
|
+
* **GVTY-65:** Allow Merging accounts when duplicated email in KYC step ([#2772](https://github.com/dynamic-labs/DynamicAuth/issues/2772)) ([8efb6ae](https://github.com/dynamic-labs/DynamicAuth/commit/8efb6aecc9445ef1798a5c6358eac27b16f661b6))
|
|
57
|
+
* hide network from nav if hideNetworkInDynamicWidget setting is true ([#2842](https://github.com/dynamic-labs/DynamicAuth/issues/2842)) ([f3dc9ba](https://github.com/dynamic-labs/DynamicAuth/commit/f3dc9ba987781d5d0540336f351bb9f148400eac))
|
|
58
|
+
* show email submit button on focus ([#2860](https://github.com/dynamic-labs/DynamicAuth/issues/2860)) ([87d8ae0](https://github.com/dynamic-labs/DynamicAuth/commit/87d8ae0806425a25835efda5f9b9abc58e5de18e))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Bug Fixes
|
|
62
|
+
|
|
63
|
+
* account already exist message not displaying automatically ([#2896](https://github.com/dynamic-labs/DynamicAuth/issues/2896)) ([ba56c93](https://github.com/dynamic-labs/DynamicAuth/commit/ba56c936546428b0a1111ab5ef6e8d0d9a463bb5))
|
|
64
|
+
* array of dynamicWagmiSettings not being sent, must be turned into object ([#2835](https://github.com/dynamic-labs/DynamicAuth/issues/2835)) ([092c45a](https://github.com/dynamic-labs/DynamicAuth/commit/092c45afd3676fbd7c3d28f51818470de7f95768))
|
|
65
|
+
* change network modal doesn't pop on secondary wallet, when primaryWallet was disconnected ([#2817](https://github.com/dynamic-labs/DynamicAuth/issues/2817)) ([b68c156](https://github.com/dynamic-labs/DynamicAuth/commit/b68c1565f936d2f4275b104a0881ba5720101abd))
|
|
66
|
+
* connectSuccess callback is not being called when connecting new wallet after unlink ([#2814](https://github.com/dynamic-labs/DynamicAuth/issues/2814)) ([d5b34d8](https://github.com/dynamic-labs/DynamicAuth/commit/d5b34d8a073436ce39280766608578fd97567fac))
|
|
67
|
+
* css variables are being ignored for ConnectButton component ([#2869](https://github.com/dynamic-labs/DynamicAuth/issues/2869)) ([a54fb46](https://github.com/dynamic-labs/DynamicAuth/commit/a54fb46648758001450a33e6d86cf04765507701))
|
|
68
|
+
* css variables for the ConnectButton are being ignored ([#2856](https://github.com/dynamic-labs/DynamicAuth/issues/2856)) ([65a342f](https://github.com/dynamic-labs/DynamicAuth/commit/65a342f828b6a16f714fc6b6e2066e1b742b2c0a))
|
|
69
|
+
* don't let user update email if it's linked to an embedded wallet ([#2883](https://github.com/dynamic-labs/DynamicAuth/issues/2883)) ([99aa303](https://github.com/dynamic-labs/DynamicAuth/commit/99aa3033e62c0dee14657cb811db8d5b3597f7de))
|
|
70
|
+
* **GVTY-150:** blocto pop up to sign after disconnect ([#2854](https://github.com/dynamic-labs/DynamicAuth/issues/2854)) ([df5481b](https://github.com/dynamic-labs/DynamicAuth/commit/df5481b2d5438848ad96cdee402f40b520bead08))
|
|
71
|
+
* **GVTY-155:** update to the new design ([#2889](https://github.com/dynamic-labs/DynamicAuth/issues/2889)) ([31f7f54](https://github.com/dynamic-labs/DynamicAuth/commit/31f7f54444c623fe7d5bcf8a42f94ee22eedc3e1))
|
|
72
|
+
* **GVTY-159:** email update view not showing email used error ([#2887](https://github.com/dynamic-labs/DynamicAuth/issues/2887)) ([bd40e4c](https://github.com/dynamic-labs/DynamicAuth/commit/bd40e4c77cda42752d44e42b98bfcea4cfd77a80))
|
|
73
|
+
* **OTPOverviewView:** enable close only on close button click ([#2877](https://github.com/dynamic-labs/DynamicAuth/issues/2877)) ([2be23e7](https://github.com/dynamic-labs/DynamicAuth/commit/2be23e7ddefe67c971d863ad9069ac5b8a74f4e5))
|
|
74
|
+
* **transaction:** improve gas estimate in transaction confirmation ([#2767](https://github.com/dynamic-labs/DynamicAuth/issues/2767)) ([7180ae5](https://github.com/dynamic-labs/DynamicAuth/commit/7180ae50559f924ae9769b2b8d87eadc6604c754))
|
|
75
|
+
* use findSocialIcon instead getSocialIcon to avoid render errors ([#2834](https://github.com/dynamic-labs/DynamicAuth/issues/2834)) ([2c57f98](https://github.com/dynamic-labs/DynamicAuth/commit/2c57f98fd5c461ae4acbe2836f719ebe18bc21fc))
|
|
76
|
+
* **useWalletConnectorEvent:** ensure connector is initialized ([#2849](https://github.com/dynamic-labs/DynamicAuth/issues/2849)) ([9137131](https://github.com/dynamic-labs/DynamicAuth/commit/913713166af8a6e6cc15a8e362e57b328fc0a76f))
|
|
77
|
+
* **wcv2:** simulate chain change event in switchNetwork ([#2809](https://github.com/dynamic-labs/DynamicAuth/issues/2809)) ([2329b80](https://github.com/dynamic-labs/DynamicAuth/commit/2329b808f57644cebb664be536bc41e256d108d8))
|
|
78
|
+
* wrong wallet list is showing after disconnecting and network change ([#2815](https://github.com/dynamic-labs/DynamicAuth/issues/2815)) ([6cae101](https://github.com/dynamic-labs/DynamicAuth/commit/6cae1019f40be4ffe7ab0426aa159c652a770a82))
|
|
79
|
+
|
|
2
80
|
## [0.19.0-alpha.0](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.25...v0.19.0-alpha.0) (2023-08-01)
|
|
3
81
|
|
|
4
82
|
## [0.18.0-RC.25](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.24...v0.18.0-RC.25) (2023-08-01)
|
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.2",
|
|
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.2",
|
|
36
|
+
"@dynamic-labs/types": "0.19.0-alpha.2",
|
|
37
|
+
"@dynamic-labs/utils": "0.19.0-alpha.2",
|
|
38
|
+
"@dynamic-labs/wallet-book": "0.19.0-alpha.2",
|
|
39
|
+
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.2",
|
|
40
40
|
"@ethersproject/providers": "5.7.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {}
|
|
@@ -2,6 +2,7 @@ import { ethers } from 'ethers';
|
|
|
2
2
|
import { NameServiceData, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
import { EvmNetwork, GenericNetwork } from '@dynamic-labs/types';
|
|
4
4
|
import { ChainRpcProviders } from '@dynamic-labs/rpc-providers';
|
|
5
|
+
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
5
6
|
export type SwitchNetworkOps = {
|
|
6
7
|
networkChainId?: number;
|
|
7
8
|
networkName?: string;
|
|
@@ -13,6 +14,7 @@ export type EthWalletConnectorOpts = {
|
|
|
13
14
|
chainRpcProviders: typeof ChainRpcProviders;
|
|
14
15
|
evmNetworks: GenericNetwork[];
|
|
15
16
|
isWalletConnectV2Enabled?: boolean;
|
|
17
|
+
walletBook: WalletBookSchema;
|
|
16
18
|
};
|
|
17
19
|
export declare abstract class EthWalletConnector extends WalletConnectorBase {
|
|
18
20
|
evmNetworks: EvmNetwork[];
|
|
@@ -26,7 +28,7 @@ export declare abstract class EthWalletConnector extends WalletConnectorBase {
|
|
|
26
28
|
supportsNetworkSwitching(): boolean;
|
|
27
29
|
switchNetwork({ networkName, networkChainId, }: SwitchNetworkOps): Promise<void>;
|
|
28
30
|
getConnectedAccounts(): Promise<string[]>;
|
|
29
|
-
|
|
31
|
+
providerSwitchNetwork({ network, provider, }: {
|
|
30
32
|
network: EvmNetwork;
|
|
31
33
|
provider: ethers.providers.Web3Provider;
|
|
32
34
|
}): Promise<void>;
|
|
@@ -38,6 +38,9 @@ class EthProviderHelper {
|
|
|
38
38
|
if (window.superb) {
|
|
39
39
|
ethereumProviders.push(window.superb);
|
|
40
40
|
}
|
|
41
|
+
if (window.okxwallet) {
|
|
42
|
+
ethereumProviders.push(window.okxwallet);
|
|
43
|
+
}
|
|
41
44
|
return ethereumProviders;
|
|
42
45
|
}
|
|
43
46
|
static isInstalledHelper(walletName) {
|
|
@@ -161,7 +164,7 @@ _a.installedProviderLookup([
|
|
|
161
164
|
{ flag: 'isMetaMask', value: true },
|
|
162
165
|
{ flag: 'isSuperb', value: false },
|
|
163
166
|
{ flag: 'isRabby', value: false },
|
|
164
|
-
{ flag: '
|
|
167
|
+
{ flag: 'isOkxWallet', value: false },
|
|
165
168
|
]);
|
|
166
169
|
EthProviderHelper.BraveProvider = () => _a.installedProviderLookup([{ flag: 'isBraveWallet', value: true }]);
|
|
167
170
|
EthProviderHelper.DawnProvider = () => _a.installedProviderLookup([{ flag: 'isDawn', value: true }]);
|
|
@@ -176,7 +179,7 @@ EthProviderHelper.PhantomProvider = () => _a.installedProviderLookup([{ flag: 'i
|
|
|
176
179
|
EthProviderHelper.ZerionProvider = () => _a.installedProviderLookup([{ flag: 'isZerion', value: true }]);
|
|
177
180
|
EthProviderHelper.SuperbProvider = () => _a.installedProviderLookup([{ flag: 'isSuperb', value: true }]);
|
|
178
181
|
EthProviderHelper.RabbyProvider = () => _a.installedProviderLookup([{ flag: 'isRabby', value: true }]);
|
|
179
|
-
EthProviderHelper.
|
|
182
|
+
EthProviderHelper.OKXProvider = () => _a.installedProviderLookup([{ flag: 'isOkxWallet', value: true }]);
|
|
180
183
|
EthProviderHelper.UnknownInjectedProvider = () => _a.installedProviderLookup([
|
|
181
184
|
{ flag: 'isMetaMask', value: false },
|
|
182
185
|
{ flag: 'isExodus', value: false },
|
|
@@ -191,10 +194,9 @@ EthProviderHelper.UnknownInjectedProvider = () => _a.installedProviderLookup([
|
|
|
191
194
|
{ flag: 'isZerion', value: false },
|
|
192
195
|
{ flag: 'isSuperb', value: false },
|
|
193
196
|
{ flag: 'isRabby', value: false },
|
|
194
|
-
{ flag: '
|
|
197
|
+
{ flag: 'isOkxWallet', value: false },
|
|
195
198
|
]);
|
|
196
199
|
EthProviderHelper.providers = {
|
|
197
|
-
backpack: _a.BackpackProvider,
|
|
198
200
|
bloctoinjected: _a.BloctoProvider,
|
|
199
201
|
braveevm: _a.BraveProvider,
|
|
200
202
|
coinbase: _a.CoinbaseProvider,
|
|
@@ -204,6 +206,7 @@ EthProviderHelper.providers = {
|
|
|
204
206
|
gamestop: _a.GameStopProvider,
|
|
205
207
|
injectedwallet: _a.UnknownInjectedProvider,
|
|
206
208
|
metamask: _a.MetamaskProvider,
|
|
209
|
+
okxwallet: _a.OKXProvider,
|
|
207
210
|
opera: _a.OperaProvider,
|
|
208
211
|
phantomevm: _a.PhantomProvider,
|
|
209
212
|
rabby: _a.RabbyProvider,
|
|
@@ -17,7 +17,7 @@ export declare class EthProviderHelper {
|
|
|
17
17
|
static ZerionProvider: Provider;
|
|
18
18
|
static SuperbProvider: Provider;
|
|
19
19
|
static RabbyProvider: Provider;
|
|
20
|
-
static
|
|
20
|
+
static OKXProvider: Provider;
|
|
21
21
|
static UnknownInjectedProvider: Provider;
|
|
22
22
|
static providers: {
|
|
23
23
|
[wallet: string]: Provider;
|
package/src/ethProviderHelper.js
CHANGED
|
@@ -34,6 +34,9 @@ class EthProviderHelper {
|
|
|
34
34
|
if (window.superb) {
|
|
35
35
|
ethereumProviders.push(window.superb);
|
|
36
36
|
}
|
|
37
|
+
if (window.okxwallet) {
|
|
38
|
+
ethereumProviders.push(window.okxwallet);
|
|
39
|
+
}
|
|
37
40
|
return ethereumProviders;
|
|
38
41
|
}
|
|
39
42
|
static isInstalledHelper(walletName) {
|
|
@@ -157,7 +160,7 @@ _a.installedProviderLookup([
|
|
|
157
160
|
{ flag: 'isMetaMask', value: true },
|
|
158
161
|
{ flag: 'isSuperb', value: false },
|
|
159
162
|
{ flag: 'isRabby', value: false },
|
|
160
|
-
{ flag: '
|
|
163
|
+
{ flag: 'isOkxWallet', value: false },
|
|
161
164
|
]);
|
|
162
165
|
EthProviderHelper.BraveProvider = () => _a.installedProviderLookup([{ flag: 'isBraveWallet', value: true }]);
|
|
163
166
|
EthProviderHelper.DawnProvider = () => _a.installedProviderLookup([{ flag: 'isDawn', value: true }]);
|
|
@@ -172,7 +175,7 @@ EthProviderHelper.PhantomProvider = () => _a.installedProviderLookup([{ flag: 'i
|
|
|
172
175
|
EthProviderHelper.ZerionProvider = () => _a.installedProviderLookup([{ flag: 'isZerion', value: true }]);
|
|
173
176
|
EthProviderHelper.SuperbProvider = () => _a.installedProviderLookup([{ flag: 'isSuperb', value: true }]);
|
|
174
177
|
EthProviderHelper.RabbyProvider = () => _a.installedProviderLookup([{ flag: 'isRabby', value: true }]);
|
|
175
|
-
EthProviderHelper.
|
|
178
|
+
EthProviderHelper.OKXProvider = () => _a.installedProviderLookup([{ flag: 'isOkxWallet', value: true }]);
|
|
176
179
|
EthProviderHelper.UnknownInjectedProvider = () => _a.installedProviderLookup([
|
|
177
180
|
{ flag: 'isMetaMask', value: false },
|
|
178
181
|
{ flag: 'isExodus', value: false },
|
|
@@ -187,10 +190,9 @@ EthProviderHelper.UnknownInjectedProvider = () => _a.installedProviderLookup([
|
|
|
187
190
|
{ flag: 'isZerion', value: false },
|
|
188
191
|
{ flag: 'isSuperb', value: false },
|
|
189
192
|
{ flag: 'isRabby', value: false },
|
|
190
|
-
{ flag: '
|
|
193
|
+
{ flag: 'isOkxWallet', value: false },
|
|
191
194
|
]);
|
|
192
195
|
EthProviderHelper.providers = {
|
|
193
|
-
backpack: _a.BackpackProvider,
|
|
194
196
|
bloctoinjected: _a.BloctoProvider,
|
|
195
197
|
braveevm: _a.BraveProvider,
|
|
196
198
|
coinbase: _a.CoinbaseProvider,
|
|
@@ -200,6 +202,7 @@ EthProviderHelper.providers = {
|
|
|
200
202
|
gamestop: _a.GameStopProvider,
|
|
201
203
|
injectedwallet: _a.UnknownInjectedProvider,
|
|
202
204
|
metamask: _a.MetamaskProvider,
|
|
205
|
+
okxwallet: _a.OKXProvider,
|
|
203
206
|
opera: _a.OperaProvider,
|
|
204
207
|
phantomevm: _a.PhantomProvider,
|
|
205
208
|
rabby: _a.RabbyProvider,
|
package/src/index.cjs
CHANGED
|
@@ -28,7 +28,7 @@ var Trust = require('./injected/Trust.cjs');
|
|
|
28
28
|
var UnknownInjectedWallet = require('./injected/UnknownInjectedWallet.cjs');
|
|
29
29
|
var Zerion = require('./injected/Zerion.cjs');
|
|
30
30
|
var Rabby = require('./injected/Rabby.cjs');
|
|
31
|
-
var
|
|
31
|
+
var OKX = require('./injected/OKX.cjs');
|
|
32
32
|
|
|
33
33
|
const EthereumWalletConnectors = (props) => [
|
|
34
34
|
...index.injectedWallets,
|
|
@@ -53,5 +53,5 @@ exports.Trust = Trust.Trust;
|
|
|
53
53
|
exports.UnknownInjectedWallet = UnknownInjectedWallet.UnknownInjectedWallet;
|
|
54
54
|
exports.Zerion = Zerion.Zerion;
|
|
55
55
|
exports.Rabby = Rabby.Rabby;
|
|
56
|
-
exports.
|
|
56
|
+
exports.OKX = OKX.OKX;
|
|
57
57
|
exports.EthereumWalletConnectors = EthereumWalletConnectors;
|
package/src/index.js
CHANGED
|
@@ -25,7 +25,7 @@ export { Trust } from './injected/Trust.js';
|
|
|
25
25
|
export { UnknownInjectedWallet } from './injected/UnknownInjectedWallet.js';
|
|
26
26
|
export { Zerion } from './injected/Zerion.js';
|
|
27
27
|
export { Rabby } from './injected/Rabby.js';
|
|
28
|
-
export {
|
|
28
|
+
export { OKX } from './injected/OKX.js';
|
|
29
29
|
|
|
30
30
|
const EthereumWalletConnectors = (props) => [
|
|
31
31
|
...injectedWallets,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
6
|
+
|
|
7
|
+
class OKX extends InjectedWalletBase {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.name = 'OKX Wallet';
|
|
11
|
+
this.walletConnectorFallback = true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.OKX = OKX;
|
package/src/injected/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var UnknownInjectedWallet = require('./UnknownInjectedWallet.cjs');
|
|
|
16
16
|
var Zerion = require('./Zerion.cjs');
|
|
17
17
|
var Superb = require('./Superb.cjs');
|
|
18
18
|
var Rabby = require('./Rabby.cjs');
|
|
19
|
-
var
|
|
19
|
+
var OKX = require('./OKX.cjs');
|
|
20
20
|
|
|
21
21
|
const injectedWallets = [
|
|
22
22
|
BloctoInjected.BloctoInjected,
|
|
@@ -33,7 +33,7 @@ const injectedWallets = [
|
|
|
33
33
|
Zerion.Zerion,
|
|
34
34
|
Superb.Superb,
|
|
35
35
|
Rabby.Rabby,
|
|
36
|
-
|
|
36
|
+
OKX.OKX,
|
|
37
37
|
];
|
|
38
38
|
|
|
39
39
|
exports.BloctoInjected = BloctoInjected.BloctoInjected;
|
|
@@ -49,5 +49,5 @@ exports.Trust = Trust.Trust;
|
|
|
49
49
|
exports.UnknownInjectedWallet = UnknownInjectedWallet.UnknownInjectedWallet;
|
|
50
50
|
exports.Zerion = Zerion.Zerion;
|
|
51
51
|
exports.Rabby = Rabby.Rabby;
|
|
52
|
-
exports.
|
|
52
|
+
exports.OKX = OKX.OKX;
|
|
53
53
|
exports.injectedWallets = injectedWallets;
|
package/src/injected/index.d.ts
CHANGED
package/src/injected/index.js
CHANGED
|
@@ -25,8 +25,8 @@ export { Zerion } from './Zerion.js';
|
|
|
25
25
|
import { Superb } from './Superb.js';
|
|
26
26
|
import { Rabby } from './Rabby.js';
|
|
27
27
|
export { Rabby } from './Rabby.js';
|
|
28
|
-
import {
|
|
29
|
-
export {
|
|
28
|
+
import { OKX } from './OKX.js';
|
|
29
|
+
export { OKX } from './OKX.js';
|
|
30
30
|
|
|
31
31
|
const injectedWallets = [
|
|
32
32
|
BloctoInjected,
|
|
@@ -43,7 +43,7 @@ const injectedWallets = [
|
|
|
43
43
|
Zerion,
|
|
44
44
|
Superb,
|
|
45
45
|
Rabby,
|
|
46
|
-
|
|
46
|
+
OKX,
|
|
47
47
|
];
|
|
48
48
|
|
|
49
49
|
export { injectedWallets };
|
package/src/types.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ declare global {
|
|
|
9
9
|
zerionWallet?: IEthereum;
|
|
10
10
|
coinbaseWalletExtension?: IEthereum;
|
|
11
11
|
superb?: IEthereum;
|
|
12
|
+
okxwallet?: IEthereum;
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
export type IEthereum = {
|
|
@@ -19,5 +20,5 @@ export type IEthereum = {
|
|
|
19
20
|
method: T;
|
|
20
21
|
} | object) => Promise<T extends 'eth_requestAccounts' ? [string] : object>;
|
|
21
22
|
};
|
|
22
|
-
export type ProviderFlag = 'isDawn' | 'isBraveWallet' | 'isCoinbaseWallet' | 'isFrame' | 'isGamestop' | 'isMetaMask' | 'isExodus' | 'isOpera' | 'isBlocto' | 'isTrustWallet' | 'isZerion' | 'isPhantom' | 'isSuperb' | 'isRabby' | '
|
|
23
|
+
export type ProviderFlag = 'isDawn' | 'isBraveWallet' | 'isCoinbaseWallet' | 'isFrame' | 'isGamestop' | 'isMetaMask' | 'isExodus' | 'isOpera' | 'isBlocto' | 'isTrustWallet' | 'isZerion' | 'isPhantom' | 'isSuperb' | 'isRabby' | 'isOkxWallet';
|
|
23
24
|
export type EthProviderCondition = ProviderCondition<ProviderFlag>;
|
|
@@ -128,12 +128,11 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
128
128
|
supportsNetworkSwitching() {
|
|
129
129
|
return true;
|
|
130
130
|
}
|
|
131
|
-
setupEventListeners(
|
|
131
|
+
setupEventListeners() {
|
|
132
132
|
if (!WalletConnectV2.provider) {
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
135
|
WalletConnectV2.provider.client.on('session_event', ({ params }) => {
|
|
136
|
-
var _a, _b;
|
|
137
136
|
if (!params || !params.event) {
|
|
138
137
|
walletConnectorCore.logger.debug('session_event was called without params or params.event');
|
|
139
138
|
return;
|
|
@@ -145,7 +144,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
145
144
|
walletConnectorCore.logger.debug(`received unexpected data for chainChanged: ${data} with type ${typeof data}}`);
|
|
146
145
|
return;
|
|
147
146
|
}
|
|
148
|
-
(
|
|
147
|
+
this.emit('chainChange', { chain: String(chainId) });
|
|
149
148
|
// When a user switches network from their wallet, we need the provider to change network
|
|
150
149
|
// such that any future calls to `getNetwork` will return the correct network
|
|
151
150
|
this.switchNetwork({ networkChainId: chainId });
|
|
@@ -158,13 +157,12 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
158
157
|
// eslint-disable-next-line prefer-destructuring
|
|
159
158
|
const account = data[0].split(':')[2];
|
|
160
159
|
this.setActiveAccount(account);
|
|
161
|
-
(
|
|
160
|
+
this.emit('accountChange', { accounts: [account] });
|
|
162
161
|
}
|
|
163
162
|
});
|
|
164
163
|
WalletConnectV2.provider.client.on('session_delete', () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
165
|
-
var _a;
|
|
166
164
|
this.endSession();
|
|
167
|
-
|
|
165
|
+
this.emit('disconnect');
|
|
168
166
|
}));
|
|
169
167
|
}
|
|
170
168
|
teardownEventListeners() {
|
|
@@ -245,11 +243,7 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
245
243
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
246
244
|
const raceConditionPromise = new Promise((resolve) => {
|
|
247
245
|
// Create listener for chain change event
|
|
248
|
-
this.
|
|
249
|
-
onChainChange: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
250
|
-
resolve({ success: false });
|
|
251
|
-
}),
|
|
252
|
-
});
|
|
246
|
+
this.on('chainChange', () => resolve({ success: false }));
|
|
253
247
|
signMessageFn(messageToSign).then((result) => resolve({ signedMessage: result, success: true }));
|
|
254
248
|
});
|
|
255
249
|
const signedMessageResult = yield raceConditionPromise;
|
|
@@ -362,7 +356,8 @@ class WalletConnectV2 extends EthWalletConnector.EthWalletConnector {
|
|
|
362
356
|
if (!provider) {
|
|
363
357
|
throw new utils.DynamicError('Provider not found');
|
|
364
358
|
}
|
|
365
|
-
|
|
359
|
+
yield _super.providerSwitchNetwork.call(this, { network, provider });
|
|
360
|
+
this.emit('chainChange', { chain: String(network.chainId) });
|
|
366
361
|
});
|
|
367
362
|
}
|
|
368
363
|
getConnectedAccounts() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
2
|
import type { SessionTypes } from '@walletconnect/types';
|
|
3
|
-
import { Chain, FetchPublicAddressOpts
|
|
3
|
+
import { Chain, FetchPublicAddressOpts } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import { EvmNetwork } from '@dynamic-labs/types';
|
|
5
5
|
import { EthWalletConnector, EthWalletConnectorOpts } from '../EthWalletConnector';
|
|
6
6
|
export type WalletConnectorV2Opts = EthWalletConnectorOpts & {
|
|
@@ -28,7 +28,7 @@ export declare class WalletConnectV2 extends EthWalletConnector {
|
|
|
28
28
|
get sessionTopicKey(): string;
|
|
29
29
|
get activeAccountKey(): string;
|
|
30
30
|
supportsNetworkSwitching(): boolean;
|
|
31
|
-
setupEventListeners(
|
|
31
|
+
setupEventListeners(): void;
|
|
32
32
|
teardownEventListeners(): void;
|
|
33
33
|
getWeb3Provider(): ethers.providers.Web3Provider | undefined;
|
|
34
34
|
fetchPublicAddress(opts?: FetchPublicAddressOpts): Promise<string | undefined>;
|
|
@@ -119,12 +119,11 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
119
119
|
supportsNetworkSwitching() {
|
|
120
120
|
return true;
|
|
121
121
|
}
|
|
122
|
-
setupEventListeners(
|
|
122
|
+
setupEventListeners() {
|
|
123
123
|
if (!WalletConnectV2.provider) {
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
126
|
WalletConnectV2.provider.client.on('session_event', ({ params }) => {
|
|
127
|
-
var _a, _b;
|
|
128
127
|
if (!params || !params.event) {
|
|
129
128
|
logger.debug('session_event was called without params or params.event');
|
|
130
129
|
return;
|
|
@@ -136,7 +135,7 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
136
135
|
logger.debug(`received unexpected data for chainChanged: ${data} with type ${typeof data}}`);
|
|
137
136
|
return;
|
|
138
137
|
}
|
|
139
|
-
(
|
|
138
|
+
this.emit('chainChange', { chain: String(chainId) });
|
|
140
139
|
// When a user switches network from their wallet, we need the provider to change network
|
|
141
140
|
// such that any future calls to `getNetwork` will return the correct network
|
|
142
141
|
this.switchNetwork({ networkChainId: chainId });
|
|
@@ -149,13 +148,12 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
149
148
|
// eslint-disable-next-line prefer-destructuring
|
|
150
149
|
const account = data[0].split(':')[2];
|
|
151
150
|
this.setActiveAccount(account);
|
|
152
|
-
(
|
|
151
|
+
this.emit('accountChange', { accounts: [account] });
|
|
153
152
|
}
|
|
154
153
|
});
|
|
155
154
|
WalletConnectV2.provider.client.on('session_delete', () => __awaiter(this, void 0, void 0, function* () {
|
|
156
|
-
var _a;
|
|
157
155
|
this.endSession();
|
|
158
|
-
|
|
156
|
+
this.emit('disconnect');
|
|
159
157
|
}));
|
|
160
158
|
}
|
|
161
159
|
teardownEventListeners() {
|
|
@@ -236,11 +234,7 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
236
234
|
return __awaiter(this, void 0, void 0, function* () {
|
|
237
235
|
const raceConditionPromise = new Promise((resolve) => {
|
|
238
236
|
// Create listener for chain change event
|
|
239
|
-
this.
|
|
240
|
-
onChainChange: () => __awaiter(this, void 0, void 0, function* () {
|
|
241
|
-
resolve({ success: false });
|
|
242
|
-
}),
|
|
243
|
-
});
|
|
237
|
+
this.on('chainChange', () => resolve({ success: false }));
|
|
244
238
|
signMessageFn(messageToSign).then((result) => resolve({ signedMessage: result, success: true }));
|
|
245
239
|
});
|
|
246
240
|
const signedMessageResult = yield raceConditionPromise;
|
|
@@ -353,7 +347,8 @@ class WalletConnectV2 extends EthWalletConnector {
|
|
|
353
347
|
if (!provider) {
|
|
354
348
|
throw new DynamicError('Provider not found');
|
|
355
349
|
}
|
|
356
|
-
|
|
350
|
+
yield _super.providerSwitchNetwork.call(this, { network, provider });
|
|
351
|
+
this.emit('chainChange', { chain: String(network.chainId) });
|
|
357
352
|
});
|
|
358
353
|
}
|
|
359
354
|
getConnectedAccounts() {
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
6
|
-
var ethProviderHelper = require('../ethProviderHelper.cjs');
|
|
7
|
-
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
8
|
-
|
|
9
|
-
class BackpackEvm extends InjectedWalletBase {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
this.name = 'Backpack';
|
|
13
|
-
}
|
|
14
|
-
getConnectedAccounts() {
|
|
15
|
-
var _a;
|
|
16
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const provider = ethProviderHelper.EthProviderHelper.findProvider(this.name);
|
|
18
|
-
if (!provider)
|
|
19
|
-
return [];
|
|
20
|
-
return (_a = (yield provider.send('eth_requestAccounts', []))) !== null && _a !== void 0 ? _a : [];
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
exports.BackpackEvm = BackpackEvm;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
|
-
import { EthProviderHelper } from '../ethProviderHelper.js';
|
|
3
|
-
import InjectedWalletBase from './InjectedWalletBase.js';
|
|
4
|
-
|
|
5
|
-
class BackpackEvm extends InjectedWalletBase {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.name = 'Backpack';
|
|
9
|
-
}
|
|
10
|
-
getConnectedAccounts() {
|
|
11
|
-
var _a;
|
|
12
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
const provider = EthProviderHelper.findProvider(this.name);
|
|
14
|
-
if (!provider)
|
|
15
|
-
return [];
|
|
16
|
-
return (_a = (yield provider.send('eth_requestAccounts', []))) !== null && _a !== void 0 ? _a : [];
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { BackpackEvm };
|