@orderly.network/wallet-connector-privy 2.5.2 → 2.5.3-alpha.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,10 +1,10 @@
1
- import React19, { createContext, useMemo, useContext, useState, useRef, useEffect, useCallback } from 'react';
1
+ import React19, { createContext, useState, useEffect, useMemo, useContext, useRef, useCallback } from 'react';
2
2
  import * as viemExport from 'viem';
3
3
  import { defineChain } from 'viem';
4
4
  import { mainnet, abstract, abstractTestnet } from 'viem/chains';
5
- import { useWalletConnector, useAccount, useSWR, WalletConnectorContext, useTrack, useStorageLedgerAddress, useLocalStorage, useStorageChain } from '@orderly.network/hooks';
5
+ import { useWalletConnector, useAccount, useSWR, fetcher, WalletConnectorContext, useTrack, useStorageLedgerAddress, useLocalStorage, useStorageChain } from '@orderly.network/hooks';
6
6
  import { SOLANA_TESTNET_CHAINID, SOLANA_MAINNET_CHAINID, ChainNamespace, ABSTRACT_CHAIN_ID_MAP, AccountStatusEnum, ABSTRACT_TESTNET_CHAINID, ABSTRACT_MAINNET_CHAINID, SolanaChains as SolanaChains$1, AbstractChains, AbstractTestnetChainInfo, ArbitrumSepoliaChainInfo, SolanaDevnetChainInfo, TrackerEventName, ConnectorKey } from '@orderly.network/types';
7
- import { installExtension, ExtensionPositionEnum, useScreen, Button, Text, formatAddress, cn, TooltipProvider, CloseIcon, ScrollArea, ExclamationFillIcon, Tooltip, CopyIcon, Checkbox, toast, DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuContent, DropdownMenuItem, Flex, ChevronDownIcon, ChevronUpIcon, SimpleDialog, ChainIcon, Popover, modal } from '@orderly.network/ui';
7
+ import { modal, useModal, SimpleSheet, SheetHeader, Text, Flex, Grid, Divider, cn, installExtension, ExtensionPositionEnum, useScreen, formatAddress, Button, SimpleDialog, TooltipProvider, CloseIcon, ScrollArea, ExclamationFillIcon, Tooltip, CopyIcon, Checkbox, toast, DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuContent, DropdownMenuItem, ChevronDownIcon, ChevronUpIcon, ChainIcon, Popover } from '@orderly.network/ui';
8
8
  import { useTranslation, Trans } from '@orderly.network/i18n';
9
9
  import { AbstractWalletProvider as AbstractWalletProvider$1, useLoginWithAbstract, useAbstractClient, useGlobalWalletSignerAccount } from '@abstract-foundation/agw-react';
10
10
  import * as WagmiExport from 'wagmi';
@@ -14,7 +14,6 @@ import { WalletAdapterNetwork } from '@solana/wallet-adapter-base';
14
14
  import { PrivyProvider, usePrivy, useWallets, useSolanaWallets } from '@privy-io/react-auth';
15
15
  import { WalletProvider, useWallet } from '@solana/wallet-adapter-react';
16
16
  import { create } from 'zustand';
17
- import { createPortal } from 'react-dom';
18
17
  import { AuthGuard } from '@orderly.network/ui-connector';
19
18
  import { PhantomWalletAdapter } from '@solana/wallet-adapter-wallets';
20
19
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
@@ -724,60 +723,227 @@ function useWagmiWallet() {
724
723
  }
725
724
  return context;
726
725
  }
727
- function Drawer({ children, isOpen, onClose }) {
728
- const [windowHeight, setWindowHeight] = useState(0);
729
- const { isMobile } = useScreen();
726
+ var MoreIcon = (props) => /* @__PURE__ */ React19.createElement(
727
+ "svg",
728
+ {
729
+ xmlns: "http://www.w3.org/2000/svg",
730
+ width: "16",
731
+ height: "16",
732
+ viewBox: "0 0 16 16",
733
+ fill: "currentColor",
734
+ ...props
735
+ },
736
+ /* @__PURE__ */ React19.createElement("path", { d: "M8.00521 6.66797C8.74161 6.66797 9.33854 7.26464 9.33854 8.0013C9.33854 8.73797 8.74161 9.33464 8.00521 9.33464C7.26881 9.33464 6.67188 8.73797 6.67188 8.0013C6.67188 7.26464 7.26881 6.66797 8.00521 6.66797Z" }),
737
+ /* @__PURE__ */ React19.createElement("path", { d: "M3.33333 6.66797C4.06973 6.66797 4.66667 7.26464 4.66667 8.0013C4.66667 8.73797 4.06973 9.33464 3.33333 9.33464C2.59693 9.33464 2 8.73797 2 8.0013C2 7.26464 2.59693 6.66797 3.33333 6.66797Z" }),
738
+ /* @__PURE__ */ React19.createElement("path", { d: "M12.6666 6.66797C13.403 6.66797 14 7.26464 14 8.0013C14 8.73797 13.403 9.33464 12.6666 9.33464C11.9302 9.33464 11.3333 8.73797 11.3333 8.0013C11.3333 7.26464 11.9302 6.66797 12.6666 6.66797Z" })
739
+ );
740
+ var DisconnectIcon = (props) => /* @__PURE__ */ React19.createElement(
741
+ "svg",
742
+ {
743
+ width: "16",
744
+ height: "16",
745
+ viewBox: "0 0 16 16",
746
+ xmlns: "http://www.w3.org/2000/svg",
747
+ fill: "currentColor",
748
+ ...props
749
+ },
750
+ /* @__PURE__ */ React19.createElement("g", { id: "box-arrow-right" }, /* @__PURE__ */ React19.createElement(
751
+ "path",
752
+ {
753
+ id: "Vector",
754
+ d: "M1.99365 4.66056C1.99365 3.1879 3.18759 1.9939 4.66032 1.9939H7.32698C8.79965 1.9939 9.99365 3.1879 9.99365 4.66056C9.99365 5.02856 9.69498 5.32723 9.32698 5.32723C8.95898 5.32723 8.66032 5.02856 8.66032 4.66056C8.66032 3.92389 8.06365 3.32723 7.32698 3.32723H4.66032C3.92392 3.32723 3.32699 3.92389 3.32699 4.66056V11.3272C3.32699 12.0639 3.92392 12.6606 4.66032 12.6606H7.32698C8.06365 12.6606 8.66032 12.0639 8.66032 11.3272C8.66032 10.9592 8.95898 10.6606 9.32698 10.6606C9.69498 10.6606 9.99365 10.9592 9.99365 11.3272C9.99365 12.7999 8.79965 13.9939 7.32698 13.9939H4.66032C3.18759 13.9939 1.99365 12.7999 1.99365 11.3272V4.66056ZM6.66032 7.99389C6.66032 7.62589 6.95898 7.32722 7.32698 7.32722H12.369L11.0563 5.99389L11.9937 5.05656L14.473 7.51456C14.733 7.77523 14.733 8.21255 14.473 8.47322L11.9937 10.9312L11.0563 9.99389L12.369 8.66056H7.32698C6.95898 8.66056 6.66032 8.36189 6.66032 7.99389Z"
755
+ }
756
+ ))
757
+ );
758
+ var ArrowRightIcon = ({ size, ...props }) => /* @__PURE__ */ React19.createElement(
759
+ "svg",
760
+ {
761
+ width: size,
762
+ height: size,
763
+ viewBox: "0 0 14 14",
764
+ fill: "currentColor",
765
+ xmlns: "http://www.w3.org/2000/svg",
766
+ ...props
767
+ },
768
+ /* @__PURE__ */ React19.createElement("path", { d: "M3.50696 6.9958C3.50696 6.6738 3.76788 6.41305 4.08971 6.41305C4.36842 6.41305 7.62762 6.41305 8.49679 6.41305L6.76662 4.6648L7.58621 3.84521L10.336 6.57697C10.4504 6.69072 10.507 6.84355 10.507 6.99639C10.507 7.14864 10.4498 7.30089 10.336 7.41464L7.58621 10.1464L6.76662 9.3268L8.49679 7.57854C7.62762 7.57854 4.36842 7.57854 4.08971 7.57854C3.76788 7.57854 3.50696 7.3178 3.50696 6.9958Z" })
769
+ );
770
+ var ArrowRightLinearGradientIcon = ({
771
+ size,
772
+ ...props
773
+ }) => /* @__PURE__ */ React19.createElement(
774
+ "svg",
775
+ {
776
+ xmlns: "http://www.w3.org/2000/svg",
777
+ width: size,
778
+ height: size,
779
+ viewBox: "0 0 20 20",
780
+ fill: "none"
781
+ },
782
+ /* @__PURE__ */ React19.createElement(
783
+ "path",
784
+ {
785
+ d: "M5.01001 9.994C5.01001 9.534 5.38276 9.1615 5.84251 9.1615C6.24068 9.1615 10.8967 9.1615 12.1383 9.1615L9.66667 6.664L10.8375 5.49316L14.7658 9.39568C14.9292 9.55818 15.01 9.7765 15.01 9.99484C15.01 10.2123 14.9283 10.4298 14.7658 10.5923L10.8375 14.4948L9.66667 13.324L12.1383 10.8265C10.8967 10.8265 6.24068 10.8265 5.84251 10.8265C5.38276 10.8265 5.01001 10.454 5.01001 9.994Z",
786
+ fill: "url(#paint0_linear_2269_12077)"
787
+ }
788
+ ),
789
+ /* @__PURE__ */ React19.createElement("defs", null, /* @__PURE__ */ React19.createElement(
790
+ "linearGradient",
791
+ {
792
+ id: "paint0_linear_2269_12077",
793
+ x1: "15.01",
794
+ y1: "9.994",
795
+ x2: "5.01001",
796
+ y2: "9.994",
797
+ gradientUnits: "userSpaceOnUse"
798
+ },
799
+ /* @__PURE__ */ React19.createElement("stop", { stopColor: "#59B0FE" }),
800
+ /* @__PURE__ */ React19.createElement("stop", { offset: "1", stopColor: "#26FEFE" })
801
+ ))
802
+ );
803
+ var PwaDialog = modal.create((props) => {
804
+ const { visible, hide, resolve, reject, onOpenChange } = useModal();
805
+ const [domain, setDomain] = useState("");
806
+ const { t } = useTranslation();
730
807
  useEffect(() => {
731
- setWindowHeight(window.innerHeight);
732
- const handleResize = () => {
733
- setWindowHeight(window.innerHeight);
734
- };
735
- window.addEventListener("resize", handleResize);
736
- if (isOpen) {
737
- document.body.style.overflow = "hidden";
738
- } else {
739
- document.body.style.overflow = "auto";
808
+ setDomain(window.location.hostname);
809
+ }, []);
810
+ return /* @__PURE__ */ React19.createElement(SimpleSheet, { open: visible, onOpenChange }, /* @__PURE__ */ React19.createElement(SheetHeader, null, /* @__PURE__ */ React19.createElement(Text, { className: "oui-text-base-contrast-80 oui-text " }, t("connector.privy.pwa.sheetTitle"))), /* @__PURE__ */ React19.createElement(Flex, { direction: "column", gap: 3, className: "oui-w-full" }, /* @__PURE__ */ React19.createElement(Text, { className: "oui-text-base-contrast-80 oui-text " }, t("connector.privy.pwa.description")), /* @__PURE__ */ React19.createElement(Flex, { direction: "column", gap: 4, className: "oui-w-full" }, /* @__PURE__ */ React19.createElement(
811
+ StepItem,
812
+ {
813
+ index: 1,
814
+ title: t("connector.privy.pwa.step1"),
815
+ content: /* @__PURE__ */ React19.createElement(Flex, { className: "oui-w-full oui-bg-dark-8" }, /* @__PURE__ */ React19.createElement(
816
+ Grid,
817
+ {
818
+ rows: 1,
819
+ cols: 3,
820
+ className: "oui-bg-black/[0.08] oui-p-2 oui-h-[52px] oui-rounded-[44px] oui-w-full oui-px-4"
821
+ },
822
+ /* @__PURE__ */ React19.createElement("div", null),
823
+ /* @__PURE__ */ React19.createElement(Text, { className: "oui-text-black/[0.88] oui-text-[20px] oui-leading-[36px] oui-flex-1" }, domain),
824
+ /* @__PURE__ */ React19.createElement(Flex, { itemAlign: "center", justify: "end" }, /* @__PURE__ */ React19.createElement(ShareIcon, null))
825
+ ))
740
826
  }
741
- return () => {
742
- document.body.style.overflow = "auto";
743
- window.removeEventListener("resize", handleResize);
744
- };
745
- }, [isOpen, isMobile]);
746
- if (!isOpen)
747
- return null;
748
- const drawerHeight = isMobile ? windowHeight : windowHeight - 72 - 24;
749
- return createPortal(
750
- /* @__PURE__ */ React19.createElement("div", { className: "oui-fixed oui-inset-0 oui-z-[60]" }, /* @__PURE__ */ React19.createElement(
751
- "div",
827
+ ), /* @__PURE__ */ React19.createElement(
828
+ StepItem,
829
+ {
830
+ index: 2,
831
+ title: t("connector.privy.pwa.step2"),
832
+ classNames: {
833
+ content: "oui-bg-[#e9e9eb]"
834
+ },
835
+ content: /* @__PURE__ */ React19.createElement(
836
+ Flex,
837
+ {
838
+ className: "oui-w-full oui-bg-base-contrast oui-rounded-[12px]",
839
+ direction: "column"
840
+ },
841
+ /* @__PURE__ */ React19.createElement(
842
+ Flex,
843
+ {
844
+ className: "oui-w-full oui-px-4 oui-py-3",
845
+ justify: "start",
846
+ itemAlign: "center"
847
+ },
848
+ /* @__PURE__ */ React19.createElement(Text, { className: "oui-text-black/[0.2] oui-text-[18px]" }, t("connector.privy.pwa.findOnPage"))
849
+ ),
850
+ /* @__PURE__ */ React19.createElement(Divider, { className: "oui-bg-black/[0.15] oui-w-full" }),
851
+ /* @__PURE__ */ React19.createElement(Grid, { cols: 3, className: "oui-w-full oui-px-4 oui-py-3" }, /* @__PURE__ */ React19.createElement(Text, { className: "oui-text-black/[0.88] oui-text-[18px] oui-col-span-2" }, t("connector.privy.pwa.addToHomeScreen")), /* @__PURE__ */ React19.createElement(Flex, { itemAlign: "center", justify: "end" }, /* @__PURE__ */ React19.createElement(AddIcon, null)))
852
+ )
853
+ }
854
+ ))));
855
+ });
856
+ var ShareIcon = () => {
857
+ return /* @__PURE__ */ React19.createElement(
858
+ "svg",
859
+ {
860
+ xmlns: "http://www.w3.org/2000/svg",
861
+ width: "28",
862
+ height: "28",
863
+ viewBox: "0 0 28 28",
864
+ fill: "none"
865
+ },
866
+ /* @__PURE__ */ React19.createElement(
867
+ "path",
752
868
  {
753
- className: "oui-absolute oui-inset-0 oui-bg-[rgba(0,0,0,0.48)] oui-transition-opacity",
754
- onClick: onClose
869
+ d: "M5 23.3333V13.6667C5 12.1939 6.15127 11 7.57143 11H10.6744V12.7778H7.57143C7.09804 12.7778 6.71429 13.1757 6.71429 13.6667V23.3333C6.71429 23.8243 7.09804 24.2222 7.57143 24.2222H20.4286C20.902 24.2222 21.2857 23.8243 21.2857 23.3333V13.6667C21.2857 13.1757 20.902 12.7778 20.4286 12.7778H17.555V11H20.4286C21.8487 11 23 12.1939 23 13.6667V23.3333C23 24.8061 21.8487 26 20.4286 26H7.57143C6.15127 26 5 24.8061 5 23.3333Z",
870
+ fill: "black",
871
+ fillOpacity: "0.48"
755
872
  }
756
- ), /* @__PURE__ */ React19.createElement(
757
- "div",
873
+ ),
874
+ /* @__PURE__ */ React19.createElement(
875
+ "path",
876
+ {
877
+ d: "M13.3759 2.25933C13.7206 1.91356 14.2794 1.91356 14.6241 2.25933L20.2416 7.89432C20.586 8.24011 20.5862 8.80066 20.2416 9.14634C19.897 9.49203 19.3382 9.49185 18.9935 9.14634L14.8827 5.02278V19H13.1173V5.02278L9.00654 9.14634C8.66182 9.49185 8.10301 9.49203 7.7584 9.14634C7.41378 8.80066 7.41396 8.24011 7.7584 7.89432L13.3759 2.25933Z",
878
+ fill: "black",
879
+ fillOpacity: "0.48"
880
+ }
881
+ )
882
+ );
883
+ };
884
+ var AddIcon = () => {
885
+ return /* @__PURE__ */ React19.createElement(
886
+ "svg",
887
+ {
888
+ xmlns: "http://www.w3.org/2000/svg",
889
+ width: "24",
890
+ height: "24",
891
+ viewBox: "0 0 24 24",
892
+ fill: "none"
893
+ },
894
+ /* @__PURE__ */ React19.createElement(
895
+ "path",
896
+ {
897
+ d: "M7.00598 3.92969H17.006C18.6627 3.92969 20.006 5.27297 20.006 6.92969V16.9297C20.006 18.5864 18.6627 19.9297 17.006 19.9297H7.00598C5.34927 19.9297 4.00598 18.5864 4.00598 16.9297V6.92969C4.00598 5.27297 5.34927 3.92969 7.00598 3.92969Z",
898
+ stroke: "black",
899
+ strokeOpacity: "0.88",
900
+ strokeWidth: "2"
901
+ }
902
+ ),
903
+ /* @__PURE__ */ React19.createElement(
904
+ "path",
905
+ {
906
+ d: "M8 12L16 12",
907
+ stroke: "black",
908
+ strokeOpacity: "0.88",
909
+ strokeWidth: "2",
910
+ strokeLinecap: "round"
911
+ }
912
+ ),
913
+ /* @__PURE__ */ React19.createElement(
914
+ "path",
915
+ {
916
+ d: "M12 8L12 16",
917
+ stroke: "black",
918
+ strokeOpacity: "0.88",
919
+ strokeWidth: "2",
920
+ strokeLinecap: "round"
921
+ }
922
+ )
923
+ );
924
+ };
925
+ var StepItem = (props) => {
926
+ return /* @__PURE__ */ React19.createElement(
927
+ Flex,
928
+ {
929
+ className: " oui-rounded-[12px] oui-w-full oui-overflow-hidden",
930
+ direction: "column"
931
+ },
932
+ /* @__PURE__ */ React19.createElement(Flex, { className: "oui-bg-base-4 oui-w-full oui-px-3 oui-py-3 oui-gap-[6px]" }, /* @__PURE__ */ React19.createElement(Text, { className: "oui-text-base-contrast-80 oui-text-xs oui-w-[18px] oui-h-[18px] oui-rounded-[100%] oui-bg-[linear-gradient(270deg,#59B0FE_0%,#26FEFE_100%)] oui-text-center oui-text-black " }, props.index), /* @__PURE__ */ React19.createElement(Text, { className: "oui-text-base-contrast-80 oui-text-xs" }, props.title)),
933
+ /* @__PURE__ */ React19.createElement(
934
+ Flex,
758
935
  {
759
- style: { height: `${drawerHeight}px` },
760
936
  className: cn(
761
- "oui-fixed oui-top-0 oui-right-0",
762
- "oui-bg-[#131519] oui-shadow-lg",
763
- "oui-border oui-border-line-12",
764
- "oui-w-[276px]",
765
- "md:oui-w-[300px]",
766
- "md:oui-top-1/2 md:oui-translate-y-[-50%]",
767
- "oui-rounded-0 md:oui-rounded-2xl",
768
- "md:oui-rounded-0",
769
- "oui-p-4",
770
- "oui-transform oui-transition-transform oui-duration-300 oui-ease-in-out",
771
- "oui-flex oui-flex-col oui-justify-between",
772
- "oui-m-0 md:oui-m-3",
773
- isOpen ? "oui-translate-x-0" : "oui--translate-x-full"
774
- )
937
+ "oui-bg-base-contrast oui-h-[120px] oui-w-full oui-px-6",
938
+ props.classNames?.content
939
+ ),
940
+ justify: "center",
941
+ itemAlign: "center"
775
942
  },
776
- children
777
- )),
778
- document.body
943
+ props.content
944
+ )
779
945
  );
780
- }
946
+ };
781
947
  var OrderlyOSS = "https://oss.orderly.network";
782
948
  var PrivyConnectorImagePath = `${OrderlyOSS}/static/sdk/privy`;
783
949
  var WALLET_ICONS = {
@@ -842,6 +1008,7 @@ function useWallet2() {
842
1008
  } = useAbstractWallet();
843
1009
  const [wallet, setWallet] = useState(null);
844
1010
  const [namespace, setNamespace] = useState(null);
1011
+ const [walletType, setWalletType] = useState(null);
845
1012
  const { storageChain, setStorageChain } = useStorageChain();
846
1013
  const { setOpenConnectDrawer, targetWalletType, setTargetWalletType } = useWalletConnectorPrivy();
847
1014
  const isManual = useRef(false);
@@ -948,11 +1115,11 @@ function useWallet2() {
948
1115
  }
949
1116
  }
950
1117
  };
951
- const switchWallet = (walletType) => {
1118
+ const switchWallet = (walletType2) => {
952
1119
  const fromWallet = wallet?.accounts[0].address;
953
1120
  let toWallet;
954
1121
  if (isPrivy) {
955
- switch (walletType) {
1122
+ switch (walletType2) {
956
1123
  case "EVM" /* EVM */:
957
1124
  if (privyWalletEVM) {
958
1125
  setStorageChain(privyWalletEVM.chain.id);
@@ -967,7 +1134,7 @@ function useWallet2() {
967
1134
  break;
968
1135
  }
969
1136
  } else {
970
- switch (walletType) {
1137
+ switch (walletType2) {
971
1138
  case "EVM" /* EVM */:
972
1139
  if (walletEVM) {
973
1140
  setStorageChain(walletEVM.chain.id);
@@ -993,8 +1160,8 @@ function useWallet2() {
993
1160
  toWallet
994
1161
  });
995
1162
  };
996
- const disconnect = async (walletType) => {
997
- switch (walletType) {
1163
+ const disconnect = async (walletType2) => {
1164
+ switch (walletType2) {
998
1165
  case "privy" /* PRIVY */:
999
1166
  return await disconnectPrivy();
1000
1167
  case "EVM" /* EVM */:
@@ -1005,8 +1172,21 @@ function useWallet2() {
1005
1172
  return disconnectAbstract();
1006
1173
  }
1007
1174
  };
1175
+ const onDisconnect = (parmas) => {
1176
+ if (!walletType) {
1177
+ throw new Error("No wallet type found");
1178
+ }
1179
+ return new Promise((resolve, reject) => {
1180
+ disconnect(walletType).then(() => {
1181
+ resolve(true);
1182
+ }).catch((e) => {
1183
+ reject(e);
1184
+ });
1185
+ });
1186
+ };
1008
1187
  const setNullWalletStatus = () => {
1009
1188
  setWallet(null);
1189
+ setWalletType(null);
1010
1190
  setConnectedChain(null);
1011
1191
  setNamespace(null);
1012
1192
  };
@@ -1020,6 +1200,7 @@ function useWallet2() {
1020
1200
  }
1021
1201
  if (privyWalletEVM) {
1022
1202
  setWallet(privyWalletEVM);
1203
+ setWalletType("privy" /* PRIVY */);
1023
1204
  setConnectedChain(privyWalletEVM.chain);
1024
1205
  setNamespace(ChainNamespace.evm);
1025
1206
  } else {
@@ -1029,6 +1210,7 @@ function useWallet2() {
1029
1210
  if (storageChain?.namespace === ChainNamespace.solana) {
1030
1211
  if (privyWalletSOL) {
1031
1212
  setWallet(privyWalletSOL);
1213
+ setWalletType("privy" /* PRIVY */);
1032
1214
  setConnectedChain(privyWalletSOL.chain);
1033
1215
  setNamespace(ChainNamespace.solana);
1034
1216
  } else {
@@ -1044,6 +1226,7 @@ function useWallet2() {
1044
1226
  if (AbstractChains.has(storageChain.chainId)) {
1045
1227
  if (isConnectedAbstract && walletAbstract) {
1046
1228
  setWallet(walletAbstract);
1229
+ setWalletType("Abstract" /* ABSTRACT */);
1047
1230
  setConnectedChain(connectedChainAbstract);
1048
1231
  setNamespace(ChainNamespace.evm);
1049
1232
  } else {
@@ -1052,6 +1235,7 @@ function useWallet2() {
1052
1235
  } else {
1053
1236
  if (isConnectedEVM && walletEVM) {
1054
1237
  setWallet(walletEVM);
1238
+ setWalletType("EVM" /* EVM */);
1055
1239
  setConnectedChain(connectedChainEvm);
1056
1240
  setNamespace(ChainNamespace.evm);
1057
1241
  } else {
@@ -1062,6 +1246,7 @@ function useWallet2() {
1062
1246
  if (storageChain?.namespace === ChainNamespace.solana) {
1063
1247
  if (isConnectedSOL && walletSOL) {
1064
1248
  setWallet(walletSOL);
1249
+ setWalletType("SOL" /* SOL */);
1065
1250
  setConnectedChain(connectedChainSOL);
1066
1251
  setNamespace(ChainNamespace.solana);
1067
1252
  } else {
@@ -1086,14 +1271,19 @@ function useWallet2() {
1086
1271
  setChain,
1087
1272
  namespace,
1088
1273
  switchWallet,
1089
- disconnect
1274
+ disconnect,
1275
+ onDisconnect
1090
1276
  };
1091
1277
  }
1092
1278
  function AbstractConnectArea({ connect }) {
1279
+ const { isMobile } = useScreen();
1093
1280
  return /* @__PURE__ */ React19.createElement("div", null, /* @__PURE__ */ React19.createElement("div", { className: "oui-mb-2 oui-text-sm oui-font-semibold oui-text-base-contrast-80" }, "Abstract"), /* @__PURE__ */ React19.createElement("div", { className: "oui-grid oui-grid-cols-2 oui-gap-2" }, /* @__PURE__ */ React19.createElement(
1094
1281
  "div",
1095
1282
  {
1096
- className: " oui-flex oui-flex-1 oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-rounded-[6px] oui-bg-[#07080A] oui-px-2 oui-py-[11px]",
1283
+ className: cn(
1284
+ " oui-flex oui-flex-1 oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-rounded-[6px] oui-px-2 oui-py-[11px]",
1285
+ isMobile ? "oui-bg-base-5" : "oui-bg-[#07080A]"
1286
+ ),
1097
1287
  onClick: () => connect()
1098
1288
  },
1099
1289
  /* @__PURE__ */ React19.createElement("div", { className: "oui-flex oui-size-[18px] oui-items-center oui-justify-center" }, /* @__PURE__ */ React19.createElement(
@@ -1107,109 +1297,123 @@ function AbstractConnectArea({ connect }) {
1107
1297
  /* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-base-contrast" }, "Abstract")
1108
1298
  )));
1109
1299
  }
1110
- function PrivyConnectArea({
1111
- connect
1112
- }) {
1300
+ var RenderLoginMethodsDom = ({
1301
+ connect,
1302
+ loginMethods
1303
+ }) => {
1113
1304
  const { t } = useTranslation();
1114
- const { isMobile, isDesktop } = useScreen();
1115
- const { connectorWalletType, privyConfig } = useWalletConnectorPrivy();
1116
- const loginMethods = privyConfig.loginMethods;
1117
- const renderLoginMethodsDom = () => {
1118
- const arr = [];
1119
- if (loginMethods?.includes("email")) {
1120
- arr.push(
1305
+ const { isDesktop } = useScreen();
1306
+ const arr = [];
1307
+ if (loginMethods?.includes("email")) {
1308
+ arr.push(
1309
+ /* @__PURE__ */ React19.createElement(
1310
+ "div",
1311
+ {
1312
+ className: cn(
1313
+ "oui-flex oui-cursor-pointer oui-items-center oui-justify-center oui-gap-1 oui-rounded-[6px] oui-border oui-border-base-contrast-12 oui-px-2 oui-py-[11px]",
1314
+ isDesktop && "oui-border-none oui-bg-[#333948]"
1315
+ ),
1316
+ onClick: () => connect({ walletType: "privy", extraType: "email" })
1317
+ },
1121
1318
  /* @__PURE__ */ React19.createElement(
1122
- "div",
1319
+ "img",
1123
1320
  {
1124
- className: "oui-flex oui-cursor-pointer oui-items-center oui-justify-center oui-gap-1 oui-rounded-[6px] oui-bg-[#333948] oui-px-2 oui-py-[11px]",
1125
- onClick: () => connect({ walletType: "privy", extraType: "email" })
1126
- },
1127
- /* @__PURE__ */ React19.createElement(
1128
- "img",
1129
- {
1130
- src: "https://oss.orderly.network/static/sdk/privy/email.svg",
1131
- className: "oui-size-[18px]"
1132
- }
1321
+ src: "https://oss.orderly.network/static/sdk/privy/email.svg",
1322
+ className: "oui-size-[18px]"
1323
+ }
1324
+ ),
1325
+ isDesktop && /* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-base-contrast" }, t("connector.privy.email"))
1326
+ )
1327
+ );
1328
+ }
1329
+ if (loginMethods?.includes("google")) {
1330
+ arr.push(
1331
+ /* @__PURE__ */ React19.createElement(
1332
+ "div",
1333
+ {
1334
+ className: cn(
1335
+ "oui-flex oui-cursor-pointer oui-items-center oui-justify-center oui-gap-1 oui-rounded-[6px] oui-border oui-border-base-contrast-12 oui-px-2 oui-py-[11px]",
1336
+ isDesktop && "oui-border-none oui-bg-[#335FFC]"
1133
1337
  ),
1134
- /* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-base-contrast" }, t("connector.privy.email"))
1135
- )
1136
- );
1137
- }
1138
- if (loginMethods?.includes("google")) {
1139
- arr.push(
1338
+ onClick: () => connect({ walletType: "privy", extraType: "google" })
1339
+ },
1140
1340
  /* @__PURE__ */ React19.createElement(
1141
- "div",
1341
+ "img",
1142
1342
  {
1143
- className: "oui-flex oui-cursor-pointer oui-items-center oui-justify-center oui-gap-1 oui-rounded-[6px] oui-bg-[#335FFC] oui-px-2 oui-py-[11px]",
1144
- onClick: () => connect({ walletType: "privy", extraType: "google" })
1145
- },
1146
- /* @__PURE__ */ React19.createElement(
1147
- "img",
1148
- {
1149
- src: "https://oss.orderly.network/static/sdk/privy/google.svg",
1150
- className: "oui-size-[18px]"
1151
- }
1343
+ src: "https://oss.orderly.network/static/sdk/privy/google.svg",
1344
+ className: "oui-size-[18px]"
1345
+ }
1346
+ ),
1347
+ isDesktop && /* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-base-contrast" }, t("connector.privy.google"))
1348
+ )
1349
+ );
1350
+ }
1351
+ if (loginMethods?.includes("twitter")) {
1352
+ arr.push(
1353
+ /* @__PURE__ */ React19.createElement(
1354
+ "div",
1355
+ {
1356
+ className: cn(
1357
+ "oui-flex oui-cursor-pointer oui-items-center oui-justify-center oui-gap-1 oui-rounded-[6px] oui-border oui-border-base-contrast-12 oui-px-2 oui-py-[11px]",
1358
+ isDesktop && "oui-border-none oui-bg-[#07080A]"
1152
1359
  ),
1153
- /* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-base-contrast" }, t("connector.privy.google"))
1154
- )
1155
- );
1156
- }
1157
- if (loginMethods?.includes("twitter")) {
1158
- arr.push(
1360
+ onClick: () => connect({ walletType: "privy", extraType: "twitter" })
1361
+ },
1159
1362
  /* @__PURE__ */ React19.createElement(
1160
- "div",
1363
+ "img",
1161
1364
  {
1162
- className: "oui-flex oui-cursor-pointer oui-items-center oui-justify-center oui-gap-1 oui-rounded-[6px] oui-bg-[#07080A] oui-px-2 oui-py-[11px]",
1163
- onClick: () => connect({ walletType: "privy", extraType: "twitter" })
1164
- },
1165
- /* @__PURE__ */ React19.createElement(
1166
- "img",
1167
- {
1168
- src: "https://oss.orderly.network/static/sdk/privy/twitter.svg",
1169
- className: "oui-size-[18px]"
1170
- }
1171
- ),
1172
- /* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-base-contrast" }, t("connector.privy.twitter"))
1173
- )
1174
- );
1175
- }
1176
- return arr.map((item, index) => {
1177
- return /* @__PURE__ */ React19.createElement("div", { key: index }, item);
1178
- });
1179
- };
1180
- return /* @__PURE__ */ React19.createElement("div", { className: "" }, /* @__PURE__ */ React19.createElement(
1181
- "div",
1182
- {
1183
- className: cn(
1184
- "oui-flex oui-items-center oui-justify-between",
1185
- "oui-mb-3 oui-text-sm oui-font-semibold oui-text-base-contrast-80",
1186
- "md:oui-mb-2"
1365
+ src: "https://oss.orderly.network/static/sdk/privy/twitter.svg",
1366
+ className: "oui-size-[18px]"
1367
+ }
1368
+ ),
1369
+ isDesktop && /* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-base-contrast" }, t("connector.privy.twitter"))
1187
1370
  )
1188
- },
1189
- t("connector.privy.loginIn"),
1190
- isMobile && /* @__PURE__ */ React19.createElement("div", { className: "oui-flex oui-h-3 oui-justify-center" }, /* @__PURE__ */ React19.createElement(
1191
- "img",
1192
- {
1193
- src: "https://oss.orderly.network/static/sdk/privy/privy-logo.png",
1194
- className: " oui-h-[10px]"
1195
- }
1196
- ))
1197
- ), /* @__PURE__ */ React19.createElement(
1371
+ );
1372
+ }
1373
+ return arr.map((item, index) => {
1374
+ return /* @__PURE__ */ React19.createElement("div", { key: index }, item);
1375
+ });
1376
+ };
1377
+ var PrivyConnectAreaMobile = ({
1378
+ connect
1379
+ }) => {
1380
+ const { t } = useTranslation();
1381
+ const { isMobile, isDesktop } = useScreen();
1382
+ const { connectorWalletType, privyConfig } = useWalletConnectorPrivy();
1383
+ const loginMethods = privyConfig.loginMethods;
1384
+ return /* @__PURE__ */ React19.createElement(Flex, { direction: "column", className: "oui-w-full" }, /* @__PURE__ */ React19.createElement(Grid, { cols: 3, rows: 1, className: "oui-w-full", gap: 2 }, /* @__PURE__ */ React19.createElement(RenderLoginMethodsDom, { connect, loginMethods })), (!connectorWalletType.disableWagmi || !connectorWalletType.disableSolana) && /* @__PURE__ */ React19.createElement("div", { className: "oui-mt-4 oui-h-px oui-w-full oui-bg-line md:oui-mt-5" }));
1385
+ };
1386
+ var PrivyConnectAreaDesktop = ({
1387
+ connect
1388
+ }) => {
1389
+ const { t } = useTranslation();
1390
+ const { connectorWalletType, privyConfig } = useWalletConnectorPrivy();
1391
+ const loginMethods = privyConfig.loginMethods;
1392
+ return /* @__PURE__ */ React19.createElement(Flex, { direction: "column", gap: 2, itemAlign: "start", className: "oui-w-full" }, /* @__PURE__ */ React19.createElement(
1198
1393
  "div",
1199
1394
  {
1200
1395
  className: cn(
1201
- "oui-grid oui-grid-cols-2 oui-gap-2",
1202
- "md:oui-flex md:oui-flex-col md:oui-gap-2"
1396
+ "oui-flex oui-items-center oui-justify-between",
1397
+ "oui-mb-3 oui-text-sm oui-font-semibold oui-text-base-contrast-80"
1203
1398
  )
1204
1399
  },
1205
- renderLoginMethodsDom()
1206
- ), isDesktop && /* @__PURE__ */ React19.createElement("div", { className: "oui-mt-4 oui-flex oui-h-3 oui-justify-center" }, /* @__PURE__ */ React19.createElement(
1400
+ t("connector.privy.loginIn")
1401
+ ), /* @__PURE__ */ React19.createElement(Grid, { cols: 1, gap: 2, className: "oui-w-full" }, /* @__PURE__ */ React19.createElement(RenderLoginMethodsDom, { connect, loginMethods })), /* @__PURE__ */ React19.createElement("div", { className: "oui-mt-4 oui-flex oui-h-3 oui-justify-center" }, /* @__PURE__ */ React19.createElement(
1207
1402
  "img",
1208
1403
  {
1209
1404
  src: "https://oss.orderly.network/static/sdk/privy/privy-logo.png",
1210
1405
  className: " oui-h-[10px]"
1211
1406
  }
1212
1407
  )), (!connectorWalletType.disableWagmi || !connectorWalletType.disableSolana) && /* @__PURE__ */ React19.createElement("div", { className: "oui-mt-4 oui-h-px oui-w-full oui-bg-line md:oui-mt-5" }));
1408
+ };
1409
+ function PrivyConnectArea({
1410
+ connect
1411
+ }) {
1412
+ const { isDesktop } = useScreen();
1413
+ if (isDesktop) {
1414
+ return /* @__PURE__ */ React19.createElement(PrivyConnectAreaDesktop, { connect });
1415
+ }
1416
+ return /* @__PURE__ */ React19.createElement(PrivyConnectAreaMobile, { connect });
1213
1417
  }
1214
1418
  function RenderPrivyTypeIcon({
1215
1419
  type,
@@ -1324,11 +1528,15 @@ function SOLConnectArea({
1324
1528
  connect
1325
1529
  }) {
1326
1530
  const { wallets } = useSolanaWallet();
1531
+ const { isMobile } = useScreen();
1327
1532
  return /* @__PURE__ */ React19.createElement("div", null, /* @__PURE__ */ React19.createElement("div", { className: "oui-mb-2 oui-text-sm oui-font-semibold oui-text-base-contrast-80" }, "Solana"), /* @__PURE__ */ React19.createElement("div", { className: "oui-grid oui-grid-cols-2 oui-gap-2" }, wallets.map((item, key) => /* @__PURE__ */ React19.createElement(
1328
1533
  "div",
1329
1534
  {
1330
1535
  key,
1331
- className: " oui-flex oui-flex-1 oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-rounded-[6px] oui-bg-[#07080A] oui-px-2 oui-py-[11px]",
1536
+ className: cn(
1537
+ " oui-flex oui-flex-1 oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-rounded-[6px] oui-px-2 oui-py-[11px]",
1538
+ isMobile ? "oui-bg-base-5" : "oui-bg-[#07080A]"
1539
+ ),
1332
1540
  onClick: () => connect(item.adapter)
1333
1541
  },
1334
1542
  /* @__PURE__ */ React19.createElement(RenderWalletIcon, { connector: item.adapter }),
@@ -1337,11 +1545,15 @@ function SOLConnectArea({
1337
1545
  }
1338
1546
  function EVMConnectArea({ connect }) {
1339
1547
  const { connectors } = useWagmiWallet();
1548
+ const { isMobile } = useScreen();
1340
1549
  return /* @__PURE__ */ React19.createElement("div", { className: "" }, /* @__PURE__ */ React19.createElement("div", { className: "oui-mb-2 oui-text-sm oui-font-semibold oui-text-base-contrast-80" }, "EVM"), /* @__PURE__ */ React19.createElement("div", { className: "oui-grid oui-grid-cols-2 oui-gap-2" }, connectors.map((item, key) => /* @__PURE__ */ React19.createElement(
1341
1550
  "div",
1342
1551
  {
1343
1552
  key,
1344
- className: " oui-flex oui-flex-1 oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-rounded-[6px] oui-bg-[#07080A] oui-px-2 oui-py-[11px]",
1553
+ className: cn(
1554
+ " oui-flex oui-flex-1 oui-cursor-pointer oui-items-center oui-justify-start oui-gap-1 oui-rounded-[6px] oui-px-2 oui-py-[11px]",
1555
+ isMobile ? "oui-bg-base-5" : "oui-bg-[#07080A]"
1556
+ ),
1345
1557
  onClick: () => connect(item)
1346
1558
  },
1347
1559
  /* @__PURE__ */ React19.createElement(RenderWalletIcon, { connector: item }),
@@ -1421,60 +1633,8 @@ function RenderConnector() {
1421
1633
  }
1422
1634
  );
1423
1635
  };
1424
- return /* @__PURE__ */ React19.createElement(ScrollArea, { className: "oui-flex oui-grow oui-shrik oui-basis-auto" }, /* @__PURE__ */ React19.createElement("div", { className: cn("oui-flex oui-flex-col oui-gap-4", "md:oui-gap-5") }, renderPrivyConnectArea(), renderWagmiConnectArea(), renderSolanaConnectArea(), renderAbstractConnectArea()));
1636
+ return /* @__PURE__ */ React19.createElement(ScrollArea, { className: "oui-flex oui-grow oui-shrik oui-basis-auto oui-custom-scrollbar" }, /* @__PURE__ */ React19.createElement("div", { className: cn("oui-flex oui-flex-col oui-gap-4", "md:oui-gap-5") }, renderPrivyConnectArea(), renderWagmiConnectArea(), renderSolanaConnectArea(), renderAbstractConnectArea()));
1425
1637
  }
1426
- var MoreIcon = (props) => /* @__PURE__ */ React19.createElement(
1427
- "svg",
1428
- {
1429
- xmlns: "http://www.w3.org/2000/svg",
1430
- width: "16",
1431
- height: "16",
1432
- viewBox: "0 0 16 16",
1433
- fill: "currentColor",
1434
- ...props
1435
- },
1436
- /* @__PURE__ */ React19.createElement("path", { d: "M8.00521 6.66797C8.74161 6.66797 9.33854 7.26464 9.33854 8.0013C9.33854 8.73797 8.74161 9.33464 8.00521 9.33464C7.26881 9.33464 6.67188 8.73797 6.67188 8.0013C6.67188 7.26464 7.26881 6.66797 8.00521 6.66797Z" }),
1437
- /* @__PURE__ */ React19.createElement("path", { d: "M3.33333 6.66797C4.06973 6.66797 4.66667 7.26464 4.66667 8.0013C4.66667 8.73797 4.06973 9.33464 3.33333 9.33464C2.59693 9.33464 2 8.73797 2 8.0013C2 7.26464 2.59693 6.66797 3.33333 6.66797Z" }),
1438
- /* @__PURE__ */ React19.createElement("path", { d: "M12.6666 6.66797C13.403 6.66797 14 7.26464 14 8.0013C14 8.73797 13.403 9.33464 12.6666 9.33464C11.9302 9.33464 11.3333 8.73797 11.3333 8.0013C11.3333 7.26464 11.9302 6.66797 12.6666 6.66797Z" })
1439
- );
1440
- var DisconnectIcon = (props) => /* @__PURE__ */ React19.createElement(
1441
- "svg",
1442
- {
1443
- width: "16",
1444
- height: "16",
1445
- viewBox: "0 0 16 16",
1446
- xmlns: "http://www.w3.org/2000/svg",
1447
- fill: "currentColor",
1448
- ...props
1449
- },
1450
- /* @__PURE__ */ React19.createElement("g", { id: "box-arrow-right" }, /* @__PURE__ */ React19.createElement(
1451
- "path",
1452
- {
1453
- id: "Vector",
1454
- d: "M1.99365 4.66056C1.99365 3.1879 3.18759 1.9939 4.66032 1.9939H7.32698C8.79965 1.9939 9.99365 3.1879 9.99365 4.66056C9.99365 5.02856 9.69498 5.32723 9.32698 5.32723C8.95898 5.32723 8.66032 5.02856 8.66032 4.66056C8.66032 3.92389 8.06365 3.32723 7.32698 3.32723H4.66032C3.92392 3.32723 3.32699 3.92389 3.32699 4.66056V11.3272C3.32699 12.0639 3.92392 12.6606 4.66032 12.6606H7.32698C8.06365 12.6606 8.66032 12.0639 8.66032 11.3272C8.66032 10.9592 8.95898 10.6606 9.32698 10.6606C9.69498 10.6606 9.99365 10.9592 9.99365 11.3272C9.99365 12.7999 8.79965 13.9939 7.32698 13.9939H4.66032C3.18759 13.9939 1.99365 12.7999 1.99365 11.3272V4.66056ZM6.66032 7.99389C6.66032 7.62589 6.95898 7.32722 7.32698 7.32722H12.369L11.0563 5.99389L11.9937 5.05656L14.473 7.51456C14.733 7.77523 14.733 8.21255 14.473 8.47322L11.9937 10.9312L11.0563 9.99389L12.369 8.66056H7.32698C6.95898 8.66056 6.66032 8.36189 6.66032 7.99389Z"
1455
- }
1456
- ))
1457
- );
1458
- var ArrowRightIcon = (props) => /* @__PURE__ */ React19.createElement(
1459
- "svg",
1460
- {
1461
- width: "16",
1462
- height: "16",
1463
- viewBox: "0 0 14 14",
1464
- fill: "currentColor",
1465
- xmlns: "http://www.w3.org/2000/svg",
1466
- ...props
1467
- },
1468
- /* @__PURE__ */ React19.createElement(
1469
- "path",
1470
- {
1471
- d: "M3.50696 6.9958C3.50696 6.6738 3.76788 6.41305 4.08971 6.41305C4.36842 6.41305 7.62762 6.41305 8.49679 6.41305L6.76662 4.6648L7.58621 3.84521L10.336 6.57697C10.4504 6.69072 10.507 6.84355 10.507 6.99639C10.507 7.14864 10.4498 7.30089 10.336 7.41464L7.58621 10.1464L6.76662 9.3268L8.49679 7.57854C7.62762 7.57854 4.36842 7.57854 4.08971 7.57854C3.76788 7.57854 3.50696 7.3178 3.50696 6.9958Z",
1472
- fill: "#FF7D00"
1473
- }
1474
- )
1475
- );
1476
-
1477
- // src/components/switchNetworkTips.tsx
1478
1638
  function SwitchNetworkTips({
1479
1639
  tipsContent
1480
1640
  }) {
@@ -1510,7 +1670,7 @@ function SwitchNetworkTips({
1510
1670
  ), /* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-warning-darken" }, t("connector.privy.switchNetwork.tips", {
1511
1671
  chainName: tipsContent
1512
1672
  }))),
1513
- /* @__PURE__ */ React19.createElement(ArrowRightIcon, null)
1673
+ /* @__PURE__ */ React19.createElement(ArrowRightIcon, { className: "oui-text-[#FF7D00]" })
1514
1674
  );
1515
1675
  }
1516
1676
  var StorageChainNotCurrentWalletType = ({
@@ -2357,56 +2517,237 @@ function ConnectDrawer(props) {
2357
2517
  connectorKey
2358
2518
  ]);
2359
2519
  const { isMobile } = useScreen();
2520
+ const showPwaDialog = () => {
2521
+ modal.show(PwaDialog);
2522
+ };
2360
2523
  const renderHeader = useCallback(() => {
2361
- if (isMobile && props.headerProps?.mobile) {
2362
- return props.headerProps?.mobile;
2363
- }
2364
2524
  return /* @__PURE__ */ React19.createElement(
2365
2525
  "div",
2366
2526
  {
2367
2527
  className: cn(
2368
2528
  "oui-font-semibold oui-text-base-contrast-80 ",
2369
- "oui-py-2 oui-text-[20px]",
2529
+ "oui-pb-2 oui-text-[20px]",
2370
2530
  "md:oui-py-0 md:oui-text-base"
2371
2531
  )
2372
2532
  },
2373
2533
  isConnected ? t("connector.privy.myWallet") : t("connector.connectWallet")
2374
2534
  );
2375
- }, [isMobile, props.headerProps?.mobile, isConnected]);
2376
- return /* @__PURE__ */ React19.createElement(Drawer, { isOpen: props.open, onClose: () => props.onChangeOpen(false) }, !isMobile && /* @__PURE__ */ React19.createElement(
2377
- "div",
2535
+ }, [isConnected]);
2536
+ return /* @__PURE__ */ React19.createElement(
2537
+ SimpleSheet,
2378
2538
  {
2379
- className: "oui-absolute oui-inset-x-[50px] -oui-top-[calc(100vh/2)] oui-z-0 oui-h-screen",
2380
- style: {
2381
- background: "conic-gradient(from -41deg at 40.63% 50.41%, rgba(242, 98, 181, 0.00) 125.17920970916748deg, rgba(95, 197, 255, 0.20) 193.4119462966919deg, rgba(255, 172, 137, 0.20) 216.0206937789917deg, rgba(129, 85, 255, 0.20) 236.0708713531494deg, rgba(120, 157, 255, 0.20) 259.95326042175293deg, rgba(159, 115, 241, 0.00) 311.0780096054077deg)",
2382
- filter: "blur(50px)"
2539
+ open: props.open,
2540
+ onOpenChange: props.onChangeOpen,
2541
+ classNames: {
2542
+ body: "oui-h-full oui-py-0 oui-border-none oui-relative",
2543
+ // overlay: "!oui-bg-base-10/60",
2544
+ content: cn(
2545
+ "!oui-p-4 !oui-bg-[#131519] !oui-border !oui-border-solid !oui-border-line-12",
2546
+ isMobile ? "oui-inset-y-0 oui-right-0 oui-w-[280px] oui-rounded-none !oui-bg-[#181C23]" : "!oui-bottom-[30px] oui-right-3 oui-top-[48px] !oui-h-auto oui-w-[300px] oui-overflow-hidden oui-rounded-[16px] !oui-bg-[#131519] "
2547
+ )
2548
+ },
2549
+ contentProps: { side: "right", closeable: false }
2550
+ },
2551
+ !isMobile && /* @__PURE__ */ React19.createElement(
2552
+ "div",
2553
+ {
2554
+ className: "oui-absolute oui-inset-x-[50px] -oui-top-[calc(100vh/2)] oui-z-0 oui-h-screen",
2555
+ style: {
2556
+ background: "conic-gradient(from -41deg at 40.63% 50.41%, rgba(242, 98, 181, 0.00) 125.17920970916748deg, rgba(95, 197, 255, 0.20) 193.4119462966919deg, rgba(255, 172, 137, 0.20) 216.0206937789917deg, rgba(129, 85, 255, 0.20) 236.0708713531494deg, rgba(120, 157, 255, 0.20) 259.95326042175293deg, rgba(159, 115, 241, 0.00) 311.0780096054077deg)",
2557
+ filter: "blur(50px)"
2558
+ }
2383
2559
  }
2384
- }
2385
- ), /* @__PURE__ */ React19.createElement("div", { className: "oui-relative oui-z-10 oui-flex oui-h-full oui-flex-col oui-gap-4 md:oui-gap-5" }, /* @__PURE__ */ React19.createElement("div", { className: "oui-flex oui-flex-none oui-items-center oui-justify-between" }, renderHeader(), /* @__PURE__ */ React19.createElement(
2386
- CloseIcon,
2560
+ ),
2561
+ /* @__PURE__ */ React19.createElement("div", { className: "oui-relative oui-z-10 oui-flex oui-h-full oui-flex-col oui-gap-4 md:oui-gap-5" }, /* @__PURE__ */ React19.createElement("div", { className: "oui-flex oui-flex-none oui-items-center oui-justify-between" }, renderHeader(), /* @__PURE__ */ React19.createElement(
2562
+ CloseIcon,
2563
+ {
2564
+ className: "oui-size-5 oui-cursor-pointer oui-text-base-contrast-20 hover:oui-text-base-contrast-80",
2565
+ onClick: () => props.onChangeOpen(false)
2566
+ }
2567
+ )), isConnected ? /* @__PURE__ */ React19.createElement(MyWallet, null) : /* @__PURE__ */ React19.createElement(RenderConnector, null), !isConnected && /* @__PURE__ */ React19.createElement(Flex, { gap: 4, direction: "column" }, isMobile && /* @__PURE__ */ React19.createElement(
2568
+ Flex,
2569
+ {
2570
+ itemAlign: "center",
2571
+ justify: "between",
2572
+ gap: 4,
2573
+ className: "oui-rounded-[8px] oui-px-3 oui-py-2 oui-text-2xs oui-bg-[linear-gradient(270deg,rgba(89,176,254,0.10)_0%,rgba(38,254,254,0.10)_100%)] oui-w-full",
2574
+ onClick: () => showPwaDialog()
2575
+ },
2576
+ /* @__PURE__ */ React19.createElement(Text, { className: "oui-bg-[linear-gradient(270deg,#59B0FE_0%,#26FEFE_100%)] oui-bg-clip-text oui-text-transparent" }, t("connector.privy.pwa.title")),
2577
+ /* @__PURE__ */ React19.createElement(
2578
+ ArrowRightLinearGradientIcon,
2579
+ {
2580
+ size: 20,
2581
+ className: "oui-flex-shrink-0"
2582
+ }
2583
+ )
2584
+ ), termsOfUse && /* @__PURE__ */ React19.createElement("div", { className: "oui-flex-none oui-text-center oui-text-2xs oui-font-semibold oui-text-base-contrast-80" }, /* @__PURE__ */ React19.createElement(
2585
+ Trans,
2586
+ {
2587
+ i18nKey: "connector.privy.termsOfUse",
2588
+ components: [
2589
+ /* @__PURE__ */ React19.createElement(
2590
+ "a",
2591
+ {
2592
+ key: "termsOfUse",
2593
+ href: termsOfUse,
2594
+ className: "oui-cursor-pointer oui-text-primary oui-underline",
2595
+ target: "_blank",
2596
+ rel: "noreferrer"
2597
+ }
2598
+ )
2599
+ ]
2600
+ }
2601
+ ))))
2602
+ );
2603
+ }
2604
+ var LinkDeviceMobile = (props) => {
2605
+ const [open, setOpen] = useState(false);
2606
+ const { account } = useAccount();
2607
+ const { t } = useTranslation();
2608
+ const onDisconnect = async () => {
2609
+ localStorage.removeItem("orderly_link_device");
2610
+ await account.disconnect();
2611
+ };
2612
+ const showDialog = () => {
2613
+ setOpen(true);
2614
+ };
2615
+ const hideDialog = () => {
2616
+ setOpen(false);
2617
+ };
2618
+ return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
2619
+ SimpleDialog,
2387
2620
  {
2388
- className: "oui-size-5 oui-cursor-pointer oui-text-base-contrast-20 hover:oui-text-base-contrast-80",
2389
- onClick: () => props.onChangeOpen(false)
2390
- }
2391
- )), isConnected ? /* @__PURE__ */ React19.createElement(MyWallet, null) : /* @__PURE__ */ React19.createElement(RenderConnector, null), !isConnected && termsOfUse && /* @__PURE__ */ React19.createElement("div", { className: "oui-flex-none oui-text-center oui-text-2xs oui-font-semibold oui-text-base-contrast-80" }, /* @__PURE__ */ React19.createElement(
2392
- Trans,
2621
+ open,
2622
+ onOpenChange: setOpen,
2623
+ title: t("common.tips"),
2624
+ size: "xs",
2625
+ actions: {
2626
+ secondary: {
2627
+ label: t("common.cancel"),
2628
+ onClick: hideDialog,
2629
+ size: "md",
2630
+ fullWidth: true
2631
+ },
2632
+ primary: {
2633
+ label: t("connector.disconnect"),
2634
+ onClick: async () => {
2635
+ await onDisconnect();
2636
+ hideDialog();
2637
+ },
2638
+ size: "md",
2639
+ variant: "outlined",
2640
+ color: "danger"
2641
+ }
2642
+ }
2643
+ },
2644
+ /* @__PURE__ */ React19.createElement(Text, { intensity: 54, size: "sm" }, t("linkDevice.scanQRCode.connected.description"))
2645
+ ), /* @__PURE__ */ React19.createElement(Flex, { className: "oui-gap-[6px]", itemAlign: "center", onClick: showDialog }, /* @__PURE__ */ React19.createElement(
2646
+ Flex,
2393
2647
  {
2394
- i18nKey: "connector.privy.termsOfUse",
2395
- components: [
2396
- /* @__PURE__ */ React19.createElement(
2397
- "a",
2398
- {
2399
- key: "termsOfUse",
2400
- href: termsOfUse,
2401
- className: "oui-cursor-pointer oui-text-primary oui-underline",
2402
- target: "_blank",
2403
- rel: "noreferrer"
2404
- }
2405
- )
2406
- ]
2648
+ className: "oui-text-base-contrast",
2649
+ intensity: 500,
2650
+ height: 28,
2651
+ r: "md"
2652
+ },
2653
+ /* @__PURE__ */ React19.createElement(DesktopIcon, null),
2654
+ /* @__PURE__ */ React19.createElement(Dot, null),
2655
+ /* @__PURE__ */ React19.createElement(LinkIcon, null),
2656
+ /* @__PURE__ */ React19.createElement(Dot, null),
2657
+ /* @__PURE__ */ React19.createElement(MobileIcon, null)
2658
+ ), props.children));
2659
+ };
2660
+ var Dot = () => {
2661
+ return /* @__PURE__ */ React19.createElement(Flex, { className: "oui-gap-x-[1px] oui-px-[1px]" }, /* @__PURE__ */ React19.createElement(DotIcon, null), /* @__PURE__ */ React19.createElement(DotIcon, null), /* @__PURE__ */ React19.createElement(DotIcon, null));
2662
+ };
2663
+ var DesktopIcon = (props) => /* @__PURE__ */ React19.createElement(
2664
+ "svg",
2665
+ {
2666
+ width: "18",
2667
+ height: "18",
2668
+ viewBox: "0 0 18 18",
2669
+ fill: "currentColor",
2670
+ xmlns: "http://www.w3.org/2000/svg",
2671
+ ...props
2672
+ },
2673
+ /* @__PURE__ */ React19.createElement("path", { d: "M4.5 2.93a2.25 2.25 0 0 0-2.25 2.25v5.25a.75.75 0 0 0-.75.75v1.5c0 1.272.93 2.25 2.25 2.25h10.5c1.318 0 2.25-.978 2.25-2.25v-1.5a.75.75 0 0 0-.75-.75V5.18a2.25 2.25 0 0 0-2.25-2.25zm0 1.5h9a.75.75 0 0 1 .75.75v5.25H3.75V5.18a.75.75 0 0 1 .75-.75M3 11.93h12v.75c0 .46-.277.75-.75.75H3.75c-.474 0-.75-.29-.75-.75z" })
2674
+ );
2675
+ var MobileIcon = (props) => /* @__PURE__ */ React19.createElement(
2676
+ "svg",
2677
+ {
2678
+ width: "18",
2679
+ height: "18",
2680
+ viewBox: "0 0 18 18",
2681
+ fill: "currentColor",
2682
+ xmlns: "http://www.w3.org/2000/svg",
2683
+ ...props
2684
+ },
2685
+ /* @__PURE__ */ React19.createElement("path", { d: "M13.498 3.715a2.25 2.25 0 0 0-2.25-2.25h-4.5a2.25 2.25 0 0 0-2.25 2.25v10.5a2.25 2.25 0 0 0 2.25 2.25h4.5a2.25 2.25 0 0 0 2.25-2.25zm-1.5 0v9.75h-6v-9.75a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 .75.75m-2.25 11.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0" })
2686
+ );
2687
+ var LinkIcon = (props) => /* @__PURE__ */ React19.createElement(
2688
+ "svg",
2689
+ {
2690
+ width: "12",
2691
+ height: "12",
2692
+ viewBox: "0 0 12 12",
2693
+ fill: "none",
2694
+ xmlns: "http://www.w3.org/2000/svg"
2695
+ },
2696
+ /* @__PURE__ */ React19.createElement(
2697
+ "path",
2698
+ {
2699
+ fillRule: "evenodd",
2700
+ clipRule: "evenodd",
2701
+ d: "M1.007 6a5 5 0 1 1 10 0 5 5 0 0 1-10 0m7.486-2.344A.6.6 0 0 1 8.91 3.5c.15 0 .305.048.418.156a.55.55 0 0 1 0 .798L5.254 8.337a.62.62 0 0 1-.837 0L2.67 6.673a.55.55 0 0 1 0-.798.62.62 0 0 1 .837 0l1.329 1.266z",
2702
+ fill: "url(#a)"
2703
+ }
2704
+ ),
2705
+ /* @__PURE__ */ React19.createElement("defs", null, /* @__PURE__ */ React19.createElement(
2706
+ "linearGradient",
2707
+ {
2708
+ id: "a",
2709
+ x1: "11.007",
2710
+ y1: "5.999",
2711
+ x2: "1.007",
2712
+ y2: "5.999",
2713
+ gradientUnits: "userSpaceOnUse"
2714
+ },
2715
+ /* @__PURE__ */ React19.createElement("stop", { stopColor: "rgb(var(--oui-gradient-brand-end))" }),
2716
+ /* @__PURE__ */ React19.createElement("stop", { offset: "1", stopColor: "rgb(var(--oui-gradient-brand-start))" })
2717
+ ))
2718
+ );
2719
+ var DotIcon = (props) => /* @__PURE__ */ React19.createElement(
2720
+ "svg",
2721
+ {
2722
+ width: "2",
2723
+ height: "2",
2724
+ viewBox: "0 0 2 2",
2725
+ fill: "none",
2726
+ xmlns: "http://www.w3.org/2000/svg"
2727
+ },
2728
+ /* @__PURE__ */ React19.createElement(
2729
+ "path",
2730
+ {
2731
+ d: "M.667.334a.667.667 0 1 1 0 1.333.667.667 0 0 1 0-1.333",
2732
+ fill: "url(#a)"
2407
2733
  }
2408
- ))));
2409
- }
2734
+ ),
2735
+ /* @__PURE__ */ React19.createElement("defs", null, /* @__PURE__ */ React19.createElement(
2736
+ "linearGradient",
2737
+ {
2738
+ id: "a",
2739
+ x1: "1.333",
2740
+ y1: "1.001",
2741
+ x2: "0",
2742
+ y2: "1.001",
2743
+ gradientUnits: "userSpaceOnUse"
2744
+ },
2745
+ /* @__PURE__ */ React19.createElement("stop", { stopColor: "rgb(var(--oui-gradient-brand-end))" }),
2746
+ /* @__PURE__ */ React19.createElement("stop", { offset: "1", stopColor: "rgb(var(--oui-gradient-brand-start))" })
2747
+ ))
2748
+ );
2749
+
2750
+ // src/components/userCenter.tsx
2410
2751
  function UserCenter(props) {
2411
2752
  const { accountState: state } = props;
2412
2753
  return /* @__PURE__ */ React19.createElement(RenderUserCenter, { state, disabledConnect: props.disabledConnect });
@@ -2431,17 +2772,14 @@ var RenderUserCenter = (props) => {
2431
2772
  return account.address;
2432
2773
  }, [account, connectedChain, accountState]);
2433
2774
  if (state.status === AccountStatusEnum.EnableTradingWithoutConnected) {
2434
- return /* @__PURE__ */ React19.createElement(
2435
- Button,
2775
+ return /* @__PURE__ */ React19.createElement(Flex, { className: "oui-bg-base-5 oui-px-[7px] oui-rounded-[6px] oui-gap-[6px]" }, /* @__PURE__ */ React19.createElement(LinkDeviceMobile, null, /* @__PURE__ */ React19.createElement(
2776
+ Text.formatted,
2436
2777
  {
2437
- size: "md",
2438
- variant: "gradient",
2439
- angle: 45,
2440
- "data-testid": "oui-testid-nav-bar-address-btn",
2441
- className: "oui-flex oui-items-center oui-justify-center oui-gap-2"
2778
+ rule: "address",
2779
+ className: "oui-text-base-contrast oui-text-xs"
2442
2780
  },
2443
- /* @__PURE__ */ React19.createElement(Text.formatted, { rule: "address", className: "oui-text-[rgba(0,0,0,.88)]" }, formatAddress(userAddress))
2444
- );
2781
+ formatAddress(userAddress)
2782
+ )));
2445
2783
  }
2446
2784
  if (state.status <= AccountStatusEnum.NotConnected || disabled) {
2447
2785
  return /* @__PURE__ */ React19.createElement(
@@ -2541,7 +2879,7 @@ installExtension({
2541
2879
 
2542
2880
  // src/main.tsx
2543
2881
  function Main(props) {
2544
- const { wallet, connectedChain, setChain, namespace } = useWallet2();
2882
+ const { wallet, connectedChain, setChain, namespace, onDisconnect } = useWallet2();
2545
2883
  const { openConnectDrawer, setOpenConnectDrawer, setTargetWalletType } = useWalletConnectorPrivy();
2546
2884
  const connect = (props2) => {
2547
2885
  if (props2 && props2.autoSelect) {
@@ -2553,13 +2891,10 @@ function Main(props) {
2553
2891
  resolve([]);
2554
2892
  });
2555
2893
  };
2556
- const disconnect = useCallback(async () => {
2557
- return Promise.resolve([]);
2558
- }, [wallet]);
2559
2894
  const value = useMemo(
2560
2895
  () => ({
2561
2896
  connect,
2562
- disconnect,
2897
+ disconnect: onDisconnect,
2563
2898
  connecting: false,
2564
2899
  wallet,
2565
2900
  setChain,
@@ -2733,7 +3068,6 @@ var commonSwrOpts = {
2733
3068
  // don't duplicate a request with the same key for 1hr
2734
3069
  dedupingInterval: 36e5
2735
3070
  };
2736
- var fetcher = (url) => fetch(url).then((res) => res.json());
2737
3071
  var formatSwapChainInfo = (data = {}) => {
2738
3072
  return Object.keys(data).map((key) => {
2739
3073
  const chain = data[key];
@@ -2867,12 +3201,12 @@ function WalletConnectorPrivyProvider(props) {
2867
3201
  fetcher,
2868
3202
  commonSwrOpts
2869
3203
  );
2870
- const { data: mainnetChainInfoRes } = useSWR(
3204
+ const { data: mainnetChainInfos } = useSWR(
2871
3205
  !props.customChains ? "https://api.orderly.org/v1/public/chain_info" : null,
2872
3206
  fetcher,
2873
3207
  commonSwrOpts
2874
3208
  );
2875
- const { data: testChainInfoRes } = useSWR(
3209
+ const { data: testChainInfos } = useSWR(
2876
3210
  !props.customChains ? "https://testnet-api.orderly.org/v1/public/chain_info" : null,
2877
3211
  fetcher,
2878
3212
  commonSwrOpts
@@ -2962,15 +3296,15 @@ function WalletConnectorPrivyProvider(props) {
2962
3296
  if (props.customChains) {
2963
3297
  return;
2964
3298
  }
2965
- if (!mainnetChainInfoRes || !testChainInfoRes || swapLoading) {
3299
+ if (!mainnetChainInfos || !testChainInfos || swapLoading) {
2966
3300
  return;
2967
3301
  }
2968
3302
  let testChainsList = [];
2969
3303
  let mainnetChainsList = [];
2970
3304
  try {
2971
- testChainsList = testChainInfoRes?.data?.rows;
3305
+ testChainsList = testChainInfos;
2972
3306
  testChainsList.push(AbstractTestnetChainInfo);
2973
- mainnetChainsList = mainnetChainInfoRes?.data?.rows;
3307
+ mainnetChainsList = mainnetChainInfos;
2974
3308
  const testChains = processChainInfo(testChainsList);
2975
3309
  const mainnetChains2 = processChainInfo(mainnetChainsList);
2976
3310
  const swapChains = processChainInfo(
@@ -2990,8 +3324,8 @@ function WalletConnectorPrivyProvider(props) {
2990
3324
  initRef.current = true;
2991
3325
  }, [
2992
3326
  props.customChains,
2993
- mainnetChainInfoRes,
2994
- testChainInfoRes,
3327
+ mainnetChainInfos,
3328
+ testChainInfos,
2995
3329
  swapChainInfoRes,
2996
3330
  swapLoading
2997
3331
  ]);