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

201
Visualizações
when using node-fetch i am not getting the data that's returned by an API when i use a variable but if i hardcode it then it works

if I go to the link used in the fetch then there is data but as you can see in the screenshot it logs an object with an empty sales array if I hardcode the link then the information is returned correctly

the res variable is an object returned by an event listener and isn't the problem

const { transactionHash } = res;
console.log(transactionHash);

const url = `https://api.reservoir.tools/sales/v3?txHash=${transactionHash}`;
console.log(url);

fetch(url, {
    method: 'GET',
    headers: { Accept: '*/*', 'x-api-key': '' },
})
    .then((response) => response.json())
    .then((response) => console.log(response))
    .catch((err) => console.error(err));

edit: when I use

const url = `https://api.reservoir.tools/sales/v3?txHash=${transactionHash}`;

then the fetch returns an empty sales array but if I hardcode the hash directly onto the link like this then it returns data inside the sales array (0x33a2907d being the hash for demonstration)

const url = `https://api.reservoir.tools/sales/v3?txHash=0x33a2907d`;
about 4 years ago · Santiago Trujillo
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