
software.crldev.elrondspringbootstarterreactive.interactor.block.ErdBlockInteractorImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elrond-spring-boot-starter-reactive Show documentation
Show all versions of elrond-spring-boot-starter-reactive Show documentation
A SpringBoot Starter solution designed to ensure easy and efficient integration with the Elrond Network using a Reactive API layer.
The newest version!
package software.crldev.elrondspringbootstarterreactive.interactor.block;
import software.crldev.elrondspringbootstarterreactive.api.ApiResourceURI;
import software.crldev.elrondspringbootstarterreactive.api.model.Hyperblock;
import software.crldev.elrondspringbootstarterreactive.api.model.ShardBlock;
import software.crldev.elrondspringbootstarterreactive.client.ErdProxyClient;
import software.crldev.elrondspringbootstarterreactive.interactor.WrappedResponses;
import reactor.core.publisher.Mono;
import static java.lang.String.format;
public class ErdBlockInteractorImpl implements ErdBlockInteractor {
private final ErdProxyClient client;
@Override
public Mono queryHyperblockByNonce(Long nonce) {
return client.get(format(ApiResourceURI.HYPERBLOCK_BY_NONCE.getURI(), nonce), WrappedResponses.QueryHyperblock.class).map(WrappedResponses.QueryHyperblock::getHyperblock);
}
@Override
public Mono queryHyperblockByHash(String hash) {
return client.get(format(ApiResourceURI.HYPERBLOCK_BY_HASH.getURI(), hash), WrappedResponses.QueryHyperblock.class).map(WrappedResponses.QueryHyperblock::getHyperblock);
}
@Override
public Mono queryShardBlockByNonceFromShard(Integer shard, Long nonce) {
return client.get(format(ApiResourceURI.BLOCK_BY_NONCE_FROM_SHARD.getURI(), shard, nonce), WrappedResponses.QueryBlock.class).map(WrappedResponses.QueryBlock::getBlock);
}
@Override
public Mono queryShardBlockByHashFromShard(Integer shard, String hash) {
return client.get(format(ApiResourceURI.BLOCK_BY_HASH_FROM_SHARD.getURI(), shard, hash), WrappedResponses.QueryBlock.class).map(WrappedResponses.QueryBlock::getBlock);
}
public ErdBlockInteractorImpl(final ErdProxyClient client) {
this.client = client;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy