@kamino-finance/klend-sdk 5.10.13 → 5.10.15

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.
Files changed (182) hide show
  1. package/README.md +32 -0
  2. package/dist/classes/action.d.ts.map +1 -1
  3. package/dist/classes/action.js +8 -6
  4. package/dist/classes/action.js.map +1 -1
  5. package/dist/classes/manager.d.ts +6 -5
  6. package/dist/classes/manager.d.ts.map +1 -1
  7. package/dist/classes/manager.js +8 -17
  8. package/dist/classes/manager.js.map +1 -1
  9. package/dist/classes/obligation.js +1 -1
  10. package/dist/classes/obligation.js.map +1 -1
  11. package/dist/classes/reserve.js +9 -9
  12. package/dist/classes/reserve.js.map +1 -1
  13. package/dist/classes/types_utils.d.ts +2 -1
  14. package/dist/classes/types_utils.d.ts.map +1 -1
  15. package/dist/classes/types_utils.js +6 -3
  16. package/dist/classes/types_utils.js.map +1 -1
  17. package/dist/classes/vault.d.ts +18 -11
  18. package/dist/classes/vault.d.ts.map +1 -1
  19. package/dist/classes/vault.js +63 -27
  20. package/dist/classes/vault.js.map +1 -1
  21. package/dist/client_kamino_manager.js +2 -2
  22. package/dist/client_kamino_manager.js.map +1 -1
  23. package/dist/idl.json +1137 -132
  24. package/dist/idl_codegen/accounts/LendingMarket.d.ts +6 -6
  25. package/dist/idl_codegen/accounts/LendingMarket.d.ts.map +1 -1
  26. package/dist/idl_codegen/accounts/LendingMarket.js +7 -7
  27. package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
  28. package/dist/idl_codegen/errors/custom.d.ts +15 -7
  29. package/dist/idl_codegen/errors/custom.d.ts.map +1 -1
  30. package/dist/idl_codegen/errors/custom.js +28 -14
  31. package/dist/idl_codegen/errors/custom.js.map +1 -1
  32. package/dist/idl_codegen/instructions/borrowObligationLiquidityV2.d.ts +29 -0
  33. package/dist/idl_codegen/instructions/borrowObligationLiquidityV2.d.ts.map +1 -0
  34. package/dist/idl_codegen/instructions/borrowObligationLiquidityV2.js +125 -0
  35. package/dist/idl_codegen/instructions/borrowObligationLiquidityV2.js.map +1 -0
  36. package/dist/idl_codegen/instructions/depositObligationCollateralV2.d.ts +26 -0
  37. package/dist/idl_codegen/instructions/depositObligationCollateralV2.d.ts.map +1 -0
  38. package/dist/idl_codegen/instructions/depositObligationCollateralV2.js +110 -0
  39. package/dist/idl_codegen/instructions/depositObligationCollateralV2.js.map +1 -0
  40. package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.d.ts +31 -0
  41. package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.d.ts.map +1 -0
  42. package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.js +135 -0
  43. package/dist/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.js.map +1 -0
  44. package/dist/idl_codegen/instructions/index.d.ts +18 -0
  45. package/dist/idl_codegen/instructions/index.d.ts.map +1 -1
  46. package/dist/idl_codegen/instructions/index.js +19 -1
  47. package/dist/idl_codegen/instructions/index.js.map +1 -1
  48. package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.d.ts +43 -0
  49. package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.d.ts.map +1 -0
  50. package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.js +181 -0
  51. package/dist/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.js.map +1 -0
  52. package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.d.ts +8 -6
  53. package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.d.ts.map +1 -1
  54. package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.js +23 -7
  55. package/dist/idl_codegen/instructions/refreshObligationFarmsForReserve.js.map +1 -1
  56. package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeemV2.d.ts +49 -0
  57. package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeemV2.d.ts.map +1 -0
  58. package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeemV2.js +205 -0
  59. package/dist/idl_codegen/instructions/repayAndWithdrawAndRedeemV2.js.map +1 -0
  60. package/dist/idl_codegen/instructions/repayObligationLiquidityV2.d.ts +27 -0
  61. package/dist/idl_codegen/instructions/repayObligationLiquidityV2.d.ts.map +1 -0
  62. package/dist/idl_codegen/instructions/repayObligationLiquidityV2.js +111 -0
  63. package/dist/idl_codegen/instructions/repayObligationLiquidityV2.js.map +1 -0
  64. package/dist/idl_codegen/instructions/socializeLossV2.d.ts +23 -0
  65. package/dist/idl_codegen/instructions/socializeLossV2.d.ts.map +1 -0
  66. package/dist/idl_codegen/instructions/socializeLossV2.js +95 -0
  67. package/dist/idl_codegen/instructions/socializeLossV2.js.map +1 -0
  68. package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.d.ts +31 -0
  69. package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.d.ts.map +1 -0
  70. package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js +135 -0
  71. package/dist/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js.map +1 -0
  72. package/dist/idl_codegen/instructions/withdrawObligationCollateralV2.d.ts +26 -0
  73. package/dist/idl_codegen/instructions/withdrawObligationCollateralV2.d.ts.map +1 -0
  74. package/dist/idl_codegen/instructions/withdrawObligationCollateralV2.js +110 -0
  75. package/dist/idl_codegen/instructions/withdrawObligationCollateralV2.js.map +1 -0
  76. package/dist/idl_codegen/types/ReserveConfig.d.ts +8 -5
  77. package/dist/idl_codegen/types/ReserveConfig.d.ts.map +1 -1
  78. package/dist/idl_codegen/types/ReserveConfig.js +9 -8
  79. package/dist/idl_codegen/types/ReserveConfig.js.map +1 -1
  80. package/dist/idl_codegen/types/UpdateConfigMode.d.ts +7 -7
  81. package/dist/idl_codegen/types/UpdateConfigMode.d.ts.map +1 -1
  82. package/dist/idl_codegen/types/UpdateConfigMode.js +12 -12
  83. package/dist/idl_codegen/types/UpdateConfigMode.js.map +1 -1
  84. package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +7 -7
  85. package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts.map +1 -1
  86. package/dist/idl_codegen/types/UpdateLendingMarketMode.js +12 -12
  87. package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
  88. package/dist/idl_codegen/types/index.d.ts +4 -4
  89. package/dist/idl_codegen/types/index.d.ts.map +1 -1
  90. package/dist/idl_codegen_kamino_vault/accounts/Reserve.js +2 -2
  91. package/dist/idl_codegen_kamino_vault/accounts/Reserve.js.map +1 -1
  92. package/dist/idl_codegen_kamino_vault/accounts/VaultState.js +2 -2
  93. package/dist/idl_codegen_kamino_vault/accounts/VaultState.js.map +1 -1
  94. package/dist/idl_codegen_kamino_vault/errors/index.js +1 -1
  95. package/dist/idl_codegen_kamino_vault/errors/index.js.map +1 -1
  96. package/dist/idl_codegen_kamino_vault/instructions/deposit.js +1 -1
  97. package/dist/idl_codegen_kamino_vault/instructions/deposit.js.map +1 -1
  98. package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.js +1 -1
  99. package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.js.map +1 -1
  100. package/dist/idl_codegen_kamino_vault/instructions/initVault.js +1 -1
  101. package/dist/idl_codegen_kamino_vault/instructions/initVault.js.map +1 -1
  102. package/dist/idl_codegen_kamino_vault/instructions/initializeSharesMetadata.js +1 -1
  103. package/dist/idl_codegen_kamino_vault/instructions/initializeSharesMetadata.js.map +1 -1
  104. package/dist/idl_codegen_kamino_vault/instructions/invest.js +1 -1
  105. package/dist/idl_codegen_kamino_vault/instructions/invest.js.map +1 -1
  106. package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.js +1 -1
  107. package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.js.map +1 -1
  108. package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js +1 -1
  109. package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js.map +1 -1
  110. package/dist/idl_codegen_kamino_vault/instructions/updateSharesMetadata.js +1 -1
  111. package/dist/idl_codegen_kamino_vault/instructions/updateSharesMetadata.js.map +1 -1
  112. package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.js +1 -1
  113. package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.js.map +1 -1
  114. package/dist/idl_codegen_kamino_vault/instructions/withdraw.js +1 -1
  115. package/dist/idl_codegen_kamino_vault/instructions/withdraw.js.map +1 -1
  116. package/dist/idl_codegen_kamino_vault/instructions/withdrawFromAvailable.js +1 -1
  117. package/dist/idl_codegen_kamino_vault/instructions/withdrawFromAvailable.js.map +1 -1
  118. package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.js +1 -1
  119. package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.js.map +1 -1
  120. package/dist/idl_codegen_kamino_vault/programId.d.ts +3 -2
  121. package/dist/idl_codegen_kamino_vault/programId.d.ts.map +1 -1
  122. package/dist/idl_codegen_kamino_vault/programId.js +7 -3
  123. package/dist/idl_codegen_kamino_vault/programId.js.map +1 -1
  124. package/dist/lib.d.ts +1 -0
  125. package/dist/lib.d.ts.map +1 -1
  126. package/dist/lib.js +1 -0
  127. package/dist/lib.js.map +1 -1
  128. package/dist/utils/ObligationType.d.ts.map +1 -1
  129. package/dist/utils/ObligationType.js.map +1 -1
  130. package/dist/utils/accountListing.d.ts +3 -1
  131. package/dist/utils/accountListing.d.ts.map +1 -1
  132. package/dist/utils/accountListing.js +40 -0
  133. package/dist/utils/accountListing.js.map +1 -1
  134. package/dist/utils/managerTypes.js +1 -1
  135. package/dist/utils/managerTypes.js.map +1 -1
  136. package/package.json +1 -1
  137. package/src/classes/action.ts +8 -6
  138. package/src/classes/manager.ts +9 -19
  139. package/src/classes/obligation.ts +1 -1
  140. package/src/classes/reserve.ts +11 -11
  141. package/src/classes/types_utils.ts +6 -3
  142. package/src/classes/vault.ts +81 -32
  143. package/src/client.ts +22 -0
  144. package/src/client_kamino_manager.ts +2 -2
  145. package/src/idl.json +1137 -132
  146. package/src/idl_codegen/accounts/LendingMarket.ts +11 -11
  147. package/src/idl_codegen/errors/custom.ts +26 -12
  148. package/src/idl_codegen/instructions/borrowObligationLiquidityV2.ts +124 -0
  149. package/src/idl_codegen/instructions/depositObligationCollateralV2.ts +106 -0
  150. package/src/idl_codegen/instructions/depositReserveLiquidityAndObligationCollateralV2.ts +136 -0
  151. package/src/idl_codegen/instructions/index.ts +45 -0
  152. package/src/idl_codegen/instructions/liquidateObligationAndRedeemReserveCollateralV2.ts +195 -0
  153. package/src/idl_codegen/instructions/refreshObligationFarmsForReserve.ts +31 -13
  154. package/src/idl_codegen/instructions/repayAndWithdrawAndRedeemV2.ts +239 -0
  155. package/src/idl_codegen/instructions/repayObligationLiquidityV2.ts +108 -0
  156. package/src/idl_codegen/instructions/socializeLossV2.ts +88 -0
  157. package/src/idl_codegen/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.ts +136 -0
  158. package/src/idl_codegen/instructions/withdrawObligationCollateralV2.ts +106 -0
  159. package/src/idl_codegen/types/ReserveConfig.ts +17 -14
  160. package/src/idl_codegen/types/UpdateConfigMode.ts +13 -13
  161. package/src/idl_codegen/types/UpdateLendingMarketMode.ts +13 -13
  162. package/src/idl_codegen/types/index.ts +4 -4
  163. package/src/idl_codegen_kamino_vault/accounts/Reserve.ts +1 -1
  164. package/src/idl_codegen_kamino_vault/accounts/VaultState.ts +1 -1
  165. package/src/idl_codegen_kamino_vault/errors/index.ts +1 -1
  166. package/src/idl_codegen_kamino_vault/instructions/deposit.ts +1 -1
  167. package/src/idl_codegen_kamino_vault/instructions/giveUpPendingFees.ts +1 -1
  168. package/src/idl_codegen_kamino_vault/instructions/initVault.ts +1 -1
  169. package/src/idl_codegen_kamino_vault/instructions/initializeSharesMetadata.ts +1 -1
  170. package/src/idl_codegen_kamino_vault/instructions/invest.ts +1 -1
  171. package/src/idl_codegen_kamino_vault/instructions/updateAdmin.ts +1 -1
  172. package/src/idl_codegen_kamino_vault/instructions/updateReserveAllocation.ts +1 -1
  173. package/src/idl_codegen_kamino_vault/instructions/updateSharesMetadata.ts +1 -1
  174. package/src/idl_codegen_kamino_vault/instructions/updateVaultConfig.ts +1 -1
  175. package/src/idl_codegen_kamino_vault/instructions/withdraw.ts +1 -1
  176. package/src/idl_codegen_kamino_vault/instructions/withdrawFromAvailable.ts +1 -1
  177. package/src/idl_codegen_kamino_vault/instructions/withdrawPendingFees.ts +1 -1
  178. package/src/idl_codegen_kamino_vault/programId.ts +6 -2
  179. package/src/lib.ts +1 -0
  180. package/src/utils/ObligationType.ts +2 -10
  181. package/src/utils/accountListing.ts +43 -1
  182. package/src/utils/managerTypes.ts +1 -1
