@reown/appkit-controllers 1.8.14 → 1.8.15-23bb47b934ad6e2db0777e70bb49289c5630f47f.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/exports/react.js +121 -2
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/src/controllers/AlertController.js +18 -2
- package/dist/esm/src/controllers/AlertController.js.map +1 -1
- package/dist/esm/src/controllers/ConnectionController.js +9 -0
- package/dist/esm/src/controllers/ConnectionController.js.map +1 -1
- package/dist/esm/src/controllers/ConnectorController.js +11 -7
- package/dist/esm/src/controllers/ConnectorController.js.map +1 -1
- package/dist/esm/src/controllers/PublicStateController.js +2 -1
- package/dist/esm/src/controllers/PublicStateController.js.map +1 -1
- package/dist/esm/src/controllers/TransactionsController.js +1 -1
- package/dist/esm/src/controllers/TransactionsController.js.map +1 -1
- package/dist/esm/src/utils/ApiControllerUtil.js +34 -0
- package/dist/esm/src/utils/ApiControllerUtil.js.map +1 -0
- package/dist/esm/src/utils/AssetUtil.js +42 -0
- package/dist/esm/src/utils/AssetUtil.js.map +1 -1
- package/dist/esm/src/utils/ConnectUtil.js +92 -0
- package/dist/esm/src/utils/ConnectUtil.js.map +1 -0
- package/dist/esm/src/utils/ConnectionControllerUtil.js +36 -0
- package/dist/esm/src/utils/ConnectionControllerUtil.js.map +1 -1
- package/dist/esm/src/utils/ConnectorUtil.js +314 -0
- package/dist/esm/src/utils/ConnectorUtil.js.map +1 -0
- package/dist/esm/src/utils/ConstantsUtil.js +21 -6
- package/dist/esm/src/utils/ConstantsUtil.js.map +1 -1
- package/dist/esm/src/utils/WalletUtil.js +161 -0
- package/dist/esm/src/utils/WalletUtil.js.map +1 -0
- package/dist/esm/tests/controllers/AlertController.test.js +62 -9
- package/dist/esm/tests/controllers/AlertController.test.js.map +1 -1
- package/dist/esm/tests/controllers/ConnectionController.test.js +5 -2
- package/dist/esm/tests/controllers/ConnectionController.test.js.map +1 -1
- package/dist/esm/tests/controllers/ConnectorController.test.js +8 -8
- package/dist/esm/tests/controllers/ConnectorController.test.js.map +1 -1
- package/dist/esm/tests/hooks/react.test.js +505 -3
- package/dist/esm/tests/hooks/react.test.js.map +1 -1
- package/dist/esm/tests/hooks/vue.test.js +8 -0
- package/dist/esm/tests/hooks/vue.test.js.map +1 -1
- package/dist/esm/tests/utils/ConnectorUtil.test.js +83 -0
- package/dist/esm/tests/utils/ConnectorUtil.test.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 +4 -1
- package/dist/types/exports/react.d.ts +69 -0
- package/dist/types/src/controllers/ConnectionController.d.ts +1 -0
- package/dist/types/src/controllers/ConnectorController.d.ts +6 -10
- package/dist/types/src/controllers/OptionsController.d.ts +3 -1
- package/dist/types/src/controllers/PublicStateController.d.ts +6 -0
- package/dist/types/src/utils/ApiControllerUtil.d.ts +8 -0
- package/dist/types/src/utils/AssetUtil.d.ts +18 -0
- package/dist/types/src/utils/ChainControllerUtil.d.ts +1 -1
- package/dist/types/src/utils/ConnectUtil.d.ts +54 -0
- package/dist/types/src/utils/ConnectionControllerUtil.d.ts +2 -0
- package/dist/types/src/utils/ConnectorUtil.d.ts +74 -0
- package/dist/types/src/utils/ConstantsUtil.d.ts +7 -1
- package/dist/types/src/utils/TypeUtil.d.ts +30 -2
- package/dist/types/src/utils/ViemUtil.d.ts +13 -13
- package/dist/types/src/utils/WalletUtil.d.ts +81 -0
- package/dist/types/tests/utils/ConnectorUtil.test.d.ts +1 -0
- package/dist/types/tests/utils/ControllerUtil.test.d.ts +1 -0
- package/package.json +7 -7
|
@@ -19,7 +19,7 @@ export type { ConnectionControllerClient, ConnectionControllerState } from '../s
|
|
|
19
19
|
export type { ConnectExternalOptions } from '../src/controllers/ConnectionController.js';
|
|
20
20
|
export { ConnectorController } from '../src/controllers/ConnectorController.js';
|
|
21
21
|
export { ConnectorControllerUtil } from '../src/utils/ConnectorControllerUtil.js';
|
|
22
|
-
export type { ConnectorControllerState
|
|
22
|
+
export type { ConnectorControllerState } from '../src/controllers/ConnectorController.js';
|
|
23
23
|
export { SnackController } from '../src/controllers/SnackController.js';
|
|
24
24
|
export type { SnackControllerState } from '../src/controllers/SnackController.js';
|
|
25
25
|
export { ApiController } from '../src/controllers/ApiController.js';
|
|
@@ -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';
|
|
@@ -69,5 +71,6 @@ export type { Exchange, GetExchangesParams, PayUrlParams, PaymentAsset, CurrentP
|
|
|
69
71
|
export { FetchUtil } from '../src/utils/FetchUtil.js';
|
|
70
72
|
export type * from '../src/utils/TypeUtil.js';
|
|
71
73
|
export type * from '../src/utils/SIWXUtil.js';
|
|
74
|
+
export type { WalletItem } from '../src/utils/ConnectUtil.js';
|
|
72
75
|
export * from '../src/utils/ChainControllerUtil.js';
|
|
73
76
|
export * from '../src/utils/WalletConnectUtil.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ChainNamespace, type Connection } from '@reown/appkit-common';
|
|
2
|
+
import { type WalletItem } from '../src/utils/ConnectUtil.js';
|
|
2
3
|
import type { UseAppKitAccountReturn, UseAppKitNetworkReturn } from '../src/utils/TypeUtil.js';
|
|
3
4
|
export type { Connection } from '@reown/appkit-common';
|
|
4
5
|
interface DisconnectParams {
|
|
@@ -75,3 +76,71 @@ export declare function useAppKitConnection({ namespace, onSuccess, onError }: U
|
|
|
75
76
|
switchConnection: ({ connection: _connection, address }: SwitchConnectionParams) => Promise<void>;
|
|
76
77
|
deleteConnection: ({ address, connectorId }: DeleteRecentConnectionProps) => void;
|
|
77
78
|
};
|
|
79
|
+
export interface UseAppKitWalletsReturn {
|
|
80
|
+
/**
|
|
81
|
+
* List of wallets for the initial connect view including WalletConnect wallet and injected wallets together. If user doesn't have any injected wallets, it'll fill the list with most ranked WalletConnect wallets.
|
|
82
|
+
*/
|
|
83
|
+
wallets: WalletItem[];
|
|
84
|
+
/**
|
|
85
|
+
* List of WalletConnect wallets from Wallet Guide API. Useful to display all available WalletConnect wallets in a separate Search Wallets view.
|
|
86
|
+
* @see https://walletguide.walletconnect.network/.
|
|
87
|
+
*/
|
|
88
|
+
wcWallets: WalletItem[];
|
|
89
|
+
/**
|
|
90
|
+
* Boolean that indicates if WalletConnect wallets are being fetched.
|
|
91
|
+
*/
|
|
92
|
+
isFetchingWallets: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Boolean that indicates if a WalletConnect URI is being fetched.
|
|
95
|
+
*/
|
|
96
|
+
isFetchingWcUri: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Boolean that indicates if the AppKit is initialized. It's useful to render a fallback UI when the AppKit initializes and detects all injected wallets.
|
|
99
|
+
*/
|
|
100
|
+
isInitialized: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* The current WalletConnect URI for QR code display. This is set when connecting to a WalletConnect wallet. Reset with resetWcUri().
|
|
103
|
+
*/
|
|
104
|
+
wcUri?: string;
|
|
105
|
+
/**
|
|
106
|
+
* The wallet currently being connected to. This is set when a connection is initiated and cleared when it completes or fails. For WalletConnect wallets, resetWcUri() should be called to clear the state.
|
|
107
|
+
*/
|
|
108
|
+
connectingWallet?: WalletItem;
|
|
109
|
+
/**
|
|
110
|
+
* The current page number of WalletConnect wallets.
|
|
111
|
+
*/
|
|
112
|
+
page: number;
|
|
113
|
+
/**
|
|
114
|
+
* The total number of available WalletConnect wallets based on the AppKit configurations and given parameters.
|
|
115
|
+
*/
|
|
116
|
+
count: number;
|
|
117
|
+
/**
|
|
118
|
+
* Function to fetch WalletConnect wallets from the explorer API. Allows to list, search and paginate through the wallets.
|
|
119
|
+
* @param options - Options for fetching wallets
|
|
120
|
+
* @param options.page - Page number to fetch (default: 1)
|
|
121
|
+
* @param options.query - Search query to filter wallets (default: '')
|
|
122
|
+
*/
|
|
123
|
+
fetchWallets: (options?: {
|
|
124
|
+
page?: number;
|
|
125
|
+
query?: string;
|
|
126
|
+
}) => Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Function to connect to a wallet.
|
|
129
|
+
* - For WalletConnect wallets: initiates WC connection and returns the URI with the `wcUri` state.
|
|
130
|
+
* - For injected connectors: triggers the extension/wallet directly.
|
|
131
|
+
*
|
|
132
|
+
* @param wallet - The wallet item to connect to
|
|
133
|
+
* @param callbacks - Success and error callbacks
|
|
134
|
+
* @returns Promise that resolves when connection completes or rejects on error
|
|
135
|
+
*/
|
|
136
|
+
connect: (wallet: WalletItem, namespace?: ChainNamespace) => Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Function to reset the WC URI. Useful to keep `connectingWallet` state sync with the WC URI. Can be called when the QR code is closed.
|
|
139
|
+
*/
|
|
140
|
+
resetWcUri: () => void;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Headless hook for wallet connection.
|
|
144
|
+
* Provides all the data and functions needed to build a custom connect UI.
|
|
145
|
+
*/
|
|
146
|
+
export declare function useAppKitWallets(): UseAppKitWalletsReturn;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { type ChainNamespace } from '@reown/appkit-common';
|
|
2
|
-
import type { AuthConnector, Connector, WcWallet } from '../utils/TypeUtil.js';
|
|
3
|
-
export interface ConnectorWithProviders extends Connector {
|
|
4
|
-
connectors?: Connector[];
|
|
5
|
-
}
|
|
2
|
+
import type { AuthConnector, Connector, ConnectorWithProviders, WcWallet } from '../utils/TypeUtil.js';
|
|
6
3
|
export interface ConnectorControllerState {
|
|
7
4
|
allConnectors: Connector[];
|
|
8
5
|
connectors: ConnectorWithProviders[];
|
|
@@ -32,12 +29,11 @@ export declare const ConnectorController: {
|
|
|
32
29
|
addConnector(connector: Connector | AuthConnector): void;
|
|
33
30
|
getAuthConnector(chainNamespace?: ChainNamespace): AuthConnector | undefined;
|
|
34
31
|
getAnnouncedConnectorRdns(): (string | undefined)[];
|
|
35
|
-
getConnectorById(id: string):
|
|
36
|
-
getConnector({ id,
|
|
37
|
-
id
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}): Connector | undefined;
|
|
32
|
+
getConnectorById(id: string): ConnectorWithProviders | undefined;
|
|
33
|
+
getConnector({ id, namespace }: {
|
|
34
|
+
id: string;
|
|
35
|
+
namespace: ChainNamespace;
|
|
36
|
+
}): ConnectorWithProviders | undefined;
|
|
41
37
|
syncIfAuthConnector(connector: Connector | AuthConnector): void;
|
|
42
38
|
/**
|
|
43
39
|
* Returns the connectors filtered by namespace.
|
|
@@ -1697,6 +1697,7 @@ export declare const OptionsController: {
|
|
|
1697
1697
|
readonly collapseWallets?: boolean | undefined;
|
|
1698
1698
|
readonly pay?: boolean | undefined;
|
|
1699
1699
|
readonly reownAuthentication?: boolean | undefined;
|
|
1700
|
+
readonly headless?: boolean | undefined;
|
|
1700
1701
|
} | undefined;
|
|
1701
1702
|
readonly siwx?: {
|
|
1702
1703
|
readonly createMessage: (input: import("../utils/SIWXUtil.js").SIWXMessage.Input) => Promise<import("../utils/SIWXUtil.js").SIWXMessage>;
|
|
@@ -1725,7 +1726,7 @@ export declare const OptionsController: {
|
|
|
1725
1726
|
*/
|
|
1726
1727
|
| undefined;
|
|
1727
1728
|
readonly defaultAccountTypes: {
|
|
1728
|
-
readonly eip155?: "
|
|
1729
|
+
readonly eip155?: "smartAccount" | "eoa" | undefined;
|
|
1729
1730
|
readonly solana?: "eoa" | undefined;
|
|
1730
1731
|
readonly bip122?: "payment" | "ordinal" | "stx" | undefined;
|
|
1731
1732
|
readonly polkadot?: "eoa" | undefined;
|
|
@@ -1784,6 +1785,7 @@ export declare const OptionsController: {
|
|
|
1784
1785
|
readonly payWithExchange?: boolean | undefined;
|
|
1785
1786
|
readonly payments?: boolean | undefined;
|
|
1786
1787
|
readonly onramp?: false | readonly "meld"[] | undefined;
|
|
1788
|
+
readonly headless?: boolean | undefined;
|
|
1787
1789
|
} | undefined;
|
|
1788
1790
|
};
|
|
1789
1791
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CaipNetworkId, ChainNamespace } from '@reown/appkit-common';
|
|
2
|
+
import type { WalletItem } from '../utils/ConnectUtil.js';
|
|
2
3
|
export interface PublicStateControllerState {
|
|
3
4
|
/**
|
|
4
5
|
* @description Indicates if the AppKit is loading.
|
|
@@ -25,6 +26,11 @@ export interface PublicStateControllerState {
|
|
|
25
26
|
* @type {boolean}
|
|
26
27
|
*/
|
|
27
28
|
initialized: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* @description Indicates the wallet item that is currently being connecting.
|
|
31
|
+
* @type {WalletItem | undefined}
|
|
32
|
+
*/
|
|
33
|
+
connectingWallet: WalletItem | undefined;
|
|
28
34
|
}
|
|
29
35
|
export declare const PublicStateController: {
|
|
30
36
|
state: PublicStateControllerState;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { WcWallet } from './TypeUtil.js';
|
|
2
|
+
export declare const ApiControllerUtil: {
|
|
3
|
+
/**
|
|
4
|
+
* Finds a wallet by ID across all wallet arrays (wallets, recommended, featured, search, etc.)
|
|
5
|
+
* This is useful when a wallet might be in different arrays depending on the context
|
|
6
|
+
*/
|
|
7
|
+
getWalletById(walletId: string | undefined): WcWallet | undefined;
|
|
8
|
+
};
|
|
@@ -13,4 +13,22 @@ export declare const AssetUtil: {
|
|
|
13
13
|
getConnectorImage(connector?: Connector): string | undefined;
|
|
14
14
|
getChainImage(chain: ChainNamespace): string | undefined;
|
|
15
15
|
getTokenImage(symbol?: string): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Get the explorer wallet's image URL for the given image ID.
|
|
18
|
+
* @param imageId - The image id of the wallet.
|
|
19
|
+
* @returns The image URL for the wallet.
|
|
20
|
+
*/
|
|
21
|
+
getWalletImageUrl(imageId: string | undefined): string;
|
|
22
|
+
/**
|
|
23
|
+
* Get the public asset's image URL with the given image ID.
|
|
24
|
+
* @param imageId - The image id of the asset.
|
|
25
|
+
* @returns The image URL for the asset.
|
|
26
|
+
*/
|
|
27
|
+
getAssetImageUrl(imageId: string | undefined): string;
|
|
28
|
+
/**
|
|
29
|
+
* Get the image URL for the given chain namespace.
|
|
30
|
+
* @param chainNamespace - The chain namespace to get the image URL for.
|
|
31
|
+
* @returns The image URL for the chain namespace.
|
|
32
|
+
*/
|
|
33
|
+
getChainNamespaceImageUrl(chainNamespace: ChainNamespace): string;
|
|
16
34
|
};
|
|
@@ -17,7 +17,7 @@ export declare function getActiveNetworkTokenAddress(): string;
|
|
|
17
17
|
* @param namespace - The namespace of the account
|
|
18
18
|
* @returns The preferred account type
|
|
19
19
|
*/
|
|
20
|
-
export declare function getPreferredAccountType(namespace: ChainNamespace | undefined): "
|
|
20
|
+
export declare function getPreferredAccountType(namespace: ChainNamespace | undefined): "payment" | "ordinal" | "stx" | "smartAccount" | "eoa" | undefined;
|
|
21
21
|
/**
|
|
22
22
|
* Get the active CAIP network for a given chain namespace, if no namespace is provided, it returns the active CAIP network
|
|
23
23
|
* @param chainNamespace - The chain namespace to get the active CAIP network for
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ChainNamespace } from '@reown/appkit-common';
|
|
2
|
+
import type { ConnectorItemWithKind, ConnectorWithProviders, WcWallet } from './TypeUtil.js';
|
|
3
|
+
export type WalletItem = {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
imageUrl: string;
|
|
7
|
+
connectors: {
|
|
8
|
+
id: string;
|
|
9
|
+
rdns?: string;
|
|
10
|
+
chain: ChainNamespace;
|
|
11
|
+
chainImageUrl?: string;
|
|
12
|
+
}[];
|
|
13
|
+
walletInfo: {
|
|
14
|
+
description?: WcWallet['description'];
|
|
15
|
+
supportedChains?: WcWallet['chains'];
|
|
16
|
+
supportedNamespaces?: ChainNamespace[];
|
|
17
|
+
website?: WcWallet['homepage'];
|
|
18
|
+
installationLinks?: {
|
|
19
|
+
appStore?: WcWallet['app_store'];
|
|
20
|
+
playStore?: WcWallet['play_store'];
|
|
21
|
+
chromeStore?: WcWallet['chrome_store'];
|
|
22
|
+
desktopLink?: WcWallet['desktop_link'];
|
|
23
|
+
};
|
|
24
|
+
deepLink?: WcWallet['mobile_link'];
|
|
25
|
+
isCertified?: boolean;
|
|
26
|
+
};
|
|
27
|
+
isInjected: boolean;
|
|
28
|
+
isRecent: boolean;
|
|
29
|
+
};
|
|
30
|
+
export declare const ConnectUtil: {
|
|
31
|
+
/**
|
|
32
|
+
* Maps the initial connect view wallets into WalletItems. Includes WalletConnect wallet and injected wallets. If user doesn't have any injected wallets, it'll fill the list with most ranked WalletConnect wallets.
|
|
33
|
+
* @returns The WalletItems for the initial connect view.
|
|
34
|
+
*/
|
|
35
|
+
getInitialWallets(): WalletItem[];
|
|
36
|
+
/**
|
|
37
|
+
* Maps the WalletGuide explorer wallets to WalletItems including search results.
|
|
38
|
+
* @returns The WalletItems for the WalletGuide explorer wallets.
|
|
39
|
+
*/
|
|
40
|
+
getWalletConnectWallets(wcAllWallets: WcWallet[], wcSearchWallets: WcWallet[]): WalletItem[];
|
|
41
|
+
/**
|
|
42
|
+
* Maps the connector to a WalletItem.
|
|
43
|
+
* @param connector - The connector to map to a WalletItem.
|
|
44
|
+
* @param subType - The subtype of the connector.
|
|
45
|
+
* @returns The WalletItem for the connector.
|
|
46
|
+
*/
|
|
47
|
+
mapConnectorToWalletItem(connector: ConnectorWithProviders, subType: ConnectorItemWithKind["subtype"]): WalletItem;
|
|
48
|
+
/**
|
|
49
|
+
* Maps the WalletGuide explorer wallet to a WalletItem.
|
|
50
|
+
* @param w - The WalletGuide explorer wallet.
|
|
51
|
+
* @returns The WalletItem for the WalletGuide explorer wallet.
|
|
52
|
+
*/
|
|
53
|
+
mapWalletToWalletItem(w: WcWallet): WalletItem;
|
|
54
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ChainNamespace } from '@reown/appkit-common';
|
|
2
2
|
import type { Connection } from '@reown/appkit-common';
|
|
3
|
+
import type { WcWallet } from './TypeUtil.js';
|
|
3
4
|
interface ExcludeConnectorAddressFromConnectionsParamters {
|
|
4
5
|
connections: Connection[];
|
|
5
6
|
connectorId?: string;
|
|
@@ -14,5 +15,6 @@ export declare const ConnectionControllerUtil: {
|
|
|
14
15
|
connections: Connection[];
|
|
15
16
|
recentConnections: Connection[];
|
|
16
17
|
};
|
|
18
|
+
onConnectMobile(wallet: WcWallet | undefined): void;
|
|
17
19
|
};
|
|
18
20
|
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
/**
|
|
37
|
+
* Returns the priority of a connector. Base Account has highest priority, followed by Coinbase then the rest.
|
|
38
|
+
*
|
|
39
|
+
* This is needed because Base Account and Coinbase share the same explorer wallet ID.
|
|
40
|
+
* Without prioritization, selecting Base Account could incorrectly trigger the Coinbase Wallet extension.
|
|
41
|
+
*
|
|
42
|
+
* @param connector - The connector to get the priority of.
|
|
43
|
+
* @returns The priority of the connector.
|
|
44
|
+
*/
|
|
45
|
+
getPriority(connector: ConnectorWithProviders): 1 | 0 | 2;
|
|
46
|
+
/**
|
|
47
|
+
* Sorts connectors by priority.
|
|
48
|
+
* @param connectors - The connectors to sort.
|
|
49
|
+
* @returns Sorted connectors.
|
|
50
|
+
*/
|
|
51
|
+
sortConnectorsByPriority(connectors: ConnectorWithProviders[]): ConnectorWithProviders[];
|
|
52
|
+
getAuthName({ email, socialUsername, socialProvider }: {
|
|
53
|
+
email: string;
|
|
54
|
+
socialUsername?: string | null;
|
|
55
|
+
socialProvider?: SocialProvider | null;
|
|
56
|
+
}): string;
|
|
57
|
+
fetchProviderData(connector: Connector): Promise<{
|
|
58
|
+
accounts: string[];
|
|
59
|
+
chainId: number | undefined;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Filter out duplicate custom wallets by RDNS
|
|
63
|
+
* @param wallets
|
|
64
|
+
*/
|
|
65
|
+
getFilteredCustomWallets(wallets: WcWallet[]): WcWallet[];
|
|
66
|
+
hasWalletConnector(wallet: WcWallet): boolean;
|
|
67
|
+
isWalletCompatibleWithCurrentChain(wallet: WcWallet): boolean;
|
|
68
|
+
getFilteredRecentWallets(): WcWallet[];
|
|
69
|
+
getCappedRecommendedWallets(wallets: WcWallet[]): WcWallet[];
|
|
70
|
+
processConnectorsByType(connectors: ConnectorWithProviders[], shouldFilter?: boolean): ConnectorWithProviders[];
|
|
71
|
+
connectorList(): ConnectorOrWalletItem[];
|
|
72
|
+
hasInjectedConnectors(): number;
|
|
73
|
+
};
|
|
74
|
+
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;
|
|
@@ -58,6 +59,7 @@ export declare const ConstantsUtil: {
|
|
|
58
59
|
payWithExchange: boolean;
|
|
59
60
|
payments: boolean;
|
|
60
61
|
reownAuthentication: boolean;
|
|
62
|
+
headless: boolean;
|
|
61
63
|
};
|
|
62
64
|
DEFAULT_REMOTE_FEATURES_DISABLED: {
|
|
63
65
|
readonly email: false;
|
|
@@ -68,12 +70,13 @@ export declare const ConstantsUtil: {
|
|
|
68
70
|
readonly reownBranding: false;
|
|
69
71
|
readonly emailCapture: false;
|
|
70
72
|
readonly reownAuthentication: false;
|
|
73
|
+
readonly headless: false;
|
|
71
74
|
};
|
|
72
75
|
DEFAULT_FEATURES: {
|
|
73
76
|
receive: true;
|
|
74
77
|
send: true;
|
|
75
78
|
emailShowWallets: true;
|
|
76
|
-
connectorTypeOrder: ("
|
|
79
|
+
connectorTypeOrder: ("walletConnect" | "recent" | "injected" | "featured" | "custom" | "external" | "recommended")[];
|
|
77
80
|
analytics: true;
|
|
78
81
|
allWallets: true;
|
|
79
82
|
legalCheckbox: false;
|
|
@@ -83,6 +86,7 @@ export declare const ConstantsUtil: {
|
|
|
83
86
|
connectMethodsOrder: undefined;
|
|
84
87
|
pay: false;
|
|
85
88
|
reownAuthentication: false;
|
|
89
|
+
headless: false;
|
|
86
90
|
};
|
|
87
91
|
DEFAULT_SOCIALS: SocialProvider[];
|
|
88
92
|
DEFAULT_ACCOUNT_TYPES: {
|
|
@@ -103,4 +107,6 @@ export declare const ConstantsUtil: {
|
|
|
103
107
|
SIWX_DEFAULTS: {
|
|
104
108
|
readonly signOutOnDisconnect: true;
|
|
105
109
|
};
|
|
110
|
+
MANDATORY_WALLET_IDS_ON_MOBILE: (string | undefined)[];
|
|
111
|
+
DEFAULT_CONNECT_METHOD_ORDER: ConnectMethod[];
|
|
106
112
|
};
|
|
@@ -71,6 +71,9 @@ export type Connector = {
|
|
|
71
71
|
connectors?: Connector[];
|
|
72
72
|
explorerWallet?: WcWallet;
|
|
73
73
|
};
|
|
74
|
+
export interface ConnectorWithProviders extends Connector {
|
|
75
|
+
connectors?: Connector[];
|
|
76
|
+
}
|
|
74
77
|
export interface AuthConnector extends Connector {
|
|
75
78
|
provider: W3mFrameProvider;
|
|
76
79
|
socials?: SocialProvider[];
|
|
@@ -95,6 +98,7 @@ export interface WcWallet {
|
|
|
95
98
|
id: string;
|
|
96
99
|
name: string;
|
|
97
100
|
badge_type?: BadgeType;
|
|
101
|
+
description?: string;
|
|
98
102
|
chains?: CaipNetworkId[];
|
|
99
103
|
homepage?: string;
|
|
100
104
|
image_id?: string;
|
|
@@ -1067,6 +1071,7 @@ export type RemoteFeatures = {
|
|
|
1067
1071
|
payWithExchange?: boolean;
|
|
1068
1072
|
payments?: boolean;
|
|
1069
1073
|
onramp?: OnRampProvider[] | false;
|
|
1074
|
+
headless?: boolean;
|
|
1070
1075
|
};
|
|
1071
1076
|
export type Features = {
|
|
1072
1077
|
/**
|
|
@@ -1165,6 +1170,12 @@ export type Features = {
|
|
|
1165
1170
|
* @type {boolean}
|
|
1166
1171
|
*/
|
|
1167
1172
|
reownAuthentication?: boolean;
|
|
1173
|
+
/**
|
|
1174
|
+
* @description Enable or disable the AppKit Headless mode to build custom connect user interfaces.
|
|
1175
|
+
* @default false
|
|
1176
|
+
* @type {boolean}
|
|
1177
|
+
*/
|
|
1178
|
+
headless?: boolean;
|
|
1168
1179
|
};
|
|
1169
1180
|
export type FeaturesKeys = Exclude<keyof Features, 'swaps' | 'onramp' | 'email' | 'socials' | 'history'>;
|
|
1170
1181
|
export type WalletGuideType = 'get-started' | 'explore';
|
|
@@ -1196,13 +1207,13 @@ export type ConnectionStatus = 'connected' | 'disconnected' | 'connecting' | 're
|
|
|
1196
1207
|
export type PreferredAccountTypes = {
|
|
1197
1208
|
[Key in keyof NamespaceTypeMap]?: NamespaceTypeMap[Key];
|
|
1198
1209
|
};
|
|
1199
|
-
export type FeatureID = 'multi_wallet' | 'activity' | 'onramp' | 'swap' | 'social_login' | 'reown_branding' | 'email_capture' | 'fund_from_exchange' | 'payments' | 'reown_authentication';
|
|
1210
|
+
export type FeatureID = 'multi_wallet' | 'activity' | 'onramp' | 'swap' | 'social_login' | 'reown_branding' | 'email_capture' | 'fund_from_exchange' | 'payments' | 'reown_authentication' | 'headless';
|
|
1200
1211
|
export interface BaseFeature<T extends FeatureID, C extends string[] | null> {
|
|
1201
1212
|
id: T;
|
|
1202
1213
|
isEnabled: boolean;
|
|
1203
1214
|
config: C;
|
|
1204
1215
|
}
|
|
1205
|
-
export type TypedFeatureConfig = BaseFeature<'activity', null | []> | BaseFeature<'onramp', OnRampProvider[]> | BaseFeature<'swap', SwapProvider[]> | BaseFeature<'social_login', (SocialProvider | 'email')[]> | BaseFeature<'reown_branding', null | []> | BaseFeature<'multi_wallet', null | []> | BaseFeature<'email_capture', EmailCaptureOptions[]>;
|
|
1216
|
+
export type TypedFeatureConfig = BaseFeature<'activity', null | []> | BaseFeature<'onramp', OnRampProvider[]> | BaseFeature<'swap', SwapProvider[]> | BaseFeature<'social_login', (SocialProvider | 'email')[]> | BaseFeature<'reown_branding', null | []> | BaseFeature<'multi_wallet', null | []> | BaseFeature<'email_capture', EmailCaptureOptions[]> | BaseFeature<'headless', null | []>;
|
|
1206
1217
|
export type ApiGetProjectConfigResponse = {
|
|
1207
1218
|
features: TypedFeatureConfig[];
|
|
1208
1219
|
};
|
|
@@ -1278,6 +1289,12 @@ export type FeatureConfigMap = {
|
|
|
1278
1289
|
returnType: boolean;
|
|
1279
1290
|
isLegacy: false;
|
|
1280
1291
|
};
|
|
1292
|
+
headless: {
|
|
1293
|
+
apiFeatureName: 'headless';
|
|
1294
|
+
localFeatureName: 'headless';
|
|
1295
|
+
returnType: boolean;
|
|
1296
|
+
isLegacy: false;
|
|
1297
|
+
};
|
|
1281
1298
|
};
|
|
1282
1299
|
export type FeatureKey = keyof FeatureConfigMap;
|
|
1283
1300
|
export type Tier = 'none' | 'starter' | 'pro' | 'enteprise';
|
|
@@ -1285,4 +1302,15 @@ export type ProjectLimits = {
|
|
|
1285
1302
|
isAboveRpcLimit: boolean;
|
|
1286
1303
|
isAboveMauLimit: boolean;
|
|
1287
1304
|
};
|
|
1305
|
+
export type ConnectorItemWithKind = {
|
|
1306
|
+
kind: 'connector';
|
|
1307
|
+
subtype: 'injected' | 'announced' | 'multiChain' | 'external' | 'walletConnect';
|
|
1308
|
+
connector: ConnectorWithProviders;
|
|
1309
|
+
};
|
|
1310
|
+
export type WalletItemWithKind = {
|
|
1311
|
+
kind: 'wallet';
|
|
1312
|
+
subtype: 'featured' | 'recommended' | 'custom' | 'recent';
|
|
1313
|
+
wallet: WcWallet;
|
|
1314
|
+
};
|
|
1315
|
+
export type ConnectorOrWalletItem = ConnectorItemWithKind | WalletItemWithKind;
|
|
1288
1316
|
export {};
|