@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.
- package/dist/index.cjs +1 -1
- package/dist/index.js +22 -20
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +37 -19
- package/dist/index100.cjs +1 -1
- package/dist/index100.js +77 -126
- package/dist/index101.cjs +1 -1
- package/dist/index101.js +17 -111
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +10 -77
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +20 -2
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +11 -16
- package/dist/index105.cjs +1 -1
- package/dist/index105.js +38 -18
- package/dist/index106.cjs +1 -1
- package/dist/index106.js +5 -17
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +10 -223
- package/dist/index108.cjs +1 -2
- package/dist/index108.js +2 -3
- package/dist/index109.cjs +1 -1
- package/dist/index109.js +18 -32
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +19 -134
- package/dist/index110.cjs +1 -1
- package/dist/index110.js +126 -17
- package/dist/index111.cjs +1 -1
- package/dist/index111.js +6 -69
- package/dist/index112.cjs +1 -1
- package/dist/index112.js +2 -68
- package/dist/index113.cjs +1 -1
- package/dist/index113.js +38 -2
- package/dist/index114.cjs +1 -1
- package/dist/index114.js +5 -41
- package/dist/index115.cjs +2 -1
- package/dist/index115.js +3 -644
- package/dist/index116.cjs +1 -1
- package/dist/index116.js +15 -228
- package/dist/index117.cjs +1 -1
- package/dist/index117.js +624 -153
- package/dist/index118.cjs +1 -0
- package/dist/index118.js +175 -0
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +136 -10
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +15 -2
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +2 -34
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +32 -17
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +14 -183
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +187 -92
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +92 -34
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +36 -32
- package/dist/index20.cjs +1 -16
- package/dist/index20.js +30 -113
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +18 -17
- package/dist/index22.cjs +16 -1
- package/dist/index22.js +113 -17
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +17 -7
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +6 -44
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +45 -21
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +21 -8
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +8 -31
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +31 -26
- package/dist/index29.cjs +1 -2
- package/dist/index29.js +25 -64
- package/dist/index30.cjs +2 -1
- package/dist/index30.js +64 -50
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +51 -12
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +12 -24
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +24 -75
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +74 -22
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +23 -7
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +7 -32
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +31 -14
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +16 -2
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +2 -9
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +2 -2
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +8 -20
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +20 -12
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +40 -33
- package/dist/index43.cjs +1 -2
- package/dist/index43.js +24 -58
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +7 -2
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +13 -6
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +15 -6
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +5 -4
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +13 -11
- package/dist/index49.cjs +1 -5
- package/dist/index49.js +10 -56
- package/dist/index50.cjs +1 -2
- package/dist/index50.js +10 -32
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +11 -5
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +13 -3
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +54 -20
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +16 -12
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +5 -55
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +4 -4
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +169 -19
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +103 -11
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +21 -8
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +40 -22
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +11 -9
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +34 -11
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +8 -6
- package/dist/index63.cjs +2 -1
- package/dist/index63.js +59 -13
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +2 -33
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +6 -14
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +6 -64
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +4 -27
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +12 -3
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +3 -3
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +24 -2
- package/dist/index70.cjs +5 -1
- package/dist/index70.js +56 -13
- package/dist/index71.cjs +2 -1
- package/dist/index71.js +33 -40
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +5 -5
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +21 -8
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +8 -103
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +9 -190
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +11 -18
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +6 -11
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +13 -19
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +31 -11
- package/dist/index8.cjs +1 -1
- package/dist/index8.js +2 -100
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +14 -25
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +64 -6
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +27 -13
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +3 -16
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +3 -5
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +8 -13
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +190 -9
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +18 -16
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +39 -170
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +30 -34
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +105 -34
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +69 -8
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +113 -5
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +67 -10
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +2 -2
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +15 -103
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +218 -37
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +227 -16
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +42 -6
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +105 -5
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +16 -36
- package/dist/src/index.d.ts +1 -0
- package/dist/src/lib/auth/siwe/siwe.d.ts +3 -2
- package/dist/src/lib/digestKey/digestKey.d.ts +12 -0
- package/package.json +4 -1
package/dist/index74.js
CHANGED
|
@@ -1,106 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
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
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
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
|
|
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 {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
+
f as commitmentToVersionedHash
|
|
14
9
|
};
|
package/dist/index78.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
15
|
+
k as toBlobSidecars
|
|
22
16
|
};
|
package/dist/index79.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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 {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
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"});
|
|
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
|
-
|
|
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
|
-
|
|
3
|
+
o as AuthHeaderEnum
|
|
102
4
|
};
|
package/dist/index80.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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;
|