Show / Hide Table of Contents

Class MirrorClient

Hedera Network Client

Inheritance
Object
MirrorClient
Implements
IAsyncDisposable
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Hashgraph
Assembly: Hashgraph.dll
Syntax
public sealed class MirrorClient : IAsyncDisposable
Remarks

This component facilitates interaction with the Hedera Mirror Network.
It manages the communication channels with the mirror network and serialization of requests and responses. This library generally shields the client code from directly interacting with the underlying protobuf communication layer but does provide hooks allowing advanced low-level manipulation of messages if necessary.

Constructors

| Improve this Doc View Source

MirrorClient(Action<IMirrorContext>)

Creates a new instance of an Hedera Mirror Network Client.

Declaration
public MirrorClient(Action<IMirrorContext> configure = null)
Parameters
Type Name Description
Action<IMirrorContext> configure

Optional configuration method that can set the location of the network node accessing the network and how transaction fees shall be paid for.

Remarks

Creating a new instance of a

Mirror
initializes a new instance of a client. It will have a separate cache of GRPC channels to the network and will maintain a separate configuration from other clients. The constructor takes an optional callback method that configures the details on how the client should connect to the network configuraable details. See the IMirrorContext documentation for configuration details.

Methods

| Improve this Doc View Source

Clone(Action<IMirrorContext>)

Creates a new instance of the mirror client having a shared base configuration with its parent. Changes to the parent’s configuration will reflect in this instances configuration while changes in this instances configuration will not be reflected in the parent configuration.

Declaration
public MirrorClient Clone(Action<IMirrorContext> configure = null)
Parameters
Type Name Description
Action<IMirrorContext> configure

The callback method receiving the IMirrorContext object providing the configuration details of this client instance. Values can be retrieved and set within the context of the method invocation.

Returns
Type Description
MirrorClient

A new instance of a client object.

| Improve this Doc View Source

Configure(Action<IMirrorContext>)

Updates the configuration of this instance of a mirror client thru implementation of the supplied IMirrorContext callback method.

Declaration
public void Configure(Action<IMirrorContext> configure)
Parameters
Type Name Description
Action<IMirrorContext> configure

The callback method receiving the IMirrorContext object providing the configuration details of this client instance. Values can be retrieved and set within the context of the method invocation.

| Improve this Doc View Source

DisposeAsync()

.NET Asynchronous dispose method.

Declaration
public ValueTask DisposeAsync()
Returns
Type Description
ValueTask

An Async Task.

Remarks

Closes any GRPC channels solely owned by this

Mirror
instance.

| Improve this Doc View Source

SubscribeTopicAsync(SubscribeTopicParams, Action<IMirrorContext>)

Subscribes to a Topic Stream from a mirror node, placing the topic messages returned meeting the query criteria into the provided .net Channel.

Declaration
public async Task SubscribeTopicAsync(SubscribeTopicParams subscribeParameters, Action<IMirrorContext> configure = null)
Parameters
Type Name Description
SubscribeTopicParams subscribeParameters

The details of the query, including the id of the topic, time constraint filters and the .net channel receiving the messages as they are returned from the server.

Action<IMirrorContext> configure

Optional callback method providing an opportunity to modify the execution configuration for just this method call. It is executed prior to submitting the request to the mirror node.

Returns
Type Description
Task

Returns only after one of the four conditions ocurr: the output channel is completed by calling code; the cancelation token provided in the params is signaled; the maximum number of topic messages was returned as configured in the params; or if the mirror stream faults during streaming, in which case a MirrorException is thrown.

Exceptions
Type Condition
ArgumentNullException

If required arguments are missing.

InvalidOperationException

If required context configuration is missing or a parameter is invalid.

MirrorException

If the mirror node stream faulted during request processing or upon submission.

Implements

System.IAsyncDisposable
  • Improve this Doc
  • View Source
In This Article
Back to top .NET Client Library for Hedera Hashgraph