-
Notifications
You must be signed in to change notification settings - Fork 89
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
refactor(wallet): fix wallet module relations with app #3108
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
… refactor/separate-wallet-module # Conflicts: # apps/cowswap-frontend/src/cosmos.decorator.tsx # apps/cowswap-frontend/src/modules/wallet/api/pure/AddToMetamask/index.tsx # apps/cowswap-frontend/src/pages/Account/styled.tsx
… refactor/separate-wallet-module
@@ -92,7 +92,7 @@ export const Wrapper = styled.div` | |||
${({ theme }) => theme.mediaWidth.upToMedium` | |||
width: auto; | |||
height: 100%; | |||
margin: 0 0 0 auto; |
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 equivalent? before we had the margin define always, now is upToMedium
?
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.
Great question!
Actually, the value of margin was overridden here:
07f4c8d
I've checked all places where the component is used and it's displayed well there
@@ -8,7 +8,7 @@ import { ApplicationModal } from 'legacy/state/application/reducer' | |||
import { updateConnectionError } from 'legacy/state/connection/reducer' | |||
import { useAppDispatch } from 'legacy/state/hooks' | |||
|
|||
import { getWeb3ReactConnection } from 'modules/wallet/web3-react/connection' |
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 im only starting the review, and i don't know where this is ending, my comment might get outdated soon, but one thought here is that long term we shouldn't export something Web3React related (if we can avoid it).
Ideally the module would abstract that
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.
100% agree. In this PR I only moved all imports from modules/wallet/*
to modules/wallet
to replace it by import from a in in the future
import { BlockNumberProvider } from 'lib/hooks/useBlockNumber' | ||
|
||
import { WalletUpdater } from './modules/wallet' | ||
import { WalletUpdater, injectedConnection } from './modules/wallet' |
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 cosmos don't use absolute imports?
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 circular dependency that broke cosmos build :( Probably after this changes it won't be relevant
|
||
export default function useIsAmbireWallet(): 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.
this hook uses only stuff from the wallet module, so I wonder if this is where it belongs.
Some additional idea, I think this is only used for detecting if the wallet is a smart contract wallwet. I think this should also be part of the wallet module. This way, we don't need to see any "ambire" use outside of the module
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 moved the hook into useIsSmartContractWallet
here:
#3109
{(ENSName || account) && ( | ||
<Copy toCopy={ENSName ? ENSName : account ? account : ''} /> | ||
)} | ||
{(ENSName || account) && <Copy toCopy={ENSName ? ENSName : account ? account : ''} />} |
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 expression sth that could be expressed simpler?
would it be equivalent to: ENSName || account || ''
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.
It might, will change it after this PR. I try to keep this PR as simple as possible, just imports replacements
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.
Great prep work!
the thing i felt more unsure was the change to relative. Once this is in a lib, it might be convenient to use absolute imports within the library.
But anyways, i don't want to get too ahead. Looking fw to read the big fat follow up of this PR. Nice work!
… refactor/separate-wallet-module
Updated dependencies detected. Learn more about Socket for GitHub ↗︎
|
Summary
This PR is a preparation before moving
modules/wallet
into a lib (PR). The goal is to fixmodules/wallet
imports and dependencies.modules/wallet/*
were replaced bymodules/wallet
(commit)Web3StatusWrapper
(commit)AddToMetamask
component styling and removed unused styles inpages/Account/styled.tsx
(commit)safe-logo.svg
to get rid of importing it from wallet module. From one side it's not a good idea, but it also is not a big problem :) (commit)#3109
To Test
Test in #3109