@gardenfi/utils 2.0.6 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +22 -20
  3. package/dist/index10.cjs +1 -1
  4. package/dist/index10.js +37 -19
  5. package/dist/index100.cjs +1 -1
  6. package/dist/index100.js +77 -126
  7. package/dist/index101.cjs +1 -1
  8. package/dist/index101.js +17 -111
  9. package/dist/index102.cjs +1 -1
  10. package/dist/index102.js +10 -77
  11. package/dist/index103.cjs +1 -1
  12. package/dist/index103.js +20 -2
  13. package/dist/index104.cjs +1 -1
  14. package/dist/index104.js +11 -16
  15. package/dist/index105.cjs +1 -1
  16. package/dist/index105.js +38 -18
  17. package/dist/index106.cjs +1 -1
  18. package/dist/index106.js +5 -17
  19. package/dist/index107.cjs +1 -1
  20. package/dist/index107.js +10 -223
  21. package/dist/index108.cjs +1 -2
  22. package/dist/index108.js +2 -3
  23. package/dist/index109.cjs +1 -1
  24. package/dist/index109.js +18 -32
  25. package/dist/index11.cjs +1 -1
  26. package/dist/index11.js +19 -134
  27. package/dist/index110.cjs +1 -1
  28. package/dist/index110.js +126 -17
  29. package/dist/index111.cjs +1 -1
  30. package/dist/index111.js +6 -69
  31. package/dist/index112.cjs +1 -1
  32. package/dist/index112.js +2 -68
  33. package/dist/index113.cjs +1 -1
  34. package/dist/index113.js +38 -2
  35. package/dist/index114.cjs +1 -1
  36. package/dist/index114.js +5 -41
  37. package/dist/index115.cjs +2 -1
  38. package/dist/index115.js +3 -644
  39. package/dist/index116.cjs +1 -1
  40. package/dist/index116.js +15 -228
  41. package/dist/index117.cjs +1 -1
  42. package/dist/index117.js +624 -153
  43. package/dist/index118.cjs +1 -0
  44. package/dist/index118.js +175 -0
  45. package/dist/index12.cjs +1 -1
  46. package/dist/index12.js +136 -10
  47. package/dist/index13.cjs +1 -1
  48. package/dist/index13.js +15 -2
  49. package/dist/index14.cjs +1 -1
  50. package/dist/index14.js +2 -34
  51. package/dist/index15.cjs +1 -1
  52. package/dist/index15.js +32 -17
  53. package/dist/index16.cjs +1 -1
  54. package/dist/index16.js +14 -183
  55. package/dist/index17.cjs +1 -1
  56. package/dist/index17.js +187 -92
  57. package/dist/index18.cjs +1 -1
  58. package/dist/index18.js +92 -34
  59. package/dist/index19.cjs +1 -1
  60. package/dist/index19.js +36 -32
  61. package/dist/index20.cjs +1 -16
  62. package/dist/index20.js +30 -113
  63. package/dist/index21.cjs +1 -1
  64. package/dist/index21.js +18 -17
  65. package/dist/index22.cjs +16 -1
  66. package/dist/index22.js +113 -17
  67. package/dist/index23.cjs +1 -1
  68. package/dist/index23.js +17 -7
  69. package/dist/index24.cjs +1 -1
  70. package/dist/index24.js +6 -44
  71. package/dist/index25.cjs +1 -1
  72. package/dist/index25.js +45 -21
  73. package/dist/index26.cjs +1 -1
  74. package/dist/index26.js +21 -8
  75. package/dist/index27.cjs +1 -1
  76. package/dist/index27.js +8 -31
  77. package/dist/index28.cjs +1 -1
  78. package/dist/index28.js +31 -26
  79. package/dist/index29.cjs +1 -2
  80. package/dist/index29.js +25 -64
  81. package/dist/index30.cjs +2 -1
  82. package/dist/index30.js +64 -50
  83. package/dist/index31.cjs +1 -1
  84. package/dist/index31.js +51 -12
  85. package/dist/index32.cjs +1 -1
  86. package/dist/index32.js +12 -24
  87. package/dist/index33.cjs +1 -1
  88. package/dist/index33.js +24 -75
  89. package/dist/index34.cjs +1 -1
  90. package/dist/index34.js +74 -22
  91. package/dist/index35.cjs +1 -1
  92. package/dist/index35.js +23 -7
  93. package/dist/index36.cjs +1 -1
  94. package/dist/index36.js +7 -32
  95. package/dist/index37.cjs +1 -1
  96. package/dist/index37.js +31 -14
  97. package/dist/index38.cjs +1 -1
  98. package/dist/index38.js +16 -2
  99. package/dist/index39.cjs +1 -1
  100. package/dist/index39.js +2 -9
  101. package/dist/index4.cjs +1 -1
  102. package/dist/index4.js +2 -2
  103. package/dist/index40.cjs +1 -1
  104. package/dist/index40.js +8 -20
  105. package/dist/index41.cjs +1 -1
  106. package/dist/index41.js +20 -12
  107. package/dist/index42.cjs +1 -1
  108. package/dist/index42.js +40 -33
  109. package/dist/index43.cjs +1 -2
  110. package/dist/index43.js +24 -58
  111. package/dist/index44.cjs +1 -1
  112. package/dist/index44.js +7 -2
  113. package/dist/index45.cjs +1 -1
  114. package/dist/index45.js +13 -6
  115. package/dist/index46.cjs +1 -1
  116. package/dist/index46.js +15 -6
  117. package/dist/index47.cjs +1 -1
  118. package/dist/index47.js +5 -4
  119. package/dist/index48.cjs +1 -1
  120. package/dist/index48.js +13 -11
  121. package/dist/index49.cjs +1 -5
  122. package/dist/index49.js +10 -56
  123. package/dist/index50.cjs +1 -2
  124. package/dist/index50.js +10 -32
  125. package/dist/index51.cjs +1 -1
  126. package/dist/index51.js +11 -5
  127. package/dist/index52.cjs +1 -1
  128. package/dist/index52.js +13 -3
  129. package/dist/index53.cjs +1 -1
  130. package/dist/index53.js +54 -20
  131. package/dist/index54.cjs +1 -1
  132. package/dist/index54.js +16 -12
  133. package/dist/index55.cjs +1 -1
  134. package/dist/index55.js +5 -55
  135. package/dist/index56.cjs +1 -1
  136. package/dist/index56.js +4 -4
  137. package/dist/index57.cjs +1 -1
  138. package/dist/index57.js +169 -19
  139. package/dist/index58.cjs +1 -1
  140. package/dist/index58.js +103 -11
  141. package/dist/index59.cjs +1 -1
  142. package/dist/index59.js +21 -8
  143. package/dist/index6.cjs +1 -1
  144. package/dist/index6.js +40 -22
  145. package/dist/index60.cjs +1 -1
  146. package/dist/index60.js +11 -9
  147. package/dist/index61.cjs +1 -1
  148. package/dist/index61.js +34 -11
  149. package/dist/index62.cjs +1 -1
  150. package/dist/index62.js +8 -6
  151. package/dist/index63.cjs +2 -1
  152. package/dist/index63.js +59 -13
  153. package/dist/index64.cjs +1 -1
  154. package/dist/index64.js +2 -33
  155. package/dist/index65.cjs +1 -1
  156. package/dist/index65.js +6 -14
  157. package/dist/index66.cjs +1 -1
  158. package/dist/index66.js +6 -64
  159. package/dist/index67.cjs +1 -1
  160. package/dist/index67.js +4 -27
  161. package/dist/index68.cjs +1 -1
  162. package/dist/index68.js +12 -3
  163. package/dist/index69.cjs +1 -1
  164. package/dist/index69.js +3 -3
  165. package/dist/index7.cjs +1 -1
  166. package/dist/index7.js +24 -2
  167. package/dist/index70.cjs +5 -1
  168. package/dist/index70.js +56 -13
  169. package/dist/index71.cjs +2 -1
  170. package/dist/index71.js +33 -40
  171. package/dist/index72.cjs +1 -1
  172. package/dist/index72.js +5 -5
  173. package/dist/index73.cjs +1 -1
  174. package/dist/index73.js +21 -8
  175. package/dist/index74.cjs +1 -1
  176. package/dist/index74.js +8 -103
  177. package/dist/index75.cjs +1 -1
  178. package/dist/index75.js +9 -190
  179. package/dist/index76.cjs +1 -1
  180. package/dist/index76.js +11 -18
  181. package/dist/index77.cjs +1 -1
  182. package/dist/index77.js +6 -11
  183. package/dist/index78.cjs +1 -1
  184. package/dist/index78.js +13 -19
  185. package/dist/index79.cjs +1 -1
  186. package/dist/index79.js +31 -11
  187. package/dist/index8.cjs +1 -1
  188. package/dist/index8.js +2 -100
  189. package/dist/index80.cjs +1 -1
  190. package/dist/index80.js +14 -25
  191. package/dist/index81.cjs +1 -1
  192. package/dist/index81.js +64 -6
  193. package/dist/index82.cjs +1 -1
  194. package/dist/index82.js +27 -13
  195. package/dist/index83.cjs +1 -1
  196. package/dist/index83.js +3 -16
  197. package/dist/index84.cjs +1 -1
  198. package/dist/index84.js +3 -5
  199. package/dist/index85.cjs +1 -1
  200. package/dist/index85.js +8 -13
  201. package/dist/index86.cjs +1 -1
  202. package/dist/index86.js +190 -9
  203. package/dist/index87.cjs +1 -1
  204. package/dist/index87.js +18 -16
  205. package/dist/index88.cjs +1 -1
  206. package/dist/index88.js +39 -170
  207. package/dist/index89.cjs +1 -1
  208. package/dist/index89.js +30 -34
  209. package/dist/index9.cjs +1 -1
  210. package/dist/index9.js +105 -34
  211. package/dist/index90.cjs +1 -1
  212. package/dist/index90.js +69 -8
  213. package/dist/index91.cjs +1 -1
  214. package/dist/index91.js +113 -5
  215. package/dist/index92.cjs +1 -1
  216. package/dist/index92.js +67 -10
  217. package/dist/index93.cjs +1 -1
  218. package/dist/index93.js +2 -2
  219. package/dist/index94.cjs +1 -1
  220. package/dist/index94.js +15 -103
  221. package/dist/index95.cjs +1 -1
  222. package/dist/index95.js +218 -37
  223. package/dist/index96.cjs +1 -1
  224. package/dist/index96.js +227 -16
  225. package/dist/index97.cjs +1 -1
  226. package/dist/index97.js +42 -6
  227. package/dist/index98.cjs +1 -1
  228. package/dist/index98.js +105 -5
  229. package/dist/index99.cjs +1 -1
  230. package/dist/index99.js +16 -36
  231. package/dist/src/index.d.ts +1 -0
  232. package/dist/src/lib/auth/siwe/siwe.d.ts +3 -2
  233. package/dist/src/lib/digestKey/digestKey.d.ts +12 -0
  234. package/package.json +4 -1
