From 16fb4c7c67369fe1bbbd657e681967227809e9a5 Mon Sep 17 00:00:00 2001 From: Sowmay Jain Date: Thu, 9 Apr 2020 23:24:09 +1000 Subject: [PATCH] edits in usage --- README.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 21e3194..6b61b8e 100644 --- a/README.md +++ b/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