@reown/appkit-core 1.6.8 → 1.6.9-rc.1.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/react.js +24 -14
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/exports/vue.js +40 -44
- package/dist/esm/exports/vue.js.map +1 -1
- package/dist/esm/src/controllers/AccountController.js +6 -2
- package/dist/esm/src/controllers/AccountController.js.map +1 -1
- package/dist/esm/src/controllers/ApiController.js +5 -0
- package/dist/esm/src/controllers/ApiController.js.map +1 -1
- package/dist/esm/src/controllers/BlockchainApiController.js +55 -28
- package/dist/esm/src/controllers/BlockchainApiController.js.map +1 -1
- package/dist/esm/src/controllers/ChainController.js +39 -27
- package/dist/esm/src/controllers/ChainController.js.map +1 -1
- package/dist/esm/src/controllers/ConnectionController.js +3 -0
- package/dist/esm/src/controllers/ConnectionController.js.map +1 -1
- package/dist/esm/src/controllers/ConnectorController.js +2 -2
- package/dist/esm/src/controllers/ConnectorController.js.map +1 -1
- package/dist/esm/src/controllers/EnsController.js +10 -0
- package/dist/esm/src/controllers/EnsController.js.map +1 -1
- package/dist/esm/src/controllers/EventsController.js +5 -5
- package/dist/esm/src/controllers/EventsController.js.map +1 -1
- package/dist/esm/src/controllers/OptionsController.js +4 -1
- package/dist/esm/src/controllers/OptionsController.js.map +1 -1
- package/dist/esm/src/controllers/RouterController.js +3 -0
- package/dist/esm/src/controllers/RouterController.js.map +1 -1
- package/dist/esm/src/controllers/SendController.js +46 -9
- package/dist/esm/src/controllers/SendController.js.map +1 -1
- package/dist/esm/src/controllers/SwapController.js +5 -6
- package/dist/esm/src/controllers/SwapController.js.map +1 -1
- package/dist/esm/src/utils/ConstantsUtil.js +6 -6
- package/dist/esm/src/utils/ConstantsUtil.js.map +1 -1
- package/dist/esm/src/utils/CoreHelperUtil.js +48 -1
- package/dist/esm/src/utils/CoreHelperUtil.js.map +1 -1
- package/dist/esm/src/utils/ERC7811Util.js +111 -0
- package/dist/esm/src/utils/ERC7811Util.js.map +1 -0
- package/dist/esm/src/utils/OptionsUtil.js +18 -0
- package/dist/esm/src/utils/OptionsUtil.js.map +1 -1
- package/dist/esm/src/utils/SIWXUtil.js +2 -1
- package/dist/esm/src/utils/SIWXUtil.js.map +1 -1
- package/dist/esm/src/utils/SendApiUtil.js +65 -0
- package/dist/esm/src/utils/SendApiUtil.js.map +1 -0
- package/dist/esm/src/utils/StorageUtil.js +208 -0
- package/dist/esm/src/utils/StorageUtil.js.map +1 -1
- package/dist/esm/src/utils/SwapApiUtil.js +4 -0
- package/dist/esm/src/utils/SwapApiUtil.js.map +1 -1
- package/dist/esm/tests/controllers/BlockchainApiController.test.js +23 -0
- package/dist/esm/tests/controllers/BlockchainApiController.test.js.map +1 -0
- package/dist/esm/tests/controllers/ChainController.test.js +2 -1
- package/dist/esm/tests/controllers/ChainController.test.js.map +1 -1
- package/dist/esm/tests/controllers/ConnectionController.test.js +4 -2
- package/dist/esm/tests/controllers/ConnectionController.test.js.map +1 -1
- package/dist/esm/tests/controllers/EventsController.test.js +11 -0
- package/dist/esm/tests/controllers/EventsController.test.js.map +1 -1
- package/dist/esm/tests/controllers/RouterController.test.js +17 -0
- package/dist/esm/tests/controllers/RouterController.test.js.map +1 -1
- package/dist/esm/tests/controllers/SendController.test.js +89 -4
- package/dist/esm/tests/controllers/SendController.test.js.map +1 -1
- package/dist/esm/tests/controllers/SwapController.test.js +9 -0
- package/dist/esm/tests/controllers/SwapController.test.js.map +1 -1
- package/dist/esm/tests/hooks/react.test.js +69 -78
- package/dist/esm/tests/hooks/react.test.js.map +1 -1
- package/dist/esm/tests/hooks/vue.test.js +56 -0
- package/dist/esm/tests/hooks/vue.test.js.map +1 -0
- package/dist/esm/tests/mocks/ChainController.js +24 -0
- package/dist/esm/tests/mocks/ChainController.js.map +1 -0
- package/dist/esm/tests/mocks/useAppKitAccount.js +41 -0
- package/dist/esm/tests/mocks/useAppKitAccount.js.map +1 -0
- package/dist/esm/tests/utils/ERC7811.test.js +268 -0
- package/dist/esm/tests/utils/ERC7811.test.js.map +1 -0
- package/dist/esm/tests/utils/SendApiUtil.test.js +340 -0
- package/dist/esm/tests/utils/SendApiUtil.test.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/types/exports/react.d.ts +4 -1
- package/dist/types/exports/vue.d.ts +4 -1
- package/dist/types/src/controllers/AccountController.d.ts +15 -15
- package/dist/types/src/controllers/AlertController.d.ts +3 -2
- package/dist/types/src/controllers/ApiController.d.ts +5 -3
- package/dist/types/src/controllers/AssetController.d.ts +4 -2
- package/dist/types/src/controllers/BlockchainApiController.d.ts +10 -6
- package/dist/types/src/controllers/ChainController.d.ts +10 -7
- package/dist/types/src/controllers/ConnectionController.d.ts +11 -7
- package/dist/types/src/controllers/ConnectorController.d.ts +6 -4
- package/dist/types/src/controllers/EnsController.d.ts +2 -1
- package/dist/types/src/controllers/EventsController.d.ts +5 -5
- package/dist/types/src/controllers/ModalController.d.ts +5 -3
- package/dist/types/src/controllers/OnRampController.d.ts +3 -1
- package/dist/types/src/controllers/OptionsController.d.ts +117 -46
- package/dist/types/src/controllers/RouterController.d.ts +5 -4
- package/dist/types/src/controllers/SendController.d.ts +16 -11
- package/dist/types/src/controllers/SnackController.d.ts +6 -4
- package/dist/types/src/controllers/SwapController.d.ts +2 -1
- package/dist/types/src/controllers/ThemeController.d.ts +2 -2
- package/dist/types/src/controllers/TooltipController.d.ts +3 -2
- package/dist/types/src/controllers/TransactionsController.d.ts +2 -2
- package/dist/types/src/utils/CoreHelperUtil.d.ts +5 -2
- package/dist/types/src/utils/ERC7811Util.d.ts +67 -0
- package/dist/types/src/utils/OptionsUtil.d.ts +1 -0
- package/dist/types/src/utils/SendApiUtil.d.ts +13 -0
- package/dist/types/src/utils/StorageUtil.d.ts +61 -1
- package/dist/types/src/utils/SwapApiUtil.d.ts +1 -1
- package/dist/types/src/utils/TypeUtil.d.ts +15 -22
- package/dist/types/tests/controllers/BlockchainApiController.test.d.ts +1 -0
- package/dist/types/tests/hooks/vue.test.d.ts +2 -0
- package/dist/types/tests/mocks/ChainController.d.ts +2 -0
- package/dist/types/tests/mocks/SwapController.d.ts +4 -3
- package/dist/types/tests/mocks/useAppKitAccount.d.ts +40 -0
- package/dist/types/tests/utils/ERC7811.test.d.ts +1 -0
- package/dist/types/tests/utils/SendApiUtil.test.d.ts +1 -0
- package/package.json +4 -4
|
@@ -12,6 +12,7 @@ export interface ContractWriteParams {
|
|
|
12
12
|
decimals: string;
|
|
13
13
|
}
|
|
14
14
|
export interface SendControllerState {
|
|
15
|
+
tokenBalances: Balance[];
|
|
15
16
|
token?: Balance;
|
|
16
17
|
sendTokenAmount?: number;
|
|
17
18
|
receiverAddress?: string;
|
|
@@ -21,23 +22,26 @@ export interface SendControllerState {
|
|
|
21
22
|
gasPriceInUSD?: number;
|
|
22
23
|
networkBalanceInUSD?: string;
|
|
23
24
|
loading: boolean;
|
|
25
|
+
lastRetry?: number;
|
|
24
26
|
}
|
|
27
|
+
type StateKey = keyof SendControllerState;
|
|
25
28
|
export declare const SendController: {
|
|
26
29
|
state: SendControllerState;
|
|
27
30
|
subscribe(callback: (newState: SendControllerState) => void): () => void;
|
|
28
|
-
subscribeKey<K extends
|
|
29
|
-
setToken(token: SendControllerState[
|
|
30
|
-
setTokenAmount(sendTokenAmount: SendControllerState[
|
|
31
|
-
setReceiverAddress(receiverAddress: SendControllerState[
|
|
32
|
-
setReceiverProfileImageUrl(receiverProfileImageUrl: SendControllerState[
|
|
33
|
-
setReceiverProfileName(receiverProfileName: SendControllerState[
|
|
34
|
-
setGasPrice(gasPrice: SendControllerState[
|
|
35
|
-
setGasPriceInUsd(gasPriceInUSD: SendControllerState[
|
|
36
|
-
setNetworkBalanceInUsd(networkBalanceInUSD: SendControllerState[
|
|
37
|
-
setLoading(loading: SendControllerState[
|
|
31
|
+
subscribeKey<K extends StateKey>(key: K, callback: (value: SendControllerState[K]) => void): () => void;
|
|
32
|
+
setToken(token: SendControllerState["token"]): void;
|
|
33
|
+
setTokenAmount(sendTokenAmount: SendControllerState["sendTokenAmount"]): void;
|
|
34
|
+
setReceiverAddress(receiverAddress: SendControllerState["receiverAddress"]): void;
|
|
35
|
+
setReceiverProfileImageUrl(receiverProfileImageUrl: SendControllerState["receiverProfileImageUrl"]): void;
|
|
36
|
+
setReceiverProfileName(receiverProfileName: SendControllerState["receiverProfileName"]): void;
|
|
37
|
+
setGasPrice(gasPrice: SendControllerState["gasPrice"]): void;
|
|
38
|
+
setGasPriceInUsd(gasPriceInUSD: SendControllerState["gasPriceInUSD"]): void;
|
|
39
|
+
setNetworkBalanceInUsd(networkBalanceInUSD: SendControllerState["networkBalanceInUSD"]): void;
|
|
40
|
+
setLoading(loading: SendControllerState["loading"]): void;
|
|
38
41
|
sendToken(): void;
|
|
39
42
|
sendEvmToken(): void;
|
|
40
|
-
|
|
43
|
+
fetchTokenBalance(onError?: (error: unknown) => void): Promise<Balance[]>;
|
|
44
|
+
fetchNetworkBalance(): void;
|
|
41
45
|
isInsufficientNetworkTokenForGas(networkBalanceInUSD: string, gasPriceInUSD: number | undefined): boolean;
|
|
42
46
|
hasInsufficientGasFunds(): boolean;
|
|
43
47
|
sendNativeToken(params: TxParams): Promise<void>;
|
|
@@ -45,3 +49,4 @@ export declare const SendController: {
|
|
|
45
49
|
sendSolanaToken(): void;
|
|
46
50
|
resetSend(): void;
|
|
47
51
|
};
|
|
52
|
+
export {};
|
|
@@ -13,15 +13,17 @@ export type SnackControllerShowOptions = {
|
|
|
13
13
|
svg?: SnackControllerState['svg'];
|
|
14
14
|
variant?: SnackControllerState['variant'];
|
|
15
15
|
};
|
|
16
|
+
type StateKey = keyof SnackControllerState;
|
|
16
17
|
export declare const SnackController: {
|
|
17
18
|
state: SnackControllerState;
|
|
18
|
-
subscribeKey<K extends
|
|
19
|
-
showLoading(message: SnackControllerState[
|
|
20
|
-
showSuccess(message: SnackControllerState[
|
|
21
|
-
showSvg(message: SnackControllerState[
|
|
19
|
+
subscribeKey<K extends StateKey>(key: K, callback: (value: SnackControllerState[K]) => void): () => void;
|
|
20
|
+
showLoading(message: SnackControllerState["message"], options?: SnackControllerShowOptions): void;
|
|
21
|
+
showSuccess(message: SnackControllerState["message"]): void;
|
|
22
|
+
showSvg(message: SnackControllerState["message"], svg: NonNullable<SnackControllerState["svg"]>): void;
|
|
22
23
|
showError(message: unknown): void;
|
|
23
24
|
hide(): void;
|
|
24
25
|
_showMessage({ message, svg, variant, autoClose }: {
|
|
25
26
|
message: string;
|
|
26
27
|
} & SnackControllerShowOptions): void;
|
|
27
28
|
};
|
|
29
|
+
export {};
|
|
@@ -56,10 +56,11 @@ export interface TokenInfo {
|
|
|
56
56
|
isFoT?: boolean;
|
|
57
57
|
tags?: string[];
|
|
58
58
|
}
|
|
59
|
+
type StateKey = keyof SwapControllerState;
|
|
59
60
|
export declare const SwapController: {
|
|
60
61
|
state: SwapControllerState;
|
|
61
62
|
subscribe(callback: (newState: SwapControllerState) => void): () => void;
|
|
62
|
-
subscribeKey<K extends
|
|
63
|
+
subscribeKey<K extends StateKey>(key: K, callback: (value: SwapControllerState[K]) => void): () => void;
|
|
63
64
|
getParams(): {
|
|
64
65
|
networkAddress: string;
|
|
65
66
|
fromAddress: string;
|
|
@@ -8,8 +8,8 @@ export interface ThemeControllerState {
|
|
|
8
8
|
export declare const ThemeController: {
|
|
9
9
|
state: ThemeControllerState;
|
|
10
10
|
subscribe(callback: (newState: ThemeControllerState) => void): () => void;
|
|
11
|
-
setThemeMode(themeMode: ThemeControllerState[
|
|
12
|
-
setThemeVariables(themeVariables: ThemeControllerState[
|
|
11
|
+
setThemeMode(themeMode: ThemeControllerState["themeMode"]): void;
|
|
12
|
+
setThemeVariables(themeVariables: ThemeControllerState["themeVariables"]): void;
|
|
13
13
|
getSnapshot(): {
|
|
14
14
|
readonly themeMode: ThemeMode;
|
|
15
15
|
readonly themeVariables: {
|
|
@@ -10,14 +10,15 @@ export interface TooltipControllerState {
|
|
|
10
10
|
open: boolean;
|
|
11
11
|
variant: 'shade' | 'fill';
|
|
12
12
|
}
|
|
13
|
+
type StateKey = keyof TooltipControllerState;
|
|
13
14
|
export declare const TooltipController: {
|
|
14
15
|
state: TooltipControllerState;
|
|
15
16
|
subscribe(callback: (newState: TooltipControllerState) => void): () => void;
|
|
16
|
-
subscribeKey<K extends
|
|
17
|
+
subscribeKey<K extends StateKey>(key: K, callback: (value: TooltipControllerState[K]) => void): () => void;
|
|
17
18
|
showTooltip({ message, triggerRect, variant }: {
|
|
18
19
|
message: string;
|
|
19
20
|
triggerRect: TriggerRect;
|
|
20
|
-
variant:
|
|
21
|
+
variant: "shade" | "fill";
|
|
21
22
|
}): void;
|
|
22
23
|
hide(): void;
|
|
23
24
|
};
|
|
@@ -14,8 +14,8 @@ export interface TransactionsControllerState {
|
|
|
14
14
|
export declare const TransactionsController: {
|
|
15
15
|
state: TransactionsControllerState;
|
|
16
16
|
subscribe(callback: (newState: TransactionsControllerState) => void): () => void;
|
|
17
|
-
setLastNetworkInView(lastNetworkInView: TransactionsControllerState[
|
|
18
|
-
fetchTransactions(accountAddress?: string, onramp?:
|
|
17
|
+
setLastNetworkInView(lastNetworkInView: TransactionsControllerState["lastNetworkInView"]): void;
|
|
18
|
+
fetchTransactions(accountAddress?: string, onramp?: "coinbase"): Promise<void>;
|
|
19
19
|
groupTransactionsByYearAndMonth(transactionsMap?: TransactionByYearMap, transactions?: Transaction[]): TransactionByYearMap;
|
|
20
20
|
filterSpamTransactions(transactions: Transaction[]): Transaction[];
|
|
21
21
|
filterByConnectedChain(transactions: Transaction[]): Transaction[];
|
|
@@ -22,7 +22,7 @@ export declare const CoreHelperUtil: {
|
|
|
22
22
|
isHttpUrl(url: string): boolean;
|
|
23
23
|
formatNativeUrl(appUrl: string, wcUri: string): LinkingRecord;
|
|
24
24
|
formatUniversalUrl(appUrl: string, wcUri: string): LinkingRecord;
|
|
25
|
-
getOpenTargetForPlatform(target:
|
|
25
|
+
getOpenTargetForPlatform(target: OpenTarget): "_blank" | "_self" | "popupWindow" | "_top";
|
|
26
26
|
openHref(href: string, target: OpenTarget, features?: string): void;
|
|
27
27
|
returnOpenHref(href: string, target: OpenTarget, features?: string): Window | null;
|
|
28
28
|
isTelegram(): boolean;
|
|
@@ -48,6 +48,9 @@ export declare const CoreHelperUtil: {
|
|
|
48
48
|
uniqueBy<T>(arr: T[], key: keyof T): T[];
|
|
49
49
|
generateSdkVersion(adapters: ChainAdapter[], platform: SDKFramework, version: string): AppKitSdkVersion;
|
|
50
50
|
createAccount<N extends ChainNamespace>(namespace: N, address: string, type: NamespaceTypeMap[N], publicKey?: string, path?: string): AccountTypeMap[N];
|
|
51
|
-
isCaipAddress(address?: unknown): address is
|
|
51
|
+
isCaipAddress(address?: unknown): address is CaipAddress;
|
|
52
|
+
isMac(): boolean;
|
|
53
|
+
formatTelegramSocialLoginUrl(url: string): string;
|
|
54
|
+
injectIntoUrl(url: string, key: string, appendString: string): string;
|
|
52
55
|
};
|
|
53
56
|
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Balance, CaipNetworkId, ChainNamespace } from '@reown/appkit-common';
|
|
2
|
+
type Hex = `0x${string}`;
|
|
3
|
+
interface Asset {
|
|
4
|
+
address: `0x${string}` | 'native';
|
|
5
|
+
balance: `0x${string}`;
|
|
6
|
+
type: 'NATIVE' | 'ERC20';
|
|
7
|
+
metadata: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export interface WalletGetAssetsRequest {
|
|
10
|
+
account: Hex;
|
|
11
|
+
assetFilter?: Record<Hex, (Hex | 'native')[]>;
|
|
12
|
+
assetTypeFilter?: ('NATIVE' | 'ERC20')[];
|
|
13
|
+
chainFilter?: Hex[];
|
|
14
|
+
}
|
|
15
|
+
export type WalletGetAssetsResponse = Record<Hex, Asset[]>;
|
|
16
|
+
export declare const ERC7811Utils: {
|
|
17
|
+
/**
|
|
18
|
+
* Creates a Balance object from an ERC7811 Asset object
|
|
19
|
+
* @param asset - Asset object to convert
|
|
20
|
+
* @param chainId - Chain ID in CAIP-2 format
|
|
21
|
+
* @returns Balance object
|
|
22
|
+
*/
|
|
23
|
+
createBalance(asset: Asset, chainId: string): Balance;
|
|
24
|
+
/**
|
|
25
|
+
* Converts a hex string to a Balance object
|
|
26
|
+
* @param hex - Hex string to convert
|
|
27
|
+
* @param decimals - Number of decimals to use
|
|
28
|
+
* @returns Balance object
|
|
29
|
+
*/
|
|
30
|
+
convertHexToBalance({ hex, decimals }: {
|
|
31
|
+
hex: `0x${string}`;
|
|
32
|
+
decimals: number;
|
|
33
|
+
}): string;
|
|
34
|
+
/**
|
|
35
|
+
* Converts an address to a CAIP-10 address
|
|
36
|
+
* @param address - Address to convert
|
|
37
|
+
* @param chainId - Chain ID in CAIP-2 format
|
|
38
|
+
* @returns CAIP-10 address
|
|
39
|
+
*/
|
|
40
|
+
convertAddressToCAIP10Address(address: `0x${string}`, chainId: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a CAIP-2 Chain ID from a chain ID and namespace
|
|
43
|
+
* @param chainId - Chain ID in hex format
|
|
44
|
+
* @param namespace - Chain namespace
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
createCAIP2ChainId(chainId: `0x${string}`, namespace: ChainNamespace): string;
|
|
48
|
+
/**
|
|
49
|
+
* Gets the chain ID in hex format from a CAIP-2 Chain ID
|
|
50
|
+
* @param caip2ChainId - CAIP-2 Chain ID
|
|
51
|
+
* @returns Chain ID in hex format
|
|
52
|
+
*/
|
|
53
|
+
getChainIdHexFromCAIP2ChainId(caip2ChainId: CaipNetworkId): `0x${string}`;
|
|
54
|
+
/**
|
|
55
|
+
* Checks if a response is a valid WalletGetAssetsResponse
|
|
56
|
+
* @param response - The response to check
|
|
57
|
+
* @returns True if the response is a valid WalletGetAssetsResponse, false otherwise
|
|
58
|
+
*/
|
|
59
|
+
isWalletGetAssetsResponse(response: WalletGetAssetsResponse): response is WalletGetAssetsResponse;
|
|
60
|
+
/**
|
|
61
|
+
* Checks if an asset object is valid.
|
|
62
|
+
* @param asset - The asset object to check.
|
|
63
|
+
* @returns True if the asset is valid, false otherwise.
|
|
64
|
+
*/
|
|
65
|
+
isValidAsset(asset: Asset): asset is Asset;
|
|
66
|
+
};
|
|
67
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Features, FeaturesKeys } from './TypeUtil.js';
|
|
2
2
|
export declare const OptionsUtil: {
|
|
3
3
|
getFeatureValue(key: FeaturesKeys, features?: Features): boolean | import("./TypeUtil.js").SocialProvider[] | import("./TypeUtil.js").WalletFeature[] | import("./TypeUtil.js").ConnectMethod[] | undefined;
|
|
4
|
+
filterSocialsByPlatform<T>(socials: Features["socials"]): import("./TypeUtil.js").SocialProvider[] | T;
|
|
4
5
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CaipNetwork } from '@reown/appkit-common';
|
|
2
|
+
import type { SwapTokenWithBalance } from './TypeUtil.js';
|
|
3
|
+
import type { BlockchainApiBalanceResponse } from './TypeUtil.js';
|
|
4
|
+
export declare const SendApiUtil: {
|
|
5
|
+
getMyTokensWithBalance(forceUpdate?: string): Promise<BlockchainApiBalanceResponse["balances"]>;
|
|
6
|
+
getEIP155Balances(address: string, caipNetwork: CaipNetwork): Promise<import("@reown/appkit-common").Balance[] | null>;
|
|
7
|
+
/**
|
|
8
|
+
* The 1Inch API includes many low-quality tokens in the balance response,
|
|
9
|
+
* which appear inconsistently. This filter prevents them from being displayed.
|
|
10
|
+
*/
|
|
11
|
+
filterLowQualityTokens(balances: BlockchainApiBalanceResponse["balances"]): import("@reown/appkit-common").Balance[];
|
|
12
|
+
mapBalancesToSwapTokens(balances: BlockchainApiBalanceResponse["balances"]): SwapTokenWithBalance[];
|
|
13
|
+
};
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { type CaipNetworkId, type ChainNamespace } from '@reown/appkit-common';
|
|
2
|
-
import type { ConnectionStatus, SocialProvider, WcWallet } from './TypeUtil.js';
|
|
2
|
+
import type { BlockchainApiBalanceResponse, BlockchainApiIdentityResponse, BlockchainApiLookupEnsName, ConnectionStatus, SocialProvider, WcWallet } from './TypeUtil.js';
|
|
3
3
|
export declare const StorageUtil: {
|
|
4
|
+
cacheExpiry: {
|
|
5
|
+
portfolio: number;
|
|
6
|
+
nativeBalance: number;
|
|
7
|
+
ens: number;
|
|
8
|
+
identity: number;
|
|
9
|
+
};
|
|
10
|
+
isCacheExpired(timestamp: number, cacheExpiry: number): boolean;
|
|
4
11
|
getActiveNetworkProps(): {
|
|
5
12
|
namespace: ChainNamespace | undefined;
|
|
6
13
|
caipNetworkId: `eip155:${string}` | `eip155:${number}` | `solana:${string}` | `solana:${number}` | `polkadot:${string}` | `polkadot:${number}` | `bip122:${string}` | `bip122:${number}` | undefined;
|
|
@@ -33,4 +40,57 @@ export declare const StorageUtil: {
|
|
|
33
40
|
setConnectedNamespaces(namespaces: ChainNamespace[]): void;
|
|
34
41
|
addConnectedNamespace(namespace: ChainNamespace): void;
|
|
35
42
|
removeConnectedNamespace(namespace: ChainNamespace): void;
|
|
43
|
+
getBalanceCache(): Record<string, {
|
|
44
|
+
timestamp: number;
|
|
45
|
+
balance: BlockchainApiBalanceResponse;
|
|
46
|
+
}>;
|
|
47
|
+
removeAddressFromBalanceCache(caipAddress: string): void;
|
|
48
|
+
getBalanceCacheForCaipAddress(caipAddress: string): BlockchainApiBalanceResponse | undefined;
|
|
49
|
+
updateBalanceCache(params: {
|
|
50
|
+
caipAddress: string;
|
|
51
|
+
balance: BlockchainApiBalanceResponse;
|
|
52
|
+
timestamp: number;
|
|
53
|
+
}): void;
|
|
54
|
+
getNativeBalanceCache(): Record<string, {
|
|
55
|
+
caipAddress: string;
|
|
56
|
+
balance: string;
|
|
57
|
+
symbol: string;
|
|
58
|
+
timestamp: number;
|
|
59
|
+
}>;
|
|
60
|
+
removeAddressFromNativeBalanceCache(caipAddress: string): void;
|
|
61
|
+
getNativeBalanceCacheForCaipAddress(caipAddress: string): {
|
|
62
|
+
caipAddress: string;
|
|
63
|
+
balance: string;
|
|
64
|
+
symbol: string;
|
|
65
|
+
timestamp: number;
|
|
66
|
+
} | undefined;
|
|
67
|
+
updateNativeBalanceCache(params: {
|
|
68
|
+
caipAddress: string;
|
|
69
|
+
balance: string;
|
|
70
|
+
symbol: string;
|
|
71
|
+
timestamp: number;
|
|
72
|
+
}): void;
|
|
73
|
+
getEnsCache(): Record<string, {
|
|
74
|
+
ens: BlockchainApiLookupEnsName[];
|
|
75
|
+
timestamp: number;
|
|
76
|
+
}>;
|
|
77
|
+
getEnsFromCacheForAddress(address: string): BlockchainApiLookupEnsName[] | undefined;
|
|
78
|
+
updateEnsCache(params: {
|
|
79
|
+
address: string;
|
|
80
|
+
timestamp: number;
|
|
81
|
+
ens: BlockchainApiLookupEnsName[];
|
|
82
|
+
}): void;
|
|
83
|
+
removeEnsFromCache(address: string): void;
|
|
84
|
+
getIdentityCache(): Record<string, {
|
|
85
|
+
identity: BlockchainApiIdentityResponse;
|
|
86
|
+
timestamp: number;
|
|
87
|
+
}>;
|
|
88
|
+
getIdentityFromCacheForAddress(address: string): BlockchainApiIdentityResponse | undefined;
|
|
89
|
+
updateIdentityCache(params: {
|
|
90
|
+
address: string;
|
|
91
|
+
timestamp: number;
|
|
92
|
+
identity: BlockchainApiIdentityResponse;
|
|
93
|
+
}): void;
|
|
94
|
+
removeIdentityFromCache(address: string): void;
|
|
95
|
+
clearAddressCache(): void;
|
|
36
96
|
};
|
|
@@ -23,5 +23,5 @@ export declare const SwapApiUtil: {
|
|
|
23
23
|
sourceTokenDecimals: number;
|
|
24
24
|
}): Promise<boolean>;
|
|
25
25
|
getMyTokensWithBalance(forceUpdate?: string): Promise<SwapTokenWithBalance[]>;
|
|
26
|
-
mapBalancesToSwapTokens(balances: BlockchainApiBalanceResponse[
|
|
26
|
+
mapBalancesToSwapTokens(balances: BlockchainApiBalanceResponse["balances"]): SwapTokenWithBalance[];
|
|
27
27
|
};
|
|
@@ -32,6 +32,7 @@ export type CaipNetworkCoinbaseNetwork = 'Ethereum' | 'Arbitrum One' | 'Polygon'
|
|
|
32
32
|
export type ConnectedWalletInfo = {
|
|
33
33
|
name: string;
|
|
34
34
|
icon?: string;
|
|
35
|
+
type?: string;
|
|
35
36
|
[key: string]: unknown;
|
|
36
37
|
};
|
|
37
38
|
export type User = {
|
|
@@ -676,6 +677,7 @@ export type Event = {
|
|
|
676
677
|
address?: string;
|
|
677
678
|
event: 'SEND_ERROR';
|
|
678
679
|
properties: {
|
|
680
|
+
message: string;
|
|
679
681
|
isSmartAccount: boolean;
|
|
680
682
|
network: string;
|
|
681
683
|
token: string;
|
|
@@ -771,6 +773,18 @@ export type AccountTypeMap = {
|
|
|
771
773
|
path?: K extends 'bip122' ? string : never;
|
|
772
774
|
};
|
|
773
775
|
};
|
|
776
|
+
export type WalletGetAssetsParams = {
|
|
777
|
+
account: `0x${string}`;
|
|
778
|
+
assetFilter?: Record<`0x${string}`, (`0x${string}` | 'native')[]>;
|
|
779
|
+
assetTypeFilter?: ('NATIVE' | 'ERC20')[];
|
|
780
|
+
chainFilter?: `0x${string}`[];
|
|
781
|
+
};
|
|
782
|
+
export type WalletGetAssetsResponse = Record<`0x${string}`, {
|
|
783
|
+
address: `0x${string}` | 'native';
|
|
784
|
+
balance: `0x${string}`;
|
|
785
|
+
type: 'NATIVE' | 'ERC20';
|
|
786
|
+
metadata: Record<string, unknown>;
|
|
787
|
+
}[]>;
|
|
774
788
|
export type AccountType = AccountTypeMap[ChainNamespace];
|
|
775
789
|
export type SendTransactionArgs = {
|
|
776
790
|
chainNamespace?: undefined | 'eip155';
|
|
@@ -818,31 +832,10 @@ export type AdapterNetworkState = {
|
|
|
818
832
|
allowUnsupportedCaipNetwork?: boolean;
|
|
819
833
|
smartAccountEnabledNetworks?: number[];
|
|
820
834
|
};
|
|
821
|
-
export type AdapterAccountState = {
|
|
822
|
-
currentTab: number;
|
|
823
|
-
caipAddress?: CaipAddress;
|
|
824
|
-
address?: string;
|
|
825
|
-
addressLabels: Map<string, string>;
|
|
826
|
-
allAccounts: AccountType[];
|
|
827
|
-
balance?: string;
|
|
828
|
-
balanceSymbol?: string;
|
|
829
|
-
profileName?: string | null;
|
|
830
|
-
profileImage?: string | null;
|
|
831
|
-
addressExplorerUrl?: string;
|
|
832
|
-
smartAccountDeployed?: boolean;
|
|
833
|
-
socialProvider?: SocialProvider;
|
|
834
|
-
tokenBalance?: Balance[];
|
|
835
|
-
shouldUpdateToAddress?: string;
|
|
836
|
-
connectedWalletInfo?: ConnectedWalletInfo;
|
|
837
|
-
preferredAccountType?: W3mFrameTypes.AccountType;
|
|
838
|
-
socialWindow?: Window;
|
|
839
|
-
farcasterUrl?: string;
|
|
840
|
-
status?: 'reconnecting' | 'connected' | 'disconnected' | 'connecting';
|
|
841
|
-
};
|
|
842
835
|
export type ChainAdapter = {
|
|
843
836
|
connectionControllerClient?: ConnectionControllerClient;
|
|
844
837
|
networkControllerClient?: NetworkControllerClient;
|
|
845
|
-
accountState?:
|
|
838
|
+
accountState?: AccountControllerState;
|
|
846
839
|
networkState?: AdapterNetworkState;
|
|
847
840
|
namespace?: ChainNamespace;
|
|
848
841
|
caipNetworks?: CaipNetwork[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { CaipAddress } from '@reown/appkit-common';
|
|
1
2
|
export declare const tokensResponse: {
|
|
2
3
|
tokens: {
|
|
3
4
|
name: string;
|
|
4
5
|
symbol: string;
|
|
5
|
-
address:
|
|
6
|
+
address: CaipAddress;
|
|
6
7
|
decimals: number;
|
|
7
8
|
logoUri: string;
|
|
8
9
|
eip2612: boolean;
|
|
@@ -57,8 +58,8 @@ export declare const swapQuoteResponse: {
|
|
|
57
58
|
};
|
|
58
59
|
export declare const swapCalldataResponse: {
|
|
59
60
|
tx: {
|
|
60
|
-
from:
|
|
61
|
-
to:
|
|
61
|
+
from: CaipAddress;
|
|
62
|
+
to: CaipAddress;
|
|
62
63
|
data: `0x${string}`;
|
|
63
64
|
amount: string;
|
|
64
65
|
eip155: {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const defaultAccountState: {
|
|
2
|
+
allAccounts: never[];
|
|
3
|
+
address: undefined;
|
|
4
|
+
caipAddress: undefined;
|
|
5
|
+
isConnected: boolean;
|
|
6
|
+
status: undefined;
|
|
7
|
+
embeddedWalletInfo: undefined;
|
|
8
|
+
};
|
|
9
|
+
export declare const connectedAccountState: {
|
|
10
|
+
allAccounts: never[];
|
|
11
|
+
address: string;
|
|
12
|
+
caipAddress: string;
|
|
13
|
+
isConnected: boolean;
|
|
14
|
+
status: string;
|
|
15
|
+
embeddedWalletInfo: undefined;
|
|
16
|
+
};
|
|
17
|
+
export declare const disconnectedAccountState: {
|
|
18
|
+
allAccounts: never[];
|
|
19
|
+
address: undefined;
|
|
20
|
+
caipAddress: undefined;
|
|
21
|
+
isConnected: boolean;
|
|
22
|
+
status: string;
|
|
23
|
+
embeddedWalletInfo: undefined;
|
|
24
|
+
};
|
|
25
|
+
export declare const connectedWithEmbeddedWalletState: {
|
|
26
|
+
allAccounts: never[];
|
|
27
|
+
address: string;
|
|
28
|
+
caipAddress: string;
|
|
29
|
+
isConnected: boolean;
|
|
30
|
+
status: string;
|
|
31
|
+
embeddedWalletInfo: {
|
|
32
|
+
user: {
|
|
33
|
+
username: string;
|
|
34
|
+
email: string;
|
|
35
|
+
};
|
|
36
|
+
accountType: string;
|
|
37
|
+
authProvider: string;
|
|
38
|
+
isSmartAccountDeployed: boolean;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit-core",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.9-rc.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/esm/exports/index.js",
|
|
6
6
|
"types": "./dist/types/exports/index.d.ts",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"@walletconnect/universal-provider": "2.18.0",
|
|
40
40
|
"valtio": "1.13.2",
|
|
41
41
|
"viem": ">=2.23",
|
|
42
|
-
"@reown/appkit-common": "1.6.
|
|
43
|
-
"@reown/appkit-wallet": "1.6.
|
|
42
|
+
"@reown/appkit-common": "1.6.9-rc.1.0",
|
|
43
|
+
"@reown/appkit-wallet": "1.6.9-rc.1.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"vitest": "2.1.
|
|
47
|
+
"vitest": "2.1.9",
|
|
48
48
|
"@vitest/coverage-v8": "2.1.3",
|
|
49
49
|
"vue": "3.x"
|
|
50
50
|
},
|