fix: support fromAmount mode in custom subvariant contract call quotes#682
Open
ayenisholah wants to merge 1 commit intolifinance:mainfrom
Open
fix: support fromAmount mode in custom subvariant contract call quotes#682ayenisholah wants to merge 1 commit intolifinance:mainfrom
ayenisholah wants to merge 1 commit intolifinance:mainfrom
Conversation
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.
Which Linear task is linked to this PR?
Fixes #575
Why was it implemented this way?
@lifi/sdk'sContractCallsQuoteRequestis a union ofContractCallsQuoteRequestFromAmountand
ContractCallsQuoteRequestToAmount— both modes are supported at the API level.useRoutes.tsonly calledgetContractCallsQuotewhentoAmountwas set, silentlyskipping the request when only
fromAmountwas provided. This breaks deposit and checkoutflows where users input a source amount rather than a destination amount.
The fix updates the condition from
contractCalls && toAmounttocontractCalls && (toAmount || fromAmount)and spreads either{ toAmount }or{ fromAmount }depending on which is set.toAmounttakes priority, so existingintegrators are unaffected.
No alternative approach was considered — the SDK already supports both modes, this is
purely a missing branch in the widget.
Visual showcase (Screenshots or Videos)
No UI changes. Logic fix only.
Before: with only
fromAmountset, no request to/v1/quote/contractCallsfires.After: request fires with
fromAmountpassed to the SDK.Checklist before requesting a review