@kamino-finance/klend-sdk 7.4.0-beta.2 → 7.4.0-beta.3
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 +150 -3
- package/dist/@codegen/klend/accounts/LendingMarket.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/LendingMarket.js +91 -2
- package/dist/@codegen/klend/accounts/LendingMarket.js.map +1 -1
- package/dist/@codegen/klend/accounts/Reserve.d.ts +6 -0
- package/dist/@codegen/klend/accounts/Reserve.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/Reserve.js +8 -1
- package/dist/@codegen/klend/accounts/Reserve.js.map +1 -1
- package/dist/@codegen/klend/accounts/WithdrawTicket.d.ts +144 -0
- package/dist/@codegen/klend/accounts/WithdrawTicket.d.ts.map +1 -0
- package/dist/@codegen/klend/accounts/WithdrawTicket.js +205 -0
- package/dist/@codegen/klend/accounts/WithdrawTicket.js.map +1 -0
- package/dist/@codegen/klend/accounts/index.d.ts +2 -0
- package/dist/@codegen/klend/accounts/index.d.ts.map +1 -1
- package/dist/@codegen/klend/accounts/index.js +3 -1
- package/dist/@codegen/klend/accounts/index.js.map +1 -1
- package/dist/@codegen/klend/errors/custom.d.ts +81 -1
- package/dist/@codegen/klend/errors/custom.d.ts.map +1 -1
- package/dist/@codegen/klend/errors/custom.js +142 -1
- package/dist/@codegen/klend/errors/custom.js.map +1 -1
- package/dist/@codegen/klend/instructions/enqueueToWithdraw.d.ts +62 -0
- package/dist/@codegen/klend/instructions/enqueueToWithdraw.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/enqueueToWithdraw.js +79 -0
- package/dist/@codegen/klend/instructions/enqueueToWithdraw.js.map +1 -0
- package/dist/@codegen/klend/instructions/index.d.ts +6 -0
- package/dist/@codegen/klend/instructions/index.d.ts.map +1 -1
- package/dist/@codegen/klend/instructions/index.js +8 -2
- package/dist/@codegen/klend/instructions/index.js.map +1 -1
- package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.d.ts +54 -0
- package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.js +66 -0
- package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.js.map +1 -0
- package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.d.ts +66 -0
- package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.d.ts.map +1 -0
- package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.js +41 -0
- package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.js.map +1 -0
- package/dist/@codegen/klend/types/BorrowOrder.d.ts +3 -3
- package/dist/@codegen/klend/types/BorrowOrder.js +1 -1
- package/dist/@codegen/klend/types/FixedTermBorrowRolloverConfig.d.ts +145 -0
- package/dist/@codegen/klend/types/FixedTermBorrowRolloverConfig.d.ts.map +1 -0
- package/dist/@codegen/klend/types/FixedTermBorrowRolloverConfig.js +144 -0
- package/dist/@codegen/klend/types/FixedTermBorrowRolloverConfig.js.map +1 -0
- package/dist/@codegen/klend/types/ObligationLiquidity.d.ts +29 -0
- package/dist/@codegen/klend/types/ObligationLiquidity.d.ts.map +1 -1
- package/dist/@codegen/klend/types/ObligationLiquidity.js +15 -1
- package/dist/@codegen/klend/types/ObligationLiquidity.js.map +1 -1
- package/dist/@codegen/klend/types/ProgressCallbackType.d.ts +32 -0
- package/dist/@codegen/klend/types/ProgressCallbackType.d.ts.map +1 -0
- package/dist/@codegen/klend/types/ProgressCallbackType.js +108 -0
- package/dist/@codegen/klend/types/ProgressCallbackType.js.map +1 -0
- package/dist/@codegen/klend/types/ReserveLiquidity.d.ts +26 -8
- package/dist/@codegen/klend/types/ReserveLiquidity.d.ts.map +1 -1
- package/dist/@codegen/klend/types/ReserveLiquidity.js +14 -8
- package/dist/@codegen/klend/types/ReserveLiquidity.js.map +1 -1
- package/dist/@codegen/klend/types/UpdateConfigMode.d.ts +7 -7
- package/dist/@codegen/klend/types/UpdateConfigMode.d.ts.map +1 -1
- package/dist/@codegen/klend/types/UpdateConfigMode.js +12 -12
- package/dist/@codegen/klend/types/UpdateConfigMode.js.map +1 -1
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.d.ts +78 -0
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.d.ts.map +1 -1
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.js +145 -1
- package/dist/@codegen/klend/types/UpdateLendingMarketMode.js.map +1 -1
- package/dist/@codegen/klend/types/WithdrawQueue.d.ts +64 -0
- package/dist/@codegen/klend/types/WithdrawQueue.d.ts.map +1 -0
- package/dist/@codegen/klend/types/WithdrawQueue.js +104 -0
- package/dist/@codegen/klend/types/WithdrawQueue.js.map +1 -0
- package/dist/@codegen/klend/types/index.d.ts +23 -4
- package/dist/@codegen/klend/types/index.d.ts.map +1 -1
- package/dist/@codegen/klend/types/index.js +7 -1
- package/dist/@codegen/klend/types/index.js.map +1 -1
- package/dist/classes/action.d.ts +11 -0
- package/dist/classes/action.d.ts.map +1 -1
- package/dist/classes/action.js +66 -0
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/actionTypes.d.ts +29 -0
- package/dist/classes/actionTypes.d.ts.map +1 -1
- package/dist/classes/manager.d.ts +1 -1
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +9 -8
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/market.d.ts +7 -102
- package/dist/classes/market.d.ts.map +1 -1
- package/dist/classes/market.js +8 -153
- package/dist/classes/market.js.map +1 -1
- package/dist/classes/reserve.d.ts +3 -10
- package/dist/classes/reserve.d.ts.map +1 -1
- package/dist/classes/reserve.js +45 -51
- package/dist/classes/reserve.js.map +1 -1
- package/dist/idl/klend.json +860 -32
- package/dist/manager/client_kamino_manager.js +2 -3
- package/dist/manager/client_kamino_manager.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/seeds.d.ts +24 -0
- package/dist/utils/seeds.d.ts.map +1 -1
- package/dist/utils/seeds.js +41 -1
- package/dist/utils/seeds.js.map +1 -1
- package/package.json +1 -1
- package/src/@codegen/klend/accounts/LendingMarket.ts +205 -4
- package/src/@codegen/klend/accounts/Reserve.ts +12 -1
- package/src/@codegen/klend/accounts/WithdrawTicket.ts +280 -0
- package/src/@codegen/klend/accounts/index.ts +2 -0
- package/src/@codegen/klend/errors/custom.ts +161 -0
- package/src/@codegen/klend/instructions/enqueueToWithdraw.ts +120 -0
- package/src/@codegen/klend/instructions/index.ts +12 -0
- package/src/@codegen/klend/instructions/recoverInvalidTicketCollateral.ts +103 -0
- package/src/@codegen/klend/instructions/withdrawQueuedLiquidity.ts +118 -0
- package/src/@codegen/klend/types/BorrowOrder.ts +3 -3
- package/src/@codegen/klend/types/FixedTermBorrowRolloverConfig.ts +199 -0
- package/src/@codegen/klend/types/ObligationLiquidity.ts +37 -1
- package/src/@codegen/klend/types/ProgressCallbackType.ts +91 -0
- package/src/@codegen/klend/types/ReserveLiquidity.ts +30 -12
- package/src/@codegen/klend/types/UpdateConfigMode.ts +13 -13
- package/src/@codegen/klend/types/UpdateLendingMarketMode.ts +180 -0
- package/src/@codegen/klend/types/WithdrawQueue.ts +117 -0
- package/src/@codegen/klend/types/index.ts +42 -2
- package/src/classes/action.ts +115 -1
- package/src/classes/actionTypes.ts +31 -0
- package/src/classes/manager.ts +19 -27
- package/src/classes/market.ts +8 -183
- package/src/classes/reserve.ts +45 -68
- package/src/idl/klend.json +860 -32
- package/src/manager/client_kamino_manager.ts +2 -4
- package/src/utils/index.ts +0 -1
- package/src/utils/seeds.ts +49 -0
- package/dist/utils/ReserveKind.d.ts +0 -57
- package/dist/utils/ReserveKind.d.ts.map +0 -1
- package/dist/utils/ReserveKind.js +0 -76
- package/dist/utils/ReserveKind.js.map +0 -1
- package/src/utils/ReserveKind.ts +0 -94
|
@@ -717,6 +717,144 @@ export class UpdateBorrowOrderExecutionEnabled {
|
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
719
|
|
|
720
|
+
export interface UpdateWithdrawTicketIssuanceEnabledJSON {
|
|
721
|
+
kind: "UpdateWithdrawTicketIssuanceEnabled"
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
export class UpdateWithdrawTicketIssuanceEnabled {
|
|
725
|
+
static readonly discriminator = 31
|
|
726
|
+
static readonly kind = "UpdateWithdrawTicketIssuanceEnabled"
|
|
727
|
+
readonly discriminator = 31
|
|
728
|
+
readonly kind = "UpdateWithdrawTicketIssuanceEnabled"
|
|
729
|
+
|
|
730
|
+
toJSON(): UpdateWithdrawTicketIssuanceEnabledJSON {
|
|
731
|
+
return {
|
|
732
|
+
kind: "UpdateWithdrawTicketIssuanceEnabled",
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
toEncodable() {
|
|
737
|
+
return {
|
|
738
|
+
UpdateWithdrawTicketIssuanceEnabled: {},
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
export interface UpdateWithdrawTicketRedemptionEnabledJSON {
|
|
744
|
+
kind: "UpdateWithdrawTicketRedemptionEnabled"
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
export class UpdateWithdrawTicketRedemptionEnabled {
|
|
748
|
+
static readonly discriminator = 32
|
|
749
|
+
static readonly kind = "UpdateWithdrawTicketRedemptionEnabled"
|
|
750
|
+
readonly discriminator = 32
|
|
751
|
+
readonly kind = "UpdateWithdrawTicketRedemptionEnabled"
|
|
752
|
+
|
|
753
|
+
toJSON(): UpdateWithdrawTicketRedemptionEnabledJSON {
|
|
754
|
+
return {
|
|
755
|
+
kind: "UpdateWithdrawTicketRedemptionEnabled",
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
toEncodable() {
|
|
760
|
+
return {
|
|
761
|
+
UpdateWithdrawTicketRedemptionEnabled: {},
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
export interface UpdateMinWithdrawQueuedLiquidityValueJSON {
|
|
767
|
+
kind: "UpdateMinWithdrawQueuedLiquidityValue"
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
export class UpdateMinWithdrawQueuedLiquidityValue {
|
|
771
|
+
static readonly discriminator = 33
|
|
772
|
+
static readonly kind = "UpdateMinWithdrawQueuedLiquidityValue"
|
|
773
|
+
readonly discriminator = 33
|
|
774
|
+
readonly kind = "UpdateMinWithdrawQueuedLiquidityValue"
|
|
775
|
+
|
|
776
|
+
toJSON(): UpdateMinWithdrawQueuedLiquidityValueJSON {
|
|
777
|
+
return {
|
|
778
|
+
kind: "UpdateMinWithdrawQueuedLiquidityValue",
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
toEncodable() {
|
|
783
|
+
return {
|
|
784
|
+
UpdateMinWithdrawQueuedLiquidityValue: {},
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
export interface UpdateFixedRolloverWindowDurationSecondsJSON {
|
|
790
|
+
kind: "UpdateFixedRolloverWindowDurationSeconds"
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
export class UpdateFixedRolloverWindowDurationSeconds {
|
|
794
|
+
static readonly discriminator = 34
|
|
795
|
+
static readonly kind = "UpdateFixedRolloverWindowDurationSeconds"
|
|
796
|
+
readonly discriminator = 34
|
|
797
|
+
readonly kind = "UpdateFixedRolloverWindowDurationSeconds"
|
|
798
|
+
|
|
799
|
+
toJSON(): UpdateFixedRolloverWindowDurationSecondsJSON {
|
|
800
|
+
return {
|
|
801
|
+
kind: "UpdateFixedRolloverWindowDurationSeconds",
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
toEncodable() {
|
|
806
|
+
return {
|
|
807
|
+
UpdateFixedRolloverWindowDurationSeconds: {},
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
export interface UpdateVariableRolloverWindowDurationSecondsJSON {
|
|
813
|
+
kind: "UpdateVariableRolloverWindowDurationSeconds"
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
export class UpdateVariableRolloverWindowDurationSeconds {
|
|
817
|
+
static readonly discriminator = 35
|
|
818
|
+
static readonly kind = "UpdateVariableRolloverWindowDurationSeconds"
|
|
819
|
+
readonly discriminator = 35
|
|
820
|
+
readonly kind = "UpdateVariableRolloverWindowDurationSeconds"
|
|
821
|
+
|
|
822
|
+
toJSON(): UpdateVariableRolloverWindowDurationSecondsJSON {
|
|
823
|
+
return {
|
|
824
|
+
kind: "UpdateVariableRolloverWindowDurationSeconds",
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
toEncodable() {
|
|
829
|
+
return {
|
|
830
|
+
UpdateVariableRolloverWindowDurationSeconds: {},
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
export interface UpdateObligationBorrowRolloverConfigurationEnabledJSON {
|
|
836
|
+
kind: "UpdateObligationBorrowRolloverConfigurationEnabled"
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
export class UpdateObligationBorrowRolloverConfigurationEnabled {
|
|
840
|
+
static readonly discriminator = 36
|
|
841
|
+
static readonly kind = "UpdateObligationBorrowRolloverConfigurationEnabled"
|
|
842
|
+
readonly discriminator = 36
|
|
843
|
+
readonly kind = "UpdateObligationBorrowRolloverConfigurationEnabled"
|
|
844
|
+
|
|
845
|
+
toJSON(): UpdateObligationBorrowRolloverConfigurationEnabledJSON {
|
|
846
|
+
return {
|
|
847
|
+
kind: "UpdateObligationBorrowRolloverConfigurationEnabled",
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
toEncodable() {
|
|
852
|
+
return {
|
|
853
|
+
UpdateObligationBorrowRolloverConfigurationEnabled: {},
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
|
|
720
858
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
721
859
|
export function fromDecoded(obj: any): types.UpdateLendingMarketModeKind {
|
|
722
860
|
if (typeof obj !== "object") {
|
|
@@ -816,6 +954,24 @@ export function fromDecoded(obj: any): types.UpdateLendingMarketModeKind {
|
|
|
816
954
|
if ("UpdateBorrowOrderExecutionEnabled" in obj) {
|
|
817
955
|
return new UpdateBorrowOrderExecutionEnabled()
|
|
818
956
|
}
|
|
957
|
+
if ("UpdateWithdrawTicketIssuanceEnabled" in obj) {
|
|
958
|
+
return new UpdateWithdrawTicketIssuanceEnabled()
|
|
959
|
+
}
|
|
960
|
+
if ("UpdateWithdrawTicketRedemptionEnabled" in obj) {
|
|
961
|
+
return new UpdateWithdrawTicketRedemptionEnabled()
|
|
962
|
+
}
|
|
963
|
+
if ("UpdateMinWithdrawQueuedLiquidityValue" in obj) {
|
|
964
|
+
return new UpdateMinWithdrawQueuedLiquidityValue()
|
|
965
|
+
}
|
|
966
|
+
if ("UpdateFixedRolloverWindowDurationSeconds" in obj) {
|
|
967
|
+
return new UpdateFixedRolloverWindowDurationSeconds()
|
|
968
|
+
}
|
|
969
|
+
if ("UpdateVariableRolloverWindowDurationSeconds" in obj) {
|
|
970
|
+
return new UpdateVariableRolloverWindowDurationSeconds()
|
|
971
|
+
}
|
|
972
|
+
if ("UpdateObligationBorrowRolloverConfigurationEnabled" in obj) {
|
|
973
|
+
return new UpdateObligationBorrowRolloverConfigurationEnabled()
|
|
974
|
+
}
|
|
819
975
|
|
|
820
976
|
throw new Error("Invalid enum object")
|
|
821
977
|
}
|
|
@@ -917,6 +1073,24 @@ export function fromJSON(
|
|
|
917
1073
|
case "UpdateBorrowOrderExecutionEnabled": {
|
|
918
1074
|
return new UpdateBorrowOrderExecutionEnabled()
|
|
919
1075
|
}
|
|
1076
|
+
case "UpdateWithdrawTicketIssuanceEnabled": {
|
|
1077
|
+
return new UpdateWithdrawTicketIssuanceEnabled()
|
|
1078
|
+
}
|
|
1079
|
+
case "UpdateWithdrawTicketRedemptionEnabled": {
|
|
1080
|
+
return new UpdateWithdrawTicketRedemptionEnabled()
|
|
1081
|
+
}
|
|
1082
|
+
case "UpdateMinWithdrawQueuedLiquidityValue": {
|
|
1083
|
+
return new UpdateMinWithdrawQueuedLiquidityValue()
|
|
1084
|
+
}
|
|
1085
|
+
case "UpdateFixedRolloverWindowDurationSeconds": {
|
|
1086
|
+
return new UpdateFixedRolloverWindowDurationSeconds()
|
|
1087
|
+
}
|
|
1088
|
+
case "UpdateVariableRolloverWindowDurationSeconds": {
|
|
1089
|
+
return new UpdateVariableRolloverWindowDurationSeconds()
|
|
1090
|
+
}
|
|
1091
|
+
case "UpdateObligationBorrowRolloverConfigurationEnabled": {
|
|
1092
|
+
return new UpdateObligationBorrowRolloverConfigurationEnabled()
|
|
1093
|
+
}
|
|
920
1094
|
}
|
|
921
1095
|
}
|
|
922
1096
|
|
|
@@ -953,6 +1127,12 @@ export function layout(property?: string) {
|
|
|
953
1127
|
borsh.struct([], "UpdateObligationBorrowDebtTermLiquidationEnabled"),
|
|
954
1128
|
borsh.struct([], "UpdateBorrowOrderCreationEnabled"),
|
|
955
1129
|
borsh.struct([], "UpdateBorrowOrderExecutionEnabled"),
|
|
1130
|
+
borsh.struct([], "UpdateWithdrawTicketIssuanceEnabled"),
|
|
1131
|
+
borsh.struct([], "UpdateWithdrawTicketRedemptionEnabled"),
|
|
1132
|
+
borsh.struct([], "UpdateMinWithdrawQueuedLiquidityValue"),
|
|
1133
|
+
borsh.struct([], "UpdateFixedRolloverWindowDurationSeconds"),
|
|
1134
|
+
borsh.struct([], "UpdateVariableRolloverWindowDurationSeconds"),
|
|
1135
|
+
borsh.struct([], "UpdateObligationBorrowRolloverConfigurationEnabled"),
|
|
956
1136
|
])
|
|
957
1137
|
if (property !== undefined) {
|
|
958
1138
|
return ret.replicate(property)
|
|
@@ -0,0 +1,117 @@
|
|
|
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 WithdrawQueueFields {
|
|
8
|
+
/** The part of [ReserveLiquidity::total_available_amount] locked for ticketed withdrawals. */
|
|
9
|
+
queuedCollateralAmount: BN
|
|
10
|
+
/**
|
|
11
|
+
* The sequence number of the next ticket to be issued when enqueueing to withdraw.
|
|
12
|
+
* Note: it is also a number of tickets issued so far.
|
|
13
|
+
*/
|
|
14
|
+
nextIssuedTicketSequenceNumber: BN
|
|
15
|
+
/**
|
|
16
|
+
* The sequence number of the next ticket to be used for actually transferring the withdrawn
|
|
17
|
+
* liquidity (assuming it is available in the reserve).
|
|
18
|
+
* Note: it is also a number of fully-consumed tickets so far.
|
|
19
|
+
*/
|
|
20
|
+
nextWithdrawableTicketSequenceNumber: BN
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface WithdrawQueueJSON {
|
|
24
|
+
/** The part of [ReserveLiquidity::total_available_amount] locked for ticketed withdrawals. */
|
|
25
|
+
queuedCollateralAmount: string
|
|
26
|
+
/**
|
|
27
|
+
* The sequence number of the next ticket to be issued when enqueueing to withdraw.
|
|
28
|
+
* Note: it is also a number of tickets issued so far.
|
|
29
|
+
*/
|
|
30
|
+
nextIssuedTicketSequenceNumber: string
|
|
31
|
+
/**
|
|
32
|
+
* The sequence number of the next ticket to be used for actually transferring the withdrawn
|
|
33
|
+
* liquidity (assuming it is available in the reserve).
|
|
34
|
+
* Note: it is also a number of fully-consumed tickets so far.
|
|
35
|
+
*/
|
|
36
|
+
nextWithdrawableTicketSequenceNumber: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** A tracker of ticket-based withdrawals. */
|
|
40
|
+
export class WithdrawQueue {
|
|
41
|
+
/** The part of [ReserveLiquidity::total_available_amount] locked for ticketed withdrawals. */
|
|
42
|
+
readonly queuedCollateralAmount: BN
|
|
43
|
+
/**
|
|
44
|
+
* The sequence number of the next ticket to be issued when enqueueing to withdraw.
|
|
45
|
+
* Note: it is also a number of tickets issued so far.
|
|
46
|
+
*/
|
|
47
|
+
readonly nextIssuedTicketSequenceNumber: BN
|
|
48
|
+
/**
|
|
49
|
+
* The sequence number of the next ticket to be used for actually transferring the withdrawn
|
|
50
|
+
* liquidity (assuming it is available in the reserve).
|
|
51
|
+
* Note: it is also a number of fully-consumed tickets so far.
|
|
52
|
+
*/
|
|
53
|
+
readonly nextWithdrawableTicketSequenceNumber: BN
|
|
54
|
+
|
|
55
|
+
constructor(fields: WithdrawQueueFields) {
|
|
56
|
+
this.queuedCollateralAmount = fields.queuedCollateralAmount
|
|
57
|
+
this.nextIssuedTicketSequenceNumber = fields.nextIssuedTicketSequenceNumber
|
|
58
|
+
this.nextWithdrawableTicketSequenceNumber =
|
|
59
|
+
fields.nextWithdrawableTicketSequenceNumber
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static layout(property?: string) {
|
|
63
|
+
return borsh.struct(
|
|
64
|
+
[
|
|
65
|
+
borsh.u64("queuedCollateralAmount"),
|
|
66
|
+
borsh.u64("nextIssuedTicketSequenceNumber"),
|
|
67
|
+
borsh.u64("nextWithdrawableTicketSequenceNumber"),
|
|
68
|
+
],
|
|
69
|
+
property
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
|
+
static fromDecoded(obj: any) {
|
|
75
|
+
return new WithdrawQueue({
|
|
76
|
+
queuedCollateralAmount: obj.queuedCollateralAmount,
|
|
77
|
+
nextIssuedTicketSequenceNumber: obj.nextIssuedTicketSequenceNumber,
|
|
78
|
+
nextWithdrawableTicketSequenceNumber:
|
|
79
|
+
obj.nextWithdrawableTicketSequenceNumber,
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
static toEncodable(fields: WithdrawQueueFields) {
|
|
84
|
+
return {
|
|
85
|
+
queuedCollateralAmount: fields.queuedCollateralAmount,
|
|
86
|
+
nextIssuedTicketSequenceNumber: fields.nextIssuedTicketSequenceNumber,
|
|
87
|
+
nextWithdrawableTicketSequenceNumber:
|
|
88
|
+
fields.nextWithdrawableTicketSequenceNumber,
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
toJSON(): WithdrawQueueJSON {
|
|
93
|
+
return {
|
|
94
|
+
queuedCollateralAmount: this.queuedCollateralAmount.toString(),
|
|
95
|
+
nextIssuedTicketSequenceNumber:
|
|
96
|
+
this.nextIssuedTicketSequenceNumber.toString(),
|
|
97
|
+
nextWithdrawableTicketSequenceNumber:
|
|
98
|
+
this.nextWithdrawableTicketSequenceNumber.toString(),
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static fromJSON(obj: WithdrawQueueJSON): WithdrawQueue {
|
|
103
|
+
return new WithdrawQueue({
|
|
104
|
+
queuedCollateralAmount: new BN(obj.queuedCollateralAmount),
|
|
105
|
+
nextIssuedTicketSequenceNumber: new BN(
|
|
106
|
+
obj.nextIssuedTicketSequenceNumber
|
|
107
|
+
),
|
|
108
|
+
nextWithdrawableTicketSequenceNumber: new BN(
|
|
109
|
+
obj.nextWithdrawableTicketSequenceNumber
|
|
110
|
+
),
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
toEncodable() {
|
|
115
|
+
return WithdrawQueue.toEncodable(this)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -5,6 +5,7 @@ import * as UpdateGlobalConfigMode from "./UpdateGlobalConfigMode"
|
|
|
5
5
|
import * as FeeCalculation from "./FeeCalculation"
|
|
6
6
|
import * as ReserveFarmKind from "./ReserveFarmKind"
|
|
7
7
|
import * as ReserveStatus from "./ReserveStatus"
|
|
8
|
+
import * as ProgressCallbackType from "./ProgressCallbackType"
|
|
8
9
|
|
|
9
10
|
export { BorrowOrderConfigArgs } from "./BorrowOrderConfigArgs"
|
|
10
11
|
export type {
|
|
@@ -38,7 +39,7 @@ export type UpdateConfigModeKind =
|
|
|
38
39
|
| UpdateConfigMode.UpdateSwitchboardFeed
|
|
39
40
|
| UpdateConfigMode.UpdateSwitchboardTwapFeed
|
|
40
41
|
| UpdateConfigMode.UpdateBorrowRateCurve
|
|
41
|
-
| UpdateConfigMode.
|
|
42
|
+
| UpdateConfigMode.DeprecatedUpdateEntireReserveConfig
|
|
42
43
|
| UpdateConfigMode.UpdateDebtWithdrawalCap
|
|
43
44
|
| UpdateConfigMode.UpdateDepositWithdrawalCap
|
|
44
45
|
| UpdateConfigMode.DeprecatedUpdateDebtWithdrawalCapCurrentTotal
|
|
@@ -94,7 +95,7 @@ export type UpdateConfigModeJSON =
|
|
|
94
95
|
| UpdateConfigMode.UpdateSwitchboardFeedJSON
|
|
95
96
|
| UpdateConfigMode.UpdateSwitchboardTwapFeedJSON
|
|
96
97
|
| UpdateConfigMode.UpdateBorrowRateCurveJSON
|
|
97
|
-
| UpdateConfigMode.
|
|
98
|
+
| UpdateConfigMode.DeprecatedUpdateEntireReserveConfigJSON
|
|
98
99
|
| UpdateConfigMode.UpdateDebtWithdrawalCapJSON
|
|
99
100
|
| UpdateConfigMode.UpdateDepositWithdrawalCapJSON
|
|
100
101
|
| UpdateConfigMode.DeprecatedUpdateDebtWithdrawalCapCurrentTotalJSON
|
|
@@ -183,6 +184,12 @@ export type UpdateLendingMarketModeKind =
|
|
|
183
184
|
| UpdateLendingMarketMode.UpdateObligationBorrowDebtTermLiquidationEnabled
|
|
184
185
|
| UpdateLendingMarketMode.UpdateBorrowOrderCreationEnabled
|
|
185
186
|
| UpdateLendingMarketMode.UpdateBorrowOrderExecutionEnabled
|
|
187
|
+
| UpdateLendingMarketMode.UpdateWithdrawTicketIssuanceEnabled
|
|
188
|
+
| UpdateLendingMarketMode.UpdateWithdrawTicketRedemptionEnabled
|
|
189
|
+
| UpdateLendingMarketMode.UpdateMinWithdrawQueuedLiquidityValue
|
|
190
|
+
| UpdateLendingMarketMode.UpdateFixedRolloverWindowDurationSeconds
|
|
191
|
+
| UpdateLendingMarketMode.UpdateVariableRolloverWindowDurationSeconds
|
|
192
|
+
| UpdateLendingMarketMode.UpdateObligationBorrowRolloverConfigurationEnabled
|
|
186
193
|
export type UpdateLendingMarketModeJSON =
|
|
187
194
|
| UpdateLendingMarketMode.UpdateOwnerJSON
|
|
188
195
|
| UpdateLendingMarketMode.UpdateEmergencyModeJSON
|
|
@@ -215,6 +222,12 @@ export type UpdateLendingMarketModeJSON =
|
|
|
215
222
|
| UpdateLendingMarketMode.UpdateObligationBorrowDebtTermLiquidationEnabledJSON
|
|
216
223
|
| UpdateLendingMarketMode.UpdateBorrowOrderCreationEnabledJSON
|
|
217
224
|
| UpdateLendingMarketMode.UpdateBorrowOrderExecutionEnabledJSON
|
|
225
|
+
| UpdateLendingMarketMode.UpdateWithdrawTicketIssuanceEnabledJSON
|
|
226
|
+
| UpdateLendingMarketMode.UpdateWithdrawTicketRedemptionEnabledJSON
|
|
227
|
+
| UpdateLendingMarketMode.UpdateMinWithdrawQueuedLiquidityValueJSON
|
|
228
|
+
| UpdateLendingMarketMode.UpdateFixedRolloverWindowDurationSecondsJSON
|
|
229
|
+
| UpdateLendingMarketMode.UpdateVariableRolloverWindowDurationSecondsJSON
|
|
230
|
+
| UpdateLendingMarketMode.UpdateObligationBorrowRolloverConfigurationEnabledJSON
|
|
218
231
|
|
|
219
232
|
export { UpdateGlobalConfigMode }
|
|
220
233
|
|
|
@@ -231,6 +244,11 @@ export { ElevationGroup } from "./ElevationGroup"
|
|
|
231
244
|
export type { ElevationGroupFields, ElevationGroupJSON } from "./ElevationGroup"
|
|
232
245
|
export { BorrowOrder } from "./BorrowOrder"
|
|
233
246
|
export type { BorrowOrderFields, BorrowOrderJSON } from "./BorrowOrder"
|
|
247
|
+
export { FixedTermBorrowRolloverConfig } from "./FixedTermBorrowRolloverConfig"
|
|
248
|
+
export type {
|
|
249
|
+
FixedTermBorrowRolloverConfigFields,
|
|
250
|
+
FixedTermBorrowRolloverConfigJSON,
|
|
251
|
+
} from "./FixedTermBorrowRolloverConfig"
|
|
234
252
|
export { InitObligationArgs } from "./InitObligationArgs"
|
|
235
253
|
export type {
|
|
236
254
|
InitObligationArgsFields,
|
|
@@ -300,6 +318,8 @@ export type ReserveStatusJSON =
|
|
|
300
318
|
| ReserveStatus.ObsoleteJSON
|
|
301
319
|
| ReserveStatus.HiddenJSON
|
|
302
320
|
|
|
321
|
+
export { WithdrawQueue } from "./WithdrawQueue"
|
|
322
|
+
export type { WithdrawQueueFields, WithdrawQueueJSON } from "./WithdrawQueue"
|
|
303
323
|
export { WithdrawalCaps } from "./WithdrawalCaps"
|
|
304
324
|
export type { WithdrawalCapsFields, WithdrawalCapsJSON } from "./WithdrawalCaps"
|
|
305
325
|
export { PriceHeuristic } from "./PriceHeuristic"
|
|
@@ -321,6 +341,26 @@ export type {
|
|
|
321
341
|
} from "./SwitchboardConfiguration"
|
|
322
342
|
export { TokenInfo } from "./TokenInfo"
|
|
323
343
|
export type { TokenInfoFields, TokenInfoJSON } from "./TokenInfo"
|
|
344
|
+
export { ProgressCallbackType }
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* A callback to be notified when the ticket is being processed.
|
|
348
|
+
*
|
|
349
|
+
* ## Why an enum?
|
|
350
|
+
*
|
|
351
|
+
* Only reliable programs may be used for callbacks (since any error or panic returned from a CPI
|
|
352
|
+
* aborts an entire transaction, which would stall the queue progress). Hence, we need a whitelist,
|
|
353
|
+
* and the simplest initial implementation is a hardcoded enum. If we want to be able to add new
|
|
354
|
+
* whitelist items without SC updates, we can implement such support using a special enum value
|
|
355
|
+
* (e.g. `SPECIFIED_BY_PDA = 255`).
|
|
356
|
+
*/
|
|
357
|
+
export type ProgressCallbackTypeKind =
|
|
358
|
+
| ProgressCallbackType.None
|
|
359
|
+
| ProgressCallbackType.KlendQueueAccountingHandlerOnKvault
|
|
360
|
+
export type ProgressCallbackTypeJSON =
|
|
361
|
+
| ProgressCallbackType.NoneJSON
|
|
362
|
+
| ProgressCallbackType.KlendQueueAccountingHandlerOnKvaultJSON
|
|
363
|
+
|
|
324
364
|
export { BorrowRateCurve } from "./BorrowRateCurve"
|
|
325
365
|
export type {
|
|
326
366
|
BorrowRateCurveFields,
|
package/src/classes/action.ts
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
depositReserveLiquidity,
|
|
24
24
|
depositReserveLiquidityAndObligationCollateral,
|
|
25
25
|
depositReserveLiquidityAndObligationCollateralV2,
|
|
26
|
+
enqueueToWithdraw,
|
|
26
27
|
initObligation,
|
|
27
28
|
initObligationFarmsForReserve,
|
|
28
29
|
InitObligationFarmsForReserveAccounts,
|
|
@@ -46,6 +47,7 @@ import {
|
|
|
46
47
|
setObligationOrder,
|
|
47
48
|
withdrawObligationCollateralAndRedeemReserveCollateral,
|
|
48
49
|
withdrawObligationCollateralAndRedeemReserveCollateralV2,
|
|
50
|
+
withdrawQueuedLiquidity,
|
|
49
51
|
withdrawReferrerFees,
|
|
50
52
|
} from '../@codegen/klend/instructions';
|
|
51
53
|
import {
|
|
@@ -58,17 +60,19 @@ import {
|
|
|
58
60
|
isNotNullPubkey,
|
|
59
61
|
obligationFarmStatePda,
|
|
60
62
|
ObligationType,
|
|
63
|
+
ownerQueuedCollateralVaultPda,
|
|
61
64
|
referrerTokenStatePda,
|
|
62
65
|
ScopePriceRefreshConfig,
|
|
63
66
|
SOL_PADDING_FOR_INTEREST,
|
|
64
67
|
U64_MAX,
|
|
65
68
|
userMetadataPda,
|
|
69
|
+
withdrawTicketPda,
|
|
66
70
|
WRAPPED_SOL_MINT,
|
|
67
71
|
} from '../utils';
|
|
68
72
|
import { getTokenIdsForScopeRefresh, KaminoMarket } from './market';
|
|
69
73
|
import { isKaminoObligation, KaminoObligation } from './obligation';
|
|
70
74
|
import { KaminoReserve } from './reserve';
|
|
71
|
-
import { ReserveFarmKind } from '../@codegen/klend/types';
|
|
75
|
+
import { ProgressCallbackType, ReserveFarmKind } from '../@codegen/klend/types';
|
|
72
76
|
import { PROGRAM_ID as FARMS_PROGRAM_ID } from '@kamino-finance/farms-sdk/dist/@codegen/farms/programId';
|
|
73
77
|
import { Reserve } from '../@codegen/klend/accounts';
|
|
74
78
|
import { VanillaObligation } from '../utils/ObligationType';
|
|
@@ -1174,6 +1178,116 @@ export class KaminoAction {
|
|
|
1174
1178
|
);
|
|
1175
1179
|
}
|
|
1176
1180
|
|
|
1181
|
+
/**
|
|
1182
|
+
* Builds an instruction for enqueueing a withdrawal request to the withdraw queue.
|
|
1183
|
+
* This is used when there isn't enough liquidity to immediately withdraw.
|
|
1184
|
+
*/
|
|
1185
|
+
static async buildEnqueueToWithdrawIx(
|
|
1186
|
+
owner: TransactionSigner,
|
|
1187
|
+
kaminoMarket: KaminoMarket,
|
|
1188
|
+
reserve: KaminoReserve,
|
|
1189
|
+
collateralAmount: BN,
|
|
1190
|
+
userDestinationLiquidityTa: Address,
|
|
1191
|
+
progressCallbackType: ProgressCallbackType.None | ProgressCallbackType.KlendQueueAccountingHandlerOnKvault = new ProgressCallbackType.None(),
|
|
1192
|
+
progressCallbackCustomAccount0: Option<Address> = none(),
|
|
1193
|
+
progressCallbackCustomAccount1: Option<Address> = none()
|
|
1194
|
+
): Promise<Instruction> {
|
|
1195
|
+
const lendingMarketAuthority = await kaminoMarket.getLendingMarketAuthority();
|
|
1196
|
+
const userSourceCollateralTa = await getAssociatedTokenAddress(reserve.getCTokenMint(), owner.address);
|
|
1197
|
+
const withdrawTicket = await withdrawTicketPda(
|
|
1198
|
+
reserve.address,
|
|
1199
|
+
BigInt(reserve.state.withdrawQueue.nextIssuedTicketSequenceNumber.toString()),
|
|
1200
|
+
kaminoMarket.programId
|
|
1201
|
+
);
|
|
1202
|
+
const ownerQueuedCollateralVault = await ownerQueuedCollateralVaultPda(
|
|
1203
|
+
reserve.address,
|
|
1204
|
+
owner.address,
|
|
1205
|
+
kaminoMarket.programId
|
|
1206
|
+
);
|
|
1207
|
+
|
|
1208
|
+
return enqueueToWithdraw(
|
|
1209
|
+
{
|
|
1210
|
+
collateralAmount,
|
|
1211
|
+
progressCallbackType,
|
|
1212
|
+
},
|
|
1213
|
+
{
|
|
1214
|
+
owner,
|
|
1215
|
+
lendingMarket: kaminoMarket.getAddress(),
|
|
1216
|
+
lendingMarketAuthority,
|
|
1217
|
+
reserve: reserve.address,
|
|
1218
|
+
userSourceCollateralTa,
|
|
1219
|
+
userDestinationLiquidityTa,
|
|
1220
|
+
reserveLiquidityMint: reserve.getLiquidityMint(),
|
|
1221
|
+
reserveCollateralMint: reserve.getCTokenMint(),
|
|
1222
|
+
collateralTokenProgram: TOKEN_PROGRAM_ADDRESS,
|
|
1223
|
+
withdrawTicket,
|
|
1224
|
+
ownerQueuedCollateralVault,
|
|
1225
|
+
systemProgram: SYSTEM_PROGRAM_ADDRESS,
|
|
1226
|
+
progressCallbackCustomAccount0,
|
|
1227
|
+
progressCallbackCustomAccount1,
|
|
1228
|
+
},
|
|
1229
|
+
undefined,
|
|
1230
|
+
kaminoMarket.programId
|
|
1231
|
+
);
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Builds an instruction for withdrawing queued liquidity (permissionless).
|
|
1236
|
+
* This allows anyone to process a withdraw ticket when liquidity becomes available.
|
|
1237
|
+
*/
|
|
1238
|
+
static async buildWithdrawQueuedLiquidityIx(
|
|
1239
|
+
payer: TransactionSigner,
|
|
1240
|
+
kaminoMarket: KaminoMarket,
|
|
1241
|
+
reserve: KaminoReserve,
|
|
1242
|
+
withdrawTicket: Address,
|
|
1243
|
+
withdrawTicketOwner: Address,
|
|
1244
|
+
userDestinationLiquidity: Address,
|
|
1245
|
+
progressCallbackProgram: Option<Address> = none(),
|
|
1246
|
+
progressCallbackCustomAccount0: Option<Address> = none(),
|
|
1247
|
+
progressCallbackCustomAccount1: Option<Address> = none()
|
|
1248
|
+
): Promise<Instruction> {
|
|
1249
|
+
const lendingMarketAuthority = await kaminoMarket.getLendingMarketAuthority();
|
|
1250
|
+
const resolvedProgressCallbackProgram = isNone(progressCallbackProgram)
|
|
1251
|
+
? some(SYSTEM_PROGRAM_ADDRESS)
|
|
1252
|
+
: progressCallbackProgram;
|
|
1253
|
+
const resolvedProgressCallbackCustomAccount0 = isNone(progressCallbackCustomAccount0)
|
|
1254
|
+
? some(SYSTEM_PROGRAM_ADDRESS)
|
|
1255
|
+
: progressCallbackCustomAccount0;
|
|
1256
|
+
const resolvedProgressCallbackCustomAccount1 = isNone(progressCallbackCustomAccount1)
|
|
1257
|
+
? some(SYSTEM_PROGRAM_ADDRESS)
|
|
1258
|
+
: progressCallbackCustomAccount1;
|
|
1259
|
+
const ownerQueuedCollateralVault = await ownerQueuedCollateralVaultPda(
|
|
1260
|
+
reserve.address,
|
|
1261
|
+
withdrawTicketOwner,
|
|
1262
|
+
kaminoMarket.programId
|
|
1263
|
+
);
|
|
1264
|
+
|
|
1265
|
+
return withdrawQueuedLiquidity(
|
|
1266
|
+
{
|
|
1267
|
+
payer,
|
|
1268
|
+
lendingMarket: kaminoMarket.getAddress(),
|
|
1269
|
+
lendingMarketAuthority,
|
|
1270
|
+
reserve: reserve.address,
|
|
1271
|
+
reserveLiquidityMint: reserve.getLiquidityMint(),
|
|
1272
|
+
reserveCollateralMint: reserve.getCTokenMint(),
|
|
1273
|
+
reserveLiquiditySupply: reserve.state.liquidity.supplyVault,
|
|
1274
|
+
ownerQueuedCollateralVault,
|
|
1275
|
+
userDestinationLiquidity,
|
|
1276
|
+
collateralTokenProgram: TOKEN_PROGRAM_ADDRESS,
|
|
1277
|
+
liquidityTokenProgram: reserve.getLiquidityTokenProgram(),
|
|
1278
|
+
withdrawTicket,
|
|
1279
|
+
withdrawTicketOwner,
|
|
1280
|
+
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
|
|
1281
|
+
systemProgram: SYSTEM_PROGRAM_ADDRESS,
|
|
1282
|
+
progressCallbackProgram: resolvedProgressCallbackProgram,
|
|
1283
|
+
progressCallbackCustomAccount0: resolvedProgressCallbackCustomAccount0,
|
|
1284
|
+
progressCallbackCustomAccount1: resolvedProgressCallbackCustomAccount1,
|
|
1285
|
+
},
|
|
1286
|
+
undefined,
|
|
1287
|
+
kaminoMarket.programId
|
|
1288
|
+
);
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1177
1291
|
async addDepositReserveLiquidityIx() {
|
|
1178
1292
|
this.lendingIxsLabels.push(`depositReserveLiquidity`);
|
|
1179
1293
|
this.lendingIxs.push(
|
|
@@ -3,7 +3,9 @@ import BN from 'bn.js';
|
|
|
3
3
|
import { ObligationType, ScopePriceRefreshConfig } from '../utils';
|
|
4
4
|
import { KaminoObligation } from './obligation';
|
|
5
5
|
import { KaminoMarket } from './market';
|
|
6
|
+
import { KaminoReserve } from './reserve';
|
|
6
7
|
import { ActionType } from './action';
|
|
8
|
+
import { ProgressCallbackType } from '../@codegen/klend/types';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Props for KaminoAction.initialize
|
|
@@ -293,3 +295,32 @@ export interface BuildDepositObligationCollateralTxnsProps {
|
|
|
293
295
|
referrer?: Option<Address>;
|
|
294
296
|
currentSlot?: Slot;
|
|
295
297
|
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Props for KaminoAction.buildEnqueueToWithdrawIx
|
|
301
|
+
*/
|
|
302
|
+
export interface BuildEnqueueToWithdrawIxProps {
|
|
303
|
+
owner: TransactionSigner;
|
|
304
|
+
kaminoMarket: KaminoMarket;
|
|
305
|
+
reserve: KaminoReserve;
|
|
306
|
+
collateralAmount: BN;
|
|
307
|
+
userDestinationLiquidityTa: Address;
|
|
308
|
+
progressCallbackType?: ProgressCallbackType.None | ProgressCallbackType.KlendQueueAccountingHandlerOnKvault;
|
|
309
|
+
progressCallbackCustomAccount0?: Option<Address>;
|
|
310
|
+
progressCallbackCustomAccount1?: Option<Address>;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Props for KaminoAction.buildWithdrawQueuedLiquidityIx
|
|
315
|
+
*/
|
|
316
|
+
export interface BuildWithdrawQueuedLiquidityIxProps {
|
|
317
|
+
payer: TransactionSigner;
|
|
318
|
+
kaminoMarket: KaminoMarket;
|
|
319
|
+
reserve: KaminoReserve;
|
|
320
|
+
withdrawTicket: Address;
|
|
321
|
+
withdrawTicketOwner: Address;
|
|
322
|
+
userDestinationLiquidity: Address;
|
|
323
|
+
progressCallbackProgram?: Option<Address>;
|
|
324
|
+
progressCallbackCustomAccount0?: Option<Address>;
|
|
325
|
+
progressCallbackCustomAccount1?: Option<Address>;
|
|
326
|
+
}
|
package/src/classes/manager.ts
CHANGED
|
@@ -61,7 +61,6 @@ import {
|
|
|
61
61
|
ReserveWithAddress,
|
|
62
62
|
ScopeOracleConfig,
|
|
63
63
|
setOrAppend,
|
|
64
|
-
updateEntireReserveConfigIx,
|
|
65
64
|
updateLendingMarket,
|
|
66
65
|
UpdateLendingMarketAccounts,
|
|
67
66
|
UpdateLendingMarketArgs,
|
|
@@ -218,8 +217,7 @@ export class KaminoManager {
|
|
|
218
217
|
marketWithAddress,
|
|
219
218
|
reserveAccount.address,
|
|
220
219
|
params.assetConfig.getReserveConfig(),
|
|
221
|
-
undefined
|
|
222
|
-
false
|
|
220
|
+
undefined
|
|
223
221
|
);
|
|
224
222
|
|
|
225
223
|
const txnIxs: Instruction[][] = [];
|
|
@@ -533,36 +531,24 @@ export class KaminoManager {
|
|
|
533
531
|
marketWithAddress: MarketWithAddress,
|
|
534
532
|
reserve: Address,
|
|
535
533
|
config: ReserveConfig,
|
|
536
|
-
reserveStateOverride?: Reserve
|
|
537
|
-
updateEntireConfig: boolean = false
|
|
534
|
+
reserveStateOverride?: Reserve
|
|
538
535
|
): Promise<Instruction[]> {
|
|
539
536
|
const reserveState = reserveStateOverride
|
|
540
537
|
? reserveStateOverride
|
|
541
538
|
: (await Reserve.fetch(this._rpc, reserve, this._kaminoLendProgramId))!;
|
|
542
539
|
const ixs: Instruction[] = [];
|
|
543
540
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
)
|
|
554
|
-
|
|
555
|
-
ixs.push(
|
|
556
|
-
...(await parseForChangesReserveConfigAndGetIxs(
|
|
557
|
-
marketWithAddress,
|
|
558
|
-
reserveState,
|
|
559
|
-
reserve,
|
|
560
|
-
config,
|
|
561
|
-
this._kaminoLendProgramId,
|
|
562
|
-
lendingMarketOwner
|
|
563
|
-
))
|
|
564
|
-
);
|
|
565
|
-
}
|
|
541
|
+
|
|
542
|
+
ixs.push(
|
|
543
|
+
...(await parseForChangesReserveConfigAndGetIxs(
|
|
544
|
+
marketWithAddress,
|
|
545
|
+
reserveState,
|
|
546
|
+
reserve,
|
|
547
|
+
config,
|
|
548
|
+
this._kaminoLendProgramId,
|
|
549
|
+
lendingMarketOwner
|
|
550
|
+
))
|
|
551
|
+
);
|
|
566
552
|
|
|
567
553
|
return ixs;
|
|
568
554
|
}
|
|
@@ -1801,6 +1787,12 @@ export const MARKET_UPDATER = new ConfigUpdater(UpdateLendingMarketMode.fromDeco
|
|
|
1801
1787
|
config.obligationBorrowDebtTermLiquidationEnabled,
|
|
1802
1788
|
[UpdateLendingMarketMode.UpdateBorrowOrderCreationEnabled.kind]: config.borrowOrderCreationEnabled,
|
|
1803
1789
|
[UpdateLendingMarketMode.UpdateBorrowOrderExecutionEnabled.kind]: config.borrowOrderExecutionEnabled,
|
|
1790
|
+
[UpdateLendingMarketMode.UpdateWithdrawTicketIssuanceEnabled.kind]: config.withdrawTicketIssuanceEnabled,
|
|
1791
|
+
[UpdateLendingMarketMode.UpdateWithdrawTicketRedemptionEnabled.kind]: config.withdrawTicketRedemptionEnabled,
|
|
1792
|
+
[UpdateLendingMarketMode.UpdateMinWithdrawQueuedLiquidityValue.kind]: config.minWithdrawQueuedLiquidityValue,
|
|
1793
|
+
[UpdateLendingMarketMode.UpdateFixedRolloverWindowDurationSeconds.kind]: config.fixedRolloverWindowDurationSeconds,
|
|
1794
|
+
[UpdateLendingMarketMode.UpdateVariableRolloverWindowDurationSeconds.kind]: config.variableRolloverWindowDurationSeconds,
|
|
1795
|
+
[UpdateLendingMarketMode.UpdateObligationBorrowRolloverConfigurationEnabled.kind]: config.obligationBorrowRolloverConfigurationEnabled,
|
|
1804
1796
|
}));
|
|
1805
1797
|
|
|
1806
1798
|
function parseForChangesMarketConfigAndGetIxs(
|