OZRelayer Client
Client for submitting transactions to an OpenZeppelin Smart Account relayer.
The relayer provides fee sponsoring by wrapping user transactions with fee bumps, enabling gasless onboarding and transactions for users with empty wallets.
Two submission modes are supported:
Host Function + Auth Entries: Submit transaction components separately for the relayer to construct and wrap the full transaction.
Signed Transaction XDR: Submit a complete, signed transaction envelope for the relayer to wrap and submit.
Example usage:
val relayer = OZRelayerClient(relayerUrl = "https://relayer.example.com")
// Mode 1: Submit host function and auth entries
val hostFunction = // ... HostFunctionXdr
val authEntries = // ... List<SorobanAuthorizationEntryXdr>
val response = relayer.send(hostFunction, authEntries)
// Mode 2: Submit signed transaction XDR
val txEnvelope = // ... TransactionEnvelopeXdr
val response = relayer.sendXdr(txEnvelope)
if (response.success) {
println("Transaction hash: ${response.hash ?: "unknown"}")
} else {
println("Error: ${response.error ?: "unknown"} (${response.errorCode ?: ""})")
}Parameters
The relayer endpoint URL (trailing slashes are stripped)
Default request timeout in milliseconds (default: 6 minutes for testnet retries)
Optional pre-configured HTTP client, typically used for testing. The caller retains ownership and is responsible for closing it.
Throws
if relayerUrl is blank or does not use HTTPS (http://localhost is permitted for development)
Functions
Submits a transaction using host function and authorization entries.
Submits a complete signed transaction envelope.