Hello, I have problem when FE connect to Smart contract and make a transaction.
I use a simple connection like this
service.js
import controller from '../abi/Controller.json'
import nodeOp from '../abi/NodeOperator'
export const controllerInstance = (web3) => {
return new web3.eth.Contract(
controller.abi, // abi of SC token
"0x027393deb73ff0d055f2c5769ee708faf1df0687" // address of token
)
}
export const operatorInstance = (web3) => {
return new web3.eth.Contract(
nodeOp.abi, // abi of SC token
"0x68a231F23D539E3ca6cbCEDcAd8778C325a0219c" // address of token
)
}
index.js
const connectWallet = async () => {
if (
typeof window !== "undefined" &&
typeof window.ethereum !== "undefined"
) {
try {
const account = await window.ethereum.request({
method: "eth_requestAccounts",
});
setWalletAddress(account[0]);
const web3Instance = new Web3(window.ethereum);
setWeb3(web3Instance);
} catch (error) {
console.error(error.message);
}
} else {
console.log("Please install MetaMask");
}
};
const operatorHandler = async () => {
const operatorContractInst = operatorInstance(web3Instance);
const depositFee = await operatorContractInst.methods.DEPOSIT_FEE().call();
const result = await operatorContractInst.methods.deposit().send({
from: walletAddress,
value: Number(depositFee),
});
console.log("depositFee", depositFee, Number(depositFee), result);
};
....
After clicking the button operator, the pop-up of metamask shows up and the tx seems normal, but when I click confirm, the tx shows successful but nothing update on the contract, the method in block explorer is empty
Please help me on this