// create a react functional component that is a ChainSelector import { IconGas } from "@/assets/icons"; import { useChains, useFetchWalletBalances, useMoonAccount } from "@/hooks"; import { shortenAddress } from "@/utils"; import { formatUnits } from "ethers"; import React from "react"; type WalletSelectorProps = { selectProps?: React.SelectHTMLAttributes; optionProps?: React.OptionHTMLAttributes; }; export const WalletSelector = ({ selectProps, optionProps, }: WalletSelectorProps) => { const { accounts: wallets, account: wallet, setAccount: setWallet, } = useMoonAccount(); const { selectedChain: chain } = useChains(); const gasBalanceQueries = useFetchWalletBalances( wallets, chain?.chain_id?.toString() || "1", ); // console.log( // "gasBalanceQueries", // gasBalanceQueries.map((r) => r.data), // gasBalanceQueries.map((r) => r.error) // ); React.useEffect(() => { if (!wallet && wallets.length > 0) setWallet(wallets[0]); }, [wallet, wallets, setWallet]); return ( ); };