GrpcClient
open class GrpcClient : Disposable, AutoCloseable, GrpcClientInterface
The gRPC client for interacting with the IOTA blockchain.
Constructors
| GrpcClient | constructor(uri: String) Create a new gRPC client with the provided server URI. |
Functions
| Name | Summary |
|---|---|
| allCoins | open 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. |
| allDynamicFields | open 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. |
| allOwnedObjects | open 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. |
| allPackageVersions | open 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. |
| checkpointByDigest | open suspend override fun checkpointByDigest(digest: CheckpointDigest, transactionsFilter: GrpcTransactionFilter?, eventsFilter: GrpcEventFilter?, readMask: List<GrpcCheckpointResponseField>?): GrpcCheckpointResponse Get a checkpoint by its digest. |
| checkpointBySequenceNumber | open suspend override fun checkpointBySequenceNumber(sequenceNumber: ULong, transactionsFilter: GrpcTransactionFilter?, eventsFilter: GrpcEventFilter?, readMask: List<GrpcCheckpointResponseField>?): GrpcCheckpointResponse Get a checkpoint by its sequence number. |
| checkpointLatest | open suspend override fun checkpointLatest(transactionsFilter: GrpcTransactionFilter?, eventsFilter: GrpcEventFilter?, readMask: List<GrpcCheckpointResponseField>?): GrpcCheckpointResponse Get the latest checkpoint. |
| checkpointsStream | open suspend override fun checkpointsStream(startSequenceNumber: ULong?, endSequenceNumber: ULong?, transactionsFilter: GrpcTransactionFilter?, eventsFilter: GrpcEventFilter?, readMask: List<GrpcCheckpointResponseField>?): GrpcCheckpointStream Stream checkpoints across a range of sequence numbers. |
| checkpointsStreamFiltered | open 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() |
| coinInfo | open suspend override fun coinInfo(coinType: StructTag): GrpcCoinInfo Get information about a coin type, including its metadata, treasury, and regulated metadata. |
| coins | open 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. |
| destroy | open override fun destroy() |
| dynamicFields | open suspend override fun dynamicFields(parent: ObjectId, pageSize: UInt?, pageToken: ByteArray?, readMask: List<GrpcDynamicFieldField>?): GrpcDynamicFieldPage List a single page of dynamic fields of an object. |
| epoch | open suspend override fun epoch(epoch: ULong?, readMask: List<GrpcEpochField>?): GrpcEpochInfo Get information about an epoch. If epoch is None, the current epoch is returned. |
| executeTransaction | open suspend override fun executeTransaction(signedTransaction: SignedTransaction, checkpointInclusionTimeoutMs: ULong?, readMask: List<GrpcTransactionField>?): GrpcExecutedTransaction Execute a signed transaction. |
| executeTransactions | open suspend override fun executeTransactions(transactions: List<SignedTransaction>, checkpointInclusionTimeoutMs: ULong?, readMask: List<GrpcTransactionField>?): GrpcExecutedTransactionResults Execute a batch of signed transactions. |
| health | open suspend override fun health(thresholdMs: ULong?): GrpcHealthInfo Get the health of the node serving the gRPC service. |
| objects | open suspend override fun objects(objectIds: List<ObjectId>, readMask: List<GrpcObjectField>?): GrpcObjectResults Get the latest version of objects by their ids. |
| objectsWithVersions | open suspend override fun objectsWithVersions(requests: List<GrpcObjectRequest>, readMask: List<GrpcObjectField>?): GrpcObjectResults Get objects by their ids and optional versions. |
| ownedObjects | open 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. |
| packageVersions | open suspend override fun packageVersions(packageId: ObjectId, pageSize: UInt?, pageToken: ByteArray?): GrpcPackageVersionPage List a single page of versions of a Move package. |
| referenceGasPrice | open suspend override fun referenceGasPrice(): ULong Get the reference gas price of the current epoch, denominated in NANOS. |
| serviceInfo | open suspend override fun serviceInfo(readMask: List<GrpcServiceInfoField>?): GrpcServiceInfo Get information about the gRPC service and the node serving it. |
| setBasicAuth | open override fun setBasicAuth(username: String, password: String?) Set a basic auth Authorization header that is sent with every request. |
| setBearerAuth | open override fun setBearerAuth(token: String) Set a bearer auth Authorization header that is sent with every request. |
| setMaxDecodingMessageSize | open override fun setMaxDecodingMessageSize(limit: ULong) Set the maximum size in bytes that a response message can be. |
| simulateTransaction | open suspend override fun simulateTransaction(transaction: Transaction, skipChecks: Boolean, readMask: List<GrpcSimulateField>?): GrpcSimulatedTransaction Simulate a transaction. |
| simulateTransactions | open suspend override fun simulateTransactions(transactions: List<GrpcSimulateTransactionInput>, readMask: List<GrpcSimulateField>?): List<GrpcSimulatedTransactionResult> Simulate a batch of transactions. |
| transactionBuilder | open override fun transactionBuilder(sender: Address): GrpcTransactionBuilder Create a new transaction builder with the given sender address, backed by this client. |
| transactions | open suspend override fun transactions(digests: List<TransactionDigest>, readMask: List<GrpcTransactionField>?): GrpcExecutedTransactionResults Get transactions by their digests. |
| viewFunctionCall | open 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. |
| viewFunctionCalls | open suspend override fun viewFunctionCalls(functionCalls: List<GrpcViewFunctionCallInput>, readMask: List<GrpcViewFunctionCallField>?): List<GrpcViewFunctionCallResult> Call a batch of Move view functions. |
| waitForTransaction | open 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
| Name | Summary |
|---|---|
| newDevnet | fun newDevnet(): GrpcClient Create a new gRPC client connected to the devnet gRPC server. |
| newLocalnet | fun newLocalnet(): GrpcClient Create a new gRPC client connected to a localnet gRPC server: http://localhost:50051. |
| newMainnet | fun newMainnet(): GrpcClient Create a new gRPC client connected to the mainnet gRPC server. |
| newTestnet | fun newTestnet(): GrpcClient Create a new gRPC client connected to the testnet gRPC server. |