Skip to content

Conversation

@vyorkin
Copy link
Contributor

@vyorkin vyorkin commented Apr 21, 2025

No description provided.

@github-actions
Copy link

github-actions bot commented Apr 21, 2025

📦 build.zip [updated at Apr 22, 1:27:59 PM UTC]

const showPriceImpactWarning =
priceImpact?.kind === 'loss' &&
(priceImpact.level === 'medium' || priceImpact.level === 'high');
const priceImpactWarningVisible = priceImpact
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it Boolean(priceImpact && isSignificantValueLoss(priceImpact))?

Copy link
Contributor Author

@vyorkin vyorkin Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, yes :) ✅

}),
quote: selectedQuote,
warningWasShown: priceImpactWarningVisible,
outputAmountColor: priceImpactWarningVisible ? 'red' : 'grey',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a case where we show red text but doesn't show warning.
Looks like this should be taken into account here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm I think you're right

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, there is an unfortunate detail. Because we should reflect UI state in the analytics, it looks like we need calculate warning text here, on this level, and pass it as a param to the component. Otherwise, we will get inconsistency one day :(

Copy link
Contributor Author

@vyorkin vyorkin Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there will be some "unavoidable" duplication (of course every duplication is avoidable at some cost :)) in SwapForm and BridgeForm "anyway", so I'm not sure if it is worth DRY'ing outputAmountColor. I mean the best thing I could do is to extract a function to calculate that outputAmountColor which is going to be called in SwapFrom and BridgeForm... but I'm not even sure if this extraction makes sense

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I fixed the condition behind outputAmountColor

chain: spendChain,
}),
quote: selectedQuote,
warningWasShown: isHighPriceImpact,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't show warning in bridge at all right now. So this field should be false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated ✅

const isSignificantLoss =
priceImpact?.kind === 'loss' &&
(priceImpact.level === 'medium' || priceImpact.level === 'high');
const isSignificantLoss = priceImpact
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated ✅

asset_name_received: toMaybeArr(incoming?.map(getAssetName)),
asset_address_sent: toMaybeArr(outgoing?.map(getAssetAddress)),
asset_address_received: toMaybeArr(incoming?.map(getAssetAddress)),
warning_was_shown: warningWasShown,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you send these fields for Approve transactions?
If I remember right, we still need send them, but with the default values

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default values you mean

    warning_was_shown: undefined,
    output_amount_color: undefined,

or

    warning_was_shown: false,
    output_amount_color: 'grey',

?

Copy link
Contributor Author

@vyorkin vyorkin Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to

 warning_was_shown: false,
output_amount_color: 'grey',

in case of approval tx ✅

@zerts zerts closed this Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants