πŸ“¦
Install with NPM
You can also easily integrate Fortmatic into your Javascript dApp written in frameworks such as React. Simply run the script below in your project directory to install the Fortmatic Javascript package from NPM.
Recommended Node and NPM versions: Node version >= 6.9 and NPM version >= 3.4

Fortmatic Installation Script

1
npm install --save fortmatic
Copied!

Web3 Installation Script

If you are using web3 for your dApp, you can install either the latest stable web3 version or the 1.0 beta version with updated capabilities and syntax. If you are only using the Fortmatic SDK without web3, you may skip this step.
1
# Install latest web3 1.0.0-beta.x version
2
npm install --save web3
3
​
4
# Or install stable web3 0.20.x version
5
npm install --save [email protected]
Copied!

Import into Web3 dApp

Use the following code snippet to import Fortmatic into your web3 dApp.
1
import Fortmatic from 'fortmatic';
2
// Works for web3 1.0 and pre-1.0 versions
3
import Web3 from 'web3';
4
​
5
const fm = new Fortmatic('YOUR_API_KEY');
6
window.web3 = new Web3(fm.getProvider());
7
​
8
// Send transactions the way your are used to
9
web3.eth.sendTransaction({/* ... */});
Copied!
Last modified 2yr ago