VL
код максимально простой тут и он рабочий
const gasEstimate = await instance.methods
.mint(receiver)
.estimateGas({ from: sender })
Size: a a a
VL
const gasEstimate = await instance.methods
.mint(receiver)
.estimateGas({ from: sender })
VL
A
estimateGas смысла нет — gas limit блока (в ропстене) 8_000_000, а тут транзакция требует >80_000_000, то есть она в 10 раз больше лимита блока и просто не сможет быть замайнена.VL
H
H
A
VL
VL
AZ
AZ
VL
I
AZ
AZ
A
from в estimate и отправитель реальной транзакции одинаковый?VL
async mintSigned(receiver, sender) {
const encoded = instance.methods.mint(receiver).encodeABI()
const gasPrice = await web3.eth.getGasPrice()
console.log(' > ', encoded, gasPrice)
console.log(' >>> ', receiver, sender)
// this works
// const gasEstimate = 156244
// this doesnt. error here
const gasEstimate = await instance.methods
.mint(receiver)
.estimateGas({ from: sender })
const tx = {
to: CONTRACT_ADDR,
from: sender,
data: encoded,
gasPrice,
gas: Math.round(gasEstimate * 1.1),
}
console.log('tx',tx)
return web3.eth.accounts
.signTransaction(tx, WALLET_KEY)
.then((signed) => {
return new Promise((resolve, reject) => {
return web3.eth
.sendSignedTransaction(signed.rawTransaction)
.on('transactionHash', function (hash) {
console.log('[CREATED]transactionHash', hash)
return resolve(hash)
})
})
})
}
AZ