@orderly.network/wallet-connector-privy 2.5.3 → 2.6.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.mjs CHANGED
@@ -3,8 +3,8 @@ import * as viemExport from 'viem';
3
3
  import { defineChain } from 'viem';
4
4
  import { mainnet, abstract, abstractTestnet } from 'viem/chains';
5
5
  import { useWalletConnector, useAccount, useSWR, fetcher, WalletConnectorContext, useTrack, useStorageLedgerAddress, useLocalStorage, useStorageChain } from '@orderly.network/hooks';
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 { 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';
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, EMPTY_OBJECT, TrackerEventName, ConnectorKey } from '@orderly.network/types';
7
+ import { modal, useModal, SimpleSheet, SheetHeader, Text, Flex, Divider, cn, installExtension, ExtensionPositionEnum, useScreen, formatAddress, Button, SimpleDialog, TooltipProvider, CloseIcon, ScrollArea, ExclamationFillIcon, Tooltip, CopyIcon, Checkbox, toast, DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuContent, DropdownMenuItem, ChevronDownIcon, ChevronUpIcon, Grid, 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';
@@ -669,7 +669,7 @@ var WagmiWalletProvider = ({
669
669
  setWallet(void 0);
670
670
  return;
671
671
  }
672
- connector.getProvider().then((provider) => {
672
+ connector.getProvider?.().then((provider) => {
673
673
  setWallet({
674
674
  label: connector.name,
675
675
  icon: "",
@@ -813,15 +813,14 @@ var PwaDialog = modal.create((props) => {
813
813
  index: 1,
814
814
  title: t("connector.privy.pwa.step1"),
815
815
  content: /* @__PURE__ */ React19.createElement(Flex, { className: "oui-w-full oui-bg-dark-8" }, /* @__PURE__ */ React19.createElement(
816
- Grid,
816
+ Flex,
817
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"
818
+ className: "oui-bg-black/[0.08] oui-p-2 oui-h-[52px] oui-rounded-[44px] oui-w-full oui-px-4 oui-relative",
819
+ itemAlign: "center",
820
+ justify: "center"
821
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))
822
+ /* @__PURE__ */ React19.createElement(Text, { className: "oui-text-black/[0.88] oui-text-[18px] oui-leading-[36px] oui-flex-1 oui-text-center oui-whitespace-nowrap" }, domain),
823
+ /* @__PURE__ */ React19.createElement(ShareIcon, { className: "oui-absolute oui-right-4 oui-top-1/2 oui-translate-y-[-50%]" })
825
824
  ))
826
825
  }
827
826
  ), /* @__PURE__ */ React19.createElement(
@@ -848,12 +847,21 @@ var PwaDialog = modal.create((props) => {
848
847
  /* @__PURE__ */ React19.createElement(Text, { className: "oui-text-black/[0.2] oui-text-[18px]" }, t("connector.privy.pwa.findOnPage"))
849
848
  ),
850
849
  /* @__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)))
850
+ /* @__PURE__ */ React19.createElement(
851
+ Flex,
852
+ {
853
+ className: "oui-w-full oui-px-4 oui-py-3",
854
+ justify: "between",
855
+ itemAlign: "center"
856
+ },
857
+ /* @__PURE__ */ React19.createElement(Text, { className: "oui-text-black/[0.88] oui-text-[18px] oui-col-span-2 oui-whitespace-nowrap" }, t("connector.privy.pwa.addToHomeScreen")),
858
+ /* @__PURE__ */ React19.createElement(AddIcon, null)
859
+ )
852
860
  )
853
861
  }
854
862
  ))));
855
863
  });
856
- var ShareIcon = () => {
864
+ var ShareIcon = (props) => {
857
865
  return /* @__PURE__ */ React19.createElement(
858
866
  "svg",
859
867
  {
@@ -861,7 +869,8 @@ var ShareIcon = () => {
861
869
  width: "28",
862
870
  height: "28",
863
871
  viewBox: "0 0 28 28",
864
- fill: "none"
872
+ fill: "none",
873
+ className: props.className
865
874
  },
866
875
  /* @__PURE__ */ React19.createElement(
867
876
  "path",
@@ -1670,7 +1679,7 @@ function SwitchNetworkTips({
1670
1679
  ), /* @__PURE__ */ React19.createElement("div", { className: "oui-text-2xs oui-text-warning-darken" }, t("connector.privy.switchNetwork.tips", {
1671
1680
  chainName: tipsContent
1672
1681
  }))),
1673
- /* @__PURE__ */ React19.createElement(ArrowRightIcon, { className: "oui-text-[#FF7D00]" })
1682
+ /* @__PURE__ */ React19.createElement(ArrowRightIcon, { size: 14, className: "oui-text-[#FF7D00]" })
1674
1683
  );
1675
1684
  }
1676
1685
  var StorageChainNotCurrentWalletType = ({
@@ -2878,20 +2887,21 @@ installExtension({
2878
2887
  });
2879
2888
 
2880
2889
  // src/main.tsx
2881
- function Main(props) {
2890
+ var Main = (props) => {
2891
+ const { headerProps, children } = props;
2882
2892
  const { wallet, connectedChain, setChain, namespace, onDisconnect } = useWallet2();
2883
2893
  const { openConnectDrawer, setOpenConnectDrawer, setTargetWalletType } = useWalletConnectorPrivy();
2884
- const connect = (props2) => {
2885
- if (props2 && props2.autoSelect) {
2894
+ const connect = (options) => {
2895
+ if (options && options.autoSelect) {
2886
2896
  return Promise.resolve([]);
2887
2897
  }
2888
2898
  setTargetWalletType(void 0);
2889
- return new Promise((resolve, reject) => {
2899
+ return new Promise((resolve) => {
2890
2900
  setOpenConnectDrawer(true);
2891
2901
  resolve([]);
2892
2902
  });
2893
2903
  };
2894
- const value = useMemo(
2904
+ const memoizedValue = useMemo(
2895
2905
  () => ({
2896
2906
  connect,
2897
2907
  disconnect: onDisconnect,
@@ -2903,17 +2913,17 @@ function Main(props) {
2903
2913
  chains: [],
2904
2914
  settingChain: false
2905
2915
  }),
2906
- [connect, setChain, connectedChain, wallet, namespace]
2916
+ [connect, setChain, onDisconnect, connectedChain, wallet, namespace]
2907
2917
  );
2908
- return /* @__PURE__ */ React19.createElement(WalletConnectorContext.Provider, { value }, /* @__PURE__ */ React19.createElement(
2918
+ return /* @__PURE__ */ React19.createElement(WalletConnectorContext.Provider, { value: memoizedValue }, /* @__PURE__ */ React19.createElement(
2909
2919
  ConnectDrawer,
2910
2920
  {
2911
2921
  open: openConnectDrawer,
2912
2922
  onChangeOpen: setOpenConnectDrawer,
2913
- headerProps: props.headerProps
2923
+ headerProps
2914
2924
  }
2915
- ), props.children);
2916
- }
2925
+ ), children);
2926
+ };
2917
2927
  var InitAbstractProvider = (props) => {
2918
2928
  const { network } = useWalletConnectorPrivy();
2919
2929
  const chain = useMemo(() => {
@@ -3029,7 +3039,7 @@ function InitWagmiProvider({
3029
3039
  return children;
3030
3040
  }
3031
3041
  const [queryClient] = useState(() => new QueryClient());
3032
- const [config, setConfig] = useState(
3042
+ const [config] = useState(
3033
3043
  () => createConfig({
3034
3044
  chains: initChains && initChains.length ? initChains : [mainnet],
3035
3045
  multiInjectedProviderDiscovery: true,
@@ -3047,16 +3057,16 @@ function InitWagmiProvider({
3047
3057
  }
3048
3058
 
3049
3059
  // src/providers/wagmi/index.tsx
3050
- function WagmiWallet(props) {
3060
+ var WagmiWallet = (props) => {
3051
3061
  return /* @__PURE__ */ React19.createElement(
3052
3062
  InitWagmiProvider,
3053
3063
  {
3054
- wagmiConfig: props.wagmiConfig ?? {},
3055
- initChains: props.initChains
3064
+ initChains: props.initChains,
3065
+ wagmiConfig: props.wagmiConfig ?? EMPTY_OBJECT
3056
3066
  },
3057
3067
  /* @__PURE__ */ React19.createElement(WagmiWalletProvider, null, props.children)
3058
3068
  );
3059
- }
3069
+ };
3060
3070
 
3061
3071
  // src/provider.tsx
3062
3072
  var commonSwrOpts = {