@gardenfi/utils 3.1.1-beta.2 → 3.1.1-beta.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.
Files changed (313) hide show
  1. package/dist/index102.cjs +1 -1
  2. package/dist/index102.js +4 -4
  3. package/dist/index104.cjs +1 -1
  4. package/dist/index104.js +3 -3
  5. package/dist/index111.cjs +1 -1
  6. package/dist/index111.js +2 -2
  7. package/dist/index112.cjs +1 -1
  8. package/dist/index112.js +1 -1
  9. package/dist/index113.cjs +1 -1
  10. package/dist/index113.js +1 -1
  11. package/dist/index114.cjs +1 -1
  12. package/dist/index114.js +1 -1
  13. package/dist/index115.cjs +1 -1
  14. package/dist/index115.js +1 -1
  15. package/dist/index132.cjs +1 -1
  16. package/dist/index132.js +5 -5
  17. package/dist/index138.cjs +1 -1
  18. package/dist/index138.js +13 -33
  19. package/dist/index139.cjs +1 -1
  20. package/dist/index139.js +34 -9
  21. package/dist/index140.cjs +1 -1
  22. package/dist/index140.js +55 -60
  23. package/dist/index141.cjs +1 -1
  24. package/dist/index141.js +23 -17
  25. package/dist/index142.cjs +1 -1
  26. package/dist/index142.js +6 -106
  27. package/dist/index143.cjs +1 -1
  28. package/dist/index143.js +18 -78
  29. package/dist/index144.cjs +1 -1
  30. package/dist/index144.js +15 -9
  31. package/dist/index145.cjs +1 -1
  32. package/dist/index145.js +5 -90
  33. package/dist/index146.cjs +1 -2
  34. package/dist/index146.js +14 -3
  35. package/dist/index147.cjs +1 -1
  36. package/dist/index147.js +11 -9
  37. package/dist/index148.cjs +1 -1
  38. package/dist/index148.js +12 -13
  39. package/dist/index149.cjs +1 -1
  40. package/dist/index149.js +11 -4
  41. package/dist/index150.cjs +1 -1
  42. package/dist/index150.js +8 -12
  43. package/dist/index151.cjs +1 -1
  44. package/dist/index151.js +4 -2
  45. package/dist/index152.cjs +1 -1
  46. package/dist/index152.js +17 -32
  47. package/dist/index153.cjs +1 -1
  48. package/dist/index153.js +5 -21
  49. package/dist/index154.cjs +1 -1
  50. package/dist/index154.js +171 -5
  51. package/dist/index155.cjs +1 -1
  52. package/dist/index155.js +103 -5
  53. package/dist/index156.cjs +1 -1
  54. package/dist/index156.js +33 -5
  55. package/dist/index157.cjs +1 -9
  56. package/dist/index157.js +8 -34
  57. package/dist/index158.cjs +1 -1
  58. package/dist/index158.js +61 -3
  59. package/dist/index159.cjs +1 -1
  60. package/dist/index159.js +19 -18
  61. package/dist/index160.cjs +1 -1
  62. package/dist/index160.js +105 -19
  63. package/dist/index161.cjs +1 -1
  64. package/dist/index161.js +70 -27
  65. package/dist/index162.cjs +1 -1
  66. package/dist/index162.js +7 -6
  67. package/dist/index163.cjs +1 -4
  68. package/dist/index163.js +88 -192
  69. package/dist/index164.cjs +2 -1
  70. package/dist/index164.js +3 -28
  71. package/dist/index165.cjs +1 -1
  72. package/dist/index165.js +9 -162
  73. package/dist/index166.cjs +1 -1
  74. package/dist/index166.js +13 -127
  75. package/dist/index167.cjs +1 -1
  76. package/dist/index167.js +4 -27
  77. package/dist/index168.cjs +1 -1
  78. package/dist/index168.js +2 -56
  79. package/dist/index169.cjs +1 -1
  80. package/dist/index169.js +31 -191
  81. package/dist/index170.cjs +1 -1
  82. package/dist/index170.js +22 -4
  83. package/dist/index171.cjs +1 -1
  84. package/dist/index171.js +5 -20
  85. package/dist/index172.cjs +1 -1
  86. package/dist/index172.js +6 -3
  87. package/dist/index173.cjs +1 -1
  88. package/dist/index173.js +5 -16
  89. package/dist/index174.cjs +9 -1
  90. package/dist/index174.js +35 -11
  91. package/dist/index175.cjs +1 -1
  92. package/dist/index175.js +3 -35
  93. package/dist/index176.cjs +1 -1
  94. package/dist/index176.js +19 -3
  95. package/dist/index177.cjs +1 -1
  96. package/dist/index177.js +18 -25
  97. package/dist/index178.cjs +1 -1
  98. package/dist/index178.js +35 -8
  99. package/dist/index179.cjs +1 -1
  100. package/dist/index179.js +6 -23
  101. package/dist/index180.cjs +4 -1
  102. package/dist/index180.js +194 -28
  103. package/dist/index181.cjs +1 -1
  104. package/dist/index181.js +27 -3
  105. package/dist/index182.cjs +1 -1
  106. package/dist/index182.js +161 -6
  107. package/dist/index183.cjs +1 -1
  108. package/dist/index183.js +127 -6
  109. package/dist/index184.cjs +1 -1
  110. package/dist/index184.js +27 -32
  111. package/dist/index185.cjs +1 -1
  112. package/dist/index185.js +192 -5
  113. package/dist/index186.cjs +1 -1
  114. package/dist/index186.js +4 -38
  115. package/dist/index187.cjs +1 -1
  116. package/dist/index187.js +14 -43
  117. package/dist/index188.cjs +1 -1
  118. package/dist/index188.js +3 -33
  119. package/dist/index189.cjs +1 -1
  120. package/dist/index189.js +15 -16
  121. package/dist/index190.cjs +1 -1
  122. package/dist/index190.js +32 -40
  123. package/dist/index191.cjs +1 -1
  124. package/dist/index191.js +3 -105
  125. package/dist/index192.cjs +1 -1
  126. package/dist/index192.js +28 -3
  127. package/dist/index193.cjs +1 -1
  128. package/dist/index193.js +25 -5
  129. package/dist/index194.cjs +1 -1
  130. package/dist/index194.js +28 -3
  131. package/dist/index195.cjs +1 -1
  132. package/dist/index195.js +6 -17
  133. package/dist/index196.cjs +1 -1
  134. package/dist/index196.js +6 -5
  135. package/dist/index197.cjs +1 -1
  136. package/dist/index197.js +32 -8
  137. package/dist/index198.cjs +1 -1
  138. package/dist/index198.js +5 -104
  139. package/dist/index199.cjs +1 -1
  140. package/dist/index199.js +37 -5
  141. package/dist/index200.cjs +1 -1
  142. package/dist/index200.js +49 -6
  143. package/dist/index201.cjs +1 -1
  144. package/dist/index201.js +30 -25
  145. package/dist/index202.cjs +1 -1
  146. package/dist/index202.js +17 -34
  147. package/dist/index203.cjs +1 -1
  148. package/dist/index203.js +42 -13
  149. package/dist/index204.cjs +1 -1
  150. package/dist/index204.js +100 -74
  151. package/dist/index205.cjs +1 -1
  152. package/dist/index205.js +3 -2
  153. package/dist/index206.cjs +1 -1
  154. package/dist/index206.js +4 -17
  155. package/dist/index207.cjs +1 -1
  156. package/dist/index207.js +3 -171
  157. package/dist/index208.cjs +1 -1
  158. package/dist/index208.js +17 -17
  159. package/dist/index209.cjs +1 -1
  160. package/dist/index209.js +8 -10
  161. package/dist/index210.cjs +1 -1
  162. package/dist/index210.js +5 -25
  163. package/dist/index211.cjs +1 -1
  164. package/dist/index211.js +27 -18
  165. package/dist/index212.cjs +1 -1
  166. package/dist/index212.js +78 -15
  167. package/dist/index213.cjs +1 -1
  168. package/dist/index213.js +2 -6
  169. package/dist/index214.cjs +1 -1
  170. package/dist/index214.js +18 -13
  171. package/dist/index215.cjs +1 -1
  172. package/dist/index215.js +17 -10
  173. package/dist/index216.cjs +1 -1
  174. package/dist/index216.js +10 -16
  175. package/dist/index217.cjs +1 -1
  176. package/dist/index217.js +24 -11
  177. package/dist/index218.cjs +1 -1
  178. package/dist/index218.js +45 -18
  179. package/dist/index219.cjs +1 -1
  180. package/dist/index219.js +9 -24
  181. package/dist/index22.cjs +1 -1
  182. package/dist/index22.js +8 -8
  183. package/dist/index220.cjs +1 -1
  184. package/dist/index220.js +100 -43
  185. package/dist/index221.cjs +1 -1
  186. package/dist/index221.js +14 -7
  187. package/dist/index222.cjs +1 -2
  188. package/dist/index222.js +213 -40
  189. package/dist/index223.cjs +2 -1
  190. package/dist/index223.js +42 -2
  191. package/dist/index224.cjs +1 -1
  192. package/dist/index224.js +2 -6
  193. package/dist/index225.cjs +1 -1
  194. package/dist/index225.js +5 -10
  195. package/dist/index226.cjs +1 -1
  196. package/dist/index226.js +9 -18
  197. package/dist/index227.cjs +1 -1
  198. package/dist/index227.js +19 -8
  199. package/dist/index228.cjs +1 -1
  200. package/dist/index228.js +8 -66
  201. package/dist/index229.cjs +1 -1
  202. package/dist/index229.js +65 -64
  203. package/dist/index23.cjs +1 -1
  204. package/dist/index23.js +2 -2
  205. package/dist/index230.cjs +1 -1
  206. package/dist/index230.js +60 -183
  207. package/dist/index231.cjs +1 -1
  208. package/dist/index231.js +185 -25
  209. package/dist/index232.cjs +1 -1
  210. package/dist/index232.js +13 -61
  211. package/dist/index233.cjs +1 -1
  212. package/dist/index233.js +54 -18
  213. package/dist/index234.cjs +1 -1
  214. package/dist/index234.js +34 -10
  215. package/dist/index235.cjs +1 -1
  216. package/dist/index235.js +10 -7
  217. package/dist/index236.cjs +1 -1
  218. package/dist/index236.js +13 -11
  219. package/dist/index237.cjs +1 -1
  220. package/dist/index237.js +109 -13
  221. package/dist/index238.cjs +1 -1
  222. package/dist/index238.js +205 -18
  223. package/dist/index239.cjs +1 -1
  224. package/dist/index239.js +40 -106
  225. package/dist/index24.cjs +1 -1
  226. package/dist/index24.js +4 -4
  227. package/dist/index240.cjs +1 -1
  228. package/dist/index240.js +78 -6
  229. package/dist/index241.cjs +1 -1
  230. package/dist/index241.js +2 -7
  231. package/dist/index242.cjs +1 -1
  232. package/dist/index242.js +11 -26
  233. package/dist/index243.cjs +1 -1
  234. package/dist/index243.js +11 -102
  235. package/dist/index244.cjs +1 -1
  236. package/dist/index244.js +18 -15
  237. package/dist/index245.cjs +1 -1
  238. package/dist/index245.js +6 -214
  239. package/dist/index246.cjs +1 -1
  240. package/dist/index246.js +6 -206
  241. package/dist/index247.cjs +1 -1
  242. package/dist/index247.js +25 -41
  243. package/dist/index248.cjs +1 -1
  244. package/dist/index248.js +10 -77
  245. package/dist/index249.cjs +1 -1
  246. package/dist/index249.js +20 -2
  247. package/dist/index25.cjs +1 -1
  248. package/dist/index25.js +2 -2
  249. package/dist/index251.cjs +1 -1
  250. package/dist/index251.js +1 -1
  251. package/dist/index252.cjs +1 -1
  252. package/dist/index252.js +657 -68
  253. package/dist/index253.cjs +1 -1
  254. package/dist/index253.js +154 -634
  255. package/dist/index254.cjs +1 -1
  256. package/dist/index254.js +67 -176
  257. package/dist/index26.cjs +1 -1
  258. package/dist/index26.js +1 -1
  259. package/dist/index30.cjs +1 -1
  260. package/dist/index30.js +6 -6
  261. package/dist/index31.cjs +1 -1
  262. package/dist/index31.js +2 -2
  263. package/dist/index35.cjs +1 -1
  264. package/dist/index35.js +1 -1
  265. package/dist/index37.cjs +1 -1
  266. package/dist/index37.js +8 -8
  267. package/dist/index38.cjs +1 -1
  268. package/dist/index38.js +1 -1
  269. package/dist/index39.cjs +1 -1
  270. package/dist/index39.js +1 -1
  271. package/dist/index40.cjs +1 -1
  272. package/dist/index40.js +2 -2
  273. package/dist/index42.cjs +1 -1
  274. package/dist/index42.js +2 -2
  275. package/dist/index43.cjs +1 -1
  276. package/dist/index43.js +2 -2
  277. package/dist/index47.cjs +1 -1
  278. package/dist/index47.js +4 -4
  279. package/dist/index48.cjs +1 -1
  280. package/dist/index48.js +3 -3
  281. package/dist/index49.cjs +1 -1
  282. package/dist/index49.js +3 -3
  283. package/dist/index51.cjs +1 -1
  284. package/dist/index51.js +6 -6
  285. package/dist/index54.cjs +1 -1
  286. package/dist/index54.js +1 -1
  287. package/dist/index58.cjs +1 -1
  288. package/dist/index58.js +1 -1
  289. package/dist/index62.cjs +1 -1
  290. package/dist/index62.js +2 -2
  291. package/dist/index63.cjs +1 -1
  292. package/dist/index63.js +3 -3
  293. package/dist/index65.cjs +1 -1
  294. package/dist/index65.js +2 -2
  295. package/dist/index67.cjs +1 -1
  296. package/dist/index67.js +2 -2
  297. package/dist/index75.cjs +1 -1
  298. package/dist/index75.js +4 -4
  299. package/dist/index78.cjs +1 -1
  300. package/dist/index78.js +3 -3
  301. package/dist/index81.cjs +1 -1
  302. package/dist/index81.js +2 -2
  303. package/dist/index90.cjs +1 -1
  304. package/dist/index90.js +1 -1
  305. package/dist/index93.cjs +1 -1
  306. package/dist/index93.js +1 -1
  307. package/dist/index95.cjs +1 -1
  308. package/dist/index95.js +2 -2
  309. package/dist/index96.cjs +1 -1
  310. package/dist/index96.js +1 -1
  311. package/dist/index97.cjs +1 -1
  312. package/dist/index97.js +5 -5
  313. package/package.json +1 -1
