@coinbase/cdp-hooks 0.0.74 → 0.0.76
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/README.md +199 -5
- package/dist/esm/index177.js +3 -3
- package/dist/esm/index206.js +2 -2
- package/dist/esm/index209.js +2 -2
- package/dist/esm/index210.js +1 -1
- package/dist/esm/index214.js +3 -3
- package/dist/esm/index215.js +40 -38
- package/dist/esm/index216.js +2 -2
- package/dist/esm/index217.js +4 -69
- package/dist/esm/index218.js +10 -34
- package/dist/esm/index219.js +18 -13
- package/dist/esm/index220.js +7 -40
- package/dist/esm/index221.js +12 -2
- package/dist/esm/index222.js +66 -4
- package/dist/esm/index223.js +64 -9
- package/dist/esm/index224.js +183 -17
- package/dist/esm/index225.js +22 -7
- package/dist/esm/index226.js +41 -10
- package/dist/esm/index227.js +72 -62
- package/dist/esm/index228.js +36 -61
- package/dist/esm/index229.js +15 -184
- package/dist/esm/index230.js +12 -21
- package/dist/esm/index231.js +7 -42
- package/dist/esm/index232.js +6 -76
- package/dist/esm/index233.js +36 -40
- package/dist/esm/index234.js +15 -16
- package/dist/esm/index235.js +8 -13
- package/dist/esm/index236.js +12 -7
- package/dist/esm/index237.js +9 -6
- package/dist/esm/index238.js +16 -36
- package/dist/esm/index239.js +22 -15
- package/dist/esm/index240.js +29 -7
- package/dist/esm/index241.js +2 -13
- package/dist/esm/index242.js +13 -9
- package/dist/esm/index243.js +11 -15
- package/dist/esm/index244.js +45 -20
- package/dist/esm/index245.js +9 -30
- package/dist/esm/index246.js +14 -2
- package/dist/esm/index247.js +14 -13
- package/dist/esm/index248.js +8 -12
- package/dist/esm/index249.js +14 -46
- package/dist/esm/index250.js +23 -8
- package/dist/esm/index251.js +11 -13
- package/dist/esm/index252.js +24 -14
- package/dist/esm/index253.js +51 -8
- package/dist/esm/index254.js +15 -13
- package/dist/esm/index255.js +14 -24
- package/dist/esm/index256.js +11 -11
- package/dist/esm/index257.js +103 -24
- package/dist/esm/index258.js +5 -51
- package/dist/esm/index259.js +222 -16
- package/dist/esm/index260.js +6 -14
- package/dist/esm/index261.js +7 -12
- package/dist/esm/index262.js +24 -101
- package/dist/esm/index263.js +19 -5
- package/dist/esm/index264.js +140 -218
- package/dist/esm/index265.js +13 -7
- package/dist/esm/index266.js +35 -6
- package/dist/esm/index267.js +41 -26
- package/dist/esm/index268.js +38 -19
- package/dist/esm/index269.js +2 -146
- package/dist/esm/index270.js +70 -13
- package/dist/esm/index271.js +34 -35
- package/dist/esm/index272.js +14 -41
- package/dist/esm/index275.js +3 -136
- package/dist/esm/index276.js +136 -3
- package/dist/esm/index277.js +3 -3
- package/dist/esm/index280.js +5 -5
- package/dist/esm/index281.js +4 -4
- package/dist/esm/index282.js +1 -1
- package/dist/esm/index284.js +2 -2
- package/dist/esm/index285.js +2 -2
- package/dist/esm/index286.js +1 -1
- package/dist/esm/index287.js +1 -1
- package/dist/esm/index288.js +65 -3
- package/dist/esm/index289.js +4 -65
- package/dist/esm/index290.js +40 -4
- package/dist/esm/index291.js +7 -40
- package/dist/esm/index292.js +62 -7
- package/dist/esm/index293.js +72 -57
- package/dist/esm/index294.js +4 -78
- package/dist/esm/index295.js +195 -4
- package/dist/esm/index296.js +3 -194
- package/dist/esm/index297.js +2 -2
- package/dist/esm/index3.js +1 -1
- package/dist/esm/index33.js +2 -2
- package/dist/esm/index40.js +1 -1
- package/dist/esm/index41.js +1 -1
- package/dist/esm/index44.js +3 -3
- package/dist/esm/index45.js +2 -2
- package/dist/esm/index46.js +3 -3
- package/dist/esm/index47.js +2 -2
- package/dist/esm/index48.js +3 -3
- package/dist/esm/index49.js +6 -6
- package/dist/esm/index50.js +2 -2
- package/dist/esm/index51.js +1 -1
- package/dist/esm/index52.js +1 -1
- package/dist/esm/index53.js +1 -1
- package/dist/esm/index54.js +1 -1
- package/dist/esm/index55.js +1 -1
- package/dist/esm/index56.js +1 -1
- package/dist/esm/index57.js +4 -4
- package/dist/esm/index58.js +1 -1
- package/dist/esm/index66.js +1 -1
- package/dist/esm/index67.js +2 -2
- package/dist/esm/index68.js +1 -1
- package/dist/esm/index73.js +1 -1
- package/dist/esm/index76.js +1 -1
- package/dist/esm/index79.js +1 -1
- package/dist/esm/index80.js +1 -1
- package/dist/esm/index81.js +3 -3
- package/dist/esm/index82.js +2 -2
- package/dist/esm/index83.js +1 -1
- package/dist/esm/index85.js +1 -1
- package/dist/esm/index86.js +1 -1
- package/dist/esm/index87.js +3 -3
- package/dist/esm/index88.js +3 -3
- package/dist/esm/index89.js +3 -3
- package/dist/esm/index90.js +3 -3
- package/dist/esm/index91.js +3 -3
- package/dist/esm/index92.js +3 -3
- package/dist/esm/index93.js +3 -3
- package/dist/esm/index94.js +1 -1
- package/dist/esm/index96.js +1 -1
- package/dist/types/index.d.ts +2 -1
- package/package.json +3 -3
package/dist/esm/index276.js
CHANGED
|
@@ -1,6 +1,139 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { readContract as w } from "./index80.js";
|
|
2
|
+
import { EnsAvatarUriResolutionError as d, EnsAvatarInvalidNftUriError as p, EnsAvatarUnsupportedNamespaceError as I, EnsAvatarInvalidMetadataError as y } from "./index124.js";
|
|
3
|
+
const v = /(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/, A = /^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/, b = /^data:([a-zA-Z\-/+]*);base64,([^"].*)/, E = /^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;
|
|
4
|
+
async function k(e) {
|
|
5
|
+
try {
|
|
6
|
+
const t = await fetch(e, { method: "HEAD" });
|
|
7
|
+
return t.status === 200 ? t.headers.get("content-type")?.startsWith("image/") : !1;
|
|
8
|
+
} catch (t) {
|
|
9
|
+
return typeof t == "object" && typeof t.response < "u" || !globalThis.hasOwnProperty("Image") ? !1 : new Promise((n) => {
|
|
10
|
+
const a = new Image();
|
|
11
|
+
a.onload = () => {
|
|
12
|
+
n(!0);
|
|
13
|
+
}, a.onerror = () => {
|
|
14
|
+
n(!1);
|
|
15
|
+
}, a.src = e;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function l(e, t) {
|
|
20
|
+
return e ? e.endsWith("/") ? e.slice(0, -1) : e : t;
|
|
21
|
+
}
|
|
22
|
+
function C({ uri: e, gatewayUrls: t }) {
|
|
23
|
+
const n = b.test(e);
|
|
24
|
+
if (n)
|
|
25
|
+
return { uri: e, isOnChain: !0, isEncoded: n };
|
|
26
|
+
const a = l(t?.ipfs, "https://ipfs.io"), r = l(t?.arweave, "https://arweave.net"), f = e.match(v), { protocol: i, subpath: c, target: s, subtarget: h = "" } = f?.groups || {}, u = i === "ipns:/" || c === "ipns/", m = i === "ipfs:/" || c === "ipfs/" || A.test(e);
|
|
27
|
+
if (e.startsWith("http") && !u && !m) {
|
|
28
|
+
let g = e;
|
|
29
|
+
return t?.arweave && (g = e.replace(/https:\/\/arweave.net/g, t?.arweave)), { uri: g, isOnChain: !1, isEncoded: !1 };
|
|
30
|
+
}
|
|
31
|
+
if ((u || m) && s)
|
|
32
|
+
return {
|
|
33
|
+
uri: `${a}/${u ? "ipns" : "ipfs"}/${s}${h}`,
|
|
34
|
+
isOnChain: !1,
|
|
35
|
+
isEncoded: !1
|
|
36
|
+
};
|
|
37
|
+
if (i === "ar:/" && s)
|
|
38
|
+
return {
|
|
39
|
+
uri: `${r}/${s}${h || ""}`,
|
|
40
|
+
isOnChain: !1,
|
|
41
|
+
isEncoded: !1
|
|
42
|
+
};
|
|
43
|
+
let o = e.replace(E, "");
|
|
44
|
+
if (o.startsWith("<svg") && (o = `data:image/svg+xml;base64,${btoa(o)}`), o.startsWith("data:") || o.startsWith("{"))
|
|
45
|
+
return {
|
|
46
|
+
uri: o,
|
|
47
|
+
isOnChain: !0,
|
|
48
|
+
isEncoded: !1
|
|
49
|
+
};
|
|
50
|
+
throw new d({ uri: e });
|
|
51
|
+
}
|
|
52
|
+
function U(e) {
|
|
53
|
+
if (typeof e != "object" || !("image" in e) && !("image_url" in e) && !("image_data" in e))
|
|
54
|
+
throw new y({ data: e });
|
|
55
|
+
return e.image || e.image_url || e.image_data;
|
|
56
|
+
}
|
|
57
|
+
async function $({ gatewayUrls: e, uri: t }) {
|
|
58
|
+
try {
|
|
59
|
+
const n = await fetch(t).then((r) => r.json());
|
|
60
|
+
return await R({
|
|
61
|
+
gatewayUrls: e,
|
|
62
|
+
uri: U(n)
|
|
63
|
+
});
|
|
64
|
+
} catch {
|
|
65
|
+
throw new d({ uri: t });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async function R({ gatewayUrls: e, uri: t }) {
|
|
69
|
+
const { uri: n, isOnChain: a } = C({ uri: t, gatewayUrls: e });
|
|
70
|
+
if (a || await k(n))
|
|
71
|
+
return n;
|
|
72
|
+
throw new d({ uri: t });
|
|
73
|
+
}
|
|
74
|
+
function D(e) {
|
|
75
|
+
let t = e;
|
|
76
|
+
t.startsWith("did:nft:") && (t = t.replace("did:nft:", "").replace(/_/g, "/"));
|
|
77
|
+
const [n, a, r] = t.split("/"), [f, i] = n.split(":"), [c, s] = a.split(":");
|
|
78
|
+
if (!f || f.toLowerCase() !== "eip155")
|
|
79
|
+
throw new p({ reason: "Only EIP-155 supported" });
|
|
80
|
+
if (!i)
|
|
81
|
+
throw new p({ reason: "Chain ID not found" });
|
|
82
|
+
if (!s)
|
|
83
|
+
throw new p({
|
|
84
|
+
reason: "Contract address not found"
|
|
85
|
+
});
|
|
86
|
+
if (!r)
|
|
87
|
+
throw new p({ reason: "Token ID not found" });
|
|
88
|
+
if (!c)
|
|
89
|
+
throw new p({ reason: "ERC namespace not found" });
|
|
90
|
+
return {
|
|
91
|
+
chainID: Number.parseInt(i),
|
|
92
|
+
namespace: c.toLowerCase(),
|
|
93
|
+
contractAddress: s,
|
|
94
|
+
tokenID: r
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
async function O(e, { nft: t }) {
|
|
98
|
+
if (t.namespace === "erc721")
|
|
99
|
+
return w(e, {
|
|
100
|
+
address: t.contractAddress,
|
|
101
|
+
abi: [
|
|
102
|
+
{
|
|
103
|
+
name: "tokenURI",
|
|
104
|
+
type: "function",
|
|
105
|
+
stateMutability: "view",
|
|
106
|
+
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
107
|
+
outputs: [{ name: "", type: "string" }]
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
functionName: "tokenURI",
|
|
111
|
+
args: [BigInt(t.tokenID)]
|
|
112
|
+
});
|
|
113
|
+
if (t.namespace === "erc1155")
|
|
114
|
+
return w(e, {
|
|
115
|
+
address: t.contractAddress,
|
|
116
|
+
abi: [
|
|
117
|
+
{
|
|
118
|
+
name: "uri",
|
|
119
|
+
type: "function",
|
|
120
|
+
stateMutability: "view",
|
|
121
|
+
inputs: [{ name: "_id", type: "uint256" }],
|
|
122
|
+
outputs: [{ name: "", type: "string" }]
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
functionName: "uri",
|
|
126
|
+
args: [BigInt(t.tokenID)]
|
|
127
|
+
});
|
|
128
|
+
throw new I({ namespace: t.namespace });
|
|
3
129
|
}
|
|
4
130
|
export {
|
|
5
|
-
|
|
131
|
+
l as getGateway,
|
|
132
|
+
U as getJsonImage,
|
|
133
|
+
$ as getMetadataAvatarUri,
|
|
134
|
+
O as getNftTokenUri,
|
|
135
|
+
k as isImageUri,
|
|
136
|
+
R as parseAvatarUri,
|
|
137
|
+
D as parseNftUri,
|
|
138
|
+
C as resolveAvatarUri
|
|
6
139
|
};
|
package/dist/esm/index277.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseError as o } from "./
|
|
2
|
-
import { stringify as b } from "./
|
|
3
|
-
import { pad as d, assertEndOffset as m, assertSize as g, assertStartOffset as p } from "./
|
|
1
|
+
import { BaseError as o } from "./index288.js";
|
|
2
|
+
import { stringify as b } from "./index289.js";
|
|
3
|
+
import { pad as d, assertEndOffset as m, assertSize as g, assertStartOffset as p } from "./index290.js";
|
|
4
4
|
const $ = /* @__PURE__ */ new TextEncoder(), h = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
5
5
|
function y(t, e = {}) {
|
|
6
6
|
const { strict: r = !1 } = e;
|
package/dist/esm/index280.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { BaseError as y } from "./
|
|
2
|
-
import { keccak256 as v } from "./
|
|
1
|
+
import { BaseError as y } from "./index288.js";
|
|
2
|
+
import { keccak256 as v } from "./index291.js";
|
|
3
3
|
import { validate as $, slice as A, fromString as S } from "./index277.js";
|
|
4
|
-
import { isArgOfType as E, normalizeSignature as p, getAmbiguousTypes as B } from "./
|
|
5
|
-
import { parseAbiItem as l } from "./
|
|
6
|
-
import { formatAbiItem as h } from "./
|
|
4
|
+
import { isArgOfType as E, normalizeSignature as p, getAmbiguousTypes as B } from "./index292.js";
|
|
5
|
+
import { parseAbiItem as l } from "./index225.js";
|
|
6
|
+
import { formatAbiItem as h } from "./index217.js";
|
|
7
7
|
function H(e, r = {}) {
|
|
8
8
|
const { prepare: i = !0 } = r, n = Array.isArray(e) ? l(e) : typeof e == "string" ? l(e) : e;
|
|
9
9
|
return {
|
package/dist/esm/index281.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { assert as p } from "./
|
|
2
|
-
import { BaseError as u } from "./
|
|
1
|
+
import { assert as p } from "./index293.js";
|
|
2
|
+
import { BaseError as u } from "./index288.js";
|
|
3
3
|
import { size as y, padLeft as f, fromString as x, fromBoolean as w, fromNumber as E, padRight as P, concat as g } from "./index277.js";
|
|
4
|
-
import { integerRegex as A, bytesRegex as $, arrayRegex as L } from "./
|
|
5
|
-
import { prepareParameters as z, encode as I } from "./
|
|
4
|
+
import { integerRegex as A, bytesRegex as $, arrayRegex as L } from "./index294.js";
|
|
5
|
+
import { prepareParameters as z, encode as I } from "./index295.js";
|
|
6
6
|
function N(n, e, t) {
|
|
7
7
|
const { checksumAddress: r = !1 } = {};
|
|
8
8
|
if (n.length !== e.length)
|
package/dist/esm/index282.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Hash as g, createView as l, aexists as b, toBytes as a, abytes as d, aoutput as x, clean as w } from "./
|
|
1
|
+
import { Hash as g, createView as l, aexists as b, toBytes as a, abytes as d, aoutput as x, clean as w } from "./index264.js";
|
|
2
2
|
function y(o, t, s, n) {
|
|
3
3
|
if (typeof o.setBigUint64 == "function")
|
|
4
4
|
return o.setBigUint64(t, s, n);
|
package/dist/esm/index284.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { hmac as dt } from "./index286.js";
|
|
2
2
|
import { _validateObject as at, bitMask as ft, abool as Q, ensureBytes as z, memoized as nt, createHmacDrbg as ht, bytesToNumberBE as ct, numberToHexUnpadded as M, aInRange as mt } from "./index285.js";
|
|
3
3
|
import { _createCurveFields as wt, wNAF as yt, normalizeZ as pt, pippenger as gt, mulEndoUnsafe as Et, negateCt as ot } from "./index287.js";
|
|
4
|
-
import { Field as bt, mapHashToField as vt, getMinHashLength as Bt } from "./
|
|
5
|
-
import { concatBytes as I, abytes as it, bytesToHex as rt, hexToBytes as xt, randomBytes as St, isBytes as Rt } from "./
|
|
4
|
+
import { Field as bt, mapHashToField as vt, getMinHashLength as Bt } from "./index259.js";
|
|
5
|
+
import { concatBytes as I, abytes as it, bytesToHex as rt, hexToBytes as xt, randomBytes as St, isBytes as Rt } from "./index264.js";
|
|
6
6
|
function st(e) {
|
|
7
7
|
e.lowS !== void 0 && Q("lowS", e.lowS), e.prehash !== void 0 && Q("prehash", e.prehash);
|
|
8
8
|
}
|
package/dist/esm/index285.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { hexToBytes as p, isBytes as B, abytes as v, bytesToHex as d, concatBytes as U } from "./
|
|
2
|
-
import { anumber as W, randomBytes as C, utf8ToBytes as G } from "./
|
|
1
|
+
import { hexToBytes as p, isBytes as B, abytes as v, bytesToHex as d, concatBytes as U } from "./index264.js";
|
|
2
|
+
import { anumber as W, randomBytes as C, utf8ToBytes as G } from "./index264.js";
|
|
3
3
|
const y = /* @__PURE__ */ BigInt(0), g = /* @__PURE__ */ BigInt(1);
|
|
4
4
|
function k(t, r) {
|
|
5
5
|
if (typeof r != "boolean")
|
package/dist/esm/index286.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Hash as d, ahash as u, toBytes as H, clean as l, aexists as a, abytes as p } from "./
|
|
1
|
+
import { Hash as d, ahash as u, toBytes as H, clean as l, aexists as a, abytes as p } from "./index264.js";
|
|
2
2
|
class r extends d {
|
|
3
3
|
constructor(t, i) {
|
|
4
4
|
super(), this.finished = !1, this.destroyed = !1, u(t);
|
package/dist/esm/index287.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { bitLen as B, bitMask as z } from "./index285.js";
|
|
2
|
-
import { validateField as Z, Field as O, FpInvertBatch as R } from "./
|
|
2
|
+
import { validateField as Z, Field as O, FpInvertBatch as R } from "./index259.js";
|
|
3
3
|
const g = BigInt(0), h = BigInt(1);
|
|
4
4
|
function b(t, r) {
|
|
5
5
|
const e = r.negate();
|
package/dist/esm/index288.js
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { getVersion as n } from "./index299.js";
|
|
2
|
+
class s extends Error {
|
|
3
|
+
constructor(r, e = {}) {
|
|
4
|
+
const a = (() => {
|
|
5
|
+
if (e.cause instanceof s) {
|
|
6
|
+
if (e.cause.details)
|
|
7
|
+
return e.cause.details;
|
|
8
|
+
if (e.cause.shortMessage)
|
|
9
|
+
return e.cause.shortMessage;
|
|
10
|
+
}
|
|
11
|
+
return e.cause && "details" in e.cause && typeof e.cause.details == "string" ? e.cause.details : e.cause?.message ? e.cause.message : e.details;
|
|
12
|
+
})(), u = e.cause instanceof s && e.cause.docsPath || e.docsPath, c = `https://oxlib.sh${u ?? ""}`, l = [
|
|
13
|
+
r || "An error occurred.",
|
|
14
|
+
...e.metaMessages ? ["", ...e.metaMessages] : [],
|
|
15
|
+
...a || u ? [
|
|
16
|
+
"",
|
|
17
|
+
a ? `Details: ${a}` : void 0,
|
|
18
|
+
u ? `See: ${c}` : void 0
|
|
19
|
+
] : []
|
|
20
|
+
].filter((d) => typeof d == "string").join(`
|
|
21
|
+
`);
|
|
22
|
+
super(l, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
|
|
23
|
+
enumerable: !0,
|
|
24
|
+
configurable: !0,
|
|
25
|
+
writable: !0,
|
|
26
|
+
value: void 0
|
|
27
|
+
}), Object.defineProperty(this, "docs", {
|
|
28
|
+
enumerable: !0,
|
|
29
|
+
configurable: !0,
|
|
30
|
+
writable: !0,
|
|
31
|
+
value: void 0
|
|
32
|
+
}), Object.defineProperty(this, "docsPath", {
|
|
33
|
+
enumerable: !0,
|
|
34
|
+
configurable: !0,
|
|
35
|
+
writable: !0,
|
|
36
|
+
value: void 0
|
|
37
|
+
}), Object.defineProperty(this, "shortMessage", {
|
|
38
|
+
enumerable: !0,
|
|
39
|
+
configurable: !0,
|
|
40
|
+
writable: !0,
|
|
41
|
+
value: void 0
|
|
42
|
+
}), Object.defineProperty(this, "cause", {
|
|
43
|
+
enumerable: !0,
|
|
44
|
+
configurable: !0,
|
|
45
|
+
writable: !0,
|
|
46
|
+
value: void 0
|
|
47
|
+
}), Object.defineProperty(this, "name", {
|
|
48
|
+
enumerable: !0,
|
|
49
|
+
configurable: !0,
|
|
50
|
+
writable: !0,
|
|
51
|
+
value: "BaseError"
|
|
52
|
+
}), Object.defineProperty(this, "version", {
|
|
53
|
+
enumerable: !0,
|
|
54
|
+
configurable: !0,
|
|
55
|
+
writable: !0,
|
|
56
|
+
value: `ox@${n()}`
|
|
57
|
+
}), this.cause = e.cause, this.details = a, this.docs = c, this.docsPath = u, this.shortMessage = r;
|
|
58
|
+
}
|
|
59
|
+
walk(r) {
|
|
60
|
+
return i(this, r);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function i(t, r) {
|
|
64
|
+
return r?.(t) ? t : t && typeof t == "object" && "cause" in t && t.cause ? i(t.cause, r) : r ? null : t;
|
|
3
65
|
}
|
|
4
66
|
export {
|
|
5
|
-
|
|
67
|
+
s as BaseError
|
|
6
68
|
};
|
package/dist/esm/index289.js
CHANGED
|
@@ -1,68 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const a = (() => {
|
|
5
|
-
if (e.cause instanceof s) {
|
|
6
|
-
if (e.cause.details)
|
|
7
|
-
return e.cause.details;
|
|
8
|
-
if (e.cause.shortMessage)
|
|
9
|
-
return e.cause.shortMessage;
|
|
10
|
-
}
|
|
11
|
-
return e.cause && "details" in e.cause && typeof e.cause.details == "string" ? e.cause.details : e.cause?.message ? e.cause.message : e.details;
|
|
12
|
-
})(), u = e.cause instanceof s && e.cause.docsPath || e.docsPath, c = `https://oxlib.sh${u ?? ""}`, l = [
|
|
13
|
-
r || "An error occurred.",
|
|
14
|
-
...e.metaMessages ? ["", ...e.metaMessages] : [],
|
|
15
|
-
...a || u ? [
|
|
16
|
-
"",
|
|
17
|
-
a ? `Details: ${a}` : void 0,
|
|
18
|
-
u ? `See: ${c}` : void 0
|
|
19
|
-
] : []
|
|
20
|
-
].filter((d) => typeof d == "string").join(`
|
|
21
|
-
`);
|
|
22
|
-
super(l, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
|
|
23
|
-
enumerable: !0,
|
|
24
|
-
configurable: !0,
|
|
25
|
-
writable: !0,
|
|
26
|
-
value: void 0
|
|
27
|
-
}), Object.defineProperty(this, "docs", {
|
|
28
|
-
enumerable: !0,
|
|
29
|
-
configurable: !0,
|
|
30
|
-
writable: !0,
|
|
31
|
-
value: void 0
|
|
32
|
-
}), Object.defineProperty(this, "docsPath", {
|
|
33
|
-
enumerable: !0,
|
|
34
|
-
configurable: !0,
|
|
35
|
-
writable: !0,
|
|
36
|
-
value: void 0
|
|
37
|
-
}), Object.defineProperty(this, "shortMessage", {
|
|
38
|
-
enumerable: !0,
|
|
39
|
-
configurable: !0,
|
|
40
|
-
writable: !0,
|
|
41
|
-
value: void 0
|
|
42
|
-
}), Object.defineProperty(this, "cause", {
|
|
43
|
-
enumerable: !0,
|
|
44
|
-
configurable: !0,
|
|
45
|
-
writable: !0,
|
|
46
|
-
value: void 0
|
|
47
|
-
}), Object.defineProperty(this, "name", {
|
|
48
|
-
enumerable: !0,
|
|
49
|
-
configurable: !0,
|
|
50
|
-
writable: !0,
|
|
51
|
-
value: "BaseError"
|
|
52
|
-
}), Object.defineProperty(this, "version", {
|
|
53
|
-
enumerable: !0,
|
|
54
|
-
configurable: !0,
|
|
55
|
-
writable: !0,
|
|
56
|
-
value: `ox@${n()}`
|
|
57
|
-
}), this.cause = e.cause, this.details = a, this.docs = c, this.docsPath = u, this.shortMessage = r;
|
|
58
|
-
}
|
|
59
|
-
walk(r) {
|
|
60
|
-
return i(this, r);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function i(t, r) {
|
|
64
|
-
return r?.(t) ? t : t && typeof t == "object" && "cause" in t && t.cause ? i(t.cause, r) : r ? null : t;
|
|
1
|
+
const r = "#__bigint";
|
|
2
|
+
function g(i, f, n) {
|
|
3
|
+
return JSON.stringify(i, (e, t) => typeof t == "bigint" ? t.toString() + r : t, n);
|
|
65
4
|
}
|
|
66
5
|
export {
|
|
67
|
-
|
|
6
|
+
g as stringify
|
|
68
7
|
};
|
package/dist/esm/index290.js
CHANGED
|
@@ -1,7 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
function
|
|
3
|
-
|
|
1
|
+
import { SizeExceedsPaddingSizeError as s, size as i, SliceOffsetOutOfBoundsError as f, SizeOverflowError as p } from "./index277.js";
|
|
2
|
+
function c(t, e) {
|
|
3
|
+
if (i(t) > e)
|
|
4
|
+
throw new p({
|
|
5
|
+
givenSize: i(t),
|
|
6
|
+
maxSize: e
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
function S(t, e) {
|
|
10
|
+
if (typeof e == "number" && e > 0 && e > i(t) - 1)
|
|
11
|
+
throw new f({
|
|
12
|
+
offset: e,
|
|
13
|
+
position: "start",
|
|
14
|
+
size: i(t)
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function d(t, e, r) {
|
|
18
|
+
if (typeof e == "number" && typeof r == "number" && i(t) !== r - e)
|
|
19
|
+
throw new f({
|
|
20
|
+
offset: r,
|
|
21
|
+
position: "end",
|
|
22
|
+
size: i(t)
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function u(t, e = {}) {
|
|
26
|
+
const { dir: r, size: n = 32 } = e;
|
|
27
|
+
if (n === 0)
|
|
28
|
+
return t;
|
|
29
|
+
const o = t.replace("0x", "");
|
|
30
|
+
if (o.length > n * 2)
|
|
31
|
+
throw new s({
|
|
32
|
+
size: Math.ceil(o.length / 2),
|
|
33
|
+
targetSize: n,
|
|
34
|
+
type: "Hex"
|
|
35
|
+
});
|
|
36
|
+
return `0x${o[r === "right" ? "padEnd" : "padStart"](n * 2, "0")}`;
|
|
4
37
|
}
|
|
5
38
|
export {
|
|
6
|
-
|
|
39
|
+
d as assertEndOffset,
|
|
40
|
+
c as assertSize,
|
|
41
|
+
S as assertStartOffset,
|
|
42
|
+
u as pad
|
|
7
43
|
};
|
package/dist/esm/index291.js
CHANGED
|
@@ -1,43 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
function S(t, e) {
|
|
10
|
-
if (typeof e == "number" && e > 0 && e > i(t) - 1)
|
|
11
|
-
throw new f({
|
|
12
|
-
offset: e,
|
|
13
|
-
position: "start",
|
|
14
|
-
size: i(t)
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
function d(t, e, r) {
|
|
18
|
-
if (typeof e == "number" && typeof r == "number" && i(t) !== r - e)
|
|
19
|
-
throw new f({
|
|
20
|
-
offset: r,
|
|
21
|
-
position: "end",
|
|
22
|
-
size: i(t)
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
function u(t, e = {}) {
|
|
26
|
-
const { dir: r, size: n = 32 } = e;
|
|
27
|
-
if (n === 0)
|
|
28
|
-
return t;
|
|
29
|
-
const o = t.replace("0x", "");
|
|
30
|
-
if (o.length > n * 2)
|
|
31
|
-
throw new s({
|
|
32
|
-
size: Math.ceil(o.length / 2),
|
|
33
|
-
targetSize: n,
|
|
34
|
-
type: "Hex"
|
|
35
|
-
});
|
|
36
|
-
return `0x${o[r === "right" ? "padEnd" : "padStart"](n * 2, "0")}`;
|
|
1
|
+
import { keccak_256 as f } from "./index209.js";
|
|
2
|
+
import { from as m } from "./index297.js";
|
|
3
|
+
import { fromBytes as s } from "./index277.js";
|
|
4
|
+
function p(t, o = {}) {
|
|
5
|
+
const { as: e = typeof t == "string" ? "Hex" : "Bytes" } = o, r = f(m(t));
|
|
6
|
+
return e === "Bytes" ? r : s(r);
|
|
37
7
|
}
|
|
38
8
|
export {
|
|
39
|
-
|
|
40
|
-
c as assertSize,
|
|
41
|
-
S as assertStartOffset,
|
|
42
|
-
u as pad
|
|
9
|
+
p as keccak256
|
|
43
10
|
};
|
package/dist/esm/index292.js
CHANGED
|
@@ -1,10 +1,65 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { validate as c } from "./index293.js";
|
|
2
|
+
import { BaseError as f } from "./index288.js";
|
|
3
|
+
function y(r) {
|
|
4
|
+
let i = !0, t = "", e = 0, n = "", o = !1;
|
|
5
|
+
for (let s = 0; s < r.length; s++) {
|
|
6
|
+
const u = r[s];
|
|
7
|
+
if (["(", ")", ","].includes(u) && (i = !0), u === "(" && e++, u === ")" && e--, !!i) {
|
|
8
|
+
if (e === 0) {
|
|
9
|
+
if (u === " " && ["event", "function", "error", ""].includes(n))
|
|
10
|
+
n = "";
|
|
11
|
+
else if (n += u, u === ")") {
|
|
12
|
+
o = !0;
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
if (u === " ") {
|
|
18
|
+
r[s - 1] !== "," && t !== "," && t !== ",(" && (t = "", i = !1);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
n += u, t += u;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (!o)
|
|
25
|
+
throw new f("Unable to normalize signature.");
|
|
26
|
+
return n;
|
|
27
|
+
}
|
|
28
|
+
function l(r, i) {
|
|
29
|
+
const t = typeof r, e = i.type;
|
|
30
|
+
switch (e) {
|
|
31
|
+
case "address":
|
|
32
|
+
return c(r, { strict: !1 });
|
|
33
|
+
case "bool":
|
|
34
|
+
return t === "boolean";
|
|
35
|
+
case "function":
|
|
36
|
+
return t === "string";
|
|
37
|
+
case "string":
|
|
38
|
+
return t === "string";
|
|
39
|
+
default:
|
|
40
|
+
return e === "tuple" && "components" in i ? Object.values(i.components).every((n, o) => l(Object.values(r)[o], n)) : /^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)?$/.test(e) ? t === "number" || t === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(e) ? t === "string" || r instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(e) ? Array.isArray(r) && r.every((n) => l(n, {
|
|
41
|
+
...i,
|
|
42
|
+
// Pop off `[]` or `[M]` from end of type
|
|
43
|
+
type: e.replace(/(\[[0-9]{0,}\])$/, "")
|
|
44
|
+
})) : !1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function a(r, i, t) {
|
|
48
|
+
for (const e in r) {
|
|
49
|
+
const n = r[e], o = i[e];
|
|
50
|
+
if (n.type === "tuple" && o.type === "tuple" && "components" in n && "components" in o)
|
|
51
|
+
return a(n.components, o.components, t[e]);
|
|
52
|
+
const s = [n.type, o.type];
|
|
53
|
+
if (s.includes("address") && s.includes("bytes20") ? !0 : s.includes("address") && s.includes("string") ? c(t[e], {
|
|
54
|
+
strict: !1
|
|
55
|
+
}) : s.includes("address") && s.includes("bytes") ? c(t[e], {
|
|
56
|
+
strict: !1
|
|
57
|
+
}) : !1)
|
|
58
|
+
return s;
|
|
59
|
+
}
|
|
7
60
|
}
|
|
8
61
|
export {
|
|
9
|
-
|
|
62
|
+
a as getAmbiguousTypes,
|
|
63
|
+
l as isArgOfType,
|
|
64
|
+
y as normalizeSignature
|
|
10
65
|
};
|