@kamino-finance/klend-sdk 5.0.3 → 5.0.5

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 (230) hide show
  1. package/dist/classes/manager.d.ts +38 -4
  2. package/dist/classes/manager.d.ts.map +1 -1
  3. package/dist/classes/manager.js +98 -4
  4. package/dist/classes/manager.js.map +1 -1
  5. package/dist/classes/market.d.ts.map +1 -1
  6. package/dist/classes/market.js +2 -25
  7. package/dist/classes/market.js.map +1 -1
  8. package/dist/classes/vault.d.ts +12 -8
  9. package/dist/classes/vault.d.ts.map +1 -1
  10. package/dist/classes/vault.js +94 -66
  11. package/dist/classes/vault.js.map +1 -1
  12. package/dist/client_kamino_manager.d.ts.map +1 -1
  13. package/dist/client_kamino_manager.js +14 -0
  14. package/dist/client_kamino_manager.js.map +1 -1
  15. package/dist/idl_codegen_kamino_vault/accounts/Reserve.d.ts +3 -3
  16. package/dist/idl_codegen_kamino_vault/accounts/Reserve.d.ts.map +1 -1
  17. package/dist/idl_codegen_kamino_vault/accounts/Reserve.js +22 -18
  18. package/dist/idl_codegen_kamino_vault/accounts/Reserve.js.map +1 -1
  19. package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts +45 -15
  20. package/dist/idl_codegen_kamino_vault/accounts/VaultState.d.ts.map +1 -1
  21. package/dist/idl_codegen_kamino_vault/accounts/VaultState.js +101 -39
  22. package/dist/idl_codegen_kamino_vault/accounts/VaultState.js.map +1 -1
  23. package/dist/idl_codegen_kamino_vault/accounts/index.d.ts +4 -4
  24. package/dist/idl_codegen_kamino_vault/accounts/index.d.ts.map +1 -1
  25. package/dist/idl_codegen_kamino_vault/accounts/index.js.map +1 -1
  26. package/dist/idl_codegen_kamino_vault/errors/anchor.d.ts.map +1 -1
  27. package/dist/idl_codegen_kamino_vault/errors/anchor.js +162 -162
  28. package/dist/idl_codegen_kamino_vault/errors/anchor.js.map +1 -1
  29. package/dist/idl_codegen_kamino_vault/errors/custom.d.ts +144 -32
  30. package/dist/idl_codegen_kamino_vault/errors/custom.d.ts.map +1 -1
  31. package/dist/idl_codegen_kamino_vault/errors/custom.js +305 -109
  32. package/dist/idl_codegen_kamino_vault/errors/custom.js.map +1 -1
  33. package/dist/idl_codegen_kamino_vault/errors/index.d.ts +3 -3
  34. package/dist/idl_codegen_kamino_vault/errors/index.d.ts.map +1 -1
  35. package/dist/idl_codegen_kamino_vault/errors/index.js +7 -2
  36. package/dist/idl_codegen_kamino_vault/errors/index.js.map +1 -1
  37. package/dist/idl_codegen_kamino_vault/instructions/deposit.d.ts +4 -2
  38. package/dist/idl_codegen_kamino_vault/instructions/deposit.d.ts.map +1 -1
  39. package/dist/idl_codegen_kamino_vault/instructions/deposit.js +3 -1
  40. package/dist/idl_codegen_kamino_vault/instructions/deposit.js.map +1 -1
  41. package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.d.ts +13 -0
  42. package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.d.ts.map +1 -0
  43. package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.js +47 -0
  44. package/dist/idl_codegen_kamino_vault/instructions/giveUpPendingFees.js.map +1 -0
  45. package/dist/idl_codegen_kamino_vault/instructions/index.d.ts +18 -10
  46. package/dist/idl_codegen_kamino_vault/instructions/index.d.ts.map +1 -1
  47. package/dist/idl_codegen_kamino_vault/instructions/index.js +9 -1
  48. package/dist/idl_codegen_kamino_vault/instructions/index.js.map +1 -1
  49. package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts +2 -1
  50. package/dist/idl_codegen_kamino_vault/instructions/initVault.d.ts.map +1 -1
  51. package/dist/idl_codegen_kamino_vault/instructions/initVault.js +1 -0
  52. package/dist/idl_codegen_kamino_vault/instructions/initVault.js.map +1 -1
  53. package/dist/idl_codegen_kamino_vault/instructions/invest.d.ts +6 -2
  54. package/dist/idl_codegen_kamino_vault/instructions/invest.d.ts.map +1 -1
  55. package/dist/idl_codegen_kamino_vault/instructions/invest.js +9 -1
  56. package/dist/idl_codegen_kamino_vault/instructions/invest.js.map +1 -1
  57. package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.d.ts +7 -0
  58. package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.d.ts.map +1 -0
  59. package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.js +16 -0
  60. package/dist/idl_codegen_kamino_vault/instructions/updateAdmin.js.map +1 -0
  61. package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts +2 -2
  62. package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.d.ts.map +1 -1
  63. package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js +1 -1
  64. package/dist/idl_codegen_kamino_vault/instructions/updateReserveAllocation.js.map +1 -1
  65. package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.d.ts +14 -0
  66. package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.d.ts.map +1 -0
  67. package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.js +52 -0
  68. package/dist/idl_codegen_kamino_vault/instructions/updateVaultConfig.js.map +1 -0
  69. package/dist/idl_codegen_kamino_vault/instructions/withdraw.d.ts +4 -2
  70. package/dist/idl_codegen_kamino_vault/instructions/withdraw.d.ts.map +1 -1
  71. package/dist/idl_codegen_kamino_vault/instructions/withdraw.js +8 -2
  72. package/dist/idl_codegen_kamino_vault/instructions/withdraw.js.map +1 -1
  73. package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.d.ts +23 -0
  74. package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.d.ts.map +1 -0
  75. package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.js +51 -0
  76. package/dist/idl_codegen_kamino_vault/instructions/withdrawPendingFees.js.map +1 -0
  77. package/dist/idl_codegen_kamino_vault/programId.d.ts +1 -1
  78. package/dist/idl_codegen_kamino_vault/programId.d.ts.map +1 -1
  79. package/dist/idl_codegen_kamino_vault/programId.js +1 -1
  80. package/dist/idl_codegen_kamino_vault/programId.js.map +1 -1
  81. package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.d.ts +2 -2
  82. package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.d.ts.map +1 -1
  83. package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.js +4 -1
  84. package/dist/idl_codegen_kamino_vault/types/BigFractionBytes.js.map +1 -1
  85. package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.d.ts +1 -1
  86. package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.d.ts.map +1 -1
  87. package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.js +1 -1
  88. package/dist/idl_codegen_kamino_vault/types/BorrowRateCurve.js.map +1 -1
  89. package/dist/idl_codegen_kamino_vault/types/CurvePoint.d.ts +1 -1
  90. package/dist/idl_codegen_kamino_vault/types/CurvePoint.d.ts.map +1 -1
  91. package/dist/idl_codegen_kamino_vault/types/CurvePoint.js +1 -1
  92. package/dist/idl_codegen_kamino_vault/types/CurvePoint.js.map +1 -1
  93. package/dist/idl_codegen_kamino_vault/types/LastUpdate.d.ts +2 -2
  94. package/dist/idl_codegen_kamino_vault/types/LastUpdate.d.ts.map +1 -1
  95. package/dist/idl_codegen_kamino_vault/types/LastUpdate.js +6 -1
  96. package/dist/idl_codegen_kamino_vault/types/LastUpdate.js.map +1 -1
  97. package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.d.ts +2 -2
  98. package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.d.ts.map +1 -1
  99. package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.js +1 -1
  100. package/dist/idl_codegen_kamino_vault/types/PriceHeuristic.js.map +1 -1
  101. package/dist/idl_codegen_kamino_vault/types/PythConfiguration.d.ts +2 -2
  102. package/dist/idl_codegen_kamino_vault/types/PythConfiguration.d.ts.map +1 -1
  103. package/dist/idl_codegen_kamino_vault/types/PythConfiguration.js +1 -1
  104. package/dist/idl_codegen_kamino_vault/types/PythConfiguration.js.map +1 -1
  105. package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.d.ts +3 -3
  106. package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.d.ts.map +1 -1
  107. package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.js +5 -5
  108. package/dist/idl_codegen_kamino_vault/types/ReserveCollateral.js.map +1 -1
  109. package/dist/idl_codegen_kamino_vault/types/ReserveConfig.d.ts +27 -24
  110. package/dist/idl_codegen_kamino_vault/types/ReserveConfig.d.ts.map +1 -1
  111. package/dist/idl_codegen_kamino_vault/types/ReserveConfig.js +59 -53
  112. package/dist/idl_codegen_kamino_vault/types/ReserveConfig.js.map +1 -1
  113. package/dist/idl_codegen_kamino_vault/types/ReserveFees.d.ts +2 -2
  114. package/dist/idl_codegen_kamino_vault/types/ReserveFees.d.ts.map +1 -1
  115. package/dist/idl_codegen_kamino_vault/types/ReserveFees.js +5 -1
  116. package/dist/idl_codegen_kamino_vault/types/ReserveFees.js.map +1 -1
  117. package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.d.ts +11 -3
  118. package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.d.ts.map +1 -1
  119. package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.js +25 -17
  120. package/dist/idl_codegen_kamino_vault/types/ReserveLiquidity.js.map +1 -1
  121. package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.d.ts +2 -2
  122. package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.d.ts.map +1 -1
  123. package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.js +3 -3
  124. package/dist/idl_codegen_kamino_vault/types/ScopeConfiguration.js.map +1 -1
  125. package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.d.ts +2 -2
  126. package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.d.ts.map +1 -1
  127. package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.js +1 -1
  128. package/dist/idl_codegen_kamino_vault/types/SwitchboardConfiguration.js.map +1 -1
  129. package/dist/idl_codegen_kamino_vault/types/TokenInfo.d.ts +3 -3
  130. package/dist/idl_codegen_kamino_vault/types/TokenInfo.d.ts.map +1 -1
  131. package/dist/idl_codegen_kamino_vault/types/TokenInfo.js +11 -11
  132. package/dist/idl_codegen_kamino_vault/types/TokenInfo.js.map +1 -1
  133. package/dist/idl_codegen_kamino_vault/types/VaultAllocation.d.ts +18 -8
  134. package/dist/idl_codegen_kamino_vault/types/VaultAllocation.d.ts.map +1 -1
  135. package/dist/idl_codegen_kamino_vault/types/VaultAllocation.js +27 -13
  136. package/dist/idl_codegen_kamino_vault/types/VaultAllocation.js.map +1 -1
  137. package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts +110 -0
  138. package/dist/idl_codegen_kamino_vault/types/VaultConfigField.d.ts.map +1 -0
  139. package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js +242 -0
  140. package/dist/idl_codegen_kamino_vault/types/VaultConfigField.js.map +1 -0
  141. package/dist/idl_codegen_kamino_vault/types/index.d.ts +34 -30
  142. package/dist/idl_codegen_kamino_vault/types/index.d.ts.map +1 -1
  143. package/dist/idl_codegen_kamino_vault/types/index.js +26 -1
  144. package/dist/idl_codegen_kamino_vault/types/index.js.map +1 -1
  145. package/dist/lending_operations/repay_with_collateral_operations.d.ts.map +1 -1
  146. package/dist/lending_operations/repay_with_collateral_operations.js +6 -0
  147. package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
  148. package/dist/leverage/calcs.d.ts +28 -1
  149. package/dist/leverage/calcs.d.ts.map +1 -1
  150. package/dist/leverage/calcs.js +204 -8
  151. package/dist/leverage/calcs.js.map +1 -1
  152. package/dist/leverage/index.d.ts +1 -0
  153. package/dist/leverage/index.d.ts.map +1 -1
  154. package/dist/leverage/index.js +1 -0
  155. package/dist/leverage/index.js.map +1 -1
  156. package/dist/leverage/operations.d.ts +14 -241
  157. package/dist/leverage/operations.d.ts.map +1 -1
  158. package/dist/leverage/operations.js +508 -776
  159. package/dist/leverage/operations.js.map +1 -1
  160. package/dist/leverage/types.d.ts +173 -0
  161. package/dist/leverage/types.d.ts.map +1 -0
  162. package/dist/leverage/types.js +3 -0
  163. package/dist/leverage/types.js.map +1 -0
  164. package/dist/leverage/utils.d.ts +5 -5
  165. package/dist/leverage/utils.d.ts.map +1 -1
  166. package/dist/leverage/utils.js +68 -33
  167. package/dist/leverage/utils.js.map +1 -1
  168. package/dist/utils/constants.d.ts +1 -0
  169. package/dist/utils/constants.d.ts.map +1 -1
  170. package/dist/utils/constants.js +2 -1
  171. package/dist/utils/constants.js.map +1 -1
  172. package/dist/utils/fuzz.d.ts +3 -0
  173. package/dist/utils/fuzz.d.ts.map +1 -0
  174. package/dist/utils/fuzz.js +11 -0
  175. package/dist/utils/fuzz.js.map +1 -0
  176. package/dist/utils/index.d.ts +1 -0
  177. package/dist/utils/index.d.ts.map +1 -1
  178. package/dist/utils/index.js +1 -0
  179. package/dist/utils/index.js.map +1 -1
  180. package/dist/utils/rpc.d.ts.map +1 -1
  181. package/dist/utils/rpc.js +2 -1
  182. package/dist/utils/rpc.js.map +1 -1
  183. package/package.json +2 -1
  184. package/src/classes/manager.ts +122 -4
  185. package/src/classes/market.ts +1 -1
  186. package/src/classes/vault.ts +123 -49
  187. package/src/client_kamino_manager.ts +18 -0
  188. package/src/idl_codegen_kamino_vault/accounts/Reserve.ts +132 -105
  189. package/src/idl_codegen_kamino_vault/accounts/VaultState.ts +217 -124
  190. package/src/idl_codegen_kamino_vault/accounts/index.ts +4 -4
  191. package/src/idl_codegen_kamino_vault/errors/anchor.ts +335 -326
  192. package/src/idl_codegen_kamino_vault/errors/custom.ts +353 -157
  193. package/src/idl_codegen_kamino_vault/errors/index.ts +35 -22
  194. package/src/idl_codegen_kamino_vault/instructions/deposit.ts +33 -25
  195. package/src/idl_codegen_kamino_vault/instructions/giveUpPendingFees.ts +40 -0
  196. package/src/idl_codegen_kamino_vault/instructions/index.ts +27 -10
  197. package/src/idl_codegen_kamino_vault/instructions/initVault.ts +25 -20
  198. package/src/idl_codegen_kamino_vault/instructions/invest.ts +40 -25
  199. package/src/idl_codegen_kamino_vault/instructions/updateAdmin.ts +24 -0
  200. package/src/idl_codegen_kamino_vault/instructions/updateReserveAllocation.ts +24 -24
  201. package/src/idl_codegen_kamino_vault/instructions/updateVaultConfig.ts +49 -0
  202. package/src/idl_codegen_kamino_vault/instructions/withdraw.ts +45 -33
  203. package/src/idl_codegen_kamino_vault/instructions/withdrawPendingFees.ts +75 -0
  204. package/src/idl_codegen_kamino_vault/programId.ts +5 -3
  205. package/src/idl_codegen_kamino_vault/types/BigFractionBytes.ts +24 -18
  206. package/src/idl_codegen_kamino_vault/types/BorrowRateCurve.ts +21 -16
  207. package/src/idl_codegen_kamino_vault/types/CurvePoint.ts +21 -18
  208. package/src/idl_codegen_kamino_vault/types/LastUpdate.ts +32 -27
  209. package/src/idl_codegen_kamino_vault/types/PriceHeuristic.ts +25 -22
  210. package/src/idl_codegen_kamino_vault/types/PythConfiguration.ts +14 -14
  211. package/src/idl_codegen_kamino_vault/types/ReserveCollateral.ts +35 -35
  212. package/src/idl_codegen_kamino_vault/types/ReserveConfig.ts +232 -191
  213. package/src/idl_codegen_kamino_vault/types/ReserveFees.ts +27 -23
  214. package/src/idl_codegen_kamino_vault/types/ReserveLiquidity.ts +116 -98
  215. package/src/idl_codegen_kamino_vault/types/ScopeConfiguration.ts +25 -25
  216. package/src/idl_codegen_kamino_vault/types/SwitchboardConfiguration.ts +21 -18
  217. package/src/idl_codegen_kamino_vault/types/TokenInfo.ts +92 -74
  218. package/src/idl_codegen_kamino_vault/types/VaultAllocation.ts +67 -49
  219. package/src/idl_codegen_kamino_vault/types/VaultConfigField.ts +270 -0
  220. package/src/idl_codegen_kamino_vault/types/index.ts +77 -30
  221. package/src/lending_operations/repay_with_collateral_operations.ts +2 -0
  222. package/src/leverage/calcs.ts +315 -8
  223. package/src/leverage/index.ts +1 -0
  224. package/src/leverage/operations.ts +1079 -1331
  225. package/src/leverage/types.ts +211 -0
  226. package/src/leverage/utils.ts +103 -64
  227. package/src/utils/constants.ts +2 -0
  228. package/src/utils/fuzz.ts +5 -0
  229. package/src/utils/index.ts +1 -0
  230. package/src/utils/rpc.ts +2 -1
