@orderly.network/ui-transfer 2.11.3-rc.0 → 2.12.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.d.mts CHANGED
@@ -69,6 +69,9 @@ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
69
69
  showSourceDepositCap: boolean;
70
70
  showTargetDepositCap: boolean;
71
71
  quantityNotional: number;
72
+ activeSubTab: "web3" | "exclusive_deposit";
73
+ setActiveSubTab: react.Dispatch<react.SetStateAction<"web3" | "exclusive_deposit">>;
74
+ showExclusiveDeposit: boolean;
72
75
  };
73
76
 
74
77
  declare const DepositForm: FC<DepositFormScriptReturn>;
package/dist/index.d.ts CHANGED
@@ -69,6 +69,9 @@ declare const useDepositFormScript: (options: DepositFormScriptOptions) => {
69
69
  showSourceDepositCap: boolean;
70
70
  showTargetDepositCap: boolean;
71
71
  quantityNotional: number;
72
+ activeSubTab: "web3" | "exclusive_deposit";
73
+ setActiveSubTab: react.Dispatch<react.SetStateAction<"web3" | "exclusive_deposit">>;
74
+ showExclusiveDeposit: boolean;
72
75
  };
73
76
 
74
77
  declare const DepositForm: FC<DepositFormScriptReturn>;
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ var jsxRuntime = require('react/jsx-runtime');
9
9
  var types = require('@orderly.network/types');
10
10
  var uiConnector = require('@orderly.network/ui-connector');
11
11
  var reactApp = require('@orderly.network/react-app');
12
+ var qr = require('@akamfoad/qr');
12
13
  var perp = require('@orderly.network/perp');
13
14
  var core = require('@orderly.network/core');
14
15
  var uiChainSelector = require('@orderly.network/ui-chain-selector');
@@ -598,6 +599,392 @@ var ExchangeDivider = ({ icon }) => {
598
599
  /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { height: 1, className: "oui-flex-1 oui-bg-base-contrast-12" })
599
600
  ] });
600
601
  };
