React Connecting Wallet
Guide to connecting the user's wallet in react.
// Example for setting up the AuctionHouse from Web3React
function MyComponent() {
const {library, chainId} = useWeb3React();
// library is a ethers provider/signer instance
// chainId is the networkId
const auctionHouse = useMemo(() => {
if (library && chainId) {
return new AuctionHouse(library.getSigner(), chainId);
}
}, [library, chainId]);
return (
auctionHouse ? (
<ManageAuction auctionHouse={auctionHouse} />
) : <div>Please connect wallet</div>
);
}Last updated
Was this helpful?