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);
});