Skip to content

Commit

Permalink
Merge pull request #63 from re2005/feature/update-balance
Browse files Browse the repository at this point in the history
feat: autoupdate balance every 10 seconds
  • Loading branch information
johnson86tw authored Jul 7, 2022
2 parents 4df55db + af635a8 commit 7a99cb7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/composables/useEthers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ async function activate(externalProvider: ExternalProvider) {
address.value = _address
balance.value = _balance.toBigInt()

const updateBalance = async (interval: number = 10000) => {
setInterval(async () => {
const _balance = await _signer.getBalance()
balance.value = _balance.toBigInt()
}, interval)
}

updateBalance()

isActivated.value = true
}

Expand Down

0 comments on commit 7a99cb7

Please sign in to comment.