@gardenfi/utils 2.1.2-beta.7 → 2.1.2-beta.8
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 +2 -1
- package/dist/index101.js +3 -11
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +18 -6
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +638 -15
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +173 -5
- 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 +1 -1
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +3 -3
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +1 -1
- package/dist/index23.cjs +2 -1
- package/dist/index23.js +49 -40
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +24 -45
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +41 -25
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +45 -6
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +24 -12
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +6 -15
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +13 -5
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +14 -12
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +5 -10
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +13 -12
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +10 -11
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +12 -13
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +11 -23
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +13 -55
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +23 -16
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +55 -5
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +16 -8
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +5 -171
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +8 -103
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +170 -20
- package/dist/index43.cjs +1 -2
- package/dist/index43.js +97 -44
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +21 -24
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +1 -1
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +6 -40
- package/dist/index48.cjs +2 -1
- package/dist/index48.js +58 -33
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +2 -70
- package/dist/index50.cjs +1 -1
- package/dist/index50.js +5 -111
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +4 -67
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +12 -2
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +8 -17
- package/dist/index54.cjs +5 -1
- package/dist/index54.js +48 -215
- package/dist/index55.cjs +2 -1
- package/dist/index55.js +31 -228
- package/dist/index56.cjs +1 -2
- package/dist/index56.js +5 -59
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +2 -22
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +18 -101
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +8 -3
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +9 -16
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +11 -8
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +6 -10
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +13 -11
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +31 -12
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +14 -18
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +64 -6
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +25 -40
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +3 -79
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +3 -14
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +8 -18
- package/dist/index71.cjs +1 -1
- package/dist/index71.js +191 -8
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +18 -191
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +39 -63
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +34 -4
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +70 -2
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +111 -5
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +67 -11
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +2 -8
- package/dist/index79.cjs +1 -5
- package/dist/index79.js +15 -55
- package/dist/index80.cjs +1 -2
- package/dist/index80.js +220 -31
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +231 -5
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +43 -2
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +104 -6
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +16 -31
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +75 -24
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +19 -3
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +8 -11
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +11 -19
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +19 -8
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +1 -1
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +37 -17
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +2 -644
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +5 -173
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +10 -127
- package/dist/index95.cjs +1 -2
- package/dist/index95.js +128 -3
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +7 -2
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +2 -2
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +2 -2
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +17 -35
- package/package.json +1 -1
package/dist/index63.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { blobsToCommitments as f } from "./index59.js";
|
|
2
|
+
import { blobsToProofs as l } from "./index60.js";
|
|
3
|
+
import { toBlobs as p } from "./index64.js";
|
|
4
|
+
function k(t) {
|
|
5
|
+
const { data: i, kzg: n, to: m } = t, s = t.blobs ?? p({ data: i, to: m }), b = t.commitments ?? f({ blobs: s, kzg: n, to: m }), r = t.proofs ?? l({ blobs: s, commitments: b, kzg: n, to: m }), c = [];
|
|
6
|
+
for (let o = 0; o < s.length; o++)
|
|
7
|
+
c.push({
|
|
8
|
+
blob: s[o],
|
|
9
|
+
commitment: b[o],
|
|
10
|
+
proof: r[o]
|
|
11
|
+
});
|
|
12
|
+
return c;
|
|
11
13
|
}
|
|
12
14
|
export {
|
|
13
|
-
|
|
15
|
+
k as toBlobSidecars
|
|
14
16
|
};
|
package/dist/index64.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index100.cjs"),y=require("./index98.cjs"),u=require("./index95.cjs"),B=require("./index51.cjs"),h=require("./index38.cjs"),d=require("./index26.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/index64.js
CHANGED
|
@@ -1,16 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { maxBytesPerTransaction as y, bytesPerBlob as a, fieldElementsPerBlob as f, bytesPerFieldElement as p } from "./index100.js";
|
|
2
|
+
import { EmptyBlobError as c, BlobSizeTooLargeError as h } from "./index98.js";
|
|
3
|
+
import { createCursor as B } from "./index95.js";
|
|
4
|
+
import { size as u } from "./index51.js";
|
|
5
|
+
import { hexToBytes as x } from "./index38.js";
|
|
6
|
+
import { bytesToHex as d } from "./index26.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
|
|
11
15
|
});
|
|
12
|
-
|
|
16
|
+
const s = [];
|
|
17
|
+
let n = !0, r = 0;
|
|
18
|
+
for (; n; ) {
|
|
19
|
+
const t = B(new Uint8Array(a));
|
|
20
|
+
let l = 0;
|
|
21
|
+
for (; l < f; ) {
|
|
22
|
+
const b = i.slice(r, r + (p - 1));
|
|
23
|
+
if (t.pushByte(0), t.pushBytes(b), b.length < 31) {
|
|
24
|
+
t.pushByte(128), n = !1;
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
l++, r += 31;
|
|
28
|
+
}
|
|
29
|
+
s.push(t);
|
|
30
|
+
}
|
|
31
|
+
return m === "bytes" ? s.map((t) => t.bytes) : s.map((t) => d(t.bytes));
|
|
13
32
|
}
|
|
14
33
|
export {
|
|
15
|
-
|
|
34
|
+
S as toBlobs
|
|
16
35
|
};
|
package/dist/index65.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 i=require("./index23.cjs");function f(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new i.InvalidSerializableTransactionError({transaction:e})}exports.getTransactionType=f;
|
package/dist/index65.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
function f(t) {
|
|
15
|
-
return `0x${t.reduce((n, r) => n + r.replace("0x", ""), "")}`;
|
|
1
|
+
import { InvalidSerializableTransactionError as f } from "./index23.js";
|
|
2
|
+
function d(e) {
|
|
3
|
+
if (e.type)
|
|
4
|
+
return e.type;
|
|
5
|
+
if (typeof e.authorizationList < "u")
|
|
6
|
+
return "eip7702";
|
|
7
|
+
if (typeof e.blobs < "u" || typeof e.blobVersionedHashes < "u" || typeof e.maxFeePerBlobGas < "u" || typeof e.sidecars < "u")
|
|
8
|
+
return "eip4844";
|
|
9
|
+
if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u")
|
|
10
|
+
return "eip1559";
|
|
11
|
+
if (typeof e.gasPrice < "u")
|
|
12
|
+
return typeof e.accessList < "u" ? "eip2930" : "legacy";
|
|
13
|
+
throw new f({ transaction: e });
|
|
16
14
|
}
|
|
17
15
|
export {
|
|
18
|
-
|
|
19
|
-
c as concatBytes,
|
|
20
|
-
f as concatHex
|
|
16
|
+
d as getTransactionType
|
|
21
17
|
};
|
package/dist/index66.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 E=require("./index54.cjs"),z=require("./index34.cjs"),o=require("./index67.cjs"),T=require("./index35.cjs"),u=require("./index51.cjs"),q=require("./index26.cjs"),g=require("./index68.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;
|
package/dist/index66.js
CHANGED
|
@@ -1,9 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { BytesSizeMismatchError as m } from "./index54.js";
|
|
2
|
+
import { InvalidAddressError as w } from "./index34.js";
|
|
3
|
+
import { InvalidDomainError as E, InvalidPrimaryTypeError as z, InvalidStructTypeError as D } from "./index67.js";
|
|
4
|
+
import { isAddress as T } from "./index35.js";
|
|
5
|
+
import { size as y } from "./index51.js";
|
|
6
|
+
import { numberToHex as x } from "./index26.js";
|
|
7
|
+
import { integerRegex as P, bytesRegex as S } from "./index68.js";
|
|
8
|
+
function j(e) {
|
|
9
|
+
const { domain: n, message: g, primaryType: o, types: r } = e, f = (h, b) => {
|
|
10
|
+
for (const u of h) {
|
|
11
|
+
const { name: l, type: s } = u, t = b[l], a = s.match(P);
|
|
12
|
+
if (a && (typeof t == "number" || typeof t == "bigint")) {
|
|
13
|
+
const [I, i, v] = a;
|
|
14
|
+
x(t, {
|
|
15
|
+
signed: i === "int",
|
|
16
|
+
size: Number.parseInt(v) / 8
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
if (s === "address" && typeof t == "string" && !T(t))
|
|
20
|
+
throw new w({ address: t });
|
|
21
|
+
const p = s.match(S);
|
|
22
|
+
if (p) {
|
|
23
|
+
const [I, i] = p;
|
|
24
|
+
if (i && y(t) !== Number.parseInt(i))
|
|
25
|
+
throw new m({
|
|
26
|
+
expectedSize: Number.parseInt(i),
|
|
27
|
+
givenSize: y(t)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const c = r[s];
|
|
31
|
+
c && (_(s), f(c, t));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
if (r.EIP712Domain && n) {
|
|
35
|
+
if (typeof n != "object")
|
|
36
|
+
throw new E({ domain: n });
|
|
37
|
+
f(r.EIP712Domain, n);
|
|
38
|
+
}
|
|
39
|
+
if (o !== "EIP712Domain")
|
|
40
|
+
if (r[o])
|
|
41
|
+
f(r[o], g);
|
|
42
|
+
else
|
|
43
|
+
throw new z({ primaryType: o, types: r });
|
|
44
|
+
}
|
|
45
|
+
function F({ domain: e }) {
|
|
46
|
+
return [
|
|
47
|
+
typeof (e == null ? void 0 : e.name) == "string" && { name: "name", type: "string" },
|
|
48
|
+
(e == null ? void 0 : e.version) && { name: "version", type: "string" },
|
|
49
|
+
(typeof (e == null ? void 0 : e.chainId) == "number" || typeof (e == null ? void 0 : e.chainId) == "bigint") && {
|
|
50
|
+
name: "chainId",
|
|
51
|
+
type: "uint256"
|
|
52
|
+
},
|
|
53
|
+
(e == null ? void 0 : e.verifyingContract) && {
|
|
54
|
+
name: "verifyingContract",
|
|
55
|
+
type: "address"
|
|
56
|
+
},
|
|
57
|
+
(e == null ? void 0 : e.salt) && { name: "salt", type: "bytes32" }
|
|
58
|
+
].filter(Boolean);
|
|
59
|
+
}
|
|
60
|
+
function _(e) {
|
|
61
|
+
if (e === "address" || e === "bool" || e === "string" || e.startsWith("bytes") || e.startsWith("uint") || e.startsWith("int"))
|
|
62
|
+
throw new D({ type: e });
|
|
6
63
|
}
|
|
7
64
|
export {
|
|
8
|
-
|
|
65
|
+
F as getTypesForEIP712Domain,
|
|
66
|
+
j as validateTypedData
|
|
9
67
|
};
|
package/dist/index67.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("./index48.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/index67.js
CHANGED
|
@@ -1,45 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { stringify as a } from "./index57.js";
|
|
2
|
+
import { BaseError as t } from "./index48.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
|
+
}
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
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
|
+
}
|
|
11
17
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
f(t);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function y(n) {
|
|
24
|
-
const e = typeof n == "string" ? g(n) : n, i = o(e.length);
|
|
25
|
-
return {
|
|
26
|
-
length: e.length === 1 && e[0] < 128 ? 1 : e.length <= 55 ? 1 + e.length : 1 + i + e.length,
|
|
27
|
-
encode(t) {
|
|
28
|
-
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));
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function o(n) {
|
|
33
|
-
if (n < 2 ** 8)
|
|
34
|
-
return 1;
|
|
35
|
-
if (n < 2 ** 16)
|
|
36
|
-
return 2;
|
|
37
|
-
if (n < 2 ** 24)
|
|
38
|
-
return 3;
|
|
39
|
-
if (n < 2 ** 32)
|
|
40
|
-
return 4;
|
|
41
|
-
throw new l("Length is too large.");
|
|
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
|
+
});
|
|
24
|
+
}
|
|
42
25
|
}
|
|
43
26
|
export {
|
|
44
|
-
|
|
27
|
+
n as InvalidDomainError,
|
|
28
|
+
p as InvalidPrimaryTypeError,
|
|
29
|
+
y as InvalidStructTypeError
|
|
45
30
|
};
|
package/dist/index68.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=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,t=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;exports.bytesRegex=e;exports.integerRegex=t;
|
package/dist/index68.js
CHANGED
|
@@ -1,81 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { maxUint256 as m } from "./index97.js";
|
|
3
|
-
import { InvalidAddressError as s } from "./index32.js";
|
|
4
|
-
import { BaseError as h } from "./index56.js";
|
|
5
|
-
import { EmptyBlobError as P, InvalidVersionedHashSizeError as p, InvalidVersionedHashVersionError as x } from "./index98.js";
|
|
6
|
-
import { InvalidChainIdError as n } from "./index76.js";
|
|
7
|
-
import { FeeCapTooHighError as w, TipAboveFeeCapError as E } from "./index80.js";
|
|
8
|
-
import { isAddress as f } from "./index33.js";
|
|
9
|
-
import { size as F } from "./index74.js";
|
|
10
|
-
import { slice as I } from "./index99.js";
|
|
11
|
-
import { hexToNumber as G } from "./index35.js";
|
|
12
|
-
function C(t) {
|
|
13
|
-
const { authorizationList: e } = t;
|
|
14
|
-
if (e)
|
|
15
|
-
for (const o of e) {
|
|
16
|
-
const { chainId: r } = o, i = o.address;
|
|
17
|
-
if (!f(i))
|
|
18
|
-
throw new s({ address: i });
|
|
19
|
-
if (r < 0)
|
|
20
|
-
throw new n({ chainId: r });
|
|
21
|
-
}
|
|
22
|
-
d(t);
|
|
23
|
-
}
|
|
24
|
-
function L(t) {
|
|
25
|
-
const { blobVersionedHashes: e } = t;
|
|
26
|
-
if (e) {
|
|
27
|
-
if (e.length === 0)
|
|
28
|
-
throw new P();
|
|
29
|
-
for (const o of e) {
|
|
30
|
-
const r = F(o), i = G(I(o, 0, 1));
|
|
31
|
-
if (r !== 32)
|
|
32
|
-
throw new p({ hash: o, size: r });
|
|
33
|
-
if (i !== c)
|
|
34
|
-
throw new x({
|
|
35
|
-
hash: o,
|
|
36
|
-
version: i
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
d(t);
|
|
41
|
-
}
|
|
42
|
-
function d(t) {
|
|
43
|
-
const { chainId: e, maxPriorityFeePerGas: o, maxFeePerGas: r, to: i } = t;
|
|
44
|
-
if (e <= 0)
|
|
45
|
-
throw new n({ chainId: e });
|
|
46
|
-
if (i && !f(i))
|
|
47
|
-
throw new s({ address: i });
|
|
48
|
-
if (r && r > m)
|
|
49
|
-
throw new w({ maxFeePerGas: r });
|
|
50
|
-
if (o && r && o > r)
|
|
51
|
-
throw new E({ maxFeePerGas: r, maxPriorityFeePerGas: o });
|
|
52
|
-
}
|
|
53
|
-
function B(t) {
|
|
54
|
-
const { chainId: e, maxPriorityFeePerGas: o, gasPrice: r, maxFeePerGas: i, to: a } = t;
|
|
55
|
-
if (e <= 0)
|
|
56
|
-
throw new n({ chainId: e });
|
|
57
|
-
if (a && !f(a))
|
|
58
|
-
throw new s({ address: a });
|
|
59
|
-
if (o || i)
|
|
60
|
-
throw new h("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");
|
|
61
|
-
if (r && r > m)
|
|
62
|
-
throw new w({ maxFeePerGas: r });
|
|
63
|
-
}
|
|
64
|
-
function K(t) {
|
|
65
|
-
const { chainId: e, maxPriorityFeePerGas: o, gasPrice: r, maxFeePerGas: i, to: a } = t;
|
|
66
|
-
if (a && !f(a))
|
|
67
|
-
throw new s({ address: a });
|
|
68
|
-
if (typeof e < "u" && e <= 0)
|
|
69
|
-
throw new n({ chainId: e });
|
|
70
|
-
if (o || i)
|
|
71
|
-
throw new h("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");
|
|
72
|
-
if (r && r > m)
|
|
73
|
-
throw new w({ maxFeePerGas: r });
|
|
74
|
-
}
|
|
1
|
+
const e = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, t = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
|
|
75
2
|
export {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
L as assertTransactionEIP4844,
|
|
79
|
-
C as assertTransactionEIP7702,
|
|
80
|
-
K as assertTransactionLegacy
|
|
3
|
+
e as bytesRegex,
|
|
4
|
+
t as integerRegex
|
|
81
5
|
};
|
package/dist/index69.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/index69.js
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (e.type)
|
|
4
|
-
return e.type;
|
|
5
|
-
if (typeof e.authorizationList < "u")
|
|
6
|
-
return "eip7702";
|
|
7
|
-
if (typeof e.blobs < "u" || typeof e.blobVersionedHashes < "u" || typeof e.maxFeePerBlobGas < "u" || typeof e.sidecars < "u")
|
|
8
|
-
return "eip4844";
|
|
9
|
-
if (typeof e.maxFeePerGas < "u" || typeof e.maxPriorityFeePerGas < "u")
|
|
10
|
-
return "eip1559";
|
|
11
|
-
if (typeof e.gasPrice < "u")
|
|
12
|
-
return typeof e.accessList < "u" ? "eip2930" : "legacy";
|
|
13
|
-
throw new f({ transaction: e });
|
|
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");
|
|
14
3
|
}
|
|
15
4
|
export {
|
|
16
|
-
|
|
5
|
+
e as isHex
|
|
17
6
|
};
|
package/dist/index70.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index101.cjs"),o=require("./index72.cjs"),s=require("./index51.cjs"),r=require("./index26.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/index70.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
for (let o = 0; o < r.length; o++) {
|
|
9
|
-
const { address: i, storageKeys: e } = r[o];
|
|
10
|
-
for (let t = 0; t < e.length; t++)
|
|
11
|
-
if (e[t].length - 2 !== 64)
|
|
12
|
-
throw new l({ storageKey: e[t] });
|
|
13
|
-
if (!f(i, { strict: !1 }))
|
|
14
|
-
throw new s({ address: i });
|
|
15
|
-
n.push([i, e]);
|
|
16
|
-
}
|
|
17
|
-
return n;
|
|
1
|
+
import { presignMessagePrefix as e } from "./index101.js";
|
|
2
|
+
import { concat as n } from "./index72.js";
|
|
3
|
+
import { size as f } from "./index51.js";
|
|
4
|
+
import { stringToHex as o, bytesToHex as p } from "./index26.js";
|
|
5
|
+
function u(r) {
|
|
6
|
+
const t = typeof r == "string" ? o(r) : typeof r.raw == "string" ? r.raw : p(r.raw), i = o(`${e}${f(t)}`);
|
|
7
|
+
return n([i, t]);
|
|
18
8
|
}
|
|
19
9
|
export {
|
|
20
|
-
|
|
10
|
+
u as toPrefixedMessage
|
|
21
11
|
};
|
package/dist/index71.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("./index54.cjs"),g=require("./index34.cjs"),l=require("./index48.cjs"),b=require("./index45.cjs"),x=require("./index35.cjs"),u=require("./index72.cjs"),d=require("./index46.cjs"),y=require("./index51.cjs"),A=require("./index91.cjs"),a=require("./index26.cjs"),z=require("./index68.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;
|