Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
Jon-edge merged 1 commit into develop from jon/fix/ramps-default-amount
Oct 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/components/scenes/RampCreateScene.tsx
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

@samholmes samholmes Oct 24, 2025

Choose a reason for hiding this comment

The 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?

Copy link
Collaborator Author

@Jon-edge Jon-edge Oct 24, 2025
edited
Loading

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

@samholmes samholmes Oct 24, 2025

Choose a reason for hiding this comment

The 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) })

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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
) {
Expand Down Expand Up @@ -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
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /