@exponent-labs/exponent-sdk 0.1.8 → 0.9.0
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/CodamaEventDecoder.d.ts +49 -0
- package/build/CodamaEventDecoder.js +113 -0
- package/build/CodamaEventDecoder.js.map +1 -0
- package/build/addressLookupTableUtil.d.ts +23 -18
- package/build/addressLookupTableUtil.js +31 -5
- package/build/addressLookupTableUtil.js.map +1 -1
- package/build/client/clmm/accounts/lpPosition.d.ts +29 -0
- package/build/client/clmm/accounts/lpPosition.js +82 -0
- package/build/client/clmm/accounts/lpPosition.js.map +1 -0
- package/build/client/clmm/accounts/marketThree.d.ts +47 -0
- package/build/client/clmm/accounts/marketThree.js +139 -0
- package/build/client/clmm/accounts/marketThree.js.map +1 -0
- package/build/client/clmm/accounts/vault.d.ts +48 -0
- package/build/client/clmm/accounts/vault.js +128 -0
- package/build/client/clmm/accounts/vault.js.map +1 -0
- package/build/client/clmm/eventRegistry.d.ts +59 -0
- package/build/client/clmm/eventRegistry.js +58 -0
- package/build/client/clmm/eventRegistry.js.map +1 -0
- package/build/client/clmm/index.d.ts +78 -0
- package/build/client/clmm/index.js +96 -0
- package/build/client/clmm/index.js.map +1 -0
- package/build/client/clmm/instructions/addFarm.d.ts +19 -0
- package/build/client/clmm/instructions/addFarm.js +31 -0
- package/build/client/clmm/instructions/addFarm.js.map +1 -0
- package/build/client/clmm/instructions/addLiquidity.d.ts +26 -0
- package/build/client/clmm/instructions/addLiquidity.js +38 -0
- package/build/client/clmm/instructions/addLiquidity.js.map +1 -0
- package/build/client/clmm/instructions/addMarketEmission.d.ts +15 -0
- package/build/client/clmm/instructions/addMarketEmission.js +27 -0
- package/build/client/clmm/instructions/addMarketEmission.js.map +1 -0
- package/build/client/clmm/instructions/buyPt.d.ts +24 -0
- package/build/client/clmm/instructions/buyPt.js +36 -0
- package/build/client/clmm/instructions/buyPt.js.map +1 -0
- package/build/client/clmm/instructions/buyYt.d.ts +26 -0
- package/build/client/clmm/instructions/buyYt.js +42 -0
- package/build/client/clmm/instructions/buyYt.js.map +1 -0
- package/build/client/clmm/instructions/claimFarmEmission.d.ts +18 -0
- package/build/client/clmm/instructions/claimFarmEmission.js +30 -0
- package/build/client/clmm/instructions/claimFarmEmission.js.map +1 -0
- package/build/client/clmm/instructions/closeMarket.d.ts +17 -0
- package/build/client/clmm/instructions/closeMarket.js +26 -0
- package/build/client/clmm/instructions/closeMarket.js.map +1 -0
- package/build/client/clmm/instructions/depositLiquidity.d.ts +25 -0
- package/build/client/clmm/instructions/depositLiquidity.js +37 -0
- package/build/client/clmm/instructions/depositLiquidity.js.map +1 -0
- package/build/client/clmm/instructions/initializeMarket.d.ts +47 -0
- package/build/client/clmm/instructions/initializeMarket.js +63 -0
- package/build/client/clmm/instructions/initializeMarket.js.map +1 -0
- package/build/client/clmm/instructions/marketAccrueEmission.d.ts +13 -0
- package/build/client/clmm/instructions/marketAccrueEmission.js +22 -0
- package/build/client/clmm/instructions/marketAccrueEmission.js.map +1 -0
- package/build/client/clmm/instructions/marketCollectEmission.d.ts +18 -0
- package/build/client/clmm/instructions/marketCollectEmission.js +30 -0
- package/build/client/clmm/instructions/marketCollectEmission.js.map +1 -0
- package/build/client/clmm/instructions/modifyFarm.d.ts +17 -0
- package/build/client/clmm/instructions/modifyFarm.js +29 -0
- package/build/client/clmm/instructions/modifyFarm.js.map +1 -0
- package/build/client/clmm/instructions/modifyMarketSetting.d.ts +11 -0
- package/build/client/clmm/instructions/modifyMarketSetting.js +23 -0
- package/build/client/clmm/instructions/modifyMarketSetting.js.map +1 -0
- package/build/client/clmm/instructions/sellPt.d.ts +24 -0
- package/build/client/clmm/instructions/sellPt.js +36 -0
- package/build/client/clmm/instructions/sellPt.js.map +1 -0
- package/build/client/clmm/instructions/sellYt.d.ts +26 -0
- package/build/client/clmm/instructions/sellYt.js +42 -0
- package/build/client/clmm/instructions/sellYt.js.map +1 -0
- package/build/client/clmm/instructions/tradePt.d.ts +25 -0
- package/build/client/clmm/instructions/tradePt.js +37 -0
- package/build/client/clmm/instructions/tradePt.js.map +1 -0
- package/build/client/clmm/instructions/tradePtExactOut.d.ts +25 -0
- package/build/client/clmm/instructions/tradePtExactOut.js +37 -0
- package/build/client/clmm/instructions/tradePtExactOut.js.map +1 -0
- package/build/client/clmm/instructions/withdrawLiquidity.d.ts +23 -0
- package/build/client/clmm/instructions/withdrawLiquidity.js +35 -0
- package/build/client/clmm/instructions/withdrawLiquidity.js.map +1 -0
- package/build/client/clmm/instructions/wrapperBuyYt.d.ts +28 -0
- package/build/client/clmm/instructions/wrapperBuyYt.js +48 -0
- package/build/client/clmm/instructions/wrapperBuyYt.js.map +1 -0
- package/build/client/clmm/instructions/wrapperProvideLiquidity.d.ts +33 -0
- package/build/client/clmm/instructions/wrapperProvideLiquidity.js +53 -0
- package/build/client/clmm/instructions/wrapperProvideLiquidity.js.map +1 -0
- package/build/client/clmm/instructions/wrapperProvideLiquidityBase.d.ts +32 -0
- package/build/client/clmm/instructions/wrapperProvideLiquidityBase.js +52 -0
- package/build/client/clmm/instructions/wrapperProvideLiquidityBase.js.map +1 -0
- package/build/client/clmm/instructions/wrapperProvideLiquidityClassic.d.ts +28 -0
- package/build/client/clmm/instructions/wrapperProvideLiquidityClassic.js +44 -0
- package/build/client/clmm/instructions/wrapperProvideLiquidityClassic.js.map +1 -0
- package/build/client/clmm/instructions/wrapperSellYt.d.ts +27 -0
- package/build/client/clmm/instructions/wrapperSellYt.js +47 -0
- package/build/client/clmm/instructions/wrapperSellYt.js.map +1 -0
- package/build/client/clmm/instructions/wrapperWithdrawLiquidity.d.ts +25 -0
- package/build/client/clmm/instructions/wrapperWithdrawLiquidity.js +41 -0
- package/build/client/clmm/instructions/wrapperWithdrawLiquidity.js.map +1 -0
- package/build/client/clmm/instructions/wrapperWithdrawLiquidityClassic.d.ts +22 -0
- package/build/client/clmm/instructions/wrapperWithdrawLiquidityClassic.js +38 -0
- package/build/client/clmm/instructions/wrapperWithdrawLiquidityClassic.js.map +1 -0
- package/build/client/clmm/types/addFarmEvent.d.ts +35 -0
- package/build/client/clmm/types/addFarmEvent.js +24 -0
- package/build/client/clmm/types/addFarmEvent.js.map +1 -0
- package/build/client/clmm/types/amount.d.ts +33 -0
- package/build/client/clmm/types/amount.js +20 -0
- package/build/client/clmm/types/amount.js.map +1 -0
- package/build/client/clmm/types/buyPtEvent.d.ts +23 -0
- package/build/client/clmm/types/buyPtEvent.js +18 -0
- package/build/client/clmm/types/buyPtEvent.js.map +1 -0
- package/build/client/clmm/types/buyYtEvent.d.ts +56 -0
- package/build/client/clmm/types/buyYtEvent.js +36 -0
- package/build/client/clmm/types/buyYtEvent.js.map +1 -0
- package/build/client/clmm/types/claimFarmEmissionsEvent.d.ts +171 -0
- package/build/client/clmm/types/claimFarmEmissionsEvent.js +42 -0
- package/build/client/clmm/types/claimFarmEmissionsEvent.js.map +1 -0
- package/build/client/clmm/types/claimLimits.d.ts +22 -0
- package/build/client/clmm/types/claimLimits.js +11 -0
- package/build/client/clmm/types/claimLimits.js.map +1 -0
- package/build/client/clmm/types/closeMarketEvent.d.ts +23 -0
- package/build/client/clmm/types/closeMarketEvent.js +18 -0
- package/build/client/clmm/types/closeMarketEvent.js.map +1 -0
- package/build/client/clmm/types/configurationOptions.d.ts +34 -0
- package/build/client/clmm/types/configurationOptions.js +14 -0
- package/build/client/clmm/types/configurationOptions.js.map +1 -0
- package/build/client/clmm/types/cpiAccounts.d.ts +107 -0
- package/build/client/clmm/types/cpiAccounts.js +13 -0
- package/build/client/clmm/types/cpiAccounts.js.map +1 -0
- package/build/client/clmm/types/cpiCoreAccounts.d.ts +47 -0
- package/build/client/clmm/types/cpiCoreAccounts.js +10 -0
- package/build/client/clmm/types/cpiCoreAccounts.js.map +1 -0
- package/build/client/clmm/types/cpiInterfaceContext.d.ts +18 -0
- package/build/client/clmm/types/cpiInterfaceContext.js +10 -0
- package/build/client/clmm/types/cpiInterfaceContext.js.map +1 -0
- package/build/client/clmm/types/crossingSplit.d.ts +124 -0
- package/build/client/clmm/types/crossingSplit.js +20 -0
- package/build/client/clmm/types/crossingSplit.js.map +1 -0
- package/build/client/clmm/types/depositLiquidityEvent.d.ts +171 -0
- package/build/client/clmm/types/depositLiquidityEvent.js +42 -0
- package/build/client/clmm/types/depositLiquidityEvent.js.map +1 -0
- package/build/client/clmm/types/depositLiquidityReturnData.d.ts +67 -0
- package/build/client/clmm/types/depositLiquidityReturnData.js +38 -0
- package/build/client/clmm/types/depositLiquidityReturnData.js.map +1 -0
- package/build/client/clmm/types/emissionInfo.d.ts +36 -0
- package/build/client/clmm/types/emissionInfo.js +22 -0
- package/build/client/clmm/types/emissionInfo.js.map +1 -0
- package/build/client/clmm/types/farmEmission.d.ts +24 -0
- package/build/client/clmm/types/farmEmission.js +16 -0
- package/build/client/clmm/types/farmEmission.js.map +1 -0
- package/build/client/clmm/types/index.d.ts +48 -0
- package/build/client/clmm/types/index.js +65 -0
- package/build/client/clmm/types/index.js.map +1 -0
- package/build/client/clmm/types/liquidityNetBalanceLimits.d.ts +26 -0
- package/build/client/clmm/types/liquidityNetBalanceLimits.js +12 -0
- package/build/client/clmm/types/liquidityNetBalanceLimits.js.map +1 -0
- package/build/client/clmm/types/lpFarm.d.ts +35 -0
- package/build/client/clmm/types/lpFarm.js +10 -0
- package/build/client/clmm/types/lpFarm.js.map +1 -0
- package/build/client/clmm/types/marketAccrueEmissionEvent.d.ts +151 -0
- package/build/client/clmm/types/marketAccrueEmissionEvent.js +31 -0
- package/build/client/clmm/types/marketAccrueEmissionEvent.js.map +1 -0
- package/build/client/clmm/types/marketAdminAction.d.ts +359 -0
- package/build/client/clmm/types/marketAdminAction.js +72 -0
- package/build/client/clmm/types/marketAdminAction.js.map +1 -0
- package/build/client/clmm/types/marketCollectEmissionEvent.d.ts +163 -0
- package/build/client/clmm/types/marketCollectEmissionEvent.js +37 -0
- package/build/client/clmm/types/marketCollectEmissionEvent.js.map +1 -0
- package/build/client/clmm/types/marketEmission.d.ts +20 -0
- package/build/client/clmm/types/marketEmission.js +15 -0
- package/build/client/clmm/types/marketEmission.js.map +1 -0
- package/build/client/clmm/types/marketEmissions.d.ts +27 -0
- package/build/client/clmm/types/marketEmissions.js +9 -0
- package/build/client/clmm/types/marketEmissions.js.map +1 -0
- package/build/client/clmm/types/marketFinancials.d.ts +26 -0
- package/build/client/clmm/types/marketFinancials.js +12 -0
- package/build/client/clmm/types/marketFinancials.js.map +1 -0
- package/build/client/clmm/types/marketThreeInitEvent.d.ts +71 -0
- package/build/client/clmm/types/marketThreeInitEvent.js +42 -0
- package/build/client/clmm/types/marketThreeInitEvent.js.map +1 -0
- package/build/client/clmm/types/mergeEvent.d.ts +84 -0
- package/build/client/clmm/types/mergeEvent.js +55 -0
- package/build/client/clmm/types/mergeEvent.js.map +1 -0
- package/build/client/clmm/types/modifiedTick.d.ts +18 -0
- package/build/client/clmm/types/modifiedTick.js +10 -0
- package/build/client/clmm/types/modifiedTick.js.map +1 -0
- package/build/client/clmm/types/modifiedTicks.d.ts +43 -0
- package/build/client/clmm/types/modifiedTicks.js +13 -0
- package/build/client/clmm/types/modifiedTicks.js.map +1 -0
- package/build/client/clmm/types/modifyFarmEvent.d.ts +43 -0
- package/build/client/clmm/types/modifyFarmEvent.js +26 -0
- package/build/client/clmm/types/modifyFarmEvent.js.map +1 -0
- package/build/client/clmm/types/number.d.ts +2 -0
- package/build/client/clmm/types/number.js +8 -0
- package/build/client/clmm/types/number.js.map +1 -0
- package/build/client/clmm/types/personalYieldTracker.d.ts +15 -0
- package/build/client/clmm/types/personalYieldTracker.js +10 -0
- package/build/client/clmm/types/personalYieldTracker.js.map +1 -0
- package/build/client/clmm/types/personalYieldTrackers.d.ts +23 -0
- package/build/client/clmm/types/personalYieldTrackers.js +9 -0
- package/build/client/clmm/types/personalYieldTrackers.js.map +1 -0
- package/build/client/clmm/types/principalShare.d.ts +51 -0
- package/build/client/clmm/types/principalShare.js +14 -0
- package/build/client/clmm/types/principalShare.js.map +1 -0
- package/build/client/clmm/types/principalShareTrackers.d.ts +63 -0
- package/build/client/clmm/types/principalShareTrackers.js +9 -0
- package/build/client/clmm/types/principalShareTrackers.js.map +1 -0
- package/build/client/clmm/types/sellPtEvent.d.ts +23 -0
- package/build/client/clmm/types/sellPtEvent.js +18 -0
- package/build/client/clmm/types/sellPtEvent.js.map +1 -0
- package/build/client/clmm/types/sellYtEvent.d.ts +47 -0
- package/build/client/clmm/types/sellYtEvent.js +33 -0
- package/build/client/clmm/types/sellYtEvent.js.map +1 -0
- package/build/client/clmm/types/stripEvent.d.ts +84 -0
- package/build/client/clmm/types/stripEvent.js +58 -0
- package/build/client/clmm/types/stripEvent.js.map +1 -0
- package/build/client/clmm/types/swapDirection.d.ts +5 -0
- package/build/client/clmm/types/swapDirection.js +11 -0
- package/build/client/clmm/types/swapDirection.js.map +1 -0
- package/build/client/clmm/types/tradePtEvent.d.ts +110 -0
- package/build/client/clmm/types/tradePtEvent.js +37 -0
- package/build/client/clmm/types/tradePtEvent.js.map +1 -0
- package/build/client/clmm/types/withdrawLiquidityEvent.d.ts +183 -0
- package/build/client/clmm/types/withdrawLiquidityEvent.js +45 -0
- package/build/client/clmm/types/withdrawLiquidityEvent.js.map +1 -0
- package/build/client/clmm/types/withdrawLiquidityReturnData.d.ts +46 -0
- package/build/client/clmm/types/withdrawLiquidityReturnData.js +17 -0
- package/build/client/clmm/types/withdrawLiquidityReturnData.js.map +1 -0
- package/build/client/clmm/types/wrapperBuyYtEvent.d.ts +23 -0
- package/build/client/clmm/types/wrapperBuyYtEvent.js +18 -0
- package/build/client/clmm/types/wrapperBuyYtEvent.js.map +1 -0
- package/build/client/clmm/types/wrapperProvideLiquidityBaseEvent.d.ts +56 -0
- package/build/client/clmm/types/wrapperProvideLiquidityBaseEvent.js +30 -0
- package/build/client/clmm/types/wrapperProvideLiquidityBaseEvent.js.map +1 -0
- package/build/client/clmm/types/wrapperProvideLiquidityClassicEvent.d.ts +52 -0
- package/build/client/clmm/types/wrapperProvideLiquidityClassicEvent.js +29 -0
- package/build/client/clmm/types/wrapperProvideLiquidityClassicEvent.js.map +1 -0
- package/build/client/clmm/types/wrapperProvideLiquidityEvent.d.ts +56 -0
- package/build/client/clmm/types/wrapperProvideLiquidityEvent.js +30 -0
- package/build/client/clmm/types/wrapperProvideLiquidityEvent.js.map +1 -0
- package/build/client/clmm/types/wrapperSellYtEvent.d.ts +23 -0
- package/build/client/clmm/types/wrapperSellYtEvent.js +18 -0
- package/build/client/clmm/types/wrapperSellYtEvent.js.map +1 -0
- package/build/client/clmm/types/wrapperWithdrawLiquidityClassicEvent.d.ts +60 -0
- package/build/client/clmm/types/wrapperWithdrawLiquidityClassicEvent.js +31 -0
- package/build/client/clmm/types/wrapperWithdrawLiquidityClassicEvent.js.map +1 -0
- package/build/client/clmm/types/wrapperWithdrawLiquidityEvent.d.ts +60 -0
- package/build/client/clmm/types/wrapperWithdrawLiquidityEvent.js +31 -0
- package/build/client/clmm/types/wrapperWithdrawLiquidityEvent.js.map +1 -0
- package/build/client/core/accounts/admin.d.ts +18 -0
- package/build/client/core/accounts/admin.js +71 -0
- package/build/client/core/accounts/admin.js.map +1 -0
- package/build/client/core/accounts/lpPosition.d.ts +20 -0
- package/build/client/core/accounts/lpPosition.js +73 -0
- package/build/client/core/accounts/lpPosition.js.map +1 -0
- package/build/client/core/accounts/marketTwo.d.ts +42 -0
- package/build/client/core/accounts/marketTwo.js +122 -0
- package/build/client/core/accounts/marketTwo.js.map +1 -0
- package/build/client/core/accounts/vault.d.ts +48 -0
- package/build/client/core/accounts/vault.js +128 -0
- package/build/client/core/accounts/vault.js.map +1 -0
- package/build/client/core/accounts/yieldTokenPosition.d.ts +20 -0
- package/build/client/core/accounts/yieldTokenPosition.js +74 -0
- package/build/client/core/accounts/yieldTokenPosition.js.map +1 -0
- package/build/client/core/eventRegistry.d.ts +87 -0
- package/build/client/core/eventRegistry.js +86 -0
- package/build/client/core/eventRegistry.js.map +1 -0
- package/build/client/core/index.d.ts +109 -0
- package/build/client/core/index.js +127 -0
- package/build/client/core/index.js.map +1 -0
- package/build/client/core/instructions/addEmission.d.ts +19 -0
- package/build/client/core/instructions/addEmission.js +35 -0
- package/build/client/core/instructions/addEmission.js.map +1 -0
- package/build/client/core/instructions/addFarm.d.ts +17 -0
- package/build/client/core/instructions/addFarm.js +29 -0
- package/build/client/core/instructions/addFarm.js.map +1 -0
- package/build/client/core/instructions/addLpTokensMetadata.d.ts +16 -0
- package/build/client/core/instructions/addLpTokensMetadata.js +32 -0
- package/build/client/core/instructions/addLpTokensMetadata.js.map +1 -0
- package/build/client/core/instructions/addMarketEmission.d.ts +16 -0
- package/build/client/core/instructions/addMarketEmission.js +28 -0
- package/build/client/core/instructions/addMarketEmission.js.map +1 -0
- package/build/client/core/instructions/buyYt.d.ts +28 -0
- package/build/client/core/instructions/buyYt.js +44 -0
- package/build/client/core/instructions/buyYt.js.map +1 -0
- package/build/client/core/instructions/claimFarmEmissions.d.ts +17 -0
- package/build/client/core/instructions/claimFarmEmissions.js +29 -0
- package/build/client/core/instructions/claimFarmEmissions.js.map +1 -0
- package/build/client/core/instructions/collectEmission.d.ts +21 -0
- package/build/client/core/instructions/collectEmission.js +37 -0
- package/build/client/core/instructions/collectEmission.js.map +1 -0
- package/build/client/core/instructions/collectInterest.d.ts +20 -0
- package/build/client/core/instructions/collectInterest.js +36 -0
- package/build/client/core/instructions/collectInterest.js.map +1 -0
- package/build/client/core/instructions/collectTreasuryEmission.d.ts +21 -0
- package/build/client/core/instructions/collectTreasuryEmission.js +33 -0
- package/build/client/core/instructions/collectTreasuryEmission.js.map +1 -0
- package/build/client/core/instructions/collectTreasuryInterest.d.ts +20 -0
- package/build/client/core/instructions/collectTreasuryInterest.js +32 -0
- package/build/client/core/instructions/collectTreasuryInterest.js.map +1 -0
- package/build/client/core/instructions/depositYt.d.ts +19 -0
- package/build/client/core/instructions/depositYt.js +31 -0
- package/build/client/core/instructions/depositYt.js.map +1 -0
- package/build/client/core/instructions/initLpPosition.d.ts +11 -0
- package/build/client/core/instructions/initLpPosition.js +20 -0
- package/build/client/core/instructions/initLpPosition.js.map +1 -0
- package/build/client/core/instructions/initMarketTwo.d.ts +37 -0
- package/build/client/core/instructions/initMarketTwo.js +53 -0
- package/build/client/core/instructions/initMarketTwo.js.map +1 -0
- package/build/client/core/instructions/initializeVault.d.ts +34 -0
- package/build/client/core/instructions/initializeVault.js +58 -0
- package/build/client/core/instructions/initializeVault.js.map +1 -0
- package/build/client/core/instructions/initializeYieldPosition.d.ts +10 -0
- package/build/client/core/instructions/initializeYieldPosition.js +19 -0
- package/build/client/core/instructions/initializeYieldPosition.js.map +1 -0
- package/build/client/core/instructions/marketCollectEmission.d.ts +17 -0
- package/build/client/core/instructions/marketCollectEmission.js +29 -0
- package/build/client/core/instructions/marketCollectEmission.js.map +1 -0
- package/build/client/core/instructions/marketDepositLp.d.ts +19 -0
- package/build/client/core/instructions/marketDepositLp.js +31 -0
- package/build/client/core/instructions/marketDepositLp.js.map +1 -0
- package/build/client/core/instructions/marketTwoDepositLiquidity.d.ts +22 -0
- package/build/client/core/instructions/marketTwoDepositLiquidity.js +34 -0
- package/build/client/core/instructions/marketTwoDepositLiquidity.js.map +1 -0
- package/build/client/core/instructions/marketTwoWithdrawLiquidity.d.ts +22 -0
- package/build/client/core/instructions/marketTwoWithdrawLiquidity.js +34 -0
- package/build/client/core/instructions/marketTwoWithdrawLiquidity.js.map +1 -0
- package/build/client/core/instructions/marketWithdrawLp.d.ts +19 -0
- package/build/client/core/instructions/marketWithdrawLp.js +31 -0
- package/build/client/core/instructions/marketWithdrawLp.js.map +1 -0
- package/build/client/core/instructions/merge.d.ts +22 -0
- package/build/client/core/instructions/merge.js +32 -0
- package/build/client/core/instructions/merge.js.map +1 -0
- package/build/client/core/instructions/modifyFarm.d.ts +15 -0
- package/build/client/core/instructions/modifyFarm.js +27 -0
- package/build/client/core/instructions/modifyFarm.js.map +1 -0
- package/build/client/core/instructions/modifyMarketSetting.d.ts +12 -0
- package/build/client/core/instructions/modifyMarketSetting.js +24 -0
- package/build/client/core/instructions/modifyMarketSetting.js.map +1 -0
- package/build/client/core/instructions/modifyVaultSetting.d.ts +12 -0
- package/build/client/core/instructions/modifyVaultSetting.js +24 -0
- package/build/client/core/instructions/modifyVaultSetting.js.map +1 -0
- package/build/client/core/instructions/reallocMarket.d.ts +12 -0
- package/build/client/core/instructions/reallocMarket.js +24 -0
- package/build/client/core/instructions/reallocMarket.js.map +1 -0
- package/build/client/core/instructions/sellYt.d.ts +28 -0
- package/build/client/core/instructions/sellYt.js +44 -0
- package/build/client/core/instructions/sellYt.js.map +1 -0
- package/build/client/core/instructions/stageYtYield.d.ts +13 -0
- package/build/client/core/instructions/stageYtYield.js +22 -0
- package/build/client/core/instructions/stageYtYield.js.map +1 -0
- package/build/client/core/instructions/strip.d.ts +22 -0
- package/build/client/core/instructions/strip.js +32 -0
- package/build/client/core/instructions/strip.js.map +1 -0
- package/build/client/core/instructions/tradePt.d.ts +20 -0
- package/build/client/core/instructions/tradePt.js +32 -0
- package/build/client/core/instructions/tradePt.js.map +1 -0
- package/build/client/core/instructions/withdrawYt.d.ts +20 -0
- package/build/client/core/instructions/withdrawYt.js +32 -0
- package/build/client/core/instructions/withdrawYt.js.map +1 -0
- package/build/client/core/instructions/wrapperBuyPt.d.ts +21 -0
- package/build/client/core/instructions/wrapperBuyPt.js +33 -0
- package/build/client/core/instructions/wrapperBuyPt.js.map +1 -0
- package/build/client/core/instructions/wrapperBuyYt.d.ts +32 -0
- package/build/client/core/instructions/wrapperBuyYt.js +52 -0
- package/build/client/core/instructions/wrapperBuyYt.js.map +1 -0
- package/build/client/core/instructions/wrapperCollectInterest.d.ts +19 -0
- package/build/client/core/instructions/wrapperCollectInterest.js +35 -0
- package/build/client/core/instructions/wrapperCollectInterest.js.map +1 -0
- package/build/client/core/instructions/wrapperMerge.d.ts +24 -0
- package/build/client/core/instructions/wrapperMerge.js +44 -0
- package/build/client/core/instructions/wrapperMerge.js.map +1 -0
- package/build/client/core/instructions/wrapperProvideLiquidity.d.ts +35 -0
- package/build/client/core/instructions/wrapperProvideLiquidity.js +59 -0
- package/build/client/core/instructions/wrapperProvideLiquidity.js.map +1 -0
- package/build/client/core/instructions/wrapperProvideLiquidityBase.d.ts +28 -0
- package/build/client/core/instructions/wrapperProvideLiquidityBase.js +44 -0
- package/build/client/core/instructions/wrapperProvideLiquidityBase.js.map +1 -0
- package/build/client/core/instructions/wrapperProvideLiquidityClassic.d.ts +26 -0
- package/build/client/core/instructions/wrapperProvideLiquidityClassic.js +42 -0
- package/build/client/core/instructions/wrapperProvideLiquidityClassic.js.map +1 -0
- package/build/client/core/instructions/wrapperSellPt.d.ts +21 -0
- package/build/client/core/instructions/wrapperSellPt.js +33 -0
- package/build/client/core/instructions/wrapperSellPt.js.map +1 -0
- package/build/client/core/instructions/wrapperSellYt.d.ts +29 -0
- package/build/client/core/instructions/wrapperSellYt.js +49 -0
- package/build/client/core/instructions/wrapperSellYt.js.map +1 -0
- package/build/client/core/instructions/wrapperStrip.d.ts +26 -0
- package/build/client/core/instructions/wrapperStrip.js +46 -0
- package/build/client/core/instructions/wrapperStrip.js.map +1 -0
- package/build/client/core/instructions/wrapperWithdrawLiquidity.d.ts +26 -0
- package/build/client/core/instructions/wrapperWithdrawLiquidity.js +42 -0
- package/build/client/core/instructions/wrapperWithdrawLiquidity.js.map +1 -0
- package/build/client/core/instructions/wrapperWithdrawLiquidityClassic.d.ts +24 -0
- package/build/client/core/instructions/wrapperWithdrawLiquidityClassic.js +40 -0
- package/build/client/core/instructions/wrapperWithdrawLiquidityClassic.js.map +1 -0
- package/build/client/core/types/adminAction.d.ts +326 -0
- package/build/client/core/types/adminAction.js +87 -0
- package/build/client/core/types/adminAction.js.map +1 -0
- package/build/client/core/types/amount.d.ts +33 -0
- package/build/client/core/types/amount.js +20 -0
- package/build/client/core/types/amount.js.map +1 -0
- package/build/client/core/types/buyPtEvent.d.ts +27 -0
- package/build/client/core/types/buyPtEvent.js +19 -0
- package/build/client/core/types/buyPtEvent.js.map +1 -0
- package/build/client/core/types/buyYtEvent.d.ts +68 -0
- package/build/client/core/types/buyYtEvent.js +45 -0
- package/build/client/core/types/buyYtEvent.js.map +1 -0
- package/build/client/core/types/claimFarmEmissionsEvent.d.ts +43 -0
- package/build/client/core/types/claimFarmEmissionsEvent.js +35 -0
- package/build/client/core/types/claimFarmEmissionsEvent.js.map +1 -0
- package/build/client/core/types/claimFarmEmissionsEventV2.d.ts +98 -0
- package/build/client/core/types/claimFarmEmissionsEventV2.js +38 -0
- package/build/client/core/types/claimFarmEmissionsEventV2.js.map +1 -0
- package/build/client/core/types/claimLimits.d.ts +22 -0
- package/build/client/core/types/claimLimits.js +11 -0
- package/build/client/core/types/claimLimits.js.map +1 -0
- package/build/client/core/types/collectEmissionEvent.d.ts +35 -0
- package/build/client/core/types/collectEmissionEvent.js +24 -0
- package/build/client/core/types/collectEmissionEvent.js.map +1 -0
- package/build/client/core/types/collectEmissionEventV2.d.ts +68 -0
- package/build/client/core/types/collectEmissionEventV2.js +27 -0
- package/build/client/core/types/collectEmissionEventV2.js.map +1 -0
- package/build/client/core/types/collectInterestEvent.d.ts +31 -0
- package/build/client/core/types/collectInterestEvent.js +23 -0
- package/build/client/core/types/collectInterestEvent.js.map +1 -0
- package/build/client/core/types/collectInterestEventV2.d.ts +64 -0
- package/build/client/core/types/collectInterestEventV2.js +26 -0
- package/build/client/core/types/collectInterestEventV2.js.map +1 -0
- package/build/client/core/types/collectTreasuryEmissionKind.d.ts +5 -0
- package/build/client/core/types/collectTreasuryEmissionKind.js +11 -0
- package/build/client/core/types/collectTreasuryEmissionKind.js.map +1 -0
- package/build/client/core/types/collectTreasuryInterestKind.d.ts +5 -0
- package/build/client/core/types/collectTreasuryInterestKind.js +11 -0
- package/build/client/core/types/collectTreasuryInterestKind.js.map +1 -0
- package/build/client/core/types/cpiAccounts.d.ts +107 -0
- package/build/client/core/types/cpiAccounts.js +13 -0
- package/build/client/core/types/cpiAccounts.js.map +1 -0
- package/build/client/core/types/cpiInterfaceContext.d.ts +18 -0
- package/build/client/core/types/cpiInterfaceContext.js +10 -0
- package/build/client/core/types/cpiInterfaceContext.js.map +1 -0
- package/build/client/core/types/depositLiquidityEvent.d.ts +67 -0
- package/build/client/core/types/depositLiquidityEvent.js +47 -0
- package/build/client/core/types/depositLiquidityEvent.js.map +1 -0
- package/build/client/core/types/depositLpEvent.d.ts +43 -0
- package/build/client/core/types/depositLpEvent.js +35 -0
- package/build/client/core/types/depositLpEvent.js.map +1 -0
- package/build/client/core/types/depositLpEventV2.d.ts +98 -0
- package/build/client/core/types/depositLpEventV2.js +38 -0
- package/build/client/core/types/depositLpEventV2.js.map +1 -0
- package/build/client/core/types/depositYtEvent.d.ts +56 -0
- package/build/client/core/types/depositYtEvent.js +39 -0
- package/build/client/core/types/depositYtEvent.js.map +1 -0
- package/build/client/core/types/depositYtEventV2.d.ts +89 -0
- package/build/client/core/types/depositYtEventV2.js +42 -0
- package/build/client/core/types/depositYtEventV2.js.map +1 -0
- package/build/client/core/types/emissionInfo.d.ts +36 -0
- package/build/client/core/types/emissionInfo.js +22 -0
- package/build/client/core/types/emissionInfo.js.map +1 -0
- package/build/client/core/types/farmEmission.d.ts +24 -0
- package/build/client/core/types/farmEmission.js +16 -0
- package/build/client/core/types/farmEmission.js.map +1 -0
- package/build/client/core/types/index.d.ts +60 -0
- package/build/client/core/types/index.js +77 -0
- package/build/client/core/types/index.js.map +1 -0
- package/build/client/core/types/initLpPositionEvent.d.ts +35 -0
- package/build/client/core/types/initLpPositionEvent.js +27 -0
- package/build/client/core/types/initLpPositionEvent.js.map +1 -0
- package/build/client/core/types/initializeYieldPositionEvent.d.ts +23 -0
- package/build/client/core/types/initializeYieldPositionEvent.js +21 -0
- package/build/client/core/types/initializeYieldPositionEvent.js.map +1 -0
- package/build/client/core/types/liquidityNetBalanceLimits.d.ts +26 -0
- package/build/client/core/types/liquidityNetBalanceLimits.js +12 -0
- package/build/client/core/types/liquidityNetBalanceLimits.js.map +1 -0
- package/build/client/core/types/lpFarm.d.ts +35 -0
- package/build/client/core/types/lpFarm.js +10 -0
- package/build/client/core/types/lpFarm.js.map +1 -0
- package/build/client/core/types/marketAdminAction.d.ts +286 -0
- package/build/client/core/types/marketAdminAction.js +61 -0
- package/build/client/core/types/marketAdminAction.js.map +1 -0
- package/build/client/core/types/marketCollectEmissionEvent.d.ts +39 -0
- package/build/client/core/types/marketCollectEmissionEvent.js +31 -0
- package/build/client/core/types/marketCollectEmissionEvent.js.map +1 -0
- package/build/client/core/types/marketCollectEmissionEventV2.d.ts +94 -0
- package/build/client/core/types/marketCollectEmissionEventV2.js +34 -0
- package/build/client/core/types/marketCollectEmissionEventV2.js.map +1 -0
- package/build/client/core/types/marketEmission.d.ts +20 -0
- package/build/client/core/types/marketEmission.js +15 -0
- package/build/client/core/types/marketEmission.js.map +1 -0
- package/build/client/core/types/marketEmissions.d.ts +27 -0
- package/build/client/core/types/marketEmissions.js +9 -0
- package/build/client/core/types/marketEmissions.js.map +1 -0
- package/build/client/core/types/marketFinancials.d.ts +30 -0
- package/build/client/core/types/marketFinancials.js +13 -0
- package/build/client/core/types/marketFinancials.js.map +1 -0
- package/build/client/core/types/mergeEvent.d.ts +84 -0
- package/build/client/core/types/mergeEvent.js +55 -0
- package/build/client/core/types/mergeEvent.js.map +1 -0
- package/build/client/core/types/number.d.ts +2 -0
- package/build/client/core/types/number.js +8 -0
- package/build/client/core/types/number.js.map +1 -0
- package/build/client/core/types/personalYieldTracker.d.ts +15 -0
- package/build/client/core/types/personalYieldTracker.js +10 -0
- package/build/client/core/types/personalYieldTracker.js.map +1 -0
- package/build/client/core/types/personalYieldTrackers.d.ts +23 -0
- package/build/client/core/types/personalYieldTrackers.js +9 -0
- package/build/client/core/types/personalYieldTrackers.js.map +1 -0
- package/build/client/core/types/principleDetails.d.ts +11 -0
- package/build/client/core/types/principleDetails.js +12 -0
- package/build/client/core/types/principleDetails.js.map +1 -0
- package/build/client/core/types/principles.d.ts +79 -0
- package/build/client/core/types/principles.js +14 -0
- package/build/client/core/types/principles.js.map +1 -0
- package/build/client/core/types/sellPtEvent.d.ts +27 -0
- package/build/client/core/types/sellPtEvent.js +19 -0
- package/build/client/core/types/sellPtEvent.js.map +1 -0
- package/build/client/core/types/sellYtEvent.d.ts +59 -0
- package/build/client/core/types/sellYtEvent.js +42 -0
- package/build/client/core/types/sellYtEvent.js.map +1 -0
- package/build/client/core/types/stageYieldEvent.d.ts +44 -0
- package/build/client/core/types/stageYieldEvent.js +30 -0
- package/build/client/core/types/stageYieldEvent.js.map +1 -0
- package/build/client/core/types/stageYieldEventV2.d.ts +73 -0
- package/build/client/core/types/stageYieldEventV2.js +32 -0
- package/build/client/core/types/stageYieldEventV2.js.map +1 -0
- package/build/client/core/types/stripEvent.d.ts +84 -0
- package/build/client/core/types/stripEvent.js +58 -0
- package/build/client/core/types/stripEvent.js.map +1 -0
- package/build/client/core/types/tradePtEvent.d.ts +52 -0
- package/build/client/core/types/tradePtEvent.js +38 -0
- package/build/client/core/types/tradePtEvent.js.map +1 -0
- package/build/client/core/types/withdrawLiquidityEvent.d.ts +59 -0
- package/build/client/core/types/withdrawLiquidityEvent.js +45 -0
- package/build/client/core/types/withdrawLiquidityEvent.js.map +1 -0
- package/build/client/core/types/withdrawLpEvent.d.ts +43 -0
- package/build/client/core/types/withdrawLpEvent.js +35 -0
- package/build/client/core/types/withdrawLpEvent.js.map +1 -0
- package/build/client/core/types/withdrawLpEventV2.d.ts +98 -0
- package/build/client/core/types/withdrawLpEventV2.js +38 -0
- package/build/client/core/types/withdrawLpEventV2.js.map +1 -0
- package/build/client/core/types/withdrawYtEvent.d.ts +56 -0
- package/build/client/core/types/withdrawYtEvent.js +39 -0
- package/build/client/core/types/withdrawYtEvent.js.map +1 -0
- package/build/client/core/types/withdrawYtEventV2.d.ts +89 -0
- package/build/client/core/types/withdrawYtEventV2.js +42 -0
- package/build/client/core/types/withdrawYtEventV2.js.map +1 -0
- package/build/client/core/types/wrapperBuyYtEvent.d.ts +27 -0
- package/build/client/core/types/wrapperBuyYtEvent.js +19 -0
- package/build/client/core/types/wrapperBuyYtEvent.js.map +1 -0
- package/build/client/core/types/wrapperCollectInterestEvent.d.ts +23 -0
- package/build/client/core/types/wrapperCollectInterestEvent.js +18 -0
- package/build/client/core/types/wrapperCollectInterestEvent.js.map +1 -0
- package/build/client/core/types/wrapperMergeEvent.d.ts +27 -0
- package/build/client/core/types/wrapperMergeEvent.js +19 -0
- package/build/client/core/types/wrapperMergeEvent.js.map +1 -0
- package/build/client/core/types/wrapperProvideLiquidityBaseEvent.d.ts +35 -0
- package/build/client/core/types/wrapperProvideLiquidityBaseEvent.js +21 -0
- package/build/client/core/types/wrapperProvideLiquidityBaseEvent.js.map +1 -0
- package/build/client/core/types/wrapperProvideLiquidityClassicEvent.d.ts +31 -0
- package/build/client/core/types/wrapperProvideLiquidityClassicEvent.js +20 -0
- package/build/client/core/types/wrapperProvideLiquidityClassicEvent.js.map +1 -0
- package/build/client/core/types/wrapperProvideLiquidityEvent.d.ts +31 -0
- package/build/client/core/types/wrapperProvideLiquidityEvent.js +20 -0
- package/build/client/core/types/wrapperProvideLiquidityEvent.js.map +1 -0
- package/build/client/core/types/wrapperSellYtEvent.d.ts +27 -0
- package/build/client/core/types/wrapperSellYtEvent.js +19 -0
- package/build/client/core/types/wrapperSellYtEvent.js.map +1 -0
- package/build/client/core/types/wrapperStripEvent.d.ts +27 -0
- package/build/client/core/types/wrapperStripEvent.js +19 -0
- package/build/client/core/types/wrapperStripEvent.js.map +1 -0
- package/build/client/core/types/wrapperWithdrawLiquidityClassicEvent.d.ts +31 -0
- package/build/client/core/types/wrapperWithdrawLiquidityClassicEvent.js +20 -0
- package/build/client/core/types/wrapperWithdrawLiquidityClassicEvent.js.map +1 -0
- package/build/client/core/types/wrapperWithdrawLiquidityEvent.d.ts +27 -0
- package/build/client/core/types/wrapperWithdrawLiquidityEvent.js +19 -0
- package/build/client/core/types/wrapperWithdrawLiquidityEvent.js.map +1 -0
- package/build/client/core/types/yieldTokenTracker.d.ts +15 -0
- package/build/client/core/types/yieldTokenTracker.js +10 -0
- package/build/client/core/types/yieldTokenTracker.js.map +1 -0
- package/build/client/orderbook/accounts/cpiAccountsOrderbook.d.ts +18 -0
- package/build/client/orderbook/accounts/cpiAccountsOrderbook.js +66 -0
- package/build/client/orderbook/accounts/cpiAccountsOrderbook.js.map +1 -0
- package/build/client/orderbook/accounts/vault.d.ts +48 -0
- package/build/client/orderbook/accounts/vault.js +128 -0
- package/build/client/orderbook/accounts/vault.js.map +1 -0
- package/build/client/orderbook/eventRegistry.d.ts +45 -0
- package/build/client/orderbook/eventRegistry.js +44 -0
- package/build/client/orderbook/eventRegistry.js.map +1 -0
- package/build/client/orderbook/index.d.ts +51 -0
- package/build/client/orderbook/index.js +69 -0
- package/build/client/orderbook/index.js.map +1 -0
- package/build/client/orderbook/instructions/collectAdminEmission.d.ts +14 -0
- package/build/client/orderbook/instructions/collectAdminEmission.js +26 -0
- package/build/client/orderbook/instructions/collectAdminEmission.js.map +1 -0
- package/build/client/orderbook/instructions/collectAdminFee.d.ts +21 -0
- package/build/client/orderbook/instructions/collectAdminFee.js +34 -0
- package/build/client/orderbook/instructions/collectAdminFee.js.map +1 -0
- package/build/client/orderbook/instructions/collectInterest.d.ts +21 -0
- package/build/client/orderbook/instructions/collectInterest.js +37 -0
- package/build/client/orderbook/instructions/collectInterest.js.map +1 -0
- package/build/client/orderbook/instructions/initializeOrderbook.d.ts +36 -0
- package/build/client/orderbook/instructions/initializeOrderbook.js +52 -0
- package/build/client/orderbook/instructions/initializeOrderbook.js.map +1 -0
- package/build/client/orderbook/instructions/marketOffer.d.ts +30 -0
- package/build/client/orderbook/instructions/marketOffer.js +46 -0
- package/build/client/orderbook/instructions/marketOffer.js.map +1 -0
- package/build/client/orderbook/instructions/postOffer.d.ts +33 -0
- package/build/client/orderbook/instructions/postOffer.js +49 -0
- package/build/client/orderbook/instructions/postOffer.js.map +1 -0
- package/build/client/orderbook/instructions/reallocOrderbookAccount.d.ts +12 -0
- package/build/client/orderbook/instructions/reallocOrderbookAccount.js +24 -0
- package/build/client/orderbook/instructions/reallocOrderbookAccount.js.map +1 -0
- package/build/client/orderbook/instructions/removeExpiredOffers.d.ts +12 -0
- package/build/client/orderbook/instructions/removeExpiredOffers.js +21 -0
- package/build/client/orderbook/instructions/removeExpiredOffers.js.map +1 -0
- package/build/client/orderbook/instructions/removeOffer.d.ts +24 -0
- package/build/client/orderbook/instructions/removeOffer.js +40 -0
- package/build/client/orderbook/instructions/removeOffer.js.map +1 -0
- package/build/client/orderbook/instructions/setConfigurationOptions.d.ts +10 -0
- package/build/client/orderbook/instructions/setConfigurationOptions.js +22 -0
- package/build/client/orderbook/instructions/setConfigurationOptions.js.map +1 -0
- package/build/client/orderbook/instructions/withdrawFunds.d.ts +27 -0
- package/build/client/orderbook/instructions/withdrawFunds.js +43 -0
- package/build/client/orderbook/instructions/withdrawFunds.js.map +1 -0
- package/build/client/orderbook/instructions/wrapperCollectAdminFee.d.ts +24 -0
- package/build/client/orderbook/instructions/wrapperCollectAdminFee.js +40 -0
- package/build/client/orderbook/instructions/wrapperCollectAdminFee.js.map +1 -0
- package/build/client/orderbook/instructions/wrapperCollectInterest.d.ts +20 -0
- package/build/client/orderbook/instructions/wrapperCollectInterest.js +36 -0
- package/build/client/orderbook/instructions/wrapperCollectInterest.js.map +1 -0
- package/build/client/orderbook/instructions/wrapperMarketOffer.d.ts +32 -0
- package/build/client/orderbook/instructions/wrapperMarketOffer.js +48 -0
- package/build/client/orderbook/instructions/wrapperMarketOffer.js.map +1 -0
- package/build/client/orderbook/instructions/wrapperPostOffer.d.ts +34 -0
- package/build/client/orderbook/instructions/wrapperPostOffer.js +50 -0
- package/build/client/orderbook/instructions/wrapperPostOffer.js.map +1 -0
- package/build/client/orderbook/instructions/wrapperRemoveOffer.d.ts +25 -0
- package/build/client/orderbook/instructions/wrapperRemoveOffer.js +41 -0
- package/build/client/orderbook/instructions/wrapperRemoveOffer.js.map +1 -0
- package/build/client/orderbook/instructions/wrapperWithdrawFunds.d.ts +28 -0
- package/build/client/orderbook/instructions/wrapperWithdrawFunds.js +44 -0
- package/build/client/orderbook/instructions/wrapperWithdrawFunds.js.map +1 -0
- package/build/client/orderbook/types/amount.d.ts +33 -0
- package/build/client/orderbook/types/amount.js +20 -0
- package/build/client/orderbook/types/amount.js.map +1 -0
- package/build/client/orderbook/types/claimLimits.d.ts +22 -0
- package/build/client/orderbook/types/claimLimits.js +11 -0
- package/build/client/orderbook/types/claimLimits.js.map +1 -0
- package/build/client/orderbook/types/collectAdminEmissionEvent.d.ts +27 -0
- package/build/client/orderbook/types/collectAdminEmissionEvent.js +19 -0
- package/build/client/orderbook/types/collectAdminEmissionEvent.js.map +1 -0
- package/build/client/orderbook/types/collectAdminFeeEvent.d.ts +26 -0
- package/build/client/orderbook/types/collectAdminFeeEvent.js +12 -0
- package/build/client/orderbook/types/collectAdminFeeEvent.js.map +1 -0
- package/build/client/orderbook/types/collectEmissionEventV2.d.ts +68 -0
- package/build/client/orderbook/types/collectEmissionEventV2.js +27 -0
- package/build/client/orderbook/types/collectEmissionEventV2.js.map +1 -0
- package/build/client/orderbook/types/collectInterestEventV2.d.ts +64 -0
- package/build/client/orderbook/types/collectInterestEventV2.js +26 -0
- package/build/client/orderbook/types/collectInterestEventV2.js.map +1 -0
- package/build/client/orderbook/types/collectUserInterestEvent.d.ts +23 -0
- package/build/client/orderbook/types/collectUserInterestEvent.js +18 -0
- package/build/client/orderbook/types/collectUserInterestEvent.js.map +1 -0
- package/build/client/orderbook/types/cpiAccounts.d.ts +107 -0
- package/build/client/orderbook/types/cpiAccounts.js +13 -0
- package/build/client/orderbook/types/cpiAccounts.js.map +1 -0
- package/build/client/orderbook/types/cpiInterfaceContext.d.ts +18 -0
- package/build/client/orderbook/types/cpiInterfaceContext.js +10 -0
- package/build/client/orderbook/types/cpiInterfaceContext.js.map +1 -0
- package/build/client/orderbook/types/emissionInfo.d.ts +36 -0
- package/build/client/orderbook/types/emissionInfo.js +22 -0
- package/build/client/orderbook/types/emissionInfo.js.map +1 -0
- package/build/client/orderbook/types/exponentCoreCpiAccounts.d.ts +107 -0
- package/build/client/orderbook/types/exponentCoreCpiAccounts.js +13 -0
- package/build/client/orderbook/types/exponentCoreCpiAccounts.js.map +1 -0
- package/build/client/orderbook/types/filledOffersEvent.d.ts +30 -0
- package/build/client/orderbook/types/filledOffersEvent.js +13 -0
- package/build/client/orderbook/types/filledOffersEvent.js.map +1 -0
- package/build/client/orderbook/types/index.d.ts +30 -0
- package/build/client/orderbook/types/index.js +47 -0
- package/build/client/orderbook/types/index.js.map +1 -0
- package/build/client/orderbook/types/marketOfferEvent.d.ts +93 -0
- package/build/client/orderbook/types/marketOfferEvent.js +33 -0
- package/build/client/orderbook/types/marketOfferEvent.js.map +1 -0
- package/build/client/orderbook/types/mergeEvent.d.ts +84 -0
- package/build/client/orderbook/types/mergeEvent.js +55 -0
- package/build/client/orderbook/types/mergeEvent.js.map +1 -0
- package/build/client/orderbook/types/number.d.ts +2 -0
- package/build/client/orderbook/types/number.js +8 -0
- package/build/client/orderbook/types/number.js.map +1 -0
- package/build/client/orderbook/types/offerOptions.d.ts +24 -0
- package/build/client/orderbook/types/offerOptions.js +22 -0
- package/build/client/orderbook/types/offerOptions.js.map +1 -0
- package/build/client/orderbook/types/offerType.d.ts +5 -0
- package/build/client/orderbook/types/offerType.js +11 -0
- package/build/client/orderbook/types/offerType.js.map +1 -0
- package/build/client/orderbook/types/orderbookInitEvent.d.ts +39 -0
- package/build/client/orderbook/types/orderbookInitEvent.js +25 -0
- package/build/client/orderbook/types/orderbookInitEvent.js.map +1 -0
- package/build/client/orderbook/types/postOfferEvent.d.ts +118 -0
- package/build/client/orderbook/types/postOfferEvent.js +36 -0
- package/build/client/orderbook/types/postOfferEvent.js.map +1 -0
- package/build/client/orderbook/types/removeOfferEvent.d.ts +39 -0
- package/build/client/orderbook/types/removeOfferEvent.js +31 -0
- package/build/client/orderbook/types/removeOfferEvent.js.map +1 -0
- package/build/client/orderbook/types/setConfigurationOptionsEnum.d.ts +72 -0
- package/build/client/orderbook/types/setConfigurationOptionsEnum.js +34 -0
- package/build/client/orderbook/types/setConfigurationOptionsEnum.js.map +1 -0
- package/build/client/orderbook/types/stripEvent.d.ts +84 -0
- package/build/client/orderbook/types/stripEvent.js +58 -0
- package/build/client/orderbook/types/stripEvent.js.map +1 -0
- package/build/client/orderbook/types/withdrawFundsEvent.d.ts +39 -0
- package/build/client/orderbook/types/withdrawFundsEvent.js +31 -0
- package/build/client/orderbook/types/withdrawFundsEvent.js.map +1 -0
- package/build/client/orderbook/types/wrapperCollectAdminFeeEvent.d.ts +18 -0
- package/build/client/orderbook/types/wrapperCollectAdminFeeEvent.js +10 -0
- package/build/client/orderbook/types/wrapperCollectAdminFeeEvent.js.map +1 -0
- package/build/client/orderbook/types/wrapperCollectInterestEvent.d.ts +15 -0
- package/build/client/orderbook/types/wrapperCollectInterestEvent.js +13 -0
- package/build/client/orderbook/types/wrapperCollectInterestEvent.js.map +1 -0
- package/build/client/orderbook/types/wrapperMarketOfferEvent.d.ts +19 -0
- package/build/client/orderbook/types/wrapperMarketOfferEvent.js +14 -0
- package/build/client/orderbook/types/wrapperMarketOfferEvent.js.map +1 -0
- package/build/client/orderbook/types/wrapperPostOfferEvent.d.ts +39 -0
- package/build/client/orderbook/types/wrapperPostOfferEvent.js +34 -0
- package/build/client/orderbook/types/wrapperPostOfferEvent.js.map +1 -0
- package/build/client/orderbook/types/wrapperRemoveOfferEvent.d.ts +15 -0
- package/build/client/orderbook/types/wrapperRemoveOfferEvent.js +13 -0
- package/build/client/orderbook/types/wrapperRemoveOfferEvent.js.map +1 -0
- package/build/client/orderbook/types/wrapperWithdrawFundsEvent.d.ts +27 -0
- package/build/client/orderbook/types/wrapperWithdrawFundsEvent.js +19 -0
- package/build/client/orderbook/types/wrapperWithdrawFundsEvent.js.map +1 -0
- package/build/client/orderbook/types/yieldTokenTracker.d.ts +15 -0
- package/build/client/orderbook/types/yieldTokenTracker.js +10 -0
- package/build/client/orderbook/types/yieldTokenTracker.js.map +1 -0
- package/build/client/vaults/accounts/actionProposal.d.ts +30 -0
- package/build/client/vaults/accounts/actionProposal.js +84 -0
- package/build/client/vaults/accounts/actionProposal.js.map +1 -0
- package/build/client/vaults/accounts/exponentStrategyVault.d.ts +39 -0
- package/build/client/vaults/accounts/exponentStrategyVault.js +113 -0
- package/build/client/vaults/accounts/exponentStrategyVault.js.map +1 -0
- package/build/client/vaults/accounts/programConfig.d.ts +19 -0
- package/build/client/vaults/accounts/programConfig.js +76 -0
- package/build/client/vaults/accounts/programConfig.js.map +1 -0
- package/build/client/vaults/accounts/voteAccount.d.ts +23 -0
- package/build/client/vaults/accounts/voteAccount.js +80 -0
- package/build/client/vaults/accounts/voteAccount.js.map +1 -0
- package/build/client/vaults/accounts/withdrawalAccount.d.ts +23 -0
- package/build/client/vaults/accounts/withdrawalAccount.js +78 -0
- package/build/client/vaults/accounts/withdrawalAccount.js.map +1 -0
- package/build/client/vaults/eventRegistry.d.ts +27 -0
- package/build/client/vaults/eventRegistry.js +27 -0
- package/build/client/vaults/eventRegistry.js.map +1 -0
- package/build/client/vaults/index.d.ts +106 -0
- package/build/client/vaults/index.js +125 -0
- package/build/client/vaults/index.js.map +1 -0
- package/build/client/vaults/instructions/activateProposal.d.ts +12 -0
- package/build/client/vaults/instructions/activateProposal.js +25 -0
- package/build/client/vaults/instructions/activateProposal.js.map +1 -0
- package/build/client/vaults/instructions/addPolicy.d.ts +16 -0
- package/build/client/vaults/instructions/addPolicy.js +33 -0
- package/build/client/vaults/instructions/addPolicy.js.map +1 -0
- package/build/client/vaults/instructions/appendProposalActions.d.ts +13 -0
- package/build/client/vaults/instructions/appendProposalActions.js +26 -0
- package/build/client/vaults/instructions/appendProposalActions.js.map +1 -0
- package/build/client/vaults/instructions/cancelProposal.d.ts +7 -0
- package/build/client/vaults/instructions/cancelProposal.js +17 -0
- package/build/client/vaults/instructions/cancelProposal.js.map +1 -0
- package/build/client/vaults/instructions/cancelWithdrawal.d.ts +10 -0
- package/build/client/vaults/instructions/cancelWithdrawal.js +20 -0
- package/build/client/vaults/instructions/cancelWithdrawal.js.map +1 -0
- package/build/client/vaults/instructions/collectManagementFee.d.ts +9 -0
- package/build/client/vaults/instructions/collectManagementFee.js +19 -0
- package/build/client/vaults/instructions/collectManagementFee.js.map +1 -0
- package/build/client/vaults/instructions/depositLiquidity.d.ts +20 -0
- package/build/client/vaults/instructions/depositLiquidity.js +33 -0
- package/build/client/vaults/instructions/depositLiquidity.js.map +1 -0
- package/build/client/vaults/instructions/executeProposal.d.ts +11 -0
- package/build/client/vaults/instructions/executeProposal.js +21 -0
- package/build/client/vaults/instructions/executeProposal.js.map +1 -0
- package/build/client/vaults/instructions/executeWithdrawal.d.ts +18 -0
- package/build/client/vaults/instructions/executeWithdrawal.js +31 -0
- package/build/client/vaults/instructions/executeWithdrawal.js.map +1 -0
- package/build/client/vaults/instructions/executeWithdrawalFromReserves.d.ts +22 -0
- package/build/client/vaults/instructions/executeWithdrawalFromReserves.js +35 -0
- package/build/client/vaults/instructions/executeWithdrawalFromReserves.js.map +1 -0
- package/build/client/vaults/instructions/fillWithdrawal.d.ts +17 -0
- package/build/client/vaults/instructions/fillWithdrawal.js +34 -0
- package/build/client/vaults/instructions/fillWithdrawal.js.map +1 -0
- package/build/client/vaults/instructions/finalizeProposal.d.ts +7 -0
- package/build/client/vaults/instructions/finalizeProposal.js +17 -0
- package/build/client/vaults/instructions/finalizeProposal.js.map +1 -0
- package/build/client/vaults/instructions/initProposal.d.ts +12 -0
- package/build/client/vaults/instructions/initProposal.js +25 -0
- package/build/client/vaults/instructions/initProposal.js.map +1 -0
- package/build/client/vaults/instructions/initializePrices.d.ts +7 -0
- package/build/client/vaults/instructions/initializePrices.js +17 -0
- package/build/client/vaults/instructions/initializePrices.js.map +1 -0
- package/build/client/vaults/instructions/initializeVault.d.ts +44 -0
- package/build/client/vaults/instructions/initializeVault.js +80 -0
- package/build/client/vaults/instructions/initializeVault.js.map +1 -0
- package/build/client/vaults/instructions/makeSentienelManager.d.ts +7 -0
- package/build/client/vaults/instructions/makeSentienelManager.js +17 -0
- package/build/client/vaults/instructions/makeSentienelManager.js.map +1 -0
- package/build/client/vaults/instructions/managePrices.d.ts +11 -0
- package/build/client/vaults/instructions/managePrices.js +24 -0
- package/build/client/vaults/instructions/managePrices.js.map +1 -0
- package/build/client/vaults/instructions/manageVaultSettings.d.ts +12 -0
- package/build/client/vaults/instructions/manageVaultSettings.js +25 -0
- package/build/client/vaults/instructions/manageVaultSettings.js.map +1 -0
- package/build/client/vaults/instructions/managerUpdatePosition.d.ts +12 -0
- package/build/client/vaults/instructions/managerUpdatePosition.js +25 -0
- package/build/client/vaults/instructions/managerUpdatePosition.js.map +1 -0
- package/build/client/vaults/instructions/proposeAction.d.ts +16 -0
- package/build/client/vaults/instructions/proposeAction.js +29 -0
- package/build/client/vaults/instructions/proposeAction.js.map +1 -0
- package/build/client/vaults/instructions/queueWithdrawal.d.ts +14 -0
- package/build/client/vaults/instructions/queueWithdrawal.js +27 -0
- package/build/client/vaults/instructions/queueWithdrawal.js.map +1 -0
- package/build/client/vaults/instructions/removePolicy.d.ts +13 -0
- package/build/client/vaults/instructions/removePolicy.js +27 -0
- package/build/client/vaults/instructions/removePolicy.js.map +1 -0
- package/build/client/vaults/instructions/sentinelSetVaultFlags.d.ts +10 -0
- package/build/client/vaults/instructions/sentinelSetVaultFlags.js +23 -0
- package/build/client/vaults/instructions/sentinelSetVaultFlags.js.map +1 -0
- package/build/client/vaults/instructions/stakeVote.d.ts +18 -0
- package/build/client/vaults/instructions/stakeVote.js +31 -0
- package/build/client/vaults/instructions/stakeVote.js.map +1 -0
- package/build/client/vaults/instructions/unstakeVote.d.ts +14 -0
- package/build/client/vaults/instructions/unstakeVote.js +24 -0
- package/build/client/vaults/instructions/unstakeVote.js.map +1 -0
- package/build/client/vaults/instructions/updatePolicy.d.ts +17 -0
- package/build/client/vaults/instructions/updatePolicy.js +34 -0
- package/build/client/vaults/instructions/updatePolicy.js.map +1 -0
- package/build/client/vaults/instructions/updatePolicyManager.d.ts +13 -0
- package/build/client/vaults/instructions/updatePolicyManager.js +27 -0
- package/build/client/vaults/instructions/updatePolicyManager.js.map +1 -0
- package/build/client/vaults/instructions/updatePrice.d.ts +9 -0
- package/build/client/vaults/instructions/updatePrice.js +22 -0
- package/build/client/vaults/instructions/updatePrice.js.map +1 -0
- package/build/client/vaults/instructions/validateInteractionHook.d.ts +16 -0
- package/build/client/vaults/instructions/validateInteractionHook.js +33 -0
- package/build/client/vaults/instructions/validateInteractionHook.js.map +1 -0
- package/build/client/vaults/instructions/wrapperAddPolicy.d.ts +16 -0
- package/build/client/vaults/instructions/wrapperAddPolicy.js +33 -0
- package/build/client/vaults/instructions/wrapperAddPolicy.js.map +1 -0
- package/build/client/vaults/instructions/wrapperExecuteWithdrawal.d.ts +27 -0
- package/build/client/vaults/instructions/wrapperExecuteWithdrawal.js +40 -0
- package/build/client/vaults/instructions/wrapperExecuteWithdrawal.js.map +1 -0
- package/build/client/vaults/instructions/wrapperManageVaultSettings.d.ts +12 -0
- package/build/client/vaults/instructions/wrapperManageVaultSettings.js +25 -0
- package/build/client/vaults/instructions/wrapperManageVaultSettings.js.map +1 -0
- package/build/client/vaults/instructions/wrapperManagerUpdatePosition.d.ts +12 -0
- package/build/client/vaults/instructions/wrapperManagerUpdatePosition.js +25 -0
- package/build/client/vaults/instructions/wrapperManagerUpdatePosition.js.map +1 -0
- package/build/client/vaults/instructions/wrapperRemovePolicy.d.ts +13 -0
- package/build/client/vaults/instructions/wrapperRemovePolicy.js +27 -0
- package/build/client/vaults/instructions/wrapperRemovePolicy.js.map +1 -0
- package/build/client/vaults/instructions/wrapperUpdatePolicy.d.ts +17 -0
- package/build/client/vaults/instructions/wrapperUpdatePolicy.js +34 -0
- package/build/client/vaults/instructions/wrapperUpdatePolicy.js.map +1 -0
- package/build/client/vaults/types/accountConstraint.d.ts +20 -0
- package/build/client/vaults/types/accountConstraint.js +16 -0
- package/build/client/vaults/types/accountConstraint.js.map +1 -0
- package/build/client/vaults/types/accountConstraintType.d.ts +18 -0
- package/build/client/vaults/types/accountConstraintType.js +38 -0
- package/build/client/vaults/types/accountConstraintType.js.map +1 -0
- package/build/client/vaults/types/allowedSettingsChange.d.ts +79 -0
- package/build/client/vaults/types/allowedSettingsChange.js +45 -0
- package/build/client/vaults/types/allowedSettingsChange.js.map +1 -0
- package/build/client/vaults/types/cancelProposalEvent.d.ts +27 -0
- package/build/client/vaults/types/cancelProposalEvent.js +23 -0
- package/build/client/vaults/types/cancelProposalEvent.js.map +1 -0
- package/build/client/vaults/types/clmmPositionEntry.d.ts +88 -0
- package/build/client/vaults/types/clmmPositionEntry.js +20 -0
- package/build/client/vaults/types/clmmPositionEntry.js.map +1 -0
- package/build/client/vaults/types/dataConstraint.d.ts +116 -0
- package/build/client/vaults/types/dataConstraint.js +13 -0
- package/build/client/vaults/types/dataConstraint.js.map +1 -0
- package/build/client/vaults/types/dataOperator.d.ts +9 -0
- package/build/client/vaults/types/dataOperator.js +16 -0
- package/build/client/vaults/types/dataOperator.js.map +1 -0
- package/build/client/vaults/types/dataValue.d.ts +104 -0
- package/build/client/vaults/types/dataValue.js +33 -0
- package/build/client/vaults/types/dataValue.js.map +1 -0
- package/build/client/vaults/types/depositLiquidityEvent.d.ts +55 -0
- package/build/client/vaults/types/depositLiquidityEvent.js +42 -0
- package/build/client/vaults/types/depositLiquidityEvent.js.map +1 -0
- package/build/client/vaults/types/executeProposalEvent.d.ts +27 -0
- package/build/client/vaults/types/executeProposalEvent.js +23 -0
- package/build/client/vaults/types/executeProposalEvent.js.map +1 -0
- package/build/client/vaults/types/executeWithdrawalEvent.d.ts +14 -0
- package/build/client/vaults/types/executeWithdrawalEvent.js +10 -0
- package/build/client/vaults/types/executeWithdrawalEvent.js.map +1 -0
- package/build/client/vaults/types/fillParam.d.ts +14 -0
- package/build/client/vaults/types/fillParam.js +10 -0
- package/build/client/vaults/types/fillParam.js.map +1 -0
- package/build/client/vaults/types/finalizeProposalEvent.d.ts +48 -0
- package/build/client/vaults/types/finalizeProposalEvent.js +26 -0
- package/build/client/vaults/types/finalizeProposalEvent.js.map +1 -0
- package/build/client/vaults/types/hook.d.ts +44 -0
- package/build/client/vaults/types/hook.js +18 -0
- package/build/client/vaults/types/hook.js.map +1 -0
- package/build/client/vaults/types/hookCompiledInstruction.d.ts +18 -0
- package/build/client/vaults/types/hookCompiledInstruction.js +11 -0
- package/build/client/vaults/types/hookCompiledInstruction.js.map +1 -0
- package/build/client/vaults/types/index.d.ts +65 -0
- package/build/client/vaults/types/index.js +83 -0
- package/build/client/vaults/types/index.js.map +1 -0
- package/build/client/vaults/types/instructionConstraint.d.ts +173 -0
- package/build/client/vaults/types/instructionConstraint.js +17 -0
- package/build/client/vaults/types/instructionConstraint.js.map +1 -0
- package/build/client/vaults/types/internalFundTransferPolicyCreationPayload.d.ts +19 -0
- package/build/client/vaults/types/internalFundTransferPolicyCreationPayload.js +18 -0
- package/build/client/vaults/types/internalFundTransferPolicyCreationPayload.js.map +1 -0
- package/build/client/vaults/types/kaminoObligationEntry.d.ts +117 -0
- package/build/client/vaults/types/kaminoObligationEntry.js +23 -0
- package/build/client/vaults/types/kaminoObligationEntry.js.map +1 -0
- package/build/client/vaults/types/limitedQuantityConstraints.d.ts +10 -0
- package/build/client/vaults/types/limitedQuantityConstraints.js +9 -0
- package/build/client/vaults/types/limitedQuantityConstraints.js.map +1 -0
- package/build/client/vaults/types/limitedSpendingLimit.d.ts +105 -0
- package/build/client/vaults/types/limitedSpendingLimit.js +17 -0
- package/build/client/vaults/types/limitedSpendingLimit.js.map +1 -0
- package/build/client/vaults/types/limitedTimeConstraints.d.ts +67 -0
- package/build/client/vaults/types/limitedTimeConstraints.js +12 -0
- package/build/client/vaults/types/limitedTimeConstraints.js.map +1 -0
- package/build/client/vaults/types/loopscaleLoanEntry.d.ts +11 -0
- package/build/client/vaults/types/loopscaleLoanEntry.js +13 -0
- package/build/client/vaults/types/loopscaleLoanEntry.js.map +1 -0
- package/build/client/vaults/types/loopscaleStrategyEntry.d.ts +11 -0
- package/build/client/vaults/types/loopscaleStrategyEntry.js +13 -0
- package/build/client/vaults/types/loopscaleStrategyEntry.js.map +1 -0
- package/build/client/vaults/types/number.d.ts +2 -0
- package/build/client/vaults/types/number.js +9 -0
- package/build/client/vaults/types/number.js.map +1 -0
- package/build/client/vaults/types/obligationType.d.ts +13 -0
- package/build/client/vaults/types/obligationType.js +24 -0
- package/build/client/vaults/types/obligationType.js.map +1 -0
- package/build/client/vaults/types/orderbookEntry.d.ts +64 -0
- package/build/client/vaults/types/orderbookEntry.js +25 -0
- package/build/client/vaults/types/orderbookEntry.js.map +1 -0
- package/build/client/vaults/types/periodV2.d.ts +60 -0
- package/build/client/vaults/types/periodV2.js +24 -0
- package/build/client/vaults/types/periodV2.js.map +1 -0
- package/build/client/vaults/types/permissions.d.ts +10 -0
- package/build/client/vaults/types/permissions.js +7 -0
- package/build/client/vaults/types/permissions.js.map +1 -0
- package/build/client/vaults/types/policyAction.d.ts +61 -0
- package/build/client/vaults/types/policyAction.js +29 -0
- package/build/client/vaults/types/policyAction.js.map +1 -0
- package/build/client/vaults/types/policyConfig.d.ts +10 -0
- package/build/client/vaults/types/policyConfig.js +15 -0
- package/build/client/vaults/types/policyConfig.js.map +1 -0
- package/build/client/vaults/types/policyCreationPayload.d.ts +287 -0
- package/build/client/vaults/types/policyCreationPayload.js +50 -0
- package/build/client/vaults/types/policyCreationPayload.js.map +1 -0
- package/build/client/vaults/types/policyExpirationArgs.d.ts +33 -0
- package/build/client/vaults/types/policyExpirationArgs.js +21 -0
- package/build/client/vaults/types/policyExpirationArgs.js.map +1 -0
- package/build/client/vaults/types/positionUpdate.d.ts +45 -0
- package/build/client/vaults/types/positionUpdate.js +89 -0
- package/build/client/vaults/types/positionUpdate.js.map +1 -0
- package/build/client/vaults/types/priceId.d.ts +40 -0
- package/build/client/vaults/types/priceId.js +21 -0
- package/build/client/vaults/types/priceId.js.map +1 -0
- package/build/client/vaults/types/priceType.d.ts +19 -0
- package/build/client/vaults/types/priceType.js +26 -0
- package/build/client/vaults/types/priceType.js.map +1 -0
- package/build/client/vaults/types/programInteractionPolicyCreationPayload.d.ts +11 -0
- package/build/client/vaults/types/programInteractionPolicyCreationPayload.js +16 -0
- package/build/client/vaults/types/programInteractionPolicyCreationPayload.js.map +1 -0
- package/build/client/vaults/types/proposalAction.d.ts +226 -0
- package/build/client/vaults/types/proposalAction.js +40 -0
- package/build/client/vaults/types/proposalAction.js.map +1 -0
- package/build/client/vaults/types/proposalActionKind.d.ts +7 -0
- package/build/client/vaults/types/proposalActionKind.js +14 -0
- package/build/client/vaults/types/proposalActionKind.js.map +1 -0
- package/build/client/vaults/types/proposalStatus.d.ts +9 -0
- package/build/client/vaults/types/proposalStatus.js +16 -0
- package/build/client/vaults/types/proposalStatus.js.map +1 -0
- package/build/client/vaults/types/proposalVoteConfig.d.ts +46 -0
- package/build/client/vaults/types/proposalVoteConfig.js +18 -0
- package/build/client/vaults/types/proposalVoteConfig.js.map +1 -0
- package/build/client/vaults/types/proposeActionEvent.d.ts +48 -0
- package/build/client/vaults/types/proposeActionEvent.js +29 -0
- package/build/client/vaults/types/proposeActionEvent.js.map +1 -0
- package/build/client/vaults/types/quantityConstraints.d.ts +18 -0
- package/build/client/vaults/types/quantityConstraints.js +11 -0
- package/build/client/vaults/types/quantityConstraints.js.map +1 -0
- package/build/client/vaults/types/reservePriceMapping.d.ts +48 -0
- package/build/client/vaults/types/reservePriceMapping.js +15 -0
- package/build/client/vaults/types/reservePriceMapping.js.map +1 -0
- package/build/client/vaults/types/settingsChangePolicyCreationPayload.d.ts +81 -0
- package/build/client/vaults/types/settingsChangePolicyCreationPayload.js +10 -0
- package/build/client/vaults/types/settingsChangePolicyCreationPayload.js.map +1 -0
- package/build/client/vaults/types/spendingLimitPolicyCreationPayload.d.ts +142 -0
- package/build/client/vaults/types/spendingLimitPolicyCreationPayload.js +24 -0
- package/build/client/vaults/types/spendingLimitPolicyCreationPayload.js.map +1 -0
- package/build/client/vaults/types/stakeVoteEvent.d.ts +40 -0
- package/build/client/vaults/types/stakeVoteEvent.js +27 -0
- package/build/client/vaults/types/stakeVoteEvent.js.map +1 -0
- package/build/client/vaults/types/strategyPosition.d.ts +43 -0
- package/build/client/vaults/types/strategyPosition.js +54 -0
- package/build/client/vaults/types/strategyPosition.js.map +1 -0
- package/build/client/vaults/types/timeConstraints.d.ts +71 -0
- package/build/client/vaults/types/timeConstraints.js +13 -0
- package/build/client/vaults/types/timeConstraints.js.map +1 -0
- package/build/client/vaults/types/tokenAccountBalance.d.ts +52 -0
- package/build/client/vaults/types/tokenAccountBalance.js +19 -0
- package/build/client/vaults/types/tokenAccountBalance.js.map +1 -0
- package/build/client/vaults/types/tokenAccountEntry.d.ts +72 -0
- package/build/client/vaults/types/tokenAccountEntry.js +15 -0
- package/build/client/vaults/types/tokenAccountEntry.js.map +1 -0
- package/build/client/vaults/types/tokenEntry.d.ts +60 -0
- package/build/client/vaults/types/tokenEntry.js +24 -0
- package/build/client/vaults/types/tokenEntry.js.map +1 -0
- package/build/client/vaults/types/unstakeVoteEvent.d.ts +36 -0
- package/build/client/vaults/types/unstakeVoteEvent.js +26 -0
- package/build/client/vaults/types/unstakeVoteEvent.js.map +1 -0
- package/build/client/vaults/types/updatePriceAction.d.ts +174 -0
- package/build/client/vaults/types/updatePriceAction.js +104 -0
- package/build/client/vaults/types/updatePriceAction.js.map +1 -0
- package/build/client/vaults/types/updatePriceInput.d.ts +14 -0
- package/build/client/vaults/types/updatePriceInput.js +10 -0
- package/build/client/vaults/types/updatePriceInput.js.map +1 -0
- package/build/client/vaults/types/usageState.d.ts +14 -0
- package/build/client/vaults/types/usageState.js +10 -0
- package/build/client/vaults/types/usageState.js.map +1 -0
- package/build/client/vaults/types/vaultConfig.d.ts +87 -0
- package/build/client/vaults/types/vaultConfig.js +19 -0
- package/build/client/vaults/types/vaultConfig.js.map +1 -0
- package/build/client/vaults/types/vaultFinancials.d.ts +58 -0
- package/build/client/vaults/types/vaultFinancials.js +21 -0
- package/build/client/vaults/types/vaultFinancials.js.map +1 -0
- package/build/client/vaults/types/vaultFlagAction.d.ts +56 -0
- package/build/client/vaults/types/vaultFlagAction.js +22 -0
- package/build/client/vaults/types/vaultFlagAction.js.map +1 -0
- package/build/client/vaults/types/vaultFlagsUpdatedEvent.d.ts +23 -0
- package/build/client/vaults/types/vaultFlagsUpdatedEvent.js +19 -0
- package/build/client/vaults/types/vaultFlagsUpdatedEvent.js.map +1 -0
- package/build/client/vaults/types/vaultRoleKind.d.ts +7 -0
- package/build/client/vaults/types/vaultRoleKind.js +14 -0
- package/build/client/vaults/types/vaultRoleKind.js.map +1 -0
- package/build/client/vaults/types/vaultRoles.d.ts +23 -0
- package/build/client/vaults/types/vaultRoles.js +25 -0
- package/build/client/vaults/types/vaultRoles.js.map +1 -0
- package/build/client/vaults/types/vaultSettingsAction.d.ts +109 -0
- package/build/client/vaults/types/vaultSettingsAction.js +161 -0
- package/build/client/vaults/types/vaultSettingsAction.js.map +1 -0
- package/build/client/vaults/types/voteChoice.d.ts +5 -0
- package/build/client/vaults/types/voteChoice.js +12 -0
- package/build/client/vaults/types/voteChoice.js.map +1 -0
- package/build/client/vaults/types/withdrawalPeriodSettings.d.ts +48 -0
- package/build/client/vaults/types/withdrawalPeriodSettings.js +28 -0
- package/build/client/vaults/types/withdrawalPeriodSettings.js.map +1 -0
- package/build/client/vaults/types/withdrawalTokenFill.d.ts +19 -0
- package/build/client/vaults/types/withdrawalTokenFill.js +18 -0
- package/build/client/vaults/types/withdrawalTokenFill.js.map +1 -0
- package/build/client/vaults/types/yieldPositionEntry.d.ts +52 -0
- package/build/client/vaults/types/yieldPositionEntry.js +19 -0
- package/build/client/vaults/types/yieldPositionEntry.js.map +1 -0
- package/build/clmm/codamaEvents.d.ts +23 -0
- package/build/clmm/codamaEvents.js +24 -0
- package/build/clmm/codamaEvents.js.map +1 -0
- package/build/clmm/index.d.ts +1 -1
- package/build/clmm/index.js +1 -1
- package/build/clmm/index.js.map +1 -1
- package/build/codamaEvents.d.ts +18 -0
- package/build/codamaEvents.js +21 -0
- package/build/codamaEvents.js.map +1 -0
- package/build/environment.d.ts +8 -7
- package/build/environment.js +8 -7
- package/build/environment.js.map +1 -1
- package/build/exponentVaults/aumCalculator.d.ts +182 -0
- package/build/exponentVaults/aumCalculator.js +778 -0
- package/build/exponentVaults/aumCalculator.js.map +1 -0
- package/build/exponentVaults/events.d.ts +8 -0
- package/build/exponentVaults/events.js +12 -0
- package/build/exponentVaults/events.js.map +1 -0
- package/build/exponentVaults/index.d.ts +30 -0
- package/build/exponentVaults/index.js +176 -0
- package/build/exponentVaults/index.js.map +1 -0
- package/build/exponentVaults/kamino-markets.d.ts +887 -0
- package/build/exponentVaults/kamino-markets.js +345 -0
- package/build/exponentVaults/kamino-markets.js.map +1 -0
- package/build/exponentVaults/loopscale-client.d.ts +541 -0
- package/build/exponentVaults/loopscale-client.js +732 -0
- package/build/exponentVaults/loopscale-client.js.map +1 -0
- package/build/exponentVaults/policyBuilders.d.ts +694 -0
- package/build/exponentVaults/policyBuilders.js +1131 -0
- package/build/exponentVaults/policyBuilders.js.map +1 -0
- package/build/exponentVaults/policyMatcher.d.ts +82 -0
- package/build/exponentVaults/policyMatcher.js +730 -0
- package/build/exponentVaults/policyMatcher.js.map +1 -0
- package/build/exponentVaults/scope-refresh.d.ts +10 -0
- package/build/exponentVaults/scope-refresh.js +140 -0
- package/build/exponentVaults/scope-refresh.js.map +1 -0
- package/build/exponentVaults/squadsVaultTxnResolver/constants.d.ts +2 -0
- package/build/exponentVaults/squadsVaultTxnResolver/constants.js +61 -0
- package/build/exponentVaults/squadsVaultTxnResolver/constants.js.map +1 -0
- package/build/exponentVaults/squadsVaultTxnResolver/helpers.d.ts +26 -0
- package/build/exponentVaults/squadsVaultTxnResolver/helpers.js +268 -0
- package/build/exponentVaults/squadsVaultTxnResolver/helpers.js.map +1 -0
- package/build/exponentVaults/squadsVaultTxnResolver/index.d.ts +5 -0
- package/build/exponentVaults/squadsVaultTxnResolver/index.js +15 -0
- package/build/exponentVaults/squadsVaultTxnResolver/index.js.map +1 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.d.ts +6 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.js +361 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.js.map +1 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.d.ts +2 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.js +28 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.js.map +1 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/index.d.ts +2 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/index.js +25 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/index.js.map +1 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.d.ts +2 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.js +67 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.js.map +1 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.d.ts +2 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.js +73 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.js.map +1 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/titan.d.ts +2 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/titan.js +35 -0
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/titan.js.map +1 -0
- package/build/exponentVaults/squadsVaultTxnResolver/squadsVaultTxnResolver.d.ts +21 -0
- package/build/exponentVaults/squadsVaultTxnResolver/squadsVaultTxnResolver.js +64 -0
- package/build/exponentVaults/squadsVaultTxnResolver/squadsVaultTxnResolver.js.map +1 -0
- package/build/exponentVaults/squadsVaultTxnResolver/types.d.ts +111 -0
- package/build/exponentVaults/squadsVaultTxnResolver/types.js +92 -0
- package/build/exponentVaults/squadsVaultTxnResolver/types.js.map +1 -0
- package/build/exponentVaults/squadsVaultTxnResolver/utils.d.ts +3 -0
- package/build/exponentVaults/squadsVaultTxnResolver/utils.js +8 -0
- package/build/exponentVaults/squadsVaultTxnResolver/utils.js.map +1 -0
- package/build/exponentVaults/syncTransaction.d.ts +84 -0
- package/build/exponentVaults/syncTransaction.js +341 -0
- package/build/exponentVaults/syncTransaction.js.map +1 -0
- package/build/exponentVaults/titan-quote.d.ts +22 -0
- package/build/exponentVaults/titan-quote.js +167 -0
- package/build/exponentVaults/titan-quote.js.map +1 -0
- package/build/exponentVaults/vault-interaction.d.ts +3475 -0
- package/build/exponentVaults/vault-interaction.js +2251 -0
- package/build/exponentVaults/vault-interaction.js.map +1 -0
- package/build/exponentVaults/vault.d.ts +613 -0
- package/build/exponentVaults/vault.js +1437 -0
- package/build/exponentVaults/vault.js.map +1 -0
- package/build/exponentVaults/vaultTransactionBuilder.d.ts +319 -0
- package/build/exponentVaults/vaultTransactionBuilder.js +470 -0
- package/build/exponentVaults/vaultTransactionBuilder.js.map +1 -0
- package/build/flavors.d.ts +3 -3
- package/build/flavors.js +115 -111
- package/build/flavors.js.map +1 -1
- package/build/index.d.ts +15 -8
- package/build/index.js +23 -7
- package/build/index.js.map +1 -1
- package/build/lpPosition.d.ts +13 -15
- package/build/lpPosition.js +2 -6
- package/build/lpPosition.js.map +1 -1
- package/build/market.d.ts +203 -230
- package/build/market.js +277 -371
- package/build/market.js.map +1 -1
- package/build/marketThree.d.ts +401 -267
- package/build/marketThree.js +613 -279
- package/build/marketThree.js.map +1 -1
- package/build/marketThree.test.js +12 -12
- package/build/marketThree.test.js.map +1 -1
- package/build/orderbook/codamaEvents.d.ts +19 -0
- package/build/orderbook/codamaEvents.js +22 -0
- package/build/orderbook/codamaEvents.js.map +1 -0
- package/build/orderbook/index.d.ts +6 -3
- package/build/orderbook/index.js +8 -4
- package/build/orderbook/index.js.map +1 -1
- package/build/orderbook/math.d.ts +4 -2
- package/build/orderbook/math.js +23 -11
- package/build/orderbook/math.js.map +1 -1
- package/build/orderbook/orderbook.d.ts +182 -104
- package/build/orderbook/orderbook.js +375 -208
- package/build/orderbook/orderbook.js.map +1 -1
- package/build/orderbook/types.d.ts +6 -20
- package/build/orderbook/types.js +25 -5
- package/build/orderbook/types.js.map +1 -1
- package/build/orderbook/utils.d.ts +1 -3
- package/build/orderbook/utils.js +4 -12
- package/build/orderbook/utils.js.map +1 -1
- package/build/router.d.ts +72 -12
- package/build/router.js +333 -3
- package/build/router.js.map +1 -1
- package/build/syPosition.d.ts +2 -2
- package/build/syPosition.js +7 -7
- package/build/syPosition.js.map +1 -1
- package/build/tokenUtil.d.ts +3 -3
- package/build/tokenUtil.js.map +1 -1
- package/build/utils/index.d.ts +4 -5
- package/build/utils/index.js +3 -24
- package/build/utils/index.js.map +1 -1
- package/build/utils/ix.d.ts +2 -2
- package/build/vault.d.ts +108 -221
- package/build/vault.js +141 -98
- package/build/vault.js.map +1 -1
- package/build/ytPosition.d.ts +28 -36
- package/build/ytPosition.js +71 -62
- package/build/ytPosition.js.map +1 -1
- package/package.json +58 -28
- package/src/CodamaEventDecoder.ts +151 -0
- package/src/addressLookupTableUtil.ts +48 -14
- package/src/client/clmm/accounts/lpPosition.ts +143 -0
- package/src/client/clmm/accounts/marketThree.ts +274 -0
- package/src/client/clmm/accounts/vault.ts +234 -0
- package/src/client/clmm/eventRegistry.ts +92 -0
- package/src/client/clmm/index.ts +82 -0
- package/src/client/clmm/instructions/addFarm.ts +57 -0
- package/src/client/clmm/instructions/addLiquidity.ts +78 -0
- package/src/client/clmm/instructions/addMarketEmission.ts +50 -0
- package/src/client/clmm/instructions/buyPt.ts +73 -0
- package/src/client/clmm/instructions/buyYt.ts +80 -0
- package/src/client/clmm/instructions/claimFarmEmission.ts +56 -0
- package/src/client/clmm/instructions/closeMarket.ts +47 -0
- package/src/client/clmm/instructions/depositLiquidity.ts +71 -0
- package/src/client/clmm/instructions/initializeMarket.ts +127 -0
- package/src/client/clmm/instructions/marketAccrueEmission.ts +39 -0
- package/src/client/clmm/instructions/marketCollectEmission.ts +57 -0
- package/src/client/clmm/instructions/modifyFarm.ts +55 -0
- package/src/client/clmm/instructions/modifyMarketSetting.ts +45 -0
- package/src/client/clmm/instructions/sellPt.ts +73 -0
- package/src/client/clmm/instructions/sellYt.ts +80 -0
- package/src/client/clmm/instructions/tradePt.ts +73 -0
- package/src/client/clmm/instructions/tradePtExactOut.ts +75 -0
- package/src/client/clmm/instructions/withdrawLiquidity.ts +67 -0
- package/src/client/clmm/instructions/wrapperBuyYt.ts +85 -0
- package/src/client/clmm/instructions/wrapperProvideLiquidity.ts +100 -0
- package/src/client/clmm/instructions/wrapperProvideLiquidityBase.ts +98 -0
- package/src/client/clmm/instructions/wrapperProvideLiquidityClassic.ts +86 -0
- package/src/client/clmm/instructions/wrapperSellYt.ts +83 -0
- package/src/client/clmm/instructions/wrapperWithdrawLiquidity.ts +75 -0
- package/src/client/clmm/instructions/wrapperWithdrawLiquidityClassic.ts +69 -0
- package/src/client/clmm/types/addFarmEvent.ts +51 -0
- package/src/client/clmm/types/amount.ts +51 -0
- package/src/client/clmm/types/buyPtEvent.ts +36 -0
- package/src/client/clmm/types/buyYtEvent.ts +74 -0
- package/src/client/clmm/types/claimFarmEmissionsEvent.ts +94 -0
- package/src/client/clmm/types/claimLimits.ts +15 -0
- package/src/client/clmm/types/closeMarketEvent.ts +36 -0
- package/src/client/clmm/types/configurationOptions.ts +29 -0
- package/src/client/clmm/types/cpiAccounts.ts +21 -0
- package/src/client/clmm/types/cpiCoreAccounts.ts +15 -0
- package/src/client/clmm/types/cpiInterfaceContext.ts +13 -0
- package/src/client/clmm/types/crossingSplit.ts +40 -0
- package/src/client/clmm/types/depositLiquidityEvent.ts +93 -0
- package/src/client/clmm/types/depositLiquidityReturnData.ts +81 -0
- package/src/client/clmm/types/emissionInfo.ts +44 -0
- package/src/client/clmm/types/farmEmission.ts +31 -0
- package/src/client/clmm/types/index.ts +48 -0
- package/src/client/clmm/types/liquidityNetBalanceLimits.ts +22 -0
- package/src/client/clmm/types/lpFarm.ts +12 -0
- package/src/client/clmm/types/marketAccrueEmissionEvent.ts +69 -0
- package/src/client/clmm/types/marketAdminAction.ts +239 -0
- package/src/client/clmm/types/marketCollectEmissionEvent.ts +83 -0
- package/src/client/clmm/types/marketEmission.ts +28 -0
- package/src/client/clmm/types/marketEmissions.ts +10 -0
- package/src/client/clmm/types/marketFinancials.ts +17 -0
- package/src/client/clmm/types/marketThreeInitEvent.ts +92 -0
- package/src/client/clmm/types/mergeEvent.ts +118 -0
- package/src/client/clmm/types/modifiedTick.ts +13 -0
- package/src/client/clmm/types/modifiedTicks.ts +18 -0
- package/src/client/clmm/types/modifyFarmEvent.ts +56 -0
- package/src/client/clmm/types/number.ts +7 -0
- package/src/client/clmm/types/personalYieldTracker.ts +12 -0
- package/src/client/clmm/types/personalYieldTrackers.ts +13 -0
- package/src/client/clmm/types/principalShare.ts +22 -0
- package/src/client/clmm/types/principalShareTrackers.ts +10 -0
- package/src/client/clmm/types/sellPtEvent.ts +36 -0
- package/src/client/clmm/types/sellYtEvent.ts +69 -0
- package/src/client/clmm/types/stripEvent.ts +124 -0
- package/src/client/clmm/types/swapDirection.ts +8 -0
- package/src/client/clmm/types/tradePtEvent.ts +76 -0
- package/src/client/clmm/types/withdrawLiquidityEvent.ts +99 -0
- package/src/client/clmm/types/withdrawLiquidityReturnData.ts +27 -0
- package/src/client/clmm/types/wrapperBuyYtEvent.ts +36 -0
- package/src/client/clmm/types/wrapperProvideLiquidityBaseEvent.ts +60 -0
- package/src/client/clmm/types/wrapperProvideLiquidityClassicEvent.ts +58 -0
- package/src/client/clmm/types/wrapperProvideLiquidityEvent.ts +60 -0
- package/src/client/clmm/types/wrapperSellYtEvent.ts +36 -0
- package/src/client/clmm/types/wrapperWithdrawLiquidityClassicEvent.ts +62 -0
- package/src/client/clmm/types/wrapperWithdrawLiquidityEvent.ts +62 -0
- package/src/client/core/accounts/admin.ts +112 -0
- package/src/client/core/accounts/lpPosition.ts +122 -0
- package/src/client/core/accounts/marketTwo.ts +234 -0
- package/src/client/core/accounts/vault.ts +234 -0
- package/src/client/core/accounts/yieldTokenPosition.ts +126 -0
- package/src/client/core/eventRegistry.ts +134 -0
- package/src/client/core/index.ts +113 -0
- package/src/client/core/instructions/addEmission.ts +62 -0
- package/src/client/core/instructions/addFarm.ts +53 -0
- package/src/client/core/instructions/addLpTokensMetadata.ts +62 -0
- package/src/client/core/instructions/addMarketEmission.ts +52 -0
- package/src/client/core/instructions/buyYt.ts +79 -0
- package/src/client/core/instructions/claimFarmEmissions.ts +54 -0
- package/src/client/core/instructions/collectEmission.ts +66 -0
- package/src/client/core/instructions/collectInterest.ts +64 -0
- package/src/client/core/instructions/collectTreasuryEmission.ts +64 -0
- package/src/client/core/instructions/collectTreasuryInterest.ts +62 -0
- package/src/client/core/instructions/depositYt.ts +59 -0
- package/src/client/core/instructions/initLpPosition.ts +35 -0
- package/src/client/core/instructions/initMarketTwo.ts +103 -0
- package/src/client/core/instructions/initializeVault.ts +107 -0
- package/src/client/core/instructions/initializeYieldPosition.ts +33 -0
- package/src/client/core/instructions/marketCollectEmission.ts +55 -0
- package/src/client/core/instructions/marketDepositLp.ts +59 -0
- package/src/client/core/instructions/marketTwoDepositLiquidity.ts +65 -0
- package/src/client/core/instructions/marketTwoWithdrawLiquidity.ts +65 -0
- package/src/client/core/instructions/marketWithdrawLp.ts +59 -0
- package/src/client/core/instructions/merge.ts +61 -0
- package/src/client/core/instructions/modifyFarm.ts +51 -0
- package/src/client/core/instructions/modifyMarketSetting.ts +47 -0
- package/src/client/core/instructions/modifyVaultSetting.ts +44 -0
- package/src/client/core/instructions/reallocMarket.ts +45 -0
- package/src/client/core/instructions/sellYt.ts +79 -0
- package/src/client/core/instructions/stageYtYield.ts +39 -0
- package/src/client/core/instructions/strip.ts +61 -0
- package/src/client/core/instructions/tradePt.ts +59 -0
- package/src/client/core/instructions/withdrawYt.ts +61 -0
- package/src/client/core/instructions/wrapperBuyPt.ts +63 -0
- package/src/client/core/instructions/wrapperBuyYt.ts +93 -0
- package/src/client/core/instructions/wrapperCollectInterest.ts +63 -0
- package/src/client/core/instructions/wrapperMerge.ts +77 -0
- package/src/client/core/instructions/wrapperProvideLiquidity.ts +103 -0
- package/src/client/core/instructions/wrapperProvideLiquidityBase.ts +81 -0
- package/src/client/core/instructions/wrapperProvideLiquidityClassic.ts +77 -0
- package/src/client/core/instructions/wrapperSellPt.ts +63 -0
- package/src/client/core/instructions/wrapperSellYt.ts +87 -0
- package/src/client/core/instructions/wrapperStrip.ts +81 -0
- package/src/client/core/instructions/wrapperWithdrawLiquidity.ts +77 -0
- package/src/client/core/instructions/wrapperWithdrawLiquidityClassic.ts +73 -0
- package/src/client/core/types/adminAction.ts +255 -0
- package/src/client/core/types/amount.ts +51 -0
- package/src/client/core/types/buyPtEvent.ts +39 -0
- package/src/client/core/types/buyYtEvent.ts +95 -0
- package/src/client/core/types/claimFarmEmissionsEvent.ts +75 -0
- package/src/client/core/types/claimFarmEmissionsEventV2.ts +83 -0
- package/src/client/core/types/claimLimits.ts +15 -0
- package/src/client/core/types/collectEmissionEvent.ts +51 -0
- package/src/client/core/types/collectEmissionEventV2.ts +60 -0
- package/src/client/core/types/collectInterestEvent.ts +48 -0
- package/src/client/core/types/collectInterestEventV2.ts +57 -0
- package/src/client/core/types/collectTreasuryEmissionKind.ts +8 -0
- package/src/client/core/types/collectTreasuryInterestKind.ts +8 -0
- package/src/client/core/types/cpiAccounts.ts +21 -0
- package/src/client/core/types/cpiInterfaceContext.ts +13 -0
- package/src/client/core/types/depositLiquidityEvent.ts +101 -0
- package/src/client/core/types/depositLpEvent.ts +75 -0
- package/src/client/core/types/depositLpEventV2.ts +83 -0
- package/src/client/core/types/depositYtEvent.ts +82 -0
- package/src/client/core/types/depositYtEventV2.ts +91 -0
- package/src/client/core/types/emissionInfo.ts +44 -0
- package/src/client/core/types/farmEmission.ts +31 -0
- package/src/client/core/types/index.ts +60 -0
- package/src/client/core/types/initLpPositionEvent.ts +57 -0
- package/src/client/core/types/initializeYieldPositionEvent.ts +43 -0
- package/src/client/core/types/liquidityNetBalanceLimits.ts +22 -0
- package/src/client/core/types/lpFarm.ts +12 -0
- package/src/client/core/types/marketAdminAction.ts +212 -0
- package/src/client/core/types/marketCollectEmissionEvent.ts +67 -0
- package/src/client/core/types/marketCollectEmissionEventV2.ts +75 -0
- package/src/client/core/types/marketEmission.ts +28 -0
- package/src/client/core/types/marketEmissions.ts +10 -0
- package/src/client/core/types/marketFinancials.ts +19 -0
- package/src/client/core/types/mergeEvent.ts +118 -0
- package/src/client/core/types/number.ts +7 -0
- package/src/client/core/types/personalYieldTracker.ts +12 -0
- package/src/client/core/types/personalYieldTrackers.ts +13 -0
- package/src/client/core/types/principleDetails.ts +25 -0
- package/src/client/core/types/principles.ts +23 -0
- package/src/client/core/types/sellPtEvent.ts +39 -0
- package/src/client/core/types/sellYtEvent.ts +90 -0
- package/src/client/core/types/stageYieldEvent.ts +63 -0
- package/src/client/core/types/stageYieldEventV2.ts +69 -0
- package/src/client/core/types/stripEvent.ts +124 -0
- package/src/client/core/types/tradePtEvent.ts +80 -0
- package/src/client/core/types/withdrawLiquidityEvent.ts +97 -0
- package/src/client/core/types/withdrawLpEvent.ts +75 -0
- package/src/client/core/types/withdrawLpEventV2.ts +83 -0
- package/src/client/core/types/withdrawYtEvent.ts +82 -0
- package/src/client/core/types/withdrawYtEventV2.ts +91 -0
- package/src/client/core/types/wrapperBuyYtEvent.ts +39 -0
- package/src/client/core/types/wrapperCollectInterestEvent.ts +37 -0
- package/src/client/core/types/wrapperMergeEvent.ts +38 -0
- package/src/client/core/types/wrapperProvideLiquidityBaseEvent.ts +43 -0
- package/src/client/core/types/wrapperProvideLiquidityClassicEvent.ts +41 -0
- package/src/client/core/types/wrapperProvideLiquidityEvent.ts +41 -0
- package/src/client/core/types/wrapperSellYtEvent.ts +39 -0
- package/src/client/core/types/wrapperStripEvent.ts +38 -0
- package/src/client/core/types/wrapperWithdrawLiquidityClassicEvent.ts +41 -0
- package/src/client/core/types/wrapperWithdrawLiquidityEvent.ts +39 -0
- package/src/client/core/types/yieldTokenTracker.ts +12 -0
- package/src/client/orderbook/accounts/cpiAccountsOrderbook.ts +101 -0
- package/src/client/orderbook/accounts/vault.ts +234 -0
- package/src/client/orderbook/eventRegistry.ts +71 -0
- package/src/client/orderbook/index.ts +55 -0
- package/src/client/orderbook/instructions/collectAdminEmission.ts +48 -0
- package/src/client/orderbook/instructions/collectAdminFee.ts +59 -0
- package/src/client/orderbook/instructions/collectInterest.ts +66 -0
- package/src/client/orderbook/instructions/initializeOrderbook.ts +104 -0
- package/src/client/orderbook/instructions/marketOffer.ts +89 -0
- package/src/client/orderbook/instructions/postOffer.ts +96 -0
- package/src/client/orderbook/instructions/reallocOrderbookAccount.ts +45 -0
- package/src/client/orderbook/instructions/removeExpiredOffers.ts +37 -0
- package/src/client/orderbook/instructions/removeOffer.ts +73 -0
- package/src/client/orderbook/instructions/setConfigurationOptions.ts +43 -0
- package/src/client/orderbook/instructions/withdrawFunds.ts +78 -0
- package/src/client/orderbook/instructions/wrapperCollectAdminFee.ts +73 -0
- package/src/client/orderbook/instructions/wrapperCollectInterest.ts +65 -0
- package/src/client/orderbook/instructions/wrapperMarketOffer.ts +94 -0
- package/src/client/orderbook/instructions/wrapperPostOffer.ts +99 -0
- package/src/client/orderbook/instructions/wrapperRemoveOffer.ts +75 -0
- package/src/client/orderbook/instructions/wrapperWithdrawFunds.ts +80 -0
- package/src/client/orderbook/types/amount.ts +51 -0
- package/src/client/orderbook/types/claimLimits.ts +15 -0
- package/src/client/orderbook/types/collectAdminEmissionEvent.ts +39 -0
- package/src/client/orderbook/types/collectAdminFeeEvent.ts +17 -0
- package/src/client/orderbook/types/collectEmissionEventV2.ts +60 -0
- package/src/client/orderbook/types/collectInterestEventV2.ts +57 -0
- package/src/client/orderbook/types/collectUserInterestEvent.ts +36 -0
- package/src/client/orderbook/types/cpiAccounts.ts +21 -0
- package/src/client/orderbook/types/cpiInterfaceContext.ts +13 -0
- package/src/client/orderbook/types/emissionInfo.ts +44 -0
- package/src/client/orderbook/types/exponentCoreCpiAccounts.ts +21 -0
- package/src/client/orderbook/types/filledOffersEvent.ts +19 -0
- package/src/client/orderbook/types/index.ts +30 -0
- package/src/client/orderbook/types/marketOfferEvent.ts +72 -0
- package/src/client/orderbook/types/mergeEvent.ts +118 -0
- package/src/client/orderbook/types/number.ts +7 -0
- package/src/client/orderbook/types/offerOptions.ts +56 -0
- package/src/client/orderbook/types/offerType.ts +8 -0
- package/src/client/orderbook/types/orderbookInitEvent.ts +54 -0
- package/src/client/orderbook/types/postOfferEvent.ts +78 -0
- package/src/client/orderbook/types/removeOfferEvent.ts +67 -0
- package/src/client/orderbook/types/setConfigurationOptionsEnum.ts +116 -0
- package/src/client/orderbook/types/stripEvent.ts +124 -0
- package/src/client/orderbook/types/withdrawFundsEvent.ts +65 -0
- package/src/client/orderbook/types/wrapperCollectAdminFeeEvent.ts +13 -0
- package/src/client/orderbook/types/wrapperCollectInterestEvent.ts +25 -0
- package/src/client/orderbook/types/wrapperMarketOfferEvent.ts +27 -0
- package/src/client/orderbook/types/wrapperPostOfferEvent.ts +72 -0
- package/src/client/orderbook/types/wrapperRemoveOfferEvent.ts +25 -0
- package/src/client/orderbook/types/wrapperWithdrawFundsEvent.ts +38 -0
- package/src/client/orderbook/types/yieldTokenTracker.ts +12 -0
- package/src/client/vaults/accounts/actionProposal.ts +144 -0
- package/src/client/vaults/accounts/exponentStrategyVault.ts +211 -0
- package/src/client/vaults/accounts/programConfig.ts +123 -0
- package/src/client/vaults/accounts/voteAccount.ts +132 -0
- package/src/client/vaults/accounts/withdrawalAccount.ts +132 -0
- package/src/client/vaults/eventRegistry.ts +45 -0
- package/src/client/vaults/index.ts +111 -0
- package/src/client/vaults/instructions/activateProposal.ts +46 -0
- package/src/client/vaults/instructions/addPolicy.ts +57 -0
- package/src/client/vaults/instructions/appendProposalActions.ts +47 -0
- package/src/client/vaults/instructions/cancelProposal.ts +28 -0
- package/src/client/vaults/instructions/cancelWithdrawal.ts +34 -0
- package/src/client/vaults/instructions/collectManagementFee.ts +32 -0
- package/src/client/vaults/instructions/depositLiquidity.ts +62 -0
- package/src/client/vaults/instructions/executeProposal.ts +36 -0
- package/src/client/vaults/instructions/executeWithdrawal.ts +58 -0
- package/src/client/vaults/instructions/executeWithdrawalFromReserves.ts +66 -0
- package/src/client/vaults/instructions/fillWithdrawal.ts +59 -0
- package/src/client/vaults/instructions/finalizeProposal.ts +28 -0
- package/src/client/vaults/instructions/initProposal.ts +46 -0
- package/src/client/vaults/instructions/initializePrices.ts +28 -0
- package/src/client/vaults/instructions/initializeVault.ts +148 -0
- package/src/client/vaults/instructions/makeSentienelManager.ts +28 -0
- package/src/client/vaults/instructions/managePrices.ts +46 -0
- package/src/client/vaults/instructions/manageVaultSettings.ts +48 -0
- package/src/client/vaults/instructions/managerUpdatePosition.ts +45 -0
- package/src/client/vaults/instructions/queueWithdrawal.ts +50 -0
- package/src/client/vaults/instructions/removePolicy.ts +44 -0
- package/src/client/vaults/instructions/sentinelSetVaultFlags.ts +44 -0
- package/src/client/vaults/instructions/stakeVote.ts +57 -0
- package/src/client/vaults/instructions/unstakeVote.ts +42 -0
- package/src/client/vaults/instructions/updatePolicy.ts +59 -0
- package/src/client/vaults/instructions/updatePolicyManager.ts +44 -0
- package/src/client/vaults/instructions/updatePrice.ts +42 -0
- package/src/client/vaults/instructions/validateInteractionHook.ts +60 -0
- package/src/client/vaults/instructions/wrapperAddPolicy.ts +57 -0
- package/src/client/vaults/instructions/wrapperExecuteWithdrawal.ts +76 -0
- package/src/client/vaults/instructions/wrapperManageVaultSettings.ts +48 -0
- package/src/client/vaults/instructions/wrapperManagerUpdatePosition.ts +45 -0
- package/src/client/vaults/instructions/wrapperRemovePolicy.ts +44 -0
- package/src/client/vaults/instructions/wrapperUpdatePolicy.ts +59 -0
- package/src/client/vaults/types/accountConstraint.ts +35 -0
- package/src/client/vaults/types/accountConstraintType.ts +93 -0
- package/src/client/vaults/types/allowedSettingsChange.ts +136 -0
- package/src/client/vaults/types/cancelProposalEvent.ts +47 -0
- package/src/client/vaults/types/clmmPositionEntry.ts +37 -0
- package/src/client/vaults/types/dataConstraint.ts +16 -0
- package/src/client/vaults/types/dataOperator.ts +13 -0
- package/src/client/vaults/types/dataValue.ts +119 -0
- package/src/client/vaults/types/depositLiquidityEvent.ts +89 -0
- package/src/client/vaults/types/executeProposalEvent.ts +47 -0
- package/src/client/vaults/types/executeWithdrawalEvent.ts +12 -0
- package/src/client/vaults/types/fillParam.ts +12 -0
- package/src/client/vaults/types/finalizeProposalEvent.ts +51 -0
- package/src/client/vaults/types/hook.ts +40 -0
- package/src/client/vaults/types/hookCompiledInstruction.ts +20 -0
- package/src/client/vaults/types/index.ts +66 -0
- package/src/client/vaults/types/instructionConstraint.ts +33 -0
- package/src/client/vaults/types/internalFundTransferPolicyCreationPayload.ts +35 -0
- package/src/client/vaults/types/kaminoObligationEntry.ts +48 -0
- package/src/client/vaults/types/limitedQuantityConstraints.ts +10 -0
- package/src/client/vaults/types/limitedSpendingLimit.ts +35 -0
- package/src/client/vaults/types/limitedTimeConstraints.ts +15 -0
- package/src/client/vaults/types/loopscaleLoanEntry.ts +23 -0
- package/src/client/vaults/types/loopscaleStrategyEntry.ts +23 -0
- package/src/client/vaults/types/number.ts +8 -0
- package/src/client/vaults/types/obligationType.ts +63 -0
- package/src/client/vaults/types/orderbookEntry.ts +50 -0
- package/src/client/vaults/types/periodV2.ts +76 -0
- package/src/client/vaults/types/permissions.ts +8 -0
- package/src/client/vaults/types/policyAction.ts +74 -0
- package/src/client/vaults/types/policyConfig.ts +32 -0
- package/src/client/vaults/types/policyCreationPayload.ts +147 -0
- package/src/client/vaults/types/policyExpirationArgs.ts +67 -0
- package/src/client/vaults/types/positionUpdate.ts +251 -0
- package/src/client/vaults/types/priceId.ts +57 -0
- package/src/client/vaults/types/priceType.ts +23 -0
- package/src/client/vaults/types/programInteractionPolicyCreationPayload.ts +32 -0
- package/src/client/vaults/types/proposalAction.ts +100 -0
- package/src/client/vaults/types/proposalActionKind.ts +11 -0
- package/src/client/vaults/types/proposalStatus.ts +13 -0
- package/src/client/vaults/types/proposalVoteConfig.ts +36 -0
- package/src/client/vaults/types/proposeActionEvent.ts +62 -0
- package/src/client/vaults/types/quantityConstraints.ts +14 -0
- package/src/client/vaults/types/reservePriceMapping.ts +26 -0
- package/src/client/vaults/types/settingsChangePolicyCreationPayload.ts +14 -0
- package/src/client/vaults/types/spendingLimitPolicyCreationPayload.ts +54 -0
- package/src/client/vaults/types/stakeVoteEvent.ts +54 -0
- package/src/client/vaults/types/strategyPosition.ts +161 -0
- package/src/client/vaults/types/timeConstraints.ts +22 -0
- package/src/client/vaults/types/tokenAccountBalance.ts +35 -0
- package/src/client/vaults/types/tokenAccountEntry.ts +30 -0
- package/src/client/vaults/types/tokenEntry.ts +48 -0
- package/src/client/vaults/types/unstakeVoteEvent.ts +53 -0
- package/src/client/vaults/types/updatePriceAction.ts +268 -0
- package/src/client/vaults/types/updatePriceInput.ts +12 -0
- package/src/client/vaults/types/usageState.ts +12 -0
- package/src/client/vaults/types/vaultConfig.ts +38 -0
- package/src/client/vaults/types/vaultFinancials.ts +40 -0
- package/src/client/vaults/types/vaultFlagAction.ts +75 -0
- package/src/client/vaults/types/vaultFlagsUpdatedEvent.ts +37 -0
- package/src/client/vaults/types/vaultRoleKind.ts +11 -0
- package/src/client/vaults/types/vaultRoles.ts +59 -0
- package/src/client/vaults/types/vaultSettingsAction.ts +533 -0
- package/src/client/vaults/types/voteChoice.ts +9 -0
- package/src/client/vaults/types/withdrawalPeriodSettings.ts +83 -0
- package/src/client/vaults/types/withdrawalTokenFill.ts +35 -0
- package/src/client/vaults/types/yieldPositionEntry.ts +35 -0
- package/src/clmm/codamaEvents.ts +34 -0
- package/src/clmm/index.ts +1 -1
- package/src/codamaEvents.ts +27 -0
- package/src/environment.ts +15 -13
- package/src/exponentVaults/aumCalculator.ts +1013 -0
- package/src/exponentVaults/events.ts +15 -0
- package/src/exponentVaults/index.ts +298 -0
- package/src/exponentVaults/kamino-markets.ts +363 -0
- package/src/exponentVaults/loopscale-client.ts +1373 -0
- package/src/exponentVaults/policyBuilders.ts +1559 -0
- package/src/exponentVaults/policyMatcher.ts +895 -0
- package/src/exponentVaults/scope-refresh.ts +169 -0
- package/src/exponentVaults/squadsVaultTxnResolver/constants.ts +59 -0
- package/src/exponentVaults/squadsVaultTxnResolver/helpers.ts +355 -0
- package/src/exponentVaults/squadsVaultTxnResolver/index.ts +16 -0
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.ts +472 -0
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.ts +33 -0
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/index.ts +38 -0
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.ts +83 -0
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.ts +94 -0
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/titan.ts +41 -0
- package/src/exponentVaults/squadsVaultTxnResolver/squadsVaultTxnResolver.ts +91 -0
- package/src/exponentVaults/squadsVaultTxnResolver/types.ts +171 -0
- package/src/exponentVaults/squadsVaultTxnResolver/utils.ts +3 -0
- package/src/exponentVaults/syncTransaction.ts +495 -0
- package/src/exponentVaults/titan-quote.ts +260 -0
- package/src/exponentVaults/vault-interaction.ts +3479 -0
- package/src/exponentVaults/vault.ts +2256 -0
- package/src/exponentVaults/vaultTransactionBuilder.ts +785 -0
- package/src/flavors.ts +100 -99
- package/src/index.ts +17 -8
- package/src/lpPosition.ts +13 -18
- package/src/market.ts +461 -544
- package/src/marketThree.test.ts +16 -14
- package/src/marketThree.ts +906 -483
- package/src/orderbook/codamaEvents.ts +28 -0
- package/src/orderbook/index.ts +5 -4
- package/src/orderbook/math.ts +25 -9
- package/src/orderbook/orderbook.ts +531 -330
- package/src/orderbook/types.ts +6 -11
- package/src/orderbook/utils.ts +4 -12
- package/src/router.ts +469 -19
- package/src/syPosition.ts +15 -16
- package/src/tokenUtil.ts +4 -4
- package/src/utils/index.ts +5 -31
- package/src/utils/ix.ts +2 -2
- package/src/vault.ts +282 -327
- package/src/ytPosition.ts +75 -118
- package/tsconfig.json +6 -1
- package/build/EventDecoderV2.d.ts +0 -31
- package/build/EventDecoderV2.js +0 -76
- package/build/EventDecoderV2.js.map +0 -1
- package/build/clmm/events.d.ts +0 -10
- package/build/clmm/events.js +0 -10
- package/build/clmm/events.js.map +0 -1
- package/build/events.d.ts +0 -563
- package/build/events.js +0 -301
- package/build/events.js.map +0 -1
- package/build/eventsV2.d.ts +0 -7
- package/build/eventsV2.js +0 -10
- package/build/eventsV2.js.map +0 -1
- package/build/orderbook/events.d.ts +0 -7
- package/build/orderbook/events.js +0 -10
- package/build/orderbook/events.js.map +0 -1
- package/src/EventDecoderV2.ts +0 -96
- package/src/clmm/events.ts +0 -17
- package/src/events.ts +0 -921
- package/src/eventsV2.ts +0 -13
- package/src/orderbook/events.ts +0 -13
|
@@ -0,0 +1,2256 @@
|
|
|
1
|
+
// The following methods have breaking changes: ixDepositLiquidity, ixQueueWithdrawal, ixExecuteWithdrawal, ixManagerRefreshSyRate
|
|
2
|
+
// Account names changed: tokenSySrc -> tokenSrc, tokenSyVault -> entryTokenVault
|
|
3
|
+
// New required accounts: exponentPrices
|
|
4
|
+
import {
|
|
5
|
+
ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
6
|
+
NATIVE_MINT,
|
|
7
|
+
TOKEN_2022_PROGRAM_ID,
|
|
8
|
+
TOKEN_PROGRAM_ID,
|
|
9
|
+
createAssociatedTokenAccountIdempotentInstruction,
|
|
10
|
+
createSyncNativeInstruction,
|
|
11
|
+
getAccount,
|
|
12
|
+
getAssociatedTokenAddressSync,
|
|
13
|
+
getMint,
|
|
14
|
+
} from "@solana/spl-token"
|
|
15
|
+
import {
|
|
16
|
+
AccountMeta,
|
|
17
|
+
Connection,
|
|
18
|
+
Keypair,
|
|
19
|
+
PublicKey,
|
|
20
|
+
SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
21
|
+
SYSVAR_RENT_PUBKEY,
|
|
22
|
+
SystemProgram,
|
|
23
|
+
TransactionInstruction,
|
|
24
|
+
TransactionMessage,
|
|
25
|
+
VersionedTransaction,
|
|
26
|
+
} from "@solana/web3.js"
|
|
27
|
+
import bs58 from "bs58"
|
|
28
|
+
|
|
29
|
+
import {
|
|
30
|
+
ClmmPositionEntry,
|
|
31
|
+
ExponentPrices,
|
|
32
|
+
ExponentVault as ExponentVaultAccountType,
|
|
33
|
+
ExponentVault as ExponentVaultType,
|
|
34
|
+
ExponentVaultsFetcher,
|
|
35
|
+
OrderbookEntry,
|
|
36
|
+
PriceId,
|
|
37
|
+
TokenAccountEntry,
|
|
38
|
+
TokenEntry,
|
|
39
|
+
transformAnchorData,
|
|
40
|
+
} from "@exponent-labs/exponent-vaults-fetcher"
|
|
41
|
+
import { PROGRAM_ID as EXPONENT_VAULTS_PROGRAM_ID } from "@exponent-labs/exponent-vaults-idl"
|
|
42
|
+
import { ExponentVaultsPDA, SeedId, SquadsPDA } from "@exponent-labs/exponent-vaults-pda"
|
|
43
|
+
|
|
44
|
+
import { fetchAllMaybeMarketThreeAccounts } from "../client/clmm/accounts/marketThree"
|
|
45
|
+
import * as exponentVaults from "../client/vaults"
|
|
46
|
+
import { Environment, LOCAL_ENV } from "../environment"
|
|
47
|
+
import { emitEventAuthority } from "../utils"
|
|
48
|
+
import { AumCalculator } from "./aumCalculator"
|
|
49
|
+
import { SquadsVaultTxnResolver } from "./squadsVaultTxnResolver"
|
|
50
|
+
|
|
51
|
+
type Numeric = bigint | number
|
|
52
|
+
|
|
53
|
+
export const SYNTHETIC_USD_MINT = new PublicKey("USD1111111111111111111111111111111111111111")
|
|
54
|
+
export const SYNTHETIC_USD_DECIMALS = 6
|
|
55
|
+
export const SYNTHETIC_USD9_MINT = new PublicKey("USD1111111111111111111111111111111111111119")
|
|
56
|
+
export const SYNTHETIC_USD9_DECIMALS = 9
|
|
57
|
+
|
|
58
|
+
export const getSyntheticMintDecimals = (mint: PublicKey): number | null => {
|
|
59
|
+
if (mint.equals(SYNTHETIC_USD_MINT)) return SYNTHETIC_USD_DECIMALS
|
|
60
|
+
if (mint.equals(SYNTHETIC_USD9_MINT)) return SYNTHETIC_USD9_DECIMALS
|
|
61
|
+
return null
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const getMintDecimals = async (connection: Connection, mint: PublicKey): Promise<number> => {
|
|
65
|
+
const syntheticDecimals = getSyntheticMintDecimals(mint)
|
|
66
|
+
if (syntheticDecimals !== null) {
|
|
67
|
+
return syntheticDecimals
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const mintInfo = await getMint(connection, mint)
|
|
71
|
+
return mintInfo.decimals
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const pushPriceMintAccount = (remainingAccounts: AccountMeta[], mint: PublicKey) => {
|
|
75
|
+
if (getSyntheticMintDecimals(mint) !== null) return
|
|
76
|
+
remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: false })
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ============================================================================
|
|
80
|
+
// Policy Types (matching on-chain structures)
|
|
81
|
+
// ============================================================================
|
|
82
|
+
|
|
83
|
+
export type DataOperator =
|
|
84
|
+
| "Equals"
|
|
85
|
+
| "NotEquals"
|
|
86
|
+
| "GreaterThan"
|
|
87
|
+
| "GreaterThanOrEqualTo"
|
|
88
|
+
| "LessThan"
|
|
89
|
+
| "LessThanOrEqualTo"
|
|
90
|
+
|
|
91
|
+
export type DataValue =
|
|
92
|
+
| { u8: number }
|
|
93
|
+
| { u16Le: number }
|
|
94
|
+
| { u32Le: number }
|
|
95
|
+
| { u64Le: bigint }
|
|
96
|
+
| { u128Le: bigint }
|
|
97
|
+
| { u8Slice: number[] }
|
|
98
|
+
|
|
99
|
+
export interface DataConstraint {
|
|
100
|
+
dataOffset: bigint
|
|
101
|
+
dataValue: DataValue
|
|
102
|
+
operator: DataOperator
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface AccountConstraint {
|
|
106
|
+
accountIndex: number
|
|
107
|
+
accountKeys?: PublicKey[]
|
|
108
|
+
accountDataConstraints?: DataConstraint[]
|
|
109
|
+
owner?: PublicKey | null
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface InstructionConstraint {
|
|
113
|
+
programId: PublicKey
|
|
114
|
+
accountConstraints: AccountConstraint[]
|
|
115
|
+
dataConstraints: DataConstraint[]
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type Period = "OneTime" | "Hourly" | "Daily" | "Weekly" | "Monthly" | "Quarterly" | "Yearly"
|
|
119
|
+
|
|
120
|
+
export interface TimeConstraints {
|
|
121
|
+
start: bigint
|
|
122
|
+
expiration: bigint | null
|
|
123
|
+
period: Period
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface QuantityConstraints {
|
|
127
|
+
maxPerPeriod: bigint
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface SpendingLimit {
|
|
131
|
+
mint: PublicKey
|
|
132
|
+
timeConstraints: TimeConstraints
|
|
133
|
+
quantityConstraints: QuantityConstraints
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export type AllowedSettingsChange = "AddSigner" | "RemoveSigner" | "ChangeThreshold" | "ChangeTimeLock"
|
|
137
|
+
|
|
138
|
+
export type PolicyType =
|
|
139
|
+
| {
|
|
140
|
+
programInteraction: {
|
|
141
|
+
accountIndex: number
|
|
142
|
+
instructionsConstraints: InstructionConstraint[]
|
|
143
|
+
spendingLimits: SpendingLimit[]
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
| {
|
|
147
|
+
internalFundTransfer: {
|
|
148
|
+
sourceAccountMask: number[]
|
|
149
|
+
destinationAccountMask: number[]
|
|
150
|
+
allowedMints: PublicKey[]
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
| {
|
|
154
|
+
settingsChange: {
|
|
155
|
+
allowedActions: AllowedSettingsChange[]
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
| {
|
|
159
|
+
spendingLimit: {
|
|
160
|
+
sourceAccountIndex: number
|
|
161
|
+
destinations: PublicKey[]
|
|
162
|
+
spendingLimit: SpendingLimit
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
167
|
+
export type PolicyExpiration = { timestamp: bigint } | { settingsState: {} }
|
|
168
|
+
|
|
169
|
+
export interface PolicyConfig {
|
|
170
|
+
policyType: PolicyType
|
|
171
|
+
threshold: number
|
|
172
|
+
timeLock: number
|
|
173
|
+
startTimestamp: bigint | null
|
|
174
|
+
expiration: PolicyExpiration | null
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** Interface type for adapter vaults */
|
|
178
|
+
export type InterfaceType =
|
|
179
|
+
| { generic: Record<string, never> }
|
|
180
|
+
| { kamino: Record<string, never> }
|
|
181
|
+
| { marginfi: Record<string, never> }
|
|
182
|
+
| { jitoRestaking: Record<string, never> }
|
|
183
|
+
| { perena: Record<string, never> }
|
|
184
|
+
|
|
185
|
+
export interface TokenEntryInput {
|
|
186
|
+
mint: PublicKey
|
|
187
|
+
priceId: PriceId
|
|
188
|
+
tokenSquadsAccount: PublicKey
|
|
189
|
+
tokenAccountVault: PublicKey
|
|
190
|
+
tokenEscrow: PublicKey
|
|
191
|
+
shareBp: number
|
|
192
|
+
currentLiquidity: bigint
|
|
193
|
+
mintFlag: number
|
|
194
|
+
interfaceType?: InterfaceType
|
|
195
|
+
/** Force deallocate policy IDs (optional, defaults to empty) */
|
|
196
|
+
forceDeallocatePolicyIds?: bigint[]
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
type TotalAumInfo = {
|
|
200
|
+
aum: bigint
|
|
201
|
+
aumHuman: number
|
|
202
|
+
lpRate: number
|
|
203
|
+
lpSupply: bigint
|
|
204
|
+
lpDecimals: number
|
|
205
|
+
underlyingDecimals: number
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const VAULT_SEED = Buffer.from("vault")
|
|
209
|
+
|
|
210
|
+
const toBigInt = (value: Numeric): bigint => {
|
|
211
|
+
if (typeof value === "bigint") return value
|
|
212
|
+
return BigInt(Math.ceil(value))
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const toCodamaPriceId = (priceId: PriceId): exponentVaults.PriceId => {
|
|
216
|
+
if ("simple" in priceId) {
|
|
217
|
+
return {
|
|
218
|
+
__kind: "Simple",
|
|
219
|
+
priceId: toBigInt(priceId.simple.priceId),
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if ("multiply" in priceId) {
|
|
223
|
+
return {
|
|
224
|
+
__kind: "Multiply",
|
|
225
|
+
priceIds: priceId.multiply.priceIds.map((id) => toBigInt(id)),
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
throw new Error("Unknown PriceId variant")
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const defaultTokenAccount = (mint: PublicKey, owner: PublicKey, tokenProgram: PublicKey) =>
|
|
232
|
+
getAssociatedTokenAddressSync(mint, owner, true, tokenProgram)
|
|
233
|
+
|
|
234
|
+
const PRICE_INTERFACE_ACCOUNTS_SEED = Buffer.from("price_interface_accounts")
|
|
235
|
+
|
|
236
|
+
const randomPriceInterfaceAccountsSeed = (): Uint8Array =>
|
|
237
|
+
Uint8Array.from(Keypair.generate().publicKey.toBytes().slice(0, 8))
|
|
238
|
+
|
|
239
|
+
const derivePriceInterfaceAccountsAddress = (
|
|
240
|
+
programId: PublicKey,
|
|
241
|
+
exponentPrices: PublicKey,
|
|
242
|
+
seed: Uint8Array,
|
|
243
|
+
): [PublicKey, number] =>
|
|
244
|
+
PublicKey.findProgramAddressSync(
|
|
245
|
+
[PRICE_INTERFACE_ACCOUNTS_SEED, exponentPrices.toBuffer(), Buffer.from(seed)],
|
|
246
|
+
programId,
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
const convertPriceType = (priceType: PriceTypeParam): exponentVaults.PriceType => {
|
|
250
|
+
if ("pyth" in priceType) return exponentVaults.PriceType.Pyth
|
|
251
|
+
if ("pythInverse" in priceType) return exponentVaults.PriceType.PythInverse
|
|
252
|
+
if ("splStakePool" in priceType) return exponentVaults.PriceType.SplStakePool
|
|
253
|
+
if ("one" in priceType) return exponentVaults.PriceType.One
|
|
254
|
+
if ("pt" in priceType) return exponentVaults.PriceType.Pt
|
|
255
|
+
if ("yt" in priceType) return exponentVaults.PriceType.Yt
|
|
256
|
+
if ("solstice" in priceType) return exponentVaults.PriceType.Solstice
|
|
257
|
+
if ("reflect" in priceType) return exponentVaults.PriceType.Reflect
|
|
258
|
+
if ("fragmetric" in priceType) return exponentVaults.PriceType.Fragmetric
|
|
259
|
+
if ("fragmetricSupportedAsset" in priceType) return exponentVaults.PriceType.FragmetricSupportedAsset
|
|
260
|
+
if ("jupiterLend" in priceType) return exponentVaults.PriceType.JupiterLend
|
|
261
|
+
if ("chainlink" in priceType) return exponentVaults.PriceType.Chainlink
|
|
262
|
+
if ("ore" in priceType) return exponentVaults.PriceType.Ore
|
|
263
|
+
if ("hyloLpToken" in priceType) return exponentVaults.PriceType.HyloLpToken
|
|
264
|
+
if ("meteora" in priceType) return exponentVaults.PriceType.Meteora
|
|
265
|
+
if ("kaminoVault" in priceType) return exponentVaults.PriceType.KaminoVault
|
|
266
|
+
throw new Error("Unknown PriceType variant")
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const convertUpdatePriceAction = (
|
|
270
|
+
action: UpdatePriceActionParam,
|
|
271
|
+
programId: PublicKey,
|
|
272
|
+
exponentPrices: PublicKey,
|
|
273
|
+
remainingAccounts: AccountMeta[],
|
|
274
|
+
): exponentVaults.UpdatePriceAction => {
|
|
275
|
+
if ("addPrice" in action) {
|
|
276
|
+
const seed = randomPriceInterfaceAccountsSeed()
|
|
277
|
+
const [priceInterfaceAccounts] = derivePriceInterfaceAccountsAddress(programId, exponentPrices, seed)
|
|
278
|
+
const interfaceAccounts = action.addPrice.interfaceAccounts ?? []
|
|
279
|
+
remainingAccounts.push({
|
|
280
|
+
pubkey: priceInterfaceAccounts,
|
|
281
|
+
isSigner: false,
|
|
282
|
+
isWritable: true,
|
|
283
|
+
})
|
|
284
|
+
pushPriceMintAccount(remainingAccounts, action.addPrice.priceMint)
|
|
285
|
+
pushPriceMintAccount(remainingAccounts, action.addPrice.underlyingMint)
|
|
286
|
+
return {
|
|
287
|
+
__kind: "AddPrice",
|
|
288
|
+
priceType: convertPriceType(action.addPrice.priceType),
|
|
289
|
+
priceMint: action.addPrice.priceMint,
|
|
290
|
+
underlyingMint: action.addPrice.underlyingMint,
|
|
291
|
+
interfaceAccounts,
|
|
292
|
+
priceInterfaceAccountsSeed: seed,
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if ("removePrice" in action) {
|
|
296
|
+
if (!action.removePrice.priceInterfaceAccounts) {
|
|
297
|
+
throw new Error("removePrice requires priceInterfaceAccounts")
|
|
298
|
+
}
|
|
299
|
+
remainingAccounts.push({
|
|
300
|
+
pubkey: action.removePrice.priceInterfaceAccounts,
|
|
301
|
+
isSigner: false,
|
|
302
|
+
isWritable: true,
|
|
303
|
+
})
|
|
304
|
+
return {
|
|
305
|
+
__kind: "RemovePrice",
|
|
306
|
+
priceId: toBigInt(action.removePrice.priceId),
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
if ("updatePrice" in action) {
|
|
310
|
+
if (!action.updatePrice.priceInterfaceAccounts) {
|
|
311
|
+
throw new Error("updatePrice requires priceInterfaceAccounts")
|
|
312
|
+
}
|
|
313
|
+
remainingAccounts.push({
|
|
314
|
+
pubkey: action.updatePrice.priceInterfaceAccounts,
|
|
315
|
+
isSigner: false,
|
|
316
|
+
isWritable: false,
|
|
317
|
+
})
|
|
318
|
+
return {
|
|
319
|
+
__kind: "UpdatePrice",
|
|
320
|
+
priceId: toBigInt(action.updatePrice.priceId),
|
|
321
|
+
priceType: convertPriceType(action.updatePrice.priceType),
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if ("addManager" in action) {
|
|
325
|
+
return {
|
|
326
|
+
__kind: "AddManager",
|
|
327
|
+
manager: action.addManager.manager,
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if ("removeManager" in action) {
|
|
331
|
+
return {
|
|
332
|
+
__kind: "RemoveManager",
|
|
333
|
+
manager: action.removeManager.manager,
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if ("addPtPrice" in action) {
|
|
337
|
+
const seed = randomPriceInterfaceAccountsSeed()
|
|
338
|
+
const [priceInterfaceAccounts] = derivePriceInterfaceAccountsAddress(programId, exponentPrices, seed)
|
|
339
|
+
const interfaceAccounts = action.addPtPrice.interfaceAccounts ?? []
|
|
340
|
+
remainingAccounts.push({
|
|
341
|
+
pubkey: priceInterfaceAccounts,
|
|
342
|
+
isSigner: false,
|
|
343
|
+
isWritable: true,
|
|
344
|
+
})
|
|
345
|
+
pushPriceMintAccount(remainingAccounts, action.addPtPrice.priceMint)
|
|
346
|
+
pushPriceMintAccount(remainingAccounts, action.addPtPrice.underlyingMint)
|
|
347
|
+
return {
|
|
348
|
+
__kind: "AddPtPrice",
|
|
349
|
+
priceMint: action.addPtPrice.priceMint,
|
|
350
|
+
underlyingMint: action.addPtPrice.underlyingMint,
|
|
351
|
+
interfaceAccounts,
|
|
352
|
+
priceInterfaceAccountsSeed: seed,
|
|
353
|
+
impliedApyBps: action.addPtPrice.impliedApyBps,
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if ("addYtPrice" in action) {
|
|
357
|
+
const seed = randomPriceInterfaceAccountsSeed()
|
|
358
|
+
const [priceInterfaceAccounts] = derivePriceInterfaceAccountsAddress(programId, exponentPrices, seed)
|
|
359
|
+
const interfaceAccounts = action.addYtPrice.interfaceAccounts ?? []
|
|
360
|
+
remainingAccounts.push({
|
|
361
|
+
pubkey: priceInterfaceAccounts,
|
|
362
|
+
isSigner: false,
|
|
363
|
+
isWritable: true,
|
|
364
|
+
})
|
|
365
|
+
pushPriceMintAccount(remainingAccounts, action.addYtPrice.priceMint)
|
|
366
|
+
pushPriceMintAccount(remainingAccounts, action.addYtPrice.underlyingMint)
|
|
367
|
+
return {
|
|
368
|
+
__kind: "AddYtPrice",
|
|
369
|
+
priceMint: action.addYtPrice.priceMint,
|
|
370
|
+
underlyingMint: action.addYtPrice.underlyingMint,
|
|
371
|
+
interfaceAccounts,
|
|
372
|
+
priceInterfaceAccountsSeed: seed,
|
|
373
|
+
impliedApyBps: action.addYtPrice.impliedApyBps,
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
throw new Error("Unknown UpdatePriceAction variant")
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export interface DepositLiquidityParams {
|
|
380
|
+
depositor: PublicKey
|
|
381
|
+
mint: PublicKey
|
|
382
|
+
tokenAmountIn: Numeric
|
|
383
|
+
minLpOut: Numeric
|
|
384
|
+
tokenSrc?: PublicKey
|
|
385
|
+
/** Defaults to the Squads-controlled token account defined by the vault entry. */
|
|
386
|
+
entryTokenVault?: PublicKey
|
|
387
|
+
tokenLpDst?: PublicKey
|
|
388
|
+
tokenProgram?: PublicKey
|
|
389
|
+
/** Additional remaining accounts (e.g., Kamino obligations) */
|
|
390
|
+
extraRemainingAccounts?: AccountMeta[]
|
|
391
|
+
/**
|
|
392
|
+
* When true, pass token_2022_program (TOKEN_2022_PROGRAM_ID) as the second token program account.
|
|
393
|
+
* Use for compatibility with older deployed programs that expect token_program + token_2022_program
|
|
394
|
+
* instead of token_program + token_program_lp. Required when running against Surfpool/mainnet fork.
|
|
395
|
+
*/
|
|
396
|
+
useLegacyTokenAccounts?: boolean
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export interface UpdatePriceParams {
|
|
400
|
+
priceInterfaceAccounts?: PublicKey
|
|
401
|
+
pythPriceFeedId?: PublicKey
|
|
402
|
+
remainingAccounts?: PublicKey[]
|
|
403
|
+
priceId: number
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export interface QueueWithdrawalParams {
|
|
407
|
+
depositor: PublicKey
|
|
408
|
+
lpAmount: Numeric
|
|
409
|
+
tokenLpSrc?: PublicKey
|
|
410
|
+
tokenProgram?: PublicKey
|
|
411
|
+
systemProgram?: PublicKey
|
|
412
|
+
tokenLpEscrow?: PublicKey
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export interface TokenAccountPair {
|
|
416
|
+
/** Source token account (vault's token escrow) */
|
|
417
|
+
tokenSrc: PublicKey
|
|
418
|
+
/** Destination token account (user's token account) */
|
|
419
|
+
tokenDst: PublicKey
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export interface ExecuteWithdrawalParams {
|
|
423
|
+
owner: PublicKey
|
|
424
|
+
withdrawalAccount: PublicKey
|
|
425
|
+
/** Array of token account pairs matching the withdrawal fills */
|
|
426
|
+
tokenAccountPairs: TokenAccountPair[]
|
|
427
|
+
tokenProgram?: PublicKey
|
|
428
|
+
token2022Program?: PublicKey
|
|
429
|
+
tokenLpEscrow?: PublicKey
|
|
430
|
+
mintLp?: PublicKey
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
export interface ExecuteWithdrawalFromReservesParams {
|
|
434
|
+
owner: PublicKey
|
|
435
|
+
/** Index of the token entry to withdraw */
|
|
436
|
+
entryIdx: number
|
|
437
|
+
/** Amount of LP tokens to burn for withdrawal */
|
|
438
|
+
lpAmount: Numeric
|
|
439
|
+
/** Source token account (owned by squads_vault) */
|
|
440
|
+
tokenSrc: PublicKey
|
|
441
|
+
/** Source token account (owned by vault) */
|
|
442
|
+
tokenVaultSrc: PublicKey
|
|
443
|
+
/** Destination token account (owned by the user) */
|
|
444
|
+
tokenDst: PublicKey
|
|
445
|
+
squadsProgram: PublicKey
|
|
446
|
+
tokenLpSrc?: PublicKey
|
|
447
|
+
tokenProgram?: PublicKey
|
|
448
|
+
token2022Program?: PublicKey
|
|
449
|
+
tokenLpEscrow?: PublicKey
|
|
450
|
+
mintLp?: PublicKey
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
export interface FillWithdrawalFillParam {
|
|
454
|
+
/** Index of the token entry in vault.token_entries */
|
|
455
|
+
tokenEntryIdx: number
|
|
456
|
+
/** Percentage of remaining LP to fill in basis points (10000 = 100%) */
|
|
457
|
+
percentOfTotalLpBp: Numeric
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export interface FillWithdrawalParams {
|
|
461
|
+
/** Withdrawal account to fill */
|
|
462
|
+
withdrawalAccount: PublicKey
|
|
463
|
+
/** Fill parameters: which token entries and what percentage */
|
|
464
|
+
fills: FillWithdrawalFillParam[]
|
|
465
|
+
/** Token account pairs per fill: [{ tokenSrc (squads), tokenDst (vault escrow), tokenProgram }] */
|
|
466
|
+
tokenAccountTriples: Array<{
|
|
467
|
+
tokenSrc: PublicKey
|
|
468
|
+
tokenDst: PublicKey
|
|
469
|
+
tokenProgram: PublicKey
|
|
470
|
+
}>
|
|
471
|
+
mintLp?: PublicKey
|
|
472
|
+
tokenLpEscrow?: PublicKey
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
export interface WrapperExecuteWithdrawalParams {
|
|
476
|
+
owner: PublicKey
|
|
477
|
+
withdrawalAccount: PublicKey
|
|
478
|
+
/** Array of token account pairs matching the withdrawal fills */
|
|
479
|
+
tokenAccountPairs: TokenAccountPair[]
|
|
480
|
+
/** Index of the token entry for reserves withdrawal */
|
|
481
|
+
entryIdx: number
|
|
482
|
+
/** Source token account for reserves withdrawal (owned by squads_vault) */
|
|
483
|
+
tokenSrc: PublicKey
|
|
484
|
+
/** Source token account for reserves withdrawal (owned by vault) */
|
|
485
|
+
tokenVaultSrc: PublicKey
|
|
486
|
+
/** Destination token account for reserves withdrawal (owned by user) */
|
|
487
|
+
tokenDst: PublicKey
|
|
488
|
+
squadsProgram: PublicKey
|
|
489
|
+
tokenProgram?: PublicKey
|
|
490
|
+
token2022Program?: PublicKey
|
|
491
|
+
tokenLpEscrow?: PublicKey
|
|
492
|
+
mintLp?: PublicKey
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// ============================================================================
|
|
496
|
+
// Vault Initialization & Policy Management Parameter Types
|
|
497
|
+
// ============================================================================
|
|
498
|
+
|
|
499
|
+
/** Vault type enum */
|
|
500
|
+
export type VaultType = { orderbook: Record<string, never> } | { generic: Record<string, never> }
|
|
501
|
+
|
|
502
|
+
/** Role membership lists for vault governance */
|
|
503
|
+
export interface VaultRoles {
|
|
504
|
+
manager: PublicKey[]
|
|
505
|
+
curator: PublicKey[]
|
|
506
|
+
allocator: PublicKey[]
|
|
507
|
+
sentinel: PublicKey[]
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/** Configuration for proposal voting system */
|
|
511
|
+
export interface ProposalVoteConfig {
|
|
512
|
+
minVotingPeriodSeconds: number
|
|
513
|
+
maxVotingPeriodSeconds: number
|
|
514
|
+
defaultVotingPeriodSeconds: number
|
|
515
|
+
defaultTimelockSeconds: number
|
|
516
|
+
rejectionThresholdBps: bigint
|
|
517
|
+
nextProposalId: bigint
|
|
518
|
+
votingEnabled: boolean
|
|
519
|
+
liveProposalsCount: number
|
|
520
|
+
maxConcurrentLiveProposals: number
|
|
521
|
+
reserved: number[]
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
export interface InitializeVaultParams {
|
|
525
|
+
/** Payer of the transaction (will also be the initial manager) */
|
|
526
|
+
payer: PublicKey
|
|
527
|
+
/** Underlying mint used by vault-level price validation */
|
|
528
|
+
mint: PublicKey
|
|
529
|
+
/** Manager of the vault (can be different from payer) */
|
|
530
|
+
manager: PublicKey
|
|
531
|
+
/** 8-byte seed ID for the vault PDA */
|
|
532
|
+
seedId: SeedId
|
|
533
|
+
/** Fee treasury account */
|
|
534
|
+
feeTreasury: PublicKey
|
|
535
|
+
/** Fee treasury in basis points */
|
|
536
|
+
normalWithdrawalFeeBps: number
|
|
537
|
+
/** Annualized management fee in basis points (1e6 precision) */
|
|
538
|
+
managementFeeBps: bigint
|
|
539
|
+
/** Percentage of vault assets to keep as reserves in basis points (10000 = 100%) */
|
|
540
|
+
reservesShareBp: number
|
|
541
|
+
/** Additional fee charged on fast withdrawals in basis points */
|
|
542
|
+
fastWithdrawalCutBp?: number
|
|
543
|
+
/** Initial token entries for the vault */
|
|
544
|
+
tokenEntries: TokenEntryInput[]
|
|
545
|
+
/** Max LP token supply */
|
|
546
|
+
maxLpSupply: bigint
|
|
547
|
+
/** Initial LP amount to mint */
|
|
548
|
+
initialLpAmount: bigint
|
|
549
|
+
/** LP token decimals */
|
|
550
|
+
lpDecimals: number
|
|
551
|
+
/** Deprecated: ignored by the vaults program */
|
|
552
|
+
vaultType?: VaultType
|
|
553
|
+
/** Role membership lists */
|
|
554
|
+
roles: VaultRoles
|
|
555
|
+
/** Proposal voting configuration (optional) */
|
|
556
|
+
proposalVoteConfig?: ProposalVoteConfig
|
|
557
|
+
/** Address lookup table */
|
|
558
|
+
addressLookupTable: PublicKey
|
|
559
|
+
/** Squads program ID */
|
|
560
|
+
squadsProgram: PublicKey
|
|
561
|
+
/** Squads program config PDA (for creation fee) */
|
|
562
|
+
squadsProgramConfig: PublicKey
|
|
563
|
+
/** Squads treasury (receives creation fee) */
|
|
564
|
+
squadsTreasury: PublicKey
|
|
565
|
+
/** Squads settings account - derived as PDA("smart_account", "settings", index) */
|
|
566
|
+
squadsSettings: PublicKey
|
|
567
|
+
/** Squads vault account - derived as PDA("smart_account", settings_key, "smart_account", 0) */
|
|
568
|
+
squadsVault: PublicKey
|
|
569
|
+
/** Token program (defaults to Token) */
|
|
570
|
+
tokenProgram?: PublicKey
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
// ============================================================================
|
|
574
|
+
// Price Management Types
|
|
575
|
+
// ============================================================================
|
|
576
|
+
|
|
577
|
+
/** Price type enum (matches on-chain PriceType) */
|
|
578
|
+
export type PriceTypeParam =
|
|
579
|
+
| { pyth: Record<string, never> }
|
|
580
|
+
| { pythInverse: Record<string, never> }
|
|
581
|
+
| { splStakePool: Record<string, never> }
|
|
582
|
+
| { one: Record<string, never> }
|
|
583
|
+
| { pt: Record<string, never> }
|
|
584
|
+
| { yt: Record<string, never> }
|
|
585
|
+
| { solstice: Record<string, never> }
|
|
586
|
+
| { reflect: Record<string, never> }
|
|
587
|
+
| { fragmetric: Record<string, never> }
|
|
588
|
+
| { fragmetricSupportedAsset: Record<string, never> }
|
|
589
|
+
| { jupiterLend: Record<string, never> }
|
|
590
|
+
| { chainlink: Record<string, never> }
|
|
591
|
+
| { ore: Record<string, never> }
|
|
592
|
+
| { hyloLpToken: Record<string, never> }
|
|
593
|
+
| { meteora: Record<string, never> }
|
|
594
|
+
| { kaminoVault: Record<string, never> }
|
|
595
|
+
|
|
596
|
+
/** Action for managing price entries in ExponentPrices account */
|
|
597
|
+
export type UpdatePriceActionParam =
|
|
598
|
+
| {
|
|
599
|
+
addPrice: {
|
|
600
|
+
priceType: PriceTypeParam
|
|
601
|
+
priceMint: PublicKey
|
|
602
|
+
underlyingMint: PublicKey
|
|
603
|
+
interfaceAccounts?: PublicKey[]
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
| { removePrice: { priceId: bigint; priceInterfaceAccounts?: PublicKey } }
|
|
607
|
+
| { updatePrice: { priceId: bigint; priceType: PriceTypeParam; priceInterfaceAccounts?: PublicKey } }
|
|
608
|
+
| { addManager: { manager: PublicKey } }
|
|
609
|
+
| { removeManager: { manager: PublicKey } }
|
|
610
|
+
| {
|
|
611
|
+
addPtPrice: {
|
|
612
|
+
priceMint: PublicKey
|
|
613
|
+
underlyingMint: PublicKey
|
|
614
|
+
interfaceAccounts?: PublicKey[]
|
|
615
|
+
impliedApyBps: number
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
| {
|
|
619
|
+
addYtPrice: {
|
|
620
|
+
priceMint: PublicKey
|
|
621
|
+
underlyingMint: PublicKey
|
|
622
|
+
interfaceAccounts?: PublicKey[]
|
|
623
|
+
impliedApyBps: number
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
export interface InitializePricesParams {
|
|
628
|
+
/** Manager of the vault (must sign, pays for account creation) */
|
|
629
|
+
manager: PublicKey
|
|
630
|
+
/** Optional override for the exponent_vaults program ID */
|
|
631
|
+
programId?: PublicKey
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
export interface ManagePricesParams {
|
|
635
|
+
/** Manager of the vault (must sign, pays for reallocation) */
|
|
636
|
+
manager: PublicKey
|
|
637
|
+
/** List of price actions to execute */
|
|
638
|
+
actions: UpdatePriceActionParam[]
|
|
639
|
+
/** Optional override for the exponent_vaults program ID */
|
|
640
|
+
programId?: PublicKey
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
export interface AddPolicyParams {
|
|
644
|
+
/** Payer for the transaction */
|
|
645
|
+
payer: PublicKey
|
|
646
|
+
/** Policy configuration to add */
|
|
647
|
+
policyConfig: PolicyConfig
|
|
648
|
+
/** Squads program ID */
|
|
649
|
+
squadsProgram: PublicKey
|
|
650
|
+
/** Next policy seed (get from settings.nextPolicySeed) */
|
|
651
|
+
nextPolicySeed: bigint
|
|
652
|
+
/** Next transaction index (get from settings.transactionIndex + 1) */
|
|
653
|
+
nextTransactionIndex: bigint
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
export interface RemovePolicyParams {
|
|
657
|
+
/** Payer for the transaction */
|
|
658
|
+
payer: PublicKey
|
|
659
|
+
/** Manager of the vault (must sign) */
|
|
660
|
+
manager: PublicKey
|
|
661
|
+
/** Policy seed to remove */
|
|
662
|
+
policySeed: bigint
|
|
663
|
+
/** Squads program ID */
|
|
664
|
+
squadsProgram: PublicKey
|
|
665
|
+
/** Next transaction index (get from settings.transactionIndex + 1) */
|
|
666
|
+
nextTransactionIndex: bigint
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
export interface UpdatePolicyParams {
|
|
670
|
+
payer: PublicKey
|
|
671
|
+
manager: PublicKey
|
|
672
|
+
policyConfig: PolicyConfig
|
|
673
|
+
policySeed: bigint
|
|
674
|
+
squadsProgram: PublicKey
|
|
675
|
+
nextTransactionIndex: bigint
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
export interface WrapperManageVaultSettingsParams {
|
|
679
|
+
manager: PublicKey
|
|
680
|
+
actions: exponentVaults.VaultSettingsAction[]
|
|
681
|
+
remainingAccounts?: AccountMeta[]
|
|
682
|
+
exponentPrices?: PublicKey
|
|
683
|
+
systemProgram?: PublicKey
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
export interface WrapperManagerUpdatePositionParams {
|
|
687
|
+
manager: PublicKey
|
|
688
|
+
update: exponentVaults.PositionUpdate
|
|
689
|
+
remainingAccounts?: AccountMeta[]
|
|
690
|
+
exponentPrices?: PublicKey
|
|
691
|
+
systemProgram?: PublicKey
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
export type WrapperAddPolicyParams = AddPolicyParams
|
|
695
|
+
|
|
696
|
+
export type WrapperRemovePolicyParams = RemovePolicyParams
|
|
697
|
+
|
|
698
|
+
export type WrapperUpdatePolicyParams = UpdatePolicyParams
|
|
699
|
+
|
|
700
|
+
export interface CancelWithdrawalParams {
|
|
701
|
+
owner: PublicKey
|
|
702
|
+
withdrawalAccount: PublicKey
|
|
703
|
+
tokenLpDst?: PublicKey
|
|
704
|
+
tokenProgram?: PublicKey
|
|
705
|
+
tokenLpEscrow?: PublicKey
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
export interface CollectManagementFeeParams {
|
|
709
|
+
manager: PublicKey
|
|
710
|
+
mintLp?: PublicKey
|
|
711
|
+
feeTreasury?: PublicKey
|
|
712
|
+
tokenProgram?: PublicKey
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
export class ExponentVault {
|
|
716
|
+
public state: ExponentVaultAccountType
|
|
717
|
+
public readonly selfAddress: PublicKey
|
|
718
|
+
public readonly env: Environment
|
|
719
|
+
public connection: Connection
|
|
720
|
+
public readonly programId: PublicKey
|
|
721
|
+
public readonly fetcher: ExponentVaultsFetcher
|
|
722
|
+
public pda: ExponentVaultsPDA
|
|
723
|
+
public aumCalculator: AumCalculator
|
|
724
|
+
private clmmTicksMap: Map<string, PublicKey> = new Map()
|
|
725
|
+
static squadsVaultTxnResolver = new SquadsVaultTxnResolver()
|
|
726
|
+
|
|
727
|
+
constructor(params: {
|
|
728
|
+
state: ExponentVaultAccountType
|
|
729
|
+
address: PublicKey
|
|
730
|
+
env?: Environment
|
|
731
|
+
connection: Connection
|
|
732
|
+
programId?: PublicKey
|
|
733
|
+
}) {
|
|
734
|
+
this.state = params.state
|
|
735
|
+
this.selfAddress = params.address
|
|
736
|
+
this.env = params.env ?? LOCAL_ENV
|
|
737
|
+
this.connection = params.connection
|
|
738
|
+
this.programId = params.programId ?? this.env.exponentVaultsProgramId ?? new PublicKey(EXPONENT_VAULTS_PROGRAM_ID)
|
|
739
|
+
this.fetcher = new ExponentVaultsFetcher(this.connection, this.programId)
|
|
740
|
+
this.pda = new ExponentVaultsPDA(this.programId)
|
|
741
|
+
this.aumCalculator = new AumCalculator(this.state, this.connection, this.env)
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
static async load(params: { env?: Environment; connection: Connection; address: PublicKey }) {
|
|
745
|
+
const env = params.env ?? LOCAL_ENV
|
|
746
|
+
const fetcher = new ExponentVaultsFetcher(
|
|
747
|
+
params.connection,
|
|
748
|
+
env.exponentVaultsProgramId ?? EXPONENT_VAULTS_PROGRAM_ID,
|
|
749
|
+
)
|
|
750
|
+
const state = await fetcher.fetchVaultDeserialized(params.address)
|
|
751
|
+
const vault = new ExponentVault({
|
|
752
|
+
state,
|
|
753
|
+
address: params.address,
|
|
754
|
+
env,
|
|
755
|
+
connection: params.connection,
|
|
756
|
+
programId: fetcher.programId,
|
|
757
|
+
})
|
|
758
|
+
await vault.populateClmmTicksCache(params.connection)
|
|
759
|
+
return vault
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
static async loadAll(params: { env?: Environment; connection: Connection }): Promise<ExponentVault[]> {
|
|
763
|
+
const env = params.env ?? LOCAL_ENV
|
|
764
|
+
const fetcher = new ExponentVaultsFetcher(
|
|
765
|
+
params.connection,
|
|
766
|
+
env.exponentVaultsProgramId ?? EXPONENT_VAULTS_PROGRAM_ID,
|
|
767
|
+
)
|
|
768
|
+
const vaults = await fetcher.fetchAllVaultsDeserialized()
|
|
769
|
+
const results = vaults.map(
|
|
770
|
+
({ publicKey, account }) =>
|
|
771
|
+
new ExponentVault({
|
|
772
|
+
state: account,
|
|
773
|
+
address: publicKey,
|
|
774
|
+
env,
|
|
775
|
+
connection: params.connection,
|
|
776
|
+
programId: fetcher.programId,
|
|
777
|
+
}),
|
|
778
|
+
)
|
|
779
|
+
await Promise.all(results.map((v) => v.populateClmmTicksCache(params.connection)))
|
|
780
|
+
return results
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
async reload(connection: Connection = this.connection) {
|
|
784
|
+
const refreshed = await ExponentVault.load({ env: this.env, connection, address: this.selfAddress })
|
|
785
|
+
this.state = refreshed.state
|
|
786
|
+
this.clmmTicksMap = refreshed.clmmTicksMap
|
|
787
|
+
this.connection = connection
|
|
788
|
+
this.aumCalculator = new AumCalculator(this.state, this.connection, this.env)
|
|
789
|
+
return refreshed
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
private async populateClmmTicksCache(connection: Connection): Promise<void> {
|
|
793
|
+
this.clmmTicksMap.clear()
|
|
794
|
+
const marketKeys: PublicKey[] = []
|
|
795
|
+
for (const pos of this.state.strategyPositions) {
|
|
796
|
+
if ("clmmPosition" in pos && pos.clmmPosition && typeof pos.clmmPosition === "object") {
|
|
797
|
+
const entry = (pos as { clmmPosition: { 0: ClmmPositionEntry } }).clmmPosition[0]
|
|
798
|
+
const key = entry.market.toBase58()
|
|
799
|
+
if (!this.clmmTicksMap.has(key) && !marketKeys.some((k) => k.equals(entry.market))) {
|
|
800
|
+
marketKeys.push(entry.market)
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
if (marketKeys.length === 0) return
|
|
805
|
+
const markets = await fetchAllMaybeMarketThreeAccounts(connection, marketKeys)
|
|
806
|
+
for (const market of markets) {
|
|
807
|
+
if (market) {
|
|
808
|
+
this.clmmTicksMap.set(market.address.toBase58(), market.data.ticks)
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Derive the PDA for a vault using its 8-byte seed identifier.
|
|
815
|
+
*/
|
|
816
|
+
static deriveVaultAddress(
|
|
817
|
+
seedId: Uint8Array | number[],
|
|
818
|
+
programId: PublicKey = new PublicKey(EXPONENT_VAULTS_PROGRAM_ID),
|
|
819
|
+
) {
|
|
820
|
+
if (seedId.length !== 8) {
|
|
821
|
+
throw new Error(`seedId must contain 8 bytes, received ${seedId.length}`)
|
|
822
|
+
}
|
|
823
|
+
const seedBuffer = Buffer.from(seedId)
|
|
824
|
+
return PublicKey.findProgramAddressSync([VAULT_SEED, seedBuffer], programId)
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
get mintLp() {
|
|
828
|
+
return this.state.mintLp
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
get tokenLpEscrow() {
|
|
832
|
+
return this.state.tokenLpEscrow
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
get eventAuthority() {
|
|
836
|
+
return emitEventAuthority(this.programId)
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
private getTokenEntryOrThrow(mint: PublicKey): TokenEntry {
|
|
840
|
+
const entry = this.state.tokenEntries.find((e) => e.mint.equals(mint))
|
|
841
|
+
if (!entry) {
|
|
842
|
+
throw new Error(`Token entry not found for mint ${mint.toBase58()}`)
|
|
843
|
+
}
|
|
844
|
+
return entry
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
async fetchWithdrawalAccount(address: PublicKey) {
|
|
848
|
+
return this.fetcher.fetchWithdrawalAccountDeserialized(address)
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
async fetchAllActionProposals() {
|
|
852
|
+
const accounts = await this.connection.getProgramAccounts(this.programId, {
|
|
853
|
+
filters: [
|
|
854
|
+
{ memcmp: { offset: 0, bytes: bs58.encode(Buffer.from([144, 192, 194, 210, 241, 173, 240, 41])) } },
|
|
855
|
+
{ memcmp: { offset: 8, bytes: this.selfAddress.toBase58() } },
|
|
856
|
+
],
|
|
857
|
+
})
|
|
858
|
+
return accounts.map(({ pubkey, account }) => ({
|
|
859
|
+
address: pubkey,
|
|
860
|
+
data: exponentVaults.deserializeActionProposalAccount(account.data),
|
|
861
|
+
}))
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
async fetchLpTokenSupply() {
|
|
865
|
+
const { supply } = await getMint(this.connection, this.state.mintLp)
|
|
866
|
+
return supply
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/** Set DEBUG_VAULT_AUM=1 to log AUM remaining accounts (token entries + strategy positions) for debugging */
|
|
870
|
+
private static get debugAum(): boolean {
|
|
871
|
+
return typeof process !== "undefined" && process.env?.DEBUG_VAULT_AUM === "1"
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
private strategyPositionAccountMetas(): AccountMeta[] {
|
|
875
|
+
const metas: AccountMeta[] = []
|
|
876
|
+
|
|
877
|
+
for (const pos of this.state.strategyPositions) {
|
|
878
|
+
if ("orderbook" in pos && pos.orderbook && typeof pos.orderbook === "object") {
|
|
879
|
+
const entry: OrderbookEntry = pos["orderbook"][0]
|
|
880
|
+
metas.push({
|
|
881
|
+
pubkey: entry.orderbook,
|
|
882
|
+
isSigner: false,
|
|
883
|
+
isWritable: false,
|
|
884
|
+
})
|
|
885
|
+
if (ExponentVault.debugAum) {
|
|
886
|
+
console.log("[VAULT_AUM] strategyPosition: Orderbook", entry.orderbook.toBase58())
|
|
887
|
+
}
|
|
888
|
+
} else if ("tokenAccount" in pos && pos.tokenAccount && typeof pos.tokenAccount === "object") {
|
|
889
|
+
const entry: TokenAccountEntry = pos["tokenAccount"][0]
|
|
890
|
+
for (const balance of entry.balances) {
|
|
891
|
+
metas.push({
|
|
892
|
+
pubkey: balance.tokenAccount,
|
|
893
|
+
isSigner: false,
|
|
894
|
+
isWritable: false,
|
|
895
|
+
})
|
|
896
|
+
if (ExponentVault.debugAum) {
|
|
897
|
+
console.log("[VAULT_AUM] strategyPosition: TokenAccount balance", balance.tokenAccount.toBase58())
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
} else if ("obligation" in pos && pos.obligation && typeof pos.obligation === "object") {
|
|
901
|
+
const inner = pos["obligation"][0] as Record<string, unknown> | undefined
|
|
902
|
+
const kaminoVariant = inner && "kaminoObligation" in inner ? (inner.kaminoObligation as unknown) : inner
|
|
903
|
+
const entry = Array.isArray(kaminoVariant)
|
|
904
|
+
? (kaminoVariant[0] as
|
|
905
|
+
| {
|
|
906
|
+
obligation?: PublicKey
|
|
907
|
+
reservePriceMappings?: Array<{ reserve: PublicKey }>
|
|
908
|
+
}
|
|
909
|
+
| undefined)
|
|
910
|
+
: kaminoVariant && typeof kaminoVariant === "object" && "0" in (kaminoVariant as Record<string, unknown>)
|
|
911
|
+
? ((
|
|
912
|
+
kaminoVariant as {
|
|
913
|
+
0?: {
|
|
914
|
+
obligation?: PublicKey
|
|
915
|
+
reservePriceMappings?: Array<{ reserve: PublicKey }>
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
)[0] ?? undefined)
|
|
919
|
+
: (kaminoVariant as
|
|
920
|
+
| {
|
|
921
|
+
obligation?: PublicKey
|
|
922
|
+
reservePriceMappings?: Array<{ reserve: PublicKey }>
|
|
923
|
+
}
|
|
924
|
+
| undefined)
|
|
925
|
+
if (entry?.obligation instanceof PublicKey) {
|
|
926
|
+
metas.push({
|
|
927
|
+
pubkey: entry.obligation,
|
|
928
|
+
isSigner: false,
|
|
929
|
+
isWritable: false,
|
|
930
|
+
})
|
|
931
|
+
for (const mapping of entry.reservePriceMappings ?? []) {
|
|
932
|
+
metas.push({
|
|
933
|
+
pubkey: mapping.reserve,
|
|
934
|
+
isSigner: false,
|
|
935
|
+
isWritable: false,
|
|
936
|
+
})
|
|
937
|
+
}
|
|
938
|
+
if (ExponentVault.debugAum) {
|
|
939
|
+
console.log("[VAULT_AUM] strategyPosition: Obligation", entry.obligation.toBase58())
|
|
940
|
+
for (const mapping of entry.reservePriceMappings ?? []) {
|
|
941
|
+
console.log("[VAULT_AUM] strategyPosition: Kamino reserve", mapping.reserve.toBase58())
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
} else if ("yieldPosition" in pos && pos.yieldPosition && typeof pos.yieldPosition === "object") {
|
|
946
|
+
const entry = pos["yieldPosition"][0] as { yieldPosition: PublicKey; vault: PublicKey }
|
|
947
|
+
metas.push({
|
|
948
|
+
pubkey: entry.yieldPosition,
|
|
949
|
+
isSigner: false,
|
|
950
|
+
isWritable: false,
|
|
951
|
+
})
|
|
952
|
+
metas.push({
|
|
953
|
+
pubkey: entry.vault,
|
|
954
|
+
isSigner: false,
|
|
955
|
+
isWritable: false,
|
|
956
|
+
})
|
|
957
|
+
if (ExponentVault.debugAum) {
|
|
958
|
+
console.log(
|
|
959
|
+
"[VAULT_AUM] strategyPosition: YieldPosition",
|
|
960
|
+
entry.yieldPosition.toBase58(),
|
|
961
|
+
entry.vault.toBase58(),
|
|
962
|
+
"(must exist and have exponent_core YieldTokenPosition discriminator)",
|
|
963
|
+
)
|
|
964
|
+
}
|
|
965
|
+
} else if ("clmmPosition" in pos && pos.clmmPosition && typeof pos.clmmPosition === "object") {
|
|
966
|
+
const entry = (pos as { clmmPosition: { 0: ClmmPositionEntry } }).clmmPosition[0]
|
|
967
|
+
metas.push({
|
|
968
|
+
pubkey: entry.lpPosition,
|
|
969
|
+
isSigner: false,
|
|
970
|
+
isWritable: false,
|
|
971
|
+
})
|
|
972
|
+
metas.push({
|
|
973
|
+
pubkey: entry.market,
|
|
974
|
+
isSigner: false,
|
|
975
|
+
isWritable: false,
|
|
976
|
+
})
|
|
977
|
+
const ticksKey = this.clmmTicksMap.get(entry.market.toBase58())
|
|
978
|
+
if (ticksKey) {
|
|
979
|
+
metas.push({
|
|
980
|
+
pubkey: ticksKey,
|
|
981
|
+
isSigner: false,
|
|
982
|
+
isWritable: false,
|
|
983
|
+
})
|
|
984
|
+
}
|
|
985
|
+
if (ExponentVault.debugAum) {
|
|
986
|
+
console.log(
|
|
987
|
+
"[VAULT_AUM] strategyPosition: ClmmPosition",
|
|
988
|
+
entry.lpPosition.toBase58(),
|
|
989
|
+
entry.market.toBase58(),
|
|
990
|
+
ticksKey ? ticksKey.toBase58() : "(ticks not cached)",
|
|
991
|
+
)
|
|
992
|
+
}
|
|
993
|
+
} else if ("loopscaleStrategy" in pos && pos.loopscaleStrategy && typeof pos.loopscaleStrategy === "object") {
|
|
994
|
+
const entry = (pos as any).loopscaleStrategy[0]
|
|
995
|
+
if (entry?.strategy instanceof PublicKey) {
|
|
996
|
+
metas.push({
|
|
997
|
+
pubkey: entry.strategy,
|
|
998
|
+
isSigner: false,
|
|
999
|
+
isWritable: false,
|
|
1000
|
+
})
|
|
1001
|
+
if (ExponentVault.debugAum) {
|
|
1002
|
+
console.log("[VAULT_AUM] strategyPosition: LoopscaleStrategy", entry.strategy.toBase58())
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
} else if ("loopscaleLoan" in pos && pos.loopscaleLoan && typeof pos.loopscaleLoan === "object") {
|
|
1006
|
+
const entry = (pos as any).loopscaleLoan[0]
|
|
1007
|
+
if (entry?.loan instanceof PublicKey) {
|
|
1008
|
+
metas.push({
|
|
1009
|
+
pubkey: entry.loan,
|
|
1010
|
+
isSigner: false,
|
|
1011
|
+
isWritable: false,
|
|
1012
|
+
})
|
|
1013
|
+
if (ExponentVault.debugAum) {
|
|
1014
|
+
console.log("[VAULT_AUM] strategyPosition: LoopscaleLoan", entry.loan.toBase58())
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
} else if (ExponentVault.debugAum) {
|
|
1018
|
+
console.log("[VAULT_AUM] strategyPosition: UNMATCHED", JSON.stringify(Object.keys(pos)))
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
return metas
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
private tokenEntryAccountMetas(): AccountMeta[] {
|
|
1026
|
+
const metas = this.state.tokenEntries.map((entry) => ({
|
|
1027
|
+
pubkey: entry.tokenSquadsAccount,
|
|
1028
|
+
isSigner: false,
|
|
1029
|
+
isWritable: false,
|
|
1030
|
+
}))
|
|
1031
|
+
if (ExponentVault.debugAum) {
|
|
1032
|
+
metas.forEach((m, i) => {
|
|
1033
|
+
console.log(
|
|
1034
|
+
`[VAULT_AUM] tokenEntry[${i}]:`,
|
|
1035
|
+
m.pubkey.toBase58(),
|
|
1036
|
+
"(vault ATA for mint, must be SPL token account)",
|
|
1037
|
+
)
|
|
1038
|
+
})
|
|
1039
|
+
}
|
|
1040
|
+
return metas
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
private aumRemainingAccounts(): AccountMeta[] {
|
|
1044
|
+
return [...this.tokenEntryAccountMetas(), ...this.strategyPositionAccountMetas()]
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
ixUpdatePrice({
|
|
1048
|
+
priceInterfaceAccounts,
|
|
1049
|
+
pythPriceFeedId,
|
|
1050
|
+
remainingAccounts = [],
|
|
1051
|
+
priceId,
|
|
1052
|
+
}: UpdatePriceParams): TransactionInstruction {
|
|
1053
|
+
const [exponentPrices] = this.pda.exponentPrices()
|
|
1054
|
+
if (!priceInterfaceAccounts) {
|
|
1055
|
+
throw new Error("ixUpdatePrice requires priceInterfaceAccounts")
|
|
1056
|
+
}
|
|
1057
|
+
const updateRemainingAccounts = [
|
|
1058
|
+
{ pubkey: priceInterfaceAccounts, isSigner: false, isWritable: false },
|
|
1059
|
+
...remainingAccounts.map((pubkey) => ({ pubkey, isSigner: false, isWritable: false })),
|
|
1060
|
+
...(pythPriceFeedId ? [{ pubkey: pythPriceFeedId, isSigner: false, isWritable: false }] : []),
|
|
1061
|
+
]
|
|
1062
|
+
const ix = exponentVaults.createUpdatePriceInstruction(
|
|
1063
|
+
{ exponentPrices },
|
|
1064
|
+
{ updates: [{ priceId: BigInt(priceId), interfaceAccountsIndex: 0 }] },
|
|
1065
|
+
)
|
|
1066
|
+
ix.keys.push(...updateRemainingAccounts)
|
|
1067
|
+
return ix
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
async ixsDepositLiquidity({
|
|
1071
|
+
depositor,
|
|
1072
|
+
mint,
|
|
1073
|
+
tokenAmountIn,
|
|
1074
|
+
minLpOut,
|
|
1075
|
+
tokenSrc,
|
|
1076
|
+
entryTokenVault,
|
|
1077
|
+
tokenLpDst,
|
|
1078
|
+
tokenProgram = TOKEN_PROGRAM_ID,
|
|
1079
|
+
extraRemainingAccounts = [],
|
|
1080
|
+
useLegacyTokenAccounts = false,
|
|
1081
|
+
}: DepositLiquidityParams): Promise<TransactionInstruction[]> {
|
|
1082
|
+
const entry = this.getTokenEntryOrThrow(mint)
|
|
1083
|
+
const source = tokenSrc ?? defaultTokenAccount(mint, depositor, tokenProgram)
|
|
1084
|
+
const vault = entryTokenVault ?? entry.tokenSquadsAccount
|
|
1085
|
+
const lpDst = tokenLpDst ?? defaultTokenAccount(this.state.mintLp, depositor, tokenProgram)
|
|
1086
|
+
const exponentPrices = this.pda.exponentPrices()[0]
|
|
1087
|
+
|
|
1088
|
+
const preIxs: TransactionInstruction[] = []
|
|
1089
|
+
|
|
1090
|
+
// If depositing WSOL, wrap native SOL as needed
|
|
1091
|
+
if (mint.equals(NATIVE_MINT)) {
|
|
1092
|
+
const wsolAta = getAssociatedTokenAddressSync(NATIVE_MINT, depositor, false, tokenProgram)
|
|
1093
|
+
// Create WSOL ATA (idempotent — no-op if already exists)
|
|
1094
|
+
preIxs.push(
|
|
1095
|
+
createAssociatedTokenAccountIdempotentInstruction(depositor, wsolAta, depositor, NATIVE_MINT, tokenProgram),
|
|
1096
|
+
)
|
|
1097
|
+
|
|
1098
|
+
// Check existing WSOL balance
|
|
1099
|
+
let existingWsolBalance = BigInt(0)
|
|
1100
|
+
try {
|
|
1101
|
+
const wsolAccount = await getAccount(this.connection, wsolAta, "confirmed", tokenProgram)
|
|
1102
|
+
existingWsolBalance = wsolAccount.amount
|
|
1103
|
+
} catch {
|
|
1104
|
+
// Account doesn't exist yet — balance is 0
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
const totalNeeded = toBigInt(tokenAmountIn)
|
|
1108
|
+
if (totalNeeded > existingWsolBalance) {
|
|
1109
|
+
const wrapAmount = totalNeeded - existingWsolBalance
|
|
1110
|
+
// Transfer native SOL to the WSOL ATA
|
|
1111
|
+
preIxs.push(
|
|
1112
|
+
SystemProgram.transfer({
|
|
1113
|
+
fromPubkey: depositor,
|
|
1114
|
+
toPubkey: wsolAta,
|
|
1115
|
+
lamports: wrapAmount,
|
|
1116
|
+
}),
|
|
1117
|
+
)
|
|
1118
|
+
// Sync the native balance so the token account reflects the deposited SOL
|
|
1119
|
+
preIxs.push(createSyncNativeInstruction(wsolAta, tokenProgram))
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
const depositorLpAta = getAssociatedTokenAddressSync(this.state.mintLp, depositor)
|
|
1124
|
+
const createLpAtaIx = createAssociatedTokenAccountIdempotentInstruction(
|
|
1125
|
+
depositor,
|
|
1126
|
+
depositorLpAta,
|
|
1127
|
+
depositor,
|
|
1128
|
+
this.state.mintLp,
|
|
1129
|
+
)
|
|
1130
|
+
|
|
1131
|
+
const depositIx = exponentVaults.createDepositLiquidityInstruction(
|
|
1132
|
+
{
|
|
1133
|
+
depositor,
|
|
1134
|
+
vault: this.selfAddress,
|
|
1135
|
+
exponentPrices,
|
|
1136
|
+
mint,
|
|
1137
|
+
tokenSrc: source,
|
|
1138
|
+
entryTokenVault: vault,
|
|
1139
|
+
tokenLpDst: lpDst,
|
|
1140
|
+
mintLp: this.state.mintLp,
|
|
1141
|
+
tokenProgram,
|
|
1142
|
+
tokenProgramLp: TOKEN_PROGRAM_ID,
|
|
1143
|
+
eventAuthority: this.eventAuthority,
|
|
1144
|
+
program: this.programId,
|
|
1145
|
+
},
|
|
1146
|
+
{ tokenAmountIn: toBigInt(tokenAmountIn), minLpOut: toBigInt(minLpOut) },
|
|
1147
|
+
)
|
|
1148
|
+
|
|
1149
|
+
const remainingAccounts = [...this.aumRemainingAccounts(), ...extraRemainingAccounts]
|
|
1150
|
+
depositIx.keys.push(...remainingAccounts)
|
|
1151
|
+
|
|
1152
|
+
if (ExponentVault.debugAum) {
|
|
1153
|
+
console.log("[VAULT_AUM] ixsDepositLiquidity: total remaining_accounts =", remainingAccounts.length)
|
|
1154
|
+
remainingAccounts.forEach((acc, i) => {
|
|
1155
|
+
console.log(` [${i}] ${acc.pubkey.toBase58()} writable=${acc.isWritable} signer=${acc.isSigner}`)
|
|
1156
|
+
})
|
|
1157
|
+
console.log(
|
|
1158
|
+
"[VAULT_AUM] DepositLiquidity expects: token_entry ATAs (for AUM) + strategy accounts (orderbook, yieldPosition). AccountDiscriminatorNotFound (0xbb9) = wrong account type at one of these.",
|
|
1159
|
+
)
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
return [...preIxs, createLpAtaIx, depositIx]
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
ixQueueWithdrawal({
|
|
1166
|
+
depositor,
|
|
1167
|
+
lpAmount,
|
|
1168
|
+
tokenLpSrc,
|
|
1169
|
+
tokenProgram = TOKEN_PROGRAM_ID,
|
|
1170
|
+
systemProgram = SystemProgram.programId,
|
|
1171
|
+
tokenLpEscrow = this.state.tokenLpEscrow,
|
|
1172
|
+
}: QueueWithdrawalParams): { ix: TransactionInstruction; withdrawalKeypair: Keypair } {
|
|
1173
|
+
const withdrawalKeypair = Keypair.generate()
|
|
1174
|
+
const lpSrc = tokenLpSrc ?? defaultTokenAccount(this.state.mintLp, depositor, tokenProgram)
|
|
1175
|
+
|
|
1176
|
+
const ix = exponentVaults.createQueueWithdrawalInstruction(
|
|
1177
|
+
{
|
|
1178
|
+
depositor,
|
|
1179
|
+
vault: this.selfAddress,
|
|
1180
|
+
withdrawalAccount: withdrawalKeypair.publicKey,
|
|
1181
|
+
tokenLpSrc: lpSrc,
|
|
1182
|
+
tokenLpEscrow,
|
|
1183
|
+
tokenProgram,
|
|
1184
|
+
systemProgram,
|
|
1185
|
+
},
|
|
1186
|
+
{
|
|
1187
|
+
lpAmount: toBigInt(lpAmount),
|
|
1188
|
+
},
|
|
1189
|
+
)
|
|
1190
|
+
ix.keys.push(...this.aumRemainingAccounts())
|
|
1191
|
+
return { ix, withdrawalKeypair }
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
ixExecuteWithdrawal({
|
|
1195
|
+
owner,
|
|
1196
|
+
withdrawalAccount,
|
|
1197
|
+
tokenAccountPairs,
|
|
1198
|
+
tokenProgram = TOKEN_PROGRAM_ID,
|
|
1199
|
+
token2022Program = TOKEN_2022_PROGRAM_ID,
|
|
1200
|
+
tokenLpEscrow = this.state.tokenLpEscrow,
|
|
1201
|
+
mintLp = this.state.mintLp,
|
|
1202
|
+
}: ExecuteWithdrawalParams): TransactionInstruction {
|
|
1203
|
+
// Flatten token account pairs into remaining accounts: [src1, dst1, src2, dst2, ...]
|
|
1204
|
+
const tokenAccountMetas = tokenAccountPairs.flatMap((pair) => [
|
|
1205
|
+
{ pubkey: pair.tokenSrc, isWritable: true, isSigner: false },
|
|
1206
|
+
{ pubkey: pair.tokenDst, isWritable: true, isSigner: false },
|
|
1207
|
+
])
|
|
1208
|
+
|
|
1209
|
+
const tokenLpSrc = defaultTokenAccount(this.state.mintLp, owner, tokenProgram)
|
|
1210
|
+
|
|
1211
|
+
const ix = exponentVaults.createExecuteWithdrawalInstruction(
|
|
1212
|
+
{
|
|
1213
|
+
vault: this.selfAddress,
|
|
1214
|
+
exponentPrices: this.pda.exponentPrices()[0],
|
|
1215
|
+
owner,
|
|
1216
|
+
withdrawalAccount,
|
|
1217
|
+
tokenLpSrc,
|
|
1218
|
+
tokenLpEscrow,
|
|
1219
|
+
mintLp,
|
|
1220
|
+
tokenProgram,
|
|
1221
|
+
eventAuthority: this.eventAuthority,
|
|
1222
|
+
program: this.programId,
|
|
1223
|
+
token2022Program: token2022Program,
|
|
1224
|
+
},
|
|
1225
|
+
{ tokenTransferAccountsUntil: tokenAccountPairs.length * 2 },
|
|
1226
|
+
)
|
|
1227
|
+
ix.keys.push(...tokenAccountMetas, ...this.aumRemainingAccounts())
|
|
1228
|
+
return ix
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
ixExecuteWithdrawalFromReserves({
|
|
1232
|
+
owner,
|
|
1233
|
+
entryIdx,
|
|
1234
|
+
lpAmount,
|
|
1235
|
+
tokenSrc,
|
|
1236
|
+
tokenVaultSrc,
|
|
1237
|
+
tokenDst,
|
|
1238
|
+
tokenLpSrc,
|
|
1239
|
+
squadsProgram,
|
|
1240
|
+
tokenProgram = TOKEN_PROGRAM_ID,
|
|
1241
|
+
token2022Program = TOKEN_2022_PROGRAM_ID,
|
|
1242
|
+
tokenLpEscrow = this.state.tokenLpEscrow,
|
|
1243
|
+
mintLp = this.state.mintLp,
|
|
1244
|
+
}: ExecuteWithdrawalFromReservesParams): TransactionInstruction {
|
|
1245
|
+
const lpSrc = tokenLpSrc ?? defaultTokenAccount(this.state.mintLp, owner, tokenProgram)
|
|
1246
|
+
const squadsPda = new SquadsPDA(squadsProgram)
|
|
1247
|
+
const squadsSettings = this.state.squadsSettings
|
|
1248
|
+
const [squadsPolicy] = squadsPda.policy({
|
|
1249
|
+
settings: squadsSettings,
|
|
1250
|
+
policySeed: 2n, // Policy seed 2 is the vault-authorized transfer policy created at init
|
|
1251
|
+
})
|
|
1252
|
+
|
|
1253
|
+
const ix = exponentVaults.createExecuteWithdrawalFromReservesInstruction(
|
|
1254
|
+
{
|
|
1255
|
+
owner,
|
|
1256
|
+
vault: this.selfAddress,
|
|
1257
|
+
exponentPrices: this.pda.exponentPrices()[0],
|
|
1258
|
+
tokenLpSrc: lpSrc,
|
|
1259
|
+
tokenLpEscrow,
|
|
1260
|
+
tokenVaultSrc,
|
|
1261
|
+
mintLp,
|
|
1262
|
+
tokenSrc,
|
|
1263
|
+
tokenDst,
|
|
1264
|
+
tokenProgram,
|
|
1265
|
+
token2022Program,
|
|
1266
|
+
squadsVault: this.state.squadsVault,
|
|
1267
|
+
squadsPolicy: squadsPolicy,
|
|
1268
|
+
squadsProgram: squadsProgram,
|
|
1269
|
+
},
|
|
1270
|
+
{ entryIdx, lpAmount: toBigInt(lpAmount) },
|
|
1271
|
+
)
|
|
1272
|
+
ix.keys.push(...this.aumRemainingAccounts())
|
|
1273
|
+
return ix
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
ixFillWithdrawal({
|
|
1277
|
+
withdrawalAccount,
|
|
1278
|
+
fills,
|
|
1279
|
+
tokenAccountTriples,
|
|
1280
|
+
mintLp = this.state.mintLp,
|
|
1281
|
+
tokenLpEscrow = this.state.tokenLpEscrow,
|
|
1282
|
+
}: FillWithdrawalParams): TransactionInstruction {
|
|
1283
|
+
const ix = exponentVaults.createFillWithdrawalInstruction(
|
|
1284
|
+
{
|
|
1285
|
+
exponentVaultsProgram: this.programId,
|
|
1286
|
+
squadsVault: this.state.squadsVault,
|
|
1287
|
+
vault: this.selfAddress,
|
|
1288
|
+
exponentPrices: this.pda.exponentPrices()[0],
|
|
1289
|
+
withdrawalAccount,
|
|
1290
|
+
mintLp,
|
|
1291
|
+
tokenLpEscrow,
|
|
1292
|
+
tokenProgramLp: TOKEN_PROGRAM_ID,
|
|
1293
|
+
systemProgram: SystemProgram.programId,
|
|
1294
|
+
},
|
|
1295
|
+
{
|
|
1296
|
+
fills: fills.map((f) => ({
|
|
1297
|
+
tokenEntryIdx: f.tokenEntryIdx,
|
|
1298
|
+
percentOfTotalLpBp: toBigInt(f.percentOfTotalLpBp),
|
|
1299
|
+
})),
|
|
1300
|
+
},
|
|
1301
|
+
)
|
|
1302
|
+
|
|
1303
|
+
// Remaining accounts layout: [aum_accounts..., token_src_0, token_dst_0, token_program_0, ...]
|
|
1304
|
+
const tokenTransferMetas = tokenAccountTriples.flatMap((triple) => [
|
|
1305
|
+
{ pubkey: triple.tokenSrc, isWritable: true, isSigner: false },
|
|
1306
|
+
{ pubkey: triple.tokenDst, isWritable: true, isSigner: false },
|
|
1307
|
+
{ pubkey: triple.tokenProgram, isWritable: false, isSigner: false },
|
|
1308
|
+
])
|
|
1309
|
+
ix.keys.push(...this.aumRemainingAccounts(), ...tokenTransferMetas)
|
|
1310
|
+
return ix
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
ixWrapperExecuteWithdrawal({
|
|
1314
|
+
owner,
|
|
1315
|
+
withdrawalAccount,
|
|
1316
|
+
tokenAccountPairs,
|
|
1317
|
+
entryIdx,
|
|
1318
|
+
tokenSrc,
|
|
1319
|
+
tokenVaultSrc,
|
|
1320
|
+
tokenDst,
|
|
1321
|
+
squadsProgram,
|
|
1322
|
+
tokenProgram = TOKEN_PROGRAM_ID,
|
|
1323
|
+
token2022Program = TOKEN_2022_PROGRAM_ID,
|
|
1324
|
+
tokenLpEscrow = this.state.tokenLpEscrow,
|
|
1325
|
+
mintLp = this.state.mintLp,
|
|
1326
|
+
}: WrapperExecuteWithdrawalParams): TransactionInstruction {
|
|
1327
|
+
const tokenLpSrc = defaultTokenAccount(this.state.mintLp, owner, tokenProgram)
|
|
1328
|
+
const squadsPda = new SquadsPDA(squadsProgram)
|
|
1329
|
+
const [squadsPolicy] = squadsPda.policy({
|
|
1330
|
+
settings: this.state.squadsSettings,
|
|
1331
|
+
policySeed: 2n,
|
|
1332
|
+
})
|
|
1333
|
+
|
|
1334
|
+
const tokenAccountMetas = tokenAccountPairs.flatMap((pair) => [
|
|
1335
|
+
{ pubkey: pair.tokenSrc, isWritable: true, isSigner: false },
|
|
1336
|
+
{ pubkey: pair.tokenDst, isWritable: true, isSigner: false },
|
|
1337
|
+
])
|
|
1338
|
+
|
|
1339
|
+
const ix = exponentVaults.createWrapperExecuteWithdrawalInstruction(
|
|
1340
|
+
{
|
|
1341
|
+
vault: this.selfAddress,
|
|
1342
|
+
exponentPrices: this.pda.exponentPrices()[0],
|
|
1343
|
+
owner,
|
|
1344
|
+
withdrawalAccount,
|
|
1345
|
+
tokenLpSrc,
|
|
1346
|
+
tokenLpEscrow,
|
|
1347
|
+
mintLp,
|
|
1348
|
+
tokenProgram,
|
|
1349
|
+
token2022Program,
|
|
1350
|
+
systemProgram: SystemProgram.programId,
|
|
1351
|
+
rent: SYSVAR_RENT_PUBKEY,
|
|
1352
|
+
tokenSrc,
|
|
1353
|
+
tokenVaultSrc,
|
|
1354
|
+
tokenDst,
|
|
1355
|
+
squadsVault: this.state.squadsVault,
|
|
1356
|
+
squadsPolicy,
|
|
1357
|
+
squadsProgram,
|
|
1358
|
+
eventAuthority: this.eventAuthority,
|
|
1359
|
+
program: this.programId,
|
|
1360
|
+
},
|
|
1361
|
+
{ tokenTransferAccountsUntil: tokenAccountPairs.length * 2, entryIdx },
|
|
1362
|
+
)
|
|
1363
|
+
ix.keys.push(...tokenAccountMetas, ...this.aumRemainingAccounts())
|
|
1364
|
+
return ix
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
ixCancelWithdrawal({
|
|
1368
|
+
owner,
|
|
1369
|
+
withdrawalAccount,
|
|
1370
|
+
tokenLpDst,
|
|
1371
|
+
tokenProgram = TOKEN_PROGRAM_ID,
|
|
1372
|
+
tokenLpEscrow = this.state.tokenLpEscrow,
|
|
1373
|
+
}: CancelWithdrawalParams) {
|
|
1374
|
+
const lpDst = tokenLpDst ?? defaultTokenAccount(this.state.mintLp, owner, tokenProgram)
|
|
1375
|
+
|
|
1376
|
+
return exponentVaults.createCancelWithdrawalInstruction({
|
|
1377
|
+
owner,
|
|
1378
|
+
vault: this.selfAddress,
|
|
1379
|
+
withdrawalAccount,
|
|
1380
|
+
tokenLpEscrow,
|
|
1381
|
+
tokenLpDst: lpDst,
|
|
1382
|
+
tokenProgram,
|
|
1383
|
+
})
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
// ixCollectManagementFee({
|
|
1387
|
+
// manager,
|
|
1388
|
+
// mintLp = this.state.mintLp,
|
|
1389
|
+
// feeTreasury = this.state.feeTreasury,
|
|
1390
|
+
// tokenProgram = TOKEN_PROGRAM_ID,
|
|
1391
|
+
// }: CollectManagementFeeParams) {
|
|
1392
|
+
// return exponentVaults.createCollectManagementFeeInstruction({
|
|
1393
|
+
// manager,
|
|
1394
|
+
// vault: this.selfAddress,
|
|
1395
|
+
// mintLp,
|
|
1396
|
+
// feeTreasury,
|
|
1397
|
+
// tokenProgram,
|
|
1398
|
+
// })
|
|
1399
|
+
// }
|
|
1400
|
+
|
|
1401
|
+
/**
|
|
1402
|
+
* Create instruction to call wrapper_manage_vault_settings.
|
|
1403
|
+
*/
|
|
1404
|
+
ixWrapperManageVaultSettings({
|
|
1405
|
+
manager,
|
|
1406
|
+
actions,
|
|
1407
|
+
remainingAccounts = [],
|
|
1408
|
+
exponentPrices = this.pda.exponentPrices()[0],
|
|
1409
|
+
systemProgram = SystemProgram.programId,
|
|
1410
|
+
}: WrapperManageVaultSettingsParams): TransactionInstruction {
|
|
1411
|
+
const ix = exponentVaults.createWrapperManageVaultSettingsInstruction(
|
|
1412
|
+
{
|
|
1413
|
+
manager,
|
|
1414
|
+
vault: this.selfAddress,
|
|
1415
|
+
exponentPrices,
|
|
1416
|
+
systemProgram,
|
|
1417
|
+
},
|
|
1418
|
+
{ actions },
|
|
1419
|
+
)
|
|
1420
|
+
ix.keys.push(...remainingAccounts)
|
|
1421
|
+
return ix
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
/**
|
|
1425
|
+
* Create instruction to call wrapper_manager_update_position.
|
|
1426
|
+
*/
|
|
1427
|
+
ixWrapperManagerUpdatePosition({
|
|
1428
|
+
manager,
|
|
1429
|
+
update,
|
|
1430
|
+
remainingAccounts = [],
|
|
1431
|
+
exponentPrices = this.pda.exponentPrices()[0],
|
|
1432
|
+
systemProgram = SystemProgram.programId,
|
|
1433
|
+
}: WrapperManagerUpdatePositionParams): TransactionInstruction {
|
|
1434
|
+
const ix = exponentVaults.createWrapperManagerUpdatePositionInstruction(
|
|
1435
|
+
{
|
|
1436
|
+
manager,
|
|
1437
|
+
vault: this.selfAddress,
|
|
1438
|
+
exponentPrices,
|
|
1439
|
+
systemProgram,
|
|
1440
|
+
},
|
|
1441
|
+
{ update },
|
|
1442
|
+
)
|
|
1443
|
+
ix.keys.push(...remainingAccounts)
|
|
1444
|
+
return ix
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
// ==========================================================================
|
|
1448
|
+
// Policy Management Methods
|
|
1449
|
+
// ==========================================================================
|
|
1450
|
+
|
|
1451
|
+
/**
|
|
1452
|
+
* Create instruction to add a policy to this vault.
|
|
1453
|
+
* Direct policy management requires an empty vault; live vaults must use proposals.
|
|
1454
|
+
*/
|
|
1455
|
+
ixAddPolicy({ payer, policyConfig, squadsProgram, nextPolicySeed, nextTransactionIndex }: AddPolicyParams) {
|
|
1456
|
+
const squadsSettings = this.state.squadsSettings
|
|
1457
|
+
const squadsPda = new SquadsPDA(squadsProgram)
|
|
1458
|
+
|
|
1459
|
+
// Derive Squads PDAs
|
|
1460
|
+
const [squadsSettingsTransaction] = squadsPda.transaction({
|
|
1461
|
+
settings: squadsSettings,
|
|
1462
|
+
transactionIndex: nextTransactionIndex,
|
|
1463
|
+
})
|
|
1464
|
+
const [squadsProposal] = squadsPda.proposal({
|
|
1465
|
+
settings: squadsSettings,
|
|
1466
|
+
transactionIndex: nextTransactionIndex,
|
|
1467
|
+
})
|
|
1468
|
+
const [squadsPolicy] = squadsPda.policy({
|
|
1469
|
+
settings: squadsSettings,
|
|
1470
|
+
policySeed: nextPolicySeed,
|
|
1471
|
+
})
|
|
1472
|
+
|
|
1473
|
+
return exponentVaults.createAddPolicyInstruction(
|
|
1474
|
+
{
|
|
1475
|
+
payer,
|
|
1476
|
+
vault: this.selfAddress,
|
|
1477
|
+
squadsSettings,
|
|
1478
|
+
squadsSettingsTransaction,
|
|
1479
|
+
squadsProposal,
|
|
1480
|
+
squadsPolicy,
|
|
1481
|
+
squadsProgram,
|
|
1482
|
+
systemProgram: SystemProgram.programId,
|
|
1483
|
+
},
|
|
1484
|
+
{ policyConfig: this.toCodamaPolicyConfig(policyConfig) },
|
|
1485
|
+
)
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
/**
|
|
1489
|
+
* Create instruction to call wrapper_add_policy.
|
|
1490
|
+
* Wrapper uses the same empty-vault guard as direct policy management.
|
|
1491
|
+
*/
|
|
1492
|
+
ixWrapperAddPolicy({
|
|
1493
|
+
payer,
|
|
1494
|
+
policyConfig,
|
|
1495
|
+
squadsProgram,
|
|
1496
|
+
nextPolicySeed,
|
|
1497
|
+
nextTransactionIndex,
|
|
1498
|
+
}: WrapperAddPolicyParams) {
|
|
1499
|
+
const squadsSettings = this.state.squadsSettings
|
|
1500
|
+
const squadsPda = new SquadsPDA(squadsProgram)
|
|
1501
|
+
|
|
1502
|
+
const [squadsSettingsTransaction] = squadsPda.transaction({
|
|
1503
|
+
settings: squadsSettings,
|
|
1504
|
+
transactionIndex: nextTransactionIndex,
|
|
1505
|
+
})
|
|
1506
|
+
const [squadsProposal] = squadsPda.proposal({
|
|
1507
|
+
settings: squadsSettings,
|
|
1508
|
+
transactionIndex: nextTransactionIndex,
|
|
1509
|
+
})
|
|
1510
|
+
const [squadsPolicy] = squadsPda.policy({
|
|
1511
|
+
settings: squadsSettings,
|
|
1512
|
+
policySeed: nextPolicySeed,
|
|
1513
|
+
})
|
|
1514
|
+
|
|
1515
|
+
return exponentVaults.createWrapperAddPolicyInstruction(
|
|
1516
|
+
{
|
|
1517
|
+
payer,
|
|
1518
|
+
vault: this.selfAddress,
|
|
1519
|
+
squadsSettings,
|
|
1520
|
+
squadsSettingsTransaction,
|
|
1521
|
+
squadsProposal,
|
|
1522
|
+
squadsPolicy,
|
|
1523
|
+
squadsProgram,
|
|
1524
|
+
systemProgram: SystemProgram.programId,
|
|
1525
|
+
},
|
|
1526
|
+
{ policyConfig: this.toCodamaPolicyConfig(policyConfig) },
|
|
1527
|
+
)
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
/**
|
|
1531
|
+
* Create instruction to remove a policy from this vault.
|
|
1532
|
+
* Direct policy management requires an empty vault; live vaults must use proposals.
|
|
1533
|
+
*/
|
|
1534
|
+
ixRemovePolicy({ payer, manager, policySeed, squadsProgram, nextTransactionIndex }: RemovePolicyParams) {
|
|
1535
|
+
const squadsSettings = this.state.squadsSettings
|
|
1536
|
+
const squadsPda = new SquadsPDA(squadsProgram)
|
|
1537
|
+
|
|
1538
|
+
// Derive Squads PDAs
|
|
1539
|
+
const [squadsSettingsTransaction] = squadsPda.transaction({
|
|
1540
|
+
settings: squadsSettings,
|
|
1541
|
+
transactionIndex: nextTransactionIndex,
|
|
1542
|
+
})
|
|
1543
|
+
const [squadsProposal] = squadsPda.proposal({
|
|
1544
|
+
settings: squadsSettings,
|
|
1545
|
+
transactionIndex: nextTransactionIndex,
|
|
1546
|
+
})
|
|
1547
|
+
const [squadsPolicy] = squadsPda.policy({
|
|
1548
|
+
settings: squadsSettings,
|
|
1549
|
+
policySeed,
|
|
1550
|
+
})
|
|
1551
|
+
|
|
1552
|
+
return exponentVaults.createRemovePolicyInstruction({
|
|
1553
|
+
payer,
|
|
1554
|
+
vault: this.selfAddress,
|
|
1555
|
+
manager,
|
|
1556
|
+
squadsSettings,
|
|
1557
|
+
squadsSettingsTransaction,
|
|
1558
|
+
squadsProposal,
|
|
1559
|
+
squadsPolicy,
|
|
1560
|
+
squadsProgram,
|
|
1561
|
+
systemProgram: SystemProgram.programId,
|
|
1562
|
+
})
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
/**
|
|
1566
|
+
* Create instruction to call wrapper_remove_policy.
|
|
1567
|
+
* Wrapper uses the same empty-vault guard as direct policy management.
|
|
1568
|
+
*/
|
|
1569
|
+
ixWrapperRemovePolicy({
|
|
1570
|
+
payer,
|
|
1571
|
+
manager,
|
|
1572
|
+
policySeed,
|
|
1573
|
+
squadsProgram,
|
|
1574
|
+
nextTransactionIndex,
|
|
1575
|
+
}: WrapperRemovePolicyParams) {
|
|
1576
|
+
const squadsSettings = this.state.squadsSettings
|
|
1577
|
+
const squadsPda = new SquadsPDA(squadsProgram)
|
|
1578
|
+
|
|
1579
|
+
const [squadsSettingsTransaction] = squadsPda.transaction({
|
|
1580
|
+
settings: squadsSettings,
|
|
1581
|
+
transactionIndex: nextTransactionIndex,
|
|
1582
|
+
})
|
|
1583
|
+
const [squadsProposal] = squadsPda.proposal({
|
|
1584
|
+
settings: squadsSettings,
|
|
1585
|
+
transactionIndex: nextTransactionIndex,
|
|
1586
|
+
})
|
|
1587
|
+
const [squadsPolicy] = squadsPda.policy({
|
|
1588
|
+
settings: squadsSettings,
|
|
1589
|
+
policySeed,
|
|
1590
|
+
})
|
|
1591
|
+
|
|
1592
|
+
return exponentVaults.createWrapperRemovePolicyInstruction({
|
|
1593
|
+
payer,
|
|
1594
|
+
vault: this.selfAddress,
|
|
1595
|
+
manager,
|
|
1596
|
+
squadsSettings,
|
|
1597
|
+
squadsSettingsTransaction,
|
|
1598
|
+
squadsProposal,
|
|
1599
|
+
squadsPolicy,
|
|
1600
|
+
squadsProgram,
|
|
1601
|
+
systemProgram: SystemProgram.programId,
|
|
1602
|
+
})
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
/**
|
|
1606
|
+
* Create instruction to call wrapper_update_policy.
|
|
1607
|
+
* Wrapper uses the same empty-vault guard as direct policy management.
|
|
1608
|
+
*/
|
|
1609
|
+
ixWrapperUpdatePolicy({
|
|
1610
|
+
payer,
|
|
1611
|
+
manager,
|
|
1612
|
+
policyConfig,
|
|
1613
|
+
policySeed,
|
|
1614
|
+
squadsProgram,
|
|
1615
|
+
nextTransactionIndex,
|
|
1616
|
+
}: WrapperUpdatePolicyParams) {
|
|
1617
|
+
const squadsSettings = this.state.squadsSettings
|
|
1618
|
+
const squadsPda = new SquadsPDA(squadsProgram)
|
|
1619
|
+
|
|
1620
|
+
const [squadsSettingsTransaction] = squadsPda.transaction({
|
|
1621
|
+
settings: squadsSettings,
|
|
1622
|
+
transactionIndex: nextTransactionIndex,
|
|
1623
|
+
})
|
|
1624
|
+
const [squadsProposal] = squadsPda.proposal({
|
|
1625
|
+
settings: squadsSettings,
|
|
1626
|
+
transactionIndex: nextTransactionIndex,
|
|
1627
|
+
})
|
|
1628
|
+
const [squadsPolicy] = squadsPda.policy({
|
|
1629
|
+
settings: squadsSettings,
|
|
1630
|
+
policySeed,
|
|
1631
|
+
})
|
|
1632
|
+
|
|
1633
|
+
return exponentVaults.createWrapperUpdatePolicyInstruction(
|
|
1634
|
+
{
|
|
1635
|
+
payer,
|
|
1636
|
+
vault: this.selfAddress,
|
|
1637
|
+
manager,
|
|
1638
|
+
squadsSettings,
|
|
1639
|
+
squadsSettingsTransaction,
|
|
1640
|
+
squadsProposal,
|
|
1641
|
+
squadsPolicy,
|
|
1642
|
+
squadsProgram,
|
|
1643
|
+
systemProgram: SystemProgram.programId,
|
|
1644
|
+
},
|
|
1645
|
+
{ policyConfig: this.toCodamaPolicyConfig(policyConfig) },
|
|
1646
|
+
)
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
// ==========================================================================
|
|
1650
|
+
// Price Management Methods
|
|
1651
|
+
// ==========================================================================
|
|
1652
|
+
|
|
1653
|
+
/**
|
|
1654
|
+
* Derive the ExponentPrices PDA for this vault.
|
|
1655
|
+
*/
|
|
1656
|
+
deriveExponentPricesAddress(): [PublicKey, number] {
|
|
1657
|
+
const vaultsPda = new ExponentVaultsPDA(this.programId)
|
|
1658
|
+
return vaultsPda.exponentPrices()
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
// ==========================================================================
|
|
1662
|
+
// Static Factory Methods
|
|
1663
|
+
// ==========================================================================
|
|
1664
|
+
|
|
1665
|
+
/**
|
|
1666
|
+
* Create instruction to initialize the global ExponentPrices account.
|
|
1667
|
+
* The account is a singleton PDA derived from ["exponent_prices"].
|
|
1668
|
+
*/
|
|
1669
|
+
static ixInitializePrices({ manager, programId: programIdOverride }: InitializePricesParams) {
|
|
1670
|
+
const programId = programIdOverride ?? new PublicKey(EXPONENT_VAULTS_PROGRAM_ID)
|
|
1671
|
+
const [exponentPrices] = new ExponentVaultsPDA(programId).exponentPrices()
|
|
1672
|
+
return exponentVaults.createInitializePricesInstruction(
|
|
1673
|
+
{
|
|
1674
|
+
manager,
|
|
1675
|
+
exponentPrices,
|
|
1676
|
+
systemProgram: SystemProgram.programId,
|
|
1677
|
+
},
|
|
1678
|
+
programId,
|
|
1679
|
+
)
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
/**
|
|
1683
|
+
* Create instruction to manage price entries (add/remove/update) in the ExponentPrices account.
|
|
1684
|
+
* Uses realloc to resize the account as prices are added or removed.
|
|
1685
|
+
*/
|
|
1686
|
+
static ixManagePrices({ manager, actions, programId: programIdOverride }: ManagePricesParams) {
|
|
1687
|
+
const programId = programIdOverride ?? new PublicKey(EXPONENT_VAULTS_PROGRAM_ID)
|
|
1688
|
+
const [exponentPrices] = new ExponentVaultsPDA(programId).exponentPrices()
|
|
1689
|
+
const remainingAccounts: AccountMeta[] = []
|
|
1690
|
+
const codamaActions = actions.map((action) =>
|
|
1691
|
+
convertUpdatePriceAction(action, programId, exponentPrices, remainingAccounts),
|
|
1692
|
+
)
|
|
1693
|
+
const ix = exponentVaults.createManagePricesInstruction(
|
|
1694
|
+
{ manager, exponentPrices, systemProgram: SystemProgram.programId },
|
|
1695
|
+
{ actions: codamaActions },
|
|
1696
|
+
programId,
|
|
1697
|
+
)
|
|
1698
|
+
ix.keys.push(...remainingAccounts)
|
|
1699
|
+
return ix
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
/**
|
|
1703
|
+
* Create instruction to initialize a new vault.
|
|
1704
|
+
* This is a static method since the vault doesn't exist yet.
|
|
1705
|
+
*/
|
|
1706
|
+
static ixInitializeVault(params: InitializeVaultParams, env: Environment) {
|
|
1707
|
+
const programId = env.exponentVaultsProgramId ?? new PublicKey(EXPONENT_VAULTS_PROGRAM_ID)
|
|
1708
|
+
const vaultsPda = new ExponentVaultsPDA(programId)
|
|
1709
|
+
const squadsPda = new SquadsPDA(params.squadsProgram)
|
|
1710
|
+
const tokenProgram = params.tokenProgram ?? TOKEN_PROGRAM_ID
|
|
1711
|
+
|
|
1712
|
+
// Derive vault PDA
|
|
1713
|
+
const [vault] = vaultsPda.vault({ seedId: params.seedId })
|
|
1714
|
+
const [mintLp] = vaultsPda.mintLp({ vault })
|
|
1715
|
+
const [tokenLpEscrow] = vaultsPda.tokenLpEscrow({ vault })
|
|
1716
|
+
|
|
1717
|
+
// Derive LP destination (ATA for payer)
|
|
1718
|
+
const lpDst = getAssociatedTokenAddressSync(mintLp, params.payer, false, tokenProgram)
|
|
1719
|
+
|
|
1720
|
+
// Squads account is created via CPI during initialize_vault
|
|
1721
|
+
// The on-chain program creates the Squads smart account first, so these start at 1
|
|
1722
|
+
const nextTransactionIndex = BigInt(1)
|
|
1723
|
+
const nextPolicySeed = BigInt(1)
|
|
1724
|
+
|
|
1725
|
+
const nextTransactionTransferIndex = BigInt(2)
|
|
1726
|
+
const nextPolicyTransferSeed = BigInt(2)
|
|
1727
|
+
|
|
1728
|
+
// Derive Squads PDAs for the policy that gets created after the Squads account
|
|
1729
|
+
// These all use squadsSettings (the Settings account) as the base key
|
|
1730
|
+
const [squadsSettingsTransaction] = squadsPda.transaction({
|
|
1731
|
+
settings: params.squadsSettings,
|
|
1732
|
+
transactionIndex: nextTransactionIndex,
|
|
1733
|
+
})
|
|
1734
|
+
const [squadsProposal] = squadsPda.proposal({
|
|
1735
|
+
settings: params.squadsSettings,
|
|
1736
|
+
transactionIndex: nextTransactionIndex,
|
|
1737
|
+
})
|
|
1738
|
+
const [squadsPolicy] = squadsPda.policy({
|
|
1739
|
+
settings: params.squadsSettings,
|
|
1740
|
+
policySeed: nextPolicySeed,
|
|
1741
|
+
})
|
|
1742
|
+
|
|
1743
|
+
// Derive Squads PDAs for the transfer accounts
|
|
1744
|
+
const [squadsPolicyTransfer] = squadsPda.policy({
|
|
1745
|
+
settings: params.squadsSettings,
|
|
1746
|
+
policySeed: nextPolicyTransferSeed,
|
|
1747
|
+
})
|
|
1748
|
+
const [squadsSettingsTransactionTransfer] = squadsPda.transaction({
|
|
1749
|
+
settings: params.squadsSettings,
|
|
1750
|
+
transactionIndex: nextTransactionTransferIndex,
|
|
1751
|
+
})
|
|
1752
|
+
const [squadsProposalTransfer] = squadsPda.proposal({
|
|
1753
|
+
settings: params.squadsSettings,
|
|
1754
|
+
transactionIndex: nextTransactionTransferIndex,
|
|
1755
|
+
})
|
|
1756
|
+
|
|
1757
|
+
// Convert token entries to Codama format
|
|
1758
|
+
const codamaTokenEntries: exponentVaults.TokenEntry[] = params.tokenEntries.map((entry) => ({
|
|
1759
|
+
mint: entry.mint,
|
|
1760
|
+
priceId: toCodamaPriceId(entry.priceId),
|
|
1761
|
+
tokenSquadsAccount: entry.tokenSquadsAccount,
|
|
1762
|
+
tokenAccountVault: entry.tokenAccountVault,
|
|
1763
|
+
forceDeallocatePolicyIds: (entry.forceDeallocatePolicyIds ?? []).map((id) => toBigInt(id)),
|
|
1764
|
+
}))
|
|
1765
|
+
|
|
1766
|
+
// Convert seedId to Uint8Array
|
|
1767
|
+
const seedIdArray = new Uint8Array(params.seedId)
|
|
1768
|
+
if (seedIdArray.length !== 8) {
|
|
1769
|
+
throw new Error(`seedId must contain 8 bytes, received ${seedIdArray.length}`)
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
// Convert roles
|
|
1773
|
+
const codamaRoles: exponentVaults.VaultRoles = {
|
|
1774
|
+
manager: params.roles.manager,
|
|
1775
|
+
curator: params.roles.curator,
|
|
1776
|
+
allocator: params.roles.allocator,
|
|
1777
|
+
sentinel: params.roles.sentinel,
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
// Convert proposal vote config if provided
|
|
1781
|
+
const codamaProposalVoteConfig: exponentVaults.ProposalVoteConfig | null = params.proposalVoteConfig
|
|
1782
|
+
? {
|
|
1783
|
+
minVotingPeriodSeconds: params.proposalVoteConfig.minVotingPeriodSeconds,
|
|
1784
|
+
maxVotingPeriodSeconds: params.proposalVoteConfig.maxVotingPeriodSeconds,
|
|
1785
|
+
defaultVotingPeriodSeconds: params.proposalVoteConfig.defaultVotingPeriodSeconds,
|
|
1786
|
+
defaultTimelockSeconds: params.proposalVoteConfig.defaultTimelockSeconds,
|
|
1787
|
+
rejectionThresholdBps: toBigInt(params.proposalVoteConfig.rejectionThresholdBps),
|
|
1788
|
+
nextProposalId: toBigInt(params.proposalVoteConfig.nextProposalId),
|
|
1789
|
+
votingEnabled: params.proposalVoteConfig.votingEnabled,
|
|
1790
|
+
liveProposalsCount: params.proposalVoteConfig.liveProposalsCount,
|
|
1791
|
+
maxConcurrentLiveProposals: params.proposalVoteConfig.maxConcurrentLiveProposals,
|
|
1792
|
+
reserved: new Uint8Array(params.proposalVoteConfig.reserved),
|
|
1793
|
+
}
|
|
1794
|
+
: null
|
|
1795
|
+
|
|
1796
|
+
const [exponentPrices] = new ExponentVaultsPDA(programId).exponentPrices()
|
|
1797
|
+
|
|
1798
|
+
return exponentVaults.createInitializeVaultInstruction(
|
|
1799
|
+
{
|
|
1800
|
+
payer: params.payer,
|
|
1801
|
+
vault,
|
|
1802
|
+
exponentPrices,
|
|
1803
|
+
mint: params.mint,
|
|
1804
|
+
mintLp,
|
|
1805
|
+
tokenLpEscrow,
|
|
1806
|
+
feeTreasury: params.feeTreasury,
|
|
1807
|
+
lpDst,
|
|
1808
|
+
tokenProgram,
|
|
1809
|
+
systemProgram: SystemProgram.programId,
|
|
1810
|
+
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
1811
|
+
addressLookupTable: params.addressLookupTable,
|
|
1812
|
+
squadsProgram: params.squadsProgram,
|
|
1813
|
+
squadsProgramConfig: params.squadsProgramConfig,
|
|
1814
|
+
squadsTreasury: params.squadsTreasury,
|
|
1815
|
+
squadsSettings: params.squadsSettings,
|
|
1816
|
+
squadsVault: params.squadsVault,
|
|
1817
|
+
squadsPolicy,
|
|
1818
|
+
squadsSettingsTransaction,
|
|
1819
|
+
squadsProposal,
|
|
1820
|
+
squadsPolicyTransfer,
|
|
1821
|
+
squadsSettingsTransactionTransfer,
|
|
1822
|
+
squadsProposalTransfer,
|
|
1823
|
+
},
|
|
1824
|
+
{
|
|
1825
|
+
manager: params.manager,
|
|
1826
|
+
feeTreasuryLpBps: params.normalWithdrawalFeeBps,
|
|
1827
|
+
managementFeeBps: toBigInt(params.managementFeeBps),
|
|
1828
|
+
reservesShareBp: params.reservesShareBp,
|
|
1829
|
+
fastWithdrawalCutBp: params.fastWithdrawalCutBp ?? 0,
|
|
1830
|
+
tokenEntries: codamaTokenEntries,
|
|
1831
|
+
maxLpSupply: toBigInt(params.maxLpSupply),
|
|
1832
|
+
seedId: seedIdArray,
|
|
1833
|
+
initialLpAmount: toBigInt(params.initialLpAmount),
|
|
1834
|
+
lpDecimals: params.lpDecimals,
|
|
1835
|
+
roles: codamaRoles,
|
|
1836
|
+
proposalVoteConfig: codamaProposalVoteConfig,
|
|
1837
|
+
},
|
|
1838
|
+
)
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
async fetchTotalAumInfo(pricesAccount: ExponentPrices, jitoBundleRpc?: string): Promise<TotalAumInfo> {
|
|
1842
|
+
const aum = await this.getTotalAumViaJitoBundle(pricesAccount, jitoBundleRpc)
|
|
1843
|
+
|
|
1844
|
+
const { supply: lpSupply, decimals: lpDecimals } = await getMint(this.connection, this.state.mintLp)
|
|
1845
|
+
const underlyingDecimals = await getMintDecimals(this.connection, this.state.underlyingMint)
|
|
1846
|
+
|
|
1847
|
+
if (lpSupply === 0n) {
|
|
1848
|
+
return {
|
|
1849
|
+
aum,
|
|
1850
|
+
aumHuman: 0,
|
|
1851
|
+
lpRate: 0,
|
|
1852
|
+
lpSupply,
|
|
1853
|
+
lpDecimals,
|
|
1854
|
+
underlyingDecimals,
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
const lpHuman = Number(lpSupply.toString()) / 10 ** lpDecimals
|
|
1859
|
+
const aumHuman = Number(aum.toString()) / 10 ** underlyingDecimals
|
|
1860
|
+
const lpRate = aumHuman / lpHuman
|
|
1861
|
+
|
|
1862
|
+
return {
|
|
1863
|
+
aum,
|
|
1864
|
+
aumHuman,
|
|
1865
|
+
lpRate,
|
|
1866
|
+
lpSupply,
|
|
1867
|
+
lpDecimals,
|
|
1868
|
+
underlyingDecimals,
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
/**
|
|
1873
|
+
* LP token price: AUM / LP supply.
|
|
1874
|
+
* Returns 0 when LP supply is zero.
|
|
1875
|
+
*/
|
|
1876
|
+
async getLpPrice(): Promise<number> {
|
|
1877
|
+
const aum = this.getTotalAum()
|
|
1878
|
+
const lpSupply = await this.fetchLpTokenSupply()
|
|
1879
|
+
const quoteDecimals = await getMintDecimals(this.connection, this.state.underlyingMint)
|
|
1880
|
+
|
|
1881
|
+
const lpSupplyNum = parseInt(lpSupply.toString())
|
|
1882
|
+
if (lpSupplyNum === 0) return 0
|
|
1883
|
+
|
|
1884
|
+
const aumHuman = parseInt(aum.toString()) / 10 ** quoteDecimals
|
|
1885
|
+
const lpMintInfo = await getMint(this.connection, this.state.mintLp)
|
|
1886
|
+
return aumHuman / (lpSupplyNum / 10 ** lpMintInfo.decimals)
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
/**
|
|
1890
|
+
* Total AUM: on-chain tracked base value + value held in strategy positions.
|
|
1891
|
+
*/
|
|
1892
|
+
getTotalAum(): bigint {
|
|
1893
|
+
return this.aumCalculator.getTotalAum()
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
/**
|
|
1897
|
+
* Calculates total AUM by simulating a bundle that updates prices and deposits liquidity.
|
|
1898
|
+
* Requires an RPC endpoint that supports the `simulateBundle` method (e.g., Jito, Helius).
|
|
1899
|
+
*/
|
|
1900
|
+
async getTotalAumViaJitoBundle(pricesAccount: ExponentPrices, jitoBundleRpc?: string): Promise<bigint> {
|
|
1901
|
+
try {
|
|
1902
|
+
const rpcUrl = jitoBundleRpc ?? this.connection.rpcEndpoint
|
|
1903
|
+
|
|
1904
|
+
const depositor = this.state.roles.manager[0]
|
|
1905
|
+
if (!depositor) {
|
|
1906
|
+
throw new Error("Vault manager not found")
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
const depositMint = this.state.tokenEntries[0]?.mint
|
|
1910
|
+
if (!depositMint) {
|
|
1911
|
+
throw new Error("Deposit token not found")
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
const [updatePriceIxs, depositIxs] = await Promise.all([
|
|
1915
|
+
this.ixsUpdateStrategyVaultPrices(pricesAccount),
|
|
1916
|
+
this.ixsDepositLiquidity({
|
|
1917
|
+
depositor,
|
|
1918
|
+
mint: depositMint,
|
|
1919
|
+
tokenAmountIn: 1,
|
|
1920
|
+
minLpOut: 0,
|
|
1921
|
+
}),
|
|
1922
|
+
])
|
|
1923
|
+
|
|
1924
|
+
// Use a dummy blockhash - Jito will replace it with replaceRecentBlockhash
|
|
1925
|
+
const blockhash = "11111111111111111111111111111111"
|
|
1926
|
+
|
|
1927
|
+
const encodedTransactions: string[] = []
|
|
1928
|
+
|
|
1929
|
+
if (updatePriceIxs.length > 0) {
|
|
1930
|
+
const priceMsg = new TransactionMessage({
|
|
1931
|
+
payerKey: depositor,
|
|
1932
|
+
recentBlockhash: blockhash,
|
|
1933
|
+
instructions: updatePriceIxs,
|
|
1934
|
+
}).compileToV0Message()
|
|
1935
|
+
encodedTransactions.push(Buffer.from(new VersionedTransaction(priceMsg).serialize()).toString("base64"))
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
const depositMsg = new TransactionMessage({
|
|
1939
|
+
payerKey: depositor,
|
|
1940
|
+
recentBlockhash: blockhash,
|
|
1941
|
+
instructions: depositIxs,
|
|
1942
|
+
}).compileToV0Message()
|
|
1943
|
+
encodedTransactions.push(Buffer.from(new VersionedTransaction(depositMsg).serialize()).toString("base64"))
|
|
1944
|
+
|
|
1945
|
+
const rpcResponse = await fetch(rpcUrl, {
|
|
1946
|
+
method: "POST",
|
|
1947
|
+
headers: { "Content-Type": "application/json" },
|
|
1948
|
+
body: JSON.stringify({
|
|
1949
|
+
jsonrpc: "2.0",
|
|
1950
|
+
id: "1",
|
|
1951
|
+
method: "simulateBundle",
|
|
1952
|
+
params: [
|
|
1953
|
+
{ encodedTransactions },
|
|
1954
|
+
{
|
|
1955
|
+
preExecutionAccountsConfigs: [
|
|
1956
|
+
null,
|
|
1957
|
+
null,
|
|
1958
|
+
// {
|
|
1959
|
+
// addresses: [this.state.selfAddress.toBase58()],
|
|
1960
|
+
// encoding: "base64",
|
|
1961
|
+
// },
|
|
1962
|
+
],
|
|
1963
|
+
postExecutionAccountsConfigs: [
|
|
1964
|
+
null,
|
|
1965
|
+
{
|
|
1966
|
+
addresses: [this.state.selfAddress.toBase58()],
|
|
1967
|
+
encoding: "base64",
|
|
1968
|
+
},
|
|
1969
|
+
],
|
|
1970
|
+
transactionEncoding: "base64",
|
|
1971
|
+
skipSigVerify: true,
|
|
1972
|
+
replaceRecentBlockhash: true,
|
|
1973
|
+
simulationBank: { commitment: { commitment: "processed" } },
|
|
1974
|
+
},
|
|
1975
|
+
],
|
|
1976
|
+
}),
|
|
1977
|
+
cache: "no-store",
|
|
1978
|
+
})
|
|
1979
|
+
|
|
1980
|
+
type HeliusSimulationTransactionResult = {
|
|
1981
|
+
err?: unknown
|
|
1982
|
+
logs?: string[] | null
|
|
1983
|
+
unitsConsumed?: number | null
|
|
1984
|
+
preExecutionAccounts?: Array<{ data: [string, string] } | null> | null
|
|
1985
|
+
postExecutionAccounts?: Array<{ data: [string, string] } | null> | null
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
type HeliusSimulationResponse = {
|
|
1989
|
+
result?: {
|
|
1990
|
+
value?: {
|
|
1991
|
+
summary?: unknown
|
|
1992
|
+
transactionResults?: HeliusSimulationTransactionResult[]
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
error?: unknown
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
const responseBody = (await rpcResponse.json().catch(() => null)) as HeliusSimulationResponse | null
|
|
1999
|
+
const txnResults = responseBody?.result?.value?.transactionResults || []
|
|
2000
|
+
|
|
2001
|
+
if (!rpcResponse.ok || responseBody?.error) {
|
|
2002
|
+
throw new Error("Jito bundle simulation failed")
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
const depositFailed = !!txnResults[1].err
|
|
2006
|
+
if (depositFailed) {
|
|
2007
|
+
throw new Error("Jito bundle simulation failed")
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
const postVaultAccountData = txnResults[1]?.postExecutionAccounts?.[0]?.data?.[0]
|
|
2011
|
+
|
|
2012
|
+
if (!postVaultAccountData) {
|
|
2013
|
+
throw new Error("Jito bundle simulation failed")
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
const decoded = this.fetcher.program.account.exponentStrategyVault.coder.accounts.decode(
|
|
2017
|
+
"exponentStrategyVault",
|
|
2018
|
+
Buffer.from(postVaultAccountData, "base64"),
|
|
2019
|
+
)
|
|
2020
|
+
const vaultStateAfterSimulations = transformAnchorData(decoded) as ExponentVaultType
|
|
2021
|
+
const aum =
|
|
2022
|
+
vaultStateAfterSimulations.financials.aumInBase + vaultStateAfterSimulations.financials.aumInBaseInPositions
|
|
2023
|
+
|
|
2024
|
+
return aum
|
|
2025
|
+
} catch {
|
|
2026
|
+
console.warn("Unable to calculate AUM via simulation. Using AUM from vault.state")
|
|
2027
|
+
return this.getTotalAum()
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
async ixsUpdateStrategyVaultPrices(pricesAccount: ExponentPrices): Promise<TransactionInstruction[]> {
|
|
2032
|
+
type PriceIdValue = { simple: { priceId: bigint } } | { multiply: { priceIds: bigint[] } }
|
|
2033
|
+
|
|
2034
|
+
const extractPriceIds = (priceId: PriceIdValue): number[] => {
|
|
2035
|
+
const ids = "simple" in priceId ? [Number(priceId.simple.priceId)] : priceId.multiply.priceIds.map(Number)
|
|
2036
|
+
return ids.filter((id) => id !== 0) // skip passthrough (price_id 0)
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
const allPriceIds = new Set<number>()
|
|
2040
|
+
|
|
2041
|
+
for (const entry of this.state.tokenEntries) {
|
|
2042
|
+
extractPriceIds(entry.priceId).forEach((id) => allPriceIds.add(id))
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
for (const position of this.state.strategyPositions) {
|
|
2046
|
+
if ("orderbook" in position) {
|
|
2047
|
+
const orderbook = position.orderbook[0]
|
|
2048
|
+
extractPriceIds(orderbook.priceIdPt).forEach((id) => allPriceIds.add(id))
|
|
2049
|
+
continue
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
if ("tokenAccount" in position) {
|
|
2053
|
+
for (const balance of position.tokenAccount[0].balances) {
|
|
2054
|
+
extractPriceIds(balance.priceId).forEach((id) => allPriceIds.add(id))
|
|
2055
|
+
}
|
|
2056
|
+
continue
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
if ("obligation" in position) {
|
|
2060
|
+
const inner = position.obligation[0]
|
|
2061
|
+
const kaminoEntry =
|
|
2062
|
+
inner && typeof inner === "object" && "kaminoObligation" in inner ? inner.kaminoObligation?.[0] : inner?.[0]
|
|
2063
|
+
if (kaminoEntry?.quotePriceId) {
|
|
2064
|
+
extractPriceIds(kaminoEntry.quotePriceId).forEach((id: number) => allPriceIds.add(id))
|
|
2065
|
+
}
|
|
2066
|
+
for (const mapping of kaminoEntry?.reservePriceMappings ?? []) {
|
|
2067
|
+
if (mapping.reservePriceId) {
|
|
2068
|
+
extractPriceIds(mapping.reservePriceId).forEach((id: number) => allPriceIds.add(id))
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2074
|
+
return Promise.all(
|
|
2075
|
+
[...allPriceIds].map((priceId) => {
|
|
2076
|
+
const priceEntry = pricesAccount.prices[priceId]
|
|
2077
|
+
|
|
2078
|
+
if (!priceEntry) {
|
|
2079
|
+
throw new Error(`Price entry not found for priceId ${priceId}`)
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
return this.ixUpdatePrice({
|
|
2083
|
+
priceInterfaceAccounts: priceEntry.priceInterfaceAccounts,
|
|
2084
|
+
remainingAccounts: priceEntry.interfaceAccounts,
|
|
2085
|
+
priceId,
|
|
2086
|
+
})
|
|
2087
|
+
}),
|
|
2088
|
+
)
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
// ==========================================================================
|
|
2092
|
+
// Helper Methods — Codama type conversions
|
|
2093
|
+
// ==========================================================================
|
|
2094
|
+
|
|
2095
|
+
/**
|
|
2096
|
+
* Converts vault `PolicyConfig` (policyType shape from policy builders) to the Codama/client codec shape
|
|
2097
|
+
* required by the proposal action codecs used by staged proposal creation.
|
|
2098
|
+
*/
|
|
2099
|
+
public toCodamaPolicyConfig(config: PolicyConfig): exponentVaults.PolicyConfig {
|
|
2100
|
+
return {
|
|
2101
|
+
payload: this.toCodamaPolicyPayload(config.policyType),
|
|
2102
|
+
threshold: config.threshold,
|
|
2103
|
+
timeLock: config.timeLock,
|
|
2104
|
+
startTimestamp: config.startTimestamp,
|
|
2105
|
+
expiration: config.expiration ? this.toCodamaPolicyExpiration(config.expiration) : null,
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
private toCodamaPolicyPayload(policyType: PolicyType): exponentVaults.PolicyCreationPayload {
|
|
2110
|
+
if ("programInteraction" in policyType) {
|
|
2111
|
+
const pi = policyType.programInteraction
|
|
2112
|
+
// Post-hook for interaction validation (matches initialize_vault.rs).
|
|
2113
|
+
// num_extra_accounts: 7 (vault, exponent_prices, mint_lp, payer,
|
|
2114
|
+
// system_program, instructions_sysvar, squads_policy).
|
|
2115
|
+
// program_id is separate, so total = 8 accounts.
|
|
2116
|
+
const validateInteractionPostHook = {
|
|
2117
|
+
numExtraAccounts: 7,
|
|
2118
|
+
accountConstraints: [],
|
|
2119
|
+
instructionData: new Uint8Array([21]), // validate_interaction_hook discriminator
|
|
2120
|
+
programId: this.programId,
|
|
2121
|
+
passInnerInstructions: true,
|
|
2122
|
+
}
|
|
2123
|
+
const payload: exponentVaults.ProgramInteractionPolicyCreationPayload = {
|
|
2124
|
+
accountIndex: pi.accountIndex,
|
|
2125
|
+
instructionsConstraints: pi.instructionsConstraints.map((ic) => ({
|
|
2126
|
+
programId: ic.programId,
|
|
2127
|
+
accountConstraints: ic.accountConstraints.map((ac) => ({
|
|
2128
|
+
accountIndex: ac.accountIndex,
|
|
2129
|
+
accountConstraint:
|
|
2130
|
+
ac.accountDataConstraints && ac.accountDataConstraints.length > 0
|
|
2131
|
+
? {
|
|
2132
|
+
__kind: "AccountData" as const,
|
|
2133
|
+
fields: [ac.accountDataConstraints.map((dc) => this.toCodamaDataConstraint(dc))],
|
|
2134
|
+
}
|
|
2135
|
+
: { __kind: "Pubkey" as const, fields: [ac.accountKeys ?? []] },
|
|
2136
|
+
owner: ac.owner ?? null,
|
|
2137
|
+
})),
|
|
2138
|
+
dataConstraints: ic.dataConstraints.map((dc) => this.toCodamaDataConstraint(dc)),
|
|
2139
|
+
})),
|
|
2140
|
+
preHook: null,
|
|
2141
|
+
postHook: validateInteractionPostHook,
|
|
2142
|
+
spendingLimits: pi.spendingLimits.map((sl) => ({
|
|
2143
|
+
mint: sl.mint,
|
|
2144
|
+
timeConstraints: {
|
|
2145
|
+
start: sl.timeConstraints.start,
|
|
2146
|
+
expiration: sl.timeConstraints.expiration,
|
|
2147
|
+
period: this.toCodamaPeriod(sl.timeConstraints.period),
|
|
2148
|
+
},
|
|
2149
|
+
quantityConstraints: { maxPerPeriod: sl.quantityConstraints.maxPerPeriod },
|
|
2150
|
+
})),
|
|
2151
|
+
}
|
|
2152
|
+
return { __kind: "ProgramInteraction", fields: [payload] }
|
|
2153
|
+
}
|
|
2154
|
+
if ("internalFundTransfer" in policyType) {
|
|
2155
|
+
const ift = policyType.internalFundTransfer
|
|
2156
|
+
const payload: exponentVaults.InternalFundTransferPolicyCreationPayload = {
|
|
2157
|
+
sourceAccountIndices: new Uint8Array(ift.sourceAccountMask),
|
|
2158
|
+
destinationAccountIndices: new Uint8Array(ift.destinationAccountMask),
|
|
2159
|
+
allowedMints: ift.allowedMints,
|
|
2160
|
+
}
|
|
2161
|
+
return { __kind: "InternalFundTransfer", fields: [payload] }
|
|
2162
|
+
}
|
|
2163
|
+
if ("settingsChange" in policyType) {
|
|
2164
|
+
const sc = policyType.settingsChange
|
|
2165
|
+
const payload: exponentVaults.SettingsChangePolicyCreationPayload = {
|
|
2166
|
+
actions: sc.allowedActions.map((a) => this.toCodamaAllowedSettingsChange(a)),
|
|
2167
|
+
}
|
|
2168
|
+
return { __kind: "SettingsChange", fields: [payload] }
|
|
2169
|
+
}
|
|
2170
|
+
if ("spendingLimit" in policyType) {
|
|
2171
|
+
const spl = policyType.spendingLimit
|
|
2172
|
+
const payload: exponentVaults.SpendingLimitPolicyCreationPayload = {
|
|
2173
|
+
mint: spl.spendingLimit.mint,
|
|
2174
|
+
sourceAccountIndex: spl.sourceAccountIndex,
|
|
2175
|
+
timeConstraints: {
|
|
2176
|
+
start: spl.spendingLimit.timeConstraints.start,
|
|
2177
|
+
expiration: spl.spendingLimit.timeConstraints.expiration,
|
|
2178
|
+
period: this.toCodamaPeriod(spl.spendingLimit.timeConstraints.period),
|
|
2179
|
+
accumulateUnused: false,
|
|
2180
|
+
},
|
|
2181
|
+
quantityConstraints: {
|
|
2182
|
+
maxPerPeriod: spl.spendingLimit.quantityConstraints.maxPerPeriod,
|
|
2183
|
+
maxPerUse: 0n,
|
|
2184
|
+
enforceExactQuantity: false,
|
|
2185
|
+
},
|
|
2186
|
+
usageState: null,
|
|
2187
|
+
destinations: spl.destinations,
|
|
2188
|
+
}
|
|
2189
|
+
return { __kind: "SpendingLimit", fields: [payload] }
|
|
2190
|
+
}
|
|
2191
|
+
throw new Error("Unsupported policy type for Codama migration")
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
private toCodamaDataConstraint(constraint: DataConstraint): exponentVaults.DataConstraint {
|
|
2195
|
+
return {
|
|
2196
|
+
dataOffset: constraint.dataOffset,
|
|
2197
|
+
dataValue: this.toCodamaDataValue(constraint.dataValue),
|
|
2198
|
+
operator: this.toCodamaDataOperator(constraint.operator),
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
private toCodamaDataValue(value: DataValue): exponentVaults.DataValue {
|
|
2203
|
+
if ("u8" in value) return { __kind: "U8", fields: [value.u8] }
|
|
2204
|
+
if ("u16Le" in value) return { __kind: "U16Le", fields: [value.u16Le] }
|
|
2205
|
+
if ("u32Le" in value) return { __kind: "U32Le", fields: [value.u32Le] }
|
|
2206
|
+
if ("u64Le" in value) return { __kind: "U64Le", fields: [value.u64Le] }
|
|
2207
|
+
if ("u128Le" in value) return { __kind: "U128Le", fields: [value.u128Le] }
|
|
2208
|
+
if ("u8Slice" in value) return { __kind: "U8Slice", fields: [new Uint8Array(value.u8Slice)] }
|
|
2209
|
+
throw new Error("Unknown data value type")
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2212
|
+
private toCodamaDataOperator(op: DataOperator): exponentVaults.DataOperator {
|
|
2213
|
+
const map: Record<DataOperator, exponentVaults.DataOperator> = {
|
|
2214
|
+
Equals: exponentVaults.DataOperator.Equals,
|
|
2215
|
+
NotEquals: exponentVaults.DataOperator.NotEquals,
|
|
2216
|
+
GreaterThan: exponentVaults.DataOperator.GreaterThan,
|
|
2217
|
+
GreaterThanOrEqualTo: exponentVaults.DataOperator.GreaterThanOrEqualTo,
|
|
2218
|
+
LessThan: exponentVaults.DataOperator.LessThan,
|
|
2219
|
+
LessThanOrEqualTo: exponentVaults.DataOperator.LessThanOrEqualTo,
|
|
2220
|
+
}
|
|
2221
|
+
return map[op]
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
private toCodamaPeriod(period: Period): exponentVaults.PeriodV2 {
|
|
2225
|
+
const map: Record<string, exponentVaults.PeriodV2> = {
|
|
2226
|
+
OneTime: { __kind: "OneTime" },
|
|
2227
|
+
Daily: { __kind: "Daily" },
|
|
2228
|
+
Weekly: { __kind: "Weekly" },
|
|
2229
|
+
Monthly: { __kind: "Monthly" },
|
|
2230
|
+
}
|
|
2231
|
+
const result = map[period]
|
|
2232
|
+
if (!result) throw new Error(`Unsupported period: ${period}`)
|
|
2233
|
+
return result
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
private toCodamaPolicyExpiration(expiration: PolicyExpiration): exponentVaults.PolicyExpirationArgs {
|
|
2237
|
+
if ("timestamp" in expiration) return { __kind: "Timestamp", fields: [expiration.timestamp] }
|
|
2238
|
+
if ("settingsState" in expiration) return { __kind: "SettingsState" }
|
|
2239
|
+
throw new Error("Unknown expiration type")
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
private toCodamaAllowedSettingsChange(change: AllowedSettingsChange): exponentVaults.AllowedSettingsChange {
|
|
2243
|
+
switch (change) {
|
|
2244
|
+
case "AddSigner":
|
|
2245
|
+
return { __kind: "AddSigner", newSigner: null, newSignerPermissions: null }
|
|
2246
|
+
case "RemoveSigner":
|
|
2247
|
+
return { __kind: "RemoveSigner", oldSigner: null }
|
|
2248
|
+
case "ChangeThreshold":
|
|
2249
|
+
return { __kind: "ChangeThreshold" }
|
|
2250
|
+
case "ChangeTimeLock":
|
|
2251
|
+
return { __kind: "ChangeTimeLock", newTimeLock: null }
|
|
2252
|
+
default:
|
|
2253
|
+
throw new Error(`Unsupported settings change: ${change}`)
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
}
|