Interface IContext
A Client instance’s configuration.
Namespace: Hashgraph
Assembly: Hashgraph.dll
Syntax
public interface IContext
Remarks
This interface exposes the current configuration context for a
Client instance. When accessed thru a
Configure(Action<IContext>),
Clone(Action<IContext>) or one of the
network request methods, calling code can interrogate the
object for configuration details and update as necessary.
Typically, the bare minimum that must be configured in a
context in order to access the network are values for
the Node Gateway and
Payer Account. The other default
values are typically suitable for most interactions with
the network.
Properties
| Improve this Doc View SourceAdjustForLocalClockDrift
If set to
true
the library client will automatically
scan for InvalidTransactionStart responses
from the server and adjust the automatic generation of transaction
IDs as appropriate to compensate for local clock drift from the
network server's clock. This can help reduce the wait time for
acceptance of transactions if the local clock deviates from the
network time by too wide a margin. It is only recommended to
enable this setting if you are having performance problems related
to clock drift an are unable to resolve at the environment level.
The default for this value is false
.
Declaration
bool AdjustForLocalClockDrift { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
FeeLimit
The maximum fee the payer is willing to pay for a transaction.
Declaration
long FeeLimit { get; set; }
Property Value
Type | Description |
---|---|
Int64 |
Gateway
Network Address and Node Account address for gaining access to the Hedera Network.
Declaration
Gateway Gateway { get; set; }
Property Value
Type | Description |
---|---|
Gateway |
Memo
The default memo associated with transactions set to the network.
Declaration
string Memo { get; set; }
Property Value
Type | Description |
---|---|
String |
OnResponseReceived
Called by the library just after receiving a response from the server and before processing that response. The information includes a retry number, the response from the first send being 0. Subsequent numbers indicate responses from resends of the same transaction, typically in response to a BUSY response from the server or in the cases where there is some time drift between the server and the client system. This information can be useful for logging and troubleshooting efforts.
Declaration
Action<int, IMessage> OnResponseReceived { get; set; }
Property Value
Type | Description |
---|---|
Action<Int32, Google.Protobuf.IMessage> |
OnSendingRequest
Called by the library just before the serialized protobuf
is sent to the Hedera Network. This is the only exposure
the library provides to the underlying protobuf implementation
(although they are publicly available in the library).
This method can be useful for logging and tracking purposes.
It could also be used in advanced scenarios to modify the
protobuf message just before sending.
Declaration
Action<IMessage> OnSendingRequest { get; set; }
Property Value
Type | Description |
---|---|
Action<Google.Protobuf.IMessage> |
Payer
The address of the account that pays for transactions submitted to the network, otherwise known as the "Operator".
Declaration
Address Payer { get; set; }
Property Value
Type | Description |
---|---|
Address |
RetryCount
The number of times the client software should retry sending a transaction to the network after the initial request failed with the server returning BUSY or invalid due to client/server time drift, or waiting for a “fast” receipt to return consensus.
Declaration
int RetryCount { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
RetryDelay
The timespan to wait between retry attempts. Each retry attempt adds the same additional amount of delay between retries. The second attempt will wait twice the delay, the third attempt will wait three times the delay and so on.
Declaration
TimeSpan RetryDelay { get; set; }
Property Value
Type | Description |
---|---|
TimeSpan |
Signatory
The private key, keys or signing callback method that are needed to sign the transaction. At a minimum, this typically includes the Payer's signing key, but can also include other signatories such as those required when creating files and contracts.
Declaration
Signatory Signatory { get; set; }
Property Value
Type | Description |
---|---|
Signatory |
Remarks
Every key added into this context will sign every transaction made by the owning client object. This includes the "second" transaction required to obtain a record from the network when the "WithRecord" form of method calls are invoked. It is important to note that many of the API calls have additional opportunities to identify specific signatories for various transactions. It is not necessary to add all the keys on this context for say, a key rotation on an account; especially if the "WithRecord" form is invoked. It is recommended to place only the keys associated with the Payer account in this property. Not doing so may result in extraneous unecessary signatures being sent with transactions. If this happens the transaction cost goes up due to the larger transaction size, waisting crypto due to unecessary signature processing fees.
SignaturePrefixTrimLimit
The smallest desired signature map prefix value length.
The client will trim the length of signature prefix identifiers
in a signature map to the smallest value possible, but not less
than this value. If the value is set to 0 (the default) the
minimum possible feasible value will be used when multiple
signatures are added to a transaction, omitting the prefix
completely if only one signature is provided. This does not
guarantee a minimum length of a signature prefix (a shorter
value may be provided to the client by the signing algorithm)
only that the client will not actively reduce the value beyond this limit.
Declaration
int SignaturePrefixTrimLimit { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Transaction
Override the automatic generation of a transaction ID and use the given Transaction ID. Can be useful for submitting the same transaction to multiple client/gateways.
Declaration
TxId Transaction { get; set; }
Property Value
Type | Description |
---|---|
TxId |
TransactionDuration
The maximum amount of time the client is willing to wait for consensus for a transaction, after which the submitted transaction is invalid.
Declaration
TimeSpan TransactionDuration { get; set; }
Property Value
Type | Description |
---|---|
TimeSpan |
Methods
| Improve this Doc View SourceReset(String)
Clears a property on the context. This is the only way to clear a property value on the context so that a parent value can be used instead. Setting a value to
null
does not
clear the value, it sets it to null
for the
current context and child contexts.
Declaration
void Reset(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the property to reset, must be one of the public properties of the . We suggest using
the operator to ensure type safety.
|
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | when an invalid is provided.
|