@dodoex/widgets 2.2.1 → 2.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.
Files changed (31) hide show
  1. package/dist/cjs/e2e/constants.d.ts +8 -0
  2. package/dist/cjs/index.cjs +1 -1
  3. package/dist/cjs/locales/en-US.js +1 -1
  4. package/dist/cjs/src/components/Swap/components/Dialog.d.ts +3 -1
  5. package/dist/cjs/src/components/Widget/index.d.ts +3 -3
  6. package/dist/cjs/src/constants/api.d.ts +2 -0
  7. package/dist/cjs/src/hooks/Token/index.d.ts +1 -1
  8. package/dist/cjs/src/hooks/Token/type.d.ts +8 -0
  9. package/dist/cjs/src/hooks/Token/useGetCGTokenList.d.ts +13 -0
  10. package/dist/cjs/src/hooks/Token/useGetTokenStatus.d.ts +1 -1
  11. package/dist/cjs/src/hooks/Token/useInitTokenList.d.ts +2 -2
  12. package/dist/cjs/src/hooks/contract/useFetchBlockNumber.d.ts +3 -1
  13. package/dist/cjs/src/store/reducers/token.d.ts +1 -4
  14. package/dist/cjs/src/utils/address.d.ts +1 -0
  15. package/dist/e2e/constants.d.ts +8 -0
  16. package/dist/index.js +1 -1
  17. package/dist/locales/en-US.js +1 -1
  18. package/dist/src/components/Swap/components/Dialog.d.ts +3 -1
  19. package/dist/src/components/Widget/index.d.ts +3 -3
  20. package/dist/src/constants/api.d.ts +2 -0
  21. package/dist/src/hooks/Token/index.d.ts +1 -1
  22. package/dist/src/hooks/Token/type.d.ts +8 -0
  23. package/dist/src/hooks/Token/useGetCGTokenList.d.ts +13 -0
  24. package/dist/src/hooks/Token/useGetTokenStatus.d.ts +1 -1
  25. package/dist/src/hooks/Token/useInitTokenList.d.ts +2 -2
  26. package/dist/src/hooks/contract/useFetchBlockNumber.d.ts +3 -1
  27. package/dist/src/store/reducers/token.d.ts +1 -4
  28. package/dist/src/utils/address.d.ts +1 -0
  29. package/package.json +9 -10
  30. package/dist/cjs/tokenList-ee5e15c8.cjs +0 -1
  31. package/dist/tokenList-4ef211de.js +0 -1
@@ -1,5 +1,5 @@
1
1
  /*eslint-disable*/
2
2
 
