@kodiak-finance/orderly-ui-transfer 2.9.2-alpha.0 → 2.9.2

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
@@ -9,6 +9,7 @@ var jsxRuntime = require('react/jsx-runtime');
9
9
  var orderlyTypes = require('@kodiak-finance/orderly-types');
10
10
  var orderlyUiConnector = require('@kodiak-finance/orderly-ui-connector');
11
11
  var orderlyReactApp = require('@kodiak-finance/orderly-react-app');
12
+ var qr = require('@akamfoad/qr');
12
13
  var orderlyPerp = require('@kodiak-finance/orderly-perp');
13
14
  var orderlyCore = require('@kodiak-finance/orderly-core');
14
15
  var orderlyUiChainSelector = require('@kodiak-finance/orderly-ui-chain-selector');
@@ -599,6 +600,423 @@ var ExchangeDivider = ({ icon }) => {
599
600
  /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Flex, { height: 1, className: "oui-flex-1 oui-bg-base-contrast-12" })
600
601
  ] });
601
602
  };
603
+ var CopyIcon = ({ copied }) => /* @__PURE__ */ jsxRuntime.jsx(
604
+ "svg",
605
+ {
606
+ width: "17",
607
+ height: "16",
608
+ viewBox: "0 0 17 16",
609
+ fill: "currentColor",
610
+ xmlns: "http://www.w3.org/2000/svg",
611
+ className: `oui-fill-base-contrast oui-text-base-contrast-54 ${copied ? "oui-fill-success oui-text-success" : ""}`,
612
+ children: copied ? /* @__PURE__ */ jsxRuntime.jsx(
613
+ "path",
614
+ {
615
+ d: "M14 4L6 11.5L3 8.5",
616
+ fill: "none",
617
+ stroke: "currentColor",
618
+ strokeWidth: "2",
619
+ strokeLinecap: "round",
620
+ strokeLinejoin: "round"
621
+ }
622
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
623
+ "path",
624
+ {
625
+ d: "M5.166 1.994A2.667 2.667 0 0 0 2.499 4.66v4a2.667 2.667 0 0 0 2.667 2.667 2.667 2.667 0 0 0 2.666 2.667h4a2.667 2.667 0 0 0 2.667-2.667v-4a2.667 2.667 0 0 0-2.667-2.667 2.667 2.667 0 0 0-2.666-2.666zm6.666 4c.737 0 1.334.596 1.334 1.333v4c0 .737-.597 1.334-1.334 1.334h-4A1.333 1.333 0 0 1 6.5 11.327h2.667a2.667 2.667 0 0 0 2.666-2.667z",
626
+ fill: "currentColor"
627
+ }
628
+ )
629
+ }
630
+ );
631
+ var CopyAddress = ({ address }) => {
632
+ const [copied, setCopied] = react.useState(false);
633
+ const handleCopy = () => {
634
+ navigator.clipboard.writeText(address);
635
+ setCopied(true);
636
+ setTimeout(() => setCopied(false), 2e3);
637
+ };
638
+ return /* @__PURE__ */ jsxRuntime.jsxs(
639
+ orderlyUi.Flex,
640
+ {
641
+ gap: 1,
642
+ itemAlign: "start",
643
+ className: "oui-mt-6 oui-w-full oui-cursor-pointer oui-justify-center",
644
+ onClick: handleCopy,
645
+ children: [
646
+ /* @__PURE__ */ jsxRuntime.jsx(
647
+ orderlyUi.Text,
648
+ {
649
+ size: "xs",
650
+ className: "oui-break-all oui-text-center oui-text-base-contrast-80",
651
+ title: address,
652
+ children: address
653
+ }
654
+ ),
655
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Box, { className: "oui-mt-0.5 oui-shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(CopyIcon, { copied }) })
656
+ ]
657
+ }
658
+ );
659
+ };
660
+ var DepositStatusBlock = ({
661
+ amount,
662
+ symbol = "USDC",
663
+ pendingCount,
664
+ explorerUrl
665
+ }) => {
666
+ const { t: t0 } = orderlyI18n.useTranslation();
667
+ const t = t0;
668
+ const label = t("transfer.exclusiveDeposit.depositPending", {
669
+ amount,
670
+ symbol
671
+ });
672
+ const handleClick = () => {
673
+ window.open(explorerUrl, "_blank", "noopener,noreferrer");
674
+ };
675
+ return /* @__PURE__ */ jsxRuntime.jsxs(
676
+ orderlyUi.Flex,
677
+ {
678
+ itemAlign: "center",
679
+ gap: 2,
680
+ className: "oui-group oui-mt-6 oui-w-full oui-cursor-pointer",
681
+ onClick: handleClick,
682
+ children: [
683
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-size-2 oui-shrink-0 oui-rounded-full oui-bg-primary" }),
684
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 98, className: "oui-flex-1", children: label }),
685
+ pendingCount > 1 && /* @__PURE__ */ jsxRuntime.jsx(
686
+ orderlyUi.Flex,
687
+ {
688
+ justify: "center",
689
+ itemAlign: "center",
690
+ r: "full",
691
+ width: 18,
692
+ height: 18,
693
+ className: "oui-bg-line-12",
694
+ children: /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "3xs", intensity: 80, children: pendingCount })
695
+ }
696
+ ),
697
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.ChevronRightIcon, { className: "oui-size-4 oui-text-base-contrast-54 oui-transition-colors group-hover:oui-text-base-contrast-80" })
698
+ ]
699
+ }
700
+ );
701
+ };
702
+ var NetworkTokenSelect = ({
703
+ selectedNetwork,
704
+ selectedToken,
705
+ onNetworkChange,
706
+ onTokenChange,
707
+ networkOptions,
708
+ tokenOptions
709
+ }) => {
710
+ const { t: t0 } = orderlyI18n.useTranslation();
711
+ const t = t0;
712
+ const selectContentProps = {
713
+ align: "end",
714
+ sideOffset: -4,
715
+ className: "oui-custom-scrollbar"
716
+ };
717
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
718
+ /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { className: "oui-w-full", justify: "between", itemAlign: "center", children: [
719
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 36, children: t("common.network") }),
720
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Box, { className: "oui-ml-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
721
+ orderlyUi.Select,
722
+ {
723
+ size: "xs",
724
+ value: selectedNetwork || void 0,
725
+ onValueChange: onNetworkChange,
726
+ placeholder: t("transfer.exclusiveDeposit.selectNetwork"),
727
+ variant: "text",
728
+ classNames: { trigger: "oui-pr-0" },
729
+ maxHeight: 128,
730
+ contentProps: selectContentProps,
731
+ children: networkOptions.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.SelectItem, { value: opt.value, children: /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { gap: 1, itemAlign: "center", children: [
732
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.ChainIcon, { chainId: opt.chainId, size: "2xs" }),
733
+ opt.label
734
+ ] }) }, opt.value))
735
+ }
736
+ ) })
737
+ ] }),
738
+ /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { className: "oui-w-full", justify: "between", itemAlign: "center", children: [
739
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 36, children: t("common.token") }),
740
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Box, { className: "oui-ml-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
741
+ orderlyUi.Select,
742
+ {
743
+ size: "xs",
744
+ value: selectedToken || void 0,
745
+ onValueChange: onTokenChange,
746
+ placeholder: t("transfer.exclusiveDeposit.selectToken"),
747
+ variant: "text",
748
+ classNames: { trigger: "oui-pr-0" },
749
+ maxHeight: 128,
750
+ contentProps: selectContentProps,
751
+ children: tokenOptions.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.SelectItem, { value: opt.value, children: /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { gap: 1, itemAlign: "center", children: [
752
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.TokenIcon, { name: opt.value, size: "2xs" }),
753
+ opt.label
754
+ ] }) }, opt.value))
755
+ }
756
+ ) })
757
+ ] })
758
+ ] });
759
+ };
760
+ var QRCodeDisplay = ({ address }) => {
761
+ return /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Flex, { direction: "column", className: "oui-mt-5 oui-w-full", itemAlign: "center", children: /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Box, { className: "oui-relative oui-flex oui-size-[140px] oui-items-center oui-justify-center oui-rounded-lg oui-bg-white oui-p-2", children: address ? /* @__PURE__ */ jsxRuntime.jsx(QRCodeCanvas, { width: 124, height: 124, content: address }) : /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Box, { className: "oui-size-full oui-border-8 oui-border-dashed oui-border-black oui-opacity-50" }) }) });
762
+ };
763
+ var QRCodeCanvas = ({ width, height, content }) => {
764
+ const canvasRef = react.useRef(null);
765
+ react.useEffect(() => {
766
+ if (!canvasRef.current || !content) return;
767
+ const qrcode = qr.qrcode(content);
768
+ const ctx = canvasRef.current.getContext("2d");
769
+ const cells = qrcode.modules;
770
+ const tileW = width / cells.length;
771
+ const tileH = height / cells.length;
772
+ for (let r = 0; r < cells.length; ++r) {
773
+ const row = cells[r];
774
+ for (let c = 0; c < row.length; ++c) {
775
+ ctx.fillStyle = row[c] ? "#000" : "#fff";
776
+ const w = Math.ceil((c + 1) * tileW) - Math.floor(c * tileW);
777
+ const h = Math.ceil((r + 1) * tileH) - Math.floor(r * tileH);
778
+ ctx.fillRect(Math.round(c * tileW), Math.round(r * tileH), w, h);
779
+ }
780
+ }
781
+ }, [content, width, height]);
782
+ return /* @__PURE__ */ jsxRuntime.jsx("canvas", { width, height, ref: canvasRef });
783
+ };
784
+ var WarningBanner = ({ message }) => {
785
+ return /* @__PURE__ */ jsxRuntime.jsxs(
786
+ orderlyUi.Flex,
787
+ {
788
+ itemAlign: "start",
789
+ gap: 1,
790
+ className: "oui-mt-4 oui-w-[calc(100%+2.5rem)] oui-rounded oui-bg-[#FF7D00]/10 oui-px-5 oui-py-2 oui-text-[#FF7D00]",
791
+ children: [
792
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Box, { className: "oui-mt-0.5", children: /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.WarningIcon, { width: 16, height: 16 }) }),
793
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 80, className: "oui-w-full oui-text-[#FF7D00]", children: message })
794
+ ]
795
+ }
796
+ );
797
+ };
798
+ var buildExplorerUrl = (baseUrl, txId) => {
799
+ const url = baseUrl;
800
+ if (url.endsWith("/")) {
801
+ return `${url}tx/${txId}`;
802
+ }
803
+ return `${url}/tx/${txId}`;
804
+ };
805
+ var useExclusiveDeposit = (options2) => {
806
+ const active = options2.active ?? true;
807
+ const confirmed = options2.confirmed ?? true;
808
+ const { chainId, token, explorerBaseUrl } = options2;
809
+ const { t: t0 } = orderlyI18n.useTranslation();
810
+ const t = t0;
811
+ const receiverAddressKey = confirmed && chainId && token ? `/v1/client/asset/receiver_address?chain_id=${chainId}&token=${token}` : null;
812
+ const receiverEventsKey = active && confirmed ? "/v1/client/asset/receiver_events" : null;
813
+ const {
814
+ data: addressData,
815
+ isLoading: isAddressLoading,
816
+ error: addressError
817
+ } = orderlyHooks.usePrivateQuery(receiverAddressKey, {
818
+ revalidateOnFocus: false
819
+ });
820
+ const {
821
+ data: eventsData,
822
+ isLoading: isEventsLoading,
823
+ error: eventsError
824
+ } = orderlyHooks.usePrivateQuery(receiverEventsKey, {
825
+ refreshInterval: active ? 1e4 : 0,
826
+ revalidateOnFocus: false
827
+ });
828
+ const { latestEvent, pendingCount, explorerUrl } = react.useMemo(() => {
829
+ const events = eventsData ?? [];
830
+ if (!events.length) {
831
+ return {
832
+ latestEvent: void 0,
833
+ pendingCount: 0,
834
+ explorerUrl: void 0
835
+ };
836
+ }
837
+ const latest = events.reduce((acc, curr) => {
838
+ if (!acc) return curr;
839
+ return curr.created_time > acc.created_time ? curr : acc;
840
+ }, void 0);
841
+ const count = events.length;
842
+ const url = latest?.tx_id ? buildExplorerUrl(explorerBaseUrl, latest.tx_id) : void 0;
843
+ return {
844
+ latestEvent: latest,
845
+ pendingCount: count,
846
+ explorerUrl: url
847
+ };
848
+ }, [explorerBaseUrl, eventsData]);
849
+ return {
850
+ address: addressData?.receiver_address,
851
+ qrUri: addressData?.receiver_address,
852
+ minimumDeposit: addressData?.minimum_deposit,
853
+ estimatedArrivalText: t("transfer.exclusiveDeposit.estimatedTime.default"),
854
+ latestEvent,
855
+ pendingCount,
856
+ explorerUrl,
857
+ isAddressLoading,
858
+ isEventsLoading,
859
+ addressError,
860
+ eventsError
861
+ };
862
+ };
863
+ var useExclusiveDepositOptions = (params) => {
864
+ const networkId = orderlyHooks.useConfig("networkId");
865
+ const tokensInfo = orderlyHooks.useTokensInfo();
866
+ const selectedNetwork = params?.selectedNetwork;
867
+ const [, { findByChainId }] = orderlyHooks.useChains(networkId, {
868
+ pick: "network_infos"
869
+ });
870
+ const combos = react.useMemo(() => {
871
+ if (!tokensInfo?.length) return [];
872
+ const result = [];
873
+ for (const token of tokensInfo) {
874
+ for (const detail of token.chain_details ?? []) {
875
+ if (detail.exclusive_deposit_supported === true) {
876
+ const chainId = Number(detail.chain_id);
877
+ const chain = findByChainId(chainId);
878
+ result.push({
879
+ chainId,
880
+ chainName: chain?.network_infos?.name ?? `Chain ${chainId}`,
881
+ explorerUrl: chain?.network_infos?.explorer_base_url ?? "",
882
+ tokenSymbol: token.token
883
+ });
884
+ }
885
+ }
886
+ }
887
+ return result;
888
+ }, [tokensInfo, findByChainId]);
889
+ const networkOptions = react.useMemo(() => {
890
+ const seen = /* @__PURE__ */ new Map();
891
+ for (const combo of combos) {
892
+ if (!seen.has(combo.chainId)) {
893
+ seen.set(combo.chainId, {
894
+ label: combo.chainName,
895
+ value: String(combo.chainId),
896
+ chainId: combo.chainId,
897
+ explorerUrl: combo.explorerUrl
898
+ });
899
+ }
900
+ }
901
+ const list = Array.from(seen.values());
902
+ list.sort((a, b) => {
903
+ if (a.chainId === 42161) return -1;
904
+ if (b.chainId === 42161) return 1;
905
+ return 0;
906
+ });
907
+ return list;
908
+ }, [combos]);
909
+ const tokenOptions = react.useMemo(() => {
910
+ if (!selectedNetwork) return [];
911
+ const chainId = Number(selectedNetwork);
912
+ const seen = /* @__PURE__ */ new Set();
913
+ const result = [];
914
+ for (const combo of combos) {
915
+ if (combo.chainId === chainId && !seen.has(combo.tokenSymbol)) {
916
+ seen.add(combo.tokenSymbol);
917
+ result.push({ label: combo.tokenSymbol, value: combo.tokenSymbol });
918
+ }
919
+ }
920
+ result.sort((a, b) => {
921
+ if (a.value === "USDC") return -1;
922
+ if (b.value === "USDC") return 1;
923
+ return 0;
924
+ });
925
+ return result;
926
+ }, [combos, selectedNetwork]);
927
+ const isSupported = combos.length > 0;
928
+ return { networkOptions, tokenOptions, isSupported };
929
+ };
930
+ var ExclusiveDeposit = ({ active }) => {
931
+ const { t: t0 } = orderlyI18n.useTranslation();
932
+ const t = t0;
933
+ const [selectedNetwork, setSelectedNetwork] = react.useState("");
934
+ const [selectedToken, setSelectedToken] = react.useState("");
935
+ const { networkOptions, tokenOptions} = useExclusiveDepositOptions({
936
+ selectedNetwork
937
+ });
938
+ const confirmed = !!selectedNetwork && !!selectedToken;
939
+ react.useEffect(() => {
940
+ if (selectedToken && tokenOptions.length > 0 && !tokenOptions.some((t2) => t2.value === selectedToken)) {
941
+ setSelectedToken("");
942
+ }
943
+ }, [selectedNetwork, selectedToken, tokenOptions]);
944
+ const selectedNetworkOption = selectedNetwork ? networkOptions.find((n) => n.value === selectedNetwork) : void 0;
945
+ const selectedChainId = selectedNetworkOption?.chainId;
946
+ const selectedTokenOption = selectedToken ? tokenOptions.find((t2) => t2.value === selectedToken) : void 0;
947
+ const {
948
+ address,
949
+ qrUri,
950
+ minimumDeposit,
951
+ estimatedArrivalText,
952
+ latestEvent,
953
+ pendingCount,
954
+ explorerUrl
955
+ } = useExclusiveDeposit({
956
+ active,
957
+ confirmed,
958
+ chainId: selectedChainId,
959
+ token: selectedToken,
960
+ explorerBaseUrl: selectedNetworkOption?.explorerUrl ?? ""
961
+ });
962
+ const networkName = selectedNetworkOption?.label ?? "";
963
+ const tokenName = selectedTokenOption?.label ?? "";
964
+ const warningMessage = confirmed ? t("transfer.exclusiveDeposit.warning", {
965
+ token: tokenName,
966
+ network: networkName
967
+ }) : t("transfer.exclusiveDeposit.selectFirst");
968
+ const minText = confirmed && typeof minimumDeposit === "number" ? `${minimumDeposit} ${tokenName}` : "--";
969
+ const estText = confirmed ? estimatedArrivalText ?? t("transfer.exclusiveDeposit.estimatedTime.default") : "--";
970
+ return /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Box, { className: "oui-flex oui-flex-col oui-items-center oui-rounded-xl oui-bg-base-8 oui-tracking-[0.03em]", children: [
971
+ /* @__PURE__ */ jsxRuntime.jsx(WarningBanner, { message: warningMessage }),
972
+ confirmed && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
973
+ /* @__PURE__ */ jsxRuntime.jsx(QRCodeDisplay, { address: qrUri }),
974
+ address && /* @__PURE__ */ jsxRuntime.jsx(CopyAddress, { address })
975
+ ] }),
976
+ /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { direction: "column", gap: 2, className: "oui-mt-5 oui-w-full", children: [
977
+ /* @__PURE__ */ jsxRuntime.jsx(
978
+ NetworkTokenSelect,
979
+ {
980
+ selectedNetwork,
981
+ selectedToken,
982
+ onNetworkChange: (value) => {
983
+ setSelectedNetwork(value);
984
+ setSelectedToken("");
985
+ },
986
+ onTokenChange: setSelectedToken,
987
+ networkOptions,
988
+ tokenOptions
989
+ },
990
+ selectedNetwork
991
+ ),
992
+ /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { className: "oui-w-full", justify: "between", children: [
993
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 36, children: t("transfer.exclusiveDeposit.minDeposit") }),
994
+ /* @__PURE__ */ jsxRuntime.jsx(
995
+ orderlyUi.Text,
996
+ {
997
+ size: "xs",
998
+ className: confirmed ? "oui-text-[#FF7D00]" : "",
999
+ intensity: confirmed ? void 0 : 98,
1000
+ children: minText
1001
+ }
1002
+ )
1003
+ ] }),
1004
+ /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { className: "oui-w-full", justify: "between", children: [
1005
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 36, children: t("transfer.exclusiveDeposit.estimatedTime") }),
1006
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 98, children: estText })
1007
+ ] })
1008
+ ] }),
1009
+ confirmed && latestEvent && explorerUrl && /* @__PURE__ */ jsxRuntime.jsx(
1010
+ DepositStatusBlock,
1011
+ {
1012
+ amount: latestEvent.amount,
1013
+ symbol: latestEvent.token,
1014
+ pendingCount,
1015
+ explorerUrl
1016
+ }
1017
+ )
1018
+ ] });
1019
+ };
602
1020
  var Fee = (props) => {
603
1021
  const { dstGasFee, feeQty, feeAmount, dp, nativeSymbol } = props;
604
1022
  const { t } = orderlyI18n.useTranslation();
@@ -1587,7 +2005,7 @@ var DepositForm = (props) => {
1587
2005
  /* @__PURE__ */ jsxRuntime.jsx(Fee, { ...fee, nativeSymbol: props.nativeSymbol })
1588
2006
  ] });
