@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,97 @@
|
|
|
1
|
+
import type { BN } from "@anchor-lang/core";
|
|
2
|
+
import type { Address } from "@solana/kit";
|
|
3
|
+
import type { CpiData } from "common";
|
|
4
|
+
import type { PricedMint } from "../general";
|
|
5
|
+
import type { SingleCpiExecutionPlan } from "./common";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Deterministic inputs for deriving a `collect_interest` plan.
|
|
9
|
+
*/
|
|
10
|
+
export interface CollectInterestPlanParams {
|
|
11
|
+
/** Yielding bank whose active carry position should be partially redeemed. */
|
|
12
|
+
yieldingBank: Address;
|
|
13
|
+
/**
|
|
14
|
+
* Minimum net yield (in USD) below which collection is skipped.
|
|
15
|
+
* Prevents wasteful swaps when accrued interest is negligible.
|
|
16
|
+
* Value is in human-readable USD (e.g. 0.5 = $0.50).
|
|
17
|
+
*/
|
|
18
|
+
minYieldUsd?: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* One yielding-bank holding that should be redeemed during interest collection.
|
|
23
|
+
*/
|
|
24
|
+
export interface CollectInterestHoldingPlan {
|
|
25
|
+
/** Mint held by the yielding bank allocation. */
|
|
26
|
+
mint: Address;
|
|
27
|
+
/** Amount to redeem in raw base units for this holding. */
|
|
28
|
+
amount: BN;
|
|
29
|
+
/** Whether this holding came from the bank's base-asset slot. */
|
|
30
|
+
isBaseAsset: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Deterministic `collect_interest` plan produced by `client.planner`.
|
|
35
|
+
*
|
|
36
|
+
* This captures protocol-derived values only: the active carry position,
|
|
37
|
+
* shares to burn, and the ordered bank holdings that should be redeemed.
|
|
38
|
+
* It intentionally does not encode swap venue or routing policy.
|
|
39
|
+
*/
|
|
40
|
+
export interface CollectInterestPlan {
|
|
41
|
+
/** Token PDA whose carry position is collecting accrued yield. */
|
|
42
|
+
token: Address;
|
|
43
|
+
/** Yielding bank the active carry position is allocated to. */
|
|
44
|
+
yieldingBank: Address;
|
|
45
|
+
/** Base mint configured on the yielding bank. */
|
|
46
|
+
baseMint: Address;
|
|
47
|
+
/** Default redemption asset that accrued interest is collected from. */
|
|
48
|
+
redemption: PricedMint;
|
|
49
|
+
/** Token collateral asset that collection must ultimately end in. */
|
|
50
|
+
collateral: PricedMint;
|
|
51
|
+
/** Index of the active `debtCarry` entry on the token account. */
|
|
52
|
+
carryIndex: number;
|
|
53
|
+
/** Number of carry-position shares the program should burn. */
|
|
54
|
+
sharesToBurn: BN;
|
|
55
|
+
/** USD value represented by the burned shares, in program-scale units. */
|
|
56
|
+
sharesBurnedValueUsd: BN;
|
|
57
|
+
/** Ordered yielding-bank holdings to redeem before final collateral settlement. */
|
|
58
|
+
holdingsToRedeem: CollectInterestHoldingPlan[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Caller-controlled routing inputs for turning a deterministic collect-interest
|
|
63
|
+
* plan into concrete swap CPI data.
|
|
64
|
+
*/
|
|
65
|
+
export interface CollectInterestRouteBuilderParams {
|
|
66
|
+
/** Final output mint. Defaults to `plan.collateral.mint`. */
|
|
67
|
+
outputMint?: Address;
|
|
68
|
+
/** Slippage tolerance applied to all collect-interest swaps. Defaults to `100`. */
|
|
69
|
+
slippageBps?: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Manual CPI inputs for callers that already know the exact swap sequence they
|
|
74
|
+
* want `collect_interest` to execute.
|
|
75
|
+
*/
|
|
76
|
+
export interface CollectInterestBuilderParams {
|
|
77
|
+
/** Yielding bank whose shares will be redeemed. */
|
|
78
|
+
yieldingBank: Address;
|
|
79
|
+
/** Prebuilt CPI descriptors that swap redeemed assets into collateral. */
|
|
80
|
+
cpiData: CpiData[];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Fully executable `collect_interest` plan produced by `client.routeBuilder`.
|
|
85
|
+
*
|
|
86
|
+
* Extends the deterministic planner result with the exact CPI sequence,
|
|
87
|
+
* pre-instructions, and initial accounts required by the final tx composer.
|
|
88
|
+
*/
|
|
89
|
+
export interface CollectInterestExecutionPlan extends CollectInterestPlan, SingleCpiExecutionPlan {}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Precomputed execution-plan wrapper accepted by `client.tx.collectInterest.getTx({...})`.
|
|
93
|
+
*/
|
|
94
|
+
export interface CollectInterestTxPlanParams {
|
|
95
|
+
/** Route-builder result previously returned by `client.routeBuilder.buildCollectInterestRoutePlan()`. */
|
|
96
|
+
plan: CollectInterestExecutionPlan;
|
|
97
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Instruction } from "@solana/kit";
|
|
2
|
+
import type { CpiData, CustomAccountMeta } from "common";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Shared fields carried by normalized execution plans.
|
|
6
|
+
*
|
|
7
|
+
* These values are produced before the transaction layer resolves remaining
|
|
8
|
+
* account refs and ATA creation instructions.
|
|
9
|
+
*/
|
|
10
|
+
export interface PlannedInstructionBase {
|
|
11
|
+
/** Pre-instructions that must run before ATA creation or the main instruction. */
|
|
12
|
+
preInstructions: Instruction[];
|
|
13
|
+
/** Accounts that must lead the remaining-accounts pool before CPI accounts are appended. */
|
|
14
|
+
initialAccounts: CustomAccountMeta[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Execution-plan shape for instructions that use a single CPI ref group.
|
|
19
|
+
*/
|
|
20
|
+
export interface SingleCpiExecutionPlan extends PlannedInstructionBase {
|
|
21
|
+
/** Ordered CPI descriptors consumed by one instruction-level refs input. */
|
|
22
|
+
cpiData: CpiData[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Execution-plan shape for instructions that use multiple CPI ref groups.
|
|
27
|
+
*/
|
|
28
|
+
export interface GroupedCpiExecutionPlan extends PlannedInstructionBase {
|
|
29
|
+
/** Ordered CPI groups where each group maps to a distinct refs input. */
|
|
30
|
+
cpiDataGroups: CpiData[][];
|
|
31
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { Address } from "@solana/kit";
|
|
2
|
+
import type BN from "bn.js";
|
|
3
|
+
import type { LendingPlatformData, LpInstructionsBase } from "lending-platforms";
|
|
4
|
+
import type { CpiData, Environment } from "common";
|
|
5
|
+
import type { GroupedCpiExecutionPlan } from "./common";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Mutually exclusive ways to steer repay sizing. Omit to use default obligation-relative
|
|
9
|
+
* sizing (`LycLendingPositionManager.calcDebtChangeAmount` with no utilization target).
|
|
10
|
+
*
|
|
11
|
+
* `DecreaseCarryPositionPlan.targetUtilizationRateBps` is set when the on-chain instruction
|
|
12
|
+
* must validate post-repay utilization against an explicit bps value (manager signer):
|
|
13
|
+
* - `explicitTargetUtilization` — caller supplies bps for both sizing and the instruction.
|
|
14
|
+
* - `collateralWithdrawal` with `allowBelowTargetOnChain` — sizing uses
|
|
15
|
+
* `calcPreWithdrawalTargetUtilizationRateBps`; set the flag when this DCP must pass derived
|
|
16
|
+
* utilization bps on-chain because post-repay utilization will sit **below** the position's
|
|
17
|
+
* configured `targetUtilizationRateBps` (e.g. pre-rebalance unwind).
|
|
18
|
+
*/
|
|
19
|
+
export type DecreaseCarryRepaySteering =
|
|
20
|
+
| {
|
|
21
|
+
mode: "collateralWithdrawal";
|
|
22
|
+
/** Collateral (UI units) removed after this repay. */
|
|
23
|
+
collateralWithdrawalUiAmount: number;
|
|
24
|
+
/**
|
|
25
|
+
* Desired utilization after the later collateral withdrawal. Defaults to the
|
|
26
|
+
* position's configured target.
|
|
27
|
+
*/
|
|
28
|
+
postWithdrawalTargetUtilizationRateBps?: number;
|
|
29
|
+
/**
|
|
30
|
+
* When true, allow passing derived utilization bps on-chain (same bps as sizing) so a
|
|
31
|
+
* manager `decrease_carry_position` can validate when post-repay utilization sits **below**
|
|
32
|
+
* the position's configured `targetUtilizationRateBps` (e.g. pre-rebalance unwind).
|
|
33
|
+
*/
|
|
34
|
+
allowBelowTargetOnChain?: boolean;
|
|
35
|
+
}
|
|
36
|
+
| {
|
|
37
|
+
mode: "explicitTargetUtilization";
|
|
38
|
+
/**
|
|
39
|
+
* Caller supplies utilization (bps) for repay sizing and on-chain post-repay check (manager signer).
|
|
40
|
+
* Often equals or is derived from the position's configured target; this mode passes bps through
|
|
41
|
+
* explicitly, unlike `collateralWithdrawal`, which derives a target from UI collateral out.
|
|
42
|
+
*/
|
|
43
|
+
targetUtilizationRateBps: number;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Deterministic inputs for deriving a `decrease_carry_position` plan.
|
|
48
|
+
*
|
|
49
|
+
* Pass this to `client.planner.buildDecreaseCarryPositionPlan()` when you want
|
|
50
|
+
* the SDK to compute repay math, swap requirements, and grouped CPI inputs.
|
|
51
|
+
*/
|
|
52
|
+
export interface DecreaseCarryPositionBuilderParams {
|
|
53
|
+
/** Index into the token's `lendingPositions` array for the position to repay. */
|
|
54
|
+
lendingPositionIndex: number;
|
|
55
|
+
/** Yielding bank PDA holding the funds that will be redeemed or swapped for repayment. */
|
|
56
|
+
yieldingBank: Address;
|
|
57
|
+
/** Lending-platform instruction client used to build the repay CPI sequence. */
|
|
58
|
+
lendingIx: LpInstructionsBase<LendingPlatformData>;
|
|
59
|
+
/** Deployment environment used for off-chain price fetches during repay sizing. */
|
|
60
|
+
environment?: Environment;
|
|
61
|
+
/** Slippage tolerance for any required DCP swap, in basis points. Defaults to `40`. */
|
|
62
|
+
swapSlippageBps?: number;
|
|
63
|
+
/** DEX labels to exclude from any required DCP swap (e.g. venues that failed a prior attempt). */
|
|
64
|
+
swapExcludeDexes?: string[];
|
|
65
|
+
/**
|
|
66
|
+
* Optional override for the asset redeemed from the yielding bank.
|
|
67
|
+
*
|
|
68
|
+
* Defaults to the bank's `defaultRedemptionMint`. On-chain permission checks
|
|
69
|
+
* may reject non-manager callers that override this away from the configured
|
|
70
|
+
* default redemption mint.
|
|
71
|
+
*/
|
|
72
|
+
sourceMint?: Address;
|
|
73
|
+
/**
|
|
74
|
+
* Optional transaction identifier shared with the lending client.
|
|
75
|
+
*
|
|
76
|
+
* Reuse a parent transaction ID when composing this flow into a larger
|
|
77
|
+
* transaction so lending pre-instructions are not duplicated.
|
|
78
|
+
*/
|
|
79
|
+
txId?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Steers how the planner picks the obligation / repay size. At most one variant;
|
|
82
|
+
* omit for default sizing.
|
|
83
|
+
*/
|
|
84
|
+
repaySteering?: DecreaseCarryRepaySteering;
|
|
85
|
+
/**
|
|
86
|
+
* When true (e.g. burn-token liquidity management), non-manager callers may execute
|
|
87
|
+
* the resulting plan subject to the instruction's post-repay validation.
|
|
88
|
+
*/
|
|
89
|
+
permissionlessOperation?: boolean;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Precomputed plan wrapper accepted by `client.tx.decreaseCarryPosition.getTx({...})`.
|
|
94
|
+
*/
|
|
95
|
+
export interface DecreaseCarryPositionTxPlanParams {
|
|
96
|
+
/** Planner result previously returned by `client.planner.buildDecreaseCarryPositionPlan()`. */
|
|
97
|
+
plan: DecreaseCarryPositionPlan;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Deterministic execution plan for `decrease_carry_position`.
|
|
102
|
+
*
|
|
103
|
+
* Produced by `client.planner.buildDecreaseCarryPositionPlan()` and later
|
|
104
|
+
* consumed by `client.tx.decreaseCarryPosition.getTx({...})`. This keeps repay math,
|
|
105
|
+
* swap decisions, and grouped CPI assembly out of the transaction composer.
|
|
106
|
+
*/
|
|
107
|
+
export interface DecreaseCarryPositionPlan extends GroupedCpiExecutionPlan {
|
|
108
|
+
/** Optional prerequisite CPIs executed before any lending-position refresh. */
|
|
109
|
+
tokenPrerequisiteCpis?: CpiData[];
|
|
110
|
+
/**
|
|
111
|
+
* When set, passed through to `decrease_carry_position` for manager-only
|
|
112
|
+
* post-repay validation. Populated from explicit steering or from
|
|
113
|
+
* `collateralWithdrawal` + `allowBelowTargetOnChain` (derived bps = sizing target).
|
|
114
|
+
*/
|
|
115
|
+
targetUtilizationRateBps?: number;
|
|
116
|
+
/** Index into the token account's `lendingPositions` array. */
|
|
117
|
+
lendingPositionIndex: number;
|
|
118
|
+
/** Raw debt repayment amount in base units. */
|
|
119
|
+
repayAmount: BN;
|
|
120
|
+
/**
|
|
121
|
+
* Yielding-bank holding index redeemed as the swap source.
|
|
122
|
+
*
|
|
123
|
+
* Omitted when no preliminary swap is needed because the debt asset is
|
|
124
|
+
* already held directly by the yielding bank.
|
|
125
|
+
*/
|
|
126
|
+
sourceAssetHoldingIndex?: number;
|
|
127
|
+
/** Yielding bank refreshed immediately before the instruction executes. */
|
|
128
|
+
yieldingBank: Address;
|
|
129
|
+
/**
|
|
130
|
+
* When set, `decrease_carry_position` / burn unwind must encode `repay_amount` as null.
|
|
131
|
+
* This is only needed for flows where the exact repay amount must be derived on-chain.
|
|
132
|
+
*/
|
|
133
|
+
omitOnChainRepayAmount?: boolean;
|
|
134
|
+
}
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import type { BN } from "@anchor-lang/core";
|
|
2
|
+
import type { Address } from "@solana/kit";
|
|
3
|
+
import type {
|
|
4
|
+
AnchorOracleType,
|
|
5
|
+
CpiData,
|
|
6
|
+
SwapClient,
|
|
7
|
+
TransactionCacheInvalidation,
|
|
8
|
+
TransactionPlan as BaseTransactionPlan,
|
|
9
|
+
} from "common";
|
|
10
|
+
import { YieldingBankAllocationConfig } from "./ix";
|
|
11
|
+
import type {
|
|
12
|
+
DecreaseCarryPositionTxPlanParams,
|
|
13
|
+
DecreaseCarryRepaySteering,
|
|
14
|
+
} from "./planTypes/decreaseCarryPosition";
|
|
15
|
+
import type { TokenLpPositionAccountOverrides } from "./ix";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Fully composed transaction output ready to pass to `sendTransaction`.
|
|
19
|
+
*/
|
|
20
|
+
export interface LongYieldCarryTransactionPlan extends BaseTransactionPlan {
|
|
21
|
+
/**
|
|
22
|
+
* Cache entries that should be cleared only after the transaction confirms.
|
|
23
|
+
*
|
|
24
|
+
* This keeps transaction builders pure while still letting callers invalidate
|
|
25
|
+
* stale off-chain snapshots when a successful on-chain write changes account
|
|
26
|
+
* topology (for example first-time lending account setup).
|
|
27
|
+
*/
|
|
28
|
+
postSuccessCacheInvalidations?: TransactionCacheInvalidation[];
|
|
29
|
+
/** Optional lending-client transaction id reused across composed plans. */
|
|
30
|
+
txId?: string;
|
|
31
|
+
/** Optional diagnostics for operator-facing scripts and services. */
|
|
32
|
+
debug?: LongYieldCarryTransactionPlanDebug;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface LongYieldCarryTransactionPlanDebug {
|
|
36
|
+
processAsyncBurn?: {
|
|
37
|
+
epochId: bigint;
|
|
38
|
+
sequence: bigint;
|
|
39
|
+
request: Address;
|
|
40
|
+
user: Address;
|
|
41
|
+
/** How collateral is delivered when the request is processed. */
|
|
42
|
+
collateralDelivery: "nativeSol" | "tokenAta";
|
|
43
|
+
/** Populated for non-native collateral mints. */
|
|
44
|
+
userCollateralAccount?: Address;
|
|
45
|
+
/** Populated for wrapped SOL collateral (request-scoped WSOL escrow). */
|
|
46
|
+
requestCollateralAccount?: Address;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// =============================================================================
|
|
51
|
+
// mint_token
|
|
52
|
+
// =============================================================================
|
|
53
|
+
|
|
54
|
+
export interface MintTokenTxParams {
|
|
55
|
+
/**
|
|
56
|
+
* Collateral amount to deposit in base units (e.g. lamports).
|
|
57
|
+
*
|
|
58
|
+
* Pass `"all"` to deposit the entire collateral ATA balance. The on-chain
|
|
59
|
+
* instruction resolves `u64::MAX` to the ATA's live balance at execution time.
|
|
60
|
+
*/
|
|
61
|
+
depositAmount: BN | "all";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// =============================================================================
|
|
65
|
+
// burn_token
|
|
66
|
+
// =============================================================================
|
|
67
|
+
|
|
68
|
+
export interface BurnTokenTxParams {
|
|
69
|
+
/**
|
|
70
|
+
* yToken amount to burn in base units (e.g. lamports for a 9-decimal token).
|
|
71
|
+
*
|
|
72
|
+
* Pass `"all"` to burn every yToken in the user's ATA. The on-chain
|
|
73
|
+
* instruction resolves `u64::MAX` to the ATA's live balance at execution time.
|
|
74
|
+
*/
|
|
75
|
+
burnAmount: BN | number | "all";
|
|
76
|
+
/**
|
|
77
|
+
* Override the auto-derived redemption epoch ID. Defaults to
|
|
78
|
+
* {@link currentEpochId} (floored to the nearest minute).
|
|
79
|
+
*/
|
|
80
|
+
epochId?: BN | number;
|
|
81
|
+
/**
|
|
82
|
+
* Override the auto-derived request sequence within the epoch. Defaults to
|
|
83
|
+
* the next available sequence read from on-chain epoch state (or 0 for a
|
|
84
|
+
* fresh epoch).
|
|
85
|
+
*/
|
|
86
|
+
requestSequence?: BN | number;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// =============================================================================
|
|
90
|
+
// rebalance_yielding_bank
|
|
91
|
+
// =============================================================================
|
|
92
|
+
|
|
93
|
+
export interface RebalanceSwapSpec {
|
|
94
|
+
/**
|
|
95
|
+
* Swap client used to quote and build CPI data for this rebalance leg.
|
|
96
|
+
* When omitted, `getRebalanceYieldingBankTx` uses the transaction client's
|
|
97
|
+
* default aggregate swap client (Perena for USD* ↔ supported stables, Jupiter otherwise).
|
|
98
|
+
*/
|
|
99
|
+
swapClient?: SwapClient;
|
|
100
|
+
/** Mint being sold. */
|
|
101
|
+
inputMint: Address;
|
|
102
|
+
/** Mint being bought. */
|
|
103
|
+
outputMint: Address;
|
|
104
|
+
/** Exact input or requested quote amount, depending on the swap client. */
|
|
105
|
+
amount: number;
|
|
106
|
+
/** Slippage tolerance in basis points. Defaults to the caller's chosen swap behavior. */
|
|
107
|
+
slippageBps?: number;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Extra account that backs an asset holding's off-ATA liquidity during refresh.
|
|
112
|
+
*
|
|
113
|
+
* Example: a Perena withdrawal queue that temporarily escrows USD*-J shares after
|
|
114
|
+
* `request_unstake_junior`, while the YieldingBank still economically owns them.
|
|
115
|
+
*/
|
|
116
|
+
export interface YieldingBankExternalLiquiditySource {
|
|
117
|
+
/** Asset mint whose refresh should include this external source. */
|
|
118
|
+
mint: Address;
|
|
119
|
+
/** Account holding the pending balance for that mint. */
|
|
120
|
+
account: Address;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Inputs for `client.tx.rebalanceYieldingBank.getTx({...})`.
|
|
125
|
+
*
|
|
126
|
+
* The transaction must be signed by the program's manager; ATA setup in the plan uses the
|
|
127
|
+
* client's environment manager address.
|
|
128
|
+
*/
|
|
129
|
+
export interface RebalanceYieldingBankTxParams {
|
|
130
|
+
/** Pre-built CPI descriptors (one per swap / deposit step). */
|
|
131
|
+
cpiData?: CpiData[];
|
|
132
|
+
/**
|
|
133
|
+
* High-level swap specifications. Each is resolved into CPI data by calling
|
|
134
|
+
* `getQuote` + `getSwapCpiData` on the leg's `swapClient`, or the SDK aggregate
|
|
135
|
+
* swap client when `swapClient` is omitted. Resolved CPI data is appended after
|
|
136
|
+
* any explicit `cpiData` entries.
|
|
137
|
+
*/
|
|
138
|
+
swaps?: RebalanceSwapSpec[];
|
|
139
|
+
/**
|
|
140
|
+
* Optional new holding or external position to register before the
|
|
141
|
+
* rebalance executes.
|
|
142
|
+
*/
|
|
143
|
+
newAllocation?: {
|
|
144
|
+
config: YieldingBankAllocationConfig;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// =============================================================================
|
|
149
|
+
// refresh_tokens
|
|
150
|
+
// =============================================================================
|
|
151
|
+
|
|
152
|
+
export interface RefreshTokensTxParams {
|
|
153
|
+
/** Token PDA addresses to refresh. */
|
|
154
|
+
tokens: Address[];
|
|
155
|
+
/**
|
|
156
|
+
* When true, always prepend `refresh_yielding_bank` for each bank referenced
|
|
157
|
+
* by the token's active carry positions, even if the bank appears fresh
|
|
158
|
+
* client-side.
|
|
159
|
+
*
|
|
160
|
+
* When false (default), the builder skips yielding-bank refreshes whose
|
|
161
|
+
* cached `lastRefreshedTs` is still inside the normal freshness window.
|
|
162
|
+
*/
|
|
163
|
+
alwaysRefreshYieldingBanks?: boolean;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// =============================================================================
|
|
167
|
+
// top_up_unlent_reserves
|
|
168
|
+
// =============================================================================
|
|
169
|
+
|
|
170
|
+
export interface TopUpUnlentReservesTxParams {
|
|
171
|
+
/** Index into the token's lending_positions array for the source position. */
|
|
172
|
+
lendingPositionIndex: number;
|
|
173
|
+
/**
|
|
174
|
+
* Withdrawal amount in UI units (e.g. 1.5 for 1.5 SOL).
|
|
175
|
+
* Pass `"all"` to withdraw the entire lending position's collateral.
|
|
176
|
+
*/
|
|
177
|
+
uiAmount: number | "all";
|
|
178
|
+
/** Optional redemption epoch PDA to credit with the withdrawn amount. */
|
|
179
|
+
redemptionEpoch?: Address;
|
|
180
|
+
/** Optional txId reused across composed plans in the same transaction. */
|
|
181
|
+
txId?: string;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// =============================================================================
|
|
185
|
+
// process_async_burn
|
|
186
|
+
// =============================================================================
|
|
187
|
+
|
|
188
|
+
export interface ProcessAsyncBurnTxParams {
|
|
189
|
+
/** Epoch ID (the minute-bucketed timestamp used when the epoch was created). */
|
|
190
|
+
epochId: bigint | number;
|
|
191
|
+
/** FIFO sequence number of the request to process within the epoch. */
|
|
192
|
+
sequence: bigint | number;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// =============================================================================
|
|
196
|
+
// deposit_unlent_collateral
|
|
197
|
+
// =============================================================================
|
|
198
|
+
|
|
199
|
+
export interface DepositUnlentCollateralTxParams {
|
|
200
|
+
/** Index into the token's lending_positions array for the target position. */
|
|
201
|
+
lendingPositionIndex: number;
|
|
202
|
+
/**
|
|
203
|
+
* Deposit amount in UI units (e.g. 1.5 for 1.5 SOL).
|
|
204
|
+
* Required unless `depositAll` is true.
|
|
205
|
+
*/
|
|
206
|
+
uiAmount?: number;
|
|
207
|
+
/**
|
|
208
|
+
* When true, deposits all remaining unlent collateral. The token account
|
|
209
|
+
* is fetched to determine the exact amount, so `uiAmount` can be omitted.
|
|
210
|
+
*/
|
|
211
|
+
depositAll?: boolean;
|
|
212
|
+
/** Optional txId reused across composed plans in the same transaction. */
|
|
213
|
+
txId?: string;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// =============================================================================
|
|
217
|
+
// increase_carry_position
|
|
218
|
+
// =============================================================================
|
|
219
|
+
|
|
220
|
+
export interface IncreaseCarryPositionTxParams {
|
|
221
|
+
/** Index into the token's lending_positions array for the position to borrow against. */
|
|
222
|
+
lendingPositionIndex: number;
|
|
223
|
+
/** The YieldingBank PDA receiving the borrow proceeds. */
|
|
224
|
+
yieldingBank: Address;
|
|
225
|
+
/** Borrow amount in UI units (e.g. 100 for 100 USDC). */
|
|
226
|
+
uiAmount: number;
|
|
227
|
+
/** Optional txId reused across composed plans in the same transaction. */
|
|
228
|
+
txId?: string;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Inputs for `client.tx.rebalanceToken.getTx({...})`.
|
|
233
|
+
*
|
|
234
|
+
* When the source lending position would exceed target utilization after the
|
|
235
|
+
* collateral withdrawal, the builder automatically constructs the flash-loan-
|
|
236
|
+
* wrapped variant: flash-borrow source debt mint → repay source → withdraw
|
|
237
|
+
* collateral → deposit to destination → borrow destination debt mint →
|
|
238
|
+
* exact-out swap back to source debt mint → flash-repay.
|
|
239
|
+
*/
|
|
240
|
+
export interface RebalanceTokenTxParams {
|
|
241
|
+
/** Index into the token's lending_positions array for the position to rebalance in-place. */
|
|
242
|
+
lpIndex: number;
|
|
243
|
+
/**
|
|
244
|
+
* Target debt mint. The position's current debt is fully repaid via flash loan and this mint
|
|
245
|
+
* is borrowed instead on the same lending position. The builder resolves the corresponding
|
|
246
|
+
* reserve via `fetchReserveByMint` and the oracle via the oracle registry.
|
|
247
|
+
*/
|
|
248
|
+
destinationDebtMint: Address;
|
|
249
|
+
/**
|
|
250
|
+
* Collateral amount used for destination borrow capacity sizing, in UI units. Pass `"all"` to
|
|
251
|
+
* size based on the full current source debt (uses the platform's repay-all sentinel so
|
|
252
|
+
* on-chain interest accrual between snapshot and landing cannot leave dust).
|
|
253
|
+
*/
|
|
254
|
+
uiAmount: number | "all";
|
|
255
|
+
/** Slippage tolerance for the exact-out flash swap, in basis points. Defaults to 100. */
|
|
256
|
+
swapSlippageBps?: number;
|
|
257
|
+
/**
|
|
258
|
+
* Maximum acceptable execution cost (route fees + price impact) of the
|
|
259
|
+
* rebalance swap quote vs the oracle-fair cross rate, in bps (see
|
|
260
|
+
* `FlashRebalanceParams.maxSwapCostBps`). When breached, `getTx` throws
|
|
261
|
+
* `FlashRebalanceSwapCostExceededError` instead of returning a plan.
|
|
262
|
+
* Unset = no limit.
|
|
263
|
+
*/
|
|
264
|
+
maxSwapCostBps?: number;
|
|
265
|
+
/**
|
|
266
|
+
* Maximum acceptable market basis between the two debt stables (oracle-fair
|
|
267
|
+
* cross rate vs 1:1), in bps, either direction (see
|
|
268
|
+
* `FlashRebalanceParams.maxMarketBasisBps`). Unset = no limit.
|
|
269
|
+
*/
|
|
270
|
+
maxMarketBasisBps?: number;
|
|
271
|
+
/** Optional explicit overrides for the LP refresh accounts (user account, collateral reserve, debt oracle). */
|
|
272
|
+
lpPosition?: TokenLpPositionAccountOverrides;
|
|
273
|
+
/**
|
|
274
|
+
* Optional transaction identifier shared with lending clients so composed
|
|
275
|
+
* flows can hoist top-level pre-instructions.
|
|
276
|
+
*/
|
|
277
|
+
txId?: string;
|
|
278
|
+
/**
|
|
279
|
+
* Yielding bank that absorbs the destination-debt slippage dust after the
|
|
280
|
+
* exact-out swap. Defaults to the first active yielding bank recorded in the
|
|
281
|
+
* token's `debtCarry` entries.
|
|
282
|
+
*/
|
|
283
|
+
yieldingBank?: Address;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export interface DecreaseCarryPositionTxBuilderParams {
|
|
287
|
+
/** Index into the token's `lendingPositions` array for the position to repay. */
|
|
288
|
+
lendingPositionIndex: number;
|
|
289
|
+
/** Yielding bank PDA holding the funds that will be redeemed or swapped for repayment. */
|
|
290
|
+
yieldingBank: Address;
|
|
291
|
+
/** Slippage tolerance for any required DCP swap, in basis points. Defaults to `40`. */
|
|
292
|
+
swapSlippageBps?: number;
|
|
293
|
+
/** DEX labels to exclude from any required DCP swap (e.g. venues that failed a prior attempt). */
|
|
294
|
+
swapExcludeDexes?: string[];
|
|
295
|
+
/**
|
|
296
|
+
* Optional override for the asset redeemed from the yielding bank.
|
|
297
|
+
*
|
|
298
|
+
* Defaults to the bank's `defaultRedemptionMint`. On-chain permission checks
|
|
299
|
+
* may reject non-manager callers that override this away from the configured
|
|
300
|
+
* default redemption mint.
|
|
301
|
+
*/
|
|
302
|
+
sourceMint?: Address;
|
|
303
|
+
/**
|
|
304
|
+
* Optional transaction identifier shared with the lending client.
|
|
305
|
+
*
|
|
306
|
+
* Reuse a parent transaction ID when composing this flow into a larger
|
|
307
|
+
* transaction so lending pre-instructions are not duplicated.
|
|
308
|
+
*/
|
|
309
|
+
txId?: string;
|
|
310
|
+
/** See {@link DecreaseCarryRepaySteering}. */
|
|
311
|
+
repaySteering?: DecreaseCarryRepaySteering;
|
|
312
|
+
/**
|
|
313
|
+
* Same as {@link DecreaseCarryPositionBuilderParams.permissionlessOperation}: when true,
|
|
314
|
+
* non-manager callers may execute the resulting plan subject to post-repay validation.
|
|
315
|
+
*/
|
|
316
|
+
permissionlessOperation?: boolean;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Inputs accepted by `client.tx.decreaseCarryPosition.getTx({...})`.
|
|
321
|
+
*
|
|
322
|
+
* Pass raw builder params to have the SDK plan the instruction for you, or
|
|
323
|
+
* pass `{ plan }` when you have pre-built a plan via `buildDecreaseCarryPositionPlan`.
|
|
324
|
+
*/
|
|
325
|
+
export type DecreaseCarryPositionTxParams =
|
|
326
|
+
| DecreaseCarryPositionTxBuilderParams
|
|
327
|
+
| DecreaseCarryPositionTxPlanParams;
|
|
328
|
+
|
|
329
|
+
// =============================================================================
|
|
330
|
+
// recollateralize_loss
|
|
331
|
+
// =============================================================================
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Inputs for `client.tx.recollateralizeLoss.getTx({...})`.
|
|
335
|
+
*
|
|
336
|
+
* The transaction builder internally:
|
|
337
|
+
* 1. Computes the debt excess (total_debt − total_carry) from on-chain state.
|
|
338
|
+
* 2. Quotes a collateral → debt swap to cover that excess.
|
|
339
|
+
* 3. Checks whether withdrawing the required collateral would push the LP
|
|
340
|
+
* above its target utilization rate. If so, prepends a
|
|
341
|
+
* `decrease_carry_position` sized to free the needed headroom.
|
|
342
|
+
* 4. Builds the Withdraw → Swap → Repay CPI sequence for the main instruction.
|
|
343
|
+
*/
|
|
344
|
+
export interface RecollateralizeLossTxParams {
|
|
345
|
+
/** Slippage tolerance for swaps (collateral → debt), in basis points. Defaults to 150. */
|
|
346
|
+
swapSlippageBps?: number;
|
|
347
|
+
/**
|
|
348
|
+
* Optional override for the asset redeemed from the yielding bank during DCP.
|
|
349
|
+
* Defaults to the bank's `defaultRedemptionMint`. Only used when a
|
|
350
|
+
* `decrease_carry_position` is needed to free collateral for the withdrawal.
|
|
351
|
+
*/
|
|
352
|
+
sourceMint?: Address;
|
|
353
|
+
/** Optional txId shared with lending clients for pre-instruction deduplication. */
|
|
354
|
+
txId?: string;
|
|
355
|
+
/** Optional explicit overrides for LP refresh accounts. */
|
|
356
|
+
lpPosition?: TokenLpPositionAccountOverrides;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// =============================================================================
|
|
360
|
+
// collect_interest
|
|
361
|
+
// =============================================================================
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Inputs accepted by `client.tx.collectInterest.getTx({...})`.
|
|
365
|
+
*/
|
|
366
|
+
export interface CollectInterestTxParams {
|
|
367
|
+
/** Yielding bank whose carry position should collect accrued interest. */
|
|
368
|
+
yieldingBank: Address;
|
|
369
|
+
/** Slippage tolerance applied to all swaps. Defaults to 100 bps. */
|
|
370
|
+
slippageBps?: number;
|
|
371
|
+
/** Final output mint. Defaults to the token's collateral mint. */
|
|
372
|
+
outputMint?: Address;
|
|
373
|
+
/**
|
|
374
|
+
* Minimum net yield (in USD) below which collection is skipped.
|
|
375
|
+
* Prevents wasteful swaps when accrued interest is negligible.
|
|
376
|
+
* Value is in human-readable USD (e.g. 0.5 = $0.50).
|
|
377
|
+
*/
|
|
378
|
+
minYieldUsd?: number;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// =============================================================================
|
|
382
|
+
// claim_incentives
|
|
383
|
+
// =============================================================================
|
|
384
|
+
|
|
385
|
+
export interface ClaimIncentivesTxParams {
|
|
386
|
+
/** Index into the token's lending_positions array. */
|
|
387
|
+
lendingPositionIndex: number;
|
|
388
|
+
/** Incentive reward mint to harvest. */
|
|
389
|
+
incentiveMint: Address;
|
|
390
|
+
/**
|
|
391
|
+
* Pre-resolved farm and user-farm addresses for the claim CPI. When provided
|
|
392
|
+
* the builder skips the on-chain incentive lookup — required when the same
|
|
393
|
+
* incentive mint appears from multiple farms (obligation vs. direct).
|
|
394
|
+
*/
|
|
395
|
+
claimAccounts?: { farm: Address; userFarm: Address };
|
|
396
|
+
/**
|
|
397
|
+
* Yielding bank that receives the claimed rewards. Defaults to the first
|
|
398
|
+
* active yielding bank recorded in the token's `debtCarry` entries.
|
|
399
|
+
*/
|
|
400
|
+
yieldingBank?: Address;
|
|
401
|
+
/**
|
|
402
|
+
* Oracle pricing `incentiveMint`. Auto-resolved when the mint matches the
|
|
403
|
+
* debt of an active lending position or is in the shared mints registry;
|
|
404
|
+
* required otherwise.
|
|
405
|
+
*/
|
|
406
|
+
incentiveOracle?: Address;
|
|
407
|
+
/** Oracle type for `incentiveOracle`. Auto-resolved when `incentiveOracle` is. */
|
|
408
|
+
incentiveOracleType?: AnchorOracleType;
|
|
409
|
+
}
|