From 77084b191257d5c45675d2fc4fb60c1b06c5a1ca Mon Sep 17 00:00:00 2001 From: skynetcap <100323448+skynetcap@users.noreply.github.com> Date: Tue, 19 Mar 2024 15:50:46 -0700 Subject: [PATCH] Update version to 1.30.3 in dependencies and add priority fee handling Updated 'solanaj-programs' version to 1.30.3 across all dependencies in .pom files and README.md documents. In OpenBookManager, introduced a method overload for 'consumeEvents' which allows specifying a custom 'priorityFee'. The previously existing 'consumeEvents' method will now use a default fee. These changes boost application performance by using the latest package version and offer more flexibility in handling transaction costs. --- README.md | 4 ++-- bonfida/pom.xml | 2 +- magiceden/pom.xml | 2 +- mango/pom.xml | 2 +- metaplex/pom.xml | 2 +- openbook/README.md | 2 +- openbook/pom.xml | 2 +- .../openbook/manager/OpenBookManager.java | 22 +++++++++++++++++-- phoenix/README.md | 2 +- phoenix/pom.xml | 6 ++--- pom.xml | 2 +- pyth/README.md | 2 +- pyth/pom.xml | 2 +- serum/pom.xml | 2 +- zeta/pom.xml | 2 +- 15 files changed, 37 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 3374258..f829c87 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Bonfida. com.mmorrell solanaj-programs - 1.30.2 + 1.30.3 ``` Or just one dependency: @@ -18,7 +18,7 @@ Or just one dependency: com.mmorrell phoenix - 1.30.2 + 1.30.3 ``` diff --git a/bonfida/pom.xml b/bonfida/pom.xml index 97a7058..f39fddd 100644 --- a/bonfida/pom.xml +++ b/bonfida/pom.xml @@ -5,7 +5,7 @@ solanaj-programs com.mmorrell - 1.30.2 + 1.30.3 4.0.0 diff --git a/magiceden/pom.xml b/magiceden/pom.xml index 751e5f8..8d6d575 100644 --- a/magiceden/pom.xml +++ b/magiceden/pom.xml @@ -5,7 +5,7 @@ solanaj-programs com.mmorrell - 1.30.2 + 1.30.3 4.0.0 diff --git a/mango/pom.xml b/mango/pom.xml index 60e39ba..5a78280 100644 --- a/mango/pom.xml +++ b/mango/pom.xml @@ -5,7 +5,7 @@ solanaj-programs com.mmorrell - 1.30.2 + 1.30.3 4.0.0 diff --git a/metaplex/pom.xml b/metaplex/pom.xml index 27cf170..fb3272b 100644 --- a/metaplex/pom.xml +++ b/metaplex/pom.xml @@ -5,7 +5,7 @@ solanaj-programs com.mmorrell - 1.30.2 + 1.30.3 4.0.0 diff --git a/openbook/README.md b/openbook/README.md index bbfb2d3..0969be4 100644 --- a/openbook/README.md +++ b/openbook/README.md @@ -4,7 +4,7 @@ A SolanaJ module for interfacing with the OpenBook v2 DEX. com.mmorrell openbook - 1.30.2 + 1.30.3 ``` ## Code Examples diff --git a/openbook/pom.xml b/openbook/pom.xml index bf46a10..2836fd7 100644 --- a/openbook/pom.xml +++ b/openbook/pom.xml @@ -5,7 +5,7 @@ solanaj-programs com.mmorrell - 1.30.2 + 1.30.3 4.0.0 diff --git a/openbook/src/main/java/com/mmorrell/openbook/manager/OpenBookManager.java b/openbook/src/main/java/com/mmorrell/openbook/manager/OpenBookManager.java index eaeed77..27778f0 100644 --- a/openbook/src/main/java/com/mmorrell/openbook/manager/OpenBookManager.java +++ b/openbook/src/main/java/com/mmorrell/openbook/manager/OpenBookManager.java @@ -40,6 +40,8 @@ public class OpenBookManager { private final RpcClient client; private final Map marketCache = new HashMap<>(); + private final static int CONSUME_EVENTS_DEFAULT_FEE = 11; + public OpenBookManager(RpcClient client) { this.client = client; cacheMarkets(); @@ -193,7 +195,8 @@ public Optional getOpenOrdersAccount(PublicKey ooa) { * @return An Optional containing the transaction hash if events are consumed successfully, * otherwise an empty Optional. */ - public Optional consumeEvents(Account caller, PublicKey marketId, long limit, @Nullable String memo) { + public Optional consumeEvents(Account caller, PublicKey marketId, long limit, @Nullable String memo, + int priorityFee) { Optional marketOptional = getMarket(marketId, true, false); if (marketOptional.isEmpty()) { return Optional.empty(); @@ -216,7 +219,7 @@ public Optional consumeEvents(Account caller, PublicKey marketId, long l log.info("Cranking {}: {}", market.getName(), peopleToCrank); Transaction tx = new Transaction(); tx.addInstruction(ComputeBudgetProgram.setComputeUnitLimit(50_000)); - tx.addInstruction(ComputeBudgetProgram.setComputeUnitPrice(11)); + tx.addInstruction(ComputeBudgetProgram.setComputeUnitPrice(priorityFee)); tx.addInstruction( OpenbookProgram.consumeEvents( caller, @@ -246,4 +249,19 @@ public Optional consumeEvents(Account caller, PublicKey marketId, long l log.info("Consumed events in TX: {}", consumeEventsTx); return Optional.of(consumeEventsTx); } + + + /** + * Consumes events for a given account, market ID, limit, and optional memo. + * It uses the default fee. + * + * @param caller The account performing the consumption + * @param marketId The public key of the market + * @param limit The maximum number of events to consume + * @param memo The optional memo + * @return An Optional String representing the consumed events + */ + public Optional consumeEvents(Account caller, PublicKey marketId, long limit, @Nullable String memo) { + return consumeEvents(caller, marketId, limit, memo, CONSUME_EVENTS_DEFAULT_FEE); + } } diff --git a/phoenix/README.md b/phoenix/README.md index a25dd82..bf8c38f 100644 --- a/phoenix/README.md +++ b/phoenix/README.md @@ -5,7 +5,7 @@ A SolanaJ module for interfacing with the Ellipsis Phoenix DEX. com.mmorrell openbook - 1.30.2 + 1.30.3 ``` diff --git a/phoenix/pom.xml b/phoenix/pom.xml index 9d30d03..405c013 100644 --- a/phoenix/pom.xml +++ b/phoenix/pom.xml @@ -6,7 +6,7 @@ com.mmorrell solanaj-programs - 1.30.2 + 1.30.3 phoenix @@ -20,13 +20,13 @@ com.mmorrell serum - 1.30.2 + 1.30.3 compile com.mmorrell metaplex - 1.30.2 + 1.30.3 test diff --git a/pom.xml b/pom.xml index 89d0980..29f28e3 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.mmorrell solanaj-programs pom - 1.30.2 + 1.30.3 ${project.groupId}:${project.artifactId} Program libraries for SolanaJ, a library for Solana RPC https://github.com/skynetcap/solanaj-programs diff --git a/pyth/README.md b/pyth/README.md index 9641c1d..9b5185c 100644 --- a/pyth/README.md +++ b/pyth/README.md @@ -6,7 +6,7 @@ A SolanaJ module for interfacing with Pyth. com.mmorrell solanaj-programs - 1.30.2 + 1.30.3 ``` diff --git a/pyth/pom.xml b/pyth/pom.xml index cad8620..6125e9b 100644 --- a/pyth/pom.xml +++ b/pyth/pom.xml @@ -5,7 +5,7 @@ solanaj-programs com.mmorrell - 1.30.2 + 1.30.3 4.0.0 diff --git a/serum/pom.xml b/serum/pom.xml index 0e7c4bb..c3fb71b 100644 --- a/serum/pom.xml +++ b/serum/pom.xml @@ -5,7 +5,7 @@ solanaj-programs com.mmorrell - 1.30.2 + 1.30.3 4.0.0 diff --git a/zeta/pom.xml b/zeta/pom.xml index 36da838..1b7ecb3 100644 --- a/zeta/pom.xml +++ b/zeta/pom.xml @@ -5,7 +5,7 @@ solanaj-programs com.mmorrell - 1.30.2 + 1.30.3 4.0.0