Skip to main content

IGrpcClient

Namespace: IotaSdk

The gRPC client for interacting with the IOTA blockchain.

public interface IGrpcClient

Attributes NullableContextAttribute

Methods​

ExecuteTransaction(SignedTransaction, UInt64?, GrpcTransactionField[])​

Execute a signed transaction.

If checkpoint_inclusion_timeout_ms is provided, the server waits up to that long for the transaction to be included in a checkpoint before responding. Include checkpoint and timestamp in the read_mask to receive that data.

The optional read_mask controls which fields the server returns. If None, the transaction digest, effects, events, and input/output objects are returned.

Task<GrpcExecutedTransaction> ExecuteTransaction(SignedTransaction signedTransaction, ulong? checkpointInclusionTimeoutMs = null, GrpcTransactionField[]? readMask = null)

Parameters​

signedTransaction SignedTransaction

checkpointInclusionTimeoutMs UInt64?

readMask GrpcTransactionField[]?

Returns​

Task<GrpcExecutedTransaction>

Exceptions​

SdkFfiException

ExecuteTransactions(SignedTransaction[], UInt64?, GrpcTransactionField[])​

Execute a batch of signed transactions.

An error the server reports for one transaction does not abort the rest of the batch; reading that transaction's item throws the server's error message. A transaction the server returns but that cannot be decoded fails the whole call.

If checkpoint_inclusion_timeout_ms is provided, the server waits up to that long for the transactions to be included in a checkpoint before responding. Include checkpoint and timestamp in the read_mask to receive that data.

The optional read_mask controls which fields the server returns. If None, the transaction digest, effects, events, and input/output objects are returned.

Task<GrpcExecutedTransactionResults> ExecuteTransactions(SignedTransaction[] transactions, ulong? checkpointInclusionTimeoutMs = null, GrpcTransactionField[]? readMask = null)

Parameters​

transactions SignedTransaction[]

checkpointInclusionTimeoutMs UInt64?

readMask GrpcTransactionField[]?

Returns​

Task<GrpcExecutedTransactionResults>

Exceptions​

SdkFfiException

SimulateTransaction(Transaction, Boolean, GrpcSimulateField[])​

Simulate a transaction.

If skip_checks is true, the VM checks are skipped during the simulation.

The optional read_mask controls which fields the server returns.

Task<GrpcSimulatedTransaction> SimulateTransaction(Transaction transaction, bool skipChecks = false, GrpcSimulateField[]? readMask = null)

Parameters​

transaction Transaction

skipChecks Boolean

readMask GrpcSimulateField[]?

Returns​

Task<GrpcSimulatedTransaction>

Exceptions​

SdkFfiException

SimulateTransactions(GrpcSimulateTransactionInput[], GrpcSimulateField[])​

Simulate a batch of transactions.

An error the server reports for one transaction does not abort the rest of the batch; each result carries either the simulated transaction or the server's error message. A transaction the server returns but that cannot be decoded fails the whole call.

Task<GrpcSimulatedTransactionResult[]> SimulateTransactions(GrpcSimulateTransactionInput[] transactions, GrpcSimulateField[]? readMask = null)

Parameters​

transactions GrpcSimulateTransactionInput[]

readMask GrpcSimulateField[]?

Returns​

Task<GrpcSimulatedTransactionResult[]>

Exceptions​

SdkFfiException

ViewFunctionCall(String, TypeTag[], MoveViewArg[], GrpcViewFunctionCallField[])​

Task<GrpcViewFunctionCallOutputs> ViewFunctionCall(string fqFunctionName, TypeTag[] typeArgs = null, MoveViewArg[] callArgs = null, GrpcViewFunctionCallField[]? readMask = null)

Parameters​

fqFunctionName String

typeArgs TypeTag[]

callArgs MoveViewArg[]

readMask GrpcViewFunctionCallField[]?

Returns​

Task<GrpcViewFunctionCallOutputs>

