@gardenfi/utils 2.1.2-beta.6 → 2.1.2-beta.7
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/index102.cjs +1 -1
- package/dist/index102.js +6 -20
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +20 -6
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +3 -3
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +2 -2
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +2 -2
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +1 -1
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +2 -2
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +10 -38
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +32 -32
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +37 -66
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +34 -112
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +63 -61
- package/dist/index50.cjs +1 -1
- package/dist/index50.js +113 -2
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +66 -15
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +2 -224
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +13 -228
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +220 -9
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +229 -32
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +3 -3
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +2 -2
- package/dist/index71.cjs +1 -1
- package/dist/index71.js +1 -1
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +191 -4
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +58 -185
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +4 -64
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +1 -1
- package/dist/index80.cjs +2 -1
- package/dist/index80.js +35 -2
- package/dist/index81.cjs +1 -2
- package/dist/index81.js +5 -34
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +2 -6
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +1 -1
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +1 -1
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +1 -1
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +10 -16
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +16 -641
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +624 -153
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +170 -10
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +1 -1
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +2 -2
- package/package.json +1 -1
package/dist/index55.js
CHANGED
|
@@ -1,37 +1,234 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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;
|
|
30
54
|
}
|
|
31
55
|
return e;
|
|
32
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);
|
|
79
|
+
}
|
|
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;
|
|
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
|
+
};
|
|
206
|
+
}
|
|
33
207
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
|
37
234
|
};
|
package/dist/index58.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("./index48.cjs"),f=require("./index91.cjs"),c=require("./index49.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/index58.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 "./index48.js";
|
|
2
|
+
import { rotlSH as H, rotlSL as m, rotlBH as S, rotlBL as T, split as F } from "./index91.js";
|
|
3
|
+
import { wrapConstructor as X, Hash as E, u32 as U, isLE as x, byteSwap32 as I, toBytes as P } from "./index49.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/index68.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./index96.cjs"),w=require("./index97.cjs"),t=require("./index32.cjs"),P=require("./index56.cjs"),h=require("./index98.cjs"),d=require("./index76.cjs"),n=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./index96.cjs"),w=require("./index97.cjs"),t=require("./index32.cjs"),P=require("./index56.cjs"),h=require("./index98.cjs"),d=require("./index76.cjs"),n=require("./index80.cjs"),c=require("./index33.cjs"),I=require("./index74.cjs"),u=require("./index99.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/index68.js
CHANGED
|
@@ -4,9 +4,9 @@ import { InvalidAddressError as s } from "./index32.js";
|
|
|
4
4
|
import { BaseError as h } from "./index56.js";
|
|
5
5
|
import { EmptyBlobError as P, InvalidVersionedHashSizeError as p, InvalidVersionedHashVersionError as x } from "./index98.js";
|
|
6
6
|
import { InvalidChainIdError as n } from "./index76.js";
|
|
7
|
-
import { FeeCapTooHighError as w, TipAboveFeeCapError as E } from "./
|
|
7
|
+
import { FeeCapTooHighError as w, TipAboveFeeCapError as E } from "./index80.js";
|
|
8
8
|
import { isAddress as f } from "./index33.js";
|
|
9
|
-
import { size as F } from "./
|
|
9
|
+
import { size as F } from "./index74.js";
|
|
10
10
|
import { slice as I } from "./index99.js";
|
|
11
11
|
import { hexToNumber as G } from "./index35.js";
|
|
12
12
|
function C(t) {
|
package/dist/index71.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index95.cjs"),o=require("./index65.cjs"),s=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index95.cjs"),o=require("./index65.cjs"),s=require("./index74.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/index71.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { presignMessagePrefix as e } from "./index95.js";
|
|
2
2
|
import { concat as n } from "./index65.js";
|
|
3
|
-
import { size as f } from "./
|
|
3
|
+
import { size as f } from "./index74.js";
|
|
4
4
|
import { stringToHex as o, bytesToHex as p } from "./index24.js";
|
|
5
5
|
function u(r) {
|
|
6
6
|
const t = typeof r == "string" ? o(r) : typeof r.raw == "string" ? r.raw : p(r.raw), i = o(`${e}${f(t)}`);
|
package/dist/index72.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 f=require("./index79.cjs"),g=require("./index32.cjs"),l=require("./index56.cjs"),b=require("./index45.cjs"),x=require("./index33.cjs"),u=require("./index65.cjs"),d=require("./index46.cjs"),y=require("./index74.cjs"),A=require("./index99.cjs"),a=require("./index24.cjs"),z=require("./index86.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/index72.js
CHANGED
|
@@ -1,7 +1,194 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { AbiEncodingLengthMismatchError as y, InvalidAbiEncodingTypeError as u, InvalidArrayError as g, AbiEncodingArrayLengthMismatchError as l, AbiEncodingBytesSizeMismatchError as b } from "./index79.js";
|
|
2
|
+
import { InvalidAddressError as w } from "./index32.js";
|
|
3
|
+
import { BaseError as A } from "./index56.js";
|
|
4
|
+
import { IntegerOutOfRangeError as x } from "./index45.js";
|
|
5
|
+
import { isAddress as z } from "./index33.js";
|
|
6
|
+
import { concat as f } from "./index65.js";
|
|
7
|
+
import { padHex as d } from "./index46.js";
|
|
8
|
+
import { size as a } from "./index74.js";
|
|
9
|
+
import { slice as E } from "./index99.js";
|
|
10
|
+
import { numberToHex as m, boolToHex as P, stringToHex as S } from "./index24.js";
|
|
11
|
+
import { integerRegex as I } from "./index86.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 };
|
|
105
|
+
}
|
|
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;
|
|
4
190
|
}
|
|
5
191
|
export {
|
|
6
|
-
|
|
192
|
+
K as encodeAbiParameters,
|
|
193
|
+
W as getArrayComponents
|
|
7
194
|
};
|
package/dist/index73.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 E=require("./index79.cjs"),z=require("./index32.cjs"),o=require("./index85.cjs"),T=require("./index33.cjs"),u=require("./index74.cjs"),q=require("./index24.cjs"),g=require("./index86.cjs");function P(e){const{domain:n,message:b,primaryType:a,types:r}=e,c=(l,h)=>{for(const v of l){const{name:I,type:s}=v,t=h[I],y=s.match(g.integerRegex);if(y&&(typeof t=="number"||typeof t=="bigint")){const[w,i,D]=y;q.numberToHex(t,{signed:i==="int",size:Number.parseInt(D)/8})}if(s==="address"&&typeof t=="string"&&!T.isAddress(t))throw new z.InvalidAddressError({address:t});const f=s.match(g.bytesRegex);if(f){const[w,i]=f;if(i&&u.size(t)!==Number.parseInt(i))throw new E.BytesSizeMismatchError({expectedSize:Number.parseInt(i),givenSize:u.size(t)})}const p=r[s];p&&(x(s),c(p,t))}};if(r.EIP712Domain&&n){if(typeof n!="object")throw new o.InvalidDomainError({domain:n});c(r.EIP712Domain,n)}if(a!=="EIP712Domain")if(r[a])c(r[a],b);else throw new o.InvalidPrimaryTypeError({primaryType:a,types:r})}function d({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},(typeof(e==null?void 0:e.chainId)=="number"||typeof(e==null?void 0:e.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function x(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new o.InvalidStructTypeError({type:e})}exports.getTypesForEIP712Domain=d;exports.validateTypedData=P;
|