@orderly.network/ui-transfer 2.4.1 → 2.5.0-alpha.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.
- package/dist/index.d.mts +178 -43
- package/dist/index.d.ts +178 -43
- package/dist/index.js +55 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -9
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +15 -10
package/dist/index.d.mts
CHANGED
|
@@ -25,13 +25,13 @@ declare enum WithdrawTo {
|
|
|
25
25
|
}
|
|
26
26
|
type InputStatus = "error" | "warning" | "success" | "default";
|
|
27
27
|
|
|
28
|
-
type Options$
|
|
28
|
+
type Options$2 = {
|
|
29
29
|
isNativeToken: boolean;
|
|
30
30
|
allowance: string;
|
|
31
31
|
quantity: string;
|
|
32
32
|
maxQuantity: string;
|
|
33
33
|
};
|
|
34
|
-
declare function useActionType(options: Options$
|
|
34
|
+
declare function useActionType(options: Options$2): DepositAction;
|
|
35
35
|
|
|
36
36
|
type CurrentChain = Pick<ConnectedChain, "namespace"> & {
|
|
37
37
|
id: number;
|
|
@@ -44,7 +44,7 @@ declare function useChainSelect(): {
|
|
|
44
44
|
onChainChange: (chain: API.NetworkInfos) => Promise<void>;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
type Options$
|
|
47
|
+
type Options$1 = {
|
|
48
48
|
quantity: string;
|
|
49
49
|
allowance?: string;
|
|
50
50
|
approve: (quantity?: string) => Promise<any>;
|
|
@@ -53,42 +53,38 @@ type Options$2 = {
|
|
|
53
53
|
customDeposit?: () => Promise<any>;
|
|
54
54
|
enableCustomDeposit?: boolean;
|
|
55
55
|
};
|
|
56
|
-
declare function useDepositAction(options: Options$
|
|
56
|
+
declare function useDepositAction(options: Options$1): {
|
|
57
57
|
submitting: boolean;
|
|
58
58
|
onApprove: () => Promise<void>;
|
|
59
59
|
onDeposit: () => void;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
type Options
|
|
62
|
+
type Options = {
|
|
63
63
|
quantity: string;
|
|
64
64
|
maxQuantity: string | number;
|
|
65
65
|
};
|
|
66
|
-
declare function useInputStatus(options: Options
|
|
66
|
+
declare function useInputStatus(options: Options): {
|
|
67
67
|
inputStatus: InputStatus;
|
|
68
68
|
hintMessage: string | undefined;
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
type Options = {
|
|
72
|
-
currentChain: CurrentChain | null;
|
|
73
|
-
tokensFilter?: (chainInfo: API.Chain) => API.TokenInfo[];
|
|
74
|
-
};
|
|
75
|
-
declare function useToken(options: Options): {
|
|
76
|
-
token: API.TokenInfo | undefined;
|
|
77
|
-
tokens: API.TokenInfo[];
|
|
78
|
-
onTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
71
|
type UseDepositFormScriptReturn = ReturnType<typeof useDepositFormScript>;
|
|
82
72
|
type UseDepositFormScriptOptions = {
|
|
83
73
|
onClose?: () => void;
|
|
84
74
|
};
|
|
85
75
|
declare const useDepositFormScript: (options: UseDepositFormScriptOptions) => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
76
|
+
sourceToken: API.TokenInfo | undefined;
|
|
77
|
+
targetToken: API.TokenInfo | undefined;
|
|
78
|
+
sourceTokens: API.TokenInfo[];
|
|
79
|
+
targetTokens: API.TokenInfo[];
|
|
80
|
+
onSourceTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
|
|
81
|
+
onTargetTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
|
|
89
82
|
amount: number;
|
|
83
|
+
isNativeToken: boolean;
|
|
90
84
|
quantity: string;
|
|
85
|
+
collateralContributionQuantity: number;
|
|
91
86
|
maxQuantity: string;
|
|
87
|
+
indexPrice: number;
|
|
92
88
|
onQuantityChange: react.Dispatch<react.SetStateAction<string>>;
|
|
93
89
|
hintMessage: string | undefined;
|
|
94
90
|
inputStatus: InputStatus;
|
|
@@ -104,8 +100,8 @@ declare const useDepositFormScript: (options: UseDepositFormScriptOptions) => {
|
|
|
104
100
|
symbol: string;
|
|
105
101
|
address: string | undefined;
|
|
106
102
|
decimals: number | undefined;
|
|
107
|
-
chainId: number
|
|
108
|
-
network: string
|
|
103
|
+
chainId: number;
|
|
104
|
+
network: string;
|
|
109
105
|
};
|
|
110
106
|
wrongNetwork: boolean;
|
|
111
107
|
balanceRevalidating: boolean;
|
|
@@ -119,8 +115,41 @@ declare const useDepositFormScript: (options: UseDepositFormScriptOptions) => {
|
|
|
119
115
|
feeAmount: string;
|
|
120
116
|
dp: number;
|
|
121
117
|
};
|
|
118
|
+
collateralRatio: number;
|
|
119
|
+
currentLTV: number;
|
|
120
|
+
nextLTV: number;
|
|
121
|
+
ltv_threshold: number | undefined;
|
|
122
|
+
negative_usdc_threshold: number | undefined;
|
|
123
|
+
isConvertThresholdLoading: boolean;
|
|
124
|
+
slippage: any;
|
|
125
|
+
onSlippageChange: (value: number) => void;
|
|
126
|
+
minimumReceived: string | number;
|
|
127
|
+
usdcToken: API.TokenInfo | undefined;
|
|
128
|
+
needSwap: boolean;
|
|
129
|
+
needCrossSwap: boolean;
|
|
130
|
+
swapPrice: number;
|
|
131
|
+
markPrice: number;
|
|
132
|
+
swapFee: {
|
|
133
|
+
nativeSymbol: string | undefined;
|
|
134
|
+
feeAmount: string;
|
|
135
|
+
feeQtys: {
|
|
136
|
+
value: string | number;
|
|
137
|
+
dp: number;
|
|
138
|
+
symbol?: string;
|
|
139
|
+
}[];
|
|
140
|
+
feeDetails: {
|
|
141
|
+
value: string | number;
|
|
142
|
+
title: string;
|
|
143
|
+
description: string;
|
|
144
|
+
dp: number;
|
|
145
|
+
symbol: string | undefined;
|
|
146
|
+
}[];
|
|
147
|
+
};
|
|
148
|
+
warningMessage: string | undefined;
|
|
149
|
+
targetQuantity: string;
|
|
150
|
+
targetQuantityLoading: boolean;
|
|
122
151
|
};
|
|
123
|
-
type
|
|
152
|
+
type UseDepositFeeReturn = ReturnType<typeof useDepositFee>;
|
|
124
153
|
declare function useDepositFee(options: {
|
|
125
154
|
nativeToken?: API.TokenInfo;
|
|
126
155
|
depositFee?: bigint;
|
|
@@ -154,16 +183,11 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
|
|
|
154
183
|
address: string | undefined;
|
|
155
184
|
quantity: string;
|
|
156
185
|
onQuantityChange: (qty: string) => void;
|
|
157
|
-
|
|
186
|
+
sourceToken: API.TokenInfo | undefined;
|
|
187
|
+
onSourceTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
|
|
188
|
+
sourceTokens: API.TokenInfo[];
|
|
158
189
|
inputStatus: InputStatus;
|
|
159
190
|
hintMessage: string | undefined;
|
|
160
|
-
dst: {
|
|
161
|
-
symbol: string;
|
|
162
|
-
decimals: number;
|
|
163
|
-
address: string | undefined;
|
|
164
|
-
chainId: number;
|
|
165
|
-
network: string;
|
|
166
|
-
};
|
|
167
191
|
amount: number;
|
|
168
192
|
balanceRevalidating: boolean;
|
|
169
193
|
maxQuantity: number;
|
|
@@ -172,12 +196,12 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
|
|
|
172
196
|
unsettledPnL: number;
|
|
173
197
|
wrongNetwork: boolean;
|
|
174
198
|
settingChain: boolean;
|
|
175
|
-
|
|
199
|
+
tokenChains: API.NetworkInfos[];
|
|
176
200
|
currentChain: CurrentChain | null;
|
|
177
201
|
onChainChange: (chain: API.NetworkInfos) => Promise<void>;
|
|
178
202
|
onWithdraw: () => Promise<void>;
|
|
179
|
-
chainVaultBalance:
|
|
180
|
-
fee:
|
|
203
|
+
chainVaultBalance: number | null;
|
|
204
|
+
fee: number;
|
|
181
205
|
crossChainWithdraw: boolean;
|
|
182
206
|
crossChainTrans: boolean;
|
|
183
207
|
showQty: string | number;
|
|
@@ -186,10 +210,11 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
|
|
|
186
210
|
hasPositions: boolean;
|
|
187
211
|
onSettlePnl: () => Promise<any>;
|
|
188
212
|
brokerName: string;
|
|
213
|
+
vaultBalanceList: API.VaultBalance[] | undefined;
|
|
189
214
|
};
|
|
190
215
|
|
|
191
216
|
type WithdrawFormProps = WithdrawFormScriptReturn;
|
|
192
|
-
declare const WithdrawForm:
|
|
217
|
+
declare const WithdrawForm: react__default.FC<WithdrawFormProps>;
|
|
193
218
|
|
|
194
219
|
declare const DepositAndWithdrawWithDialogId = "DepositAndWithdrawWithDialogId";
|
|
195
220
|
declare const DepositAndWithdrawWithSheetId = "DepositAndWithdrawWithSheetId";
|
|
@@ -201,12 +226,78 @@ declare const DepositAndWithdraw: FC<DepositAndWithdrawProps>;
|
|
|
201
226
|
|
|
202
227
|
declare const WithdrawFormWidget: (dialogProps: DepositAndWithdrawProps) => react_jsx_runtime.JSX.Element;
|
|
203
228
|
|
|
229
|
+
type UseSwapDepositFormScriptReturn = ReturnType<typeof useSwapDepositFormScript>;
|
|
230
|
+
type UseSwapDepositFormScriptOptions = {
|
|
231
|
+
onClose?: () => void;
|
|
232
|
+
};
|
|
233
|
+
declare const useSwapDepositFormScript: (options: UseSwapDepositFormScriptOptions) => {
|
|
234
|
+
token: API.TokenInfo | undefined;
|
|
235
|
+
tokens: API.TokenInfo[];
|
|
236
|
+
onTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
|
|
237
|
+
amount: number;
|
|
238
|
+
quantity: string;
|
|
239
|
+
maxQuantity: string;
|
|
240
|
+
swapQuantity: string;
|
|
241
|
+
onQuantityChange: react.Dispatch<react.SetStateAction<string>>;
|
|
242
|
+
hintMessage: string | undefined;
|
|
243
|
+
inputStatus: InputStatus;
|
|
244
|
+
chains: API.NetworkInfos[];
|
|
245
|
+
currentChain: CurrentChain | null;
|
|
246
|
+
settingChain: boolean;
|
|
247
|
+
onChainChange: (chain: API.NetworkInfos) => Promise<void>;
|
|
248
|
+
actionType: DepositAction;
|
|
249
|
+
onDeposit: () => void;
|
|
250
|
+
onApprove: () => Promise<void>;
|
|
251
|
+
fetchBalance: (address: string, decimals?: number) => Promise<string>;
|
|
252
|
+
dst: {
|
|
253
|
+
symbol: string;
|
|
254
|
+
address: string | undefined;
|
|
255
|
+
decimals: number | undefined;
|
|
256
|
+
chainId: number;
|
|
257
|
+
network: string;
|
|
258
|
+
};
|
|
259
|
+
wrongNetwork: boolean;
|
|
260
|
+
balanceRevalidating: boolean;
|
|
261
|
+
loading: boolean;
|
|
262
|
+
disabled: boolean;
|
|
263
|
+
networkId: NetworkId;
|
|
264
|
+
slippage: any;
|
|
265
|
+
onSlippageChange: (value: number) => void;
|
|
266
|
+
needSwap: boolean;
|
|
267
|
+
needCrossSwap: boolean;
|
|
268
|
+
swapPrice: number;
|
|
269
|
+
swapRevalidating: boolean;
|
|
270
|
+
warningMessage: string;
|
|
271
|
+
fee: {
|
|
272
|
+
nativeSymbol: string | undefined;
|
|
273
|
+
feeAmount: string;
|
|
274
|
+
feeQtys: {
|
|
275
|
+
value: string | number;
|
|
276
|
+
dp: number;
|
|
277
|
+
symbol?: string;
|
|
278
|
+
}[];
|
|
279
|
+
feeDetails: {
|
|
280
|
+
value: string | number;
|
|
281
|
+
title: string;
|
|
282
|
+
description: string;
|
|
283
|
+
dp: number;
|
|
284
|
+
symbol: string | undefined;
|
|
285
|
+
}[];
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
declare const SwapDepositForm: FC<UseSwapDepositFormScriptReturn>;
|
|
290
|
+
|
|
291
|
+
type SwapDepositFormWidgetProps = UseSwapDepositFormScriptOptions;
|
|
292
|
+
declare const SwapDepositFormWidget: FC<SwapDepositFormWidgetProps>;
|
|
293
|
+
|
|
204
294
|
declare function installDeposit(): void;
|
|
205
295
|
|
|
206
296
|
type TransferFormScriptReturn = ReturnType<typeof useTransferFormScript>;
|
|
207
297
|
type TransferFormScriptOptions = {
|
|
208
298
|
/** target sub account id */
|
|
209
299
|
toAccountId?: string;
|
|
300
|
+
token?: string;
|
|
210
301
|
close?: () => void;
|
|
211
302
|
};
|
|
212
303
|
declare const useTransferFormScript: (options: TransferFormScriptOptions) => {
|
|
@@ -246,7 +337,49 @@ type TransferFormWidgetProps = TransferFormScriptOptions;
|
|
|
246
337
|
declare const TransferFormWidget: (props: TransferFormWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
247
338
|
declare const TransferWidget: FC<TransferFormWidgetProps>;
|
|
248
339
|
|
|
249
|
-
|
|
340
|
+
type ConvertFormScriptReturn = ReturnType<typeof useConvertFormScript>;
|
|
341
|
+
interface ConvertFormScriptOptions {
|
|
342
|
+
token?: string;
|
|
343
|
+
close?: () => void;
|
|
344
|
+
}
|
|
345
|
+
declare const useConvertFormScript: (options: ConvertFormScriptOptions) => {
|
|
346
|
+
walletName: string | undefined;
|
|
347
|
+
address: string | undefined;
|
|
348
|
+
quantity: string;
|
|
349
|
+
onQuantityChange: (qty: string) => void;
|
|
350
|
+
token: API.TokenInfo;
|
|
351
|
+
sourceTokens: API.TokenInfo[];
|
|
352
|
+
onSourceTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
|
|
353
|
+
targetToken: API.TokenInfo | undefined;
|
|
354
|
+
inputStatus: InputStatus;
|
|
355
|
+
hintMessage: string | undefined;
|
|
356
|
+
balanceRevalidating: boolean;
|
|
357
|
+
maxQuantity: number;
|
|
358
|
+
disabled: boolean;
|
|
359
|
+
loading: boolean;
|
|
360
|
+
wrongNetwork: boolean;
|
|
361
|
+
onConvert: () => Promise<void>;
|
|
362
|
+
crossChainTrans: boolean;
|
|
363
|
+
networkId: NetworkId;
|
|
364
|
+
checkIsBridgeless: boolean;
|
|
365
|
+
hasPositions: boolean;
|
|
366
|
+
onSettlePnl: () => Promise<any>;
|
|
367
|
+
brokerName: string;
|
|
368
|
+
slippage: any;
|
|
369
|
+
onSlippageChange: (value: number) => void;
|
|
370
|
+
convertRate: string;
|
|
371
|
+
minimumReceived: number;
|
|
372
|
+
isQuoteLoading: boolean;
|
|
373
|
+
currentLTV: number;
|
|
374
|
+
nextLTV: number;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
type ConvertFormProps = ConvertFormScriptReturn;
|
|
378
|
+
declare const ConvertFormUI: react__default.FC<ConvertFormProps>;
|
|
379
|
+
|
|
380
|
+
declare const ConvertFormWidget: react__default.FC<ConvertFormScriptOptions>;
|
|
381
|
+
|
|
382
|
+
declare const getTokenByTokenList: (tokens?: API.TokenInfo[]) => API.TokenInfo;
|
|
250
383
|
declare const feeDecimalsOffset: (origin?: number) => number;
|
|
251
384
|
declare function checkIsAccountId(accountId: string): boolean;
|
|
252
385
|
declare function getTransferErrorMessage(errorCode: number): string;
|
|
@@ -272,6 +405,8 @@ declare const QuantityInput: react.ForwardRefExoticComponent<{
|
|
|
272
405
|
loading?: boolean;
|
|
273
406
|
testId?: string;
|
|
274
407
|
formatters?: InputFormatter[];
|
|
408
|
+
vaultBalanceList?: API.VaultBalance[];
|
|
409
|
+
displayType?: "balance" | "vaultBalance";
|
|
275
410
|
} & Omit<InputProps<string>, "onClear" | "suffix" | "onValueChange"> & react.RefAttributes<HTMLInputElement>>;
|
|
276
411
|
|
|
277
412
|
type AvailableQuantityProps = {
|
|
@@ -292,12 +427,13 @@ type ExchangeDividerProps = {
|
|
|
292
427
|
};
|
|
293
428
|
declare const ExchangeDivider: FC<ExchangeDividerProps>;
|
|
294
429
|
|
|
295
|
-
|
|
430
|
+
interface SwapCoinProps {
|
|
296
431
|
className?: string;
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
432
|
+
sourceSymbol?: string;
|
|
433
|
+
targetSymbol?: string;
|
|
434
|
+
indexPrice: number | string;
|
|
435
|
+
precision?: number;
|
|
436
|
+
}
|
|
301
437
|
declare const SwapCoin: FC<SwapCoinProps>;
|
|
302
438
|
|
|
303
439
|
type ActionButtonProps = {
|
|
@@ -311,7 +447,6 @@ type ActionButtonProps = {
|
|
|
311
447
|
};
|
|
312
448
|
declare const ActionButton: react__default.FC<ActionButtonProps>;
|
|
313
449
|
|
|
314
|
-
|
|
315
|
-
declare const Fee: FC<FeeProps>;
|
|
450
|
+
declare const Fee: FC<Partial<UseDepositFeeReturn>>;
|
|
316
451
|
|
|
317
|
-
export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type CurrentChain, type DST, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, DepositFormWidget, ExchangeDivider, Fee, type InputStatus, QuantityInput, SwapCoin, TransferDialogId, TransferForm, TransferFormWidget, type TransferFormWidgetProps, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm as WithdrawFormUI, WithdrawFormWidget, WithdrawTo, checkIsAccountId, feeDecimalsOffset, getTokenByTokenList, getTransferErrorMessage, installDeposit, useActionType, useChainSelect, useDepositAction, useDepositFormScript, useInputStatus,
|
|
452
|
+
export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type ConvertFormProps, ConvertFormUI, ConvertFormWidget, type CurrentChain, type DST, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, DepositFormWidget, ExchangeDivider, Fee, type InputStatus, QuantityInput, SwapCoin, SwapDepositForm, SwapDepositFormWidget, TransferDialogId, TransferForm, TransferFormWidget, type TransferFormWidgetProps, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm as WithdrawFormUI, WithdrawFormWidget, WithdrawTo, checkIsAccountId, feeDecimalsOffset, getTokenByTokenList, getTransferErrorMessage, installDeposit, useActionType, useChainSelect, useConvertFormScript as useConvertForm, useDepositAction, useDepositFormScript, useInputStatus, useSwapDepositFormScript, useTransferFormScript, useWithdrawFormScript as useWithdrawForm };
|
package/dist/index.d.ts
CHANGED
|
@@ -25,13 +25,13 @@ declare enum WithdrawTo {
|
|
|
25
25
|
}
|
|
26
26
|
type InputStatus = "error" | "warning" | "success" | "default";
|
|
27
27
|
|
|
28
|
-
type Options$
|
|
28
|
+
type Options$2 = {
|
|
29
29
|
isNativeToken: boolean;
|
|
30
30
|
allowance: string;
|
|
31
31
|
quantity: string;
|
|
32
32
|
maxQuantity: string;
|
|
33
33
|
};
|
|
34
|
-
declare function useActionType(options: Options$
|
|
34
|
+
declare function useActionType(options: Options$2): DepositAction;
|
|
35
35
|
|
|
36
36
|
type CurrentChain = Pick<ConnectedChain, "namespace"> & {
|
|
37
37
|
id: number;
|
|
@@ -44,7 +44,7 @@ declare function useChainSelect(): {
|
|
|
44
44
|
onChainChange: (chain: API.NetworkInfos) => Promise<void>;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
type Options$
|
|
47
|
+
type Options$1 = {
|
|
48
48
|
quantity: string;
|
|
49
49
|
allowance?: string;
|
|
50
50
|
approve: (quantity?: string) => Promise<any>;
|
|
@@ -53,42 +53,38 @@ type Options$2 = {
|
|
|
53
53
|
customDeposit?: () => Promise<any>;
|
|
54
54
|
enableCustomDeposit?: boolean;
|
|
55
55
|
};
|
|
56
|
-
declare function useDepositAction(options: Options$
|
|
56
|
+
declare function useDepositAction(options: Options$1): {
|
|
57
57
|
submitting: boolean;
|
|
58
58
|
onApprove: () => Promise<void>;
|
|
59
59
|
onDeposit: () => void;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
type Options
|
|
62
|
+
type Options = {
|
|
63
63
|
quantity: string;
|
|
64
64
|
maxQuantity: string | number;
|
|
65
65
|
};
|
|
66
|
-
declare function useInputStatus(options: Options
|
|
66
|
+
declare function useInputStatus(options: Options): {
|
|
67
67
|
inputStatus: InputStatus;
|
|
68
68
|
hintMessage: string | undefined;
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
type Options = {
|
|
72
|
-
currentChain: CurrentChain | null;
|
|
73
|
-
tokensFilter?: (chainInfo: API.Chain) => API.TokenInfo[];
|
|
74
|
-
};
|
|
75
|
-
declare function useToken(options: Options): {
|
|
76
|
-
token: API.TokenInfo | undefined;
|
|
77
|
-
tokens: API.TokenInfo[];
|
|
78
|
-
onTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
71
|
type UseDepositFormScriptReturn = ReturnType<typeof useDepositFormScript>;
|
|
82
72
|
type UseDepositFormScriptOptions = {
|
|
83
73
|
onClose?: () => void;
|
|
84
74
|
};
|
|
85
75
|
declare const useDepositFormScript: (options: UseDepositFormScriptOptions) => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
76
|
+
sourceToken: API.TokenInfo | undefined;
|
|
77
|
+
targetToken: API.TokenInfo | undefined;
|
|
78
|
+
sourceTokens: API.TokenInfo[];
|
|
79
|
+
targetTokens: API.TokenInfo[];
|
|
80
|
+
onSourceTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
|
|
81
|
+
onTargetTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
|
|
89
82
|
amount: number;
|
|
83
|
+
isNativeToken: boolean;
|
|
90
84
|
quantity: string;
|
|
85
|
+
collateralContributionQuantity: number;
|
|
91
86
|
maxQuantity: string;
|
|
87
|
+
indexPrice: number;
|
|
92
88
|
onQuantityChange: react.Dispatch<react.SetStateAction<string>>;
|
|
93
89
|
hintMessage: string | undefined;
|
|
94
90
|
inputStatus: InputStatus;
|
|
@@ -104,8 +100,8 @@ declare const useDepositFormScript: (options: UseDepositFormScriptOptions) => {
|
|
|
104
100
|
symbol: string;
|
|
105
101
|
address: string | undefined;
|
|
106
102
|
decimals: number | undefined;
|
|
107
|
-
chainId: number
|
|
108
|
-
network: string
|
|
103
|
+
chainId: number;
|
|
104
|
+
network: string;
|
|
109
105
|
};
|
|
110
106
|
wrongNetwork: boolean;
|
|
111
107
|
balanceRevalidating: boolean;
|
|
@@ -119,8 +115,41 @@ declare const useDepositFormScript: (options: UseDepositFormScriptOptions) => {
|
|
|
119
115
|
feeAmount: string;
|
|
120
116
|
dp: number;
|
|
121
117
|
};
|
|
118
|
+
collateralRatio: number;
|
|
119
|
+
currentLTV: number;
|
|
120
|
+
nextLTV: number;
|
|
121
|
+
ltv_threshold: number | undefined;
|
|
122
|
+
negative_usdc_threshold: number | undefined;
|
|
123
|
+
isConvertThresholdLoading: boolean;
|
|
124
|
+
slippage: any;
|
|
125
|
+
onSlippageChange: (value: number) => void;
|
|
126
|
+
minimumReceived: string | number;
|
|
127
|
+
usdcToken: API.TokenInfo | undefined;
|
|
128
|
+
needSwap: boolean;
|
|
129
|
+
needCrossSwap: boolean;
|
|
130
|
+
swapPrice: number;
|
|
131
|
+
markPrice: number;
|
|
132
|
+
swapFee: {
|
|
133
|
+
nativeSymbol: string | undefined;
|
|
134
|
+
feeAmount: string;
|
|
135
|
+
feeQtys: {
|
|
136
|
+
value: string | number;
|
|
137
|
+
dp: number;
|
|
138
|
+
symbol?: string;
|
|
139
|
+
}[];
|
|
140
|
+
feeDetails: {
|
|
141
|
+
value: string | number;
|
|
142
|
+
title: string;
|
|
143
|
+
description: string;
|
|
144
|
+
dp: number;
|
|
145
|
+
symbol: string | undefined;
|
|
146
|
+
}[];
|
|
147
|
+
};
|
|
148
|
+
warningMessage: string | undefined;
|
|
149
|
+
targetQuantity: string;
|
|
150
|
+
targetQuantityLoading: boolean;
|
|
122
151
|
};
|
|
123
|
-
type
|
|
152
|
+
type UseDepositFeeReturn = ReturnType<typeof useDepositFee>;
|
|
124
153
|
declare function useDepositFee(options: {
|
|
125
154
|
nativeToken?: API.TokenInfo;
|
|
126
155
|
depositFee?: bigint;
|
|
@@ -154,16 +183,11 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
|
|
|
154
183
|
address: string | undefined;
|
|
155
184
|
quantity: string;
|
|
156
185
|
onQuantityChange: (qty: string) => void;
|
|
157
|
-
|
|
186
|
+
sourceToken: API.TokenInfo | undefined;
|
|
187
|
+
onSourceTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
|
|
188
|
+
sourceTokens: API.TokenInfo[];
|
|
158
189
|
inputStatus: InputStatus;
|
|
159
190
|
hintMessage: string | undefined;
|
|
160
|
-
dst: {
|
|
161
|
-
symbol: string;
|
|
162
|
-
decimals: number;
|
|
163
|
-
address: string | undefined;
|
|
164
|
-
chainId: number;
|
|
165
|
-
network: string;
|
|
166
|
-
};
|
|
167
191
|
amount: number;
|
|
168
192
|
balanceRevalidating: boolean;
|
|
169
193
|
maxQuantity: number;
|
|
@@ -172,12 +196,12 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
|
|
|
172
196
|
unsettledPnL: number;
|
|
173
197
|
wrongNetwork: boolean;
|
|
174
198
|
settingChain: boolean;
|
|
175
|
-
|
|
199
|
+
tokenChains: API.NetworkInfos[];
|
|
176
200
|
currentChain: CurrentChain | null;
|
|
177
201
|
onChainChange: (chain: API.NetworkInfos) => Promise<void>;
|
|
178
202
|
onWithdraw: () => Promise<void>;
|
|
179
|
-
chainVaultBalance:
|
|
180
|
-
fee:
|
|
203
|
+
chainVaultBalance: number | null;
|
|
204
|
+
fee: number;
|
|
181
205
|
crossChainWithdraw: boolean;
|
|
182
206
|
crossChainTrans: boolean;
|
|
183
207
|
showQty: string | number;
|
|
@@ -186,10 +210,11 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
|
|
|
186
210
|
hasPositions: boolean;
|
|
187
211
|
onSettlePnl: () => Promise<any>;
|
|
188
212
|
brokerName: string;
|
|
213
|
+
vaultBalanceList: API.VaultBalance[] | undefined;
|
|
189
214
|
};
|
|
190
215
|
|
|
191
216
|
type WithdrawFormProps = WithdrawFormScriptReturn;
|
|
192
|
-
declare const WithdrawForm:
|
|
217
|
+
declare const WithdrawForm: react__default.FC<WithdrawFormProps>;
|
|
193
218
|
|
|
194
219
|
declare const DepositAndWithdrawWithDialogId = "DepositAndWithdrawWithDialogId";
|
|
195
220
|
declare const DepositAndWithdrawWithSheetId = "DepositAndWithdrawWithSheetId";
|
|
@@ -201,12 +226,78 @@ declare const DepositAndWithdraw: FC<DepositAndWithdrawProps>;
|
|
|
201
226
|
|
|
202
227
|
declare const WithdrawFormWidget: (dialogProps: DepositAndWithdrawProps) => react_jsx_runtime.JSX.Element;
|
|
203
228
|
|
|
229
|
+
type UseSwapDepositFormScriptReturn = ReturnType<typeof useSwapDepositFormScript>;
|
|
230
|
+
type UseSwapDepositFormScriptOptions = {
|
|
231
|
+
onClose?: () => void;
|
|
232
|
+
};
|
|
233
|
+
declare const useSwapDepositFormScript: (options: UseSwapDepositFormScriptOptions) => {
|
|
234
|
+
token: API.TokenInfo | undefined;
|
|
235
|
+
tokens: API.TokenInfo[];
|
|
236
|
+
onTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
|
|
237
|
+
amount: number;
|
|
238
|
+
quantity: string;
|
|
239
|
+
maxQuantity: string;
|
|
240
|
+
swapQuantity: string;
|
|
241
|
+
onQuantityChange: react.Dispatch<react.SetStateAction<string>>;
|
|
242
|
+
hintMessage: string | undefined;
|
|
243
|
+
inputStatus: InputStatus;
|
|
244
|
+
chains: API.NetworkInfos[];
|
|
245
|
+
currentChain: CurrentChain | null;
|
|
246
|
+
settingChain: boolean;
|
|
247
|
+
onChainChange: (chain: API.NetworkInfos) => Promise<void>;
|
|
248
|
+
actionType: DepositAction;
|
|
249
|
+
onDeposit: () => void;
|
|
250
|
+
onApprove: () => Promise<void>;
|
|
251
|
+
fetchBalance: (address: string, decimals?: number) => Promise<string>;
|
|
252
|
+
dst: {
|
|
253
|
+
symbol: string;
|
|
254
|
+
address: string | undefined;
|
|
255
|
+
decimals: number | undefined;
|
|
256
|
+
chainId: number;
|
|
257
|
+
network: string;
|
|
258
|
+
};
|
|
259
|
+
wrongNetwork: boolean;
|
|
260
|
+
balanceRevalidating: boolean;
|
|
261
|
+
loading: boolean;
|
|
262
|
+
disabled: boolean;
|
|
263
|
+
networkId: NetworkId;
|
|
264
|
+
slippage: any;
|
|
265
|
+
onSlippageChange: (value: number) => void;
|
|
266
|
+
needSwap: boolean;
|
|
267
|
+
needCrossSwap: boolean;
|
|
268
|
+
swapPrice: number;
|
|
269
|
+
swapRevalidating: boolean;
|
|
270
|
+
warningMessage: string;
|
|
271
|
+
fee: {
|
|
272
|
+
nativeSymbol: string | undefined;
|
|
273
|
+
feeAmount: string;
|
|
274
|
+
feeQtys: {
|
|
275
|
+
value: string | number;
|
|
276
|
+
dp: number;
|
|
277
|
+
symbol?: string;
|
|
278
|
+
}[];
|
|
279
|
+
feeDetails: {
|
|
280
|
+
value: string | number;
|
|
281
|
+
title: string;
|
|
282
|
+
description: string;
|
|
283
|
+
dp: number;
|
|
284
|
+
symbol: string | undefined;
|
|
285
|
+
}[];
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
declare const SwapDepositForm: FC<UseSwapDepositFormScriptReturn>;
|
|
290
|
+
|
|
291
|
+
type SwapDepositFormWidgetProps = UseSwapDepositFormScriptOptions;
|
|
292
|
+
declare const SwapDepositFormWidget: FC<SwapDepositFormWidgetProps>;
|
|
293
|
+
|
|
204
294
|
declare function installDeposit(): void;
|
|
205
295
|
|
|
206
296
|
type TransferFormScriptReturn = ReturnType<typeof useTransferFormScript>;
|
|
207
297
|
type TransferFormScriptOptions = {
|
|
208
298
|
/** target sub account id */
|
|
209
299
|
toAccountId?: string;
|
|
300
|
+
token?: string;
|
|
210
301
|
close?: () => void;
|
|
211
302
|
};
|
|
212
303
|
declare const useTransferFormScript: (options: TransferFormScriptOptions) => {
|
|
@@ -246,7 +337,49 @@ type TransferFormWidgetProps = TransferFormScriptOptions;
|
|
|
246
337
|
declare const TransferFormWidget: (props: TransferFormWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
247
338
|
declare const TransferWidget: FC<TransferFormWidgetProps>;
|
|
248
339
|
|
|
249
|
-
|
|
340
|
+
type ConvertFormScriptReturn = ReturnType<typeof useConvertFormScript>;
|
|
341
|
+
interface ConvertFormScriptOptions {
|
|
342
|
+
token?: string;
|
|
343
|
+
close?: () => void;
|
|
344
|
+
}
|
|
345
|
+
declare const useConvertFormScript: (options: ConvertFormScriptOptions) => {
|
|
346
|
+
walletName: string | undefined;
|
|
347
|
+
address: string | undefined;
|
|
348
|
+
quantity: string;
|
|
349
|
+
onQuantityChange: (qty: string) => void;
|
|
350
|
+
token: API.TokenInfo;
|
|
351
|
+
sourceTokens: API.TokenInfo[];
|
|
352
|
+
onSourceTokenChange: react.Dispatch<react.SetStateAction<API.TokenInfo | undefined>>;
|
|
353
|
+
targetToken: API.TokenInfo | undefined;
|
|
354
|
+
inputStatus: InputStatus;
|
|
355
|
+
hintMessage: string | undefined;
|
|
356
|
+
balanceRevalidating: boolean;
|
|
357
|
+
maxQuantity: number;
|
|
358
|
+
disabled: boolean;
|
|
359
|
+
loading: boolean;
|
|
360
|
+
wrongNetwork: boolean;
|
|
361
|
+
onConvert: () => Promise<void>;
|
|
362
|
+
crossChainTrans: boolean;
|
|
363
|
+
networkId: NetworkId;
|
|
364
|
+
checkIsBridgeless: boolean;
|
|
365
|
+
hasPositions: boolean;
|
|
366
|
+
onSettlePnl: () => Promise<any>;
|
|
367
|
+
brokerName: string;
|
|
368
|
+
slippage: any;
|
|
369
|
+
onSlippageChange: (value: number) => void;
|
|
370
|
+
convertRate: string;
|
|
371
|
+
minimumReceived: number;
|
|
372
|
+
isQuoteLoading: boolean;
|
|
373
|
+
currentLTV: number;
|
|
374
|
+
nextLTV: number;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
type ConvertFormProps = ConvertFormScriptReturn;
|
|
378
|
+
declare const ConvertFormUI: react__default.FC<ConvertFormProps>;
|
|
379
|
+
|
|
380
|
+
declare const ConvertFormWidget: react__default.FC<ConvertFormScriptOptions>;
|
|
381
|
+
|
|
382
|
+
declare const getTokenByTokenList: (tokens?: API.TokenInfo[]) => API.TokenInfo;
|
|
250
383
|
declare const feeDecimalsOffset: (origin?: number) => number;
|
|
251
384
|
declare function checkIsAccountId(accountId: string): boolean;
|
|
252
385
|
declare function getTransferErrorMessage(errorCode: number): string;
|
|
@@ -272,6 +405,8 @@ declare const QuantityInput: react.ForwardRefExoticComponent<{
|
|
|
272
405
|
loading?: boolean;
|
|
273
406
|
testId?: string;
|
|
274
407
|
formatters?: InputFormatter[];
|
|
408
|
+
vaultBalanceList?: API.VaultBalance[];
|
|
409
|
+
displayType?: "balance" | "vaultBalance";
|
|
275
410
|
} & Omit<InputProps<string>, "onClear" | "suffix" | "onValueChange"> & react.RefAttributes<HTMLInputElement>>;
|
|
276
411
|
|
|
277
412
|
type AvailableQuantityProps = {
|
|
@@ -292,12 +427,13 @@ type ExchangeDividerProps = {
|
|
|
292
427
|
};
|
|
293
428
|
declare const ExchangeDivider: FC<ExchangeDividerProps>;
|
|
294
429
|
|
|
295
|
-
|
|
430
|
+
interface SwapCoinProps {
|
|
296
431
|
className?: string;
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
432
|
+
sourceSymbol?: string;
|
|
433
|
+
targetSymbol?: string;
|
|
434
|
+
indexPrice: number | string;
|
|
435
|
+
precision?: number;
|
|
436
|
+
}
|
|
301
437
|
declare const SwapCoin: FC<SwapCoinProps>;
|
|
302
438
|
|
|
303
439
|
type ActionButtonProps = {
|
|
@@ -311,7 +447,6 @@ type ActionButtonProps = {
|
|
|
311
447
|
};
|
|
312
448
|
declare const ActionButton: react__default.FC<ActionButtonProps>;
|
|
313
449
|
|
|
314
|
-
|
|
315
|
-
declare const Fee: FC<FeeProps>;
|
|
450
|
+
declare const Fee: FC<Partial<UseDepositFeeReturn>>;
|
|
316
451
|
|
|
317
|
-
export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type CurrentChain, type DST, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, DepositFormWidget, ExchangeDivider, Fee, type InputStatus, QuantityInput, SwapCoin, TransferDialogId, TransferForm, TransferFormWidget, type TransferFormWidgetProps, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm as WithdrawFormUI, WithdrawFormWidget, WithdrawTo, checkIsAccountId, feeDecimalsOffset, getTokenByTokenList, getTransferErrorMessage, installDeposit, useActionType, useChainSelect, useDepositAction, useDepositFormScript, useInputStatus,
|
|
452
|
+
export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type ConvertFormProps, ConvertFormUI, ConvertFormWidget, type CurrentChain, type DST, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, DepositFormWidget, ExchangeDivider, Fee, type InputStatus, QuantityInput, SwapCoin, SwapDepositForm, SwapDepositFormWidget, TransferDialogId, TransferForm, TransferFormWidget, type TransferFormWidgetProps, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm as WithdrawFormUI, WithdrawFormWidget, WithdrawTo, checkIsAccountId, feeDecimalsOffset, getTokenByTokenList, getTransferErrorMessage, installDeposit, useActionType, useChainSelect, useConvertFormScript as useConvertForm, useDepositAction, useDepositFormScript, useInputStatus, useSwapDepositFormScript, useTransferFormScript, useWithdrawFormScript as useWithdrawForm };
|