ViewFunctionCalls(GrpcViewFunctionCallInput[], GrpcViewFunctionCallField[])​

Call a batch of Move view functions.

Each call runs in its own transaction on the server, so one call being rejected leaves the rest untouched. Results are returned in the same order as the input; each result carries either the outputs of the call or the error the node returned for it. A call that ran and aborted lands in outputs, with the abort in its execution_error field.

The optional read_mask controls which fields the server returns.

Task<GrpcViewFunctionCallResult[]> ViewFunctionCalls(GrpcViewFunctionCallInput[] functionCalls, GrpcViewFunctionCallField[]? readMask = null)

Parameters​

functionCalls GrpcViewFunctionCallInput[]

readMask GrpcViewFunctionCallField[]?

Returns​

Task<GrpcViewFunctionCallResult[]>

Exceptions​

SdkFfiException

CheckpointByDigest(CheckpointDigest, GrpcTransactionFilter, GrpcEventFilter, GrpcCheckpointResponseField[])​

Get a checkpoint by its digest.

The optional transactions_filter and events_filter narrow the transactions and events returned for the checkpoint.

The optional read_mask controls which fields the server returns. If None, only the checkpoint summary is returned.

Task<GrpcCheckpointResponse> CheckpointByDigest(CheckpointDigest digest, GrpcTransactionFilter? transactionsFilter = null, GrpcEventFilter? eventsFilter = null, GrpcCheckpointResponseField[]? readMask = null)

Parameters​

digest CheckpointDigest

transactionsFilter GrpcTransactionFilter?

eventsFilter GrpcEventFilter?

readMask GrpcCheckpointResponseField[]?

Returns​

Task<GrpcCheckpointResponse>

Exceptions​

SdkFfiException

CheckpointBySequenceNumber(UInt64, GrpcTransactionFilter, GrpcEventFilter, GrpcCheckpointResponseField[])​

Get a checkpoint by its sequence number.

The optional transactions_filter and events_filter narrow the transactions and events returned for the checkpoint.

The optional read_mask controls which fields the server returns. If None, only the checkpoint summary is returned.

Task<GrpcCheckpointResponse> CheckpointBySequenceNumber(ulong sequenceNumber, GrpcTransactionFilter? transactionsFilter = null, GrpcEventFilter? eventsFilter = null, GrpcCheckpointResponseField[]? readMask = null)

Parameters​

sequenceNumber UInt64

transactionsFilter GrpcTransactionFilter?

eventsFilter GrpcEventFilter?

readMask GrpcCheckpointResponseField[]?

Returns​

Task<GrpcCheckpointResponse>

Exceptions​

SdkFfiException

CheckpointLatest(GrpcTransactionFilter, GrpcEventFilter, GrpcCheckpointResponseField[])​

Get the latest checkpoint.

The optional transactions_filter and events_filter narrow the transactions and events returned for the checkpoint.

The optional read_mask controls which fields the server returns. If None, only the checkpoint summary is returned.

Task<GrpcCheckpointResponse> CheckpointLatest(GrpcTransactionFilter? transactionsFilter = null, GrpcEventFilter? eventsFilter = null, GrpcCheckpointResponseField[]? readMask = null)

Parameters​

transactionsFilter GrpcTransactionFilter?

eventsFilter GrpcEventFilter?

readMask GrpcCheckpointResponseField[]?

Returns​

Task<GrpcCheckpointResponse>

Exceptions​

SdkFfiException

CheckpointsStream(UInt64?, UInt64?, GrpcTransactionFilter, GrpcEventFilter, GrpcCheckpointResponseField[])​

Stream checkpoints across a range of sequence numbers.

Every checkpoint in the range is yielded, even if the filters produce no matching transactions or events within it.

If start_sequence_number is None, the stream starts from the latest checkpoint. If end_sequence_number is None, the stream continues indefinitely.

The optional transactions_filter and events_filter narrow the transactions and events returned for each checkpoint.

