-
Notifications
You must be signed in to change notification settings - Fork 10
Api
Ishinka edited this page May 9, 2022
·
4 revisions
Api
provides high-level API to interact with a node in two different ways: using defined RPC's queries directly or accessing standard or user-defined Pallet and its API.
Api
requires an adjusted instance of ProviderInterface
(follow this link to get more information about the transport).
ProviderInterface wsProvider = WsProvider.builder()
.setEndpoint("ws://127.0.0.1:9944")
.build();
wsProvider.connect().join();
try (DefaultApi api = Api.with(wsProvider)) {
}
CompletableFuture<BlockHash> finalized = api.rpc().chain().getFinalizedHead();
SystemPallet systemPallet = api.pallet(SystemPallet.class);
CompletableFuture<BlockHash> blockHash = systemPallet
.blockHash()
.get(0);