chain5j-jsonRpc

基于okHttp的jsonRpc

License

License

Categories

Categories

JSON Data
GroupId

GroupId

com.xwc1125.chain5j
ArtifactId

ArtifactId

chain5j-jsonrpc
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

chain5j-jsonRpc
基于okHttp的jsonRpc
Project URL

Project URL

https://github.com/chain5j/chain5j-jsonRpc
Source Code Management

Source Code Management

https://github.com/chain5j/chain5j-jsonRpc.git

Download chain5j-jsonrpc

How to add to project

<!-- https://jarcasting.com/artifacts/com.xwc1125.chain5j/chain5j-jsonrpc/ -->
<dependency>
    <groupId>com.xwc1125.chain5j</groupId>
    <artifactId>chain5j-jsonrpc</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.xwc1125.chain5j/chain5j-jsonrpc/
implementation 'com.xwc1125.chain5j:chain5j-jsonrpc:1.0.1'
// https://jarcasting.com/artifacts/com.xwc1125.chain5j/chain5j-jsonrpc/
implementation ("com.xwc1125.chain5j:chain5j-jsonrpc:1.0.1")
'com.xwc1125.chain5j:chain5j-jsonrpc:jar:1.0.1'
<dependency org="com.xwc1125.chain5j" name="chain5j-jsonrpc" rev="1.0.1">
  <artifact name="chain5j-jsonrpc" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.xwc1125.chain5j', module='chain5j-jsonrpc', version='1.0.1')
)
libraryDependencies += "com.xwc1125.chain5j" % "chain5j-jsonrpc" % "1.0.1"
[com.xwc1125.chain5j/chain5j-jsonrpc "1.0.1"]

Dependencies

compile (7)

Group / Artifact Type Version
com.fasterxml.jackson.core : jackson-annotations jar 2.11.0
com.fasterxml.jackson.core : jackson-core jar 2.11.0
com.fasterxml.jackson.core : jackson-databind jar 2.11.0
io.reactivex : rxjava jar 1.3.8
com.squareup.okhttp3 : logging-interceptor jar 4.6.0
org.projectlombok : lombok jar 1.18.12
org.slf4j : slf4j-api jar 2.0.0-alpha1

Project Modules

There are no modules declared in this project.

chain5j-jsonrpc

基于Okhttp的jsonRpc

Dependency

  • Maven:
<dependency>
  <groupId>com.xwc1125.chain5j</groupId>
  <artifactId>chain5j-jsonrpc</artifactId>
  <version>1.0.0</version>
</dependency>
  • Gradle:
implementation 'com.xwc1125.chain5j:chain5j-jsonrpc:1.0.0'

示例代码

public class RpcServiceTest {
    private static Eth5j getService() {
        HttpService httpService = new HttpService("http://127.0.0.1:7545");
        Eth5j eth5j = Eth5j.build(httpService);
        return eth5j;
    }

    public static void main(String[] args) {
        try {
            // 方式一
            HttpService httpService = new HttpService("http://127.0.0.1:7545");
            Request request = new Request("eth_getBalance", Arrays.asList("0x9254E62FBCA63769DFd4Cc8e23f630F0785610CE", "latest"), httpService, EthBalance.class);
            EthBalance balance = httpService.send(request, EthBalance.class);
            System.out.println(balance.getResult());

            // 方式二
            String address = "0x9254E62FBCA63769DFd4Cc8e23f630F0785610CE";
            Request<?, EthBalance> ethBalance = getService().getBalance(address, "latest");
            EthBalance send = ethBalance.send();
            System.out.println(send.getResult());
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
com.xwc1125.chain5j

Versions

Version
1.0.1
1.0.0