CreateWallet (React SDK)

Integration

Provide the user's email address and success callback handler to the <CreateWallet> component. When this component is rendered, an email is sent to the user prompting them to verify it. Once verified, a Paper Wallet address on the chain specified in PaperSDKProvider is returned.

The same email address will always resolve to the same wallet address on a given blockchain so it is safe to verify email addresses that already have a Paper Wallet.

Code example

<PaperSDKProvider chainName="Polygon">
  <CreateWallet
        emailAddress="[email protected]"
        onSuccess={(user) => { ... }}
        onError={(error) => { ... }}
  />
</PaperSDKProvider>

Props

PropTypeDescription
emailAddress
Required
stringThe user's email address that needs to be verified.
onSuccess
Required
(user: { emailAddress: string; walletAddress: string; }) => voidA callback called when the email is verified and wallet address is created.

The user's email address and wallet address are returned.
redirectUrlstringA URL to redirect the user once they click the link in their email.

If not provided, the email link prompts the user to close the tab and return to your app.
clientIdstringIf provided, an accessCode is provided in the onSuccess callback. This accessCode is used to query the user's wallet information later.
onEmailVerificationInitiated() => voidA callback called after Paper sends an email for the user to verify.

If not provided, Paper provides a UI to tell the user to check their inbox.
onError(error: PaperSDKError) => voidA callback called if there is an error sending the email or creating a wallet address.

Customization

Button

If no child element is passed in, a default button is rendered.

`CreateWallet` default button`CreateWallet` default button

CreateWallet default button

Provide your own button by passing a child element into the React component.

<CreateWallet>
  <button class='my-button'>Sign In</button>
</CreateWallet>

Email verification prompt

By default, Paper shows a modal prompting the user to check their email.

To provide your own UX, provide the onEmailVerificationInitiated callback to provide your own instructions prompting the user to check their inbox.