-
Notifications
You must be signed in to change notification settings - Fork 54
[presign] Enhance transactions and refactor #1429
Conversation
|
I tested it a bit with an rinkeby Safe: Transaction details Safe: Etherscan link provided by Safe: Cowswap: Etherscan link provided by Cowswap: |
To add, Approve transaction does not appear in the side bar: I'm not sure if this issue related exactly to this PR or not, but I faced the conneciton issue: I reloaded the safe, and it appears that connection was lost there. However, the Cowswap app showed still connected state, Showed safe balances, etc. But I was not able to run transactions from there: |
Sorry if this as addressed somewhere before in the other presign PRs. https://user-images.githubusercontent.com/34510341/134336291-d42f7286-a6ef-4f51-8e16-de2f62be373d.mov This also applies for other wallets( e.g. MM or imToken) connected through WC. But I usually had the app open on my mobile and could see the call for action directly there. |
I retried it and all remain in the open status. |
Buy and Sell orders work nicely |
Thanks @MareenG and @elena-zh for the tests! I will add some of the defects on the description, to keep track. Some answers to the issues you brought up:
I will review this, it shouldn't be the case. Elena also notice an issue with wrapping, maybe is related.
Will review! definitely an issue
It seems lost from the other side, on the Gnosis Safe. I think is independent of this PR, and not sure how to reproduce. Probably nice to verify this, and we could open an issue if we have an issue in our side.
@MareenG true, we are aware, thanks for bringing it up. Not part of the scope of this PR. @michelbio is doing it here #1338 and also part of the pending tasks in the summary issue. |
@elena-zh the issue with the approval should be fixed now The other issue with wrapping/unwrapping won't be fixed in this PR, but will be in a future PR :) Once we have this, we will just need to monitor the safe transaction until we have a hash of the real transaction. Only with this piece of information, we will be able to tell when the tx is mined |
* @param tx to check for recency | ||
*/ | ||
export function isTransactionRecent(tx: EnhancedTransactionDetails): boolean { | ||
return new Date().getTime() - tx.addedTime < 86_400_000 |
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.
is this a mod? if so make the magic number go away pls
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.
Because is a mod, i would avoid to change it. But is a good point, however, is not part of this PR, plus I think Leandro touched near this in the orders PR, so I think is not worth it
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.
First part, tested the behaviour, will review the code next.
Tested using a rinkeby safe with a single owner
Token enabling
Working, with caveats.
Transaction is displayed on activities panel but remains pending forever
.
When the button is clicked, there's no feedback in the UI.
Which is fine most of the time with Metamask where the feedback is in the browser but weird in this case.
Trading
Working, no issues
Wrapping
Not working.
Tried to unwrap, since I only have WETH in this account.
No feedback in the UI, just an error logged to the console:
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 issues with the code, only the one reported about unwrapping
import { useTokenContract } from 'hooks/useContract' | ||
import { useActiveWeb3React } from 'hooks/web3' | ||
import { useTokenAllowance } from 'hooks/useTokenAllowance' | ||
import { HashType } from '@src/custom/state/enhancedTransactions/reducer' |
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 is the mod in this file? Only this import?
Also, path
import { HashType } from '@src/custom/state/enhancedTransactions/reducer' | |
import { HashType } from 'state/enhancedTransactions/reducer' |
Hey @anxolin , I have retested your fix. Buy/Sell orders work fine (1sig and multisig). |
As for connection issue, I have faced it again today when I opened the PR to test: there was no connection in Safe, however, Cowswap showed me an active connection. |
030864b
to
5b32325
Compare
Most of the issues described are either solved in this PR or in other PRs. I tracked them so we can a review. Merging to consolidate all the waterfalls. Reviews are still welcomed, the idea is:
|
@anxolin can this branch be deleted? Not doing it yet because there might be stuff pointing to it, and if I remove then those will point to develop |
Summary
This PR is important part for improving Gnosis Safe UX, but also give us more freedom in order to better handle our transactions.
This PR Includes:
transaction
state (state, actions, redux, etc) to allow our custom logicsLimitations on previous approach:
Main motivation:
Changes / hints for reviewer
state/enhancedTransactions
state/transactions
but using our own model. Now we have freedom of define Tx however we want!FinalizeTxUpdater
which is the logic from Uniswap that watch tx and change the state when they are mined. Also I addedCancelReplaceTxUpdater
which is the logic of cancelation and replacement of transactions that Ramiro did. This way, we can keep adding updaters and separating them. Also, now we have possibility to modify the originalFinalizeTxUpdater
code.addTransaction
now changes slightly the parameters. You need to provide a hash, and a hash type. This is because we won't be assuming that the hash is a Ethereum transaction, its possible is for example a Gnosis Safe Hash. Other wallets might use different hashes.Issues detected
To Test
Everything should work as before. Note that in this branch, we use presign, even for normal EOA. Also, note that #1416 fix for showing the loading indicator is not included in this PR.