我正在寻找一个完整的基于javascript/typescript的代码,用于为智能契约函数调用签名事务(这会改变合同状态),以及使用醚类广播事务。
发布于 2021-07-19 09:10:31
找到下面的例子,
const release = async () => {
try {
//Set price to 1 Gwei
let gasPriceHex = ethers.utils.hexlify(8000000000);
//Set max gas limit to 4M
var gasLimitHex = ethers.utils.hexlify(4000000);
// Raw Transaction
var rawTx = {
gasLimit: gasLimitHex,
gasPrice: gasPriceHex,
};
// https://docs.ethers.io/v5/api/signer/#Signer-populateTransaction
let unsignedTx = await contactSendInstance.populateTransaction.release(contractAddress, rawTx)
let response = await wallet.sendTransaction(unsignedTx);
await response.wait();
console.log('response', response);
} catch (e) {
console.log('In Catch Block: Error : ', e.message);
}
};https://ethereum.stackexchange.com/questions/103704
复制相似问题