I have a transaction with a method.purchase(). But the tx has been reverted.
This is my tx in sepolia.etherscan tx/0x13575e79b12f3110d7df1d9597595c606a2c3c180d17bf98545db45fb61a6e0f.
And this is my code:
/* After estimate the gas I do this */
const weiValue = web3.utils.toWei(res.amount.toString(), "ether");
const bnNumber = web3.utils.toBN(weiValue);
web3.eth
.sendTransaction({
from: res["user-address"],
to: res["contract-address-trader"],
value: bnNumber,
gas: gasUsed,
data: traderContract.methods
.purchase(res["contract-address"], res["token-id"])
.encodeABI()
})
I don’t know why the tx is reverted. Any help here please? I haven’t got almost experience with MetaMask.