@dodoex/widgets 2.5.2 → 2.5.3-1

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.
@@ -1,2 +1,7 @@
1
1
  /// <reference types="react" />
2
- export declare function Swap(): JSX.Element;
2
+ import { GetAutoSlippage } from '../../hooks/setting/useSetAutoSlippage';
3
+ export interface SwapProps {
4
+ /** Higher priority setting slippage */
5
+ getAutoSlippage?: GetAutoSlippage;
6
+ }
7
+ export declare function Swap({ getAutoSlippage }?: SwapProps): JSX.Element;
@@ -7,8 +7,9 @@ import { ExecutionProps } from '../../hooks/Submission';
7
7
  import { ChainId } from '../../constants/chains';
8
8
  import { DefaultTokenInfo } from '../../hooks/Token/type';
9
9
  import { APIServices } from '../../constants/api';
10
+ import { SwapProps } from '../Swap';
10
11
  export declare const WIDGET_CLASS_NAME = "dodo-widget-container";
11
- export interface WidgetProps extends Web3ConnectorsProps, InitTokenListProps, ExecutionProps {
12
+ export interface WidgetProps extends Web3ConnectorsProps, InitTokenListProps, ExecutionProps, SwapProps {
12
13
  apikey?: string;
13
14
  theme?: ThemeOptions;
14
15
  colorMode?: PaletteMode;
@@ -1 +1,4 @@
1
- export declare function useDefaultSlippage(isBridge: boolean | undefined): number;
1
+ export declare function useDefaultSlippage(isBridge: boolean | undefined): {
2
+ defaultSlippage: number;
3
+ loading: boolean | undefined;
4
+ };
@@ -0,0 +1,13 @@
1
+ import { TokenInfo } from '../Token';
2
+ export declare type GetAutoSlippage = (options: {
3
+ fromToken: TokenInfo | null;
4
+ toToken: TokenInfo | null;
5
+ }) => Promise<number | undefined> | number | undefined;
6
+ /**
7
+ * Sets the slippage based on the incoming getAutoSlippage method. If there is an interface error or no data is returned, the default data with a lower priority will be used.
8
+ */
9
+ export declare function useSetAutoSlippage({ fromToken, toToken, getAutoSlippage, }: {
10
+ fromToken: TokenInfo | null;
11
+ toToken: TokenInfo | null;
12
+ getAutoSlippage?: GetAutoSlippage;
13
+ }): void;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { WidgetProps } from './components/Widget';
3
3
  export declare type SwapWidgetProps = WidgetProps;
4
+ export type { TokenInfo } from './hooks/Token/type';
4
5
  export declare function SwapWidget(props: SwapWidgetProps): JSX.Element;
5
6
  export declare function InitSwapWidget(props: SwapWidgetProps): void;
@@ -2,3 +2,8 @@ import { AppThunkAction } from '.';
2
2
  import { State } from '../reducers/globals';
3
3
  export declare const setGlobalProps: (globalProps: Partial<State>) => AppThunkAction;
4
4
  export declare const setAutoConnectLoading: (loading: boolean) => AppThunkAction;
5
+ export declare const setAutoSlippage: (autoSlippage: {
6
+ loading: boolean;
7
+ value: number | null;
8
+ }) => AppThunkAction;
9
+ export declare const setAutoSlippageLoading: (loading: boolean) => AppThunkAction;
@@ -12,6 +12,11 @@ export interface State extends SwapWidgetProps {
12
12
  contractStatus?: ContractStatus;
13
13
  autoConnectLoading?: boolean;
14
14
  showCoingecko?: boolean;
15
+ /** source: props.getAutoSlippage */
16
+ autoSlippage?: {
17
+ loading: boolean;
18
+ value: number | null;
19
+ };
15
20
  }
16
21
  export declare const initialState: State;
17
22
  declare const _default: (state: State | undefined, action: AnyAction) => State;
@@ -1,3 +1,7 @@
1
1
  import { RootState } from '../reducers';
2
2
  export declare const getGlobalProps: (state?: RootState) => import("../reducers/globals").State;
3
3
  export declare const getAutoConnectLoading: (state?: RootState) => boolean | undefined;
4
+ export declare const getAutoSlippage: (state?: RootState) => {
5
+ loading: boolean;
6
+ value: number | null;
7
+ } | undefined;