Skip to content

Commit

Permalink
feat: add reverse resolution priority
Browse files Browse the repository at this point in the history
  • Loading branch information
sammyluo committed Sep 24, 2024
1 parent 64f0c7c commit 75b9498
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Resolution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1178,10 +1178,18 @@ export default class Resolution {
private async reverseGetTokenId(
address: string,
location?: UnsLocation,
): Promise<string> {
const service = this.serviceMap['UNS'].native;
const tokenId = await service.reverseOf(address, location);
return tokenId as string;
): Promise<string | null> {
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 {
Expand Down

0 comments on commit 75b9498

Please sign in to comment.