-
Notifications
You must be signed in to change notification settings - Fork 78
Fix: RFQ Accept fixes #229
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR fixes the RFQ (Request for Quote) accept logic to properly handle different quote match types (COMPLEMENTARY, MERGE, and MINT). The key changes introduce match type awareness when creating orders from quotes, ensuring the correct side, token, and size are used based on the quote's match type.
Key Changes
- Introduced
RfqMatchTypeenum to categorize quote matching scenarios - Added
matchTypefield toRfqQuoteinterface - Refactored order creation logic to determine correct parameters based on match type
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/types.ts | Defines the RfqMatchType enum, adds matchType field to RfqQuote, and introduces RfqRequestOrderCreationPayload interface |
| src/rfq-client.ts | Refactors quote acceptance logic by extracting order payload calculation into getRequestOrderCreationPayload() method that handles different match types |
| package.json | Version bump from 5.1.0 to 5.1.1 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // the order side is opposite the quote side | ||
| side = quoteSide === "BUY" ? Side.SELL: Side.BUY; | ||
| token = quote.token; | ||
| size = side == Side.BUY ? quote.sizeOut : quote.sizeIn; |
Copilot
AI
Dec 13, 2025
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.
Use strict equality (===) instead of loose equality (==) for type safety and consistency with other comparisons in the codebase.
| // the order side is the same as the quote side | ||
| side = quoteSide === "BUY" ? Side.BUY: Side.SELL; | ||
| token = quote.complement; | ||
| size = side == Side.BUY ? quote.sizeIn : quote.sizeOut; |
Copilot
AI
Dec 13, 2025
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.
Use strict equality (===) instead of loose equality (==) for type safety and consistency with other comparisons in the codebase.
| size = side == Side.BUY ? quote.sizeIn : quote.sizeOut; | |
| size = side === Side.BUY ? quote.sizeIn : quote.sizeOut; |
| readonly price: number; | ||
| readonly state: string; | ||
| readonly expiry: Date; | ||
| readonly matchType: string; |
Copilot
AI
Dec 13, 2025
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.
The matchType field is typed as 'string' but should be typed as 'RfqMatchType' (the enum defined above) to provide type safety and prevent invalid values.
| readonly matchType: string; | |
| readonly matchType: RfqMatchType; |
Note
Accept flow now computes the correct token, side, and size from RFQ quote match type (COMPLEMENTARY/MERGE/MINT) with new helper and types.
src/rfq-client.ts):getRequestOrderCreationPayloadto derivetoken/side/sizefromRfqQuote.matchType(handlesCOMPLEMENTARY,MERGE,MINT).acceptRfqQuotenow uses this helper and passes the derivedside,size, andtokentocreateOrderand acceptance payload.src/types.ts):RfqMatchTypeenum andmatchTypetoRfqQuote.RfqRequestOrderCreationPayload.5.1.1.Written by Cursor Bugbot for commit df4cb50. This will update automatically on new commits. Configure here.