Skip to content
This repository has been archived by the owner on Nov 4, 2020. It is now read-only.

Latest commit

 

History

History
84 lines (65 loc) · 1.76 KB

migrating-from-fortmatic.md

File metadata and controls

84 lines (65 loc) · 1.76 KB

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

{% tabs %} {% tab title="Fortmatic" %}

import Fortmatic from 'fortmatic';

{% endtab %}

{% tab title="Magic" %}

import { Magic } from 'magic-sdk';

{% endtab %} {% endtabs %}

Constructing the SDK Instance

{% tabs %} {% tab title="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://...' });

{% endtab %}

{% tab title="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://...' }
});

{% endtab %} {% endtabs %}

Logging in

{% tabs %} {% tab title="Fortmatic" %}

fmPhantom.loginWithMagicLink({ email: '[email protected]' });

{% endtab %}

{% tab title="Magic" %}

magic.auth.loginWithMagicLink({ email: '[email protected]' });

{% endtab %} {% endtabs %}

Constructing a Web3 Instance

{% tabs %} {% tab title="Fortmatic" %}

new Web3(fmPhantom.getProvider());

{% endtab %}

{% tab title="Magic" %}

new Web3(magic.rpcProvider);

{% endtab %} {% endtabs %}