@kestrelfi/lyc-sdk 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (738) hide show
  1. package/README.md +32 -0
  2. package/dist/carry-XU3WUD22.mjs +20 -0
  3. package/dist/carry-XU3WUD22.mjs.map +1 -0
  4. package/dist/chunk-2T23QQCX.mjs +3707 -0
  5. package/dist/chunk-2T23QQCX.mjs.map +1 -0
  6. package/dist/chunk-GOW6CARW.mjs +3969 -0
  7. package/dist/chunk-GOW6CARW.mjs.map +1 -0
  8. package/dist/chunk-ZPXXY3QV.mjs +9330 -0
  9. package/dist/chunk-ZPXXY3QV.mjs.map +1 -0
  10. package/dist/{sdks/long-yield-carry/src/idl/long_yield_carry.d.ts → core-DP6wfpME.d.mts} +3242 -84
  11. package/dist/core-DP6wfpME.d.ts +10485 -0
  12. package/dist/core.d.mts +8 -0
  13. package/dist/core.d.ts +8 -0
  14. package/dist/core.js +12348 -0
  15. package/dist/core.js.map +1 -0
  16. package/dist/core.mjs +72 -0
  17. package/dist/core.mjs.map +1 -0
  18. package/dist/index.d.mts +2537 -0
  19. package/dist/index.d.ts +2537 -0
  20. package/dist/index.js +23884 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/index.mjs +5898 -0
  23. package/dist/index.mjs.map +1 -0
  24. package/package.json +56 -10
  25. package/.env.example +0 -11
  26. package/dist/sdks/long-yield-carry/scripts/asyncBurn.d.ts +0 -1
  27. package/dist/sdks/long-yield-carry/scripts/asyncBurn.js +0 -117
  28. package/dist/sdks/long-yield-carry/scripts/burnToken.d.ts +0 -1
  29. package/dist/sdks/long-yield-carry/scripts/burnToken.js +0 -98
  30. package/dist/sdks/long-yield-carry/scripts/claimIncentives.d.ts +0 -1
  31. package/dist/sdks/long-yield-carry/scripts/claimIncentives.js +0 -108
  32. package/dist/sdks/long-yield-carry/scripts/closeCpiPlans.d.ts +0 -1
  33. package/dist/sdks/long-yield-carry/scripts/closeCpiPlans.js +0 -93
  34. package/dist/sdks/long-yield-carry/scripts/collectInterest.d.ts +0 -1
  35. package/dist/sdks/long-yield-carry/scripts/collectInterest.js +0 -164
  36. package/dist/sdks/long-yield-carry/scripts/collectProtocolFees.d.ts +0 -1
  37. package/dist/sdks/long-yield-carry/scripts/collectProtocolFees.js +0 -120
  38. package/dist/sdks/long-yield-carry/scripts/computeOptimalAllocations.d.ts +0 -1
  39. package/dist/sdks/long-yield-carry/scripts/computeOptimalAllocations.js +0 -84
  40. package/dist/sdks/long-yield-carry/scripts/createToken.d.ts +0 -1
  41. package/dist/sdks/long-yield-carry/scripts/createToken.js +0 -76
  42. package/dist/sdks/long-yield-carry/scripts/createTokenLendingPosition.d.ts +0 -1
  43. package/dist/sdks/long-yield-carry/scripts/createTokenLendingPosition.js +0 -157
  44. package/dist/sdks/long-yield-carry/scripts/createYieldingBank.d.ts +0 -1
  45. package/dist/sdks/long-yield-carry/scripts/createYieldingBank.js +0 -69
  46. package/dist/sdks/long-yield-carry/scripts/decreaseCarryPositions.d.ts +0 -1
  47. package/dist/sdks/long-yield-carry/scripts/decreaseCarryPositions.js +0 -247
  48. package/dist/sdks/long-yield-carry/scripts/depositUnlentCollateral.d.ts +0 -1
  49. package/dist/sdks/long-yield-carry/scripts/depositUnlentCollateral.js +0 -90
  50. package/dist/sdks/long-yield-carry/scripts/emergency/deleverageAll.d.ts +0 -1
  51. package/dist/sdks/long-yield-carry/scripts/emergency/deleverageAll.js +0 -202
  52. package/dist/sdks/long-yield-carry/scripts/emergency/triggerCircuitBreaker.d.ts +0 -1
  53. package/dist/sdks/long-yield-carry/scripts/emergency/triggerCircuitBreaker.js +0 -68
  54. package/dist/sdks/long-yield-carry/scripts/env.d.ts +0 -1
  55. package/dist/sdks/long-yield-carry/scripts/env.js +0 -8
  56. package/dist/sdks/long-yield-carry/scripts/findTxs.d.ts +0 -1
  57. package/dist/sdks/long-yield-carry/scripts/findTxs.js +0 -143
  58. package/dist/sdks/long-yield-carry/scripts/increaseCarryPositions.d.ts +0 -1
  59. package/dist/sdks/long-yield-carry/scripts/increaseCarryPositions.js +0 -112
  60. package/dist/sdks/long-yield-carry/scripts/inspect/format.d.ts +0 -13
  61. package/dist/sdks/long-yield-carry/scripts/inspect/format.js +0 -363
  62. package/dist/sdks/long-yield-carry/scripts/inspect.d.ts +0 -1
  63. package/dist/sdks/long-yield-carry/scripts/inspect.js +0 -108
  64. package/dist/sdks/long-yield-carry/scripts/localUtils.d.ts +0 -53
  65. package/dist/sdks/long-yield-carry/scripts/localUtils.js +0 -191
  66. package/dist/sdks/long-yield-carry/scripts/mintToken.d.ts +0 -1
  67. package/dist/sdks/long-yield-carry/scripts/mintToken.js +0 -103
  68. package/dist/sdks/long-yield-carry/scripts/processAsyncBurns.d.ts +0 -1
  69. package/dist/sdks/long-yield-carry/scripts/processAsyncBurns.js +0 -76
  70. package/dist/sdks/long-yield-carry/scripts/rebalanceToken.d.ts +0 -1
  71. package/dist/sdks/long-yield-carry/scripts/rebalanceToken.js +0 -210
  72. package/dist/sdks/long-yield-carry/scripts/rebalanceYieldingBank.d.ts +0 -1
  73. package/dist/sdks/long-yield-carry/scripts/rebalanceYieldingBank.js +0 -149
  74. package/dist/sdks/long-yield-carry/scripts/recollateralizeLoss.d.ts +0 -1
  75. package/dist/sdks/long-yield-carry/scripts/recollateralizeLoss.js +0 -64
  76. package/dist/sdks/long-yield-carry/scripts/refresh.d.ts +0 -1
  77. package/dist/sdks/long-yield-carry/scripts/refresh.js +0 -101
  78. package/dist/sdks/long-yield-carry/scripts/updateFees.d.ts +0 -1
  79. package/dist/sdks/long-yield-carry/scripts/updateFees.js +0 -369
  80. package/dist/sdks/long-yield-carry/scripts/updateGeneralLut.d.ts +0 -1
  81. package/dist/sdks/long-yield-carry/scripts/updateGeneralLut.js +0 -27
  82. package/dist/sdks/long-yield-carry/scripts/updateLendingPositionConfig.d.ts +0 -1
  83. package/dist/sdks/long-yield-carry/scripts/updateLendingPositionConfig.js +0 -127
  84. package/dist/sdks/long-yield-carry/scripts/updateTokenLuts.d.ts +0 -1
  85. package/dist/sdks/long-yield-carry/scripts/updateTokenLuts.js +0 -27
  86. package/dist/sdks/long-yield-carry/scripts/updateTokenMetadata.d.ts +0 -1
  87. package/dist/sdks/long-yield-carry/scripts/updateTokenMetadata.js +0 -194
  88. package/dist/sdks/long-yield-carry/scripts/updateYieldingBankConfig.d.ts +0 -1
  89. package/dist/sdks/long-yield-carry/scripts/updateYieldingBankConfig.js +0 -84
  90. package/dist/sdks/long-yield-carry/scripts/withdrawUnlentCollateral.d.ts +0 -1
  91. package/dist/sdks/long-yield-carry/scripts/withdrawUnlentCollateral.js +0 -140
  92. package/dist/sdks/long-yield-carry/src/client/account.d.ts +0 -152
  93. package/dist/sdks/long-yield-carry/src/client/account.js +0 -349
  94. package/dist/sdks/long-yield-carry/src/client/builders/args.d.ts +0 -299
  95. package/dist/sdks/long-yield-carry/src/client/builders/args.js +0 -2
  96. package/dist/sdks/long-yield-carry/src/client/builders/asyncBurnBuilder.d.ts +0 -20
  97. package/dist/sdks/long-yield-carry/src/client/builders/asyncBurnBuilder.js +0 -212
  98. package/dist/sdks/long-yield-carry/src/client/builders/base.d.ts +0 -77
  99. package/dist/sdks/long-yield-carry/src/client/builders/base.js +0 -191
  100. package/dist/sdks/long-yield-carry/src/client/builders/burnTokenBuilder.d.ts +0 -18
  101. package/dist/sdks/long-yield-carry/src/client/builders/burnTokenBuilder.js +0 -165
  102. package/dist/sdks/long-yield-carry/src/client/builders/claimIncentivesBuilder.d.ts +0 -9
  103. package/dist/sdks/long-yield-carry/src/client/builders/claimIncentivesBuilder.js +0 -135
  104. package/dist/sdks/long-yield-carry/src/client/builders/collectFeesBuilder.d.ts +0 -14
  105. package/dist/sdks/long-yield-carry/src/client/builders/collectFeesBuilder.js +0 -50
  106. package/dist/sdks/long-yield-carry/src/client/builders/collectInterestBuilder.d.ts +0 -8
  107. package/dist/sdks/long-yield-carry/src/client/builders/collectInterestBuilder.js +0 -86
  108. package/dist/sdks/long-yield-carry/src/client/builders/createCpiPlanBuilder.d.ts +0 -6
  109. package/dist/sdks/long-yield-carry/src/client/builders/createCpiPlanBuilder.js +0 -22
  110. package/dist/sdks/long-yield-carry/src/client/builders/createTokenBuilder.d.ts +0 -7
  111. package/dist/sdks/long-yield-carry/src/client/builders/createTokenBuilder.js +0 -64
  112. package/dist/sdks/long-yield-carry/src/client/builders/createTokenLendingPositionBuilder.d.ts +0 -10
  113. package/dist/sdks/long-yield-carry/src/client/builders/createTokenLendingPositionBuilder.js +0 -138
  114. package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankAllocationBuilder.d.ts +0 -7
  115. package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankAllocationBuilder.js +0 -29
  116. package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankBuilder.d.ts +0 -7
  117. package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankBuilder.js +0 -39
  118. package/dist/sdks/long-yield-carry/src/client/builders/decreaseCarryPositionBuilder.d.ts +0 -30
  119. package/dist/sdks/long-yield-carry/src/client/builders/decreaseCarryPositionBuilder.js +0 -99
  120. package/dist/sdks/long-yield-carry/src/client/builders/depositUnlentCollateralBuilder.d.ts +0 -8
  121. package/dist/sdks/long-yield-carry/src/client/builders/depositUnlentCollateralBuilder.js +0 -64
  122. package/dist/sdks/long-yield-carry/src/client/builders/increaseCarryPositionBuilder.d.ts +0 -8
  123. package/dist/sdks/long-yield-carry/src/client/builders/increaseCarryPositionBuilder.js +0 -73
  124. package/dist/sdks/long-yield-carry/src/client/builders/index.d.ts +0 -28
  125. package/dist/sdks/long-yield-carry/src/client/builders/index.js +0 -62
  126. package/dist/sdks/long-yield-carry/src/client/builders/mintTokenBuilder.d.ts +0 -8
  127. package/dist/sdks/long-yield-carry/src/client/builders/mintTokenBuilder.js +0 -95
  128. package/dist/sdks/long-yield-carry/src/client/builders/rebalanceTokenBuilder.d.ts +0 -11
  129. package/dist/sdks/long-yield-carry/src/client/builders/rebalanceTokenBuilder.js +0 -255
  130. package/dist/sdks/long-yield-carry/src/client/builders/rebalanceYieldingBankBuilder.d.ts +0 -8
  131. package/dist/sdks/long-yield-carry/src/client/builders/rebalanceYieldingBankBuilder.js +0 -75
  132. package/dist/sdks/long-yield-carry/src/client/builders/recollateralizeLossBuilder.d.ts +0 -12
  133. package/dist/sdks/long-yield-carry/src/client/builders/recollateralizeLossBuilder.js +0 -220
  134. package/dist/sdks/long-yield-carry/src/client/builders/refreshTokenStateBuilder.d.ts +0 -9
  135. package/dist/sdks/long-yield-carry/src/client/builders/refreshTokenStateBuilder.js +0 -112
  136. package/dist/sdks/long-yield-carry/src/client/builders/refreshTokensBuilder.d.ts +0 -9
  137. package/dist/sdks/long-yield-carry/src/client/builders/refreshTokensBuilder.js +0 -59
  138. package/dist/sdks/long-yield-carry/src/client/builders/refreshYieldingBankBuilder.d.ts +0 -8
  139. package/dist/sdks/long-yield-carry/src/client/builders/refreshYieldingBankBuilder.js +0 -29
  140. package/dist/sdks/long-yield-carry/src/client/builders/resetTokenBurnRateLimitBuilder.d.ts +0 -7
  141. package/dist/sdks/long-yield-carry/src/client/builders/resetTokenBurnRateLimitBuilder.js +0 -19
  142. package/dist/sdks/long-yield-carry/src/client/builders/setTokenCircuitBreakerBuilder.d.ts +0 -11
  143. package/dist/sdks/long-yield-carry/src/client/builders/setTokenCircuitBreakerBuilder.js +0 -31
  144. package/dist/sdks/long-yield-carry/src/client/builders/setYieldingBankCircuitBreakerBuilder.d.ts +0 -8
  145. package/dist/sdks/long-yield-carry/src/client/builders/setYieldingBankCircuitBreakerBuilder.js +0 -28
  146. package/dist/sdks/long-yield-carry/src/client/builders/updateLendingPositionConfigBuilder.d.ts +0 -10
  147. package/dist/sdks/long-yield-carry/src/client/builders/updateLendingPositionConfigBuilder.js +0 -30
  148. package/dist/sdks/long-yield-carry/src/client/builders/updateTokenConfigurationBuilder.d.ts +0 -11
  149. package/dist/sdks/long-yield-carry/src/client/builders/updateTokenConfigurationBuilder.js +0 -47
  150. package/dist/sdks/long-yield-carry/src/client/builders/updateTokenMetadataBuilder.d.ts +0 -7
  151. package/dist/sdks/long-yield-carry/src/client/builders/updateTokenMetadataBuilder.js +0 -24
  152. package/dist/sdks/long-yield-carry/src/client/builders/updateYieldingBankConfigBuilder.d.ts +0 -10
  153. package/dist/sdks/long-yield-carry/src/client/builders/updateYieldingBankConfigBuilder.js +0 -31
  154. package/dist/sdks/long-yield-carry/src/client/builders/utils.d.ts +0 -4
  155. package/dist/sdks/long-yield-carry/src/client/builders/utils.js +0 -20
  156. package/dist/sdks/long-yield-carry/src/client/client.d.ts +0 -115
  157. package/dist/sdks/long-yield-carry/src/client/client.js +0 -166
  158. package/dist/sdks/long-yield-carry/src/client/externalLiquidityResolver.d.ts +0 -13
  159. package/dist/sdks/long-yield-carry/src/client/externalLiquidityResolver.js +0 -34
  160. package/dist/sdks/long-yield-carry/src/client/index.d.ts +0 -10
  161. package/dist/sdks/long-yield-carry/src/client/index.js +0 -33
  162. package/dist/sdks/long-yield-carry/src/client/lendingPlatformClients.d.ts +0 -19
  163. package/dist/sdks/long-yield-carry/src/client/lendingPlatformClients.js +0 -33
  164. package/dist/sdks/long-yield-carry/src/client/pda.d.ts +0 -33
  165. package/dist/sdks/long-yield-carry/src/client/pda.js +0 -79
  166. package/dist/sdks/long-yield-carry/src/client/plans/collectInterest.d.ts +0 -24
  167. package/dist/sdks/long-yield-carry/src/client/plans/collectInterest.js +0 -150
  168. package/dist/sdks/long-yield-carry/src/client/plans/decreaseCarryPosition.d.ts +0 -12
  169. package/dist/sdks/long-yield-carry/src/client/plans/decreaseCarryPosition.js +0 -140
  170. package/dist/sdks/long-yield-carry/src/client/routes/collectInterest.d.ts +0 -13
  171. package/dist/sdks/long-yield-carry/src/client/routes/collectInterest.js +0 -39
  172. package/dist/sdks/long-yield-carry/src/client/transaction.d.ts +0 -41
  173. package/dist/sdks/long-yield-carry/src/client/transaction.js +0 -55
  174. package/dist/sdks/long-yield-carry/src/client/types/builders.d.ts +0 -18
  175. package/dist/sdks/long-yield-carry/src/client/types/builders.js +0 -2
  176. package/dist/sdks/long-yield-carry/src/client/types/enums.d.ts +0 -22
  177. package/dist/sdks/long-yield-carry/src/client/types/enums.js +0 -48
  178. package/dist/sdks/long-yield-carry/src/client/types/general.d.ts +0 -98
  179. package/dist/sdks/long-yield-carry/src/client/types/general.js +0 -2
  180. package/dist/sdks/long-yield-carry/src/client/types/index.d.ts +0 -6
  181. package/dist/sdks/long-yield-carry/src/client/types/index.js +0 -22
  182. package/dist/sdks/long-yield-carry/src/client/types/ix.d.ts +0 -352
  183. package/dist/sdks/long-yield-carry/src/client/types/ix.js +0 -2
  184. package/dist/sdks/long-yield-carry/src/client/types/planTypes/collectInterest.d.ts +0 -91
  185. package/dist/sdks/long-yield-carry/src/client/types/planTypes/collectInterest.js +0 -2
  186. package/dist/sdks/long-yield-carry/src/client/types/planTypes/common.d.ts +0 -28
  187. package/dist/sdks/long-yield-carry/src/client/types/planTypes/common.js +0 -2
  188. package/dist/sdks/long-yield-carry/src/client/types/planTypes/decreaseCarryPosition.d.ts +0 -128
  189. package/dist/sdks/long-yield-carry/src/client/types/planTypes/decreaseCarryPosition.js +0 -2
  190. package/dist/sdks/long-yield-carry/src/client/types/planTypes/index.d.ts +0 -3
  191. package/dist/sdks/long-yield-carry/src/client/types/planTypes/index.js +0 -19
  192. package/dist/sdks/long-yield-carry/src/client/types/tx.d.ts +0 -339
  193. package/dist/sdks/long-yield-carry/src/client/types/tx.js +0 -2
  194. package/dist/sdks/long-yield-carry/src/constants/configs/allocations.d.ts +0 -3
  195. package/dist/sdks/long-yield-carry/src/constants/configs/allocations.js +0 -23
  196. package/dist/sdks/long-yield-carry/src/constants/configs/carryTradePresets.d.ts +0 -58
  197. package/dist/sdks/long-yield-carry/src/constants/configs/carryTradePresets.js +0 -116
  198. package/dist/sdks/long-yield-carry/src/constants/configs/index.d.ts +0 -2
  199. package/dist/sdks/long-yield-carry/src/constants/configs/index.js +0 -18
  200. package/dist/sdks/long-yield-carry/src/constants/general.d.ts +0 -70
  201. package/dist/sdks/long-yield-carry/src/constants/general.js +0 -107
  202. package/dist/sdks/long-yield-carry/src/constants/index.d.ts +0 -3
  203. package/dist/sdks/long-yield-carry/src/constants/index.js +0 -19
  204. package/dist/sdks/long-yield-carry/src/constants/lycTokenMetadata.d.ts +0 -36
  205. package/dist/sdks/long-yield-carry/src/constants/lycTokenMetadata.js +0 -41
  206. package/dist/sdks/long-yield-carry/src/decoders/decodeTransaction.d.ts +0 -86
  207. package/dist/sdks/long-yield-carry/src/decoders/decodeTransaction.js +0 -230
  208. package/dist/sdks/long-yield-carry/src/decoders/discriminators.d.ts +0 -8
  209. package/dist/sdks/long-yield-carry/src/decoders/discriminators.js +0 -11
  210. package/dist/sdks/long-yield-carry/src/decoders/idlAccounts.d.ts +0 -29
  211. package/dist/sdks/long-yield-carry/src/decoders/idlAccounts.js +0 -57
  212. package/dist/sdks/long-yield-carry/src/decoders/index.d.ts +0 -6
  213. package/dist/sdks/long-yield-carry/src/decoders/index.js +0 -14
  214. package/dist/sdks/long-yield-carry/src/decoders/innerCpis.d.ts +0 -68
  215. package/dist/sdks/long-yield-carry/src/decoders/innerCpis.js +0 -225
  216. package/dist/sdks/long-yield-carry/src/decoders/lycInstructionNames.d.ts +0 -6
  217. package/dist/sdks/long-yield-carry/src/decoders/lycInstructionNames.js +0 -73
  218. package/dist/sdks/long-yield-carry/src/decoders/programIds.d.ts +0 -4
  219. package/dist/sdks/long-yield-carry/src/decoders/programIds.js +0 -11
  220. package/dist/sdks/long-yield-carry/src/decoders/solana.d.ts +0 -7
  221. package/dist/sdks/long-yield-carry/src/decoders/solana.js +0 -30
  222. package/dist/sdks/long-yield-carry/src/decoders/transactionPayload.d.ts +0 -41
  223. package/dist/sdks/long-yield-carry/src/decoders/transactionPayload.js +0 -6
  224. package/dist/sdks/long-yield-carry/src/decoders/types.d.ts +0 -58
  225. package/dist/sdks/long-yield-carry/src/decoders/types.js +0 -2
  226. package/dist/sdks/long-yield-carry/src/errors.d.ts +0 -69
  227. package/dist/sdks/long-yield-carry/src/errors.js +0 -183
  228. package/dist/sdks/long-yield-carry/src/idl/long_yield_carry.js +0 -7323
  229. package/dist/sdks/long-yield-carry/src/index.d.ts +0 -10
  230. package/dist/sdks/long-yield-carry/src/index.js +0 -25
  231. package/dist/sdks/long-yield-carry/src/metrics/index.d.ts +0 -1
  232. package/dist/sdks/long-yield-carry/src/metrics/index.js +0 -17
  233. package/dist/sdks/long-yield-carry/src/metrics/protocolMetrics.d.ts +0 -276
  234. package/dist/sdks/long-yield-carry/src/metrics/protocolMetrics.js +0 -547
  235. package/dist/sdks/long-yield-carry/src/models/index.d.ts +0 -3
  236. package/dist/sdks/long-yield-carry/src/models/index.js +0 -7
  237. package/dist/sdks/long-yield-carry/src/models/lycToken.d.ts +0 -156
  238. package/dist/sdks/long-yield-carry/src/models/lycToken.js +0 -288
  239. package/dist/sdks/long-yield-carry/src/models/yieldingBank.d.ts +0 -52
  240. package/dist/sdks/long-yield-carry/src/models/yieldingBank.js +0 -109
  241. package/dist/sdks/long-yield-carry/src/services/allocation/allocationService.d.ts +0 -106
  242. package/dist/sdks/long-yield-carry/src/services/allocation/allocationService.js +0 -589
  243. package/dist/sdks/long-yield-carry/src/services/allocation/index.d.ts +0 -2
  244. package/dist/sdks/long-yield-carry/src/services/allocation/index.js +0 -18
  245. package/dist/sdks/long-yield-carry/src/services/allocation/types.d.ts +0 -25
  246. package/dist/sdks/long-yield-carry/src/services/allocation/types.js +0 -2
  247. package/dist/sdks/long-yield-carry/src/services/carry/carryAllocationConfig.d.ts +0 -103
  248. package/dist/sdks/long-yield-carry/src/services/carry/carryAllocationConfig.js +0 -146
  249. package/dist/sdks/long-yield-carry/src/services/carry/index.d.ts +0 -2
  250. package/dist/sdks/long-yield-carry/src/services/carry/index.js +0 -18
  251. package/dist/sdks/long-yield-carry/src/services/carry/lycLendingPositionManager.d.ts +0 -39
  252. package/dist/sdks/long-yield-carry/src/services/carry/lycLendingPositionManager.js +0 -100
  253. package/dist/sdks/long-yield-carry/src/services/index.d.ts +0 -5
  254. package/dist/sdks/long-yield-carry/src/services/index.js +0 -21
  255. package/dist/sdks/long-yield-carry/src/services/lendingPosition/index.d.ts +0 -2
  256. package/dist/sdks/long-yield-carry/src/services/lendingPosition/index.js +0 -5
  257. package/dist/sdks/long-yield-carry/src/services/lendingPosition/lendingPositionService.d.ts +0 -88
  258. package/dist/sdks/long-yield-carry/src/services/lendingPosition/lendingPositionService.js +0 -229
  259. package/dist/sdks/long-yield-carry/src/services/rebalance/index.d.ts +0 -2
  260. package/dist/sdks/long-yield-carry/src/services/rebalance/index.js +0 -18
  261. package/dist/sdks/long-yield-carry/src/services/rebalance/token/index.d.ts +0 -1
  262. package/dist/sdks/long-yield-carry/src/services/rebalance/token/index.js +0 -17
  263. package/dist/sdks/long-yield-carry/src/services/rebalance/token/tokenRebalanceService.d.ts +0 -51
  264. package/dist/sdks/long-yield-carry/src/services/rebalance/token/tokenRebalanceService.js +0 -99
  265. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/index.d.ts +0 -3
  266. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/index.js +0 -21
  267. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/planner.d.ts +0 -68
  268. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/planner.js +0 -181
  269. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/strategy.d.ts +0 -26
  270. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/strategy.js +0 -26
  271. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/types.d.ts +0 -40
  272. package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/types.js +0 -2
  273. package/dist/sdks/long-yield-carry/src/services/redemption/index.d.ts +0 -2
  274. package/dist/sdks/long-yield-carry/src/services/redemption/index.js +0 -5
  275. package/dist/sdks/long-yield-carry/src/services/redemption/redemptionService.d.ts +0 -139
  276. package/dist/sdks/long-yield-carry/src/services/redemption/redemptionService.js +0 -532
  277. package/dist/sdks/long-yield-carry/src/types/enriched.d.ts +0 -168
  278. package/dist/sdks/long-yield-carry/src/types/enriched.js +0 -2
  279. package/dist/sdks/long-yield-carry/src/types/index.d.ts +0 -1
  280. package/dist/sdks/long-yield-carry/src/types/index.js +0 -17
  281. package/dist/sdks/long-yield-carry/src/utils/cache.d.ts +0 -4
  282. package/dist/sdks/long-yield-carry/src/utils/cache.js +0 -10
  283. package/dist/sdks/long-yield-carry/src/utils/data.d.ts +0 -12
  284. package/dist/sdks/long-yield-carry/src/utils/data.js +0 -59
  285. package/dist/sdks/long-yield-carry/src/utils/enrichment.d.ts +0 -5
  286. package/dist/sdks/long-yield-carry/src/utils/enrichment.js +0 -244
  287. package/dist/sdks/long-yield-carry/src/utils/feeDripMetrics.d.ts +0 -36
  288. package/dist/sdks/long-yield-carry/src/utils/feeDripMetrics.js +0 -93
  289. package/dist/sdks/long-yield-carry/src/utils/general.d.ts +0 -28
  290. package/dist/sdks/long-yield-carry/src/utils/general.js +0 -47
  291. package/dist/sdks/long-yield-carry/src/utils/index.d.ts +0 -13
  292. package/dist/sdks/long-yield-carry/src/utils/index.js +0 -29
  293. package/dist/sdks/long-yield-carry/src/utils/ix.d.ts +0 -83
  294. package/dist/sdks/long-yield-carry/src/utils/ix.js +0 -165
  295. package/dist/sdks/long-yield-carry/src/utils/lendingPosition.d.ts +0 -68
  296. package/dist/sdks/long-yield-carry/src/utils/lendingPosition.js +0 -105
  297. package/dist/sdks/long-yield-carry/src/utils/lookupTables.d.ts +0 -55
  298. package/dist/sdks/long-yield-carry/src/utils/lookupTables.js +0 -216
  299. package/dist/sdks/long-yield-carry/src/utils/lycData.d.ts +0 -66
  300. package/dist/sdks/long-yield-carry/src/utils/lycData.js +0 -211
  301. package/dist/sdks/long-yield-carry/src/utils/timelock.d.ts +0 -19
  302. package/dist/sdks/long-yield-carry/src/utils/timelock.js +0 -37
  303. package/dist/sdks/long-yield-carry/src/utils/tokenFeeMath.d.ts +0 -11
  304. package/dist/sdks/long-yield-carry/src/utils/tokenFeeMath.js +0 -24
  305. package/dist/sdks/long-yield-carry/src/utils/transactions.d.ts +0 -20
  306. package/dist/sdks/long-yield-carry/src/utils/transactions.js +0 -72
  307. package/dist/sdks/long-yield-carry/src/utils/yieldingBank.d.ts +0 -24
  308. package/dist/sdks/long-yield-carry/src/utils/yieldingBank.js +0 -36
  309. package/dist/shared/common/src/constants/accountMetas.d.ts +0 -3
  310. package/dist/shared/common/src/constants/accountMetas.js +0 -9
  311. package/dist/shared/common/src/constants/general.d.ts +0 -21
  312. package/dist/shared/common/src/constants/general.js +0 -30
  313. package/dist/shared/common/src/constants/generated/cpi.d.ts +0 -23
  314. package/dist/shared/common/src/constants/generated/cpi.js +0 -28
  315. package/dist/shared/common/src/constants/generated/index.d.ts +0 -1
  316. package/dist/shared/common/src/constants/generated/index.js +0 -17
  317. package/dist/shared/common/src/constants/index.d.ts +0 -3
  318. package/dist/shared/common/src/constants/index.js +0 -19
  319. package/dist/shared/common/src/index.d.ts +0 -4
  320. package/dist/shared/common/src/index.js +0 -20
  321. package/dist/shared/common/src/services/baseAccountClient.d.ts +0 -22
  322. package/dist/shared/common/src/services/baseAccountClient.js +0 -38
  323. package/dist/shared/common/src/services/baseIxBuilderService.d.ts +0 -27
  324. package/dist/shared/common/src/services/baseIxBuilderService.js +0 -48
  325. package/dist/shared/common/src/services/dataCache.d.ts +0 -41
  326. package/dist/shared/common/src/services/dataCache.js +0 -130
  327. package/dist/shared/common/src/services/index.d.ts +0 -8
  328. package/dist/shared/common/src/services/index.js +0 -24
  329. package/dist/shared/common/src/services/lutManager.d.ts +0 -31
  330. package/dist/shared/common/src/services/lutManager.js +0 -133
  331. package/dist/shared/common/src/services/mints/defaults.d.ts +0 -2
  332. package/dist/shared/common/src/services/mints/defaults.js +0 -152
  333. package/dist/shared/common/src/services/mints/index.d.ts +0 -4
  334. package/dist/shared/common/src/services/mints/index.js +0 -20
  335. package/dist/shared/common/src/services/mints/registry.d.ts +0 -70
  336. package/dist/shared/common/src/services/mints/registry.js +0 -117
  337. package/dist/shared/common/src/services/mints/symbols.d.ts +0 -6
  338. package/dist/shared/common/src/services/mints/symbols.js +0 -13
  339. package/dist/shared/common/src/services/mints/types.d.ts +0 -30
  340. package/dist/shared/common/src/services/mints/types.js +0 -2
  341. package/dist/shared/common/src/services/swap/index.d.ts +0 -4
  342. package/dist/shared/common/src/services/swap/index.js +0 -20
  343. package/dist/shared/common/src/services/swap/routableSwapClient.d.ts +0 -36
  344. package/dist/shared/common/src/services/swap/routableSwapClient.js +0 -2
  345. package/dist/shared/common/src/services/swap/swapClientBase.d.ts +0 -45
  346. package/dist/shared/common/src/services/swap/swapClientBase.js +0 -2
  347. package/dist/shared/common/src/services/swap/swapRouting.d.ts +0 -13
  348. package/dist/shared/common/src/services/swap/swapRouting.js +0 -28
  349. package/dist/shared/common/src/services/swap/types.d.ts +0 -77
  350. package/dist/shared/common/src/services/swap/types.js +0 -2
  351. package/dist/shared/common/src/services/token/index.d.ts +0 -2
  352. package/dist/shared/common/src/services/token/index.js +0 -18
  353. package/dist/shared/common/src/services/token/tokenProtocolClientBase.d.ts +0 -51
  354. package/dist/shared/common/src/services/token/tokenProtocolClientBase.js +0 -2
  355. package/dist/shared/common/src/services/token/types.d.ts +0 -19
  356. package/dist/shared/common/src/services/token/types.js +0 -2
  357. package/dist/shared/common/src/services/transactionSender.d.ts +0 -24
  358. package/dist/shared/common/src/services/transactionSender.js +0 -30
  359. package/dist/shared/common/src/types/cpi.d.ts +0 -34
  360. package/dist/shared/common/src/types/cpi.js +0 -8
  361. package/dist/shared/common/src/types/enums.d.ts +0 -59
  362. package/dist/shared/common/src/types/enums.js +0 -122
  363. package/dist/shared/common/src/types/general.d.ts +0 -38
  364. package/dist/shared/common/src/types/general.js +0 -2
  365. package/dist/shared/common/src/types/index.d.ts +0 -4
  366. package/dist/shared/common/src/types/index.js +0 -20
  367. package/dist/shared/common/src/types/solana.d.ts +0 -24
  368. package/dist/shared/common/src/types/solana.js +0 -2
  369. package/dist/shared/common/src/utils/accounts/index.d.ts +0 -5
  370. package/dist/shared/common/src/utils/accounts/index.js +0 -21
  371. package/dist/shared/common/src/utils/accounts/meta.d.ts +0 -21
  372. package/dist/shared/common/src/utils/accounts/meta.js +0 -27
  373. package/dist/shared/common/src/utils/accounts/pda.d.ts +0 -2
  374. package/dist/shared/common/src/utils/accounts/pda.js +0 -17
  375. package/dist/shared/common/src/utils/accounts/roles.d.ts +0 -26
  376. package/dist/shared/common/src/utils/accounts/roles.js +0 -54
  377. package/dist/shared/common/src/utils/accounts/rpc.d.ts +0 -8
  378. package/dist/shared/common/src/utils/accounts/rpc.js +0 -30
  379. package/dist/shared/common/src/utils/accounts/splBalances.d.ts +0 -15
  380. package/dist/shared/common/src/utils/accounts/splBalances.js +0 -52
  381. package/dist/shared/common/src/utils/anchor.d.ts +0 -17
  382. package/dist/shared/common/src/utils/anchor.js +0 -29
  383. package/dist/shared/common/src/utils/asyncConcurrency.d.ts +0 -5
  384. package/dist/shared/common/src/utils/asyncConcurrency.js +0 -28
  385. package/dist/shared/common/src/utils/compat.d.ts +0 -46
  386. package/dist/shared/common/src/utils/compat.js +0 -72
  387. package/dist/shared/common/src/utils/cpi/args.d.ts +0 -69
  388. package/dist/shared/common/src/utils/cpi/args.js +0 -100
  389. package/dist/shared/common/src/utils/cpi/index.d.ts +0 -2
  390. package/dist/shared/common/src/utils/cpi/index.js +0 -18
  391. package/dist/shared/common/src/utils/cpi/refs.d.ts +0 -122
  392. package/dist/shared/common/src/utils/cpi/refs.js +0 -234
  393. package/dist/shared/common/src/utils/data.d.ts +0 -20
  394. package/dist/shared/common/src/utils/data.js +0 -27
  395. package/dist/shared/common/src/utils/general.d.ts +0 -24
  396. package/dist/shared/common/src/utils/general.js +0 -95
  397. package/dist/shared/common/src/utils/index.d.ts +0 -22
  398. package/dist/shared/common/src/utils/index.js +0 -38
  399. package/dist/shared/common/src/utils/instruction.d.ts +0 -74
  400. package/dist/shared/common/src/utils/instruction.js +0 -147
  401. package/dist/shared/common/src/utils/jito.d.ts +0 -113
  402. package/dist/shared/common/src/utils/jito.js +0 -178
  403. package/dist/shared/common/src/utils/json.d.ts +0 -5
  404. package/dist/shared/common/src/utils/json.js +0 -25
  405. package/dist/shared/common/src/utils/jsonRpcFetch.d.ts +0 -21
  406. package/dist/shared/common/src/utils/jsonRpcFetch.js +0 -134
  407. package/dist/shared/common/src/utils/metadata.d.ts +0 -107
  408. package/dist/shared/common/src/utils/metadata.js +0 -194
  409. package/dist/shared/common/src/utils/numbers.d.ts +0 -72
  410. package/dist/shared/common/src/utils/numbers.js +0 -193
  411. package/dist/shared/common/src/utils/priorityFee.d.ts +0 -18
  412. package/dist/shared/common/src/utils/priorityFee.js +0 -63
  413. package/dist/shared/common/src/utils/retry.d.ts +0 -20
  414. package/dist/shared/common/src/utils/retry.js +0 -69
  415. package/dist/shared/common/src/utils/rpc.d.ts +0 -40
  416. package/dist/shared/common/src/utils/rpc.js +0 -130
  417. package/dist/shared/common/src/utils/solana.d.ts +0 -23
  418. package/dist/shared/common/src/utils/solana.js +0 -61
  419. package/dist/shared/common/src/utils/timeSeries.d.ts +0 -18
  420. package/dist/shared/common/src/utils/timeSeries.js +0 -40
  421. package/dist/shared/common/src/utils/token.d.ts +0 -33
  422. package/dist/shared/common/src/utils/token.js +0 -82
  423. package/dist/shared/common/src/utils/transaction.d.ts +0 -154
  424. package/dist/shared/common/src/utils/transaction.js +0 -585
  425. package/dist/shared/common/src/utils/transactionSplitter.d.ts +0 -85
  426. package/dist/shared/common/src/utils/transactionSplitter.js +0 -127
  427. package/dist/shared/common/src/utils/txAccountCoverage.d.ts +0 -49
  428. package/dist/shared/common/src/utils/txAccountCoverage.js +0 -122
  429. package/dist/shared/jupiter-helpers/src/api.d.ts +0 -59
  430. package/dist/shared/jupiter-helpers/src/api.js +0 -130
  431. package/dist/shared/jupiter-helpers/src/client.d.ts +0 -79
  432. package/dist/shared/jupiter-helpers/src/client.js +0 -173
  433. package/dist/shared/jupiter-helpers/src/constants.d.ts +0 -35
  434. package/dist/shared/jupiter-helpers/src/constants.js +0 -38
  435. package/dist/shared/jupiter-helpers/src/extract.d.ts +0 -30
  436. package/dist/shared/jupiter-helpers/src/extract.js +0 -57
  437. package/dist/shared/jupiter-helpers/src/index.d.ts +0 -5
  438. package/dist/shared/jupiter-helpers/src/index.js +0 -21
  439. package/dist/shared/jupiter-helpers/src/routePreInstructions.d.ts +0 -19
  440. package/dist/shared/jupiter-helpers/src/routePreInstructions.js +0 -61
  441. package/dist/shared/jupiter-helpers/src/sizeExactInForMinOutput.d.ts +0 -70
  442. package/dist/shared/jupiter-helpers/src/sizeExactInForMinOutput.js +0 -95
  443. package/dist/shared/jupiter-helpers/src/types.d.ts +0 -66
  444. package/dist/shared/jupiter-helpers/src/types.js +0 -2
  445. package/dist/shared/lending-platforms/src/constants/cache.d.ts +0 -8
  446. package/dist/shared/lending-platforms/src/constants/cache.js +0 -11
  447. package/dist/shared/lending-platforms/src/constants/index.d.ts +0 -3
  448. package/dist/shared/lending-platforms/src/constants/index.js +0 -19
  449. package/dist/shared/lending-platforms/src/constants/kamino.d.ts +0 -7
  450. package/dist/shared/lending-platforms/src/constants/kamino.js +0 -83
  451. package/dist/shared/lending-platforms/src/constants/lendingPosition.d.ts +0 -7
  452. package/dist/shared/lending-platforms/src/constants/lendingPosition.js +0 -10
  453. package/dist/shared/lending-platforms/src/data/accounts/index.d.ts +0 -2
  454. package/dist/shared/lending-platforms/src/data/accounts/index.js +0 -18
  455. package/dist/shared/lending-platforms/src/data/accounts/kamino.d.ts +0 -42
  456. package/dist/shared/lending-platforms/src/data/accounts/kamino.js +0 -104
  457. package/dist/shared/lending-platforms/src/data/accounts/lpAccountsBase.d.ts +0 -7
  458. package/dist/shared/lending-platforms/src/data/accounts/lpAccountsBase.js +0 -9
  459. package/dist/shared/lending-platforms/src/data/incentive/incentiveBase.d.ts +0 -35
  460. package/dist/shared/lending-platforms/src/data/incentive/incentiveBase.js +0 -26
  461. package/dist/shared/lending-platforms/src/data/incentive/index.d.ts +0 -2
  462. package/dist/shared/lending-platforms/src/data/incentive/index.js +0 -18
  463. package/dist/shared/lending-platforms/src/data/incentive/kamino.d.ts +0 -55
  464. package/dist/shared/lending-platforms/src/data/incentive/kamino.js +0 -101
  465. package/dist/shared/lending-platforms/src/data/index.d.ts +0 -6
  466. package/dist/shared/lending-platforms/src/data/index.js +0 -22
  467. package/dist/shared/lending-platforms/src/data/instructions/index.d.ts +0 -3
  468. package/dist/shared/lending-platforms/src/data/instructions/index.js +0 -19
  469. package/dist/shared/lending-platforms/src/data/instructions/kamino.d.ts +0 -55
  470. package/dist/shared/lending-platforms/src/data/instructions/kamino.js +0 -630
  471. package/dist/shared/lending-platforms/src/data/instructions/lpInstructionsBase.d.ts +0 -175
  472. package/dist/shared/lending-platforms/src/data/instructions/lpInstructionsBase.js +0 -192
  473. package/dist/shared/lending-platforms/src/data/instructions/types.d.ts +0 -7
  474. package/dist/shared/lending-platforms/src/data/instructions/types.js +0 -2
  475. package/dist/shared/lending-platforms/src/data/platform/index.d.ts +0 -2
  476. package/dist/shared/lending-platforms/src/data/platform/index.js +0 -18
  477. package/dist/shared/lending-platforms/src/data/platform/kamino.d.ts +0 -59
  478. package/dist/shared/lending-platforms/src/data/platform/kamino.js +0 -206
  479. package/dist/shared/lending-platforms/src/data/platform/lpDataBase.d.ts +0 -35
  480. package/dist/shared/lending-platforms/src/data/platform/lpDataBase.js +0 -31
  481. package/dist/shared/lending-platforms/src/data/reserve/index.d.ts +0 -2
  482. package/dist/shared/lending-platforms/src/data/reserve/index.js +0 -18
  483. package/dist/shared/lending-platforms/src/data/reserve/kamino.d.ts +0 -45
  484. package/dist/shared/lending-platforms/src/data/reserve/kamino.js +0 -141
  485. package/dist/shared/lending-platforms/src/data/reserve/reserveBase.d.ts +0 -114
  486. package/dist/shared/lending-platforms/src/data/reserve/reserveBase.js +0 -125
  487. package/dist/shared/lending-platforms/src/data/userPosition/index.d.ts +0 -2
  488. package/dist/shared/lending-platforms/src/data/userPosition/index.js +0 -18
  489. package/dist/shared/lending-platforms/src/data/userPosition/kamino.d.ts +0 -15
  490. package/dist/shared/lending-platforms/src/data/userPosition/kamino.js +0 -45
  491. package/dist/shared/lending-platforms/src/data/userPosition/userPositionBase.d.ts +0 -50
  492. package/dist/shared/lending-platforms/src/data/userPosition/userPositionBase.js +0 -63
  493. package/dist/shared/lending-platforms/src/index.d.ts +0 -5
  494. package/dist/shared/lending-platforms/src/index.js +0 -21
  495. package/dist/shared/lending-platforms/src/services/client/index.d.ts +0 -2
  496. package/dist/shared/lending-platforms/src/services/client/index.js +0 -18
  497. package/dist/shared/lending-platforms/src/services/client/kamino.d.ts +0 -53
  498. package/dist/shared/lending-platforms/src/services/client/kamino.js +0 -142
  499. package/dist/shared/lending-platforms/src/services/client/lpClientBase.d.ts +0 -66
  500. package/dist/shared/lending-platforms/src/services/client/lpClientBase.js +0 -19
  501. package/dist/shared/lending-platforms/src/services/flashLoan/flashLoanBase.d.ts +0 -49
  502. package/dist/shared/lending-platforms/src/services/flashLoan/flashLoanBase.js +0 -16
  503. package/dist/shared/lending-platforms/src/services/flashLoan/index.d.ts +0 -2
  504. package/dist/shared/lending-platforms/src/services/flashLoan/index.js +0 -18
  505. package/dist/shared/lending-platforms/src/services/flashLoan/kamino.d.ts +0 -11
  506. package/dist/shared/lending-platforms/src/services/flashLoan/kamino.js +0 -85
  507. package/dist/shared/lending-platforms/src/services/index.d.ts +0 -5
  508. package/dist/shared/lending-platforms/src/services/index.js +0 -21
  509. package/dist/shared/lending-platforms/src/services/lendingPosition/index.d.ts +0 -2
  510. package/dist/shared/lending-platforms/src/services/lendingPosition/index.js +0 -18
  511. package/dist/shared/lending-platforms/src/services/lendingPosition/lendingPositionManager.d.ts +0 -117
  512. package/dist/shared/lending-platforms/src/services/lendingPosition/lendingPositionManager.js +0 -342
  513. package/dist/shared/lending-platforms/src/services/lendingPosition/types.d.ts +0 -40
  514. package/dist/shared/lending-platforms/src/services/lendingPosition/types.js +0 -2
  515. package/dist/shared/lending-platforms/src/services/leverage/index.d.ts +0 -2
  516. package/dist/shared/lending-platforms/src/services/leverage/index.js +0 -18
  517. package/dist/shared/lending-platforms/src/services/leverage/leverageService.d.ts +0 -104
  518. package/dist/shared/lending-platforms/src/services/leverage/leverageService.js +0 -437
  519. package/dist/shared/lending-platforms/src/services/leverage/types.d.ts +0 -261
  520. package/dist/shared/lending-platforms/src/services/leverage/types.js +0 -2
  521. package/dist/shared/lending-platforms/src/services/reservesManager.d.ts +0 -53
  522. package/dist/shared/lending-platforms/src/services/reservesManager.js +0 -112
  523. package/dist/shared/lending-platforms/src/types/general.d.ts +0 -37
  524. package/dist/shared/lending-platforms/src/types/general.js +0 -8
  525. package/dist/shared/lending-platforms/src/types/index.d.ts +0 -2
  526. package/dist/shared/lending-platforms/src/types/index.js +0 -18
  527. package/dist/shared/lending-platforms/src/types/kamino.d.ts +0 -10
  528. package/dist/shared/lending-platforms/src/types/kamino.js +0 -2
  529. package/dist/shared/lending-platforms/src/utils/accounts.d.ts +0 -16
  530. package/dist/shared/lending-platforms/src/utils/accounts.js +0 -36
  531. package/dist/shared/lending-platforms/src/utils/cache.d.ts +0 -3
  532. package/dist/shared/lending-platforms/src/utils/cache.js +0 -11
  533. package/dist/shared/lending-platforms/src/utils/index.d.ts +0 -6
  534. package/dist/shared/lending-platforms/src/utils/index.js +0 -22
  535. package/dist/shared/lending-platforms/src/utils/kamino.d.ts +0 -87
  536. package/dist/shared/lending-platforms/src/utils/kamino.js +0 -190
  537. package/dist/shared/lending-platforms/src/utils/lendingPlatform.d.ts +0 -6
  538. package/dist/shared/lending-platforms/src/utils/lendingPlatform.js +0 -16
  539. package/dist/shared/lending-platforms/src/utils/math.d.ts +0 -47
  540. package/dist/shared/lending-platforms/src/utils/math.js +0 -123
  541. package/dist/shared/lending-platforms/src/utils/scope.d.ts +0 -38
  542. package/dist/shared/lending-platforms/src/utils/scope.js +0 -144
  543. package/dist/shared/oracle-service/src/constants/index.d.ts +0 -3
  544. package/dist/shared/oracle-service/src/constants/index.js +0 -19
  545. package/dist/shared/oracle-service/src/constants/pyth.d.ts +0 -7
  546. package/dist/shared/oracle-service/src/constants/pyth.js +0 -71
  547. package/dist/shared/oracle-service/src/constants/splStake.d.ts +0 -2
  548. package/dist/shared/oracle-service/src/constants/splStake.js +0 -6
  549. package/dist/shared/oracle-service/src/constants/switchboard.d.ts +0 -7
  550. package/dist/shared/oracle-service/src/constants/switchboard.js +0 -10
  551. package/dist/shared/oracle-service/src/feeds/custom.d.ts +0 -30
  552. package/dist/shared/oracle-service/src/feeds/custom.js +0 -56
  553. package/dist/shared/oracle-service/src/feeds/jupiter.d.ts +0 -7
  554. package/dist/shared/oracle-service/src/feeds/jupiter.js +0 -43
  555. package/dist/shared/oracle-service/src/feeds/priceBase.d.ts +0 -13
  556. package/dist/shared/oracle-service/src/feeds/priceBase.js +0 -25
  557. package/dist/shared/oracle-service/src/feeds/pyth.d.ts +0 -8
  558. package/dist/shared/oracle-service/src/feeds/pyth.js +0 -59
  559. package/dist/shared/oracle-service/src/feeds/splStake.d.ts +0 -26
  560. package/dist/shared/oracle-service/src/feeds/splStake.js +0 -99
  561. package/dist/shared/oracle-service/src/feeds/switchboard.d.ts +0 -6
  562. package/dist/shared/oracle-service/src/feeds/switchboard.js +0 -11
  563. package/dist/shared/oracle-service/src/index.d.ts +0 -5
  564. package/dist/shared/oracle-service/src/index.js +0 -26
  565. package/dist/shared/oracle-service/src/oracle.d.ts +0 -22
  566. package/dist/shared/oracle-service/src/oracle.js +0 -104
  567. package/dist/shared/oracle-service/src/types.d.ts +0 -4
  568. package/dist/shared/oracle-service/src/types.js +0 -2
  569. package/dist/shared/oracle-service/src/utils/general.d.ts +0 -20
  570. package/dist/shared/oracle-service/src/utils/general.js +0 -65
  571. package/dist/shared/oracle-service/src/utils/index.d.ts +0 -1
  572. package/dist/shared/oracle-service/src/utils/index.js +0 -17
  573. package/dist/shared/perena-helpers/src/accounts.d.ts +0 -7
  574. package/dist/shared/perena-helpers/src/accounts.js +0 -12
  575. package/dist/shared/perena-helpers/src/client.d.ts +0 -299
  576. package/dist/shared/perena-helpers/src/client.js +0 -680
  577. package/dist/shared/perena-helpers/src/constants.d.ts +0 -5
  578. package/dist/shared/perena-helpers/src/constants.js +0 -8
  579. package/dist/shared/perena-helpers/src/cpi/burn.d.ts +0 -27
  580. package/dist/shared/perena-helpers/src/cpi/burn.js +0 -22
  581. package/dist/shared/perena-helpers/src/cpi/index.d.ts +0 -3
  582. package/dist/shared/perena-helpers/src/cpi/index.js +0 -19
  583. package/dist/shared/perena-helpers/src/cpi/mint.d.ts +0 -27
  584. package/dist/shared/perena-helpers/src/cpi/mint.js +0 -22
  585. package/dist/shared/perena-helpers/src/cpi/requestUnstake.d.ts +0 -19
  586. package/dist/shared/perena-helpers/src/cpi/requestUnstake.js +0 -16
  587. package/dist/shared/perena-helpers/src/index.d.ts +0 -5
  588. package/dist/shared/perena-helpers/src/index.js +0 -21
  589. package/dist/shared/perena-helpers/src/utils.d.ts +0 -9
  590. package/dist/shared/perena-helpers/src/utils.js +0 -54
  591. package/dist/shared/swap-aggregator/src/aggSwapClient.d.ts +0 -71
  592. package/dist/shared/swap-aggregator/src/aggSwapClient.js +0 -103
  593. package/dist/shared/swap-aggregator/src/index.d.ts +0 -1
  594. package/dist/shared/swap-aggregator/src/index.js +0 -17
  595. package/docs/launchingToken.md +0 -57
  596. package/scripts/asyncBurn.ts +0 -155
  597. package/scripts/burnToken.ts +0 -120
  598. package/scripts/claimIncentives.ts +0 -125
  599. package/scripts/closeCpiPlans.ts +0 -113
  600. package/scripts/collectInterest.ts +0 -194
  601. package/scripts/collectProtocolFees.ts +0 -144
  602. package/scripts/computeOptimalAllocations.ts +0 -117
  603. package/scripts/createToken.ts +0 -100
  604. package/scripts/createTokenLendingPosition.ts +0 -204
  605. package/scripts/createYieldingBank.ts +0 -91
  606. package/scripts/decreaseCarryPositions.ts +0 -359
  607. package/scripts/depositUnlentCollateral.ts +0 -106
  608. package/scripts/emergency/deleverageAll.ts +0 -287
  609. package/scripts/emergency/triggerCircuitBreaker.ts +0 -87
  610. package/scripts/env.ts +0 -4
  611. package/scripts/findTxs.ts +0 -169
  612. package/scripts/increaseCarryPositions.ts +0 -134
  613. package/scripts/inspect/format.ts +0 -576
  614. package/scripts/inspect.ts +0 -147
  615. package/scripts/localUtils.ts +0 -249
  616. package/scripts/mintToken.ts +0 -126
  617. package/scripts/processAsyncBurns.ts +0 -89
  618. package/scripts/rebalanceToken.ts +0 -269
  619. package/scripts/rebalanceYieldingBank.ts +0 -183
  620. package/scripts/recollateralizeLoss.ts +0 -79
  621. package/scripts/refresh.ts +0 -156
  622. package/scripts/updateFees.ts +0 -486
  623. package/scripts/updateGeneralLut.ts +0 -36
  624. package/scripts/updateLendingPositionConfig.ts +0 -172
  625. package/scripts/updateTokenLuts.ts +0 -36
  626. package/scripts/updateTokenMetadata.ts +0 -199
  627. package/scripts/updateYieldingBankConfig.ts +0 -100
  628. package/scripts/withdrawUnlentCollateral.ts +0 -178
  629. package/src/client/account.ts +0 -503
  630. package/src/client/builders/args.ts +0 -381
  631. package/src/client/builders/asyncBurnBuilder.ts +0 -305
  632. package/src/client/builders/base.ts +0 -303
  633. package/src/client/builders/burnTokenBuilder.ts +0 -258
  634. package/src/client/builders/claimIncentivesBuilder.ts +0 -211
  635. package/src/client/builders/collectFeesBuilder.ts +0 -52
  636. package/src/client/builders/collectInterestBuilder.ts +0 -165
  637. package/src/client/builders/createCpiPlanBuilder.ts +0 -21
  638. package/src/client/builders/createTokenBuilder.ts +0 -73
  639. package/src/client/builders/createTokenLendingPositionBuilder.ts +0 -219
  640. package/src/client/builders/createYieldingBankAllocationBuilder.ts +0 -32
  641. package/src/client/builders/createYieldingBankBuilder.ts +0 -39
  642. package/src/client/builders/decreaseCarryPositionBuilder.ts +0 -162
  643. package/src/client/builders/depositUnlentCollateralBuilder.ts +0 -95
  644. package/src/client/builders/increaseCarryPositionBuilder.ts +0 -105
  645. package/src/client/builders/index.ts +0 -37
  646. package/src/client/builders/mintTokenBuilder.ts +0 -137
  647. package/src/client/builders/rebalanceTokenBuilder.ts +0 -356
  648. package/src/client/builders/rebalanceYieldingBankBuilder.ts +0 -109
  649. package/src/client/builders/recollateralizeLossBuilder.ts +0 -367
  650. package/src/client/builders/refreshTokenStateBuilder.ts +0 -153
  651. package/src/client/builders/refreshTokensBuilder.ts +0 -82
  652. package/src/client/builders/refreshYieldingBankBuilder.ts +0 -42
  653. package/src/client/builders/resetTokenBurnRateLimitBuilder.ts +0 -21
  654. package/src/client/builders/setTokenCircuitBreakerBuilder.ts +0 -40
  655. package/src/client/builders/setYieldingBankCircuitBreakerBuilder.ts +0 -37
  656. package/src/client/builders/updateLendingPositionConfigBuilder.ts +0 -33
  657. package/src/client/builders/updateTokenConfigurationBuilder.ts +0 -50
  658. package/src/client/builders/updateTokenMetadataBuilder.ts +0 -24
  659. package/src/client/builders/updateYieldingBankConfigBuilder.ts +0 -32
  660. package/src/client/builders/utils.ts +0 -26
  661. package/src/client/client.ts +0 -264
  662. package/src/client/externalLiquidityResolver.ts +0 -54
  663. package/src/client/index.ts +0 -20
  664. package/src/client/lendingPlatformClients.ts +0 -50
  665. package/src/client/pda.ts +0 -102
  666. package/src/client/plans/collectInterest.ts +0 -207
  667. package/src/client/plans/decreaseCarryPosition.ts +0 -226
  668. package/src/client/routes/collectInterest.ts +0 -56
  669. package/src/client/transaction.ts +0 -106
  670. package/src/client/types/builders.ts +0 -19
  671. package/src/client/types/enums.ts +0 -47
  672. package/src/client/types/general.ts +0 -117
  673. package/src/client/types/index.ts +0 -6
  674. package/src/client/types/ix.ts +0 -452
  675. package/src/client/types/planTypes/collectInterest.ts +0 -97
  676. package/src/client/types/planTypes/common.ts +0 -31
  677. package/src/client/types/planTypes/decreaseCarryPosition.ts +0 -134
  678. package/src/client/types/planTypes/index.ts +0 -3
  679. package/src/client/types/tx.ts +0 -409
  680. package/src/constants/configs/allocations.ts +0 -30
  681. package/src/constants/configs/carryTradePresets.ts +0 -164
  682. package/src/constants/configs/index.ts +0 -2
  683. package/src/constants/general.ts +0 -141
  684. package/src/constants/index.ts +0 -3
  685. package/src/constants/lycTokenMetadata.ts +0 -52
  686. package/src/decoders/decodeTransaction.ts +0 -319
  687. package/src/decoders/discriminators.ts +0 -10
  688. package/src/decoders/idlAccounts.ts +0 -75
  689. package/src/decoders/index.ts +0 -15
  690. package/src/decoders/innerCpis.ts +0 -262
  691. package/src/decoders/lycInstructionNames.ts +0 -73
  692. package/src/decoders/programIds.ts +0 -12
  693. package/src/decoders/solana.ts +0 -25
  694. package/src/decoders/transactionPayload.ts +0 -41
  695. package/src/decoders/types.ts +0 -60
  696. package/src/errors.ts +0 -195
  697. package/src/idl/long_yield_carry.ts +0 -14648
  698. package/src/index.ts +0 -10
  699. package/src/metrics/index.ts +0 -1
  700. package/src/metrics/protocolMetrics.ts +0 -976
  701. package/src/models/index.ts +0 -9
  702. package/src/models/lycToken.ts +0 -380
  703. package/src/models/yieldingBank.ts +0 -127
  704. package/src/services/allocation/allocationService.ts +0 -823
  705. package/src/services/allocation/index.ts +0 -2
  706. package/src/services/allocation/types.ts +0 -27
  707. package/src/services/carry/carryAllocationConfig.ts +0 -266
  708. package/src/services/carry/index.ts +0 -2
  709. package/src/services/carry/lycLendingPositionManager.ts +0 -167
  710. package/src/services/index.ts +0 -5
  711. package/src/services/lendingPosition/index.ts +0 -5
  712. package/src/services/lendingPosition/lendingPositionService.ts +0 -328
  713. package/src/services/rebalance/index.ts +0 -2
  714. package/src/services/rebalance/token/index.ts +0 -1
  715. package/src/services/rebalance/token/tokenRebalanceService.ts +0 -142
  716. package/src/services/rebalance/yieldingBank/index.ts +0 -3
  717. package/src/services/rebalance/yieldingBank/planner.ts +0 -215
  718. package/src/services/rebalance/yieldingBank/strategy.ts +0 -41
  719. package/src/services/rebalance/yieldingBank/types.ts +0 -41
  720. package/src/services/redemption/index.ts +0 -9
  721. package/src/services/redemption/redemptionService.ts +0 -758
  722. package/src/types/enriched.ts +0 -187
  723. package/src/types/index.ts +0 -1
  724. package/src/utils/cache.ts +0 -12
  725. package/src/utils/data.ts +0 -65
  726. package/src/utils/enrichment.ts +0 -330
  727. package/src/utils/feeDripMetrics.ts +0 -146
  728. package/src/utils/general.ts +0 -54
  729. package/src/utils/index.ts +0 -13
  730. package/src/utils/ix.ts +0 -227
  731. package/src/utils/lendingPosition.ts +0 -221
  732. package/src/utils/lookupTables.ts +0 -309
  733. package/src/utils/lycData.ts +0 -321
  734. package/src/utils/timelock.ts +0 -63
  735. package/src/utils/tokenFeeMath.ts +0 -25
  736. package/src/utils/transactions.ts +0 -109
  737. package/src/utils/yieldingBank.ts +0 -38
  738. package/tsconfig.json +0 -11
package/src/client/pda.ts DELETED
@@ -1,102 +0,0 @@
1
- import {
2
- type Address,
3
- type ProgramDerivedAddressBump,
4
- getAddressEncoder,
5
- getProgramDerivedAddress,
6
- } from "@solana/kit";
7
-
8
- const addressEncoder = getAddressEncoder();
9
-
10
- function u64LeBytes(value: bigint | number): Uint8Array {
11
- const bytes = new Uint8Array(8);
12
- const view = new DataView(bytes.buffer);
13
- view.setBigUint64(0, BigInt(value), true);
14
- return bytes;
15
- }
16
-
17
- /**
18
- * PDA derivation for the long_yield_carry program.
19
- *
20
- * The program ID is injected via constructor — no global state.
21
- */
22
- export class PdaClient {
23
- constructor(private readonly programAddress: Address) {}
24
-
25
- /**
26
- * Derives the Token PDA for a given mint and ID.
27
- *
28
- * Seeds: ["TOKEN", mint_pubkey, id]
29
- *
30
- * @param mintAddress - The yToken mint address
31
- * @param id - The token ID (u8)
32
- * @returns Tuple of [PDA address, bump seed]
33
- */
34
- async deriveTokenPda(
35
- mintAddress: Address,
36
- id: number
37
- ): Promise<readonly [Address, ProgramDerivedAddressBump]> {
38
- return await getProgramDerivedAddress({
39
- programAddress: this.programAddress,
40
- seeds: [Buffer.from("TOKEN"), addressEncoder.encode(mintAddress), new Uint8Array([id])],
41
- });
42
- }
43
-
44
- /**
45
- * Derives the YieldingBank PDA for a given base mint and yielding ID.
46
- *
47
- * Seeds: ["YIELDING_BANK", base_mint_pubkey, id_le_bytes]
48
- *
49
- * @param baseMint - The base mint address
50
- * @param yieldingId - The yielding bank ID (u8)
51
- * @returns Tuple of [PDA address, bump seed]
52
- */
53
- async deriveYieldingBankPda(
54
- baseMint: Address,
55
- yieldingId: number
56
- ): Promise<readonly [Address, ProgramDerivedAddressBump]> {
57
- return await getProgramDerivedAddress({
58
- programAddress: this.programAddress,
59
- seeds: [
60
- Buffer.from("YIELDING_BANK"),
61
- addressEncoder.encode(baseMint),
62
- new Uint8Array([yieldingId]),
63
- ],
64
- });
65
- }
66
-
67
- async deriveRedemptionEpochPda(
68
- token: Address,
69
- epochId: bigint | number
70
- ): Promise<readonly [Address, ProgramDerivedAddressBump]> {
71
- return await getProgramDerivedAddress({
72
- programAddress: this.programAddress,
73
- seeds: [Buffer.from("REDEMPTION_EPOCH"), addressEncoder.encode(token), u64LeBytes(epochId)],
74
- });
75
- }
76
-
77
- async deriveAsyncBurnRequestPda(
78
- token: Address,
79
- epochId: bigint | number,
80
- sequence: bigint | number
81
- ): Promise<readonly [Address, ProgramDerivedAddressBump]> {
82
- return await getProgramDerivedAddress({
83
- programAddress: this.programAddress,
84
- seeds: [
85
- Buffer.from("ASYNC_BURN_REQUEST"),
86
- addressEncoder.encode(token),
87
- u64LeBytes(epochId),
88
- u64LeBytes(sequence),
89
- ],
90
- });
91
- }
92
-
93
- async deriveCpiPlanPda(
94
- uniqueId: Address,
95
- createdTs: bigint | number
96
- ): Promise<readonly [Address, ProgramDerivedAddressBump]> {
97
- return await getProgramDerivedAddress({
98
- programAddress: this.programAddress,
99
- seeds: [Buffer.from("cpi plan"), addressEncoder.encode(uniqueId), u64LeBytes(createdTs)],
100
- });
101
- }
102
- }
@@ -1,207 +0,0 @@
1
- import { BN } from "@anchor-lang/core";
2
- import type { Address } from "@solana/kit";
3
- import { PublicKey } from "@solana/web3.js";
4
- import {
5
- bnFromBigInt,
6
- calculateTvlUsd,
7
- fromUiAmount,
8
- fromWeb3Pk,
9
- resolveTokenProgram,
10
- toBigInt,
11
- tvlUsdToBaseUnits,
12
- } from "common";
13
- import type { AccountClient } from "../account";
14
- import type { CollectInterestPlan, CollectInterestPlanParams } from "../types";
15
- import { NoInterestToCollectError } from "../../errors";
16
- import { collectableNetYieldUsd } from "../../utils/tokenFeeMath";
17
-
18
- /**
19
- * Ensures the planner produced at least one positive redemption leg. Without this,
20
- * routing would fail or build an empty CPI list even though share math passed.
21
- */
22
- export function assertCollectInterestPlanHasPositiveRedemptions(plan: CollectInterestPlan): void {
23
- const hasPositive = plan.holdingsToRedeem.some((h) => h.amount.gt(new BN(0)));
24
- if (!hasPositive) {
25
- throw new NoInterestToCollectError("No redeemable yielding bank assets — nothing to collect");
26
- }
27
- }
28
-
29
- /**
30
- * Derive deterministic collect-interest values from fresh token and bank state.
31
- * This intentionally excludes route / venue selection.
32
- *
33
- * @param account - Account client used to fetch fresh token and yielding-bank state.
34
- * @param token - Token PDA whose carry position should collect accrued interest.
35
- * @param params - Yielding bank to redeem from.
36
- * @returns Deterministic collect-interest plan without swap routing attached.
37
- *
38
- * @throws {NoInterestToCollectError} When carry/debt math rules out collection.
39
- *
40
- * Before swap routing, run `assertCollectInterestPlanHasPositiveRedemptions` on the
41
- * returned plan (the `getCollectInterestTx` transaction builder does this) so rounding
42
- * cannot yield an empty redemption list.
43
- */
44
- export async function buildCollectInterestPlan(
45
- account: AccountClient,
46
- token: Address,
47
- params: CollectInterestPlanParams
48
- ): Promise<CollectInterestPlan> {
49
- const [tokenData, bank] = await Promise.all([
50
- account.fetchToken(token),
51
- account.fetchYieldingBank(params.yieldingBank),
52
- ]);
53
-
54
- const carryIndex = tokenData.data.debtCarry.findIndex(
55
- (carry) =>
56
- !carry.yieldingBaseMint.equals(PublicKey.default) &&
57
- fromWeb3Pk(carry.yieldingBaseMint) === bank.baseMint &&
58
- carry.yieldingBankId === bank.id &&
59
- toBigInt(carry.shares) > BigInt(0)
60
- );
61
-
62
- if (carryIndex === -1) {
63
- throw new NoInterestToCollectError(
64
- `No active carry position found for yielding bank ${params.yieldingBank}`
65
- );
66
- }
67
-
68
- const carry = tokenData.data.debtCarry[carryIndex];
69
- const totalCarryTvl = tokenData.totalCarryTvlUsd;
70
- const totalDebtUsd = tokenData.totalLendingDebtTvlUsd;
71
- const totalShares = toBigInt(bank.data.accounting.totalShares);
72
- const tvlBefore = toBigInt(bank.data.accounting.tvl);
73
- const carryShares = toBigInt(carry.shares);
74
-
75
- if (!tokenData.hasInterestToCollect()) {
76
- throw new NoInterestToCollectError(
77
- "Token is inactive, carry surplus is absent, or surplus exceeds the 1 bp collection limit"
78
- );
79
- }
80
- if (totalShares <= BigInt(0)) {
81
- throw new NoInterestToCollectError("Yielding bank has no outstanding shares");
82
- }
83
- if (tvlBefore <= BigInt(0)) {
84
- throw new NoInterestToCollectError("Yielding bank has zero TVL — nothing to collect");
85
- }
86
-
87
- // Only redeem from the default redemption mint — the on-chain instruction
88
- // enforces this by validating the yb_redemption_token_account ATA.
89
- const redemptionMint = bank.defaultRedemptionMint;
90
- const redemptionHolding = bank.findAssetHolding(redemptionMint);
91
- if (!redemptionHolding) {
92
- throw new NoInterestToCollectError(
93
- `Default redemption mint ${redemptionMint} has no active asset holding on the yielding bank`
94
- );
95
- }
96
- const redemptionOracle = fromWeb3Pk(redemptionHolding.oracle);
97
- const redemptionTokenProgram = resolveTokenProgram(redemptionHolding.tokenProgram);
98
-
99
- // Use the redemption holding's cached on-chain price rather than a freshly
100
- // fetched live price. The handler re-reads the same on-chain oracle account
101
- // we cached from the previous refresh_yielding_bank, so using the cached
102
- // value here lets the SDK predict the handler's `redemption_sold_tvl`
103
- // exactly. (An independently-fetched Hermes/live price drifts by a few
104
- // fixed-point units from the on-chain account, which previously caused
105
- // strict-equality test assertions and the share_price invariant check to
106
- // fail on rebalanced banks.)
107
- const redemptionPrice = toBigInt(redemptionHolding.price);
108
- const redemptionDecimals = redemptionHolding.decimals;
109
- const redemptionHoldingAmount = toBigInt(redemptionHolding.amount);
110
- if (redemptionPrice <= BigInt(0)) {
111
- throw new NoInterestToCollectError(
112
- `Redemption mint ${redemptionMint} has no cached price — refresh the yielding bank first`
113
- );
114
- }
115
-
116
- // Collectable yield is the full carry surplus above debt — must match the on-chain cap.
117
- const netYieldUsd = collectableNetYieldUsd(totalCarryTvl, totalDebtUsd);
118
-
119
- if (params.minYieldUsd !== undefined && params.minYieldUsd > 0) {
120
- const minYield8Dec = toBigInt(fromUiAmount(params.minYieldUsd, 8));
121
- if (netYieldUsd < minYield8Dec) {
122
- throw new NoInterestToCollectError(
123
- `Net yield $${(Number(netYieldUsd) / 1e8).toFixed(4)} is below minimum $${
124
- params.minYieldUsd
125
- }`
126
- );
127
- }
128
- }
129
-
130
- // Target shares to burn: capped at this carry position's balance because a
131
- // single call cannot drain more than this bank's own carry (the handler
132
- // enforces the same cap against `carry.shares`).
133
- //
134
- // Use the same `totalShares / tvl` ratio as the handler's final derivation
135
- // to keep a single truncation across all share-math steps.
136
- const unboundedSharesToBurn = (netYieldUsd * totalShares) / tvlBefore;
137
- const targetSharesToBurn =
138
- unboundedSharesToBurn < carryShares ? unboundedSharesToBurn : carryShares;
139
- if (targetSharesToBurn <= BigInt(0)) {
140
- throw new NoInterestToCollectError(
141
- "Computed shares to burn is zero — yield too small to collect"
142
- );
143
- }
144
-
145
- // USD value we want the swap to liquidate from the redemption mint. Convert
146
- // to raw token units at the cached redemption price to size the swap input.
147
- const targetRedemptionTvlUsd = (targetSharesToBurn * tvlBefore) / totalShares;
148
- const redemptionAmount = tvlUsdToBaseUnits(
149
- targetRedemptionTvlUsd,
150
- redemptionPrice,
151
- redemptionDecimals
152
- );
153
-
154
- if (redemptionAmount > redemptionHoldingAmount) {
155
- throw new NoInterestToCollectError(
156
- `Redemption mint ${redemptionMint} holding (${redemptionHoldingAmount}) is insufficient ` +
157
- `to cover yield redemption (${redemptionAmount}) — rebalance the yielding bank first`
158
- );
159
- }
160
-
161
- // Predict the handler's phase 6 derivation exactly (same integer-truncation
162
- // order): first recompute the *actual* USD value the handler will see from
163
- // the sized `redemptionAmount`, then apply the invariant formula
164
- // `shares_to_burn = redemption_sold_tvl × total_shares_before / tvl_before`.
165
- // The handler uses `total_shares / tvl` rather than `bank_scale /
166
- // share_price` to avoid double truncation — mirror that here.
167
- const sharesBurnedValueUsd = calculateTvlUsd(
168
- redemptionAmount,
169
- redemptionPrice,
170
- redemptionDecimals
171
- );
172
- const sharesToBurn = (sharesBurnedValueUsd * totalShares) / tvlBefore;
173
- if (sharesToBurn <= BigInt(0)) {
174
- throw new NoInterestToCollectError(
175
- "Predicted shares to burn is zero — redemption amount rounds down below one share"
176
- );
177
- }
178
-
179
- const holdingsToRedeem: CollectInterestPlan["holdingsToRedeem"] = [];
180
- if (redemptionAmount > BigInt(0)) {
181
- holdingsToRedeem.push({
182
- mint: redemptionMint,
183
- amount: bnFromBigInt(redemptionAmount),
184
- isBaseAsset: redemptionMint === bank.baseMint,
185
- });
186
- }
187
-
188
- return {
189
- token,
190
- yieldingBank: params.yieldingBank,
191
- baseMint: bank.baseMint,
192
- redemption: {
193
- mint: redemptionMint,
194
- tokenProgram: redemptionTokenProgram,
195
- oracle: redemptionOracle,
196
- },
197
- collateral: {
198
- mint: fromWeb3Pk(tokenData.data.collateral.mint),
199
- tokenProgram: resolveTokenProgram(tokenData.data.collateral.tokenProgram),
200
- oracle: fromWeb3Pk(tokenData.data.collateral.oracle),
201
- },
202
- carryIndex,
203
- sharesToBurn: bnFromBigInt(sharesToBurn),
204
- sharesBurnedValueUsd: bnFromBigInt(sharesBurnedValueUsd),
205
- holdingsToRedeem,
206
- };
207
- }
@@ -1,226 +0,0 @@
1
- import type { Address } from "@solana/kit";
2
- import { BN } from "@anchor-lang/core";
3
- import { fromUiAmount, fromWeb3Pk, type SwapClient } from "common";
4
- import type { LendingPlatformData, ReserveBase } from "lending-platforms";
5
- import { LeverageService, type LeverageSwapContext } from "lending-platforms";
6
- import type { TokenLendingPositionData } from "../../models/lycToken";
7
- import type { LYCYieldingBank } from "../../models/yieldingBank";
8
- import { LycLendingPositionManager } from "../../services/carry";
9
- import type { AccountClient } from "../account";
10
- import type {
11
- DecreaseCarryPositionBuilderParams,
12
- DecreaseCarryPositionPlan,
13
- DecreaseCarryRepaySteering,
14
- } from "../types";
15
-
16
- /**
17
- * Build the execution plan for `decrease_carry_position`.
18
- *
19
- * LYC-specific concerns (permissionless operation handling, steering-based target
20
- * resolution) live here. Sizing, repay CPI construction, and swap assembly are
21
- * delegated to the generic {@link LeverageService} from `lending-platforms`.
22
- */
23
- export async function buildDecreaseCarryPositionPlan(
24
- account: AccountClient,
25
- swap: SwapClient,
26
- signer: Address,
27
- token: Address,
28
- params: DecreaseCarryPositionBuilderParams
29
- ): Promise<DecreaseCarryPositionPlan> {
30
- const tokenData = await account.fetchToken(token);
31
- const position = tokenData.data.lendingPositions[params.lendingPositionIndex];
32
- const debtMint = fromWeb3Pk(position.accounting.debt.mint);
33
-
34
- const initialAccounts = await account.getCarryTradeAccounts(
35
- token,
36
- params.yieldingBank,
37
- params.lendingPositionIndex
38
- );
39
-
40
- if (params.permissionlessOperation && params.sourceMint !== undefined) {
41
- throw new Error(
42
- "DecreaseCarryPositionBuilderParams: sourceMint must not be set when permissionlessOperation is true"
43
- );
44
- }
45
-
46
- params.lendingIx.clearCacheEntry(
47
- params.lendingIx.data.userAccountCatKey,
48
- fromWeb3Pk(position.protocolUserAcc)
49
- );
50
- const manager = await LycLendingPositionManager.create(
51
- params.lendingIx.data,
52
- position,
53
- params.environment
54
- );
55
-
56
- const { targetUtilizationBps, passTargetUtilizationOnChain } =
57
- await resolveRepaySteeringUtilization(manager, position, params.repaySteering);
58
-
59
- const bank = await account.fetchYieldingBank(params.yieldingBank);
60
- const { swapContext, sourceAssetHoldingIndex, needsSwapPath } = resolveSwapContext(
61
- swap,
62
- signer,
63
- params,
64
- bank,
65
- debtMint
66
- );
67
-
68
- const { supplyReserve, debtReserve } = manager.reservesManager;
69
- const positionState = await manager.getLendingPositionAmounts();
70
- const txId = params.txId ?? `decrease-carry-${Date.now()}-${position.protocolUserAcc.toBase58()}`;
71
-
72
- const isFullDeleverage =
73
- params.repaySteering?.mode === "explicitTargetUtilization" &&
74
- params.repaySteering.targetUtilizationRateBps === 0;
75
-
76
- const repayBaseUnitsOverride = isFullDeleverage
77
- ? await resolveFullDeleverageRepayBaseUnits(
78
- params.lendingIx.data,
79
- position,
80
- debtReserve,
81
- manager
82
- )
83
- : undefined;
84
-
85
- const leverageResult = await LeverageService.buildDecreaseLeverage(
86
- {
87
- lendingIx: params.lendingIx,
88
- supplyReserve,
89
- debtReserve,
90
- user: token,
91
- payer: signer,
92
- pool: fromWeb3Pk(position.pool),
93
- userAccount: fromWeb3Pk(position.protocolUserAcc),
94
- txId,
95
- environment: params.environment,
96
- },
97
- {
98
- currentSupplyUiAmount: positionState.supplyUiAmount,
99
- currentDebtUiAmount: positionState.debtUiAmount,
100
- targetUtilizationRateBps: targetUtilizationBps,
101
- swapContext,
102
- repayBaseUnitsOverride,
103
- }
104
- );
105
-
106
- return {
107
- lendingPositionIndex: params.lendingPositionIndex,
108
- repayAmount: leverageResult.repayBaseUnits,
109
- preInstructions: leverageResult.preInstructions,
110
- initialAccounts,
111
- cpiDataGroups: leverageResult.cpiDataGroups,
112
- ...(leverageResult.prerequisiteCpis.length
113
- ? { tokenPrerequisiteCpis: leverageResult.prerequisiteCpis }
114
- : {}),
115
- ...(passTargetUtilizationOnChain ? { targetUtilizationRateBps: targetUtilizationBps } : {}),
116
- yieldingBank: params.yieldingBank,
117
- ...(needsSwapPath && sourceAssetHoldingIndex != null ? { sourceAssetHoldingIndex } : {}),
118
- };
119
- }
120
-
121
- /**
122
- * Sizes a full repay from the refreshed Kamino obligation borrow (+ buffer), not
123
- * stale token accounting, so the SPL transfer and repay CPI stay in sync.
124
- */
125
- async function resolveFullDeleverageRepayBaseUnits(
126
- lpData: LendingPlatformData,
127
- position: TokenLendingPositionData,
128
- debtReserve: ReserveBase,
129
- manager: LycLendingPositionManager
130
- ): Promise<BN> {
131
- const pool = fromWeb3Pk(position.pool);
132
- const userAccount = fromWeb3Pk(position.protocolUserAcc);
133
- const obligation = await lpData.maybeFetchUserPositionInPool(pool, userAccount);
134
- const borrow = obligation?.borrows.find((entry) => entry.reserve === debtReserve.address);
135
-
136
- const fallbackUi = (await manager.getLendingPositionAmounts()).debtUiAmount;
137
- const fallbackBaseUnits = fromUiAmount(fallbackUi, debtReserve.mint.mintDecimals);
138
- if (!borrow) {
139
- return fallbackBaseUnits;
140
- }
141
-
142
- // Kamino obligation debt can exceed stale token accounting by accrued interest
143
- // (often 1 base unit on tiny positions). Size the SPL transfer and repay CPI
144
- // from the refreshed obligation borrow, not the token snapshot alone.
145
- return borrow.amount.gt(fallbackBaseUnits) ? borrow.amount : fallbackBaseUnits;
146
- }
147
-
148
- /**
149
- * Resolves the utilization target (bps) for leverage sizing and whether that same
150
- * bps should appear on-chain as `targetUtilizationRateBps` for manager post-repay checks.
151
- */
152
- async function resolveRepaySteeringUtilization(
153
- manager: LycLendingPositionManager,
154
- position: TokenLendingPositionData,
155
- steering?: DecreaseCarryRepaySteering
156
- ) {
157
- if (!steering) {
158
- return {
159
- targetUtilizationBps: position.config.targetUtilizationRateBps,
160
- passTargetUtilizationOnChain: false,
161
- };
162
- }
163
-
164
- switch (steering.mode) {
165
- case "collateralWithdrawal": {
166
- const postWithdrawalTargetUtilizationRateBps =
167
- steering.postWithdrawalTargetUtilizationRateBps ?? position.config.targetUtilizationRateBps;
168
- const targetUtilizationBps = await manager.calcPreWithdrawalTargetUtilizationRateBps(
169
- steering.collateralWithdrawalUiAmount,
170
- postWithdrawalTargetUtilizationRateBps
171
- );
172
- return {
173
- targetUtilizationBps,
174
- passTargetUtilizationOnChain: steering.allowBelowTargetOnChain === true,
175
- };
176
- }
177
- case "explicitTargetUtilization":
178
- return {
179
- targetUtilizationBps: steering.targetUtilizationRateBps,
180
- passTargetUtilizationOnChain: true,
181
- };
182
- default: {
183
- throw new Error(`Unexpected repaySteering: ${JSON.stringify(steering)}`);
184
- }
185
- }
186
- }
187
-
188
- /**
189
- * Swap context when the yielding bank's source asset differs from the debt mint.
190
- */
191
- function resolveSwapContext(
192
- swap: SwapClient,
193
- signer: Address,
194
- params: DecreaseCarryPositionBuilderParams,
195
- bank: LYCYieldingBank,
196
- debtMint: Address
197
- ): {
198
- swapContext: LeverageSwapContext | undefined;
199
- sourceAssetHoldingIndex: number | null;
200
- needsSwapPath: boolean;
201
- } {
202
- const sourceMint = params.sourceMint ?? bank.defaultRedemptionMint;
203
- const sourceAssetHoldingIndex = bank.findAssetHoldingIndex(sourceMint);
204
- const needsSwapPath = sourceAssetHoldingIndex != null && sourceMint !== debtMint;
205
-
206
- if (!needsSwapPath) {
207
- return { swapContext: undefined, sourceAssetHoldingIndex, needsSwapPath };
208
- }
209
-
210
- const sourceHolding = bank.findAssetHolding(sourceMint);
211
-
212
- return {
213
- swapContext: {
214
- swap,
215
- sourceMint,
216
- debtMint,
217
- sourceBalanceBaseUnits: sourceHolding ? BigInt(sourceHolding.amount.toString()) : 0n,
218
- swapTarget: params.yieldingBank,
219
- payer: signer,
220
- slippageBps: params.swapSlippageBps,
221
- excludeDexes: params.swapExcludeDexes,
222
- },
223
- sourceAssetHoldingIndex,
224
- needsSwapPath,
225
- };
226
- }
@@ -1,56 +0,0 @@
1
- import { BN } from "@anchor-lang/core";
2
- import type { Address } from "@solana/kit";
3
- import type { CpiData, SwapClient } from "common";
4
- import { toSafeNumber } from "common";
5
- import type {
6
- CollectInterestExecutionPlan,
7
- CollectInterestPlan,
8
- CollectInterestRouteBuilderParams,
9
- } from "../types";
10
- import { NoInterestToCollectError } from "../../errors";
11
-
12
- /**
13
- * Convert a deterministic collect-interest plan into ordered CPI data.
14
- * Venue selection and slippage policy live here.
15
- *
16
- * @param swapClient - Swap client used for all intermediate and final swaps.
17
- * @param plan - Deterministic collect-interest plan returned by the planner layer.
18
- * @param params - Optional routing policy such as output mint and slippage.
19
- * @returns Executable collect-interest plan with ordered CPI data.
20
- */
21
- export async function buildCollectInterestRoutePlan(
22
- swapClient: SwapClient,
23
- plan: CollectInterestPlan,
24
- params: CollectInterestRouteBuilderParams = {},
25
- payer?: Address
26
- ): Promise<CollectInterestExecutionPlan> {
27
- const outputMint = params.outputMint ?? plan.collateral.mint;
28
- const slippageBps = params.slippageBps ?? 100;
29
- const cpiData: CpiData[] = [];
30
-
31
- const holding = plan.holdingsToRedeem[0];
32
- if (!holding || holding.amount.lte(new BN(0))) {
33
- throw new NoInterestToCollectError("Expected positive redeemable yielding bank assets");
34
- }
35
-
36
- // Single swap: redemption mint → output mint (collateral or caller override).
37
- const quote = await swapClient.getQuote({
38
- inputMint: holding.mint,
39
- outputMint,
40
- amount: toSafeNumber(holding.amount, "collect_interest swap amount"),
41
- slippageBps,
42
- });
43
- const swapCpi = await swapClient.getSwapCpiData(
44
- quote,
45
- plan.yieldingBank,
46
- payer ? { payer } : undefined
47
- );
48
- cpiData.push(swapCpi);
49
-
50
- return {
51
- ...plan,
52
- preInstructions: swapCpi.preInstructions ?? [],
53
- initialAccounts: [],
54
- cpiData,
55
- };
56
- }
@@ -1,106 +0,0 @@
1
- import type { TransactionPlan as BaseTransactionPlan } from "common";
2
- import type { LongYieldCarryBuilderContext } from "./types/builders";
3
- import {
4
- BurnTokenBuilder,
5
- ClaimIncentivesBuilder,
6
- CollectFeesBuilder,
7
- CollectInterestBuilder,
8
- CreditUnlentToRedemptionEpochBuilder,
9
- CreateCpiPlanBuilder,
10
- CreateTokenBuilder,
11
- CreateTokenLendingPositionBuilder,
12
- CreateYieldingBankAllocationBuilder,
13
- CreateYieldingBankBuilder,
14
- DecreaseCarryPositionBuilder,
15
- DepositUnlentCollateralBuilder,
16
- IncreaseCarryPositionBuilder,
17
- MintTokenBuilder,
18
- RebalanceTokenBuilder,
19
- RebalanceYieldingBankBuilder,
20
- RecollateralizeLossBuilder,
21
- RefreshTokenStateBuilder,
22
- RefreshTokensBuilder,
23
- RefreshYieldingBankBuilder,
24
- ProcessAsyncBurnBuilder,
25
- ResetTokenBurnRateLimitBuilder,
26
- SetRedemptionEpochStatusBuilder,
27
- SetTokenCircuitBreakerBuilder,
28
- SetYieldingBankCircuitBreakerBuilder,
29
- UpdateLendingPositionConfigBuilder,
30
- UpdateTokenConfigurationBuilder,
31
- UpdateTokenMetadataBuilder,
32
- UpdateYieldingBankConfigBuilder,
33
- TopUpUnlentReservesBuilder,
34
- } from "./builders";
35
- import type { LongYieldCarryTransactionPlan } from "./types";
36
-
37
- export * from "./builders";
38
-
39
- export class TransactionClient {
40
- readonly burnToken: BurnTokenBuilder;
41
- readonly claimIncentives: ClaimIncentivesBuilder;
42
- readonly collectFees: CollectFeesBuilder;
43
- readonly collectInterest: CollectInterestBuilder;
44
- readonly creditUnlentToRedemptionEpoch: CreditUnlentToRedemptionEpochBuilder;
45
- readonly createCpiPlan: CreateCpiPlanBuilder;
46
- readonly createToken: CreateTokenBuilder;
47
- readonly createTokenLendingPosition: CreateTokenLendingPositionBuilder;
48
- readonly createYieldingBank: CreateYieldingBankBuilder;
49
- readonly createYieldingBankAllocation: CreateYieldingBankAllocationBuilder;
50
- readonly decreaseCarryPosition: DecreaseCarryPositionBuilder;
51
- readonly depositUnlentCollateral: DepositUnlentCollateralBuilder;
52
- readonly increaseCarryPosition: IncreaseCarryPositionBuilder;
53
- readonly mintToken: MintTokenBuilder;
54
- readonly rebalanceToken: RebalanceTokenBuilder;
55
- readonly rebalanceYieldingBank: RebalanceYieldingBankBuilder;
56
- readonly recollateralizeLoss: RecollateralizeLossBuilder;
57
- readonly refreshTokenState: RefreshTokenStateBuilder;
58
- readonly refreshTokens: RefreshTokensBuilder;
59
- readonly refreshYieldingBank: RefreshYieldingBankBuilder;
60
- readonly processAsyncBurn: ProcessAsyncBurnBuilder;
61
- readonly resetTokenBurnRateLimit: ResetTokenBurnRateLimitBuilder;
62
- readonly setRedemptionEpochStatus: SetRedemptionEpochStatusBuilder;
63
- readonly setTokenCircuitBreaker: SetTokenCircuitBreakerBuilder;
64
- readonly setYieldingBankCircuitBreaker: SetYieldingBankCircuitBreakerBuilder;
65
- readonly updateLendingPositionConfig: UpdateLendingPositionConfigBuilder;
66
- readonly updateTokenConfiguration: UpdateTokenConfigurationBuilder;
67
- readonly updateTokenMetadata: UpdateTokenMetadataBuilder;
68
- readonly updateYieldingBankConfig: UpdateYieldingBankConfigBuilder;
69
- readonly topUpUnlentReserves: TopUpUnlentReservesBuilder;
70
-
71
- constructor(readonly context: LongYieldCarryBuilderContext) {
72
- this.burnToken = new BurnTokenBuilder(context);
73
- this.claimIncentives = new ClaimIncentivesBuilder(context);
74
- this.collectFees = new CollectFeesBuilder(context);
75
- this.collectInterest = new CollectInterestBuilder(context);
76
- this.creditUnlentToRedemptionEpoch = new CreditUnlentToRedemptionEpochBuilder(context);
77
- this.createCpiPlan = new CreateCpiPlanBuilder(context);
78
- this.createToken = new CreateTokenBuilder(context);
79
- this.createTokenLendingPosition = new CreateTokenLendingPositionBuilder(context);
80
- this.createYieldingBank = new CreateYieldingBankBuilder(context);
81
- this.createYieldingBankAllocation = new CreateYieldingBankAllocationBuilder(context);
82
- this.decreaseCarryPosition = new DecreaseCarryPositionBuilder(context);
83
- this.depositUnlentCollateral = new DepositUnlentCollateralBuilder(context);
84
- this.increaseCarryPosition = new IncreaseCarryPositionBuilder(context);
85
- this.mintToken = new MintTokenBuilder(context);
86
- this.rebalanceToken = new RebalanceTokenBuilder(context);
87
- this.rebalanceYieldingBank = new RebalanceYieldingBankBuilder(context);
88
- this.recollateralizeLoss = new RecollateralizeLossBuilder(context);
89
- this.refreshTokenState = new RefreshTokenStateBuilder(context);
90
- this.refreshTokens = new RefreshTokensBuilder(context);
91
- this.refreshYieldingBank = new RefreshYieldingBankBuilder(context);
92
- this.processAsyncBurn = new ProcessAsyncBurnBuilder(context);
93
- this.resetTokenBurnRateLimit = new ResetTokenBurnRateLimitBuilder(context);
94
- this.setRedemptionEpochStatus = new SetRedemptionEpochStatusBuilder(context);
95
- this.setTokenCircuitBreaker = new SetTokenCircuitBreakerBuilder(context);
96
- this.setYieldingBankCircuitBreaker = new SetYieldingBankCircuitBreakerBuilder(context);
97
- this.updateLendingPositionConfig = new UpdateLendingPositionConfigBuilder(context);
98
- this.updateTokenConfiguration = new UpdateTokenConfigurationBuilder(context);
99
- this.updateTokenMetadata = new UpdateTokenMetadataBuilder(context);
100
- this.updateYieldingBankConfig = new UpdateYieldingBankConfigBuilder(context);
101
- this.topUpUnlentReserves = new TopUpUnlentReservesBuilder(context);
102
- }
103
- }
104
-
105
- export type TransactionBuilder = TransactionClient[keyof TransactionClient];
106
- export type CompositeTransactionPlan = BaseTransactionPlan | LongYieldCarryTransactionPlan;