-
Notifications
You must be signed in to change notification settings - Fork 411
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
feat: Add Human readable descriptions #2371
Conversation
Branch preview✅ Deploy successful! https://human_readable_txs--walletweb.review-wallet-web.5afe.dev |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
5e29717
to
f231cd7
Compare
ESLint Summary View Full Report
Report generated by eslint-plus-action |
159e941
to
0154d0b
Compare
addToBatch: (safeTx?: SafeTransaction, origin?: string, humanDescription?: string) => Promise<string> | ||
signTx: (safeTx?: SafeTransaction, txId?: string, origin?: string, humanDescription?: string) => Promise<string> |
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.
Passing humanDescription
to these two methods seems oddly specific. I would suggest passing the whole txDetails
.
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've changed the signature to accept a transaction object instead.
|
||
dispatch( | ||
showNotification({ | ||
title: humanDescription, |
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.
What will it look like w/o a title?
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 went through each tx event that we show a notification for and made sure to add a humanDescription there, either from the CGW response or an appropriate fallback i.e. Transaction #<nonce>
or Module transaction
txDispatch(TxEvent.SIGNATURE_PROPOSE_FAILED, { | ||
txId, | ||
error: asError(error), | ||
}) |
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.
Unnecessary formatting
txDispatch(TxEvent.SIGNATURE_PROPOSE_FAILED, { | |
txId, | |
error: asError(error), | |
}) | |
txDispatch(TxEvent.SIGNATURE_PROPOSE_FAILED, { txId, error: asError(error) }) |
[TxEvent.SIGN_FAILED]: 'Failed to sign. Please try again.', | ||
[TxEvent.PROPOSED]: 'Successfully added to queue.', | ||
[TxEvent.PROPOSE_FAILED]: 'Failed to add to queue. Please try again.', | ||
[TxEvent.SIGNATURE_PROPOSED]: 'Successfully signed.', | ||
[TxEvent.SIGNATURE_PROPOSE_FAILED]: 'Failed to send signature. Please try again.', | ||
[TxEvent.EXECUTING]: 'Confirm the execution in your wallet.', | ||
[TxEvent.PROCESSING]: 'Validating...', | ||
[TxEvent.PROCESSING_MODULE]: 'Validating module interaction...', | ||
[TxEvent.ONCHAIN_SIGNATURE_REQUESTED]: 'Confirm on-chain signature in your wallet.', | ||
[TxEvent.ONCHAIN_SIGNATURE_SUCCESS]: 'On-chain signature request confirmed.', | ||
[TxEvent.PROCESSED]: 'Successfully validated. Indexing...', | ||
[TxEvent.REVERTED]: 'Reverted. Please check your gas settings.', | ||
[TxEvent.SUCCESS]: 'Successfully executed.', | ||
[TxEvent.FAILED]: 'Failed.', |
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 are these changes necessary? If there's no humanDescription
, we now lose some context.
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.
humanDescription
will be always there unless the feature is disabled for technical reasons.
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.
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.
Good point, I think we should add a fallback for the title. Maybe we can include the nonce, something like Transaction #113
@@ -50,6 +52,8 @@ const ExecuteForm = ({ | |||
const { setTxFlow } = useContext(TxModalContext) | |||
const { needsRiskConfirmation, isRiskConfirmed, setIsRiskIgnored } = useContext(TxSecurityContext) | |||
|
|||
const tx = useAppSelector((state) => selectQueuedTransactionById(state, txId)) |
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 the transaction dispatchers (e.g. executeTx
) were thunks, you could select this inside it as you already have the txId
. It's an opinionated change though so I won't request it be changed.
…ide of dispatch calls
@francovenica thanks for testing! I've fixed the "Send" issue. This was a regression, nice find! For Batch Executions I now added a static description so it should always say "Batch transaction" as the title. |
57104ff
to
af34a83
Compare
af34a83
to
7749282
Compare
@iamacook @katspaugh what do you think about removing all the custom fallbacks and only having one fallback to "Transaction" inside |
src/store/txHistorySlice.ts
Outdated
const HUMAN_DESCRIPTION_FALLBACK = | ||
'Transaction ' + | ||
(isMultisigExecutionInfo(result.transaction.executionInfo) | ||
? `#${result.transaction.executionInfo.nonce}` | ||
: '') |
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.
const HUMAN_DESCRIPTION_FALLBACK = | |
'Transaction ' + | |
(isMultisigExecutionInfo(result.transaction.executionInfo) | |
? `#${result.transaction.executionInfo.nonce}` | |
: '') | |
const HUMAN_DESCRIPTION_FALLBACK = | |
'Transaction' + | |
(isMultisigExecutionInfo(result.transaction.executionInfo) | |
? ` #${result.transaction.executionInfo.nonce}` | |
: '') |
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've reverted this change and use a generic fallback now.
Having a SSOT makes the most sense. |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
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.
There is a failing test.
4dc8a28
to
2c33674
Compare
Nice find! There was an issue with setting the fallback title. It should be fixed now and display |
What it solves
First part of the EPIC #2011
Resolves #2448
Depends on safe-global/safe-client-gateway#631
How this PR fixes it
ToDos
TransactionInfo
dispatch
functions if they need atxDescription
How to test it
Transaction
as the Notification titleScreenshots
Checklist