The optional read_mask controls which fields the server returns for each checkpoint. If None, only the checkpoint summary is returned.

Task<GrpcCheckpointStream> CheckpointsStream(ulong? startSequenceNumber = null, ulong? endSequenceNumber = null, GrpcTransactionFilter? transactionsFilter = null, GrpcEventFilter? eventsFilter = null, GrpcCheckpointResponseField[]? readMask = null)

Parameters​

startSequenceNumber UInt64?

endSequenceNumber UInt64?

transactionsFilter GrpcTransactionFilter?

eventsFilter GrpcEventFilter?

readMask GrpcCheckpointResponseField[]?

Returns​

Task<GrpcCheckpointStream>

Exceptions​

SdkFfiException

CheckpointsStreamFiltered(UInt64?, UInt64?, GrpcTransactionFilter, GrpcEventFilter, UInt32?, GrpcCheckpointResponseField[])​

Stream checkpoints across a range of sequence numbers, skipping checkpoints with no data matching the filters.

Unlike [GrpcClient::checkpoints_stream], the filters decide which checkpoints are returned at all; checkpoints without any matching transactions or events are skipped entirely. At least one of transactions_filter or events_filter must be set.

While the server scans non-matching checkpoints, the stream yields progress items indicating the current scan position (default every 2000ms, configurable via progress_interval_ms, minimum 500ms).

If start_sequence_number is None, the stream starts from the latest checkpoint. If end_sequence_number is None, the stream continues indefinitely.

The optional read_mask controls which fields the server returns for each checkpoint. If None, only the checkpoint summary is returned.

Task<GrpcFilteredCheckpointStream> CheckpointsStreamFiltered(ulong? startSequenceNumber = null, ulong? endSequenceNumber = null, GrpcTransactionFilter? transactionsFilter = null, GrpcEventFilter? eventsFilter = null, uint? progressIntervalMs = null, GrpcCheckpointResponseField[]? readMask = null)

Parameters​

startSequenceNumber UInt64?

endSequenceNumber UInt64?

transactionsFilter GrpcTransactionFilter?

eventsFilter GrpcEventFilter?

progressIntervalMs UInt32?

readMask GrpcCheckpointResponseField[]?

Returns​

Task<GrpcFilteredCheckpointStream>

Exceptions​

SdkFfiException

Epoch(UInt64?, GrpcEpochField[])​

Get information about an epoch. If epoch is None, the current epoch is returned.

The optional read_mask controls which fields the server returns.

Task<GrpcEpochInfo> Epoch(ulong? epoch = null, GrpcEpochField[]? readMask = null)

Parameters​

epoch UInt64?

readMask GrpcEpochField[]?

Returns​

Task<GrpcEpochInfo>

Exceptions​

SdkFfiException

ReferenceGasPrice()​

Get the reference gas price of the current epoch, denominated in NANOS.

Task<ulong> ReferenceGasPrice()

Returns​

Task<UInt64>

Exceptions​

SdkFfiException

Health(UInt64?)​

Get the health of the node serving the gRPC service.

If threshold_ms is provided, the server returns an UNAVAILABLE error when the most recently executed checkpoint is older than the threshold.

Task<GrpcHealthInfo> Health(ulong? thresholdMs = null)

Parameters​

thresholdMs UInt64?

Returns​

Task<GrpcHealthInfo>

Exceptions​

SdkFfiException

Objects(ObjectId[], GrpcObjectField[])​

Get the latest version of objects by their ids.

Results are returned in the same order as the input ids, one per id. An object the serving node cannot return — because it is not found, was deleted, or has been pruned — fails only its own item, which reading throws with the server's error message. An object the server returns but that cannot be decoded fails the whole call.

The optional read_mask controls which fields the server returns. If None, the reference and the object are returned.

Task<GrpcObjectResults> Objects(ObjectId[] objectIds, GrpcObjectField[]? readMask = null)

