@exponent-labs/exponent-sdk 0.9.2 → 0.9.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/build/addressLookupTableUtil.d.ts +13 -13
- package/build/addressLookupTableUtil.js +5 -5
- package/build/addressLookupTableUtil.js.map +1 -1
- package/build/client/clmm/accounts/lpPosition.js +5 -6
- package/build/client/clmm/accounts/lpPosition.js.map +1 -1
- package/build/client/clmm/accounts/marketThree.js +5 -6
- package/build/client/clmm/accounts/marketThree.js.map +1 -1
- package/build/client/clmm/accounts/vault.js +5 -6
- package/build/client/clmm/accounts/vault.js.map +1 -1
- package/build/client/clmm/index.d.ts +1 -2
- package/build/client/clmm/instructions/addFarm.js +1 -2
- package/build/client/clmm/instructions/addFarm.js.map +1 -1
- package/build/client/clmm/instructions/addLiquidity.js +1 -2
- package/build/client/clmm/instructions/addLiquidity.js.map +1 -1
- package/build/client/clmm/instructions/addMarketEmission.js +1 -2
- package/build/client/clmm/instructions/addMarketEmission.js.map +1 -1
- package/build/client/clmm/instructions/buyPt.js +1 -2
- package/build/client/clmm/instructions/buyPt.js.map +1 -1
- package/build/client/clmm/instructions/buyYt.js +1 -2
- package/build/client/clmm/instructions/buyYt.js.map +1 -1
- package/build/client/clmm/instructions/claimFarmEmission.js +1 -2
- package/build/client/clmm/instructions/claimFarmEmission.js.map +1 -1
- package/build/client/clmm/instructions/closeMarket.js +1 -2
- package/build/client/clmm/instructions/closeMarket.js.map +1 -1
- package/build/client/clmm/instructions/depositLiquidity.js +1 -2
- package/build/client/clmm/instructions/depositLiquidity.js.map +1 -1
- package/build/client/clmm/instructions/initializeMarket.js +1 -2
- package/build/client/clmm/instructions/initializeMarket.js.map +1 -1
- package/build/client/clmm/instructions/marketAccrueEmission.js +1 -2
- package/build/client/clmm/instructions/marketAccrueEmission.js.map +1 -1
- package/build/client/clmm/instructions/marketCollectEmission.js +1 -2
- package/build/client/clmm/instructions/marketCollectEmission.js.map +1 -1
- package/build/client/clmm/instructions/modifyFarm.js +1 -2
- package/build/client/clmm/instructions/modifyFarm.js.map +1 -1
- package/build/client/clmm/instructions/modifyMarketSetting.js +1 -2
- package/build/client/clmm/instructions/modifyMarketSetting.js.map +1 -1
- package/build/client/clmm/instructions/sellPt.js +1 -2
- package/build/client/clmm/instructions/sellPt.js.map +1 -1
- package/build/client/clmm/instructions/sellYt.js +1 -2
- package/build/client/clmm/instructions/sellYt.js.map +1 -1
- package/build/client/clmm/instructions/tradePt.js +1 -2
- package/build/client/clmm/instructions/tradePt.js.map +1 -1
- package/build/client/clmm/instructions/tradePtExactOut.js +1 -2
- package/build/client/clmm/instructions/tradePtExactOut.js.map +1 -1
- package/build/client/clmm/instructions/withdrawLiquidity.js +1 -2
- package/build/client/clmm/instructions/withdrawLiquidity.js.map +1 -1
- package/build/client/clmm/instructions/wrapperBuyYt.js +1 -2
- package/build/client/clmm/instructions/wrapperBuyYt.js.map +1 -1
- package/build/client/clmm/instructions/wrapperProvideLiquidity.js +1 -2
- package/build/client/clmm/instructions/wrapperProvideLiquidity.js.map +1 -1
- package/build/client/clmm/instructions/wrapperProvideLiquidityBase.js +1 -2
- package/build/client/clmm/instructions/wrapperProvideLiquidityBase.js.map +1 -1
- package/build/client/clmm/instructions/wrapperProvideLiquidityClassic.js +1 -2
- package/build/client/clmm/instructions/wrapperProvideLiquidityClassic.js.map +1 -1
- package/build/client/clmm/instructions/wrapperSellYt.js +1 -2
- package/build/client/clmm/instructions/wrapperSellYt.js.map +1 -1
- package/build/client/clmm/instructions/wrapperWithdrawLiquidity.js +1 -2
- package/build/client/clmm/instructions/wrapperWithdrawLiquidity.js.map +1 -1
- package/build/client/clmm/instructions/wrapperWithdrawLiquidityClassic.js +1 -2
- package/build/client/clmm/instructions/wrapperWithdrawLiquidityClassic.js.map +1 -1
- package/build/client/clmm/types/addFarmEvent.d.ts +1 -25
- package/build/client/clmm/types/amount.d.ts +1 -19
- package/build/client/clmm/types/amount.js +3 -3
- package/build/client/clmm/types/amount.js.map +1 -1
- package/build/client/clmm/types/buyPtEvent.d.ts +1 -16
- package/build/client/clmm/types/buyYtEvent.d.ts +1 -40
- package/build/client/clmm/types/claimFarmEmissionsEvent.d.ts +1 -149
- package/build/client/clmm/types/claimLimits.d.ts +1 -16
- package/build/client/clmm/types/closeMarketEvent.d.ts +1 -16
- package/build/client/clmm/types/configurationOptions.d.ts +1 -25
- package/build/client/clmm/types/cpiAccounts.d.ts +1 -99
- package/build/client/clmm/types/cpiCoreAccounts.d.ts +1 -42
- package/build/client/clmm/types/cpiInterfaceContext.d.ts +1 -13
- package/build/client/clmm/types/crossingSplit.d.ts +1 -109
- package/build/client/clmm/types/depositLiquidityEvent.d.ts +1 -149
- package/build/client/clmm/types/depositLiquidityReturnData.d.ts +1 -49
- package/build/client/clmm/types/emissionInfo.d.ts +1 -25
- package/build/client/clmm/types/farmEmission.d.ts +1 -16
- package/build/client/clmm/types/liquidityNetBalanceLimits.d.ts +1 -19
- package/build/client/clmm/types/lpFarm.d.ts +1 -30
- package/build/client/clmm/types/marketAccrueEmissionEvent.d.ts +1 -134
- package/build/client/clmm/types/marketAdminAction.d.ts +1 -306
- package/build/client/clmm/types/marketAdminAction.js +3 -3
- package/build/client/clmm/types/marketAdminAction.js.map +1 -1
- package/build/client/clmm/types/marketCollectEmissionEvent.d.ts +1 -143
- package/build/client/clmm/types/marketEmission.d.ts +1 -13
- package/build/client/clmm/types/marketEmissions.d.ts +1 -23
- package/build/client/clmm/types/marketFinancials.d.ts +1 -19
- package/build/client/clmm/types/marketThreeInitEvent.d.ts +1 -52
- package/build/client/clmm/types/mergeEvent.d.ts +1 -61
- package/build/client/clmm/types/modifiedTick.d.ts +1 -13
- package/build/client/clmm/types/modifiedTicks.d.ts +1 -35
- package/build/client/clmm/types/modifyFarmEvent.d.ts +1 -31
- package/build/client/clmm/types/number.d.ts +1 -1
- package/build/client/clmm/types/personalYieldTracker.d.ts +1 -10
- package/build/client/clmm/types/personalYieldTrackers.d.ts +1 -19
- package/build/client/clmm/types/principalShare.d.ts +1 -42
- package/build/client/clmm/types/principalShareTrackers.d.ts +1 -59
- package/build/client/clmm/types/sellPtEvent.d.ts +1 -16
- package/build/client/clmm/types/sellYtEvent.d.ts +1 -34
- package/build/client/clmm/types/stripEvent.d.ts +1 -61
- package/build/client/clmm/types/swapDirection.d.ts +1 -1
- package/build/client/clmm/types/tradePtEvent.d.ts +1 -90
- package/build/client/clmm/types/withdrawLiquidityEvent.d.ts +1 -158
- package/build/client/clmm/types/withdrawLiquidityReturnData.d.ts +1 -34
- package/build/client/clmm/types/wrapperBuyYtEvent.d.ts +1 -16
- package/build/client/clmm/types/wrapperProvideLiquidityBaseEvent.d.ts +1 -40
- package/build/client/clmm/types/wrapperProvideLiquidityClassicEvent.d.ts +1 -37
- package/build/client/clmm/types/wrapperProvideLiquidityEvent.d.ts +1 -40
- package/build/client/clmm/types/wrapperSellYtEvent.d.ts +1 -16
- package/build/client/clmm/types/wrapperWithdrawLiquidityClassicEvent.d.ts +1 -43
- package/build/client/clmm/types/wrapperWithdrawLiquidityEvent.d.ts +1 -43
- package/build/client/core/accounts/admin.js +5 -6
- package/build/client/core/accounts/admin.js.map +1 -1
- package/build/client/core/accounts/lpPosition.js +5 -6
- package/build/client/core/accounts/lpPosition.js.map +1 -1
- package/build/client/core/accounts/marketTwo.js +5 -6
- package/build/client/core/accounts/marketTwo.js.map +1 -1
- package/build/client/core/accounts/vault.js +5 -6
- package/build/client/core/accounts/vault.js.map +1 -1
- package/build/client/core/accounts/yieldTokenPosition.js +5 -6
- package/build/client/core/accounts/yieldTokenPosition.js.map +1 -1
- package/build/client/core/index.d.ts +1 -2
- package/build/client/core/instructions/addEmission.js +1 -2
- package/build/client/core/instructions/addEmission.js.map +1 -1
- package/build/client/core/instructions/addFarm.js +1 -2
- package/build/client/core/instructions/addFarm.js.map +1 -1
- package/build/client/core/instructions/addLpTokensMetadata.js +1 -2
- package/build/client/core/instructions/addLpTokensMetadata.js.map +1 -1
- package/build/client/core/instructions/addMarketEmission.js +1 -2
- package/build/client/core/instructions/addMarketEmission.js.map +1 -1
- package/build/client/core/instructions/buyYt.js +1 -2
- package/build/client/core/instructions/buyYt.js.map +1 -1
- package/build/client/core/instructions/claimFarmEmissions.js +1 -2
- package/build/client/core/instructions/claimFarmEmissions.js.map +1 -1
- package/build/client/core/instructions/collectEmission.js +1 -2
- package/build/client/core/instructions/collectEmission.js.map +1 -1
- package/build/client/core/instructions/collectInterest.js +1 -2
- package/build/client/core/instructions/collectInterest.js.map +1 -1
- package/build/client/core/instructions/collectTreasuryEmission.js +1 -2
- package/build/client/core/instructions/collectTreasuryEmission.js.map +1 -1
- package/build/client/core/instructions/collectTreasuryInterest.js +1 -2
- package/build/client/core/instructions/collectTreasuryInterest.js.map +1 -1
- package/build/client/core/instructions/depositYt.js +1 -2
- package/build/client/core/instructions/depositYt.js.map +1 -1
- package/build/client/core/instructions/initLpPosition.js +1 -2
- package/build/client/core/instructions/initLpPosition.js.map +1 -1
- package/build/client/core/instructions/initMarketTwo.js +1 -2
- package/build/client/core/instructions/initMarketTwo.js.map +1 -1
- package/build/client/core/instructions/initializeVault.js +1 -2
- package/build/client/core/instructions/initializeVault.js.map +1 -1
- package/build/client/core/instructions/initializeYieldPosition.js +1 -2
- package/build/client/core/instructions/initializeYieldPosition.js.map +1 -1
- package/build/client/core/instructions/marketCollectEmission.js +1 -2
- package/build/client/core/instructions/marketCollectEmission.js.map +1 -1
- package/build/client/core/instructions/marketDepositLp.js +1 -2
- package/build/client/core/instructions/marketDepositLp.js.map +1 -1
- package/build/client/core/instructions/marketTwoDepositLiquidity.js +1 -2
- package/build/client/core/instructions/marketTwoDepositLiquidity.js.map +1 -1
- package/build/client/core/instructions/marketTwoWithdrawLiquidity.js +1 -2
- package/build/client/core/instructions/marketTwoWithdrawLiquidity.js.map +1 -1
- package/build/client/core/instructions/marketWithdrawLp.js +1 -2
- package/build/client/core/instructions/marketWithdrawLp.js.map +1 -1
- package/build/client/core/instructions/merge.js +1 -2
- package/build/client/core/instructions/merge.js.map +1 -1
- package/build/client/core/instructions/modifyFarm.js +1 -2
- package/build/client/core/instructions/modifyFarm.js.map +1 -1
- package/build/client/core/instructions/modifyMarketSetting.js +1 -2
- package/build/client/core/instructions/modifyMarketSetting.js.map +1 -1
- package/build/client/core/instructions/modifyVaultSetting.js +1 -2
- package/build/client/core/instructions/modifyVaultSetting.js.map +1 -1
- package/build/client/core/instructions/reallocMarket.js +1 -2
- package/build/client/core/instructions/reallocMarket.js.map +1 -1
- package/build/client/core/instructions/sellYt.js +1 -2
- package/build/client/core/instructions/sellYt.js.map +1 -1
- package/build/client/core/instructions/stageYtYield.js +1 -2
- package/build/client/core/instructions/stageYtYield.js.map +1 -1
- package/build/client/core/instructions/strip.js +1 -2
- package/build/client/core/instructions/strip.js.map +1 -1
- package/build/client/core/instructions/tradePt.js +1 -2
- package/build/client/core/instructions/tradePt.js.map +1 -1
- package/build/client/core/instructions/withdrawYt.js +1 -2
- package/build/client/core/instructions/withdrawYt.js.map +1 -1
- package/build/client/core/instructions/wrapperBuyPt.js +1 -2
- package/build/client/core/instructions/wrapperBuyPt.js.map +1 -1
- package/build/client/core/instructions/wrapperBuyYt.js +1 -2
- package/build/client/core/instructions/wrapperBuyYt.js.map +1 -1
- package/build/client/core/instructions/wrapperCollectInterest.js +1 -2
- package/build/client/core/instructions/wrapperCollectInterest.js.map +1 -1
- package/build/client/core/instructions/wrapperMerge.js +1 -2
- package/build/client/core/instructions/wrapperMerge.js.map +1 -1
- package/build/client/core/instructions/wrapperProvideLiquidity.js +1 -2
- package/build/client/core/instructions/wrapperProvideLiquidity.js.map +1 -1
- package/build/client/core/instructions/wrapperProvideLiquidityBase.js +1 -2
- package/build/client/core/instructions/wrapperProvideLiquidityBase.js.map +1 -1
- package/build/client/core/instructions/wrapperProvideLiquidityClassic.js +1 -2
- package/build/client/core/instructions/wrapperProvideLiquidityClassic.js.map +1 -1
- package/build/client/core/instructions/wrapperSellPt.js +1 -2
- package/build/client/core/instructions/wrapperSellPt.js.map +1 -1
- package/build/client/core/instructions/wrapperSellYt.js +1 -2
- package/build/client/core/instructions/wrapperSellYt.js.map +1 -1
- package/build/client/core/instructions/wrapperStrip.js +1 -2
- package/build/client/core/instructions/wrapperStrip.js.map +1 -1
- package/build/client/core/instructions/wrapperWithdrawLiquidity.js +1 -2
- package/build/client/core/instructions/wrapperWithdrawLiquidity.js.map +1 -1
- package/build/client/core/instructions/wrapperWithdrawLiquidityClassic.js +1 -2
- package/build/client/core/instructions/wrapperWithdrawLiquidityClassic.js.map +1 -1
- package/build/client/core/types/adminAction.d.ts +1 -269
- package/build/client/core/types/adminAction.js +3 -3
- package/build/client/core/types/adminAction.js.map +1 -1
- package/build/client/core/types/amount.d.ts +1 -19
- package/build/client/core/types/amount.js +3 -3
- package/build/client/core/types/amount.js.map +1 -1
- package/build/client/core/types/buyPtEvent.d.ts +1 -19
- package/build/client/core/types/buyYtEvent.d.ts +1 -49
- package/build/client/core/types/claimFarmEmissionsEvent.d.ts +1 -31
- package/build/client/core/types/claimFarmEmissionsEventV2.d.ts +1 -83
- package/build/client/core/types/claimLimits.d.ts +1 -16
- package/build/client/core/types/collectEmissionEvent.d.ts +1 -25
- package/build/client/core/types/collectEmissionEventV2.d.ts +1 -55
- package/build/client/core/types/collectInterestEvent.d.ts +1 -22
- package/build/client/core/types/collectInterestEventV2.d.ts +1 -52
- package/build/client/core/types/collectTreasuryEmissionKind.d.ts +1 -1
- package/build/client/core/types/collectTreasuryInterestKind.d.ts +1 -1
- package/build/client/core/types/cpiAccounts.d.ts +1 -99
- package/build/client/core/types/cpiInterfaceContext.d.ts +1 -13
- package/build/client/core/types/depositLiquidityEvent.d.ts +1 -49
- package/build/client/core/types/depositLpEvent.d.ts +1 -31
- package/build/client/core/types/depositLpEventV2.d.ts +1 -83
- package/build/client/core/types/depositYtEvent.d.ts +1 -40
- package/build/client/core/types/depositYtEventV2.d.ts +1 -70
- package/build/client/core/types/emissionInfo.d.ts +1 -25
- package/build/client/core/types/farmEmission.d.ts +1 -16
- package/build/client/core/types/initLpPositionEvent.d.ts +1 -25
- package/build/client/core/types/initializeYieldPositionEvent.d.ts +1 -16
- package/build/client/core/types/liquidityNetBalanceLimits.d.ts +1 -19
- package/build/client/core/types/lpFarm.d.ts +1 -30
- package/build/client/core/types/marketAdminAction.d.ts +1 -239
- package/build/client/core/types/marketAdminAction.js +3 -3
- package/build/client/core/types/marketAdminAction.js.map +1 -1
- package/build/client/core/types/marketCollectEmissionEvent.d.ts +1 -28
- package/build/client/core/types/marketCollectEmissionEventV2.d.ts +1 -80
- package/build/client/core/types/marketEmission.d.ts +1 -13
- package/build/client/core/types/marketEmissions.d.ts +1 -23
- package/build/client/core/types/marketFinancials.d.ts +1 -22
- package/build/client/core/types/mergeEvent.d.ts +1 -61
- package/build/client/core/types/number.d.ts +1 -1
- package/build/client/core/types/personalYieldTracker.d.ts +1 -10
- package/build/client/core/types/personalYieldTrackers.d.ts +1 -19
- package/build/client/core/types/principleDetails.d.ts +1 -7
- package/build/client/core/types/principles.d.ts +1 -70
- package/build/client/core/types/sellPtEvent.d.ts +1 -19
- package/build/client/core/types/sellYtEvent.d.ts +1 -43
- package/build/client/core/types/stageYieldEvent.d.ts +1 -31
- package/build/client/core/types/stageYieldEventV2.d.ts +1 -58
- package/build/client/core/types/stripEvent.d.ts +1 -61
- package/build/client/core/types/tradePtEvent.d.ts +1 -37
- package/build/client/core/types/withdrawLiquidityEvent.d.ts +1 -43
- package/build/client/core/types/withdrawLpEvent.d.ts +1 -31
- package/build/client/core/types/withdrawLpEventV2.d.ts +1 -83
- package/build/client/core/types/withdrawYtEvent.d.ts +1 -40
- package/build/client/core/types/withdrawYtEventV2.d.ts +1 -70
- package/build/client/core/types/wrapperBuyYtEvent.d.ts +1 -19
- package/build/client/core/types/wrapperCollectInterestEvent.d.ts +1 -16
- package/build/client/core/types/wrapperMergeEvent.d.ts +1 -19
- package/build/client/core/types/wrapperProvideLiquidityBaseEvent.d.ts +1 -25
- package/build/client/core/types/wrapperProvideLiquidityClassicEvent.d.ts +1 -22
- package/build/client/core/types/wrapperProvideLiquidityEvent.d.ts +1 -22
- package/build/client/core/types/wrapperSellYtEvent.d.ts +1 -19
- package/build/client/core/types/wrapperStripEvent.d.ts +1 -19
- package/build/client/core/types/wrapperWithdrawLiquidityClassicEvent.d.ts +1 -22
- package/build/client/core/types/wrapperWithdrawLiquidityEvent.d.ts +1 -19
- package/build/client/core/types/yieldTokenTracker.d.ts +1 -10
- package/build/client/orderbook/accounts/cpiAccountsOrderbook.js +5 -6
- package/build/client/orderbook/accounts/cpiAccountsOrderbook.js.map +1 -1
- package/build/client/orderbook/accounts/vault.js +5 -6
- package/build/client/orderbook/accounts/vault.js.map +1 -1
- package/build/client/orderbook/index.d.ts +1 -2
- package/build/client/orderbook/instructions/collectAdminEmission.js +1 -2
- package/build/client/orderbook/instructions/collectAdminEmission.js.map +1 -1
- package/build/client/orderbook/instructions/collectAdminFee.js +1 -2
- package/build/client/orderbook/instructions/collectAdminFee.js.map +1 -1
- package/build/client/orderbook/instructions/collectInterest.js +1 -2
- package/build/client/orderbook/instructions/collectInterest.js.map +1 -1
- package/build/client/orderbook/instructions/initializeOrderbook.js +1 -2
- package/build/client/orderbook/instructions/initializeOrderbook.js.map +1 -1
- package/build/client/orderbook/instructions/marketOffer.js +1 -2
- package/build/client/orderbook/instructions/marketOffer.js.map +1 -1
- package/build/client/orderbook/instructions/postOffer.js +1 -2
- package/build/client/orderbook/instructions/postOffer.js.map +1 -1
- package/build/client/orderbook/instructions/reallocOrderbookAccount.js +1 -2
- package/build/client/orderbook/instructions/reallocOrderbookAccount.js.map +1 -1
- package/build/client/orderbook/instructions/removeExpiredOffers.js +1 -2
- package/build/client/orderbook/instructions/removeExpiredOffers.js.map +1 -1
- package/build/client/orderbook/instructions/removeOffer.js +1 -2
- package/build/client/orderbook/instructions/removeOffer.js.map +1 -1
- package/build/client/orderbook/instructions/setConfigurationOptions.js +1 -2
- package/build/client/orderbook/instructions/setConfigurationOptions.js.map +1 -1
- package/build/client/orderbook/instructions/withdrawFunds.js +1 -2
- package/build/client/orderbook/instructions/withdrawFunds.js.map +1 -1
- package/build/client/orderbook/instructions/wrapperCollectAdminFee.js +1 -2
- package/build/client/orderbook/instructions/wrapperCollectAdminFee.js.map +1 -1
- package/build/client/orderbook/instructions/wrapperCollectInterest.js +1 -2
- package/build/client/orderbook/instructions/wrapperCollectInterest.js.map +1 -1
- package/build/client/orderbook/instructions/wrapperMarketOffer.js +1 -2
- package/build/client/orderbook/instructions/wrapperMarketOffer.js.map +1 -1
- package/build/client/orderbook/instructions/wrapperPostOffer.js +1 -2
- package/build/client/orderbook/instructions/wrapperPostOffer.js.map +1 -1
- package/build/client/orderbook/instructions/wrapperRemoveOffer.js +1 -2
- package/build/client/orderbook/instructions/wrapperRemoveOffer.js.map +1 -1
- package/build/client/orderbook/instructions/wrapperWithdrawFunds.js +1 -2
- package/build/client/orderbook/instructions/wrapperWithdrawFunds.js.map +1 -1
- package/build/client/orderbook/types/amount.d.ts +1 -19
- package/build/client/orderbook/types/amount.js +3 -3
- package/build/client/orderbook/types/amount.js.map +1 -1
- package/build/client/orderbook/types/claimLimits.d.ts +1 -16
- package/build/client/orderbook/types/collectAdminEmissionEvent.d.ts +1 -19
- package/build/client/orderbook/types/collectAdminFeeEvent.d.ts +1 -19
- package/build/client/orderbook/types/collectEmissionEventV2.d.ts +1 -55
- package/build/client/orderbook/types/collectInterestEventV2.d.ts +1 -52
- package/build/client/orderbook/types/collectUserInterestEvent.d.ts +1 -16
- package/build/client/orderbook/types/cpiAccounts.d.ts +1 -99
- package/build/client/orderbook/types/cpiInterfaceContext.d.ts +1 -13
- package/build/client/orderbook/types/emissionInfo.d.ts +1 -25
- package/build/client/orderbook/types/exponentCoreCpiAccounts.d.ts +1 -99
- package/build/client/orderbook/types/filledOffersEvent.d.ts +1 -22
- package/build/client/orderbook/types/marketOfferEvent.d.ts +1 -74
- package/build/client/orderbook/types/mergeEvent.d.ts +1 -61
- package/build/client/orderbook/types/number.d.ts +1 -1
- package/build/client/orderbook/types/offerOptions.d.ts +1 -13
- package/build/client/orderbook/types/offerOptions.js +3 -3
- package/build/client/orderbook/types/offerOptions.js.map +1 -1
- package/build/client/orderbook/types/offerType.d.ts +1 -1
- package/build/client/orderbook/types/orderbookInitEvent.d.ts +1 -28
- package/build/client/orderbook/types/postOfferEvent.d.ts +1 -96
- package/build/client/orderbook/types/removeOfferEvent.d.ts +1 -28
- package/build/client/orderbook/types/setConfigurationOptionsEnum.d.ts +1 -49
- package/build/client/orderbook/types/setConfigurationOptionsEnum.js +3 -3
- package/build/client/orderbook/types/setConfigurationOptionsEnum.js.map +1 -1
- package/build/client/orderbook/types/stripEvent.d.ts +1 -61
- package/build/client/orderbook/types/withdrawFundsEvent.d.ts +1 -28
- package/build/client/orderbook/types/wrapperCollectAdminFeeEvent.d.ts +1 -13
- package/build/client/orderbook/types/wrapperCollectInterestEvent.d.ts +1 -10
- package/build/client/orderbook/types/wrapperMarketOfferEvent.d.ts +1 -13
- package/build/client/orderbook/types/wrapperPostOfferEvent.d.ts +1 -28
- package/build/client/orderbook/types/wrapperRemoveOfferEvent.d.ts +1 -10
- package/build/client/orderbook/types/wrapperWithdrawFundsEvent.d.ts +1 -19
- package/build/client/orderbook/types/yieldTokenTracker.d.ts +1 -10
- package/build/client/vaults/accounts/actionProposal.js +5 -6
- package/build/client/vaults/accounts/actionProposal.js.map +1 -1
- package/build/client/vaults/accounts/exponentStrategyVault.js +5 -6
- package/build/client/vaults/accounts/exponentStrategyVault.js.map +1 -1
- package/build/client/vaults/accounts/programConfig.js +5 -6
- package/build/client/vaults/accounts/programConfig.js.map +1 -1
- package/build/client/vaults/accounts/voteAccount.js +5 -6
- package/build/client/vaults/accounts/voteAccount.js.map +1 -1
- package/build/client/vaults/accounts/withdrawalAccount.js +5 -6
- package/build/client/vaults/accounts/withdrawalAccount.js.map +1 -1
- package/build/client/vaults/eventRegistry.d.ts +8 -2
- package/build/client/vaults/eventRegistry.js +6 -0
- package/build/client/vaults/eventRegistry.js.map +1 -1
- package/build/client/vaults/index.d.ts +4 -2
- package/build/client/vaults/index.js +3 -0
- package/build/client/vaults/index.js.map +1 -1
- package/build/client/vaults/instructions/activateProposal.d.ts +2 -0
- package/build/client/vaults/instructions/activateProposal.js +3 -2
- package/build/client/vaults/instructions/activateProposal.js.map +1 -1
- package/build/client/vaults/instructions/addPolicy.js +1 -2
- package/build/client/vaults/instructions/addPolicy.js.map +1 -1
- package/build/client/vaults/instructions/appendProposalActions.js +1 -2
- package/build/client/vaults/instructions/appendProposalActions.js.map +1 -1
- package/build/client/vaults/instructions/cancelProposal.d.ts +2 -0
- package/build/client/vaults/instructions/cancelProposal.js +3 -2
- package/build/client/vaults/instructions/cancelProposal.js.map +1 -1
- package/build/client/vaults/instructions/cancelWithdrawal.d.ts +2 -0
- package/build/client/vaults/instructions/cancelWithdrawal.js +3 -2
- package/build/client/vaults/instructions/cancelWithdrawal.js.map +1 -1
- package/build/client/vaults/instructions/collectManagementFee.js +1 -2
- package/build/client/vaults/instructions/collectManagementFee.js.map +1 -1
- package/build/client/vaults/instructions/depositLiquidity.js +1 -2
- package/build/client/vaults/instructions/depositLiquidity.js.map +1 -1
- package/build/client/vaults/instructions/executeProposal.d.ts +2 -0
- package/build/client/vaults/instructions/executeProposal.js +3 -2
- package/build/client/vaults/instructions/executeProposal.js.map +1 -1
- package/build/client/vaults/instructions/executeWithdrawal.js +1 -2
- package/build/client/vaults/instructions/executeWithdrawal.js.map +1 -1
- package/build/client/vaults/instructions/executeWithdrawalFromReserves.d.ts +2 -0
- package/build/client/vaults/instructions/executeWithdrawalFromReserves.js +3 -2
- package/build/client/vaults/instructions/executeWithdrawalFromReserves.js.map +1 -1
- package/build/client/vaults/instructions/fillWithdrawal.js +1 -2
- package/build/client/vaults/instructions/fillWithdrawal.js.map +1 -1
- package/build/client/vaults/instructions/finalizeProposal.d.ts +2 -0
- package/build/client/vaults/instructions/finalizeProposal.js +3 -2
- package/build/client/vaults/instructions/finalizeProposal.js.map +1 -1
- package/build/client/vaults/instructions/initProposal.js +1 -2
- package/build/client/vaults/instructions/initProposal.js.map +1 -1
- package/build/client/vaults/instructions/initializePrices.js +1 -2
- package/build/client/vaults/instructions/initializePrices.js.map +1 -1
- package/build/client/vaults/instructions/initializeVault.js +1 -2
- package/build/client/vaults/instructions/initializeVault.js.map +1 -1
- package/build/client/vaults/instructions/makeSentienelManager.js +1 -2
- package/build/client/vaults/instructions/makeSentienelManager.js.map +1 -1
- package/build/client/vaults/instructions/managePrices.js +1 -2
- package/build/client/vaults/instructions/managePrices.js.map +1 -1
- package/build/client/vaults/instructions/manageVaultSettings.js +1 -2
- package/build/client/vaults/instructions/manageVaultSettings.js.map +1 -1
- package/build/client/vaults/instructions/managerUpdatePosition.js +1 -2
- package/build/client/vaults/instructions/managerUpdatePosition.js.map +1 -1
- package/build/client/vaults/instructions/queueWithdrawal.d.ts +2 -0
- package/build/client/vaults/instructions/queueWithdrawal.js +3 -2
- package/build/client/vaults/instructions/queueWithdrawal.js.map +1 -1
- package/build/client/vaults/instructions/removePolicy.js +1 -2
- package/build/client/vaults/instructions/removePolicy.js.map +1 -1
- package/build/client/vaults/instructions/sentinelSetVaultFlags.d.ts +2 -0
- package/build/client/vaults/instructions/sentinelSetVaultFlags.js +3 -2
- package/build/client/vaults/instructions/sentinelSetVaultFlags.js.map +1 -1
- package/build/client/vaults/instructions/stakeVote.d.ts +2 -0
- package/build/client/vaults/instructions/stakeVote.js +3 -2
- package/build/client/vaults/instructions/stakeVote.js.map +1 -1
- package/build/client/vaults/instructions/unstakeVote.js +1 -2
- package/build/client/vaults/instructions/unstakeVote.js.map +1 -1
- package/build/client/vaults/instructions/updatePolicy.js +1 -2
- package/build/client/vaults/instructions/updatePolicy.js.map +1 -1
- package/build/client/vaults/instructions/updatePolicyManager.js +1 -2
- package/build/client/vaults/instructions/updatePolicyManager.js.map +1 -1
- package/build/client/vaults/instructions/updatePrice.js +1 -2
- package/build/client/vaults/instructions/updatePrice.js.map +1 -1
- package/build/client/vaults/instructions/validateInteractionHook.js +1 -2
- package/build/client/vaults/instructions/validateInteractionHook.js.map +1 -1
- package/build/client/vaults/instructions/wrapperAddPolicy.js +1 -2
- package/build/client/vaults/instructions/wrapperAddPolicy.js.map +1 -1
- package/build/client/vaults/instructions/wrapperExecuteWithdrawal.js +1 -2
- package/build/client/vaults/instructions/wrapperExecuteWithdrawal.js.map +1 -1
- package/build/client/vaults/instructions/wrapperManageVaultSettings.js +1 -2
- package/build/client/vaults/instructions/wrapperManageVaultSettings.js.map +1 -1
- package/build/client/vaults/instructions/wrapperManagerUpdatePosition.js +1 -2
- package/build/client/vaults/instructions/wrapperManagerUpdatePosition.js.map +1 -1
- package/build/client/vaults/instructions/wrapperRemovePolicy.js +1 -2
- package/build/client/vaults/instructions/wrapperRemovePolicy.js.map +1 -1
- package/build/client/vaults/instructions/wrapperUpdatePolicy.js +1 -2
- package/build/client/vaults/instructions/wrapperUpdatePolicy.js.map +1 -1
- package/build/client/vaults/types/accountConstraint.d.ts +1 -13
- package/build/client/vaults/types/accountConstraintType.d.ts +1 -1
- package/build/client/vaults/types/accountConstraintType.js +3 -3
- package/build/client/vaults/types/accountConstraintType.js.map +1 -1
- package/build/client/vaults/types/allowedSettingsChange.d.ts +1 -54
- package/build/client/vaults/types/allowedSettingsChange.js +3 -3
- package/build/client/vaults/types/allowedSettingsChange.js.map +1 -1
- package/build/client/vaults/types/cancelProposalEvent.d.ts +1 -19
- package/build/client/vaults/types/cancelWithdrawalEvent.d.ts +12 -0
- package/build/client/vaults/types/cancelWithdrawalEvent.js +29 -0
- package/build/client/vaults/types/cancelWithdrawalEvent.js.map +1 -0
- package/build/client/vaults/types/clmmPositionEntry.d.ts +1 -80
- package/build/client/vaults/types/dataConstraint.d.ts +1 -109
- package/build/client/vaults/types/dataOperator.d.ts +1 -1
- package/build/client/vaults/types/dataValue.d.ts +1 -73
- package/build/client/vaults/types/dataValue.js +3 -3
- package/build/client/vaults/types/dataValue.js.map +1 -1
- package/build/client/vaults/types/depositLiquidityEvent.d.ts +1 -40
- package/build/client/vaults/types/executeProposalEvent.d.ts +1 -19
- package/build/client/vaults/types/executeWithdrawalEvent.d.ts +8 -10
- package/build/client/vaults/types/executeWithdrawalEvent.js +19 -0
- package/build/client/vaults/types/executeWithdrawalEvent.js.map +1 -1
- package/build/client/vaults/types/executeWithdrawalFromReservesEvent.d.ts +19 -0
- package/build/client/vaults/types/executeWithdrawalFromReservesEvent.js +48 -0
- package/build/client/vaults/types/executeWithdrawalFromReservesEvent.js.map +1 -0
- package/build/client/vaults/types/fillParam.d.ts +1 -10
- package/build/client/vaults/types/finalizeProposalEvent.d.ts +1 -34
- package/build/client/vaults/types/hook.d.ts +1 -35
- package/build/client/vaults/types/hookCompiledInstruction.d.ts +1 -13
- package/build/client/vaults/types/index.d.ts +3 -0
- package/build/client/vaults/types/index.js +3 -0
- package/build/client/vaults/types/index.js.map +1 -1
- package/build/client/vaults/types/instructionConstraint.d.ts +1 -165
- package/build/client/vaults/types/internalFundTransferPolicyCreationPayload.d.ts +1 -13
- package/build/client/vaults/types/kaminoFarmEntry.d.ts +1 -10
- package/build/client/vaults/types/kaminoObligationEntry.d.ts +1 -122
- package/build/client/vaults/types/limitedQuantityConstraints.d.ts +1 -7
- package/build/client/vaults/types/limitedSpendingLimit.d.ts +1 -97
- package/build/client/vaults/types/limitedTimeConstraints.d.ts +1 -61
- package/build/client/vaults/types/loopscaleLoanEntry.d.ts +1 -7
- package/build/client/vaults/types/loopscaleStrategyEntry.d.ts +1 -7
- package/build/client/vaults/types/number.d.ts +1 -1
- package/build/client/vaults/types/obligationType.d.ts +1 -1
- package/build/client/vaults/types/obligationType.js +3 -3
- package/build/client/vaults/types/obligationType.js.map +1 -1
- package/build/client/vaults/types/orderbookEntry.d.ts +1 -54
- package/build/client/vaults/types/periodV2.d.ts +1 -37
- package/build/client/vaults/types/periodV2.js +3 -3
- package/build/client/vaults/types/periodV2.js.map +1 -1
- package/build/client/vaults/types/permissions.d.ts +1 -7
- package/build/client/vaults/types/policyAction.d.ts +1 -40
- package/build/client/vaults/types/policyAction.js +3 -3
- package/build/client/vaults/types/policyAction.js.map +1 -1
- package/build/client/vaults/types/policyCreationPayload.d.ts +1 -260
- package/build/client/vaults/types/policyCreationPayload.js +3 -3
- package/build/client/vaults/types/policyCreationPayload.js.map +1 -1
- package/build/client/vaults/types/policyExpirationArgs.d.ts +1 -19
- package/build/client/vaults/types/policyExpirationArgs.js +3 -3
- package/build/client/vaults/types/policyExpirationArgs.js.map +1 -1
- package/build/client/vaults/types/positionUpdate.js +3 -3
- package/build/client/vaults/types/positionUpdate.js.map +1 -1
- package/build/client/vaults/types/priceId.d.ts +1 -25
- package/build/client/vaults/types/priceId.js +3 -3
- package/build/client/vaults/types/priceId.js.map +1 -1
- package/build/client/vaults/types/priceType.d.ts +1 -1
- package/build/client/vaults/types/proposalAction.d.ts +2 -204
- package/build/client/vaults/types/proposalAction.js +6 -3
- package/build/client/vaults/types/proposalAction.js.map +1 -1
- package/build/client/vaults/types/proposalActionKind.d.ts +1 -1
- package/build/client/vaults/types/proposalStatus.d.ts +1 -1
- package/build/client/vaults/types/proposalVoteConfig.d.ts +1 -34
- package/build/client/vaults/types/proposeActionEvent.d.ts +1 -34
- package/build/client/vaults/types/quantityConstraints.d.ts +1 -13
- package/build/client/vaults/types/queueWithdrawalEvent.d.ts +11 -0
- package/build/client/vaults/types/queueWithdrawalEvent.js +31 -0
- package/build/client/vaults/types/queueWithdrawalEvent.js.map +1 -0
- package/build/client/vaults/types/reserveFarmMapping.d.ts +1 -13
- package/build/client/vaults/types/reservePriceMapping.d.ts +1 -42
- package/build/client/vaults/types/settingsChangePolicyCreationPayload.d.ts +1 -77
- package/build/client/vaults/types/spendingLimitPolicyCreationPayload.d.ts +1 -130
- package/build/client/vaults/types/stakeVoteEvent.d.ts +1 -28
- package/build/client/vaults/types/strategyPosition.d.ts +1 -1
- package/build/client/vaults/types/strategyPosition.js +3 -3
- package/build/client/vaults/types/strategyPosition.js.map +1 -1
- package/build/client/vaults/types/timeConstraints.d.ts +1 -64
- package/build/client/vaults/types/tokenAccountBalance.d.ts +1 -45
- package/build/client/vaults/types/tokenAccountEntry.d.ts +1 -66
- package/build/client/vaults/types/tokenEntry.d.ts +1 -51
- package/build/client/vaults/types/unstakeVoteEvent.d.ts +1 -25
- package/build/client/vaults/types/updatePriceAction.d.ts +1 -124
- package/build/client/vaults/types/updatePriceAction.js +3 -3
- package/build/client/vaults/types/updatePriceAction.js.map +1 -1
- package/build/client/vaults/types/updatePriceInput.d.ts +1 -10
- package/build/client/vaults/types/usageState.d.ts +1 -10
- package/build/client/vaults/types/vaultConfig.d.ts +1 -74
- package/build/client/vaults/types/vaultFinancials.d.ts +1 -43
- package/build/client/vaults/types/vaultFlagAction.d.ts +1 -37
- package/build/client/vaults/types/vaultFlagAction.js +3 -3
- package/build/client/vaults/types/vaultFlagAction.js.map +1 -1
- package/build/client/vaults/types/vaultFlagsUpdatedEvent.d.ts +1 -16
- package/build/client/vaults/types/vaultRoleKind.d.ts +1 -1
- package/build/client/vaults/types/vaultRoles.d.ts +1 -16
- package/build/client/vaults/types/vaultSettingsAction.js +3 -3
- package/build/client/vaults/types/vaultSettingsAction.js.map +1 -1
- package/build/client/vaults/types/voteChoice.d.ts +1 -1
- package/build/client/vaults/types/withdrawalPeriodSettings.d.ts +1 -31
- package/build/client/vaults/types/withdrawalPeriodSettings.js +3 -3
- package/build/client/vaults/types/withdrawalPeriodSettings.js.map +1 -1
- package/build/client/vaults/types/withdrawalTokenFill.d.ts +1 -13
- package/build/client/vaults/types/yieldPositionEntry.d.ts +1 -45
- package/build/clmm/codamaEvents.d.ts +1 -2
- package/build/codamaEvents.d.ts +1 -2
- package/build/exponentVaults/aumCalculator.d.ts +0 -2
- package/build/exponentVaults/aumCalculator.js +20 -10
- package/build/exponentVaults/aumCalculator.js.map +1 -1
- package/build/exponentVaults/events.d.ts +1 -2
- package/build/exponentVaults/fetcher.js +4 -4
- package/build/exponentVaults/fetcher.js.map +1 -1
- package/build/exponentVaults/index.js +17 -7
- package/build/exponentVaults/index.js.map +1 -1
- package/build/exponentVaults/kamino-farms.d.ts +0 -2
- package/build/exponentVaults/kamino-farms.js +14 -14
- package/build/exponentVaults/kamino-farms.js.map +1 -1
- package/build/exponentVaults/kamino-markets.d.ts +394 -394
- package/build/exponentVaults/kamino-markets.js +2 -2
- package/build/exponentVaults/kamino-markets.js.map +1 -1
- package/build/exponentVaults/loopscale/helpers.js +6 -7
- package/build/exponentVaults/loopscale/helpers.js.map +1 -1
- package/build/exponentVaults/loopscale/prepared-transactions.js +1 -2
- package/build/exponentVaults/loopscale/prepared-transactions.js.map +1 -1
- package/build/exponentVaults/policyBuilders.d.ts +73 -75
- package/build/exponentVaults/policyBuilders.js +26 -27
- package/build/exponentVaults/policyBuilders.js.map +1 -1
- package/build/exponentVaults/policyMatcher.js +6 -7
- package/build/exponentVaults/policyMatcher.js.map +1 -1
- package/build/exponentVaults/pricePathResolver.js +7 -8
- package/build/exponentVaults/pricePathResolver.js.map +1 -1
- package/build/exponentVaults/scope-refresh.js +1 -2
- package/build/exponentVaults/scope-refresh.js.map +1 -1
- package/build/exponentVaults/squadsVaultTxnResolver/helpers.js +6 -7
- package/build/exponentVaults/squadsVaultTxnResolver/helpers.js.map +1 -1
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.js +5 -6
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.js.map +1 -1
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.js +1 -2
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.js.map +1 -1
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.js +1 -2
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.js.map +1 -1
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.js +1 -2
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.js.map +1 -1
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/titan.js +1 -2
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/titan.js.map +1 -1
- package/build/exponentVaults/squadsVaultTxnResolver/utils.d.ts +1 -3
- package/build/exponentVaults/squadsVaultTxnResolver/utils.js +1 -2
- package/build/exponentVaults/squadsVaultTxnResolver/utils.js.map +1 -1
- package/build/exponentVaults/syncTransaction.d.ts +1 -1
- package/build/exponentVaults/syncTransaction.js +4 -4
- package/build/exponentVaults/syncTransaction.js.map +1 -1
- package/build/exponentVaults/titan-quote.js +1 -2
- package/build/exponentVaults/titan-quote.js.map +1 -1
- package/build/exponentVaults/vault-interaction.d.ts +3 -2538
- package/build/exponentVaults/vault-interaction.js +34 -24
- package/build/exponentVaults/vault-interaction.js.map +1 -1
- package/build/exponentVaults/vault.d.ts +9 -25
- package/build/exponentVaults/vault.js +28 -12
- package/build/exponentVaults/vault.js.map +1 -1
- package/build/flavors.js +19 -20
- package/build/flavors.js.map +1 -1
- package/build/index.js +17 -7
- package/build/index.js.map +1 -1
- package/build/market.d.ts +31 -31
- package/build/market.js +17 -7
- package/build/market.js.map +1 -1
- package/build/marketThree.d.ts +42 -48
- package/build/marketThree.js +20 -8
- package/build/marketThree.js.map +1 -1
- package/build/orderbook/codamaEvents.d.ts +1 -2
- package/build/orderbook/index.js +17 -7
- package/build/orderbook/index.js.map +1 -1
- package/build/orderbook/math.d.ts +4 -4
- package/build/orderbook/math.js +13 -13
- package/build/orderbook/math.js.map +1 -1
- package/build/orderbook/orderbook.d.ts +19 -21
- package/build/orderbook/orderbook.js +17 -7
- package/build/orderbook/orderbook.js.map +1 -1
- package/build/orderbook/types.js +17 -7
- package/build/orderbook/types.js.map +1 -1
- package/build/orderbook/utils.js +6 -7
- package/build/orderbook/utils.js.map +1 -1
- package/build/syPosition.js +3 -4
- package/build/syPosition.js.map +1 -1
- package/build/tokenUtil.js +2 -3
- package/build/tokenUtil.js.map +1 -1
- package/build/utils/altUtil.js +2 -3
- package/build/utils/altUtil.js.map +1 -1
- package/build/utils/binSolver.js +1 -2
- package/build/utils/binSolver.js.map +1 -1
- package/build/utils/index.d.ts +2 -2
- package/build/utils/index.js +3 -4
- package/build/utils/index.js.map +1 -1
- package/build/vault.d.ts +11 -12
- package/build/vault.js +20 -10
- package/build/vault.js.map +1 -1
- package/build/ytPosition.d.ts +7 -7
- package/build/ytPosition.js +17 -7
- package/build/ytPosition.js.map +1 -1
- package/package.json +35 -33
- package/build/client/vaults/instructions/proposeAction.d.ts +0 -16
- package/build/client/vaults/instructions/proposeAction.js +0 -29
- package/build/client/vaults/instructions/proposeAction.js.map +0 -1
- package/build/exponentVaults/loopscale/client.test.d.ts +0 -1
- package/build/exponentVaults/loopscale/client.test.js +0 -183
- package/build/exponentVaults/loopscale/client.test.js.map +0 -1
- package/build/exponentVaults/loopscale/prepared-transactions.test.d.ts +0 -1
- package/build/exponentVaults/loopscale/prepared-transactions.test.js +0 -400
- package/build/exponentVaults/loopscale/prepared-transactions.test.js.map +0 -1
- package/build/exponentVaults/loopscale/response-plan.d.ts +0 -69
- package/build/exponentVaults/loopscale/response-plan.js +0 -141
- package/build/exponentVaults/loopscale/response-plan.js.map +0 -1
- package/build/exponentVaults/loopscale/response-plan.test.d.ts +0 -1
- package/build/exponentVaults/loopscale/response-plan.test.js +0 -139
- package/build/exponentVaults/loopscale/response-plan.test.js.map +0 -1
- package/build/exponentVaults/loopscale/send-plan.d.ts +0 -75
- package/build/exponentVaults/loopscale/send-plan.js +0 -235
- package/build/exponentVaults/loopscale/send-plan.js.map +0 -1
- package/build/exponentVaults/loopscale-client.d.ts +0 -130
- package/build/exponentVaults/loopscale-client.js +0 -489
- package/build/exponentVaults/loopscale-client.js.map +0 -1
- package/build/exponentVaults/loopscale-client.test.d.ts +0 -1
- package/build/exponentVaults/loopscale-client.test.js +0 -162
- package/build/exponentVaults/loopscale-client.test.js.map +0 -1
- package/build/exponentVaults/loopscale-client.types.d.ts +0 -425
- package/build/exponentVaults/loopscale-client.types.js +0 -3
- package/build/exponentVaults/loopscale-client.types.js.map +0 -1
- package/build/exponentVaults/loopscale-execution.d.ts +0 -125
- package/build/exponentVaults/loopscale-execution.js +0 -341
- package/build/exponentVaults/loopscale-execution.js.map +0 -1
- package/build/exponentVaults/loopscale-execution.test.d.ts +0 -1
- package/build/exponentVaults/loopscale-execution.test.js +0 -139
- package/build/exponentVaults/loopscale-execution.test.js.map +0 -1
- package/build/exponentVaults/loopscale-vault.d.ts +0 -115
- package/build/exponentVaults/loopscale-vault.js +0 -275
- package/build/exponentVaults/loopscale-vault.js.map +0 -1
- package/build/exponentVaults/loopscale-vault.test.d.ts +0 -1
- package/build/exponentVaults/loopscale-vault.test.js +0 -102
- package/build/exponentVaults/loopscale-vault.test.js.map +0 -1
- package/build/exponentVaults/pricePathResolver.test.d.ts +0 -1
- package/build/exponentVaults/pricePathResolver.test.js +0 -369
- package/build/exponentVaults/pricePathResolver.test.js.map +0 -1
- package/build/exponentVaults/vault-interaction.kamino-vault.test.d.ts +0 -1
- package/build/exponentVaults/vault-interaction.kamino-vault.test.js +0 -143
- package/build/exponentVaults/vault-interaction.kamino-vault.test.js.map +0 -1
- package/build/exponentVaults/vaultTransactionBuilder.test.d.ts +0 -1
- package/build/exponentVaults/vaultTransactionBuilder.test.js +0 -297
- package/build/exponentVaults/vaultTransactionBuilder.test.js.map +0 -1
- package/build/marketThree.test.d.ts +0 -1
- package/build/marketThree.test.js +0 -166
- package/build/marketThree.test.js.map +0 -1
- package/build/utils/binSolver.test.d.ts +0 -1
- package/build/utils/binSolver.test.js +0 -16
- package/build/utils/binSolver.test.js.map +0 -1
- package/jest.config.js +0 -5
- package/src/CodamaEventDecoder.ts +0 -151
- package/src/addressLookupTableUtil.ts +0 -110
- package/src/client/clmm/accounts/lpPosition.ts +0 -143
- package/src/client/clmm/accounts/marketThree.ts +0 -274
- package/src/client/clmm/accounts/vault.ts +0 -234
- package/src/client/clmm/eventRegistry.ts +0 -92
- package/src/client/clmm/index.ts +0 -82
- package/src/client/clmm/instructions/addFarm.ts +0 -57
- package/src/client/clmm/instructions/addLiquidity.ts +0 -78
- package/src/client/clmm/instructions/addMarketEmission.ts +0 -50
- package/src/client/clmm/instructions/buyPt.ts +0 -73
- package/src/client/clmm/instructions/buyYt.ts +0 -80
- package/src/client/clmm/instructions/claimFarmEmission.ts +0 -56
- package/src/client/clmm/instructions/closeMarket.ts +0 -47
- package/src/client/clmm/instructions/depositLiquidity.ts +0 -71
- package/src/client/clmm/instructions/initializeMarket.ts +0 -127
- package/src/client/clmm/instructions/marketAccrueEmission.ts +0 -39
- package/src/client/clmm/instructions/marketCollectEmission.ts +0 -57
- package/src/client/clmm/instructions/modifyFarm.ts +0 -55
- package/src/client/clmm/instructions/modifyMarketSetting.ts +0 -45
- package/src/client/clmm/instructions/sellPt.ts +0 -73
- package/src/client/clmm/instructions/sellYt.ts +0 -80
- package/src/client/clmm/instructions/tradePt.ts +0 -73
- package/src/client/clmm/instructions/tradePtExactOut.ts +0 -75
- package/src/client/clmm/instructions/withdrawLiquidity.ts +0 -67
- package/src/client/clmm/instructions/wrapperBuyYt.ts +0 -85
- package/src/client/clmm/instructions/wrapperProvideLiquidity.ts +0 -100
- package/src/client/clmm/instructions/wrapperProvideLiquidityBase.ts +0 -98
- package/src/client/clmm/instructions/wrapperProvideLiquidityClassic.ts +0 -86
- package/src/client/clmm/instructions/wrapperSellYt.ts +0 -83
- package/src/client/clmm/instructions/wrapperWithdrawLiquidity.ts +0 -75
- package/src/client/clmm/instructions/wrapperWithdrawLiquidityClassic.ts +0 -69
- package/src/client/clmm/types/addFarmEvent.ts +0 -51
- package/src/client/clmm/types/amount.ts +0 -51
- package/src/client/clmm/types/buyPtEvent.ts +0 -36
- package/src/client/clmm/types/buyYtEvent.ts +0 -74
- package/src/client/clmm/types/claimFarmEmissionsEvent.ts +0 -94
- package/src/client/clmm/types/claimLimits.ts +0 -15
- package/src/client/clmm/types/closeMarketEvent.ts +0 -36
- package/src/client/clmm/types/configurationOptions.ts +0 -29
- package/src/client/clmm/types/cpiAccounts.ts +0 -21
- package/src/client/clmm/types/cpiCoreAccounts.ts +0 -15
- package/src/client/clmm/types/cpiInterfaceContext.ts +0 -13
- package/src/client/clmm/types/crossingSplit.ts +0 -40
- package/src/client/clmm/types/depositLiquidityEvent.ts +0 -93
- package/src/client/clmm/types/depositLiquidityReturnData.ts +0 -81
- package/src/client/clmm/types/emissionInfo.ts +0 -44
- package/src/client/clmm/types/farmEmission.ts +0 -31
- package/src/client/clmm/types/index.ts +0 -48
- package/src/client/clmm/types/liquidityNetBalanceLimits.ts +0 -22
- package/src/client/clmm/types/lpFarm.ts +0 -12
- package/src/client/clmm/types/marketAccrueEmissionEvent.ts +0 -69
- package/src/client/clmm/types/marketAdminAction.ts +0 -239
- package/src/client/clmm/types/marketCollectEmissionEvent.ts +0 -83
- package/src/client/clmm/types/marketEmission.ts +0 -28
- package/src/client/clmm/types/marketEmissions.ts +0 -10
- package/src/client/clmm/types/marketFinancials.ts +0 -17
- package/src/client/clmm/types/marketThreeInitEvent.ts +0 -92
- package/src/client/clmm/types/mergeEvent.ts +0 -118
- package/src/client/clmm/types/modifiedTick.ts +0 -13
- package/src/client/clmm/types/modifiedTicks.ts +0 -18
- package/src/client/clmm/types/modifyFarmEvent.ts +0 -56
- package/src/client/clmm/types/number.ts +0 -7
- package/src/client/clmm/types/personalYieldTracker.ts +0 -12
- package/src/client/clmm/types/personalYieldTrackers.ts +0 -13
- package/src/client/clmm/types/principalShare.ts +0 -22
- package/src/client/clmm/types/principalShareTrackers.ts +0 -10
- package/src/client/clmm/types/sellPtEvent.ts +0 -36
- package/src/client/clmm/types/sellYtEvent.ts +0 -69
- package/src/client/clmm/types/stripEvent.ts +0 -124
- package/src/client/clmm/types/swapDirection.ts +0 -8
- package/src/client/clmm/types/tradePtEvent.ts +0 -76
- package/src/client/clmm/types/withdrawLiquidityEvent.ts +0 -99
- package/src/client/clmm/types/withdrawLiquidityReturnData.ts +0 -27
- package/src/client/clmm/types/wrapperBuyYtEvent.ts +0 -36
- package/src/client/clmm/types/wrapperProvideLiquidityBaseEvent.ts +0 -60
- package/src/client/clmm/types/wrapperProvideLiquidityClassicEvent.ts +0 -58
- package/src/client/clmm/types/wrapperProvideLiquidityEvent.ts +0 -60
- package/src/client/clmm/types/wrapperSellYtEvent.ts +0 -36
- package/src/client/clmm/types/wrapperWithdrawLiquidityClassicEvent.ts +0 -62
- package/src/client/clmm/types/wrapperWithdrawLiquidityEvent.ts +0 -62
- package/src/client/core/accounts/admin.ts +0 -112
- package/src/client/core/accounts/lpPosition.ts +0 -122
- package/src/client/core/accounts/marketTwo.ts +0 -234
- package/src/client/core/accounts/vault.ts +0 -234
- package/src/client/core/accounts/yieldTokenPosition.ts +0 -126
- package/src/client/core/eventRegistry.ts +0 -134
- package/src/client/core/index.ts +0 -113
- package/src/client/core/instructions/addEmission.ts +0 -62
- package/src/client/core/instructions/addFarm.ts +0 -53
- package/src/client/core/instructions/addLpTokensMetadata.ts +0 -62
- package/src/client/core/instructions/addMarketEmission.ts +0 -52
- package/src/client/core/instructions/buyYt.ts +0 -79
- package/src/client/core/instructions/claimFarmEmissions.ts +0 -54
- package/src/client/core/instructions/collectEmission.ts +0 -66
- package/src/client/core/instructions/collectInterest.ts +0 -64
- package/src/client/core/instructions/collectTreasuryEmission.ts +0 -64
- package/src/client/core/instructions/collectTreasuryInterest.ts +0 -62
- package/src/client/core/instructions/depositYt.ts +0 -59
- package/src/client/core/instructions/initLpPosition.ts +0 -35
- package/src/client/core/instructions/initMarketTwo.ts +0 -103
- package/src/client/core/instructions/initializeVault.ts +0 -107
- package/src/client/core/instructions/initializeYieldPosition.ts +0 -33
- package/src/client/core/instructions/marketCollectEmission.ts +0 -55
- package/src/client/core/instructions/marketDepositLp.ts +0 -59
- package/src/client/core/instructions/marketTwoDepositLiquidity.ts +0 -65
- package/src/client/core/instructions/marketTwoWithdrawLiquidity.ts +0 -65
- package/src/client/core/instructions/marketWithdrawLp.ts +0 -59
- package/src/client/core/instructions/merge.ts +0 -61
- package/src/client/core/instructions/modifyFarm.ts +0 -51
- package/src/client/core/instructions/modifyMarketSetting.ts +0 -47
- package/src/client/core/instructions/modifyVaultSetting.ts +0 -44
- package/src/client/core/instructions/reallocMarket.ts +0 -45
- package/src/client/core/instructions/sellYt.ts +0 -79
- package/src/client/core/instructions/stageYtYield.ts +0 -39
- package/src/client/core/instructions/strip.ts +0 -61
- package/src/client/core/instructions/tradePt.ts +0 -59
- package/src/client/core/instructions/withdrawYt.ts +0 -61
- package/src/client/core/instructions/wrapperBuyPt.ts +0 -63
- package/src/client/core/instructions/wrapperBuyYt.ts +0 -93
- package/src/client/core/instructions/wrapperCollectInterest.ts +0 -63
- package/src/client/core/instructions/wrapperMerge.ts +0 -77
- package/src/client/core/instructions/wrapperProvideLiquidity.ts +0 -103
- package/src/client/core/instructions/wrapperProvideLiquidityBase.ts +0 -81
- package/src/client/core/instructions/wrapperProvideLiquidityClassic.ts +0 -77
- package/src/client/core/instructions/wrapperSellPt.ts +0 -63
- package/src/client/core/instructions/wrapperSellYt.ts +0 -87
- package/src/client/core/instructions/wrapperStrip.ts +0 -81
- package/src/client/core/instructions/wrapperWithdrawLiquidity.ts +0 -77
- package/src/client/core/instructions/wrapperWithdrawLiquidityClassic.ts +0 -73
- package/src/client/core/types/adminAction.ts +0 -255
- package/src/client/core/types/amount.ts +0 -51
- package/src/client/core/types/buyPtEvent.ts +0 -39
- package/src/client/core/types/buyYtEvent.ts +0 -95
- package/src/client/core/types/claimFarmEmissionsEvent.ts +0 -75
- package/src/client/core/types/claimFarmEmissionsEventV2.ts +0 -83
- package/src/client/core/types/claimLimits.ts +0 -15
- package/src/client/core/types/collectEmissionEvent.ts +0 -51
- package/src/client/core/types/collectEmissionEventV2.ts +0 -60
- package/src/client/core/types/collectInterestEvent.ts +0 -48
- package/src/client/core/types/collectInterestEventV2.ts +0 -57
- package/src/client/core/types/collectTreasuryEmissionKind.ts +0 -8
- package/src/client/core/types/collectTreasuryInterestKind.ts +0 -8
- package/src/client/core/types/cpiAccounts.ts +0 -21
- package/src/client/core/types/cpiInterfaceContext.ts +0 -13
- package/src/client/core/types/depositLiquidityEvent.ts +0 -101
- package/src/client/core/types/depositLpEvent.ts +0 -75
- package/src/client/core/types/depositLpEventV2.ts +0 -83
- package/src/client/core/types/depositYtEvent.ts +0 -82
- package/src/client/core/types/depositYtEventV2.ts +0 -91
- package/src/client/core/types/emissionInfo.ts +0 -44
- package/src/client/core/types/farmEmission.ts +0 -31
- package/src/client/core/types/index.ts +0 -60
- package/src/client/core/types/initLpPositionEvent.ts +0 -57
- package/src/client/core/types/initializeYieldPositionEvent.ts +0 -43
- package/src/client/core/types/liquidityNetBalanceLimits.ts +0 -22
- package/src/client/core/types/lpFarm.ts +0 -12
- package/src/client/core/types/marketAdminAction.ts +0 -212
- package/src/client/core/types/marketCollectEmissionEvent.ts +0 -67
- package/src/client/core/types/marketCollectEmissionEventV2.ts +0 -75
- package/src/client/core/types/marketEmission.ts +0 -28
- package/src/client/core/types/marketEmissions.ts +0 -10
- package/src/client/core/types/marketFinancials.ts +0 -19
- package/src/client/core/types/mergeEvent.ts +0 -118
- package/src/client/core/types/number.ts +0 -7
- package/src/client/core/types/personalYieldTracker.ts +0 -12
- package/src/client/core/types/personalYieldTrackers.ts +0 -13
- package/src/client/core/types/principleDetails.ts +0 -25
- package/src/client/core/types/principles.ts +0 -23
- package/src/client/core/types/sellPtEvent.ts +0 -39
- package/src/client/core/types/sellYtEvent.ts +0 -90
- package/src/client/core/types/stageYieldEvent.ts +0 -63
- package/src/client/core/types/stageYieldEventV2.ts +0 -69
- package/src/client/core/types/stripEvent.ts +0 -124
- package/src/client/core/types/tradePtEvent.ts +0 -80
- package/src/client/core/types/withdrawLiquidityEvent.ts +0 -97
- package/src/client/core/types/withdrawLpEvent.ts +0 -75
- package/src/client/core/types/withdrawLpEventV2.ts +0 -83
- package/src/client/core/types/withdrawYtEvent.ts +0 -82
- package/src/client/core/types/withdrawYtEventV2.ts +0 -91
- package/src/client/core/types/wrapperBuyYtEvent.ts +0 -39
- package/src/client/core/types/wrapperCollectInterestEvent.ts +0 -37
- package/src/client/core/types/wrapperMergeEvent.ts +0 -38
- package/src/client/core/types/wrapperProvideLiquidityBaseEvent.ts +0 -43
- package/src/client/core/types/wrapperProvideLiquidityClassicEvent.ts +0 -41
- package/src/client/core/types/wrapperProvideLiquidityEvent.ts +0 -41
- package/src/client/core/types/wrapperSellYtEvent.ts +0 -39
- package/src/client/core/types/wrapperStripEvent.ts +0 -38
- package/src/client/core/types/wrapperWithdrawLiquidityClassicEvent.ts +0 -41
- package/src/client/core/types/wrapperWithdrawLiquidityEvent.ts +0 -39
- package/src/client/core/types/yieldTokenTracker.ts +0 -12
- package/src/client/orderbook/accounts/cpiAccountsOrderbook.ts +0 -101
- package/src/client/orderbook/accounts/vault.ts +0 -234
- package/src/client/orderbook/eventRegistry.ts +0 -71
- package/src/client/orderbook/index.ts +0 -55
- package/src/client/orderbook/instructions/collectAdminEmission.ts +0 -48
- package/src/client/orderbook/instructions/collectAdminFee.ts +0 -59
- package/src/client/orderbook/instructions/collectInterest.ts +0 -66
- package/src/client/orderbook/instructions/initializeOrderbook.ts +0 -104
- package/src/client/orderbook/instructions/marketOffer.ts +0 -89
- package/src/client/orderbook/instructions/postOffer.ts +0 -96
- package/src/client/orderbook/instructions/reallocOrderbookAccount.ts +0 -45
- package/src/client/orderbook/instructions/removeExpiredOffers.ts +0 -37
- package/src/client/orderbook/instructions/removeOffer.ts +0 -73
- package/src/client/orderbook/instructions/setConfigurationOptions.ts +0 -43
- package/src/client/orderbook/instructions/withdrawFunds.ts +0 -78
- package/src/client/orderbook/instructions/wrapperCollectAdminFee.ts +0 -73
- package/src/client/orderbook/instructions/wrapperCollectInterest.ts +0 -65
- package/src/client/orderbook/instructions/wrapperMarketOffer.ts +0 -94
- package/src/client/orderbook/instructions/wrapperPostOffer.ts +0 -99
- package/src/client/orderbook/instructions/wrapperRemoveOffer.ts +0 -75
- package/src/client/orderbook/instructions/wrapperWithdrawFunds.ts +0 -80
- package/src/client/orderbook/types/amount.ts +0 -51
- package/src/client/orderbook/types/claimLimits.ts +0 -15
- package/src/client/orderbook/types/collectAdminEmissionEvent.ts +0 -39
- package/src/client/orderbook/types/collectAdminFeeEvent.ts +0 -17
- package/src/client/orderbook/types/collectEmissionEventV2.ts +0 -60
- package/src/client/orderbook/types/collectInterestEventV2.ts +0 -57
- package/src/client/orderbook/types/collectUserInterestEvent.ts +0 -36
- package/src/client/orderbook/types/cpiAccounts.ts +0 -21
- package/src/client/orderbook/types/cpiInterfaceContext.ts +0 -13
- package/src/client/orderbook/types/emissionInfo.ts +0 -44
- package/src/client/orderbook/types/exponentCoreCpiAccounts.ts +0 -21
- package/src/client/orderbook/types/filledOffersEvent.ts +0 -19
- package/src/client/orderbook/types/index.ts +0 -30
- package/src/client/orderbook/types/marketOfferEvent.ts +0 -72
- package/src/client/orderbook/types/mergeEvent.ts +0 -118
- package/src/client/orderbook/types/number.ts +0 -7
- package/src/client/orderbook/types/offerOptions.ts +0 -56
- package/src/client/orderbook/types/offerType.ts +0 -8
- package/src/client/orderbook/types/orderbookInitEvent.ts +0 -54
- package/src/client/orderbook/types/postOfferEvent.ts +0 -78
- package/src/client/orderbook/types/removeOfferEvent.ts +0 -67
- package/src/client/orderbook/types/setConfigurationOptionsEnum.ts +0 -116
- package/src/client/orderbook/types/stripEvent.ts +0 -124
- package/src/client/orderbook/types/withdrawFundsEvent.ts +0 -65
- package/src/client/orderbook/types/wrapperCollectAdminFeeEvent.ts +0 -13
- package/src/client/orderbook/types/wrapperCollectInterestEvent.ts +0 -25
- package/src/client/orderbook/types/wrapperMarketOfferEvent.ts +0 -27
- package/src/client/orderbook/types/wrapperPostOfferEvent.ts +0 -72
- package/src/client/orderbook/types/wrapperRemoveOfferEvent.ts +0 -25
- package/src/client/orderbook/types/wrapperWithdrawFundsEvent.ts +0 -38
- package/src/client/orderbook/types/yieldTokenTracker.ts +0 -12
- package/src/client/vaults/accounts/actionProposal.ts +0 -144
- package/src/client/vaults/accounts/exponentStrategyVault.ts +0 -211
- package/src/client/vaults/accounts/programConfig.ts +0 -123
- package/src/client/vaults/accounts/voteAccount.ts +0 -132
- package/src/client/vaults/accounts/withdrawalAccount.ts +0 -132
- package/src/client/vaults/eventRegistry.ts +0 -45
- package/src/client/vaults/index.ts +0 -113
- package/src/client/vaults/instructions/activateProposal.ts +0 -46
- package/src/client/vaults/instructions/addPolicy.ts +0 -57
- package/src/client/vaults/instructions/appendProposalActions.ts +0 -47
- package/src/client/vaults/instructions/cancelProposal.ts +0 -28
- package/src/client/vaults/instructions/cancelWithdrawal.ts +0 -34
- package/src/client/vaults/instructions/collectManagementFee.ts +0 -32
- package/src/client/vaults/instructions/depositLiquidity.ts +0 -62
- package/src/client/vaults/instructions/executeProposal.ts +0 -36
- package/src/client/vaults/instructions/executeWithdrawal.ts +0 -58
- package/src/client/vaults/instructions/executeWithdrawalFromReserves.ts +0 -66
- package/src/client/vaults/instructions/fillWithdrawal.ts +0 -59
- package/src/client/vaults/instructions/finalizeProposal.ts +0 -28
- package/src/client/vaults/instructions/initProposal.ts +0 -46
- package/src/client/vaults/instructions/initializePrices.ts +0 -28
- package/src/client/vaults/instructions/initializeVault.ts +0 -148
- package/src/client/vaults/instructions/makeSentienelManager.ts +0 -28
- package/src/client/vaults/instructions/managePrices.ts +0 -46
- package/src/client/vaults/instructions/manageVaultSettings.ts +0 -48
- package/src/client/vaults/instructions/managerUpdatePosition.ts +0 -45
- package/src/client/vaults/instructions/queueWithdrawal.ts +0 -50
- package/src/client/vaults/instructions/removePolicy.ts +0 -44
- package/src/client/vaults/instructions/sentinelSetVaultFlags.ts +0 -44
- package/src/client/vaults/instructions/stakeVote.ts +0 -57
- package/src/client/vaults/instructions/unstakeVote.ts +0 -42
- package/src/client/vaults/instructions/updatePolicy.ts +0 -59
- package/src/client/vaults/instructions/updatePolicyManager.ts +0 -44
- package/src/client/vaults/instructions/updatePrice.ts +0 -42
- package/src/client/vaults/instructions/validateInteractionHook.ts +0 -60
- package/src/client/vaults/instructions/wrapperAddPolicy.ts +0 -57
- package/src/client/vaults/instructions/wrapperExecuteWithdrawal.ts +0 -76
- package/src/client/vaults/instructions/wrapperManageVaultSettings.ts +0 -48
- package/src/client/vaults/instructions/wrapperManagerUpdatePosition.ts +0 -45
- package/src/client/vaults/instructions/wrapperRemovePolicy.ts +0 -44
- package/src/client/vaults/instructions/wrapperUpdatePolicy.ts +0 -59
- package/src/client/vaults/types/accountConstraint.ts +0 -35
- package/src/client/vaults/types/accountConstraintType.ts +0 -93
- package/src/client/vaults/types/allowedSettingsChange.ts +0 -136
- package/src/client/vaults/types/cancelProposalEvent.ts +0 -47
- package/src/client/vaults/types/clmmPositionEntry.ts +0 -37
- package/src/client/vaults/types/dataConstraint.ts +0 -16
- package/src/client/vaults/types/dataOperator.ts +0 -13
- package/src/client/vaults/types/dataValue.ts +0 -119
- package/src/client/vaults/types/depositLiquidityEvent.ts +0 -89
- package/src/client/vaults/types/executeProposalEvent.ts +0 -47
- package/src/client/vaults/types/executeWithdrawalEvent.ts +0 -12
- package/src/client/vaults/types/fillParam.ts +0 -12
- package/src/client/vaults/types/finalizeProposalEvent.ts +0 -51
- package/src/client/vaults/types/hook.ts +0 -40
- package/src/client/vaults/types/hookCompiledInstruction.ts +0 -20
- package/src/client/vaults/types/index.ts +0 -68
- package/src/client/vaults/types/instructionConstraint.ts +0 -33
- package/src/client/vaults/types/internalFundTransferPolicyCreationPayload.ts +0 -35
- package/src/client/vaults/types/kaminoFarmEntry.ts +0 -32
- package/src/client/vaults/types/kaminoObligationEntry.ts +0 -51
- package/src/client/vaults/types/limitedQuantityConstraints.ts +0 -10
- package/src/client/vaults/types/limitedSpendingLimit.ts +0 -35
- package/src/client/vaults/types/limitedTimeConstraints.ts +0 -15
- package/src/client/vaults/types/loopscaleLoanEntry.ts +0 -23
- package/src/client/vaults/types/loopscaleStrategyEntry.ts +0 -23
- package/src/client/vaults/types/number.ts +0 -8
- package/src/client/vaults/types/obligationType.ts +0 -63
- package/src/client/vaults/types/orderbookEntry.ts +0 -50
- package/src/client/vaults/types/periodV2.ts +0 -76
- package/src/client/vaults/types/permissions.ts +0 -8
- package/src/client/vaults/types/policyAction.ts +0 -74
- package/src/client/vaults/types/policyConfig.ts +0 -32
- package/src/client/vaults/types/policyCreationPayload.ts +0 -147
- package/src/client/vaults/types/policyExpirationArgs.ts +0 -67
- package/src/client/vaults/types/positionUpdate.ts +0 -313
- package/src/client/vaults/types/priceId.ts +0 -57
- package/src/client/vaults/types/priceType.ts +0 -23
- package/src/client/vaults/types/programInteractionPolicyCreationPayload.ts +0 -32
- package/src/client/vaults/types/proposalAction.ts +0 -97
- package/src/client/vaults/types/proposalActionKind.ts +0 -11
- package/src/client/vaults/types/proposalStatus.ts +0 -13
- package/src/client/vaults/types/proposalVoteConfig.ts +0 -36
- package/src/client/vaults/types/proposeActionEvent.ts +0 -62
- package/src/client/vaults/types/quantityConstraints.ts +0 -14
- package/src/client/vaults/types/reserveFarmMapping.ts +0 -35
- package/src/client/vaults/types/reservePriceMapping.ts +0 -26
- package/src/client/vaults/types/settingsChangePolicyCreationPayload.ts +0 -14
- package/src/client/vaults/types/spendingLimitPolicyCreationPayload.ts +0 -54
- package/src/client/vaults/types/stakeVoteEvent.ts +0 -54
- package/src/client/vaults/types/strategyPosition.ts +0 -178
- package/src/client/vaults/types/timeConstraints.ts +0 -22
- package/src/client/vaults/types/tokenAccountBalance.ts +0 -35
- package/src/client/vaults/types/tokenAccountEntry.ts +0 -30
- package/src/client/vaults/types/tokenEntry.ts +0 -48
- package/src/client/vaults/types/unstakeVoteEvent.ts +0 -53
- package/src/client/vaults/types/updatePriceAction.ts +0 -268
- package/src/client/vaults/types/updatePriceInput.ts +0 -12
- package/src/client/vaults/types/usageState.ts +0 -12
- package/src/client/vaults/types/vaultConfig.ts +0 -38
- package/src/client/vaults/types/vaultFinancials.ts +0 -40
- package/src/client/vaults/types/vaultFlagAction.ts +0 -75
- package/src/client/vaults/types/vaultFlagsUpdatedEvent.ts +0 -37
- package/src/client/vaults/types/vaultRoleKind.ts +0 -11
- package/src/client/vaults/types/vaultRoles.ts +0 -59
- package/src/client/vaults/types/vaultSettingsAction.ts +0 -533
- package/src/client/vaults/types/voteChoice.ts +0 -9
- package/src/client/vaults/types/withdrawalPeriodSettings.ts +0 -83
- package/src/client/vaults/types/withdrawalTokenFill.ts +0 -35
- package/src/client/vaults/types/yieldPositionEntry.ts +0 -35
- package/src/clmm/codamaEvents.ts +0 -34
- package/src/clmm/index.ts +0 -1
- package/src/codamaEvents.ts +0 -27
- package/src/environment.ts +0 -21
- package/src/exponentVaults/aumCalculator.ts +0 -1350
- package/src/exponentVaults/events.ts +0 -15
- package/src/exponentVaults/fetcher.ts +0 -257
- package/src/exponentVaults/index.ts +0 -323
- package/src/exponentVaults/kamino-farms.ts +0 -538
- package/src/exponentVaults/kamino-markets.ts +0 -363
- package/src/exponentVaults/loopscale/client.ts +0 -808
- package/src/exponentVaults/loopscale/helpers.ts +0 -172
- package/src/exponentVaults/loopscale/index.ts +0 -57
- package/src/exponentVaults/loopscale/prepared-transactions.ts +0 -435
- package/src/exponentVaults/loopscale/prepared-types.ts +0 -73
- package/src/exponentVaults/loopscale/types.ts +0 -466
- package/src/exponentVaults/policyBuilders.ts +0 -1729
- package/src/exponentVaults/policyMatcher.ts +0 -895
- package/src/exponentVaults/pricePathResolver.test.ts +0 -466
- package/src/exponentVaults/pricePathResolver.ts +0 -273
- package/src/exponentVaults/scope-refresh.ts +0 -169
- package/src/exponentVaults/squadsVaultTxnResolver/constants.ts +0 -59
- package/src/exponentVaults/squadsVaultTxnResolver/helpers.ts +0 -355
- package/src/exponentVaults/squadsVaultTxnResolver/index.ts +0 -16
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.ts +0 -472
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.ts +0 -33
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/index.ts +0 -38
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.ts +0 -83
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.ts +0 -94
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/titan.ts +0 -41
- package/src/exponentVaults/squadsVaultTxnResolver/squadsVaultTxnResolver.ts +0 -91
- package/src/exponentVaults/squadsVaultTxnResolver/types.ts +0 -171
- package/src/exponentVaults/squadsVaultTxnResolver/utils.ts +0 -3
- package/src/exponentVaults/syncTransaction.ts +0 -500
- package/src/exponentVaults/titan-quote.ts +0 -446
- package/src/exponentVaults/vault-instruction-types.ts +0 -493
- package/src/exponentVaults/vault-interaction.kamino-vault.test.ts +0 -149
- package/src/exponentVaults/vault-interaction.ts +0 -5498
- package/src/exponentVaults/vault.ts +0 -2667
- package/src/exponentVaults/vaultTransactionBuilder.test.ts +0 -349
- package/src/exponentVaults/vaultTransactionBuilder.ts +0 -933
- package/src/flavors.ts +0 -841
- package/src/index.ts +0 -26
- package/src/lpPosition.ts +0 -155
- package/src/market.ts +0 -2432
- package/src/marketThree.test.ts +0 -210
- package/src/marketThree.ts +0 -2861
- package/src/orderbook/codamaEvents.ts +0 -28
- package/src/orderbook/index.ts +0 -13
- package/src/orderbook/math.ts +0 -138
- package/src/orderbook/orderbook.ts +0 -1354
- package/src/orderbook/types.ts +0 -40
- package/src/orderbook/utils.ts +0 -66
- package/src/router.ts +0 -810
- package/src/syPosition.ts +0 -182
- package/src/tokenUtil.ts +0 -23
- package/src/utils/altUtil.ts +0 -52
- package/src/utils/binSolver.test.ts +0 -17
- package/src/utils/binSolver.ts +0 -44
- package/src/utils/index.ts +0 -33
- package/src/utils/ix.ts +0 -7
- package/src/vault.ts +0 -1033
- package/src/ytPosition.ts +0 -319
- package/tsconfig.json +0 -46
|
@@ -1,1729 +0,0 @@
|
|
|
1
|
-
import { PublicKey } from "@solana/web3.js"
|
|
2
|
-
|
|
3
|
-
import { AccountConstraint, DataConstraint, InstructionConstraint, PolicyConfig, SpendingLimit } from "./vault"
|
|
4
|
-
|
|
5
|
-
// ============================================================================
|
|
6
|
-
// Known Program IDs
|
|
7
|
-
// ============================================================================
|
|
8
|
-
|
|
9
|
-
export const KAMINO_LENDING_PROGRAM_ID = new PublicKey("KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD")
|
|
10
|
-
export const KAMINO_VAULT_PROGRAM_ID = new PublicKey("KvauGMspG5k6rtzrqqn7WNn3oZdyKqLKwK2XWQ8FLjd")
|
|
11
|
-
export const KAMINO_FARMS_PROGRAM_ID = new PublicKey("FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr")
|
|
12
|
-
|
|
13
|
-
// ============================================================================
|
|
14
|
-
// Instruction Discriminators (first 8 bytes of sha256("global:<method_name>"))
|
|
15
|
-
// ============================================================================
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Common Kamino Lending instruction discriminators.
|
|
19
|
-
* These can be used for data constraints to match specific instructions.
|
|
20
|
-
*/
|
|
21
|
-
export const KAMINO_DISCRIMINATORS = {
|
|
22
|
-
initUserMetadata: Buffer.from([117, 169, 176, 69, 197, 23, 15, 162]),
|
|
23
|
-
depositReserveLiquidity: Buffer.from([171, 234, 45, 51, 25, 117, 180, 182]),
|
|
24
|
-
depositReserveLiquidityAndObligationCollateral: Buffer.from([129, 199, 4, 2, 222, 39, 26, 46]),
|
|
25
|
-
depositReserveLiquidityAndObligationCollateralV2: Buffer.from([216, 224, 191, 27, 204, 151, 102, 175]),
|
|
26
|
-
withdrawObligationCollateralAndRedeemReserveCollateral: Buffer.from([75, 93, 93, 220, 34, 150, 218, 196]),
|
|
27
|
-
withdrawObligationCollateralAndRedeemReserveCollateralV2: Buffer.from([235, 52, 119, 152, 149, 197, 20, 7]),
|
|
28
|
-
borrowObligationLiquidity: Buffer.from([121, 127, 18, 204, 73, 245, 225, 65]),
|
|
29
|
-
borrowObligationLiquidityV2: Buffer.from([161, 128, 143, 245, 171, 199, 194, 6]),
|
|
30
|
-
repayObligationLiquidity: Buffer.from([145, 178, 13, 225, 76, 240, 147, 72]),
|
|
31
|
-
repayObligationLiquidityV2: Buffer.from([116, 174, 213, 76, 180, 53, 210, 144]),
|
|
32
|
-
initObligation: Buffer.from([251, 10, 231, 76, 27, 11, 159, 96]),
|
|
33
|
-
initObligationFarmsForReserve: Buffer.from([1, 152, 226, 239, 191, 47, 250, 194]),
|
|
34
|
-
refreshReserve: Buffer.from([2, 218, 138, 235, 79, 201, 25, 102]),
|
|
35
|
-
refreshObligation: Buffer.from([33, 132, 147, 228, 151, 192, 72, 89]),
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const KAMINO_VAULT_DISCRIMINATORS = {
|
|
39
|
-
deposit: Buffer.from([242, 35, 198, 137, 82, 225, 242, 182]),
|
|
40
|
-
withdraw: Buffer.from([183, 18, 70, 156, 148, 109, 161, 34]),
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export const KAMINO_FARM_DISCRIMINATORS = {
|
|
44
|
-
initializeUser: Buffer.from([111, 17, 185, 250, 60, 122, 38, 254]),
|
|
45
|
-
stake: Buffer.from([206, 176, 202, 18, 200, 209, 179, 108]),
|
|
46
|
-
unstake: Buffer.from([90, 95, 107, 42, 205, 124, 50, 225]),
|
|
47
|
-
withdrawUnstakedDeposits: Buffer.from([36, 102, 187, 49, 220, 36, 132, 67]),
|
|
48
|
-
harvestReward: Buffer.from([68, 200, 228, 233, 184, 32, 226, 188]),
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// ============================================================================
|
|
52
|
-
// Policy Builder Functions
|
|
53
|
-
// ============================================================================
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Creates a basic ProgramInteraction policy configuration.
|
|
57
|
-
*/
|
|
58
|
-
export function createProgramInteractionPolicy(params: {
|
|
59
|
-
/** Index of the vault account that will sign (typically 0) */
|
|
60
|
-
accountIndex?: number
|
|
61
|
-
/** Instruction constraints (which programs/instructions are allowed) */
|
|
62
|
-
instructionsConstraints: InstructionConstraint[]
|
|
63
|
-
/** Spending limits (optional) */
|
|
64
|
-
spendingLimits?: SpendingLimit[]
|
|
65
|
-
/** Threshold (number of signers required, typically 1) */
|
|
66
|
-
threshold?: number
|
|
67
|
-
/** Time lock in seconds (typically 0 for instant execution) */
|
|
68
|
-
timeLock?: number
|
|
69
|
-
}): PolicyConfig {
|
|
70
|
-
return {
|
|
71
|
-
policyType: {
|
|
72
|
-
programInteraction: {
|
|
73
|
-
accountIndex: params.accountIndex ?? 0,
|
|
74
|
-
instructionsConstraints: params.instructionsConstraints,
|
|
75
|
-
spendingLimits: params.spendingLimits ?? [],
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
threshold: params.threshold ?? 1,
|
|
79
|
-
timeLock: params.timeLock ?? 0,
|
|
80
|
-
startTimestamp: null,
|
|
81
|
-
expiration: null,
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Creates an instruction constraint for a specific program.
|
|
87
|
-
*/
|
|
88
|
-
export function createInstructionConstraint(params: {
|
|
89
|
-
programId: PublicKey
|
|
90
|
-
accountConstraints?: AccountConstraint[]
|
|
91
|
-
dataConstraints?: DataConstraint[]
|
|
92
|
-
}): InstructionConstraint {
|
|
93
|
-
return {
|
|
94
|
-
programId: params.programId,
|
|
95
|
-
accountConstraints: params.accountConstraints ?? [],
|
|
96
|
-
dataConstraints: params.dataConstraints ?? [],
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Creates an account constraint for a specific account index.
|
|
102
|
-
*/
|
|
103
|
-
export function createAccountConstraint(accountIndex: number, allowedKeys: PublicKey[]): AccountConstraint {
|
|
104
|
-
return {
|
|
105
|
-
accountIndex,
|
|
106
|
-
accountKeys: allowedKeys,
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Creates an account-data constraint for a specific account index.
|
|
112
|
-
*/
|
|
113
|
-
export function createAccountDataConstraint(accountIndex: number, accountDataConstraints: DataConstraint[]): AccountConstraint {
|
|
114
|
-
return {
|
|
115
|
-
accountIndex,
|
|
116
|
-
accountDataConstraints,
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Creates a data constraint to match instruction discriminator (first 8 bytes).
|
|
122
|
-
*/
|
|
123
|
-
export function createDiscriminatorConstraint(discriminator: Buffer | number[]): DataConstraint {
|
|
124
|
-
return {
|
|
125
|
-
dataOffset: 0n,
|
|
126
|
-
dataValue: { u8Slice: Array.from(discriminator) },
|
|
127
|
-
operator: "Equals",
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// ============================================================================
|
|
132
|
-
// Kamino Lending Policy Builders
|
|
133
|
-
// ============================================================================
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Account indices in Kamino Lending instructions
|
|
137
|
-
*/
|
|
138
|
-
export const KAMINO_ACCOUNT_INDICES = {
|
|
139
|
-
initObligation: {
|
|
140
|
-
owner: 0,
|
|
141
|
-
feePayer: 1,
|
|
142
|
-
obligation: 2,
|
|
143
|
-
lendingMarket: 3,
|
|
144
|
-
seed1Account: 4,
|
|
145
|
-
seed2Account: 5,
|
|
146
|
-
ownerUserMetadata: 6,
|
|
147
|
-
rent: 7,
|
|
148
|
-
systemProgram: 8,
|
|
149
|
-
},
|
|
150
|
-
// depositReserveLiquidityAndObligationCollateral
|
|
151
|
-
depositCollateral: {
|
|
152
|
-
owner: 0,
|
|
153
|
-
obligation: 1,
|
|
154
|
-
lendingMarket: 2,
|
|
155
|
-
lendingMarketAuthority: 3,
|
|
156
|
-
reserve: 4,
|
|
157
|
-
reserveLiquidityMint: 5,
|
|
158
|
-
reserveLiquiditySupply: 6,
|
|
159
|
-
reserveCollateralMint: 7,
|
|
160
|
-
reserveDestinationDepositCollateral: 8,
|
|
161
|
-
obligationCollateralTokenAccount: 9,
|
|
162
|
-
userSourceLiquidity: 10,
|
|
163
|
-
placeholderUserDestinationCollateral: 11,
|
|
164
|
-
collateralTokenProgram: 12,
|
|
165
|
-
liquidityTokenProgram: 13,
|
|
166
|
-
instructionSysvarAccount: 14,
|
|
167
|
-
},
|
|
168
|
-
// withdrawObligationCollateralAndRedeemReserveCollateral
|
|
169
|
-
withdrawCollateral: {
|
|
170
|
-
owner: 0,
|
|
171
|
-
obligation: 1,
|
|
172
|
-
lendingMarket: 2,
|
|
173
|
-
lendingMarketAuthority: 3,
|
|
174
|
-
withdrawReserve: 4,
|
|
175
|
-
reserveLiquidityMint: 5,
|
|
176
|
-
reserveSourceCollateral: 6,
|
|
177
|
-
reserveCollateralMint: 7,
|
|
178
|
-
reserveLiquiditySupply: 8,
|
|
179
|
-
userDestinationLiquidity: 9,
|
|
180
|
-
placeholderUserDestinationCollateral: 10,
|
|
181
|
-
obligationCollateralTokenAccount: 11,
|
|
182
|
-
collateralTokenProgram: 12,
|
|
183
|
-
liquidityTokenProgram: 13,
|
|
184
|
-
instructionSysvarAccount: 14,
|
|
185
|
-
},
|
|
186
|
-
// borrowObligationLiquidity
|
|
187
|
-
borrow: {
|
|
188
|
-
owner: 0,
|
|
189
|
-
obligation: 1,
|
|
190
|
-
lendingMarket: 2,
|
|
191
|
-
lendingMarketAuthority: 3,
|
|
192
|
-
borrowReserve: 4,
|
|
193
|
-
borrowReserveLiquidityMint: 5,
|
|
194
|
-
reserveSourceLiquidity: 6,
|
|
195
|
-
borrowReserveLiquidityFeeReceiver: 7,
|
|
196
|
-
userDestinationLiquidity: 8,
|
|
197
|
-
referrerTokenState: 9,
|
|
198
|
-
liquidityTokenProgram: 10,
|
|
199
|
-
instructionSysvarAccount: 11,
|
|
200
|
-
},
|
|
201
|
-
// repayObligationLiquidity
|
|
202
|
-
repay: {
|
|
203
|
-
owner: 0,
|
|
204
|
-
obligation: 1,
|
|
205
|
-
lendingMarket: 2,
|
|
206
|
-
repayReserve: 3,
|
|
207
|
-
reserveLiquidityMint: 4,
|
|
208
|
-
reserveDestinationLiquidity: 5,
|
|
209
|
-
userSourceLiquidity: 6,
|
|
210
|
-
liquidityTokenProgram: 7,
|
|
211
|
-
instructionSysvarAccount: 8,
|
|
212
|
-
},
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Creates a policy that allows Kamino account initialization for specific lending markets.
|
|
217
|
-
*/
|
|
218
|
-
export function createKaminoInitPolicy(params: {
|
|
219
|
-
/** Optional: allowed lending markets for init_obligation */
|
|
220
|
-
allowedLendingMarkets?: PublicKey[]
|
|
221
|
-
/** Threshold (default 1) */
|
|
222
|
-
threshold?: number
|
|
223
|
-
/** Time lock in seconds (default 0) */
|
|
224
|
-
timeLock?: number
|
|
225
|
-
} = {}): PolicyConfig {
|
|
226
|
-
const initObligationAccountConstraints: AccountConstraint[] = []
|
|
227
|
-
|
|
228
|
-
if (params.allowedLendingMarkets && params.allowedLendingMarkets.length > 0) {
|
|
229
|
-
initObligationAccountConstraints.push(
|
|
230
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.initObligation.lendingMarket, params.allowedLendingMarkets),
|
|
231
|
-
)
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return createProgramInteractionPolicy({
|
|
235
|
-
threshold: params.threshold,
|
|
236
|
-
timeLock: params.timeLock,
|
|
237
|
-
instructionsConstraints: [
|
|
238
|
-
createInstructionConstraint({
|
|
239
|
-
programId: KAMINO_LENDING_PROGRAM_ID,
|
|
240
|
-
dataConstraints: [createDiscriminatorConstraint(KAMINO_DISCRIMINATORS.initUserMetadata)],
|
|
241
|
-
}),
|
|
242
|
-
createInstructionConstraint({
|
|
243
|
-
programId: KAMINO_LENDING_PROGRAM_ID,
|
|
244
|
-
accountConstraints: initObligationAccountConstraints,
|
|
245
|
-
dataConstraints: [createDiscriminatorConstraint(KAMINO_DISCRIMINATORS.initObligation)],
|
|
246
|
-
}),
|
|
247
|
-
],
|
|
248
|
-
})
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Creates a policy that allows depositing into specific Kamino reserves.
|
|
253
|
-
*/
|
|
254
|
-
export function createKaminoDepositPolicy(params: {
|
|
255
|
-
/** Allowed reserve addresses for deposits */
|
|
256
|
-
allowedReserves: PublicKey[]
|
|
257
|
-
/** Optional: allowed lending markets (if not specified, any market is allowed) */
|
|
258
|
-
allowedLendingMarkets?: PublicKey[]
|
|
259
|
-
/** Optional: spending limits */
|
|
260
|
-
spendingLimits?: SpendingLimit[]
|
|
261
|
-
/** Threshold (default 1) */
|
|
262
|
-
threshold?: number
|
|
263
|
-
/** Time lock in seconds (default 0) */
|
|
264
|
-
timeLock?: number
|
|
265
|
-
}): PolicyConfig {
|
|
266
|
-
const accountConstraints: AccountConstraint[] = []
|
|
267
|
-
|
|
268
|
-
// Constrain on reserve account (index 4 in depositReserveLiquidityAndObligationCollateral)
|
|
269
|
-
if (params.allowedReserves.length > 0) {
|
|
270
|
-
accountConstraints.push(
|
|
271
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.depositCollateral.reserve, params.allowedReserves),
|
|
272
|
-
)
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// Optionally constrain on lending market
|
|
276
|
-
if (params.allowedLendingMarkets && params.allowedLendingMarkets.length > 0) {
|
|
277
|
-
accountConstraints.push(
|
|
278
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.depositCollateral.lendingMarket, params.allowedLendingMarkets),
|
|
279
|
-
)
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
const instructionConstraint = createInstructionConstraint({
|
|
283
|
-
programId: KAMINO_LENDING_PROGRAM_ID,
|
|
284
|
-
accountConstraints,
|
|
285
|
-
// Match the deposit instruction discriminator
|
|
286
|
-
dataConstraints: [
|
|
287
|
-
createDiscriminatorConstraint(KAMINO_DISCRIMINATORS.depositReserveLiquidityAndObligationCollateralV2),
|
|
288
|
-
],
|
|
289
|
-
})
|
|
290
|
-
|
|
291
|
-
return createProgramInteractionPolicy({
|
|
292
|
-
instructionsConstraints: [instructionConstraint],
|
|
293
|
-
spendingLimits: params.spendingLimits,
|
|
294
|
-
threshold: params.threshold,
|
|
295
|
-
timeLock: params.timeLock,
|
|
296
|
-
})
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Creates a policy that allows withdrawing from specific Kamino reserves.
|
|
301
|
-
*/
|
|
302
|
-
export function createKaminoWithdrawPolicy(params: {
|
|
303
|
-
/** Allowed reserve addresses for withdrawals */
|
|
304
|
-
allowedReserves: PublicKey[]
|
|
305
|
-
/** Optional: allowed lending markets */
|
|
306
|
-
allowedLendingMarkets?: PublicKey[]
|
|
307
|
-
/** Optional: spending limits */
|
|
308
|
-
spendingLimits?: SpendingLimit[]
|
|
309
|
-
/** Threshold (default 1) */
|
|
310
|
-
threshold?: number
|
|
311
|
-
/** Time lock in seconds (default 0) */
|
|
312
|
-
timeLock?: number
|
|
313
|
-
}): PolicyConfig {
|
|
314
|
-
const accountConstraints: AccountConstraint[] = []
|
|
315
|
-
|
|
316
|
-
// Constrain on withdraw reserve account (index 4)
|
|
317
|
-
if (params.allowedReserves.length > 0) {
|
|
318
|
-
accountConstraints.push(
|
|
319
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.withdrawCollateral.withdrawReserve, params.allowedReserves),
|
|
320
|
-
)
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// Optionally constrain on lending market
|
|
324
|
-
if (params.allowedLendingMarkets && params.allowedLendingMarkets.length > 0) {
|
|
325
|
-
accountConstraints.push(
|
|
326
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.withdrawCollateral.lendingMarket, params.allowedLendingMarkets),
|
|
327
|
-
)
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
const instructionConstraint = createInstructionConstraint({
|
|
331
|
-
programId: KAMINO_LENDING_PROGRAM_ID,
|
|
332
|
-
accountConstraints,
|
|
333
|
-
dataConstraints: [
|
|
334
|
-
createDiscriminatorConstraint(KAMINO_DISCRIMINATORS.withdrawObligationCollateralAndRedeemReserveCollateralV2),
|
|
335
|
-
],
|
|
336
|
-
})
|
|
337
|
-
|
|
338
|
-
return createProgramInteractionPolicy({
|
|
339
|
-
instructionsConstraints: [instructionConstraint],
|
|
340
|
-
spendingLimits: params.spendingLimits,
|
|
341
|
-
threshold: params.threshold,
|
|
342
|
-
timeLock: params.timeLock,
|
|
343
|
-
})
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* Creates a policy that allows borrowing from specific Kamino reserves.
|
|
348
|
-
*/
|
|
349
|
-
export function createKaminoBorrowPolicy(params: {
|
|
350
|
-
/** Allowed reserve addresses for borrowing */
|
|
351
|
-
allowedReserves: PublicKey[]
|
|
352
|
-
/** Optional: allowed lending markets */
|
|
353
|
-
allowedLendingMarkets?: PublicKey[]
|
|
354
|
-
/** Optional: spending limits */
|
|
355
|
-
spendingLimits?: SpendingLimit[]
|
|
356
|
-
/** Threshold (default 1) */
|
|
357
|
-
threshold?: number
|
|
358
|
-
/** Time lock in seconds (default 0) */
|
|
359
|
-
timeLock?: number
|
|
360
|
-
}): PolicyConfig {
|
|
361
|
-
const accountConstraints: AccountConstraint[] = []
|
|
362
|
-
|
|
363
|
-
// Constrain on borrow reserve account (index 4)
|
|
364
|
-
if (params.allowedReserves.length > 0) {
|
|
365
|
-
accountConstraints.push(
|
|
366
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.borrow.borrowReserve, params.allowedReserves),
|
|
367
|
-
)
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
// Optionally constrain on lending market
|
|
371
|
-
if (params.allowedLendingMarkets && params.allowedLendingMarkets.length > 0) {
|
|
372
|
-
accountConstraints.push(
|
|
373
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.borrow.lendingMarket, params.allowedLendingMarkets),
|
|
374
|
-
)
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
const instructionConstraint = createInstructionConstraint({
|
|
378
|
-
programId: KAMINO_LENDING_PROGRAM_ID,
|
|
379
|
-
accountConstraints,
|
|
380
|
-
dataConstraints: [createDiscriminatorConstraint(KAMINO_DISCRIMINATORS.borrowObligationLiquidityV2)],
|
|
381
|
-
})
|
|
382
|
-
|
|
383
|
-
return createProgramInteractionPolicy({
|
|
384
|
-
instructionsConstraints: [instructionConstraint],
|
|
385
|
-
spendingLimits: params.spendingLimits,
|
|
386
|
-
threshold: params.threshold,
|
|
387
|
-
timeLock: params.timeLock,
|
|
388
|
-
})
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Creates a policy that allows repaying on specific Kamino reserves.
|
|
393
|
-
*/
|
|
394
|
-
export function createKaminoRepayPolicy(params: {
|
|
395
|
-
/** Allowed reserve addresses for repaying */
|
|
396
|
-
allowedReserves: PublicKey[]
|
|
397
|
-
/** Optional: allowed lending markets */
|
|
398
|
-
allowedLendingMarkets?: PublicKey[]
|
|
399
|
-
/** Optional: spending limits */
|
|
400
|
-
spendingLimits?: SpendingLimit[]
|
|
401
|
-
/** Threshold (default 1) */
|
|
402
|
-
threshold?: number
|
|
403
|
-
/** Time lock in seconds (default 0) */
|
|
404
|
-
timeLock?: number
|
|
405
|
-
}): PolicyConfig {
|
|
406
|
-
const accountConstraints: AccountConstraint[] = []
|
|
407
|
-
|
|
408
|
-
// Constrain on repay reserve account (index 3)
|
|
409
|
-
if (params.allowedReserves.length > 0) {
|
|
410
|
-
accountConstraints.push(createAccountConstraint(KAMINO_ACCOUNT_INDICES.repay.repayReserve, params.allowedReserves))
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
// Optionally constrain on lending market
|
|
414
|
-
if (params.allowedLendingMarkets && params.allowedLendingMarkets.length > 0) {
|
|
415
|
-
accountConstraints.push(
|
|
416
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.repay.lendingMarket, params.allowedLendingMarkets),
|
|
417
|
-
)
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
const instructionConstraint = createInstructionConstraint({
|
|
421
|
-
programId: KAMINO_LENDING_PROGRAM_ID,
|
|
422
|
-
accountConstraints,
|
|
423
|
-
dataConstraints: [createDiscriminatorConstraint(KAMINO_DISCRIMINATORS.repayObligationLiquidityV2)],
|
|
424
|
-
})
|
|
425
|
-
|
|
426
|
-
return createProgramInteractionPolicy({
|
|
427
|
-
instructionsConstraints: [instructionConstraint],
|
|
428
|
-
spendingLimits: params.spendingLimits,
|
|
429
|
-
threshold: params.threshold,
|
|
430
|
-
timeLock: params.timeLock,
|
|
431
|
-
})
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Creates a combined Kamino policy that allows multiple actions on the same reserves.
|
|
436
|
-
*/
|
|
437
|
-
export function createKaminoFullAccessPolicy(params: {
|
|
438
|
-
/** Allowed reserve addresses */
|
|
439
|
-
allowedReserves: PublicKey[]
|
|
440
|
-
/** Which actions to allow */
|
|
441
|
-
allowedActions: ("deposit" | "withdraw" | "borrow" | "repay")[]
|
|
442
|
-
/** Optional: allowed lending markets */
|
|
443
|
-
allowedLendingMarkets?: PublicKey[]
|
|
444
|
-
/** Optional: spending limits */
|
|
445
|
-
spendingLimits?: SpendingLimit[]
|
|
446
|
-
/** Threshold (default 1) */
|
|
447
|
-
threshold?: number
|
|
448
|
-
/** Time lock in seconds (default 0) */
|
|
449
|
-
timeLock?: number
|
|
450
|
-
}): PolicyConfig {
|
|
451
|
-
const instructionsConstraints: InstructionConstraint[] = []
|
|
452
|
-
|
|
453
|
-
for (const action of params.allowedActions) {
|
|
454
|
-
const accountConstraints: AccountConstraint[] = []
|
|
455
|
-
|
|
456
|
-
switch (action) {
|
|
457
|
-
case "deposit":
|
|
458
|
-
if (params.allowedReserves.length > 0) {
|
|
459
|
-
accountConstraints.push(
|
|
460
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.depositCollateral.reserve, params.allowedReserves),
|
|
461
|
-
)
|
|
462
|
-
}
|
|
463
|
-
instructionsConstraints.push(
|
|
464
|
-
createInstructionConstraint({
|
|
465
|
-
programId: KAMINO_LENDING_PROGRAM_ID,
|
|
466
|
-
accountConstraints,
|
|
467
|
-
dataConstraints: [
|
|
468
|
-
createDiscriminatorConstraint(KAMINO_DISCRIMINATORS.depositReserveLiquidityAndObligationCollateralV2),
|
|
469
|
-
],
|
|
470
|
-
}),
|
|
471
|
-
)
|
|
472
|
-
break
|
|
473
|
-
case "withdraw":
|
|
474
|
-
if (params.allowedReserves.length > 0) {
|
|
475
|
-
accountConstraints.push(
|
|
476
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.withdrawCollateral.withdrawReserve, params.allowedReserves),
|
|
477
|
-
)
|
|
478
|
-
}
|
|
479
|
-
instructionsConstraints.push(
|
|
480
|
-
createInstructionConstraint({
|
|
481
|
-
programId: KAMINO_LENDING_PROGRAM_ID,
|
|
482
|
-
accountConstraints,
|
|
483
|
-
dataConstraints: [
|
|
484
|
-
createDiscriminatorConstraint(
|
|
485
|
-
KAMINO_DISCRIMINATORS.withdrawObligationCollateralAndRedeemReserveCollateralV2,
|
|
486
|
-
),
|
|
487
|
-
],
|
|
488
|
-
}),
|
|
489
|
-
)
|
|
490
|
-
break
|
|
491
|
-
case "borrow":
|
|
492
|
-
if (params.allowedReserves.length > 0) {
|
|
493
|
-
accountConstraints.push(
|
|
494
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.borrow.borrowReserve, params.allowedReserves),
|
|
495
|
-
)
|
|
496
|
-
}
|
|
497
|
-
instructionsConstraints.push(
|
|
498
|
-
createInstructionConstraint({
|
|
499
|
-
programId: KAMINO_LENDING_PROGRAM_ID,
|
|
500
|
-
accountConstraints,
|
|
501
|
-
dataConstraints: [createDiscriminatorConstraint(KAMINO_DISCRIMINATORS.borrowObligationLiquidityV2)],
|
|
502
|
-
}),
|
|
503
|
-
)
|
|
504
|
-
break
|
|
505
|
-
case "repay":
|
|
506
|
-
if (params.allowedReserves.length > 0) {
|
|
507
|
-
accountConstraints.push(
|
|
508
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.repay.repayReserve, params.allowedReserves),
|
|
509
|
-
)
|
|
510
|
-
}
|
|
511
|
-
instructionsConstraints.push(
|
|
512
|
-
createInstructionConstraint({
|
|
513
|
-
programId: KAMINO_LENDING_PROGRAM_ID,
|
|
514
|
-
accountConstraints,
|
|
515
|
-
dataConstraints: [createDiscriminatorConstraint(KAMINO_DISCRIMINATORS.repayObligationLiquidityV2)],
|
|
516
|
-
}),
|
|
517
|
-
)
|
|
518
|
-
break
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
return createProgramInteractionPolicy({
|
|
523
|
-
instructionsConstraints,
|
|
524
|
-
spendingLimits: params.spendingLimits,
|
|
525
|
-
threshold: params.threshold,
|
|
526
|
-
timeLock: params.timeLock,
|
|
527
|
-
})
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
/** Kamino actions that can be included in a policy */
|
|
531
|
-
export type KaminoPolicyAction = "deposit" | "withdraw" | "borrow" | "repay"
|
|
532
|
-
|
|
533
|
-
/**
|
|
534
|
-
* Creates a Kamino policy configuration (unified API, similar to createCorePolicy).
|
|
535
|
-
* Both allowedReserves and allowedDepositMints are optional; omit both to allow any reserve/mint.
|
|
536
|
-
*/
|
|
537
|
-
export function createKaminoPolicy(params: {
|
|
538
|
-
/** Allowed reserve addresses (optional) */
|
|
539
|
-
allowedReserves?: PublicKey[]
|
|
540
|
-
/** Allowed liquidity mints for deposits/withdrawals/borrows/repays (optional) */
|
|
541
|
-
allowedDepositMints?: PublicKey[]
|
|
542
|
-
/** Which actions to allow */
|
|
543
|
-
actions: KaminoPolicyAction[]
|
|
544
|
-
/** Optional: allowed lending markets */
|
|
545
|
-
allowedLendingMarkets?: PublicKey[]
|
|
546
|
-
/** Optional: spending limits */
|
|
547
|
-
spendingLimits?: SpendingLimit[]
|
|
548
|
-
/** Threshold (default 1) */
|
|
549
|
-
threshold?: number
|
|
550
|
-
/** Time lock in seconds (default 0) */
|
|
551
|
-
timeLock?: number
|
|
552
|
-
}): PolicyConfig {
|
|
553
|
-
const instructionsConstraints: InstructionConstraint[] = []
|
|
554
|
-
|
|
555
|
-
for (const action of params.actions) {
|
|
556
|
-
const accountConstraints: AccountConstraint[] = []
|
|
557
|
-
|
|
558
|
-
switch (action) {
|
|
559
|
-
case "deposit":
|
|
560
|
-
if (params.allowedReserves && params.allowedReserves.length > 0) {
|
|
561
|
-
accountConstraints.push(
|
|
562
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.depositCollateral.reserve, params.allowedReserves),
|
|
563
|
-
)
|
|
564
|
-
}
|
|
565
|
-
if (params.allowedDepositMints && params.allowedDepositMints.length > 0) {
|
|
566
|
-
accountConstraints.push(
|
|
567
|
-
createAccountConstraint(
|
|
568
|
-
KAMINO_ACCOUNT_INDICES.depositCollateral.reserveLiquidityMint,
|
|
569
|
-
params.allowedDepositMints,
|
|
570
|
-
),
|
|
571
|
-
)
|
|
572
|
-
}
|
|
573
|
-
if (params.allowedLendingMarkets && params.allowedLendingMarkets.length > 0) {
|
|
574
|
-
accountConstraints.push(
|
|
575
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.depositCollateral.lendingMarket, params.allowedLendingMarkets),
|
|
576
|
-
)
|
|
577
|
-
}
|
|
578
|
-
instructionsConstraints.push(
|
|
579
|
-
createInstructionConstraint({
|
|
580
|
-
programId: KAMINO_LENDING_PROGRAM_ID,
|
|
581
|
-
accountConstraints,
|
|
582
|
-
dataConstraints: [
|
|
583
|
-
createDiscriminatorConstraint(KAMINO_DISCRIMINATORS.depositReserveLiquidityAndObligationCollateralV2),
|
|
584
|
-
],
|
|
585
|
-
}),
|
|
586
|
-
)
|
|
587
|
-
break
|
|
588
|
-
case "withdraw":
|
|
589
|
-
if (params.allowedReserves && params.allowedReserves.length > 0) {
|
|
590
|
-
accountConstraints.push(
|
|
591
|
-
createAccountConstraint(
|
|
592
|
-
KAMINO_ACCOUNT_INDICES.withdrawCollateral.withdrawReserve,
|
|
593
|
-
params.allowedReserves,
|
|
594
|
-
),
|
|
595
|
-
)
|
|
596
|
-
}
|
|
597
|
-
if (params.allowedDepositMints && params.allowedDepositMints.length > 0) {
|
|
598
|
-
accountConstraints.push(
|
|
599
|
-
createAccountConstraint(
|
|
600
|
-
KAMINO_ACCOUNT_INDICES.withdrawCollateral.reserveLiquidityMint,
|
|
601
|
-
params.allowedDepositMints,
|
|
602
|
-
),
|
|
603
|
-
)
|
|
604
|
-
}
|
|
605
|
-
if (params.allowedLendingMarkets && params.allowedLendingMarkets.length > 0) {
|
|
606
|
-
accountConstraints.push(
|
|
607
|
-
createAccountConstraint(
|
|
608
|
-
KAMINO_ACCOUNT_INDICES.withdrawCollateral.lendingMarket,
|
|
609
|
-
params.allowedLendingMarkets,
|
|
610
|
-
),
|
|
611
|
-
)
|
|
612
|
-
}
|
|
613
|
-
instructionsConstraints.push(
|
|
614
|
-
createInstructionConstraint({
|
|
615
|
-
programId: KAMINO_LENDING_PROGRAM_ID,
|
|
616
|
-
accountConstraints,
|
|
617
|
-
dataConstraints: [
|
|
618
|
-
createDiscriminatorConstraint(
|
|
619
|
-
KAMINO_DISCRIMINATORS.withdrawObligationCollateralAndRedeemReserveCollateralV2,
|
|
620
|
-
),
|
|
621
|
-
],
|
|
622
|
-
}),
|
|
623
|
-
)
|
|
624
|
-
break
|
|
625
|
-
case "borrow":
|
|
626
|
-
if (params.allowedReserves && params.allowedReserves.length > 0) {
|
|
627
|
-
accountConstraints.push(
|
|
628
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.borrow.borrowReserve, params.allowedReserves),
|
|
629
|
-
)
|
|
630
|
-
}
|
|
631
|
-
if (params.allowedDepositMints && params.allowedDepositMints.length > 0) {
|
|
632
|
-
accountConstraints.push(
|
|
633
|
-
createAccountConstraint(
|
|
634
|
-
KAMINO_ACCOUNT_INDICES.borrow.borrowReserveLiquidityMint,
|
|
635
|
-
params.allowedDepositMints,
|
|
636
|
-
),
|
|
637
|
-
)
|
|
638
|
-
}
|
|
639
|
-
if (params.allowedLendingMarkets && params.allowedLendingMarkets.length > 0) {
|
|
640
|
-
accountConstraints.push(
|
|
641
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.borrow.lendingMarket, params.allowedLendingMarkets),
|
|
642
|
-
)
|
|
643
|
-
}
|
|
644
|
-
instructionsConstraints.push(
|
|
645
|
-
createInstructionConstraint({
|
|
646
|
-
programId: KAMINO_LENDING_PROGRAM_ID,
|
|
647
|
-
accountConstraints,
|
|
648
|
-
dataConstraints: [createDiscriminatorConstraint(KAMINO_DISCRIMINATORS.borrowObligationLiquidityV2)],
|
|
649
|
-
}),
|
|
650
|
-
)
|
|
651
|
-
break
|
|
652
|
-
case "repay":
|
|
653
|
-
if (params.allowedReserves && params.allowedReserves.length > 0) {
|
|
654
|
-
accountConstraints.push(
|
|
655
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.repay.repayReserve, params.allowedReserves),
|
|
656
|
-
)
|
|
657
|
-
}
|
|
658
|
-
if (params.allowedDepositMints && params.allowedDepositMints.length > 0) {
|
|
659
|
-
accountConstraints.push(
|
|
660
|
-
createAccountConstraint(
|
|
661
|
-
KAMINO_ACCOUNT_INDICES.repay.reserveLiquidityMint,
|
|
662
|
-
params.allowedDepositMints,
|
|
663
|
-
),
|
|
664
|
-
)
|
|
665
|
-
}
|
|
666
|
-
if (params.allowedLendingMarkets && params.allowedLendingMarkets.length > 0) {
|
|
667
|
-
accountConstraints.push(
|
|
668
|
-
createAccountConstraint(KAMINO_ACCOUNT_INDICES.repay.lendingMarket, params.allowedLendingMarkets),
|
|
669
|
-
)
|
|
670
|
-
}
|
|
671
|
-
instructionsConstraints.push(
|
|
672
|
-
createInstructionConstraint({
|
|
673
|
-
programId: KAMINO_LENDING_PROGRAM_ID,
|
|
674
|
-
accountConstraints,
|
|
675
|
-
dataConstraints: [createDiscriminatorConstraint(KAMINO_DISCRIMINATORS.repayObligationLiquidityV2)],
|
|
676
|
-
}),
|
|
677
|
-
)
|
|
678
|
-
break
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
return createProgramInteractionPolicy({
|
|
683
|
-
instructionsConstraints,
|
|
684
|
-
spendingLimits: params.spendingLimits,
|
|
685
|
-
threshold: params.threshold,
|
|
686
|
-
timeLock: params.timeLock,
|
|
687
|
-
})
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
export const KAMINO_VAULT_ACCOUNT_INDICES = {
|
|
691
|
-
deposit: {
|
|
692
|
-
vaultState: 1,
|
|
693
|
-
tokenMint: 3,
|
|
694
|
-
},
|
|
695
|
-
withdraw: {
|
|
696
|
-
vaultState: 1,
|
|
697
|
-
tokenMint: 6,
|
|
698
|
-
reserve: 15,
|
|
699
|
-
},
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
export type KaminoVaultPolicyAction = "deposit" | "withdraw"
|
|
703
|
-
|
|
704
|
-
export function createKaminoVaultPolicy(params: {
|
|
705
|
-
allowedVaults?: PublicKey[]
|
|
706
|
-
allowedDepositMints?: PublicKey[]
|
|
707
|
-
actions: KaminoVaultPolicyAction[]
|
|
708
|
-
spendingLimits?: SpendingLimit[]
|
|
709
|
-
threshold?: number
|
|
710
|
-
timeLock?: number
|
|
711
|
-
}): PolicyConfig {
|
|
712
|
-
const instructionsConstraints: InstructionConstraint[] = []
|
|
713
|
-
|
|
714
|
-
for (const action of params.actions) {
|
|
715
|
-
const accountConstraints: AccountConstraint[] = []
|
|
716
|
-
const accountIndices =
|
|
717
|
-
action === "deposit" ? KAMINO_VAULT_ACCOUNT_INDICES.deposit : KAMINO_VAULT_ACCOUNT_INDICES.withdraw
|
|
718
|
-
|
|
719
|
-
if (params.allowedVaults && params.allowedVaults.length > 0) {
|
|
720
|
-
accountConstraints.push(createAccountConstraint(accountIndices.vaultState, params.allowedVaults))
|
|
721
|
-
}
|
|
722
|
-
if (params.allowedDepositMints && params.allowedDepositMints.length > 0) {
|
|
723
|
-
accountConstraints.push(createAccountConstraint(accountIndices.tokenMint, params.allowedDepositMints))
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
instructionsConstraints.push(
|
|
727
|
-
createInstructionConstraint({
|
|
728
|
-
programId: KAMINO_VAULT_PROGRAM_ID,
|
|
729
|
-
accountConstraints,
|
|
730
|
-
dataConstraints: [
|
|
731
|
-
createDiscriminatorConstraint(
|
|
732
|
-
action === "deposit"
|
|
733
|
-
? KAMINO_VAULT_DISCRIMINATORS.deposit
|
|
734
|
-
: KAMINO_VAULT_DISCRIMINATORS.withdraw,
|
|
735
|
-
),
|
|
736
|
-
],
|
|
737
|
-
}),
|
|
738
|
-
)
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
return createProgramInteractionPolicy({
|
|
742
|
-
instructionsConstraints,
|
|
743
|
-
spendingLimits: params.spendingLimits,
|
|
744
|
-
threshold: params.threshold,
|
|
745
|
-
timeLock: params.timeLock,
|
|
746
|
-
})
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
export const KAMINO_FARM_ACCOUNT_INDICES = {
|
|
750
|
-
initializeUser: {
|
|
751
|
-
farmState: 5,
|
|
752
|
-
},
|
|
753
|
-
stake: {
|
|
754
|
-
farmState: 2,
|
|
755
|
-
tokenMint: 5,
|
|
756
|
-
},
|
|
757
|
-
unstake: {
|
|
758
|
-
farmState: 2,
|
|
759
|
-
},
|
|
760
|
-
withdrawUnstakedDeposits: {
|
|
761
|
-
farmState: 2,
|
|
762
|
-
},
|
|
763
|
-
harvestReward: {
|
|
764
|
-
farmState: 2,
|
|
765
|
-
rewardMint: 4,
|
|
766
|
-
},
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
export type KaminoFarmPolicyAction =
|
|
770
|
-
| "initializeUser"
|
|
771
|
-
| "stake"
|
|
772
|
-
| "unstake"
|
|
773
|
-
| "withdrawUnstakedDeposits"
|
|
774
|
-
| "harvestReward"
|
|
775
|
-
|
|
776
|
-
export function createKaminoFarmPolicy(params: {
|
|
777
|
-
allowedFarmStates?: PublicKey[]
|
|
778
|
-
allowedUnderlyingMints?: PublicKey[]
|
|
779
|
-
allowedRewardMints?: PublicKey[]
|
|
780
|
-
actions: KaminoFarmPolicyAction[]
|
|
781
|
-
spendingLimits?: SpendingLimit[]
|
|
782
|
-
threshold?: number
|
|
783
|
-
timeLock?: number
|
|
784
|
-
}): PolicyConfig {
|
|
785
|
-
const instructionsConstraints: InstructionConstraint[] = []
|
|
786
|
-
|
|
787
|
-
for (const action of params.actions) {
|
|
788
|
-
const accountConstraints: AccountConstraint[] = []
|
|
789
|
-
|
|
790
|
-
const farmIndex =
|
|
791
|
-
action === "initializeUser"
|
|
792
|
-
? KAMINO_FARM_ACCOUNT_INDICES.initializeUser.farmState
|
|
793
|
-
: action === "stake"
|
|
794
|
-
? KAMINO_FARM_ACCOUNT_INDICES.stake.farmState
|
|
795
|
-
: action === "unstake"
|
|
796
|
-
? KAMINO_FARM_ACCOUNT_INDICES.unstake.farmState
|
|
797
|
-
: action === "withdrawUnstakedDeposits"
|
|
798
|
-
? KAMINO_FARM_ACCOUNT_INDICES.withdrawUnstakedDeposits.farmState
|
|
799
|
-
: KAMINO_FARM_ACCOUNT_INDICES.harvestReward.farmState
|
|
800
|
-
|
|
801
|
-
if (params.allowedFarmStates && params.allowedFarmStates.length > 0) {
|
|
802
|
-
accountConstraints.push(createAccountConstraint(farmIndex, params.allowedFarmStates))
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
if (action === "stake" && params.allowedUnderlyingMints && params.allowedUnderlyingMints.length > 0) {
|
|
806
|
-
accountConstraints.push(
|
|
807
|
-
createAccountConstraint(KAMINO_FARM_ACCOUNT_INDICES.stake.tokenMint, params.allowedUnderlyingMints),
|
|
808
|
-
)
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
if (action === "harvestReward" && params.allowedRewardMints && params.allowedRewardMints.length > 0) {
|
|
812
|
-
accountConstraints.push(
|
|
813
|
-
createAccountConstraint(KAMINO_FARM_ACCOUNT_INDICES.harvestReward.rewardMint, params.allowedRewardMints),
|
|
814
|
-
)
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
const discriminator =
|
|
818
|
-
action === "initializeUser"
|
|
819
|
-
? KAMINO_FARM_DISCRIMINATORS.initializeUser
|
|
820
|
-
: action === "stake"
|
|
821
|
-
? KAMINO_FARM_DISCRIMINATORS.stake
|
|
822
|
-
: action === "unstake"
|
|
823
|
-
? KAMINO_FARM_DISCRIMINATORS.unstake
|
|
824
|
-
: action === "withdrawUnstakedDeposits"
|
|
825
|
-
? KAMINO_FARM_DISCRIMINATORS.withdrawUnstakedDeposits
|
|
826
|
-
: KAMINO_FARM_DISCRIMINATORS.harvestReward
|
|
827
|
-
|
|
828
|
-
instructionsConstraints.push(
|
|
829
|
-
createInstructionConstraint({
|
|
830
|
-
programId: KAMINO_FARMS_PROGRAM_ID,
|
|
831
|
-
accountConstraints,
|
|
832
|
-
dataConstraints: [createDiscriminatorConstraint(discriminator)],
|
|
833
|
-
}),
|
|
834
|
-
)
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
return createProgramInteractionPolicy({
|
|
838
|
-
instructionsConstraints,
|
|
839
|
-
spendingLimits: params.spendingLimits,
|
|
840
|
-
threshold: params.threshold,
|
|
841
|
-
timeLock: params.timeLock,
|
|
842
|
-
})
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
// ============================================================================
|
|
846
|
-
// Exponent Core Policy Builders (Strip/Merge)
|
|
847
|
-
// ============================================================================
|
|
848
|
-
|
|
849
|
-
export const EXPONENT_CORE_PROGRAM_ID = new PublicKey("ExponentnaRg3CQbW6dqQNZKXp7gtZ9DGMp1cwC4HAS7")
|
|
850
|
-
|
|
851
|
-
/**
|
|
852
|
-
* Single-byte discriminators for Exponent Core wrapper instructions.
|
|
853
|
-
*/
|
|
854
|
-
export const EXPONENT_CORE_DISCRIMINATORS = {
|
|
855
|
-
initializeYieldPosition: Buffer.from([3]),
|
|
856
|
-
collectInterest: Buffer.from([6]),
|
|
857
|
-
depositYt: Buffer.from([7]),
|
|
858
|
-
withdrawYt: Buffer.from([8]),
|
|
859
|
-
wrapperCollectInterest: Buffer.from([33]),
|
|
860
|
-
wrapperStrip: Buffer.from([38]),
|
|
861
|
-
wrapperMerge: Buffer.from([39]),
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
/**
|
|
865
|
-
* Account indices in Exponent Core initialize_yield_position instruction.
|
|
866
|
-
*/
|
|
867
|
-
export const EXPONENT_CORE_INITIALIZE_YIELD_POSITION_ACCOUNT_INDICES = {
|
|
868
|
-
owner: 0,
|
|
869
|
-
vault: 1,
|
|
870
|
-
yieldPosition: 2,
|
|
871
|
-
systemProgram: 3,
|
|
872
|
-
eventAuthority: 4,
|
|
873
|
-
program: 5,
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
/**
|
|
877
|
-
* Account indices in Exponent Core wrapper_strip instruction.
|
|
878
|
-
*/
|
|
879
|
-
export const EXPONENT_CORE_STRIP_ACCOUNT_INDICES = {
|
|
880
|
-
depositor: 0,
|
|
881
|
-
tokenSyDepositor: 1,
|
|
882
|
-
vault: 2,
|
|
883
|
-
escrowSy: 3,
|
|
884
|
-
tokenYtDepositor: 4,
|
|
885
|
-
tokenPtDepositor: 5,
|
|
886
|
-
mintYt: 6,
|
|
887
|
-
mintPt: 7,
|
|
888
|
-
authority: 8,
|
|
889
|
-
vaultAddressLookupTable: 9,
|
|
890
|
-
tokenProgram: 10,
|
|
891
|
-
escrowYt: 11,
|
|
892
|
-
userYieldPosition: 12,
|
|
893
|
-
vaultRobotYieldPosition: 13,
|
|
894
|
-
syProgram: 14,
|
|
895
|
-
systemProgram: 15,
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
/**
|
|
899
|
-
* Account indices in Exponent Core wrapper_merge instruction.
|
|
900
|
-
*/
|
|
901
|
-
export const EXPONENT_CORE_MERGE_ACCOUNT_INDICES = {
|
|
902
|
-
merger: 0,
|
|
903
|
-
tokenSyMerger: 1,
|
|
904
|
-
vault: 2,
|
|
905
|
-
escrowSy: 3,
|
|
906
|
-
tokenYtMerger: 4,
|
|
907
|
-
tokenPtMerger: 5,
|
|
908
|
-
mintYt: 6,
|
|
909
|
-
mintPt: 7,
|
|
910
|
-
authority: 8,
|
|
911
|
-
vaultAddressLookupTable: 9,
|
|
912
|
-
tokenProgram: 10,
|
|
913
|
-
vaultRobotYieldPosition: 11,
|
|
914
|
-
syProgram: 12,
|
|
915
|
-
systemProgram: 13,
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
export const EXPONENT_CORE_DEPOSIT_YT_ACCOUNT_INDICES = {
|
|
919
|
-
depositor: 0,
|
|
920
|
-
vault: 1,
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
export const EXPONENT_CORE_COLLECT_INTEREST_ACCOUNT_INDICES = {
|
|
924
|
-
owner: 0,
|
|
925
|
-
vault: 2,
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
export const EXPONENT_CORE_WITHDRAW_YT_ACCOUNT_INDICES = {
|
|
929
|
-
owner: 0,
|
|
930
|
-
vault: 1,
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
export const EXPONENT_CORE_WRAPPER_COLLECT_INTEREST_ACCOUNT_INDICES = {
|
|
934
|
-
claimer: 0,
|
|
935
|
-
vault: 2,
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
export const EXPONENT_VAULT_ACCOUNT_DATA_OFFSETS = {
|
|
939
|
-
mintSy: 40n,
|
|
940
|
-
} as const
|
|
941
|
-
|
|
942
|
-
/** Core actions that can be included in a policy */
|
|
943
|
-
export type CorePolicyAction =
|
|
944
|
-
| "initializeYieldPosition"
|
|
945
|
-
| "collectInterest"
|
|
946
|
-
| "depositYt"
|
|
947
|
-
| "withdrawYt"
|
|
948
|
-
| "wrapperCollectInterest"
|
|
949
|
-
| "strip"
|
|
950
|
-
| "merge"
|
|
951
|
-
|
|
952
|
-
function createExponentVaultMintSyConstraint(accountIndex: number, allowedSyMint: PublicKey): AccountConstraint {
|
|
953
|
-
return createAccountDataConstraint(accountIndex, [
|
|
954
|
-
{
|
|
955
|
-
dataOffset: EXPONENT_VAULT_ACCOUNT_DATA_OFFSETS.mintSy,
|
|
956
|
-
dataValue: { u8Slice: Array.from(allowedSyMint.toBytes()) },
|
|
957
|
-
operator: "Equals",
|
|
958
|
-
},
|
|
959
|
-
])
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
function resolveExponentAccountConstraintVariants(params: {
|
|
963
|
-
accountIndex: number
|
|
964
|
-
allowedVaults?: PublicKey[]
|
|
965
|
-
allowedSyMints?: PublicKey[]
|
|
966
|
-
}): AccountConstraint[][] {
|
|
967
|
-
if (params.allowedVaults && params.allowedVaults.length > 0) {
|
|
968
|
-
return [[createAccountConstraint(params.accountIndex, params.allowedVaults)]]
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
if (params.allowedSyMints && params.allowedSyMints.length > 0) {
|
|
972
|
-
return params.allowedSyMints.map((allowedSyMint) => [
|
|
973
|
-
createExponentVaultMintSyConstraint(params.accountIndex, allowedSyMint),
|
|
974
|
-
])
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
return [[]]
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
/**
|
|
981
|
-
* Creates instruction constraints for Exponent Core operations.
|
|
982
|
-
*/
|
|
983
|
-
export function createCoreInstructionConstraints(params: {
|
|
984
|
-
/** Allowed vault addresses (optional) */
|
|
985
|
-
allowedVaults?: PublicKey[]
|
|
986
|
-
/** Allowed SY mints - constrains the vault account's mintSy field directly */
|
|
987
|
-
allowedSyMints?: PublicKey[]
|
|
988
|
-
/** Deprecated: no longer required when constraining by SY mint */
|
|
989
|
-
vaultsForSyMints?: PublicKey[]
|
|
990
|
-
/** Which actions to allow */
|
|
991
|
-
actions: CorePolicyAction[]
|
|
992
|
-
}): InstructionConstraint[] {
|
|
993
|
-
const instructionsConstraints: InstructionConstraint[] = []
|
|
994
|
-
|
|
995
|
-
for (const action of params.actions) {
|
|
996
|
-
const accountIndex =
|
|
997
|
-
action === "initializeYieldPosition"
|
|
998
|
-
? EXPONENT_CORE_INITIALIZE_YIELD_POSITION_ACCOUNT_INDICES.vault
|
|
999
|
-
: action === "collectInterest"
|
|
1000
|
-
? EXPONENT_CORE_COLLECT_INTEREST_ACCOUNT_INDICES.vault
|
|
1001
|
-
: action === "depositYt"
|
|
1002
|
-
? EXPONENT_CORE_DEPOSIT_YT_ACCOUNT_INDICES.vault
|
|
1003
|
-
: action === "withdrawYt"
|
|
1004
|
-
? EXPONENT_CORE_WITHDRAW_YT_ACCOUNT_INDICES.vault
|
|
1005
|
-
: action === "wrapperCollectInterest"
|
|
1006
|
-
? EXPONENT_CORE_WRAPPER_COLLECT_INTEREST_ACCOUNT_INDICES.vault
|
|
1007
|
-
: action === "strip"
|
|
1008
|
-
? EXPONENT_CORE_STRIP_ACCOUNT_INDICES.vault
|
|
1009
|
-
: EXPONENT_CORE_MERGE_ACCOUNT_INDICES.vault
|
|
1010
|
-
const accountConstraintVariants = resolveExponentAccountConstraintVariants({
|
|
1011
|
-
accountIndex,
|
|
1012
|
-
allowedVaults: params.allowedVaults,
|
|
1013
|
-
allowedSyMints: params.allowedSyMints,
|
|
1014
|
-
})
|
|
1015
|
-
const discriminator =
|
|
1016
|
-
action === "initializeYieldPosition"
|
|
1017
|
-
? EXPONENT_CORE_DISCRIMINATORS.initializeYieldPosition
|
|
1018
|
-
: action === "collectInterest"
|
|
1019
|
-
? EXPONENT_CORE_DISCRIMINATORS.collectInterest
|
|
1020
|
-
: action === "depositYt"
|
|
1021
|
-
? EXPONENT_CORE_DISCRIMINATORS.depositYt
|
|
1022
|
-
: action === "withdrawYt"
|
|
1023
|
-
? EXPONENT_CORE_DISCRIMINATORS.withdrawYt
|
|
1024
|
-
: action === "wrapperCollectInterest"
|
|
1025
|
-
? EXPONENT_CORE_DISCRIMINATORS.wrapperCollectInterest
|
|
1026
|
-
: action === "strip"
|
|
1027
|
-
? EXPONENT_CORE_DISCRIMINATORS.wrapperStrip
|
|
1028
|
-
: EXPONENT_CORE_DISCRIMINATORS.wrapperMerge
|
|
1029
|
-
|
|
1030
|
-
switch (action) {
|
|
1031
|
-
case "initializeYieldPosition":
|
|
1032
|
-
case "collectInterest":
|
|
1033
|
-
case "depositYt":
|
|
1034
|
-
case "withdrawYt":
|
|
1035
|
-
case "wrapperCollectInterest":
|
|
1036
|
-
accountConstraintVariants.forEach((accountConstraints) => {
|
|
1037
|
-
instructionsConstraints.push(
|
|
1038
|
-
createInstructionConstraint({
|
|
1039
|
-
programId: EXPONENT_CORE_PROGRAM_ID,
|
|
1040
|
-
accountConstraints,
|
|
1041
|
-
dataConstraints: [createDiscriminatorConstraint(discriminator)],
|
|
1042
|
-
}),
|
|
1043
|
-
)
|
|
1044
|
-
})
|
|
1045
|
-
break
|
|
1046
|
-
case "strip":
|
|
1047
|
-
accountConstraintVariants.forEach((accountConstraints) => {
|
|
1048
|
-
instructionsConstraints.push(
|
|
1049
|
-
createInstructionConstraint({
|
|
1050
|
-
programId: EXPONENT_CORE_PROGRAM_ID,
|
|
1051
|
-
accountConstraints,
|
|
1052
|
-
dataConstraints: [createDiscriminatorConstraint(discriminator)],
|
|
1053
|
-
}),
|
|
1054
|
-
)
|
|
1055
|
-
})
|
|
1056
|
-
break
|
|
1057
|
-
case "merge":
|
|
1058
|
-
accountConstraintVariants.forEach((accountConstraints) => {
|
|
1059
|
-
instructionsConstraints.push(
|
|
1060
|
-
createInstructionConstraint({
|
|
1061
|
-
programId: EXPONENT_CORE_PROGRAM_ID,
|
|
1062
|
-
accountConstraints,
|
|
1063
|
-
dataConstraints: [createDiscriminatorConstraint(discriminator)],
|
|
1064
|
-
}),
|
|
1065
|
-
)
|
|
1066
|
-
})
|
|
1067
|
-
break
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
return instructionsConstraints
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
/**
|
|
1075
|
-
* Creates a complete Exponent Core strip/merge policy configuration.
|
|
1076
|
-
*/
|
|
1077
|
-
export function createCorePolicy(params: {
|
|
1078
|
-
/** Allowed vault addresses (optional) */
|
|
1079
|
-
allowedVaults?: PublicKey[]
|
|
1080
|
-
/** Allowed SY mints - constrains the vault account's mintSy field directly */
|
|
1081
|
-
allowedSyMints?: PublicKey[]
|
|
1082
|
-
/** Deprecated: no longer required when constraining by SY mint */
|
|
1083
|
-
vaultsForSyMints?: PublicKey[]
|
|
1084
|
-
/** Which actions to allow */
|
|
1085
|
-
actions: CorePolicyAction[]
|
|
1086
|
-
/** Spending limits (optional) */
|
|
1087
|
-
spendingLimits?: SpendingLimit[]
|
|
1088
|
-
/** Threshold (default 1) */
|
|
1089
|
-
threshold?: number
|
|
1090
|
-
/** Time lock in seconds (default 0) */
|
|
1091
|
-
timeLock?: number
|
|
1092
|
-
}): PolicyConfig {
|
|
1093
|
-
const instructionsConstraints = createCoreInstructionConstraints({
|
|
1094
|
-
allowedVaults: params.allowedVaults,
|
|
1095
|
-
allowedSyMints: params.allowedSyMints,
|
|
1096
|
-
vaultsForSyMints: params.vaultsForSyMints,
|
|
1097
|
-
actions: params.actions,
|
|
1098
|
-
})
|
|
1099
|
-
|
|
1100
|
-
return createProgramInteractionPolicy({
|
|
1101
|
-
instructionsConstraints,
|
|
1102
|
-
spendingLimits: params.spendingLimits,
|
|
1103
|
-
threshold: params.threshold,
|
|
1104
|
-
timeLock: params.timeLock,
|
|
1105
|
-
})
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
// ============================================================================
|
|
1109
|
-
// Exponent Orderbook Policy Builders
|
|
1110
|
-
// ============================================================================
|
|
1111
|
-
|
|
1112
|
-
export const EXPONENT_ORDERBOOK_PROGRAM_ID = new PublicKey("XPBookgQTN2p8Yw1C2La35XkPMmZTCEYH77AdReVvK1")
|
|
1113
|
-
export const MARGINFI_STANDARD_PROGRAM_ID = new PublicKey("XPMfipyhcbq3DBvgvxkbZY7GekwmGNJLMD3wdiCkBc7")
|
|
1114
|
-
export const KAMINO_STANDARD_PROGRAM_ID = new PublicKey("XPK1ndTK1xrgRg99ifvdPP1exrx8D1mRXTuxBkkroCx")
|
|
1115
|
-
export const JITO_RESTAKING_STANDARD_PROGRAM_ID = new PublicKey("XPJitopeUEhMZVF72CvswnwrS2U2akQvk5s26aEfWv2")
|
|
1116
|
-
export const PERENA_STANDARD_PROGRAM_ID = new PublicKey("XPerenaJPyvnjseLCn7rgzxFEum6zX1k89C13SPTyGZ")
|
|
1117
|
-
export const GENERIC_STANDARD_PROGRAM_ID = new PublicKey("XP1BRLn8eCYSygrd8er5P4GKdzqKbC3DLoSsS5UYVZy")
|
|
1118
|
-
|
|
1119
|
-
/**
|
|
1120
|
-
* Single-byte discriminators for Exponent Orderbook wrapper instructions.
|
|
1121
|
-
* The orderbook uses single-byte discriminators, not 8-byte Anchor discriminators.
|
|
1122
|
-
*/
|
|
1123
|
-
export const ORDERBOOK_DISCRIMINATORS = {
|
|
1124
|
-
rawPostOffer: Buffer.from([1]),
|
|
1125
|
-
rawMarketOffer: Buffer.from([3]),
|
|
1126
|
-
wrapperPostOffer: Buffer.from([7]),
|
|
1127
|
-
wrapperMarketOffer: Buffer.from([8]),
|
|
1128
|
-
wrapperRemoveOffer: Buffer.from([9]),
|
|
1129
|
-
wrapperWithdrawFunds: Buffer.from([11]),
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
/**
|
|
1133
|
-
* Account indices in Exponent Orderbook wrapper instructions.
|
|
1134
|
-
* Used for setting up account constraints.
|
|
1135
|
-
*/
|
|
1136
|
-
export const ORDERBOOK_ACCOUNT_INDICES = {
|
|
1137
|
-
// Common to all wrapper instructions
|
|
1138
|
-
trader: 0,
|
|
1139
|
-
orderbook: 1,
|
|
1140
|
-
vault: 2,
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
/** Orderbook actions that can be included in a policy */
|
|
1144
|
-
export type OrderbookPolicyAction =
|
|
1145
|
-
| "rawPostOffer"
|
|
1146
|
-
| "rawMarketOffer"
|
|
1147
|
-
| "postOffer"
|
|
1148
|
-
| "marketOffer"
|
|
1149
|
-
| "removeOffer"
|
|
1150
|
-
| "withdrawFunds"
|
|
1151
|
-
|
|
1152
|
-
/**
|
|
1153
|
-
* Creates instruction constraints for Exponent Orderbook operations.
|
|
1154
|
-
*
|
|
1155
|
-
* When SY mints are provided, the vault account (account index 2) is constrained
|
|
1156
|
-
* by reading its mintSy field from account data instead of hardcoding vault PDAs.
|
|
1157
|
-
*
|
|
1158
|
-
* @example
|
|
1159
|
-
* ```ts
|
|
1160
|
-
* const constraints = createOrderbookInstructionConstraints({
|
|
1161
|
-
* allowedSyMints: [BULKSOL_SY_MINT],
|
|
1162
|
-
* actions: ["postOffer", "marketOffer", "removeOffer", "withdrawFunds"],
|
|
1163
|
-
* })
|
|
1164
|
-
* ```
|
|
1165
|
-
*/
|
|
1166
|
-
export function createOrderbookInstructionConstraints(params: {
|
|
1167
|
-
/** SY mints that are allowed via the vault account's mintSy field */
|
|
1168
|
-
allowedSyMints: PublicKey[]
|
|
1169
|
-
/** Which orderbook actions to allow */
|
|
1170
|
-
actions: OrderbookPolicyAction[]
|
|
1171
|
-
}): InstructionConstraint[] {
|
|
1172
|
-
const instructionsConstraints: InstructionConstraint[] = []
|
|
1173
|
-
const accountConstraintVariants = resolveExponentAccountConstraintVariants({
|
|
1174
|
-
accountIndex: ORDERBOOK_ACCOUNT_INDICES.vault,
|
|
1175
|
-
allowedSyMints: params.allowedSyMints,
|
|
1176
|
-
})
|
|
1177
|
-
|
|
1178
|
-
for (const action of params.actions) {
|
|
1179
|
-
switch (action) {
|
|
1180
|
-
case "rawPostOffer":
|
|
1181
|
-
accountConstraintVariants.forEach((accountConstraints) => {
|
|
1182
|
-
instructionsConstraints.push(
|
|
1183
|
-
createInstructionConstraint({
|
|
1184
|
-
programId: EXPONENT_ORDERBOOK_PROGRAM_ID,
|
|
1185
|
-
accountConstraints,
|
|
1186
|
-
dataConstraints: [createDiscriminatorConstraint(ORDERBOOK_DISCRIMINATORS.rawPostOffer)],
|
|
1187
|
-
}),
|
|
1188
|
-
)
|
|
1189
|
-
})
|
|
1190
|
-
break
|
|
1191
|
-
case "rawMarketOffer":
|
|
1192
|
-
accountConstraintVariants.forEach((accountConstraints) => {
|
|
1193
|
-
instructionsConstraints.push(
|
|
1194
|
-
createInstructionConstraint({
|
|
1195
|
-
programId: EXPONENT_ORDERBOOK_PROGRAM_ID,
|
|
1196
|
-
accountConstraints,
|
|
1197
|
-
dataConstraints: [createDiscriminatorConstraint(ORDERBOOK_DISCRIMINATORS.rawMarketOffer)],
|
|
1198
|
-
}),
|
|
1199
|
-
)
|
|
1200
|
-
})
|
|
1201
|
-
break
|
|
1202
|
-
case "postOffer":
|
|
1203
|
-
accountConstraintVariants.forEach((accountConstraints) => {
|
|
1204
|
-
instructionsConstraints.push(
|
|
1205
|
-
createInstructionConstraint({
|
|
1206
|
-
programId: EXPONENT_ORDERBOOK_PROGRAM_ID,
|
|
1207
|
-
accountConstraints,
|
|
1208
|
-
dataConstraints: [createDiscriminatorConstraint(ORDERBOOK_DISCRIMINATORS.wrapperPostOffer)],
|
|
1209
|
-
}),
|
|
1210
|
-
)
|
|
1211
|
-
})
|
|
1212
|
-
break
|
|
1213
|
-
case "marketOffer":
|
|
1214
|
-
accountConstraintVariants.forEach((accountConstraints) => {
|
|
1215
|
-
instructionsConstraints.push(
|
|
1216
|
-
createInstructionConstraint({
|
|
1217
|
-
programId: EXPONENT_ORDERBOOK_PROGRAM_ID,
|
|
1218
|
-
accountConstraints,
|
|
1219
|
-
dataConstraints: [createDiscriminatorConstraint(ORDERBOOK_DISCRIMINATORS.wrapperMarketOffer)],
|
|
1220
|
-
}),
|
|
1221
|
-
)
|
|
1222
|
-
})
|
|
1223
|
-
break
|
|
1224
|
-
case "removeOffer":
|
|
1225
|
-
accountConstraintVariants.forEach((accountConstraints) => {
|
|
1226
|
-
instructionsConstraints.push(
|
|
1227
|
-
createInstructionConstraint({
|
|
1228
|
-
programId: EXPONENT_ORDERBOOK_PROGRAM_ID,
|
|
1229
|
-
accountConstraints,
|
|
1230
|
-
dataConstraints: [createDiscriminatorConstraint(ORDERBOOK_DISCRIMINATORS.wrapperRemoveOffer)],
|
|
1231
|
-
}),
|
|
1232
|
-
)
|
|
1233
|
-
})
|
|
1234
|
-
break
|
|
1235
|
-
case "withdrawFunds":
|
|
1236
|
-
accountConstraintVariants.forEach((accountConstraints) => {
|
|
1237
|
-
instructionsConstraints.push(
|
|
1238
|
-
createInstructionConstraint({
|
|
1239
|
-
programId: EXPONENT_ORDERBOOK_PROGRAM_ID,
|
|
1240
|
-
accountConstraints,
|
|
1241
|
-
dataConstraints: [createDiscriminatorConstraint(ORDERBOOK_DISCRIMINATORS.wrapperWithdrawFunds)],
|
|
1242
|
-
}),
|
|
1243
|
-
)
|
|
1244
|
-
})
|
|
1245
|
-
break
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
return instructionsConstraints
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
export const STANDARD_PROGRAM_DISCRIMINATORS = {
|
|
1253
|
-
mint: Buffer.from([1]),
|
|
1254
|
-
redeem: Buffer.from([2]),
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
type StandardProgramAccountIndices = {
|
|
1258
|
-
mint: {
|
|
1259
|
-
mintSy: number
|
|
1260
|
-
}
|
|
1261
|
-
redeem: {
|
|
1262
|
-
mintSy: number
|
|
1263
|
-
}
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
export const STANDARD_PROGRAM_ACCOUNT_INDICES: Record<string, StandardProgramAccountIndices> = {
|
|
1267
|
-
[MARGINFI_STANDARD_PROGRAM_ID.toBase58()]: {
|
|
1268
|
-
mint: { mintSy: 2 },
|
|
1269
|
-
redeem: { mintSy: 5 },
|
|
1270
|
-
},
|
|
1271
|
-
[KAMINO_STANDARD_PROGRAM_ID.toBase58()]: {
|
|
1272
|
-
mint: { mintSy: 6 },
|
|
1273
|
-
redeem: { mintSy: 4 },
|
|
1274
|
-
},
|
|
1275
|
-
[JITO_RESTAKING_STANDARD_PROGRAM_ID.toBase58()]: {
|
|
1276
|
-
mint: { mintSy: 2 },
|
|
1277
|
-
redeem: { mintSy: 6 },
|
|
1278
|
-
},
|
|
1279
|
-
[PERENA_STANDARD_PROGRAM_ID.toBase58()]: {
|
|
1280
|
-
mint: { mintSy: 2 },
|
|
1281
|
-
redeem: { mintSy: 6 },
|
|
1282
|
-
},
|
|
1283
|
-
[GENERIC_STANDARD_PROGRAM_ID.toBase58()]: {
|
|
1284
|
-
mint: { mintSy: 2 },
|
|
1285
|
-
redeem: { mintSy: 5 },
|
|
1286
|
-
},
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
export type StandardProgramPolicyAction = "mintSy" | "redeemSy"
|
|
1290
|
-
|
|
1291
|
-
export type AllowedSyMintProgram = {
|
|
1292
|
-
syMint: PublicKey
|
|
1293
|
-
programId: PublicKey
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
export function createStandardProgramInstructionConstraints(params: {
|
|
1297
|
-
allowedSyMints: AllowedSyMintProgram[]
|
|
1298
|
-
actions: StandardProgramPolicyAction[]
|
|
1299
|
-
}): InstructionConstraint[] {
|
|
1300
|
-
const instructionsConstraints: InstructionConstraint[] = []
|
|
1301
|
-
|
|
1302
|
-
for (const action of params.actions) {
|
|
1303
|
-
for (const allowedMint of params.allowedSyMints) {
|
|
1304
|
-
const indices = STANDARD_PROGRAM_ACCOUNT_INDICES[allowedMint.programId.toBase58()]
|
|
1305
|
-
if (!indices) {
|
|
1306
|
-
continue
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
const mintAccountIndex = action === "mintSy" ? indices.mint.mintSy : indices.redeem.mintSy
|
|
1310
|
-
const discriminator =
|
|
1311
|
-
action === "mintSy" ? STANDARD_PROGRAM_DISCRIMINATORS.mint : STANDARD_PROGRAM_DISCRIMINATORS.redeem
|
|
1312
|
-
|
|
1313
|
-
instructionsConstraints.push(
|
|
1314
|
-
createInstructionConstraint({
|
|
1315
|
-
programId: allowedMint.programId,
|
|
1316
|
-
accountConstraints: [createAccountConstraint(mintAccountIndex, [allowedMint.syMint])],
|
|
1317
|
-
dataConstraints: [createDiscriminatorConstraint(discriminator)],
|
|
1318
|
-
}),
|
|
1319
|
-
)
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
return instructionsConstraints
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
export function createStandardProgramPolicy(params: {
|
|
1327
|
-
allowedSyMints: AllowedSyMintProgram[]
|
|
1328
|
-
actions: StandardProgramPolicyAction[]
|
|
1329
|
-
spendingLimits?: SpendingLimit[]
|
|
1330
|
-
threshold?: number
|
|
1331
|
-
timeLock?: number
|
|
1332
|
-
}): PolicyConfig {
|
|
1333
|
-
return createProgramInteractionPolicy({
|
|
1334
|
-
instructionsConstraints: createStandardProgramInstructionConstraints({
|
|
1335
|
-
allowedSyMints: params.allowedSyMints,
|
|
1336
|
-
actions: params.actions,
|
|
1337
|
-
}),
|
|
1338
|
-
spendingLimits: params.spendingLimits,
|
|
1339
|
-
threshold: params.threshold,
|
|
1340
|
-
timeLock: params.timeLock,
|
|
1341
|
-
})
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
/**
|
|
1345
|
-
* Creates a complete Exponent Orderbook policy configuration.
|
|
1346
|
-
*
|
|
1347
|
-
* @example
|
|
1348
|
-
* ```ts
|
|
1349
|
-
* const policy = createOrderbookPolicy({
|
|
1350
|
-
* allowedSyMints: [BULKSOL_SY_MINT],
|
|
1351
|
-
* actions: ["postOffer", "marketOffer", "removeOffer", "withdrawFunds"],
|
|
1352
|
-
* })
|
|
1353
|
-
* ```
|
|
1354
|
-
*/
|
|
1355
|
-
// ============================================================================
|
|
1356
|
-
// Titan Swap Policy Builders
|
|
1357
|
-
// ============================================================================
|
|
1358
|
-
|
|
1359
|
-
export const TITAN_PROGRAM_ID = new PublicKey("T1TANpTeScyeqVzzgNViGDNrkQ6qHz9KrSBS4aNXvGT")
|
|
1360
|
-
|
|
1361
|
-
export const TITAN_DISCRIMINATORS = {
|
|
1362
|
-
swapRouteV2: Buffer.from([249, 91, 84, 33, 69, 22, 0, 135]),
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
|
-
export const TITAN_ACCOUNT_INDICES = {
|
|
1366
|
-
inputMint: 2,
|
|
1367
|
-
outputMint: 4,
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
/**
|
|
1371
|
-
* Creates a policy that allows Titan SwapRouteV2 swaps.
|
|
1372
|
-
* Optional mint constraints can be applied to both the input and output mint.
|
|
1373
|
-
* The on-chain post-hook validator separately checks that input/output token
|
|
1374
|
-
* accounts are vault-owned tracked accounts.
|
|
1375
|
-
*/
|
|
1376
|
-
export function createTitanSwapPolicy(params?: {
|
|
1377
|
-
/** Allowed input/output mints (optional) */
|
|
1378
|
-
allowedMints?: PublicKey[]
|
|
1379
|
-
/** Threshold (default 1) */
|
|
1380
|
-
threshold?: number
|
|
1381
|
-
/** Time lock in seconds (default 0) */
|
|
1382
|
-
timeLock?: number
|
|
1383
|
-
}): PolicyConfig {
|
|
1384
|
-
const accountConstraints: AccountConstraint[] = []
|
|
1385
|
-
|
|
1386
|
-
if (params?.allowedMints && params.allowedMints.length > 0) {
|
|
1387
|
-
accountConstraints.push(
|
|
1388
|
-
createAccountConstraint(TITAN_ACCOUNT_INDICES.inputMint, params.allowedMints),
|
|
1389
|
-
createAccountConstraint(TITAN_ACCOUNT_INDICES.outputMint, params.allowedMints),
|
|
1390
|
-
)
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
const instructionConstraint = createInstructionConstraint({
|
|
1394
|
-
programId: TITAN_PROGRAM_ID,
|
|
1395
|
-
accountConstraints,
|
|
1396
|
-
dataConstraints: [createDiscriminatorConstraint(TITAN_DISCRIMINATORS.swapRouteV2)],
|
|
1397
|
-
})
|
|
1398
|
-
|
|
1399
|
-
return createProgramInteractionPolicy({
|
|
1400
|
-
instructionsConstraints: [instructionConstraint],
|
|
1401
|
-
threshold: params?.threshold,
|
|
1402
|
-
timeLock: params?.timeLock,
|
|
1403
|
-
})
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
// ============================================================================
|
|
1407
|
-
// Loopscale Policy Builders
|
|
1408
|
-
// ============================================================================
|
|
1409
|
-
|
|
1410
|
-
/** Loopscale lending protocol program ID. */
|
|
1411
|
-
export const LOOPSCALE_PROGRAM_ID = new PublicKey("1oopBoJG58DgkUVKkEzKgyG9dvRmpgeEm1AVjoHkF78")
|
|
1412
|
-
|
|
1413
|
-
/**
|
|
1414
|
-
* Derive a Loopscale Strategy PDA.
|
|
1415
|
-
* seeds = ["strategy", nonce] where nonce is a Pubkey (keypair generated at creation).
|
|
1416
|
-
*/
|
|
1417
|
-
export function deriveLoopscaleStrategyAddress(nonce: PublicKey): [PublicKey, number] {
|
|
1418
|
-
return PublicKey.findProgramAddressSync(
|
|
1419
|
-
[Buffer.from("strategy"), nonce.toBytes()],
|
|
1420
|
-
LOOPSCALE_PROGRAM_ID,
|
|
1421
|
-
)
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
/**
|
|
1425
|
-
* Derive a Loopscale Loan PDA.
|
|
1426
|
-
* seeds = [borrower, nonce] where nonce is a u64 (typically current timestamp).
|
|
1427
|
-
*/
|
|
1428
|
-
export function deriveLoopscaleLoanAddress(borrower: PublicKey, nonce: bigint): [PublicKey, number] {
|
|
1429
|
-
const nonceBuf = Buffer.alloc(8)
|
|
1430
|
-
nonceBuf.writeBigUInt64LE(nonce)
|
|
1431
|
-
return PublicKey.findProgramAddressSync(
|
|
1432
|
-
[borrower.toBytes(), nonceBuf],
|
|
1433
|
-
LOOPSCALE_PROGRAM_ID,
|
|
1434
|
-
)
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
/**
|
|
1438
|
-
* 8-byte Anchor discriminators for Loopscale instructions (loans + strategies).
|
|
1439
|
-
* Must match the on-chain constants in `interaction_validations/loopscale.rs`.
|
|
1440
|
-
*/
|
|
1441
|
-
export const LOOPSCALE_DISCRIMINATORS = {
|
|
1442
|
-
createLoan: Buffer.from([166, 131, 118, 219, 138, 218, 206, 140]),
|
|
1443
|
-
depositCollateral: Buffer.from([156, 131, 142, 116, 146, 247, 162, 120]),
|
|
1444
|
-
borrowPrincipal: Buffer.from([106, 10, 38, 204, 139, 188, 124, 50]),
|
|
1445
|
-
repayPrincipal: Buffer.from([229, 67, 83, 65, 77, 84, 80, 141]),
|
|
1446
|
-
withdrawCollateral: Buffer.from([115, 135, 168, 106, 139, 214, 138, 150]),
|
|
1447
|
-
closeLoan: Buffer.from([96, 114, 111, 204, 149, 228, 235, 124]),
|
|
1448
|
-
createStrategy: Buffer.from([152, 160, 107, 148, 245, 190, 127, 224]),
|
|
1449
|
-
depositStrategy: Buffer.from([246, 82, 57, 226, 131, 222, 253, 249]),
|
|
1450
|
-
withdrawStrategy: Buffer.from([31, 45, 162, 5, 193, 217, 134, 188]),
|
|
1451
|
-
closeStrategy: Buffer.from([56, 247, 170, 246, 89, 221, 134, 200]),
|
|
1452
|
-
updateWeightMatrix: Buffer.from([252, 166, 37, 207, 154, 83, 187, 128]),
|
|
1453
|
-
lockLoan: Buffer.from([28, 101, 52, 240, 146, 230, 95, 22]),
|
|
1454
|
-
unlockLoan: Buffer.from([121, 226, 178, 98, 215, 209, 240, 38]),
|
|
1455
|
-
updateStrategy: Buffer.from([16, 76, 138, 179, 171, 112, 196, 21]),
|
|
1456
|
-
refinanceLedger: Buffer.from([103, 41, 134, 43, 140, 152, 253, 74]),
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
/**
|
|
1460
|
-
* Account indices for Loopscale instructions (loans + strategies), matching
|
|
1461
|
-
* the on-chain validation in `interaction_validations/loopscale.rs`.
|
|
1462
|
-
*/
|
|
1463
|
-
export const LOOPSCALE_ACCOUNT_INDICES = {
|
|
1464
|
-
/** Loan account (BORROWER side) — index 3 for loan instructions, index 2 for update_weight_matrix */
|
|
1465
|
-
loan: 3,
|
|
1466
|
-
updateWeightMatrixLoan: 2,
|
|
1467
|
-
/** Mint indices vary per instruction */
|
|
1468
|
-
depositCollateralMint: 6,
|
|
1469
|
-
borrowPrincipalMint: 6,
|
|
1470
|
-
repayPrincipalMint: 6,
|
|
1471
|
-
withdrawCollateralMint: 7,
|
|
1472
|
-
strategy: 3,
|
|
1473
|
-
depositStrategyMint: 4,
|
|
1474
|
-
withdrawStrategyMint: 4,
|
|
1475
|
-
lockLoanLoan: 3,
|
|
1476
|
-
unlockLoanLoan: 1,
|
|
1477
|
-
refinanceLedgerLoan: 2,
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
export type LoopscalePolicyAction =
|
|
1481
|
-
| "createLoan"
|
|
1482
|
-
| "depositCollateral"
|
|
1483
|
-
| "borrowPrincipal"
|
|
1484
|
-
| "repayPrincipal"
|
|
1485
|
-
| "withdrawCollateral"
|
|
1486
|
-
| "closeLoan"
|
|
1487
|
-
| "updateWeightMatrix"
|
|
1488
|
-
| "lockLoan"
|
|
1489
|
-
| "unlockLoan"
|
|
1490
|
-
| "createStrategy"
|
|
1491
|
-
| "depositStrategy"
|
|
1492
|
-
| "withdrawStrategy"
|
|
1493
|
-
| "closeStrategy"
|
|
1494
|
-
| "updateStrategy"
|
|
1495
|
-
| "refinanceLedger"
|
|
1496
|
-
|
|
1497
|
-
const LOOPSCALE_ACTION_DISCRIMINATOR_MAP: Record<LoopscalePolicyAction, Buffer> = {
|
|
1498
|
-
createLoan: LOOPSCALE_DISCRIMINATORS.createLoan,
|
|
1499
|
-
depositCollateral: LOOPSCALE_DISCRIMINATORS.depositCollateral,
|
|
1500
|
-
borrowPrincipal: LOOPSCALE_DISCRIMINATORS.borrowPrincipal,
|
|
1501
|
-
repayPrincipal: LOOPSCALE_DISCRIMINATORS.repayPrincipal,
|
|
1502
|
-
withdrawCollateral: LOOPSCALE_DISCRIMINATORS.withdrawCollateral,
|
|
1503
|
-
closeLoan: LOOPSCALE_DISCRIMINATORS.closeLoan,
|
|
1504
|
-
updateWeightMatrix: LOOPSCALE_DISCRIMINATORS.updateWeightMatrix,
|
|
1505
|
-
lockLoan: LOOPSCALE_DISCRIMINATORS.lockLoan,
|
|
1506
|
-
unlockLoan: LOOPSCALE_DISCRIMINATORS.unlockLoan,
|
|
1507
|
-
createStrategy: LOOPSCALE_DISCRIMINATORS.createStrategy,
|
|
1508
|
-
depositStrategy: LOOPSCALE_DISCRIMINATORS.depositStrategy,
|
|
1509
|
-
withdrawStrategy: LOOPSCALE_DISCRIMINATORS.withdrawStrategy,
|
|
1510
|
-
closeStrategy: LOOPSCALE_DISCRIMINATORS.closeStrategy,
|
|
1511
|
-
updateStrategy: LOOPSCALE_DISCRIMINATORS.updateStrategy,
|
|
1512
|
-
refinanceLedger: LOOPSCALE_DISCRIMINATORS.refinanceLedger,
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
/** Mint account index for actions that have one, or undefined for create/close. */
|
|
1516
|
-
const LOOPSCALE_ACTION_MINT_INDEX: Partial<Record<LoopscalePolicyAction, number>> = {
|
|
1517
|
-
depositCollateral: LOOPSCALE_ACCOUNT_INDICES.depositCollateralMint,
|
|
1518
|
-
borrowPrincipal: LOOPSCALE_ACCOUNT_INDICES.borrowPrincipalMint,
|
|
1519
|
-
repayPrincipal: LOOPSCALE_ACCOUNT_INDICES.repayPrincipalMint,
|
|
1520
|
-
withdrawCollateral: LOOPSCALE_ACCOUNT_INDICES.withdrawCollateralMint,
|
|
1521
|
-
depositStrategy: LOOPSCALE_ACCOUNT_INDICES.depositStrategyMint,
|
|
1522
|
-
withdrawStrategy: LOOPSCALE_ACCOUNT_INDICES.withdrawStrategyMint,
|
|
1523
|
-
}
|
|
1524
|
-
|
|
1525
|
-
/**
|
|
1526
|
-
* Creates a policy that allows Loopscale interactions (loans and/or strategies).
|
|
1527
|
-
*
|
|
1528
|
-
* Loans (BORROWER side): create/close loan, deposit/withdraw collateral, borrow/repay principal.
|
|
1529
|
-
* Strategies (LENDER side): create/close strategy, deposit/withdraw into strategy.
|
|
1530
|
-
*
|
|
1531
|
-
* Optional mint constraints can restrict which collateral/principal mints are
|
|
1532
|
-
* allowed. The on-chain post-hook validator separately checks that positions are
|
|
1533
|
-
* tracked and that mints have matching token entries on the vault.
|
|
1534
|
-
*
|
|
1535
|
-
* @param params.actions - Which Loopscale actions to allow (default: all 15 — 10 loan + 5 strategy).
|
|
1536
|
-
* @param params.allowedMints - Optional list of allowed mints for deposit/borrow/repay/withdraw
|
|
1537
|
-
* @param params.threshold - Number of signers required (default 1)
|
|
1538
|
-
* @param params.timeLock - Time lock in seconds (default 0)
|
|
1539
|
-
*
|
|
1540
|
-
* @example
|
|
1541
|
-
* ```ts
|
|
1542
|
-
* // Allow all Loopscale loan actions (borrower side)
|
|
1543
|
-
* const policy = createLoopscalePolicy()
|
|
1544
|
-
*
|
|
1545
|
-
* // Allow only strategy actions (lender side)
|
|
1546
|
-
* const policy = createLoopscalePolicy({
|
|
1547
|
-
* actions: ["createStrategy", "depositStrategy", "withdrawStrategy", "closeStrategy"],
|
|
1548
|
-
* })
|
|
1549
|
-
* ```
|
|
1550
|
-
*/
|
|
1551
|
-
export function createLoopscalePolicy(params?: {
|
|
1552
|
-
/** Which Loopscale actions to allow (default: all 15) */
|
|
1553
|
-
actions?: LoopscalePolicyAction[]
|
|
1554
|
-
/** Allowed mints for deposit/borrow/repay/withdraw (optional) */
|
|
1555
|
-
allowedMints?: PublicKey[]
|
|
1556
|
-
/** Threshold (default 1) */
|
|
1557
|
-
threshold?: number
|
|
1558
|
-
/** Time lock in seconds (default 0) */
|
|
1559
|
-
timeLock?: number
|
|
1560
|
-
}): PolicyConfig {
|
|
1561
|
-
const actions: LoopscalePolicyAction[] = params?.actions ?? [
|
|
1562
|
-
// Loan actions (BORROWER side)
|
|
1563
|
-
"createLoan",
|
|
1564
|
-
"depositCollateral",
|
|
1565
|
-
"borrowPrincipal",
|
|
1566
|
-
"repayPrincipal",
|
|
1567
|
-
"withdrawCollateral",
|
|
1568
|
-
"closeLoan",
|
|
1569
|
-
"updateWeightMatrix",
|
|
1570
|
-
"lockLoan",
|
|
1571
|
-
"unlockLoan",
|
|
1572
|
-
// Strategy actions (LENDER side)
|
|
1573
|
-
"createStrategy",
|
|
1574
|
-
"depositStrategy",
|
|
1575
|
-
"withdrawStrategy",
|
|
1576
|
-
"closeStrategy",
|
|
1577
|
-
"updateStrategy",
|
|
1578
|
-
"refinanceLedger",
|
|
1579
|
-
]
|
|
1580
|
-
|
|
1581
|
-
const instructionsConstraints: InstructionConstraint[] = actions.map((action) => {
|
|
1582
|
-
const accountConstraints: AccountConstraint[] = []
|
|
1583
|
-
|
|
1584
|
-
// Add mint constraints for actions that have a mint account
|
|
1585
|
-
const mintIndex = LOOPSCALE_ACTION_MINT_INDEX[action]
|
|
1586
|
-
if (mintIndex !== undefined && params?.allowedMints && params.allowedMints.length > 0) {
|
|
1587
|
-
accountConstraints.push(createAccountConstraint(mintIndex, params.allowedMints))
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
return createInstructionConstraint({
|
|
1591
|
-
programId: LOOPSCALE_PROGRAM_ID,
|
|
1592
|
-
accountConstraints,
|
|
1593
|
-
dataConstraints: [createDiscriminatorConstraint(LOOPSCALE_ACTION_DISCRIMINATOR_MAP[action])],
|
|
1594
|
-
})
|
|
1595
|
-
})
|
|
1596
|
-
|
|
1597
|
-
return createProgramInteractionPolicy({
|
|
1598
|
-
instructionsConstraints,
|
|
1599
|
-
threshold: params?.threshold,
|
|
1600
|
-
timeLock: params?.timeLock,
|
|
1601
|
-
})
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
export function createOrderbookPolicy(params: {
|
|
1605
|
-
/** SY mints that are allowed */
|
|
1606
|
-
allowedSyMints: PublicKey[]
|
|
1607
|
-
/** Which orderbook actions to allow */
|
|
1608
|
-
actions: OrderbookPolicyAction[]
|
|
1609
|
-
/** Spending limits (optional) */
|
|
1610
|
-
spendingLimits?: SpendingLimit[]
|
|
1611
|
-
/** Threshold (number of signers required, typically 1) */
|
|
1612
|
-
threshold?: number
|
|
1613
|
-
/** Time lock in seconds (typically 0 for instant execution) */
|
|
1614
|
-
timeLock?: number
|
|
1615
|
-
}): PolicyConfig {
|
|
1616
|
-
const instructionsConstraints = createOrderbookInstructionConstraints({
|
|
1617
|
-
allowedSyMints: params.allowedSyMints,
|
|
1618
|
-
actions: params.actions,
|
|
1619
|
-
})
|
|
1620
|
-
|
|
1621
|
-
return createProgramInteractionPolicy({
|
|
1622
|
-
instructionsConstraints,
|
|
1623
|
-
spendingLimits: params.spendingLimits,
|
|
1624
|
-
threshold: params.threshold,
|
|
1625
|
-
timeLock: params.timeLock,
|
|
1626
|
-
})
|
|
1627
|
-
}
|
|
1628
|
-
|
|
1629
|
-
// ============================================================================
|
|
1630
|
-
// CLMM Policy Builders
|
|
1631
|
-
// ============================================================================
|
|
1632
|
-
|
|
1633
|
-
/** Exponent CLMM program ID. */
|
|
1634
|
-
export const EXPONENT_CLMM_PROGRAM_ID = new PublicKey("XPC1MM4dYACDfykNuXYZ5una2DsMDWL24CrYubCvarC")
|
|
1635
|
-
|
|
1636
|
-
/**
|
|
1637
|
-
* Single-byte discriminators for CLMM instructions.
|
|
1638
|
-
* These correspond to the instruction indices in the CLMM program.
|
|
1639
|
-
*/
|
|
1640
|
-
export const CLMM_DISCRIMINATORS = {
|
|
1641
|
-
depositLiquidity: Buffer.from([4]),
|
|
1642
|
-
addLiquidity: Buffer.from([25]),
|
|
1643
|
-
withdrawLiquidity: Buffer.from([5]),
|
|
1644
|
-
tradePt: Buffer.from([3]),
|
|
1645
|
-
tradePtExactOut: Buffer.from([24]),
|
|
1646
|
-
buyYt: Buffer.from([12]),
|
|
1647
|
-
sellYt: Buffer.from([13]),
|
|
1648
|
-
claimFarmEmission: Buffer.from([6]),
|
|
1649
|
-
}
|
|
1650
|
-
|
|
1651
|
-
/**
|
|
1652
|
-
* Account indices for CLMM instructions (matching the on-chain validation in
|
|
1653
|
-
* `interaction_validations/clmm.rs`). Useful for building fine-grained
|
|
1654
|
-
* account constraints in policies.
|
|
1655
|
-
*/
|
|
1656
|
-
export const CLMM_ACCOUNT_INDICES = {
|
|
1657
|
-
depositLiquidity: { depositor: 0, market: 1, ticks: 2, lpPosition: 3, tokenPtSrc: 4, tokenSySrc: 5 },
|
|
1658
|
-
addLiquidity: { owner: 0, market: 1, ticks: 2, lpPosition: 3, tokenPtSrc: 4, tokenSySrc: 5 },
|
|
1659
|
-
withdrawLiquidity: { owner: 0, market: 1, lpPosition: 2, ticks: 3, tokenPtDst: 4, tokenSyDst: 5 },
|
|
1660
|
-
tradePt: { trader: 0, market: 1, ticks: 2, tokenSyTrader: 3, tokenPtTrader: 4 },
|
|
1661
|
-
tradePtExactOut: { trader: 0, market: 1, ticks: 2, tokenSyTrader: 3, tokenPtTrader: 4 },
|
|
1662
|
-
buyYt: { trader: 0, market: 1, ticks: 2, tokenSyTrader: 3, tokenYtTrader: 4, tokenPtTrader: 5 },
|
|
1663
|
-
sellYt: { trader: 0, market: 1, ticks: 2, tokenYtTrader: 3, tokenPtTrader: 4, tokenSyTrader: 5 },
|
|
1664
|
-
claimFarmEmission: { owner: 0, market: 1, ticks: 2, lpPosition: 3, tokenDst: 4, mint: 5, tokenFarm: 6, tokenProgram: 7 },
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
/**
|
|
1668
|
-
* Creates a policy that allows all Exponent CLMM interactions: deposit/add/withdraw
|
|
1669
|
-
* liquidity, PT/SY swaps, YT trades, and farm emission claims.
|
|
1670
|
-
*
|
|
1671
|
-
* Optional market constraints can be applied to restrict which CLMM markets
|
|
1672
|
-
* the policy applies to. The on-chain post-hook validator separately checks
|
|
1673
|
-
* that token accounts are vault-owned tracked accounts.
|
|
1674
|
-
*
|
|
1675
|
-
* @param params.allowedMarkets - Optional list of allowed CLMM market addresses
|
|
1676
|
-
* @param params.threshold - Number of signers required (default 1)
|
|
1677
|
-
* @param params.timeLock - Time lock in seconds (default 0)
|
|
1678
|
-
*
|
|
1679
|
-
* @example
|
|
1680
|
-
* ```ts
|
|
1681
|
-
* // Allow all CLMM actions on any market
|
|
1682
|
-
* const policy = createClmmPolicy()
|
|
1683
|
-
*
|
|
1684
|
-
* // Allow CLMM actions only on specific markets
|
|
1685
|
-
* const policy = createClmmPolicy({
|
|
1686
|
-
* allowedMarkets: [BULKSOL_CLMM_MARKET, ONYC_CLMM_MARKET],
|
|
1687
|
-
* })
|
|
1688
|
-
* ```
|
|
1689
|
-
*/
|
|
1690
|
-
export function createClmmPolicy(params?: {
|
|
1691
|
-
/** Allowed CLMM market addresses (optional — if omitted, all markets are allowed) */
|
|
1692
|
-
allowedMarkets?: PublicKey[]
|
|
1693
|
-
/** Threshold (default 1) */
|
|
1694
|
-
threshold?: number
|
|
1695
|
-
/** Time lock in seconds (default 0) */
|
|
1696
|
-
timeLock?: number
|
|
1697
|
-
}): PolicyConfig {
|
|
1698
|
-
const allDiscriminators = [
|
|
1699
|
-
CLMM_DISCRIMINATORS.depositLiquidity,
|
|
1700
|
-
CLMM_DISCRIMINATORS.addLiquidity,
|
|
1701
|
-
CLMM_DISCRIMINATORS.withdrawLiquidity,
|
|
1702
|
-
CLMM_DISCRIMINATORS.tradePt,
|
|
1703
|
-
CLMM_DISCRIMINATORS.tradePtExactOut,
|
|
1704
|
-
CLMM_DISCRIMINATORS.buyYt,
|
|
1705
|
-
CLMM_DISCRIMINATORS.sellYt,
|
|
1706
|
-
CLMM_DISCRIMINATORS.claimFarmEmission,
|
|
1707
|
-
]
|
|
1708
|
-
|
|
1709
|
-
const instructionsConstraints: InstructionConstraint[] = allDiscriminators.map((disc) => {
|
|
1710
|
-
const accountConstraints: AccountConstraint[] = []
|
|
1711
|
-
|
|
1712
|
-
// Market account is at index 1 for all CLMM instructions
|
|
1713
|
-
if (params?.allowedMarkets && params.allowedMarkets.length > 0) {
|
|
1714
|
-
accountConstraints.push(createAccountConstraint(1, params.allowedMarkets))
|
|
1715
|
-
}
|
|
1716
|
-
|
|
1717
|
-
return createInstructionConstraint({
|
|
1718
|
-
programId: EXPONENT_CLMM_PROGRAM_ID,
|
|
1719
|
-
accountConstraints,
|
|
1720
|
-
dataConstraints: [createDiscriminatorConstraint(disc)],
|
|
1721
|
-
})
|
|
1722
|
-
})
|
|
1723
|
-
|
|
1724
|
-
return createProgramInteractionPolicy({
|
|
1725
|
-
instructionsConstraints,
|
|
1726
|
-
threshold: params?.threshold,
|
|
1727
|
-
timeLock: params?.timeLock,
|
|
1728
|
-
})
|
|
1729
|
-
}
|