Wallet Widget
Wallet Widget
With Magic's wallet widget, you can have your users view and manage their assets with a single line of code.
#Use Cases
- Show users their public address and their assets
- Let users send and recieve funds to their wallet
- Let users export their wallet's secret phrase for account recovery
Note: The widget currently has limited support for tokens and NFTs. We recommend using Zerion to view assets not visible by default in the Magic Connect wallet view. We are actively working on more robust, native coverage for tokens and NFTs.
#Usage
After following the quickstart to ensure Magic SDK is setup correctly and the user has succcesfully logged in, you can then pop open the wallet widget in an iframe as follows:
Show Widget
01import Web3 from 'web3';
02import { Magic } from 'magic-sdk';
03
04const magic = new Magic('YOUR_API_KEY', {
05 network: "goerli", // Ethereum testnet
06});
07
08const web3 = new Web3(magic.rpcProvider);
09
10const walletInfo = await magic.wallet.getInfo();
11const walletType = walletInfo.walletType;
12
13if (walletType === "magic") {
14 await magic.wallet.showUI();
15};
Secret Phrase Access
Users that have an account address that was created with Magic are able to access their seed phrase through the settings page.
#Configuration
- See how to brand this experience with your own logo and colors in the customization section.