Skip to content

Commit 4d3cb02

Browse files
committed
Update
1 parent 209ef66 commit 4d3cb02

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

packages/thirdweb/src/extensions/unstoppable-domains/read/resolveAddress.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,48 @@ import { getMany } from "../__generated__/UnstoppableDomains/read/getMany.js";
88
import { namehash } from "../__generated__/UnstoppableDomains/read/namehash.js";
99
import { UD_POLYGON_MAINNET } from "../consts.js";
1010

11+
/**
12+
* @extension UNSTOPPABLE-DOMAINS
13+
*/
1114
export type ResolveAddressOptions = {
1215
client: ThirdwebClient;
1316
name: string;
1417
resolverAddress?: string;
1518
resolverChain?: Chain;
1619
};
1720

21+
/**
22+
* Resolve an Unstoppable-Domain domain to an Ethereum address
23+
* @param options - The options for resolving an UD domain
24+
* @returns The Ethereum address associated with the domain name. [Learn more](https://docs.unstoppabledomains.com/reverse-resolution/)
25+
* @example
26+
*
27+
* ### Basic usage
28+
* ```ts
29+
* import { resolveAddress } from "thirdweb/extension/unstoppable-domains";
30+
*
31+
* const address = await resolveAddress({
32+
* client,
33+
* name: "thirdweb.crypto",
34+
* });
35+
* ```
36+
*
37+
* ### Custom resolver
38+
* By default this extension will try to resolve the name on Polygon mainnet,
39+
* you can decide to customize the resolver contract by specifying `resolverAddress` and `resolverChain`
40+
* ```ts
41+
* import { ethereum } from "thirdweb/chains";
42+
*
43+
* const address = await resolveAddress({
44+
* client,
45+
* name: "thirdweb.crypto",
46+
* resolverAddress: "0x...",
47+
* resolverChain: ethereum,
48+
* });
49+
* ```
50+
*
51+
* @extension UNSTOPPABLE-DOMAINS
52+
*/
1853
export async function resolveAddress(
1954
options: ResolveAddressOptions,
2055
): Promise<string> {

packages/thirdweb/src/extensions/unstoppable-domains/read/resolveName.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,46 @@ import { withCache } from "../../../utils/promise/withCache.js";
66
import { reverseNameOf } from "../__generated__/UnstoppableDomains/read/reverseNameOf.js";
77
import { UD_POLYGON_MAINNET } from "../consts.js";
88

9+
/**
10+
* @extension UNSTOPPABLE-DOMAINS
11+
*/
912
export type ResolveUDNameOptions = {
1013
client: ThirdwebClient;
1114
address: string;
1215
resolverAddress?: string;
1316
resolverChain?: Chain;
1417
};
1518

19+
/**
20+
* Resolves the primary Untoppable-Domains name for a specified address.
21+
* @param options - The options for resolving an UD domain
22+
* @example
23+
*
24+
* ### Basic usage
25+
* ```ts
26+
* import { resolveName } from "thirdweb/extension/unstoppable-domains";
27+
*
28+
* const name = await resolveName({
29+
* client,
30+
* address: "0x...",
31+
* });
32+
* ```
33+
*
34+
* ### Custom resolver
35+
* By default this extension will try to resolve the address on Polygon mainnet,
36+
* you can decide to customize the resolver contract by specifying `resolverAddress` and `resolverChain`
37+
* ```ts
38+
* import { ethereum } from "thirdweb/chains";
39+
*
40+
* const address = await resolveName({
41+
* client,
42+
* address: "0x...",
43+
* resolverAddress: "0x...",
44+
* resolverChain: ethereum,
45+
* });
46+
* ```
47+
* @extension UNSTOPPABLE-DOMAINS
48+
*/
1649
export async function resolveName(
1750
options: ResolveUDNameOptions,
1851
): Promise<string> {

0 commit comments

Comments
 (0)