edits in usage

This commit is contained in:
Sowmay Jain 2020-04-09 23:24:09 +10:00
parent 713f60e41c
commit 16fb4c7c67

View File

@ -25,17 +25,11 @@ npm install dsa-sdk
For production, we recommend linking to a specific version number ([jsdeliver](https://www.jsdelivr.com/package/npm/dsa-sdk)).
## Usage
Now instantiate DSA.
```js
// in node.js
const dsa = require('dsa-sdk');
const dsa = new DSA();
```
DSA only works with web3 library so you also have to instantiate [Web3](https://github.com/ethereum/web3.js/#installation).
Currently, this SDK only works with [web3 library](https://github.com/ethereum/web3.js/#installation)
```js
// in browser
if (window.ethereum) {
window.web3 = new Web3(window.ethereum)
} else if (window.web3) {
@ -43,6 +37,17 @@ if (window.ethereum) {
} else {
window.web3 = new Web3(customProvider)
}
// in node.js
const Web3 = require('web3')
const DSA = require('dsa-sdk');
const web3 = new Web3(new Web3.providers.HttpProvider(ETH_NODE_URL))
```
Now instantiate DSA.
```js
const dsa = new DSA(web3);
```
## Get Accounts