@@ -0,0 +1,75 @@
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 WithdrawPendingFeesAccounts {
8
+ adminAuthority: PublicKey
9
+ vaultState: PublicKey
10
+ reserve: PublicKey
11
+ tokenVault: PublicKey
12
+ ctokenVault: PublicKey
13
+ baseVaultAuthority: PublicKey
14
+ tokenAta: PublicKey
15
+ tokenMint: PublicKey
16
+ tokenProgram: PublicKey
17
+ /** CPI accounts */
18
+ lendingMarket: PublicKey
19
+ lendingMarketAuthority: PublicKey
20
+ reserveLiquiditySupply: PublicKey
21
+ reserveCollateralMint: PublicKey
22
+ klendProgram: PublicKey
23
+ instructionSysvarAccount: PublicKey
24
+ reserveCollateralTokenProgram: PublicKey
25
+ sharesTokenProgram: PublicKey
26
+ }
27
+
28
+ export function withdrawPendingFees(
29
+ accounts: WithdrawPendingFeesAccounts,
30
+ programId: PublicKey = PROGRAM_ID
31
+ ) {
32
+ const keys: Array<AccountMeta> = [
33
+ { pubkey: accounts.adminAuthority, isSigner: true, isWritable: true },
34
+ { pubkey: accounts.vaultState, isSigner: false, isWritable: true },
35
+ { pubkey: accounts.reserve, isSigner: false, isWritable: true },
36
+ { pubkey: accounts.tokenVault, isSigner: false, isWritable: true },
37
+ { pubkey: accounts.ctokenVault, isSigner: false, isWritable: true },
38
+ { pubkey: accounts.baseVaultAuthority, isSigner: false, isWritable: true },
39
+ { pubkey: accounts.tokenAta, isSigner: false, isWritable: true },
40
+ { pubkey: accounts.tokenMint, isSigner: false, isWritable: true },
41
+ { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
42
+ { pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
43
+ {
44
+ pubkey: accounts.lendingMarketAuthority,
45
+ isSigner: false,
46
+ isWritable: false,
47
+ },
48
+ {
49
+ pubkey: accounts.reserveLiquiditySupply,
50
+ isSigner: false,
51
+ isWritable: true,
52
+ },
53
+ {
54
+ pubkey: accounts.reserveCollateralMint,
55
+ isSigner: false,
56
+ isWritable: true,
57
+ },
58
+ { pubkey: accounts.klendProgram, isSigner: false, isWritable: false },
59
+ {
60
+ pubkey: accounts.instructionSysvarAccount,
61
+ isSigner: false,
62
+ isWritable: false,
63
+ },
64
+ {
65
+ pubkey: accounts.reserveCollateralTokenProgram,
66
+ isSigner: false,
67
+ isWritable: false,
68
+ },
69
+ { pubkey: accounts.sharesTokenProgram, isSigner: false, isWritable: false },
70
+ ]
71
+ const identifier = Buffer.from([131, 194, 200, 140, 175, 244, 217, 183])
72
+ const data = identifier
73
+ const ix = new TransactionInstruction({ keys, programId, data })
74
+ return ix
75
+ }
@@ -1,7 +1,9 @@
1
- import { PublicKey } from '@solana/web3.js';
1
+ import { PublicKey } from "@solana/web3.js"
2
2
 
3
3
  // Program ID passed with the cli --program-id flag when running the code generator. Do not edit, it will get overwritten.
4
- export const PROGRAM_ID_CLI = new PublicKey('kvauTFR8qm1dhniz6pYuBZkuene3Hfrs1VQhVRgCNrr');
4
+ export const PROGRAM_ID_CLI = new PublicKey(
5
+ "kvauTFR8qm1dhniz6pYuBZkuene3Hfrs1VQhVRgCNrr"
6
+ )
5
7
 
6
8
  // This constant will not get overwritten on subsequent code generations and it's safe to modify it's value.
7
- export const PROGRAM_ID: PublicKey = PROGRAM_ID_CLI;
9
+ export const PROGRAM_ID: PublicKey = PROGRAM_ID_CLI
@@ -1,29 +1,35 @@
1
- import { PublicKey } 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 types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
4
- import * as borsh from '@coral-xyz/borsh';
1
+ import { PublicKey } 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 types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as borsh from "@coral-xyz/borsh"
5
5
 
6
6
  export interface BigFractionBytesFields {
7
- value: Array<BN>;
8
- padding: Array<BN>;
7
+ value: Array<BN>
8
+ padding: Array<BN>
9
9
  }
10
10
 
11
11
  export interface BigFractionBytesJSON {
12
- value: Array<string>;
13
- padding: Array<string>;
12
+ value: Array<string>
13
+ padding: Array<string>
14
14
  }
15
15
 
16
16
  export class BigFractionBytes {
17
- readonly value: Array<BN>;
18
- readonly padding: Array<BN>;
17
+ readonly value: Array<BN>
18
+ readonly padding: Array<BN>
19
19
 
20
20
  constructor(fields: BigFractionBytesFields) {
21
- this.value = fields.value;
22
- this.padding = fields.padding;
21
+ this.value = fields.value
22
+ this.padding = fields.padding
23
23
  }
24
24
 
25
25
  static layout(property?: string) {
26
- return borsh.struct([borsh.array(borsh.u64(), 4, 'value'), borsh.array(borsh.u64(), 2, 'padding')], property);
26
+ return borsh.struct(
27
+ [
28
+ borsh.array(borsh.u64(), 4, "value"),
29
+ borsh.array(borsh.u64(), 2, "padding"),
30
+ ],
31
+ property
32
+ )
27
33
  }
28
34
 
29
35
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -31,31 +37,31 @@ export class BigFractionBytes {
31
37
  return new BigFractionBytes({
32
38
  value: obj.value,
33
39
  padding: obj.padding,
34
- });
40
+ })
35
41
  }
36
42
 
37
43
  static toEncodable(fields: BigFractionBytesFields) {
38
44
  return {
39
45
  value: fields.value,
40
46
  padding: fields.padding,
41
- };
47
+ }
42
48
  }
