-
Notifications
You must be signed in to change notification settings - Fork 2
feat: metamask connector upgrade #1
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
base: main
Are you sure you want to change the base?
Conversation
packages/connectors/src/metaMask.ts
Outdated
| isReconnecting?: boolean | undefined | ||
| withCapabilities?: withCapabilities | boolean | undefined | ||
| }) { | ||
| // TODO: better handling when not providing a chainId? |
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 could we consider as "better handling" ?
I believe defaulting to mainnet seems like a good approach here
packages/connectors/src/metaMask.ts
Outdated
| try { | ||
| const result = await metamask.connect({ | ||
| chainId: chainId, | ||
| account: undefined, |
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.
do we need to explicitly set account to undefined.
If not, think it's cleaner to omit it altogether and just have
const result = await metamask.connect({ chainId: chainId });
packages/connectors/src/metaMask.ts
Outdated
| async switchChain({ addEthereumChainParameter, chainId }) { | ||
| const provider = await this.getProvider() | ||
|
|
||
| async switchChain({ addEthereumChainParameter, chainId }) { |
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.
Not suggesting anything in particular, but want to understand
do you remember why we are now deviating from doing
await provider.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: numberToHex(chainId) }],
})like before ?
EDIT: as I read further, perhaps the call to
await metamask.switchChain({ chainId, chainConfiguration })handles this.
…ade-update feat: update connector
Setup:
connect-monorepoandyarn && yarn buildfeat/metamask-connector-upgrade)pnpm ito install depspnpm run dev:reactto launch the playground