@orderly.network/ui-transfer 3.1.12 → 3.2.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 +6 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i18n, useTranslation, Trans } from '@orderly.network/i18n';
|
|
2
2
|
import { registerSimpleDialog, registerSimpleSheet, Tabs, TabPanel, ArrowDownSquareFillIcon, ArrowUpSquareFillIcon, useModal, ExtensionSlot, ExtensionPositionEnum, toast, Box, Text, Flex, cn, Button, textVariants, ExclamationFillIcon, ArrowLeftRightIcon, WalletIcon, DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuContent, ScrollArea, useDocumentDirection, Spinner, Select, Input, inputFormatter, useScreen, modal, Tooltip, ToastTile, CheckedCircleFillIcon, Tips, AlertDialog, EditIcon, ChainIcon, Badge, CaretUpIcon, CaretDownIcon, SimpleDialog, CloseRoundFillIcon, TokenIcon, WarningIcon, SelectItem, ChevronRightIcon, Checkbox, CloseIcon } from '@orderly.network/ui';
|
|
3
|
-
import {
|
|
4
|
-
import { useConfig, useAccount, useAppStore, useTransfer, useSubAccountDataObserver, useSubAccountMaxWithdrawal, useSessionStorage, useEventEmitter, useWalletConnector, useLocalStorage, usePrivateQuery, useConvert, useSwapQuote as useSwapQuote$1, useComputedLTV, useOrderlyContext, useIndexPricesStream, useDeposit, useAssetsHistory, useChains, useMemoizedFn, useWithdraw, useWalletTopic, usePositionStream, useMainTokenStore, useSWR, useTokenInfo, useQuery, useTokensInfo, useHoldingStream, useInternalTransfer, useDebouncedCallback, useTransferHistory, useBalanceTopic } from '@orderly.network/hooks';
|
|
3
|
+
import { useConfig, useAccount, useAppStore, useTransfer, useSubAccountDataObserver, useSubAccountMaxWithdrawal, useSessionStorage, useEventEmitter, useWalletConnector, useLocalStorage, usePrivateQuery, useConvert, useSwapQuote as useSwapQuote$1, useComputedLTV, useOrderlyContext, useIndexPricesStream, useDeposit, useConvertThreshold, useAssetsHistory, useChains, useMemoizedFn, useWithdraw, useWalletTopic, usePositionStream, useMainTokenStore, useSWR, useTokenInfo, useTokensInfo, useHoldingStream, useQuery, useInternalTransfer, useDebouncedCallback, useTransferHistory, useBalanceTopic } from '@orderly.network/hooks';
|
|
5
4
|
import { zero, Decimal, praseChainIdToNumber, int2hex, toNonExponential, formatWithPrecision, isSolana, getTimestamp } from '@orderly.network/utils';
|
|
5
|
+
import { forwardRef, useState, isValidElement, useMemo, useCallback, useEffect, useRef } from 'react';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import { AccountStatusEnum, ChainNamespace, AssetHistoryStatusEnum, AssetHistorySideEnum, isWalletChainChangePendingResult, EMPTY_OBJECT, isNativeTokenChecker, ABSTRACT_CHAIN_ID_MAP, nativeTokenAddress, SOLANA_MAINNET_CHAINID, SOLANA_TESTNET_CHAINID, SolanaDevnetChainInfo } from '@orderly.network/types';
|
|
8
8
|
import { AuthGuard, useAuthGuard } from '@orderly.network/ui-connector';
|
|
@@ -17,22 +17,11 @@ import { injectable } from '@orderly.network/plugin-core';
|
|
|
17
17
|
|
|
18
18
|
// src/components/depositForm/depositForm.ui.tsx
|
|
19
19
|
var useLtvScript = () => {
|
|
20
|
-
const {
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
errorRetryCount: 3,
|
|
24
|
-
revalidateOnFocus: false
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
const ltvThreshold = useMemo(() => {
|
|
28
|
-
if (!data || isLoading) {
|
|
29
|
-
return "-";
|
|
30
|
-
}
|
|
31
|
-
return `${new Decimal(data.ltv_threshold).mul(100).toNumber()}%`;
|
|
32
|
-
}, []);
|
|
20
|
+
const { ltv_threshold, negative_usdc_threshold, isLoading, error } = useConvertThreshold();
|
|
21
|
+
const ltvThreshold = ltv_threshold === void 0 || isLoading ? "-" : `${new Decimal(ltv_threshold).mul(100).toNumber()}%`;
|
|
33
22
|
return {
|
|
34
23
|
ltv_threshold: ltvThreshold,
|
|
35
|
-
negative_usdc_threshold
|
|
24
|
+
negative_usdc_threshold,
|
|
36
25
|
isLoading,
|
|
37
26
|
error
|
|
38
27
|
};
|
|
@@ -2348,21 +2337,6 @@ var useCollateralValue = (params) => {
|
|
|
2348
2337
|
nextLTV
|
|
2349
2338
|
};
|
|
2350
2339
|
};
|
|
2351
|
-
var useConvertThreshold = () => {
|
|
2352
|
-
const { data, error, isLoading } = useQuery(
|
|
2353
|
-
"/v1/public/auto_convert_threshold",
|
|
2354
|
-
{
|
|
2355
|
-
revalidateOnFocus: true,
|
|
2356
|
-
errorRetryCount: 3
|
|
2357
|
-
}
|
|
2358
|
-
);
|
|
2359
|
-
return {
|
|
2360
|
-
ltv_threshold: data?.ltv_threshold,
|
|
2361
|
-
negative_usdc_threshold: data?.negative_usdc_threshold,
|
|
2362
|
-
isLoading,
|
|
2363
|
-
error
|
|
2364
|
-
};
|
|
2365
|
-
};
|
|
2366
2340
|
function sortTokensWithUSDCFirst(tokens = []) {
|
|
2367
2341
|
const sortedTokens = [...tokens];
|
|
2368
2342
|
sortedTokens.sort((a, b) => {
|
|
@@ -5365,7 +5339,7 @@ function useWithdrawFee(options2) {
|
|
|
5365
5339
|
}
|
|
5366
5340
|
var useWithdrawLTV = (params) => {
|
|
5367
5341
|
const { token, quantity } = params;
|
|
5368
|
-
const { ltv_threshold } =
|
|
5342
|
+
const { ltv_threshold } = useConvertThreshold();
|
|
5369
5343
|
const { t } = useTranslation();
|
|
5370
5344
|
const currentLTV = useComputedLTV();
|
|
5371
5345
|
const nextLTV = useComputedLTV({
|
|
@@ -5390,18 +5364,6 @@ var useWithdrawLTV = (params) => {
|
|
|
5390
5364
|
t
|
|
5391
5365
|
};
|
|
5392
5366
|
};
|
|
5393
|
-
var useConvertThreshold2 = () => {
|
|
5394
|
-
const { data } = useQuery(
|
|
5395
|
-
"/v1/public/auto_convert_threshold",
|
|
5396
|
-
{
|
|
5397
|
-
revalidateOnFocus: false
|
|
5398
|
-
}
|
|
5399
|
-
);
|
|
5400
|
-
return {
|
|
5401
|
-
ltv_threshold: data?.ltv_threshold,
|
|
5402
|
-
negative_usdc_threshold: data?.negative_usdc_threshold
|
|
5403
|
-
};
|
|
5404
|
-
};
|
|
5405
5367
|
var useToken2 = (currentChain, filter = () => true) => {
|
|
5406
5368
|
const [sourceToken, setSourceToken] = useState();
|
|
5407
5369
|
const [targetToken, setTargetToken] = useState();
|