@dodoex/widgets 2.2.0 → 2.2.2-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.
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 +3 -1
  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/store/selectors/token.d.ts +1 -1
  15. package/dist/cjs/src/utils/address.d.ts +1 -0
  16. package/dist/e2e/constants.d.ts +8 -0
  17. package/dist/index.js +1 -1
  18. package/dist/locales/en-US.js +1 -1
  19. package/dist/src/components/Swap/components/Dialog.d.ts +3 -1
  20. package/dist/src/components/Widget/index.d.ts +3 -3
  21. package/dist/src/constants/api.d.ts +3 -1
  22. package/dist/src/hooks/Token/index.d.ts +1 -1
  23. package/dist/src/hooks/Token/type.d.ts +8 -0
  24. package/dist/src/hooks/Token/useGetCGTokenList.d.ts +13 -0
  25. package/dist/src/hooks/Token/useGetTokenStatus.d.ts +1 -1
  26. package/dist/src/hooks/Token/useInitTokenList.d.ts +2 -2
  27. package/dist/src/hooks/contract/useFetchBlockNumber.d.ts +3 -1
  28. package/dist/src/store/reducers/token.d.ts +1 -4
  29. package/dist/src/store/selectors/token.d.ts +1 -1
  30. package/dist/src/utils/address.d.ts +1 -0
  31. package/package.json +9 -10
@@ -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
- export declare const FiatPriceAPI = "https://api.dodoex.io/price-api";
3
+ export declare const FiatPriceAPI = "https://api.dodoex.io/frontend-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,6 +1,6 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  import { ChainId } from '../../constants/chains';
3
- import { DefaultTokenInfo } from '../reducers/token';
3
+ import type { DefaultTokenInfo } from '../../hooks/Token';
4
4
  import { RootState } from '../reducers';
5
5
  export declare const getTokenList: (state?: RootState) => import("../../hooks/Token").TokenList;
6
6
  export declare const getPopularTokenList: (chainId: ChainId, state?: RootState) => import("../../hooks/Token").TokenInfo[];
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dodoex/widgets",
3
- "version": "2.2.0",
3
+ "version": "2.2.2-0",
4
4
  "description": "DODO Widgets",
5
5
  "source": "src/index.tsx",
6
6
  "types": "dist/src/index.d.ts",
@@ -17,12 +17,11 @@
17
17
  "extract:i18": "lingui extract --locale en-US",
18
18
  "compile:i18n": "yarn extract:i18 && lingui compile",
19
19
  "watch": "yarn run rollup -c --watch",
20
- "prebuild": "yarn workspace @dodoex/icons build && yarn workspace @dodoex/components build",
21
- "build": "yarn prebuild && yarn compile:i18n && rollup --config",
22
- "prerelease": "yarn build",
20
+ "build": "yarn compile:i18n && rollup --config",
23
21
  "release": "semantic-release",
24
22
  "release:local": "np --any-branch --no-cleanup --no-tests",
25
- "test": "jest"
23
+ "test": "jest src",
24
+ "test:e2e": "jest e2e"
26
25
  },
27
26
  "author": "",
28
27
  "publishConfig": {
@@ -65,6 +64,8 @@
65
64
  "@lingui/macro": "^3.14.0",
66
65
  "@lingui/react": "^3.14.0",
67
66
  "@reduxjs/toolkit": "^1.6.1",
67
+ "@semantic-release/changelog": "^6.0.1",
68
+ "@semantic-release/git": "^10.0.1",
68
69
  "@walletconnect/ethereum-provider": "^1.8.0",
69
70
  "@walletconnect/jsonrpc-http-connection": "^1.0.3",
70
71
  "@web3-react/core": "8.0.35-beta.0",
@@ -72,15 +73,13 @@
72
73
  "@web3-react/metamask": "8.0.28-beta.0",
73
74
  "@web3-react/types": "8.0.20-beta.0",
74
75
  "@web3-react/walletconnect": "8.0.35-beta.0",
75
- "@semantic-release/changelog": "^6.0.1",
76
- "@semantic-release/git": "^10.0.1",
77
- "semantic-release": "^19.0.2",
78
76
  "axios": "^0.27.2",
79
77
  "bignumber.js": "^9.0.2",
80
78
  "identicon.js": "^2.3.3",
81
79
  "lodash": "^4.17.21",
82
80
  "make-plural": "^7.0.0",
83
- "react-window": "^1.8.7"
81
+ "react-window": "^1.8.8",
82
+ "semantic-release": "^19.0.2"
84
83
  },
85
84
  "peerDependencies": {
86
85
  "@babel/runtime": ">=7.17.0",
@@ -117,7 +116,7 @@
117
116
  "hardhat": "^2.11.2",
118
117
  "identity-obj-proxy": "^3.0.0",
119
118
  "jest": "^29.0.3",
120
- "jest-environment-hardhat": "^1.1.8",
119
+ "jest-environment-hardhat": "^1.1.9",
121
120
  "jest-environment-jsdom": "^29.0.3",
122
121
  "np": "^7.6.1",
123
122
  "rollup": "^2.75.5",