43
49
 
44
50
  toJSON(): BigFractionBytesJSON {
45
51
  return {
46
52
  value: this.value.map((item) => item.toString()),
47
53
  padding: this.padding.map((item) => item.toString()),
48
- };
54
+ }
49
55
  }
50
56
 
51
57
  static fromJSON(obj: BigFractionBytesJSON): BigFractionBytes {
52
58
  return new BigFractionBytes({
53
59
  value: obj.value.map((item) => new BN(item)),
54
60
  padding: obj.padding.map((item) => new BN(item)),
55
- });
61
+ })
56
62
  }
57
63
 
58
64
  toEncodable() {
59
- return BigFractionBytes.toEncodable(this);
65
+ return BigFractionBytes.toEncodable(this)
60
66
  }
61
67
  }
@@ -1,55 +1,60 @@
1
- import { PublicKey } 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 types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
4
- import * as borsh from '@coral-xyz/borsh';
1
+ import { PublicKey } 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 types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as borsh from "@coral-xyz/borsh"
5
5
 
6
6
  export interface BorrowRateCurveFields {
7
- points: Array<types.CurvePointFields>;
7
+ points: Array<types.CurvePointFields>
8
8
  }
9
9
 
10
10
  export interface BorrowRateCurveJSON {
11
- points: Array<types.CurvePointJSON>;
11
+ points: Array<types.CurvePointJSON>
12
12
  }
