Migrating From Fortmatic

This short guide highlights some of the differences between the soon-to-be-deprecated Fortmatic Whitelabel API and Magic SDK.

important

Developers should plan to migrate existing Fortmatic.Phantom implementations to Magic SDK before October 30, 2020.

Prerequisite: Install Magic Client SDKโ€‹

Imports

import Fortmatic from 'fortmatic';

Constructing the SDK Instance

const fmPhantom = new Fortmatic.Phantom('API_KEY');
// With custom Ethereum node configuration:
const fmPhantom = new Fortmatic.Phantom('API_KEY', 'mainnet');
const fmPhantom = new Fortmatic.Phantom('API_KEY', { rpcUrl: 'https://...' });

Logging in

fmPhantom.loginWithMagicLink({ email: 'hello@magic.link' });

Constructing a Web3 Instance

new Web3(fmPhantom.getProvider());