import { connectAndVerifyWithWalletProvider } from '@dynamic-labs-sdk/client';const signInWithWallet = async (key) => { try { const walletAccount = await connectAndVerifyWithWalletProvider({ walletProviderKey: key, }); console.log(`Wallet account connected and verified: ${walletAccount.accountAddress}`); // User is now signed in and available in the dynamicClient.user property // walletAccount is now available with getWalletAccounts() // ... } catch (error) { console.error('Error connecting or verifying wallet: ', error); // No Dynamic user was created, the user is not signed in }};
import { connectWithWalletProvider } from '@dynamic-labs-sdk/client';const signInWithWallet = async (key) => { try { const walletAccount = await connectWithWalletProvider({ walletProviderKey: key, }); console.log(`Wallet account connected: ${walletAccount.accountAddress}`); // No Dynamic user was created, but the session has been established // walletAccount is now available with getWalletAccounts() // ... } catch (error) { console.error('Error connecting wallet: ', error); // Connection failed and session was not established }};
You can use this function to verify a wallet account that was connected but not verified before.
Copy
Ask AI
import { verifyWalletAccount } from '@dynamic-labs-sdk/client';const verifyWallet = async (walletAccount) => { try { const walletAccount = await verifyWalletAccount({ walletAccount }); console.log(`Wallet is now verified: ${walletAccount.accountAddress}`); // A Dynamic user was created and is available in the dynamicClient.user property // walletAccount remains available in getWalletAccounts(), with a new `verifiedCredentialId` property // ... } catch (error) { console.error('Error verifying wallet: ', error); // No Dynamic user was created, but the existing session remains valid }};