-
Notifications
You must be signed in to change notification settings - Fork 31
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
RFQ API: add bulk quotes endpoint #2846
Merged
Merged
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5837092
Feat: add bulk quotes route
dwasse 0a46d31
Feat: impl UpsertQuotes
dwasse bf3a58b
Feat: add PutBulkQuotes to api client
dwasse 5cce9a1
Fix: bulk quotes auth
dwasse 7eb7089
Feat: add bulk quotes test
dwasse cc5624c
Feat: quoter submits bulk quotes
dwasse 02ec98b
Cleanup: lint
dwasse ebe46d8
Cleanup: comment
dwasse 5080a00
Regenerate
dwasse d95d62e
[goreleaser]
dwasse 5fc84a3
update endpoint (runs go generate
trajan0x 562366e
Fix: reset db on every test
dwasse f15ff30
[goreleaser]
dwasse c2c7b6f
Merge branch 'feat/bulk-quote' of github.com:synapsecns/sanguine into…
dwasse 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,65 @@ func (c *ClientSuite) TestPutAndGetQuote() { | |
c.Equal(expectedResp, *quotes[0]) | ||
} | ||
|
||
func (c *ClientSuite) TestPutAndGetBulkQuotes() { | ||
req := model.PutBulkQuotesRequest{ | ||
Quotes: []model.PutQuoteRequest{ | ||
{ | ||
OriginChainID: 1, | ||
OriginTokenAddr: "0xOriginTokenAddr", | ||
DestChainID: 42161, | ||
DestTokenAddr: "0xDestTokenAddr", | ||
DestAmount: "100", | ||
MaxOriginAmount: "200", | ||
FixedFee: "10", | ||
}, | ||
{ | ||
OriginChainID: 42161, | ||
OriginTokenAddr: "0xOriginTokenAddr", | ||
DestChainID: 1, | ||
DestTokenAddr: "0xDestTokenAddr", | ||
DestAmount: "100", | ||
MaxOriginAmount: "200", | ||
FixedFee: "10", | ||
}, | ||
}, | ||
} | ||
|
||
err := c.client.PutBulkQuotes(c.GetTestContext(), &req) | ||
c.Require().NoError(err) | ||
|
||
quotes, err := c.client.GetAllQuotes(c.GetTestContext()) | ||
c.Require().NoError(err) | ||
|
||
expectedResp := []model.GetQuoteResponse{ | ||
{ | ||
OriginChainID: 1, | ||
OriginTokenAddr: "0xOriginTokenAddr", | ||
DestChainID: 42161, | ||
DestTokenAddr: "0xDestTokenAddr", | ||
DestAmount: "100", | ||
MaxOriginAmount: "200", | ||
FixedFee: "10", | ||
RelayerAddr: c.testWallet.Address().String(), | ||
UpdatedAt: quotes[0].UpdatedAt, | ||
}, | ||
{ | ||
OriginChainID: 42161, | ||
OriginTokenAddr: "0xOriginTokenAddr", | ||
DestChainID: 1, | ||
DestTokenAddr: "0xDestTokenAddr", | ||
DestAmount: "100", | ||
MaxOriginAmount: "200", | ||
FixedFee: "10", | ||
RelayerAddr: c.testWallet.Address().String(), | ||
UpdatedAt: quotes[0].UpdatedAt, | ||
}, | ||
} | ||
c.Len(quotes, 2) | ||
c.Equal(expectedResp[0], *quotes[0]) | ||
c.Equal(expectedResp[1], *quotes[1]) | ||
} | ||
Comment on lines
+41
to
+98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Address implicit memory aliasing. The loop in for _, quoteReq := range putRequest.Quotes {
dbQuote, err := parseDBQuote("eReq, relayerAddr)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid quote request"})
return
}
dbQuotes = append(dbQuotes, dbQuote)
} for i := range putRequest.Quotes {
quoteReq := putRequest.Quotes[i]
dbQuote, err := parseDBQuote("eReq, relayerAddr)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid quote request"})
return
}
dbQuotes = append(dbQuotes, dbQuote)
} |
||
|
||
func (c *ClientSuite) TestGetSpecificQuote() { | ||
req := model.PutQuoteRequest{ | ||
OriginChainID: 1, | ||
|
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
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
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.
Ensure proper error handling for the response.
The function
PutBulkQuotes
is correctly implemented to handle multiple quotes. However, it would be beneficial to handle the response to check for errors or log relevant information.Committable suggestion