ethers-meow
ethers-meow copied to clipboard
Add override for gasPrice (to ethers-wallet)
Currently defaults to 35 Gwei. Suggested value is 25 Gwei as per this article from cryptokitties team https://medium.com/@CryptoKitties/cryptokitties-birthing-fees-increases-in-order-to-accommodate-demand-acc314fcadf5
Please make options object (or at least gas price) overridable in Manager.prototype.giveBirth()
The gas price currently comes from the Ethereum network, but yes I should add the ability to override it for those wish to have finer grained control. Give me a day to think about the best way to support this in a more general way.
I think I will add a optional function to signers for getGasPrice(tx).
I would also like to add a feature where the gasPrice can be set to specific constants, in which case it will use the ethers gas oracle; for example "low" would use the current safe low value for the network. I still need to think more about this though, since it will greatly increase the traffic to my public API.
If you need something ASAP, for now, you can just create a custom signer, which will allow you to override this.
var ethers = require('ethers');
var meow = require('ethers-meow');
function CustomSigner(privateKey) {
this.provider = ethers.providers.getDefaultProvider();
var wallet = new ethers.Wallet(privateKey, this.provider);
this.address = wallet.address;
this.sendTransaction = function(tx) {
tx.gasPrice = 25000000000;
console.log(tx);
return wallet.sendTransaction(tx);
}
}
var customSigner = new CustomSigner('0x0123456789012345678901234567890123456789012345678901234567890123');
var manager = new meow.Manager(customSigner);
manager.giveBirth(1000);