-
Notifications
You must be signed in to change notification settings - Fork 30
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(relapi): get QuoteRequest by txhash #3032
Conversation
WalkthroughThe recent changes streamline the codebase by removing the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3032 +/- ##
===================================================
+ Coverage 23.38100% 23.40442% +0.02341%
===================================================
Files 644 644
Lines 50139 50170 +31
Branches 82 82
===================================================
+ Hits 11723 11742 +19
- Misses 37255 37263 +8
- Partials 1161 1165 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Deploying sanguine-fe with Cloudflare Pages
|
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.
PR Summary
This pull request adds functionality to retrieve QuoteRequests by transaction hash in the relayer API, complementing the existing ability to fetch by transaction ID.
- Added
GetQuoteRequestbyTxHash
method inservices/rfq/relayer/relapi/client.go
- Implemented
GetQuoteRequestByTxHash
function inservices/rfq/relayer/relapi/handler.go
- Created new API endpoint '/request/by_tx_hash' in
services/rfq/relayer/relapi/server.go
- Removed dependency on github.com/BurntSushi/toml in
contrib/screener-api/go.mod
andethergo/go.mod
7 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings
@@ -169,3 +168,20 @@ func (r *relayerClient) GetQuoteRequestByTXID(ctx context.Context, txid string) | |||
|
|||
return &res, nil | |||
} | |||
|
|||
func (r *relayerClient) GetQuoteRequestbyTxHash(ctx context.Context, txHash string) (*GetQuoteRequestResponse, error) { |
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.
syntax: Typo in function name: 'by' should be capitalized
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.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files ignored due to path filters (2)
contrib/screener-api/go.sum
is excluded by!**/*.sum
core/go.sum
is excluded by!**/*.sum
Files selected for processing (5)
- contrib/screener-api/go.mod (1 hunks)
- ethergo/go.mod (1 hunks)
- services/rfq/relayer/relapi/client.go (2 hunks)
- services/rfq/relayer/relapi/handler.go (1 hunks)
- services/rfq/relayer/relapi/server.go (2 hunks)
Files skipped from review due to trivial changes (2)
- contrib/screener-api/go.mod
- ethergo/go.mod
Additional comments not posted (4)
services/rfq/relayer/relapi/server.go (2)
105-105
: LGTM: New route constant definition.The
getRequestByTxHash
constant is correctly defined and follows the naming conventions of other route constants.
123-123
: LGTM: Integration of new GET route.The new route
/request/by_tx_hash
is correctly registered in theRun
method and linked to theGetQuoteRequestByTxHash
handler.services/rfq/relayer/relapi/client.go (1)
172-187
: LGTM: New method implementation.The
GetQuoteRequestbyTxHash
method is well-implemented, consistent with existing methods, and includes appropriate error handling and status code checks.services/rfq/relayer/relapi/handler.go (1)
183-206
: LGTM: New handler function implementation.The
GetQuoteRequestByTxHash
function is well-implemented, consistent with existing handlers, and includes appropriate error handling and response construction.
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.
PR Summary
(updates since last review)
This pull request adds functionality to retrieve QuoteRequests by transaction hash in the relayer API. Here's a summary of the recent changes:
- Implemented
GetQuoteRequestByTxHash
function inservices/rfq/relayer/relapi/handler.go
- The new function follows a similar pattern to
GetQuoteRequestByTxID
, using the database service to fetch the quote request - Added error handling for cases where the transaction hash is not provided or the quote request is not found
- The response includes the raw quote request data, origin and destination chain IDs, and token addresses
These changes enhance the API's functionality by providing an additional method to retrieve quote requests, improving flexibility for clients interacting with the relayer service.
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
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.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- services/rfq/relayer/relapi/client.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- services/rfq/relayer/relapi/client.go
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.
PR Summary
(updates since last review)
This pull request adds a new method GetQuoteRequestByTxHash
to retrieve quote requests by transaction hash, complementing the existing GetQuoteRequestByTXID
method. The implementation is consistent across the handler, client, and model files. Here's a summary of the key changes:
- Added
GetQuoteRequestByTxHash
method to theRelayerClient
interface inclient.go
- Implemented the new method in the
relayerClient
struct inclient.go
- Added a test case
TestGetQuoteByTxHash
inclient_test.go
- Implemented
GetQuoteRequestByTxHash
function in the handler file (previously reviewed)
These changes provide a complete implementation of the new functionality, allowing clients to retrieve quote requests using either transaction IDs or transaction hashes.
2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings
func (r *relayerClient) GetQuoteRequestByTxHash(ctx context.Context, txHash string) (*GetQuoteRequestResponse, error) { | ||
var res GetQuoteRequestResponse | ||
resp, err := r.client.R().SetContext(ctx). | ||
SetQueryParam("hash", txHash). |
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.
style: Consider using a constant for the 'hash' query parameter name
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.
PR Summary
(updates since last review)
No major changes found since last review.
No file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
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.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- services/rfq/relayer/relapi/client.go (3 hunks)
- services/rfq/relayer/relapi/client_test.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- services/rfq/relayer/relapi/client.go
Additional comments not posted (2)
services/rfq/relayer/relapi/client_test.go (2)
Line range hint
239-248
: Renaming improves clarity.The function
TestGetQuoteByTxID
has been renamed fromTestGetQuoteByTX
, which enhances clarity regarding the identifier being tested.
250-259
: New test function added successfully.The function
TestGetQuoteByTxHash
correctly tests the retrieval of a quote request by transaction hash, ensuring the new functionality is verified.
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.
PR Summary
(updates since last review)
This PR introduces a new feature to retrieve QuoteRequests by transaction hash in the RFQ (Request for Quote) relayer service. Here are the key changes:
- Added
GetQuoteRequestByTxHash
method in/services/rfq/relayer/relapi/handler.go
- Updated
/services/rfq/relayer/relapi/server.go
to include a new route for the new feature - Modified
/services/rfq/api/model/response.go
to support the new response structure - Improved concurrency handling in
/services/rfq/relayer/service/handlers.go
with balance locking - Enhanced chain listener initialization in
/services/rfq/relayer/service/relayer.go
22 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
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.
PR Summary
(updates since last review)
This PR extends the functionality of the RFQ relayer service by adding the ability to retrieve QuoteRequests by transaction hash, complementing the existing txID-based retrieval.
- Introduced
GetQuoteRequestByTxHash
method inservices/rfq/relayer/relapi/client.go
, enhancing theRelayerClient
interface - Added a new route in
services/rfq/relayer/relapi/server.go
to handle requests for quote retrieval by transaction hash - Deprecated
GetQuoteRequestByTxID
andGetQuoteRequestByTxIDWithStatus
methods in favor of new, more flexible alternatives - Included TODO comments in
server.go
for future replacement of status-specific endpoints, indicating ongoing API structure improvements
2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings
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.
Actionable comments posted: 1
Outside diff range, codebase verification and nitpick comments (1)
services/rfq/relayer/relapi/server.go (1)
99-99
: Add a period at the end of the comment.The comment should end with a period for consistency with other comments.
- // TODO: replace with non-status specific endpoints + // TODO: replace with non-status specific endpoints.Tools
GitHub Check: Lint (services/rfq)
[failure] 99-99:
Comment should end in a period (godot)
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- services/rfq/relayer/relapi/client.go (3 hunks)
- services/rfq/relayer/relapi/server.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- services/rfq/relayer/relapi/client.go
Additional context used
GitHub Check: Lint (services/rfq)
services/rfq/relayer/relapi/server.go
[failure] 99-99:
Comment should end in a period (godot)
Additional comments not posted (2)
services/rfq/relayer/relapi/server.go (2)
106-106
: LGTM! Addition ofgetRequestByTxHash
constant.The new constant for the
/request/by_tx_hash
endpoint is a necessary addition for the new feature.
126-126
: LGTM! Addition of route handler forgetRequestByTxHash
.The new route handler
h.GetQuoteRequestByTxHash
is correctly registered.
@@ -95,13 +95,15 @@ | |||
} | |||
|
|||
const ( | |||
getHealthRoute = "/health" | |||
getHealthRoute = "/health" | |||
// TODO: replace with non-status specific endpoints |
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.
Follow-up on TODO comments.
The TODO comments indicate a need to replace status-specific endpoints. Ensure these are addressed in future updates.
Would you like me to open a GitHub issue to track the replacement of status-specific endpoints?
Also applies to: 120-122
Tools
GitHub Check: Lint (services/rfq)
[failure] 99-99:
Comment should end in a period (godot)
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.
PR Summary
(updates since last review)
No major changes found since last review.
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
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.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- services/rfq/relayer/relapi/server.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- services/rfq/relayer/relapi/server.go
we already had it for getting it by txID, for completeness added txHash
Summary by CodeRabbit
New Features
Chores