@dodoex/widgets 2.4.2-0 → 2.4.2-2
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/cjs/index.cjs +7 -7
- package/dist/cjs/src/components/Bridge/SelectBridgeDialog/productList.d.ts +4 -1
- package/dist/cjs/src/components/Swap/components/SettingsDialog/index.d.ts +1 -1
- package/dist/cjs/src/components/Widget/index.d.ts +5 -1
- package/dist/cjs/src/constants/api.d.ts +13 -2
- package/dist/cjs/src/constants/localstorage.d.ts +10 -0
- package/dist/cjs/src/constants/swap.d.ts +1 -1
- package/dist/cjs/src/hooks/Bridge/createBridgeOrder.d.ts +1 -1
- package/dist/cjs/src/hooks/Bridge/useSendRoute.d.ts +1 -1
- package/dist/cjs/src/hooks/Bridge/useSwitchBridgeOrSwapSlippage.d.ts +1 -1
- package/dist/cjs/src/hooks/Swap/useFetchFiatPrice.d.ts +1 -1
- package/dist/cjs/src/hooks/Swap/useInitDefaultToken.d.ts +10 -0
- package/dist/cjs/src/hooks/Widget/useInitPropsToRedux.d.ts +1 -1
- package/dist/cjs/src/hooks/setting/useDefaultSlippage.d.ts +1 -0
- package/dist/cjs/src/hooks/setting/useGetAPIService.d.ts +2 -0
- package/dist/index.js +7 -7
- package/dist/src/components/Bridge/SelectBridgeDialog/productList.d.ts +4 -1
- package/dist/src/components/Swap/components/SettingsDialog/index.d.ts +1 -1
- package/dist/src/components/Widget/index.d.ts +5 -1
- package/dist/src/constants/api.d.ts +13 -2
- package/dist/src/constants/localstorage.d.ts +10 -0
- package/dist/src/constants/swap.d.ts +1 -1
- package/dist/src/hooks/Bridge/createBridgeOrder.d.ts +1 -1
- package/dist/src/hooks/Bridge/useSendRoute.d.ts +1 -1
- package/dist/src/hooks/Bridge/useSwitchBridgeOrSwapSlippage.d.ts +1 -1
- package/dist/src/hooks/Swap/useFetchFiatPrice.d.ts +1 -1
- package/dist/src/hooks/Swap/useInitDefaultToken.d.ts +10 -0
- package/dist/src/hooks/Widget/useInitPropsToRedux.d.ts +1 -1
- package/dist/src/hooks/setting/useDefaultSlippage.d.ts +1 -0
- package/dist/src/hooks/setting/useGetAPIService.d.ts +2 -0
- package/package.json +2 -2
|
@@ -6,9 +6,10 @@ import { InitTokenListProps } from '../../hooks/Token/useInitTokenList';
|
|
|
6
6
|
import { ExecutionProps } from '../../hooks/Submission';
|
|
7
7
|
import { ChainId } from '../../constants/chains';
|
|
8
8
|
import { DefaultTokenInfo } from '../../hooks/Token/type';
|
|
9
|
+
import { APIServices } from '../../constants/api';
|
|
9
10
|
export declare const WIDGET_CLASS_NAME = "dodo-widget-container";
|
|
10
11
|
export interface WidgetProps extends Web3ConnectorsProps, InitTokenListProps, ExecutionProps {
|
|
11
|
-
apikey
|
|
12
|
+
apikey?: string;
|
|
12
13
|
theme?: ThemeOptions;
|
|
13
14
|
colorMode?: PaletteMode;
|
|
14
15
|
defaultChainId?: ChainId;
|
|
@@ -19,6 +20,9 @@ export interface WidgetProps extends Web3ConnectorsProps, InitTokenListProps, Ex
|
|
|
19
20
|
defaultFromToken?: DefaultTokenInfo;
|
|
20
21
|
defaultToToken?: DefaultTokenInfo;
|
|
21
22
|
locale?: SupportedLang;
|
|
23
|
+
swapSlippage?: number;
|
|
24
|
+
bridgeSlippage?: number;
|
|
25
|
+
apiServices?: Partial<APIServices>;
|
|
22
26
|
onProviderChanged?: (provider?: any) => void;
|
|
23
27
|
}
|
|
24
28
|
export declare function Widget(props: PropsWithChildren<WidgetProps>): JSX.Element;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { ChainId } from './chains';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
2
|
+
export declare enum APIServiceKey {
|
|
3
|
+
routePrice = "routePrice",
|
|
4
|
+
fiatPrice = "fiatPrice",
|
|
5
|
+
bridgeRoutePrice = "bridgeRoutePrice",
|
|
6
|
+
bridgeEncode = "bridgeEncode",
|
|
7
|
+
bridgeCreateRoute = "bridgeCreateRoute"
|
|
8
|
+
}
|
|
9
|
+
export declare type APIServices = {
|
|
10
|
+
[key in APIServiceKey]: string;
|
|
11
|
+
};
|
|
4
12
|
export declare const AppUrl = "https://app.dodoex.io";
|
|
5
13
|
export declare const getCGTokenListAPI: (chainId: ChainId) => any;
|
|
14
|
+
export declare const RoutePriceAPI = "https://api.dodoex.io/route-service/v2/widget/getdodoroute";
|
|
15
|
+
export declare const FiatPriceAPI = "https://api.dodoex.io/frontend-price-api";
|
|
6
16
|
export declare const BridgeRoutePriceAPI: string;
|
|
7
17
|
export declare const BridgeEncodeAPI: string;
|
|
8
18
|
export declare const BridgeCreateRouteAPI: string;
|
|
19
|
+
export declare function getAPIService(key: APIServiceKey, serviceProps?: Partial<APIServices>): string;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
import { TokenInfo } from '../hooks/Token';
|
|
2
|
+
import { ChainId } from './chains';
|
|
1
3
|
export declare function getAuthSwitchCache(): boolean;
|
|
2
4
|
export declare function setAuthSwitchCache(isAuto: boolean): void;
|
|
5
|
+
export interface LastTokenCache {
|
|
6
|
+
chainId: ChainId;
|
|
7
|
+
address: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function getLastToken(side: TokenInfo['side']): LastTokenCache | null;
|
|
10
|
+
export declare function setLastToken(side: TokenInfo['side'], token: LastTokenCache | null): void;
|
|
11
|
+
export declare function getLastSlippage(isBridge: boolean): number | null;
|
|
12
|
+
export declare function setLastSlippage(isBridge: boolean, slippage: number | string | null): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const AUTO_SWAP_SLIPPAGE_PROTECTION = "auto";
|
|
2
2
|
export declare const PRICE_IMPACT_THRESHOLD = 15;
|
|
3
|
-
export declare const DEFAULT_SWAP_SLIPPAGE =
|
|
3
|
+
export declare const DEFAULT_SWAP_SLIPPAGE = 0.2;
|
|
4
4
|
export declare const MAX_SWAP_SLIPPAGE = 50;
|
|
5
5
|
export declare const DEFAULT_SWAP_DDL = 20;
|
|
6
6
|
export declare const MIN_GAS_LIMIT = 30000;
|
|
@@ -3,7 +3,7 @@ import BigNumber from 'bignumber.js';
|
|
|
3
3
|
import { BridgeRouteI } from './useFetchRoutePriceBridge';
|
|
4
4
|
import { BridgeTXRequest } from '../../components/Bridge/BridgeSummaryDialog';
|
|
5
5
|
export declare function useSendRoute(): {
|
|
6
|
-
apikey: string;
|
|
6
|
+
apikey: string | undefined;
|
|
7
7
|
sendRouteLoading: boolean;
|
|
8
8
|
sendRouteError: string;
|
|
9
9
|
setSendRouteError: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useSwitchBridgeOrSwapSlippage(isBridge: boolean): boolean;
|
|
1
|
+
export declare function useSwitchBridgeOrSwapSlippage(isBridge: boolean | undefined): boolean;
|
|
@@ -5,7 +5,7 @@ export interface FetchFiatPriceProps {
|
|
|
5
5
|
fromToken: TokenInfo | null;
|
|
6
6
|
toToken: TokenInfo | null;
|
|
7
7
|
}
|
|
8
|
-
export declare function useFetchFiatPrice({ fromToken, toToken, chainId }: FetchFiatPriceProps): {
|
|
8
|
+
export declare function useFetchFiatPrice({ fromToken, toToken, chainId, }: FetchFiatPriceProps): {
|
|
9
9
|
loading: boolean;
|
|
10
10
|
refetch: () => void;
|
|
11
11
|
toFiatPrice: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TokenInfo } from '../Token';
|
|
3
|
+
export declare function useInitDefaultToken({ fromToken, toToken, setFromToken, setToToken, updateFromAmt, updateToAmt, }: {
|
|
4
|
+
fromToken: TokenInfo | null;
|
|
5
|
+
toToken: TokenInfo | null;
|
|
6
|
+
setFromToken: (value: React.SetStateAction<TokenInfo | null>) => void;
|
|
7
|
+
setToToken: (value: React.SetStateAction<TokenInfo | null>) => void;
|
|
8
|
+
updateFromAmt: (v: string | number) => void;
|
|
9
|
+
updateToAmt: (v: string | number) => void;
|
|
10
|
+
}): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { WidgetProps } from '../../components/Widget/';
|
|
2
|
-
export declare function useInitPropsToRedux({ width, height, feeRate, rebateTo, colorMode, apikey, defaultChainId, defaultToToken, defaultFromToken, jsonRpcUrlMap, }: WidgetProps): void;
|
|
2
|
+
export declare function useInitPropsToRedux({ width, height, feeRate, rebateTo, colorMode, apikey, defaultChainId, defaultToToken, defaultFromToken, jsonRpcUrlMap, swapSlippage, bridgeSlippage, apiServices, }: WidgetProps): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useDefaultSlippage(isBridge: boolean | undefined): number;
|