@gardenfi/utils 2.5.2 → 2.5.3-beta.0

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.
Files changed (200) hide show
  1. package/README.md +9 -0
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.js +37 -36
  4. package/dist/index10.cjs +1 -1
  5. package/dist/index10.js +4 -4
  6. package/dist/index11.cjs +1 -1
  7. package/dist/index11.js +16 -20
  8. package/dist/index112.cjs +1 -1
  9. package/dist/index112.js +15 -15
  10. package/dist/index121.cjs +1 -1
  11. package/dist/index121.js +1 -1
  12. package/dist/index130.cjs +1 -1
  13. package/dist/index130.js +1 -1
  14. package/dist/index16.cjs +1 -1
  15. package/dist/index16.js +4 -4
  16. package/dist/index18.cjs +1 -1
  17. package/dist/index18.js +20 -9
  18. package/dist/index197.cjs +1 -1
  19. package/dist/index197.js +17 -30
  20. package/dist/index22.cjs +1 -1
  21. package/dist/index22.js +84 -51
  22. package/dist/index226.cjs +1 -1
  23. package/dist/index226.js +2 -2
  24. package/dist/index229.cjs +1 -1
  25. package/dist/index229.js +2 -2
  26. package/dist/index230.cjs +1 -1
  27. package/dist/index230.js +1 -1
  28. package/dist/index234.cjs +1 -1
  29. package/dist/index234.js +7 -8
  30. package/dist/index235.cjs +1 -1
  31. package/dist/index235.js +1 -1
  32. package/dist/index236.cjs +1 -1
  33. package/dist/index236.js +1 -1
  34. package/dist/index237.cjs +1 -1
  35. package/dist/index237.js +2 -2
  36. package/dist/index24.cjs +1 -1
  37. package/dist/index24.js +30 -13
  38. package/dist/index249.cjs +1 -1
  39. package/dist/index249.js +3 -3
  40. package/dist/index25.cjs +1 -1
  41. package/dist/index25.js +30 -58
  42. package/dist/index250.cjs +1 -1
  43. package/dist/index250.js +3 -3
  44. package/dist/index256.cjs +1 -1
  45. package/dist/index256.js +17 -12
  46. package/dist/index26.cjs +1 -16
  47. package/dist/index26.js +11 -113
  48. package/dist/index269.cjs +1 -1
  49. package/dist/index269.js +4 -4
  50. package/dist/index27.cjs +1 -1
  51. package/dist/index27.js +58 -32
  52. package/dist/index270.cjs +1 -1
  53. package/dist/index270.js +5 -5
  54. package/dist/index271.cjs +1 -1
  55. package/dist/index271.js +27 -21
  56. package/dist/index272.cjs +1 -1
  57. package/dist/index272.js +54 -20
  58. package/dist/index273.cjs +1 -1
  59. package/dist/index273.js +18 -54
  60. package/dist/index274.cjs +1 -1
  61. package/dist/index274.js +10 -34
  62. package/dist/index275.cjs +1 -1
  63. package/dist/index275.js +7 -10
  64. package/dist/index276.cjs +1 -1
  65. package/dist/index276.js +12 -13
  66. package/dist/index277.cjs +1 -1
  67. package/dist/index277.js +11 -12
  68. package/dist/index28.cjs +1 -1
  69. package/dist/index28.js +13 -31
  70. package/dist/index280.cjs +1 -1
  71. package/dist/index280.js +103 -11
  72. package/dist/index281.cjs +1 -1
  73. package/dist/index281.js +6 -103
  74. package/dist/index282.cjs +1 -1
  75. package/dist/index282.js +243 -5
  76. package/dist/index283.cjs +1 -1
  77. package/dist/index283.js +6 -224
  78. package/dist/index284.cjs +1 -1
  79. package/dist/index284.js +7 -7
  80. package/dist/index285.cjs +1 -1
  81. package/dist/index285.js +27 -7
  82. package/dist/index286.cjs +1 -1
  83. package/dist/index286.js +18 -25
  84. package/dist/index287.cjs +1 -1
  85. package/dist/index287.js +145 -18
  86. package/dist/index288.cjs +1 -1
  87. package/dist/index288.js +3 -146
  88. package/dist/index289.cjs +1 -1
  89. package/dist/index289.js +155 -3
  90. package/dist/index29.cjs +16 -1
  91. package/dist/index29.js +113 -11
  92. package/dist/index290.cjs +1 -1
  93. package/dist/index290.js +7 -138
  94. package/dist/index291.cjs +1 -1
  95. package/dist/index291.js +128 -143
  96. package/dist/index292.cjs +1 -1
  97. package/dist/index292.js +111 -7
  98. package/dist/index293.cjs +2 -1
  99. package/dist/index293.js +116 -95
  100. package/dist/index294.cjs +1 -2
  101. package/dist/index294.js +35 -127
  102. package/dist/index295.cjs +1 -1
  103. package/dist/index295.js +66 -30
  104. package/dist/index296.cjs +1 -1
  105. package/dist/index296.js +2 -79
  106. package/dist/index297.cjs +1 -1
  107. package/dist/index297.js +12 -2
  108. package/dist/index298.cjs +1 -1
  109. package/dist/index298.js +19 -11
  110. package/dist/index299.cjs +1 -1
  111. package/dist/index299.js +68 -19
  112. package/dist/index3.cjs +1 -1
  113. package/dist/index3.js +10 -8
  114. package/dist/index300.cjs +1 -1
  115. package/dist/index300.js +786 -66
  116. package/dist/index301.cjs +1 -1
  117. package/dist/index301.js +134 -684
  118. package/dist/index302.cjs +1 -1
  119. package/dist/index302.js +185 -124
  120. package/dist/index303.cjs +2 -1
  121. package/dist/index303.js +63 -198
  122. package/dist/index304.cjs +1 -2
  123. package/dist/index304.js +7 -66
  124. package/dist/index305.cjs +1 -1
  125. package/dist/index305.js +62 -4
  126. package/dist/index306.cjs +1 -1
  127. package/dist/index306.js +22 -40
  128. package/dist/index307.cjs +1 -1
  129. package/dist/index307.js +5 -7
  130. package/dist/index308.cjs +1 -1
  131. package/dist/index308.js +72 -57
  132. package/dist/index309.cjs +1 -1
  133. package/dist/index309.js +4 -78
  134. package/dist/index310.cjs +1 -1
  135. package/dist/index310.js +195 -4
  136. package/dist/index311.cjs +1 -1
  137. package/dist/index311.js +4 -194
  138. package/dist/index312.cjs +1 -1
  139. package/dist/index312.js +35 -58
  140. package/dist/index313.cjs +2 -1
  141. package/dist/index313.js +40 -43
  142. package/dist/index314.cjs +1 -1
  143. package/dist/index314.js +2 -5
  144. package/dist/index315.cjs +1 -1
  145. package/dist/index315.js +11 -5
  146. package/dist/index316.cjs +1 -1
  147. package/dist/index316.js +20 -2
  148. package/dist/index317.cjs +1 -1
  149. package/dist/index317.js +8 -21
  150. package/dist/index318.cjs +1 -0
  151. package/dist/index318.js +45 -0
  152. package/dist/index319.cjs +1 -0
  153. package/dist/index319.js +69 -0
  154. package/dist/index320.cjs +1 -0
  155. package/dist/index320.js +68 -0
  156. package/dist/index321.cjs +1 -0
  157. package/dist/index321.js +191 -0
  158. package/dist/index322.cjs +1 -0
  159. package/dist/index322.js +79 -0
  160. package/dist/index323.cjs +1 -0
  161. package/dist/index323.js +43 -0
  162. package/dist/index324.cjs +1 -0
  163. package/dist/index324.js +19 -0
  164. package/dist/index325.cjs +1 -0
  165. package/dist/index325.js +16 -0
  166. package/dist/index326.cjs +1 -0
  167. package/dist/index326.js +7 -0
  168. package/dist/index327.cjs +1 -0
  169. package/dist/index327.js +66 -0
  170. package/dist/index328.cjs +1 -0
  171. package/dist/index328.js +7 -0
  172. package/dist/index329.cjs +1 -0
  173. package/dist/index329.js +47 -0
  174. package/dist/index330.cjs +1 -0
  175. package/dist/index330.js +71 -0
  176. package/dist/index331.cjs +1 -0
  177. package/dist/index331.js +4 -0
  178. package/dist/index332.cjs +1 -0
  179. package/dist/index332.js +24 -0
  180. package/dist/index55.cjs +1 -1
  181. package/dist/index55.js +1 -1
  182. package/dist/index58.cjs +1 -1
  183. package/dist/index58.js +35 -34
  184. package/dist/index60.cjs +1 -1
  185. package/dist/index60.js +26 -30
  186. package/dist/index61.cjs +1 -1
  187. package/dist/index61.js +13 -9
  188. package/dist/index62.cjs +1 -1
  189. package/dist/index62.js +19 -19
  190. package/dist/index89.cjs +1 -1
  191. package/dist/index89.js +31 -30
  192. package/dist/index9.cjs +1 -1
  193. package/dist/index9.js +2 -2
  194. package/dist/index95.cjs +1 -1
  195. package/dist/index95.js +73 -73
  196. package/dist/src/lib/auth/apikey/apikey.d.ts +1 -1
  197. package/dist/src/lib/auth/auth.types.d.ts +1 -1
  198. package/dist/src/lib/fetcher/fetcher.d.ts +2 -0
  199. package/dist/src/lib/utils.d.ts +1 -0
  200. package/package.json +2 -2
