@kamino-finance/klend-sdk 7.3.10-beta.0 → 7.4.0-beta.0
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/@codegen/klend/accounts/LendingMarket.d.ts +51 -3
- package/dist/@codegen/klend/accounts/LendingMarket.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/LendingMarket.js +39 -6
- package/dist/@codegen/klend/accounts/LendingMarket.js.map +1 -1
- package/dist/@codegen/klend/accounts/Obligation.d.ts +24 -15
- package/dist/@codegen/klend/accounts/Obligation.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/Obligation.js +24 -21
- package/dist/@codegen/klend/accounts/Obligation.js.map +1 -1
- package/dist/@codegen/klend/accounts/Reserve.js +1 -1
- package/dist/@codegen/klend/accounts/UserState.d.ts +0 -75
- package/dist/@codegen/klend/accounts/UserState.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/UserState.js +0 -25
- package/dist/@codegen/klend/accounts/UserState.js.map +1 -1
- package/dist/@codegen/klend/errors/custom.d.ts +89 -1
- package/dist/@codegen/klend/errors/custom.d.ts.map +1 -1
- package/dist/@codegen/klend/errors/custom.js +155 -1
- package/dist/@codegen/klend/errors/custom.js.map +1 -1
- package/dist/@codegen/klend/instructions/fillBorrowOrder.d.ts +36 -0
- package/dist/@codegen/klend/instructions/fillBorrowOrder.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/fillBorrowOrder.js +49 -0
- package/dist/@codegen/klend/instructions/fillBorrowOrder.js.map +1 -0
- package/dist/@codegen/klend/instructions/idlMissingTypes.d.ts +0 -1
- package/dist/@codegen/klend/instructions/idlMissingTypes.d.ts.map +1 -1
- package/dist/@codegen/klend/instructions/idlMissingTypes.js +0 -2
- package/dist/@codegen/klend/instructions/idlMissingTypes.js.map +1 -1
- package/dist/@codegen/klend/instructions/index.d.ts +4 -0
- package/dist/@codegen/klend/instructions/index.d.ts.map +1 -1
- package/dist/@codegen/klend/instructions/index.js +6 -1
- package/dist/@codegen/klend/instructions/index.js.map +1 -1
- package/dist/@codegen/klend/instructions/setBorrowOrder.d.ts +33 -0
- package/dist/@codegen/klend/instructions/setBorrowOrder.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/setBorrowOrder.js +66 -0
- package/dist/@codegen/klend/instructions/setBorrowOrder.js.map +1 -0
- package/dist/@codegen/klend/types/BorrowOrder.d.ts +192 -0
- package/dist/@codegen/klend/types/BorrowOrder.d.ts.map +1 -0
- package/dist/@codegen/klend/types/BorrowOrder.js +194 -0
- package/dist/@codegen/klend/types/BorrowOrder.js.map +1 -0
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.d.ts +39 -0
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.d.ts.map +1 -0
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.js +100 -0
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.js.map +1 -0
- package/dist/@codegen/klend/types/ObligationLiquidity.d.ts +35 -5
- package/dist/@codegen/klend/types/ObligationLiquidity.d.ts.map +1 -1
- package/dist/@codegen/klend/types/ObligationLiquidity.js +17 -7
- package/dist/@codegen/klend/types/ObligationLiquidity.js.map +1 -1
- package/dist/@codegen/klend/types/ObligationOrder.d.ts +4 -4
- package/dist/@codegen/klend/types/ObligationOrder.js +2 -2
- package/dist/@codegen/klend/types/ReserveConfig.d.ts +60 -5
- package/dist/@codegen/klend/types/ReserveConfig.d.ts.map +1 -1
- package/dist/@codegen/klend/types/ReserveConfig.js +36 -7
- package/dist/@codegen/klend/types/ReserveConfig.js.map +1 -1
- package/dist/@codegen/klend/types/UpdateConfigMode.d.ts +33 -7
- package/dist/@codegen/klend/types/UpdateConfigMode.d.ts.map +1 -1
- package/dist/@codegen/klend/types/UpdateConfigMode.js +61 -13
- package/dist/@codegen/klend/types/UpdateConfigMode.js.map +1 -1
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.d.ts +52 -0
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.d.ts.map +1 -1
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.js +97 -1
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.js.map +1 -1
- package/dist/@codegen/klend/types/index.d.ts +8 -8
- package/dist/@codegen/klend/types/index.d.ts.map +1 -1
- package/dist/@codegen/klend/types/index.js +5 -3
- package/dist/@codegen/klend/types/index.js.map +1 -1
- package/dist/@codegen/klend/zero_padding/ObligationZP.d.ts +8 -5
- package/dist/@codegen/klend/zero_padding/ObligationZP.d.ts.map +1 -1
- package/dist/@codegen/klend/zero_padding/ObligationZP.js +17 -14
- package/dist/@codegen/klend/zero_padding/ObligationZP.js.map +1 -1
- package/dist/classes/action.d.ts.map +1 -1
- package/dist/classes/action.js +11 -20
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/configItems.d.ts +1 -6
- package/dist/classes/configItems.d.ts.map +1 -1
- package/dist/classes/configItems.js +1 -93
- package/dist/classes/configItems.js.map +1 -1
- package/dist/classes/farm_utils.d.ts +1 -1
- package/dist/classes/farm_utils.d.ts.map +1 -1
- package/dist/classes/farm_utils.js +3 -1
- package/dist/classes/farm_utils.js.map +1 -1
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +4 -0
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/market.d.ts +6 -0
- package/dist/classes/market.d.ts.map +1 -1
- package/dist/classes/market.js +8 -0
- package/dist/classes/market.js.map +1 -1
- package/dist/classes/obligation.js +1 -1
- package/dist/classes/obligation.js.map +1 -1
- package/dist/classes/reserve.d.ts +7 -3
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +34 -44
- package/dist/classes/reserve.js.map +1 -1
- package/dist/classes/shared.d.ts +2 -2
- package/dist/classes/shared.d.ts.map +1 -1
- package/dist/classes/vault.d.ts +28 -1
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +103 -6
- package/dist/classes/vault.js.map +1 -1
- package/dist/classes/vault_types.d.ts +2 -1
- package/dist/classes/vault_types.d.ts.map +1 -1
- package/dist/idl/klend.json +581 -54
- package/dist/manager/client_kamino_manager.js +12 -6
- package/dist/manager/client_kamino_manager.js.map +1 -1
- package/dist/utils/Logger.d.ts +14 -0
- package/dist/utils/Logger.d.ts.map +1 -0
- package/dist/utils/Logger.js +12 -0
- package/dist/utils/Logger.js.map +1 -0
- package/dist/utils/api.d.ts +13 -4
- package/dist/utils/api.d.ts.map +1 -1
- package/dist/utils/api.js +33 -31
- package/dist/utils/api.js.map +1 -1
- package/dist/utils/managerTypes.d.ts.map +1 -1
- package/dist/utils/managerTypes.js +3 -1
- package/dist/utils/managerTypes.js.map +1 -1
- package/package.json +1 -1
- package/src/@codegen/klend/accounts/LendingMarket.ts +79 -8
- package/src/@codegen/klend/accounts/Obligation.ts +42 -31
- package/src/@codegen/klend/accounts/Reserve.ts +1 -1
- package/src/@codegen/klend/accounts/UserState.ts +0 -75
- package/src/@codegen/klend/errors/custom.ts +172 -0
- package/src/@codegen/klend/instructions/fillBorrowOrder.ts +96 -0
- package/src/@codegen/klend/instructions/idlMissingTypes.ts +0 -3
- package/src/@codegen/klend/instructions/index.ts +7 -0
- package/src/@codegen/klend/instructions/setBorrowOrder.ts +81 -0
- package/src/@codegen/klend/types/BorrowOrder.ts +267 -0
- package/src/@codegen/klend/types/BorrowOrderConfigArgs.ts +87 -0
- package/src/@codegen/klend/types/ObligationLiquidity.ts +39 -9
- package/src/@codegen/klend/types/ObligationOrder.ts +4 -4
- package/src/@codegen/klend/types/ReserveConfig.ts +72 -9
- package/src/@codegen/klend/types/UpdateConfigMode.ts +73 -13
- package/src/@codegen/klend/types/UpdateLendingMarketMode.ts +120 -0
- package/src/@codegen/klend/types/index.ts +21 -14
- package/src/@codegen/klend/zero_padding/ObligationZP.ts +17 -14
- package/src/classes/action.ts +25 -25
- package/src/classes/configItems.ts +1 -99
- package/src/classes/farm_utils.ts +5 -1
- package/src/classes/manager.ts +5 -0
- package/src/classes/market.ts +16 -0
- package/src/classes/obligation.ts +1 -1
- package/src/classes/reserve.ts +120 -122
- package/src/classes/shared.ts +2 -2
- package/src/classes/vault.ts +160 -7
- package/src/classes/vault_types.ts +2 -1
- package/src/idl/klend.json +581 -54
- package/src/manager/client_kamino_manager.ts +12 -6
- package/src/utils/Logger.ts +14 -0
- package/src/utils/api.ts +56 -33
- package/src/utils/managerTypes.ts +3 -1
- package/dist/@codegen/klend/types/AssetTier.d.ts +0 -45
- package/dist/@codegen/klend/types/AssetTier.d.ts.map +0 -1
- package/dist/@codegen/klend/types/AssetTier.js +0 -132
- package/dist/@codegen/klend/types/AssetTier.js.map +0 -1
- package/src/@codegen/klend/types/AssetTier.ts +0 -119
|
@@ -625,6 +625,98 @@ export class UpdatePriceTriggeredLiquidationDisabled {
|
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
|
|
628
|
+
export interface UpdateMatureReserveDebtLiquidationEnabledJSON {
|
|
629
|
+
kind: "UpdateMatureReserveDebtLiquidationEnabled"
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
export class UpdateMatureReserveDebtLiquidationEnabled {
|
|
633
|
+
static readonly discriminator = 27
|
|
634
|
+
static readonly kind = "UpdateMatureReserveDebtLiquidationEnabled"
|
|
635
|
+
readonly discriminator = 27
|
|
636
|
+
readonly kind = "UpdateMatureReserveDebtLiquidationEnabled"
|
|
637
|
+
|
|
638
|
+
toJSON(): UpdateMatureReserveDebtLiquidationEnabledJSON {
|
|
639
|
+
return {
|
|
640
|
+
kind: "UpdateMatureReserveDebtLiquidationEnabled",
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
toEncodable() {
|
|
645
|
+
return {
|
|
646
|
+
UpdateMatureReserveDebtLiquidationEnabled: {},
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
export interface UpdateObligationBorrowDebtTermLiquidationEnabledJSON {
|
|
652
|
+
kind: "UpdateObligationBorrowDebtTermLiquidationEnabled"
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
export class UpdateObligationBorrowDebtTermLiquidationEnabled {
|
|
656
|
+
static readonly discriminator = 28
|
|
657
|
+
static readonly kind = "UpdateObligationBorrowDebtTermLiquidationEnabled"
|
|
658
|
+
readonly discriminator = 28
|
|
659
|
+
readonly kind = "UpdateObligationBorrowDebtTermLiquidationEnabled"
|
|
660
|
+
|
|
661
|
+
toJSON(): UpdateObligationBorrowDebtTermLiquidationEnabledJSON {
|
|
662
|
+
return {
|
|
663
|
+
kind: "UpdateObligationBorrowDebtTermLiquidationEnabled",
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
toEncodable() {
|
|
668
|
+
return {
|
|
669
|
+
UpdateObligationBorrowDebtTermLiquidationEnabled: {},
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
export interface UpdateBorrowOrderCreationEnabledJSON {
|
|
675
|
+
kind: "UpdateBorrowOrderCreationEnabled"
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
export class UpdateBorrowOrderCreationEnabled {
|
|
679
|
+
static readonly discriminator = 29
|
|
680
|
+
static readonly kind = "UpdateBorrowOrderCreationEnabled"
|
|
681
|
+
readonly discriminator = 29
|
|
682
|
+
readonly kind = "UpdateBorrowOrderCreationEnabled"
|
|
683
|
+
|
|
684
|
+
toJSON(): UpdateBorrowOrderCreationEnabledJSON {
|
|
685
|
+
return {
|
|
686
|
+
kind: "UpdateBorrowOrderCreationEnabled",
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
toEncodable() {
|
|
691
|
+
return {
|
|
692
|
+
UpdateBorrowOrderCreationEnabled: {},
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
export interface UpdateBorrowOrderExecutionEnabledJSON {
|
|
698
|
+
kind: "UpdateBorrowOrderExecutionEnabled"
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
export class UpdateBorrowOrderExecutionEnabled {
|
|
702
|
+
static readonly discriminator = 30
|
|
703
|
+
static readonly kind = "UpdateBorrowOrderExecutionEnabled"
|
|
704
|
+
readonly discriminator = 30
|
|
705
|
+
readonly kind = "UpdateBorrowOrderExecutionEnabled"
|
|
706
|
+
|
|
707
|
+
toJSON(): UpdateBorrowOrderExecutionEnabledJSON {
|
|
708
|
+
return {
|
|
709
|
+
kind: "UpdateBorrowOrderExecutionEnabled",
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
toEncodable() {
|
|
714
|
+
return {
|
|
715
|
+
UpdateBorrowOrderExecutionEnabled: {},
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
|
|
628
720
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
629
721
|
export function fromDecoded(obj: any): types.UpdateLendingMarketModeKind {
|
|
630
722
|
if (typeof obj !== "object") {
|
|
@@ -712,6 +804,18 @@ export function fromDecoded(obj: any): types.UpdateLendingMarketModeKind {
|
|
|
712
804
|
if ("UpdatePriceTriggeredLiquidationDisabled" in obj) {
|
|
713
805
|
return new UpdatePriceTriggeredLiquidationDisabled()
|
|
714
806
|
}
|
|
807
|
+
if ("UpdateMatureReserveDebtLiquidationEnabled" in obj) {
|
|
808
|
+
return new UpdateMatureReserveDebtLiquidationEnabled()
|
|
809
|
+
}
|
|
810
|
+
if ("UpdateObligationBorrowDebtTermLiquidationEnabled" in obj) {
|
|
811
|
+
return new UpdateObligationBorrowDebtTermLiquidationEnabled()
|
|
812
|
+
}
|
|
813
|
+
if ("UpdateBorrowOrderCreationEnabled" in obj) {
|
|
814
|
+
return new UpdateBorrowOrderCreationEnabled()
|
|
815
|
+
}
|
|
816
|
+
if ("UpdateBorrowOrderExecutionEnabled" in obj) {
|
|
817
|
+
return new UpdateBorrowOrderExecutionEnabled()
|
|
818
|
+
}
|
|
715
819
|
|
|
716
820
|
throw new Error("Invalid enum object")
|
|
717
821
|
}
|
|
@@ -801,6 +905,18 @@ export function fromJSON(
|
|
|
801
905
|
case "UpdatePriceTriggeredLiquidationDisabled": {
|
|
802
906
|
return new UpdatePriceTriggeredLiquidationDisabled()
|
|
803
907
|
}
|
|
908
|
+
case "UpdateMatureReserveDebtLiquidationEnabled": {
|
|
909
|
+
return new UpdateMatureReserveDebtLiquidationEnabled()
|
|
910
|
+
}
|
|
911
|
+
case "UpdateObligationBorrowDebtTermLiquidationEnabled": {
|
|
912
|
+
return new UpdateObligationBorrowDebtTermLiquidationEnabled()
|
|
913
|
+
}
|
|
914
|
+
case "UpdateBorrowOrderCreationEnabled": {
|
|
915
|
+
return new UpdateBorrowOrderCreationEnabled()
|
|
916
|
+
}
|
|
917
|
+
case "UpdateBorrowOrderExecutionEnabled": {
|
|
918
|
+
return new UpdateBorrowOrderExecutionEnabled()
|
|
919
|
+
}
|
|
804
920
|
}
|
|
805
921
|
}
|
|
806
922
|
|
|
@@ -833,6 +949,10 @@ export function layout(property?: string) {
|
|
|
833
949
|
borsh.struct([], "UpdateObligationOrderCreationEnabled"),
|
|
834
950
|
borsh.struct([], "UpdateProposerAuthority"),
|
|
835
951
|
borsh.struct([], "UpdatePriceTriggeredLiquidationDisabled"),
|
|
952
|
+
borsh.struct([], "UpdateMatureReserveDebtLiquidationEnabled"),
|
|
953
|
+
borsh.struct([], "UpdateObligationBorrowDebtTermLiquidationEnabled"),
|
|
954
|
+
borsh.struct([], "UpdateBorrowOrderCreationEnabled"),
|
|
955
|
+
borsh.struct([], "UpdateBorrowOrderExecutionEnabled"),
|
|
836
956
|
])
|
|
837
957
|
if (property !== undefined) {
|
|
838
958
|
return ret.replicate(property)
|
|
@@ -2,11 +2,15 @@ import * as UpdateConfigMode from "./UpdateConfigMode"
|
|
|
2
2
|
import * as UpdateLendingMarketConfigValue from "./UpdateLendingMarketConfigValue"
|
|
3
3
|
import * as UpdateLendingMarketMode from "./UpdateLendingMarketMode"
|
|
4
4
|
import * as UpdateGlobalConfigMode from "./UpdateGlobalConfigMode"
|
|
5
|
-
import * as AssetTier from "./AssetTier"
|
|
6
5
|
import * as FeeCalculation from "./FeeCalculation"
|
|
7
6
|
import * as ReserveFarmKind from "./ReserveFarmKind"
|
|
8
7
|
import * as ReserveStatus from "./ReserveStatus"
|
|
9
8
|
|
|
9
|
+
export { BorrowOrderConfigArgs } from "./BorrowOrderConfigArgs"
|
|
10
|
+
export type {
|
|
11
|
+
BorrowOrderConfigArgsFields,
|
|
12
|
+
BorrowOrderConfigArgsJSON,
|
|
13
|
+
} from "./BorrowOrderConfigArgs"
|
|
10
14
|
export { UpdateConfigMode }
|
|
11
15
|
|
|
12
16
|
export type UpdateConfigModeKind =
|
|
@@ -43,7 +47,7 @@ export type UpdateConfigModeKind =
|
|
|
43
47
|
| UpdateConfigMode.UpdateMinLiquidationBonusBps
|
|
44
48
|
| UpdateConfigMode.UpdateDeleveragingMarginCallPeriod
|
|
45
49
|
| UpdateConfigMode.UpdateBorrowFactor
|
|
46
|
-
| UpdateConfigMode.
|
|
50
|
+
| UpdateConfigMode.DeprecatedUpdateAssetTier
|
|
47
51
|
| UpdateConfigMode.UpdateElevationGroup
|
|
48
52
|
| UpdateConfigMode.UpdateDeleveragingThresholdDecreaseBpsPerDay
|
|
49
53
|
| UpdateConfigMode.DeprecatedUpdateMultiplierSideBoost
|
|
@@ -63,6 +67,8 @@ export type UpdateConfigModeKind =
|
|
|
63
67
|
| UpdateConfigMode.UpdateProposerAuthorityLock
|
|
64
68
|
| UpdateConfigMode.UpdateMinDeleveragingBonusBps
|
|
65
69
|
| UpdateConfigMode.UpdateBlockCTokenUsage
|
|
70
|
+
| UpdateConfigMode.UpdateDebtMaturityTimestamp
|
|
71
|
+
| UpdateConfigMode.UpdateDebtTermSeconds
|
|
66
72
|
export type UpdateConfigModeJSON =
|
|
67
73
|
| UpdateConfigMode.UpdateLoanToValuePctJSON
|
|
68
74
|
| UpdateConfigMode.UpdateMaxLiquidationBonusBpsJSON
|
|
@@ -97,7 +103,7 @@ export type UpdateConfigModeJSON =
|
|
|
97
103
|
| UpdateConfigMode.UpdateMinLiquidationBonusBpsJSON
|
|
98
104
|
| UpdateConfigMode.UpdateDeleveragingMarginCallPeriodJSON
|
|
99
105
|
| UpdateConfigMode.UpdateBorrowFactorJSON
|
|
100
|
-
| UpdateConfigMode.
|
|
106
|
+
| UpdateConfigMode.DeprecatedUpdateAssetTierJSON
|
|
101
107
|
| UpdateConfigMode.UpdateElevationGroupJSON
|
|
102
108
|
| UpdateConfigMode.UpdateDeleveragingThresholdDecreaseBpsPerDayJSON
|
|
103
109
|
| UpdateConfigMode.DeprecatedUpdateMultiplierSideBoostJSON
|
|
@@ -117,6 +123,8 @@ export type UpdateConfigModeJSON =
|
|
|
117
123
|
| UpdateConfigMode.UpdateProposerAuthorityLockJSON
|
|
118
124
|
| UpdateConfigMode.UpdateMinDeleveragingBonusBpsJSON
|
|
119
125
|
| UpdateConfigMode.UpdateBlockCTokenUsageJSON
|
|
126
|
+
| UpdateConfigMode.UpdateDebtMaturityTimestampJSON
|
|
127
|
+
| UpdateConfigMode.UpdateDebtTermSecondsJSON
|
|
120
128
|
|
|
121
129
|
export { UpdateLendingMarketConfigValue }
|
|
122
130
|
|
|
@@ -171,6 +179,10 @@ export type UpdateLendingMarketModeKind =
|
|
|
171
179
|
| UpdateLendingMarketMode.UpdateObligationOrderCreationEnabled
|
|
172
180
|
| UpdateLendingMarketMode.UpdateProposerAuthority
|
|
173
181
|
| UpdateLendingMarketMode.UpdatePriceTriggeredLiquidationDisabled
|
|
182
|
+
| UpdateLendingMarketMode.UpdateMatureReserveDebtLiquidationEnabled
|
|
183
|
+
| UpdateLendingMarketMode.UpdateObligationBorrowDebtTermLiquidationEnabled
|
|
184
|
+
| UpdateLendingMarketMode.UpdateBorrowOrderCreationEnabled
|
|
185
|
+
| UpdateLendingMarketMode.UpdateBorrowOrderExecutionEnabled
|
|
174
186
|
export type UpdateLendingMarketModeJSON =
|
|
175
187
|
| UpdateLendingMarketMode.UpdateOwnerJSON
|
|
176
188
|
| UpdateLendingMarketMode.UpdateEmergencyModeJSON
|
|
@@ -199,6 +211,10 @@ export type UpdateLendingMarketModeJSON =
|
|
|
199
211
|
| UpdateLendingMarketMode.UpdateObligationOrderCreationEnabledJSON
|
|
200
212
|
| UpdateLendingMarketMode.UpdateProposerAuthorityJSON
|
|
201
213
|
| UpdateLendingMarketMode.UpdatePriceTriggeredLiquidationDisabledJSON
|
|
214
|
+
| UpdateLendingMarketMode.UpdateMatureReserveDebtLiquidationEnabledJSON
|
|
215
|
+
| UpdateLendingMarketMode.UpdateObligationBorrowDebtTermLiquidationEnabledJSON
|
|
216
|
+
| UpdateLendingMarketMode.UpdateBorrowOrderCreationEnabledJSON
|
|
217
|
+
| UpdateLendingMarketMode.UpdateBorrowOrderExecutionEnabledJSON
|
|
202
218
|
|
|
203
219
|
export { UpdateGlobalConfigMode }
|
|
204
220
|
|
|
@@ -213,6 +229,8 @@ export { LastUpdate } from "./LastUpdate"
|
|
|
213
229
|
export type { LastUpdateFields, LastUpdateJSON } from "./LastUpdate"
|
|
214
230
|
export { ElevationGroup } from "./ElevationGroup"
|
|
215
231
|
export type { ElevationGroupFields, ElevationGroupJSON } from "./ElevationGroup"
|
|
232
|
+
export { BorrowOrder } from "./BorrowOrder"
|
|
233
|
+
export type { BorrowOrderFields, BorrowOrderJSON } from "./BorrowOrder"
|
|
216
234
|
export { InitObligationArgs } from "./InitObligationArgs"
|
|
217
235
|
export type {
|
|
218
236
|
InitObligationArgsFields,
|
|
@@ -233,17 +251,6 @@ export type {
|
|
|
233
251
|
ObligationOrderFields,
|
|
234
252
|
ObligationOrderJSON,
|
|
235
253
|
} from "./ObligationOrder"
|
|
236
|
-
export { AssetTier }
|
|
237
|
-
|
|
238
|
-
export type AssetTierKind =
|
|
239
|
-
| AssetTier.Regular
|
|
240
|
-
| AssetTier.IsolatedCollateral
|
|
241
|
-
| AssetTier.IsolatedDebt
|
|
242
|
-
export type AssetTierJSON =
|
|
243
|
-
| AssetTier.RegularJSON
|
|
244
|
-
| AssetTier.IsolatedCollateralJSON
|
|
245
|
-
| AssetTier.IsolatedDebtJSON
|
|
246
|
-
|
|
247
254
|
export { BigFractionBytes } from "./BigFractionBytes"
|
|
248
255
|
export type {
|
|
249
256
|
BigFractionBytesFields,
|
|
@@ -43,9 +43,7 @@ export class ObligationZP {
|
|
|
43
43
|
/** The dangerous borrow value at the weighted average liquidation threshold (scaled fraction) */
|
|
44
44
|
readonly unhealthyBorrowValueSf: BN
|
|
45
45
|
/** The asset tier of the deposits */
|
|
46
|
-
readonly
|
|
47
|
-
/** The asset tier of the borrows */
|
|
48
|
-
readonly borrowsAssetTiers: Array<number>
|
|
46
|
+
readonly paddingDeprecatedAssetTiers: Array<number>
|
|
49
47
|
/** The elevation group id the obligation opted into. */
|
|
50
48
|
readonly elevationGroup: number
|
|
51
49
|
/** The number of obsolete reserves the obligation has a deposit in */
|
|
@@ -73,10 +71,15 @@ export class ObligationZP {
|
|
|
73
71
|
*/
|
|
74
72
|
readonly autodeleverageMarginCallStartedTimestamp: BN
|
|
75
73
|
/**
|
|
76
|
-
* Owner-defined,
|
|
74
|
+
* Owner-defined, permissionlessly-executed repay orders.
|
|
77
75
|
* Typical use-cases would be a stop-loss and a take-profit (possibly co-existing).
|
|
78
76
|
*/
|
|
79
|
-
readonly
|
|
77
|
+
readonly obligationOrders: Array<types.ObligationOrder>
|
|
78
|
+
/**
|
|
79
|
+
* Owner-defined, permissionlessly-executed borrow order applicable to this obligation.
|
|
80
|
+
* Non-zeroed only on a newly-initialized fixed-rate, fixed-term obligation.
|
|
81
|
+
*/
|
|
82
|
+
readonly borrowOrder: types.BorrowOrder
|
|
80
83
|
readonly padding3: Array<BN> = new Array(0)
|
|
81
84
|
|
|
82
85
|
static readonly layout = borsh.struct<ObligationZP>([
|
|
@@ -92,8 +95,7 @@ export class ObligationZP {
|
|
|
92
95
|
borsh.u128("borrowedAssetsMarketValueSf"),
|
|
93
96
|
borsh.u128("allowedBorrowValueSf"),
|
|
94
97
|
borsh.u128("unhealthyBorrowValueSf"),
|
|
95
|
-
borsh.array(borsh.u8(),
|
|
96
|
-
borsh.array(borsh.u8(), 5, "borrowsAssetTiers"),
|
|
98
|
+
borsh.array(borsh.u8(), 13, "paddingDeprecatedAssetTiers"),
|
|
97
99
|
borsh.u8("elevationGroup"),
|
|
98
100
|
borsh.u8("numOfObsoleteDepositReserves"),
|
|
99
101
|
borsh.u8("hasDebt"),
|
|
@@ -105,7 +107,8 @@ export class ObligationZP {
|
|
|
105
107
|
borsh.array(borsh.u8(), 4, "reserved"),
|
|
106
108
|
borsh.u64("highestBorrowFactorPct"),
|
|
107
109
|
borsh.u64("autodeleverageMarginCallStartedTimestamp"),
|
|
108
|
-
borsh.array(types.ObligationOrder.layout(), 2, "
|
|
110
|
+
borsh.array(types.ObligationOrder.layout(), 2, "obligationOrders"),
|
|
111
|
+
types.BorrowOrder.layout("borrowOrder"),
|
|
109
112
|
])
|
|
110
113
|
|
|
111
114
|
constructor(fields: ObligationFields) {
|
|
@@ -127,8 +130,7 @@ export class ObligationZP {
|
|
|
127
130
|
this.borrowedAssetsMarketValueSf = fields.borrowedAssetsMarketValueSf
|
|
128
131
|
this.allowedBorrowValueSf = fields.allowedBorrowValueSf
|
|
129
132
|
this.unhealthyBorrowValueSf = fields.unhealthyBorrowValueSf
|
|
130
|
-
this.
|
|
131
|
-
this.borrowsAssetTiers = fields.borrowsAssetTiers
|
|
133
|
+
this.paddingDeprecatedAssetTiers = fields.paddingDeprecatedAssetTiers
|
|
132
134
|
this.elevationGroup = fields.elevationGroup
|
|
133
135
|
this.numOfObsoleteDepositReserves = fields.numOfObsoleteDepositReserves
|
|
134
136
|
this.hasDebt = fields.hasDebt
|
|
@@ -141,9 +143,10 @@ export class ObligationZP {
|
|
|
141
143
|
this.highestBorrowFactorPct = fields.highestBorrowFactorPct
|
|
142
144
|
this.autodeleverageMarginCallStartedTimestamp =
|
|
143
145
|
fields.autodeleverageMarginCallStartedTimestamp
|
|
144
|
-
this.
|
|
146
|
+
this.obligationOrders = fields.obligationOrders.map(
|
|
145
147
|
(item) => new types.ObligationOrder({ ...item })
|
|
146
148
|
)
|
|
149
|
+
this.borrowOrder = new types.BorrowOrder({ ...fields.borrowOrder })
|
|
147
150
|
this.padding3 = new Array<BN>(0);
|
|
148
151
|
}
|
|
149
152
|
|
|
@@ -212,8 +215,7 @@ export class ObligationZP {
|
|
|
212
215
|
borrowedAssetsMarketValueSf: dec.borrowedAssetsMarketValueSf,
|
|
213
216
|
allowedBorrowValueSf: dec.allowedBorrowValueSf,
|
|
214
217
|
unhealthyBorrowValueSf: dec.unhealthyBorrowValueSf,
|
|
215
|
-
|
|
216
|
-
borrowsAssetTiers: dec.borrowsAssetTiers,
|
|
218
|
+
paddingDeprecatedAssetTiers: dec.paddingDeprecatedAssetTiers,
|
|
217
219
|
elevationGroup: dec.elevationGroup,
|
|
218
220
|
numOfObsoleteDepositReserves: dec.numOfObsoleteDepositReserves,
|
|
219
221
|
hasDebt: dec.hasDebt,
|
|
@@ -226,11 +228,12 @@ export class ObligationZP {
|
|
|
226
228
|
highestBorrowFactorPct: dec.highestBorrowFactorPct,
|
|
227
229
|
autodeleverageMarginCallStartedTimestamp:
|
|
228
230
|
dec.autodeleverageMarginCallStartedTimestamp,
|
|
229
|
-
|
|
231
|
+
obligationOrders: dec.obligationOrders.map(
|
|
230
232
|
(
|
|
231
233
|
item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */
|
|
232
234
|
) => types.ObligationOrder.fromDecoded(item)
|
|
233
235
|
),
|
|
236
|
+
borrowOrder: types.BorrowOrder.fromDecoded(dec.borrowOrder),
|
|
234
237
|
padding3: [],
|
|
235
238
|
})
|
|
236
239
|
}
|
package/src/classes/action.ts
CHANGED
|
@@ -76,7 +76,11 @@ import { Scope } from '@kamino-finance/scope-sdk';
|
|
|
76
76
|
import { ObligationOrderAtIndex } from './obligationOrder';
|
|
77
77
|
import { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, TOKEN_PROGRAM_ADDRESS } from '@solana-program/token';
|
|
78
78
|
import { SYSVAR_INSTRUCTIONS_ADDRESS, SYSVAR_RENT_ADDRESS } from '@solana/sysvars';
|
|
79
|
-
import {
|
|
79
|
+
import {
|
|
80
|
+
getCloseAccountInstruction,
|
|
81
|
+
getSyncNativeInstruction,
|
|
82
|
+
TOKEN_2022_PROGRAM_ADDRESS,
|
|
83
|
+
} from '@solana-program/token-2022';
|
|
80
84
|
import { getTransferSolInstruction, SYSTEM_PROGRAM_ADDRESS } from '@solana-program/system';
|
|
81
85
|
import { noopSigner } from '../utils/signer';
|
|
82
86
|
|
|
@@ -3289,8 +3293,13 @@ export class KaminoAction {
|
|
|
3289
3293
|
action === 'mint' ||
|
|
3290
3294
|
(action === 'liquidate' && this.mint === WRAPPED_SOL_MINT); // only sync WSOL amount if liquidator repays SOL which is secondaryMint
|
|
3291
3295
|
|
|
3296
|
+
const isValidTokenAccount =
|
|
3297
|
+
userWSOLAccountInfo.exists &&
|
|
3298
|
+
(userWSOLAccountInfo.programAddress === TOKEN_PROGRAM_ADDRESS ||
|
|
3299
|
+
userWSOLAccountInfo.programAddress === TOKEN_2022_PROGRAM_ADDRESS);
|
|
3300
|
+
|
|
3292
3301
|
const transferLamportsIx = getTransferSolInstruction({
|
|
3293
|
-
amount: (
|
|
3302
|
+
amount: (isValidTokenAccount ? 0n : rentExemptLamports) + (sendAction ? BigInt(safeRepay.toString()) : 0n),
|
|
3294
3303
|
source: this.owner,
|
|
3295
3304
|
destination: userTokenAccountAddress,
|
|
3296
3305
|
});
|
|
@@ -3312,29 +3321,20 @@ export class KaminoAction {
|
|
|
3312
3321
|
},
|
|
3313
3322
|
{ programAddress: TOKEN_PROGRAM_ADDRESS }
|
|
3314
3323
|
);
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
userTokenAccountAddress
|
|
3330
|
-
);
|
|
3331
|
-
preIxs.push(createUserWSOLAccountIx);
|
|
3332
|
-
preIxsLabels.push(`CreateUserAtaSOL[${userTokenAccountAddress}]`);
|
|
3333
|
-
preIxs.push(syncIx);
|
|
3334
|
-
preIxsLabels.push(`SyncUserAtaSOL[${userTokenAccountAddress}]`);
|
|
3335
|
-
postIxs.push(closeWSOLAccountIx);
|
|
3336
|
-
postIxsLabels.push(`CloseUserAtaSOL[${userTokenAccountAddress}]`);
|
|
3337
|
-
}
|
|
3324
|
+
|
|
3325
|
+
const [, createUserWSOLAccountIx] = await createAssociatedTokenAccountIdempotentInstruction(
|
|
3326
|
+
this.owner,
|
|
3327
|
+
WRAPPED_SOL_MINT,
|
|
3328
|
+
this.owner.address,
|
|
3329
|
+
TOKEN_PROGRAM_ADDRESS,
|
|
3330
|
+
userTokenAccountAddress
|
|
3331
|
+
);
|
|
3332
|
+
preIxs.push(createUserWSOLAccountIx);
|
|
3333
|
+
preIxsLabels.push(`CreateUserAtaSOL[${userTokenAccountAddress}]`);
|
|
3334
|
+
preIxs.push(syncIx);
|
|
3335
|
+
preIxsLabels.push(`SyncUserAtaSOL[${userTokenAccountAddress}]`);
|
|
3336
|
+
postIxs.push(closeWSOLAccountIx);
|
|
3337
|
+
postIxsLabels.push(`CloseUserAtaSOL[${userTokenAccountAddress}]`);
|
|
3338
3338
|
|
|
3339
3339
|
this.setupIxs.unshift(...preIxs);
|
|
3340
3340
|
this.setupIxsLabels.unshift(...preIxsLabels);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { struct, Layout } from '@coral-xyz/borsh';
|
|
2
2
|
import { blobEquals, orThrow, toJson } from './utils';
|
|
3
3
|
import { Buffer } from 'buffer';
|
|
4
|
-
import { ReserveConfig } from '../lib';
|
|
5
|
-
import { UpdateConfigModeKind, UpdateConfigMode } from '../@codegen/klend/types';
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* An object literal specifying *all* "update mode" enum values (of type {@code M}) and their corresponding config items
|
|
@@ -153,7 +151,7 @@ export class ConfigItemUpdater<C, A> {
|
|
|
153
151
|
* A resolver of config item changes.
|
|
154
152
|
*/
|
|
155
153
|
export class ConfigUpdater<M extends BorshEnum, C> {
|
|
156
|
-
|
|
154
|
+
private readonly itemUpdaters: Map<M['kind'], [M, ConfigItemUpdater<C, any>[]]>;
|
|
157
155
|
|
|
158
156
|
/**
|
|
159
157
|
* A resolving constructor.
|
|
@@ -237,61 +235,6 @@ export class ConfigUpdater<M extends BorshEnum, C> {
|
|
|
237
235
|
}
|
|
238
236
|
}
|
|
239
237
|
|
|
240
|
-
export class EntireReserveConfigUpdater extends ConfigUpdater<UpdateConfigModeKind, ReserveConfig> {
|
|
241
|
-
encodeAllUpdates(
|
|
242
|
-
currentConfig: ReserveConfig | undefined,
|
|
243
|
-
newConfig: ReserveConfig
|
|
244
|
-
): EncodedConfigUpdate<UpdateConfigModeKind>[] {
|
|
245
|
-
const updates: EncodedConfigUpdate<UpdateConfigModeKind>[] = [];
|
|
246
|
-
let ltvUpdate: EncodedConfigUpdate<UpdateConfigModeKind> | undefined;
|
|
247
|
-
let liquidationThresholdUpdate: EncodedConfigUpdate<UpdateConfigModeKind> | undefined;
|
|
248
|
-
|
|
249
|
-
for (const [mode, itemUpdaters] of this.itemUpdaters.values()) {
|
|
250
|
-
for (const itemUpdater of itemUpdaters) {
|
|
251
|
-
const value = itemUpdater.encodeUpdatedItemFrom(currentConfig, newConfig);
|
|
252
|
-
if (value === undefined) {
|
|
253
|
-
continue;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
const update = { mode, value };
|
|
257
|
-
|
|
258
|
-
if (mode.discriminator === UpdateConfigMode.UpdateLoanToValuePct.discriminator) {
|
|
259
|
-
ltvUpdate = update;
|
|
260
|
-
} else if (mode.discriminator === UpdateConfigMode.UpdateLiquidationThresholdPct.discriminator) {
|
|
261
|
-
liquidationThresholdUpdate = update;
|
|
262
|
-
// If reserve is already initialized, skip fields that require global admin signature on update
|
|
263
|
-
} else {
|
|
264
|
-
updates.push(update);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// Handle ordering of LTV and LiquidationThreshold updates
|
|
270
|
-
// ensure LiquidationThreshold >= LTV at all times
|
|
271
|
-
if (ltvUpdate && liquidationThresholdUpdate) {
|
|
272
|
-
const currentLiquidationThreshold = currentConfig ? currentConfig.liquidationThresholdPct : 0;
|
|
273
|
-
const newLiquidationThreshold = newConfig.liquidationThresholdPct;
|
|
274
|
-
|
|
275
|
-
if (newLiquidationThreshold > currentLiquidationThreshold) {
|
|
276
|
-
// Liquidation threshold is increasing, so it must be updated first
|
|
277
|
-
updates.push(liquidationThresholdUpdate);
|
|
278
|
-
updates.push(ltvUpdate);
|
|
279
|
-
} else {
|
|
280
|
-
// All other cases, it's safer to update the LTV first
|
|
281
|
-
updates.push(ltvUpdate);
|
|
282
|
-
updates.push(liquidationThresholdUpdate);
|
|
283
|
-
}
|
|
284
|
-
} else if (ltvUpdate) {
|
|
285
|
-
updates.push(ltvUpdate);
|
|
286
|
-
} else if (liquidationThresholdUpdate) {
|
|
287
|
-
updates.push(liquidationThresholdUpdate);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
updates.sort((left, right) => priorityOf(left.mode) - priorityOf(right.mode));
|
|
291
|
-
return updates;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
238
|
/**
|
|
296
239
|
* The update mode discriminator and the serialized value needed to construct an update ix.
|
|
297
240
|
*/
|
|
@@ -350,44 +293,3 @@ type Getter<C, A> = (config: C) => A;
|
|
|
350
293
|
function toArray<T>(singleOrArray: SingleOrArray<T>): T[] {
|
|
351
294
|
return Array.isArray(singleOrArray) ? singleOrArray : [singleOrArray];
|
|
352
295
|
}
|
|
353
|
-
|
|
354
|
-
// Lowest priority gets updated first
|
|
355
|
-
function priorityOf(mode: UpdateConfigModeKind): number {
|
|
356
|
-
switch (mode.discriminator) {
|
|
357
|
-
case UpdateConfigMode.UpdateScopePriceFeed.discriminator:
|
|
358
|
-
return 0;
|
|
359
|
-
case UpdateConfigMode.UpdateTokenInfoScopeTwap.discriminator:
|
|
360
|
-
return 0;
|
|
361
|
-
case UpdateConfigMode.UpdateTokenInfoScopeChain.discriminator:
|
|
362
|
-
return 0;
|
|
363
|
-
case UpdateConfigMode.UpdateTokenInfoLowerHeuristic.discriminator:
|
|
364
|
-
return 0;
|
|
365
|
-
case UpdateConfigMode.UpdateTokenInfoUpperHeuristic.discriminator:
|
|
366
|
-
return 0;
|
|
367
|
-
case UpdateConfigMode.UpdateTokenInfoExpHeuristic.discriminator:
|
|
368
|
-
return 0;
|
|
369
|
-
case UpdateConfigMode.UpdateTokenInfoTwapDivergence.discriminator:
|
|
370
|
-
return 0;
|
|
371
|
-
case UpdateConfigMode.UpdateTokenInfoName.discriminator:
|
|
372
|
-
return 0;
|
|
373
|
-
case UpdateConfigMode.UpdateTokenInfoPriceMaxAge.discriminator:
|
|
374
|
-
return 0;
|
|
375
|
-
case UpdateConfigMode.UpdateTokenInfoTwapMaxAge.discriminator:
|
|
376
|
-
return 0;
|
|
377
|
-
case UpdateConfigMode.UpdateDeleveragingBonusIncreaseBpsPerDay.discriminator:
|
|
378
|
-
return priorityOf(new UpdateConfigMode.UpdateAutodeleverageEnabled()) - 1;
|
|
379
|
-
case UpdateConfigMode.UpdateDeleveragingMarginCallPeriod.discriminator:
|
|
380
|
-
return priorityOf(new UpdateConfigMode.UpdateAutodeleverageEnabled()) - 1;
|
|
381
|
-
case UpdateConfigMode.UpdateDeleveragingThresholdDecreaseBpsPerDay.discriminator:
|
|
382
|
-
return priorityOf(new UpdateConfigMode.UpdateAutodeleverageEnabled()) - 1;
|
|
383
|
-
case UpdateConfigMode.UpdateAutodeleverageEnabled.discriminator:
|
|
384
|
-
return 4;
|
|
385
|
-
// Always update last bc we cannot skip validation
|
|
386
|
-
case UpdateConfigMode.UpdateDepositLimit.discriminator:
|
|
387
|
-
return 63;
|
|
388
|
-
case UpdateConfigMode.UpdateBorrowLimit.discriminator:
|
|
389
|
-
return 63;
|
|
390
|
-
default:
|
|
391
|
-
return 10;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
scaleDownWads,
|
|
9
9
|
WAD,
|
|
10
10
|
RewardInfo,
|
|
11
|
+
RewardType,
|
|
11
12
|
} from '@kamino-finance/farms-sdk';
|
|
12
13
|
import {
|
|
13
14
|
address,
|
|
@@ -174,7 +175,7 @@ export type UnstakeAndWithdrawFromFarmIxs = {
|
|
|
174
175
|
withdrawIx: Instruction;
|
|
175
176
|
};
|
|
176
177
|
|
|
177
|
-
export function getRewardPerTimeUnitSecond(reward: RewardInfo) {
|
|
178
|
+
export function getRewardPerTimeUnitSecond(reward: RewardInfo, farmTotalStakeLamports: Decimal) {
|
|
178
179
|
const now = new Decimal(new Date().getTime()).div(1000);
|
|
179
180
|
let rewardPerTimeUnitSecond = new Decimal(0);
|
|
180
181
|
for (let i = 0; i < reward.rewardScheduleCurve.points.length - 1; i++) {
|
|
@@ -196,8 +197,11 @@ export function getRewardPerTimeUnitSecond(reward: RewardInfo) {
|
|
|
196
197
|
const rewardTokenDecimals = reward.token.decimals.toNumber();
|
|
197
198
|
const rewardAmountPerUnitDecimals = new Decimal(10).pow(reward.rewardsPerSecondDecimals.toString());
|
|
198
199
|
const rewardAmountPerUnitLamports = new Decimal(10).pow(rewardTokenDecimals.toString());
|
|
200
|
+
const constantRewardStakeAdjustment =
|
|
201
|
+
reward.rewardType === RewardType.Constant.discriminator ? farmTotalStakeLamports : new Decimal(1);
|
|
199
202
|
|
|
200
203
|
const rpsAdjusted = new Decimal(rewardPerTimeUnitSecond.toString())
|
|
204
|
+
.mul(constantRewardStakeAdjustment)
|
|
201
205
|
.div(rewardAmountPerUnitDecimals)
|
|
202
206
|
.div(rewardAmountPerUnitLamports);
|
|
203
207
|
|
package/src/classes/manager.ts
CHANGED
|
@@ -1796,6 +1796,11 @@ export const MARKET_UPDATER = new ConfigUpdater(UpdateLendingMarketMode.fromDeco
|
|
|
1796
1796
|
[UpdateLendingMarketMode.UpdateObligationOrderExecutionEnabled.kind]: config.obligationOrderExecutionEnabled,
|
|
1797
1797
|
[UpdateLendingMarketMode.UpdateProposerAuthority.kind]: config.proposerAuthority,
|
|
1798
1798
|
[UpdateLendingMarketMode.UpdatePriceTriggeredLiquidationDisabled.kind]: config.priceTriggeredLiquidationDisabled,
|
|
1799
|
+
[UpdateLendingMarketMode.UpdateMatureReserveDebtLiquidationEnabled.kind]: config.matureReserveDebtLiquidationEnabled,
|
|
1800
|
+
[UpdateLendingMarketMode.UpdateObligationBorrowDebtTermLiquidationEnabled.kind]:
|
|
1801
|
+
config.obligationBorrowDebtTermLiquidationEnabled,
|
|
1802
|
+
[UpdateLendingMarketMode.UpdateBorrowOrderCreationEnabled.kind]: config.borrowOrderCreationEnabled,
|
|
1803
|
+
[UpdateLendingMarketMode.UpdateBorrowOrderExecutionEnabled.kind]: config.borrowOrderExecutionEnabled,
|
|
1799
1804
|
}));
|
|
1800
1805
|
|
|
1801
1806
|
function parseForChangesMarketConfigAndGetIxs(
|
package/src/classes/market.ts
CHANGED
|
@@ -121,6 +121,22 @@ export class KaminoMarket {
|
|
|
121
121
|
);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
/**
|
|
125
|
+
* TESTING ONLY!
|
|
126
|
+
*
|
|
127
|
+
* Used to create mock markets for testing
|
|
128
|
+
*/
|
|
129
|
+
static createMarket(
|
|
130
|
+
rpc: Rpc<KaminoMarketRpcApi>,
|
|
131
|
+
state: LendingMarket,
|
|
132
|
+
marketAddress: Address,
|
|
133
|
+
reserves: Map<Address, KaminoReserve>,
|
|
134
|
+
recentSlotDurationMs: number,
|
|
135
|
+
programId: Address = PROGRAM_ID
|
|
136
|
+
) {
|
|
137
|
+
return new KaminoMarket(rpc, state, marketAddress, reserves, recentSlotDurationMs, programId);
|
|
138
|
+
}
|
|
139
|
+
|
|
124
140
|
/**
|
|
125
141
|
* Load a new market with all of its associated reserves
|
|
126
142
|
* @param rpc
|
|
@@ -275,7 +275,7 @@ export class KaminoObligation {
|
|
|
275
275
|
* Returns obligation orders (including the null ones, i.e. non-active positions in the orders' array).
|
|
276
276
|
*/
|
|
277
277
|
getOrders(): Array<KaminoObligationOrder | null> {
|
|
278
|
-
return this.state.
|
|
278
|
+
return this.state.obligationOrders.map((order) => KaminoObligationOrder.fromState(order));
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
/**
|