@strkfarm/sdk 1.0.61 → 1.0.62

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.
@@ -47686,7 +47686,8 @@ ${indent}}` : "}";
47686
47686
  const url = this.EKUBO_API.replace("{{TOKEN_ADDRESS}}", token.address.toString()).replace("{{AMOUNT}}", amountIn.toWei());
47687
47687
  const result = await axios_default.get(url);
47688
47688
  const data = result.data;
47689
- const outputUSDC = Number(Web3Number.fromWei(data.total_calculated, 6).toFixed(6));
47689
+ const multiplier = 1 / amountIn.toNumber();
47690
+ const outputUSDC = Number(Web3Number.fromWei(data.total_calculated, 6).toFixed(6)) * multiplier;
47690
47691
  logger.verbose(`Ekubo: ${token.symbol} -> USDC: ${outputUSDC}, retry: ${retry}`);
47691
47692
  if (outputUSDC === 0 && retry < 3) {
47692
47693
  const amountIn2 = new Web3Number(100, token.decimals);
@@ -423,7 +423,8 @@ var Pricer = class extends PricerBase {
423
423
  const url = this.EKUBO_API.replace("{{TOKEN_ADDRESS}}", token.address.toString()).replace("{{AMOUNT}}", amountIn.toWei());
424
424
  const result = await axios2.get(url);
425
425
  const data = result.data;
426
- const outputUSDC = Number(Web3Number.fromWei(data.total_calculated, 6).toFixed(6));
426
+ const multiplier = 1 / amountIn.toNumber();
427
+ const outputUSDC = Number(Web3Number.fromWei(data.total_calculated, 6).toFixed(6)) * multiplier;
427
428
  logger.verbose(`Ekubo: ${token.symbol} -> USDC: ${outputUSDC}, retry: ${retry}`);
428
429
  if (outputUSDC === 0 && retry < 3) {
429
430
  const amountIn2 = new Web3Number(100, token.decimals);
package/dist/index.js CHANGED
@@ -551,7 +551,8 @@ var Pricer = class extends PricerBase {
551
551
  const url = this.EKUBO_API.replace("{{TOKEN_ADDRESS}}", token.address.toString()).replace("{{AMOUNT}}", amountIn.toWei());
552
552
  const result = await import_axios2.default.get(url);
553
553
  const data = result.data;
554
- const outputUSDC = Number(Web3Number.fromWei(data.total_calculated, 6).toFixed(6));
554
+ const multiplier = 1 / amountIn.toNumber();
555
+ const outputUSDC = Number(Web3Number.fromWei(data.total_calculated, 6).toFixed(6)) * multiplier;
555
556
  logger.verbose(`Ekubo: ${token.symbol} -> USDC: ${outputUSDC}, retry: ${retry}`);
556
557
  if (outputUSDC === 0 && retry < 3) {
557
558
  const amountIn2 = new Web3Number(100, token.decimals);
package/dist/index.mjs CHANGED
@@ -464,7 +464,8 @@ var Pricer = class extends PricerBase {
464
464
  const url = this.EKUBO_API.replace("{{TOKEN_ADDRESS}}", token.address.toString()).replace("{{AMOUNT}}", amountIn.toWei());
465
465
  const result = await axios2.get(url);
466
466
  const data = result.data;
467
- const outputUSDC = Number(Web3Number.fromWei(data.total_calculated, 6).toFixed(6));
467
+ const multiplier = 1 / amountIn.toNumber();
468
+ const outputUSDC = Number(Web3Number.fromWei(data.total_calculated, 6).toFixed(6)) * multiplier;
468
469
  logger.verbose(`Ekubo: ${token.symbol} -> USDC: ${outputUSDC}, retry: ${retry}`);
469
470
  if (outputUSDC === 0 && retry < 3) {
470
471
  const amountIn2 = new Web3Number(100, token.decimals);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strkfarm/sdk",
3
- "version": "1.0.61",
3
+ "version": "1.0.62",
4
4
  "description": "STRKFarm TS SDK (Meant for our internal use, but feel free to use it)",
5
5
  "typings": "dist/index.d.ts",
6
6
  "types": "dist/index.d.ts",
@@ -187,7 +187,8 @@ export class Pricer extends PricerBase {
187
187
  const url = this.EKUBO_API.replace("{{TOKEN_ADDRESS}}", token.address.toString()).replace("{{AMOUNT}}", amountIn.toWei());
188
188
  const result = await axios.get(url);
189
189
  const data: any = result.data;
190
- const outputUSDC = Number(Web3Number.fromWei(data.total_calculated, 6).toFixed(6));
190
+ const multiplier = 1 / amountIn.toNumber();
191
+ const outputUSDC = Number(Web3Number.fromWei(data.total_calculated, 6).toFixed(6)) * multiplier;
191
192
  logger.verbose(`Ekubo: ${token.symbol} -> USDC: ${outputUSDC}, retry: ${retry}`);
192
193
  if (outputUSDC === 0 && retry < 3) {
193
194
  // try again with a higher amount