diff --git a/packages/extension/src/libs/name-resolver/index.ts b/packages/extension/src/libs/name-resolver/index.ts new file mode 100644 index 000000000..0fb2f7f91 --- /dev/null +++ b/packages/extension/src/libs/name-resolver/index.ts @@ -0,0 +1,23 @@ +import NameResolver, { CoinType } from "@enkryptcom/name-resolution"; +class GenericNameResolver { + nameResolver: NameResolver; + + constructor() { + this.nameResolver = new NameResolver({ + ens: { node: "https://nodes.mewapi.io/rpc/eth" }, + }); + } + + async resolveName(name: string, coins: CoinType[]): Promise { + let response: string | null = null; + for (const coin of coins) { + response = await this.nameResolver + .resolveAddress(name, coin) + .catch(() => null); + if (response) return response; + } + return response; + } +} + +export { CoinType, GenericNameResolver }; diff --git a/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue b/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue index 3317bedd0..0dc21331e 100644 --- a/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue +++ b/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue @@ -129,6 +129,7 @@