Quickly setup a few thing to get you up and running in 15 minutes
Elements requires a few wallet methods to work. We have created an interface so that you can bring your own wallet (BYOW) and elements will always work!
For this purpose, elements needs you to pass in a wallet client.
WalletClient
This is an object that has the following methods that the elements components use:
enable: function that enables chain(s) on the wallet.
getAccount: function that returns the account for a given chain id
getSigner: function that returns a signer for a given chain id
network: network settings for the SDK (this is optional and by default set to mainnet)
We export a NETWORK enum from elements which you can use to set this property
This is an object that has methods and properties that the Elements components use:
userAddressstring | undefined
Description - user's address for the primary connected chain. If undefined is passed, it is inferred as the wallet no connected state.
walletClientWalletClient
Description - wallet client described above to sign transactions
connectWallet(chainId?: string) => Promise<void>
Description - let's Elements trigger your dApps' wallet connection flow, accepts an optional chain ID parameter to specify which chain to connect with.