From 47e90aae70fa1cf223625375fc2dc6feabf7a093 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Tue, 13 Sep 2022 10:06:27 +0200 Subject: [PATCH] Add getSeedEmoji util fn Signed-off-by: Sebastian Martinez --- src/utils.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/utils.ts b/src/utils.ts index c7bc73ae1..5e0b86524 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -477,6 +477,16 @@ export function parseEmoji(input: string): string { return input; } +// Fetch from config the emoji to the corresponding pinned seed, if non found return default emoji +// @dev: This helper fn lets us get a seed emoji quick without multiLookups or complex type usage. +// TODO: Should be revisited, when we have a stable implementation for seed avatars. +export function getSeedEmoji(input: string, config: Config): string { + if (config.seeds.pinned[input]) { + return config.seeds.pinned[input].emoji; + } + return "🌱"; +} + // Identify an address by checking whether it's a contract or an externally-owned address. export async function identifyAddress( address: string,