To connect to a wallet, create an object to represent the wallet to access with the createProvider() method. These wallet objects implement the Provider interface so you can access different types of wallets in a consistent way.
constgetMetamaskWalletAddress = async () => { // Connect to the Metamask wallet in the browser, using the MetamaskProvider interface to limit bundle size. constprovider = awaitcreateProvider(MetamaskProvider)
// Get the address of the wallet console.log(provider.address) }
Description
Represents a browser-based wallet.
To connect to a wallet, create an object to represent the wallet to access with the
createProvider()
method. These wallet objects implement theProvider
interface so you can access different types of wallets in a consistent way.Example