@gearbox-protocol/sdk 1.5.10 → 1.5.11

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.
@@ -19,3 +19,4 @@ export declare const tokenDataByNetwork: Record<NetworkType, Record<SupportedTok
19
19
  export declare const tokenSymbolByAddress: Record<string, SupportedToken>;
20
20
  export declare const isSupportedToken: (t: unknown) => t is SupportedToken;
21
21
  export declare const isLPToken: (t: unknown) => t is LPTokens;
22
+ export declare function getDecimals(token: SupportedToken | string): number;
@@ -11,10 +11,11 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.isLPToken = exports.isSupportedToken = exports.tokenSymbolByAddress = exports.tokenDataByNetwork = exports.supportedTokens = exports.lpTokens = void 0;
14
+ exports.getDecimals = exports.isLPToken = exports.isSupportedToken = exports.tokenSymbolByAddress = exports.tokenDataByNetwork = exports.supportedTokens = exports.lpTokens = void 0;
15
15
  var mappers_1 = require("../utils/mappers");
16
16
  var convex_1 = require("./convex");
17
17
  var curveLP_1 = require("./curveLP");
18
+ var decimals_1 = require("./decimals");
18
19
  var gear_1 = require("./gear");
19
20
  var normal_1 = require("./normal");
20
21
  var yearn_1 = require("./yearn");
@@ -171,3 +172,14 @@ var isLPToken = function (t) {
171
172
  return typeof t === "string" && !!exports.lpTokens[t];
172
173
  };
173
174
  exports.isLPToken = isLPToken;
175
+ function getDecimals(token) {
176
+ var dec = decimals_1.decimals[token];
177
+ if (dec)
178
+ return dec;
179
+ dec = decimals_1.decimals[exports.tokenSymbolByAddress[token.toLowerCase()]];
180
+ if (!dec) {
181
+ throw new Error("Decimals for ".concat(token, " not found"));
182
+ }
183
+ return dec;
184
+ }
185
+ exports.getDecimals = getDecimals;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "1.5.10",
3
+ "version": "1.5.11",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",