Skip to content

Commit 6dd022b

Browse files
1.29.0-0.5.9: Fix ens on non-ethereum networks - filter out detectedwallet (#633)
* 1.29.0-0.5.9: Fix ens on non-ethereum networks - filter out detected wallet * Version bump * Fix typo
1 parent 2049d88 commit 6dd022b

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bnc-onboard",
3-
"version": "1.29.0-0.5.8",
3+
"version": "1.29.0-0.5.9",
44
"description": "Onboard users to web3 by allowing them to select a wallet, get that wallet ready to transact and have access to synced wallet state.",
55
"keywords": [
66
"ethereum",

src/modules/select/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ function select(
5050
: desktopDefaultWalletNames
5151

5252
if (wallets) {
53+
// For backwards compatibility if a user is still using 'detectedwallet' in the onboard wallet select array
54+
// it will be filtered out so there are no duplicates
55+
wallets = wallets.filter(
56+
wallet =>
57+
'walletName' in wallet ? wallet.walletName !== 'detectedwallet' : true // It is not a WalletInitOption but rather a WalletModule so let it through
58+
)
59+
5360
// If we detect an injected wallet then place the detected wallet
5461
// at the beginning of the list e.g. the of the wallet select modal
5562
if (injectedWalletDetected()) {
@@ -59,7 +66,7 @@ function select(
5966
wallets.map(wallet => {
6067
// If this is a wallet init object then load the built-in wallet module
6168
if (isWalletInit(wallet)) {
62-
const { walletName, ...initParams } = wallet as WalletInitOptions
69+
const { walletName, ...initParams } = wallet
6370
try {
6471
return getModule(walletName).then((m: any) =>
6572
m.default({ ...initParams, networkId, isMobile })

src/utilities.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ export function getAddress(provider: any): Promise<string | any> {
7070

7171
export async function getEns(provider: any, address: string): Promise<Ens> {
7272
const { networkId } = get(app)
73-
const ens = new ENS({ provider, ensAddress: getEnsAddress(networkId) })
7473
try {
74+
const ens = new ENS({ provider, ensAddress: getEnsAddress(networkId) })
7575
const { name } = await ens.getName(address)
7676
const nameInterface = await ens.name(name)
7777
const contentHash = await nameInterface?.getContent()
@@ -83,7 +83,7 @@ export async function getEns(provider: any, address: string): Promise<Ens> {
8383
getText: nameInterface?.getText.bind(nameInterface)
8484
}
8585
} catch (e) {
86-
// Error getting ens name
86+
// Error getting ens
8787
return {}
8888
}
8989
}

0 commit comments

Comments
 (0)