IEas.getParams

getParams() external view returns (EasParams memory params)

Returns the canonical Ethereum Attestation Service addresses for this chain: the schemaRegistry, eas, and indexer preinstall addresses. Call this at startup so your dApp resolves the addresses at runtime instead of hard-coding per-network values. The precompile inherits the shared IPrecompile error surface — argument-shape failures revert with typed errors, while a not-yet-initialized keeper still surfaces as a plain string revert "eas keeper is not initialized".

Parameters

This method has no parameters.

Returns

Type: tuple

An EasParams struct with three fields: schemaRegistry, eas, and indexer — the addresses of the canonical EAS deployment on this chain.

Errors

Code Name Description
InvalidNumberOfArgs InvalidNumberOfArgs Declared in the shared IPrecompile error set as InvalidNumberOfArgs(uint256 expected, uint256 got), but getParams does not revert with it: it takes no arguments, and bytes after the selector are ignored.
ABISetupFailed ABISetupFailed Reverts when the calldata cannot be decoded against the precompile's ABI, for example an unknown 4-byte selector from a stale ABI, which gives the reason no method with id: 0x…. Encoded as ABISetupFailed(string reason). An unknown selector does not revert with UnknownMethod, although the precompile declares it.
QueryFailed QueryFailed Reverts when the underlying x/eas params lookup fails. Encoded as QueryFailed(string queryMethod, string reason), normalized through the shared SDK error registry when applicable.
eas keeper is not initialized eas keeper is not initialized Surfaces only if the precompile's easKeeper reference was not wired at startup. This one failure has no typed error of its own: the reason is ABI-encoded as Solidity's Error(string), so decodeErrorResult returns it as errorName: "Error" with the reason in args[0].

Examples

Resolve EAS addresses at startup

Cache the three returned addresses for the process lifetime — they are stable per chain.

import { createPublicClient, http } from "viem";

const EAS_PRECOMPILE = "0x1000000000000000000000000000000000000009" as const;
const easPrecompileAbi = [{
  type: "function", name: "getParams", stateMutability: "view",
  inputs: [],
  outputs: [{
    type: "tuple", components: [
      { name: "schemaRegistry", type: "address" },
      { name: "eas",            type: "address" },
      { name: "indexer",        type: "address" },
    ],
  }],
}] as const;

const publicClient = createPublicClient({ transport: http("https://rpc-testnet.maroo.io") });
const { schemaRegistry, eas, indexer } = await publicClient.readContract({
  address: EAS_PRECOMPILE,
  abi: easPrecompileAbi,
  functionName: "getParams",
});

Decoding shared IPrecompile errors and plain-string reverts

Typed IPrecompile errors decode with decodeErrorResult, and so does a plain reason such as the keeper-not-initialized case: it arrives as Solidity's Error(string), which decodes as errorName: "Error". A revert the ABI does not describe is rethrown.

import { BaseError, ContractFunctionRevertedError, decodeErrorResult } from "viem";

const iPrecompileErrorsAbi = [
  { type: "error", name: "InvalidNumberOfArgs",
    inputs: [{ name: "expected", type: "uint256" }, { name: "got", type: "uint256" }] },
  { type: "error", name: "ABISetupFailed", inputs: [{ name: "reason", type: "string" }] },
  { type: "error", name: "QueryFailed",
    inputs: [{ name: "queryMethod", type: "string" }, { name: "reason", type: "string" }] },
] as const;

try {
  await publicClient.readContract({
    address: EAS_PRECOMPILE,
    abi: easPrecompileAbi,
    functionName: "getParams",
  });
} catch (err) {
  // viem keeps the revert data on the ContractFunctionRevertedError in the cause chain, not on err.
  const revert = err instanceof BaseError ? err.walk((e) => e instanceof ContractFunctionRevertedError) : null;
  if (!(revert instanceof ContractFunctionRevertedError) || !revert.raw) throw err;
  try {
    // decodeErrorResult also knows Solidity's Error(string), so a plain reason
    // (e.g. "eas keeper is not initialized") decodes as errorName "Error".
    const decoded = decodeErrorResult({ abi: iPrecompileErrorsAbi, data: revert.raw });
    console.error("getParams reverted:", decoded.errorName, decoded.args);
  } catch {
    throw err; // a revert this ABI does not describe
  }
}
ESC
Type to search