thirdweb 5.119.3 → 5.119.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,8 +9,12 @@ export type ReverseParams = {
9
9
  type: "bytes";
10
10
  name: "reverseName";
11
11
  }>;
12
+ coinType: AbiParameterToPrimitiveType<{
13
+ type: "uint256";
14
+ name: "coinType";
15
+ }>;
12
16
  };
13
- export declare const FN_SELECTOR: "0xec11c823";
17
+ export declare const FN_SELECTOR: "0x5d78a217";
14
18
  /**
15
19
  * Checks if the `reverse` method is supported by the given contract.
16
20
  * @param availableSelectors An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors.
@@ -62,7 +66,7 @@ export declare function encodeReverse(options: ReverseParams): `${typeof FN_SELE
62
66
  * const result = decodeReverseResultResult("...");
63
67
  * ```
64
68
  */
65
- export declare function decodeReverseResult(result: Hex): readonly [string, `0x${string}`, `0x${string}`, `0x${string}`];
69
+ export declare function decodeReverseResult(result: Hex): readonly [string, `0x${string}`, `0x${string}`];
66
70
  /**
67
71
  * Calls the "reverse" function on the contract.
68
72
  * @param options - The options for the reverse function.
@@ -79,5 +83,5 @@ export declare function decodeReverseResult(result: Hex): readonly [string, `0x$
79
83
  *
80
84
  * ```
81
85
  */
82
- export declare function reverse(options: BaseTransactionOptions<ReverseParams>): Promise<readonly [string, string, string, string]>;
86
+ export declare function reverse(options: BaseTransactionOptions<ReverseParams>): Promise<readonly [string, string, string]>;
83
87
  //# sourceMappingURL=reverse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reverse.d.ts","sourceRoot":"","sources":["../../../../../../../src/extensions/ens/__generated__/UniversalResolver/read/reverse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAG3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,2BAA2B,CAAC;QACvC,IAAI,EAAE,OAAO,CAAC;QACd,IAAI,EAAE,aAAa,CAAC;KACrB,CAAC,CAAC;CACJ,CAAC;AAEF,eAAO,MAAM,WAAW,EAAG,YAAqB,CAAC;AAsBjD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,EAAE,WAK9D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,iBAEzD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAIN,GAAG,OAAO,WAAW,GAAG,MAAM,EAAE,CAC7E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,kEAE9C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,sBAAsB,CAAC,aAAa,CAAC,sDAM3E"}
1
+ {"version":3,"file":"reverse.d.ts","sourceRoot":"","sources":["../../../../../../../src/extensions/ens/__generated__/UniversalResolver/read/reverse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAG3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,2BAA2B,CAAC;QACvC,IAAI,EAAE,OAAO,CAAC;QACd,IAAI,EAAE,aAAa,CAAC;KACrB,CAAC,CAAC;IACH,QAAQ,EAAE,2BAA2B,CAAC;QACpC,IAAI,EAAE,SAAS,CAAC;QAChB,IAAI,EAAE,UAAU,CAAC;KAClB,CAAC,CAAC;CACJ,CAAC;AAEF,eAAO,MAAM,WAAW,EAAG,YAAqB,CAAC;AAuBjD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,EAAE,WAK9D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,iBAKzD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAIN,GAAG,OAAO,WAAW,GAAG,MAAM,EAAE,CAC7E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,mDAE9C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,sBAAsB,CAAC,aAAa,CAAC,8CAM3E"}
@@ -1,4 +1,4 @@
1
- export declare const UNIVERSAL_RESOLVER_ADDRESS = "0xce01f8eee7E479C928F8919abD53E553a36CeF67";
1
+ export declare const UNIVERSAL_RESOLVER_ADDRESS = "0xeeeeeeee14d718c2b47d9923deab1335e144eeee";
2
2
  export declare const BASENAME_RESOLVER_ADDRESS = "0xC6d566A56A1aFf6508b41f6c90ff131615583BCD";
3
3
  export declare const BASE_SEPOLIA_BASENAME_RESOLVER_ADDRESS = "0x6533C94869D28fAA8dF77cc63f9e2b2D6Cf77eBA";
4
4
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-name.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ens/resolve-name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAQ7D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,KAAK,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,0BAqC5D"}
1
+ {"version":3,"file":"resolve-name.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ens/resolve-name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAM7D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,KAAK,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAwCxB"}
@@ -1,2 +1,2 @@
1
- export declare const version = "5.119.3";
1
+ export declare const version = "5.119.4";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -400,7 +400,7 @@
400
400
  }
401
401
  },
402
402
  "typings": "./dist/types/exports/thirdweb.d.ts",
403
- "version": "5.119.3",
403
+ "version": "5.119.4",
404
404
  "scripts": {
405
405
  "bench": "vitest -c ./test/vitest.config.ts bench",
406
406
  "bench:compare": "bun run ./benchmarks/run.ts",
@@ -14,14 +14,22 @@ export type ReverseParams = {
14
14
  type: "bytes";
15
15
  name: "reverseName";
16
16
  }>;
17
+ coinType: AbiParameterToPrimitiveType<{
18
+ type: "uint256";
19
+ name: "coinType";
20
+ }>;
17
21
  };
