Embedded Wallet SDK React
With the Embedded Wallet SDK, you can supercharge your dApp’s UX. It is super easy to integrate and completely customisable to meet your dApp’s styles. It also helps solve the current Snaps limitations and integrating this will allow users to view their balances, manage their assets, and more.


Installation
Usage
Get Started
Props
theme
"light" | "dark"
Theme of the modal
chainRecords
Record<string, { address: string; restUrl?: string, coinType?: string }> | null. Key is chainId
Record of addresses and REST URLs corresponding to given chain ID.
isOpen
boolean
Whether the modal is open
onClose
() => void
Callback function when the modal is closed
config
Config
Config of the modal
height
string
Height of the component
width
string
Width of the component
enableWalletConnect
boolean
When true, wallet connection can be controlled via embedded wallet
restrictChains
boolean
Defaults to false, shows balances of all discoverable chains. Passing this as true restricts to only fetching balances for specified chains.
Here is the type definition of Config:
Example Configuration
Usage with Custom React UI
In case you want to create your own UI in react, we have exposed the react hooks that we use internally. If you are not using react, then you can check out the next page.
For making queries, we primarily use swr, so a lot of return values from hooks will have the same return type (except for the data).
User Balances
To fetch user balances, you can use useRichBalance hook.
Parameters -
address- the wallet address your querying the balance forchainId- self explanatoryrestUrl(optional) - custom rest url for the nodeswrConfiguration(optional) - configure your swr query, click here for more information
Multi Chain Balances
To fetch balances across multiple chains, you can use
Parameters -
aggregatedChainData- chain records which you provide account modal to fetch balanceskey- optional, key for SWR configuration
User Activity
To fetch user activity, you can use useActivity hook. The return type of a @tanstack/react-query useInfiniteQuery hook.
Parameters -
address- the wallet address your querying the balance forchainId- self explanatoryrestUrl(optional) - custom rest url for the node
Return Value -
The activityQuery.data.pages field will be a list of objects with the following fields -
Usage Example -
Using the activity data
Triggering the next (data) page load using the last element on the list
Last updated