13
13
 
14
14
  export class BorrowRateCurve {
15
- readonly points: Array<types.CurvePoint>;
15
+ readonly points: Array<types.CurvePoint>
16
16
 
17
17
  constructor(fields: BorrowRateCurveFields) {
18
- this.points = fields.points.map((item) => new types.CurvePoint({ ...item }));
18
+ this.points = fields.points.map((item) => new types.CurvePoint({ ...item }))
19
19
  }
20
20
 
21
21
  static layout(property?: string) {
22
- return borsh.struct([borsh.array(types.CurvePoint.layout(), 11, 'points')], property);
22
+ return borsh.struct(
23
+ [borsh.array(types.CurvePoint.layout(), 11, "points")],
24
+ property
25
+ )
23
26
  }
24
27
 
25
28
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
29
  static fromDecoded(obj: any) {
27
30
  return new BorrowRateCurve({
28
- points: obj.points.map((item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */) =>
29
- types.CurvePoint.fromDecoded(item)
31
+ points: obj.points.map(
32
+ (
33
+ item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */
34
+ ) => types.CurvePoint.fromDecoded(item)
30
35
  ),
31
- });
36
+ })
32
37
  }
33
38
 
34
39
  static toEncodable(fields: BorrowRateCurveFields) {
35
40
  return {
36
41
  points: fields.points.map((item) => types.CurvePoint.toEncodable(item)),
37
- };
42
+ }
38
43
  }
