@coinbase/cdp-hooks 0.0.96 → 0.0.97

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 (282) hide show
  1. package/dist/esm/index100.js +35 -25
  2. package/dist/esm/index101.js +9 -46
  3. package/dist/esm/index102.js +31 -69
  4. package/dist/esm/index103.js +36 -40
  5. package/dist/esm/index104.js +9 -75
  6. package/dist/esm/index105.js +25 -27
  7. package/dist/esm/index106.js +46 -6
  8. package/dist/esm/index107.js +69 -16
  9. package/dist/esm/index108.js +40 -8
  10. package/dist/esm/index109.js +75 -13
  11. package/dist/esm/index110.js +31 -7
  12. package/dist/esm/index111.js +6 -9
  13. package/dist/esm/index112.js +16 -16
  14. package/dist/esm/index113.js +8 -12
  15. package/dist/esm/index114.js +13 -46
  16. package/dist/esm/index115.js +7 -13
  17. package/dist/esm/index116.js +9 -16
  18. package/dist/esm/index117.js +16 -13
  19. package/dist/esm/index118.js +11 -5
  20. package/dist/esm/index119.js +46 -35
  21. package/dist/esm/index120.js +13 -9
  22. package/dist/esm/index121.js +15 -7
  23. package/dist/esm/index122.js +13 -28
  24. package/dist/esm/index123.js +6 -10
  25. package/dist/esm/index124.js +32 -11
  26. package/dist/esm/index125.js +9 -11
  27. package/dist/esm/index126.js +8 -120
  28. package/dist/esm/index127.js +27 -32
  29. package/dist/esm/index128.js +10 -80
  30. package/dist/esm/index129.js +13 -176
  31. package/dist/esm/index130.js +11 -44
  32. package/dist/esm/index131.js +120 -6
  33. package/dist/esm/index132.js +30 -151
  34. package/dist/esm/index133.js +80 -14
  35. package/dist/esm/index134.js +177 -14
  36. package/dist/esm/index135.js +42 -97
  37. package/dist/esm/index136.js +6 -72
  38. package/dist/esm/index137.js +153 -86
  39. package/dist/esm/index138.js +14 -148
  40. package/dist/esm/index139.js +14 -136
  41. package/dist/esm/index140.js +94 -63
  42. package/dist/esm/index141.js +72 -23
  43. package/dist/esm/index142.js +83 -154
  44. package/dist/esm/index143.js +148 -6
  45. package/dist/esm/index144.js +136 -11
  46. package/dist/esm/index145.js +68 -19
  47. package/dist/esm/index146.js +23 -135
  48. package/dist/esm/index147.js +155 -75
  49. package/dist/esm/index148.js +6 -9
  50. package/dist/esm/index149.js +11 -28
  51. package/dist/esm/index150.js +17 -87
  52. package/dist/esm/index151.js +135 -350
  53. package/dist/esm/index152.js +79 -3
  54. package/dist/esm/index153.js +10 -5
  55. package/dist/esm/index154.js +29 -2
  56. package/dist/esm/index155.js +90 -3
  57. package/dist/esm/index156.js +351 -9
  58. package/dist/esm/index157.js +3 -327
  59. package/dist/esm/index158.js +5 -14
  60. package/dist/esm/index159.js +2 -5
  61. package/dist/esm/index160.js +3 -56
  62. package/dist/esm/index161.js +9 -13
  63. package/dist/esm/index162.js +327 -2
  64. package/dist/esm/index163.js +13 -7
  65. package/dist/esm/index164.js +4 -30
  66. package/dist/esm/index165.js +29 -188
  67. package/dist/esm/index166.js +13 -32
  68. package/dist/esm/index167.js +2 -22
  69. package/dist/esm/index168.js +7 -5
  70. package/dist/esm/index169.js +25 -68
  71. package/dist/esm/index170.js +214 -5
  72. package/dist/esm/index171.js +32 -6
  73. package/dist/esm/index172.js +20 -34
  74. package/dist/esm/index173.js +5 -119
  75. package/dist/esm/index174.js +74 -3
  76. package/dist/esm/index175.js +5 -18
  77. package/dist/esm/index176.js +5 -26
  78. package/dist/esm/index177.js +28 -26
  79. package/dist/esm/index178.js +105 -20
  80. package/dist/esm/index179.js +3 -24
  81. package/dist/esm/index180.js +17 -7
  82. package/dist/esm/index181.js +18 -185
  83. package/dist/esm/index182.js +34 -2
  84. package/dist/esm/index183.js +28 -461
  85. package/dist/esm/index184.js +16 -20
  86. package/dist/esm/index185.js +6 -158
  87. package/dist/esm/index186.js +193 -21
  88. package/dist/esm/index187.js +2 -128
  89. package/dist/esm/index188.js +467 -38
  90. package/dist/esm/index189.js +27 -6
  91. package/dist/esm/index190.js +160 -27
  92. package/dist/esm/index191.js +20 -54
  93. package/dist/esm/index192.js +126 -44
  94. package/dist/esm/index193.js +31 -184
  95. package/dist/esm/index194.js +7 -4
  96. package/dist/esm/index195.js +26 -72
  97. package/dist/esm/index196.js +52 -17
  98. package/dist/esm/index197.js +46 -3
  99. package/dist/esm/index198.js +188 -13
  100. package/dist/esm/index199.js +4 -24
  101. package/dist/esm/index200.js +73 -11
  102. package/dist/esm/index201.js +18 -16
  103. package/dist/esm/index202.js +3 -35
  104. package/dist/esm/index203.js +17 -3
  105. package/dist/esm/index204.js +23 -18
  106. package/dist/esm/index205.js +11 -27
  107. package/dist/esm/index206.js +17 -34
  108. package/dist/esm/index207.js +34 -8
  109. package/dist/esm/index208.js +3 -8
  110. package/dist/esm/index209.js +18 -25
  111. package/dist/esm/index210.js +26 -27
  112. package/dist/esm/index211.js +35 -3
  113. package/dist/esm/index212.js +8 -79
  114. package/dist/esm/index213.js +7 -9
  115. package/dist/esm/index214.js +23 -10
  116. package/dist/esm/index215.js +27 -20
  117. package/dist/esm/index216.js +3 -8
  118. package/dist/esm/index217.js +78 -9
  119. package/dist/esm/index218.js +9 -11
  120. package/dist/esm/index219.js +12 -6
  121. package/dist/esm/index220.js +21 -6
  122. package/dist/esm/index221.js +8 -13
  123. package/dist/esm/index222.js +9 -31
  124. package/dist/esm/index223.js +12 -5
  125. package/dist/esm/index224.js +6 -37
  126. package/dist/esm/index225.js +6 -110
  127. package/dist/esm/index226.js +12 -47
  128. package/dist/esm/index227.js +31 -31
  129. package/dist/esm/index228.js +5 -18
  130. package/dist/esm/index229.js +35 -17
  131. package/dist/esm/index230.js +108 -40
  132. package/dist/esm/index231.js +46 -40
  133. package/dist/esm/index232.js +32 -8
  134. package/dist/esm/index233.js +17 -7
  135. package/dist/esm/index234.js +19 -16
  136. package/dist/esm/index235.js +42 -22
  137. package/dist/esm/index236.js +40 -22
  138. package/dist/esm/index237.js +8 -16
  139. package/dist/esm/index238.js +7 -54
  140. package/dist/esm/index239.js +16 -27
  141. package/dist/esm/index240.js +22 -24
  142. package/dist/esm/index241.js +24 -104
  143. package/dist/esm/index242.js +17 -3
  144. package/dist/esm/index243.js +54 -5
  145. package/dist/esm/index244.js +26 -30
  146. package/dist/esm/index245.js +24 -20
  147. package/dist/esm/index246.js +104 -3
  148. package/dist/esm/index247.js +3 -18
  149. package/dist/esm/index248.js +5 -5
  150. package/dist/esm/index249.js +31 -8
  151. package/dist/esm/index250.js +19 -102
  152. package/dist/esm/index251.js +3 -64
  153. package/dist/esm/index252.js +17 -5
  154. package/dist/esm/index253.js +5 -6
  155. package/dist/esm/index254.js +8 -27
  156. package/dist/esm/index255.js +103 -33
  157. package/dist/esm/index256.js +64 -13
  158. package/dist/esm/index257.js +5 -16
  159. package/dist/esm/index258.js +6 -78
  160. package/dist/esm/index259.js +28 -2
  161. package/dist/esm/index260.js +33 -14
  162. package/dist/esm/index261.js +13 -18
  163. package/dist/esm/index262.js +16 -171
  164. package/dist/esm/index263.js +77 -16
  165. package/dist/esm/index264.js +2 -11
  166. package/dist/esm/index265.js +15 -10
  167. package/dist/esm/index266.js +18 -38
  168. package/dist/esm/index267.js +172 -2
  169. package/dist/esm/index268.js +17 -69
  170. package/dist/esm/index269.js +10 -34
  171. package/dist/esm/index270.js +10 -15
  172. package/dist/esm/index271.js +2 -41
  173. package/dist/esm/index272.js +41 -2
  174. package/dist/esm/index273.js +2 -5
  175. package/dist/esm/index274.js +4 -10
  176. package/dist/esm/index275.js +9 -18
  177. package/dist/esm/index276.js +19 -7
  178. package/dist/esm/index277.js +7 -11
  179. package/dist/esm/index278.js +11 -72
  180. package/dist/esm/index279.js +71 -64
  181. package/dist/esm/index280.js +60 -182
  182. package/dist/esm/index281.js +185 -20
  183. package/dist/esm/index282.js +21 -41
  184. package/dist/esm/index283.js +41 -24
  185. package/dist/esm/index284.js +24 -89
  186. package/dist/esm/index285.js +68 -18
  187. package/dist/esm/index286.js +34 -10
  188. package/dist/esm/index287.js +10 -7
  189. package/dist/esm/index288.js +13 -7
  190. package/dist/esm/index289.js +7 -6
  191. package/dist/esm/index290.js +6 -36
  192. package/dist/esm/index291.js +35 -14
  193. package/dist/esm/index292.js +15 -8
  194. package/dist/esm/index293.js +8 -8
  195. package/dist/esm/index294.js +8 -16
  196. package/dist/esm/index295.js +15 -21
  197. package/dist/esm/index296.js +22 -30
  198. package/dist/esm/index297.js +31 -2
  199. package/dist/esm/index298.js +2 -14
  200. package/dist/esm/index299.js +13 -12
  201. package/dist/esm/index3.js +1 -1
  202. package/dist/esm/index300.js +10 -45
  203. package/dist/esm/index301.js +47 -9
  204. package/dist/esm/index302.js +8 -12
  205. package/dist/esm/index303.js +10 -10
  206. package/dist/esm/index304.js +13 -14
  207. package/dist/esm/index305.js +14 -8
  208. package/dist/esm/index306.js +6 -13
  209. package/dist/esm/index307.js +15 -24
  210. package/dist/esm/index308.js +24 -24
  211. package/dist/esm/index309.js +20 -27
  212. package/dist/esm/index310.js +31 -9
  213. package/dist/esm/index311.js +9 -51
  214. package/dist/esm/index312.js +38 -24
  215. package/dist/esm/index313.js +37 -17
  216. package/dist/esm/index314.js +17 -14
  217. package/dist/esm/index315.js +14 -11
  218. package/dist/esm/index316.js +11 -12
  219. package/dist/esm/index317.js +12 -19
  220. package/dist/esm/index318.js +18 -106
  221. package/dist/esm/index319.js +105 -101
  222. package/dist/esm/index320.js +103 -6
  223. package/dist/esm/index321.js +7 -7
  224. package/dist/esm/index322.js +7 -27
  225. package/dist/esm/index323.js +26 -15
  226. package/dist/esm/index324.js +13 -211
  227. package/dist/esm/index325.js +213 -12
  228. package/dist/esm/index326.js +12 -35
  229. package/dist/esm/index327.js +35 -41
  230. package/dist/esm/index328.js +42 -2
  231. package/dist/esm/index329.js +3 -68
  232. package/dist/esm/index330.js +68 -3
  233. package/dist/esm/index331.js +3 -136
  234. package/dist/esm/index332.js +125 -163
  235. package/dist/esm/index333.js +174 -9
  236. package/dist/esm/index334.js +9 -16
  237. package/dist/esm/index335.js +16 -133
  238. package/dist/esm/index336.js +112 -172
  239. package/dist/esm/index337.js +194 -2
  240. package/dist/esm/index338.js +2 -79
  241. package/dist/esm/index339.js +77 -13
  242. package/dist/esm/index340.js +13 -89
  243. package/dist/esm/index341.js +70 -143
  244. package/dist/esm/index342.js +157 -36
  245. package/dist/esm/index343.js +41 -654
  246. package/dist/esm/index344.js +646 -196
  247. package/dist/esm/index345.js +201 -172
  248. package/dist/esm/index346.js +176 -3
  249. package/dist/esm/index347.js +1 -1
  250. package/dist/esm/index349.js +2 -2
  251. package/dist/esm/index350.js +1 -1
  252. package/dist/esm/index351.js +1 -1
  253. package/dist/esm/index352.js +2 -2
  254. package/dist/esm/index353.js +3 -3
  255. package/dist/esm/index354.js +1 -1
  256. package/dist/esm/index73.js +2 -2
  257. package/dist/esm/index74.js +1 -1
  258. package/dist/esm/index75.js +2 -2
  259. package/dist/esm/index76.js +1 -1
  260. package/dist/esm/index77.js +1 -1
  261. package/dist/esm/index78.js +1 -1
  262. package/dist/esm/index79.js +1 -1
  263. package/dist/esm/index80.js +2 -2
  264. package/dist/esm/index81.js +2 -2
  265. package/dist/esm/index82.js +5 -5
  266. package/dist/esm/index83.js +2 -2
  267. package/dist/esm/index85.js +37 -33
  268. package/dist/esm/index86.js +2 -4
  269. package/dist/esm/index87.js +69 -9
  270. package/dist/esm/index88.js +33 -117
  271. package/dist/esm/index89.js +13 -60
  272. package/dist/esm/index90.js +33 -23
  273. package/dist/esm/index91.js +3 -36
  274. package/dist/esm/index92.js +9 -41
  275. package/dist/esm/index93.js +118 -58
  276. package/dist/esm/index94.js +58 -165
  277. package/dist/esm/index95.js +21 -36
  278. package/dist/esm/index96.js +36 -9
  279. package/dist/esm/index97.js +38 -28
  280. package/dist/esm/index98.js +58 -36
  281. package/dist/esm/index99.js +167 -8
  282. package/package.json +3 -3
