@galacticcouncil/sdk 0.0.1-beta.9 → 0.0.1

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,13 @@ Install with [npm](https://www.npmjs.com/):
27
26
 
28
27
  ## Components
29
28
 
29
+ ## Router
30
+
31
+ Off-chain routing, build to find the all possible trading routes across the the pools. Building block for TradeRouter.
32
+
30
33
  ### TradeRouter
31
34
 
32
- Off-chain optimization of orders across pools for best price execution. Router does not perform any on-chain transations.
35
+ Off-chain optimization of orders across pools for best price execution. TradeRouter does not perform any on-chain transations.
33
36
 
34
37
  #### API
35
38
 
@@ -38,6 +41,7 @@ getPools(): PoolBase[]
38
41
  getAllAssets(): PoolAsset[]
39
42
  getAssetPairs(token: string): PoolAsset[]
40
43
  getAllPaths(tokenIn: string, tokenOut: string): Hop[][]
44
+ getBestSpotPrice(tokenIn: string, tokenOut: string): Amount
41
45
  getBestSell(tokenIn: string, tokenOut: string, amountIn: BigNumber | number | string): Trade
42
46
  getBestBuy(tokenIn: string, tokenOut: string, amountOut: BigNumber | number | string): Trade
43
47
  ```
@@ -49,27 +53,21 @@ For type signature visit [types.ts](src/types.ts)<br />
49
53
  ```typescript
50
54
  // Import
51
55
  import { ApiPromise, WsProvider } from '@polkadot/api';
52
- import { TradeRouter, PolkadotPoolService } from '@galacticcouncil/sdk';
56
+ import { TradeRouter, PolkadotApiPoolService } from '@galacticcouncil/sdk';
53
57
 
54
58
  // Initialize Polkadot API
55
59
  const wsProvider = new WsProvider('wss://rpc.basilisk.cloud');
56
60
  const api = await ApiPromise.create({ provider: wsProvider });
57
61
 
58
- // Initialize Router
59
- const poolService = new PolkadotPoolService(api);
60
- const tradeRouter = new TradeRouter(poolService);
62
+ // Initialize Trade Router
63
+ const poolService = new PolkadotApiPoolService(api);
64
+ const tradeRouter = new TradeRouter(poolService, { includeOnly: [PoolType.XYK] });
61
65
 
62
66
  // Do something
63
67
  const result = await tradeRouter.getAllAssets();
64
68
  console.log(result);
65
69
  ```
66
70
 
67
- ### TradeExecutor
68
-
69
- On-chain transaction executor using data from router to perform best possible trade.
70
-
71
- Not supported yet. 🛠
72
-
73
71
  ## Examples
74
72
 
75
73
  SDK Examples and testing helpers.
@@ -88,17 +86,17 @@ Component list and current status ⬇️
88
86
  - 🛠 Work in progress
89
87
  - ⏳ Planning to build
90
88
 
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 | ⏳ |
89
+ | Name | Type | |
90
+ | ----------- | :----: | --: |
91
+ | Router | API | 🧪 |
92
+ | TradeRouter | API | 🧪 |
93
+ | Polkadot | Client | 🧪 |
94
+ | Capi | Client | ⏳ |
95
+ | XYK | Pool | 🧪 |
96
+ | Omni | Pool | 🧪 |
97
+ | LBP | Pool | 🛠 |
98
+ | Stable | Pool | ⏳ |
101
99
 
102
100
  ## Issue reporting
103
101
 
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.
102
+ 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.