impermax-sdk 2.1.73 → 2.1.74
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,12 +1,11 @@
|
|
|
1
1
|
import { Borrowable } from "../../config/types";
|
|
2
|
-
import OffchainCollateral from "./offchainCollateral";
|
|
3
2
|
import OffchainLendingPool from "./offchainLendingPool";
|
|
4
3
|
import OffchainCollateralV2 from "./offchainCollateralV2";
|
|
5
4
|
import OffchainBorrowableV2 from "./offchainBorrowableV2";
|
|
6
5
|
import OffchainAccount from "../account";
|
|
7
6
|
import OffchainAccountLendingPoolV2 from "../account/lendingPool/offchainAccountLendingPoolV2";
|
|
8
7
|
export default class OffchainLendingPoolV2 extends OffchainLendingPool {
|
|
9
|
-
protected readonly collateral:
|
|
8
|
+
protected readonly collateral: OffchainCollateralV2;
|
|
10
9
|
protected readonly borrowables: {
|
|
11
10
|
[Borrowable.A]: OffchainBorrowableV2;
|
|
12
11
|
[Borrowable.B]: OffchainBorrowableV2;
|
|
@@ -14,4 +13,5 @@ export default class OffchainLendingPoolV2 extends OffchainLendingPool {
|
|
|
14
13
|
protected getNewCollateralObject(): OffchainCollateralV2;
|
|
15
14
|
protected getNewBorrowableObject(borrowable: Borrowable): OffchainBorrowableV2;
|
|
16
15
|
getNewAccountLendingPoolObject(account: OffchainAccount): OffchainAccountLendingPoolV2;
|
|
16
|
+
getTVL(): Promise<number>;
|
|
17
17
|
}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
@@ -18,5 +27,17 @@ class OffchainLendingPoolV2 extends offchainLendingPool_1.default {
|
|
|
18
27
|
getNewAccountLendingPoolObject(account) {
|
|
19
28
|
return new offchainAccountLendingPoolV2_1.default(account, this);
|
|
20
29
|
}
|
|
30
|
+
getTVL() {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const [supply0USD, supply1USD, lpUSD] = yield Promise.all([
|
|
33
|
+
this.getBorrowableA().getTotalBalanceUSD(),
|
|
34
|
+
this.getBorrowableB().getTotalBalanceUSD(),
|
|
35
|
+
this.collateral.getTotalBalanceUSD()
|
|
36
|
+
]);
|
|
37
|
+
if (supply0USD && supply1USD && lpUSD)
|
|
38
|
+
return supply0USD + supply1USD + lpUSD;
|
|
39
|
+
return 0;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
21
42
|
}
|
|
22
43
|
exports.default = OffchainLendingPoolV2;
|