usePaperWallet
Hook that prompts users to connect Paper Wallet to your app which allows users to connect to your app using their email address
import { usePaperWallet } from "@thirdweb-dev/react";
const connectWithPaperWallet = usePaperWallet();
The paperWallet also needs to be added in ThirdwebProvider's supportedWallets if you want the wallet to auto-connect on next page load.
Usage
Calling the function returned by the usePaperWallet
hook opens the Paper Wallet's Modal and prompts the user to log in with their email address.
If email
is not provided, the user will be prompted to enter their email address or sign in with a Google account. Once the user enters the email address or signs in with a Google account, an OTP will be sent to the user's email address. Once the user enters the OTP, the wallet will be connected.
If the email is provided, the user will be directly shown the OTP screen, the user will not be prompted to enter their email.
once connected, you can use the useAddress
hook to get the user's address and usePaperWalletUserEmail
hook to get the user's email address.
import { usePaperWallet } from "@thirdweb-dev/react";
function App() {
const connectWithPaperWallet = usePaperWallet();
return (
<button
onClick={() =>
connectWithPaperWallet({
email: "<USER_EMAIL>", // optional - directly show OTP screen
})
}
>
Connect with Paper Wallet
</button>
);
}