@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/index208.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index42.cjs"),c=require("./index207.cjs");function u(t){if(!t||t.length===0)return[];const e=[];for(const r of t){const{chainId:i,nonce:o,...s}=r,a=r.address;e.push([i?n.toHex(i):"0x",a,o?n.toHex(o):"0x",...c.toYParitySignatureArray({},s)])}return e}exports.serializeAuthorizationList=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function u(n,{errorInstance:r=new Error("timed out"),timeout:i,signal:a}){return new Promise((l,e)=>{(async()=>{let o;try{const t=new AbortController;i>0&&(o=setTimeout(()=>{a&&t.abort()},i)),l(await n({signal:(t==null?void 0:t.signal)||null}))}catch(t){(t==null?void 0:t.name)==="AbortError"&&e(r),e(t)}finally{clearTimeout(o)}})()})}exports.withTimeout=u;
package/dist/index208.js CHANGED
@@ -1,20 +1,20 @@
1
- import { toHex as i } from "./index42.js";
2
- import { toYParitySignatureArray as c } from "./index207.js";
3
- function f(r) {
4
- if (!r || r.length === 0)
5
- return [];
6
- const t = [];
7
- for (const o of r) {
8
- const { chainId: n, nonce: e, ...s } = o, a = o.address;
9
- t.push([
10
- n ? i(n) : "0x",
11
- a,
12
- e ? i(e) : "0x",
13
- ...c({}, s)
14
- ]);
15
- }
16
- return t;
1
+ function u(r, { errorInstance: e = new Error("timed out"), timeout: i, signal: a }) {
2
+ return new Promise((l, n) => {
3
+ (async () => {
4
+ let o;
5
+ try {
6
+ const t = new AbortController();
7
+ i > 0 && (o = setTimeout(() => {
8
+ a && t.abort();
9
+ }, i)), l(await r({ signal: (t == null ? void 0 : t.signal) || null }));
10
+ } catch (t) {
11
+ (t == null ? void 0 : t.name) === "AbortError" && n(e), n(t);
12
+ } finally {
13
+ clearTimeout(o);
14
+ }
15
+ })();
16
+ });
17
17
  }
18
18
  export {
19
- f as serializeAuthorizationList
19
+ u as withTimeout
20
20
  };
package/dist/index209.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(r,i){let t=r.toString();const n=t.startsWith("-");n&&(t=t.slice(1)),t=t.padStart(i,"0");let[l,e]=[t.slice(0,t.length-i),t.slice(t.length-i)];return e=e.replace(/(0+)$/,""),`${n?"-":""}${l||"0"}${e?`.${e}`:""}`}exports.formatUnits=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index164.cjs"),o=require("./index120.cjs"),s=require("./index167.cjs"),r=require("./index42.cjs");function c(e){const t=typeof e=="string"?r.stringToHex(e):typeof e.raw=="string"?e.raw:r.bytesToHex(e.raw),i=r.stringToHex(`${n.presignMessagePrefix}${s.size(t)}`);return o.concat([i,t])}exports.toPrefixedMessage=c;
package/dist/index209.js CHANGED
@@ -1,13 +1,11 @@
1
- function a(r, n) {
2
- let t = r.toString();
3
- const i = t.startsWith("-");
4
- i && (t = t.slice(1)), t = t.padStart(n, "0");
5
- let [l, e] = [
6
- t.slice(0, t.length - n),
7
- t.slice(t.length - n)
8
- ];
9
- return e = e.replace(/(0+)$/, ""), `${i ? "-" : ""}${l || "0"}${e ? `.${e}` : ""}`;
1
+ import { presignMessagePrefix as e } from "./index164.js";
2
+ import { concat as n } from "./index120.js";
3
+ import { size as f } from "./index167.js";
4
+ import { stringToHex as o, bytesToHex as p } from "./index42.js";
5
+ function u(r) {
6
+ const t = typeof r == "string" ? o(r) : typeof r.raw == "string" ? r.raw : p(r.raw), i = o(`${e}${f(t)}`);
7
+ return n([i, t]);
10
8
  }
11
9
  export {
12
- a as formatUnits
10
+ u as toPrefixedMessage
13
11
  };
package/dist/index210.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index150.cjs"),t=require("./index174.cjs");function i(s){if(typeof s=="string"){if(!t.isAddress(s,{strict:!1}))throw new n.InvalidAddressError({address:s});return{address:s,type:"json-rpc"}}if(!t.isAddress(s.address,{strict:!1}))throw new n.InvalidAddressError({address:s.address});return{address:s.address,nonceManager:s.nonceManager,sign:s.sign,signAuthorization:s.signAuthorization,signMessage:s.signMessage,signTransaction:s.signTransaction,signTypedData:s.signTypedData,source:"custom",type:"local"}}exports.toAccount=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index142.cjs"),o=require("./index211.cjs");async function s({hash:e,signature:r}){return c.publicKeyToAddress(await o.recoverPublicKey({hash:e,signature:r}))}exports.recoverAddress=s;
package/dist/index210.js CHANGED
@@ -1,28 +1,8 @@
1
- import { InvalidAddressError as s } from "./index150.js";
2
- import { isAddress as a } from "./index174.js";
3
- function r(n) {
4
- if (typeof n == "string") {
5
- if (!a(n, { strict: !1 }))
6
- throw new s({ address: n });
7
- return {
8
- address: n,
9
- type: "json-rpc"
10
- };
11
- }
12
- if (!a(n.address, { strict: !1 }))
13
- throw new s({ address: n.address });
14
- return {
15
- address: n.address,
16
- nonceManager: n.nonceManager,
17
- sign: n.sign,
18
- signAuthorization: n.signAuthorization,
19
- signMessage: n.signMessage,
20
- signTransaction: n.signTransaction,
21
- signTypedData: n.signTypedData,
22
- source: "custom",
23
- type: "local"
24
- };
1
+ import { publicKeyToAddress as o } from "./index142.js";
2
+ import { recoverPublicKey as c } from "./index211.js";
3
+ async function s({ hash: r, signature: e }) {
4
+ return o(await c({ hash: r, signature: e }));
25
5
  }
26
6
  export {
27
- r as toAccount
7
+ s as recoverAddress
28
8
  };
package/dist/index211.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index202.cjs"),l=require("./index181.cjs"),y=require("./index168.cjs"),i=require("./index42.cjs"),x=require("./index203.cjs");let r=!1;async function g({hash:n,privateKey:o,to:e="object"}){const{r:c,s:u,recovery:t}=a.secp256k1.sign(n.slice(2),o.slice(2),{lowS:!0,extraEntropy:l.isHex(r,{strict:!1})?y.hexToBytes(r):r}),s={r:i.numberToHex(c,{size:32}),s:i.numberToHex(u,{size:32}),v:t?28n:27n,yParity:t};return e==="bytes"||e==="hex"?x.serializeSignature({...s,to:e}):s}exports.sign=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index151.cjs"),d=require("./index167.cjs"),o=require("./index65.cjs"),c=require("./index42.cjs");async function g({hash:e,signature:r}){const u=n.isHex(e)?e:c.toHex(e),{secp256k1:i}=await Promise.resolve().then(()=>require("./index139.cjs"));return`0x${(()=>{if(typeof r=="object"&&"r"in r&&"s"in r){const{r:v,s:y,v:b,yParity:f}=r,a=Number(f??b),H=s(a);return new i.Signature(o.hexToBigInt(v),o.hexToBigInt(y)).addRecoveryBit(H)}const t=n.isHex(r)?r:c.toHex(r);if(d.size(t)!==65)throw new Error("invalid signature length");const l=o.hexToNumber(`0x${t.slice(130)}`),x=s(l);return i.Signature.fromCompact(t.substring(2,130)).addRecoveryBit(x)})().recoverPublicKey(u.substring(2)).toHex(!1)}`}function s(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}exports.recoverPublicKey=g;
package/dist/index211.js CHANGED
@@ -1,21 +1,30 @@
1
- import { secp256k1 as a } from "./index202.js";
2
- import { isHex as f } from "./index181.js";
3
- import { hexToBytes as p } from "./index168.js";
4
- import { numberToHex as s } from "./index42.js";
5
- import { serializeSignature as u } from "./index203.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;
1
+ import { isHex as i } from "./index151.js";
2
+ import { size as b } from "./index167.js";
3
+ import { hexToBigInt as n, hexToNumber as d } from "./index65.js";
4
+ import { toHex as c } from "./index42.js";
5
+ async function R({ hash: r, signature: e }) {
6
+ const u = i(r) ? r : c(r), { secp256k1: t } = await import("./index139.js");
7
+ return `0x${(() => {
8
+ if (typeof e == "object" && "r" in e && "s" in e) {
9
+ const { r: p, s: v, v: y, yParity: l } = e, x = Number(l ?? y), a = s(x);
10
+ return new t.Signature(n(p), n(v)).addRecoveryBit(a);
11
+ }
12
+ const o = i(e) ? e : c(e);
13
+ if (b(o) !== 65)
14
+ throw new Error("invalid signature length");
15
+ const f = d(`0x${o.slice(130)}`), m = s(f);
16
+ return t.Signature.fromCompact(o.substring(2, 130)).addRecoveryBit(m);
17
+ })().recoverPublicKey(u.substring(2)).toHex(!1)}`;
18
+ }
19
+ function s(r) {
20
+ if (r === 0 || r === 1)
21
+ return r;
22
+ if (r === 27)
23
+ return 0;
24
+ if (r === 28)
25
+ return 1;
26
+ throw new Error("Invalid yParityOrV value");
18
27
  }
19
28
  export {
20
- z as sign
29
+ R as recoverPublicKey
21
30
  };
package/dist/index212.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index216.cjs"),a=require("./index211.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./index213.cjs"),w=require("./index19.cjs"),t=require("./index148.cjs"),P=require("./index35.cjs"),h=require("./index199.cjs"),d=require("./index36.cjs"),n=require("./index180.cjs"),c=require("./index149.cjs"),I=require("./index167.cjs"),u=require("./index104.cjs"),l=require("./index65.cjs");function m(o){const{authorizationList:e}=o;if(e)for(const s of e){const{chainId:r}=s,i=s.address;if(!c.isAddress(i))throw new t.InvalidAddressError({address:i});if(r<0)throw new d.InvalidChainIdError({chainId:r})}f(o)}function T(o){const{blobVersionedHashes:e}=o;if(e){if(e.length===0)throw new h.EmptyBlobError;for(const s of e){const r=I.size(s),i=l.hexToNumber(u.slice(s,0,1));if(r!==32)throw new h.InvalidVersionedHashSizeError({hash:s,size:r});if(i!==E.versionedHashVersionKzg)throw new h.InvalidVersionedHashVersionError({hash:s,version:i})}}f(o)}function f(o){const{chainId:e,maxPriorityFeePerGas:s,maxFeePerGas:r,to:i}=o;if(e<=0)throw new d.InvalidChainIdError({chainId:e});if(i&&!c.isAddress(i))throw new t.InvalidAddressError({address:i});if(r&&r>w.maxUint256)throw new n.FeeCapTooHighError({maxFeePerGas:r});if(s&&r&&s>r)throw new n.TipAboveFeeCapError({maxFeePerGas:r,maxPriorityFeePerGas:s})}function x(o){const{chainId:e,maxPriorityFeePerGas:s,gasPrice:r,maxFeePerGas:i,to:a}=o;if(e<=0)throw new d.InvalidChainIdError({chainId:e});if(a&&!c.isAddress(a))throw new t.InvalidAddressError({address:a});if(s||i)throw new P.BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(r&&r>w.maxUint256)throw new n.FeeCapTooHighError({maxFeePerGas:r})}function v(o){const{chainId:e,maxPriorityFeePerGas:s,gasPrice:r,maxFeePerGas:i,to:a}=o;if(a&&!c.isAddress(a))throw new t.InvalidAddressError({address:a});if(typeof e<"u"&&e<=0)throw new d.InvalidChainIdError({chainId:e});if(s||i)throw new P.BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(r&&r>w.maxUint256)throw new n.FeeCapTooHighError({maxFeePerGas:r})}exports.assertTransactionEIP1559=f;exports.assertTransactionEIP2930=x;exports.assertTransactionEIP4844=T;exports.assertTransactionEIP7702=m;exports.assertTransactionLegacy=v;
package/dist/index212.js CHANGED
@@ -1,18 +1,81 @@
1
- import { hashAuthorization as a } from "./index216.js";
2
- import { sign as e } from "./index211.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;
1
+ import { versionedHashVersionKzg as c } from "./index213.js";
2
+ import { maxUint256 as m } from "./index19.js";
3
+ import { InvalidAddressError as s } from "./index148.js";
4
+ import { BaseError as h } from "./index35.js";
5
+ import { EmptyBlobError as P, InvalidVersionedHashSizeError as p, InvalidVersionedHashVersionError as x } from "./index199.js";
6
+ import { InvalidChainIdError as n } from "./index36.js";
7
+ import { FeeCapTooHighError as w, TipAboveFeeCapError as E } from "./index180.js";
8
+ import { isAddress as f } from "./index149.js";
9
+ import { size as F } from "./index167.js";
10
+ import { slice as I } from "./index104.js";
11
+ import { hexToNumber as G } from "./index65.js";
12
+ function C(t) {
13
+ const { authorizationList: e } = t;
14
+ if (e)
15
+ for (const o of e) {
16
+ const { chainId: r } = o, i = o.address;
17
+ if (!f(i))
18
+ throw new s({ address: i });
19
+ if (r < 0)
20
+ throw new n({ chainId: r });
21
+ }
22
+ d(t);
23
+ }
24
+ function L(t) {
25
+ const { blobVersionedHashes: e } = t;
26
+ if (e) {
27
+ if (e.length === 0)
28
+ throw new P();
29
+ for (const o of e) {
30
+ const r = F(o), i = G(I(o, 0, 1));
31
+ if (r !== 32)
32
+ throw new p({ hash: o, size: r });
33
+ if (i !== c)
34
+ throw new x({
35
+ hash: o,
36
+ version: i
37
+ });
38
+ }
39
+ }
40
+ d(t);
41
+ }
42
+ function d(t) {
43
+ const { chainId: e, maxPriorityFeePerGas: o, maxFeePerGas: r, to: i } = t;
44
+ if (e <= 0)
45
+ throw new n({ chainId: e });
46
+ if (i && !f(i))
47
+ throw new s({ address: i });
48
+ if (r && r > m)
49
+ throw new w({ maxFeePerGas: r });
50
+ if (o && r && o > r)
51
+ throw new E({ maxFeePerGas: r, maxPriorityFeePerGas: o });
52
+ }
53
+ function B(t) {
54
+ const { chainId: e, maxPriorityFeePerGas: o, gasPrice: r, maxFeePerGas: i, to: a } = t;
55
+ if (e <= 0)
56
+ throw new n({ chainId: e });
57
+ if (a && !f(a))
58
+ throw new s({ address: a });
59
+ if (o || i)
60
+ throw new h("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");
61
+ if (r && r > m)
62
+ throw new w({ maxFeePerGas: r });
63
+ }
64
+ function K(t) {
65
+ const { chainId: e, maxPriorityFeePerGas: o, gasPrice: r, maxFeePerGas: i, to: a } = t;
66
+ if (a && !f(a))
67
+ throw new s({ address: a });
68
+ if (typeof e < "u" && e <= 0)
69
+ throw new n({ chainId: e });
70
+ if (o || i)
71
+ throw new h("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");
72
+ if (r && r > m)
73
+ throw new w({ maxFeePerGas: r });
15
74
  }
16
75
  export {
17
- u as signAuthorization
76
+ d as assertTransactionEIP1559,
77
+ B as assertTransactionEIP2930,
78
+ L as assertTransactionEIP4844,
79
+ C as assertTransactionEIP7702,
80
+ K as assertTransactionLegacy
18
81
  };
package/dist/index213.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index196.cjs"),n=require("./index211.cjs");async function t({message:e,privateKey:s}){return await n.sign({hash:a.hashMessage(e),privateKey:s,to:"hex"})}exports.signMessage=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=1;exports.versionedHashVersionKzg=e;
package/dist/index213.js CHANGED
@@ -1,8 +1,4 @@
1
- import { hashMessage as e } from "./index196.js";
2
- import { sign as o } from "./index211.js";
3
- async function i({ message: s, privateKey: a }) {
4
- return await o({ hash: e(s), privateKey: a, to: "hex" });
5
- }
1
+ const e = 1;
6
2
  export {
7
- i as signMessage
3
+ e as versionedHashVersionKzg
8
4
  };
package/dist/index214.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index178.cjs"),c=require("./index207.cjs"),o=require("./index211.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index148.cjs"),d=require("./index81.cjs"),l=require("./index149.cjs");function a(e){if(!e||e.length===0)return[];const n=[];for(let t=0;t<e.length;t++){const{address:i,storageKeys:r}=e[t];for(let s=0;s<r.length;s++)if(r[s].length-2!==64)throw new d.InvalidStorageKeySizeError({storageKey:r[s]});if(!l.isAddress(i,{strict:!1}))throw new o.InvalidAddressError({address:i});n.push([i,r])}return n}exports.serializeAccessList=a;
package/dist/index214.js CHANGED
@@ -1,16 +1,21 @@
1
- import { keccak256 as e } from "./index178.js";
2
- import { serializeTransaction as o } from "./index207.js";
3
- import { sign as c } from "./index211.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);
1
+ import { InvalidAddressError as s } from "./index148.js";
2
+ import { InvalidStorageKeySizeError as l } from "./index81.js";
3
+ import { isAddress as f } from "./index149.js";
4
+ function a(r) {
5
+ if (!r || r.length === 0)
6
+ return [];
7
+ const n = [];
8
+ for (let o = 0; o < r.length; o++) {
9
+ const { address: i, storageKeys: e } = r[o];
10
+ for (let t = 0; t < e.length; t++)
11
+ if (e[t].length - 2 !== 64)
12
+ throw new l({ storageKey: e[t] });
13
+ if (!f(i, { strict: !1 }))
14
+ throw new s({ address: i });
15
+ n.push([i, e]);
16
+ }
17
+ return n;
13
18
  }
14
19
  export {
15
- u as signTransaction
20
+ a as serializeAccessList
16
21
  };
package/dist/index215.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index198.cjs"),s=require("./index211.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index42.cjs"),c=require("./index154.cjs");function u(t){if(!t||t.length===0)return[];const e=[];for(const r of t){const{chainId:i,nonce:o,...s}=r,a=r.address;e.push([i?n.toHex(i):"0x",a,o?n.toHex(o):"0x",...c.toYParitySignatureArray({},s)])}return e}exports.serializeAuthorizationList=u;
package/dist/index215.js CHANGED
@@ -1,13 +1,20 @@
1
- import { hashTypedData as o } from "./index198.js";
2
- import { sign as r } from "./index211.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
- });
1
+ import { toHex as i } from "./index42.js";
2
+ import { toYParitySignatureArray as c } from "./index154.js";
3
+ function f(r) {
4
+ if (!r || r.length === 0)
5
+ return [];
6
+ const t = [];
7
+ for (const o of r) {
8
+ const { chainId: n, nonce: e, ...s } = o, a = o.address;
9
+ t.push([
10
+ n ? i(n) : "0x",
11
+ a,
12
+ e ? i(e) : "0x",
13
+ ...c({}, s)
14
+ ]);
15
+ }
16
+ return t;
10
17
  }
