Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

131
Views
Update 2 Solidity contract variables with one transaction

How do I chain two contract updates together?

This following code works for individually updating each of them, but I have to approve the first update in Metamask, then wait for it to finish before the other update asks to be confirmed in Metamask :

      await vaultcontract.methods.update7Day([update7day]).send({from: account}).then(function(receipt){
        document.getElementById("7dayupdated").innerText = "updated";
      });
     
      await vaultcontract.methods.update30Day([update30day]).send({from: account}).then(function(receipt){
        document.getElementById("30dayupdated").innerText = "updated";
      });

How can I do both with one transaction?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Promise.all([
    vaultcontract.methods.update7Day([update7day]).send({from: account}),
    vaultcontract.methods.update30Day([update30day]).send({from: account})
]).then( _ => {
    // variable name is _ (underscore) because you don't use it
    document.getElementById("7dayupdated").innerText = "updated";
    document.getElementById("30dayupdated").innerText = "updated";
});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!