Add rate field to GetQuoteResponse#157
Merged
Merged
Conversation
Exposes the dest/source conversion rate on the quote response so clients can surface it alongside the receive amount, matching the existing Layerswap quote payload shape. Rate comes from the route's IRateProvider and is truncated to 6 decimals (matching Layerswap's Constants.UsdPrecision). Single-leg paths reduce the Layerswap multiplicative path aggregate to the provider's rate directly. Intentionally not part of the signing payload — it's informational and derivable from the already-signed amount/receive-amount pair. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
ratefield toGetQuoteResponse(proto + C# DTO) carrying the dest/source conversion ratio as an invariant-culture decimal string, truncated to 6 decimals.QuoteService.GetQuoteAsyncfrom the route'sIRateProviderand mapped throughSolverProtoMapper.ToGetQuoteResponse. Single-leg paths make Layerswap's multiplicative path aggregate reduce to the provider's rate directly.Files
protos/solver.proto—string rate = 14;onGetQuoteResponsecsharp/src/Shared.Models/Models/QuoteDto.cs—public decimal Rate { get; set; }csharp/src/Infrastructure/Quote/QuoteService.cs—Rate = swapRate.Truncate(6)on theQuoteWithSolverDtoinitializercsharp/src/Shared.Proto/SolverProtoMapper.cs— mapsquote.Rate.ToString(InvariantCulture)into the gRPC responseTest plan
dotnet build csharp/src/Shared.Proto/Proto.csprojsucceeds (regenerates gRPC stubs with new field)dotnet build csharp/src/Infrastructure/Infrastructure.csprojsucceedsdotnet test csharp/tests/Util.Tests/Util.Tests.csproj— existingQuoteServiceTestsstay greenGetQuoteresponse includes a non-emptyratefield and is consistent withreceive_amount / amountafter fee subtraction🤖 Generated with Claude Code