@gearbox-protocol/sdk 1.20.7 → 1.20.8

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.
@@ -1,6 +1,6 @@
1
1
  import { BigNumber, providers, Signer } from "ethers";
2
- import { ChartsPoolDataPayload, PoolDataPayload } from "../payload/pool";
3
- import { IPoolService } from "../types";
2
+ import { ChartsPoolDataPayload, PoolDataPayload } from "../../payload/pool";
3
+ import { IPoolService } from "../../types";
4
4
  export declare class PoolData {
5
5
  readonly id: string;
6
6
  readonly address: string;
@@ -40,6 +40,7 @@ export declare class ChartsPoolData extends PoolData {
40
40
  readonly depositAPY7D: number;
41
41
  readonly depositAPY30D: number;
42
42
  readonly lmAPY: number;
43
+ readonly utilization: number;
43
44
  constructor({ expectedLiquidityInUSD, expectedLiquidityLimitInUSD, availableLiquidityInUSD, totalBorrowedInUSD, caLockedValueInUSD, uniqueLPs, dieselAPY7D, dieselAPY30D, lmAPY, ...restPayload }: ChartsPoolDataPayload);
44
45
  }
45
46
  export {};
@@ -75,9 +75,9 @@ var __rest = (this && this.__rest) || function (s, e) {
75
75
  Object.defineProperty(exports, "__esModule", { value: true });
76
76
  exports.ChartsPoolData = exports.PoolData = void 0;
77
77
  var ethers_1 = require("ethers");
78
- var types_1 = require("../types");
79
- var formatter_1 = require("../utils/formatter");
80
- var constants_1 = require("./constants");
78
+ var types_1 = require("../../types");
79
+ var formatter_1 = require("../../utils/formatter");
80
+ var constants_1 = require("../constants");
81
81
  var PoolData = /** @class */ (function () {
82
82
  function PoolData(payload) {
83
83
  this.isPaused = false;
@@ -132,6 +132,11 @@ var ChartsPoolData = /** @class */ (function (_super) {
132
132
  _this.depositAPY30D = dieselAPY30D / constants_1.PERCENTAGE_DECIMALS;
133
133
  _this.caLockedValueInUSD = caLockedValueInUSD;
134
134
  _this.lmAPY = lmAPY / constants_1.PERCENTAGE_FACTOR;
135
+ _this.utilization =
136
+ ethers_1.BigNumber.from(v1Props.totalBorrowed)
137
+ .mul(constants_1.PERCENTAGE_FACTOR)
138
+ .div(ethers_1.BigNumber.from(v1Props.expectedLiquidity))
139
+ .toNumber() / constants_1.PERCENTAGE_DECIMALS;
135
140
  return _this;
136
141
  }
137
142
  return ChartsPoolData;
@@ -0,0 +1,2 @@
1
+ export * from "./data";
2
+ export * from "./operation";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./data"), exports);
18
+ __exportStar(require("./operation"), exports);
@@ -0,0 +1,29 @@
1
+ import { BigNumber } from "ethers";
2
+ import { TokenData } from "../../tokens/tokenData";
3
+ export interface BasePoolOperation {
4
+ amount: string;
5
+ pool: string;
6
+ session_id: string;
7
+ timestamp: number;
8
+ tx_hash: string;
9
+ user: string;
10
+ }
11
+ export declare abstract class AbstractPoolOperation {
12
+ readonly txHash: string;
13
+ readonly date: string;
14
+ readonly timestamp: number;
15
+ readonly user: string;
16
+ readonly sessionId: string;
17
+ readonly pool: string;
18
+ readonly amount: BigNumber;
19
+ constructor(opts: BasePoolOperation);
20
+ abstract toString(token: TokenData): string;
21
+ }
22
+ export declare type PoolOperationResponse = BasePoolOperation & {
23
+ event: string;
24
+ };
25
+ export declare class PoolOperation extends AbstractPoolOperation {
26
+ readonly event: string;
27
+ constructor(ops: PoolOperationResponse);
28
+ toString(token: TokenData): string;
29
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.PoolOperation = exports.AbstractPoolOperation = void 0;
19
+ var ethers_1 = require("ethers");
20
+ var moment_1 = require("moment");
21
+ var contractsRegister_1 = require("../../contracts/contractsRegister");
22
+ var formatter_1 = require("../../utils/formatter");
23
+ var AbstractPoolOperation = /** @class */ (function () {
24
+ function AbstractPoolOperation(opts) {
25
+ this.txHash = opts.tx_hash;
26
+ this.amount = ethers_1.BigNumber.from(opts.amount);
27
+ this.pool = opts.pool;
28
+ this.sessionId = opts.session_id;
29
+ this.user = opts.user;
30
+ this.timestamp = opts.timestamp;
31
+ this.date = (0, moment_1.unix)(opts.timestamp).format("Do MMM YYYY");
32
+ }
33
+ return AbstractPoolOperation;
34
+ }());
35
+ exports.AbstractPoolOperation = AbstractPoolOperation;
36
+ var PoolOperation = /** @class */ (function (_super) {
37
+ __extends(PoolOperation, _super);
38
+ function PoolOperation(ops) {
39
+ var _this = _super.call(this, ops) || this;
40
+ _this.event = ops.event;
41
+ return _this;
42
+ }
43
+ PoolOperation.prototype.toString = function (token) {
44
+ return "".concat(this.event, " ").concat((0, formatter_1.formatBN)(ethers_1.BigNumber.from(this.amount), token.decimals), " ").concat((0, contractsRegister_1.getContractName)(this.pool));
45
+ };
46
+ return PoolOperation;
47
+ }(AbstractPoolOperation));
48
+ exports.PoolOperation = PoolOperation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "1.20.7",
3
+ "version": "1.20.8",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",