602
+ var CopyIcon = ({ copied }) => /* @__PURE__ */ jsxRuntime.jsx(
603
+ "svg",
604
+ {
605
+ width: "17",
606
+ height: "16",
607
+ viewBox: "0 0 17 16",
608
+ fill: "currentColor",
609
+ xmlns: "http://www.w3.org/2000/svg",
610
+ className: `oui-fill-base-contrast oui-text-base-contrast-54 ${copied ? "oui-fill-success oui-text-success" : ""}`,
611
+ children: copied ? /* @__PURE__ */ jsxRuntime.jsx(
612
+ "path",
613
+ {
614
+ d: "M14 4L6 11.5L3 8.5",
615
+ fill: "none",
616
+ stroke: "currentColor",
617
+ strokeWidth: "2",
618
+ strokeLinecap: "round",
619
+ strokeLinejoin: "round"
620
+ }
621
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
622
+ "path",
623
+ {
624
+ 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",
625
+ fill: "currentColor"
626
+ }
627
+ )
628
+ }
629
+ );
630
+ var CopyAddress = ({ address }) => {
631
+ const [copied, setCopied] = react.useState(false);
632
+ const handleCopy = () => {
633
+ navigator.clipboard.writeText(address);
634
+ setCopied(true);
635
+ setTimeout(() => setCopied(false), 2e3);
636
+ };
637
+ return /* @__PURE__ */ jsxRuntime.jsxs(
638
+ ui.Flex,
639
+ {
640
+ gap: 1,
641
+ itemAlign: "start",
642
+ className: "oui-mt-6 oui-w-full oui-cursor-pointer oui-justify-center",
643
+ onClick: handleCopy,
644
+ children: [
645
+ /* @__PURE__ */ jsxRuntime.jsx(
646
+ ui.Text,
647
+ {
648
+ size: "xs",
649
+ className: "oui-break-all oui-text-center oui-text-base-contrast-80",
650
+ title: address,
651
+ children: address
652
+ }
653
+ ),
654
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { className: "oui-mt-0.5 oui-shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(CopyIcon, { copied }) })
655
+ ]
656
+ }
657
+ );
658
+ };
659
+ var DepositStatusBlock = ({
660
+ amount,
661
+ symbol = "USDC",
662
+ pendingCount,
663
+ explorerUrl
664
+ }) => {
665
+ const { t: t0 } = i18n.useTranslation();
666
+ const t = t0;
667
+ const label = t("transfer.exclusiveDeposit.depositPending", {
668
+ amount,
669
+ symbol
670
+ });
671
+ const handleClick = () => {
672
+ window.open(explorerUrl, "_blank", "noopener,noreferrer");
673
+ };
674
+ return /* @__PURE__ */ jsxRuntime.jsxs(
675
+ ui.Flex,
676
+ {
677
+ itemAlign: "center",
678
+ gap: 2,
679
+ className: "oui-group oui-mt-6 oui-w-full oui-cursor-pointer",
680
+ onClick: handleClick,
681
+ children: [
682
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-size-2 oui-shrink-0 oui-rounded-full oui-bg-primary" }),
683
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xs", intensity: 98, className: "oui-flex-1", children: label }),
684
+ pendingCount > 1 && /* @__PURE__ */ jsxRuntime.jsx(
685
+ ui.Flex,
686
+ {
687
+ justify: "center",
688
+ itemAlign: "center",
689
+ r: "full",
690
+ width: 18,
691
+ height: 18,
692
+ className: "oui-bg-line-12",
693
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "3xs", intensity: 80, children: pendingCount })
694
+ }
695
+ ),
696
+ /* @__PURE__ */ jsxRuntime.jsx(ui.ChevronRightIcon, { className: "oui-size-4 oui-text-base-contrast-54 oui-transition-colors group-hover:oui-text-base-contrast-80" })
697
+ ]
698
+ }
699
+ );
700
+ };
701
+ var NetworkTokenSelect = ({
702
+ selectedNetwork,
703
+ selectedToken,
704
+ onNetworkChange,
705
+ onTokenChange,
706
+ networkOptions,
707
+ tokenOptions
708
+ }) => {
709
+ const { t: t0 } = i18n.useTranslation();
710
+ const t = t0;
711
+ const selectContentProps = {
712
+ align: "end",
713
+ sideOffset: -4,
714
+ className: "oui-custom-scrollbar"
715
+ };
716
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
717
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { className: "oui-w-full", justify: "between", itemAlign: "center", children: [
718
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xs", intensity: 36, children: t("common.network") }),
719
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { className: "oui-ml-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
720
+ ui.Select,
721
+ {
722
+ size: "xs",
723
+ value: selectedNetwork || void 0,
724
+ onValueChange: onNetworkChange,
725
+ placeholder: t("transfer.exclusiveDeposit.selectNetwork"),
726
+ variant: "text",
727
+ classNames: { trigger: "oui-pr-0" },
728
+ maxHeight: 128,
729
+ contentProps: selectContentProps,
730
+ children: networkOptions.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: opt.value, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 1, itemAlign: "center", children: [
731
+ /* @__PURE__ */ jsxRuntime.jsx(ui.ChainIcon, { chainId: opt.chainId, size: "2xs" }),
732
+ opt.label
733
+ ] }) }, opt.value))
734
+ }
735
+ ) })
736
+ ] }),
737
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { className: "oui-w-full", justify: "between", itemAlign: "center", children: [
738
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xs", intensity: 36, children: t("common.token") }),
739
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { className: "oui-ml-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
740
+ ui.Select,
741
+ {
742
+ size: "xs",
743
+ value: selectedToken || void 0,
744
+ onValueChange: onTokenChange,
745
+ placeholder: t("transfer.exclusiveDeposit.selectToken"),
746
+ variant: "text",
747
+ classNames: { trigger: "oui-pr-0" },
748
+ maxHeight: 128,
749
+ contentProps: selectContentProps,
750
+ children: tokenOptions.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: opt.value, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 1, itemAlign: "center", children: [
751
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TokenIcon, { name: opt.value, size: "2xs" }),
752
+ opt.label
753
+ ] }) }, opt.value))
754
+ }
755
+ ) })
756
+ ] })
757
+ ] });
758
+ };
759
+ var QRCodeDisplay = ({ address }) => {
760
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { direction: "column", className: "oui-mt-5 oui-w-full", itemAlign: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.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(ui.Box, { className: "oui-size-full oui-border-8 oui-border-dashed oui-border-black oui-opacity-50" }) }) });
761
+ };
762
+ var QRCodeCanvas = ({ width, height, content }) => {
763
+ const canvasRef = react.useRef(null);
764
+ react.useEffect(() => {
765
+ if (!canvasRef.current || !content) return;
766
+ const qrcode = qr.qrcode(content);
767
+ const ctx = canvasRef.current.getContext("2d");
768
+ const cells = qrcode.modules;
769
+ const tileW = width / cells.length;
770
+ const tileH = height / cells.length;
771
+ for (let r = 0; r < cells.length; ++r) {
772
+ const row = cells[r];
773
+ for (let c = 0; c < row.length; ++c) {
774
+ ctx.fillStyle = row[c] ? "#000" : "#fff";
775
+ const w = Math.ceil((c + 1) * tileW) - Math.floor(c * tileW);
776
+ const h = Math.ceil((r + 1) * tileH) - Math.floor(r * tileH);
777
+ ctx.fillRect(Math.round(c * tileW), Math.round(r * tileH), w, h);
778
+ }
779
+ }
780
+ }, [content, width, height]);
781
+ return /* @__PURE__ */ jsxRuntime.jsx("canvas", { width, height, ref: canvasRef });
782
+ };
783
+ var WarningBanner = ({ message }) => {
784
+ return /* @__PURE__ */ jsxRuntime.jsxs(
785
+ ui.Flex,
786
+ {
787
+ itemAlign: "start",
788
+ gap: 1,
789
+ 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]",
790
+ children: [
791
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { className: "oui-mt-0.5", children: /* @__PURE__ */ jsxRuntime.jsx(ui.WarningIcon, { width: 16, height: 16 }) }),
792
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xs", intensity: 80, className: "oui-w-full oui-text-[#FF7D00]", children: message })
793
+ ]
794
+ }
795
+ );
796
+ };
797
+ var buildExplorerUrl = (baseUrl, txId) => {
798
+ const url = baseUrl;
799
+ if (url.endsWith("/")) {
800
+ return `${url}tx/${txId}`;
801
+ }
802
+ return `${url}/tx/${txId}`;
803
+ };
804
+ var useExclusiveDeposit = (options2) => {
805
+ const active = options2.active ?? true;
806
+ const confirmed = options2.confirmed ?? true;
807
+ const { chainId, explorerBaseUrl } = options2;
808
+ const { t: t0 } = i18n.useTranslation();
809
+ const t = t0;
810
+ const receiverAddressKey = confirmed && chainId ? `/v1/client/asset/receiver_address?chain_id=${chainId}` : null;
811
+ const receiverEventsKey = active && confirmed ? "/v1/client/asset/receiver_events" : null;
812
+ const {
813
+ data: addressData,
814
+ isLoading: isAddressLoading,
815
+ error: addressError
816
+ } = hooks.usePrivateQuery(receiverAddressKey, {
817
+ revalidateOnFocus: false
818
+ });
819
+ const {
820
+ data: eventsData,
821
+ isLoading: isEventsLoading,
822
+ error: eventsError
823
+ } = hooks.usePrivateQuery(receiverEventsKey, {
824
+ refreshInterval: active ? 1e4 : 0,
825
+ revalidateOnFocus: false
826
+ });
827
+ const { latestEvent, pendingCount, explorerUrl } = react.useMemo(() => {
828
+ const events = eventsData ?? [];
829
+ if (!events.length) {
830
+ return {
831
+ latestEvent: void 0,
832
+ pendingCount: 0,
833
+ explorerUrl: void 0
834
+ };
835
+ }
836
+ const latest = events.reduce((acc, curr) => {
837
+ if (!acc) return curr;
838
+ return curr.created_time > acc.created_time ? curr : acc;
839
+ }, void 0);
840
+ const count = events.length;
841
+ const url = latest?.tx_id ? buildExplorerUrl(explorerBaseUrl, latest.tx_id) : void 0;
842
+ return {
843
+ latestEvent: latest,
844
+ pendingCount: count,
845
+ explorerUrl: url
846
+ };
847
+ }, [explorerBaseUrl, eventsData]);
848
+ return {
849
+ address: addressData?.receiver_address,
850
+ qrUri: addressData?.receiver_address,
851
+ minimumDeposit: addressData?.minimum_deposit,
852
+ estimatedArrivalText: t("transfer.exclusiveDeposit.estimatedTime.default"),
853
+ latestEvent,
854
+ pendingCount,
855
+ explorerUrl,
856
+ isAddressLoading,
857
+ isEventsLoading,
858
+ addressError,
859
+ eventsError
860
+ };
861
+ };
862
+ var SUPPORTED_CHAINS = {
863
+ prod: [42161],
864
+ testnet: [421614]
865
+ };
866
+ var SUPPORTED_TOKENS = ["USDC"];
867
+ var useExclusiveDepositOptions = () => {
868
+ const env = hooks.useConfig("env");
869
+ const networkId = hooks.useConfig("networkId");
870
+ const [chains, { findByChainId }] = hooks.useChains(networkId, {
871
+ pick: "network_infos"
872
+ });
873
+ const supportedChainIds = env === "prod" ? SUPPORTED_CHAINS.prod : SUPPORTED_CHAINS.testnet;
874
+ const networkOptions = react.useMemo(() => {
875
+ return supportedChainIds.map((chainId) => {
876
+ const chain = findByChainId(chainId);
877
+ const name = chain?.network_infos?.name ?? `Chain ${chainId}`;
878
+ const explorerUrl = chain?.network_infos?.explorer_base_url ?? "";
879
+ return {
880
+ label: name,
881
+ value: String(chainId),
882
+ chainId,
883
+ explorerUrl
884
+ };
885
+ });
886
+ }, [supportedChainIds, findByChainId]);
887
+ const tokenOptions = react.useMemo(() => {
888
+ return SUPPORTED_TOKENS.map((symbol) => ({
889
+ label: symbol,
890
+ value: symbol
891
+ }));
892
+ }, []);
893
+ return { networkOptions, tokenOptions };
894
+ };
895
+ var ExclusiveDeposit = ({ active }) => {
896
+ const { t: t0 } = i18n.useTranslation();
897
+ const t = t0;
898
+ const [selectedNetwork, setSelectedNetwork] = react.useState("");
899
+ const [selectedToken, setSelectedToken] = react.useState("");
900
+ const { networkOptions, tokenOptions } = useExclusiveDepositOptions();
901
+ const confirmed = !!selectedNetwork && !!selectedToken;
902
+ const selectedNetworkOption = selectedNetwork ? networkOptions.find((n) => n.value === selectedNetwork) : void 0;
903
+ const selectedChainId = selectedNetworkOption?.chainId;
904
+ const selectedTokenOption = selectedToken ? tokenOptions.find((t2) => t2.value === selectedToken) : void 0;
905
+ const {
906
+ address,
907
+ qrUri,
908
+ minimumDeposit,
909
+ estimatedArrivalText,
910
+ latestEvent,
911
+ pendingCount,
912
+ explorerUrl
913
+ } = useExclusiveDeposit({
914
+ active,
915
+ confirmed,
916
+ chainId: selectedChainId,
917
+ explorerBaseUrl: selectedNetworkOption?.explorerUrl ?? ""
918
+ });
919
+ const networkName = selectedNetworkOption?.label ?? "";
920
+ const tokenName = selectedTokenOption?.label ?? "";
921
+ const warningMessage = confirmed ? t("transfer.exclusiveDeposit.warning", {
922
+ token: tokenName,
923
+ network: networkName
924
+ }) : t("transfer.exclusiveDeposit.selectFirst");
925
+ const minText = confirmed && typeof minimumDeposit === "number" ? `${minimumDeposit} ${tokenName}` : "--";
926
+ const estText = confirmed ? estimatedArrivalText ?? t("transfer.exclusiveDeposit.estimatedTime.default") : "--";
927
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { className: "oui-flex oui-flex-col oui-items-center oui-rounded-xl oui-bg-base-8 oui-tracking-[0.03em]", children: [
928
+ /* @__PURE__ */ jsxRuntime.jsx(WarningBanner, { message: warningMessage }),
929
+ confirmed && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
930
+ /* @__PURE__ */ jsxRuntime.jsx(QRCodeDisplay, { address: qrUri }),
931
+ address && /* @__PURE__ */ jsxRuntime.jsx(CopyAddress, { address })
932
+ ] }),
933
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 2, className: "oui-mt-5 oui-w-full", children: [
934
+ confirmed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
935
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { className: "oui-w-full", justify: "between", itemAlign: "center", children: [
936
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xs", intensity: 36, children: t("common.network") }),
937
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 1, itemAlign: "center", children: [
938
+ /* @__PURE__ */ jsxRuntime.jsx(ui.ChainIcon, { chainId: selectedChainId, size: "2xs" }),
939
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xs", intensity: 98, children: networkName })
940
+ ] })
941
+ ] }),
942
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { className: "oui-w-full", justify: "between", itemAlign: "center", children: [
943
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xs", intensity: 36, children: t("common.token") }),
944
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 1, itemAlign: "center", children: [
945
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TokenIcon, { name: tokenName, size: "2xs" }),
946
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xs", intensity: 98, children: tokenName })
947
+ ] })
948
+ ] })
949
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
950
+ NetworkTokenSelect,
951
+ {
952
+ selectedNetwork,
953
+ selectedToken,
954
+ onNetworkChange: setSelectedNetwork,
955
+ onTokenChange: setSelectedToken,
956
+ networkOptions,
957
+ tokenOptions
958
+ }
959
+ ),
960
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { className: "oui-w-full", justify: "between", children: [
961
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xs", intensity: 36, children: t("transfer.exclusiveDeposit.minDeposit") }),
962
+ /* @__PURE__ */ jsxRuntime.jsx(
963
+ ui.Text,
964
+ {
965
+ size: "xs",
966
+ className: confirmed ? "oui-text-[#FF7D00]" : "",
967
+ intensity: confirmed ? void 0 : 98,
968
+ children: minText
969
+ }
970
+ )
971
+ ] }),
972
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { className: "oui-w-full", justify: "between", children: [
973
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xs", intensity: 36, children: t("transfer.exclusiveDeposit.estimatedTime") }),
974
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xs", intensity: 98, children: estText })
975
+ ] })
976
+ ] }),
977
+ confirmed && latestEvent && explorerUrl && /* @__PURE__ */ jsxRuntime.jsx(
978
+ DepositStatusBlock,
979
+ {
980
+ amount: latestEvent.amount,
981
+ symbol: latestEvent.token,
982
+ pendingCount,
983
+ explorerUrl
984
+ }
985
+ )
986
+ ] });
987
+ };
601
988
  var Fee = (props) => {
602
989
  const { dstGasFee, feeQty, feeAmount, dp, nativeSymbol } = props;
603
990
  const { t } = i18n.useTranslation();
@@ -1522,7 +1909,10 @@ var DepositForm = (props) => {
1522
1909
  showSourceDepositCap,
1523
1910
  showTargetDepositCap,
1524
1911
  slippageValidate,
1525
- quantityNotional
1912
+ quantityNotional,
1913
+ activeSubTab,
1914
+ setActiveSubTab,
1915
+ showExclusiveDeposit
1526
1916
  } = props;
1527
1917
  const { t } = i18n.useTranslation();
1528
1918
  const tokenValueFormatter = (value) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -1583,101 +1973,129 @@ var DepositForm = (props) => {
1583
1973
  /* @__PURE__ */ jsxRuntime.jsx(Fee, { ...fee, nativeSymbol: props.nativeSymbol })
1584
1974
  ] });
