@cetusprotocol/terminal 0.0.0-experimental-1737427725035

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.
Files changed (158) hide show
  1. package/README.md +39 -0
  2. package/dist/App.d.ts +2 -0
  3. package/dist/Com.d.ts +4 -0
  4. package/dist/_redirects +2 -0
  5. package/dist/cetus-swap.cjs.js +114 -0
  6. package/dist/cetus-swap.cjs.js.gz +0 -0
  7. package/dist/cetus-swap.es.js +36047 -0
  8. package/dist/cetus-swap.es.js.gz +0 -0
  9. package/dist/cetus-swap.umd.js +114 -0
  10. package/dist/cetus-swap.umd.js.gz +0 -0
  11. package/dist/components/common/BackButton.d.ts +3 -0
  12. package/dist/components/common/Button.d.ts +8 -0
  13. package/dist/components/common/CopyButton.d.ts +4 -0
  14. package/dist/components/common/HaveBackHeader.d.ts +4 -0
  15. package/dist/components/common/HighlightText.d.ts +10 -0
  16. package/dist/components/common/Loading.d.ts +2 -0
  17. package/dist/components/common/MevButton.d.ts +1 -0
  18. package/dist/components/common/NumericFormatInput.d.ts +15 -0
  19. package/dist/components/common/RefreshButton.d.ts +3 -0
  20. package/dist/components/common/SettingsButton.d.ts +5 -0
  21. package/dist/components/common/SlippageButton.d.ts +4 -0
  22. package/dist/components/common/Spinner.d.ts +8 -0
  23. package/dist/components/common/SpinnerWithGap.d.ts +7 -0
  24. package/dist/components/common/Toast.d.ts +7 -0
  25. package/dist/components/common/TokenImage.d.ts +7 -0
  26. package/dist/components/common/Tooltip.d.ts +9 -0
  27. package/dist/components/common/TooltipV2.d.ts +9 -0
  28. package/dist/components/common/TsStatusDialog.d.ts +7 -0
  29. package/dist/components/common/wallet/AccountSwitch.d.ts +3 -0
  30. package/dist/components/common/wallet/ConnectButton.d.ts +1 -0
  31. package/dist/components/common/wallet/TriggerButton.d.ts +4 -0
  32. package/dist/components/demo/CodeBlocks.d.ts +1 -0
  33. package/dist/components/demo/DemoFooter.d.ts +1 -0
  34. package/dist/components/demo/DisplayModeBlock.d.ts +1 -0
  35. package/dist/components/demo/DisplayModeTab.d.ts +6 -0
  36. package/dist/components/demo/NavMenu.d.ts +1 -0
  37. package/dist/components/demo/SetingMenu.d.ts +1 -0
  38. package/dist/components/demo/SimulateDappWallet.d.ts +1 -0
  39. package/dist/components/demo/SwapPanel.d.ts +1 -0
  40. package/dist/components/demo/TerminalModalButton.d.ts +5 -0
  41. package/dist/components/demo/WidgetBlock.d.ts +7 -0
  42. package/dist/components/demo/WidgetBtn.d.ts +7 -0
  43. package/dist/components/demo/index.d.ts +1 -0
  44. package/dist/components/export/ExportModal.d.ts +4 -0
  45. package/dist/components/export/ExportWidgetBtn.d.ts +7 -0
  46. package/dist/components/swap/CurrentPriceBlock.d.ts +10 -0
  47. package/dist/components/swap/PriceImpact.d.ts +8 -0
  48. package/dist/components/swap/ReceivedBlock.d.ts +8 -0
  49. package/dist/components/swap/RouteDialog.d.ts +11 -0
  50. package/dist/components/swap/ScamsAlert.d.ts +5 -0
  51. package/dist/components/swap/SecondaryDialog.d.ts +8 -0
  52. package/dist/components/swap/SimpleRouter.d.ts +8 -0
  53. package/dist/components/swap/SwapHeader.d.ts +5 -0
  54. package/dist/components/swap/SwapTrade.d.ts +7 -0
  55. package/dist/components/swap/SwapWidget.d.ts +4 -0
  56. package/dist/components/swap/TestToast.d.ts +1 -0
  57. package/dist/components/swap/TokenSelect.d.ts +7 -0
  58. package/dist/components/swap/TokenSelectModal/CollectTokenBlock.d.ts +6 -0
  59. package/dist/components/swap/TokenSelectModal/NoData.d.ts +11 -0
  60. package/dist/components/swap/TokenSelectModal/PlatformTabs.d.ts +5 -0
  61. package/dist/components/swap/TokenSelectModal/PopularTokens.d.ts +1 -0
  62. package/dist/components/swap/TokenSelectModal/TokenList.d.ts +13 -0
  63. package/dist/components/swap/TokenSelectModal/TypeTabs.d.ts +4 -0
  64. package/dist/components/swap/TokenSelectModal/WarnTokenDialog.d.ts +6 -0
  65. package/dist/components/swap/TokenSelectModal/index.d.ts +6 -0
  66. package/dist/components/swap/TradeInput.d.ts +17 -0
  67. package/dist/components/swap/WidgetHeader.d.ts +4 -0
  68. package/dist/config/explorer.d.ts +2 -0
  69. package/dist/config/index.d.ts +11 -0
  70. package/dist/config/provider.d.ts +36 -0
  71. package/dist/config/rpc.d.ts +2 -0
  72. package/dist/config/token.d.ts +3 -0
  73. package/dist/data/pools.json +40563 -0
  74. package/dist/data/pools.json.gz +0 -0
  75. package/dist/favicon.ico +0 -0
  76. package/dist/hooks/common/useExplorer.d.ts +4 -0
  77. package/dist/hooks/common/useFetch.d.ts +3 -0
  78. package/dist/hooks/common/useFindBestRouting.d.ts +11 -0
  79. package/dist/hooks/common/useGetPoolListByCoinType.d.ts +3 -0
  80. package/dist/hooks/common/useGetRouterConfig.d.ts +3 -0
  81. package/dist/hooks/common/useInterval.d.ts +9 -0
  82. package/dist/hooks/common/useSigner.d.ts +8 -0
  83. package/dist/hooks/common/useSyncedRef.d.ts +1 -0
  84. package/dist/hooks/common/useTransaction.d.ts +5 -0
  85. package/dist/hooks/common/useWindowWidth.d.ts +4 -0
  86. package/dist/hooks/demo/useDisplayMode.d.ts +15 -0
  87. package/dist/hooks/demo/useRpcConfiguration.d.ts +10 -0
  88. package/dist/hooks/demo/useSeting.d.ts +0 -0
  89. package/dist/hooks/swap/usePriceImpact.d.ts +13 -0
  90. package/dist/hooks/swap/useSwap.d.ts +13 -0
  91. package/dist/hooks/swap/useSwapButtonStatus.d.ts +4 -0
  92. package/dist/hooks/swap/useSwapHelper.d.ts +49 -0
  93. package/dist/hooks/useDebounce.d.ts +4 -0
  94. package/dist/hooks/useGetPoolList.d.ts +22 -0
  95. package/dist/hooks/useGetTokenBalance.d.ts +5 -0
  96. package/dist/hooks/useInitWidget.d.ts +3 -0
  97. package/dist/hooks/useSuiClient.d.ts +1 -0
  98. package/dist/hooks/useToast.d.ts +7 -0
  99. package/dist/hooks/useTokenCollect.d.ts +6 -0
  100. package/dist/hooks/useTokenPrice.d.ts +6 -0
  101. package/dist/hooks/useTokenSelect.d.ts +11 -0
  102. package/dist/hooks/useTokens.d.ts +8 -0
  103. package/dist/images/aggregator-source/aftermath.png +0 -0
  104. package/dist/images/aggregator-source/bluefin.png +0 -0
  105. package/dist/images/aggregator-source/bluemove.png +0 -0
  106. package/dist/images/aggregator-source/cetus.png +0 -0
  107. package/dist/images/aggregator-source/deepbook.png +0 -0
  108. package/dist/images/aggregator-source/flowx.png +0 -0
  109. package/dist/images/aggregator-source/haedal.png +0 -0
  110. package/dist/images/aggregator-source/kriya.png +0 -0
  111. package/dist/images/aggregator-source/scallop.png +0 -0
  112. package/dist/images/aggregator-source/suilend.png +0 -0
  113. package/dist/images/aggregator-source/turbos.png +0 -0
  114. package/dist/images/aggregator-source/volo.png +0 -0
  115. package/dist/images/birdeye-logo.png +0 -0
  116. package/dist/images/ghost_loading.png +0 -0
  117. package/dist/images/icon_mev@2x.png +0 -0
  118. package/dist/images/img-logo@2x.png +0 -0
  119. package/dist/images/img_no_data@2x.png +0 -0
  120. package/dist/images/logo@2x.png +0 -0
  121. package/dist/images/logo_CoinGecko@2x.png +0 -0
  122. package/dist/images/logo_pyth.png +0 -0
  123. package/dist/images/logo_suiscan@2x.png +0 -0
  124. package/dist/images/logo_suivision@2x.png +0 -0
  125. package/dist/images/placeholder-token@2x.png +0 -0
  126. package/dist/images/primary_loading.png +0 -0
  127. package/dist/index.d.ts +2 -0
  128. package/dist/main.d.ts +0 -0
  129. package/dist/stores/account.d.ts +16 -0
  130. package/dist/stores/client.d.ts +10 -0
  131. package/dist/stores/common.d.ts +8 -0
  132. package/dist/stores/demo.d.ts +27 -0
  133. package/dist/stores/global.d.ts +52 -0
  134. package/dist/stores/price.d.ts +8 -0
  135. package/dist/stores/swap.d.ts +26 -0
  136. package/dist/stores/token.d.ts +13 -0
  137. package/dist/stores/tokenSelect.d.ts +30 -0
  138. package/dist/stores/transaction.d.ts +7 -0
  139. package/dist/style.css +1 -0
  140. package/dist/style.css.gz +0 -0
  141. package/dist/types/common.d.ts +91 -0
  142. package/dist/types/config.d.ts +13 -0
  143. package/dist/types/demo.d.ts +5 -0
  144. package/dist/types/index.d.ts +4 -0
  145. package/dist/types/sui.d.ts +33 -0
  146. package/dist/utils/common.d.ts +13 -0
  147. package/dist/utils/contract.d.ts +10 -0
  148. package/dist/utils/decimal.d.ts +2 -0
  149. package/dist/utils/error.d.ts +9 -0
  150. package/dist/utils/fetch.d.ts +8 -0
  151. package/dist/utils/formatter.d.ts +12 -0
  152. package/dist/utils/index.d.ts +8 -0
  153. package/dist/utils/localforage-key.d.ts +4 -0
  154. package/dist/utils/localforage-service.d.ts +6 -0
  155. package/dist/utils/number.d.ts +20 -0
  156. package/dist/vite-env.d.ts +1 -0
  157. package/dist/widget.d.ts +0 -0
  158. package/package.json +72 -0
