Skip to content

Commit 1f3e204

Browse files
authored
Add avatar to ENS object (#862)
1 parent 386fd79 commit 1f3e204

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

packages/core/src/provider.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,16 @@ export async function getEns(
244244
const resolver = await provider.getResolver(name)
245245

246246
if (resolver) {
247-
const contentHash = await resolver.getContentHash()
247+
const [contentHash, avatar] = await Promise.all([
248+
resolver.getContentHash(),
249+
resolver.getAvatar()
250+
])
251+
248252
const getText = resolver.getText.bind(resolver)
249253

250254
ens = {
251255
name,
256+
avatar,
252257
contentHash,
253258
getText
254259
}

packages/core/src/types.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,15 @@ export type Account = {
7171
export type Balances = Record<TokenSymbol, string> | null
7272

7373
export interface Ens {
74-
name?: string
75-
avatar?: string
76-
contentHash?: string
77-
getText?: (key: string) => Promise<string | undefined>
74+
name: string
75+
avatar: Avatar | null
76+
contentHash: string | null
77+
getText: (key: string) => Promise<string | undefined>
78+
}
79+
80+
export type Avatar = {
81+
url: string
82+
linkage: Array<{ type: string; content: string }>
7883
}
7984

8085
export type Address = string

0 commit comments

Comments
 (0)