Skip to content

Conversation

@JonathanAmenechi
Copy link
Contributor

@JonathanAmenechi JonathanAmenechi commented Dec 12, 2025

Note

Accept flow now computes the correct token, side, and size from RFQ quote match type (COMPLEMENTARY/MERGE/MINT) with new helper and types.

  • RFQ Client (src/rfq-client.ts):
    • Add getRequestOrderCreationPayload to derive token/side/size from RfqQuote.matchType (handles COMPLEMENTARY, MERGE, MINT).
    • acceptRfqQuote now uses this helper and passes the derived side, size, and token to createOrder and acceptance payload.
  • Types (src/types.ts):
    • Add RfqMatchType enum and matchType to RfqQuote.
    • Introduce RfqRequestOrderCreationPayload.
  • Package:
    • Bump version to 5.1.1.

Written by Cursor Bugbot for commit df4cb50. This will update automatically on new commits. Configure here.

@JonathanAmenechi JonathanAmenechi marked this pull request as ready for review December 13, 2025 10:32
@JonathanAmenechi JonathanAmenechi requested a review from a team as a code owner December 13, 2025 10:32
Copilot AI review requested due to automatic review settings December 13, 2025 10:32
Copy link
Contributor

Copilot AI left a 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 RfqMatchType enum to categorize quote matching scenarios
  • Added matchType field to RfqQuote interface
  • 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;
Copy link

Copilot AI Dec 13, 2025

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.

Copilot uses AI. Check for mistakes.
// 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;
Copy link

Copilot AI Dec 13, 2025

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.

Suggested change
size = side == Side.BUY ? quote.sizeIn : quote.sizeOut;
size = side === Side.BUY ? quote.sizeIn : quote.sizeOut;

Copilot uses AI. Check for mistakes.
readonly price: number;
readonly state: string;
readonly expiry: Date;
readonly matchType: string;
Copy link

Copilot AI Dec 13, 2025

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.

Suggested change
readonly matchType: string;
readonly matchType: RfqMatchType;

Copilot uses AI. Check for mistakes.
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.

2 participants