@kamino-finance/klend-sdk 7.4.0-beta.5 → 7.4.0-beta.6
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 +18 -18
- package/dist/@codegen/klend/accounts/LendingMarket.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/LendingMarket.js +18 -18
- package/dist/@codegen/klend/accounts/LendingMarket.js.map +1 -1
- package/dist/@codegen/klend/errors/custom.d.ts +73 -1
- package/dist/@codegen/klend/errors/custom.d.ts.map +1 -1
- package/dist/@codegen/klend/errors/custom.js +127 -1
- package/dist/@codegen/klend/errors/custom.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 -2
- package/dist/@codegen/klend/instructions/index.js.map +1 -1
- package/dist/@codegen/klend/instructions/rolloverFixedTermBorrow.d.ts +36 -0
- package/dist/@codegen/klend/instructions/rolloverFixedTermBorrow.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/rolloverFixedTermBorrow.js +62 -0
- package/dist/@codegen/klend/instructions/rolloverFixedTermBorrow.js.map +1 -0
- package/dist/@codegen/klend/instructions/updateObligationConfig.d.ts +30 -0
- package/dist/@codegen/klend/instructions/updateObligationConfig.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/updateObligationConfig.js +70 -0
- package/dist/@codegen/klend/instructions/updateObligationConfig.js.map +1 -0
- package/dist/@codegen/klend/types/BorrowOrder.d.ts +62 -0
- package/dist/@codegen/klend/types/BorrowOrder.d.ts.map +1 -1
- package/dist/@codegen/klend/types/BorrowOrder.js +28 -1
- package/dist/@codegen/klend/types/BorrowOrder.js.map +1 -1
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.d.ts +5 -0
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.d.ts.map +1 -1
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.js +8 -0
- package/dist/@codegen/klend/types/BorrowOrderConfigArgs.js.map +1 -1
- package/dist/@codegen/klend/types/FixedTermBorrowRolloverConfig.d.ts +6 -6
- package/dist/@codegen/klend/types/FixedTermBorrowRolloverConfig.js +2 -2
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.d.ts +14 -14
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.d.ts.map +1 -1
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.js +23 -23
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.js.map +1 -1
- package/dist/@codegen/klend/types/UpdateObligationConfigMode.d.ts +58 -0
- package/dist/@codegen/klend/types/UpdateObligationConfigMode.d.ts.map +1 -0
- package/dist/@codegen/klend/types/UpdateObligationConfigMode.js +156 -0
- package/dist/@codegen/klend/types/UpdateObligationConfigMode.js.map +1 -0
- package/dist/@codegen/klend/types/index.d.ts +16 -2
- package/dist/@codegen/klend/types/index.d.ts.map +1 -1
- package/dist/@codegen/klend/types/index.js +3 -1
- package/dist/@codegen/klend/types/index.js.map +1 -1
- package/dist/classes/action.d.ts +1 -0
- package/dist/classes/action.d.ts.map +1 -1
- package/dist/classes/action.js +44 -1
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/actionTypes.d.ts +1 -0
- package/dist/classes/actionTypes.d.ts.map +1 -1
- package/dist/classes/manager.js +2 -2
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/reserve.d.ts +4 -4
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +9 -4
- package/dist/classes/reserve.js.map +1 -1
- package/dist/idl/klend.json +309 -12
- package/package.json +1 -1
- package/src/@codegen/klend/accounts/LendingMarket.ts +36 -36
- package/src/@codegen/klend/errors/custom.ts +147 -0
- package/src/@codegen/klend/instructions/index.ts +7 -0
- package/src/@codegen/klend/instructions/rolloverFixedTermBorrow.ts +109 -0
- package/src/@codegen/klend/instructions/updateObligationConfig.ts +84 -0
- package/src/@codegen/klend/types/BorrowOrder.ts +69 -1
- package/src/@codegen/klend/types/BorrowOrderConfigArgs.ts +11 -0
- package/src/@codegen/klend/types/FixedTermBorrowRolloverConfig.ts +6 -6
- package/src/@codegen/klend/types/UpdateLendingMarketMode.ts +26 -26
- package/src/@codegen/klend/types/UpdateObligationConfigMode.ts +151 -0
- package/src/@codegen/klend/types/index.ts +28 -4
- package/src/classes/action.ts +76 -1
- package/src/classes/actionTypes.ts +1 -0
- package/src/classes/manager.ts +2 -2
- package/src/classes/reserve.ts +9 -4
- package/src/idl/klend.json +309 -12
|
@@ -786,48 +786,48 @@ export class UpdateMinWithdrawQueuedLiquidityValue {
|
|
|
786
786
|
}
|
|
787
787
|
}
|
|
788
788
|
|
|
789
|
-
export interface
|
|
790
|
-
kind: "
|
|
789
|
+
export interface UpdateFixedTermRolloverWindowDurationSecondsJSON {
|
|
790
|
+
kind: "UpdateFixedTermRolloverWindowDurationSeconds"
|
|
791
791
|
}
|
|
792
792
|
|
|
793
|
-
export class
|
|
793
|
+
export class UpdateFixedTermRolloverWindowDurationSeconds {
|
|
794
794
|
static readonly discriminator = 34
|
|
795
|
-
static readonly kind = "
|
|
795
|
+
static readonly kind = "UpdateFixedTermRolloverWindowDurationSeconds"
|
|
796
796
|
readonly discriminator = 34
|
|
797
|
-
readonly kind = "
|
|
797
|
+
readonly kind = "UpdateFixedTermRolloverWindowDurationSeconds"
|
|
798
798
|
|
|
799
|
-
toJSON():
|
|
799
|
+
toJSON(): UpdateFixedTermRolloverWindowDurationSecondsJSON {
|
|
800
800
|
return {
|
|
801
|
-
kind: "
|
|
801
|
+
kind: "UpdateFixedTermRolloverWindowDurationSeconds",
|
|
802
802
|
}
|
|
803
803
|
}
|
|
804
804
|
|
|
805
805
|
toEncodable() {
|
|
806
806
|
return {
|
|
807
|
-
|
|
807
|
+
UpdateFixedTermRolloverWindowDurationSeconds: {},
|
|
808
808
|
}
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
811
|
|
|
812
|
-
export interface
|
|
813
|
-
kind: "
|
|
812
|
+
export interface UpdateOpenTermRolloverWindowDurationSecondsJSON {
|
|
813
|
+
kind: "UpdateOpenTermRolloverWindowDurationSeconds"
|
|
814
814
|
}
|
|
815
815
|
|
|
816
|
-
export class
|
|
816
|
+
export class UpdateOpenTermRolloverWindowDurationSeconds {
|
|
817
817
|
static readonly discriminator = 35
|
|
818
|
-
static readonly kind = "
|
|
818
|
+
static readonly kind = "UpdateOpenTermRolloverWindowDurationSeconds"
|
|
819
819
|
readonly discriminator = 35
|
|
820
|
-
readonly kind = "
|
|
820
|
+
readonly kind = "UpdateOpenTermRolloverWindowDurationSeconds"
|
|
821
821
|
|
|
822
|
-
toJSON():
|
|
822
|
+
toJSON(): UpdateOpenTermRolloverWindowDurationSecondsJSON {
|
|
823
823
|
return {
|
|
824
|
-
kind: "
|
|
824
|
+
kind: "UpdateOpenTermRolloverWindowDurationSeconds",
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
827
|
|
|
828
828
|
toEncodable() {
|
|
829
829
|
return {
|
|
830
|
-
|
|
830
|
+
UpdateOpenTermRolloverWindowDurationSeconds: {},
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
833
|
}
|
|
@@ -963,11 +963,11 @@ export function fromDecoded(obj: any): types.UpdateLendingMarketModeKind {
|
|
|
963
963
|
if ("UpdateMinWithdrawQueuedLiquidityValue" in obj) {
|
|
964
964
|
return new UpdateMinWithdrawQueuedLiquidityValue()
|
|
965
965
|
}
|
|
966
|
-
if ("
|
|
967
|
-
return new
|
|
966
|
+
if ("UpdateFixedTermRolloverWindowDurationSeconds" in obj) {
|
|
967
|
+
return new UpdateFixedTermRolloverWindowDurationSeconds()
|
|
968
968
|
}
|
|
969
|
-
if ("
|
|
970
|
-
return new
|
|
969
|
+
if ("UpdateOpenTermRolloverWindowDurationSeconds" in obj) {
|
|
970
|
+
return new UpdateOpenTermRolloverWindowDurationSeconds()
|
|
971
971
|
}
|
|
972
972
|
if ("UpdateObligationBorrowRolloverConfigurationEnabled" in obj) {
|
|
973
973
|
return new UpdateObligationBorrowRolloverConfigurationEnabled()
|
|
@@ -1082,11 +1082,11 @@ export function fromJSON(
|
|
|
1082
1082
|
case "UpdateMinWithdrawQueuedLiquidityValue": {
|
|
1083
1083
|
return new UpdateMinWithdrawQueuedLiquidityValue()
|
|
1084
1084
|
}
|
|
1085
|
-
case "
|
|
1086
|
-
return new
|
|
1085
|
+
case "UpdateFixedTermRolloverWindowDurationSeconds": {
|
|
1086
|
+
return new UpdateFixedTermRolloverWindowDurationSeconds()
|
|
1087
1087
|
}
|
|
1088
|
-
case "
|
|
1089
|
-
return new
|
|
1088
|
+
case "UpdateOpenTermRolloverWindowDurationSeconds": {
|
|
1089
|
+
return new UpdateOpenTermRolloverWindowDurationSeconds()
|
|
1090
1090
|
}
|
|
1091
1091
|
case "UpdateObligationBorrowRolloverConfigurationEnabled": {
|
|
1092
1092
|
return new UpdateObligationBorrowRolloverConfigurationEnabled()
|
|
@@ -1130,8 +1130,8 @@ export function layout(property?: string) {
|
|
|
1130
1130
|
borsh.struct([], "UpdateWithdrawTicketIssuanceEnabled"),
|
|
1131
1131
|
borsh.struct([], "UpdateWithdrawTicketRedemptionEnabled"),
|
|
1132
1132
|
borsh.struct([], "UpdateMinWithdrawQueuedLiquidityValue"),
|
|
1133
|
-
borsh.struct([], "
|
|
1134
|
-
borsh.struct([], "
|
|
1133
|
+
borsh.struct([], "UpdateFixedTermRolloverWindowDurationSeconds"),
|
|
1134
|
+
borsh.struct([], "UpdateOpenTermRolloverWindowDurationSeconds"),
|
|
1135
1135
|
borsh.struct([], "UpdateObligationBorrowRolloverConfigurationEnabled"),
|
|
1136
1136
|
])
|
|
1137
1137
|
if (property !== undefined) {
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { address, Address } from "@solana/kit" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
|
5
|
+
import { borshAddress } from "../utils"
|
|
6
|
+
|
|
7
|
+
export interface FixedTermRolloverEnabledJSON {
|
|
8
|
+
kind: "FixedTermRolloverEnabled"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class FixedTermRolloverEnabled {
|
|
12
|
+
static readonly discriminator = 0
|
|
13
|
+
static readonly kind = "FixedTermRolloverEnabled"
|
|
14
|
+
readonly discriminator = 0
|
|
15
|
+
readonly kind = "FixedTermRolloverEnabled"
|
|
16
|
+
|
|
17
|
+
toJSON(): FixedTermRolloverEnabledJSON {
|
|
18
|
+
return {
|
|
19
|
+
kind: "FixedTermRolloverEnabled",
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
toEncodable() {
|
|
24
|
+
return {
|
|
25
|
+
FixedTermRolloverEnabled: {},
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface FixedTermRolloverMaxBorrowRateBpsJSON {
|
|
31
|
+
kind: "FixedTermRolloverMaxBorrowRateBps"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class FixedTermRolloverMaxBorrowRateBps {
|
|
35
|
+
static readonly discriminator = 1
|
|
36
|
+
static readonly kind = "FixedTermRolloverMaxBorrowRateBps"
|
|
37
|
+
readonly discriminator = 1
|
|
38
|
+
readonly kind = "FixedTermRolloverMaxBorrowRateBps"
|
|
39
|
+
|
|
40
|
+
toJSON(): FixedTermRolloverMaxBorrowRateBpsJSON {
|
|
41
|
+
return {
|
|
42
|
+
kind: "FixedTermRolloverMaxBorrowRateBps",
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
toEncodable() {
|
|
47
|
+
return {
|
|
48
|
+
FixedTermRolloverMaxBorrowRateBps: {},
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface FixedTermRolloverMinDebtTermSecondsJSON {
|
|
54
|
+
kind: "FixedTermRolloverMinDebtTermSeconds"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export class FixedTermRolloverMinDebtTermSeconds {
|
|
58
|
+
static readonly discriminator = 2
|
|
59
|
+
static readonly kind = "FixedTermRolloverMinDebtTermSeconds"
|
|
60
|
+
readonly discriminator = 2
|
|
61
|
+
readonly kind = "FixedTermRolloverMinDebtTermSeconds"
|
|
62
|
+
|
|
63
|
+
toJSON(): FixedTermRolloverMinDebtTermSecondsJSON {
|
|
64
|
+
return {
|
|
65
|
+
kind: "FixedTermRolloverMinDebtTermSeconds",
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
toEncodable() {
|
|
70
|
+
return {
|
|
71
|
+
FixedTermRolloverMinDebtTermSeconds: {},
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface FixedTermRolloverOpenTermAllowedJSON {
|
|
77
|
+
kind: "FixedTermRolloverOpenTermAllowed"
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export class FixedTermRolloverOpenTermAllowed {
|
|
81
|
+
static readonly discriminator = 3
|
|
82
|
+
static readonly kind = "FixedTermRolloverOpenTermAllowed"
|
|
83
|
+
readonly discriminator = 3
|
|
84
|
+
readonly kind = "FixedTermRolloverOpenTermAllowed"
|
|
85
|
+
|
|
86
|
+
toJSON(): FixedTermRolloverOpenTermAllowedJSON {
|
|
87
|
+
return {
|
|
88
|
+
kind: "FixedTermRolloverOpenTermAllowed",
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
toEncodable() {
|
|
93
|
+
return {
|
|
94
|
+
FixedTermRolloverOpenTermAllowed: {},
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
|
+
export function fromDecoded(obj: any): types.UpdateObligationConfigModeKind {
|
|
101
|
+
if (typeof obj !== "object") {
|
|
102
|
+
throw new Error("Invalid enum object")
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if ("FixedTermRolloverEnabled" in obj) {
|
|
106
|
+
return new FixedTermRolloverEnabled()
|
|
107
|
+
}
|
|
108
|
+
if ("FixedTermRolloverMaxBorrowRateBps" in obj) {
|
|
109
|
+
return new FixedTermRolloverMaxBorrowRateBps()
|
|
110
|
+
}
|
|
111
|
+
if ("FixedTermRolloverMinDebtTermSeconds" in obj) {
|
|
112
|
+
return new FixedTermRolloverMinDebtTermSeconds()
|
|
113
|
+
}
|
|
114
|
+
if ("FixedTermRolloverOpenTermAllowed" in obj) {
|
|
115
|
+
return new FixedTermRolloverOpenTermAllowed()
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
throw new Error("Invalid enum object")
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function fromJSON(
|
|
122
|
+
obj: types.UpdateObligationConfigModeJSON
|
|
123
|
+
): types.UpdateObligationConfigModeKind {
|
|
124
|
+
switch (obj.kind) {
|
|
125
|
+
case "FixedTermRolloverEnabled": {
|
|
126
|
+
return new FixedTermRolloverEnabled()
|
|
127
|
+
}
|
|
128
|
+
case "FixedTermRolloverMaxBorrowRateBps": {
|
|
129
|
+
return new FixedTermRolloverMaxBorrowRateBps()
|
|
130
|
+
}
|
|
131
|
+
case "FixedTermRolloverMinDebtTermSeconds": {
|
|
132
|
+
return new FixedTermRolloverMinDebtTermSeconds()
|
|
133
|
+
}
|
|
134
|
+
case "FixedTermRolloverOpenTermAllowed": {
|
|
135
|
+
return new FixedTermRolloverOpenTermAllowed()
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function layout(property?: string) {
|
|
141
|
+
const ret = borsh.rustEnum([
|
|
142
|
+
borsh.struct([], "FixedTermRolloverEnabled"),
|
|
143
|
+
borsh.struct([], "FixedTermRolloverMaxBorrowRateBps"),
|
|
144
|
+
borsh.struct([], "FixedTermRolloverMinDebtTermSeconds"),
|
|
145
|
+
borsh.struct([], "FixedTermRolloverOpenTermAllowed"),
|
|
146
|
+
])
|
|
147
|
+
if (property !== undefined) {
|
|
148
|
+
return ret.replicate(property)
|
|
149
|
+
}
|
|
150
|
+
return ret
|
|
151
|
+
}
|
|
@@ -2,6 +2,7 @@ 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 UpdateObligationConfigMode from "./UpdateObligationConfigMode"
|
|
5
6
|
import * as FeeCalculation from "./FeeCalculation"
|
|
6
7
|
import * as ReserveFarmKind from "./ReserveFarmKind"
|
|
7
8
|
import * as ReserveStatus from "./ReserveStatus"
|
|
@@ -187,8 +188,8 @@ export type UpdateLendingMarketModeKind =
|
|
|
187
188
|
| UpdateLendingMarketMode.UpdateWithdrawTicketIssuanceEnabled
|
|
188
189
|
| UpdateLendingMarketMode.UpdateWithdrawTicketRedemptionEnabled
|
|
189
190
|
| UpdateLendingMarketMode.UpdateMinWithdrawQueuedLiquidityValue
|
|
190
|
-
| UpdateLendingMarketMode.
|
|
191
|
-
| UpdateLendingMarketMode.
|
|
191
|
+
| UpdateLendingMarketMode.UpdateFixedTermRolloverWindowDurationSeconds
|
|
192
|
+
| UpdateLendingMarketMode.UpdateOpenTermRolloverWindowDurationSeconds
|
|
192
193
|
| UpdateLendingMarketMode.UpdateObligationBorrowRolloverConfigurationEnabled
|
|
193
194
|
export type UpdateLendingMarketModeJSON =
|
|
194
195
|
| UpdateLendingMarketMode.UpdateOwnerJSON
|
|
@@ -225,8 +226,8 @@ export type UpdateLendingMarketModeJSON =
|
|
|
225
226
|
| UpdateLendingMarketMode.UpdateWithdrawTicketIssuanceEnabledJSON
|
|
226
227
|
| UpdateLendingMarketMode.UpdateWithdrawTicketRedemptionEnabledJSON
|
|
227
228
|
| UpdateLendingMarketMode.UpdateMinWithdrawQueuedLiquidityValueJSON
|
|
228
|
-
| UpdateLendingMarketMode.
|
|
229
|
-
| UpdateLendingMarketMode.
|
|
229
|
+
| UpdateLendingMarketMode.UpdateFixedTermRolloverWindowDurationSecondsJSON
|
|
230
|
+
| UpdateLendingMarketMode.UpdateOpenTermRolloverWindowDurationSecondsJSON
|
|
230
231
|
| UpdateLendingMarketMode.UpdateObligationBorrowRolloverConfigurationEnabledJSON
|
|
231
232
|
|
|
232
233
|
export { UpdateGlobalConfigMode }
|
|
@@ -269,6 +270,29 @@ export type {
|
|
|
269
270
|
ObligationOrderFields,
|
|
270
271
|
ObligationOrderJSON,
|
|
271
272
|
} from "./ObligationOrder"
|
|
273
|
+
export { UpdateObligationConfigMode }
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* A discriminator of a user-configurable piece of [Obligation].
|
|
277
|
+
*
|
|
278
|
+
* Implementation note: due to TS-side codegen quirks (and a "convention" currently seen e.g.
|
|
279
|
+
* within reserve and market update operations), this is not a true Rust enum. The new value of
|
|
280
|
+
* a config item is provided in a separate handler argument (borsh-serialized), and its expected
|
|
281
|
+
* type is defined by each discriminator here. Additionally, each update mode acts on a specific
|
|
282
|
+
* [ObligationConfigUpdateSubject] (e.g. the auto-rollover of fixed-term borrows is configured on
|
|
283
|
+
* a per-borrow basis), which is also specified by separate handler arguments.
|
|
284
|
+
*/
|
|
285
|
+
export type UpdateObligationConfigModeKind =
|
|
286
|
+
| UpdateObligationConfigMode.FixedTermRolloverEnabled
|
|
287
|
+
| UpdateObligationConfigMode.FixedTermRolloverMaxBorrowRateBps
|
|
288
|
+
| UpdateObligationConfigMode.FixedTermRolloverMinDebtTermSeconds
|
|
289
|
+
| UpdateObligationConfigMode.FixedTermRolloverOpenTermAllowed
|
|
290
|
+
export type UpdateObligationConfigModeJSON =
|
|
291
|
+
| UpdateObligationConfigMode.FixedTermRolloverEnabledJSON
|
|
292
|
+
| UpdateObligationConfigMode.FixedTermRolloverMaxBorrowRateBpsJSON
|
|
293
|
+
| UpdateObligationConfigMode.FixedTermRolloverMinDebtTermSecondsJSON
|
|
294
|
+
| UpdateObligationConfigMode.FixedTermRolloverOpenTermAllowedJSON
|
|
295
|
+
|
|
272
296
|
export { BigFractionBytes } from "./BigFractionBytes"
|
|
273
297
|
export type {
|
|
274
298
|
BigFractionBytesFields,
|
package/src/classes/action.ts
CHANGED
|
@@ -45,8 +45,11 @@ import {
|
|
|
45
45
|
RequestElevationGroupAccounts,
|
|
46
46
|
RequestElevationGroupArgs,
|
|
47
47
|
setObligationOrder,
|
|
48
|
+
updateObligationConfig,
|
|
49
|
+
type UpdateObligationConfigAccounts,
|
|
48
50
|
withdrawObligationCollateralAndRedeemReserveCollateral,
|
|
49
51
|
withdrawObligationCollateralAndRedeemReserveCollateralV2,
|
|
52
|
+
withdrawObligationCollateralV2,
|
|
50
53
|
withdrawQueuedLiquidity,
|
|
51
54
|
withdrawReferrerFees,
|
|
52
55
|
} from '../@codegen/klend/instructions';
|
|
@@ -69,10 +72,11 @@ import {
|
|
|
69
72
|
withdrawTicketPda,
|
|
70
73
|
WRAPPED_SOL_MINT,
|
|
71
74
|
} from '../utils';
|
|
75
|
+
import { FixedRateReserveKind } from '../utils/ReserveKind';
|
|
72
76
|
import { getTokenIdsForScopeRefresh, KaminoMarket } from './market';
|
|
73
77
|
import { isKaminoObligation, KaminoObligation } from './obligation';
|
|
74
78
|
import { KaminoReserve } from './reserve';
|
|
75
|
-
import { ProgressCallbackType, ReserveFarmKind } from '../@codegen/klend/types';
|
|
79
|
+
import { ProgressCallbackType, ReserveFarmKind, UpdateObligationConfigMode } from '../@codegen/klend/types';
|
|
76
80
|
import { PROGRAM_ID as FARMS_PROGRAM_ID } from '@kamino-finance/farms-sdk/dist/@codegen/farms/programId';
|
|
77
81
|
import { Reserve } from '../@codegen/klend/accounts';
|
|
78
82
|
import { VanillaObligation } from '../utils/ObligationType';
|
|
@@ -466,6 +470,7 @@ export class KaminoAction {
|
|
|
466
470
|
referrer = none(),
|
|
467
471
|
currentSlot = 0n,
|
|
468
472
|
overrideElevationGroupRequest,
|
|
473
|
+
rollOver = false,
|
|
469
474
|
} = props;
|
|
470
475
|
|
|
471
476
|
const axn = await KaminoAction.initialize({
|
|
@@ -511,6 +516,9 @@ export class KaminoAction {
|
|
|
511
516
|
} else {
|
|
512
517
|
await axn.addBorrowIx();
|
|
513
518
|
}
|
|
519
|
+
if (rollOver && axn.reserve.getKind().isFixedRate()) {
|
|
520
|
+
await axn.addBorrowRolloverConfigIxs();
|
|
521
|
+
}
|
|
514
522
|
axn.addRefreshFarmsCleanupTxnIxsToCleanupIxs();
|
|
515
523
|
|
|
516
524
|
return axn;
|
|
@@ -1560,6 +1568,73 @@ export class KaminoAction {
|
|
|
1560
1568
|
this.lendingIxs.push(borrowIx);
|
|
1561
1569
|
}
|
|
1562
1570
|
|
|
1571
|
+
private async addBorrowRolloverConfigIxs(): Promise<void> {
|
|
1572
|
+
const reserveKind = this.reserve.getKind() as FixedRateReserveKind;
|
|
1573
|
+
const borrowRateBps = reserveKind.borrowRateBps;
|
|
1574
|
+
const maxBorrowRateBpsBytes = Buffer.alloc(4);
|
|
1575
|
+
maxBorrowRateBpsBytes.writeUInt32LE(borrowRateBps, 0);
|
|
1576
|
+
|
|
1577
|
+
const minDebtTermSecondsBytes = Buffer.alloc(8);
|
|
1578
|
+
minDebtTermSecondsBytes.writeBigUInt64LE(BigInt(reserveKind.debtTermSeconds.toString()), 0);
|
|
1579
|
+
|
|
1580
|
+
const obligation = await this.getObligationPda();
|
|
1581
|
+
const accounts: UpdateObligationConfigAccounts = {
|
|
1582
|
+
owner: this.owner,
|
|
1583
|
+
obligation,
|
|
1584
|
+
borrowReserve: some(this.reserve.address),
|
|
1585
|
+
depositReserve: none<Address>(),
|
|
1586
|
+
lendingMarket: this.kaminoMarket.getAddress(),
|
|
1587
|
+
};
|
|
1588
|
+
|
|
1589
|
+
const updateRolloverIx = updateObligationConfig(
|
|
1590
|
+
{
|
|
1591
|
+
mode: new UpdateObligationConfigMode.FixedTermRolloverEnabled(),
|
|
1592
|
+
value: Uint8Array.from([1]),
|
|
1593
|
+
},
|
|
1594
|
+
accounts,
|
|
1595
|
+
undefined,
|
|
1596
|
+
this.kaminoMarket.programId
|
|
1597
|
+
);
|
|
1598
|
+
this.lendingIxs.push(updateRolloverIx);
|
|
1599
|
+
this.lendingIxsLabels.push('updateObligationConfig[FixedTermRolloverEnabled]');
|
|
1600
|
+
|
|
1601
|
+
const updateMaxBorrowRateIx = updateObligationConfig(
|
|
1602
|
+
{
|
|
1603
|
+
mode: new UpdateObligationConfigMode.FixedTermRolloverMaxBorrowRateBps(),
|
|
1604
|
+
value: maxBorrowRateBpsBytes,
|
|
1605
|
+
},
|
|
1606
|
+
accounts,
|
|
1607
|
+
undefined,
|
|
1608
|
+
this.kaminoMarket.programId
|
|
1609
|
+
);
|
|
1610
|
+
this.lendingIxs.push(updateMaxBorrowRateIx);
|
|
1611
|
+
this.lendingIxsLabels.push('updateObligationConfig[FixedTermRolloverMaxBorrowRateBps]');
|
|
1612
|
+
|
|
1613
|
+
const updateMinDebtTermIx = updateObligationConfig(
|
|
1614
|
+
{
|
|
1615
|
+
mode: new UpdateObligationConfigMode.FixedTermRolloverMinDebtTermSeconds(),
|
|
1616
|
+
value: minDebtTermSecondsBytes,
|
|
1617
|
+
},
|
|
1618
|
+
accounts,
|
|
1619
|
+
undefined,
|
|
1620
|
+
this.kaminoMarket.programId
|
|
1621
|
+
);
|
|
1622
|
+
this.lendingIxs.push(updateMinDebtTermIx);
|
|
1623
|
+
this.lendingIxsLabels.push('updateObligationConfig[FixedTermRolloverMinDebtTermSeconds]');
|
|
1624
|
+
|
|
1625
|
+
const updateOpenTermAllowedIx = updateObligationConfig(
|
|
1626
|
+
{
|
|
1627
|
+
mode: new UpdateObligationConfigMode.FixedTermRolloverOpenTermAllowed(),
|
|
1628
|
+
value: Uint8Array.from([1]),
|
|
1629
|
+
},
|
|
1630
|
+
accounts,
|
|
1631
|
+
undefined,
|
|
1632
|
+
this.kaminoMarket.programId
|
|
1633
|
+
);
|
|
1634
|
+
this.lendingIxs.push(updateOpenTermAllowedIx);
|
|
1635
|
+
this.lendingIxsLabels.push('updateObligationConfig[FixedTermRolloverOpenTermAllowed]');
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1563
1638
|
/// @deprecated -- use addWithdrawIxV2 instead
|
|
1564
1639
|
async addWithdrawIx(collateralAmount: BN) {
|
|
1565
1640
|
this.lendingIxsLabels.push(`withdrawObligationCollateralAndRedeemReserveCollateral`);
|
package/src/classes/manager.ts
CHANGED
|
@@ -1790,8 +1790,8 @@ export const MARKET_UPDATER = new ConfigUpdater(UpdateLendingMarketMode.fromDeco
|
|
|
1790
1790
|
[UpdateLendingMarketMode.UpdateWithdrawTicketIssuanceEnabled.kind]: config.withdrawTicketIssuanceEnabled,
|
|
1791
1791
|
[UpdateLendingMarketMode.UpdateWithdrawTicketRedemptionEnabled.kind]: config.withdrawTicketRedemptionEnabled,
|
|
1792
1792
|
[UpdateLendingMarketMode.UpdateMinWithdrawQueuedLiquidityValue.kind]: config.minWithdrawQueuedLiquidityValue,
|
|
1793
|
-
[UpdateLendingMarketMode.
|
|
1794
|
-
[UpdateLendingMarketMode.
|
|
1793
|
+
[UpdateLendingMarketMode.UpdateFixedTermRolloverWindowDurationSeconds.kind]: config.fixedTermRolloverWindowDurationSeconds,
|
|
1794
|
+
[UpdateLendingMarketMode.UpdateOpenTermRolloverWindowDurationSeconds.kind]: config.openTermRolloverWindowDurationSeconds,
|
|
1795
1795
|
[UpdateLendingMarketMode.UpdateObligationBorrowRolloverConfigurationEnabled.kind]: config.obligationBorrowRolloverConfigurationEnabled,
|
|
1796
1796
|
}));
|
|
1797
1797
|
|
package/src/classes/reserve.ts
CHANGED
|
@@ -1191,13 +1191,13 @@ export class KaminoReserve {
|
|
|
1191
1191
|
}
|
|
1192
1192
|
|
|
1193
1193
|
/**
|
|
1194
|
-
*
|
|
1194
|
+
* Fetches all withdraw tickets for this reserve owned by the given user.
|
|
1195
1195
|
*
|
|
1196
1196
|
* @param userWallet - The user's wallet address
|
|
1197
1197
|
* @param programId - The lending program ID (defaults to PROGRAM_ID)
|
|
1198
|
-
* @returns
|
|
1198
|
+
* @returns Array of withdraw tickets for the user on this reserve
|
|
1199
1199
|
*/
|
|
1200
|
-
async
|
|
1200
|
+
async getWithdrawTicketsForUser(userWallet: Address, programId: Address = PROGRAM_ID): Promise<WithdrawTicket[]> {
|
|
1201
1201
|
const tickets = await this.rpc
|
|
1202
1202
|
.getProgramAccounts(programId, {
|
|
1203
1203
|
filters: [
|
|
@@ -1223,7 +1223,12 @@ export class KaminoReserve {
|
|
|
1223
1223
|
})
|
|
1224
1224
|
.send();
|
|
1225
1225
|
|
|
1226
|
-
return tickets.
|
|
1226
|
+
return tickets.map((ticket) => {
|
|
1227
|
+
if (ticket.account === null) {
|
|
1228
|
+
throw new Error(`WithdrawTicket account ${ticket.pubkey} does not exist`);
|
|
1229
|
+
}
|
|
1230
|
+
return WithdrawTicket.decode(Buffer.from(ticket.account.data[0], 'base64'));
|
|
1231
|
+
});
|
|
1227
1232
|
}
|
|
1228
1233
|
}
|
|
1229
1234
|
|