Skip to main content

GrpcClient

open class GrpcClient : Disposable, AutoCloseable, GrpcClientInterface

The gRPC client for interacting with the IOTA blockchain.

Constructors​

GrpcClientconstructor(uri: String)
Create a new gRPC client with the provided server URI.

Functions​

NameSummary
allCoinsopen suspend override fun allCoins(owner: Address, coinType: StructTag?, limit: UInt?): List<Coin>
List all coins owned by an address, optionally filtered by coin type (the inner type T of Coin<T>), auto-paginating up to limit coins. If coin_type is None, coins of all types are returned. If limit is None, all coins are returned.
allDynamicFieldsopen suspend override fun allDynamicFields(parent: ObjectId, limit: UInt?, readMask: List<GrpcDynamicFieldField>?): List<GrpcDynamicField>
List all dynamic fields of an object, auto-paginating up to limit fields. If limit is None, all fields are returned.
allOwnedObjectsopen suspend override fun allOwnedObjects(owner: Address, objectType: StructTag?, limit: UInt?, readMask: List<GrpcOwnedObjectField>?): List<GrpcObject>
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.
allPackageVersionsopen suspend override fun allPackageVersions(packageId: ObjectId, limit: UInt?): List<GrpcPackageVersion>
List all versions of a Move package, auto-paginating up to limit versions. If limit is None, all versions are returned.
checkpointByDigestopen suspend override fun checkpointByDigest(digest: CheckpointDigest, transactionsFilter: GrpcTransactionFilter?, eventsFilter: GrpcEventFilter?, readMask: List<GrpcCheckpointResponseField>?): GrpcCheckpointResponse
Get a checkpoint by its digest.
checkpointBySequenceNumberopen suspend override fun checkpointBySequenceNumber(sequenceNumber: ULong, transactionsFilter: GrpcTransactionFilter?, eventsFilter: GrpcEventFilter?, readMask: List<GrpcCheckpointResponseField>?): GrpcCheckpointResponse
Get a checkpoint by its sequence number.
checkpointLatestopen suspend override fun checkpointLatest(transactionsFilter: GrpcTransactionFilter?, eventsFilter: GrpcEventFilter?, readMask: List<GrpcCheckpointResponseField>?): GrpcCheckpointResponse
Get the latest checkpoint.
checkpointsStreamopen suspend override fun checkpointsStream(startSequenceNumber: ULong?, endSequenceNumber: ULong?, transactionsFilter: GrpcTransactionFilter?, eventsFilter: GrpcEventFilter?, readMask: List<GrpcCheckpointResponseField>?): GrpcCheckpointStream
Stream checkpoints across a range of sequence numbers.
checkpointsStreamFilteredopen suspend override fun checkpointsStreamFiltered(startSequenceNumber: ULong?, endSequenceNumber: ULong?, transactionsFilter: GrpcTransactionFilter?, eventsFilter: GrpcEventFilter?, progressIntervalMs: UInt?, readMask: List<GrpcCheckpointResponseField>?): GrpcFilteredCheckpointStream
Stream checkpoints across a range of sequence numbers, skipping checkpoints with no data matching the filters.
close@Synchronized
open override fun close()
coinInfoopen suspend override fun coinInfo(coinType: StructTag): GrpcCoinInfo
Get information about a coin type, including its metadata, treasury, and regulated metadata.
coinsopen suspend override fun coins(owner: Address, coinType: StructTag?, pageSize: UInt?, pageToken: ByteArray?): GrpcCoinPage
List a single page of coins owned by an address, optionally filtered by coin type (the inner type T of Coin<T>). If coin_type is None, coins of all types are returned.
destroyopen override fun destroy()
dynamicFieldsopen suspend override fun dynamicFields(parent: ObjectId, pageSize: UInt?, pageToken: ByteArray?, readMask: List<GrpcDynamicFieldField>?): GrpcDynamicFieldPage
List a single page of dynamic fields of an object.
epochopen suspend override fun epoch(epoch: ULong?, readMask: List<GrpcEpochField>?): GrpcEpochInfo
Get information about an epoch. If epoch is None, the current epoch is returned.
executeTransactionopen suspend override fun executeTransaction(signedTransaction: SignedTransaction, checkpointInclusionTimeoutMs: ULong?, readMask: List<GrpcTransactionField>?): GrpcExecutedTransaction
Execute a signed transaction.
executeTransactionsopen suspend override fun executeTransactions(transactions: List<SignedTransaction>, checkpointInclusionTimeoutMs: ULong?, readMask: List<GrpcTransactionField>?): GrpcExecutedTransactionResults
Execute a batch of signed transactions.
healthopen suspend override fun health(thresholdMs: ULong?): GrpcHealthInfo
Get the health of the node serving the gRPC service.
objectsopen suspend override fun objects(objectIds: List<ObjectId>, readMask: List<GrpcObjectField>?): GrpcObjectResults
Get the latest version of objects by their ids.
objectsWithVersionsopen suspend override fun objectsWithVersions(requests: List<GrpcObjectRequest>, readMask: List<GrpcObjectField>?): GrpcObjectResults
Get objects by their ids and optional versions.
ownedObjectsopen suspend override fun ownedObjects(owner: Address, objectType: StructTag?, pageSize: UInt?, pageToken: ByteArray?, readMask: List<GrpcOwnedObjectField>?): GrpcOwnedObjectPage
List a single page of objects owned by an address, optionally filtered by object type.
packageVersionsopen suspend override fun packageVersions(packageId: ObjectId, pageSize: UInt?, pageToken: ByteArray?): GrpcPackageVersionPage
List a single page of versions of a Move package.
referenceGasPriceopen suspend override fun referenceGasPrice(): ULong
Get the reference gas price of the current epoch, denominated in NANOS.
serviceInfoopen suspend override fun serviceInfo(readMask: List<GrpcServiceInfoField>?): GrpcServiceInfo
Get information about the gRPC service and the node serving it.
setBasicAuthopen override fun setBasicAuth(username: String, password: String?)
Set a basic auth Authorization header that is sent with every request.
setBearerAuthopen override fun setBearerAuth(token: String)
Set a bearer auth Authorization header that is sent with every request.
setMaxDecodingMessageSizeopen override fun setMaxDecodingMessageSize(limit: ULong)
Set the maximum size in bytes that a response message can be.
simulateTransactionopen suspend override fun simulateTransaction(transaction: Transaction, skipChecks: Boolean, readMask: List<GrpcSimulateField>?): GrpcSimulatedTransaction
Simulate a transaction.
simulateTransactionsopen suspend override fun simulateTransactions(transactions: List<GrpcSimulateTransactionInput>, readMask: List<GrpcSimulateField>?): List<GrpcSimulatedTransactionResult>
Simulate a batch of transactions.
transactionBuilderopen override fun transactionBuilder(sender: Address): GrpcTransactionBuilder
Create a new transaction builder with the given sender address, backed by this client.
transactionsopen suspend override fun transactions(digests: List<TransactionDigest>, readMask: List<GrpcTransactionField>?): GrpcExecutedTransactionResults
Get transactions by their digests.
viewFunctionCallopen suspend override fun viewFunctionCall(fqFunctionName: String, typeArgs: List<TypeTag>, callArgs: List<MoveViewArg>, readMask: List<GrpcViewFunctionCallField>?): GrpcViewFunctionCallOutputs
Call a Move view function and read back what it returns, without submitting a transaction.
viewFunctionCallsopen suspend override fun viewFunctionCalls(functionCalls: List<GrpcViewFunctionCallInput>, readMask: List<GrpcViewFunctionCallField>?): List<GrpcViewFunctionCallResult>
Call a batch of Move view functions.
waitForTransactionopen suspend override fun waitForTransaction(digest: TransactionDigest, waitFor: 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.

Companion object functions​

NameSummary
newDevnetfun newDevnet(): GrpcClient
Create a new gRPC client connected to the devnet gRPC server.
newLocalnetfun newLocalnet(): GrpcClient
Create a new gRPC client connected to a localnet gRPC server: http://localhost:50051.
newMainnetfun newMainnet(): GrpcClient
Create a new gRPC client connected to the mainnet gRPC server.
newTestnetfun newTestnet(): GrpcClient
Create a new gRPC client connected to the testnet gRPC server.