Wallet Widget

Wallet Widget

With Magic's wallet widget, your users can view and manage their assets with a single line of code.

#Use Cases

  • Show users their public address and their assets – tokens and NFT collectibles
  • Let users send and receive funds to their wallet
  • Let users export their wallet's secret phrase for account recovery

#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

Javascript
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

#Reference