Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Add resolveMultiLabel util fn
Sebastian Martinez committed 3 years ago
commit 549140aab92559c27272ab24c745915169c41a9e
parent 4ebf073c5bfaba9a721748e9161d9d07b2647a49
1 file changed +12 -0
modified src/utils.ts
@@ -508,6 +508,18 @@ export async function resolveLabel(
  return null;
}

+
export async function resolveMultiLabel(
+
  labels: string[],
+
  config: Config,
+
): Promise<Record<string, string | null>> {
+
  const addresses = await Promise.all(
+
    labels.map(label => config.provider.resolveName(label)),
+
  );
+
  return labels.reduce((arr, curr, index) => {
+
    return { ...arr, [curr]: addresses[index] };
+
  }, {});
+
}
+

// Resolves an IDX profile or return null
export const resolveIdxProfile = cache.cached(
  async (caip10: string, config: Config): Promise<BasicProfile | null> => {