From 75b9498b74dba8e74d585fed394b4c8c9e572434 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 24 Sep 2024 16:23:51 -0400 Subject: [PATCH] feat: add reverse resolution priority --- src/Resolution.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Resolution.ts b/src/Resolution.ts index 7a8ad573..c479f7d6 100644 --- a/src/Resolution.ts +++ b/src/Resolution.ts @@ -1178,10 +1178,18 @@ export default class Resolution { private async reverseGetTokenId( address: string, location?: UnsLocation, - ): Promise { - const service = this.serviceMap['UNS'].native; - const tokenId = await service.reverseOf(address, location); - return tokenId as string; + ): Promise { + let tokenId: string | null = null; + + const unsService = this.serviceMap['UNS'].native; + tokenId = await unsService.reverseOf(address, location); + + if (!tokenId) { + const baseUnsService = this.serviceMap['UNS_BASE'].native; + tokenId = await baseUnsService.reverseOf(address, location); + } + + return tokenId; } private getUnsConfig(config: ResolutionConfig): Uns | UdApi {