IGraphQlClient
Namespace: IotaSdk
The GraphQL client for interacting with the IOTA blockchain.
public interface IGraphQlClient
Attributes NullableContextAttribute
Methods
Balance(Address, String)
Task<ulong?> Balance(Address address, string? coinType = null)
Parameters
address Address
coinType String?
Returns
Checkpoint(CheckpointDigest, UInt64?)
Get the CheckpointSummary for a given checkpoint digest or
checkpoint id. If none is provided, it will use the last known
checkpoint id.
Task<CheckpointSummary?> Checkpoint(CheckpointDigest? digest = null, ulong? seqNum = null)
Parameters
digest CheckpointDigest?
seqNum UInt64?
Returns
Exceptions
Checkpoints(PaginationFilter)
Get a page of CheckpointSummary for the provided parameters.
Task<CheckpointSummaryPage> Checkpoints(PaginationFilter? paginationFilter = null)
Parameters
paginationFilter PaginationFilter?
Returns
Exceptions
LatestCheckpointSequenceNumber()
Return the sequence number of the latest checkpoint that has been executed.
Task<ulong?> LatestCheckpointSequenceNumber()
Returns
Exceptions
TotalTransactionBlocks()
The total number of transaction blocks in the network by the end of the last known checkpoint.
Task<ulong?> TotalTransactionBlocks()
Returns
Exceptions
TotalTransactionBlocksByDigest(CheckpointDigest)
The total number of transaction blocks in the network by the end of the provided checkpoint digest.
Task<ulong?> TotalTransactionBlocksByDigest(CheckpointDigest digest)
Parameters
digest CheckpointDigest
Returns
Exceptions
TotalTransactionBlocksBySeqNum(UInt64)
The total number of transaction blocks in the network by the end of the provided checkpoint sequence number.
Task<ulong?> TotalTransactionBlocksBySeqNum(ulong seqNum)
Parameters
seqNum UInt64
Returns
Exceptions
CoinMetadata(String)
Get the coin metadata for the coin type.
Task<CoinMetadata?> CoinMetadata(string coinType)
Parameters
coinType String
Returns
Exceptions
Coins(Address, PaginationFilter, StructTag)
Get the list of coins for the specified address.
If coin_type is not provided, all coins will be returned. For IOTA
coins, pass in the coin type: 0x2::iota::IOTA.
Task<CoinPage> Coins(Address owner, PaginationFilter? paginationFilter = null, StructTag? coinType = null)
Parameters
owner Address
paginationFilter PaginationFilter?
coinType StructTag?
Returns
Exceptions
GasCoins(Address, PaginationFilter)
Get the list of gas coins for the specified address.
Task<CoinPage> GasCoins(Address owner, PaginationFilter? paginationFilter = null)
Parameters
owner Address
paginationFilter PaginationFilter?
Returns
Exceptions
TotalSupply(String)
Get total supply for the coin type.
Task<ulong?> TotalSupply(string coinType)
Parameters
coinType String
Returns
Exceptions
DryRunTx(Transaction, Boolean)
Dry run a Transaction and return the transaction effects and dry run
error (if any).
skipChecks optional flag disables the usual verification checks that
prevent access to objects that are owned by addresses other than the
sender, and calling non-public, non-entry functions, and some other
checks. Defaults to false.
Task<DryRunResult> DryRunTx(Transaction tx, bool skipChecks = false)
Parameters
tx Transaction
skipChecks Boolean
Returns
Exceptions
DryRunTxKind(TransactionKind, TransactionMetadata, Boolean)
Dry run a TransactionKind and return the transaction effects and dry
run error (if any).
skipChecks optional flag disables the usual verification checks that
prevent access to objects that are owned by addresses other than the
sender, and calling non-public, non-entry functions, and some other
checks. Defaults to false.
tx_meta is the transaction metadata.
Task<DryRunResult> DryRunTxKind(TransactionKind txKind, TransactionMetadata txMeta, bool skipChecks = false)
Parameters
txKind TransactionKind
txMeta TransactionMetadata
skipChecks Boolean
Returns
Exceptions
DynamicField(Address, TypeTag, String)
Access a dynamic field on an object using its name. Names are arbitrary Move values whose type have copy, drop, and store, and are specified using their type, and their BCS contents, Base64 encoded.
The name argument is a json serialized type.
This returns DynamicFieldOutput which contains the name, the value
as json, and object.
Task<DynamicFieldOutput?> DynamicField(Address address, TypeTag typeTag, string name)
Parameters
address Address
typeTag TypeTag
name String
Returns
Exceptions
DynamicFields(Address, PaginationFilter)
Get a page of dynamic fields for the provided address. Note that this will also fetch dynamic fields on wrapped objects.
This returns a page of DynamicFieldOutputs.
Task<DynamicFieldOutputPage> DynamicFields(Address address, PaginationFilter? paginationFilter = null)
Parameters
address Address
paginationFilter PaginationFilter?
Returns
Exceptions
DynamicObjectField(Address, TypeTag, String)
Access a dynamic object field on an object using its name. Names are arbitrary Move values whose type have copy, drop, and store, and are specified using their type, and their BCS contents, Base64 encoded.
The name argument is a json serialized type.
This returns DynamicFieldOutput which contains the name, the value
as json, and object.
Task<DynamicFieldOutput?> DynamicObjectField(Address address, TypeTag typeTag, string name)
Parameters
address Address
typeTag TypeTag
name String
Returns
Exceptions
Epoch(UInt64?)
Return the epoch information for the provided epoch. If no epoch is provided, it will return the last known epoch.
Task<Epoch?> Epoch(ulong? epoch = null)
Parameters
epoch UInt64?
Returns
Exceptions
EpochTotalCheckpoints(UInt64?)
Return the number of checkpoints in this epoch. This will return
Ok(None) if the epoch requested is not available in the GraphQL
service (e.g., due to pruning).
Task<ulong?> EpochTotalCheckpoints(ulong? epoch = null)
Parameters
epoch UInt64?
Returns
Exceptions
EpochTotalTransactionBlocks(UInt64?)
Return the number of transaction blocks in this epoch. This will return
Ok(None) if the epoch requested is not available in the GraphQL
service (e.g., due to pruning).
Task<ulong?> EpochTotalTransactionBlocks(ulong? epoch = null)
Parameters
epoch UInt64?
Returns
Exceptions
Events(EventFilter, PaginationFilter)
Return a page of tuple (event, transaction digest) based on the (optional) event filter.
Task<EventPage> Events(EventFilter? filter = null, PaginationFilter? paginationFilter = null)
Parameters
filter EventFilter?
paginationFilter PaginationFilter?
Returns
Exceptions
IotaNamesDefaultName(Address, NameFormat?)
Get the default name pointing to this address, if one exists.
Task<Name?> IotaNamesDefaultName(Address address, NameFormat? format)
Parameters
address Address
format NameFormat?
Returns
Exceptions
IotaNamesLookup(String)
Return the resolved address for the given name.
Task<Address?> IotaNamesLookup(string name)
Parameters
name String
Returns
Exceptions
IotaNamesRegistrations(Address, PaginationFilter)
Find all registration NFTs for the given address.
Task<NameRegistrationPage> IotaNamesRegistrations(Address address, PaginationFilter paginationFilter)
Parameters
address Address
paginationFilter PaginationFilter
Returns
Exceptions
MoveViewCall(String, TypeTag[], MoveViewArg[])
Task<MoveViewResult> MoveViewCall(string functionName, TypeTag[]? typeArguments = null, MoveViewArg[]? arguments = null)
Parameters
functionName String
typeArguments TypeTag[]?
arguments MoveViewArg[]?
Returns
MoveViewCallJson(String, String[], String[])
Task<MoveViewResult> MoveViewCallJson(string functionName, String[]? typeArguments = null, String[]? arguments = null)
Parameters
functionName String
typeArguments String[]?
arguments String[]?
Returns
ActiveValidators(UInt64?, PaginationFilter)
Get the list of active validators for the provided epoch, including related metadata. If no epoch is provided, it will return the active validators for the current epoch.
Task<ValidatorPage> ActiveValidators(ulong? epoch = null, PaginationFilter? paginationFilter = null)
Parameters
epoch UInt64?
paginationFilter PaginationFilter?
Returns
Exceptions
ChainId()
Get the chain identifier.
Task<string> ChainId()
Returns
Exceptions
ProtocolConfig(UInt64?)
Get the protocol configuration.
Task<ProtocolConfigs> ProtocolConfig(ulong? version = null)
Parameters
version UInt64?
Returns
Exceptions
ReferenceGasPrice(UInt64?)
Get the reference gas price for the provided epoch or the last known one if no epoch is provided.
This will return Ok(None) if the epoch requested is not available in
the GraphQL service (e.g., due to pruning).
Task<ulong?> ReferenceGasPrice(ulong? epoch = null)
Parameters
epoch UInt64?
Returns
Exceptions
MoveObjectContents(ObjectId, Version)
Return the contents' JSON of an object that is a Move object.
If the object does not exist (e.g., due to pruning), this will return
Ok(None). Similarly, if this is not an object but an address, it
will return Ok(None).
Task<string?> MoveObjectContents(ObjectId objectId, Version? version = null)
Parameters
objectId ObjectId
version Version?
Returns
Exceptions
MoveObjectContentsBcs(ObjectId, Version)
Return the BCS of an object that is a Move object.
If the object does not exist (e.g., due to pruning), this will return
Ok(None). Similarly, if this is not an object but an address, it
will return Ok(None).
Task<Byte[]?> MoveObjectContentsBcs(ObjectId objectId, Version? version = null)
Parameters
objectId ObjectId
version Version?
Returns
Exceptions
Object(ObjectId, Version)
Return an object based on the provided Address.
If the object does not exist (e.g., due to pruning), this will return
Ok(None). Similarly, if this is not an object but an address, it
will return Ok(None).
Task<Object?> Object(ObjectId objectId, Version? version = null)
Parameters
objectId ObjectId
version Version?
Returns
Exceptions
ObjectBcs(ObjectId)
Task<Byte[]?> ObjectBcs(ObjectId objectId)
Parameters
objectId ObjectId
Returns
Objects(ObjectFilter, PaginationFilter)
Return a page of objects based on the provided parameters.
Use this function together with the ObjectFilter::owner to get the
objects owned by an address.
Task<ObjectPage> Objects(ObjectFilter? filter = null, PaginationFilter? paginationFilter = null)
Parameters
filter ObjectFilter?
paginationFilter PaginationFilter?
Returns
Exceptions
NormalizedMoveFunction(Address, String, String, Version)
Return the normalized Move function data for the provided package, module, and function.
Task<MoveFunction?> NormalizedMoveFunction(Address package, string module, string function, Version? version = null)
Parameters
package Address
module String
function String
version Version?
Returns
Exceptions
NormalizedMoveModule(Address, String, Version, PaginationFilter, PaginationFilter, PaginationFilter, PaginationFilter)
Return the normalized Move module data for the provided module.
Task<MoveModule?> NormalizedMoveModule(Address package, string module, Version? version = null, PaginationFilter? paginationFilterEnums = null, PaginationFilter? paginationFilterFriends = null, PaginationFilter? paginationFilterFunctions = null, PaginationFilter? paginationFilterStructs = null)
Parameters
package Address
module String
version Version?
paginationFilterEnums PaginationFilter?
paginationFilterFriends PaginationFilter?
paginationFilterFunctions PaginationFilter?
paginationFilterStructs PaginationFilter?
Returns
Exceptions
Package(Address, Version)
The package corresponding to the given address (at the optionally given version). When no version is given, the package is loaded directly from the address given. Otherwise, the address is translated before loading to point to the package whose original ID matches the package at address, but whose version is version. For non-system packages, this might result in a different address than address because different versions of a package, introduced by upgrades, exist at distinct addresses.
Note that this interpretation of version is different from a historical object read (the interpretation of version for the object query).
Task<MovePackage?> Package(Address address, Version? version = null)
Parameters
address Address
version Version?
Returns
Exceptions
PackageLatest(Address)
Fetch the latest version of the package at address. This corresponds to the package with the highest version that shares its original ID with the package at address.
Task<MovePackage?> PackageLatest(Address address)
Parameters
address Address
Returns
Exceptions
PackageVersions(Address, Version, Version, PaginationFilter)
Fetch all versions of package at address (packages that share this package's original ID), optionally bounding the versions exclusively from below with afterVersion, or from above with beforeVersion.
Task<MovePackagePage> PackageVersions(Address address, Version? afterVersion = null, Version? beforeVersion = null, PaginationFilter? paginationFilter = null)
Parameters
address Address
afterVersion Version?
beforeVersion Version?
paginationFilter PaginationFilter?
Returns
Exceptions
Packages(UInt64?, UInt64?, PaginationFilter)
The Move packages that exist in the network, optionally filtered to be strictly before beforeCheckpoint and/or strictly after afterCheckpoint.
This query returns all versions of a given user package that appear between the specified checkpoints, but only records the latest versions of system packages.
Task<MovePackagePage> Packages(ulong? afterCheckpoint = null, ulong? beforeCheckpoint = null, PaginationFilter? paginationFilter = null)
Parameters
afterCheckpoint UInt64?
beforeCheckpoint UInt64?
paginationFilter PaginationFilter?
Returns
Exceptions
ExecuteTx(UserSignature[], Transaction, WaitForTx?)
Execute a transaction.
Task<TransactionEffects> ExecuteTx(UserSignature[] signatures, Transaction tx, WaitForTx? waitFor = null)
Parameters
signatures UserSignature[]
tx Transaction
waitFor WaitForTx?
Returns
Exceptions
IsTxFinalized(TransactionDigest)
Returns whether the transaction for the given digest has been included in a checkpoint (finalized).
Task<bool> IsTxFinalized(TransactionDigest digest)
Parameters
digest TransactionDigest
Returns
Exceptions
IsTxIndexedOnNode(TransactionDigest)
Returns whether the transaction for the given digest has been indexed
on the node. This means that it can be queried by its digest and its
effects will be usable for subsequent transactions. To check for
full finalization, use is_tx_finalized.
Task<bool> IsTxIndexedOnNode(TransactionDigest digest)
Parameters
digest TransactionDigest
Returns
Exceptions
Transaction(TransactionDigest)
Get a transaction by its digest.
Task<SignedTransaction?> Transaction(TransactionDigest digest)
Parameters
digest TransactionDigest
Returns
Exceptions
TransactionDataEffects(TransactionDigest)
Get a transaction's data and effects by its digest.
Task<TransactionDataEffects?> TransactionDataEffects(TransactionDigest digest)
Parameters
digest TransactionDigest
Returns
Exceptions
TransactionEffects(TransactionDigest)
Get a transaction's effects by its digest.
Task<TransactionEffects?> TransactionEffects(TransactionDigest digest)
Parameters
digest TransactionDigest
Returns
Exceptions
Transactions(TransactionsFilter, PaginationFilter)
Get a page of transactions based on the provided filters.
Task<SignedTransactionPage> Transactions(TransactionsFilter? filter = null, PaginationFilter? paginationFilter = null)
Parameters
filter TransactionsFilter?
paginationFilter PaginationFilter?
Returns
Exceptions
TransactionsDataEffects(TransactionsFilter, PaginationFilter)
Get a page of transactions' data and effects based on the provided filters.
Task<TransactionDataEffectsPage> TransactionsDataEffects(TransactionsFilter? filter = null, PaginationFilter? paginationFilter = null)
Parameters
filter TransactionsFilter?
paginationFilter PaginationFilter?
Returns
Task<TransactionDataEffectsPage>
Exceptions
TransactionsEffects(TransactionsFilter, PaginationFilter)
Get a page of transactions' effects based on the provided filters.
Task<TransactionEffectsPage> TransactionsEffects(TransactionsFilter? filter = null, PaginationFilter? paginationFilter = null)
Parameters
filter TransactionsFilter?
paginationFilter PaginationFilter?
Returns
Exceptions
WaitForTx(TransactionDigest, WaitForTx, TimeSpan?)
Wait for the indexing (on the node, not the indexer) or finalization of a transaction by its digest. An optional timeout can be provided, which, if exceeded, will return an error (default 60s).
Task WaitForTx(TransactionDigest digest, WaitForTx waitFor, TimeSpan? timeout = null)
Parameters
digest TransactionDigest
waitFor WaitForTx
timeout TimeSpan?
Returns
Exceptions
MaxPageSize()
Lazily fetch the max page size
Task<int> MaxPageSize()
Returns
Exceptions
RunQuery(Query)
Run a query.
Task<string> RunQuery(Query query)
Parameters
query Query
Returns
Exceptions
ServiceConfig()
Get the GraphQL service configuration, including complexity limits, read and mutation limits, supported versions, and others.
Task<ServiceConfig> ServiceConfig()
Returns
Exceptions
SetRpcServer(String)
Set the server address for the GraphQL client. It should be a valid URL with a host and optionally a port number.
Task SetRpcServer(string server)
Parameters
server String
Returns
Exceptions
EventsSubscription(SubscriptionEventFilter, String)
Subscribe to a live stream of events matching the (optional) filter.
start_after optionally resumes from the transaction immediately
following the given transaction digest; thereafter the subscription
tracks its own resume point across reconnects.
Note: subscriptions are served over a WebSocket and are currently
supported on devnet and localnet only. They are unavailable altogether
in the wasm build, where next raises.
Task<EventSubscription> EventsSubscription(SubscriptionEventFilter? filter = null, string? startAfter = null)
Parameters
filter SubscriptionEventFilter?
startAfter String?
Returns
TransactionsSubscription(SubscriptionTransactionFilter, String)
Subscribe to a live stream of transactions matching the (optional) filter.
start_after optionally resumes from the transaction immediately
following the given digest; thereafter the subscription tracks its own
resume point across reconnects.
Note: subscriptions are served over a WebSocket and are currently
supported on devnet and localnet only. They are unavailable altogether
in the wasm build, where next raises.
Task<TransactionSubscription> TransactionsSubscription(SubscriptionTransactionFilter? filter = null, string? startAfter = null)
Parameters
filter SubscriptionTransactionFilter?
startAfter String?
Returns
TransactionBuilder(Address)
Create a new TransactionBuilder with the given sender address.
ClientTransactionBuilder TransactionBuilder(Address sender)
Parameters
sender Address