X: Move and adapt conflicting interface classes from API project

This commit is contained in:
2026-07-04 13:35:27 +02:00
parent 24a05ff382
commit 14c9ccd6d3
5 changed files with 17 additions and 36 deletions
@@ -1,6 +1,5 @@
package com.r35157.libs.raydium; package com.r35157.libs.raydium;
import com.r35157.libs.valuetypes.basic.AssetPrice;
import com.r35157.libs.valuetypes.basic.MoneyAmount; import com.r35157.libs.valuetypes.basic.MoneyAmount;
import com.r35157.libs.valuetypes.basic.Range; import com.r35157.libs.valuetypes.basic.Range;
@@ -16,11 +15,11 @@ public interface Raydium {
* to any Raydium liquidity pool supported by the implementation.</p> * to any Raydium liquidity pool supported by the implementation.</p>
* *
* @param poolId the Raydium liquidity pool id * @param poolId the Raydium liquidity pool id
* @return the current pool price * @return the current pool price expressed as a Solana amount
* @throws IOException if the price could not be fetched or the response could not be parsed * @throws IOException if the price could not be fetched or the response could not be parsed
* @throws InterruptedException if the calling thread is interrupted while fetching the price * @throws InterruptedException if the calling thread is interrupted while fetching the price
*/ */
AssetPrice fetchPoolPrice(ΩRaydiumLiquidityPoolIdΩ poolId) throws IOException, InterruptedException; ΩSolanaAmountΩ fetchPoolPrice(ΩRaydiumLiquidityPoolIdΩ poolId) throws IOException, InterruptedException;
/** /**
* Fetches the Raydium liquidity pool ids where the supplied Solana owner address has positions. * Fetches the Raydium liquidity pool ids where the supplied Solana owner address has positions.
@@ -184,7 +183,7 @@ public interface Raydium {
* @param decimalPlaces the number decimal places in the resulting price currency * @param decimalPlaces the number decimal places in the resulting price currency
* @return the price range represented by the concentrated liquidity position * @return the price range represented by the concentrated liquidity position
*/ */
Range<AssetPrice> calculateConcentratedPositionPriceRange( Range<ΩPriceΩ> calculateConcentratedPositionPriceRange(
RaydiumConcentratedPositionState positionState, RaydiumConcentratedPositionState positionState,
RaydiumConcentratedPoolInfo poolInfo, RaydiumConcentratedPoolInfo poolInfo,
int decimalPlaces int decimalPlaces
@@ -1,5 +1,6 @@
package com.r35157.libs.raydium; package com.r35157.libs.raydium;
import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
public record RaydiumConcentratedPositionState( public record RaydiumConcentratedPositionState(
@@ -1,18 +1,18 @@
package com.r35157.libs.raydium; package com.r35157.libs.raydium;
import com.r35157.libs.valuetypes.basic.AssetPrice; import com.r35157.libs.valuetypes.basic.MoneyAmount;
/** /**
* Represents the current price of the tokens in a Raydium liquidity pool. * Represents the price of a Raydium liquidity pool.
* *
* <p>The 'poolId' identifies the Raydium liquidity pool for which the current token price applies. * <p>The pool id identifies the Raydium liquidity pool for which the price applies.
* The 'price' represents the price value returned or calculated for that pool.</p> * The amount contains the price value returned or calculated for that pool.</p>
* *
* @param poolId the Raydium liquidity pool id that the price belongs to * @param poolId the Raydium liquidity pool id that the price belongs to
* @param price the price for a token in the liquidity pool * @param amount the price amount for the liquidity pool
*/ */
public record RaydiumLiquidityPoolPrice( public record RaydiumLiquidityPoolPrice(
ΩRaydiumLiquidityPoolIdΩ poolId, ΩRaydiumLiquidityPoolIdΩ poolId,
AssetPrice price MoneyAmount amount
) { ) {
} }
@@ -1,13 +1,6 @@
package com.r35157.libs.valuetypes.basic; package com.r35157.libs.valuetypes.basic;
import org.jetbrains.annotations.NotNull;
public record TradingPair( public record TradingPair(
CurrencyType base, // The thing you are buying or selling. CurrencyType base, // The thing you are buying or selling.
CurrencyType quote // The currency/unit used to price the base asset. CurrencyType quote // The currency/unit used to price the base asset.
) { ) { }
@Override
public @NotNull String toString() {
return base.symbol() + "_" + quote.symbol();
}
}
@@ -1,30 +1,18 @@
package com.r35157.nenjim.hubd; package com.r35157.nenjim.hubd;
import com.r35157.nenjim.hubd.journal.Journal; import com.r35157.nenjim.hubd.journal.Journal;
import crypto.r35157.nenjim.NenjimProcess;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
public interface NenjimHub { public interface NenjimHub {
/**
* Starts a process based on the provided fully qualified interface name.
* The actual implementation that is run is binded according to the Context.
*
* @param fqInterfaceName the fully qualified interface name of the process to start. The interface must extend the {@code NenjimProcess} interface.
*/
void startProcess(String fqInterfaceName);
/**
* Provides a map of all running processes managed by the NenjimHub, keyed by the processId.
*
* @return a map of {@code NenjimProcess} running processes
*/
HashMap<Integer, NenjimProcess> getRunningProcesses();
/** /**
* A no-operation (noop). This method is suppoted to do nothing. * A no-operation (noop). This method is suppoted to do nothing.
*/ */
void noop(); void noop();
/**
*
* @param journal
*/
void monitorJournal(@NotNull Journal journal);
} }