1589
2007
  };
1590
- return /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Box, { id: "oui-deposit-form", className: orderlyUi.textVariants({ weight: "semibold" }), children: /* @__PURE__ */ jsxRuntime.jsx(
2008
+ return /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Box, { id: "oui-deposit-form", className: orderlyUi.textVariants({ weight: "semibold" }), children: /* @__PURE__ */ jsxRuntime.jsxs(
1591
2009
  orderlyUi.Tabs,
1592
2010
  {
1593
2011
  value: activeSubTab,
@@ -1596,108 +2014,118 @@ var DepositForm = (props) => {
1596
2014
  classNames: {
1597
2015
  tabsList: "oui-w-fit"
1598
2016
  },
1599
- children: /* @__PURE__ */ jsxRuntime.jsxs(
1600
- orderlyUi.TabPanel,
1601
- {
1602
- title: t("transfer.deposit.tab.connectedWallet"),
1603
- value: "web3",
1604
- children: [
1605
- /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Box, { className: "oui-mt-3", children: [
1606
- /* @__PURE__ */ jsxRuntime.jsx(Web3Wallet, {}),
1607
- /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Box, { mt: 3, mb: 1, children: [
2017
+ children: [
2018
+ /* @__PURE__ */ jsxRuntime.jsxs(
2019
+ orderlyUi.TabPanel,
2020
+ {
2021
+ title: t("transfer.deposit.tab.connectedWallet"),
2022
+ value: "web3",
2023
+ children: [
2024
+ /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Box, { className: "oui-mt-3", children: [
2025
+ /* @__PURE__ */ jsxRuntime.jsx(Web3Wallet, {}),
2026
+ /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Box, { mt: 3, mb: 1, children: [
2027
+ /* @__PURE__ */ jsxRuntime.jsx(
2028
+ ChainSelect,
2029
+ {
2030
+ chains,
2031
+ value: currentChain,
2032
+ onValueChange: onChainChange,
2033
+ wrongNetwork,
2034
+ loading: settingChain,
2035
+ disabled: !props.isLoggedIn
2036
+ }
2037
+ ),
2038
+ /* @__PURE__ */ jsxRuntime.jsx(
2039
+ QuantityInput,
2040
+ {
2041
+ "data-testId": "oui-testid-deposit-dialog-quantity-input",
2042
+ classNames: {
2043
+ root: "oui-mt-[2px] oui-rounded-t-sm oui-rounded-b-xl"
2044
+ },
2045
+ value: quantity,
2046
+ onValueChange: onQuantityChange,
2047
+ token: sourceToken,
2048
+ tokens: sourceTokens,
2049
+ onTokenChange: onSourceTokenChange,
2050
+ status: inputStatus,
2051
+ hintMessage,
2052
+ tokenShowCaret: !showSourceDepositCap && sourceTokens?.length > 1,
2053
+ tokenValueFormatter: showSourceDepositCap ? tokenValueFormatter : void 0,
2054
+ disabled: !props.isLoggedIn,
2055
+ balancesRevalidating: batchBalancesRevalidating,
2056
+ showBalance: true
2057
+ }
2058
+ )
2059
+ ] }),
1608
2060
  /* @__PURE__ */ jsxRuntime.jsx(
1609
- ChainSelect,
2061
+ AvailableQuantity,
1610
2062
  {
1611
- chains,
1612
- value: currentChain,
1613
- onValueChange: onChainChange,
1614
- wrongNetwork,
1615
- loading: settingChain,
1616
- disabled: !props.isLoggedIn
2063
+ token: sourceToken,
2064
+ quantity,
2065
+ maxQuantity,
2066
+ notional: quantityNotional,
2067
+ loading: balanceRevalidating,
2068
+ onClick: () => {
2069
+ onQuantityChange(maxDepositAmount);
2070
+ }
1617
2071
  }
1618
2072
  ),
2073
+ /* @__PURE__ */ jsxRuntime.jsx(
2074
+ YieldBearingReminder,
2075
+ {
2076
+ symbol: targetToken?.symbol,
2077
+ className: "oui-mt-3"
2078
+ }
2079
+ ),
2080
+ /* @__PURE__ */ jsxRuntime.jsx(ExchangeDivider, {}),
2081
+ /* @__PURE__ */ jsxRuntime.jsx(BrokerWallet, {}),
1619
2082
  /* @__PURE__ */ jsxRuntime.jsx(
1620
2083
  QuantityInput,
1621
2084
  {
1622
- "data-testId": "oui-testid-deposit-dialog-quantity-input",
1623
2085
  classNames: {
1624
- root: "oui-mt-[2px] oui-rounded-t-sm oui-rounded-b-xl"
2086
+ root: "oui-mt-3 oui-border-transparent focus-within:oui-outline-transparent"
1625
2087
  },
1626
- value: quantity,
1627
- onValueChange: onQuantityChange,
1628
- token: sourceToken,
1629
- tokens: sourceTokens,
1630
- onTokenChange: onSourceTokenChange,
1631
- status: inputStatus,
1632
- hintMessage,
1633
- tokenShowCaret: !showSourceDepositCap && sourceTokens?.length > 1,
1634
- tokenValueFormatter: showSourceDepositCap ? tokenValueFormatter : void 0,
2088
+ token: targetToken,
2089
+ tokens: targetTokens,
2090
+ onTokenChange: onTargetTokenChange,
2091
+ value: targetQuantity,
2092
+ loading: targetQuantityLoading,
1635
2093
  disabled: !props.isLoggedIn,
1636
- balancesRevalidating: batchBalancesRevalidating,
1637
- showBalance: true
2094
+ readOnly: true,
2095
+ status: targetInputStatus,
2096
+ hintMessage: targetHintMessage,
2097
+ tokenShowCaret: !showTargetDepositCap && targetTokens?.length > 1,
2098
+ tokenValueFormatter: showTargetDepositCap ? tokenValueFormatter : void 0
1638
2099
  }
1639
- )
2100
+ ),
2101
+ renderContent()
1640
2102
  ] }),
1641
- /* @__PURE__ */ jsxRuntime.jsx(
1642
- AvailableQuantity,
1643
- {
1644
- token: sourceToken,
1645
- quantity,
1646
- maxQuantity,
1647
- notional: quantityNotional,
1648
- loading: balanceRevalidating,
1649
- onClick: () => {
1650
- onQuantityChange(maxDepositAmount);
1651
- }
1652
- }
1653
- ),
1654
- /* @__PURE__ */ jsxRuntime.jsx(
1655
- YieldBearingReminder,
1656
- {
1657
- symbol: targetToken?.symbol,
1658
- className: "oui-mt-3"
1659
- }
1660
- ),
1661
- /* @__PURE__ */ jsxRuntime.jsx(ExchangeDivider, {}),
1662
- /* @__PURE__ */ jsxRuntime.jsx(BrokerWallet, {}),
1663
- /* @__PURE__ */ jsxRuntime.jsx(
1664
- QuantityInput,
2103
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Box, { className: "oui-mb-6 lg:oui-mb-8", children: /* @__PURE__ */ jsxRuntime.jsx(Notice, { message: warningMessage, wrongNetwork }) }),
2104
+ /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Flex, { justify: "center", children: /* @__PURE__ */ jsxRuntime.jsx(
2105
+ ActionButton,
1665
2106
  {
1666
- classNames: {
1667
- root: "oui-mt-3 oui-border-transparent focus-within:oui-outline-transparent"
1668
- },
1669
- token: targetToken,
1670
- tokens: targetTokens,
1671
- onTokenChange: onTargetTokenChange,
1672
- value: targetQuantity,
1673
- loading: targetQuantityLoading,
1674
- disabled: !props.isLoggedIn,
1675
- readOnly: true,
1676
- status: targetInputStatus,
1677
- hintMessage: targetHintMessage,
1678
- tokenShowCaret: !showTargetDepositCap && targetTokens?.length > 1,
1679
- tokenValueFormatter: showTargetDepositCap ? tokenValueFormatter : void 0
2107
+ actionType,
2108
+ symbol: sourceToken?.symbol,
2109
+ disabled,
2110
+ loading,
2111
+ onDeposit,
2112
+ onApprove,
2113
+ onApproveAndDeposit,
2114
+ networkId
1680
2115
  }
1681
- ),
1682
- renderContent()
1683
- ] }),
1684
- /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Box, { className: "oui-mb-6 lg:oui-mb-8", children: /* @__PURE__ */ jsxRuntime.jsx(Notice, { message: warningMessage, wrongNetwork }) }),
1685
- /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Flex, { justify: "center", children: /* @__PURE__ */ jsxRuntime.jsx(
1686
- ActionButton,
1687
- {
1688
- actionType,
1689
- symbol: sourceToken?.symbol,
1690
- disabled,
1691
- loading,
1692
- onDeposit,
1693
- onApprove,
1694
- onApproveAndDeposit,
1695
- networkId
1696
- }
1697
- ) })
1698
- ]
1699
- }
1700
- )
2116
+ ) })
2117
+ ]
2118
+ }
2119
+ ),
2120
+ showExclusiveDeposit && /* @__PURE__ */ jsxRuntime.jsx(
2121
+ orderlyUi.TabPanel,
2122
+ {
2123
+ title: t("transfer.deposit.tab.exchangeOrOtherWallet"),
2124
+ value: "exclusive_deposit",
2125
+ children: /* @__PURE__ */ jsxRuntime.jsx(ExclusiveDeposit, { active: activeSubTab === "exclusive_deposit" })
2126
+ }
2127
+ )
2128
+ ]
1701
2129
  }
1702
2130
  ) });
1703
2131
  };