@kestrelfi/lyc-sdk 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/carry-XU3WUD22.mjs +20 -0
- package/dist/carry-XU3WUD22.mjs.map +1 -0
- package/dist/chunk-2T23QQCX.mjs +3707 -0
- package/dist/chunk-2T23QQCX.mjs.map +1 -0
- package/dist/chunk-GOW6CARW.mjs +3969 -0
- package/dist/chunk-GOW6CARW.mjs.map +1 -0
- package/dist/chunk-ZPXXY3QV.mjs +9330 -0
- package/dist/chunk-ZPXXY3QV.mjs.map +1 -0
- package/dist/{sdks/long-yield-carry/src/idl/long_yield_carry.d.ts → core-DP6wfpME.d.mts} +3242 -84
- package/dist/core-DP6wfpME.d.ts +10485 -0
- package/dist/core.d.mts +8 -0
- package/dist/core.d.ts +8 -0
- package/dist/core.js +12348 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +72 -0
- package/dist/core.mjs.map +1 -0
- package/dist/index.d.mts +2537 -0
- package/dist/index.d.ts +2537 -0
- package/dist/index.js +23884 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5898 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +56 -10
- package/.env.example +0 -11
- package/dist/sdks/long-yield-carry/scripts/asyncBurn.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/asyncBurn.js +0 -117
- package/dist/sdks/long-yield-carry/scripts/burnToken.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/burnToken.js +0 -98
- package/dist/sdks/long-yield-carry/scripts/claimIncentives.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/claimIncentives.js +0 -108
- package/dist/sdks/long-yield-carry/scripts/closeCpiPlans.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/closeCpiPlans.js +0 -93
- package/dist/sdks/long-yield-carry/scripts/collectInterest.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/collectInterest.js +0 -164
- package/dist/sdks/long-yield-carry/scripts/collectProtocolFees.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/collectProtocolFees.js +0 -120
- package/dist/sdks/long-yield-carry/scripts/computeOptimalAllocations.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/computeOptimalAllocations.js +0 -84
- package/dist/sdks/long-yield-carry/scripts/createToken.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/createToken.js +0 -76
- package/dist/sdks/long-yield-carry/scripts/createTokenLendingPosition.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/createTokenLendingPosition.js +0 -157
- package/dist/sdks/long-yield-carry/scripts/createYieldingBank.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/createYieldingBank.js +0 -69
- package/dist/sdks/long-yield-carry/scripts/decreaseCarryPositions.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/decreaseCarryPositions.js +0 -247
- package/dist/sdks/long-yield-carry/scripts/depositUnlentCollateral.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/depositUnlentCollateral.js +0 -90
- package/dist/sdks/long-yield-carry/scripts/emergency/deleverageAll.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/emergency/deleverageAll.js +0 -202
- package/dist/sdks/long-yield-carry/scripts/emergency/triggerCircuitBreaker.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/emergency/triggerCircuitBreaker.js +0 -68
- package/dist/sdks/long-yield-carry/scripts/env.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/env.js +0 -8
- package/dist/sdks/long-yield-carry/scripts/findTxs.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/findTxs.js +0 -143
- package/dist/sdks/long-yield-carry/scripts/increaseCarryPositions.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/increaseCarryPositions.js +0 -112
- package/dist/sdks/long-yield-carry/scripts/inspect/format.d.ts +0 -13
- package/dist/sdks/long-yield-carry/scripts/inspect/format.js +0 -363
- package/dist/sdks/long-yield-carry/scripts/inspect.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/inspect.js +0 -108
- package/dist/sdks/long-yield-carry/scripts/localUtils.d.ts +0 -53
- package/dist/sdks/long-yield-carry/scripts/localUtils.js +0 -191
- package/dist/sdks/long-yield-carry/scripts/mintToken.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/mintToken.js +0 -103
- package/dist/sdks/long-yield-carry/scripts/processAsyncBurns.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/processAsyncBurns.js +0 -76
- package/dist/sdks/long-yield-carry/scripts/rebalanceToken.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/rebalanceToken.js +0 -210
- package/dist/sdks/long-yield-carry/scripts/rebalanceYieldingBank.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/rebalanceYieldingBank.js +0 -149
- package/dist/sdks/long-yield-carry/scripts/recollateralizeLoss.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/recollateralizeLoss.js +0 -64
- package/dist/sdks/long-yield-carry/scripts/refresh.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/refresh.js +0 -101
- package/dist/sdks/long-yield-carry/scripts/updateFees.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/updateFees.js +0 -369
- package/dist/sdks/long-yield-carry/scripts/updateGeneralLut.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/updateGeneralLut.js +0 -27
- package/dist/sdks/long-yield-carry/scripts/updateLendingPositionConfig.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/updateLendingPositionConfig.js +0 -127
- package/dist/sdks/long-yield-carry/scripts/updateTokenLuts.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/updateTokenLuts.js +0 -27
- package/dist/sdks/long-yield-carry/scripts/updateTokenMetadata.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/updateTokenMetadata.js +0 -194
- package/dist/sdks/long-yield-carry/scripts/updateYieldingBankConfig.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/updateYieldingBankConfig.js +0 -84
- package/dist/sdks/long-yield-carry/scripts/withdrawUnlentCollateral.d.ts +0 -1
- package/dist/sdks/long-yield-carry/scripts/withdrawUnlentCollateral.js +0 -140
- package/dist/sdks/long-yield-carry/src/client/account.d.ts +0 -152
- package/dist/sdks/long-yield-carry/src/client/account.js +0 -349
- package/dist/sdks/long-yield-carry/src/client/builders/args.d.ts +0 -299
- package/dist/sdks/long-yield-carry/src/client/builders/args.js +0 -2
- package/dist/sdks/long-yield-carry/src/client/builders/asyncBurnBuilder.d.ts +0 -20
- package/dist/sdks/long-yield-carry/src/client/builders/asyncBurnBuilder.js +0 -212
- package/dist/sdks/long-yield-carry/src/client/builders/base.d.ts +0 -77
- package/dist/sdks/long-yield-carry/src/client/builders/base.js +0 -191
- package/dist/sdks/long-yield-carry/src/client/builders/burnTokenBuilder.d.ts +0 -18
- package/dist/sdks/long-yield-carry/src/client/builders/burnTokenBuilder.js +0 -165
- package/dist/sdks/long-yield-carry/src/client/builders/claimIncentivesBuilder.d.ts +0 -9
- package/dist/sdks/long-yield-carry/src/client/builders/claimIncentivesBuilder.js +0 -135
- package/dist/sdks/long-yield-carry/src/client/builders/collectFeesBuilder.d.ts +0 -14
- package/dist/sdks/long-yield-carry/src/client/builders/collectFeesBuilder.js +0 -50
- package/dist/sdks/long-yield-carry/src/client/builders/collectInterestBuilder.d.ts +0 -8
- package/dist/sdks/long-yield-carry/src/client/builders/collectInterestBuilder.js +0 -86
- package/dist/sdks/long-yield-carry/src/client/builders/createCpiPlanBuilder.d.ts +0 -6
- package/dist/sdks/long-yield-carry/src/client/builders/createCpiPlanBuilder.js +0 -22
- package/dist/sdks/long-yield-carry/src/client/builders/createTokenBuilder.d.ts +0 -7
- package/dist/sdks/long-yield-carry/src/client/builders/createTokenBuilder.js +0 -64
- package/dist/sdks/long-yield-carry/src/client/builders/createTokenLendingPositionBuilder.d.ts +0 -10
- package/dist/sdks/long-yield-carry/src/client/builders/createTokenLendingPositionBuilder.js +0 -138
- package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankAllocationBuilder.d.ts +0 -7
- package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankAllocationBuilder.js +0 -29
- package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankBuilder.d.ts +0 -7
- package/dist/sdks/long-yield-carry/src/client/builders/createYieldingBankBuilder.js +0 -39
- package/dist/sdks/long-yield-carry/src/client/builders/decreaseCarryPositionBuilder.d.ts +0 -30
- package/dist/sdks/long-yield-carry/src/client/builders/decreaseCarryPositionBuilder.js +0 -99
- package/dist/sdks/long-yield-carry/src/client/builders/depositUnlentCollateralBuilder.d.ts +0 -8
- package/dist/sdks/long-yield-carry/src/client/builders/depositUnlentCollateralBuilder.js +0 -64
- package/dist/sdks/long-yield-carry/src/client/builders/increaseCarryPositionBuilder.d.ts +0 -8
- package/dist/sdks/long-yield-carry/src/client/builders/increaseCarryPositionBuilder.js +0 -73
- package/dist/sdks/long-yield-carry/src/client/builders/index.d.ts +0 -28
- package/dist/sdks/long-yield-carry/src/client/builders/index.js +0 -62
- package/dist/sdks/long-yield-carry/src/client/builders/mintTokenBuilder.d.ts +0 -8
- package/dist/sdks/long-yield-carry/src/client/builders/mintTokenBuilder.js +0 -95
- package/dist/sdks/long-yield-carry/src/client/builders/rebalanceTokenBuilder.d.ts +0 -11
- package/dist/sdks/long-yield-carry/src/client/builders/rebalanceTokenBuilder.js +0 -255
- package/dist/sdks/long-yield-carry/src/client/builders/rebalanceYieldingBankBuilder.d.ts +0 -8
- package/dist/sdks/long-yield-carry/src/client/builders/rebalanceYieldingBankBuilder.js +0 -75
- package/dist/sdks/long-yield-carry/src/client/builders/recollateralizeLossBuilder.d.ts +0 -12
- package/dist/sdks/long-yield-carry/src/client/builders/recollateralizeLossBuilder.js +0 -220
- package/dist/sdks/long-yield-carry/src/client/builders/refreshTokenStateBuilder.d.ts +0 -9
- package/dist/sdks/long-yield-carry/src/client/builders/refreshTokenStateBuilder.js +0 -112
- package/dist/sdks/long-yield-carry/src/client/builders/refreshTokensBuilder.d.ts +0 -9
- package/dist/sdks/long-yield-carry/src/client/builders/refreshTokensBuilder.js +0 -59
- package/dist/sdks/long-yield-carry/src/client/builders/refreshYieldingBankBuilder.d.ts +0 -8
- package/dist/sdks/long-yield-carry/src/client/builders/refreshYieldingBankBuilder.js +0 -29
- package/dist/sdks/long-yield-carry/src/client/builders/resetTokenBurnRateLimitBuilder.d.ts +0 -7
- package/dist/sdks/long-yield-carry/src/client/builders/resetTokenBurnRateLimitBuilder.js +0 -19
- package/dist/sdks/long-yield-carry/src/client/builders/setTokenCircuitBreakerBuilder.d.ts +0 -11
- package/dist/sdks/long-yield-carry/src/client/builders/setTokenCircuitBreakerBuilder.js +0 -31
- package/dist/sdks/long-yield-carry/src/client/builders/setYieldingBankCircuitBreakerBuilder.d.ts +0 -8
- package/dist/sdks/long-yield-carry/src/client/builders/setYieldingBankCircuitBreakerBuilder.js +0 -28
- package/dist/sdks/long-yield-carry/src/client/builders/updateLendingPositionConfigBuilder.d.ts +0 -10
- package/dist/sdks/long-yield-carry/src/client/builders/updateLendingPositionConfigBuilder.js +0 -30
- package/dist/sdks/long-yield-carry/src/client/builders/updateTokenConfigurationBuilder.d.ts +0 -11
- package/dist/sdks/long-yield-carry/src/client/builders/updateTokenConfigurationBuilder.js +0 -47
- package/dist/sdks/long-yield-carry/src/client/builders/updateTokenMetadataBuilder.d.ts +0 -7
- package/dist/sdks/long-yield-carry/src/client/builders/updateTokenMetadataBuilder.js +0 -24
- package/dist/sdks/long-yield-carry/src/client/builders/updateYieldingBankConfigBuilder.d.ts +0 -10
- package/dist/sdks/long-yield-carry/src/client/builders/updateYieldingBankConfigBuilder.js +0 -31
- package/dist/sdks/long-yield-carry/src/client/builders/utils.d.ts +0 -4
- package/dist/sdks/long-yield-carry/src/client/builders/utils.js +0 -20
- package/dist/sdks/long-yield-carry/src/client/client.d.ts +0 -115
- package/dist/sdks/long-yield-carry/src/client/client.js +0 -166
- package/dist/sdks/long-yield-carry/src/client/externalLiquidityResolver.d.ts +0 -13
- package/dist/sdks/long-yield-carry/src/client/externalLiquidityResolver.js +0 -34
- package/dist/sdks/long-yield-carry/src/client/index.d.ts +0 -10
- package/dist/sdks/long-yield-carry/src/client/index.js +0 -33
- package/dist/sdks/long-yield-carry/src/client/lendingPlatformClients.d.ts +0 -19
- package/dist/sdks/long-yield-carry/src/client/lendingPlatformClients.js +0 -33
- package/dist/sdks/long-yield-carry/src/client/pda.d.ts +0 -33
- package/dist/sdks/long-yield-carry/src/client/pda.js +0 -79
- package/dist/sdks/long-yield-carry/src/client/plans/collectInterest.d.ts +0 -24
- package/dist/sdks/long-yield-carry/src/client/plans/collectInterest.js +0 -150
- package/dist/sdks/long-yield-carry/src/client/plans/decreaseCarryPosition.d.ts +0 -12
- package/dist/sdks/long-yield-carry/src/client/plans/decreaseCarryPosition.js +0 -140
- package/dist/sdks/long-yield-carry/src/client/routes/collectInterest.d.ts +0 -13
- package/dist/sdks/long-yield-carry/src/client/routes/collectInterest.js +0 -39
- package/dist/sdks/long-yield-carry/src/client/transaction.d.ts +0 -41
- package/dist/sdks/long-yield-carry/src/client/transaction.js +0 -55
- package/dist/sdks/long-yield-carry/src/client/types/builders.d.ts +0 -18
- package/dist/sdks/long-yield-carry/src/client/types/builders.js +0 -2
- package/dist/sdks/long-yield-carry/src/client/types/enums.d.ts +0 -22
- package/dist/sdks/long-yield-carry/src/client/types/enums.js +0 -48
- package/dist/sdks/long-yield-carry/src/client/types/general.d.ts +0 -98
- package/dist/sdks/long-yield-carry/src/client/types/general.js +0 -2
- package/dist/sdks/long-yield-carry/src/client/types/index.d.ts +0 -6
- package/dist/sdks/long-yield-carry/src/client/types/index.js +0 -22
- package/dist/sdks/long-yield-carry/src/client/types/ix.d.ts +0 -352
- package/dist/sdks/long-yield-carry/src/client/types/ix.js +0 -2
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/collectInterest.d.ts +0 -91
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/collectInterest.js +0 -2
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/common.d.ts +0 -28
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/common.js +0 -2
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/decreaseCarryPosition.d.ts +0 -128
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/decreaseCarryPosition.js +0 -2
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/index.d.ts +0 -3
- package/dist/sdks/long-yield-carry/src/client/types/planTypes/index.js +0 -19
- package/dist/sdks/long-yield-carry/src/client/types/tx.d.ts +0 -339
- package/dist/sdks/long-yield-carry/src/client/types/tx.js +0 -2
- package/dist/sdks/long-yield-carry/src/constants/configs/allocations.d.ts +0 -3
- package/dist/sdks/long-yield-carry/src/constants/configs/allocations.js +0 -23
- package/dist/sdks/long-yield-carry/src/constants/configs/carryTradePresets.d.ts +0 -58
- package/dist/sdks/long-yield-carry/src/constants/configs/carryTradePresets.js +0 -116
- package/dist/sdks/long-yield-carry/src/constants/configs/index.d.ts +0 -2
- package/dist/sdks/long-yield-carry/src/constants/configs/index.js +0 -18
- package/dist/sdks/long-yield-carry/src/constants/general.d.ts +0 -70
- package/dist/sdks/long-yield-carry/src/constants/general.js +0 -107
- package/dist/sdks/long-yield-carry/src/constants/index.d.ts +0 -3
- package/dist/sdks/long-yield-carry/src/constants/index.js +0 -19
- package/dist/sdks/long-yield-carry/src/constants/lycTokenMetadata.d.ts +0 -36
- package/dist/sdks/long-yield-carry/src/constants/lycTokenMetadata.js +0 -41
- package/dist/sdks/long-yield-carry/src/decoders/decodeTransaction.d.ts +0 -86
- package/dist/sdks/long-yield-carry/src/decoders/decodeTransaction.js +0 -230
- package/dist/sdks/long-yield-carry/src/decoders/discriminators.d.ts +0 -8
- package/dist/sdks/long-yield-carry/src/decoders/discriminators.js +0 -11
- package/dist/sdks/long-yield-carry/src/decoders/idlAccounts.d.ts +0 -29
- package/dist/sdks/long-yield-carry/src/decoders/idlAccounts.js +0 -57
- package/dist/sdks/long-yield-carry/src/decoders/index.d.ts +0 -6
- package/dist/sdks/long-yield-carry/src/decoders/index.js +0 -14
- package/dist/sdks/long-yield-carry/src/decoders/innerCpis.d.ts +0 -68
- package/dist/sdks/long-yield-carry/src/decoders/innerCpis.js +0 -225
- package/dist/sdks/long-yield-carry/src/decoders/lycInstructionNames.d.ts +0 -6
- package/dist/sdks/long-yield-carry/src/decoders/lycInstructionNames.js +0 -73
- package/dist/sdks/long-yield-carry/src/decoders/programIds.d.ts +0 -4
- package/dist/sdks/long-yield-carry/src/decoders/programIds.js +0 -11
- package/dist/sdks/long-yield-carry/src/decoders/solana.d.ts +0 -7
- package/dist/sdks/long-yield-carry/src/decoders/solana.js +0 -30
- package/dist/sdks/long-yield-carry/src/decoders/transactionPayload.d.ts +0 -41
- package/dist/sdks/long-yield-carry/src/decoders/transactionPayload.js +0 -6
- package/dist/sdks/long-yield-carry/src/decoders/types.d.ts +0 -58
- package/dist/sdks/long-yield-carry/src/decoders/types.js +0 -2
- package/dist/sdks/long-yield-carry/src/errors.d.ts +0 -69
- package/dist/sdks/long-yield-carry/src/errors.js +0 -183
- package/dist/sdks/long-yield-carry/src/idl/long_yield_carry.js +0 -7323
- package/dist/sdks/long-yield-carry/src/index.d.ts +0 -10
- package/dist/sdks/long-yield-carry/src/index.js +0 -25
- package/dist/sdks/long-yield-carry/src/metrics/index.d.ts +0 -1
- package/dist/sdks/long-yield-carry/src/metrics/index.js +0 -17
- package/dist/sdks/long-yield-carry/src/metrics/protocolMetrics.d.ts +0 -276
- package/dist/sdks/long-yield-carry/src/metrics/protocolMetrics.js +0 -547
- package/dist/sdks/long-yield-carry/src/models/index.d.ts +0 -3
- package/dist/sdks/long-yield-carry/src/models/index.js +0 -7
- package/dist/sdks/long-yield-carry/src/models/lycToken.d.ts +0 -156
- package/dist/sdks/long-yield-carry/src/models/lycToken.js +0 -288
- package/dist/sdks/long-yield-carry/src/models/yieldingBank.d.ts +0 -52
- package/dist/sdks/long-yield-carry/src/models/yieldingBank.js +0 -109
- package/dist/sdks/long-yield-carry/src/services/allocation/allocationService.d.ts +0 -106
- package/dist/sdks/long-yield-carry/src/services/allocation/allocationService.js +0 -589
- package/dist/sdks/long-yield-carry/src/services/allocation/index.d.ts +0 -2
- package/dist/sdks/long-yield-carry/src/services/allocation/index.js +0 -18
- package/dist/sdks/long-yield-carry/src/services/allocation/types.d.ts +0 -25
- package/dist/sdks/long-yield-carry/src/services/allocation/types.js +0 -2
- package/dist/sdks/long-yield-carry/src/services/carry/carryAllocationConfig.d.ts +0 -103
- package/dist/sdks/long-yield-carry/src/services/carry/carryAllocationConfig.js +0 -146
- package/dist/sdks/long-yield-carry/src/services/carry/index.d.ts +0 -2
- package/dist/sdks/long-yield-carry/src/services/carry/index.js +0 -18
- package/dist/sdks/long-yield-carry/src/services/carry/lycLendingPositionManager.d.ts +0 -39
- package/dist/sdks/long-yield-carry/src/services/carry/lycLendingPositionManager.js +0 -100
- package/dist/sdks/long-yield-carry/src/services/index.d.ts +0 -5
- package/dist/sdks/long-yield-carry/src/services/index.js +0 -21
- package/dist/sdks/long-yield-carry/src/services/lendingPosition/index.d.ts +0 -2
- package/dist/sdks/long-yield-carry/src/services/lendingPosition/index.js +0 -5
- package/dist/sdks/long-yield-carry/src/services/lendingPosition/lendingPositionService.d.ts +0 -88
- package/dist/sdks/long-yield-carry/src/services/lendingPosition/lendingPositionService.js +0 -229
- package/dist/sdks/long-yield-carry/src/services/rebalance/index.d.ts +0 -2
- package/dist/sdks/long-yield-carry/src/services/rebalance/index.js +0 -18
- package/dist/sdks/long-yield-carry/src/services/rebalance/token/index.d.ts +0 -1
- package/dist/sdks/long-yield-carry/src/services/rebalance/token/index.js +0 -17
- package/dist/sdks/long-yield-carry/src/services/rebalance/token/tokenRebalanceService.d.ts +0 -51
- package/dist/sdks/long-yield-carry/src/services/rebalance/token/tokenRebalanceService.js +0 -99
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/index.d.ts +0 -3
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/index.js +0 -21
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/planner.d.ts +0 -68
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/planner.js +0 -181
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/strategy.d.ts +0 -26
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/strategy.js +0 -26
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/types.d.ts +0 -40
- package/dist/sdks/long-yield-carry/src/services/rebalance/yieldingBank/types.js +0 -2
- package/dist/sdks/long-yield-carry/src/services/redemption/index.d.ts +0 -2
- package/dist/sdks/long-yield-carry/src/services/redemption/index.js +0 -5
- package/dist/sdks/long-yield-carry/src/services/redemption/redemptionService.d.ts +0 -139
- package/dist/sdks/long-yield-carry/src/services/redemption/redemptionService.js +0 -532
- package/dist/sdks/long-yield-carry/src/types/enriched.d.ts +0 -168
- package/dist/sdks/long-yield-carry/src/types/enriched.js +0 -2
- package/dist/sdks/long-yield-carry/src/types/index.d.ts +0 -1
- package/dist/sdks/long-yield-carry/src/types/index.js +0 -17
- package/dist/sdks/long-yield-carry/src/utils/cache.d.ts +0 -4
- package/dist/sdks/long-yield-carry/src/utils/cache.js +0 -10
- package/dist/sdks/long-yield-carry/src/utils/data.d.ts +0 -12
- package/dist/sdks/long-yield-carry/src/utils/data.js +0 -59
- package/dist/sdks/long-yield-carry/src/utils/enrichment.d.ts +0 -5
- package/dist/sdks/long-yield-carry/src/utils/enrichment.js +0 -244
- package/dist/sdks/long-yield-carry/src/utils/feeDripMetrics.d.ts +0 -36
- package/dist/sdks/long-yield-carry/src/utils/feeDripMetrics.js +0 -93
- package/dist/sdks/long-yield-carry/src/utils/general.d.ts +0 -28
- package/dist/sdks/long-yield-carry/src/utils/general.js +0 -47
- package/dist/sdks/long-yield-carry/src/utils/index.d.ts +0 -13
- package/dist/sdks/long-yield-carry/src/utils/index.js +0 -29
- package/dist/sdks/long-yield-carry/src/utils/ix.d.ts +0 -83
- package/dist/sdks/long-yield-carry/src/utils/ix.js +0 -165
- package/dist/sdks/long-yield-carry/src/utils/lendingPosition.d.ts +0 -68
- package/dist/sdks/long-yield-carry/src/utils/lendingPosition.js +0 -105
- package/dist/sdks/long-yield-carry/src/utils/lookupTables.d.ts +0 -55
- package/dist/sdks/long-yield-carry/src/utils/lookupTables.js +0 -216
- package/dist/sdks/long-yield-carry/src/utils/lycData.d.ts +0 -66
- package/dist/sdks/long-yield-carry/src/utils/lycData.js +0 -211
- package/dist/sdks/long-yield-carry/src/utils/timelock.d.ts +0 -19
- package/dist/sdks/long-yield-carry/src/utils/timelock.js +0 -37
- package/dist/sdks/long-yield-carry/src/utils/tokenFeeMath.d.ts +0 -11
- package/dist/sdks/long-yield-carry/src/utils/tokenFeeMath.js +0 -24
- package/dist/sdks/long-yield-carry/src/utils/transactions.d.ts +0 -20
- package/dist/sdks/long-yield-carry/src/utils/transactions.js +0 -72
- package/dist/sdks/long-yield-carry/src/utils/yieldingBank.d.ts +0 -24
- package/dist/sdks/long-yield-carry/src/utils/yieldingBank.js +0 -36
- package/dist/shared/common/src/constants/accountMetas.d.ts +0 -3
- package/dist/shared/common/src/constants/accountMetas.js +0 -9
- package/dist/shared/common/src/constants/general.d.ts +0 -21
- package/dist/shared/common/src/constants/general.js +0 -30
- package/dist/shared/common/src/constants/generated/cpi.d.ts +0 -23
- package/dist/shared/common/src/constants/generated/cpi.js +0 -28
- package/dist/shared/common/src/constants/generated/index.d.ts +0 -1
- package/dist/shared/common/src/constants/generated/index.js +0 -17
- package/dist/shared/common/src/constants/index.d.ts +0 -3
- package/dist/shared/common/src/constants/index.js +0 -19
- package/dist/shared/common/src/index.d.ts +0 -4
- package/dist/shared/common/src/index.js +0 -20
- package/dist/shared/common/src/services/baseAccountClient.d.ts +0 -22
- package/dist/shared/common/src/services/baseAccountClient.js +0 -38
- package/dist/shared/common/src/services/baseIxBuilderService.d.ts +0 -27
- package/dist/shared/common/src/services/baseIxBuilderService.js +0 -48
- package/dist/shared/common/src/services/dataCache.d.ts +0 -41
- package/dist/shared/common/src/services/dataCache.js +0 -130
- package/dist/shared/common/src/services/index.d.ts +0 -8
- package/dist/shared/common/src/services/index.js +0 -24
- package/dist/shared/common/src/services/lutManager.d.ts +0 -31
- package/dist/shared/common/src/services/lutManager.js +0 -133
- package/dist/shared/common/src/services/mints/defaults.d.ts +0 -2
- package/dist/shared/common/src/services/mints/defaults.js +0 -152
- package/dist/shared/common/src/services/mints/index.d.ts +0 -4
- package/dist/shared/common/src/services/mints/index.js +0 -20
- package/dist/shared/common/src/services/mints/registry.d.ts +0 -70
- package/dist/shared/common/src/services/mints/registry.js +0 -117
- package/dist/shared/common/src/services/mints/symbols.d.ts +0 -6
- package/dist/shared/common/src/services/mints/symbols.js +0 -13
- package/dist/shared/common/src/services/mints/types.d.ts +0 -30
- package/dist/shared/common/src/services/mints/types.js +0 -2
- package/dist/shared/common/src/services/swap/index.d.ts +0 -4
- package/dist/shared/common/src/services/swap/index.js +0 -20
- package/dist/shared/common/src/services/swap/routableSwapClient.d.ts +0 -36
- package/dist/shared/common/src/services/swap/routableSwapClient.js +0 -2
- package/dist/shared/common/src/services/swap/swapClientBase.d.ts +0 -45
- package/dist/shared/common/src/services/swap/swapClientBase.js +0 -2
- package/dist/shared/common/src/services/swap/swapRouting.d.ts +0 -13
- package/dist/shared/common/src/services/swap/swapRouting.js +0 -28
- package/dist/shared/common/src/services/swap/types.d.ts +0 -77
- package/dist/shared/common/src/services/swap/types.js +0 -2
- package/dist/shared/common/src/services/token/index.d.ts +0 -2
- package/dist/shared/common/src/services/token/index.js +0 -18
- package/dist/shared/common/src/services/token/tokenProtocolClientBase.d.ts +0 -51
- package/dist/shared/common/src/services/token/tokenProtocolClientBase.js +0 -2
- package/dist/shared/common/src/services/token/types.d.ts +0 -19
- package/dist/shared/common/src/services/token/types.js +0 -2
- package/dist/shared/common/src/services/transactionSender.d.ts +0 -24
- package/dist/shared/common/src/services/transactionSender.js +0 -30
- package/dist/shared/common/src/types/cpi.d.ts +0 -34
- package/dist/shared/common/src/types/cpi.js +0 -8
- package/dist/shared/common/src/types/enums.d.ts +0 -59
- package/dist/shared/common/src/types/enums.js +0 -122
- package/dist/shared/common/src/types/general.d.ts +0 -38
- package/dist/shared/common/src/types/general.js +0 -2
- package/dist/shared/common/src/types/index.d.ts +0 -4
- package/dist/shared/common/src/types/index.js +0 -20
- package/dist/shared/common/src/types/solana.d.ts +0 -24
- package/dist/shared/common/src/types/solana.js +0 -2
- package/dist/shared/common/src/utils/accounts/index.d.ts +0 -5
- package/dist/shared/common/src/utils/accounts/index.js +0 -21
- package/dist/shared/common/src/utils/accounts/meta.d.ts +0 -21
- package/dist/shared/common/src/utils/accounts/meta.js +0 -27
- package/dist/shared/common/src/utils/accounts/pda.d.ts +0 -2
- package/dist/shared/common/src/utils/accounts/pda.js +0 -17
- package/dist/shared/common/src/utils/accounts/roles.d.ts +0 -26
- package/dist/shared/common/src/utils/accounts/roles.js +0 -54
- package/dist/shared/common/src/utils/accounts/rpc.d.ts +0 -8
- package/dist/shared/common/src/utils/accounts/rpc.js +0 -30
- package/dist/shared/common/src/utils/accounts/splBalances.d.ts +0 -15
- package/dist/shared/common/src/utils/accounts/splBalances.js +0 -52
- package/dist/shared/common/src/utils/anchor.d.ts +0 -17
- package/dist/shared/common/src/utils/anchor.js +0 -29
- package/dist/shared/common/src/utils/asyncConcurrency.d.ts +0 -5
- package/dist/shared/common/src/utils/asyncConcurrency.js +0 -28
- package/dist/shared/common/src/utils/compat.d.ts +0 -46
- package/dist/shared/common/src/utils/compat.js +0 -72
- package/dist/shared/common/src/utils/cpi/args.d.ts +0 -69
- package/dist/shared/common/src/utils/cpi/args.js +0 -100
- package/dist/shared/common/src/utils/cpi/index.d.ts +0 -2
- package/dist/shared/common/src/utils/cpi/index.js +0 -18
- package/dist/shared/common/src/utils/cpi/refs.d.ts +0 -122
- package/dist/shared/common/src/utils/cpi/refs.js +0 -234
- package/dist/shared/common/src/utils/data.d.ts +0 -20
- package/dist/shared/common/src/utils/data.js +0 -27
- package/dist/shared/common/src/utils/general.d.ts +0 -24
- package/dist/shared/common/src/utils/general.js +0 -95
- package/dist/shared/common/src/utils/index.d.ts +0 -22
- package/dist/shared/common/src/utils/index.js +0 -38
- package/dist/shared/common/src/utils/instruction.d.ts +0 -74
- package/dist/shared/common/src/utils/instruction.js +0 -147
- package/dist/shared/common/src/utils/jito.d.ts +0 -113
- package/dist/shared/common/src/utils/jito.js +0 -178
- package/dist/shared/common/src/utils/json.d.ts +0 -5
- package/dist/shared/common/src/utils/json.js +0 -25
- package/dist/shared/common/src/utils/jsonRpcFetch.d.ts +0 -21
- package/dist/shared/common/src/utils/jsonRpcFetch.js +0 -134
- package/dist/shared/common/src/utils/metadata.d.ts +0 -107
- package/dist/shared/common/src/utils/metadata.js +0 -194
- package/dist/shared/common/src/utils/numbers.d.ts +0 -72
- package/dist/shared/common/src/utils/numbers.js +0 -193
- package/dist/shared/common/src/utils/priorityFee.d.ts +0 -18
- package/dist/shared/common/src/utils/priorityFee.js +0 -63
- package/dist/shared/common/src/utils/retry.d.ts +0 -20
- package/dist/shared/common/src/utils/retry.js +0 -69
- package/dist/shared/common/src/utils/rpc.d.ts +0 -40
- package/dist/shared/common/src/utils/rpc.js +0 -130
- package/dist/shared/common/src/utils/solana.d.ts +0 -23
- package/dist/shared/common/src/utils/solana.js +0 -61
- package/dist/shared/common/src/utils/timeSeries.d.ts +0 -18
- package/dist/shared/common/src/utils/timeSeries.js +0 -40
- package/dist/shared/common/src/utils/token.d.ts +0 -33
- package/dist/shared/common/src/utils/token.js +0 -82
- package/dist/shared/common/src/utils/transaction.d.ts +0 -154
- package/dist/shared/common/src/utils/transaction.js +0 -585
- package/dist/shared/common/src/utils/transactionSplitter.d.ts +0 -85
- package/dist/shared/common/src/utils/transactionSplitter.js +0 -127
- package/dist/shared/common/src/utils/txAccountCoverage.d.ts +0 -49
- package/dist/shared/common/src/utils/txAccountCoverage.js +0 -122
- package/dist/shared/jupiter-helpers/src/api.d.ts +0 -59
- package/dist/shared/jupiter-helpers/src/api.js +0 -130
- package/dist/shared/jupiter-helpers/src/client.d.ts +0 -79
- package/dist/shared/jupiter-helpers/src/client.js +0 -173
- package/dist/shared/jupiter-helpers/src/constants.d.ts +0 -35
- package/dist/shared/jupiter-helpers/src/constants.js +0 -38
- package/dist/shared/jupiter-helpers/src/extract.d.ts +0 -30
- package/dist/shared/jupiter-helpers/src/extract.js +0 -57
- package/dist/shared/jupiter-helpers/src/index.d.ts +0 -5
- package/dist/shared/jupiter-helpers/src/index.js +0 -21
- package/dist/shared/jupiter-helpers/src/routePreInstructions.d.ts +0 -19
- package/dist/shared/jupiter-helpers/src/routePreInstructions.js +0 -61
- package/dist/shared/jupiter-helpers/src/sizeExactInForMinOutput.d.ts +0 -70
- package/dist/shared/jupiter-helpers/src/sizeExactInForMinOutput.js +0 -95
- package/dist/shared/jupiter-helpers/src/types.d.ts +0 -66
- package/dist/shared/jupiter-helpers/src/types.js +0 -2
- package/dist/shared/lending-platforms/src/constants/cache.d.ts +0 -8
- package/dist/shared/lending-platforms/src/constants/cache.js +0 -11
- package/dist/shared/lending-platforms/src/constants/index.d.ts +0 -3
- package/dist/shared/lending-platforms/src/constants/index.js +0 -19
- package/dist/shared/lending-platforms/src/constants/kamino.d.ts +0 -7
- package/dist/shared/lending-platforms/src/constants/kamino.js +0 -83
- package/dist/shared/lending-platforms/src/constants/lendingPosition.d.ts +0 -7
- package/dist/shared/lending-platforms/src/constants/lendingPosition.js +0 -10
- package/dist/shared/lending-platforms/src/data/accounts/index.d.ts +0 -2
- package/dist/shared/lending-platforms/src/data/accounts/index.js +0 -18
- package/dist/shared/lending-platforms/src/data/accounts/kamino.d.ts +0 -42
- package/dist/shared/lending-platforms/src/data/accounts/kamino.js +0 -104
- package/dist/shared/lending-platforms/src/data/accounts/lpAccountsBase.d.ts +0 -7
- package/dist/shared/lending-platforms/src/data/accounts/lpAccountsBase.js +0 -9
- package/dist/shared/lending-platforms/src/data/incentive/incentiveBase.d.ts +0 -35
- package/dist/shared/lending-platforms/src/data/incentive/incentiveBase.js +0 -26
- package/dist/shared/lending-platforms/src/data/incentive/index.d.ts +0 -2
- package/dist/shared/lending-platforms/src/data/incentive/index.js +0 -18
- package/dist/shared/lending-platforms/src/data/incentive/kamino.d.ts +0 -55
- package/dist/shared/lending-platforms/src/data/incentive/kamino.js +0 -101
- package/dist/shared/lending-platforms/src/data/index.d.ts +0 -6
- package/dist/shared/lending-platforms/src/data/index.js +0 -22
- package/dist/shared/lending-platforms/src/data/instructions/index.d.ts +0 -3
- package/dist/shared/lending-platforms/src/data/instructions/index.js +0 -19
- package/dist/shared/lending-platforms/src/data/instructions/kamino.d.ts +0 -55
- package/dist/shared/lending-platforms/src/data/instructions/kamino.js +0 -630
- package/dist/shared/lending-platforms/src/data/instructions/lpInstructionsBase.d.ts +0 -175
- package/dist/shared/lending-platforms/src/data/instructions/lpInstructionsBase.js +0 -192
- package/dist/shared/lending-platforms/src/data/instructions/types.d.ts +0 -7
- package/dist/shared/lending-platforms/src/data/instructions/types.js +0 -2
- package/dist/shared/lending-platforms/src/data/platform/index.d.ts +0 -2
- package/dist/shared/lending-platforms/src/data/platform/index.js +0 -18
- package/dist/shared/lending-platforms/src/data/platform/kamino.d.ts +0 -59
- package/dist/shared/lending-platforms/src/data/platform/kamino.js +0 -206
- package/dist/shared/lending-platforms/src/data/platform/lpDataBase.d.ts +0 -35
- package/dist/shared/lending-platforms/src/data/platform/lpDataBase.js +0 -31
- package/dist/shared/lending-platforms/src/data/reserve/index.d.ts +0 -2
- package/dist/shared/lending-platforms/src/data/reserve/index.js +0 -18
- package/dist/shared/lending-platforms/src/data/reserve/kamino.d.ts +0 -45
- package/dist/shared/lending-platforms/src/data/reserve/kamino.js +0 -141
- package/dist/shared/lending-platforms/src/data/reserve/reserveBase.d.ts +0 -114
- package/dist/shared/lending-platforms/src/data/reserve/reserveBase.js +0 -125
- package/dist/shared/lending-platforms/src/data/userPosition/index.d.ts +0 -2
- package/dist/shared/lending-platforms/src/data/userPosition/index.js +0 -18
- package/dist/shared/lending-platforms/src/data/userPosition/kamino.d.ts +0 -15
- package/dist/shared/lending-platforms/src/data/userPosition/kamino.js +0 -45
- package/dist/shared/lending-platforms/src/data/userPosition/userPositionBase.d.ts +0 -50
- package/dist/shared/lending-platforms/src/data/userPosition/userPositionBase.js +0 -63
- package/dist/shared/lending-platforms/src/index.d.ts +0 -5
- package/dist/shared/lending-platforms/src/index.js +0 -21
- package/dist/shared/lending-platforms/src/services/client/index.d.ts +0 -2
- package/dist/shared/lending-platforms/src/services/client/index.js +0 -18
- package/dist/shared/lending-platforms/src/services/client/kamino.d.ts +0 -53
- package/dist/shared/lending-platforms/src/services/client/kamino.js +0 -142
- package/dist/shared/lending-platforms/src/services/client/lpClientBase.d.ts +0 -66
- package/dist/shared/lending-platforms/src/services/client/lpClientBase.js +0 -19
- package/dist/shared/lending-platforms/src/services/flashLoan/flashLoanBase.d.ts +0 -49
- package/dist/shared/lending-platforms/src/services/flashLoan/flashLoanBase.js +0 -16
- package/dist/shared/lending-platforms/src/services/flashLoan/index.d.ts +0 -2
- package/dist/shared/lending-platforms/src/services/flashLoan/index.js +0 -18
- package/dist/shared/lending-platforms/src/services/flashLoan/kamino.d.ts +0 -11
- package/dist/shared/lending-platforms/src/services/flashLoan/kamino.js +0 -85
- package/dist/shared/lending-platforms/src/services/index.d.ts +0 -5
- package/dist/shared/lending-platforms/src/services/index.js +0 -21
- package/dist/shared/lending-platforms/src/services/lendingPosition/index.d.ts +0 -2
- package/dist/shared/lending-platforms/src/services/lendingPosition/index.js +0 -18
- package/dist/shared/lending-platforms/src/services/lendingPosition/lendingPositionManager.d.ts +0 -117
- package/dist/shared/lending-platforms/src/services/lendingPosition/lendingPositionManager.js +0 -342
- package/dist/shared/lending-platforms/src/services/lendingPosition/types.d.ts +0 -40
- package/dist/shared/lending-platforms/src/services/lendingPosition/types.js +0 -2
- package/dist/shared/lending-platforms/src/services/leverage/index.d.ts +0 -2
- package/dist/shared/lending-platforms/src/services/leverage/index.js +0 -18
- package/dist/shared/lending-platforms/src/services/leverage/leverageService.d.ts +0 -104
- package/dist/shared/lending-platforms/src/services/leverage/leverageService.js +0 -437
- package/dist/shared/lending-platforms/src/services/leverage/types.d.ts +0 -261
- package/dist/shared/lending-platforms/src/services/leverage/types.js +0 -2
- package/dist/shared/lending-platforms/src/services/reservesManager.d.ts +0 -53
- package/dist/shared/lending-platforms/src/services/reservesManager.js +0 -112
- package/dist/shared/lending-platforms/src/types/general.d.ts +0 -37
- package/dist/shared/lending-platforms/src/types/general.js +0 -8
- package/dist/shared/lending-platforms/src/types/index.d.ts +0 -2
- package/dist/shared/lending-platforms/src/types/index.js +0 -18
- package/dist/shared/lending-platforms/src/types/kamino.d.ts +0 -10
- package/dist/shared/lending-platforms/src/types/kamino.js +0 -2
- package/dist/shared/lending-platforms/src/utils/accounts.d.ts +0 -16
- package/dist/shared/lending-platforms/src/utils/accounts.js +0 -36
- package/dist/shared/lending-platforms/src/utils/cache.d.ts +0 -3
- package/dist/shared/lending-platforms/src/utils/cache.js +0 -11
- package/dist/shared/lending-platforms/src/utils/index.d.ts +0 -6
- package/dist/shared/lending-platforms/src/utils/index.js +0 -22
- package/dist/shared/lending-platforms/src/utils/kamino.d.ts +0 -87
- package/dist/shared/lending-platforms/src/utils/kamino.js +0 -190
- package/dist/shared/lending-platforms/src/utils/lendingPlatform.d.ts +0 -6
- package/dist/shared/lending-platforms/src/utils/lendingPlatform.js +0 -16
- package/dist/shared/lending-platforms/src/utils/math.d.ts +0 -47
- package/dist/shared/lending-platforms/src/utils/math.js +0 -123
- package/dist/shared/lending-platforms/src/utils/scope.d.ts +0 -38
- package/dist/shared/lending-platforms/src/utils/scope.js +0 -144
- package/dist/shared/oracle-service/src/constants/index.d.ts +0 -3
- package/dist/shared/oracle-service/src/constants/index.js +0 -19
- package/dist/shared/oracle-service/src/constants/pyth.d.ts +0 -7
- package/dist/shared/oracle-service/src/constants/pyth.js +0 -71
- package/dist/shared/oracle-service/src/constants/splStake.d.ts +0 -2
- package/dist/shared/oracle-service/src/constants/splStake.js +0 -6
- package/dist/shared/oracle-service/src/constants/switchboard.d.ts +0 -7
- package/dist/shared/oracle-service/src/constants/switchboard.js +0 -10
- package/dist/shared/oracle-service/src/feeds/custom.d.ts +0 -30
- package/dist/shared/oracle-service/src/feeds/custom.js +0 -56
- package/dist/shared/oracle-service/src/feeds/jupiter.d.ts +0 -7
- package/dist/shared/oracle-service/src/feeds/jupiter.js +0 -43
- package/dist/shared/oracle-service/src/feeds/priceBase.d.ts +0 -13
- package/dist/shared/oracle-service/src/feeds/priceBase.js +0 -25
- package/dist/shared/oracle-service/src/feeds/pyth.d.ts +0 -8
- package/dist/shared/oracle-service/src/feeds/pyth.js +0 -59
- package/dist/shared/oracle-service/src/feeds/splStake.d.ts +0 -26
- package/dist/shared/oracle-service/src/feeds/splStake.js +0 -99
- package/dist/shared/oracle-service/src/feeds/switchboard.d.ts +0 -6
- package/dist/shared/oracle-service/src/feeds/switchboard.js +0 -11
- package/dist/shared/oracle-service/src/index.d.ts +0 -5
- package/dist/shared/oracle-service/src/index.js +0 -26
- package/dist/shared/oracle-service/src/oracle.d.ts +0 -22
- package/dist/shared/oracle-service/src/oracle.js +0 -104
- package/dist/shared/oracle-service/src/types.d.ts +0 -4
- package/dist/shared/oracle-service/src/types.js +0 -2
- package/dist/shared/oracle-service/src/utils/general.d.ts +0 -20
- package/dist/shared/oracle-service/src/utils/general.js +0 -65
- package/dist/shared/oracle-service/src/utils/index.d.ts +0 -1
- package/dist/shared/oracle-service/src/utils/index.js +0 -17
- package/dist/shared/perena-helpers/src/accounts.d.ts +0 -7
- package/dist/shared/perena-helpers/src/accounts.js +0 -12
- package/dist/shared/perena-helpers/src/client.d.ts +0 -299
- package/dist/shared/perena-helpers/src/client.js +0 -680
- package/dist/shared/perena-helpers/src/constants.d.ts +0 -5
- package/dist/shared/perena-helpers/src/constants.js +0 -8
- package/dist/shared/perena-helpers/src/cpi/burn.d.ts +0 -27
- package/dist/shared/perena-helpers/src/cpi/burn.js +0 -22
- package/dist/shared/perena-helpers/src/cpi/index.d.ts +0 -3
- package/dist/shared/perena-helpers/src/cpi/index.js +0 -19
- package/dist/shared/perena-helpers/src/cpi/mint.d.ts +0 -27
- package/dist/shared/perena-helpers/src/cpi/mint.js +0 -22
- package/dist/shared/perena-helpers/src/cpi/requestUnstake.d.ts +0 -19
- package/dist/shared/perena-helpers/src/cpi/requestUnstake.js +0 -16
- package/dist/shared/perena-helpers/src/index.d.ts +0 -5
- package/dist/shared/perena-helpers/src/index.js +0 -21
- package/dist/shared/perena-helpers/src/utils.d.ts +0 -9
- package/dist/shared/perena-helpers/src/utils.js +0 -54
- package/dist/shared/swap-aggregator/src/aggSwapClient.d.ts +0 -71
- package/dist/shared/swap-aggregator/src/aggSwapClient.js +0 -103
- package/dist/shared/swap-aggregator/src/index.d.ts +0 -1
- package/dist/shared/swap-aggregator/src/index.js +0 -17
- package/docs/launchingToken.md +0 -57
- package/scripts/asyncBurn.ts +0 -155
- package/scripts/burnToken.ts +0 -120
- package/scripts/claimIncentives.ts +0 -125
- package/scripts/closeCpiPlans.ts +0 -113
- package/scripts/collectInterest.ts +0 -194
- package/scripts/collectProtocolFees.ts +0 -144
- package/scripts/computeOptimalAllocations.ts +0 -117
- package/scripts/createToken.ts +0 -100
- package/scripts/createTokenLendingPosition.ts +0 -204
- package/scripts/createYieldingBank.ts +0 -91
- package/scripts/decreaseCarryPositions.ts +0 -359
- package/scripts/depositUnlentCollateral.ts +0 -106
- package/scripts/emergency/deleverageAll.ts +0 -287
- package/scripts/emergency/triggerCircuitBreaker.ts +0 -87
- package/scripts/env.ts +0 -4
- package/scripts/findTxs.ts +0 -169
- package/scripts/increaseCarryPositions.ts +0 -134
- package/scripts/inspect/format.ts +0 -576
- package/scripts/inspect.ts +0 -147
- package/scripts/localUtils.ts +0 -249
- package/scripts/mintToken.ts +0 -126
- package/scripts/processAsyncBurns.ts +0 -89
- package/scripts/rebalanceToken.ts +0 -269
- package/scripts/rebalanceYieldingBank.ts +0 -183
- package/scripts/recollateralizeLoss.ts +0 -79
- package/scripts/refresh.ts +0 -156
- package/scripts/updateFees.ts +0 -486
- package/scripts/updateGeneralLut.ts +0 -36
- package/scripts/updateLendingPositionConfig.ts +0 -172
- package/scripts/updateTokenLuts.ts +0 -36
- package/scripts/updateTokenMetadata.ts +0 -199
- package/scripts/updateYieldingBankConfig.ts +0 -100
- package/scripts/withdrawUnlentCollateral.ts +0 -178
- package/src/client/account.ts +0 -503
- package/src/client/builders/args.ts +0 -381
- package/src/client/builders/asyncBurnBuilder.ts +0 -305
- package/src/client/builders/base.ts +0 -303
- package/src/client/builders/burnTokenBuilder.ts +0 -258
- package/src/client/builders/claimIncentivesBuilder.ts +0 -211
- package/src/client/builders/collectFeesBuilder.ts +0 -52
- package/src/client/builders/collectInterestBuilder.ts +0 -165
- package/src/client/builders/createCpiPlanBuilder.ts +0 -21
- package/src/client/builders/createTokenBuilder.ts +0 -73
- package/src/client/builders/createTokenLendingPositionBuilder.ts +0 -219
- package/src/client/builders/createYieldingBankAllocationBuilder.ts +0 -32
- package/src/client/builders/createYieldingBankBuilder.ts +0 -39
- package/src/client/builders/decreaseCarryPositionBuilder.ts +0 -162
- package/src/client/builders/depositUnlentCollateralBuilder.ts +0 -95
- package/src/client/builders/increaseCarryPositionBuilder.ts +0 -105
- package/src/client/builders/index.ts +0 -37
- package/src/client/builders/mintTokenBuilder.ts +0 -137
- package/src/client/builders/rebalanceTokenBuilder.ts +0 -356
- package/src/client/builders/rebalanceYieldingBankBuilder.ts +0 -109
- package/src/client/builders/recollateralizeLossBuilder.ts +0 -367
- package/src/client/builders/refreshTokenStateBuilder.ts +0 -153
- package/src/client/builders/refreshTokensBuilder.ts +0 -82
- package/src/client/builders/refreshYieldingBankBuilder.ts +0 -42
- package/src/client/builders/resetTokenBurnRateLimitBuilder.ts +0 -21
- package/src/client/builders/setTokenCircuitBreakerBuilder.ts +0 -40
- package/src/client/builders/setYieldingBankCircuitBreakerBuilder.ts +0 -37
- package/src/client/builders/updateLendingPositionConfigBuilder.ts +0 -33
- package/src/client/builders/updateTokenConfigurationBuilder.ts +0 -50
- package/src/client/builders/updateTokenMetadataBuilder.ts +0 -24
- package/src/client/builders/updateYieldingBankConfigBuilder.ts +0 -32
- package/src/client/builders/utils.ts +0 -26
- package/src/client/client.ts +0 -264
- package/src/client/externalLiquidityResolver.ts +0 -54
- package/src/client/index.ts +0 -20
- package/src/client/lendingPlatformClients.ts +0 -50
- package/src/client/pda.ts +0 -102
- package/src/client/plans/collectInterest.ts +0 -207
- package/src/client/plans/decreaseCarryPosition.ts +0 -226
- package/src/client/routes/collectInterest.ts +0 -56
- package/src/client/transaction.ts +0 -106
- package/src/client/types/builders.ts +0 -19
- package/src/client/types/enums.ts +0 -47
- package/src/client/types/general.ts +0 -117
- package/src/client/types/index.ts +0 -6
- package/src/client/types/ix.ts +0 -452
- package/src/client/types/planTypes/collectInterest.ts +0 -97
- package/src/client/types/planTypes/common.ts +0 -31
- package/src/client/types/planTypes/decreaseCarryPosition.ts +0 -134
- package/src/client/types/planTypes/index.ts +0 -3
- package/src/client/types/tx.ts +0 -409
- package/src/constants/configs/allocations.ts +0 -30
- package/src/constants/configs/carryTradePresets.ts +0 -164
- package/src/constants/configs/index.ts +0 -2
- package/src/constants/general.ts +0 -141
- package/src/constants/index.ts +0 -3
- package/src/constants/lycTokenMetadata.ts +0 -52
- package/src/decoders/decodeTransaction.ts +0 -319
- package/src/decoders/discriminators.ts +0 -10
- package/src/decoders/idlAccounts.ts +0 -75
- package/src/decoders/index.ts +0 -15
- package/src/decoders/innerCpis.ts +0 -262
- package/src/decoders/lycInstructionNames.ts +0 -73
- package/src/decoders/programIds.ts +0 -12
- package/src/decoders/solana.ts +0 -25
- package/src/decoders/transactionPayload.ts +0 -41
- package/src/decoders/types.ts +0 -60
- package/src/errors.ts +0 -195
- package/src/idl/long_yield_carry.ts +0 -14648
- package/src/index.ts +0 -10
- package/src/metrics/index.ts +0 -1
- package/src/metrics/protocolMetrics.ts +0 -976
- package/src/models/index.ts +0 -9
- package/src/models/lycToken.ts +0 -380
- package/src/models/yieldingBank.ts +0 -127
- package/src/services/allocation/allocationService.ts +0 -823
- package/src/services/allocation/index.ts +0 -2
- package/src/services/allocation/types.ts +0 -27
- package/src/services/carry/carryAllocationConfig.ts +0 -266
- package/src/services/carry/index.ts +0 -2
- package/src/services/carry/lycLendingPositionManager.ts +0 -167
- package/src/services/index.ts +0 -5
- package/src/services/lendingPosition/index.ts +0 -5
- package/src/services/lendingPosition/lendingPositionService.ts +0 -328
- package/src/services/rebalance/index.ts +0 -2
- package/src/services/rebalance/token/index.ts +0 -1
- package/src/services/rebalance/token/tokenRebalanceService.ts +0 -142
- package/src/services/rebalance/yieldingBank/index.ts +0 -3
- package/src/services/rebalance/yieldingBank/planner.ts +0 -215
- package/src/services/rebalance/yieldingBank/strategy.ts +0 -41
- package/src/services/rebalance/yieldingBank/types.ts +0 -41
- package/src/services/redemption/index.ts +0 -9
- package/src/services/redemption/redemptionService.ts +0 -758
- package/src/types/enriched.ts +0 -187
- package/src/types/index.ts +0 -1
- package/src/utils/cache.ts +0 -12
- package/src/utils/data.ts +0 -65
- package/src/utils/enrichment.ts +0 -330
- package/src/utils/feeDripMetrics.ts +0 -146
- package/src/utils/general.ts +0 -54
- package/src/utils/index.ts +0 -13
- package/src/utils/ix.ts +0 -227
- package/src/utils/lendingPosition.ts +0 -221
- package/src/utils/lookupTables.ts +0 -309
- package/src/utils/lycData.ts +0 -321
- package/src/utils/timelock.ts +0 -63
- package/src/utils/tokenFeeMath.ts +0 -25
- package/src/utils/transactions.ts +0 -109
- package/src/utils/yieldingBank.ts +0 -38
- package/tsconfig.json +0 -11
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,2537 @@
|
|
|
1
|
+
import { M as MintIdentifier, R as ReserveBase, E as Environment, P as PositionBalanceChange, L as LendingPlatformData, C as CpiData, a as PricedMint, S as SingleCpiExecutionPlan, b as LongYieldCarryBuilderBase, c as CreditUnlentToRedemptionEpochIxArgs, d as LongYieldCarryTransactionPlan, e as ProcessAsyncBurnIxArgs, f as ProcessAsyncBurnTxArgs, g as SetRedemptionEpochStatusIxArgs, T as TopUpUnlentReservesIxArgs, h as TopUpUnlentReservesTxArgs, i as LongYieldCarryBuilderContext, j as LYCToken, k as ClaimIncentivesIxArgs, l as ClaimIncentivesTxArgs, m as LongYieldCarrySingleInstructionBuilderService, n as CollectFeesIxArgs, o as CollectInterestIxArgs, p as CollectInterestTxArgs, q as CreateCpiPlanIxArgs, r as CreateTokenIxArgs, s as CreateTokenLendingPositionIxArgs, t as CreateTokenLendingPositionTxArgs, u as CreateYieldingBankAllocationIxArgs, v as CreateYieldingBankIxArgs, w as LendingPlatform, x as LYCYieldingBank, y as TokenLendingPositionData, z as LendingPlatformClientBase, A as AccountClient, B as BurnAmounts, D as CustomAccountMeta, I as InstructionRefs, F as DecreaseCarryPositionPlan, Y as YieldingBankAllocationConfig, G as LongYieldCarry, H as YieldingBankExternalLiquiditySource, J as TransactionCacheInvalidation, K as CreateTokenLendingPositionParams, N as CreateTokenLendingPositionAccounts, O as DecreaseCarryPositionIxArgs, Q as DecreaseCarryPositionTxArgs, U as DecreaseCarryPositionTxParams, V as DecreaseCarryPositionTxBuilderParams, W as DepositUnlentCollateralIxArgs, X as DepositUnlentCollateralTxArgs, Z as IncreaseCarryPositionIxArgs, _ as IncreaseCarryPositionTxArgs, $ as RebalanceTokenIxArgs, a0 as RebalanceTokenTxArgs, a1 as RebalanceYieldingBankIxArgs, a2 as RebalanceYieldingBankTxArgs, a3 as RecollateralizeLossIxArgs, a4 as RecollateralizeLossTxArgs, a5 as RefreshTokenStateIxArgs, a6 as RefreshTokensBuilderTxArgs, a7 as RefreshYieldingBankIxArgs, a8 as RefreshYieldingBankTxArgs, a9 as ResetTokenBurnRateLimitIxArgs, aa as SetTokenCircuitBreakerIxArgs, ab as SetTokenCircuitBreakerTxArgs, ac as SetYieldingBankCircuitBreakerIxArgs, ad as SetYieldingBankCircuitBreakerTxArgs, ae as UpdateLendingPositionConfigIxArgs, af as UpdateTokenConfigurationIxArgs, ag as UpdateTokenMetadataIxArgs, ah as UpdateYieldingBankConfigIxArgs, ai as TransactionPlan, aj as BurnTokenBuilder, ak as MintTokenBuilder, al as PdaClient, am as SwapClient, an as LendingPlatformClientRegistry, ao as SupportedLendingPlatformClients, ap as SendTransactionOptionsWithPostSuccess, aq as OutstandingIncentive, ar as KaminoClient, as as DecreaseCarryPositionBuilderParams, at as IndexedLendingPosition, au as RebalanceSwapSpec, av as RedemptionEpochSnapshot } from './core-DP6wfpME.mjs';
|
|
2
|
+
export { aw as AMOUNT_ALL_SENTINEL, ax as AnchorInterestDistribution, ay as AnchorLendingType, az as AssetAllocationConfig, aA as AssetConfig, aB as BundledBurnPlan, aC as BurnTokenIxParams, aD as BurnTokenTxParams, aE as CIRCUIT_BREAKER_CONTROLLER, aF as ClaimIncentivesParams, aG as ClaimIncentivesTxParams, aH as CollectInterestParams, aI as CollectInterestTxParams, aJ as CreateCpiPlanParams, aK as CreateTokenParams, aL as CreateYieldingBankParams, aM as DEFAULT_MIN_INCENTIVE_UI_AMOUNT, aN as DEFAULT_RECOLLATERALIZE_LOSS_SLIPPAGE_BPS, aO as DecreaseCarryPositionParams, aP as DecreaseCarryPositionTxPlanParams, aQ as DecreaseCarryRepaySteering, aR as DepositUnlentCollateralParams, aS as DepositUnlentCollateralTxParams, aT as ExternalPositionConfig, aU as FeeConfig, aV as GENERAL_LOOKUP_TABLES, aW as GroupedCpiExecutionPlan, aX as IncreaseCarryPositionParams, aY as IncreaseCarryPositionTxParams, aZ as IndexedCarryPosition, a_ as InterestDistribution, a$ as LYC_ADMIN_KEYPAIR_FP, b0 as LYC_CB_KEYPAIR_FP, b1 as LYC_MANAGER_KEYPAIR_FP, b2 as LYC_PROGRAM_IDS, b3 as LYC_TOKEN_METADATA, b4 as LendingType, b5 as LongYieldCarryTransactionPlanDebug, b6 as LycTokenMetadataEntry, b7 as MANAGER, b8 as MAX_HEAP_FRAME_BYTES, b9 as MintAmounts, ba as MintTokenTxParams, bb as OracleConfigDetails, bc as PROGRAM_ID, bd as PROTOCOL_ADMIN, be as PROTOCOL_FEE_WALLET, bf as PlannedInstructionBase, bg as ProcessAsyncBurnTxParams, bh as REBALANCE_TOKEN_RATE_LIMIT_SECS, bi as REDEMPTION_EPOCH_STATUS_FUNDING, bj as REDEMPTION_EPOCH_STATUS_OPEN, bk as REDEMPTION_EPOCH_STATUS_PROCESSING, bl as RebalanceTokenParams, bm as RebalanceTokenTxParams, bn as RebalanceYieldingBankParams, bo as RebalanceYieldingBankTxParams, bp as RecollateralizeLossParams, bq as RecollateralizeLossTxParams, br as RefreshTokensTxParams, bs as SetRedemptionEpochStatusParams, bt as TOKEN_LOOKUP_TABLES, bu as TOKEN_STALENESS_THRESHOLD_SECS, bv as TokenAccountData, bw as TokenCarryPositionData, bx as TokenLpPositionAccountOverrides, by as TopUpUnlentReservesParams, bz as TopUpUnlentReservesTxParams, bA as UpdateLendingPositionConfigParams, bB as UpdateTokenConfigurationParams, bC as UpdateTokenMetadataParams, bD as UpdateYieldingBankConfigParams, bE as UserHolding, bF as enumToInterestDistribution, bG as enumToLendingType, bH as interestDistributionToEnum, bI as lendingTypeToEnum } from './core-DP6wfpME.mjs';
|
|
3
|
+
import { Address, Instruction, TransactionSigner, Rpc, SolanaRpcApi, KeyPairSigner, Signature } from '@solana/kit';
|
|
4
|
+
import { BN, IdlTypes, AnchorProvider } from '@anchor-lang/core';
|
|
5
|
+
import { PriceResult } from 'oracle-service';
|
|
6
|
+
import '@solana-program/token';
|
|
7
|
+
import 'bn.js';
|
|
8
|
+
import '@kamino-finance/klend-sdk';
|
|
9
|
+
import '@kamino-finance/farms-sdk';
|
|
10
|
+
import '@kamino-finance/scope-sdk/dist/@codegen/scope/accounts';
|
|
11
|
+
|
|
12
|
+
type AssetType = "LST" | "YBA" | "Stablecoin" | "Standard";
|
|
13
|
+
interface MintConfig {
|
|
14
|
+
address: Address;
|
|
15
|
+
symbol: string;
|
|
16
|
+
decimals: number;
|
|
17
|
+
name?: string;
|
|
18
|
+
assetType: AssetType;
|
|
19
|
+
isToken2022?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Runtime information for a token mint.
|
|
23
|
+
* Extends MintConfig with methods for dynamic data.
|
|
24
|
+
*/
|
|
25
|
+
interface MintInfo extends MintConfig {
|
|
26
|
+
tokenProgram: Address;
|
|
27
|
+
/**
|
|
28
|
+
* Get the current APY for this token (LSTs & YBAs only).
|
|
29
|
+
* Returns undefined for non-LST tokens.
|
|
30
|
+
*/
|
|
31
|
+
getApy?: () => Promise<number | undefined>;
|
|
32
|
+
toUiAmount: (amount: bigint | BN) => number;
|
|
33
|
+
fromUiAmount: (amount: number) => BN;
|
|
34
|
+
}
|
|
35
|
+
interface MintRegistryOptions {
|
|
36
|
+
/** Default: true */
|
|
37
|
+
includeDefaults?: boolean;
|
|
38
|
+
custom?: MintConfig[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Registry for token mint information.
|
|
43
|
+
*
|
|
44
|
+
* Provides a unified interface to query token metadata by address or symbol.
|
|
45
|
+
* Supports both well-known tokens and custom configurations.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* // Create registry with defaults
|
|
50
|
+
* const mints = new MintRegistry();
|
|
51
|
+
*
|
|
52
|
+
* // Query by symbol
|
|
53
|
+
* const usdc = mints.get("USDC");
|
|
54
|
+
* console.log(usdc?.decimals); // 6
|
|
55
|
+
*
|
|
56
|
+
* // Query by address
|
|
57
|
+
* const token = mints.get(someAddress);
|
|
58
|
+
* console.log(token?.symbol); // "USDC"
|
|
59
|
+
*
|
|
60
|
+
* // Add custom tokens
|
|
61
|
+
* const mints = new MintRegistry({
|
|
62
|
+
* custom: [{ address: "...", symbol: "MY_TOKEN", decimals: 9 }]
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
declare class MintRegistry {
|
|
67
|
+
private byAddress;
|
|
68
|
+
private bySymbol;
|
|
69
|
+
constructor(options?: MintRegistryOptions);
|
|
70
|
+
/**
|
|
71
|
+
* Register a new mint configuration.
|
|
72
|
+
* Overwrites existing entries with the same address or symbol.
|
|
73
|
+
*/
|
|
74
|
+
register(config: MintConfig): void;
|
|
75
|
+
/**
|
|
76
|
+
* Get mint information by address or symbol.
|
|
77
|
+
*
|
|
78
|
+
* @param mint - Mint address or token symbol (case-insensitive)
|
|
79
|
+
* @returns MintInfo if found, undefined otherwise
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* mints.get("USDC")?.decimals // 6
|
|
84
|
+
* mints.get(usdcAddress)?.symbol // "USDC"
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
get(mint: MintIdentifier): MintInfo | undefined;
|
|
88
|
+
all(): MintInfo[];
|
|
89
|
+
standardAssets(): MintInfo[];
|
|
90
|
+
stablecoins(): MintInfo[];
|
|
91
|
+
lsts(): MintInfo[];
|
|
92
|
+
yieldBearingAssets(): MintInfo[];
|
|
93
|
+
filterAssetsByType(assetType: AssetType): MintInfo[];
|
|
94
|
+
symbols(): string[];
|
|
95
|
+
addresses(): Address[];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface ReservesPrices {
|
|
99
|
+
supply: PriceResult;
|
|
100
|
+
debt: PriceResult;
|
|
101
|
+
}
|
|
102
|
+
interface DebtAdjustmentOptions {
|
|
103
|
+
/**
|
|
104
|
+
* How the position changes when debt is adjusted.
|
|
105
|
+
* `levered` models a loop / flash-loan rebalance where borrowed funds also
|
|
106
|
+
* increase supplied collateral.
|
|
107
|
+
* `debtOnly` models changes such as carry-position borrows where only debt
|
|
108
|
+
* changes and supplied collateral stays constant.
|
|
109
|
+
*/
|
|
110
|
+
positionChangeMode?: "levered" | "debtOnly";
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Manages a supply/debt reserve pair and provides calculations
|
|
114
|
+
* for APY, simulations, and debt adjustments.
|
|
115
|
+
*/
|
|
116
|
+
declare class ReservesManager {
|
|
117
|
+
supplyReserve: ReserveBase;
|
|
118
|
+
debtReserve: ReserveBase;
|
|
119
|
+
private environment?;
|
|
120
|
+
private cache;
|
|
121
|
+
constructor(supplyReserve: ReserveBase, debtReserve: ReserveBase, environment?: Environment | undefined);
|
|
122
|
+
/** Max LTV ratio (0-1), using e-mode override when the pair qualifies */
|
|
123
|
+
get maxLtv(): number;
|
|
124
|
+
/**
|
|
125
|
+
* Returns supply and debt token prices.
|
|
126
|
+
* Uses reserve-embedded prices when available, otherwise fetches from oracle and caches the result.
|
|
127
|
+
*/
|
|
128
|
+
prices(): Promise<ReservesPrices>;
|
|
129
|
+
/**
|
|
130
|
+
* Net APY for the lending & borrowing position.
|
|
131
|
+
* Accounts for eligible incentives based on the paired reserve relationship.
|
|
132
|
+
*/
|
|
133
|
+
get netAPY(): number;
|
|
134
|
+
/**
|
|
135
|
+
* Simulates net APY after hypothetical position changes.
|
|
136
|
+
* Accounts for eligible incentives based on the paired reserve relationship.
|
|
137
|
+
*/
|
|
138
|
+
simulateNetAPY(args: PositionBalanceChange[]): number;
|
|
139
|
+
/** Current LTV utilization rate in basis points (0-10000) given USD position values */
|
|
140
|
+
calcLtvUtilizationRateBps(supplyUsd: number, debtUsd: number): number;
|
|
141
|
+
/**
|
|
142
|
+
* Calculates the USD debt adjustment needed to reach a target LTV utilization rate.
|
|
143
|
+
* Positive result = boost (increase leverage), negative = deleverage.
|
|
144
|
+
*/
|
|
145
|
+
calcDebtAdjustmentUsd(uiSupplyAmount: number, uiDebtAmount: number, targetLtvUtilizationRateBps: number, options?: DebtAdjustmentOptions): Promise<number>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
interface LendingPositionState {
|
|
149
|
+
prices: ReservesPrices;
|
|
150
|
+
supplyUsd: number;
|
|
151
|
+
debtUsd: number;
|
|
152
|
+
}
|
|
153
|
+
interface CollateralPriceTriggerLevel {
|
|
154
|
+
currentCollateralPrice: number;
|
|
155
|
+
triggerCollateralPrice: number;
|
|
156
|
+
targetUtilizationRateBps: number;
|
|
157
|
+
priceMode: "realtime" | "ema";
|
|
158
|
+
priceChangePct: number;
|
|
159
|
+
}
|
|
160
|
+
interface CollateralPriceTriggerBand {
|
|
161
|
+
lower?: CollateralPriceTriggerLevel;
|
|
162
|
+
upper?: CollateralPriceTriggerLevel;
|
|
163
|
+
}
|
|
164
|
+
interface LendingPositionUtilizationRatesBps {
|
|
165
|
+
realtime: number;
|
|
166
|
+
ema: number;
|
|
167
|
+
}
|
|
168
|
+
interface LendingPositionSelectedPrice {
|
|
169
|
+
value: number;
|
|
170
|
+
source: "realtime" | "ema" | "ema_fallback_realtime";
|
|
171
|
+
}
|
|
172
|
+
interface LendingPositionUtilizationPrices {
|
|
173
|
+
realtime: {
|
|
174
|
+
collateral: LendingPositionSelectedPrice;
|
|
175
|
+
debt: LendingPositionSelectedPrice;
|
|
176
|
+
};
|
|
177
|
+
ema: {
|
|
178
|
+
collateral: LendingPositionSelectedPrice;
|
|
179
|
+
debt: LendingPositionSelectedPrice;
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
interface LendingPositionInspectMetrics {
|
|
183
|
+
utilizationRateBps: LendingPositionUtilizationRatesBps;
|
|
184
|
+
utilizationPrices: LendingPositionUtilizationPrices;
|
|
185
|
+
triggerBand: CollateralPriceTriggerBand;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Manages a leveraged lending position (collateral/debt pair): sizing decisions,
|
|
190
|
+
* threshold triggers, and realtime/EMA-priced state. Wraps a {@link ReservesManager}.
|
|
191
|
+
*
|
|
192
|
+
* Generic across protocols — the constructor takes pool + user-account addresses
|
|
193
|
+
* directly. SDK-specific subclasses may add convenience wrappers that derive
|
|
194
|
+
* targets from their own on-chain config.
|
|
195
|
+
*/
|
|
196
|
+
declare class LendingPositionManager {
|
|
197
|
+
readonly lpData: LendingPlatformData;
|
|
198
|
+
readonly pool: Address;
|
|
199
|
+
readonly userAccount: Address;
|
|
200
|
+
readonly reservesManager: ReservesManager;
|
|
201
|
+
constructor(lpData: LendingPlatformData, pool: Address, userAccount: Address, collateralReserve: ReserveBase, debtReserve: ReserveBase, environment?: Environment);
|
|
202
|
+
/**
|
|
203
|
+
* Calculates the UI debt amount change needed to reach the target LTV utilization
|
|
204
|
+
* rate. Positive values indicate borrowing; negative values indicate repaying.
|
|
205
|
+
*/
|
|
206
|
+
calcDebtChangeAmount(targetUtilizationRateBps: number): Promise<number>;
|
|
207
|
+
/**
|
|
208
|
+
* Fetch current supply and debt position amounts in UI units.
|
|
209
|
+
*/
|
|
210
|
+
getLendingPositionAmounts(): Promise<{
|
|
211
|
+
supplyUiAmount: number;
|
|
212
|
+
debtUiAmount: number;
|
|
213
|
+
}>;
|
|
214
|
+
/**
|
|
215
|
+
* Calculates the utilization rate the source position must reach before a
|
|
216
|
+
* collateral withdrawal so that, after the withdrawal, the position lands at
|
|
217
|
+
* the desired target utilization rate.
|
|
218
|
+
*
|
|
219
|
+
* Units:
|
|
220
|
+
* - current supply USD = supplied collateral before withdrawal
|
|
221
|
+
* - withdrawn USD = collateral requested for the rebalance move
|
|
222
|
+
* - post-withdraw target = desired utilization after collateral leaves the LP
|
|
223
|
+
*
|
|
224
|
+
* Formula:
|
|
225
|
+
* pre_withdraw_target = post_withdraw_target * (current_supply - withdrawn) / current_supply
|
|
226
|
+
*
|
|
227
|
+
* The result is floored to stay conservatively at or below the requested
|
|
228
|
+
* post-withdraw target once integer basis-point rounding is applied.
|
|
229
|
+
*/
|
|
230
|
+
calcPreWithdrawalTargetUtilizationRateBps(withdrawUiCollateralAmount: number, postWithdrawalTargetUtilizationRateBps: number): Promise<number>;
|
|
231
|
+
/**
|
|
232
|
+
* Calculates the UI debt amount change needed before a collateral withdrawal
|
|
233
|
+
* so that the position lands at the desired utilization rate after the
|
|
234
|
+
* withdrawal completes.
|
|
235
|
+
*/
|
|
236
|
+
calcDebtChangeAmountForCollateralWithdrawal(withdrawUiCollateralAmount: number, postWithdrawalTargetUtilizationRateBps: number): Promise<number>;
|
|
237
|
+
/**
|
|
238
|
+
* Calculates the utilization rate after withdrawing collateral while leaving
|
|
239
|
+
* debt unchanged.
|
|
240
|
+
*/
|
|
241
|
+
calcPostWithdrawalUtilizationRateBps(withdrawUiCollateralAmount: number): Promise<number>;
|
|
242
|
+
/**
|
|
243
|
+
* For burn-token liquidity management: checks that a withdrawal of
|
|
244
|
+
* `collateralWithdrawalUiAmount` (collateral mint UI units) leaves strictly
|
|
245
|
+
* positive supplied collateral, matching the pre-withdraw math used in
|
|
246
|
+
* {@link calcPreWithdrawalTargetUtilizationRateBps}.
|
|
247
|
+
*
|
|
248
|
+
* Returns realtime LTV utilization in basis points when eligible; null when the
|
|
249
|
+
* obligation is missing, has no supply, prices are invalid, or the withdrawal
|
|
250
|
+
* would consume the full (or more than the full) collateral position.
|
|
251
|
+
*/
|
|
252
|
+
getBurnUnwindEligibility(collateralWithdrawalUiAmount: number): Promise<{
|
|
253
|
+
utilizationRateBps: number;
|
|
254
|
+
} | null>;
|
|
255
|
+
/**
|
|
256
|
+
* Returns the collateral price levels that would place the position exactly on
|
|
257
|
+
* its lower and upper utilization trigger bands.
|
|
258
|
+
*
|
|
259
|
+
* The lower-band trigger uses EMA pricing (to mirror boost-trigger semantics),
|
|
260
|
+
* while the upper-band trigger uses realtime pricing (to mirror unwind-trigger
|
|
261
|
+
* semantics).
|
|
262
|
+
*/
|
|
263
|
+
getCollateralPriceTriggerBand(params: {
|
|
264
|
+
lowerTargetUtilizationRateBps: number;
|
|
265
|
+
upperTargetUtilizationRateBps: number;
|
|
266
|
+
}): Promise<CollateralPriceTriggerBand>;
|
|
267
|
+
getUtilizationRatesBps(): Promise<LendingPositionUtilizationRatesBps | null>;
|
|
268
|
+
getUtilizationPrices(): Promise<LendingPositionUtilizationPrices | null>;
|
|
269
|
+
getInspectMetrics(params: {
|
|
270
|
+
lowerTargetUtilizationRateBps: number;
|
|
271
|
+
upperTargetUtilizationRateBps: number;
|
|
272
|
+
}): Promise<LendingPositionInspectMetrics | null>;
|
|
273
|
+
protected getPositionState(mode: "realtime" | "ema"): Promise<LendingPositionState | null>;
|
|
274
|
+
private calcPositionSupplyDebtUsd;
|
|
275
|
+
private selectPrice;
|
|
276
|
+
private getCollateralPriceTriggerLevel;
|
|
277
|
+
/**
|
|
278
|
+
* Solve for collateral price at a target utilization:
|
|
279
|
+
* utilization = debtUsd / (collateralAmount * collateralPrice * maxLtv).
|
|
280
|
+
*/
|
|
281
|
+
private calcCollateralPriceForTargetUtilization;
|
|
282
|
+
private calcDebtChangeAmountFromState;
|
|
283
|
+
/**
|
|
284
|
+
* Quantize to the debt mint's base-unit precision. Borrows floor; repays round
|
|
285
|
+
* away from zero so deleveraging does not undershoot.
|
|
286
|
+
*/
|
|
287
|
+
private quantizeDebtChangeUiAmount;
|
|
288
|
+
/** Cap positive borrows to obligation headroom when the platform exposes it. */
|
|
289
|
+
private capPositiveBorrowToProtocolHeadroom;
|
|
290
|
+
private calcPreWithdrawalTargetUtilizationRateBpsFromState;
|
|
291
|
+
private calcPostWithdrawalUtilizationRateBpsFromState;
|
|
292
|
+
protected assertValidUtilizationRateBps(value: number, field: string): void;
|
|
293
|
+
/**
|
|
294
|
+
* Unwind/boost trigger bands may exceed 100% LTV utilization (up to 10_500 bps
|
|
295
|
+
* on-chain). Debt-sizing paths still use {@link assertValidUtilizationRateBps}.
|
|
296
|
+
*/
|
|
297
|
+
protected assertValidTriggerBandUtilizationRateBps(value: number, field: string): void;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Deterministic inputs for deriving a `collect_interest` plan.
|
|
302
|
+
*/
|
|
303
|
+
interface CollectInterestPlanParams {
|
|
304
|
+
/** Yielding bank whose active carry position should be partially redeemed. */
|
|
305
|
+
yieldingBank: Address;
|
|
306
|
+
/**
|
|
307
|
+
* Minimum net yield (in USD) below which collection is skipped.
|
|
308
|
+
* Prevents wasteful swaps when accrued interest is negligible.
|
|
309
|
+
* Value is in human-readable USD (e.g. 0.5 = $0.50).
|
|
310
|
+
*/
|
|
311
|
+
minYieldUsd?: number;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* One yielding-bank holding that should be redeemed during interest collection.
|
|
315
|
+
*/
|
|
316
|
+
interface CollectInterestHoldingPlan {
|
|
317
|
+
/** Mint held by the yielding bank allocation. */
|
|
318
|
+
mint: Address;
|
|
319
|
+
/** Amount to redeem in raw base units for this holding. */
|
|
320
|
+
amount: BN;
|
|
321
|
+
/** Whether this holding came from the bank's base-asset slot. */
|
|
322
|
+
isBaseAsset: boolean;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Deterministic `collect_interest` plan produced by `client.planner`.
|
|
326
|
+
*
|
|
327
|
+
* This captures protocol-derived values only: the active carry position,
|
|
328
|
+
* shares to burn, and the ordered bank holdings that should be redeemed.
|
|
329
|
+
* It intentionally does not encode swap venue or routing policy.
|
|
330
|
+
*/
|
|
331
|
+
interface CollectInterestPlan {
|
|
332
|
+
/** Token PDA whose carry position is collecting accrued yield. */
|
|
333
|
+
token: Address;
|
|
334
|
+
/** Yielding bank the active carry position is allocated to. */
|
|
335
|
+
yieldingBank: Address;
|
|
336
|
+
/** Base mint configured on the yielding bank. */
|
|
337
|
+
baseMint: Address;
|
|
338
|
+
/** Default redemption asset that accrued interest is collected from. */
|
|
339
|
+
redemption: PricedMint;
|
|
340
|
+
/** Token collateral asset that collection must ultimately end in. */
|
|
341
|
+
collateral: PricedMint;
|
|
342
|
+
/** Index of the active `debtCarry` entry on the token account. */
|
|
343
|
+
carryIndex: number;
|
|
344
|
+
/** Number of carry-position shares the program should burn. */
|
|
345
|
+
sharesToBurn: BN;
|
|
346
|
+
/** USD value represented by the burned shares, in program-scale units. */
|
|
347
|
+
sharesBurnedValueUsd: BN;
|
|
348
|
+
/** Ordered yielding-bank holdings to redeem before final collateral settlement. */
|
|
349
|
+
holdingsToRedeem: CollectInterestHoldingPlan[];
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Caller-controlled routing inputs for turning a deterministic collect-interest
|
|
353
|
+
* plan into concrete swap CPI data.
|
|
354
|
+
*/
|
|
355
|
+
interface CollectInterestRouteBuilderParams {
|
|
356
|
+
/** Final output mint. Defaults to `plan.collateral.mint`. */
|
|
357
|
+
outputMint?: Address;
|
|
358
|
+
/** Slippage tolerance applied to all collect-interest swaps. Defaults to `100`. */
|
|
359
|
+
slippageBps?: number;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Manual CPI inputs for callers that already know the exact swap sequence they
|
|
363
|
+
* want `collect_interest` to execute.
|
|
364
|
+
*/
|
|
365
|
+
interface CollectInterestBuilderParams {
|
|
366
|
+
/** Yielding bank whose shares will be redeemed. */
|
|
367
|
+
yieldingBank: Address;
|
|
368
|
+
/** Prebuilt CPI descriptors that swap redeemed assets into collateral. */
|
|
369
|
+
cpiData: CpiData[];
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Fully executable `collect_interest` plan produced by `client.routeBuilder`.
|
|
373
|
+
*
|
|
374
|
+
* Extends the deterministic planner result with the exact CPI sequence,
|
|
375
|
+
* pre-instructions, and initial accounts required by the final tx composer.
|
|
376
|
+
*/
|
|
377
|
+
interface CollectInterestExecutionPlan extends CollectInterestPlan, SingleCpiExecutionPlan {
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Precomputed execution-plan wrapper accepted by `client.tx.collectInterest.getTx({...})`.
|
|
381
|
+
*/
|
|
382
|
+
interface CollectInterestTxPlanParams {
|
|
383
|
+
/** Route-builder result previously returned by `client.routeBuilder.buildCollectInterestRoutePlan()`. */
|
|
384
|
+
plan: CollectInterestExecutionPlan;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
declare class SetRedemptionEpochStatusBuilder extends LongYieldCarryBuilderBase<SetRedemptionEpochStatusIxArgs, SetRedemptionEpochStatusIxArgs> {
|
|
388
|
+
getTx(args: SetRedemptionEpochStatusIxArgs): Promise<LongYieldCarryTransactionPlan>;
|
|
389
|
+
getIx(args: SetRedemptionEpochStatusIxArgs): Promise<Instruction>;
|
|
390
|
+
}
|
|
391
|
+
declare class TopUpUnlentReservesBuilder extends LongYieldCarryBuilderBase<TopUpUnlentReservesIxArgs, TopUpUnlentReservesTxArgs> {
|
|
392
|
+
getTx(args: TopUpUnlentReservesTxArgs): Promise<LongYieldCarryTransactionPlan>;
|
|
393
|
+
getIx(args: TopUpUnlentReservesIxArgs): Promise<Instruction>;
|
|
394
|
+
}
|
|
395
|
+
declare class CreditUnlentToRedemptionEpochBuilder extends LongYieldCarryBuilderBase<CreditUnlentToRedemptionEpochIxArgs, CreditUnlentToRedemptionEpochIxArgs> {
|
|
396
|
+
getTx(args: CreditUnlentToRedemptionEpochIxArgs): Promise<LongYieldCarryTransactionPlan>;
|
|
397
|
+
getIx(args: CreditUnlentToRedemptionEpochIxArgs): Promise<Instruction>;
|
|
398
|
+
}
|
|
399
|
+
declare class ProcessAsyncBurnBuilder extends LongYieldCarryBuilderBase<ProcessAsyncBurnIxArgs, ProcessAsyncBurnTxArgs> {
|
|
400
|
+
getTx(args: ProcessAsyncBurnTxArgs): Promise<LongYieldCarryTransactionPlan>;
|
|
401
|
+
getIx(args: ProcessAsyncBurnIxArgs): Promise<Instruction>;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
declare function getRefreshTokenInstructionsIfStale(context: LongYieldCarryBuilderContext, signer: Address, tokenData: LYCToken): Promise<Instruction[]>;
|
|
405
|
+
|
|
406
|
+
declare class ClaimIncentivesBuilder extends LongYieldCarryBuilderBase<ClaimIncentivesIxArgs, ClaimIncentivesTxArgs> {
|
|
407
|
+
getIx(args: ClaimIncentivesIxArgs): Promise<Instruction>;
|
|
408
|
+
getTx(args: ClaimIncentivesTxArgs): Promise<LongYieldCarryTransactionPlan>;
|
|
409
|
+
private resolveIncentiveOracle;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Collects pending fees for either the curator or the protocol. The caller
|
|
414
|
+
* passes the `authority` signer. If it is `PROTOCOL_ADMIN`, the protocol bucket and
|
|
415
|
+
* protocol fee wallet are used (even when that address is also the token curator).
|
|
416
|
+
* Otherwise, if it is the curator only, the curator bucket and curator fee wallet are used.
|
|
417
|
+
* Throws client-side if the signer matches neither role (mirroring the on-chain check).
|
|
418
|
+
*/
|
|
419
|
+
declare class CollectFeesBuilder extends LongYieldCarrySingleInstructionBuilderService<CollectFeesIxArgs> {
|
|
420
|
+
getIx(args: CollectFeesIxArgs): Promise<Instruction>;
|
|
421
|
+
protected buildLookupTables(args: CollectFeesIxArgs): Promise<readonly Address[]>;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
declare class CollectInterestBuilder extends LongYieldCarryBuilderBase<CollectInterestIxArgs, CollectInterestTxArgs> {
|
|
425
|
+
getIx(args: CollectInterestIxArgs): Promise<Instruction>;
|
|
426
|
+
getTx(args: CollectInterestTxArgs): Promise<LongYieldCarryTransactionPlan>;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
declare class CreateCpiPlanBuilder extends LongYieldCarrySingleInstructionBuilderService<CreateCpiPlanIxArgs> {
|
|
430
|
+
getIx(args: CreateCpiPlanIxArgs): Promise<Instruction>;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
declare class CreateTokenBuilder extends LongYieldCarrySingleInstructionBuilderService<CreateTokenIxArgs> {
|
|
434
|
+
getIx(args: CreateTokenIxArgs): Promise<Instruction>;
|
|
435
|
+
protected buildLookupTables(): Promise<readonly Address[]>;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
declare class CreateTokenLendingPositionBuilder extends LongYieldCarryBuilderBase<CreateTokenLendingPositionIxArgs, CreateTokenLendingPositionTxArgs> {
|
|
439
|
+
getIx(args: CreateTokenLendingPositionIxArgs): Promise<Instruction>;
|
|
440
|
+
getTx(txArgs: CreateTokenLendingPositionTxArgs): Promise<LongYieldCarryTransactionPlan>;
|
|
441
|
+
private buildSetupCpis;
|
|
442
|
+
private buildRefreshCpis;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
declare class CreateYieldingBankAllocationBuilder extends LongYieldCarrySingleInstructionBuilderService<CreateYieldingBankAllocationIxArgs> {
|
|
446
|
+
getIx(args: CreateYieldingBankAllocationIxArgs): Promise<Instruction>;
|
|
447
|
+
protected buildLookupTables(): Promise<readonly Address[]>;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
declare class CreateYieldingBankBuilder extends LongYieldCarrySingleInstructionBuilderService<CreateYieldingBankIxArgs> {
|
|
451
|
+
getIx(args: CreateYieldingBankIxArgs): Promise<Instruction>;
|
|
452
|
+
protected buildLookupTables(): Promise<readonly Address[]>;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
type FeeDripAbsorptionStatus = "estimated" | "no_fees" | "parked" | "unavailable";
|
|
456
|
+
interface FeeDripMetricsInput {
|
|
457
|
+
currentPriceRaw: bigint;
|
|
458
|
+
apyReferencePriceRaw: bigint;
|
|
459
|
+
apyReferenceTs: bigint;
|
|
460
|
+
/** Timestamp at which `currentPriceRaw` was last written on-chain. */
|
|
461
|
+
currentPriceTs: bigint;
|
|
462
|
+
totalSupplyRaw: bigint;
|
|
463
|
+
tokenDecimals: number;
|
|
464
|
+
undrippedFeeCollateralRaw: bigint;
|
|
465
|
+
feeDripMaxApyBps: number;
|
|
466
|
+
nowTs: bigint;
|
|
467
|
+
}
|
|
468
|
+
interface FeeDripMetrics {
|
|
469
|
+
/** Simple annualized price return from the on-chain APY reference, in basis points. */
|
|
470
|
+
currentApyBps: number | null;
|
|
471
|
+
/** Estimated seconds until the current fee buffer is fully released. */
|
|
472
|
+
absorptionEtaSeconds: number | null;
|
|
473
|
+
absorptionStatus: FeeDripAbsorptionStatus;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Derives the current fee-window APY and a simple absorption ETA.
|
|
477
|
+
*
|
|
478
|
+
* ETA assumes fees release at the configured target APY:
|
|
479
|
+
* remaining_price_return = buffer * 10^decimals / (supply * price)
|
|
480
|
+
* eta_seconds = remaining_price_return / (target_apy_bps / 10_000) * seconds_per_year
|
|
481
|
+
*
|
|
482
|
+
* A zero target parks the buffer. Current-window APY is reported separately and
|
|
483
|
+
* does not change the ETA.
|
|
484
|
+
*/
|
|
485
|
+
declare function calculateFeeDripMetrics(input: FeeDripMetricsInput): FeeDripMetrics;
|
|
486
|
+
|
|
487
|
+
interface YieldingBankInspectSnapshotArgs {
|
|
488
|
+
environment: "local" | "test" | "prod";
|
|
489
|
+
mintRegistry: MintRegistry;
|
|
490
|
+
timelocksEnabledInLocal?: boolean;
|
|
491
|
+
}
|
|
492
|
+
interface TokenInspectSnapshotArgs {
|
|
493
|
+
environment: "local" | "test" | "prod";
|
|
494
|
+
mintRegistry: MintRegistry;
|
|
495
|
+
yieldingBanks: readonly LYCYieldingBank[];
|
|
496
|
+
kaminoData: LendingPlatformData;
|
|
497
|
+
timelocksEnabledInLocal?: boolean;
|
|
498
|
+
/** Unix timestamp override for deterministic APY/fee-drip projections. */
|
|
499
|
+
nowTs?: number;
|
|
500
|
+
}
|
|
501
|
+
interface EnrichedYieldingBankHolding {
|
|
502
|
+
kind: "base" | "asset";
|
|
503
|
+
mint: Address;
|
|
504
|
+
symbol: string;
|
|
505
|
+
amountRaw: bigint;
|
|
506
|
+
amountUi: number;
|
|
507
|
+
decimals: number;
|
|
508
|
+
priceRaw: bigint;
|
|
509
|
+
priceUi: number;
|
|
510
|
+
isTimelocked: boolean;
|
|
511
|
+
}
|
|
512
|
+
interface EnrichedYieldingBankExternalPosition {
|
|
513
|
+
platform: LendingPlatform;
|
|
514
|
+
pool: Address;
|
|
515
|
+
tvlRaw: bigint;
|
|
516
|
+
tvlUsd: number;
|
|
517
|
+
isTimelocked: boolean;
|
|
518
|
+
}
|
|
519
|
+
interface EnrichedYieldingBankSnapshot {
|
|
520
|
+
address: Address;
|
|
521
|
+
id: number;
|
|
522
|
+
curator: Address;
|
|
523
|
+
baseMint: Address;
|
|
524
|
+
baseSymbol: string;
|
|
525
|
+
isActive: boolean;
|
|
526
|
+
circuitBreaker: number;
|
|
527
|
+
decimals: number;
|
|
528
|
+
tvlRaw: bigint;
|
|
529
|
+
tvlUsd: number;
|
|
530
|
+
sharePrice: number;
|
|
531
|
+
totalShares: number;
|
|
532
|
+
lastRefreshedTs: bigint;
|
|
533
|
+
lastRebalancedTs: bigint;
|
|
534
|
+
isTimelocked: boolean;
|
|
535
|
+
defaultRedemptionMint?: Address;
|
|
536
|
+
defaultRedemptionSymbol?: string;
|
|
537
|
+
holdings: EnrichedYieldingBankHolding[];
|
|
538
|
+
externalYieldingPositions: EnrichedYieldingBankExternalPosition[];
|
|
539
|
+
}
|
|
540
|
+
interface EnrichedTokenCollateralSnapshot {
|
|
541
|
+
mint: Address;
|
|
542
|
+
symbol: string;
|
|
543
|
+
decimals: number;
|
|
544
|
+
unlentAmountRaw: bigint;
|
|
545
|
+
unlentAmountUi: number;
|
|
546
|
+
pendingUnwindResidualRaw: bigint;
|
|
547
|
+
pendingUnwindResidualUi: number;
|
|
548
|
+
oraclePriceRaw: bigint;
|
|
549
|
+
oraclePriceOnChainUi: number;
|
|
550
|
+
oraclePriceRealtimeUi: number;
|
|
551
|
+
oraclePriceEmaUi: number;
|
|
552
|
+
oracle: Address;
|
|
553
|
+
/** Set for composite oracle types (e.g. PythSplStake stake pool). */
|
|
554
|
+
secondaryOracle?: Address;
|
|
555
|
+
lastRefreshedTs: bigint;
|
|
556
|
+
}
|
|
557
|
+
interface EnrichedTokenLendingPosition {
|
|
558
|
+
index: number;
|
|
559
|
+
platform: LendingPlatform;
|
|
560
|
+
withdrawPending: boolean;
|
|
561
|
+
pool: Address;
|
|
562
|
+
userAccount: Address;
|
|
563
|
+
collateralAmountRaw: bigint;
|
|
564
|
+
collateralAmountUi: number;
|
|
565
|
+
collateralDecimals: number;
|
|
566
|
+
collateralSymbol: string;
|
|
567
|
+
debtAmountRaw: bigint;
|
|
568
|
+
debtAmountUi: number;
|
|
569
|
+
debtTvlUsdRaw: bigint;
|
|
570
|
+
debtTvlUsd: number;
|
|
571
|
+
debtMint: Address;
|
|
572
|
+
debtSymbol: string;
|
|
573
|
+
debtDecimals: number;
|
|
574
|
+
debtPriceRaw: bigint;
|
|
575
|
+
debtPriceUi: number;
|
|
576
|
+
onChainUtilizationRateBps: number;
|
|
577
|
+
targetUtilizationRateBps: number;
|
|
578
|
+
maxDeviationAboveTargetUtilBps: number;
|
|
579
|
+
maxDeviationBelowTargetUtilBps: number;
|
|
580
|
+
/** Stamped only by `rebalance_token`; 0 means never rebalanced. */
|
|
581
|
+
lastRebalancedTs: bigint;
|
|
582
|
+
inspectMetrics?: LendingPositionInspectMetrics;
|
|
583
|
+
}
|
|
584
|
+
interface EnrichedTokenCarryPosition {
|
|
585
|
+
index: number;
|
|
586
|
+
yieldingBankId: number;
|
|
587
|
+
yieldingBankAddress?: Address;
|
|
588
|
+
baseMint: Address;
|
|
589
|
+
baseSymbol: string;
|
|
590
|
+
sharesRaw: bigint;
|
|
591
|
+
sharesUi?: number;
|
|
592
|
+
shareDecimals?: number;
|
|
593
|
+
tvlUsdRaw: bigint;
|
|
594
|
+
tvlUsd: number;
|
|
595
|
+
}
|
|
596
|
+
interface EnrichedTokenCarrySummary {
|
|
597
|
+
totalCarryTvlUsdRaw: bigint;
|
|
598
|
+
totalCarryTvlUsd: number;
|
|
599
|
+
totalDebtUsdRaw: bigint;
|
|
600
|
+
totalDebtUsd: number;
|
|
601
|
+
netYieldUsdRaw: bigint;
|
|
602
|
+
netYieldUsd: number;
|
|
603
|
+
}
|
|
604
|
+
interface EnrichedTokenFeesSnapshot {
|
|
605
|
+
mintingFeeBps: number;
|
|
606
|
+
burningFeeBps: number;
|
|
607
|
+
performanceFeeBps: number;
|
|
608
|
+
protocolMintBurnPctBps: number;
|
|
609
|
+
curatorMintBurnPctBps: number;
|
|
610
|
+
holderMintBurnPctBps: number;
|
|
611
|
+
curatorPerfPctBps: number;
|
|
612
|
+
feeDripMaxApyBps: number;
|
|
613
|
+
undrippedFeeCollateralRaw: bigint;
|
|
614
|
+
undrippedFeeCollateralUi: number;
|
|
615
|
+
apyReferencePriceRaw: bigint;
|
|
616
|
+
apyReferencePrice: number;
|
|
617
|
+
apyReferenceTs: bigint;
|
|
618
|
+
currentApyBps: number | null;
|
|
619
|
+
absorptionEtaSeconds: number | null;
|
|
620
|
+
absorptionStatus: FeeDripAbsorptionStatus;
|
|
621
|
+
pendingProtocolFeesRaw: bigint;
|
|
622
|
+
pendingProtocolFeesUi: number;
|
|
623
|
+
pendingCuratorFeesRaw: bigint;
|
|
624
|
+
pendingCuratorFeesUi: number;
|
|
625
|
+
}
|
|
626
|
+
interface EnrichedTokenSnapshot {
|
|
627
|
+
address: Address;
|
|
628
|
+
id: number;
|
|
629
|
+
curator: Address;
|
|
630
|
+
mint: Address;
|
|
631
|
+
decimals: number;
|
|
632
|
+
isActive: boolean;
|
|
633
|
+
price: number;
|
|
634
|
+
totalSupply: number;
|
|
635
|
+
tvlUsdRaw: bigint;
|
|
636
|
+
tvlUsd: number;
|
|
637
|
+
lastRefreshedTs: bigint;
|
|
638
|
+
firstMintTs: bigint;
|
|
639
|
+
collateral: EnrichedTokenCollateralSnapshot;
|
|
640
|
+
lendingPositions: EnrichedTokenLendingPosition[];
|
|
641
|
+
carryPositions: EnrichedTokenCarryPosition[];
|
|
642
|
+
carrySummary: EnrichedTokenCarrySummary;
|
|
643
|
+
/** True when the token is active and its positive carry surplus is at most 1 bp of debt. */
|
|
644
|
+
hasInterestToCollect: boolean;
|
|
645
|
+
fees: EnrichedTokenFeesSnapshot;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
declare function buildYieldingBankInspectSnapshot(bank: LYCYieldingBank, args: YieldingBankInspectSnapshotArgs): EnrichedYieldingBankSnapshot;
|
|
649
|
+
declare function buildTokenInspectSnapshot(token: LYCToken, args: TokenInspectSnapshotArgs): Promise<EnrichedTokenSnapshot>;
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Pure helpers over decoded long_yield_carry account data (`Token`, `YieldingBank`, etc.):
|
|
653
|
+
* selection logic, liquidity / holding analysis, and other algorithms that do not belong on
|
|
654
|
+
* `AccountClient` or transaction composers.
|
|
655
|
+
*/
|
|
656
|
+
|
|
657
|
+
/** Any object that can resolve a lending-platform client for a given position. */
|
|
658
|
+
interface LendingPlatformResolver {
|
|
659
|
+
getForPosition(position: TokenLendingPositionData): LendingPlatformClientBase<LendingPlatformData>;
|
|
660
|
+
}
|
|
661
|
+
declare function getBurnCollateralWithdrawalAmount(tokenData: LYCToken, burnAmount: BN | number): bigint;
|
|
662
|
+
declare function getBurnCollateralWithdrawalUiAmount(tokenData: LYCToken, burnAmount: BN | number, includeOneUnitTolerance?: boolean): number;
|
|
663
|
+
declare function computeBurnAmountsForFrontendEstimate(_account: AccountClient, tokenData: LYCToken, burnAmount: BN | number, _resolver: LendingPlatformResolver): Promise<BurnAmounts>;
|
|
664
|
+
/**
|
|
665
|
+
* True when at least one active lending position can supply the collateral implied by `burnAmount`
|
|
666
|
+
* for a liquidity-managed burn (same eligibility filter as {@link findPositionToUnwindForBurn}).
|
|
667
|
+
*/
|
|
668
|
+
declare function hasLendingPositionCoveringBurn(tokenData: LYCToken, burnAmount: BN | number, resolver: LendingPlatformResolver): Promise<boolean>;
|
|
669
|
+
/**
|
|
670
|
+
* True when the best burn-candidate lending position can absorb a collateral
|
|
671
|
+
* withdrawal for `burnAmount` without pushing the LTV utilization rate above
|
|
672
|
+
* the position's upper deviation band — meaning no `decrease_carry_position`
|
|
673
|
+
* (debt repayment) is required.
|
|
674
|
+
*
|
|
675
|
+
* Should only be called after {@link hasLendingPositionCoveringBurn} returns
|
|
676
|
+
* `true`; uses the same candidate selection logic as
|
|
677
|
+
* {@link findPositionToUnwindForBurn}.
|
|
678
|
+
*/
|
|
679
|
+
declare function isWithdrawOnlyBurnFeasible(tokenData: LYCToken, burnAmount: BN | number, resolver: LendingPlatformResolver): Promise<boolean>;
|
|
680
|
+
/**
|
|
681
|
+
* Chooses which `lendingPositions` slot to unwind for a burn liquidity-managed tx.
|
|
682
|
+
*
|
|
683
|
+
* Considers only active positions with a supported platform and collateral mint
|
|
684
|
+
* matching the token. Filters to positions that can cover `collateralWithdrawalUiAmount`
|
|
685
|
+
* (same strict less-than full-supply rule as pre-withdraw repay sizing). Among those,
|
|
686
|
+
* picks the position with the most deposited collateral (tie → lower index) so the
|
|
687
|
+
* burn unwind comes out of the deepest slot and small positions are left intact.
|
|
688
|
+
*
|
|
689
|
+
* @param getLendingPlatformClient - Resolves the Kamino (etc.) client for a position;
|
|
690
|
+
* kept injectable so callers are not tied to transaction wiring.
|
|
691
|
+
*/
|
|
692
|
+
declare function findPositionToUnwindForBurn(tokenData: LYCToken, collateralWithdrawalUiAmount: number, resolver: LendingPlatformResolver): Promise<{
|
|
693
|
+
lendingPositionIndex: number;
|
|
694
|
+
position: TokenLendingPositionData;
|
|
695
|
+
}>;
|
|
696
|
+
/**
|
|
697
|
+
* Picks the yielding bank to fund repay/swap during a burn liquidity-managed tx.
|
|
698
|
+
*
|
|
699
|
+
* Enumerates banks derived from active `debtCarry` entries on the token, fetches
|
|
700
|
+
* each account via `account.fetchYieldingBanks`, then:
|
|
701
|
+
* 1. Prefer a bank whose **debt mint** holding is at least `requiredDebtUiAmount` (debt token UI)
|
|
702
|
+
* and is largest among those sufficient balances (headroom for the unwind repay).
|
|
703
|
+
* 2. Otherwise prefer the bank whose **default redemption mint** holding has the largest
|
|
704
|
+
* balance in UI units (`toUiAmount` with the holding's on-chain `decimals`).
|
|
705
|
+
*
|
|
706
|
+
* Permissionless burn planning does not pass `sourceMint`; the default-redemption fallback
|
|
707
|
+
* assumes that path is viable for the chosen bank's holdings.
|
|
708
|
+
*/
|
|
709
|
+
declare function findBestYieldingBankForBurn(account: AccountClient, tokenData: LYCToken, position: TokenLendingPositionData, requiredDebtUiAmount: number): Promise<{
|
|
710
|
+
yieldingBank: Address;
|
|
711
|
+
}>;
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Get the specific lookup table for the given Token PDA (if it exists).
|
|
715
|
+
*
|
|
716
|
+
* `TOKEN_LOOKUP_TABLES` is keyed by Token PDA address.
|
|
717
|
+
*/
|
|
718
|
+
declare function getLookupTableForToken(tokenPda: Address): Address | undefined;
|
|
719
|
+
/**
|
|
720
|
+
* Assembles lookup table addresses for LYC transaction plans: the deployment
|
|
721
|
+
* general LUT (when not `local`), any registered per-token LUT for the given
|
|
722
|
+
* token PDAs, then any CPI/swap tables. Entries are omitted when missing or
|
|
723
|
+
* equal to the default (unused) public key; duplicates are removed in first-seen
|
|
724
|
+
* order.
|
|
725
|
+
*/
|
|
726
|
+
declare function mergeLycLookupTables(environment: Environment, tokenPda?: Address | readonly Address[], existingLookupTables?: readonly Address[]): Address[];
|
|
727
|
+
/**
|
|
728
|
+
* Refresh per-token lookup tables for every Token account owned by the program.
|
|
729
|
+
*
|
|
730
|
+
* @param client - Initialized client (provides RPC-backed account fetch and Kamino helpers).
|
|
731
|
+
*/
|
|
732
|
+
declare function updateTokenLutsIfNeeded(signer: TransactionSigner, rpc: Rpc<SolanaRpcApi>, client: LongYieldCarryClient): Promise<void>;
|
|
733
|
+
/**
|
|
734
|
+
* Extend the per-token lookup table with addresses needed for that token's
|
|
735
|
+
* instructions: mints, token/YB ATAs, registry debt-mint ATAs for the token PDA, lending protocol accounts, Kamino
|
|
736
|
+
* obligation ATAs when applicable. Lending reserve accounts live on the
|
|
737
|
+
* lending-platform LUT; price oracles for registry-listed debt/YBAs and risk
|
|
738
|
+
* assets live on the general LUT.
|
|
739
|
+
*
|
|
740
|
+
* Collateral mint is read from on-chain token state (it is not a PDA).
|
|
741
|
+
*
|
|
742
|
+
* @param client - Used for Kamino reserve metadata and reserve interaction ATAs.
|
|
743
|
+
* @param token - Fetched token model (`LYCToken`); avoids an extra fetch.
|
|
744
|
+
*/
|
|
745
|
+
declare function updateTokenLutIfNeeded(signer: TransactionSigner, rpc: Rpc<SolanaRpcApi>, client: LongYieldCarryClient, token: LYCToken): Promise<void>;
|
|
746
|
+
/**
|
|
747
|
+
* Extend the shared general lookup table: program IDs, well-known SPL programs,
|
|
748
|
+
* stablecoin and YBA mints (plus registry oracles), Standard + LST oracle accounts,
|
|
749
|
+
* Perena program id, every on-chain YieldingBank PDA, each bank’s ATAs for
|
|
750
|
+
* all registry debt mints (stablecoins) and yield-bearing assets, the canonical
|
|
751
|
+
* Jito tip accounts (referenced by every Jito-bundle tip ix), the ComputeBudget
|
|
752
|
+
* program (referenced by every CU-limit ix), and the deployment's manager.
|
|
753
|
+
*
|
|
754
|
+
* Risk asset (Standard + LST) mints are omitted here; they appear on each token LUT
|
|
755
|
+
* as collateral.
|
|
756
|
+
*
|
|
757
|
+
* Uses {@link GENERAL_LOOKUP_TABLES} for {@link LongYieldCarryClient.environment}
|
|
758
|
+
* (`test` | `prod` only) and only that tier’s program ID.
|
|
759
|
+
*
|
|
760
|
+
* @throws If `client.environment` is `local` — there is no pinned general LUT for local.
|
|
761
|
+
*/
|
|
762
|
+
declare function updateGeneralLutIfNeeded(signer: TransactionSigner, rpc: Rpc<SolanaRpcApi>, client: LongYieldCarryClient): Promise<Address>;
|
|
763
|
+
|
|
764
|
+
declare function toAnchorAllocationConfig(cfg: YieldingBankAllocationConfig): IdlTypes<LongYieldCarry>["yieldingBankAllocationConfig"];
|
|
765
|
+
/**
|
|
766
|
+
* Build the carry-trade account metas that are prepended to remaining_accounts
|
|
767
|
+
* for increase/decrease carry position instructions.
|
|
768
|
+
*
|
|
769
|
+
* The two ATA accounts are tagged with `isRequiredAta` so that
|
|
770
|
+
* `getCreateAtaInstructions` will create them if they don't yet exist.
|
|
771
|
+
*
|
|
772
|
+
* Order must match `parse_carry_trade_accounts` on the Rust side:
|
|
773
|
+
* 0. token (writable)
|
|
774
|
+
* 1. yieldingBank (writable)
|
|
775
|
+
* 2. tokenLpDebtTa (writable, ATA)
|
|
776
|
+
* 3. yieldingBankTa (writable, ATA)
|
|
777
|
+
* 4. lendingPositionUserAccount (readonly)
|
|
778
|
+
* 5. lendingPositionCollateralReserve (readonly)
|
|
779
|
+
* 6. debtOracle (readonly)
|
|
780
|
+
* 7. debtTokenProgram (readonly)
|
|
781
|
+
* 8. instructions_sysvar (readonly)
|
|
782
|
+
*/
|
|
783
|
+
declare function buildCarryTradeAccountMetas(token: Address, yieldingBank: Address, tokenLpDebtTa: Address, yieldingBankTa: Address, lendingPositionUserAccount: Address, lendingPositionCollateralReserve: Address, debtOracle: Address, debtMint: Address, debtTokenProgram: Address): CustomAccountMeta[];
|
|
784
|
+
/**
|
|
785
|
+
* Build the initial remaining-accounts prefix for `rebalance_token`.
|
|
786
|
+
*
|
|
787
|
+
* Order must match `RebalanceTokenAccounts::parse` on the Rust side:
|
|
788
|
+
* 0. token (writable)
|
|
789
|
+
* 1. yieldingBank (writable)
|
|
790
|
+
* 2. sourceDebtTokenProgram (readonly)
|
|
791
|
+
* 3. yieldingBankSourceDebtAta (writable, ATA)
|
|
792
|
+
* 4. sourceLpUserAccount (readonly)
|
|
793
|
+
* 5. sourceLpCollateralReserve (readonly)
|
|
794
|
+
* 6. sourceLpDebtOracle (readonly — also serves as the
|
|
795
|
+
* dust-sweep source_debt_oracle)
|
|
796
|
+
* 7. destinationLpUserAccount (readonly)
|
|
797
|
+
* 8. destinationLpCollateralReserve (readonly)
|
|
798
|
+
* 9. destinationLpDebtOracle (readonly)
|
|
799
|
+
*
|
|
800
|
+
* The destination debt mint is referenced by inner CPIs (borrow / swap) and
|
|
801
|
+
* reaches the pool through CPI dedup; it does not need a fixed slot here.
|
|
802
|
+
* The token PDA's source-debt ATA is part of the flash-borrow / repay path
|
|
803
|
+
* and is also resolved at runtime from the CPI account pool — only the
|
|
804
|
+
* yielding-bank's source-debt ATA needs an explicit slot for the dust sweep.
|
|
805
|
+
*/
|
|
806
|
+
declare function buildRebalanceTokenInitialAccounts(args: {
|
|
807
|
+
token: Address;
|
|
808
|
+
yieldingBank: Address;
|
|
809
|
+
sourceDebtMint: Address;
|
|
810
|
+
sourceDebtTokenProgram: Address;
|
|
811
|
+
yieldingBankSourceDebtAta: Address;
|
|
812
|
+
lpUserAccount: Address;
|
|
813
|
+
sourceDebtOracle: Address;
|
|
814
|
+
destinationDebtOracle: Address;
|
|
815
|
+
}): CustomAccountMeta[];
|
|
816
|
+
/**
|
|
817
|
+
* Normalize grouped CPI refs for `decrease_carry_position`.
|
|
818
|
+
*
|
|
819
|
+
* The plan can contain either:
|
|
820
|
+
* - one group: repay only, or
|
|
821
|
+
* - two groups: yielding-bank swap/redeem first, then repay.
|
|
822
|
+
*/
|
|
823
|
+
declare function resolveDecreaseCarryIxRefs(refsGroups: InstructionRefs[], options?: {
|
|
824
|
+
hasTokenPrerequisiteCpis?: boolean;
|
|
825
|
+
}): {
|
|
826
|
+
ybIxRefs?: InstructionRefs;
|
|
827
|
+
prerequisiteCpis?: InstructionRefs;
|
|
828
|
+
tokenIxRefs: InstructionRefs;
|
|
829
|
+
};
|
|
830
|
+
interface ResolvedDecreaseCarryCpiPlan {
|
|
831
|
+
accounts: CustomAccountMeta[];
|
|
832
|
+
lookupTables: Address[];
|
|
833
|
+
ybIxRefs?: InstructionRefs;
|
|
834
|
+
prerequisiteCpis?: InstructionRefs;
|
|
835
|
+
tokenIxRefs: InstructionRefs;
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Build the grouped CPI pool for `decrease_carry_position` and normalize the
|
|
839
|
+
* resulting ref groups into the instruction params the SDK passes on-chain.
|
|
840
|
+
*/
|
|
841
|
+
declare function resolveDecreaseCarryCpiPlan(plan: DecreaseCarryPositionPlan): ResolvedDecreaseCarryCpiPlan;
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* PodBool is a Rust `#[repr(transparent)]` newtype over `u8`.
|
|
845
|
+
* Anchor deserializes tuple-struct fields using positional integer keys, so
|
|
846
|
+
* `PodBool(1)` arrives from the RPC as `{ '0': 1 }` instead of a plain number.
|
|
847
|
+
*
|
|
848
|
+
* This helper extracts the underlying u8 value so callers work with a plain
|
|
849
|
+
* number rather than the intermediate struct object.
|
|
850
|
+
*/
|
|
851
|
+
declare function podBoolToNumber(val: {
|
|
852
|
+
0: number;
|
|
853
|
+
} | number): number;
|
|
854
|
+
/**
|
|
855
|
+
* Build external-liquidity source descriptors for one mint across multiple accounts.
|
|
856
|
+
*/
|
|
857
|
+
declare function toYieldingBankExternalLiquiditySources(mint: Address, accounts: Address[]): YieldingBankExternalLiquiditySource[];
|
|
858
|
+
/**
|
|
859
|
+
* Convert a raw token amount and raw oracle price into 8-decimal USD TVL units.
|
|
860
|
+
*/
|
|
861
|
+
declare function amountToTvl(amount: number | bigint | BN, price: number | bigint | BN, decimals: number): BN;
|
|
862
|
+
/**
|
|
863
|
+
* Generate a redemption epoch ID by flooring `Date.now()` to the nearest minute.
|
|
864
|
+
* Burns within the same 60-second window will share an epoch PDA, allowing the
|
|
865
|
+
* manager to batch-process them together.
|
|
866
|
+
*/
|
|
867
|
+
declare function currentEpochId(): BN;
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* First token ID (0–255) not yet used for the given yToken mint address.
|
|
871
|
+
*
|
|
872
|
+
* Tries `fetchAllTokens` first, then scans PDAs if RPC program accounts are unavailable.
|
|
873
|
+
*/
|
|
874
|
+
declare function findFreeTokenId(client: LongYieldCarryClient, mint: Address): Promise<number>;
|
|
875
|
+
/**
|
|
876
|
+
* First yielding-bank ID (0–255) not yet used for the given base mint.
|
|
877
|
+
*/
|
|
878
|
+
declare function findFreeYieldingBankId(client: LongYieldCarryClient, baseMint: Address): Promise<number>;
|
|
879
|
+
|
|
880
|
+
declare function getTokenCacheInvalidation(token: Address): TransactionCacheInvalidation;
|
|
881
|
+
declare function getYieldingBankCacheInvalidation(yieldingBank: Address): TransactionCacheInvalidation;
|
|
882
|
+
|
|
883
|
+
/**
|
|
884
|
+
* Compose ordered phases into one bundle-ready plan without making an entire
|
|
885
|
+
* phase indivisible. Existing atomic segments are preserved, and each phase
|
|
886
|
+
* after the first is forced to start in a new transaction.
|
|
887
|
+
*/
|
|
888
|
+
declare function composePhasedTransactionPlan(phases: LongYieldCarryTransactionPlan[]): LongYieldCarryTransactionPlan;
|
|
889
|
+
declare function setTokenCircuitBreaker(client: LongYieldCarryClient, signer: KeyPairSigner, token: Address, active: boolean): Promise<Signature>;
|
|
890
|
+
declare function setYieldingBankCircuitBreaker(client: LongYieldCarryClient, signer: KeyPairSigner, yieldingBank: Address, active: boolean): Promise<Signature>;
|
|
891
|
+
/**
|
|
892
|
+
* Creates a new yToken SPL mint with mint authority = token PDA, using the next free token ID.
|
|
893
|
+
*/
|
|
894
|
+
declare function createYTokenMint(client: LongYieldCarryClient, payer: KeyPairSigner, decimals?: number, tokenProgram?: Address): Promise<{
|
|
895
|
+
mintSigner: KeyPairSigner;
|
|
896
|
+
tokenPda: Address;
|
|
897
|
+
tokenPdaBump: number;
|
|
898
|
+
id: number;
|
|
899
|
+
}>;
|
|
900
|
+
|
|
901
|
+
interface BuildLendingPositionAllocationArgs {
|
|
902
|
+
/** Lending platform client used to resolve reserves and user accounts. */
|
|
903
|
+
lendingClient: LendingPlatformClientBase<LendingPlatformData>;
|
|
904
|
+
/** Token PDA that will own the lending position. */
|
|
905
|
+
tokenPda: Address;
|
|
906
|
+
/** Collateral mint address. Used to resolve the collateral reserve in the pool. */
|
|
907
|
+
collateralMint: Address;
|
|
908
|
+
/** Debt mint address. Decimals and token program are resolved from the mint registry. */
|
|
909
|
+
debtMint: Address;
|
|
910
|
+
/** Debt reserve address. If omitted, looked up from the pool by `debtMint`. */
|
|
911
|
+
debtReserve?: Address;
|
|
912
|
+
/** Obligation / user-account ID within the lending pool. */
|
|
913
|
+
userAccountId: number;
|
|
914
|
+
/**
|
|
915
|
+
* Lending pool address. When omitted, resolved automatically from the
|
|
916
|
+
* collateral mint via {@link getEligiblePools}. Throws if the mint is
|
|
917
|
+
* listed in zero or multiple pools (caller must disambiguate).
|
|
918
|
+
*/
|
|
919
|
+
pool?: Address;
|
|
920
|
+
/** @default LendingPlatform.Kamino */
|
|
921
|
+
lendingPlatform?: LendingPlatform;
|
|
922
|
+
/** @default 9000 */
|
|
923
|
+
targetUtilizationRateBps?: number;
|
|
924
|
+
/** @default 150 */
|
|
925
|
+
maxDeviationAboveTargetUtilBps?: number;
|
|
926
|
+
/** @default 300 */
|
|
927
|
+
maxDeviationBelowTargetUtilBps?: number;
|
|
928
|
+
}
|
|
929
|
+
interface LendingPositionAllocation {
|
|
930
|
+
params: CreateTokenLendingPositionParams;
|
|
931
|
+
accounts: CreateTokenLendingPositionAccounts;
|
|
932
|
+
pool: Address;
|
|
933
|
+
collateralReserve: Address;
|
|
934
|
+
debtReserve: Address;
|
|
935
|
+
protocolUserAccount: Address;
|
|
936
|
+
userAccountId: number;
|
|
937
|
+
}
|
|
938
|
+
interface GetAvailableTokenLendingUserAccountIdArgs {
|
|
939
|
+
lendingClient: LendingPlatformClientBase<LendingPlatformData>;
|
|
940
|
+
token: LYCToken;
|
|
941
|
+
pool: Address;
|
|
942
|
+
lendingPlatform?: LendingPlatform;
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Resolves the lending pool for a collateral mint when the caller didn't
|
|
946
|
+
* supply one explicitly. Uses the static `KAMINO_ACCOUNTS` registry to
|
|
947
|
+
* find which pool(s) list the mint.
|
|
948
|
+
*
|
|
949
|
+
* - Exactly one pool → returns it.
|
|
950
|
+
* - Zero pools → throws (mint not listed anywhere).
|
|
951
|
+
* - Multiple pools → throws (caller must pass `pool` to disambiguate).
|
|
952
|
+
*/
|
|
953
|
+
declare function resolveDefaultPool(collateralMint: Address): Address;
|
|
954
|
+
declare function getAvailableTokenLendingUserAccountId({ lendingClient, token, pool, lendingPlatform, }: GetAvailableTokenLendingUserAccountIdArgs): Promise<number>;
|
|
955
|
+
/**
|
|
956
|
+
* Resolves reserves, oracle data, and user-account PDA, then assembles a
|
|
957
|
+
* `CreateTokenLendingPositionParams` ready for `ix.createTokenLendingPosition`.
|
|
958
|
+
*
|
|
959
|
+
* The collateral reserve is resolved from the collateral mint against the pool.
|
|
960
|
+
* Debt metadata (decimals, token program) is resolved from the mint registry;
|
|
961
|
+
* the debt reserve address is either provided directly or looked up by mint.
|
|
962
|
+
*/
|
|
963
|
+
declare function buildLendingPositionAllocation(args: BuildLendingPositionAllocationArgs): Promise<LendingPositionAllocation>;
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* Returns the first active yielding bank (circuit breaker off, lowest id).
|
|
967
|
+
*
|
|
968
|
+
* TODO: This naively returns the first active bank regardless of what the
|
|
969
|
+
* lending position actually borrows. It works today because there is one
|
|
970
|
+
* yielding bank (USDC) and all debt is denominated in USDC. When a second
|
|
971
|
+
* yielding bank exists (e.g. SOL-denominated) or a lending position borrows
|
|
972
|
+
* a non-USDC asset, the carry-manager would route that debt into the wrong
|
|
973
|
+
* bank. At that point this function needs to accept the lending position's
|
|
974
|
+
* debt mint and match it to the correct bank — either via the token's
|
|
975
|
+
* existing `debtCarry` entries or an explicit per-token bank configuration.
|
|
976
|
+
*
|
|
977
|
+
* @returns The yielding bank address, or `null` if no active bank exists.
|
|
978
|
+
*/
|
|
979
|
+
declare function resolveYieldingBankForPosition(allBanks: LYCYieldingBank[]): Address | null;
|
|
980
|
+
/**
|
|
981
|
+
* Returns the index of the first active lending position for the given
|
|
982
|
+
* platform, or `null` if the token has no positions on that platform.
|
|
983
|
+
*/
|
|
984
|
+
declare function firstActiveLendingIndex(token: LYCToken, platform: LendingPlatform): number | null;
|
|
985
|
+
|
|
986
|
+
type TimelockKind = "touch" | "cleanup";
|
|
987
|
+
interface TimelockStatus {
|
|
988
|
+
enabled: boolean;
|
|
989
|
+
isTimelocked: boolean;
|
|
990
|
+
timeCreated: bigint;
|
|
991
|
+
unlockAt?: bigint;
|
|
992
|
+
remainingSecs: bigint;
|
|
993
|
+
}
|
|
994
|
+
interface TimelockOptions {
|
|
995
|
+
enableLocalTimelocks?: boolean;
|
|
996
|
+
}
|
|
997
|
+
declare function timelocksEnabled(environment: Environment, options?: TimelockOptions): boolean;
|
|
998
|
+
declare function getTimelockStatus(environment: Environment, timeCreated: bigint | number | BN, kind: TimelockKind, options?: TimelockOptions): TimelockStatus;
|
|
999
|
+
type AllocationTimelockKind = TimelockKind;
|
|
1000
|
+
type AllocationTimelockStatus = TimelockStatus;
|
|
1001
|
+
declare const allocationTimelocksEnabled: typeof timelocksEnabled;
|
|
1002
|
+
declare const getAllocationTimelockStatus: typeof getTimelockStatus;
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* Collectable net yield in 8-decimal normalized USD: any carry surplus above
|
|
1006
|
+
* debt. Returns `0n` when carry TVL does not exceed debt TVL.
|
|
1007
|
+
*
|
|
1008
|
+
* Used by SDK planning and metrics to size collect-interest attempts.
|
|
1009
|
+
*
|
|
1010
|
+
* @param totalCarryTvlUsd Aggregate carry-position TVL (8-dec USD).
|
|
1011
|
+
* @param totalDebtUsd Aggregate lending-position debt TVL (8-dec USD).
|
|
1012
|
+
*/
|
|
1013
|
+
declare function collectableNetYieldUsd(totalCarryTvlUsd: bigint, totalDebtUsd: bigint): bigint;
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* Options for {@link DecreaseCarryPositionBuilder.buildTx}. Supports pre-merged CPI accounts
|
|
1017
|
+
* and custom heap size.
|
|
1018
|
+
*/
|
|
1019
|
+
type DecreaseCarryPositionBuildTxOptions = {
|
|
1020
|
+
includePreInstructions: boolean;
|
|
1021
|
+
/** Defaults to {@link MAX_HEAP_FRAME_BYTES}. */
|
|
1022
|
+
heapFrameBytes?: number;
|
|
1023
|
+
/**
|
|
1024
|
+
* When set, skips internal {@link resolveDecreaseCarryCpiPlan}(plan). Use when remaining
|
|
1025
|
+
* accounts already include additional CPI account slots (e.g. lending withdraw merged for burn).
|
|
1026
|
+
*/
|
|
1027
|
+
resolvedCpiPlan?: ResolvedDecreaseCarryCpiPlan;
|
|
1028
|
+
/** When set, the DCP loss is attributed to this epoch instead of socialised into the price. */
|
|
1029
|
+
redemptionEpoch?: Address;
|
|
1030
|
+
};
|
|
1031
|
+
declare class DecreaseCarryPositionBuilder extends LongYieldCarryBuilderBase<DecreaseCarryPositionIxArgs, DecreaseCarryPositionTxArgs> {
|
|
1032
|
+
constructor(context: LongYieldCarryBuilderContext);
|
|
1033
|
+
getIx(args: DecreaseCarryPositionIxArgs): Promise<Instruction>;
|
|
1034
|
+
getTx(args: DecreaseCarryPositionTxArgs): Promise<LongYieldCarryTransactionPlan>;
|
|
1035
|
+
buildTx(signer: Address, token: Address, params: DecreaseCarryPositionTxParams, options: DecreaseCarryPositionBuildTxOptions): Promise<LongYieldCarryTransactionPlan>;
|
|
1036
|
+
buildPlan(signer: Address, token: Address, params: DecreaseCarryPositionTxBuilderParams): Promise<DecreaseCarryPositionPlan>;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
declare class DepositUnlentCollateralBuilder extends LongYieldCarryBuilderBase<DepositUnlentCollateralIxArgs, DepositUnlentCollateralTxArgs> {
|
|
1040
|
+
getIx(args: DepositUnlentCollateralIxArgs): Promise<Instruction>;
|
|
1041
|
+
getTx(args: DepositUnlentCollateralTxArgs): Promise<LongYieldCarryTransactionPlan>;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
declare class IncreaseCarryPositionBuilder extends LongYieldCarryBuilderBase<IncreaseCarryPositionIxArgs, IncreaseCarryPositionTxArgs> {
|
|
1045
|
+
getIx(args: IncreaseCarryPositionIxArgs): Promise<Instruction>;
|
|
1046
|
+
getTx(args: IncreaseCarryPositionTxArgs): Promise<LongYieldCarryTransactionPlan>;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
declare class RebalanceTokenBuilder extends LongYieldCarryBuilderBase<RebalanceTokenIxArgs, RebalanceTokenTxArgs> {
|
|
1050
|
+
getIx(args: RebalanceTokenIxArgs): Promise<Instruction>;
|
|
1051
|
+
getTx(args: RebalanceTokenTxArgs): Promise<LongYieldCarryTransactionPlan>;
|
|
1052
|
+
private maxPostRebalanceUtilizationBps;
|
|
1053
|
+
private buildFlashRebalanceOrSkip;
|
|
1054
|
+
private collectFlashCpiGroups;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
declare class RebalanceYieldingBankBuilder extends LongYieldCarryBuilderBase<RebalanceYieldingBankIxArgs, RebalanceYieldingBankTxArgs> {
|
|
1058
|
+
getIx(args: RebalanceYieldingBankIxArgs): Promise<Instruction>;
|
|
1059
|
+
getTx(args: RebalanceYieldingBankTxArgs): Promise<LongYieldCarryTransactionPlan>;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
declare class RecollateralizeLossBuilder extends LongYieldCarryBuilderBase<RecollateralizeLossIxArgs, RecollateralizeLossTxArgs, LongYieldCarryTransactionPlan[]> {
|
|
1063
|
+
getIx(args: RecollateralizeLossIxArgs): Promise<Instruction>;
|
|
1064
|
+
/**
|
|
1065
|
+
* The active lending position holding the most collateral, or `undefined`
|
|
1066
|
+
* when the token has no active positions. Used only to supply a well-formed
|
|
1067
|
+
* reference account layout when `getIx` is called with an invalid index.
|
|
1068
|
+
*/
|
|
1069
|
+
private largestActiveLendingPosition;
|
|
1070
|
+
getTx(args: RecollateralizeLossTxArgs): Promise<LongYieldCarryTransactionPlan[]>;
|
|
1071
|
+
private selectRecollateralizationTarget;
|
|
1072
|
+
private buildRecollateralizationSwapPlan;
|
|
1073
|
+
private buildOptionalDecreaseCarryPhase;
|
|
1074
|
+
private buildRecollateralizePhase;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
declare class RefreshTokenStateBuilder extends LongYieldCarrySingleInstructionBuilderService<RefreshTokenStateIxArgs> {
|
|
1078
|
+
getIx(args: RefreshTokenStateIxArgs): Promise<Instruction>;
|
|
1079
|
+
getTx(args: RefreshTokenStateIxArgs): Promise<LongYieldCarryTransactionPlan>;
|
|
1080
|
+
private getRefreshTokenStateParams;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
declare class RefreshTokensBuilder {
|
|
1084
|
+
private readonly context;
|
|
1085
|
+
constructor(context: LongYieldCarryBuilderContext);
|
|
1086
|
+
getTx(args: RefreshTokensBuilderTxArgs): Promise<LongYieldCarryTransactionPlan>;
|
|
1087
|
+
private getYieldingBanksToRefresh;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
declare class RefreshYieldingBankBuilder extends LongYieldCarryBuilderBase<RefreshYieldingBankIxArgs, RefreshYieldingBankTxArgs> {
|
|
1091
|
+
getIx(args: RefreshYieldingBankIxArgs): Promise<Instruction>;
|
|
1092
|
+
getTx(args: RefreshYieldingBankTxArgs): Promise<LongYieldCarryTransactionPlan>;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
declare class ResetTokenBurnRateLimitBuilder extends LongYieldCarrySingleInstructionBuilderService<ResetTokenBurnRateLimitIxArgs> {
|
|
1096
|
+
getIx(args: ResetTokenBurnRateLimitIxArgs): Promise<Instruction>;
|
|
1097
|
+
protected buildLookupTables(args: ResetTokenBurnRateLimitIxArgs): Promise<readonly Address[]>;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
declare class SetTokenCircuitBreakerBuilder extends LongYieldCarrySingleInstructionBuilderService<SetTokenCircuitBreakerIxArgs, SetTokenCircuitBreakerTxArgs> {
|
|
1101
|
+
protected deriveIxArgs(txArgs: SetTokenCircuitBreakerTxArgs): Promise<SetTokenCircuitBreakerIxArgs>;
|
|
1102
|
+
getIx(args: SetTokenCircuitBreakerIxArgs): Promise<Instruction>;
|
|
1103
|
+
protected buildLookupTables(args: SetTokenCircuitBreakerIxArgs): Promise<readonly Address[]>;
|
|
1104
|
+
protected buildPlanExtras(args: SetTokenCircuitBreakerIxArgs): Promise<{
|
|
1105
|
+
postSuccessCacheInvalidations: TransactionCacheInvalidation[];
|
|
1106
|
+
}>;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
declare class SetYieldingBankCircuitBreakerBuilder extends LongYieldCarrySingleInstructionBuilderService<SetYieldingBankCircuitBreakerIxArgs, SetYieldingBankCircuitBreakerTxArgs> {
|
|
1110
|
+
protected deriveIxArgs(txArgs: SetYieldingBankCircuitBreakerTxArgs): Promise<SetYieldingBankCircuitBreakerIxArgs>;
|
|
1111
|
+
getIx(args: SetYieldingBankCircuitBreakerIxArgs): Promise<Instruction>;
|
|
1112
|
+
protected buildLookupTables(): Promise<readonly Address[]>;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
declare class UpdateLendingPositionConfigBuilder extends LongYieldCarrySingleInstructionBuilderService<UpdateLendingPositionConfigIxArgs> {
|
|
1116
|
+
getIx(args: UpdateLendingPositionConfigIxArgs): Promise<Instruction>;
|
|
1117
|
+
protected buildLookupTables(args: UpdateLendingPositionConfigIxArgs): Promise<readonly Address[]>;
|
|
1118
|
+
protected buildPlanExtras(args: UpdateLendingPositionConfigIxArgs): Promise<{
|
|
1119
|
+
postSuccessCacheInvalidations: TransactionCacheInvalidation[];
|
|
1120
|
+
}>;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
declare class UpdateTokenConfigurationBuilder extends LongYieldCarrySingleInstructionBuilderService<UpdateTokenConfigurationIxArgs> {
|
|
1124
|
+
/**
|
|
1125
|
+
* Builds an update signed by the token admin by default. Callers may pass the
|
|
1126
|
+
* token manager (`feeDripMaxApyBps` only) or curator (curator fee wallet)
|
|
1127
|
+
* through the compatibility-named `admin` argument.
|
|
1128
|
+
*
|
|
1129
|
+
* Omitted fee/config fields are sent as `null` (on-chain `None` = no change).
|
|
1130
|
+
*/
|
|
1131
|
+
getIx(args: UpdateTokenConfigurationIxArgs): Promise<Instruction>;
|
|
1132
|
+
protected buildLookupTables(args: UpdateTokenConfigurationIxArgs): Promise<readonly Address[]>;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
declare class UpdateTokenMetadataBuilder extends LongYieldCarrySingleInstructionBuilderService<UpdateTokenMetadataIxArgs> {
|
|
1136
|
+
getIx(args: UpdateTokenMetadataIxArgs): Promise<Instruction>;
|
|
1137
|
+
protected buildLookupTables(args: UpdateTokenMetadataIxArgs): Promise<readonly Address[]>;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
declare class UpdateYieldingBankConfigBuilder extends LongYieldCarrySingleInstructionBuilderService<UpdateYieldingBankConfigIxArgs> {
|
|
1141
|
+
getIx(args: UpdateYieldingBankConfigIxArgs): Promise<Instruction>;
|
|
1142
|
+
protected buildLookupTables(): Promise<readonly Address[]>;
|
|
1143
|
+
protected buildPlanExtras(args: UpdateYieldingBankConfigIxArgs): Promise<{
|
|
1144
|
+
postSuccessCacheInvalidations: TransactionCacheInvalidation[];
|
|
1145
|
+
}>;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
declare class TransactionClient {
|
|
1149
|
+
readonly context: LongYieldCarryBuilderContext;
|
|
1150
|
+
readonly burnToken: BurnTokenBuilder;
|
|
1151
|
+
readonly claimIncentives: ClaimIncentivesBuilder;
|
|
1152
|
+
readonly collectFees: CollectFeesBuilder;
|
|
1153
|
+
readonly collectInterest: CollectInterestBuilder;
|
|
1154
|
+
readonly creditUnlentToRedemptionEpoch: CreditUnlentToRedemptionEpochBuilder;
|
|
1155
|
+
readonly createCpiPlan: CreateCpiPlanBuilder;
|
|
1156
|
+
readonly createToken: CreateTokenBuilder;
|
|
1157
|
+
readonly createTokenLendingPosition: CreateTokenLendingPositionBuilder;
|
|
1158
|
+
readonly createYieldingBank: CreateYieldingBankBuilder;
|
|
1159
|
+
readonly createYieldingBankAllocation: CreateYieldingBankAllocationBuilder;
|
|
1160
|
+
readonly decreaseCarryPosition: DecreaseCarryPositionBuilder;
|
|
1161
|
+
readonly depositUnlentCollateral: DepositUnlentCollateralBuilder;
|
|
1162
|
+
readonly increaseCarryPosition: IncreaseCarryPositionBuilder;
|
|
1163
|
+
readonly mintToken: MintTokenBuilder;
|
|
1164
|
+
readonly rebalanceToken: RebalanceTokenBuilder;
|
|
1165
|
+
readonly rebalanceYieldingBank: RebalanceYieldingBankBuilder;
|
|
1166
|
+
readonly recollateralizeLoss: RecollateralizeLossBuilder;
|
|
1167
|
+
readonly refreshTokenState: RefreshTokenStateBuilder;
|
|
1168
|
+
readonly refreshTokens: RefreshTokensBuilder;
|
|
1169
|
+
readonly refreshYieldingBank: RefreshYieldingBankBuilder;
|
|
1170
|
+
readonly processAsyncBurn: ProcessAsyncBurnBuilder;
|
|
1171
|
+
readonly resetTokenBurnRateLimit: ResetTokenBurnRateLimitBuilder;
|
|
1172
|
+
readonly setRedemptionEpochStatus: SetRedemptionEpochStatusBuilder;
|
|
1173
|
+
readonly setTokenCircuitBreaker: SetTokenCircuitBreakerBuilder;
|
|
1174
|
+
readonly setYieldingBankCircuitBreaker: SetYieldingBankCircuitBreakerBuilder;
|
|
1175
|
+
readonly updateLendingPositionConfig: UpdateLendingPositionConfigBuilder;
|
|
1176
|
+
readonly updateTokenConfiguration: UpdateTokenConfigurationBuilder;
|
|
1177
|
+
readonly updateTokenMetadata: UpdateTokenMetadataBuilder;
|
|
1178
|
+
readonly updateYieldingBankConfig: UpdateYieldingBankConfigBuilder;
|
|
1179
|
+
readonly topUpUnlentReserves: TopUpUnlentReservesBuilder;
|
|
1180
|
+
constructor(context: LongYieldCarryBuilderContext);
|
|
1181
|
+
}
|
|
1182
|
+
type TransactionBuilder = TransactionClient[keyof TransactionClient];
|
|
1183
|
+
type CompositeTransactionPlan = TransactionPlan | LongYieldCarryTransactionPlan;
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* Long Yield Carry program client.
|
|
1187
|
+
*
|
|
1188
|
+
* Composes PDA derivation, account fetching, instruction building, and
|
|
1189
|
+
* transaction composition behind a single entry point.
|
|
1190
|
+
*
|
|
1191
|
+
* The Anchor program ID flows through to all sub-clients — no global state
|
|
1192
|
+
* required.
|
|
1193
|
+
*
|
|
1194
|
+
* Usage:
|
|
1195
|
+
* const client = new LongYieldCarryClient(provider, "local");
|
|
1196
|
+
* const [pda, bump] = client.pda.token(mintAddress);
|
|
1197
|
+
* const ix = await client.tx.createToken.getIx({
|
|
1198
|
+
* mint,
|
|
1199
|
+
* collateralMint,
|
|
1200
|
+
* params,
|
|
1201
|
+
* });
|
|
1202
|
+
* const data = await client.account.token(pda);
|
|
1203
|
+
* const tx = await client.tx.collectInterest.getTx({ manager: manager, token: token, params: { yieldingBank } });
|
|
1204
|
+
*/
|
|
1205
|
+
|
|
1206
|
+
interface LongYieldCarryClientOptions {
|
|
1207
|
+
/**
|
|
1208
|
+
* Swap client override. Replaces the default `AggSwapClient` for all swaps
|
|
1209
|
+
* (including collect_interest). Useful in tests that need a restricted routing
|
|
1210
|
+
* client (e.g. Surfpool direct-route-only client).
|
|
1211
|
+
*/
|
|
1212
|
+
swapClient?: SwapClient;
|
|
1213
|
+
/**
|
|
1214
|
+
* Optional overrides for internally managed lending platform clients.
|
|
1215
|
+
* These are primarily useful in tests.
|
|
1216
|
+
*/
|
|
1217
|
+
lendingPlatformClients?: Partial<SupportedLendingPlatformClients>;
|
|
1218
|
+
}
|
|
1219
|
+
/** Claimable incentives keyed by the token's lending position index. */
|
|
1220
|
+
type OutstandingIncentivesByPosition = Map<number, OutstandingIncentive[]>;
|
|
1221
|
+
declare class LongYieldCarryClient {
|
|
1222
|
+
/**
|
|
1223
|
+
* Deployment tier for this client (`local`, `test`, `prod`) — drives program ID,
|
|
1224
|
+
* RPC URL, and authority constants passed into transaction builders.
|
|
1225
|
+
*/
|
|
1226
|
+
readonly environment: Environment;
|
|
1227
|
+
/** Shared RPC client used by SDK send helpers */
|
|
1228
|
+
readonly rpc: Rpc<SolanaRpcApi>;
|
|
1229
|
+
/** PDA derivation utilities */
|
|
1230
|
+
readonly pda: PdaClient;
|
|
1231
|
+
/** On-chain account fetchers */
|
|
1232
|
+
readonly account: AccountClient;
|
|
1233
|
+
/** Transaction/instruction builders */
|
|
1234
|
+
readonly tx: TransactionClient;
|
|
1235
|
+
/** Aggregated swap client (Perena for USD* pairs, Jupiter fallback) */
|
|
1236
|
+
readonly swap: SwapClient;
|
|
1237
|
+
/** Shared registry of protocol-specific lending clients */
|
|
1238
|
+
readonly lendingPlatformClients: LendingPlatformClientRegistry;
|
|
1239
|
+
/**
|
|
1240
|
+
* @param provider - Anchor provider (connection + wallet)
|
|
1241
|
+
* @param environment - Optional environment override ("local", "test", "prod").
|
|
1242
|
+
* Determines which program ID and RPC URL to use. Defaults to the IDL address.
|
|
1243
|
+
* @param options - Optional configuration overrides (e.g. custom swap client for tests).
|
|
1244
|
+
*/
|
|
1245
|
+
/**
|
|
1246
|
+
* Create a read-only client with a throwaway keypair.
|
|
1247
|
+
*
|
|
1248
|
+
* Use this for services that only need to read on-chain state (e.g. the
|
|
1249
|
+
* price ingestion Lambda) and never sign transactions.
|
|
1250
|
+
*/
|
|
1251
|
+
static readOnly(env: Environment): LongYieldCarryClient;
|
|
1252
|
+
constructor(provider: AnchorProvider, environment?: Environment, options?: LongYieldCarryClientOptions);
|
|
1253
|
+
/**
|
|
1254
|
+
* Sign, send, and confirm a transaction, then apply any post-success cache
|
|
1255
|
+
* invalidations embedded in the transaction plan.
|
|
1256
|
+
*/
|
|
1257
|
+
sendTransaction(payer: TransactionSigner, instructionsOrPlan: Instruction[] | TransactionPlan, options?: SendTransactionOptionsWithPostSuccess): Promise<Signature>;
|
|
1258
|
+
/**
|
|
1259
|
+
* Returns currently claimable lending incentives keyed by lending position
|
|
1260
|
+
* index. Each value contains that position's claimable incentive entries as
|
|
1261
|
+
* reported by the underlying lending-platform client.
|
|
1262
|
+
*
|
|
1263
|
+
* `minUiAmount` filters out dust rewards (UI-denominated, per reward token);
|
|
1264
|
+
* defaults to {@link DEFAULT_MIN_INCENTIVE_UI_AMOUNT} so harvesting never pays
|
|
1265
|
+
* a transaction fee for an economically negligible balance.
|
|
1266
|
+
*/
|
|
1267
|
+
getOutstandingIncentives(token: LYCToken, minUiAmount?: number, log?: (msg: string) => void): Promise<OutstandingIncentivesByPosition>;
|
|
1268
|
+
/**
|
|
1269
|
+
* Drops every cached entry across all sub-clients (account data, Kamino
|
|
1270
|
+
* lending data, swap quotes). The next read through any sub-client will
|
|
1271
|
+
* hit the RPC / API fresh.
|
|
1272
|
+
*
|
|
1273
|
+
* Use this between sequential phases that mutate on-chain state so that
|
|
1274
|
+
* the later phase doesn't operate on stale snapshots.
|
|
1275
|
+
*/
|
|
1276
|
+
clearAllCache(): void;
|
|
1277
|
+
/**
|
|
1278
|
+
* Clears cached data that a confirmed transaction has made stale.
|
|
1279
|
+
*
|
|
1280
|
+
* Call this after a transaction built from a `LongYieldCarryTransactionPlan`
|
|
1281
|
+
* has been confirmed by an external sender (e.g. the backend
|
|
1282
|
+
* `TransactionService`). The built-in `sendTransaction` applies these
|
|
1283
|
+
* automatically; this method exists for callers that sign/send through a
|
|
1284
|
+
* different path.
|
|
1285
|
+
*/
|
|
1286
|
+
applyCacheInvalidations(plan: LongYieldCarryTransactionPlan): void;
|
|
1287
|
+
getLendingPlatformClient(position: TokenLendingPositionData): LendingPlatformClientBase<LendingPlatformData>;
|
|
1288
|
+
getLendingPlatformClientByPlatform(platform: LendingPlatform.Kamino): KaminoClient;
|
|
1289
|
+
getLendingPlatformClientByPlatform(platform: LendingPlatform): LendingPlatformClientBase<LendingPlatformData>;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
/**
|
|
1293
|
+
* Ensures the planner produced at least one positive redemption leg. Without this,
|
|
1294
|
+
* routing would fail or build an empty CPI list even though share math passed.
|
|
1295
|
+
*/
|
|
1296
|
+
declare function assertCollectInterestPlanHasPositiveRedemptions(plan: CollectInterestPlan): void;
|
|
1297
|
+
/**
|
|
1298
|
+
* Derive deterministic collect-interest values from fresh token and bank state.
|
|
1299
|
+
* This intentionally excludes route / venue selection.
|
|
1300
|
+
*
|
|
1301
|
+
* @param account - Account client used to fetch fresh token and yielding-bank state.
|
|
1302
|
+
* @param token - Token PDA whose carry position should collect accrued interest.
|
|
1303
|
+
* @param params - Yielding bank to redeem from.
|
|
1304
|
+
* @returns Deterministic collect-interest plan without swap routing attached.
|
|
1305
|
+
*
|
|
1306
|
+
* @throws {NoInterestToCollectError} When carry/debt math rules out collection.
|
|
1307
|
+
*
|
|
1308
|
+
* Before swap routing, run `assertCollectInterestPlanHasPositiveRedemptions` on the
|
|
1309
|
+
* returned plan (the `getCollectInterestTx` transaction builder does this) so rounding
|
|
1310
|
+
* cannot yield an empty redemption list.
|
|
1311
|
+
*/
|
|
1312
|
+
declare function buildCollectInterestPlan(account: AccountClient, token: Address, params: CollectInterestPlanParams): Promise<CollectInterestPlan>;
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* Build the execution plan for `decrease_carry_position`.
|
|
1316
|
+
*
|
|
1317
|
+
* LYC-specific concerns (permissionless operation handling, steering-based target
|
|
1318
|
+
* resolution) live here. Sizing, repay CPI construction, and swap assembly are
|
|
1319
|
+
* delegated to the generic {@link LeverageService} from `lending-platforms`.
|
|
1320
|
+
*/
|
|
1321
|
+
declare function buildDecreaseCarryPositionPlan(account: AccountClient, swap: SwapClient, signer: Address, token: Address, params: DecreaseCarryPositionBuilderParams): Promise<DecreaseCarryPositionPlan>;
|
|
1322
|
+
|
|
1323
|
+
/** LYC program error when on-chain utilization guards block a carry update. */
|
|
1324
|
+
declare const INVALID_UTILIZATION_RATE_CONDITION_CODE = 8020;
|
|
1325
|
+
/**
|
|
1326
|
+
* Thrown when a tx builder receives inputs that make the operation a no-op
|
|
1327
|
+
* (e.g. zero borrow amount, no yield to collect). Callers can catch this
|
|
1328
|
+
* to distinguish "nothing to do" from genuine failures.
|
|
1329
|
+
*/
|
|
1330
|
+
declare class NoOpTransactionError extends Error {
|
|
1331
|
+
constructor(message: string);
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Thrown when `collect_interest` has nothing meaningful to redeem or swap
|
|
1335
|
+
* (no net carry yield, no matching carry slot, redeem rounds to zero, etc.).
|
|
1336
|
+
*
|
|
1337
|
+
* Extends {@link NoOpTransactionError} so batch jobs that skip no-ops via
|
|
1338
|
+
* `instanceof NoOpTransactionError` continue to treat this as a skip.
|
|
1339
|
+
*/
|
|
1340
|
+
declare class NoInterestToCollectError extends NoOpTransactionError {
|
|
1341
|
+
constructor(message: string);
|
|
1342
|
+
}
|
|
1343
|
+
/**
|
|
1344
|
+
* Thrown when an initial lending position cannot be created because of a
|
|
1345
|
+
* permanent configuration gap rather than a transient failure — e.g. the
|
|
1346
|
+
* collateral mint is not listed in any lending pool, has no carry preset, or
|
|
1347
|
+
* has no viable debt mint / reserve.
|
|
1348
|
+
*
|
|
1349
|
+
* Callers running on a tight schedule (e.g. the unlent-buffer worker) should
|
|
1350
|
+
* catch this to **skip** the token instead of failing the task, which would
|
|
1351
|
+
* otherwise retry every cycle and churn the DLQ until the config is fixed.
|
|
1352
|
+
*/
|
|
1353
|
+
declare class LendingPositionBootstrapError extends Error {
|
|
1354
|
+
constructor(message: string);
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* Looks up an Anchor custom error code against the LYC program IDL.
|
|
1358
|
+
* Returns the error name and message if found, or `undefined` for codes
|
|
1359
|
+
* belonging to other programs (e.g. Kamino, SPL Token).
|
|
1360
|
+
*/
|
|
1361
|
+
declare function lookupLycError(code: number): {
|
|
1362
|
+
name: string;
|
|
1363
|
+
msg: string;
|
|
1364
|
+
} | undefined;
|
|
1365
|
+
/**
|
|
1366
|
+
* Parses a logged Anchor error from a simulation failure message or program log line.
|
|
1367
|
+
*/
|
|
1368
|
+
declare function parseLoggedLycAnchorError(text: string): {
|
|
1369
|
+
name: string;
|
|
1370
|
+
code: number;
|
|
1371
|
+
msg: string;
|
|
1372
|
+
} | undefined;
|
|
1373
|
+
/**
|
|
1374
|
+
* Extracts an LYC program error code from a failed transaction, when present.
|
|
1375
|
+
*/
|
|
1376
|
+
declare function extractLycErrorCode(err: unknown): number | undefined;
|
|
1377
|
+
/** True when a failed tx was rejected by an expected LYC guard (not an incident). */
|
|
1378
|
+
declare function isSkippableLycTransactionError(err: unknown): boolean;
|
|
1379
|
+
/**
|
|
1380
|
+
* Attempts to parse a Solana `InstructionError` from a transaction simulation
|
|
1381
|
+
* failure message and returns a human-readable string.
|
|
1382
|
+
*
|
|
1383
|
+
* Handles formats like:
|
|
1384
|
+
* - `Transaction simulation failed: {"InstructionError":["0",{"Custom":"6121"}]}`
|
|
1385
|
+
* - `Transaction simulation failed: {"InstructionError":["1","ProgramFailedToComplete"]}`
|
|
1386
|
+
*
|
|
1387
|
+
* If the error contains a `Custom` code in the LYC IDL range, it's decoded to
|
|
1388
|
+
* the program error name and message. Otherwise, the raw code or variant is
|
|
1389
|
+
* included with a note that it may be from a CPI target program.
|
|
1390
|
+
*/
|
|
1391
|
+
declare function formatTransactionError(errMessage: string): string;
|
|
1392
|
+
|
|
1393
|
+
declare const usdStarAllocationConfig: YieldingBankAllocationConfig;
|
|
1394
|
+
declare const usdStarJuniorAllocationConfig: YieldingBankAllocationConfig;
|
|
1395
|
+
|
|
1396
|
+
/** Maximum value for `targetUtilizationRateBps` (100% in basis points). */
|
|
1397
|
+
declare const MAX_TARGET_UTILIZATION_RATE_BPS = 10000;
|
|
1398
|
+
/**
|
|
1399
|
+
* Maximum allowed value of `targetUtilizationRateBps + maxDeviationAboveTargetUtilBps`.
|
|
1400
|
+
* Mirrors `MAX_LENDING_POSITION_UPPER_UTIL_BPS` in the on-chain program.
|
|
1401
|
+
*/
|
|
1402
|
+
declare const MAX_LENDING_POSITION_UPPER_UTIL_BPS = 10500;
|
|
1403
|
+
/**
|
|
1404
|
+
* Floor for `maxDeviationAboveTargetUtilBps` in preset-based computation.
|
|
1405
|
+
*
|
|
1406
|
+
* When the raw target is high enough that the unwind-trigger gap would be
|
|
1407
|
+
* smaller than this, `computeCarryLendingAllocationConfig` pulls the target
|
|
1408
|
+
* down so the above-deviation is at least this wide. This prevents
|
|
1409
|
+
* near-zero unwind bands that would trigger constant rebalances.
|
|
1410
|
+
*/
|
|
1411
|
+
declare const MIN_DEVIATION_ABOVE_TARGET_UTIL_BPS = 200;
|
|
1412
|
+
/**
|
|
1413
|
+
* On-chain lending position tuning (see `LendingPositionConfig` in `long_yield_carry`).
|
|
1414
|
+
*/
|
|
1415
|
+
type CarryLendingAllocationConfig = {
|
|
1416
|
+
targetUtilizationRateBps: number;
|
|
1417
|
+
maxDeviationAboveTargetUtilBps: number;
|
|
1418
|
+
maxDeviationBelowTargetUtilBps: number;
|
|
1419
|
+
};
|
|
1420
|
+
type ComputeCarryLendingAllocationConfigParams = {
|
|
1421
|
+
/**
|
|
1422
|
+
* Collateral drawdown buffer between the **target** utilization and liquidation (positive percent,
|
|
1423
|
+
* e.g. `25` for 25%). At target utilization, a collateral drop of this size reaches the liquidation
|
|
1424
|
+
* line: `target = (1 − drawdownPctFromTargetToLiq/100) × liquidationThreshold / maxLtv`.
|
|
1425
|
+
*
|
|
1426
|
+
* Must be greater than `drawdownPctFromUnwindToLiq` (the target sits further from liquidation than
|
|
1427
|
+
* the unwind trigger).
|
|
1428
|
+
*/
|
|
1429
|
+
drawdownPctFromTargetToLiq: number;
|
|
1430
|
+
/**
|
|
1431
|
+
* Collateral drawdown buffer between the **unwind trigger** and liquidation (positive percent,
|
|
1432
|
+
* e.g. `10` for 10%). At the unwind trigger (`target + maxDeviationAbove`), a collateral drop of
|
|
1433
|
+
* this size reaches the liquidation line:
|
|
1434
|
+
* `unwindTrigger = (1 − drawdownPctFromUnwindToLiq/100) × liquidationThreshold / maxLtv`.
|
|
1435
|
+
*
|
|
1436
|
+
* Must be less than `drawdownPctFromTargetToLiq`.
|
|
1437
|
+
*/
|
|
1438
|
+
drawdownPctFromUnwindToLiq: number;
|
|
1439
|
+
/**
|
|
1440
|
+
* Max collateral **appreciation** (positive percent, e.g. `25` for +25%). If you start exactly at
|
|
1441
|
+
* target utilization and collateral rallies this much (debt USD fixed), utilization reaches the
|
|
1442
|
+
* **boost** trigger: `target − maxDeviationBelow`.
|
|
1443
|
+
*/
|
|
1444
|
+
maxPriceChangeUpPercent: number;
|
|
1445
|
+
/** Effective max LTV for the pair (decimal `0.8` = 80%), e.g. `ReservesManager.maxLtv`. */
|
|
1446
|
+
maxLtv: number;
|
|
1447
|
+
/** Collateral liquidation threshold (decimal `0.85` = 85%), from reserve config. */
|
|
1448
|
+
liquidationThreshold: number;
|
|
1449
|
+
};
|
|
1450
|
+
/** The price-band params without pair-specific LTV / liquidation fields. */
|
|
1451
|
+
type CarryPriceBandPreset = Omit<ComputeCarryLendingAllocationConfigParams, "maxLtv" | "liquidationThreshold">;
|
|
1452
|
+
/**
|
|
1453
|
+
* Clamps a lending position config so it satisfies the on-chain constraints in
|
|
1454
|
+
* `require_valid_lending_position_config_bps`:
|
|
1455
|
+
*
|
|
1456
|
+
* - `targetUtilizationRateBps` is clamped to `[1, MAX_TARGET_UTILIZATION_RATE_BPS]`
|
|
1457
|
+
* - `maxDeviationAboveTargetUtilBps` is clamped so `target + above ≤ MAX_LENDING_POSITION_UPPER_UTIL_BPS`
|
|
1458
|
+
*
|
|
1459
|
+
* Throws only for inputs that indicate a bug (non-integer, negative deviation, target ≤ maxDevBelow).
|
|
1460
|
+
*/
|
|
1461
|
+
declare function clampLendingPositionConfigBps(config: CarryLendingAllocationConfig): CarryLendingAllocationConfig;
|
|
1462
|
+
/**
|
|
1463
|
+
* Builds `targetUtilizationRateBps` and deviation bands from drawdown-to-liquidation buffers.
|
|
1464
|
+
*
|
|
1465
|
+
* **Model:** debt USD fixed; only collateral USD moves. Both the target and the unwind trigger are
|
|
1466
|
+
* defined by how much collateral drawdown separates them from the liquidation line
|
|
1467
|
+
* (`liquidationThreshold / maxLtv`). The boost trigger (below target) is set by a rally percentage.
|
|
1468
|
+
*
|
|
1469
|
+
* `maxDeviationAbove = unwindTriggerBps − targetBps` (derived, not from a price-change input).
|
|
1470
|
+
*/
|
|
1471
|
+
declare function computeCarryLendingAllocationConfig(params: ComputeCarryLendingAllocationConfigParams): CarryLendingAllocationConfig;
|
|
1472
|
+
interface ComputeConfigForCollateralArgs {
|
|
1473
|
+
/** Collateral mint address — used to look up the symbol from the mint registry. */
|
|
1474
|
+
collateralMint: Address;
|
|
1475
|
+
/** Collateral reserve — used to read `liquidationThresholdPct`. */
|
|
1476
|
+
collateralReserve: ReserveBase;
|
|
1477
|
+
/** Debt reserve — paired with collateral to determine `maxLtv` (including e-mode). */
|
|
1478
|
+
debtReserve: ReserveBase;
|
|
1479
|
+
/**
|
|
1480
|
+
* Override the volatility regime. When omitted, uses the asset's
|
|
1481
|
+
* `defaultRegime` from `ASSET_PRESETS`.
|
|
1482
|
+
*/
|
|
1483
|
+
regime?: VolatilityRegime;
|
|
1484
|
+
}
|
|
1485
|
+
/**
|
|
1486
|
+
* Resolves the carry trade price-band preset for a collateral mint and
|
|
1487
|
+
* computes the lending position config (target utilization + deviation bands)
|
|
1488
|
+
* using the reserve pair's `maxLtv` and `liquidationThreshold`.
|
|
1489
|
+
*
|
|
1490
|
+
* Uses {@link ReservesManager} to derive `maxLtv` (including e-mode overrides)
|
|
1491
|
+
* and normalizes `liquidationThresholdPct` to a decimal.
|
|
1492
|
+
*
|
|
1493
|
+
* Throws if the collateral mint symbol is not in `ASSET_PRESETS`.
|
|
1494
|
+
*/
|
|
1495
|
+
declare function computeConfigForCollateral(args: ComputeConfigForCollateralArgs): CarryLendingAllocationConfig;
|
|
1496
|
+
|
|
1497
|
+
/**
|
|
1498
|
+
* Per-asset carry trade price-band presets, split by volatility regime.
|
|
1499
|
+
*
|
|
1500
|
+
* Each preset defines three drawdown / rally buffers that control how aggressively a
|
|
1501
|
+
* lending position is utilized relative to its liquidation line:
|
|
1502
|
+
*
|
|
1503
|
+
* - `drawdownPctFromTargetToLiq` — collateral drawdown (%) that separates the **target**
|
|
1504
|
+
* utilization from the liquidation line. Larger = more conservative target.
|
|
1505
|
+
* - `drawdownPctFromUnwindToLiq` — collateral drawdown (%) that separates the **unwind
|
|
1506
|
+
* trigger** from the liquidation line. Smaller than target (closer to liquidation).
|
|
1507
|
+
* - `maxPriceChangeUpPercent` — max collateral **rally** (%) before the boost trigger fires,
|
|
1508
|
+
* prompting the position to borrow more and return to target.
|
|
1509
|
+
*
|
|
1510
|
+
* ## Usage
|
|
1511
|
+
*
|
|
1512
|
+
* Select the appropriate asset preset and volatility regime, then pass it to
|
|
1513
|
+
* `LycLendingPositionManager.getLendingAllocationConfigFromPriceBands(preset)`, which combines
|
|
1514
|
+
* the price-band params with pair-specific `maxLtv` and `liquidationThreshold` to produce
|
|
1515
|
+
* a `CarryLendingAllocationConfig` (target utilization + deviation bands in bps). The
|
|
1516
|
+
* resulting config is used to update the on-chain `LendingPositionConfig`, adapting the
|
|
1517
|
+
* position's risk envelope to the current market regime.
|
|
1518
|
+
*
|
|
1519
|
+
* ## Asset tiers (tightest → widest buffers)
|
|
1520
|
+
*
|
|
1521
|
+
* BTC → ETH → SOL → large-cap alts → small-cap alts
|
|
1522
|
+
*
|
|
1523
|
+
* Higher-volatility assets use wider buffers to avoid unnecessary unwinds during normal
|
|
1524
|
+
* price swings, while lower-volatility assets can afford tighter bands for better capital
|
|
1525
|
+
* efficiency.
|
|
1526
|
+
*/
|
|
1527
|
+
|
|
1528
|
+
declare const VOLATILITY_REGIMES: readonly ["lowVol", "highVol"];
|
|
1529
|
+
type VolatilityRegime = (typeof VOLATILITY_REGIMES)[number];
|
|
1530
|
+
declare function isVolatilityRegime(s: string): s is VolatilityRegime;
|
|
1531
|
+
type CarryVolatilityPresets = {
|
|
1532
|
+
lowVol: CarryPriceBandPreset;
|
|
1533
|
+
highVol: CarryPriceBandPreset;
|
|
1534
|
+
};
|
|
1535
|
+
interface AssetPresetEntry {
|
|
1536
|
+
presets: CarryVolatilityPresets;
|
|
1537
|
+
defaultRegime: VolatilityRegime;
|
|
1538
|
+
}
|
|
1539
|
+
declare const STOCK_INDEX_PRESETS: CarryVolatilityPresets;
|
|
1540
|
+
declare const BTC_CARRY_PRESETS: CarryVolatilityPresets;
|
|
1541
|
+
declare const ETH_CARRY_PRESETS: CarryVolatilityPresets;
|
|
1542
|
+
declare const SOL_CARRY_PRESETS: CarryVolatilityPresets;
|
|
1543
|
+
declare const LST_CARRY_PRESETS: CarryVolatilityPresets;
|
|
1544
|
+
declare const LARGE_CAP_ALT_CARRY_PRESETS: CarryVolatilityPresets;
|
|
1545
|
+
declare const SMALL_CAP_ALT_CARRY_PRESETS: CarryVolatilityPresets;
|
|
1546
|
+
/**
|
|
1547
|
+
* Maps collateral symbol (upper-cased) to its carry trade preset tier and
|
|
1548
|
+
* default volatility regime. Used by scripts and backend services to resolve
|
|
1549
|
+
* the correct price-band parameters when creating or reconfiguring lending
|
|
1550
|
+
* positions.
|
|
1551
|
+
*/
|
|
1552
|
+
declare const ASSET_PRESETS: Record<string, AssetPresetEntry>;
|
|
1553
|
+
/** Looks up the carry preset entry for a collateral symbol (case-insensitive). */
|
|
1554
|
+
declare function resolvePresets(collateralSymbol: string): AssetPresetEntry | undefined;
|
|
1555
|
+
|
|
1556
|
+
interface DebtAllocationTarget {
|
|
1557
|
+
mint: Address;
|
|
1558
|
+
amountUi: number;
|
|
1559
|
+
/** Proportion of total debt allocated here, in basis points (0–10000) */
|
|
1560
|
+
weightBps: number;
|
|
1561
|
+
}
|
|
1562
|
+
interface DebtReallocation {
|
|
1563
|
+
token: Address;
|
|
1564
|
+
lendingPositionIndex: number;
|
|
1565
|
+
currentDebtMint: Address;
|
|
1566
|
+
currentDebtAmountUi: number;
|
|
1567
|
+
currentBorrowApy: number;
|
|
1568
|
+
/** Supply APY that the collateral earns as a pair incentive from the current debt token. */
|
|
1569
|
+
currentSupplyIncentiveApy: number;
|
|
1570
|
+
projectedBorrowApy: number;
|
|
1571
|
+
targets: DebtAllocationTarget[];
|
|
1572
|
+
/**
|
|
1573
|
+
* Ordered list of single-mint fallback options to try if the primary targets
|
|
1574
|
+
* fail at execution time (e.g. insufficient borrow capacity or swap liquidity).
|
|
1575
|
+
* Each entry is a full-position allocation to a single mint, ranked by
|
|
1576
|
+
* effective borrow APY ascending.
|
|
1577
|
+
*/
|
|
1578
|
+
fallbackTargets: DebtAllocationTarget[][];
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
interface AllocationServiceOptions {
|
|
1582
|
+
/**
|
|
1583
|
+
* Receives diagnostic log messages. When omitted, the service is silent
|
|
1584
|
+
* (used by unit tests). Pass `console.log` from scripts to inspect per-pool
|
|
1585
|
+
* candidate evaluation, incentive eligibility, and the chosen allocation.
|
|
1586
|
+
*/
|
|
1587
|
+
logger?: (message: string) => void;
|
|
1588
|
+
/**
|
|
1589
|
+
* Yielding-bank state used to identify tokens whose active bank holds USD*.
|
|
1590
|
+
* Without this data, allocation remains unbiased.
|
|
1591
|
+
*/
|
|
1592
|
+
yieldingBanks?: readonly LYCYieldingBank[];
|
|
1593
|
+
}
|
|
1594
|
+
declare class AllocationService {
|
|
1595
|
+
private readonly lpData;
|
|
1596
|
+
private readonly log;
|
|
1597
|
+
private readonly yieldingBanks;
|
|
1598
|
+
constructor(lpData: LendingPlatformData, options?: AllocationServiceOptions);
|
|
1599
|
+
/**
|
|
1600
|
+
* Returns the debt mint with the highest pair-adjusted net APY
|
|
1601
|
+
* (supplyAPY − borrowAPY) for a given pool and collateral reserve.
|
|
1602
|
+
*
|
|
1603
|
+
* Use this when creating a new lending position to pick the optimal debt
|
|
1604
|
+
* mint rather than hardcoding a default.
|
|
1605
|
+
*/
|
|
1606
|
+
findOptimalDebtMint(pool: Address, collateralReserve: ReserveBase, token?: LYCToken): Promise<{
|
|
1607
|
+
mint: Address;
|
|
1608
|
+
symbol: string;
|
|
1609
|
+
borrowApy: number;
|
|
1610
|
+
} | null>;
|
|
1611
|
+
/**
|
|
1612
|
+
* Groups all active lending positions by pool, then for each position in a
|
|
1613
|
+
* pool finds the allocation across supported borrow mints that minimises
|
|
1614
|
+
* that position's pair-adjusted borrow cost. Positions are optimised
|
|
1615
|
+
* independently — pair-incentive eligibility is keyed on the position's
|
|
1616
|
+
* (debt, collateral) pair, so positions with different collaterals can have
|
|
1617
|
+
* different optimal debt mints. (Utilization coupling between positions on
|
|
1618
|
+
* the same reserve is not modelled; pair-incentive deltas dominate marginal
|
|
1619
|
+
* utilization deltas at typical position sizes.)
|
|
1620
|
+
*
|
|
1621
|
+
* Returns one entry per position whose allocation would change.
|
|
1622
|
+
*/
|
|
1623
|
+
computeOptimalAllocations(tokens: LYCToken[]): Promise<DebtReallocation[]>;
|
|
1624
|
+
private resolveAllPositions;
|
|
1625
|
+
private resolvePosition;
|
|
1626
|
+
private tokenUsesUsdStarYieldingBank;
|
|
1627
|
+
private applyUsdcBias;
|
|
1628
|
+
private groupByPool;
|
|
1629
|
+
private processPoolGroup;
|
|
1630
|
+
/**
|
|
1631
|
+
* Optimises a single position against the candidate set, logs the result,
|
|
1632
|
+
* applies the minimum-improvement gate, and returns a reallocation if one
|
|
1633
|
+
* should be emitted. Returns `null` when the position is already optimal,
|
|
1634
|
+
* the optimum doesn't beat current, or the gain is below threshold.
|
|
1635
|
+
*
|
|
1636
|
+
*/
|
|
1637
|
+
private evaluatePosition;
|
|
1638
|
+
/**
|
|
1639
|
+
* Logs, in this order:
|
|
1640
|
+
* 1. Each collateral reserve in the pool group + its incentives (once).
|
|
1641
|
+
* 2. Each candidate debt reserve: base borrow APY, utilization, and its
|
|
1642
|
+
* borrow-side incentives (once).
|
|
1643
|
+
* 3. A net-APY matrix (candidate rows × collateral columns) showing the
|
|
1644
|
+
* pair-adjusted supply APY, borrow APY, and net APY = supply − borrow.
|
|
1645
|
+
* The matrix answers "should I borrow USDS or USDG against cbBTC?" at a
|
|
1646
|
+
* glance — compare rows within the cbBTC column.
|
|
1647
|
+
*
|
|
1648
|
+
* The matrix uses `supplyAPY(debtReserve)` and `borrowAPY(supplyReserve)`,
|
|
1649
|
+
* which include pair-gated incentives. A `★` marks rows where a pair
|
|
1650
|
+
* incentive activates (supplyApy or borrowApy differs from the base).
|
|
1651
|
+
*/
|
|
1652
|
+
private logCandidates;
|
|
1653
|
+
private logBorrowRateMatrix;
|
|
1654
|
+
private aggregateExistingDebtByMint;
|
|
1655
|
+
private resolveGroupCandidates;
|
|
1656
|
+
private fetchOptionalReserveByMint;
|
|
1657
|
+
/**
|
|
1658
|
+
* Finds the allocation of `pos.debtAmountUi` across `candidates` that
|
|
1659
|
+
* MAXIMISES this position's pair-adjusted net APY (supplyApy − borrowApy)
|
|
1660
|
+
* using DP over a discrete grid of size K = ALLOCATION_STEPS.
|
|
1661
|
+
*
|
|
1662
|
+
* Both legs are pair-adjusted with this position's own collateral reserve,
|
|
1663
|
+
* since incentive eligibility is keyed on the (debt, collateral) pair. This
|
|
1664
|
+
* matters because some pair incentives (e.g. USDG★cbBTC) act on the supply
|
|
1665
|
+
* side — minimising borrow cost alone would miss them.
|
|
1666
|
+
*
|
|
1667
|
+
* For candidate `i` at step `n`:
|
|
1668
|
+
* target = n × stepSize
|
|
1669
|
+
* posExisting = pos.debtAmountUi if pos.debtMint == candidate.mint else 0
|
|
1670
|
+
* debtChange = target − posExisting
|
|
1671
|
+
* borrowApy = simulateNewBorrowAPY({debtChange}, pos.collateralReserve)
|
|
1672
|
+
* supplyApy = pos.collateralReserve.supplyAPY(reserve.address)
|
|
1673
|
+
*
|
|
1674
|
+
* The DP minimises Σ target × (borrowApy − supplyApy) — equivalent to
|
|
1675
|
+
* maximising debt-weighted net APY. Utilization coupling with sibling
|
|
1676
|
+
* positions is not modelled; the simulator only sees this position's
|
|
1677
|
+
* marginal change.
|
|
1678
|
+
*/
|
|
1679
|
+
private optimizePosition;
|
|
1680
|
+
private runDp;
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
/**
|
|
1684
|
+
* LYC-flavoured {@link LendingPositionManager}: adds carry-specific sizing
|
|
1685
|
+
* signals ({@link shouldIncreaseCarryPosition}, {@link shouldDecreaseCarryPosition})
|
|
1686
|
+
* and defaults utilization targets from the on-chain `LendingPositionConfig`.
|
|
1687
|
+
*/
|
|
1688
|
+
declare class LycLendingPositionManager extends LendingPositionManager {
|
|
1689
|
+
readonly lendingPosition: TokenLendingPositionData;
|
|
1690
|
+
constructor(lpData: LendingPlatformData, lendingPosition: TokenLendingPositionData, collateralReserve: ReserveBase, debtReserve: ReserveBase, environment?: Environment);
|
|
1691
|
+
static create(lpData: LendingPlatformData, lendingPosition: TokenLendingPositionData, environment?: Environment): Promise<LycLendingPositionManager>;
|
|
1692
|
+
/**
|
|
1693
|
+
* Derives `targetUtilizationRateBps` and carry trigger deviations from drawdown-to-liquidation
|
|
1694
|
+
* buffers and a rally percentage, using this pair's {@link ReservesManager.maxLtv} and the
|
|
1695
|
+
* collateral reserve's **base** `liquidationThresholdPct` (normalized to a decimal).
|
|
1696
|
+
*
|
|
1697
|
+
* For custom `maxLtv` / `liquidationThreshold` (e.g. e-mode liquidation threshold), call
|
|
1698
|
+
* {@link computeCarryLendingAllocationConfig} directly.
|
|
1699
|
+
*/
|
|
1700
|
+
getLendingAllocationConfigFromPriceBands(params: CarryPriceBandPreset): CarryLendingAllocationConfig;
|
|
1701
|
+
/**
|
|
1702
|
+
* Returns true when the current LTV utilization (valued at EMA prices) has
|
|
1703
|
+
* fallen far enough below the target that the position should be boosted.
|
|
1704
|
+
*/
|
|
1705
|
+
shouldIncreaseCarryPosition(): Promise<boolean>;
|
|
1706
|
+
/**
|
|
1707
|
+
* Returns true when the current LTV utilization (valued at realtime prices) has
|
|
1708
|
+
* risen far enough above the target that the position should be unwound.
|
|
1709
|
+
*/
|
|
1710
|
+
shouldDecreaseCarryPosition(): Promise<boolean>;
|
|
1711
|
+
calcDebtChangeAmount(targetUtilizationRateBps?: number): Promise<number>;
|
|
1712
|
+
calcPreWithdrawalTargetUtilizationRateBps(withdrawUiCollateralAmount: number, postWithdrawalTargetUtilizationRateBps?: number): Promise<number>;
|
|
1713
|
+
calcDebtChangeAmountForCollateralWithdrawal(withdrawUiCollateralAmount: number, postWithdrawalTargetUtilizationRateBps?: number): Promise<number>;
|
|
1714
|
+
getCollateralPriceTriggerBand(): Promise<CollateralPriceTriggerBand>;
|
|
1715
|
+
getInspectMetrics(): Promise<LendingPositionInspectMetrics | null>;
|
|
1716
|
+
private configTriggerBandBps;
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
/** A lending position paired with the amount to deposit into it, in raw base units. */
|
|
1720
|
+
interface EvenDepositAllocation {
|
|
1721
|
+
lp: IndexedLendingPosition;
|
|
1722
|
+
depositRaw: bigint;
|
|
1723
|
+
}
|
|
1724
|
+
/**
|
|
1725
|
+
* Distributes `totalDepositRaw` across `positions` so their post-deposit
|
|
1726
|
+
* collateral balances end up as even as possible. Deposits only — a position
|
|
1727
|
+
* that is already above the resulting water level is left untouched (we never
|
|
1728
|
+
* withdraw to level down).
|
|
1729
|
+
*
|
|
1730
|
+
* Water-filling: the lowest-collateral positions are topped up first until they
|
|
1731
|
+
* reach the next tier, then the remainder is spread evenly across the leveled
|
|
1732
|
+
* front. Base-unit remainders from integer division go to the lowest-collateral
|
|
1733
|
+
* positions first, so the returned deposits sum exactly to `totalDepositRaw`.
|
|
1734
|
+
*
|
|
1735
|
+
* Only positions receiving a positive deposit are returned; each keeps its
|
|
1736
|
+
* original `index` for the on-chain `lendingPositions[index]` reference.
|
|
1737
|
+
*/
|
|
1738
|
+
declare function computeEvenDepositAllocation(positions: IndexedLendingPosition[], totalDepositRaw: bigint): EvenDepositAllocation[];
|
|
1739
|
+
type LogFn$1 = (msg: string) => void;
|
|
1740
|
+
interface EnsureInitialKaminoLendingPositionOptions {
|
|
1741
|
+
manager: TransactionSigner;
|
|
1742
|
+
/** When set, refreshes the per-token LUT after the new LP is created. */
|
|
1743
|
+
lutManager?: TransactionSigner;
|
|
1744
|
+
token: LYCToken;
|
|
1745
|
+
sendPlan: (plan: LongYieldCarryTransactionPlan, label: string) => Promise<void>;
|
|
1746
|
+
log?: LogFn$1;
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* Shared logic for interacting with a token's lending positions: bootstrapping
|
|
1750
|
+
* the first position, and depositing unlent collateral across positions. Used
|
|
1751
|
+
* by deposit scripts and backend services.
|
|
1752
|
+
*/
|
|
1753
|
+
declare class LendingPositionService {
|
|
1754
|
+
private readonly client;
|
|
1755
|
+
constructor(client: LongYieldCarryClient);
|
|
1756
|
+
/**
|
|
1757
|
+
* Opens the first Kamino lending position on a token that has none yet.
|
|
1758
|
+
*
|
|
1759
|
+
* Mirrors `scripts/createTokenLendingPosition.ts` and the create-LP branch in
|
|
1760
|
+
* `TokenRebalanceWorker`: resolve pool + optimal debt mint, compute carry
|
|
1761
|
+
* allocation config, send `createTokenLendingPosition`, then refetch the token.
|
|
1762
|
+
*
|
|
1763
|
+
* Kamino-specific: the flow resolves the default Kamino pool, fetches Kamino
|
|
1764
|
+
* reserves, and uses {@link AllocationService} over Kamino reserve data. It is
|
|
1765
|
+
* named accordingly until a second lending platform actually needs bootstrap
|
|
1766
|
+
* support (avoid speculative platform abstraction with a single implementation).
|
|
1767
|
+
*
|
|
1768
|
+
* No-op when the token already has at least one active lending position slot.
|
|
1769
|
+
*
|
|
1770
|
+
* @throws {LendingPositionBootstrapError} when the token cannot be bootstrapped
|
|
1771
|
+
* because of a permanent configuration gap (collateral mint not in any pool,
|
|
1772
|
+
* no preset, no viable debt mint / reserve). Callers should treat this as a
|
|
1773
|
+
* skip rather than a retryable failure.
|
|
1774
|
+
*/
|
|
1775
|
+
ensureInitialKaminoLendingPosition(options: EnsureInitialKaminoLendingPositionOptions): Promise<LYCToken>;
|
|
1776
|
+
/**
|
|
1777
|
+
* Deposits all unlent collateral across the token's active lending positions,
|
|
1778
|
+
* distributing it so their post-deposit collateral balances end up as even as
|
|
1779
|
+
* possible (see {@link computeEvenDepositAllocation}).
|
|
1780
|
+
*
|
|
1781
|
+
* Refreshes the token state first, then sends one `depositUnlentCollateral`
|
|
1782
|
+
* per position that receives an allocation. Returns one entry per deposit sent.
|
|
1783
|
+
*/
|
|
1784
|
+
depositEvenlyAcrossPositions(signer: TransactionSigner, token: LYCToken, log?: LogFn$1): Promise<{
|
|
1785
|
+
signature: string;
|
|
1786
|
+
lendingPositionIndex: number;
|
|
1787
|
+
depositUi: number;
|
|
1788
|
+
debtSymbol: string;
|
|
1789
|
+
}[]>;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
type RebalancePlanResult = {
|
|
1793
|
+
outcome: "skipped";
|
|
1794
|
+
reason: string;
|
|
1795
|
+
} | {
|
|
1796
|
+
outcome: "plan";
|
|
1797
|
+
plan: LongYieldCarryTransactionPlan;
|
|
1798
|
+
label: string;
|
|
1799
|
+
};
|
|
1800
|
+
/**
|
|
1801
|
+
* Shared logic for building a token rebalance plan from a {@link DebtReallocation}.
|
|
1802
|
+
* Callers are responsible for sending the returned plan (and any post-send steps such as
|
|
1803
|
+
* excess-rent reclaim).
|
|
1804
|
+
*/
|
|
1805
|
+
interface TokenRebalanceServiceOptions {
|
|
1806
|
+
/**
|
|
1807
|
+
* Maximum acceptable execution cost (route fees + price impact) of the
|
|
1808
|
+
* rebalance swap quote vs the oracle-fair cross rate, in bps. Candidates
|
|
1809
|
+
* quoting worse are skipped — that cost is permanently lost value.
|
|
1810
|
+
* Unset = no limit.
|
|
1811
|
+
*/
|
|
1812
|
+
maxSwapCostBps?: number;
|
|
1813
|
+
/**
|
|
1814
|
+
* Maximum acceptable market basis between the two debt stables, in bps
|
|
1815
|
+
* either direction. Bounds how much mark-to-market difference the $1-pinned
|
|
1816
|
+
* books absorb per conversion, and blocks rebalancing through a depegging
|
|
1817
|
+
* stable. Unset = no limit.
|
|
1818
|
+
*/
|
|
1819
|
+
maxMarketBasisBps?: number;
|
|
1820
|
+
}
|
|
1821
|
+
declare class TokenRebalanceService {
|
|
1822
|
+
private readonly client;
|
|
1823
|
+
private readonly options;
|
|
1824
|
+
constructor(client: LongYieldCarryClient, options?: TokenRebalanceServiceOptions);
|
|
1825
|
+
/**
|
|
1826
|
+
* Validates a reallocation and builds the rebalance transaction plan.
|
|
1827
|
+
* If the primary targets fail due to insufficient borrow/swap capacity
|
|
1828
|
+
* ({@link ExactInQuoteExceedsMaxInputError}), retries with each fallback
|
|
1829
|
+
* option in order before giving up.
|
|
1830
|
+
*
|
|
1831
|
+
* Returns `{ outcome: "skipped" }` for benign no-ops (inactive token, no active LP for the
|
|
1832
|
+
* reallocation index, no targets). Throws on unexpected errors from the builder.
|
|
1833
|
+
*/
|
|
1834
|
+
buildPlan(token: LYCToken, realloc: DebtReallocation): Promise<RebalancePlanResult>;
|
|
1835
|
+
/** Convenience: fetch a fresh token then call {@link buildPlan}. */
|
|
1836
|
+
fetchAndBuildPlan(tokenAddress: Address, realloc: DebtReallocation): Promise<RebalancePlanResult>;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
/**
|
|
1840
|
+
* A single allocation target: a mint and its desired weight in basis points.
|
|
1841
|
+
* Weights across all targets in a {@link TargetAllocation} must sum to 10_000.
|
|
1842
|
+
*/
|
|
1843
|
+
interface AllocationTarget {
|
|
1844
|
+
mint: Address;
|
|
1845
|
+
weightBps: number;
|
|
1846
|
+
/** Slippage tolerance for swaps into/out of this asset (basis points). */
|
|
1847
|
+
slippageBps: number;
|
|
1848
|
+
/**
|
|
1849
|
+
* Allocation config needed to register this asset on the yielding bank
|
|
1850
|
+
* if it doesn't already have a holding slot. Required for first-time
|
|
1851
|
+
* allocations; ignored when the bank already holds the asset.
|
|
1852
|
+
*/
|
|
1853
|
+
allocationConfig: YieldingBankAllocationConfig;
|
|
1854
|
+
}
|
|
1855
|
+
/**
|
|
1856
|
+
* The full target allocation for a yielding bank's non-base assets.
|
|
1857
|
+
* Each entry describes one asset and its desired weight.
|
|
1858
|
+
* Weights must sum to exactly 10_000 (100%).
|
|
1859
|
+
*/
|
|
1860
|
+
type TargetAllocation = AllocationTarget[];
|
|
1861
|
+
/**
|
|
1862
|
+
* The output of {@link RebalancePlanner.plan}: swaps to execute and any
|
|
1863
|
+
* new asset holdings to create before the rebalance instruction fires.
|
|
1864
|
+
*/
|
|
1865
|
+
interface YieldingBankRebalancePlan {
|
|
1866
|
+
/** Swaps to execute (base → asset or asset → base). */
|
|
1867
|
+
swaps: RebalanceSwapSpec[];
|
|
1868
|
+
/**
|
|
1869
|
+
* If a target allocation references a mint the bank has never held,
|
|
1870
|
+
* the allocation must be registered first. This contains the config
|
|
1871
|
+
* for that one-time setup. At most one new allocation per rebalance.
|
|
1872
|
+
*/
|
|
1873
|
+
newAllocation?: {
|
|
1874
|
+
config: YieldingBankAllocationConfig;
|
|
1875
|
+
};
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
/**
|
|
1879
|
+
* Decides the target allocation for a yielding bank's non-base assets.
|
|
1880
|
+
*
|
|
1881
|
+
* Implementations receive the current bank state and return the desired
|
|
1882
|
+
* distribution across yield-bearing assets. The {@link RebalancePlanner}
|
|
1883
|
+
* then computes the delta (swaps) needed to reach that target.
|
|
1884
|
+
*
|
|
1885
|
+
* Strategies should be pure functions of the bank state (and any external
|
|
1886
|
+
* data injected through the constructor). They must not perform RPC calls
|
|
1887
|
+
* or side effects.
|
|
1888
|
+
*/
|
|
1889
|
+
interface AllocationStrategy {
|
|
1890
|
+
computeTarget(bank: LYCYieldingBank): TargetAllocation;
|
|
1891
|
+
}
|
|
1892
|
+
/**
|
|
1893
|
+
* Default strategy: deploy 100% of idle base asset into USD*.
|
|
1894
|
+
*
|
|
1895
|
+
* This is the simplest possible allocation — all non-base value goes to
|
|
1896
|
+
* a single Perena stablecoin. Replace with a multi-asset strategy when
|
|
1897
|
+
* additional yield-bearing positions (e.g. USD*-J) are introduced.
|
|
1898
|
+
*/
|
|
1899
|
+
declare class SimpleUsdStarStrategy implements AllocationStrategy {
|
|
1900
|
+
computeTarget(_bank: LYCYieldingBank): TargetAllocation;
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
/**
|
|
1904
|
+
* Computes the swaps needed to move a yielding bank from its current
|
|
1905
|
+
* asset distribution to a target allocation.
|
|
1906
|
+
*
|
|
1907
|
+
* The planner is stateless and performs no RPC — it operates entirely on
|
|
1908
|
+
* the in-memory bank model and the strategy's target. This makes it
|
|
1909
|
+
* straightforward to unit-test.
|
|
1910
|
+
*
|
|
1911
|
+
* ## How it works
|
|
1912
|
+
*
|
|
1913
|
+
* 1. The {@link AllocationStrategy} produces a {@link TargetAllocation}
|
|
1914
|
+
* (e.g. 25% USD*, 75% USD*-J).
|
|
1915
|
+
* 2. The planner classifies every bank holding as either a **target**
|
|
1916
|
+
* (a mint the strategy manages) or an **idle source** (everything
|
|
1917
|
+
* else — the base asset, plus any non-target stablecoins that
|
|
1918
|
+
* arrived from borrows in other denominations).
|
|
1919
|
+
* 3. Each idle source with a non-trivial balance gets its own
|
|
1920
|
+
* {@link YieldingBankRebalancePlan} that deploys its capital
|
|
1921
|
+
* proportionally across the targets according to their weights.
|
|
1922
|
+
* 4. If existing target holdings are imbalanced relative to their
|
|
1923
|
+
* weights (overweight / underweight), a separate rebalance plan
|
|
1924
|
+
* routes through the base mint. The resulting swaps are sorted
|
|
1925
|
+
* sells-first so freed base-mint liquidity is available for
|
|
1926
|
+
* subsequent buy swaps.
|
|
1927
|
+
*
|
|
1928
|
+
* All swaps route through the bank's base mint as the common
|
|
1929
|
+
* intermediate, matching how the on-chain `rebalance_yielding_bank`
|
|
1930
|
+
* instruction processes CPI swaps.
|
|
1931
|
+
*/
|
|
1932
|
+
declare class RebalancePlanner {
|
|
1933
|
+
private readonly strategy;
|
|
1934
|
+
constructor(strategy: AllocationStrategy);
|
|
1935
|
+
/**
|
|
1936
|
+
* Plan the rebalance for a single yielding bank.
|
|
1937
|
+
* Returns an empty array if no action is needed.
|
|
1938
|
+
*
|
|
1939
|
+
* Each element is an independent plan that can be sent as its own
|
|
1940
|
+
* transaction. Separate plans are produced for:
|
|
1941
|
+
* - Each idle source (base asset, or non-target stablecoins)
|
|
1942
|
+
* - Target-to-target rebalancing (selling overweight, buying underweight)
|
|
1943
|
+
*/
|
|
1944
|
+
plan(bank: LYCYieldingBank): YieldingBankRebalancePlan[];
|
|
1945
|
+
/**
|
|
1946
|
+
* Returns every holding on the bank that is NOT a strategy target.
|
|
1947
|
+
* This includes the base asset and any non-target asset slots with
|
|
1948
|
+
* a positive balance (e.g. a stablecoin that arrived from a
|
|
1949
|
+
* non-base-mint borrow).
|
|
1950
|
+
*/
|
|
1951
|
+
private discoverIdleSources;
|
|
1952
|
+
/** Snapshot only the holdings that ARE strategy targets. */
|
|
1953
|
+
private snapshotTargetHoldings;
|
|
1954
|
+
/**
|
|
1955
|
+
* Build a plan that deploys a single idle source proportionally
|
|
1956
|
+
* across the strategy's targets according to their weights.
|
|
1957
|
+
*/
|
|
1958
|
+
private buildDeploymentPlan;
|
|
1959
|
+
/**
|
|
1960
|
+
* Build a plan that rebalances between existing target holdings when
|
|
1961
|
+
* they've drifted from the strategy's desired weights. Overweight
|
|
1962
|
+
* targets are sold back to the base mint; underweight targets are
|
|
1963
|
+
* bought with the freed base.
|
|
1964
|
+
*/
|
|
1965
|
+
private buildTargetRebalancePlan;
|
|
1966
|
+
private findCurrentAmount;
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
interface RedemptionServiceOptions {
|
|
1970
|
+
/** Swap slippage tolerance for DCP transactions, in bps. Defaults to 100. */
|
|
1971
|
+
dcpSwapSlippageBps?: number;
|
|
1972
|
+
/** Optional structured sink for warnings (funding CPI failures, partial funding). */
|
|
1973
|
+
structuredLog?: (entry: StructuredRedemptionLog) => void;
|
|
1974
|
+
}
|
|
1975
|
+
/** Single LP-targeted funding failure captured during epoch funding. */
|
|
1976
|
+
interface RedemptionFundingFailure {
|
|
1977
|
+
lpIndex: number;
|
|
1978
|
+
message: string;
|
|
1979
|
+
}
|
|
1980
|
+
/** Aggregated non-fatal failures while funding an epoch (DCP vs withdraw phases). */
|
|
1981
|
+
interface RedemptionFundingErrors {
|
|
1982
|
+
dcp: RedemptionFundingFailure[];
|
|
1983
|
+
withdraw: RedemptionFundingFailure[];
|
|
1984
|
+
}
|
|
1985
|
+
interface StructuredRedemptionLog {
|
|
1986
|
+
level: "warn" | "info";
|
|
1987
|
+
event: string;
|
|
1988
|
+
data?: Record<string, unknown>;
|
|
1989
|
+
}
|
|
1990
|
+
interface FundRedemptionEpochResult {
|
|
1991
|
+
funded: boolean;
|
|
1992
|
+
fundedCollateral: bigint;
|
|
1993
|
+
grossCollateralClaim: bigint;
|
|
1994
|
+
realizedUnwindLoss: bigint;
|
|
1995
|
+
errors: RedemptionFundingErrors;
|
|
1996
|
+
}
|
|
1997
|
+
interface ProcessEpochResult {
|
|
1998
|
+
requestsProcessed: number;
|
|
1999
|
+
}
|
|
2000
|
+
type LogFn = (msg: string) => void;
|
|
2001
|
+
/**
|
|
2002
|
+
* Orchestrates the redemption epoch lifecycle: detecting open epochs, waiting
|
|
2003
|
+
* for their time window to elapse, funding (DCP + top-up), and processing
|
|
2004
|
+
* individual async burn requests.
|
|
2005
|
+
*
|
|
2006
|
+
* Holds a reference to the LYC client and caches yielding-bank PDAs per token
|
|
2007
|
+
* so repeated calls against the same token avoid redundant derivation.
|
|
2008
|
+
*/
|
|
2009
|
+
declare class RedemptionService {
|
|
2010
|
+
private readonly client;
|
|
2011
|
+
private readonly yieldingBankCache;
|
|
2012
|
+
private readonly dcpSwapSlippageBps;
|
|
2013
|
+
private readonly structuredLog?;
|
|
2014
|
+
constructor(client: LongYieldCarryClient, opts?: RedemptionServiceOptions);
|
|
2015
|
+
/** Delegates to `client.account.fetchAllRedemptionEpochs`. */
|
|
2016
|
+
getAllEpochs(): Promise<RedemptionEpochSnapshot[]>;
|
|
2017
|
+
/** Delegates to `client.account.fetchRedemptionEpoch`. */
|
|
2018
|
+
getEpoch(epochPda: Address): Promise<RedemptionEpochSnapshot>;
|
|
2019
|
+
/** Re-fetches an existing snapshot from on-chain state. */
|
|
2020
|
+
refreshEpoch(epoch: RedemptionEpochSnapshot): Promise<RedemptionEpochSnapshot>;
|
|
2021
|
+
/**
|
|
2022
|
+
* Returns the number of milliseconds until the epoch's acceptance window
|
|
2023
|
+
* closes. Zero or negative means the window has already elapsed.
|
|
2024
|
+
*/
|
|
2025
|
+
epochWindowRemainingMs(epoch: RedemptionEpochSnapshot): number;
|
|
2026
|
+
/**
|
|
2027
|
+
* Sleeps until the epoch's 60-second acceptance window has elapsed. Returns
|
|
2028
|
+
* immediately if the window is already closed.
|
|
2029
|
+
*/
|
|
2030
|
+
waitForEpochWindow(epoch: RedemptionEpochSnapshot, log?: LogFn): Promise<void>;
|
|
2031
|
+
/**
|
|
2032
|
+
* Transitions an epoch from Open → Funding. Waits for the epoch window to
|
|
2033
|
+
* close first so in-flight burns can still land.
|
|
2034
|
+
*/
|
|
2035
|
+
closeEpoch(signer: TransactionSigner, epoch: RedemptionEpochSnapshot, log?: LogFn): Promise<void>;
|
|
2036
|
+
/** Transitions an epoch from Funding → Processing. */
|
|
2037
|
+
startProcessing(signer: TransactionSigner, epoch: RedemptionEpochSnapshot, log?: LogFn): Promise<void>;
|
|
2038
|
+
/**
|
|
2039
|
+
* Funds a redemption epoch. Withdraws from debt-free LPs first (no DCP
|
|
2040
|
+
* needed), then — if a deficit remains — runs targeted DCP + withdraw on
|
|
2041
|
+
* carry-loaded LPs, prioritizing non-optimal positions.
|
|
2042
|
+
*/
|
|
2043
|
+
fundEpoch(signer: TransactionSigner, epoch: RedemptionEpochSnapshot, log?: LogFn): Promise<FundRedemptionEpochResult>;
|
|
2044
|
+
/**
|
|
2045
|
+
* Processes all remaining async burn requests in a redemption epoch in FIFO
|
|
2046
|
+
* order.
|
|
2047
|
+
*/
|
|
2048
|
+
processRequests(signer: TransactionSigner, epoch: RedemptionEpochSnapshot, log?: LogFn): Promise<ProcessEpochResult>;
|
|
2049
|
+
/**
|
|
2050
|
+
* Runs the complete epoch lifecycle: close → fund → transition to
|
|
2051
|
+
* processing → process all requests.
|
|
2052
|
+
*
|
|
2053
|
+
* Returns true if the epoch was fully processed and closed.
|
|
2054
|
+
*/
|
|
2055
|
+
processEpoch(signer: TransactionSigner, epoch: RedemptionEpochSnapshot, log?: LogFn): Promise<boolean>;
|
|
2056
|
+
clearYieldingBankCache(): void;
|
|
2057
|
+
/**
|
|
2058
|
+
* Credits only the residual shortfall from collateral already sitting in the
|
|
2059
|
+
* token PDA's unlent reserve. LP withdrawals run first so existing reserves
|
|
2060
|
+
* are used as the tail of mixed LP/unlent funding, not the first source.
|
|
2061
|
+
*/
|
|
2062
|
+
private creditResidualUnlent;
|
|
2063
|
+
/** Phase 1: withdraw directly from LPs that have no debt (no DCP needed). */
|
|
2064
|
+
private fundFromDebtFreeLps;
|
|
2065
|
+
/**
|
|
2066
|
+
* Phase 2: DCP + withdraw from carry-loaded LPs, processed in position order
|
|
2067
|
+
* (first slot to last) so burns unwind positions deterministically.
|
|
2068
|
+
*/
|
|
2069
|
+
private fundFromCarryLps;
|
|
2070
|
+
/**
|
|
2071
|
+
* Runs a targeted DCP on each LP that needs collateral freed. Iterates `lps`
|
|
2072
|
+
* in the caller-provided order (on-chain slot order, first to last).
|
|
2073
|
+
*/
|
|
2074
|
+
private dcpAcrossLps;
|
|
2075
|
+
/**
|
|
2076
|
+
* Max collateral (native units) withdrawable from an LP without a prior DCP.
|
|
2077
|
+
*
|
|
2078
|
+
* TopUpUnlentReserves re-checks `is_utilization_rate_at_or_below_target`
|
|
2079
|
+
* AFTER the withdrawal (util <= target + target * threshold / 10_000), and
|
|
2080
|
+
* utilization scales as `util_after = util * collateral / (collateral - w)`
|
|
2081
|
+
* when debt and prices stay constant (mirrors on-chain
|
|
2082
|
+
* `simulate_utilization_rate_bps_after_collateral_withdraw`). Inverting
|
|
2083
|
+
* against the upper bound gives:
|
|
2084
|
+
* w_max = collateral * (limit - util) / limit
|
|
2085
|
+
*/
|
|
2086
|
+
private maxDirectWithdrawal;
|
|
2087
|
+
/**
|
|
2088
|
+
* Executes a single DCP on one lending position with retry logic. Uses full
|
|
2089
|
+
* unwind (target utilization 0) when the deficit exceeds the LP's collateral,
|
|
2090
|
+
* otherwise uses `collateralWithdrawal` steering.
|
|
2091
|
+
*/
|
|
2092
|
+
private dcpSingleLp;
|
|
2093
|
+
/**
|
|
2094
|
+
* Withdraws collateral from lending positions into unlent reserves, crediting
|
|
2095
|
+
* the redemption epoch. Stops as soon as the epoch is fully funded.
|
|
2096
|
+
*/
|
|
2097
|
+
private withdrawFromLps;
|
|
2098
|
+
private isFullyFunded;
|
|
2099
|
+
private deficitUi;
|
|
2100
|
+
private fundResult;
|
|
2101
|
+
private resolveYieldingBanks;
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
/** Skip dust Kamino slots when a material position exists on the same token. */
|
|
2105
|
+
declare const MIN_MATERIAL_KAMINO_COLLATERAL_USD = 1;
|
|
2106
|
+
interface LendingPositionInspectMetricSnapshot {
|
|
2107
|
+
utilizationRealtimeBps: number;
|
|
2108
|
+
utilizationEmaBps: number;
|
|
2109
|
+
lowerTriggerPriceChangePct?: number;
|
|
2110
|
+
upperTriggerPriceChangePct?: number;
|
|
2111
|
+
}
|
|
2112
|
+
interface YieldingBankExternalPositionMetricSnapshot {
|
|
2113
|
+
platform: LendingPlatform;
|
|
2114
|
+
pool: Address;
|
|
2115
|
+
tvlUsdRaw: string;
|
|
2116
|
+
tvlUsd: number;
|
|
2117
|
+
}
|
|
2118
|
+
type ProtocolMetricEntityType = "token" | "yielding_bank" | "yielding_bank_asset" | "kamino_position_rate" | "token_lending_position" | "token_carry_position" | "fee_wallet_balance" | "protocol_manifest";
|
|
2119
|
+
/**
|
|
2120
|
+
* Balance held by the protocol fee wallet for one mint. Performance fees
|
|
2121
|
+
* arrive here as collateral at `collect_interest` time (no pending counter
|
|
2122
|
+
* exists on the token), and mint/burn fees arrive as yTokens via
|
|
2123
|
+
* `collect_fees` — so these balances are the only on-chain record of
|
|
2124
|
+
* cumulative collected fees.
|
|
2125
|
+
*/
|
|
2126
|
+
interface FeeWalletBalanceMetricSnapshot {
|
|
2127
|
+
entityType: "fee_wallet_balance";
|
|
2128
|
+
wallet: Address;
|
|
2129
|
+
mint: Address;
|
|
2130
|
+
symbol: string;
|
|
2131
|
+
/** "collateral" = performance fees; "ytoken" = collected mint/burn fees. */
|
|
2132
|
+
kind: "collateral" | "ytoken";
|
|
2133
|
+
decimals: number;
|
|
2134
|
+
amountRaw: string;
|
|
2135
|
+
amountUi: number;
|
|
2136
|
+
priceUsd: number;
|
|
2137
|
+
valueUsd: number;
|
|
2138
|
+
}
|
|
2139
|
+
/** Index of entity keys written for a single ingestion hour (enables API assembly). */
|
|
2140
|
+
interface ProtocolManifestSnapshot {
|
|
2141
|
+
entityType: "protocol_manifest";
|
|
2142
|
+
tokenMints: Address[];
|
|
2143
|
+
bankAddresses: Address[];
|
|
2144
|
+
kaminoPositions: Array<{
|
|
2145
|
+
mint: Address;
|
|
2146
|
+
lendingPositionIndex: number;
|
|
2147
|
+
}>;
|
|
2148
|
+
yieldingBankAssets: Array<{
|
|
2149
|
+
bank: Address;
|
|
2150
|
+
mint: Address;
|
|
2151
|
+
}>;
|
|
2152
|
+
/** Present on manifests written after Phase 2 ingestion deploy. */
|
|
2153
|
+
tokenLendingPositions?: Array<{
|
|
2154
|
+
mint: Address;
|
|
2155
|
+
lendingPositionIndex: number;
|
|
2156
|
+
}>;
|
|
2157
|
+
/** Present on manifests written after Phase 2 ingestion deploy. */
|
|
2158
|
+
tokenCarryPositions?: Array<{
|
|
2159
|
+
mint: Address;
|
|
2160
|
+
carryPositionIndex: number;
|
|
2161
|
+
}>;
|
|
2162
|
+
/** Present on manifests written after fee-wallet tracking deploy. */
|
|
2163
|
+
feeWalletBalances?: Array<{
|
|
2164
|
+
wallet: Address;
|
|
2165
|
+
mint: Address;
|
|
2166
|
+
}>;
|
|
2167
|
+
/**
|
|
2168
|
+
* Per-row build failures from this ingestion hour (skipped Kamino rate rows,
|
|
2169
|
+
* failed inspect enrichment). Persisted so the ops dashboard can surface
|
|
2170
|
+
* partial snapshots instead of silently dropping rows.
|
|
2171
|
+
*/
|
|
2172
|
+
errors?: ProtocolMetricsSnapshotError[];
|
|
2173
|
+
}
|
|
2174
|
+
declare const PROTOCOL_MANIFEST_PK = "protocol_manifest";
|
|
2175
|
+
interface TokenMetricSnapshot {
|
|
2176
|
+
entityType: "token";
|
|
2177
|
+
token: Address;
|
|
2178
|
+
mint: Address;
|
|
2179
|
+
collateralMint: Address;
|
|
2180
|
+
isActive: boolean;
|
|
2181
|
+
priceCollateral: number;
|
|
2182
|
+
collateralPriceUsd: number;
|
|
2183
|
+
priceUsd: number;
|
|
2184
|
+
totalSupply: number;
|
|
2185
|
+
tvlUsdRaw: string;
|
|
2186
|
+
tvlUsd: number;
|
|
2187
|
+
carryTvlUsdRaw: string;
|
|
2188
|
+
carryTvlUsd: number;
|
|
2189
|
+
debtUsdRaw: string;
|
|
2190
|
+
debtUsd: number;
|
|
2191
|
+
netYieldUsdRaw: string;
|
|
2192
|
+
netYieldUsd: number;
|
|
2193
|
+
pendingProtocolFeesRaw: string;
|
|
2194
|
+
pendingProtocolFeesUi: number;
|
|
2195
|
+
pendingCuratorFeesRaw: string;
|
|
2196
|
+
pendingCuratorFeesUi: number;
|
|
2197
|
+
performanceFeeBps: number;
|
|
2198
|
+
mintingFeeBps: number;
|
|
2199
|
+
burningFeeBps: number;
|
|
2200
|
+
protocolMintBurnPctBps: number;
|
|
2201
|
+
curatorMintBurnPctBps: number;
|
|
2202
|
+
curatorPerfPctBps: number;
|
|
2203
|
+
/** Absent on snapshots ingested before fee-drip projection metrics were added. */
|
|
2204
|
+
feeDripMaxApyBps?: number;
|
|
2205
|
+
feeDripCurrentApyBps?: number | null;
|
|
2206
|
+
undrippedFeeCollateralUi?: number;
|
|
2207
|
+
feeDripAbsorptionEtaSeconds?: number | null;
|
|
2208
|
+
feeDripAbsorptionStatus?: FeeDripAbsorptionStatus;
|
|
2209
|
+
firstMintTs: number;
|
|
2210
|
+
collateralOracle: Address;
|
|
2211
|
+
collateralLastRefreshedTs: number;
|
|
2212
|
+
unlentCollateralUi: number;
|
|
2213
|
+
lastRefreshedTs: number;
|
|
2214
|
+
}
|
|
2215
|
+
interface YieldingBankMetricSnapshot {
|
|
2216
|
+
entityType: "yielding_bank";
|
|
2217
|
+
bank: Address;
|
|
2218
|
+
id: number;
|
|
2219
|
+
baseMint: Address;
|
|
2220
|
+
isActive: boolean;
|
|
2221
|
+
sharePriceRaw: string;
|
|
2222
|
+
sharePriceUsd: number;
|
|
2223
|
+
totalSharesRaw: string;
|
|
2224
|
+
totalShares: number;
|
|
2225
|
+
tvlUsdRaw: string;
|
|
2226
|
+
tvlUsd: number;
|
|
2227
|
+
baseSymbol: string;
|
|
2228
|
+
curator: Address;
|
|
2229
|
+
circuitBreaker: number;
|
|
2230
|
+
defaultRedemptionMint?: Address;
|
|
2231
|
+
externalYieldingPositions: YieldingBankExternalPositionMetricSnapshot[];
|
|
2232
|
+
lastRefreshedTs: number;
|
|
2233
|
+
lastRebalancedTs: number;
|
|
2234
|
+
}
|
|
2235
|
+
interface YieldingBankAssetMetricSnapshot {
|
|
2236
|
+
entityType: "yielding_bank_asset";
|
|
2237
|
+
bank: Address;
|
|
2238
|
+
assetIndex: number;
|
|
2239
|
+
assetKind: "base" | "asset";
|
|
2240
|
+
mint: Address;
|
|
2241
|
+
amountRaw: string;
|
|
2242
|
+
amountUi: number;
|
|
2243
|
+
decimals: number;
|
|
2244
|
+
priceRaw: string;
|
|
2245
|
+
priceUsd: number;
|
|
2246
|
+
tvlUsdRaw: string;
|
|
2247
|
+
tvlUsd: number;
|
|
2248
|
+
}
|
|
2249
|
+
interface TokenLendingPositionMetricSnapshot {
|
|
2250
|
+
entityType: "token_lending_position";
|
|
2251
|
+
token: Address;
|
|
2252
|
+
mint: Address;
|
|
2253
|
+
lendingPositionIndex: number;
|
|
2254
|
+
platform: LendingPlatform;
|
|
2255
|
+
withdrawPending: boolean;
|
|
2256
|
+
pool: Address;
|
|
2257
|
+
userAccount: Address;
|
|
2258
|
+
collateralAmountRaw: string;
|
|
2259
|
+
collateralAmountUi: number;
|
|
2260
|
+
collateralSymbol: string;
|
|
2261
|
+
collateralUsd: number;
|
|
2262
|
+
debtAmountRaw: string;
|
|
2263
|
+
debtAmountUi: number;
|
|
2264
|
+
debtTvlUsdRaw: string;
|
|
2265
|
+
debtTvlUsd: number;
|
|
2266
|
+
debtMint: Address;
|
|
2267
|
+
debtSymbol: string;
|
|
2268
|
+
debtPriceUsd: number;
|
|
2269
|
+
onChainUtilizationRateBps: number;
|
|
2270
|
+
targetUtilizationRateBps: number;
|
|
2271
|
+
maxDeviationAboveTargetUtilBps: number;
|
|
2272
|
+
maxDeviationBelowTargetUtilBps: number;
|
|
2273
|
+
inspect?: LendingPositionInspectMetricSnapshot;
|
|
2274
|
+
}
|
|
2275
|
+
interface TokenCarryPositionMetricSnapshot {
|
|
2276
|
+
entityType: "token_carry_position";
|
|
2277
|
+
token: Address;
|
|
2278
|
+
mint: Address;
|
|
2279
|
+
carryPositionIndex: number;
|
|
2280
|
+
yieldingBankId: number;
|
|
2281
|
+
yieldingBankAddress?: Address;
|
|
2282
|
+
baseMint: Address;
|
|
2283
|
+
baseSymbol: string;
|
|
2284
|
+
sharesRaw: string;
|
|
2285
|
+
sharesUi?: number;
|
|
2286
|
+
tvlUsdRaw: string;
|
|
2287
|
+
tvlUsd: number;
|
|
2288
|
+
}
|
|
2289
|
+
interface KaminoPositionRateSnapshot {
|
|
2290
|
+
entityType: "kamino_position_rate";
|
|
2291
|
+
token: Address;
|
|
2292
|
+
mint: Address;
|
|
2293
|
+
lendingPositionIndex: number;
|
|
2294
|
+
pool: Address;
|
|
2295
|
+
userAccount: Address;
|
|
2296
|
+
collateralReserve: Address;
|
|
2297
|
+
debtReserve: Address;
|
|
2298
|
+
collateralMint: Address;
|
|
2299
|
+
debtMint: Address;
|
|
2300
|
+
supplyBaseApy: number;
|
|
2301
|
+
borrowBaseApy: number;
|
|
2302
|
+
supplyEffectiveApy: number;
|
|
2303
|
+
borrowEffectiveApy: number;
|
|
2304
|
+
netEffectiveApy: number;
|
|
2305
|
+
collateralReserveUtilizationPct: number;
|
|
2306
|
+
debtReserveUtilizationPct: number;
|
|
2307
|
+
onChainLtvUtilizationBps: number;
|
|
2308
|
+
targetUtilizationRateBps: number;
|
|
2309
|
+
maxDeviationAboveTargetUtilBps: number;
|
|
2310
|
+
maxDeviationBelowTargetUtilBps: number;
|
|
2311
|
+
}
|
|
2312
|
+
type ProtocolMetricSnapshotRow = TokenMetricSnapshot | YieldingBankMetricSnapshot | YieldingBankAssetMetricSnapshot | KaminoPositionRateSnapshot | TokenLendingPositionMetricSnapshot | TokenCarryPositionMetricSnapshot | FeeWalletBalanceMetricSnapshot | ProtocolManifestSnapshot;
|
|
2313
|
+
interface ProtocolMetricsSnapshot {
|
|
2314
|
+
timestamp: number;
|
|
2315
|
+
tokens: TokenMetricSnapshot[];
|
|
2316
|
+
yieldingBanks: YieldingBankMetricSnapshot[];
|
|
2317
|
+
yieldingBankAssets: YieldingBankAssetMetricSnapshot[];
|
|
2318
|
+
kaminoPositionRates: KaminoPositionRateSnapshot[];
|
|
2319
|
+
tokenLendingPositions: TokenLendingPositionMetricSnapshot[];
|
|
2320
|
+
tokenCarryPositions: TokenCarryPositionMetricSnapshot[];
|
|
2321
|
+
feeWalletBalances: FeeWalletBalanceMetricSnapshot[];
|
|
2322
|
+
errors: ProtocolMetricsSnapshotError[];
|
|
2323
|
+
}
|
|
2324
|
+
interface ProtocolMetricsSnapshotError {
|
|
2325
|
+
scope: "kamino_position_rate" | "lending_position_inspect";
|
|
2326
|
+
token: Address;
|
|
2327
|
+
lendingPositionIndex: number;
|
|
2328
|
+
message: string;
|
|
2329
|
+
}
|
|
2330
|
+
interface BuildProtocolMetricsSnapshotOptions {
|
|
2331
|
+
timestamp?: number;
|
|
2332
|
+
includeInactive?: boolean;
|
|
2333
|
+
tokens?: LYCToken[];
|
|
2334
|
+
yieldingBanks?: LYCYieldingBank[];
|
|
2335
|
+
}
|
|
2336
|
+
declare function protocolMetricPartitionKey(metric: ProtocolMetricSnapshotRow): string;
|
|
2337
|
+
declare function buildProtocolManifestSnapshot(snapshot: ProtocolMetricsSnapshot): ProtocolManifestSnapshot;
|
|
2338
|
+
declare function flattenProtocolMetricsSnapshot(snapshot: ProtocolMetricsSnapshot): ProtocolMetricSnapshotRow[];
|
|
2339
|
+
/** Dynamo item shape written by {@link buildProtocolMetricDynamoItems}. */
|
|
2340
|
+
interface ProtocolMetricDynamoItem {
|
|
2341
|
+
pk: string;
|
|
2342
|
+
timestamp: number;
|
|
2343
|
+
entityType: ProtocolMetricEntityType;
|
|
2344
|
+
metrics: ProtocolMetricSnapshotRow;
|
|
2345
|
+
ttl?: number;
|
|
2346
|
+
}
|
|
2347
|
+
declare function toProtocolMetricDynamoItem(metric: ProtocolMetricSnapshotRow, hourTimestamp: number, ttl?: number): ProtocolMetricDynamoItem;
|
|
2348
|
+
interface BuildProtocolMetricDynamoItemsOptions extends BuildProtocolMetricsSnapshotOptions {
|
|
2349
|
+
hourTimestamp: number;
|
|
2350
|
+
ttl?: number;
|
|
2351
|
+
}
|
|
2352
|
+
interface BuildProtocolMetricDynamoItemsResult {
|
|
2353
|
+
items: ProtocolMetricDynamoItem[];
|
|
2354
|
+
errors: ProtocolMetricsSnapshotError[];
|
|
2355
|
+
}
|
|
2356
|
+
/** Builds on-chain snapshot rows and maps them to Dynamo put payloads. */
|
|
2357
|
+
declare function buildProtocolMetricDynamoItems(client: LongYieldCarryClient, opts: BuildProtocolMetricDynamoItemsOptions): Promise<BuildProtocolMetricDynamoItemsResult>;
|
|
2358
|
+
declare function buildProtocolMetricsSnapshot(client: LongYieldCarryClient, opts?: BuildProtocolMetricsSnapshotOptions): Promise<ProtocolMetricsSnapshot>;
|
|
2359
|
+
declare function buildFeeWalletBalanceSnapshots(client: LongYieldCarryClient, tokens: LYCToken[]): Promise<FeeWalletBalanceMetricSnapshot[]>;
|
|
2360
|
+
declare function buildTokenMetricSnapshot(token: LYCToken, yieldingBanks?: LYCYieldingBank[], nowTs?: number): TokenMetricSnapshot;
|
|
2361
|
+
declare function buildYieldingBankMetricSnapshot(bank: LYCYieldingBank): YieldingBankMetricSnapshot;
|
|
2362
|
+
declare function buildTokenLendingPositionMetricSnapshots(token: LYCToken, yieldingBanks?: LYCYieldingBank[]): TokenLendingPositionMetricSnapshot[];
|
|
2363
|
+
declare function buildTokenLendingPositionMetricSnapshotsAsync(client: LongYieldCarryClient, token: LYCToken, yieldingBanks?: LYCYieldingBank[]): Promise<{
|
|
2364
|
+
snapshots: TokenLendingPositionMetricSnapshot[];
|
|
2365
|
+
errors: ProtocolMetricsSnapshotError[];
|
|
2366
|
+
}>;
|
|
2367
|
+
declare function serializeLendingPositionInspectMetrics(metrics: LendingPositionInspectMetrics | null | undefined): LendingPositionInspectMetricSnapshot | undefined;
|
|
2368
|
+
declare function kaminoCollateralUsd(token: LYCToken, position: TokenLendingPositionData): number;
|
|
2369
|
+
declare function shouldIncludeKaminoPositionRate(collateralUsd: number, maxCollateralUsdOnToken: number): boolean;
|
|
2370
|
+
declare function buildTokenCarryPositionMetricSnapshots(token: LYCToken, yieldingBanks: LYCYieldingBank[]): TokenCarryPositionMetricSnapshot[];
|
|
2371
|
+
declare function buildYieldingBankAssetMetricSnapshots(bank: LYCYieldingBank): YieldingBankAssetMetricSnapshot[];
|
|
2372
|
+
declare function buildKaminoPositionRateSnapshotFromReserves(token: LYCToken, lendingPositionIndex: number, position: TokenLendingPositionData, collateralReserve: ReserveBase, debtReserve: ReserveBase): KaminoPositionRateSnapshot;
|
|
2373
|
+
|
|
2374
|
+
/** User-facing LYC transaction kinds we index. */
|
|
2375
|
+
type LycTransactionType = "mint" | "burn";
|
|
2376
|
+
/**
|
|
2377
|
+
* A single normalized LYC transaction event produced from a raw tx payload.
|
|
2378
|
+
*
|
|
2379
|
+
* A single Solana transaction can contain multiple top-level LYC instructions
|
|
2380
|
+
* (e.g. `refresh_yielding_bank` + `decrease_carry_position` + `burn_token`),
|
|
2381
|
+
* but only user-facing ones (`mint_token`, `burn_token`) surface here. Other
|
|
2382
|
+
* LYC instructions in the same tx are infrastructure and are not indexed as
|
|
2383
|
+
* user events.
|
|
2384
|
+
*/
|
|
2385
|
+
interface LycTransactionEvent {
|
|
2386
|
+
/** Solana transaction signature. */
|
|
2387
|
+
signature: string;
|
|
2388
|
+
/** Solana slot the tx was included in. */
|
|
2389
|
+
slot: number;
|
|
2390
|
+
/** Block time (unix seconds). */
|
|
2391
|
+
blockTime: number;
|
|
2392
|
+
/** Classified instruction kind. */
|
|
2393
|
+
type: LycTransactionType;
|
|
2394
|
+
/** User wallet: the tx signer for mint/burn (fee payer index 0). */
|
|
2395
|
+
wallet: string;
|
|
2396
|
+
/** Token mint minted into / burned from the user's token ATA. */
|
|
2397
|
+
tokenMint: string;
|
|
2398
|
+
/**
|
|
2399
|
+
* Token base-unit amount.
|
|
2400
|
+
* - `mint`: minted to the user (positive).
|
|
2401
|
+
* - `burn`: burned from the user (positive).
|
|
2402
|
+
*/
|
|
2403
|
+
tokenAmountBaseUnits: string;
|
|
2404
|
+
/** Underlying collateral mint (e.g. wSOL when collateral is SOL). */
|
|
2405
|
+
collateralMint: string;
|
|
2406
|
+
/**
|
|
2407
|
+
* Collateral base-unit amount moved to/from the user:
|
|
2408
|
+
* - `mint`: collateral deposited by the user.
|
|
2409
|
+
* - `burn`: collateral paid out to the user (net of fees).
|
|
2410
|
+
*/
|
|
2411
|
+
collateralAmountBaseUnits: string;
|
|
2412
|
+
/** Transaction fee in lamports paid by the signer. */
|
|
2413
|
+
fee: number;
|
|
2414
|
+
}
|
|
2415
|
+
/**
|
|
2416
|
+
* One LYC-program-related transaction we ingested and queued for indexing.
|
|
2417
|
+
*
|
|
2418
|
+
* `payload` is the raw Solana transaction object (slot, meta, transaction,
|
|
2419
|
+
* version, etc.) — the same shape you get from `getTransaction` / streamed
|
|
2420
|
+
* commitment updates. `source` discriminates this envelope from other queue
|
|
2421
|
+
* producers if we add them later.
|
|
2422
|
+
*/
|
|
2423
|
+
interface LycProgramTransactionRecord {
|
|
2424
|
+
source: "lyc-program-transaction";
|
|
2425
|
+
/** Unix seconds when our API accepted and wrapped the payload. */
|
|
2426
|
+
receivedAt: number;
|
|
2427
|
+
signature: string;
|
|
2428
|
+
slot?: number;
|
|
2429
|
+
/** Raw Solana tx + meta (RPC / stream shape). */
|
|
2430
|
+
payload: unknown;
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
/**
|
|
2434
|
+
* Decoder: streamed Solana transaction payloads → normalized LYC user events.
|
|
2435
|
+
*
|
|
2436
|
+
* Wire shape is validator-style `getTransaction` data wrapped by the API into
|
|
2437
|
+
* {@link LycProgramTransactionRecord} when enqueued. Downstream consumers (the
|
|
2438
|
+
* indexer Lambda, backfill jobs) validate the envelope with
|
|
2439
|
+
* {@link parseLycProgramTransactionRecord} then call
|
|
2440
|
+
* {@link decodeLycProgramTransaction} to produce zero or more user-facing
|
|
2441
|
+
* {@link LycTransactionEvent}s.
|
|
2442
|
+
*
|
|
2443
|
+
* The set of indexed instructions is currently `mint_token` and `burn_token`.
|
|
2444
|
+
* Both are inlined in this module — if we ever add a third, promote back to a
|
|
2445
|
+
* registry/interface pattern.
|
|
2446
|
+
*/
|
|
2447
|
+
|
|
2448
|
+
/**
|
|
2449
|
+
* Validate and narrow an arbitrary JSON body (SQS message body / API request)
|
|
2450
|
+
* to {@link LycProgramTransactionRecord}. Returns `null` on any shape mismatch.
|
|
2451
|
+
*/
|
|
2452
|
+
declare function parseLycProgramTransactionRecord(input: unknown): LycProgramTransactionRecord | null;
|
|
2453
|
+
/**
|
|
2454
|
+
* Stable enum of why a matched-discriminator instruction produced no event.
|
|
2455
|
+
* All reasons are CPI-driven; none depend on balance deltas.
|
|
2456
|
+
*/
|
|
2457
|
+
type DecoderRejectionReason = "accounts_too_short" | "missing_key" | "no_inner_instructions_block" | "no_token_burn_cpi" | "no_token_mint_to_cpi" | "no_collateral_out_delta" | "no_collateral_in_delta";
|
|
2458
|
+
/**
|
|
2459
|
+
* One reason a tx produced zero events despite looking like something we index.
|
|
2460
|
+
*
|
|
2461
|
+
* - `payload_unparseable`: the envelope `payload` lacked `meta` / `transaction.message` and
|
|
2462
|
+
* we couldn't even enumerate instructions.
|
|
2463
|
+
* - `instruction_data_invalid`: an LYC-program instruction's `data` field wasn't valid
|
|
2464
|
+
* base58 so we couldn't read its discriminator.
|
|
2465
|
+
* - `decoder_rejected`: the discriminator matched a user-facing decoder but a guard rail
|
|
2466
|
+
* returned null — `reason` identifies which guard.
|
|
2467
|
+
*/
|
|
2468
|
+
type DecodeRejection = {
|
|
2469
|
+
kind: "payload_unparseable";
|
|
2470
|
+
} | {
|
|
2471
|
+
kind: "instruction_data_invalid";
|
|
2472
|
+
instructionIndex: number;
|
|
2473
|
+
} | {
|
|
2474
|
+
kind: "decoder_rejected";
|
|
2475
|
+
name: "mint_token" | "burn_token";
|
|
2476
|
+
reason: DecoderRejectionReason;
|
|
2477
|
+
};
|
|
2478
|
+
interface DecodeResult {
|
|
2479
|
+
events: LycTransactionEvent[];
|
|
2480
|
+
/**
|
|
2481
|
+
* Non-empty only when something anomalous happened. Consumers that want to
|
|
2482
|
+
* distinguish "refresh-only tx, nothing to do" from "tried and bailed" check
|
|
2483
|
+
* `rejections.length === 0` for the former and `rejections.length > 0` for
|
|
2484
|
+
* the latter.
|
|
2485
|
+
*/
|
|
2486
|
+
rejections: DecodeRejection[];
|
|
2487
|
+
}
|
|
2488
|
+
/**
|
|
2489
|
+
* Decode one queued tx into zero or more user-facing events, in top-level
|
|
2490
|
+
* instruction order. Silently skips instructions we don't index or whose data
|
|
2491
|
+
* cannot be base58-decoded.
|
|
2492
|
+
*/
|
|
2493
|
+
declare function decodeLycProgramTransaction(record: LycProgramTransactionRecord): LycTransactionEvent[];
|
|
2494
|
+
/**
|
|
2495
|
+
* Same as {@link decodeLycProgramTransaction} but also returns structured
|
|
2496
|
+
* rejections for the indexer's CloudWatch log path. Use this when "zero events"
|
|
2497
|
+
* isn't enough information — e.g. you need to know whether a burn-shaped tx
|
|
2498
|
+
* bailed because its inner-instructions block was missing or because no
|
|
2499
|
+
* collateral transfer CPI landed in the user's ATA.
|
|
2500
|
+
*/
|
|
2501
|
+
declare function decodeLycProgramTransactionWithDiagnostics(record: LycProgramTransactionRecord): DecodeResult;
|
|
2502
|
+
|
|
2503
|
+
/**
|
|
2504
|
+
* Top-level instructions that invoke the LYC program, in tx order.
|
|
2505
|
+
* Returns `null` if the payload can't be parsed (missing meta/message).
|
|
2506
|
+
*/
|
|
2507
|
+
declare function listLycTopLevelInstructionNames(record: LycProgramTransactionRecord): string[] | null;
|
|
2508
|
+
|
|
2509
|
+
/**
|
|
2510
|
+
* IDL-backed account resolution for the LYC decoder.
|
|
2511
|
+
*
|
|
2512
|
+
* The decoder reads specific accounts (wallet, mint, collateral mint, user
|
|
2513
|
+
* ATAs) out of each indexed instruction's account list. Rather than hardcoding
|
|
2514
|
+
* positional indices — which silently break if the on-chain
|
|
2515
|
+
* `#[derive(Accounts)]` struct is ever reordered — we resolve positions by
|
|
2516
|
+
* account name off the SDK's shipped IDL at module load.
|
|
2517
|
+
*
|
|
2518
|
+
* Guarantees:
|
|
2519
|
+
* - **Resilient to reordering.** If the Rust program reorders accounts, the
|
|
2520
|
+
* regenerated IDL updates the name→index map and the decoder follows.
|
|
2521
|
+
* - **Fail-fast on rename/removal.** If an account we depend on is renamed
|
|
2522
|
+
* or removed, this module throws at import time — the SDK fails to load
|
|
2523
|
+
* instead of producing mislabeled events.
|
|
2524
|
+
* - **Minimal surface.** Only pins the accounts the decoder actually reads
|
|
2525
|
+
* (`signer`, `mint`, `collateral_mint`, `user_token_account`,
|
|
2526
|
+
* `user_collateral_account`). Unused accounts can be renamed freely.
|
|
2527
|
+
*/
|
|
2528
|
+
declare const MINT_TOKEN_REQUIRED_ACCOUNT_NAMES: readonly ["signer", "mint", "collateral_mint", "user_collateral_account", "user_token_account"];
|
|
2529
|
+
declare const BURN_TOKEN_REQUIRED_ACCOUNT_NAMES: readonly ["signer", "mint", "user_token_account", "user_collateral_account"];
|
|
2530
|
+
type MintTokenAccountName = (typeof MINT_TOKEN_REQUIRED_ACCOUNT_NAMES)[number];
|
|
2531
|
+
type BurnTokenAccountName = (typeof BURN_TOKEN_REQUIRED_ACCOUNT_NAMES)[number];
|
|
2532
|
+
/** Name→index map for the accounts list of `mint_token`. */
|
|
2533
|
+
declare const MINT_TOKEN_ACCOUNTS: Readonly<Record<"signer" | "mint" | "user_token_account" | "collateral_mint" | "user_collateral_account", number>>;
|
|
2534
|
+
/** Name→index map for the accounts list of `burn_token`. */
|
|
2535
|
+
declare const BURN_TOKEN_ACCOUNTS: Readonly<Record<"signer" | "mint" | "user_token_account" | "user_collateral_account", number>>;
|
|
2536
|
+
|
|
2537
|
+
export { ASSET_PRESETS, AllocationService, type AllocationServiceOptions, type AllocationStrategy, type AllocationTarget, type AllocationTimelockKind, type AllocationTimelockStatus, type AssetPresetEntry, BTC_CARRY_PRESETS, BURN_TOKEN_ACCOUNTS, BURN_TOKEN_REQUIRED_ACCOUNT_NAMES, type BuildLendingPositionAllocationArgs, type BuildProtocolMetricDynamoItemsOptions, type BuildProtocolMetricDynamoItemsResult, type BuildProtocolMetricsSnapshotOptions, BurnAmounts, type BurnTokenAccountName, BurnTokenBuilder, type CarryLendingAllocationConfig, type CarryPriceBandPreset, type CarryVolatilityPresets, ClaimIncentivesBuilder, type CollateralPriceTriggerBand, type CollateralPriceTriggerLevel, CollectFeesBuilder, CollectInterestBuilder, type CollectInterestBuilderParams, type CollectInterestExecutionPlan, type CollectInterestHoldingPlan, type CollectInterestPlan, type CollectInterestPlanParams, type CollectInterestRouteBuilderParams, type CollectInterestTxPlanParams, type CompositeTransactionPlan, type ComputeCarryLendingAllocationConfigParams, type ComputeConfigForCollateralArgs, CreateCpiPlanBuilder, CreateTokenBuilder, CreateTokenLendingPositionAccounts, CreateTokenLendingPositionBuilder, CreateTokenLendingPositionParams, CreateYieldingBankAllocationBuilder, CreateYieldingBankBuilder, CreditUnlentToRedemptionEpochBuilder, type DebtAllocationTarget, type DebtReallocation, type DecodeRejection, type DecodeResult, type DecoderRejectionReason, type DecreaseCarryPositionBuildTxOptions, DecreaseCarryPositionBuilder, DecreaseCarryPositionBuilderParams, DecreaseCarryPositionPlan, DecreaseCarryPositionTxBuilderParams, DecreaseCarryPositionTxParams, DepositUnlentCollateralBuilder, ETH_CARRY_PRESETS, type EnrichedTokenCarryPosition, type EnrichedTokenCarrySummary, type EnrichedTokenCollateralSnapshot, type EnrichedTokenFeesSnapshot, type EnrichedTokenLendingPosition, type EnrichedTokenSnapshot, type EnrichedYieldingBankExternalPosition, type EnrichedYieldingBankHolding, type EnrichedYieldingBankSnapshot, type EnsureInitialKaminoLendingPositionOptions, type EvenDepositAllocation, type FeeDripAbsorptionStatus, type FeeDripMetrics, type FeeDripMetricsInput, type FeeWalletBalanceMetricSnapshot, type FundRedemptionEpochResult, type GetAvailableTokenLendingUserAccountIdArgs, INVALID_UTILIZATION_RATE_CONDITION_CODE, IncreaseCarryPositionBuilder, IndexedLendingPosition, type KaminoPositionRateSnapshot, LARGE_CAP_ALT_CARRY_PRESETS, LST_CARRY_PRESETS, LYCToken, LYCYieldingBank, LendingPlatformClientRegistry, type LendingPlatformResolver, type LendingPositionAllocation, LendingPositionBootstrapError, type LendingPositionInspectMetricSnapshot, type LendingPositionInspectMetrics, type LendingPositionSelectedPrice, LendingPositionService, type LendingPositionUtilizationPrices, type LendingPositionUtilizationRatesBps, LongYieldCarryBuilderContext, LongYieldCarryClient, type LongYieldCarryClientOptions, LongYieldCarryTransactionPlan, LycLendingPositionManager, type LycProgramTransactionRecord, type LycTransactionEvent, type LycTransactionType, MAX_LENDING_POSITION_UPPER_UTIL_BPS, MAX_TARGET_UTILIZATION_RATE_BPS, MINT_TOKEN_ACCOUNTS, MINT_TOKEN_REQUIRED_ACCOUNT_NAMES, MIN_DEVIATION_ABOVE_TARGET_UTIL_BPS, MIN_MATERIAL_KAMINO_COLLATERAL_USD, type MintTokenAccountName, MintTokenBuilder, NoInterestToCollectError, NoOpTransactionError, PROTOCOL_MANIFEST_PK, PricedMint, ProcessAsyncBurnBuilder, type ProcessEpochResult, type ProtocolManifestSnapshot, type ProtocolMetricDynamoItem, type ProtocolMetricEntityType, type ProtocolMetricSnapshotRow, type ProtocolMetricsSnapshot, type ProtocolMetricsSnapshotError, type RebalancePlanResult, RebalancePlanner, RebalanceSwapSpec, RebalanceTokenBuilder, RebalanceYieldingBankBuilder, RecollateralizeLossBuilder, RedemptionEpochSnapshot, type RedemptionFundingErrors, type RedemptionFundingFailure, RedemptionService, type RedemptionServiceOptions, RefreshTokenStateBuilder, RefreshTokensBuilder, RefreshYieldingBankBuilder, ResetTokenBurnRateLimitBuilder, type ResolvedDecreaseCarryCpiPlan, SMALL_CAP_ALT_CARRY_PRESETS, SOL_CARRY_PRESETS, STOCK_INDEX_PRESETS, SetRedemptionEpochStatusBuilder, SetTokenCircuitBreakerBuilder, SetYieldingBankCircuitBreakerBuilder, SimpleUsdStarStrategy, SingleCpiExecutionPlan, type StructuredRedemptionLog, SupportedLendingPlatformClients, type TargetAllocation, type TimelockKind, type TimelockOptions, type TimelockStatus, type TokenCarryPositionMetricSnapshot, type TokenInspectSnapshotArgs, TokenLendingPositionData, type TokenLendingPositionMetricSnapshot, type TokenMetricSnapshot, TokenRebalanceService, type TokenRebalanceServiceOptions, TopUpUnlentReservesBuilder, type TransactionBuilder, TransactionClient, UpdateLendingPositionConfigBuilder, UpdateTokenConfigurationBuilder, UpdateTokenMetadataBuilder, UpdateYieldingBankConfigBuilder, VOLATILITY_REGIMES, type VolatilityRegime, YieldingBankAllocationConfig, type YieldingBankAssetMetricSnapshot, YieldingBankExternalLiquiditySource, type YieldingBankExternalPositionMetricSnapshot, type YieldingBankInspectSnapshotArgs, type YieldingBankMetricSnapshot, type YieldingBankRebalancePlan, allocationTimelocksEnabled, amountToTvl, assertCollectInterestPlanHasPositiveRedemptions, buildCarryTradeAccountMetas, buildCollectInterestPlan, buildDecreaseCarryPositionPlan, buildFeeWalletBalanceSnapshots, buildKaminoPositionRateSnapshotFromReserves, buildLendingPositionAllocation, buildProtocolManifestSnapshot, buildProtocolMetricDynamoItems, buildProtocolMetricsSnapshot, buildRebalanceTokenInitialAccounts, buildTokenCarryPositionMetricSnapshots, buildTokenInspectSnapshot, buildTokenLendingPositionMetricSnapshots, buildTokenLendingPositionMetricSnapshotsAsync, buildTokenMetricSnapshot, buildYieldingBankAssetMetricSnapshots, buildYieldingBankInspectSnapshot, buildYieldingBankMetricSnapshot, calculateFeeDripMetrics, clampLendingPositionConfigBps, collectableNetYieldUsd, composePhasedTransactionPlan, computeBurnAmountsForFrontendEstimate, computeCarryLendingAllocationConfig, computeConfigForCollateral, computeEvenDepositAllocation, createYTokenMint, currentEpochId, decodeLycProgramTransaction, decodeLycProgramTransactionWithDiagnostics, extractLycErrorCode, findBestYieldingBankForBurn, findFreeTokenId, findFreeYieldingBankId, findPositionToUnwindForBurn, firstActiveLendingIndex, flattenProtocolMetricsSnapshot, formatTransactionError, getAllocationTimelockStatus, getAvailableTokenLendingUserAccountId, getBurnCollateralWithdrawalAmount, getBurnCollateralWithdrawalUiAmount, getLookupTableForToken, getRefreshTokenInstructionsIfStale, getTimelockStatus, getTokenCacheInvalidation, getYieldingBankCacheInvalidation, hasLendingPositionCoveringBurn, isSkippableLycTransactionError, isVolatilityRegime, isWithdrawOnlyBurnFeasible, kaminoCollateralUsd, listLycTopLevelInstructionNames, lookupLycError, mergeLycLookupTables, parseLoggedLycAnchorError, parseLycProgramTransactionRecord, podBoolToNumber, protocolMetricPartitionKey, resolveDecreaseCarryCpiPlan, resolveDecreaseCarryIxRefs, resolveDefaultPool, resolvePresets, resolveYieldingBankForPosition, serializeLendingPositionInspectMetrics, setTokenCircuitBreaker, setYieldingBankCircuitBreaker, shouldIncludeKaminoPositionRate, timelocksEnabled, toAnchorAllocationConfig, toProtocolMetricDynamoItem, toYieldingBankExternalLiquiditySources, updateGeneralLutIfNeeded, updateTokenLutIfNeeded, updateTokenLutsIfNeeded, usdStarAllocationConfig, usdStarJuniorAllocationConfig };
|