Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

327
Visualizações
Error: Unable to decode revert reason using getReverReason()

I am trying to understand why an ethereum transaction reverted by using getReverReason() from eth-revert-reason. I first tried using their example which is:

console.log(await getRevertReason('0x6ea1798a2d0d21db18d6e45ca00f230160b05f172f6022aa138a0b605831d740'))

but I get the error "await is only valid in async function". When I tried to run it inside the async function as below:

const Web3 = require("web3");
const ethers = require('ethers');
const getRevertReason = require('eth-revert-reason');
const txHash = '0x6ea1798a2d0d21db18d6e45ca00f230160b05f172f6022aa138a0b605831d740'

// Failed with revert reason "Failed test"
async function reason() {
    await getRevertReason(txHash)
}

console.log(reason())

I always get the same result, regardless of the Transaction Hash:

Error: Unable to decode revert reason.

Could you please help me?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda