@orderly.network/ui-transfer 2.11.0 → 3.0.0-beta.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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i18n, useTranslation, Trans } from '@orderly.network/i18n';
2
2
  import { registerSimpleDialog, registerSimpleSheet, Tabs, TabPanel, ArrowDownSquareFillIcon, ArrowUpSquareFillIcon, ExtensionSlot, ExtensionPositionEnum, Box, textVariants, Flex, toast, Text, cn, Button, Spinner, Select, Input, inputFormatter, useScreen, modal, Tooltip, Tips, AlertDialog, EditIcon, ArrowLeftRightIcon, WalletIcon, DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuContent, ScrollArea, ChainIcon, Badge, CaretUpIcon, CaretDownIcon, SimpleDialog, CloseRoundFillIcon, ExclamationFillIcon, TokenIcon, Checkbox, CloseIcon } from '@orderly.network/ui';
3
- import { forwardRef, useState, useMemo, useEffect, useCallback, useRef } from 'react';
3
+ import { forwardRef, useState, isValidElement, useMemo, useEffect, useCallback, useRef } from 'react';
4
4
  import { useConfig, useWalletConnector, useLocalStorage, useConvert, useOdosQuote, useComputedLTV, useAccount, useAppStore, useTransfer, useSubAccountDataObserver, useSubAccountMaxWithdrawal, useTokensInfo, useEventEmitter, usePositionStream, useIndexPricesStream, useOrderlyContext, useDeposit, useAssetsHistory, useChains, useMemoizedFn, useWithdraw, useWalletTopic, useQuery, useSWR, useTokenInfo, useHoldingStream, useInternalTransfer, useDebouncedCallback, useTransferHistory, useBalanceTopic } from '@orderly.network/hooks';
5
5
  import { Decimal, zero, praseChainIdToNumber, int2hex, toNonExponential, formatWithPrecision, isSolana } from '@orderly.network/utils';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -12,6 +12,7 @@ import { utils } from '@orderly.network/core';
12
12
  import { ChainSelectorDialogId } from '@orderly.network/ui-chain-selector';
13
13
  import { PublicKey } from '@solana/web3.js';
14
14
  import { ethers } from 'ethers';
15
+ import { injectable } from '@orderly.network/plugin-core';
15
16
  import { DefaultSolanaWalletAdapter } from '@orderly.network/default-solana-adapter';
16
17
 
17
18
  // src/components/depositForm/depositForm.ui.tsx
@@ -2480,6 +2481,9 @@ var useSwapTokens = (chainId, enableSwapDeposit) => {
2480
2481
  logo_uri: item.logoURI
2481
2482
  }));
2482
2483
  }, [data]);
2484
+ if (!enableSwapDeposit) {
2485
+ return [];
2486
+ }
2483
2487
  return tokens;
2484
2488
  };
2485
2489
 
@@ -5986,10 +5990,14 @@ var WithdrawSlot = (props) => {
5986
5990
  var DepositAndWithdrawWithDialogId = "DepositAndWithdrawWithDialogId";
5987
5991
  var DepositAndWithdrawWithSheetId = "DepositAndWithdrawWithSheetId";
5988
5992
  var DepositAndWithdraw = (props) => {
5993
+ const { extraTabs = [] } = props;
5989
5994
  const [activeTab, setActiveTab] = useState(
5990
5995
  props.activeTab || "deposit"
5991
5996
  );
5992
5997
  const { t } = useTranslation();
5998
+ const sortedExtra = [...extraTabs].sort(
5999
+ (a, b) => (a.order ?? 100) - (b.order ?? 100)
6000
+ );
5993
6001
  return /* @__PURE__ */ jsxs(
5994
6002
  Tabs,
5995
6003
  {
@@ -6019,18 +6027,39 @@ var DepositAndWithdraw = (props) => {
6019
6027
  value: "withdraw",
6020
6028
  children: /* @__PURE__ */ jsx(WithdrawSlot, { close: props.close })
6021
6029
  }
6022
- )
6030
+ ),
6031
+ sortedExtra.map((tab) => /* @__PURE__ */ jsx(
6032
+ TabPanel,
6033
+ {
6034
+ title: tab.title,
6035
+ icon: isValidElement(tab.icon) ? tab.icon : void 0,
6036
+ value: tab.id,
6037
+ children: /* @__PURE__ */ jsx(tab.component, { close: props.close })
6038
+ },
6039
+ tab.id
6040
+ ))
6023
6041
  ]
6024
6042
  }
