Skip to content

getEnsName fails with "reverseWithGateways" contract reversion in v2.35.1 #3926

@nakedfool

Description

@nakedfool

Check existing issues

Viem Version

2.35.1

Current Behavior

The getEnsName function is failing to resolve ENS names due to a contract reversion in the reverseWithGateways function call.

ContractFunctionExecutionError: The contract function "reverseWithGateways" reverted.

Contract Call:
  address:   0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62
  function:  reverseWithGateways(bytes reverseName, uint256 coinType, string[] gateways)
  args:                         (0xa13d49fCbf79EAF6A0a58cBDD3361422DB4eAfF1, 60, ["x-batch-gateway:true"])

Docs: https://viem.sh/docs/contract/readContract
Version: viem@2.35.1
    at getContractError (webpack-internal:///(app-pages-browser)/../../node_modules/viem/_esm/utils/errors/getContractError.js:39:12)
    at readContract (webpack-internal:///(app-pages-browser)/../../node_modules/viem/_esm/actions/public/readContract.js:67:98)
    at async getEnsName (webpack-internal:///(app-pages-browser)/../../node_modules/viem/_esm/actions/ens/getEnsName.js:67:24)
    at async fetchProfileData (webpack-internal:///(app-pages-browser)/./hooks/useProfileData/index.ts:50:25)

It is happening when we call getEnsName fn from wagmi/core package (this happened exactly after we upgraded viem to 2.35.1)

 const ensName = await getEnsName(config, { chainId: 1, address: ethereumAddress as `0x${string}` });

Expected Behavior

The function should successfully resolve the ENS name for the given Ethereum address or return null if no ENS name exists.

Steps To Reproduce

No response

Link to Minimal Reproducible Example

https://www.jokerace.io/

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions