Skip to content

Commit ba5a20b

Browse files
committed
fix:add example run command guide
Signed-off-by: grapebaba <281165273@qq.com>
1 parent aae79fc commit ba5a20b

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,13 @@ CompletableFuture<String> res = mevShareClient.sendPrivateTransaction(signRawTx,
292292
## Examples
293293
For more examples, you can see [example](https://github.com/optimism-java/mev-share-java/tree/main/example)
294294

295+
Examples can be run with the following commands:
296+
```shell
297+
./gradlew execute -PmainClassName=bundle.RpcSendPrivateTx
298+
299+
./gradlew execute -PmainClassName=event.SseHistorical
300+
```
301+
295302
> Examples require a `.env` file (or that you populate your environment directly with the appropriate variables).
296303
297304
```sh

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
}
1010

1111
group = 'me.grapebaba'
12-
version = '0.1.0'
12+
version = '0.1.1'
1313

1414
repositories {
1515
mavenCentral()

src/test/java/net/flashbots/MevShareClientTest.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,20 @@
1818
import static org.junit.jupiter.api.Assertions.assertTrue;
1919

2020
import io.reactivex.disposables.Disposable;
21-
import net.flashbots.models.bundle.*;
21+
import net.flashbots.models.bundle.BundleItemType;
22+
import net.flashbots.models.bundle.BundleParams;
23+
import net.flashbots.models.bundle.BundlePrivacy;
24+
import net.flashbots.models.bundle.HintPreferences;
25+
import net.flashbots.models.bundle.Inclusion;
26+
import net.flashbots.models.bundle.PrivateTxOptions;
27+
import net.flashbots.models.bundle.SendBundleResponse;
28+
import net.flashbots.models.bundle.SimBundleOptions;
2229
import net.flashbots.models.common.Network;
2330
import net.flashbots.models.event.EventHistoryEntry;
2431
import net.flashbots.models.event.EventHistoryInfo;
2532
import net.flashbots.models.event.EventHistoryParams;
2633
import net.flashbots.models.event.MevShareEvent;
34+
import org.junit.jupiter.api.AfterAll;
2735
import org.junit.jupiter.api.BeforeAll;
2836
import org.junit.jupiter.api.Disabled;
2937
import org.junit.jupiter.api.DisplayName;
@@ -48,7 +56,6 @@
4856
* @author kaichen
4957
* @since 0.1.0
5058
*/
51-
@Disabled
5259
class MevShareClientTest {
5360

5461
private static Credentials AUTH_SIGNER;
@@ -64,8 +71,13 @@ static void beforeAll()
6471
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException {
6572
AUTH_SIGNER = Credentials.create(Keys.createEcKeyPair());
6673
SIGNER = Credentials.create(System.getenv("SIGNER_PRIVATE_KEY"));
67-
MEV_SHARE_CLIENT = new MevShareClient(Network.GOERLI, AUTH_SIGNER, WEB3J);
6874
WEB3J = Web3j.build(new HttpService(System.getenv("GOERLI_RPC_URL")));
75+
MEV_SHARE_CLIENT = new MevShareClient(Network.GOERLI, AUTH_SIGNER, WEB3J);
76+
}
77+
78+
@AfterAll
79+
static void afterAll() {
80+
MEV_SHARE_CLIENT.close();
6981
}
7082

7183
/**
@@ -100,6 +112,7 @@ void getEventHistory() throws ExecutionException, InterruptedException {
100112

101113
@Test
102114
@DisplayName("Subscribe event")
115+
@Disabled
103116
void subscribeEvent() throws InterruptedException, ExecutionException {
104117
final CountDownLatch latch = new CountDownLatch(3);
105118
var ref = new AtomicReference<MevShareEvent>();
@@ -116,6 +129,7 @@ void subscribeEvent() throws InterruptedException, ExecutionException {
116129

117130
@Test
118131
@DisplayName("Send bundle with hash")
132+
@Disabled
119133
void sendBundle()
120134
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException,
121135
ExecutionException, InterruptedException, IOException {
@@ -315,6 +329,7 @@ void sendPrivateTransaction()
315329

316330
@Test
317331
@DisplayName("Subscribe tx event")
332+
@Disabled
318333
void subscribeTx() throws ExecutionException, InterruptedException {
319334
CompletableFuture<MevShareEvent> future = new CompletableFuture<>();
320335
Disposable disposable = MEV_SHARE_CLIENT.subscribeTx(mevShareEvent -> {

0 commit comments

Comments
 (0)