-
Notifications
You must be signed in to change notification settings - Fork 587
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: wallets #1869
base: main
Are you sure you want to change the base?
refactor: wallets #1869
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
id, | ||
name, | ||
provider, |
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.
Those return types are required in wagmi. Reference to the docs 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.
id: 'rainbow', | ||
name: 'Rainbow', | ||
flag: 'isRainbow', | ||
}), |
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 are id
and name
used for here? Is there a way for us to prevent needing to implement id
and name
twice within the wallet connector?
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 we call createConnector
, shouldn't we be able to pass in id
at connect time?
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.
Mhmm good point. We could, but then we would have to do something similar to what we do with mockWallet
here which would add more logic on top. When doing createConnector
we're creating a brand new connector, but don't append the id's to our created connectors like injected()
, walletConnect()
, safe()
and etc (since they are in a created mode).
We could maybe generate random uuid
's, but not sure if that would cause problems.
@@ -44,6 +44,8 @@ export const ramperWallet = (): Wallet => { | |||
}, | |||
}, | |||
createConnector: getInjectedConnector({ | |||
id: 'ramper', | |||
name: 'Ramper Wallet', | |||
namespace: 'ramper2.provider', |
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.
Likewise, should we be moving namespace
to the top-level wallet connector, instead of implementing it here? getInjectedConnector
was previously a bit more of a simple util, and the added complexity might require a more in-depth refactor
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.
@magiziz Is there anything we can do to revert this change? Seems to make the wallet connectors more verbose
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 think we'd want namespace
, id
, name
to all live in the connector metadata, instead of redefining 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.
I think we need to refactor much of the code in the walletListItems
for loop, as the spread operators and var naming is getting tough to understand. Need comments here too. Rewinding back to v1, it was a bit easier to read and had comments: https://github.com/rainbow-me/rainbowkit/blob/42b0661e622ba99ec98cdb0219431f90ca45d40d/packages/rainbowkit/src/wallets/connectorsForWallets.ts
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.
Refactored 🙏
…d introduce new util functions
Changes
What to test