Skip to content

Latest commit

 

History

History
66 lines (48 loc) · 1.71 KB

local-client-provider.md

File metadata and controls

66 lines (48 loc) · 1.71 KB

Local Client Provier

LocalClientProvider helper class simplifies the interaction with a local Cardano node. It provides functionalities like state query, mempool tx monitoring and tx submission through protocol specific clients on a single connection.

Create LocalClientProvider

Create and start a LocalClientProvider.

LocalClientProvider localClientProvider = new LocalClientProvider(nodeSocketFile, protocolMagic)
localQueryProvider.start();

Get protocol specific clients

Get LocalStateQueryClient

LocalStateQueryClient localStateQueryClient = localClientProvider.getLocalStateQueryClient()

Get LocalTxSubmissionClient

LocalTxSubmissionClient localTxSubmissionClient = localClientProvider.getTxSubmissionClient()

Get LocalTxMonitorClient

LocalTxMonitorClient localTxMonitorClient = localClientProvider.getTxMonitorClient()

Listeners

The following listeners can be added to LocalClientProvider to listen to events or get results.

  • LocalStateQueryListener : To receive state query result
localClientProvider.addLocalStateQueryListener(listener)
  • LocaTxMonitorListener : To get tx monitoring events
localClientProvider.addTxMonitorListener(listener)
  • LocalTxSubmissionListener : To get tx submission result
localClientProvider.addTxSubmissionListener(listener)
  • LocalClientProviderListener : To get connection ready event
localClientProvider.setLocalClientProviderListener(listener)

To shutdown

localClientProvider.shutdown()