15: Add getOpenPositions() to Jupiter Perps API (dummy)

This commit is contained in:
2026-06-26 16:15:19 +02:00
parent 09bd70b348
commit a52dbec41a
2 changed files with 25 additions and 0 deletions
@@ -1,6 +1,7 @@
package com.r35157.libs.jupiter.perps; package com.r35157.libs.jupiter.perps;
import java.io.IOException; import java.io.IOException;
import java.util.Set;
/** /**
* Service for reading Jupiter Perps positions. * Service for reading Jupiter Perps positions.
@@ -27,4 +28,18 @@ public interface JupiterPerpsPositionService {
*/ */
JupiterPerpsPosition getPosition(ΩJupiterPerpsPositionAccountΩ positionAccount) JupiterPerpsPosition getPosition(ΩJupiterPerpsPositionAccountΩ positionAccount)
throws IOException, InterruptedException; throws IOException, InterruptedException;
/**
* Finds open Jupiter Perps positions owned by a wallet.
*
* <p>This method returns decoded Jupiter Perps position objects. It does not return
* raw Solana accounts or account ids.</p>
*
* @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<JupiterPerpsPosition> getOpenPositions(ΩSolanaWalletIdΩ owner)
throws IOException, InterruptedException;
} }
@@ -6,6 +6,7 @@ import com.r35157.libs.solana.SolanaAccountInfo;
import com.r35157.libs.solana.SolanaBlockChain; import com.r35157.libs.solana.SolanaBlockChain;
import java.io.IOException; import java.io.IOException;
import java.util.Set;
public class AnchorIdlJupiterPerpsPositionServiceImpl implements JupiterPerpsPositionService { public class AnchorIdlJupiterPerpsPositionServiceImpl implements JupiterPerpsPositionService {
@@ -35,6 +36,15 @@ public class AnchorIdlJupiterPerpsPositionServiceImpl implements JupiterPerpsPos
return pos; return pos;
} }
@Override
public Set<JupiterPerpsPosition> getOpenPositions(
ΩSolanaWalletIdΩ owner
) throws IOException, InterruptedException {
throw new UnsupportedOperationException(
"Finding Jupiter Perps positions by owner is not implemented yet."
);
}
private static final ΩJupiterPerpsProgramIdΩ JUPITER_PERPS_PROGRAM_ID = private static final ΩJupiterPerpsProgramIdΩ JUPITER_PERPS_PROGRAM_ID =
"PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu"; "PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu";