README update

This commit is contained in:
Aleksandr Kraiz
2022-04-21 20:41:39 +04:00
parent 106b702d21
commit d7ea8e3aff

View File

@@ -1,22 +1,10 @@
# Orion Protocol SDK
## Install
Before install SDK you need create Personal Access Token.
1. Create PAT [here](https://github.com/settings/tokens):
1. type any name (for example `READ_PACKAGES`)
2. select scope `read:packages`)
2. At your machine go to `~` (your home directory, **not project!**)
3. Create or modify `.npmrc` file with content:
# Install
```console
npm i @orionprotocol/sdk
```
//npm.pkg.github.com/:_authToken=YOUR_PAT
@orionprotocol:registry=https://npm.pkg.github.com/
```
4. Save `.npmrc` file
5. Now you can install `@orionprotocol/sdk` as dependency in your package
# Usage
@@ -162,18 +150,17 @@ orionUnit.orionAggregator.ws.subscribe(
services.orionAggregator.ws.SubscriptionType.SWAP_SUBSCRIBE,
{
payload: {
d: swapRequestId,
d: swapRequestId, // generated by client
i: assetIn, // asset in
o: assetOut, // asset out
e: true, // true when type of swap is exactSpend, can be omitted (true bu default)
a: 5.62345343,
a: 5.62345343, // amount
},
// Handle data update in your way
callback: (swapInfo) => {
switch (swapInfo.kind) {
case "exactSpend":
console.log(swapInfo.availableAmountOut);
break;
case "exactReceive":
console.log(swapInfo.availableAmountOut);