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, OKX Wallet, or Solana Wallet. The Web3Wallet 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 either 0x + 40 hexadecimal characters or a
base58encodeded25519public key (for Solana wallets).
- 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 address as a string.
function toString(): stringprepareVerification()
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_base_signature'|'web3_metamask_signature'|'web3_coinbase_wallet_signature'|'web3_okx_wallet_signature'|'web3_solana_signature'- Description
The verification strategy to validate the user's sign-up request. The following strategies are supported:
'web3_base_signature': User will need to sign a message and generate a signature using Base.'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.'web3_solana_signature': User will need to sign a message and generate a signature using their Solana wallet provider.
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.
Web3Provider
A type represents the supported Web3 wallet providers to set the signagture type in GenerateSignatureParams.
type Web3Provider = EthereumWeb3Provider | SolanaWeb3ProviderEthereumWeb3Provider
A type that represents the supported Ethereum Web3 wallet providers.
type EthereumWeb3Provider =
| MetamaskWeb3Provider
| BaseWeb3Provider
| CoinbaseWalletWeb3Provider
| OKXWalletWeb3ProviderA type that represents the Solana Web3 provider. This is independent of the specific Solana wallet used as users can use any Solana wallet that supports signing messages.
type SolanaWeb3Provider = 'solana'MetamaskWeb3Provider
A type that represents the MetaMask Web3 wallet provider.
type MetamaskWeb3Provider = 'metamask'BaseWeb3Provider
A type that represents the Base Web3 wallet provider.
type BaseWeb3Provider = 'base'CoinbaseWalletWeb3Provider
A type that represents the Coinbase Wallet Web3 wallet provider.
type CoinbaseWalletWeb3Provider = 'coinbase_wallet'OKXWalletWeb3Provider
A type that represents the OKX Wallet Web3 wallet provider.
type OKXWalletWeb3Provider = 'okx_wallet'Feedback
Last updated on
Edit on GitHub