@orderly.network/ui-transfer 2.5.3 → 2.6.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.
package/dist/index.d.mts CHANGED
@@ -15,7 +15,7 @@ type DST = {
15
15
  declare enum DepositAction {
16
16
  Deposit = 0,
17
17
  Approve = 1,
18
- Increase = 2
18
+ ApproveAndDeposit = 2
19
19
  }
20
20
  declare enum WithdrawTo {
21
21
  /** withdraw to web3 wallet */
@@ -31,7 +31,7 @@ type Options$2 = {
31
31
  quantity: string;
32
32
  maxQuantity: string;
33
33
  };
34
- declare function useActionType(options: Options$2): DepositAction;
34
+ declare function useActionType(options: Options$2): DepositAction.Deposit | DepositAction.ApproveAndDeposit;
35
35
 
36
36
  type CurrentChain = Pick<ConnectedChain, "namespace"> & {
37
37
  id: number;
@@ -56,7 +56,8 @@ type Options$1 = {
56
56
  declare function useDepositAction(options: Options$1): {
57
57
  submitting: boolean;
58
58
  onApprove: () => Promise<void>;
59
- onDeposit: () => void;
59
+ onDeposit: () => Promise<void>;
60
+ onApproveAndDeposit: () => Promise<void>;
60
61
  };
61
62
 
62
63
  type Options = {
@@ -68,11 +69,11 @@ declare function useInputStatus(options: Options): {
68
69
  hintMessage: string | undefined;
69
70
  };
70
71
 
71
- type UseDepositFormScriptReturn = ReturnType<typeof useDepositFormScript>;
72
- type UseDepositFormScriptOptions = {
73
- onClose?: () => void;
72
+ type DepositFormScriptReturn = ReturnType<typeof useDepositFormScript>;
73
+ type DepositFormScriptOptions = {
74
+ close?: () => void;
74
75
  };
75
- declare const useDepositFormScript: (options: UseDepositFormScriptOptions) => {
76
+ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
76
77
  sourceToken: API.TokenInfo | undefined;
77
78
  targetToken: API.TokenInfo | undefined;
78
79
  sourceTokens: API.TokenInfo[];
@@ -93,8 +94,9 @@ declare const useDepositFormScript: (options: UseDepositFormScriptOptions) => {
93
94
  settingChain: boolean;
94
95
  onChainChange: (chain: API.NetworkInfos) => Promise<void>;
95
96
  actionType: DepositAction;
96
- onDeposit: () => void;
97
+ onDeposit: () => Promise<void>;
97
98
  onApprove: () => Promise<void>;
99
+ onApproveAndDeposit: () => Promise<void>;
98
100
  fetchBalance: (address: string, decimals?: number) => Promise<string>;
99
101
  dst: {
100
102
  symbol: string;
@@ -161,14 +163,14 @@ declare function useDepositFee(options: {
161
163
  dp: number;
162
164
  };
163
165
 
164
- declare const DepositForm: FC<UseDepositFormScriptReturn>;
166
+ declare const DepositForm: FC<DepositFormScriptReturn>;
165
167
 
166
- type DepositFormWidgetProps = UseDepositFormScriptOptions;
168
+ type DepositFormWidgetProps = DepositFormScriptOptions;
167
169
  declare const DepositFormWidget: FC<DepositFormWidgetProps>;
168
170
 
169
171
  type WithdrawFormScriptReturn = ReturnType<typeof useWithdrawFormScript>;
170
172
  type WithdrawFormScriptOptions = {
171
- onClose: (() => void) | undefined;
173
+ close?: () => void;
172
174
  };
173
175
  declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
174
176
  withdrawTo: WithdrawTo;
@@ -210,12 +212,17 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
210
212
  hasPositions: boolean;
211
213
  onSettlePnl: () => Promise<any>;
212
214
  brokerName: string;
215
+ qtyGreaterThanMaxAmount: boolean;
216
+ qtyGreaterThanVault: boolean;
213
217
  vaultBalanceList: API.VaultBalance[] | undefined;
214
218
  };
215
219
 
216
220
  type WithdrawFormProps = WithdrawFormScriptReturn;
217
221
  declare const WithdrawForm: react__default.FC<WithdrawFormProps>;
218
222
 
223
+ type WithdrawFormWidgetProps = WithdrawFormScriptOptions;
224
+ declare const WithdrawFormWidget: FC<WithdrawFormWidgetProps>;
225
+
219
226
  declare const DepositAndWithdrawWithDialogId = "DepositAndWithdrawWithDialogId";
220
227
  declare const DepositAndWithdrawWithSheetId = "DepositAndWithdrawWithSheetId";
221
228
  type DepositAndWithdrawProps = {
@@ -224,8 +231,6 @@ type DepositAndWithdrawProps = {
224
231
  };
225
232
  declare const DepositAndWithdraw: FC<DepositAndWithdrawProps>;
226
233
 
227
- declare const WithdrawFormWidget: (dialogProps: DepositAndWithdrawProps) => react_jsx_runtime.JSX.Element;
228
-
229
234
  type UseSwapDepositFormScriptReturn = ReturnType<typeof useSwapDepositFormScript>;
230
235
  type UseSwapDepositFormScriptOptions = {
231
236
  onClose?: () => void;
@@ -246,7 +251,7 @@ declare const useSwapDepositFormScript: (options: UseSwapDepositFormScriptOption
246
251
  settingChain: boolean;
247
252
  onChainChange: (chain: API.NetworkInfos) => Promise<void>;
248
253
  actionType: DepositAction;
249
- onDeposit: () => void;
254
+ onDeposit: () => Promise<void>;
250
255
  onApprove: () => Promise<void>;
251
256
  fetchBalance: (address: string, decimals?: number) => Promise<string>;
252
257
  dst: {
@@ -291,8 +296,6 @@ declare const SwapDepositForm: FC<UseSwapDepositFormScriptReturn>;
291
296
  type SwapDepositFormWidgetProps = UseSwapDepositFormScriptOptions;
292
297
  declare const SwapDepositFormWidget: FC<SwapDepositFormWidgetProps>;
293
298
 
294
- declare function installDeposit(): void;
295
-
296
299
  type TransferFormScriptReturn = ReturnType<typeof useTransferFormScript>;
297
300
  type TransferFormScriptOptions = {
298
301
  /** target sub account id */
@@ -389,7 +392,7 @@ type ChainSelectProps = {
389
392
  };
390
393
  declare const ChainSelect: React.FC<ChainSelectProps>;
391
394
 
392
- declare const QuantityInput: react.ForwardRefExoticComponent<{
395
+ type QuantityInputProps = {
393
396
  token?: API.TokenInfo;
394
397
  tokens?: API.TokenInfo[];
395
398
  label?: string;
@@ -403,7 +406,8 @@ declare const QuantityInput: react.ForwardRefExoticComponent<{
403
406
  formatters?: InputFormatter[];
404
407
  vaultBalanceList?: API.VaultBalance[];
405
408
  displayType?: "balance" | "vaultBalance";
406
- } & Omit<InputProps<string>, "onClear" | "suffix" | "onValueChange"> & react.RefAttributes<HTMLInputElement>>;
409
+ } & Omit<InputProps, "onClear" | "suffix" | "onValueChange">;
410
+ declare const QuantityInput: FC<QuantityInputProps>;
407
411
 
408
412
  type AvailableQuantityProps = {
409
413
  token?: Partial<API.TokenInfo>;
@@ -439,6 +443,7 @@ type ActionButtonProps = {
439
443
  symbol?: string;
440
444
  onDeposit?: () => void;
441
445
  onApprove?: () => void;
446
+ onApproveAndDeposit?: () => void;
442
447
  networkId?: NetworkId;
443
448
  };
444
449
  declare const ActionButton: react__default.FC<ActionButtonProps>;
@@ -449,7 +454,8 @@ type DepositStatusScriptReturn = ReturnType<typeof useDepositStatusScript>;
449
454
  declare function useDepositStatusScript(): {
450
455
  pendingCount: number;
451
456
  completedCount: number;
452
- isSignIn: boolean;
457
+ canTrade: boolean;
458
+ estimatedTime: string | number;
453
459
  };
454
460
 
455
461
  type DepositStatusProps = {
@@ -465,4 +471,4 @@ declare const DepositStatus: (props: DepositStatusProps) => react_jsx_runtime.JS
465
471
  type DepositStatusWidgetProps = Pick<DepositStatusProps, "className" | "onClick">;
466
472
  declare const DepositStatusWidget: (props: DepositStatusWidgetProps) => react_jsx_runtime.JSX.Element;
467
473
 
468
- export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type ConvertFormProps, ConvertFormUI, ConvertFormWidget, type CurrentChain, type DST, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, DepositFormWidget, DepositStatus, DepositStatusWidget, 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, useDepositStatusScript, useInputStatus, useSwapDepositFormScript, useTransferFormScript, useWithdrawFormScript as useWithdrawForm };
474
+ export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type ConvertFormProps, ConvertFormUI, ConvertFormWidget, type CurrentChain, type DST, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, type DepositFormScriptOptions, DepositFormWidget, type DepositFormWidgetProps, DepositStatus, DepositStatusWidget, ExchangeDivider, Fee, type InputStatus, QuantityInput, SwapCoin, SwapDepositForm, SwapDepositFormWidget, TransferDialogId, TransferForm, TransferFormWidget, type TransferFormWidgetProps, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm, type WithdrawFormScriptOptions, WithdrawFormWidget, type WithdrawFormWidgetProps, WithdrawTo, checkIsAccountId, feeDecimalsOffset, getTokenByTokenList, getTransferErrorMessage, useActionType, useChainSelect, useConvertFormScript as useConvertForm, useDepositAction, useDepositFormScript, useDepositStatusScript, useInputStatus, useSwapDepositFormScript, useTransferFormScript, useWithdrawFormScript };
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ type DST = {
15
15
  declare enum DepositAction {
16
16
  Deposit = 0,
17
17
  Approve = 1,
18
- Increase = 2
18
+ ApproveAndDeposit = 2
19
19
  }
20
20
  declare enum WithdrawTo {
21
21
  /** withdraw to web3 wallet */
@@ -31,7 +31,7 @@ type Options$2 = {
31
31
  quantity: string;
32
32
  maxQuantity: string;
33
33
  };
34
- declare function useActionType(options: Options$2): DepositAction;
34
+ declare function useActionType(options: Options$2): DepositAction.Deposit | DepositAction.ApproveAndDeposit;
35
35
 
36
36
  type CurrentChain = Pick<ConnectedChain, "namespace"> & {
37
37
  id: number;
@@ -56,7 +56,8 @@ type Options$1 = {
56
56
  declare function useDepositAction(options: Options$1): {
57
57
  submitting: boolean;
58
58
  onApprove: () => Promise<void>;
59
- onDeposit: () => void;
59
+ onDeposit: () => Promise<void>;
60
+ onApproveAndDeposit: () => Promise<void>;
60
61
  };
61
62
 
62
63
  type Options = {
@@ -68,11 +69,11 @@ declare function useInputStatus(options: Options): {
68
69
  hintMessage: string | undefined;
69
70
  };
70
71
 
71
- type UseDepositFormScriptReturn = ReturnType<typeof useDepositFormScript>;
72
- type UseDepositFormScriptOptions = {
73
- onClose?: () => void;
72
+ type DepositFormScriptReturn = ReturnType<typeof useDepositFormScript>;
73
+ type DepositFormScriptOptions = {
74
+ close?: () => void;
74
75
  };
75
- declare const useDepositFormScript: (options: UseDepositFormScriptOptions) => {
76
+ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
76
77
  sourceToken: API.TokenInfo | undefined;
77
78
  targetToken: API.TokenInfo | undefined;
78
79
  sourceTokens: API.TokenInfo[];
@@ -93,8 +94,9 @@ declare const useDepositFormScript: (options: UseDepositFormScriptOptions) => {
93
94
  settingChain: boolean;
94
95
  onChainChange: (chain: API.NetworkInfos) => Promise<void>;
95
96
  actionType: DepositAction;
96
- onDeposit: () => void;
97
+ onDeposit: () => Promise<void>;
97
98
  onApprove: () => Promise<void>;
99
+ onApproveAndDeposit: () => Promise<void>;
98
100
  fetchBalance: (address: string, decimals?: number) => Promise<string>;
99
101
  dst: {
100
102
  symbol: string;
@@ -161,14 +163,14 @@ declare function useDepositFee(options: {
161
163
  dp: number;
162
164
  };
163
165
 
164
- declare const DepositForm: FC<UseDepositFormScriptReturn>;
166
+ declare const DepositForm: FC<DepositFormScriptReturn>;
165
167
 
166
- type DepositFormWidgetProps = UseDepositFormScriptOptions;
168
+ type DepositFormWidgetProps = DepositFormScriptOptions;
167
169
  declare const DepositFormWidget: FC<DepositFormWidgetProps>;
168
170
 
169
171
  type WithdrawFormScriptReturn = ReturnType<typeof useWithdrawFormScript>;
170
172
  type WithdrawFormScriptOptions = {
171
- onClose: (() => void) | undefined;
173
+ close?: () => void;
172
174
  };
173
175
  declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
174
176
  withdrawTo: WithdrawTo;
@@ -210,12 +212,17 @@ declare const useWithdrawFormScript: (options: WithdrawFormScriptOptions) => {
210
212
  hasPositions: boolean;
211
213
  onSettlePnl: () => Promise<any>;
212
214
  brokerName: string;
215
+ qtyGreaterThanMaxAmount: boolean;
216
+ qtyGreaterThanVault: boolean;
213
217
  vaultBalanceList: API.VaultBalance[] | undefined;
214
218
  };
215
219
 
216
220
  type WithdrawFormProps = WithdrawFormScriptReturn;
217
221
  declare const WithdrawForm: react__default.FC<WithdrawFormProps>;
218
222
 
223
+ type WithdrawFormWidgetProps = WithdrawFormScriptOptions;
224
+ declare const WithdrawFormWidget: FC<WithdrawFormWidgetProps>;
225
+
219
226
  declare const DepositAndWithdrawWithDialogId = "DepositAndWithdrawWithDialogId";
220
227
  declare const DepositAndWithdrawWithSheetId = "DepositAndWithdrawWithSheetId";
221
228
  type DepositAndWithdrawProps = {
@@ -224,8 +231,6 @@ type DepositAndWithdrawProps = {
224
231
  };
225
232
  declare const DepositAndWithdraw: FC<DepositAndWithdrawProps>;
226
233
 
227
- declare const WithdrawFormWidget: (dialogProps: DepositAndWithdrawProps) => react_jsx_runtime.JSX.Element;
228
-
229
234
  type UseSwapDepositFormScriptReturn = ReturnType<typeof useSwapDepositFormScript>;
230
235
  type UseSwapDepositFormScriptOptions = {
231
236
  onClose?: () => void;
@@ -246,7 +251,7 @@ declare const useSwapDepositFormScript: (options: UseSwapDepositFormScriptOption
246
251
  settingChain: boolean;
247
252
  onChainChange: (chain: API.NetworkInfos) => Promise<void>;
248
253
  actionType: DepositAction;
249
- onDeposit: () => void;
254
+ onDeposit: () => Promise<void>;
250
255
  onApprove: () => Promise<void>;
251
256
  fetchBalance: (address: string, decimals?: number) => Promise<string>;
252
257
  dst: {
@@ -291,8 +296,6 @@ declare const SwapDepositForm: FC<UseSwapDepositFormScriptReturn>;
291
296
  type SwapDepositFormWidgetProps = UseSwapDepositFormScriptOptions;
292
297
  declare const SwapDepositFormWidget: FC<SwapDepositFormWidgetProps>;
293
298
 
294
- declare function installDeposit(): void;
295
-
296
299
  type TransferFormScriptReturn = ReturnType<typeof useTransferFormScript>;
297
300
  type TransferFormScriptOptions = {
298
301
  /** target sub account id */
@@ -389,7 +392,7 @@ type ChainSelectProps = {
389
392
  };
390
393
  declare const ChainSelect: React.FC<ChainSelectProps>;
391
394
 
392
- declare const QuantityInput: react.ForwardRefExoticComponent<{
395
+ type QuantityInputProps = {
393
396
  token?: API.TokenInfo;
394
397
  tokens?: API.TokenInfo[];
395
398
  label?: string;
@@ -403,7 +406,8 @@ declare const QuantityInput: react.ForwardRefExoticComponent<{
403
406
  formatters?: InputFormatter[];
404
407
  vaultBalanceList?: API.VaultBalance[];
405
408
  displayType?: "balance" | "vaultBalance";
406
- } & Omit<InputProps<string>, "onClear" | "suffix" | "onValueChange"> & react.RefAttributes<HTMLInputElement>>;
409
+ } & Omit<InputProps, "onClear" | "suffix" | "onValueChange">;
410
+ declare const QuantityInput: FC<QuantityInputProps>;
407
411
 
408
412
  type AvailableQuantityProps = {
409
413
  token?: Partial<API.TokenInfo>;
@@ -439,6 +443,7 @@ type ActionButtonProps = {
439
443
  symbol?: string;
440
444
  onDeposit?: () => void;
441
445
  onApprove?: () => void;
446
+ onApproveAndDeposit?: () => void;
442
447
  networkId?: NetworkId;
443
448
  };
444
449
  declare const ActionButton: react__default.FC<ActionButtonProps>;
@@ -449,7 +454,8 @@ type DepositStatusScriptReturn = ReturnType<typeof useDepositStatusScript>;
449
454
  declare function useDepositStatusScript(): {
450
455
  pendingCount: number;
451
456
  completedCount: number;
452
- isSignIn: boolean;
457
+ canTrade: boolean;
458
+ estimatedTime: string | number;
453
459
  };
454
460
 
455
461
  type DepositStatusProps = {
@@ -465,4 +471,4 @@ declare const DepositStatus: (props: DepositStatusProps) => react_jsx_runtime.JS
465
471
  type DepositStatusWidgetProps = Pick<DepositStatusProps, "className" | "onClick">;
466
472
  declare const DepositStatusWidget: (props: DepositStatusWidgetProps) => react_jsx_runtime.JSX.Element;
467
473
 
468
- export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type ConvertFormProps, ConvertFormUI, ConvertFormWidget, type CurrentChain, type DST, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, DepositFormWidget, DepositStatus, DepositStatusWidget, 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, useDepositStatusScript, useInputStatus, useSwapDepositFormScript, useTransferFormScript, useWithdrawFormScript as useWithdrawForm };
474
+ export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, type ConvertFormProps, ConvertFormUI, ConvertFormWidget, type CurrentChain, type DST, DepositAction, DepositAndWithdraw, type DepositAndWithdrawProps, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, type DepositFormScriptOptions, DepositFormWidget, type DepositFormWidgetProps, DepositStatus, DepositStatusWidget, ExchangeDivider, Fee, type InputStatus, QuantityInput, SwapCoin, SwapDepositForm, SwapDepositFormWidget, TransferDialogId, TransferForm, TransferFormWidget, type TransferFormWidgetProps, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm, type WithdrawFormScriptOptions, WithdrawFormWidget, type WithdrawFormWidgetProps, WithdrawTo, checkIsAccountId, feeDecimalsOffset, getTokenByTokenList, getTransferErrorMessage, useActionType, useChainSelect, useConvertFormScript as useConvertForm, useDepositAction, useDepositFormScript, useDepositStatusScript, useInputStatus, useSwapDepositFormScript, useTransferFormScript, useWithdrawFormScript };