@dodoex/widgets 2.6.12-beta.3 → 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 (61) 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 +6 -6
  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/hooks/Bridge/useExecuteBridgeRoute.d.ts +3 -1
  20. package/dist/cjs/src/hooks/Bridge/useFetchRoutePriceBridge.d.ts +6 -0
  21. package/dist/cjs/src/hooks/ConnectWallet/TonConnect/contract.d.ts +8 -0
  22. package/dist/cjs/src/hooks/ConnectWallet/useWalletState.d.ts +4 -0
  23. package/dist/cjs/src/hooks/Submission/types.d.ts +14 -0
  24. package/dist/cjs/src/hooks/Submission/useExecution.d.ts +14 -0
  25. package/dist/cjs/src/hooks/Swap/usePriceTimer.d.ts +1 -0
  26. package/dist/cjs/src/hooks/Token/useGetTokenStatus.d.ts +2 -1
  27. package/dist/cjs/src/hooks/contract/layerswap/constants.d.ts +6 -0
  28. package/dist/cjs/src/hooks/contract/layerswap/data.d.ts +41 -0
  29. package/dist/cjs/src/hooks/contract/layerswap/types.d.ts +170 -0
  30. package/dist/cjs/src/hooks/contract/layerswap/useLayerswapRouters.d.ts +20 -0
  31. package/dist/helper-CHqZavUq.js +1 -0
  32. package/dist/helper-D1mp2p4F.js +1 -0
  33. package/dist/helper-Dhy5gy1p.js +1 -0
  34. package/dist/index-0IX6JBNg.js +12 -0
  35. package/dist/index-BgcusTMt.js +78 -0
  36. package/dist/index-BlT57eKb.js +53 -0
  37. package/dist/index-CE6izMXy.js +12 -0
  38. package/dist/index-CEwSZbo5.js +53 -0
  39. package/dist/index-CTxzesqs.js +53 -0
  40. package/dist/index-D0SWY6AZ.js +12 -0
  41. package/dist/index-Duga8SDh.js +78 -0
  42. package/dist/index-DxNt17fy.js +78 -0
  43. package/dist/index.js +7 -7
  44. package/dist/locales/en-US.js +1 -1
  45. package/dist/locales/zh-CN.js +1 -1
  46. package/dist/lottie-B77ifW0u.js +1 -0
  47. package/dist/lottie-C9cpjlCR.js +1 -0
  48. package/dist/lottie-DMZ5X1eY.js +1 -0
  49. package/dist/src/hooks/Bridge/useExecuteBridgeRoute.d.ts +3 -1
  50. package/dist/src/hooks/Bridge/useFetchRoutePriceBridge.d.ts +6 -0
  51. package/dist/src/hooks/ConnectWallet/TonConnect/contract.d.ts +8 -0
  52. package/dist/src/hooks/ConnectWallet/useWalletState.d.ts +4 -0
  53. package/dist/src/hooks/Submission/types.d.ts +14 -0
  54. package/dist/src/hooks/Submission/useExecution.d.ts +14 -0
  55. package/dist/src/hooks/Swap/usePriceTimer.d.ts +1 -0
  56. package/dist/src/hooks/Token/useGetTokenStatus.d.ts +2 -1
  57. package/dist/src/hooks/contract/layerswap/constants.d.ts +6 -0
  58. package/dist/src/hooks/contract/layerswap/data.d.ts +41 -0
  59. package/dist/src/hooks/contract/layerswap/types.d.ts +170 -0
  60. package/dist/src/hooks/contract/layerswap/useLayerswapRouters.d.ts +20 -0
  61. package/package.json +2 -1
@@ -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;
@@ -37,6 +38,7 @@ export interface BridgeRouteI {
37
38
  chainId: number;
38
39
  encodeId?: string;
39
40
  };
41
+ sendData?: Parameters<ExecutionCtx['executeCustom']>['0']['handler'];
40
42
  productParams: any;
41
43
  sourceRoute?: {
42
44
  toAmount: string;
@@ -110,4 +112,8 @@ export declare function useFetchRoutePriceBridge({ toToken, fromToken, fromAmoun
110
112
  status: RoutePriceStatus;
111
113
  refetch: () => Promise<void>;
112
114
  bridgeRouteList: BridgeRouteI[];
115
+ limit: {
116
+ minAmt?: number | undefined;
117
+ maxAmt?: number | undefined;
118
+ } | null;
113
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;
@@ -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,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
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dodoex/widgets",
3
- "version": "2.6.12-beta.3",
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",
@@ -88,6 +88,7 @@
88
88
  "ton": "^13.9.0",
89
89
  "ton-core": "^0.53.0",
90
90
  "ton-crypto": "^3.2.0",
91
+ "tonweb": "^0.0.66",
91
92
  "zustand": "^4.5.4"
92
93
  },
93
94
  "peerDependencies": {