@kamino-finance/klend-sdk 6.0.5-beta.2 → 6.0.5-beta.21
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/action.d.ts +1 -1
- package/dist/classes/action.d.ts.map +1 -1
- package/dist/classes/action.js +32 -16
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/manager.d.ts +29 -18
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +66 -49
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/market.d.ts +12 -11
- package/dist/classes/market.d.ts.map +1 -1
- package/dist/classes/market.js +77 -37
- package/dist/classes/market.js.map +1 -1
- package/dist/classes/obligation.d.ts +32 -2
- package/dist/classes/obligation.d.ts.map +1 -1
- package/dist/classes/obligation.js +150 -24
- package/dist/classes/obligation.js.map +1 -1
- package/dist/classes/vault.d.ts +5 -3
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +8 -6
- package/dist/classes/vault.js.map +1 -1
- package/dist/client_kamino_manager.d.ts.map +1 -1
- package/dist/client_kamino_manager.js +30 -22
- package/dist/client_kamino_manager.js.map +1 -1
- package/dist/lending_operations/repay_with_collateral_operations.d.ts.map +1 -1
- package/dist/lending_operations/repay_with_collateral_operations.js +36 -32
- package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
- package/dist/lending_operations/swap_collateral_operations.d.ts.map +1 -1
- package/dist/lending_operations/swap_collateral_operations.js +4 -4
- package/dist/lending_operations/swap_collateral_operations.js.map +1 -1
- package/dist/leverage/operations.d.ts +4 -3
- package/dist/leverage/operations.d.ts.map +1 -1
- package/dist/leverage/operations.js +186 -154
- package/dist/leverage/operations.js.map +1 -1
- package/dist/leverage/types.d.ts +1 -0
- package/dist/leverage/types.d.ts.map +1 -1
- package/dist/utils/managerTypes.d.ts +1 -2
- package/dist/utils/managerTypes.d.ts.map +1 -1
- package/dist/utils/managerTypes.js +9 -9
- package/dist/utils/managerTypes.js.map +1 -1
- package/dist/utils/obligations.d.ts +5 -0
- package/dist/utils/obligations.d.ts.map +1 -0
- package/dist/utils/obligations.js +53 -0
- package/dist/utils/obligations.js.map +1 -0
- package/dist/utils/oracle.d.ts +3 -3
- package/dist/utils/oracle.d.ts.map +1 -1
- package/dist/utils/oracle.js +2 -2
- package/dist/utils/oracle.js.map +1 -1
- package/dist/utils/pubkey.d.ts +1 -0
- package/dist/utils/pubkey.d.ts.map +1 -1
- package/dist/utils/pubkey.js +10 -0
- package/dist/utils/pubkey.js.map +1 -1
- package/package.json +3 -3
- package/src/classes/action.ts +32 -20
- package/src/classes/manager.ts +87 -54
- package/src/classes/market.ts +132 -52
- package/src/classes/obligation.ts +201 -36
- package/src/classes/vault.ts +17 -6
- package/src/client.ts +4 -4
- package/src/client_kamino_manager.ts +40 -35
- package/src/lending_operations/repay_with_collateral_operations.ts +76 -72
- package/src/lending_operations/swap_collateral_operations.ts +13 -11
- package/src/leverage/operations.ts +362 -328
- package/src/leverage/types.ts +1 -0
- package/src/utils/managerTypes.ts +1 -2
- package/src/utils/obligations.ts +69 -0
- package/src/utils/oracle.ts +5 -4
- package/src/utils/pubkey.ts +9 -0
package/dist/utils/pubkey.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pubkey.js","sourceRoot":"","sources":["../../src/utils/pubkey.ts"],"names":[],"mappings":";;;;;;AAWA,0CAEC;
|
|
1
|
+
{"version":3,"file":"pubkey.js","sourceRoot":"","sources":["../../src/utils/pubkey.ts"],"names":[],"mappings":";;;;;;AAWA,0CAEC;AAkPD,kCAOC;AAtQD,6CAA4C;AAC5C,kDAAuB;AAEV,QAAA,WAAW,GAAG,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;AAC3E,QAAA,yBAAyB,GAAG,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;AAEtG;;;;GAIG;AACH,SAAgB,eAAe,CAAC,MAAiB;IAC/C,OAAO,MAAM,IAAI,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,CAAC,EAAE,CAAC;IACjC,CAAC;CACF;AAtHD,sCAsHC;AAED,SAAgB,WAAW,CAAO,GAAgB,EAAE,GAAM,EAAE,KAAQ;IAClE,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,QAAQ,EAAE,CAAC;QACb,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACxB,CAAC;AACH,CAAC;AAED,MAAa,iBAAkB,SAAQ,mBAAS;IAC9C,6DAA6D;IAC7D,MAAM,CAAC,IAAI,GAAG,IAAI,eAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEzC,YAAY,KAA+D;QACzE,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;QAChF,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,KAAK;QACX,YAAY;QACZ,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;;AAjBH,8CAkBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kamino-finance/klend-sdk",
|
|
3
|
-
"version": "6.0.5-beta.
|
|
3
|
+
"version": "6.0.5-beta.21",
|
|
4
4
|
"description": "Typescript SDK for interacting with the Kamino Lending (klend) protocol",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"@coral-xyz/anchor": "^0.28.0",
|
|
60
60
|
"@coral-xyz/borsh": "^0.28.0",
|
|
61
61
|
"@kamino-finance/farms-sdk": "3.0.2",
|
|
62
|
-
"@kamino-finance/kliquidity-sdk": "8.2.
|
|
63
|
-
"@kamino-finance/scope-sdk": "
|
|
62
|
+
"@kamino-finance/kliquidity-sdk": "8.5.2-beta.0",
|
|
63
|
+
"@kamino-finance/scope-sdk": "8.1.0-beta.4",
|
|
64
64
|
"@solana/buffer-layout": "^4.0.0",
|
|
65
65
|
"@solana/spl-token": "^0.4.8",
|
|
66
66
|
"@solana/web3.js": "^1.95.8",
|
package/src/classes/action.ts
CHANGED
|
@@ -75,7 +75,7 @@ import { KaminoReserve } from './reserve';
|
|
|
75
75
|
import { ReserveFarmKind } from '../idl_codegen/types';
|
|
76
76
|
import { farmsId } from '@kamino-finance/farms-sdk';
|
|
77
77
|
import { Reserve } from '../idl_codegen/accounts';
|
|
78
|
-
import { VanillaObligation } from '../utils
|
|
78
|
+
import { VanillaObligation } from '../utils';
|
|
79
79
|
import { PROGRAM_ID } from '../lib';
|
|
80
80
|
import { Scope } from '@kamino-finance/scope-sdk';
|
|
81
81
|
import { ObligationOrderAtIndex } from './obligationOrder';
|
|
@@ -430,16 +430,12 @@ export class KaminoAction {
|
|
|
430
430
|
return axn;
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
-
async addScopeRefreshIxs(scope: Scope, tokens: number[],
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
},
|
|
440
|
-
tokens
|
|
441
|
-
)
|
|
442
|
-
);
|
|
433
|
+
async addScopeRefreshIxs(scope: Scope, tokens: number[], scopeConfig: PublicKey) {
|
|
434
|
+
const refreshIx = await scope.refreshPriceListIx({ config: scopeConfig }, tokens);
|
|
435
|
+
if (refreshIx) {
|
|
436
|
+
this.setupIxsLabels.unshift(`refreshScopePrices`);
|
|
437
|
+
this.setupIxs.unshift(refreshIx);
|
|
438
|
+
}
|
|
443
439
|
}
|
|
444
440
|
|
|
445
441
|
static async buildBorrowTxns(
|
|
@@ -732,10 +728,16 @@ export class KaminoAction {
|
|
|
732
728
|
...(axn.outflowReserve ? [axn.outflowReserve.address] : []),
|
|
733
729
|
...(axn.preLoadedDepositReservesSameTx ? axn.preLoadedDepositReservesSameTx : []),
|
|
734
730
|
]).toArray();
|
|
735
|
-
const tokenIds = getTokenIdsForScopeRefresh(axn.kaminoMarket, allReserves);
|
|
736
731
|
|
|
737
|
-
|
|
738
|
-
|
|
732
|
+
const scopeTokensMap = getTokenIdsForScopeRefresh(axn.kaminoMarket, allReserves);
|
|
733
|
+
|
|
734
|
+
if (scopeTokensMap.size > 0 && scopeRefreshConfig) {
|
|
735
|
+
for (const [configPubkey, config] of scopeRefreshConfig.scopeConfigurations) {
|
|
736
|
+
const tokenIds = scopeTokensMap.get(config.oraclePrices);
|
|
737
|
+
if (tokenIds && tokenIds.length > 0) {
|
|
738
|
+
await axn.addScopeRefreshIxs(scopeRefreshConfig.scope, tokenIds, configPubkey);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
739
741
|
}
|
|
740
742
|
return axn;
|
|
741
743
|
}
|
|
@@ -922,10 +924,15 @@ export class KaminoAction {
|
|
|
922
924
|
...(axn.outflowReserve ? [axn.outflowReserve.address] : []),
|
|
923
925
|
...(axn.preLoadedDepositReservesSameTx ? axn.preLoadedDepositReservesSameTx : []),
|
|
924
926
|
]).toArray();
|
|
925
|
-
const
|
|
927
|
+
const scopeTokensMap = getTokenIdsForScopeRefresh(axn.kaminoMarket, allReserves);
|
|
926
928
|
|
|
927
|
-
if (
|
|
928
|
-
|
|
929
|
+
if (scopeTokensMap.size > 0 && scopeRefreshConfig) {
|
|
930
|
+
for (const [configPubkey, config] of scopeRefreshConfig.scopeConfigurations) {
|
|
931
|
+
const tokenIds = scopeTokensMap.get(config.oraclePrices);
|
|
932
|
+
if (tokenIds && tokenIds.length > 0) {
|
|
933
|
+
await axn.addScopeRefreshIxs(scopeRefreshConfig.scope, tokenIds, configPubkey);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
929
936
|
}
|
|
930
937
|
return axn;
|
|
931
938
|
}
|
|
@@ -2748,10 +2755,15 @@ export class KaminoAction {
|
|
|
2748
2755
|
...(this.outflowReserve ? [this.outflowReserve.address] : []),
|
|
2749
2756
|
...(this.preLoadedDepositReservesSameTx ? this.preLoadedDepositReservesSameTx : []),
|
|
2750
2757
|
]).toArray();
|
|
2751
|
-
const
|
|
2758
|
+
const scopeTokensMap = getTokenIdsForScopeRefresh(this.kaminoMarket, allReserves);
|
|
2752
2759
|
|
|
2753
|
-
if (
|
|
2754
|
-
|
|
2760
|
+
if (scopeTokensMap.size > 0 && scopeRefreshConfig) {
|
|
2761
|
+
for (const [configPubkey, config] of scopeRefreshConfig.scopeConfigurations) {
|
|
2762
|
+
const tokenIds = scopeTokensMap.get(config.oraclePrices);
|
|
2763
|
+
if (tokenIds && tokenIds.length > 0) {
|
|
2764
|
+
await this.addScopeRefreshIxs(scopeRefreshConfig.scope, tokenIds, configPubkey);
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2755
2767
|
}
|
|
2756
2768
|
}
|
|
2757
2769
|
|
package/src/classes/manager.ts
CHANGED
|
@@ -34,7 +34,6 @@ import {
|
|
|
34
34
|
getAllLendingMarketAccounts,
|
|
35
35
|
getAllOracleAccounts,
|
|
36
36
|
getAllReserveAccounts,
|
|
37
|
-
getMedianSlotDurationInMsFromLastEpochs,
|
|
38
37
|
getReserveOracleConfigs,
|
|
39
38
|
getTokenOracleDataSync,
|
|
40
39
|
initLendingMarket,
|
|
@@ -52,6 +51,7 @@ import {
|
|
|
52
51
|
Reserve,
|
|
53
52
|
ReserveWithAddress,
|
|
54
53
|
ScopeOracleConfig,
|
|
54
|
+
setOrAppend,
|
|
55
55
|
updateEntireReserveConfigIx,
|
|
56
56
|
updateLendingMarket,
|
|
57
57
|
UpdateLendingMarketAccounts,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
UpdateLendingMarketOwnerAccounts,
|
|
61
61
|
} from '../lib';
|
|
62
62
|
import { PROGRAM_ID } from '../idl_codegen/programId';
|
|
63
|
-
import { Scope, TokenMetadatas, U16_MAX } from '@kamino-finance/scope-sdk';
|
|
63
|
+
import { OracleMappings, Scope, TokenMetadatas, U16_MAX } from '@kamino-finance/scope-sdk';
|
|
64
64
|
import BN from 'bn.js';
|
|
65
65
|
import { ReserveConfig, UpdateLendingMarketMode, UpdateLendingMarketModeKind } from '../idl_codegen/types';
|
|
66
66
|
import Decimal from 'decimal.js';
|
|
@@ -69,7 +69,7 @@ import { VaultState } from '../idl_codegen_kamino_vault/accounts';
|
|
|
69
69
|
import { TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
|
70
70
|
import { Data } from '@kamino-finance/kliquidity-sdk';
|
|
71
71
|
import bs58 from 'bs58';
|
|
72
|
-
import { getProgramAccounts } from '../utils
|
|
72
|
+
import { getProgramAccounts } from '../utils';
|
|
73
73
|
import { VaultConfigField, VaultConfigFieldKind } from '../idl_codegen_kamino_vault/types';
|
|
74
74
|
import {
|
|
75
75
|
AcceptVaultOwnershipIxs,
|
|
@@ -317,6 +317,7 @@ export class KaminoManager {
|
|
|
317
317
|
* This function enables the update of the scope oracle configuration. In order to get a list of scope prices, getScopeOracleConfigs can be used
|
|
318
318
|
* @param market - lending market which owns the reserve
|
|
319
319
|
* @param reserve - reserve which to be updated
|
|
320
|
+
* @param oraclePrices - scope OraclePrices account pubkey
|
|
320
321
|
* @param scopeOracleConfig - new scope oracle config
|
|
321
322
|
* @param scopeTwapConfig - new scope twap config
|
|
322
323
|
* @param maxAgeBufferSeconds - buffer to be added to onchain max_age - if oracle price is older than that, txns interacting with the reserve will fail
|
|
@@ -325,6 +326,7 @@ export class KaminoManager {
|
|
|
325
326
|
async updateReserveScopeOracleConfigurationIxs(
|
|
326
327
|
market: MarketWithAddress,
|
|
327
328
|
reserve: ReserveWithAddress,
|
|
329
|
+
oraclePrices: PublicKey,
|
|
328
330
|
scopeOracleConfig: ScopeOracleConfig,
|
|
329
331
|
scopeTwapConfig?: ScopeOracleConfig,
|
|
330
332
|
maxAgeBufferSeconds: number = 20
|
|
@@ -341,7 +343,7 @@ export class KaminoManager {
|
|
|
341
343
|
}
|
|
342
344
|
|
|
343
345
|
const { scopeConfiguration } = getReserveOracleConfigs({
|
|
344
|
-
scopePriceConfigAddress:
|
|
346
|
+
scopePriceConfigAddress: oraclePrices,
|
|
345
347
|
scopeChain: [scopeOracleConfig.oracleId],
|
|
346
348
|
scopeTwapChain: [scopeTwapId],
|
|
347
349
|
});
|
|
@@ -523,7 +525,6 @@ export class KaminoManager {
|
|
|
523
525
|
* This method withdraws all the pending fees from the vault to the owner's token ATA
|
|
524
526
|
* @param vault - vault for which the admin withdraws the pending fees
|
|
525
527
|
* @param slot - current slot, used to estimate the interest earned in the different reserves with allocation from the vault
|
|
526
|
-
* @param [vaultReservesMap] - 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
|
|
527
528
|
* @returns - list of instructions to withdraw all pending fees, including the ATA creation instructions if needed
|
|
528
529
|
*/
|
|
529
530
|
async withdrawPendingFeesIxs(vault: KaminoVault, slot: number): Promise<TransactionInstruction[]> {
|
|
@@ -533,7 +534,7 @@ export class KaminoManager {
|
|
|
533
534
|
/**
|
|
534
535
|
* This method inserts the missing keys from the provided keys into an existent lookup table
|
|
535
536
|
* @param payer - payer wallet pubkey
|
|
536
|
-
* @param
|
|
537
|
+
* @param lut
|
|
537
538
|
* @param keys - keys to insert into the lookup table
|
|
538
539
|
* @param [accountsInLUT] - the existent accounts in the lookup table. Optional. If provided, the function will not fetch the accounts in the lookup table
|
|
539
540
|
* @returns - an array of instructions to insert the missing keys into the lookup table
|
|
@@ -551,7 +552,6 @@ export class KaminoManager {
|
|
|
551
552
|
* Sync a vault for lookup table; create and set the LUT for the vault if needed and fill it with all the needed accounts
|
|
552
553
|
* @param vault the vault to sync and set the LUT for if needed
|
|
553
554
|
* @param vaultReserves optional; the state of the reserves in the vault allocation
|
|
554
|
-
* @param [vaultReservesMap] - optional parameter; 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
|
|
555
555
|
* @returns a struct that contains a list of ix to create the LUT and assign it to the vault if needed + a list of ixs to insert all the accounts in the LUT
|
|
556
556
|
*/
|
|
557
557
|
async syncVaultLUTIxs(
|
|
@@ -632,8 +632,8 @@ export class KaminoManager {
|
|
|
632
632
|
|
|
633
633
|
/**
|
|
634
634
|
* This method returns the vault name
|
|
635
|
-
* @param vault - vault to retrieve the onchain name for
|
|
636
635
|
* @returns - the vault name as string
|
|
636
|
+
* @param vaultState
|
|
637
637
|
*/
|
|
638
638
|
getDecodedVaultName(vaultState: VaultState): string {
|
|
639
639
|
return this._vaultClient.decodeVaultName(vaultState.name);
|
|
@@ -661,7 +661,6 @@ export class KaminoManager {
|
|
|
661
661
|
async getAllMarkets(programId: PublicKey = PROGRAM_ID): Promise<KaminoMarket[]> {
|
|
662
662
|
// Get all lending markets
|
|
663
663
|
const marketGenerator = getAllLendingMarketAccounts(this.getConnection(), programId);
|
|
664
|
-
const slotDuration = await getMedianSlotDurationInMsFromLastEpochs();
|
|
665
664
|
|
|
666
665
|
const lendingMarketPairs: [PublicKey, LendingMarket][] = [];
|
|
667
666
|
for await (const pair of marketGenerator) {
|
|
@@ -691,7 +690,7 @@ export class KaminoManager {
|
|
|
691
690
|
}
|
|
692
691
|
}
|
|
693
692
|
|
|
694
|
-
|
|
693
|
+
return lendingMarketPairs.map(([pubkey, market]) => {
|
|
695
694
|
const reserves = marketToReserve.get(pubkey);
|
|
696
695
|
const reservesByAddress = new PubkeyHashMap<PublicKey, KaminoReserve>();
|
|
697
696
|
if (!reserves) {
|
|
@@ -718,10 +717,14 @@ export class KaminoManager {
|
|
|
718
717
|
});
|
|
719
718
|
}
|
|
720
719
|
|
|
721
|
-
return KaminoMarket.loadWithReserves(
|
|
720
|
+
return KaminoMarket.loadWithReserves(
|
|
721
|
+
this.getConnection(),
|
|
722
|
+
market,
|
|
723
|
+
reservesByAddress,
|
|
724
|
+
pubkey,
|
|
725
|
+
this.recentSlotDurationMs
|
|
726
|
+
);
|
|
722
727
|
});
|
|
723
|
-
|
|
724
|
-
return combinedMarkets;
|
|
725
728
|
}
|
|
726
729
|
|
|
727
730
|
/**
|
|
@@ -859,7 +862,7 @@ export class KaminoManager {
|
|
|
859
862
|
* @param vault - the kamino vault to get available liquidity to withdraw for
|
|
860
863
|
* @param price - the price of the token in the vault (e.g. USDC)
|
|
861
864
|
* @param [slot] - the slot for which to calculate the holdings. Optional. If not provided the function will fetch the current slot
|
|
862
|
-
* @param
|
|
865
|
+
* @param vaultReserves
|
|
863
866
|
* @param [currentSlot] - the latest confirmed slot. Optional. If provided the function will be faster as it will not have to fetch the latest slot
|
|
864
867
|
* @returns an VaultHoldingsWithUSDValue object with details about the tokens available and invested in the vault, denominated in tokens and USD
|
|
865
868
|
*/
|
|
@@ -878,7 +881,7 @@ export class KaminoManager {
|
|
|
878
881
|
* @param vault - the kamino vault to get available liquidity to withdraw for
|
|
879
882
|
* @param price - the price of the token in the vault (e.g. USDC)
|
|
880
883
|
* @param [slot] - the slot for which to retrieve the vault overview for. Optional. If not provided the function will fetch the current slot
|
|
881
|
-
* @param
|
|
884
|
+
* @param vaultReserves
|
|
882
885
|
* @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
|
|
883
886
|
* @param [currentSlot] - the latest confirmed slot. Optional. If provided the function will be faster as it will not have to fetch the latest slot
|
|
884
887
|
* @returns an VaultOverview object with details about the tokens available and invested in the vault, denominated in tokens and USD
|
|
@@ -938,7 +941,7 @@ export class KaminoManager {
|
|
|
938
941
|
* This will return the APY of the vault under the assumption that all the available tokens in the vault are all the time invested in the reserves as ratio; for percentage it needs multiplication by 100
|
|
939
942
|
* @param vault - the kamino vault to get APY for
|
|
940
943
|
* @param slot - current slot
|
|
941
|
-
* @param
|
|
944
|
+
* @param vaultReserves
|
|
942
945
|
* @returns a struct containing estimated gross APY and net APY (gross - vault fees) for the vault
|
|
943
946
|
*/
|
|
944
947
|
async getVaultTheoreticalAPY(
|
|
@@ -953,7 +956,7 @@ export class KaminoManager {
|
|
|
953
956
|
* This will return the APY of the vault based on the current invested amounts; for percentage it needs multiplication by 100
|
|
954
957
|
* @param vault - the kamino vault to get APY for
|
|
955
958
|
* @param slot - current slot
|
|
956
|
-
* @param
|
|
959
|
+
* @param vaultReserves
|
|
957
960
|
* @returns a struct containing estimated gross APY and net APY (gross - vault fees) for the vault
|
|
958
961
|
*/
|
|
959
962
|
async getVaultActualAPY(
|
|
@@ -976,8 +979,10 @@ export class KaminoManager {
|
|
|
976
979
|
/**
|
|
977
980
|
* Simulate the current holdings of the vault and the earned interest
|
|
978
981
|
* @param vaultState the kamino vault state to get simulated holdings and earnings for
|
|
979
|
-
* @param
|
|
980
|
-
* @param
|
|
982
|
+
* @param vaultReserves
|
|
983
|
+
* @param vaultReserves
|
|
984
|
+
* @param slot
|
|
985
|
+
* @param slot
|
|
981
986
|
* @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
|
|
982
987
|
* @param [currentSlot] - the latest confirmed slot. Optional. If provided the function will be faster as it will not have to fetch the latest slot
|
|
983
988
|
* @returns a struct of simulated vault holdings and earned interest
|
|
@@ -1056,8 +1061,8 @@ export class KaminoManager {
|
|
|
1056
1061
|
|
|
1057
1062
|
/**
|
|
1058
1063
|
* This will load the onchain state for all the reserves that the vault has allocations for
|
|
1059
|
-
* @param vaultState - the vault state to load reserves for
|
|
1060
1064
|
* @returns a hashmap from each reserve pubkey to the reserve state
|
|
1065
|
+
* @param vault
|
|
1061
1066
|
*/
|
|
1062
1067
|
getVaultReserves(vault: VaultState): PublicKey[] {
|
|
1063
1068
|
return this._vaultClient.getVaultReserves(vault);
|
|
@@ -1067,6 +1072,15 @@ export class KaminoManager {
|
|
|
1067
1072
|
* This will retrieve all the tokens that can be use as collateral by the users who borrow the token in the vault alongside details about the min and max loan to value ratio
|
|
1068
1073
|
* @param vaultState - the vault state to load reserves for
|
|
1069
1074
|
*
|
|
1075
|
+
* @param slot
|
|
1076
|
+
* @param vaultReservesMap
|
|
1077
|
+
* @param kaminoMarkets
|
|
1078
|
+
* @param slot
|
|
1079
|
+
* @param vaultReservesMap
|
|
1080
|
+
* @param kaminoMarkets
|
|
1081
|
+
* @param slot
|
|
1082
|
+
* @param vaultReservesMap
|
|
1083
|
+
* @param kaminoMarkets
|
|
1070
1084
|
* @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
|
|
1071
1085
|
*/
|
|
1072
1086
|
async getVaultCollaterals(
|
|
@@ -1080,6 +1094,7 @@ export class KaminoManager {
|
|
|
1080
1094
|
|
|
1081
1095
|
/**
|
|
1082
1096
|
* This will trigger invest by balancing, based on weights, the reserve allocations of the vault. It can either withdraw or deposit into reserves to balance them. This is a function that should be cranked
|
|
1097
|
+
* @param payer
|
|
1083
1098
|
* @param kaminoVault - vault to invest from
|
|
1084
1099
|
* @returns - an array of invest instructions for each invest action required for the vault reserves
|
|
1085
1100
|
*/
|
|
@@ -1090,8 +1105,8 @@ export class KaminoManager {
|
|
|
1090
1105
|
/**
|
|
1091
1106
|
* This will trigger invest by balancing, based on weights, the reserve allocation of the vault. It can either withdraw or deposit into the given reserve to balance it
|
|
1092
1107
|
* @param payer wallet pubkey
|
|
1093
|
-
* @param
|
|
1094
|
-
* @param
|
|
1108
|
+
* @param kaminoVault
|
|
1109
|
+
* @param reserveWithAddress
|
|
1095
1110
|
* @param [vaultReservesMap] - optional parameter; a hashmap from each reserve pubkey to the reserve state. If provided the function will be significantly faster as it will not have to fetch the reserves
|
|
1096
1111
|
* @returns - an array of invest instructions for each invest action required for the vault reserves
|
|
1097
1112
|
*/
|
|
@@ -1124,7 +1139,7 @@ export class KaminoManager {
|
|
|
1124
1139
|
|
|
1125
1140
|
/**
|
|
1126
1141
|
* This will return the amount of token invested from the vault into the given reserve
|
|
1127
|
-
* @param
|
|
1142
|
+
* @param vaultState
|
|
1128
1143
|
* @param slot - current slot
|
|
1129
1144
|
* @param reserve - the reserve state to get vault invested amount in
|
|
1130
1145
|
* @returns vault amount supplied in reserve in decimal
|
|
@@ -1135,43 +1150,63 @@ export class KaminoManager {
|
|
|
1135
1150
|
|
|
1136
1151
|
/**
|
|
1137
1152
|
* This returns an array of scope oracle configs to be used to set the scope price and twap oracles for a reserve
|
|
1138
|
-
* @param
|
|
1153
|
+
* @param market - kamino market
|
|
1139
1154
|
* @param cluster - cluster to fetch from, this should be left unchanged unless working on devnet or locally
|
|
1140
|
-
* @returns -
|
|
1155
|
+
* @returns - a map with keys as scope OraclePrices pubkeys and values of scope oracle configs
|
|
1141
1156
|
*/
|
|
1142
1157
|
async getScopeOracleConfigs(
|
|
1143
|
-
|
|
1158
|
+
market: KaminoMarket,
|
|
1144
1159
|
cluster: ENV = 'mainnet-beta'
|
|
1145
|
-
): Promise<
|
|
1146
|
-
const scopeOracleConfigs
|
|
1160
|
+
): Promise<PubkeyHashMap<PublicKey, ScopeOracleConfig[]>> {
|
|
1161
|
+
const scopeOracleConfigs = new PubkeyHashMap<PublicKey, ScopeOracleConfig[]>();
|
|
1147
1162
|
|
|
1148
1163
|
const scope = new Scope(cluster, this._connection);
|
|
1149
|
-
const oracleMappings = await scope.getOracleMappings({ feed: feed });
|
|
1150
|
-
const [, feedConfig] = await scope.getFeedConfiguration({ feed: feed });
|
|
1151
|
-
const tokenMetadatas = await TokenMetadatas.fetch(this._connection, feedConfig.tokensMetadata);
|
|
1152
|
-
const decoder = new TextDecoder('utf-8');
|
|
1153
|
-
|
|
1154
|
-
console.log('feedConfig.tokensMetadata', feedConfig.tokensMetadata);
|
|
1155
1164
|
|
|
1156
|
-
|
|
1157
|
-
|
|
1165
|
+
const configs = (await scope.getAllConfigurations()).filter(([_, config]) =>
|
|
1166
|
+
market.scopeFeeds.contains(config.oraclePrices)
|
|
1167
|
+
);
|
|
1168
|
+
if (!configs || configs.length === 0) {
|
|
1169
|
+
return scopeOracleConfigs;
|
|
1158
1170
|
}
|
|
1159
1171
|
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1172
|
+
const configOracleMappings = await OracleMappings.fetchMultiple(
|
|
1173
|
+
this._connection,
|
|
1174
|
+
configs.map(([_, config]) => config.oracleMappings),
|
|
1175
|
+
scope.config.programId
|
|
1176
|
+
);
|
|
1177
|
+
|
|
1178
|
+
const configTokenMetadatas = await TokenMetadatas.fetchMultiple(
|
|
1179
|
+
this._connection,
|
|
1180
|
+
configs.map(([_, config]) => config.tokensMetadata),
|
|
1181
|
+
scope.config.programId
|
|
1182
|
+
);
|
|
1183
|
+
const decoder = new TextDecoder('utf-8');
|
|
1184
|
+
|
|
1185
|
+
for (let i = 0; i < configs.length; i++) {
|
|
1186
|
+
const [configPubkey, config] = configs[i];
|
|
1187
|
+
const oracleMappings = configOracleMappings[i];
|
|
1188
|
+
const tokenMetadatas = configTokenMetadatas[i];
|
|
1189
|
+
if (!oracleMappings) {
|
|
1190
|
+
throw new Error(`OracleMappings account not found for config ${configPubkey}`);
|
|
1191
|
+
}
|
|
1192
|
+
if (!tokenMetadatas) {
|
|
1193
|
+
throw new Error(`TokenMetadatas account not found for config ${configPubkey}`);
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
for (let j = 0; j < oracleMappings.priceInfoAccounts.length; j++) {
|
|
1197
|
+
if (!oracleMappings.priceInfoAccounts[j].equals(PublicKey.default)) {
|
|
1198
|
+
const name = decoder.decode(Uint8Array.from(tokenMetadatas.metadatasArray[j].name)).replace(/\0/g, '');
|
|
1199
|
+
const oracleType = parseOracleType(oracleMappings.priceTypes[j]);
|
|
1200
|
+
setOrAppend(scopeOracleConfigs, config.oraclePrices, {
|
|
1201
|
+
name: name,
|
|
1202
|
+
oracleType: oracleType,
|
|
1203
|
+
oracleId: j,
|
|
1204
|
+
oracleAccount: oracleMappings.priceInfoAccounts[j],
|
|
1205
|
+
twapEnabled: oracleMappings.twapEnabled[j] === 1,
|
|
1206
|
+
twapSourceId: oracleMappings.twapSource[j],
|
|
1207
|
+
max_age: tokenMetadatas.metadatasArray[j].maxAgePriceSlots.toNumber(),
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1175
1210
|
}
|
|
1176
1211
|
}
|
|
1177
1212
|
|
|
@@ -1329,7 +1364,5 @@ function updateMarketConfigIx(
|
|
|
1329
1364
|
value: [...value, ...Array(72 - value.length).fill(0)],
|
|
1330
1365
|
};
|
|
1331
1366
|
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
return ix;
|
|
1367
|
+
return updateLendingMarket(args, accounts, programId);
|
|
1335
1368
|
}
|