package/dist/index143.js CHANGED
@@ -1,81 +1,21 @@
1
- import { stringify as s } from "./index91.js";
2
- import { BaseError as a } from "./index35.js";
3
- import { getUrl as i } from "./index158.js";
4
- class m extends a {
5
- constructor({ body: t, cause: e, details: r, headers: n, status: u, url: l }) {
6
- super("HTTP request failed.", {
7
- cause: e,
8
- details: r,
9
- metaMessages: [
10
- u && `Status: ${u}`,
11
- `URL: ${i(l)}`,
12
- t && `Request body: ${s(t)}`
13
- ].filter(Boolean),
14
- name: "HttpRequestError"
15
- }), Object.defineProperty(this, "body", {
16
- enumerable: !0,
17
- configurable: !0,
18
- writable: !0,
19
- value: void 0
20
- }), Object.defineProperty(this, "headers", {
21
- enumerable: !0,
22
- configurable: !0,
23
- writable: !0,
24
- value: void 0
25
- }), Object.defineProperty(this, "status", {
26
- enumerable: !0,
27
- configurable: !0,
28
- writable: !0,
29
- value: void 0
30
- }), Object.defineProperty(this, "url", {
31
- enumerable: !0,
32
- configurable: !0,
33
- writable: !0,
34
- value: void 0
35
- }), this.body = t, this.headers = n, this.status = u, this.url = l;
36
- }
37
- }
38
- class f extends a {
39
- constructor({ body: t, error: e, url: r }) {
40
- super("RPC Request failed.", {
41
- cause: e,
42
- details: e.message,
43
- metaMessages: [`URL: ${i(r)}`, `Request body: ${s(t)}`],
44
- name: "RpcRequestError"
45
- }), Object.defineProperty(this, "code", {
46
- enumerable: !0,
47
- configurable: !0,
48
- writable: !0,
49
- value: void 0
50
- }), Object.defineProperty(this, "data", {
51
- enumerable: !0,
52
- configurable: !0,
53
- writable: !0,
54
- value: void 0
55
- }), Object.defineProperty(this, "url", {
56
- enumerable: !0,
57
- configurable: !0,
58
- writable: !0,
59
- value: void 0
60
- }), this.code = e.code, this.data = e.data, this.url = r;
61
- }
62
- }
63
- class h extends a {
64
- constructor({ body: t, url: e }) {
65
- super("The request took too long to respond.", {
66
- details: "The request timed out.",
67
- metaMessages: [`URL: ${i(e)}`, `Request body: ${s(t)}`],
68
- name: "TimeoutError"
69
- }), Object.defineProperty(this, "url", {
70
- enumerable: !0,
71
- configurable: !0,
72
- writable: !0,
73
- value: void 0
74
- }), this.url = e;
75
- }
1
+ import { secp256k1 as a } from "./index139.js";
2
+ import { isHex as f } from "./index151.js";
3
+ import { hexToBytes as p } from "./index140.js";
4
+ import { numberToHex as s } from "./index42.js";
5
+ import { serializeSignature as u } from "./index138.js";
6
+ let e = !1;
7
+ async function z({ hash: o, privateKey: n, to: r = "object" }) {
8
+ const { r: m, s: c, recovery: t } = a.sign(o.slice(2), n.slice(2), {
9
+ lowS: !0,
10
+ extraEntropy: f(e, { strict: !1 }) ? p(e) : e
11
+ }), i = {
12
+ r: s(m, { size: 32 }),
13
+ s: s(c, { size: 32 }),
14
+ v: t ? 28n : 27n,
15
+ yParity: t
16
+ };
17
+ return r === "bytes" || r === "hex" ? u({ ...i, to: r }) : i;
76
18
  }
77
19
  export {
78
- m as HttpRequestError,
79
- f as RpcRequestError,
80
- h as TimeoutError
20
+ z as sign
81
21
  };
package/dist/index144.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index35.cjs");class e extends r.BaseError{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}exports.UrlRequiredError=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index152.cjs"),a=require("./index143.cjs");async function u(t){const{chainId:n,nonce:i,privateKey:r,to:o="object"}=t,s=t.contractAddress??t.address,e=await a.sign({hash:c.hashAuthorization({address:s,chainId:n,nonce:i}),privateKey:r,to:o});return o==="object"?{address:s,chainId:n,nonce:i,...e}:e}exports.signAuthorization=u;
package/dist/index144.js CHANGED
@@ -1,12 +1,18 @@
1
- import { BaseError as r } from "./index35.js";
2
- class t extends r {
3
- constructor() {
4
- super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.", {
5
- docsPath: "/docs/clients/intro",
6
- name: "UrlRequiredError"
7
- });
8
- }
1
+ import { hashAuthorization as a } from "./index152.js";
2
+ import { sign as e } from "./index143.js";
3
+ async function u(t) {
4
+ const { chainId: o, nonce: n, privateKey: c, to: i = "object" } = t, r = t.contractAddress ?? t.address, s = await e({
5
+ hash: a({ address: r, chainId: o, nonce: n }),
6
+ privateKey: c,
7
+ to: i
8
+ });
9
+ return i === "object" ? {
10
+ address: r,
11
+ chainId: o,
12
+ nonce: n,
13
+ ...s
14
+ } : s;
9
15
  }