11
18
  export {
12
- p as signTypedData
19
+ f as serializeAuthorizationList
13
20
  };
package/dist/index216.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index120.cjs"),u=require("./index168.cjs"),c=require("./index42.cjs"),a=require("./index190.cjs"),h=require("./index178.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(r,i){let t=r.toString();const n=t.startsWith("-");n&&(t=t.slice(1)),t=t.padStart(i,"0");let[l,e]=[t.slice(0,t.length-i),t.slice(t.length-i)];return e=e.replace(/(0+)$/,""),`${n?"-":""}${l||"0"}${e?`.${e}`:""}`}exports.formatUnits=o;
package/dist/index216.js CHANGED
@@ -1,19 +1,13 @@
1
- import { concatHex as i } from "./index120.js";
2
- import { hexToBytes as m } from "./index168.js";
3
- import { numberToHex as c } from "./index42.js";
4
- import { toRlp as d } from "./index190.js";
5
- import { keccak256 as f } from "./index178.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
+ function a(r, n) {
2
+ let t = r.toString();
3
+ const i = t.startsWith("-");
4
+ i && (t = t.slice(1)), t = t.padStart(n, "0");
5
+ let [l, e] = [
6
+ t.slice(0, t.length - n),
7
+ t.slice(t.length - n)
8
+ ];
9
+ return e = e.replace(/(0+)$/, ""), `${i ? "-" : ""}${l || "0"}${e ? `.${e}` : ""}`;
16
10
  }
