Skip to content

Commit 1a190c2

Browse files
1.29.0-0.5.7: Adds avatar to ens object (#629)
* 1.29.0-0.5.7: Adds avatar to ens object * Refactor
1 parent f4cf098 commit 1a190c2

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
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.6",
3+
"version": "1.29.0-0.5.7",
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/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ export interface TermsAgreementState {
563563

564564
export interface Ens {
565565
name?: string
566+
avatar?: string
566567
contentHash?: string
567568
getText?: (key: string) => Promise<string | undefined>
568569
}

src/utilities.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,20 @@ export function getAddress(provider: any): Promise<string | any> {
7171
export async function getEns(provider: any, address: string): Promise<Ens> {
7272
const { networkId } = get(app)
7373
const ens = new ENS({ provider, ensAddress: getEnsAddress(networkId) })
74-
let name
75-
let nameInterface
76-
let contentHash
7774
try {
78-
;({ name } = await ens.getName(address))
79-
nameInterface = await ens.name(name)
80-
contentHash = await nameInterface?.getContent()
75+
const { name } = await ens.getName(address)
76+
const nameInterface = await ens.name(name)
77+
const contentHash = await nameInterface?.getContent()
78+
const avatar = await nameInterface?.getText('avatar')
79+
return {
80+
name,
81+
avatar,
82+
contentHash,
83+
getText: nameInterface?.getText.bind(nameInterface)
84+
}
8185
} catch (e) {
8286
// Error getting ens name
83-
}
84-
85-
return {
86-
name,
87-
contentHash,
88-
getText: nameInterface?.getText.bind(nameInterface)
87+
return {}
8988
}
9089
}
9190

0 commit comments

Comments
 (0)