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
- Fortmatic
- Magic
import Fortmatic from 'fortmatic';
Constructing the SDK Instance
- Fortmatic
- Magic
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
- Fortmatic
- Magic
fmPhantom.loginWithMagicLink({ email: 'hello@magic.link' });
Constructing a Web3 Instance
- Fortmatic
- Magic
new Web3(fmPhantom.getProvider());