Web3Wallet
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 to ensure that they can be assigned to their rightful owners. The verification is completed via Web3 wallet browser extensions, such as Metamask, Coinbase Wallet, and OKX Wallet. 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's Frontend API and will receive a nonce that needs to be signed by the Web3 wallet browser extension. A signature is generated from the nonce and is returned in the Verification.message
property of the returned Web3Wallet
object.
The second and final step involves an attempt to complete the verification by calling Web3Wallet.attemptVerification()
method, passing the signature that was generated from the prepareVerification()
method as a parameter.
Properties
- Name
id
- Type
string
- Description
The unique ID for the Web3 wallet.
- Name
web3Wallet
- Type
string
- Description
The Web3 wallet address, made up of 0x + 40 hexadecimal characters.
- Name
verification
- Type
Verification
- Description
An object holding information on the verification of this Web3 wallet.
function create(): Promise<Web3Wallet>
destroy()
Deletes this Web3 wallet.
function destroy(): Promise<void>
toString()
Returns the web3Wallet
hexadecimal string.
function toString(): string
prepareVerification()
Starts the verification process for the Web3 wallet. The user will be prompted to sign a generated nonce by the browser extension. Returns a Web3Wallet
object with the signature in the Verification.message
property. The signature should then be passed to the attemptVerification()
method.
function prepareVerification(params: PrepareWeb3WalletVerificationParams): Promise<Web3Wallet>
- Name
strategy
- Type
'web3_metamask_signature'
|'web3_coinbase_wallet_signature'
|'web3_okx_wallet_signature'
- Description
The verification strategy to validate the user's sign-up request. The following strategies are supported:
'web3_metamask_signature'
: User will need to sign a message and generate a signature using MetaMask browser extension.'web3_coinbase_wallet_signature'
: User will need to sign a message and generate a signature using Coinbase Wallet.'web3_okx_wallet_signature'
: User will need to sign a message and generate a signature using OKX Wallet.
attemptVerification()
Attempts to verify the Web3 wallet by passing the signature generated from the prepareVerification()
method. Returns a Web3Wallet
object.
function attemptVerification(params: AttemptWeb3WalletVerificationParams): Promise<Web3Wallet>
- Name
signature
- Type
string
- Description
The signature generated from calling the
prepareVerification()
method.
Feedback
Last updated on