Skip to content

Commit

Permalink
Merge pull request #41 from micwallace/patch-1
Browse files Browse the repository at this point in the history
fix: Chain config not updated when switching chains
  • Loading branch information
yuche authored Sep 18, 2024
2 parents 531032a + aa9a9ce commit a802f89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/slow-foxes-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@joyid/ethereum-provider": patch
---

fix: Chain config not updated when switching chains
3 changes: 2 additions & 1 deletion packages/ethereum-provider/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ export class EthereumProvider extends EventEmitter {
throw new Error('eth_sign is not supported, use personal_sign instead')
}
case 'wallet_switchEthereumChain': {
const [chainId] = args.params as [chainId: string]
const chainId = args.params?.[0]?.chainId as string
this.switchChain(parseInt(chainId))
this.emit('chainChanged', chainId)
return undefined
}
Expand Down

0 comments on commit a802f89

Please sign in to comment.