Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function getContractEventBreakdown(params: {
}): Promise<EventBreakdownEntry[]> {
const queryParams = [
`chain=${params.chainId}`,
"group_by=time",
"group_by=block_timestamp",
"group_by=topic_0 as event_signature",
"aggregate=toStartOfDay(toDate(block_timestamp)) as time",
"aggregate=count(*) as count",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function getContractEventAnalytics(params: {
}): Promise<AnalyticsEntry[]> {
const queryParams = [
`chain=${params.chainId}`,
"group_by=time",
"group_by=block_timestamp",
"aggregate=toStartOfDay(toDate(block_timestamp)) as time",
Comment on lines +35 to 36
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from group_by=time to group_by=block_timestamp introduces a potential field naming inconsistency. While the grouping parameter now uses block_timestamp, the aggregation still creates a time alias with toStartOfDay(toDate(block_timestamp)) as time.

This mismatch between the grouping field and aggregation alias might cause issues if the backend expects consistent naming between these clauses. Consider either:

  1. Updating the aggregation to use a matching alias:

    "aggregate=toStartOfDay(toDate(block_timestamp)) as block_timestamp"
    
  2. Or documenting why this apparent inconsistency is intentional and safe in this context

This would ensure the query parameters maintain logical consistency and reduce the risk of unexpected behavior.

Suggested change
"group_by=block_timestamp",
"aggregate=toStartOfDay(toDate(block_timestamp)) as time",
"group_by=block_timestamp",
"aggregate=toStartOfDay(toDate(block_timestamp)) as block_timestamp",

Spotted by Diamond

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

"aggregate=count(block_timestamp) as count",
params.startDate
Expand Down
Loading