Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.com
Check out a preview of our new docs.

Web3Wallet

The Web3Wallet object describes a User's web3 wallet address.

Overview

The Web3Wallet object describes a Web3 wallet address. The address can be used as a proof of identification for users.

Web3 addresses must be verified so that we can make sure they can be assigned to their rightful owners. The verification is completed via Web3 wallet browser extensions such as Metamask. The Web3Wallet3 object holds all the necessary state around the verification process.

The verification process always starts with the Web3Wallet.prepareVerification() or signIn.prepareFirstFactor() method, which will send the wallet address to Clerk Frontend API and will receive a nonce that needs to be signed by the Web3 wallet browser extension.

The second and final step involves an attempt to complete the verification by calling Web3Wallet.attemptVerification() method, passing the generated signature as a parameter.

Attributes

NameTypeDescription
idstring

A unique identifier for this web3 wallet.

web3Walletstring

In Ethereum, the address is made up of 0x + 40 hexadecimal characters.

verificationVerificationResource

An object holding information on the verification of this web3 wallet.

Methods

create()

create() => Promise<Web3WalletResource>

Creates a new web3 wallet.

Parameters

This method accepts no parameters.

Returns

TypeDescription
Promise<Web3WalletResource>

This method returns a Promise which resolves to a Web3Wallet object.

prepareVerification()

prepareVerification(params: PrepareWeb3WalletVerificationParams) => Promise<Web3WalletResource>

Kick off the verification process for this web3 wallet. The user will be prompted to sign a generated nonce by the browser extension e.g MetaMask.

Parameters

NameDescription
params

An object of type PrepareWeb3WalletVerificationParams

Returns

TypeDescription
Promise<Web3WalletResource>

This method returns a Promise which resolves with a Web3Wallet object.

attemptVerification()

attemptVerification(params: AttemptWeb3WalletVerificationParams) => Promise<Web3WalletResource>

Attempts to verify this web3 wallet, by passing the generated signature.

Parameters

NameDescription
params

An object of type AttemptWeb3WalletVerificationParams

Returns

TypeDescription
Promise<Web3WalletResource>

This method returns a Promise which resolves with a Web3Wallet object.

destroy()

destroy() => Promise<void>

Delete this web3 walllet.

Parameters

This method accepts no parameters.

Returns

TypeDescription
Promise<void>

This method returns a Promise which doesn't resolve to any value.

toString()

toString() => string

Returns the web3Wallet hexadecimal string.

Interfaces

VerificationResource

NameTypeDescription
statusstring | null

The verification status. Possible values are:

  • unverified: The verification process has not been completed.
  • verified: The verification process has completed successfully.
  • failed: The verification process has been completed, but failed.
  • expired: The verification is invalid because it wasn't completed in the allowed time.
strategystring | null

The verification strategy. Possible strategy values are:

noncestring | null

A unique nonce that will be signed in the browser.

attemptsnumber | null

The number of attempts to complete the verification so far. Usually, a verification allows for maximum 3 attempts to be completed.

expireAtDate | null

The timestamp when the verification will expire and cease to be valid.

errorClerkAPIError | null

Any error that occurred during the verification process from the Clerk API.

Types

PrepareWeb3WalletVerificationParams

NameTypeDescription
strategystring

The verification strategy. Possible strategy values are:

  • web3_metamask_signature: User will need to sign a message and generate a signature using MetaMask browser extension.

AttemptWeb3WalletVerificationParams

NameTypeDescription
signaturestring

The signature that was generated after prepareVerification was called

Was this helpful?

Clerk © 2023