@reservoir0x/relay-kit-ui
Version:
Relay is the Fastest and Cheapest Way to Bridge and Transact Across Chains.
20 lines • 689 B
JavaScript
import { useEffect, useState } from 'react';
import { useAccount } from 'wagmi';
export default function (wallet, linkedWallets) {
const [address, setAddress] = useState();
const { address: wagmiAddress } = useAccount();
useEffect(() => {
const getWalletAddress = async (wallet) => {
if (wallet) {
const walletAddress = await wallet.address();
setAddress(walletAddress);
}
else {
setAddress(undefined);
}
};
getWalletAddress(wallet);
}, [wallet, linkedWallets]);
return wallet ? address : wagmiAddress;
}
//# sourceMappingURL=useWalletAddress.js.map