Get Started
To view a sample integration, please refer to our demo application. Alternatively, please post any other questions on our Discord.
First, install the library via your terminal.
1
# install via Yarn
2
yarn add @metafi/metafi-react-package
3
4
# or via NPM
5
npm install @metafi/metafi-react-package
Next, wrap your top level component as follows with the Metafi provider.
1
import { MetafiProvider, chains } from '@metafi/metafi-react-package';
2
3
function App() {
4
return (
5
<MetafiProvider
6
apiKey={apiKey}
7
secretKey={secretKey}
8
supportedChains={supportedChains}
9
customTokens={customTokens}
10
options={options}
11
metafiSSO={metafiSSO}
12
>
13
<YourComponents>
14
...
15
</YourComponents>
16
</MetafiProvider>
17
);
18
};
For more information on customising your wallet interface, please refer to the section on UI Customisation.
This step is only required if you are using your own login/authentication mechanism
Go to the projects page of the Developer Portal 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.You're done! You can now invoke the functions that you need.
1
import { useMetafi } from '@metafi/metafi-react-package';
2
3
function displayWallet(userIdentifier) {
4
const { ShowWallet } = useMetafi();
5
6
return (
7
<>
8
<button onClick={()=>ShowWallet()}>Show Wallet</button>
9
</>
10
);
11
};
Last modified 7mo ago