@kestrelfi/lyc-sdk 1.0.1

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 (717) hide show
  1. package/.env.example +11 -0
  2. package/README.md +207 -0
  3. package/dist/sdks/long-yield-carry/scripts/asyncBurn.d.ts +1 -0
  4. package/dist/sdks/long-yield-carry/scripts/asyncBurn.js +117 -0
  5. package/dist/sdks/long-yield-carry/scripts/burnToken.d.ts +1 -0
  6. package/dist/sdks/long-yield-carry/scripts/burnToken.js +98 -0
  7. package/dist/sdks/long-yield-carry/scripts/claimIncentives.d.ts +1 -0
  8. package/dist/sdks/long-yield-carry/scripts/claimIncentives.js +108 -0
  9. package/dist/sdks/long-yield-carry/scripts/closeCpiPlans.d.ts +1 -0
  10. package/dist/sdks/long-yield-carry/scripts/closeCpiPlans.js +93 -0
  11. package/dist/sdks/long-yield-carry/scripts/collectInterest.d.ts +1 -0
  12. package/dist/sdks/long-yield-carry/scripts/collectInterest.js +164 -0
  13. package/dist/sdks/long-yield-carry/scripts/collectProtocolFees.d.ts +1 -0
  14. package/dist/sdks/long-yield-carry/scripts/collectProtocolFees.js +120 -0
  15. package/dist/sdks/long-yield-carry/scripts/computeOptimalAllocations.d.ts +1 -0
  16. package/dist/sdks/long-yield-carry/scripts/computeOptimalAllocations.js +84 -0
  17. package/dist/sdks/long-yield-carry/scripts/createToken.d.ts +1 -0
  18. package/dist/sdks/long-yield-carry/scripts/createToken.js +76 -0
  19. package/dist/sdks/long-yield-carry/scripts/createTokenLendingPosition.d.ts +1 -0
  20. package/dist/sdks/long-yield-carry/scripts/createTokenLendingPosition.js +157 -0
  21. package/dist/sdks/long-yield-carry/scripts/createYieldingBank.d.ts +1 -0
  22. package/dist/sdks/long-yield-carry/scripts/createYieldingBank.js +69 -0
  23. package/dist/sdks/long-yield-carry/scripts/decreaseCarryPositions.d.ts +1 -0
  24. package/dist/sdks/long-yield-carry/scripts/decreaseCarryPositions.js +247 -0
  25. package/dist/sdks/long-yield-carry/scripts/depositUnlentCollateral.d.ts +1 -0
  26. package/dist/sdks/long-yield-carry/scripts/depositUnlentCollateral.js +90 -0
  27. package/dist/sdks/long-yield-carry/scripts/emergency/deleverageAll.d.ts +1 -0
  28. package/dist/sdks/long-yield-carry/scripts/emergency/deleverageAll.js +202 -0
  29. package/dist/sdks/long-yield-carry/scripts/emergency/triggerCircuitBreaker.d.ts +1 -0
  30. package/dist/sdks/long-yield-carry/scripts/emergency/triggerCircuitBreaker.js +68 -0
  31. package/dist/sdks/long-yield-carry/scripts/env.d.ts +1 -0
  32. package/dist/sdks/long-yield-carry/scripts/env.js +8 -0
  33. package/dist/sdks/long-yield-carry/scripts/findTxs.d.ts +1 -0
  34. package/dist/sdks/long-yield-carry/scripts/findTxs.js +143 -0
  35. package/dist/sdks/long-yield-carry/scripts/increaseCarryPositions.d.ts +1 -0
  36. package/dist/sdks/long-yield-carry/scripts/increaseCarryPositions.js +112 -0
  37. package/dist/sdks/long-yield-carry/scripts/inspect/format.d.ts +13 -0
  38. package/dist/sdks/long-yield-carry/scripts/inspect/format.js +363 -0
  39. package/dist/sdks/long-yield-carry/scripts/inspect.d.ts +1 -0
  40. package/dist/sdks/long-yield-carry/scripts/inspect.js +108 -0
  41. package/dist/sdks/long-yield-carry/scripts/localUtils.d.ts +53 -0
  42. package/dist/sdks/long-yield-carry/scripts/localUtils.js +191 -0
  43. package/dist/sdks/long-yield-carry/scripts/mintToken.d.ts +1 -0
  44. package/dist/sdks/long-yield-carry/scripts/mintToken.js +103 -0
  45. package/dist/sdks/long-yield-carry/scripts/processAsyncBurns.d.ts +1 -0
  46. package/dist/sdks/long-yield-carry/scripts/processAsyncBurns.js +76 -0
  47. package/dist/sdks/long-yield-carry/scripts/rebalanceToken.d.ts +1 -0
  48. package/dist/sdks/long-yield-carry/scripts/rebalanceToken.js +210 -0
  49. package/dist/sdks/long-yield-carry/scripts/rebalanceYieldingBank.d.ts +1 -0
  50. package/dist/sdks/long-yield-carry/scripts/rebalanceYieldingBank.js +149 -0
  51. package/dist/sdks/long-yield-carry/scripts/recollateralizeLoss.d.ts +1 -0
  52. package/dist/sdks/long-yield-carry/scripts/recollateralizeLoss.js +64 -0
  53. package/dist/sdks/long-yield-carry/scripts/refresh.d.ts +1 -0
  54. package/dist/sdks/long-yield-carry/scripts/refresh.js +101 -0
  55. package/dist/sdks/long-yield-carry/scripts/updateFees.d.ts +1 -0
  56. package/dist/sdks/long-yield-carry/scripts/updateFees.js +369 -0
  57. package/dist/sdks/long-yield-carry/scripts/updateGeneralLut.d.ts +1 -0
  58. package/dist/sdks/long-yield-carry/scripts/updateGeneralLut.js +27 -0
  59. package/dist/sdks/long-yield-carry/scripts/updateLendingPositionConfig.d.ts +1 -0
  60. package/dist/sdks/long-yield-carry/scripts/updateLendingPositionConfig.js +127 -0
  61. package/dist/sdks/long-yield-carry/scripts/updateTokenLuts.d.ts +1 -0
  62. package/dist/sdks/long-yield-carry/scripts/updateTokenLuts.js +27 -0
  63. package/dist/sdks/long-yield-carry/scripts/updateTokenMetadata.d.ts +1 -0
  64. package/dist/sdks/long-yield-carry/scripts/updateTokenMetadata.js +194 -0
  65. package/dist/sdks/long-yield-carry/scripts/updateYieldingBankConfig.d.ts +1 -0
  66. package/dist/sdks/long-yield-carry/scripts/updateYieldingBankConfig.js +84 -0
  67. package/dist/sdks/long-yield-carry/scripts/withdrawUnlentCollateral.d.ts +1 -0
  68. package/dist/sdks/long-yield-carry/scripts/withdrawUnlentCollateral.js +140 -0
  69. package/dist/sdks/long-yield-carry/src/client/account.d.ts +152 -0
  70. package/dist/sdks/long-yield-carry/src/client/account.js +349 -0
  71. package/dist/sdks/long-yield-carry/src/client/builders/args.d.ts +299 -0
  72. package/dist/sdks/long-yield-carry/src/client/builders/args.js +2 -0
  73. package/dist/sdks/long-yield-carry/src/client/builders/asyncBurnBuilder.d.ts +20 -0
  74. package/dist/sdks/long-yield-carry/src/client/builders/asyncBurnBuilder.js +212 -0
  75. package/dist/sdks/long-yield-carry/src/client/builders/base.d.ts +77 -0
  76. package/dist/sdks/long-yield-carry/src/client/builders/base.js +191 -0
  77. package/dist/sdks/long-yield-carry/src/client/builders/burnTokenBuilder.d.ts +18 -0
  78. package/dist/sdks/long-yield-carry/src/client/builders/burnTokenBuilder.js +165 -0
  79. package/dist/sdks/long-yield-carry/src/client/builders/claimIncentivesBuilder.d.ts +9 -0
  80. package/dist/sdks/long-yield-carry/src/client/builders/claimIncentivesBuilder.js +135 -0
  81. package/dist/sdks/long-yield-carry/src/client/builders/collectFeesBuilder.d.ts +14 -0
  82. package/dist/sdks/long-yield-carry/src/client/builders/collectFeesBuilder.js +50 -0
  83. package/dist/sdks/long-yield-carry/src/client/builders/collectInterestBuilder.d.ts +8 -0
  84. package/dist/sdks/long-yield-carry/src/client/builders/collectInterestBuilder.js +86 -0
  85. package/dist/sdks/long-yield-carry/src/client/builders/createCpiPlanBuilder.d.ts +6 -0
  86. package/dist/sdks/long-yield-carry/src/client/builders/createCpiPlanBuilder.js +22 -0
  87. package/dist/sdks/long-yield-carry/src/client/builders/createTokenBuilder.d.ts +7 -0
  88. package/dist/sdks/long-yield-carry/src/client/builders/createTokenBuilder.js +64 -0
  89. package/dist/sdks/long-yield-carry/src/client/builders/createTokenLendingPositionBuilder.d.ts +10 -0
  90. package/dist/sdks/long-yield-carry/src/client/builders/createTokenLendingPositionBuilder.js +138 -0
  91. package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankAllocationBuilder.d.ts +7 -0
  92. package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankAllocationBuilder.js +29 -0
  93. package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankBuilder.d.ts +7 -0
  94. package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankBuilder.js +39 -0
  95. package/dist/sdks/long-yield-carry/src/client/builders/decreaseCarryPositionBuilder.d.ts +30 -0
  96. package/dist/sdks/long-yield-carry/src/client/builders/decreaseCarryPositionBuilder.js +99 -0
  97. package/dist/sdks/long-yield-carry/src/client/builders/depositUnlentCollateralBuilder.d.ts +8 -0
  98. package/dist/sdks/long-yield-carry/src/client/builders/depositUnlentCollateralBuilder.js +64 -0
  99. package/dist/sdks/long-yield-carry/src/client/builders/increaseCarryPositionBuilder.d.ts +8 -0
  100. package/dist/sdks/long-yield-carry/src/client/builders/increaseCarryPositionBuilder.js +73 -0
  101. package/dist/sdks/long-yield-carry/src/client/builders/index.d.ts +28 -0
  102. package/dist/sdks/long-yield-carry/src/client/builders/index.js +62 -0
  103. package/dist/sdks/long-yield-carry/src/client/builders/mintTokenBuilder.d.ts +8 -0
  104. package/dist/sdks/long-yield-carry/src/client/builders/mintTokenBuilder.js +95 -0
  105. package/dist/sdks/long-yield-carry/src/client/builders/rebalanceTokenBuilder.d.ts +11 -0
  106. package/dist/sdks/long-yield-carry/src/client/builders/rebalanceTokenBuilder.js +255 -0
  107. package/dist/sdks/long-yield-carry/src/client/builders/rebalanceYieldingBankBuilder.d.ts +8 -0
  108. package/dist/sdks/long-yield-carry/src/client/builders/rebalanceYieldingBankBuilder.js +75 -0
  109. package/dist/sdks/long-yield-carry/src/client/builders/recollateralizeLossBuilder.d.ts +12 -0
  110. package/dist/sdks/long-yield-carry/src/client/builders/recollateralizeLossBuilder.js +220 -0
  111. package/dist/sdks/long-yield-carry/src/client/builders/refreshTokenStateBuilder.d.ts +9 -0
  112. package/dist/sdks/long-yield-carry/src/client/builders/refreshTokenStateBuilder.js +112 -0
  113. package/dist/sdks/long-yield-carry/src/client/builders/refreshTokensBuilder.d.ts +9 -0
  114. package/dist/sdks/long-yield-carry/src/client/builders/refreshTokensBuilder.js +59 -0
  115. package/dist/sdks/long-yield-carry/src/client/builders/refreshYieldingBankBuilder.d.ts +8 -0
  116. package/dist/sdks/long-yield-carry/src/client/builders/refreshYieldingBankBuilder.js +29 -0
  117. package/dist/sdks/long-yield-carry/src/client/builders/resetTokenBurnRateLimitBuilder.d.ts +7 -0
  118. package/dist/sdks/long-yield-carry/src/client/builders/resetTokenBurnRateLimitBuilder.js +19 -0
  119. package/dist/sdks/long-yield-carry/src/client/builders/setTokenCircuitBreakerBuilder.d.ts +11 -0
  120. package/dist/sdks/long-yield-carry/src/client/builders/setTokenCircuitBreakerBuilder.js +31 -0
  121. package/dist/sdks/long-yield-carry/src/client/builders/setYieldingBankCircuitBreakerBuilder.d.ts +8 -0
  122. package/dist/sdks/long-yield-carry/src/client/builders/setYieldingBankCircuitBreakerBuilder.js +28 -0
  123. package/dist/sdks/long-yield-carry/src/client/builders/updateLendingPositionConfigBuilder.d.ts +10 -0
  124. package/dist/sdks/long-yield-carry/src/client/builders/updateLendingPositionConfigBuilder.js +30 -0
  125. package/dist/sdks/long-yield-carry/src/client/builders/updateTokenConfigurationBuilder.d.ts +11 -0
  126. package/dist/sdks/long-yield-carry/src/client/builders/updateTokenConfigurationBuilder.js +47 -0
  127. package/dist/sdks/long-yield-carry/src/client/builders/updateTokenMetadataBuilder.d.ts +7 -0
  128. package/dist/sdks/long-yield-carry/src/client/builders/updateTokenMetadataBuilder.js +24 -0
  129. package/dist/sdks/long-yield-carry/src/client/builders/updateYieldingBankConfigBuilder.d.ts +10 -0
  130. package/dist/sdks/long-yield-carry/src/client/builders/updateYieldingBankConfigBuilder.js +31 -0
  131. package/dist/sdks/long-yield-carry/src/client/builders/utils.d.ts +4 -0
  132. package/dist/sdks/long-yield-carry/src/client/builders/utils.js +20 -0
  133. package/dist/sdks/long-yield-carry/src/client/client.d.ts +115 -0
  134. package/dist/sdks/long-yield-carry/src/client/client.js +166 -0
  135. package/dist/sdks/long-yield-carry/src/client/externalLiquidityResolver.d.ts +13 -0
  136. package/dist/sdks/long-yield-carry/src/client/externalLiquidityResolver.js +34 -0
  137. package/dist/sdks/long-yield-carry/src/client/index.d.ts +10 -0
  138. package/dist/sdks/long-yield-carry/src/client/index.js +33 -0
  139. package/dist/sdks/long-yield-carry/src/client/lendingPlatformClients.d.ts +19 -0
  140. package/dist/sdks/long-yield-carry/src/client/lendingPlatformClients.js +33 -0
  141. package/dist/sdks/long-yield-carry/src/client/pda.d.ts +33 -0
  142. package/dist/sdks/long-yield-carry/src/client/pda.js +79 -0
  143. package/dist/sdks/long-yield-carry/src/client/plans/collectInterest.d.ts +24 -0
  144. package/dist/sdks/long-yield-carry/src/client/plans/collectInterest.js +150 -0
  145. package/dist/sdks/long-yield-carry/src/client/plans/decreaseCarryPosition.d.ts +12 -0
  146. package/dist/sdks/long-yield-carry/src/client/plans/decreaseCarryPosition.js +140 -0
  147. package/dist/sdks/long-yield-carry/src/client/routes/collectInterest.d.ts +13 -0
  148. package/dist/sdks/long-yield-carry/src/client/routes/collectInterest.js +39 -0
  149. package/dist/sdks/long-yield-carry/src/client/transaction.d.ts +41 -0
  150. package/dist/sdks/long-yield-carry/src/client/transaction.js +55 -0
  151. package/dist/sdks/long-yield-carry/src/client/types/builders.d.ts +18 -0
  152. package/dist/sdks/long-yield-carry/src/client/types/builders.js +2 -0
  153. package/dist/sdks/long-yield-carry/src/client/types/enums.d.ts +22 -0
  154. package/dist/sdks/long-yield-carry/src/client/types/enums.js +48 -0
  155. package/dist/sdks/long-yield-carry/src/client/types/general.d.ts +98 -0
  156. package/dist/sdks/long-yield-carry/src/client/types/general.js +2 -0
  157. package/dist/sdks/long-yield-carry/src/client/types/index.d.ts +6 -0
  158. package/dist/sdks/long-yield-carry/src/client/types/index.js +22 -0
  159. package/dist/sdks/long-yield-carry/src/client/types/ix.d.ts +352 -0
  160. package/dist/sdks/long-yield-carry/src/client/types/ix.js +2 -0
  161. package/dist/sdks/long-yield-carry/src/client/types/planTypes/collectInterest.d.ts +91 -0
  162. package/dist/sdks/long-yield-carry/src/client/types/planTypes/collectInterest.js +2 -0
  163. package/dist/sdks/long-yield-carry/src/client/types/planTypes/common.d.ts +28 -0
  164. package/dist/sdks/long-yield-carry/src/client/types/planTypes/common.js +2 -0
  165. package/dist/sdks/long-yield-carry/src/client/types/planTypes/decreaseCarryPosition.d.ts +128 -0
  166. package/dist/sdks/long-yield-carry/src/client/types/planTypes/decreaseCarryPosition.js +2 -0
  167. package/dist/sdks/long-yield-carry/src/client/types/planTypes/index.d.ts +3 -0
  168. package/dist/sdks/long-yield-carry/src/client/types/planTypes/index.js +19 -0
  169. package/dist/sdks/long-yield-carry/src/client/types/tx.d.ts +339 -0
  170. package/dist/sdks/long-yield-carry/src/client/types/tx.js +2 -0
  171. package/dist/sdks/long-yield-carry/src/constants/configs/allocations.d.ts +3 -0
  172. package/dist/sdks/long-yield-carry/src/constants/configs/allocations.js +23 -0
  173. package/dist/sdks/long-yield-carry/src/constants/configs/carryTradePresets.d.ts +58 -0
  174. package/dist/sdks/long-yield-carry/src/constants/configs/carryTradePresets.js +116 -0
  175. package/dist/sdks/long-yield-carry/src/constants/configs/index.d.ts +2 -0
  176. package/dist/sdks/long-yield-carry/src/constants/configs/index.js +18 -0
  177. package/dist/sdks/long-yield-carry/src/constants/general.d.ts +70 -0
  178. package/dist/sdks/long-yield-carry/src/constants/general.js +107 -0
  179. package/dist/sdks/long-yield-carry/src/constants/index.d.ts +3 -0
  180. package/dist/sdks/long-yield-carry/src/constants/index.js +19 -0
  181. package/dist/sdks/long-yield-carry/src/constants/lycTokenMetadata.d.ts +36 -0
  182. package/dist/sdks/long-yield-carry/src/constants/lycTokenMetadata.js +41 -0
  183. package/dist/sdks/long-yield-carry/src/decoders/decodeTransaction.d.ts +86 -0
  184. package/dist/sdks/long-yield-carry/src/decoders/decodeTransaction.js +230 -0
  185. package/dist/sdks/long-yield-carry/src/decoders/discriminators.d.ts +8 -0
  186. package/dist/sdks/long-yield-carry/src/decoders/discriminators.js +11 -0
  187. package/dist/sdks/long-yield-carry/src/decoders/idlAccounts.d.ts +29 -0
  188. package/dist/sdks/long-yield-carry/src/decoders/idlAccounts.js +57 -0
  189. package/dist/sdks/long-yield-carry/src/decoders/index.d.ts +6 -0
  190. package/dist/sdks/long-yield-carry/src/decoders/index.js +14 -0
  191. package/dist/sdks/long-yield-carry/src/decoders/innerCpis.d.ts +68 -0
  192. package/dist/sdks/long-yield-carry/src/decoders/innerCpis.js +225 -0
  193. package/dist/sdks/long-yield-carry/src/decoders/lycInstructionNames.d.ts +6 -0
  194. package/dist/sdks/long-yield-carry/src/decoders/lycInstructionNames.js +73 -0
  195. package/dist/sdks/long-yield-carry/src/decoders/programIds.d.ts +4 -0
  196. package/dist/sdks/long-yield-carry/src/decoders/programIds.js +11 -0
  197. package/dist/sdks/long-yield-carry/src/decoders/solana.d.ts +7 -0
  198. package/dist/sdks/long-yield-carry/src/decoders/solana.js +30 -0
  199. package/dist/sdks/long-yield-carry/src/decoders/transactionPayload.d.ts +41 -0
  200. package/dist/sdks/long-yield-carry/src/decoders/transactionPayload.js +6 -0
  201. package/dist/sdks/long-yield-carry/src/decoders/types.d.ts +58 -0
  202. package/dist/sdks/long-yield-carry/src/decoders/types.js +2 -0
  203. package/dist/sdks/long-yield-carry/src/errors.d.ts +69 -0
  204. package/dist/sdks/long-yield-carry/src/errors.js +183 -0
  205. package/dist/sdks/long-yield-carry/src/idl/long_yield_carry.d.ts +7327 -0
  206. package/dist/sdks/long-yield-carry/src/idl/long_yield_carry.js +7323 -0
  207. package/dist/sdks/long-yield-carry/src/index.d.ts +10 -0
  208. package/dist/sdks/long-yield-carry/src/index.js +25 -0
  209. package/dist/sdks/long-yield-carry/src/metrics/index.d.ts +1 -0
  210. package/dist/sdks/long-yield-carry/src/metrics/index.js +17 -0
  211. package/dist/sdks/long-yield-carry/src/metrics/protocolMetrics.d.ts +276 -0
  212. package/dist/sdks/long-yield-carry/src/metrics/protocolMetrics.js +547 -0
  213. package/dist/sdks/long-yield-carry/src/models/index.d.ts +3 -0
  214. package/dist/sdks/long-yield-carry/src/models/index.js +7 -0
  215. package/dist/sdks/long-yield-carry/src/models/lycToken.d.ts +156 -0
  216. package/dist/sdks/long-yield-carry/src/models/lycToken.js +288 -0
  217. package/dist/sdks/long-yield-carry/src/models/yieldingBank.d.ts +52 -0
  218. package/dist/sdks/long-yield-carry/src/models/yieldingBank.js +109 -0
  219. package/dist/sdks/long-yield-carry/src/services/allocation/allocationService.d.ts +106 -0
  220. package/dist/sdks/long-yield-carry/src/services/allocation/allocationService.js +589 -0
  221. package/dist/sdks/long-yield-carry/src/services/allocation/index.d.ts +2 -0
  222. package/dist/sdks/long-yield-carry/src/services/allocation/index.js +18 -0
  223. package/dist/sdks/long-yield-carry/src/services/allocation/types.d.ts +25 -0
  224. package/dist/sdks/long-yield-carry/src/services/allocation/types.js +2 -0
  225. package/dist/sdks/long-yield-carry/src/services/carry/carryAllocationConfig.d.ts +103 -0
  226. package/dist/sdks/long-yield-carry/src/services/carry/carryAllocationConfig.js +146 -0
  227. package/dist/sdks/long-yield-carry/src/services/carry/index.d.ts +2 -0
  228. package/dist/sdks/long-yield-carry/src/services/carry/index.js +18 -0
  229. package/dist/sdks/long-yield-carry/src/services/carry/lycLendingPositionManager.d.ts +39 -0
  230. package/dist/sdks/long-yield-carry/src/services/carry/lycLendingPositionManager.js +100 -0
  231. package/dist/sdks/long-yield-carry/src/services/index.d.ts +5 -0
  232. package/dist/sdks/long-yield-carry/src/services/index.js +21 -0
  233. package/dist/sdks/long-yield-carry/src/services/lendingPosition/index.d.ts +2 -0
  234. package/dist/sdks/long-yield-carry/src/services/lendingPosition/index.js +5 -0
  235. package/dist/sdks/long-yield-carry/src/services/lendingPosition/lendingPositionService.d.ts +88 -0
  236. package/dist/sdks/long-yield-carry/src/services/lendingPosition/lendingPositionService.js +229 -0
  237. package/dist/sdks/long-yield-carry/src/services/rebalance/index.d.ts +2 -0
  238. package/dist/sdks/long-yield-carry/src/services/rebalance/index.js +18 -0
  239. package/dist/sdks/long-yield-carry/src/services/rebalance/token/index.d.ts +1 -0
  240. package/dist/sdks/long-yield-carry/src/services/rebalance/token/index.js +17 -0
  241. package/dist/sdks/long-yield-carry/src/services/rebalance/token/tokenRebalanceService.d.ts +51 -0
  242. package/dist/sdks/long-yield-carry/src/services/rebalance/token/tokenRebalanceService.js +99 -0
  243. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/index.d.ts +3 -0
  244. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/index.js +21 -0
  245. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/planner.d.ts +68 -0
  246. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/planner.js +181 -0
  247. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/strategy.d.ts +26 -0
  248. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/strategy.js +26 -0
  249. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/types.d.ts +40 -0
  250. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/types.js +2 -0
  251. package/dist/sdks/long-yield-carry/src/services/redemption/index.d.ts +2 -0
  252. package/dist/sdks/long-yield-carry/src/services/redemption/index.js +5 -0
  253. package/dist/sdks/long-yield-carry/src/services/redemption/redemptionService.d.ts +139 -0
  254. package/dist/sdks/long-yield-carry/src/services/redemption/redemptionService.js +532 -0
  255. package/dist/sdks/long-yield-carry/src/types/enriched.d.ts +168 -0
  256. package/dist/sdks/long-yield-carry/src/types/enriched.js +2 -0
  257. package/dist/sdks/long-yield-carry/src/types/index.d.ts +1 -0
  258. package/dist/sdks/long-yield-carry/src/types/index.js +17 -0
  259. package/dist/sdks/long-yield-carry/src/utils/cache.d.ts +4 -0
  260. package/dist/sdks/long-yield-carry/src/utils/cache.js +10 -0
  261. package/dist/sdks/long-yield-carry/src/utils/data.d.ts +12 -0
  262. package/dist/sdks/long-yield-carry/src/utils/data.js +59 -0
  263. package/dist/sdks/long-yield-carry/src/utils/enrichment.d.ts +5 -0
  264. package/dist/sdks/long-yield-carry/src/utils/enrichment.js +244 -0
  265. package/dist/sdks/long-yield-carry/src/utils/feeDripMetrics.d.ts +36 -0
  266. package/dist/sdks/long-yield-carry/src/utils/feeDripMetrics.js +93 -0
  267. package/dist/sdks/long-yield-carry/src/utils/general.d.ts +28 -0
  268. package/dist/sdks/long-yield-carry/src/utils/general.js +47 -0
  269. package/dist/sdks/long-yield-carry/src/utils/index.d.ts +13 -0
  270. package/dist/sdks/long-yield-carry/src/utils/index.js +29 -0
  271. package/dist/sdks/long-yield-carry/src/utils/ix.d.ts +83 -0
  272. package/dist/sdks/long-yield-carry/src/utils/ix.js +165 -0
  273. package/dist/sdks/long-yield-carry/src/utils/lendingPosition.d.ts +68 -0
  274. package/dist/sdks/long-yield-carry/src/utils/lendingPosition.js +105 -0
  275. package/dist/sdks/long-yield-carry/src/utils/lookupTables.d.ts +55 -0
  276. package/dist/sdks/long-yield-carry/src/utils/lookupTables.js +216 -0
  277. package/dist/sdks/long-yield-carry/src/utils/lycData.d.ts +66 -0
  278. package/dist/sdks/long-yield-carry/src/utils/lycData.js +211 -0
  279. package/dist/sdks/long-yield-carry/src/utils/timelock.d.ts +19 -0
  280. package/dist/sdks/long-yield-carry/src/utils/timelock.js +37 -0
  281. package/dist/sdks/long-yield-carry/src/utils/tokenFeeMath.d.ts +11 -0
  282. package/dist/sdks/long-yield-carry/src/utils/tokenFeeMath.js +24 -0
  283. package/dist/sdks/long-yield-carry/src/utils/transactions.d.ts +20 -0
  284. package/dist/sdks/long-yield-carry/src/utils/transactions.js +72 -0
  285. package/dist/sdks/long-yield-carry/src/utils/yieldingBank.d.ts +24 -0
  286. package/dist/sdks/long-yield-carry/src/utils/yieldingBank.js +36 -0
  287. package/dist/shared/common/src/constants/accountMetas.d.ts +3 -0
  288. package/dist/shared/common/src/constants/accountMetas.js +9 -0
  289. package/dist/shared/common/src/constants/general.d.ts +21 -0
  290. package/dist/shared/common/src/constants/general.js +30 -0
  291. package/dist/shared/common/src/constants/generated/cpi.d.ts +23 -0
  292. package/dist/shared/common/src/constants/generated/cpi.js +28 -0
  293. package/dist/shared/common/src/constants/generated/index.d.ts +1 -0
  294. package/dist/shared/common/src/constants/generated/index.js +17 -0
  295. package/dist/shared/common/src/constants/index.d.ts +3 -0
  296. package/dist/shared/common/src/constants/index.js +19 -0
  297. package/dist/shared/common/src/index.d.ts +4 -0
  298. package/dist/shared/common/src/index.js +20 -0
  299. package/dist/shared/common/src/services/baseAccountClient.d.ts +22 -0
  300. package/dist/shared/common/src/services/baseAccountClient.js +38 -0
  301. package/dist/shared/common/src/services/baseIxBuilderService.d.ts +27 -0
  302. package/dist/shared/common/src/services/baseIxBuilderService.js +48 -0
  303. package/dist/shared/common/src/services/dataCache.d.ts +41 -0
  304. package/dist/shared/common/src/services/dataCache.js +130 -0
  305. package/dist/shared/common/src/services/index.d.ts +8 -0
  306. package/dist/shared/common/src/services/index.js +24 -0
  307. package/dist/shared/common/src/services/lutManager.d.ts +31 -0
  308. package/dist/shared/common/src/services/lutManager.js +133 -0
  309. package/dist/shared/common/src/services/mints/defaults.d.ts +2 -0
  310. package/dist/shared/common/src/services/mints/defaults.js +152 -0
  311. package/dist/shared/common/src/services/mints/index.d.ts +4 -0
  312. package/dist/shared/common/src/services/mints/index.js +20 -0
  313. package/dist/shared/common/src/services/mints/registry.d.ts +70 -0
  314. package/dist/shared/common/src/services/mints/registry.js +117 -0
  315. package/dist/shared/common/src/services/mints/symbols.d.ts +6 -0
  316. package/dist/shared/common/src/services/mints/symbols.js +13 -0
  317. package/dist/shared/common/src/services/mints/types.d.ts +30 -0
  318. package/dist/shared/common/src/services/mints/types.js +2 -0
  319. package/dist/shared/common/src/services/swap/index.d.ts +4 -0
  320. package/dist/shared/common/src/services/swap/index.js +20 -0
  321. package/dist/shared/common/src/services/swap/routableSwapClient.d.ts +36 -0
  322. package/dist/shared/common/src/services/swap/routableSwapClient.js +2 -0
  323. package/dist/shared/common/src/services/swap/swapClientBase.d.ts +45 -0
  324. package/dist/shared/common/src/services/swap/swapClientBase.js +2 -0
  325. package/dist/shared/common/src/services/swap/swapRouting.d.ts +13 -0
  326. package/dist/shared/common/src/services/swap/swapRouting.js +28 -0
  327. package/dist/shared/common/src/services/swap/types.d.ts +77 -0
  328. package/dist/shared/common/src/services/swap/types.js +2 -0
  329. package/dist/shared/common/src/services/token/index.d.ts +2 -0
  330. package/dist/shared/common/src/services/token/index.js +18 -0
  331. package/dist/shared/common/src/services/token/tokenProtocolClientBase.d.ts +51 -0
  332. package/dist/shared/common/src/services/token/tokenProtocolClientBase.js +2 -0
  333. package/dist/shared/common/src/services/token/types.d.ts +19 -0
  334. package/dist/shared/common/src/services/token/types.js +2 -0
  335. package/dist/shared/common/src/services/transactionSender.d.ts +24 -0
  336. package/dist/shared/common/src/services/transactionSender.js +30 -0
  337. package/dist/shared/common/src/types/cpi.d.ts +34 -0
  338. package/dist/shared/common/src/types/cpi.js +8 -0
  339. package/dist/shared/common/src/types/enums.d.ts +59 -0
  340. package/dist/shared/common/src/types/enums.js +122 -0
  341. package/dist/shared/common/src/types/general.d.ts +38 -0
  342. package/dist/shared/common/src/types/general.js +2 -0
  343. package/dist/shared/common/src/types/index.d.ts +4 -0
  344. package/dist/shared/common/src/types/index.js +20 -0
  345. package/dist/shared/common/src/types/solana.d.ts +24 -0
  346. package/dist/shared/common/src/types/solana.js +2 -0
  347. package/dist/shared/common/src/utils/accounts/index.d.ts +5 -0
  348. package/dist/shared/common/src/utils/accounts/index.js +21 -0
  349. package/dist/shared/common/src/utils/accounts/meta.d.ts +21 -0
  350. package/dist/shared/common/src/utils/accounts/meta.js +27 -0
  351. package/dist/shared/common/src/utils/accounts/pda.d.ts +2 -0
  352. package/dist/shared/common/src/utils/accounts/pda.js +17 -0
  353. package/dist/shared/common/src/utils/accounts/roles.d.ts +26 -0
  354. package/dist/shared/common/src/utils/accounts/roles.js +54 -0
  355. package/dist/shared/common/src/utils/accounts/rpc.d.ts +8 -0
  356. package/dist/shared/common/src/utils/accounts/rpc.js +30 -0
  357. package/dist/shared/common/src/utils/accounts/splBalances.d.ts +15 -0
  358. package/dist/shared/common/src/utils/accounts/splBalances.js +52 -0
  359. package/dist/shared/common/src/utils/anchor.d.ts +17 -0
  360. package/dist/shared/common/src/utils/anchor.js +29 -0
  361. package/dist/shared/common/src/utils/asyncConcurrency.d.ts +5 -0
  362. package/dist/shared/common/src/utils/asyncConcurrency.js +28 -0
  363. package/dist/shared/common/src/utils/compat.d.ts +46 -0
  364. package/dist/shared/common/src/utils/compat.js +72 -0
  365. package/dist/shared/common/src/utils/cpi/args.d.ts +69 -0
  366. package/dist/shared/common/src/utils/cpi/args.js +100 -0
  367. package/dist/shared/common/src/utils/cpi/index.d.ts +2 -0
  368. package/dist/shared/common/src/utils/cpi/index.js +18 -0
  369. package/dist/shared/common/src/utils/cpi/refs.d.ts +122 -0
  370. package/dist/shared/common/src/utils/cpi/refs.js +234 -0
  371. package/dist/shared/common/src/utils/data.d.ts +20 -0
  372. package/dist/shared/common/src/utils/data.js +27 -0
  373. package/dist/shared/common/src/utils/general.d.ts +24 -0
  374. package/dist/shared/common/src/utils/general.js +95 -0
  375. package/dist/shared/common/src/utils/index.d.ts +22 -0
  376. package/dist/shared/common/src/utils/index.js +38 -0
  377. package/dist/shared/common/src/utils/instruction.d.ts +74 -0
  378. package/dist/shared/common/src/utils/instruction.js +147 -0
  379. package/dist/shared/common/src/utils/jito.d.ts +113 -0
  380. package/dist/shared/common/src/utils/jito.js +178 -0
  381. package/dist/shared/common/src/utils/json.d.ts +5 -0
  382. package/dist/shared/common/src/utils/json.js +25 -0
  383. package/dist/shared/common/src/utils/jsonRpcFetch.d.ts +21 -0
  384. package/dist/shared/common/src/utils/jsonRpcFetch.js +134 -0
  385. package/dist/shared/common/src/utils/metadata.d.ts +107 -0
  386. package/dist/shared/common/src/utils/metadata.js +194 -0
  387. package/dist/shared/common/src/utils/numbers.d.ts +72 -0
  388. package/dist/shared/common/src/utils/numbers.js +193 -0
  389. package/dist/shared/common/src/utils/priorityFee.d.ts +18 -0
  390. package/dist/shared/common/src/utils/priorityFee.js +63 -0
  391. package/dist/shared/common/src/utils/retry.d.ts +20 -0
  392. package/dist/shared/common/src/utils/retry.js +69 -0
  393. package/dist/shared/common/src/utils/rpc.d.ts +40 -0
  394. package/dist/shared/common/src/utils/rpc.js +130 -0
  395. package/dist/shared/common/src/utils/solana.d.ts +23 -0
  396. package/dist/shared/common/src/utils/solana.js +61 -0
  397. package/dist/shared/common/src/utils/timeSeries.d.ts +18 -0
  398. package/dist/shared/common/src/utils/timeSeries.js +40 -0
  399. package/dist/shared/common/src/utils/token.d.ts +33 -0
  400. package/dist/shared/common/src/utils/token.js +82 -0
  401. package/dist/shared/common/src/utils/transaction.d.ts +154 -0
  402. package/dist/shared/common/src/utils/transaction.js +585 -0
  403. package/dist/shared/common/src/utils/transactionSplitter.d.ts +85 -0
  404. package/dist/shared/common/src/utils/transactionSplitter.js +127 -0
  405. package/dist/shared/common/src/utils/txAccountCoverage.d.ts +49 -0
  406. package/dist/shared/common/src/utils/txAccountCoverage.js +122 -0
  407. package/dist/shared/jupiter-helpers/src/api.d.ts +59 -0
  408. package/dist/shared/jupiter-helpers/src/api.js +130 -0
  409. package/dist/shared/jupiter-helpers/src/client.d.ts +79 -0
  410. package/dist/shared/jupiter-helpers/src/client.js +173 -0
  411. package/dist/shared/jupiter-helpers/src/constants.d.ts +35 -0
  412. package/dist/shared/jupiter-helpers/src/constants.js +38 -0
  413. package/dist/shared/jupiter-helpers/src/extract.d.ts +30 -0
  414. package/dist/shared/jupiter-helpers/src/extract.js +57 -0
  415. package/dist/shared/jupiter-helpers/src/index.d.ts +5 -0
  416. package/dist/shared/jupiter-helpers/src/index.js +21 -0
  417. package/dist/shared/jupiter-helpers/src/routePreInstructions.d.ts +19 -0
  418. package/dist/shared/jupiter-helpers/src/routePreInstructions.js +61 -0
  419. package/dist/shared/jupiter-helpers/src/sizeExactInForMinOutput.d.ts +70 -0
  420. package/dist/shared/jupiter-helpers/src/sizeExactInForMinOutput.js +95 -0
  421. package/dist/shared/jupiter-helpers/src/types.d.ts +66 -0
  422. package/dist/shared/jupiter-helpers/src/types.js +2 -0
  423. package/dist/shared/lending-platforms/src/constants/cache.d.ts +8 -0
  424. package/dist/shared/lending-platforms/src/constants/cache.js +11 -0
  425. package/dist/shared/lending-platforms/src/constants/index.d.ts +3 -0
  426. package/dist/shared/lending-platforms/src/constants/index.js +19 -0
  427. package/dist/shared/lending-platforms/src/constants/kamino.d.ts +7 -0
  428. package/dist/shared/lending-platforms/src/constants/kamino.js +83 -0
  429. package/dist/shared/lending-platforms/src/constants/lendingPosition.d.ts +7 -0
  430. package/dist/shared/lending-platforms/src/constants/lendingPosition.js +10 -0
  431. package/dist/shared/lending-platforms/src/data/accounts/index.d.ts +2 -0
  432. package/dist/shared/lending-platforms/src/data/accounts/index.js +18 -0
  433. package/dist/shared/lending-platforms/src/data/accounts/kamino.d.ts +42 -0
  434. package/dist/shared/lending-platforms/src/data/accounts/kamino.js +104 -0
  435. package/dist/shared/lending-platforms/src/data/accounts/lpAccountsBase.d.ts +7 -0
  436. package/dist/shared/lending-platforms/src/data/accounts/lpAccountsBase.js +9 -0
  437. package/dist/shared/lending-platforms/src/data/incentive/incentiveBase.d.ts +35 -0
  438. package/dist/shared/lending-platforms/src/data/incentive/incentiveBase.js +26 -0
  439. package/dist/shared/lending-platforms/src/data/incentive/index.d.ts +2 -0
  440. package/dist/shared/lending-platforms/src/data/incentive/index.js +18 -0
  441. package/dist/shared/lending-platforms/src/data/incentive/kamino.d.ts +55 -0
  442. package/dist/shared/lending-platforms/src/data/incentive/kamino.js +101 -0
  443. package/dist/shared/lending-platforms/src/data/index.d.ts +6 -0
  444. package/dist/shared/lending-platforms/src/data/index.js +22 -0
  445. package/dist/shared/lending-platforms/src/data/instructions/index.d.ts +3 -0
  446. package/dist/shared/lending-platforms/src/data/instructions/index.js +19 -0
  447. package/dist/shared/lending-platforms/src/data/instructions/kamino.d.ts +55 -0
  448. package/dist/shared/lending-platforms/src/data/instructions/kamino.js +630 -0
  449. package/dist/shared/lending-platforms/src/data/instructions/lpInstructionsBase.d.ts +175 -0
  450. package/dist/shared/lending-platforms/src/data/instructions/lpInstructionsBase.js +192 -0
  451. package/dist/shared/lending-platforms/src/data/instructions/types.d.ts +7 -0
  452. package/dist/shared/lending-platforms/src/data/instructions/types.js +2 -0
  453. package/dist/shared/lending-platforms/src/data/platform/index.d.ts +2 -0
  454. package/dist/shared/lending-platforms/src/data/platform/index.js +18 -0
  455. package/dist/shared/lending-platforms/src/data/platform/kamino.d.ts +59 -0
  456. package/dist/shared/lending-platforms/src/data/platform/kamino.js +206 -0
  457. package/dist/shared/lending-platforms/src/data/platform/lpDataBase.d.ts +35 -0
  458. package/dist/shared/lending-platforms/src/data/platform/lpDataBase.js +31 -0
  459. package/dist/shared/lending-platforms/src/data/reserve/index.d.ts +2 -0
  460. package/dist/shared/lending-platforms/src/data/reserve/index.js +18 -0
  461. package/dist/shared/lending-platforms/src/data/reserve/kamino.d.ts +45 -0
  462. package/dist/shared/lending-platforms/src/data/reserve/kamino.js +141 -0
  463. package/dist/shared/lending-platforms/src/data/reserve/reserveBase.d.ts +114 -0
  464. package/dist/shared/lending-platforms/src/data/reserve/reserveBase.js +125 -0
  465. package/dist/shared/lending-platforms/src/data/userPosition/index.d.ts +2 -0
  466. package/dist/shared/lending-platforms/src/data/userPosition/index.js +18 -0
  467. package/dist/shared/lending-platforms/src/data/userPosition/kamino.d.ts +15 -0
  468. package/dist/shared/lending-platforms/src/data/userPosition/kamino.js +45 -0
  469. package/dist/shared/lending-platforms/src/data/userPosition/userPositionBase.d.ts +50 -0
  470. package/dist/shared/lending-platforms/src/data/userPosition/userPositionBase.js +63 -0
  471. package/dist/shared/lending-platforms/src/index.d.ts +5 -0
  472. package/dist/shared/lending-platforms/src/index.js +21 -0
  473. package/dist/shared/lending-platforms/src/services/client/index.d.ts +2 -0
  474. package/dist/shared/lending-platforms/src/services/client/index.js +18 -0
  475. package/dist/shared/lending-platforms/src/services/client/kamino.d.ts +53 -0
  476. package/dist/shared/lending-platforms/src/services/client/kamino.js +142 -0
  477. package/dist/shared/lending-platforms/src/services/client/lpClientBase.d.ts +66 -0
  478. package/dist/shared/lending-platforms/src/services/client/lpClientBase.js +19 -0
  479. package/dist/shared/lending-platforms/src/services/flashLoan/flashLoanBase.d.ts +49 -0
  480. package/dist/shared/lending-platforms/src/services/flashLoan/flashLoanBase.js +16 -0
  481. package/dist/shared/lending-platforms/src/services/flashLoan/index.d.ts +2 -0
  482. package/dist/shared/lending-platforms/src/services/flashLoan/index.js +18 -0
  483. package/dist/shared/lending-platforms/src/services/flashLoan/kamino.d.ts +11 -0
  484. package/dist/shared/lending-platforms/src/services/flashLoan/kamino.js +85 -0
  485. package/dist/shared/lending-platforms/src/services/index.d.ts +5 -0
  486. package/dist/shared/lending-platforms/src/services/index.js +21 -0
  487. package/dist/shared/lending-platforms/src/services/lendingPosition/index.d.ts +2 -0
  488. package/dist/shared/lending-platforms/src/services/lendingPosition/index.js +18 -0
  489. package/dist/shared/lending-platforms/src/services/lendingPosition/lendingPositionManager.d.ts +117 -0
  490. package/dist/shared/lending-platforms/src/services/lendingPosition/lendingPositionManager.js +342 -0
  491. package/dist/shared/lending-platforms/src/services/lendingPosition/types.d.ts +40 -0
  492. package/dist/shared/lending-platforms/src/services/lendingPosition/types.js +2 -0
  493. package/dist/shared/lending-platforms/src/services/leverage/index.d.ts +2 -0
  494. package/dist/shared/lending-platforms/src/services/leverage/index.js +18 -0
  495. package/dist/shared/lending-platforms/src/services/leverage/leverageService.d.ts +104 -0
  496. package/dist/shared/lending-platforms/src/services/leverage/leverageService.js +437 -0
  497. package/dist/shared/lending-platforms/src/services/leverage/types.d.ts +261 -0
  498. package/dist/shared/lending-platforms/src/services/leverage/types.js +2 -0
  499. package/dist/shared/lending-platforms/src/services/reservesManager.d.ts +53 -0
  500. package/dist/shared/lending-platforms/src/services/reservesManager.js +112 -0
  501. package/dist/shared/lending-platforms/src/types/general.d.ts +37 -0
  502. package/dist/shared/lending-platforms/src/types/general.js +8 -0
  503. package/dist/shared/lending-platforms/src/types/index.d.ts +2 -0
  504. package/dist/shared/lending-platforms/src/types/index.js +18 -0
  505. package/dist/shared/lending-platforms/src/types/kamino.d.ts +10 -0
  506. package/dist/shared/lending-platforms/src/types/kamino.js +2 -0
  507. package/dist/shared/lending-platforms/src/utils/accounts.d.ts +16 -0
  508. package/dist/shared/lending-platforms/src/utils/accounts.js +36 -0
  509. package/dist/shared/lending-platforms/src/utils/cache.d.ts +3 -0
  510. package/dist/shared/lending-platforms/src/utils/cache.js +11 -0
  511. package/dist/shared/lending-platforms/src/utils/index.d.ts +6 -0
  512. package/dist/shared/lending-platforms/src/utils/index.js +22 -0
  513. package/dist/shared/lending-platforms/src/utils/kamino.d.ts +87 -0
  514. package/dist/shared/lending-platforms/src/utils/kamino.js +190 -0
  515. package/dist/shared/lending-platforms/src/utils/lendingPlatform.d.ts +6 -0
  516. package/dist/shared/lending-platforms/src/utils/lendingPlatform.js +16 -0
  517. package/dist/shared/lending-platforms/src/utils/math.d.ts +47 -0
  518. package/dist/shared/lending-platforms/src/utils/math.js +123 -0
  519. package/dist/shared/lending-platforms/src/utils/scope.d.ts +38 -0
  520. package/dist/shared/lending-platforms/src/utils/scope.js +144 -0
  521. package/dist/shared/oracle-service/src/constants/index.d.ts +3 -0
  522. package/dist/shared/oracle-service/src/constants/index.js +19 -0
  523. package/dist/shared/oracle-service/src/constants/pyth.d.ts +7 -0
  524. package/dist/shared/oracle-service/src/constants/pyth.js +71 -0
  525. package/dist/shared/oracle-service/src/constants/splStake.d.ts +2 -0
  526. package/dist/shared/oracle-service/src/constants/splStake.js +6 -0
  527. package/dist/shared/oracle-service/src/constants/switchboard.d.ts +7 -0
  528. package/dist/shared/oracle-service/src/constants/switchboard.js +10 -0
  529. package/dist/shared/oracle-service/src/feeds/custom.d.ts +30 -0
  530. package/dist/shared/oracle-service/src/feeds/custom.js +56 -0
  531. package/dist/shared/oracle-service/src/feeds/jupiter.d.ts +7 -0
  532. package/dist/shared/oracle-service/src/feeds/jupiter.js +43 -0
  533. package/dist/shared/oracle-service/src/feeds/priceBase.d.ts +13 -0
  534. package/dist/shared/oracle-service/src/feeds/priceBase.js +25 -0
  535. package/dist/shared/oracle-service/src/feeds/pyth.d.ts +8 -0
  536. package/dist/shared/oracle-service/src/feeds/pyth.js +59 -0
  537. package/dist/shared/oracle-service/src/feeds/splStake.d.ts +26 -0
  538. package/dist/shared/oracle-service/src/feeds/splStake.js +99 -0
  539. package/dist/shared/oracle-service/src/feeds/switchboard.d.ts +6 -0
  540. package/dist/shared/oracle-service/src/feeds/switchboard.js +11 -0
  541. package/dist/shared/oracle-service/src/index.d.ts +5 -0
  542. package/dist/shared/oracle-service/src/index.js +26 -0
  543. package/dist/shared/oracle-service/src/oracle.d.ts +22 -0
  544. package/dist/shared/oracle-service/src/oracle.js +104 -0
  545. package/dist/shared/oracle-service/src/types.d.ts +4 -0
  546. package/dist/shared/oracle-service/src/types.js +2 -0
  547. package/dist/shared/oracle-service/src/utils/general.d.ts +20 -0
  548. package/dist/shared/oracle-service/src/utils/general.js +65 -0
  549. package/dist/shared/oracle-service/src/utils/index.d.ts +1 -0
  550. package/dist/shared/oracle-service/src/utils/index.js +17 -0
  551. package/dist/shared/perena-helpers/src/accounts.d.ts +7 -0
  552. package/dist/shared/perena-helpers/src/accounts.js +12 -0
  553. package/dist/shared/perena-helpers/src/client.d.ts +299 -0
  554. package/dist/shared/perena-helpers/src/client.js +680 -0
  555. package/dist/shared/perena-helpers/src/constants.d.ts +5 -0
  556. package/dist/shared/perena-helpers/src/constants.js +8 -0
  557. package/dist/shared/perena-helpers/src/cpi/burn.d.ts +27 -0
  558. package/dist/shared/perena-helpers/src/cpi/burn.js +22 -0
  559. package/dist/shared/perena-helpers/src/cpi/index.d.ts +3 -0
  560. package/dist/shared/perena-helpers/src/cpi/index.js +19 -0
  561. package/dist/shared/perena-helpers/src/cpi/mint.d.ts +27 -0
  562. package/dist/shared/perena-helpers/src/cpi/mint.js +22 -0
  563. package/dist/shared/perena-helpers/src/cpi/requestUnstake.d.ts +19 -0
  564. package/dist/shared/perena-helpers/src/cpi/requestUnstake.js +16 -0
  565. package/dist/shared/perena-helpers/src/index.d.ts +5 -0
  566. package/dist/shared/perena-helpers/src/index.js +21 -0
  567. package/dist/shared/perena-helpers/src/utils.d.ts +9 -0
  568. package/dist/shared/perena-helpers/src/utils.js +54 -0
  569. package/dist/shared/swap-aggregator/src/aggSwapClient.d.ts +71 -0
  570. package/dist/shared/swap-aggregator/src/aggSwapClient.js +103 -0
  571. package/dist/shared/swap-aggregator/src/index.d.ts +1 -0
  572. package/dist/shared/swap-aggregator/src/index.js +17 -0
  573. package/docs/launchingToken.md +57 -0
  574. package/package.json +75 -0
  575. package/scripts/asyncBurn.ts +155 -0
  576. package/scripts/burnToken.ts +120 -0
  577. package/scripts/claimIncentives.ts +125 -0
  578. package/scripts/closeCpiPlans.ts +113 -0
  579. package/scripts/collectInterest.ts +194 -0
  580. package/scripts/collectProtocolFees.ts +144 -0
  581. package/scripts/computeOptimalAllocations.ts +117 -0
  582. package/scripts/createToken.ts +100 -0
  583. package/scripts/createTokenLendingPosition.ts +204 -0
  584. package/scripts/createYieldingBank.ts +91 -0
  585. package/scripts/decreaseCarryPositions.ts +359 -0
  586. package/scripts/depositUnlentCollateral.ts +106 -0
  587. package/scripts/emergency/deleverageAll.ts +287 -0
  588. package/scripts/emergency/triggerCircuitBreaker.ts +87 -0
  589. package/scripts/env.ts +4 -0
  590. package/scripts/findTxs.ts +169 -0
  591. package/scripts/increaseCarryPositions.ts +134 -0
  592. package/scripts/inspect/format.ts +576 -0
  593. package/scripts/inspect.ts +147 -0
  594. package/scripts/localUtils.ts +249 -0
  595. package/scripts/mintToken.ts +126 -0
  596. package/scripts/processAsyncBurns.ts +89 -0
  597. package/scripts/rebalanceToken.ts +269 -0
  598. package/scripts/rebalanceYieldingBank.ts +183 -0
  599. package/scripts/recollateralizeLoss.ts +79 -0
  600. package/scripts/refresh.ts +156 -0
  601. package/scripts/updateFees.ts +486 -0
  602. package/scripts/updateGeneralLut.ts +36 -0
  603. package/scripts/updateLendingPositionConfig.ts +172 -0
  604. package/scripts/updateTokenLuts.ts +36 -0
  605. package/scripts/updateTokenMetadata.ts +199 -0
  606. package/scripts/updateYieldingBankConfig.ts +100 -0
  607. package/scripts/withdrawUnlentCollateral.ts +178 -0
  608. package/src/client/account.ts +503 -0
  609. package/src/client/builders/args.ts +381 -0
  610. package/src/client/builders/asyncBurnBuilder.ts +305 -0
  611. package/src/client/builders/base.ts +303 -0
  612. package/src/client/builders/burnTokenBuilder.ts +258 -0
  613. package/src/client/builders/claimIncentivesBuilder.ts +211 -0
  614. package/src/client/builders/collectFeesBuilder.ts +52 -0
  615. package/src/client/builders/collectInterestBuilder.ts +165 -0
  616. package/src/client/builders/createCpiPlanBuilder.ts +21 -0
  617. package/src/client/builders/createTokenBuilder.ts +73 -0
  618. package/src/client/builders/createTokenLendingPositionBuilder.ts +219 -0
  619. package/src/client/builders/createYieldingBankAllocationBuilder.ts +32 -0
  620. package/src/client/builders/createYieldingBankBuilder.ts +39 -0
  621. package/src/client/builders/decreaseCarryPositionBuilder.ts +162 -0
  622. package/src/client/builders/depositUnlentCollateralBuilder.ts +95 -0
  623. package/src/client/builders/increaseCarryPositionBuilder.ts +105 -0
  624. package/src/client/builders/index.ts +37 -0
  625. package/src/client/builders/mintTokenBuilder.ts +137 -0
  626. package/src/client/builders/rebalanceTokenBuilder.ts +356 -0
  627. package/src/client/builders/rebalanceYieldingBankBuilder.ts +109 -0
  628. package/src/client/builders/recollateralizeLossBuilder.ts +367 -0
  629. package/src/client/builders/refreshTokenStateBuilder.ts +153 -0
  630. package/src/client/builders/refreshTokensBuilder.ts +82 -0
  631. package/src/client/builders/refreshYieldingBankBuilder.ts +42 -0
  632. package/src/client/builders/resetTokenBurnRateLimitBuilder.ts +21 -0
  633. package/src/client/builders/setTokenCircuitBreakerBuilder.ts +40 -0
  634. package/src/client/builders/setYieldingBankCircuitBreakerBuilder.ts +37 -0
  635. package/src/client/builders/updateLendingPositionConfigBuilder.ts +33 -0
  636. package/src/client/builders/updateTokenConfigurationBuilder.ts +50 -0
  637. package/src/client/builders/updateTokenMetadataBuilder.ts +24 -0
  638. package/src/client/builders/updateYieldingBankConfigBuilder.ts +32 -0
  639. package/src/client/builders/utils.ts +26 -0
  640. package/src/client/client.ts +264 -0
  641. package/src/client/externalLiquidityResolver.ts +54 -0
  642. package/src/client/index.ts +20 -0
  643. package/src/client/lendingPlatformClients.ts +50 -0
  644. package/src/client/pda.ts +102 -0
  645. package/src/client/plans/collectInterest.ts +207 -0
  646. package/src/client/plans/decreaseCarryPosition.ts +226 -0
  647. package/src/client/routes/collectInterest.ts +56 -0
  648. package/src/client/transaction.ts +106 -0
  649. package/src/client/types/builders.ts +19 -0
  650. package/src/client/types/enums.ts +47 -0
  651. package/src/client/types/general.ts +117 -0
  652. package/src/client/types/index.ts +6 -0
  653. package/src/client/types/ix.ts +452 -0
  654. package/src/client/types/planTypes/collectInterest.ts +97 -0
  655. package/src/client/types/planTypes/common.ts +31 -0
  656. package/src/client/types/planTypes/decreaseCarryPosition.ts +134 -0
  657. package/src/client/types/planTypes/index.ts +3 -0
  658. package/src/client/types/tx.ts +409 -0
  659. package/src/constants/configs/allocations.ts +30 -0
  660. package/src/constants/configs/carryTradePresets.ts +164 -0
  661. package/src/constants/configs/index.ts +2 -0
  662. package/src/constants/general.ts +141 -0
  663. package/src/constants/index.ts +3 -0
  664. package/src/constants/lycTokenMetadata.ts +52 -0
  665. package/src/decoders/decodeTransaction.ts +319 -0
  666. package/src/decoders/discriminators.ts +10 -0
  667. package/src/decoders/idlAccounts.ts +75 -0
  668. package/src/decoders/index.ts +15 -0
  669. package/src/decoders/innerCpis.ts +262 -0
  670. package/src/decoders/lycInstructionNames.ts +73 -0
  671. package/src/decoders/programIds.ts +12 -0
  672. package/src/decoders/solana.ts +25 -0
  673. package/src/decoders/transactionPayload.ts +41 -0
  674. package/src/decoders/types.ts +60 -0
  675. package/src/errors.ts +195 -0
  676. package/src/idl/long_yield_carry.ts +14648 -0
  677. package/src/index.ts +10 -0
  678. package/src/metrics/index.ts +1 -0
  679. package/src/metrics/protocolMetrics.ts +976 -0
  680. package/src/models/index.ts +9 -0
  681. package/src/models/lycToken.ts +380 -0
  682. package/src/models/yieldingBank.ts +127 -0
  683. package/src/services/allocation/allocationService.ts +823 -0
  684. package/src/services/allocation/index.ts +2 -0
  685. package/src/services/allocation/types.ts +27 -0
  686. package/src/services/carry/carryAllocationConfig.ts +266 -0
  687. package/src/services/carry/index.ts +2 -0
  688. package/src/services/carry/lycLendingPositionManager.ts +167 -0
  689. package/src/services/index.ts +5 -0
  690. package/src/services/lendingPosition/index.ts +5 -0
  691. package/src/services/lendingPosition/lendingPositionService.ts +328 -0
  692. package/src/services/rebalance/index.ts +2 -0
  693. package/src/services/rebalance/token/index.ts +1 -0
  694. package/src/services/rebalance/token/tokenRebalanceService.ts +142 -0
  695. package/src/services/rebalance/yieldingBank/index.ts +3 -0
  696. package/src/services/rebalance/yieldingBank/planner.ts +215 -0
  697. package/src/services/rebalance/yieldingBank/strategy.ts +41 -0
  698. package/src/services/rebalance/yieldingBank/types.ts +41 -0
  699. package/src/services/redemption/index.ts +9 -0
  700. package/src/services/redemption/redemptionService.ts +758 -0
  701. package/src/types/enriched.ts +187 -0
  702. package/src/types/index.ts +1 -0
  703. package/src/utils/cache.ts +12 -0
  704. package/src/utils/data.ts +65 -0
  705. package/src/utils/enrichment.ts +330 -0
  706. package/src/utils/feeDripMetrics.ts +146 -0
  707. package/src/utils/general.ts +54 -0
  708. package/src/utils/index.ts +13 -0
  709. package/src/utils/ix.ts +227 -0
  710. package/src/utils/lendingPosition.ts +221 -0
  711. package/src/utils/lookupTables.ts +309 -0
  712. package/src/utils/lycData.ts +321 -0
  713. package/src/utils/timelock.ts +63 -0
  714. package/src/utils/tokenFeeMath.ts +25 -0
  715. package/src/utils/transactions.ts +109 -0
  716. package/src/utils/yieldingBank.ts +38 -0
  717. package/tsconfig.json +11 -0
@@ -0,0 +1,103 @@
1
+ import { type ReserveBase } from "lending-platforms";
2
+ import type { Address } from "@solana/kit";
3
+ import { type VolatilityRegime } from "../../constants/configs/carryTradePresets";
4
+ /** Maximum value for `targetUtilizationRateBps` (100% in basis points). */
5
+ export declare const MAX_TARGET_UTILIZATION_RATE_BPS = 10000;
6
+ /**
7
+ * Maximum allowed value of `targetUtilizationRateBps + maxDeviationAboveTargetUtilBps`.
8
+ * Mirrors `MAX_LENDING_POSITION_UPPER_UTIL_BPS` in the on-chain program.
9
+ */
10
+ export declare const MAX_LENDING_POSITION_UPPER_UTIL_BPS = 10500;
11
+ /**
12
+ * Floor for `maxDeviationAboveTargetUtilBps` in preset-based computation.
13
+ *
14
+ * When the raw target is high enough that the unwind-trigger gap would be
15
+ * smaller than this, `computeCarryLendingAllocationConfig` pulls the target
16
+ * down so the above-deviation is at least this wide. This prevents
17
+ * near-zero unwind bands that would trigger constant rebalances.
18
+ */
19
+ export declare const MIN_DEVIATION_ABOVE_TARGET_UTIL_BPS = 200;
20
+ /**
21
+ * On-chain lending position tuning (see `LendingPositionConfig` in `long_yield_carry`).
22
+ */
23
+ export type CarryLendingAllocationConfig = {
24
+ targetUtilizationRateBps: number;
25
+ maxDeviationAboveTargetUtilBps: number;
26
+ maxDeviationBelowTargetUtilBps: number;
27
+ };
28
+ export type ComputeCarryLendingAllocationConfigParams = {
29
+ /**
30
+ * Collateral drawdown buffer between the **target** utilization and liquidation (positive percent,
31
+ * e.g. `25` for 25%). At target utilization, a collateral drop of this size reaches the liquidation
32
+ * line: `target = (1 − drawdownPctFromTargetToLiq/100) × liquidationThreshold / maxLtv`.
33
+ *
34
+ * Must be greater than `drawdownPctFromUnwindToLiq` (the target sits further from liquidation than
35
+ * the unwind trigger).
36
+ */
37
+ drawdownPctFromTargetToLiq: number;
38
+ /**
39
+ * Collateral drawdown buffer between the **unwind trigger** and liquidation (positive percent,
40
+ * e.g. `10` for 10%). At the unwind trigger (`target + maxDeviationAbove`), a collateral drop of
41
+ * this size reaches the liquidation line:
42
+ * `unwindTrigger = (1 − drawdownPctFromUnwindToLiq/100) × liquidationThreshold / maxLtv`.
43
+ *
44
+ * Must be less than `drawdownPctFromTargetToLiq`.
45
+ */
46
+ drawdownPctFromUnwindToLiq: number;
47
+ /**
48
+ * Max collateral **appreciation** (positive percent, e.g. `25` for +25%). If you start exactly at
49
+ * target utilization and collateral rallies this much (debt USD fixed), utilization reaches the
50
+ * **boost** trigger: `target − maxDeviationBelow`.
51
+ */
52
+ maxPriceChangeUpPercent: number;
53
+ /** Effective max LTV for the pair (decimal `0.8` = 80%), e.g. `ReservesManager.maxLtv`. */
54
+ maxLtv: number;
55
+ /** Collateral liquidation threshold (decimal `0.85` = 85%), from reserve config. */
56
+ liquidationThreshold: number;
57
+ };
58
+ /** The price-band params without pair-specific LTV / liquidation fields. */
59
+ export type CarryPriceBandPreset = Omit<ComputeCarryLendingAllocationConfigParams, "maxLtv" | "liquidationThreshold">;
60
+ /**
61
+ * Clamps a lending position config so it satisfies the on-chain constraints in
62
+ * `require_valid_lending_position_config_bps`:
63
+ *
64
+ * - `targetUtilizationRateBps` is clamped to `[1, MAX_TARGET_UTILIZATION_RATE_BPS]`
65
+ * - `maxDeviationAboveTargetUtilBps` is clamped so `target + above ≤ MAX_LENDING_POSITION_UPPER_UTIL_BPS`
66
+ *
67
+ * Throws only for inputs that indicate a bug (non-integer, negative deviation, target ≤ maxDevBelow).
68
+ */
69
+ export declare function clampLendingPositionConfigBps(config: CarryLendingAllocationConfig): CarryLendingAllocationConfig;
70
+ /**
71
+ * Builds `targetUtilizationRateBps` and deviation bands from drawdown-to-liquidation buffers.
72
+ *
73
+ * **Model:** debt USD fixed; only collateral USD moves. Both the target and the unwind trigger are
74
+ * defined by how much collateral drawdown separates them from the liquidation line
75
+ * (`liquidationThreshold / maxLtv`). The boost trigger (below target) is set by a rally percentage.
76
+ *
77
+ * `maxDeviationAbove = unwindTriggerBps − targetBps` (derived, not from a price-change input).
78
+ */
79
+ export declare function computeCarryLendingAllocationConfig(params: ComputeCarryLendingAllocationConfigParams): CarryLendingAllocationConfig;
80
+ export interface ComputeConfigForCollateralArgs {
81
+ /** Collateral mint address — used to look up the symbol from the mint registry. */
82
+ collateralMint: Address;
83
+ /** Collateral reserve — used to read `liquidationThresholdPct`. */
84
+ collateralReserve: ReserveBase;
85
+ /** Debt reserve — paired with collateral to determine `maxLtv` (including e-mode). */
86
+ debtReserve: ReserveBase;
87
+ /**
88
+ * Override the volatility regime. When omitted, uses the asset's
89
+ * `defaultRegime` from `ASSET_PRESETS`.
90
+ */
91
+ regime?: VolatilityRegime;
92
+ }
93
+ /**
94
+ * Resolves the carry trade price-band preset for a collateral mint and
95
+ * computes the lending position config (target utilization + deviation bands)
96
+ * using the reserve pair's `maxLtv` and `liquidationThreshold`.
97
+ *
98
+ * Uses {@link ReservesManager} to derive `maxLtv` (including e-mode overrides)
99
+ * and normalizes `liquidationThresholdPct` to a decimal.
100
+ *
101
+ * Throws if the collateral mint symbol is not in `ASSET_PRESETS`.
102
+ */
103
+ export declare function computeConfigForCollateral(args: ComputeConfigForCollateralArgs): CarryLendingAllocationConfig;
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MIN_DEVIATION_ABOVE_TARGET_UTIL_BPS = exports.MAX_LENDING_POSITION_UPPER_UTIL_BPS = exports.MAX_TARGET_UTILIZATION_RATE_BPS = void 0;
4
+ exports.clampLendingPositionConfigBps = clampLendingPositionConfigBps;
5
+ exports.computeCarryLendingAllocationConfig = computeCarryLendingAllocationConfig;
6
+ exports.computeConfigForCollateral = computeConfigForCollateral;
7
+ const lending_platforms_1 = require("lending-platforms");
8
+ const common_1 = require("common");
9
+ const carryTradePresets_1 = require("../../constants/configs/carryTradePresets");
10
+ /** Maximum value for `targetUtilizationRateBps` (100% in basis points). */
11
+ exports.MAX_TARGET_UTILIZATION_RATE_BPS = 10000;
12
+ /**
13
+ * Maximum allowed value of `targetUtilizationRateBps + maxDeviationAboveTargetUtilBps`.
14
+ * Mirrors `MAX_LENDING_POSITION_UPPER_UTIL_BPS` in the on-chain program.
15
+ */
16
+ exports.MAX_LENDING_POSITION_UPPER_UTIL_BPS = 10500;
17
+ /**
18
+ * Floor for `maxDeviationAboveTargetUtilBps` in preset-based computation.
19
+ *
20
+ * When the raw target is high enough that the unwind-trigger gap would be
21
+ * smaller than this, `computeCarryLendingAllocationConfig` pulls the target
22
+ * down so the above-deviation is at least this wide. This prevents
23
+ * near-zero unwind bands that would trigger constant rebalances.
24
+ */
25
+ exports.MIN_DEVIATION_ABOVE_TARGET_UTIL_BPS = 200;
26
+ /**
27
+ * Clamps a lending position config so it satisfies the on-chain constraints in
28
+ * `require_valid_lending_position_config_bps`:
29
+ *
30
+ * - `targetUtilizationRateBps` is clamped to `[1, MAX_TARGET_UTILIZATION_RATE_BPS]`
31
+ * - `maxDeviationAboveTargetUtilBps` is clamped so `target + above ≤ MAX_LENDING_POSITION_UPPER_UTIL_BPS`
32
+ *
33
+ * Throws only for inputs that indicate a bug (non-integer, negative deviation, target ≤ maxDevBelow).
34
+ */
35
+ function clampLendingPositionConfigBps(config) {
36
+ let { targetUtilizationRateBps, maxDeviationAboveTargetUtilBps, maxDeviationBelowTargetUtilBps } = config;
37
+ if (!Number.isInteger(targetUtilizationRateBps) || targetUtilizationRateBps <= 0) {
38
+ throw new Error("targetUtilizationRateBps must be a positive integer");
39
+ }
40
+ for (const [name, v] of [
41
+ ["maxDeviationAboveTargetUtilBps", maxDeviationAboveTargetUtilBps],
42
+ ["maxDeviationBelowTargetUtilBps", maxDeviationBelowTargetUtilBps],
43
+ ]) {
44
+ if (!Number.isInteger(v) || v < 0) {
45
+ throw new Error(`${name} must be a non-negative integer`);
46
+ }
47
+ }
48
+ targetUtilizationRateBps = Math.min(targetUtilizationRateBps, exports.MAX_TARGET_UTILIZATION_RATE_BPS);
49
+ maxDeviationAboveTargetUtilBps = Math.min(maxDeviationAboveTargetUtilBps, exports.MAX_LENDING_POSITION_UPPER_UTIL_BPS - targetUtilizationRateBps);
50
+ if (targetUtilizationRateBps <= maxDeviationBelowTargetUtilBps) {
51
+ throw new Error("targetUtilizationRateBps must be greater than maxDeviationBelowTargetUtilBps");
52
+ }
53
+ return {
54
+ targetUtilizationRateBps,
55
+ maxDeviationAboveTargetUtilBps,
56
+ maxDeviationBelowTargetUtilBps,
57
+ };
58
+ }
59
+ /**
60
+ * Builds `targetUtilizationRateBps` and deviation bands from drawdown-to-liquidation buffers.
61
+ *
62
+ * **Model:** debt USD fixed; only collateral USD moves. Both the target and the unwind trigger are
63
+ * defined by how much collateral drawdown separates them from the liquidation line
64
+ * (`liquidationThreshold / maxLtv`). The boost trigger (below target) is set by a rally percentage.
65
+ *
66
+ * `maxDeviationAbove = unwindTriggerBps − targetBps` (derived, not from a price-change input).
67
+ */
68
+ function computeCarryLendingAllocationConfig(params) {
69
+ const { drawdownPctFromTargetToLiq, drawdownPctFromUnwindToLiq, maxPriceChangeUpPercent, maxLtv, liquidationThreshold, } = params;
70
+ if (!Number.isFinite(drawdownPctFromTargetToLiq) ||
71
+ drawdownPctFromTargetToLiq <= 0 ||
72
+ drawdownPctFromTargetToLiq >= 100) {
73
+ throw new RangeError("drawdownPctFromTargetToLiq must be in (0, 100)");
74
+ }
75
+ if (!Number.isFinite(drawdownPctFromUnwindToLiq) ||
76
+ drawdownPctFromUnwindToLiq < 0 ||
77
+ drawdownPctFromUnwindToLiq >= 100) {
78
+ throw new RangeError("drawdownPctFromUnwindToLiq must be in [0, 100)");
79
+ }
80
+ if (drawdownPctFromUnwindToLiq >= drawdownPctFromTargetToLiq) {
81
+ throw new RangeError("drawdownPctFromUnwindToLiq must be less than drawdownPctFromTargetToLiq (unwind trigger is closer to liquidation than target)");
82
+ }
83
+ if (!Number.isFinite(maxPriceChangeUpPercent) || maxPriceChangeUpPercent <= 0) {
84
+ throw new RangeError("maxPriceChangeUpPercent must be finite and positive");
85
+ }
86
+ const targetDecimal = (0, lending_platforms_1.maxLtvUtilBeforeCollDrawdown)({
87
+ drawdownPercent: drawdownPctFromTargetToLiq,
88
+ ltv: maxLtv,
89
+ liquidationThreshold,
90
+ });
91
+ let targetUtilizationRateBps = Math.min(Math.floor(targetDecimal * 10000), exports.MAX_TARGET_UTILIZATION_RATE_BPS);
92
+ if (targetUtilizationRateBps <= 0) {
93
+ throw new RangeError("Computed target utilization rounds to zero; reduce drawdownPctFromTargetToLiq or check maxLtv / liquidationThreshold");
94
+ }
95
+ const unwindTriggerDecimal = (0, lending_platforms_1.maxLtvUtilBeforeCollDrawdown)({
96
+ drawdownPercent: drawdownPctFromUnwindToLiq,
97
+ ltv: maxLtv,
98
+ liquidationThreshold,
99
+ });
100
+ const unwindTriggerBps = Math.floor(unwindTriggerDecimal * 10000);
101
+ let maxDeviationAboveTargetUtilBps = Math.min(unwindTriggerBps - targetUtilizationRateBps, exports.MAX_LENDING_POSITION_UPPER_UTIL_BPS - targetUtilizationRateBps);
102
+ // If the above-deviation is below the minimum (e.g. because the target was
103
+ // clamped to MAX_TARGET_UTILIZATION_RATE_BPS), pull the target down so the
104
+ // unwind band is at least MIN_DEVIATION_ABOVE_TARGET_UTIL_BPS wide.
105
+ if (maxDeviationAboveTargetUtilBps < exports.MIN_DEVIATION_ABOVE_TARGET_UTIL_BPS) {
106
+ maxDeviationAboveTargetUtilBps = exports.MIN_DEVIATION_ABOVE_TARGET_UTIL_BPS;
107
+ targetUtilizationRateBps = Math.min(targetUtilizationRateBps, exports.MAX_LENDING_POSITION_UPPER_UTIL_BPS - exports.MIN_DEVIATION_ABOVE_TARGET_UTIL_BPS);
108
+ }
109
+ const t = targetUtilizationRateBps / 10000;
110
+ const maxBelowDecimal = (0, lending_platforms_1.ltvUtilDeltaBelowTargForRallyPct)(t, maxPriceChangeUpPercent);
111
+ const maxDeviationBelowTargetUtilBps = Math.floor(maxBelowDecimal * 10000);
112
+ return clampLendingPositionConfigBps({
113
+ targetUtilizationRateBps,
114
+ maxDeviationAboveTargetUtilBps,
115
+ maxDeviationBelowTargetUtilBps,
116
+ });
117
+ }
118
+ /**
119
+ * Resolves the carry trade price-band preset for a collateral mint and
120
+ * computes the lending position config (target utilization + deviation bands)
121
+ * using the reserve pair's `maxLtv` and `liquidationThreshold`.
122
+ *
123
+ * Uses {@link ReservesManager} to derive `maxLtv` (including e-mode overrides)
124
+ * and normalizes `liquidationThresholdPct` to a decimal.
125
+ *
126
+ * Throws if the collateral mint symbol is not in `ASSET_PRESETS`.
127
+ */
128
+ function computeConfigForCollateral(args) {
129
+ const { collateralMint, collateralReserve, debtReserve } = args;
130
+ const mintInfo = common_1.mints.get(collateralMint);
131
+ const symbol = mintInfo?.symbol ?? String(collateralMint);
132
+ const entry = (0, carryTradePresets_1.resolvePresets)(symbol);
133
+ if (!entry) {
134
+ throw new Error(`computeConfigForCollateral: no carry preset found for collateral "${symbol}" (${collateralMint})`);
135
+ }
136
+ const regime = args.regime ?? entry.defaultRegime;
137
+ const preset = entry.presets[regime];
138
+ const rm = new lending_platforms_1.ReservesManager(collateralReserve, debtReserve);
139
+ const pct = collateralReserve.config.liquidationThresholdPct;
140
+ const liquidationThreshold = pct <= 1 ? pct : pct / 100;
141
+ return computeCarryLendingAllocationConfig({
142
+ ...preset,
143
+ maxLtv: rm.maxLtv,
144
+ liquidationThreshold,
145
+ });
146
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./carryAllocationConfig";
2
+ export * from "./lycLendingPositionManager";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./carryAllocationConfig"), exports);
18
+ __exportStar(require("./lycLendingPositionManager"), exports);
@@ -0,0 +1,39 @@
1
+ import { type Environment } from "common";
2
+ import { LendingPlatformData, LendingPositionManager, ReserveBase, type CollateralPriceTriggerBand, type LendingPositionInspectMetrics } from "lending-platforms";
3
+ import { TokenLendingPositionData } from "../../models/lycToken";
4
+ import { type CarryLendingAllocationConfig, type CarryPriceBandPreset } from "./carryAllocationConfig";
5
+ /**
6
+ * LYC-flavoured {@link LendingPositionManager}: adds carry-specific sizing
7
+ * signals ({@link shouldIncreaseCarryPosition}, {@link shouldDecreaseCarryPosition})
8
+ * and defaults utilization targets from the on-chain `LendingPositionConfig`.
9
+ */
10
+ export declare class LycLendingPositionManager extends LendingPositionManager {
11
+ readonly lendingPosition: TokenLendingPositionData;
12
+ constructor(lpData: LendingPlatformData, lendingPosition: TokenLendingPositionData, collateralReserve: ReserveBase, debtReserve: ReserveBase, environment?: Environment);
13
+ static create(lpData: LendingPlatformData, lendingPosition: TokenLendingPositionData, environment?: Environment): Promise<LycLendingPositionManager>;
14
+ /**
15
+ * Derives `targetUtilizationRateBps` and carry trigger deviations from drawdown-to-liquidation
16
+ * buffers and a rally percentage, using this pair's {@link ReservesManager.maxLtv} and the
17
+ * collateral reserve's **base** `liquidationThresholdPct` (normalized to a decimal).
18
+ *
19
+ * For custom `maxLtv` / `liquidationThreshold` (e.g. e-mode liquidation threshold), call
20
+ * {@link computeCarryLendingAllocationConfig} directly.
21
+ */
22
+ getLendingAllocationConfigFromPriceBands(params: CarryPriceBandPreset): CarryLendingAllocationConfig;
23
+ /**
24
+ * Returns true when the current LTV utilization (valued at EMA prices) has
25
+ * fallen far enough below the target that the position should be boosted.
26
+ */
27
+ shouldIncreaseCarryPosition(): Promise<boolean>;
28
+ /**
29
+ * Returns true when the current LTV utilization (valued at realtime prices) has
30
+ * risen far enough above the target that the position should be unwound.
31
+ */
32
+ shouldDecreaseCarryPosition(): Promise<boolean>;
33
+ calcDebtChangeAmount(targetUtilizationRateBps?: number): Promise<number>;
34
+ calcPreWithdrawalTargetUtilizationRateBps(withdrawUiCollateralAmount: number, postWithdrawalTargetUtilizationRateBps?: number): Promise<number>;
35
+ calcDebtChangeAmountForCollateralWithdrawal(withdrawUiCollateralAmount: number, postWithdrawalTargetUtilizationRateBps?: number): Promise<number>;
36
+ getCollateralPriceTriggerBand(): Promise<CollateralPriceTriggerBand>;
37
+ getInspectMetrics(): Promise<LendingPositionInspectMetrics | null>;
38
+ private configTriggerBandBps;
39
+ }
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LycLendingPositionManager = void 0;
4
+ const common_1 = require("common");
5
+ const lending_platforms_1 = require("lending-platforms");
6
+ const carryAllocationConfig_1 = require("./carryAllocationConfig");
7
+ /**
8
+ * LYC-flavoured {@link LendingPositionManager}: adds carry-specific sizing
9
+ * signals ({@link shouldIncreaseCarryPosition}, {@link shouldDecreaseCarryPosition})
10
+ * and defaults utilization targets from the on-chain `LendingPositionConfig`.
11
+ */
12
+ class LycLendingPositionManager extends lending_platforms_1.LendingPositionManager {
13
+ constructor(lpData, lendingPosition, collateralReserve, debtReserve, environment) {
14
+ super(lpData, (0, common_1.fromWeb3Pk)(lendingPosition.pool), (0, common_1.fromWeb3Pk)(lendingPosition.protocolUserAcc), collateralReserve, debtReserve, environment);
15
+ this.lendingPosition = lendingPosition;
16
+ }
17
+ static async create(lpData, lendingPosition, environment) {
18
+ const pool = (0, common_1.fromWeb3Pk)(lendingPosition.pool);
19
+ const [collateralReserve, debtReserve] = await Promise.all([
20
+ lpData.fetchReserve(pool, (0, common_1.fromWeb3Pk)(lendingPosition.collateralReserve)),
21
+ lpData.fetchReserve(pool, (0, common_1.fromWeb3Pk)(lendingPosition.debtReserve)),
22
+ ]);
23
+ if (!collateralReserve || !debtReserve) {
24
+ throw new Error("Failed to fetch reserves");
25
+ }
26
+ return new LycLendingPositionManager(lpData, lendingPosition, collateralReserve, debtReserve, environment);
27
+ }
28
+ /**
29
+ * Derives `targetUtilizationRateBps` and carry trigger deviations from drawdown-to-liquidation
30
+ * buffers and a rally percentage, using this pair's {@link ReservesManager.maxLtv} and the
31
+ * collateral reserve's **base** `liquidationThresholdPct` (normalized to a decimal).
32
+ *
33
+ * For custom `maxLtv` / `liquidationThreshold` (e.g. e-mode liquidation threshold), call
34
+ * {@link computeCarryLendingAllocationConfig} directly.
35
+ */
36
+ getLendingAllocationConfigFromPriceBands(params) {
37
+ const pct = this.reservesManager.supplyReserve.config.liquidationThresholdPct;
38
+ const liquidationThreshold = pct <= 1 ? pct : pct / 100;
39
+ return (0, carryAllocationConfig_1.computeCarryLendingAllocationConfig)({
40
+ ...params,
41
+ maxLtv: this.reservesManager.maxLtv,
42
+ liquidationThreshold,
43
+ });
44
+ }
45
+ /**
46
+ * Returns true when the current LTV utilization (valued at EMA prices) has
47
+ * fallen far enough below the target that the position should be boosted.
48
+ */
49
+ async shouldIncreaseCarryPosition() {
50
+ const state = await this.getPositionState("ema");
51
+ if (!state)
52
+ return false;
53
+ const { supplyUsd, debtUsd } = state;
54
+ if (supplyUsd <= 0)
55
+ return false;
56
+ const currentUtilBps = this.reservesManager.calcLtvUtilizationRateBps(supplyUsd, debtUsd);
57
+ return (currentUtilBps <=
58
+ this.lendingPosition.config.targetUtilizationRateBps -
59
+ this.lendingPosition.config.maxDeviationBelowTargetUtilBps);
60
+ }
61
+ /**
62
+ * Returns true when the current LTV utilization (valued at realtime prices) has
63
+ * risen far enough above the target that the position should be unwound.
64
+ */
65
+ async shouldDecreaseCarryPosition() {
66
+ const state = await this.getPositionState("realtime");
67
+ if (!state)
68
+ return false;
69
+ const { supplyUsd, debtUsd } = state;
70
+ const currentUtilBps = this.reservesManager.calcLtvUtilizationRateBps(supplyUsd, debtUsd);
71
+ return (currentUtilBps >=
72
+ this.lendingPosition.config.targetUtilizationRateBps +
73
+ this.lendingPosition.config.maxDeviationAboveTargetUtilBps);
74
+ }
75
+ async calcDebtChangeAmount(targetUtilizationRateBps = this.lendingPosition.config.targetUtilizationRateBps) {
76
+ return super.calcDebtChangeAmount(targetUtilizationRateBps);
77
+ }
78
+ async calcPreWithdrawalTargetUtilizationRateBps(withdrawUiCollateralAmount, postWithdrawalTargetUtilizationRateBps = this.lendingPosition.config
79
+ .targetUtilizationRateBps) {
80
+ return super.calcPreWithdrawalTargetUtilizationRateBps(withdrawUiCollateralAmount, postWithdrawalTargetUtilizationRateBps);
81
+ }
82
+ async calcDebtChangeAmountForCollateralWithdrawal(withdrawUiCollateralAmount, postWithdrawalTargetUtilizationRateBps = this.lendingPosition.config
83
+ .targetUtilizationRateBps) {
84
+ return super.calcDebtChangeAmountForCollateralWithdrawal(withdrawUiCollateralAmount, postWithdrawalTargetUtilizationRateBps);
85
+ }
86
+ async getCollateralPriceTriggerBand() {
87
+ return super.getCollateralPriceTriggerBand(this.configTriggerBandBps());
88
+ }
89
+ async getInspectMetrics() {
90
+ return super.getInspectMetrics(this.configTriggerBandBps());
91
+ }
92
+ configTriggerBandBps() {
93
+ const { targetUtilizationRateBps, maxDeviationBelowTargetUtilBps, maxDeviationAboveTargetUtilBps, } = this.lendingPosition.config;
94
+ return {
95
+ lowerTargetUtilizationRateBps: targetUtilizationRateBps - maxDeviationBelowTargetUtilBps,
96
+ upperTargetUtilizationRateBps: targetUtilizationRateBps + maxDeviationAboveTargetUtilBps,
97
+ };
98
+ }
99
+ }
100
+ exports.LycLendingPositionManager = LycLendingPositionManager;
@@ -0,0 +1,5 @@
1
+ export * from "./allocation";
2
+ export * from "./carry";
3
+ export * from "./lendingPosition";
4
+ export * from "./rebalance";
5
+ export * from "./redemption";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./allocation"), exports);
18
+ __exportStar(require("./carry"), exports);
19
+ __exportStar(require("./lendingPosition"), exports);
20
+ __exportStar(require("./rebalance"), exports);
21
+ __exportStar(require("./redemption"), exports);
@@ -0,0 +1,2 @@
1
+ export { LendingPositionService } from "./lendingPositionService";
2
+ export type { EnsureInitialKaminoLendingPositionOptions, OptimalLendingPosition, } from "./lendingPositionService";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LendingPositionService = void 0;
4
+ var lendingPositionService_1 = require("./lendingPositionService");
5
+ Object.defineProperty(exports, "LendingPositionService", { enumerable: true, get: function () { return lendingPositionService_1.LendingPositionService; } });
@@ -0,0 +1,88 @@
1
+ import { type Address, type TransactionSigner } from "@solana/kit";
2
+ import type { LongYieldCarryClient } from "../../client/client";
3
+ import type { LongYieldCarryTransactionPlan } from "../../client/types";
4
+ import type { IndexedLendingPosition, LYCToken } from "../../models/lycToken";
5
+ export interface OptimalLendingPosition {
6
+ /** The lending position selected. */
7
+ lp: IndexedLendingPosition;
8
+ /** Debt mint of the selected position. */
9
+ debtMint: Address;
10
+ /** Human-readable symbol of the debt mint. */
11
+ debtSymbol: string;
12
+ /** Whether this position uses the optimal debt mint (true) or is the best available fallback. */
13
+ isOptimal: boolean;
14
+ }
15
+ type LogFn = (msg: string) => void;
16
+ export interface EnsureInitialKaminoLendingPositionOptions {
17
+ manager: TransactionSigner;
18
+ /** When set, refreshes the per-token LUT after the new LP is created. */
19
+ lutManager?: TransactionSigner;
20
+ token: LYCToken;
21
+ sendPlan: (plan: LongYieldCarryTransactionPlan, label: string) => Promise<void>;
22
+ log?: LogFn;
23
+ }
24
+ /**
25
+ * Shared logic for choosing and interacting with a token's lending positions
26
+ * based on allocation optimality. Used by {@link RedemptionService} (to
27
+ * prioritize which positions to unwind) and by deposit scripts / backend
28
+ * services (to deposit into the best position).
29
+ */
30
+ export declare class LendingPositionService {
31
+ private readonly client;
32
+ constructor(client: LongYieldCarryClient);
33
+ /**
34
+ * Returns the lending position whose debt mint matches the current optimal
35
+ * allocation. If no position matches the optimal mint, returns the position
36
+ * with the most collateral as a fallback.
37
+ *
38
+ * Returns `null` only when the token has no active lending positions.
39
+ */
40
+ findOptimalLendingPosition(token: LYCToken, log?: LogFn): Promise<OptimalLendingPosition | null>;
41
+ /**
42
+ * Sorts lending positions so non-optimal debt mints come first. Useful for
43
+ * choosing which positions to unwind during redemptions — non-optimal
44
+ * positions are unwound first to preserve the best-yielding ones.
45
+ *
46
+ * Returns the original order if there's only one LP or the optimal mint
47
+ * lookup fails.
48
+ */
49
+ sortByOptimality(token: LYCToken, lps: IndexedLendingPosition[], log?: LogFn): Promise<IndexedLendingPosition[]>;
50
+ /**
51
+ * Opens the first Kamino lending position on a token that has none yet.
52
+ *
53
+ * Mirrors `scripts/createTokenLendingPosition.ts` and the create-LP branch in
54
+ * `TokenRebalanceWorker`: resolve pool + optimal debt mint, compute carry
55
+ * allocation config, send `createTokenLendingPosition`, then refetch the token.
56
+ *
57
+ * Kamino-specific: the flow resolves the default Kamino pool, fetches Kamino
58
+ * reserves, and uses {@link AllocationService} over Kamino reserve data. It is
59
+ * named accordingly until a second lending platform actually needs bootstrap
60
+ * support (avoid speculative platform abstraction with a single implementation).
61
+ *
62
+ * No-op when the token already has at least one active lending position slot.
63
+ *
64
+ * @throws {LendingPositionBootstrapError} when the token cannot be bootstrapped
65
+ * because of a permanent configuration gap (collateral mint not in any pool,
66
+ * no preset, no viable debt mint / reserve). Callers should treat this as a
67
+ * skip rather than a retryable failure.
68
+ */
69
+ ensureInitialKaminoLendingPosition(options: EnsureInitialKaminoLendingPositionOptions): Promise<LYCToken>;
70
+ /**
71
+ * Deposits unlent collateral into the optimal lending position. Refreshes
72
+ * the token state first, then deposits all unlent collateral into the
73
+ * position returned by {@link findOptimalLendingPosition}.
74
+ */
75
+ depositToOptimalPosition(signer: TransactionSigner, token: LYCToken, log?: LogFn): Promise<{
76
+ signature: string;
77
+ lendingPositionIndex: number;
78
+ debtSymbol: string;
79
+ }>;
80
+ /**
81
+ * Queries `AllocationService.findOptimalDebtMint` for the token's
82
+ * pool + collateral pair. Returns null on any failure (missing reserve, etc.).
83
+ */
84
+ private findOptimalDebtMint;
85
+ private largestLp;
86
+ private toLpResult;
87
+ }
88
+ export {};