From 5015018b6eac312877b7941415836daa63c68d40 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Tue, 14 Sep 2021 10:28:51 +0200 Subject: [PATCH] Reduce calls to IDX profile streams Check first for a ENS profile and in case it returns null, go for the IDX profile. Signed-off-by: Sebastian Martinez --- src/profile.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/profile.ts b/src/profile.ts index 7bd54d55a..024e2bbfa 100644 --- a/src/profile.ts +++ b/src/profile.ts @@ -100,13 +100,10 @@ export class Profile { } try { - const [ens, idx] = await Promise.allSettled([ - resolveEnsProfile(address, profileType, config), - resolveIdxProfile(formatCAIP10Address(address, "eip155", config.network.chainId), config) - ]); - - if (ens.status == "fulfilled") profile.ens = ens.value; - if (idx.status == "fulfilled") profile.idx = idx.value; + profile.ens = await resolveEnsProfile(address, profileType, config); + if (!profile.ens) { + profile.idx = await resolveIdxProfile(formatCAIP10Address(address, "eip155", config.network.chainId), config); + } } catch (error) { console.error(error); }