Wallet and Contracts
Creating wallets and using contracts
//Common Js
const { VerifiedWallet, Provider } = require('@verified-network/verified-sdk');
//ES Module
import { VerifiedWallet, Provider } from '@verified-network/verified-sdk'
/** Step 1: Create Verified Wallet **/
//Option 1: Generate new Mnemonics and Wallet
const investorMnemonics = await VerifiedWallet.generateMnemonics()
const investorWallet = await VerifiedWallet.importWallet(menmonics)
//Option 2: using existing wallet mnemonics
const investorMnemonics = 'your wallet mnemonics'
const investorWallet = await VerifiedWallet.importWallet(investorMnemonics);
/** Step 2: Set Provider for Wallet **/
//Option 1: using Default Providers by ethers.js(for networks like mainnet, sepolia, ropstan, polygon e.t.c)
const defaultProviderNetwork = 'sepolia' // or any other default provider network of your choice.
//Network/chain id(number) can be used in place of network name, for example:
const defaultProviderNetwork = 11155111 // where number 11155111 is chain id for sepolia. any other chain id of default provider network can be used.
const investorWalletProvider = investorWallet.setProvider(
Provider.defaultProvider(defaultProviderNetwork)
)
//Option 2: using custom providers(infura and alchemy)
const network = 'sepolia' // or any other network of your choice.
//Network/chain id(number) can be used in place of network name, for example:
const network = 11155111 // where number 11155111 is chain id for sepolia, any other chain id can be used.
//For infura; to get api key and enable networks checout: https://www.infura.io/
const INFURA_API_KEY = 'your infura api key'
const investorWalletProvider = investorWallet.setProvider(
Provider.infuraProvider(network, INFURA_API_KEY)
)
//For alchemy; to get api key and enable networks checout: https://www.alchemy.com/
const ALCHEMY_API_KEY = 'your alchemy api key'
const investorWalletProvider = investorWallet.setProvider(
Provider.alchemyProvider(network, ALCHEMY_API_KEY)
)Last updated