Skip to content

netsugo/infura3j

Repository files navigation

infura3j

A small tool to mediate between Infura and Web3j.

Features

  • URL generation for Infura

  • HttpService/WebSocketService generation for Infura

  • header builder for Infura

Requirements

  • Java8 & up

  • web3j core

  • web3j hosted-providers

build.gradle
...
dependencies {
    implementation "org.web3j:core:$web3jVersion"
    implementation "org.web3j:hosted-providers:$web3jVersion"
    ...
}
...

Example

public class Example() {
    public static void eg() {
        String id = "specify-project-id";
        String secret = "specify-project-secret"; // or null
        String jwtKey = "specify-jwt-key"; // or null
        InfuraHttpService httpService = Infura.createHttpService(Infura.Ropsten, id, sercret, jwtKey);
        WebSocketService wsService = Infura.createWsService(Infura.Mainnet, id, null, null); // public project
        // Create web3j instance with above web3j-services.
        ...
    }
}

About

A small tool to mediate between Infura and Web3j.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages