Skip to content

Portfolio Transaction History improvements #1172

@jaspervdj-da

Description

@jaspervdj-da

In the example splice portfolio, TransactionHistoryService provides an API for retrieving past transactions.

Currently this class just stored transactions in an in-memory array, which works as a PoC but isn't great for two reasons:

  1. All history needs to be fetched again when the user refreshes the page
  2. Queries are less efficient than they could be without extra work

Additionally, the class currently uses offsets to order transactions. This works when using a single synchronizer, but breaks down in a multi-synchronizer world. Instead, we want to use updateId (for uniqueness) and recordTime (for sorting).

An IndexedDB-based store seems like a good match here. It is widely supported (in particular, browser extensions can also use it). It allows us to have semi-structured data with indices on updateId and recordTime (or alternatively offset if we don't want to solve the multi-synchronizer problem yet).

I recommend using idb to make the API more async-idiomatic.

We will still need to store both parsed and queued (typically we can't parse these yet, but we will once we retrieve older events) transactions. IDBKeyRange.bound/IDBKeyRange.lowerBound/IDBKeyRange.upperBound should make retrieving the right transactions trivial.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions