@orderly.network/ui-transfer 3.1.12-alpha.0 → 3.2.0-alpha.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.js CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  var i18n = require('@orderly.network/i18n');
4
4
  var ui = require('@orderly.network/ui');
5
- var react = require('react');
6
5
  var hooks = require('@orderly.network/hooks');
7
6
  var utils = require('@orderly.network/utils');
7
+ var react = require('react');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
9
  var types = require('@orderly.network/types');
10
10
  var uiConnector = require('@orderly.network/ui-connector');
@@ -19,22 +19,11 @@ var pluginCore = require('@orderly.network/plugin-core');
19
19
 
20
20
  // src/components/depositForm/depositForm.ui.tsx
21
21
  var useLtvScript = () => {
22
- const { data, error, isLoading } = hooks.useQuery(
23
- "/v1/public/auto_convert_threshold",
24
- {
25
- errorRetryCount: 3,
26
- revalidateOnFocus: false
27
- }
28
- );
29
- const ltvThreshold = react.useMemo(() => {
30
- if (!data || isLoading) {
31
- return "-";
32
- }
33
- return `${new utils.Decimal(data.ltv_threshold).mul(100).toNumber()}%`;
34
- }, []);
22
+ const { ltv_threshold, negative_usdc_threshold, isLoading, error } = hooks.useConvertThreshold();
23
+ const ltvThreshold = ltv_threshold === void 0 || isLoading ? "-" : `${new utils.Decimal(ltv_threshold).mul(100).toNumber()}%`;
35
24
  return {
36
25
  ltv_threshold: ltvThreshold,
37
- negative_usdc_threshold: data?.negative_usdc_threshold,
26
+ negative_usdc_threshold,
38
27
  isLoading,
39
28
  error
40
29
  };
@@ -2350,21 +2339,6 @@ var useCollateralValue = (params) => {
2350
2339
  nextLTV
2351
2340
  };
2352
2341
  };
2353
- var useConvertThreshold = () => {
2354
- const { data, error, isLoading } = hooks.useQuery(
2355
- "/v1/public/auto_convert_threshold",
2356
- {
2357
- revalidateOnFocus: true,
2358
- errorRetryCount: 3
2359
- }
2360
- );
2361
- return {
2362
- ltv_threshold: data?.ltv_threshold,
2363
- negative_usdc_threshold: data?.negative_usdc_threshold,
2364
- isLoading,
2365
- error
2366
- };
2367
- };
2368
2342
  function sortTokensWithUSDCFirst(tokens = []) {
2369
2343
  const sortedTokens = [...tokens];
2370
2344
  sortedTokens.sort((a, b) => {
@@ -4469,7 +4443,7 @@ var useDepositFormScript = (options2) => {
4469
4443
  ltv_threshold,
4470
4444
  negative_usdc_threshold,
4471
4445
  isLoading: isConvertThresholdLoading
4472
- } = useConvertThreshold();
4446
+ } = hooks.useConvertThreshold();
4473
4447
  const loading = depositFeeRevalidating || depositRevalidating || swapPriceRevalidating;
4474
4448
  const disabled = !sourceToken || !quantity || Number(quantity) === 0 || depositDisabled || loading || !!swapErrorMessage;
4475
4449
  const targetQuantityLoading = swapPriceRevalidating;
@@ -5367,7 +5341,7 @@ function useWithdrawFee(options2) {
5367
5341
  }
5368
5342
  var useWithdrawLTV = (params) => {
5369
5343
  const { token, quantity } = params;
5370
- const { ltv_threshold } = useConvertThreshold2();
5344
+ const { ltv_threshold } = hooks.useConvertThreshold();
5371
5345
  const { t } = i18n.useTranslation();
5372
5346
  const currentLTV = hooks.useComputedLTV();
5373
5347
  const nextLTV = hooks.useComputedLTV({
@@ -5392,18 +5366,6 @@ var useWithdrawLTV = (params) => {
5392
5366
  t
5393
5367
  };
5394
5368
  };
5395
- var useConvertThreshold2 = () => {
5396
- const { data } = hooks.useQuery(
5397
- "/v1/public/auto_convert_threshold",
5398
- {
5399
- revalidateOnFocus: false
5400
- }
5401
- );
5402
- return {
5403
- ltv_threshold: data?.ltv_threshold,
5404
- negative_usdc_threshold: data?.negative_usdc_threshold
5405
- };
5406
- };
5407
5369
  var useToken2 = (currentChain, filter = () => true) => {
5408
5370
  const [sourceToken, setSourceToken] = react.useState();
5409
5371
  const [targetToken, setTargetToken] = react.useState();