HederaClient class
The main entry point for interacting with the Hedera network.
HederaClient manages the network configuration, operator credentials, and connection settings for all SDK operations.
Example:
final client = HederaClient.forTestnet()
.setOperator(
AccountId.fromString('0.0.12345'),
PrivateKey.fromString('302e...'),
);
Constructors
- HederaClient.forMainnet()
-
Creates a client configured for Hedera mainnet.
factory
- HederaClient.forPreviewnet()
-
Creates a client configured for Hedera previewnet.
factory
- HederaClient.forTestnet()
-
Creates a client configured for Hedera testnet.
factory
Properties
- channel → ClientChannel
-
Returns a
ClientChannelconnected to the active network node.no setter - cryptoClient → CryptoServiceClient
-
Returns a
CryptoServiceClientfor account and transfer operations, connected via the generic channel.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- maxQueryPayment → Hbar
-
The maximum query payment.
no setter
- maxTransactionFee → Hbar
-
The maximum transaction fee.
no setter
- network → HederaNetwork
-
The active network environment.
final
- networkEndpoint → String
-
The gRPC endpoint for the active network.
no setter
- operatorAccountId → AccountId?
-
The operator account ID, or null if not set.
no setter
- operatorPrivateKey → PrivateKey?
-
The operator private key, or null if not set.
no setter
- retryPolicy → RetryPolicy
-
The active retry policy.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
channelFor(
HederaNode node) → ClientChannel -
Creates a new
ClientChannelconnected tonode's specific endpoint. -
close(
) → Future< void> - Closes the gRPC channel and releases resources.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resolveNode(
{AccountId? explicitNodeAccountId}) → Future< HederaNode> -
Resolves the
HederaNodeto submit a transaction to. -
selectNode(
) → Future< HederaNode> - Selects the next node using round-robin rotation over the dynamically fetched (and cached) node list.
-
setMaxQueryPayment(
Hbar payment) → HederaClient - Sets the maximum payment for queries.
-
setMaxTransactionFee(
Hbar fee) → HederaClient - Sets the maximum transaction fee this client will pay.
-
setOperator(
AccountId accountId, PrivateKey privateKey) → HederaClient - Sets the operator account and key for this client.
-
setRetryPolicy(
RetryPolicy policy) → HederaClient - Sets the retry policy for this client.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- nodeListCacheDuration → const Duration
- How long a fetched node list is cached before being refreshed.