@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.
- package/.env.example +11 -0
- package/README.md +207 -0
- package/dist/sdks/long-yield-carry/scripts/asyncBurn.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/asyncBurn.js +117 -0
- package/dist/sdks/long-yield-carry/scripts/burnToken.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/burnToken.js +98 -0
- package/dist/sdks/long-yield-carry/scripts/claimIncentives.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/claimIncentives.js +108 -0
- package/dist/sdks/long-yield-carry/scripts/closeCpiPlans.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/closeCpiPlans.js +93 -0
- package/dist/sdks/long-yield-carry/scripts/collectInterest.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/collectInterest.js +164 -0
- package/dist/sdks/long-yield-carry/scripts/collectProtocolFees.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/collectProtocolFees.js +120 -0
- package/dist/sdks/long-yield-carry/scripts/computeOptimalAllocations.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/computeOptimalAllocations.js +84 -0
- package/dist/sdks/long-yield-carry/scripts/createToken.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/createToken.js +76 -0
- package/dist/sdks/long-yield-carry/scripts/createTokenLendingPosition.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/createTokenLendingPosition.js +157 -0
- package/dist/sdks/long-yield-carry/scripts/createYieldingBank.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/createYieldingBank.js +69 -0
- package/dist/sdks/long-yield-carry/scripts/decreaseCarryPositions.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/decreaseCarryPositions.js +247 -0
- package/dist/sdks/long-yield-carry/scripts/depositUnlentCollateral.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/depositUnlentCollateral.js +90 -0
- package/dist/sdks/long-yield-carry/scripts/emergency/deleverageAll.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/emergency/deleverageAll.js +202 -0
- package/dist/sdks/long-yield-carry/scripts/emergency/triggerCircuitBreaker.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/emergency/triggerCircuitBreaker.js +68 -0
- package/dist/sdks/long-yield-carry/scripts/env.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/env.js +8 -0
- package/dist/sdks/long-yield-carry/scripts/findTxs.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/findTxs.js +143 -0
- package/dist/sdks/long-yield-carry/scripts/increaseCarryPositions.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/increaseCarryPositions.js +112 -0
- package/dist/sdks/long-yield-carry/scripts/inspect/format.d.ts +13 -0
- package/dist/sdks/long-yield-carry/scripts/inspect/format.js +363 -0
- package/dist/sdks/long-yield-carry/scripts/inspect.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/inspect.js +108 -0
- package/dist/sdks/long-yield-carry/scripts/localUtils.d.ts +53 -0
- package/dist/sdks/long-yield-carry/scripts/localUtils.js +191 -0
- package/dist/sdks/long-yield-carry/scripts/mintToken.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/mintToken.js +103 -0
- package/dist/sdks/long-yield-carry/scripts/processAsyncBurns.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/processAsyncBurns.js +76 -0
- package/dist/sdks/long-yield-carry/scripts/rebalanceToken.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/rebalanceToken.js +210 -0
- package/dist/sdks/long-yield-carry/scripts/rebalanceYieldingBank.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/rebalanceYieldingBank.js +149 -0
- package/dist/sdks/long-yield-carry/scripts/recollateralizeLoss.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/recollateralizeLoss.js +64 -0
- package/dist/sdks/long-yield-carry/scripts/refresh.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/refresh.js +101 -0
- package/dist/sdks/long-yield-carry/scripts/updateFees.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/updateFees.js +369 -0
- package/dist/sdks/long-yield-carry/scripts/updateGeneralLut.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/updateGeneralLut.js +27 -0
- package/dist/sdks/long-yield-carry/scripts/updateLendingPositionConfig.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/updateLendingPositionConfig.js +127 -0
- package/dist/sdks/long-yield-carry/scripts/updateTokenLuts.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/updateTokenLuts.js +27 -0
- package/dist/sdks/long-yield-carry/scripts/updateTokenMetadata.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/updateTokenMetadata.js +194 -0
- package/dist/sdks/long-yield-carry/scripts/updateYieldingBankConfig.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/updateYieldingBankConfig.js +84 -0
- package/dist/sdks/long-yield-carry/scripts/withdrawUnlentCollateral.d.ts +1 -0
- package/dist/sdks/long-yield-carry/scripts/withdrawUnlentCollateral.js +140 -0
- package/dist/sdks/long-yield-carry/src/client/account.d.ts +152 -0
- package/dist/sdks/long-yield-carry/src/client/account.js +349 -0
- package/dist/sdks/long-yield-carry/src/client/builders/args.d.ts +299 -0
- package/dist/sdks/long-yield-carry/src/client/builders/args.js +2 -0
- package/dist/sdks/long-yield-carry/src/client/builders/asyncBurnBuilder.d.ts +20 -0
- package/dist/sdks/long-yield-carry/src/client/builders/asyncBurnBuilder.js +212 -0
- package/dist/sdks/long-yield-carry/src/client/builders/base.d.ts +77 -0
- package/dist/sdks/long-yield-carry/src/client/builders/base.js +191 -0
- package/dist/sdks/long-yield-carry/src/client/builders/burnTokenBuilder.d.ts +18 -0
- package/dist/sdks/long-yield-carry/src/client/builders/burnTokenBuilder.js +165 -0
- package/dist/sdks/long-yield-carry/src/client/builders/claimIncentivesBuilder.d.ts +9 -0
- package/dist/sdks/long-yield-carry/src/client/builders/claimIncentivesBuilder.js +135 -0
- package/dist/sdks/long-yield-carry/src/client/builders/collectFeesBuilder.d.ts +14 -0
- package/dist/sdks/long-yield-carry/src/client/builders/collectFeesBuilder.js +50 -0
- package/dist/sdks/long-yield-carry/src/client/builders/collectInterestBuilder.d.ts +8 -0
- package/dist/sdks/long-yield-carry/src/client/builders/collectInterestBuilder.js +86 -0
- package/dist/sdks/long-yield-carry/src/client/builders/createCpiPlanBuilder.d.ts +6 -0
- package/dist/sdks/long-yield-carry/src/client/builders/createCpiPlanBuilder.js +22 -0
- package/dist/sdks/long-yield-carry/src/client/builders/createTokenBuilder.d.ts +7 -0
- package/dist/sdks/long-yield-carry/src/client/builders/createTokenBuilder.js +64 -0
- package/dist/sdks/long-yield-carry/src/client/builders/createTokenLendingPositionBuilder.d.ts +10 -0
- package/dist/sdks/long-yield-carry/src/client/builders/createTokenLendingPositionBuilder.js +138 -0
- package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankAllocationBuilder.d.ts +7 -0
- package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankAllocationBuilder.js +29 -0
- package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankBuilder.d.ts +7 -0
- package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankBuilder.js +39 -0
- package/dist/sdks/long-yield-carry/src/client/builders/decreaseCarryPositionBuilder.d.ts +30 -0
- package/dist/sdks/long-yield-carry/src/client/builders/decreaseCarryPositionBuilder.js +99 -0
- package/dist/sdks/long-yield-carry/src/client/builders/depositUnlentCollateralBuilder.d.ts +8 -0
- package/dist/sdks/long-yield-carry/src/client/builders/depositUnlentCollateralBuilder.js +64 -0
- package/dist/sdks/long-yield-carry/src/client/builders/increaseCarryPositionBuilder.d.ts +8 -0
- package/dist/sdks/long-yield-carry/src/client/builders/increaseCarryPositionBuilder.js +73 -0
- package/dist/sdks/long-yield-carry/src/client/builders/index.d.ts +28 -0
- package/dist/sdks/long-yield-carry/src/client/builders/index.js +62 -0
- package/dist/sdks/long-yield-carry/src/client/builders/mintTokenBuilder.d.ts +8 -0
- package/dist/sdks/long-yield-carry/src/client/builders/mintTokenBuilder.js +95 -0
- package/dist/sdks/long-yield-carry/src/client/builders/rebalanceTokenBuilder.d.ts +11 -0
- package/dist/sdks/long-yield-carry/src/client/builders/rebalanceTokenBuilder.js +255 -0
- package/dist/sdks/long-yield-carry/src/client/builders/rebalanceYieldingBankBuilder.d.ts +8 -0
- package/dist/sdks/long-yield-carry/src/client/builders/rebalanceYieldingBankBuilder.js +75 -0
- package/dist/sdks/long-yield-carry/src/client/builders/recollateralizeLossBuilder.d.ts +12 -0
- package/dist/sdks/long-yield-carry/src/client/builders/recollateralizeLossBuilder.js +220 -0
- package/dist/sdks/long-yield-carry/src/client/builders/refreshTokenStateBuilder.d.ts +9 -0
- package/dist/sdks/long-yield-carry/src/client/builders/refreshTokenStateBuilder.js +112 -0
- package/dist/sdks/long-yield-carry/src/client/builders/refreshTokensBuilder.d.ts +9 -0
- package/dist/sdks/long-yield-carry/src/client/builders/refreshTokensBuilder.js +59 -0
- package/dist/sdks/long-yield-carry/src/client/builders/refreshYieldingBankBuilder.d.ts +8 -0
- package/dist/sdks/long-yield-carry/src/client/builders/refreshYieldingBankBuilder.js +29 -0
- package/dist/sdks/long-yield-carry/src/client/builders/resetTokenBurnRateLimitBuilder.d.ts +7 -0
- package/dist/sdks/long-yield-carry/src/client/builders/resetTokenBurnRateLimitBuilder.js +19 -0
- package/dist/sdks/long-yield-carry/src/client/builders/setTokenCircuitBreakerBuilder.d.ts +11 -0
- package/dist/sdks/long-yield-carry/src/client/builders/setTokenCircuitBreakerBuilder.js +31 -0
- package/dist/sdks/long-yield-carry/src/client/builders/setYieldingBankCircuitBreakerBuilder.d.ts +8 -0
- package/dist/sdks/long-yield-carry/src/client/builders/setYieldingBankCircuitBreakerBuilder.js +28 -0
- package/dist/sdks/long-yield-carry/src/client/builders/updateLendingPositionConfigBuilder.d.ts +10 -0
- package/dist/sdks/long-yield-carry/src/client/builders/updateLendingPositionConfigBuilder.js +30 -0
- package/dist/sdks/long-yield-carry/src/client/builders/updateTokenConfigurationBuilder.d.ts +11 -0
- package/dist/sdks/long-yield-carry/src/client/builders/updateTokenConfigurationBuilder.js +47 -0
- package/dist/sdks/long-yield-carry/src/client/builders/updateTokenMetadataBuilder.d.ts +7 -0
- package/dist/sdks/long-yield-carry/src/client/builders/updateTokenMetadataBuilder.js +24 -0
- package/dist/sdks/long-yield-carry/src/client/builders/updateYieldingBankConfigBuilder.d.ts +10 -0
- package/dist/sdks/long-yield-carry/src/client/builders/updateYieldingBankConfigBuilder.js +31 -0
- package/dist/sdks/long-yield-carry/src/client/builders/utils.d.ts +4 -0
- package/dist/sdks/long-yield-carry/src/client/builders/utils.js +20 -0
- package/dist/sdks/long-yield-carry/src/client/client.d.ts +115 -0
- package/dist/sdks/long-yield-carry/src/client/client.js +166 -0
- package/dist/sdks/long-yield-carry/src/client/externalLiquidityResolver.d.ts +13 -0
- package/dist/sdks/long-yield-carry/src/client/externalLiquidityResolver.js +34 -0
- package/dist/sdks/long-yield-carry/src/client/index.d.ts +10 -0
- package/dist/sdks/long-yield-carry/src/client/index.js +33 -0
- package/dist/sdks/long-yield-carry/src/client/lendingPlatformClients.d.ts +19 -0
- package/dist/sdks/long-yield-carry/src/client/lendingPlatformClients.js +33 -0
- package/dist/sdks/long-yield-carry/src/client/pda.d.ts +33 -0
- package/dist/sdks/long-yield-carry/src/client/pda.js +79 -0
- package/dist/sdks/long-yield-carry/src/client/plans/collectInterest.d.ts +24 -0
- package/dist/sdks/long-yield-carry/src/client/plans/collectInterest.js +150 -0
- package/dist/sdks/long-yield-carry/src/client/plans/decreaseCarryPosition.d.ts +12 -0
- package/dist/sdks/long-yield-carry/src/client/plans/decreaseCarryPosition.js +140 -0
- package/dist/sdks/long-yield-carry/src/client/routes/collectInterest.d.ts +13 -0
- package/dist/sdks/long-yield-carry/src/client/routes/collectInterest.js +39 -0
- package/dist/sdks/long-yield-carry/src/client/transaction.d.ts +41 -0
- package/dist/sdks/long-yield-carry/src/client/transaction.js +55 -0
- package/dist/sdks/long-yield-carry/src/client/types/builders.d.ts +18 -0
- package/dist/sdks/long-yield-carry/src/client/types/builders.js +2 -0
- package/dist/sdks/long-yield-carry/src/client/types/enums.d.ts +22 -0
- package/dist/sdks/long-yield-carry/src/client/types/enums.js +48 -0
- package/dist/sdks/long-yield-carry/src/client/types/general.d.ts +98 -0
- package/dist/sdks/long-yield-carry/src/client/types/general.js +2 -0
- package/dist/sdks/long-yield-carry/src/client/types/index.d.ts +6 -0
- package/dist/sdks/long-yield-carry/src/client/types/index.js +22 -0
- package/dist/sdks/long-yield-carry/src/client/types/ix.d.ts +352 -0
- package/dist/sdks/long-yield-carry/src/client/types/ix.js +2 -0
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/collectInterest.d.ts +91 -0
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/collectInterest.js +2 -0
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/common.d.ts +28 -0
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/common.js +2 -0
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/decreaseCarryPosition.d.ts +128 -0
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/decreaseCarryPosition.js +2 -0
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/index.d.ts +3 -0
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/index.js +19 -0
- package/dist/sdks/long-yield-carry/src/client/types/tx.d.ts +339 -0
- package/dist/sdks/long-yield-carry/src/client/types/tx.js +2 -0
- package/dist/sdks/long-yield-carry/src/constants/configs/allocations.d.ts +3 -0
- package/dist/sdks/long-yield-carry/src/constants/configs/allocations.js +23 -0
- package/dist/sdks/long-yield-carry/src/constants/configs/carryTradePresets.d.ts +58 -0
- package/dist/sdks/long-yield-carry/src/constants/configs/carryTradePresets.js +116 -0
- package/dist/sdks/long-yield-carry/src/constants/configs/index.d.ts +2 -0
- package/dist/sdks/long-yield-carry/src/constants/configs/index.js +18 -0
- package/dist/sdks/long-yield-carry/src/constants/general.d.ts +70 -0
- package/dist/sdks/long-yield-carry/src/constants/general.js +107 -0
- package/dist/sdks/long-yield-carry/src/constants/index.d.ts +3 -0
- package/dist/sdks/long-yield-carry/src/constants/index.js +19 -0
- package/dist/sdks/long-yield-carry/src/constants/lycTokenMetadata.d.ts +36 -0
- package/dist/sdks/long-yield-carry/src/constants/lycTokenMetadata.js +41 -0
- package/dist/sdks/long-yield-carry/src/decoders/decodeTransaction.d.ts +86 -0
- package/dist/sdks/long-yield-carry/src/decoders/decodeTransaction.js +230 -0
- package/dist/sdks/long-yield-carry/src/decoders/discriminators.d.ts +8 -0
- package/dist/sdks/long-yield-carry/src/decoders/discriminators.js +11 -0
- package/dist/sdks/long-yield-carry/src/decoders/idlAccounts.d.ts +29 -0
- package/dist/sdks/long-yield-carry/src/decoders/idlAccounts.js +57 -0
- package/dist/sdks/long-yield-carry/src/decoders/index.d.ts +6 -0
- package/dist/sdks/long-yield-carry/src/decoders/index.js +14 -0
- package/dist/sdks/long-yield-carry/src/decoders/innerCpis.d.ts +68 -0
- package/dist/sdks/long-yield-carry/src/decoders/innerCpis.js +225 -0
- package/dist/sdks/long-yield-carry/src/decoders/lycInstructionNames.d.ts +6 -0
- package/dist/sdks/long-yield-carry/src/decoders/lycInstructionNames.js +73 -0
- package/dist/sdks/long-yield-carry/src/decoders/programIds.d.ts +4 -0
- package/dist/sdks/long-yield-carry/src/decoders/programIds.js +11 -0
- package/dist/sdks/long-yield-carry/src/decoders/solana.d.ts +7 -0
- package/dist/sdks/long-yield-carry/src/decoders/solana.js +30 -0
- package/dist/sdks/long-yield-carry/src/decoders/transactionPayload.d.ts +41 -0
- package/dist/sdks/long-yield-carry/src/decoders/transactionPayload.js +6 -0
- package/dist/sdks/long-yield-carry/src/decoders/types.d.ts +58 -0
- package/dist/sdks/long-yield-carry/src/decoders/types.js +2 -0
- package/dist/sdks/long-yield-carry/src/errors.d.ts +69 -0
- package/dist/sdks/long-yield-carry/src/errors.js +183 -0
- package/dist/sdks/long-yield-carry/src/idl/long_yield_carry.d.ts +7327 -0
- package/dist/sdks/long-yield-carry/src/idl/long_yield_carry.js +7323 -0
- package/dist/sdks/long-yield-carry/src/index.d.ts +10 -0
- package/dist/sdks/long-yield-carry/src/index.js +25 -0
- package/dist/sdks/long-yield-carry/src/metrics/index.d.ts +1 -0
- package/dist/sdks/long-yield-carry/src/metrics/index.js +17 -0
- package/dist/sdks/long-yield-carry/src/metrics/protocolMetrics.d.ts +276 -0
- package/dist/sdks/long-yield-carry/src/metrics/protocolMetrics.js +547 -0
- package/dist/sdks/long-yield-carry/src/models/index.d.ts +3 -0
- package/dist/sdks/long-yield-carry/src/models/index.js +7 -0
- package/dist/sdks/long-yield-carry/src/models/lycToken.d.ts +156 -0
- package/dist/sdks/long-yield-carry/src/models/lycToken.js +288 -0
- package/dist/sdks/long-yield-carry/src/models/yieldingBank.d.ts +52 -0
- package/dist/sdks/long-yield-carry/src/models/yieldingBank.js +109 -0
- package/dist/sdks/long-yield-carry/src/services/allocation/allocationService.d.ts +106 -0
- package/dist/sdks/long-yield-carry/src/services/allocation/allocationService.js +589 -0
- package/dist/sdks/long-yield-carry/src/services/allocation/index.d.ts +2 -0
- package/dist/sdks/long-yield-carry/src/services/allocation/index.js +18 -0
- package/dist/sdks/long-yield-carry/src/services/allocation/types.d.ts +25 -0
- package/dist/sdks/long-yield-carry/src/services/allocation/types.js +2 -0
- package/dist/sdks/long-yield-carry/src/services/carry/carryAllocationConfig.d.ts +103 -0
- package/dist/sdks/long-yield-carry/src/services/carry/carryAllocationConfig.js +146 -0
- package/dist/sdks/long-yield-carry/src/services/carry/index.d.ts +2 -0
- package/dist/sdks/long-yield-carry/src/services/carry/index.js +18 -0
- package/dist/sdks/long-yield-carry/src/services/carry/lycLendingPositionManager.d.ts +39 -0
- package/dist/sdks/long-yield-carry/src/services/carry/lycLendingPositionManager.js +100 -0
- package/dist/sdks/long-yield-carry/src/services/index.d.ts +5 -0
- package/dist/sdks/long-yield-carry/src/services/index.js +21 -0
- package/dist/sdks/long-yield-carry/src/services/lendingPosition/index.d.ts +2 -0
- package/dist/sdks/long-yield-carry/src/services/lendingPosition/index.js +5 -0
- package/dist/sdks/long-yield-carry/src/services/lendingPosition/lendingPositionService.d.ts +88 -0
- package/dist/sdks/long-yield-carry/src/services/lendingPosition/lendingPositionService.js +229 -0
- package/dist/sdks/long-yield-carry/src/services/rebalance/index.d.ts +2 -0
- package/dist/sdks/long-yield-carry/src/services/rebalance/index.js +18 -0
- package/dist/sdks/long-yield-carry/src/services/rebalance/token/index.d.ts +1 -0
- package/dist/sdks/long-yield-carry/src/services/rebalance/token/index.js +17 -0
- package/dist/sdks/long-yield-carry/src/services/rebalance/token/tokenRebalanceService.d.ts +51 -0
- package/dist/sdks/long-yield-carry/src/services/rebalance/token/tokenRebalanceService.js +99 -0
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/index.d.ts +3 -0
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/index.js +21 -0
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/planner.d.ts +68 -0
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/planner.js +181 -0
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/strategy.d.ts +26 -0
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/strategy.js +26 -0
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/types.d.ts +40 -0
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/types.js +2 -0
- package/dist/sdks/long-yield-carry/src/services/redemption/index.d.ts +2 -0
- package/dist/sdks/long-yield-carry/src/services/redemption/index.js +5 -0
- package/dist/sdks/long-yield-carry/src/services/redemption/redemptionService.d.ts +139 -0
- package/dist/sdks/long-yield-carry/src/services/redemption/redemptionService.js +532 -0
- package/dist/sdks/long-yield-carry/src/types/enriched.d.ts +168 -0
- package/dist/sdks/long-yield-carry/src/types/enriched.js +2 -0
- package/dist/sdks/long-yield-carry/src/types/index.d.ts +1 -0
- package/dist/sdks/long-yield-carry/src/types/index.js +17 -0
- package/dist/sdks/long-yield-carry/src/utils/cache.d.ts +4 -0
- package/dist/sdks/long-yield-carry/src/utils/cache.js +10 -0
- package/dist/sdks/long-yield-carry/src/utils/data.d.ts +12 -0
- package/dist/sdks/long-yield-carry/src/utils/data.js +59 -0
- package/dist/sdks/long-yield-carry/src/utils/enrichment.d.ts +5 -0
- package/dist/sdks/long-yield-carry/src/utils/enrichment.js +244 -0
- package/dist/sdks/long-yield-carry/src/utils/feeDripMetrics.d.ts +36 -0
- package/dist/sdks/long-yield-carry/src/utils/feeDripMetrics.js +93 -0
- package/dist/sdks/long-yield-carry/src/utils/general.d.ts +28 -0
- package/dist/sdks/long-yield-carry/src/utils/general.js +47 -0
- package/dist/sdks/long-yield-carry/src/utils/index.d.ts +13 -0
- package/dist/sdks/long-yield-carry/src/utils/index.js +29 -0
- package/dist/sdks/long-yield-carry/src/utils/ix.d.ts +83 -0
- package/dist/sdks/long-yield-carry/src/utils/ix.js +165 -0
- package/dist/sdks/long-yield-carry/src/utils/lendingPosition.d.ts +68 -0
- package/dist/sdks/long-yield-carry/src/utils/lendingPosition.js +105 -0
- package/dist/sdks/long-yield-carry/src/utils/lookupTables.d.ts +55 -0
- package/dist/sdks/long-yield-carry/src/utils/lookupTables.js +216 -0
- package/dist/sdks/long-yield-carry/src/utils/lycData.d.ts +66 -0
- package/dist/sdks/long-yield-carry/src/utils/lycData.js +211 -0
- package/dist/sdks/long-yield-carry/src/utils/timelock.d.ts +19 -0
- package/dist/sdks/long-yield-carry/src/utils/timelock.js +37 -0
- package/dist/sdks/long-yield-carry/src/utils/tokenFeeMath.d.ts +11 -0
- package/dist/sdks/long-yield-carry/src/utils/tokenFeeMath.js +24 -0
- package/dist/sdks/long-yield-carry/src/utils/transactions.d.ts +20 -0
- package/dist/sdks/long-yield-carry/src/utils/transactions.js +72 -0
- package/dist/sdks/long-yield-carry/src/utils/yieldingBank.d.ts +24 -0
- package/dist/sdks/long-yield-carry/src/utils/yieldingBank.js +36 -0
- package/dist/shared/common/src/constants/accountMetas.d.ts +3 -0
- package/dist/shared/common/src/constants/accountMetas.js +9 -0
- package/dist/shared/common/src/constants/general.d.ts +21 -0
- package/dist/shared/common/src/constants/general.js +30 -0
- package/dist/shared/common/src/constants/generated/cpi.d.ts +23 -0
- package/dist/shared/common/src/constants/generated/cpi.js +28 -0
- package/dist/shared/common/src/constants/generated/index.d.ts +1 -0
- package/dist/shared/common/src/constants/generated/index.js +17 -0
- package/dist/shared/common/src/constants/index.d.ts +3 -0
- package/dist/shared/common/src/constants/index.js +19 -0
- package/dist/shared/common/src/index.d.ts +4 -0
- package/dist/shared/common/src/index.js +20 -0
- package/dist/shared/common/src/services/baseAccountClient.d.ts +22 -0
- package/dist/shared/common/src/services/baseAccountClient.js +38 -0
- package/dist/shared/common/src/services/baseIxBuilderService.d.ts +27 -0
- package/dist/shared/common/src/services/baseIxBuilderService.js +48 -0
- package/dist/shared/common/src/services/dataCache.d.ts +41 -0
- package/dist/shared/common/src/services/dataCache.js +130 -0
- package/dist/shared/common/src/services/index.d.ts +8 -0
- package/dist/shared/common/src/services/index.js +24 -0
- package/dist/shared/common/src/services/lutManager.d.ts +31 -0
- package/dist/shared/common/src/services/lutManager.js +133 -0
- package/dist/shared/common/src/services/mints/defaults.d.ts +2 -0
- package/dist/shared/common/src/services/mints/defaults.js +152 -0
- package/dist/shared/common/src/services/mints/index.d.ts +4 -0
- package/dist/shared/common/src/services/mints/index.js +20 -0
- package/dist/shared/common/src/services/mints/registry.d.ts +70 -0
- package/dist/shared/common/src/services/mints/registry.js +117 -0
- package/dist/shared/common/src/services/mints/symbols.d.ts +6 -0
- package/dist/shared/common/src/services/mints/symbols.js +13 -0
- package/dist/shared/common/src/services/mints/types.d.ts +30 -0
- package/dist/shared/common/src/services/mints/types.js +2 -0
- package/dist/shared/common/src/services/swap/index.d.ts +4 -0
- package/dist/shared/common/src/services/swap/index.js +20 -0
- package/dist/shared/common/src/services/swap/routableSwapClient.d.ts +36 -0
- package/dist/shared/common/src/services/swap/routableSwapClient.js +2 -0
- package/dist/shared/common/src/services/swap/swapClientBase.d.ts +45 -0
- package/dist/shared/common/src/services/swap/swapClientBase.js +2 -0
- package/dist/shared/common/src/services/swap/swapRouting.d.ts +13 -0
- package/dist/shared/common/src/services/swap/swapRouting.js +28 -0
- package/dist/shared/common/src/services/swap/types.d.ts +77 -0
- package/dist/shared/common/src/services/swap/types.js +2 -0
- package/dist/shared/common/src/services/token/index.d.ts +2 -0
- package/dist/shared/common/src/services/token/index.js +18 -0
- package/dist/shared/common/src/services/token/tokenProtocolClientBase.d.ts +51 -0
- package/dist/shared/common/src/services/token/tokenProtocolClientBase.js +2 -0
- package/dist/shared/common/src/services/token/types.d.ts +19 -0
- package/dist/shared/common/src/services/token/types.js +2 -0
- package/dist/shared/common/src/services/transactionSender.d.ts +24 -0
- package/dist/shared/common/src/services/transactionSender.js +30 -0
- package/dist/shared/common/src/types/cpi.d.ts +34 -0
- package/dist/shared/common/src/types/cpi.js +8 -0
- package/dist/shared/common/src/types/enums.d.ts +59 -0
- package/dist/shared/common/src/types/enums.js +122 -0
- package/dist/shared/common/src/types/general.d.ts +38 -0
- package/dist/shared/common/src/types/general.js +2 -0
- package/dist/shared/common/src/types/index.d.ts +4 -0
- package/dist/shared/common/src/types/index.js +20 -0
- package/dist/shared/common/src/types/solana.d.ts +24 -0
- package/dist/shared/common/src/types/solana.js +2 -0
- package/dist/shared/common/src/utils/accounts/index.d.ts +5 -0
- package/dist/shared/common/src/utils/accounts/index.js +21 -0
- package/dist/shared/common/src/utils/accounts/meta.d.ts +21 -0
- package/dist/shared/common/src/utils/accounts/meta.js +27 -0
- package/dist/shared/common/src/utils/accounts/pda.d.ts +2 -0
- package/dist/shared/common/src/utils/accounts/pda.js +17 -0
- package/dist/shared/common/src/utils/accounts/roles.d.ts +26 -0
- package/dist/shared/common/src/utils/accounts/roles.js +54 -0
- package/dist/shared/common/src/utils/accounts/rpc.d.ts +8 -0
- package/dist/shared/common/src/utils/accounts/rpc.js +30 -0
- package/dist/shared/common/src/utils/accounts/splBalances.d.ts +15 -0
- package/dist/shared/common/src/utils/accounts/splBalances.js +52 -0
- package/dist/shared/common/src/utils/anchor.d.ts +17 -0
- package/dist/shared/common/src/utils/anchor.js +29 -0
- package/dist/shared/common/src/utils/asyncConcurrency.d.ts +5 -0
- package/dist/shared/common/src/utils/asyncConcurrency.js +28 -0
- package/dist/shared/common/src/utils/compat.d.ts +46 -0
- package/dist/shared/common/src/utils/compat.js +72 -0
- package/dist/shared/common/src/utils/cpi/args.d.ts +69 -0
- package/dist/shared/common/src/utils/cpi/args.js +100 -0
- package/dist/shared/common/src/utils/cpi/index.d.ts +2 -0
- package/dist/shared/common/src/utils/cpi/index.js +18 -0
- package/dist/shared/common/src/utils/cpi/refs.d.ts +122 -0
- package/dist/shared/common/src/utils/cpi/refs.js +234 -0
- package/dist/shared/common/src/utils/data.d.ts +20 -0
- package/dist/shared/common/src/utils/data.js +27 -0
- package/dist/shared/common/src/utils/general.d.ts +24 -0
- package/dist/shared/common/src/utils/general.js +95 -0
- package/dist/shared/common/src/utils/index.d.ts +22 -0
- package/dist/shared/common/src/utils/index.js +38 -0
- package/dist/shared/common/src/utils/instruction.d.ts +74 -0
- package/dist/shared/common/src/utils/instruction.js +147 -0
- package/dist/shared/common/src/utils/jito.d.ts +113 -0
- package/dist/shared/common/src/utils/jito.js +178 -0
- package/dist/shared/common/src/utils/json.d.ts +5 -0
- package/dist/shared/common/src/utils/json.js +25 -0
- package/dist/shared/common/src/utils/jsonRpcFetch.d.ts +21 -0
- package/dist/shared/common/src/utils/jsonRpcFetch.js +134 -0
- package/dist/shared/common/src/utils/metadata.d.ts +107 -0
- package/dist/shared/common/src/utils/metadata.js +194 -0
- package/dist/shared/common/src/utils/numbers.d.ts +72 -0
- package/dist/shared/common/src/utils/numbers.js +193 -0
- package/dist/shared/common/src/utils/priorityFee.d.ts +18 -0
- package/dist/shared/common/src/utils/priorityFee.js +63 -0
- package/dist/shared/common/src/utils/retry.d.ts +20 -0
- package/dist/shared/common/src/utils/retry.js +69 -0
- package/dist/shared/common/src/utils/rpc.d.ts +40 -0
- package/dist/shared/common/src/utils/rpc.js +130 -0
- package/dist/shared/common/src/utils/solana.d.ts +23 -0
- package/dist/shared/common/src/utils/solana.js +61 -0
- package/dist/shared/common/src/utils/timeSeries.d.ts +18 -0
- package/dist/shared/common/src/utils/timeSeries.js +40 -0
- package/dist/shared/common/src/utils/token.d.ts +33 -0
- package/dist/shared/common/src/utils/token.js +82 -0
- package/dist/shared/common/src/utils/transaction.d.ts +154 -0
- package/dist/shared/common/src/utils/transaction.js +585 -0
- package/dist/shared/common/src/utils/transactionSplitter.d.ts +85 -0
- package/dist/shared/common/src/utils/transactionSplitter.js +127 -0
- package/dist/shared/common/src/utils/txAccountCoverage.d.ts +49 -0
- package/dist/shared/common/src/utils/txAccountCoverage.js +122 -0
- package/dist/shared/jupiter-helpers/src/api.d.ts +59 -0
- package/dist/shared/jupiter-helpers/src/api.js +130 -0
- package/dist/shared/jupiter-helpers/src/client.d.ts +79 -0
- package/dist/shared/jupiter-helpers/src/client.js +173 -0
- package/dist/shared/jupiter-helpers/src/constants.d.ts +35 -0
- package/dist/shared/jupiter-helpers/src/constants.js +38 -0
- package/dist/shared/jupiter-helpers/src/extract.d.ts +30 -0
- package/dist/shared/jupiter-helpers/src/extract.js +57 -0
- package/dist/shared/jupiter-helpers/src/index.d.ts +5 -0
- package/dist/shared/jupiter-helpers/src/index.js +21 -0
- package/dist/shared/jupiter-helpers/src/routePreInstructions.d.ts +19 -0
- package/dist/shared/jupiter-helpers/src/routePreInstructions.js +61 -0
- package/dist/shared/jupiter-helpers/src/sizeExactInForMinOutput.d.ts +70 -0
- package/dist/shared/jupiter-helpers/src/sizeExactInForMinOutput.js +95 -0
- package/dist/shared/jupiter-helpers/src/types.d.ts +66 -0
- package/dist/shared/jupiter-helpers/src/types.js +2 -0
- package/dist/shared/lending-platforms/src/constants/cache.d.ts +8 -0
- package/dist/shared/lending-platforms/src/constants/cache.js +11 -0
- package/dist/shared/lending-platforms/src/constants/index.d.ts +3 -0
- package/dist/shared/lending-platforms/src/constants/index.js +19 -0
- package/dist/shared/lending-platforms/src/constants/kamino.d.ts +7 -0
- package/dist/shared/lending-platforms/src/constants/kamino.js +83 -0
- package/dist/shared/lending-platforms/src/constants/lendingPosition.d.ts +7 -0
- package/dist/shared/lending-platforms/src/constants/lendingPosition.js +10 -0
- package/dist/shared/lending-platforms/src/data/accounts/index.d.ts +2 -0
- package/dist/shared/lending-platforms/src/data/accounts/index.js +18 -0
- package/dist/shared/lending-platforms/src/data/accounts/kamino.d.ts +42 -0
- package/dist/shared/lending-platforms/src/data/accounts/kamino.js +104 -0
- package/dist/shared/lending-platforms/src/data/accounts/lpAccountsBase.d.ts +7 -0
- package/dist/shared/lending-platforms/src/data/accounts/lpAccountsBase.js +9 -0
- package/dist/shared/lending-platforms/src/data/incentive/incentiveBase.d.ts +35 -0
- package/dist/shared/lending-platforms/src/data/incentive/incentiveBase.js +26 -0
- package/dist/shared/lending-platforms/src/data/incentive/index.d.ts +2 -0
- package/dist/shared/lending-platforms/src/data/incentive/index.js +18 -0
- package/dist/shared/lending-platforms/src/data/incentive/kamino.d.ts +55 -0
- package/dist/shared/lending-platforms/src/data/incentive/kamino.js +101 -0
- package/dist/shared/lending-platforms/src/data/index.d.ts +6 -0
- package/dist/shared/lending-platforms/src/data/index.js +22 -0
- package/dist/shared/lending-platforms/src/data/instructions/index.d.ts +3 -0
- package/dist/shared/lending-platforms/src/data/instructions/index.js +19 -0
- package/dist/shared/lending-platforms/src/data/instructions/kamino.d.ts +55 -0
- package/dist/shared/lending-platforms/src/data/instructions/kamino.js +630 -0
- package/dist/shared/lending-platforms/src/data/instructions/lpInstructionsBase.d.ts +175 -0
- package/dist/shared/lending-platforms/src/data/instructions/lpInstructionsBase.js +192 -0
- package/dist/shared/lending-platforms/src/data/instructions/types.d.ts +7 -0
- package/dist/shared/lending-platforms/src/data/instructions/types.js +2 -0
- package/dist/shared/lending-platforms/src/data/platform/index.d.ts +2 -0
- package/dist/shared/lending-platforms/src/data/platform/index.js +18 -0
- package/dist/shared/lending-platforms/src/data/platform/kamino.d.ts +59 -0
- package/dist/shared/lending-platforms/src/data/platform/kamino.js +206 -0
- package/dist/shared/lending-platforms/src/data/platform/lpDataBase.d.ts +35 -0
- package/dist/shared/lending-platforms/src/data/platform/lpDataBase.js +31 -0
- package/dist/shared/lending-platforms/src/data/reserve/index.d.ts +2 -0
- package/dist/shared/lending-platforms/src/data/reserve/index.js +18 -0
- package/dist/shared/lending-platforms/src/data/reserve/kamino.d.ts +45 -0
- package/dist/shared/lending-platforms/src/data/reserve/kamino.js +141 -0
- package/dist/shared/lending-platforms/src/data/reserve/reserveBase.d.ts +114 -0
- package/dist/shared/lending-platforms/src/data/reserve/reserveBase.js +125 -0
- package/dist/shared/lending-platforms/src/data/userPosition/index.d.ts +2 -0
- package/dist/shared/lending-platforms/src/data/userPosition/index.js +18 -0
- package/dist/shared/lending-platforms/src/data/userPosition/kamino.d.ts +15 -0
- package/dist/shared/lending-platforms/src/data/userPosition/kamino.js +45 -0
- package/dist/shared/lending-platforms/src/data/userPosition/userPositionBase.d.ts +50 -0
- package/dist/shared/lending-platforms/src/data/userPosition/userPositionBase.js +63 -0
- package/dist/shared/lending-platforms/src/index.d.ts +5 -0
- package/dist/shared/lending-platforms/src/index.js +21 -0
- package/dist/shared/lending-platforms/src/services/client/index.d.ts +2 -0
- package/dist/shared/lending-platforms/src/services/client/index.js +18 -0
- package/dist/shared/lending-platforms/src/services/client/kamino.d.ts +53 -0
- package/dist/shared/lending-platforms/src/services/client/kamino.js +142 -0
- package/dist/shared/lending-platforms/src/services/client/lpClientBase.d.ts +66 -0
- package/dist/shared/lending-platforms/src/services/client/lpClientBase.js +19 -0
- package/dist/shared/lending-platforms/src/services/flashLoan/flashLoanBase.d.ts +49 -0
- package/dist/shared/lending-platforms/src/services/flashLoan/flashLoanBase.js +16 -0
- package/dist/shared/lending-platforms/src/services/flashLoan/index.d.ts +2 -0
- package/dist/shared/lending-platforms/src/services/flashLoan/index.js +18 -0
- package/dist/shared/lending-platforms/src/services/flashLoan/kamino.d.ts +11 -0
- package/dist/shared/lending-platforms/src/services/flashLoan/kamino.js +85 -0
- package/dist/shared/lending-platforms/src/services/index.d.ts +5 -0
- package/dist/shared/lending-platforms/src/services/index.js +21 -0
- package/dist/shared/lending-platforms/src/services/lendingPosition/index.d.ts +2 -0
- package/dist/shared/lending-platforms/src/services/lendingPosition/index.js +18 -0
- package/dist/shared/lending-platforms/src/services/lendingPosition/lendingPositionManager.d.ts +117 -0
- package/dist/shared/lending-platforms/src/services/lendingPosition/lendingPositionManager.js +342 -0
- package/dist/shared/lending-platforms/src/services/lendingPosition/types.d.ts +40 -0
- package/dist/shared/lending-platforms/src/services/lendingPosition/types.js +2 -0
- package/dist/shared/lending-platforms/src/services/leverage/index.d.ts +2 -0
- package/dist/shared/lending-platforms/src/services/leverage/index.js +18 -0
- package/dist/shared/lending-platforms/src/services/leverage/leverageService.d.ts +104 -0
- package/dist/shared/lending-platforms/src/services/leverage/leverageService.js +437 -0
- package/dist/shared/lending-platforms/src/services/leverage/types.d.ts +261 -0
- package/dist/shared/lending-platforms/src/services/leverage/types.js +2 -0
- package/dist/shared/lending-platforms/src/services/reservesManager.d.ts +53 -0
- package/dist/shared/lending-platforms/src/services/reservesManager.js +112 -0
- package/dist/shared/lending-platforms/src/types/general.d.ts +37 -0
- package/dist/shared/lending-platforms/src/types/general.js +8 -0
- package/dist/shared/lending-platforms/src/types/index.d.ts +2 -0
- package/dist/shared/lending-platforms/src/types/index.js +18 -0
- package/dist/shared/lending-platforms/src/types/kamino.d.ts +10 -0
- package/dist/shared/lending-platforms/src/types/kamino.js +2 -0
- package/dist/shared/lending-platforms/src/utils/accounts.d.ts +16 -0
- package/dist/shared/lending-platforms/src/utils/accounts.js +36 -0
- package/dist/shared/lending-platforms/src/utils/cache.d.ts +3 -0
- package/dist/shared/lending-platforms/src/utils/cache.js +11 -0
- package/dist/shared/lending-platforms/src/utils/index.d.ts +6 -0
- package/dist/shared/lending-platforms/src/utils/index.js +22 -0
- package/dist/shared/lending-platforms/src/utils/kamino.d.ts +87 -0
- package/dist/shared/lending-platforms/src/utils/kamino.js +190 -0
- package/dist/shared/lending-platforms/src/utils/lendingPlatform.d.ts +6 -0
- package/dist/shared/lending-platforms/src/utils/lendingPlatform.js +16 -0
- package/dist/shared/lending-platforms/src/utils/math.d.ts +47 -0
- package/dist/shared/lending-platforms/src/utils/math.js +123 -0
- package/dist/shared/lending-platforms/src/utils/scope.d.ts +38 -0
- package/dist/shared/lending-platforms/src/utils/scope.js +144 -0
- package/dist/shared/oracle-service/src/constants/index.d.ts +3 -0
- package/dist/shared/oracle-service/src/constants/index.js +19 -0
- package/dist/shared/oracle-service/src/constants/pyth.d.ts +7 -0
- package/dist/shared/oracle-service/src/constants/pyth.js +71 -0
- package/dist/shared/oracle-service/src/constants/splStake.d.ts +2 -0
- package/dist/shared/oracle-service/src/constants/splStake.js +6 -0
- package/dist/shared/oracle-service/src/constants/switchboard.d.ts +7 -0
- package/dist/shared/oracle-service/src/constants/switchboard.js +10 -0
- package/dist/shared/oracle-service/src/feeds/custom.d.ts +30 -0
- package/dist/shared/oracle-service/src/feeds/custom.js +56 -0
- package/dist/shared/oracle-service/src/feeds/jupiter.d.ts +7 -0
- package/dist/shared/oracle-service/src/feeds/jupiter.js +43 -0
- package/dist/shared/oracle-service/src/feeds/priceBase.d.ts +13 -0
- package/dist/shared/oracle-service/src/feeds/priceBase.js +25 -0
- package/dist/shared/oracle-service/src/feeds/pyth.d.ts +8 -0
- package/dist/shared/oracle-service/src/feeds/pyth.js +59 -0
- package/dist/shared/oracle-service/src/feeds/splStake.d.ts +26 -0
- package/dist/shared/oracle-service/src/feeds/splStake.js +99 -0
- package/dist/shared/oracle-service/src/feeds/switchboard.d.ts +6 -0
- package/dist/shared/oracle-service/src/feeds/switchboard.js +11 -0
- package/dist/shared/oracle-service/src/index.d.ts +5 -0
- package/dist/shared/oracle-service/src/index.js +26 -0
- package/dist/shared/oracle-service/src/oracle.d.ts +22 -0
- package/dist/shared/oracle-service/src/oracle.js +104 -0
- package/dist/shared/oracle-service/src/types.d.ts +4 -0
- package/dist/shared/oracle-service/src/types.js +2 -0
- package/dist/shared/oracle-service/src/utils/general.d.ts +20 -0
- package/dist/shared/oracle-service/src/utils/general.js +65 -0
- package/dist/shared/oracle-service/src/utils/index.d.ts +1 -0
- package/dist/shared/oracle-service/src/utils/index.js +17 -0
- package/dist/shared/perena-helpers/src/accounts.d.ts +7 -0
- package/dist/shared/perena-helpers/src/accounts.js +12 -0
- package/dist/shared/perena-helpers/src/client.d.ts +299 -0
- package/dist/shared/perena-helpers/src/client.js +680 -0
- package/dist/shared/perena-helpers/src/constants.d.ts +5 -0
- package/dist/shared/perena-helpers/src/constants.js +8 -0
- package/dist/shared/perena-helpers/src/cpi/burn.d.ts +27 -0
- package/dist/shared/perena-helpers/src/cpi/burn.js +22 -0
- package/dist/shared/perena-helpers/src/cpi/index.d.ts +3 -0
- package/dist/shared/perena-helpers/src/cpi/index.js +19 -0
- package/dist/shared/perena-helpers/src/cpi/mint.d.ts +27 -0
- package/dist/shared/perena-helpers/src/cpi/mint.js +22 -0
- package/dist/shared/perena-helpers/src/cpi/requestUnstake.d.ts +19 -0
- package/dist/shared/perena-helpers/src/cpi/requestUnstake.js +16 -0
- package/dist/shared/perena-helpers/src/index.d.ts +5 -0
- package/dist/shared/perena-helpers/src/index.js +21 -0
- package/dist/shared/perena-helpers/src/utils.d.ts +9 -0
- package/dist/shared/perena-helpers/src/utils.js +54 -0
- package/dist/shared/swap-aggregator/src/aggSwapClient.d.ts +71 -0
- package/dist/shared/swap-aggregator/src/aggSwapClient.js +103 -0
- package/dist/shared/swap-aggregator/src/index.d.ts +1 -0
- package/dist/shared/swap-aggregator/src/index.js +17 -0
- package/docs/launchingToken.md +57 -0
- package/package.json +75 -0
- package/scripts/asyncBurn.ts +155 -0
- package/scripts/burnToken.ts +120 -0
- package/scripts/claimIncentives.ts +125 -0
- package/scripts/closeCpiPlans.ts +113 -0
- package/scripts/collectInterest.ts +194 -0
- package/scripts/collectProtocolFees.ts +144 -0
- package/scripts/computeOptimalAllocations.ts +117 -0
- package/scripts/createToken.ts +100 -0
- package/scripts/createTokenLendingPosition.ts +204 -0
- package/scripts/createYieldingBank.ts +91 -0
- package/scripts/decreaseCarryPositions.ts +359 -0
- package/scripts/depositUnlentCollateral.ts +106 -0
- package/scripts/emergency/deleverageAll.ts +287 -0
- package/scripts/emergency/triggerCircuitBreaker.ts +87 -0
- package/scripts/env.ts +4 -0
- package/scripts/findTxs.ts +169 -0
- package/scripts/increaseCarryPositions.ts +134 -0
- package/scripts/inspect/format.ts +576 -0
- package/scripts/inspect.ts +147 -0
- package/scripts/localUtils.ts +249 -0
- package/scripts/mintToken.ts +126 -0
- package/scripts/processAsyncBurns.ts +89 -0
- package/scripts/rebalanceToken.ts +269 -0
- package/scripts/rebalanceYieldingBank.ts +183 -0
- package/scripts/recollateralizeLoss.ts +79 -0
- package/scripts/refresh.ts +156 -0
- package/scripts/updateFees.ts +486 -0
- package/scripts/updateGeneralLut.ts +36 -0
- package/scripts/updateLendingPositionConfig.ts +172 -0
- package/scripts/updateTokenLuts.ts +36 -0
- package/scripts/updateTokenMetadata.ts +199 -0
- package/scripts/updateYieldingBankConfig.ts +100 -0
- package/scripts/withdrawUnlentCollateral.ts +178 -0
- package/src/client/account.ts +503 -0
- package/src/client/builders/args.ts +381 -0
- package/src/client/builders/asyncBurnBuilder.ts +305 -0
- package/src/client/builders/base.ts +303 -0
- package/src/client/builders/burnTokenBuilder.ts +258 -0
- package/src/client/builders/claimIncentivesBuilder.ts +211 -0
- package/src/client/builders/collectFeesBuilder.ts +52 -0
- package/src/client/builders/collectInterestBuilder.ts +165 -0
- package/src/client/builders/createCpiPlanBuilder.ts +21 -0
- package/src/client/builders/createTokenBuilder.ts +73 -0
- package/src/client/builders/createTokenLendingPositionBuilder.ts +219 -0
- package/src/client/builders/createYieldingBankAllocationBuilder.ts +32 -0
- package/src/client/builders/createYieldingBankBuilder.ts +39 -0
- package/src/client/builders/decreaseCarryPositionBuilder.ts +162 -0
- package/src/client/builders/depositUnlentCollateralBuilder.ts +95 -0
- package/src/client/builders/increaseCarryPositionBuilder.ts +105 -0
- package/src/client/builders/index.ts +37 -0
- package/src/client/builders/mintTokenBuilder.ts +137 -0
- package/src/client/builders/rebalanceTokenBuilder.ts +356 -0
- package/src/client/builders/rebalanceYieldingBankBuilder.ts +109 -0
- package/src/client/builders/recollateralizeLossBuilder.ts +367 -0
- package/src/client/builders/refreshTokenStateBuilder.ts +153 -0
- package/src/client/builders/refreshTokensBuilder.ts +82 -0
- package/src/client/builders/refreshYieldingBankBuilder.ts +42 -0
- package/src/client/builders/resetTokenBurnRateLimitBuilder.ts +21 -0
- package/src/client/builders/setTokenCircuitBreakerBuilder.ts +40 -0
- package/src/client/builders/setYieldingBankCircuitBreakerBuilder.ts +37 -0
- package/src/client/builders/updateLendingPositionConfigBuilder.ts +33 -0
- package/src/client/builders/updateTokenConfigurationBuilder.ts +50 -0
- package/src/client/builders/updateTokenMetadataBuilder.ts +24 -0
- package/src/client/builders/updateYieldingBankConfigBuilder.ts +32 -0
- package/src/client/builders/utils.ts +26 -0
- package/src/client/client.ts +264 -0
- package/src/client/externalLiquidityResolver.ts +54 -0
- package/src/client/index.ts +20 -0
- package/src/client/lendingPlatformClients.ts +50 -0
- package/src/client/pda.ts +102 -0
- package/src/client/plans/collectInterest.ts +207 -0
- package/src/client/plans/decreaseCarryPosition.ts +226 -0
- package/src/client/routes/collectInterest.ts +56 -0
- package/src/client/transaction.ts +106 -0
- package/src/client/types/builders.ts +19 -0
- package/src/client/types/enums.ts +47 -0
- package/src/client/types/general.ts +117 -0
- package/src/client/types/index.ts +6 -0
- package/src/client/types/ix.ts +452 -0
- package/src/client/types/planTypes/collectInterest.ts +97 -0
- package/src/client/types/planTypes/common.ts +31 -0
- package/src/client/types/planTypes/decreaseCarryPosition.ts +134 -0
- package/src/client/types/planTypes/index.ts +3 -0
- package/src/client/types/tx.ts +409 -0
- package/src/constants/configs/allocations.ts +30 -0
- package/src/constants/configs/carryTradePresets.ts +164 -0
- package/src/constants/configs/index.ts +2 -0
- package/src/constants/general.ts +141 -0
- package/src/constants/index.ts +3 -0
- package/src/constants/lycTokenMetadata.ts +52 -0
- package/src/decoders/decodeTransaction.ts +319 -0
- package/src/decoders/discriminators.ts +10 -0
- package/src/decoders/idlAccounts.ts +75 -0
- package/src/decoders/index.ts +15 -0
- package/src/decoders/innerCpis.ts +262 -0
- package/src/decoders/lycInstructionNames.ts +73 -0
- package/src/decoders/programIds.ts +12 -0
- package/src/decoders/solana.ts +25 -0
- package/src/decoders/transactionPayload.ts +41 -0
- package/src/decoders/types.ts +60 -0
- package/src/errors.ts +195 -0
- package/src/idl/long_yield_carry.ts +14648 -0
- package/src/index.ts +10 -0
- package/src/metrics/index.ts +1 -0
- package/src/metrics/protocolMetrics.ts +976 -0
- package/src/models/index.ts +9 -0
- package/src/models/lycToken.ts +380 -0
- package/src/models/yieldingBank.ts +127 -0
- package/src/services/allocation/allocationService.ts +823 -0
- package/src/services/allocation/index.ts +2 -0
- package/src/services/allocation/types.ts +27 -0
- package/src/services/carry/carryAllocationConfig.ts +266 -0
- package/src/services/carry/index.ts +2 -0
- package/src/services/carry/lycLendingPositionManager.ts +167 -0
- package/src/services/index.ts +5 -0
- package/src/services/lendingPosition/index.ts +5 -0
- package/src/services/lendingPosition/lendingPositionService.ts +328 -0
- package/src/services/rebalance/index.ts +2 -0
- package/src/services/rebalance/token/index.ts +1 -0
- package/src/services/rebalance/token/tokenRebalanceService.ts +142 -0
- package/src/services/rebalance/yieldingBank/index.ts +3 -0
- package/src/services/rebalance/yieldingBank/planner.ts +215 -0
- package/src/services/rebalance/yieldingBank/strategy.ts +41 -0
- package/src/services/rebalance/yieldingBank/types.ts +41 -0
- package/src/services/redemption/index.ts +9 -0
- package/src/services/redemption/redemptionService.ts +758 -0
- package/src/types/enriched.ts +187 -0
- package/src/types/index.ts +1 -0
- package/src/utils/cache.ts +12 -0
- package/src/utils/data.ts +65 -0
- package/src/utils/enrichment.ts +330 -0
- package/src/utils/feeDripMetrics.ts +146 -0
- package/src/utils/general.ts +54 -0
- package/src/utils/index.ts +13 -0
- package/src/utils/ix.ts +227 -0
- package/src/utils/lendingPosition.ts +221 -0
- package/src/utils/lookupTables.ts +309 -0
- package/src/utils/lycData.ts +321 -0
- package/src/utils/timelock.ts +63 -0
- package/src/utils/tokenFeeMath.ts +25 -0
- package/src/utils/transactions.ts +109 -0
- package/src/utils/yieldingBank.ts +38 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Address, Instruction } from "@solana/kit";
|
|
2
|
+
import { toKitInstruction } from "common";
|
|
3
|
+
import { getTokenCacheInvalidation } from "../../utils";
|
|
4
|
+
import { LongYieldCarrySingleInstructionBuilderService } from "./base";
|
|
5
|
+
import type { SetTokenCircuitBreakerIxArgs, SetTokenCircuitBreakerTxArgs } from "./args";
|
|
6
|
+
|
|
7
|
+
export class SetTokenCircuitBreakerBuilder extends LongYieldCarrySingleInstructionBuilderService<
|
|
8
|
+
SetTokenCircuitBreakerIxArgs,
|
|
9
|
+
SetTokenCircuitBreakerTxArgs
|
|
10
|
+
> {
|
|
11
|
+
protected async deriveIxArgs(
|
|
12
|
+
txArgs: SetTokenCircuitBreakerTxArgs
|
|
13
|
+
): Promise<SetTokenCircuitBreakerIxArgs> {
|
|
14
|
+
return {
|
|
15
|
+
authority: txArgs.authority,
|
|
16
|
+
token: txArgs.token,
|
|
17
|
+
active: txArgs.active,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async getIx(args: SetTokenCircuitBreakerIxArgs): Promise<Instruction> {
|
|
22
|
+
return this.program.methods
|
|
23
|
+
.setTokenCircuitBreaker(args.active)
|
|
24
|
+
.accountsPartial({ authority: args.authority, token: args.token })
|
|
25
|
+
.instruction()
|
|
26
|
+
.then(toKitInstruction);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
protected async buildLookupTables(
|
|
30
|
+
args: SetTokenCircuitBreakerIxArgs
|
|
31
|
+
): Promise<readonly Address[]> {
|
|
32
|
+
return this.getTxLookupTables(args.token);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
protected async buildPlanExtras(args: SetTokenCircuitBreakerIxArgs) {
|
|
36
|
+
return {
|
|
37
|
+
postSuccessCacheInvalidations: [getTokenCacheInvalidation(args.token)],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Address, Instruction } from "@solana/kit";
|
|
2
|
+
import { toKitInstruction } from "common";
|
|
3
|
+
import { LongYieldCarrySingleInstructionBuilderService } from "./base";
|
|
4
|
+
import type {
|
|
5
|
+
SetYieldingBankCircuitBreakerIxArgs,
|
|
6
|
+
SetYieldingBankCircuitBreakerTxArgs,
|
|
7
|
+
} from "./args";
|
|
8
|
+
|
|
9
|
+
export class SetYieldingBankCircuitBreakerBuilder extends LongYieldCarrySingleInstructionBuilderService<
|
|
10
|
+
SetYieldingBankCircuitBreakerIxArgs,
|
|
11
|
+
SetYieldingBankCircuitBreakerTxArgs
|
|
12
|
+
> {
|
|
13
|
+
protected async deriveIxArgs(
|
|
14
|
+
txArgs: SetYieldingBankCircuitBreakerTxArgs
|
|
15
|
+
): Promise<SetYieldingBankCircuitBreakerIxArgs> {
|
|
16
|
+
return {
|
|
17
|
+
authority: txArgs.authority,
|
|
18
|
+
yieldingBank: txArgs.yieldingBank,
|
|
19
|
+
active: txArgs.active,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async getIx(args: SetYieldingBankCircuitBreakerIxArgs): Promise<Instruction> {
|
|
24
|
+
return this.program.methods
|
|
25
|
+
.setYieldingBankCircuitBreaker(args.active)
|
|
26
|
+
.accountsPartial({
|
|
27
|
+
authority: args.authority,
|
|
28
|
+
yieldingBank: args.yieldingBank,
|
|
29
|
+
})
|
|
30
|
+
.instruction()
|
|
31
|
+
.then(toKitInstruction);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
protected async buildLookupTables(): Promise<readonly Address[]> {
|
|
35
|
+
return this.getTxLookupTables();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Address, Instruction } from "@solana/kit";
|
|
2
|
+
import { toKitInstruction } from "common";
|
|
3
|
+
import { getTokenCacheInvalidation } from "../../utils";
|
|
4
|
+
import { LongYieldCarrySingleInstructionBuilderService } from "./base";
|
|
5
|
+
import type { UpdateLendingPositionConfigIxArgs } from "./args";
|
|
6
|
+
|
|
7
|
+
export class UpdateLendingPositionConfigBuilder extends LongYieldCarrySingleInstructionBuilderService<UpdateLendingPositionConfigIxArgs> {
|
|
8
|
+
async getIx(args: UpdateLendingPositionConfigIxArgs): Promise<Instruction> {
|
|
9
|
+
const tokenData = await this.account.fetchToken(args.token);
|
|
10
|
+
return this.program.methods
|
|
11
|
+
.updateLendingPositionConfig({
|
|
12
|
+
lendingPositionIndex: args.params.lendingPositionIndex,
|
|
13
|
+
targetUtilizationRateBps: args.params.targetUtilizationRateBps,
|
|
14
|
+
maxDeviationAboveTargetUtilBps: args.params.maxDeviationAboveTargetUtilBps,
|
|
15
|
+
maxDeviationBelowTargetUtilBps: args.params.maxDeviationBelowTargetUtilBps,
|
|
16
|
+
})
|
|
17
|
+
.accountsPartial({ manager: this.resolveTokenManager(tokenData.data), token: args.token })
|
|
18
|
+
.instruction()
|
|
19
|
+
.then(toKitInstruction);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
protected async buildLookupTables(
|
|
23
|
+
args: UpdateLendingPositionConfigIxArgs
|
|
24
|
+
): Promise<readonly Address[]> {
|
|
25
|
+
return this.getTxLookupTables(args.token);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
protected async buildPlanExtras(args: UpdateLendingPositionConfigIxArgs) {
|
|
29
|
+
return {
|
|
30
|
+
postSuccessCacheInvalidations: [getTokenCacheInvalidation(args.token)],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Address, Instruction } from "@solana/kit";
|
|
2
|
+
import { toKitInstruction } from "common";
|
|
3
|
+
import { LongYieldCarrySingleInstructionBuilderService } from "./base";
|
|
4
|
+
import type { UpdateTokenConfigurationIxArgs } from "./args";
|
|
5
|
+
|
|
6
|
+
export class UpdateTokenConfigurationBuilder extends LongYieldCarrySingleInstructionBuilderService<UpdateTokenConfigurationIxArgs> {
|
|
7
|
+
/**
|
|
8
|
+
* Builds an update signed by the token admin by default. Callers may pass the
|
|
9
|
+
* token manager through the compatibility-named `admin` argument for fee-only updates.
|
|
10
|
+
*/
|
|
11
|
+
async getIx(args: UpdateTokenConfigurationIxArgs): Promise<Instruction> {
|
|
12
|
+
const tokenData = await this.account.fetchToken(args.token);
|
|
13
|
+
return this.program.methods
|
|
14
|
+
.updateTokenConfiguration({
|
|
15
|
+
performanceFeeBps: args.params.performanceFeeBps,
|
|
16
|
+
mintingFeeBps: args.params.mintingFeeBps,
|
|
17
|
+
burningFeeBps: args.params.burningFeeBps,
|
|
18
|
+
protocolMintBurnPctBps: args.params.protocolMintBurnPctBps,
|
|
19
|
+
curatorMintBurnPctBps: args.params.curatorMintBurnPctBps,
|
|
20
|
+
curatorPerfPctBps: args.params.curatorPerfPctBps,
|
|
21
|
+
// Omit to preserve the current on-chain value (the program always
|
|
22
|
+
// rewrites drip config on this instruction).
|
|
23
|
+
feeDripMaxApyBps: args.params.feeDripMaxApyBps ?? tokenData.data.fees.feeDripMaxApyBps,
|
|
24
|
+
feeDripDurationSecs:
|
|
25
|
+
args.params.feeDripDurationSecs ?? tokenData.data.fees.feeDripDurationSecs,
|
|
26
|
+
burnRateLimit: args.params.burnRateLimit
|
|
27
|
+
? {
|
|
28
|
+
maxAmount: args.params.burnRateLimit.maxAmount,
|
|
29
|
+
windowDurationSecs: args.params.burnRateLimit.windowDurationSecs,
|
|
30
|
+
}
|
|
31
|
+
: null,
|
|
32
|
+
depositLimit: args.params.depositLimit !== undefined ? args.params.depositLimit : null,
|
|
33
|
+
})
|
|
34
|
+
.accountsPartial({
|
|
35
|
+
admin: args.admin ?? this.resolveTokenAdmin(tokenData.data),
|
|
36
|
+
token: args.token,
|
|
37
|
+
managerRole: args.managerRole ?? null,
|
|
38
|
+
feesRole: args.feesRole ?? null,
|
|
39
|
+
cbControllerRole: args.cbControllerRole ?? null,
|
|
40
|
+
})
|
|
41
|
+
.instruction()
|
|
42
|
+
.then(toKitInstruction);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
protected async buildLookupTables(
|
|
46
|
+
args: UpdateTokenConfigurationIxArgs
|
|
47
|
+
): Promise<readonly Address[]> {
|
|
48
|
+
return this.getTxLookupTables(args.token);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Address, Instruction } from "@solana/kit";
|
|
2
|
+
import { toKitInstruction, toWeb3AccountMeta } from "common";
|
|
3
|
+
import { LongYieldCarrySingleInstructionBuilderService } from "./base";
|
|
4
|
+
import type { UpdateTokenMetadataIxArgs } from "./args";
|
|
5
|
+
|
|
6
|
+
export class UpdateTokenMetadataBuilder extends LongYieldCarrySingleInstructionBuilderService<UpdateTokenMetadataIxArgs> {
|
|
7
|
+
async getIx(args: UpdateTokenMetadataIxArgs): Promise<Instruction> {
|
|
8
|
+
const tokenData = await this.account.fetchToken(args.token);
|
|
9
|
+
return this.program.methods
|
|
10
|
+
.updateTokenMetadata(args.params.ixRefs)
|
|
11
|
+
.accountsPartial({
|
|
12
|
+
admin: this.resolveTokenAdmin(tokenData.data),
|
|
13
|
+
token: args.token,
|
|
14
|
+
mint: args.mint,
|
|
15
|
+
})
|
|
16
|
+
.remainingAccounts(args.params.remainingAccounts.map(toWeb3AccountMeta))
|
|
17
|
+
.instruction()
|
|
18
|
+
.then(toKitInstruction);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
protected async buildLookupTables(args: UpdateTokenMetadataIxArgs): Promise<readonly Address[]> {
|
|
22
|
+
return this.getTxLookupTables(args.token);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Address, Instruction } from "@solana/kit";
|
|
2
|
+
import { toKitInstruction } from "common";
|
|
3
|
+
import { getYieldingBankCacheInvalidation } from "../../utils";
|
|
4
|
+
import { LongYieldCarrySingleInstructionBuilderService } from "./base";
|
|
5
|
+
import type { UpdateYieldingBankConfigIxArgs } from "./args";
|
|
6
|
+
|
|
7
|
+
export class UpdateYieldingBankConfigBuilder extends LongYieldCarrySingleInstructionBuilderService<UpdateYieldingBankConfigIxArgs> {
|
|
8
|
+
async getIx(args: UpdateYieldingBankConfigIxArgs): Promise<Instruction> {
|
|
9
|
+
const bankData = await this.account.fetchYieldingBank(args.yieldingBank);
|
|
10
|
+
return this.program.methods
|
|
11
|
+
.updateYieldingBankConfig({})
|
|
12
|
+
.accountsPartial({
|
|
13
|
+
admin: args.admin ?? this.resolveYieldingBankAdmin(bankData.data),
|
|
14
|
+
yieldingBank: args.yieldingBank,
|
|
15
|
+
defaultRedemptionMint: args.params.defaultRedemptionMint,
|
|
16
|
+
managerRole: args.managerRole ?? null,
|
|
17
|
+
cbControllerRole: args.cbControllerRole ?? null,
|
|
18
|
+
})
|
|
19
|
+
.instruction()
|
|
20
|
+
.then(toKitInstruction);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
protected async buildLookupTables(): Promise<readonly Address[]> {
|
|
24
|
+
return this.getTxLookupTables();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
protected async buildPlanExtras(args: UpdateYieldingBankConfigIxArgs) {
|
|
28
|
+
return {
|
|
29
|
+
postSuccessCacheInvalidations: [getYieldingBankCacheInvalidation(args.yieldingBank)],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Address, Instruction } from "@solana/kit";
|
|
2
|
+
import type { LongYieldCarryBuilderContext } from "../types/builders";
|
|
3
|
+
import type { LYCToken } from "../../models/lycToken";
|
|
4
|
+
import { TOKEN_STALENESS_THRESHOLD_SECS } from "../../constants/general";
|
|
5
|
+
import { RefreshTokensBuilder } from "./refreshTokensBuilder";
|
|
6
|
+
|
|
7
|
+
export async function getRefreshTokenInstructionsIfStale(
|
|
8
|
+
context: LongYieldCarryBuilderContext,
|
|
9
|
+
signer: Address,
|
|
10
|
+
tokenData: LYCToken
|
|
11
|
+
): Promise<Instruction[]> {
|
|
12
|
+
const lastRefreshed = tokenData.data.accounting.lastRefreshedTs.toNumber();
|
|
13
|
+
const nowSecs = Math.floor(Date.now() / 1000);
|
|
14
|
+
if (nowSecs - lastRefreshed <= TOKEN_STALENESS_THRESHOLD_SECS) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return new RefreshTokensBuilder(context)
|
|
19
|
+
.getTx({
|
|
20
|
+
signer,
|
|
21
|
+
params: {
|
|
22
|
+
tokens: [tokenData.address],
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
.then((plan) => [...plan.instructions]);
|
|
26
|
+
}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Long Yield Carry program client.
|
|
3
|
+
*
|
|
4
|
+
* Composes PDA derivation, account fetching, instruction building, and
|
|
5
|
+
* transaction composition behind a single entry point.
|
|
6
|
+
*
|
|
7
|
+
* The Anchor program ID flows through to all sub-clients — no global state
|
|
8
|
+
* required.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* const client = new LongYieldCarryClient(provider, "local");
|
|
12
|
+
* const [pda, bump] = client.pda.token(mintAddress);
|
|
13
|
+
* const ix = await client.tx.createToken.getIx({
|
|
14
|
+
* mint,
|
|
15
|
+
* collateralMint,
|
|
16
|
+
* params,
|
|
17
|
+
* });
|
|
18
|
+
* const data = await client.account.token(pda);
|
|
19
|
+
* const tx = await client.tx.collectInterest.getTx({ manager: manager, token: token, params: { yieldingBank } });
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { Program, AnchorProvider } from "@anchor-lang/core";
|
|
23
|
+
import {
|
|
24
|
+
address,
|
|
25
|
+
type Instruction,
|
|
26
|
+
type Rpc,
|
|
27
|
+
type Signature,
|
|
28
|
+
type SolanaRpcApi,
|
|
29
|
+
type TransactionSigner,
|
|
30
|
+
} from "@solana/kit";
|
|
31
|
+
import {
|
|
32
|
+
LendingPlatform,
|
|
33
|
+
type Environment,
|
|
34
|
+
createRpc,
|
|
35
|
+
getRpcUrl,
|
|
36
|
+
getRpcUrls,
|
|
37
|
+
applyDataCacheTransactionInvalidations,
|
|
38
|
+
fromWeb3Pk,
|
|
39
|
+
mints,
|
|
40
|
+
signSendAndConfirmTransaction,
|
|
41
|
+
type SendTransactionOptionsWithPostSuccess,
|
|
42
|
+
type SwapClient,
|
|
43
|
+
type TransactionPlan,
|
|
44
|
+
createReadOnlyAnchorProvider,
|
|
45
|
+
} from "common";
|
|
46
|
+
import {
|
|
47
|
+
KaminoClient,
|
|
48
|
+
type LendingPlatformClientBase,
|
|
49
|
+
type LendingPlatformData,
|
|
50
|
+
type OutstandingIncentive,
|
|
51
|
+
} from "lending-platforms";
|
|
52
|
+
import { createAggSwapClient } from "swap-aggregator";
|
|
53
|
+
import { LongYieldCarry, IDL } from "../idl/long_yield_carry";
|
|
54
|
+
import { DEFAULT_MIN_INCENTIVE_UI_AMOUNT, PROGRAM_ID } from "../constants/general";
|
|
55
|
+
import { PdaClient } from "./pda";
|
|
56
|
+
import { AccountClient, LYC_TOKEN_CACHE_CATEGORY, YIELDING_BANK_CACHE_CATEGORY } from "./account";
|
|
57
|
+
import type { LongYieldCarryTransactionPlan } from "./types";
|
|
58
|
+
import type { LYCToken, TokenLendingPositionData } from "../models/lycToken";
|
|
59
|
+
import {
|
|
60
|
+
LendingPlatformClientRegistry,
|
|
61
|
+
type SupportedLendingPlatformClients,
|
|
62
|
+
} from "./lendingPlatformClients";
|
|
63
|
+
import { LongYieldCarryExternalLiquidityResolver } from "./externalLiquidityResolver";
|
|
64
|
+
import { TransactionClient } from "./transaction";
|
|
65
|
+
|
|
66
|
+
export interface LongYieldCarryClientOptions {
|
|
67
|
+
/**
|
|
68
|
+
* Swap client override. Replaces the default `AggSwapClient` for all swaps
|
|
69
|
+
* (including collect_interest). Useful in tests that need a restricted routing
|
|
70
|
+
* client (e.g. Surfpool direct-route-only client).
|
|
71
|
+
*/
|
|
72
|
+
swapClient?: SwapClient;
|
|
73
|
+
/**
|
|
74
|
+
* Optional overrides for internally managed lending platform clients.
|
|
75
|
+
* These are primarily useful in tests.
|
|
76
|
+
*/
|
|
77
|
+
lendingPlatformClients?: Partial<SupportedLendingPlatformClients>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Claimable incentives keyed by the token's lending position index. */
|
|
81
|
+
export type OutstandingIncentivesByPosition = Map<number, OutstandingIncentive[]>;
|
|
82
|
+
|
|
83
|
+
export class LongYieldCarryClient {
|
|
84
|
+
/**
|
|
85
|
+
* Deployment tier for this client (`local`, `test`, `prod`) — drives program ID,
|
|
86
|
+
* RPC URL, and authority constants passed into transaction builders.
|
|
87
|
+
*/
|
|
88
|
+
readonly environment: Environment;
|
|
89
|
+
/** Shared RPC client used by SDK send helpers */
|
|
90
|
+
readonly rpc: Rpc<SolanaRpcApi>;
|
|
91
|
+
/** PDA derivation utilities */
|
|
92
|
+
readonly pda: PdaClient;
|
|
93
|
+
/** On-chain account fetchers */
|
|
94
|
+
readonly account: AccountClient;
|
|
95
|
+
/** Transaction/instruction builders */
|
|
96
|
+
readonly tx: TransactionClient;
|
|
97
|
+
/** Aggregated swap client (Perena for USD* pairs, Jupiter fallback) */
|
|
98
|
+
readonly swap: SwapClient;
|
|
99
|
+
/** Shared registry of protocol-specific lending clients */
|
|
100
|
+
readonly lendingPlatformClients: LendingPlatformClientRegistry;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @param provider - Anchor provider (connection + wallet)
|
|
104
|
+
* @param environment - Optional environment override ("local", "test", "prod").
|
|
105
|
+
* Determines which program ID and RPC URL to use. Defaults to the IDL address.
|
|
106
|
+
* @param options - Optional configuration overrides (e.g. custom swap client for tests).
|
|
107
|
+
*/
|
|
108
|
+
/**
|
|
109
|
+
* Create a read-only client with a throwaway keypair.
|
|
110
|
+
*
|
|
111
|
+
* Use this for services that only need to read on-chain state (e.g. the
|
|
112
|
+
* price ingestion Lambda) and never sign transactions.
|
|
113
|
+
*/
|
|
114
|
+
static readOnly(env: Environment): LongYieldCarryClient {
|
|
115
|
+
return new LongYieldCarryClient(createReadOnlyAnchorProvider(env), env);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
constructor(
|
|
119
|
+
provider: AnchorProvider,
|
|
120
|
+
environment?: Environment,
|
|
121
|
+
options?: LongYieldCarryClientOptions
|
|
122
|
+
) {
|
|
123
|
+
const env = environment ?? "local";
|
|
124
|
+
this.environment = env;
|
|
125
|
+
const rpcUrl = getRpcUrl(env);
|
|
126
|
+
const rpcUrls = getRpcUrls(env);
|
|
127
|
+
const idl = environment ? { ...IDL, address: PROGRAM_ID[environment] } : IDL;
|
|
128
|
+
const program: Program<LongYieldCarry> = new Program(idl as LongYieldCarry, provider);
|
|
129
|
+
this.rpc = createRpc(env);
|
|
130
|
+
this.pda = new PdaClient(address(program.programId.toBase58()));
|
|
131
|
+
this.account = new AccountClient(program, this.pda, this.rpc);
|
|
132
|
+
const kaminoClient =
|
|
133
|
+
options?.lendingPlatformClients?.kamino ?? new KaminoClient(rpcUrl, rpcUrls);
|
|
134
|
+
this.lendingPlatformClients = new LendingPlatformClientRegistry({
|
|
135
|
+
kamino: kaminoClient,
|
|
136
|
+
});
|
|
137
|
+
this.swap = options?.swapClient ?? createAggSwapClient(rpcUrl, env);
|
|
138
|
+
const externalLiquidityResolver = new LongYieldCarryExternalLiquidityResolver(rpcUrl);
|
|
139
|
+
this.tx = new TransactionClient({
|
|
140
|
+
rpc: this.rpc,
|
|
141
|
+
program,
|
|
142
|
+
account: this.account,
|
|
143
|
+
pda: this.pda,
|
|
144
|
+
swap: this.swap,
|
|
145
|
+
externalLiquidityResolver,
|
|
146
|
+
environment: environment ?? "local",
|
|
147
|
+
lendingPlatformClients: this.lendingPlatformClients,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Sign, send, and confirm a transaction, then apply any post-success cache
|
|
153
|
+
* invalidations embedded in the transaction plan.
|
|
154
|
+
*/
|
|
155
|
+
async sendTransaction(
|
|
156
|
+
payer: TransactionSigner,
|
|
157
|
+
instructionsOrPlan: Instruction[] | TransactionPlan,
|
|
158
|
+
options?: SendTransactionOptionsWithPostSuccess
|
|
159
|
+
): Promise<Signature> {
|
|
160
|
+
const plan = Array.isArray(instructionsOrPlan)
|
|
161
|
+
? undefined
|
|
162
|
+
: (instructionsOrPlan as LongYieldCarryTransactionPlan);
|
|
163
|
+
|
|
164
|
+
return signSendAndConfirmTransaction(this.rpc, payer, instructionsOrPlan, {
|
|
165
|
+
...options,
|
|
166
|
+
onSuccess: () => {
|
|
167
|
+
if (plan) this.applyCacheInvalidations(plan);
|
|
168
|
+
options?.onSuccess?.();
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Returns currently claimable lending incentives keyed by lending position
|
|
175
|
+
* index. Each value contains that position's claimable incentive entries as
|
|
176
|
+
* reported by the underlying lending-platform client.
|
|
177
|
+
*
|
|
178
|
+
* `minUiAmount` filters out dust rewards (UI-denominated, per reward token);
|
|
179
|
+
* defaults to {@link DEFAULT_MIN_INCENTIVE_UI_AMOUNT} so harvesting never pays
|
|
180
|
+
* a transaction fee for an economically negligible balance.
|
|
181
|
+
*/
|
|
182
|
+
async getOutstandingIncentives(
|
|
183
|
+
token: LYCToken,
|
|
184
|
+
minUiAmount: number = DEFAULT_MIN_INCENTIVE_UI_AMOUNT,
|
|
185
|
+
log?: (msg: string) => void
|
|
186
|
+
): Promise<OutstandingIncentivesByPosition> {
|
|
187
|
+
const positionIncentives = await Promise.all(
|
|
188
|
+
token.activeLendingPositions.map(async ({ index, data: position }) => {
|
|
189
|
+
log?.(
|
|
190
|
+
`\n[getOutstandingIncentives] position #${index} userAcc=${fromWeb3Pk(position.protocolUserAcc).slice(0, 6)}…`
|
|
191
|
+
);
|
|
192
|
+
const incentives = await this.lendingPlatformClients
|
|
193
|
+
.getForPosition(position)
|
|
194
|
+
.getOutstandingIncentives(fromWeb3Pk(position.protocolUserAcc), minUiAmount, log);
|
|
195
|
+
return { index, incentives };
|
|
196
|
+
})
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
const incentivesByPosition: OutstandingIncentivesByPosition = new Map();
|
|
200
|
+
for (const { index, incentives } of positionIncentives) {
|
|
201
|
+
const known = incentives.filter((i) => mints.get(i.mint) !== undefined);
|
|
202
|
+
const unknown = incentives.filter((i) => mints.get(i.mint) === undefined);
|
|
203
|
+
if (unknown.length > 0) {
|
|
204
|
+
log?.(
|
|
205
|
+
` position #${index}: ${unknown.length} incentive(s) skipped — mint not in registry: ${unknown.map((i) => i.mint.slice(0, 6) + "…").join(", ")}`
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
if (known.length > 0) {
|
|
209
|
+
incentivesByPosition.set(index, known);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return incentivesByPosition;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Drops every cached entry across all sub-clients (account data, Kamino
|
|
218
|
+
* lending data, swap quotes). The next read through any sub-client will
|
|
219
|
+
* hit the RPC / API fresh.
|
|
220
|
+
*
|
|
221
|
+
* Use this between sequential phases that mutate on-chain state so that
|
|
222
|
+
* the later phase doesn't operate on stale snapshots.
|
|
223
|
+
*/
|
|
224
|
+
clearAllCache(): void {
|
|
225
|
+
this.account.dataCache.clearAllCache();
|
|
226
|
+
for (const lpClient of this.lendingPlatformClients.getAll()) {
|
|
227
|
+
lpClient.data.clearCache();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Clears cached data that a confirmed transaction has made stale.
|
|
233
|
+
*
|
|
234
|
+
* Call this after a transaction built from a `LongYieldCarryTransactionPlan`
|
|
235
|
+
* has been confirmed by an external sender (e.g. the backend
|
|
236
|
+
* `TransactionService`). The built-in `sendTransaction` applies these
|
|
237
|
+
* automatically; this method exists for callers that sign/send through a
|
|
238
|
+
* different path.
|
|
239
|
+
*/
|
|
240
|
+
applyCacheInvalidations(plan: LongYieldCarryTransactionPlan): void {
|
|
241
|
+
const invalidations = plan.postSuccessCacheInvalidations ?? [];
|
|
242
|
+
for (const lpClient of this.lendingPlatformClients.getAll()) {
|
|
243
|
+
lpClient.applyPostSuccessCacheInvalidations(invalidations);
|
|
244
|
+
}
|
|
245
|
+
applyDataCacheTransactionInvalidations(this.account.dataCache, invalidations, {
|
|
246
|
+
tokenPdaCategory: LYC_TOKEN_CACHE_CATEGORY,
|
|
247
|
+
yieldingBankPdaCategory: YIELDING_BANK_CACHE_CATEGORY,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
getLendingPlatformClient(position: TokenLendingPositionData) {
|
|
252
|
+
return this.lendingPlatformClients.getForPosition(position);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
getLendingPlatformClientByPlatform(platform: LendingPlatform.Kamino): KaminoClient;
|
|
256
|
+
getLendingPlatformClientByPlatform(
|
|
257
|
+
platform: LendingPlatform
|
|
258
|
+
): LendingPlatformClientBase<LendingPlatformData>;
|
|
259
|
+
getLendingPlatformClientByPlatform(
|
|
260
|
+
platform: LendingPlatform
|
|
261
|
+
): LendingPlatformClientBase<LendingPlatformData> {
|
|
262
|
+
return this.lendingPlatformClients.getByPlatform(platform);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Address } from "@solana/kit";
|
|
2
|
+
import {
|
|
3
|
+
dedupeOrderedAddresses,
|
|
4
|
+
mints,
|
|
5
|
+
type CpiData,
|
|
6
|
+
type TransactionCacheInvalidation,
|
|
7
|
+
} from "common";
|
|
8
|
+
import { getPerenaWithdrawalQueueAddressesFromCpiData, PerenaClient } from "perena-helpers";
|
|
9
|
+
import type { YieldingBankExternalLiquiditySource } from "./types";
|
|
10
|
+
import type { AccountClient } from "./account";
|
|
11
|
+
|
|
12
|
+
export interface YieldingBankRefreshExternalLiquidity {
|
|
13
|
+
externalLiquiditySources: YieldingBankExternalLiquiditySource[];
|
|
14
|
+
postSuccessCacheInvalidations: TransactionCacheInvalidation[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class LongYieldCarryExternalLiquidityResolver {
|
|
18
|
+
private readonly perena: PerenaClient;
|
|
19
|
+
|
|
20
|
+
constructor(rpcUrl: string) {
|
|
21
|
+
this.perena = new PerenaClient(rpcUrl);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async resolveYieldingBankRefreshExternalLiquidity(
|
|
25
|
+
accountClient: AccountClient,
|
|
26
|
+
yieldingBank: Address,
|
|
27
|
+
cpiData: readonly CpiData[] = []
|
|
28
|
+
): Promise<YieldingBankRefreshExternalLiquidity> {
|
|
29
|
+
const usdStarJuniorMint = mints.get("USD*-J");
|
|
30
|
+
if (!usdStarJuniorMint) {
|
|
31
|
+
return { externalLiquiditySources: [], postSuccessCacheInvalidations: [] };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const bank = await accountClient.fetchYieldingBank(yieldingBank);
|
|
35
|
+
if (!bank.findAssetHolding(usdStarJuniorMint.address)) {
|
|
36
|
+
return { externalLiquiditySources: [], postSuccessCacheInvalidations: [] };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const withdrawalQueues = dedupeOrderedAddresses([
|
|
40
|
+
...(await this.perena.getActiveWithdrawalQueues(yieldingBank)),
|
|
41
|
+
...getPerenaWithdrawalQueueAddressesFromCpiData(cpiData),
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
externalLiquiditySources: withdrawalQueues.map((account) => ({
|
|
46
|
+
mint: usdStarJuniorMint.address,
|
|
47
|
+
account,
|
|
48
|
+
})),
|
|
49
|
+
postSuccessCacheInvalidations: withdrawalQueues.length
|
|
50
|
+
? [this.perena.getActiveWithdrawalQueuesCacheInvalidation(yieldingBank)]
|
|
51
|
+
: [],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { LongYieldCarryClient, type LongYieldCarryClientOptions } from "./client";
|
|
2
|
+
export * from "./transaction";
|
|
3
|
+
export {
|
|
4
|
+
LendingPlatformClientRegistry,
|
|
5
|
+
type SupportedLendingPlatformClients,
|
|
6
|
+
} from "./lendingPlatformClients";
|
|
7
|
+
export {
|
|
8
|
+
assertCollectInterestPlanHasPositiveRedemptions,
|
|
9
|
+
buildCollectInterestPlan,
|
|
10
|
+
} from "./plans/collectInterest";
|
|
11
|
+
export { buildDecreaseCarryPositionPlan } from "./plans/decreaseCarryPosition";
|
|
12
|
+
export * from "./types";
|
|
13
|
+
export { LYCToken } from "../models/lycToken";
|
|
14
|
+
export type {
|
|
15
|
+
TokenAccountData,
|
|
16
|
+
TokenCarryPositionData,
|
|
17
|
+
IndexedCarryPosition,
|
|
18
|
+
} from "../models/lycToken";
|
|
19
|
+
export { LYCYieldingBank } from "../models/yieldingBank";
|
|
20
|
+
export * from "../types";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { LendingPlatform, lendingPlatformToEnum } from "common";
|
|
2
|
+
import type {
|
|
3
|
+
KaminoClient,
|
|
4
|
+
LendingPlatformClientBase,
|
|
5
|
+
LendingPlatformData,
|
|
6
|
+
} from "lending-platforms";
|
|
7
|
+
import type { TokenLendingPositionData } from "../models/lycToken";
|
|
8
|
+
|
|
9
|
+
export interface SupportedLendingPlatformClients {
|
|
10
|
+
kamino: KaminoClient;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Central registry for protocol-specific lending clients used throughout the
|
|
15
|
+
* long-yield-carry SDK.
|
|
16
|
+
*/
|
|
17
|
+
export class LendingPlatformClientRegistry {
|
|
18
|
+
private readonly kaminoClient: KaminoClient;
|
|
19
|
+
|
|
20
|
+
constructor(clients: SupportedLendingPlatformClients) {
|
|
21
|
+
this.kaminoClient = clients.kamino;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getAll(): LendingPlatformClientBase<LendingPlatformData>[] {
|
|
25
|
+
return [this.kaminoClient];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getPlatformForPosition(position: TokenLendingPositionData): LendingPlatform {
|
|
29
|
+
return lendingPlatformToEnum(position.platform);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getForPosition(
|
|
33
|
+
position: TokenLendingPositionData
|
|
34
|
+
): LendingPlatformClientBase<LendingPlatformData> {
|
|
35
|
+
return this.getByPlatform(this.getPlatformForPosition(position));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
getByPlatform(platform: LendingPlatform.Kamino): KaminoClient;
|
|
39
|
+
getByPlatform(platform: LendingPlatform): LendingPlatformClientBase<LendingPlatformData>;
|
|
40
|
+
getByPlatform(platform: LendingPlatform): LendingPlatformClientBase<LendingPlatformData> {
|
|
41
|
+
switch (platform) {
|
|
42
|
+
case LendingPlatform.None:
|
|
43
|
+
throw new Error("Lending position does not have an active lending platform");
|
|
44
|
+
case LendingPlatform.Kamino:
|
|
45
|
+
return this.kaminoClient;
|
|
46
|
+
default:
|
|
47
|
+
throw new Error(`Unsupported lending platform client: ${platform}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|