@reown/appkit-controllers 1.8.14-cc0928045461a473e8850f4bd5ee072c53e54502.0 → 1.8.14-d921da175a718bd981568cbf2b4236631c3f59c1.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/dist/esm/exports/index.js +2 -0
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/src/utils/ConnectUtil.js +3 -1
- package/dist/esm/src/utils/ConnectUtil.js.map +1 -1
- package/dist/esm/src/utils/ConnectorUtil.js +282 -0
- package/dist/esm/src/utils/ConnectorUtil.js.map +1 -0
- package/dist/esm/src/utils/ConstantsUtil.js +11 -2
- package/dist/esm/src/utils/ConstantsUtil.js.map +1 -1
- package/dist/esm/src/utils/WalletUtil.js +148 -0
- package/dist/esm/src/utils/WalletUtil.js.map +1 -0
- package/dist/esm/tests/utils/ControllerUtil.test.js +500 -0
- package/dist/esm/tests/utils/ControllerUtil.test.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/types/exports/index.d.ts +2 -0
- package/dist/types/src/utils/ConnectorUtil.d.ts +57 -0
- package/dist/types/src/utils/ConstantsUtil.d.ts +3 -0
- package/dist/types/src/utils/TypeUtil.d.ts +11 -0
- package/dist/types/src/utils/WalletUtil.d.ts +56 -0
- package/dist/types/tests/utils/ControllerUtil.test.d.ts +1 -0
- package/package.json +3 -3
|
@@ -55,7 +55,9 @@ export { ExchangeController } from '../src/controllers/ExchangeController.js';
|
|
|
55
55
|
export type { ExchangeControllerState } from '../src/controllers/ExchangeController.js';
|
|
56
56
|
export { AssetUtil } from '../src/utils/AssetUtil.js';
|
|
57
57
|
export { ConstantsUtil } from '../src/utils/ConstantsUtil.js';
|
|
58
|
+
export { WalletUtil } from '../src/utils/WalletUtil.js';
|
|
58
59
|
export { CoreHelperUtil, type OpenTarget } from '../src/utils/CoreHelperUtil.js';
|
|
60
|
+
export { ConnectorUtil } from '../src/utils/ConnectorUtil.js';
|
|
59
61
|
export { StorageUtil } from '../src/utils/StorageUtil.js';
|
|
60
62
|
export { RouterUtil } from '../src/utils/RouterUtil.js';
|
|
61
63
|
export { OptionsUtil } from '../src/utils/OptionsUtil.js';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Connector, ConnectorOrWalletItem, ConnectorTypeOrder, ConnectorWithProviders, CustomWallet, SocialProvider, WcWallet } from './TypeUtil.js';
|
|
2
|
+
interface GetConnectorTypeOrderParameters {
|
|
3
|
+
recommended: WcWallet[];
|
|
4
|
+
featured: WcWallet[];
|
|
5
|
+
custom: CustomWallet[] | undefined;
|
|
6
|
+
recent: WcWallet[];
|
|
7
|
+
announced: WcWallet[];
|
|
8
|
+
injected: WcWallet[];
|
|
9
|
+
multiChain: WcWallet[];
|
|
10
|
+
external: WcWallet[];
|
|
11
|
+
overriddenConnectors?: ConnectorTypeOrder[];
|
|
12
|
+
}
|
|
13
|
+
export declare const ConnectorUtil: {
|
|
14
|
+
getConnectorsByType(connectors: ConnectorWithProviders[], recommended: WcWallet[], featured: WcWallet[]): {
|
|
15
|
+
custom: CustomWallet[] | undefined;
|
|
16
|
+
recent: WcWallet[];
|
|
17
|
+
external: ConnectorWithProviders[];
|
|
18
|
+
multiChain: ConnectorWithProviders[];
|
|
19
|
+
announced: ConnectorWithProviders[];
|
|
20
|
+
injected: ConnectorWithProviders[];
|
|
21
|
+
recommended: WcWallet[];
|
|
22
|
+
featured: WcWallet[];
|
|
23
|
+
};
|
|
24
|
+
showConnector(connector: ConnectorWithProviders): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Returns true if the user is connected to a WalletConnect connector in the any of the available namespaces.
|
|
27
|
+
* @returns boolean
|
|
28
|
+
*/
|
|
29
|
+
getIsConnectedWithWC(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the connector positions in the order of the user's preference.
|
|
32
|
+
* @returns ConnectorTypeOrder[]
|
|
33
|
+
*/
|
|
34
|
+
getConnectorTypeOrder({ recommended, featured, custom, recent, announced, injected, multiChain, external, overriddenConnectors }: GetConnectorTypeOrderParameters): string[];
|
|
35
|
+
sortConnectorsByExplorerWallet(connectors: ConnectorWithProviders[]): ConnectorWithProviders[];
|
|
36
|
+
getAuthName({ email, socialUsername, socialProvider }: {
|
|
37
|
+
email: string;
|
|
38
|
+
socialUsername?: string | null;
|
|
39
|
+
socialProvider?: SocialProvider | null;
|
|
40
|
+
}): string;
|
|
41
|
+
fetchProviderData(connector: Connector): Promise<{
|
|
42
|
+
accounts: string[];
|
|
43
|
+
chainId: number | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Filter out duplicate custom wallets by RDNS
|
|
47
|
+
* @param wallets
|
|
48
|
+
*/
|
|
49
|
+
getFilteredCustomWallets(wallets: WcWallet[]): WcWallet[];
|
|
50
|
+
hasWalletConnector(wallet: WcWallet): boolean;
|
|
51
|
+
isWalletCompatibleWithCurrentChain(wallet: WcWallet): boolean;
|
|
52
|
+
getFilteredRecentWallets(): WcWallet[];
|
|
53
|
+
getCappedRecommendedWallets(wallets: WcWallet[]): WcWallet[];
|
|
54
|
+
processConnectorsByType(connectors: ConnectorWithProviders[], shouldFilter?: boolean): ConnectorWithProviders[];
|
|
55
|
+
connectorList(): ConnectorOrWalletItem[];
|
|
56
|
+
};
|
|
57
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ChainNamespace, type OnRampProvider, type SocialProvider, type SwapProvider } from '@reown/appkit-common';
|
|
2
|
+
import type { ConnectMethod } from './TypeUtil.js';
|
|
2
3
|
export declare const ONRAMP_PROVIDERS: {
|
|
3
4
|
label: string;
|
|
4
5
|
name: string;
|
|
@@ -105,4 +106,6 @@ export declare const ConstantsUtil: {
|
|
|
105
106
|
SIWX_DEFAULTS: {
|
|
106
107
|
readonly signOutOnDisconnect: true;
|
|
107
108
|
};
|
|
109
|
+
MANDATORY_WALLET_IDS_ON_MOBILE: (string | undefined)[];
|
|
110
|
+
DEFAULT_CONNECT_METHOD_ORDER: ConnectMethod[];
|
|
108
111
|
};
|
|
@@ -1296,4 +1296,15 @@ export type ProjectLimits = {
|
|
|
1296
1296
|
isAboveRpcLimit: boolean;
|
|
1297
1297
|
isAboveMauLimit: boolean;
|
|
1298
1298
|
};
|
|
1299
|
+
export type ConnectorItemWithKind = {
|
|
1300
|
+
kind: 'connector';
|
|
1301
|
+
subtype: 'injected' | 'announced' | 'multiChain' | 'external' | 'walletConnect';
|
|
1302
|
+
connector: ConnectorWithProviders;
|
|
1303
|
+
};
|
|
1304
|
+
export type WalletItemWithKind = {
|
|
1305
|
+
kind: 'wallet';
|
|
1306
|
+
subtype: 'featured' | 'recommended' | 'custom' | 'recent';
|
|
1307
|
+
wallet: WcWallet;
|
|
1308
|
+
};
|
|
1309
|
+
export type ConnectorOrWalletItem = ConnectorItemWithKind | WalletItemWithKind;
|
|
1299
1310
|
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { ConnectMethod, Connector, Features, WcWallet } from './TypeUtil.js';
|
|
2
|
+
interface AppKitWallet extends WcWallet {
|
|
3
|
+
installed: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const WalletUtil: {
|
|
6
|
+
filterOutDuplicatesByRDNS(wallets: WcWallet[]): WcWallet[];
|
|
7
|
+
filterOutDuplicatesByIds(wallets: WcWallet[]): WcWallet[];
|
|
8
|
+
filterOutDuplicateWallets(wallets: WcWallet[]): WcWallet[];
|
|
9
|
+
/**
|
|
10
|
+
* Marks wallets as installed based on available connectors and sorts them
|
|
11
|
+
* according to both installation status and featuredWalletIds order.
|
|
12
|
+
*
|
|
13
|
+
* @param wallets - Array of wallets to process
|
|
14
|
+
* @returns Array of wallets marked as installed and sorted by priority
|
|
15
|
+
*/
|
|
16
|
+
markWalletsAsInstalled(wallets: WcWallet[]): AppKitWallet[];
|
|
17
|
+
getConnectOrderMethod(_features: Features | undefined, _connectors: Connector[]): ConnectMethod[];
|
|
18
|
+
isExcluded(wallet: WcWallet): boolean;
|
|
19
|
+
markWalletsWithDisplayIndex(wallets: WcWallet[]): {
|
|
20
|
+
display_index: number;
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
badge_type?: import("./TypeUtil.js").BadgeType;
|
|
24
|
+
description?: string;
|
|
25
|
+
chains?: import("@reown/appkit-common").CaipNetworkId[];
|
|
26
|
+
homepage?: string;
|
|
27
|
+
image_id?: string;
|
|
28
|
+
image_url?: string;
|
|
29
|
+
order?: number;
|
|
30
|
+
link_mode?: string | null;
|
|
31
|
+
mobile_link?: string | null;
|
|
32
|
+
desktop_link?: string | null;
|
|
33
|
+
webapp_link?: string | null;
|
|
34
|
+
app_store?: string | null;
|
|
35
|
+
play_store?: string | null;
|
|
36
|
+
chrome_store?: string | null;
|
|
37
|
+
rdns?: string | null;
|
|
38
|
+
injected?: {
|
|
39
|
+
namespace?: string;
|
|
40
|
+
injected_id?: string;
|
|
41
|
+
}[] | null;
|
|
42
|
+
supports_wc?: boolean;
|
|
43
|
+
}[];
|
|
44
|
+
/**
|
|
45
|
+
* Filters wallets based on WalletConnect support and platform requirements.
|
|
46
|
+
*
|
|
47
|
+
* On mobile only wallets with WalletConnect support and some mandatory wallets are shown.
|
|
48
|
+
* On desktop with Appkit Core only wallets with WalletConnect support are shown.
|
|
49
|
+
* On desktop with Appkit all wallets are shown.
|
|
50
|
+
*
|
|
51
|
+
* @param wallets - Array of wallets to filter
|
|
52
|
+
* @returns Filtered array of wallets based on WalletConnect support and platform
|
|
53
|
+
*/
|
|
54
|
+
filterWalletsByWcSupport(wallets: WcWallet[]): WcWallet[];
|
|
55
|
+
};
|
|
56
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit-controllers",
|
|
3
|
-
"version": "1.8.14-
|
|
3
|
+
"version": "1.8.14-d921da175a718bd981568cbf2b4236631c3f59c1.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/esm/exports/index.js",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"@walletconnect/universal-provider": "2.23.0",
|
|
57
57
|
"valtio": "2.1.7",
|
|
58
58
|
"viem": ">=2.37.9",
|
|
59
|
-
"@reown/appkit-common": "1.8.14-
|
|
60
|
-
"@reown/appkit-wallet": "1.8.14-
|
|
59
|
+
"@reown/appkit-common": "1.8.14-d921da175a718bd981568cbf2b4236631c3f59c1.0",
|
|
60
|
+
"@reown/appkit-wallet": "1.8.14-d921da175a718bd981568cbf2b4236631c3f59c1.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@vitest/coverage-v8": "2.1.9",
|