diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-08-25 18:00:02 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-08-29 16:01:13 +0800 |
commit | a6a16017997fbe53ac709f2f0d874e348da35621 (patch) | |
tree | 9c0bf98ddef5e9f073c7e5c795fc79eb2b9d3e35 /src/0x.ts | |
parent | a8fd3f30cf87660f08fa7b1c249606b7f8872ba1 (diff) | |
download | dexon-sol-tools-a6a16017997fbe53ac709f2f0d874e348da35621.tar dexon-sol-tools-a6a16017997fbe53ac709f2f0d874e348da35621.tar.gz dexon-sol-tools-a6a16017997fbe53ac709f2f0d874e348da35621.tar.bz2 dexon-sol-tools-a6a16017997fbe53ac709f2f0d874e348da35621.tar.lz dexon-sol-tools-a6a16017997fbe53ac709f2f0d874e348da35621.tar.xz dexon-sol-tools-a6a16017997fbe53ac709f2f0d874e348da35621.tar.zst dexon-sol-tools-a6a16017997fbe53ac709f2f0d874e348da35621.zip |
Allow user to specify the gas price
Diffstat (limited to 'src/0x.ts')
-rw-r--r-- | src/0x.ts | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -159,15 +159,19 @@ export class ZeroEx { * Instantiates a new ZeroEx instance that provides the public interface to the 0x.js library. * @param provider The Web3.js Provider instance you would like the 0x.js library to use for interacting with * the Ethereum network. + * @param gasPrice The gas price to use for sending transactions. Defaults to 21 GWei. * @return An instance of the 0x.js ZeroEx class. */ - constructor(provider: Web3Provider) { + constructor(provider: Web3Provider, gasPrice?: BigNumber.BigNumber) { this._web3Wrapper = new Web3Wrapper(provider); - this.token = new TokenWrapper(this._web3Wrapper); - this.proxy = new TokenTransferProxyWrapper(this._web3Wrapper); - this.exchange = new ExchangeWrapper(this._web3Wrapper, this.token); - this.tokenRegistry = new TokenRegistryWrapper(this._web3Wrapper); - this.etherToken = new EtherTokenWrapper(this._web3Wrapper, this.token); + if (_.isUndefined(gasPrice)) { + gasPrice = this._web3Wrapper.toWei(new BigNumber(21), 'gwei'); + } + this.token = new TokenWrapper(this._web3Wrapper, gasPrice); + this.proxy = new TokenTransferProxyWrapper(this._web3Wrapper, gasPrice); + this.exchange = new ExchangeWrapper(this._web3Wrapper, this.token, gasPrice); + this.tokenRegistry = new TokenRegistryWrapper(this._web3Wrapper, gasPrice); + this.etherToken = new EtherTokenWrapper(this._web3Wrapper, this.token, gasPrice); } /** * Sets a new web3 provider for 0x.js. Updating the provider will stop all |