17
11
  export {
18
- b as hashAuthorization
12
+ a as formatUnits
19
13
  };
package/dist/index217.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index35.cjs");class t extends a.BaseError{constructor(e){const{docsPath:s,field:r,metaMessages:i}=e;super(`Invalid Sign-In with Ethereum message field "${r}".`,{docsPath:s,metaMessages:i,name:"SiweInvalidMessageFieldError"})}}exports.SiweInvalidMessageFieldError=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index35.cjs"),o=require("./index180.cjs");function s(n,e){const t=(n.details||"").toLowerCase(),i=n instanceof c.BaseError?n.walk(r=>(r==null?void 0:r.code)===o.ExecutionRevertedError.code):n;return i instanceof c.BaseError?new o.ExecutionRevertedError({cause:n,message:i.details}):o.ExecutionRevertedError.nodeMessage.test(t)?new o.ExecutionRevertedError({cause:n,message:n.details}):o.FeeCapTooHighError.nodeMessage.test(t)?new o.FeeCapTooHighError({cause:n,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):o.FeeCapTooLowError.nodeMessage.test(t)?new o.FeeCapTooLowError({cause:n,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):o.NonceTooHighError.nodeMessage.test(t)?new o.NonceTooHighError({cause:n,nonce:e==null?void 0:e.nonce}):o.NonceTooLowError.nodeMessage.test(t)?new o.NonceTooLowError({cause:n,nonce:e==null?void 0:e.nonce}):o.NonceMaxValueError.nodeMessage.test(t)?new o.NonceMaxValueError({cause:n,nonce:e==null?void 0:e.nonce}):o.InsufficientFundsError.nodeMessage.test(t)?new o.InsufficientFundsError({cause:n}):o.IntrinsicGasTooHighError.nodeMessage.test(t)?new o.IntrinsicGasTooHighError({cause:n,gas:e==null?void 0:e.gas}):o.IntrinsicGasTooLowError.nodeMessage.test(t)?new o.IntrinsicGasTooLowError({cause:n,gas:e==null?void 0:e.gas}):o.TransactionTypeNotSupportedError.nodeMessage.test(t)?new o.TransactionTypeNotSupportedError({cause:n}):o.TipAboveFeeCapError.nodeMessage.test(t)?new o.TipAboveFeeCapError({cause:n,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new o.UnknownNodeError({cause:n})}exports.getNodeError=s;
package/dist/index217.js CHANGED
@@ -1,14 +1,27 @@
1
- import { BaseError as i } from "./index35.js";
2
- class d extends i {
3
- constructor(e) {
4
- const { docsPath: s, field: r, metaMessages: a } = e;
5
- super(`Invalid Sign-In with Ethereum message field "${r}".`, {
6
- docsPath: s,
7
- metaMessages: a,
8
- name: "SiweInvalidMessageFieldError"
9
- });
10
- }
1
+ import { BaseError as c } from "./index35.js";
2
+ import { ExecutionRevertedError as t, FeeCapTooHighError as u, FeeCapTooLowError as d, NonceTooHighError as a, NonceTooLowError as f, NonceMaxValueError as w, InsufficientFundsError as r, IntrinsicGasTooHighError as E, IntrinsicGasTooLowError as m, TransactionTypeNotSupportedError as x, TipAboveFeeCapError as F, UnknownNodeError as M } from "./index180.js";
3
+ function P(o, e) {
4
+ const n = (o.details || "").toLowerCase(), s = o instanceof c ? o.walk((i) => (i == null ? void 0 : i.code) === t.code) : o;
5
+ return s instanceof c ? new t({
6
+ cause: o,
7
+ message: s.details
8
+ }) : t.nodeMessage.test(n) ? new t({
9
+ cause: o,
10
+ message: o.details
11
+ }) : u.nodeMessage.test(n) ? new u({
12
+ cause: o,
13
+ maxFeePerGas: e == null ? void 0 : e.maxFeePerGas
14
+ }) : d.nodeMessage.test(n) ? new d({
15
+ cause: o,
16
+ maxFeePerGas: e == null ? void 0 : e.maxFeePerGas
17
+ }) : a.nodeMessage.test(n) ? new a({ cause: o, nonce: e == null ? void 0 : e.nonce }) : f.nodeMessage.test(n) ? new f({ cause: o, nonce: e == null ? void 0 : e.nonce }) : w.nodeMessage.test(n) ? new w({ cause: o, nonce: e == null ? void 0 : e.nonce }) : r.nodeMessage.test(n) ? new r({ cause: o }) : E.nodeMessage.test(n) ? new E({ cause: o, gas: e == null ? void 0 : e.gas }) : m.nodeMessage.test(n) ? new m({ cause: o, gas: e == null ? void 0 : e.gas }) : x.nodeMessage.test(n) ? new x({ cause: o }) : F.nodeMessage.test(n) ? new F({
18
+ cause: o,
19
+ maxFeePerGas: e == null ? void 0 : e.maxFeePerGas,
20
+ maxPriorityFeePerGas: e == null ? void 0 : e.maxPriorityFeePerGas
21
+ }) : new M({
22
+ cause: o
23
+ });
11
24
  }
12
25
  export {
13
- d as SiweInvalidMessageFieldError
26
+ P as getNodeError
14
27
  };
package/dist/index218.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(e){if(/[^a-z0-9:/?#[\]@!$&'()*+,;=.\-_~%]/i.test(e)||/%[^0-9a-f]/i.test(e)||/%[0-9a-f](:?[^0-9a-f]|$)/i.test(e))return!1;const s=a(e),f=s[1],t=s[2],i=s[3],r=s[4],l=s[5];if(!(f!=null&&f.length&&i.length>=0))return!1;if(t!=null&&t.length){if(!(i.length===0||/^\//.test(i)))return!1}else if(/^\/\//.test(i))return!1;if(!/^[a-z][a-z0-9+\-.]*$/.test(f.toLowerCase()))return!1;let n="";return n+=`${f}:`,t!=null&&t.length&&(n+=`//${t}`),n+=i,r!=null&&r.length&&(n+=`?${r}`),l!=null&&l.length&&(n+=`#${l}`),n}function a(e){return e.match(/(?:([^:/?#]+):)?(?:\/\/([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)}exports.isUri=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index250.cjs"),f=require("./index251.cjs");function l(t,i={}){const{signed:n,size:e}=i,s=BigInt(t);let r;e?n?r=(1n<<BigInt(e)*8n-1n)-1n:r=2n**(BigInt(e)*8n)-1n:typeof t=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const u=typeof r=="bigint"&&n?-r-1n:0;if(r&&s>r||s<u){const o=typeof t=="bigint"?"n":"";throw new d({max:r?`${r}${o}`:void 0,min:`${u}${o}`,signed:n,size:e,value:`${t}${o}`})}const a=`0x${(n&&s<0?BigInt.asUintN(e*8,BigInt(s)):s).toString(16)}`;return e?c(a,e):a}function c(t,i){return f.pad(t,{dir:"left",size:i})}class d extends g.BaseError{constructor({max:i,min:n,signed:e,size:s,value:r}){super(`Number \`${r}\` is not in safe${s?` ${s*8}-bit`:""}${e?" signed":" unsigned"} integer range ${i?`(\`${n}\` to \`${i}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class b extends g.BaseError{constructor({size:i,targetSize:n,type:e}){super(`${e.charAt(0).toUpperCase()}${e.slice(1).toLowerCase()} size (\`${i}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}exports.IntegerOutOfRangeError=d;exports.SizeExceedsPaddingSizeError=b;exports.fromNumber=l;exports.padLeft=c;
package/dist/index218.js CHANGED
@@ -1,22 +1,49 @@
1
- function o(e) {
2
- if (/[^a-z0-9:/?#[\]@!$&'()*+,;=.\-_~%]/i.test(e) || /%[^0-9a-f]/i.test(e) || /%[0-9a-f](:?[^0-9a-f]|$)/i.test(e))
3
- return !1;
4
- const s = a(e), f = s[1], t = s[2], i = s[3], r = s[4], l = s[5];
5
- if (!(f != null && f.length && i.length >= 0))
6
- return !1;
7
- if (t != null && t.length) {
8
- if (!(i.length === 0 || /^\//.test(i)))
9
- return !1;
10
- } else if (/^\/\//.test(i))
11
- return !1;
12
- if (!/^[a-z][a-z0-9+\-.]*$/.test(f.toLowerCase()))
13
- return !1;
14
- let n = "";
15
- return n += `${f}:`, t != null && t.length && (n += `//${t}`), n += i, r != null && r.length && (n += `?${r}`), l != null && l.length && (n += `#${l}`), n;
1
+ import { BaseError as f } from "./index250.js";
2
+ import { pad as g } from "./index251.js";
3
+ function m(t, i = {}) {
4
+ const { signed: r, size: e } = i, o = BigInt(t);
5
+ let n;
6
+ e ? r ? n = (1n << BigInt(e) * 8n - 1n) - 1n : n = 2n ** (BigInt(e) * 8n) - 1n : typeof t == "number" && (n = BigInt(Number.MAX_SAFE_INTEGER));
7
+ const u = typeof n == "bigint" && r ? -n - 1n : 0;
8
+ if (n && o > n || o < u) {
9
+ const s = typeof t == "bigint" ? "n" : "";
10
+ throw new d({
11
+ max: n ? `${n}${s}` : void 0,
12
+ min: `${u}${s}`,
13
+ signed: r,
14
+ size: e,
15
+ value: `${t}${s}`
16
+ });
17
+ }
18
+ const a = `0x${(r && o < 0 ? BigInt.asUintN(e * 8, BigInt(o)) : o).toString(16)}`;
19
+ return e ? c(a, e) : a;
16
20
  }
17
- function a(e) {
18
- return e.match(/(?:([^:/?#]+):)?(?:\/\/([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);
21
+ function c(t, i) {
22
+ return g(t, { dir: "left", size: i });
23
+ }
24
+ class d extends f {
25
+ constructor({ max: i, min: r, signed: e, size: o, value: n }) {
26
+ super(`Number \`${n}\` is not in safe${o ? ` ${o * 8}-bit` : ""}${e ? " signed" : " unsigned"} integer range ${i ? `(\`${r}\` to \`${i}\`)` : `(above \`${r}\`)`}`), Object.defineProperty(this, "name", {
27
+ enumerable: !0,
28
+ configurable: !0,
29
+ writable: !0,
30
+ value: "Hex.IntegerOutOfRangeError"
31
+ });
32
+ }
33
+ }
34
+ class p extends f {
35
+ constructor({ size: i, targetSize: r, type: e }) {
36
+ super(`${e.charAt(0).toUpperCase()}${e.slice(1).toLowerCase()} size (\`${i}\`) exceeds padding size (\`${r}\`).`), Object.defineProperty(this, "name", {
37
+ enumerable: !0,
38
+ configurable: !0,
39
+ writable: !0,
40
+ value: "Hex.SizeExceedsPaddingSizeError"
41
+ });
42
+ }
19
43
  }
20
44
  export {
21
- o as isUri
45
+ d as IntegerOutOfRangeError,
46
+ p as SizeExceedsPaddingSizeError,
47
+ m as fromNumber,
48
+ c as padLeft
22
49
  };
package/dist/index219.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index35.cjs"),o=require("./index163.cjs");function s(n,e){const t=(n.details||"").toLowerCase(),i=n instanceof c.BaseError?n.walk(r=>(r==null?void 0:r.code)===o.ExecutionRevertedError.code):n;return i instanceof c.BaseError?new o.ExecutionRevertedError({cause:n,message:i.details}):o.ExecutionRevertedError.nodeMessage.test(t)?new o.ExecutionRevertedError({cause:n,message:n.details}):o.FeeCapTooHighError.nodeMessage.test(t)?new o.FeeCapTooHighError({cause:n,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):o.FeeCapTooLowError.nodeMessage.test(t)?new o.FeeCapTooLowError({cause:n,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):o.NonceTooHighError.nodeMessage.test(t)?new o.NonceTooHighError({cause:n,nonce:e==null?void 0:e.nonce}):o.NonceTooLowError.nodeMessage.test(t)?new o.NonceTooLowError({cause:n,nonce:e==null?void 0:e.nonce}):o.NonceMaxValueError.nodeMessage.test(t)?new o.NonceMaxValueError({cause:n,nonce:e==null?void 0:e.nonce}):o.InsufficientFundsError.nodeMessage.test(t)?new o.InsufficientFundsError({cause:n}):o.IntrinsicGasTooHighError.nodeMessage.test(t)?new o.IntrinsicGasTooHighError({cause:n,gas:e==null?void 0:e.gas}):o.IntrinsicGasTooLowError.nodeMessage.test(t)?new o.IntrinsicGasTooLowError({cause:n,gas:e==null?void 0:e.gas}):o.TransactionTypeNotSupportedError.nodeMessage.test(t)?new o.TransactionTypeNotSupportedError({cause:n}):o.TipAboveFeeCapError.nodeMessage.test(t)?new o.TipAboveFeeCapError({cause:n,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new o.UnknownNodeError({cause:n})}exports.getNodeError=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index218.cjs");function r(e){return{address:e.address,amount:o.fromNumber(e.amount),index:o.fromNumber(e.index),validatorIndex:o.fromNumber(e.validatorIndex)}}exports.toRpc=r;
package/dist/index219.js CHANGED
@@ -1,27 +1,12 @@
1
- import { BaseError as c } from "./index35.js";
2
- import { ExecutionRevertedError as t, FeeCapTooHighError as u, FeeCapTooLowError as d, NonceTooHighError as a, NonceTooLowError as f, NonceMaxValueError as w, InsufficientFundsError as r, IntrinsicGasTooHighError as E, IntrinsicGasTooLowError as m, TransactionTypeNotSupportedError as x, TipAboveFeeCapError as F, UnknownNodeError as M } from "./index163.js";
3
- function P(o, e) {
4
- const n = (o.details || "").toLowerCase(), s = o instanceof c ? o.walk((i) => (i == null ? void 0 : i.code) === t.code) : o;
5
- return s instanceof c ? new t({
6
- cause: o,
7
- message: s.details
8
- }) : t.nodeMessage.test(n) ? new t({
9
- cause: o,
10
- message: o.details
11
- }) : u.nodeMessage.test(n) ? new u({
12
- cause: o,
13
- maxFeePerGas: e == null ? void 0 : e.maxFeePerGas
14
- }) : d.nodeMessage.test(n) ? new d({
15
- cause: o,
16
- maxFeePerGas: e == null ? void 0 : e.maxFeePerGas
17
- }) : a.nodeMessage.test(n) ? new a({ cause: o, nonce: e == null ? void 0 : e.nonce }) : f.nodeMessage.test(n) ? new f({ cause: o, nonce: e == null ? void 0 : e.nonce }) : w.nodeMessage.test(n) ? new w({ cause: o, nonce: e == null ? void 0 : e.nonce }) : r.nodeMessage.test(n) ? new r({ cause: o }) : E.nodeMessage.test(n) ? new E({ cause: o, gas: e == null ? void 0 : e.gas }) : m.nodeMessage.test(n) ? new m({ cause: o, gas: e == null ? void 0 : e.gas }) : x.nodeMessage.test(n) ? new x({ cause: o }) : F.nodeMessage.test(n) ? new F({
18
- cause: o,
19
- maxFeePerGas: e == null ? void 0 : e.maxFeePerGas,
20
- maxPriorityFeePerGas: e == null ? void 0 : e.maxPriorityFeePerGas
21
- }) : new M({
22
- cause: o
23
- });
1
+ import { fromNumber as e } from "./index218.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
+ };
24
9
  }
25
10
  export {
26
- P as getNodeError
11
+ r as toRpc
27
12
  };
package/dist/index22.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index202.cjs"),u=require("./index42.cjs"),a=require("./index210.cjs"),g=require("./index200.cjs"),y=require("./index211.cjs"),d=require("./index212.cjs"),T=require("./index213.cjs"),l=require("./index214.cjs"),q=require("./index215.cjs");function A(s,t={}){const{nonceManager:c}=t,e=u.toHex(i.secp256k1.getPublicKey(s.slice(2),!1)),o=g.publicKeyToAddress(e);return{...a.toAccount({address:o,nonceManager:c,async sign({hash:n}){return y.sign({hash:n,privateKey:s,to:"hex"})},async signAuthorization(n){return d.signAuthorization({...n,privateKey:s})},async signMessage({message:n}){return T.signMessage({message:n,privateKey:s})},async signTransaction(n,{serializer:r}={}){return l.signTransaction({privateKey:s,transaction:n,serializer:r})},async signTypedData(n){return q.signTypedData({...n,privateKey:s})}}),publicKey:e,source:"privateKey"}}exports.privateKeyToAccount=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index139.cjs"),u=require("./index42.cjs"),a=require("./index141.cjs"),g=require("./index142.cjs"),y=require("./index143.cjs"),d=require("./index144.cjs"),T=require("./index145.cjs"),l=require("./index146.cjs"),q=require("./index147.cjs");function A(s,t={}){const{nonceManager:c}=t,e=u.toHex(i.secp256k1.getPublicKey(s.slice(2),!1)),o=g.publicKeyToAddress(e);return{...a.toAccount({address:o,nonceManager:c,async sign({hash:n}){return y.sign({hash:n,privateKey:s,to:"hex"})},async signAuthorization(n){return d.signAuthorization({...n,privateKey:s})},async signMessage({message:n}){return T.signMessage({message:n,privateKey:s})},async signTransaction(n,{serializer:r}={}){return l.signTransaction({privateKey:s,transaction:n,serializer:r})},async signTypedData(n){return q.signTypedData({...n,privateKey:s})}}),publicKey:e,source:"privateKey"}}exports.privateKeyToAccount=A;