@dodoex/widgets 2.6.12-beta.2 → 2.6.12-beta.4

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 (85) hide show
  1. package/dist/cjs/helper-C5SrJQaK.cjs +1 -0
  2. package/dist/cjs/helper-DL8TMEkQ.cjs +1 -0
  3. package/dist/cjs/helper-DNaeIBQY.cjs +1 -0
  4. package/dist/cjs/index-BZtt1iuv.cjs +12 -0
  5. package/dist/cjs/index-BeGs2DH_.cjs +78 -0
  6. package/dist/cjs/index-BwnUmGDp.cjs +53 -0
  7. package/dist/cjs/index-CULtuKOC.cjs +78 -0
  8. package/dist/cjs/index-DTCQ7g1k.cjs +12 -0
  9. package/dist/cjs/index-DUQ8hOW2.cjs +78 -0
  10. package/dist/cjs/index-DWLX0NSs.cjs +53 -0
  11. package/dist/cjs/index-DoCc2JCv.cjs +53 -0
  12. package/dist/cjs/index-DsNlidLA.cjs +12 -0
  13. package/dist/cjs/index.cjs +7 -7
  14. package/dist/cjs/locales/en-US.js +1 -1
  15. package/dist/cjs/locales/zh-CN.js +1 -1
  16. package/dist/cjs/lottie-4VzKv4A8.cjs +1 -0
  17. package/dist/cjs/lottie-DLvPIL-h.cjs +1 -0
  18. package/dist/cjs/lottie-TilCy8UF.cjs +1 -0
  19. package/dist/cjs/src/components/Bridge/BridgeSummaryDialog/index.d.ts +1 -1
  20. package/dist/cjs/src/components/Bridge/SelectBridgeDialog/RouteCard.d.ts +2 -2
  21. package/dist/cjs/src/components/Swap/components/ConnectWallet/index.d.ts +2 -1
  22. package/dist/cjs/src/components/Widget/index.d.ts +2 -0
  23. package/dist/cjs/src/constants/tokenList.d.ts +11 -2
  24. package/dist/cjs/src/hooks/Bridge/createBridgeOrder.d.ts +1 -1
  25. package/dist/cjs/src/hooks/Bridge/useExecuteBridgeRoute.d.ts +3 -1
  26. package/dist/cjs/src/hooks/Bridge/useFetchRoutePriceBridge.d.ts +23 -6
  27. package/dist/cjs/src/hooks/ConnectWallet/TonConnect/contract.d.ts +8 -0
  28. package/dist/cjs/src/hooks/ConnectWallet/useWalletState.d.ts +4 -0
  29. package/dist/cjs/src/hooks/Submission/types.d.ts +14 -0
  30. package/dist/cjs/src/hooks/Submission/useExecution.d.ts +14 -0
  31. package/dist/cjs/src/hooks/Swap/usePriceTimer.d.ts +1 -0
  32. package/dist/cjs/src/hooks/Token/type.d.ts +1 -0
  33. package/dist/cjs/src/hooks/Token/useGetTokenStatus.d.ts +2 -1
  34. package/dist/cjs/src/hooks/contract/abis/OrbiterV3ABI.d.ts +85 -0
  35. package/dist/cjs/src/hooks/contract/layerswap/constants.d.ts +6 -0
  36. package/dist/cjs/src/hooks/contract/layerswap/data.d.ts +41 -0
  37. package/dist/cjs/src/hooks/contract/layerswap/types.d.ts +170 -0
  38. package/dist/cjs/src/hooks/contract/layerswap/useLayerswapRouters.d.ts +20 -0
  39. package/dist/cjs/src/hooks/contract/orbiter/constants.d.ts +3 -0
  40. package/dist/cjs/src/hooks/contract/orbiter/encodeOrbiterBridge.d.ts +12 -0
  41. package/dist/cjs/src/hooks/contract/orbiter/useOrbiterContractMap.d.ts +5 -0
  42. package/dist/cjs/src/hooks/contract/orbiter/useOrbiterRouters.d.ts +21 -0
  43. package/dist/helper-CHqZavUq.js +1 -0
  44. package/dist/helper-D1mp2p4F.js +1 -0
  45. package/dist/helper-Dhy5gy1p.js +1 -0
  46. package/dist/index-0IX6JBNg.js +12 -0
  47. package/dist/index-BgcusTMt.js +78 -0
  48. package/dist/index-BlT57eKb.js +53 -0
  49. package/dist/index-CE6izMXy.js +12 -0
  50. package/dist/index-CEwSZbo5.js +53 -0
  51. package/dist/index-CTxzesqs.js +53 -0
  52. package/dist/index-D0SWY6AZ.js +12 -0
  53. package/dist/index-Duga8SDh.js +78 -0
  54. package/dist/index-DxNt17fy.js +78 -0
  55. package/dist/index.js +7 -7
  56. package/dist/locales/en-US.js +1 -1
  57. package/dist/locales/zh-CN.js +1 -1
  58. package/dist/lottie-B77ifW0u.js +1 -0
  59. package/dist/lottie-C9cpjlCR.js +1 -0
  60. package/dist/lottie-DMZ5X1eY.js +1 -0
  61. package/dist/src/components/Bridge/BridgeSummaryDialog/index.d.ts +1 -1
  62. package/dist/src/components/Bridge/SelectBridgeDialog/RouteCard.d.ts +2 -2
  63. package/dist/src/components/Swap/components/ConnectWallet/index.d.ts +2 -1
  64. package/dist/src/components/Widget/index.d.ts +2 -0
  65. package/dist/src/constants/tokenList.d.ts +11 -2
  66. package/dist/src/hooks/Bridge/createBridgeOrder.d.ts +1 -1
  67. package/dist/src/hooks/Bridge/useExecuteBridgeRoute.d.ts +3 -1
  68. package/dist/src/hooks/Bridge/useFetchRoutePriceBridge.d.ts +23 -6
  69. package/dist/src/hooks/ConnectWallet/TonConnect/contract.d.ts +8 -0
  70. package/dist/src/hooks/ConnectWallet/useWalletState.d.ts +4 -0
  71. package/dist/src/hooks/Submission/types.d.ts +14 -0
  72. package/dist/src/hooks/Submission/useExecution.d.ts +14 -0
  73. package/dist/src/hooks/Swap/usePriceTimer.d.ts +1 -0
  74. package/dist/src/hooks/Token/type.d.ts +1 -0
  75. package/dist/src/hooks/Token/useGetTokenStatus.d.ts +2 -1
  76. package/dist/src/hooks/contract/abis/OrbiterV3ABI.d.ts +85 -0
  77. package/dist/src/hooks/contract/layerswap/constants.d.ts +6 -0
  78. package/dist/src/hooks/contract/layerswap/data.d.ts +41 -0
  79. package/dist/src/hooks/contract/layerswap/types.d.ts +170 -0
  80. package/dist/src/hooks/contract/layerswap/useLayerswapRouters.d.ts +20 -0
  81. package/dist/src/hooks/contract/orbiter/constants.d.ts +3 -0
  82. package/dist/src/hooks/contract/orbiter/encodeOrbiterBridge.d.ts +12 -0
  83. package/dist/src/hooks/contract/orbiter/useOrbiterContractMap.d.ts +5 -0
  84. package/dist/src/hooks/contract/orbiter/useOrbiterRouters.d.ts +21 -0
  85. package/package.json +3 -1