39
44
 
40
45
  toJSON(): BorrowRateCurveJSON {
41
46
  return {
42
47
  points: this.points.map((item) => item.toJSON()),
43
- };
48
+ }
44
49
  }
45
50
 
46
51
  static fromJSON(obj: BorrowRateCurveJSON): BorrowRateCurve {
47
52
  return new BorrowRateCurve({
48
53
  points: obj.points.map((item) => types.CurvePoint.fromJSON(item)),
49
- });
54
+ })
50
55
  }
51
56
 
52
57
  toEncodable() {
53
- return BorrowRateCurve.toEncodable(this);
58
+ return BorrowRateCurve.toEncodable(this)
54
59
  }
55
60
  }
@@ -1,29 +1,32 @@
1
- import { PublicKey } 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 types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
4
- import * as borsh from '@coral-xyz/borsh';
1
+ import { PublicKey } 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 types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as borsh from "@coral-xyz/borsh"
5
5
 
6
6
  export interface CurvePointFields {
7
- utilizationRateBps: number;
8
- borrowRateBps: number;
7
+ utilizationRateBps: number
8
+ borrowRateBps: number
9
9
  }
10
10
 
11
11
  export interface CurvePointJSON {
12
- utilizationRateBps: number;
13
- borrowRateBps: number;
12
+ utilizationRateBps: number
13
+ borrowRateBps: number
14
14
  }
15
15
 
16
16
  export class CurvePoint {
17
- readonly utilizationRateBps: number;
18
- readonly borrowRateBps: number;
17
+ readonly utilizationRateBps: number
18
+ readonly borrowRateBps: number
19
19
 
20
20
  constructor(fields: CurvePointFields) {
21
- this.utilizationRateBps = fields.utilizationRateBps;
22
- this.borrowRateBps = fields.borrowRateBps;
21
+ this.utilizationRateBps = fields.utilizationRateBps
22
+ this.borrowRateBps = fields.borrowRateBps
23
23
  }
24
24
 
25
25
  static layout(property?: string) {
26
- return borsh.struct([borsh.u32('utilizationRateBps'), borsh.u32('borrowRateBps')], property);
26
+ return borsh.struct(
27
+ [borsh.u32("utilizationRateBps"), borsh.u32("borrowRateBps")],
28
+ property
29
+ )
27
30
  }
28
31
 
29
32
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -31,31 +34,31 @@ export class CurvePoint {
31
34
  return new CurvePoint({
32
35
  utilizationRateBps: obj.utilizationRateBps,
33
36
  borrowRateBps: obj.borrowRateBps,
34
- });
37
+ })
35
38
  }
36
39
 
37
40
  static toEncodable(fields: CurvePointFields) {
38
41
  return {
39
42
  utilizationRateBps: fields.utilizationRateBps,
40
43
  borrowRateBps: fields.borrowRateBps,
41
- };
44
+ }
42
45
  }
43
46
 
44
47
  toJSON(): CurvePointJSON {
45
48
  return {
46
49
  utilizationRateBps: this.utilizationRateBps,
47
50
  borrowRateBps: this.borrowRateBps,
48
- };
51
+ }
49
52
  }
50
53
 
51
54
  static fromJSON(obj: CurvePointJSON): CurvePoint {
52
55
  return new CurvePoint({
53
56
  utilizationRateBps: obj.utilizationRateBps,
54
57
  borrowRateBps: obj.borrowRateBps,
55
- });
58
+ })
56
59
  }