18
22
 
19
- export const FN_SELECTOR = "0xec11c823" as const;
23
+ export const FN_SELECTOR = "0x5d78a217" as const;
20
24
  const FN_INPUTS = [
21
25
  {
22
26
  name: "reverseName",
23
27
  type: "bytes",
24
28
  },
29
+ {
30
+ name: "coinType",
31
+ type: "uint256",
32
+ },
25
33
  ] as const;
26
34
  const FN_OUTPUTS = [
27
35
  {
@@ -33,9 +41,6 @@ const FN_OUTPUTS = [
33
41
  {
34
42
  type: "address",
35
43
  },
36
- {
37
- type: "address",
38
- },
39
44
  ] as const;
40
45
 
41
46
  /**
@@ -70,7 +75,10 @@ export function isReverseSupported(availableSelectors: string[]) {
70
75
  * ```
71
76
  */
72
77
  export function encodeReverseParams(options: ReverseParams) {
73
- return encodeAbiParameters(FN_INPUTS, [options.reverseName]);
78
+ return encodeAbiParameters(FN_INPUTS, [
79
+ options.reverseName,
80
+ options.coinType,
81
+ ]);
74
82
  }
75
83
 
76
84
  /**
@@ -128,6 +136,6 @@ export async function reverse(options: BaseTransactionOptions<ReverseParams>) {
128
136
  return readContract({
129
137
  contract: options.contract,
130
138
  method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
131
- params: [options.reverseName],
139
+ params: [options.reverseName, options.coinType],
132
140
  });
133
141
  }
@@ -1,5 +1,5 @@
1
1
  export const UNIVERSAL_RESOLVER_ADDRESS =
2
- "0xce01f8eee7E479C928F8919abD53E553a36CeF67";
2
+ "0xeeeeeeee14d718c2b47d9923deab1335e144eeee";
3
3
  export const BASENAME_RESOLVER_ADDRESS =
4
4
  "0xC6d566A56A1aFf6508b41f6c90ff131615583BCD";
5
5
  export const BASE_SEPOLIA_BASENAME_RESOLVER_ADDRESS =
@@ -3,8 +3,6 @@ import { ethereum } from "../../chains/chain-definitions/ethereum.js";
3
3
  import type { Chain } from "../../chains/types.js";
4
4
  import type { ThirdwebClient } from "../../client/client.js";
5
5
  import { getContract } from "../../contract/contract.js";
6
- import { toHex } from "../../utils/encoding/hex.js";
7
- import { packetToBytes } from "../../utils/ens/packetToBytes.js";
8
6
  import { withCache } from "../../utils/promise/withCache.js";
9
7
  import { reverse } from "./__generated__/UniversalResolver/read/reverse.js";
10
8
  import { UNIVERSAL_RESOLVER_ADDRESS } from "./constants.js";
@@ -33,7 +31,9 @@ export type ResolveNameOptions = {
33
31
  * @extension ENS
34
32
  * @returns A promise that resolves to the Ethereum address.
35
33
  */
36
- export async function resolveName(options: ResolveNameOptions) {
34
+ export async function resolveName(
35
+ options: ResolveNameOptions,
36
+ ): Promise<string | null> {
37
37
  const { client, address, resolverAddress, resolverChain } = options;
38
38
 
39
39
  return withCache(
@@ -44,25 +44,28 @@ export async function resolveName(options: ResolveNameOptions) {
44
44
  client,
45
45
  });
46
46
 
47
- const reverseName = toHex(
48
- packetToBytes(`${address.toLowerCase().substring(2)}.addr.reverse`),
49
- );
50
-
51
- const [name, resolvedAddress] = await reverse({
47
+ const [name] = await reverse({
52
48
  contract,
53
- reverseName,
49
+ reverseName: address as `0x${string}`,
50
+ coinType: 60n,
54
51
  }).catch((e) => {
55
- if ("data" in e && e.data === "0x7199966d") {
56
- return [null, address] as const;
52
+ // Re-throw verification errors so callers can detect data integrity issues
53
+ if (
54
+ typeof e === "object" &&
55
+ e !== null &&
56
+ "data" in e &&
57
+ typeof e.data === "string"
58
+ ) {
59
+ // ReverseAddressMismatch(string,bytes) = 0xef9c03ce
60
+ if (e.data.startsWith("0xef9c03ce")) {
61
+ throw e;
62
+ }
57
63
  }
58
- throw e;
64
+ // Swallow expected "no resolver" / "no name" errors
65
+ return [null] as const;
59
66
  });
60
67
 
61
- if (address.toLowerCase() !== resolvedAddress.toLowerCase()) {
62
- return null;
63
- }
64
-
65
- return name;
68
+ return name || null;
66
69
  },
67
70
  {
68
71
  cacheKey: `ens:name:${resolverChain?.id || 1}:${address}`,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.119.3";
1
+ export const version = "5.119.4";