@gardenfi/utils 2.1.0 → 2.1.2
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 +3 -79
- package/dist/index101.cjs +1 -1
- package/dist/index101.js +10 -17
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +19 -11
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +8 -19
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +16 -10
- package/dist/index105.cjs +1 -1
- package/dist/index105.js +638 -33
- package/dist/index106.cjs +1 -1
- package/dist/index106.js +173 -5
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +12 -10
- package/dist/index108.cjs +1 -1
- package/dist/index108.js +128 -2
- package/dist/index109.cjs +2 -1
- package/dist/index109.js +3 -21
- package/dist/index110.cjs +1 -1
- package/dist/index110.js +2 -128
- package/dist/index111.cjs +1 -1
- package/dist/index111.js +2 -7
- package/dist/index112.cjs +1 -1
- package/dist/index112.js +38 -2
- package/dist/index113.cjs +1 -1
- package/dist/index113.js +34 -33
- package/dist/index114.cjs +1 -1
- package/dist/index114.js +5 -5
- package/dist/index115.cjs +1 -2
- package/dist/index115.js +11 -3
- package/dist/index116.cjs +1 -1
- package/dist/index116.js +6 -18
- package/dist/index117.cjs +1 -1
- package/dist/index117.js +15 -638
- package/dist/index118.cjs +1 -1
- package/dist/index118.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 +11 -11
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +9 -9
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +18 -17
- package/dist/index21.cjs +16 -1
- package/dist/index21.js +112 -30
- package/dist/index22.cjs +1 -16
- package/dist/index22.js +30 -113
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +41 -17
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +44 -6
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +24 -44
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +6 -21
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +13 -8
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +15 -31
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +5 -26
- package/dist/index30.cjs +1 -2
- package/dist/index30.js +13 -65
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +10 -51
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +12 -12
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +11 -24
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +13 -75
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +2 -2
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +55 -7
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +16 -32
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +5 -15
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +9 -2
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +171 -8
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +102 -19
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +21 -41
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +17 -25
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +7 -6
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +20 -12
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +8 -15
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +31 -5
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +26 -13
- package/dist/index49.cjs +2 -1
- package/dist/index49.js +65 -10
- package/dist/index50.cjs +1 -1
- package/dist/index50.js +51 -12
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +12 -11
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +24 -13
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +75 -55
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +7 -16
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +32 -5
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +15 -8
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +2 -172
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +7 -102
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +20 -21
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +38 -10
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +32 -32
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +69 -8
- package/dist/index63.cjs +1 -2
- package/dist/index63.js +110 -57
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +68 -2
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +2 -7
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +16 -6
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +223 -4
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +230 -10
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +12 -3
- package/dist/index70.cjs +1 -5
- package/dist/index70.js +29 -51
- package/dist/index71.cjs +2 -2
- package/dist/index71.js +57 -32
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +21 -5
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +18 -21
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +42 -8
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +8 -10
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +104 -11
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +3 -6
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +17 -13
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +8 -32
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +10 -14
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +11 -64
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +12 -26
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +7 -3
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +78 -3
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +14 -8
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +16 -189
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +191 -18
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +63 -39
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +4 -34
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +51 -43
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +2 -70
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +5 -111
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +11 -67
- package/dist/index93.cjs +5 -1
- package/dist/index93.js +57 -2
- package/dist/index94.cjs +2 -1
- package/dist/index94.js +33 -15
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +5 -223
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +3 -231
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +6 -42
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +30 -102
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +26 -16
- package/package.json +1 -1
package/dist/index98.js
CHANGED
|
@@ -1,107 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
-
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];
|
|
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 "./index112.js";
|
|
3
|
+
import { createCursor as B } from "./index108.js";
|
|
4
|
+
import { size as u } from "./index89.js";
|
|
5
|
+
import { hexToBytes as x } from "./index36.js";
|
|
6
|
+
import { bytesToHex as d } from "./index24.js";
|
|
7
|
+
function S(e) {
|
|
8
|
+
const m = e.to ?? (typeof e.data == "string" ? "hex" : "bytes"), i = typeof e.data == "string" ? x(e.data) : e.data, o = u(i);
|
|
9
|
+
if (!o)
|
|
10
|
+
throw new c();
|
|
11
|
+
if (o > y)
|
|
12
|
+
throw new h({
|
|
13
|
+
maxSize: y,
|
|
14
|
+
size: o
|
|
15
|
+
});
|
|
16
|
+
const s = [];
|
|
17
|
+
let n = !0, r = 0;
|
|
18
|
+
for (; n; ) {
|
|
19
|
+
const t = B(new Uint8Array(a));
|
|
20
|
+
let l = 0;
|
|
21
|
+
for (; l < f; ) {
|
|
22
|
+
const b = i.slice(r, r + (p - 1));
|
|
23
|
+
if (t.pushByte(0), t.pushBytes(b), b.length < 31) {
|
|
24
|
+
t.pushByte(128), n = !1;
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
l++, r += 31;
|
|
33
28
|
}
|
|
34
|
-
|
|
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;
|
|
29
|
+
s.push(t);
|
|
100
30
|
}
|
|
31
|
+
return m === "bytes" ? s.map((t) => t.bytes) : s.map((t) => d(t.bytes));
|
|
101
32
|
}
|
|
102
|
-
const G = (e, t, s) => X(() => new p(t, e, s)), Q = /* @__PURE__ */ G(1, 136, 256 / 8);
|
|
103
33
|
export {
|
|
104
|
-
|
|
105
|
-
D as keccakP,
|
|
106
|
-
Q as keccak_256
|
|
34
|
+
S as toBlobs
|
|
107
35
|
};
|
package/dist/index99.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 s=require("./index57.cjs"),e=require("./index71.cjs");class i extends e.BaseError{constructor({domain:r}){super(`Invalid domain "${s.stringify(r)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class o extends e.BaseError{constructor({primaryType:r,types:a}){super(`Invalid primary type \`${r}\` must be one of \`${JSON.stringify(Object.keys(a))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class n extends e.BaseError{constructor({type:r}){super(`Struct type "${r}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}exports.InvalidDomainError=i;exports.InvalidPrimaryTypeError=o;exports.InvalidStructTypeError=n;
|
package/dist/index99.js
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { stringify as a } from "./index57.js";
|
|
2
|
+
import { BaseError as t } from "./index71.js";
|
|
3
|
+
class n extends t {
|
|
4
|
+
constructor({ domain: r }) {
|
|
5
|
+
super(`Invalid domain "${a(r)}".`, {
|
|
6
|
+
metaMessages: ["Must be a valid EIP-712 domain."]
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
class p extends t {
|
|
11
|
+
constructor({ primaryType: r, types: s }) {
|
|
12
|
+
super(`Invalid primary type \`${r}\` must be one of \`${JSON.stringify(Object.keys(s))}\`.`, {
|
|
13
|
+
docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror",
|
|
14
|
+
metaMessages: ["Check that the primary type is a key in `types`."]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
class y extends t {
|
|
19
|
+
constructor({ type: r }) {
|
|
20
|
+
super(`Struct type "${r}" is invalid.`, {
|
|
21
|
+
metaMessages: ["Struct type must not be a Solidity type."],
|
|
22
|
+
name: "InvalidStructTypeError"
|
|
23
|
+
});
|
|
15
24
|
}
|
|
16
|
-
return t;
|
|
17
25
|
}
|
|
18
26
|
export {
|
|
19
|
-
|
|
27
|
+
n as InvalidDomainError,
|
|
28
|
+
p as InvalidPrimaryTypeError,
|
|
29
|
+
y as InvalidStructTypeError
|
|
20
30
|
};
|