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

217
Visualizações
Deep copying a struct fetched from a smart contract (web3js) in JavaScript

I'm trying to deep-copy in JavaScript a struct from my Solidity smart contract, which is fetched using web3js

This is how I do it:

 participant = await this.state.ContractInstance.methods.retrieveParticipant(0).call();
 let deepParticipant = JSON.parse(JSON.stringify(participants));

A) If I console.log() the participant variable, this is what I get enter image description here B) If I console.log() the deepParticipant variable (the deep clone) I get this enter image description here

They are not the same.

So the question is: How do I get a perfect deep copy of it? I also tried cloning using Lodash and the results are no better.

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