-
Notifications
You must be signed in to change notification settings - Fork 22
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
transaction history: add input addresses, metadata and slots filter #173
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f648cde
transaction history: add input addresses, metadata and slots filter
ecioppettini 368050d
remove outputs field from the response
ecioppettini 5e736bf
update .nvmrc
ecioppettini 945981b
make input addresses and metadata optional (as an arg)
ecioppettini 1e83422
reformat slotBoundsPagination.sql
ecioppettini 1eb8a0c
add more comments in the code
ecioppettini d683446
update slotBOundsPagination.queries.ts after reformatting
ecioppettini 28538c0
update .nvmrc to lts/hydrogen
ecioppettini b0702f8
optimize slot filter tx filter query
ecioppettini e1bca8e
add support to lower slot limit as -1 to get the full range
ecioppettini cde3ec4
update openapi.json
ecioppettini 6568a1f
update tx_count change to cml multiera after rebase
ecioppettini 9906695
fix genesis_block task: missing tx_count
ecioppettini 9ece156
add comment explaining the <= :low condition
ecioppettini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
36 changes: 36 additions & 0 deletions
36
indexer/migration/src/m20240229_000019_add_block_tx_count_column.rs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use sea_schema::migration::prelude::*; | ||
|
||
use entity::block::*; | ||
|
||
pub struct Migration; | ||
|
||
impl MigrationName for Migration { | ||
fn name(&self) -> &str { | ||
"m20240229_000019_add_block_tx_count_column" | ||
} | ||
} | ||
|
||
#[async_trait::async_trait] | ||
impl MigrationTrait for Migration { | ||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { | ||
manager | ||
.alter_table( | ||
Table::alter() | ||
.table(Entity) | ||
.add_column(ColumnDef::new(Column::TxCount).integer()) | ||
.to_owned(), | ||
) | ||
.await | ||
} | ||
|
||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { | ||
manager | ||
.alter_table( | ||
Table::alter() | ||
.table(Entity) | ||
.drop_column(Column::TxCount) | ||
.to_owned(), | ||
) | ||
.await | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v14.17.0 | ||
lts/hydrogen |
This file contains 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
This file contains 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
87 changes: 87 additions & 0 deletions
87
webserver/server/app/models/pagination/slotBoundsPagination.queries.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/** Types generated for queries found in "app/models/pagination/slotBoundsPagination.sql" */ | ||
import { PreparedQuery } from '@pgtyped/runtime'; | ||
|
||
/** 'SlotBoundsPagination' parameters type */ | ||
export interface ISlotBoundsPaginationParams { | ||
high: number; | ||
low: number; | ||
} | ||
|
||
/** 'SlotBoundsPagination' return type */ | ||
export interface ISlotBoundsPaginationResult { | ||
max_tx_id: string | null; | ||
min_tx_id: string | null; | ||
} | ||
|
||
/** 'SlotBoundsPagination' query type */ | ||
export interface ISlotBoundsPaginationQuery { | ||
params: ISlotBoundsPaginationParams; | ||
result: ISlotBoundsPaginationResult; | ||
} | ||
|
||
const slotBoundsPaginationIR: any = {"usedParamSet":{"low":true,"high":true},"params":[{"name":"low","required":true,"transform":{"type":"scalar"},"locs":[{"a":782,"b":786}]},{"name":"high","required":true,"transform":{"type":"scalar"},"locs":[{"a":1036,"b":1041}]}],"statement":"WITH\n low_block AS (\n SELECT\n \"Block\".id,\n \"Block\".slot\n FROM\n \"Block\"\n WHERE\n \n slot <= :low! AND tx_count > 0\n ORDER BY\n \"Block\".id DESC\n LIMIT\n 1\n ),\n high_block AS (\n SELECT\n \"Block\".id,\n \"Block\".slot\n FROM\n \"Block\"\n WHERE\n slot <= :high! AND tx_count > 0\n ORDER BY\n \"Block\".id DESC\n LIMIT 1\n ),\n min_hash AS (\n (SELECT\n COALESCE(MAX(\"Transaction\".id), -1) AS min_tx_id\n FROM\n \"Transaction\"\n JOIN low_block ON \"Transaction\".block_id = low_block.id\n GROUP BY\n low_block.slot\n LIMIT\n 1\n )\n UNION (SELECT min_tx_id FROM (values(-1)) s(min_tx_id))\n ORDER BY min_tx_id DESC\n LIMIT\n 1\n ),\n max_hash AS (\n SELECT\n COALESCE(MAX(\"Transaction\".id), -2) AS max_tx_id\n FROM\n \"Transaction\"\n JOIN high_block ON \"Transaction\".block_id = high_block.id\n GROUP BY\n high_block.slot\n )\nSELECT\n *\nFROM min_hash\nLEFT JOIN max_hash ON 1 = 1"}; | ||
|
||
/** | ||
* Query generated from SQL: | ||
* ``` | ||
* WITH | ||
* low_block AS ( | ||
* SELECT | ||
* "Block".id, | ||
* "Block".slot | ||
* FROM | ||
* "Block" | ||
* WHERE | ||
* | ||
* slot <= :low! AND tx_count > 0 | ||
* ORDER BY | ||
* "Block".id DESC | ||
* LIMIT | ||
* 1 | ||
* ), | ||
* high_block AS ( | ||
* SELECT | ||
* "Block".id, | ||
* "Block".slot | ||
* FROM | ||
* "Block" | ||
* WHERE | ||
* slot <= :high! AND tx_count > 0 | ||
* ORDER BY | ||
* "Block".id DESC | ||
* LIMIT 1 | ||
* ), | ||
* min_hash AS ( | ||
* (SELECT | ||
* COALESCE(MAX("Transaction".id), -1) AS min_tx_id | ||
* FROM | ||
* "Transaction" | ||
* JOIN low_block ON "Transaction".block_id = low_block.id | ||
* GROUP BY | ||
* low_block.slot | ||
* LIMIT | ||
* 1 | ||
* ) | ||
* UNION (SELECT min_tx_id FROM (values(-1)) s(min_tx_id)) | ||
* ORDER BY min_tx_id DESC | ||
* LIMIT | ||
* 1 | ||
* ), | ||
* max_hash AS ( | ||
* SELECT | ||
* COALESCE(MAX("Transaction".id), -2) AS max_tx_id | ||
* FROM | ||
* "Transaction" | ||
* JOIN high_block ON "Transaction".block_id = high_block.id | ||
* GROUP BY | ||
* high_block.slot | ||
* ) | ||
* SELECT | ||
* * | ||
* FROM min_hash | ||
* LEFT JOIN max_hash ON 1 = 1 | ||
* ``` | ||
*/ | ||
export const slotBoundsPagination = new PreparedQuery<ISlotBoundsPaginationParams,ISlotBoundsPaginationResult>(slotBoundsPaginationIR); | ||
|
||
|
Oops, something went wrong.
Oops, something went wrong.
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.
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.
We really should have comments in the code for things like this otherwise it makes it takes a while to understand what is going on
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.
I added some comments already, not sure if now it's clear enough.