@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,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PERENA_PROGRAM_ID = void 0;
|
|
4
|
+
const kit_1 = require("@solana/kit");
|
|
5
|
+
/**
|
|
6
|
+
* Perena Bankineco Program ID (prod)
|
|
7
|
+
*/
|
|
8
|
+
exports.PERENA_PROGRAM_ID = (0, kit_1.address)("save8RQVPMWNTzU18t3GBvBkN9hT7jsGjiCQ28FpD9H");
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BN } from "@anchor-lang/core";
|
|
2
|
+
/**
|
|
3
|
+
* Inner arguments for Perena burn CPI.
|
|
4
|
+
*
|
|
5
|
+
* Matches Rust `PerenaBurnArgs` in perena_helpers/src/cpi/burn.rs.
|
|
6
|
+
* Borsh size: 16 bytes (2 × u64 LE).
|
|
7
|
+
*/
|
|
8
|
+
export interface PerenaBurnArgs {
|
|
9
|
+
/** Amount of USD* to burn */
|
|
10
|
+
amountToBurn: bigint | BN | number;
|
|
11
|
+
/** Minimum yielding tokens to receive (slippage protection) */
|
|
12
|
+
minimumYieldingWithdrawn: bigint | BN | number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get raw borsh bytes for Perena burn CPI args.
|
|
16
|
+
*
|
|
17
|
+
* Returns a 16-byte `Uint8Array` (2 × u64 LE) — no length prefix.
|
|
18
|
+
* Pass the result to `CpiArgsBuilder.add()` or `serializeArgs()`.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const cpiArgs = new CpiArgsBuilder()
|
|
23
|
+
* .add(getPerenaBurnArgs({ amountToBurn: 1_000_000, minimumYieldingWithdrawn: 900_000 }))
|
|
24
|
+
* .build();
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function getPerenaBurnArgs(data: PerenaBurnArgs): Uint8Array;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPerenaBurnArgs = getPerenaBurnArgs;
|
|
4
|
+
/**
|
|
5
|
+
* Get raw borsh bytes for Perena burn CPI args.
|
|
6
|
+
*
|
|
7
|
+
* Returns a 16-byte `Uint8Array` (2 × u64 LE) — no length prefix.
|
|
8
|
+
* Pass the result to `CpiArgsBuilder.add()` or `serializeArgs()`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const cpiArgs = new CpiArgsBuilder()
|
|
13
|
+
* .add(getPerenaBurnArgs({ amountToBurn: 1_000_000, minimumYieldingWithdrawn: 900_000 }))
|
|
14
|
+
* .build();
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
function getPerenaBurnArgs(data) {
|
|
18
|
+
const buf = Buffer.alloc(16);
|
|
19
|
+
buf.writeBigUInt64LE(BigInt(data.amountToBurn.toString()), 0);
|
|
20
|
+
buf.writeBigUInt64LE(BigInt(data.minimumYieldingWithdrawn.toString()), 8);
|
|
21
|
+
return buf;
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./mint"), exports);
|
|
18
|
+
__exportStar(require("./burn"), exports);
|
|
19
|
+
__exportStar(require("./requestUnstake"), exports);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BN } from "@anchor-lang/core";
|
|
2
|
+
/**
|
|
3
|
+
* Inner arguments for Perena mint CPI.
|
|
4
|
+
*
|
|
5
|
+
* Matches Rust `PerenaMintArgs` in perena_helpers/src/cpi/mint.rs.
|
|
6
|
+
* Borsh size: 16 bytes (2 × u64 LE).
|
|
7
|
+
*/
|
|
8
|
+
export interface PerenaMintArgs {
|
|
9
|
+
/** Amount of yielding tokens to deposit (e.g., USDC amount) */
|
|
10
|
+
amountYieldingDeposit: bigint | BN | number;
|
|
11
|
+
/** Minimum USD* to receive (slippage protection) */
|
|
12
|
+
minBankMintMinted: bigint | BN | number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get raw borsh bytes for Perena mint CPI args.
|
|
16
|
+
*
|
|
17
|
+
* Returns a 16-byte `Uint8Array` (2 × u64 LE) — no length prefix.
|
|
18
|
+
* Pass the result to `CpiArgsBuilder.add()` or `serializeArgs()`.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const cpiArgs = new CpiArgsBuilder()
|
|
23
|
+
* .add(getPerenaMintArgs({ amountYieldingDeposit: 1_000_000, minBankMintMinted: 900_000 }))
|
|
24
|
+
* .build();
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function getPerenaMintArgs(data: PerenaMintArgs): Uint8Array;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPerenaMintArgs = getPerenaMintArgs;
|
|
4
|
+
/**
|
|
5
|
+
* Get raw borsh bytes for Perena mint CPI args.
|
|
6
|
+
*
|
|
7
|
+
* Returns a 16-byte `Uint8Array` (2 × u64 LE) — no length prefix.
|
|
8
|
+
* Pass the result to `CpiArgsBuilder.add()` or `serializeArgs()`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const cpiArgs = new CpiArgsBuilder()
|
|
13
|
+
* .add(getPerenaMintArgs({ amountYieldingDeposit: 1_000_000, minBankMintMinted: 900_000 }))
|
|
14
|
+
* .build();
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
function getPerenaMintArgs(data) {
|
|
18
|
+
const buf = Buffer.alloc(16);
|
|
19
|
+
buf.writeBigUInt64LE(BigInt(data.amountYieldingDeposit.toString()), 0);
|
|
20
|
+
buf.writeBigUInt64LE(BigInt(data.minBankMintMinted.toString()), 8);
|
|
21
|
+
return buf;
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BN } from "@anchor-lang/core";
|
|
2
|
+
/**
|
|
3
|
+
* Inner arguments for Perena request_unstake_junior CPI.
|
|
4
|
+
*
|
|
5
|
+
* Matches the Anchor `request_unstake_junior` instruction args.
|
|
6
|
+
* Borsh size: 9 bytes (1 × u64 LE + 1 × u8).
|
|
7
|
+
*/
|
|
8
|
+
export interface PerenaRequestUnstakeArgs {
|
|
9
|
+
/** Number of junior shares to lock in the withdrawal queue */
|
|
10
|
+
shares: BN | number;
|
|
11
|
+
/** Queue slot id (0–255) — unique per user per bank */
|
|
12
|
+
queueId: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get raw borsh bytes for Perena request_unstake_junior CPI args.
|
|
16
|
+
*
|
|
17
|
+
* Returns a 9-byte `Uint8Array` (u64 LE + u8) — no length prefix.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getPerenaRequestUnstakeArgs(data: PerenaRequestUnstakeArgs): Uint8Array;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPerenaRequestUnstakeArgs = getPerenaRequestUnstakeArgs;
|
|
4
|
+
const common_1 = require("common");
|
|
5
|
+
/**
|
|
6
|
+
* Get raw borsh bytes for Perena request_unstake_junior CPI args.
|
|
7
|
+
*
|
|
8
|
+
* Returns a 9-byte `Uint8Array` (u64 LE + u8) — no length prefix.
|
|
9
|
+
*/
|
|
10
|
+
function getPerenaRequestUnstakeArgs(data) {
|
|
11
|
+
const sharesBytes = (0, common_1.numToU64Bytes)(data.shares);
|
|
12
|
+
const buf = Buffer.alloc(9);
|
|
13
|
+
Buffer.from(sharesBytes).copy(buf, 0);
|
|
14
|
+
buf.writeUInt8(data.queueId, 8);
|
|
15
|
+
return buf;
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./constants"), exports);
|
|
18
|
+
__exportStar(require("./client"), exports);
|
|
19
|
+
__exportStar(require("./accounts"), exports);
|
|
20
|
+
__exportStar(require("./cpi"), exports);
|
|
21
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Address } from "@solana/kit";
|
|
2
|
+
import { type CpiData } from "common";
|
|
3
|
+
import { PerenaClient } from "./client";
|
|
4
|
+
/**
|
|
5
|
+
* Extract Perena withdrawal queue accounts referenced by request/fulfill-unstake
|
|
6
|
+
* CPI data.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getPerenaWithdrawalQueueAddressesFromCpiData(cpiData: readonly CpiData[]): Address[];
|
|
9
|
+
export declare function getGeneralLookupTableAccountsForPerena(perenaClient: PerenaClient): Promise<Address[]>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPerenaWithdrawalQueueAddressesFromCpiData = getPerenaWithdrawalQueueAddressesFromCpiData;
|
|
4
|
+
exports.getGeneralLookupTableAccountsForPerena = getGeneralLookupTableAccountsForPerena;
|
|
5
|
+
const common_1 = require("common");
|
|
6
|
+
/**
|
|
7
|
+
* Extract Perena withdrawal queue accounts referenced by request/fulfill-unstake
|
|
8
|
+
* CPI data.
|
|
9
|
+
*/
|
|
10
|
+
function getPerenaWithdrawalQueueAddressesFromCpiData(cpiData) {
|
|
11
|
+
return cpiData
|
|
12
|
+
.filter((cpi) => cpi.cpiType === common_1.CpiTypes.PERENA_REQUEST_UNSTAKE ||
|
|
13
|
+
cpi.cpiType === common_1.CpiTypes.PERENA_FULFILL_UNSTAKE)
|
|
14
|
+
.map((cpi) => cpi.accounts[2]?.address)
|
|
15
|
+
.filter((address) => address !== undefined);
|
|
16
|
+
}
|
|
17
|
+
async function getGeneralLookupTableAccountsForPerena(perenaClient) {
|
|
18
|
+
const bankMintInfo = common_1.mints.get("USD*");
|
|
19
|
+
const juniorMintInfo = common_1.mints.get("USD*-J");
|
|
20
|
+
const usdcMintInfo = common_1.mints.get("USDC");
|
|
21
|
+
if (!bankMintInfo || !juniorMintInfo || !usdcMintInfo) {
|
|
22
|
+
throw new Error("USD*, USD*-J, and USDC must exist in the mint registry");
|
|
23
|
+
}
|
|
24
|
+
const dummyUser = common_1.DEFAULT_PUBLIC_KEY;
|
|
25
|
+
const bankMintUserAta = await (0, common_1.getAtaAddress)(bankMintInfo.address, dummyUser, bankMintInfo.tokenProgram);
|
|
26
|
+
const juniorMintUserAta = await (0, common_1.getAtaAddress)(juniorMintInfo.address, dummyUser, juniorMintInfo.tokenProgram);
|
|
27
|
+
const usdcMintUserAta = await (0, common_1.getAtaAddress)(usdcMintInfo.address, dummyUser, usdcMintInfo.tokenProgram);
|
|
28
|
+
const allAccounts = [];
|
|
29
|
+
const stakeQuote = await perenaClient.getQuote({
|
|
30
|
+
inputMint: bankMintInfo.address,
|
|
31
|
+
outputMint: juniorMintInfo.address,
|
|
32
|
+
amount: (0, common_1.wholeTokenAmount)(bankMintInfo.decimals),
|
|
33
|
+
slippageBps: 50,
|
|
34
|
+
});
|
|
35
|
+
const stakeCpi = await perenaClient.getSwapCpiData(stakeQuote, dummyUser);
|
|
36
|
+
allAccounts.push(...(0, common_1.filterSpecificAccounts)(stakeCpi.accounts.map((account) => account.address), [common_1.DEFAULT_PUBLIC_KEY, bankMintUserAta, juniorMintUserAta]));
|
|
37
|
+
const mintQuote = await perenaClient.getQuote({
|
|
38
|
+
inputMint: usdcMintInfo.address,
|
|
39
|
+
outputMint: bankMintInfo.address,
|
|
40
|
+
amount: (0, common_1.wholeTokenAmount)(usdcMintInfo.decimals),
|
|
41
|
+
slippageBps: 50,
|
|
42
|
+
});
|
|
43
|
+
const mintCpi = await perenaClient.getSwapCpiData(mintQuote, dummyUser);
|
|
44
|
+
allAccounts.push(...(0, common_1.filterSpecificAccounts)(mintCpi.accounts.map((account) => account.address), [common_1.DEFAULT_PUBLIC_KEY, usdcMintUserAta, bankMintUserAta]));
|
|
45
|
+
const burnQuote = await perenaClient.getQuote({
|
|
46
|
+
inputMint: bankMintInfo.address,
|
|
47
|
+
outputMint: usdcMintInfo.address,
|
|
48
|
+
amount: (0, common_1.wholeTokenAmount)(bankMintInfo.decimals),
|
|
49
|
+
slippageBps: 50,
|
|
50
|
+
});
|
|
51
|
+
const burnCpi = await perenaClient.getSwapCpiData(burnQuote, dummyUser);
|
|
52
|
+
allAccounts.push(...(0, common_1.filterSpecificAccounts)(burnCpi.accounts.map((account) => account.address), [common_1.DEFAULT_PUBLIC_KEY, bankMintUserAta, usdcMintUserAta]));
|
|
53
|
+
return (0, common_1.dedupeOrderedAddresses)(allAccounts);
|
|
54
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type Address } from "@solana/kit";
|
|
2
|
+
import { type CpiData, type SwapClient, type SwapQuoteParams, type SwapQuoteCoveringMinOutputParams, type SwapQuote, type SwapInstructionOptions, type Environment } from "common";
|
|
3
|
+
import { type JupiterSwapClientConfig } from "jupiter-helpers";
|
|
4
|
+
/**
|
|
5
|
+
* Internal wrapper around a sub-client's quote so we can route
|
|
6
|
+
* `getSwapCpiData` back to the correct client.
|
|
7
|
+
*/
|
|
8
|
+
interface AggRawQuote {
|
|
9
|
+
routeKey: string;
|
|
10
|
+
innerQuote: SwapQuote<any>;
|
|
11
|
+
}
|
|
12
|
+
export type AggSwapQuote = SwapQuote<AggRawQuote>;
|
|
13
|
+
/**
|
|
14
|
+
* Optional routing-policy overrides for the aggregate swap client.
|
|
15
|
+
*/
|
|
16
|
+
export interface AggSwapClientConfig {
|
|
17
|
+
/** Optional default quote policy passed through to the Jupiter fallback client. */
|
|
18
|
+
jupiter?: JupiterSwapClientConfig;
|
|
19
|
+
}
|
|
20
|
+
export declare function createAggSwapClient(rpcUrl: string, environment: Environment): AggSwapClient;
|
|
21
|
+
/**
|
|
22
|
+
* Aggregating swap client that routes to the best available swap
|
|
23
|
+
* implementation based on {@link swapClientCanRoute} over an ordered list
|
|
24
|
+
* of {@link RoutableSwapClient}s (Perena first, then Jupiter).
|
|
25
|
+
*
|
|
26
|
+
* Routing priority:
|
|
27
|
+
* 1. **Perena** — when the pair is routable per Perena’s mint lists and anchors
|
|
28
|
+
* 2. **Jupiter** — fallback (wildcard routing metadata)
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const swapClient = new AggSwapClient(rpcUrl);
|
|
33
|
+
*
|
|
34
|
+
* // USD* <-> USDC goes through Perena
|
|
35
|
+
* const quote = await swapClient.getQuote({
|
|
36
|
+
* inputMint: USD_STAR_MINT,
|
|
37
|
+
* outputMint: USDC_MINT,
|
|
38
|
+
* amount: 10_000_000,
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* // USD*-J -> USD* goes through Perena
|
|
42
|
+
* const quote2 = await swapClient.getQuote({
|
|
43
|
+
* inputMint: USD_STAR_J_MINT,
|
|
44
|
+
* outputMint: USD_STAR_MINT,
|
|
45
|
+
* amount: 10_000_000,
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* // SOL -> USDC goes through Jupiter
|
|
49
|
+
* const quote3 = await swapClient.getQuote({
|
|
50
|
+
* inputMint: SOL_MINT,
|
|
51
|
+
* outputMint: USDC_MINT,
|
|
52
|
+
* amount: 1_000_000_000,
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare class AggSwapClient implements SwapClient<AggRawQuote> {
|
|
57
|
+
private readonly perena;
|
|
58
|
+
private readonly jupiter;
|
|
59
|
+
/** Priority order: first routable client wins. */
|
|
60
|
+
private readonly routeClients;
|
|
61
|
+
constructor(rpcUrl: string, config?: AggSwapClientConfig);
|
|
62
|
+
getQuote(params: SwapQuoteParams): Promise<AggSwapQuote>;
|
|
63
|
+
getSwapCpiData(quote: AggSwapQuote, userPublicKey: Address, options?: SwapInstructionOptions): Promise<CpiData>;
|
|
64
|
+
/**
|
|
65
|
+
* Route {@link SwapClient.getQuoteCoveringMinOutput} to the first backend that can
|
|
66
|
+
* handle the mint pair (Perena before Jupiter).
|
|
67
|
+
*/
|
|
68
|
+
getQuoteCoveringMinOutput(params: SwapQuoteCoveringMinOutputParams): Promise<AggSwapQuote>;
|
|
69
|
+
private wrapQuote;
|
|
70
|
+
}
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AggSwapClient = void 0;
|
|
4
|
+
exports.createAggSwapClient = createAggSwapClient;
|
|
5
|
+
const common_1 = require("common");
|
|
6
|
+
const jupiter_helpers_1 = require("jupiter-helpers");
|
|
7
|
+
const perena_helpers_1 = require("perena-helpers");
|
|
8
|
+
function createAggSwapClient(rpcUrl, environment) {
|
|
9
|
+
return new AggSwapClient(rpcUrl, {
|
|
10
|
+
jupiter: environment === "local"
|
|
11
|
+
? {
|
|
12
|
+
quoteDefaults: {
|
|
13
|
+
excludeDexes: jupiter_helpers_1.LOCAL_TEST_EXCLUDED_DEXES,
|
|
14
|
+
maxAccounts: jupiter_helpers_1.LOCAL_TEST_MAX_ACCOUNTS,
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
: undefined,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Aggregating swap client that routes to the best available swap
|
|
22
|
+
* implementation based on {@link swapClientCanRoute} over an ordered list
|
|
23
|
+
* of {@link RoutableSwapClient}s (Perena first, then Jupiter).
|
|
24
|
+
*
|
|
25
|
+
* Routing priority:
|
|
26
|
+
* 1. **Perena** — when the pair is routable per Perena’s mint lists and anchors
|
|
27
|
+
* 2. **Jupiter** — fallback (wildcard routing metadata)
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const swapClient = new AggSwapClient(rpcUrl);
|
|
32
|
+
*
|
|
33
|
+
* // USD* <-> USDC goes through Perena
|
|
34
|
+
* const quote = await swapClient.getQuote({
|
|
35
|
+
* inputMint: USD_STAR_MINT,
|
|
36
|
+
* outputMint: USDC_MINT,
|
|
37
|
+
* amount: 10_000_000,
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // USD*-J -> USD* goes through Perena
|
|
41
|
+
* const quote2 = await swapClient.getQuote({
|
|
42
|
+
* inputMint: USD_STAR_J_MINT,
|
|
43
|
+
* outputMint: USD_STAR_MINT,
|
|
44
|
+
* amount: 10_000_000,
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* // SOL -> USDC goes through Jupiter
|
|
48
|
+
* const quote3 = await swapClient.getQuote({
|
|
49
|
+
* inputMint: SOL_MINT,
|
|
50
|
+
* outputMint: USDC_MINT,
|
|
51
|
+
* amount: 1_000_000_000,
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
class AggSwapClient {
|
|
56
|
+
constructor(rpcUrl, config = {}) {
|
|
57
|
+
this.perena = new perena_helpers_1.PerenaClient(rpcUrl);
|
|
58
|
+
this.jupiter = new jupiter_helpers_1.JupiterSwapClient((0, common_1.createRpcWithRetry)(rpcUrl), config.jupiter);
|
|
59
|
+
this.routeClients = [
|
|
60
|
+
{ key: "perena", client: this.perena },
|
|
61
|
+
{ key: "jupiter", client: this.jupiter },
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
async getQuote(params) {
|
|
65
|
+
const match = this.routeClients.find(({ client }) => (0, common_1.swapClientCanRoute)(client, params.inputMint, params.outputMint));
|
|
66
|
+
if (!match) {
|
|
67
|
+
throw new Error("AggSwapClient: no backend can route this mint pair");
|
|
68
|
+
}
|
|
69
|
+
const innerQuote = await match.client.getQuote(params);
|
|
70
|
+
return this.wrapQuote(match.key, innerQuote);
|
|
71
|
+
}
|
|
72
|
+
async getSwapCpiData(quote, userPublicKey, options) {
|
|
73
|
+
const { routeKey, innerQuote } = quote.rawQuote;
|
|
74
|
+
const entry = this.routeClients.find((r) => r.key === routeKey);
|
|
75
|
+
if (!entry) {
|
|
76
|
+
throw new Error(`AggSwapClient: unknown routeKey ${routeKey}`);
|
|
77
|
+
}
|
|
78
|
+
return entry.client.getSwapCpiData(innerQuote, userPublicKey, options);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Route {@link SwapClient.getQuoteCoveringMinOutput} to the first backend that can
|
|
82
|
+
* handle the mint pair (Perena before Jupiter).
|
|
83
|
+
*/
|
|
84
|
+
async getQuoteCoveringMinOutput(params) {
|
|
85
|
+
const match = this.routeClients.find(({ client }) => (0, common_1.swapClientCanRoute)(client, params.inputMint, params.outputMint));
|
|
86
|
+
if (!match) {
|
|
87
|
+
throw new Error("AggSwapClient: no backend can route this mint pair");
|
|
88
|
+
}
|
|
89
|
+
const innerQuote = await match.client.getQuoteCoveringMinOutput(params);
|
|
90
|
+
return this.wrapQuote(match.key, innerQuote);
|
|
91
|
+
}
|
|
92
|
+
wrapQuote(routeKey, innerQuote) {
|
|
93
|
+
return {
|
|
94
|
+
inputMint: innerQuote.inputMint,
|
|
95
|
+
outputMint: innerQuote.outputMint,
|
|
96
|
+
inputAmount: innerQuote.inputAmount,
|
|
97
|
+
outputAmount: innerQuote.outputAmount,
|
|
98
|
+
priceImpactPct: innerQuote.priceImpactPct,
|
|
99
|
+
rawQuote: { routeKey, innerQuote },
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.AggSwapClient = AggSwapClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./aggSwapClient";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./aggSwapClient"), exports);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Launching a New Token
|
|
2
|
+
|
|
3
|
+
End-to-end steps to deploy a new yToken backed by a collateral (risk) asset.
|
|
4
|
+
|
|
5
|
+
## 1. Register the risk asset in shared packages
|
|
6
|
+
|
|
7
|
+
**Default mints** — add the collateral mint to `common/src/services/mints/defaults.ts` with the correct `address`, `symbol`, `decimals`, and `assetType` (`"Standard"` for most risk assets, `"LST"` for liquid staking tokens).
|
|
8
|
+
|
|
9
|
+
**Oracle feed** — add a Pyth or Switchboard entry for the collateral symbol in `oracle-service/src/constants/pyth.ts` (or the relevant Switchboard constants file). The `create-token` script reads the oracle from this registry.
|
|
10
|
+
|
|
11
|
+
**Lending platform accounts** — add reserves, pools, and any other protocol-specific accounts for the collateral and debt mints in `lending-platforms/src/constants/kamino.ts` (or the file for the relevant lending platform). Each reserve entry needs the on-chain reserve address and `mintSymbol`.
|
|
12
|
+
|
|
13
|
+
## 2. Create the on-chain Token account
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm lyc:create-token {test|prod} {COLLATERAL_SYMBOL}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Example: `pnpm lyc:create-token test SOL`
|
|
20
|
+
|
|
21
|
+
This mints a new yToken, derives the Token PDA, and calls `create_token` on-chain. Note the **Token PDA** printed in the output — you'll need it later.
|
|
22
|
+
|
|
23
|
+
## 3. Create a lending position on the token
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pnpm lyc:create-lp {test|prod} {TOKEN} {lowVol|highVol} [DEBT_SYMBOL] [POOL] [KEYPAIR_JSON]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Example: `pnpm lyc:create-lp test SOL lowVol USDC`
|
|
30
|
+
|
|
31
|
+
`TOKEN` is the collateral symbol (e.g. `SOL`) or the Token PDA address. `DEBT_SYMBOL` defaults to `USDC`. `POOL` defaults to the Kamino main market. The script resolves carry trade presets for the collateral asset and volatility regime, reads `maxLtv` and `liquidationThreshold` from on-chain reserves, and computes the lending allocation config.
|
|
32
|
+
|
|
33
|
+
## 4. Update lookup tables
|
|
34
|
+
|
|
35
|
+
Run all three in order:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pnpm kamino:update-lut
|
|
39
|
+
pnpm lyc:update-general-lut {test|prod}
|
|
40
|
+
pnpm lyc:update-token-luts {test|prod}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`kamino:update-lut` refreshes the Kamino lending platform LUT with any new reserves. `lyc:update-general-lut` refreshes the shared program LUT (program IDs, mints, oracles, yielding banks). `lyc:update-token-luts` creates or extends per-token LUTs with the token's mints, ATAs, and lending accounts. New tokens without an existing LUT entry get a fresh one created automatically.
|
|
44
|
+
|
|
45
|
+
## 5. Register the new token lookup table
|
|
46
|
+
|
|
47
|
+
After `lyc:update-token-luts` runs, it logs the address of any newly created lookup table. Add it to `TOKEN_LOOKUP_TABLES` in `typescript/sdks/long-yield-carry/src/constants/general.ts`, keyed by the Token PDA:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
export const TOKEN_LOOKUP_TABLES: Record<Address, Address> = {
|
|
51
|
+
// TEST
|
|
52
|
+
[address("<TOKEN_PDA>")]: address("<NEW_LUT_ADDRESS>"),
|
|
53
|
+
// ...
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This mapping is used by `mergeLycLookupTables` to attach the correct per-token LUT to every transaction involving that token.
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kestrelfi/lyc-sdk",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"license": "ISC",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"main": "src/index.ts",
|
|
9
|
+
"types": "src/index.ts",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@anchor-lang/core": "=0.32.1",
|
|
12
|
+
"@anchor-lang/errors": "=0.32.1",
|
|
13
|
+
"@anchor-lang/spl-token": "=0.32.1",
|
|
14
|
+
"@solana-program/address-lookup-table": "=0.7.0",
|
|
15
|
+
"@solana-program/system": "=0.10.0",
|
|
16
|
+
"@solana-program/token": "=0.5.1",
|
|
17
|
+
"@solana-program/token-2022": "=0.6.1",
|
|
18
|
+
"bs58": "5.0.0",
|
|
19
|
+
"common": "file:../../shared/common",
|
|
20
|
+
"dotenv": "^17.3.1",
|
|
21
|
+
"lending-platforms": "file:../../shared/lending-platforms",
|
|
22
|
+
"oracle": "file:../../shared/oracle-service",
|
|
23
|
+
"perena-helpers": "file:../../shared/perena-helpers",
|
|
24
|
+
"swap-aggregator": "file:../../shared/swap-aggregator"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@solana/web3.js": "=1.98.4",
|
|
28
|
+
"@types/bn.js": "^5.1.0",
|
|
29
|
+
"@types/chai": "^4.3.0",
|
|
30
|
+
"@types/mocha": "^9.0.0",
|
|
31
|
+
"chai": "^4.3.4",
|
|
32
|
+
"mocha": "^9.0.3",
|
|
33
|
+
"prettier": "^2.6.2",
|
|
34
|
+
"ts-mocha": "^10.0.0",
|
|
35
|
+
"tsx": "^4.19.2",
|
|
36
|
+
"typescript": "^5.7.3"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc",
|
|
40
|
+
"lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w",
|
|
41
|
+
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check",
|
|
42
|
+
"refresh": "tsx scripts/refresh.ts",
|
|
43
|
+
"update-general-lut": "tsx scripts/updateGeneralLut.ts",
|
|
44
|
+
"update-token-luts": "tsx scripts/updateTokenLuts.ts",
|
|
45
|
+
"create-token": "tsx scripts/createToken.ts",
|
|
46
|
+
"create-yielding-bank": "tsx scripts/createYieldingBank.ts",
|
|
47
|
+
"rebalance-yielding-bank": "tsx scripts/rebalanceYieldingBank.ts",
|
|
48
|
+
"mint-token": "tsx scripts/mintToken.ts",
|
|
49
|
+
"burn-token": "tsx scripts/burnToken.ts",
|
|
50
|
+
"async-burn": "tsx scripts/asyncBurn.ts",
|
|
51
|
+
"process-async-burns": "tsx scripts/processAsyncBurns.ts",
|
|
52
|
+
"deposit-unlent": "tsx scripts/depositUnlentCollateral.ts",
|
|
53
|
+
"withdraw-unlent": "tsx scripts/withdrawUnlentCollateral.ts",
|
|
54
|
+
"create-lp": "tsx scripts/createTokenLendingPosition.ts",
|
|
55
|
+
"update-lp-config": "tsx scripts/updateLendingPositionConfig.ts",
|
|
56
|
+
"inspect": "tsx scripts/inspect.ts",
|
|
57
|
+
"trigger-cb": "tsx scripts/emergency/triggerCircuitBreaker.ts",
|
|
58
|
+
"deleverage-all": "tsx scripts/emergency/deleverageAll.ts",
|
|
59
|
+
"update-token-metadata": "tsx scripts/updateTokenMetadata.ts",
|
|
60
|
+
"recollateralize-loss": "tsx scripts/recollateralizeLoss.ts",
|
|
61
|
+
"increase-carry": "tsx scripts/increaseCarryPositions.ts",
|
|
62
|
+
"decrease-carry": "tsx scripts/decreaseCarryPositions.ts",
|
|
63
|
+
"collect-interest": "tsx scripts/collectInterest.ts",
|
|
64
|
+
"collect-protocol-fees": "tsx scripts/collectProtocolFees.ts",
|
|
65
|
+
"reclaim-excess-rent": "tsx scripts/reclaimExcessRent.ts",
|
|
66
|
+
"close-cpi-plans": "tsx scripts/closeCpiPlans.ts",
|
|
67
|
+
"claim-incentives": "tsx scripts/claimIncentives.ts",
|
|
68
|
+
"update-yb-config": "tsx scripts/updateYieldingBankConfig.ts",
|
|
69
|
+
"compute-optimal-allocations": "tsx scripts/computeOptimalAllocations.ts",
|
|
70
|
+
"update-fees": "tsx scripts/updateFees.ts",
|
|
71
|
+
"rebalance-token": "tsx scripts/rebalanceToken.ts",
|
|
72
|
+
"debug:burn-yeth-all": "tsx scripts/debugBurnYethAll.ts",
|
|
73
|
+
"find-txs": "tsx scripts/findTxs.ts"
|
|
74
|
+
}
|
|
75
|
+
}
|