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

256
Visualizações
Cannot get results from an object - Error saying does not exits

I have a function that returns an object. I want to be able to take out "results" from that object but I'm having difficulty. My error is

'results' does not exist on type 'SimulationResponse'. Property 'results' does not exist on type 'RelayResponseError'

The code is currently

    const response = await flashbotsProvider.simulate(
      simulateTransaction,
      blockNumber + 1
    );

    console.log(typeof response);
    console.log(response.results);

And if i only console.log(response) then the output is:

object
{
  bundleHash: '0x7765d8cf3063adb1bf9a2e524071a86ddcd3abf96acee689989f0a574073d9ac',
  coinbaseDiff: BigNumber { _hex: '0x02b959fc8d06f000', _isBigNumber: true },
  results: [
    {
      coinbaseDiff: '196287000000000000',
      ethSentToCoinbase: '0',
      fromAddress: '0xd612c9fBc4047E1cd50bf0996B8D277d0bF425F9',
      gasFees: '196287000000000000',
      gasPrice: '2100000000000',
      gasUsed: 93470,
      toAddress: '0x20EE855E43A7af19E407E39E5110c2C1Ee41F64D',
      txHash: '0x883597fc3df0e70bf78383c381394c6b39ca8f8cfe1885ad4b889f37339874dc',
      value: '0x'
    }
  ],
  totalGasUsed: 93470,
  firstRevert: undefined
}

any idea?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

if ("error" in response || response.firstRevert !== undefined) { console.log(Simulation Error: ${response}); process.exit(1); }

I checked it if there is error, and when there is error you can get results by response.results.

about 4 years ago · Juan Pablo Isaza Relatório
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