@reown/appkit-core 1.6.9-vfat.0 → 1.6.9
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/src/controllers/AccountController.js +4 -0
- 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 +75 -70
- package/dist/esm/src/controllers/BlockchainApiController.js.map +1 -1
- package/dist/esm/src/controllers/ChainController.js +5 -0
- 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/EnsController.js +10 -0
- package/dist/esm/src/controllers/EnsController.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 +61 -9
- package/dist/esm/src/controllers/SendController.js.map +1 -1
- package/dist/esm/src/controllers/SwapController.js +5 -12
- package/dist/esm/src/controllers/SwapController.js.map +1 -1
- package/dist/esm/src/controllers/TransactionsController.js +3 -5
- package/dist/esm/src/controllers/TransactionsController.js.map +1 -1
- package/dist/esm/src/utils/ConstantsUtil.js +5 -5
- package/dist/esm/src/utils/ConstantsUtil.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/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 +5 -7
- package/dist/esm/src/utils/SwapApiUtil.js.map +1 -1
- package/dist/esm/tests/controllers/BlockchainApiController.test.js +18 -3
- package/dist/esm/tests/controllers/BlockchainApiController.test.js.map +1 -1
- 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/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/controllers/TransactionsController.test.js +0 -9
- package/dist/esm/tests/controllers/TransactionsController.test.js.map +1 -1
- 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/tests/utils/SwapApiUtil.test.js +1 -4
- package/dist/esm/tests/utils/SwapApiUtil.test.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -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 +15 -14
- package/dist/types/src/controllers/ChainController.d.ts +8 -6
- package/dist/types/src/controllers/ConnectionController.d.ts +11 -7
- package/dist/types/src/controllers/ConnectorController.d.ts +5 -3
- package/dist/types/src/controllers/EnsController.d.ts +2 -1
- package/dist/types/src/controllers/EventsController.d.ts +1 -1
- 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 +45 -49
- 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/ConstantsUtil.d.ts +1 -1
- package/dist/types/src/utils/CoreHelperUtil.d.ts +1 -1
- package/dist/types/src/utils/ERC7811Util.d.ts +67 -0
- package/dist/types/src/utils/FetchUtil.d.ts +1 -1
- package/dist/types/src/utils/OptionsUtil.d.ts +1 -1
- 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 +13 -8
- package/dist/types/tests/mocks/SwapController.d.ts +4 -3
- 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
- package/dist/esm/src/utils/ConnectorUtil.js +0 -26
- package/dist/esm/src/utils/ConnectorUtil.js.map +0 -1
- package/dist/esm/src/utils/DeeplinkUtil.js +0 -2
- package/dist/esm/src/utils/DeeplinkUtil.js.map +0 -1
- package/dist/types/src/utils/ConnectorUtil.d.ts +0 -4
- package/dist/types/src/utils/DeeplinkUtil.d.ts +0 -0
|
@@ -1,56 +1,52 @@
|
|
|
1
|
-
import { type Balance } from '@reown/appkit-common'
|
|
2
|
-
|
|
1
|
+
import { type Balance } from '@reown/appkit-common';
|
|
3
2
|
export interface TxParams {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
receiverAddress: string;
|
|
4
|
+
sendTokenAmount: number;
|
|
5
|
+
gasPrice: bigint;
|
|
6
|
+
decimals: string;
|
|
8
7
|
}
|
|
9
8
|
export interface ContractWriteParams {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
receiverAddress: string;
|
|
10
|
+
tokenAddress: string;
|
|
11
|
+
sendTokenAmount: number;
|
|
12
|
+
decimals: string;
|
|
14
13
|
}
|
|
15
14
|
export interface SendControllerState {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
tokenBalances: Balance[];
|
|
16
|
+
token?: Balance;
|
|
17
|
+
sendTokenAmount?: number;
|
|
18
|
+
receiverAddress?: string;
|
|
19
|
+
receiverProfileName?: string;
|
|
20
|
+
receiverProfileImageUrl?: string;
|
|
21
|
+
gasPrice?: bigint;
|
|
22
|
+
gasPriceInUSD?: number;
|
|
23
|
+
networkBalanceInUSD?: string;
|
|
24
|
+
loading: boolean;
|
|
25
|
+
lastRetry?: number;
|
|
25
26
|
}
|
|
27
|
+
type StateKey = keyof SendControllerState;
|
|
26
28
|
export declare const SendController: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
hasInsufficientGasFunds(): boolean
|
|
52
|
-
sendNativeToken(params: TxParams): Promise<void>
|
|
53
|
-
sendERC20Token(params: ContractWriteParams): Promise<void>
|
|
54
|
-
sendSolanaToken(): void
|
|
55
|
-
resetSend(): void
|
|
56
|
-
}
|
|
29
|
+
state: SendControllerState;
|
|
30
|
+
subscribe(callback: (newState: SendControllerState) => void): () => void;
|
|
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;
|
|
41
|
+
sendToken(): void;
|
|
42
|
+
sendEvmToken(): void;
|
|
43
|
+
fetchTokenBalance(onError?: (error: unknown) => void): Promise<Balance[]>;
|
|
44
|
+
fetchNetworkBalance(): void;
|
|
45
|
+
isInsufficientNetworkTokenForGas(networkBalanceInUSD: string, gasPriceInUSD: number | undefined): boolean;
|
|
46
|
+
hasInsufficientGasFunds(): boolean;
|
|
47
|
+
sendNativeToken(params: TxParams): Promise<void>;
|
|
48
|
+
sendERC20Token(params: ContractWriteParams): Promise<void>;
|
|
49
|
+
sendSolanaToken(): void;
|
|
50
|
+
resetSend(): void;
|
|
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[];
|
|
@@ -65,7 +65,7 @@ export declare const ConstantsUtil: {
|
|
|
65
65
|
legalCheckbox: false;
|
|
66
66
|
smartSessions: false;
|
|
67
67
|
collapseWallets: false;
|
|
68
|
-
walletFeaturesOrder: ("swaps" | "
|
|
68
|
+
walletFeaturesOrder: ("swaps" | "onramp" | "receive" | "send")[];
|
|
69
69
|
connectMethodsOrder: undefined;
|
|
70
70
|
};
|
|
71
71
|
DEFAULT_ACCOUNT_TYPES: {
|
|
@@ -48,7 +48,7 @@ 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
52
|
isMac(): boolean;
|
|
53
53
|
formatTelegramSocialLoginUrl(url: string): string;
|
|
54
54
|
injectIntoUrl(url: string, key: string, appendString: string): string;
|
|
@@ -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,5 +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[
|
|
4
|
+
filterSocialsByPlatform<T>(socials: Features["socials"]): T | import("./TypeUtil.js").SocialProvider[];
|
|
5
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 = {
|
|
@@ -139,7 +140,6 @@ export interface BlockchainApiIdentityResponse {
|
|
|
139
140
|
}
|
|
140
141
|
export interface BlockchainApiTransactionsRequest {
|
|
141
142
|
account: string;
|
|
142
|
-
projectId: string;
|
|
143
143
|
cursor?: string;
|
|
144
144
|
onramp?: 'coinbase';
|
|
145
145
|
signal?: AbortSignal;
|
|
@@ -167,14 +167,12 @@ export type SwapTokenWithBalance = SwapToken & {
|
|
|
167
167
|
value: number;
|
|
168
168
|
};
|
|
169
169
|
export interface BlockchainApiSwapTokensRequest {
|
|
170
|
-
projectId: string;
|
|
171
170
|
chainId?: string;
|
|
172
171
|
}
|
|
173
172
|
export interface BlockchainApiSwapTokensResponse {
|
|
174
173
|
tokens: SwapToken[];
|
|
175
174
|
}
|
|
176
175
|
export interface BlockchainApiSwapQuoteRequest {
|
|
177
|
-
projectId: string;
|
|
178
176
|
chainId?: string;
|
|
179
177
|
amount: string;
|
|
180
178
|
userAddress: string;
|
|
@@ -192,7 +190,6 @@ export interface BlockchainApiSwapQuoteResponse {
|
|
|
192
190
|
}[];
|
|
193
191
|
}
|
|
194
192
|
export interface BlockchainApiTokenPriceRequest {
|
|
195
|
-
projectId: string;
|
|
196
193
|
currency?: 'usd' | 'eur' | 'gbp' | 'aud' | 'cad' | 'inr' | 'jpy' | 'btc' | 'eth';
|
|
197
194
|
addresses: string[];
|
|
198
195
|
}
|
|
@@ -205,7 +202,6 @@ export interface BlockchainApiTokenPriceResponse {
|
|
|
205
202
|
}[];
|
|
206
203
|
}
|
|
207
204
|
export interface BlockchainApiSwapAllowanceRequest {
|
|
208
|
-
projectId: string;
|
|
209
205
|
tokenAddress: string;
|
|
210
206
|
userAddress: string;
|
|
211
207
|
}
|
|
@@ -213,7 +209,6 @@ export interface BlockchainApiSwapAllowanceResponse {
|
|
|
213
209
|
allowance: string;
|
|
214
210
|
}
|
|
215
211
|
export interface BlockchainApiGasPriceRequest {
|
|
216
|
-
projectId: string;
|
|
217
212
|
chainId: string;
|
|
218
213
|
}
|
|
219
214
|
export interface BlockchainApiGasPriceResponse {
|
|
@@ -222,7 +217,6 @@ export interface BlockchainApiGasPriceResponse {
|
|
|
222
217
|
instant: string;
|
|
223
218
|
}
|
|
224
219
|
export interface BlockchainApiGenerateSwapCalldataRequest {
|
|
225
|
-
projectId: string;
|
|
226
220
|
userAddress: string;
|
|
227
221
|
from: string;
|
|
228
222
|
to: string;
|
|
@@ -245,7 +239,6 @@ export interface BlockchainApiGenerateSwapCalldataResponse {
|
|
|
245
239
|
};
|
|
246
240
|
}
|
|
247
241
|
export interface BlockchainApiGenerateApproveCalldataRequest {
|
|
248
|
-
projectId: string;
|
|
249
242
|
userAddress: string;
|
|
250
243
|
from: string;
|
|
251
244
|
to: string;
|
|
@@ -772,6 +765,18 @@ export type AccountTypeMap = {
|
|
|
772
765
|
path?: K extends 'bip122' ? string : never;
|
|
773
766
|
};
|
|
774
767
|
};
|
|
768
|
+
export type WalletGetAssetsParams = {
|
|
769
|
+
account: `0x${string}`;
|
|
770
|
+
assetFilter?: Record<`0x${string}`, (`0x${string}` | 'native')[]>;
|
|
771
|
+
assetTypeFilter?: ('NATIVE' | 'ERC20')[];
|
|
772
|
+
chainFilter?: `0x${string}`[];
|
|
773
|
+
};
|
|
774
|
+
export type WalletGetAssetsResponse = Record<`0x${string}`, {
|
|
775
|
+
address: `0x${string}` | 'native';
|
|
776
|
+
balance: `0x${string}`;
|
|
777
|
+
type: 'NATIVE' | 'ERC20';
|
|
778
|
+
metadata: Record<string, unknown>;
|
|
779
|
+
}[]>;
|
|
775
780
|
export type AccountType = AccountTypeMap[ChainNamespace];
|
|
776
781
|
export type SendTransactionArgs = {
|
|
777
782
|
chainNamespace?: undefined | 'eip155';
|
|
@@ -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 @@
|
|
|
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.9
|
|
3
|
+
"version": "1.6.9",
|
|
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-
|
|
43
|
-
"@reown/appkit-
|
|
42
|
+
"@reown/appkit-common": "1.6.9",
|
|
43
|
+
"@reown/appkit-wallet": "1.6.9"
|
|
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
|
},
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const ConnectorUtil = {
|
|
2
|
-
handleSolanaDeeplinkRedirect: (wallet, connector) => {
|
|
3
|
-
/**
|
|
4
|
-
* Universal Links requires explicit user interaction to open the wallet app.
|
|
5
|
-
* Previously we've been calling this with the life-cycle methods in the Solana clients by listening the SELECT_WALLET event of EventController.
|
|
6
|
-
* But this breaks the UL functionality for some wallets like Phantom.
|
|
7
|
-
*/
|
|
8
|
-
console.log('ConnectorUtil.handleSolanaDeeplinkRedirect', wallet, connector);
|
|
9
|
-
const href = window.location.href;
|
|
10
|
-
const encodedHref = encodeURIComponent(href);
|
|
11
|
-
const name = connector?.name || wallet?.name || '';
|
|
12
|
-
console.log('>> Name:', name, window);
|
|
13
|
-
if (name === 'Phantom' && !('phantom' in window)) {
|
|
14
|
-
console.log('>> Update phantom');
|
|
15
|
-
const protocol = href.startsWith('https') ? 'https' : 'http';
|
|
16
|
-
const host = href.split('/')[2];
|
|
17
|
-
const encodedRef = encodeURIComponent(`${protocol}://${host}`);
|
|
18
|
-
window.location.href = `https://phantom.app/ul/browse/${encodedHref}?ref=${encodedRef}`;
|
|
19
|
-
}
|
|
20
|
-
if (name === 'Coinbase Wallet' && !('coinbaseSolana' in window)) {
|
|
21
|
-
console.log('>> Update coinbaseSolana');
|
|
22
|
-
window.location.href = `https://go.cb-w.com/dapp?cb_url=${encodedHref}`;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=ConnectorUtil.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectorUtil.js","sourceRoot":"","sources":["../../../../src/utils/ConnectorUtil.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,4BAA4B,EAAE,CAAC,MAAgB,EAAE,SAAqB,EAAE,EAAE;QACxE;;;;WAIG;QACH,OAAO,CAAC,GAAG,CAAC,4CAA4C,EAAE,MAAM,EAAE,SAAS,CAAC,CAAA;QAC5E,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAA;QACjC,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAA;QAC5C,MAAM,IAAI,GAAG,SAAS,EAAE,IAAI,IAAI,MAAM,EAAE,IAAI,IAAI,EAAE,CAAA;QAClD,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;QACrC,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,EAAE,CAAC;YACjD,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;YAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAA;YAC5D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;YAC/B,MAAM,UAAU,GAAG,kBAAkB,CAAC,GAAG,QAAQ,MAAM,IAAI,EAAE,CAAC,CAAA;YAE9D,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,iCAAiC,WAAW,QAAQ,UAAU,EAAE,CAAA;QACzF,CAAC;QAED,IAAI,IAAI,KAAK,iBAAiB,IAAI,CAAC,CAAC,gBAAgB,IAAI,MAAM,CAAC,EAAE,CAAC;YAChE,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;YACvC,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,mCAAmC,WAAW,EAAE,CAAA;QACzE,CAAC;IACH,CAAC;CACF,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeeplinkUtil.js","sourceRoot":"","sources":["../../../../src/utils/DeeplinkUtil.ts"],"names":[],"mappings":""}
|
|
File without changes
|