3
- var enUS={messages:{"Additional Fee":"Additional Fee","Additional routing fees set by the Widget user":"Additional routing fees set by the Widget user","Approve":"Approve","Approving":"Approving","Attention: High slippage tolerance will increase the success rate of transaction, but might not get the best quote.":"Attention: High slippage tolerance will increase the success rate of transaction, but might not get the best quote.","Balance:":"Balance:","Basic Fee":"Basic Fee","Close":"Close","Confirm swap":"Confirm swap","Confirming":"Confirming","Connect to a wallet":"Connect to a wallet","Connect to your wallet":"Connect to your wallet","Connect to your {0} Wallet":["Connect to your ",["0"]," Wallet"],"Current price impact":"Current price impact","Dismiss":"Dismiss","Due to the market condition, market price and estimated price may have a slight difference":"Due to the market condition, market price and estimated price may have a slight difference","Enter an amount":"Enter an amount","Enter the token symbol or address":"Enter the token symbol or address","Estimated service provider fees":"Estimated service provider fees","Fetching Price...":"Fetching Price...","Fetching best price...":"Fetching best price...","ForceStop exception":"ForceStop exception","Gas price is too low, please adjust in your wallet and try again":"Gas price is too low, please adjust in your wallet and try again","High slippage tolerance will increase the success rate of transaction, but might not get the best quote.":"High slippage tolerance will increase the success rate of transaction, but might not get the best quote.","If your transaction time exceeds the deadline, your transaction will be rescinded.":"If your transaction time exceeds the deadline, your transaction will be rescinded.","Insufficient balance":"Insufficient balance","Insufficient funds - Please retry after depositing more {EtherTokenSymbol} into your wallet":["Insufficient funds - Please retry after depositing more ",["EtherTokenSymbol"]," into your wallet"],"Max":"Max","Maximum slippage do not exceed 50%":"Maximum slippage do not exceed 50%","No ForceStop access":"No ForceStop access","Powered by DODO protocol":"Powered by DODO protocol","Price Impact":"Price Impact","Price impact exceeds the slippage tolerance you set. Try increasing the slippage tolerance.":"Price impact exceeds the slippage tolerance you set. Try increasing the slippage tolerance.","Price impact reaches <0>{priceImpact}</0>%, accept the quote":["Price impact reaches <0>",["priceImpact"],"</0>%, accept the quote"],"Quote not available":"Quote not available","RPC node data exception":"RPC node data exception","Reset":"Reset","Review Swap":"Review Swap","SELECT TOKEN":"SELECT TOKEN","SafeERC20: low-level call failed. Please log a Zendesk support ticket or contact the DODO team.":"SafeERC20: low-level call failed. Please log a Zendesk support ticket or contact the DODO team.","Select Tokens":"Select Tokens","Select a token":"Select a token","Service update, please wait and try again":"Service update, please wait and try again","Settings":"Settings","Slippage":"Slippage","Slippage Tolerance":"Slippage Tolerance","Something went wrong.":"Something went wrong.","Swap":"Swap","Swap Detail":"Swap Detail","Swap summary":"Swap summary","This CP has been settled by other addrs":"This CP has been settled by other addrs","Transaction Deadline":"Transaction Deadline","Transaction Pending":"Transaction Pending","Transaction Time:":"Transaction Time:","Transaction rejected.":"Transaction rejected.","Tx":"Tx","Unable to SETTLE during the cooling-off period":"Unable to SETTLE during the cooling-off period","Unsupported network - switch to trade":"Unsupported network - switch to trade","User denied transaction signature.":"User denied transaction signature.","View on Etherscan":"View on Etherscan","Wallet incompatibility":"Wallet incompatibility","{0} confirmed":[["0"]," confirmed"],"{0} pending":[["0"]," pending"],"{DEFAULT_SWAP_DDL} minutes":[["DEFAULT_SWAP_DDL"]," minutes"]}};
3
+ var enUS={messages:{"Additional Fee":"Additional Fee","Additional routing fees set by the Widget user":"Additional routing fees set by the Widget user","Approve":"Approve","Approving":"Approving","Attention: High slippage tolerance will increase the success rate of transaction, but might not get the best quote.":"Attention: High slippage tolerance will increase the success rate of transaction, but might not get the best quote.","Balance:":"Balance:","Basic Fee":"Basic Fee","Close":"Close","Confirm swap":"Confirm swap","Confirming":"Confirming","Connect to a wallet":"Connect to a wallet","Connect to your wallet":"Connect to your wallet","Connect to your {0} Wallet":["Connect to your ",["0"]," Wallet"],"Current price impact":"Current price impact","Dismiss":"Dismiss","Due to the market condition, market price and estimated price may have a slight difference":"Due to the market condition, market price and estimated price may have a slight difference","Enter an amount":"Enter an amount","Enter the token symbol or address":"Enter the token symbol or address","Estimated service provider fees":"Estimated service provider fees","Fetching Price...":"Fetching Price...","Fetching best price...":"Fetching best price...","ForceStop exception":"ForceStop exception","Gas price is too low, please adjust in your wallet and try again":"Gas price is too low, please adjust in your wallet and try again","High slippage tolerance will increase the success rate of transaction, but might not get the best quote.":"High slippage tolerance will increase the success rate of transaction, but might not get the best quote.","If your transaction time exceeds the deadline, your transaction will be rescinded.":"If your transaction time exceeds the deadline, your transaction will be rescinded.","Insufficient balance":"Insufficient balance","Insufficient funds - Please retry after depositing more {EtherTokenSymbol} into your wallet":["Insufficient funds - Please retry after depositing more ",["EtherTokenSymbol"]," into your wallet"],"Max":"Max","Maximum slippage do not exceed 50%":"Maximum slippage do not exceed 50%","No ForceStop access":"No ForceStop access","Powered by DODO protocol":"Powered by DODO protocol","Price Impact":"Price Impact","Price impact exceeds the slippage tolerance you set. Try increasing the slippage tolerance.":"Price impact exceeds the slippage tolerance you set. Try increasing the slippage tolerance.","Price impact reaches <0>{priceImpact}</0>%, accept the quote":["Price impact reaches <0>",["priceImpact"],"</0>%, accept the quote"],"Quote not available":"Quote not available","RPC node data exception":"RPC node data exception","Reset":"Reset","Review Swap":"Review Swap","SELECT TOKEN":"SELECT TOKEN","SafeERC20: low-level call failed. Please contact the DODO team.":"SafeERC20: low-level call failed. Please contact the DODO team.","SafeERC20: low-level call failed. Please log a Zendesk support ticket or contact the DODO team.":"SafeERC20: low-level call failed. Please log a Zendesk support ticket or contact the DODO team.","Select Tokens":"Select Tokens","Select a token":"Select a token","Service update, please wait and try again":"Service update, please wait and try again","Settings":"Settings","Slippage":"Slippage","Slippage Tolerance":"Slippage Tolerance","Something went wrong.":"Something went wrong.","Swap":"Swap","Swap Detail":"Swap Detail","Swap summary":"Swap summary","This CP has been settled by other addrs":"This CP has been settled by other addrs","Transaction Deadline":"Transaction Deadline","Transaction Pending":"Transaction Pending","Transaction Time:":"Transaction Time:","Transaction rejected.":"Transaction rejected.","Tx":"Tx","Unable to SETTLE during the cooling-off period":"Unable to SETTLE during the cooling-off period","Unsupported network - switch to trade":"Unsupported network - switch to trade","User denied transaction signature.":"User denied transaction signature.","View on Etherscan":"View on Etherscan","Wallet incompatibility":"Wallet incompatibility","{0} confirmed":[["0"]," confirmed"],"{0} pending":[["0"]," pending"],"{DEFAULT_SWAP_DDL} minutes":[["DEFAULT_SWAP_DDL"]," minutes"]}};
4
4
 
