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

151
Views
Hello,I want the js function return the result but it show errorPromise {<fulfilled>: undefined}
    if (window.ethereum) {
        const ethereum = window.ethereum;
        const web3 = new Web3(ethereum);
        const ethereum_account = ethereum.request({ method: 'eth_requestAccounts' });
        const ct = new web3.eth.Contract(abi, contract);

        try {
            await ethereum_account.then(accounts => {
                ct.methods.transfer(toaddress, web3.utils.toWei(value, "ether")).send({ 'from': ethereum.selectedAddress }).on('receipt', (receipt) => {
                    const result = {}
                    console.log(result) // I can see the result at console
                    return result //but I cannot get the return
                })
            });

        } catch (error) {
            console.log(error);
        }

Im new for code js, I want the function return the result , but it shows undefine!

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