-
Notifications
You must be signed in to change notification settings - Fork 78
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
Display error when relay fee is greater than xdai amount #2219
base: master
Are you sure you want to change the base?
Conversation
Testing (all using the relay/omen account):
|
I would prefer the usage of our error message below the inputfield like this: Figma: |
@pimato I moved the relay fee error under inputs but I'm unable to access that design spec atm 🤔 |
I would add a new error message for xDai tight user who have not deposit Dai into the Omen account. Right now we are just saying Priority of error message for xDai tight:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hexyls Great job with service! Code looks good added some stuff wondering what you think.
return () => { | ||
status.active = false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering just out of learning purposes why are you returning this status.active=false. And what does it do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this prevents against race conditions when requesting data, e.g. imagine we start requesting data while the user is using the relay and the user switches accounts mid request - it is possible that the state could be updated with data we don't want once the relayService.getInfo()
request finishes.
The line you commented will make sure status.active is set to false if the hook is updated, so in our scenario above once relayService.getInfo()
is finished we check status.active
, if it is true that means the hook has not updated since the request was made and it is safe to update the state.
@@ -11,7 +11,7 @@ const Wrapper = styled.div<{ margin?: boolean }>` | |||
border: ${({ theme }) => theme.borders.borderLineDisabled}; | |||
align-content: center; | |||
padding: 4px 20px; | |||
margin-bottom: ${props => (!props.margin ? '20px' : '0')}; | |||
margin-bottom: ${props => (props.margin ? '20px' : '0')}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find figma designs but seems that because you flipped evaluation in some cases where it was previously set we have double margins...Like if value inputted in negative on market_buy component. Or this is how its supposed to be I couldn't find figma @pimato ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pimato Also seems that color on this error message when value is negative is different then the error message on form...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filled this back to !props.margin
and changed up the alert color 👍
formField: any | ||
symbol: any | ||
shouldDisplayMaxButton?: boolean | ||
onClickMaxButton?: () => void | ||
style?: CSSProperties | undefined | ||
} | ||
|
||
const FieldWrapper = styled.div` | ||
const FieldWrapper = styled.div<{ error?: boolean }>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make this into style(TYPE.BodyRegular) and remove couple of prperties like font-size,font-weight,line-height
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmmm will leave this one, styled(TYPE.bodyRegular) doesn't appear to apply font styling in the same way using the> input
selector does
: relayFeeGreaterThanBalance | ||
? 'Insufficient Dai in your Omen Account' | ||
: maybeCollateralBalance.isZero() && funding.gt(maybeCollateralBalance) | ||
? `Insufficient balance` | ||
: funding.gt(maybeCollateralBalance) | ||
? `Value must be less than or equal to ${collateralBalanceFormatted} ${collateral.symbol}` | ||
: relayFeeGreaterThanAmount | ||
? 'Relay fee is greater than buy amount' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hexyls Also one more consideration. I was looking through the codebase now and seems that in this pr and throught the codebase in components(marketBuy,marketSell,fundingAndFee and MarketPoolLiqudity) we have almost exactly the same amount error evaluations. Wondering does it make sense to make separate component or service dedicated to it? So we don't mess up in future if we have to add some new error handling. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you consider this makes sense to do we can even move it also into separate issue...
Screen.Recording.2021-08-26.at.15.57.42.mov@hexyls Also seems that message gets stuck and I can't even buy with proper amount inputted..After I triggered insufficient dai in your omen account |
@Mi-Lan for that last one where the error stays - do you know how to reproduce it? I managed to get it to show up once but haven't seen it since 🤔 |
closes #2189
Displays an error when relay fee is greater than xdai amount for both buys and deposit for xdai markets when connected to the relay.
Also added a warning for when a user is attempting to transaction through the relay with an xDai balance lower than the relay fee.
Testing (all using the relay/omen account):