@galacticcouncil/sdk 0.0.1-beta.9 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
 
4
4
  [![npm version](https://img.shields.io/npm/v/@galacticcouncil/sdk.svg)](https://www.npmjs.com/package/@galacticcouncil/sdk)
5
5
  ![Coverage](./badges/coverage-jest%20coverage.svg)
6
- [![CodeFactor](https://www.codefactor.io/repository/github/galacticcouncil/sdk/badge)](https://www.codefactor.io/repository/github/galacticcouncil/sdk)
7
6
 
8
7
  </p>
9
8
  Galactic SDK is collection of components crafted to ease Basilisk & HydraDX chains integration.
@@ -27,9 +26,9 @@ Install with [npm](https://www.npmjs.com/):
27
26
 
28
27
  ## Components
29
28
 
30
- ### TradeRouter
29
+ ### Router
31
30
 
32
- Off-chain optimization of orders across pools for best price execution. Router does not perform any on-chain transations.
31
+ Off-chain routing, build to find the most suitable routes across the the pools. Building block for TradeRouter.
33
32
 
34
33
  #### API
35
34
 
@@ -38,6 +37,16 @@ getPools(): PoolBase[]
38
37
  getAllAssets(): PoolAsset[]
39
38
  getAssetPairs(token: string): PoolAsset[]
40
39
  getAllPaths(tokenIn: string, tokenOut: string): Hop[][]
40
+ ```
41
+
42
+ ### TradeRouter
43
+
44
+ Off-chain optimization of orders across pools for best price execution. TradeRouter does not perform any on-chain transations.
45
+
46
+ #### API
47
+
48
+ ```typescript
49
+ getBestSpotPrice(tokenIn: string, tokenOut: string): Amount
41
50
  getBestSell(tokenIn: string, tokenOut: string, amountIn: BigNumber | number | string): Trade
42
51
  getBestBuy(tokenIn: string, tokenOut: string, amountOut: BigNumber | number | string): Trade
43
52
  ```
@@ -49,27 +58,21 @@ For type signature visit [types.ts](src/types.ts)<br />
49
58
  ```typescript
50
59
  // Import
51
60
  import { ApiPromise, WsProvider } from '@polkadot/api';
52
- import { TradeRouter, PolkadotPoolService } from '@galacticcouncil/sdk';
61
+ import { TradeRouter, PolkadotApiPoolService } from '@galacticcouncil/sdk';
53
62
 
54
63
  // Initialize Polkadot API
55
64
  const wsProvider = new WsProvider('wss://rpc.basilisk.cloud');
56
65
  const api = await ApiPromise.create({ provider: wsProvider });
57
66
 
58
- // Initialize Router
59
- const poolService = new PolkadotPoolService(api);
60
- const tradeRouter = new TradeRouter(poolService);
67
+ // Initialize Trade Router
68
+ const poolService = new PolkadotApiPoolService(api);
69
+ const tradeRouter = new TradeRouter(poolService, { includeOnly: [PoolType.XYK] });
61
70
 
62
71
  // Do something
63
72
  const result = await tradeRouter.getAllAssets();
64
73
  console.log(result);
65
74
  ```
66
75
 
67
- ### TradeExecutor
68
-
69
- On-chain transaction executor using data from router to perform best possible trade.
70
-
71
- Not supported yet. 🛠
72
-
73
76
  ## Examples
74
77
 
75
78
  SDK Examples and testing helpers.
@@ -88,17 +91,17 @@ Component list and current status ⬇️
88
91
  - 🛠 Work in progress
89
92
  - ⏳ Planning to build
90
93
 
91
- | Name | Type | |
92
- | ------------- | :----: | --: |
93
- | TradeRouter | API | 🧪 |
94
- | TradeExecutor | API | 🛠 |
95
- | Polkadot | Client | 🧪 |
96
- | Capi | Client | ⏳ |
97
- | XYK | Pool | 🧪 |
98
- | LBP | Pool | |
99
- | Stable | Pool | |
100
- | Omni | Pool | ⏳ |
94
+ | Name | Type | |
95
+ | ----------- | :----: | --: |
96
+ | Router | API | 🧪 |
97
+ | TradeRouter | API | 🧪 |
98
+ | Polkadot | Client | 🧪 |
99
+ | Capi | Client | ⏳ |
100
+ | XYK | Pool | 🧪 |
101
+ | Omni | Pool | 🧪 |
102
+ | LBP | Pool | 🛠 |
103
+ | Stable | Pool | ⏳ |
101
104
 
102
105
  ## Issue reporting
103
106
 
104
- In case of unexpected sdk behaviour, please create well-written issue [here](https://https://github.com/nohaapav/router-sdk/issues/new). It makes it easier to find & fix the problem accordingly.
107
+ In case of unexpected sdk behaviour, please create well-written issue [here](https://https://github.com/galacticcouncil/sdk/issues/new). It makes it easier to find & fix the problem accordingly.