-
Notifications
You must be signed in to change notification settings - Fork 94
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
feat(zcoin): impl tx_history support for WASM target #2077
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks you for the PR! First review iteration!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question, LGTM otherwise :)
// 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()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: idb doesn't have a join construct like sql?
will such a join ever be expensive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately indexeddb doesn't offer such abstraction most things are down manually with indexeddb 😄 but with indexes they're fast
* dev: feat(zcoin): balance event streaming (KomodoPlatform#2076) feat(zcoin): tx_history support for WASM target (KomodoPlatform#2077)
fixes: #2072