@dynamic-labs/wagmi-connector 2.0.0-alpha.22 → 2.0.0-alpha.24
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 +53 -0
- package/package.json +6 -6
- package/src/lib/Connector.d.ts +9 -10
- package/src/lib/Connector.js +2 -9
- package/src/lib/DynamicWagmiConnector.js +15 -10
- package/src/lib/hooks/useConnectorId/index.d.ts +1 -0
- package/src/lib/hooks/useConnectorId/useConnectorId.d.ts +7 -0
- package/src/lib/hooks/useConnectorId/useConnectorId.js +23 -0
- package/src/lib/hooks/useFindEvmWallet/index.d.ts +1 -0
- package/src/lib/hooks/useFindEvmWallet/useFindEvmWallet.d.ts +2 -0
- package/src/lib/hooks/useFindEvmWallet/useFindEvmWallet.js +21 -0
- package/src/lib/utils/findAndOrderEvmWallets/findAndOrderEvmWallets.d.ts +0 -2
- package/src/lib/utils/findAndOrderEvmWallets/findAndOrderEvmWallets.js +0 -13
- package/src/lib/utils/findAndOrderEvmWallets/index.d.ts +0 -1
- package/src/lib/utils/index.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,57 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.0.0-alpha.24](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.23...v2.0.0-alpha.24) (2024-04-03)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* rename otp verification callbacks (#5180)
|
|
8
|
+
* remove deprecated isVerificationInProgress flag and setter (#5089)
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* allow creating embedded wallets even if user signs in with a wallet ([#5093](https://github.com/dynamic-labs/DynamicAuth/issues/5093)) ([ba2dd62](https://github.com/dynamic-labs/DynamicAuth/commit/ba2dd625e0a7bf35018cf8aac8e80bd23b4e3b0f))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* api unit test by removing api and sdk versions for assertion ([#5168](https://github.com/dynamic-labs/DynamicAuth/issues/5168)) ([6d3b8ad](https://github.com/dynamic-labs/DynamicAuth/commit/6d3b8adebe62a4f2a7878630384348b2c491d779))
|
|
18
|
+
* bug when phone input is empty ([#5139](https://github.com/dynamic-labs/DynamicAuth/issues/5139)) ([7155b63](https://github.com/dynamic-labs/DynamicAuth/commit/7155b63518d00ba807bc321c6740b341d0a8b82f))
|
|
19
|
+
* clear error message on otp resend for sms ([#5182](https://github.com/dynamic-labs/DynamicAuth/issues/5182)) ([f40b48c](https://github.com/dynamic-labs/DynamicAuth/commit/f40b48c7f58c8e3dfe73fb124d642c3b8f193cee))
|
|
20
|
+
* link farcaster account ([#5170](https://github.com/dynamic-labs/DynamicAuth/issues/5170)) ([10fe272](https://github.com/dynamic-labs/DynamicAuth/commit/10fe272247605b5f09385f063231e2c881399cc8))
|
|
21
|
+
* show correct otp message for sms verification failure ([#5177](https://github.com/dynamic-labs/DynamicAuth/issues/5177)) ([b3bcd76](https://github.com/dynamic-labs/DynamicAuth/commit/b3bcd7694047dac55ce37babb71684a418633f95))
|
|
22
|
+
* update wagmi connector id when wallet connector changes ([#5185](https://github.com/dynamic-labs/DynamicAuth/issues/5185)) ([14fb83a](https://github.com/dynamic-labs/DynamicAuth/commit/14fb83a22c8e39095b79cc9951cae3f00f4fca2f))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
* remove deprecated isVerificationInProgress flag and setter ([#5089](https://github.com/dynamic-labs/DynamicAuth/issues/5089)) ([060fef7](https://github.com/dynamic-labs/DynamicAuth/commit/060fef70df0c497e7a9b6e67ad0bfafef52c2bbb))
|
|
26
|
+
* rename otp verification callbacks ([#5180](https://github.com/dynamic-labs/DynamicAuth/issues/5180)) ([a580eec](https://github.com/dynamic-labs/DynamicAuth/commit/a580eec02d15b46a25c01d5473e4db2db89937e2))
|
|
27
|
+
|
|
28
|
+
## [2.0.0-alpha.23](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.22...v2.0.0-alpha.23) (2024-04-01)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### ⚠ BREAKING CHANGES
|
|
32
|
+
|
|
33
|
+
* implement proper solana embedded wallet signer (#5092)
|
|
34
|
+
* prevent adding temporary wallet connection to userWallets (#5104)
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* Multiple WC bug fixes ([#5142](https://github.com/dynamic-labs/DynamicAuth/issues/5142)) ([92236e6](https://github.com/dynamic-labs/DynamicAuth/commit/92236e6d74c28516403f6df79c539406ece3d6d0)) ([#5132](https://github.com/dynamic-labs/DynamicAuth/issues/5132)) ([99f564a](https://github.com/dynamic-labs/DynamicAuth/commit/99f564a39e35e28af0be2a03617f12aa19cbeb7f))
|
|
39
|
+
|
|
40
|
+
* Better handling of empty callback queue([#5147](https://github.com/dynamic-labs/DynamicAuth/issues/5147)) ([e2d6bf2](https://github.com/dynamic-labs/DynamicAuth/commit/e2d6bf2444ca01199796ead4136f34b81b6c9b61))
|
|
41
|
+
|
|
42
|
+
* multiple improvements to the wallet list ([#5112](https://github.com/dynamic-labs/DynamicAuth/issues/5112)) ([00eec5f](https://github.com/dynamic-labs/DynamicAuth/commit/00eec5fde70548c3d771260f3d86e5365e73878d))
|
|
43
|
+
|
|
44
|
+
* Improved scroll experience on ios ([#5152](https://github.com/dynamic-labs/DynamicAuth/issues/5152)) ([341704f](https://github.com/dynamic-labs/DynamicAuth/commit/341704f99cb6e06f253309f3a8afb1684bb8ae2a))
|
|
45
|
+
|
|
46
|
+
* better handling of multiwallet state([#5146](https://github.com/dynamic-labs/DynamicAuth/issues/5146)) ([403267b](https://github.com/dynamic-labs/DynamicAuth/commit/403267b3c268d648aba155e0b6fea31d7fdc1b56))
|
|
47
|
+
|
|
48
|
+
* show correct OTP error message ([#5135](https://github.com/dynamic-labs/DynamicAuth/issues/5135)) ([e7494ce](https://github.com/dynamic-labs/DynamicAuth/commit/e7494cee4a1b5132af91058cbcb2dae0b7eac44b))
|
|
49
|
+
|
|
50
|
+
* implement proper solana embedded wallet signer ([#5092](https://github.com/dynamic-labs/DynamicAuth/issues/5092)) ([7749b97](https://github.com/dynamic-labs/DynamicAuth/commit/7749b97db49fb9af8ae0668172f478e1f0c29665))
|
|
51
|
+
|
|
52
|
+
* prevent adding temporary wallet connection to userWallets ([#5104](https://github.com/dynamic-labs/DynamicAuth/issues/5104)) ([3c02b78](https://github.com/dynamic-labs/DynamicAuth/commit/3c02b781c997c63ff11a7f1c255b92d10962327f))
|
|
53
|
+
|
|
54
|
+
|
|
2
55
|
## [2.0.0-alpha.22](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.21...v2.0.0-alpha.22) (2024-03-27)
|
|
3
56
|
|
|
4
57
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/wagmi-connector",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.24",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
"react": "^18.0.0",
|
|
12
12
|
"viem": "2.7.6",
|
|
13
13
|
"wagmi": "2.5.7",
|
|
14
|
-
"@dynamic-labs/logger": "2.0.0-alpha.
|
|
15
|
-
"@dynamic-labs/rpc-providers": "2.0.0-alpha.
|
|
16
|
-
"@dynamic-labs/sdk-react-core": "2.0.0-alpha.
|
|
17
|
-
"@dynamic-labs/types": "2.0.0-alpha.
|
|
18
|
-
"@dynamic-labs/wallet-connector-core": "2.0.0-alpha.
|
|
14
|
+
"@dynamic-labs/logger": "2.0.0-alpha.24",
|
|
15
|
+
"@dynamic-labs/rpc-providers": "2.0.0-alpha.24",
|
|
16
|
+
"@dynamic-labs/sdk-react-core": "2.0.0-alpha.24",
|
|
17
|
+
"@dynamic-labs/types": "2.0.0-alpha.24",
|
|
18
|
+
"@dynamic-labs/wallet-connector-core": "2.0.0-alpha.24",
|
|
19
19
|
"eventemitter3": "5.0.1"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
package/src/lib/Connector.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MutableRefObject } from 'react';
|
|
2
|
-
import { Connector } from 'wagmi';
|
|
3
2
|
import { Account, Transport, Chain } from 'viem';
|
|
4
|
-
import {
|
|
3
|
+
import { WalletConnector } from '@dynamic-labs/sdk-react-core';
|
|
5
4
|
export type ConnectorParameters = {
|
|
5
|
+
connectorId: string;
|
|
6
6
|
handleLogOut: () => Promise<void>;
|
|
7
7
|
walletConnector: WalletConnector;
|
|
8
8
|
preventWagmiSyncFromCallingLogout: MutableRefObject<boolean>;
|
|
@@ -58,8 +58,8 @@ export declare const getCreateConnectorFn: (parameters: ConnectorParameters) =>
|
|
|
58
58
|
[x: `address[${string}]`]: undefined;
|
|
59
59
|
[x: `bool[${string}]`]: undefined;
|
|
60
60
|
[x: `bytes[${string}]`]: undefined;
|
|
61
|
-
[x: `bytes1[${string}]`]: undefined;
|
|
62
61
|
[x: `bytes16[${string}]`]: undefined;
|
|
62
|
+
[x: `bytes1[${string}]`]: undefined;
|
|
63
63
|
[x: `bytes2[${string}]`]: undefined;
|
|
64
64
|
[x: `bytes3[${string}]`]: undefined;
|
|
65
65
|
[x: `bytes4[${string}]`]: undefined;
|
|
@@ -160,8 +160,8 @@ export declare const getCreateConnectorFn: (parameters: ConnectorParameters) =>
|
|
|
160
160
|
address?: undefined;
|
|
161
161
|
bool?: undefined;
|
|
162
162
|
bytes?: undefined;
|
|
163
|
-
bytes1?: undefined;
|
|
164
163
|
bytes16?: undefined;
|
|
164
|
+
bytes1?: undefined;
|
|
165
165
|
bytes2?: undefined;
|
|
166
166
|
bytes3?: undefined;
|
|
167
167
|
bytes4?: undefined;
|
|
@@ -336,8 +336,8 @@ export declare const getCreateConnectorFn: (parameters: ConnectorParameters) =>
|
|
|
336
336
|
[x: `address[${string}]`]: undefined;
|
|
337
337
|
[x: `bool[${string}]`]: undefined;
|
|
338
338
|
[x: `bytes[${string}]`]: undefined;
|
|
339
|
-
[x: `bytes1[${string}]`]: undefined;
|
|
340
339
|
[x: `bytes16[${string}]`]: undefined;
|
|
340
|
+
[x: `bytes1[${string}]`]: undefined;
|
|
341
341
|
[x: `bytes2[${string}]`]: undefined;
|
|
342
342
|
[x: `bytes3[${string}]`]: undefined;
|
|
343
343
|
[x: `bytes4[${string}]`]: undefined;
|
|
@@ -438,8 +438,8 @@ export declare const getCreateConnectorFn: (parameters: ConnectorParameters) =>
|
|
|
438
438
|
address?: undefined;
|
|
439
439
|
bool?: undefined;
|
|
440
440
|
bytes?: undefined;
|
|
441
|
-
bytes1?: undefined;
|
|
442
441
|
bytes16?: undefined;
|
|
442
|
+
bytes1?: undefined;
|
|
443
443
|
bytes2?: undefined;
|
|
444
444
|
bytes3?: undefined;
|
|
445
445
|
bytes4?: undefined;
|
|
@@ -618,8 +618,8 @@ export declare const getCreateConnectorFn: (parameters: ConnectorParameters) =>
|
|
|
618
618
|
[x: `address[${string}]`]: undefined;
|
|
619
619
|
[x: `bool[${string}]`]: undefined;
|
|
620
620
|
[x: `bytes[${string}]`]: undefined;
|
|
621
|
-
[x: `bytes1[${string}]`]: undefined;
|
|
622
621
|
[x: `bytes16[${string}]`]: undefined;
|
|
622
|
+
[x: `bytes1[${string}]`]: undefined;
|
|
623
623
|
[x: `bytes2[${string}]`]: undefined;
|
|
624
624
|
[x: `bytes3[${string}]`]: undefined;
|
|
625
625
|
[x: `bytes4[${string}]`]: undefined;
|
|
@@ -720,8 +720,8 @@ export declare const getCreateConnectorFn: (parameters: ConnectorParameters) =>
|
|
|
720
720
|
address?: undefined;
|
|
721
721
|
bool?: undefined;
|
|
722
722
|
bytes?: undefined;
|
|
723
|
-
bytes1?: undefined;
|
|
724
723
|
bytes16?: undefined;
|
|
724
|
+
bytes1?: undefined;
|
|
725
725
|
bytes2?: undefined;
|
|
726
726
|
bytes3?: undefined;
|
|
727
727
|
bytes4?: undefined;
|
|
@@ -835,7 +835,7 @@ export declare const getCreateConnectorFn: (parameters: ConnectorParameters) =>
|
|
|
835
835
|
uid?: undefined;
|
|
836
836
|
} & Partial<Pick<import("viem").PublicActions<Transport, Chain, Account>, "getChainId" | "prepareTransactionRequest" | "sendRawTransaction" | "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "readContract" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<import("viem").WalletActions<Chain, Account>, "sendTransaction" | "writeContract">>>(fn: (client: import("viem").Client<Transport, Chain, Account, import("viem").WalletRpcSchema, import("viem").WalletActions<Chain, Account>>) => client) => import("viem").Client<Transport, Chain, Account, import("viem").WalletRpcSchema, { [K in keyof client]: client[K]; } & import("viem").WalletActions<Chain, Account>>;
|
|
837
837
|
}>;
|
|
838
|
-
id:
|
|
838
|
+
id: string;
|
|
839
839
|
isAuthorized: () => Promise<boolean>;
|
|
840
840
|
name: "Dynamic";
|
|
841
841
|
onAccountsChanged: (accounts: string[]) => void;
|
|
@@ -846,4 +846,3 @@ export declare const getCreateConnectorFn: (parameters: ConnectorParameters) =>
|
|
|
846
846
|
}) => Promise<Chain>;
|
|
847
847
|
type: "dynamic";
|
|
848
848
|
}, {}>;
|
|
849
|
-
export declare const createConnectorForFirstConnectedEvmWallet: (wallets: Wallet[], createConnector: (wallet: Wallet) => Connector) => Connector | undefined;
|
package/src/lib/Connector.js
CHANGED
|
@@ -82,7 +82,7 @@ const getCreateConnectorFn = (parameters) => createConnector((config) => ({
|
|
|
82
82
|
return (_a = parameters.walletConnector) === null || _a === void 0 ? void 0 : _a.getWalletClient();
|
|
83
83
|
});
|
|
84
84
|
},
|
|
85
|
-
id:
|
|
85
|
+
id: parameters.connectorId,
|
|
86
86
|
isAuthorized() {
|
|
87
87
|
var _a, _b;
|
|
88
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -117,12 +117,5 @@ const getCreateConnectorFn = (parameters) => createConnector((config) => ({
|
|
|
117
117
|
},
|
|
118
118
|
type: 'dynamic',
|
|
119
119
|
}));
|
|
120
|
-
const createConnectorForFirstConnectedEvmWallet = (wallets, createConnector) => {
|
|
121
|
-
for (const wallet of wallets) {
|
|
122
|
-
if (wallet.connected && wallet.connector.connectedChain === 'EVM') {
|
|
123
|
-
return createConnector(wallet);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
120
|
|
|
128
|
-
export {
|
|
121
|
+
export { getCreateConnectorFn };
|
|
@@ -2,31 +2,36 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useRef, useMemo, useEffect } from 'react';
|
|
3
3
|
import { useConfig } from 'wagmi';
|
|
4
4
|
import { useDynamicContext, useUserWallets } from '@dynamic-labs/sdk-react-core';
|
|
5
|
-
import {
|
|
6
|
-
import { createConnectorForFirstConnectedEvmWallet, getCreateConnectorFn } from './Connector.js';
|
|
5
|
+
import { getCreateConnectorFn } from './Connector.js';
|
|
7
6
|
import { SyncDynamicWagmi } from './SyncDynamicWagmi.js';
|
|
8
7
|
import { useChainMismatchLogger } from './useChainMismatchLogger.js';
|
|
8
|
+
import { useFindEvmWallet } from './hooks/useFindEvmWallet/useFindEvmWallet.js';
|
|
9
|
+
import { useConnectorId } from './hooks/useConnectorId/useConnectorId.js';
|
|
9
10
|
|
|
10
11
|
const DynamicWagmiConnector = ({ children, }) => {
|
|
11
12
|
const config = useConfig();
|
|
12
13
|
const { handleLogOut, primaryWallet } = useDynamicContext();
|
|
14
|
+
const wallets = useUserWallets();
|
|
13
15
|
useChainMismatchLogger();
|
|
16
|
+
const evmWallet = useFindEvmWallet(primaryWallet, wallets);
|
|
17
|
+
const getConnectorId = useConnectorId();
|
|
14
18
|
/**
|
|
15
19
|
* This will prevent the wagmi Connector from calling handleLogOut when we are the ones calling disconnect
|
|
16
20
|
* as a result of a handleLogOut call (see SyncDynamicWagmi), but will preserve the existing behavior for customers.
|
|
17
21
|
*/
|
|
18
22
|
const preventWagmiSyncFromCallingLogout = useRef(false);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
23
|
+
const connector = useMemo(() => {
|
|
24
|
+
if (!evmWallet) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const connectorId = getConnectorId(evmWallet.connector);
|
|
28
|
+
return config._internal.connectors.setup(getCreateConnectorFn({
|
|
29
|
+
connectorId,
|
|
24
30
|
handleLogOut,
|
|
25
31
|
preventWagmiSyncFromCallingLogout,
|
|
26
|
-
walletConnector:
|
|
32
|
+
walletConnector: evmWallet.connector,
|
|
27
33
|
}));
|
|
28
|
-
|
|
29
|
-
}), [config._internal.connectors, evmWallets, handleLogOut]);
|
|
34
|
+
}, [config._internal.connectors, getConnectorId, handleLogOut, evmWallet]);
|
|
30
35
|
/**
|
|
31
36
|
* Updating the wagmi config must be done in a useEffect because
|
|
32
37
|
* when setting the public client and connectors, wagmi will fire
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useConnectorId } from './useConnectorId';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
+
/**
|
|
3
|
+
* This hook is used to generate a unique ID for a given WalletConnector.
|
|
4
|
+
* This is used to ensure the wagmi connector id will change if the wallet connector
|
|
5
|
+
* instance changes between rerenders.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useConnectorId: () => (walletConnector: WalletConnector) => string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useRef, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This hook is used to generate a unique ID for a given WalletConnector.
|
|
5
|
+
* This is used to ensure the wagmi connector id will change if the wallet connector
|
|
6
|
+
* instance changes between rerenders.
|
|
7
|
+
*/
|
|
8
|
+
const useConnectorId = () => {
|
|
9
|
+
const lastSeenWalletConnector = useRef(undefined);
|
|
10
|
+
const lastConnectorKey = useRef(0);
|
|
11
|
+
/**
|
|
12
|
+
* This function will generate a unique ID for a given WalletConnector.
|
|
13
|
+
*/
|
|
14
|
+
return useCallback((walletConnector) => {
|
|
15
|
+
if (walletConnector !== lastSeenWalletConnector.current) {
|
|
16
|
+
lastSeenWalletConnector.current = walletConnector;
|
|
17
|
+
lastConnectorKey.current += 1;
|
|
18
|
+
}
|
|
19
|
+
return `dynamic-${walletConnector.key}-${lastConnectorKey.current}`;
|
|
20
|
+
}, []);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { useConnectorId };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useFindEvmWallet } from './useFindEvmWallet';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const isEvmWallet = (wallet) => wallet.connector.connectedChain === 'EVM';
|
|
2
|
+
const isWalletConnected = (wallet) => wallet.connected;
|
|
3
|
+
const useFindEvmWallet = (primaryWallet, wallets) => {
|
|
4
|
+
/**
|
|
5
|
+
* If the primary wallet is an EVM wallet and is connected, return it.
|
|
6
|
+
*/
|
|
7
|
+
if (primaryWallet &&
|
|
8
|
+
isEvmWallet(primaryWallet) &&
|
|
9
|
+
isWalletConnected(primaryWallet)) {
|
|
10
|
+
return primaryWallet;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* If the primary wallet is not connected, find the first connected EVM wallet.
|
|
14
|
+
*/
|
|
15
|
+
const connectedEvmWallets = wallets
|
|
16
|
+
.filter(isEvmWallet)
|
|
17
|
+
.filter(isWalletConnected);
|
|
18
|
+
return connectedEvmWallets[0];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { useFindEvmWallet };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const evmWalletsFilter = (wallet) => wallet.connector.connectedChain === 'EVM';
|
|
2
|
-
const findAndOrderEvmWallets = (primaryWallet, wallets) => {
|
|
3
|
-
const isPrimaryWalletEvm = (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.connectedChain) === 'EVM';
|
|
4
|
-
if (isPrimaryWalletEvm) {
|
|
5
|
-
const secondaryEvmWallets = wallets
|
|
6
|
-
.filter(evmWalletsFilter)
|
|
7
|
-
.filter((wallet) => wallet.address !== primaryWallet.address);
|
|
8
|
-
return [primaryWallet, ...secondaryEvmWallets];
|
|
9
|
-
}
|
|
10
|
-
return wallets.filter(evmWalletsFilter);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export { findAndOrderEvmWallets };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { findAndOrderEvmWallets } from './findAndOrderEvmWallets';
|
package/src/lib/utils/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './findAndOrderEvmWallets';
|