@gardenfi/utils 2.1.2-beta.8 → 2.1.2-beta.9
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/index100.cjs +1 -1
- package/dist/index100.js +5 -5
- package/dist/index101.cjs +1 -2
- package/dist/index101.js +11 -3
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +6 -18
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +15 -638
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +5 -173
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +2 -2
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +2 -2
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +9 -9
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +17 -18
- package/dist/index21.cjs +1 -16
- package/dist/index21.js +30 -112
- package/dist/index22.cjs +16 -1
- package/dist/index22.js +113 -30
- package/dist/index23.cjs +1 -2
- package/dist/index23.js +40 -49
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +45 -24
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +25 -41
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +6 -45
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +12 -24
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +15 -6
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +5 -13
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +12 -14
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +10 -5
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +12 -13
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +11 -10
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +13 -12
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +23 -11
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +55 -13
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +16 -23
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +5 -55
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +8 -16
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +171 -5
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +103 -8
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +20 -170
- package/dist/index43.cjs +2 -1
- package/dist/index43.js +44 -97
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +24 -21
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +1 -1
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +1 -1
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +112 -6
- package/dist/index48.cjs +1 -2
- package/dist/index48.js +15 -58
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +224 -2
- package/dist/index50.cjs +2 -1
- package/dist/index50.js +58 -5
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +21 -4
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +104 -11
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +4 -8
- package/dist/index54.cjs +1 -5
- package/dist/index54.js +16 -55
- package/dist/index55.cjs +1 -2
- package/dist/index55.js +8 -34
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +10 -5
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +12 -2
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +13 -21
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +18 -8
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +6 -10
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +42 -11
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +78 -6
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +14 -13
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +17 -31
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +8 -14
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +186 -59
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +61 -24
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +5 -3
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +40 -3
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +34 -8
- package/dist/index71.cjs +1 -1
- package/dist/index71.js +58 -180
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +65 -16
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +2 -41
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +229 -32
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +2 -70
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +5 -111
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +11 -67
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +8 -2
- package/dist/index79.cjs +5 -1
- package/dist/index79.js +55 -15
- package/dist/index80.cjs +2 -1
- package/dist/index80.js +31 -220
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +5 -231
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +2 -43
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +6 -104
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +31 -16
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +24 -75
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +3 -19
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +11 -8
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +19 -11
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +11 -18
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +2 -2
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +8 -12
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +638 -33
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +173 -2
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +19 -5
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +127 -10
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +2 -128
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +2 -7
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +38 -2
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +34 -33
- package/dist/index99.cjs +2 -1
- package/dist/index99.js +3 -21
- package/package.json +1 -1
package/dist/index48.js
CHANGED
|
@@ -1,62 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return e.cause instanceof r ? e.cause.details : (c = e.cause) != null && c.message ? e.cause.message : e.details;
|
|
12
|
-
})(), a = e.cause instanceof r && e.cause.docsPath || e.docsPath, n = (o = i.getDocsUrl) == null ? void 0 : o.call(i, { ...e, docsPath: a }), b = [
|
|
13
|
-
t || "An error occurred.",
|
|
14
|
-
"",
|
|
15
|
-
...e.metaMessages ? [...e.metaMessages, ""] : [],
|
|
16
|
-
...n ? [`Docs: ${n}`] : [],
|
|
17
|
-
...u ? [`Details: ${u}`] : [],
|
|
18
|
-
...i.version ? [`Version: ${i.version}`] : []
|
|
19
|
-
].join(`
|
|
20
|
-
`);
|
|
21
|
-
super(b, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
|
|
22
|
-
enumerable: !0,
|
|
23
|
-
configurable: !0,
|
|
24
|
-
writable: !0,
|
|
25
|
-
value: void 0
|
|
26
|
-
}), Object.defineProperty(this, "docsPath", {
|
|
27
|
-
enumerable: !0,
|
|
28
|
-
configurable: !0,
|
|
29
|
-
writable: !0,
|
|
30
|
-
value: void 0
|
|
31
|
-
}), Object.defineProperty(this, "metaMessages", {
|
|
32
|
-
enumerable: !0,
|
|
33
|
-
configurable: !0,
|
|
34
|
-
writable: !0,
|
|
35
|
-
value: void 0
|
|
36
|
-
}), Object.defineProperty(this, "shortMessage", {
|
|
37
|
-
enumerable: !0,
|
|
38
|
-
configurable: !0,
|
|
39
|
-
writable: !0,
|
|
40
|
-
value: void 0
|
|
41
|
-
}), Object.defineProperty(this, "version", {
|
|
42
|
-
enumerable: !0,
|
|
43
|
-
configurable: !0,
|
|
44
|
-
writable: !0,
|
|
45
|
-
value: void 0
|
|
46
|
-
}), Object.defineProperty(this, "name", {
|
|
47
|
-
enumerable: !0,
|
|
48
|
-
configurable: !0,
|
|
49
|
-
writable: !0,
|
|
50
|
-
value: "BaseError"
|
|
51
|
-
}), this.details = u, this.docsPath = a, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version = l;
|
|
52
|
-
}
|
|
53
|
-
walk(t) {
|
|
54
|
-
return d(this, t);
|
|
55
|
-
}
|
|
1
|
+
import { hmac as c } from "./index69.js";
|
|
2
|
+
import { randomBytes as m, concatBytes as n } from "./index71.js";
|
|
3
|
+
import { weierstrass as a } from "./index91.js";
|
|
4
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5
|
+
function i(r) {
|
|
6
|
+
return {
|
|
7
|
+
hash: r,
|
|
8
|
+
hmac: (e, ...t) => c(r, e, n(...t)),
|
|
9
|
+
randomBytes: m
|
|
10
|
+
};
|
|
56
11
|
}
|
|
57
|
-
function
|
|
58
|
-
|
|
12
|
+
function p(r, e) {
|
|
13
|
+
const t = (o) => a({ ...r, ...i(o) });
|
|
14
|
+
return { ...t(e), create: t };
|
|
59
15
|
}
|
|
60
16
|
export {
|
|
61
|
-
|
|
17
|
+
p as createCurve,
|
|
18
|
+
i as getHash
|
|
62
19
|
};
|
package/dist/index49.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="2.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index74.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const d=BigInt(0),c=BigInt(1),w=BigInt(2),j=BigInt(3),E=BigInt(4),S=BigInt(5),I=BigInt(8);function g(t,i){const r=t%i;return r>=d?r:i+r}function L(t,i,r){if(i<d)throw new Error("invalid exponent, negatives unsupported");if(r<=d)throw new Error("invalid modulus");if(r===c)return d;let n=c;for(;i>d;)i&c&&(n=n*t%r),t=t*t%r,i>>=c;return n}function H(t,i,r){let n=t;for(;i-- >d;)n*=n,n%=r;return n}function m(t,i){if(t===d)throw new Error("invert: expected non-zero number");if(i<=d)throw new Error("invert: expected positive modulus, got "+i);let r=g(t,i),n=i,s=d,u=c;for(;r!==d;){const o=n/r,e=n%r,l=s-u*o;n=r,r=e,s=u,u=l}if(n!==c)throw new Error("invert: does not exist");return g(s,i)}function T(t){const i=(t-c)/w;let r,n,s;for(r=t-c,n=0;r%w===d;r/=w,n++);for(s=w;s<t&&L(s,i,t)!==t-c;s++)if(s>1e3)throw new Error("Cannot find square root: likely non-prime P");if(n===1){const f=(t+c)/E;return function(e,l){const h=e.pow(l,f);if(!e.eql(e.sqr(h),l))throw new Error("Cannot find square root");return h}}const u=(r+c)/w;return function(o,e){if(o.pow(e,i)===o.neg(o.ONE))throw new Error("Cannot find square root");let l=n,h=o.pow(o.mul(o.ONE,s),r),v=o.pow(e,u),q=o.pow(e,r);for(;!o.eql(q,o.ONE);){if(o.eql(q,o.ZERO))return o.ZERO;let b=1;for(let B=o.sqr(q);b<l&&!o.eql(B,o.ONE);b++)B=o.sqr(B);const y=o.pow(h,c<<BigInt(l-b-1));h=o.sqr(y),v=o.mul(v,y),q=o.mul(q,h),l=b}return v}}function x(t){if(t%E===j){const i=(t+c)/E;return function(n,s){const u=n.pow(s,i);if(!n.eql(n.sqr(u),s))throw new Error("Cannot find square root");return u}}if(t%I===S){const i=(t-S)/I;return function(n,s){const u=n.mul(s,w),f=n.pow(u,i),o=n.mul(s,f),e=n.mul(n.mul(o,w),f),l=n.mul(o,n.sub(e,n.ONE));if(!n.eql(n.sqr(l),s))throw new Error("Cannot find square root");return l}}return T(t)}const Z=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function k(t){const i={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=Z.reduce((n,s)=>(n[s]="function",n),i);return a.validateObject(t,r)}function M(t,i,r){if(r<d)throw new Error("invalid exponent, negatives unsupported");if(r===d)return t.ONE;if(r===c)return i;let n=t.ONE,s=i;for(;r>d;)r&c&&(n=t.mul(n,s)),s=t.sqr(s),r>>=c;return n}function _(t,i){const r=new Array(i.length),n=i.reduce((u,f,o)=>t.is0(f)?u:(r[o]=u,t.mul(u,f)),t.ONE),s=t.inv(n);return i.reduceRight((u,f,o)=>t.is0(f)?u:(r[o]=t.mul(u,r[o]),t.mul(u,f)),s),r}function p(t,i){const r=i!==void 0?i:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function z(t,i,r=!1,n={}){if(t<=d)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:s,nByteLength:u}=p(t,i);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let f;const o=Object.freeze({ORDER:t,isLE:r,BITS:s,BYTES:u,MASK:a.bitMask(s),ZERO:d,ONE:c,create:e=>g(e,t),isValid:e=>{if(typeof e!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof e);return d<=e&&e<t},is0:e=>e===d,isOdd:e=>(e&c)===c,neg:e=>g(-e,t),eql:(e,l)=>e===l,sqr:e=>g(e*e,t),add:(e,l)=>g(e+l,t),sub:(e,l)=>g(e-l,t),mul:(e,l)=>g(e*l,t),pow:(e,l)=>M(o,e,l),div:(e,l)=>g(e*m(l,t),t),sqrN:e=>e*e,addN:(e,l)=>e+l,subN:(e,l)=>e-l,mulN:(e,l)=>e*l,inv:e=>m(e,t),sqrt:n.sqrt||(e=>(f||(f=x(t)),f(o,e))),invertBatch:e=>_(o,e),cmov:(e,l,h)=>h?l:e,toBytes:e=>r?a.numberToBytesLE(e,u):a.numberToBytesBE(e,u),fromBytes:e=>{if(e.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+e.length);return r?a.bytesToNumberLE(e):a.bytesToNumberBE(e)}});return Object.freeze(o)}function N(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const i=t.toString(2).length;return Math.ceil(i/8)}function C(t){const i=N(t);return i+Math.ceil(i/2)}function A(t,i,r=!1){const n=t.length,s=N(i),u=C(i);if(n<16||n<u||n>1024)throw new Error("expected "+u+"-1024 bytes of input, got "+n);const f=r?a.bytesToNumberLE(t):a.bytesToNumberBE(t),o=g(f,i-c)+c;return r?a.numberToBytesLE(o,s):a.numberToBytesBE(o,s)}exports.Field=z;exports.FpInvertBatch=_;exports.FpPow=M;exports.FpSqrt=x;exports.getFieldBytesLength=N;exports.getMinHashLength=C;exports.invert=m;exports.mapHashToField=A;exports.mod=g;exports.nLength=p;exports.pow=L;exports.pow2=H;exports.tonelliShanks=T;exports.validateField=k;
|
package/dist/index49.js
CHANGED
|
@@ -1,4 +1,226 @@
|
|
|
1
|
-
|
|
1
|
+
import { numberToBytesLE as S, numberToBytesBE as x, bitMask as _, bytesToNumberLE as y, bytesToNumberBE as L, validateObject as M } from "./index74.js";
|
|
2
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3
|
+
const d = BigInt(0), c = BigInt(1), w = /* @__PURE__ */ BigInt(2), C = /* @__PURE__ */ BigInt(3), b = /* @__PURE__ */ BigInt(4), N = /* @__PURE__ */ BigInt(5), m = /* @__PURE__ */ BigInt(8);
|
|
4
|
+
function g(t, i) {
|
|
5
|
+
const r = t % i;
|
|
6
|
+
return r >= d ? r : i + r;
|
|
7
|
+
}
|
|
8
|
+
function Z(t, i, r) {
|
|
9
|
+
if (i < d)
|
|
10
|
+
throw new Error("invalid exponent, negatives unsupported");
|
|
11
|
+
if (r <= d)
|
|
12
|
+
throw new Error("invalid modulus");
|
|
13
|
+
if (r === c)
|
|
14
|
+
return d;
|
|
15
|
+
let e = c;
|
|
16
|
+
for (; i > d; )
|
|
17
|
+
i & c && (e = e * t % r), t = t * t % r, i >>= c;
|
|
18
|
+
return e;
|
|
19
|
+
}
|
|
20
|
+
function V(t, i, r) {
|
|
21
|
+
let e = t;
|
|
22
|
+
for (; i-- > d; )
|
|
23
|
+
e *= e, e %= r;
|
|
24
|
+
return e;
|
|
25
|
+
}
|
|
26
|
+
function I(t, i) {
|
|
27
|
+
if (t === d)
|
|
28
|
+
throw new Error("invert: expected non-zero number");
|
|
29
|
+
if (i <= d)
|
|
30
|
+
throw new Error("invert: expected positive modulus, got " + i);
|
|
31
|
+
let r = g(t, i), e = i, s = d, u = c;
|
|
32
|
+
for (; r !== d; ) {
|
|
33
|
+
const o = e / r, n = e % r, l = s - u * o;
|
|
34
|
+
e = r, r = n, s = u, u = l;
|
|
35
|
+
}
|
|
36
|
+
if (e !== c)
|
|
37
|
+
throw new Error("invert: does not exist");
|
|
38
|
+
return g(s, i);
|
|
39
|
+
}
|
|
40
|
+
function j(t) {
|
|
41
|
+
const i = (t - c) / w;
|
|
42
|
+
let r, e, s;
|
|
43
|
+
for (r = t - c, e = 0; r % w === d; r /= w, e++)
|
|
44
|
+
;
|
|
45
|
+
for (s = w; s < t && Z(s, i, t) !== t - c; s++)
|
|
46
|
+
if (s > 1e3)
|
|
47
|
+
throw new Error("Cannot find square root: likely non-prime P");
|
|
48
|
+
if (e === 1) {
|
|
49
|
+
const f = (t + c) / b;
|
|
50
|
+
return function(n, l) {
|
|
51
|
+
const h = n.pow(l, f);
|
|
52
|
+
if (!n.eql(n.sqr(h), l))
|
|
53
|
+
throw new Error("Cannot find square root");
|
|
54
|
+
return h;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const u = (r + c) / w;
|
|
58
|
+
return function(o, n) {
|
|
59
|
+
if (o.pow(n, i) === o.neg(o.ONE))
|
|
60
|
+
throw new Error("Cannot find square root");
|
|
61
|
+
let l = e, h = o.pow(o.mul(o.ONE, s), r), v = o.pow(n, u), a = o.pow(n, r);
|
|
62
|
+
for (; !o.eql(a, o.ONE); ) {
|
|
63
|
+
if (o.eql(a, o.ZERO))
|
|
64
|
+
return o.ZERO;
|
|
65
|
+
let q = 1;
|
|
66
|
+
for (let B = o.sqr(a); q < l && !o.eql(B, o.ONE); q++)
|
|
67
|
+
B = o.sqr(B);
|
|
68
|
+
const E = o.pow(h, c << BigInt(l - q - 1));
|
|
69
|
+
h = o.sqr(E), v = o.mul(v, E), a = o.mul(a, h), l = q;
|
|
70
|
+
}
|
|
71
|
+
return v;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function z(t) {
|
|
75
|
+
if (t % b === C) {
|
|
76
|
+
const i = (t + c) / b;
|
|
77
|
+
return function(e, s) {
|
|
78
|
+
const u = e.pow(s, i);
|
|
79
|
+
if (!e.eql(e.sqr(u), s))
|
|
80
|
+
throw new Error("Cannot find square root");
|
|
81
|
+
return u;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (t % m === N) {
|
|
85
|
+
const i = (t - N) / m;
|
|
86
|
+
return function(e, s) {
|
|
87
|
+
const u = e.mul(s, w), f = e.pow(u, i), o = e.mul(s, f), n = e.mul(e.mul(o, w), f), l = e.mul(o, e.sub(n, e.ONE));
|
|
88
|
+
if (!e.eql(e.sqr(l), s))
|
|
89
|
+
throw new Error("Cannot find square root");
|
|
90
|
+
return l;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return j(t);
|
|
94
|
+
}
|
|
95
|
+
const A = [
|
|
96
|
+
"create",
|
|
97
|
+
"isValid",
|
|
98
|
+
"is0",
|
|
99
|
+
"neg",
|
|
100
|
+
"inv",
|
|
101
|
+
"sqrt",
|
|
102
|
+
"sqr",
|
|
103
|
+
"eql",
|
|
104
|
+
"add",
|
|
105
|
+
"sub",
|
|
106
|
+
"mul",
|
|
107
|
+
"pow",
|
|
108
|
+
"div",
|
|
109
|
+
"addN",
|
|
110
|
+
"subN",
|
|
111
|
+
"mulN",
|
|
112
|
+
"sqrN"
|
|
113
|
+
];
|
|
114
|
+
function Y(t) {
|
|
115
|
+
const i = {
|
|
116
|
+
ORDER: "bigint",
|
|
117
|
+
MASK: "bigint",
|
|
118
|
+
BYTES: "isSafeInteger",
|
|
119
|
+
BITS: "isSafeInteger"
|
|
120
|
+
}, r = A.reduce((e, s) => (e[s] = "function", e), i);
|
|
121
|
+
return M(t, r);
|
|
122
|
+
}
|
|
123
|
+
function k(t, i, r) {
|
|
124
|
+
if (r < d)
|
|
125
|
+
throw new Error("invalid exponent, negatives unsupported");
|
|
126
|
+
if (r === d)
|
|
127
|
+
return t.ONE;
|
|
128
|
+
if (r === c)
|
|
129
|
+
return i;
|
|
130
|
+
let e = t.ONE, s = i;
|
|
131
|
+
for (; r > d; )
|
|
132
|
+
r & c && (e = t.mul(e, s)), s = t.sqr(s), r >>= c;
|
|
133
|
+
return e;
|
|
134
|
+
}
|
|
135
|
+
function H(t, i) {
|
|
136
|
+
const r = new Array(i.length), e = i.reduce((u, f, o) => t.is0(f) ? u : (r[o] = u, t.mul(u, f)), t.ONE), s = t.inv(e);
|
|
137
|
+
return i.reduceRight((u, f, o) => t.is0(f) ? u : (r[o] = t.mul(u, r[o]), t.mul(u, f)), s), r;
|
|
138
|
+
}
|
|
139
|
+
function K(t, i) {
|
|
140
|
+
const r = i !== void 0 ? i : t.toString(2).length, e = Math.ceil(r / 8);
|
|
141
|
+
return { nBitLength: r, nByteLength: e };
|
|
142
|
+
}
|
|
143
|
+
function p(t, i, r = !1, e = {}) {
|
|
144
|
+
if (t <= d)
|
|
145
|
+
throw new Error("invalid field: expected ORDER > 0, got " + t);
|
|
146
|
+
const { nBitLength: s, nByteLength: u } = K(t, i);
|
|
147
|
+
if (u > 2048)
|
|
148
|
+
throw new Error("invalid field: expected ORDER of <= 2048 bytes");
|
|
149
|
+
let f;
|
|
150
|
+
const o = Object.freeze({
|
|
151
|
+
ORDER: t,
|
|
152
|
+
isLE: r,
|
|
153
|
+
BITS: s,
|
|
154
|
+
BYTES: u,
|
|
155
|
+
MASK: _(s),
|
|
156
|
+
ZERO: d,
|
|
157
|
+
ONE: c,
|
|
158
|
+
create: (n) => g(n, t),
|
|
159
|
+
isValid: (n) => {
|
|
160
|
+
if (typeof n != "bigint")
|
|
161
|
+
throw new Error("invalid field element: expected bigint, got " + typeof n);
|
|
162
|
+
return d <= n && n < t;
|
|
163
|
+
},
|
|
164
|
+
is0: (n) => n === d,
|
|
165
|
+
isOdd: (n) => (n & c) === c,
|
|
166
|
+
neg: (n) => g(-n, t),
|
|
167
|
+
eql: (n, l) => n === l,
|
|
168
|
+
sqr: (n) => g(n * n, t),
|
|
169
|
+
add: (n, l) => g(n + l, t),
|
|
170
|
+
sub: (n, l) => g(n - l, t),
|
|
171
|
+
mul: (n, l) => g(n * l, t),
|
|
172
|
+
pow: (n, l) => k(o, n, l),
|
|
173
|
+
div: (n, l) => g(n * I(l, t), t),
|
|
174
|
+
// Same as above, but doesn't normalize
|
|
175
|
+
sqrN: (n) => n * n,
|
|
176
|
+
addN: (n, l) => n + l,
|
|
177
|
+
subN: (n, l) => n - l,
|
|
178
|
+
mulN: (n, l) => n * l,
|
|
179
|
+
inv: (n) => I(n, t),
|
|
180
|
+
sqrt: e.sqrt || ((n) => (f || (f = z(t)), f(o, n))),
|
|
181
|
+
invertBatch: (n) => H(o, n),
|
|
182
|
+
// TODO: do we really need constant cmov?
|
|
183
|
+
// We don't have const-time bigints anyway, so probably will be not very useful
|
|
184
|
+
cmov: (n, l, h) => h ? l : n,
|
|
185
|
+
toBytes: (n) => r ? S(n, u) : x(n, u),
|
|
186
|
+
fromBytes: (n) => {
|
|
187
|
+
if (n.length !== u)
|
|
188
|
+
throw new Error("Field.fromBytes: expected " + u + " bytes, got " + n.length);
|
|
189
|
+
return r ? y(n) : L(n);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
return Object.freeze(o);
|
|
193
|
+
}
|
|
194
|
+
function T(t) {
|
|
195
|
+
if (typeof t != "bigint")
|
|
196
|
+
throw new Error("field order must be bigint");
|
|
197
|
+
const i = t.toString(2).length;
|
|
198
|
+
return Math.ceil(i / 8);
|
|
199
|
+
}
|
|
200
|
+
function O(t) {
|
|
201
|
+
const i = T(t);
|
|
202
|
+
return i + Math.ceil(i / 2);
|
|
203
|
+
}
|
|
204
|
+
function G(t, i, r = !1) {
|
|
205
|
+
const e = t.length, s = T(i), u = O(i);
|
|
206
|
+
if (e < 16 || e < u || e > 1024)
|
|
207
|
+
throw new Error("expected " + u + "-1024 bytes of input, got " + e);
|
|
208
|
+
const f = r ? y(t) : L(t), o = g(f, i - c) + c;
|
|
209
|
+
return r ? S(o, s) : x(o, s);
|
|
210
|
+
}
|
|
2
211
|
export {
|
|
3
|
-
|
|
212
|
+
p as Field,
|
|
213
|
+
H as FpInvertBatch,
|
|
214
|
+
k as FpPow,
|
|
215
|
+
z as FpSqrt,
|
|
216
|
+
T as getFieldBytesLength,
|
|
217
|
+
O as getMinHashLength,
|
|
218
|
+
I as invert,
|
|
219
|
+
G as mapHashToField,
|
|
220
|
+
g as mod,
|
|
221
|
+
K as nLength,
|
|
222
|
+
Z as pow,
|
|
223
|
+
V as pow2,
|
|
224
|
+
j as tonelliShanks,
|
|
225
|
+
Y as validateField
|
|
4
226
|
};
|
package/dist/index50.cjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index75.cjs");let i={getDocsUrl:({docsBaseUrl:s,docsPath:t="",docsSlug:e})=>t?`${s??"https://viem.sh"}${t}${e?`#${e}`:""}`:void 0,version:`viem@${l.version}`};class u extends Error{constructor(t,e={}){var o;const r=(()=>{var c;return e.cause instanceof u?e.cause.details:(c=e.cause)!=null&&c.message?e.cause.message:e.details})(),n=e.cause instanceof u&&e.cause.docsPath||e.docsPath,a=(o=i.getDocsUrl)==null?void 0:o.call(i,{...e,docsPath:n}),b=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...i.version?[`Version: ${i.version}`]:[]].join(`
|
|
2
|
+
`);super(b,e.cause?{cause:e.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=n,this.metaMessages=e.metaMessages,this.name=e.name??this.name,this.shortMessage=t,this.version=l.version}walk(t){return d(this,t)}}function d(s,t){return t!=null&&t(s)?s:s&&typeof s=="object"&&"cause"in s&&s.cause!==void 0?d(s.cause,t):t?null:s}exports.BaseError=u;
|
package/dist/index50.js
CHANGED
|
@@ -1,9 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { version as l } from "./index75.js";
|
|
2
|
+
let i = {
|
|
3
|
+
getDocsUrl: ({ docsBaseUrl: s, docsPath: t = "", docsSlug: e }) => t ? `${s ?? "https://viem.sh"}${t}${e ? `#${e}` : ""}` : void 0,
|
|
4
|
+
version: `viem@${l}`
|
|
5
|
+
};
|
|
6
|
+
class r extends Error {
|
|
7
|
+
constructor(t, e = {}) {
|
|
8
|
+
var o;
|
|
9
|
+
const u = (() => {
|
|
10
|
+
var c;
|
|
11
|
+
return e.cause instanceof r ? e.cause.details : (c = e.cause) != null && c.message ? e.cause.message : e.details;
|
|
12
|
+
})(), a = e.cause instanceof r && e.cause.docsPath || e.docsPath, n = (o = i.getDocsUrl) == null ? void 0 : o.call(i, { ...e, docsPath: a }), b = [
|
|
13
|
+
t || "An error occurred.",
|
|
14
|
+
"",
|
|
15
|
+
...e.metaMessages ? [...e.metaMessages, ""] : [],
|
|
16
|
+
...n ? [`Docs: ${n}`] : [],
|
|
17
|
+
...u ? [`Details: ${u}`] : [],
|
|
18
|
+
...i.version ? [`Version: ${i.version}`] : []
|
|
19
|
+
].join(`
|
|
20
|
+
`);
|
|
21
|
+
super(b, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
|
|
22
|
+
enumerable: !0,
|
|
23
|
+
configurable: !0,
|
|
24
|
+
writable: !0,
|
|
25
|
+
value: void 0
|
|
26
|
+
}), Object.defineProperty(this, "docsPath", {
|
|
27
|
+
enumerable: !0,
|
|
28
|
+
configurable: !0,
|
|
29
|
+
writable: !0,
|
|
30
|
+
value: void 0
|
|
31
|
+
}), Object.defineProperty(this, "metaMessages", {
|
|
32
|
+
enumerable: !0,
|
|
33
|
+
configurable: !0,
|
|
34
|
+
writable: !0,
|
|
35
|
+
value: void 0
|
|
36
|
+
}), Object.defineProperty(this, "shortMessage", {
|
|
37
|
+
enumerable: !0,
|
|
38
|
+
configurable: !0,
|
|
39
|
+
writable: !0,
|
|
40
|
+
value: void 0
|
|
41
|
+
}), Object.defineProperty(this, "version", {
|
|
42
|
+
enumerable: !0,
|
|
43
|
+
configurable: !0,
|
|
44
|
+
writable: !0,
|
|
45
|
+
value: void 0
|
|
46
|
+
}), Object.defineProperty(this, "name", {
|
|
47
|
+
enumerable: !0,
|
|
48
|
+
configurable: !0,
|
|
49
|
+
writable: !0,
|
|
50
|
+
value: "BaseError"
|
|
51
|
+
}), this.details = u, this.docsPath = a, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version = l;
|
|
52
|
+
}
|
|
53
|
+
walk(t) {
|
|
54
|
+
return d(this, t);
|
|
5
55
|
}
|
|
6
56
|
}
|
|
57
|
+
function d(s, t) {
|
|
58
|
+
return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? d(s.cause, t) : t ? null : s;
|
|
59
|
+
}
|
|
7
60
|
export {
|
|
8
|
-
|
|
61
|
+
r as BaseError
|
|
9
62
|
};
|
package/dist/index51.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class i extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&t!==void 0&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const s=this.keys().next().value;s&&this.delete(s)}return this}}exports.LruMap=i;
|
package/dist/index51.js
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
class r extends Map {
|
|
2
|
+
constructor(e) {
|
|
3
|
+
super(), Object.defineProperty(this, "maxSize", {
|
|
4
|
+
enumerable: !0,
|
|
5
|
+
configurable: !0,
|
|
6
|
+
writable: !0,
|
|
7
|
+
value: void 0
|
|
8
|
+
}), this.maxSize = e;
|
|
9
|
+
}
|
|
10
|
+
get(e) {
|
|
11
|
+
const t = super.get(e);
|
|
12
|
+
return super.has(e) && t !== void 0 && (this.delete(e), super.set(e, t)), t;
|
|
13
|
+
}
|
|
14
|
+
set(e, t) {
|
|
15
|
+
if (super.set(e, t), this.maxSize && this.size > this.maxSize) {
|
|
16
|
+
const s = this.keys().next().value;
|
|
17
|
+
s && this.delete(s);
|
|
18
|
+
}
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
4
21
|
}
|
|
5
22
|
export {
|
|
6
|
-
|
|
23
|
+
r as LruMap
|
|
7
24
|
};
|
package/dist/index52.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 l=require("./index70.cjs"),f=require("./index93.cjs"),c=require("./index71.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/index52.js
CHANGED
|
@@ -1,14 +1,107 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { anumber as d, aexists as k, abytes as B, aoutput as A } from "./index70.js";
|
|
2
|
+
import { rotlSH as H, rotlSL as m, rotlBH as S, rotlBL as T, split as F } from "./index93.js";
|
|
3
|
+
import { wrapConstructor as X, Hash as E, u32 as U, isLE as x, byteSwap32 as I, toBytes as P } from "./index71.js";
|
|
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
|
+
for (let e = 0, t = f, s = 1, n = 0; e < 24; e++) {
|
|
6
|
+
[s, n] = [n, (2 * s + 3 * n) % 5], y.push(2 * (5 * n + s)), L.push((e + 1) * (e + 2) / 2 % 64);
|
|
7
|
+
let o = M;
|
|
8
|
+
for (let r = 0; r < 7; r++)
|
|
9
|
+
t = (t << f ^ (t >> j) * q) % C, t & R && (o ^= f << (f << /* @__PURE__ */ BigInt(r)) - f);
|
|
10
|
+
b.push(o);
|
|
11
11
|
}
|
|
12
|
+
const [v, z] = /* @__PURE__ */ F(b, !0), O = (e, t, s) => s > 32 ? S(e, t, s) : H(e, t, s), w = (e, t, s) => s > 32 ? T(e, t, s) : m(e, t, s);
|
|
13
|
+
function D(e, t = 24) {
|
|
14
|
+
const s = new Uint32Array(10);
|
|
15
|
+
for (let n = 24 - t; n < 24; n++) {
|
|
16
|
+
for (let i = 0; i < 10; i++)
|
|
17
|
+
s[i] = e[i] ^ e[i + 10] ^ e[i + 20] ^ e[i + 30] ^ e[i + 40];
|
|
18
|
+
for (let i = 0; i < 10; i += 2) {
|
|
19
|
+
const h = (i + 8) % 10, l = (i + 2) % 10, u = s[l], c = s[l + 1], _ = O(u, c, 1) ^ s[h], g = w(u, c, 1) ^ s[h + 1];
|
|
20
|
+
for (let a = 0; a < 50; a += 10)
|
|
21
|
+
e[i + a] ^= _, e[i + a + 1] ^= g;
|
|
22
|
+
}
|
|
23
|
+
let o = e[2], r = e[3];
|
|
24
|
+
for (let i = 0; i < 24; i++) {
|
|
25
|
+
const h = L[i], l = O(o, r, h), u = w(o, r, h), c = y[i];
|
|
26
|
+
o = e[c], r = e[c + 1], e[c] = l, e[c + 1] = u;
|
|
27
|
+
}
|
|
28
|
+
for (let i = 0; i < 50; i += 10) {
|
|
29
|
+
for (let h = 0; h < 10; h++)
|
|
30
|
+
s[h] = e[i + h];
|
|
31
|
+
for (let h = 0; h < 10; h++)
|
|
32
|
+
e[i + h] ^= ~s[(h + 2) % 10] & s[(h + 4) % 10];
|
|
33
|
+
}
|
|
34
|
+
e[0] ^= v[n], e[1] ^= z[n];
|
|
35
|
+
}
|
|
36
|
+
s.fill(0);
|
|
37
|
+
}
|
|
38
|
+
class p extends E {
|
|
39
|
+
// NOTE: we accept arguments in bytes instead of bits here.
|
|
40
|
+
constructor(t, s, n, o = !1, r = 24) {
|
|
41
|
+
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, d(n), 0 >= this.blockLen || this.blockLen >= 200)
|
|
42
|
+
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
43
|
+
this.state = new Uint8Array(200), this.state32 = U(this.state);
|
|
44
|
+
}
|
|
45
|
+
keccak() {
|
|
46
|
+
x || I(this.state32), D(this.state32, this.rounds), x || I(this.state32), this.posOut = 0, this.pos = 0;
|
|
47
|
+
}
|
|
48
|
+
update(t) {
|
|
49
|
+
k(this);
|
|
50
|
+
const { blockLen: s, state: n } = this;
|
|
51
|
+
t = P(t);
|
|
52
|
+
const o = t.length;
|
|
53
|
+
for (let r = 0; r < o; ) {
|
|
54
|
+
const i = Math.min(s - this.pos, o - r);
|
|
55
|
+
for (let h = 0; h < i; h++)
|
|
56
|
+
n[this.pos++] ^= t[r++];
|
|
57
|
+
this.pos === s && this.keccak();
|
|
58
|
+
}
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
finish() {
|
|
62
|
+
if (this.finished)
|
|
63
|
+
return;
|
|
64
|
+
this.finished = !0;
|
|
65
|
+
const { state: t, suffix: s, pos: n, blockLen: o } = this;
|
|
66
|
+
t[n] ^= s, s & 128 && n === o - 1 && this.keccak(), t[o - 1] ^= 128, this.keccak();
|
|
67
|
+
}
|
|
68
|
+
writeInto(t) {
|
|
69
|
+
k(this, !1), B(t), this.finish();
|
|
70
|
+
const s = this.state, { blockLen: n } = this;
|
|
71
|
+
for (let o = 0, r = t.length; o < r; ) {
|
|
72
|
+
this.posOut >= n && this.keccak();
|
|
73
|
+
const i = Math.min(n - this.posOut, r - o);
|
|
74
|
+
t.set(s.subarray(this.posOut, this.posOut + i), o), this.posOut += i, o += i;
|
|
75
|
+
}
|
|
76
|
+
return t;
|
|
77
|
+
}
|
|
78
|
+
xofInto(t) {
|
|
79
|
+
if (!this.enableXOF)
|
|
80
|
+
throw new Error("XOF is not possible for this instance");
|
|
81
|
+
return this.writeInto(t);
|
|
82
|
+
}
|
|
83
|
+
xof(t) {
|
|
84
|
+
return d(t), this.xofInto(new Uint8Array(t));
|
|
85
|
+
}
|
|
86
|
+
digestInto(t) {
|
|
87
|
+
if (A(t, this), this.finished)
|
|
88
|
+
throw new Error("digest() was already called");
|
|
89
|
+
return this.writeInto(t), this.destroy(), t;
|
|
90
|
+
}
|
|
91
|
+
digest() {
|
|
92
|
+
return this.digestInto(new Uint8Array(this.outputLen));
|
|
93
|
+
}
|
|
94
|
+
destroy() {
|
|
95
|
+
this.destroyed = !0, this.state.fill(0);
|
|
96
|
+
}
|
|
97
|
+
_cloneInto(t) {
|
|
98
|
+
const { blockLen: s, suffix: n, outputLen: o, rounds: r, enableXOF: i } = this;
|
|
99
|
+
return t || (t = new p(s, n, o, i, 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 = i, t.destroyed = this.destroyed, t;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const G = (e, t, s) => X(() => new p(t, e, s)), Q = /* @__PURE__ */ G(1, 136, 256 / 8);
|
|
12
103
|
export {
|
|
13
|
-
|
|
104
|
+
p as Keccak,
|
|
105
|
+
D as keccakP,
|
|
106
|
+
Q as keccak_256
|
|
14
107
|
};
|
package/dist/index53.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}exports.isHex=r;
|
package/dist/index53.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
"0x2": "eip1559",
|
|
5
|
-
"0x3": "eip4844",
|
|
6
|
-
"0x4": "eip7702"
|
|
7
|
-
};
|
|
1
|
+
function e(t, { strict: r = !0 } = {}) {
|
|
2
|
+
return !t || typeof t != "string" ? !1 : r ? /^0x[0-9a-fA-F]*$/.test(t) : t.startsWith("0x");
|
|
3
|
+
}
|
|
8
4
|
export {
|
|
9
|
-
e as
|
|
5
|
+
e as isHex
|
|
10
6
|
};
|
package/dist/index54.cjs
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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
|
-
`),{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
|
-
`),{docsPath:e,name:"InvalidAbiEncodingType"})}}class g extends n.BaseError{constructor(r){super([`Value "${r}" is not a valid array.`].join(`
|
|
5
|
-
`),{name:"InvalidArrayError"})}}exports.AbiEncodingArrayLengthMismatchError=o;exports.AbiEncodingBytesSizeMismatchError=a;exports.AbiEncodingLengthMismatchError=c;exports.BytesSizeMismatchError=d;exports.InvalidAbiEncodingTypeError=E;exports.InvalidArrayError=g;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index24.cjs"),c=require("./index40.cjs");function u(t){if(!t||t.length===0)return[];const e=[];for(const r of t){const{chainId:i,nonce:o,...s}=r,a=r.address;e.push([i?n.toHex(i):"0x",a,o?n.toHex(o):"0x",...c.toYParitySignatureArray({},s)])}return e}exports.serializeAuthorizationList=u;
|