Skip to content

Commit c29d0e8

Browse files
chore(useResolveAddress): use the new space id endpoint
1 parent 7a3801b commit c29d0e8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎src/hooks/useResolveAddress.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,17 @@ const fetchLensProtocolName = async (address: string): Promise<string> => {
106106
}
107107

108108
const fetchSpaceIdName = async (address: string): Promise<string> => {
109-
const tlds = ["bnb", "arb"]
109+
const chainIds = [42161, 34443, 7000, 4200, 100, 185, 902, 903, 904]
110110

111111
const spaceIds = await Promise.all(
112-
tlds.map((tld) =>
113-
fetcher(`https://api.prd.space.id/v1/getName?tld=${tld}&address=${address}`)
112+
chainIds.map((chainId) =>
113+
fetcher(
114+
`https://nameapi.space.id/getName?chainid=${chainId}&address=${address}`
115+
)
114116
)
115117
)
116118

117-
const spaceId = spaceIds.find((data) => !!data.name)?.name
119+
const spaceId = spaceIds.find((res) => !!res.data.name)?.data.name
118120

119121
if (spaceId) {
120122
await setResolvedAddressToIdb(address, {

0 commit comments

Comments
 (0)