I'm building a simple wallet app and I want to keep the balance of my account up to date in the wallet. I have thought of a couple ways to do this, but neither seem that great.
OPTION 1: Query the account balance each time a transaction comes through on my transaction stream, and store this in my database. CON: If multiple transactions are processed when the app is started, there will be multiple queries fetching the same balance value. Also, I'm now storing the balance in my database, away from the Stellar network and I assume this is not ideal?
OPTION 2: Query the account balance directly (ie not prompted by the transaction stream nor stored in the database). CON: There isn't a balance listener (that I know of) that could keep the value up to date without refreshing the app.
Of these, which would you recommend, or do you have a third, better way?