Skip to content

Commit

Permalink
Fix upstream handling of number chain Ids by adding a check to the ch…
Browse files Browse the repository at this point in the history
…ainChanged listener (#2216)

* Fix upstream handling of number chain Ids by adding a check to the chainChanged listener

* Add to ens checking block
  • Loading branch information
Adamj1232 committed May 31, 2024
1 parent d68c0ed commit 820fb38
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/core",
"version": "2.22.0-alpha.7",
"version": "2.22.0-alpha.8",
"description": "Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
"keywords": [
"Ethereum",
Expand Down
15 changes: 12 additions & 3 deletions packages/core/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import { configuration } from './configuration.js'
import { updateSecondaryTokens } from './update-balances'

import type { Uns } from '@web3-onboard/unstoppable-resolution'
import type { PublicClient, GetEnsTextReturnType } from 'viem'
import {
type PublicClient,
type GetEnsTextReturnType,
isHex,
toHex
} from 'viem'
import type {
Address,
ChainId,
Expand Down Expand Up @@ -260,7 +265,9 @@ export function trackWallet(
if (!wallet) return // Add null check for wallet
const { chains, accounts } = wallet
const [connectedWalletChain] = chains

if (!isHex(chainId)) {
chainId = toHex(chainId)
}
if (chainId === connectedWalletChain.id) return

if (state.get().notify.enabled) {
Expand Down Expand Up @@ -321,7 +328,9 @@ export function trackWallet(
const { wallets, chains } = state.get()
const primaryWallet = wallets.find(wallet => wallet.label === label)
const accounts = primaryWallet?.accounts || []

if (!isHex(chainId)) {
chainId = toHex(chainId)
}
const chain = chains.find(
({ namespace, id }) => namespace === 'evm' && id === chainId
)
Expand Down
4 changes: 2 additions & 2 deletions packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@web3-onboard/blocto": "^2.1.0-alpha.2",
"@web3-onboard/capsule": "2.1.0-alpha.2",
"@web3-onboard/cede-store": "^2.3.0-alpha.2",
"@web3-onboard/core": "2.22.0-alpha.7",
"@web3-onboard/core": "2.22.0-alpha.8",
"@web3-onboard/coinbase": "^2.3.0-alpha.2",
"@web3-onboard/dcent": "^2.2.7",
"@web3-onboard/enkrypt": "^2.1.0-alpha.2",
Expand All @@ -43,7 +43,7 @@
"@web3-onboard/wagmi": "^2.0.0-alpha.6",
"@web3-onboard/gnosis": "^2.3.0-alpha.2",
"@web3-onboard/infinity-wallet": "^2.1.0-alpha.2",
"@web3-onboard/injected-wallets": "^2.11.0-alpha.2",
"@web3-onboard/injected-wallets": "2.11.0-alpha.2",
"@web3-onboard/keepkey": "^2.3.8",
"@web3-onboard/keystone": "^2.3.8",
"@web3-onboard/ledger": "^2.7.0-alpha.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/demo/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@
const onboard = Onboard({
wallets: [
metamaskSDKWallet,
coinbaseWallet,
// metamaskSDKWallet,
// coinbaseWallet,
injected,
ledger,
trezor,
Expand Down
3 changes: 2 additions & 1 deletion packages/injected/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"dependencies": {
"@web3-onboard/common": "^2.4.0-alpha.2",
"joi": "17.9.1",
"lodash.uniqby": "^4.7.0"
"lodash.uniqby": "^4.7.0",
"viem": "2.12.0"
}
}
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/react",
"version": "2.9.0-alpha.8",
"version": "2.9.0-alpha.9",
"description": "A collection of React hooks for integrating Web3-Onboard in to React and Next.js projects. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
"keywords": [
"Ethereum",
Expand Down Expand Up @@ -61,7 +61,7 @@
"typescript": "^5.4.5"
},
"dependencies": {
"@web3-onboard/core": "2.22.0-alpha.7",
"@web3-onboard/core": "2.22.0-alpha.8",
"@web3-onboard/common": "^2.4.0-alpha.2",
"use-sync-external-store": "1.0.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/solid/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/solid",
"version": "2.1.0-alpha.6",
"version": "2.1.0-alpha.7",
"description": "A collection of solid Composables for integrating Web3-Onboard in to a Solid project. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
"keywords": [
"Ethereum",
Expand Down Expand Up @@ -63,7 +63,7 @@
},
"dependencies": {
"@web3-onboard/common": "^2.4.0-alpha.2",
"@web3-onboard/core": "2.22.0-alpha.7",
"@web3-onboard/core": "2.22.0-alpha.8",
"solid-js": "^1.8.1"
}
}
4 changes: 2 additions & 2 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/vue",
"version": "2.8.0-alpha.6",
"version": "2.8.0-alpha.7",
"description": "A collection of Vue Composables for integrating Web3-Onboard in to a Vue or Nuxt project. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
"keywords": [
"Ethereum",
Expand Down Expand Up @@ -62,7 +62,7 @@
"@vueuse/core": "^8.4.2",
"@vueuse/rxjs": "^8.2.0",
"@web3-onboard/common": "^2.4.0-alpha.2",
"@web3-onboard/core": "2.22.0-alpha.7",
"@web3-onboard/core": "2.22.0-alpha.8",
"vue-demi": "^0.12.4"
},
"peerDependencies": {
Expand Down

0 comments on commit 820fb38

Please sign in to comment.