From 03b7624cae6b9316d61bdd173c863642a57217a2 Mon Sep 17 00:00:00 2001 From: John Henderson Date: Mon, 6 Dec 2021 12:41:12 +0100 Subject: [PATCH] feat(utils/did): use Chain from ew-did-reg/did Better to use enum to ensure consistent use of strings --- src/utils/did.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils/did.ts b/src/utils/did.ts index d5b63d58..ce7937e5 100644 --- a/src/utils/did.ts +++ b/src/utils/did.ts @@ -1,4 +1,4 @@ -import { Methods, isValidErc1056EWC, isValidErc1056VOLTA } from "@ew-did-registry/did"; +import { Methods, Chain, isValidErc1056EWC, isValidErc1056VOLTA } from "@ew-did-registry/did"; const validators = new Map boolean>(); @@ -10,9 +10,9 @@ export function isValidDID(did: string): boolean { return Array.from(validators.values()).some((v) => v(did)); } -export function addSupportedDID(method: string, validator: (did: string) => boolean) { - validators.set(method, validator); +export function addSupportedDID(methodWithChain: string, validator: (did: string) => boolean) { + validators.set(methodWithChain, validator); } -addSupportedDID(`${Methods.Erc1056}:ewc`, isValidErc1056EWC); -addSupportedDID(`${Methods.Erc1056}:volta`, isValidErc1056VOLTA); +addSupportedDID(`${Methods.Erc1056}:${Chain.EWC}`, isValidErc1056EWC); +addSupportedDID(`${Methods.Erc1056}:${Chain.VOLTA}`, isValidErc1056VOLTA);