Updated SDK version and bit of refactor.

This commit is contained in:
Thrilok Kumar 2020-04-10 08:08:18 +05:30
parent 16fb4c7c67
commit d043083bbd

View File

@ -8,6 +8,7 @@ Our team is super active to assist with your queries at our [TG developer group]
## Get Started ## Get Started
**Node** **Node**
To get started, install the DSA SDK package from NPM: To get started, install the DSA SDK package from NPM:
```bash ```bash
@ -19,7 +20,7 @@ npm install dsa-sdk
via jsDelivr CDN: via jsDelivr CDN:
```html ```html
<script src="https://cdn.jsdelivr.net/npm/dsa-sdk@1.2.3/build/dsa.js"></script> <script src="https://cdn.jsdelivr.net/npm/dsa-sdk@1.2.5/build/dsa.js"></script>
``` ```
For production, we recommend linking to a specific version number ([jsdeliver](https://www.jsdelivr.com/package/npm/dsa-sdk)). For production, we recommend linking to a specific version number ([jsdeliver](https://www.jsdelivr.com/package/npm/dsa-sdk)).
@ -98,28 +99,6 @@ new web3.eth.Contract(ABI, contract);
}); });
``` ```
## Set Instance
Once you get the DSA(s), set some common values so you don't have to pass similar arguments in further calls.
```js
let address = "0x...";
let dsaAccount = dsa.getAccounts(address);
dsa.setInstance({
id: dsaAccount[0].id,
address: dsaAccount[0].account,
origin: "0x..." // optional
})
```
### Parameters
1. `Object`
* `id` - `Number`: The number of DSA.
* `address` - `String`: The address of DSA.
* `origin` - `String`: The address to track the transaction origination (affiliates).
## Build DSA ## Build DSA
Build a new DSA. Build a new DSA.
@ -166,6 +145,27 @@ new web3.eth.Contract(ABI, contract).methods
}); });
``` ```
## Set Instance
Once you get the DSA(s), set some common values so you don't have to pass similar arguments in further calls.
```js
let address = "0x...";
let dsaAccount = await dsa.getAccounts(address);
dsa.setInstance({
id: dsaAccount[0].id,
address: dsaAccount[0].account,
origin: "0x..." // optional
})
```
### Parameters
1. `Object`
* `id` - `Number`: The number of DSA.
* `address` - `String`: The address of DSA.
* `origin` - `String`: The address to track the transaction origination (affiliates).
## Interact with DSA ## Interact with DSA
Once the DSA is build, use the following function to make calls to your DSA. This is where you'll interact with other smart contracts like DeFi protocols. Once the DSA is build, use the following function to make calls to your DSA. This is where you'll interact with other smart contracts like DeFi protocols.