@@ -0,0 +1,66 @@
1
+ import { BaseError as c } from "./index303.js";
2
+ import { padRight as h } from "./index289.js";
3
+ import { charCodeToBase16 as b, assertSize as g, pad as m } from "./index329.js";
4
+ import { assertSize as p } from "./index312.js";
5
+ const l = /* @__PURE__ */ new TextEncoder();
6
+ function E(e) {
7
+ return e instanceof Uint8Array ? e : typeof e == "string" ? y(e) : z(e);
8
+ }
9
+ function z(e) {
10
+ return e instanceof Uint8Array ? e : new Uint8Array(e);
11
+ }
12
+ function y(e, t = {}) {
13
+ const { size: r } = t;
14
+ let n = e;
15
+ r && (p(e, r), n = h(e, r));
16
+ let i = n.slice(2);
17
+ i.length % 2 && (i = `0${i}`);
18
+ const f = i.length / 2, a = new Uint8Array(f);
19
+ for (let s = 0, o = 0; s < f; s++) {
20
+ const d = b(i.charCodeAt(o++)), u = b(i.charCodeAt(o++));
21
+ if (d === void 0 || u === void 0)
22
+ throw new c(`Invalid byte sequence ("${i[o - 2]}${i[o - 1]}" in "${i}").`);
23
+ a[s] = d * 16 + u;
24
+ }
25
+ return a;
26
+ }
27
+ function C(e, t = {}) {
28
+ const { size: r } = t, n = l.encode(e);
29
+ return typeof r == "number" ? (g(n, r), x(n, r)) : n;
30
+ }
31
+ function x(e, t) {
32
+ return m(e, { dir: "right", size: t });
33
+ }
34
+ function U(e) {
35
+ return e.length;
36
+ }
37
+ class B extends c {
38
+ constructor({ givenSize: t, maxSize: r }) {
39
+ super(`Size cannot exceed \`${r}\` bytes. Given size: \`${t}\` bytes.`), Object.defineProperty(this, "name", {
40
+ enumerable: !0,
41
+ configurable: !0,
42
+ writable: !0,
43
+ value: "Bytes.SizeOverflowError"
44
+ });
45
+ }
46
+ }
47
+ class O extends c {
48
+ constructor({ size: t, targetSize: r, type: n }) {
49
+ super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${r}\`).`), Object.defineProperty(this, "name", {
50
+ enumerable: !0,
51
+ configurable: !0,
52
+ writable: !0,
53
+ value: "Bytes.SizeExceedsPaddingSizeError"
54
+ });
55
+ }
56
+ }
57
+ export {
58
+ O as SizeExceedsPaddingSizeError,
59
+ B as SizeOverflowError,
60
+ E as from,
61
+ z as fromArray,
62
+ y as fromHex,
63
+ C as fromString,
64
+ x as padRight,
65
+ U as size
66
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index332.cjs"),e={checksum:new c.LruMap(8192)},s=e.checksum;exports.checksum=s;
@@ -0,0 +1,7 @@
1
+ import { LruMap as c } from "./index332.js";
2
+ const e = {
3
+ checksum: /* @__PURE__ */ new c(8192)
4
+ }, m = e.checksum;
5
+ export {
6
+ m as checksum
7
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index327.cjs");function s(e,t){if(o.size(e)>t)throw new o.SizeOverflowError({givenSize:o.size(e),maxSize:t})}const n={zero:48,nine:57,A:65,F:70,a:97,f:102};function u(e){if(e>=n.zero&&e<=n.nine)return e-n.zero;if(e>=n.A&&e<=n.F)return e-(n.A-10);if(e>=n.a&&e<=n.f)return e-(n.a-10)}function z(e,t={}){const{dir:f,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new o.SizeExceedsPaddingSizeError({size:e.length,targetSize:r,type:"Bytes"});const d=new Uint8Array(r);for(let i=0;i<r;i++){const a=f==="right";d[a?i:r-i-1]=e[a?i:e.length-i-1]}return d}exports.assertSize=s;exports.charCodeMap=n;exports.charCodeToBase16=u;exports.pad=z;
@@ -0,0 +1,47 @@
1
+ import { size as d, SizeOverflowError as u, SizeExceedsPaddingSizeError as a } from "./index327.js";
2
+ function p(e, t) {
3
+ if (d(e) > t)
4
+ throw new u({
5
+ givenSize: d(e),
6
+ maxSize: t
7
+ });
8
+ }
9
+ const n = {
10
+ zero: 48,
11
+ nine: 57,
12
+ A: 65,
13
+ F: 70,
14
+ a: 97,
15
+ f: 102
16
+ };
17
+ function s(e) {
18
+ if (e >= n.zero && e <= n.nine)
19
+ return e - n.zero;
20
+ if (e >= n.A && e <= n.F)
21
+ return e - (n.A - 10);
22
+ if (e >= n.a && e <= n.f)
23
+ return e - (n.a - 10);
24
+ }
25
+ function S(e, t = {}) {
26
+ const { dir: z, size: i = 32 } = t;
27
+ if (i === 0)
28
+ return e;
29
+ if (e.length > i)
30
+ throw new a({
31
+ size: e.length,
32
+ targetSize: i,
33
+ type: "Bytes"
34
+ });
35
+ const o = new Uint8Array(i);
36
+ for (let r = 0; r < i; r++) {
37
+ const f = z === "right";
38
+ o[f ? r : i - r - 1] = e[f ? r : e.length - r - 1];
39
+ }
40
+ return o;
41
+ }
42
+ export {
43
+ p as assertSize,
44
+ n as charCodeMap,
45
+ s as charCodeToBase16,
46
+ S as pad
47
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(n,a,y){let i="";if(y)for(const e of Object.entries(y)){if(!e)continue;let s="";for(const t of e[1])s+=`[${t.type}${t.name?`:${t.name}`:""}]`;i+=`(${e[0]}{${s}})`}return a?`${a}:${n}${i}`:n}const d=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);exports.getParameterCacheKey=r;exports.parameterCache=d;
@@ -0,0 +1,71 @@
1
+ function d(n, y, i) {
2
+ let a = "";
3
+ if (i)
4
+ for (const e of Object.entries(i)) {
5
+ if (!e)
6
+ continue;
7
+ let s = "";
8
+ for (const t of e[1])
9
+ s += `[${t.type}${t.name ? `:${t.name}` : ""}]`;
10
+ a += `(${e[0]}{${s}})`;
11
+ }
12
+ return y ? `${y}:${n}${a}` : n;
13
+ }
14
+ const p = /* @__PURE__ */ new Map([
15
+ // Unnamed
16
+ ["address", { type: "address" }],
17
+ ["bool", { type: "bool" }],
18
+ ["bytes", { type: "bytes" }],
19
+ ["bytes32", { type: "bytes32" }],
20
+ ["int", { type: "int256" }],
21
+ ["int256", { type: "int256" }],
22
+ ["string", { type: "string" }],
23
+ ["uint", { type: "uint256" }],
24
+ ["uint8", { type: "uint8" }],
25
+ ["uint16", { type: "uint16" }],
26
+ ["uint24", { type: "uint24" }],
27
+ ["uint32", { type: "uint32" }],
28
+ ["uint64", { type: "uint64" }],
29
+ ["uint96", { type: "uint96" }],
30
+ ["uint112", { type: "uint112" }],
31
+ ["uint160", { type: "uint160" }],
32
+ ["uint192", { type: "uint192" }],
33
+ ["uint256", { type: "uint256" }],
34
+ // Named
35
+ ["address owner", { type: "address", name: "owner" }],
36
+ ["address to", { type: "address", name: "to" }],
37
+ ["bool approved", { type: "bool", name: "approved" }],
38
+ ["bytes _data", { type: "bytes", name: "_data" }],
39
+ ["bytes data", { type: "bytes", name: "data" }],
40
+ ["bytes signature", { type: "bytes", name: "signature" }],
41
+ ["bytes32 hash", { type: "bytes32", name: "hash" }],
42
+ ["bytes32 r", { type: "bytes32", name: "r" }],
43
+ ["bytes32 root", { type: "bytes32", name: "root" }],
44
+ ["bytes32 s", { type: "bytes32", name: "s" }],
45
+ ["string name", { type: "string", name: "name" }],
46
+ ["string symbol", { type: "string", name: "symbol" }],
47
+ ["string tokenURI", { type: "string", name: "tokenURI" }],
48
+ ["uint tokenId", { type: "uint256", name: "tokenId" }],
49
+ ["uint8 v", { type: "uint8", name: "v" }],
50
+ ["uint256 balance", { type: "uint256", name: "balance" }],
51
+ ["uint256 tokenId", { type: "uint256", name: "tokenId" }],
52
+ ["uint256 value", { type: "uint256", name: "value" }],
53
+ // Indexed
54
+ [
55
+ "event:address indexed from",
56
+ { type: "address", name: "from", indexed: !0 }
57
+ ],
58
+ ["event:address indexed to", { type: "address", name: "to", indexed: !0 }],
59
+ [
60
+ "event:uint indexed tokenId",
61
+ { type: "uint256", name: "tokenId", indexed: !0 }
62
+ ],
63
+ [
64
+ "event:uint256 indexed tokenId",
65
+ { type: "uint256", name: "tokenId", indexed: !0 }
66
+ ]
67
+ ]);
68
+ export {
69
+ d as getParameterCacheKey,
70
+ p as parameterCache
71
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.1.1";exports.version=e;
@@ -0,0 +1,4 @@
1
+ const o = "0.1.1";
2
+ export {
3
+ o as version
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class i extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&t!==void 0&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const s=this.keys().next().value;s&&this.delete(s)}return this}}exports.LruMap=i;
@@ -0,0 +1,24 @@
1
+ class r extends Map {
2
+ constructor(e) {
3
+ super(), Object.defineProperty(this, "maxSize", {
4
+ enumerable: !0,
5
+ configurable: !0,
6
+ writable: !0,
7
+ value: void 0
8
+ }), this.maxSize = e;
9
+ }
10
+ get(e) {
11
+ const t = super.get(e);
12
+ return super.has(e) && t !== void 0 && (this.delete(e), super.set(e, t)), t;
13
+ }
14
+ set(e, t) {
15
+ if (super.set(e, t), this.maxSize && this.size > this.maxSize) {
16
+ const s = this.keys().next().value;
17
+ s && this.delete(s);
18
+ }
19
+ return this;
20
+ }
21
+ }
22
+ export {
23
+ r as LruMap
24
+ };
package/dist/index55.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index52.cjs"),j=require("./index222.cjs"),u=require("./index47.cjs"),l=require("./index277.cjs");function C(s,i={}){return{async request(h){var w;const{body:r,onRequest:o=i.onRequest,onResponse:p=i.onResponse,timeout:d=i.timeout??1e4}=h,f={...i.fetchOptions??{},...h.fetchOptions??{}},{headers:q,method:m,signal:T}=f;try{const t=await j.withTimeout(async({signal:a})=>{const c={...f,body:Array.isArray(r)?u.stringify(r.map(g=>({jsonrpc:"2.0",id:g.id??l.idCache.take(),...g}))):u.stringify({jsonrpc:"2.0",id:r.id??l.idCache.take(),...r}),headers:{"Content-Type":"application/json",...q},method:m||"POST",signal:T||(d>0?a:null)},R=new Request(s,c),y=await(o==null?void 0:o(R,c))??{...c,url:s};return await fetch(y.url??s,y)},{errorInstance:new n.TimeoutError({body:r,url:s}),timeout:d,signal:!0});p&&await p(t);let e;if((w=t.headers.get("Content-Type"))!=null&&w.startsWith("application/json"))e=await t.json();else{e=await t.text();try{e=JSON.parse(e||"{}")}catch(a){if(t.ok)throw a;e={error:e}}}if(!t.ok)throw new n.HttpRequestError({body:r,details:u.stringify(e.error)||t.statusText,headers:t.headers,status:t.status,url:s});return e}catch(t){throw t instanceof n.HttpRequestError||t instanceof n.TimeoutError?t:new n.HttpRequestError({body:r,cause:t,url:s})}}}}exports.getHttpRpcClient=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index52.cjs"),j=require("./index222.cjs"),u=require("./index47.cjs"),l=require("./index276.cjs");function C(s,i={}){return{async request(h){var w;const{body:r,onRequest:o=i.onRequest,onResponse:p=i.onResponse,timeout:d=i.timeout??1e4}=h,f={...i.fetchOptions??{},...h.fetchOptions??{}},{headers:q,method:m,signal:T}=f;try{const t=await j.withTimeout(async({signal:a})=>{const c={...f,body:Array.isArray(r)?u.stringify(r.map(g=>({jsonrpc:"2.0",id:g.id??l.idCache.take(),...g}))):u.stringify({jsonrpc:"2.0",id:r.id??l.idCache.take(),...r}),headers:{"Content-Type":"application/json",...q},method:m||"POST",signal:T||(d>0?a:null)},R=new Request(s,c),y=await(o==null?void 0:o(R,c))??{...c,url:s};return await fetch(y.url??s,y)},{errorInstance:new n.TimeoutError({body:r,url:s}),timeout:d,signal:!0});p&&await p(t);let e;if((w=t.headers.get("Content-Type"))!=null&&w.startsWith("application/json"))e=await t.json();else{e=await t.text();try{e=JSON.parse(e||"{}")}catch(a){if(t.ok)throw a;e={error:e}}}if(!t.ok)throw new n.HttpRequestError({body:r,details:u.stringify(e.error)||t.statusText,headers:t.headers,status:t.status,url:s});return e}catch(t){throw t instanceof n.HttpRequestError||t instanceof n.TimeoutError?t:new n.HttpRequestError({body:r,cause:t,url:s})}}}}exports.getHttpRpcClient=C;
package/dist/index55.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { TimeoutError as g, HttpRequestError as c } from "./index52.js";
2
2
  import { withTimeout as k } from "./index222.js";
3
3
  import { stringify as p } from "./index47.js";
4
- import { idCache as l } from "./index277.js";
4
+ import { idCache as l } from "./index276.js";
5
5
  function H(s, o = {}) {
6
6
  return {
7
7
  async request(h) {
package/dist/index58.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index22.cjs"),q=require("./index175.cjs"),R=require("./index182.cjs"),b=require("./index219.cjs"),m=require("./index167.cjs"),y=require("./index155.cjs"),C=require("./index234.cjs"),w=require("./index208.cjs"),i=require("./index158.cjs"),B=require("./index235.cjs"),T=require("./index32.cjs"),x=require("./index36.cjs");async function N(c,s){const{blockNumber:u,blockTag:v,coinType:n,name:r,gatewayUrls:g,strict:h}=s,{chain:t}=c,f=(()=>{if(s.universalResolverAddress)return s.universalResolverAddress;if(!t)throw new Error("client chain not configured. universalResolverAddress is required.");return b.getChainContractAddress({blockNumber:u,chain:t,contract:"ensUniversalResolver"})})(),d=t==null?void 0:t.ensTlds;if(d&&!d.some(e=>r.endsWith(e)))return null;try{const e=R.encodeFunctionData({abi:a.addressResolverAbi,functionName:"addr",...n!=null?{args:[i.namehash(r),BigInt(n)]}:{args:[i.namehash(r)]}}),A={address:f,abi:a.universalResolverResolveAbi,functionName:"resolve",args:[y.toHex(B.packetToBytes(r)),e,g??[w.localBatchGatewayUrl]],blockNumber:u,blockTag:v},l=await T.getAction(c,x.readContract,"readContract")(A);if(l[0]==="0x")return null;const o=q.decodeFunctionResult({abi:a.addressResolverAbi,args:n!=null?[i.namehash(r),BigInt(n)]:void 0,functionName:"addr",data:l[0]});return o==="0x"||m.trim(o)==="0x00"?null:o}catch(e){if(h)throw e;if(C.isNullUniversalResolverError(e,"resolve"))return null;throw e}}exports.getEnsAddress=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index22.cjs"),R=require("./index175.cjs"),b=require("./index182.cjs"),m=require("./index219.cjs"),y=require("./index167.cjs"),C=require("./index155.cjs"),w=require("./index234.cjs"),T=require("./index208.cjs"),v=require("./index158.cjs"),x=require("./index235.cjs"),B=require("./index32.cjs"),N=require("./index36.cjs");async function k(a,n){const{blockNumber:c,blockTag:f,coinType:i,name:t,gatewayUrls:h,strict:A}=n,{chain:r}=a,g=(()=>{if(n.universalResolverAddress)return n.universalResolverAddress;if(!r)throw new Error("client chain not configured. universalResolverAddress is required.");return m.getChainContractAddress({blockNumber:c,chain:r,contract:"ensUniversalResolver"})})(),u=r==null?void 0:r.ensTlds;if(u&&!u.some(e=>t.endsWith(e)))return null;const d=i!=null?[v.namehash(t),BigInt(i)]:[v.namehash(t)];try{const e=b.encodeFunctionData({abi:o.addressResolverAbi,functionName:"addr",args:d}),q={address:g,abi:o.universalResolverResolveAbi,functionName:"resolveWithGateways",args:[C.toHex(x.packetToBytes(t)),e,h??[T.localBatchGatewayUrl]],blockNumber:c,blockTag:f},l=await B.getAction(a,N.readContract,"readContract")(q);if(l[0]==="0x")return null;const s=R.decodeFunctionResult({abi:o.addressResolverAbi,args:d,functionName:"addr",data:l[0]});return s==="0x"||y.trim(s)==="0x00"?null:s}catch(e){if(A)throw e;if(w.isNullUniversalResolverError(e))return null;throw e}}exports.getEnsAddress=k;
package/dist/index58.js CHANGED
@@ -1,63 +1,64 @@
1
- import { addressResolverAbi as u, universalResolverResolveAbi as A } from "./index22.js";
2
- import { decodeFunctionResult as R } from "./index175.js";
3
- import { encodeFunctionData as h } from "./index182.js";
4
- import { getChainContractAddress as b } from "./index219.js";
5
- import { trim as w } from "./index167.js";
1
+ import { addressResolverAbi as u, universalResolverResolveAbi as R } from "./index22.js";
2
+ import { decodeFunctionResult as g } from "./index175.js";
3
+ import { encodeFunctionData as b } from "./index182.js";
4
+ import { getChainContractAddress as w } from "./index219.js";
5
+ import { trim as y } from "./index167.js";
6
6
  import { toHex as C } from "./index155.js";
7
- import { isNullUniversalResolverError as y } from "./index234.js";
8
- import { localBatchGatewayUrl as x } from "./index208.js";
9
- import { namehash as i } from "./index158.js";
10
- import { packetToBytes as N } from "./index235.js";
11
- import { getAction as B } from "./index32.js";
12
- import { readContract as T } from "./index36.js";
13
- async function J(a, n) {
14
- const { blockNumber: l, blockTag: m, coinType: o, name: e, gatewayUrls: f, strict: v } = n, { chain: t } = a, p = (() => {
15
- if (n.universalResolverAddress)
16
- return n.universalResolverAddress;
7
+ import { isNullUniversalResolverError as x } from "./index234.js";
8
+ import { localBatchGatewayUrl as N } from "./index208.js";
9
+ import { namehash as m } from "./index158.js";
10
+ import { packetToBytes as T } from "./index235.js";
11
+ import { getAction as U } from "./index32.js";
12
+ import { readContract as k } from "./index36.js";
13
+ async function K(s, o) {
14
+ const { blockNumber: i, blockTag: f, coinType: a, name: e, gatewayUrls: v, strict: p } = o, { chain: t } = s, A = (() => {
15
+ if (o.universalResolverAddress)
16
+ return o.universalResolverAddress;
17
17
  if (!t)
18
18
  throw new Error("client chain not configured. universalResolverAddress is required.");
19
- return b({
20
- blockNumber: l,
19
+ return w({
20
+ blockNumber: i,
21
21
  chain: t,
22
22
  contract: "ensUniversalResolver"
23
23
  });
24
24
  })(), c = t == null ? void 0 : t.ensTlds;
25
25
  if (c && !c.some((r) => e.endsWith(r)))
26
26
  return null;
27
+ const l = a != null ? [m(e), BigInt(a)] : [m(e)];
27
28
  try {
28
- const r = h({
29
+ const r = b({
29
30
  abi: u,
30
31
  functionName: "addr",
31
- ...o != null ? { args: [i(e), BigInt(o)] } : { args: [i(e)] }
32
- }), g = {
33
- address: p,
34
- abi: A,
35
- functionName: "resolve",
32
+ args: l
33
+ }), h = {
34
+ address: A,
35
+ abi: R,
36
+ functionName: "resolveWithGateways",
36
37
  args: [
37
- C(N(e)),
38
+ C(T(e)),
38
39
  r,
39
- f ?? [x]
40
+ v ?? [N]
40
41
  ],
41
- blockNumber: l,
42
- blockTag: m
43
- }, d = await B(a, T, "readContract")(g);
42
+ blockNumber: i,
43
+ blockTag: f
44
+ }, d = await U(s, k, "readContract")(h);
44
45
  if (d[0] === "0x")
45
46
  return null;
46
- const s = R({
47
+ const n = g({
47
48
  abi: u,
48
- args: o != null ? [i(e), BigInt(o)] : void 0,
49
+ args: l,
49
50
  functionName: "addr",
50
51
  data: d[0]
51
52
  });
52
- return s === "0x" || w(s) === "0x00" ? null : s;
53
+ return n === "0x" || y(n) === "0x00" ? null : n;
53
54
  } catch (r) {
54
- if (v)
55
+ if (p)
55
56
  throw r;
56
- if (y(r, "resolve"))
57
+ if (x(r))
57
58
  return null;
58
59
  throw r;
59
60
  }
60
61
  }
61
62
  export {
62
- J as getEnsAddress
63
+ K as getEnsAddress
63
64
  };
package/dist/index60.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index22.cjs"),C=require("./index219.cjs"),h=require("./index155.cjs"),A=require("./index234.cjs"),f=require("./index235.cjs"),q=require("./index32.cjs"),w=require("./index36.cjs");async function R(r,{address:s,blockNumber:n,blockTag:i,gatewayUrls:o,strict:c,universalResolverAddress:d}){let t=d;if(!t){if(!r.chain)throw new Error("client chain not configured. universalResolverAddress is required.");t=C.getChainContractAddress({blockNumber:n,chain:r.chain,contract:"ensUniversalResolver"})}const u=`${s.toLowerCase().substring(2)}.addr.reverse`;try{const e={address:t,abi:g.universalResolverReverseAbi,functionName:"reverse",args:[h.toHex(f.packetToBytes(u))],blockNumber:n,blockTag:i},a=q.getAction(r,w.readContract,"readContract"),[l,v]=o?await a({...e,args:[...e.args,o]}):await a(e);return s.toLowerCase()!==v.toLowerCase()?null:l}catch(e){if(c)throw e;if(A.isNullUniversalResolverError(e,"reverse"))return null;throw e}}exports.getEnsName=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index22.cjs"),h=require("./index219.cjs"),A=require("./index234.cjs"),w=require("./index208.cjs"),y=require("./index32.cjs"),C=require("./index36.cjs");async function R(t,r){const{address:a,blockNumber:s,blockTag:o,coinType:c=60n,gatewayUrls:i,strict:l}=r,{chain:n}=t,u=(()=>{if(r.universalResolverAddress)return r.universalResolverAddress;if(!n)throw new Error("client chain not configured. universalResolverAddress is required.");return h.getChainContractAddress({blockNumber:s,chain:n,contract:"ensUniversalResolver"})})();try{const e={address:u,abi:g.universalResolverReverseAbi,args:[a,c,i??[w.localBatchGatewayUrl]],functionName:"reverseWithGateways",blockNumber:s,blockTag:o},d=y.getAction(t,C.readContract,"readContract"),[v]=await d(e);return v||null}catch(e){if(l)throw e;if(A.isNullUniversalResolverError(e))return null;throw e}}exports.getEnsName=R;
package/dist/index60.js CHANGED
@@ -1,43 +1,39 @@
1
- import { universalResolverReverseAbi as f } from "./index22.js";
2
- import { getChainContractAddress as u } from "./index219.js";
3
- import { toHex as h } from "./index155.js";
4
- import { isNullUniversalResolverError as p } from "./index234.js";
5
- import { packetToBytes as C } from "./index235.js";
6
- import { getAction as w } from "./index32.js";
7
- import { readContract as A } from "./index36.js";
8
- async function b(e, { address: t, blockNumber: s, blockTag: i, gatewayUrls: a, strict: c, universalResolverAddress: d }) {
9
- let o = d;
10
- if (!o) {
11
- if (!e.chain)
1
+ import { universalResolverReverseAbi as m } from "./index22.js";
2
+ import { getChainContractAddress as f } from "./index219.js";
3
+ import { isNullUniversalResolverError as h } from "./index234.js";
4
+ import { localBatchGatewayUrl as w } from "./index208.js";
5
+ import { getAction as A } from "./index32.js";
6
+ import { readContract as R } from "./index36.js";
7
+ async function U(t, e) {
8
+ const { address: n, blockNumber: o, blockTag: a, coinType: i = 60n, gatewayUrls: c, strict: l } = e, { chain: s } = t, d = (() => {
9
+ if (e.universalResolverAddress)
10
+ return e.universalResolverAddress;
11
+ if (!s)
12
12
  throw new Error("client chain not configured. universalResolverAddress is required.");
13
- o = u({
14
- blockNumber: s,
15
- chain: e.chain,
13
+ return f({
14
+ blockNumber: o,
15
+ chain: s,
16
16
  contract: "ensUniversalResolver"
17
17
  });
18
- }
19
- const v = `${t.toLowerCase().substring(2)}.addr.reverse`;
18
+ })();
20
19
  try {
21
20
  const r = {
22
- address: o,
23
- abi: f,
24
- functionName: "reverse",
25
- args: [h(C(v))],
26
- blockNumber: s,
27
- blockTag: i
28
- }, n = w(e, A, "readContract"), [l, m] = a ? await n({
29
- ...r,
30
- args: [...r.args, a]
31
- }) : await n(r);
32
- return t.toLowerCase() !== m.toLowerCase() ? null : l;
21
+ address: d,
22
+ abi: m,
23
+ args: [n, i, c ?? [w]],
24
+ functionName: "reverseWithGateways",
25
+ blockNumber: o,
26
+ blockTag: a
27
+ }, u = A(t, R, "readContract"), [v] = await u(r);
28
+ return v || null;
33
29
  } catch (r) {
34
- if (c)
30
+ if (l)
35
31
  throw r;
36
- if (p(r, "reverse"))
32
+ if (h(r))
37
33
  return null;
38
34
  throw r;
39
35
  }
40
36
  }
41
37
  export {
42
- b as getEnsName
38
+ U as getEnsName
43
39
  };
package/dist/index61.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index219.cjs"),l=require("./index155.cjs"),v=require("./index235.cjs"),y=require("./index32.cjs"),f=require("./index36.cjs");async function g(n,t){const{blockNumber:o,blockTag:i,name:s}=t,{chain:e}=n,a=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!e)throw new Error("client chain not configured. universalResolverAddress is required.");return u.getChainContractAddress({blockNumber:o,chain:e,contract:"ensUniversalResolver"})})(),r=e==null?void 0:e.ensTlds;if(r&&!r.some(d=>s.endsWith(d)))throw new Error(`${s} is not a valid ENS TLD (${r==null?void 0:r.join(", ")}) for chain "${e.name}" (id: ${e.id}).`);const[c]=await y.getAction(n,f.readContract,"readContract")({address:a,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[l.toHex(v.packetToBytes(s))],blockNumber:o,blockTag:i});return c}exports.getEnsResolver=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index219.cjs"),l=require("./index155.cjs"),v=require("./index235.cjs"),y=require("./index32.cjs"),f=require("./index36.cjs");async function g(n,r){const{blockNumber:o,blockTag:i,name:s}=r,{chain:e}=n,a=(()=>{if(r.universalResolverAddress)return r.universalResolverAddress;if(!e)throw new Error("client chain not configured. universalResolverAddress is required.");return u.getChainContractAddress({blockNumber:o,chain:e,contract:"ensUniversalResolver"})})(),t=e==null?void 0:e.ensTlds;if(t&&!t.some(d=>s.endsWith(d)))throw new Error(`${s} is not a valid ENS TLD (${t==null?void 0:t.join(", ")}) for chain "${e.name}" (id: ${e.id}).`);const[c]=await y.getAction(n,f.readContract,"readContract")({address:a,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[l.toHex(v.packetToBytes(s))],blockNumber:o,blockTag:i});return c}exports.getEnsResolver=g;
package/dist/index61.js CHANGED
@@ -3,10 +3,10 @@ import { toHex as u } from "./index155.js";
3
3
  import { packetToBytes as v } from "./index235.js";
4
4
  import { getAction as f } from "./index32.js";
5
5
  import { readContract as m } from "./index36.js";
6
- async function g(t, o) {
7
- const { blockNumber: n, blockTag: i, name: s } = o, { chain: e } = t, a = (() => {
8
- if (o.universalResolverAddress)
9
- return o.universalResolverAddress;
6
+ async function g(s, t) {
7
+ const { blockNumber: n, blockTag: i, name: o } = t, { chain: e } = s, a = (() => {
8
+ if (t.universalResolverAddress)
9
+ return t.universalResolverAddress;
10
10
  if (!e)
11
11
  throw new Error("client chain not configured. universalResolverAddress is required.");
12
12
  return l({
@@ -15,21 +15,25 @@ async function g(t, o) {
15
15
  contract: "ensUniversalResolver"
16
16
  });
17
17
  })(), r = e == null ? void 0 : e.ensTlds;
18
- if (r && !r.some((c) => s.endsWith(c)))
19
- throw new Error(`${s} is not a valid ENS TLD (${r == null ? void 0 : r.join(", ")}) for chain "${e.name}" (id: ${e.id}).`);
20
- const [d] = await f(t, m, "readContract")({
18
+ if (r && !r.some((c) => o.endsWith(c)))
19
+ throw new Error(`${o} is not a valid ENS TLD (${r == null ? void 0 : r.join(", ")}) for chain "${e.name}" (id: ${e.id}).`);
20
+ const [d] = await f(s, m, "readContract")({
21
21
  address: a,
22
22
  abi: [
23
23
  {
24
24
  inputs: [{ type: "bytes" }],
25
25
  name: "findResolver",
26
- outputs: [{ type: "address" }, { type: "bytes32" }],
26
+ outputs: [
27
+ { type: "address" },
28
+ { type: "bytes32" },
29
+ { type: "uint256" }
30
+ ],
27
31
  stateMutability: "view",
28
32
  type: "function"
29
33
  }
30
34
  ],
31
35
  functionName: "findResolver",
32
- args: [u(v(s))],
36
+ args: [u(v(o))],
33
37
  blockNumber: n,
34
38
  blockTag: i
35
39
  });
package/dist/index62.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index22.cjs"),q=require("./index175.cjs"),A=require("./index182.cjs"),R=require("./index219.cjs"),b=require("./index155.cjs"),f=require("./index234.cjs"),y=require("./index208.cjs"),C=require("./index158.cjs"),x=require("./index235.cjs"),m=require("./index32.cjs"),w=require("./index36.cjs");async function T(s,r){const{blockNumber:a,blockTag:u,key:d,name:n,gatewayUrls:v,strict:g}=r,{chain:t}=s,h=(()=>{if(r.universalResolverAddress)return r.universalResolverAddress;if(!t)throw new Error("client chain not configured. universalResolverAddress is required.");return R.getChainContractAddress({blockNumber:a,chain:t,contract:"ensUniversalResolver"})})(),c=t==null?void 0:t.ensTlds;if(c&&!c.some(e=>n.endsWith(e)))return null;try{const e={address:h,abi:o.universalResolverResolveAbi,functionName:"resolve",args:[b.toHex(x.packetToBytes(n)),A.encodeFunctionData({abi:o.textResolverAbi,functionName:"text",args:[C.namehash(n),d]}),v??[y.localBatchGatewayUrl]],blockNumber:a,blockTag:u},i=await m.getAction(s,w.readContract,"readContract")(e);if(i[0]==="0x")return null;const l=q.decodeFunctionResult({abi:o.textResolverAbi,functionName:"text",data:i[0]});return l===""?null:l}catch(e){if(g)throw e;if(f.isNullUniversalResolverError(e,"resolve"))return null;throw e}}exports.getEnsText=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index22.cjs"),q=require("./index175.cjs"),A=require("./index182.cjs"),R=require("./index219.cjs"),b=require("./index155.cjs"),f=require("./index234.cjs"),y=require("./index208.cjs"),C=require("./index158.cjs"),w=require("./index235.cjs"),x=require("./index32.cjs"),m=require("./index36.cjs");async function T(o,r){const{blockNumber:a,blockTag:l,key:d,name:n,gatewayUrls:v,strict:h}=r,{chain:t}=o,g=(()=>{if(r.universalResolverAddress)return r.universalResolverAddress;if(!t)throw new Error("client chain not configured. universalResolverAddress is required.");return R.getChainContractAddress({blockNumber:a,chain:t,contract:"ensUniversalResolver"})})(),c=t==null?void 0:t.ensTlds;if(c&&!c.some(e=>n.endsWith(e)))return null;try{const e={address:g,abi:s.universalResolverResolveAbi,args:[b.toHex(w.packetToBytes(n)),A.encodeFunctionData({abi:s.textResolverAbi,functionName:"text",args:[C.namehash(n),d]}),v??[y.localBatchGatewayUrl]],functionName:"resolveWithGateways",blockNumber:a,blockTag:l},i=await x.getAction(o,m.readContract,"readContract")(e);if(i[0]==="0x")return null;const u=q.decodeFunctionResult({abi:s.textResolverAbi,functionName:"text",data:i[0]});return u===""?null:u}catch(e){if(h)throw e;if(f.isNullUniversalResolverError(e))return null;throw e}}exports.getEnsText=T;
package/dist/index62.js CHANGED
@@ -1,48 +1,48 @@
1
1
  import { textResolverAbi as l, universalResolverResolveAbi as p } from "./index22.js";
2
- import { decodeFunctionResult as A } from "./index175.js";
3
- import { encodeFunctionData as R } from "./index182.js";
4
- import { getChainContractAddress as h } from "./index219.js";
2
+ import { decodeFunctionResult as h } from "./index175.js";
3
+ import { encodeFunctionData as A } from "./index182.js";
4
+ import { getChainContractAddress as R } from "./index219.js";
5
5
  import { toHex as b } from "./index155.js";
6
6
  import { isNullUniversalResolverError as g } from "./index234.js";
7
7
  import { localBatchGatewayUrl as w } from "./index208.js";
8
8
  import { namehash as x } from "./index158.js";
9
- import { packetToBytes as C } from "./index235.js";
10
- import { getAction as y } from "./index32.js";
9
+ import { packetToBytes as y } from "./index235.js";
10
+ import { getAction as C } from "./index32.js";
11
11
  import { readContract as N } from "./index36.js";
12
- async function j(n, t) {
13
- const { blockNumber: s, blockTag: m, key: d, name: o, gatewayUrls: u, strict: f } = t, { chain: e } = n, v = (() => {
14
- if (t.universalResolverAddress)
15
- return t.universalResolverAddress;
16
- if (!e)
12
+ async function j(n, e) {
13
+ const { blockNumber: s, blockTag: m, key: d, name: o, gatewayUrls: u, strict: f } = e, { chain: t } = n, v = (() => {
14
+ if (e.universalResolverAddress)
15
+ return e.universalResolverAddress;
16
+ if (!t)
17
17
  throw new Error("client chain not configured. universalResolverAddress is required.");
18
- return h({
18
+ return R({
19
19
  blockNumber: s,
20
- chain: e,
20
+ chain: t,
21
21
  contract: "ensUniversalResolver"
22
22
  });
23
- })(), a = e == null ? void 0 : e.ensTlds;
23
+ })(), a = t == null ? void 0 : t.ensTlds;
24
24
  if (a && !a.some((r) => o.endsWith(r)))
25
25
  return null;
26
26
  try {
27
27
  const r = {
28
28
  address: v,
29
29
  abi: p,
30
- functionName: "resolve",
31
30
  args: [
32
- b(C(o)),
33
- R({
31
+ b(y(o)),
32
+ A({
34
33
  abi: l,
35
34
  functionName: "text",
36
35
  args: [x(o), d]
37
36
  }),
38
37
  u ?? [w]
39
38
  ],
39
+ functionName: "resolveWithGateways",
40
40
  blockNumber: s,
41
41
  blockTag: m
42
- }, i = await y(n, N, "readContract")(r);
42
+ }, i = await C(n, N, "readContract")(r);
43
43
  if (i[0] === "0x")
44
44
  return null;
45
- const c = A({
45
+ const c = h({
46
46
  abi: l,
47
47
  functionName: "text",
48
48
  data: i[0]
@@ -51,7 +51,7 @@ async function j(n, t) {
51
51
  } catch (r) {
52
52
  if (f)
53
53
  throw r;
54
- if (g(r, "resolve"))
54
+ if (g(r))
55
55
  return null;
56
56
  throw r;
57
57
  }
package/dist/index89.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./index22.cjs"),v=require("./index127.cjs"),_=require("./index41.cjs"),x=require("./index132.cjs"),O=require("./index175.cjs"),T=require("./index182.cjs"),B=require("./index219.cjs"),j=require("./index225.cjs"),M=require("./index32.cjs"),Z=require("./index36.cjs");async function $(l,m){var D;const{account:w,allowFailure:u=!0,batchSize:k,blockNumber:C,blockTag:p,multicallAddress:z,stateOverride:R}=m,d=m.contracts,q=k??(typeof((D=l.batch)==null?void 0:D.multicall)=="object"&&l.batch.multicall.batchSize||1024);let g=z;if(!g){if(!l.chain)throw new Error("client chain not configured. multicallAddress is required.");g=B.getChainContractAddress({blockNumber:C,chain:l.chain,contract:"multicall3"})}const r=[[]];let a=0,f=0;for(let t=0;t<d.length;t++){const{abi:c,address:s,args:e,functionName:i}=d[t];try{const n=T.encodeFunctionData({abi:c,args:e,functionName:i});f+=(n.length-2)/2,q>0&&f>q&&r[a].length>0&&(a++,f=(n.length-2)/2,r[a]=[]),r[a]=[...r[a],{allowFailure:!0,callData:n,target:s}]}catch(n){const b=j.getContractError(n,{abi:c,address:s,args:e,docsPath:"/docs/contract/multicall",functionName:i,sender:w});if(!u)throw b;r[a]=[...r[a],{allowFailure:!0,callData:"0x",target:s}]}}const A=await Promise.allSettled(r.map(t=>M.getAction(l,Z.readContract,"readContract")({abi:P.multicall3Abi,account:w,address:g,args:[t],blockNumber:C,blockTag:p,functionName:"aggregate3",stateOverride:R}))),o=[];for(let t=0;t<A.length;t++){const c=A[t];if(c.status==="rejected"){if(!u)throw c.reason;for(let e=0;e<r[t].length;e++)o.push({status:"failure",error:c.reason,result:void 0});continue}const s=c.value;for(let e=0;e<s.length;e++){const{returnData:i,success:n}=s[e],{callData:b}=r[t][e],{abi:S,address:N,functionName:E,args:F}=d[o.length];try{if(b==="0x")throw new v.AbiDecodingZeroDataError;if(!n)throw new x.RawContractError({data:i});const h=O.decodeFunctionResult({abi:S,args:F,data:i,functionName:E});o.push(u?{result:h,status:"success"}:h)}catch(h){const y=j.getContractError(h,{abi:S,address:N,args:F,docsPath:"/docs/contract/multicall",functionName:E});if(!u)throw y;o.push({error:y,result:void 0,status:"failure"})}}}if(o.length!==d.length)throw new _.BaseError("multicall results mismatch");return o}exports.multicall=$;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index22.cjs"),_=require("./index127.cjs"),x=require("./index41.cjs"),O=require("./index132.cjs"),T=require("./index175.cjs"),B=require("./index182.cjs"),L=require("./index219.cjs"),z=require("./index225.cjs"),M=require("./index32.cjs"),Z=require("./index36.cjs");async function $(l,m){var D;const{account:w,authorizationList:j,allowFailure:u=!0,batchSize:k,blockNumber:C,blockTag:p,multicallAddress:R,stateOverride:N}=m,d=m.contracts,q=k??(typeof((D=l.batch)==null?void 0:D.multicall)=="object"&&l.batch.multicall.batchSize||1024);let g=R;if(!g){if(!l.chain)throw new Error("client chain not configured. multicallAddress is required.");g=L.getChainContractAddress({blockNumber:C,chain:l.chain,contract:"multicall3"})}const r=[[]];let a=0,f=0;for(let t=0;t<d.length;t++){const{abi:c,address:s,args:e,functionName:i}=d[t];try{const n=B.encodeFunctionData({abi:c,args:e,functionName:i});f+=(n.length-2)/2,q>0&&f>q&&r[a].length>0&&(a++,f=(n.length-2)/2,r[a]=[]),r[a]=[...r[a],{allowFailure:!0,callData:n,target:s}]}catch(n){const b=z.getContractError(n,{abi:c,address:s,args:e,docsPath:"/docs/contract/multicall",functionName:i,sender:w});if(!u)throw b;r[a]=[...r[a],{allowFailure:!0,callData:"0x",target:s}]}}const A=await Promise.allSettled(r.map(t=>M.getAction(l,Z.readContract,"readContract")({abi:v.multicall3Abi,account:w,address:g,args:[t],authorizationList:j,blockNumber:C,blockTag:p,functionName:"aggregate3",stateOverride:N}))),o=[];for(let t=0;t<A.length;t++){const c=A[t];if(c.status==="rejected"){if(!u)throw c.reason;for(let e=0;e<r[t].length;e++)o.push({status:"failure",error:c.reason,result:void 0});continue}const s=c.value;for(let e=0;e<s.length;e++){const{returnData:i,success:n}=s[e],{callData:b}=r[t][e],{abi:S,address:P,functionName:E,args:F}=d[o.length];try{if(b==="0x")throw new _.AbiDecodingZeroDataError;if(!n)throw new O.RawContractError({data:i});const h=T.decodeFunctionResult({abi:S,args:F,data:i,functionName:E});o.push(u?{result:h,status:"success"}:h)}catch(h){const y=z.getContractError(h,{abi:S,address:P,args:F,docsPath:"/docs/contract/multicall",functionName:E});if(!u)throw y;o.push({error:y,result:void 0,status:"failure"})}}}if(o.length!==d.length)throw new x.BaseError("multicall results mismatch");return o}exports.multicall=$;