package/dist/index74.js CHANGED
@@ -1,106 +1,11 @@
1
- import { encodeAbiParameters as p } from "./index75.js";
2
- import { concat as h } from "./index76.js";
3
- import { toHex as d } from "./index24.js";
4
- import { keccak256 as c } from "./index56.js";
5
- import { getTypesForEIP712Domain as T, validateTypedData as D } from "./index66.js";
6
- function k(o) {
7
- const { domain: t = {}, message: e, primaryType: n } = o, r = {
8
- EIP712Domain: T({ domain: t }),
9
- ...o.types
10
- };
11
- D({
12
- domain: t,
13
- message: e,
14
- primaryType: n,
15
- types: r
16
- });
17
- const a = ["0x1901"];
18
- return t && a.push(b({
19
- domain: t,
20
- types: r
21
- })), n !== "EIP712Domain" && a.push(f({
22
- data: e,
23
- primaryType: n,
24
- types: r
25
- })), c(h(a));
26
- }
27
- function b({ domain: o, types: t }) {
28
- return f({
29
- data: o,
30
- primaryType: "EIP712Domain",
31
- types: t
32
- });
33
- }
34
- function f({ data: o, primaryType: t, types: e }) {
35
- const n = m({
36
- data: o,
37
- primaryType: t,
38
- types: e
39
- });
40
- return c(n);
41
- }
42
- function m({ data: o, primaryType: t, types: e }) {
43
- const n = [{ type: "bytes32" }], r = [l({ primaryType: t, types: e })];
44
- for (const a of e[t]) {
45
- const [i, s] = y({
46
- types: e,
47
- name: a.name,
48
- type: a.type,
49
- value: o[a.name]
50
- });
51
- n.push(i), r.push(s);
52
- }
53
- return p(n, r);
54
- }
55
- function l({ primaryType: o, types: t }) {
56
- const e = d(x({ primaryType: o, types: t }));
57
- return c(e);
58
- }
59
- function x({ primaryType: o, types: t }) {
60
- let e = "";
61
- const n = u({ primaryType: o, types: t });
62
- n.delete(o);
63
- const r = [o, ...Array.from(n).sort()];
64
- for (const a of r)
65
- e += `${a}(${t[a].map(({ name: i, type: s }) => `${s} ${i}`).join(",")})`;
66
- return e;
67
- }
68
- function u({ primaryType: o, types: t }, e = /* @__PURE__ */ new Set()) {
69
- const n = o.match(/^\w*/u), r = n == null ? void 0 : n[0];
70
- if (e.has(r) || t[r] === void 0)
71
- return e;
72
- e.add(r);
73
- for (const a of t[r])
74
- u({ primaryType: a.type, types: t }, e);
75
- return e;
76
- }
77
- function y({ types: o, name: t, type: e, value: n }) {
78
- if (o[e] !== void 0)
79
- return [
80
- { type: "bytes32" },
81
- c(m({ data: n, primaryType: e, types: o }))
82
- ];
83
- if (e === "bytes")
84
- return n = `0x${(n.length % 2 ? "0" : "") + n.slice(2)}`, [{ type: "bytes32" }, c(n)];
85
- if (e === "string")
86
- return [{ type: "bytes32" }, c(d(n))];
87
- if (e.lastIndexOf("]") === e.length - 1) {
88
- const r = e.slice(0, e.lastIndexOf("[")), a = n.map((i) => y({
89
- name: t,
90
- type: r,
91
- types: o,
92
- value: i
93
- }));
94
- return [
95
- { type: "bytes32" },
96
- c(p(a.map(([i]) => i), a.map(([, i]) => i)))
97
- ];
98
- }
99
- return [{ type: e }, n];
1
+ import { hexToBytes as i } from "./index53.js";
2
+ import { bytesToHex as f } from "./index25.js";
3
+ function y(o) {
4
+ const { kzg: s } = o, n = o.to ?? (typeof o.blobs[0] == "string" ? "hex" : "bytes"), m = typeof o.blobs[0] == "string" ? o.blobs.map((t) => i(t)) : o.blobs, b = [];
5
+ for (const t of m)
6
+ b.push(Uint8Array.from(s.blobToKzgCommitment(t)));
7
+ return n === "bytes" ? b : b.map((t) => f(t));
100
8
  }
101
9
  export {
102
- x as encodeType,
103
- b as hashDomain,
104
- f as hashStruct,
105
- k as hashTypedData
10
+ y as blobsToCommitments
106
11
  };
package/dist/index75.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index49.cjs"),g=require("./index54.cjs"),l=require("./index43.cjs"),b=require("./index41.cjs"),x=require("./index58.cjs"),u=require("./index76.cjs"),d=require("./index42.cjs"),y=require("./index47.cjs"),A=require("./index89.cjs"),a=require("./index24.cjs"),z=require("./index68.cjs");function w(e,n){if(e.length!==n.length)throw new f.AbiEncodingLengthMismatchError({expectedLength:e.length,givenLength:n.length});const o=H({params:e,values:n}),t=p(o);return t.length===0?"0x":t}function H({params:e,values:n}){const o=[];for(let t=0;t<e.length;t++)o.push(h({param:e[t],value:n[t]}));return o}function h({param:e,value:n}){const o=m(e.type);if(o){const[t,r]=o;return P(n,{length:t,param:{...e,type:r}})}if(e.type==="tuple")return L(n,{param:e});if(e.type==="address")return E(n);if(e.type==="bool")return q(n);if(e.type.startsWith("uint")||e.type.startsWith("int")){const t=e.type.startsWith("int"),[,,r="256"]=z.integerRegex.exec(e.type)??[];return T(n,{signed:t,size:Number(r)})}if(e.type.startsWith("bytes"))return S(n,{param:e});if(e.type==="string")return I(n);throw new f.InvalidAbiEncodingTypeError(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function p(e){let n=0;for(let i=0;i<e.length;i++){const{dynamic:c,encoded:s}=e[i];c?n+=32:n+=y.size(s)}const o=[],t=[];let r=0;for(let i=0;i<e.length;i++){const{dynamic:c,encoded:s}=e[i];c?(o.push(a.numberToHex(n+r,{size:32})),t.push(s),r+=y.size(s)):o.push(s)}return u.concat([...o,...t])}function E(e){if(!x.isAddress(e))throw new g.InvalidAddressError({address:e});return{dynamic:!1,encoded:d.padHex(e.toLowerCase())}}function P(e,{length:n,param:o}){const t=n===null;if(!Array.isArray(e))throw new f.InvalidArrayError(e);if(!t&&e.length!==n)throw new f.AbiEncodingArrayLengthMismatchError({expectedLength:n,givenLength:e.length,type:`${o.type}[${n}]`});let r=!1;const i=[];for(let c=0;c<e.length;c++){const s=h({param:o,value:e[c]});s.dynamic&&(r=!0),i.push(s)}if(t||r){const c=p(i);if(t){const s=a.numberToHex(i.length,{size:32});return{dynamic:!0,encoded:i.length>0?u.concat([s,c]):s}}if(r)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:u.concat(i.map(({encoded:c})=>c))}}function S(e,{param:n}){const[,o]=n.type.split("bytes"),t=y.size(e);if(!o){let r=e;return t%32!==0&&(r=d.padHex(r,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:u.concat([d.padHex(a.numberToHex(t,{size:32})),r])}}if(t!==Number.parseInt(o))throw new f.AbiEncodingBytesSizeMismatchError({expectedSize:Number.parseInt(o),value:e});return{dynamic:!1,encoded:d.padHex(e,{dir:"right"})}}function q(e){if(typeof e!="boolean")throw new l.BaseError(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:d.padHex(a.boolToHex(e))}}function T(e,{signed:n,size:o=256}){if(typeof o=="number"){const t=2n**(BigInt(o)-(n?1n:0n))-1n,r=n?-t-1n:0n;if(e>t||e<r)throw new b.IntegerOutOfRangeError({max:t.toString(),min:r.toString(),signed:n,size:o/8,value:e.toString()})}return{dynamic:!1,encoded:a.numberToHex(e,{size:32,signed:n})}}function I(e){const n=a.stringToHex(e),o=Math.ceil(y.size(n)/32),t=[];for(let r=0;r<o;r++)t.push(d.padHex(A.slice(n,r*32,(r+1)*32),{dir:"right"}));return{dynamic:!0,encoded:u.concat([d.padHex(a.numberToHex(y.size(n),{size:32})),...t])}}function L(e,{param:n}){let o=!1;const t=[];for(let r=0;r<n.components.length;r++){const i=n.components[r],c=Array.isArray(e)?r:i.name,s=h({param:i,value:e[c]});t.push(s),s.dynamic&&(o=!0)}return{dynamic:o,encoded:o?p(t):u.concat(t.map(({encoded:r})=>r))}}function m(e){const n=e.match(/^(.*)\[(\d+)?\]$/);return n?[n[2]?Number(n[2]):null,n[1]]:void 0}exports.encodeAbiParameters=w;exports.getArrayComponents=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index53.cjs"),y=require("./index25.cjs");function f(t){const{kzg:c}=t,e=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),n=typeof t.blobs[0]=="string"?t.blobs.map(o=>b.hexToBytes(o)):t.blobs,i=typeof t.commitments[0]=="string"?t.commitments.map(o=>b.hexToBytes(o)):t.commitments,s=[];for(let o=0;o<n.length;o++){const l=n[o],m=i[o];s.push(Uint8Array.from(c.computeBlobKzgProof(l,m)))}return e==="bytes"?s:s.map(o=>y.bytesToHex(o))}exports.blobsToProofs=f;
package/dist/index75.js CHANGED
@@ -1,194 +1,13 @@
1
- import { AbiEncodingLengthMismatchError as y, InvalidAbiEncodingTypeError as u, InvalidArrayError as g, AbiEncodingArrayLengthMismatchError as l, AbiEncodingBytesSizeMismatchError as b } from "./index49.js";
2
- import { InvalidAddressError as w } from "./index54.js";
3
- import { BaseError as A } from "./index43.js";
4
- import { IntegerOutOfRangeError as x } from "./index41.js";
5
- import { isAddress as z } from "./index58.js";
6
- import { concat as f } from "./index76.js";
7
- import { padHex as d } from "./index42.js";
8
- import { size as a } from "./index47.js";
9
- import { slice as E } from "./index89.js";
10
- import { numberToHex as m, boolToHex as P, stringToHex as S } from "./index24.js";
11
- import { integerRegex as I } from "./index68.js";
12
- function K(e, t) {
13
- if (e.length !== t.length)
14
- throw new y({
15
- expectedLength: e.length,
16
- givenLength: t.length
17
- });
18
- const o = L({
19
- params: e,
20
- values: t
21
- }), n = h(o);
22
- return n.length === 0 ? "0x" : n;
23
- }
24
- function L({ params: e, values: t }) {
25
- const o = [];
26
- for (let n = 0; n < e.length; n++)
27
- o.push(p({ param: e[n], value: t[n] }));
28
- return o;
29
- }
30
- function p({ param: e, value: t }) {
31
- const o = W(e.type);
32
- if (o) {
33
- const [n, r] = o;
34
- return M(t, { length: n, param: { ...e, type: r } });
35
- }
36
- if (e.type === "tuple")
37
- return H(t, {
38
- param: e
39
- });
40
- if (e.type === "address")
41
- return B(t);
42
- if (e.type === "bool")
43
- return T(t);
44
- if (e.type.startsWith("uint") || e.type.startsWith("int")) {
45
- const n = e.type.startsWith("int"), [, , r = "256"] = I.exec(e.type) ?? [];
46
- return $(t, {
47
- signed: n,
48
- size: Number(r)
49
- });
50
- }
51
- if (e.type.startsWith("bytes"))
52
- return N(t, { param: e });
53
- if (e.type === "string")
54
- return C(t);
55
- throw new u(e.type, {
56
- docsPath: "/docs/contract/encodeAbiParameters"
57
- });
58
- }
59
- function h(e) {
60
- let t = 0;
61
- for (let i = 0; i < e.length; i++) {
62
- const { dynamic: c, encoded: s } = e[i];
63
- c ? t += 32 : t += a(s);
64
- }
65
- const o = [], n = [];
66
- let r = 0;
67
- for (let i = 0; i < e.length; i++) {
68
- const { dynamic: c, encoded: s } = e[i];
69
- c ? (o.push(m(t + r, { size: 32 })), n.push(s), r += a(s)) : o.push(s);
70
- }
71
- return f([...o, ...n]);
72
- }
73
- function B(e) {
74
- if (!z(e))
75
- throw new w({ address: e });
76
- return { dynamic: !1, encoded: d(e.toLowerCase()) };
77
- }
78
- function M(e, { length: t, param: o }) {
79
- const n = t === null;
80
- if (!Array.isArray(e))
81
- throw new g(e);
82
- if (!n && e.length !== t)
83
- throw new l({
84
- expectedLength: t,
85
- givenLength: e.length,
86
- type: `${o.type}[${t}]`
87
- });
88
- let r = !1;
89
- const i = [];
90
- for (let c = 0; c < e.length; c++) {
91
- const s = p({ param: o, value: e[c] });
92
- s.dynamic && (r = !0), i.push(s);
93
- }
94
- if (n || r) {
95
- const c = h(i);
96
- if (n) {
97
- const s = m(i.length, { size: 32 });
98
- return {
99
- dynamic: !0,
100
- encoded: i.length > 0 ? f([s, c]) : s
101
- };
102
- }
103
- if (r)
104
- return { dynamic: !0, encoded: c };
1
+ import { hexToBytes as b } from "./index53.js";
2
+ import { bytesToHex as y } from "./index25.js";
3
+ function h(t) {
4
+ const { kzg: m } = t, c = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), s = typeof t.blobs[0] == "string" ? t.blobs.map((o) => b(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => b(o)) : t.commitments, n = [];
5
+ for (let o = 0; o < s.length; o++) {
6
+ const f = s[o], l = i[o];
7
+ n.push(Uint8Array.from(m.computeBlobKzgProof(f, l)));
105
8
  }
106
- return {
107
- dynamic: !1,
108
- encoded: f(i.map(({ encoded: c }) => c))
109
- };
110
- }
111
- function N(e, { param: t }) {
112
- const [, o] = t.type.split("bytes"), n = a(e);
113
- if (!o) {
114
- let r = e;
115
- return n % 32 !== 0 && (r = d(r, {
116
- dir: "right",
117
- size: Math.ceil((e.length - 2) / 2 / 32) * 32
118
- })), {
119
- dynamic: !0,
120
- encoded: f([d(m(n, { size: 32 })), r])
121
- };
122
- }
123
- if (n !== Number.parseInt(o))
124
- throw new b({
125
- expectedSize: Number.parseInt(o),
126
- value: e
127
- });
128
- return { dynamic: !1, encoded: d(e, { dir: "right" }) };
129
- }
130
- function T(e) {
131
- if (typeof e != "boolean")
132
- throw new A(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);
133
- return { dynamic: !1, encoded: d(P(e)) };
134
- }
135
- function $(e, { signed: t, size: o = 256 }) {
136
- if (typeof o == "number") {
137
- const n = 2n ** (BigInt(o) - (t ? 1n : 0n)) - 1n, r = t ? -n - 1n : 0n;
138
- if (e > n || e < r)
139
- throw new x({
140
- max: n.toString(),
141
- min: r.toString(),
142
- signed: t,
143
- size: o / 8,
144
- value: e.toString()
145
- });
146
- }
147
- return {
148
- dynamic: !1,
149
- encoded: m(e, {
150
- size: 32,
151
- signed: t
152
- })
153
- };
154
- }
155
- function C(e) {
156
- const t = S(e), o = Math.ceil(a(t) / 32), n = [];
157
- for (let r = 0; r < o; r++)
158
- n.push(d(E(t, r * 32, (r + 1) * 32), {
159
- dir: "right"
160
- }));
161
- return {
162
- dynamic: !0,
163
- encoded: f([
164
- d(m(a(t), { size: 32 })),
165
- ...n
166
- ])
167
- };
168
- }
169
- function H(e, { param: t }) {
170
- let o = !1;
171
- const n = [];
172
- for (let r = 0; r < t.components.length; r++) {
173
- const i = t.components[r], c = Array.isArray(e) ? r : i.name, s = p({
174
- param: i,
175
- value: e[c]
176
- });
177
- n.push(s), s.dynamic && (o = !0);
178
- }
179
- return {
180
- dynamic: o,
181
- encoded: o ? h(n) : f(n.map(({ encoded: r }) => r))
182
- };
183
- }
184
- function W(e) {
185
- const t = e.match(/^(.*)\[(\d+)?\]$/);
186
- return t ? (
187
- // Return `null` if the array is dynamic.
188
- [t[2] ? Number(t[2]) : null, t[1]]
189
- ) : void 0;
9
+ return c === "bytes" ? n : n.map((o) => y(o));
190
10
  }
191
11
  export {
192
- K as encodeAbiParameters,
193
- W as getArrayComponents
12
+ h as blobsToProofs
194
13
  };
package/dist/index76.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function a(t){return typeof t[0]=="string"?f(t):o(t)}function o(t){let n=0;for(const r of t)n+=r.length;const e=new Uint8Array(n);let c=0;for(const r of t)e.set(r,c),c+=r.length;return e}function f(t){return`0x${t.reduce((n,e)=>n+e.replace("0x",""),"")}`}exports.concat=a;exports.concatBytes=o;exports.concatHex=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index77.cjs");function c(o){const{commitments:e,version:s}=o,n=o.to??(typeof e[0]=="string"?"hex":"bytes"),t=[];for(const m of e)t.push(i.commitmentToVersionedHash({commitment:m,to:n,version:s}));return t}exports.commitmentsToVersionedHashes=c;
package/dist/index76.js CHANGED
@@ -1,21 +1,14 @@
1
- function i(t) {
2
- return typeof t[0] == "string" ? f(t) : c(t);
3
- }
4
- function c(t) {
5
- let n = 0;
6
- for (const e of t)
7
- n += e.length;
8
- const r = new Uint8Array(n);
9
- let o = 0;
10
- for (const e of t)
11
- r.set(e, o), o += e.length;
12
- return r;
13
- }
14
- function f(t) {
15
- return `0x${t.reduce((n, r) => n + r.replace("0x", ""), "")}`;
1
+ import { commitmentToVersionedHash as i } from "./index77.js";
2
+ function r(o) {
3
+ const { commitments: t, version: n } = o, e = o.to ?? (typeof t[0] == "string" ? "hex" : "bytes"), s = [];
4
+ for (const m of t)
5
+ s.push(i({
6
+ commitment: m,
7
+ to: e,
8
+ version: n
9
+ }));
10
+ return s;
16
11
  }
17
12
  export {
18
- i as concat,
19
- c as concatBytes,
20
- f as concatHex
13
+ r as commitmentsToVersionedHashes
21
14
  };
package/dist/index77.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index43.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 i=require("./index25.cjs"),r=require("./index111.cjs");function c(t){const{commitment:o,version:s=1}=t,n=t.to??(typeof o=="string"?"hex":"bytes"),e=r.sha256(o);return e.set([s],0),n==="bytes"?e:i.bytesToHex(e)}exports.commitmentToVersionedHash=c;
package/dist/index77.js CHANGED
@@ -1,14 +1,9 @@
1
- import { BaseError as i } from "./index43.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 { bytesToHex as i } from "./index25.js";
2
+ import { sha256 as m } from "./index111.js";
3
+ function f(t) {
4
+ const { commitment: e, version: s = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), o = m(e);
5
+ return o.set([s], 0), n === "bytes" ? o : i(o);
11
6
  }
12
7
  export {
13
- d as SiweInvalidMessageFieldError
8
+ f as commitmentToVersionedHash
14
9
  };
package/dist/index78.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 r=require("./index74.cjs"),m=require("./index75.cjs"),u=require("./index79.cjs");function f(t){const{data:i,kzg:n,to:b}=t,s=t.blobs??u.toBlobs({data:i,to:b}),e=t.commitments??r.blobsToCommitments({blobs:s,kzg:n,to:b}),l=t.proofs??m.blobsToProofs({blobs:s,commitments:e,kzg:n,to:b}),c=[];for(let o=0;o<s.length;o++)c.push({blob:s[o],commitment:e[o],proof:l[o]});return c}exports.toBlobSidecars=f;
package/dist/index78.js CHANGED
@@ -1,22 +1,16 @@
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;
16
- }
17
- function a(e) {
18
- return e.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);
1
+ import { blobsToCommitments as f } from "./index74.js";
2
+ import { blobsToProofs as l } from "./index75.js";
3
+ import { toBlobs as p } from "./index79.js";
4
+ function k(t) {
5
+ const { data: i, kzg: n, to: m } = t, s = t.blobs ?? p({ data: i, to: m }), b = t.commitments ?? f({ blobs: s, kzg: n, to: m }), r = t.proofs ?? l({ blobs: s, commitments: b, kzg: n, to: m }), c = [];
6
+ for (let o = 0; o < s.length; o++)
7
+ c.push({
8
+ blob: s[o],
9
+ commitment: b[o],
10
+ proof: r[o]
11
+ });
12
+ return c;
19
13
  }
20
14
  export {
21
- o as isUri
15
+ k as toBlobSidecars
22
16
  };
package/dist/index79.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index43.cjs");class i extends t.BaseError{constructor({offset:r,position:s,size:e}){super(`Slice ${s==="start"?"starting":"ending"} at offset "${r}" is out-of-bounds (size: ${e}).`,{name:"SliceOffsetOutOfBoundsError"})}}class d extends t.BaseError{constructor({size:r,targetSize:s,type:e}){super(`${e.charAt(0).toUpperCase()}${e.slice(1).toLowerCase()} size (${r}) exceeds padding size (${s}).`,{name:"SizeExceedsPaddingSizeError"})}}exports.SizeExceedsPaddingSizeError=d;exports.SliceOffsetOutOfBoundsError=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index114.cjs"),y=require("./index113.cjs"),u=require("./index110.cjs"),B=require("./index67.cjs"),h=require("./index53.cjs"),d=require("./index25.cjs");function f(t){const a=t.to??(typeof t.data=="string"?"hex":"bytes"),n=typeof t.data=="string"?h.hexToBytes(t.data):t.data,s=B.size(n);if(!s)throw new y.EmptyBlobError;if(s>o.maxBytesPerTransaction)throw new y.BlobSizeTooLargeError({maxSize:o.maxBytesPerTransaction,size:s});const r=[];let b=!0,i=0;for(;b;){const e=u.createCursor(new Uint8Array(o.bytesPerBlob));let l=0;for(;l<o.fieldElementsPerBlob;){const c=n.slice(i,i+(o.bytesPerFieldElement-1));if(e.pushByte(0),e.pushBytes(c),c.length<31){e.pushByte(128),b=!1;break}l++,i+=31}r.push(e)}return a==="bytes"?r.map(e=>e.bytes):r.map(e=>d.bytesToHex(e.bytes))}exports.toBlobs=f;
package/dist/index79.js CHANGED
@@ -1,15 +1,35 @@
1
- import { BaseError as o } from "./index43.js";
2
- class d extends o {
3
- constructor({ offset: r, position: s, size: e }) {
4
- super(`Slice ${s === "start" ? "starting" : "ending"} at offset "${r}" is out-of-bounds (size: ${e}).`, { name: "SliceOffsetOutOfBoundsError" });
5
- }
6
- }
7
- class n extends o {
8
- constructor({ size: r, targetSize: s, type: e }) {
9
- super(`${e.charAt(0).toUpperCase()}${e.slice(1).toLowerCase()} size (${r}) exceeds padding size (${s}).`, { name: "SizeExceedsPaddingSizeError" });
1
+ import { maxBytesPerTransaction as y, bytesPerBlob as a, fieldElementsPerBlob as f, bytesPerFieldElement as p } from "./index114.js";
2
+ import { EmptyBlobError as c, BlobSizeTooLargeError as h } from "./index113.js";
3
+ import { createCursor as B } from "./index110.js";
4
+ import { size as u } from "./index67.js";
5
+ import { hexToBytes as x } from "./index53.js";
6
+ import { bytesToHex as d } from "./index25.js";
7
+ function S(e) {
8
+ const m = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), i = typeof e.data == "string" ? x(e.data) : e.data, o = u(i);
9
+ if (!o)
10
+ throw new c();
11
+ if (o > y)
12
+ throw new h({
13
+ maxSize: y,
14
+ size: o
15
+ });
16
+ const s = [];
17
+ let n = !0, r = 0;
18
+ for (; n; ) {
19
+ const t = B(new Uint8Array(a));
20
+ let l = 0;
21
+ for (; l < f; ) {
22
+ const b = i.slice(r, r + (p - 1));
23
+ if (t.pushByte(0), t.pushBytes(b), b.length < 31) {
24
+ t.pushByte(128), n = !1;
25
+ break;
26
+ }
27
+ l++, r += 31;
28
+ }
29
+ s.push(t);
10
30
  }
31
+ return m === "bytes" ? s.map((t) => t.bytes) : s.map((t) => d(t.bytes));
11
32
  }
12
33
  export {
13
- n as SizeExceedsPaddingSizeError,
14
- d as SliceOffsetOutOfBoundsError
34
+ S as toBlobs
15
35
  };
package/dist/index8.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index16.cjs"),f=require("./index12.cjs"),h=require("./index13.cjs"),d=require("viem"),o=require("./index3.cjs"),g=require("./index6.cjs"),w=require("./index18.cjs"),m=require("./index19.cjs"),y=require("./index20.cjs");class c{constructor(n,r,e){this.API=new g.Url("https://api.garden.finance"),this.url=n??this.API,this.walletClient=r,this.domain=(e==null?void 0:e.domain)||"app.garden.finance",this.domain.startsWith("https://")&&(this.domain=this.domain.split("https://")[1]),this.signingStatement=(e==null?void 0:e.signingStatement)??"Garden.fi",this.store=(e==null?void 0:e.store)??new f.MemoryStorage}static fromDigestKey(n,r){const e=d.createWalletClient({account:w.privateKeyToAccount(o.add0x(r)),transport:d.http(),chain:m.mainnet});return new c(n,e)}verifyToken(n,r){try{const e=o.parseJwt(n);if(!e)return t.Ok(!1);const i=Math.floor(Date.now()/1e3)+120;return t.Ok(e.exp>i&&e.user_id.toLowerCase()===r.toLowerCase())}catch{return t.Ok(!1)}}async getToken(){var a;if(!((a=this.walletClient.account)!=null&&a.address))return t.Err("Wallet client does not have an account");const n=this.store.getItem(h.StoreKeys.AUTH_TOKEN);if(n){const s=this.verifyToken(n,this.walletClient.account.address);if(s.ok&&s.val)return t.Ok(n)}const r=await this.signStatement();if(r.error)return t.Err(r.error);const e=await t.Fetcher.post(this.url.endpoint("verify"),{body:JSON.stringify({...r.val}),headers:{"Content-Type":"application/json"}});if(e.error)return t.Err(e.error);const i=e.result;if(!i)return t.Err("Failed to get token");if(!this.verifyToken(i,this.walletClient.account.address).val)throw new Error("Token verification failed");return this.store.setItem(h.StoreKeys.AUTH_TOKEN,i),t.Ok(i)}async signStatement(){var u;if(!((u=this.walletClient.account)!=null&&u.address))return t.Err("Wallet client does not have a valid account");const n=new Date,r=new Date(n.getTime()+300*1e3),i=(await t.Fetcher.get(this.url.endpoint("nonce"))).result;if(!i)return t.Err("Failed to get nonce");const l=await this.walletClient.getChainId(),a=y.createSiweMessage({domain:this.domain,address:this.walletClient.account.address,statement:this.signingStatement,nonce:i,uri:"https://"+this.domain,version:"1",chainId:l,notBefore:r}),s=await this.walletClient.signMessage({account:this.walletClient.account,message:a});return t.Ok({message:a,signature:s,nonce:i})}async getAuthHeaders(){const n=await this.getToken();return n.error?t.Err(n.error):t.Ok({Authorization:o.Authorization(n.val)})}}exports.Siwe=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=(t=>(t.Authorization="Authorization",t.ApiKey="api-key",t))(e||{});exports.AuthHeaderEnum=e;
package/dist/index8.js CHANGED
@@ -1,102 +1,4 @@
1
- import { Ok as r, Err as a, Fetcher as h } from "./index16.js";
2
- import { MemoryStorage as u } from "./index12.js";
3
- import { StoreKeys as m } from "./index13.js";
4
- import { createWalletClient as f, http as w } from "viem";
5
- import { add0x as g, parseJwt as p, Authorization as y } from "./index3.js";
6
- import { Url as v } from "./index6.js";
7
- import { privateKeyToAccount as T } from "./index18.js";
8
- import { mainnet as k } from "./index19.js";
9
- import { createSiweMessage as C } from "./index20.js";
10
- class d {
11
- constructor(e, n, t) {
12
- this.API = new v("https://api.garden.finance"), this.url = e ?? this.API, this.walletClient = n, this.domain = (t == null ? void 0 : t.domain) || "app.garden.finance", this.domain.startsWith("https://") && (this.domain = this.domain.split("https://")[1]), this.signingStatement = (t == null ? void 0 : t.signingStatement) ?? "Garden.fi", this.store = (t == null ? void 0 : t.store) ?? new u();
13
- }
14
- static fromDigestKey(e, n) {
15
- const t = f({
16
- account: T(g(n)),
17
- transport: w(),
18
- chain: k
19
- });
20
- return new d(e, t);
21
- }
22
- verifyToken(e, n) {
23
- try {
24
- const t = p(e);
25
- if (!t) return r(!1);
26
- const i = Math.floor(Date.now() / 1e3) + 120;
27
- return r(
28
- t.exp > i && t.user_id.toLowerCase() === n.toLowerCase()
29
- );
30
- } catch {
31
- return r(!1);
32
- }
33
- }
34
- async getToken() {
35
- var o;
36
- if (!((o = this.walletClient.account) != null && o.address))
37
- return a("Wallet client does not have an account");
38
- const e = this.store.getItem(m.AUTH_TOKEN);
39
- if (e) {
40
- const s = this.verifyToken(
41
- e,
42
- this.walletClient.account.address
43
- );
44
- if (s.ok && s.val) return r(e);
45
- }
46
- const n = await this.signStatement();
47
- if (n.error)
48
- return a(n.error);
49
- const t = await h.post(
50
- this.url.endpoint("verify"),
51
- {
52
- body: JSON.stringify({
53
- ...n.val
54
- }),
55
- headers: {
56
- "Content-Type": "application/json"
57
- }
58
- }
59
- );
60
- if (t.error) return a(t.error);
61
- const i = t.result;
62
- if (!i) return a("Failed to get token");
63
- if (!this.verifyToken(i, this.walletClient.account.address).val)
64
- throw new Error("Token verification failed");
65
- return this.store.setItem(m.AUTH_TOKEN, i), r(i);
66
- }
67
- async signStatement() {
68
- var l;
69
- if (!((l = this.walletClient.account) != null && l.address))
70
- return a("Wallet client does not have a valid account");
71
- const e = /* @__PURE__ */ new Date(), n = new Date(e.getTime() + 300 * 1e3), i = (await h.get(
72
- this.url.endpoint("nonce")
73
- )).result;
74
- if (!i)
75
- return a("Failed to get nonce");
76
- const c = await this.walletClient.getChainId(), o = C({
77
- domain: this.domain,
78
- address: this.walletClient.account.address,
79
- statement: this.signingStatement,
80
- nonce: i,
81
- uri: "https://" + this.domain,
82
- version: "1",
83
- chainId: c,
84
- notBefore: n
85
- }), s = await this.walletClient.signMessage({
86
- account: this.walletClient.account,
87
- message: o
88
- });
89
- return r({
90
- message: o,
91
- signature: s,
92
- nonce: i
93
- });
94
- }
95
- async getAuthHeaders() {
96
- const e = await this.getToken();
97
- return e.error ? a(e.error) : r({ Authorization: y(e.val) });
98
- }
99
- }
1
+ var o = /* @__PURE__ */ ((i) => (i.Authorization = "Authorization", i.ApiKey = "api-key", i))(o || {});
100
2
  export {
101
- d as Siwe
3
+ o as AuthHeaderEnum
102
4
  };
package/dist/index80.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index54.cjs"),e=require("./index58.cjs");function t(s){if(typeof s=="string"){if(!e.isAddress(s,{strict:!1}))throw new n.InvalidAddressError({address:s});return{address:s,type:"json-rpc"}}if(!e.isAddress(s.address,{strict:!1}))throw new n.InvalidAddressError({address:s.address});return{address:s.address,nonceManager:s.nonceManager,sign:s.sign,experimental_signAuthorization:s.experimental_signAuthorization,signMessage:s.signMessage,signTransaction:s.signTransaction,signTypedData:s.signTypedData,source:"custom",type:"local"}}exports.toAccount=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index30.cjs");function f(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new i.InvalidSerializableTransactionError({transaction:e})}exports.getTransactionType=f;