GraphQlClient
open class GraphQlClient : Disposable, AutoCloseable, GraphQlClientInterface
The GraphQL client for interacting with the IOTA blockchain.
Constructors
| GraphQlClient | constructor(server: String) Create a new GraphQL client with the provided server address. |
Functions
| Name | Summary |
|---|---|
| activeValidators | open suspend override fun activeValidators(epoch: ULong?, paginationFilter: PaginationFilter?): ValidatorPage 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. |
| balance | open suspend override fun balance(address: Address, coinType: String?): ULong? Get the balance of all the coins owned by address for the provided coin type. Coin type will default to 0x2::coin::Coin<0x2::iota::IOTA> if not provided. |
| chainId | open suspend override fun chainId(): String Get the chain identifier. |
| checkpoint | open suspend override fun checkpoint(digest: CheckpointDigest?, seqNum: ULong?): CheckpointSummary? Get the CheckpointSummary for a given checkpoint digest or checkpoint id. If none is provided, it will use the last known checkpoint id. |
| checkpoints | open suspend override fun checkpoints(paginationFilter: PaginationFilter?): CheckpointSummaryPage Get a page of CheckpointSummary for the provided parameters. |
| close | @Synchronized open override fun close() |
| coinMetadata | open suspend override fun coinMetadata(coinType: String): CoinMetadata? Get the coin metadata for the coin type. |
| coins | open suspend override fun coins(owner: Address, paginationFilter: PaginationFilter?, coinType: StructTag?): CoinPage Get the list of coins for the specified address. |
| destroy | open override fun destroy() |
| dryRunTx | open suspend override fun dryRunTx(tx: Transaction, skipChecks: Boolean): DryRunResult Dry run a Transaction and return the transaction effects and dry run error (if any). |
| dryRunTxKind | open suspend override fun dryRunTxKind(txKind: TransactionKind, txMeta: TransactionMetadata, skipChecks: Boolean): DryRunResult Dry run a TransactionKind and return the transaction effects and dry run error (if any). |
| dynamicField | open suspend override fun dynamicField(address: Address, typeTag: TypeTag, name: Value): DynamicFieldOutput? 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. |
| dynamicFields | open suspend override fun dynamicFields(address: Address, paginationFilter: PaginationFilter?): DynamicFieldOutputPage Get a page of dynamic fields for the provided address. Note that this will also fetch dynamic fields on wrapped objects. |
| dynamicObjectField | open suspend override fun dynamicObjectField(address: Address, typeTag: TypeTag, name: Value): DynamicFieldOutput? 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. |
| epoch | open suspend override fun epoch(epoch: ULong?): Epoch? Return the epoch information for the provided epoch. If no epoch is provided, it will return the last known epoch. |
| epochTotalCheckpoints | open suspend override fun epochTotalCheckpoints(epoch: ULong?): ULong? 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). |
| epochTotalTransactionBlocks | open suspend override fun epochTotalTransactionBlocks(epoch: ULong?): ULong? 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). |
| events | open suspend override fun events(filter: EventFilter?, paginationFilter: PaginationFilter?): EventPage Return a page of tuple (event, transaction digest) based on the (optional) event filter. |
| eventsSubscription | open suspend override fun eventsSubscription(filter: SubscriptionEventFilter?, startAfter: String?): EventSubscription Subscribe to a live stream of events matching the (optional) filter. |
| executeTx | open suspend override fun executeTx(signatures: List<UserSignature>, tx: Transaction, waitFor: WaitForTx?): TransactionEffects Execute a transaction. |
| gasCoins | open suspend override fun gasCoins(owner: Address, paginationFilter: PaginationFilter?): CoinPage Get the list of gas coins for the specified address. |
| iotaNamesDefaultName | open suspend override fun iotaNamesDefaultName(address: Address, format: NameFormat?): Name? Get the default name pointing to this address, if one exists. |
| iotaNamesLookup | open suspend override fun iotaNamesLookup(name: String): Address? Return the resolved address for the given name. |
| iotaNamesRegistrations | open suspend override fun iotaNamesRegistrations(address: Address, paginationFilter: PaginationFilter): NameRegistrationPage Find all registration NFTs for the given address. |
| isTxFinalized | open suspend override fun isTxFinalized(digest: TransactionDigest): Boolean Returns whether the transaction for the given digest has been included in a checkpoint (finalized). |
| isTxIndexedOnNode | open suspend override fun isTxIndexedOnNode(digest: TransactionDigest): Boolean 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. |
| latestCheckpointSequenceNumber | open suspend override fun latestCheckpointSequenceNumber(): ULong? Return the sequence number of the latest checkpoint that has been executed. |
| maxPageSize | open suspend override fun maxPageSize(): Int Lazily fetch the max page size |
| moveObjectContents | open suspend override fun moveObjectContents(objectId: ObjectId, version: Version?): Value? Return the contents' JSON of an object that is a Move object. |
| moveObjectContentsBcs | open suspend override fun moveObjectContentsBcs(objectId: ObjectId, version: Version?): ByteArray? Return the BCS of an object that is a Move object. |
| moveViewCall | open suspend override fun moveViewCall(functionName: String, typeArguments: List<TypeTag>?, arguments: List<MoveViewArg>?): MoveViewResult Execute a Move View Function. |
| moveViewCallJson | open suspend override fun moveViewCallJson(functionName: String, typeArguments: List<String>?, arguments: List<Value>?): MoveViewResult Execute a Move View Function with raw JSON arguments. |
| normalizedMoveFunction | open suspend override fun normalizedMoveFunction(package: Address, module: String, function: String, version: Version?): MoveFunction? Return the normalized Move function data for the provided package, module, and function. |
| normalizedMoveModule | open suspend override fun normalizedMoveModule(package: Address, module: String, version: Version?, paginationFilterEnums: PaginationFilter?, paginationFilterFriends: PaginationFilter?, paginationFilterFunctions: PaginationFilter?, paginationFilterStructs: PaginationFilter?): MoveModule? Return the normalized Move module data for the provided module. |
| object | open suspend override fun object(objectId: ObjectId, version: Version?): Object? Return an object based on the provided Address. |
| objectBcs | open suspend override fun objectBcs(objectId: ObjectId): ByteArray? Return the object's bcs content Vec<u8> based on the provided Address. |
| objects | open suspend override fun objects(filter: ObjectFilter?, paginationFilter: PaginationFilter?): ObjectPage Return a page of objects based on the provided parameters. |
| package | open suspend override fun package(address: Address, version: Version?): MovePackage? 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. |
| packageLatest | open suspend override fun packageLatest(address: Address): MovePackage? 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. |
| packages | open suspend override fun packages(afterCheckpoint: ULong?, beforeCheckpoint: ULong?, paginationFilter: PaginationFilter?): MovePackagePage The Move packages that exist in the network, optionally filtered to be strictly before beforeCheckpoint and/or strictly after afterCheckpoint. |
| packageVersions | open suspend override fun packageVersions(address: Address, afterVersion: Version?, beforeVersion: Version?, paginationFilter: PaginationFilter?): MovePackagePage 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. |
| protocolConfig | open suspend override fun protocolConfig(version: ULong?): ProtocolConfigs Get the protocol configuration. |
| referenceGasPrice | open suspend override fun referenceGasPrice(epoch: ULong?): ULong? Get the reference gas price for the provided epoch or the last known one if no epoch is provided. |
| runQuery | open suspend override fun runQuery(query: Query): Value Run a query. |
| serviceConfig | open suspend override fun serviceConfig(): ServiceConfig Get the GraphQL service configuration, including complexity limits, read and mutation limits, supported versions, and others. |
| setRpcServer | open suspend override fun setRpcServer(server: String) Set the server address for the GraphQL client. It should be a valid URL with a host and optionally a port number. |
| totalSupply | open suspend override fun totalSupply(coinType: String): ULong? Get total supply for the coin type. |
| totalTransactionBlocks | open suspend override fun totalTransactionBlocks(): ULong? The total number of transaction blocks in the network by the end of the last known checkpoint. |
| totalTransactionBlocksByDigest | open suspend override fun totalTransactionBlocksByDigest(digest: CheckpointDigest): ULong? The total number of transaction blocks in the network by the end of the provided checkpoint digest. |
| totalTransactionBlocksBySeqNum | open suspend override fun totalTransactionBlocksBySeqNum(seqNum: ULong): ULong? The total number of transaction blocks in the network by the end of the provided checkpoint sequence number. |
| transaction | open suspend override fun transaction(digest: TransactionDigest): SignedTransaction? Get a transaction by its digest. |
| transactionBuilder | open override fun transactionBuilder(sender: Address): ClientTransactionBuilder Create a new TransactionBuilder with the given sender address. |
| transactionDataEffects | open suspend override fun transactionDataEffects(digest: TransactionDigest): TransactionDataEffects? Get a transaction's data and effects by its digest. |
| transactionEffects | open suspend override fun transactionEffects(digest: TransactionDigest): TransactionEffects? Get a transaction's effects by its digest. |
| transactions | open suspend override fun transactions(filter: TransactionsFilter?, paginationFilter: PaginationFilter?): SignedTransactionPage Get a page of transactions based on the provided filters. |
| transactionsDataEffects | open suspend override fun transactionsDataEffects(filter: TransactionsFilter?, paginationFilter: PaginationFilter?): TransactionDataEffectsPage Get a page of transactions' data and effects based on the provided filters. |
| transactionsEffects | open suspend override fun transactionsEffects(filter: TransactionsFilter?, paginationFilter: PaginationFilter?): TransactionEffectsPage Get a page of transactions' effects based on the provided filters. |
| transactionsSubscription | open suspend override fun transactionsSubscription(filter: SubscriptionTransactionFilter?, startAfter: String?): TransactionSubscription Subscribe to a live stream of transactions matching the (optional) filter. |
| waitForTx | open suspend override fun waitForTx(digest: TransactionDigest, waitFor: WaitForTx, timeout: Duration?) 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). |
Companion object functions
| Name | Summary |
|---|---|
| newDevnet | fun newDevnet(): GraphQlClient Create a new GraphQL client connected to the devnet GraphQL server: {DEVNET_HOST}. |
| newLocalnet | fun newLocalnet(): GraphQlClient Create a new GraphQL client connected to the localhost GraphQL server: {DEFAULT_LOCAL_HOST}. |
| newMainnet | fun newMainnet(): GraphQlClient Create a new GraphQL client connected to the mainnet GraphQL server: {MAINNET_HOST}. |
| newTestnet | fun newTestnet(): GraphQlClient Create a new GraphQL client connected to the testnet GraphQL server: {TESTNET_HOST}. |