aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/pending-balance-calculator.js
blob: 4f6e031383df4883e5633c18ce45956155872ec1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const BN = require('ethereumjs-util').BN
const EthQuery = require('ethjs-query')

class PendingBalanceCalculator {

  constructor ({ getBalance, getPendingTransactions }) {
    this.getPendingTransactions = getPendingTransactions
    this.getBalance = getBalance
  }

  async getBalance() {
    const results = await Promise.all([
      this.getBalance(),
      this.getPendingTransactions(),
    ])

    const balance = results[0]
    const pending = results[1]

    return balance
  }

}

module.exports = PendingBalanceCalculator