0

Looking here in the docs it mentions I need to have the provider attached to estimate gas. But for formatting a transaction offline, I dont have access to the provider. Is there a way to estimate the gas when you dont have access to the provider? I tried sending the transaction without gasPrice and it worked... however, should I provide this price in my formatted offline transaction? Here is how I am formatting my transaction without provider:

const iface = new ethers.utils.Interface(abi);
const func = iface.functions.setValues.encode([name, value]);
const nonce = await NonceManager.requestNonce(wallet);
const txs = {
  gasLimit: 1000001,
  data: func,
  to: address,
  nonce: nonce,
}
const iSign = await wallet.sign(txs);

The iSign is my transaction to send when needed. But is there a way to estimate gase without provider?

0

https://docs.ethers.io/ethers.js/html/api-contract.html

see details from the documentations of etherjs v4 https://docs.ethers.io/ethers.js/html/api-contract.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.