1585
1975
  };
1586
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { id: "oui-deposit-form", className: ui.textVariants({ weight: "semibold" }), children: [
1587
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { className: "oui-mb-6 lg:oui-mb-8", children: [
1588
- /* @__PURE__ */ jsxRuntime.jsx(Web3Wallet, {}),
1589
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { mt: 3, mb: 1, children: [
1590
- /* @__PURE__ */ jsxRuntime.jsx(
1591
- ChainSelect,
1976
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { id: "oui-deposit-form", className: ui.textVariants({ weight: "semibold" }), children: /* @__PURE__ */ jsxRuntime.jsxs(
1977
+ ui.Tabs,
1978
+ {
1979
+ value: activeSubTab,
1980
+ onValueChange: (value) => setActiveSubTab(value),
1981
+ variant: "contained",
1982
+ classNames: {
1983
+ tabsList: "oui-w-fit"
1984
+ },
1985
+ children: [
1986
+ /* @__PURE__ */ jsxRuntime.jsxs(
1987
+ ui.TabPanel,
1592
1988
  {
1593
- chains,
1594
- value: currentChain,
1595
- onValueChange: onChainChange,
1596
- wrongNetwork,
1597
- loading: settingChain,
1598
- disabled: !props.isLoggedIn
1989
+ title: t("transfer.deposit.tab.connectedWallet"),
1990
+ value: "web3",
1991
+ children: [
1992
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { className: "oui-mt-3", children: [
1993
+ /* @__PURE__ */ jsxRuntime.jsx(Web3Wallet, {}),
1994
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { mt: 3, mb: 1, children: [
1995
+ /* @__PURE__ */ jsxRuntime.jsx(
1996
+ ChainSelect,
1997
+ {
1998
+ chains,
1999
+ value: currentChain,
2000
+ onValueChange: onChainChange,
2001
+ wrongNetwork,
2002
+ loading: settingChain,
2003
+ disabled: !props.isLoggedIn
2004
+ }
2005
+ ),
2006
+ /* @__PURE__ */ jsxRuntime.jsx(
2007
+ QuantityInput,
2008
+ {
2009
+ "data-testId": "oui-testid-deposit-dialog-quantity-input",
2010
+ classNames: {
2011
+ root: "oui-mt-[2px] oui-rounded-t-sm oui-rounded-b-xl"
2012
+ },
2013
+ value: quantity,
2014
+ onValueChange: onQuantityChange,
2015
+ token: sourceToken,
2016
+ tokens: sourceTokens,
2017
+ onTokenChange: onSourceTokenChange,
2018
+ status: inputStatus,
2019
+ hintMessage,
2020
+ tokenShowCaret: !showSourceDepositCap && sourceTokens?.length > 1,
2021
+ tokenValueFormatter: showSourceDepositCap ? tokenValueFormatter : void 0,
2022
+ disabled: !props.isLoggedIn,
2023
+ balancesRevalidating: batchBalancesRevalidating,
2024
+ showBalance: true
2025
+ }
2026
+ )
2027
+ ] }),
2028
+ /* @__PURE__ */ jsxRuntime.jsx(
2029
+ AvailableQuantity,
2030
+ {
2031
+ token: sourceToken,
2032
+ quantity,
2033
+ maxQuantity,
2034
+ notional: quantityNotional,
2035
+ loading: balanceRevalidating,
2036
+ onClick: () => {
2037
+ onQuantityChange(maxDepositAmount);
2038
+ }
2039
+ }
2040
+ ),
2041
+ /* @__PURE__ */ jsxRuntime.jsx(
2042
+ YieldBearingReminder,
2043
+ {
2044
+ symbol: targetToken?.symbol,
2045
+ className: "oui-mt-3"
2046
+ }
2047
+ ),
2048
+ /* @__PURE__ */ jsxRuntime.jsx(ExchangeDivider, {}),
2049
+ /* @__PURE__ */ jsxRuntime.jsx(BrokerWallet, {}),
2050
+ /* @__PURE__ */ jsxRuntime.jsx(
2051
+ QuantityInput,
2052
+ {
2053
+ classNames: {
2054
+ root: "oui-mt-3 oui-border-transparent focus-within:oui-outline-transparent"
2055
+ },
2056
+ token: targetToken,
2057
+ tokens: targetTokens,
2058
+ onTokenChange: onTargetTokenChange,
2059
+ value: targetQuantity,
2060
+ loading: targetQuantityLoading,
2061
+ disabled: !props.isLoggedIn,
2062
+ readOnly: true,
2063
+ status: targetInputStatus,
2064
+ hintMessage: targetHintMessage,
2065
+ tokenShowCaret: !showTargetDepositCap && targetTokens?.length > 1,
2066
+ tokenValueFormatter: showTargetDepositCap ? tokenValueFormatter : void 0
2067
+ }
2068
+ ),
2069
+ renderContent()
2070
+ ] }),
2071
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { className: "oui-mb-6 lg:oui-mb-8", children: /* @__PURE__ */ jsxRuntime.jsx(Notice, { message: warningMessage, wrongNetwork }) }),
2072
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { justify: "center", children: /* @__PURE__ */ jsxRuntime.jsx(
2073
+ ActionButton,
2074
+ {
2075
+ actionType,
2076
+ symbol: sourceToken?.symbol,
2077
+ disabled,
2078
+ loading,
2079
+ onDeposit,
2080
+ onApprove,
2081
+ onApproveAndDeposit,
2082
+ networkId
2083
+ }
2084
+ ) })
2085
+ ]
1599
2086
  }
1600
2087
  ),
1601
- /* @__PURE__ */ jsxRuntime.jsx(
1602
- QuantityInput,
2088
+ showExclusiveDeposit && /* @__PURE__ */ jsxRuntime.jsx(
2089
+ ui.TabPanel,
1603
2090
  {
1604
- "data-testId": "oui-testid-deposit-dialog-quantity-input",
1605
- classNames: {
1606
- root: "oui-mt-[2px] oui-rounded-t-sm oui-rounded-b-xl"
1607
- },
1608
- value: quantity,
1609
- onValueChange: onQuantityChange,
1610
- token: sourceToken,
1611
- tokens: sourceTokens,
1612
- onTokenChange: onSourceTokenChange,
1613
- status: inputStatus,
1614
- hintMessage,
1615
- tokenShowCaret: !showSourceDepositCap && sourceTokens?.length > 1,
1616
- tokenValueFormatter: showSourceDepositCap ? tokenValueFormatter : void 0,
1617
- disabled: !props.isLoggedIn,
1618
- balancesRevalidating: batchBalancesRevalidating,
1619
- showBalance: true
2091
+ title: t("transfer.deposit.tab.exchangeOrOtherWallet"),
2092
+ value: "exclusive_deposit",
2093
+ children: /* @__PURE__ */ jsxRuntime.jsx(ExclusiveDeposit, { active: activeSubTab === "exclusive_deposit" })
1620
2094
  }
1621
2095
  )
1622
- ] }),
1623
- /* @__PURE__ */ jsxRuntime.jsx(
1624
- AvailableQuantity,
1625
- {
1626
- token: sourceToken,
1627
- quantity,
1628
- maxQuantity,
1629
- notional: quantityNotional,
1630
- loading: balanceRevalidating,
1631
- onClick: () => {
1632
- onQuantityChange(maxDepositAmount);
1633
- }
1634
- }
1635
- ),
1636
- /* @__PURE__ */ jsxRuntime.jsx(
1637
- YieldBearingReminder,
1638
- {
1639
- symbol: targetToken?.symbol,
1640
- className: "oui-mt-3"
1641
- }
1642
- ),
1643
- /* @__PURE__ */ jsxRuntime.jsx(ExchangeDivider, {}),
1644
- /* @__PURE__ */ jsxRuntime.jsx(BrokerWallet, {}),
1645
- /* @__PURE__ */ jsxRuntime.jsx(
1646
- QuantityInput,
1647
- {
1648
- classNames: {
1649
- root: "oui-mt-3 oui-border-transparent focus-within:oui-outline-transparent"
1650
- },
1651
- token: targetToken,
1652
- tokens: targetTokens,
1653
- onTokenChange: onTargetTokenChange,
1654
- value: targetQuantity,
1655
- loading: targetQuantityLoading,
1656
- disabled: !props.isLoggedIn,
1657
- readOnly: true,
1658
- status: targetInputStatus,
1659
- hintMessage: targetHintMessage,
1660
- tokenShowCaret: !showTargetDepositCap && targetTokens?.length > 1,
1661
- tokenValueFormatter: showTargetDepositCap ? tokenValueFormatter : void 0
1662
- }
1663
- ),
1664
- renderContent()
1665
- ] }),
1666
- /* @__PURE__ */ jsxRuntime.jsx(Notice, { message: warningMessage, wrongNetwork }),
1667
- /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { justify: "center", children: /* @__PURE__ */ jsxRuntime.jsx(
1668
- ActionButton,
1669
- {
1670
- actionType,
1671
- symbol: sourceToken?.symbol,
1672
- disabled,
1673
- loading,
1674
- onDeposit,
1675
- onApprove,
1676
- onApproveAndDeposit,
1677
- networkId
1678
- }
1679
- ) })
1680
- ] });
2096
+ ]
2097
+ }
2098
+ ) });
1681
2099
  };
