Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend getAccountTransactions by token/asset Id filter #681

Open
ohager opened this issue Oct 17, 2022 · 1 comment
Open

Extend getAccountTransactions by token/asset Id filter #681

ohager opened this issue Oct 17, 2022 · 1 comment
Labels
enhancement New feature or request priority-medium

Comments

@ohager
Copy link
Member

ohager commented Oct 17, 2022

Motivation

While trying to support Tokens in the XT Wallet I came up with an "accuracy" problem of fetching transactions for a specific token. Atm, I'm doing 5 (five) HTTP requests to the node to get

  1. Token Trades
  2. Token Transfers
  3. Open Bid Orders
  4. Open Ask Orders
  5. further transactions like minting, issuance, distribution using getAccountTransactions with type/subtype filter

Problem

The problem is that I need to filter the result getAccountTransactions by the Token Id, trying to find the tx for the related token. This is limited as it may happen, that an active account can have hundreds of transactions per day and then some token related transactions from a very few days ago won't appear. I could do multiple calls using the pagination, but the main problem still persists.

Solution

If we would be able to return only transactions for a given account and given token we can be much more precise on the transaction history for a token. So, additionally to the type/subtype filter an additional asset filter could be a nice extension.

I'm aware that this might introduce a bigger effort, as one cannot simply filter the attachment_bytes using SQL. And doing the filter only server side brings up the similar "accuracy" problem as doing it on application level (although, it can be done much faster due to direct database access) - Ideally, another nullable column asset_id for token/asset related can be added to the transaction table and set on each transaction with type=2.

@ohager ohager added enhancement New feature or request fork-hard Fixing this will require a hard fork. SIP This feature request is protocol relevant and may require a SIP labels Oct 17, 2022
@frankTheTank72
Copy link
Member

frankTheTank72 commented Oct 17, 2022

From my point of view is this change working without a HF.

We should create a new table which only store asset_id and tx_id and block height.

In this case we could have several entries for the same tx (e.g. Multi-token transfer)

For sure we need a DB update script.

@ohager ohager removed the fork-hard Fixing this will require a hard fork. label Oct 17, 2022
@frankTheTank72 frankTheTank72 removed the SIP This feature request is protocol relevant and may require a SIP label Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority-medium
Projects
None yet
Development

No branches or pull requests

2 participants