Skip to main content

Paper Wallet

Prompt users to connect to your app using their email with Paper Wallet

Usage

import { PaperWallet } from "@thirdweb-dev/wallets";
import { Ethereum } from "@thirdweb-dev/chains";

const wallet = new PaperWallet({
chain: Ethereum, // chain to connect to
clientId: "client_id", // Paper SDK client ID
});

wallet.connect();

Configuration

Provide a configuration object when instantiating the PaperWallet class.

chain (required)

The chain to connect to by default.

Must be a Chain object, from the @thirdweb-dev/chains package.

chains (optional)

Provide an array of chains you want to support.

Must be an array of Chain objects, from the @thirdweb-dev/chains package.

clientId (required)

Paper SDK requires a clientId for instantiation. You can create a clientId for your app on paper.xyz

Must be a string.

walletStorage (optional)

wallet needs to store data in a persistent storage. By default localStorage is used. If you want to use a different storage, you can pass it in the walletStorage option.

Must be an object conforming to the AsyncStorage interface:

export interface AsyncStorage {
getItem(key: string): Promise<string | null>;
setItem(key: string, value: string): Promise<void>;
removeItem(key: string): Promise<void>;
}

Example:

import { PaperWallet } from "@thirdweb-dev/wallets";

const walletWithOptions = new PaperWallet({
// ... other required config

walletStorage: {
getItem: (key) => {
// Implement your own storage logic here
},
removeItem: (key) => {
// Implement your own storage logic here
},
setItem: (key, value) => {
// Implement your own storage logic here
},
},
});

Methods

Inherhits all the public methods from the AbstractClientWallet class.

getEmail

Get the email associated with the currently connected wallet.

const email = await wallet.getEmail();
Configuration

Return Value

Returns a string containing the email.

string;