@directcryptopay/sdk 0.1.0
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 +357 -0
- package/dist/ConstantsUtil-B-_-u8aQ.js +6 -0
- package/dist/add-KF4m4jFK.js +19 -0
- package/dist/all-wallets-D6NAjQgX.js +10 -0
- package/dist/app-store-D7TTn-EO.js +21 -0
- package/dist/apple-DjX2E2hE.js +22 -0
- package/dist/arrow-bottom-C0YrNJYB.js +12 -0
- package/dist/arrow-bottom-circle-Dlxvx_XG.js +15 -0
- package/dist/arrow-left-x8_-lUyK.js +12 -0
- package/dist/arrow-right-BTZybj80.js +12 -0
- package/dist/arrow-top-LzH7iLCp.js +12 -0
- package/dist/bank-23jp-IV_.js +18 -0
- package/dist/browser-EjoorDid.js +18 -0
- package/dist/card-DGgWwtwC.js +18 -0
- package/dist/ccip-BMANewTU.js +150 -0
- package/dist/checkmark-B1qcQhBo.js +15 -0
- package/dist/checkmark-bold-Cyc4IEEJ.js +12 -0
- package/dist/chevron-bottom-ClHs08rB.js +12 -0
- package/dist/chevron-left-O8h_551_.js +12 -0
- package/dist/chevron-right-DP3xpyIA.js +12 -0
- package/dist/chevron-top-CuwkBUs9.js +12 -0
- package/dist/chrome-store-zfT_aJ3R.js +65 -0
- package/dist/clock-DHZqivIS.js +12 -0
- package/dist/close-Cp9rNAw4.js +12 -0
- package/dist/coinPlaceholder-U7-T1KKQ.js +12 -0
- package/dist/compass-Ds5-PRSR.js +12 -0
- package/dist/copy-Jg4HdIMf.js +19 -0
- package/dist/core/api.d.ts +30 -0
- package/dist/core/config.d.ts +59 -0
- package/dist/core/logic.d.ts +2 -0
- package/dist/core/wallet.d.ts +34 -0
- package/dist/cursor-DmMevduB.js +7 -0
- package/dist/cursor-transparent-Dn9-1SV8.js +16 -0
- package/dist/dcp-sdk.umd.js +12000 -0
- package/dist/dcp.d.ts +10 -0
- package/dist/desktop-C4udXXlZ.js +13 -0
- package/dist/disconnect-wd1BYLxt.js +12 -0
- package/dist/discord-DthxuCAP.js +21 -0
- package/dist/email-B3jSnUFE.js +696 -0
- package/dist/embedded-wallet-CJHmoBI2.js +468 -0
- package/dist/etherscan-Cjp4xfMW.js +10 -0
- package/dist/exclamation-triangle-CRNR5WOy.js +8 -0
- package/dist/extension-Cydk0mZt.js +12 -0
- package/dist/external-link-CuPTAoq9.js +12 -0
- package/dist/facebook-CghqXmdf.js +30 -0
- package/dist/farcaster-BREqMX4y.js +16 -0
- package/dist/filters-Dn_Ys7ew.js +12 -0
- package/dist/github-C-A7JmIY.js +22 -0
- package/dist/google-CCdM_naE.js +22 -0
- package/dist/hashTypedData-D2Qmzscs.js +197 -0
- package/dist/help-circle-DIH4vyj3.js +16 -0
- package/dist/id-DkJ0gBuy.js +16 -0
- package/dist/if-defined-BciplFKz.js +744 -0
- package/dist/image-qMjyiXM0.js +8 -0
- package/dist/index--3Zp0jAb.js +45 -0
- package/dist/index-1adX-Fit.js +65 -0
- package/dist/index-AvC0IGDl.js +7864 -0
- package/dist/index-B2-vKLd8.js +276 -0
- package/dist/index-B2iDt0TJ.js +146 -0
- package/dist/index-B5zkXsLJ.js +320 -0
- package/dist/index-B7K86vWu.js +1742 -0
- package/dist/index-BBkcvSiY.js +511 -0
- package/dist/index-BdjxQs66.js +181 -0
- package/dist/index-Bijd4_Ns.js +294 -0
- package/dist/index-BpXOsxzU.js +387 -0
- package/dist/index-C1QEJL-2.js +572 -0
- package/dist/index-C27dwOyE.js +243 -0
- package/dist/index-C4BX3QW8.js +58 -0
- package/dist/index-CMPIqsB1.js +170 -0
- package/dist/index-CTYngdl0.js +21991 -0
- package/dist/index-CUdQyyFn.js +51 -0
- package/dist/index-CX60z_g2.js +573 -0
- package/dist/index-CppCc1n8.js +65 -0
- package/dist/index-CqVegmN4.js +559 -0
- package/dist/index-CuiyMA8F.js +78 -0
- package/dist/index-CwB_qRfM.js +305 -0
- package/dist/index-CxOF7GqE.js +265 -0
- package/dist/index-D-IzHD_8.js +54 -0
- package/dist/index-DRNiFv9I.js +218 -0
- package/dist/index-Da8oZh8H.js +838 -0
- package/dist/index-DiHImG4L.js +44236 -0
- package/dist/index-DmOMXRG1.js +181 -0
- package/dist/index-DoSYqTQg.js +199 -0
- package/dist/index-DpHXq5_E.js +603 -0
- package/dist/index-DtCsAVBg.js +78 -0
- package/dist/index-Ij6XA6_4.js +77 -0
- package/dist/index-SzyBYfzA.js +8490 -0
- package/dist/index-eW8y-mXH.js +257 -0
- package/dist/index-fxzIDZsb.js +75 -0
- package/dist/index-lbhz9evJ.js +97 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/info-DMIGgjkL.js +7 -0
- package/dist/info-circle-CJuIKZSx.js +16 -0
- package/dist/lightbulb-qFT6WEWV.js +7 -0
- package/dist/localBatchGatewayRequest-CsMVMFBc.js +91 -0
- package/dist/mail-DoYgQvOt.js +12 -0
- package/dist/mobile-URtsh7o-.js +13 -0
- package/dist/more-DoQd10TF.js +15 -0
- package/dist/network-placeholder-BBA2Ue6C.js +18 -0
- package/dist/nftPlaceholder-C9RXWz9k.js +12 -0
- package/dist/off-YcuDQczT.js +12 -0
- package/dist/onramp-BfqDIx4o.js +1279 -0
- package/dist/parseSignature-280HB24T.js +3560 -0
- package/dist/play-store-sFaloG_r.js +36 -0
- package/dist/plus-l0wekSht.js +17 -0
- package/dist/qr-code-CihrUU4G.js +10 -0
- package/dist/receive-dfY1Cu-g.js +186 -0
- package/dist/recycle-horizontal-nXu6YaPw.js +13 -0
- package/dist/ref-huAzXCX0.js +41 -0
- package/dist/refresh-D2ZbVeNC.js +12 -0
- package/dist/reown-logo-BMaTMJmc.js +16 -0
- package/dist/search-YVM9q3J-.js +12 -0
- package/dist/secp256k1-BrysY3Sv.js +1302 -0
- package/dist/secp256k1-DPQgTBwQ.js +1510 -0
- package/dist/send-BwQZPKxI.js +19 -0
- package/dist/send-GyetMVu1.js +1038 -0
- package/dist/socials-B0W91J9k.js +574 -0
- package/dist/swapHorizontal-Dy_oQEkp.js +12 -0
- package/dist/swapHorizontalBold-C4JpaMpc.js +12 -0
- package/dist/swapHorizontalMedium-D5NuVZFh.js +20 -0
- package/dist/swapHorizontalRoundedBold-Bq4P2MCj.js +12 -0
- package/dist/swapVertical-CVQ8Mg03.js +12 -0
- package/dist/swaps-CA04SSdK.js +1637 -0
- package/dist/telegram-BP4SgW_L.js +20 -0
- package/dist/three-dots-BJYGJ-dQ.js +9 -0
- package/dist/transactions-Bq-98Tsg.js +37 -0
- package/dist/twitch-DTATWo9M.js +22 -0
- package/dist/twitterIcon-D5UWPInb.js +10 -0
- package/dist/types.d.ts +128 -0
- package/dist/ui/Modal.d.ts +9 -0
- package/dist/ui/index.d.ts +6 -0
- package/dist/verify-Byvj8Wi1.js +12 -0
- package/dist/verify-filled-B40taNm0.js +12 -0
- package/dist/w3m-modal-HV6SE74G.js +1037 -0
- package/dist/wallet-Cp-6Kk88.js +12 -0
- package/dist/wallet-placeholder-C3juwA9o.js +18 -0
- package/dist/walletconnect-CRkIiLCx.js +36 -0
- package/dist/warning-circle-DtvCLwG4.js +16 -0
- package/dist/x-Cqyx5eCt.js +16 -0
- package/package.json +70 -0
|
@@ -0,0 +1,3560 @@
|
|
|
1
|
+
import { dT as yt, dU as _t, dV as Ut, I as _n, dW as gt, dX as wt, dY as vt, a as Un, dZ as Dn, d_ as X, d$ as B, e0 as V, e1 as Dt, e2 as Mn, e3 as Vn, e4 as G, e5 as re, e6 as L, e7 as ue, e8 as Mt, e9 as qn, ea as We, eb as _, ec as jn, ed as Gn, ee as Hn, ef as Wn, eg as _e, a1 as F, bl as Vt, M as xt, cZ as Zn, ci as Jn, cf as Pe, bZ as qt, bi as jt, eh as Ze, c0 as y, bk as q, ei as I, ej as Gt, ek as be, c4 as Je, c7 as H, bm as Ht, cM as Ye, bh as Ee, cq as fe, el as de, em as Ie, en as Ke, eo as Be, aJ as Wt, ep as Qe, bg as Zt, V as Jt, W as Yt, bT as le, eq as Yn, bR as ee, bM as te, bL as Pt, er as Kn, cm as Qn, aa as At, bE as Kt, b$ as he, bY as ce, bB as Qt, bA as Ne, es as Et, c2 as pe, et as Xt, eu as U, ev as It, ew as Xn, cr as en, cd as tn, ex as er, ey as tr, H as nr, bD as j, bq as Z, a0 as se, bF as Fe, c1 as rr, b_ as sr, da as ar, db as ir, T as or, ez as cr, $ as ur, a7 as Ce, w as Xe, ap as et, ax as fr, eA as dr, bI as lr, bJ as hr, eB as pr, eC as mr, eD as br, b7 as yr, cs as gr, c3 as ne, bs as wr, bu as vr, bt as xr, bw as Pr, b5 as Ar, br as tt, eE as Er, bp as nn, eF as Ir, bW as rn, eG as sn, eH as Br, eI as Nr, c6 as Cr, E as Tr, ad as $r, eJ as kr, az as zr, t as Rr, co as Sr, r as Fr, eK as Lr, eL as an, q as Bt, bj as Or, v as _r, a8 as Ur, bS as Dr, a9 as Mr, eM as oe, cc as Vr, eN as qr, eO as jr, eP as Gr, eQ as Hr, eR as Wr, eS as Zr, eT as Jr, eU as Yr, eV as Kr, eW as Qr, eX as Xr, eY as es, eZ as ts, e_ as ns, e$ as rs, f0 as ss, j as as } from "./index-DiHImG4L.js";
|
|
2
|
+
import { l as nt } from "./localBatchGatewayRequest-CsMVMFBc.js";
|
|
3
|
+
import { s as on } from "./secp256k1-BrysY3Sv.js";
|
|
4
|
+
import { h as cn, e as is } from "./hashTypedData-D2Qmzscs.js";
|
|
5
|
+
function Nt(e) {
|
|
6
|
+
let t;
|
|
7
|
+
if (typeof e == "string")
|
|
8
|
+
t = yt(e);
|
|
9
|
+
else {
|
|
10
|
+
const n = _t(e), r = e.length;
|
|
11
|
+
for (let s = 0; s < r; s++) {
|
|
12
|
+
const a = e[s];
|
|
13
|
+
if (!Ut(a)) {
|
|
14
|
+
t = yt(a, n);
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (!t)
|
|
20
|
+
throw new _n({ signature: e });
|
|
21
|
+
return t;
|
|
22
|
+
}
|
|
23
|
+
function Ct(e) {
|
|
24
|
+
const t = [];
|
|
25
|
+
if (typeof e == "string") {
|
|
26
|
+
const n = gt(e), r = n.length;
|
|
27
|
+
for (let s = 0; s < r; s++)
|
|
28
|
+
t.push(wt(n[s], { modifiers: vt }));
|
|
29
|
+
} else {
|
|
30
|
+
const n = _t(e), r = e.length;
|
|
31
|
+
for (let s = 0; s < r; s++) {
|
|
32
|
+
const a = e[s];
|
|
33
|
+
if (Ut(a))
|
|
34
|
+
continue;
|
|
35
|
+
const i = gt(a), o = i.length;
|
|
36
|
+
for (let c = 0; c < o; c++)
|
|
37
|
+
t.push(wt(i[c], { modifiers: vt, structs: n }));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (t.length === 0)
|
|
41
|
+
throw new Un({ params: e });
|
|
42
|
+
return t;
|
|
43
|
+
}
|
|
44
|
+
function ye(e, t) {
|
|
45
|
+
if (Y(e) > t)
|
|
46
|
+
throw new vs({
|
|
47
|
+
givenSize: Y(e),
|
|
48
|
+
maxSize: t
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const D = {
|
|
52
|
+
zero: 48,
|
|
53
|
+
nine: 57,
|
|
54
|
+
A: 65,
|
|
55
|
+
F: 70,
|
|
56
|
+
a: 97,
|
|
57
|
+
f: 102
|
|
58
|
+
};
|
|
59
|
+
function Tt(e) {
|
|
60
|
+
if (e >= D.zero && e <= D.nine)
|
|
61
|
+
return e - D.zero;
|
|
62
|
+
if (e >= D.A && e <= D.F)
|
|
63
|
+
return e - (D.A - 10);
|
|
64
|
+
if (e >= D.a && e <= D.f)
|
|
65
|
+
return e - (D.a - 10);
|
|
66
|
+
}
|
|
67
|
+
function os(e, t = {}) {
|
|
68
|
+
const { dir: n, size: r = 32 } = t;
|
|
69
|
+
if (r === 0)
|
|
70
|
+
return e;
|
|
71
|
+
if (e.length > r)
|
|
72
|
+
throw new xs({
|
|
73
|
+
size: e.length,
|
|
74
|
+
targetSize: r,
|
|
75
|
+
type: "Bytes"
|
|
76
|
+
});
|
|
77
|
+
const s = new Uint8Array(r);
|
|
78
|
+
for (let a = 0; a < r; a++) {
|
|
79
|
+
const i = n === "right";
|
|
80
|
+
s[i ? a : r - a - 1] = e[i ? a : e.length - a - 1];
|
|
81
|
+
}
|
|
82
|
+
return s;
|
|
83
|
+
}
|
|
84
|
+
function un(e, t = {}) {
|
|
85
|
+
const { dir: n = "left" } = t;
|
|
86
|
+
let r = e, s = 0;
|
|
87
|
+
for (let a = 0; a < r.length - 1 && r[n === "left" ? a : r.length - a - 1].toString() === "0"; a++)
|
|
88
|
+
s++;
|
|
89
|
+
return r = n === "left" ? r.slice(s) : r.slice(0, r.length - s), r;
|
|
90
|
+
}
|
|
91
|
+
const cs = /* @__PURE__ */ new TextDecoder(), us = /* @__PURE__ */ new TextEncoder();
|
|
92
|
+
function fs(e) {
|
|
93
|
+
return e instanceof Uint8Array ? e : typeof e == "string" ? fn(e) : ds(e);
|
|
94
|
+
}
|
|
95
|
+
function ds(e) {
|
|
96
|
+
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
97
|
+
}
|
|
98
|
+
function fn(e, t = {}) {
|
|
99
|
+
const { size: n } = t;
|
|
100
|
+
let r = e;
|
|
101
|
+
n && (Dn(e, n), r = X(e, n));
|
|
102
|
+
let s = r.slice(2);
|
|
103
|
+
s.length % 2 && (s = `0${s}`);
|
|
104
|
+
const a = s.length / 2, i = new Uint8Array(a);
|
|
105
|
+
for (let o = 0, c = 0; o < a; o++) {
|
|
106
|
+
const u = Tt(s.charCodeAt(c++)), f = Tt(s.charCodeAt(c++));
|
|
107
|
+
if (u === void 0 || f === void 0)
|
|
108
|
+
throw new B(`Invalid byte sequence ("${s[c - 2]}${s[c - 1]}" in "${s}").`);
|
|
109
|
+
i[o] = u * 16 + f;
|
|
110
|
+
}
|
|
111
|
+
return i;
|
|
112
|
+
}
|
|
113
|
+
function ls(e, t = {}) {
|
|
114
|
+
const { size: n } = t, r = us.encode(e);
|
|
115
|
+
return typeof n == "number" ? (ye(r, n), hs(r, n)) : r;
|
|
116
|
+
}
|
|
117
|
+
function hs(e, t) {
|
|
118
|
+
return os(e, { dir: "right", size: t });
|
|
119
|
+
}
|
|
120
|
+
function Y(e) {
|
|
121
|
+
return e.length;
|
|
122
|
+
}
|
|
123
|
+
function ps(e, t, n, r = {}) {
|
|
124
|
+
const { strict: s } = r;
|
|
125
|
+
return e.slice(t, n);
|
|
126
|
+
}
|
|
127
|
+
function ms(e, t = {}) {
|
|
128
|
+
const { size: n } = t;
|
|
129
|
+
typeof n < "u" && ye(e, n);
|
|
130
|
+
const r = V(e, t);
|
|
131
|
+
return Mn(r, t);
|
|
132
|
+
}
|
|
133
|
+
function bs(e, t = {}) {
|
|
134
|
+
const { size: n } = t;
|
|
135
|
+
let r = e;
|
|
136
|
+
if (typeof n < "u" && (ye(r, n), r = dn(r)), r.length > 1 || r[0] > 1)
|
|
137
|
+
throw new ws(r);
|
|
138
|
+
return !!r[0];
|
|
139
|
+
}
|
|
140
|
+
function M(e, t = {}) {
|
|
141
|
+
const { size: n } = t;
|
|
142
|
+
typeof n < "u" && ye(e, n);
|
|
143
|
+
const r = V(e, t);
|
|
144
|
+
return Dt(r, t);
|
|
145
|
+
}
|
|
146
|
+
function ys(e, t = {}) {
|
|
147
|
+
const { size: n } = t;
|
|
148
|
+
let r = e;
|
|
149
|
+
return typeof n < "u" && (ye(r, n), r = gs(r)), cs.decode(r);
|
|
150
|
+
}
|
|
151
|
+
function dn(e) {
|
|
152
|
+
return un(e, { dir: "left" });
|
|
153
|
+
}
|
|
154
|
+
function gs(e) {
|
|
155
|
+
return un(e, { dir: "right" });
|
|
156
|
+
}
|
|
157
|
+
class ws extends B {
|
|
158
|
+
constructor(t) {
|
|
159
|
+
super(`Bytes value \`${t}\` is not a valid boolean.`, {
|
|
160
|
+
metaMessages: [
|
|
161
|
+
"The bytes array must contain a single byte of either a `0` or `1` value."
|
|
162
|
+
]
|
|
163
|
+
}), Object.defineProperty(this, "name", {
|
|
164
|
+
enumerable: !0,
|
|
165
|
+
configurable: !0,
|
|
166
|
+
writable: !0,
|
|
167
|
+
value: "Bytes.InvalidBytesBooleanError"
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
class vs extends B {
|
|
172
|
+
constructor({ givenSize: t, maxSize: n }) {
|
|
173
|
+
super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`), Object.defineProperty(this, "name", {
|
|
174
|
+
enumerable: !0,
|
|
175
|
+
configurable: !0,
|
|
176
|
+
writable: !0,
|
|
177
|
+
value: "Bytes.SizeOverflowError"
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
class xs extends B {
|
|
182
|
+
constructor({ size: t, targetSize: n, type: r }) {
|
|
183
|
+
super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`), Object.defineProperty(this, "name", {
|
|
184
|
+
enumerable: !0,
|
|
185
|
+
configurable: !0,
|
|
186
|
+
writable: !0,
|
|
187
|
+
value: "Bytes.SizeExceedsPaddingSizeError"
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
class Ps extends Map {
|
|
192
|
+
constructor(t) {
|
|
193
|
+
super(), Object.defineProperty(this, "maxSize", {
|
|
194
|
+
enumerable: !0,
|
|
195
|
+
configurable: !0,
|
|
196
|
+
writable: !0,
|
|
197
|
+
value: void 0
|
|
198
|
+
}), this.maxSize = t;
|
|
199
|
+
}
|
|
200
|
+
get(t) {
|
|
201
|
+
const n = super.get(t);
|
|
202
|
+
return super.has(t) && n !== void 0 && (this.delete(t), super.set(t, n)), n;
|
|
203
|
+
}
|
|
204
|
+
set(t, n) {
|
|
205
|
+
if (super.set(t, n), this.maxSize && this.size > this.maxSize) {
|
|
206
|
+
const r = this.keys().next().value;
|
|
207
|
+
r && this.delete(r);
|
|
208
|
+
}
|
|
209
|
+
return this;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
const As = {
|
|
213
|
+
checksum: /* @__PURE__ */ new Ps(8192)
|
|
214
|
+
}, Le = As.checksum;
|
|
215
|
+
function ln(e, t = {}) {
|
|
216
|
+
const { as: n = typeof e == "string" ? "Hex" : "Bytes" } = t, r = Vn(fs(e));
|
|
217
|
+
return n === "Bytes" ? r : V(r);
|
|
218
|
+
}
|
|
219
|
+
const Es = /^0x[a-fA-F0-9]{40}$/;
|
|
220
|
+
function Te(e, t = {}) {
|
|
221
|
+
const { strict: n = !0 } = t;
|
|
222
|
+
if (!Es.test(e))
|
|
223
|
+
throw new $t({
|
|
224
|
+
address: e,
|
|
225
|
+
cause: new Is()
|
|
226
|
+
});
|
|
227
|
+
if (n) {
|
|
228
|
+
if (e.toLowerCase() === e)
|
|
229
|
+
return;
|
|
230
|
+
if (hn(e) !== e)
|
|
231
|
+
throw new $t({
|
|
232
|
+
address: e,
|
|
233
|
+
cause: new Bs()
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function hn(e) {
|
|
238
|
+
if (Le.has(e))
|
|
239
|
+
return Le.get(e);
|
|
240
|
+
Te(e, { strict: !1 });
|
|
241
|
+
const t = e.substring(2).toLowerCase(), n = ln(ls(t), { as: "Bytes" }), r = t.split("");
|
|
242
|
+
for (let a = 0; a < 40; a += 2)
|
|
243
|
+
n[a >> 1] >> 4 >= 8 && r[a] && (r[a] = r[a].toUpperCase()), (n[a >> 1] & 15) >= 8 && r[a + 1] && (r[a + 1] = r[a + 1].toUpperCase());
|
|
244
|
+
const s = `0x${r.join("")}`;
|
|
245
|
+
return Le.set(e, s), s;
|
|
246
|
+
}
|
|
247
|
+
function Ue(e, t = {}) {
|
|
248
|
+
const { strict: n = !0 } = t ?? {};
|
|
249
|
+
try {
|
|
250
|
+
return Te(e, { strict: n }), !0;
|
|
251
|
+
} catch {
|
|
252
|
+
return !1;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
class $t extends B {
|
|
256
|
+
constructor({ address: t, cause: n }) {
|
|
257
|
+
super(`Address "${t}" is invalid.`, {
|
|
258
|
+
cause: n
|
|
259
|
+
}), Object.defineProperty(this, "name", {
|
|
260
|
+
enumerable: !0,
|
|
261
|
+
configurable: !0,
|
|
262
|
+
writable: !0,
|
|
263
|
+
value: "Address.InvalidAddressError"
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
class Is extends B {
|
|
268
|
+
constructor() {
|
|
269
|
+
super("Address is not a 20 byte (40 hexadecimal character) value."), Object.defineProperty(this, "name", {
|
|
270
|
+
enumerable: !0,
|
|
271
|
+
configurable: !0,
|
|
272
|
+
writable: !0,
|
|
273
|
+
value: "Address.InvalidInputError"
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
class Bs extends B {
|
|
278
|
+
constructor() {
|
|
279
|
+
super("Address does not match its checksum counterpart."), Object.defineProperty(this, "name", {
|
|
280
|
+
enumerable: !0,
|
|
281
|
+
configurable: !0,
|
|
282
|
+
writable: !0,
|
|
283
|
+
value: "Address.InvalidChecksumError"
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
const Ns = /^(.*)\[([0-9]*)\]$/, Cs = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, pn = /^(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)?$/, kt = 2n ** 256n - 1n;
|
|
288
|
+
function Q(e, t, n) {
|
|
289
|
+
const { checksumAddress: r, staticPosition: s } = n, a = at(t.type);
|
|
290
|
+
if (a) {
|
|
291
|
+
const [i, o] = a;
|
|
292
|
+
return $s(e, { ...t, type: o }, { checksumAddress: r, length: i, staticPosition: s });
|
|
293
|
+
}
|
|
294
|
+
if (t.type === "tuple")
|
|
295
|
+
return Ss(e, t, {
|
|
296
|
+
checksumAddress: r,
|
|
297
|
+
staticPosition: s
|
|
298
|
+
});
|
|
299
|
+
if (t.type === "address")
|
|
300
|
+
return Ts(e, { checksum: r });
|
|
301
|
+
if (t.type === "bool")
|
|
302
|
+
return ks(e);
|
|
303
|
+
if (t.type.startsWith("bytes"))
|
|
304
|
+
return zs(e, t, { staticPosition: s });
|
|
305
|
+
if (t.type.startsWith("uint") || t.type.startsWith("int"))
|
|
306
|
+
return Rs(e, t);
|
|
307
|
+
if (t.type === "string")
|
|
308
|
+
return Fs(e, { staticPosition: s });
|
|
309
|
+
throw new ot(t.type);
|
|
310
|
+
}
|
|
311
|
+
const zt = 32, De = 32;
|
|
312
|
+
function Ts(e, t = {}) {
|
|
313
|
+
const { checksum: n = !1 } = t, r = e.readBytes(32);
|
|
314
|
+
return [((a) => n ? hn(a) : a)(V(ps(r, -20))), 32];
|
|
315
|
+
}
|
|
316
|
+
function $s(e, t, n) {
|
|
317
|
+
const { checksumAddress: r, length: s, staticPosition: a } = n;
|
|
318
|
+
if (!s) {
|
|
319
|
+
const c = M(e.readBytes(De)), u = a + c, f = u + zt;
|
|
320
|
+
e.setPosition(u);
|
|
321
|
+
const d = M(e.readBytes(zt)), l = me(t);
|
|
322
|
+
let h = 0;
|
|
323
|
+
const g = [];
|
|
324
|
+
for (let v = 0; v < d; ++v) {
|
|
325
|
+
e.setPosition(f + (l ? v * 32 : h));
|
|
326
|
+
const [p, m] = Q(e, t, {
|
|
327
|
+
checksumAddress: r,
|
|
328
|
+
staticPosition: f
|
|
329
|
+
});
|
|
330
|
+
h += m, g.push(p);
|
|
331
|
+
}
|
|
332
|
+
return e.setPosition(a + 32), [g, 32];
|
|
333
|
+
}
|
|
334
|
+
if (me(t)) {
|
|
335
|
+
const c = M(e.readBytes(De)), u = a + c, f = [];
|
|
336
|
+
for (let d = 0; d < s; ++d) {
|
|
337
|
+
e.setPosition(u + d * 32);
|
|
338
|
+
const [l] = Q(e, t, {
|
|
339
|
+
checksumAddress: r,
|
|
340
|
+
staticPosition: u
|
|
341
|
+
});
|
|
342
|
+
f.push(l);
|
|
343
|
+
}
|
|
344
|
+
return e.setPosition(a + 32), [f, 32];
|
|
345
|
+
}
|
|
346
|
+
let i = 0;
|
|
347
|
+
const o = [];
|
|
348
|
+
for (let c = 0; c < s; ++c) {
|
|
349
|
+
const [u, f] = Q(e, t, {
|
|
350
|
+
checksumAddress: r,
|
|
351
|
+
staticPosition: a + i
|
|
352
|
+
});
|
|
353
|
+
i += f, o.push(u);
|
|
354
|
+
}
|
|
355
|
+
return [o, i];
|
|
356
|
+
}
|
|
357
|
+
function ks(e) {
|
|
358
|
+
return [bs(e.readBytes(32), { size: 32 }), 32];
|
|
359
|
+
}
|
|
360
|
+
function zs(e, t, { staticPosition: n }) {
|
|
361
|
+
const [r, s] = t.type.split("bytes");
|
|
362
|
+
if (!s) {
|
|
363
|
+
const i = M(e.readBytes(32));
|
|
364
|
+
e.setPosition(n + i);
|
|
365
|
+
const o = M(e.readBytes(32));
|
|
366
|
+
if (o === 0)
|
|
367
|
+
return e.setPosition(n + 32), ["0x", 32];
|
|
368
|
+
const c = e.readBytes(o);
|
|
369
|
+
return e.setPosition(n + 32), [V(c), 32];
|
|
370
|
+
}
|
|
371
|
+
return [V(e.readBytes(Number.parseInt(s, 10), 32)), 32];
|
|
372
|
+
}
|
|
373
|
+
function Rs(e, t) {
|
|
374
|
+
const n = t.type.startsWith("int"), r = Number.parseInt(t.type.split("int")[1] || "256", 10), s = e.readBytes(32);
|
|
375
|
+
return [
|
|
376
|
+
r > 48 ? ms(s, { signed: n }) : M(s, { signed: n }),
|
|
377
|
+
32
|
|
378
|
+
];
|
|
379
|
+
}
|
|
380
|
+
function Ss(e, t, n) {
|
|
381
|
+
const { checksumAddress: r, staticPosition: s } = n, a = t.components.length === 0 || t.components.some(({ name: c }) => !c), i = a ? [] : {};
|
|
382
|
+
let o = 0;
|
|
383
|
+
if (me(t)) {
|
|
384
|
+
const c = M(e.readBytes(De)), u = s + c;
|
|
385
|
+
for (let f = 0; f < t.components.length; ++f) {
|
|
386
|
+
const d = t.components[f];
|
|
387
|
+
e.setPosition(u + o);
|
|
388
|
+
const [l, h] = Q(e, d, {
|
|
389
|
+
checksumAddress: r,
|
|
390
|
+
staticPosition: u
|
|
391
|
+
});
|
|
392
|
+
o += h, i[a ? f : d == null ? void 0 : d.name] = l;
|
|
393
|
+
}
|
|
394
|
+
return e.setPosition(s + 32), [i, 32];
|
|
395
|
+
}
|
|
396
|
+
for (let c = 0; c < t.components.length; ++c) {
|
|
397
|
+
const u = t.components[c], [f, d] = Q(e, u, {
|
|
398
|
+
checksumAddress: r,
|
|
399
|
+
staticPosition: s
|
|
400
|
+
});
|
|
401
|
+
i[a ? c : u == null ? void 0 : u.name] = f, o += d;
|
|
402
|
+
}
|
|
403
|
+
return [i, o];
|
|
404
|
+
}
|
|
405
|
+
function Fs(e, { staticPosition: t }) {
|
|
406
|
+
const n = M(e.readBytes(32)), r = t + n;
|
|
407
|
+
e.setPosition(r);
|
|
408
|
+
const s = M(e.readBytes(32));
|
|
409
|
+
if (s === 0)
|
|
410
|
+
return e.setPosition(t + 32), ["", 32];
|
|
411
|
+
const a = e.readBytes(s, 32), i = ys(dn(a));
|
|
412
|
+
return e.setPosition(t + 32), [i, 32];
|
|
413
|
+
}
|
|
414
|
+
function Ls({ checksumAddress: e, parameters: t, values: n }) {
|
|
415
|
+
const r = [];
|
|
416
|
+
for (let s = 0; s < t.length; s++)
|
|
417
|
+
r.push(rt({
|
|
418
|
+
checksumAddress: e,
|
|
419
|
+
parameter: t[s],
|
|
420
|
+
value: n[s]
|
|
421
|
+
}));
|
|
422
|
+
return r;
|
|
423
|
+
}
|
|
424
|
+
function rt({ checksumAddress: e = !1, parameter: t, value: n }) {
|
|
425
|
+
const r = t, s = at(r.type);
|
|
426
|
+
if (s) {
|
|
427
|
+
const [a, i] = s;
|
|
428
|
+
return _s(n, {
|
|
429
|
+
checksumAddress: e,
|
|
430
|
+
length: a,
|
|
431
|
+
parameter: {
|
|
432
|
+
...r,
|
|
433
|
+
type: i
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
if (r.type === "tuple")
|
|
438
|
+
return qs(n, {
|
|
439
|
+
checksumAddress: e,
|
|
440
|
+
parameter: r
|
|
441
|
+
});
|
|
442
|
+
if (r.type === "address")
|
|
443
|
+
return Os(n, {
|
|
444
|
+
checksum: e
|
|
445
|
+
});
|
|
446
|
+
if (r.type === "bool")
|
|
447
|
+
return Ds(n);
|
|
448
|
+
if (r.type.startsWith("uint") || r.type.startsWith("int")) {
|
|
449
|
+
const a = r.type.startsWith("int"), [, , i = "256"] = pn.exec(r.type) ?? [];
|
|
450
|
+
return Ms(n, {
|
|
451
|
+
signed: a,
|
|
452
|
+
size: Number(i)
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
if (r.type.startsWith("bytes"))
|
|
456
|
+
return Us(n, { type: r.type });
|
|
457
|
+
if (r.type === "string")
|
|
458
|
+
return Vs(n);
|
|
459
|
+
throw new ot(r.type);
|
|
460
|
+
}
|
|
461
|
+
function st(e) {
|
|
462
|
+
let t = 0;
|
|
463
|
+
for (let a = 0; a < e.length; a++) {
|
|
464
|
+
const { dynamic: i, encoded: o } = e[a];
|
|
465
|
+
i ? t += 32 : t += G(o);
|
|
466
|
+
}
|
|
467
|
+
const n = [], r = [];
|
|
468
|
+
let s = 0;
|
|
469
|
+
for (let a = 0; a < e.length; a++) {
|
|
470
|
+
const { dynamic: i, encoded: o } = e[a];
|
|
471
|
+
i ? (n.push(re(t + s, { size: 32 })), r.push(o), s += G(o)) : n.push(o);
|
|
472
|
+
}
|
|
473
|
+
return L(...n, ...r);
|
|
474
|
+
}
|
|
475
|
+
function Os(e, t) {
|
|
476
|
+
const { checksum: n = !1 } = t;
|
|
477
|
+
return Te(e, { strict: n }), {
|
|
478
|
+
dynamic: !1,
|
|
479
|
+
encoded: ue(e.toLowerCase())
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
function _s(e, t) {
|
|
483
|
+
const { checksumAddress: n, length: r, parameter: s } = t, a = r === null;
|
|
484
|
+
if (!Array.isArray(e))
|
|
485
|
+
throw new Qs(e);
|
|
486
|
+
if (!a && e.length !== r)
|
|
487
|
+
throw new Ks({
|
|
488
|
+
expectedLength: r,
|
|
489
|
+
givenLength: e.length,
|
|
490
|
+
type: `${s.type}[${r}]`
|
|
491
|
+
});
|
|
492
|
+
let i = !1;
|
|
493
|
+
const o = [];
|
|
494
|
+
for (let c = 0; c < e.length; c++) {
|
|
495
|
+
const u = rt({
|
|
496
|
+
checksumAddress: n,
|
|
497
|
+
parameter: s,
|
|
498
|
+
value: e[c]
|
|
499
|
+
});
|
|
500
|
+
u.dynamic && (i = !0), o.push(u);
|
|
501
|
+
}
|
|
502
|
+
if (a || i) {
|
|
503
|
+
const c = st(o);
|
|
504
|
+
if (a) {
|
|
505
|
+
const u = re(o.length, { size: 32 });
|
|
506
|
+
return {
|
|
507
|
+
dynamic: !0,
|
|
508
|
+
encoded: o.length > 0 ? L(u, c) : u
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
if (i)
|
|
512
|
+
return { dynamic: !0, encoded: c };
|
|
513
|
+
}
|
|
514
|
+
return {
|
|
515
|
+
dynamic: !1,
|
|
516
|
+
encoded: L(...o.map(({ encoded: c }) => c))
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
function Us(e, { type: t }) {
|
|
520
|
+
const [, n] = t.split("bytes"), r = G(e);
|
|
521
|
+
if (!n) {
|
|
522
|
+
let s = e;
|
|
523
|
+
return r % 32 !== 0 && (s = X(s, Math.ceil((e.length - 2) / 2 / 32) * 32)), {
|
|
524
|
+
dynamic: !0,
|
|
525
|
+
encoded: L(ue(re(r, { size: 32 })), s)
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
if (r !== Number.parseInt(n, 10))
|
|
529
|
+
throw new bn({
|
|
530
|
+
expectedSize: Number.parseInt(n, 10),
|
|
531
|
+
value: e
|
|
532
|
+
});
|
|
533
|
+
return { dynamic: !1, encoded: X(e) };
|
|
534
|
+
}
|
|
535
|
+
function Ds(e) {
|
|
536
|
+
if (typeof e != "boolean")
|
|
537
|
+
throw new B(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);
|
|
538
|
+
return { dynamic: !1, encoded: ue(Mt(e)) };
|
|
539
|
+
}
|
|
540
|
+
function Ms(e, { signed: t, size: n }) {
|
|
541
|
+
if (typeof n == "number") {
|
|
542
|
+
const r = 2n ** (BigInt(n) - (t ? 1n : 0n)) - 1n, s = t ? -r - 1n : 0n;
|
|
543
|
+
if (e > r || e < s)
|
|
544
|
+
throw new qn({
|
|
545
|
+
max: r.toString(),
|
|
546
|
+
min: s.toString(),
|
|
547
|
+
signed: t,
|
|
548
|
+
size: n / 8,
|
|
549
|
+
value: e.toString()
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
return {
|
|
553
|
+
dynamic: !1,
|
|
554
|
+
encoded: re(e, {
|
|
555
|
+
size: 32,
|
|
556
|
+
signed: t
|
|
557
|
+
})
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
function Vs(e) {
|
|
561
|
+
const t = We(e), n = Math.ceil(G(t) / 32), r = [];
|
|
562
|
+
for (let s = 0; s < n; s++)
|
|
563
|
+
r.push(X(_(t, s * 32, (s + 1) * 32)));
|
|
564
|
+
return {
|
|
565
|
+
dynamic: !0,
|
|
566
|
+
encoded: L(X(re(G(t), { size: 32 })), ...r)
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
function qs(e, t) {
|
|
570
|
+
const { checksumAddress: n, parameter: r } = t;
|
|
571
|
+
let s = !1;
|
|
572
|
+
const a = [];
|
|
573
|
+
for (let i = 0; i < r.components.length; i++) {
|
|
574
|
+
const o = r.components[i], c = Array.isArray(e) ? i : o.name, u = rt({
|
|
575
|
+
checksumAddress: n,
|
|
576
|
+
parameter: o,
|
|
577
|
+
value: e[c]
|
|
578
|
+
});
|
|
579
|
+
a.push(u), u.dynamic && (s = !0);
|
|
580
|
+
}
|
|
581
|
+
return {
|
|
582
|
+
dynamic: s,
|
|
583
|
+
encoded: s ? st(a) : L(...a.map(({ encoded: i }) => i))
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
function at(e) {
|
|
587
|
+
const t = e.match(/^(.*)\[(\d+)?\]$/);
|
|
588
|
+
return t ? (
|
|
589
|
+
// Return `null` if the array is dynamic.
|
|
590
|
+
[t[2] ? Number(t[2]) : null, t[1]]
|
|
591
|
+
) : void 0;
|
|
592
|
+
}
|
|
593
|
+
function me(e) {
|
|
594
|
+
var r;
|
|
595
|
+
const { type: t } = e;
|
|
596
|
+
if (t === "string" || t === "bytes" || t.endsWith("[]"))
|
|
597
|
+
return !0;
|
|
598
|
+
if (t === "tuple")
|
|
599
|
+
return (r = e.components) == null ? void 0 : r.some(me);
|
|
600
|
+
const n = at(e.type);
|
|
601
|
+
return !!(n && me({
|
|
602
|
+
...e,
|
|
603
|
+
type: n[1]
|
|
604
|
+
}));
|
|
605
|
+
}
|
|
606
|
+
const js = {
|
|
607
|
+
bytes: new Uint8Array(),
|
|
608
|
+
dataView: new DataView(new ArrayBuffer(0)),
|
|
609
|
+
position: 0,
|
|
610
|
+
positionReadCount: /* @__PURE__ */ new Map(),
|
|
611
|
+
recursiveReadCount: 0,
|
|
612
|
+
recursiveReadLimit: Number.POSITIVE_INFINITY,
|
|
613
|
+
assertReadLimit() {
|
|
614
|
+
if (this.recursiveReadCount >= this.recursiveReadLimit)
|
|
615
|
+
throw new Ws({
|
|
616
|
+
count: this.recursiveReadCount + 1,
|
|
617
|
+
limit: this.recursiveReadLimit
|
|
618
|
+
});
|
|
619
|
+
},
|
|
620
|
+
assertPosition(e) {
|
|
621
|
+
if (e < 0 || e > this.bytes.length - 1)
|
|
622
|
+
throw new Hs({
|
|
623
|
+
length: this.bytes.length,
|
|
624
|
+
position: e
|
|
625
|
+
});
|
|
626
|
+
},
|
|
627
|
+
decrementPosition(e) {
|
|
628
|
+
if (e < 0)
|
|
629
|
+
throw new Rt({ offset: e });
|
|
630
|
+
const t = this.position - e;
|
|
631
|
+
this.assertPosition(t), this.position = t;
|
|
632
|
+
},
|
|
633
|
+
getReadCount(e) {
|
|
634
|
+
return this.positionReadCount.get(e || this.position) || 0;
|
|
635
|
+
},
|
|
636
|
+
incrementPosition(e) {
|
|
637
|
+
if (e < 0)
|
|
638
|
+
throw new Rt({ offset: e });
|
|
639
|
+
const t = this.position + e;
|
|
640
|
+
this.assertPosition(t), this.position = t;
|
|
641
|
+
},
|
|
642
|
+
inspectByte(e) {
|
|
643
|
+
const t = e ?? this.position;
|
|
644
|
+
return this.assertPosition(t), this.bytes[t];
|
|
645
|
+
},
|
|
646
|
+
inspectBytes(e, t) {
|
|
647
|
+
const n = t ?? this.position;
|
|
648
|
+
return this.assertPosition(n + e - 1), this.bytes.subarray(n, n + e);
|
|
649
|
+
},
|
|
650
|
+
inspectUint8(e) {
|
|
651
|
+
const t = e ?? this.position;
|
|
652
|
+
return this.assertPosition(t), this.bytes[t];
|
|
653
|
+
},
|
|
654
|
+
inspectUint16(e) {
|
|
655
|
+
const t = e ?? this.position;
|
|
656
|
+
return this.assertPosition(t + 1), this.dataView.getUint16(t);
|
|
657
|
+
},
|
|
658
|
+
inspectUint24(e) {
|
|
659
|
+
const t = e ?? this.position;
|
|
660
|
+
return this.assertPosition(t + 2), (this.dataView.getUint16(t) << 8) + this.dataView.getUint8(t + 2);
|
|
661
|
+
},
|
|
662
|
+
inspectUint32(e) {
|
|
663
|
+
const t = e ?? this.position;
|
|
664
|
+
return this.assertPosition(t + 3), this.dataView.getUint32(t);
|
|
665
|
+
},
|
|
666
|
+
pushByte(e) {
|
|
667
|
+
this.assertPosition(this.position), this.bytes[this.position] = e, this.position++;
|
|
668
|
+
},
|
|
669
|
+
pushBytes(e) {
|
|
670
|
+
this.assertPosition(this.position + e.length - 1), this.bytes.set(e, this.position), this.position += e.length;
|
|
671
|
+
},
|
|
672
|
+
pushUint8(e) {
|
|
673
|
+
this.assertPosition(this.position), this.bytes[this.position] = e, this.position++;
|
|
674
|
+
},
|
|
675
|
+
pushUint16(e) {
|
|
676
|
+
this.assertPosition(this.position + 1), this.dataView.setUint16(this.position, e), this.position += 2;
|
|
677
|
+
},
|
|
678
|
+
pushUint24(e) {
|
|
679
|
+
this.assertPosition(this.position + 2), this.dataView.setUint16(this.position, e >> 8), this.dataView.setUint8(this.position + 2, e & 255), this.position += 3;
|
|
680
|
+
},
|
|
681
|
+
pushUint32(e) {
|
|
682
|
+
this.assertPosition(this.position + 3), this.dataView.setUint32(this.position, e), this.position += 4;
|
|
683
|
+
},
|
|
684
|
+
readByte() {
|
|
685
|
+
this.assertReadLimit(), this._touch();
|
|
686
|
+
const e = this.inspectByte();
|
|
687
|
+
return this.position++, e;
|
|
688
|
+
},
|
|
689
|
+
readBytes(e, t) {
|
|
690
|
+
this.assertReadLimit(), this._touch();
|
|
691
|
+
const n = this.inspectBytes(e);
|
|
692
|
+
return this.position += t ?? e, n;
|
|
693
|
+
},
|
|
694
|
+
readUint8() {
|
|
695
|
+
this.assertReadLimit(), this._touch();
|
|
696
|
+
const e = this.inspectUint8();
|
|
697
|
+
return this.position += 1, e;
|
|
698
|
+
},
|
|
699
|
+
readUint16() {
|
|
700
|
+
this.assertReadLimit(), this._touch();
|
|
701
|
+
const e = this.inspectUint16();
|
|
702
|
+
return this.position += 2, e;
|
|
703
|
+
},
|
|
704
|
+
readUint24() {
|
|
705
|
+
this.assertReadLimit(), this._touch();
|
|
706
|
+
const e = this.inspectUint24();
|
|
707
|
+
return this.position += 3, e;
|
|
708
|
+
},
|
|
709
|
+
readUint32() {
|
|
710
|
+
this.assertReadLimit(), this._touch();
|
|
711
|
+
const e = this.inspectUint32();
|
|
712
|
+
return this.position += 4, e;
|
|
713
|
+
},
|
|
714
|
+
get remaining() {
|
|
715
|
+
return this.bytes.length - this.position;
|
|
716
|
+
},
|
|
717
|
+
setPosition(e) {
|
|
718
|
+
const t = this.position;
|
|
719
|
+
return this.assertPosition(e), this.position = e, () => this.position = t;
|
|
720
|
+
},
|
|
721
|
+
_touch() {
|
|
722
|
+
if (this.recursiveReadLimit === Number.POSITIVE_INFINITY)
|
|
723
|
+
return;
|
|
724
|
+
const e = this.getReadCount();
|
|
725
|
+
this.positionReadCount.set(this.position, e + 1), e > 0 && this.recursiveReadCount++;
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
function Gs(e, { recursiveReadLimit: t = 8192 } = {}) {
|
|
729
|
+
const n = Object.create(js);
|
|
730
|
+
return n.bytes = e, n.dataView = new DataView(e.buffer, e.byteOffset, e.byteLength), n.positionReadCount = /* @__PURE__ */ new Map(), n.recursiveReadLimit = t, n;
|
|
731
|
+
}
|
|
732
|
+
class Rt extends B {
|
|
733
|
+
constructor({ offset: t }) {
|
|
734
|
+
super(`Offset \`${t}\` cannot be negative.`), Object.defineProperty(this, "name", {
|
|
735
|
+
enumerable: !0,
|
|
736
|
+
configurable: !0,
|
|
737
|
+
writable: !0,
|
|
738
|
+
value: "Cursor.NegativeOffsetError"
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
class Hs extends B {
|
|
743
|
+
constructor({ length: t, position: n }) {
|
|
744
|
+
super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`), Object.defineProperty(this, "name", {
|
|
745
|
+
enumerable: !0,
|
|
746
|
+
configurable: !0,
|
|
747
|
+
writable: !0,
|
|
748
|
+
value: "Cursor.PositionOutOfBoundsError"
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
class Ws extends B {
|
|
753
|
+
constructor({ count: t, limit: n }) {
|
|
754
|
+
super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`), Object.defineProperty(this, "name", {
|
|
755
|
+
enumerable: !0,
|
|
756
|
+
configurable: !0,
|
|
757
|
+
writable: !0,
|
|
758
|
+
value: "Cursor.RecursiveReadLimitExceededError"
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
function Zs(e, t, n = {}) {
|
|
763
|
+
const { as: r = "Array", checksumAddress: s = !1 } = n, a = typeof t == "string" ? fn(t) : t, i = Gs(a);
|
|
764
|
+
if (Y(a) === 0 && e.length > 0)
|
|
765
|
+
throw new Ys();
|
|
766
|
+
if (Y(a) && Y(a) < 32)
|
|
767
|
+
throw new Js({
|
|
768
|
+
data: typeof t == "string" ? t : V(t),
|
|
769
|
+
parameters: e,
|
|
770
|
+
size: Y(a)
|
|
771
|
+
});
|
|
772
|
+
let o = 0;
|
|
773
|
+
const c = r === "Array" ? [] : {};
|
|
774
|
+
for (let u = 0; u < e.length; ++u) {
|
|
775
|
+
const f = e[u];
|
|
776
|
+
i.setPosition(o);
|
|
777
|
+
const [d, l] = Q(i, f, {
|
|
778
|
+
checksumAddress: s,
|
|
779
|
+
staticPosition: 0
|
|
780
|
+
});
|
|
781
|
+
o += l, r === "Array" ? c.push(d) : c[f.name ?? u] = d;
|
|
782
|
+
}
|
|
783
|
+
return c;
|
|
784
|
+
}
|
|
785
|
+
function it(e, t, n) {
|
|
786
|
+
const { checksumAddress: r = !1 } = {};
|
|
787
|
+
if (e.length !== t.length)
|
|
788
|
+
throw new yn({
|
|
789
|
+
expectedLength: e.length,
|
|
790
|
+
givenLength: t.length
|
|
791
|
+
});
|
|
792
|
+
const s = Ls({
|
|
793
|
+
checksumAddress: r,
|
|
794
|
+
parameters: e,
|
|
795
|
+
values: t
|
|
796
|
+
}), a = st(s);
|
|
797
|
+
return a.length === 0 ? "0x" : a;
|
|
798
|
+
}
|
|
799
|
+
function Me(e, t) {
|
|
800
|
+
if (e.length !== t.length)
|
|
801
|
+
throw new yn({
|
|
802
|
+
expectedLength: e.length,
|
|
803
|
+
givenLength: t.length
|
|
804
|
+
});
|
|
805
|
+
const n = [];
|
|
806
|
+
for (let r = 0; r < e.length; r++) {
|
|
807
|
+
const s = e[r], a = t[r];
|
|
808
|
+
n.push(Me.encode(s, a));
|
|
809
|
+
}
|
|
810
|
+
return L(...n);
|
|
811
|
+
}
|
|
812
|
+
(function(e) {
|
|
813
|
+
function t(n, r, s = !1) {
|
|
814
|
+
if (n === "address") {
|
|
815
|
+
const c = r;
|
|
816
|
+
return Te(c), ue(c.toLowerCase(), s ? 32 : 0);
|
|
817
|
+
}
|
|
818
|
+
if (n === "string")
|
|
819
|
+
return We(r);
|
|
820
|
+
if (n === "bytes")
|
|
821
|
+
return r;
|
|
822
|
+
if (n === "bool")
|
|
823
|
+
return ue(Mt(r), s ? 32 : 1);
|
|
824
|
+
const a = n.match(pn);
|
|
825
|
+
if (a) {
|
|
826
|
+
const [c, u, f = "256"] = a, d = Number.parseInt(f, 10) / 8;
|
|
827
|
+
return re(r, {
|
|
828
|
+
size: s ? 32 : d,
|
|
829
|
+
signed: u === "int"
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
const i = n.match(Cs);
|
|
833
|
+
if (i) {
|
|
834
|
+
const [c, u] = i;
|
|
835
|
+
if (Number.parseInt(u, 10) !== (r.length - 2) / 2)
|
|
836
|
+
throw new bn({
|
|
837
|
+
expectedSize: Number.parseInt(u, 10),
|
|
838
|
+
value: r
|
|
839
|
+
});
|
|
840
|
+
return X(r, s ? 32 : 0);
|
|
841
|
+
}
|
|
842
|
+
const o = n.match(Ns);
|
|
843
|
+
if (o && Array.isArray(r)) {
|
|
844
|
+
const [c, u] = o, f = [];
|
|
845
|
+
for (let d = 0; d < r.length; d++)
|
|
846
|
+
f.push(t(u, r[d], !0));
|
|
847
|
+
return f.length === 0 ? "0x" : L(...f);
|
|
848
|
+
}
|
|
849
|
+
throw new ot(n);
|
|
850
|
+
}
|
|
851
|
+
e.encode = t;
|
|
852
|
+
})(Me || (Me = {}));
|
|
853
|
+
function mn(e) {
|
|
854
|
+
return Array.isArray(e) && typeof e[0] == "string" || typeof e == "string" ? Ct(e) : e;
|
|
855
|
+
}
|
|
856
|
+
class Js extends B {
|
|
857
|
+
constructor({ data: t, parameters: n, size: r }) {
|
|
858
|
+
super(`Data size of ${r} bytes is too small for given parameters.`, {
|
|
859
|
+
metaMessages: [
|
|
860
|
+
`Params: (${jn(n)})`,
|
|
861
|
+
`Data: ${t} (${r} bytes)`
|
|
862
|
+
]
|
|
863
|
+
}), Object.defineProperty(this, "name", {
|
|
864
|
+
enumerable: !0,
|
|
865
|
+
configurable: !0,
|
|
866
|
+
writable: !0,
|
|
867
|
+
value: "AbiParameters.DataSizeTooSmallError"
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
class Ys extends B {
|
|
872
|
+
constructor() {
|
|
873
|
+
super('Cannot decode zero data ("0x") with ABI parameters.'), Object.defineProperty(this, "name", {
|
|
874
|
+
enumerable: !0,
|
|
875
|
+
configurable: !0,
|
|
876
|
+
writable: !0,
|
|
877
|
+
value: "AbiParameters.ZeroDataError"
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
class Ks extends B {
|
|
882
|
+
constructor({ expectedLength: t, givenLength: n, type: r }) {
|
|
883
|
+
super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`), Object.defineProperty(this, "name", {
|
|
884
|
+
enumerable: !0,
|
|
885
|
+
configurable: !0,
|
|
886
|
+
writable: !0,
|
|
887
|
+
value: "AbiParameters.ArrayLengthMismatchError"
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
class bn extends B {
|
|
892
|
+
constructor({ expectedSize: t, value: n }) {
|
|
893
|
+
super(`Size of bytes "${n}" (bytes${G(n)}) does not match expected size (bytes${t}).`), Object.defineProperty(this, "name", {
|
|
894
|
+
enumerable: !0,
|
|
895
|
+
configurable: !0,
|
|
896
|
+
writable: !0,
|
|
897
|
+
value: "AbiParameters.BytesSizeMismatchError"
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
class yn extends B {
|
|
902
|
+
constructor({ expectedLength: t, givenLength: n }) {
|
|
903
|
+
super([
|
|
904
|
+
"ABI encoding parameters/values length mismatch.",
|
|
905
|
+
`Expected length (parameters): ${t}`,
|
|
906
|
+
`Given length (values): ${n}`
|
|
907
|
+
].join(`
|
|
908
|
+
`)), Object.defineProperty(this, "name", {
|
|
909
|
+
enumerable: !0,
|
|
910
|
+
configurable: !0,
|
|
911
|
+
writable: !0,
|
|
912
|
+
value: "AbiParameters.LengthMismatchError"
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
class Qs extends B {
|
|
917
|
+
constructor(t) {
|
|
918
|
+
super(`Value \`${t}\` is not a valid array.`), Object.defineProperty(this, "name", {
|
|
919
|
+
enumerable: !0,
|
|
920
|
+
configurable: !0,
|
|
921
|
+
writable: !0,
|
|
922
|
+
value: "AbiParameters.InvalidArrayError"
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
class ot extends B {
|
|
927
|
+
constructor(t) {
|
|
928
|
+
super(`Type \`${t}\` is not a valid ABI Type.`), Object.defineProperty(this, "name", {
|
|
929
|
+
enumerable: !0,
|
|
930
|
+
configurable: !0,
|
|
931
|
+
writable: !0,
|
|
932
|
+
value: "AbiParameters.InvalidTypeError"
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
function gn(e, t = {}) {
|
|
937
|
+
const { recovered: n } = t;
|
|
938
|
+
if (typeof e.r > "u")
|
|
939
|
+
throw new Oe({ signature: e });
|
|
940
|
+
if (typeof e.s > "u")
|
|
941
|
+
throw new Oe({ signature: e });
|
|
942
|
+
if (n && typeof e.yParity > "u")
|
|
943
|
+
throw new Oe({ signature: e });
|
|
944
|
+
if (e.r < 0n || e.r > kt)
|
|
945
|
+
throw new aa({ value: e.r });
|
|
946
|
+
if (e.s < 0n || e.s > kt)
|
|
947
|
+
throw new ia({ value: e.s });
|
|
948
|
+
if (typeof e.yParity == "number" && e.yParity !== 0 && e.yParity !== 1)
|
|
949
|
+
throw new ut({ value: e.yParity });
|
|
950
|
+
}
|
|
951
|
+
function Xs(e) {
|
|
952
|
+
return wn(V(e));
|
|
953
|
+
}
|
|
954
|
+
function wn(e) {
|
|
955
|
+
if (e.length !== 130 && e.length !== 132)
|
|
956
|
+
throw new sa({ signature: e });
|
|
957
|
+
const t = BigInt(_(e, 0, 32)), n = BigInt(_(e, 32, 64)), r = (() => {
|
|
958
|
+
const s = +`0x${e.slice(130)}`;
|
|
959
|
+
if (!Number.isNaN(s))
|
|
960
|
+
try {
|
|
961
|
+
return ct(s);
|
|
962
|
+
} catch {
|
|
963
|
+
throw new ut({ value: s });
|
|
964
|
+
}
|
|
965
|
+
})();
|
|
966
|
+
return typeof r > "u" ? {
|
|
967
|
+
r: t,
|
|
968
|
+
s: n
|
|
969
|
+
} : {
|
|
970
|
+
r: t,
|
|
971
|
+
s: n,
|
|
972
|
+
yParity: r
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
function ea(e) {
|
|
976
|
+
if (!(typeof e.r > "u") && !(typeof e.s > "u"))
|
|
977
|
+
return ta(e);
|
|
978
|
+
}
|
|
979
|
+
function ta(e) {
|
|
980
|
+
const t = typeof e == "string" ? wn(e) : e instanceof Uint8Array ? Xs(e) : typeof e.r == "string" ? ra(e) : e.v ? na(e) : {
|
|
981
|
+
r: e.r,
|
|
982
|
+
s: e.s,
|
|
983
|
+
...typeof e.yParity < "u" ? { yParity: e.yParity } : {}
|
|
984
|
+
};
|
|
985
|
+
return gn(t), t;
|
|
986
|
+
}
|
|
987
|
+
function na(e) {
|
|
988
|
+
return {
|
|
989
|
+
r: e.r,
|
|
990
|
+
s: e.s,
|
|
991
|
+
yParity: ct(e.v)
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
function ra(e) {
|
|
995
|
+
const t = (() => {
|
|
996
|
+
const n = e.v ? Number(e.v) : void 0;
|
|
997
|
+
let r = e.yParity ? Number(e.yParity) : void 0;
|
|
998
|
+
if (typeof n == "number" && typeof r != "number" && (r = ct(n)), typeof r != "number")
|
|
999
|
+
throw new ut({ value: e.yParity });
|
|
1000
|
+
return r;
|
|
1001
|
+
})();
|
|
1002
|
+
return {
|
|
1003
|
+
r: BigInt(e.r),
|
|
1004
|
+
s: BigInt(e.s),
|
|
1005
|
+
yParity: t
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
function ct(e) {
|
|
1009
|
+
if (e === 0 || e === 27)
|
|
1010
|
+
return 0;
|
|
1011
|
+
if (e === 1 || e === 28)
|
|
1012
|
+
return 1;
|
|
1013
|
+
if (e >= 35)
|
|
1014
|
+
return e % 2 === 0 ? 1 : 0;
|
|
1015
|
+
throw new oa({ value: e });
|
|
1016
|
+
}
|
|
1017
|
+
class sa extends B {
|
|
1018
|
+
constructor({ signature: t }) {
|
|
1019
|
+
super(`Value \`${t}\` is an invalid signature size.`, {
|
|
1020
|
+
metaMessages: [
|
|
1021
|
+
"Expected: 64 bytes or 65 bytes.",
|
|
1022
|
+
`Received ${G(Hn(t))} bytes.`
|
|
1023
|
+
]
|
|
1024
|
+
}), Object.defineProperty(this, "name", {
|
|
1025
|
+
enumerable: !0,
|
|
1026
|
+
configurable: !0,
|
|
1027
|
+
writable: !0,
|
|
1028
|
+
value: "Signature.InvalidSerializedSizeError"
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
class Oe extends B {
|
|
1033
|
+
constructor({ signature: t }) {
|
|
1034
|
+
super(`Signature \`${Gn(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`), Object.defineProperty(this, "name", {
|
|
1035
|
+
enumerable: !0,
|
|
1036
|
+
configurable: !0,
|
|
1037
|
+
writable: !0,
|
|
1038
|
+
value: "Signature.MissingPropertiesError"
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
class aa extends B {
|
|
1043
|
+
constructor({ value: t }) {
|
|
1044
|
+
super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`), Object.defineProperty(this, "name", {
|
|
1045
|
+
enumerable: !0,
|
|
1046
|
+
configurable: !0,
|
|
1047
|
+
writable: !0,
|
|
1048
|
+
value: "Signature.InvalidRError"
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
class ia extends B {
|
|
1053
|
+
constructor({ value: t }) {
|
|
1054
|
+
super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`), Object.defineProperty(this, "name", {
|
|
1055
|
+
enumerable: !0,
|
|
1056
|
+
configurable: !0,
|
|
1057
|
+
writable: !0,
|
|
1058
|
+
value: "Signature.InvalidSError"
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
class ut extends B {
|
|
1063
|
+
constructor({ value: t }) {
|
|
1064
|
+
super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`), Object.defineProperty(this, "name", {
|
|
1065
|
+
enumerable: !0,
|
|
1066
|
+
configurable: !0,
|
|
1067
|
+
writable: !0,
|
|
1068
|
+
value: "Signature.InvalidYParityError"
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
class oa extends B {
|
|
1073
|
+
constructor({ value: t }) {
|
|
1074
|
+
super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`), Object.defineProperty(this, "name", {
|
|
1075
|
+
enumerable: !0,
|
|
1076
|
+
configurable: !0,
|
|
1077
|
+
writable: !0,
|
|
1078
|
+
value: "Signature.InvalidVError"
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
function ca(e, t = {}) {
|
|
1083
|
+
return typeof e.chainId == "string" ? ua(e) : { ...e, ...t.signature };
|
|
1084
|
+
}
|
|
1085
|
+
function ua(e) {
|
|
1086
|
+
const { address: t, chainId: n, nonce: r } = e, s = ea(e);
|
|
1087
|
+
return {
|
|
1088
|
+
address: t,
|
|
1089
|
+
chainId: Number(n),
|
|
1090
|
+
nonce: BigInt(r),
|
|
1091
|
+
...s
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
const fa = "0x8010801080108010801080108010801080108010801080108010801080108010", da = mn("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");
|
|
1095
|
+
function vn(e) {
|
|
1096
|
+
if (typeof e == "string") {
|
|
1097
|
+
if (_(e, -32) !== fa)
|
|
1098
|
+
throw new pa(e);
|
|
1099
|
+
} else
|
|
1100
|
+
gn(e.authorization);
|
|
1101
|
+
}
|
|
1102
|
+
function la(e) {
|
|
1103
|
+
vn(e);
|
|
1104
|
+
const t = Dt(_(e, -64, -32)), n = _(e, -t - 64, -64), r = _(e, 0, -t - 64), [s, a, i] = Zs(da, n);
|
|
1105
|
+
return {
|
|
1106
|
+
authorization: ca({
|
|
1107
|
+
address: s.delegation,
|
|
1108
|
+
chainId: Number(s.chainId),
|
|
1109
|
+
nonce: s.nonce,
|
|
1110
|
+
yParity: s.yParity,
|
|
1111
|
+
r: s.r,
|
|
1112
|
+
s: s.s
|
|
1113
|
+
}),
|
|
1114
|
+
signature: r,
|
|
1115
|
+
...i && i !== "0x" ? { data: i, to: a } : {}
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
function ha(e) {
|
|
1119
|
+
try {
|
|
1120
|
+
return vn(e), !0;
|
|
1121
|
+
} catch {
|
|
1122
|
+
return !1;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
let pa = class extends B {
|
|
1126
|
+
constructor(t) {
|
|
1127
|
+
super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`), Object.defineProperty(this, "name", {
|
|
1128
|
+
enumerable: !0,
|
|
1129
|
+
configurable: !0,
|
|
1130
|
+
writable: !0,
|
|
1131
|
+
value: "SignatureErc8010.InvalidWrappedSignatureError"
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
function Ve(e) {
|
|
1136
|
+
let t = !0, n = "", r = 0, s = "", a = !1;
|
|
1137
|
+
for (let i = 0; i < e.length; i++) {
|
|
1138
|
+
const o = e[i];
|
|
1139
|
+
if (["(", ")", ","].includes(o) && (t = !0), o === "(" && r++, o === ")" && r--, !!t) {
|
|
1140
|
+
if (r === 0) {
|
|
1141
|
+
if (o === " " && ["event", "function", "error", ""].includes(s))
|
|
1142
|
+
s = "";
|
|
1143
|
+
else if (s += o, o === ")") {
|
|
1144
|
+
a = !0;
|
|
1145
|
+
break;
|
|
1146
|
+
}
|
|
1147
|
+
continue;
|
|
1148
|
+
}
|
|
1149
|
+
if (o === " ") {
|
|
1150
|
+
e[i - 1] !== "," && n !== "," && n !== ",(" && (n = "", t = !1);
|
|
1151
|
+
continue;
|
|
1152
|
+
}
|
|
1153
|
+
s += o, n += o;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
if (!a)
|
|
1157
|
+
throw new B("Unable to normalize signature.");
|
|
1158
|
+
return s;
|
|
1159
|
+
}
|
|
1160
|
+
function qe(e, t) {
|
|
1161
|
+
const n = typeof e, r = t.type;
|
|
1162
|
+
switch (r) {
|
|
1163
|
+
case "address":
|
|
1164
|
+
return Ue(e, { strict: !1 });
|
|
1165
|
+
case "bool":
|
|
1166
|
+
return n === "boolean";
|
|
1167
|
+
case "function":
|
|
1168
|
+
return n === "string";
|
|
1169
|
+
case "string":
|
|
1170
|
+
return n === "string";
|
|
1171
|
+
default:
|
|
1172
|
+
return r === "tuple" && "components" in t ? Object.values(t.components).every((s, a) => qe(Object.values(e)[a], s)) : /^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(r) ? n === "number" || n === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r) ? n === "string" || e instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r) ? Array.isArray(e) && e.every((s) => qe(s, {
|
|
1173
|
+
...t,
|
|
1174
|
+
// Pop off `[]` or `[M]` from end of type
|
|
1175
|
+
type: r.replace(/(\[[0-9]{0,}\])$/, "")
|
|
1176
|
+
})) : !1;
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
function xn(e, t, n) {
|
|
1180
|
+
for (const r in e) {
|
|
1181
|
+
const s = e[r], a = t[r];
|
|
1182
|
+
if (s.type === "tuple" && a.type === "tuple" && "components" in s && "components" in a)
|
|
1183
|
+
return xn(s.components, a.components, n[r]);
|
|
1184
|
+
const i = [s.type, a.type];
|
|
1185
|
+
if (i.includes("address") && i.includes("bytes20") ? !0 : i.includes("address") && i.includes("string") ? Ue(n[r], {
|
|
1186
|
+
strict: !1
|
|
1187
|
+
}) : i.includes("address") && i.includes("bytes") ? Ue(n[r], {
|
|
1188
|
+
strict: !1
|
|
1189
|
+
}) : !1)
|
|
1190
|
+
return i;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
function Pn(e, t = {}) {
|
|
1194
|
+
const { prepare: n = !0 } = t, r = Array.isArray(e) || typeof e == "string" ? Nt(e) : e;
|
|
1195
|
+
return {
|
|
1196
|
+
...r,
|
|
1197
|
+
...n ? { hash: K(r) } : {}
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
function $e(e, t, n) {
|
|
1201
|
+
const { args: r = [], prepare: s = !0 } = n ?? {}, a = Wn(t, { strict: !1 }), i = e.filter((u) => a ? u.type === "function" || u.type === "error" ? An(u) === _(t, 0, 4) : u.type === "event" ? K(u) === t : !1 : "name" in u && u.name === t);
|
|
1202
|
+
if (i.length === 0)
|
|
1203
|
+
throw new Ae({ name: t });
|
|
1204
|
+
if (i.length === 1)
|
|
1205
|
+
return {
|
|
1206
|
+
...i[0],
|
|
1207
|
+
...s ? { hash: K(i[0]) } : {}
|
|
1208
|
+
};
|
|
1209
|
+
let o;
|
|
1210
|
+
for (const u of i) {
|
|
1211
|
+
if (!("inputs" in u))
|
|
1212
|
+
continue;
|
|
1213
|
+
if (!r || r.length === 0) {
|
|
1214
|
+
if (!u.inputs || u.inputs.length === 0)
|
|
1215
|
+
return {
|
|
1216
|
+
...u,
|
|
1217
|
+
...s ? { hash: K(u) } : {}
|
|
1218
|
+
};
|
|
1219
|
+
continue;
|
|
1220
|
+
}
|
|
1221
|
+
if (!u.inputs || u.inputs.length === 0 || u.inputs.length !== r.length)
|
|
1222
|
+
continue;
|
|
1223
|
+
if (r.every((d, l) => {
|
|
1224
|
+
const h = "inputs" in u && u.inputs[l];
|
|
1225
|
+
return h ? qe(d, h) : !1;
|
|
1226
|
+
})) {
|
|
1227
|
+
if (o && "inputs" in o && o.inputs) {
|
|
1228
|
+
const d = xn(u.inputs, o.inputs, r);
|
|
1229
|
+
if (d)
|
|
1230
|
+
throw new ba({
|
|
1231
|
+
abiItem: u,
|
|
1232
|
+
type: d[0]
|
|
1233
|
+
}, {
|
|
1234
|
+
abiItem: o,
|
|
1235
|
+
type: d[1]
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
o = u;
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
const c = (() => {
|
|
1242
|
+
if (o)
|
|
1243
|
+
return o;
|
|
1244
|
+
const [u, ...f] = i;
|
|
1245
|
+
return { ...u, overloads: f };
|
|
1246
|
+
})();
|
|
1247
|
+
if (!c)
|
|
1248
|
+
throw new Ae({ name: t });
|
|
1249
|
+
return {
|
|
1250
|
+
...c,
|
|
1251
|
+
...s ? { hash: K(c) } : {}
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
function An(...e) {
|
|
1255
|
+
const t = (() => {
|
|
1256
|
+
if (Array.isArray(e[0])) {
|
|
1257
|
+
const [n, r] = e;
|
|
1258
|
+
return $e(n, r);
|
|
1259
|
+
}
|
|
1260
|
+
return e[0];
|
|
1261
|
+
})();
|
|
1262
|
+
return _(K(t), 0, 4);
|
|
1263
|
+
}
|
|
1264
|
+
function ma(...e) {
|
|
1265
|
+
const t = (() => {
|
|
1266
|
+
if (Array.isArray(e[0])) {
|
|
1267
|
+
const [r, s] = e;
|
|
1268
|
+
return $e(r, s);
|
|
1269
|
+
}
|
|
1270
|
+
return e[0];
|
|
1271
|
+
})(), n = typeof t == "string" ? t : _e(t);
|
|
1272
|
+
return Ve(n);
|
|
1273
|
+
}
|
|
1274
|
+
function K(...e) {
|
|
1275
|
+
const t = (() => {
|
|
1276
|
+
if (Array.isArray(e[0])) {
|
|
1277
|
+
const [n, r] = e;
|
|
1278
|
+
return $e(n, r);
|
|
1279
|
+
}
|
|
1280
|
+
return e[0];
|
|
1281
|
+
})();
|
|
1282
|
+
return typeof t != "string" && "hash" in t && t.hash ? t.hash : ln(We(ma(t)));
|
|
1283
|
+
}
|
|
1284
|
+
class ba extends B {
|
|
1285
|
+
constructor(t, n) {
|
|
1286
|
+
super("Found ambiguous types in overloaded ABI Items.", {
|
|
1287
|
+
metaMessages: [
|
|
1288
|
+
// TODO: abitype to add support for signature-formatted ABI items.
|
|
1289
|
+
`\`${t.type}\` in \`${Ve(_e(t.abiItem))}\`, and`,
|
|
1290
|
+
`\`${n.type}\` in \`${Ve(_e(n.abiItem))}\``,
|
|
1291
|
+
"",
|
|
1292
|
+
"These types encode differently and cannot be distinguished at runtime.",
|
|
1293
|
+
"Remove one of the ambiguous items in the ABI."
|
|
1294
|
+
]
|
|
1295
|
+
}), Object.defineProperty(this, "name", {
|
|
1296
|
+
enumerable: !0,
|
|
1297
|
+
configurable: !0,
|
|
1298
|
+
writable: !0,
|
|
1299
|
+
value: "AbiItem.AmbiguityError"
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
class Ae extends B {
|
|
1304
|
+
constructor({ name: t, data: n, type: r = "item" }) {
|
|
1305
|
+
const s = t ? ` with name "${t}"` : n ? ` with data "${n}"` : "";
|
|
1306
|
+
super(`ABI ${r}${s} not found.`), Object.defineProperty(this, "name", {
|
|
1307
|
+
enumerable: !0,
|
|
1308
|
+
configurable: !0,
|
|
1309
|
+
writable: !0,
|
|
1310
|
+
value: "AbiItem.NotFoundError"
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
function ya(...e) {
|
|
1315
|
+
var a;
|
|
1316
|
+
const [t, n] = (() => {
|
|
1317
|
+
if (Array.isArray(e[0])) {
|
|
1318
|
+
const [i, o] = e;
|
|
1319
|
+
return [wa(i), o];
|
|
1320
|
+
}
|
|
1321
|
+
return e;
|
|
1322
|
+
})(), { bytecode: r, args: s } = n;
|
|
1323
|
+
return L(r, (a = t.inputs) != null && a.length && (s != null && s.length) ? it(t.inputs, s) : "0x");
|
|
1324
|
+
}
|
|
1325
|
+
function ga(e) {
|
|
1326
|
+
return Pn(e);
|
|
1327
|
+
}
|
|
1328
|
+
function wa(e) {
|
|
1329
|
+
const t = e.find((n) => n.type === "constructor");
|
|
1330
|
+
if (!t)
|
|
1331
|
+
throw new Ae({ name: "constructor" });
|
|
1332
|
+
return t;
|
|
1333
|
+
}
|
|
1334
|
+
function va(...e) {
|
|
1335
|
+
const [t, n = []] = (() => {
|
|
1336
|
+
if (Array.isArray(e[0])) {
|
|
1337
|
+
const [u, f, d] = e;
|
|
1338
|
+
return [St(u, f, { args: d }), d];
|
|
1339
|
+
}
|
|
1340
|
+
const [o, c] = e;
|
|
1341
|
+
return [o, c];
|
|
1342
|
+
})(), { overloads: r } = t, s = r ? St([t, ...r], t.name, {
|
|
1343
|
+
args: n
|
|
1344
|
+
}) : t, a = xa(s), i = n.length > 0 ? it(s.inputs, n) : void 0;
|
|
1345
|
+
return i ? L(a, i) : a;
|
|
1346
|
+
}
|
|
1347
|
+
function J(e, t = {}) {
|
|
1348
|
+
return Pn(e, t);
|
|
1349
|
+
}
|
|
1350
|
+
function St(e, t, n) {
|
|
1351
|
+
const r = $e(e, t, n);
|
|
1352
|
+
if (r.type !== "function")
|
|
1353
|
+
throw new Ae({ name: t, type: "function" });
|
|
1354
|
+
return r;
|
|
1355
|
+
}
|
|
1356
|
+
function xa(e) {
|
|
1357
|
+
return An(e);
|
|
1358
|
+
}
|
|
1359
|
+
const En = "0x6492649264926492649264926492649264926492649264926492649264926492";
|
|
1360
|
+
function Pa(e) {
|
|
1361
|
+
if (_(e, -32) !== En)
|
|
1362
|
+
throw new Ia(e);
|
|
1363
|
+
}
|
|
1364
|
+
function Aa(e) {
|
|
1365
|
+
const { data: t, signature: n, to: r } = e;
|
|
1366
|
+
return L(it(mn("address, bytes, bytes"), [
|
|
1367
|
+
r,
|
|
1368
|
+
t,
|
|
1369
|
+
n
|
|
1370
|
+
]), En);
|
|
1371
|
+
}
|
|
1372
|
+
function Ea(e) {
|
|
1373
|
+
try {
|
|
1374
|
+
return Pa(e), !0;
|
|
1375
|
+
} catch {
|
|
1376
|
+
return !1;
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
class Ia extends B {
|
|
1380
|
+
constructor(t) {
|
|
1381
|
+
super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`), Object.defineProperty(this, "name", {
|
|
1382
|
+
enumerable: !0,
|
|
1383
|
+
configurable: !0,
|
|
1384
|
+
writable: !0,
|
|
1385
|
+
value: "SignatureErc6492.InvalidWrappedSignatureError"
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
class Ba extends F {
|
|
1390
|
+
constructor(t) {
|
|
1391
|
+
super(`Filter type "${t}" is not supported.`, {
|
|
1392
|
+
name: "FilterTypeNotSupportedError"
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
const Ft = "/docs/contract/encodeEventTopics";
|
|
1397
|
+
function ge(e) {
|
|
1398
|
+
var c;
|
|
1399
|
+
const { abi: t, eventName: n, args: r } = e;
|
|
1400
|
+
let s = t[0];
|
|
1401
|
+
if (n) {
|
|
1402
|
+
const u = Vt({ abi: t, name: n });
|
|
1403
|
+
if (!u)
|
|
1404
|
+
throw new xt(n, { docsPath: Ft });
|
|
1405
|
+
s = u;
|
|
1406
|
+
}
|
|
1407
|
+
if (s.type !== "event")
|
|
1408
|
+
throw new xt(void 0, { docsPath: Ft });
|
|
1409
|
+
const a = Zn(s), i = Jn(a);
|
|
1410
|
+
let o = [];
|
|
1411
|
+
if (r && "inputs" in s) {
|
|
1412
|
+
const u = (c = s.inputs) == null ? void 0 : c.filter((d) => "indexed" in d && d.indexed), f = Array.isArray(r) ? r : Object.values(r).length > 0 ? (u == null ? void 0 : u.map((d) => r[d.name])) ?? [] : [];
|
|
1413
|
+
f.length > 0 && (o = (u == null ? void 0 : u.map((d, l) => Array.isArray(f[l]) ? f[l].map((h, g) => Lt({ param: d, value: f[l][g] })) : typeof f[l] < "u" && f[l] !== null ? Lt({ param: d, value: f[l] }) : null)) ?? []);
|
|
1414
|
+
}
|
|
1415
|
+
return [i, ...o];
|
|
1416
|
+
}
|
|
1417
|
+
function Lt({ param: e, value: t }) {
|
|
1418
|
+
if (e.type === "string" || e.type === "bytes")
|
|
1419
|
+
return Pe(qt(t));
|
|
1420
|
+
if (e.type === "tuple" || e.type.match(/^(.*)\[(\d+)?\]$/))
|
|
1421
|
+
throw new Ba(e.type);
|
|
1422
|
+
return jt([e], [t]);
|
|
1423
|
+
}
|
|
1424
|
+
async function In(e, t) {
|
|
1425
|
+
const { address: n, abi: r, args: s, eventName: a, fromBlock: i, strict: o, toBlock: c } = t, u = Ze(e, {
|
|
1426
|
+
method: "eth_newFilter"
|
|
1427
|
+
}), f = a ? ge({
|
|
1428
|
+
abi: r,
|
|
1429
|
+
args: s,
|
|
1430
|
+
eventName: a
|
|
1431
|
+
}) : void 0, d = await e.request({
|
|
1432
|
+
method: "eth_newFilter",
|
|
1433
|
+
params: [
|
|
1434
|
+
{
|
|
1435
|
+
address: n,
|
|
1436
|
+
fromBlock: typeof i == "bigint" ? y(i) : i,
|
|
1437
|
+
toBlock: typeof c == "bigint" ? y(c) : c,
|
|
1438
|
+
topics: f
|
|
1439
|
+
}
|
|
1440
|
+
]
|
|
1441
|
+
});
|
|
1442
|
+
return {
|
|
1443
|
+
abi: r,
|
|
1444
|
+
args: s,
|
|
1445
|
+
eventName: a,
|
|
1446
|
+
id: d,
|
|
1447
|
+
request: u(d),
|
|
1448
|
+
strict: !!o,
|
|
1449
|
+
type: "event"
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
async function Na(e, t) {
|
|
1453
|
+
const { abi: n, address: r, args: s, functionName: a, dataSuffix: i, ...o } = t, c = q({
|
|
1454
|
+
abi: n,
|
|
1455
|
+
args: s,
|
|
1456
|
+
functionName: a
|
|
1457
|
+
});
|
|
1458
|
+
try {
|
|
1459
|
+
return await I(e, Gt, "estimateGas")({
|
|
1460
|
+
data: `${c}${i ? i.replace("0x", "") : ""}`,
|
|
1461
|
+
to: r,
|
|
1462
|
+
...o
|
|
1463
|
+
});
|
|
1464
|
+
} catch (u) {
|
|
1465
|
+
const f = o.account ? be(o.account) : void 0;
|
|
1466
|
+
throw Je(u, {
|
|
1467
|
+
abi: n,
|
|
1468
|
+
address: r,
|
|
1469
|
+
args: s,
|
|
1470
|
+
docsPath: "/docs/contract/estimateContractGas",
|
|
1471
|
+
functionName: a,
|
|
1472
|
+
sender: f == null ? void 0 : f.address
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
async function ft(e, { address: t, blockHash: n, fromBlock: r, toBlock: s, event: a, events: i, args: o, strict: c } = {}) {
|
|
1477
|
+
const u = c ?? !1, f = i ?? (a ? [a] : void 0);
|
|
1478
|
+
let d = [];
|
|
1479
|
+
f && (d = [f.flatMap((v) => ge({
|
|
1480
|
+
abi: [v],
|
|
1481
|
+
eventName: v.name,
|
|
1482
|
+
args: i ? void 0 : o
|
|
1483
|
+
}))], a && (d = d[0]));
|
|
1484
|
+
let l;
|
|
1485
|
+
n ? l = await e.request({
|
|
1486
|
+
method: "eth_getLogs",
|
|
1487
|
+
params: [{ address: t, topics: d, blockHash: n }]
|
|
1488
|
+
}) : l = await e.request({
|
|
1489
|
+
method: "eth_getLogs",
|
|
1490
|
+
params: [
|
|
1491
|
+
{
|
|
1492
|
+
address: t,
|
|
1493
|
+
topics: d,
|
|
1494
|
+
fromBlock: typeof r == "bigint" ? y(r) : r,
|
|
1495
|
+
toBlock: typeof s == "bigint" ? y(s) : s
|
|
1496
|
+
}
|
|
1497
|
+
]
|
|
1498
|
+
});
|
|
1499
|
+
const h = l.map((g) => H(g));
|
|
1500
|
+
return f ? Ht({
|
|
1501
|
+
abi: f,
|
|
1502
|
+
args: o,
|
|
1503
|
+
logs: h,
|
|
1504
|
+
strict: u
|
|
1505
|
+
}) : h;
|
|
1506
|
+
}
|
|
1507
|
+
async function Bn(e, t) {
|
|
1508
|
+
const { abi: n, address: r, args: s, blockHash: a, eventName: i, fromBlock: o, toBlock: c, strict: u } = t, f = i ? Vt({ abi: n, name: i }) : void 0, d = f ? void 0 : n.filter((l) => l.type === "event");
|
|
1509
|
+
return I(e, ft, "getLogs")({
|
|
1510
|
+
address: r,
|
|
1511
|
+
args: s,
|
|
1512
|
+
blockHash: a,
|
|
1513
|
+
event: f,
|
|
1514
|
+
events: d,
|
|
1515
|
+
fromBlock: o,
|
|
1516
|
+
toBlock: c,
|
|
1517
|
+
strict: u
|
|
1518
|
+
});
|
|
1519
|
+
}
|
|
1520
|
+
async function Ca(e, t) {
|
|
1521
|
+
const { abi: n, address: r, args: s, dataSuffix: a, functionName: i, ...o } = t, c = o.account ? be(o.account) : e.account, u = q({ abi: n, args: s, functionName: i });
|
|
1522
|
+
try {
|
|
1523
|
+
const { data: f } = await I(e, Ye, "call")({
|
|
1524
|
+
batch: !1,
|
|
1525
|
+
data: `${u}${a ? a.replace("0x", "") : ""}`,
|
|
1526
|
+
to: r,
|
|
1527
|
+
...o,
|
|
1528
|
+
account: c
|
|
1529
|
+
}), d = Ee({
|
|
1530
|
+
abi: n,
|
|
1531
|
+
args: s,
|
|
1532
|
+
functionName: i,
|
|
1533
|
+
data: f || "0x"
|
|
1534
|
+
}), l = n.filter((h) => "name" in h && h.name === t.functionName);
|
|
1535
|
+
return {
|
|
1536
|
+
result: d,
|
|
1537
|
+
request: {
|
|
1538
|
+
abi: l,
|
|
1539
|
+
address: r,
|
|
1540
|
+
args: s,
|
|
1541
|
+
dataSuffix: a,
|
|
1542
|
+
functionName: i,
|
|
1543
|
+
...o,
|
|
1544
|
+
account: c
|
|
1545
|
+
}
|
|
1546
|
+
};
|
|
1547
|
+
} catch (f) {
|
|
1548
|
+
throw Je(f, {
|
|
1549
|
+
abi: n,
|
|
1550
|
+
address: r,
|
|
1551
|
+
args: s,
|
|
1552
|
+
docsPath: "/docs/contract/simulateContract",
|
|
1553
|
+
functionName: i,
|
|
1554
|
+
sender: c == null ? void 0 : c.address
|
|
1555
|
+
});
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
function Ta(e, t) {
|
|
1559
|
+
const { abi: n, address: r, args: s, batch: a = !0, eventName: i, fromBlock: o, onError: c, onLogs: u, poll: f, pollingInterval: d = e.pollingInterval, strict: l } = t;
|
|
1560
|
+
return (typeof f < "u" ? f : typeof o == "bigint" ? !0 : !(e.transport.type === "webSocket" || e.transport.type === "ipc" || e.transport.type === "fallback" && (e.transport.transports[0].config.type === "webSocket" || e.transport.transports[0].config.type === "ipc"))) ? (() => {
|
|
1561
|
+
const p = l ?? !1, m = fe([
|
|
1562
|
+
"watchContractEvent",
|
|
1563
|
+
r,
|
|
1564
|
+
s,
|
|
1565
|
+
a,
|
|
1566
|
+
e.uid,
|
|
1567
|
+
i,
|
|
1568
|
+
d,
|
|
1569
|
+
p,
|
|
1570
|
+
o
|
|
1571
|
+
]);
|
|
1572
|
+
return de(m, { onLogs: u, onError: c }, (w) => {
|
|
1573
|
+
let b;
|
|
1574
|
+
o !== void 0 && (b = o - 1n);
|
|
1575
|
+
let x, N = !1;
|
|
1576
|
+
const T = Ie(async () => {
|
|
1577
|
+
var A;
|
|
1578
|
+
if (!N) {
|
|
1579
|
+
try {
|
|
1580
|
+
x = await I(e, In, "createContractEventFilter")({
|
|
1581
|
+
abi: n,
|
|
1582
|
+
address: r,
|
|
1583
|
+
args: s,
|
|
1584
|
+
eventName: i,
|
|
1585
|
+
strict: p,
|
|
1586
|
+
fromBlock: o
|
|
1587
|
+
});
|
|
1588
|
+
} catch {
|
|
1589
|
+
}
|
|
1590
|
+
N = !0;
|
|
1591
|
+
return;
|
|
1592
|
+
}
|
|
1593
|
+
try {
|
|
1594
|
+
let E;
|
|
1595
|
+
if (x)
|
|
1596
|
+
E = await I(e, Ke, "getFilterChanges")({ filter: x });
|
|
1597
|
+
else {
|
|
1598
|
+
const C = await I(e, Be, "getBlockNumber")({});
|
|
1599
|
+
b && b < C ? E = await I(e, Bn, "getContractEvents")({
|
|
1600
|
+
abi: n,
|
|
1601
|
+
address: r,
|
|
1602
|
+
args: s,
|
|
1603
|
+
eventName: i,
|
|
1604
|
+
fromBlock: b + 1n,
|
|
1605
|
+
toBlock: C,
|
|
1606
|
+
strict: p
|
|
1607
|
+
}) : E = [], b = C;
|
|
1608
|
+
}
|
|
1609
|
+
if (E.length === 0)
|
|
1610
|
+
return;
|
|
1611
|
+
if (a)
|
|
1612
|
+
w.onLogs(E);
|
|
1613
|
+
else
|
|
1614
|
+
for (const C of E)
|
|
1615
|
+
w.onLogs([C]);
|
|
1616
|
+
} catch (E) {
|
|
1617
|
+
x && E instanceof Wt && (N = !1), (A = w.onError) == null || A.call(w, E);
|
|
1618
|
+
}
|
|
1619
|
+
}, {
|
|
1620
|
+
emitOnBegin: !0,
|
|
1621
|
+
interval: d
|
|
1622
|
+
});
|
|
1623
|
+
return async () => {
|
|
1624
|
+
x && await I(e, Qe, "uninstallFilter")({ filter: x }), T();
|
|
1625
|
+
};
|
|
1626
|
+
});
|
|
1627
|
+
})() : (() => {
|
|
1628
|
+
const p = l ?? !1, m = fe([
|
|
1629
|
+
"watchContractEvent",
|
|
1630
|
+
r,
|
|
1631
|
+
s,
|
|
1632
|
+
a,
|
|
1633
|
+
e.uid,
|
|
1634
|
+
i,
|
|
1635
|
+
d,
|
|
1636
|
+
p
|
|
1637
|
+
]);
|
|
1638
|
+
let w = !0, b = () => w = !1;
|
|
1639
|
+
return de(m, { onLogs: u, onError: c }, (x) => ((async () => {
|
|
1640
|
+
try {
|
|
1641
|
+
const N = (() => {
|
|
1642
|
+
if (e.transport.type === "fallback") {
|
|
1643
|
+
const E = e.transport.transports.find((C) => C.config.type === "webSocket" || C.config.type === "ipc");
|
|
1644
|
+
return E ? E.value : e.transport;
|
|
1645
|
+
}
|
|
1646
|
+
return e.transport;
|
|
1647
|
+
})(), T = i ? ge({
|
|
1648
|
+
abi: n,
|
|
1649
|
+
eventName: i,
|
|
1650
|
+
args: s
|
|
1651
|
+
}) : [], { unsubscribe: A } = await N.subscribe({
|
|
1652
|
+
params: ["logs", { address: r, topics: T }],
|
|
1653
|
+
onData(E) {
|
|
1654
|
+
var R;
|
|
1655
|
+
if (!w)
|
|
1656
|
+
return;
|
|
1657
|
+
const C = E.result;
|
|
1658
|
+
try {
|
|
1659
|
+
const { eventName: $, args: k } = Zt({
|
|
1660
|
+
abi: n,
|
|
1661
|
+
data: C.data,
|
|
1662
|
+
topics: C.topics,
|
|
1663
|
+
strict: l
|
|
1664
|
+
}), S = H(C, {
|
|
1665
|
+
args: k,
|
|
1666
|
+
eventName: $
|
|
1667
|
+
});
|
|
1668
|
+
x.onLogs([S]);
|
|
1669
|
+
} catch ($) {
|
|
1670
|
+
let k, S;
|
|
1671
|
+
if ($ instanceof Jt || $ instanceof Yt) {
|
|
1672
|
+
if (l)
|
|
1673
|
+
return;
|
|
1674
|
+
k = $.abiItem.name, S = (R = $.abiItem.inputs) == null ? void 0 : R.some((ve) => !("name" in ve && ve.name));
|
|
1675
|
+
}
|
|
1676
|
+
const Re = H(C, {
|
|
1677
|
+
args: S ? [] : {},
|
|
1678
|
+
eventName: k
|
|
1679
|
+
});
|
|
1680
|
+
x.onLogs([Re]);
|
|
1681
|
+
}
|
|
1682
|
+
},
|
|
1683
|
+
onError(E) {
|
|
1684
|
+
var C;
|
|
1685
|
+
(C = x.onError) == null || C.call(x, E);
|
|
1686
|
+
}
|
|
1687
|
+
});
|
|
1688
|
+
b = A, w || b();
|
|
1689
|
+
} catch (N) {
|
|
1690
|
+
c == null || c(N);
|
|
1691
|
+
}
|
|
1692
|
+
})(), () => b()));
|
|
1693
|
+
})();
|
|
1694
|
+
}
|
|
1695
|
+
class $a extends F {
|
|
1696
|
+
constructor(t) {
|
|
1697
|
+
super(`Call bundle failed with status: ${t.statusCode}`, {
|
|
1698
|
+
name: "BundleFailedError"
|
|
1699
|
+
}), Object.defineProperty(this, "result", {
|
|
1700
|
+
enumerable: !0,
|
|
1701
|
+
configurable: !0,
|
|
1702
|
+
writable: !0,
|
|
1703
|
+
value: void 0
|
|
1704
|
+
}), this.result = t;
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
const ka = "0x5792579257925792579257925792579257925792579257925792579257925792", za = y(0, {
|
|
1708
|
+
size: 32
|
|
1709
|
+
});
|
|
1710
|
+
async function Ra(e, t) {
|
|
1711
|
+
async function n(f) {
|
|
1712
|
+
if (f.endsWith(ka.slice(2))) {
|
|
1713
|
+
const l = te(Pt(f, -64, -32)), h = Pt(f, 0, -64).slice(2).match(/.{1,64}/g), g = await Promise.all(h.map((p) => za.slice(2) !== p ? e.request({
|
|
1714
|
+
method: "eth_getTransactionReceipt",
|
|
1715
|
+
params: [`0x${p}`]
|
|
1716
|
+
}, { dedupe: !0 }) : void 0)), v = g.some((p) => p === null) ? 100 : g.every((p) => (p == null ? void 0 : p.status) === "0x1") ? 200 : g.every((p) => (p == null ? void 0 : p.status) === "0x0") ? 500 : 600;
|
|
1717
|
+
return {
|
|
1718
|
+
atomic: !1,
|
|
1719
|
+
chainId: le(l),
|
|
1720
|
+
receipts: g.filter(Boolean),
|
|
1721
|
+
status: v,
|
|
1722
|
+
version: "2.0.0"
|
|
1723
|
+
};
|
|
1724
|
+
}
|
|
1725
|
+
return e.request({
|
|
1726
|
+
method: "wallet_getCallsStatus",
|
|
1727
|
+
params: [f]
|
|
1728
|
+
});
|
|
1729
|
+
}
|
|
1730
|
+
const { atomic: r = !1, chainId: s, receipts: a, version: i = "2.0.0", ...o } = await n(t.id), [c, u] = (() => {
|
|
1731
|
+
const f = o.status;
|
|
1732
|
+
return f >= 100 && f < 200 ? ["pending", f] : f >= 200 && f < 300 ? ["success", f] : f >= 300 && f < 700 ? ["failure", f] : f === "CONFIRMED" ? ["success", 200] : f === "PENDING" ? ["pending", 100] : [void 0, f];
|
|
1733
|
+
})();
|
|
1734
|
+
return {
|
|
1735
|
+
...o,
|
|
1736
|
+
atomic: r,
|
|
1737
|
+
// @ts-expect-error: for backwards compatibility
|
|
1738
|
+
chainId: s ? le(s) : void 0,
|
|
1739
|
+
receipts: (a == null ? void 0 : a.map((f) => ({
|
|
1740
|
+
...f,
|
|
1741
|
+
blockNumber: ee(f.blockNumber),
|
|
1742
|
+
gasUsed: ee(f.gasUsed),
|
|
1743
|
+
status: Yn[f.status]
|
|
1744
|
+
}))) ?? [],
|
|
1745
|
+
statusCode: u,
|
|
1746
|
+
status: c,
|
|
1747
|
+
version: i
|
|
1748
|
+
};
|
|
1749
|
+
}
|
|
1750
|
+
async function Zi(e, t) {
|
|
1751
|
+
const {
|
|
1752
|
+
id: n,
|
|
1753
|
+
pollingInterval: r = e.pollingInterval,
|
|
1754
|
+
status: s = ({ statusCode: v }) => v === 200 || v >= 300,
|
|
1755
|
+
retryCount: a = 4,
|
|
1756
|
+
retryDelay: i = ({ count: v }) => ~~(1 << v) * 200,
|
|
1757
|
+
// exponential backoff
|
|
1758
|
+
timeout: o = 6e4,
|
|
1759
|
+
throwOnFailure: c = !1
|
|
1760
|
+
} = t, u = fe(["waitForCallsStatus", e.uid, n]), { promise: f, resolve: d, reject: l } = Kn();
|
|
1761
|
+
let h;
|
|
1762
|
+
const g = de(u, { resolve: d, reject: l }, (v) => {
|
|
1763
|
+
const p = Ie(async () => {
|
|
1764
|
+
const m = (w) => {
|
|
1765
|
+
clearTimeout(h), p(), w(), g();
|
|
1766
|
+
};
|
|
1767
|
+
try {
|
|
1768
|
+
const w = await Qn(async () => {
|
|
1769
|
+
const b = await I(e, Ra, "getCallsStatus")({ id: n });
|
|
1770
|
+
if (c && b.status === "failure")
|
|
1771
|
+
throw new $a(b);
|
|
1772
|
+
return b;
|
|
1773
|
+
}, {
|
|
1774
|
+
retryCount: a,
|
|
1775
|
+
delay: i
|
|
1776
|
+
});
|
|
1777
|
+
if (!s(w))
|
|
1778
|
+
return;
|
|
1779
|
+
m(() => v.resolve(w));
|
|
1780
|
+
} catch (w) {
|
|
1781
|
+
m(() => v.reject(w));
|
|
1782
|
+
}
|
|
1783
|
+
}, {
|
|
1784
|
+
interval: r,
|
|
1785
|
+
emitOnBegin: !0
|
|
1786
|
+
});
|
|
1787
|
+
return p;
|
|
1788
|
+
});
|
|
1789
|
+
return h = o ? setTimeout(() => {
|
|
1790
|
+
g(), clearTimeout(h), l(new Sa({ id: n }));
|
|
1791
|
+
}, o) : void 0, await f;
|
|
1792
|
+
}
|
|
1793
|
+
class Sa extends F {
|
|
1794
|
+
constructor({ id: t }) {
|
|
1795
|
+
super(`Timed out while waiting for call bundle with id "${t}" to be confirmed.`, { name: "WaitForCallsStatusTimeoutError" });
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
function dt(e) {
|
|
1799
|
+
var n, r, s, a, i, o;
|
|
1800
|
+
if (!(e instanceof F))
|
|
1801
|
+
return !1;
|
|
1802
|
+
const t = e.walk((c) => c instanceof At);
|
|
1803
|
+
return t instanceof At ? ((n = t.data) == null ? void 0 : n.errorName) === "HttpError" || ((r = t.data) == null ? void 0 : r.errorName) === "ResolverError" || ((s = t.data) == null ? void 0 : s.errorName) === "ResolverNotContract" || ((a = t.data) == null ? void 0 : a.errorName) === "ResolverNotFound" || ((i = t.data) == null ? void 0 : i.errorName) === "ReverseAddressMismatch" || ((o = t.data) == null ? void 0 : o.errorName) === "UnsupportedResolverProfile" : !1;
|
|
1804
|
+
}
|
|
1805
|
+
function Nn(e) {
|
|
1806
|
+
if (e.length !== 66 || e.indexOf("[") !== 0 || e.indexOf("]") !== 65)
|
|
1807
|
+
return null;
|
|
1808
|
+
const t = `0x${e.slice(1, 65)}`;
|
|
1809
|
+
return Kt(t) ? t : null;
|
|
1810
|
+
}
|
|
1811
|
+
function je(e) {
|
|
1812
|
+
let t = new Uint8Array(32).fill(0);
|
|
1813
|
+
if (!e)
|
|
1814
|
+
return he(t);
|
|
1815
|
+
const n = e.split(".");
|
|
1816
|
+
for (let r = n.length - 1; r >= 0; r -= 1) {
|
|
1817
|
+
const s = Nn(n[r]), a = s ? qt(s) : Pe(ce(n[r]), "bytes");
|
|
1818
|
+
t = Pe(Qt([t, a]), "bytes");
|
|
1819
|
+
}
|
|
1820
|
+
return he(t);
|
|
1821
|
+
}
|
|
1822
|
+
function Fa(e) {
|
|
1823
|
+
return `[${e.slice(2)}]`;
|
|
1824
|
+
}
|
|
1825
|
+
function La(e) {
|
|
1826
|
+
const t = new Uint8Array(32).fill(0);
|
|
1827
|
+
return e ? Nn(e) || Pe(ce(e)) : he(t);
|
|
1828
|
+
}
|
|
1829
|
+
function lt(e) {
|
|
1830
|
+
const t = e.replace(/^\.|\.$/gm, "");
|
|
1831
|
+
if (t.length === 0)
|
|
1832
|
+
return new Uint8Array(1);
|
|
1833
|
+
const n = new Uint8Array(ce(t).byteLength + 2);
|
|
1834
|
+
let r = 0;
|
|
1835
|
+
const s = t.split(".");
|
|
1836
|
+
for (let a = 0; a < s.length; a++) {
|
|
1837
|
+
let i = ce(s[a]);
|
|
1838
|
+
i.byteLength > 255 && (i = ce(Fa(La(s[a])))), n[r] = i.length, n.set(i, r + 1), r += i.length + 1;
|
|
1839
|
+
}
|
|
1840
|
+
return n.byteLength !== r + 1 ? n.slice(0, r + 1) : n;
|
|
1841
|
+
}
|
|
1842
|
+
async function Oa(e, t) {
|
|
1843
|
+
const { blockNumber: n, blockTag: r, coinType: s, name: a, gatewayUrls: i, strict: o } = t, { chain: c } = e, u = (() => {
|
|
1844
|
+
if (t.universalResolverAddress)
|
|
1845
|
+
return t.universalResolverAddress;
|
|
1846
|
+
if (!c)
|
|
1847
|
+
throw new Error("client chain not configured. universalResolverAddress is required.");
|
|
1848
|
+
return Ne({
|
|
1849
|
+
blockNumber: n,
|
|
1850
|
+
chain: c,
|
|
1851
|
+
contract: "ensUniversalResolver"
|
|
1852
|
+
});
|
|
1853
|
+
})(), f = c == null ? void 0 : c.ensTlds;
|
|
1854
|
+
if (f && !f.some((l) => a.endsWith(l)))
|
|
1855
|
+
return null;
|
|
1856
|
+
const d = s != null ? [je(a), BigInt(s)] : [je(a)];
|
|
1857
|
+
try {
|
|
1858
|
+
const l = q({
|
|
1859
|
+
abi: Et,
|
|
1860
|
+
functionName: "addr",
|
|
1861
|
+
args: d
|
|
1862
|
+
}), h = {
|
|
1863
|
+
address: u,
|
|
1864
|
+
abi: Xt,
|
|
1865
|
+
functionName: "resolveWithGateways",
|
|
1866
|
+
args: [
|
|
1867
|
+
pe(lt(a)),
|
|
1868
|
+
l,
|
|
1869
|
+
i ?? [nt]
|
|
1870
|
+
],
|
|
1871
|
+
blockNumber: n,
|
|
1872
|
+
blockTag: r
|
|
1873
|
+
}, v = await I(e, U, "readContract")(h);
|
|
1874
|
+
if (v[0] === "0x")
|
|
1875
|
+
return null;
|
|
1876
|
+
const p = Ee({
|
|
1877
|
+
abi: Et,
|
|
1878
|
+
args: d,
|
|
1879
|
+
functionName: "addr",
|
|
1880
|
+
data: v[0]
|
|
1881
|
+
});
|
|
1882
|
+
return p === "0x" || te(p) === "0x00" ? null : p;
|
|
1883
|
+
} catch (l) {
|
|
1884
|
+
if (o)
|
|
1885
|
+
throw l;
|
|
1886
|
+
if (dt(l))
|
|
1887
|
+
return null;
|
|
1888
|
+
throw l;
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
class _a extends F {
|
|
1892
|
+
constructor({ data: t }) {
|
|
1893
|
+
super("Unable to extract image from metadata. The metadata may be malformed or invalid.", {
|
|
1894
|
+
metaMessages: [
|
|
1895
|
+
"- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.",
|
|
1896
|
+
"",
|
|
1897
|
+
`Provided data: ${JSON.stringify(t)}`
|
|
1898
|
+
],
|
|
1899
|
+
name: "EnsAvatarInvalidMetadataError"
|
|
1900
|
+
});
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
class ie extends F {
|
|
1904
|
+
constructor({ reason: t }) {
|
|
1905
|
+
super(`ENS NFT avatar URI is invalid. ${t}`, {
|
|
1906
|
+
name: "EnsAvatarInvalidNftUriError"
|
|
1907
|
+
});
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
class ht extends F {
|
|
1911
|
+
constructor({ uri: t }) {
|
|
1912
|
+
super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`, { name: "EnsAvatarUriResolutionError" });
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
class Ua extends F {
|
|
1916
|
+
constructor({ namespace: t }) {
|
|
1917
|
+
super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`, { name: "EnsAvatarUnsupportedNamespaceError" });
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
const Da = /(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/, Ma = /^(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>\/.*)?$/, Va = /^data:([a-zA-Z\-/+]*);base64,([^"].*)/, qa = /^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;
|
|
1921
|
+
async function ja(e) {
|
|
1922
|
+
try {
|
|
1923
|
+
const t = await fetch(e, { method: "HEAD" });
|
|
1924
|
+
if (t.status === 200) {
|
|
1925
|
+
const n = t.headers.get("content-type");
|
|
1926
|
+
return n == null ? void 0 : n.startsWith("image/");
|
|
1927
|
+
}
|
|
1928
|
+
return !1;
|
|
1929
|
+
} catch (t) {
|
|
1930
|
+
return typeof t == "object" && typeof t.response < "u" || !Object.hasOwn(globalThis, "Image") ? !1 : new Promise((n) => {
|
|
1931
|
+
const r = new Image();
|
|
1932
|
+
r.onload = () => {
|
|
1933
|
+
n(!0);
|
|
1934
|
+
}, r.onerror = () => {
|
|
1935
|
+
n(!1);
|
|
1936
|
+
}, r.src = e;
|
|
1937
|
+
});
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
function Ot(e, t) {
|
|
1941
|
+
return e ? e.endsWith("/") ? e.slice(0, -1) : e : t;
|
|
1942
|
+
}
|
|
1943
|
+
function Cn({ uri: e, gatewayUrls: t }) {
|
|
1944
|
+
const n = Va.test(e);
|
|
1945
|
+
if (n)
|
|
1946
|
+
return { uri: e, isOnChain: !0, isEncoded: n };
|
|
1947
|
+
const r = Ot(t == null ? void 0 : t.ipfs, "https://ipfs.io"), s = Ot(t == null ? void 0 : t.arweave, "https://arweave.net"), a = e.match(Da), { protocol: i, subpath: o, target: c, subtarget: u = "" } = (a == null ? void 0 : a.groups) || {}, f = i === "ipns:/" || o === "ipns/", d = i === "ipfs:/" || o === "ipfs/" || Ma.test(e);
|
|
1948
|
+
if (e.startsWith("http") && !f && !d) {
|
|
1949
|
+
let h = e;
|
|
1950
|
+
return t != null && t.arweave && (h = e.replace(/https:\/\/arweave.net/g, t == null ? void 0 : t.arweave)), { uri: h, isOnChain: !1, isEncoded: !1 };
|
|
1951
|
+
}
|
|
1952
|
+
if ((f || d) && c)
|
|
1953
|
+
return {
|
|
1954
|
+
uri: `${r}/${f ? "ipns" : "ipfs"}/${c}${u}`,
|
|
1955
|
+
isOnChain: !1,
|
|
1956
|
+
isEncoded: !1
|
|
1957
|
+
};
|
|
1958
|
+
if (i === "ar:/" && c)
|
|
1959
|
+
return {
|
|
1960
|
+
uri: `${s}/${c}${u || ""}`,
|
|
1961
|
+
isOnChain: !1,
|
|
1962
|
+
isEncoded: !1
|
|
1963
|
+
};
|
|
1964
|
+
let l = e.replace(qa, "");
|
|
1965
|
+
if (l.startsWith("<svg") && (l = `data:image/svg+xml;base64,${btoa(l)}`), l.startsWith("data:") || l.startsWith("{"))
|
|
1966
|
+
return {
|
|
1967
|
+
uri: l,
|
|
1968
|
+
isOnChain: !0,
|
|
1969
|
+
isEncoded: !1
|
|
1970
|
+
};
|
|
1971
|
+
throw new ht({ uri: e });
|
|
1972
|
+
}
|
|
1973
|
+
function Tn(e) {
|
|
1974
|
+
if (typeof e != "object" || !("image" in e) && !("image_url" in e) && !("image_data" in e))
|
|
1975
|
+
throw new _a({ data: e });
|
|
1976
|
+
return e.image || e.image_url || e.image_data;
|
|
1977
|
+
}
|
|
1978
|
+
async function Ga({ gatewayUrls: e, uri: t }) {
|
|
1979
|
+
try {
|
|
1980
|
+
const n = await fetch(t).then((s) => s.json());
|
|
1981
|
+
return await pt({
|
|
1982
|
+
gatewayUrls: e,
|
|
1983
|
+
uri: Tn(n)
|
|
1984
|
+
});
|
|
1985
|
+
} catch {
|
|
1986
|
+
throw new ht({ uri: t });
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
async function pt({ gatewayUrls: e, uri: t }) {
|
|
1990
|
+
const { uri: n, isOnChain: r } = Cn({ uri: t, gatewayUrls: e });
|
|
1991
|
+
if (r || await ja(n))
|
|
1992
|
+
return n;
|
|
1993
|
+
throw new ht({ uri: t });
|
|
1994
|
+
}
|
|
1995
|
+
function Ha(e) {
|
|
1996
|
+
let t = e;
|
|
1997
|
+
t.startsWith("did:nft:") && (t = t.replace("did:nft:", "").replace(/_/g, "/"));
|
|
1998
|
+
const [n, r, s] = t.split("/"), [a, i] = n.split(":"), [o, c] = r.split(":");
|
|
1999
|
+
if (!a || a.toLowerCase() !== "eip155")
|
|
2000
|
+
throw new ie({ reason: "Only EIP-155 supported" });
|
|
2001
|
+
if (!i)
|
|
2002
|
+
throw new ie({ reason: "Chain ID not found" });
|
|
2003
|
+
if (!c)
|
|
2004
|
+
throw new ie({
|
|
2005
|
+
reason: "Contract address not found"
|
|
2006
|
+
});
|
|
2007
|
+
if (!s)
|
|
2008
|
+
throw new ie({ reason: "Token ID not found" });
|
|
2009
|
+
if (!o)
|
|
2010
|
+
throw new ie({ reason: "ERC namespace not found" });
|
|
2011
|
+
return {
|
|
2012
|
+
chainID: Number.parseInt(i, 10),
|
|
2013
|
+
namespace: o.toLowerCase(),
|
|
2014
|
+
contractAddress: c,
|
|
2015
|
+
tokenID: s
|
|
2016
|
+
};
|
|
2017
|
+
}
|
|
2018
|
+
async function Wa(e, { nft: t }) {
|
|
2019
|
+
if (t.namespace === "erc721")
|
|
2020
|
+
return U(e, {
|
|
2021
|
+
address: t.contractAddress,
|
|
2022
|
+
abi: [
|
|
2023
|
+
{
|
|
2024
|
+
name: "tokenURI",
|
|
2025
|
+
type: "function",
|
|
2026
|
+
stateMutability: "view",
|
|
2027
|
+
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
2028
|
+
outputs: [{ name: "", type: "string" }]
|
|
2029
|
+
}
|
|
2030
|
+
],
|
|
2031
|
+
functionName: "tokenURI",
|
|
2032
|
+
args: [BigInt(t.tokenID)]
|
|
2033
|
+
});
|
|
2034
|
+
if (t.namespace === "erc1155")
|
|
2035
|
+
return U(e, {
|
|
2036
|
+
address: t.contractAddress,
|
|
2037
|
+
abi: [
|
|
2038
|
+
{
|
|
2039
|
+
name: "uri",
|
|
2040
|
+
type: "function",
|
|
2041
|
+
stateMutability: "view",
|
|
2042
|
+
inputs: [{ name: "_id", type: "uint256" }],
|
|
2043
|
+
outputs: [{ name: "", type: "string" }]
|
|
2044
|
+
}
|
|
2045
|
+
],
|
|
2046
|
+
functionName: "uri",
|
|
2047
|
+
args: [BigInt(t.tokenID)]
|
|
2048
|
+
});
|
|
2049
|
+
throw new Ua({ namespace: t.namespace });
|
|
2050
|
+
}
|
|
2051
|
+
async function Za(e, { gatewayUrls: t, record: n }) {
|
|
2052
|
+
return /eip155:/i.test(n) ? Ja(e, { gatewayUrls: t, record: n }) : pt({ uri: n, gatewayUrls: t });
|
|
2053
|
+
}
|
|
2054
|
+
async function Ja(e, { gatewayUrls: t, record: n }) {
|
|
2055
|
+
const r = Ha(n), s = await Wa(e, { nft: r }), { uri: a, isOnChain: i, isEncoded: o } = Cn({ uri: s, gatewayUrls: t });
|
|
2056
|
+
if (i && (a.includes("data:application/json;base64,") || a.startsWith("{"))) {
|
|
2057
|
+
const u = o ? (
|
|
2058
|
+
// if it is encoded, decode it
|
|
2059
|
+
atob(a.replace("data:application/json;base64,", ""))
|
|
2060
|
+
) : (
|
|
2061
|
+
// if it isn't encoded assume it is a JSON string, but it could be anything (it will error if it is)
|
|
2062
|
+
a
|
|
2063
|
+
), f = JSON.parse(u);
|
|
2064
|
+
return pt({ uri: Tn(f), gatewayUrls: t });
|
|
2065
|
+
}
|
|
2066
|
+
let c = r.tokenID;
|
|
2067
|
+
return r.namespace === "erc1155" && (c = c.replace("0x", "").padStart(64, "0")), Ga({
|
|
2068
|
+
gatewayUrls: t,
|
|
2069
|
+
uri: a.replace(/(?:0x)?{id}/, c)
|
|
2070
|
+
});
|
|
2071
|
+
}
|
|
2072
|
+
async function $n(e, t) {
|
|
2073
|
+
const { blockNumber: n, blockTag: r, key: s, name: a, gatewayUrls: i, strict: o } = t, { chain: c } = e, u = (() => {
|
|
2074
|
+
if (t.universalResolverAddress)
|
|
2075
|
+
return t.universalResolverAddress;
|
|
2076
|
+
if (!c)
|
|
2077
|
+
throw new Error("client chain not configured. universalResolverAddress is required.");
|
|
2078
|
+
return Ne({
|
|
2079
|
+
blockNumber: n,
|
|
2080
|
+
chain: c,
|
|
2081
|
+
contract: "ensUniversalResolver"
|
|
2082
|
+
});
|
|
2083
|
+
})(), f = c == null ? void 0 : c.ensTlds;
|
|
2084
|
+
if (f && !f.some((d) => a.endsWith(d)))
|
|
2085
|
+
return null;
|
|
2086
|
+
try {
|
|
2087
|
+
const d = {
|
|
2088
|
+
address: u,
|
|
2089
|
+
abi: Xt,
|
|
2090
|
+
args: [
|
|
2091
|
+
pe(lt(a)),
|
|
2092
|
+
q({
|
|
2093
|
+
abi: It,
|
|
2094
|
+
functionName: "text",
|
|
2095
|
+
args: [je(a), s]
|
|
2096
|
+
}),
|
|
2097
|
+
i ?? [nt]
|
|
2098
|
+
],
|
|
2099
|
+
functionName: "resolveWithGateways",
|
|
2100
|
+
blockNumber: n,
|
|
2101
|
+
blockTag: r
|
|
2102
|
+
}, h = await I(e, U, "readContract")(d);
|
|
2103
|
+
if (h[0] === "0x")
|
|
2104
|
+
return null;
|
|
2105
|
+
const g = Ee({
|
|
2106
|
+
abi: It,
|
|
2107
|
+
functionName: "text",
|
|
2108
|
+
data: h[0]
|
|
2109
|
+
});
|
|
2110
|
+
return g === "" ? null : g;
|
|
2111
|
+
} catch (d) {
|
|
2112
|
+
if (o)
|
|
2113
|
+
throw d;
|
|
2114
|
+
if (dt(d))
|
|
2115
|
+
return null;
|
|
2116
|
+
throw d;
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
async function Ya(e, { blockNumber: t, blockTag: n, assetGatewayUrls: r, name: s, gatewayUrls: a, strict: i, universalResolverAddress: o }) {
|
|
2120
|
+
const c = await I(e, $n, "getEnsText")({
|
|
2121
|
+
blockNumber: t,
|
|
2122
|
+
blockTag: n,
|
|
2123
|
+
key: "avatar",
|
|
2124
|
+
name: s,
|
|
2125
|
+
universalResolverAddress: o,
|
|
2126
|
+
gatewayUrls: a,
|
|
2127
|
+
strict: i
|
|
2128
|
+
});
|
|
2129
|
+
if (!c)
|
|
2130
|
+
return null;
|
|
2131
|
+
try {
|
|
2132
|
+
return await Za(e, {
|
|
2133
|
+
record: c,
|
|
2134
|
+
gatewayUrls: r
|
|
2135
|
+
});
|
|
2136
|
+
} catch {
|
|
2137
|
+
return null;
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
async function Ka(e, t) {
|
|
2141
|
+
const { address: n, blockNumber: r, blockTag: s, coinType: a = 60n, gatewayUrls: i, strict: o } = t, { chain: c } = e, u = (() => {
|
|
2142
|
+
if (t.universalResolverAddress)
|
|
2143
|
+
return t.universalResolverAddress;
|
|
2144
|
+
if (!c)
|
|
2145
|
+
throw new Error("client chain not configured. universalResolverAddress is required.");
|
|
2146
|
+
return Ne({
|
|
2147
|
+
blockNumber: r,
|
|
2148
|
+
chain: c,
|
|
2149
|
+
contract: "ensUniversalResolver"
|
|
2150
|
+
});
|
|
2151
|
+
})();
|
|
2152
|
+
try {
|
|
2153
|
+
const f = {
|
|
2154
|
+
address: u,
|
|
2155
|
+
abi: Xn,
|
|
2156
|
+
args: [n, a, i ?? [nt]],
|
|
2157
|
+
functionName: "reverseWithGateways",
|
|
2158
|
+
blockNumber: r,
|
|
2159
|
+
blockTag: s
|
|
2160
|
+
}, d = I(e, U, "readContract"), [l] = await d(f);
|
|
2161
|
+
return l || null;
|
|
2162
|
+
} catch (f) {
|
|
2163
|
+
if (o)
|
|
2164
|
+
throw f;
|
|
2165
|
+
if (dt(f))
|
|
2166
|
+
return null;
|
|
2167
|
+
throw f;
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
async function Qa(e, t) {
|
|
2171
|
+
const { blockNumber: n, blockTag: r, name: s } = t, { chain: a } = e, i = (() => {
|
|
2172
|
+
if (t.universalResolverAddress)
|
|
2173
|
+
return t.universalResolverAddress;
|
|
2174
|
+
if (!a)
|
|
2175
|
+
throw new Error("client chain not configured. universalResolverAddress is required.");
|
|
2176
|
+
return Ne({
|
|
2177
|
+
blockNumber: n,
|
|
2178
|
+
chain: a,
|
|
2179
|
+
contract: "ensUniversalResolver"
|
|
2180
|
+
});
|
|
2181
|
+
})(), o = a == null ? void 0 : a.ensTlds;
|
|
2182
|
+
if (o && !o.some((u) => s.endsWith(u)))
|
|
2183
|
+
throw new Error(`${s} is not a valid ENS TLD (${o == null ? void 0 : o.join(", ")}) for chain "${a.name}" (id: ${a.id}).`);
|
|
2184
|
+
const [c] = await I(e, U, "readContract")({
|
|
2185
|
+
address: i,
|
|
2186
|
+
abi: [
|
|
2187
|
+
{
|
|
2188
|
+
inputs: [{ type: "bytes" }],
|
|
2189
|
+
name: "findResolver",
|
|
2190
|
+
outputs: [
|
|
2191
|
+
{ type: "address" },
|
|
2192
|
+
{ type: "bytes32" },
|
|
2193
|
+
{ type: "uint256" }
|
|
2194
|
+
],
|
|
2195
|
+
stateMutability: "view",
|
|
2196
|
+
type: "function"
|
|
2197
|
+
}
|
|
2198
|
+
],
|
|
2199
|
+
functionName: "findResolver",
|
|
2200
|
+
args: [pe(lt(s))],
|
|
2201
|
+
blockNumber: n,
|
|
2202
|
+
blockTag: r
|
|
2203
|
+
});
|
|
2204
|
+
return c;
|
|
2205
|
+
}
|
|
2206
|
+
async function kn(e, t) {
|
|
2207
|
+
var p, m, w;
|
|
2208
|
+
const { account: n = e.account, blockNumber: r, blockTag: s = "latest", blobs: a, data: i, gas: o, gasPrice: c, maxFeePerBlobGas: u, maxFeePerGas: f, maxPriorityFeePerGas: d, to: l, value: h, ...g } = t, v = n ? be(n) : void 0;
|
|
2209
|
+
try {
|
|
2210
|
+
en(t);
|
|
2211
|
+
const x = (typeof r == "bigint" ? y(r) : void 0) || s, N = (w = (m = (p = e.chain) == null ? void 0 : p.formatters) == null ? void 0 : m.transactionRequest) == null ? void 0 : w.format, A = (N || tn)({
|
|
2212
|
+
// Pick out extra data that might exist on the chain's transaction request type.
|
|
2213
|
+
...er(g, { format: N }),
|
|
2214
|
+
account: v,
|
|
2215
|
+
blobs: a,
|
|
2216
|
+
data: i,
|
|
2217
|
+
gas: o,
|
|
2218
|
+
gasPrice: c,
|
|
2219
|
+
maxFeePerBlobGas: u,
|
|
2220
|
+
maxFeePerGas: f,
|
|
2221
|
+
maxPriorityFeePerGas: d,
|
|
2222
|
+
to: l,
|
|
2223
|
+
value: h
|
|
2224
|
+
}, "createAccessList"), E = await e.request({
|
|
2225
|
+
method: "eth_createAccessList",
|
|
2226
|
+
params: [A, x]
|
|
2227
|
+
});
|
|
2228
|
+
return {
|
|
2229
|
+
accessList: E.accessList,
|
|
2230
|
+
gasUsed: BigInt(E.gasUsed)
|
|
2231
|
+
};
|
|
2232
|
+
} catch (b) {
|
|
2233
|
+
throw tr(b, {
|
|
2234
|
+
...t,
|
|
2235
|
+
account: v,
|
|
2236
|
+
chain: e.chain
|
|
2237
|
+
});
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
async function Xa(e) {
|
|
2241
|
+
const t = Ze(e, {
|
|
2242
|
+
method: "eth_newBlockFilter"
|
|
2243
|
+
}), n = await e.request({
|
|
2244
|
+
method: "eth_newBlockFilter"
|
|
2245
|
+
});
|
|
2246
|
+
return { id: n, request: t(n), type: "block" };
|
|
2247
|
+
}
|
|
2248
|
+
async function zn(e, { address: t, args: n, event: r, events: s, fromBlock: a, strict: i, toBlock: o } = {}) {
|
|
2249
|
+
const c = s ?? (r ? [r] : void 0), u = Ze(e, {
|
|
2250
|
+
method: "eth_newFilter"
|
|
2251
|
+
});
|
|
2252
|
+
let f = [];
|
|
2253
|
+
c && (f = [c.flatMap((h) => ge({
|
|
2254
|
+
abi: [h],
|
|
2255
|
+
eventName: h.name,
|
|
2256
|
+
args: n
|
|
2257
|
+
}))], r && (f = f[0]));
|
|
2258
|
+
const d = await e.request({
|
|
2259
|
+
method: "eth_newFilter",
|
|
2260
|
+
params: [
|
|
2261
|
+
{
|
|
2262
|
+
address: t,
|
|
2263
|
+
fromBlock: typeof a == "bigint" ? y(a) : a,
|
|
2264
|
+
toBlock: typeof o == "bigint" ? y(o) : o,
|
|
2265
|
+
...f.length ? { topics: f } : {}
|
|
2266
|
+
}
|
|
2267
|
+
]
|
|
2268
|
+
});
|
|
2269
|
+
return {
|
|
2270
|
+
abi: c,
|
|
2271
|
+
args: n,
|
|
2272
|
+
eventName: r ? r.name : void 0,
|
|
2273
|
+
fromBlock: a,
|
|
2274
|
+
id: d,
|
|
2275
|
+
request: u(d),
|
|
2276
|
+
strict: !!i,
|
|
2277
|
+
toBlock: o,
|
|
2278
|
+
type: "event"
|
|
2279
|
+
};
|
|
2280
|
+
}
|
|
2281
|
+
async function ei(e) {
|
|
2282
|
+
const t = await e.request({
|
|
2283
|
+
method: "eth_blobBaseFee"
|
|
2284
|
+
});
|
|
2285
|
+
return BigInt(t);
|
|
2286
|
+
}
|
|
2287
|
+
async function ti(e, { blockHash: t, blockNumber: n, blockTag: r = "latest" } = {}) {
|
|
2288
|
+
const s = n !== void 0 ? y(n) : void 0;
|
|
2289
|
+
let a;
|
|
2290
|
+
return t ? a = await e.request({
|
|
2291
|
+
method: "eth_getBlockTransactionCountByHash",
|
|
2292
|
+
params: [t]
|
|
2293
|
+
}, { dedupe: !0 }) : a = await e.request({
|
|
2294
|
+
method: "eth_getBlockTransactionCountByNumber",
|
|
2295
|
+
params: [s || r]
|
|
2296
|
+
}, { dedupe: !!s }), le(a);
|
|
2297
|
+
}
|
|
2298
|
+
async function Ge(e, { address: t, blockNumber: n, blockTag: r = "latest" }) {
|
|
2299
|
+
const s = n !== void 0 ? y(n) : void 0, a = await e.request({
|
|
2300
|
+
method: "eth_getCode",
|
|
2301
|
+
params: [t, s || r]
|
|
2302
|
+
}, { dedupe: !!s });
|
|
2303
|
+
if (a !== "0x")
|
|
2304
|
+
return a;
|
|
2305
|
+
}
|
|
2306
|
+
class ni extends F {
|
|
2307
|
+
constructor({ address: t }) {
|
|
2308
|
+
super(`No EIP-712 domain found on contract "${t}".`, {
|
|
2309
|
+
metaMessages: [
|
|
2310
|
+
"Ensure that:",
|
|
2311
|
+
`- The contract is deployed at the address "${t}".`,
|
|
2312
|
+
"- `eip712Domain()` function exists on the contract.",
|
|
2313
|
+
"- `eip712Domain()` function matches signature to ERC-5267 specification."
|
|
2314
|
+
],
|
|
2315
|
+
name: "Eip712DomainNotFoundError"
|
|
2316
|
+
});
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
async function ri(e, t) {
|
|
2320
|
+
const { address: n, factory: r, factoryData: s } = t;
|
|
2321
|
+
try {
|
|
2322
|
+
const [a, i, o, c, u, f, d] = await I(e, U, "readContract")({
|
|
2323
|
+
abi: si,
|
|
2324
|
+
address: n,
|
|
2325
|
+
functionName: "eip712Domain",
|
|
2326
|
+
factory: r,
|
|
2327
|
+
factoryData: s
|
|
2328
|
+
});
|
|
2329
|
+
return {
|
|
2330
|
+
domain: {
|
|
2331
|
+
name: i,
|
|
2332
|
+
version: o,
|
|
2333
|
+
chainId: Number(c),
|
|
2334
|
+
verifyingContract: u,
|
|
2335
|
+
salt: f
|
|
2336
|
+
},
|
|
2337
|
+
extensions: d,
|
|
2338
|
+
fields: a
|
|
2339
|
+
};
|
|
2340
|
+
} catch (a) {
|
|
2341
|
+
const i = a;
|
|
2342
|
+
throw i.name === "ContractFunctionExecutionError" && i.cause.name === "ContractFunctionZeroDataError" ? new ni({ address: n }) : i;
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2345
|
+
const si = [
|
|
2346
|
+
{
|
|
2347
|
+
inputs: [],
|
|
2348
|
+
name: "eip712Domain",
|
|
2349
|
+
outputs: [
|
|
2350
|
+
{ name: "fields", type: "bytes1" },
|
|
2351
|
+
{ name: "name", type: "string" },
|
|
2352
|
+
{ name: "version", type: "string" },
|
|
2353
|
+
{ name: "chainId", type: "uint256" },
|
|
2354
|
+
{ name: "verifyingContract", type: "address" },
|
|
2355
|
+
{ name: "salt", type: "bytes32" },
|
|
2356
|
+
{ name: "extensions", type: "uint256[]" }
|
|
2357
|
+
],
|
|
2358
|
+
stateMutability: "view",
|
|
2359
|
+
type: "function"
|
|
2360
|
+
}
|
|
2361
|
+
];
|
|
2362
|
+
function ai(e) {
|
|
2363
|
+
var t;
|
|
2364
|
+
return {
|
|
2365
|
+
baseFeePerGas: e.baseFeePerGas.map((n) => BigInt(n)),
|
|
2366
|
+
gasUsedRatio: e.gasUsedRatio,
|
|
2367
|
+
oldestBlock: BigInt(e.oldestBlock),
|
|
2368
|
+
reward: (t = e.reward) == null ? void 0 : t.map((n) => n.map((r) => BigInt(r)))
|
|
2369
|
+
};
|
|
2370
|
+
}
|
|
2371
|
+
async function ii(e, { blockCount: t, blockNumber: n, blockTag: r = "latest", rewardPercentiles: s }) {
|
|
2372
|
+
const a = typeof n == "bigint" ? y(n) : void 0, i = await e.request({
|
|
2373
|
+
method: "eth_feeHistory",
|
|
2374
|
+
params: [
|
|
2375
|
+
y(t),
|
|
2376
|
+
a || r,
|
|
2377
|
+
s
|
|
2378
|
+
]
|
|
2379
|
+
}, { dedupe: !!a });
|
|
2380
|
+
return ai(i);
|
|
2381
|
+
}
|
|
2382
|
+
async function oi(e, { filter: t }) {
|
|
2383
|
+
const n = t.strict ?? !1, s = (await t.request({
|
|
2384
|
+
method: "eth_getFilterLogs",
|
|
2385
|
+
params: [t.id]
|
|
2386
|
+
})).map((a) => H(a));
|
|
2387
|
+
return t.abi ? Ht({
|
|
2388
|
+
abi: t.abi,
|
|
2389
|
+
logs: s,
|
|
2390
|
+
strict: n
|
|
2391
|
+
}) : s;
|
|
2392
|
+
}
|
|
2393
|
+
function Ji(e, t) {
|
|
2394
|
+
if (e.length !== t.length)
|
|
2395
|
+
throw new nr({
|
|
2396
|
+
expectedLength: e.length,
|
|
2397
|
+
givenLength: t.length
|
|
2398
|
+
});
|
|
2399
|
+
const n = [];
|
|
2400
|
+
for (let r = 0; r < e.length; r++) {
|
|
2401
|
+
const s = e[r], a = t[r];
|
|
2402
|
+
n.push(Rn(s, a));
|
|
2403
|
+
}
|
|
2404
|
+
return j(n);
|
|
2405
|
+
}
|
|
2406
|
+
function Rn(e, t, n = !1) {
|
|
2407
|
+
if (e === "address") {
|
|
2408
|
+
const i = t;
|
|
2409
|
+
if (!Z(i))
|
|
2410
|
+
throw new se({ address: i });
|
|
2411
|
+
return Fe(i.toLowerCase(), {
|
|
2412
|
+
size: n ? 32 : null
|
|
2413
|
+
});
|
|
2414
|
+
}
|
|
2415
|
+
if (e === "string")
|
|
2416
|
+
return rr(t);
|
|
2417
|
+
if (e === "bytes")
|
|
2418
|
+
return t;
|
|
2419
|
+
if (e === "bool")
|
|
2420
|
+
return Fe(sr(t), { size: n ? 32 : 1 });
|
|
2421
|
+
const r = e.match(ar);
|
|
2422
|
+
if (r) {
|
|
2423
|
+
const [i, o, c = "256"] = r, u = Number.parseInt(c, 10) / 8;
|
|
2424
|
+
return y(t, {
|
|
2425
|
+
size: n ? 32 : u,
|
|
2426
|
+
signed: o === "int"
|
|
2427
|
+
});
|
|
2428
|
+
}
|
|
2429
|
+
const s = e.match(ir);
|
|
2430
|
+
if (s) {
|
|
2431
|
+
const [i, o] = s;
|
|
2432
|
+
if (Number.parseInt(o, 10) !== (t.length - 2) / 2)
|
|
2433
|
+
throw new or({
|
|
2434
|
+
expectedSize: Number.parseInt(o, 10),
|
|
2435
|
+
givenSize: (t.length - 2) / 2
|
|
2436
|
+
});
|
|
2437
|
+
return Fe(t, { dir: "right", size: n ? 32 : null });
|
|
2438
|
+
}
|
|
2439
|
+
const a = e.match(cr);
|
|
2440
|
+
if (a && Array.isArray(t)) {
|
|
2441
|
+
const [i, o] = a, c = [];
|
|
2442
|
+
for (let u = 0; u < t.length; u++)
|
|
2443
|
+
c.push(Rn(o, t[u], !0));
|
|
2444
|
+
return c.length === 0 ? "0x" : j(c);
|
|
2445
|
+
}
|
|
2446
|
+
throw new ur(e);
|
|
2447
|
+
}
|
|
2448
|
+
function ci(e) {
|
|
2449
|
+
const { authorizationList: t } = e;
|
|
2450
|
+
if (t)
|
|
2451
|
+
for (const n of t) {
|
|
2452
|
+
const { chainId: r } = n, s = n.address;
|
|
2453
|
+
if (!Z(s))
|
|
2454
|
+
throw new se({ address: s });
|
|
2455
|
+
if (r < 0)
|
|
2456
|
+
throw new Ce({ chainId: r });
|
|
2457
|
+
}
|
|
2458
|
+
mt(e);
|
|
2459
|
+
}
|
|
2460
|
+
function ui(e) {
|
|
2461
|
+
const { blobVersionedHashes: t } = e;
|
|
2462
|
+
if (t) {
|
|
2463
|
+
if (t.length === 0)
|
|
2464
|
+
throw new dr();
|
|
2465
|
+
for (const n of t) {
|
|
2466
|
+
const r = lr(n), s = le(hr(n, 0, 1));
|
|
2467
|
+
if (r !== 32)
|
|
2468
|
+
throw new pr({ hash: n, size: r });
|
|
2469
|
+
if (s !== mr)
|
|
2470
|
+
throw new br({
|
|
2471
|
+
hash: n,
|
|
2472
|
+
version: s
|
|
2473
|
+
});
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
mt(e);
|
|
2477
|
+
}
|
|
2478
|
+
function mt(e) {
|
|
2479
|
+
const { chainId: t, maxPriorityFeePerGas: n, maxFeePerGas: r, to: s } = e;
|
|
2480
|
+
if (t <= 0)
|
|
2481
|
+
throw new Ce({ chainId: t });
|
|
2482
|
+
if (s && !Z(s))
|
|
2483
|
+
throw new se({ address: s });
|
|
2484
|
+
if (r && r > Xe)
|
|
2485
|
+
throw new et({ maxFeePerGas: r });
|
|
2486
|
+
if (n && r && n > r)
|
|
2487
|
+
throw new fr({ maxFeePerGas: r, maxPriorityFeePerGas: n });
|
|
2488
|
+
}
|
|
2489
|
+
function fi(e) {
|
|
2490
|
+
const { chainId: t, maxPriorityFeePerGas: n, gasPrice: r, maxFeePerGas: s, to: a } = e;
|
|
2491
|
+
if (t <= 0)
|
|
2492
|
+
throw new Ce({ chainId: t });
|
|
2493
|
+
if (a && !Z(a))
|
|
2494
|
+
throw new se({ address: a });
|
|
2495
|
+
if (n || s)
|
|
2496
|
+
throw new F("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");
|
|
2497
|
+
if (r && r > Xe)
|
|
2498
|
+
throw new et({ maxFeePerGas: r });
|
|
2499
|
+
}
|
|
2500
|
+
function di(e) {
|
|
2501
|
+
const { chainId: t, maxPriorityFeePerGas: n, gasPrice: r, maxFeePerGas: s, to: a } = e;
|
|
2502
|
+
if (a && !Z(a))
|
|
2503
|
+
throw new se({ address: a });
|
|
2504
|
+
if (typeof t < "u" && t <= 0)
|
|
2505
|
+
throw new Ce({ chainId: t });
|
|
2506
|
+
if (n || s)
|
|
2507
|
+
throw new F("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");
|
|
2508
|
+
if (r && r > Xe)
|
|
2509
|
+
throw new et({ maxFeePerGas: r });
|
|
2510
|
+
}
|
|
2511
|
+
function ke(e) {
|
|
2512
|
+
if (!e || e.length === 0)
|
|
2513
|
+
return [];
|
|
2514
|
+
const t = [];
|
|
2515
|
+
for (let n = 0; n < e.length; n++) {
|
|
2516
|
+
const { address: r, storageKeys: s } = e[n];
|
|
2517
|
+
for (let a = 0; a < s.length; a++)
|
|
2518
|
+
if (s[a].length - 2 !== 64)
|
|
2519
|
+
throw new yr({ storageKey: s[a] });
|
|
2520
|
+
if (!Z(r, { strict: !1 }))
|
|
2521
|
+
throw new se({ address: r });
|
|
2522
|
+
t.push([r, s]);
|
|
2523
|
+
}
|
|
2524
|
+
return t;
|
|
2525
|
+
}
|
|
2526
|
+
function Yi(e, t) {
|
|
2527
|
+
const n = gr(e);
|
|
2528
|
+
return n === "eip1559" ? pi(e, t) : n === "eip2930" ? mi(e, t) : n === "eip4844" ? hi(e, t) : n === "eip7702" ? li(e, t) : bi(e, t);
|
|
2529
|
+
}
|
|
2530
|
+
function li(e, t) {
|
|
2531
|
+
const { authorizationList: n, chainId: r, gas: s, nonce: a, to: i, value: o, maxFeePerGas: c, maxPriorityFeePerGas: u, accessList: f, data: d } = e;
|
|
2532
|
+
ci(e);
|
|
2533
|
+
const l = ke(f), h = yi(n);
|
|
2534
|
+
return j([
|
|
2535
|
+
"0x04",
|
|
2536
|
+
ne([
|
|
2537
|
+
y(r),
|
|
2538
|
+
a ? y(a) : "0x",
|
|
2539
|
+
u ? y(u) : "0x",
|
|
2540
|
+
c ? y(c) : "0x",
|
|
2541
|
+
s ? y(s) : "0x",
|
|
2542
|
+
i ?? "0x",
|
|
2543
|
+
o ? y(o) : "0x",
|
|
2544
|
+
d ?? "0x",
|
|
2545
|
+
l,
|
|
2546
|
+
h,
|
|
2547
|
+
...we(e, t)
|
|
2548
|
+
])
|
|
2549
|
+
]);
|
|
2550
|
+
}
|
|
2551
|
+
function hi(e, t) {
|
|
2552
|
+
const { chainId: n, gas: r, nonce: s, to: a, value: i, maxFeePerBlobGas: o, maxFeePerGas: c, maxPriorityFeePerGas: u, accessList: f, data: d } = e;
|
|
2553
|
+
ui(e);
|
|
2554
|
+
let l = e.blobVersionedHashes, h = e.sidecars;
|
|
2555
|
+
if (e.blobs && (typeof l > "u" || typeof h > "u")) {
|
|
2556
|
+
const b = typeof e.blobs[0] == "string" ? e.blobs : e.blobs.map((T) => he(T)), x = e.kzg, N = wr({
|
|
2557
|
+
blobs: b,
|
|
2558
|
+
kzg: x
|
|
2559
|
+
});
|
|
2560
|
+
if (typeof l > "u" && (l = vr({
|
|
2561
|
+
commitments: N
|
|
2562
|
+
})), typeof h > "u") {
|
|
2563
|
+
const T = xr({ blobs: b, commitments: N, kzg: x });
|
|
2564
|
+
h = Pr({ blobs: b, commitments: N, proofs: T });
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
const g = ke(f), v = [
|
|
2568
|
+
y(n),
|
|
2569
|
+
s ? y(s) : "0x",
|
|
2570
|
+
u ? y(u) : "0x",
|
|
2571
|
+
c ? y(c) : "0x",
|
|
2572
|
+
r ? y(r) : "0x",
|
|
2573
|
+
a ?? "0x",
|
|
2574
|
+
i ? y(i) : "0x",
|
|
2575
|
+
d ?? "0x",
|
|
2576
|
+
g,
|
|
2577
|
+
o ? y(o) : "0x",
|
|
2578
|
+
l ?? [],
|
|
2579
|
+
...we(e, t)
|
|
2580
|
+
], p = [], m = [], w = [];
|
|
2581
|
+
if (h)
|
|
2582
|
+
for (let b = 0; b < h.length; b++) {
|
|
2583
|
+
const { blob: x, commitment: N, proof: T } = h[b];
|
|
2584
|
+
p.push(x), m.push(N), w.push(T);
|
|
2585
|
+
}
|
|
2586
|
+
return j([
|
|
2587
|
+
"0x03",
|
|
2588
|
+
h ? (
|
|
2589
|
+
// If sidecars are enabled, envelope turns into a "wrapper":
|
|
2590
|
+
ne([v, p, m, w])
|
|
2591
|
+
) : (
|
|
2592
|
+
// If sidecars are disabled, standard envelope is used:
|
|
2593
|
+
ne(v)
|
|
2594
|
+
)
|
|
2595
|
+
]);
|
|
2596
|
+
}
|
|
2597
|
+
function pi(e, t) {
|
|
2598
|
+
const { chainId: n, gas: r, nonce: s, to: a, value: i, maxFeePerGas: o, maxPriorityFeePerGas: c, accessList: u, data: f } = e;
|
|
2599
|
+
mt(e);
|
|
2600
|
+
const d = ke(u), l = [
|
|
2601
|
+
y(n),
|
|
2602
|
+
s ? y(s) : "0x",
|
|
2603
|
+
c ? y(c) : "0x",
|
|
2604
|
+
o ? y(o) : "0x",
|
|
2605
|
+
r ? y(r) : "0x",
|
|
2606
|
+
a ?? "0x",
|
|
2607
|
+
i ? y(i) : "0x",
|
|
2608
|
+
f ?? "0x",
|
|
2609
|
+
d,
|
|
2610
|
+
...we(e, t)
|
|
2611
|
+
];
|
|
2612
|
+
return j([
|
|
2613
|
+
"0x02",
|
|
2614
|
+
ne(l)
|
|
2615
|
+
]);
|
|
2616
|
+
}
|
|
2617
|
+
function mi(e, t) {
|
|
2618
|
+
const { chainId: n, gas: r, data: s, nonce: a, to: i, value: o, accessList: c, gasPrice: u } = e;
|
|
2619
|
+
fi(e);
|
|
2620
|
+
const f = ke(c), d = [
|
|
2621
|
+
y(n),
|
|
2622
|
+
a ? y(a) : "0x",
|
|
2623
|
+
u ? y(u) : "0x",
|
|
2624
|
+
r ? y(r) : "0x",
|
|
2625
|
+
i ?? "0x",
|
|
2626
|
+
o ? y(o) : "0x",
|
|
2627
|
+
s ?? "0x",
|
|
2628
|
+
f,
|
|
2629
|
+
...we(e, t)
|
|
2630
|
+
];
|
|
2631
|
+
return j([
|
|
2632
|
+
"0x01",
|
|
2633
|
+
ne(d)
|
|
2634
|
+
]);
|
|
2635
|
+
}
|
|
2636
|
+
function bi(e, t) {
|
|
2637
|
+
const { chainId: n = 0, gas: r, data: s, nonce: a, to: i, value: o, gasPrice: c } = e;
|
|
2638
|
+
di(e);
|
|
2639
|
+
let u = [
|
|
2640
|
+
a ? y(a) : "0x",
|
|
2641
|
+
c ? y(c) : "0x",
|
|
2642
|
+
r ? y(r) : "0x",
|
|
2643
|
+
i ?? "0x",
|
|
2644
|
+
o ? y(o) : "0x",
|
|
2645
|
+
s ?? "0x"
|
|
2646
|
+
];
|
|
2647
|
+
if (t) {
|
|
2648
|
+
const f = (() => {
|
|
2649
|
+
if (t.v >= 35n)
|
|
2650
|
+
return (t.v - 35n) / 2n > 0 ? t.v : 27n + (t.v === 35n ? 0n : 1n);
|
|
2651
|
+
if (n > 0)
|
|
2652
|
+
return BigInt(n * 2) + BigInt(35n + t.v - 27n);
|
|
2653
|
+
const h = 27n + (t.v === 27n ? 0n : 1n);
|
|
2654
|
+
if (t.v !== h)
|
|
2655
|
+
throw new Ar({ v: t.v });
|
|
2656
|
+
return h;
|
|
2657
|
+
})(), d = te(t.r), l = te(t.s);
|
|
2658
|
+
u = [
|
|
2659
|
+
...u,
|
|
2660
|
+
y(f),
|
|
2661
|
+
d === "0x00" ? "0x" : d,
|
|
2662
|
+
l === "0x00" ? "0x" : l
|
|
2663
|
+
];
|
|
2664
|
+
} else n > 0 && (u = [
|
|
2665
|
+
...u,
|
|
2666
|
+
y(n),
|
|
2667
|
+
"0x",
|
|
2668
|
+
"0x"
|
|
2669
|
+
]);
|
|
2670
|
+
return ne(u);
|
|
2671
|
+
}
|
|
2672
|
+
function we(e, t) {
|
|
2673
|
+
const n = t ?? e, { v: r, yParity: s } = n;
|
|
2674
|
+
if (typeof n.r > "u")
|
|
2675
|
+
return [];
|
|
2676
|
+
if (typeof n.s > "u")
|
|
2677
|
+
return [];
|
|
2678
|
+
if (typeof r > "u" && typeof s > "u")
|
|
2679
|
+
return [];
|
|
2680
|
+
const a = te(n.r), i = te(n.s);
|
|
2681
|
+
return [typeof s == "number" ? s ? y(1) : "0x" : r === 0n ? "0x" : r === 1n ? y(1) : r === 27n ? "0x" : y(1), a === "0x00" ? "0x" : a, i === "0x00" ? "0x" : i];
|
|
2682
|
+
}
|
|
2683
|
+
function yi(e) {
|
|
2684
|
+
if (!e || e.length === 0)
|
|
2685
|
+
return [];
|
|
2686
|
+
const t = [];
|
|
2687
|
+
for (const n of e) {
|
|
2688
|
+
const { chainId: r, nonce: s, ...a } = n, i = n.address;
|
|
2689
|
+
t.push([
|
|
2690
|
+
r ? pe(r) : "0x",
|
|
2691
|
+
i,
|
|
2692
|
+
s ? pe(s) : "0x",
|
|
2693
|
+
...we({}, a)
|
|
2694
|
+
]);
|
|
2695
|
+
}
|
|
2696
|
+
return t;
|
|
2697
|
+
}
|
|
2698
|
+
async function gi({ address: e, authorization: t, signature: n }) {
|
|
2699
|
+
return tt(nn(e), await Er({
|
|
2700
|
+
authorization: t,
|
|
2701
|
+
signature: n
|
|
2702
|
+
}));
|
|
2703
|
+
}
|
|
2704
|
+
function Ki(e) {
|
|
2705
|
+
const { source: t } = e, n = /* @__PURE__ */ new Map(), r = new Ir(8192), s = /* @__PURE__ */ new Map(), a = ({ address: i, chainId: o }) => `${i}.${o}`;
|
|
2706
|
+
return {
|
|
2707
|
+
async consume({ address: i, chainId: o, client: c }) {
|
|
2708
|
+
const u = a({ address: i, chainId: o }), f = this.get({ address: i, chainId: o, client: c });
|
|
2709
|
+
this.increment({ address: i, chainId: o });
|
|
2710
|
+
const d = await f;
|
|
2711
|
+
return await t.set({ address: i, chainId: o }, d), r.set(u, d), d;
|
|
2712
|
+
},
|
|
2713
|
+
async increment({ address: i, chainId: o }) {
|
|
2714
|
+
const c = a({ address: i, chainId: o }), u = n.get(c) ?? 0;
|
|
2715
|
+
n.set(c, u + 1);
|
|
2716
|
+
},
|
|
2717
|
+
async get({ address: i, chainId: o, client: c }) {
|
|
2718
|
+
const u = a({ address: i, chainId: o });
|
|
2719
|
+
let f = s.get(u);
|
|
2720
|
+
return f || (f = (async () => {
|
|
2721
|
+
try {
|
|
2722
|
+
const l = await t.get({ address: i, chainId: o, client: c }), h = r.get(u) ?? 0;
|
|
2723
|
+
return h > 0 && l <= h ? h + 1 : (r.delete(u), l);
|
|
2724
|
+
} finally {
|
|
2725
|
+
this.reset({ address: i, chainId: o });
|
|
2726
|
+
}
|
|
2727
|
+
})(), s.set(u, f)), (n.get(u) ?? 0) + await f;
|
|
2728
|
+
},
|
|
2729
|
+
reset({ address: i, chainId: o }) {
|
|
2730
|
+
const c = a({ address: i, chainId: o });
|
|
2731
|
+
n.delete(c), s.delete(c);
|
|
2732
|
+
}
|
|
2733
|
+
};
|
|
2734
|
+
}
|
|
2735
|
+
const wi = "0x6492649264926492649264926492649264926492649264926492649264926492";
|
|
2736
|
+
function Qi(e) {
|
|
2737
|
+
const { address: t, data: n, signature: r, to: s = "hex" } = e, a = j([
|
|
2738
|
+
jt([{ type: "address" }, { type: "bytes" }, { type: "bytes" }], [t, n, r]),
|
|
2739
|
+
wi
|
|
2740
|
+
]);
|
|
2741
|
+
return s === "hex" ? a : rn(a);
|
|
2742
|
+
}
|
|
2743
|
+
function vi(e) {
|
|
2744
|
+
return e.map((t) => ({
|
|
2745
|
+
...t,
|
|
2746
|
+
value: BigInt(t.value)
|
|
2747
|
+
}));
|
|
2748
|
+
}
|
|
2749
|
+
function xi(e) {
|
|
2750
|
+
return {
|
|
2751
|
+
...e,
|
|
2752
|
+
balance: e.balance ? BigInt(e.balance) : void 0,
|
|
2753
|
+
nonce: e.nonce ? le(e.nonce) : void 0,
|
|
2754
|
+
storageProof: e.storageProof ? vi(e.storageProof) : void 0
|
|
2755
|
+
};
|
|
2756
|
+
}
|
|
2757
|
+
async function Pi(e, { address: t, blockNumber: n, blockTag: r, storageKeys: s }) {
|
|
2758
|
+
const a = r ?? "latest", i = n !== void 0 ? y(n) : void 0, o = await e.request({
|
|
2759
|
+
method: "eth_getProof",
|
|
2760
|
+
params: [t, s, i || a]
|
|
2761
|
+
});
|
|
2762
|
+
return xi(o);
|
|
2763
|
+
}
|
|
2764
|
+
async function Ai(e, { address: t, blockNumber: n, blockTag: r = "latest", slot: s }) {
|
|
2765
|
+
const a = n !== void 0 ? y(n) : void 0;
|
|
2766
|
+
return await e.request({
|
|
2767
|
+
method: "eth_getStorageAt",
|
|
2768
|
+
params: [t, s, a || r]
|
|
2769
|
+
});
|
|
2770
|
+
}
|
|
2771
|
+
async function Ei(e, { hash: t, transactionReceipt: n }) {
|
|
2772
|
+
const [r, s] = await Promise.all([
|
|
2773
|
+
I(e, Be, "getBlockNumber")({}),
|
|
2774
|
+
t ? I(e, sn, "getTransaction")({ hash: t }) : void 0
|
|
2775
|
+
]), a = (n == null ? void 0 : n.blockNumber) || (s == null ? void 0 : s.blockNumber);
|
|
2776
|
+
return a ? r - a + 1n : 0n;
|
|
2777
|
+
}
|
|
2778
|
+
async function He(e, t) {
|
|
2779
|
+
const { blockNumber: n, blockTag: r = e.experimental_blockTag ?? "latest", blocks: s, returnFullTransactions: a, traceTransfers: i, validation: o } = t;
|
|
2780
|
+
try {
|
|
2781
|
+
const c = [];
|
|
2782
|
+
for (const l of s) {
|
|
2783
|
+
const h = l.blockOverrides ? Br(l.blockOverrides) : void 0, g = l.calls.map((p) => {
|
|
2784
|
+
const m = p, w = m.account ? be(m.account) : void 0, b = m.abi ? q(m) : m.data, x = {
|
|
2785
|
+
...m,
|
|
2786
|
+
account: w,
|
|
2787
|
+
data: m.dataSuffix ? Qt([b || "0x", m.dataSuffix]) : b,
|
|
2788
|
+
from: m.from ?? (w == null ? void 0 : w.address)
|
|
2789
|
+
};
|
|
2790
|
+
return en(x), tn(x);
|
|
2791
|
+
}), v = l.stateOverrides ? Nr(l.stateOverrides) : void 0;
|
|
2792
|
+
c.push({
|
|
2793
|
+
blockOverrides: h,
|
|
2794
|
+
calls: g,
|
|
2795
|
+
stateOverrides: v
|
|
2796
|
+
});
|
|
2797
|
+
}
|
|
2798
|
+
const f = (typeof n == "bigint" ? y(n) : void 0) || r;
|
|
2799
|
+
return (await e.request({
|
|
2800
|
+
method: "eth_simulateV1",
|
|
2801
|
+
params: [
|
|
2802
|
+
{ blockStateCalls: c, returnFullTransactions: a, traceTransfers: i, validation: o },
|
|
2803
|
+
f
|
|
2804
|
+
]
|
|
2805
|
+
})).map((l, h) => ({
|
|
2806
|
+
...Cr(l),
|
|
2807
|
+
calls: l.calls.map((g, v) => {
|
|
2808
|
+
var R, $;
|
|
2809
|
+
const { abi: p, args: m, functionName: w, to: b } = s[h].calls[v], x = ((R = g.error) == null ? void 0 : R.data) ?? g.returnData, N = BigInt(g.gasUsed), T = ($ = g.logs) == null ? void 0 : $.map((k) => H(k)), A = g.status === "0x1" ? "success" : "failure", E = p && A === "success" && x !== "0x" ? Ee({
|
|
2810
|
+
abi: p,
|
|
2811
|
+
data: x,
|
|
2812
|
+
functionName: w
|
|
2813
|
+
}) : null, C = (() => {
|
|
2814
|
+
var S;
|
|
2815
|
+
if (A === "success")
|
|
2816
|
+
return;
|
|
2817
|
+
let k;
|
|
2818
|
+
if (((S = g.error) == null ? void 0 : S.data) === "0x" ? k = new Tr() : g.error && (k = new $r(g.error)), !!k)
|
|
2819
|
+
return Je(k, {
|
|
2820
|
+
abi: p ?? [],
|
|
2821
|
+
address: b ?? "0x",
|
|
2822
|
+
args: m,
|
|
2823
|
+
functionName: w ?? "<unknown>"
|
|
2824
|
+
});
|
|
2825
|
+
})();
|
|
2826
|
+
return {
|
|
2827
|
+
data: x,
|
|
2828
|
+
gasUsed: N,
|
|
2829
|
+
logs: T,
|
|
2830
|
+
status: A,
|
|
2831
|
+
...A === "success" ? {
|
|
2832
|
+
result: E
|
|
2833
|
+
} : {
|
|
2834
|
+
error: C
|
|
2835
|
+
}
|
|
2836
|
+
};
|
|
2837
|
+
})
|
|
2838
|
+
}));
|
|
2839
|
+
} catch (c) {
|
|
2840
|
+
const u = c, f = kr(u, {});
|
|
2841
|
+
throw f instanceof zr ? u : f;
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
const Ii = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", O = "0x0000000000000000000000000000000000000000", Bi = "0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";
|
|
2845
|
+
async function Ni(e, t) {
|
|
2846
|
+
const { blockNumber: n, blockTag: r, calls: s, stateOverrides: a, traceAssetChanges: i, traceTransfers: o, validation: c } = t, u = t.account ? be(t.account) : void 0;
|
|
2847
|
+
if (i && !u)
|
|
2848
|
+
throw new F("`account` is required when `traceAssetChanges` is true");
|
|
2849
|
+
const f = u ? ya(ga("constructor(bytes, bytes)"), {
|
|
2850
|
+
bytecode: Rr,
|
|
2851
|
+
args: [
|
|
2852
|
+
Bi,
|
|
2853
|
+
va(J("function getBalance(address)"), [u.address])
|
|
2854
|
+
]
|
|
2855
|
+
}) : void 0, d = i ? await Promise.all(t.calls.map(async (P) => {
|
|
2856
|
+
if (!P.data && !P.abi)
|
|
2857
|
+
return;
|
|
2858
|
+
const { accessList: z } = await kn(e, {
|
|
2859
|
+
account: u.address,
|
|
2860
|
+
...P,
|
|
2861
|
+
data: P.abi ? q(P) : P.data
|
|
2862
|
+
});
|
|
2863
|
+
return z.map(({ address: ae, storageKeys: xe }) => xe.length > 0 ? ae : null);
|
|
2864
|
+
})).then((P) => P.flat().filter(Boolean)) : [], l = await He(e, {
|
|
2865
|
+
blockNumber: n,
|
|
2866
|
+
blockTag: r,
|
|
2867
|
+
blocks: [
|
|
2868
|
+
...i ? [
|
|
2869
|
+
// ETH pre balances
|
|
2870
|
+
{
|
|
2871
|
+
calls: [{ data: f }],
|
|
2872
|
+
stateOverrides: a
|
|
2873
|
+
},
|
|
2874
|
+
// Asset pre balances
|
|
2875
|
+
{
|
|
2876
|
+
calls: d.map((P, z) => ({
|
|
2877
|
+
abi: [
|
|
2878
|
+
J("function balanceOf(address) returns (uint256)")
|
|
2879
|
+
],
|
|
2880
|
+
functionName: "balanceOf",
|
|
2881
|
+
args: [u.address],
|
|
2882
|
+
to: P,
|
|
2883
|
+
from: O,
|
|
2884
|
+
nonce: z
|
|
2885
|
+
})),
|
|
2886
|
+
stateOverrides: [
|
|
2887
|
+
{
|
|
2888
|
+
address: O,
|
|
2889
|
+
nonce: 0
|
|
2890
|
+
}
|
|
2891
|
+
]
|
|
2892
|
+
}
|
|
2893
|
+
] : [],
|
|
2894
|
+
{
|
|
2895
|
+
calls: [...s, {}].map((P) => ({
|
|
2896
|
+
...P,
|
|
2897
|
+
from: u == null ? void 0 : u.address
|
|
2898
|
+
})),
|
|
2899
|
+
stateOverrides: a
|
|
2900
|
+
},
|
|
2901
|
+
...i ? [
|
|
2902
|
+
// ETH post balances
|
|
2903
|
+
{
|
|
2904
|
+
calls: [{ data: f }]
|
|
2905
|
+
},
|
|
2906
|
+
// Asset post balances
|
|
2907
|
+
{
|
|
2908
|
+
calls: d.map((P, z) => ({
|
|
2909
|
+
abi: [
|
|
2910
|
+
J("function balanceOf(address) returns (uint256)")
|
|
2911
|
+
],
|
|
2912
|
+
functionName: "balanceOf",
|
|
2913
|
+
args: [u.address],
|
|
2914
|
+
to: P,
|
|
2915
|
+
from: O,
|
|
2916
|
+
nonce: z
|
|
2917
|
+
})),
|
|
2918
|
+
stateOverrides: [
|
|
2919
|
+
{
|
|
2920
|
+
address: O,
|
|
2921
|
+
nonce: 0
|
|
2922
|
+
}
|
|
2923
|
+
]
|
|
2924
|
+
},
|
|
2925
|
+
// Decimals
|
|
2926
|
+
{
|
|
2927
|
+
calls: d.map((P, z) => ({
|
|
2928
|
+
to: P,
|
|
2929
|
+
abi: [
|
|
2930
|
+
J("function decimals() returns (uint256)")
|
|
2931
|
+
],
|
|
2932
|
+
functionName: "decimals",
|
|
2933
|
+
from: O,
|
|
2934
|
+
nonce: z
|
|
2935
|
+
})),
|
|
2936
|
+
stateOverrides: [
|
|
2937
|
+
{
|
|
2938
|
+
address: O,
|
|
2939
|
+
nonce: 0
|
|
2940
|
+
}
|
|
2941
|
+
]
|
|
2942
|
+
},
|
|
2943
|
+
// Token URI
|
|
2944
|
+
{
|
|
2945
|
+
calls: d.map((P, z) => ({
|
|
2946
|
+
to: P,
|
|
2947
|
+
abi: [
|
|
2948
|
+
J("function tokenURI(uint256) returns (string)")
|
|
2949
|
+
],
|
|
2950
|
+
functionName: "tokenURI",
|
|
2951
|
+
args: [0n],
|
|
2952
|
+
from: O,
|
|
2953
|
+
nonce: z
|
|
2954
|
+
})),
|
|
2955
|
+
stateOverrides: [
|
|
2956
|
+
{
|
|
2957
|
+
address: O,
|
|
2958
|
+
nonce: 0
|
|
2959
|
+
}
|
|
2960
|
+
]
|
|
2961
|
+
},
|
|
2962
|
+
// Symbols
|
|
2963
|
+
{
|
|
2964
|
+
calls: d.map((P, z) => ({
|
|
2965
|
+
to: P,
|
|
2966
|
+
abi: [J("function symbol() returns (string)")],
|
|
2967
|
+
functionName: "symbol",
|
|
2968
|
+
from: O,
|
|
2969
|
+
nonce: z
|
|
2970
|
+
})),
|
|
2971
|
+
stateOverrides: [
|
|
2972
|
+
{
|
|
2973
|
+
address: O,
|
|
2974
|
+
nonce: 0
|
|
2975
|
+
}
|
|
2976
|
+
]
|
|
2977
|
+
}
|
|
2978
|
+
] : []
|
|
2979
|
+
],
|
|
2980
|
+
traceTransfers: o,
|
|
2981
|
+
validation: c
|
|
2982
|
+
}), h = i ? l[2] : l[0], [g, v, , p, m, w, b, x] = i ? l : [], { calls: N, ...T } = h, A = N.slice(0, -1) ?? [], E = (g == null ? void 0 : g.calls) ?? [], C = (v == null ? void 0 : v.calls) ?? [], R = [...E, ...C].map((P) => P.status === "success" ? ee(P.data) : null), $ = (p == null ? void 0 : p.calls) ?? [], k = (m == null ? void 0 : m.calls) ?? [], S = [...$, ...k].map((P) => P.status === "success" ? ee(P.data) : null), Re = ((w == null ? void 0 : w.calls) ?? []).map((P) => P.status === "success" ? P.result : null), ve = ((x == null ? void 0 : x.calls) ?? []).map((P) => P.status === "success" ? P.result : null), Sn = ((b == null ? void 0 : b.calls) ?? []).map((P) => P.status === "success" ? P.result : null), Se = [];
|
|
2983
|
+
for (const [P, z] of S.entries()) {
|
|
2984
|
+
const ae = R[P];
|
|
2985
|
+
if (typeof z != "bigint" || typeof ae != "bigint")
|
|
2986
|
+
continue;
|
|
2987
|
+
const xe = Re[P - 1], Fn = ve[P - 1], Ln = Sn[P - 1], bt = P === 0 ? {
|
|
2988
|
+
address: Ii,
|
|
2989
|
+
decimals: 18,
|
|
2990
|
+
symbol: "ETH"
|
|
2991
|
+
} : {
|
|
2992
|
+
address: d[P - 1],
|
|
2993
|
+
decimals: Ln || xe ? Number(xe ?? 1) : void 0,
|
|
2994
|
+
symbol: Fn ?? void 0
|
|
2995
|
+
};
|
|
2996
|
+
Se.some((On) => On.token.address === bt.address) || Se.push({
|
|
2997
|
+
token: bt,
|
|
2998
|
+
value: {
|
|
2999
|
+
pre: ae,
|
|
3000
|
+
post: z,
|
|
3001
|
+
diff: z - ae
|
|
3002
|
+
}
|
|
3003
|
+
});
|
|
3004
|
+
}
|
|
3005
|
+
return {
|
|
3006
|
+
assetChanges: Se,
|
|
3007
|
+
block: T,
|
|
3008
|
+
results: A
|
|
3009
|
+
};
|
|
3010
|
+
}
|
|
3011
|
+
function Ci({ r: e, s: t, to: n = "hex", v: r, yParity: s }) {
|
|
3012
|
+
const a = (() => {
|
|
3013
|
+
if (s === 0 || s === 1)
|
|
3014
|
+
return s;
|
|
3015
|
+
if (r && (r === 27n || r === 28n || r >= 35n))
|
|
3016
|
+
return r % 2n === 0n ? 1 : 0;
|
|
3017
|
+
throw new Error("Invalid `v` or `yParity` value");
|
|
3018
|
+
})(), i = `0x${new on.Signature(ee(e), ee(t)).toCompactHex()}${a === 0 ? "1b" : "1c"}`;
|
|
3019
|
+
return n === "hex" ? i : rn(i);
|
|
3020
|
+
}
|
|
3021
|
+
async function ze(e, t) {
|
|
3022
|
+
var o, c, u, f, d, l;
|
|
3023
|
+
const { address: n, hash: r, erc6492VerifierAddress: s = t.universalSignatureVerifierAddress ?? ((u = (c = (o = e.chain) == null ? void 0 : o.contracts) == null ? void 0 : c.erc6492Verifier) == null ? void 0 : u.address), multicallAddress: a = t.multicallAddress ?? ((l = (d = (f = e.chain) == null ? void 0 : f.contracts) == null ? void 0 : d.multicall3) == null ? void 0 : l.address) } = t, i = (() => {
|
|
3024
|
+
const h = t.signature;
|
|
3025
|
+
return Kt(h) ? h : typeof h == "object" && "r" in h && "s" in h ? Ci(h) : he(h);
|
|
3026
|
+
})();
|
|
3027
|
+
try {
|
|
3028
|
+
return ha(i) ? await Ti(e, {
|
|
3029
|
+
...t,
|
|
3030
|
+
multicallAddress: a,
|
|
3031
|
+
signature: i
|
|
3032
|
+
}) : await $i(e, {
|
|
3033
|
+
...t,
|
|
3034
|
+
verifierAddress: s,
|
|
3035
|
+
signature: i
|
|
3036
|
+
});
|
|
3037
|
+
} catch (h) {
|
|
3038
|
+
try {
|
|
3039
|
+
if (tt(nn(n), await Sr({ hash: r, signature: i })))
|
|
3040
|
+
return !0;
|
|
3041
|
+
} catch {
|
|
3042
|
+
}
|
|
3043
|
+
if (h instanceof W)
|
|
3044
|
+
return !1;
|
|
3045
|
+
throw h;
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
async function Ti(e, t) {
|
|
3049
|
+
var p;
|
|
3050
|
+
const { address: n, blockNumber: r, blockTag: s, hash: a, multicallAddress: i } = t, { authorization: o, data: c, signature: u, to: f } = la(t.signature);
|
|
3051
|
+
if (await Ge(e, {
|
|
3052
|
+
address: n,
|
|
3053
|
+
blockNumber: r,
|
|
3054
|
+
blockTag: s
|
|
3055
|
+
}) === j(["0xef0100", o.address]))
|
|
3056
|
+
return await ki(e, {
|
|
3057
|
+
address: n,
|
|
3058
|
+
blockNumber: r,
|
|
3059
|
+
blockTag: s,
|
|
3060
|
+
hash: a,
|
|
3061
|
+
signature: u
|
|
3062
|
+
});
|
|
3063
|
+
const l = {
|
|
3064
|
+
address: o.address,
|
|
3065
|
+
chainId: Number(o.chainId),
|
|
3066
|
+
nonce: Number(o.nonce),
|
|
3067
|
+
r: y(o.r, { size: 32 }),
|
|
3068
|
+
s: y(o.s, { size: 32 }),
|
|
3069
|
+
yParity: o.yParity
|
|
3070
|
+
};
|
|
3071
|
+
if (!await gi({
|
|
3072
|
+
address: n,
|
|
3073
|
+
authorization: l
|
|
3074
|
+
}))
|
|
3075
|
+
throw new W();
|
|
3076
|
+
const g = await I(e, U, "readContract")({
|
|
3077
|
+
...i ? { address: i } : { code: Lr },
|
|
3078
|
+
authorizationList: [l],
|
|
3079
|
+
abi: Fr,
|
|
3080
|
+
blockNumber: r,
|
|
3081
|
+
blockTag: "pending",
|
|
3082
|
+
functionName: "aggregate3",
|
|
3083
|
+
args: [
|
|
3084
|
+
[
|
|
3085
|
+
...c ? [
|
|
3086
|
+
{
|
|
3087
|
+
allowFailure: !0,
|
|
3088
|
+
target: f ?? n,
|
|
3089
|
+
callData: c
|
|
3090
|
+
}
|
|
3091
|
+
] : [],
|
|
3092
|
+
{
|
|
3093
|
+
allowFailure: !0,
|
|
3094
|
+
target: n,
|
|
3095
|
+
callData: q({
|
|
3096
|
+
abi: an,
|
|
3097
|
+
functionName: "isValidSignature",
|
|
3098
|
+
args: [a, u]
|
|
3099
|
+
})
|
|
3100
|
+
}
|
|
3101
|
+
]
|
|
3102
|
+
]
|
|
3103
|
+
}), v = (p = g[g.length - 1]) == null ? void 0 : p.returnData;
|
|
3104
|
+
if (v != null && v.startsWith("0x1626ba7e"))
|
|
3105
|
+
return !0;
|
|
3106
|
+
throw new W();
|
|
3107
|
+
}
|
|
3108
|
+
async function $i(e, t) {
|
|
3109
|
+
const { address: n, factory: r, factoryData: s, hash: a, signature: i, verifierAddress: o, ...c } = t, u = await (async () => !r && !s || Ea(i) ? i : Aa({
|
|
3110
|
+
data: s,
|
|
3111
|
+
signature: i,
|
|
3112
|
+
to: r
|
|
3113
|
+
}))(), f = o ? {
|
|
3114
|
+
to: o,
|
|
3115
|
+
data: q({
|
|
3116
|
+
abi: Bt,
|
|
3117
|
+
functionName: "isValidSig",
|
|
3118
|
+
args: [n, a, u]
|
|
3119
|
+
}),
|
|
3120
|
+
...c
|
|
3121
|
+
} : {
|
|
3122
|
+
data: Or({
|
|
3123
|
+
abi: Bt,
|
|
3124
|
+
args: [n, a, u],
|
|
3125
|
+
bytecode: _r
|
|
3126
|
+
}),
|
|
3127
|
+
...c
|
|
3128
|
+
}, { data: d } = await I(e, Ye, "call")(f).catch((l) => {
|
|
3129
|
+
throw l instanceof Ur ? new W() : l;
|
|
3130
|
+
});
|
|
3131
|
+
if (Dr(d ?? "0x0"))
|
|
3132
|
+
return !0;
|
|
3133
|
+
throw new W();
|
|
3134
|
+
}
|
|
3135
|
+
async function ki(e, t) {
|
|
3136
|
+
const { address: n, blockNumber: r, blockTag: s, hash: a, signature: i } = t;
|
|
3137
|
+
if ((await I(e, U, "readContract")({
|
|
3138
|
+
address: n,
|
|
3139
|
+
abi: an,
|
|
3140
|
+
args: [a, i],
|
|
3141
|
+
blockNumber: r,
|
|
3142
|
+
blockTag: s,
|
|
3143
|
+
functionName: "isValidSignature"
|
|
3144
|
+
}).catch((c) => {
|
|
3145
|
+
throw c instanceof Mr ? new W() : c;
|
|
3146
|
+
})).startsWith("0x1626ba7e"))
|
|
3147
|
+
return !0;
|
|
3148
|
+
throw new W();
|
|
3149
|
+
}
|
|
3150
|
+
class W extends Error {
|
|
3151
|
+
}
|
|
3152
|
+
async function zi(e, { address: t, message: n, factory: r, factoryData: s, signature: a, ...i }) {
|
|
3153
|
+
const o = cn(n);
|
|
3154
|
+
return I(e, ze, "verifyHash")({
|
|
3155
|
+
address: t,
|
|
3156
|
+
factory: r,
|
|
3157
|
+
factoryData: s,
|
|
3158
|
+
hash: o,
|
|
3159
|
+
signature: a,
|
|
3160
|
+
...i
|
|
3161
|
+
});
|
|
3162
|
+
}
|
|
3163
|
+
async function Ri(e, t) {
|
|
3164
|
+
const { address: n, factory: r, factoryData: s, signature: a, message: i, primaryType: o, types: c, domain: u, ...f } = t, d = is({ message: i, primaryType: o, types: c, domain: u });
|
|
3165
|
+
return I(e, ze, "verifyHash")({
|
|
3166
|
+
address: n,
|
|
3167
|
+
factory: r,
|
|
3168
|
+
factoryData: s,
|
|
3169
|
+
hash: d,
|
|
3170
|
+
signature: a,
|
|
3171
|
+
...f
|
|
3172
|
+
});
|
|
3173
|
+
}
|
|
3174
|
+
function Si(e, { blockTag: t = e.experimental_blockTag ?? "latest", emitMissed: n = !1, emitOnBegin: r = !1, onBlock: s, onError: a, includeTransactions: i, poll: o, pollingInterval: c = e.pollingInterval }) {
|
|
3175
|
+
const u = typeof o < "u" ? o : !(e.transport.type === "webSocket" || e.transport.type === "ipc" || e.transport.type === "fallback" && (e.transport.transports[0].config.type === "webSocket" || e.transport.transports[0].config.type === "ipc")), f = i ?? !1;
|
|
3176
|
+
let d;
|
|
3177
|
+
return u ? (() => {
|
|
3178
|
+
const g = fe([
|
|
3179
|
+
"watchBlocks",
|
|
3180
|
+
e.uid,
|
|
3181
|
+
t,
|
|
3182
|
+
n,
|
|
3183
|
+
r,
|
|
3184
|
+
f,
|
|
3185
|
+
c
|
|
3186
|
+
]);
|
|
3187
|
+
return de(g, { onBlock: s, onError: a }, (v) => Ie(async () => {
|
|
3188
|
+
var p;
|
|
3189
|
+
try {
|
|
3190
|
+
const m = await I(e, oe, "getBlock")({
|
|
3191
|
+
blockTag: t,
|
|
3192
|
+
includeTransactions: f
|
|
3193
|
+
});
|
|
3194
|
+
if (m.number !== null && (d == null ? void 0 : d.number) != null) {
|
|
3195
|
+
if (m.number === d.number)
|
|
3196
|
+
return;
|
|
3197
|
+
if (m.number - d.number > 1 && n)
|
|
3198
|
+
for (let w = (d == null ? void 0 : d.number) + 1n; w < m.number; w++) {
|
|
3199
|
+
const b = await I(e, oe, "getBlock")({
|
|
3200
|
+
blockNumber: w,
|
|
3201
|
+
includeTransactions: f
|
|
3202
|
+
});
|
|
3203
|
+
v.onBlock(b, d), d = b;
|
|
3204
|
+
}
|
|
3205
|
+
}
|
|
3206
|
+
// If no previous block exists, emit.
|
|
3207
|
+
((d == null ? void 0 : d.number) == null || // If the block tag is "pending" with no block number, emit.
|
|
3208
|
+
t === "pending" && (m == null ? void 0 : m.number) == null || // If the next block number is greater than the previous block number, emit.
|
|
3209
|
+
// We don't want to emit blocks in the past.
|
|
3210
|
+
m.number !== null && m.number > d.number) && (v.onBlock(m, d), d = m);
|
|
3211
|
+
} catch (m) {
|
|
3212
|
+
(p = v.onError) == null || p.call(v, m);
|
|
3213
|
+
}
|
|
3214
|
+
}, {
|
|
3215
|
+
emitOnBegin: r,
|
|
3216
|
+
interval: c
|
|
3217
|
+
}));
|
|
3218
|
+
})() : (() => {
|
|
3219
|
+
let g = !0, v = !0, p = () => g = !1;
|
|
3220
|
+
return (async () => {
|
|
3221
|
+
try {
|
|
3222
|
+
r && I(e, oe, "getBlock")({
|
|
3223
|
+
blockTag: t,
|
|
3224
|
+
includeTransactions: f
|
|
3225
|
+
}).then((b) => {
|
|
3226
|
+
g && v && (s(b, void 0), v = !1);
|
|
3227
|
+
}).catch(a);
|
|
3228
|
+
const m = (() => {
|
|
3229
|
+
if (e.transport.type === "fallback") {
|
|
3230
|
+
const b = e.transport.transports.find((x) => x.config.type === "webSocket" || x.config.type === "ipc");
|
|
3231
|
+
return b ? b.value : e.transport;
|
|
3232
|
+
}
|
|
3233
|
+
return e.transport;
|
|
3234
|
+
})(), { unsubscribe: w } = await m.subscribe({
|
|
3235
|
+
params: ["newHeads"],
|
|
3236
|
+
async onData(b) {
|
|
3237
|
+
var N;
|
|
3238
|
+
if (!g)
|
|
3239
|
+
return;
|
|
3240
|
+
const x = await I(e, oe, "getBlock")({
|
|
3241
|
+
blockNumber: (N = b.result) == null ? void 0 : N.number,
|
|
3242
|
+
includeTransactions: f
|
|
3243
|
+
}).catch(() => {
|
|
3244
|
+
});
|
|
3245
|
+
g && (s(x, d), v = !1, d = x);
|
|
3246
|
+
},
|
|
3247
|
+
onError(b) {
|
|
3248
|
+
a == null || a(b);
|
|
3249
|
+
}
|
|
3250
|
+
});
|
|
3251
|
+
p = w, g || p();
|
|
3252
|
+
} catch (m) {
|
|
3253
|
+
a == null || a(m);
|
|
3254
|
+
}
|
|
3255
|
+
})(), () => p();
|
|
3256
|
+
})();
|
|
3257
|
+
}
|
|
3258
|
+
function Fi(e, { address: t, args: n, batch: r = !0, event: s, events: a, fromBlock: i, onError: o, onLogs: c, poll: u, pollingInterval: f = e.pollingInterval, strict: d }) {
|
|
3259
|
+
const l = typeof u < "u" ? u : typeof i == "bigint" ? !0 : !(e.transport.type === "webSocket" || e.transport.type === "ipc" || e.transport.type === "fallback" && (e.transport.transports[0].config.type === "webSocket" || e.transport.transports[0].config.type === "ipc")), h = d ?? !1;
|
|
3260
|
+
return l ? (() => {
|
|
3261
|
+
const p = fe([
|
|
3262
|
+
"watchEvent",
|
|
3263
|
+
t,
|
|
3264
|
+
n,
|
|
3265
|
+
r,
|
|
3266
|
+
e.uid,
|
|
3267
|
+
s,
|
|
3268
|
+
f,
|
|
3269
|
+
i
|
|
3270
|
+
]);
|
|
3271
|
+
return de(p, { onLogs: c, onError: o }, (m) => {
|
|
3272
|
+
let w;
|
|
3273
|
+
i !== void 0 && (w = i - 1n);
|
|
3274
|
+
let b, x = !1;
|
|
3275
|
+
const N = Ie(async () => {
|
|
3276
|
+
var T;
|
|
3277
|
+
if (!x) {
|
|
3278
|
+
try {
|
|
3279
|
+
b = await I(e, zn, "createEventFilter")({
|
|
3280
|
+
address: t,
|
|
3281
|
+
args: n,
|
|
3282
|
+
event: s,
|
|
3283
|
+
events: a,
|
|
3284
|
+
strict: h,
|
|
3285
|
+
fromBlock: i
|
|
3286
|
+
});
|
|
3287
|
+
} catch {
|
|
3288
|
+
}
|
|
3289
|
+
x = !0;
|
|
3290
|
+
return;
|
|
3291
|
+
}
|
|
3292
|
+
try {
|
|
3293
|
+
let A;
|
|
3294
|
+
if (b)
|
|
3295
|
+
A = await I(e, Ke, "getFilterChanges")({ filter: b });
|
|
3296
|
+
else {
|
|
3297
|
+
const E = await I(e, Be, "getBlockNumber")({});
|
|
3298
|
+
w && w !== E ? A = await I(e, ft, "getLogs")({
|
|
3299
|
+
address: t,
|
|
3300
|
+
args: n,
|
|
3301
|
+
event: s,
|
|
3302
|
+
events: a,
|
|
3303
|
+
fromBlock: w + 1n,
|
|
3304
|
+
toBlock: E
|
|
3305
|
+
}) : A = [], w = E;
|
|
3306
|
+
}
|
|
3307
|
+
if (A.length === 0)
|
|
3308
|
+
return;
|
|
3309
|
+
if (r)
|
|
3310
|
+
m.onLogs(A);
|
|
3311
|
+
else
|
|
3312
|
+
for (const E of A)
|
|
3313
|
+
m.onLogs([E]);
|
|
3314
|
+
} catch (A) {
|
|
3315
|
+
b && A instanceof Wt && (x = !1), (T = m.onError) == null || T.call(m, A);
|
|
3316
|
+
}
|
|
3317
|
+
}, {
|
|
3318
|
+
emitOnBegin: !0,
|
|
3319
|
+
interval: f
|
|
3320
|
+
});
|
|
3321
|
+
return async () => {
|
|
3322
|
+
b && await I(e, Qe, "uninstallFilter")({ filter: b }), N();
|
|
3323
|
+
};
|
|
3324
|
+
});
|
|
3325
|
+
})() : (() => {
|
|
3326
|
+
let p = !0, m = () => p = !1;
|
|
3327
|
+
return (async () => {
|
|
3328
|
+
try {
|
|
3329
|
+
const w = (() => {
|
|
3330
|
+
if (e.transport.type === "fallback") {
|
|
3331
|
+
const T = e.transport.transports.find((A) => A.config.type === "webSocket" || A.config.type === "ipc");
|
|
3332
|
+
return T ? T.value : e.transport;
|
|
3333
|
+
}
|
|
3334
|
+
return e.transport;
|
|
3335
|
+
})(), b = a ?? (s ? [s] : void 0);
|
|
3336
|
+
let x = [];
|
|
3337
|
+
b && (x = [b.flatMap((A) => ge({
|
|
3338
|
+
abi: [A],
|
|
3339
|
+
eventName: A.name,
|
|
3340
|
+
args: n
|
|
3341
|
+
}))], s && (x = x[0]));
|
|
3342
|
+
const { unsubscribe: N } = await w.subscribe({
|
|
3343
|
+
params: ["logs", { address: t, topics: x }],
|
|
3344
|
+
onData(T) {
|
|
3345
|
+
var E;
|
|
3346
|
+
if (!p)
|
|
3347
|
+
return;
|
|
3348
|
+
const A = T.result;
|
|
3349
|
+
try {
|
|
3350
|
+
const { eventName: C, args: R } = Zt({
|
|
3351
|
+
abi: b ?? [],
|
|
3352
|
+
data: A.data,
|
|
3353
|
+
topics: A.topics,
|
|
3354
|
+
strict: h
|
|
3355
|
+
}), $ = H(A, { args: R, eventName: C });
|
|
3356
|
+
c([$]);
|
|
3357
|
+
} catch (C) {
|
|
3358
|
+
let R, $;
|
|
3359
|
+
if (C instanceof Jt || C instanceof Yt) {
|
|
3360
|
+
if (d)
|
|
3361
|
+
return;
|
|
3362
|
+
R = C.abiItem.name, $ = (E = C.abiItem.inputs) == null ? void 0 : E.some((S) => !("name" in S && S.name));
|
|
3363
|
+
}
|
|
3364
|
+
const k = H(A, {
|
|
3365
|
+
args: $ ? [] : {},
|
|
3366
|
+
eventName: R
|
|
3367
|
+
});
|
|
3368
|
+
c([k]);
|
|
3369
|
+
}
|
|
3370
|
+
},
|
|
3371
|
+
onError(T) {
|
|
3372
|
+
o == null || o(T);
|
|
3373
|
+
}
|
|
3374
|
+
});
|
|
3375
|
+
m = N, p || m();
|
|
3376
|
+
} catch (w) {
|
|
3377
|
+
o == null || o(w);
|
|
3378
|
+
}
|
|
3379
|
+
})(), () => m();
|
|
3380
|
+
})();
|
|
3381
|
+
}
|
|
3382
|
+
function Li(e) {
|
|
3383
|
+
var d, l, h;
|
|
3384
|
+
const { scheme: t, statement: n, ...r } = ((d = e.match(Oi)) == null ? void 0 : d.groups) ?? {}, { chainId: s, expirationTime: a, issuedAt: i, notBefore: o, requestId: c, ...u } = ((l = e.match(_i)) == null ? void 0 : l.groups) ?? {}, f = (h = e.split("Resources:")[1]) == null ? void 0 : h.split(`
|
|
3385
|
+
- `).slice(1);
|
|
3386
|
+
return {
|
|
3387
|
+
...r,
|
|
3388
|
+
...u,
|
|
3389
|
+
...s ? { chainId: Number(s) } : {},
|
|
3390
|
+
...a ? { expirationTime: new Date(a) } : {},
|
|
3391
|
+
...i ? { issuedAt: new Date(i) } : {},
|
|
3392
|
+
...o ? { notBefore: new Date(o) } : {},
|
|
3393
|
+
...c ? { requestId: c } : {},
|
|
3394
|
+
...f ? { resources: f } : {},
|
|
3395
|
+
...t ? { scheme: t } : {},
|
|
3396
|
+
...n ? { statement: n } : {}
|
|
3397
|
+
};
|
|
3398
|
+
}
|
|
3399
|
+
const Oi = /^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/, _i = /(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;
|
|
3400
|
+
function Ui(e) {
|
|
3401
|
+
const { address: t, domain: n, message: r, nonce: s, scheme: a, time: i = /* @__PURE__ */ new Date() } = e;
|
|
3402
|
+
if (n && r.domain !== n || s && r.nonce !== s || a && r.scheme !== a || r.expirationTime && i >= r.expirationTime || r.notBefore && i < r.notBefore)
|
|
3403
|
+
return !1;
|
|
3404
|
+
try {
|
|
3405
|
+
if (!r.address || !Z(r.address, { strict: !1 }) || t && !tt(r.address, t))
|
|
3406
|
+
return !1;
|
|
3407
|
+
} catch {
|
|
3408
|
+
return !1;
|
|
3409
|
+
}
|
|
3410
|
+
return !0;
|
|
3411
|
+
}
|
|
3412
|
+
async function Di(e, t) {
|
|
3413
|
+
const { address: n, domain: r, message: s, nonce: a, scheme: i, signature: o, time: c = /* @__PURE__ */ new Date(), ...u } = t, f = Li(s);
|
|
3414
|
+
if (!f.address || !Ui({
|
|
3415
|
+
address: n,
|
|
3416
|
+
domain: r,
|
|
3417
|
+
message: f,
|
|
3418
|
+
nonce: a,
|
|
3419
|
+
scheme: i,
|
|
3420
|
+
time: c
|
|
3421
|
+
}))
|
|
3422
|
+
return !1;
|
|
3423
|
+
const l = cn(s);
|
|
3424
|
+
return ze(e, {
|
|
3425
|
+
address: f.address,
|
|
3426
|
+
hash: l,
|
|
3427
|
+
signature: o,
|
|
3428
|
+
...u
|
|
3429
|
+
});
|
|
3430
|
+
}
|
|
3431
|
+
async function Mi(e, { serializedTransaction: t, throwOnReceiptRevert: n, timeout: r }) {
|
|
3432
|
+
var o, c, u;
|
|
3433
|
+
const s = await e.request({
|
|
3434
|
+
method: "eth_sendRawTransactionSync",
|
|
3435
|
+
params: r ? [t, y(r)] : [t]
|
|
3436
|
+
}, { retryCount: 0 }), i = (((u = (c = (o = e.chain) == null ? void 0 : o.formatters) == null ? void 0 : c.transactionReceipt) == null ? void 0 : u.format) || Vr)(s);
|
|
3437
|
+
if (i.status === "reverted" && n)
|
|
3438
|
+
throw new qr({ receipt: i });
|
|
3439
|
+
return i;
|
|
3440
|
+
}
|
|
3441
|
+
function Vi(e) {
|
|
3442
|
+
return {
|
|
3443
|
+
call: (t) => Ye(e, t),
|
|
3444
|
+
createAccessList: (t) => kn(e, t),
|
|
3445
|
+
createBlockFilter: () => Xa(e),
|
|
3446
|
+
createContractEventFilter: (t) => In(e, t),
|
|
3447
|
+
createEventFilter: (t) => zn(e, t),
|
|
3448
|
+
createPendingTransactionFilter: () => ss(e),
|
|
3449
|
+
estimateContractGas: (t) => Na(e, t),
|
|
3450
|
+
estimateGas: (t) => Gt(e, t),
|
|
3451
|
+
getBalance: (t) => rs(e, t),
|
|
3452
|
+
getBlobBaseFee: () => ei(e),
|
|
3453
|
+
getBlock: (t) => oe(e, t),
|
|
3454
|
+
getBlockNumber: (t) => Be(e, t),
|
|
3455
|
+
getBlockTransactionCount: (t) => ti(e, t),
|
|
3456
|
+
getBytecode: (t) => Ge(e, t),
|
|
3457
|
+
getChainId: () => ns(e),
|
|
3458
|
+
getCode: (t) => Ge(e, t),
|
|
3459
|
+
getContractEvents: (t) => Bn(e, t),
|
|
3460
|
+
getEip712Domain: (t) => ri(e, t),
|
|
3461
|
+
getEnsAddress: (t) => Oa(e, t),
|
|
3462
|
+
getEnsAvatar: (t) => Ya(e, t),
|
|
3463
|
+
getEnsName: (t) => Ka(e, t),
|
|
3464
|
+
getEnsResolver: (t) => Qa(e, t),
|
|
3465
|
+
getEnsText: (t) => $n(e, t),
|
|
3466
|
+
getFeeHistory: (t) => ii(e, t),
|
|
3467
|
+
estimateFeesPerGas: (t) => ts(e, t),
|
|
3468
|
+
getFilterChanges: (t) => Ke(e, t),
|
|
3469
|
+
getFilterLogs: (t) => oi(e, t),
|
|
3470
|
+
getGasPrice: () => es(e),
|
|
3471
|
+
getLogs: (t) => ft(e, t),
|
|
3472
|
+
getProof: (t) => Pi(e, t),
|
|
3473
|
+
estimateMaxPriorityFeePerGas: (t) => Xr(e, t),
|
|
3474
|
+
fillTransaction: (t) => Qr(e, t),
|
|
3475
|
+
getStorageAt: (t) => Ai(e, t),
|
|
3476
|
+
getTransaction: (t) => sn(e, t),
|
|
3477
|
+
getTransactionConfirmations: (t) => Ei(e, t),
|
|
3478
|
+
getTransactionCount: (t) => Kr(e, t),
|
|
3479
|
+
getTransactionReceipt: (t) => Yr(e, t),
|
|
3480
|
+
multicall: (t) => Jr(e, t),
|
|
3481
|
+
prepareTransactionRequest: (t) => Zr(e, t),
|
|
3482
|
+
readContract: (t) => U(e, t),
|
|
3483
|
+
sendRawTransaction: (t) => Wr(e, t),
|
|
3484
|
+
sendRawTransactionSync: (t) => Mi(e, t),
|
|
3485
|
+
simulate: (t) => He(e, t),
|
|
3486
|
+
simulateBlocks: (t) => He(e, t),
|
|
3487
|
+
simulateCalls: (t) => Ni(e, t),
|
|
3488
|
+
simulateContract: (t) => Ca(e, t),
|
|
3489
|
+
verifyHash: (t) => ze(e, t),
|
|
3490
|
+
verifyMessage: (t) => zi(e, t),
|
|
3491
|
+
verifySiweMessage: (t) => Di(e, t),
|
|
3492
|
+
verifyTypedData: (t) => Ri(e, t),
|
|
3493
|
+
uninstallFilter: (t) => Qe(e, t),
|
|
3494
|
+
waitForTransactionReceipt: (t) => Hr(e, t),
|
|
3495
|
+
watchBlocks: (t) => Si(e, t),
|
|
3496
|
+
watchBlockNumber: (t) => Gr(e, t),
|
|
3497
|
+
watchContractEvent: (t) => Ta(e, t),
|
|
3498
|
+
watchEvent: (t) => Fi(e, t),
|
|
3499
|
+
watchPendingTransactions: (t) => jr(e, t)
|
|
3500
|
+
};
|
|
3501
|
+
}
|
|
3502
|
+
function Xi(e) {
|
|
3503
|
+
const { key: t = "public", name: n = "Public Client" } = e;
|
|
3504
|
+
return as({
|
|
3505
|
+
...e,
|
|
3506
|
+
key: t,
|
|
3507
|
+
name: n,
|
|
3508
|
+
type: "publicClient"
|
|
3509
|
+
}).extend(Vi);
|
|
3510
|
+
}
|
|
3511
|
+
function eo(e) {
|
|
3512
|
+
const { r: t, s: n } = on.Signature.fromCompact(e.slice(2, 130)), r = +`0x${e.slice(130)}`, [s, a] = (() => {
|
|
3513
|
+
if (r === 0 || r === 1)
|
|
3514
|
+
return [void 0, r];
|
|
3515
|
+
if (r === 27)
|
|
3516
|
+
return [BigInt(r), 0];
|
|
3517
|
+
if (r === 28)
|
|
3518
|
+
return [BigInt(r), 1];
|
|
3519
|
+
throw new Error("Invalid yParityOrV value");
|
|
3520
|
+
})();
|
|
3521
|
+
return typeof s < "u" ? {
|
|
3522
|
+
r: y(t, { size: 32 }),
|
|
3523
|
+
s: y(n, { size: 32 }),
|
|
3524
|
+
v: s,
|
|
3525
|
+
yParity: a
|
|
3526
|
+
} : {
|
|
3527
|
+
r: y(t, { size: 32 }),
|
|
3528
|
+
s: y(n, { size: 32 }),
|
|
3529
|
+
yParity: a
|
|
3530
|
+
};
|
|
3531
|
+
}
|
|
3532
|
+
export {
|
|
3533
|
+
$a as B,
|
|
3534
|
+
ie as E,
|
|
3535
|
+
Ba as F,
|
|
3536
|
+
Sa as W,
|
|
3537
|
+
Ct as a,
|
|
3538
|
+
Vi as b,
|
|
3539
|
+
Xi as c,
|
|
3540
|
+
Ua as d,
|
|
3541
|
+
Ii as e,
|
|
3542
|
+
ht as f,
|
|
3543
|
+
ge as g,
|
|
3544
|
+
Ji as h,
|
|
3545
|
+
Ki as i,
|
|
3546
|
+
eo as j,
|
|
3547
|
+
Ci as k,
|
|
3548
|
+
La as l,
|
|
3549
|
+
mt as m,
|
|
3550
|
+
je as n,
|
|
3551
|
+
fi as o,
|
|
3552
|
+
Nt as p,
|
|
3553
|
+
di as q,
|
|
3554
|
+
ke as r,
|
|
3555
|
+
Qi as s,
|
|
3556
|
+
Yi as t,
|
|
3557
|
+
Ge as u,
|
|
3558
|
+
Zi as w,
|
|
3559
|
+
O as z
|
|
3560
|
+
};
|