57
60
 
58
61
  toEncodable() {
59
- return CurvePoint.toEncodable(this);
62
+ return CurvePoint.toEncodable(this)
60
63
  }
61
64
  }
@@ -1,50 +1,55 @@
1
- import { PublicKey } 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 types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
4
- import * as borsh from '@coral-xyz/borsh';
1
+ import { PublicKey } 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 types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as borsh from "@coral-xyz/borsh"
5
5
 
6
6
  export interface LastUpdateFields {
7
7
  /** Last slot when updated */
8
- slot: BN;
8
+ slot: BN
9
9
  /** True when marked stale, false when slot updated */
10
- stale: number;
10
+ stale: number
11
11
  /** Status of the prices used to calculate the last update */
12
- priceStatus: number;
13
- placeholder: Array<number>;
12
+ priceStatus: number
13
+ placeholder: Array<number>
14
14
  }
15
15
 
16
16
  export interface LastUpdateJSON {
17
17
  /** Last slot when updated */
18
- slot: string;
18
+ slot: string
19
19
  /** True when marked stale, false when slot updated */
20
- stale: number;
20
+ stale: number
21
21
  /** Status of the prices used to calculate the last update */
22
- priceStatus: number;
23
- placeholder: Array<number>;
22
+ priceStatus: number
23
+ placeholder: Array<number>
24
24
  }
25
25
 
26
26
  /** Last update state */
27
27
  export class LastUpdate {
28
28
  /** Last slot when updated */
29
- readonly slot: BN;
29
+ readonly slot: BN
30
30
  /** True when marked stale, false when slot updated */
31
- readonly stale: number;
31
+ readonly stale: number
32
32
  /** Status of the prices used to calculate the last update */
33
- readonly priceStatus: number;
34
- readonly placeholder: Array<number>;
33
+ readonly priceStatus: number
34
+ readonly placeholder: Array<number>
35
35
 
36
36
  constructor(fields: LastUpdateFields) {
37
- this.slot = fields.slot;
38
- this.stale = fields.stale;
39
- this.priceStatus = fields.priceStatus;
40
- this.placeholder = fields.placeholder;
37
+ this.slot = fields.slot
38
+ this.stale = fields.stale
39
+ this.priceStatus = fields.priceStatus
40
+ this.placeholder = fields.placeholder
41
41
  }
42
42
 
43
43
  static layout(property?: string) {
44
44
  return borsh.struct(
45
- [borsh.u64('slot'), borsh.u8('stale'), borsh.u8('priceStatus'), borsh.array(borsh.u8(), 6, 'placeholder')],
45
+ [
46
+ borsh.u64("slot"),
47
+ borsh.u8("stale"),
48
+ borsh.u8("priceStatus"),
49
+ borsh.array(borsh.u8(), 6, "placeholder"),
50
+ ],
46
51
  property
47
- );
52
+ )
48
53
  }
49
54
 
50
55
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -54,7 +59,7 @@ export class LastUpdate {
54
59
  stale: obj.stale,
55
60
  priceStatus: obj.priceStatus,
56
61
  placeholder: obj.placeholder,
57
- });
62
+ })
58
63
  }
59
64
 
60
65
  static toEncodable(fields: LastUpdateFields) {
@@ -63,7 +68,7 @@ export class LastUpdate {
63
68
  stale: fields.stale,
64
69
  priceStatus: fields.priceStatus,
65
70
  placeholder: fields.placeholder,
66
- };
71
+ }
67
72
  }
68
73
 
69
74
  toJSON(): LastUpdateJSON {
@@ -72,7 +77,7 @@ export class LastUpdate {
72
77
  stale: this.stale,
73
78
  priceStatus: this.priceStatus,
74
79
  placeholder: this.placeholder,
75
- };
80
+ }
76
81
  }
77
82
 
78
83
  static fromJSON(obj: LastUpdateJSON): LastUpdate {
@@ -81,10 +86,10 @@ export class LastUpdate {
81
86
  stale: obj.stale,
82
87
  priceStatus: obj.priceStatus,
83
88
  placeholder: obj.placeholder,
84
- });
89
+ })
85
90
  }
86
91
 
87
92
  toEncodable() {
88
- return LastUpdate.toEncodable(this);
93
+ return LastUpdate.toEncodable(this)
89
94
  }
90
95
  }
@@ -1,42 +1,45 @@
1
- import { PublicKey } 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 types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
4
- import * as borsh from '@coral-xyz/borsh';
1
+ import { PublicKey } 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 types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as borsh from "@coral-xyz/borsh"
5
5
 
6
6
  export interface PriceHeuristicFields {
7
7
  /** Lower value of acceptable price */
8
- lower: BN;
8
+ lower: BN
9
9
  /** Upper value of acceptable price */
10
- upper: BN;
10
+ upper: BN
11
11
  /** Number of decimals of the previously defined values */
12
- exp: BN;
12
+ exp: BN
13
13
  }
14
14
 
15
15
  export interface PriceHeuristicJSON {
16
16
  /** Lower value of acceptable price */
17
- lower: string;
17
+ lower: string
18
18
  /** Upper value of acceptable price */
19
- upper: string;
19
+ upper: string
20
20
  /** Number of decimals of the previously defined values */
21
- exp: string;
21
+ exp: string
22
22
  }
23
23
 
24
24
  export class PriceHeuristic {
25
25
  /** Lower value of acceptable price */
26
- readonly lower: BN;
26
+ readonly lower: BN
27
27
  /** Upper value of acceptable price */
28
- readonly upper: BN;
28
+ readonly upper: BN
29
29
  /** Number of decimals of the previously defined values */
30
- readonly exp: BN;
30
+ readonly exp: BN
31
31
 
32
32
  constructor(fields: PriceHeuristicFields) {
33
- this.lower = fields.lower;
34
- this.upper = fields.upper;
35
- this.exp = fields.exp;
33
+ this.lower = fields.lower
34
+ this.upper = fields.upper
35
+ this.exp = fields.exp
36
36
  }
37
37
 
38
38
  static layout(property?: string) {
39
- return borsh.struct([borsh.u64('lower'), borsh.u64('upper'), borsh.u64('exp')], property);
39
+ return borsh.struct(
40
+ [borsh.u64("lower"), borsh.u64("upper"), borsh.u64("exp")],
41
+ property
42
+ )
40
43
  }
41
44
 
42
45
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -45,7 +48,7 @@ export class PriceHeuristic {
45
48
  lower: obj.lower,
46
49
  upper: obj.upper,
47
50
  exp: obj.exp,
48
- });
51
+ })
49
52
  }
50
53
 
51
54
  static toEncodable(fields: PriceHeuristicFields) {
@@ -53,7 +56,7 @@ export class PriceHeuristic {
53
56
  lower: fields.lower,
54
57
  upper: fields.upper,
55
58
  exp: fields.exp,
56
- };
59
+ }
57
60
  }
58
61
 
59
62
  toJSON(): PriceHeuristicJSON {
@@ -61,7 +64,7 @@ export class PriceHeuristic {
61
64
  lower: this.lower.toString(),
62
65
  upper: this.upper.toString(),
63
66
  exp: this.exp.toString(),
64
- };
67
+ }
65
68
  }
66
69
 
67
70
  static fromJSON(obj: PriceHeuristicJSON): PriceHeuristic {
@@ -69,10 +72,10 @@ export class PriceHeuristic {
69
72
  lower: new BN(obj.lower),
70
73
  upper: new BN(obj.upper),
71
74
  exp: new BN(obj.exp),
72
- });
75
+ })
73
76
  }
74
77
 
75
78
  toEncodable() {
76
- return PriceHeuristic.toEncodable(this);
79
+ return PriceHeuristic.toEncodable(this)
77
80
  }
78
81
  }
@@ -1,56 +1,56 @@
1
- import { PublicKey } 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 types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
4
- import * as borsh from '@coral-xyz/borsh';
1
+ import { PublicKey } 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 types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as borsh from "@coral-xyz/borsh"
5
5
 
6
6
  export interface PythConfigurationFields {
7
7
  /** Pubkey of the base price feed (disabled if `null` or `default`) */
8
- price: PublicKey;
8
+ price: PublicKey
9
9
  }
10
10
 
11
11
  export interface PythConfigurationJSON {
12
12
  /** Pubkey of the base price feed (disabled if `null` or `default`) */
13
- price: string;
13
+ price: string
14
14
  }
15
15
 
16
16
  export class PythConfiguration {
17
17
  /** Pubkey of the base price feed (disabled if `null` or `default`) */
18
- readonly price: PublicKey;
18
+ readonly price: PublicKey
19
19
 
20
20
  constructor(fields: PythConfigurationFields) {
21
- this.price = fields.price;
21
+ this.price = fields.price
22
22
  }
23
23
 
24
24
  static layout(property?: string) {
25
- return borsh.struct([borsh.publicKey('price')], property);
25
+ return borsh.struct([borsh.publicKey("price")], property)
26
26
  }
27
27
 
28
28
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
29
  static fromDecoded(obj: any) {
30
30
  return new PythConfiguration({
31
31
  price: obj.price,
32
- });
32
+ })
33
33
  }
34
34
 
35
35
  static toEncodable(fields: PythConfigurationFields) {
36
36
  return {
37
37
  price: fields.price,
38
- };
38
+ }
39
39
  }
40
40
 
41
41
  toJSON(): PythConfigurationJSON {
42
42
  return {
43
43
  price: this.price.toString(),
44
- };
44
+ }
45
45
  }
46
46
 
47
47
  static fromJSON(obj: PythConfigurationJSON): PythConfiguration {
48
48
  return new PythConfiguration({
49
49
  price: new PublicKey(obj.price),
50
- });
50
+ })
51
51
  }
52
52
 
53
53
  toEncodable() {
54
- return PythConfiguration.toEncodable(this);
54
+ return PythConfiguration.toEncodable(this)
55
55
  }
56
56
  }