mirror of
https://github.com/Instadapp/dsa-developers.git
synced 2024-07-29 21:56:57 +00:00
edits in usage
This commit is contained in:
parent
713f60e41c
commit
16fb4c7c67
21
README.md
21
README.md
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user