-
Notifications
You must be signed in to change notification settings - Fork 275
RampCreateScene not auto-populating a 500ドル buy amount
#5807
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -246,12 +246,12 @@ export const RampCreateScene: React.FC<Props> = (props: Props) => { | |
| if (fiatUsdRate == null) return | ||
| let abort = false | ||
| const applyInitial = async (): Promise<void> => { | ||
| if (abort) return | ||
| if (abort || direction !== 'buy') return | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we adding this constraint? Why not have this default amount for sell too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes no UX sense. The amount is completely dependent on your balance and what you choose to sell. The buy flow's 500ドル default is an effort to improve our revenue. Also, it was the task's ask and pretty sure aligns with our legacy behavior. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the fix is: const maxSpendExchangeAmount = await getMaxSpendExchangeAmount( selectedWallet, selectedCrypto.tokenId, denomination ) setExchangeAmount({ amount: Math.min(initialFiat, maxSpendExchangeAmount) }) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| // Don't override if the user has started typing or fiat input is disabled | ||
| if ( | ||
| hasAppliedInitialAmount.current || | ||
| amountTypeSupport.onlyCrypto || | ||
| 'empty' in exchangeAmount || | ||
| !('empty' in exchangeAmount) || | ||
| lastUsedInput != null || | ||
| shouldShowRegionSelect | ||
| ) { | ||
|
|
@@ -287,7 +287,8 @@ export const RampCreateScene: React.FC<Props> = (props: Props) => { | |
| selectedFiatCurrencyCode, | ||
| shouldShowRegionSelect, | ||
| fiatUsdRate, | ||
| exchangeAmount | ||
| exchangeAmount, | ||
| direction | ||
| ]) | ||
|
|
||
| // Create rampQuoteRequest based on current form state | ||
|
|
||