@@ -1,177 +1,139 @@
1
- import { BaseError as o } from "./index340.js";
2
- import { assertStartOffset as x, assertEndOffset as $, pad as b, assertSize as f } from "./index347.js";
3
- import { stringify as p } from "./index348.js";
4
- const y = /* @__PURE__ */ new TextEncoder(), h = /* @__PURE__ */ Array.from({ length: 256 }, (e, r) => r.toString(16).padStart(2, "0"));
5
- function z(e, r = {}) {
6
- const { strict: t = !1 } = r;
7
- if (!e)
8
- throw new d(e);
9
- if (typeof e != "string")
10
- throw new d(e);
11
- if (t && !/^0x[0-9a-fA-F]*$/.test(e))
12
- throw new g(e);
13
- if (!e.startsWith("0x"))
14
- throw new g(e);
15
- }
16
- function A(...e) {
17
- return `0x${e.reduce((r, t) => r + t.replace("0x", ""), "")}`;
18
- }
19
- function N(e) {
20
- return e instanceof Uint8Array ? c(e) : Array.isArray(e) ? c(new Uint8Array(e)) : e;
21
- }
22
- function P(e, r = {}) {
23
- const t = `0x${Number(e)}`;
24
- return typeof r.size == "number" ? (f(t, r.size), m(t, r.size)) : t;
25
- }
26
- function c(e, r = {}) {
27
- let t = "";
28
- for (let s = 0; s < e.length; s++)
29
- t += h[e[s]];
30
- const n = `0x${t}`;
31
- return typeof r.size == "number" ? (f(n, r.size), w(n, r.size)) : n;
32
- }
33
- function V(e, r = {}) {
34
- const { signed: t, size: n } = r, s = BigInt(e);
35
- let i;
36
- n ? t ? i = (1n << BigInt(n) * 8n - 1n) - 1n : i = 2n ** (BigInt(n) * 8n) - 1n : typeof e == "number" && (i = BigInt(Number.MAX_SAFE_INTEGER));
37
- const u = typeof i == "bigint" && t ? -i - 1n : 0;
38
- if (i && s > i || s < u) {
39
- const a = typeof e == "bigint" ? "n" : "";
40
- throw new O({
41
- max: i ? `${i}${a}` : void 0,
42
- min: `${u}${a}`,
43
- signed: t,
44
- size: n,
45
- value: `${e}${a}`
46
- });
47
- }
48
- const l = `0x${(t && s < 0 ? BigInt.asUintN(n * 8, BigInt(s)) : s).toString(16)}`;
49
- return n ? m(l, n) : l;
50
- }
51
- function j(e, r = {}) {
52
- return c(y.encode(e), r);
53
- }
54
- function m(e, r) {
55
- return b(e, { dir: "left", size: r });
56
- }
57
- function w(e, r) {
58
- return b(e, { dir: "right", size: r });
59
- }
60
- function _(e, r, t, n = {}) {
61
- const { strict: s } = n;
62
- x(e, r);
63
- const i = `0x${e.replace("0x", "").slice((r ?? 0) * 2, (t ?? e.length) * 2)}`;
64
- return s && $(i, r, t), i;
65
- }
66
- function v(e) {
67
- return Math.ceil((e.length - 2) / 2);
68
- }
69
- function E(e, r = {}) {
70
- const { signed: t } = r;
71
- r.size && f(e, r.size);
72
- const n = BigInt(e);
73
- if (!t)
74
- return n;
75
- const s = (e.length - 2) / 2, i = (1n << BigInt(s) * 8n) - 1n, u = i >> 1n;
76
- return n <= u ? n : n - i - 1n;
77
- }
78
- function M(e, r = {}) {
79
- const { signed: t, size: n } = r;
80
- return Number(!t && !n ? e : E(e, r));
81
- }
82
- function R(e, r = {}) {
83
- const { strict: t = !1 } = r;
1
+ import { readContract as w } from "./index132.js";
2
+ import { EnsAvatarUriResolutionError as d, EnsAvatarInvalidNftUriError as p, EnsAvatarUnsupportedNamespaceError as I, EnsAvatarInvalidMetadataError as y } from "./index182.js";
3
+ const v = /(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/, A = /^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/, b = /^data:([a-zA-Z\-/+]*);base64,([^"].*)/, E = /^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;
4
+ async function k(e) {
84
5
  try {
85
- return z(e, { strict: t }), !0;
86
- } catch {
87
- return !1;
88
- }
89
- }
90
- class O extends o {
91
- constructor({ max: r, min: t, signed: n, size: s, value: i }) {
92
- super(`Number \`${i}\` is not in safe${s ? ` ${s * 8}-bit` : ""}${n ? " signed" : " unsigned"} integer range ${r ? `(\`${t}\` to \`${r}\`)` : `(above \`${t}\`)`}`), Object.defineProperty(this, "name", {
93
- enumerable: !0,
94
- configurable: !0,
95
- writable: !0,
96
- value: "Hex.IntegerOutOfRangeError"
6
+ const t = await fetch(e, { method: "HEAD" });
7
+ return t.status === 200 ? t.headers.get("content-type")?.startsWith("image/") : !1;
8
+ } catch (t) {
9
+ return typeof t == "object" && typeof t.response < "u" || !Object.hasOwn(globalThis, "Image") ? !1 : new Promise((n) => {
10
+ const a = new Image();
11
+ a.onload = () => {
12
+ n(!0);
13
+ }, a.onerror = () => {
14
+ n(!1);
15
+ }, a.src = e;
97
16
  });
98
17
  }
99
18
  }
100
- class d extends o {
101
- constructor(r) {
102
- super(`Value \`${typeof r == "object" ? p(r) : r}\` of type \`${typeof r}\` is an invalid hex type.`, {
103
- metaMessages: ['Hex types must be represented as `"0x${string}"`.']
104
- }), Object.defineProperty(this, "name", {
105
- enumerable: !0,
106
- configurable: !0,
107
- writable: !0,
108
- value: "Hex.InvalidHexTypeError"
109
- });
19
+ function l(e, t) {
20
+ return e ? e.endsWith("/") ? e.slice(0, -1) : e : t;
21
+ }
22
+ function C({ uri: e, gatewayUrls: t }) {
23
+ const n = b.test(e);
24
+ if (n)
25
+ return { uri: e, isOnChain: !0, isEncoded: n };
26
+ const a = l(t?.ipfs, "https://ipfs.io"), r = l(t?.arweave, "https://arweave.net"), f = e.match(v), { protocol: i, subpath: c, target: s, subtarget: h = "" } = f?.groups || {}, u = i === "ipns:/" || c === "ipns/", m = i === "ipfs:/" || c === "ipfs/" || A.test(e);
27
+ if (e.startsWith("http") && !u && !m) {
28
+ let g = e;
29
+ return t?.arweave && (g = e.replace(/https:\/\/arweave.net/g, t?.arweave)), { uri: g, isOnChain: !1, isEncoded: !1 };
110
30
  }
111
- }
112
- class g extends o {
113
- constructor(r) {
114
- super(`Value \`${r}\` is an invalid hex value.`, {
115
- metaMessages: [
116
- 'Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).'
117
- ]
118
- }), Object.defineProperty(this, "name", {
119
- enumerable: !0,
120
- configurable: !0,
121
- writable: !0,
122
- value: "Hex.InvalidHexValueError"
31
+ if ((u || m) && s)
32
+ return {
33
+ uri: `${a}/${u ? "ipns" : "ipfs"}/${s}${h}`,
34
+ isOnChain: !1,
35
+ isEncoded: !1
36
+ };
37
+ if (i === "ar:/" && s)
38
+ return {
39
+ uri: `${r}/${s}${h || ""}`,
40
+ isOnChain: !1,
41
+ isEncoded: !1
42
+ };
43
+ let o = e.replace(E, "");
44
+ if (o.startsWith("<svg") && (o = `data:image/svg+xml;base64,${btoa(o)}`), o.startsWith("data:") || o.startsWith("{"))
45
+ return {
46
+ uri: o,
47
+ isOnChain: !0,
48
+ isEncoded: !1
49
+ };
50
+ throw new d({ uri: e });
51
+ }
52
+ function U(e) {
53
+ if (typeof e != "object" || !("image" in e) && !("image_url" in e) && !("image_data" in e))
54
+ throw new y({ data: e });
55
+ return e.image || e.image_url || e.image_data;
56
+ }
57
+ async function _({ gatewayUrls: e, uri: t }) {
58
+ try {
59
+ const n = await fetch(t).then((r) => r.json());
60
+ return await R({
61
+ gatewayUrls: e,
62
+ uri: U(n)
123
63
  });
64
+ } catch {
65
+ throw new d({ uri: t });
124
66
  }
125
67
  }
126
- class T extends o {
127
- constructor({ givenSize: r, maxSize: t }) {
128
- super(`Size cannot exceed \`${t}\` bytes. Given size: \`${r}\` bytes.`), Object.defineProperty(this, "name", {
129
- enumerable: !0,
130
- configurable: !0,
131
- writable: !0,
132
- value: "Hex.SizeOverflowError"
68
+ async function R({ gatewayUrls: e, uri: t }) {
69
+ const { uri: n, isOnChain: a } = C({ uri: t, gatewayUrls: e });
70
+ if (a || await k(n))
71
+ return n;
72
+ throw new d({ uri: t });
73
+ }
74
+ function $(e) {
75
+ let t = e;
76
+ t.startsWith("did:nft:") && (t = t.replace("did:nft:", "").replace(/_/g, "/"));
77
+ const [n, a, r] = t.split("/"), [f, i] = n.split(":"), [c, s] = a.split(":");
78
+ if (!f || f.toLowerCase() !== "eip155")
79
+ throw new p({ reason: "Only EIP-155 supported" });
80
+ if (!i)
81
+ throw new p({ reason: "Chain ID not found" });
82
+ if (!s)
83
+ throw new p({
84
+ reason: "Contract address not found"
133
85
  });
134
- }
135
- }
136
- class U extends o {
137
- constructor({ offset: r, position: t, size: n }) {
138
- super(`Slice ${t === "start" ? "starting" : "ending"} at offset \`${r}\` is out-of-bounds (size: \`${n}\`).`), Object.defineProperty(this, "name", {
139
- enumerable: !0,
140
- configurable: !0,
141
- writable: !0,
142
- value: "Hex.SliceOffsetOutOfBoundsError"
86
+ if (!r)
87
+ throw new p({ reason: "Token ID not found" });
88
+ if (!c)
89
+ throw new p({ reason: "ERC namespace not found" });
90
+ return {
91
+ chainID: Number.parseInt(i, 10),
92
+ namespace: c.toLowerCase(),
93
+ contractAddress: s,
94
+ tokenID: r
95
+ };
96
+ }
97
+ async function D(e, { nft: t }) {
98
+ if (t.namespace === "erc721")
99
+ return w(e, {
100
+ address: t.contractAddress,
101
+ abi: [
102
+ {
103
+ name: "tokenURI",
104
+ type: "function",
105
+ stateMutability: "view",
106
+ inputs: [{ name: "tokenId", type: "uint256" }],
107
+ outputs: [{ name: "", type: "string" }]
108
+ }
109
+ ],
110
+ functionName: "tokenURI",
111
+ args: [BigInt(t.tokenID)]
143
112
  });
144
- }
145
- }
146
- class F extends o {
147
- constructor({ size: r, targetSize: t, type: n }) {
148
- super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${r}\`) exceeds padding size (\`${t}\`).`), Object.defineProperty(this, "name", {
149
- enumerable: !0,
150
- configurable: !0,
151
- writable: !0,
152
- value: "Hex.SizeExceedsPaddingSizeError"
113
+ if (t.namespace === "erc1155")
114
+ return w(e, {
115
+ address: t.contractAddress,
116
+ abi: [
117
+ {
118
+ name: "uri",
119
+ type: "function",
120
+ stateMutability: "view",
121
+ inputs: [{ name: "_id", type: "uint256" }],
122
+ outputs: [{ name: "", type: "string" }]
123
+ }
124
+ ],
125
+ functionName: "uri",
126
+ args: [BigInt(t.tokenID)]
153
127
  });
154
- }
128
+ throw new I({ namespace: t.namespace });
155
129
  }
156
130
  export {
157
- O as IntegerOutOfRangeError,
158
- d as InvalidHexTypeError,
159
- g as InvalidHexValueError,
160
- F as SizeExceedsPaddingSizeError,
161
- T as SizeOverflowError,
162
- U as SliceOffsetOutOfBoundsError,
163
- z as assert,
164
- A as concat,
165
- N as from,
166
- P as fromBoolean,
167
- c as fromBytes,
168
- V as fromNumber,
169
- j as fromString,
170
- m as padLeft,
171
- w as padRight,
172
- v as size,
173
- _ as slice,
174
- E as toBigInt,
175
- M as toNumber,
176
- R as validate
131
+ l as getGateway,
132
+ U as getJsonImage,
133
+ _ as getMetadataAvatarUri,
134
+ D as getNftTokenUri,
135
+ k as isImageUri,
136
+ R as parseAvatarUri,
137
+ $ as parseNftUri,
138
+ C as resolveAvatarUri
177
139
  };
@@ -1,12 +1,177 @@
1
- import { fromNumber as e } from "./index332.js";
2
- function r(o) {
3
- return {
4
- address: o.address,
5
- amount: e(o.amount),
6
- index: e(o.index),
7
- validatorIndex: e(o.validatorIndex)
8
- };
1
+ import { BaseError as o } from "./index341.js";
2
+ import { assertStartOffset as x, assertEndOffset as $, pad as b, assertSize as f } from "./index347.js";
3
+ import { stringify as p } from "./index348.js";
4
+ const y = /* @__PURE__ */ new TextEncoder(), h = /* @__PURE__ */ Array.from({ length: 256 }, (e, r) => r.toString(16).padStart(2, "0"));
5
+ function z(e, r = {}) {
6
+ const { strict: t = !1 } = r;
7
+ if (!e)
8
+ throw new d(e);
9
+ if (typeof e != "string")
10
+ throw new d(e);
11
+ if (t && !/^0x[0-9a-fA-F]*$/.test(e))
12
+ throw new g(e);
13
+ if (!e.startsWith("0x"))
14
+ throw new g(e);
15
+ }
16
+ function A(...e) {
17
+ return `0x${e.reduce((r, t) => r + t.replace("0x", ""), "")}`;
18
+ }
19
+ function N(e) {
20
+ return e instanceof Uint8Array ? c(e) : Array.isArray(e) ? c(new Uint8Array(e)) : e;
21
+ }
22
+ function P(e, r = {}) {
23
+ const t = `0x${Number(e)}`;
24
+ return typeof r.size == "number" ? (f(t, r.size), m(t, r.size)) : t;
25
+ }
26
+ function c(e, r = {}) {
27
+ let t = "";
28
+ for (let s = 0; s < e.length; s++)
29
+ t += h[e[s]];
30
+ const n = `0x${t}`;
31
+ return typeof r.size == "number" ? (f(n, r.size), w(n, r.size)) : n;
32
+ }
33
+ function V(e, r = {}) {
34
+ const { signed: t, size: n } = r, s = BigInt(e);
35
+ let i;
36
+ n ? t ? i = (1n << BigInt(n) * 8n - 1n) - 1n : i = 2n ** (BigInt(n) * 8n) - 1n : typeof e == "number" && (i = BigInt(Number.MAX_SAFE_INTEGER));
37
+ const u = typeof i == "bigint" && t ? -i - 1n : 0;
38
+ if (i && s > i || s < u) {
39
+ const a = typeof e == "bigint" ? "n" : "";
40
+ throw new O({
41
+ max: i ? `${i}${a}` : void 0,
42
+ min: `${u}${a}`,
43
+ signed: t,
44
+ size: n,
45
+ value: `${e}${a}`
46
+ });
47
+ }
48
+ const l = `0x${(t && s < 0 ? BigInt.asUintN(n * 8, BigInt(s)) : s).toString(16)}`;
49
+ return n ? m(l, n) : l;
50
+ }
51
+ function j(e, r = {}) {
52
+ return c(y.encode(e), r);
53
+ }
54
+ function m(e, r) {
55
+ return b(e, { dir: "left", size: r });
56
+ }
57
+ function w(e, r) {
58
+ return b(e, { dir: "right", size: r });
59
+ }
60
+ function _(e, r, t, n = {}) {
61
+ const { strict: s } = n;
62
+ x(e, r);
63
+ const i = `0x${e.replace("0x", "").slice((r ?? 0) * 2, (t ?? e.length) * 2)}`;
64
+ return s && $(i, r, t), i;
65
+ }
66
+ function v(e) {
67
+ return Math.ceil((e.length - 2) / 2);
68
+ }
69
+ function E(e, r = {}) {
70
+ const { signed: t } = r;
71
+ r.size && f(e, r.size);
72
+ const n = BigInt(e);
73
+ if (!t)
74
+ return n;
75
+ const s = (e.length - 2) / 2, i = (1n << BigInt(s) * 8n) - 1n, u = i >> 1n;
76
+ return n <= u ? n : n - i - 1n;
77
+ }
78
+ function M(e, r = {}) {
79
+ const { signed: t, size: n } = r;
80
+ return Number(!t && !n ? e : E(e, r));
81
+ }
82
+ function R(e, r = {}) {
83
+ const { strict: t = !1 } = r;
84
+ try {
85
+ return z(e, { strict: t }), !0;
86
+ } catch {
87
+ return !1;
88
+ }
89
+ }
90
+ class O extends o {
91
+ constructor({ max: r, min: t, signed: n, size: s, value: i }) {
92
+ super(`Number \`${i}\` is not in safe${s ? ` ${s * 8}-bit` : ""}${n ? " signed" : " unsigned"} integer range ${r ? `(\`${t}\` to \`${r}\`)` : `(above \`${t}\`)`}`), Object.defineProperty(this, "name", {
93
+ enumerable: !0,
94
+ configurable: !0,
95
+ writable: !0,
96
+ value: "Hex.IntegerOutOfRangeError"
97
+ });
98
+ }
99
+ }
100
+ class d extends o {
101
+ constructor(r) {
102
+ super(`Value \`${typeof r == "object" ? p(r) : r}\` of type \`${typeof r}\` is an invalid hex type.`, {
103
+ metaMessages: ['Hex types must be represented as `"0x${string}"`.']
104
+ }), Object.defineProperty(this, "name", {
105
+ enumerable: !0,
106
+ configurable: !0,
107
+ writable: !0,
108
+ value: "Hex.InvalidHexTypeError"
109
+ });
110
+ }
111
+ }
112
+ class g extends o {
113
+ constructor(r) {
114
+ super(`Value \`${r}\` is an invalid hex value.`, {
115
+ metaMessages: [
116
+ 'Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).'
117
+ ]
118
+ }), Object.defineProperty(this, "name", {
119
+ enumerable: !0,
120
+ configurable: !0,
121
+ writable: !0,
122
+ value: "Hex.InvalidHexValueError"
123
+ });
124
+ }
125
+ }
126
+ class T extends o {
127
+ constructor({ givenSize: r, maxSize: t }) {
128
+ super(`Size cannot exceed \`${t}\` bytes. Given size: \`${r}\` bytes.`), Object.defineProperty(this, "name", {
129
+ enumerable: !0,
130
+ configurable: !0,
131
+ writable: !0,
132
+ value: "Hex.SizeOverflowError"
133
+ });
134
+ }
135
+ }
136
+ class U extends o {
137
+ constructor({ offset: r, position: t, size: n }) {
138
+ super(`Slice ${t === "start" ? "starting" : "ending"} at offset \`${r}\` is out-of-bounds (size: \`${n}\`).`), Object.defineProperty(this, "name", {
139
+ enumerable: !0,
140
+ configurable: !0,
141
+ writable: !0,
142
+ value: "Hex.SliceOffsetOutOfBoundsError"
143
+ });
144
+ }
145
+ }
146
+ class F extends o {
147
+ constructor({ size: r, targetSize: t, type: n }) {
148
+ super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${r}\`) exceeds padding size (\`${t}\`).`), Object.defineProperty(this, "name", {
149
+ enumerable: !0,
150
+ configurable: !0,
151
+ writable: !0,
152
+ value: "Hex.SizeExceedsPaddingSizeError"
153
+ });
154
+ }
9
155
  }
10
156
  export {
11
- r as toRpc
157
+ O as IntegerOutOfRangeError,
158
+ d as InvalidHexTypeError,
159
+ g as InvalidHexValueError,
160
+ F as SizeExceedsPaddingSizeError,
161
+ T as SizeOverflowError,
162
+ U as SliceOffsetOutOfBoundsError,
163
+ z as assert,
164
+ A as concat,
165
+ N as from,
166
+ P as fromBoolean,
167
+ c as fromBytes,
168
+ V as fromNumber,
169
+ j as fromString,
170
+ m as padLeft,
171
+ w as padRight,
172
+ v as size,
173
+ _ as slice,
174
+ E as toBigInt,
175
+ M as toNumber,
176
+ R as validate
12
177
  };
@@ -1,19 +1,12 @@
1
- import { concatHex as i } from "./index201.js";
2
- import { hexToBytes as m } from "./index191.js";
3
- import { numberToHex as c } from "./index192.js";
4
- import { toRlp as d } from "./index231.js";
5
- import { keccak256 as f } from "./index207.js";
6
- function b(o) {
7
- const { chainId: t, nonce: r, to: s } = o, e = o.contractAddress ?? o.address, n = f(i([
8
- "0x05",
9
- d([
10
- t ? c(t) : "0x",
11
- e,
12
- r ? c(r) : "0x"
13
- ])
14
- ]));
15
- return s === "bytes" ? m(n) : n;
1
+ import { fromNumber as e } from "./index333.js";
2
+ function r(o) {
3
+ return {
4
+ address: o.address,
5
+ amount: e(o.amount),
6
+ index: e(o.index),
7
+ validatorIndex: e(o.validatorIndex)
8
+ };
16
9
  }
17
10
  export {
18
- b as hashAuthorization
11
+ r as toRpc
19
12
  };
@@ -1,136 +1,19 @@
1
- import { BaseError as d } from "./index340.js";
2
- import { keccak256 as v } from "./index349.js";
3
- import { validate as $, slice as A, fromString as S } from "./index332.js";
4
- import { isArgOfType as E, normalizeSignature as m, getAmbiguousTypes as B } from "./index350.js";
5
- import { parseAbiItem as y } from "./index281.js";
6
- import { formatAbiItem as p } from "./index273.js";
7
- function H(r, t = {}) {
8
- const { prepare: i = !0 } = t, n = Array.isArray(r) ? y(r) : typeof r == "string" ? y(r) : r;
9
- return {
10
- ...n,
11
- ...i ? { hash: f(n) } : {}
12
- };
13
- }
14
- function h(r, t, i) {
15
- const { args: n = [], prepare: u = !0 } = i ?? {}, w = $(t, { strict: !1 }), s = r.filter((e) => w ? e.type === "function" || e.type === "error" ? T(e) === A(t, 0, 4) : e.type === "event" ? f(e) === t : !1 : "name" in e && e.name === t);
16
- if (s.length === 0)
17
- throw new b({ name: t });
18
- if (s.length === 1)
19
- return {
20
- ...s[0],
21
- ...u ? { hash: f(s[0]) } : {}
22
- };
23
- let o;
24
- for (const e of s) {
25
- if (!("inputs" in e))
26
- continue;
27
- if (!n || n.length === 0) {
28
- if (!e.inputs || e.inputs.length === 0)
29
- return {
30
- ...e,
31
- ...u ? { hash: f(e) } : {}
32
- };
33
- continue;
34
- }
35
- if (!e.inputs || e.inputs.length === 0 || e.inputs.length !== n.length)
36
- continue;
37
- if (n.every((a, I) => {
38
- const l = "inputs" in e && e.inputs[I];
39
- return l ? E(a, l) : !1;
40
- })) {
41
- if (o && "inputs" in o && o.inputs) {
42
- const a = B(e.inputs, o.inputs, n);
43
- if (a)
44
- throw new O({
45
- abiItem: e,
46
- type: a[0]
47
- }, {
48
- abiItem: o,
49
- type: a[1]
50
- });
51
- }
52
- o = e;
53
- }
54
- }
55
- const c = (() => {
56
- if (o)
57
- return o;
58
- const [e, ...g] = s;
59
- return { ...e, overloads: g };
60
- })();
61
- if (!c)
62
- throw new b({ name: t });
63
- return {
64
- ...c,
65
- ...u ? { hash: f(c) } : {}
66
- };
67
- }
68
- function T(...r) {
69
- const t = (() => {
70
- if (Array.isArray(r[0])) {
71
- const [i, n] = r;
72
- return h(i, n);
73
- }
74
- return r[0];
75
- })();
76
- return A(f(t), 0, 4);
77
- }
78
- function F(...r) {
79
- const t = (() => {
80
- if (Array.isArray(r[0])) {
81
- const [n, u] = r;
82
- return h(n, u);
83
- }
84
- return r[0];
85
- })(), i = typeof t == "string" ? t : p(t);
86
- return m(i);
87
- }
88
- function f(...r) {
89
- const t = (() => {
90
- if (Array.isArray(r[0])) {
91
- const [i, n] = r;
92
- return h(i, n);
93
- }
94
- return r[0];
95
- })();
96
- return typeof t != "string" && "hash" in t && t.hash ? t.hash : v(S(F(t)));
97
- }
98
- class O extends d {
99
- constructor(t, i) {
100
- super("Found ambiguous types in overloaded ABI Items.", {
101
- metaMessages: [
102
- // TODO: abitype to add support for signature-formatted ABI items.
103
- `\`${t.type}\` in \`${m(p(t.abiItem))}\`, and`,
104
- `\`${i.type}\` in \`${m(p(i.abiItem))}\``,
105
- "",
106
- "These types encode differently and cannot be distinguished at runtime.",
107
- "Remove one of the ambiguous items in the ABI."
108
- ]
109
- }), Object.defineProperty(this, "name", {
110
- enumerable: !0,
111
- configurable: !0,
112
- writable: !0,
113
- value: "AbiItem.AmbiguityError"
114
- });
115
- }
116
- }
117
- class b extends d {
118
- constructor({ name: t, data: i, type: n = "item" }) {
119
- const u = t ? ` with name "${t}"` : i ? ` with data "${i}"` : "";
120
- super(`ABI ${n}${u} not found.`), Object.defineProperty(this, "name", {
121
- enumerable: !0,
122
- configurable: !0,
123
- writable: !0,
124
- value: "AbiItem.NotFoundError"
125
- });
126
- }
1
+ import { concatHex as i } from "./index206.js";
2
+ import { hexToBytes as m } from "./index196.js";
3
+ import { numberToHex as c } from "./index197.js";
4
+ import { toRlp as d } from "./index236.js";
5
+ import { keccak256 as f } from "./index212.js";
6
+ function b(o) {
7
+ const { chainId: t, nonce: r, to: s } = o, e = o.contractAddress ?? o.address, n = f(i([
8
+ "0x05",
9
+ d([
10
+ t ? c(t) : "0x",
11
+ e,
12
+ r ? c(r) : "0x"
13
+ ])
14
+ ]));
15
+ return s === "bytes" ? m(n) : n;
127
16
  }
128
17
  export {
129
- O as AmbiguityError,
130
- b as NotFoundError,
131
- H as from,
132
- h as fromAbi,
133
- T as getSelector,
134
- F as getSignature,
135
- f as getSignatureHash
18
+ b as hashAuthorization
136
19
  };