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

164
Views
web3 javascript unable to transfer

I am tring to transfer my TOKEN from metamask to another address, but I am stuck at the following error and am unable to find a solution.

Error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'transfer')

I have tried changing the ABI but it doesn't work...

Here is the code:

<!DOCTYPE html>
<html>
    <head>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
        <script src="https://unpkg.com/@metamask/legacy-web3@latest/dist/metamask.web3.min.js"></script>
        <script src="contractAbi.js"></script>
    </head>
    <body>
        <div>
            <button class="pay-button">Pay</button>
            <div id="status"></div>
        </div>
        <script type="text/javascript">
            window.addEventListener('load', async () => {
                if (typeof window.ethereum !== 'undefined') {
                    ethereum.request({ method: 'eth_requestAccounts' });
                }
                else {
                    alert('Please install metamask');
                }
                const web3 = new Web3('https://bsc-dataseed.binance.org/');
                const contractAddress = '0xbdc6b4f65eae62574551951dddab27bfcd976c5c';
                const reciever = '';
                const amount = 10;
                const sendEthButton = document.querySelector('.pay-button');
                sendEthButton.addEventListener('click', () => {
                    (async () => {
                        const contract = new web3.eth.contract(ABI, contractAddress);
                        if (window.ethereum.chainId == '0x38') {
                            await contract.methods.transfer(reciever, amount).send('from',ethereum.selectedAddress).on('receipt', (receipt) => {
                                console.log(receipt);
                            })
                        }
                        else {
                            ethereum.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0x38' }] });
                        }
                    })();
                });
            })
        </script>
    </body>
</html>
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!