@gardenfi/utils 2.0.6-beta.16 → 2.0.6-beta.18
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/index101.cjs +1 -1
- package/dist/index101.js +11 -10
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +17 -18
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +641 -6
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +170 -10
- package/dist/index105.cjs +1 -1
- package/dist/index105.js +126 -17
- package/dist/index106.cjs +2 -1
- package/dist/index106.js +3 -644
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +36 -170
- package/dist/index108.cjs +1 -1
- package/dist/index108.js +2 -128
- package/dist/index109.cjs +1 -2
- package/dist/index109.js +2 -3
- package/dist/index110.cjs +1 -1
- package/dist/index110.js +33 -34
- package/dist/index111.cjs +1 -1
- package/dist/index111.js +12 -2
- package/dist/index112.cjs +1 -1
- package/dist/index112.js +20 -2
- package/dist/index113.cjs +1 -1
- package/dist/index113.js +8 -37
- package/dist/index116.cjs +1 -1
- package/dist/index116.js +1 -1
- package/dist/index117.cjs +1 -1
- package/dist/index117.js +1 -1
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +1 -1
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +2 -2
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +1 -1
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +3 -3
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +1 -1
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +1 -1
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +1 -1
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +1 -1
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +1 -1
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +1 -1
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +1 -1
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +1 -1
- package/dist/index62.cjs +2 -1
- package/dist/index62.js +57 -38
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +21 -34
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +37 -66
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +34 -112
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +63 -61
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +113 -2
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +66 -15
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +2 -224
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +13 -228
- package/dist/index71.cjs +1 -2
- package/dist/index71.js +220 -56
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +228 -18
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +2 -2
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +1 -1
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +3 -3
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +5 -5
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +2 -2
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +41 -49
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +1 -1
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +1 -1
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +1 -1
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +2 -2
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +1 -1
- package/package.json +1 -1
package/dist/index72.js
CHANGED
|
@@ -1,24 +1,234 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2
|
+
const d = /* @__PURE__ */ BigInt(0), y = /* @__PURE__ */ BigInt(1), I = /* @__PURE__ */ BigInt(2);
|
|
3
|
+
function h(t) {
|
|
4
|
+
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
5
|
+
}
|
|
6
|
+
function b(t) {
|
|
7
|
+
if (!h(t))
|
|
8
|
+
throw new Error("Uint8Array expected");
|
|
9
|
+
}
|
|
10
|
+
function O(t, n) {
|
|
11
|
+
if (typeof n != "boolean")
|
|
12
|
+
throw new Error(t + " boolean expected, got " + n);
|
|
13
|
+
}
|
|
14
|
+
const T = /* @__PURE__ */ Array.from({ length: 256 }, (t, n) => n.toString(16).padStart(2, "0"));
|
|
15
|
+
function B(t) {
|
|
16
|
+
b(t);
|
|
17
|
+
let n = "";
|
|
18
|
+
for (let r = 0; r < t.length; r++)
|
|
19
|
+
n += T[t[r]];
|
|
20
|
+
return n;
|
|
21
|
+
}
|
|
22
|
+
function S(t) {
|
|
23
|
+
const n = t.toString(16);
|
|
24
|
+
return n.length & 1 ? "0" + n : n;
|
|
25
|
+
}
|
|
26
|
+
function U(t) {
|
|
27
|
+
if (typeof t != "string")
|
|
28
|
+
throw new Error("hex string expected, got " + typeof t);
|
|
29
|
+
return t === "" ? d : BigInt("0x" + t);
|
|
30
|
+
}
|
|
31
|
+
const s = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
32
|
+
function E(t) {
|
|
33
|
+
if (t >= s._0 && t <= s._9)
|
|
34
|
+
return t - s._0;
|
|
35
|
+
if (t >= s.A && t <= s.F)
|
|
36
|
+
return t - (s.A - 10);
|
|
37
|
+
if (t >= s.a && t <= s.f)
|
|
38
|
+
return t - (s.a - 10);
|
|
39
|
+
}
|
|
40
|
+
function m(t) {
|
|
41
|
+
if (typeof t != "string")
|
|
42
|
+
throw new Error("hex string expected, got " + typeof t);
|
|
43
|
+
const n = t.length, r = n / 2;
|
|
44
|
+
if (n % 2)
|
|
45
|
+
throw new Error("hex string expected, got unpadded hex of length " + n);
|
|
46
|
+
const e = new Uint8Array(r);
|
|
47
|
+
for (let o = 0, i = 0; o < r; o++, i += 2) {
|
|
48
|
+
const a = E(t.charCodeAt(i)), f = E(t.charCodeAt(i + 1));
|
|
49
|
+
if (a === void 0 || f === void 0) {
|
|
50
|
+
const c = t[i] + t[i + 1];
|
|
51
|
+
throw new Error('hex string expected, got non-hex character "' + c + '" at index ' + i);
|
|
52
|
+
}
|
|
53
|
+
e[o] = a * 16 + f;
|
|
13
54
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
55
|
+
return e;
|
|
56
|
+
}
|
|
57
|
+
function V(t) {
|
|
58
|
+
return U(B(t));
|
|
59
|
+
}
|
|
60
|
+
function H(t) {
|
|
61
|
+
return b(t), U(B(Uint8Array.from(t).reverse()));
|
|
62
|
+
}
|
|
63
|
+
function v(t, n) {
|
|
64
|
+
return m(t.toString(16).padStart(n * 2, "0"));
|
|
65
|
+
}
|
|
66
|
+
function C(t, n) {
|
|
67
|
+
return v(t, n).reverse();
|
|
68
|
+
}
|
|
69
|
+
function M(t) {
|
|
70
|
+
return m(S(t));
|
|
71
|
+
}
|
|
72
|
+
function R(t, n, r) {
|
|
73
|
+
let e;
|
|
74
|
+
if (typeof n == "string")
|
|
75
|
+
try {
|
|
76
|
+
e = m(n);
|
|
77
|
+
} catch (i) {
|
|
78
|
+
throw new Error(t + " must be hex string or Uint8Array, cause: " + i);
|
|
18
79
|
}
|
|
19
|
-
|
|
80
|
+
else if (h(n))
|
|
81
|
+
e = Uint8Array.from(n);
|
|
82
|
+
else
|
|
83
|
+
throw new Error(t + " must be hex string or Uint8Array");
|
|
84
|
+
const o = e.length;
|
|
85
|
+
if (typeof r == "number" && o !== r)
|
|
86
|
+
throw new Error(t + " of length " + r + " expected, got " + o);
|
|
87
|
+
return e;
|
|
88
|
+
}
|
|
89
|
+
function _(...t) {
|
|
90
|
+
let n = 0;
|
|
91
|
+
for (let e = 0; e < t.length; e++) {
|
|
92
|
+
const o = t[e];
|
|
93
|
+
b(o), n += o.length;
|
|
94
|
+
}
|
|
95
|
+
const r = new Uint8Array(n);
|
|
96
|
+
for (let e = 0, o = 0; e < t.length; e++) {
|
|
97
|
+
const i = t[e];
|
|
98
|
+
r.set(i, o), o += i.length;
|
|
20
99
|
}
|
|
100
|
+
return r;
|
|
101
|
+
}
|
|
102
|
+
function j(t, n) {
|
|
103
|
+
if (t.length !== n.length)
|
|
104
|
+
return !1;
|
|
105
|
+
let r = 0;
|
|
106
|
+
for (let e = 0; e < t.length; e++)
|
|
107
|
+
r |= t[e] ^ n[e];
|
|
108
|
+
return r === 0;
|
|
109
|
+
}
|
|
110
|
+
function z(t) {
|
|
111
|
+
if (typeof t != "string")
|
|
112
|
+
throw new Error("string expected");
|
|
113
|
+
return new Uint8Array(new TextEncoder().encode(t));
|
|
114
|
+
}
|
|
115
|
+
const w = (t) => typeof t == "bigint" && d <= t;
|
|
116
|
+
function N(t, n, r) {
|
|
117
|
+
return w(t) && w(n) && w(r) && n <= t && t < r;
|
|
118
|
+
}
|
|
119
|
+
function D(t, n, r, e) {
|
|
120
|
+
if (!N(n, r, e))
|
|
121
|
+
throw new Error("expected valid " + t + ": " + r + " <= n < " + e + ", got " + n);
|
|
122
|
+
}
|
|
123
|
+
function G(t) {
|
|
124
|
+
let n;
|
|
125
|
+
for (n = 0; t > d; t >>= y, n += 1)
|
|
126
|
+
;
|
|
127
|
+
return n;
|
|
128
|
+
}
|
|
129
|
+
function P(t, n) {
|
|
130
|
+
return t >> BigInt(n) & y;
|
|
131
|
+
}
|
|
132
|
+
function W(t, n, r) {
|
|
133
|
+
return t | (r ? y : d) << BigInt(n);
|
|
134
|
+
}
|
|
135
|
+
const q = (t) => (I << BigInt(t - 1)) - y, p = (t) => new Uint8Array(t), A = (t) => Uint8Array.from(t);
|
|
136
|
+
function J(t, n, r) {
|
|
137
|
+
if (typeof t != "number" || t < 2)
|
|
138
|
+
throw new Error("hashLen must be a number");
|
|
139
|
+
if (typeof n != "number" || n < 2)
|
|
140
|
+
throw new Error("qByteLen must be a number");
|
|
141
|
+
if (typeof r != "function")
|
|
142
|
+
throw new Error("hmacFn must be a function");
|
|
143
|
+
let e = p(t), o = p(t), i = 0;
|
|
144
|
+
const a = () => {
|
|
145
|
+
e.fill(1), o.fill(0), i = 0;
|
|
146
|
+
}, f = (...u) => r(o, e, ...u), c = (u = p()) => {
|
|
147
|
+
o = f(A([0]), u), e = f(), u.length !== 0 && (o = f(A([1]), u), e = f());
|
|
148
|
+
}, x = () => {
|
|
149
|
+
if (i++ >= 1e3)
|
|
150
|
+
throw new Error("drbg: tried 1000 values");
|
|
151
|
+
let u = 0;
|
|
152
|
+
const l = [];
|
|
153
|
+
for (; u < n; ) {
|
|
154
|
+
e = f();
|
|
155
|
+
const g = e.slice();
|
|
156
|
+
l.push(g), u += e.length;
|
|
157
|
+
}
|
|
158
|
+
return _(...l);
|
|
159
|
+
};
|
|
160
|
+
return (u, l) => {
|
|
161
|
+
a(), c(u);
|
|
162
|
+
let g;
|
|
163
|
+
for (; !(g = l(x())); )
|
|
164
|
+
c();
|
|
165
|
+
return a(), g;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
const k = {
|
|
169
|
+
bigint: (t) => typeof t == "bigint",
|
|
170
|
+
function: (t) => typeof t == "function",
|
|
171
|
+
boolean: (t) => typeof t == "boolean",
|
|
172
|
+
string: (t) => typeof t == "string",
|
|
173
|
+
stringOrUint8Array: (t) => typeof t == "string" || h(t),
|
|
174
|
+
isSafeInteger: (t) => Number.isSafeInteger(t),
|
|
175
|
+
array: (t) => Array.isArray(t),
|
|
176
|
+
field: (t, n) => n.Fp.isValid(t),
|
|
177
|
+
hash: (t) => typeof t == "function" && Number.isSafeInteger(t.outputLen)
|
|
178
|
+
};
|
|
179
|
+
function K(t, n, r = {}) {
|
|
180
|
+
const e = (o, i, a) => {
|
|
181
|
+
const f = k[i];
|
|
182
|
+
if (typeof f != "function")
|
|
183
|
+
throw new Error("invalid validator function");
|
|
184
|
+
const c = t[o];
|
|
185
|
+
if (!(a && c === void 0) && !f(c, t))
|
|
186
|
+
throw new Error("param " + String(o) + " is invalid. Expected " + i + ", got " + c);
|
|
187
|
+
};
|
|
188
|
+
for (const [o, i] of Object.entries(n))
|
|
189
|
+
e(o, i, !1);
|
|
190
|
+
for (const [o, i] of Object.entries(r))
|
|
191
|
+
e(o, i, !0);
|
|
192
|
+
return t;
|
|
193
|
+
}
|
|
194
|
+
const Q = () => {
|
|
195
|
+
throw new Error("not implemented");
|
|
196
|
+
};
|
|
197
|
+
function X(t) {
|
|
198
|
+
const n = /* @__PURE__ */ new WeakMap();
|
|
199
|
+
return (r, ...e) => {
|
|
200
|
+
const o = n.get(r);
|
|
201
|
+
if (o !== void 0)
|
|
202
|
+
return o;
|
|
203
|
+
const i = t(r, ...e);
|
|
204
|
+
return n.set(r, i), i;
|
|
205
|
+
};
|
|
21
206
|
}
|
|
22
207
|
export {
|
|
23
|
-
|
|
208
|
+
D as aInRange,
|
|
209
|
+
O as abool,
|
|
210
|
+
b as abytes,
|
|
211
|
+
P as bitGet,
|
|
212
|
+
G as bitLen,
|
|
213
|
+
q as bitMask,
|
|
214
|
+
W as bitSet,
|
|
215
|
+
B as bytesToHex,
|
|
216
|
+
V as bytesToNumberBE,
|
|
217
|
+
H as bytesToNumberLE,
|
|
218
|
+
_ as concatBytes,
|
|
219
|
+
J as createHmacDrbg,
|
|
220
|
+
R as ensureBytes,
|
|
221
|
+
j as equalBytes,
|
|
222
|
+
m as hexToBytes,
|
|
223
|
+
U as hexToNumber,
|
|
224
|
+
N as inRange,
|
|
225
|
+
h as isBytes,
|
|
226
|
+
X as memoized,
|
|
227
|
+
Q as notImplemented,
|
|
228
|
+
v as numberToBytesBE,
|
|
229
|
+
C as numberToBytesLE,
|
|
230
|
+
S as numberToHexUnpadded,
|
|
231
|
+
M as numberToVarBytesBE,
|
|
232
|
+
z as utf8ToBytes,
|
|
233
|
+
K as validateObject
|
|
24
234
|
};
|
package/dist/index74.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index62.cjs"),u=require("./index105.cjs"),f=require("./index36.cjs"),g=require("./index24.cjs");function c(n,e="hex"){const i=o(n),s=u.createCursor(new Uint8Array(i.length));return i.encode(s),e==="hex"?g.bytesToHex(s.bytes):s.bytes}function o(n){return Array.isArray(n)?p(n.map(e=>o(e))):y(n)}function p(n){const e=n.reduce((t,h)=>t+h.length,0),i=l(e);return{length:e<=55?1+e:1+i+e,encode(t){e<=55?t.pushByte(192+e):(t.pushByte(247+i),i===1?t.pushUint8(e):i===2?t.pushUint16(e):i===3?t.pushUint24(e):t.pushUint32(e));for(const{encode:h}of n)h(t)}}}function y(n){const e=typeof n=="string"?f.hexToBytes(n):n,i=l(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+i+e.length,encode(t){e.length===1&&e[0]<128?t.pushBytes(e):e.length<=55?(t.pushByte(128+e.length),t.pushBytes(e)):(t.pushByte(183+i),i===1?t.pushUint8(e.length):i===2?t.pushUint16(e.length):i===3?t.pushUint24(e.length):t.pushUint32(e.length),t.pushBytes(e))}}}function l(n){if(n<2**8)return 1;if(n<2**16)return 2;if(n<2**24)return 3;if(n<2**32)return 4;throw new r.BaseError("Length is too large.")}exports.toRlp=c;
|
package/dist/index74.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseError as l } from "./
|
|
2
|
-
import { createCursor as r } from "./
|
|
1
|
+
import { BaseError as l } from "./index62.js";
|
|
2
|
+
import { createCursor as r } from "./index105.js";
|
|
3
3
|
import { hexToBytes as g } from "./index36.js";
|
|
4
4
|
import { bytesToHex as u } from "./index24.js";
|
|
5
5
|
function m(n, e = "hex") {
|
package/dist/index77.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index106.cjs"),o=require("./index73.cjs"),s=require("./index75.cjs"),r=require("./index24.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/index77.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { presignMessagePrefix as e } from "./
|
|
1
|
+
import { presignMessagePrefix as e } from "./index106.js";
|
|
2
2
|
import { concat as n } from "./index73.js";
|
|
3
3
|
import { size as f } from "./index75.js";
|
|
4
4
|
import { stringToHex as o, bytesToHex as p } from "./index24.js";
|
package/dist/index78.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index65.cjs"),f=require("./index102.cjs"),c=require("./index66.cjs"),I=[],O=[],w=[],B=BigInt(0),a=BigInt(1),A=BigInt(2),S=BigInt(7),H=BigInt(256),T=BigInt(113);for(let i=0,t=a,s=1,n=0;i<24;i++){[s,n]=[n,(2*s+3*n)%5],I.push(2*(5*n+s)),O.push((i+1)*(i+2)/2%64);let o=B;for(let r=0;r<7;r++)t=(t<<a^(t>>S)*T)%H,t&A&&(o^=a<<(a<<BigInt(r))-a);w.push(o)}const[m,E]=f.split(w,!0),y=(i,t,s)=>s>32?f.rotlBH(i,t,s):f.rotlSH(i,t,s),b=(i,t,s)=>s>32?f.rotlBL(i,t,s):f.rotlSL(i,t,s);function L(i,t=24){const s=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let e=0;e<10;e++)s[e]=i[e]^i[e+10]^i[e+20]^i[e+30]^i[e+40];for(let e=0;e<10;e+=2){const h=(e+8)%10,p=(e+2)%10,d=s[p],u=s[p+1],_=y(d,u,1)^s[h],g=b(d,u,1)^s[h+1];for(let k=0;k<50;k+=10)i[e+k]^=_,i[e+k+1]^=g}let o=i[2],r=i[3];for(let e=0;e<24;e++){const h=O[e],p=y(o,r,h),d=b(o,r,h),u=I[e];o=i[u],r=i[u+1],i[u]=p,i[u+1]=d}for(let e=0;e<50;e+=10){for(let h=0;h<10;h++)s[h]=i[e+h];for(let h=0;h<10;h++)i[e+h]^=~s[(h+2)%10]&s[(h+4)%10]}i[0]^=m[n],i[1]^=E[n]}s.fill(0)}class x extends c.Hash{constructor(t,s,n,o=!1,r=24){if(super(),this.blockLen=t,this.suffix=s,this.outputLen=n,this.enableXOF=o,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,l.anumber(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=c.u32(this.state)}keccak(){c.isLE||c.byteSwap32(this.state32),L(this.state32,this.rounds),c.isLE||c.byteSwap32(this.state32),this.posOut=0,this.pos=0}update(t){l.aexists(this);const{blockLen:s,state:n}=this;t=c.toBytes(t);const o=t.length;for(let r=0;r<o;){const e=Math.min(s-this.pos,o-r);for(let h=0;h<e;h++)n[this.pos++]^=t[r++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:s,pos:n,blockLen:o}=this;t[n]^=s,s&128&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){l.aexists(this,!1),l.abytes(t),this.finish();const s=this.state,{blockLen:n}=this;for(let o=0,r=t.length;o<r;){this.posOut>=n&&this.keccak();const e=Math.min(n-this.posOut,r-o);t.set(s.subarray(this.posOut,this.posOut+e),o),this.posOut+=e,o+=e}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return l.anumber(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(l.aoutput(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:s,suffix:n,outputLen:o,rounds:r,enableXOF:e}=this;return t||(t=new x(s,n,o,e,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=n,t.outputLen=o,t.enableXOF=e,t.destroyed=this.destroyed,t}}const F=(i,t,s)=>c.wrapConstructor(()=>new x(t,i,s)),P=F(1,136,256/8);exports.Keccak=x;exports.keccakP=L;exports.keccak_256=P;
|
package/dist/index78.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { anumber as d, aexists as k, abytes as B, aoutput as A } from "./
|
|
2
|
-
import { rotlSH as H, rotlSL as m, rotlBH as S, rotlBL as T, split as F } from "./
|
|
3
|
-
import { wrapConstructor as X, Hash as E, u32 as U, isLE as x, byteSwap32 as I, toBytes as P } from "./
|
|
1
|
+
import { anumber as d, aexists as k, abytes as B, aoutput as A } from "./index65.js";
|
|
2
|
+
import { rotlSH as H, rotlSL as m, rotlBH as S, rotlBL as T, split as F } from "./index102.js";
|
|
3
|
+
import { wrapConstructor as X, Hash as E, u32 as U, isLE as x, byteSwap32 as I, toBytes as P } from "./index66.js";
|
|
4
4
|
const y = [], L = [], b = [], M = /* @__PURE__ */ BigInt(0), f = /* @__PURE__ */ BigInt(1), R = /* @__PURE__ */ BigInt(2), j = /* @__PURE__ */ BigInt(7), C = /* @__PURE__ */ BigInt(256), q = /* @__PURE__ */ BigInt(113);
|
|
5
5
|
for (let e = 0, t = f, s = 1, n = 0; e < 24; e++) {
|
|
6
6
|
[s, n] = [n, (2 * s + 3 * n) % 5], y.push(2 * (5 * n + s)), L.push((e + 1) * (e + 2) / 2 % 64);
|
package/dist/index85.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./index108.cjs"),w=require("./index109.cjs"),t=require("./index32.cjs"),P=require("./index62.cjs"),h=require("./index110.cjs"),d=require("./index91.cjs"),n=require("./index94.cjs"),c=require("./index33.cjs"),I=require("./index75.cjs"),u=require("./index107.cjs"),l=require("./index35.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/index85.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { versionedHashVersionKzg as c } from "./
|
|
2
|
-
import { maxUint256 as m } from "./
|
|
1
|
+
import { versionedHashVersionKzg as c } from "./index108.js";
|
|
2
|
+
import { maxUint256 as m } from "./index109.js";
|
|
3
3
|
import { InvalidAddressError as s } from "./index32.js";
|
|
4
|
-
import { BaseError as h } from "./
|
|
5
|
-
import { EmptyBlobError as P, InvalidVersionedHashSizeError as p, InvalidVersionedHashVersionError as x } from "./
|
|
4
|
+
import { BaseError as h } from "./index62.js";
|
|
5
|
+
import { EmptyBlobError as P, InvalidVersionedHashSizeError as p, InvalidVersionedHashVersionError as x } from "./index110.js";
|
|
6
6
|
import { InvalidChainIdError as n } from "./index91.js";
|
|
7
7
|
import { FeeCapTooHighError as w, TipAboveFeeCapError as E } from "./index94.js";
|
|
8
8
|
import { isAddress as f } from "./index33.js";
|
|
9
9
|
import { size as F } from "./index75.js";
|
|
10
|
-
import { slice as I } from "./
|
|
10
|
+
import { slice as I } from "./index107.js";
|
|
11
11
|
import { hexToNumber as G } from "./index35.js";
|
|
12
12
|
function C(t) {
|
|
13
13
|
const { authorizationList: e } = t;
|
package/dist/index88.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index93.cjs"),g=require("./index32.cjs"),l=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index93.cjs"),g=require("./index32.cjs"),l=require("./index62.cjs"),b=require("./index60.cjs"),x=require("./index33.cjs"),u=require("./index73.cjs"),d=require("./index61.cjs"),y=require("./index75.cjs"),A=require("./index107.cjs"),a=require("./index24.cjs"),z=require("./index100.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;
|
package/dist/index88.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { AbiEncodingLengthMismatchError as y, InvalidAbiEncodingTypeError as u, InvalidArrayError as g, AbiEncodingArrayLengthMismatchError as l, AbiEncodingBytesSizeMismatchError as b } from "./index93.js";
|
|
2
2
|
import { InvalidAddressError as w } from "./index32.js";
|
|
3
|
-
import { BaseError as A } from "./
|
|
3
|
+
import { BaseError as A } from "./index62.js";
|
|
4
4
|
import { IntegerOutOfRangeError as x } from "./index60.js";
|
|
5
5
|
import { isAddress as z } from "./index33.js";
|
|
6
6
|
import { concat as f } from "./index73.js";
|
|
7
7
|
import { padHex as d } from "./index61.js";
|
|
8
8
|
import { size as a } from "./index75.js";
|
|
9
|
-
import { slice as E } from "./
|
|
9
|
+
import { slice as E } from "./index107.js";
|
|
10
10
|
import { numberToHex as m, boolToHex as P, stringToHex as S } from "./index24.js";
|
|
11
11
|
import { integerRegex as I } from "./index100.js";
|
|
12
12
|
function K(e, t) {
|
package/dist/index9.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 w=require("tough-cookie"),f=require("fetch-cookie"),n=require("./index17.cjs"),g=require("./index13.cjs"),m=require("./index14.cjs"),u=require("viem"),c=require("./index3.cjs"),k=require("./index20.cjs"),y=require("./index19.cjs"),C=require("./index21.cjs");class l{constructor(t,i,e){if(this.url=t.endpoint("siwe"),this.walletClient=i,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)??(typeof window<"u"?window.localStorage:new g.MemoryStorage),typeof window>"u"){const r=new w.CookieJar;this.fetchWithCookies=f(fetch,r)}else this.fetchWithCookies=window.fetch.bind(window)}static fromDigestKey(t,i,e){const r=u.createWalletClient({account:y.privateKeyToAccount(c.add0x(i.digestKey)),transport:u.http(),chain:k.mainnet});return new l(t,r,e)}verifyToken(t,i){try{const e=c.parseJwt(t);if(!e)return n.Ok(!1);const r=Math.floor(Date.now()/1e3)+120;return n.Ok(e.exp>r&&e.user_id.toLowerCase()===i.toLowerCase())}catch{return n.Ok(!1)}}async getToken(){var r;if(!((r=this.walletClient.account)!=null&&r.address))return n.Err("Wallet client does not have an account");const t=await this.signStatement();if(t.error)return n.Err(t.error);let i;try{const o=await(await this.fetchWithCookies(this.url.endpoint("tokens"),{method:"POST",body:JSON.stringify({...t.val}),headers:{"Content-Type":"application/json"},credentials:"include"})).json();if(o.error||!o.result)return n.Err(o.error??"Failed to get token");i=o.result}catch(a){return n.Err("Failed to get token",a)}if(!this.verifyToken(i,this.walletClient.account.address).val)throw new Error("Token verification failed");return this.store.setItem(m.StoreKeys.AUTH_TOKEN,i),n.Ok(i)}async signStatement(){var h;if(!((h=this.walletClient.account)!=null&&h.address))return n.Err("Wallet client does not have a valid account");const t=new Date,i=new Date(t.getTime()+300*1e3);let e;try{const s=await(await this.fetchWithCookies(this.url.endpoint("challenges"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"})).json();if(s.error||!s.result)return n.Err("Failed to get nonce");e=s.result}catch(d){return n.Err("Failed to get nonce",d)}const r=await this.walletClient.getChainId(),a=C.createSiweMessage({domain:this.domain,address:this.walletClient.account.address,statement:this.signingStatement,nonce:e,uri:"https://"+this.domain,version:"1",chainId:r,notBefore:i}),o=await this.walletClient.signMessage({account:this.walletClient.account,message:a});return n.Ok({message:a,signature:o,nonce:e})}async getAuthHeaders(){const t=await this.getToken();return t.error?n.Err(t.error):n.Ok({Authorization:c.Authorization(t.val)})}}exports.Siwe=l;
|
package/dist/index9.js
CHANGED
|
@@ -1,64 +1,56 @@
|
|
|
1
|
-
import { CookieJar as
|
|
1
|
+
import { CookieJar as f } from "tough-cookie";
|
|
2
2
|
import m from "fetch-cookie";
|
|
3
|
-
import { Ok as
|
|
4
|
-
import { MemoryStorage as
|
|
5
|
-
import { StoreKeys as
|
|
6
|
-
import { createWalletClient as g, http as
|
|
7
|
-
import { add0x as
|
|
3
|
+
import { Ok as a, Err as r } from "./index17.js";
|
|
4
|
+
import { MemoryStorage as u } from "./index13.js";
|
|
5
|
+
import { StoreKeys as w } from "./index14.js";
|
|
6
|
+
import { createWalletClient as g, http as p } from "viem";
|
|
7
|
+
import { add0x as k, parseJwt as y, Authorization as C } from "./index3.js";
|
|
8
8
|
import { mainnet as T } from "./index20.js";
|
|
9
9
|
import { privateKeyToAccount as v } from "./index19.js";
|
|
10
10
|
import { createSiweMessage as S } from "./index21.js";
|
|
11
|
-
class
|
|
11
|
+
class d {
|
|
12
12
|
constructor(e, n, t) {
|
|
13
|
-
if (this.url = e.endpoint("siwe"), 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) ?? (typeof window < "u" ? window.localStorage : new
|
|
14
|
-
const i = new
|
|
13
|
+
if (this.url = e.endpoint("siwe"), 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) ?? (typeof window < "u" ? window.localStorage : new u()), typeof window > "u") {
|
|
14
|
+
const i = new f();
|
|
15
15
|
this.fetchWithCookies = m(fetch, i);
|
|
16
16
|
} else
|
|
17
17
|
this.fetchWithCookies = window.fetch.bind(window);
|
|
18
18
|
}
|
|
19
19
|
static fromDigestKey(e, n, t) {
|
|
20
20
|
const i = g({
|
|
21
|
-
account: v(
|
|
22
|
-
transport:
|
|
21
|
+
account: v(k(n.digestKey)),
|
|
22
|
+
transport: p(),
|
|
23
23
|
chain: T
|
|
24
24
|
});
|
|
25
|
-
return new
|
|
25
|
+
return new d(e, i, t);
|
|
26
26
|
}
|
|
27
27
|
verifyToken(e, n) {
|
|
28
28
|
try {
|
|
29
29
|
const t = y(e);
|
|
30
|
-
if (!t) return
|
|
30
|
+
if (!t) return a(!1);
|
|
31
31
|
const i = Math.floor(Date.now() / 1e3) + 120;
|
|
32
|
-
return
|
|
32
|
+
return a(
|
|
33
33
|
t.exp > i && t.user_id.toLowerCase() === n.toLowerCase()
|
|
34
34
|
);
|
|
35
35
|
} catch {
|
|
36
|
-
return
|
|
36
|
+
return a(!1);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
async getToken() {
|
|
40
|
-
var
|
|
41
|
-
if (!((
|
|
40
|
+
var i;
|
|
41
|
+
if (!((i = this.walletClient.account) != null && i.address))
|
|
42
42
|
return r("Wallet client does not have an account");
|
|
43
|
-
const e = this.
|
|
44
|
-
if (e)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.walletClient.account.address
|
|
48
|
-
);
|
|
49
|
-
if (o.ok && o.val) return s(e);
|
|
50
|
-
}
|
|
51
|
-
const n = await this.signStatement();
|
|
52
|
-
if (n.error)
|
|
53
|
-
return r(n.error);
|
|
54
|
-
let t;
|
|
43
|
+
const e = await this.signStatement();
|
|
44
|
+
if (e.error)
|
|
45
|
+
return r(e.error);
|
|
46
|
+
let n;
|
|
55
47
|
try {
|
|
56
|
-
const
|
|
48
|
+
const o = await (await this.fetchWithCookies(
|
|
57
49
|
this.url.endpoint("tokens"),
|
|
58
50
|
{
|
|
59
51
|
method: "POST",
|
|
60
52
|
body: JSON.stringify({
|
|
61
|
-
...
|
|
53
|
+
...e.val
|
|
62
54
|
}),
|
|
63
55
|
headers: {
|
|
64
56
|
"Content-Type": "application/json"
|
|
@@ -66,37 +58,37 @@ class f {
|
|
|
66
58
|
credentials: "include"
|
|
67
59
|
}
|
|
68
60
|
)).json();
|
|
69
|
-
if (
|
|
70
|
-
return r(
|
|
71
|
-
|
|
72
|
-
} catch (
|
|
73
|
-
return r("Failed to get token",
|
|
61
|
+
if (o.error || !o.result)
|
|
62
|
+
return r(o.error ?? "Failed to get token");
|
|
63
|
+
n = o.result;
|
|
64
|
+
} catch (s) {
|
|
65
|
+
return r("Failed to get token", s);
|
|
74
66
|
}
|
|
75
|
-
if (!this.verifyToken(
|
|
67
|
+
if (!this.verifyToken(n, this.walletClient.account.address).val)
|
|
76
68
|
throw new Error("Token verification failed");
|
|
77
|
-
return this.store.setItem(
|
|
69
|
+
return this.store.setItem(w.AUTH_TOKEN, n), a(n);
|
|
78
70
|
}
|
|
79
71
|
async signStatement() {
|
|
80
|
-
var
|
|
81
|
-
if (!((
|
|
72
|
+
var l;
|
|
73
|
+
if (!((l = this.walletClient.account) != null && l.address))
|
|
82
74
|
return r("Wallet client does not have a valid account");
|
|
83
75
|
const e = /* @__PURE__ */ new Date(), n = new Date(e.getTime() + 300 * 1e3);
|
|
84
76
|
let t;
|
|
85
77
|
try {
|
|
86
|
-
const
|
|
78
|
+
const c = await (await this.fetchWithCookies(this.url.endpoint("challenges"), {
|
|
87
79
|
method: "POST",
|
|
88
80
|
headers: {
|
|
89
81
|
"Content-Type": "application/json"
|
|
90
82
|
},
|
|
91
83
|
credentials: "include"
|
|
92
84
|
})).json();
|
|
93
|
-
if (
|
|
85
|
+
if (c.error || !c.result)
|
|
94
86
|
return r("Failed to get nonce");
|
|
95
|
-
t =
|
|
87
|
+
t = c.result;
|
|
96
88
|
} catch (h) {
|
|
97
89
|
return r("Failed to get nonce", h);
|
|
98
90
|
}
|
|
99
|
-
const i = await this.walletClient.getChainId(),
|
|
91
|
+
const i = await this.walletClient.getChainId(), s = S({
|
|
100
92
|
domain: this.domain,
|
|
101
93
|
address: this.walletClient.account.address,
|
|
102
94
|
statement: this.signingStatement,
|
|
@@ -107,19 +99,19 @@ class f {
|
|
|
107
99
|
notBefore: n
|
|
108
100
|
}), o = await this.walletClient.signMessage({
|
|
109
101
|
account: this.walletClient.account,
|
|
110
|
-
message:
|
|
102
|
+
message: s
|
|
111
103
|
});
|
|
112
|
-
return
|
|
113
|
-
message:
|
|
104
|
+
return a({
|
|
105
|
+
message: s,
|
|
114
106
|
signature: o,
|
|
115
107
|
nonce: t
|
|
116
108
|
});
|
|
117
109
|
}
|
|
118
110
|
async getAuthHeaders() {
|
|
119
111
|
const e = await this.getToken();
|
|
120
|
-
return e.error ? r(e.error) :
|
|
112
|
+
return e.error ? r(e.error) : a({ Authorization: C(e.val) });
|
|
121
113
|
}
|
|
122
114
|
}
|
|
123
115
|
export {
|
|
124
|
-
|
|
116
|
+
d as Siwe
|
|
125
117
|
};
|
package/dist/index91.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index62.cjs");class i extends e.BaseError{constructor({chainId:r}){super(typeof r=="number"?`Chain ID "${r}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}exports.InvalidChainIdError=i;
|
package/dist/index91.js
CHANGED
package/dist/index93.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index75.cjs"),n=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index75.cjs"),n=require("./index62.cjs");class o extends n.BaseError{constructor({expectedLength:r,givenLength:e,type:t}){super([`ABI encoding array length mismatch for type ${t}.`,`Expected length: ${r}`,`Given length: ${e}`].join(`
|
|
2
2
|
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class a extends n.BaseError{constructor({expectedSize:r,value:e}){super(`Size of bytes "${e}" (bytes${i.size(e)}) does not match expected size (bytes${r}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class c extends n.BaseError{constructor({expectedLength:r,givenLength:e}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${r}`,`Given length (values): ${e}`].join(`
|
|
3
3
|
`),{name:"AbiEncodingLengthMismatchError"})}}class d extends n.BaseError{constructor({expectedSize:r,givenSize:e}){super(`Expected bytes${r}, got bytes${e}.`,{name:"BytesSizeMismatchError"})}}class E extends n.BaseError{constructor(r,{docsPath:e}){super([`Type "${r}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
4
4
|
`),{docsPath:e,name:"InvalidAbiEncodingType"})}}class g extends n.BaseError{constructor(r){super([`Value "${r}" is not a valid array.`].join(`
|
package/dist/index93.js
CHANGED
package/dist/index94.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index95.cjs"),t=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index95.cjs"),t=require("./index62.cjs");class i extends t.BaseError{constructor({cause:r,maxFeePerGas:e}={}){super(`The fee cap (\`maxFeePerGas\`${e?` = ${a.formatGwei(e)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:r,name:"FeeCapTooHighError"})}}Object.defineProperty(i,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class n extends t.BaseError{constructor({cause:r,maxPriorityFeePerGas:e,maxFeePerGas:o}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${e?` = ${a.formatGwei(e)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${o?` = ${a.formatGwei(o)} gwei`:""}).`].join(`
|
|
2
2
|
`),{cause:r,name:"TipAboveFeeCapError"})}}Object.defineProperty(n,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});exports.FeeCapTooHighError=i;exports.TipAboveFeeCapError=n;
|
package/dist/index94.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { formatGwei as a } from "./index95.js";
|
|
2
|
-
import { BaseError as o } from "./
|
|
2
|
+
import { BaseError as o } from "./index62.js";
|
|
3
3
|
class n extends o {
|
|
4
4
|
constructor({ cause: r, maxFeePerGas: e } = {}) {
|
|
5
5
|
super(`The fee cap (\`maxFeePerGas\`${e ? ` = ${a(e)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
|
package/dist/index98.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index118.cjs"),y=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index118.cjs"),y=require("./index110.cjs"),u=require("./index105.cjs"),B=require("./index75.cjs"),h=require("./index36.cjs"),d=require("./index24.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/index98.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { maxBytesPerTransaction as y, bytesPerBlob as a, fieldElementsPerBlob as f, bytesPerFieldElement as p } from "./index118.js";
|
|
2
|
-
import { EmptyBlobError as c, BlobSizeTooLargeError as h } from "./
|
|
3
|
-
import { createCursor as B } from "./
|
|
2
|
+
import { EmptyBlobError as c, BlobSizeTooLargeError as h } from "./index110.js";
|
|
3
|
+
import { createCursor as B } from "./index105.js";
|
|
4
4
|
import { size as u } from "./index75.js";
|
|
5
5
|
import { hexToBytes as x } from "./index36.js";
|
|
6
6
|
import { bytesToHex as d } from "./index24.js";
|