Migrating From Fortmatic

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

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

Prerequisite

Imports

Fortmatic
Magic
Fortmatic
import Fortmatic from 'fortmatic';
Magic
import { Magic } from 'magic-sdk';

Constructing the SDK Instance

Fortmatic
Magic
Fortmatic
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://...' });
Magic
const magic = new Magic('API_KEY');
​
// With custom Ethereum node configuration:
const magic = new Magic('API_KEY', { network: 'mainnet' });
const magic = new Magic('API_KEY', {
network: { rpcUrl: 'https://...' }
});

Logging in

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

Constructing a Web3 Instance

Fortmatic
Magic
Fortmatic
new Web3(fmPhantom.getProvider());
Magic
new Web3(magic.rpcProvider);