@gardenfi/utils 2.4.5 → 2.4.6
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/index119.cjs +1 -1
- package/dist/index119.js +1 -1
- package/dist/index195.cjs +1 -1
- package/dist/index195.js +3 -3
- package/dist/index225.cjs +1 -1
- package/dist/index225.js +2 -2
- package/dist/index228.cjs +1 -1
- package/dist/index228.js +2 -2
- package/dist/index229.cjs +1 -1
- package/dist/index229.js +1 -1
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +6 -6
- package/dist/index234.cjs +1 -1
- package/dist/index234.js +1 -1
- package/dist/index235.cjs +1 -1
- package/dist/index235.js +1 -1
- package/dist/index236.cjs +1 -1
- package/dist/index236.js +2 -2
- package/dist/index241.cjs +1 -1
- package/dist/index241.js +3 -3
- package/dist/index243.cjs +1 -1
- package/dist/index243.js +1 -1
- package/dist/index248.cjs +1 -1
- package/dist/index248.js +3 -3
- package/dist/index249.cjs +1 -1
- package/dist/index249.js +3 -3
- package/dist/index254.cjs +1 -1
- package/dist/index254.js +102 -24
- package/dist/index255.cjs +1 -1
- package/dist/index255.js +6 -13
- package/dist/index256.cjs +1 -1
- package/dist/index256.js +223 -14
- package/dist/index257.cjs +1 -1
- package/dist/index257.js +25 -5
- package/dist/index258.cjs +1 -1
- package/dist/index258.js +13 -13
- package/dist/index259.cjs +1 -1
- package/dist/index259.js +14 -9
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +2 -2
- package/dist/index260.cjs +1 -1
- package/dist/index260.js +5 -16
- package/dist/index261.cjs +1 -2
- package/dist/index261.js +13 -41
- package/dist/index262.cjs +1 -1
- package/dist/index262.js +11 -2
- package/dist/index263.cjs +1 -1
- package/dist/index263.js +16 -5
- package/dist/index264.cjs +2 -1
- package/dist/index264.js +40 -9
- package/dist/index265.cjs +1 -1
- package/dist/index265.js +2 -20
- package/dist/index266.cjs +1 -1
- package/dist/index266.js +5 -8
- package/dist/index267.cjs +1 -1
- package/dist/index267.js +9 -65
- package/dist/index268.cjs +1 -1
- package/dist/index268.js +17 -63
- package/dist/index269.cjs +1 -1
- package/dist/index269.js +8 -186
- package/dist/index270.cjs +1 -1
- package/dist/index270.js +66 -22
- package/dist/index271.cjs +1 -1
- package/dist/index271.js +61 -38
- package/dist/index272.cjs +1 -1
- package/dist/index272.js +179 -69
- package/dist/index273.cjs +1 -1
- package/dist/index273.js +21 -39
- package/dist/index274.cjs +1 -1
- package/dist/index274.js +35 -9
- package/dist/index275.cjs +1 -1
- package/dist/index275.js +70 -7
- package/dist/index276.cjs +1 -1
- package/dist/index276.js +40 -12
- package/dist/index277.cjs +1 -2
- package/dist/index277.js +16 -18
- package/dist/index278.cjs +1 -1
- package/dist/index278.js +12 -13
- package/dist/index279.cjs +1 -1
- package/dist/index279.js +12 -11
- package/dist/index280.cjs +2 -1
- package/dist/index280.js +18 -103
- package/dist/index281.cjs +1 -1
- package/dist/index281.js +14 -6
- package/dist/index282.cjs +1 -1
- package/dist/index282.js +152 -221
- package/dist/index283.cjs +1 -1
- package/dist/index283.js +9 -6
- package/dist/index284.cjs +1 -1
- package/dist/index284.js +114 -7
- package/dist/index285.cjs +2 -1
- package/dist/index285.js +132 -24
- package/dist/index286.cjs +1 -1
- package/dist/index286.js +11 -19
- package/dist/index287.cjs +1 -1
- package/dist/index287.js +6 -146
- package/dist/index288.cjs +1 -1
- package/dist/index288.js +7 -4
- package/dist/index289.cjs +1 -1
- package/dist/index289.js +23 -137
- package/dist/index290.cjs +1 -1
- package/dist/index290.js +17 -153
- package/dist/index291.cjs +1 -1
- package/dist/index291.js +146 -9
- package/dist/index292.cjs +1 -1
- package/dist/index292.js +3 -113
- package/dist/index293.cjs +1 -2
- package/dist/index293.js +128 -122
- package/dist/index294.cjs +1 -1
- package/dist/index294.js +73 -134
- package/dist/index295.cjs +1 -1
- package/dist/index295.js +2 -43
- package/dist/index296.cjs +1 -1
- package/dist/index296.js +693 -73
- package/dist/index297.cjs +1 -1
- package/dist/index297.js +140 -2
- package/dist/index298.cjs +1 -1
- package/dist/index298.js +41 -10
- package/dist/index299.cjs +1 -1
- package/dist/index299.js +201 -19
- package/dist/index301.cjs +2 -1
- package/dist/index301.js +63 -695
- package/dist/index302.cjs +1 -1
- package/dist/index302.js +4 -201
- package/dist/index303.cjs +1 -2
- package/dist/index303.js +39 -65
- package/dist/index304.cjs +1 -1
- package/dist/index304.js +7 -4
- package/dist/index305.cjs +1 -1
- package/dist/index305.js +60 -38
- package/dist/index306.cjs +1 -1
- package/dist/index306.js +77 -7
- package/dist/index307.cjs +1 -1
- package/dist/index307.js +4 -63
- package/dist/index308.cjs +1 -1
- package/dist/index308.js +181 -64
- package/dist/index309.cjs +1 -1
- package/dist/index309.js +12 -4
- package/dist/index310.cjs +1 -1
- package/dist/index310.js +19 -194
- package/dist/index311.cjs +1 -1
- package/dist/index311.js +63 -4
- package/dist/index312.cjs +1 -1
- package/dist/index312.js +40 -59
- package/dist/index313.cjs +1 -1
- package/dist/index313.js +4 -44
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +1 -1
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +2 -2
- package/package.json +1 -1
package/dist/index289.js
CHANGED
|
@@ -1,143 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { BaseError as u } from "./index41.js";
|
|
2
|
+
function a(r) {
|
|
3
|
+
let l = !0, i = "", f = 0, t = "", o = !1;
|
|
4
|
+
for (let n = 0; n < r.length; n++) {
|
|
5
|
+
const e = r[n];
|
|
6
|
+
if (["(", ")", ","].includes(e) && (l = !0), e === "(" && f++, e === ")" && f--, !!l) {
|
|
7
|
+
if (f === 0) {
|
|
8
|
+
if (e === " " && ["event", "function", ""].includes(t))
|
|
9
|
+
t = "";
|
|
10
|
+
else if (t += e, e === ")") {
|
|
11
|
+
o = !0;
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
if (e === " ") {
|
|
17
|
+
r[n - 1] !== "," && i !== "," && i !== ",(" && (i = "", l = !1);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
t += e, i += e;
|
|
10
21
|
}
|
|
11
|
-
return !1;
|
|
12
|
-
} catch (e) {
|
|
13
|
-
return typeof e == "object" && typeof e.response < "u" || !globalThis.hasOwnProperty("Image") ? !1 : new Promise((n) => {
|
|
14
|
-
const r = new Image();
|
|
15
|
-
r.onload = () => {
|
|
16
|
-
n(!0);
|
|
17
|
-
}, r.onerror = () => {
|
|
18
|
-
n(!1);
|
|
19
|
-
}, r.src = t;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function w(t, e) {
|
|
24
|
-
return t ? t.endsWith("/") ? t.slice(0, -1) : t : e;
|
|
25
|
-
}
|
|
26
|
-
function N({ uri: t, gatewayUrls: e }) {
|
|
27
|
-
const n = E.test(t);
|
|
28
|
-
if (n)
|
|
29
|
-
return { uri: t, isOnChain: !0, isEncoded: n };
|
|
30
|
-
const r = w(e == null ? void 0 : e.ipfs, "https://ipfs.io"), a = w(e == null ? void 0 : e.arweave, "https://arweave.net"), i = t.match(b), { protocol: o, subpath: p, target: s, subtarget: m = "" } = (i == null ? void 0 : i.groups) || {}, u = o === "ipns:/" || p === "ipns/", h = o === "ipfs:/" || p === "ipfs/" || l.test(t);
|
|
31
|
-
if (t.startsWith("http") && !u && !h) {
|
|
32
|
-
let I = t;
|
|
33
|
-
return e != null && e.arweave && (I = t.replace(/https:\/\/arweave.net/g, e == null ? void 0 : e.arweave)), { uri: I, isOnChain: !1, isEncoded: !1 };
|
|
34
|
-
}
|
|
35
|
-
if ((u || h) && s)
|
|
36
|
-
return {
|
|
37
|
-
uri: `${r}/${u ? "ipns" : "ipfs"}/${s}${m}`,
|
|
38
|
-
isOnChain: !1,
|
|
39
|
-
isEncoded: !1
|
|
40
|
-
};
|
|
41
|
-
if (o === "ar:/" && s)
|
|
42
|
-
return {
|
|
43
|
-
uri: `${a}/${s}${m || ""}`,
|
|
44
|
-
isOnChain: !1,
|
|
45
|
-
isEncoded: !1
|
|
46
|
-
};
|
|
47
|
-
let c = t.replace(C, "");
|
|
48
|
-
if (c.startsWith("<svg") && (c = `data:image/svg+xml;base64,${btoa(c)}`), c.startsWith("data:") || c.startsWith("{"))
|
|
49
|
-
return {
|
|
50
|
-
uri: c,
|
|
51
|
-
isOnChain: !0,
|
|
52
|
-
isEncoded: !1
|
|
53
|
-
};
|
|
54
|
-
throw new d({ uri: t });
|
|
55
|
-
}
|
|
56
|
-
function R(t) {
|
|
57
|
-
if (typeof t != "object" || !("image" in t) && !("image_url" in t) && !("image_data" in t))
|
|
58
|
-
throw new A({ data: t });
|
|
59
|
-
return t.image || t.image_url || t.image_data;
|
|
60
|
-
}
|
|
61
|
-
async function O({ gatewayUrls: t, uri: e }) {
|
|
62
|
-
try {
|
|
63
|
-
const n = await fetch(e).then((a) => a.json());
|
|
64
|
-
return await _({
|
|
65
|
-
gatewayUrls: t,
|
|
66
|
-
uri: R(n)
|
|
67
|
-
});
|
|
68
|
-
} catch {
|
|
69
|
-
throw new d({ uri: e });
|
|
70
22
|
}
|
|
71
|
-
}
|
|
72
|
-
async function _({ gatewayUrls: t, uri: e }) {
|
|
73
|
-
const { uri: n, isOnChain: r } = N({ uri: e, gatewayUrls: t });
|
|
74
|
-
if (r || await k(n))
|
|
75
|
-
return n;
|
|
76
|
-
throw new d({ uri: e });
|
|
77
|
-
}
|
|
78
|
-
function z(t) {
|
|
79
|
-
let e = t;
|
|
80
|
-
e.startsWith("did:nft:") && (e = e.replace("did:nft:", "").replace(/_/g, "/"));
|
|
81
|
-
const [n, r, a] = e.split("/"), [i, o] = n.split(":"), [p, s] = r.split(":");
|
|
82
|
-
if (!i || i.toLowerCase() !== "eip155")
|
|
83
|
-
throw new f({ reason: "Only EIP-155 supported" });
|
|
84
23
|
if (!o)
|
|
85
|
-
throw new
|
|
86
|
-
|
|
87
|
-
throw new f({
|
|
88
|
-
reason: "Contract address not found"
|
|
89
|
-
});
|
|
90
|
-
if (!a)
|
|
91
|
-
throw new f({ reason: "Token ID not found" });
|
|
92
|
-
if (!p)
|
|
93
|
-
throw new f({ reason: "ERC namespace not found" });
|
|
94
|
-
return {
|
|
95
|
-
chainID: Number.parseInt(o),
|
|
96
|
-
namespace: p.toLowerCase(),
|
|
97
|
-
contractAddress: s,
|
|
98
|
-
tokenID: a
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
async function P(t, { nft: e }) {
|
|
102
|
-
if (e.namespace === "erc721")
|
|
103
|
-
return g(t, {
|
|
104
|
-
address: e.contractAddress,
|
|
105
|
-
abi: [
|
|
106
|
-
{
|
|
107
|
-
name: "tokenURI",
|
|
108
|
-
type: "function",
|
|
109
|
-
stateMutability: "view",
|
|
110
|
-
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
111
|
-
outputs: [{ name: "", type: "string" }]
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
functionName: "tokenURI",
|
|
115
|
-
args: [BigInt(e.tokenID)]
|
|
116
|
-
});
|
|
117
|
-
if (e.namespace === "erc1155")
|
|
118
|
-
return g(t, {
|
|
119
|
-
address: e.contractAddress,
|
|
120
|
-
abi: [
|
|
121
|
-
{
|
|
122
|
-
name: "uri",
|
|
123
|
-
type: "function",
|
|
124
|
-
stateMutability: "view",
|
|
125
|
-
inputs: [{ name: "_id", type: "uint256" }],
|
|
126
|
-
outputs: [{ name: "", type: "string" }]
|
|
127
|
-
}
|
|
128
|
-
],
|
|
129
|
-
functionName: "uri",
|
|
130
|
-
args: [BigInt(e.tokenID)]
|
|
131
|
-
});
|
|
132
|
-
throw new v({ namespace: e.namespace });
|
|
24
|
+
throw new u("Unable to normalize signature.");
|
|
25
|
+
return t;
|
|
133
26
|
}
|
|
134
27
|
export {
|
|
135
|
-
|
|
136
|
-
R as getJsonImage,
|
|
137
|
-
O as getMetadataAvatarUri,
|
|
138
|
-
P as getNftTokenUri,
|
|
139
|
-
k as isImageUri,
|
|
140
|
-
_ as parseAvatarUri,
|
|
141
|
-
z as parseNftUri,
|
|
142
|
-
N as resolveAvatarUri
|
|
28
|
+
a as normalizeSignature
|
|
143
29
|
};
|
package/dist/index290.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 l=BigInt(2**32-1),c=BigInt(32);function u(t,o=!1){return o?{h:Number(t&l),l:Number(t>>c&l)}:{h:Number(t>>c&l)|0,l:Number(t&l)|0}}function B(t,o=!1){const r=t.length;let n=new Uint32Array(r),i=new Uint32Array(r);for(let e=0;e<r;e++){const{h:f,l:s}=u(t[e],o);[n[e],i[e]]=[f,s]}return[n,i]}const g=(t,o,r)=>t<<r|o>>>32-r,m=(t,o,r)=>o<<r|t>>>32-r,S=(t,o,r)=>o<<r-32|t>>>64-r,a=(t,o,r)=>t<<r-32|o>>>64-r;exports.fromBig=u;exports.rotlBH=S;exports.rotlBL=a;exports.rotlSH=g;exports.rotlSL=m;exports.split=B;
|
package/dist/index290.js
CHANGED
|
@@ -1,158 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const $ = /* @__PURE__ */ new TextEncoder(), h = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
5
|
-
function y(t, e = {}) {
|
|
6
|
-
const { strict: r = !1 } = e;
|
|
7
|
-
if (!t)
|
|
8
|
-
throw new f(t);
|
|
9
|
-
if (typeof t != "string")
|
|
10
|
-
throw new f(t);
|
|
11
|
-
if (r && !/^0x[0-9a-fA-F]*$/.test(t))
|
|
12
|
-
throw new l(t);
|
|
13
|
-
if (!t.startsWith("0x"))
|
|
14
|
-
throw new l(t);
|
|
1
|
+
const o = /* @__PURE__ */ BigInt(4294967295), i = /* @__PURE__ */ BigInt(32);
|
|
2
|
+
function s(t, r = !1) {
|
|
3
|
+
return r ? { h: Number(t & o), l: Number(t >> i & o) } : { h: Number(t >> i & o) | 0, l: Number(t & o) | 0 };
|
|
15
4
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
function w(t, e = {}) {
|
|
24
|
-
let r = "";
|
|
25
|
-
for (let i = 0; i < t.length; i++)
|
|
26
|
-
r += h[t[i]];
|
|
27
|
-
const n = `0x${r}`;
|
|
28
|
-
return typeof e.size == "number" ? (g(n, e.size), E(n, e.size)) : n;
|
|
29
|
-
}
|
|
30
|
-
function V(t, e = {}) {
|
|
31
|
-
const { signed: r, size: n } = e, i = BigInt(t);
|
|
32
|
-
let s;
|
|
33
|
-
n ? r ? s = (1n << BigInt(n) * 8n - 1n) - 1n : s = 2n ** (BigInt(n) * 8n) - 1n : typeof t == "number" && (s = BigInt(Number.MAX_SAFE_INTEGER));
|
|
34
|
-
const u = typeof s == "bigint" && r ? -s - 1n : 0;
|
|
35
|
-
if (s && i > s || i < u) {
|
|
36
|
-
const a = typeof t == "bigint" ? "n" : "";
|
|
37
|
-
throw new O({
|
|
38
|
-
max: s ? `${s}${a}` : void 0,
|
|
39
|
-
min: `${u}${a}`,
|
|
40
|
-
signed: r,
|
|
41
|
-
size: n,
|
|
42
|
-
value: `${t}${a}`
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
const c = `0x${(r && i < 0 ? (1n << BigInt(n * 8)) + BigInt(i) : i).toString(16)}`;
|
|
46
|
-
return n ? x(c, n) : c;
|
|
47
|
-
}
|
|
48
|
-
function j(t, e = {}) {
|
|
49
|
-
return w($.encode(t), e);
|
|
50
|
-
}
|
|
51
|
-
function x(t, e) {
|
|
52
|
-
return d(t, { dir: "left", size: e });
|
|
53
|
-
}
|
|
54
|
-
function E(t, e) {
|
|
55
|
-
return d(t, { dir: "right", size: e });
|
|
56
|
-
}
|
|
57
|
-
function v(t, e, r, n = {}) {
|
|
58
|
-
const { strict: i } = n;
|
|
59
|
-
p(t, e);
|
|
60
|
-
const s = `0x${t.replace("0x", "").slice((e ?? 0) * 2, (r ?? t.length) * 2)}`;
|
|
61
|
-
return i && m(s, e, r), s;
|
|
62
|
-
}
|
|
63
|
-
function A(t) {
|
|
64
|
-
return Math.ceil((t.length - 2) / 2);
|
|
65
|
-
}
|
|
66
|
-
function N(t, e = {}) {
|
|
67
|
-
const { strict: r = !1 } = e;
|
|
68
|
-
try {
|
|
69
|
-
return y(t, { strict: r }), !0;
|
|
70
|
-
} catch {
|
|
71
|
-
return !1;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
class O extends o {
|
|
75
|
-
constructor({ max: e, min: r, signed: n, size: i, value: s }) {
|
|
76
|
-
super(`Number \`${s}\` is not in safe${i ? ` ${i * 8}-bit` : ""}${n ? " signed" : " unsigned"} integer range ${e ? `(\`${r}\` to \`${e}\`)` : `(above \`${r}\`)`}`), Object.defineProperty(this, "name", {
|
|
77
|
-
enumerable: !0,
|
|
78
|
-
configurable: !0,
|
|
79
|
-
writable: !0,
|
|
80
|
-
value: "Hex.IntegerOutOfRangeError"
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
class f extends o {
|
|
85
|
-
constructor(e) {
|
|
86
|
-
super(`Value \`${typeof e == "object" ? b(e) : e}\` of type \`${typeof e}\` is an invalid hex type.`, {
|
|
87
|
-
metaMessages: ['Hex types must be represented as `"0x${string}"`.']
|
|
88
|
-
}), Object.defineProperty(this, "name", {
|
|
89
|
-
enumerable: !0,
|
|
90
|
-
configurable: !0,
|
|
91
|
-
writable: !0,
|
|
92
|
-
value: "Hex.InvalidHexTypeError"
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
class l extends o {
|
|
97
|
-
constructor(e) {
|
|
98
|
-
super(`Value \`${e}\` is an invalid hex value.`, {
|
|
99
|
-
metaMessages: [
|
|
100
|
-
'Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).'
|
|
101
|
-
]
|
|
102
|
-
}), Object.defineProperty(this, "name", {
|
|
103
|
-
enumerable: !0,
|
|
104
|
-
configurable: !0,
|
|
105
|
-
writable: !0,
|
|
106
|
-
value: "Hex.InvalidHexValueError"
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
class _ extends o {
|
|
111
|
-
constructor({ givenSize: e, maxSize: r }) {
|
|
112
|
-
super(`Size cannot exceed \`${r}\` bytes. Given size: \`${e}\` bytes.`), Object.defineProperty(this, "name", {
|
|
113
|
-
enumerable: !0,
|
|
114
|
-
configurable: !0,
|
|
115
|
-
writable: !0,
|
|
116
|
-
value: "Hex.SizeOverflowError"
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
class M extends o {
|
|
121
|
-
constructor({ offset: e, position: r, size: n }) {
|
|
122
|
-
super(`Slice ${r === "start" ? "starting" : "ending"} at offset \`${e}\` is out-of-bounds (size: \`${n}\`).`), Object.defineProperty(this, "name", {
|
|
123
|
-
enumerable: !0,
|
|
124
|
-
configurable: !0,
|
|
125
|
-
writable: !0,
|
|
126
|
-
value: "Hex.SliceOffsetOutOfBoundsError"
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
class R extends o {
|
|
131
|
-
constructor({ size: e, targetSize: r, type: n }) {
|
|
132
|
-
super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${r}\`).`), Object.defineProperty(this, "name", {
|
|
133
|
-
enumerable: !0,
|
|
134
|
-
configurable: !0,
|
|
135
|
-
writable: !0,
|
|
136
|
-
value: "Hex.SizeExceedsPaddingSizeError"
|
|
137
|
-
});
|
|
5
|
+
function h(t, r = !1) {
|
|
6
|
+
const n = t.length;
|
|
7
|
+
let l = new Uint32Array(n), c = new Uint32Array(n);
|
|
8
|
+
for (let e = 0; e < n; e++) {
|
|
9
|
+
const { h: u, l: f } = s(t[e], r);
|
|
10
|
+
[l[e], c[e]] = [u, f];
|
|
138
11
|
}
|
|
12
|
+
return [l, c];
|
|
139
13
|
}
|
|
14
|
+
const m = (t, r, n) => t << n | r >>> 32 - n, A = (t, r, n) => r << n | t >>> 32 - n, B = (t, r, n) => r << n - 32 | t >>> 64 - n, a = (t, r, n) => t << n - 32 | r >>> 64 - n;
|
|
140
15
|
export {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
y as assert,
|
|
148
|
-
B as concat,
|
|
149
|
-
P as fromBoolean,
|
|
150
|
-
w as fromBytes,
|
|
151
|
-
V as fromNumber,
|
|
152
|
-
j as fromString,
|
|
153
|
-
x as padLeft,
|
|
154
|
-
E as padRight,
|
|
155
|
-
A as size,
|
|
156
|
-
v as slice,
|
|
157
|
-
N as validate
|
|
16
|
+
s as fromBig,
|
|
17
|
+
B as rotlBH,
|
|
18
|
+
a as rotlBL,
|
|
19
|
+
m as rotlSH,
|
|
20
|
+
A as rotlSL,
|
|
21
|
+
h as split
|
|
158
22
|
};
|
package/dist/index291.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 u=require("./index295.cjs");/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function p(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function s(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function c(t,...e){if(!p(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function m(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");s(t.outputLen),s(t.blockLen)}function B(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function E(t,e){c(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function H(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function U(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function L(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function S(t,e){return t<<32-e|t>>>e}const h=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function w(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function g(t){for(let e=0;e<t.length;e++)t[e]=w(t[e]);return t}const T=h?t=>t:g,d=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",V=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function _(t){if(c(t),d)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=V[t[n]];return e}const f={_0:48,_9:57,A:65,F:70,a:97,f:102};function l(t){if(t>=f._0&&t<=f._9)return t-f._0;if(t>=f.A&&t<=f.F)return t-(f.A-10);if(t>=f.a&&t<=f.f)return t-(f.a-10)}function I(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(d)return Uint8Array.fromHex(t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let o=0,i=0;o<n;o++,i+=2){const a=l(t.charCodeAt(i)),y=l(t.charCodeAt(i+1));if(a===void 0||y===void 0){const A=t[i]+t[i+1];throw new Error('hex string expected, got non-hex character "'+A+'" at index '+i)}r[o]=a*16+y}return r}function x(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function b(t){return typeof t=="string"&&(t=x(t)),c(t),t}function k(...t){let e=0;for(let r=0;r<t.length;r++){const o=t[r];c(o),e+=o.length}const n=new Uint8Array(e);for(let r=0,o=0;r<t.length;r++){const i=t[r];n.set(i,o),o+=i.length}return n}class O{}function R(t){const e=r=>t().update(b(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function v(t=32){if(u.crypto&&typeof u.crypto.getRandomValues=="function")return u.crypto.getRandomValues(new Uint8Array(t));if(u.crypto&&typeof u.crypto.randomBytes=="function")return Uint8Array.from(u.crypto.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}exports.Hash=O;exports.abytes=c;exports.aexists=B;exports.ahash=m;exports.anumber=s;exports.aoutput=E;exports.byteSwap=w;exports.byteSwap32=g;exports.bytesToHex=_;exports.clean=U;exports.concatBytes=k;exports.createHasher=R;exports.createView=L;exports.hexToBytes=I;exports.isBytes=p;exports.isLE=h;exports.randomBytes=v;exports.rotr=S;exports.swap32IfBE=T;exports.toBytes=b;exports.u32=H;exports.utf8ToBytes=x;
|
package/dist/index291.js
CHANGED
|
@@ -1,12 +1,149 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { crypto as u } from "./index295.js";
|
|
2
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3
|
+
function w(t) {
|
|
4
|
+
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
5
|
+
}
|
|
6
|
+
function l(t) {
|
|
7
|
+
if (!Number.isSafeInteger(t) || t < 0)
|
|
8
|
+
throw new Error("positive integer expected, got " + t);
|
|
9
|
+
}
|
|
10
|
+
function c(t, ...e) {
|
|
11
|
+
if (!w(t))
|
|
12
|
+
throw new Error("Uint8Array expected");
|
|
13
|
+
if (e.length > 0 && !e.includes(t.length))
|
|
14
|
+
throw new Error("Uint8Array expected of length " + e + ", got length=" + t.length);
|
|
15
|
+
}
|
|
16
|
+
function U(t) {
|
|
17
|
+
if (typeof t != "function" || typeof t.create != "function")
|
|
18
|
+
throw new Error("Hash should be wrapped by utils.createHasher");
|
|
19
|
+
l(t.outputLen), l(t.blockLen);
|
|
20
|
+
}
|
|
21
|
+
function B(t, e = !0) {
|
|
22
|
+
if (t.destroyed)
|
|
23
|
+
throw new Error("Hash instance has been destroyed");
|
|
24
|
+
if (e && t.finished)
|
|
25
|
+
throw new Error("Hash#digest() has already been called");
|
|
26
|
+
}
|
|
27
|
+
function H(t, e) {
|
|
28
|
+
c(t);
|
|
29
|
+
const n = e.outputLen;
|
|
30
|
+
if (t.length < n)
|
|
31
|
+
throw new Error("digestInto() expects output buffer of length at least " + n);
|
|
32
|
+
}
|
|
33
|
+
function L(t) {
|
|
34
|
+
return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
|
|
35
|
+
}
|
|
36
|
+
function V(...t) {
|
|
37
|
+
for (let e = 0; e < t.length; e++)
|
|
38
|
+
t[e].fill(0);
|
|
39
|
+
}
|
|
40
|
+
function _(t) {
|
|
41
|
+
return new DataView(t.buffer, t.byteOffset, t.byteLength);
|
|
42
|
+
}
|
|
43
|
+
function S(t, e) {
|
|
44
|
+
return t << 32 - e | t >>> e;
|
|
45
|
+
}
|
|
46
|
+
const d = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
47
|
+
function h(t) {
|
|
48
|
+
return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
|
|
49
|
+
}
|
|
50
|
+
function x(t) {
|
|
51
|
+
for (let e = 0; e < t.length; e++)
|
|
52
|
+
t[e] = h(t[e]);
|
|
53
|
+
return t;
|
|
54
|
+
}
|
|
55
|
+
const T = d ? (t) => t : x, p = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", A = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
56
|
+
function k(t) {
|
|
57
|
+
if (c(t), p)
|
|
58
|
+
return t.toHex();
|
|
59
|
+
let e = "";
|
|
60
|
+
for (let n = 0; n < t.length; n++)
|
|
61
|
+
e += A[t[n]];
|
|
62
|
+
return e;
|
|
63
|
+
}
|
|
64
|
+
const f = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
65
|
+
function y(t) {
|
|
66
|
+
if (t >= f._0 && t <= f._9)
|
|
67
|
+
return t - f._0;
|
|
68
|
+
if (t >= f.A && t <= f.F)
|
|
69
|
+
return t - (f.A - 10);
|
|
70
|
+
if (t >= f.a && t <= f.f)
|
|
71
|
+
return t - (f.a - 10);
|
|
72
|
+
}
|
|
73
|
+
function I(t) {
|
|
74
|
+
if (typeof t != "string")
|
|
75
|
+
throw new Error("hex string expected, got " + typeof t);
|
|
76
|
+
if (p)
|
|
77
|
+
return Uint8Array.fromHex(t);
|
|
78
|
+
const e = t.length, n = e / 2;
|
|
79
|
+
if (e % 2)
|
|
80
|
+
throw new Error("hex string expected, got unpadded hex of length " + e);
|
|
81
|
+
const r = new Uint8Array(n);
|
|
82
|
+
for (let o = 0, i = 0; o < n; o++, i += 2) {
|
|
83
|
+
const s = y(t.charCodeAt(i)), a = y(t.charCodeAt(i + 1));
|
|
84
|
+
if (s === void 0 || a === void 0) {
|
|
85
|
+
const g = t[i] + t[i + 1];
|
|
86
|
+
throw new Error('hex string expected, got non-hex character "' + g + '" at index ' + i);
|
|
87
|
+
}
|
|
88
|
+
r[o] = s * 16 + a;
|
|
89
|
+
}
|
|
90
|
+
return r;
|
|
91
|
+
}
|
|
92
|
+
function m(t) {
|
|
93
|
+
if (typeof t != "string")
|
|
94
|
+
throw new Error("string expected");
|
|
95
|
+
return new Uint8Array(new TextEncoder().encode(t));
|
|
96
|
+
}
|
|
97
|
+
function b(t) {
|
|
98
|
+
return typeof t == "string" && (t = m(t)), c(t), t;
|
|
99
|
+
}
|
|
100
|
+
function R(...t) {
|
|
101
|
+
let e = 0;
|
|
102
|
+
for (let r = 0; r < t.length; r++) {
|
|
103
|
+
const o = t[r];
|
|
104
|
+
c(o), e += o.length;
|
|
105
|
+
}
|
|
106
|
+
const n = new Uint8Array(e);
|
|
107
|
+
for (let r = 0, o = 0; r < t.length; r++) {
|
|
108
|
+
const i = t[r];
|
|
109
|
+
n.set(i, o), o += i.length;
|
|
110
|
+
}
|
|
111
|
+
return n;
|
|
112
|
+
}
|
|
113
|
+
class F {
|
|
114
|
+
}
|
|
115
|
+
function O(t) {
|
|
116
|
+
const e = (r) => t().update(b(r)).digest(), n = t();
|
|
117
|
+
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
|
|
118
|
+
}
|
|
119
|
+
function v(t = 32) {
|
|
120
|
+
if (u && typeof u.getRandomValues == "function")
|
|
121
|
+
return u.getRandomValues(new Uint8Array(t));
|
|
122
|
+
if (u && typeof u.randomBytes == "function")
|
|
123
|
+
return Uint8Array.from(u.randomBytes(t));
|
|
124
|
+
throw new Error("crypto.getRandomValues must be defined");
|
|
9
125
|
}
|
|
10
126
|
export {
|
|
11
|
-
|
|
127
|
+
F as Hash,
|
|
128
|
+
c as abytes,
|
|
129
|
+
B as aexists,
|
|
130
|
+
U as ahash,
|
|
131
|
+
l as anumber,
|
|
132
|
+
H as aoutput,
|
|
133
|
+
h as byteSwap,
|
|
134
|
+
x as byteSwap32,
|
|
135
|
+
k as bytesToHex,
|
|
136
|
+
V as clean,
|
|
137
|
+
R as concatBytes,
|
|
138
|
+
O as createHasher,
|
|
139
|
+
_ as createView,
|
|
140
|
+
I as hexToBytes,
|
|
141
|
+
w as isBytes,
|
|
142
|
+
d as isLE,
|
|
143
|
+
v as randomBytes,
|
|
144
|
+
S as rotr,
|
|
145
|
+
T as swap32IfBE,
|
|
146
|
+
b as toBytes,
|
|
147
|
+
L as u32,
|
|
148
|
+
m as utf8ToBytes
|
|
12
149
|
};
|
package/dist/index292.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 t(e){return`[${e.slice(2)}]`}exports.encodeLabelhash=t;
|
package/dist/index292.js
CHANGED
|
@@ -1,116 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { validate as $, slice as A, fromString as S } from "./index290.js";
|
|
4
|
-
import { isArgOfType as E, normalizeSignature as p, getAmbiguousTypes as B } from "./index307.js";
|
|
5
|
-
import { parseAbiItem as l } from "./index270.js";
|
|
6
|
-
import { formatAbiItem as h } from "./index263.js";
|
|
7
|
-
function H(e, r = {}) {
|
|
8
|
-
const { prepare: i = !0 } = r, n = Array.isArray(e) ? l(e) : typeof e == "string" ? l(e) : e;
|
|
9
|
-
return {
|
|
10
|
-
...n,
|
|
11
|
-
...i ? { hash: s(n) } : {}
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function M(e, r, i) {
|
|
15
|
-
const { args: n = [], prepare: f = !0 } = i ?? {}, b = $(r, { strict: !1 }), u = e.filter((t) => b ? t.type === "function" || t.type === "error" ? T(t) === A(r, 0, 4) : t.type === "event" ? s(t) === r : !1 : "name" in t && t.name === r);
|
|
16
|
-
if (u.length === 0)
|
|
17
|
-
throw new d({ name: r });
|
|
18
|
-
if (u.length === 1)
|
|
19
|
-
return {
|
|
20
|
-
...u[0],
|
|
21
|
-
...f ? { hash: s(u[0]) } : {}
|
|
22
|
-
};
|
|
23
|
-
let o;
|
|
24
|
-
for (const t of u) {
|
|
25
|
-
if (!("inputs" in t))
|
|
26
|
-
continue;
|
|
27
|
-
if (!n || n.length === 0) {
|
|
28
|
-
if (!t.inputs || t.inputs.length === 0)
|
|
29
|
-
return {
|
|
30
|
-
...t,
|
|
31
|
-
...f ? { hash: s(t) } : {}
|
|
32
|
-
};
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
if (!t.inputs || t.inputs.length === 0 || t.inputs.length !== n.length)
|
|
36
|
-
continue;
|
|
37
|
-
if (n.every((a, w) => {
|
|
38
|
-
const g = "inputs" in t && t.inputs[w];
|
|
39
|
-
return g ? E(a, g) : !1;
|
|
40
|
-
})) {
|
|
41
|
-
if (o && "inputs" in o && o.inputs) {
|
|
42
|
-
const a = B(t.inputs, o.inputs, n);
|
|
43
|
-
if (a)
|
|
44
|
-
throw new O({
|
|
45
|
-
abiItem: t,
|
|
46
|
-
type: a[0]
|
|
47
|
-
}, {
|
|
48
|
-
abiItem: o,
|
|
49
|
-
type: a[1]
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
o = t;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
const c = (() => {
|
|
56
|
-
if (o)
|
|
57
|
-
return o;
|
|
58
|
-
const [t, ...m] = u;
|
|
59
|
-
return { ...t, overloads: m };
|
|
60
|
-
})();
|
|
61
|
-
if (!c)
|
|
62
|
-
throw new d({ name: r });
|
|
63
|
-
return {
|
|
64
|
-
...c,
|
|
65
|
-
...f ? { hash: s(c) } : {}
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function T(e) {
|
|
69
|
-
return A(s(e), 0, 4);
|
|
70
|
-
}
|
|
71
|
-
function F(e) {
|
|
72
|
-
const r = typeof e == "string" ? e : h(e);
|
|
73
|
-
return p(r);
|
|
74
|
-
}
|
|
75
|
-
function s(e) {
|
|
76
|
-
return typeof e != "string" && "hash" in e && e.hash ? e.hash : v(S(F(e)));
|
|
77
|
-
}
|
|
78
|
-
class O extends y {
|
|
79
|
-
constructor(r, i) {
|
|
80
|
-
super("Found ambiguous types in overloaded ABI Items.", {
|
|
81
|
-
metaMessages: [
|
|
82
|
-
// TODO: abitype to add support for signature-formatted ABI items.
|
|
83
|
-
`\`${r.type}\` in \`${p(h(r.abiItem))}\`, and`,
|
|
84
|
-
`\`${i.type}\` in \`${p(h(i.abiItem))}\``,
|
|
85
|
-
"",
|
|
86
|
-
"These types encode differently and cannot be distinguished at runtime.",
|
|
87
|
-
"Remove one of the ambiguous items in the ABI."
|
|
88
|
-
]
|
|
89
|
-
}), Object.defineProperty(this, "name", {
|
|
90
|
-
enumerable: !0,
|
|
91
|
-
configurable: !0,
|
|
92
|
-
writable: !0,
|
|
93
|
-
value: "AbiItem.AmbiguityError"
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
class d extends y {
|
|
98
|
-
constructor({ name: r, data: i, type: n = "item" }) {
|
|
99
|
-
const f = r ? ` with name "${r}"` : i ? ` with data "${i}"` : "";
|
|
100
|
-
super(`ABI ${n}${f} not found.`), Object.defineProperty(this, "name", {
|
|
101
|
-
enumerable: !0,
|
|
102
|
-
configurable: !0,
|
|
103
|
-
writable: !0,
|
|
104
|
-
value: "AbiItem.NotFoundError"
|
|
105
|
-
});
|
|
106
|
-
}
|
|
1
|
+
function n(e) {
|
|
2
|
+
return `[${e.slice(2)}]`;
|
|
107
3
|
}
|
|
108
4
|
export {
|
|
109
|
-
|
|
110
|
-
d as NotFoundError,
|
|
111
|
-
H as from,
|
|
112
|
-
M as fromAbi,
|
|
113
|
-
T as getSelector,
|
|
114
|
-
F as getSignature,
|
|
115
|
-
s as getSignatureHash
|
|
5
|
+
n as encodeLabelhash
|
|
116
6
|
};
|