Is there an ether-pudding way to get the balance of a contract/account, or should I just use web3.eth.getBalance(account)?

  • I'm still having a hard time with this. Something recently changed with the latest truffle release. Aug 16, 2017 at 22:03

2 Answers 2


Unless something has changed in ether-pudding, it is primarily focused on wrapping/simplifying contract code while also adding javascript promises to deal with asynchronous calls. So I do not believe it has a simpler call to get the balance.

Short answer: use the web3 call you mention.


This doesn't exist in truffle-contract. Here's a quick way to wrap web3 calls to make them use promises.

const promisify = (inner) =>
  new Promise((resolve, reject) =>
    inner((err, res) => {
      if (err) { reject(err) }

const getBalance = (account, at) =>
  promisify(cb => web3.eth.getBalance(account, at, cb));

// use getBalance
const bigNumberBalance = await getBalance('0xabcdef');

You can use this promisify helper to wrap any function which accepts a callback param and handles errors the same way as web3. Here's another example of using it:

const getTransaction = (hash) =>
  promisify(cb => web3.eth.getTransaction(hash, cb));

// use getTransaction
const transaction = await getTransaction('0xcaff');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.