我正在尝试设置交易的价格
根据文档:
value (in wei):从发送者转移到接收者的 Wei 数量。
但是当我输入这个值时:(对于 0.04eth)-> 我在 metamask 中得到 73 eth :)
(我在rinkeby网络上)
这是我的代码:
window.contract = await new web3.eth.Contract(contractABI.abi, contractAddress);//loadContract();
const transactionParameters = {
to: contractAddress, // Required except during contract publications.
from: window.ethereum.selectedAddress, // must match user's active address.
'data': window.contract.methods.mint(window.ethereum.selectedAddress,number).encodeABI(),
value: String(40000000000000000)
};
try {
const txHash = await window.ethereum
.request({
method: 'eth_sendTransaction',
params: [transactionParameters],
});
return {
success: true,
status: " Check out your transaction on Etherscan: https://ropsten.etherscan.io/tx/" + txHash
}
} catch (error) {
console.log(error);
return {
success: false,
status: " Something went wrong: " + error.message
}
}