@reown/appkit-controllers 1.7.0-rc.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/LICENSE +190 -0
- package/dist/esm/exports/index.js +32 -0
- package/dist/esm/exports/index.js.map +1 -0
- package/dist/esm/exports/modal.js +2 -0
- package/dist/esm/exports/modal.js.map +1 -0
- package/dist/esm/exports/react.js +52 -0
- package/dist/esm/exports/react.js.map +1 -0
- package/dist/esm/exports/vue.js +63 -0
- package/dist/esm/exports/vue.js.map +1 -0
- package/dist/esm/src/controllers/AccountController.js +160 -0
- package/dist/esm/src/controllers/AccountController.js.map +1 -0
- package/dist/esm/src/controllers/AlertController.js +35 -0
- package/dist/esm/src/controllers/AlertController.js.map +1 -0
- package/dist/esm/src/controllers/ApiController.js +260 -0
- package/dist/esm/src/controllers/ApiController.js.map +1 -0
- package/dist/esm/src/controllers/AssetController.js +43 -0
- package/dist/esm/src/controllers/AssetController.js.map +1 -0
- package/dist/esm/src/controllers/BlockchainApiController.js +472 -0
- package/dist/esm/src/controllers/BlockchainApiController.js.map +1 -0
- package/dist/esm/src/controllers/ChainController.js +548 -0
- package/dist/esm/src/controllers/ChainController.js.map +1 -0
- package/dist/esm/src/controllers/ConnectionController.js +190 -0
- package/dist/esm/src/controllers/ConnectionController.js.map +1 -0
- package/dist/esm/src/controllers/ConnectorController.js +272 -0
- package/dist/esm/src/controllers/ConnectorController.js.map +1 -0
- package/dist/esm/src/controllers/EnsController.js +144 -0
- package/dist/esm/src/controllers/EnsController.js.map +1 -0
- package/dist/esm/src/controllers/EventsController.js +76 -0
- package/dist/esm/src/controllers/EventsController.js.map +1 -0
- package/dist/esm/src/controllers/ModalController.js +120 -0
- package/dist/esm/src/controllers/ModalController.js.map +1 -0
- package/dist/esm/src/controllers/OnRampController.js +132 -0
- package/dist/esm/src/controllers/OnRampController.js.map +1 -0
- package/dist/esm/src/controllers/OptionsController.js +146 -0
- package/dist/esm/src/controllers/OptionsController.js.map +1 -0
- package/dist/esm/src/controllers/PublicStateController.js +20 -0
- package/dist/esm/src/controllers/PublicStateController.js.map +1 -0
- package/dist/esm/src/controllers/RouterController.js +125 -0
- package/dist/esm/src/controllers/RouterController.js.map +1 -0
- package/dist/esm/src/controllers/SendController.js +305 -0
- package/dist/esm/src/controllers/SendController.js.map +1 -0
- package/dist/esm/src/controllers/SnackController.js +62 -0
- package/dist/esm/src/controllers/SnackController.js.map +1 -0
- package/dist/esm/src/controllers/SwapController.js +674 -0
- package/dist/esm/src/controllers/SwapController.js.map +1 -0
- package/dist/esm/src/controllers/ThemeController.js +55 -0
- package/dist/esm/src/controllers/ThemeController.js.map +1 -0
- package/dist/esm/src/controllers/TooltipController.js +41 -0
- package/dist/esm/src/controllers/TooltipController.js.map +1 -0
- package/dist/esm/src/controllers/TransactionsController.js +113 -0
- package/dist/esm/src/controllers/TransactionsController.js.map +1 -0
- package/dist/esm/src/utils/AssetUtil.js +86 -0
- package/dist/esm/src/utils/AssetUtil.js.map +1 -0
- package/dist/esm/src/utils/ConstantsUtil.js +239 -0
- package/dist/esm/src/utils/ConstantsUtil.js.map +1 -0
- package/dist/esm/src/utils/CoreHelperUtil.js +354 -0
- package/dist/esm/src/utils/CoreHelperUtil.js.map +1 -0
- package/dist/esm/src/utils/ERC7811Util.js +111 -0
- package/dist/esm/src/utils/ERC7811Util.js.map +1 -0
- package/dist/esm/src/utils/EnsUtil.js +10 -0
- package/dist/esm/src/utils/EnsUtil.js.map +1 -0
- package/dist/esm/src/utils/FetchUtil.js +73 -0
- package/dist/esm/src/utils/FetchUtil.js.map +1 -0
- package/dist/esm/src/utils/MobileWallet.js +31 -0
- package/dist/esm/src/utils/MobileWallet.js.map +1 -0
- package/dist/esm/src/utils/OptionsUtil.js +29 -0
- package/dist/esm/src/utils/OptionsUtil.js.map +1 -0
- package/dist/esm/src/utils/RouterUtil.js +23 -0
- package/dist/esm/src/utils/RouterUtil.js.map +1 -0
- package/dist/esm/src/utils/SIWXUtil.js +258 -0
- package/dist/esm/src/utils/SIWXUtil.js.map +1 -0
- 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 +485 -0
- package/dist/esm/src/utils/StorageUtil.js.map +1 -0
- package/dist/esm/src/utils/SwapApiUtil.js +89 -0
- package/dist/esm/src/utils/SwapApiUtil.js.map +1 -0
- package/dist/esm/src/utils/SwapCalculationUtil.js +74 -0
- package/dist/esm/src/utils/SwapCalculationUtil.js.map +1 -0
- package/dist/esm/src/utils/TypeUtil.js +2 -0
- package/dist/esm/src/utils/TypeUtil.js.map +1 -0
- package/dist/esm/tests/constants/OnrampTransactions.js +151 -0
- package/dist/esm/tests/constants/OnrampTransactions.js.map +1 -0
- package/dist/esm/tests/controllers/AccountController.test.js +186 -0
- package/dist/esm/tests/controllers/AccountController.test.js.map +1 -0
- package/dist/esm/tests/controllers/AlertController.test.js +48 -0
- package/dist/esm/tests/controllers/AlertController.test.js.map +1 -0
- package/dist/esm/tests/controllers/ApiController.test.js +608 -0
- package/dist/esm/tests/controllers/ApiController.test.js.map +1 -0
- package/dist/esm/tests/controllers/AssetController.test.js +92 -0
- package/dist/esm/tests/controllers/AssetController.test.js.map +1 -0
- package/dist/esm/tests/controllers/BlockchainApiController.test.js +38 -0
- package/dist/esm/tests/controllers/BlockchainApiController.test.js.map +1 -0
- package/dist/esm/tests/controllers/ChainController.test.js +382 -0
- package/dist/esm/tests/controllers/ChainController.test.js.map +1 -0
- package/dist/esm/tests/controllers/ConnectionController.test.js +151 -0
- package/dist/esm/tests/controllers/ConnectionController.test.js.map +1 -0
- package/dist/esm/tests/controllers/ConnectorController.test.js +282 -0
- package/dist/esm/tests/controllers/ConnectorController.test.js.map +1 -0
- package/dist/esm/tests/controllers/EnsController.test.js +186 -0
- package/dist/esm/tests/controllers/EnsController.test.js.map +1 -0
- package/dist/esm/tests/controllers/EventsController.test.js +47 -0
- package/dist/esm/tests/controllers/EventsController.test.js.map +1 -0
- package/dist/esm/tests/controllers/ModalController.test.js +66 -0
- package/dist/esm/tests/controllers/ModalController.test.js.map +1 -0
- package/dist/esm/tests/controllers/OnRampController.test.js +118 -0
- package/dist/esm/tests/controllers/OnRampController.test.js.map +1 -0
- package/dist/esm/tests/controllers/OptionsController.test.js +42 -0
- package/dist/esm/tests/controllers/OptionsController.test.js.map +1 -0
- package/dist/esm/tests/controllers/PublicStateController.test.js +33 -0
- package/dist/esm/tests/controllers/PublicStateController.test.js.map +1 -0
- package/dist/esm/tests/controllers/RouterController.test.js +103 -0
- package/dist/esm/tests/controllers/RouterController.test.js.map +1 -0
- package/dist/esm/tests/controllers/SendController.test.js +136 -0
- package/dist/esm/tests/controllers/SendController.test.js.map +1 -0
- package/dist/esm/tests/controllers/SnackController.test.js +86 -0
- package/dist/esm/tests/controllers/SnackController.test.js.map +1 -0
- package/dist/esm/tests/controllers/SwapController.test.js +105 -0
- package/dist/esm/tests/controllers/SwapController.test.js.map +1 -0
- package/dist/esm/tests/controllers/ThemeController.test.js +26 -0
- package/dist/esm/tests/controllers/ThemeController.test.js.map +1 -0
- package/dist/esm/tests/controllers/TooltipController.test.js +40 -0
- package/dist/esm/tests/controllers/TooltipController.test.js.map +1 -0
- package/dist/esm/tests/controllers/TransactionsController.test.js +239 -0
- package/dist/esm/tests/controllers/TransactionsController.test.js.map +1 -0
- package/dist/esm/tests/hooks/react.test.js +149 -0
- package/dist/esm/tests/hooks/react.test.js.map +1 -0
- 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/SwapController.js +118 -0
- package/dist/esm/tests/mocks/SwapController.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/AssetUtil.test.js +108 -0
- package/dist/esm/tests/utils/AssetUtil.test.js.map +1 -0
- package/dist/esm/tests/utils/CoreHelperUtil.test.js +67 -0
- package/dist/esm/tests/utils/CoreHelperUtil.test.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/EnsUtil.test.js +23 -0
- package/dist/esm/tests/utils/EnsUtil.test.js.map +1 -0
- package/dist/esm/tests/utils/FetchUtil.test.js +175 -0
- package/dist/esm/tests/utils/FetchUtil.test.js.map +1 -0
- package/dist/esm/tests/utils/MobileWallet.test.js +72 -0
- package/dist/esm/tests/utils/MobileWallet.test.js.map +1 -0
- package/dist/esm/tests/utils/OptionsUtil.test.js +20 -0
- package/dist/esm/tests/utils/OptionsUtil.test.js.map +1 -0
- package/dist/esm/tests/utils/RouterUtil.test.js +62 -0
- package/dist/esm/tests/utils/RouterUtil.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/StorageUtil.test.js +162 -0
- package/dist/esm/tests/utils/StorageUtil.test.js.map +1 -0
- package/dist/esm/tests/utils/SwapApiUtil.test.js +213 -0
- package/dist/esm/tests/utils/SwapApiUtil.test.js.map +1 -0
- package/dist/esm/tests/utils/SwapCalculationUtil.test.js +80 -0
- package/dist/esm/tests/utils/SwapCalculationUtil.test.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/dist/types/exports/index.d.ts +51 -0
- package/dist/types/exports/modal.d.ts +2 -0
- package/dist/types/exports/react.d.ts +9 -0
- package/dist/types/exports/vue.d.ts +9 -0
- package/dist/types/src/controllers/AccountController.d.ts +56 -0
- package/dist/types/src/controllers/AlertController.d.ts +17 -0
- package/dist/types/src/controllers/ApiController.d.ts +52 -0
- package/dist/types/src/controllers/AssetController.d.ts +22 -0
- package/dist/types/src/controllers/BlockchainApiController.d.ts +59 -0
- package/dist/types/src/controllers/ChainController.d.ts +75 -0
- package/dist/types/src/controllers/ConnectionController.d.ts +86 -0
- package/dist/types/src/controllers/ConnectorController.d.ts +61 -0
- package/dist/types/src/controllers/EnsController.d.ts +26 -0
- package/dist/types/src/controllers/EventsController.d.ts +17 -0
- package/dist/types/src/controllers/ModalController.d.ts +27 -0
- package/dist/types/src/controllers/OnRampController.d.ts +55 -0
- package/dist/types/src/controllers/OptionsController.d.ts +364 -0
- package/dist/types/src/controllers/PublicStateController.d.ts +33 -0
- package/dist/types/src/controllers/RouterController.d.ts +56 -0
- package/dist/types/src/controllers/SendController.d.ts +52 -0
- package/dist/types/src/controllers/SnackController.d.ts +29 -0
- package/dist/types/src/controllers/SwapController.d.ts +127 -0
- package/dist/types/src/controllers/ThemeController.d.ts +30 -0
- package/dist/types/src/controllers/TooltipController.d.ts +25 -0
- package/dist/types/src/controllers/TransactionsController.d.ts +25 -0
- package/dist/types/src/utils/AssetUtil.d.ts +15 -0
- package/dist/types/src/utils/ConstantsUtil.d.ts +86 -0
- package/dist/types/src/utils/CoreHelperUtil.d.ts +56 -0
- package/dist/types/src/utils/ERC7811Util.d.ts +67 -0
- package/dist/types/src/utils/EnsUtil.d.ts +3 -0
- package/dist/types/src/utils/FetchUtil.d.ts +26 -0
- package/dist/types/src/utils/MobileWallet.d.ts +9 -0
- package/dist/types/src/utils/OptionsUtil.d.ts +5 -0
- package/dist/types/src/utils/RouterUtil.d.ts +4 -0
- package/dist/types/src/utils/SIWXUtil.d.ts +183 -0
- package/dist/types/src/utils/SendApiUtil.d.ts +13 -0
- package/dist/types/src/utils/StorageUtil.d.ts +99 -0
- package/dist/types/src/utils/SwapApiUtil.d.ts +27 -0
- package/dist/types/src/utils/SwapCalculationUtil.d.ts +22 -0
- package/dist/types/src/utils/TypeUtil.d.ts +981 -0
- package/dist/types/tests/constants/OnrampTransactions.d.ts +138 -0
- package/dist/types/tests/controllers/AccountController.test.d.ts +1 -0
- package/dist/types/tests/controllers/AlertController.test.d.ts +1 -0
- package/dist/types/tests/controllers/ApiController.test.d.ts +1 -0
- package/dist/types/tests/controllers/AssetController.test.d.ts +1 -0
- package/dist/types/tests/controllers/BlockchainApiController.test.d.ts +1 -0
- package/dist/types/tests/controllers/ChainController.test.d.ts +1 -0
- package/dist/types/tests/controllers/ConnectionController.test.d.ts +1 -0
- package/dist/types/tests/controllers/ConnectorController.test.d.ts +1 -0
- package/dist/types/tests/controllers/EnsController.test.d.ts +1 -0
- package/dist/types/tests/controllers/EventsController.test.d.ts +1 -0
- package/dist/types/tests/controllers/ModalController.test.d.ts +1 -0
- package/dist/types/tests/controllers/OnRampController.test.d.ts +1 -0
- package/dist/types/tests/controllers/OptionsController.test.d.ts +1 -0
- package/dist/types/tests/controllers/PublicStateController.test.d.ts +1 -0
- package/dist/types/tests/controllers/RouterController.test.d.ts +1 -0
- package/dist/types/tests/controllers/SendController.test.d.ts +1 -0
- package/dist/types/tests/controllers/SnackController.test.d.ts +1 -0
- package/dist/types/tests/controllers/SwapController.test.d.ts +1 -0
- package/dist/types/tests/controllers/ThemeController.test.d.ts +1 -0
- package/dist/types/tests/controllers/TooltipController.test.d.ts +1 -0
- package/dist/types/tests/controllers/TransactionsController.test.d.ts +1 -0
- package/dist/types/tests/hooks/react.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 +75 -0
- package/dist/types/tests/mocks/useAppKitAccount.d.ts +40 -0
- package/dist/types/tests/utils/AssetUtil.test.d.ts +1 -0
- package/dist/types/tests/utils/CoreHelperUtil.test.d.ts +1 -0
- package/dist/types/tests/utils/ERC7811.test.d.ts +1 -0
- package/dist/types/tests/utils/EnsUtil.test.d.ts +1 -0
- package/dist/types/tests/utils/FetchUtil.test.d.ts +1 -0
- package/dist/types/tests/utils/MobileWallet.test.d.ts +1 -0
- package/dist/types/tests/utils/OptionsUtil.test.d.ts +1 -0
- package/dist/types/tests/utils/RouterUtil.test.d.ts +1 -0
- package/dist/types/tests/utils/SendApiUtil.test.d.ts +1 -0
- package/dist/types/tests/utils/StorageUtil.test.d.ts +1 -0
- package/dist/types/tests/utils/SwapApiUtil.test.d.ts +1 -0
- package/dist/types/tests/utils/SwapCalculationUtil.test.d.ts +1 -0
- package/package.json +81 -0
- package/readme.md +11 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { W3mThemeVariables } from '@reown/appkit-common';
|
|
2
|
+
import type { ThemeMode, ThemeVariables } from '../utils/TypeUtil.js';
|
|
3
|
+
export interface ThemeControllerState {
|
|
4
|
+
themeMode: ThemeMode;
|
|
5
|
+
themeVariables: ThemeVariables;
|
|
6
|
+
w3mThemeVariables: W3mThemeVariables | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare const ThemeController: {
|
|
9
|
+
state: ThemeControllerState;
|
|
10
|
+
subscribe(callback: (newState: ThemeControllerState) => void): () => void;
|
|
11
|
+
setThemeMode(themeMode: ThemeControllerState["themeMode"]): void;
|
|
12
|
+
setThemeVariables(themeVariables: ThemeControllerState["themeVariables"]): void;
|
|
13
|
+
getSnapshot(): {
|
|
14
|
+
readonly themeMode: ThemeMode;
|
|
15
|
+
readonly themeVariables: {
|
|
16
|
+
readonly '--w3m-font-family'?: string | undefined;
|
|
17
|
+
readonly '--w3m-accent'?: string | undefined;
|
|
18
|
+
readonly '--w3m-color-mix'?: string | undefined;
|
|
19
|
+
readonly '--w3m-color-mix-strength'?: number | undefined;
|
|
20
|
+
readonly '--w3m-font-size-master'?: string | undefined;
|
|
21
|
+
readonly '--w3m-border-radius-master'?: string | undefined;
|
|
22
|
+
readonly '--w3m-z-index'?: number | undefined;
|
|
23
|
+
readonly '--w3m-qr-color'?: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
readonly w3mThemeVariables: {
|
|
26
|
+
readonly '--w3m-accent': string;
|
|
27
|
+
readonly '--w3m-background': string;
|
|
28
|
+
} | undefined;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type TriggerRect = {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
top: number;
|
|
5
|
+
left: number;
|
|
6
|
+
};
|
|
7
|
+
export interface TooltipControllerState {
|
|
8
|
+
message: string;
|
|
9
|
+
triggerRect: TriggerRect;
|
|
10
|
+
open: boolean;
|
|
11
|
+
variant: 'shade' | 'fill';
|
|
12
|
+
}
|
|
13
|
+
type StateKey = keyof TooltipControllerState;
|
|
14
|
+
export declare const TooltipController: {
|
|
15
|
+
state: TooltipControllerState;
|
|
16
|
+
subscribe(callback: (newState: TooltipControllerState) => void): () => void;
|
|
17
|
+
subscribeKey<K extends StateKey>(key: K, callback: (value: TooltipControllerState[K]) => void): () => void;
|
|
18
|
+
showTooltip({ message, triggerRect, variant }: {
|
|
19
|
+
message: string;
|
|
20
|
+
triggerRect: TriggerRect;
|
|
21
|
+
variant: "shade" | "fill";
|
|
22
|
+
}): void;
|
|
23
|
+
hide(): void;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Transaction } from '@reown/appkit-common';
|
|
2
|
+
import type { CaipNetworkId } from '@reown/appkit-common';
|
|
3
|
+
type TransactionByMonthMap = Record<number, Transaction[]>;
|
|
4
|
+
type TransactionByYearMap = Record<number, TransactionByMonthMap>;
|
|
5
|
+
export interface TransactionsControllerState {
|
|
6
|
+
transactions: Transaction[];
|
|
7
|
+
coinbaseTransactions: TransactionByYearMap;
|
|
8
|
+
transactionsByYear: TransactionByYearMap;
|
|
9
|
+
lastNetworkInView: CaipNetworkId | undefined;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
empty: boolean;
|
|
12
|
+
next: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
export declare const TransactionsController: {
|
|
15
|
+
state: TransactionsControllerState;
|
|
16
|
+
subscribe(callback: (newState: TransactionsControllerState) => void): () => void;
|
|
17
|
+
setLastNetworkInView(lastNetworkInView: TransactionsControllerState["lastNetworkInView"]): void;
|
|
18
|
+
fetchTransactions(accountAddress?: string, onramp?: "coinbase"): Promise<void>;
|
|
19
|
+
groupTransactionsByYearAndMonth(transactionsMap?: TransactionByYearMap, transactions?: Transaction[]): TransactionByYearMap;
|
|
20
|
+
filterSpamTransactions(transactions: Transaction[]): Transaction[];
|
|
21
|
+
filterByConnectedChain(transactions: Transaction[]): Transaction[];
|
|
22
|
+
clearCursor(): void;
|
|
23
|
+
resetTransactions(): void;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CaipNetwork, ChainNamespace } from '@reown/appkit-common';
|
|
2
|
+
import type { Connector, WcWallet } from './TypeUtil.js';
|
|
3
|
+
export interface AssetUtilState {
|
|
4
|
+
networkImagePromises: Record<string, Promise<void>>;
|
|
5
|
+
}
|
|
6
|
+
export declare const AssetUtil: {
|
|
7
|
+
fetchWalletImage(imageId?: string): Promise<string | undefined>;
|
|
8
|
+
fetchNetworkImage(imageId?: string): Promise<string | undefined>;
|
|
9
|
+
getWalletImageById(imageId?: string): string | undefined;
|
|
10
|
+
getWalletImage(wallet?: WcWallet): string | undefined;
|
|
11
|
+
getNetworkImage(network?: CaipNetwork): string | undefined;
|
|
12
|
+
getNetworkImageById(imageId?: string): string | undefined;
|
|
13
|
+
getConnectorImage(connector?: Connector): string | undefined;
|
|
14
|
+
getChainImage(chain: ChainNamespace): string | undefined;
|
|
15
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type ChainNamespace } from '@reown/appkit-common';
|
|
2
|
+
import type { SocialProvider } from './TypeUtil.js';
|
|
3
|
+
export declare const ONRAMP_PROVIDERS: {
|
|
4
|
+
label: string;
|
|
5
|
+
name: string;
|
|
6
|
+
feeRange: string;
|
|
7
|
+
url: string;
|
|
8
|
+
supportedChains: string[];
|
|
9
|
+
}[];
|
|
10
|
+
export declare const MELD_PUBLIC_KEY = "WXETMuFUQmqqybHuRkSgxv:25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU";
|
|
11
|
+
export declare const ConstantsUtil: {
|
|
12
|
+
FOUR_MINUTES_MS: number;
|
|
13
|
+
TEN_SEC_MS: number;
|
|
14
|
+
FIVE_SEC_MS: number;
|
|
15
|
+
THREE_SEC_MS: number;
|
|
16
|
+
ONE_SEC_MS: number;
|
|
17
|
+
SECURE_SITE: string;
|
|
18
|
+
SECURE_SITE_DASHBOARD: string;
|
|
19
|
+
SECURE_SITE_FAVICON: string;
|
|
20
|
+
RESTRICTED_TIMEZONES: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Network name to Coinbase Pay SDK chain name map object
|
|
23
|
+
* @see supported chain names on Coinbase for Pay SDK: https://github.com/coinbase/cbpay-js/blob/d4bda2c05c4d5917c8db6a05476b603546046394/src/types/onramp.ts
|
|
24
|
+
*/
|
|
25
|
+
WC_COINBASE_PAY_SDK_CHAINS: string[];
|
|
26
|
+
WC_COINBASE_PAY_SDK_FALLBACK_CHAIN: string;
|
|
27
|
+
WC_COINBASE_PAY_SDK_CHAIN_NAME_MAP: {
|
|
28
|
+
Ethereum: string;
|
|
29
|
+
'Arbitrum One': string;
|
|
30
|
+
Polygon: string;
|
|
31
|
+
Berachain: string;
|
|
32
|
+
Avalanche: string;
|
|
33
|
+
'OP Mainnet': string;
|
|
34
|
+
Celo: string;
|
|
35
|
+
Base: string;
|
|
36
|
+
};
|
|
37
|
+
WC_COINBASE_ONRAMP_APP_ID: string;
|
|
38
|
+
SWAP_SUGGESTED_TOKENS: string[];
|
|
39
|
+
SWAP_POPULAR_TOKENS: string[];
|
|
40
|
+
BALANCE_SUPPORTED_CHAINS: ChainNamespace[];
|
|
41
|
+
SWAP_SUPPORTED_NETWORKS: string[];
|
|
42
|
+
NAMES_SUPPORTED_CHAIN_NAMESPACES: ChainNamespace[];
|
|
43
|
+
ONRAMP_SUPPORTED_CHAIN_NAMESPACES: ChainNamespace[];
|
|
44
|
+
ACTIVITY_ENABLED_CHAIN_NAMESPACES: ChainNamespace[];
|
|
45
|
+
NATIVE_TOKEN_ADDRESS: {
|
|
46
|
+
readonly eip155: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
47
|
+
readonly solana: "So11111111111111111111111111111111111111111";
|
|
48
|
+
readonly polkadot: "0x";
|
|
49
|
+
readonly bip122: "0x";
|
|
50
|
+
};
|
|
51
|
+
CONVERT_SLIPPAGE_TOLERANCE: number;
|
|
52
|
+
CONNECT_LABELS: {
|
|
53
|
+
MOBILE: string;
|
|
54
|
+
};
|
|
55
|
+
DEFAULT_FEATURES: {
|
|
56
|
+
swaps: true;
|
|
57
|
+
onramp: true;
|
|
58
|
+
receive: true;
|
|
59
|
+
send: true;
|
|
60
|
+
email: true;
|
|
61
|
+
emailShowWallets: true;
|
|
62
|
+
socials: SocialProvider[];
|
|
63
|
+
history: true;
|
|
64
|
+
analytics: true;
|
|
65
|
+
allWallets: true;
|
|
66
|
+
legalCheckbox: false;
|
|
67
|
+
smartSessions: false;
|
|
68
|
+
collapseWallets: false;
|
|
69
|
+
walletFeaturesOrder: ("swaps" | "onramp" | "receive" | "send")[];
|
|
70
|
+
connectMethodsOrder: undefined;
|
|
71
|
+
};
|
|
72
|
+
DEFAULT_ACCOUNT_TYPES: {
|
|
73
|
+
readonly bip122: "payment";
|
|
74
|
+
readonly eip155: "smartAccount";
|
|
75
|
+
readonly polkadot: "eoa";
|
|
76
|
+
readonly solana: "eoa";
|
|
77
|
+
};
|
|
78
|
+
ADAPTER_TYPES: {
|
|
79
|
+
UNIVERSAL: string;
|
|
80
|
+
SOLANA: string;
|
|
81
|
+
WAGMI: string;
|
|
82
|
+
ETHERS: string;
|
|
83
|
+
ETHERS5: string;
|
|
84
|
+
BITCOIN: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Balance, ChainNamespace, SdkVersion } from '@reown/appkit-common';
|
|
2
|
+
import type { CaipAddress, CaipNetwork } from '@reown/appkit-common';
|
|
3
|
+
import type { AccountTypeMap, ChainAdapter, LinkingRecord, NamespaceTypeMap } from './TypeUtil.js';
|
|
4
|
+
type SDKFramework = 'html' | 'react' | 'vue';
|
|
5
|
+
type OpenTarget = '_blank' | '_self' | 'popupWindow' | '_top';
|
|
6
|
+
export declare const CoreHelperUtil: {
|
|
7
|
+
isMobile(): boolean;
|
|
8
|
+
checkCaipNetwork(network: CaipNetwork | undefined, networkName?: string): boolean | undefined;
|
|
9
|
+
isAndroid(): boolean;
|
|
10
|
+
isIos(): boolean;
|
|
11
|
+
isSafari(): boolean;
|
|
12
|
+
isClient(): boolean;
|
|
13
|
+
isPairingExpired(expiry?: number): boolean;
|
|
14
|
+
isAllowedRetry(lastRetry: number, differenceMs?: number): boolean;
|
|
15
|
+
copyToClopboard(text: string): void;
|
|
16
|
+
isIframe(): boolean;
|
|
17
|
+
getPairingExpiry(): number;
|
|
18
|
+
getNetworkId(caipAddress: CaipAddress | undefined): string | undefined;
|
|
19
|
+
getPlainAddress(caipAddress: CaipAddress | undefined): string | undefined;
|
|
20
|
+
wait(milliseconds: number): Promise<unknown>;
|
|
21
|
+
debounce(func: (...args: any[]) => unknown, timeout?: number): (...args: unknown[]) => void;
|
|
22
|
+
isHttpUrl(url: string): boolean;
|
|
23
|
+
formatNativeUrl(appUrl: string, wcUri: string): LinkingRecord;
|
|
24
|
+
formatUniversalUrl(appUrl: string, wcUri: string): LinkingRecord;
|
|
25
|
+
getOpenTargetForPlatform(target: OpenTarget): "_blank" | "_self" | "popupWindow" | "_top";
|
|
26
|
+
openHref(href: string, target: OpenTarget, features?: string): void;
|
|
27
|
+
returnOpenHref(href: string, target: OpenTarget, features?: string): Window | null;
|
|
28
|
+
isTelegram(): boolean;
|
|
29
|
+
preloadImage(src: string): Promise<unknown>;
|
|
30
|
+
formatBalance(balance: string | undefined, symbol: string | undefined): string;
|
|
31
|
+
formatBalance2(balance: string | undefined, symbol: string | undefined): {
|
|
32
|
+
value: string;
|
|
33
|
+
rest: string;
|
|
34
|
+
symbol: string | undefined;
|
|
35
|
+
};
|
|
36
|
+
getApiUrl(): "https://api.web3modal.org";
|
|
37
|
+
getBlockchainApiUrl(): "https://rpc.walletconnect.org";
|
|
38
|
+
getAnalyticsUrl(): "https://pulse.walletconnect.org";
|
|
39
|
+
getUUID(): string;
|
|
40
|
+
parseError(error: any): string;
|
|
41
|
+
sortRequestedNetworks(approvedIds: `${string}:${string}`[] | undefined, requestedNetworks?: CaipNetwork[]): CaipNetwork[];
|
|
42
|
+
calculateBalance(array: Balance[]): number;
|
|
43
|
+
formatTokenBalance(number: number): {
|
|
44
|
+
dollars: string | undefined;
|
|
45
|
+
pennies: string | undefined;
|
|
46
|
+
};
|
|
47
|
+
isAddress(address: string, chain?: ChainNamespace): boolean;
|
|
48
|
+
uniqueBy<T>(arr: T[], key: keyof T): T[];
|
|
49
|
+
generateSdkVersion(adapters: ChainAdapter[], platform: SDKFramework, version: string): SdkVersion;
|
|
50
|
+
createAccount<N extends ChainNamespace>(namespace: N, address: string, type: NamespaceTypeMap[N], publicKey?: string, path?: string): AccountTypeMap[N];
|
|
51
|
+
isCaipAddress(address?: unknown): address is CaipAddress;
|
|
52
|
+
isMac(): boolean;
|
|
53
|
+
formatTelegramSocialLoginUrl(url: string): string;
|
|
54
|
+
injectIntoUrl(url: string, key: string, appendString: string): string;
|
|
55
|
+
};
|
|
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 {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface Options {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
clientId: string | null;
|
|
4
|
+
}
|
|
5
|
+
export interface RequestArguments {
|
|
6
|
+
path: string;
|
|
7
|
+
headers?: HeadersInit;
|
|
8
|
+
params?: Record<string, string | undefined>;
|
|
9
|
+
cache?: RequestCache;
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
interface PostArguments extends RequestArguments {
|
|
13
|
+
body?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
export declare class FetchUtil {
|
|
16
|
+
baseUrl: Options['baseUrl'];
|
|
17
|
+
clientId: Options['clientId'];
|
|
18
|
+
constructor({ baseUrl, clientId }: Options);
|
|
19
|
+
get<T>({ headers, signal, cache, ...args }: RequestArguments): Promise<T>;
|
|
20
|
+
getBlob({ headers, signal, ...args }: RequestArguments): Promise<Blob>;
|
|
21
|
+
post<T>({ body, headers, signal, ...args }: PostArguments): Promise<T>;
|
|
22
|
+
put<T>({ body, headers, signal, ...args }: PostArguments): Promise<T>;
|
|
23
|
+
delete<T>({ body, headers, signal, ...args }: PostArguments): Promise<T>;
|
|
24
|
+
private createUrl;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const MobileWalletUtil: {
|
|
2
|
+
/**
|
|
3
|
+
* Handles mobile wallet redirection for wallets that have Universal Links.
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} properties - The properties object.
|
|
6
|
+
* @param {string} properties.name - The name of the wallet.
|
|
7
|
+
*/
|
|
8
|
+
handleSolanaDeeplinkRedirect(name: string): void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Features, FeaturesKeys } from './TypeUtil.js';
|
|
2
|
+
export declare const OptionsUtil: {
|
|
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"]): T | import("./TypeUtil.js").SocialProvider[];
|
|
5
|
+
};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import UniversalProvider from '@walletconnect/universal-provider';
|
|
2
|
+
import type { CaipNetworkId } from '@reown/appkit-common';
|
|
3
|
+
/**
|
|
4
|
+
* SIWXUtil holds the methods to interact with the SIWX plugin and must be called internally on AppKit.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SIWXUtil: {
|
|
7
|
+
getSIWX(): SIWXConfig | undefined;
|
|
8
|
+
initializeIfEnabled(): Promise<void>;
|
|
9
|
+
requestSignMessage(): Promise<void>;
|
|
10
|
+
cancelSignMessage(): Promise<void>;
|
|
11
|
+
getSessions(): Promise<SIWXSession[]>;
|
|
12
|
+
isSIWXCloseDisabled(): Promise<boolean | undefined>;
|
|
13
|
+
universalProviderAuthenticate({ universalProvider, chains, methods }: {
|
|
14
|
+
universalProvider: UniversalProvider;
|
|
15
|
+
chains: CaipNetworkId[];
|
|
16
|
+
methods: string[];
|
|
17
|
+
}): Promise<boolean>;
|
|
18
|
+
getSIWXEventProperties(): {
|
|
19
|
+
network: string;
|
|
20
|
+
isSmartAccount: boolean;
|
|
21
|
+
};
|
|
22
|
+
clearSessions(): Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* This interface represents the SIWX configuration plugin, which is used to create and manage SIWX messages and sessions.
|
|
26
|
+
* AppKit provides predefined implementations for this interface through `@reown/appkit-siwx`.
|
|
27
|
+
* You may use it to create a custom implementation following your needs, but watch close for the methods requirements.
|
|
28
|
+
*/
|
|
29
|
+
export interface SIWXConfig {
|
|
30
|
+
/**
|
|
31
|
+
* This method will be called to create a new message to be signed by the user.
|
|
32
|
+
*
|
|
33
|
+
* Constraints:
|
|
34
|
+
* - The message MUST be unique and contain all the necessary information to verify the user's identity.
|
|
35
|
+
* - SIWXMessage.toString() method MUST be implemented to return the message string.
|
|
36
|
+
*
|
|
37
|
+
* @param input SIWXMessage.Input
|
|
38
|
+
* @returns SIWXMessage
|
|
39
|
+
*/
|
|
40
|
+
createMessage: (input: SIWXMessage.Input) => Promise<SIWXMessage>;
|
|
41
|
+
/**
|
|
42
|
+
* This method will be called to store a new single session.
|
|
43
|
+
*
|
|
44
|
+
* Constraints:
|
|
45
|
+
* - This method MUST verify if the session is valid and store it in the storage successfully.
|
|
46
|
+
*
|
|
47
|
+
* @param session SIWXSession
|
|
48
|
+
*/
|
|
49
|
+
addSession: (session: SIWXSession) => Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* This method will be called to revoke all the sessions stored for a specific chain and address.
|
|
52
|
+
*
|
|
53
|
+
* Constraints:
|
|
54
|
+
* - This method MUST delete all the sessions stored for the specific chain and address successfully.
|
|
55
|
+
*
|
|
56
|
+
* @param chainId CaipNetworkId
|
|
57
|
+
* @param address string
|
|
58
|
+
*/
|
|
59
|
+
revokeSession: (chainId: CaipNetworkId, address: string) => Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* This method will be called to replace all the sessions in the storage with the new ones.
|
|
62
|
+
*
|
|
63
|
+
* Constraints:
|
|
64
|
+
* - This method MUST verify all the sessions before storing them in the storage;
|
|
65
|
+
* - This method MUST replace all the sessions in the storage with the new ones succesfully otherwise it MUST throw an error.
|
|
66
|
+
*
|
|
67
|
+
* @param sessions SIWXSession[]
|
|
68
|
+
*/
|
|
69
|
+
setSessions: (sessions: SIWXSession[]) => Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* This method will be called to get all the sessions stored for a specific chain and address.
|
|
72
|
+
*
|
|
73
|
+
* Constraints:
|
|
74
|
+
* - This method MUST return only sessions that are verified and valid;
|
|
75
|
+
* - This method MUST NOT return expired sessions.
|
|
76
|
+
*
|
|
77
|
+
* @param chainId CaipNetworkId
|
|
78
|
+
* @param address string
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
81
|
+
getSessions: (chainId: CaipNetworkId, address: string) => Promise<SIWXSession[]>;
|
|
82
|
+
/**
|
|
83
|
+
* This method determines whether the wallet stays connected when the user denies the signature request.
|
|
84
|
+
*
|
|
85
|
+
* @returns {boolean}
|
|
86
|
+
*/
|
|
87
|
+
getRequired?: () => boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* This interface represents a SIWX session, which is used to store the user's identity information.
|
|
91
|
+
*/
|
|
92
|
+
export interface SIWXSession {
|
|
93
|
+
data: SIWXMessage.Data;
|
|
94
|
+
message: string;
|
|
95
|
+
signature: string;
|
|
96
|
+
cacao?: Cacao;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* This interface represents a SIWX message, which is used to create a message to be signed by the user.
|
|
100
|
+
* This must contain the necessary information to verify the user's identity and how to generate the string message.
|
|
101
|
+
*/
|
|
102
|
+
export interface SIWXMessage extends SIWXMessage.Data, SIWXMessage.Methods {
|
|
103
|
+
}
|
|
104
|
+
export declare namespace SIWXMessage {
|
|
105
|
+
/**
|
|
106
|
+
* This interface represents the SIWX message data, which is used to create a message to be signed by the user.
|
|
107
|
+
*/
|
|
108
|
+
interface Data extends Input, Metadata, Identifier {
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* This interface represents the SIWX message input.
|
|
112
|
+
* Here must contain what is different for each user of the application.
|
|
113
|
+
*/
|
|
114
|
+
interface Input {
|
|
115
|
+
accountAddress: string;
|
|
116
|
+
chainId: CaipNetworkId;
|
|
117
|
+
notBefore?: Timestamp;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* This interface represents the SIWX message metadata.
|
|
121
|
+
* Here must contain the main data related to the app.
|
|
122
|
+
*/
|
|
123
|
+
interface Metadata {
|
|
124
|
+
domain: string;
|
|
125
|
+
uri: string;
|
|
126
|
+
version: string;
|
|
127
|
+
nonce: string;
|
|
128
|
+
statement?: string;
|
|
129
|
+
resources?: string[];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* This interface represents the SIWX message identifier.
|
|
133
|
+
* Here must contain the request id and the timestamps.
|
|
134
|
+
*/
|
|
135
|
+
interface Identifier {
|
|
136
|
+
requestId?: string;
|
|
137
|
+
issuedAt?: Timestamp;
|
|
138
|
+
expirationTime?: Timestamp;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* This interface represents the SIWX message methods.
|
|
142
|
+
* Here must contain the method to generate the message string and any other method performed by the SIWX message.
|
|
143
|
+
*/
|
|
144
|
+
interface Methods {
|
|
145
|
+
toString: () => string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The timestamp is a UTC string representing the time in ISO 8601 format.
|
|
149
|
+
*/
|
|
150
|
+
type Timestamp = string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* The Cacao interface is a reference of CAIP-74 and represents a chain-agnostic Object Capability (OCAP).
|
|
154
|
+
* https://chainagnostic.org/CAIPs/caip-74
|
|
155
|
+
*/
|
|
156
|
+
export interface Cacao {
|
|
157
|
+
h: Cacao.Header;
|
|
158
|
+
p: Cacao.Payload;
|
|
159
|
+
s: {
|
|
160
|
+
t: 'eip191' | 'eip1271';
|
|
161
|
+
s: string;
|
|
162
|
+
m?: string;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
export declare namespace Cacao {
|
|
166
|
+
interface Header {
|
|
167
|
+
t: 'caip122';
|
|
168
|
+
}
|
|
169
|
+
interface Payload {
|
|
170
|
+
domain: string;
|
|
171
|
+
aud: string;
|
|
172
|
+
nonce: string;
|
|
173
|
+
iss: string;
|
|
174
|
+
version?: string;
|
|
175
|
+
iat?: string;
|
|
176
|
+
nbf?: string;
|
|
177
|
+
exp?: string;
|
|
178
|
+
statement?: string;
|
|
179
|
+
requestId?: string;
|
|
180
|
+
resources?: string[];
|
|
181
|
+
type?: string;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type CaipNetworkId, type ChainNamespace } from '@reown/appkit-common';
|
|
2
|
+
import type { BlockchainApiBalanceResponse, BlockchainApiIdentityResponse, BlockchainApiLookupEnsName, ConnectionStatus, SocialProvider, WcWallet } from './TypeUtil.js';
|
|
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;
|
|
11
|
+
getActiveNetworkProps(): {
|
|
12
|
+
namespace: ChainNamespace | undefined;
|
|
13
|
+
caipNetworkId: `eip155:${string}` | `eip155:${number}` | `solana:${string}` | `solana:${number}` | `polkadot:${string}` | `polkadot:${number}` | `bip122:${string}` | `bip122:${number}` | undefined;
|
|
14
|
+
chainId: string | number | undefined;
|
|
15
|
+
};
|
|
16
|
+
setWalletConnectDeepLink({ name, href }: {
|
|
17
|
+
href: string;
|
|
18
|
+
name: string;
|
|
19
|
+
}): void;
|
|
20
|
+
getWalletConnectDeepLink(): any;
|
|
21
|
+
deleteWalletConnectDeepLink(): void;
|
|
22
|
+
setActiveNamespace(namespace: ChainNamespace): void;
|
|
23
|
+
setActiveCaipNetworkId(caipNetworkId: CaipNetworkId): void;
|
|
24
|
+
getActiveCaipNetworkId(): `eip155:${string}` | `solana:${string}` | `polkadot:${string}` | `bip122:${string}` | undefined;
|
|
25
|
+
deleteActiveCaipNetworkId(): void;
|
|
26
|
+
deleteConnectedConnectorId(namespace: ChainNamespace): void;
|
|
27
|
+
setAppKitRecent(wallet: WcWallet): void;
|
|
28
|
+
getRecentWallets(): WcWallet[];
|
|
29
|
+
setConnectedConnectorId(namespace: ChainNamespace, connectorId: string): void;
|
|
30
|
+
getActiveNamespace(): ChainNamespace | undefined;
|
|
31
|
+
getConnectedConnectorId(namespace: ChainNamespace | undefined): string | undefined;
|
|
32
|
+
setConnectedSocialProvider(socialProvider: SocialProvider): void;
|
|
33
|
+
getConnectedSocialProvider(): string | undefined;
|
|
34
|
+
deleteConnectedSocialProvider(): void;
|
|
35
|
+
getConnectedSocialUsername(): string | undefined;
|
|
36
|
+
getStoredActiveCaipNetworkId(): string | undefined;
|
|
37
|
+
setConnectionStatus(status: ConnectionStatus): void;
|
|
38
|
+
getConnectionStatus(): ConnectionStatus | undefined;
|
|
39
|
+
getConnectedNamespaces(): ChainNamespace[];
|
|
40
|
+
setConnectedNamespaces(namespaces: ChainNamespace[]): void;
|
|
41
|
+
addConnectedNamespace(namespace: ChainNamespace): void;
|
|
42
|
+
removeConnectedNamespace(namespace: ChainNamespace): void;
|
|
43
|
+
getTelegramSocialProvider(): SocialProvider | null | undefined;
|
|
44
|
+
setTelegramSocialProvider(socialProvider: SocialProvider): void;
|
|
45
|
+
removeTelegramSocialProvider(): void;
|
|
46
|
+
getBalanceCache(): Record<string, {
|
|
47
|
+
timestamp: number;
|
|
48
|
+
balance: BlockchainApiBalanceResponse;
|
|
49
|
+
}>;
|
|
50
|
+
removeAddressFromBalanceCache(caipAddress: string): void;
|
|
51
|
+
getBalanceCacheForCaipAddress(caipAddress: string): BlockchainApiBalanceResponse | undefined;
|
|
52
|
+
updateBalanceCache(params: {
|
|
53
|
+
caipAddress: string;
|
|
54
|
+
balance: BlockchainApiBalanceResponse;
|
|
55
|
+
timestamp: number;
|
|
56
|
+
}): void;
|
|
57
|
+
getNativeBalanceCache(): Record<string, {
|
|
58
|
+
caipAddress: string;
|
|
59
|
+
balance: string;
|
|
60
|
+
symbol: string;
|
|
61
|
+
timestamp: number;
|
|
62
|
+
}>;
|
|
63
|
+
removeAddressFromNativeBalanceCache(caipAddress: string): void;
|
|
64
|
+
getNativeBalanceCacheForCaipAddress(caipAddress: string): {
|
|
65
|
+
caipAddress: string;
|
|
66
|
+
balance: string;
|
|
67
|
+
symbol: string;
|
|
68
|
+
timestamp: number;
|
|
69
|
+
} | undefined;
|
|
70
|
+
updateNativeBalanceCache(params: {
|
|
71
|
+
caipAddress: string;
|
|
72
|
+
balance: string;
|
|
73
|
+
symbol: string;
|
|
74
|
+
timestamp: number;
|
|
75
|
+
}): void;
|
|
76
|
+
getEnsCache(): Record<string, {
|
|
77
|
+
ens: BlockchainApiLookupEnsName[];
|
|
78
|
+
timestamp: number;
|
|
79
|
+
}>;
|
|
80
|
+
getEnsFromCacheForAddress(address: string): BlockchainApiLookupEnsName[] | undefined;
|
|
81
|
+
updateEnsCache(params: {
|
|
82
|
+
address: string;
|
|
83
|
+
timestamp: number;
|
|
84
|
+
ens: BlockchainApiLookupEnsName[];
|
|
85
|
+
}): void;
|
|
86
|
+
removeEnsFromCache(address: string): void;
|
|
87
|
+
getIdentityCache(): Record<string, {
|
|
88
|
+
identity: BlockchainApiIdentityResponse;
|
|
89
|
+
timestamp: number;
|
|
90
|
+
}>;
|
|
91
|
+
getIdentityFromCacheForAddress(address: string): BlockchainApiIdentityResponse | undefined;
|
|
92
|
+
updateIdentityCache(params: {
|
|
93
|
+
address: string;
|
|
94
|
+
timestamp: number;
|
|
95
|
+
identity: BlockchainApiIdentityResponse;
|
|
96
|
+
}): void;
|
|
97
|
+
removeIdentityFromCache(address: string): void;
|
|
98
|
+
clearAddressCache(): void;
|
|
99
|
+
};
|