feat(zcoin): impl tx_history support for WASM target#2077
Merged
Conversation
shamardy
reviewed
Mar 25, 2024
Collaborator
shamardy
left a comment
There was a problem hiding this comment.
Thanks you for the PR! First review iteration!
mariocynicys
approved these changes
Mar 29, 2024
Collaborator
mariocynicys
left a comment
There was a problem hiding this comment.
Just a question, LGTM otherwise :)
Comment on lines
+61
to
+98
| // Fetch transactions | ||
| let txs = tx_table | ||
| .cursor_builder() | ||
| .only("ticker", z.ticker())? | ||
| .offset(offset as u32) | ||
| .limit(limit) | ||
| .reverse() | ||
| .open_cursor("ticker") | ||
| .await? | ||
| .collect() | ||
| .await?; | ||
|
|
||
| // Fetch received notes | ||
| let rn_table = db_transaction.table::<WalletDbReceivedNotesTable>().await?; | ||
| let received_notes = rn_table | ||
| .cursor_builder() | ||
| .only("ticker", z.ticker())? | ||
| .open_cursor("ticker") | ||
| .await? | ||
| .collect() | ||
| .await?; | ||
|
|
||
| // Fetch blocks | ||
| let blocks_table = db_transaction.table::<WalletDbBlocksTable>().await?; | ||
| let blocks = blocks_table | ||
| .cursor_builder() | ||
| .only("ticker", z.ticker())? | ||
| .open_cursor("ticker") | ||
| .await? | ||
| .collect() | ||
| .await?; | ||
|
|
||
| // Process transactions and construct tx_details | ||
| let mut tx_details = vec![]; | ||
| for (tx_id, tx) in txs { | ||
| if let Some((_, WalletDbBlocksTable { height, time, .. })) = blocks | ||
| .iter() | ||
| .find(|(_, block)| tx.block.map(|b| b == block.height).unwrap_or_default()) |
Collaborator
There was a problem hiding this comment.
q: idb doesn't have a join construct like sql?
will such a join ever be expensive?
Author
There was a problem hiding this comment.
unfortunately indexeddb doesn't offer such abstraction most things are done manually with indexeddb 😄 but with indexes they're fast
dimxy
pushed a commit
to dimxy/komodo-defi-framework
that referenced
this pull request
Mar 30, 2024
* dev: feat(zcoin): balance event streaming (GLEECBTC#2076) feat(zcoin): tx_history support for WASM target (GLEECBTC#2077)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes: #2072