10
16
  export {
11
- t as UrlRequiredError
17
+ u as signAuthorization
12
18
  };
package/dist/index145.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index143.cjs"),E=require("./index195.cjs"),d=require("./index91.cjs"),q=require("./index237.cjs");function H(i,e={}){const{url:r,headers:a}=R(i);return{async request(p){var g;const{body:n,fetchFn:T=e.fetchFn??fetch,onRequest:c=e.onRequest,onResponse:l=e.onResponse,timeout:f=e.timeout??1e4}=p,w={...e.fetchOptions??{},...p.fetchOptions??{}},{headers:C,method:j,signal:O}=w;try{const t=await E.withTimeout(async({signal:u})=>{const h={...w,body:Array.isArray(n)?d.stringify(n.map(m=>({jsonrpc:"2.0",id:m.id??q.idCache.take(),...m}))):d.stringify({jsonrpc:"2.0",id:n.id??q.idCache.take(),...n}),headers:{...a,"Content-Type":"application/json",...C},method:j||"POST",signal:O||(f>0?u:null)},S=new Request(r,h),y=await(c==null?void 0:c(S,h))??{...h,url:r};return await T(y.url??r,y)},{errorInstance:new o.TimeoutError({body:n,url:r}),timeout:f,signal:!0});l&&await l(t);let s;if((g=t.headers.get("Content-Type"))!=null&&g.startsWith("application/json"))s=await t.json();else{s=await t.text();try{s=JSON.parse(s||"{}")}catch(u){if(t.ok)throw u;s={error:s}}}if(!t.ok)throw new o.HttpRequestError({body:n,details:d.stringify(s.error)||t.statusText,headers:t.headers,status:t.status,url:r});return s}catch(t){throw t instanceof o.HttpRequestError||t instanceof o.TimeoutError?t:new o.HttpRequestError({body:n,cause:t,url:r})}}}}function R(i){try{const e=new URL(i),r=(()=>{if(e.username){const a=`${decodeURIComponent(e.username)}:${decodeURIComponent(e.password)}`;return e.username="",e.password="",{url:e.toString(),headers:{Authorization:`Basic ${btoa(a)}`}}}})();return{url:e.toString(),...r}}catch{return{url:i}}}exports.getHttpRpcClient=H;exports.parseUrl=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index153.cjs"),n=require("./index143.cjs");async function t({message:e,privateKey:s}){return await n.sign({hash:a.hashMessage(e),privateKey:s,to:"hex"})}exports.signMessage=t;
package/dist/index145.js CHANGED
@@ -1,93 +1,8 @@
1
- import { TimeoutError as R, HttpRequestError as h } from "./index143.js";
2
- import { withTimeout as S } from "./index195.js";
3
- import { stringify as p } from "./index91.js";
4
- import { idCache as C } from "./index237.js";
5
- function E(o, e = {}) {
6
- const { url: r, headers: a } = U(o);
7
- return {
8
- async request(d) {
9
- var w;
10
- const { body: s, fetchFn: T = e.fetchFn ?? fetch, onRequest: i = e.onRequest, onResponse: f = e.onResponse, timeout: l = e.timeout ?? 1e4 } = d, m = {
11
- ...e.fetchOptions ?? {},
12
- ...d.fetchOptions ?? {}
13
- }, { headers: j, method: O, signal: k } = m;
14
- try {
15
- const t = await S(async ({ signal: c }) => {
16
- const u = {
17
- ...m,
18
- body: Array.isArray(s) ? p(s.map((g) => ({
19
- jsonrpc: "2.0",
20
- id: g.id ?? C.take(),
21
- ...g
22
- }))) : p({
23
- jsonrpc: "2.0",
24
- id: s.id ?? C.take(),
25
- ...s
26
- }),
27
- headers: {
28
- ...a,
29
- "Content-Type": "application/json",
30
- ...j
31
- },
32
- method: O || "POST",
33
- signal: k || (l > 0 ? c : null)
34
- }, q = new Request(r, u), y = await (i == null ? void 0 : i(q, u)) ?? { ...u, url: r };
35
- return await T(y.url ?? r, y);
36
- }, {
37
- errorInstance: new R({ body: s, url: r }),
38
- timeout: l,
39
- signal: !0
40
- });
41
- f && await f(t);
42
- let n;
43
- if ((w = t.headers.get("Content-Type")) != null && w.startsWith("application/json"))
44
- n = await t.json();
45
- else {
46
- n = await t.text();
47
- try {
48
- n = JSON.parse(n || "{}");
49
- } catch (c) {
50
- if (t.ok)
51
- throw c;
52
- n = { error: n };
53
- }
54
- }
55
- if (!t.ok)
56
- throw new h({
57
- body: s,
58
- details: p(n.error) || t.statusText,
59
- headers: t.headers,
60
- status: t.status,
61
- url: r
62
- });
63
- return n;
64
- } catch (t) {
65
- throw t instanceof h || t instanceof R ? t : new h({
66
- body: s,
67
- cause: t,
68
- url: r
69
- });
70
- }
71
- }
72
- };
73
- }
74
- function U(o) {
75
- try {
76
- const e = new URL(o), r = (() => {
77
- if (e.username) {
78
- const a = `${decodeURIComponent(e.username)}:${decodeURIComponent(e.password)}`;
79
- return e.username = "", e.password = "", {
80
- url: e.toString(),
81
- headers: { Authorization: `Basic ${btoa(a)}` }
82
- };
83
- }
84
- })();
85
- return { url: e.toString(), ...r };
86
- } catch {
87
- return { url: o };
88
- }
1
+ import { hashMessage as e } from "./index153.js";
2
+ import { sign as o } from "./index143.js";
3
+ async function i({ message: s, privateKey: a }) {
4
+ return await o({ hash: e(s), privateKey: a, to: "hex" });
89
5
  }
90
6
  export {
91
- E as getHttpRpcClient,
92
- U as parseUrl
7
+ i as signMessage
93
8
  };
package/dist/index146.cjs CHANGED
@@ -1,2 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=`Ethereum Signed Message:
2
- `;exports.presignMessagePrefix=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index150.cjs"),c=require("./index154.cjs"),o=require("./index143.cjs");async function u(i){const{privateKey:n,transaction:a,serializer:e=c.serializeTransaction}=i,r=a.type==="eip4844"?{...a,sidecars:!1}:a,t=await o.sign({hash:s.keccak256(await e(r)),privateKey:n});return await e(a,t)}exports.signTransaction=u;
package/dist/index146.js CHANGED
@@ -1,5 +1,16 @@
1
- const e = `Ethereum Signed Message:
2
- `;
1
+ import { keccak256 as e } from "./index150.js";
2
+ import { serializeTransaction as o } from "./index154.js";
3
+ import { sign as c } from "./index143.js";
4
+ async function u(r) {
5
+ const { privateKey: t, transaction: a, serializer: i = o } = r, n = a.type === "eip4844" ? {
6
+ ...a,
7
+ sidecars: !1
8
+ } : a, s = await c({
9
+ hash: e(await i(n)),
10
+ privateKey: t
11
+ });
12
+ return await i(a, s);
13
+ }
3
14
  export {
4
- e as presignMessagePrefix
15
+ u as signTransaction
5
16
  };
package/dist/index147.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={gwei:9,wei:18},t={ether:-9,wei:9};exports.etherUnits=e;exports.gweiUnits=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index155.cjs"),s=require("./index143.cjs");async function i(e){const{privateKey:t,...a}=e;return await s.sign({hash:n.hashTypedData(a),privateKey:t,to:"hex"})}exports.signTypedData=i;
package/dist/index147.js CHANGED
@@ -1,11 +1,13 @@
1
- const e = {
2
- gwei: 9,
3
- wei: 18
4
- }, t = {
5
- ether: -9,
6
- wei: 9
7
- };
1
+ import { hashTypedData as o } from "./index155.js";
2
+ import { sign as r } from "./index143.js";
3
+ async function p(t) {
4
+ const { privateKey: a, ...e } = t;
5
+ return await r({
6
+ hash: o(e),
7
+ privateKey: a,
8
+ to: "hex"
9
+ });
10
+ }
8
11
  export {
9
- e as etherUnits,
10
- t as gweiUnits
12
+ p as signTypedData
11
13
  };
package/dist/index148.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index95.cjs");function i(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new o.InvalidDefinitionTypeError(t.type);return`${t.name}(${n(t.inputs,{includeName:e})})`}function n(t,{includeName:e=!1}={}){return t?t.map(r=>f(r,{includeName:e})).join(e?", ":","):""}function f(t,{includeName:e}){return t.type.startsWith("tuple")?`(${n(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}exports.formatAbiItem=i;exports.formatAbiParams=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index35.cjs");class r extends s.BaseError{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}exports.InvalidAddressError=r;
package/dist/index148.js CHANGED
@@ -1,16 +1,15 @@
1
- import { InvalidDefinitionTypeError as o } from "./index95.js";
2
- function u(t, { includeName: n = !1 } = {}) {
3
- if (t.type !== "function" && t.type !== "event" && t.type !== "error")
4
- throw new o(t.type);
5
- return `${t.name}(${e(t.inputs, { includeName: n })})`;
6
- }
7
- function e(t, { includeName: n = !1 } = {}) {
8
- return t ? t.map((r) => f(r, { includeName: n })).join(n ? ", " : ",") : "";
9
- }
10
- function f(t, { includeName: n }) {
11
- return t.type.startsWith("tuple") ? `(${e(t.components, { includeName: n })})${t.type.slice(5)}` : t.type + (n && t.name ? ` ${t.name}` : "");
1
+ import { BaseError as r } from "./index35.js";
2
+ class d extends r {
3
+ constructor({ address: s }) {
4
+ super(`Address "${s}" is invalid.`, {
5
+ metaMessages: [
6
+ "- Address must be a hex value of 20 bytes (40 hex characters).",
7
+ "- Address must match its checksum counterpart."
8
+ ],
9
+ name: "InvalidAddressError"
10
+ });
11
+ }
12
12
  }
13
13
  export {
14
- u as formatAbiItem,
15
- e as formatAbiParams
14
+ d as InvalidAddressError
16
15
  };
package/dist/index149.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index181.cjs");function i(e){return t.isHex(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}exports.size=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index116.cjs"),i=require("./index102.cjs"),o=/^0x[a-fA-F0-9]{40}$/,t=new c.LruMap(8192);function f(e,n){const{strict:s=!0}=n??{},r=`${e}.${s}`;if(t.has(r))return t.get(r);const u=o.test(e)?e.toLowerCase()===e?!0:s?i.checksumAddress(e)===e:!0:!1;return t.set(r,u),u}exports.isAddress=f;exports.isAddressCache=t;
package/dist/index149.js CHANGED
@@ -1,7 +1,14 @@
1
- import { isHex as r } from "./index181.js";
2
- function i(t) {
3
- return r(t, { strict: !1 }) ? Math.ceil((t.length - 2) / 2) : t.length;
1
+ import { LruMap as u } from "./index116.js";
2
+ import { checksumAddress as c } from "./index102.js";
3
+ const i = /^0x[a-fA-F0-9]{40}$/, r = /* @__PURE__ */ new u(8192);
4
+ function h(t, s) {
5
+ const { strict: n = !0 } = s ?? {}, e = `${t}.${n}`;
6
+ if (r.has(e))
7
+ return r.get(e);
8
+ const o = i.test(t) ? t.toLowerCase() === t ? !0 : n ? c(t) === t : !0 : !1;
9
+ return r.set(e, o), o;
4
10
  }
5
11
  export {
6
- i as size
12
+ h as isAddress,
13
+ r as isAddressCache
7
14
  };
package/dist/index150.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index35.cjs");class r extends s.BaseError{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}exports.InvalidAddressError=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index204.cjs"),o=require("./index151.cjs"),i=require("./index140.cjs"),n=require("./index42.cjs");function u(e,r){const s=r||"hex",t=c.keccak_256(o.isHex(e,{strict:!1})?i.toBytes(e):e);return s==="bytes"?t:n.toHex(t)}exports.keccak256=u;
package/dist/index150.js CHANGED
@@ -1,15 +1,11 @@
1
- import { BaseError as r } from "./index35.js";
2
- class d extends r {
3
- constructor({ address: s }) {
4
- super(`Address "${s}" is invalid.`, {
5
- metaMessages: [
6
- "- Address must be a hex value of 20 bytes (40 hex characters).",
7
- "- Address must match its checksum counterpart."
8
- ],
9
- name: "InvalidAddressError"
10
- });
11
- }
1
+ import { keccak_256 as c } from "./index204.js";
2
+ import { isHex as i } from "./index151.js";
3
+ import { toBytes as m } from "./index140.js";
4
+ import { toHex as s } from "./index42.js";
5
+ function x(t, r) {
6
+ const e = r || "hex", o = c(i(t, { strict: !1 }) ? m(t) : t);
7
+ return e === "bytes" ? o : s(o);
12
8
  }
13
9
  export {
14
- d as InvalidAddressError
10
+ x as keccak256
15
11
  };
package/dist/index151.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="2.44.4";exports.version=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}exports.isHex=r;
package/dist/index151.js CHANGED
@@ -1,4 +1,6 @@
1
- const o = "2.44.4";
1
+ function e(t, { strict: r = !0 } = {}) {
2
+ return !t || typeof t != "string" ? !1 : r ? /^0x[0-9a-fA-F]*$/.test(t) : t.startsWith("0x");
3
+ }
2
4
  export {
3
- o as version
5
+ e as isHex
4
6
  };
package/dist/index152.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},o={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},t={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};exports.panicReasons=e;exports.solidityError=o;exports.solidityPanic=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index120.cjs"),u=require("./index140.cjs"),c=require("./index42.cjs"),a=require("./index203.cjs"),h=require("./index150.cjs");function d(e){const{chainId:t,nonce:o,to:r}=e,s=e.contractAddress??e.address,n=h.keccak256(i.concatHex(["0x05",a.toRlp([t?c.numberToHex(t):"0x",s,o?c.numberToHex(o):"0x"])]));return r==="bytes"?u.hexToBytes(n):n}exports.hashAuthorization=d;
package/dist/index152.js CHANGED
@@ -1,34 +1,19 @@
1
- const e = {
2
- 1: "An `assert` condition failed.",
3
- 17: "Arithmetic operation resulted in underflow or overflow.",
4
- 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
5
- 33: "Attempted to convert to an invalid type.",
6
- 34: "Attempted to access a storage byte array that is incorrectly encoded.",
7
- 49: "Performed `.pop()` on an empty array",
8
- 50: "Array index is out of bounds.",
9
- 65: "Allocated too much memory or created an array which is too large.",
10
- 81: "Attempted to call a zero-initialized variable of internal function type."
11
- }, o = {
12
- inputs: [
13
- {
14
- name: "message",
15
- type: "string"
16
- }
17
- ],
18
- name: "Error",
19
- type: "error"
20
- }, t = {
21
- inputs: [
22
- {
23
- name: "reason",
24
- type: "uint256"
25
- }
26
- ],
27
- name: "Panic",
28
- type: "error"
29
- };
1
+ import { concatHex as i } from "./index120.js";
2
+ import { hexToBytes as m } from "./index140.js";
3
+ import { numberToHex as c } from "./index42.js";
4
+ import { toRlp as d } from "./index203.js";
5
+ import { keccak256 as f } from "./index150.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;
16
+ }
30
17
  export {
31
- e as panicReasons,
32
- o as solidityError,
33
- t as solidityPanic
18
+ b as hashAuthorization
34
19
  };
package/dist/index153.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index152.cjs"),n=require("./index95.cjs"),c=require("./index104.cjs"),u=require("./index170.cjs"),d=require("./index165.cjs"),l=require("./index148.cjs");function b(s){const{abi:a,data:t}=s,r=c.slice(t,0,4);if(r==="0x")throw new n.AbiDecodingZeroDataError;const e=[...a||[],i.solidityError,i.solidityPanic].find(o=>o.type==="error"&&r===u.toFunctionSelector(l.formatAbiItem(o)));if(!e)throw new n.AbiErrorSignatureNotFoundError(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:e,args:"inputs"in e&&e.inputs&&e.inputs.length>0?d.decodeAbiParameters(e.inputs,c.slice(t,4)):void 0,errorName:e.name}}exports.decodeErrorResult=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index150.cjs"),t=require("./index209.cjs");function a(e,s){return r.keccak256(t.toPrefixedMessage(e),s)}exports.hashMessage=a;
package/dist/index153.js CHANGED
@@ -1,24 +1,8 @@
1
- import { solidityError as m, solidityPanic as s } from "./index152.js";
2
- import { AbiDecodingZeroDataError as c, AbiErrorSignatureNotFoundError as d } from "./index95.js";
3
- import { slice as e } from "./index104.js";
4
- import { toFunctionSelector as u } from "./index170.js";
5
- import { decodeAbiParameters as f } from "./index165.js";
6
- import { formatAbiItem as p } from "./index148.js";
7
- function y(n) {
8
- const { abi: a, data: t } = n, o = e(t, 0, 4);
9
- if (o === "0x")
10
- throw new c();
11
- const r = [...a || [], m, s].find((i) => i.type === "error" && o === u(p(i)));
12
- if (!r)
13
- throw new d(o, {
14
- docsPath: "/docs/contract/decodeErrorResult"
15
- });
16
- return {
17
- abiItem: r,
18
- args: "inputs" in r && r.inputs && r.inputs.length > 0 ? f(r.inputs, e(t, 4)) : void 0,
19
- errorName: r.name
20
- };
1
+ import { keccak256 as o } from "./index150.js";
2
+ import { toPrefixedMessage as t } from "./index209.js";
3
+ function f(e, r) {
4
+ return o(t(e), r);
21
5
  }
22
6
  export {
23
- y as decodeErrorResult
7
+ f as hashMessage
24
8
  };
package/dist/index154.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index91.cjs");function o({abiItem:t,args:n,includeFunctionName:i=!0,includeName:u=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${i?t.name:""}(${t.inputs.map((r,e)=>`${u&&r.name?`${r.name}: `:""}${typeof n[e]=="object"?f.stringify(n[e]):n[e]}`).join(", ")})`}exports.formatAbiItemWithArgs=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("./index81.cjs"),G=require("./index215.cjs"),R=require("./index112.cjs"),S=require("./index113.cjs"),B=require("./index114.cjs"),V=require("./index115.cjs"),L=require("./index120.cjs"),h=require("./index105.cjs"),r=require("./index42.cjs"),d=require("./index203.cjs"),y=require("./index212.cjs"),C=require("./index117.cjs"),v=require("./index214.cjs");function k(e,o){const n=C.getTransactionType(e);return n==="eip1559"?_(e,o):n==="eip2930"?j(e,o):n==="eip4844"?Y(e,o):n==="eip7702"?w(e,o):M(e,o)}function w(e,o){const{authorizationList:n,chainId:s,gas:i,nonce:c,to:a,value:x,maxFeePerGas:u,maxPriorityFeePerGas:t,accessList:l,data:T}=e;y.assertTransactionEIP7702(e);const b=v.serializeAccessList(l),m=G.serializeAuthorizationList(n);return L.concatHex(["0x04",d.toRlp([r.numberToHex(s),c?r.numberToHex(c):"0x",t?r.numberToHex(t):"0x",u?r.numberToHex(u):"0x",i?r.numberToHex(i):"0x",a??"0x",x?r.numberToHex(x):"0x",T??"0x",b,m,...z(e,o)])])}function Y(e,o){const{chainId:n,gas:s,nonce:i,to:c,value:a,maxFeePerBlobGas:x,maxFeePerGas:u,maxPriorityFeePerGas:t,accessList:l,data:T}=e;y.assertTransactionEIP4844(e);let b=e.blobVersionedHashes,m=e.sidecars;if(e.blobs&&(typeof b>"u"||typeof m>"u")){const f=typeof e.blobs[0]=="string"?e.blobs:e.blobs.map(p=>r.bytesToHex(p)),P=e.kzg,H=R.blobsToCommitments({blobs:f,kzg:P});if(typeof b>"u"&&(b=B.commitmentsToVersionedHashes({commitments:H})),typeof m>"u"){const p=S.blobsToProofs({blobs:f,commitments:H,kzg:P});m=V.toBlobSidecars({blobs:f,commitments:H,proofs:p})}}const I=v.serializeAccessList(l),A=[r.numberToHex(n),i?r.numberToHex(i):"0x",t?r.numberToHex(t):"0x",u?r.numberToHex(u):"0x",s?r.numberToHex(s):"0x",c??"0x",a?r.numberToHex(a):"0x",T??"0x",I,x?r.numberToHex(x):"0x",b??[],...z(e,o)],q=[],g=[],E=[];if(m)for(let f=0;f<m.length;f++){const{blob:P,commitment:H,proof:p}=m[f];q.push(P),g.push(H),E.push(p)}return L.concatHex(["0x03",m?d.toRlp([A,q,g,E]):d.toRlp(A)])}function _(e,o){const{chainId:n,gas:s,nonce:i,to:c,value:a,maxFeePerGas:x,maxPriorityFeePerGas:u,accessList:t,data:l}=e;y.assertTransactionEIP1559(e);const T=v.serializeAccessList(t),b=[r.numberToHex(n),i?r.numberToHex(i):"0x",u?r.numberToHex(u):"0x",x?r.numberToHex(x):"0x",s?r.numberToHex(s):"0x",c??"0x",a?r.numberToHex(a):"0x",l??"0x",T,...z(e,o)];return L.concatHex(["0x02",d.toRlp(b)])}function j(e,o){const{chainId:n,gas:s,data:i,nonce:c,to:a,value:x,accessList:u,gasPrice:t}=e;y.assertTransactionEIP2930(e);const l=v.serializeAccessList(u),T=[r.numberToHex(n),c?r.numberToHex(c):"0x",t?r.numberToHex(t):"0x",s?r.numberToHex(s):"0x",a??"0x",x?r.numberToHex(x):"0x",i??"0x",l,...z(e,o)];return L.concatHex(["0x01",d.toRlp(T)])}function M(e,o){const{chainId:n=0,gas:s,data:i,nonce:c,to:a,value:x,gasPrice:u}=e;y.assertTransactionLegacy(e);let t=[c?r.numberToHex(c):"0x",u?r.numberToHex(u):"0x",s?r.numberToHex(s):"0x",a??"0x",x?r.numberToHex(x):"0x",i??"0x"];if(o){const l=(()=>{if(o.v>=35n)return(o.v-35n)/2n>0?o.v:27n+(o.v===35n?0n:1n);if(n>0)return BigInt(n*2)+BigInt(35n+o.v-27n);const m=27n+(o.v===27n?0n:1n);if(o.v!==m)throw new F.InvalidLegacyVError({v:o.v});return m})(),T=h.trim(o.r),b=h.trim(o.s);t=[...t,r.numberToHex(l),T==="0x00"?"0x":T,b==="0x00"?"0x":b]}else n>0&&(t=[...t,r.numberToHex(n),"0x","0x"]);return d.toRlp(t)}function z(e,o){const n=o??e,{v:s,yParity:i}=n;if(typeof n.r>"u")return[];if(typeof n.s>"u")return[];if(typeof s>"u"&&typeof i>"u")return[];const c=h.trim(n.r),a=h.trim(n.s);return[typeof i=="number"?i?r.numberToHex(1):"0x":s===0n?"0x":s===1n?r.numberToHex(1):s===27n?"0x":r.numberToHex(1),c==="0x00"?"0x":c,a==="0x00"?"0x":a]}exports.serializeTransaction=k;exports.toYParitySignatureArray=z;