feat(external-match): v2 API migration with backwards-compatible v1 shims#266
Merged
feat(external-match): v2 API migration with backwards-compatible v1 shims#266
Conversation
Contributor
|
Nice work — the conversion layer is faithful to the Rust SDK and the structure is clean. Two things worth looking at: 1.
2. The Rust version returns an error on parse failure. The TS version uses function invertPriceString(priceStr: string): string {
const price = Number.parseFloat(priceStr);
if (Number.isNaN(price) || price === 0) {
return "0";
}
return (1.0 / price).toString();
} |
sehyunc
approved these changes
Feb 18, 2026
aee85d9 to
0be2750
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Migrates the external-match package from v0 to v2 API routes internally, following the same pattern as the Rust SDK. All existing public types and methods are preserved via conversion layers (v1 order → v2, v2 response → v1), while malleable match types adopt breaking v2 input/output terminology. Adds new
getMarkets(),getMarketDepth(), andgetMarketDepthsAllPairs()methods; deprecated v1 methods (getSupportedTokens,getTokenPrices,getOrderBookDepth,getOrderBookDepthAllPairs) are shimmed through v2 endpoints.Breaking changes
ExternalMatchClientconstructor: 4 args → 3 (no separaterelayerUrl)MalleableExternalMatchResponse: rewritten with v2 input/output terminology (setInputAmount,inputBounds,outputBounds, etc.)AssembleExternalMatchOptions: removedrequestGasSponsorshipandgasRefundAddressnewSepoliaClientandnewMainnetClientSignedGasSponsorshipInfo.signatureis now optional (v2 has no separate signature)Test plan
pnpm typecheckpassespnpm buildproduces valid dist/pnpm lintpassesv1_conversions.rs🤖 Generated with Claude Code