Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

History tab should show all balance changes #347

Closed
justmoon opened this issue Mar 28, 2013 · 2 comments
Closed

History tab should show all balance changes #347

justmoon opened this issue Mar 28, 2013 · 2 comments

Comments

@justmoon
Copy link
Contributor

Currently, the history tab shows a list of transactions. Instead, it should show a list of balance changes.

To generate the list of balance changes, we take the list of transactions as the input and loop over all metadata in all transactions:

var changes = [];
_.each(transactions, function (tx) {
  if (!tx.mmeta) tx.mmeta = new ripple.Meta(tx);
  tx.mmeta.each(function (an) {
    // if (is a balance change) {
    //   var desc = // description of balance change
    //   changes.push(desc);
    // }
  });
});

The history tab should then be an ng-repeat over changes.

The benefit of this approach is that we know with 100% certainty that anything affecting your balance is being shown on the history tab. The next step is then to generate more intelligent and user-friendly descriptions.

@ghost ghost assigned justinhernandez Mar 28, 2013
@justinhernandez
Copy link
Contributor

@justmoon can you explain more or is there an example of how you want the balance changes to look? Also for the example you provided, I think we need to extend var Meta so it's available as a function in the ripple object. Thanks.

@justmoon
Copy link
Contributor Author

justmoon commented Apr 2, 2013

Here is how it would look roughly:


Account: XRP | Bitstamp/USD | Bitstamp/BTC | All
Date range: From Sep 1 2013 to Sep 30 2013
Show fees: [ ] Yes [ X ] No

Date Description Amount
Sep 29 Payment from Alice USD 50
Sep 28 Trade BTC ---> XRP BTC -10
Sep 28 Trade XRP <--- BTC XRP 700000
Sep 22 Payment to Bob BTC -23.5
Sep 10 Unknown incoming XRP 200

Couple of things to note:

  • Note that each row represents one metadata entry.
  • See how a trade shows up as two entries? That's because a trade will have two balance-affecting metadata entries per offer.
  • Generating the description is not trivial. There are several possibilities (payments, offers, rippling) for why your balance might change. Once we have contracts there will be infinite possibilities. That's why I added an example of an "Unknown incoming" transaction. This will be rare in practice, but the important part is that the list shows absolutely every change to your balance. That's why we include even changes that we couldn't recognize.

Here is a more advanced example:


Account: XRP | Bitstamp/USD | Bitstamp/BTC | Paula/USD | All
Date range: From Nov 1 2013 to Nov 30 2013
Show fees: [ X ] Yes [ ] No

Date Description Amount
Nov 25 Rippling Paula ---> Bitstamp Paula/USD -50
Nov 25 Rippling Bitstamp <--- Paula Bitstamp/USD 50
Nov 21 Fee XRP -2
Nov 21 Nickname auction purchase Bitstamp/USD -140

Notes:

  • So here the user has enabled fee display, meaning we are showing those metadata entries caused by us paying a fee. The rippling was something that happened to us, so we didn't pay the fee, someone else did.
  • The "nickname auction purchase" is an example of a contract transaction that we did recognize and were able to parse. Ideally we'd want parsing rules for most commonly used contracts.
  • There is more than one issuer for USD, meaning we have to show the issuer next to the amount somewhere.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants