From 62bee4feefd68981b8b6df769af15b5539d37050dc451dd9a18855fd30ab404e Mon Sep 17 00:00:00 2001 From: Minimons Date: Fri, 26 Jun 2026 18:47:03 +0200 Subject: [PATCH] X: Move JupiterPerpsPositionService to API instead of implementation --- .../perps/JupiterPerpsPositionService.tjava | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/main/tjava/com/r35157/libs/jupiter/perps/JupiterPerpsPositionService.tjava diff --git a/src/main/tjava/com/r35157/libs/jupiter/perps/JupiterPerpsPositionService.tjava b/src/main/tjava/com/r35157/libs/jupiter/perps/JupiterPerpsPositionService.tjava new file mode 100644 index 0000000..533cad7 --- /dev/null +++ b/src/main/tjava/com/r35157/libs/jupiter/perps/JupiterPerpsPositionService.tjava @@ -0,0 +1,45 @@ +package com.r35157.libs.jupiter.perps; + +import java.io.IOException; +import java.util.Set; + +/** + * Service for reading Jupiter Perps positions. + * + *

This service is read-only. It does not open, close, modify, or sign transactions + * for Jupiter Perps positions.

+ * + *

The first supported operation is reading a known Jupiter Perps position account + * and returning its decoded position data.

+ */ +public interface JupiterPerpsPositionService { + /** + * Reads a Jupiter Perps position from a known position account. + * + *

The supplied account must be the Solana account that stores the Jupiter Perps + * position state. It is not the wallet address, token account, custody account, pool + * account, or position request account.

+ * + * @param positionAccount the Solana account address of the Jupiter Perps position + * @return the decoded Jupiter Perps position + * @throws IOException if the position account could not be fetched or decoded + * @throws InterruptedException if the calling thread is interrupted while fetching + * the position account + */ + JupiterPerpsPosition getPosition(ΩJupiterPerpsPositionAccountΩ positionAccount) + throws IOException, InterruptedException; + + /** + * Finds open Jupiter Perps positions owned by a wallet. + * + *

This method returns decoded Jupiter Perps position objects. It does not return + * raw Solana accounts or account ids.

+ * + * @param owner the wallet address that owns the Jupiter Perps positions + * @return the open Jupiter Perps positions owned by the wallet + * @throws IOException if the position accounts could not be fetched or decoded + * @throws InterruptedException if the calling thread is interrupted while fetching positions + */ + Set getOpenPositions(ΩSolanaWalletIdΩ owner) + throws IOException, InterruptedException; +} \ No newline at end of file