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

feat: Add new order clusters endpoint and enhance contract state filtering #84

Merged

Conversation

JohnPhamous
Copy link
Contributor

No description provided.

Copy link

semanticdiff-com bot commented Feb 28, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  src/lib/clusters/clusters.tsx  58% smaller
  src/lib/contracts/index.tsx  29% smaller
  src/schema.ts  1% smaller
  src/lib/clusters/types.ts  0% smaller

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR enhances contract management by adding state filtering capabilities and a new endpoint for retrieving clusters associated with orders.

  • Added --state option to contracts list command with validation for "active", "upcoming", or "expired" values in src/lib/contracts/index.tsx
  • Modified listContracts function to accept a state parameter and pass it to the API instead of filtering client-side
  • Added new endpoint /v0/orders/{id}/clusters in src/schema.ts for retrieving clusters associated with a specific order
  • Enhanced contract objects with a state field throughout the schema with values "Upcoming", "Expired", or "Active"
  • Added state query parameter to /v0/contracts endpoint for server-side filtering

2 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +71 to +74
const state = showAll
? "all"
: (stateFilter?.toLowerCase() as "expired" | "active" | "upcoming") ||
undefined;
Copy link

Choose a reason for hiding this comment

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

style: The state logic could be simplified. If showAll is true, it should override any state filter, but the current implementation still allows both parameters to be used together which might be confusing.

*/
start_at: string;
/**
* Format: date-time
* @description The time at which the grid should stop placing new orders automatically. Must be on the hour. For sell grids, will be set to the given time (if any) or the end of the backing contract, whichever is sooner. This is not to be confused for the end time of the last order in the grid, i.e. `grid_front + num_orders * order.duration`.
* @description The time at which the grid should stop placing new orders automatically. The grid never places an order whos (compute-available) end time is after this time. For sell grids, will be set to the given time (if any) or the end of the backing contract, whichever is sooner. This is not to be confused for the end time of the last order in the grid, i.e. `grid_front + num_orders * order.duration`.
Copy link

Choose a reason for hiding this comment

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

syntax: There's a typo in the description - "whos" should be "whose" when referring to the order's end time

@JohnPhamous JohnPhamous merged commit d556bd3 into main Feb 28, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant