-
Notifications
You must be signed in to change notification settings - Fork 10
Api
Alexander Kalankhodzhaev edited this page Aug 7, 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).
Supplier<ProviderInterface> wsProvider = WsProvider.builder().setEndpoint("ws://127.0.0.1:9944");
try (Api api = Api.with(wsProvider).build().join()) {
}
CompletableFuture<BlockHash> finalized = api.rpc(Chain.class).getFinalizedHead();
System system = api.pallet(System.class);
CompletableFuture<BlockHash> blockHash = system.blockHash().get(0);