Thanks for read me.
Hi, im trying to send USDT (custom token) with the metamask api using web3. I’m developing on ReactJS and i could detected correctly the user account from metamask.
My code :
const web3 = new Web3(window.web3.currentProvider);
const contractInstance = new web3.eth.Contract(abiUSDT, addressUSDT);
const amount = 200;
const tx = {
from: 'PERSON_SENDER',
to: contractInstance._address,
data: contractInstance.methods.transfer('PERSON_RECIPIENT', web3.utils.toWei( amount.toString() ) ).encodeABI(),
}
web3.eth.sendTransaction(tx).then(res => {
console.log("res",res)
}).catch(err => {
console.log("err",err)
});
obviously, i replace the fields called : PERSON_SENDER and PERSON_RECIPIENT with:
- PERSON_SENDER : The user account
- PERSON_RECIPIENT : My personal account (i want to deposit in this account)
Using this config, the transaction doesnt send to my account when i check in etherscan (and the amount was sent to the address of the contract) , and a user communicate that if he uses real values for him real account, metamask dont touch his amount.
Thanks for read me and i’m pending for all comments. Thanks for ur time!