0

I'm using JSON-RPC sendTransaction, I want to transfer the ERC20 token this way, the code above works fine, but surprisingly, instead of calling transfer(), a contract is deployed for me!!It's really weird, I wonder what I missed?

This is the result of code execution: https://testnet.bscscan.com/tx/0x96f4a4c00a81678f3d32855d05894f3ea9f667970ef0f7a042496b77e3e5e9fb

Any help would be greatly appreciated!

const data= ADToken.methods.transfer("0x0325E8d42da1FA8Ed7e43dFC3D2c99A31605f838",this.web3.utils.toWei("1000")).encodeABI();

        const gasPrice = await this.web3.eth.getGasPrice();

        const tx = {
            from: this.connector.session.accounts[0],
            to: ADToken.options.address,
            data: data,
            gasPrice: this.web3.utils.toHex(gasPrice),
            gas: this.web3.utils.toHex(90000),
        };

        console.log('tx', tx);

        this.connector.sendTransaction(tx)
            .then((result) => {
                console.log('result', result);

            })
            .catch((error) => {
                console.log('error' + error);
            });

1 Answer 1

0

https://github.com/MetaMask/metamask-mobile/issues/2744

I found the answer on Gitub, and it's a very serious metamask bug that hasn't been fixed yet!😅

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.