OZIndexerClient

class OZIndexerClient(indexerUrl: String, timeoutMs: Long = OZConstants.DEFAULT_INDEXER_TIMEOUT_MS, injectedClient: HttpClient? = null) : AutoCloseable

Client for interacting with the OpenZeppelin Smart Account indexer service.

The indexer maps WebAuthn credential IDs and signer addresses to deployed smart account contract addresses, enabling "Connect Wallet" discovery and contract exploration.

Example usage:

val client = OZIndexerClient(indexerUrl = "https://indexer.example.com")

// Look up contracts by credential ID
val credentialResponse = client.lookupByCredentialId("abc123...")
println("Found ${credentialResponse.count} contracts")

// Look up contracts by signer address
val addressResponse = client.lookupByAddress("GABC123...")
println("Signer is registered in ${addressResponse.count} contracts")

// Get full contract details
val contractDetails = client.getContract("CABC123...")
println("Contract has ${contractDetails.contextRules.size} context rules")

Parameters

indexerUrl

The indexer endpoint URL (trailing slashes are stripped)

timeoutMs

Request timeout in milliseconds

injectedClient

Optional custom HTTP client for testing

Throws

if the URL is blank or does not use HTTPS (http://localhost is permitted for development).

Constructors

Link copied to clipboard
constructor(indexerUrl: String, timeoutMs: Long = OZConstants.DEFAULT_INDEXER_TIMEOUT_MS, injectedClient: HttpClient? = null)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun close()

Closes the owned HTTP client and releases resources.

Link copied to clipboard
suspend fun getContract(contractId: String): ContractDetailsResponse

Gets detailed information about a smart account contract.

Link copied to clipboard

Gets statistics from the indexer.

Link copied to clipboard
suspend fun isHealthy(): Boolean

Checks if the indexer service is healthy and reachable.

Link copied to clipboard

Looks up smart account contracts by signer address.

Link copied to clipboard

Looks up smart account contracts by WebAuthn credential ID.