6025
6043
  );
6026
6044
  };
6027
- registerSimpleDialog(DepositAndWithdrawWithDialogId, DepositAndWithdraw, {
6028
- size: "md",
6029
- classNames: {
6030
- content: "oui-border oui-border-line-6"
6045
+ var InjectableDepositAndWithdraw = injectable(
6046
+ DepositAndWithdraw,
6047
+ "Transfer.DepositAndWithdraw"
6048
+ );
6049
+ registerSimpleDialog(
6050
+ DepositAndWithdrawWithDialogId,
6051
+ InjectableDepositAndWithdraw,
6052
+ {
6053
+ size: "md",
6054
+ classNames: {
6055
+ content: "oui-border oui-border-line-6"
6056
+ }
6031
6057
  }
6032
- });
6033
- registerSimpleSheet(DepositAndWithdrawWithSheetId, DepositAndWithdraw);
6058
+ );
6059
+ registerSimpleSheet(
6060
+ DepositAndWithdrawWithSheetId,
6061
+ InjectableDepositAndWithdraw
6062
+ );
6034
6063
  var AccountSelect = (props) => {
6035
6064
  const { subAccounts = [], value } = props;
6036
6065
  const [open, setOpen] = useState(false);
@@ -7868,6 +7897,6 @@ var DepositStatusWidget = (props) => {
7868
7897
  return /* @__PURE__ */ jsx(DepositStatus, { ...state, ...props });
7869
7898
  };
7870
7899
 
7871
- export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, ConvertFormUI, ConvertFormWidget, DEPOSIT_ERROR_CODE_MAP, DepositAction, DepositAndWithdraw, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, DepositFormWidget, DepositStatus, DepositStatusWidget, ExchangeDivider, Fee, QuantityInput, SwapCoin, TransferDialogId, TransferForm, TransferFormWidget, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm, WithdrawFormWidget, WithdrawTo, YIELD_BEARING_ASSETS, YieldBearingReminder, checkIsAccountId, feeDecimalsOffset, getDepositKnownErrorMessage, getTransferErrorMessage, getUSDCToken, getYieldBearingAsset, isYieldBearingAsset, sortTokensWithUSDCFirst, useConvertFormScript as useConvertForm, useDepositFormScript, useDepositStatusScript, useTransferFormScript, useWithdrawFormScript };
7900
+ export { ActionButton, AvailableQuantity, BrokerWallet, ChainSelect, ConvertFormUI, ConvertFormWidget, DEPOSIT_ERROR_CODE_MAP, DepositAction, DepositAndWithdraw, DepositAndWithdrawWithDialogId, DepositAndWithdrawWithSheetId, DepositForm, DepositFormWidget, DepositStatus, DepositStatusWidget, ExchangeDivider, Fee, InjectableDepositAndWithdraw, QuantityInput, SwapCoin, TransferDialogId, TransferForm, TransferFormWidget, TransferSheetId, TransferWidget, Web3Wallet, WithdrawForm, WithdrawFormWidget, WithdrawTo, YIELD_BEARING_ASSETS, YieldBearingReminder, checkIsAccountId, feeDecimalsOffset, getDepositKnownErrorMessage, getTransferErrorMessage, getUSDCToken, getYieldBearingAsset, isYieldBearingAsset, sortTokensWithUSDCFirst, useConvertFormScript as useConvertForm, useDepositFormScript, useDepositStatusScript, useTransferFormScript, useWithdrawFormScript };
7872
7901
  //# sourceMappingURL=index.mjs.map
7873
7902
  //# sourceMappingURL=index.mjs.map