@@ -44,8 +44,8 @@ export interface LendingMarketFields {
44
44
  minFullLiquidationValueThreshold: BN
45
45
  /** Max allowed liquidation value in one ix call */
46
46
  maxLiquidatableDebtMarketValueAtOnce: BN
47
- /** Global maximum unhealthy borrow value allowed for any obligation */
48
- globalUnhealthyBorrowValue: BN
47
+ /** [DEPRECATED] Global maximum unhealthy borrow value allowed for any obligation */
48
+ reserved0: Array<number>
49
49
  /** Global maximum allowed borrow value allowed for any obligation */
50
50
  globalAllowedBorrowValue: BN
51
51
  /** The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol */
@@ -111,8 +111,8 @@ export interface LendingMarketJSON {
111
111
  minFullLiquidationValueThreshold: string
112
112
  /** Max allowed liquidation value in one ix call */
113
113
  maxLiquidatableDebtMarketValueAtOnce: string
114
- /** Global maximum unhealthy borrow value allowed for any obligation */
115
- globalUnhealthyBorrowValue: string
114
+ /** [DEPRECATED] Global maximum unhealthy borrow value allowed for any obligation */
115
+ reserved0: Array<number>
116
116
  /** Global maximum allowed borrow value allowed for any obligation */
117
117
  globalAllowedBorrowValue: string
118
118
  /** The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol */
@@ -178,8 +178,8 @@ export class LendingMarket {
178
178
  readonly minFullLiquidationValueThreshold: BN
179
179
  /** Max allowed liquidation value in one ix call */
180
180
  readonly maxLiquidatableDebtMarketValueAtOnce: BN
181
- /** Global maximum unhealthy borrow value allowed for any obligation */
182
- readonly globalUnhealthyBorrowValue: BN
181
+ /** [DEPRECATED] Global maximum unhealthy borrow value allowed for any obligation */
182
+ readonly reserved0: Array<number>
183
183
  /** Global maximum allowed borrow value allowed for any obligation */
184
184
  readonly globalAllowedBorrowValue: BN
185
185
  /** The address of the risk council, in charge of making parameter and risk decisions on behalf of the protocol */
@@ -223,7 +223,7 @@ export class LendingMarket {
223
223
  borsh.u8("insolvencyRiskUnhealthyLtvPct"),
224
224
  borsh.u64("minFullLiquidationValueThreshold"),
225
225
  borsh.u64("maxLiquidatableDebtMarketValueAtOnce"),
226
- borsh.u64("globalUnhealthyBorrowValue"),
226
+ borsh.array(borsh.u8(), 8, "reserved0"),
227
227
  borsh.u64("globalAllowedBorrowValue"),
228
228
  borsh.publicKey("riskCouncil"),
229
229
  borsh.array(borsh.u8(), 8, "reserved1"),
@@ -255,7 +255,7 @@ export class LendingMarket {
255
255
  fields.minFullLiquidationValueThreshold
256
256
  this.maxLiquidatableDebtMarketValueAtOnce =
257
257
  fields.maxLiquidatableDebtMarketValueAtOnce
258
- this.globalUnhealthyBorrowValue = fields.globalUnhealthyBorrowValue
258
+ this.reserved0 = fields.reserved0
259
259
  this.globalAllowedBorrowValue = fields.globalAllowedBorrowValue
260
260
  this.riskCouncil = fields.riskCouncil
261
261
  this.reserved1 = fields.reserved1
@@ -333,7 +333,7 @@ export class LendingMarket {
333
333
  minFullLiquidationValueThreshold: dec.minFullLiquidationValueThreshold,
334
334
  maxLiquidatableDebtMarketValueAtOnce:
335
335
  dec.maxLiquidatableDebtMarketValueAtOnce,
336
- globalUnhealthyBorrowValue: dec.globalUnhealthyBorrowValue,
336
+ reserved0: dec.reserved0,
337
337
  globalAllowedBorrowValue: dec.globalAllowedBorrowValue,
338
338
  riskCouncil: dec.riskCouncil,
339
339
  reserved1: dec.reserved1,
@@ -371,7 +371,7 @@ export class LendingMarket {
371
371
  this.minFullLiquidationValueThreshold.toString(),
372
372
  maxLiquidatableDebtMarketValueAtOnce:
373
373
  this.maxLiquidatableDebtMarketValueAtOnce.toString(),
374
- globalUnhealthyBorrowValue: this.globalUnhealthyBorrowValue.toString(),
374
+ reserved0: this.reserved0,
375
375
  globalAllowedBorrowValue: this.globalAllowedBorrowValue.toString(),
376
376
  riskCouncil: this.riskCouncil.toString(),
377
377
  reserved1: this.reserved1,
@@ -411,7 +411,7 @@ export class LendingMarket {
411
411
  maxLiquidatableDebtMarketValueAtOnce: new BN(
412
412
  obj.maxLiquidatableDebtMarketValueAtOnce
413
413
  ),
414
- globalUnhealthyBorrowValue: new BN(obj.globalUnhealthyBorrowValue),
414
+ reserved0: obj.reserved0,
415
415
  globalAllowedBorrowValue: new BN(obj.globalAllowedBorrowValue),
416
416
  riskCouncil: new PublicKey(obj.riskCouncil),
417
417
  reserved1: obj.reserved1,
@@ -58,7 +58,7 @@ export type CustomError =
58
58
  | InvalidScopePriceAccount
59
59
  | ObligationCollateralLtvZero
60
60
  | InvalidObligationSeedsValue
61
- | InvalidObligationId
61
+ | DeprecatedInvalidObligationId
62
62
  | InvalidBorrowRateCurvePoint
63
63
  | InvalidUtilizationRate
64
64
  | CannotSocializeObligationWithCollateral
@@ -114,7 +114,8 @@ export type CustomError =
114
114
  | ObligationOwnersMustMatch
115
115
  | ObligationsMustMatch
116
116
  | LendingMarketsMustMatch
117
- | ObligationAlreadyMarkedForDeleveraging
117
+ | ObligationCurrentlyMarkedForDeleveraging
118
+ | FarmAccountsMissing
118
119
 
119
120
  export class InvalidMarketAuthority extends Error {
120
121
  static readonly code = 6000
@@ -774,14 +775,14 @@ export class InvalidObligationSeedsValue extends Error {
774
775
  }
775
776
  }
776
777
 
777
- export class InvalidObligationId extends Error {
778
+ export class DeprecatedInvalidObligationId extends Error {
778
779
  static readonly code = 6059
779
780
  readonly code = 6059
780
- readonly name = "InvalidObligationId"
781
- readonly msg = "Obligation id must be 0"
781
+ readonly name = "DeprecatedInvalidObligationId"
782
+ readonly msg = "[DEPRECATED] Obligation id must be 0"
782
783
 
783
784
  constructor(readonly logs?: string[]) {
784
- super("6059: Obligation id must be 0")
785
+ super("6059: [DEPRECATED] Obligation id must be 0")
785
786
  }
786
787
  }
787
788
 
@@ -1438,14 +1439,25 @@ export class LendingMarketsMustMatch extends Error {
1438
1439
  }
1439
1440
  }
1440
1441
 
1441
- export class ObligationAlreadyMarkedForDeleveraging extends Error {
1442
+ export class ObligationCurrentlyMarkedForDeleveraging extends Error {
1442
1443
  static readonly code = 6115
1443
1444
  readonly code = 6115
1444
- readonly name = "ObligationAlreadyMarkedForDeleveraging"
1445
- readonly msg = "Obligation is already marked for deleveraging"
1445
+ readonly name = "ObligationCurrentlyMarkedForDeleveraging"
1446
+ readonly msg = "Obligation is currently marked for deleveraging"
1446
1447
 
1447
1448
  constructor(readonly logs?: string[]) {
1448
- super("6115: Obligation is already marked for deleveraging")
1449
+ super("6115: Obligation is currently marked for deleveraging")
1450
+ }
1451
+ }
1452
+
1453
+ export class FarmAccountsMissing extends Error {
1454
+ static readonly code = 6116
1455
+ readonly code = 6116
1456
+ readonly name = "FarmAccountsMissing"
1457
+ readonly msg = "Farm accounts to refresh are missing"
1458
+
1459
+ constructor(readonly logs?: string[]) {
1460
+ super("6116: Farm accounts to refresh are missing")
1449
1461
  }
1450
1462
  }
1451
1463
 
@@ -1570,7 +1582,7 @@ export function fromCode(code: number, logs?: string[]): CustomError | null {
1570
1582
  case 6058:
1571
1583
  return new InvalidObligationSeedsValue(logs)
1572
1584
  case 6059:
1573
- return new InvalidObligationId(logs)
1585
+ return new DeprecatedInvalidObligationId(logs)
1574
1586
  case 6060:
1575
1587
  return new InvalidBorrowRateCurvePoint(logs)
1576
1588
  case 6061:
@@ -1682,7 +1694,9 @@ export function fromCode(code: number, logs?: string[]): CustomError | null {
1682
1694
  case 6114:
1683
1695
  return new LendingMarketsMustMatch(logs)
1684
1696
  case 6115:
1685
- return new ObligationAlreadyMarkedForDeleveraging(logs)
1697
+ return new ObligationCurrentlyMarkedForDeleveraging(logs)
1698
+ case 6116:
1699
+ return new FarmAccountsMissing(logs)
1686
1700
  }
1687
1701
 
1688
1702
  return null
@@ -0,0 +1,124 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface BorrowObligationLiquidityV2Args {
8
+ liquidityAmount: BN
9
+ }
10
+
11
+ export interface BorrowObligationLiquidityV2Accounts {
12
+ borrowAccounts: {
13
+ owner: PublicKey
14
+ obligation: PublicKey
15
+ lendingMarket: PublicKey
16
+ lendingMarketAuthority: PublicKey
17
+ borrowReserve: PublicKey
18
+ borrowReserveLiquidityMint: PublicKey
19
+ reserveSourceLiquidity: PublicKey
20
+ borrowReserveLiquidityFeeReceiver: PublicKey
21
+ userDestinationLiquidity: PublicKey
22
+ referrerTokenState: PublicKey
23
+ tokenProgram: PublicKey
24
+ instructionSysvarAccount: PublicKey
25
+ }
26
+ farmsAccounts: {
27
+ obligationFarmUserState: PublicKey
28
+ reserveFarmState: PublicKey
29
+ }
30
+ farmsProgram: PublicKey
31
+ }
32
+
33
+ export const layout = borsh.struct([borsh.u64("liquidityAmount")])
34
+
35
+ export function borrowObligationLiquidityV2(
36
+ args: BorrowObligationLiquidityV2Args,
37
+ accounts: BorrowObligationLiquidityV2Accounts,
38
+ programId: PublicKey = PROGRAM_ID
39
+ ) {
40
+ const keys: Array<AccountMeta> = [
41
+ {
42
+ pubkey: accounts.borrowAccounts.owner,
43
+ isSigner: true,
44
+ isWritable: false,
45
+ },
46
+ {
47
+ pubkey: accounts.borrowAccounts.obligation,
48
+ isSigner: false,
49
+ isWritable: true,
50
+ },
51
+ {
52
+ pubkey: accounts.borrowAccounts.lendingMarket,
53
+ isSigner: false,
54
+ isWritable: false,
55
+ },
56
+ {
57
+ pubkey: accounts.borrowAccounts.lendingMarketAuthority,
58
+ isSigner: false,
59
+ isWritable: false,
60
+ },
61
+ {
62
+ pubkey: accounts.borrowAccounts.borrowReserve,
63
+ isSigner: false,
64
+ isWritable: true,
65
+ },
66
+ {
67
+ pubkey: accounts.borrowAccounts.borrowReserveLiquidityMint,
68
+ isSigner: false,
69
+ isWritable: true,
70
+ },
71
+ {
72
+ pubkey: accounts.borrowAccounts.reserveSourceLiquidity,
73
+ isSigner: false,
74
+ isWritable: true,
75
+ },
76
+ {
77
+ pubkey: accounts.borrowAccounts.borrowReserveLiquidityFeeReceiver,
78
+ isSigner: false,
79
+ isWritable: true,
80
+ },
81
+ {
82
+ pubkey: accounts.borrowAccounts.userDestinationLiquidity,
83
+ isSigner: false,
84
+ isWritable: true,
85
+ },
86
+ {
87
+ pubkey: accounts.borrowAccounts.referrerTokenState,
88
+ isSigner: false,
89
+ isWritable: true,
90
+ },
91
+ {
92
+ pubkey: accounts.borrowAccounts.tokenProgram,
93
+ isSigner: false,
94
+ isWritable: false,
95
+ },
96
+ {
97
+ pubkey: accounts.borrowAccounts.instructionSysvarAccount,
98
+ isSigner: false,
99
+ isWritable: false,
100
+ },
101
+ {
102
+ pubkey: accounts.farmsAccounts.obligationFarmUserState,
103
+ isSigner: false,
104
+ isWritable: true,
105
+ },
106
+ {
107
+ pubkey: accounts.farmsAccounts.reserveFarmState,
108
+ isSigner: false,
109
+ isWritable: true,
110
+ },
111
+ { pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
112
+ ]
113
+ const identifier = Buffer.from([161, 128, 143, 245, 171, 199, 194, 6])
114
+ const buffer = Buffer.alloc(1000)
115
+ const len = layout.encode(
116
+ {
117
+ liquidityAmount: args.liquidityAmount,
118
+ },
119
+ buffer
120
+ )
121
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
122
+ const ix = new TransactionInstruction({ keys, programId, data })
123
+ return ix
124
+ }
@@ -0,0 +1,106 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface DepositObligationCollateralV2Args {
8
+ collateralAmount: BN
9
+ }
10
+
11
+ export interface DepositObligationCollateralV2Accounts {
12
+ depositAccounts: {
13
+ owner: PublicKey
14
+ obligation: PublicKey
15
+ lendingMarket: PublicKey
16
+ depositReserve: PublicKey
17
+ reserveDestinationCollateral: PublicKey
18
+ userSourceCollateral: PublicKey
19
+ tokenProgram: PublicKey
20
+ instructionSysvarAccount: PublicKey
21
+ }
22
+ lendingMarketAuthority: PublicKey
23
+ farmsAccounts: {
24
+ obligationFarmUserState: PublicKey
25
+ reserveFarmState: PublicKey
26
+ }
27
+ farmsProgram: PublicKey
28
+ }
29
+
30
+ export const layout = borsh.struct([borsh.u64("collateralAmount")])
31
+
32
+ export function depositObligationCollateralV2(
33
+ args: DepositObligationCollateralV2Args,
34
+ accounts: DepositObligationCollateralV2Accounts,
35
+ programId: PublicKey = PROGRAM_ID
36
+ ) {
37
+ const keys: Array<AccountMeta> = [
38
+ {
39
+ pubkey: accounts.depositAccounts.owner,
40
+ isSigner: true,
41
+ isWritable: false,
42
+ },
43
+ {
44
+ pubkey: accounts.depositAccounts.obligation,
45
+ isSigner: false,
46
+ isWritable: true,
47
+ },
48
+ {
49
+ pubkey: accounts.depositAccounts.lendingMarket,
50
+ isSigner: false,
51
+ isWritable: false,
52
+ },
53
+ {
54
+ pubkey: accounts.depositAccounts.depositReserve,
55
+ isSigner: false,
56
+ isWritable: true,
57
+ },
58
+ {
59
+ pubkey: accounts.depositAccounts.reserveDestinationCollateral,
60
+ isSigner: false,
61
+ isWritable: true,
62
+ },
63
+ {
64
+ pubkey: accounts.depositAccounts.userSourceCollateral,
65
+ isSigner: false,
66
+ isWritable: true,
67
+ },
68
+ {
69
+ pubkey: accounts.depositAccounts.tokenProgram,
70
+ isSigner: false,
71
+ isWritable: false,
72
+ },
73
+ {
74
+ pubkey: accounts.depositAccounts.instructionSysvarAccount,
75
+ isSigner: false,
76
+ isWritable: false,
77
+ },
78
+ {
79
+ pubkey: accounts.lendingMarketAuthority,
80
+ isSigner: false,
81
+ isWritable: false,
82
+ },
83
+ {
84
+ pubkey: accounts.farmsAccounts.obligationFarmUserState,
85
+ isSigner: false,
86
+ isWritable: true,
87
+ },
88
+ {
89
+ pubkey: accounts.farmsAccounts.reserveFarmState,
90
+ isSigner: false,
91
+ isWritable: true,
92
+ },
93
+ { pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
94
+ ]
95
+ const identifier = Buffer.from([137, 145, 151, 94, 167, 113, 4, 145])
96
+ const buffer = Buffer.alloc(1000)
97
+ const len = layout.encode(
98
+ {
99
+ collateralAmount: args.collateralAmount,
100
+ },
101
+ buffer
102
+ )
103
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
104
+ const ix = new TransactionInstruction({ keys, programId, data })
105
+ return ix
106
+ }
@@ -0,0 +1,136 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface DepositReserveLiquidityAndObligationCollateralV2Args {
8
+ liquidityAmount: BN
9
+ }
10
+
11
+ export interface DepositReserveLiquidityAndObligationCollateralV2Accounts {
12
+ depositAccounts: {
13
+ owner: PublicKey
14
+ obligation: PublicKey
15
+ lendingMarket: PublicKey
16
+ lendingMarketAuthority: PublicKey
17
+ reserve: PublicKey
18
+ reserveLiquidityMint: PublicKey
19
+ reserveLiquiditySupply: PublicKey
20
+ reserveCollateralMint: PublicKey
21
+ reserveDestinationDepositCollateral: PublicKey
22
+ userSourceLiquidity: PublicKey
23
+ placeholderUserDestinationCollateral: PublicKey
24
+ collateralTokenProgram: PublicKey
25
+ liquidityTokenProgram: PublicKey
26
+ instructionSysvarAccount: PublicKey
27
+ }
28
+ farmsAccounts: {
29
+ obligationFarmUserState: PublicKey
30
+ reserveFarmState: PublicKey
31
+ }
32
+ farmsProgram: PublicKey
33
+ }
34
+
35
+ export const layout = borsh.struct([borsh.u64("liquidityAmount")])
36
+
37
+ export function depositReserveLiquidityAndObligationCollateralV2(
38
+ args: DepositReserveLiquidityAndObligationCollateralV2Args,
39
+ accounts: DepositReserveLiquidityAndObligationCollateralV2Accounts,
40
+ programId: PublicKey = PROGRAM_ID
41
+ ) {
42
+ const keys: Array<AccountMeta> = [
43
+ {
44
+ pubkey: accounts.depositAccounts.owner,
45
+ isSigner: true,
46
+ isWritable: true,
47
+ },
48
+ {
49
+ pubkey: accounts.depositAccounts.obligation,
50
+ isSigner: false,
51
+ isWritable: true,
52
+ },
53
+ {
54
+ pubkey: accounts.depositAccounts.lendingMarket,
55
+ isSigner: false,
56
+ isWritable: false,
57
+ },
58
+ {
59
+ pubkey: accounts.depositAccounts.lendingMarketAuthority,
60
+ isSigner: false,
61
+ isWritable: false,
62
+ },
63
+ {
64
+ pubkey: accounts.depositAccounts.reserve,
65
+ isSigner: false,
66
+ isWritable: true,
67
+ },
68
+ {
69
+ pubkey: accounts.depositAccounts.reserveLiquidityMint,
70
+ isSigner: false,
71
+ isWritable: true,
72
+ },
73
+ {
74
+ pubkey: accounts.depositAccounts.reserveLiquiditySupply,
75
+ isSigner: false,
76
+ isWritable: true,
77
+ },
78
+ {
79
+ pubkey: accounts.depositAccounts.reserveCollateralMint,
80
+ isSigner: false,
81
+ isWritable: true,
82
+ },
83
+ {
84
+ pubkey: accounts.depositAccounts.reserveDestinationDepositCollateral,
85
+ isSigner: false,
86
+ isWritable: true,
87
+ },
88
+ {
89
+ pubkey: accounts.depositAccounts.userSourceLiquidity,
90
+ isSigner: false,
91
+ isWritable: true,
92
+ },
93
+ {
94
+ pubkey: accounts.depositAccounts.placeholderUserDestinationCollateral,
95
+ isSigner: false,
96
+ isWritable: false,
97
+ },
98
+ {
99
+ pubkey: accounts.depositAccounts.collateralTokenProgram,
100
+ isSigner: false,
101
+ isWritable: false,
102
+ },
103
+ {
104
+ pubkey: accounts.depositAccounts.liquidityTokenProgram,
105
+ isSigner: false,
106
+ isWritable: false,
107
+ },
108
+ {
109
+ pubkey: accounts.depositAccounts.instructionSysvarAccount,
110
+ isSigner: false,
111
+ isWritable: false,
112
+ },
113
+ {
114
+ pubkey: accounts.farmsAccounts.obligationFarmUserState,
115
+ isSigner: false,
116
+ isWritable: true,
117
+ },
118
+ {
119
+ pubkey: accounts.farmsAccounts.reserveFarmState,
120
+ isSigner: false,
121
+ isWritable: true,
122
+ },
123
+ { pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
124
+ ]
125
+ const identifier = Buffer.from([216, 224, 191, 27, 204, 151, 102, 175])
126
+ const buffer = Buffer.alloc(1000)
127
+ const len = layout.encode(
128
+ {
129
+ liquidityAmount: args.liquidityAmount,
130
+ },
131
+ buffer
132
+ )
133
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
134
+ const ix = new TransactionInstruction({ keys, programId, data })
135
+ return ix
136
+ }
@@ -31,6 +31,11 @@ export type {
31
31
  } from "./withdrawProtocolFee"
32
32
  export { socializeLoss } from "./socializeLoss"
33
33
  export type { SocializeLossArgs, SocializeLossAccounts } from "./socializeLoss"
34
+ export { socializeLossV2 } from "./socializeLossV2"
35
+ export type {
36
+ SocializeLossV2Args,
37
+ SocializeLossV2Accounts,
38
+ } from "./socializeLossV2"
34
39
  export { markObligationForDeleveraging } from "./markObligationForDeleveraging"
35
40
  export type {
36
41
  MarkObligationForDeleveragingArgs,
@@ -72,41 +77,81 @@ export type {
72
77
  DepositObligationCollateralArgs,
73
78
  DepositObligationCollateralAccounts,
74
79
  } from "./depositObligationCollateral"
80
+ export { depositObligationCollateralV2 } from "./depositObligationCollateralV2"
81
+ export type {
82
+ DepositObligationCollateralV2Args,
83
+ DepositObligationCollateralV2Accounts,
84
+ } from "./depositObligationCollateralV2"
75
85
  export { withdrawObligationCollateral } from "./withdrawObligationCollateral"
76
86
  export type {
77
87
  WithdrawObligationCollateralArgs,
78
88
  WithdrawObligationCollateralAccounts,
79
89
  } from "./withdrawObligationCollateral"
90
+ export { withdrawObligationCollateralV2 } from "./withdrawObligationCollateralV2"
91
+ export type {
92
+ WithdrawObligationCollateralV2Args,
93
+ WithdrawObligationCollateralV2Accounts,
94
+ } from "./withdrawObligationCollateralV2"
80
95
  export { borrowObligationLiquidity } from "./borrowObligationLiquidity"
81
96
  export type {
82
97
  BorrowObligationLiquidityArgs,
83
98
  BorrowObligationLiquidityAccounts,
84
99
  } from "./borrowObligationLiquidity"
100
+ export { borrowObligationLiquidityV2 } from "./borrowObligationLiquidityV2"
101
+ export type {
102
+ BorrowObligationLiquidityV2Args,
103
+ BorrowObligationLiquidityV2Accounts,
104
+ } from "./borrowObligationLiquidityV2"
85
105
  export { repayObligationLiquidity } from "./repayObligationLiquidity"
86
106
  export type {
87
107
  RepayObligationLiquidityArgs,
88
108
  RepayObligationLiquidityAccounts,
89
109
  } from "./repayObligationLiquidity"
110
+ export { repayObligationLiquidityV2 } from "./repayObligationLiquidityV2"
111
+ export type {
112
+ RepayObligationLiquidityV2Args,
113
+ RepayObligationLiquidityV2Accounts,
114
+ } from "./repayObligationLiquidityV2"
90
115
  export { repayAndWithdrawAndRedeem } from "./repayAndWithdrawAndRedeem"
91
116
  export type {
92
117
  RepayAndWithdrawAndRedeemArgs,
93
118
  RepayAndWithdrawAndRedeemAccounts,
94
119
  } from "./repayAndWithdrawAndRedeem"
120
+ export { repayAndWithdrawAndRedeemV2 } from "./repayAndWithdrawAndRedeemV2"
121
+ export type {
122
+ RepayAndWithdrawAndRedeemV2Args,
123
+ RepayAndWithdrawAndRedeemV2Accounts,
124
+ } from "./repayAndWithdrawAndRedeemV2"
95
125
  export { depositReserveLiquidityAndObligationCollateral } from "./depositReserveLiquidityAndObligationCollateral"
96
126
  export type {
97
127
  DepositReserveLiquidityAndObligationCollateralArgs,
98
128
  DepositReserveLiquidityAndObligationCollateralAccounts,
99
129
  } from "./depositReserveLiquidityAndObligationCollateral"
130
+ export { depositReserveLiquidityAndObligationCollateralV2 } from "./depositReserveLiquidityAndObligationCollateralV2"
131
+ export type {
132
+ DepositReserveLiquidityAndObligationCollateralV2Args,
133
+ DepositReserveLiquidityAndObligationCollateralV2Accounts,
134
+ } from "./depositReserveLiquidityAndObligationCollateralV2"
100
135
  export { withdrawObligationCollateralAndRedeemReserveCollateral } from "./withdrawObligationCollateralAndRedeemReserveCollateral"
101
136
  export type {
102
137
  WithdrawObligationCollateralAndRedeemReserveCollateralArgs,
103
138
  WithdrawObligationCollateralAndRedeemReserveCollateralAccounts,
104
139
  } from "./withdrawObligationCollateralAndRedeemReserveCollateral"
140
+ export { withdrawObligationCollateralAndRedeemReserveCollateralV2 } from "./withdrawObligationCollateralAndRedeemReserveCollateralV2"
141
+ export type {
142
+ WithdrawObligationCollateralAndRedeemReserveCollateralV2Args,
143
+ WithdrawObligationCollateralAndRedeemReserveCollateralV2Accounts,
144
+ } from "./withdrawObligationCollateralAndRedeemReserveCollateralV2"
105
145
  export { liquidateObligationAndRedeemReserveCollateral } from "./liquidateObligationAndRedeemReserveCollateral"
106
146
  export type {
107
147
  LiquidateObligationAndRedeemReserveCollateralArgs,
108
148
  LiquidateObligationAndRedeemReserveCollateralAccounts,
109
149
  } from "./liquidateObligationAndRedeemReserveCollateral"
150
+ export { liquidateObligationAndRedeemReserveCollateralV2 } from "./liquidateObligationAndRedeemReserveCollateralV2"
151
+ export type {
152
+ LiquidateObligationAndRedeemReserveCollateralV2Args,
153
+ LiquidateObligationAndRedeemReserveCollateralV2Accounts,
154
+ } from "./liquidateObligationAndRedeemReserveCollateralV2"
110
155
  export { flashRepayReserveLiquidity } from "./flashRepayReserveLiquidity"
111
156
  export type {
112
157
  FlashRepayReserveLiquidityArgs,