java.lang.Object
tech.deplant.java4ever.binding.EverSdk
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
The type Builder.static final record
The type Result of create context. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The constant LOG_FORMAT.static long
Timeout for the waiting of async operations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,
P> CompletableFuture <T> Async method to get future result from EVER-SDKstatic <T,
P> CompletableFuture <T> asyncAppObject
(int contextId, String functionName, P functionInputs, Class<T> outputClass, AppObject appObject) Async method to get future result from EVER-SDK with additional parameter to receive AppObject callbacks.static <T,
P> CompletableFuture <T> asyncCallback
(int contextId, String functionName, P functionInputs, Class<T> outputClass, Consumer<com.fasterxml.jackson.databind.JsonNode> eventConsumer) Async method to get future result from EVER-SDK with additional parameter to receive recurring events from EVER-SDKstatic <P> CompletableFuture
<Void> Async method to call EVER-SDK that do not return responses.static <T> T
await
(CompletableFuture<T> functionOutputs) Helper method that awaits for completable future for timeout that you can specify by issuing EverSdk.timeout = 60_000L.static EverSdk.Builder
builder()
Creates a builder object that is used to precisely configure EVER-SDK before creating new context.static Client.ClientConfig
contextConfig
(int contextId) Context config client . client config.static int
Create default int.static int
createWithConfig
(Client.ClientConfig config) Helper method to create new context from existing config objectstatic int
createWithEndpoint
(String endpoint) Helper method to create new context with only one setting - endpoint of the blockchain.static int
createWithJson
(String configJson) Helper method to create new context from existing JSON configstatic void
destroy
(int contextId) Destroy.static long
getDefaultWorkchainId
(int contextId) Gets default workchain id.static void
load()
Load.static void
load
(LibraryLoader loader) Load.sendExternalMessage
(int contextId, String dstAddress, Abi.ABI abi, String stateInit, String messageBody, String optionalSrcAddress)
-
Field Details
-
LOG_FORMAT
-
timeout
public static long timeoutTimeout for the waiting of async operations.
-
-
Constructor Details
-
EverSdk
public EverSdk()
-
-
Method Details
-
contextConfig
Context config client . client config.- Parameters:
contextId
- the context id- Returns:
- the client . client config
-
getDefaultWorkchainId
public static long getDefaultWorkchainId(int contextId) Gets default workchain id.- Parameters:
contextId
- the context id- Returns:
- the default workchain id
-
load
public static void load()Load. -
load
-
asyncVoid
public static <P> CompletableFuture<Void> asyncVoid(int contextId, String functionName, P functionInputs) throws EverSdkException Async method to call EVER-SDK that do not return responses. It will response as soon as call is sent.- Type Parameters:
P
- function params type parameter- Parameters:
contextId
- config context idfunctionName
- EVER-SDK function namefunctionInputs
- EVER-SDK function inputs- Returns:
- the completable future with generic result type
- Throws:
EverSdkException
- the ever sdk exception
-
async
public static <T,P> CompletableFuture<T> async(int contextId, String functionName, P functionInputs, Class<T> outputClass) throws EverSdkException Async method to get future result from EVER-SDK- Type Parameters:
T
- result type parameterP
- function params type parameter- Parameters:
contextId
- config context idfunctionName
- EVER-SDK function namefunctionInputs
- EVER-SDK function inputsoutputClass
- EVER-SDK output class- Returns:
- the completable future with generic result type
- Throws:
EverSdkException
- the ever sdk exception
-
asyncCallback
public static <T,P> CompletableFuture<T> asyncCallback(int contextId, String functionName, P functionInputs, Class<T> outputClass, Consumer<com.fasterxml.jackson.databind.JsonNode> eventConsumer) throws EverSdkException Async method to get future result from EVER-SDK with additional parameter to receive recurring events from EVER-SDK- Type Parameters:
T
- result type parameterP
- function params type parameter- Parameters:
contextId
- config context idfunctionName
- EVER-SDK function namefunctionInputs
- EVER-SDK function inputsoutputClass
- EVER-SDK output classeventConsumer
- Java Consumer (lambda-function) that accepts JsonNode object returned by EVER-SDK- Returns:
- the completable future with generic result type
- Throws:
EverSdkException
- the ever sdk exception
-
asyncAppObject
public static <T,P> CompletableFuture<T> asyncAppObject(int contextId, String functionName, P functionInputs, Class<T> outputClass, AppObject appObject) throws EverSdkException Async method to get future result from EVER-SDK with additional parameter to receive AppObject callbacks.- Type Parameters:
T
- result type parameterP
- function params type parameter- Parameters:
contextId
- config context idfunctionName
- EVER-SDK function namefunctionInputs
- EVER-SDK function inputsoutputClass
- EVER-SDK output classappObject
- Pointer to AppObject implementation- Returns:
- the completable future with generic result type
- Throws:
EverSdkException
- the ever sdk exception
-
destroy
public static void destroy(int contextId) Destroy.- Parameters:
contextId
- the context id
-
createDefault
Create default int.- Returns:
- the int
- Throws:
EverSdkException
- the ever sdk exception
-
builder
Creates a builder object that is used to precisely configure EVER-SDK before creating new context. After specifying all needed configs in builder style, call build() to finish and create context_id with EVER-SDK.- Returns:
- the builder
-
createWithEndpoint
Helper method to create new context with only one setting - endpoint of the blockchain.- Parameters:
endpoint
- the endpoint of the blockchain.- Returns:
- context_id for future usage
- Throws:
EverSdkException
- the ever sdk exception
-
createWithConfig
Helper method to create new context from existing config object- Parameters:
config
- config object- Returns:
- context_id for future usage
- Throws:
EverSdkException
- the ever sdk exception
-
createWithJson
Helper method to create new context from existing JSON config- Parameters:
configJson
- json text that contains config parameters- Returns:
- context_id for future usage
- Throws:
EverSdkException
- the ever sdk exception
-
sendExternalMessage
public static Processing.ResultOfProcessMessage sendExternalMessage(int contextId, String dstAddress, Abi.ABI abi, String stateInit, String messageBody, String optionalSrcAddress) throws EverSdkException - Throws:
EverSdkException
-
await
Helper method that awaits for completable future for timeout that you can specify by issuing EverSdk.timeout = 60_000L. All Java Futures possible errors are wrapped in EverSdkException. If you want to catch these errors, catch errors -400, -408, -500- Type Parameters:
T
- result type parameter- Parameters:
functionOutputs
- future result to wait for- Returns:
- returns result of the given type
- Throws:
EverSdkException
- the ever sdk exception
-