Skip to content
Permalink
Browse files

feat(contract-wrapper): first pass at using estimate gas

  • Loading branch information...
epiqueras authored and satello committed Mar 7, 2018
1 parent daff853 commit e455c55914ee0178bf63df143c9b0a7f7e70539d
Showing with 22 additions and 0 deletions.
  1. +22 −0 src/contractWrappers/ContractWrapper.js
@@ -34,6 +34,28 @@ class ContractWrapper {
? await c.deployed()
: await c.at(address)

// Estimate gas before sending transactions
// for (const funcABI of contractInstance.abi) {
// if (funcABI.constant === false) {
// const func = contractInstance[funcABI.name]
// // eslint-disable-next-line no-loop-func
// contractInstance[funcABI.name] = async (...args) => {
// try {
// console.log(args)
// await func.estimateGas(...args)
// return func(...args)
// } catch (err) {
// console.log('ERRRRRRR')
// throw err
// }
// }
// } else if (funcABI.constant === true) {
// const func = contractInstance[funcABI.name]
// // eslint-disable-next-line no-loop-func
// contractInstance[funcABI.name] = (...args) => func.call(...args)
// }
// }

return contractInstance
} catch (err) {
const errMsg = `${err}`

0 comments on commit e455c55

Please sign in to comment.
You can’t perform that action at this time.