@galacticcouncil/sdk-next 0.25.0-pr243-ced8794 → 0.25.0-pr243-1cee03e

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.
@@ -39,7 +39,7 @@ export declare class TradeRouter extends Router {
39
39
  */
40
40
  private getPoolFeeRange;
41
41
  /**
42
- * Calculate and return best possible sell trade for assetIn>assetOut
42
+ * Calculate and return best possible sell trade for assetIn > assetOut
43
43
  *
44
44
  * @param {number} assetIn - assetIn id
45
45
  * @param {number} assetOut - assetOut id
@@ -78,16 +78,23 @@ export declare class TradeRouter extends Router {
78
78
  *
79
79
  * @param poolsMap - pools map
80
80
  * @param route - sell route
81
- * @returns - sell trade
81
+ * @returns sell trade
82
82
  */
83
83
  private buildSell;
84
84
  /**
85
- * Calculate the amount out for best possible trade if fees are zero
85
+ * Calculate route spot price
86
+ *
87
+ * @param route - trade route
88
+ * @returns spot price
89
+ */
90
+ private calculateSpot;
91
+ /**
92
+ * Calculate the output amount of a trade assuming fees are zero
86
93
  *
87
94
  * @param amountIn - amount of assetIn to sell for assetOut
88
- * @param route - best possible trade route (sell)
95
+ * @param route - trade route
89
96
  * @param poolsMap - pools map
90
- * @returns the amount out for best possible trade if fees are zero
97
+ * @returns the amount out if fees are zero
91
98
  */
92
99
  private calculateDelta0Y;
93
100
  /**
@@ -104,13 +111,12 @@ export declare class TradeRouter extends Router {
104
111
  */
105
112
  private calculateMostLiquidRoute;
106
113
  /**
107
- * Calculate and return sell swaps for given path
108
- * - final amount of previous swap is entry to next one
114
+ * Calculate and return sell route for given path
109
115
  *
110
116
  * @param amountIn - amount of assetIn to sell for assetOut
111
117
  * @param path - current path
112
118
  * @param poolsMap - pools map
113
- * @returns sell swaps for given path
119
+ * @returns sell route for given path with corresponding pool pairs
114
120
  */
115
121
  private toSellSwaps;
116
122
  /**
@@ -130,10 +136,10 @@ export declare class TradeRouter extends Router {
130
136
  */
131
137
  getSpotPrice(assetIn: number, assetOut: number): Promise<Amount | undefined>;
132
138
  /**
133
- * Find best buy route
139
+ * Find best buy route without errors
134
140
  *
135
141
  * @param swaps - buy routes
136
- * @returns the most beneficial route without errors, if exist
142
+ * @returns best buy route if exist, otherwise first one found
137
143
  */
138
144
  private findBestBuyRoute;
139
145
  /**
@@ -176,27 +182,26 @@ export declare class TradeRouter extends Router {
176
182
  *
177
183
  * @param poolsMap - pools map
178
184
  * @param route - buy route
179
- * @returns - buy trade
185
+ * @returns buy trade
180
186
  */
181
187
  private buildBuy;
182
188
  /**
183
- * Calculate the amount in for best possible trade if fees are zero
189
+ * Calculates the required input amount for a trade to receive a desired output amount,
190
+ * assuming fees are zero.
184
191
  *
185
192
  * @param amountOut - amount of assetOut to buy for assetIn
186
- * @param bestRoute - best possible trade route (buy)
193
+ * @param route - trade route
187
194
  * @param poolsMap - pools map
188
- * @returns the amount in for best possible trade if fees are zero
195
+ * @returns the required input amount for a trade if fees are zero
189
196
  */
190
197
  private calculateDelta0X;
191
198
  /**
192
- * Calculate and return buy swaps for given path
193
- * - final amount of previous swap is entry to next one
194
- * - calculation is done backwards (swaps in reversed order)
199
+ * Calculate and return buy route for given path
195
200
  *
196
201
  * @param amountOut - amount of assetOut to buy for assetIn
197
202
  * @param path - current path
198
203
  * @param poolsMap - pools map
199
- * @returns buy swaps for given path
204
+ * @returns buy route for given path
200
205
  */
201
206
  private toBuySwaps;
202
207
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacticcouncil/sdk-next",
3
- "version": "0.25.0-pr243-ced8794",
3
+ "version": "0.25.0-pr243-1cee03e",
4
4
  "description": "Galactic next gen sdk (papi)",
5
5
  "author": "GalacticCouncil",
6
6
  "repository": {