@@ -6,7 +6,7 @@ export interface BridgeTXRequest {
6
6
  value: string;
7
7
  from: string;
8
8
  chainId: number;
9
- encodeId: string;
9
+ encodeId?: string;
10
10
  }
11
11
  export default function BridgeSummaryDialog({ open, onClose, route, bridgeOrderTxRequest, clearToAmt, clearFromAmt, }: {
12
12
  open: boolean;
@@ -10,12 +10,12 @@ export default function RouteCard({ fromToken, toToken, fromChainId, toChainId,
10
10
  fromAmount?: BridgeRouteI['fromAmount'];
11
11
  fromTokenBalance: BigNumber | null;
12
12
  toTokenAmount?: BigNumber | null;
13
- toolDetails: BridgeRouteI['step']['toolDetails'];
13
+ toolDetails: undefined | Exclude<BridgeRouteI['step'], undefined>['toolDetails'];
14
14
  product: BridgeRouteI['product'];
15
15
  executionDuration: BridgeRouteI['executionDuration'];
16
16
  feeUSD: BridgeRouteI['feeUSD'];
17
17
  selected: boolean;
18
18
  setSelected: () => void;
19
- spenderContractAddress: string;
19
+ spenderContractAddress: string | undefined;
20
20
  isBestPrice?: boolean;
21
21
  }): JSX.Element;
@@ -4,5 +4,6 @@ export interface ConnectWalletProps {
4
4
  needSwitchChain?: ChainId;
5
5
  /** If true is returned, the default wallet connection logic will not be executed */
6
6
  onConnectWalletClick?: () => boolean | Promise<boolean>;
7
+ needConnectTwoWallet?: boolean;
7
8
  }
8
- export default function ConnectWallet({ needSwitchChain, onConnectWalletClick, }: ConnectWalletProps): JSX.Element;
9
+ export default function ConnectWallet({ needSwitchChain, onConnectWalletClick, needConnectTwoWallet, }: ConnectWalletProps): JSX.Element;
@@ -8,7 +8,9 @@ import { ChainId } from '../../constants/chains';
8
8
  import { DefaultTokenInfo } from '../../hooks/Token/type';
9
9
  import { APIServices } from '../../constants/api';
10
10
  import { SwapProps } from '../Swap';
11
+ import { QueryClient } from '@tanstack/react-query';
11
12
  export declare const WIDGET_CLASS_NAME = "dodo-widget-container";
13
+ export declare const queryClient: QueryClient;
12
14
  export interface WidgetProps extends Web3ConnectorsProps, InitTokenListProps, ExecutionProps, SwapProps {
13
15
  apikey?: string;
14
16
  theme?: ThemeOptions;
@@ -1,9 +1,18 @@
1
- declare const _default: {
1
+ declare const _default: ({
2
2
  chainId: number;
3
3
  address: string;
4
4
  name: string;
5
5
  decimals: number;
6
6
  symbol: string;
7
7
  logoURI: string;
8
- }[];
8
+ canBridgeToTon?: undefined;
9
+ } | {
10
+ chainId: number;
11
+ address: string;
12
+ name: string;
13
+ decimals: number;
14
+ symbol: string;
15
+ logoURI: string;
16
+ canBridgeToTon: boolean;
17
+ })[];
9
18
  export default _default;
@@ -12,7 +12,7 @@ export interface BridgeOrderCreateParams {
12
12
  hash: string;
13
13
  product: string | null;
14
14
  extend: {
15
- lifiBridge: BridgeRouteI['sourceRoute']['step']['tool'];
15
+ lifiBridge: Exclude<BridgeRouteI['sourceRoute'], undefined>['step']['tool'];
16
16
  route: BridgeRouteI['sourceRoute'];
17
17
  productParams: BridgeRouteI['productParams'];
18
18
  encodeId: string;
@@ -1,6 +1,8 @@
1
1
  import { BridgeTXRequest } from '../../components/Bridge/BridgeSummaryDialog';
2
2
  import { BridgeRouteI } from './useFetchRoutePriceBridge';
3
- export default function useExecuteBridgeRoute({ route, bridgeOrderTxRequest, }: {
3
+ import { ExecutionCtx } from '../Submission/types';
4
+ export default function useExecuteBridgeRoute({ route, bridgeOrderTxRequest, sendData, }: {
4
5
  route?: BridgeRouteI;
5
6
  bridgeOrderTxRequest?: BridgeTXRequest;
7
+ sendData?: Parameters<ExecutionCtx['executeCustom']>['0']['handler'];
6
8
  }): () => Promise<import("../Submission/types").ExecutionResult> | undefined;
@@ -1,5 +1,6 @@
1
1
  import { TokenInfo } from '../Token';
2
2
  import BigNumber from 'bignumber.js';
3
+ import { ExecutionCtx } from '../Submission/types';
3
4
  export interface BridgeRouteI {
4
5
  /** update */
5
6
  key: string;
@@ -17,20 +18,29 @@ export interface BridgeRouteI {
17
18
  toAddress: string;
18
19
  /** from parameter */
19
20
  product: string | null;
20
- slippage: number;
21
+ slippage?: number;
21
22
  /** in seconds */
22
23
  roundedRouteCostTime: number;
23
24
  /** approve contract address */
24
- spenderContractAddress: string;
25
+ spenderContractAddress?: string;
25
26
  /** USD */
26
27
  feeUSD: string | null;
27
28
  /** in seconds */
28
29
  executionDuration: number | null;
29
30
  /** one-click */
30
31
  step: BridgeStep;
31
- encodeParams: any;
32
+ encodeParams?: any;
33
+ encodeResultData?: {
34
+ data: string;
35
+ to: string;
36
+ value: string;
37
+ from: string;
38
+ chainId: number;
39
+ encodeId?: string;
40
+ };
41
+ sendData?: Parameters<ExecutionCtx['executeCustom']>['0']['handler'];
32
42
  productParams: any;
33
- sourceRoute: {
43
+ sourceRoute?: {
34
44
  toAmount: string;
35
45
  feeUSD: string | null;
36
46
  executionDuration: number | null;
@@ -47,6 +57,8 @@ export interface BridgeRouteI {
47
57
  };
48
58
  fee: any;
49
59
  };
60
+ minAmt?: string;
61
+ maxAmt?: string;
50
62
  }
51
63
  export interface BridgeTokenI {
52
64
  id: number;
@@ -73,7 +85,7 @@ export interface BridgeStep {
73
85
  tool: string;
74
86
  toolDetails: BridgeStepTool;
75
87
  type: string | null;
76
- includedSteps: Array<{
88
+ includedSteps?: Array<{
77
89
  id: string;
78
90
  /**
79
91
  * bridge or swap
@@ -94,9 +106,14 @@ export interface FetchRoutePrice {
94
106
  fromToken: TokenInfo | null;
95
107
  toToken: TokenInfo | null;
96
108
  fromAmount: string;
109
+ fromFiatPrice: string;
97
110
  }
98
- export declare function useFetchRoutePriceBridge({ toToken, fromToken, fromAmount, }: FetchRoutePrice): {
111
+ export declare function useFetchRoutePriceBridge({ toToken, fromToken, fromAmount, fromFiatPrice, }: FetchRoutePrice): {
99
112
  status: RoutePriceStatus;
100
113
  refetch: () => Promise<void>;
101
114
  bridgeRouteList: BridgeRouteI[];
115
+ limit: {
116
+ minAmt?: number | undefined;
117
+ maxAmt?: number | undefined;
118
+ } | null;
102
119
  };
@@ -0,0 +1,8 @@
1
+ import { TonClient, Transaction } from 'ton';
2
+ export declare function getHashByBoc(boc: string): string;
3
+ export declare const waitForTransaction: (options: {
4
+ boc: string;
5
+ refetchInterval?: number;
6
+ refetchLimit?: number;
7
+ address: string;
8
+ }, client: TonClient) => Promise<Transaction | null>;
@@ -5,6 +5,8 @@ export declare function useWalletState({ isTon, }?: {
5
5
  isTon: boolean;
6
6
  chainId: number | undefined;
7
7
  account: string | undefined;
8
+ tonAccount: string | undefined;
9
+ evmAccount: string | undefined;
8
10
  isMetamask: boolean;
9
11
  autoConnect: (chainId?: number) => Promise<void>;
10
12
  connect: () => Promise<void>;
@@ -15,6 +17,8 @@ export declare function useWalletState({ isTon, }?: {
15
17
  isTon: boolean;
16
18
  chainId: number | undefined;
17
19
  account: string | undefined;
20
+ tonAccount: string | undefined;
21
+ evmAccount: string | undefined;
18
22
  isMetamask: boolean | undefined;
19
23
  autoConnect: (chainId?: number) => Promise<void>;
20
24
  connect: () => void | Promise<void>;
@@ -37,6 +37,20 @@ export declare type ExecutionCtx = {
37
37
  * @param submittedConfirmBack: dismiss callback
38
38
  */
39
39
  execute: (brief: string, spec: StepSpec, subtitle?: string | React.ReactNode | null, early?: boolean, submittedBack?: () => void, mixpanelProps?: Record<string, any>, submittedConfirmBack?: () => void, successBack?: (tx: string, callback?: ExecutionProps['onTxSuccess']) => void) => Promise<ExecutionResult>;
40
+ executeCustom: ({ brief, subtitle, early, mixpanelProps, submittedBack, submittedConfirmBack, successBack, handler, }: {
41
+ brief: string;
42
+ subtitle?: string | React.ReactNode | null;
43
+ early?: boolean | undefined;
44
+ mixpanelProps?: Record<string, any> | undefined;
45
+ submittedBack?: (() => void) | undefined;
46
+ submittedConfirmBack?: (() => void) | undefined;
47
+ successBack?: ((tx: string, callback?: ExecutionProps['onTxSuccess']) => void) | undefined;
48
+ handler: (params: {
49
+ onSubmit?: (tx: string, reportInfo?: Record<string, any>) => void;
50
+ onSuccess?: (tx: string, reportInfo?: Record<string, any>) => Promise<void>;
51
+ onError?: (e: any) => void;
52
+ }) => Promise<any>;
53
+ }) => Promise<ExecutionResult>;
40
54
  /**
41
55
  * order
42
56
  */
@@ -23,6 +23,20 @@ export default function useExecution({ onTxFail, onTxSubmit, onTxSuccess, }?: Ex
23
23
  closeShowing: () => void;
24
24
  ctxVal: {
25
25
  execute: (brief: string, spec: StepSpec, subtitle?: string | React.ReactNode | null, early?: boolean, submittedBack?: () => void, mixpanelProps?: Record<string, any>, submittedConfirmBack?: () => void, successBack?: ((tx: string, callback?: ExecutionProps['onTxSuccess']) => void) | undefined) => Promise<ExecutionResult.Failed | ExecutionResult.Success | ExecutionResult.Submitted>;
26
+ executeCustom: ({ brief, subtitle, early, mixpanelProps, submittedBack, submittedConfirmBack, successBack, handler, }: {
27
+ brief: string;
28
+ subtitle?: string | React.ReactNode | null;
29
+ early?: boolean | undefined;
30
+ mixpanelProps?: Record<string, any> | undefined;
31
+ submittedBack?: (() => void) | undefined;
32
+ submittedConfirmBack?: (() => void) | undefined;
33
+ successBack?: ((tx: string, callback?: ExecutionProps['onTxSuccess']) => void) | undefined;
34
+ handler: (params: {
35
+ onSubmit?: ((tx: string, reportInfo?: Record<string, any>) => void) | undefined;
36
+ onSuccess?: ((tx: string, reportInfo?: Record<string, any>) => Promise<void>) | undefined;
37
+ onError?: ((e: any) => void) | undefined;
38
+ }) => Promise<any>;
39
+ }) => Promise<ExecutionResult>;
26
40
  requests: Map<string, [Request, State]>;
27
41
  setShowing: import("react").Dispatch<import("react").SetStateAction<Showing | null>>;
28
42
  waitingSubmit: boolean;
@@ -1,3 +1,4 @@
1
+ export declare const refreshTime: number;
1
2
  export interface PriceTimerProps {
2
3
  refetch: () => void;
3
4
  interval?: number;
@@ -8,6 +8,7 @@ export interface TokenInfo {
8
8
  readonly tags?: string[];
9
9
  readonly extensions?: any;
10
10
  readonly side?: 'from' | 'to';
11
+ readonly canBridgeToTon?: boolean;
11
12
  }
12
13
  export interface DefaultTokenInfo extends TokenInfo {
13
14
  amount?: number;
@@ -1,10 +1,11 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  import { TokenInfo, ApprovalState } from './type';
3
- export declare const useGetTokenStatus: ({ account, chainId, offset, contractAddress, }: {
3
+ export declare const useGetTokenStatus: ({ account, chainId, offset, contractAddress, skip, }: {
4
4
  account?: string | undefined;
5
5
  chainId: number | undefined;
6
6
  offset?: BigNumber | undefined;
7
7
  contractAddress?: string | undefined;
8
+ skip?: boolean | undefined;
8
9
  }) => {
9
10
  getApprovalState: (token: TokenInfo | null, value: string | number | BigNumber, overrideBalance?: BigNumber) => ApprovalState;
10
11
  getPendingRest: (token?: TokenInfo | null) => boolean;
@@ -0,0 +1,85 @@
1
+ declare const Orbiter_V3_ABI_EVM: ({
2
+ anonymous: boolean;
3
+ inputs: {
4
+ indexed: boolean;
5
+ internalType: string;
6
+ name: string;
7
+ type: string;
8
+ }[];
9
+ name: string;
10
+ type: string;
11
+ outputs?: undefined;
12
+ stateMutability?: undefined;
13
+ } | {
14
+ inputs: {
15
+ internalType: string;
16
+ name: string;
17
+ type: string;
18
+ }[];
19
+ name: string;
20
+ outputs: never[];
21
+ stateMutability: string;
22
+ type: string;
23
+ anonymous?: undefined;
24
+ })[];
25
+ declare const Orbiter_V3_ABI_STARKNET_GOERLI: ({
26
+ members: {
27
+ name: string;
28
+ offset: number;
29
+ type: string;
30
+ }[];
31
+ name: string;
32
+ size: number;
33
+ type: string;
34
+ inputs?: undefined;
35
+ outputs?: undefined;
36
+ } | {
37
+ inputs: {
38
+ name: string;
39
+ type: string;
40
+ }[];
41
+ name: string;
42
+ outputs: never[];
43
+ type: string;
44
+ members?: undefined;
45
+ size?: undefined;
46
+ })[];
47
+ declare const Orbiter_V3_ABI_STARKNET: ({
48
+ members: {
49
+ name: string;
50
+ offset: number;
51
+ type: string;
52
+ }[];
53
+ name: string;
54
+ size: number;
55
+ type: string;
56
+ data?: undefined;
57
+ keys?: undefined;
58
+ inputs?: undefined;
59
+ outputs?: undefined;
60
+ } | {
61
+ data: {
62
+ name: string;
63
+ type: string;
64
+ }[];
65
+ keys: never[];
66
+ name: string;
67
+ type: string;
68
+ members?: undefined;
69
+ size?: undefined;
70
+ inputs?: undefined;
71
+ outputs?: undefined;
72
+ } | {
73
+ inputs: {
74
+ name: string;
75
+ type: string;
76
+ }[];
77
+ name: string;
78
+ outputs: never[];
79
+ type: string;
80
+ members?: undefined;
81
+ size?: undefined;
82
+ data?: undefined;
83
+ keys?: undefined;
84
+ })[];
85
+ export { Orbiter_V3_ABI_EVM, Orbiter_V3_ABI_STARKNET, Orbiter_V3_ABI_STARKNET_GOERLI, };
@@ -0,0 +1,6 @@
1
+ export declare const LAYERSWAP_URL = "https://api.layerswap.io/api/v2";
2
+ export declare const LAYERSWAP_API_KEY = "gNiGVhOddxMmWk4LFCR/5tDsdTECWCRlQBcW6yV8l+paqSVJBUth0wDXqA0jC16cv+Pz54+YeeKo54ioiR4n9Q";
3
+ export declare const LAYERSWAP_NETWORKS_URL: string;
4
+ export declare const LAYERSWAP_LIMITS_URL: string;
5
+ export declare const LAYERSWAP_QUOTE_URL: string;
6
+ export declare const LAYERSWAP_SWAPS_URL: string;
@@ -0,0 +1,41 @@
1
+ import { TokenInfo } from '../../Token';
2
+ import { Network, Quote } from './types';
3
+ export declare function getLayerSwapData<T>(url: string): Promise<T>;
4
+ export declare function getNetworks(): Promise<Network[]>;
5
+ export declare function getLimits({ fromToken, toToken, fromNetworkName, toNetworkName, }: {
6
+ fromToken: TokenInfo | null;
7
+ toToken: TokenInfo | null;
8
+ fromNetworkName: string | undefined | null;
9
+ toNetworkName: string | undefined | null;
10
+ }): Promise<{
11
+ min_amount_in_usd: number;
12
+ min_amount: number;
13
+ max_amount_in_usd: number;
14
+ max_amount: number;
15
+ } | undefined>;
16
+ export declare function getQuote({ fromToken, toToken, fromNetworkName, toNetworkName, slippage, fromAmount, }: {
17
+ fromToken: TokenInfo | null;
18
+ toToken: TokenInfo | null;
19
+ fromNetworkName: string | undefined | null;
20
+ toNetworkName: string | undefined | null;
21
+ slippage: number;
22
+ fromAmount: string;
23
+ }): Promise<Quote | undefined>;
24
+ /**
25
+ * @see https://github.com/layerswap/layerswapapp/blob/dev/components/Swap/Withdraw/Wallet/TonWalletWithdraw.tsx
26
+ */
27
+ export declare function submitTonWalletWithdraw({ fromAddress, toAddress, fromToken, toToken, fromNetworkName, toNetworkName, fromAmount, slippage, params, }: {
28
+ fromAddress: string | undefined;
29
+ toAddress: string | undefined;
30
+ fromToken: TokenInfo | null;
31
+ toToken: TokenInfo | null;
32
+ fromNetworkName: string | undefined | null;
33
+ toNetworkName: string | undefined | null;
34
+ fromAmount: string;
35
+ slippage?: number;
36
+ params: {
37
+ onSubmit?: (tx: string, reportInfo?: Record<string, any>) => void;
38
+ onSuccess?: (tx: string, reportInfo?: Record<string, any>) => Promise<void>;
39
+ onError?: (e: any) => void;
40
+ };
41
+ }): Promise<import("ton").Transaction | null | undefined>;
@@ -0,0 +1,170 @@
1
+ export declare enum NetworkType {
2
+ EVM = "evm",
3
+ Starknet = "starknet",
4
+ Solana = "solana",
5
+ Cosmos = "cosmos",
6
+ StarkEx = "starkex",
7
+ ZkSyncLite = "zksynclite",
8
+ TON = "ton"
9
+ }
10
+ export interface Token {
11
+ symbol: string;
12
+ logo: string;
13
+ contract: string | null | undefined;
14
+ decimals: number;
15
+ price_in_usd: number;
16
+ precision: number;
17
+ listing_date: string;
18
+ status?: 'active' | 'inactive' | 'not_found';
19
+ }
20
+ export interface Metadata {
21
+ evm_oracle_contract?: `0x${string}` | null;
22
+ evm_multicall_contract?: string | null;
23
+ listing_date: string;
24
+ }
25
+ export interface Network {
26
+ name: string;
27
+ display_name: string;
28
+ logo: string;
29
+ chain_id: string | null;
30
+ node_url: string;
31
+ type: NetworkType;
32
+ transaction_explorer_template: string;
33
+ account_explorer_template: string;
34
+ metadata: Metadata;
35
+ deposit_methods: string[];
36
+ token?: Token;
37
+ }
38
+ export interface Exchange {
39
+ display_name: string;
40
+ name: string;
41
+ logo: string;
42
+ token_groups: ExchangeToken[];
43
+ metadata: {
44
+ o_auth: {
45
+ connect_url: string;
46
+ authorize_url: string;
47
+ } | null;
48
+ };
49
+ }
50
+ export interface ExchangeNetwork {
51
+ token: Token;
52
+ network: Network;
53
+ fee: {
54
+ total_fee: number;
55
+ total_fee_in_usd: number;
56
+ };
57
+ }
58
+ export interface ExchangeToken {
59
+ symbol: string;
60
+ logo: string;
61
+ status: 'active' | 'inactive' | 'not_found';
62
+ }
63
+ export declare enum SwapStatus {
64
+ Created = "created",
65
+ UserTransferPending = "user_transfer_pending",
66
+ UserTransferDelayed = "user_transfer_delayed",
67
+ LsTransferPending = "ls_transfer_pending",
68
+ Completed = "completed",
69
+ Failed = "failed",
70
+ Expired = "expired",
71
+ Cancelled = "cancelled"
72
+ }
73
+ export declare enum TransactionType {
74
+ Input = "input",
75
+ Output = "output",
76
+ Refuel = "refuel"
77
+ }
78
+ export declare enum BackendTransactionStatus {
79
+ Completed = "completed",
80
+ Failed = "failed",
81
+ Initiated = "initiated",
82
+ Pending = "pending"
83
+ }
84
+ export declare type Transaction = {
85
+ type: TransactionType;
86
+ from: string;
87
+ to: string;
88
+ created_date: string;
89
+ amount: number;
90
+ transaction_hash: string;
91
+ confirmations: number;
92
+ max_confirmations: number;
93
+ usd_value: number;
94
+ usd_price: number;
95
+ status: BackendTransactionStatus;
96
+ timestamp?: string;
97
+ };
98
+ export declare type SwapItem = {
99
+ id: string;
100
+ created_date: string;
101
+ source_network: Network;
102
+ source_token: Token;
103
+ source_exchange?: Exchange;
104
+ destination_network: Network;
105
+ destination_token: Token;
106
+ destination_exchange?: Exchange;
107
+ status: SwapStatus;
108
+ source_address: `0x${string}`;
109
+ destination_address: `0x${string}`;
110
+ requested_amount: number;
111
+ use_deposit_address: boolean;
112
+ transactions: Transaction[];
113
+ exchange_account_connected: boolean;
114
+ exchange_account_name?: string;
115
+ fail_reason?: string;
116
+ metadata: {
117
+ reference_id: string | null;
118
+ app: string | null;
119
+ sequence_number: number;
120
+ };
121
+ };
122
+ export declare type SwapQuote = {
123
+ source_network?: Network;
124
+ source_token?: Token;
125
+ destination_network?: Network;
126
+ destination_token?: Token;
127
+ receive_amount: number;
128
+ min_receive_amount: number;
129
+ total_fee: number;
130
+ total_fee_in_usd: number;
131
+ blockchain_fee: number;
132
+ service_fee: number;
133
+ avg_completion_time: string;
134
+ refuel_in_source?: number;
135
+ slippage?: number;
136
+ };
137
+ export declare type Refuel = {
138
+ network: Network;
139
+ token: Token;
140
+ amount: number;
141
+ amount_in_usd: number;
142
+ };
143
+ export declare type SwapResponse = {
144
+ swap: SwapItem;
145
+ quote: SwapQuote;
146
+ refuel?: Refuel;
147
+ };
148
+ export declare type DepositAction = {
149
+ amount: number;
150
+ amount_in_base_units: string;
151
+ call_data: `0x${string}` | string;
152
+ fee: any | null;
153
+ network: Network;
154
+ order: number;
155
+ to_address?: `0x${string}`;
156
+ token: Token;
157
+ fee_token: Token;
158
+ type: 'transfer' | 'manual_transfer';
159
+ };
160
+ export declare type QuoteReward = {
161
+ amount: number;
162
+ amount_in_usd: number;
163
+ token: Token;
164
+ network: Network;
165
+ };
166
+ export declare type Quote = {
167
+ quote: SwapQuote;
168
+ refuel: Refuel;
169
+ reward: QuoteReward;
170
+ };
@@ -0,0 +1,20 @@
1
+ import { BridgeRouteI, RoutePriceStatus } from '../../Bridge/useFetchRoutePriceBridge';
2
+ import { TokenInfo } from '../../Token';
3
+ export declare function useLayerswapRouters({ skip, data: { fromToken, toToken, fromAmount, evmAccount, tonAccount, slippage }, }: {
4
+ skip?: boolean;
5
+ data: {
6
+ fromToken: TokenInfo | null;
7
+ toToken: TokenInfo | null;
8
+ fromAmount: string;
9
+ evmAccount: string | undefined;
10
+ tonAccount: string | undefined;
11
+ slippage: number;
12
+ };
13
+ }): {
14
+ status: RoutePriceStatus;
15
+ router: BridgeRouteI | null;
16
+ limit: {
17
+ minAmt: number;
18
+ maxAmt: number;
19
+ } | null;
20
+ };
@@ -0,0 +1,3 @@
1
+ export declare const ORBITER_SDK_URL = "https://api.orbiter.finance/sdk";
2
+ export declare const ORBITER_ROUTERS_URL: string;
3
+ export declare const ORBITER_CHAINS_URL: string;
@@ -0,0 +1,12 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { BridgeRouteI } from '../../Bridge';
3
+ import { TokenInfo } from '../../Token';
4
+ import { useOrbiterRouters } from './useOrbiterRouters';
5
+ export declare function encodeOrbiterBridge({ route, fromAddress, toAddress, fromAmount, fromToken, contractAddress, }: {
6
+ route: Exclude<ReturnType<typeof useOrbiterRouters>['data'], undefined>[0];
7
+ fromAddress: string;
8
+ toAddress: string;
9
+ fromAmount: BigNumber;
10
+ fromToken: TokenInfo;
11
+ contractAddress: string;
12
+ }): Exclude<BridgeRouteI['encodeResultData'], undefined>;
@@ -0,0 +1,5 @@
1
+ export declare function useOrbiterContractMap({ skip }?: {
2
+ skip?: boolean;
3
+ }): import("@tanstack/react-query/build/legacy/types").UseQueryResult<{
4
+ bridgeContractMap: Map<number, string>;
5
+ }, Error>;
@@ -0,0 +1,21 @@
1
+ import { ChainId } from '../../../constants/chains';
2
+ interface OrbiterRoute {
3
+ key: string;
4
+ id: string;
5
+ fromChainId: ChainId;
6
+ toChainId: ChainId;
7
+ fromTokenAddress: string;
8
+ toTokenAddress: string;
9
+ product: string;
10
+ endpoint: string;
11
+ minAmt: string;
12
+ maxAmt: string;
13
+ withholdingFee: string;
14
+ tradeFee: string;
15
+ spentTime: string;
16
+ vc: string;
17
+ }
18
+ export declare function useOrbiterRouters({ skip }?: {
19
+ skip?: boolean;
20
+ }): import("@tanstack/react-query/build/legacy/types").UseQueryResult<OrbiterRoute[], Error>;
21
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dodoex/widgets",
3
- "version": "2.6.12-beta.2",
3
+ "version": "2.6.12-beta.4",
4
4
  "description": "DODO Widgets",
5
5
  "source": "src/index.tsx",
6
6
  "types": "dist/src/index.d.ts",
@@ -70,6 +70,7 @@
70
70
  "@reduxjs/toolkit": "^1.6.1",
71
71
  "@semantic-release/changelog": "^6.0.1",
72
72
  "@semantic-release/git": "^10.0.1",
73
+ "@tanstack/react-query": "^5.51.23",
73
74
  "@tonconnect/ui": "^2.0.6",
74
75
  "@twa-dev/sdk": "^7.8.0",
75
76
  "@web3-react/core": "8.2.0",
@@ -87,6 +88,7 @@
87
88
  "ton": "^13.9.0",
88
89
  "ton-core": "^0.53.0",
89
90
  "ton-crypto": "^3.2.0",
91
+ "tonweb": "^0.0.66",
90
92
  "zustand": "^4.5.4"
91
93
  },
92
94
  "peerDependencies": {