Get Started

circle-exclamation

Demo

To view a sample integration, please refer to our demo applicationarrow-up-right. Alternatively, please post any other questions on our Discordarrow-up-right.

Step 1: Install the library

First, install the library via your terminal.

# install via Yarn
yarn add @metafi/metafi-react-package

# or via NPM
npm install @metafi/metafi-react-package

Step 2a: Initialise Metafi Component

Next, wrap your top level component as follows with the Metafi provider.

import { MetafiProvider, chains } from '@metafi/metafi-react-package';

function App() {
    return (
    <MetafiProvider 
        apiKey={apiKey} 
        secretKey={secretKey} 
        supportedChains={supportedChains}
        customTokens={customTokens}
        options={options}
        metafiSSO={metafiSSO}
    >
        <YourComponents>
        ...
        </YourComponents>
    </MetafiProvider>
    );
};

Refer to the section on Provider Initialisation for more information on MetafiProvider.

For more information on customising your wallet interface, please refer to the section on UI Customisation.

Step 2b: Setup User Login

circle-info

This step is only required if you are using your own login/authentication mechanism

Go to the projects page of the Developer Portalarrow-up-right and navigate to Settings. There you can update the URL which we will use to authenticate your user token. Once this URL is updated, you can create a wallet for a user by passing in their userIdentifier and jwtToken into our SDK.

More information on this can be found in the Login section of our documentation.

Step 3: Function Invocation

You're done! You can now invoke the functions that you need.

Last updated