impermax-sdk 1.2.15 → 1.2.16
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.
|
@@ -112,5 +112,18 @@ class OffchainAccount {
|
|
|
112
112
|
return earningsUSD;
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
+
getLendingVaultsYearlyYieldUSD() {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
let yieldUSD = 0;
|
|
118
|
+
const lendingVaultUserData = yield this.getLendingVaultsUserData();
|
|
119
|
+
if (lendingVaultUserData === null)
|
|
120
|
+
return 0;
|
|
121
|
+
for (const address in lendingVaultUserData) {
|
|
122
|
+
const lendingVault = yield this.getLendingVault(address);
|
|
123
|
+
yieldUSD += (yield lendingVault.getValue()) * (yield lendingVault.getPoolToken().getSupplyAPR());
|
|
124
|
+
}
|
|
125
|
+
return yieldUSD;
|
|
126
|
+
});
|
|
127
|
+
}
|
|
115
128
|
}
|
|
116
129
|
exports.default = OffchainAccount;
|
|
@@ -7,6 +7,7 @@ export default class OffchainAccountLendingVault extends OffchainAccountPoolToke
|
|
|
7
7
|
protected readonly poolToken: OffchainLendingVault;
|
|
8
8
|
constructor(account: OffchainAccount, lendingVault: OffchainLendingVault);
|
|
9
9
|
getAccount: () => OffchainAccount;
|
|
10
|
+
getPoolToken: () => OffchainLendingVault;
|
|
10
11
|
private getVaultAddress;
|
|
11
12
|
getLendingVaultPosition(): Promise<LendingVaultPosition | undefined>;
|
|
12
13
|
getAmount(): Promise<number>;
|
|
@@ -17,6 +17,7 @@ class OffchainAccountLendingVault extends offchainAccountPoolToken_1.default {
|
|
|
17
17
|
constructor(account, lendingVault) {
|
|
18
18
|
super();
|
|
19
19
|
this.getAccount = () => this.account;
|
|
20
|
+
this.getPoolToken = () => this.poolToken;
|
|
20
21
|
this.getVaultAddress = () => this.poolToken.getVaultAddress();
|
|
21
22
|
this.account = account;
|
|
22
23
|
this.poolToken = lendingVault;
|