Skip to content

Commit 9d85be9

Browse files
1.33.0-0.3.3: [refactor] Lazy load ens (#660)
1 parent 42cbad8 commit 9d85be9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
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.33.0-0.3.2",
3+
"version": "1.33.0-0.3.3",
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/utilities.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import bowser from 'bowser'
22
import BigNumber from 'bignumber.js'
33
import { get } from 'svelte/store'
4-
import ENS, { getEnsAddress } from '@ensdomains/ensjs'
54

65
import { app } from './stores'
76
import { WalletInterface, Ens } from './interfaces'
@@ -71,6 +70,11 @@ export function getAddress(provider: any): Promise<string | any> {
7170
export async function getEns(provider: any, address: string): Promise<Ens> {
7271
const { networkId } = get(app)
7372
try {
73+
// There is an issue with ens and ts unable to find the
74+
// declaration file for it even though it is present.
75+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
76+
// @ts-ignore - TS7016
77+
const { default: ENS, getEnsAddress } = await import('@ensdomains/ensjs')
7478
const ens = new ENS({ provider, ensAddress: getEnsAddress(networkId) })
7579
const { name } = await ens.getName(address)
7680
const nameInterface = await ens.name(name)
@@ -84,6 +88,7 @@ export async function getEns(provider: any, address: string): Promise<Ens> {
8488
}
8589
} catch (e) {
8690
// Error getting ens
91+
console.error(e)
8792
return {}
8893
}
8994
}

0 commit comments

Comments
 (0)