@exponent-labs/exponent-sdk 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/addressLookupTableUtil.d.ts +13 -13
- package/build/addressLookupTableUtil.js +5 -5
- package/build/addressLookupTableUtil.js.map +1 -1
- package/build/client/clmm/accounts/lpPosition.js +5 -6
- package/build/client/clmm/accounts/lpPosition.js.map +1 -1
- package/build/client/clmm/accounts/marketThree.js +5 -6
- package/build/client/clmm/accounts/marketThree.js.map +1 -1
- package/build/client/clmm/accounts/vault.js +5 -6
- package/build/client/clmm/accounts/vault.js.map +1 -1
- package/build/client/clmm/index.d.ts +1 -2
- package/build/client/clmm/instructions/addFarm.js +1 -2
- package/build/client/clmm/instructions/addFarm.js.map +1 -1
- package/build/client/clmm/instructions/addLiquidity.js +1 -2
- package/build/client/clmm/instructions/addLiquidity.js.map +1 -1
- package/build/client/clmm/instructions/addMarketEmission.js +1 -2
- package/build/client/clmm/instructions/addMarketEmission.js.map +1 -1
- package/build/client/clmm/instructions/buyPt.js +1 -2
- package/build/client/clmm/instructions/buyPt.js.map +1 -1
- package/build/client/clmm/instructions/buyYt.js +1 -2
- package/build/client/clmm/instructions/buyYt.js.map +1 -1
- package/build/client/clmm/instructions/claimFarmEmission.js +1 -2
- package/build/client/clmm/instructions/claimFarmEmission.js.map +1 -1
- package/build/client/clmm/instructions/closeMarket.js +1 -2
- package/build/client/clmm/instructions/closeMarket.js.map +1 -1
- package/build/client/clmm/instructions/depositLiquidity.js +1 -2
- package/build/client/clmm/instructions/depositLiquidity.js.map +1 -1
- package/build/client/clmm/instructions/initializeMarket.js +1 -2
- package/build/client/clmm/instructions/initializeMarket.js.map +1 -1
- package/build/client/clmm/instructions/marketAccrueEmission.js +1 -2
- package/build/client/clmm/instructions/marketAccrueEmission.js.map +1 -1
- package/build/client/clmm/instructions/marketCollectEmission.js +1 -2
- package/build/client/clmm/instructions/marketCollectEmission.js.map +1 -1
- package/build/client/clmm/instructions/modifyFarm.js +1 -2
- package/build/client/clmm/instructions/modifyFarm.js.map +1 -1
- package/build/client/clmm/instructions/modifyMarketSetting.js +1 -2
- package/build/client/clmm/instructions/modifyMarketSetting.js.map +1 -1
- package/build/client/clmm/instructions/sellPt.js +1 -2
- package/build/client/clmm/instructions/sellPt.js.map +1 -1
- package/build/client/clmm/instructions/sellYt.js +1 -2
- package/build/client/clmm/instructions/sellYt.js.map +1 -1
- package/build/client/clmm/instructions/tradePt.js +1 -2
- package/build/client/clmm/instructions/tradePt.js.map +1 -1
- package/build/client/clmm/instructions/tradePtExactOut.js +1 -2
- package/build/client/clmm/instructions/tradePtExactOut.js.map +1 -1
- package/build/client/clmm/instructions/withdrawLiquidity.js +1 -2
- package/build/client/clmm/instructions/withdrawLiquidity.js.map +1 -1
- package/build/client/clmm/instructions/wrapperBuyYt.js +1 -2
- package/build/client/clmm/instructions/wrapperBuyYt.js.map +1 -1
- package/build/client/clmm/instructions/wrapperProvideLiquidity.js +1 -2
- package/build/client/clmm/instructions/wrapperProvideLiquidity.js.map +1 -1
- package/build/client/clmm/instructions/wrapperProvideLiquidityBase.js +1 -2
- package/build/client/clmm/instructions/wrapperProvideLiquidityBase.js.map +1 -1
- package/build/client/clmm/instructions/wrapperProvideLiquidityClassic.js +1 -2
- package/build/client/clmm/instructions/wrapperProvideLiquidityClassic.js.map +1 -1
- package/build/client/clmm/instructions/wrapperSellYt.js +1 -2
- package/build/client/clmm/instructions/wrapperSellYt.js.map +1 -1
- package/build/client/clmm/instructions/wrapperWithdrawLiquidity.js +1 -2
- package/build/client/clmm/instructions/wrapperWithdrawLiquidity.js.map +1 -1
- package/build/client/clmm/instructions/wrapperWithdrawLiquidityClassic.js +1 -2
- package/build/client/clmm/instructions/wrapperWithdrawLiquidityClassic.js.map +1 -1
- package/build/client/clmm/types/addFarmEvent.d.ts +1 -25
- package/build/client/clmm/types/amount.d.ts +1 -19
- package/build/client/clmm/types/amount.js +3 -3
- package/build/client/clmm/types/amount.js.map +1 -1
- package/build/client/clmm/types/buyPtEvent.d.ts +1 -16
- package/build/client/clmm/types/buyYtEvent.d.ts +1 -40
- package/build/client/clmm/types/claimFarmEmissionsEvent.d.ts +1 -149
- package/build/client/clmm/types/claimLimits.d.ts +1 -16
- package/build/client/clmm/types/closeMarketEvent.d.ts +1 -16
- package/build/client/clmm/types/configurationOptions.d.ts +1 -25
- package/build/client/clmm/types/cpiAccounts.d.ts +1 -99
- package/build/client/clmm/types/cpiCoreAccounts.d.ts +1 -42
- package/build/client/clmm/types/cpiInterfaceContext.d.ts +1 -13
- package/build/client/clmm/types/crossingSplit.d.ts +1 -109
- package/build/client/clmm/types/depositLiquidityEvent.d.ts +1 -149
- package/build/client/clmm/types/depositLiquidityReturnData.d.ts +1 -49
- package/build/client/clmm/types/emissionInfo.d.ts +1 -25
- package/build/client/clmm/types/farmEmission.d.ts +1 -16
- package/build/client/clmm/types/liquidityNetBalanceLimits.d.ts +1 -19
- package/build/client/clmm/types/lpFarm.d.ts +1 -30
- package/build/client/clmm/types/marketAccrueEmissionEvent.d.ts +1 -134
- package/build/client/clmm/types/marketAdminAction.d.ts +1 -306
- package/build/client/clmm/types/marketAdminAction.js +3 -3
- package/build/client/clmm/types/marketAdminAction.js.map +1 -1
- package/build/client/clmm/types/marketCollectEmissionEvent.d.ts +1 -143
- package/build/client/clmm/types/marketEmission.d.ts +1 -13
- package/build/client/clmm/types/marketEmissions.d.ts +1 -23
- package/build/client/clmm/types/marketFinancials.d.ts +1 -19
- package/build/client/clmm/types/marketThreeInitEvent.d.ts +1 -52
- package/build/client/clmm/types/mergeEvent.d.ts +1 -61
- package/build/client/clmm/types/modifiedTick.d.ts +1 -13
- package/build/client/clmm/types/modifiedTicks.d.ts +1 -35
- package/build/client/clmm/types/modifyFarmEvent.d.ts +1 -31
- package/build/client/clmm/types/number.d.ts +1 -1
- package/build/client/clmm/types/personalYieldTracker.d.ts +1 -10
- package/build/client/clmm/types/personalYieldTrackers.d.ts +1 -19
- package/build/client/clmm/types/principalShare.d.ts +1 -42
- package/build/client/clmm/types/principalShareTrackers.d.ts +1 -59
- package/build/client/clmm/types/sellPtEvent.d.ts +1 -16
- package/build/client/clmm/types/sellYtEvent.d.ts +1 -34
- package/build/client/clmm/types/stripEvent.d.ts +1 -61
- package/build/client/clmm/types/swapDirection.d.ts +1 -1
- package/build/client/clmm/types/tradePtEvent.d.ts +1 -90
- package/build/client/clmm/types/withdrawLiquidityEvent.d.ts +1 -158
- package/build/client/clmm/types/withdrawLiquidityReturnData.d.ts +1 -34
- package/build/client/clmm/types/wrapperBuyYtEvent.d.ts +1 -16
- package/build/client/clmm/types/wrapperProvideLiquidityBaseEvent.d.ts +1 -40
- package/build/client/clmm/types/wrapperProvideLiquidityClassicEvent.d.ts +1 -37
- package/build/client/clmm/types/wrapperProvideLiquidityEvent.d.ts +1 -40
- package/build/client/clmm/types/wrapperSellYtEvent.d.ts +1 -16
- package/build/client/clmm/types/wrapperWithdrawLiquidityClassicEvent.d.ts +1 -43
- package/build/client/clmm/types/wrapperWithdrawLiquidityEvent.d.ts +1 -43
- package/build/client/core/accounts/admin.js +5 -6
- package/build/client/core/accounts/admin.js.map +1 -1
- package/build/client/core/accounts/lpPosition.js +5 -6
- package/build/client/core/accounts/lpPosition.js.map +1 -1
- package/build/client/core/accounts/marketTwo.js +5 -6
- package/build/client/core/accounts/marketTwo.js.map +1 -1
- package/build/client/core/accounts/vault.js +5 -6
- package/build/client/core/accounts/vault.js.map +1 -1
- package/build/client/core/accounts/yieldTokenPosition.js +5 -6
- package/build/client/core/accounts/yieldTokenPosition.js.map +1 -1
- package/build/client/core/index.d.ts +1 -2
- package/build/client/core/instructions/addEmission.js +1 -2
- package/build/client/core/instructions/addEmission.js.map +1 -1
- package/build/client/core/instructions/addFarm.js +1 -2
- package/build/client/core/instructions/addFarm.js.map +1 -1
- package/build/client/core/instructions/addLpTokensMetadata.js +1 -2
- package/build/client/core/instructions/addLpTokensMetadata.js.map +1 -1
- package/build/client/core/instructions/addMarketEmission.js +1 -2
- package/build/client/core/instructions/addMarketEmission.js.map +1 -1
- package/build/client/core/instructions/buyYt.js +1 -2
- package/build/client/core/instructions/buyYt.js.map +1 -1
- package/build/client/core/instructions/claimFarmEmissions.js +1 -2
- package/build/client/core/instructions/claimFarmEmissions.js.map +1 -1
- package/build/client/core/instructions/collectEmission.js +1 -2
- package/build/client/core/instructions/collectEmission.js.map +1 -1
- package/build/client/core/instructions/collectInterest.js +1 -2
- package/build/client/core/instructions/collectInterest.js.map +1 -1
- package/build/client/core/instructions/collectTreasuryEmission.js +1 -2
- package/build/client/core/instructions/collectTreasuryEmission.js.map +1 -1
- package/build/client/core/instructions/collectTreasuryInterest.js +1 -2
- package/build/client/core/instructions/collectTreasuryInterest.js.map +1 -1
- package/build/client/core/instructions/depositYt.js +1 -2
- package/build/client/core/instructions/depositYt.js.map +1 -1
- package/build/client/core/instructions/initLpPosition.js +1 -2
- package/build/client/core/instructions/initLpPosition.js.map +1 -1
- package/build/client/core/instructions/initMarketTwo.js +1 -2
- package/build/client/core/instructions/initMarketTwo.js.map +1 -1
- package/build/client/core/instructions/initializeVault.js +1 -2
- package/build/client/core/instructions/initializeVault.js.map +1 -1
- package/build/client/core/instructions/initializeYieldPosition.js +1 -2
- package/build/client/core/instructions/initializeYieldPosition.js.map +1 -1
- package/build/client/core/instructions/marketCollectEmission.js +1 -2
- package/build/client/core/instructions/marketCollectEmission.js.map +1 -1
- package/build/client/core/instructions/marketDepositLp.js +1 -2
- package/build/client/core/instructions/marketDepositLp.js.map +1 -1
- package/build/client/core/instructions/marketTwoDepositLiquidity.js +1 -2
- package/build/client/core/instructions/marketTwoDepositLiquidity.js.map +1 -1
- package/build/client/core/instructions/marketTwoWithdrawLiquidity.js +1 -2
- package/build/client/core/instructions/marketTwoWithdrawLiquidity.js.map +1 -1
- package/build/client/core/instructions/marketWithdrawLp.js +1 -2
- package/build/client/core/instructions/marketWithdrawLp.js.map +1 -1
- package/build/client/core/instructions/merge.js +1 -2
- package/build/client/core/instructions/merge.js.map +1 -1
- package/build/client/core/instructions/modifyFarm.js +1 -2
- package/build/client/core/instructions/modifyFarm.js.map +1 -1
- package/build/client/core/instructions/modifyMarketSetting.js +1 -2
- package/build/client/core/instructions/modifyMarketSetting.js.map +1 -1
- package/build/client/core/instructions/modifyVaultSetting.js +1 -2
- package/build/client/core/instructions/modifyVaultSetting.js.map +1 -1
- package/build/client/core/instructions/reallocMarket.js +1 -2
- package/build/client/core/instructions/reallocMarket.js.map +1 -1
- package/build/client/core/instructions/sellYt.js +1 -2
- package/build/client/core/instructions/sellYt.js.map +1 -1
- package/build/client/core/instructions/stageYtYield.js +1 -2
- package/build/client/core/instructions/stageYtYield.js.map +1 -1
- package/build/client/core/instructions/strip.js +1 -2
- package/build/client/core/instructions/strip.js.map +1 -1
- package/build/client/core/instructions/tradePt.js +1 -2
- package/build/client/core/instructions/tradePt.js.map +1 -1
- package/build/client/core/instructions/withdrawYt.js +1 -2
- package/build/client/core/instructions/withdrawYt.js.map +1 -1
- package/build/client/core/instructions/wrapperBuyPt.js +1 -2
- package/build/client/core/instructions/wrapperBuyPt.js.map +1 -1
- package/build/client/core/instructions/wrapperBuyYt.js +1 -2
- package/build/client/core/instructions/wrapperBuyYt.js.map +1 -1
- package/build/client/core/instructions/wrapperCollectInterest.js +1 -2
- package/build/client/core/instructions/wrapperCollectInterest.js.map +1 -1
- package/build/client/core/instructions/wrapperMerge.js +1 -2
- package/build/client/core/instructions/wrapperMerge.js.map +1 -1
- package/build/client/core/instructions/wrapperProvideLiquidity.js +1 -2
- package/build/client/core/instructions/wrapperProvideLiquidity.js.map +1 -1
- package/build/client/core/instructions/wrapperProvideLiquidityBase.js +1 -2
- package/build/client/core/instructions/wrapperProvideLiquidityBase.js.map +1 -1
- package/build/client/core/instructions/wrapperProvideLiquidityClassic.js +1 -2
- package/build/client/core/instructions/wrapperProvideLiquidityClassic.js.map +1 -1
- package/build/client/core/instructions/wrapperSellPt.js +1 -2
- package/build/client/core/instructions/wrapperSellPt.js.map +1 -1
- package/build/client/core/instructions/wrapperSellYt.js +1 -2
- package/build/client/core/instructions/wrapperSellYt.js.map +1 -1
- package/build/client/core/instructions/wrapperStrip.js +1 -2
- package/build/client/core/instructions/wrapperStrip.js.map +1 -1
- package/build/client/core/instructions/wrapperWithdrawLiquidity.js +1 -2
- package/build/client/core/instructions/wrapperWithdrawLiquidity.js.map +1 -1
- package/build/client/core/instructions/wrapperWithdrawLiquidityClassic.js +1 -2
- package/build/client/core/instructions/wrapperWithdrawLiquidityClassic.js.map +1 -1
- package/build/client/core/types/adminAction.d.ts +1 -269
- package/build/client/core/types/adminAction.js +3 -3
- package/build/client/core/types/adminAction.js.map +1 -1
- package/build/client/core/types/amount.d.ts +1 -19
- package/build/client/core/types/amount.js +3 -3
- package/build/client/core/types/amount.js.map +1 -1
- package/build/client/core/types/buyPtEvent.d.ts +1 -19
- package/build/client/core/types/buyYtEvent.d.ts +1 -49
- package/build/client/core/types/claimFarmEmissionsEvent.d.ts +1 -31
- package/build/client/core/types/claimFarmEmissionsEventV2.d.ts +1 -83
- package/build/client/core/types/claimLimits.d.ts +1 -16
- package/build/client/core/types/collectEmissionEvent.d.ts +1 -25
- package/build/client/core/types/collectEmissionEventV2.d.ts +1 -55
- package/build/client/core/types/collectInterestEvent.d.ts +1 -22
- package/build/client/core/types/collectInterestEventV2.d.ts +1 -52
- package/build/client/core/types/collectTreasuryEmissionKind.d.ts +1 -1
- package/build/client/core/types/collectTreasuryInterestKind.d.ts +1 -1
- package/build/client/core/types/cpiAccounts.d.ts +1 -99
- package/build/client/core/types/cpiInterfaceContext.d.ts +1 -13
- package/build/client/core/types/depositLiquidityEvent.d.ts +1 -49
- package/build/client/core/types/depositLpEvent.d.ts +1 -31
- package/build/client/core/types/depositLpEventV2.d.ts +1 -83
- package/build/client/core/types/depositYtEvent.d.ts +1 -40
- package/build/client/core/types/depositYtEventV2.d.ts +1 -70
- package/build/client/core/types/emissionInfo.d.ts +1 -25
- package/build/client/core/types/farmEmission.d.ts +1 -16
- package/build/client/core/types/initLpPositionEvent.d.ts +1 -25
- package/build/client/core/types/initializeYieldPositionEvent.d.ts +1 -16
- package/build/client/core/types/liquidityNetBalanceLimits.d.ts +1 -19
- package/build/client/core/types/lpFarm.d.ts +1 -30
- package/build/client/core/types/marketAdminAction.d.ts +1 -239
- package/build/client/core/types/marketAdminAction.js +3 -3
- package/build/client/core/types/marketAdminAction.js.map +1 -1
- package/build/client/core/types/marketCollectEmissionEvent.d.ts +1 -28
- package/build/client/core/types/marketCollectEmissionEventV2.d.ts +1 -80
- package/build/client/core/types/marketEmission.d.ts +1 -13
- package/build/client/core/types/marketEmissions.d.ts +1 -23
- package/build/client/core/types/marketFinancials.d.ts +1 -22
- package/build/client/core/types/mergeEvent.d.ts +1 -61
- package/build/client/core/types/number.d.ts +1 -1
- package/build/client/core/types/personalYieldTracker.d.ts +1 -10
- package/build/client/core/types/personalYieldTrackers.d.ts +1 -19
- package/build/client/core/types/principleDetails.d.ts +1 -7
- package/build/client/core/types/principles.d.ts +1 -70
- package/build/client/core/types/sellPtEvent.d.ts +1 -19
- package/build/client/core/types/sellYtEvent.d.ts +1 -43
- package/build/client/core/types/stageYieldEvent.d.ts +1 -31
- package/build/client/core/types/stageYieldEventV2.d.ts +1 -58
- package/build/client/core/types/stripEvent.d.ts +1 -61
- package/build/client/core/types/tradePtEvent.d.ts +1 -37
- package/build/client/core/types/withdrawLiquidityEvent.d.ts +1 -43
- package/build/client/core/types/withdrawLpEvent.d.ts +1 -31
- package/build/client/core/types/withdrawLpEventV2.d.ts +1 -83
- package/build/client/core/types/withdrawYtEvent.d.ts +1 -40
- package/build/client/core/types/withdrawYtEventV2.d.ts +1 -70
- package/build/client/core/types/wrapperBuyYtEvent.d.ts +1 -19
- package/build/client/core/types/wrapperCollectInterestEvent.d.ts +1 -16
- package/build/client/core/types/wrapperMergeEvent.d.ts +1 -19
- package/build/client/core/types/wrapperProvideLiquidityBaseEvent.d.ts +1 -25
- package/build/client/core/types/wrapperProvideLiquidityClassicEvent.d.ts +1 -22
- package/build/client/core/types/wrapperProvideLiquidityEvent.d.ts +1 -22
- package/build/client/core/types/wrapperSellYtEvent.d.ts +1 -19
- package/build/client/core/types/wrapperStripEvent.d.ts +1 -19
- package/build/client/core/types/wrapperWithdrawLiquidityClassicEvent.d.ts +1 -22
- package/build/client/core/types/wrapperWithdrawLiquidityEvent.d.ts +1 -19
- package/build/client/core/types/yieldTokenTracker.d.ts +1 -10
- package/build/client/orderbook/accounts/cpiAccountsOrderbook.js +5 -6
- package/build/client/orderbook/accounts/cpiAccountsOrderbook.js.map +1 -1
- package/build/client/orderbook/accounts/vault.js +5 -6
- package/build/client/orderbook/accounts/vault.js.map +1 -1
- package/build/client/orderbook/index.d.ts +1 -2
- package/build/client/orderbook/instructions/collectAdminEmission.js +1 -2
- package/build/client/orderbook/instructions/collectAdminEmission.js.map +1 -1
- package/build/client/orderbook/instructions/collectAdminFee.js +1 -2
- package/build/client/orderbook/instructions/collectAdminFee.js.map +1 -1
- package/build/client/orderbook/instructions/collectInterest.js +1 -2
- package/build/client/orderbook/instructions/collectInterest.js.map +1 -1
- package/build/client/orderbook/instructions/initializeOrderbook.js +1 -2
- package/build/client/orderbook/instructions/initializeOrderbook.js.map +1 -1
- package/build/client/orderbook/instructions/marketOffer.js +1 -2
- package/build/client/orderbook/instructions/marketOffer.js.map +1 -1
- package/build/client/orderbook/instructions/postOffer.js +1 -2
- package/build/client/orderbook/instructions/postOffer.js.map +1 -1
- package/build/client/orderbook/instructions/reallocOrderbookAccount.js +1 -2
- package/build/client/orderbook/instructions/reallocOrderbookAccount.js.map +1 -1
- package/build/client/orderbook/instructions/removeExpiredOffers.js +1 -2
- package/build/client/orderbook/instructions/removeExpiredOffers.js.map +1 -1
- package/build/client/orderbook/instructions/removeOffer.js +1 -2
- package/build/client/orderbook/instructions/removeOffer.js.map +1 -1
- package/build/client/orderbook/instructions/setConfigurationOptions.js +1 -2
- package/build/client/orderbook/instructions/setConfigurationOptions.js.map +1 -1
- package/build/client/orderbook/instructions/withdrawFunds.js +1 -2
- package/build/client/orderbook/instructions/withdrawFunds.js.map +1 -1
- package/build/client/orderbook/instructions/wrapperCollectAdminFee.js +1 -2
- package/build/client/orderbook/instructions/wrapperCollectAdminFee.js.map +1 -1
- package/build/client/orderbook/instructions/wrapperCollectInterest.js +1 -2
- package/build/client/orderbook/instructions/wrapperCollectInterest.js.map +1 -1
- package/build/client/orderbook/instructions/wrapperMarketOffer.js +1 -2
- package/build/client/orderbook/instructions/wrapperMarketOffer.js.map +1 -1
- package/build/client/orderbook/instructions/wrapperPostOffer.js +1 -2
- package/build/client/orderbook/instructions/wrapperPostOffer.js.map +1 -1
- package/build/client/orderbook/instructions/wrapperRemoveOffer.js +1 -2
- package/build/client/orderbook/instructions/wrapperRemoveOffer.js.map +1 -1
- package/build/client/orderbook/instructions/wrapperWithdrawFunds.js +1 -2
- package/build/client/orderbook/instructions/wrapperWithdrawFunds.js.map +1 -1
- package/build/client/orderbook/types/amount.d.ts +1 -19
- package/build/client/orderbook/types/amount.js +3 -3
- package/build/client/orderbook/types/amount.js.map +1 -1
- package/build/client/orderbook/types/claimLimits.d.ts +1 -16
- package/build/client/orderbook/types/collectAdminEmissionEvent.d.ts +1 -19
- package/build/client/orderbook/types/collectAdminFeeEvent.d.ts +1 -19
- package/build/client/orderbook/types/collectEmissionEventV2.d.ts +1 -55
- package/build/client/orderbook/types/collectInterestEventV2.d.ts +1 -52
- package/build/client/orderbook/types/collectUserInterestEvent.d.ts +1 -16
- package/build/client/orderbook/types/cpiAccounts.d.ts +1 -99
- package/build/client/orderbook/types/cpiInterfaceContext.d.ts +1 -13
- package/build/client/orderbook/types/emissionInfo.d.ts +1 -25
- package/build/client/orderbook/types/exponentCoreCpiAccounts.d.ts +1 -99
- package/build/client/orderbook/types/filledOffersEvent.d.ts +1 -22
- package/build/client/orderbook/types/marketOfferEvent.d.ts +1 -74
- package/build/client/orderbook/types/mergeEvent.d.ts +1 -61
- package/build/client/orderbook/types/number.d.ts +1 -1
- package/build/client/orderbook/types/offerOptions.d.ts +1 -13
- package/build/client/orderbook/types/offerOptions.js +3 -3
- package/build/client/orderbook/types/offerOptions.js.map +1 -1
- package/build/client/orderbook/types/offerType.d.ts +1 -1
- package/build/client/orderbook/types/orderbookInitEvent.d.ts +1 -28
- package/build/client/orderbook/types/postOfferEvent.d.ts +1 -96
- package/build/client/orderbook/types/removeOfferEvent.d.ts +1 -28
- package/build/client/orderbook/types/setConfigurationOptionsEnum.d.ts +1 -49
- package/build/client/orderbook/types/setConfigurationOptionsEnum.js +3 -3
- package/build/client/orderbook/types/setConfigurationOptionsEnum.js.map +1 -1
- package/build/client/orderbook/types/stripEvent.d.ts +1 -61
- package/build/client/orderbook/types/withdrawFundsEvent.d.ts +1 -28
- package/build/client/orderbook/types/wrapperCollectAdminFeeEvent.d.ts +1 -13
- package/build/client/orderbook/types/wrapperCollectInterestEvent.d.ts +1 -10
- package/build/client/orderbook/types/wrapperMarketOfferEvent.d.ts +1 -13
- package/build/client/orderbook/types/wrapperPostOfferEvent.d.ts +1 -28
- package/build/client/orderbook/types/wrapperRemoveOfferEvent.d.ts +1 -10
- package/build/client/orderbook/types/wrapperWithdrawFundsEvent.d.ts +1 -19
- package/build/client/orderbook/types/yieldTokenTracker.d.ts +1 -10
- package/build/client/vaults/accounts/actionProposal.js +5 -6
- package/build/client/vaults/accounts/actionProposal.js.map +1 -1
- package/build/client/vaults/accounts/exponentStrategyVault.js +5 -6
- package/build/client/vaults/accounts/exponentStrategyVault.js.map +1 -1
- package/build/client/vaults/accounts/programConfig.js +5 -6
- package/build/client/vaults/accounts/programConfig.js.map +1 -1
- package/build/client/vaults/accounts/voteAccount.js +5 -6
- package/build/client/vaults/accounts/voteAccount.js.map +1 -1
- package/build/client/vaults/accounts/withdrawalAccount.js +5 -6
- package/build/client/vaults/accounts/withdrawalAccount.js.map +1 -1
- package/build/client/vaults/eventRegistry.d.ts +8 -2
- package/build/client/vaults/eventRegistry.js +6 -0
- package/build/client/vaults/eventRegistry.js.map +1 -1
- package/build/client/vaults/index.d.ts +4 -2
- package/build/client/vaults/index.js +3 -0
- package/build/client/vaults/index.js.map +1 -1
- package/build/client/vaults/instructions/activateProposal.d.ts +2 -0
- package/build/client/vaults/instructions/activateProposal.js +3 -2
- package/build/client/vaults/instructions/activateProposal.js.map +1 -1
- package/build/client/vaults/instructions/addPolicy.js +1 -2
- package/build/client/vaults/instructions/addPolicy.js.map +1 -1
- package/build/client/vaults/instructions/appendProposalActions.js +1 -2
- package/build/client/vaults/instructions/appendProposalActions.js.map +1 -1
- package/build/client/vaults/instructions/cancelProposal.d.ts +2 -0
- package/build/client/vaults/instructions/cancelProposal.js +3 -2
- package/build/client/vaults/instructions/cancelProposal.js.map +1 -1
- package/build/client/vaults/instructions/cancelWithdrawal.d.ts +2 -0
- package/build/client/vaults/instructions/cancelWithdrawal.js +3 -2
- package/build/client/vaults/instructions/cancelWithdrawal.js.map +1 -1
- package/build/client/vaults/instructions/collectManagementFee.js +1 -2
- package/build/client/vaults/instructions/collectManagementFee.js.map +1 -1
- package/build/client/vaults/instructions/depositLiquidity.js +1 -2
- package/build/client/vaults/instructions/depositLiquidity.js.map +1 -1
- package/build/client/vaults/instructions/executeProposal.d.ts +2 -0
- package/build/client/vaults/instructions/executeProposal.js +3 -2
- package/build/client/vaults/instructions/executeProposal.js.map +1 -1
- package/build/client/vaults/instructions/executeWithdrawal.js +1 -2
- package/build/client/vaults/instructions/executeWithdrawal.js.map +1 -1
- package/build/client/vaults/instructions/executeWithdrawalFromReserves.d.ts +2 -0
- package/build/client/vaults/instructions/executeWithdrawalFromReserves.js +3 -2
- package/build/client/vaults/instructions/executeWithdrawalFromReserves.js.map +1 -1
- package/build/client/vaults/instructions/fillWithdrawal.js +1 -2
- package/build/client/vaults/instructions/fillWithdrawal.js.map +1 -1
- package/build/client/vaults/instructions/finalizeProposal.d.ts +2 -0
- package/build/client/vaults/instructions/finalizeProposal.js +3 -2
- package/build/client/vaults/instructions/finalizeProposal.js.map +1 -1
- package/build/client/vaults/instructions/initProposal.js +1 -2
- package/build/client/vaults/instructions/initProposal.js.map +1 -1
- package/build/client/vaults/instructions/initializePrices.js +1 -2
- package/build/client/vaults/instructions/initializePrices.js.map +1 -1
- package/build/client/vaults/instructions/initializeVault.js +1 -2
- package/build/client/vaults/instructions/initializeVault.js.map +1 -1
- package/build/client/vaults/instructions/makeSentienelManager.js +1 -2
- package/build/client/vaults/instructions/makeSentienelManager.js.map +1 -1
- package/build/client/vaults/instructions/managePrices.js +1 -2
- package/build/client/vaults/instructions/managePrices.js.map +1 -1
- package/build/client/vaults/instructions/manageVaultSettings.js +1 -2
- package/build/client/vaults/instructions/manageVaultSettings.js.map +1 -1
- package/build/client/vaults/instructions/managerUpdatePosition.js +1 -2
- package/build/client/vaults/instructions/managerUpdatePosition.js.map +1 -1
- package/build/client/vaults/instructions/queueWithdrawal.d.ts +2 -0
- package/build/client/vaults/instructions/queueWithdrawal.js +3 -2
- package/build/client/vaults/instructions/queueWithdrawal.js.map +1 -1
- package/build/client/vaults/instructions/removePolicy.js +1 -2
- package/build/client/vaults/instructions/removePolicy.js.map +1 -1
- package/build/client/vaults/instructions/sentinelSetVaultFlags.d.ts +2 -0
- package/build/client/vaults/instructions/sentinelSetVaultFlags.js +3 -2
- package/build/client/vaults/instructions/sentinelSetVaultFlags.js.map +1 -1
- package/build/client/vaults/instructions/stakeVote.d.ts +2 -0
- package/build/client/vaults/instructions/stakeVote.js +3 -2
- package/build/client/vaults/instructions/stakeVote.js.map +1 -1
- package/build/client/vaults/instructions/unstakeVote.js +1 -2
- package/build/client/vaults/instructions/unstakeVote.js.map +1 -1
- package/build/client/vaults/instructions/updatePolicy.js +1 -2
- package/build/client/vaults/instructions/updatePolicy.js.map +1 -1
- package/build/client/vaults/instructions/updatePolicyManager.js +1 -2
- package/build/client/vaults/instructions/updatePolicyManager.js.map +1 -1
- package/build/client/vaults/instructions/updatePrice.js +1 -2
- package/build/client/vaults/instructions/updatePrice.js.map +1 -1
- package/build/client/vaults/instructions/validateInteractionHook.js +1 -2
- package/build/client/vaults/instructions/validateInteractionHook.js.map +1 -1
- package/build/client/vaults/instructions/wrapperAddPolicy.js +1 -2
- package/build/client/vaults/instructions/wrapperAddPolicy.js.map +1 -1
- package/build/client/vaults/instructions/wrapperExecuteWithdrawal.js +1 -2
- package/build/client/vaults/instructions/wrapperExecuteWithdrawal.js.map +1 -1
- package/build/client/vaults/instructions/wrapperManageVaultSettings.js +1 -2
- package/build/client/vaults/instructions/wrapperManageVaultSettings.js.map +1 -1
- package/build/client/vaults/instructions/wrapperManagerUpdatePosition.js +1 -2
- package/build/client/vaults/instructions/wrapperManagerUpdatePosition.js.map +1 -1
- package/build/client/vaults/instructions/wrapperRemovePolicy.js +1 -2
- package/build/client/vaults/instructions/wrapperRemovePolicy.js.map +1 -1
- package/build/client/vaults/instructions/wrapperUpdatePolicy.js +1 -2
- package/build/client/vaults/instructions/wrapperUpdatePolicy.js.map +1 -1
- package/build/client/vaults/types/accountConstraint.d.ts +1 -13
- package/build/client/vaults/types/accountConstraintType.d.ts +1 -1
- package/build/client/vaults/types/accountConstraintType.js +3 -3
- package/build/client/vaults/types/accountConstraintType.js.map +1 -1
- package/build/client/vaults/types/allowedSettingsChange.d.ts +1 -54
- package/build/client/vaults/types/allowedSettingsChange.js +3 -3
- package/build/client/vaults/types/allowedSettingsChange.js.map +1 -1
- package/build/client/vaults/types/cancelProposalEvent.d.ts +1 -19
- package/build/client/vaults/types/cancelWithdrawalEvent.d.ts +12 -0
- package/build/client/vaults/types/cancelWithdrawalEvent.js +29 -0
- package/build/client/vaults/types/cancelWithdrawalEvent.js.map +1 -0
- package/build/client/vaults/types/clmmPositionEntry.d.ts +1 -80
- package/build/client/vaults/types/dataConstraint.d.ts +1 -109
- package/build/client/vaults/types/dataOperator.d.ts +1 -1
- package/build/client/vaults/types/dataValue.d.ts +1 -73
- package/build/client/vaults/types/dataValue.js +3 -3
- package/build/client/vaults/types/dataValue.js.map +1 -1
- package/build/client/vaults/types/depositLiquidityEvent.d.ts +1 -40
- package/build/client/vaults/types/executeProposalEvent.d.ts +1 -19
- package/build/client/vaults/types/executeWithdrawalEvent.d.ts +8 -10
- package/build/client/vaults/types/executeWithdrawalEvent.js +19 -0
- package/build/client/vaults/types/executeWithdrawalEvent.js.map +1 -1
- package/build/client/vaults/types/executeWithdrawalFromReservesEvent.d.ts +19 -0
- package/build/client/vaults/types/executeWithdrawalFromReservesEvent.js +48 -0
- package/build/client/vaults/types/executeWithdrawalFromReservesEvent.js.map +1 -0
- package/build/client/vaults/types/fillParam.d.ts +1 -10
- package/build/client/vaults/types/finalizeProposalEvent.d.ts +1 -34
- package/build/client/vaults/types/hook.d.ts +1 -35
- package/build/client/vaults/types/hookCompiledInstruction.d.ts +1 -13
- package/build/client/vaults/types/index.d.ts +3 -0
- package/build/client/vaults/types/index.js +3 -0
- package/build/client/vaults/types/index.js.map +1 -1
- package/build/client/vaults/types/instructionConstraint.d.ts +1 -165
- package/build/client/vaults/types/internalFundTransferPolicyCreationPayload.d.ts +1 -13
- package/build/client/vaults/types/kaminoFarmEntry.d.ts +1 -10
- package/build/client/vaults/types/kaminoObligationEntry.d.ts +1 -122
- package/build/client/vaults/types/limitedQuantityConstraints.d.ts +1 -7
- package/build/client/vaults/types/limitedSpendingLimit.d.ts +1 -97
- package/build/client/vaults/types/limitedTimeConstraints.d.ts +1 -61
- package/build/client/vaults/types/loopscaleLoanEntry.d.ts +1 -7
- package/build/client/vaults/types/loopscaleStrategyEntry.d.ts +1 -7
- package/build/client/vaults/types/number.d.ts +1 -1
- package/build/client/vaults/types/obligationType.d.ts +1 -1
- package/build/client/vaults/types/obligationType.js +3 -3
- package/build/client/vaults/types/obligationType.js.map +1 -1
- package/build/client/vaults/types/orderbookEntry.d.ts +1 -54
- package/build/client/vaults/types/periodV2.d.ts +1 -37
- package/build/client/vaults/types/periodV2.js +3 -3
- package/build/client/vaults/types/periodV2.js.map +1 -1
- package/build/client/vaults/types/permissions.d.ts +1 -7
- package/build/client/vaults/types/policyAction.d.ts +1 -40
- package/build/client/vaults/types/policyAction.js +3 -3
- package/build/client/vaults/types/policyAction.js.map +1 -1
- package/build/client/vaults/types/policyCreationPayload.d.ts +1 -260
- package/build/client/vaults/types/policyCreationPayload.js +3 -3
- package/build/client/vaults/types/policyCreationPayload.js.map +1 -1
- package/build/client/vaults/types/policyExpirationArgs.d.ts +1 -19
- package/build/client/vaults/types/policyExpirationArgs.js +3 -3
- package/build/client/vaults/types/policyExpirationArgs.js.map +1 -1
- package/build/client/vaults/types/positionUpdate.js +3 -3
- package/build/client/vaults/types/positionUpdate.js.map +1 -1
- package/build/client/vaults/types/priceId.d.ts +1 -25
- package/build/client/vaults/types/priceId.js +3 -3
- package/build/client/vaults/types/priceId.js.map +1 -1
- package/build/client/vaults/types/priceType.d.ts +1 -1
- package/build/client/vaults/types/proposalAction.d.ts +2 -204
- package/build/client/vaults/types/proposalAction.js +6 -3
- package/build/client/vaults/types/proposalAction.js.map +1 -1
- package/build/client/vaults/types/proposalActionKind.d.ts +1 -1
- package/build/client/vaults/types/proposalStatus.d.ts +1 -1
- package/build/client/vaults/types/proposalVoteConfig.d.ts +1 -34
- package/build/client/vaults/types/proposeActionEvent.d.ts +1 -34
- package/build/client/vaults/types/quantityConstraints.d.ts +1 -13
- package/build/client/vaults/types/queueWithdrawalEvent.d.ts +11 -0
- package/build/client/vaults/types/queueWithdrawalEvent.js +31 -0
- package/build/client/vaults/types/queueWithdrawalEvent.js.map +1 -0
- package/build/client/vaults/types/reserveFarmMapping.d.ts +1 -13
- package/build/client/vaults/types/reservePriceMapping.d.ts +1 -42
- package/build/client/vaults/types/settingsChangePolicyCreationPayload.d.ts +1 -77
- package/build/client/vaults/types/spendingLimitPolicyCreationPayload.d.ts +1 -130
- package/build/client/vaults/types/stakeVoteEvent.d.ts +1 -28
- package/build/client/vaults/types/strategyPosition.d.ts +1 -1
- package/build/client/vaults/types/strategyPosition.js +3 -3
- package/build/client/vaults/types/strategyPosition.js.map +1 -1
- package/build/client/vaults/types/timeConstraints.d.ts +1 -64
- package/build/client/vaults/types/tokenAccountBalance.d.ts +1 -45
- package/build/client/vaults/types/tokenAccountEntry.d.ts +1 -66
- package/build/client/vaults/types/tokenEntry.d.ts +1 -51
- package/build/client/vaults/types/unstakeVoteEvent.d.ts +1 -25
- package/build/client/vaults/types/updatePriceAction.d.ts +1 -124
- package/build/client/vaults/types/updatePriceAction.js +3 -3
- package/build/client/vaults/types/updatePriceAction.js.map +1 -1
- package/build/client/vaults/types/updatePriceInput.d.ts +1 -10
- package/build/client/vaults/types/usageState.d.ts +1 -10
- package/build/client/vaults/types/vaultConfig.d.ts +1 -74
- package/build/client/vaults/types/vaultFinancials.d.ts +1 -43
- package/build/client/vaults/types/vaultFlagAction.d.ts +1 -37
- package/build/client/vaults/types/vaultFlagAction.js +3 -3
- package/build/client/vaults/types/vaultFlagAction.js.map +1 -1
- package/build/client/vaults/types/vaultFlagsUpdatedEvent.d.ts +1 -16
- package/build/client/vaults/types/vaultRoleKind.d.ts +1 -1
- package/build/client/vaults/types/vaultRoles.d.ts +1 -16
- package/build/client/vaults/types/vaultSettingsAction.js +3 -3
- package/build/client/vaults/types/vaultSettingsAction.js.map +1 -1
- package/build/client/vaults/types/voteChoice.d.ts +1 -1
- package/build/client/vaults/types/withdrawalPeriodSettings.d.ts +1 -31
- package/build/client/vaults/types/withdrawalPeriodSettings.js +3 -3
- package/build/client/vaults/types/withdrawalPeriodSettings.js.map +1 -1
- package/build/client/vaults/types/withdrawalTokenFill.d.ts +1 -13
- package/build/client/vaults/types/yieldPositionEntry.d.ts +1 -45
- package/build/clmm/codamaEvents.d.ts +1 -2
- package/build/codamaEvents.d.ts +1 -2
- package/build/exponentVaults/aumCalculator.d.ts +0 -2
- package/build/exponentVaults/aumCalculator.js +20 -10
- package/build/exponentVaults/aumCalculator.js.map +1 -1
- package/build/exponentVaults/events.d.ts +1 -2
- package/build/exponentVaults/fetcher.js +4 -4
- package/build/exponentVaults/fetcher.js.map +1 -1
- package/build/exponentVaults/index.js +17 -7
- package/build/exponentVaults/index.js.map +1 -1
- package/build/exponentVaults/kamino-farms.d.ts +0 -2
- package/build/exponentVaults/kamino-farms.js +14 -14
- package/build/exponentVaults/kamino-farms.js.map +1 -1
- package/build/exponentVaults/kamino-markets.d.ts +394 -394
- package/build/exponentVaults/kamino-markets.js +2 -2
- package/build/exponentVaults/kamino-markets.js.map +1 -1
- package/build/exponentVaults/loopscale/helpers.js +6 -7
- package/build/exponentVaults/loopscale/helpers.js.map +1 -1
- package/build/exponentVaults/loopscale/prepared-transactions.js +1 -2
- package/build/exponentVaults/loopscale/prepared-transactions.js.map +1 -1
- package/build/exponentVaults/policyBuilders.d.ts +73 -75
- package/build/exponentVaults/policyBuilders.js +26 -27
- package/build/exponentVaults/policyBuilders.js.map +1 -1
- package/build/exponentVaults/policyMatcher.js +6 -7
- package/build/exponentVaults/policyMatcher.js.map +1 -1
- package/build/exponentVaults/pricePathResolver.js +7 -8
- package/build/exponentVaults/pricePathResolver.js.map +1 -1
- package/build/exponentVaults/scope-refresh.js +1 -2
- package/build/exponentVaults/scope-refresh.js.map +1 -1
- package/build/exponentVaults/squadsVaultTxnResolver/helpers.js +6 -7
- package/build/exponentVaults/squadsVaultTxnResolver/helpers.js.map +1 -1
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.js +5 -6
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.js.map +1 -1
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.js +1 -2
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.js.map +1 -1
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.js +1 -2
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.js.map +1 -1
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.js +1 -2
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.js.map +1 -1
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/titan.js +1 -2
- package/build/exponentVaults/squadsVaultTxnResolver/resolvers/titan.js.map +1 -1
- package/build/exponentVaults/squadsVaultTxnResolver/utils.d.ts +1 -3
- package/build/exponentVaults/squadsVaultTxnResolver/utils.js +1 -2
- package/build/exponentVaults/squadsVaultTxnResolver/utils.js.map +1 -1
- package/build/exponentVaults/syncTransaction.d.ts +1 -1
- package/build/exponentVaults/syncTransaction.js +4 -4
- package/build/exponentVaults/syncTransaction.js.map +1 -1
- package/build/exponentVaults/titan-quote.js +1 -2
- package/build/exponentVaults/titan-quote.js.map +1 -1
- package/build/exponentVaults/vault-interaction.d.ts +3 -2538
- package/build/exponentVaults/vault-interaction.js +34 -24
- package/build/exponentVaults/vault-interaction.js.map +1 -1
- package/build/exponentVaults/vault.d.ts +9 -25
- package/build/exponentVaults/vault.js +28 -12
- package/build/exponentVaults/vault.js.map +1 -1
- package/build/flavors.js +19 -20
- package/build/flavors.js.map +1 -1
- package/build/index.js +17 -7
- package/build/index.js.map +1 -1
- package/build/market.d.ts +31 -31
- package/build/market.js +17 -7
- package/build/market.js.map +1 -1
- package/build/marketThree.d.ts +42 -48
- package/build/marketThree.js +20 -8
- package/build/marketThree.js.map +1 -1
- package/build/orderbook/codamaEvents.d.ts +1 -2
- package/build/orderbook/index.js +17 -7
- package/build/orderbook/index.js.map +1 -1
- package/build/orderbook/math.d.ts +4 -4
- package/build/orderbook/math.js +13 -13
- package/build/orderbook/math.js.map +1 -1
- package/build/orderbook/orderbook.d.ts +19 -21
- package/build/orderbook/orderbook.js +17 -7
- package/build/orderbook/orderbook.js.map +1 -1
- package/build/orderbook/types.js +17 -7
- package/build/orderbook/types.js.map +1 -1
- package/build/orderbook/utils.js +6 -7
- package/build/orderbook/utils.js.map +1 -1
- package/build/syPosition.js +3 -4
- package/build/syPosition.js.map +1 -1
- package/build/tokenUtil.js +2 -3
- package/build/tokenUtil.js.map +1 -1
- package/build/utils/altUtil.js +2 -3
- package/build/utils/altUtil.js.map +1 -1
- package/build/utils/binSolver.js +1 -2
- package/build/utils/binSolver.js.map +1 -1
- package/build/utils/index.d.ts +2 -2
- package/build/utils/index.js +3 -4
- package/build/utils/index.js.map +1 -1
- package/build/vault.d.ts +11 -12
- package/build/vault.js +20 -10
- package/build/vault.js.map +1 -1
- package/build/ytPosition.d.ts +7 -7
- package/build/ytPosition.js +17 -7
- package/build/ytPosition.js.map +1 -1
- package/package.json +35 -33
- package/build/client/vaults/instructions/proposeAction.d.ts +0 -16
- package/build/client/vaults/instructions/proposeAction.js +0 -29
- package/build/client/vaults/instructions/proposeAction.js.map +0 -1
- package/build/exponentVaults/loopscale/client.test.d.ts +0 -1
- package/build/exponentVaults/loopscale/client.test.js +0 -183
- package/build/exponentVaults/loopscale/client.test.js.map +0 -1
- package/build/exponentVaults/loopscale/prepared-transactions.test.d.ts +0 -1
- package/build/exponentVaults/loopscale/prepared-transactions.test.js +0 -400
- package/build/exponentVaults/loopscale/prepared-transactions.test.js.map +0 -1
- package/build/exponentVaults/loopscale/response-plan.d.ts +0 -69
- package/build/exponentVaults/loopscale/response-plan.js +0 -141
- package/build/exponentVaults/loopscale/response-plan.js.map +0 -1
- package/build/exponentVaults/loopscale/response-plan.test.d.ts +0 -1
- package/build/exponentVaults/loopscale/response-plan.test.js +0 -139
- package/build/exponentVaults/loopscale/response-plan.test.js.map +0 -1
- package/build/exponentVaults/loopscale/send-plan.d.ts +0 -75
- package/build/exponentVaults/loopscale/send-plan.js +0 -235
- package/build/exponentVaults/loopscale/send-plan.js.map +0 -1
- package/build/exponentVaults/loopscale-client.d.ts +0 -130
- package/build/exponentVaults/loopscale-client.js +0 -489
- package/build/exponentVaults/loopscale-client.js.map +0 -1
- package/build/exponentVaults/loopscale-client.test.d.ts +0 -1
- package/build/exponentVaults/loopscale-client.test.js +0 -162
- package/build/exponentVaults/loopscale-client.test.js.map +0 -1
- package/build/exponentVaults/loopscale-client.types.d.ts +0 -425
- package/build/exponentVaults/loopscale-client.types.js +0 -3
- package/build/exponentVaults/loopscale-client.types.js.map +0 -1
- package/build/exponentVaults/loopscale-execution.d.ts +0 -125
- package/build/exponentVaults/loopscale-execution.js +0 -341
- package/build/exponentVaults/loopscale-execution.js.map +0 -1
- package/build/exponentVaults/loopscale-execution.test.d.ts +0 -1
- package/build/exponentVaults/loopscale-execution.test.js +0 -139
- package/build/exponentVaults/loopscale-execution.test.js.map +0 -1
- package/build/exponentVaults/loopscale-vault.d.ts +0 -115
- package/build/exponentVaults/loopscale-vault.js +0 -275
- package/build/exponentVaults/loopscale-vault.js.map +0 -1
- package/build/exponentVaults/loopscale-vault.test.d.ts +0 -1
- package/build/exponentVaults/loopscale-vault.test.js +0 -102
- package/build/exponentVaults/loopscale-vault.test.js.map +0 -1
- package/build/exponentVaults/pricePathResolver.test.d.ts +0 -1
- package/build/exponentVaults/pricePathResolver.test.js +0 -369
- package/build/exponentVaults/pricePathResolver.test.js.map +0 -1
- package/build/exponentVaults/vault-interaction.kamino-vault.test.d.ts +0 -1
- package/build/exponentVaults/vault-interaction.kamino-vault.test.js +0 -143
- package/build/exponentVaults/vault-interaction.kamino-vault.test.js.map +0 -1
- package/build/exponentVaults/vaultTransactionBuilder.test.d.ts +0 -1
- package/build/exponentVaults/vaultTransactionBuilder.test.js +0 -297
- package/build/exponentVaults/vaultTransactionBuilder.test.js.map +0 -1
- package/build/marketThree.test.d.ts +0 -1
- package/build/marketThree.test.js +0 -166
- package/build/marketThree.test.js.map +0 -1
- package/build/utils/binSolver.test.d.ts +0 -1
- package/build/utils/binSolver.test.js +0 -16
- package/build/utils/binSolver.test.js.map +0 -1
- package/jest.config.js +0 -5
- package/src/CodamaEventDecoder.ts +0 -151
- package/src/addressLookupTableUtil.ts +0 -110
- package/src/client/clmm/accounts/lpPosition.ts +0 -143
- package/src/client/clmm/accounts/marketThree.ts +0 -274
- package/src/client/clmm/accounts/vault.ts +0 -234
- package/src/client/clmm/eventRegistry.ts +0 -92
- package/src/client/clmm/index.ts +0 -82
- package/src/client/clmm/instructions/addFarm.ts +0 -57
- package/src/client/clmm/instructions/addLiquidity.ts +0 -78
- package/src/client/clmm/instructions/addMarketEmission.ts +0 -50
- package/src/client/clmm/instructions/buyPt.ts +0 -73
- package/src/client/clmm/instructions/buyYt.ts +0 -80
- package/src/client/clmm/instructions/claimFarmEmission.ts +0 -56
- package/src/client/clmm/instructions/closeMarket.ts +0 -47
- package/src/client/clmm/instructions/depositLiquidity.ts +0 -71
- package/src/client/clmm/instructions/initializeMarket.ts +0 -127
- package/src/client/clmm/instructions/marketAccrueEmission.ts +0 -39
- package/src/client/clmm/instructions/marketCollectEmission.ts +0 -57
- package/src/client/clmm/instructions/modifyFarm.ts +0 -55
- package/src/client/clmm/instructions/modifyMarketSetting.ts +0 -45
- package/src/client/clmm/instructions/sellPt.ts +0 -73
- package/src/client/clmm/instructions/sellYt.ts +0 -80
- package/src/client/clmm/instructions/tradePt.ts +0 -73
- package/src/client/clmm/instructions/tradePtExactOut.ts +0 -75
- package/src/client/clmm/instructions/withdrawLiquidity.ts +0 -67
- package/src/client/clmm/instructions/wrapperBuyYt.ts +0 -85
- package/src/client/clmm/instructions/wrapperProvideLiquidity.ts +0 -100
- package/src/client/clmm/instructions/wrapperProvideLiquidityBase.ts +0 -98
- package/src/client/clmm/instructions/wrapperProvideLiquidityClassic.ts +0 -86
- package/src/client/clmm/instructions/wrapperSellYt.ts +0 -83
- package/src/client/clmm/instructions/wrapperWithdrawLiquidity.ts +0 -75
- package/src/client/clmm/instructions/wrapperWithdrawLiquidityClassic.ts +0 -69
- package/src/client/clmm/types/addFarmEvent.ts +0 -51
- package/src/client/clmm/types/amount.ts +0 -51
- package/src/client/clmm/types/buyPtEvent.ts +0 -36
- package/src/client/clmm/types/buyYtEvent.ts +0 -74
- package/src/client/clmm/types/claimFarmEmissionsEvent.ts +0 -94
- package/src/client/clmm/types/claimLimits.ts +0 -15
- package/src/client/clmm/types/closeMarketEvent.ts +0 -36
- package/src/client/clmm/types/configurationOptions.ts +0 -29
- package/src/client/clmm/types/cpiAccounts.ts +0 -21
- package/src/client/clmm/types/cpiCoreAccounts.ts +0 -15
- package/src/client/clmm/types/cpiInterfaceContext.ts +0 -13
- package/src/client/clmm/types/crossingSplit.ts +0 -40
- package/src/client/clmm/types/depositLiquidityEvent.ts +0 -93
- package/src/client/clmm/types/depositLiquidityReturnData.ts +0 -81
- package/src/client/clmm/types/emissionInfo.ts +0 -44
- package/src/client/clmm/types/farmEmission.ts +0 -31
- package/src/client/clmm/types/index.ts +0 -48
- package/src/client/clmm/types/liquidityNetBalanceLimits.ts +0 -22
- package/src/client/clmm/types/lpFarm.ts +0 -12
- package/src/client/clmm/types/marketAccrueEmissionEvent.ts +0 -69
- package/src/client/clmm/types/marketAdminAction.ts +0 -239
- package/src/client/clmm/types/marketCollectEmissionEvent.ts +0 -83
- package/src/client/clmm/types/marketEmission.ts +0 -28
- package/src/client/clmm/types/marketEmissions.ts +0 -10
- package/src/client/clmm/types/marketFinancials.ts +0 -17
- package/src/client/clmm/types/marketThreeInitEvent.ts +0 -92
- package/src/client/clmm/types/mergeEvent.ts +0 -118
- package/src/client/clmm/types/modifiedTick.ts +0 -13
- package/src/client/clmm/types/modifiedTicks.ts +0 -18
- package/src/client/clmm/types/modifyFarmEvent.ts +0 -56
- package/src/client/clmm/types/number.ts +0 -7
- package/src/client/clmm/types/personalYieldTracker.ts +0 -12
- package/src/client/clmm/types/personalYieldTrackers.ts +0 -13
- package/src/client/clmm/types/principalShare.ts +0 -22
- package/src/client/clmm/types/principalShareTrackers.ts +0 -10
- package/src/client/clmm/types/sellPtEvent.ts +0 -36
- package/src/client/clmm/types/sellYtEvent.ts +0 -69
- package/src/client/clmm/types/stripEvent.ts +0 -124
- package/src/client/clmm/types/swapDirection.ts +0 -8
- package/src/client/clmm/types/tradePtEvent.ts +0 -76
- package/src/client/clmm/types/withdrawLiquidityEvent.ts +0 -99
- package/src/client/clmm/types/withdrawLiquidityReturnData.ts +0 -27
- package/src/client/clmm/types/wrapperBuyYtEvent.ts +0 -36
- package/src/client/clmm/types/wrapperProvideLiquidityBaseEvent.ts +0 -60
- package/src/client/clmm/types/wrapperProvideLiquidityClassicEvent.ts +0 -58
- package/src/client/clmm/types/wrapperProvideLiquidityEvent.ts +0 -60
- package/src/client/clmm/types/wrapperSellYtEvent.ts +0 -36
- package/src/client/clmm/types/wrapperWithdrawLiquidityClassicEvent.ts +0 -62
- package/src/client/clmm/types/wrapperWithdrawLiquidityEvent.ts +0 -62
- package/src/client/core/accounts/admin.ts +0 -112
- package/src/client/core/accounts/lpPosition.ts +0 -122
- package/src/client/core/accounts/marketTwo.ts +0 -234
- package/src/client/core/accounts/vault.ts +0 -234
- package/src/client/core/accounts/yieldTokenPosition.ts +0 -126
- package/src/client/core/eventRegistry.ts +0 -134
- package/src/client/core/index.ts +0 -113
- package/src/client/core/instructions/addEmission.ts +0 -62
- package/src/client/core/instructions/addFarm.ts +0 -53
- package/src/client/core/instructions/addLpTokensMetadata.ts +0 -62
- package/src/client/core/instructions/addMarketEmission.ts +0 -52
- package/src/client/core/instructions/buyYt.ts +0 -79
- package/src/client/core/instructions/claimFarmEmissions.ts +0 -54
- package/src/client/core/instructions/collectEmission.ts +0 -66
- package/src/client/core/instructions/collectInterest.ts +0 -64
- package/src/client/core/instructions/collectTreasuryEmission.ts +0 -64
- package/src/client/core/instructions/collectTreasuryInterest.ts +0 -62
- package/src/client/core/instructions/depositYt.ts +0 -59
- package/src/client/core/instructions/initLpPosition.ts +0 -35
- package/src/client/core/instructions/initMarketTwo.ts +0 -103
- package/src/client/core/instructions/initializeVault.ts +0 -107
- package/src/client/core/instructions/initializeYieldPosition.ts +0 -33
- package/src/client/core/instructions/marketCollectEmission.ts +0 -55
- package/src/client/core/instructions/marketDepositLp.ts +0 -59
- package/src/client/core/instructions/marketTwoDepositLiquidity.ts +0 -65
- package/src/client/core/instructions/marketTwoWithdrawLiquidity.ts +0 -65
- package/src/client/core/instructions/marketWithdrawLp.ts +0 -59
- package/src/client/core/instructions/merge.ts +0 -61
- package/src/client/core/instructions/modifyFarm.ts +0 -51
- package/src/client/core/instructions/modifyMarketSetting.ts +0 -47
- package/src/client/core/instructions/modifyVaultSetting.ts +0 -44
- package/src/client/core/instructions/reallocMarket.ts +0 -45
- package/src/client/core/instructions/sellYt.ts +0 -79
- package/src/client/core/instructions/stageYtYield.ts +0 -39
- package/src/client/core/instructions/strip.ts +0 -61
- package/src/client/core/instructions/tradePt.ts +0 -59
- package/src/client/core/instructions/withdrawYt.ts +0 -61
- package/src/client/core/instructions/wrapperBuyPt.ts +0 -63
- package/src/client/core/instructions/wrapperBuyYt.ts +0 -93
- package/src/client/core/instructions/wrapperCollectInterest.ts +0 -63
- package/src/client/core/instructions/wrapperMerge.ts +0 -77
- package/src/client/core/instructions/wrapperProvideLiquidity.ts +0 -103
- package/src/client/core/instructions/wrapperProvideLiquidityBase.ts +0 -81
- package/src/client/core/instructions/wrapperProvideLiquidityClassic.ts +0 -77
- package/src/client/core/instructions/wrapperSellPt.ts +0 -63
- package/src/client/core/instructions/wrapperSellYt.ts +0 -87
- package/src/client/core/instructions/wrapperStrip.ts +0 -81
- package/src/client/core/instructions/wrapperWithdrawLiquidity.ts +0 -77
- package/src/client/core/instructions/wrapperWithdrawLiquidityClassic.ts +0 -73
- package/src/client/core/types/adminAction.ts +0 -255
- package/src/client/core/types/amount.ts +0 -51
- package/src/client/core/types/buyPtEvent.ts +0 -39
- package/src/client/core/types/buyYtEvent.ts +0 -95
- package/src/client/core/types/claimFarmEmissionsEvent.ts +0 -75
- package/src/client/core/types/claimFarmEmissionsEventV2.ts +0 -83
- package/src/client/core/types/claimLimits.ts +0 -15
- package/src/client/core/types/collectEmissionEvent.ts +0 -51
- package/src/client/core/types/collectEmissionEventV2.ts +0 -60
- package/src/client/core/types/collectInterestEvent.ts +0 -48
- package/src/client/core/types/collectInterestEventV2.ts +0 -57
- package/src/client/core/types/collectTreasuryEmissionKind.ts +0 -8
- package/src/client/core/types/collectTreasuryInterestKind.ts +0 -8
- package/src/client/core/types/cpiAccounts.ts +0 -21
- package/src/client/core/types/cpiInterfaceContext.ts +0 -13
- package/src/client/core/types/depositLiquidityEvent.ts +0 -101
- package/src/client/core/types/depositLpEvent.ts +0 -75
- package/src/client/core/types/depositLpEventV2.ts +0 -83
- package/src/client/core/types/depositYtEvent.ts +0 -82
- package/src/client/core/types/depositYtEventV2.ts +0 -91
- package/src/client/core/types/emissionInfo.ts +0 -44
- package/src/client/core/types/farmEmission.ts +0 -31
- package/src/client/core/types/index.ts +0 -60
- package/src/client/core/types/initLpPositionEvent.ts +0 -57
- package/src/client/core/types/initializeYieldPositionEvent.ts +0 -43
- package/src/client/core/types/liquidityNetBalanceLimits.ts +0 -22
- package/src/client/core/types/lpFarm.ts +0 -12
- package/src/client/core/types/marketAdminAction.ts +0 -212
- package/src/client/core/types/marketCollectEmissionEvent.ts +0 -67
- package/src/client/core/types/marketCollectEmissionEventV2.ts +0 -75
- package/src/client/core/types/marketEmission.ts +0 -28
- package/src/client/core/types/marketEmissions.ts +0 -10
- package/src/client/core/types/marketFinancials.ts +0 -19
- package/src/client/core/types/mergeEvent.ts +0 -118
- package/src/client/core/types/number.ts +0 -7
- package/src/client/core/types/personalYieldTracker.ts +0 -12
- package/src/client/core/types/personalYieldTrackers.ts +0 -13
- package/src/client/core/types/principleDetails.ts +0 -25
- package/src/client/core/types/principles.ts +0 -23
- package/src/client/core/types/sellPtEvent.ts +0 -39
- package/src/client/core/types/sellYtEvent.ts +0 -90
- package/src/client/core/types/stageYieldEvent.ts +0 -63
- package/src/client/core/types/stageYieldEventV2.ts +0 -69
- package/src/client/core/types/stripEvent.ts +0 -124
- package/src/client/core/types/tradePtEvent.ts +0 -80
- package/src/client/core/types/withdrawLiquidityEvent.ts +0 -97
- package/src/client/core/types/withdrawLpEvent.ts +0 -75
- package/src/client/core/types/withdrawLpEventV2.ts +0 -83
- package/src/client/core/types/withdrawYtEvent.ts +0 -82
- package/src/client/core/types/withdrawYtEventV2.ts +0 -91
- package/src/client/core/types/wrapperBuyYtEvent.ts +0 -39
- package/src/client/core/types/wrapperCollectInterestEvent.ts +0 -37
- package/src/client/core/types/wrapperMergeEvent.ts +0 -38
- package/src/client/core/types/wrapperProvideLiquidityBaseEvent.ts +0 -43
- package/src/client/core/types/wrapperProvideLiquidityClassicEvent.ts +0 -41
- package/src/client/core/types/wrapperProvideLiquidityEvent.ts +0 -41
- package/src/client/core/types/wrapperSellYtEvent.ts +0 -39
- package/src/client/core/types/wrapperStripEvent.ts +0 -38
- package/src/client/core/types/wrapperWithdrawLiquidityClassicEvent.ts +0 -41
- package/src/client/core/types/wrapperWithdrawLiquidityEvent.ts +0 -39
- package/src/client/core/types/yieldTokenTracker.ts +0 -12
- package/src/client/orderbook/accounts/cpiAccountsOrderbook.ts +0 -101
- package/src/client/orderbook/accounts/vault.ts +0 -234
- package/src/client/orderbook/eventRegistry.ts +0 -71
- package/src/client/orderbook/index.ts +0 -55
- package/src/client/orderbook/instructions/collectAdminEmission.ts +0 -48
- package/src/client/orderbook/instructions/collectAdminFee.ts +0 -59
- package/src/client/orderbook/instructions/collectInterest.ts +0 -66
- package/src/client/orderbook/instructions/initializeOrderbook.ts +0 -104
- package/src/client/orderbook/instructions/marketOffer.ts +0 -89
- package/src/client/orderbook/instructions/postOffer.ts +0 -96
- package/src/client/orderbook/instructions/reallocOrderbookAccount.ts +0 -45
- package/src/client/orderbook/instructions/removeExpiredOffers.ts +0 -37
- package/src/client/orderbook/instructions/removeOffer.ts +0 -73
- package/src/client/orderbook/instructions/setConfigurationOptions.ts +0 -43
- package/src/client/orderbook/instructions/withdrawFunds.ts +0 -78
- package/src/client/orderbook/instructions/wrapperCollectAdminFee.ts +0 -73
- package/src/client/orderbook/instructions/wrapperCollectInterest.ts +0 -65
- package/src/client/orderbook/instructions/wrapperMarketOffer.ts +0 -94
- package/src/client/orderbook/instructions/wrapperPostOffer.ts +0 -99
- package/src/client/orderbook/instructions/wrapperRemoveOffer.ts +0 -75
- package/src/client/orderbook/instructions/wrapperWithdrawFunds.ts +0 -80
- package/src/client/orderbook/types/amount.ts +0 -51
- package/src/client/orderbook/types/claimLimits.ts +0 -15
- package/src/client/orderbook/types/collectAdminEmissionEvent.ts +0 -39
- package/src/client/orderbook/types/collectAdminFeeEvent.ts +0 -17
- package/src/client/orderbook/types/collectEmissionEventV2.ts +0 -60
- package/src/client/orderbook/types/collectInterestEventV2.ts +0 -57
- package/src/client/orderbook/types/collectUserInterestEvent.ts +0 -36
- package/src/client/orderbook/types/cpiAccounts.ts +0 -21
- package/src/client/orderbook/types/cpiInterfaceContext.ts +0 -13
- package/src/client/orderbook/types/emissionInfo.ts +0 -44
- package/src/client/orderbook/types/exponentCoreCpiAccounts.ts +0 -21
- package/src/client/orderbook/types/filledOffersEvent.ts +0 -19
- package/src/client/orderbook/types/index.ts +0 -30
- package/src/client/orderbook/types/marketOfferEvent.ts +0 -72
- package/src/client/orderbook/types/mergeEvent.ts +0 -118
- package/src/client/orderbook/types/number.ts +0 -7
- package/src/client/orderbook/types/offerOptions.ts +0 -56
- package/src/client/orderbook/types/offerType.ts +0 -8
- package/src/client/orderbook/types/orderbookInitEvent.ts +0 -54
- package/src/client/orderbook/types/postOfferEvent.ts +0 -78
- package/src/client/orderbook/types/removeOfferEvent.ts +0 -67
- package/src/client/orderbook/types/setConfigurationOptionsEnum.ts +0 -116
- package/src/client/orderbook/types/stripEvent.ts +0 -124
- package/src/client/orderbook/types/withdrawFundsEvent.ts +0 -65
- package/src/client/orderbook/types/wrapperCollectAdminFeeEvent.ts +0 -13
- package/src/client/orderbook/types/wrapperCollectInterestEvent.ts +0 -25
- package/src/client/orderbook/types/wrapperMarketOfferEvent.ts +0 -27
- package/src/client/orderbook/types/wrapperPostOfferEvent.ts +0 -72
- package/src/client/orderbook/types/wrapperRemoveOfferEvent.ts +0 -25
- package/src/client/orderbook/types/wrapperWithdrawFundsEvent.ts +0 -38
- package/src/client/orderbook/types/yieldTokenTracker.ts +0 -12
- package/src/client/vaults/accounts/actionProposal.ts +0 -144
- package/src/client/vaults/accounts/exponentStrategyVault.ts +0 -211
- package/src/client/vaults/accounts/programConfig.ts +0 -123
- package/src/client/vaults/accounts/voteAccount.ts +0 -132
- package/src/client/vaults/accounts/withdrawalAccount.ts +0 -132
- package/src/client/vaults/eventRegistry.ts +0 -45
- package/src/client/vaults/index.ts +0 -113
- package/src/client/vaults/instructions/activateProposal.ts +0 -46
- package/src/client/vaults/instructions/addPolicy.ts +0 -57
- package/src/client/vaults/instructions/appendProposalActions.ts +0 -47
- package/src/client/vaults/instructions/cancelProposal.ts +0 -28
- package/src/client/vaults/instructions/cancelWithdrawal.ts +0 -34
- package/src/client/vaults/instructions/collectManagementFee.ts +0 -32
- package/src/client/vaults/instructions/depositLiquidity.ts +0 -62
- package/src/client/vaults/instructions/executeProposal.ts +0 -36
- package/src/client/vaults/instructions/executeWithdrawal.ts +0 -58
- package/src/client/vaults/instructions/executeWithdrawalFromReserves.ts +0 -66
- package/src/client/vaults/instructions/fillWithdrawal.ts +0 -59
- package/src/client/vaults/instructions/finalizeProposal.ts +0 -28
- package/src/client/vaults/instructions/initProposal.ts +0 -46
- package/src/client/vaults/instructions/initializePrices.ts +0 -28
- package/src/client/vaults/instructions/initializeVault.ts +0 -148
- package/src/client/vaults/instructions/makeSentienelManager.ts +0 -28
- package/src/client/vaults/instructions/managePrices.ts +0 -46
- package/src/client/vaults/instructions/manageVaultSettings.ts +0 -48
- package/src/client/vaults/instructions/managerUpdatePosition.ts +0 -45
- package/src/client/vaults/instructions/queueWithdrawal.ts +0 -50
- package/src/client/vaults/instructions/removePolicy.ts +0 -44
- package/src/client/vaults/instructions/sentinelSetVaultFlags.ts +0 -44
- package/src/client/vaults/instructions/stakeVote.ts +0 -57
- package/src/client/vaults/instructions/unstakeVote.ts +0 -42
- package/src/client/vaults/instructions/updatePolicy.ts +0 -59
- package/src/client/vaults/instructions/updatePolicyManager.ts +0 -44
- package/src/client/vaults/instructions/updatePrice.ts +0 -42
- package/src/client/vaults/instructions/validateInteractionHook.ts +0 -60
- package/src/client/vaults/instructions/wrapperAddPolicy.ts +0 -57
- package/src/client/vaults/instructions/wrapperExecuteWithdrawal.ts +0 -76
- package/src/client/vaults/instructions/wrapperManageVaultSettings.ts +0 -48
- package/src/client/vaults/instructions/wrapperManagerUpdatePosition.ts +0 -45
- package/src/client/vaults/instructions/wrapperRemovePolicy.ts +0 -44
- package/src/client/vaults/instructions/wrapperUpdatePolicy.ts +0 -59
- package/src/client/vaults/types/accountConstraint.ts +0 -35
- package/src/client/vaults/types/accountConstraintType.ts +0 -93
- package/src/client/vaults/types/allowedSettingsChange.ts +0 -136
- package/src/client/vaults/types/cancelProposalEvent.ts +0 -47
- package/src/client/vaults/types/clmmPositionEntry.ts +0 -37
- package/src/client/vaults/types/dataConstraint.ts +0 -16
- package/src/client/vaults/types/dataOperator.ts +0 -13
- package/src/client/vaults/types/dataValue.ts +0 -119
- package/src/client/vaults/types/depositLiquidityEvent.ts +0 -89
- package/src/client/vaults/types/executeProposalEvent.ts +0 -47
- package/src/client/vaults/types/executeWithdrawalEvent.ts +0 -12
- package/src/client/vaults/types/fillParam.ts +0 -12
- package/src/client/vaults/types/finalizeProposalEvent.ts +0 -51
- package/src/client/vaults/types/hook.ts +0 -40
- package/src/client/vaults/types/hookCompiledInstruction.ts +0 -20
- package/src/client/vaults/types/index.ts +0 -68
- package/src/client/vaults/types/instructionConstraint.ts +0 -33
- package/src/client/vaults/types/internalFundTransferPolicyCreationPayload.ts +0 -35
- package/src/client/vaults/types/kaminoFarmEntry.ts +0 -32
- package/src/client/vaults/types/kaminoObligationEntry.ts +0 -51
- package/src/client/vaults/types/limitedQuantityConstraints.ts +0 -10
- package/src/client/vaults/types/limitedSpendingLimit.ts +0 -35
- package/src/client/vaults/types/limitedTimeConstraints.ts +0 -15
- package/src/client/vaults/types/loopscaleLoanEntry.ts +0 -23
- package/src/client/vaults/types/loopscaleStrategyEntry.ts +0 -23
- package/src/client/vaults/types/number.ts +0 -8
- package/src/client/vaults/types/obligationType.ts +0 -63
- package/src/client/vaults/types/orderbookEntry.ts +0 -50
- package/src/client/vaults/types/periodV2.ts +0 -76
- package/src/client/vaults/types/permissions.ts +0 -8
- package/src/client/vaults/types/policyAction.ts +0 -74
- package/src/client/vaults/types/policyConfig.ts +0 -32
- package/src/client/vaults/types/policyCreationPayload.ts +0 -147
- package/src/client/vaults/types/policyExpirationArgs.ts +0 -67
- package/src/client/vaults/types/positionUpdate.ts +0 -313
- package/src/client/vaults/types/priceId.ts +0 -57
- package/src/client/vaults/types/priceType.ts +0 -23
- package/src/client/vaults/types/programInteractionPolicyCreationPayload.ts +0 -32
- package/src/client/vaults/types/proposalAction.ts +0 -97
- package/src/client/vaults/types/proposalActionKind.ts +0 -11
- package/src/client/vaults/types/proposalStatus.ts +0 -13
- package/src/client/vaults/types/proposalVoteConfig.ts +0 -36
- package/src/client/vaults/types/proposeActionEvent.ts +0 -62
- package/src/client/vaults/types/quantityConstraints.ts +0 -14
- package/src/client/vaults/types/reserveFarmMapping.ts +0 -35
- package/src/client/vaults/types/reservePriceMapping.ts +0 -26
- package/src/client/vaults/types/settingsChangePolicyCreationPayload.ts +0 -14
- package/src/client/vaults/types/spendingLimitPolicyCreationPayload.ts +0 -54
- package/src/client/vaults/types/stakeVoteEvent.ts +0 -54
- package/src/client/vaults/types/strategyPosition.ts +0 -178
- package/src/client/vaults/types/timeConstraints.ts +0 -22
- package/src/client/vaults/types/tokenAccountBalance.ts +0 -35
- package/src/client/vaults/types/tokenAccountEntry.ts +0 -30
- package/src/client/vaults/types/tokenEntry.ts +0 -48
- package/src/client/vaults/types/unstakeVoteEvent.ts +0 -53
- package/src/client/vaults/types/updatePriceAction.ts +0 -268
- package/src/client/vaults/types/updatePriceInput.ts +0 -12
- package/src/client/vaults/types/usageState.ts +0 -12
- package/src/client/vaults/types/vaultConfig.ts +0 -38
- package/src/client/vaults/types/vaultFinancials.ts +0 -40
- package/src/client/vaults/types/vaultFlagAction.ts +0 -75
- package/src/client/vaults/types/vaultFlagsUpdatedEvent.ts +0 -37
- package/src/client/vaults/types/vaultRoleKind.ts +0 -11
- package/src/client/vaults/types/vaultRoles.ts +0 -59
- package/src/client/vaults/types/vaultSettingsAction.ts +0 -533
- package/src/client/vaults/types/voteChoice.ts +0 -9
- package/src/client/vaults/types/withdrawalPeriodSettings.ts +0 -83
- package/src/client/vaults/types/withdrawalTokenFill.ts +0 -35
- package/src/client/vaults/types/yieldPositionEntry.ts +0 -35
- package/src/clmm/codamaEvents.ts +0 -34
- package/src/clmm/index.ts +0 -1
- package/src/codamaEvents.ts +0 -27
- package/src/environment.ts +0 -21
- package/src/exponentVaults/aumCalculator.ts +0 -1350
- package/src/exponentVaults/events.ts +0 -15
- package/src/exponentVaults/fetcher.ts +0 -257
- package/src/exponentVaults/index.ts +0 -323
- package/src/exponentVaults/kamino-farms.ts +0 -538
- package/src/exponentVaults/kamino-markets.ts +0 -363
- package/src/exponentVaults/loopscale/client.ts +0 -808
- package/src/exponentVaults/loopscale/helpers.ts +0 -172
- package/src/exponentVaults/loopscale/index.ts +0 -57
- package/src/exponentVaults/loopscale/prepared-transactions.ts +0 -435
- package/src/exponentVaults/loopscale/prepared-types.ts +0 -73
- package/src/exponentVaults/loopscale/types.ts +0 -466
- package/src/exponentVaults/policyBuilders.ts +0 -1729
- package/src/exponentVaults/policyMatcher.ts +0 -895
- package/src/exponentVaults/pricePathResolver.test.ts +0 -466
- package/src/exponentVaults/pricePathResolver.ts +0 -273
- package/src/exponentVaults/scope-refresh.ts +0 -169
- package/src/exponentVaults/squadsVaultTxnResolver/constants.ts +0 -59
- package/src/exponentVaults/squadsVaultTxnResolver/helpers.ts +0 -355
- package/src/exponentVaults/squadsVaultTxnResolver/index.ts +0 -16
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/exponent.ts +0 -472
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/helpers.ts +0 -33
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/index.ts +0 -38
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/kamino.ts +0 -83
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/loopscale.ts +0 -94
- package/src/exponentVaults/squadsVaultTxnResolver/resolvers/titan.ts +0 -41
- package/src/exponentVaults/squadsVaultTxnResolver/squadsVaultTxnResolver.ts +0 -91
- package/src/exponentVaults/squadsVaultTxnResolver/types.ts +0 -171
- package/src/exponentVaults/squadsVaultTxnResolver/utils.ts +0 -3
- package/src/exponentVaults/syncTransaction.ts +0 -500
- package/src/exponentVaults/titan-quote.ts +0 -446
- package/src/exponentVaults/vault-instruction-types.ts +0 -493
- package/src/exponentVaults/vault-interaction.kamino-vault.test.ts +0 -149
- package/src/exponentVaults/vault-interaction.ts +0 -5498
- package/src/exponentVaults/vault.ts +0 -2667
- package/src/exponentVaults/vaultTransactionBuilder.test.ts +0 -349
- package/src/exponentVaults/vaultTransactionBuilder.ts +0 -933
- package/src/flavors.ts +0 -841
- package/src/index.ts +0 -26
- package/src/lpPosition.ts +0 -155
- package/src/market.ts +0 -2432
- package/src/marketThree.test.ts +0 -210
- package/src/marketThree.ts +0 -2861
- package/src/orderbook/codamaEvents.ts +0 -28
- package/src/orderbook/index.ts +0 -13
- package/src/orderbook/math.ts +0 -138
- package/src/orderbook/orderbook.ts +0 -1354
- package/src/orderbook/types.ts +0 -40
- package/src/orderbook/utils.ts +0 -66
- package/src/router.ts +0 -810
- package/src/syPosition.ts +0 -182
- package/src/tokenUtil.ts +0 -23
- package/src/utils/altUtil.ts +0 -52
- package/src/utils/binSolver.test.ts +0 -17
- package/src/utils/binSolver.ts +0 -44
- package/src/utils/index.ts +0 -33
- package/src/utils/ix.ts +0 -7
- package/src/vault.ts +0 -1033
- package/src/ytPosition.ts +0 -319
- package/tsconfig.json +0 -46
|
@@ -1,1354 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TOKEN_PROGRAM_ID,
|
|
3
|
-
createAssociatedTokenAccountIdempotentInstruction,
|
|
4
|
-
getAssociatedTokenAddressSync,
|
|
5
|
-
} from "@solana/spl-token"
|
|
6
|
-
|
|
7
|
-
import { EXPONENT_ADMIN_PROGRAM_ID, ExponentAdminPda } from "@exponent-labs/exponent-admin-pda"
|
|
8
|
-
import { ExponentFetcher } from "@exponent-labs/exponent-fetcher"
|
|
9
|
-
import { ExponentOrderbookPDA, ExponentPDA } from "@exponent-labs/exponent-pda"
|
|
10
|
-
import { AccountInfo, ConfigurationOptions, OrderbookState } from "@exponent-labs/exponent-types"
|
|
11
|
-
import { feeRate } from "@exponent-labs/market-math"
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
fetchAddressLookupTable,
|
|
15
|
-
makeCoreCpiAccountMetaLists,
|
|
16
|
-
makeCpiAccountMetaLists,
|
|
17
|
-
} from "../addressLookupTableUtil"
|
|
18
|
-
import { Environment } from "../environment"
|
|
19
|
-
import {
|
|
20
|
-
makeFlavorGenericSync,
|
|
21
|
-
makeFlavorJitoRestakingSync,
|
|
22
|
-
makeFlavorKaminoSync,
|
|
23
|
-
makeFlavorMarginfiSync,
|
|
24
|
-
makeFlavorPerenaSync,
|
|
25
|
-
} from "../flavors"
|
|
26
|
-
import { emitEventAuthority, uniqueRemainingAccounts } from "../utils"
|
|
27
|
-
import { Vault } from "../vault"
|
|
28
|
-
import {
|
|
29
|
-
MAX_FILLED_OFFERS,
|
|
30
|
-
PRICE_BASE_POINTS,
|
|
31
|
-
calcOutAmountOnCounterOfferFilling,
|
|
32
|
-
calcRemainingAmountOnCounterOfferFilling,
|
|
33
|
-
getOfferAmountToGet,
|
|
34
|
-
getOfferAmountToGetNoVirtual,
|
|
35
|
-
getOfferSize,
|
|
36
|
-
roundPriceApy,
|
|
37
|
-
} from "./math"
|
|
38
|
-
import { Offer, OfferType, OrderbookLoadOptions, QuoteDirection } from "./types"
|
|
39
|
-
import {
|
|
40
|
-
getOfferDirectionFromQuoteDirection,
|
|
41
|
-
getOfferType,
|
|
42
|
-
getOfferTypeFromTradeDirection,
|
|
43
|
-
isQuoteInputTokenBase,
|
|
44
|
-
isQuoteOutputTokenBase,
|
|
45
|
-
priceToImpliedRate,
|
|
46
|
-
} from "./utils"
|
|
47
|
-
|
|
48
|
-
import * as exponentCore from '../client/core';
|
|
49
|
-
import * as exponentOrderbook from '../client/orderbook';
|
|
50
|
-
import { PublicKey, Connection, SystemProgram, TransactionInstruction } from "@solana/web3.js"
|
|
51
|
-
|
|
52
|
-
export class Orderbook {
|
|
53
|
-
|
|
54
|
-
constructor(
|
|
55
|
-
public state: OrderbookState,
|
|
56
|
-
public selfAddress: PublicKey,
|
|
57
|
-
public env: Environment,
|
|
58
|
-
public connection: Connection,
|
|
59
|
-
public vaulLookupTable: PublicKey,
|
|
60
|
-
/** Vault instance - required for merge/strip which uses vault's SY position (owned by vault authority) */
|
|
61
|
-
public vault: Vault,
|
|
62
|
-
) {
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
static async load(
|
|
67
|
-
env: Environment,
|
|
68
|
-
connection: Connection,
|
|
69
|
-
address: PublicKey,
|
|
70
|
-
options: OrderbookLoadOptions = {},
|
|
71
|
-
vault?: Vault,
|
|
72
|
-
) {
|
|
73
|
-
const fetcher = new ExponentFetcher({ connection })
|
|
74
|
-
const orderbook = await fetcher.fetchOrderbook(address)
|
|
75
|
-
const pda = new ExponentOrderbookPDA()
|
|
76
|
-
const orderbookCpiAccounts = await fetcher.fetchOrderbookCpiAccounts(
|
|
77
|
-
pda.orderbookCpiAccounts({ orderbook: address }),
|
|
78
|
-
)
|
|
79
|
-
const altOrderbook = await fetchAddressLookupTable(connection, orderbook.addressLookupTable)
|
|
80
|
-
const cpiAccounts = makeCpiAccountMetaLists(altOrderbook, orderbookCpiAccounts.syCpiAccounts)
|
|
81
|
-
const cpiCoreAccounts = makeCoreCpiAccountMetaLists(altOrderbook, orderbookCpiAccounts.exponentCoreCpiAccounts)
|
|
82
|
-
const loadedVault = vault || (await Vault.load(env, connection, orderbook.vault))
|
|
83
|
-
const flavor = (() => {
|
|
84
|
-
switch (loadedVault.flavor.flavor) {
|
|
85
|
-
case "marginfi":
|
|
86
|
-
return makeFlavorMarginfiSync(loadedVault.flavor)
|
|
87
|
-
case "kamino":
|
|
88
|
-
return makeFlavorKaminoSync(loadedVault.flavor)
|
|
89
|
-
case "jitoRestaking":
|
|
90
|
-
return makeFlavorJitoRestakingSync(loadedVault.flavor)
|
|
91
|
-
case "perena":
|
|
92
|
-
return makeFlavorPerenaSync(loadedVault.flavor)
|
|
93
|
-
case "generic":
|
|
94
|
-
return makeFlavorGenericSync(loadedVault.flavor, options.syConfig)
|
|
95
|
-
default:
|
|
96
|
-
throw new Error(`Unknown flavor: ${loadedVault.flavor}`)
|
|
97
|
-
}
|
|
98
|
-
})()
|
|
99
|
-
|
|
100
|
-
const state: OrderbookState = {
|
|
101
|
-
...orderbook,
|
|
102
|
-
syCpiAccounts: cpiAccounts,
|
|
103
|
-
exponentCoreCpiAccounts: cpiCoreAccounts,
|
|
104
|
-
flavor,
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return new Orderbook(state, address, env, connection, loadedVault.addressLookupTable, loadedVault)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
async reload(conn: Connection = this.connection) {
|
|
111
|
-
const v = await Orderbook.load(this.env, conn, this.selfAddress)
|
|
112
|
-
this.state = v.state
|
|
113
|
-
;(this as { vault: Vault }).vault = v.vault
|
|
114
|
-
return v
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
get corePda() {
|
|
118
|
-
return new ExponentPDA()
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
get pda() {
|
|
122
|
-
return new ExponentOrderbookPDA()
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
get adminPda() {
|
|
126
|
-
return new ExponentAdminPda(EXPONENT_ADMIN_PROGRAM_ID)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
get eventAuthority() {
|
|
130
|
-
return emitEventAuthority(exponentOrderbook.EXPONENTORDERBOOK_PROGRAM_ID)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
get coreEventAuthority() {
|
|
134
|
-
return emitEventAuthority(this.state.exponentCoreProgram)
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
get mintYt() {
|
|
138
|
-
return this.corePda.mintYt({ vault: this.state.vault })
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
get mintPt() {
|
|
142
|
-
return this.corePda.mintPt({ vault: this.state.vault })
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
get syCpiAccounts() {
|
|
146
|
-
return this.state.syCpiAccounts
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
get exponentCoreCpiAccounts() {
|
|
150
|
-
return this.state.exponentCoreCpiAccounts
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
get flavor() {
|
|
154
|
-
return this.state.flavor
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
get secondsRemaining() {
|
|
158
|
-
return Math.max(this.state.financials.expirationTs - Math.floor(Date.now() / 1000), 0)
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/** Fee rate is 1 + the actual fee rate - is is for convenience with calculations
|
|
162
|
-
* A feeRate of 1.001 means the fee is 0.1%
|
|
163
|
-
* A feeRate of 1 means there is no fee
|
|
164
|
-
*/
|
|
165
|
-
get makerFeeRate() {
|
|
166
|
-
if (this.secondsRemaining == 0) {
|
|
167
|
-
return 1
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return feeRate({
|
|
171
|
-
lnFeeRateRoot: this.state.configurationOptions.lnMakerFeeRate,
|
|
172
|
-
secondsRemaining: this.secondsRemaining,
|
|
173
|
-
})
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
get takerFeeRate() {
|
|
177
|
-
if (this.secondsRemaining == 0) {
|
|
178
|
-
return 1
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return feeRate({
|
|
182
|
-
lnFeeRateRoot: this.state.configurationOptions.lnTakerFeeRate,
|
|
183
|
-
secondsRemaining: this.secondsRemaining,
|
|
184
|
-
})
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/** Post offer instruction */
|
|
188
|
-
ixPostOffer({
|
|
189
|
-
trader,
|
|
190
|
-
price,
|
|
191
|
-
amount,
|
|
192
|
-
offerType,
|
|
193
|
-
offerOption,
|
|
194
|
-
virtualOffer,
|
|
195
|
-
expirySeconds,
|
|
196
|
-
offerIdx,
|
|
197
|
-
mintSy,
|
|
198
|
-
ptSrc: ptSrcParam,
|
|
199
|
-
ytSrc: ytSrcParam,
|
|
200
|
-
sySrc: sySrcParam,
|
|
201
|
-
}: {
|
|
202
|
-
trader: PublicKey
|
|
203
|
-
price: number
|
|
204
|
-
amount: bigint
|
|
205
|
-
offerType: exponentOrderbook.OfferType
|
|
206
|
-
offerOption: exponentOrderbook.OfferOptions
|
|
207
|
-
virtualOffer: boolean
|
|
208
|
-
expirySeconds: number
|
|
209
|
-
offerIdx?: number | null
|
|
210
|
-
mintSy: PublicKey
|
|
211
|
-
ptSrc?: PublicKey
|
|
212
|
-
ytSrc?: PublicKey
|
|
213
|
-
sySrc?: PublicKey
|
|
214
|
-
}) {
|
|
215
|
-
const ptSrc = ptSrcParam || getAssociatedTokenAddressSync(this.mintPt, trader, true, TOKEN_PROGRAM_ID)
|
|
216
|
-
const ytSrc = ytSrcParam || getAssociatedTokenAddressSync(this.mintYt, trader, true, TOKEN_PROGRAM_ID)
|
|
217
|
-
const sySrc = sySrcParam || getAssociatedTokenAddressSync(mintSy, trader, true, TOKEN_PROGRAM_ID)
|
|
218
|
-
const impliedRate = priceToImpliedRate(price)
|
|
219
|
-
const cpiAccountOrderbook = this.pda.orderbookCpiAccounts({ orderbook: this.selfAddress })
|
|
220
|
-
const remainingAccounts = uniqueRemainingAccounts([
|
|
221
|
-
...this.syCpiAccounts.getSyState,
|
|
222
|
-
...this.exponentCoreCpiAccounts.mergeSy,
|
|
223
|
-
...this.exponentCoreCpiAccounts.stripSy,
|
|
224
|
-
...this.exponentCoreCpiAccounts.depositYt,
|
|
225
|
-
...this.exponentCoreCpiAccounts.withdrawYt,
|
|
226
|
-
// Merge uses vault's cpi_accounts.withdraw_sy - needs vault's SY position (owner = vault authority)
|
|
227
|
-
...this.vault.cpiAccounts.getSyState,
|
|
228
|
-
...this.vault.cpiAccounts.withdrawSy,
|
|
229
|
-
])
|
|
230
|
-
const ix = exponentOrderbook.createPostOfferInstruction(
|
|
231
|
-
{
|
|
232
|
-
trader,
|
|
233
|
-
orderbook: this.selfAddress,
|
|
234
|
-
vault: this.state.vault,
|
|
235
|
-
cpiAccountOrderbook,
|
|
236
|
-
yieldPosition: this.corePda.yieldPosition({ vault: this.state.vault, owner: this.selfAddress }),
|
|
237
|
-
tokenEscrowYt: this.pda.orderbookEscrowYt({ orderbook: this.selfAddress }),
|
|
238
|
-
tokenEscrowSy: this.pda.orderbookEscrowSy({ orderbook: this.selfAddress }),
|
|
239
|
-
tokenEscrowPt: this.pda.orderbookEscrowPt({ orderbook: this.selfAddress }),
|
|
240
|
-
tokenSyTrader: sySrc,
|
|
241
|
-
tokenYtTrader: ytSrc,
|
|
242
|
-
tokenPtTrader: ptSrc,
|
|
243
|
-
systemProgram: SystemProgram.programId,
|
|
244
|
-
syProgram: this.state.syProgram,
|
|
245
|
-
tokenProgram: TOKEN_PROGRAM_ID,
|
|
246
|
-
exponentCore: this.state.exponentCoreProgram,
|
|
247
|
-
addressLookupTable: this.state.addressLookupTable,
|
|
248
|
-
eventAuthority: this.eventAuthority,
|
|
249
|
-
program: exponentOrderbook.EXPONENTORDERBOOK_PROGRAM_ID,
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
priceApy: impliedRate,
|
|
253
|
-
amount,
|
|
254
|
-
offerTypeFlag: offerType,
|
|
255
|
-
virtualOffer,
|
|
256
|
-
expirySeconds,
|
|
257
|
-
options: offerOption,
|
|
258
|
-
offerIdx: offerIdx ?? null,
|
|
259
|
-
},
|
|
260
|
-
)
|
|
261
|
-
ix.keys.push(...remainingAccounts)
|
|
262
|
-
return ix
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/** Market offer instruction */
|
|
266
|
-
ixMarketOffer({
|
|
267
|
-
trader,
|
|
268
|
-
maxPriceApy,
|
|
269
|
-
amount,
|
|
270
|
-
minAmountOut,
|
|
271
|
-
offerType,
|
|
272
|
-
virtualOffer,
|
|
273
|
-
mintSy,
|
|
274
|
-
ptSrc: ptSrcParam,
|
|
275
|
-
ytSrc: ytSrcParam,
|
|
276
|
-
sySrc: sySrcParam,
|
|
277
|
-
}: {
|
|
278
|
-
trader: PublicKey
|
|
279
|
-
maxPriceApy: number
|
|
280
|
-
amount: bigint
|
|
281
|
-
minAmountOut: bigint
|
|
282
|
-
offerType: exponentOrderbook.OfferType
|
|
283
|
-
virtualOffer: boolean
|
|
284
|
-
mintSy: PublicKey
|
|
285
|
-
ptSrc?: PublicKey
|
|
286
|
-
ytSrc?: PublicKey
|
|
287
|
-
sySrc?: PublicKey
|
|
288
|
-
}) {
|
|
289
|
-
const ptSrc = ptSrcParam || getAssociatedTokenAddressSync(this.mintPt, trader, true, TOKEN_PROGRAM_ID)
|
|
290
|
-
const ytSrc = ytSrcParam || getAssociatedTokenAddressSync(this.mintYt, trader, true, TOKEN_PROGRAM_ID)
|
|
291
|
-
const sySrc = sySrcParam || getAssociatedTokenAddressSync(mintSy, trader, true, TOKEN_PROGRAM_ID)
|
|
292
|
-
const impliedRate = priceToImpliedRate(maxPriceApy)
|
|
293
|
-
const cpiAccountOrderbook = this.pda.orderbookCpiAccounts({ orderbook: this.selfAddress })
|
|
294
|
-
const remainingAccounts = uniqueRemainingAccounts([
|
|
295
|
-
...this.syCpiAccounts.getSyState,
|
|
296
|
-
...this.exponentCoreCpiAccounts.mergeSy,
|
|
297
|
-
...this.exponentCoreCpiAccounts.stripSy,
|
|
298
|
-
...this.exponentCoreCpiAccounts.depositYt,
|
|
299
|
-
...this.exponentCoreCpiAccounts.withdrawYt,
|
|
300
|
-
// Merge uses vault's cpi_accounts.withdraw_sy - needs vault's SY position (owner = vault authority)
|
|
301
|
-
...this.vault.cpiAccounts.getSyState,
|
|
302
|
-
...this.vault.cpiAccounts.withdrawSy,
|
|
303
|
-
])
|
|
304
|
-
const ix = exponentOrderbook.createMarketOfferInstruction(
|
|
305
|
-
{
|
|
306
|
-
trader,
|
|
307
|
-
orderbook: this.selfAddress,
|
|
308
|
-
vault: this.state.vault,
|
|
309
|
-
cpiAccountOrderbook,
|
|
310
|
-
yieldPosition: this.corePda.yieldPosition({ vault: this.state.vault, owner: this.selfAddress }),
|
|
311
|
-
tokenEscrowYt: this.pda.orderbookEscrowYt({ orderbook: this.selfAddress }),
|
|
312
|
-
tokenEscrowSy: this.pda.orderbookEscrowSy({ orderbook: this.selfAddress }),
|
|
313
|
-
tokenEscrowPt: this.pda.orderbookEscrowPt({ orderbook: this.selfAddress }),
|
|
314
|
-
tokenSyTrader: sySrc,
|
|
315
|
-
tokenYtTrader: ytSrc,
|
|
316
|
-
tokenPtTrader: ptSrc,
|
|
317
|
-
systemProgram: SystemProgram.programId,
|
|
318
|
-
syProgram: this.state.syProgram,
|
|
319
|
-
tokenProgram: TOKEN_PROGRAM_ID,
|
|
320
|
-
exponentCore: this.state.exponentCoreProgram,
|
|
321
|
-
addressLookupTable: this.state.addressLookupTable,
|
|
322
|
-
eventAuthority: this.eventAuthority,
|
|
323
|
-
program: exponentOrderbook.EXPONENTORDERBOOK_PROGRAM_ID,
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
maxPriceApy: impliedRate,
|
|
327
|
-
amount,
|
|
328
|
-
minAmountOut,
|
|
329
|
-
offerType,
|
|
330
|
-
virtualOffer,
|
|
331
|
-
},
|
|
332
|
-
)
|
|
333
|
-
ix.keys.push(...remainingAccounts)
|
|
334
|
-
return ix
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/** High trust set configuration options instruction */
|
|
338
|
-
ixSetConfigurationOptions({
|
|
339
|
-
admin,
|
|
340
|
-
configurationOptions,
|
|
341
|
-
}: {
|
|
342
|
-
admin: PublicKey
|
|
343
|
-
configurationOptions: ConfigurationOptions
|
|
344
|
-
}) {
|
|
345
|
-
return exponentOrderbook.createSetConfigurationOptionsInstruction(
|
|
346
|
-
{
|
|
347
|
-
adminSigner: admin,
|
|
348
|
-
orderbook: this.selfAddress,
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
setConfigurationOptionsEnum: exponentOrderbook.setConfigurationOptionsEnum(
|
|
352
|
-
"ThresholdAmount",
|
|
353
|
-
[BigInt(configurationOptions.thresholdAmount.toString())],
|
|
354
|
-
),
|
|
355
|
-
},
|
|
356
|
-
)
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Set a single configuration option on the orderbook.
|
|
361
|
-
*
|
|
362
|
-
* Each call sets exactly one of the four on-chain enum variants:
|
|
363
|
-
* { thresholdAmount: bigint } – minimum lot size (u64)
|
|
364
|
-
* { priceDecimals: number } – APY tick precision (u8), e.g. 6 → 0.0001% resolution
|
|
365
|
-
* { takerFeeRateBp: number } – ln-space taker fee rate (f64)
|
|
366
|
-
* { makerFeeRateBp: number } – ln-space maker fee rate (f64)
|
|
367
|
-
*/
|
|
368
|
-
ixSetConfigurationOption({
|
|
369
|
-
admin,
|
|
370
|
-
option,
|
|
371
|
-
}: {
|
|
372
|
-
admin: PublicKey
|
|
373
|
-
option:
|
|
374
|
-
| { thresholdAmount: bigint }
|
|
375
|
-
| { priceDecimals: number }
|
|
376
|
-
| { takerFeeRateBp: number }
|
|
377
|
-
| { makerFeeRateBp: number }
|
|
378
|
-
}) {
|
|
379
|
-
return Orderbook.buildSetConfigurationOptionIx({
|
|
380
|
-
orderbookAddress: this.selfAddress,
|
|
381
|
-
admin,
|
|
382
|
-
option,
|
|
383
|
-
})
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
/**
|
|
387
|
-
* Build a `setConfigurationOptions` instruction without loading the full orderbook.
|
|
388
|
-
*
|
|
389
|
-
* Use this when you only have the orderbook address and admin key — it avoids
|
|
390
|
-
* fetching the vault, ALT, or any other on-chain state.
|
|
391
|
-
*/
|
|
392
|
-
static buildSetConfigurationOptionIx({
|
|
393
|
-
orderbookAddress,
|
|
394
|
-
admin,
|
|
395
|
-
option,
|
|
396
|
-
}: {
|
|
397
|
-
orderbookAddress: PublicKey
|
|
398
|
-
admin: PublicKey
|
|
399
|
-
option:
|
|
400
|
-
| { thresholdAmount: bigint }
|
|
401
|
-
| { priceDecimals: number }
|
|
402
|
-
| { takerFeeRateBp: number }
|
|
403
|
-
| { makerFeeRateBp: number }
|
|
404
|
-
}) {
|
|
405
|
-
let enumArg: exponentOrderbook.SetConfigurationOptionsEnum
|
|
406
|
-
if ('thresholdAmount' in option) {
|
|
407
|
-
enumArg = exponentOrderbook.setConfigurationOptionsEnum("ThresholdAmount", [option.thresholdAmount])
|
|
408
|
-
} else if ('priceDecimals' in option) {
|
|
409
|
-
enumArg = exponentOrderbook.setConfigurationOptionsEnum("PriceDecimals", [option.priceDecimals])
|
|
410
|
-
} else if ('takerFeeRateBp' in option) {
|
|
411
|
-
enumArg = exponentOrderbook.setConfigurationOptionsEnum("TakerFeeRateBp", [option.takerFeeRateBp])
|
|
412
|
-
} else {
|
|
413
|
-
enumArg = exponentOrderbook.setConfigurationOptionsEnum("MakerFeeRateBp", [option.makerFeeRateBp])
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
return exponentOrderbook.createSetConfigurationOptionsInstruction(
|
|
417
|
-
{ adminSigner: admin, orderbook: orderbookAddress },
|
|
418
|
-
{ setConfigurationOptionsEnum: enumArg },
|
|
419
|
-
)
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
getOffers(): Offer[] {
|
|
423
|
-
const { offers, prices, userEscrows } = this.state
|
|
424
|
-
|
|
425
|
-
return offers.map((o) => {
|
|
426
|
-
//? pricePointer - 1 because of TreeNode allocator specifics
|
|
427
|
-
const priceApy = prices[o.pricePointer - 1]!.key / PRICE_BASE_POINTS
|
|
428
|
-
const userEscrow = userEscrows[o.userVaultPointer - 1]!.user
|
|
429
|
-
|
|
430
|
-
const type = getOfferType(o.orderTypeFlag)
|
|
431
|
-
|
|
432
|
-
return {
|
|
433
|
-
type,
|
|
434
|
-
priceApy,
|
|
435
|
-
amount: Number(o.amount.toString()),
|
|
436
|
-
userEscrow: userEscrow,
|
|
437
|
-
expiryAt: o.expiryAt,
|
|
438
|
-
createdAt: o.createdAt,
|
|
439
|
-
isVirtual: o.virtualOffer,
|
|
440
|
-
offerIndex: o.offerIndex,
|
|
441
|
-
}
|
|
442
|
-
})
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
/** Remove offer instruction */
|
|
446
|
-
ixRemoveOffer({
|
|
447
|
-
trader,
|
|
448
|
-
offerIdx,
|
|
449
|
-
mintSy,
|
|
450
|
-
ptSrc: ptSrcParam,
|
|
451
|
-
ytSrc: ytSrcParam,
|
|
452
|
-
sySrc: sySrcParam,
|
|
453
|
-
}: {
|
|
454
|
-
trader: PublicKey
|
|
455
|
-
offerIdx: number
|
|
456
|
-
mintSy: PublicKey
|
|
457
|
-
ptSrc?: PublicKey
|
|
458
|
-
ytSrc?: PublicKey
|
|
459
|
-
sySrc?: PublicKey
|
|
460
|
-
}) {
|
|
461
|
-
const ptSrc = ptSrcParam || getAssociatedTokenAddressSync(this.mintPt, trader, true, TOKEN_PROGRAM_ID)
|
|
462
|
-
const ytSrc = ytSrcParam || getAssociatedTokenAddressSync(this.mintYt, trader, true, TOKEN_PROGRAM_ID)
|
|
463
|
-
const sySrc = sySrcParam || getAssociatedTokenAddressSync(mintSy, trader, true, TOKEN_PROGRAM_ID)
|
|
464
|
-
const cpiAccountOrderbook = this.pda.orderbookCpiAccounts({ orderbook: this.selfAddress })
|
|
465
|
-
const ix = exponentOrderbook.createRemoveOfferInstruction(
|
|
466
|
-
{
|
|
467
|
-
trader,
|
|
468
|
-
orderbook: this.selfAddress,
|
|
469
|
-
vault: this.state.vault,
|
|
470
|
-
tokenEscrowYt: this.pda.orderbookEscrowYt({ orderbook: this.selfAddress }),
|
|
471
|
-
tokenEscrowSy: this.pda.orderbookEscrowSy({ orderbook: this.selfAddress }),
|
|
472
|
-
tokenEscrowPt: this.pda.orderbookEscrowPt({ orderbook: this.selfAddress }),
|
|
473
|
-
tokenSyTrader: sySrc,
|
|
474
|
-
tokenYtTrader: ytSrc,
|
|
475
|
-
tokenPtTrader: ptSrc,
|
|
476
|
-
systemProgram: SystemProgram.programId,
|
|
477
|
-
tokenProgram: TOKEN_PROGRAM_ID,
|
|
478
|
-
syProgram: this.state.syProgram,
|
|
479
|
-
exponentCore: this.state.exponentCoreProgram,
|
|
480
|
-
addressLookupTable: this.state.addressLookupTable,
|
|
481
|
-
cpiAccountOrderbook,
|
|
482
|
-
eventAuthority: this.eventAuthority,
|
|
483
|
-
program: exponentOrderbook.EXPONENTORDERBOOK_PROGRAM_ID,
|
|
484
|
-
},
|
|
485
|
-
{
|
|
486
|
-
offerIdx,
|
|
487
|
-
},
|
|
488
|
-
)
|
|
489
|
-
ix.keys.push(...this.syCpiAccounts.getSyState)
|
|
490
|
-
return ix
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
/** Post offer instruction
|
|
494
|
-
* @param offerIdx - Optional offer index for vault position tracking. Must be unique per trader when provided.
|
|
495
|
-
* For vault managers, this should be tracked in the vault's OrderbookEntry.offerIdxVec.
|
|
496
|
-
* Omit for direct user orders (no vault position tracking).
|
|
497
|
-
*/
|
|
498
|
-
async ixWrapperPostOffer({
|
|
499
|
-
trader,
|
|
500
|
-
setupPayer,
|
|
501
|
-
price,
|
|
502
|
-
amount,
|
|
503
|
-
offerType,
|
|
504
|
-
offerOption,
|
|
505
|
-
virtualOffer,
|
|
506
|
-
expirySeconds,
|
|
507
|
-
mintSy,
|
|
508
|
-
offerIdx,
|
|
509
|
-
ptSrc: ptSrcParam,
|
|
510
|
-
ytSrc: ytSrcParam,
|
|
511
|
-
sySrc: sySrcParam,
|
|
512
|
-
tokenBaseTrader: tokenBaseTraderParam,
|
|
513
|
-
}: {
|
|
514
|
-
trader: PublicKey
|
|
515
|
-
setupPayer?: PublicKey
|
|
516
|
-
price: number
|
|
517
|
-
amount: bigint
|
|
518
|
-
offerType: exponentOrderbook.OfferType
|
|
519
|
-
offerOption: exponentOrderbook.OfferOptions
|
|
520
|
-
virtualOffer: boolean
|
|
521
|
-
expirySeconds: number
|
|
522
|
-
mintSy: PublicKey
|
|
523
|
-
/** Offer index for vault position tracking. Omit for direct user orders. */
|
|
524
|
-
offerIdx?: number | null
|
|
525
|
-
ptSrc?: PublicKey
|
|
526
|
-
ytSrc?: PublicKey
|
|
527
|
-
sySrc?: PublicKey
|
|
528
|
-
tokenBaseTrader?: PublicKey
|
|
529
|
-
}) {
|
|
530
|
-
const ptSrc = ptSrcParam || getAssociatedTokenAddressSync(this.mintPt, trader, true, TOKEN_PROGRAM_ID)
|
|
531
|
-
const ytSrc = ytSrcParam || getAssociatedTokenAddressSync(this.mintYt, trader, true, TOKEN_PROGRAM_ID)
|
|
532
|
-
const sySrc = sySrcParam || getAssociatedTokenAddressSync(mintSy, trader, true, TOKEN_PROGRAM_ID)
|
|
533
|
-
const tokenBaseTrader =
|
|
534
|
-
tokenBaseTraderParam ||
|
|
535
|
-
getAssociatedTokenAddressSync(this.flavor.mintBase, trader, true, this.flavor.baseTokenProgram)
|
|
536
|
-
const impliedRate = priceToImpliedRate(price)
|
|
537
|
-
const cpiAccountOrderbook = this.pda.orderbookCpiAccounts({ orderbook: this.selfAddress })
|
|
538
|
-
const remainingAccounts = uniqueRemainingAccounts([
|
|
539
|
-
...this.syCpiAccounts.getSyState,
|
|
540
|
-
...this.exponentCoreCpiAccounts.mergeSy,
|
|
541
|
-
...this.exponentCoreCpiAccounts.stripSy,
|
|
542
|
-
...this.exponentCoreCpiAccounts.depositYt,
|
|
543
|
-
...this.exponentCoreCpiAccounts.withdrawYt,
|
|
544
|
-
// Merge uses vault's cpi_accounts.withdraw_sy - needs vault's SY position (owner = vault authority)
|
|
545
|
-
...this.vault.cpiAccounts.getSyState,
|
|
546
|
-
...this.vault.cpiAccounts.withdrawSy,
|
|
547
|
-
])
|
|
548
|
-
|
|
549
|
-
const ataPayer = setupPayer ?? trader
|
|
550
|
-
const tokenSyDepositorAtaIx = createAssociatedTokenAccountIdempotentInstruction(ataPayer, sySrc, trader, mintSy)
|
|
551
|
-
const tokenYtDepositorAtaIx = createAssociatedTokenAccountIdempotentInstruction(ataPayer, ytSrc, trader, this.mintYt)
|
|
552
|
-
const tokenPtDepositorAtaIx = createAssociatedTokenAccountIdempotentInstruction(ataPayer, ptSrc, trader, this.mintPt)
|
|
553
|
-
|
|
554
|
-
const mintSyIx = await this.flavor.ixMintSy({
|
|
555
|
-
amountBase: "0",
|
|
556
|
-
depositor: trader,
|
|
557
|
-
depositorBaseTokenAccount: tokenBaseTrader,
|
|
558
|
-
depositorSyTokenAccount: sySrc,
|
|
559
|
-
})
|
|
560
|
-
|
|
561
|
-
const mintSyRemAccounts = mintSyIx.keys
|
|
562
|
-
const ix = exponentOrderbook.createWrapperPostOfferInstruction(
|
|
563
|
-
{
|
|
564
|
-
trader,
|
|
565
|
-
orderbook: this.selfAddress,
|
|
566
|
-
vault: this.state.vault,
|
|
567
|
-
cpiAccountOrderbook,
|
|
568
|
-
yieldPosition: this.corePda.yieldPosition({ vault: this.state.vault, owner: this.selfAddress }),
|
|
569
|
-
tokenEscrowYt: this.pda.orderbookEscrowYt({ orderbook: this.selfAddress }),
|
|
570
|
-
tokenEscrowSy: this.pda.orderbookEscrowSy({ orderbook: this.selfAddress }),
|
|
571
|
-
tokenEscrowPt: this.pda.orderbookEscrowPt({ orderbook: this.selfAddress }),
|
|
572
|
-
tokenSyTrader: sySrc,
|
|
573
|
-
tokenYtTrader: ytSrc,
|
|
574
|
-
tokenPtTrader: ptSrc,
|
|
575
|
-
systemProgram: SystemProgram.programId,
|
|
576
|
-
syProgram: this.state.syProgram,
|
|
577
|
-
tokenProgram: TOKEN_PROGRAM_ID,
|
|
578
|
-
exponentCore: this.state.exponentCoreProgram,
|
|
579
|
-
addressLookupTable: this.state.addressLookupTable,
|
|
580
|
-
eventAuthority: this.eventAuthority,
|
|
581
|
-
program: exponentOrderbook.EXPONENTORDERBOOK_PROGRAM_ID,
|
|
582
|
-
},
|
|
583
|
-
{
|
|
584
|
-
priceApy: impliedRate,
|
|
585
|
-
amountBase: amount,
|
|
586
|
-
offerType,
|
|
587
|
-
virtualOffer,
|
|
588
|
-
expirySeconds,
|
|
589
|
-
options: offerOption,
|
|
590
|
-
offerIdx: offerIdx ?? null,
|
|
591
|
-
mintSyOrWithdrawYtAccountsUntil: mintSyRemAccounts.length,
|
|
592
|
-
},
|
|
593
|
-
)
|
|
594
|
-
ix.keys.push(...mintSyRemAccounts, ...remainingAccounts)
|
|
595
|
-
|
|
596
|
-
return { ix, setupIxs: [tokenSyDepositorAtaIx, tokenYtDepositorAtaIx, tokenPtDepositorAtaIx] }
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
/** Market offer instruction */
|
|
600
|
-
async ixWrapperMarketOffer({
|
|
601
|
-
trader,
|
|
602
|
-
setupPayer,
|
|
603
|
-
maxPriceApy,
|
|
604
|
-
amount,
|
|
605
|
-
offerType,
|
|
606
|
-
minAmountOut,
|
|
607
|
-
virtualOffer,
|
|
608
|
-
mintSy,
|
|
609
|
-
ptSrc: ptSrcParam,
|
|
610
|
-
ytSrc: ytSrcParam,
|
|
611
|
-
sySrc: sySrcParam,
|
|
612
|
-
tokenBaseTrader: tokenBaseTraderParam,
|
|
613
|
-
}: {
|
|
614
|
-
trader: PublicKey
|
|
615
|
-
setupPayer?: PublicKey
|
|
616
|
-
maxPriceApy: number
|
|
617
|
-
amount: bigint
|
|
618
|
-
offerType: exponentOrderbook.OfferType
|
|
619
|
-
minAmountOut: bigint
|
|
620
|
-
virtualOffer: boolean
|
|
621
|
-
mintSy: PublicKey
|
|
622
|
-
ptSrc?: PublicKey
|
|
623
|
-
ytSrc?: PublicKey
|
|
624
|
-
sySrc?: PublicKey
|
|
625
|
-
tokenBaseTrader?: PublicKey
|
|
626
|
-
}) {
|
|
627
|
-
const ptSrc = ptSrcParam || getAssociatedTokenAddressSync(this.mintPt, trader, true, TOKEN_PROGRAM_ID)
|
|
628
|
-
const ytSrc = ytSrcParam || getAssociatedTokenAddressSync(this.mintYt, trader, true, TOKEN_PROGRAM_ID)
|
|
629
|
-
const sySrc = sySrcParam || getAssociatedTokenAddressSync(mintSy, trader, true, TOKEN_PROGRAM_ID)
|
|
630
|
-
const tokenBaseTrader =
|
|
631
|
-
tokenBaseTraderParam ||
|
|
632
|
-
getAssociatedTokenAddressSync(this.flavor.mintBase, trader, true, this.flavor.baseTokenProgram)
|
|
633
|
-
const impliedRate = priceToImpliedRate(maxPriceApy)
|
|
634
|
-
const cpiAccountOrderbook = this.pda.orderbookCpiAccounts({ orderbook: this.selfAddress })
|
|
635
|
-
const remainingAccounts = uniqueRemainingAccounts([
|
|
636
|
-
...this.syCpiAccounts.getSyState,
|
|
637
|
-
...this.exponentCoreCpiAccounts.mergeSy,
|
|
638
|
-
...this.exponentCoreCpiAccounts.stripSy,
|
|
639
|
-
...this.exponentCoreCpiAccounts.depositYt,
|
|
640
|
-
...this.exponentCoreCpiAccounts.withdrawYt,
|
|
641
|
-
// Merge uses vault's cpi_accounts.withdraw_sy - needs vault's SY position (owner = vault authority)
|
|
642
|
-
...this.vault.cpiAccounts.getSyState,
|
|
643
|
-
...this.vault.cpiAccounts.withdrawSy,
|
|
644
|
-
])
|
|
645
|
-
|
|
646
|
-
const ataPayer = setupPayer ?? trader
|
|
647
|
-
const tokenSyDepositorAtaIx = createAssociatedTokenAccountIdempotentInstruction(ataPayer, sySrc, trader, mintSy)
|
|
648
|
-
const tokenYtDepositorAtaIx = createAssociatedTokenAccountIdempotentInstruction(ataPayer, ytSrc, trader, this.mintYt)
|
|
649
|
-
const tokenPtDepositorAtaIx = createAssociatedTokenAccountIdempotentInstruction(ataPayer, ptSrc, trader, this.mintPt)
|
|
650
|
-
|
|
651
|
-
const mintSyIx = await this.flavor.ixMintSy({
|
|
652
|
-
amountBase: "0",
|
|
653
|
-
depositor: trader,
|
|
654
|
-
depositorBaseTokenAccount: tokenBaseTrader,
|
|
655
|
-
depositorSyTokenAccount: sySrc,
|
|
656
|
-
})
|
|
657
|
-
|
|
658
|
-
const redeemSyIx = await this.flavor.ixRedeemSy({
|
|
659
|
-
amountSy: "0",
|
|
660
|
-
redeemer: trader,
|
|
661
|
-
redeemerBaseTokenAccount: tokenBaseTrader,
|
|
662
|
-
redeemerSyTokenAccount: sySrc,
|
|
663
|
-
})
|
|
664
|
-
|
|
665
|
-
const depositYtAccounts = this.depositYtAccounts({
|
|
666
|
-
owner: trader,
|
|
667
|
-
ytSrc: ytSrc,
|
|
668
|
-
})
|
|
669
|
-
const redeem_sy_or_deposit_yt_accounts =
|
|
670
|
-
(!virtualOffer && offerType == OfferType.SellYt) || (virtualOffer && offerType == OfferType.BuyYt)
|
|
671
|
-
? redeemSyIx.keys
|
|
672
|
-
: depositYtAccounts.keys
|
|
673
|
-
|
|
674
|
-
const mintSyRemAccounts = mintSyIx.keys
|
|
675
|
-
const redeem_sy_or_deposit_yt_accounts_untill = mintSyRemAccounts.length + redeem_sy_or_deposit_yt_accounts.length
|
|
676
|
-
const ix = exponentOrderbook.createWrapperMarketOfferInstruction(
|
|
677
|
-
{
|
|
678
|
-
trader,
|
|
679
|
-
orderbook: this.selfAddress,
|
|
680
|
-
vault: this.state.vault,
|
|
681
|
-
cpiAccountOrderbook,
|
|
682
|
-
yieldPosition: this.corePda.yieldPosition({ vault: this.state.vault, owner: this.selfAddress }),
|
|
683
|
-
tokenEscrowYt: this.pda.orderbookEscrowYt({ orderbook: this.selfAddress }),
|
|
684
|
-
tokenEscrowSy: this.pda.orderbookEscrowSy({ orderbook: this.selfAddress }),
|
|
685
|
-
tokenEscrowPt: this.pda.orderbookEscrowPt({ orderbook: this.selfAddress }),
|
|
686
|
-
tokenSyTrader: sySrc,
|
|
687
|
-
tokenYtTrader: ytSrc,
|
|
688
|
-
tokenPtTrader: ptSrc,
|
|
689
|
-
systemProgram: SystemProgram.programId,
|
|
690
|
-
syProgram: this.state.syProgram,
|
|
691
|
-
tokenProgram: TOKEN_PROGRAM_ID,
|
|
692
|
-
exponentCore: this.state.exponentCoreProgram,
|
|
693
|
-
addressLookupTable: this.state.addressLookupTable,
|
|
694
|
-
eventAuthority: this.eventAuthority,
|
|
695
|
-
program: exponentOrderbook.EXPONENTORDERBOOK_PROGRAM_ID,
|
|
696
|
-
},
|
|
697
|
-
{
|
|
698
|
-
maxPriceApy: impliedRate,
|
|
699
|
-
amountBase: amount,
|
|
700
|
-
minAmountOut,
|
|
701
|
-
offerType,
|
|
702
|
-
virtualOffer,
|
|
703
|
-
mintSyOrWithdrawYtAccountsUntil: mintSyRemAccounts.length,
|
|
704
|
-
redeemSyOrDepsoitYtAccountsUntil: redeem_sy_or_deposit_yt_accounts_untill,
|
|
705
|
-
},
|
|
706
|
-
)
|
|
707
|
-
ix.keys.push(...mintSyRemAccounts, ...redeem_sy_or_deposit_yt_accounts, ...remainingAccounts)
|
|
708
|
-
|
|
709
|
-
return { ix, setupIxs: [tokenSyDepositorAtaIx, tokenYtDepositorAtaIx, tokenPtDepositorAtaIx] }
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
/** Wrapper remove offer instruction */
|
|
713
|
-
async ixWrapperRemoveOffer({
|
|
714
|
-
trader,
|
|
715
|
-
offerIdx,
|
|
716
|
-
mintSy,
|
|
717
|
-
ptSrc: ptSrcParam,
|
|
718
|
-
ytSrc: ytSrcParam,
|
|
719
|
-
sySrc: sySrcParam,
|
|
720
|
-
tokenBaseTrader: tokenBaseTraderParam,
|
|
721
|
-
}: {
|
|
722
|
-
trader: PublicKey
|
|
723
|
-
offerIdx: number
|
|
724
|
-
mintSy: PublicKey
|
|
725
|
-
ptSrc?: PublicKey
|
|
726
|
-
ytSrc?: PublicKey
|
|
727
|
-
sySrc?: PublicKey
|
|
728
|
-
tokenBaseTrader?: PublicKey
|
|
729
|
-
}) {
|
|
730
|
-
const ptSrc = ptSrcParam || getAssociatedTokenAddressSync(this.mintPt, trader, true, TOKEN_PROGRAM_ID)
|
|
731
|
-
const ytSrc = ytSrcParam || getAssociatedTokenAddressSync(this.mintYt, trader, true, TOKEN_PROGRAM_ID)
|
|
732
|
-
const sySrc = sySrcParam || getAssociatedTokenAddressSync(mintSy, trader, true, TOKEN_PROGRAM_ID)
|
|
733
|
-
const cpiAccountOrderbook = this.pda.orderbookCpiAccounts({ orderbook: this.selfAddress })
|
|
734
|
-
const tokenBaseTrader =
|
|
735
|
-
tokenBaseTraderParam ||
|
|
736
|
-
getAssociatedTokenAddressSync(this.flavor.mintBase, trader, true, this.flavor.baseTokenProgram)
|
|
737
|
-
|
|
738
|
-
const redeemSyIx = await this.flavor.ixRedeemSy({
|
|
739
|
-
amountSy: "0",
|
|
740
|
-
redeemer: trader,
|
|
741
|
-
redeemerBaseTokenAccount: tokenBaseTrader,
|
|
742
|
-
redeemerSyTokenAccount: sySrc,
|
|
743
|
-
})
|
|
744
|
-
|
|
745
|
-
const remainingAccounts = uniqueRemainingAccounts([
|
|
746
|
-
...this.syCpiAccounts.getSyState,
|
|
747
|
-
...this.exponentCoreCpiAccounts.withdrawYt,
|
|
748
|
-
])
|
|
749
|
-
|
|
750
|
-
const redeemSyRemAccounts = redeemSyIx.keys
|
|
751
|
-
const ix = exponentOrderbook.createWrapperRemoveOfferInstruction(
|
|
752
|
-
{
|
|
753
|
-
trader,
|
|
754
|
-
orderbook: this.selfAddress,
|
|
755
|
-
vault: this.state.vault,
|
|
756
|
-
cpiAccountOrderbook,
|
|
757
|
-
tokenEscrowYt: this.pda.orderbookEscrowYt({ orderbook: this.selfAddress }),
|
|
758
|
-
tokenEscrowSy: this.pda.orderbookEscrowSy({ orderbook: this.selfAddress }),
|
|
759
|
-
tokenEscrowPt: this.pda.orderbookEscrowPt({ orderbook: this.selfAddress }),
|
|
760
|
-
tokenSyTrader: sySrc,
|
|
761
|
-
tokenYtTrader: ytSrc,
|
|
762
|
-
tokenPtTrader: ptSrc,
|
|
763
|
-
systemProgram: SystemProgram.programId,
|
|
764
|
-
syProgram: this.state.syProgram,
|
|
765
|
-
tokenProgram: TOKEN_PROGRAM_ID,
|
|
766
|
-
exponentCore: this.state.exponentCoreProgram,
|
|
767
|
-
addressLookupTable: this.state.addressLookupTable,
|
|
768
|
-
eventAuthority: this.eventAuthority,
|
|
769
|
-
program: exponentOrderbook.EXPONENTORDERBOOK_PROGRAM_ID,
|
|
770
|
-
},
|
|
771
|
-
{
|
|
772
|
-
offerIdx,
|
|
773
|
-
redeemSyAccountsUntil: redeemSyIx.keys.length,
|
|
774
|
-
},
|
|
775
|
-
)
|
|
776
|
-
ix.keys.push(...redeemSyRemAccounts, ...remainingAccounts)
|
|
777
|
-
return ix
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
/** Wrapper collect interest instruction */
|
|
781
|
-
async ixWrapperCollectInterest({
|
|
782
|
-
trader,
|
|
783
|
-
mintSy,
|
|
784
|
-
sySrc: sySrcParam,
|
|
785
|
-
tokenBaseTrader: tokenBaseTraderParam,
|
|
786
|
-
}: {
|
|
787
|
-
trader: PublicKey
|
|
788
|
-
mintSy: PublicKey
|
|
789
|
-
sySrc?: PublicKey
|
|
790
|
-
tokenBaseTrader?: PublicKey
|
|
791
|
-
}) {
|
|
792
|
-
const sySrc = sySrcParam || getAssociatedTokenAddressSync(mintSy, trader, true, TOKEN_PROGRAM_ID)
|
|
793
|
-
const cpiAccountOrderbook = this.pda.orderbookCpiAccounts({ orderbook: this.selfAddress })
|
|
794
|
-
const tokenBaseTrader =
|
|
795
|
-
tokenBaseTraderParam ||
|
|
796
|
-
getAssociatedTokenAddressSync(this.flavor.mintBase, trader, true, this.flavor.baseTokenProgram)
|
|
797
|
-
|
|
798
|
-
const redeemSyIx = await this.flavor.ixRedeemSy({
|
|
799
|
-
amountSy: "0",
|
|
800
|
-
redeemer: trader,
|
|
801
|
-
redeemerBaseTokenAccount: tokenBaseTrader,
|
|
802
|
-
redeemerSyTokenAccount: sySrc,
|
|
803
|
-
})
|
|
804
|
-
const remainingAccounts = uniqueRemainingAccounts([
|
|
805
|
-
...this.syCpiAccounts.getSyState,
|
|
806
|
-
...this.exponentCoreCpiAccounts.collectInterest,
|
|
807
|
-
...this.syCpiAccounts.withdrawSy,
|
|
808
|
-
])
|
|
809
|
-
const redeemSyRemAccounts = redeemSyIx.keys
|
|
810
|
-
const ix = exponentOrderbook.createWrapperCollectInterestInstruction(
|
|
811
|
-
{
|
|
812
|
-
trader,
|
|
813
|
-
orderbook: this.selfAddress,
|
|
814
|
-
vault: this.state.vault,
|
|
815
|
-
cpiAccountOrderbook,
|
|
816
|
-
tokenEscrowSy: this.pda.orderbookEscrowSy({ orderbook: this.selfAddress }),
|
|
817
|
-
tokenSyTrader: sySrc,
|
|
818
|
-
systemProgram: SystemProgram.programId,
|
|
819
|
-
syProgram: this.state.syProgram,
|
|
820
|
-
tokenProgram: TOKEN_PROGRAM_ID,
|
|
821
|
-
exponentCore: this.state.exponentCoreProgram,
|
|
822
|
-
addressLookupTable: this.state.addressLookupTable,
|
|
823
|
-
eventAuthority: this.eventAuthority,
|
|
824
|
-
program: exponentOrderbook.EXPONENTORDERBOOK_PROGRAM_ID,
|
|
825
|
-
},
|
|
826
|
-
{
|
|
827
|
-
redeemSyAccountsUntil: redeemSyIx.keys.length,
|
|
828
|
-
},
|
|
829
|
-
)
|
|
830
|
-
ix.keys.push(...redeemSyRemAccounts, ...remainingAccounts)
|
|
831
|
-
return ix
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
/** Wrapper withdraw funds instruction */
|
|
835
|
-
async ixWrapperWithdrawFunds({
|
|
836
|
-
trader,
|
|
837
|
-
mintSy,
|
|
838
|
-
ptAmount,
|
|
839
|
-
ytAmount,
|
|
840
|
-
syAmount,
|
|
841
|
-
ptSrc: ptSrcParam,
|
|
842
|
-
ytSrc: ytSrcParam,
|
|
843
|
-
sySrc: sySrcParam,
|
|
844
|
-
tokenBaseTrader: tokenBaseTraderParam,
|
|
845
|
-
}: {
|
|
846
|
-
trader: PublicKey
|
|
847
|
-
mintSy: PublicKey
|
|
848
|
-
ptAmount: exponentOrderbook.Amount
|
|
849
|
-
ytAmount: exponentOrderbook.Amount
|
|
850
|
-
syAmount: exponentOrderbook.Amount
|
|
851
|
-
ptSrc?: PublicKey
|
|
852
|
-
ytSrc?: PublicKey
|
|
853
|
-
sySrc?: PublicKey
|
|
854
|
-
tokenBaseTrader?: PublicKey
|
|
855
|
-
}) {
|
|
856
|
-
const ptSrc = ptSrcParam || getAssociatedTokenAddressSync(this.mintPt, trader, true, TOKEN_PROGRAM_ID)
|
|
857
|
-
const ytSrc = ytSrcParam || getAssociatedTokenAddressSync(this.mintYt, trader, true, TOKEN_PROGRAM_ID)
|
|
858
|
-
const sySrc = sySrcParam || getAssociatedTokenAddressSync(mintSy, trader, true, TOKEN_PROGRAM_ID)
|
|
859
|
-
|
|
860
|
-
const cpiAccountOrderbook = this.pda.orderbookCpiAccounts({ orderbook: this.selfAddress })
|
|
861
|
-
const tokenBaseTrader =
|
|
862
|
-
tokenBaseTraderParam ||
|
|
863
|
-
getAssociatedTokenAddressSync(this.flavor.mintBase, trader, true, this.flavor.baseTokenProgram)
|
|
864
|
-
|
|
865
|
-
const redeemSyIx = await this.flavor.ixRedeemSy({
|
|
866
|
-
amountSy: "0",
|
|
867
|
-
redeemer: trader,
|
|
868
|
-
redeemerBaseTokenAccount: tokenBaseTrader,
|
|
869
|
-
redeemerSyTokenAccount: sySrc,
|
|
870
|
-
})
|
|
871
|
-
|
|
872
|
-
const redeemSyRemAccounts = redeemSyIx.keys
|
|
873
|
-
|
|
874
|
-
const remainingAccounts = uniqueRemainingAccounts([
|
|
875
|
-
...this.syCpiAccounts.getSyState,
|
|
876
|
-
...this.exponentCoreCpiAccounts.withdrawYt,
|
|
877
|
-
])
|
|
878
|
-
|
|
879
|
-
const ix = exponentOrderbook.createWrapperWithdrawFundsInstruction(
|
|
880
|
-
{
|
|
881
|
-
trader,
|
|
882
|
-
orderbook: this.selfAddress,
|
|
883
|
-
vault: this.state.vault,
|
|
884
|
-
cpiAccountOrderbook,
|
|
885
|
-
tokenEscrowYt: this.pda.orderbookEscrowYt({ orderbook: this.selfAddress }),
|
|
886
|
-
tokenEscrowSy: this.pda.orderbookEscrowSy({ orderbook: this.selfAddress }),
|
|
887
|
-
tokenEscrowPt: this.pda.orderbookEscrowPt({ orderbook: this.selfAddress }),
|
|
888
|
-
tokenSyTrader: sySrc,
|
|
889
|
-
tokenYtTrader: ytSrc,
|
|
890
|
-
tokenPtTrader: ptSrc,
|
|
891
|
-
systemProgram: SystemProgram.programId,
|
|
892
|
-
syProgram: this.state.syProgram,
|
|
893
|
-
tokenProgram: TOKEN_PROGRAM_ID,
|
|
894
|
-
exponentCore: this.state.exponentCoreProgram,
|
|
895
|
-
addressLookupTable: this.state.addressLookupTable,
|
|
896
|
-
eventAuthority: this.eventAuthority,
|
|
897
|
-
program: exponentOrderbook.EXPONENTORDERBOOK_PROGRAM_ID,
|
|
898
|
-
},
|
|
899
|
-
{
|
|
900
|
-
ptAmountOptional: ptAmount,
|
|
901
|
-
ytAmountOptional: ytAmount,
|
|
902
|
-
syAmountOptional: syAmount,
|
|
903
|
-
redeemSyAccountsUntil: redeemSyIx.keys.length,
|
|
904
|
-
},
|
|
905
|
-
)
|
|
906
|
-
ix.keys.push(...redeemSyRemAccounts, ...remainingAccounts)
|
|
907
|
-
return ix
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
/** Wrapper collect admin fee instruction */
|
|
911
|
-
async ixWrapperCollectAdminFee({ admin, mintSy }: { admin: PublicKey; mintSy: PublicKey }) {
|
|
912
|
-
const ptSrc = getAssociatedTokenAddressSync(this.mintPt, admin, true, TOKEN_PROGRAM_ID)
|
|
913
|
-
const ytSrc = getAssociatedTokenAddressSync(this.mintYt, admin, true, TOKEN_PROGRAM_ID)
|
|
914
|
-
const sySrc = getAssociatedTokenAddressSync(mintSy, admin, true, TOKEN_PROGRAM_ID)
|
|
915
|
-
|
|
916
|
-
const cpiAccountOrderbook = this.pda.orderbookCpiAccounts({ orderbook: this.selfAddress })
|
|
917
|
-
const tokenBaseTrader = getAssociatedTokenAddressSync(
|
|
918
|
-
this.flavor.mintBase,
|
|
919
|
-
admin,
|
|
920
|
-
true,
|
|
921
|
-
this.flavor.baseTokenProgram,
|
|
922
|
-
)
|
|
923
|
-
|
|
924
|
-
const redeemSyIx = await this.flavor.ixRedeemSy({
|
|
925
|
-
amountSy: "0",
|
|
926
|
-
redeemer: admin,
|
|
927
|
-
redeemerBaseTokenAccount: tokenBaseTrader,
|
|
928
|
-
redeemerSyTokenAccount: sySrc,
|
|
929
|
-
})
|
|
930
|
-
|
|
931
|
-
const redeemSyRemAccounts = redeemSyIx.keys
|
|
932
|
-
|
|
933
|
-
const remainingAccounts = uniqueRemainingAccounts([
|
|
934
|
-
...this.syCpiAccounts.getSyState,
|
|
935
|
-
...this.exponentCoreCpiAccounts.collectInterest,
|
|
936
|
-
...this.exponentCoreCpiAccounts.withdrawYt,
|
|
937
|
-
])
|
|
938
|
-
|
|
939
|
-
const ix = exponentOrderbook.createWrapperCollectAdminFeeInstruction(
|
|
940
|
-
{
|
|
941
|
-
admin,
|
|
942
|
-
orderbook: this.selfAddress,
|
|
943
|
-
vault: this.state.vault,
|
|
944
|
-
cpiAccountOrderbook,
|
|
945
|
-
tokenEscrowYt: this.pda.orderbookEscrowYt({ orderbook: this.selfAddress }),
|
|
946
|
-
tokenEscrowSy: this.pda.orderbookEscrowSy({ orderbook: this.selfAddress }),
|
|
947
|
-
tokenEscrowPt: this.pda.orderbookEscrowPt({ orderbook: this.selfAddress }),
|
|
948
|
-
tokenSyAdmin: sySrc,
|
|
949
|
-
tokenYtAdmin: ytSrc,
|
|
950
|
-
tokenPtAdmin: ptSrc,
|
|
951
|
-
systemProgram: SystemProgram.programId,
|
|
952
|
-
syProgram: this.state.syProgram,
|
|
953
|
-
tokenProgram: TOKEN_PROGRAM_ID,
|
|
954
|
-
exponentCore: this.state.exponentCoreProgram,
|
|
955
|
-
addressLookupTable: this.state.addressLookupTable,
|
|
956
|
-
eventAuthority: this.eventAuthority,
|
|
957
|
-
program: exponentOrderbook.EXPONENTORDERBOOK_PROGRAM_ID,
|
|
958
|
-
},
|
|
959
|
-
{
|
|
960
|
-
redeemSyAccountsUntil: redeemSyIx.keys.length,
|
|
961
|
-
},
|
|
962
|
-
)
|
|
963
|
-
ix.keys.push(...redeemSyRemAccounts, ...remainingAccounts)
|
|
964
|
-
return ix
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
/** Wrapper collect admin emission instruction */
|
|
968
|
-
ixCollectAdminEmission({
|
|
969
|
-
emissionEscrow,
|
|
970
|
-
amount,
|
|
971
|
-
index,
|
|
972
|
-
treasuryEmissionTokenAccount,
|
|
973
|
-
tokenEmissionAdmin,
|
|
974
|
-
}: {
|
|
975
|
-
emissionEscrow: PublicKey
|
|
976
|
-
index: number
|
|
977
|
-
amount: exponentOrderbook.Amount
|
|
978
|
-
treasuryEmissionTokenAccount: PublicKey
|
|
979
|
-
tokenEmissionAdmin: PublicKey
|
|
980
|
-
}) {
|
|
981
|
-
const claimEmissionAccounts = this.collectAdminEmissionCoreAccounts({
|
|
982
|
-
emissionDst: tokenEmissionAdmin,
|
|
983
|
-
emissionEscrow,
|
|
984
|
-
treasuryEmissionTokenAccount,
|
|
985
|
-
})
|
|
986
|
-
const remainingAccounts = [...claimEmissionAccounts, ...this.syCpiAccounts.claimEmission[index]]
|
|
987
|
-
|
|
988
|
-
const ix = exponentOrderbook.createCollectAdminEmissionInstruction(
|
|
989
|
-
{
|
|
990
|
-
admin: this.state.admin,
|
|
991
|
-
orderbook: this.selfAddress,
|
|
992
|
-
exponentCore: this.state.exponentCoreProgram,
|
|
993
|
-
eventAuthority: this.eventAuthority,
|
|
994
|
-
program: exponentOrderbook.EXPONENTORDERBOOK_PROGRAM_ID,
|
|
995
|
-
},
|
|
996
|
-
{
|
|
997
|
-
amount,
|
|
998
|
-
index,
|
|
999
|
-
},
|
|
1000
|
-
)
|
|
1001
|
-
ix.keys.push(...remainingAccounts)
|
|
1002
|
-
return ix
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
collectAdminEmissionCoreAccounts({
|
|
1006
|
-
emissionDst,
|
|
1007
|
-
emissionEscrow,
|
|
1008
|
-
treasuryEmissionTokenAccount,
|
|
1009
|
-
}: {
|
|
1010
|
-
emissionDst: PublicKey
|
|
1011
|
-
emissionEscrow: PublicKey
|
|
1012
|
-
treasuryEmissionTokenAccount: PublicKey
|
|
1013
|
-
}): AccountInfo[] {
|
|
1014
|
-
return [
|
|
1015
|
-
{
|
|
1016
|
-
pubkey: this.selfAddress,
|
|
1017
|
-
isSigner: false,
|
|
1018
|
-
isWritable: true,
|
|
1019
|
-
},
|
|
1020
|
-
{
|
|
1021
|
-
pubkey: this.state.vault,
|
|
1022
|
-
isSigner: false,
|
|
1023
|
-
isWritable: true,
|
|
1024
|
-
},
|
|
1025
|
-
{
|
|
1026
|
-
pubkey: this.state.yieldPosition,
|
|
1027
|
-
isSigner: false,
|
|
1028
|
-
isWritable: true,
|
|
1029
|
-
},
|
|
1030
|
-
{
|
|
1031
|
-
pubkey: this.state.syProgram,
|
|
1032
|
-
isSigner: false,
|
|
1033
|
-
isWritable: false,
|
|
1034
|
-
},
|
|
1035
|
-
{
|
|
1036
|
-
pubkey: emissionEscrow,
|
|
1037
|
-
isSigner: false,
|
|
1038
|
-
isWritable: true,
|
|
1039
|
-
},
|
|
1040
|
-
{
|
|
1041
|
-
pubkey: emissionDst,
|
|
1042
|
-
isSigner: false,
|
|
1043
|
-
isWritable: true,
|
|
1044
|
-
},
|
|
1045
|
-
{
|
|
1046
|
-
pubkey: treasuryEmissionTokenAccount,
|
|
1047
|
-
isSigner: false,
|
|
1048
|
-
isWritable: true,
|
|
1049
|
-
},
|
|
1050
|
-
{
|
|
1051
|
-
pubkey: TOKEN_PROGRAM_ID,
|
|
1052
|
-
isSigner: false,
|
|
1053
|
-
isWritable: false,
|
|
1054
|
-
},
|
|
1055
|
-
{
|
|
1056
|
-
pubkey: this.coreEventAuthority,
|
|
1057
|
-
isSigner: false,
|
|
1058
|
-
isWritable: false,
|
|
1059
|
-
},
|
|
1060
|
-
{
|
|
1061
|
-
pubkey: this.state.exponentCoreProgram,
|
|
1062
|
-
isSigner: false,
|
|
1063
|
-
isWritable: false,
|
|
1064
|
-
},
|
|
1065
|
-
]
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
/** Wrapper collect admin fee instruction */
|
|
1069
|
-
ixRemoveExpiredOffers({ admin }: { admin: PublicKey }) {
|
|
1070
|
-
const cpiAccountOrderbook = this.pda.orderbookCpiAccounts({ orderbook: this.selfAddress })
|
|
1071
|
-
|
|
1072
|
-
const remainingAccounts = uniqueRemainingAccounts([...this.syCpiAccounts.getSyState])
|
|
1073
|
-
|
|
1074
|
-
const ix = exponentOrderbook.createRemoveExpiredOffersInstruction({
|
|
1075
|
-
admin,
|
|
1076
|
-
orderbook: this.selfAddress,
|
|
1077
|
-
vault: this.state.vault,
|
|
1078
|
-
syProgram: this.state.syProgram,
|
|
1079
|
-
addressLookupTable: this.state.addressLookupTable,
|
|
1080
|
-
cpiAccountOrderbook,
|
|
1081
|
-
eventAuthority: this.eventAuthority,
|
|
1082
|
-
program: exponentOrderbook.EXPONENTORDERBOOK_PROGRAM_ID,
|
|
1083
|
-
})
|
|
1084
|
-
ix.keys.push(...remainingAccounts)
|
|
1085
|
-
return ix
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
getQuote({
|
|
1089
|
-
priceApy: rawPriceApy,
|
|
1090
|
-
inAmount: inAmountRaw,
|
|
1091
|
-
direction,
|
|
1092
|
-
unixNow,
|
|
1093
|
-
syExchangeRate,
|
|
1094
|
-
}: {
|
|
1095
|
-
priceApy?: number //? In percents!!!
|
|
1096
|
-
inAmount: number //? In lamports
|
|
1097
|
-
unixNow: number //? Time is very important for calculations. Better to avoid using Date.now()
|
|
1098
|
-
direction: QuoteDirection
|
|
1099
|
-
syExchangeRate: number //? E.g. 1.000009210084
|
|
1100
|
-
}) {
|
|
1101
|
-
const offerDirection = getOfferDirectionFromQuoteDirection(direction)
|
|
1102
|
-
const { isVirtual: isQuoteVirtualOffer, offerType: quoteOfferType } = getOfferTypeFromTradeDirection(offerDirection)
|
|
1103
|
-
|
|
1104
|
-
//? If inAmount is in base, convert Base to SY
|
|
1105
|
-
const inAmount = isQuoteInputTokenBase(direction) ? inAmountRaw / syExchangeRate : inAmountRaw
|
|
1106
|
-
//? Offer on contract stores its APY price in ln(1+ apy) view. Convert it before all calculations
|
|
1107
|
-
const priceApy =
|
|
1108
|
-
rawPriceApy &&
|
|
1109
|
-
roundPriceApy(priceToImpliedRate(rawPriceApy), this.state.configurationOptions.priceDecimals) / PRICE_BASE_POINTS
|
|
1110
|
-
|
|
1111
|
-
const secUntilMaturity = this.state.financials.expirationTs - unixNow
|
|
1112
|
-
|
|
1113
|
-
//? If offerType === BuyYT, sort by priceApy asc, otherwise by priceApy desc
|
|
1114
|
-
const suitableOffersByType = this.getOffers()
|
|
1115
|
-
.filter(({ type, expiryAt, priceApy: offerPriceApy }) => {
|
|
1116
|
-
const isExpired = expiryAt < unixNow
|
|
1117
|
-
const satisfyPriceApy = (() => {
|
|
1118
|
-
if (!priceApy) return true
|
|
1119
|
-
if (quoteOfferType === OfferType.BuyYt) return offerPriceApy <= priceApy
|
|
1120
|
-
return offerPriceApy >= priceApy
|
|
1121
|
-
})()
|
|
1122
|
-
return type !== quoteOfferType && !isExpired && satisfyPriceApy
|
|
1123
|
-
})
|
|
1124
|
-
.sort((a, b) => {
|
|
1125
|
-
const expiryCompare = a.expiryAt - b.expiryAt
|
|
1126
|
-
//? If we buyYT -- sort priceApy ascending, otherwise descending
|
|
1127
|
-
if (quoteOfferType === OfferType.BuyYt) {
|
|
1128
|
-
return a.priceApy - b.priceApy || expiryCompare
|
|
1129
|
-
}
|
|
1130
|
-
return b.priceApy - a.priceApy || expiryCompare
|
|
1131
|
-
})
|
|
1132
|
-
|
|
1133
|
-
let remainingAmount = inAmount
|
|
1134
|
-
let outAmount = 0
|
|
1135
|
-
let offersUsed = 0
|
|
1136
|
-
let makerFees = 0
|
|
1137
|
-
let takerFees = 0
|
|
1138
|
-
suitableOffersByType.forEach((counterOffer) => {
|
|
1139
|
-
if (remainingAmount <= 0) return
|
|
1140
|
-
|
|
1141
|
-
if (offersUsed > MAX_FILLED_OFFERS) return
|
|
1142
|
-
|
|
1143
|
-
//? How much counter type tokens we request using current counter offer price+type
|
|
1144
|
-
//? Returns YT amount for SY->YT quote
|
|
1145
|
-
//? Returns SY amount for quote YT->SY quote
|
|
1146
|
-
//? Returns SY amount for SY->PT quote. How much SY should be (in theory) in counter offer to satisfy strip: SY_get->PT+YT
|
|
1147
|
-
//? Returns YT amount for PT->SY quote. YT amount in merge operation: PT+YT->SY
|
|
1148
|
-
const remainingAmountInCounterOfferToken = getOfferAmountToGet(
|
|
1149
|
-
{
|
|
1150
|
-
type: quoteOfferType,
|
|
1151
|
-
amount: remainingAmount,
|
|
1152
|
-
priceApy: counterOffer.priceApy,
|
|
1153
|
-
isVirtual: isQuoteVirtualOffer,
|
|
1154
|
-
userEscrow: PublicKey.default,
|
|
1155
|
-
expiryAt: Infinity,
|
|
1156
|
-
createdAt: unixNow,
|
|
1157
|
-
},
|
|
1158
|
-
syExchangeRate,
|
|
1159
|
-
secUntilMaturity,
|
|
1160
|
-
)
|
|
1161
|
-
|
|
1162
|
-
//? YT amount for SY->YT quote
|
|
1163
|
-
//? SY amount for quote YT->SY quote
|
|
1164
|
-
//? SY amount for SY->PT quote
|
|
1165
|
-
//? YT amount for PT->SY quote
|
|
1166
|
-
const offerSize = getOfferSize(counterOffer, secUntilMaturity, syExchangeRate)
|
|
1167
|
-
|
|
1168
|
-
if (remainingAmountInCounterOfferToken > offerSize) {
|
|
1169
|
-
//? How much token you can sell into this offer. To extract all the liquidity (offer.amount)
|
|
1170
|
-
const offerToGet = getOfferAmountToGetNoVirtual(
|
|
1171
|
-
{
|
|
1172
|
-
...counterOffer,
|
|
1173
|
-
amount: offerSize,
|
|
1174
|
-
},
|
|
1175
|
-
syExchangeRate,
|
|
1176
|
-
secUntilMaturity,
|
|
1177
|
-
)
|
|
1178
|
-
|
|
1179
|
-
const remainingAmountFromCounterOffer = calcRemainingAmountOnCounterOfferFilling(
|
|
1180
|
-
offerToGet,
|
|
1181
|
-
offerSize,
|
|
1182
|
-
isQuoteVirtualOffer,
|
|
1183
|
-
quoteOfferType,
|
|
1184
|
-
syExchangeRate,
|
|
1185
|
-
)
|
|
1186
|
-
|
|
1187
|
-
const outAmountFromCounterOffer = calcOutAmountOnCounterOfferFilling(
|
|
1188
|
-
offerToGet,
|
|
1189
|
-
offerSize,
|
|
1190
|
-
isQuoteVirtualOffer,
|
|
1191
|
-
quoteOfferType,
|
|
1192
|
-
counterOffer.isVirtual,
|
|
1193
|
-
syExchangeRate,
|
|
1194
|
-
this.makerFeeRate,
|
|
1195
|
-
this.takerFeeRate,
|
|
1196
|
-
)
|
|
1197
|
-
|
|
1198
|
-
remainingAmount -= remainingAmountFromCounterOffer
|
|
1199
|
-
outAmount += outAmountFromCounterOffer.outAmount
|
|
1200
|
-
makerFees += outAmountFromCounterOffer.tradeMakerFee
|
|
1201
|
-
takerFees += outAmountFromCounterOffer.tradeTakerFee
|
|
1202
|
-
} else {
|
|
1203
|
-
//? How much token you can sell into this offer. To extract all the liquidity (offer.amount)
|
|
1204
|
-
const offerToGet = getOfferAmountToGetNoVirtual(
|
|
1205
|
-
{
|
|
1206
|
-
...counterOffer,
|
|
1207
|
-
amount: remainingAmountInCounterOfferToken,
|
|
1208
|
-
},
|
|
1209
|
-
syExchangeRate,
|
|
1210
|
-
secUntilMaturity,
|
|
1211
|
-
)
|
|
1212
|
-
|
|
1213
|
-
const outAmountFromCounterOffer = calcOutAmountOnCounterOfferFilling(
|
|
1214
|
-
offerToGet,
|
|
1215
|
-
remainingAmountInCounterOfferToken,
|
|
1216
|
-
isQuoteVirtualOffer,
|
|
1217
|
-
quoteOfferType,
|
|
1218
|
-
counterOffer.isVirtual,
|
|
1219
|
-
syExchangeRate,
|
|
1220
|
-
this.makerFeeRate,
|
|
1221
|
-
this.takerFeeRate,
|
|
1222
|
-
)
|
|
1223
|
-
|
|
1224
|
-
remainingAmount = 0
|
|
1225
|
-
outAmount += outAmountFromCounterOffer.outAmount
|
|
1226
|
-
makerFees += outAmountFromCounterOffer.tradeMakerFee
|
|
1227
|
-
takerFees += outAmountFromCounterOffer.tradeTakerFee
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
offersUsed++
|
|
1231
|
-
})
|
|
1232
|
-
|
|
1233
|
-
//? If output is in base, convert SY to Base
|
|
1234
|
-
const outAmountAdjusted = isQuoteOutputTokenBase(direction) ? outAmount * syExchangeRate : outAmount
|
|
1235
|
-
const isConsumedAllInput = remainingAmount <= this.state.configurationOptions.thresholdAmount
|
|
1236
|
-
if (!isConsumedAllInput) {
|
|
1237
|
-
return {
|
|
1238
|
-
outAmount: 0,
|
|
1239
|
-
makerFees: 0,
|
|
1240
|
-
takerFees: 0,
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
return {
|
|
1245
|
-
outAmount: Math.floor(outAmountAdjusted),
|
|
1246
|
-
makerFees: Math.floor(makerFees),
|
|
1247
|
-
takerFees: Math.floor(takerFees),
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
depositYtAccounts({
|
|
1252
|
-
owner,
|
|
1253
|
-
ytSrc: ytSrcParam,
|
|
1254
|
-
}: {
|
|
1255
|
-
owner: PublicKey
|
|
1256
|
-
ytSrc?: PublicKey
|
|
1257
|
-
}): TransactionInstruction {
|
|
1258
|
-
const ytSrc = ytSrcParam || getAssociatedTokenAddressSync(this.mintYt, owner, true, TOKEN_PROGRAM_ID)
|
|
1259
|
-
const ix = exponentCore.createDepositYtInstruction(
|
|
1260
|
-
{
|
|
1261
|
-
depositor: owner,
|
|
1262
|
-
vault: this.state.vault,
|
|
1263
|
-
userYieldPosition: this.corePda.yieldPosition({ vault: this.state.vault, owner }),
|
|
1264
|
-
ytSrc,
|
|
1265
|
-
escrowYt: this.corePda.escrowYt({ vault: this.state.vault }),
|
|
1266
|
-
tokenProgram: TOKEN_PROGRAM_ID,
|
|
1267
|
-
syProgram: this.state.syProgram,
|
|
1268
|
-
addressLookupTable: this.vaulLookupTable,
|
|
1269
|
-
yieldPosition: this.corePda.vaultYieldPosition({ vault: this.state.vault }),
|
|
1270
|
-
systemProgram: SystemProgram.programId,
|
|
1271
|
-
eventAuthority: this.coreEventAuthority,
|
|
1272
|
-
program: this.state.exponentCoreProgram,
|
|
1273
|
-
},
|
|
1274
|
-
{ amount: 0n },
|
|
1275
|
-
)
|
|
1276
|
-
ix.keys.push(...this.syCpiAccounts.getSyState)
|
|
1277
|
-
return ix
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
/**
|
|
1281
|
-
* Gets the user's escrow balances locked in the orderbook
|
|
1282
|
-
* Returns PT, YT, and SY token amounts held in escrow for active orders
|
|
1283
|
-
*/
|
|
1284
|
-
getUserBalances(user: PublicKey) {
|
|
1285
|
-
// Find user's escrow balances from the orderbook state
|
|
1286
|
-
const userEscrow = this.state.userEscrows.find((escrow) => escrow.user.equals(user))
|
|
1287
|
-
|
|
1288
|
-
return {
|
|
1289
|
-
pt: userEscrow?.ptAmount?.toString() || "0",
|
|
1290
|
-
yt: userEscrow?.ytAmount?.toString() || "0",
|
|
1291
|
-
sy: userEscrow?.syAmount?.toString() || "0",
|
|
1292
|
-
stakedYt: userEscrow?.stakedYtAmount?.toString() || "0",
|
|
1293
|
-
staged: userEscrow?.staged?.toString() || "0",
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
/**
|
|
1298
|
-
* Gets all open orders for a specific user
|
|
1299
|
-
* Returns detailed information about each order including type, price, amount, and expiry
|
|
1300
|
-
*/
|
|
1301
|
-
getUserOpenOrders(user: PublicKey): Offer[] {
|
|
1302
|
-
const { offers, prices, userEscrows } = this.state
|
|
1303
|
-
const currentTime = Math.floor(Date.now() / 1000)
|
|
1304
|
-
|
|
1305
|
-
return offers
|
|
1306
|
-
.map((o, index) => {
|
|
1307
|
-
const priceApy = prices[o.pricePointer - 1]!.key / PRICE_BASE_POINTS
|
|
1308
|
-
const userEscrow = userEscrows[o.userVaultPointer - 1]!.user
|
|
1309
|
-
const type = getOfferType(o.orderTypeFlag)
|
|
1310
|
-
|
|
1311
|
-
return {
|
|
1312
|
-
type,
|
|
1313
|
-
priceApy,
|
|
1314
|
-
amount: Number(o.amount.toString()),
|
|
1315
|
-
userEscrow: userEscrow,
|
|
1316
|
-
expiryAt: o.expiryAt,
|
|
1317
|
-
createdAt: o.createdAt,
|
|
1318
|
-
isVirtual: o.virtualOffer,
|
|
1319
|
-
offerIndex: o.offerIndex,
|
|
1320
|
-
}
|
|
1321
|
-
})
|
|
1322
|
-
.filter((offer) => {
|
|
1323
|
-
// Filter for this specific user and non-expired orders
|
|
1324
|
-
return offer.userEscrow.equals(user) && offer.expiryAt > currentTime
|
|
1325
|
-
})
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
/**
|
|
1329
|
-
* Gets the next offer index that will be allocated by the orderbook.
|
|
1330
|
-
* Use the free-list head when available, otherwise fall back to the bump index
|
|
1331
|
-
* for fresh allocations.
|
|
1332
|
-
*/
|
|
1333
|
-
getNextOfferIndex(): number {
|
|
1334
|
-
return this.state.offersFreeListHead !== 0
|
|
1335
|
-
? this.state.offersFreeListHead
|
|
1336
|
-
: this.state.offersBumpIndex
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
|
|
1340
|
-
type DepositYtAccounts = {
|
|
1341
|
-
[K in
|
|
1342
|
-
| "depositor"
|
|
1343
|
-
| "vault"
|
|
1344
|
-
| "userYieldPosition"
|
|
1345
|
-
| "ytSrc"
|
|
1346
|
-
| "escrowYt"
|
|
1347
|
-
| "tokenProgram"
|
|
1348
|
-
| "syProgram"
|
|
1349
|
-
| "addressLookupTable"
|
|
1350
|
-
| "yieldPosition"
|
|
1351
|
-
| "systemProgram"
|
|
1352
|
-
| "eventAuthority"
|
|
1353
|
-
| "program"]: PublicKey
|
|
1354
|
-
}
|