Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Commit

Permalink
feat(contract-wrapper): first pass at using estimate gas
Browse files Browse the repository at this point in the history
  • Loading branch information
epiqueras authored and satello committed Mar 7, 2018
1 parent daff853 commit e455c55
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/contractWrappers/ContractWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
Expand Down

0 comments on commit e455c55

Please sign in to comment.