5
5
  export { enUS as default };
@@ -1,7 +1,9 @@
1
1
  /// <reference types="react" />
2
+ export declare const transitionTime = 300;
2
3
  export interface DialogProps {
3
4
  open: boolean;
4
5
  onClose?: () => void;
6
+ afterClose?: () => void;
5
7
  title?: string | React.ReactNode;
6
8
  rightSlot?: React.ReactNode;
7
9
  canBack?: boolean;
@@ -9,4 +11,4 @@ export interface DialogProps {
9
11
  height?: number | string;
10
12
  testId?: string;
11
13
  }
12
- export default function Dialog({ open, onClose, title, rightSlot, canBack, children, height, testId, }: DialogProps): JSX.Element;
14
+ export default function Dialog({ open, onClose, afterClose, title, rightSlot, canBack, children, height, testId, }: DialogProps): JSX.Element;
@@ -5,7 +5,7 @@ import { Web3ConnectorsProps } from '../../hooks/ConnectWallet';
5
5
  import { InitTokenListProps } from '../../hooks/Token/useInitTokenList';
6
6
  import { ExecutionProps } from '../../hooks/Submission';
7
7
  import { ChainId } from '../../constants/chains';
8
- import { TokenInfo } from '../../hooks/Token/type';
8
+ import { DefaultTokenInfo } from '../../hooks/Token/type';
9
9
  export declare const WIDGET_CLASS_NAME = "dodo-widget-container";
10
10
  export interface WidgetProps extends Web3ConnectorsProps, InitTokenListProps, ExecutionProps {
11
11
  apikey: string;
@@ -16,8 +16,8 @@ export interface WidgetProps extends Web3ConnectorsProps, InitTokenListProps, Ex
16
16
  height?: string | number;
17
17
  feeRate?: number;
18
18
  rebateTo?: string;
19
- defaultFromToken?: TokenInfo;
20
- defaultToToken?: TokenInfo;
19
+ defaultFromToken?: DefaultTokenInfo;
20
+ defaultToToken?: DefaultTokenInfo;
21
21
  locale?: SupportedLang;
22
22
  }
23
23
  export declare function Widget(props: PropsWithChildren<WidgetProps>): JSX.Element;
@@ -1,3 +1,5 @@
1
+ import { ChainId } from './chains';
1
2
  export declare const RoutePriceAPI = "https://api.dodoex.io/route-service/v2/widget/getdodoroute";
2
3
  export declare const FiatPriceAPI = "https://api.dodoex.io/price-api";
3
4
  export declare const AppUrl = "https://app.dodoex.io";
5
+ export declare const getCGTokenListAPI: (chainId: ChainId) => any;
@@ -1,4 +1,4 @@
1
1
  export { default as useInitTokenList } from './useInitTokenList';
2
2
  export { default as useFindTokenByAddress } from './useFindTokenByAddress';
3
3
  export { default as useTokenList } from './useTokenList';
4
- export type { TokenList, TokenInfo } from './type';
4
+ export type { TokenList, TokenInfo, DefaultTokenInfo } from './type';
@@ -8,7 +8,15 @@ export interface TokenInfo {
8
8
  readonly tags?: string[];
9
9
  readonly extensions?: any;
10
10
  }
11
+ export interface DefaultTokenInfo extends TokenInfo {
12
+ amount?: number;
13
+ }
11
14
  export declare type TokenList = TokenInfo[];
15
+ export declare enum TokenListType {
16
+ All = "all",
17
+ Default = "default",
18
+ Coingecko = "coingecko"
19
+ }
12
20
  export declare enum ApprovalState {
13
21
  Loading = "Loading",
14
22
  Insufficient = "ApprovalInsufficient",
@@ -0,0 +1,13 @@
1
+ import { List } from 'immutable';
2
+ import { TokenInfo } from './type';
3
+ export declare enum FetchStatus {
4
+ Initial = "Initial",
5
+ Loading = "Loading",
6
+ Failed = "Failed",
7
+ Success = "Success"
8
+ }
9
+ export declare function useGetCGTokenList(): {
10
+ cgTokenList: List<TokenInfo>;
11
+ loading: boolean;
12
+ refetch: () => Promise<void>;
13
+ };
@@ -8,6 +8,6 @@ export declare const useGetTokenStatus: ({ account, chainId, offset, contractAdd
8
8
  }) => {
9
9
  getApprovalState: (token: TokenInfo | null, value: string | number | BigNumber, overrideBalance?: BigNumber) => ApprovalState;
10
10
  getPendingRest: (token?: TokenInfo | null) => boolean;
11
- getMaxBalance: (token: TokenInfo | null) => number;
11
+ getMaxBalance: (token: TokenInfo | null) => string;
12
12
  submitApprove: (token: TokenInfo | null, isReset?: boolean) => Promise<void>;
13
13
  };
@@ -1,6 +1,6 @@
1
- import { TokenList } from './type';
1
+ import { TokenList, TokenListType } from './type';
2
2
  export interface InitTokenListProps {
3
- tokenList?: TokenList;
3
+ tokenList?: TokenList | TokenListType;
4
4
  popularTokenList?: TokenList;
5
5
  }
6
6
  export default function useInitTokenList({ tokenList, popularTokenList: popularTokenListProps, }: InitTokenListProps): void;
@@ -1 +1,3 @@
1
- export default function useFetchBlockNumber(): void;
1
+ export default function useFetchBlockNumber(): {
2
+ updateBlockNumber: () => Promise<void>;
3
+ };
@@ -1,6 +1,6 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  import { AnyAction } from 'redux';
3
- import type { TokenList, TokenInfo } from '../../hooks/Token';
3
+ import type { TokenList, DefaultTokenInfo } from '../../hooks/Token';
4
4
  export declare type AccountBalance = {
5
5
  tokenBalances?: BigNumber;
6
6
  tokenAllowances?: BigNumber;
@@ -12,9 +12,6 @@ export declare type SlippageWithToken = {
12
12
  slippage: string;
13
13
  tokens: string[];
14
14
  };
15
- export interface DefaultTokenInfo extends TokenInfo {
16
- amount?: number;
17
- }
18
15
  export declare type State = {
19
16
  tokenList: TokenList;
20
17
  popularTokenList: TokenList;
@@ -1,5 +1,6 @@
1
1
  export declare const isSameAddress: (tokenAddress1: string, tokenAddress2: string) => boolean;
2
2
  export declare function isAddress(value: any): string | false;
3
+ export declare function isETHAddress(addr: string): boolean;
3
4
  /**
4
5
  * Returns true if the string value is zero in hex
5
6
  * @param hexNumberString
@@ -66,6 +66,14 @@ export declare const routeRes: {
66
66
  totalDuration: number;
67
67
  };
68
68
  };
69
+ export declare const tokenListRes: {
70
+ keywords: string[];
71
+ logoURI: string;
72
+ name: string;
73
+ timestamp: string;
74
+ tokens: never[];
75
+ message: string;
76
+ };
69
77
  export declare const fiatPriceBatchRes: {
70
78
  code: number;
71
79
  data: {