1682
2100
  function useActionType(options2) {
1683
2101
  const { allowance, quantity, maxQuantity } = options2;
@@ -3863,6 +4281,8 @@ var useDepositFormScript = (options2) => {
3863
4281
  const disabled = !sourceToken || !quantity || Number(quantity) === 0 || depositDisabled || loading || !!swapErrorMessage;
3864
4282
  const targetQuantityLoading = swapPriceRevalidating;
3865
4283
  const warningMessage = validationMessage || swapErrorMessage;
4284
+ const [activeSubTab, setActiveSubTab] = react.useState("web3");
4285
+ const showExclusiveDeposit = account2.walletAdapter?.chainNamespace !== types.ChainNamespace.solana;
3866
4286
  return {
3867
4287
  sourceToken,
3868
4288
  targetToken,
@@ -3916,7 +4336,10 @@ var useDepositFormScript = (options2) => {
3916
4336
  isLoggedIn,
3917
4337
  showSourceDepositCap,
3918
4338
  showTargetDepositCap,
3919
- quantityNotional
4339
+ quantityNotional,
4340
+ activeSubTab,
4341
+ setActiveSubTab,
4342
+ showExclusiveDeposit
3920
4343
  };
3921
4344
  };
3922
4345
  var DepositFormWidget = (props) => {