Parameters​

objectIds ObjectId[]

readMask GrpcObjectField[]?

Returns​

Task<GrpcObjectResults>

Exceptions​

SdkFfiException

ObjectsWithVersions(GrpcObjectRequest[], GrpcObjectField[])​

Get objects by their ids and optional versions.

Results are returned in the same order as the input requests, one per request. An object the serving node cannot return — because it is not found, was deleted, or has been pruned — fails only its own item, which reading throws with the server's error message. An object the server returns but that cannot be decoded fails the whole call.

The optional read_mask controls which fields the server returns. If None, the reference and the object are returned.

Task<GrpcObjectResults> ObjectsWithVersions(GrpcObjectRequest[] requests, GrpcObjectField[]? readMask = null)

Parameters​

requests GrpcObjectRequest[]

readMask GrpcObjectField[]?

Returns​

Task<GrpcObjectResults>

Exceptions​

SdkFfiException

ServiceInfo(GrpcServiceInfoField[])​

Get information about the gRPC service and the node serving it.

The optional read_mask controls which fields the server returns.

Task<GrpcServiceInfo> ServiceInfo(GrpcServiceInfoField[]? readMask = null)

Parameters​

readMask GrpcServiceInfoField[]?

Returns​

Task<GrpcServiceInfo>

Exceptions​

SdkFfiException

Transactions(TransactionDigest[], GrpcTransactionField[])​

Get transactions by their digests.

Results are returned in the same order as the input digests, one per digest. A transaction the serving node cannot return — because it is not found or has been pruned — fails only its own item, which reading throws with the server's error message. A transaction the server returns but that cannot be decoded fails the whole call.

The optional read_mask controls which fields the server returns. If None, the transaction, signatures, checkpoint, and timestamp are returned.

Task<GrpcExecutedTransactionResults> Transactions(TransactionDigest[] digests, GrpcTransactionField[]? readMask = null)

Parameters​

digests TransactionDigest[]

readMask GrpcTransactionField[]?

Returns​

Task<GrpcExecutedTransactionResults>

Exceptions​

SdkFfiException

WaitForTransaction(TransactionDigest, WaitForTransaction)​

Wait for the indexing (on the node) or finalization of a transaction by its digest, polling the node until then. Returns an error after 60s.

Task WaitForTransaction(TransactionDigest digest, WaitForTransaction waitFor)

Parameters​

digest TransactionDigest

waitFor WaitForTransaction

Returns​

Task

Exceptions​

SdkFfiException

AllPackageVersions(ObjectId, UInt32?)​

List all versions of a Move package, auto-paginating up to limit versions. If limit is None, all versions are returned.

Task<GrpcPackageVersion[]> AllPackageVersions(ObjectId packageId, uint? limit = null)

Parameters​

packageId ObjectId

limit UInt32?

Returns​

Task<GrpcPackageVersion[]>

Exceptions​

SdkFfiException

PackageVersions(ObjectId, UInt32?, Byte[])​

List a single page of versions of a Move package.

Pass the returned next_page_token back in to retrieve the next page.

Task<GrpcPackageVersionPage> PackageVersions(ObjectId packageId, uint? pageSize = null, Byte[]? pageToken = null)

Parameters​

packageId ObjectId

pageSize UInt32?

pageToken Byte[]?

Returns​

Task<GrpcPackageVersionPage>

Exceptions​

SdkFfiException

CoinInfo(StructTag)​

Task<GrpcCoinInfo> CoinInfo(StructTag coinType)

Parameters​

coinType StructTag

Returns​

Task<GrpcCoinInfo>

AllCoins(Address, StructTag, UInt32?)​

Task<Coin[]> AllCoins(Address owner, StructTag? coinType = null, uint? limit = null)

Parameters​

owner Address

coinType StructTag?

limit UInt32?

Returns​

Task<Coin[]>

Coins(Address, StructTag, UInt32?, Byte[])​

