@exponent-labs/klend-idl 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/build/accounts/LendingMarket.d.ts +88 -0
  2. package/build/accounts/LendingMarket.js +225 -0
  3. package/build/accounts/LendingMarket.js.map +1 -0
  4. package/build/accounts/Obligation.d.ts +85 -0
  5. package/build/accounts/Obligation.js +217 -0
  6. package/build/accounts/Obligation.js.map +1 -0
  7. package/build/accounts/ReferrerState.d.ts +23 -0
  8. package/build/accounts/ReferrerState.js +85 -0
  9. package/build/accounts/ReferrerState.js.map +1 -0
  10. package/build/accounts/ReferrerTokenState.d.ts +36 -0
  11. package/build/accounts/ReferrerTokenState.js +116 -0
  12. package/build/accounts/ReferrerTokenState.js.map +1 -0
  13. package/build/accounts/Reserve.d.ts +61 -0
  14. package/build/accounts/Reserve.js +169 -0
  15. package/build/accounts/Reserve.js.map +1 -0
  16. package/build/accounts/ShortUrl.d.ts +23 -0
  17. package/build/accounts/ShortUrl.js +85 -0
  18. package/build/accounts/ShortUrl.js.map +1 -0
  19. package/build/accounts/UserMetadata.d.ts +36 -0
  20. package/build/accounts/UserMetadata.js +116 -0
  21. package/build/accounts/UserMetadata.js.map +1 -0
  22. package/build/accounts/UserState.d.ts +69 -0
  23. package/build/accounts/UserState.js +182 -0
  24. package/build/accounts/UserState.js.map +1 -0
  25. package/build/accounts/index.d.ts +16 -0
  26. package/build/accounts/index.js +20 -0
  27. package/build/accounts/index.js.map +1 -0
  28. package/build/errors/anchor.d.ts +434 -0
  29. package/build/errors/anchor.js +767 -0
  30. package/build/errors/anchor.js.map +1 -0
  31. package/build/errors/custom.d.ts +898 -0
  32. package/build/errors/custom.js +1580 -0
  33. package/build/errors/custom.js.map +1 -0
  34. package/build/errors/index.d.ts +5 -0
  35. package/build/errors/index.js +71 -0
  36. package/build/errors/index.js.map +1 -0
  37. package/build/index.d.ts +4 -0
  38. package/build/index.js +34 -0
  39. package/build/index.js.map +1 -0
  40. package/build/instructions/borrowObligationLiquidity.d.ts +21 -0
  41. package/build/instructions/borrowObligationLiquidity.js +80 -0
  42. package/build/instructions/borrowObligationLiquidity.js.map +1 -0
  43. package/build/instructions/borrowObligationLiquidityV2.d.ts +28 -0
  44. package/build/instructions/borrowObligationLiquidityV2.js +90 -0
  45. package/build/instructions/borrowObligationLiquidityV2.js.map +1 -0
  46. package/build/instructions/deleteReferrerStateAndShortUrl.d.ts +9 -0
  47. package/build/instructions/deleteReferrerStateAndShortUrl.js +20 -0
  48. package/build/instructions/deleteReferrerStateAndShortUrl.js.map +1 -0
  49. package/build/instructions/depositObligationCollateral.d.ts +17 -0
  50. package/build/instructions/depositObligationCollateral.js +64 -0
  51. package/build/instructions/depositObligationCollateral.js.map +1 -0
  52. package/build/instructions/depositReserveLiquidity.d.ts +21 -0
  53. package/build/instructions/depositReserveLiquidity.js +88 -0
  54. package/build/instructions/depositReserveLiquidity.js.map +1 -0
  55. package/build/instructions/depositReserveLiquidityAndObligationCollateral.d.ts +23 -0
  56. package/build/instructions/depositReserveLiquidityAndObligationCollateral.js +94 -0
  57. package/build/instructions/depositReserveLiquidityAndObligationCollateral.js.map +1 -0
  58. package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.d.ts +30 -0
  59. package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js +100 -0
  60. package/build/instructions/depositReserveLiquidityAndObligationCollateralV2.js.map +1 -0
  61. package/build/instructions/flashBorrowReserveLiquidity.d.ts +21 -0
  62. package/build/instructions/flashBorrowReserveLiquidity.js +80 -0
  63. package/build/instructions/flashBorrowReserveLiquidity.js.map +1 -0
  64. package/build/instructions/flashRepayReserveLiquidity.d.ts +22 -0
  65. package/build/instructions/flashRepayReserveLiquidity.js +77 -0
  66. package/build/instructions/flashRepayReserveLiquidity.js.map +1 -0
  67. package/build/instructions/idlMissingTypes.d.ts +18 -0
  68. package/build/instructions/idlMissingTypes.js +62 -0
  69. package/build/instructions/idlMissingTypes.js.map +1 -0
  70. package/build/instructions/index.d.ts +74 -0
  71. package/build/instructions/index.js +78 -0
  72. package/build/instructions/index.js.map +1 -0
  73. package/build/instructions/initFarmsForReserve.d.ts +18 -0
  74. package/build/instructions/initFarmsForReserve.js +62 -0
  75. package/build/instructions/initFarmsForReserve.js.map +1 -0
  76. package/build/instructions/initLendingMarket.d.ts +13 -0
  77. package/build/instructions/initLendingMarket.js +53 -0
  78. package/build/instructions/initLendingMarket.js.map +1 -0
  79. package/build/instructions/initObligation.d.ts +18 -0
  80. package/build/instructions/initObligation.js +54 -0
  81. package/build/instructions/initObligation.js.map +1 -0
  82. package/build/instructions/initObligationFarmsForReserve.d.ts +19 -0
  83. package/build/instructions/initObligationFarmsForReserve.js +59 -0
  84. package/build/instructions/initObligationFarmsForReserve.js.map +1 -0
  85. package/build/instructions/initReferrerStateAndShortUrl.d.ts +14 -0
  86. package/build/instructions/initReferrerStateAndShortUrl.js +54 -0
  87. package/build/instructions/initReferrerStateAndShortUrl.js.map +1 -0
  88. package/build/instructions/initReferrerTokenState.d.ts +14 -0
  89. package/build/instructions/initReferrerTokenState.js +50 -0
  90. package/build/instructions/initReferrerTokenState.js.map +1 -0
  91. package/build/instructions/initReserve.d.ts +17 -0
  92. package/build/instructions/initReserve.js +56 -0
  93. package/build/instructions/initReserve.js.map +1 -0
  94. package/build/instructions/initUserMetadata.d.ts +14 -0
  95. package/build/instructions/initUserMetadata.js +54 -0
  96. package/build/instructions/initUserMetadata.js.map +1 -0
  97. package/build/instructions/liquidateObligationAndRedeemReserveCollateral.d.ts +31 -0
  98. package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js +126 -0
  99. package/build/instructions/liquidateObligationAndRedeemReserveCollateral.js.map +1 -0
  100. package/build/instructions/redeemFees.d.ts +11 -0
  101. package/build/instructions/redeemFees.js +38 -0
  102. package/build/instructions/redeemFees.js.map +1 -0
  103. package/build/instructions/redeemReserveCollateral.d.ts +21 -0
  104. package/build/instructions/redeemReserveCollateral.js +92 -0
  105. package/build/instructions/redeemReserveCollateral.js.map +1 -0
  106. package/build/instructions/refreshObligation.d.ts +6 -0
  107. package/build/instructions/refreshObligation.js +17 -0
  108. package/build/instructions/refreshObligation.js.map +1 -0
  109. package/build/instructions/refreshObligationFarmsForReserve.d.ts +18 -0
  110. package/build/instructions/refreshObligationFarmsForReserve.js +62 -0
  111. package/build/instructions/refreshObligationFarmsForReserve.js.map +1 -0
  112. package/build/instructions/refreshReserve.d.ts +10 -0
  113. package/build/instructions/refreshReserve.js +29 -0
  114. package/build/instructions/refreshReserve.js.map +1 -0
  115. package/build/instructions/refreshReservesBatch.d.ts +6 -0
  116. package/build/instructions/refreshReservesBatch.js +43 -0
  117. package/build/instructions/refreshReservesBatch.js.map +1 -0
  118. package/build/instructions/repayObligationLiquidity.d.ts +18 -0
  119. package/build/instructions/repayObligationLiquidity.js +65 -0
  120. package/build/instructions/repayObligationLiquidity.js.map +1 -0
  121. package/build/instructions/repayObligationLiquidityV2.d.ts +26 -0
  122. package/build/instructions/repayObligationLiquidityV2.js +76 -0
  123. package/build/instructions/repayObligationLiquidityV2.js.map +1 -0
  124. package/build/instructions/requestElevationGroup.d.ts +11 -0
  125. package/build/instructions/requestElevationGroup.js +47 -0
  126. package/build/instructions/requestElevationGroup.js.map +1 -0
  127. package/build/instructions/socializeLoss.d.ts +14 -0
  128. package/build/instructions/socializeLoss.js +53 -0
  129. package/build/instructions/socializeLoss.js.map +1 -0
  130. package/build/instructions/updateLendingMarket.d.ts +12 -0
  131. package/build/instructions/updateLendingMarket.js +47 -0
  132. package/build/instructions/updateLendingMarket.js.map +1 -0
  133. package/build/instructions/updateLendingMarketOwner.d.ts +6 -0
  134. package/build/instructions/updateLendingMarketOwner.js +21 -0
  135. package/build/instructions/updateLendingMarketOwner.js.map +1 -0
  136. package/build/instructions/updateReserveConfig.d.ts +14 -0
  137. package/build/instructions/updateReserveConfig.js +49 -0
  138. package/build/instructions/updateReserveConfig.js.map +1 -0
  139. package/build/instructions/withdrawObligationCollateral.d.ts +18 -0
  140. package/build/instructions/withdrawObligationCollateral.js +69 -0
  141. package/build/instructions/withdrawObligationCollateral.js.map +1 -0
  142. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.d.ts +23 -0
  143. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js +98 -0
  144. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.js.map +1 -0
  145. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.d.ts +30 -0
  146. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js +104 -0
  147. package/build/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.js.map +1 -0
  148. package/build/instructions/withdrawProtocolFee.d.ts +17 -0
  149. package/build/instructions/withdrawProtocolFee.js +64 -0
  150. package/build/instructions/withdrawProtocolFee.js.map +1 -0
  151. package/build/instructions/withdrawReferrerFees.d.ts +13 -0
  152. package/build/instructions/withdrawReferrerFees.js +40 -0
  153. package/build/instructions/withdrawReferrerFees.js.map +1 -0
  154. package/build/kamino_lending.d.ts +3937 -0
  155. package/build/kamino_lending.js +3940 -0
  156. package/build/kamino_lending.js.map +1 -0
  157. package/build/kamino_lending.json +6352 -0
  158. package/build/programId.d.ts +3 -0
  159. package/build/programId.js +9 -0
  160. package/build/programId.js.map +1 -0
  161. package/build/types/AssetTier.d.ts +44 -0
  162. package/build/types/AssetTier.js +122 -0
  163. package/build/types/AssetTier.js.map +1 -0
  164. package/build/types/BigFractionBytes.d.ts +26 -0
  165. package/build/types/BigFractionBytes.js +72 -0
  166. package/build/types/BigFractionBytes.js.map +1 -0
  167. package/build/types/BorrowRateCurve.d.ts +27 -0
  168. package/build/types/BorrowRateCurve.js +63 -0
  169. package/build/types/BorrowRateCurve.js.map +1 -0
  170. package/build/types/CurvePoint.d.ts +25 -0
  171. package/build/types/CurvePoint.js +68 -0
  172. package/build/types/CurvePoint.js.map +1 -0
  173. package/build/types/ElevationGroup.d.ts +62 -0
  174. package/build/types/ElevationGroup.js +125 -0
  175. package/build/types/ElevationGroup.js.map +1 -0
  176. package/build/types/FeeCalculation.d.ts +31 -0
  177. package/build/types/FeeCalculation.js +95 -0
  178. package/build/types/FeeCalculation.js.map +1 -0
  179. package/build/types/InitObligationArgs.d.ts +25 -0
  180. package/build/types/InitObligationArgs.js +68 -0
  181. package/build/types/InitObligationArgs.js.map +1 -0
  182. package/build/types/LastUpdate.d.ts +36 -0
  183. package/build/types/LastUpdate.js +84 -0
  184. package/build/types/LastUpdate.js.map +1 -0
  185. package/build/types/ObligationCollateral.d.ts +43 -0
  186. package/build/types/ObligationCollateral.js +98 -0
  187. package/build/types/ObligationCollateral.js.map +1 -0
  188. package/build/types/ObligationLiquidity.d.ts +64 -0
  189. package/build/types/ObligationLiquidity.js +123 -0
  190. package/build/types/ObligationLiquidity.js.map +1 -0
  191. package/build/types/PriceHeuristic.d.ts +32 -0
  192. package/build/types/PriceHeuristic.js +78 -0
  193. package/build/types/PriceHeuristic.js.map +1 -0
  194. package/build/types/PythConfiguration.d.ts +22 -0
  195. package/build/types/PythConfiguration.js +63 -0
  196. package/build/types/PythConfiguration.js.map +1 -0
  197. package/build/types/ReserveCollateral.d.ts +43 -0
  198. package/build/types/ReserveCollateral.js +97 -0
  199. package/build/types/ReserveCollateral.js.map +1 -0
  200. package/build/types/ReserveConfig.d.ts +246 -0
  201. package/build/types/ReserveConfig.js +269 -0
  202. package/build/types/ReserveConfig.js.map +1 -0
  203. package/build/types/ReserveFarmKind.d.ts +31 -0
  204. package/build/types/ReserveFarmKind.js +98 -0
  205. package/build/types/ReserveFarmKind.js.map +1 -0
  206. package/build/types/ReserveFees.d.ts +32 -0
  207. package/build/types/ReserveFees.js +82 -0
  208. package/build/types/ReserveFees.js.map +1 -0
  209. package/build/types/ReserveLiquidity.d.ts +114 -0
  210. package/build/types/ReserveLiquidity.js +191 -0
  211. package/build/types/ReserveLiquidity.js.map +1 -0
  212. package/build/types/ReserveStatus.d.ts +44 -0
  213. package/build/types/ReserveStatus.js +122 -0
  214. package/build/types/ReserveStatus.js.map +1 -0
  215. package/build/types/ScopeConfiguration.d.ts +32 -0
  216. package/build/types/ScopeConfiguration.js +79 -0
  217. package/build/types/ScopeConfiguration.js.map +1 -0
  218. package/build/types/SwitchboardConfiguration.d.ts +27 -0
  219. package/build/types/SwitchboardConfiguration.js +69 -0
  220. package/build/types/SwitchboardConfiguration.js.map +1 -0
  221. package/build/types/TokenInfo.d.ts +99 -0
  222. package/build/types/TokenInfo.js +145 -0
  223. package/build/types/TokenInfo.js.map +1 -0
  224. package/build/types/UpdateConfigMode.d.ts +616 -0
  225. package/build/types/UpdateConfigMode.js +1178 -0
  226. package/build/types/UpdateConfigMode.js.map +1 -0
  227. package/build/types/UpdateLendingMarketConfigValue.d.ts +177 -0
  228. package/build/types/UpdateLendingMarketConfigValue.js +312 -0
  229. package/build/types/UpdateLendingMarketConfigValue.js.map +1 -0
  230. package/build/types/UpdateLendingMarketMode.d.ts +239 -0
  231. package/build/types/UpdateLendingMarketMode.js +482 -0
  232. package/build/types/UpdateLendingMarketMode.js.map +1 -0
  233. package/build/types/WithdrawalCaps.d.ts +37 -0
  234. package/build/types/WithdrawalCaps.js +89 -0
  235. package/build/types/WithdrawalCaps.js.map +1 -0
  236. package/build/types/index.d.ts +64 -0
  237. package/build/types/index.js +77 -0
  238. package/build/types/index.js.map +1 -0
  239. package/package.json +44 -0
  240. package/src/accounts/LendingMarket.ts +292 -0
  241. package/src/accounts/Obligation.ts +282 -0
  242. package/src/accounts/ReferrerState.ts +90 -0
  243. package/src/accounts/ReferrerTokenState.ts +126 -0
  244. package/src/accounts/Reserve.ts +218 -0
  245. package/src/accounts/ShortUrl.ts +86 -0
  246. package/src/accounts/UserMetadata.ts +126 -0
  247. package/src/accounts/UserState.ts +210 -0
  248. package/src/accounts/index.ts +19 -0
  249. package/src/errors/anchor.ts +773 -0
  250. package/src/errors/custom.ts +1633 -0
  251. package/src/errors/index.ts +62 -0
  252. package/src/index.ts +5 -0
  253. package/src/instructions/borrowObligationLiquidity.ts +81 -0
  254. package/src/instructions/borrowObligationLiquidityV2.ts +103 -0
  255. package/src/instructions/deleteReferrerStateAndShortUrl.ts +27 -0
  256. package/src/instructions/depositObligationCollateral.ts +61 -0
  257. package/src/instructions/depositReserveLiquidity.ts +89 -0
  258. package/src/instructions/depositReserveLiquidityAndObligationCollateral.ts +97 -0
  259. package/src/instructions/depositReserveLiquidityAndObligationCollateralV2.ts +119 -0
  260. package/src/instructions/flashBorrowReserveLiquidity.ts +81 -0
  261. package/src/instructions/flashRepayReserveLiquidity.ts +79 -0
  262. package/src/instructions/idlMissingTypes.ts +59 -0
  263. package/src/instructions/index.ts +158 -0
  264. package/src/instructions/initFarmsForReserve.ts +60 -0
  265. package/src/instructions/initLendingMarket.ts +46 -0
  266. package/src/instructions/initObligation.ts +51 -0
  267. package/src/instructions/initObligationFarmsForReserve.ts +58 -0
  268. package/src/instructions/initReferrerStateAndShortUrl.ts +48 -0
  269. package/src/instructions/initReferrerTokenState.ts +44 -0
  270. package/src/instructions/initReserve.ts +68 -0
  271. package/src/instructions/initUserMetadata.ts +48 -0
  272. package/src/instructions/liquidateObligationAndRedeemReserveCollateral.ts +137 -0
  273. package/src/instructions/redeemFees.ts +44 -0
  274. package/src/instructions/redeemReserveCollateral.ts +93 -0
  275. package/src/instructions/refreshObligation.ts +18 -0
  276. package/src/instructions/refreshObligationFarmsForReserve.ts +60 -0
  277. package/src/instructions/refreshReserve.ts +34 -0
  278. package/src/instructions/refreshReservesBatch.ts +24 -0
  279. package/src/instructions/repayObligationLiquidity.ts +63 -0
  280. package/src/instructions/repayObligationLiquidityV2.ts +87 -0
  281. package/src/instructions/requestElevationGroup.ts +38 -0
  282. package/src/instructions/socializeLoss.ts +47 -0
  283. package/src/instructions/updateLendingMarket.ts +39 -0
  284. package/src/instructions/updateLendingMarketOwner.ts +25 -0
  285. package/src/instructions/updateReserveConfig.ts +43 -0
  286. package/src/instructions/withdrawObligationCollateral.ts +67 -0
  287. package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateral.ts +101 -0
  288. package/src/instructions/withdrawObligationCollateralAndRedeemReserveCollateralV2.ts +123 -0
  289. package/src/instructions/withdrawProtocolFee.ts +61 -0
  290. package/src/instructions/withdrawReferrerFees.ts +48 -0
  291. package/src/kamino_lending.json +6352 -0
  292. package/src/kamino_lending.ts +7873 -0
  293. package/src/programId.ts +9 -0
  294. package/src/types/AssetTier.ts +116 -0
  295. package/src/types/BigFractionBytes.ts +59 -0
  296. package/src/types/BorrowRateCurve.ts +53 -0
  297. package/src/types/CurvePoint.ts +58 -0
  298. package/src/types/ElevationGroup.ts +129 -0
  299. package/src/types/FeeCalculation.ts +83 -0
  300. package/src/types/InitObligationArgs.ts +58 -0
  301. package/src/types/LastUpdate.ts +78 -0
  302. package/src/types/ObligationCollateral.ts +100 -0
  303. package/src/types/ObligationLiquidity.ts +140 -0
  304. package/src/types/PriceHeuristic.ts +72 -0
  305. package/src/types/PythConfiguration.ts +53 -0
  306. package/src/types/ReserveCollateral.ts +94 -0
  307. package/src/types/ReserveConfig.ts +349 -0
  308. package/src/types/ReserveFarmKind.ts +90 -0
  309. package/src/types/ReserveFees.ts +76 -0
  310. package/src/types/ReserveLiquidity.ts +219 -0
  311. package/src/types/ReserveStatus.ts +120 -0
  312. package/src/types/ScopeConfiguration.ts +76 -0
  313. package/src/types/SwitchboardConfiguration.ts +64 -0
  314. package/src/types/TokenInfo.ts +172 -0
  315. package/src/types/UpdateConfigMode.ts +1440 -0
  316. package/src/types/UpdateLendingMarketConfigValue.ts +376 -0
  317. package/src/types/UpdateLendingMarketMode.ts +570 -0
  318. package/src/types/WithdrawalCaps.ts +85 -0
  319. package/src/types/index.ts +275 -0
  320. package/tsconfig.json +17 -0
@@ -0,0 +1,81 @@
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 { PROGRAM_ID } from "../programId"
5
+
6
+ export interface FlashBorrowReserveLiquidityArgs {
7
+ liquidityAmount: BN
8
+ }
9
+
10
+ export interface FlashBorrowReserveLiquidityAccounts {
11
+ userTransferAuthority: PublicKey
12
+ lendingMarketAuthority: PublicKey
13
+ lendingMarket: PublicKey
14
+ reserve: PublicKey
15
+ reserveLiquidityMint: PublicKey
16
+ reserveSourceLiquidity: PublicKey
17
+ userDestinationLiquidity: PublicKey
18
+ reserveLiquidityFeeReceiver: PublicKey
19
+ referrerTokenState: PublicKey
20
+ referrerAccount: PublicKey
21
+ sysvarInfo: PublicKey
22
+ tokenProgram: PublicKey
23
+ }
24
+
25
+ export const layout = borsh.struct([borsh.u64("liquidityAmount")])
26
+
27
+ export function flashBorrowReserveLiquidity(
28
+ args: FlashBorrowReserveLiquidityArgs,
29
+ accounts: FlashBorrowReserveLiquidityAccounts,
30
+ programId: PublicKey = PROGRAM_ID,
31
+ ) {
32
+ const keys: Array<AccountMeta> = [
33
+ {
34
+ pubkey: accounts.userTransferAuthority,
35
+ isSigner: true,
36
+ isWritable: false,
37
+ },
38
+ {
39
+ pubkey: accounts.lendingMarketAuthority,
40
+ isSigner: false,
41
+ isWritable: false,
42
+ },
43
+ { pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
44
+ { pubkey: accounts.reserve, isSigner: false, isWritable: true },
45
+ {
46
+ pubkey: accounts.reserveLiquidityMint,
47
+ isSigner: false,
48
+ isWritable: false,
49
+ },
50
+ {
51
+ pubkey: accounts.reserveSourceLiquidity,
52
+ isSigner: false,
53
+ isWritable: true,
54
+ },
55
+ {
56
+ pubkey: accounts.userDestinationLiquidity,
57
+ isSigner: false,
58
+ isWritable: true,
59
+ },
60
+ {
61
+ pubkey: accounts.reserveLiquidityFeeReceiver,
62
+ isSigner: false,
63
+ isWritable: true,
64
+ },
65
+ { pubkey: accounts.referrerTokenState, isSigner: false, isWritable: true },
66
+ { pubkey: accounts.referrerAccount, isSigner: false, isWritable: true },
67
+ { pubkey: accounts.sysvarInfo, isSigner: false, isWritable: false },
68
+ { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
69
+ ]
70
+ const identifier = Buffer.from([135, 231, 52, 167, 7, 52, 212, 193])
71
+ const buffer = Buffer.alloc(1000)
72
+ const len = layout.encode(
73
+ {
74
+ liquidityAmount: args.liquidityAmount,
75
+ },
76
+ buffer,
77
+ )
78
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
79
+ const ix = new TransactionInstruction({ keys, programId, data })
80
+ return ix
81
+ }
@@ -0,0 +1,79 @@
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 { PROGRAM_ID } from "../programId"
5
+
6
+ export interface FlashRepayReserveLiquidityArgs {
7
+ liquidityAmount: BN
8
+ borrowInstructionIndex: number
9
+ }
10
+
11
+ export interface FlashRepayReserveLiquidityAccounts {
12
+ userTransferAuthority: PublicKey
13
+ lendingMarketAuthority: PublicKey
14
+ lendingMarket: PublicKey
15
+ reserve: PublicKey
16
+ reserveLiquidityMint: PublicKey
17
+ reserveDestinationLiquidity: PublicKey
18
+ userSourceLiquidity: PublicKey
19
+ reserveLiquidityFeeReceiver: PublicKey
20
+ referrerTokenState: PublicKey
21
+ referrerAccount: PublicKey
22
+ sysvarInfo: PublicKey
23
+ tokenProgram: PublicKey
24
+ }
25
+
26
+ export const layout = borsh.struct([borsh.u64("liquidityAmount"), borsh.u8("borrowInstructionIndex")])
27
+
28
+ export function flashRepayReserveLiquidity(
29
+ args: FlashRepayReserveLiquidityArgs,
30
+ accounts: FlashRepayReserveLiquidityAccounts,
31
+ programId: PublicKey = PROGRAM_ID,
32
+ ) {
33
+ const keys: Array<AccountMeta> = [
34
+ {
35
+ pubkey: accounts.userTransferAuthority,
36
+ isSigner: true,
37
+ isWritable: false,
38
+ },
39
+ {
40
+ pubkey: accounts.lendingMarketAuthority,
41
+ isSigner: false,
42
+ isWritable: false,
43
+ },
44
+ { pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
45
+ { pubkey: accounts.reserve, isSigner: false, isWritable: true },
46
+ {
47
+ pubkey: accounts.reserveLiquidityMint,
48
+ isSigner: false,
49
+ isWritable: false,
50
+ },
51
+ {
52
+ pubkey: accounts.reserveDestinationLiquidity,
53
+ isSigner: false,
54
+ isWritable: true,
55
+ },
56
+ { pubkey: accounts.userSourceLiquidity, isSigner: false, isWritable: true },
57
+ {
58
+ pubkey: accounts.reserveLiquidityFeeReceiver,
59
+ isSigner: false,
60
+ isWritable: true,
61
+ },
62
+ { pubkey: accounts.referrerTokenState, isSigner: false, isWritable: true },
63
+ { pubkey: accounts.referrerAccount, isSigner: false, isWritable: true },
64
+ { pubkey: accounts.sysvarInfo, isSigner: false, isWritable: false },
65
+ { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
66
+ ]
67
+ const identifier = Buffer.from([185, 117, 0, 203, 96, 245, 180, 186])
68
+ const buffer = Buffer.alloc(1000)
69
+ const len = layout.encode(
70
+ {
71
+ liquidityAmount: args.liquidityAmount,
72
+ borrowInstructionIndex: args.borrowInstructionIndex,
73
+ },
74
+ buffer,
75
+ )
76
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
77
+ const ix = new TransactionInstruction({ keys, programId, data })
78
+ return ix
79
+ }
@@ -0,0 +1,59 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import { PROGRAM_ID } from "../programId"
5
+
6
+ export interface IdlMissingTypesArgs {
7
+ reserveFarmKind: types.ReserveFarmKindKind
8
+ assetTier: types.AssetTierKind
9
+ feeCalculation: types.FeeCalculationKind
10
+ reserveStatus: types.ReserveStatusKind
11
+ updateConfigMode: types.UpdateConfigModeKind
12
+ updateLendingMarketConfigValue: types.UpdateLendingMarketConfigValueKind
13
+ updateLendingMarketConfigMode: types.UpdateLendingMarketModeKind
14
+ }
15
+
16
+ export interface IdlMissingTypesAccounts {
17
+ lendingMarketOwner: PublicKey
18
+ lendingMarket: PublicKey
19
+ reserve: PublicKey
20
+ }
21
+
22
+ export const layout = borsh.struct([
23
+ types.ReserveFarmKind.layout("reserveFarmKind"),
24
+ types.AssetTier.layout("assetTier"),
25
+ types.FeeCalculation.layout("feeCalculation"),
26
+ types.ReserveStatus.layout("reserveStatus"),
27
+ types.UpdateConfigMode.layout("updateConfigMode"),
28
+ types.UpdateLendingMarketConfigValue.layout("updateLendingMarketConfigValue"),
29
+ types.UpdateLendingMarketMode.layout("updateLendingMarketConfigMode"),
30
+ ])
31
+
32
+ export function idlMissingTypes(
33
+ args: IdlMissingTypesArgs,
34
+ accounts: IdlMissingTypesAccounts,
35
+ programId: PublicKey = PROGRAM_ID,
36
+ ) {
37
+ const keys: Array<AccountMeta> = [
38
+ { pubkey: accounts.lendingMarketOwner, isSigner: true, isWritable: false },
39
+ { pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
40
+ { pubkey: accounts.reserve, isSigner: false, isWritable: true },
41
+ ]
42
+ const identifier = Buffer.from([130, 80, 38, 153, 80, 212, 182, 253])
43
+ const buffer = Buffer.alloc(1000)
44
+ const len = layout.encode(
45
+ {
46
+ reserveFarmKind: args.reserveFarmKind.toEncodable(),
47
+ assetTier: args.assetTier.toEncodable(),
48
+ feeCalculation: args.feeCalculation.toEncodable(),
49
+ reserveStatus: args.reserveStatus.toEncodable(),
50
+ updateConfigMode: args.updateConfigMode.toEncodable(),
51
+ updateLendingMarketConfigValue: args.updateLendingMarketConfigValue.toEncodable(),
52
+ updateLendingMarketConfigMode: args.updateLendingMarketConfigMode.toEncodable(),
53
+ },
54
+ buffer,
55
+ )
56
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
57
+ const ix = new TransactionInstruction({ keys, programId, data })
58
+ return ix
59
+ }
@@ -0,0 +1,158 @@
1
+ export { initLendingMarket } from "./initLendingMarket"
2
+ export type {
3
+ InitLendingMarketArgs,
4
+ InitLendingMarketAccounts,
5
+ } from "./initLendingMarket"
6
+ export { updateLendingMarket } from "./updateLendingMarket"
7
+ export type {
8
+ UpdateLendingMarketArgs,
9
+ UpdateLendingMarketAccounts,
10
+ } from "./updateLendingMarket"
11
+ export { updateLendingMarketOwner } from "./updateLendingMarketOwner"
12
+ export type { UpdateLendingMarketOwnerAccounts } from "./updateLendingMarketOwner"
13
+ export { initReserve } from "./initReserve"
14
+ export type { InitReserveAccounts } from "./initReserve"
15
+ export { initFarmsForReserve } from "./initFarmsForReserve"
16
+ export type {
17
+ InitFarmsForReserveArgs,
18
+ InitFarmsForReserveAccounts,
19
+ } from "./initFarmsForReserve"
20
+ export { updateReserveConfig } from "./updateReserveConfig"
21
+ export type {
22
+ UpdateReserveConfigArgs,
23
+ UpdateReserveConfigAccounts,
24
+ } from "./updateReserveConfig"
25
+ export { redeemFees } from "./redeemFees"
26
+ export type { RedeemFeesAccounts } from "./redeemFees"
27
+ export { socializeLoss } from "./socializeLoss"
28
+ export type { SocializeLossArgs, SocializeLossAccounts } from "./socializeLoss"
29
+ export { withdrawProtocolFee } from "./withdrawProtocolFee"
30
+ export type {
31
+ WithdrawProtocolFeeArgs,
32
+ WithdrawProtocolFeeAccounts,
33
+ } from "./withdrawProtocolFee"
34
+ export { refreshReserve } from "./refreshReserve"
35
+ export type { RefreshReserveAccounts } from "./refreshReserve"
36
+ export { refreshReservesBatch } from "./refreshReservesBatch"
37
+ export type { RefreshReservesBatchArgs } from "./refreshReservesBatch"
38
+ export { depositReserveLiquidity } from "./depositReserveLiquidity"
39
+ export type {
40
+ DepositReserveLiquidityArgs,
41
+ DepositReserveLiquidityAccounts,
42
+ } from "./depositReserveLiquidity"
43
+ export { redeemReserveCollateral } from "./redeemReserveCollateral"
44
+ export type {
45
+ RedeemReserveCollateralArgs,
46
+ RedeemReserveCollateralAccounts,
47
+ } from "./redeemReserveCollateral"
48
+ export { initObligation } from "./initObligation"
49
+ export type {
50
+ InitObligationArgs,
51
+ InitObligationAccounts,
52
+ } from "./initObligation"
53
+ export { initObligationFarmsForReserve } from "./initObligationFarmsForReserve"
54
+ export type {
55
+ InitObligationFarmsForReserveArgs,
56
+ InitObligationFarmsForReserveAccounts,
57
+ } from "./initObligationFarmsForReserve"
58
+ export { refreshObligationFarmsForReserve } from "./refreshObligationFarmsForReserve"
59
+ export type {
60
+ RefreshObligationFarmsForReserveArgs,
61
+ RefreshObligationFarmsForReserveAccounts,
62
+ } from "./refreshObligationFarmsForReserve"
63
+ export { refreshObligation } from "./refreshObligation"
64
+ export type { RefreshObligationAccounts } from "./refreshObligation"
65
+ export { depositObligationCollateral } from "./depositObligationCollateral"
66
+ export type {
67
+ DepositObligationCollateralArgs,
68
+ DepositObligationCollateralAccounts,
69
+ } from "./depositObligationCollateral"
70
+ export { withdrawObligationCollateral } from "./withdrawObligationCollateral"
71
+ export type {
72
+ WithdrawObligationCollateralArgs,
73
+ WithdrawObligationCollateralAccounts,
74
+ } from "./withdrawObligationCollateral"
75
+ export { borrowObligationLiquidity } from "./borrowObligationLiquidity"
76
+ export type {
77
+ BorrowObligationLiquidityArgs,
78
+ BorrowObligationLiquidityAccounts,
79
+ } from "./borrowObligationLiquidity"
80
+ export { borrowObligationLiquidityV2 } from "./borrowObligationLiquidityV2"
81
+ export type {
82
+ BorrowObligationLiquidityV2Args,
83
+ BorrowObligationLiquidityV2Accounts,
84
+ } from "./borrowObligationLiquidityV2"
85
+ export { repayObligationLiquidity } from "./repayObligationLiquidity"
86
+ export type {
87
+ RepayObligationLiquidityArgs,
88
+ RepayObligationLiquidityAccounts,
89
+ } from "./repayObligationLiquidity"
90
+ export { repayObligationLiquidityV2 } from "./repayObligationLiquidityV2"
91
+ export type {
92
+ RepayObligationLiquidityV2Args,
93
+ RepayObligationLiquidityV2Accounts,
94
+ } from "./repayObligationLiquidityV2"
95
+ export { depositReserveLiquidityAndObligationCollateral } from "./depositReserveLiquidityAndObligationCollateral"
96
+ export type {
97
+ DepositReserveLiquidityAndObligationCollateralArgs,
98
+ DepositReserveLiquidityAndObligationCollateralAccounts,
99
+ } from "./depositReserveLiquidityAndObligationCollateral"
100
+ export { depositReserveLiquidityAndObligationCollateralV2 } from "./depositReserveLiquidityAndObligationCollateralV2"
101
+ export type {
102
+ DepositReserveLiquidityAndObligationCollateralV2Args,
103
+ DepositReserveLiquidityAndObligationCollateralV2Accounts,
104
+ } from "./depositReserveLiquidityAndObligationCollateralV2"
105
+ export { withdrawObligationCollateralAndRedeemReserveCollateral } from "./withdrawObligationCollateralAndRedeemReserveCollateral"
106
+ export type {
107
+ WithdrawObligationCollateralAndRedeemReserveCollateralArgs,
108
+ WithdrawObligationCollateralAndRedeemReserveCollateralAccounts,
109
+ } from "./withdrawObligationCollateralAndRedeemReserveCollateral"
110
+ export { withdrawObligationCollateralAndRedeemReserveCollateralV2 } from "./withdrawObligationCollateralAndRedeemReserveCollateralV2"
111
+ export type {
112
+ WithdrawObligationCollateralAndRedeemReserveCollateralV2Args,
113
+ WithdrawObligationCollateralAndRedeemReserveCollateralV2Accounts,
114
+ } from "./withdrawObligationCollateralAndRedeemReserveCollateralV2"
115
+ export { liquidateObligationAndRedeemReserveCollateral } from "./liquidateObligationAndRedeemReserveCollateral"
116
+ export type {
117
+ LiquidateObligationAndRedeemReserveCollateralArgs,
118
+ LiquidateObligationAndRedeemReserveCollateralAccounts,
119
+ } from "./liquidateObligationAndRedeemReserveCollateral"
120
+ export { flashRepayReserveLiquidity } from "./flashRepayReserveLiquidity"
121
+ export type {
122
+ FlashRepayReserveLiquidityArgs,
123
+ FlashRepayReserveLiquidityAccounts,
124
+ } from "./flashRepayReserveLiquidity"
125
+ export { flashBorrowReserveLiquidity } from "./flashBorrowReserveLiquidity"
126
+ export type {
127
+ FlashBorrowReserveLiquidityArgs,
128
+ FlashBorrowReserveLiquidityAccounts,
129
+ } from "./flashBorrowReserveLiquidity"
130
+ export { requestElevationGroup } from "./requestElevationGroup"
131
+ export type {
132
+ RequestElevationGroupArgs,
133
+ RequestElevationGroupAccounts,
134
+ } from "./requestElevationGroup"
135
+ export { initReferrerTokenState } from "./initReferrerTokenState"
136
+ export type {
137
+ InitReferrerTokenStateArgs,
138
+ InitReferrerTokenStateAccounts,
139
+ } from "./initReferrerTokenState"
140
+ export { initUserMetadata } from "./initUserMetadata"
141
+ export type {
142
+ InitUserMetadataArgs,
143
+ InitUserMetadataAccounts,
144
+ } from "./initUserMetadata"
145
+ export { withdrawReferrerFees } from "./withdrawReferrerFees"
146
+ export type { WithdrawReferrerFeesAccounts } from "./withdrawReferrerFees"
147
+ export { initReferrerStateAndShortUrl } from "./initReferrerStateAndShortUrl"
148
+ export type {
149
+ InitReferrerStateAndShortUrlArgs,
150
+ InitReferrerStateAndShortUrlAccounts,
151
+ } from "./initReferrerStateAndShortUrl"
152
+ export { deleteReferrerStateAndShortUrl } from "./deleteReferrerStateAndShortUrl"
153
+ export type { DeleteReferrerStateAndShortUrlAccounts } from "./deleteReferrerStateAndShortUrl"
154
+ export { idlMissingTypes } from "./idlMissingTypes"
155
+ export type {
156
+ IdlMissingTypesArgs,
157
+ IdlMissingTypesAccounts,
158
+ } from "./idlMissingTypes"
@@ -0,0 +1,60 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import { PROGRAM_ID } from "../programId"
4
+
5
+ export interface InitFarmsForReserveArgs {
6
+ mode: number
7
+ }
8
+
9
+ export interface InitFarmsForReserveAccounts {
10
+ lendingMarketOwner: PublicKey
11
+ lendingMarket: PublicKey
12
+ lendingMarketAuthority: PublicKey
13
+ reserve: PublicKey
14
+ farmsProgram: PublicKey
15
+ farmsGlobalConfig: PublicKey
16
+ farmState: PublicKey
17
+ farmsVaultAuthority: PublicKey
18
+ rent: PublicKey
19
+ systemProgram: PublicKey
20
+ }
21
+
22
+ export const layout = borsh.struct([borsh.u8("mode")])
23
+
24
+ export function initFarmsForReserve(
25
+ args: InitFarmsForReserveArgs,
26
+ accounts: InitFarmsForReserveAccounts,
27
+ programId: PublicKey = PROGRAM_ID,
28
+ ) {
29
+ const keys: Array<AccountMeta> = [
30
+ { pubkey: accounts.lendingMarketOwner, isSigner: true, isWritable: true },
31
+ { pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
32
+ {
33
+ pubkey: accounts.lendingMarketAuthority,
34
+ isSigner: false,
35
+ isWritable: true,
36
+ },
37
+ { pubkey: accounts.reserve, isSigner: false, isWritable: true },
38
+ { pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
39
+ { pubkey: accounts.farmsGlobalConfig, isSigner: false, isWritable: false },
40
+ { pubkey: accounts.farmState, isSigner: false, isWritable: true },
41
+ {
42
+ pubkey: accounts.farmsVaultAuthority,
43
+ isSigner: false,
44
+ isWritable: false,
45
+ },
46
+ { pubkey: accounts.rent, isSigner: false, isWritable: false },
47
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
48
+ ]
49
+ const identifier = Buffer.from([218, 6, 62, 233, 1, 33, 232, 82])
50
+ const buffer = Buffer.alloc(1000)
51
+ const len = layout.encode(
52
+ {
53
+ mode: args.mode,
54
+ },
55
+ buffer,
56
+ )
57
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
58
+ const ix = new TransactionInstruction({ keys, programId, data })
59
+ return ix
60
+ }
@@ -0,0 +1,46 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import { PROGRAM_ID } from "../programId"
4
+
5
+ export interface InitLendingMarketArgs {
6
+ quoteCurrency: Array<number>
7
+ }
8
+
9
+ export interface InitLendingMarketAccounts {
10
+ lendingMarketOwner: PublicKey
11
+ lendingMarket: PublicKey
12
+ lendingMarketAuthority: PublicKey
13
+ systemProgram: PublicKey
14
+ rent: PublicKey
15
+ }
16
+
17
+ export const layout = borsh.struct([borsh.array(borsh.u8(), 32, "quoteCurrency")])
18
+
19
+ export function initLendingMarket(
20
+ args: InitLendingMarketArgs,
21
+ accounts: InitLendingMarketAccounts,
22
+ programId: PublicKey = PROGRAM_ID,
23
+ ) {
24
+ const keys: Array<AccountMeta> = [
25
+ { pubkey: accounts.lendingMarketOwner, isSigner: true, isWritable: true },
26
+ { pubkey: accounts.lendingMarket, isSigner: false, isWritable: true },
27
+ {
28
+ pubkey: accounts.lendingMarketAuthority,
29
+ isSigner: false,
30
+ isWritable: false,
31
+ },
32
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
33
+ { pubkey: accounts.rent, isSigner: false, isWritable: false },
34
+ ]
35
+ const identifier = Buffer.from([34, 162, 116, 14, 101, 137, 94, 239])
36
+ const buffer = Buffer.alloc(1000)
37
+ const len = layout.encode(
38
+ {
39
+ quoteCurrency: args.quoteCurrency,
40
+ },
41
+ buffer,
42
+ )
43
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
44
+ const ix = new TransactionInstruction({ keys, programId, data })
45
+ return ix
46
+ }
@@ -0,0 +1,51 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import { PROGRAM_ID } from "../programId"
5
+
6
+ export interface InitObligationArgs {
7
+ args: types.InitObligationArgsFields
8
+ }
9
+
10
+ export interface InitObligationAccounts {
11
+ obligationOwner: PublicKey
12
+ feePayer: PublicKey
13
+ obligation: PublicKey
14
+ lendingMarket: PublicKey
15
+ seed1Account: PublicKey
16
+ seed2Account: PublicKey
17
+ ownerUserMetadata: PublicKey
18
+ rent: PublicKey
19
+ systemProgram: PublicKey
20
+ }
21
+
22
+ export const layout = borsh.struct([types.InitObligationArgs.layout("args")])
23
+
24
+ export function initObligation(
25
+ args: InitObligationArgs,
26
+ accounts: InitObligationAccounts,
27
+ programId: PublicKey = PROGRAM_ID,
28
+ ) {
29
+ const keys: Array<AccountMeta> = [
30
+ { pubkey: accounts.obligationOwner, isSigner: true, isWritable: false },
31
+ { pubkey: accounts.feePayer, isSigner: true, isWritable: true },
32
+ { pubkey: accounts.obligation, isSigner: false, isWritable: true },
33
+ { pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
34
+ { pubkey: accounts.seed1Account, isSigner: false, isWritable: false },
35
+ { pubkey: accounts.seed2Account, isSigner: false, isWritable: false },
36
+ { pubkey: accounts.ownerUserMetadata, isSigner: false, isWritable: false },
37
+ { pubkey: accounts.rent, isSigner: false, isWritable: false },
38
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
39
+ ]
40
+ const identifier = Buffer.from([251, 10, 231, 76, 27, 11, 159, 96])
41
+ const buffer = Buffer.alloc(1000)
42
+ const len = layout.encode(
43
+ {
44
+ args: types.InitObligationArgs.toEncodable(args.args),
45
+ },
46
+ buffer,
47
+ )
48
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
49
+ const ix = new TransactionInstruction({ keys, programId, data })
50
+ return ix
51
+ }
@@ -0,0 +1,58 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import { PROGRAM_ID } from "../programId"
4
+
5
+ export interface InitObligationFarmsForReserveArgs {
6
+ mode: number
7
+ }
8
+
9
+ export interface InitObligationFarmsForReserveAccounts {
10
+ payer: PublicKey
11
+ owner: PublicKey
12
+ obligation: PublicKey
13
+ lendingMarketAuthority: PublicKey
14
+ reserve: PublicKey
15
+ reserveFarmState: PublicKey
16
+ obligationFarm: PublicKey
17
+ lendingMarket: PublicKey
18
+ farmsProgram: PublicKey
19
+ rent: PublicKey
20
+ systemProgram: PublicKey
21
+ }
22
+
23
+ export const layout = borsh.struct([borsh.u8("mode")])
24
+
25
+ export function initObligationFarmsForReserve(
26
+ args: InitObligationFarmsForReserveArgs,
27
+ accounts: InitObligationFarmsForReserveAccounts,
28
+ programId: PublicKey = PROGRAM_ID,
29
+ ) {
30
+ const keys: Array<AccountMeta> = [
31
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
32
+ { pubkey: accounts.owner, isSigner: false, isWritable: false },
33
+ { pubkey: accounts.obligation, isSigner: false, isWritable: true },
34
+ {
35
+ pubkey: accounts.lendingMarketAuthority,
36
+ isSigner: false,
37
+ isWritable: true,
38
+ },
39
+ { pubkey: accounts.reserve, isSigner: false, isWritable: true },
40
+ { pubkey: accounts.reserveFarmState, isSigner: false, isWritable: true },
41
+ { pubkey: accounts.obligationFarm, isSigner: false, isWritable: true },
42
+ { pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
43
+ { pubkey: accounts.farmsProgram, isSigner: false, isWritable: false },
44
+ { pubkey: accounts.rent, isSigner: false, isWritable: false },
45
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
46
+ ]
47
+ const identifier = Buffer.from([136, 63, 15, 186, 211, 152, 168, 164])
48
+ const buffer = Buffer.alloc(1000)
49
+ const len = layout.encode(
50
+ {
51
+ mode: args.mode,
52
+ },
53
+ buffer,
54
+ )
55
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
56
+ const ix = new TransactionInstruction({ keys, programId, data })
57
+ return ix
58
+ }
@@ -0,0 +1,48 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
2
+ import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
3
+ import { PROGRAM_ID } from "../programId"
4
+
5
+ export interface InitReferrerStateAndShortUrlArgs {
6
+ shortUrl: string
7
+ }
8
+
9
+ export interface InitReferrerStateAndShortUrlAccounts {
10
+ referrer: PublicKey
11
+ referrerState: PublicKey
12
+ referrerShortUrl: PublicKey
13
+ referrerUserMetadata: PublicKey
14
+ rent: PublicKey
15
+ systemProgram: PublicKey
16
+ }
17
+
18
+ export const layout = borsh.struct([borsh.str("shortUrl")])
19
+
20
+ export function initReferrerStateAndShortUrl(
21
+ args: InitReferrerStateAndShortUrlArgs,
22
+ accounts: InitReferrerStateAndShortUrlAccounts,
23
+ programId: PublicKey = PROGRAM_ID,
24
+ ) {
25
+ const keys: Array<AccountMeta> = [
26
+ { pubkey: accounts.referrer, isSigner: true, isWritable: true },
27
+ { pubkey: accounts.referrerState, isSigner: false, isWritable: true },
28
+ { pubkey: accounts.referrerShortUrl, isSigner: false, isWritable: true },
29
+ {
30
+ pubkey: accounts.referrerUserMetadata,
31
+ isSigner: false,
32
+ isWritable: false,
33
+ },
34
+ { pubkey: accounts.rent, isSigner: false, isWritable: false },
35
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
36
+ ]
37
+ const identifier = Buffer.from([165, 19, 25, 127, 100, 55, 31, 90])
38
+ const buffer = Buffer.alloc(1000)
39
+ const len = layout.encode(
40
+ {
41
+ shortUrl: args.shortUrl,
42
+ },
43
+ buffer,
44
+ )
45
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
46
+ const ix = new TransactionInstruction({ keys, programId, data })
47
+ return ix
48
+ }