Binary file
Binary file
@@ -0,0 +1,4 @@
1
+ export type ExplorerType = "account" | "token" | "tx" | "poolAddress" | "nftAddress" | "coin";
2
+ export default function useExplorer(): {
3
+ getExplorerUrl: (address?: string, type?: ExplorerType, explorer?: string) => string;
4
+ };
@@ -0,0 +1,3 @@
1
+ export declare function useFetch(): {
2
+ fetchByApi: (path: string, type: "GET" | "POST", options?: any, domain?: string) => Promise<any>;
3
+ };
@@ -0,0 +1,11 @@
1
+ import { SwapRouterData, Token } from '../../types';
2
+ export declare function useFindBestRouting(): {
3
+ findBestRouters: (options: {
4
+ fromToken: Token;
5
+ toToken: Token;
6
+ amount: string;
7
+ providersKeys: string[];
8
+ by_amount_in: boolean;
9
+ uuid: string;
10
+ }) => Promise<SwapRouterData>;
11
+ };
@@ -0,0 +1,3 @@
1
+ export declare function useGetPoolListByCoinType(useLocal?: boolean): {
2
+ getPoolListByCoinType: (fromCoin: string, toCoin: string) => Promise<any[]>;
3
+ };
@@ -0,0 +1,3 @@
1
+ export default function useGetRouterConfig(): {
2
+ fetchRouterConfig: () => Promise<void>;
3
+ };
@@ -0,0 +1,9 @@
1
+ type IntervalHookOptions = {
2
+ interval: number;
3
+ callback: (timestamp: number) => void;
4
+ };
5
+ export declare function useInterval({ interval, callback }: IntervalHookOptions): {
6
+ startTimer: () => void;
7
+ stopTimer: () => void;
8
+ };
9
+ export {};
@@ -0,0 +1,8 @@
1
+ import { SuiTransactionBlockResponse } from '@mysten/sui/client';
2
+ import { Transaction } from '@mysten/sui/transactions';
3
+ import { SignedTransaction } from '@mysten/wallet-standard';
4
+ export declare function useSigner(): {
5
+ signAndExecuteTransactionBlock: (transactionBlock: Transaction, useDevInspect?: boolean) => Promise<SuiTransactionBlockResponse>;
6
+ signTransactionBlock: (transactionBlock: Uint8Array | Transaction | string) => Promise<SignedTransaction>;
7
+ executeTransactionBlock: (rawBytes: string, signature: string | string[], useDevInspect?: boolean) => Promise<SuiTransactionBlockResponse>;
8
+ };
@@ -0,0 +1 @@
1
+ export declare function useSyncedRef<T>(value: T): React.MutableRefObject<T>;
@@ -0,0 +1,5 @@
1
+ import { ToastType, TransactionOption } from '../../types';
2
+ import { Transaction } from '@mysten/sui/transactions';
3
+ export default function useTransaction(): {
4
+ signAndExecuteTransaction: (tx: Transaction, toastType: ToastType, option?: TransactionOption) => Promise<any>;
5
+ };
@@ -0,0 +1,4 @@
1
+ export default function useWindowWidth(): {
2
+ windowWidth: number;
3
+ isApp: boolean;
4
+ };
@@ -0,0 +1,15 @@
1
+ import { DisplayMode, WidgetBtnSize, WidgetDirection } from '../../types';
2
+ export default function useDisplayMode(): {
3
+ DisplayModeList: DisplayMode[];
4
+ displayMode: DisplayMode;
5
+ handleChangeDisplayMode: (value: DisplayMode) => void;
6
+ currentDisplayModeDesc: string;
7
+ isOpenSwapModal: boolean;
8
+ handleCloseSwapModal: () => void;
9
+ handleOpenSwapModal: () => void;
10
+ handleChangeWidgetDirection: (value: WidgetDirection) => void;
11
+ widgetCurrentDirection: WidgetDirection;
12
+ widgetBtnSize: WidgetBtnSize;
13
+ handleChangeWidgetBtnSize: (value: WidgetBtnSize) => void;
14
+ isIndependentWallet: boolean;
15
+ };
@@ -0,0 +1,10 @@
1
+ export default function useRpcConfiguration(): {
2
+ customRpcList: any[];
3
+ handleAdd: () => void;
4
+ handleInputChange: (index: number, value: string) => void;
5
+ handleDelete: (index: number) => void;
6
+ handleSave: (index: number) => void;
7
+ handleEdit: (index: number) => void;
8
+ handleSetDefault: (index: number) => void;
9
+ defaultRpcIndex: number;
10
+ };
File without changes
@@ -0,0 +1,13 @@
1
+ import { Token } from '../../types/common';
2
+ export declare function usePriceImpact(fromToken?: Token, toToken?: Token, fromValue?: string, toValue?: string): {
3
+ swapPrice: string;
4
+ marketPrice: string | undefined;
5
+ priceImpact: string | undefined;
6
+ sources: string[];
7
+ showPriceImpactTips: boolean;
8
+ showPriceImpactWarn: boolean;
9
+ priceImpactTextInfo: {
10
+ priceImpactText: string | undefined;
11
+ textColor: string;
12
+ };
13
+ };
@@ -0,0 +1,13 @@
1
+ import { SwapRouterData, Token } from '../../types';
2
+ export declare function useSwapHook(): {
3
+ handleAmountChange: (amount: string, by_amount_in: boolean, resetOtherInput?: boolean) => void;
4
+ handleSelectToken: (coin: Token, isFrom?: boolean) => void;
5
+ fromBalanceInfo: import('../../types').TokenBalance | undefined;
6
+ toBalanceInfo: import('../../types').TokenBalance | undefined;
7
+ fromAmountValue: string;
8
+ toAmountValue: string;
9
+ doSwapAction: (data: SwapRouterData, partner?: string) => Promise<void>;
10
+ reCalculateRouteData: () => void;
11
+ refreshMarketPrice: () => void;
12
+ scamsText: string | undefined;
13
+ };
@@ -0,0 +1,4 @@
1
+ export declare function useSwapButtonStatus(fromBalance?: string): {
2
+ btnText: string | undefined;
3
+ btnDisabled: boolean;
4
+ };
@@ -0,0 +1,49 @@
1
+ import { SwapRouterData, SwapRouterFormat, Token } from '../../types';
2
+ /**
3
+ * 获取展示PriceAccept RouterData
4
+ * @param originData
5
+ * @returns
6
+ */
7
+ export declare function useGetPriceAcceptRouterData(originData?: SwapRouterData): {
8
+ priceAcceptRouterData: SwapRouterData | undefined;
9
+ };
10
+ /**
11
+ * 计算交易的amountLimit
12
+ * @param slippage
13
+ * @param routerData
14
+ * @returns
15
+ */
16
+ export declare function useGetAmountLimit(slippage: string | number, routerData?: SwapRouterData): {
17
+ amountLimit: string | undefined;
18
+ };
19
+ /**
20
+ * 对RouterData 进行格式化处理
21
+ * @returns
22
+ */
23
+ export declare function useFormatSwapRouter(routerData?: SwapRouterData): {
24
+ formatSwapRouter: SwapRouterFormat | undefined;
25
+ };
26
+ /**
27
+ * 得到 swap 降级 池子地址列表
28
+ * @returns
29
+ */
30
+ export declare function useGetSwapPoolAddressList(): {
31
+ getSwapPoolAddress: () => Promise<any[]>;
32
+ };
33
+ /**
34
+ * 计算swap 价格ß
35
+ * @param fromAmount
36
+ * @param toAmount
37
+ */
38
+ export declare function useGetSwapPrice(direct: boolean, fromAmount?: string, toAmount?: string): string;
39
+ /**
40
+ * token 风险提示检查
41
+ * @returns
42
+ */
43
+ export default function useCheckTokenScamsAlert(coinInfo?: Token): {
44
+ isScamsCoin: boolean | undefined;
45
+ };
46
+ export declare function useCheckCustomCoinPair(fromCoinType?: string, toCoinType?: string): {
47
+ isCustomMode: boolean;
48
+ customWarnTokenList: Token[];
49
+ };
@@ -0,0 +1,4 @@
1
+ type noop = (...args: any[]) => any;
2
+ export declare function useDebounceFunction<T extends noop>(callback: T, delay?: number): (...args: Parameters<T>) => void;
3
+ export declare function useDebounceValue(value: string, delay: number): string;
4
+ export {};
@@ -0,0 +1,22 @@
1
+ export type GetPoolListParams = {
2
+ is_vaults?: boolean;
3
+ display_all_pools?: boolean;
4
+ has_mining?: boolean;
5
+ has_farming?: boolean;
6
+ no_incentives?: boolean;
7
+ order_by?: string;
8
+ limit?: number;
9
+ offset?: number;
10
+ coin_type?: string;
11
+ pool?: string;
12
+ };
13
+ export default function useGetPoolList(): {
14
+ getPoolList: (params: GetPoolListParams) => Promise<{
15
+ list: any[];
16
+ total: number;
17
+ }>;
18
+ getLocalJsonPoolList: (params: GetPoolListParams) => Promise<{
19
+ list: any[];
20
+ total: number;
21
+ }>;
22
+ };
@@ -0,0 +1,5 @@
1
+ import { TokenBalance } from '../types';
2
+ export default function useGetTokenBalance(coinType?: string): {
3
+ getOwnerCoinBalances: (account?: string, coinType?: string) => Promise<void>;
4
+ balanceInfo: TokenBalance | undefined;
5
+ };
@@ -0,0 +1,3 @@
1
+ export default function useInitWidget(initProps: any, customWallet?: any): {
2
+ handleSetDefaultPair: (from: string, to: string) => Promise<void>;
3
+ };
@@ -0,0 +1 @@
1
+ export default function useSuiClient(): void;
@@ -0,0 +1,7 @@
1
+ import { ToastType, TransactionStatusType } from '../types';
2
+ export declare const useToast: (containerId?: string) => {
3
+ addCommonToast: (message: string, status?: TransactionStatusType) => void;
4
+ addTxToast: (toastType: ToastType) => number;
5
+ ToastContainer: () => import('react').ReactPortal;
6
+ removeToast: (id: number) => void;
7
+ };
@@ -0,0 +1,6 @@
1
+ import { Token } from '../types';
2
+ export default function useTokenCollect(): {
3
+ handleCollectToken: (value: Token) => void;
4
+ isCollectToken: (token: Token) => boolean;
5
+ collectTokenMap: Map<string, Token>;
6
+ };
@@ -0,0 +1,6 @@
1
+ import { TokenPrice } from '../types';
2
+ export default function useTokenPrice(): {
3
+ fetchTokenPrices: (coinTypeList: string[]) => Promise<TokenPrice[] | null>;
4
+ getTokenPrice: (coinType?: string) => TokenPrice | undefined;
5
+ getTokenAmountValue: (coinType?: string, amount?: string, defaultReturn?: string) => string;
6
+ };
@@ -0,0 +1,11 @@
1
+ import { Token } from '../types';
2
+ export default function useTokenSelect(currCoin?: string): {
3
+ showTokenList: any[];
4
+ handleSearch: (keyword: string) => void;
5
+ handleChangePlatform: (platform: string) => void;
6
+ currentImportTokenData: any;
7
+ handleChangeType: (type: string) => void;
8
+ handleImportClick: () => void;
9
+ handleDeleteImportClick: (token: Token) => void;
10
+ isNoData: boolean;
11
+ };
@@ -0,0 +1,8 @@
1
+ import { Token } from '../types';
2
+ import { CoinMetadata } from '@mysten/sui/client';
3
+ export declare function coinMetadataToCoinInfo(metadata: CoinMetadata, coinType: string): Token;
4
+ export declare function useTokens(): {
5
+ getTokens: () => Promise<void>;
6
+ fetchTokenInfo: (coinType: string) => Promise<Token | undefined>;
7
+ getTokenInfo: (coinType?: string) => Token | undefined;
8
+ };
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,2 @@
1
+ import { default as SwapWidget } from './Com.tsx';
2
+ export declare const CetusSwap: typeof SwapWidget;
package/dist/main.d.ts ADDED
File without changes
@@ -0,0 +1,16 @@
1
+ import { TokenBalance } from '../types';
2
+ import { WalletAccount } from '@wallet-standard/base';
3
+ interface AccountState {
4
+ accounts: WalletAccount[];
5
+ currentAccount: WalletAccount | undefined;
6
+ saveCurrentAccount: (account: WalletAccount | undefined) => void;
7
+ saveAccounts: (accounts: WalletAccount[]) => void;
8
+ isOpenWalletModal: boolean;
9
+ onWalletModal: (isOpen: boolean) => void;
10
+ isOpenAccountList: boolean;
11
+ setIsOpenAccountList: (value: boolean) => void;
12
+ tokenBalanceObj: Record<string, TokenBalance>;
13
+ setTokenBalanceObj: (data: Record<string, TokenBalance>) => void;
14
+ }
15
+ declare const useAccountStore: import('zustand').UseBoundStore<import('zustand').StoreApi<AccountState>>;
16
+ export { useAccountStore };
@@ -0,0 +1,10 @@
1
+ import { AggregatorClient } from '@cetusprotocol/aggregator-sdk';
2
+ import { SuiClient } from '@mysten/sui/client';
3
+ interface ClientState {
4
+ suiClient: SuiClient;
5
+ setSuiClient: (value: SuiClient) => void;
6
+ aggregatorSDK: AggregatorClient;
7
+ setAggregatorSDK: (client: AggregatorClient) => void;
8
+ }
9
+ declare const useClientStore: import('zustand').UseBoundStore<import('zustand').StoreApi<ClientState>>;
10
+ export { useClientStore };
@@ -0,0 +1,8 @@
1
+ import { ToastType } from '../types';
2
+ interface AccountState {
3
+ toasts: ToastType[];
4
+ setToasts: (value: ToastType) => void;
5
+ removeToast: (id: number) => void;
6
+ }
7
+ declare const useCommonStore: import('zustand').UseBoundStore<import('zustand').StoreApi<AccountState>>;
8
+ export { useCommonStore };
@@ -0,0 +1,27 @@
1
+ import { DefaultPairType, DefaultSlippageType, DisplayMode, WidgetBtnSize, WidgetDirection } from '../types';
2
+ interface DemoState {
3
+ defaultPairType: DefaultPairType;
4
+ setDefaultPairType: (value: DefaultPairType) => void;
5
+ defaultSlippageType: DefaultSlippageType;
6
+ setDefaultSlippageType: (value: DefaultSlippageType) => void;
7
+ isIndependentWallet: boolean;
8
+ customSlippage: string;
9
+ setCustomSlippage: (value: string) => void;
10
+ setIsIndependentWallet: (value: boolean) => void;
11
+ customRpcList: any[];
12
+ setCustomRpcList: (value: any) => void;
13
+ defaultRpcIndex: number;
14
+ setDefaultRpcIndex: (value: number) => void;
15
+ displayMode: DisplayMode;
16
+ setDisplayMode: (value: DisplayMode) => void;
17
+ isOpenSwapModal: boolean;
18
+ setIsOpenSwapModal: (value: boolean) => void;
19
+ widgetCurrentDirection: WidgetDirection;
20
+ setWidgetCurrentDirection: (value: WidgetDirection) => void;
21
+ widgetBtnSize: WidgetBtnSize;
22
+ setWidgetBtnSize: (value: WidgetBtnSize) => void;
23
+ isOpenSwapWidgetModal: boolean;
24
+ setIsOpenSwapWidgetModal: (value: boolean) => void;
25
+ }
26
+ declare const useDemoStore: import('zustand').UseBoundStore<import('zustand').StoreApi<DemoState>>;
27
+ export default useDemoStore;
@@ -0,0 +1,52 @@
1
+ import { AggregatorProvider } from '../config/provider';
2
+ import { ConfigLinkItem } from '../types';
3
+ interface GlobalState {
4
+ currentExplorer: string;
5
+ setCurrentExplorer: (value: string) => void;
6
+ rpcList: ConfigLinkItem[];
7
+ setRpcList: (list: ConfigLinkItem[]) => void;
8
+ currentRpc: ConfigLinkItem;
9
+ setCurrentRpc: (value: ConfigLinkItem) => void;
10
+ customRpc: string;
11
+ setCustomRpc: (value: string) => void;
12
+ slippage: string;
13
+ setSlippage: (value: string) => void;
14
+ isOpenSlippageDialog: boolean;
15
+ setIsOpenSlippageDialog: (value: boolean) => void;
16
+ providers: AggregatorProvider[];
17
+ setProviders: (providers: AggregatorProvider[]) => void;
18
+ poolApiMap: Record<string, any[]>;
19
+ setPoolApiMap: (key: string, poolAddress: any[]) => void;
20
+ mevProtect: boolean;
21
+ setMevProtect: (value: boolean) => void;
22
+ ignoreWarnTokenMap: Record<string, boolean>;
23
+ setIgnoreWarnToken: (coin_type: string) => void;
24
+ }
25
+ declare const useGlobalStore: import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<GlobalState>, "persist"> & {
26
+ persist: {
27
+ setOptions: (options: Partial<import('zustand/middleware').PersistOptions<GlobalState, {
28
+ currentExplorer: string;
29
+ currentRpc: ConfigLinkItem;
30
+ slippage: string;
31
+ customRpc: string;
32
+ providers: AggregatorProvider[];
33
+ mevProtect: boolean;
34
+ ignoreWarnTokenMap: Record<string, boolean>;
35
+ }>>) => void;
36
+ clearStorage: () => void;
37
+ rehydrate: () => Promise<void> | void;
38
+ hasHydrated: () => boolean;
39
+ onHydrate: (fn: (state: GlobalState) => void) => () => void;
40
+ onFinishHydration: (fn: (state: GlobalState) => void) => () => void;
41
+ getOptions: () => Partial<import('zustand/middleware').PersistOptions<GlobalState, {
42
+ currentExplorer: string;
43
+ currentRpc: ConfigLinkItem;
44
+ slippage: string;
45
+ customRpc: string;
46
+ providers: AggregatorProvider[];
47
+ mevProtect: boolean;
48
+ ignoreWarnTokenMap: Record<string, boolean>;
49
+ }>>;
50
+ };
51
+ }>;
52
+ export { useGlobalStore };
@@ -0,0 +1,8 @@
1
+ import { TokenPrice } from '../types';
2
+ interface TokenState {
3
+ coinPriceObj: Record<string, TokenPrice>;
4
+ setPriceObj: (obj: Record<string, TokenPrice>) => void;
5
+ clearPriceObj: (coinTypeList: string[]) => void;
6
+ }
7
+ declare const useTokenPriceStore: import('zustand').UseBoundStore<import('zustand').StoreApi<TokenState>>;
8
+ export default useTokenPriceStore;
@@ -0,0 +1,26 @@
1
+ import { SwapRouterData, Token } from '../types/common';
2
+ interface SwapState {
3
+ defaultFromCoinType?: string;
4
+ defaultToCoinCoinType?: string;
5
+ setDefaultCoin: (from?: string, to?: string) => void;
6
+ fromCoin: Token | undefined;
7
+ toCoin: Token | undefined;
8
+ setFromCoin: (value: Token | undefined) => void;
9
+ setToCoin: (value: Token | undefined) => void;
10
+ byAmountIn: boolean;
11
+ setByAmountIn: (byAmountIn: boolean) => void;
12
+ fromAmount: string;
13
+ toAmount: string;
14
+ setFromAmount: (amount: string) => void;
15
+ setToAmount: (amount: string) => void;
16
+ findRouterLoading: boolean;
17
+ setFindRouterLoading: (loading: boolean) => void;
18
+ routerData?: SwapRouterData;
19
+ setRouterData: (data?: SwapRouterData) => void;
20
+ isOpenSecondary: boolean;
21
+ setIsOpenSecondary: (isOpen: boolean) => void;
22
+ isOpenTokensDialog: boolean;
23
+ setIsOpenTokensDialog: (isOpen: boolean) => void;
24
+ }
25
+ declare const useSwapStore: import('zustand').UseBoundStore<import('zustand').StoreApi<SwapState>>;
26
+ export default useSwapStore;
@@ -0,0 +1,13 @@
1
+ import { Token } from '../types';
2
+ interface TokenState {
3
+ requestTokenList: string[];
4
+ addRequestTokenList: (coinType: string) => void;
5
+ setToken: (info: Token) => void;
6
+ tokenMap: Map<string, Token>;
7
+ setTokenMap: (data: Map<string, Token>, notSave?: boolean) => void;
8
+ trustedTokenList: Token[];
9
+ setTrustedTokenList: (data: Token[], notSave?: boolean) => void;
10
+ tokenMapIsInit: boolean;
11
+ }
12
+ declare const useTokenStore: import('zustand').UseBoundStore<import('zustand').StoreApi<TokenState>>;
13
+ export default useTokenStore;
@@ -0,0 +1,30 @@
1
+ import { Token } from '../types';
2
+ interface AccountState {
3
+ currentTypeTab: string;
4
+ setCurrentTypeTab: (value: string) => void;
5
+ currentPlatformTab: string;
6
+ setCurrentPlatformTab: (value: string) => void;
7
+ platformList: string[];
8
+ setPlatformList: (value: string[]) => void;
9
+ isOpenImportDialog: boolean;
10
+ setIsOpenImportDialog: (value: boolean) => void;
11
+ collectTokenMap: Map<string, Token>;
12
+ setCollectTokenMap: (data: Map<string, Token>, notSave?: boolean) => void;
13
+ showTokenList: any[];
14
+ setShowTokenList: (data: any[]) => void;
15
+ combineTokenList: any[];
16
+ setComBineTokenList: (data: any[]) => void;
17
+ currentImportTokenData: any;
18
+ setCurrentImportTokenData: (data: any) => void;
19
+ importTokenList: Token[];
20
+ setImportToken: (token: Token, isAdd: boolean) => Token[];
21
+ setImportTokenList: (tokenList: Token[]) => void;
22
+ importTokenIsLoading: boolean;
23
+ setImportTokenIsLoading: (value: boolean) => void;
24
+ searchInput: string;
25
+ setSearchInput: (value: string) => void;
26
+ showTokenListIsLoading: boolean;
27
+ setShowTokenListIsLoading: (value: boolean) => void;
28
+ }
29
+ declare const useTokenSelectStore: import('zustand').UseBoundStore<import('zustand').StoreApi<AccountState>>;
30
+ export { useTokenSelectStore };
@@ -0,0 +1,7 @@
1
+ import { ToastType } from '../types';
2
+ interface TransactionState {
3
+ transactionData?: ToastType | undefined;
4
+ setTransactionData: (data?: ToastType) => void;
5
+ }
6
+ declare const useTransactionStore: import('zustand').UseBoundStore<import('zustand').StoreApi<TransactionState>>;
7
+ export { useTransactionStore };