@kamino-finance/klend-sdk 5.14.3 → 5.14.5
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/configItems.d.ts +166 -0
- package/dist/classes/configItems.d.ts.map +1 -0
- package/dist/classes/configItems.js +202 -0
- package/dist/classes/configItems.js.map +1 -0
- package/dist/classes/manager.d.ts +4 -7
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +37 -292
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/market.d.ts.map +1 -1
- package/dist/classes/market.js.map +1 -1
- package/dist/classes/reserve.d.ts +5 -14
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +93 -465
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/utils.d.ts +1 -0
- package/dist/classes/utils.d.ts.map +1 -1
- package/dist/classes/utils.js +12 -0
- package/dist/classes/utils.js.map +1 -1
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +28 -1
- package/dist/classes/vault.js.map +1 -1
- package/dist/classes/vault_types.d.ts +1 -0
- package/dist/classes/vault_types.d.ts.map +1 -1
- package/dist/client_kamino_manager.d.ts.map +1 -1
- package/dist/client_kamino_manager.js +24 -11
- package/dist/client_kamino_manager.js.map +1 -1
- package/dist/idl.json +193 -16
- package/dist/idl_codegen/accounts/GlobalConfig.d.ts +40 -0
- package/dist/idl_codegen/accounts/GlobalConfig.d.ts.map +1 -0
- package/dist/idl_codegen/accounts/GlobalConfig.js +116 -0
- package/dist/idl_codegen/accounts/GlobalConfig.js.map +1 -0
- package/dist/idl_codegen/accounts/LendingMarket.d.ts +24 -3
- package/dist/idl_codegen/accounts/LendingMarket.d.ts.map +1 -1
- package/dist/idl_codegen/accounts/LendingMarket.js +25 -7
- package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
- package/dist/idl_codegen/accounts/index.d.ts +2 -0
- package/dist/idl_codegen/accounts/index.d.ts.map +1 -1
- package/dist/idl_codegen/accounts/index.js +3 -1
- package/dist/idl_codegen/accounts/index.js.map +1 -1
- package/dist/idl_codegen/errors/custom.d.ts +35 -11
- package/dist/idl_codegen/errors/custom.d.ts.map +1 -1
- package/dist/idl_codegen/errors/custom.js +64 -22
- package/dist/idl_codegen/errors/custom.js.map +1 -1
- package/dist/idl_codegen/instructions/idlMissingTypes.d.ts +2 -1
- package/dist/idl_codegen/instructions/idlMissingTypes.d.ts.map +1 -1
- package/dist/idl_codegen/instructions/idlMissingTypes.js +2 -1
- package/dist/idl_codegen/instructions/idlMissingTypes.js.map +1 -1
- package/dist/idl_codegen/instructions/index.d.ts +6 -0
- package/dist/idl_codegen/instructions/index.d.ts.map +1 -1
- package/dist/idl_codegen/instructions/index.js +7 -1
- package/dist/idl_codegen/instructions/index.js.map +1 -1
- package/dist/idl_codegen/instructions/initGlobalConfig.d.ts +10 -0
- package/dist/idl_codegen/instructions/initGlobalConfig.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/initGlobalConfig.js +19 -0
- package/dist/idl_codegen/instructions/initGlobalConfig.js.map +1 -0
- package/dist/idl_codegen/instructions/updateGlobalConfig.d.ts +13 -0
- package/dist/idl_codegen/instructions/updateGlobalConfig.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/updateGlobalConfig.js +61 -0
- package/dist/idl_codegen/instructions/updateGlobalConfig.js.map +1 -0
- package/dist/idl_codegen/instructions/updateGlobalConfigAdmin.d.ts +7 -0
- package/dist/idl_codegen/instructions/updateGlobalConfigAdmin.d.ts.map +1 -0
- package/dist/idl_codegen/instructions/updateGlobalConfigAdmin.js +16 -0
- package/dist/idl_codegen/instructions/updateGlobalConfigAdmin.js.map +1 -0
- package/dist/idl_codegen/instructions/updateReserveConfig.d.ts +5 -4
- package/dist/idl_codegen/instructions/updateReserveConfig.d.ts.map +1 -1
- package/dist/idl_codegen/instructions/updateReserveConfig.js +7 -5
- package/dist/idl_codegen/instructions/updateReserveConfig.js.map +1 -1
- package/dist/idl_codegen/instructions/withdrawProtocolFee.d.ts +2 -2
- package/dist/idl_codegen/instructions/withdrawProtocolFee.d.ts.map +1 -1
- package/dist/idl_codegen/instructions/withdrawProtocolFee.js +2 -6
- package/dist/idl_codegen/instructions/withdrawProtocolFee.js.map +1 -1
- package/dist/idl_codegen/types/UpdateGlobalConfigMode.d.ts +32 -0
- package/dist/idl_codegen/types/UpdateGlobalConfigMode.d.ts.map +1 -0
- package/dist/idl_codegen/types/UpdateGlobalConfigMode.js +108 -0
- package/dist/idl_codegen/types/UpdateGlobalConfigMode.js.map +1 -0
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +33 -7
- package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts.map +1 -1
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js +60 -12
- package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
- package/dist/idl_codegen/types/index.d.ts +6 -2
- package/dist/idl_codegen/types/index.d.ts.map +1 -1
- package/dist/idl_codegen/types/index.js +3 -1
- package/dist/idl_codegen/types/index.js.map +1 -1
- package/dist/utils/instruction.d.ts.map +1 -1
- package/dist/utils/instruction.js.map +1 -1
- package/dist/utils/lookupTable.d.ts.map +1 -1
- package/dist/utils/lookupTable.js +1 -6
- package/dist/utils/lookupTable.js.map +1 -1
- package/dist/utils/managerTypes.js +1 -1
- package/dist/utils/managerTypes.js.map +1 -1
- package/dist/utils/seeds.d.ts +16 -0
- package/dist/utils/seeds.d.ts.map +1 -1
- package/dist/utils/seeds.js +23 -1
- package/dist/utils/seeds.js.map +1 -1
- package/package.json +1 -1
- package/src/classes/configItems.ts +295 -0
- package/src/classes/manager.ts +49 -392
- package/src/classes/market.ts +2 -6
- package/src/classes/reserve.ts +122 -786
- package/src/classes/utils.ts +12 -0
- package/src/classes/vault.ts +47 -2
- package/src/classes/vault_types.ts +1 -0
- package/src/client_kamino_manager.ts +40 -14
- package/src/idl.json +193 -16
- package/src/idl_codegen/accounts/GlobalConfig.ts +125 -0
- package/src/idl_codegen/accounts/LendingMarket.ts +41 -9
- package/src/idl_codegen/accounts/index.ts +2 -0
- package/src/idl_codegen/errors/custom.ts +65 -20
- package/src/idl_codegen/instructions/idlMissingTypes.ts +4 -2
- package/src/idl_codegen/instructions/index.ts +9 -0
- package/src/idl_codegen/instructions/initGlobalConfig.ts +30 -0
- package/src/idl_codegen/instructions/updateGlobalConfig.ts +47 -0
- package/src/idl_codegen/instructions/updateGlobalConfigAdmin.ts +24 -0
- package/src/idl_codegen/instructions/updateReserveConfig.ts +10 -8
- package/src/idl_codegen/instructions/withdrawProtocolFee.ts +4 -8
- package/src/idl_codegen/types/UpdateGlobalConfigMode.ts +90 -0
- package/src/idl_codegen/types/UpdateLendingMarketMode.ts +73 -13
- package/src/idl_codegen/types/index.ts +16 -2
- package/src/utils/instruction.ts +2 -2
- package/src/utils/lookupTable.ts +1 -7
- package/src/utils/managerTypes.ts +1 -1
- package/src/utils/seeds.ts +25 -0
|
@@ -509,25 +509,71 @@ export class UpdateInitialDepositAmount {
|
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
511
|
|
|
512
|
-
export interface
|
|
513
|
-
kind: "
|
|
512
|
+
export interface UpdateObligationOrderExecutionEnabledJSON {
|
|
513
|
+
kind: "UpdateObligationOrderExecutionEnabled"
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
-
export class
|
|
516
|
+
export class UpdateObligationOrderExecutionEnabled {
|
|
517
517
|
static readonly discriminator = 22
|
|
518
|
-
static readonly kind = "
|
|
518
|
+
static readonly kind = "UpdateObligationOrderExecutionEnabled"
|
|
519
519
|
readonly discriminator = 22
|
|
520
|
-
readonly kind = "
|
|
520
|
+
readonly kind = "UpdateObligationOrderExecutionEnabled"
|
|
521
521
|
|
|
522
|
-
toJSON():
|
|
522
|
+
toJSON(): UpdateObligationOrderExecutionEnabledJSON {
|
|
523
523
|
return {
|
|
524
|
-
kind: "
|
|
524
|
+
kind: "UpdateObligationOrderExecutionEnabled",
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
527
|
|
|
528
528
|
toEncodable() {
|
|
529
529
|
return {
|
|
530
|
-
|
|
530
|
+
UpdateObligationOrderExecutionEnabled: {},
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
export interface UpdateImmutableFlagJSON {
|
|
536
|
+
kind: "UpdateImmutableFlag"
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
export class UpdateImmutableFlag {
|
|
540
|
+
static readonly discriminator = 23
|
|
541
|
+
static readonly kind = "UpdateImmutableFlag"
|
|
542
|
+
readonly discriminator = 23
|
|
543
|
+
readonly kind = "UpdateImmutableFlag"
|
|
544
|
+
|
|
545
|
+
toJSON(): UpdateImmutableFlagJSON {
|
|
546
|
+
return {
|
|
547
|
+
kind: "UpdateImmutableFlag",
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
toEncodable() {
|
|
552
|
+
return {
|
|
553
|
+
UpdateImmutableFlag: {},
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export interface UpdateObligationOrderCreationEnabledJSON {
|
|
559
|
+
kind: "UpdateObligationOrderCreationEnabled"
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
export class UpdateObligationOrderCreationEnabled {
|
|
563
|
+
static readonly discriminator = 24
|
|
564
|
+
static readonly kind = "UpdateObligationOrderCreationEnabled"
|
|
565
|
+
readonly discriminator = 24
|
|
566
|
+
readonly kind = "UpdateObligationOrderCreationEnabled"
|
|
567
|
+
|
|
568
|
+
toJSON(): UpdateObligationOrderCreationEnabledJSON {
|
|
569
|
+
return {
|
|
570
|
+
kind: "UpdateObligationOrderCreationEnabled",
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
toEncodable() {
|
|
575
|
+
return {
|
|
576
|
+
UpdateObligationOrderCreationEnabled: {},
|
|
531
577
|
}
|
|
532
578
|
}
|
|
533
579
|
}
|
|
@@ -604,8 +650,14 @@ export function fromDecoded(obj: any): types.UpdateLendingMarketModeKind {
|
|
|
604
650
|
if ("UpdateInitialDepositAmount" in obj) {
|
|
605
651
|
return new UpdateInitialDepositAmount()
|
|
606
652
|
}
|
|
607
|
-
if ("
|
|
608
|
-
return new
|
|
653
|
+
if ("UpdateObligationOrderExecutionEnabled" in obj) {
|
|
654
|
+
return new UpdateObligationOrderExecutionEnabled()
|
|
655
|
+
}
|
|
656
|
+
if ("UpdateImmutableFlag" in obj) {
|
|
657
|
+
return new UpdateImmutableFlag()
|
|
658
|
+
}
|
|
659
|
+
if ("UpdateObligationOrderCreationEnabled" in obj) {
|
|
660
|
+
return new UpdateObligationOrderCreationEnabled()
|
|
609
661
|
}
|
|
610
662
|
|
|
611
663
|
throw new Error("Invalid enum object")
|
|
@@ -681,8 +733,14 @@ export function fromJSON(
|
|
|
681
733
|
case "UpdateInitialDepositAmount": {
|
|
682
734
|
return new UpdateInitialDepositAmount()
|
|
683
735
|
}
|
|
684
|
-
case "
|
|
685
|
-
return new
|
|
736
|
+
case "UpdateObligationOrderExecutionEnabled": {
|
|
737
|
+
return new UpdateObligationOrderExecutionEnabled()
|
|
738
|
+
}
|
|
739
|
+
case "UpdateImmutableFlag": {
|
|
740
|
+
return new UpdateImmutableFlag()
|
|
741
|
+
}
|
|
742
|
+
case "UpdateObligationOrderCreationEnabled": {
|
|
743
|
+
return new UpdateObligationOrderCreationEnabled()
|
|
686
744
|
}
|
|
687
745
|
}
|
|
688
746
|
}
|
|
@@ -711,7 +769,9 @@ export function layout(property?: string) {
|
|
|
711
769
|
borsh.struct([], "UpdateName"),
|
|
712
770
|
borsh.struct([], "UpdateIndividualAutodeleverageMarginCallPeriodSecs"),
|
|
713
771
|
borsh.struct([], "UpdateInitialDepositAmount"),
|
|
714
|
-
borsh.struct([], "
|
|
772
|
+
borsh.struct([], "UpdateObligationOrderExecutionEnabled"),
|
|
773
|
+
borsh.struct([], "UpdateImmutableFlag"),
|
|
774
|
+
borsh.struct([], "UpdateObligationOrderCreationEnabled"),
|
|
715
775
|
])
|
|
716
776
|
if (property !== undefined) {
|
|
717
777
|
return ret.replicate(property)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as UpdateConfigMode from "./UpdateConfigMode"
|
|
2
2
|
import * as UpdateLendingMarketConfigValue from "./UpdateLendingMarketConfigValue"
|
|
3
3
|
import * as UpdateLendingMarketMode from "./UpdateLendingMarketMode"
|
|
4
|
+
import * as UpdateGlobalConfigMode from "./UpdateGlobalConfigMode"
|
|
4
5
|
import * as AssetTier from "./AssetTier"
|
|
5
6
|
import * as FeeCalculation from "./FeeCalculation"
|
|
6
7
|
import * as ReserveFarmKind from "./ReserveFarmKind"
|
|
@@ -159,7 +160,9 @@ export type UpdateLendingMarketModeKind =
|
|
|
159
160
|
| UpdateLendingMarketMode.UpdateName
|
|
160
161
|
| UpdateLendingMarketMode.UpdateIndividualAutodeleverageMarginCallPeriodSecs
|
|
161
162
|
| UpdateLendingMarketMode.UpdateInitialDepositAmount
|
|
162
|
-
| UpdateLendingMarketMode.
|
|
163
|
+
| UpdateLendingMarketMode.UpdateObligationOrderExecutionEnabled
|
|
164
|
+
| UpdateLendingMarketMode.UpdateImmutableFlag
|
|
165
|
+
| UpdateLendingMarketMode.UpdateObligationOrderCreationEnabled
|
|
163
166
|
export type UpdateLendingMarketModeJSON =
|
|
164
167
|
| UpdateLendingMarketMode.UpdateOwnerJSON
|
|
165
168
|
| UpdateLendingMarketMode.UpdateEmergencyModeJSON
|
|
@@ -183,7 +186,18 @@ export type UpdateLendingMarketModeJSON =
|
|
|
183
186
|
| UpdateLendingMarketMode.UpdateNameJSON
|
|
184
187
|
| UpdateLendingMarketMode.UpdateIndividualAutodeleverageMarginCallPeriodSecsJSON
|
|
185
188
|
| UpdateLendingMarketMode.UpdateInitialDepositAmountJSON
|
|
186
|
-
| UpdateLendingMarketMode.
|
|
189
|
+
| UpdateLendingMarketMode.UpdateObligationOrderExecutionEnabledJSON
|
|
190
|
+
| UpdateLendingMarketMode.UpdateImmutableFlagJSON
|
|
191
|
+
| UpdateLendingMarketMode.UpdateObligationOrderCreationEnabledJSON
|
|
192
|
+
|
|
193
|
+
export { UpdateGlobalConfigMode }
|
|
194
|
+
|
|
195
|
+
export type UpdateGlobalConfigModeKind =
|
|
196
|
+
| UpdateGlobalConfigMode.PendingAdmin
|
|
197
|
+
| UpdateGlobalConfigMode.FeeCollector
|
|
198
|
+
export type UpdateGlobalConfigModeJSON =
|
|
199
|
+
| UpdateGlobalConfigMode.PendingAdminJSON
|
|
200
|
+
| UpdateGlobalConfigMode.FeeCollectorJSON
|
|
187
201
|
|
|
188
202
|
export { LastUpdate } from "./LastUpdate"
|
|
189
203
|
export type { LastUpdateFields, LastUpdateJSON } from "./LastUpdate"
|
package/src/utils/instruction.ts
CHANGED
|
@@ -226,7 +226,7 @@ export const buildVersionedTransactionSync = (
|
|
|
226
226
|
payer: PublicKey,
|
|
227
227
|
instructions: TransactionInstruction[],
|
|
228
228
|
blockhash: Blockhash,
|
|
229
|
-
lookupTables: AddressLookupTableAccount[] = []
|
|
229
|
+
lookupTables: AddressLookupTableAccount[] = []
|
|
230
230
|
): VersionedTransaction => {
|
|
231
231
|
const messageV0 = new TransactionMessage({
|
|
232
232
|
payerKey: payer,
|
|
@@ -235,7 +235,7 @@ export const buildVersionedTransactionSync = (
|
|
|
235
235
|
}).compileToV0Message(lookupTables.filter(notEmpty));
|
|
236
236
|
|
|
237
237
|
return new VersionedTransaction(messageV0);
|
|
238
|
-
}
|
|
238
|
+
};
|
|
239
239
|
|
|
240
240
|
export const getLookupTableAccount = async (connection: Connection, address: PublicKey) => {
|
|
241
241
|
return connection.getAddressLookupTable(address).then((res) => res.value);
|
package/src/utils/lookupTable.ts
CHANGED
|
@@ -15,13 +15,7 @@ export async function createLookupTableIx(
|
|
|
15
15
|
connection: Connection,
|
|
16
16
|
wallet: PublicKey
|
|
17
17
|
): Promise<[TransactionInstruction, PublicKey]> {
|
|
18
|
-
|
|
19
|
-
authority: wallet,
|
|
20
|
-
payer: wallet,
|
|
21
|
-
recentSlot: await connection.getSlot('confirmed'),
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
return [createLookupTableIxs, lookupTableAddress];
|
|
18
|
+
return initLookupTableIx(wallet, await connection.getSlot('confirmed'));
|
|
25
19
|
}
|
|
26
20
|
|
|
27
21
|
export function extendLookupTableChunkIx(
|
|
@@ -262,7 +262,7 @@ export const DefaultConfigParams: AssetReserveConfigParams = {
|
|
|
262
262
|
borrowFeeSf: ZERO_FRACTION,
|
|
263
263
|
flashLoanFeeSf: ZERO_FRACTION,
|
|
264
264
|
protocolTakeRate: 0,
|
|
265
|
-
elevationGroups:
|
|
265
|
+
elevationGroups: new Array(20).fill(0),
|
|
266
266
|
priceFeed: null,
|
|
267
267
|
borrowLimit: new Decimal(1000.0),
|
|
268
268
|
depositLimit: new Decimal(1000.0),
|
package/src/utils/seeds.ts
CHANGED
|
@@ -39,6 +39,10 @@ export const BASE_SEED_REFERRER_STATE = 'ref_state';
|
|
|
39
39
|
* Short url seed
|
|
40
40
|
*/
|
|
41
41
|
export const BASE_SEED_SHORT_URL = 'short_url';
|
|
42
|
+
/**
|
|
43
|
+
* Short url seed
|
|
44
|
+
*/
|
|
45
|
+
export const BASE_SEED_GLOBAL_CONFIG_STATE = 'global_config';
|
|
42
46
|
/**
|
|
43
47
|
* Farm user state seed
|
|
44
48
|
*/
|
|
@@ -193,6 +197,27 @@ export function shortUrlPda(shortUrl: string, programId: PublicKey = PROGRAM_ID)
|
|
|
193
197
|
return PublicKey.findProgramAddressSync([Buffer.from(BASE_SEED_SHORT_URL), Buffer.from(shortUrl)], programId);
|
|
194
198
|
}
|
|
195
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Returns the PDA and bump for the global config state.
|
|
202
|
+
* @param programId
|
|
203
|
+
* @returns [pda, bump]
|
|
204
|
+
*/
|
|
205
|
+
export function globalConfigPda(programId: PublicKey = PROGRAM_ID) {
|
|
206
|
+
return PublicKey.findProgramAddressSync([Buffer.from(BASE_SEED_GLOBAL_CONFIG_STATE)], programId);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Returns the PDA and bump for the program data.
|
|
211
|
+
* @param programId
|
|
212
|
+
* @returns [pda, bump]
|
|
213
|
+
*/
|
|
214
|
+
export function programDataPda(programId: PublicKey = PROGRAM_ID) {
|
|
215
|
+
return PublicKey.findProgramAddressSync(
|
|
216
|
+
[programId.toBuffer()],
|
|
217
|
+
new PublicKey('BPFLoaderUpgradeab1e11111111111111111111111')
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
196
221
|
/**
|
|
197
222
|
* Returns the PDA for the obligation farm state
|
|
198
223
|
* @param farm
|