public class ApiWrapperBuilder
extends java.lang.Object
| Constructor and Description |
|---|
ApiWrapperBuilder(java.lang.String grpcEndpoint) |
ApiWrapperBuilder(java.lang.String grpcEndpoint,
java.lang.String grpcEndpointSolidity,
java.lang.String hexPrivateKey) |
| Modifier and Type | Method and Description |
|---|---|
ApiWrapperBuilder |
addInterceptors(java.util.List<io.grpc.ClientInterceptor> interceptors)
Add multiple custom interceptors.
|
ApiWrapper |
build() |
java.util.List<io.grpc.ClientInterceptor> |
getCustomInterceptors()
The custom interceptors added so far, as an unmodifiable view.
|
java.lang.String |
toString() |
ApiWrapperBuilder |
withApiKey(java.lang.String apiKey)
Set API key for TronGrid
|
ApiWrapperBuilder |
withGrpcEndpointSolidity(java.lang.String grpcEndpointSolidity)
set grpcEndpointSolidity
|
ApiWrapperBuilder |
withPrivateKey(java.lang.String hexPrivateKey)
set PrivateKey, an optional "0x" prefix is accepted
|
ApiWrapperBuilder |
withTimeout(long timeoutMs)
Set timeout in milliseconds for all requests
|
ApiWrapperBuilder |
withTLS()
Enable TLS using the system trust certificates.
|
ApiWrapperBuilder |
withTLS(java.io.File certFile)
Enable TLS with custom certificate
|
public ApiWrapperBuilder(java.lang.String grpcEndpoint,
java.lang.String grpcEndpointSolidity,
java.lang.String hexPrivateKey)
public ApiWrapperBuilder(java.lang.String grpcEndpoint)
public ApiWrapperBuilder withTLS(java.io.File certFile)
Recommend using TLS 1.2 or TLS 1.3 for better security. For generating self-signed certificates, tools like OpenSSL can be used (e.g., OpenSSL Req).
certFile - The certificate filepublic ApiWrapperBuilder withTLS()
A certificate previously set by withTLS(File) is cleared.
public ApiWrapperBuilder withApiKey(java.lang.String apiKey)
public ApiWrapperBuilder withTimeout(long timeoutMs)
public ApiWrapperBuilder addInterceptors(java.util.List<io.grpc.ClientInterceptor> interceptors)
Custom interceptors are applied outside the timeout interceptor, so they cannot
change the deadline set by withTimeout(long).
public ApiWrapperBuilder withGrpcEndpointSolidity(java.lang.String grpcEndpointSolidity)
public ApiWrapperBuilder withPrivateKey(java.lang.String hexPrivateKey)
java.lang.IllegalArgumentException - if the key is not 64 hex characters or its scalar
is outside the valid secp256k1 range [1, n - 1]public java.util.List<io.grpc.ClientInterceptor> getCustomInterceptors()
public ApiWrapper build()
public java.lang.String toString()
toString in class java.lang.Object