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.
{% tabs %} {% tab title="Fortmatic" %}
import Fortmatic from 'fortmatic';
{% endtab %}
{% tab title="Magic" %}
import { Magic } from 'magic-sdk';
{% endtab %} {% endtabs %}
{% 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 %}
{% tabs %} {% tab title="Fortmatic" %}
fmPhantom.loginWithMagicLink({ email: '[email protected]' });
{% endtab %}
{% tab title="Magic" %}
magic.auth.loginWithMagicLink({ email: '[email protected]' });
{% endtab %} {% endtabs %}
{% tabs %} {% tab title="Fortmatic" %}
new Web3(fmPhantom.getProvider());
{% endtab %}
{% tab title="Magic" %}
new Web3(magic.rpcProvider);
{% endtab %} {% endtabs %}