1 | # Fortmatic Javascript SDK
|
2 |
|
3 | Fortmatic JavaScript SDK lets developers conveniently connect their web apps to the Ethereum blockchain - allowing end-users to interact with their apps on any modern browser, without requiring them to download any browser extensions or mobile dApp browsers.
|
4 |
|
5 | ## Documentation
|
6 |
|
7 | See the [Developer Documentation](https://docs.fortmatic.com).
|
8 |
|
9 | ## Installation
|
10 |
|
11 | Integrating your app with Fortmatic will need our npm package:
|
12 |
|
13 | ```bash
|
14 | # Via NPM:
|
15 | npm install --save fortmatic
|
16 |
|
17 | # Via Yarn:
|
18 | yarn add fortmatic
|
19 | ```
|
20 |
|
21 | Alternatively you can load via CDN with by adding a script tag to your app’s `<head>`:
|
22 |
|
23 | ```html
|
24 | <script src="https://cdn.jsdelivr.net/npm/fortmatic/dist/fortmatic.js"></script>
|
25 | ```
|
26 |
|
27 | ## Usage
|
28 |
|
29 | Sign up or log in to the [Developer Dashboard](https://dashboard.fortmatic.com) to receive API keys that will allow your app to interact with the Ethereum blockchain through Fortmatic.
|
30 |
|
31 | You can then integrate by simply replacing your web3 provider with Fortmatic provider. Now, instead of the MetaMask Chrome Extension opening, a Fortmatic modal will show instead—requiring no additional user downloads. Fortmatic works across all modern desktop, mobile Chrome, Safari and Firefox browsers.
|
32 |
|
33 | ```jspx
|
34 | import Fortmatic from 'fortmatic';
|
35 |
|
36 | // Create client and replace web3 provider
|
37 | const fm = new Fortmatic('YOUR_API_KEY');
|
38 | web3 = new Web3(fm.getProvider());
|
39 |
|
40 | // Send transactions the way your are used to
|
41 | web3.eth.sendTransaction({/* ... */});
|
42 | ```
|