-
Notifications
You must be signed in to change notification settings - Fork 363
Adapt TxParametersDetail to display a future safeNonce #2982
Conversation
CLA Assistant Lite All Contributors have signed the CLA. |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
|
Pull Request Test Coverage Report for Build 1462197080
💛 - Coveralls |
E2E Tests Passed |
37a9847
to
d8cedac
Compare
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.
Looking good. I have a few questions and found a few places you can improve
isCreation, | ||
isExecution, | ||
isOffChainSignature, | ||
safeNonce, |
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.
Assign a default value here and then you won't need to use a fallback on line 26.
{transactionsToGo} | ||
</Text> | ||
{` transaction${ | ||
transactionsToGo > 1 ? 's' : '' |
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.
Nice perfectionism 😉
@@ -4,7 +4,7 @@ import { getNetworkInfo } from 'src/config' | |||
import { TransactionFailText } from 'src/components/TransactionFailText' | |||
import { Text } from '@gnosis.pm/safe-react-components' | |||
|
|||
type TransactionFailTextProps = { | |||
export type TransactionFailTextProps = { |
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'm not sure how we approach exporting types. I would use my Parameters<typeof TransactionFees>[0]
trick instead.
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.
Yes, you are right. Works like a charm 👌
txEstimationExecutionStatus={txEstimationExecutionStatus} | ||
/> | ||
</div> | ||
<ReviewInfoText |
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.
Why did you remove the class here?
txEstimationExecutionStatus={txEstimationExecutionStatus} | ||
/> | ||
</Block> | ||
<ReviewInfoText |
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.
Why did you remove the and class here?
const threshold = useSelector(currentSafeThreshold) || 1 | ||
const defaultParameterStatus = isOffChainSignature && threshold > 1 ? 'ETH_HIDDEN' : 'ENABLED' | ||
|
||
const { safeNonce } = txParameters |
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.
Assign a default here and you will not have to use a fallback?
const threshold = useSelector(currentSafeThreshold) || 1 | ||
const defaultParameterStatus = isOffChainSignature && threshold > 1 ? 'ETH_HIDDEN' : 'ENABLED' | ||
|
||
const { safeNonce } = txParameters | ||
const isSafeNonceFuture = parseInt(safeNonce || '', 10) > nonce | ||
const [isAccordionExpanded, setIsAccordionExpanded] = useState(isSafeNonceFuture) |
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.
You should strictly type this.
if (!isTransactionExecution && !isTransactionCreation && isOffChainSignature) { | ||
return null | ||
} | ||
|
||
const onChangeExpand = () => { | ||
setIsAccordionExpanded(!isAccordionExpanded) |
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.
Here it should be fine, but you should normally use the previous state value by means of a callback.
const transactionsToGo = parseInt(safeNonce || '', 10) - nonce | ||
|
||
return ( | ||
<ReviewInfoTextWrapper data-testid={testId}> |
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.
You're missing the styling that seems to have been applied everywhere else here.
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 we are talking about the
padding: ${sm} ${lg}
That's why I've passed that styling to the to the ReviewInfoTextWrapper
styled component.
Thats why I also removed some of the wrapping elements/classes across the Modals as they were repeating this same css property but dispersed across the codebase.
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.
No, I mean in reference to all of my other comments regarding classes.
@@ -154,12 +153,13 @@ export const RemoveGuardModal = ({ onClose, guardAddress }: RemoveGuardModalProp | |||
isOffChainSignature={isOffChainSignature} | |||
/> | |||
</Block> | |||
<Row className={cn(classes.modalDescription, classes.gasCostsContainer)}> | |||
<TransactionFees | |||
<Row className={classes.modalDescription}> |
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.
Why did you remove the <Row>
and class here?
I check the and components before removing them. They basically wrap the children prop inside a div. I also verified that I was not getting rid of any particular styling before removing the |
Some were |
Yes, all the |
@francovenica I've fixed it! I also made sure that the Advanced Options section is extended when we enter the Review step with a suggested safe nonce in the future (before it was only opening after you edit). |
Looks good to me. |
What it solves
Resolves #2904
How this PR fixes it
When the user edits the transaction params and sets a
safeNonce
greater than the currentnonce
How to test it
On creating transaction "Review" step, edit the
safeNonce
to be greater than the current one.Then:
Screenshots