<CreateWallet> is a React component that renders a button which initiates a flow to create a wallet tied to a user's email address. Paper does not have the ability to read the private keys of this wallet, and the user can choose to export the private keys of this wallet at any time by accessing a link that we can provide (please contact us for details of the export flow).

The flow works as follows:

  1. Paper sends the user a verification email (to the address provided to the emailAddressprop) to ensure that they own the email that is being passed in. This is the email address that the wallet will be tied to.

Optional event callback function onEmailVerificationInitiated is called when the user clicks on the button. If nothing is passed in, we show default messages to prompt the user to check their email for verification.

  1. Paper calls onSuccess when email verification succeeds and passes through an object that contains the user's email address and wallet address. If verification failed, onError is called with an error message.

Props

These props can be used as arguments within the <CreateWallet> component. See the name, type, and description for each prop in the table below.

Prop

Type

Description

emailAddress

string

Required
This is the email address that the user owns and can access. We will send them a verification email and create a wallet tied to this email.

Callback Functions

The following callback function can be passed on as arguments within the <CreateWallet> component. See the name, type, and description for each prop in the table below.

Callback Function

Description

onSuccess: (user: PaperUser) => void

Optional
This callback is called once the user successfully logs in to their Paper wallet

onError: (error: PaperSDKError) => void

Optional
This function is called when the user fails to login. This could happen because the user gave an invalid email, or they failed to verify their email. See PaperSDKError for more.

onClose: () => void

Optional
This function is called when the login window is closed.

Types

export type PaperUser = {
  /**
   * The user's email address.
   * This address is case-insensitive (i.e. different capitalizations map to the same wallet).
   */
  emailAddress: string;
  /**
   * The Paper Wallet address associated with this user's email address.
   */
  walletAddress: string;
};