mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
README update
This commit is contained in:
23
README.md
23
README.md
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user