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

143
Views
web3js Batch Request response doesn't have any context

I am sending batch requests to a moralis avalanche node which (half the time) returns token prices, but it only returns prices to the callback, I can't see the token addresses or anything related to the request I sent. Is there anyway to have some context sent to the callback? Or maybe a better way to send batch requests?

here is the callback:

const callbackMethod = (error, result) => {
  if (error) {
    console.log("error");
  } else {
    result.map((res) => {
      console.log(res.toString())
    })
  }
}

and the requests:

const generateBatch = () => {
  var batch = new web3.BatchRequest();
  for (let i = 0; i < tokens.length; i++) {
    for (let j = 0; j < tokens.length; j++) {
      if (i != j) {
        batch.add(contract.methods
                .function(params)
                .call.request({from: web3.eth.accounts.wallet.accounts["0"].address}, callbackMethod));
      }
    }
  }
  return batch;
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

My implementation was to write a wrapper around the function I was using (I was already going to deploy a contract for this project) and make it return both the prices and the path.

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!