Setting gasPrice/gasLimit on contract #1565
Unanswered
fomotrader
asked this question in
Q&A
Replies: 1 comment 2 replies
-
You can try extending the class that you are passing in the signer/3rd argument to the Contract. Just override the sendTransaction method class WalletExtended extends Wallet {
sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse> {
if(transaction.gasPrice === undefined) transaction.gasPrice = ethers.utils.parseUnits('1', 'gwei'); // default gasPrice
if(transaction.gasLimit === undefined) transaction.gasLimit = 1000000; // default gasPrice
return super.sendTransaction(transaction).then((tx) => {
return this.provider.waitForTransaction(tx.hash).then((receipt) => {
return tx
})
})
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to set the default price of
gas
on a smart contract object?When approving transactions, sometimes the value is too low on a custom wallet I'm building. And I know I can not supply a new
gasPrice
when callingapprove
on thecontract
object. Any chance I can supply a defaultgasPrice
to the contract object itself?Beta Was this translation helpful? Give feedback.
All reactions