@kamino-finance/klend-sdk 5.10.7 → 5.10.9
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.
- package/dist/classes/manager.d.ts +20 -18
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +27 -20
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/types_utils.d.ts +11 -0
- package/dist/classes/types_utils.d.ts.map +1 -0
- package/dist/classes/types_utils.js +21 -0
- package/dist/classes/types_utils.js.map +1 -0
- package/dist/classes/utils.d.ts +7 -0
- package/dist/classes/utils.d.ts.map +1 -1
- package/dist/classes/utils.js +21 -0
- package/dist/classes/utils.js.map +1 -1
- package/dist/classes/vault.d.ts +23 -14
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +66 -34
- package/dist/classes/vault.js.map +1 -1
- package/dist/client_kamino_manager.d.ts.map +1 -1
- package/dist/client_kamino_manager.js +25 -2
- package/dist/client_kamino_manager.js.map +1 -1
- package/package.json +1 -1
- package/src/classes/manager.ts +40 -23
- package/src/classes/types_utils.ts +19 -0
- package/src/classes/utils.ts +22 -1
- package/src/classes/vault.ts +97 -42
- package/src/client_kamino_manager.ts +43 -4
package/dist/classes/vault.d.ts
CHANGED
|
@@ -20,6 +20,13 @@ export declare class KaminoVaultClient {
|
|
|
20
20
|
getConnection(): Connection;
|
|
21
21
|
getProgramID(): PublicKey;
|
|
22
22
|
hasFarm(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Prints a vault in a human readable form
|
|
25
|
+
* @param vaultPubkey - the address of the vault
|
|
26
|
+
* @param [vaultState] - optional parameter to pass the vault state directly; this will save a network call
|
|
27
|
+
* @returns - void; prints the vault to the console
|
|
28
|
+
*/
|
|
29
|
+
printVault(vaultPubkey: PublicKey, vaultState?: VaultState): Promise<void>;
|
|
23
30
|
/**
|
|
24
31
|
* This method will create a vault with a given config. The config can be changed later on, but it is recommended to set it up correctly from the start
|
|
25
32
|
* @param vaultConfig - the config object used to create a vault
|
|
@@ -173,13 +180,13 @@ export declare class KaminoVaultClient {
|
|
|
173
180
|
*/
|
|
174
181
|
getVaultFeesPct(vaultState: VaultState): VaultFeesPct;
|
|
175
182
|
/**
|
|
176
|
-
* This method calculates the token per
|
|
183
|
+
* This method calculates the token per share value. This will always change based on interest earned from the vault, but calculating it requires a bunch of rpc requests. Caching this for a short duration would be optimal
|
|
177
184
|
* @param vault - vault to calculate tokensPerShare for
|
|
178
|
-
* @param slot -
|
|
185
|
+
* @param [slot] - the slot at which we retrieve the tokens per share. Optional. If not provided, the function will fetch the current slot
|
|
179
186
|
* @param [vaultReservesMap] - hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
180
187
|
* @returns - token per share value
|
|
181
188
|
*/
|
|
182
|
-
getTokensPerShareSingleVault(vault: KaminoVault, slot
|
|
189
|
+
getTokensPerShareSingleVault(vault: KaminoVault, slot?: number, vaultReservesMap?: PubkeyHashMap<PublicKey, KaminoReserve>): Promise<Decimal>;
|
|
183
190
|
/**
|
|
184
191
|
* This method calculates the token per share value. This will always change based on interest earned from the vault, but calculating it requires a bunch of rpc requests. Caching this for a short duration would be optimal
|
|
185
192
|
* @param [vaultsOverride] - a list of vaults to get the tokens per share for; if provided with state it will not fetch the state again. Optional
|
|
@@ -236,7 +243,7 @@ export declare class KaminoVaultClient {
|
|
|
236
243
|
/**
|
|
237
244
|
* This will retrieve all the tokens that can be used as collateral by the users who borrow the token in the vault alongside details about the min and max loan to value ratio
|
|
238
245
|
* @param vaultState - the vault state to load reserves for
|
|
239
|
-
* @param slot - current slot
|
|
246
|
+
* @param [slot] - the slot for which to retrieve the vault collaterals for. Optional. If not provided the function will fetch the current slot
|
|
240
247
|
* @param [vaultReservesMap] - hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
241
248
|
* @param [kaminoMarkets] - a list of all the kamino markets. Optional. If provided the function will be significantly faster as it will not have to fetch the markets
|
|
242
249
|
* @returns a hashmap from each reserve pubkey to the market overview of the collaterals that can be used and the min and max loan to value ratio in that market
|
|
@@ -245,30 +252,31 @@ export declare class KaminoVaultClient {
|
|
|
245
252
|
/**
|
|
246
253
|
* This will return an VaultHoldings object which contains the amount available (uninvested) in vault, total amount invested in reseves and a breakdown of the amount invested in each reserve
|
|
247
254
|
* @param vault - the kamino vault to get available liquidity to withdraw for
|
|
248
|
-
* @param slot - current slot
|
|
249
|
-
* @param vaultReserves - a hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
255
|
+
* @param [slot] - the slot for which to calculate the holdings. Optional. If not provided the function will fetch the current slot
|
|
256
|
+
* @param [vaultReserves] - a hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
250
257
|
* @returns an VaultHoldings object representing the amount available (uninvested) in vault, total amount invested in reseves and a breakdown of the amount invested in each reserve
|
|
251
258
|
*/
|
|
252
|
-
getVaultHoldings(vault: VaultState, slot
|
|
259
|
+
getVaultHoldings(vault: VaultState, slot?: number, vaultReserves?: PubkeyHashMap<PublicKey, KaminoReserve>): Promise<VaultHoldings>;
|
|
253
260
|
/**
|
|
254
|
-
* This will return an
|
|
261
|
+
* This will return an VaultOverview object that encapsulates all the information about the vault, including the holdings, reserves details, theoretical APY, utilization ratio and total borrowed amount
|
|
255
262
|
* @param vault - the kamino vault to get available liquidity to withdraw for
|
|
256
|
-
* @param slot - current slot
|
|
257
263
|
* @param price - the price of the token in the vault (e.g. USDC)
|
|
264
|
+
* @param [slot] - the slot for which to retrieve the vault overview for. Optional. If not provided the function will fetch the current slot
|
|
258
265
|
* @param [vaultReservesMap] - hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
259
|
-
* @
|
|
266
|
+
* @param [kaminoMarkets] - a list of all kamino markets. Optional. If provided the function will be significantly faster as it will not have to fetch the markets
|
|
267
|
+
* @returns an VaultOverview object with details about the tokens available and invested in the vault, denominated in tokens and USD
|
|
260
268
|
*/
|
|
261
|
-
getVaultHoldingsWithPrice(vault: VaultState,
|
|
269
|
+
getVaultHoldingsWithPrice(vault: VaultState, price: Decimal, slot?: number, vaultReservesMap?: PubkeyHashMap<PublicKey, KaminoReserve>): Promise<VaultHoldingsWithUSDValue>;
|
|
262
270
|
/**
|
|
263
271
|
* This will return an VaultOverview object that encapsulates all the information about the vault, including the holdings, reserves details, theoretical APY, utilization ratio and total borrowed amount
|
|
264
272
|
* @param vault - the kamino vault to get available liquidity to withdraw for
|
|
265
|
-
* @param slot - current slot
|
|
266
273
|
* @param price - the price of the token in the vault (e.g. USDC)
|
|
274
|
+
* @param [slot] - the slot for which to retrieve the vault overview for. Optional. If not provided the function will fetch the current slot
|
|
267
275
|
* @param [vaultReservesMap] - hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
268
276
|
* @param [kaminoMarkets] - a list of all kamino markets. Optional. If provided the function will be significantly faster as it will not have to fetch the markets
|
|
269
277
|
* @returns an VaultOverview object with details about the tokens available and invested in the vault, denominated in tokens and USD
|
|
270
278
|
*/
|
|
271
|
-
getVaultOverview(vault: VaultState,
|
|
279
|
+
getVaultOverview(vault: VaultState, price: Decimal, slot?: number, vaultReservesMap?: PubkeyHashMap<PublicKey, KaminoReserve>, kaminoMarkets?: KaminoMarket[]): Promise<VaultOverview>;
|
|
272
280
|
/**
|
|
273
281
|
* This will return an aggregation of the current state of the vault with all the invested amounts and the utilization ratio of the vault
|
|
274
282
|
* @param vault - the kamino vault to get available liquidity to withdraw for
|
|
@@ -304,9 +312,10 @@ export declare class KaminoVaultClient {
|
|
|
304
312
|
* @param vaultState the kamino vault state to get simulated holdings and earnings for
|
|
305
313
|
* @param [vaultReservesMap] - hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
306
314
|
* @param [currentSlot] - the current slot. Optional. If not provided it will fetch the current slot
|
|
315
|
+
* @param [previousTotalAUM] - the previous AUM of the vault to compute the earned interest relative to this value. Optional. If not provided the function will estimate the total AUM at the slot of the last state update on chain
|
|
307
316
|
* @returns a struct of simulated vault holdings and earned interest
|
|
308
317
|
*/
|
|
309
|
-
calculateSimulatedHoldingsWithInterest(vaultState: VaultState, vaultReservesMap?: PubkeyHashMap<PublicKey, KaminoReserve>, currentSlot?: number): Promise<SimulatedVaultHoldingsWithEarnedInterest>;
|
|
318
|
+
calculateSimulatedHoldingsWithInterest(vaultState: VaultState, vaultReservesMap?: PubkeyHashMap<PublicKey, KaminoReserve>, currentSlot?: number, previousTotalAUM?: Decimal): Promise<SimulatedVaultHoldingsWithEarnedInterest>;
|
|
310
319
|
/**
|
|
311
320
|
* Simulate the current holdings and compute the fees that would be charged
|
|
312
321
|
* @param vaultState the kamino vault state to get simulated fees for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vault.d.ts","sourceRoot":"","sources":["../../src/classes/vault.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,UAAU,EAEV,OAAO,EACP,SAAS,EAIT,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAIL,YAAY,EACZ,aAAa,EAEb,aAAa,EACb,OAAO,EAGR,MAAM,QAAQ,CAAC;AA2BhB,OAAO,EAAoB,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,OAAO,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"vault.d.ts","sourceRoot":"","sources":["../../src/classes/vault.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,UAAU,EAEV,OAAO,EACP,SAAS,EAIT,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAIL,YAAY,EACZ,aAAa,EAEb,aAAa,EACb,OAAO,EAGR,MAAM,QAAQ,CAAC;AA2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M,YAAY,GAAG;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC"}
|
package/dist/classes/vault.js
CHANGED
|
@@ -27,6 +27,7 @@ const CreationParameters_1 = require("@kamino-finance/kliquidity-sdk/dist/utils/
|
|
|
27
27
|
const dist_1 = require("@kamino-finance/farms-sdk/dist");
|
|
28
28
|
const lut_utils_1 = require("./lut_utils");
|
|
29
29
|
const farm_utils_1 = require("./farm_utils");
|
|
30
|
+
const types_utils_1 = require("./types_utils");
|
|
30
31
|
exports.kaminoVaultId = new web3_js_1.PublicKey('kvauTFR8qm1dhniz6pYuBZkuene3Hfrs1VQhVRgCNrr');
|
|
31
32
|
exports.kaminoVaultStagingId = new web3_js_1.PublicKey('STkvh7ostar39Fwr4uZKASs1RNNuYMFMTsE77FiRsL2');
|
|
32
33
|
const TOKEN_VAULT_SEED = 'token_vault';
|
|
@@ -56,6 +57,29 @@ class KaminoVaultClient {
|
|
|
56
57
|
hasFarm() {
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Prints a vault in a human readable form
|
|
62
|
+
* @param vaultPubkey - the address of the vault
|
|
63
|
+
* @param [vaultState] - optional parameter to pass the vault state directly; this will save a network call
|
|
64
|
+
* @returns - void; prints the vault to the console
|
|
65
|
+
*/
|
|
66
|
+
async printVault(vaultPubkey, vaultState) {
|
|
67
|
+
const vault = vaultState ? vaultState : await accounts_1.VaultState.fetch(this.getConnection(), vaultPubkey);
|
|
68
|
+
if (!vault) {
|
|
69
|
+
console.log(`Vault ${vaultPubkey.toString()} not found`);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const kaminoVault = new KaminoVault(vaultPubkey, vault, this._kaminoVaultProgramId);
|
|
73
|
+
const vaultName = this.decodeVaultName(vault.name);
|
|
74
|
+
const slot = await this.getConnection().getSlot('confirmed');
|
|
75
|
+
const tokensPerShare = await this.getTokensPerShareSingleVault(kaminoVault, slot);
|
|
76
|
+
const holdings = await this.getVaultHoldings(vault);
|
|
77
|
+
const sharesIssued = new decimal_js_1.default(vault.sharesIssued.toString()).div(new decimal_js_1.default(vault.sharesMintDecimals.toString()));
|
|
78
|
+
console.log('Name: ', vaultName);
|
|
79
|
+
console.log('Shares issued: ', sharesIssued);
|
|
80
|
+
(0, types_utils_1.printHoldings)(holdings);
|
|
81
|
+
console.log('Tokens per share: ', tokensPerShare);
|
|
82
|
+
}
|
|
59
83
|
/**
|
|
60
84
|
* This method will create a vault with a given config. The config can be changed later on, but it is recommended to set it up correctly from the start
|
|
61
85
|
* @param vaultConfig - the config object used to create a vault
|
|
@@ -695,11 +719,7 @@ class KaminoVaultClient {
|
|
|
695
719
|
}
|
|
696
720
|
/**Convert an u8 array to a string */
|
|
697
721
|
decodeVaultName(token) {
|
|
698
|
-
|
|
699
|
-
let s = new TextDecoder().decode(maxArray);
|
|
700
|
-
// Remove trailing zeros and spaces
|
|
701
|
-
s = s.replace(/[\0 ]+$/, '');
|
|
702
|
-
return s;
|
|
722
|
+
return (0, utils_1.decodeVaultName)(token);
|
|
703
723
|
}
|
|
704
724
|
withdrawIxn(user, vault, vaultState, marketAddress, reserve, userSharesAta, userTokenAta, shareAmountLamports, vaultReservesState) {
|
|
705
725
|
const lendingMarketAuth = (0, utils_2.lendingMarketAuthPda)(marketAddress, this._kaminoLendProgramId)[0];
|
|
@@ -1027,9 +1047,9 @@ class KaminoVaultClient {
|
|
|
1027
1047
|
};
|
|
1028
1048
|
}
|
|
1029
1049
|
/**
|
|
1030
|
-
* This method calculates the token per
|
|
1050
|
+
* This method calculates the token per share value. This will always change based on interest earned from the vault, but calculating it requires a bunch of rpc requests. Caching this for a short duration would be optimal
|
|
1031
1051
|
* @param vault - vault to calculate tokensPerShare for
|
|
1032
|
-
* @param slot -
|
|
1052
|
+
* @param [slot] - the slot at which we retrieve the tokens per share. Optional. If not provided, the function will fetch the current slot
|
|
1033
1053
|
* @param [vaultReservesMap] - hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
1034
1054
|
* @returns - token per share value
|
|
1035
1055
|
*/
|
|
@@ -1040,7 +1060,7 @@ class KaminoVaultClient {
|
|
|
1040
1060
|
}
|
|
1041
1061
|
const vaultReservesState = vaultReservesMap ? vaultReservesMap : await this.loadVaultReserves(vaultState);
|
|
1042
1062
|
const sharesDecimal = (0, lib_1.lamportsToDecimal)(vaultState.sharesIssued.toString(), vaultState.sharesMintDecimals.toString());
|
|
1043
|
-
const holdings = await this.getVaultHoldings(vaultState,
|
|
1063
|
+
const holdings = await this.getVaultHoldings(vaultState, slot, vaultReservesState);
|
|
1044
1064
|
return holdings.total.div(sharesDecimal);
|
|
1045
1065
|
}
|
|
1046
1066
|
/**
|
|
@@ -1214,7 +1234,7 @@ class KaminoVaultClient {
|
|
|
1214
1234
|
/**
|
|
1215
1235
|
* This will retrieve all the tokens that can be used as collateral by the users who borrow the token in the vault alongside details about the min and max loan to value ratio
|
|
1216
1236
|
* @param vaultState - the vault state to load reserves for
|
|
1217
|
-
* @param slot - current slot
|
|
1237
|
+
* @param [slot] - the slot for which to retrieve the vault collaterals for. Optional. If not provided the function will fetch the current slot
|
|
1218
1238
|
* @param [vaultReservesMap] - hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
1219
1239
|
* @param [kaminoMarkets] - a list of all the kamino markets. Optional. If provided the function will be significantly faster as it will not have to fetch the markets
|
|
1220
1240
|
* @returns a hashmap from each reserve pubkey to the market overview of the collaterals that can be used and the min and max loan to value ratio in that market
|
|
@@ -1269,8 +1289,8 @@ class KaminoVaultClient {
|
|
|
1269
1289
|
/**
|
|
1270
1290
|
* This will return an VaultHoldings object which contains the amount available (uninvested) in vault, total amount invested in reseves and a breakdown of the amount invested in each reserve
|
|
1271
1291
|
* @param vault - the kamino vault to get available liquidity to withdraw for
|
|
1272
|
-
* @param slot - current slot
|
|
1273
|
-
* @param vaultReserves - a hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
1292
|
+
* @param [slot] - the slot for which to calculate the holdings. Optional. If not provided the function will fetch the current slot
|
|
1293
|
+
* @param [vaultReserves] - a hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
1274
1294
|
* @returns an VaultHoldings object representing the amount available (uninvested) in vault, total amount invested in reseves and a breakdown of the amount invested in each reserve
|
|
1275
1295
|
*/
|
|
1276
1296
|
async getVaultHoldings(vault, slot, vaultReserves) {
|
|
@@ -1290,7 +1310,13 @@ class KaminoVaultClient {
|
|
|
1290
1310
|
if (reserve === undefined) {
|
|
1291
1311
|
throw new Error(`Reserve ${allocationStrategy.reserve.toBase58()} not found`);
|
|
1292
1312
|
}
|
|
1293
|
-
|
|
1313
|
+
let reserveCollExchangeRate;
|
|
1314
|
+
if (slot) {
|
|
1315
|
+
reserveCollExchangeRate = reserve.getEstimatedCollateralExchangeRate(slot, 0);
|
|
1316
|
+
}
|
|
1317
|
+
else {
|
|
1318
|
+
reserveCollExchangeRate = reserve.getCollateralExchangeRate();
|
|
1319
|
+
}
|
|
1294
1320
|
const reserveAllocationLiquidityAmount = new decimal_js_1.default(allocationStrategy.ctokenAllocation.toString()).div(reserveCollExchangeRate);
|
|
1295
1321
|
vaultHoldings.invested = vaultHoldings.invested.add(reserveAllocationLiquidityAmount);
|
|
1296
1322
|
vaultHoldings.investedInReserves.set(allocationStrategy.reserve, (0, lib_1.lamportsToDecimal)(reserveAllocationLiquidityAmount, decimals));
|
|
@@ -1305,14 +1331,15 @@ class KaminoVaultClient {
|
|
|
1305
1331
|
};
|
|
1306
1332
|
}
|
|
1307
1333
|
/**
|
|
1308
|
-
* This will return an
|
|
1334
|
+
* This will return an VaultOverview object that encapsulates all the information about the vault, including the holdings, reserves details, theoretical APY, utilization ratio and total borrowed amount
|
|
1309
1335
|
* @param vault - the kamino vault to get available liquidity to withdraw for
|
|
1310
|
-
* @param slot - current slot
|
|
1311
1336
|
* @param price - the price of the token in the vault (e.g. USDC)
|
|
1337
|
+
* @param [slot] - the slot for which to retrieve the vault overview for. Optional. If not provided the function will fetch the current slot
|
|
1312
1338
|
* @param [vaultReservesMap] - hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
1313
|
-
* @
|
|
1339
|
+
* @param [kaminoMarkets] - a list of all kamino markets. Optional. If provided the function will be significantly faster as it will not have to fetch the markets
|
|
1340
|
+
* @returns an VaultOverview object with details about the tokens available and invested in the vault, denominated in tokens and USD
|
|
1314
1341
|
*/
|
|
1315
|
-
async getVaultHoldingsWithPrice(vault,
|
|
1342
|
+
async getVaultHoldingsWithPrice(vault, price, slot, vaultReservesMap) {
|
|
1316
1343
|
const holdings = await this.getVaultHoldings(vault, slot, vaultReservesMap);
|
|
1317
1344
|
const investedInReservesUSD = new lib_1.PubkeyHashMap();
|
|
1318
1345
|
holdings.investedInReserves.forEach((amount, reserve) => {
|
|
@@ -1329,19 +1356,20 @@ class KaminoVaultClient {
|
|
|
1329
1356
|
/**
|
|
1330
1357
|
* This will return an VaultOverview object that encapsulates all the information about the vault, including the holdings, reserves details, theoretical APY, utilization ratio and total borrowed amount
|
|
1331
1358
|
* @param vault - the kamino vault to get available liquidity to withdraw for
|
|
1332
|
-
* @param slot - current slot
|
|
1333
1359
|
* @param price - the price of the token in the vault (e.g. USDC)
|
|
1360
|
+
* @param [slot] - the slot for which to retrieve the vault overview for. Optional. If not provided the function will fetch the current slot
|
|
1334
1361
|
* @param [vaultReservesMap] - hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
1335
1362
|
* @param [kaminoMarkets] - a list of all kamino markets. Optional. If provided the function will be significantly faster as it will not have to fetch the markets
|
|
1336
1363
|
* @returns an VaultOverview object with details about the tokens available and invested in the vault, denominated in tokens and USD
|
|
1337
1364
|
*/
|
|
1338
|
-
async getVaultOverview(vault,
|
|
1365
|
+
async getVaultOverview(vault, price, slot, vaultReservesMap, kaminoMarkets) {
|
|
1339
1366
|
const vaultReservesState = vaultReservesMap ? vaultReservesMap : await this.loadVaultReserves(vault);
|
|
1340
|
-
const vaultHoldingsWithUSDValuePromise = await this.getVaultHoldingsWithPrice(vault,
|
|
1341
|
-
const
|
|
1342
|
-
const
|
|
1343
|
-
const
|
|
1344
|
-
const
|
|
1367
|
+
const vaultHoldingsWithUSDValuePromise = await this.getVaultHoldingsWithPrice(vault, price, slot, vaultReservesState);
|
|
1368
|
+
const currentSlot = slot ? slot : await this.getConnection().getSlot();
|
|
1369
|
+
const vaultTheoreticalAPYPromise = await this.getVaultTheoreticalAPY(vault, currentSlot, vaultReservesState);
|
|
1370
|
+
const totalInvestedAndBorrowedPromise = await this.getTotalBorrowedAndInvested(vault, currentSlot, vaultReservesState);
|
|
1371
|
+
const vaultCollateralsPromise = await this.getVaultCollaterals(vault, currentSlot, vaultReservesState, kaminoMarkets);
|
|
1372
|
+
const reservesOverviewPromise = await this.getVaultReservesDetails(vault, currentSlot, vaultReservesState);
|
|
1345
1373
|
// all the async part of the functions above just read the vaultReservesState which is read beforehand, so excepting vaultCollateralsPromise they should do no additional network calls
|
|
1346
1374
|
const [vaultHoldingsWithUSDValue, vaultTheoreticalAPY, totalInvestedAndBorrowed, vaultCollaterals, reservesOverview,] = await Promise.all([
|
|
1347
1375
|
vaultHoldingsWithUSDValuePromise,
|
|
@@ -1472,19 +1500,23 @@ class KaminoVaultClient {
|
|
|
1472
1500
|
* @param vaultState the kamino vault state to get simulated holdings and earnings for
|
|
1473
1501
|
* @param [vaultReservesMap] - hashmap from each reserve pubkey to the reserve state. Optional. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
1474
1502
|
* @param [currentSlot] - the current slot. Optional. If not provided it will fetch the current slot
|
|
1503
|
+
* @param [previousTotalAUM] - the previous AUM of the vault to compute the earned interest relative to this value. Optional. If not provided the function will estimate the total AUM at the slot of the last state update on chain
|
|
1475
1504
|
* @returns a struct of simulated vault holdings and earned interest
|
|
1476
1505
|
*/
|
|
1477
|
-
async calculateSimulatedHoldingsWithInterest(vaultState, vaultReservesMap, currentSlot) {
|
|
1478
|
-
|
|
1479
|
-
|
|
1506
|
+
async calculateSimulatedHoldingsWithInterest(vaultState, vaultReservesMap, currentSlot, previousTotalAUM) {
|
|
1507
|
+
let prevAUM;
|
|
1508
|
+
if (previousTotalAUM) {
|
|
1509
|
+
prevAUM = previousTotalAUM;
|
|
1510
|
+
}
|
|
1511
|
+
else {
|
|
1512
|
+
const latestUpdateTs = vaultState.lastFeeChargeTimestamp.toNumber();
|
|
1513
|
+
const lastUpdateSlot = latestUpdateTs / this.recentSlotDurationMs;
|
|
1514
|
+
const lastUpdateHoldings = await this.getVaultHoldings(vaultState, lastUpdateSlot, vaultReservesMap);
|
|
1515
|
+
prevAUM = lastUpdateHoldings.total;
|
|
1516
|
+
}
|
|
1480
1517
|
const slot = currentSlot ? currentSlot : await this.getConnection().getSlot('confirmed');
|
|
1481
|
-
const
|
|
1482
|
-
const
|
|
1483
|
-
const [lastUpdateHoldings, currentHoldings] = await Promise.all([
|
|
1484
|
-
lastUpdateHoldingsPromise,
|
|
1485
|
-
currentHoldingsPromise,
|
|
1486
|
-
]);
|
|
1487
|
-
const earnedInterest = currentHoldings.total.sub(lastUpdateHoldings.total);
|
|
1518
|
+
const currentHoldings = await this.getVaultHoldings(vaultState, slot, vaultReservesMap);
|
|
1519
|
+
const earnedInterest = currentHoldings.total.sub(prevAUM);
|
|
1488
1520
|
return {
|
|
1489
1521
|
holdings: currentHoldings,
|
|
1490
1522
|
earnedInterest: earnedInterest,
|
|
@@ -1509,7 +1541,7 @@ class KaminoVaultClient {
|
|
|
1509
1541
|
.mul(new decimal_js_1.default(vaultState.managementFeeBps.toString()))
|
|
1510
1542
|
.div(new decimal_js_1.default(utils_2.SECONDS_PER_YEAR))
|
|
1511
1543
|
.div(CreationParameters_1.FullBPSDecimal);
|
|
1512
|
-
const prevAUM = new fraction_1.Fraction(vaultState.prevAumSf).toDecimal();
|
|
1544
|
+
const prevAUM = (0, lib_1.lamportsToDecimal)(new fraction_1.Fraction(vaultState.prevAumSf).toDecimal(), vaultState.tokenMintDecimals.toNumber());
|
|
1513
1545
|
const mgmtFee = prevAUM.mul(managementFeeFactor);
|
|
1514
1546
|
return {
|
|
1515
1547
|
managementFee: mgmtFee,
|