@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/src/client/account.ts
DELETED
|
@@ -1,503 +0,0 @@
|
|
|
1
|
-
import { type Address, address, type Rpc, type SolanaRpcApi } from "@solana/kit";
|
|
2
|
-
import { PublicKey } from "@solana/web3.js";
|
|
3
|
-
import { Program } from "@anchor-lang/core";
|
|
4
|
-
import { LongYieldCarry } from "../idl/long_yield_carry";
|
|
5
|
-
import { LYCToken, type TokenAccountData } from "../models/lycToken";
|
|
6
|
-
import { LYCYieldingBank, type YieldingBankAccountData } from "../models/yieldingBank";
|
|
7
|
-
import {
|
|
8
|
-
BaseAccountClient,
|
|
9
|
-
CustomAccountMeta,
|
|
10
|
-
ExternalLiquidityType,
|
|
11
|
-
ExternalLiquidityTypeToEnum,
|
|
12
|
-
fetchSplTokenAccountAmounts,
|
|
13
|
-
fromWeb3Pk,
|
|
14
|
-
getAtaAddress,
|
|
15
|
-
LendingPlatform,
|
|
16
|
-
lendingPlatformToEnum,
|
|
17
|
-
resolveTokenProgram,
|
|
18
|
-
toBigInt,
|
|
19
|
-
toCustomAccountMeta,
|
|
20
|
-
toUiAmount,
|
|
21
|
-
toWeb3Pk,
|
|
22
|
-
} from "common";
|
|
23
|
-
import type { PdaClient } from "./pda";
|
|
24
|
-
import type {
|
|
25
|
-
RedemptionEpochSnapshot,
|
|
26
|
-
TokenLpPositionAccountOverrides,
|
|
27
|
-
UserHolding,
|
|
28
|
-
YieldingBankAllocationConfig,
|
|
29
|
-
YieldingBankExternalLiquiditySource,
|
|
30
|
-
} from "./types";
|
|
31
|
-
import { buildCarryTradeAccountMetas, buildRebalanceTokenInitialAccounts } from "../utils/ix";
|
|
32
|
-
|
|
33
|
-
/** DataCache category for LYC `Token` accounts (used when clearing cache after writes). */
|
|
34
|
-
export const LYC_TOKEN_CACHE_CATEGORY = "token";
|
|
35
|
-
export const YIELDING_BANK_CACHE_CATEGORY = "yieldingBank";
|
|
36
|
-
export const REDEMPTION_EPOCH_CACHE_CATEGORY = "redemptionEpoch";
|
|
37
|
-
export const IGNORED_LYC_TOKEN_ADDRESSES = new Set<string>([
|
|
38
|
-
"GphwC2jwG3mcM8FYFFm5j8A4jNw3i7Hhic4poLbnoKpu", // jupSOL - need proper oracle implementation to fix this (TODO)
|
|
39
|
-
]);
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Account fetchers for the long_yield_carry program.
|
|
43
|
-
*
|
|
44
|
-
* Extends {@link BaseAccountClient} for shared DataCache + `splAtaExists`, then adds LYC-specific
|
|
45
|
-
* deserialization and helpers (Token, YieldingBank, carry-trade metas).
|
|
46
|
-
*/
|
|
47
|
-
export class AccountClient extends BaseAccountClient {
|
|
48
|
-
constructor(
|
|
49
|
-
private readonly program: Program<LongYieldCarry>,
|
|
50
|
-
readonly pda: PdaClient,
|
|
51
|
-
rpc: Rpc<SolanaRpcApi>
|
|
52
|
-
) {
|
|
53
|
-
super(rpc, {
|
|
54
|
-
categoryTtlMs: {
|
|
55
|
-
[LYC_TOKEN_CACHE_CATEGORY]: 60_000 * 5,
|
|
56
|
-
[YIELDING_BANK_CACHE_CATEGORY]: 60_000 * 10,
|
|
57
|
-
[REDEMPTION_EPOCH_CACHE_CATEGORY]: 30_000,
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/** Fetch and deserialize a Token account by its PDA address. */
|
|
63
|
-
async fetchToken(token: Address, opts?: { fresh?: boolean }): Promise<LYCToken> {
|
|
64
|
-
if (opts?.fresh) {
|
|
65
|
-
this.dataCache.clearCacheEntry(LYC_TOKEN_CACHE_CATEGORY, token);
|
|
66
|
-
}
|
|
67
|
-
const { data } = await this.dataCache.getDataOrThrow(
|
|
68
|
-
() => this.program.account.token.fetch(toWeb3Pk(token)),
|
|
69
|
-
LYC_TOKEN_CACHE_CATEGORY,
|
|
70
|
-
token
|
|
71
|
-
);
|
|
72
|
-
return new LYCToken(token, data);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** Fetch and deserialize multiple Token accounts by their PDA addresses. */
|
|
76
|
-
async fetchTokens(tokens: Address[]): Promise<LYCToken[]> {
|
|
77
|
-
const { data } = await this.dataCache.getDataBatch(
|
|
78
|
-
() => this.program.account.token.fetchMultiple(tokens.map(toWeb3Pk)),
|
|
79
|
-
LYC_TOKEN_CACHE_CATEGORY,
|
|
80
|
-
tokens
|
|
81
|
-
);
|
|
82
|
-
return data.map((x, i) => new LYCToken(tokens[i], x));
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Fetch all Token accounts owned by the program.
|
|
87
|
-
*
|
|
88
|
-
* Pass `{ fresh: true }` to clear the cached `"all"` entry before reading,
|
|
89
|
-
* forcing a fresh `getProgramAccounts` call. The returned data is
|
|
90
|
-
* re-cached so subsequent callers benefit from the same refresh.
|
|
91
|
-
*/
|
|
92
|
-
async fetchAllTokens(opts?: { fresh?: boolean }): Promise<LYCToken[]> {
|
|
93
|
-
if (opts?.fresh) {
|
|
94
|
-
this.dataCache.clearCacheEntry(LYC_TOKEN_CACHE_CATEGORY, "all");
|
|
95
|
-
}
|
|
96
|
-
const { data } = await this.dataCache.getDataOrThrow(
|
|
97
|
-
() => this.program.account.token.all(),
|
|
98
|
-
LYC_TOKEN_CACHE_CATEGORY,
|
|
99
|
-
"all"
|
|
100
|
-
);
|
|
101
|
-
return data
|
|
102
|
-
.map((acc) => new LYCToken(address(acc.publicKey.toBase58()), acc.account))
|
|
103
|
-
.filter(
|
|
104
|
-
(token) =>
|
|
105
|
-
!IGNORED_LYC_TOKEN_ADDRESSES.has(token.address) &&
|
|
106
|
-
!IGNORED_LYC_TOKEN_ADDRESSES.has(token.mint)
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/** Fetch and deserialize a YieldingBank account by its PDA address. */
|
|
111
|
-
async fetchYieldingBank(bank: Address): Promise<LYCYieldingBank> {
|
|
112
|
-
const { data } = await this.dataCache.getDataOrThrow(
|
|
113
|
-
() => this.program.account.yieldingBank.fetch(toWeb3Pk(bank)),
|
|
114
|
-
YIELDING_BANK_CACHE_CATEGORY,
|
|
115
|
-
bank
|
|
116
|
-
);
|
|
117
|
-
return new LYCYieldingBank(bank, data);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/** Fetch and deserialize multiple YieldingBank accounts by their PDA addresses. */
|
|
121
|
-
async fetchYieldingBanks(banks: Address[]): Promise<LYCYieldingBank[]> {
|
|
122
|
-
const { data } = await this.dataCache.getDataBatch(
|
|
123
|
-
() => this.program.account.yieldingBank.fetchMultiple(banks.map(toWeb3Pk)),
|
|
124
|
-
YIELDING_BANK_CACHE_CATEGORY,
|
|
125
|
-
banks
|
|
126
|
-
);
|
|
127
|
-
return data.map((x, i) => new LYCYieldingBank(banks[i], x));
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/** Fetch all YieldingBank accounts owned by the program. */
|
|
131
|
-
async fetchAllYieldingBanks(): Promise<LYCYieldingBank[]> {
|
|
132
|
-
const { data } = await this.dataCache.getDataOrThrow(
|
|
133
|
-
() => this.program.account.yieldingBank.all(),
|
|
134
|
-
YIELDING_BANK_CACHE_CATEGORY,
|
|
135
|
-
"all"
|
|
136
|
-
);
|
|
137
|
-
return data.map((acc) => new LYCYieldingBank(address(acc.publicKey.toBase58()), acc.account));
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** Fetch and deserialize a RedemptionEpoch account by its PDA address. */
|
|
141
|
-
async fetchRedemptionEpoch(
|
|
142
|
-
epochPda: Address,
|
|
143
|
-
opts?: { fresh?: boolean }
|
|
144
|
-
): Promise<RedemptionEpochSnapshot> {
|
|
145
|
-
if (opts?.fresh) {
|
|
146
|
-
this.dataCache.clearCacheEntry(REDEMPTION_EPOCH_CACHE_CATEGORY, epochPda);
|
|
147
|
-
}
|
|
148
|
-
const { data } = await this.dataCache.getDataOrThrow(
|
|
149
|
-
() => this.program.account.redemptionEpoch.fetch(toWeb3Pk(epochPda)),
|
|
150
|
-
REDEMPTION_EPOCH_CACHE_CATEGORY,
|
|
151
|
-
epochPda
|
|
152
|
-
);
|
|
153
|
-
return this.toRedemptionEpochSnapshot(epochPda, data);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/** Fetch all RedemptionEpoch accounts owned by the program. */
|
|
157
|
-
async fetchAllRedemptionEpochs(opts?: { fresh?: boolean }): Promise<RedemptionEpochSnapshot[]> {
|
|
158
|
-
if (opts?.fresh) {
|
|
159
|
-
this.dataCache.clearCacheEntry(REDEMPTION_EPOCH_CACHE_CATEGORY, "all");
|
|
160
|
-
}
|
|
161
|
-
const { data } = await this.dataCache.getDataOrThrow(
|
|
162
|
-
() => this.program.account.redemptionEpoch.all(),
|
|
163
|
-
REDEMPTION_EPOCH_CACHE_CATEGORY,
|
|
164
|
-
"all"
|
|
165
|
-
);
|
|
166
|
-
return data
|
|
167
|
-
.filter((acc) => acc?.publicKey && acc?.account)
|
|
168
|
-
.map((acc) => this.toRedemptionEpochSnapshot(address(acc.publicKey.toBase58()), acc.account));
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Fetch all LYC yToken holdings for a wallet.
|
|
173
|
-
*
|
|
174
|
-
* Reads the user's ATA per LYC token directly via `getMultipleAccounts` —
|
|
175
|
-
* cost scales with the LYC token count (typically <10), not the wallet's
|
|
176
|
-
* total token-account count, which can be in the hundreds for active users.
|
|
177
|
-
*
|
|
178
|
-
* USD valuation: only when `opts.priceMap` supplies a positive USD price for
|
|
179
|
-
* the collateral mint and `token.price` (NAV) is positive:
|
|
180
|
-
* `valueUsd = uiBalance × token.price × priceMap[collateralMint]`.
|
|
181
|
-
* If the caller does not supply a usable collateral price, `valueUsd` is
|
|
182
|
-
* omitted — we do not infer USD from on-chain `tvlUsd` / `totalSupply`, since
|
|
183
|
-
* those can lag risk-asset markets by tens of minutes.
|
|
184
|
-
*
|
|
185
|
-
* Tokens with no user ATA or a zero balance are filtered out unless
|
|
186
|
-
* `opts.includeEmpty` is set.
|
|
187
|
-
*
|
|
188
|
-
* Pass `opts.tokens` when the caller already has a list of tokens (e.g. a
|
|
189
|
-
* backend service with its own shorter-lived tokens cache) to skip the
|
|
190
|
-
* internal `fetchAllTokens` call and its 5-minute SDK cache.
|
|
191
|
-
*/
|
|
192
|
-
async fetchUserHoldings(
|
|
193
|
-
owner: Address,
|
|
194
|
-
opts?: {
|
|
195
|
-
includeEmpty?: boolean;
|
|
196
|
-
tokens?: LYCToken[];
|
|
197
|
-
priceMap?: Partial<Record<Address, number>>;
|
|
198
|
-
}
|
|
199
|
-
): Promise<UserHolding[]> {
|
|
200
|
-
const tokens = opts?.tokens ?? (await this.fetchAllTokens());
|
|
201
|
-
if (tokens.length === 0) return [];
|
|
202
|
-
|
|
203
|
-
// Derive the user's ATA per LYC token mint up front so we can fetch them
|
|
204
|
-
// all in a single round trip rather than enumerating the wallet's full
|
|
205
|
-
// token-account set.
|
|
206
|
-
const ataByMint = new Map<Address, Address>();
|
|
207
|
-
const ataAddresses: Address[] = [];
|
|
208
|
-
for (const token of tokens) {
|
|
209
|
-
const tokenProgram = resolveTokenProgram(token.data.config.tokenProgram);
|
|
210
|
-
const ata = await getAtaAddress(token.mint, owner, tokenProgram);
|
|
211
|
-
ataByMint.set(token.mint, ata);
|
|
212
|
-
ataAddresses.push(ata);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
const balanceByAta = await fetchSplTokenAccountAmounts(this.rpc, ataAddresses);
|
|
216
|
-
|
|
217
|
-
const holdings: UserHolding[] = [];
|
|
218
|
-
for (const token of tokens) {
|
|
219
|
-
const tokenAccount = ataByMint.get(token.mint)!;
|
|
220
|
-
const balance = balanceByAta.get(tokenAccount) ?? BigInt(0);
|
|
221
|
-
|
|
222
|
-
if (balance === BigInt(0) && !opts?.includeEmpty) continue;
|
|
223
|
-
|
|
224
|
-
const uiBalance = toUiAmount(balance, token.decimals);
|
|
225
|
-
|
|
226
|
-
const collateralPrice = opts?.priceMap?.[token.collateralMint];
|
|
227
|
-
let valueUsd: number | undefined;
|
|
228
|
-
if (collateralPrice !== undefined && collateralPrice > 0 && token.price > 0) {
|
|
229
|
-
valueUsd = uiBalance * token.price * collateralPrice;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
holdings.push({
|
|
233
|
-
token,
|
|
234
|
-
tokenAccount,
|
|
235
|
-
balance,
|
|
236
|
-
uiBalance,
|
|
237
|
-
valueUsd,
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
return holdings;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/** Fetch all Token and YieldingBank accounts in parallel. */
|
|
244
|
-
async fetchAllTokensAndYieldingBanks(): Promise<{
|
|
245
|
-
tokens: LYCToken[];
|
|
246
|
-
yieldingBanks: LYCYieldingBank[];
|
|
247
|
-
}> {
|
|
248
|
-
const [tokens, yieldingBanks] = await Promise.all([
|
|
249
|
-
this.fetchAllTokens(),
|
|
250
|
-
this.fetchAllYieldingBanks(),
|
|
251
|
-
]);
|
|
252
|
-
return { tokens, yieldingBanks };
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Build the ordered remaining-accounts list required by refresh_yielding_bank
|
|
257
|
-
* (and embedded within rebalance_yielding_bank):
|
|
258
|
-
*
|
|
259
|
-
* 1. base_asset: [token_account, oracle, external_liquidity...] (if active)
|
|
260
|
-
* 2. Per active asset holding (in slot order): [token_account, oracle, external_liquidity...]
|
|
261
|
-
* The token_account is the mint's ATA owned by the bank PDA; the program
|
|
262
|
-
* reads its raw balance to sync asset.amount on every refresh.
|
|
263
|
-
* 3. One user account per active external yielding position (in slot order)
|
|
264
|
-
*
|
|
265
|
-
* If `newAllocation` is provided, its [token_account, oracle, external_liquidity...]
|
|
266
|
-
* tuple is injected at the first inactive slot, matching where `apply_allocation`
|
|
267
|
-
* will register it.
|
|
268
|
-
*/
|
|
269
|
-
async getYieldingBankRefreshAccounts(
|
|
270
|
-
bank: Address,
|
|
271
|
-
newAllocation?: YieldingBankAllocationConfig,
|
|
272
|
-
externalLiquiditySources: YieldingBankExternalLiquiditySource[] = []
|
|
273
|
-
): Promise<CustomAccountMeta[]> {
|
|
274
|
-
const bankData = await this.fetchYieldingBank(bank);
|
|
275
|
-
|
|
276
|
-
const pushAssetAccounts = async (
|
|
277
|
-
mint: Address,
|
|
278
|
-
tokenProgramAddr: Address,
|
|
279
|
-
externalLiquidityType: YieldingBankAccountData["baseAsset"]["externalLiquidity"],
|
|
280
|
-
oracle: Address,
|
|
281
|
-
accounts: CustomAccountMeta[]
|
|
282
|
-
) => {
|
|
283
|
-
const ata = await getAtaAddress(mint, bank, tokenProgramAddr);
|
|
284
|
-
accounts.push(
|
|
285
|
-
toCustomAccountMeta(ata, false, { owner: bank, tokenProgram: tokenProgramAddr, mint })
|
|
286
|
-
);
|
|
287
|
-
accounts.push(toCustomAccountMeta(oracle));
|
|
288
|
-
if (ExternalLiquidityTypeToEnum(externalLiquidityType) !== ExternalLiquidityType.None) {
|
|
289
|
-
const sources = externalLiquiditySources
|
|
290
|
-
.filter((source) => source.mint === mint)
|
|
291
|
-
.map((source) => source.account);
|
|
292
|
-
accounts.push(...sources.map((source) => toCustomAccountMeta(source)));
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
const assetAccounts: CustomAccountMeta[] = [];
|
|
297
|
-
|
|
298
|
-
// base_asset first
|
|
299
|
-
const baseAsset = bankData.baseAsset;
|
|
300
|
-
if (!baseAsset.mint.equals(PublicKey.default)) {
|
|
301
|
-
await pushAssetAccounts(
|
|
302
|
-
fromWeb3Pk(baseAsset.mint),
|
|
303
|
-
resolveTokenProgram(baseAsset.tokenProgram),
|
|
304
|
-
baseAsset.externalLiquidity,
|
|
305
|
-
fromWeb3Pk(baseAsset.oracle),
|
|
306
|
-
assetAccounts
|
|
307
|
-
);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
// Per active asset holding: [token_account, oracle].
|
|
311
|
-
// The first inactive slot gets the newAllocation pair (if provided).
|
|
312
|
-
let newAssetInserted = false;
|
|
313
|
-
for (const asset of bankData.assets) {
|
|
314
|
-
if (!asset.mint.equals(PublicKey.default)) {
|
|
315
|
-
await pushAssetAccounts(
|
|
316
|
-
fromWeb3Pk(asset.mint),
|
|
317
|
-
resolveTokenProgram(asset.tokenProgram),
|
|
318
|
-
asset.externalLiquidity,
|
|
319
|
-
fromWeb3Pk(asset.oracle),
|
|
320
|
-
assetAccounts
|
|
321
|
-
);
|
|
322
|
-
} else if (newAllocation?.assetHolding && !newAssetInserted) {
|
|
323
|
-
const { mint, oracle, externalLiquidityType } = newAllocation.assetHolding;
|
|
324
|
-
const mintInfo = await this.rpc.getAccountInfo(mint, { encoding: "base64" }).send();
|
|
325
|
-
const mintOwner = mintInfo.value!.owner;
|
|
326
|
-
await pushAssetAccounts(mint, mintOwner, externalLiquidityType, oracle, assetAccounts);
|
|
327
|
-
newAssetInserted = true;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
// External position accounts — active slots only (lendingPlatform != None).
|
|
332
|
-
// Per position: [protocol_user_acc, collateral_reserve].
|
|
333
|
-
// The new allocation's accounts are inserted at the first inactive slot.
|
|
334
|
-
const extAccounts: CustomAccountMeta[] = [];
|
|
335
|
-
let newExtInserted = false;
|
|
336
|
-
for (const pos of bankData.externalYieldingPositions) {
|
|
337
|
-
if (!("none" in pos.lendingPlatform)) {
|
|
338
|
-
extAccounts.push(toCustomAccountMeta(fromWeb3Pk(pos.protocolUserAcc)));
|
|
339
|
-
extAccounts.push(toCustomAccountMeta(fromWeb3Pk(pos.collateralReserve)));
|
|
340
|
-
} else if (newAllocation?.externalPosition && !newExtInserted) {
|
|
341
|
-
extAccounts.push(toCustomAccountMeta(newAllocation.externalPosition.protocolUserAcc));
|
|
342
|
-
extAccounts.push(toCustomAccountMeta(newAllocation.externalPosition.collateralReserve));
|
|
343
|
-
newExtInserted = true;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
return [...assetAccounts, ...extAccounts];
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Build the carry-trade remaining accounts for increase/decrease carry
|
|
352
|
-
* position instructions.
|
|
353
|
-
*
|
|
354
|
-
* Fetches the token's lending position at `lendingPositionIndex`, derives
|
|
355
|
-
* the debt ATAs, and returns the ordered account metas that
|
|
356
|
-
* `parse_carry_trade_accounts` expects on the Rust side.
|
|
357
|
-
*
|
|
358
|
-
* Returns the fixed carry-trade account prefix, including the instructions
|
|
359
|
-
* sysvar in slot 8 so CPI refs are derived against the on-chain layout.
|
|
360
|
-
*
|
|
361
|
-
* @param lendingPositionUserAccount - Override for the protocol user account.
|
|
362
|
-
* Defaults to the value stored in the on-chain lending position.
|
|
363
|
-
*/
|
|
364
|
-
async getCarryTradeAccounts(
|
|
365
|
-
token: Address,
|
|
366
|
-
yieldingBank: Address,
|
|
367
|
-
lendingPositionIndex: number,
|
|
368
|
-
lendingPositionUserAccount?: Address
|
|
369
|
-
): Promise<CustomAccountMeta[]> {
|
|
370
|
-
const tokenData = await this.fetchToken(token);
|
|
371
|
-
const position = tokenData.data.lendingPositions[lendingPositionIndex];
|
|
372
|
-
const debt = position.accounting.debt;
|
|
373
|
-
const debtMint = fromWeb3Pk(debt.mint);
|
|
374
|
-
const debtTokenProgram = resolveTokenProgram(debt.tokenProgram);
|
|
375
|
-
const tokenLpDebtTa = await getAtaAddress(debtMint, token, debtTokenProgram);
|
|
376
|
-
const yieldingBankTa = await getAtaAddress(debtMint, yieldingBank, debtTokenProgram);
|
|
377
|
-
return buildCarryTradeAccountMetas(
|
|
378
|
-
token,
|
|
379
|
-
yieldingBank,
|
|
380
|
-
tokenLpDebtTa,
|
|
381
|
-
yieldingBankTa,
|
|
382
|
-
lendingPositionUserAccount ?? fromWeb3Pk(position.protocolUserAcc),
|
|
383
|
-
fromWeb3Pk(position.collateralReserve),
|
|
384
|
-
fromWeb3Pk(position.accounting.debt.oracle),
|
|
385
|
-
debtMint,
|
|
386
|
-
debtTokenProgram
|
|
387
|
-
);
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* Derive the account set needed to refresh a single token lending position.
|
|
392
|
-
*
|
|
393
|
-
* This pulls the protocol user account, collateral reserve, and debt oracle
|
|
394
|
-
* from the selected lending position so callers can pass the exact accounts
|
|
395
|
-
* required by refresh-oriented instructions. Optional overrides let tests or
|
|
396
|
-
* advanced callers substitute explicit addresses when needed.
|
|
397
|
-
*/
|
|
398
|
-
getTokenLendingPositionRefreshAccounts(
|
|
399
|
-
tokenData: TokenAccountData,
|
|
400
|
-
lendingPositionIndex: number,
|
|
401
|
-
overrides?: TokenLpPositionAccountOverrides
|
|
402
|
-
) {
|
|
403
|
-
const position = tokenData.lendingPositions[lendingPositionIndex];
|
|
404
|
-
if (!position) {
|
|
405
|
-
throw new Error(`Invalid lending position index: ${lendingPositionIndex}`);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
return {
|
|
409
|
-
userAccount: overrides?.userAccount ?? fromWeb3Pk(position.protocolUserAcc),
|
|
410
|
-
collateralReserve: overrides?.collateralReserve ?? fromWeb3Pk(position.collateralReserve),
|
|
411
|
-
debtOracle: overrides?.debtOracle ?? fromWeb3Pk(position.accounting.debt.oracle),
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Build the fixed initial-accounts prefix for `rebalance_token`.
|
|
417
|
-
*
|
|
418
|
-
* The Rust handler reads these positionally from the front of
|
|
419
|
-
* `remaining_accounts` (see `RebalanceTokenAccounts::parse`). Returning the
|
|
420
|
-
* prefix as `initialAccounts` to `createMultiCpiRefs` lets every CPI in the
|
|
421
|
-
* flash-rebalance bundle deduplicate against these slots, shrinking the
|
|
422
|
-
* transaction's account list compared to declaring them as named ix
|
|
423
|
-
* accounts that would force separate copies in the message header.
|
|
424
|
-
*/
|
|
425
|
-
async getRebalanceTokenInitialAccounts(
|
|
426
|
-
token: Address,
|
|
427
|
-
yieldingBank: Address,
|
|
428
|
-
lpIndex: number,
|
|
429
|
-
destinationDebtOracle: Address,
|
|
430
|
-
overrides?: TokenLpPositionAccountOverrides
|
|
431
|
-
): Promise<CustomAccountMeta[]> {
|
|
432
|
-
const tokenData = await this.fetchToken(token);
|
|
433
|
-
const position = tokenData.data.lendingPositions[lpIndex];
|
|
434
|
-
if (!position) {
|
|
435
|
-
throw new Error(`Invalid lending position index: ${lpIndex}`);
|
|
436
|
-
}
|
|
437
|
-
const sourceDebtMint = fromWeb3Pk(position.accounting.debt.mint);
|
|
438
|
-
const sourceDebtTokenProgram = resolveTokenProgram(position.accounting.debt.tokenProgram);
|
|
439
|
-
const yieldingBankSourceDebtAta = await getAtaAddress(
|
|
440
|
-
sourceDebtMint,
|
|
441
|
-
yieldingBank,
|
|
442
|
-
sourceDebtTokenProgram
|
|
443
|
-
);
|
|
444
|
-
const lp = this.getTokenLendingPositionRefreshAccounts(tokenData.data, lpIndex, overrides);
|
|
445
|
-
return buildRebalanceTokenInitialAccounts({
|
|
446
|
-
token,
|
|
447
|
-
yieldingBank,
|
|
448
|
-
sourceDebtMint,
|
|
449
|
-
sourceDebtTokenProgram,
|
|
450
|
-
yieldingBankSourceDebtAta,
|
|
451
|
-
lpUserAccount: lp.userAccount,
|
|
452
|
-
sourceDebtOracle: lp.debtOracle,
|
|
453
|
-
destinationDebtOracle,
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* Build the initial account pool seed for refresh_token_state.
|
|
459
|
-
*
|
|
460
|
-
* These accounts are placed at the front of the deduplicated remaining_accounts
|
|
461
|
-
* pool (positions 0..N-1), so the index-based TokenRefreshRefs computed by
|
|
462
|
-
* the builder remain stable whether or not prereq CPIs introduce additional accounts.
|
|
463
|
-
*
|
|
464
|
-
* Order:
|
|
465
|
-
* 1. Per active lending position (in slot order): protocol_user_acc, collateral_reserve, debt_oracle
|
|
466
|
-
* 2. One YieldingBank PDA per active carry position (in slot order)
|
|
467
|
-
*/
|
|
468
|
-
async getTokenRefreshAccounts(token: Address): Promise<CustomAccountMeta[]> {
|
|
469
|
-
const tokenData = await this.fetchToken(token);
|
|
470
|
-
const accounts: CustomAccountMeta[] = [];
|
|
471
|
-
|
|
472
|
-
for (const position of tokenData.data.lendingPositions) {
|
|
473
|
-
if (lendingPlatformToEnum(position.platform) === LendingPlatform.None) continue;
|
|
474
|
-
accounts.push(toCustomAccountMeta(fromWeb3Pk(position.protocolUserAcc)));
|
|
475
|
-
accounts.push(toCustomAccountMeta(fromWeb3Pk(position.collateralReserve)));
|
|
476
|
-
accounts.push(toCustomAccountMeta(fromWeb3Pk(position.accounting.debt.oracle)));
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
for (const { data: carry } of tokenData.activeCarryPositions) {
|
|
480
|
-
const baseMint = fromWeb3Pk(carry.yieldingBaseMint);
|
|
481
|
-
const [bankPda] = await this.pda.deriveYieldingBankPda(baseMint, carry.yieldingBankId);
|
|
482
|
-
accounts.push(toCustomAccountMeta(bankPda));
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
return accounts;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
489
|
-
private toRedemptionEpochSnapshot(pda: Address, data: any): RedemptionEpochSnapshot {
|
|
490
|
-
return {
|
|
491
|
-
pda,
|
|
492
|
-
tokenPda: data.header.token.toBase58() as Address,
|
|
493
|
-
epochId: BigInt(data.header.id.toString()),
|
|
494
|
-
payer: data.header.payer.toBase58() as Address,
|
|
495
|
-
status: data.header.status,
|
|
496
|
-
requestCount: Number(data.sequencing.requestCount.toString()),
|
|
497
|
-
processedRequestCount: Number(data.sequencing.processedRequestCount.toString()),
|
|
498
|
-
grossCollateralClaim: toBigInt(data.accounting.grossCollateralClaim),
|
|
499
|
-
realizedUnwindLoss: toBigInt(data.accounting.realizedUnwindLoss),
|
|
500
|
-
fundedCollateral: toBigInt(data.accounting.fundedCollateral),
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
}
|