Task<GrpcCoinPage> Coins(Address owner, StructTag? coinType = null, uint? pageSize = null, Byte[]? pageToken = null)

Parameters​

owner Address

coinType StructTag?

pageSize UInt32?

pageToken Byte[]?

Returns​

Task<GrpcCoinPage>

AllDynamicFields(ObjectId, UInt32?, GrpcDynamicFieldField[])​

List all dynamic fields of an object, auto-paginating up to limit fields. If limit is None, all fields are returned.

The optional read_mask controls which fields the server returns. If None, the parent and field id are returned.

Task<GrpcDynamicField[]> AllDynamicFields(ObjectId parent, uint? limit = null, GrpcDynamicFieldField[]? readMask = null)

Parameters​

parent ObjectId

limit UInt32?

readMask GrpcDynamicFieldField[]?

Returns​

Task<GrpcDynamicField[]>

Exceptions​

SdkFfiException

DynamicFields(ObjectId, UInt32?, Byte[], GrpcDynamicFieldField[])​

List a single page of dynamic fields of an object.

Pass the returned next_page_token back in to retrieve the next page.

The optional read_mask controls which fields the server returns. If None, the parent and field id are returned.

Task<GrpcDynamicFieldPage> DynamicFields(ObjectId parent, uint? pageSize = null, Byte[]? pageToken = null, GrpcDynamicFieldField[]? readMask = null)

Parameters​

parent ObjectId

pageSize UInt32?

pageToken Byte[]?

readMask GrpcDynamicFieldField[]?

Returns​

Task<GrpcDynamicFieldPage>

Exceptions​

SdkFfiException

AllOwnedObjects(Address, StructTag, UInt32?, GrpcOwnedObjectField[])​

List all objects owned by an address, optionally filtered by object type, auto-paginating up to limit objects. If limit is None, all objects are returned.

The optional read_mask controls which fields the server returns. If None, the object reference and the BCS-encoded object are returned.

Task<GrpcObject[]> AllOwnedObjects(Address owner, StructTag? objectType = null, uint? limit = null, GrpcOwnedObjectField[]? readMask = null)

Parameters​

owner Address

objectType StructTag?

limit UInt32?

readMask GrpcOwnedObjectField[]?

Returns​

Task<GrpcObject[]>

Exceptions​

SdkFfiException

OwnedObjects(Address, StructTag, UInt32?, Byte[], GrpcOwnedObjectField[])​

List a single page of objects owned by an address, optionally filtered by object type.

Pass the returned next_page_token back in to retrieve the next page.

The optional read_mask controls which fields the server returns. If None, the object reference and the BCS-encoded object are returned.

Task<GrpcOwnedObjectPage> OwnedObjects(Address owner, StructTag? objectType = null, uint? pageSize = null, Byte[]? pageToken = null, GrpcOwnedObjectField[]? readMask = null)

Parameters​

owner Address

objectType StructTag?

pageSize UInt32?

pageToken Byte[]?

readMask GrpcOwnedObjectField[]?

Returns​

Task<GrpcOwnedObjectPage>

Exceptions​

SdkFfiException

SetBasicAuth(String, String)​

Set a basic auth Authorization header that is sent with every request.

void SetBasicAuth(string username, string? password)

Parameters​

username String

password String?

SetBearerAuth(String)​

Set a bearer auth Authorization header that is sent with every request.

void SetBearerAuth(string token)

Parameters​

token String

Exceptions​

SdkFfiException

SetMaxDecodingMessageSize(UInt64)​

Set the maximum size in bytes that a response message can be.

void SetMaxDecodingMessageSize(ulong limit)

Parameters​

limit UInt64

TransactionBuilder(Address)​

Create a new transaction builder with the given sender address, backed by this client.

GrpcTransactionBuilder TransactionBuilder(Address sender)

Parameters​

sender Address

Returns​

GrpcTransactionBuilder