@pufferfinance/puffer-sdk 1.29.1 → 1.29.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/puffer-client-helpers.cjs +1 -1
- package/dist/api/puffer-client-helpers.cjs.map +1 -1
- package/dist/api/puffer-client-helpers.js +3 -3
- package/dist/api/puffer-client-helpers.js.map +1 -1
- package/dist/api/puffer-client.cjs +1 -1
- package/dist/api/puffer-client.js +2 -2
- package/dist/{ccip-Dv8Z-tXr.cjs → ccip-BQKdkZzc.cjs} +2 -2
- package/dist/{ccip-Dv8Z-tXr.cjs.map → ccip-BQKdkZzc.cjs.map} +1 -1
- package/dist/{ccip-dYaIZXTj.js → ccip-DkpMYAPh.js} +4 -4
- package/dist/{ccip-dYaIZXTj.js.map → ccip-DkpMYAPh.js.map} +1 -1
- package/dist/chains/constants.cjs +1 -1
- package/dist/chains/constants.d.ts +3 -1
- package/dist/chains/constants.js +1 -1
- package/dist/{constants-BO_Dvglw.js → constants-0GZgavMM.js} +511 -443
- package/dist/constants-0GZgavMM.js.map +1 -0
- package/dist/constants-CwkqnEF2.cjs +8 -0
- package/dist/constants-CwkqnEF2.cjs.map +1 -0
- package/dist/contracts/addresses.cjs +1 -1
- package/dist/contracts/addresses.js +1 -1
- package/dist/contracts/handlers/carrot-staking-handler.cjs +1 -1
- package/dist/contracts/handlers/carrot-staking-handler.d.ts +9 -3
- package/dist/contracts/handlers/carrot-staking-handler.js +2 -2
- package/dist/contracts/handlers/carrot-vesting-handler.cjs +1 -1
- package/dist/contracts/handlers/carrot-vesting-handler.d.ts +9 -3
- package/dist/contracts/handlers/carrot-vesting-handler.js +2 -2
- package/dist/contracts/handlers/concrete-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/concrete-vault-handler.d.ts +9 -3
- package/dist/contracts/handlers/concrete-vault-handler.js +2 -2
- package/dist/contracts/handlers/distributor-handler.cjs +1 -1
- package/dist/contracts/handlers/distributor-handler.d.ts +9 -3
- package/dist/contracts/handlers/distributor-handler.js +2 -2
- package/dist/contracts/handlers/erc20-permit-handler.cjs +1 -1
- package/dist/contracts/handlers/erc20-permit-handler.cjs.map +1 -1
- package/dist/contracts/handlers/erc20-permit-handler.d.ts +9 -3
- package/dist/contracts/handlers/erc20-permit-handler.js +3 -3
- package/dist/contracts/handlers/erc20-permit-handler.js.map +1 -1
- package/dist/contracts/handlers/gauge-registry-handler.cjs +1 -1
- package/dist/contracts/handlers/gauge-registry-handler.d.ts +9 -3
- package/dist/contracts/handlers/gauge-registry-handler.js +2 -2
- package/dist/contracts/handlers/guardian-module-handler.cjs +1 -1
- package/dist/contracts/handlers/guardian-module-handler.d.ts +9 -3
- package/dist/contracts/handlers/guardian-module-handler.js +2 -2
- package/dist/contracts/handlers/institutional-access-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/institutional-access-manager-handler.d.ts +9 -3
- package/dist/contracts/handlers/institutional-access-manager-handler.js +3 -3
- package/dist/contracts/handlers/institutional-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/institutional-vault-handler.d.ts +9 -3
- package/dist/contracts/handlers/institutional-vault-handler.js +2 -2
- package/dist/contracts/handlers/l1-reward-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/l1-reward-manager-handler.d.ts +9 -3
- package/dist/contracts/handlers/l1-reward-manager-handler.js +2 -2
- package/dist/contracts/handlers/l2-reward-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/l2-reward-manager-handler.d.ts +9 -3
- package/dist/contracts/handlers/l2-reward-manager-handler.js +2 -2
- package/dist/contracts/handlers/lagoon-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/lagoon-vault-handler.d.ts +9 -3
- package/dist/contracts/handlers/lagoon-vault-handler.js +2 -2
- package/dist/contracts/handlers/mtw-carrot-handler.cjs +1 -1
- package/dist/contracts/handlers/mtw-carrot-handler.d.ts +9 -3
- package/dist/contracts/handlers/mtw-carrot-handler.js +2 -2
- package/dist/contracts/handlers/nucleus-accountant-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-accountant-handler.d.ts +9 -3
- package/dist/contracts/handlers/nucleus-accountant-handler.js +1 -1
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.d.ts +10 -4
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.js +2 -2
- package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-boring-vault-handler.d.ts +9 -3
- package/dist/contracts/handlers/nucleus-boring-vault-handler.js +2 -2
- package/dist/contracts/handlers/nucleus-teller-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-teller-handler.d.ts +9 -3
- package/dist/contracts/handlers/nucleus-teller-handler.js +2 -2
- package/dist/contracts/handlers/puf-locker-handler.cjs +1 -1
- package/dist/contracts/handlers/puf-locker-handler.d.ts +9 -3
- package/dist/contracts/handlers/puf-locker-handler.js +2 -2
- package/dist/contracts/handlers/puffer-depositor-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-depositor-handler.d.ts +9 -3
- package/dist/contracts/handlers/puffer-depositor-handler.js +2 -2
- package/dist/contracts/handlers/puffer-l2-depositor-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-l2-depositor-handler.d.ts +9 -3
- package/dist/contracts/handlers/puffer-l2-depositor-handler.js +2 -2
- package/dist/contracts/handlers/puffer-oracle-v2-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-oracle-v2-handler.d.ts +9 -3
- package/dist/contracts/handlers/puffer-oracle-v2-handler.js +2 -2
- package/dist/contracts/handlers/puffer-protocol-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-protocol-handler.d.ts +9 -3
- package/dist/contracts/handlers/puffer-protocol-handler.js +2 -2
- package/dist/contracts/handlers/puffer-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-vault-handler.d.ts +9 -3
- package/dist/contracts/handlers/puffer-vault-handler.js +2 -2
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.d.ts +9 -3
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js +2 -2
- package/dist/contracts/handlers/validator-ticket-handler.cjs +1 -1
- package/dist/contracts/handlers/validator-ticket-handler.d.ts +10 -4
- package/dist/contracts/handlers/validator-ticket-handler.js +2 -2
- package/dist/contracts/handlers/vl-puffer-handler.cjs +1 -1
- package/dist/contracts/handlers/vl-puffer-handler.d.ts +9 -3
- package/dist/contracts/handlers/vl-puffer-handler.js +2 -2
- package/dist/contracts/tokens.cjs +1 -1
- package/dist/contracts/tokens.js +1 -1
- package/dist/contracts/vaults-addresses.cjs +1 -1
- package/dist/contracts/vaults-addresses.js +1 -1
- package/dist/{getContract-C6a8L2Jd.cjs → getContract-BinxcNSi.cjs} +2 -2
- package/dist/{getContract-C6a8L2Jd.cjs.map → getContract-BinxcNSi.cjs.map} +1 -1
- package/dist/{getContract-DRjKmuyC.js → getContract-DaCKXI8P.js} +2 -2
- package/dist/{getContract-DRjKmuyC.js.map → getContract-DaCKXI8P.js.map} +1 -1
- package/dist/http-BC-nqLLb.cjs +5 -0
- package/dist/http-BC-nqLLb.cjs.map +1 -0
- package/dist/{http-ZcKHvn9V.js → http-DfLfk9B5.js} +1343 -1302
- package/dist/http-DfLfk9B5.js.map +1 -0
- package/dist/{localBatchGatewayRequest-BTy8p6qj.cjs → localBatchGatewayRequest-B7XKTHRK.cjs} +2 -2
- package/dist/{localBatchGatewayRequest-BTy8p6qj.cjs.map → localBatchGatewayRequest-B7XKTHRK.cjs.map} +1 -1
- package/dist/{localBatchGatewayRequest-Cb0QKL0s.js → localBatchGatewayRequest-C1C2Kpcs.js} +3 -3
- package/dist/{localBatchGatewayRequest-Cb0QKL0s.js.map → localBatchGatewayRequest-C1C2Kpcs.js.map} +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.js +1 -1
- package/dist/{secp256k1-Dx1prb1E.js → secp256k1-BNsewQvi.js} +2 -2
- package/dist/{secp256k1-Dx1prb1E.js.map → secp256k1-BNsewQvi.js.map} +1 -1
- package/dist/{secp256k1-CzsL7iVx.cjs → secp256k1-Be7RiBch.cjs} +2 -2
- package/dist/{secp256k1-CzsL7iVx.cjs.map → secp256k1-Be7RiBch.cjs.map} +1 -1
- package/dist/utils/version.cjs +1 -1
- package/dist/utils/version.js +1 -1
- package/dist/writeContract-De1cMFmW.cjs +36 -0
- package/dist/writeContract-De1cMFmW.cjs.map +1 -0
- package/dist/{writeContract-BFxyLFA9.js → writeContract-DordYfu2.js} +1650 -1479
- package/dist/writeContract-DordYfu2.js.map +1 -0
- package/package.json +2 -2
- package/dist/constants-4-ehn8UI.cjs +0 -9
- package/dist/constants-4-ehn8UI.cjs.map +0 -1
- package/dist/constants-BO_Dvglw.js.map +0 -1
- package/dist/http-CRYDzx7w.cjs +0 -5
- package/dist/http-CRYDzx7w.cjs.map +0 -1
- package/dist/http-ZcKHvn9V.js.map +0 -1
- package/dist/writeContract-BFxyLFA9.js.map +0 -1
- package/dist/writeContract-HBsqM_Od.cjs +0 -36
- package/dist/writeContract-HBsqM_Od.cjs.map +0 -1
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { B as
|
|
2
|
-
import { B as
|
|
3
|
-
import { l as yt } from "./localBatchGatewayRequest-
|
|
4
|
-
import { secp256k1 as Fs } from "./secp256k1-
|
|
1
|
+
import { B as St, C as yn, D as bn, E as Or, F as Bt, G as $t, J as Dr, K as _t, L as qr, M as ae, N as R, O as G, P as gn, Q as Lr, m as Mr, R as Y, S as F, V as Ve, W as Ge, X as ut, Y as wn, h as U, Z as vn, _ as K, $ as be, g as T, a0 as zt, a1 as ge, a2 as Ut, a3 as En, r as D, a4 as _e, a5 as Ft, a6 as jr, a7 as ze, a8 as Ue, a9 as Pn, aa as Hr, ab as dt, ac as xn, ad as Wr, j as Fe, ae as Tn, af as xe, H as le, ag as Vr, U as Me, ah as Ot, ai as Dt, aj as qt, ak as Lt, al as Mt, am as jt, an as Ht, ao as Wt, ap as Vt, aq as Gt, ar as Zt, as as Ze, T as Jt, at as Yt, au as Kt, av as Je, aw as Ye, ax as Qt, ay as Xt, az as en, aA as tn, aB as nn, aC as Gr, aD as Zr, aE as Jr, l as An, aF as Q, aG as oe, aH as q, aI as pe, aJ as In, aK as Yr, aL as ft, aM as j, aN as Kr, aO as Qr, aP as Xr, aQ as Oe, aR as Ke, aS as Rn, aT as Cn, aU as kn, aV as Nn, aW as es, aX as ts, aY as ns, aZ as rs, a_ as Qe, a$ as ss, b0 as as, b1 as Sn, b2 as rn, b3 as Bn, b4 as os, k as $n, b5 as is, b6 as cs, b7 as te, b8 as us, b9 as ds, ba as fs, bb as ls, bc as lt, bd as _n, be as ht, w as hs, s as ps, bf as zn, bg as pt, bh as Un, bi as Fn, bj as ms, bk as ys, bl as bs, a as gs, bm as we, bn as ws, e as vs, c as Es, bo as ie, bp as On, bq as Ps, br as Re, d as Dn, bs as xs, bt as Ts } from "./writeContract-DordYfu2.js";
|
|
2
|
+
import { B as _, n as C, c as Z, h as J, F as ke, ai as As, D as qn, aj as sn, i as Ln, b as me, a as Is, v as O, s as he, t as ce, ad as Ne, ak as mt, a6 as Mn, z as Se, u as Xe, w as jn, I as Rs, al as Cs, am as Hn, a5 as ks, an as Wn, ao as Vn, a3 as Ns, a0 as Ss, J as Bs, e as $s, ap as _s, aq as zs, ar as Gn, L as Us } from "./constants-0GZgavMM.js";
|
|
3
|
+
import { l as yt } from "./localBatchGatewayRequest-C1C2Kpcs.js";
|
|
4
|
+
import { secp256k1 as Fs } from "./secp256k1-BNsewQvi.js";
|
|
5
5
|
function an(e) {
|
|
6
6
|
let t;
|
|
7
7
|
if (typeof e == "string")
|
|
8
|
-
t =
|
|
8
|
+
t = St(e);
|
|
9
9
|
else {
|
|
10
10
|
const n = yn(e), r = e.length;
|
|
11
11
|
for (let s = 0; s < r; s++) {
|
|
12
12
|
const a = e[s];
|
|
13
13
|
if (!bn(a)) {
|
|
14
|
-
t =
|
|
14
|
+
t = St(a, n);
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
if (!t)
|
|
20
|
-
throw new
|
|
20
|
+
throw new Or({ signature: e });
|
|
21
21
|
return t;
|
|
22
22
|
}
|
|
23
23
|
function on(e) {
|
|
24
24
|
const t = [];
|
|
25
25
|
if (typeof e == "string") {
|
|
26
|
-
const n =
|
|
26
|
+
const n = Bt(e), r = n.length;
|
|
27
27
|
for (let s = 0; s < r; s++)
|
|
28
28
|
t.push($t(n[s], { modifiers: _t }));
|
|
29
29
|
} else {
|
|
@@ -32,23 +32,23 @@ function on(e) {
|
|
|
32
32
|
const a = e[s];
|
|
33
33
|
if (bn(a))
|
|
34
34
|
continue;
|
|
35
|
-
const o =
|
|
35
|
+
const o = Bt(a), i = o.length;
|
|
36
36
|
for (let c = 0; c < i; c++)
|
|
37
37
|
t.push($t(o[c], { modifiers: _t, structs: n }));
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
if (t.length === 0)
|
|
41
|
-
throw new
|
|
41
|
+
throw new Dr({ params: e });
|
|
42
42
|
return t;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function ve(e, t) {
|
|
45
45
|
if (ne(e) > t)
|
|
46
|
-
throw new
|
|
46
|
+
throw new Ks({
|
|
47
47
|
givenSize: ne(e),
|
|
48
48
|
maxSize: t
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
const
|
|
51
|
+
const H = {
|
|
52
52
|
zero: 48,
|
|
53
53
|
nine: 57,
|
|
54
54
|
A: 65,
|
|
@@ -57,19 +57,19 @@ const W = {
|
|
|
57
57
|
f: 102
|
|
58
58
|
};
|
|
59
59
|
function cn(e) {
|
|
60
|
-
if (e >=
|
|
61
|
-
return e -
|
|
62
|
-
if (e >=
|
|
63
|
-
return e - (
|
|
64
|
-
if (e >=
|
|
65
|
-
return e - (
|
|
66
|
-
}
|
|
67
|
-
function
|
|
60
|
+
if (e >= H.zero && e <= H.nine)
|
|
61
|
+
return e - H.zero;
|
|
62
|
+
if (e >= H.A && e <= H.F)
|
|
63
|
+
return e - (H.A - 10);
|
|
64
|
+
if (e >= H.a && e <= H.f)
|
|
65
|
+
return e - (H.a - 10);
|
|
66
|
+
}
|
|
67
|
+
function Os(e, t = {}) {
|
|
68
68
|
const { dir: n, size: r = 32 } = t;
|
|
69
69
|
if (r === 0)
|
|
70
70
|
return e;
|
|
71
71
|
if (e.length > r)
|
|
72
|
-
throw new
|
|
72
|
+
throw new Qs({
|
|
73
73
|
size: e.length,
|
|
74
74
|
targetSize: r,
|
|
75
75
|
type: "Bytes"
|
|
@@ -81,41 +81,41 @@ function Us(e, t = {}) {
|
|
|
81
81
|
}
|
|
82
82
|
return s;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function Zn(e, t = {}) {
|
|
85
85
|
const { dir: n = "left" } = t;
|
|
86
86
|
let r = e, s = 0;
|
|
87
87
|
for (let a = 0; a < r.length - 1 && r[n === "left" ? a : r.length - a - 1].toString() === "0"; a++)
|
|
88
88
|
s++;
|
|
89
89
|
return r = n === "left" ? r.slice(s) : r.slice(0, r.length - s), r;
|
|
90
90
|
}
|
|
91
|
-
const
|
|
92
|
-
function qs(e) {
|
|
93
|
-
return e instanceof Uint8Array ? e : typeof e == "string" ? Zn(e) : Ls(e);
|
|
94
|
-
}
|
|
91
|
+
const Ds = /* @__PURE__ */ new TextDecoder(), qs = /* @__PURE__ */ new TextEncoder();
|
|
95
92
|
function Ls(e) {
|
|
93
|
+
return e instanceof Uint8Array ? e : typeof e == "string" ? Jn(e) : Ms(e);
|
|
94
|
+
}
|
|
95
|
+
function Ms(e) {
|
|
96
96
|
return e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function Jn(e, t = {}) {
|
|
99
99
|
const { size: n } = t;
|
|
100
100
|
let r = e;
|
|
101
|
-
n && (
|
|
101
|
+
n && (qr(e, n), r = ae(e, n));
|
|
102
102
|
let s = r.slice(2);
|
|
103
103
|
s.length % 2 && (s = `0${s}`);
|
|
104
104
|
const a = s.length / 2, o = new Uint8Array(a);
|
|
105
105
|
for (let i = 0, c = 0; i < a; i++) {
|
|
106
|
-
const
|
|
107
|
-
if (
|
|
108
|
-
throw new
|
|
109
|
-
o[i] =
|
|
106
|
+
const d = cn(s.charCodeAt(c++)), u = cn(s.charCodeAt(c++));
|
|
107
|
+
if (d === void 0 || u === void 0)
|
|
108
|
+
throw new R(`Invalid byte sequence ("${s[c - 2]}${s[c - 1]}" in "${s}").`);
|
|
109
|
+
o[i] = d << 4 | u;
|
|
110
110
|
}
|
|
111
111
|
return o;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
const { size: n } = t, r =
|
|
115
|
-
return typeof n == "number" ? (
|
|
113
|
+
function js(e, t = {}) {
|
|
114
|
+
const { size: n } = t, r = qs.encode(e);
|
|
115
|
+
return typeof n == "number" ? (ve(r, n), Hs(r, n)) : r;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
return
|
|
117
|
+
function Hs(e, t) {
|
|
118
|
+
return Os(e, { dir: "right", size: t });
|
|
119
119
|
}
|
|
120
120
|
function ne(e) {
|
|
121
121
|
return e.length;
|
|
@@ -126,35 +126,35 @@ function Ws(e, t, n, r = {}) {
|
|
|
126
126
|
}
|
|
127
127
|
function Vs(e, t = {}) {
|
|
128
128
|
const { size: n } = t;
|
|
129
|
-
typeof n < "u" &&
|
|
129
|
+
typeof n < "u" && ve(e, n);
|
|
130
130
|
const r = G(e, t);
|
|
131
|
-
return
|
|
131
|
+
return Lr(r, t);
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function Gs(e, t = {}) {
|
|
134
134
|
const { size: n } = t;
|
|
135
135
|
let r = e;
|
|
136
|
-
if (typeof n < "u" && (
|
|
137
|
-
throw new
|
|
136
|
+
if (typeof n < "u" && (ve(r, n), r = Yn(r)), r.length > 1 || r[0] > 1)
|
|
137
|
+
throw new Ys(r);
|
|
138
138
|
return !!r[0];
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function W(e, t = {}) {
|
|
141
141
|
const { size: n } = t;
|
|
142
|
-
typeof n < "u" &&
|
|
142
|
+
typeof n < "u" && ve(e, n);
|
|
143
143
|
const r = G(e, t);
|
|
144
144
|
return gn(r, t);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function Zs(e, t = {}) {
|
|
147
147
|
const { size: n } = t;
|
|
148
148
|
let r = e;
|
|
149
|
-
return typeof n < "u" && (
|
|
149
|
+
return typeof n < "u" && (ve(r, n), r = Js(r)), Ds.decode(r);
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
return
|
|
151
|
+
function Yn(e) {
|
|
152
|
+
return Zn(e, { dir: "left" });
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
return
|
|
154
|
+
function Js(e) {
|
|
155
|
+
return Zn(e, { dir: "right" });
|
|
156
156
|
}
|
|
157
|
-
class
|
|
157
|
+
class Ys extends R {
|
|
158
158
|
constructor(t) {
|
|
159
159
|
super(`Bytes value \`${t}\` is not a valid boolean.`, {
|
|
160
160
|
metaMessages: [
|
|
@@ -168,7 +168,7 @@ class Js extends I {
|
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
class
|
|
171
|
+
class Ks extends R {
|
|
172
172
|
constructor({ givenSize: t, maxSize: n }) {
|
|
173
173
|
super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`), Object.defineProperty(this, "name", {
|
|
174
174
|
enumerable: !0,
|
|
@@ -178,7 +178,7 @@ class Ys extends I {
|
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
class
|
|
181
|
+
class Qs extends R {
|
|
182
182
|
constructor({ size: t, targetSize: n, type: r }) {
|
|
183
183
|
super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`), Object.defineProperty(this, "name", {
|
|
184
184
|
enumerable: !0,
|
|
@@ -188,7 +188,7 @@ class Ks extends I {
|
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
class
|
|
191
|
+
class Xs extends _ {
|
|
192
192
|
constructor(t) {
|
|
193
193
|
super(`Call bundle failed with status: ${t.statusCode}`, {
|
|
194
194
|
name: "BundleFailedError"
|
|
@@ -200,114 +200,126 @@ class Qs extends $ {
|
|
|
200
200
|
}), this.result = t;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function Be(e, { delay: t = 100, retryCount: n = 2, shouldRetry: r = () => !0 } = {}) {
|
|
204
204
|
return new Promise((s, a) => {
|
|
205
205
|
const o = async ({ count: i = 0 } = {}) => {
|
|
206
|
-
const c = async ({ error:
|
|
207
|
-
const
|
|
208
|
-
|
|
206
|
+
const c = async ({ error: d }) => {
|
|
207
|
+
const u = typeof t == "function" ? t({ count: i, error: d }) : t;
|
|
208
|
+
u && await Mr(u), o({ count: i + 1 });
|
|
209
209
|
};
|
|
210
210
|
try {
|
|
211
|
-
const
|
|
212
|
-
s(
|
|
213
|
-
} catch (
|
|
214
|
-
if (i < n && await r({ count: i, error:
|
|
215
|
-
return c({ error:
|
|
216
|
-
a(
|
|
211
|
+
const d = await e();
|
|
212
|
+
s(d);
|
|
213
|
+
} catch (d) {
|
|
214
|
+
if (i < n && await r({ count: i, error: d }))
|
|
215
|
+
return c({ error: d });
|
|
216
|
+
a(d);
|
|
217
217
|
}
|
|
218
218
|
};
|
|
219
219
|
o();
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
|
-
const
|
|
222
|
+
const Kn = "0x5792579257925792579257925792579257925792579257925792579257925792", Qn = C(0, {
|
|
223
223
|
size: 32
|
|
224
224
|
});
|
|
225
|
-
async function
|
|
226
|
-
const { account: n = e.account,
|
|
227
|
-
|
|
225
|
+
async function Xn(e, t) {
|
|
226
|
+
const { account: n = e.account, chain: r = e.chain, experimental_fallback: s, experimental_fallbackDelay: a = 32, forceAtomic: o = !1, id: i, version: c = "2.0.0" } = t, d = n ? F(n) : null;
|
|
227
|
+
let u = t.capabilities;
|
|
228
|
+
e.dataSuffix && !t.capabilities?.dataSuffix && (typeof e.dataSuffix == "string" ? u = {
|
|
229
|
+
...t.capabilities,
|
|
230
|
+
dataSuffix: { value: e.dataSuffix, optional: !0 }
|
|
231
|
+
} : u = {
|
|
232
|
+
...t.capabilities,
|
|
233
|
+
dataSuffix: {
|
|
234
|
+
value: e.dataSuffix.value,
|
|
235
|
+
...e.dataSuffix.required ? {} : { optional: !0 }
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
const f = t.calls.map((l) => {
|
|
239
|
+
const h = l, p = h.abi ? Y({
|
|
228
240
|
abi: h.abi,
|
|
229
241
|
functionName: h.functionName,
|
|
230
242
|
args: h.args
|
|
231
243
|
}) : h.data;
|
|
232
244
|
return {
|
|
233
|
-
data: h.dataSuffix && p ?
|
|
245
|
+
data: h.dataSuffix && p ? Z([p, h.dataSuffix]) : p,
|
|
234
246
|
to: h.to,
|
|
235
247
|
value: h.value ? C(h.value) : void 0
|
|
236
248
|
};
|
|
237
249
|
});
|
|
238
250
|
try {
|
|
239
|
-
const
|
|
251
|
+
const l = await e.request({
|
|
240
252
|
method: "wallet_sendCalls",
|
|
241
253
|
params: [
|
|
242
254
|
{
|
|
243
|
-
atomicRequired:
|
|
244
|
-
calls:
|
|
245
|
-
capabilities:
|
|
246
|
-
chainId: C(
|
|
255
|
+
atomicRequired: o,
|
|
256
|
+
calls: f,
|
|
257
|
+
capabilities: u,
|
|
258
|
+
chainId: C(r.id),
|
|
247
259
|
from: d?.address,
|
|
248
|
-
id:
|
|
249
|
-
version:
|
|
260
|
+
id: i,
|
|
261
|
+
version: c
|
|
250
262
|
}
|
|
251
263
|
]
|
|
252
264
|
}, { retryCount: 0 });
|
|
253
|
-
return typeof
|
|
254
|
-
} catch (
|
|
255
|
-
const h =
|
|
256
|
-
if (
|
|
265
|
+
return typeof l == "string" ? { id: l } : l;
|
|
266
|
+
} catch (l) {
|
|
267
|
+
const h = l;
|
|
268
|
+
if (s && (h.name === "MethodNotFoundRpcError" || h.name === "MethodNotSupportedRpcError" || h.name === "UnknownRpcError" || h.details.toLowerCase().includes("does not exist / is not available") || h.details.toLowerCase().includes("missing or invalid. request()") || h.details.toLowerCase().includes("did not match any variant of untagged enum") || h.details.toLowerCase().includes("account upgraded to unsupported contract") || h.details.toLowerCase().includes("eip-7702 not supported") || h.details.toLowerCase().includes("unsupported wc_ method") || // magic.link
|
|
257
269
|
h.details.toLowerCase().includes("feature toggled misconfigured") || // Trust Wallet
|
|
258
270
|
h.details.toLowerCase().includes("jsonrpcengine: response has no error or result for request"))) {
|
|
259
|
-
if (
|
|
271
|
+
if (u && Object.values(u).some((b) => !b.optional)) {
|
|
260
272
|
const b = "non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";
|
|
261
|
-
throw new
|
|
273
|
+
throw new Ve(new _(b, {
|
|
262
274
|
details: b
|
|
263
275
|
}));
|
|
264
276
|
}
|
|
265
|
-
if (
|
|
277
|
+
if (o && f.length > 1) {
|
|
266
278
|
const m = "`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";
|
|
267
|
-
throw new Ge(new
|
|
279
|
+
throw new Ge(new _(m, {
|
|
268
280
|
details: m
|
|
269
281
|
}));
|
|
270
282
|
}
|
|
271
283
|
const p = [];
|
|
272
|
-
for (const m of
|
|
284
|
+
for (const m of f) {
|
|
273
285
|
const b = ut(e, {
|
|
274
286
|
account: d,
|
|
275
|
-
chain:
|
|
287
|
+
chain: r,
|
|
276
288
|
data: m.data,
|
|
277
289
|
to: m.to,
|
|
278
|
-
value: m.value ?
|
|
290
|
+
value: m.value ? J(m.value) : void 0
|
|
279
291
|
});
|
|
280
|
-
p.push(b),
|
|
292
|
+
p.push(b), a > 0 && await new Promise((w) => setTimeout(w, a));
|
|
281
293
|
}
|
|
282
294
|
const g = await Promise.allSettled(p);
|
|
283
295
|
if (g.every((m) => m.status === "rejected"))
|
|
284
296
|
throw g[0].reason;
|
|
285
|
-
const y = g.map((m) => m.status === "fulfilled" ? m.value :
|
|
297
|
+
const y = g.map((m) => m.status === "fulfilled" ? m.value : Qn);
|
|
286
298
|
return {
|
|
287
|
-
id:
|
|
299
|
+
id: Z([
|
|
288
300
|
...y,
|
|
289
|
-
C(
|
|
290
|
-
|
|
301
|
+
C(r.id, { size: 32 }),
|
|
302
|
+
Kn
|
|
291
303
|
])
|
|
292
304
|
};
|
|
293
305
|
}
|
|
294
|
-
throw wn(
|
|
306
|
+
throw wn(l, {
|
|
295
307
|
...t,
|
|
296
308
|
account: d,
|
|
297
309
|
chain: t.chain
|
|
298
310
|
});
|
|
299
311
|
}
|
|
300
312
|
}
|
|
301
|
-
async function
|
|
302
|
-
async function n(
|
|
303
|
-
if (
|
|
304
|
-
const
|
|
313
|
+
async function er(e, t) {
|
|
314
|
+
async function n(u) {
|
|
315
|
+
if (u.endsWith(Kn.slice(2))) {
|
|
316
|
+
const l = qn(sn(u, -64, -32)), h = sn(u, 0, -64).slice(2).match(/.{1,64}/g), p = await Promise.all(h.map((y) => Qn.slice(2) !== y ? e.request({
|
|
305
317
|
method: "eth_getTransactionReceipt",
|
|
306
318
|
params: [`0x${y}`]
|
|
307
319
|
}, { dedupe: !0 }) : void 0)), g = p.some((y) => y === null) ? 100 : p.every((y) => y?.status === "0x1") ? 200 : p.every((y) => y?.status === "0x0") ? 500 : 600;
|
|
308
320
|
return {
|
|
309
321
|
atomic: !1,
|
|
310
|
-
chainId: ke(
|
|
322
|
+
chainId: ke(l),
|
|
311
323
|
receipts: p.filter(Boolean),
|
|
312
324
|
status: g,
|
|
313
325
|
version: "2.0.0"
|
|
@@ -315,30 +327,30 @@ async function Xn(e, t) {
|
|
|
315
327
|
}
|
|
316
328
|
return e.request({
|
|
317
329
|
method: "wallet_getCallsStatus",
|
|
318
|
-
params: [
|
|
330
|
+
params: [u]
|
|
319
331
|
});
|
|
320
332
|
}
|
|
321
|
-
const { atomic: r = !1, chainId: s, receipts: a, version: o = "2.0.0", ...i } = await n(t.id), [c,
|
|
322
|
-
const
|
|
323
|
-
return
|
|
333
|
+
const { atomic: r = !1, chainId: s, receipts: a, version: o = "2.0.0", ...i } = await n(t.id), [c, d] = (() => {
|
|
334
|
+
const u = i.status;
|
|
335
|
+
return u >= 100 && u < 200 ? ["pending", u] : u >= 200 && u < 300 ? ["success", u] : u >= 300 && u < 700 ? ["failure", u] : u === "CONFIRMED" ? ["success", 200] : u === "PENDING" ? ["pending", 100] : [void 0, u];
|
|
324
336
|
})();
|
|
325
337
|
return {
|
|
326
338
|
...i,
|
|
327
339
|
atomic: r,
|
|
328
340
|
// @ts-expect-error: for backwards compatibility
|
|
329
341
|
chainId: s ? ke(s) : void 0,
|
|
330
|
-
receipts: a?.map((
|
|
331
|
-
...
|
|
332
|
-
blockNumber:
|
|
333
|
-
gasUsed:
|
|
334
|
-
status: As[
|
|
342
|
+
receipts: a?.map((u) => ({
|
|
343
|
+
...u,
|
|
344
|
+
blockNumber: J(u.blockNumber),
|
|
345
|
+
gasUsed: J(u.gasUsed),
|
|
346
|
+
status: As[u.status]
|
|
335
347
|
})) ?? [],
|
|
336
|
-
statusCode:
|
|
348
|
+
statusCode: d,
|
|
337
349
|
status: c,
|
|
338
350
|
version: o
|
|
339
351
|
};
|
|
340
352
|
}
|
|
341
|
-
async function
|
|
353
|
+
async function tr(e, t) {
|
|
342
354
|
const {
|
|
343
355
|
id: n,
|
|
344
356
|
pollingInterval: r = e.pollingInterval,
|
|
@@ -348,18 +360,18 @@ async function er(e, t) {
|
|
|
348
360
|
// exponential backoff
|
|
349
361
|
timeout: i = 6e4,
|
|
350
362
|
throwOnFailure: c = !1
|
|
351
|
-
} = t,
|
|
363
|
+
} = t, d = U(["waitForCallsStatus", e.uid, n]), { promise: u, resolve: f, reject: l } = vn();
|
|
352
364
|
let h;
|
|
353
|
-
const p = K(
|
|
354
|
-
const y =
|
|
365
|
+
const p = K(d, { resolve: f, reject: l }, (g) => {
|
|
366
|
+
const y = be(async () => {
|
|
355
367
|
const m = (b) => {
|
|
356
368
|
clearTimeout(h), y(), b(), p();
|
|
357
369
|
};
|
|
358
370
|
try {
|
|
359
|
-
const b = await
|
|
360
|
-
const w = await
|
|
371
|
+
const b = await Be(async () => {
|
|
372
|
+
const w = await T(e, er, "getCallsStatus")({ id: n });
|
|
361
373
|
if (c && w.status === "failure")
|
|
362
|
-
throw new
|
|
374
|
+
throw new Xs(w);
|
|
363
375
|
return w;
|
|
364
376
|
}, {
|
|
365
377
|
retryCount: a,
|
|
@@ -378,147 +390,149 @@ async function er(e, t) {
|
|
|
378
390
|
return y;
|
|
379
391
|
});
|
|
380
392
|
return h = i ? setTimeout(() => {
|
|
381
|
-
p(), clearTimeout(h),
|
|
382
|
-
}, i) : void 0, await
|
|
393
|
+
p(), clearTimeout(h), l(new ea({ id: n }));
|
|
394
|
+
}, i) : void 0, await u;
|
|
383
395
|
}
|
|
384
|
-
class
|
|
396
|
+
class ea extends _ {
|
|
385
397
|
constructor({ id: t }) {
|
|
386
398
|
super(`Timed out while waiting for call bundle with id "${t}" to be confirmed.`, { name: "WaitForCallsStatusTimeoutError" });
|
|
387
399
|
}
|
|
388
400
|
}
|
|
389
401
|
const et = 256;
|
|
390
|
-
let
|
|
391
|
-
function
|
|
392
|
-
if (!
|
|
393
|
-
|
|
402
|
+
let Te = et, Ae;
|
|
403
|
+
function nr(e = 11) {
|
|
404
|
+
if (!Ae || Te + e > et * 2) {
|
|
405
|
+
Ae = "", Te = 0;
|
|
394
406
|
for (let t = 0; t < et; t++)
|
|
395
|
-
|
|
407
|
+
Ae += (256 + Math.random() * 256 | 0).toString(16).substring(1);
|
|
396
408
|
}
|
|
397
|
-
return
|
|
409
|
+
return Ae.substring(Te, Te++ + e);
|
|
398
410
|
}
|
|
399
|
-
function
|
|
400
|
-
const { batch: t, chain: n, ccipRead: r,
|
|
411
|
+
function rr(e) {
|
|
412
|
+
const { batch: t, chain: n, ccipRead: r, dataSuffix: s, key: a = "base", name: o = "Base Client", type: i = "base" } = e, c = e.experimental_blockTag ?? (typeof n?.experimental_preconfirmationTime == "number" ? "pending" : void 0), d = n?.blockTime ?? 12e3, u = Math.min(Math.max(Math.floor(d / 2), 500), 4e3), f = e.pollingInterval ?? u, l = e.cacheTime ?? f, h = e.account ? F(e.account) : void 0, { config: p, request: g, value: y } = e.transport({
|
|
413
|
+
account: h,
|
|
401
414
|
chain: n,
|
|
402
|
-
pollingInterval:
|
|
403
|
-
}),
|
|
404
|
-
account:
|
|
415
|
+
pollingInterval: f
|
|
416
|
+
}), m = { ...p, ...y }, b = {
|
|
417
|
+
account: h,
|
|
405
418
|
batch: t,
|
|
406
419
|
cacheTime: l,
|
|
407
420
|
ccipRead: r,
|
|
408
421
|
chain: n,
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
422
|
+
dataSuffix: s,
|
|
423
|
+
key: a,
|
|
424
|
+
name: o,
|
|
425
|
+
pollingInterval: f,
|
|
426
|
+
request: g,
|
|
427
|
+
transport: m,
|
|
428
|
+
type: i,
|
|
429
|
+
uid: nr(),
|
|
430
|
+
...c ? { experimental_blockTag: c } : {}
|
|
417
431
|
};
|
|
418
|
-
function
|
|
419
|
-
return (
|
|
420
|
-
const
|
|
421
|
-
for (const
|
|
422
|
-
delete
|
|
423
|
-
const
|
|
424
|
-
return Object.assign(
|
|
432
|
+
function w(P) {
|
|
433
|
+
return (A) => {
|
|
434
|
+
const x = A(P);
|
|
435
|
+
for (const I in b)
|
|
436
|
+
delete x[I];
|
|
437
|
+
const v = { ...P, ...x };
|
|
438
|
+
return Object.assign(v, { extend: w(v) });
|
|
425
439
|
};
|
|
426
440
|
}
|
|
427
|
-
return Object.assign(
|
|
441
|
+
return Object.assign(b, { extend: w(b) });
|
|
428
442
|
}
|
|
429
443
|
function bt(e) {
|
|
430
|
-
if (!(e instanceof
|
|
444
|
+
if (!(e instanceof _))
|
|
431
445
|
return !1;
|
|
432
446
|
const t = e.walk((n) => n instanceof zt);
|
|
433
447
|
return t instanceof zt ? t.data?.errorName === "HttpError" || t.data?.errorName === "ResolverError" || t.data?.errorName === "ResolverNotContract" || t.data?.errorName === "ResolverNotFound" || t.data?.errorName === "ReverseAddressMismatch" || t.data?.errorName === "UnsupportedResolverProfile" : !1;
|
|
434
448
|
}
|
|
435
|
-
function
|
|
449
|
+
function sr(e) {
|
|
436
450
|
if (e.length !== 66 || e.indexOf("[") !== 0 || e.indexOf("]") !== 65)
|
|
437
451
|
return null;
|
|
438
452
|
const t = `0x${e.slice(1, 65)}`;
|
|
439
|
-
return
|
|
453
|
+
return Ln(t) ? t : null;
|
|
440
454
|
}
|
|
441
455
|
function tt(e) {
|
|
442
456
|
let t = new Uint8Array(32).fill(0);
|
|
443
457
|
if (!e)
|
|
444
|
-
return
|
|
458
|
+
return me(t);
|
|
445
459
|
const n = e.split(".");
|
|
446
460
|
for (let r = n.length - 1; r >= 0; r -= 1) {
|
|
447
|
-
const s =
|
|
448
|
-
t = O(
|
|
461
|
+
const s = sr(n[r]), a = s ? Is(s) : O(he(n[r]), "bytes");
|
|
462
|
+
t = O(Z([t, a]), "bytes");
|
|
449
463
|
}
|
|
450
|
-
return
|
|
464
|
+
return me(t);
|
|
451
465
|
}
|
|
452
|
-
function
|
|
466
|
+
function ta(e) {
|
|
453
467
|
return `[${e.slice(2)}]`;
|
|
454
468
|
}
|
|
455
|
-
function
|
|
469
|
+
function na(e) {
|
|
456
470
|
const t = new Uint8Array(32).fill(0);
|
|
457
|
-
return e ?
|
|
471
|
+
return e ? sr(e) || O(he(e)) : me(t);
|
|
458
472
|
}
|
|
459
473
|
function gt(e) {
|
|
460
474
|
const t = e.replace(/^\.|\.$/gm, "");
|
|
461
475
|
if (t.length === 0)
|
|
462
476
|
return new Uint8Array(1);
|
|
463
|
-
const n = new Uint8Array(
|
|
477
|
+
const n = new Uint8Array(he(t).byteLength + 2);
|
|
464
478
|
let r = 0;
|
|
465
479
|
const s = t.split(".");
|
|
466
480
|
for (let a = 0; a < s.length; a++) {
|
|
467
|
-
let o =
|
|
468
|
-
o.byteLength > 255 && (o =
|
|
481
|
+
let o = he(s[a]);
|
|
482
|
+
o.byteLength > 255 && (o = he(ta(na(s[a])))), n[r] = o.length, n.set(o, r + 1), r += o.length + 1;
|
|
469
483
|
}
|
|
470
484
|
return n.byteLength !== r + 1 ? n.slice(0, r + 1) : n;
|
|
471
485
|
}
|
|
472
|
-
async function
|
|
473
|
-
const { blockNumber: n, blockTag: r, coinType: s, name: a, gatewayUrls: o, strict: i } = t, { chain: c } = e,
|
|
486
|
+
async function ra(e, t) {
|
|
487
|
+
const { blockNumber: n, blockTag: r, coinType: s, name: a, gatewayUrls: o, strict: i } = t, { chain: c } = e, d = (() => {
|
|
474
488
|
if (t.universalResolverAddress)
|
|
475
489
|
return t.universalResolverAddress;
|
|
476
490
|
if (!c)
|
|
477
491
|
throw new Error("client chain not configured. universalResolverAddress is required.");
|
|
478
|
-
return
|
|
492
|
+
return ge({
|
|
479
493
|
blockNumber: n,
|
|
480
494
|
chain: c,
|
|
481
495
|
contract: "ensUniversalResolver"
|
|
482
496
|
});
|
|
483
|
-
})(),
|
|
484
|
-
if (
|
|
497
|
+
})(), u = c?.ensTlds;
|
|
498
|
+
if (u && !u.some((l) => a.endsWith(l)))
|
|
485
499
|
return null;
|
|
486
|
-
const
|
|
500
|
+
const f = s != null ? [tt(a), BigInt(s)] : [tt(a)];
|
|
487
501
|
try {
|
|
488
|
-
const
|
|
489
|
-
abi:
|
|
502
|
+
const l = Y({
|
|
503
|
+
abi: Ut,
|
|
490
504
|
functionName: "addr",
|
|
491
|
-
args:
|
|
505
|
+
args: f
|
|
492
506
|
}), h = {
|
|
493
|
-
address:
|
|
507
|
+
address: d,
|
|
494
508
|
abi: En,
|
|
495
509
|
functionName: "resolveWithGateways",
|
|
496
510
|
args: [
|
|
497
|
-
|
|
498
|
-
|
|
511
|
+
ce(gt(a)),
|
|
512
|
+
l,
|
|
499
513
|
o ?? [yt]
|
|
500
514
|
],
|
|
501
515
|
blockNumber: n,
|
|
502
516
|
blockTag: r
|
|
503
|
-
}, g = await
|
|
517
|
+
}, g = await T(e, D, "readContract")(h);
|
|
504
518
|
if (g[0] === "0x")
|
|
505
519
|
return null;
|
|
506
520
|
const y = _e({
|
|
507
|
-
abi:
|
|
508
|
-
args:
|
|
521
|
+
abi: Ut,
|
|
522
|
+
args: f,
|
|
509
523
|
functionName: "addr",
|
|
510
524
|
data: g[0]
|
|
511
525
|
});
|
|
512
|
-
return y === "0x" ||
|
|
513
|
-
} catch (
|
|
526
|
+
return y === "0x" || qn(y) === "0x00" ? null : y;
|
|
527
|
+
} catch (l) {
|
|
514
528
|
if (i)
|
|
515
|
-
throw
|
|
516
|
-
if (bt(
|
|
529
|
+
throw l;
|
|
530
|
+
if (bt(l))
|
|
517
531
|
return null;
|
|
518
|
-
throw
|
|
532
|
+
throw l;
|
|
519
533
|
}
|
|
520
534
|
}
|
|
521
|
-
class
|
|
535
|
+
class sa extends _ {
|
|
522
536
|
constructor({ data: t }) {
|
|
523
537
|
super("Unable to extract image from metadata. The metadata may be malformed or invalid.", {
|
|
524
538
|
metaMessages: [
|
|
@@ -530,25 +544,25 @@ class ra extends $ {
|
|
|
530
544
|
});
|
|
531
545
|
}
|
|
532
546
|
}
|
|
533
|
-
class
|
|
547
|
+
class fe extends _ {
|
|
534
548
|
constructor({ reason: t }) {
|
|
535
549
|
super(`ENS NFT avatar URI is invalid. ${t}`, {
|
|
536
550
|
name: "EnsAvatarInvalidNftUriError"
|
|
537
551
|
});
|
|
538
552
|
}
|
|
539
553
|
}
|
|
540
|
-
class wt extends
|
|
554
|
+
class wt extends _ {
|
|
541
555
|
constructor({ uri: t }) {
|
|
542
556
|
super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`, { name: "EnsAvatarUriResolutionError" });
|
|
543
557
|
}
|
|
544
558
|
}
|
|
545
|
-
class
|
|
559
|
+
class aa extends _ {
|
|
546
560
|
constructor({ namespace: t }) {
|
|
547
561
|
super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`, { name: "EnsAvatarUnsupportedNamespaceError" });
|
|
548
562
|
}
|
|
549
563
|
}
|
|
550
|
-
const
|
|
551
|
-
async function
|
|
564
|
+
const oa = /(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/, ia = /^(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>\/.*)?$/, ca = /^data:([a-zA-Z\-/+]*);base64,([^"].*)/, ua = /^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;
|
|
565
|
+
async function da(e) {
|
|
552
566
|
try {
|
|
553
567
|
const t = await fetch(e, { method: "HEAD" });
|
|
554
568
|
return t.status === 200 ? t.headers.get("content-type")?.startsWith("image/") : !1;
|
|
@@ -566,74 +580,74 @@ async function ua(e) {
|
|
|
566
580
|
function un(e, t) {
|
|
567
581
|
return e ? e.endsWith("/") ? e.slice(0, -1) : e : t;
|
|
568
582
|
}
|
|
569
|
-
function
|
|
570
|
-
const n =
|
|
583
|
+
function ar({ uri: e, gatewayUrls: t }) {
|
|
584
|
+
const n = ca.test(e);
|
|
571
585
|
if (n)
|
|
572
586
|
return { uri: e, isOnChain: !0, isEncoded: n };
|
|
573
|
-
const r = un(t?.ipfs, "https://ipfs.io"), s = un(t?.arweave, "https://arweave.net"), a = e.match(
|
|
574
|
-
if (e.startsWith("http") && !
|
|
587
|
+
const r = un(t?.ipfs, "https://ipfs.io"), s = un(t?.arweave, "https://arweave.net"), a = e.match(oa), { protocol: o, subpath: i, target: c, subtarget: d = "" } = a?.groups || {}, u = o === "ipns:/" || i === "ipns/", f = o === "ipfs:/" || i === "ipfs/" || ia.test(e);
|
|
588
|
+
if (e.startsWith("http") && !u && !f) {
|
|
575
589
|
let h = e;
|
|
576
590
|
return t?.arweave && (h = e.replace(/https:\/\/arweave.net/g, t?.arweave)), { uri: h, isOnChain: !1, isEncoded: !1 };
|
|
577
591
|
}
|
|
578
|
-
if ((
|
|
592
|
+
if ((u || f) && c)
|
|
579
593
|
return {
|
|
580
|
-
uri: `${r}/${
|
|
594
|
+
uri: `${r}/${u ? "ipns" : "ipfs"}/${c}${d}`,
|
|
581
595
|
isOnChain: !1,
|
|
582
596
|
isEncoded: !1
|
|
583
597
|
};
|
|
584
598
|
if (o === "ar:/" && c)
|
|
585
599
|
return {
|
|
586
|
-
uri: `${s}/${c}${
|
|
600
|
+
uri: `${s}/${c}${d || ""}`,
|
|
587
601
|
isOnChain: !1,
|
|
588
602
|
isEncoded: !1
|
|
589
603
|
};
|
|
590
|
-
let
|
|
591
|
-
if (
|
|
604
|
+
let l = e.replace(ua, "");
|
|
605
|
+
if (l.startsWith("<svg") && (l = `data:image/svg+xml;base64,${btoa(l)}`), l.startsWith("data:") || l.startsWith("{"))
|
|
592
606
|
return {
|
|
593
|
-
uri:
|
|
607
|
+
uri: l,
|
|
594
608
|
isOnChain: !0,
|
|
595
609
|
isEncoded: !1
|
|
596
610
|
};
|
|
597
611
|
throw new wt({ uri: e });
|
|
598
612
|
}
|
|
599
|
-
function
|
|
613
|
+
function or(e) {
|
|
600
614
|
if (typeof e != "object" || !("image" in e) && !("image_url" in e) && !("image_data" in e))
|
|
601
|
-
throw new
|
|
615
|
+
throw new sa({ data: e });
|
|
602
616
|
return e.image || e.image_url || e.image_data;
|
|
603
617
|
}
|
|
604
|
-
async function
|
|
618
|
+
async function fa({ gatewayUrls: e, uri: t }) {
|
|
605
619
|
try {
|
|
606
620
|
const n = await fetch(t).then((s) => s.json());
|
|
607
621
|
return await vt({
|
|
608
622
|
gatewayUrls: e,
|
|
609
|
-
uri:
|
|
623
|
+
uri: or(n)
|
|
610
624
|
});
|
|
611
625
|
} catch {
|
|
612
626
|
throw new wt({ uri: t });
|
|
613
627
|
}
|
|
614
628
|
}
|
|
615
629
|
async function vt({ gatewayUrls: e, uri: t }) {
|
|
616
|
-
const { uri: n, isOnChain: r } =
|
|
617
|
-
if (r || await
|
|
630
|
+
const { uri: n, isOnChain: r } = ar({ uri: t, gatewayUrls: e });
|
|
631
|
+
if (r || await da(n))
|
|
618
632
|
return n;
|
|
619
633
|
throw new wt({ uri: t });
|
|
620
634
|
}
|
|
621
|
-
function
|
|
635
|
+
function la(e) {
|
|
622
636
|
let t = e;
|
|
623
637
|
t.startsWith("did:nft:") && (t = t.replace("did:nft:", "").replace(/_/g, "/"));
|
|
624
638
|
const [n, r, s] = t.split("/"), [a, o] = n.split(":"), [i, c] = r.split(":");
|
|
625
639
|
if (!a || a.toLowerCase() !== "eip155")
|
|
626
|
-
throw new
|
|
640
|
+
throw new fe({ reason: "Only EIP-155 supported" });
|
|
627
641
|
if (!o)
|
|
628
|
-
throw new
|
|
642
|
+
throw new fe({ reason: "Chain ID not found" });
|
|
629
643
|
if (!c)
|
|
630
|
-
throw new
|
|
644
|
+
throw new fe({
|
|
631
645
|
reason: "Contract address not found"
|
|
632
646
|
});
|
|
633
647
|
if (!s)
|
|
634
|
-
throw new
|
|
648
|
+
throw new fe({ reason: "Token ID not found" });
|
|
635
649
|
if (!i)
|
|
636
|
-
throw new
|
|
650
|
+
throw new fe({ reason: "ERC namespace not found" });
|
|
637
651
|
return {
|
|
638
652
|
chainID: Number.parseInt(o, 10),
|
|
639
653
|
namespace: i.toLowerCase(),
|
|
@@ -641,7 +655,7 @@ function fa(e) {
|
|
|
641
655
|
tokenID: s
|
|
642
656
|
};
|
|
643
657
|
}
|
|
644
|
-
async function
|
|
658
|
+
async function ha(e, { nft: t }) {
|
|
645
659
|
if (t.namespace === "erc721")
|
|
646
660
|
return D(e, {
|
|
647
661
|
address: t.contractAddress,
|
|
@@ -672,51 +686,51 @@ async function la(e, { nft: t }) {
|
|
|
672
686
|
functionName: "uri",
|
|
673
687
|
args: [BigInt(t.tokenID)]
|
|
674
688
|
});
|
|
675
|
-
throw new
|
|
676
|
-
}
|
|
677
|
-
async function ha(e, { gatewayUrls: t, record: n }) {
|
|
678
|
-
return /eip155:/i.test(n) ? pa(e, { gatewayUrls: t, record: n }) : vt({ uri: n, gatewayUrls: t });
|
|
689
|
+
throw new aa({ namespace: t.namespace });
|
|
679
690
|
}
|
|
680
691
|
async function pa(e, { gatewayUrls: t, record: n }) {
|
|
681
|
-
|
|
692
|
+
return /eip155:/i.test(n) ? ma(e, { gatewayUrls: t, record: n }) : vt({ uri: n, gatewayUrls: t });
|
|
693
|
+
}
|
|
694
|
+
async function ma(e, { gatewayUrls: t, record: n }) {
|
|
695
|
+
const r = la(n), s = await ha(e, { nft: r }), { uri: a, isOnChain: o, isEncoded: i } = ar({ uri: s, gatewayUrls: t });
|
|
682
696
|
if (o && (a.includes("data:application/json;base64,") || a.startsWith("{"))) {
|
|
683
|
-
const
|
|
697
|
+
const d = i ? (
|
|
684
698
|
// if it is encoded, decode it
|
|
685
699
|
atob(a.replace("data:application/json;base64,", ""))
|
|
686
700
|
) : (
|
|
687
701
|
// if it isn't encoded assume it is a JSON string, but it could be anything (it will error if it is)
|
|
688
702
|
a
|
|
689
|
-
),
|
|
690
|
-
return vt({ uri:
|
|
703
|
+
), u = JSON.parse(d);
|
|
704
|
+
return vt({ uri: or(u), gatewayUrls: t });
|
|
691
705
|
}
|
|
692
706
|
let c = r.tokenID;
|
|
693
|
-
return r.namespace === "erc1155" && (c = c.replace("0x", "").padStart(64, "0")),
|
|
707
|
+
return r.namespace === "erc1155" && (c = c.replace("0x", "").padStart(64, "0")), fa({
|
|
694
708
|
gatewayUrls: t,
|
|
695
709
|
uri: a.replace(/(?:0x)?{id}/, c)
|
|
696
710
|
});
|
|
697
711
|
}
|
|
698
|
-
async function
|
|
699
|
-
const { blockNumber: n, blockTag: r, key: s, name: a, gatewayUrls: o, strict: i } = t, { chain: c } = e,
|
|
712
|
+
async function ir(e, t) {
|
|
713
|
+
const { blockNumber: n, blockTag: r, key: s, name: a, gatewayUrls: o, strict: i } = t, { chain: c } = e, d = (() => {
|
|
700
714
|
if (t.universalResolverAddress)
|
|
701
715
|
return t.universalResolverAddress;
|
|
702
716
|
if (!c)
|
|
703
717
|
throw new Error("client chain not configured. universalResolverAddress is required.");
|
|
704
|
-
return
|
|
718
|
+
return ge({
|
|
705
719
|
blockNumber: n,
|
|
706
720
|
chain: c,
|
|
707
721
|
contract: "ensUniversalResolver"
|
|
708
722
|
});
|
|
709
|
-
})(),
|
|
710
|
-
if (
|
|
723
|
+
})(), u = c?.ensTlds;
|
|
724
|
+
if (u && !u.some((f) => a.endsWith(f)))
|
|
711
725
|
return null;
|
|
712
726
|
try {
|
|
713
|
-
const
|
|
714
|
-
address:
|
|
727
|
+
const f = {
|
|
728
|
+
address: d,
|
|
715
729
|
abi: En,
|
|
716
730
|
args: [
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
abi:
|
|
731
|
+
ce(gt(a)),
|
|
732
|
+
Y({
|
|
733
|
+
abi: Ft,
|
|
720
734
|
functionName: "text",
|
|
721
735
|
args: [tt(a), s]
|
|
722
736
|
}),
|
|
@@ -725,25 +739,25 @@ async function or(e, t) {
|
|
|
725
739
|
functionName: "resolveWithGateways",
|
|
726
740
|
blockNumber: n,
|
|
727
741
|
blockTag: r
|
|
728
|
-
}, h = await
|
|
742
|
+
}, h = await T(e, D, "readContract")(f);
|
|
729
743
|
if (h[0] === "0x")
|
|
730
744
|
return null;
|
|
731
745
|
const p = _e({
|
|
732
|
-
abi:
|
|
746
|
+
abi: Ft,
|
|
733
747
|
functionName: "text",
|
|
734
748
|
data: h[0]
|
|
735
749
|
});
|
|
736
750
|
return p === "" ? null : p;
|
|
737
|
-
} catch (
|
|
751
|
+
} catch (f) {
|
|
738
752
|
if (i)
|
|
739
|
-
throw
|
|
740
|
-
if (bt(
|
|
753
|
+
throw f;
|
|
754
|
+
if (bt(f))
|
|
741
755
|
return null;
|
|
742
|
-
throw
|
|
756
|
+
throw f;
|
|
743
757
|
}
|
|
744
758
|
}
|
|
745
|
-
async function
|
|
746
|
-
const c = await
|
|
759
|
+
async function ya(e, { blockNumber: t, blockTag: n, assetGatewayUrls: r, name: s, gatewayUrls: a, strict: o, universalResolverAddress: i }) {
|
|
760
|
+
const c = await T(e, ir, "getEnsText")({
|
|
747
761
|
blockNumber: t,
|
|
748
762
|
blockTag: n,
|
|
749
763
|
key: "avatar",
|
|
@@ -755,7 +769,7 @@ async function ma(e, { blockNumber: t, blockTag: n, assetGatewayUrls: r, name: s
|
|
|
755
769
|
if (!c)
|
|
756
770
|
return null;
|
|
757
771
|
try {
|
|
758
|
-
return await
|
|
772
|
+
return await pa(e, {
|
|
759
773
|
record: c,
|
|
760
774
|
gatewayUrls: r
|
|
761
775
|
});
|
|
@@ -763,51 +777,51 @@ async function ma(e, { blockNumber: t, blockTag: n, assetGatewayUrls: r, name: s
|
|
|
763
777
|
return null;
|
|
764
778
|
}
|
|
765
779
|
}
|
|
766
|
-
async function
|
|
767
|
-
const { address: n, blockNumber: r, blockTag: s, coinType: a = 60n, gatewayUrls: o, strict: i } = t, { chain: c } = e,
|
|
780
|
+
async function ba(e, t) {
|
|
781
|
+
const { address: n, blockNumber: r, blockTag: s, coinType: a = 60n, gatewayUrls: o, strict: i } = t, { chain: c } = e, d = (() => {
|
|
768
782
|
if (t.universalResolverAddress)
|
|
769
783
|
return t.universalResolverAddress;
|
|
770
784
|
if (!c)
|
|
771
785
|
throw new Error("client chain not configured. universalResolverAddress is required.");
|
|
772
|
-
return
|
|
786
|
+
return ge({
|
|
773
787
|
blockNumber: r,
|
|
774
788
|
chain: c,
|
|
775
789
|
contract: "ensUniversalResolver"
|
|
776
790
|
});
|
|
777
791
|
})();
|
|
778
792
|
try {
|
|
779
|
-
const
|
|
780
|
-
address:
|
|
781
|
-
abi:
|
|
793
|
+
const u = {
|
|
794
|
+
address: d,
|
|
795
|
+
abi: jr,
|
|
782
796
|
args: [n, a, o ?? [yt]],
|
|
783
797
|
functionName: "reverseWithGateways",
|
|
784
798
|
blockNumber: r,
|
|
785
799
|
blockTag: s
|
|
786
|
-
},
|
|
787
|
-
return
|
|
788
|
-
} catch (
|
|
800
|
+
}, f = T(e, D, "readContract"), [l] = await f(u);
|
|
801
|
+
return l || null;
|
|
802
|
+
} catch (u) {
|
|
789
803
|
if (i)
|
|
790
|
-
throw
|
|
791
|
-
if (bt(
|
|
804
|
+
throw u;
|
|
805
|
+
if (bt(u))
|
|
792
806
|
return null;
|
|
793
|
-
throw
|
|
807
|
+
throw u;
|
|
794
808
|
}
|
|
795
809
|
}
|
|
796
|
-
async function
|
|
810
|
+
async function ga(e, t) {
|
|
797
811
|
const { blockNumber: n, blockTag: r, name: s } = t, { chain: a } = e, o = (() => {
|
|
798
812
|
if (t.universalResolverAddress)
|
|
799
813
|
return t.universalResolverAddress;
|
|
800
814
|
if (!a)
|
|
801
815
|
throw new Error("client chain not configured. universalResolverAddress is required.");
|
|
802
|
-
return
|
|
816
|
+
return ge({
|
|
803
817
|
blockNumber: n,
|
|
804
818
|
chain: a,
|
|
805
819
|
contract: "ensUniversalResolver"
|
|
806
820
|
});
|
|
807
821
|
})(), i = a?.ensTlds;
|
|
808
|
-
if (i && !i.some((
|
|
822
|
+
if (i && !i.some((d) => s.endsWith(d)))
|
|
809
823
|
throw new Error(`${s} is not a valid ENS TLD (${i?.join(", ")}) for chain "${a.name}" (id: ${a.id}).`);
|
|
810
|
-
const [c] = await
|
|
824
|
+
const [c] = await T(e, D, "readContract")({
|
|
811
825
|
address: o,
|
|
812
826
|
abi: [
|
|
813
827
|
{
|
|
@@ -823,17 +837,17 @@ async function ba(e, t) {
|
|
|
823
837
|
}
|
|
824
838
|
],
|
|
825
839
|
functionName: "findResolver",
|
|
826
|
-
args: [
|
|
840
|
+
args: [ce(gt(s))],
|
|
827
841
|
blockNumber: n,
|
|
828
842
|
blockTag: r
|
|
829
843
|
});
|
|
830
844
|
return c;
|
|
831
845
|
}
|
|
832
|
-
async function
|
|
833
|
-
const { account: n = e.account, blockNumber: r, blockTag: s = "latest", blobs: a, data: o, gas: i, gasPrice: c, maxFeePerBlobGas:
|
|
846
|
+
async function cr(e, t) {
|
|
847
|
+
const { account: n = e.account, blockNumber: r, blockTag: s = "latest", blobs: a, data: o, gas: i, gasPrice: c, maxFeePerBlobGas: d, maxFeePerGas: u, maxPriorityFeePerGas: f, to: l, value: h, ...p } = t, g = n ? F(n) : void 0;
|
|
834
848
|
try {
|
|
835
849
|
ze(t);
|
|
836
|
-
const m = (typeof r == "bigint" ? C(r) : void 0) || s, b = e.chain?.formatters?.transactionRequest?.format,
|
|
850
|
+
const m = (typeof r == "bigint" ? C(r) : void 0) || s, b = e.chain?.formatters?.transactionRequest?.format, P = (b || Ue)({
|
|
837
851
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
838
852
|
...Pn(p, { format: b }),
|
|
839
853
|
account: g,
|
|
@@ -841,28 +855,28 @@ async function ir(e, t) {
|
|
|
841
855
|
data: o,
|
|
842
856
|
gas: i,
|
|
843
857
|
gasPrice: c,
|
|
844
|
-
maxFeePerBlobGas:
|
|
845
|
-
maxFeePerGas:
|
|
846
|
-
maxPriorityFeePerGas:
|
|
847
|
-
to:
|
|
858
|
+
maxFeePerBlobGas: d,
|
|
859
|
+
maxFeePerGas: u,
|
|
860
|
+
maxPriorityFeePerGas: f,
|
|
861
|
+
to: l,
|
|
848
862
|
value: h
|
|
849
|
-
}, "createAccessList"),
|
|
863
|
+
}, "createAccessList"), A = await e.request({
|
|
850
864
|
method: "eth_createAccessList",
|
|
851
|
-
params: [
|
|
865
|
+
params: [P, m]
|
|
852
866
|
});
|
|
853
867
|
return {
|
|
854
|
-
accessList:
|
|
855
|
-
gasUsed: BigInt(
|
|
868
|
+
accessList: A.accessList,
|
|
869
|
+
gasUsed: BigInt(A.gasUsed)
|
|
856
870
|
};
|
|
857
871
|
} catch (y) {
|
|
858
|
-
throw
|
|
872
|
+
throw Hr(y, {
|
|
859
873
|
...t,
|
|
860
874
|
account: g,
|
|
861
875
|
chain: e.chain
|
|
862
876
|
});
|
|
863
877
|
}
|
|
864
878
|
}
|
|
865
|
-
async function
|
|
879
|
+
async function wa(e) {
|
|
866
880
|
const t = dt(e, {
|
|
867
881
|
method: "eth_newBlockFilter"
|
|
868
882
|
}), n = await e.request({
|
|
@@ -870,24 +884,24 @@ async function ga(e) {
|
|
|
870
884
|
});
|
|
871
885
|
return { id: n, request: t(n), type: "block" };
|
|
872
886
|
}
|
|
873
|
-
async function
|
|
874
|
-
const c = s ?? (r ? [r] : void 0),
|
|
887
|
+
async function ur(e, { address: t, args: n, event: r, events: s, fromBlock: a, strict: o, toBlock: i } = {}) {
|
|
888
|
+
const c = s ?? (r ? [r] : void 0), d = dt(e, {
|
|
875
889
|
method: "eth_newFilter"
|
|
876
890
|
});
|
|
877
|
-
let
|
|
878
|
-
c && (
|
|
891
|
+
let u = [];
|
|
892
|
+
c && (u = [c.flatMap((h) => xn({
|
|
879
893
|
abi: [h],
|
|
880
894
|
eventName: h.name,
|
|
881
895
|
args: n
|
|
882
|
-
}))], r && (
|
|
883
|
-
const
|
|
896
|
+
}))], r && (u = u[0]));
|
|
897
|
+
const f = await e.request({
|
|
884
898
|
method: "eth_newFilter",
|
|
885
899
|
params: [
|
|
886
900
|
{
|
|
887
901
|
address: t,
|
|
888
902
|
fromBlock: typeof a == "bigint" ? C(a) : a,
|
|
889
903
|
toBlock: typeof i == "bigint" ? C(i) : i,
|
|
890
|
-
...
|
|
904
|
+
...u.length ? { topics: u } : {}
|
|
891
905
|
}
|
|
892
906
|
]
|
|
893
907
|
});
|
|
@@ -896,14 +910,14 @@ async function cr(e, { address: t, args: n, event: r, events: s, fromBlock: a, s
|
|
|
896
910
|
args: n,
|
|
897
911
|
eventName: r ? r.name : void 0,
|
|
898
912
|
fromBlock: a,
|
|
899
|
-
id:
|
|
900
|
-
request:
|
|
913
|
+
id: f,
|
|
914
|
+
request: d(f),
|
|
901
915
|
strict: !!o,
|
|
902
916
|
toBlock: i,
|
|
903
917
|
type: "event"
|
|
904
918
|
};
|
|
905
919
|
}
|
|
906
|
-
async function
|
|
920
|
+
async function dr(e) {
|
|
907
921
|
const t = dt(e, {
|
|
908
922
|
method: "eth_newPendingTransactionFilter"
|
|
909
923
|
}), n = await e.request({
|
|
@@ -911,20 +925,20 @@ async function ur(e) {
|
|
|
911
925
|
});
|
|
912
926
|
return { id: n, request: t(n), type: "transaction" };
|
|
913
927
|
}
|
|
914
|
-
async function
|
|
928
|
+
async function va(e, { address: t, blockNumber: n, blockTag: r = e.experimental_blockTag ?? "latest" }) {
|
|
915
929
|
const s = typeof n == "bigint" ? C(n) : void 0, a = await e.request({
|
|
916
930
|
method: "eth_getBalance",
|
|
917
931
|
params: [t, s || r]
|
|
918
932
|
});
|
|
919
933
|
return BigInt(a);
|
|
920
934
|
}
|
|
921
|
-
async function
|
|
935
|
+
async function Ea(e) {
|
|
922
936
|
const t = await e.request({
|
|
923
937
|
method: "eth_blobBaseFee"
|
|
924
938
|
});
|
|
925
939
|
return BigInt(t);
|
|
926
940
|
}
|
|
927
|
-
async function
|
|
941
|
+
async function Pa(e, { blockHash: t, blockNumber: n, blockTag: r = "latest" } = {}) {
|
|
928
942
|
const s = n !== void 0 ? C(n) : void 0;
|
|
929
943
|
let a;
|
|
930
944
|
return t ? a = await e.request({
|
|
@@ -943,7 +957,7 @@ async function nt(e, { address: t, blockNumber: n, blockTag: r = "latest" }) {
|
|
|
943
957
|
if (a !== "0x")
|
|
944
958
|
return a;
|
|
945
959
|
}
|
|
946
|
-
class
|
|
960
|
+
class xa extends _ {
|
|
947
961
|
constructor({ address: t }) {
|
|
948
962
|
super(`No EIP-712 domain found on contract "${t}".`, {
|
|
949
963
|
metaMessages: [
|
|
@@ -959,7 +973,7 @@ class Pa extends $ {
|
|
|
959
973
|
async function Ta(e, t) {
|
|
960
974
|
const { address: n, factory: r, factoryData: s } = t;
|
|
961
975
|
try {
|
|
962
|
-
const [a, o, i, c,
|
|
976
|
+
const [a, o, i, c, d, u, f] = await T(e, D, "readContract")({
|
|
963
977
|
abi: Aa,
|
|
964
978
|
address: n,
|
|
965
979
|
functionName: "eip712Domain",
|
|
@@ -971,15 +985,15 @@ async function Ta(e, t) {
|
|
|
971
985
|
name: o,
|
|
972
986
|
version: i,
|
|
973
987
|
chainId: Number(c),
|
|
974
|
-
verifyingContract:
|
|
975
|
-
salt:
|
|
988
|
+
verifyingContract: d,
|
|
989
|
+
salt: u
|
|
976
990
|
},
|
|
977
|
-
extensions:
|
|
991
|
+
extensions: f,
|
|
978
992
|
fields: a
|
|
979
993
|
};
|
|
980
994
|
} catch (a) {
|
|
981
995
|
const o = a;
|
|
982
|
-
throw o.name === "ContractFunctionExecutionError" && o.cause.name === "ContractFunctionZeroDataError" ? new
|
|
996
|
+
throw o.name === "ContractFunctionExecutionError" && o.cause.name === "ContractFunctionZeroDataError" ? new xa({ address: n }) : o;
|
|
983
997
|
}
|
|
984
998
|
}
|
|
985
999
|
const Aa = [
|
|
@@ -999,7 +1013,7 @@ const Aa = [
|
|
|
999
1013
|
type: "function"
|
|
1000
1014
|
}
|
|
1001
1015
|
];
|
|
1002
|
-
function
|
|
1016
|
+
function Ia(e) {
|
|
1003
1017
|
return {
|
|
1004
1018
|
baseFeePerGas: e.baseFeePerGas.map((t) => BigInt(t)),
|
|
1005
1019
|
gasUsedRatio: e.gasUsedRatio,
|
|
@@ -1007,7 +1021,7 @@ function xa(e) {
|
|
|
1007
1021
|
reward: e.reward?.map((t) => t.map((n) => BigInt(n)))
|
|
1008
1022
|
};
|
|
1009
1023
|
}
|
|
1010
|
-
async function
|
|
1024
|
+
async function Ra(e, { blockCount: t, blockNumber: n, blockTag: r = "latest", rewardPercentiles: s }) {
|
|
1011
1025
|
const a = typeof n == "bigint" ? C(n) : void 0, o = await e.request({
|
|
1012
1026
|
method: "eth_feeHistory",
|
|
1013
1027
|
params: [
|
|
@@ -1016,9 +1030,9 @@ async function Ia(e, { blockCount: t, blockNumber: n, blockTag: r = "latest", re
|
|
|
1016
1030
|
s
|
|
1017
1031
|
]
|
|
1018
1032
|
}, { dedupe: !!a });
|
|
1019
|
-
return
|
|
1033
|
+
return Ia(o);
|
|
1020
1034
|
}
|
|
1021
|
-
async function
|
|
1035
|
+
async function Ca(e, { filter: t }) {
|
|
1022
1036
|
const n = t.strict ?? !1, s = (await t.request({
|
|
1023
1037
|
method: "eth_getFilterLogs",
|
|
1024
1038
|
params: [t.id]
|
|
@@ -1029,14 +1043,14 @@ async function Ra(e, { filter: t }) {
|
|
|
1029
1043
|
strict: n
|
|
1030
1044
|
}) : s;
|
|
1031
1045
|
}
|
|
1032
|
-
async function
|
|
1033
|
-
return
|
|
1046
|
+
async function ka({ address: e, authorization: t, signature: n }) {
|
|
1047
|
+
return Fe(mt(e), await Tn({
|
|
1034
1048
|
authorization: t,
|
|
1035
1049
|
signature: n
|
|
1036
1050
|
}));
|
|
1037
1051
|
}
|
|
1038
|
-
const Ie = /* @__PURE__ */ new
|
|
1039
|
-
function
|
|
1052
|
+
const Ie = /* @__PURE__ */ new Mn(8192);
|
|
1053
|
+
function Na(e, { enabled: t = !0, id: n }) {
|
|
1040
1054
|
if (!t || !n)
|
|
1041
1055
|
return e();
|
|
1042
1056
|
if (Ie.get(n))
|
|
@@ -1044,130 +1058,130 @@ function ka(e, { enabled: t = !0, id: n }) {
|
|
|
1044
1058
|
const r = e().finally(() => Ie.delete(n));
|
|
1045
1059
|
return Ie.set(n, r), r;
|
|
1046
1060
|
}
|
|
1047
|
-
function
|
|
1061
|
+
function Sa(e, t = {}) {
|
|
1048
1062
|
return async (n, r = {}) => {
|
|
1049
1063
|
const { dedupe: s = !1, methods: a, retryDelay: o = 150, retryCount: i = 3, uid: c } = {
|
|
1050
1064
|
...t,
|
|
1051
1065
|
...r
|
|
1052
|
-
}, { method:
|
|
1053
|
-
if (a?.exclude?.includes(
|
|
1054
|
-
throw new
|
|
1055
|
-
method:
|
|
1066
|
+
}, { method: d } = n;
|
|
1067
|
+
if (a?.exclude?.includes(d))
|
|
1068
|
+
throw new xe(new Error("method not supported"), {
|
|
1069
|
+
method: d
|
|
1056
1070
|
});
|
|
1057
|
-
if (a?.include && !a.include.includes(
|
|
1058
|
-
throw new
|
|
1059
|
-
method:
|
|
1071
|
+
if (a?.include && !a.include.includes(d))
|
|
1072
|
+
throw new xe(new Error("method not supported"), {
|
|
1073
|
+
method: d
|
|
1060
1074
|
});
|
|
1061
|
-
const
|
|
1062
|
-
return
|
|
1075
|
+
const u = s ? Se(`${c}.${U(n)}`) : void 0;
|
|
1076
|
+
return Na(() => Be(async () => {
|
|
1063
1077
|
try {
|
|
1064
1078
|
return await e(n);
|
|
1065
|
-
} catch (
|
|
1066
|
-
const
|
|
1067
|
-
switch (
|
|
1079
|
+
} catch (f) {
|
|
1080
|
+
const l = f;
|
|
1081
|
+
switch (l.code) {
|
|
1068
1082
|
// -32700
|
|
1069
1083
|
case tn.code:
|
|
1070
|
-
throw new tn(
|
|
1084
|
+
throw new tn(l);
|
|
1071
1085
|
// -32600
|
|
1072
1086
|
case en.code:
|
|
1073
|
-
throw new en(
|
|
1087
|
+
throw new en(l);
|
|
1074
1088
|
// -32601
|
|
1075
1089
|
case Xt.code:
|
|
1076
|
-
throw new Xt(
|
|
1090
|
+
throw new Xt(l, { method: n.method });
|
|
1077
1091
|
// -32602
|
|
1078
1092
|
case Qt.code:
|
|
1079
|
-
throw new Qt(
|
|
1093
|
+
throw new Qt(l);
|
|
1080
1094
|
// -32603
|
|
1081
1095
|
case Ye.code:
|
|
1082
|
-
throw new Ye(
|
|
1096
|
+
throw new Ye(l);
|
|
1083
1097
|
// -32000
|
|
1084
1098
|
case Je.code:
|
|
1085
|
-
throw new Je(
|
|
1099
|
+
throw new Je(l);
|
|
1086
1100
|
// -32001
|
|
1087
1101
|
case Kt.code:
|
|
1088
|
-
throw new Kt(
|
|
1102
|
+
throw new Kt(l);
|
|
1089
1103
|
// -32002
|
|
1090
1104
|
case Yt.code:
|
|
1091
|
-
throw new Yt(
|
|
1105
|
+
throw new Yt(l);
|
|
1092
1106
|
// -32003
|
|
1093
1107
|
case Jt.code:
|
|
1094
|
-
throw new Jt(
|
|
1108
|
+
throw new Jt(l);
|
|
1095
1109
|
// -32004
|
|
1096
|
-
case
|
|
1097
|
-
throw new
|
|
1110
|
+
case xe.code:
|
|
1111
|
+
throw new xe(l, {
|
|
1098
1112
|
method: n.method
|
|
1099
1113
|
});
|
|
1100
1114
|
// -32005
|
|
1101
1115
|
case Ze.code:
|
|
1102
|
-
throw new Ze(
|
|
1116
|
+
throw new Ze(l);
|
|
1103
1117
|
// -32006
|
|
1104
1118
|
case Zt.code:
|
|
1105
|
-
throw new Zt(
|
|
1119
|
+
throw new Zt(l);
|
|
1106
1120
|
// 4001
|
|
1107
1121
|
case Me.code:
|
|
1108
|
-
throw new Me(
|
|
1122
|
+
throw new Me(l);
|
|
1109
1123
|
// 4100
|
|
1110
1124
|
case Gt.code:
|
|
1111
|
-
throw new Gt(
|
|
1125
|
+
throw new Gt(l);
|
|
1112
1126
|
// 4200
|
|
1113
|
-
case Ht.code:
|
|
1114
|
-
throw new Ht(f);
|
|
1115
|
-
// 4900
|
|
1116
1127
|
case Vt.code:
|
|
1117
|
-
throw new Vt(
|
|
1118
|
-
//
|
|
1128
|
+
throw new Vt(l);
|
|
1129
|
+
// 4900
|
|
1119
1130
|
case Wt.code:
|
|
1120
|
-
throw new Wt(
|
|
1131
|
+
throw new Wt(l);
|
|
1132
|
+
// 4901
|
|
1133
|
+
case Ht.code:
|
|
1134
|
+
throw new Ht(l);
|
|
1121
1135
|
// 4902
|
|
1122
1136
|
case jt.code:
|
|
1123
|
-
throw new jt(
|
|
1137
|
+
throw new jt(l);
|
|
1124
1138
|
// 5700
|
|
1125
|
-
case
|
|
1126
|
-
throw new
|
|
1139
|
+
case Ve.code:
|
|
1140
|
+
throw new Ve(l);
|
|
1127
1141
|
// 5710
|
|
1128
1142
|
case Mt.code:
|
|
1129
|
-
throw new Mt(
|
|
1143
|
+
throw new Mt(l);
|
|
1130
1144
|
// 5720
|
|
1131
1145
|
case Lt.code:
|
|
1132
|
-
throw new Lt(
|
|
1146
|
+
throw new Lt(l);
|
|
1133
1147
|
// 5730
|
|
1134
1148
|
case qt.code:
|
|
1135
|
-
throw new qt(
|
|
1149
|
+
throw new qt(l);
|
|
1136
1150
|
// 5740
|
|
1137
1151
|
case Dt.code:
|
|
1138
|
-
throw new Dt(
|
|
1152
|
+
throw new Dt(l);
|
|
1139
1153
|
// 5750
|
|
1140
1154
|
case Ot.code:
|
|
1141
|
-
throw new Ot(
|
|
1155
|
+
throw new Ot(l);
|
|
1142
1156
|
// 5760
|
|
1143
1157
|
case Ge.code:
|
|
1144
|
-
throw new Ge(
|
|
1158
|
+
throw new Ge(l);
|
|
1145
1159
|
// CAIP-25: User Rejected Error
|
|
1146
1160
|
// https://docs.walletconnect.com/2.0/specs/clients/sign/error-codes#rejected-caip-25
|
|
1147
1161
|
case 5e3:
|
|
1148
|
-
throw new Me(
|
|
1162
|
+
throw new Me(l);
|
|
1149
1163
|
default:
|
|
1150
|
-
throw
|
|
1164
|
+
throw f instanceof _ ? f : new Vr(l);
|
|
1151
1165
|
}
|
|
1152
1166
|
}
|
|
1153
1167
|
}, {
|
|
1154
|
-
delay: ({ count:
|
|
1155
|
-
if (
|
|
1156
|
-
const h =
|
|
1168
|
+
delay: ({ count: f, error: l }) => {
|
|
1169
|
+
if (l && l instanceof le) {
|
|
1170
|
+
const h = l?.headers?.get("Retry-After");
|
|
1157
1171
|
if (h?.match(/\d/))
|
|
1158
1172
|
return Number.parseInt(h, 10) * 1e3;
|
|
1159
1173
|
}
|
|
1160
|
-
return ~~(1 <<
|
|
1174
|
+
return ~~(1 << f) * o;
|
|
1161
1175
|
},
|
|
1162
1176
|
retryCount: i,
|
|
1163
|
-
shouldRetry: ({ error:
|
|
1164
|
-
}), { enabled: s, id:
|
|
1177
|
+
shouldRetry: ({ error: f }) => Ba(f)
|
|
1178
|
+
}), { enabled: s, id: u });
|
|
1165
1179
|
};
|
|
1166
1180
|
}
|
|
1167
1181
|
function Ba(e) {
|
|
1168
|
-
return "code" in e && typeof e.code == "number" ? e.code === -1 || e.code === Ze.code || e.code === Ye.code : e instanceof
|
|
1182
|
+
return "code" in e && typeof e.code == "number" ? e.code === -1 || e.code === Ze.code || e.code === Ye.code : e instanceof le && e.status ? e.status === 403 || e.status === 408 || e.status === 413 || e.status === 429 || e.status === 500 || e.status === 502 || e.status === 503 || e.status === 504 : !0;
|
|
1169
1183
|
}
|
|
1170
|
-
function
|
|
1184
|
+
function $a(e, { errorInstance: t = new Error("timed out"), timeout: n, signal: r }) {
|
|
1171
1185
|
return new Promise((s, a) => {
|
|
1172
1186
|
(async () => {
|
|
1173
1187
|
let o;
|
|
@@ -1184,7 +1198,7 @@ function Sa(e, { errorInstance: t = new Error("timed out"), timeout: n, signal:
|
|
|
1184
1198
|
})();
|
|
1185
1199
|
});
|
|
1186
1200
|
}
|
|
1187
|
-
function
|
|
1201
|
+
function _a() {
|
|
1188
1202
|
return {
|
|
1189
1203
|
current: 0,
|
|
1190
1204
|
take() {
|
|
@@ -1195,90 +1209,108 @@ function $a() {
|
|
|
1195
1209
|
}
|
|
1196
1210
|
};
|
|
1197
1211
|
}
|
|
1198
|
-
const dn = /* @__PURE__ */
|
|
1199
|
-
function
|
|
1212
|
+
const dn = /* @__PURE__ */ _a();
|
|
1213
|
+
function za(e, t = {}) {
|
|
1214
|
+
const { url: n, headers: r } = Ua(e);
|
|
1200
1215
|
return {
|
|
1201
|
-
async request(
|
|
1202
|
-
const { body:
|
|
1216
|
+
async request(s) {
|
|
1217
|
+
const { body: a, fetchFn: o = t.fetchFn ?? fetch, onRequest: i = t.onRequest, onResponse: c = t.onResponse, timeout: d = t.timeout ?? 1e4 } = s, u = {
|
|
1203
1218
|
...t.fetchOptions ?? {},
|
|
1204
|
-
...
|
|
1205
|
-
}, { headers:
|
|
1219
|
+
...s.fetchOptions ?? {}
|
|
1220
|
+
}, { headers: f, method: l, signal: h } = u;
|
|
1206
1221
|
try {
|
|
1207
|
-
const
|
|
1208
|
-
const
|
|
1209
|
-
...
|
|
1210
|
-
body: Array.isArray(
|
|
1222
|
+
const p = await $a(async ({ signal: y }) => {
|
|
1223
|
+
const m = {
|
|
1224
|
+
...u,
|
|
1225
|
+
body: Array.isArray(a) ? U(a.map((A) => ({
|
|
1211
1226
|
jsonrpc: "2.0",
|
|
1212
|
-
id:
|
|
1213
|
-
...
|
|
1214
|
-
}))) :
|
|
1227
|
+
id: A.id ?? dn.take(),
|
|
1228
|
+
...A
|
|
1229
|
+
}))) : U({
|
|
1215
1230
|
jsonrpc: "2.0",
|
|
1216
|
-
id:
|
|
1217
|
-
...
|
|
1231
|
+
id: a.id ?? dn.take(),
|
|
1232
|
+
...a
|
|
1218
1233
|
}),
|
|
1219
1234
|
headers: {
|
|
1235
|
+
...r,
|
|
1220
1236
|
"Content-Type": "application/json",
|
|
1221
|
-
...
|
|
1237
|
+
...f
|
|
1222
1238
|
},
|
|
1223
|
-
method:
|
|
1224
|
-
signal:
|
|
1225
|
-
},
|
|
1226
|
-
return await
|
|
1239
|
+
method: l || "POST",
|
|
1240
|
+
signal: h || (d > 0 ? y : null)
|
|
1241
|
+
}, b = new Request(n, m), w = await i?.(b, m) ?? { ...m, url: n };
|
|
1242
|
+
return await o(w.url ?? n, w);
|
|
1227
1243
|
}, {
|
|
1228
|
-
errorInstance: new nn({ body:
|
|
1229
|
-
timeout:
|
|
1244
|
+
errorInstance: new nn({ body: a, url: n }),
|
|
1245
|
+
timeout: d,
|
|
1230
1246
|
signal: !0
|
|
1231
1247
|
});
|
|
1232
|
-
|
|
1233
|
-
let
|
|
1234
|
-
if (
|
|
1235
|
-
|
|
1248
|
+
c && await c(p);
|
|
1249
|
+
let g;
|
|
1250
|
+
if (p.headers.get("Content-Type")?.startsWith("application/json"))
|
|
1251
|
+
g = await p.json();
|
|
1236
1252
|
else {
|
|
1237
|
-
|
|
1253
|
+
g = await p.text();
|
|
1238
1254
|
try {
|
|
1239
|
-
|
|
1240
|
-
} catch (
|
|
1241
|
-
if (
|
|
1242
|
-
throw
|
|
1243
|
-
|
|
1255
|
+
g = JSON.parse(g || "{}");
|
|
1256
|
+
} catch (y) {
|
|
1257
|
+
if (p.ok)
|
|
1258
|
+
throw y;
|
|
1259
|
+
g = { error: g };
|
|
1244
1260
|
}
|
|
1245
1261
|
}
|
|
1246
|
-
if (!
|
|
1247
|
-
throw new
|
|
1248
|
-
body:
|
|
1249
|
-
details:
|
|
1250
|
-
headers:
|
|
1251
|
-
status:
|
|
1252
|
-
url:
|
|
1262
|
+
if (!p.ok)
|
|
1263
|
+
throw new le({
|
|
1264
|
+
body: a,
|
|
1265
|
+
details: U(g.error) || p.statusText,
|
|
1266
|
+
headers: p.headers,
|
|
1267
|
+
status: p.status,
|
|
1268
|
+
url: n
|
|
1253
1269
|
});
|
|
1254
|
-
return
|
|
1255
|
-
} catch (
|
|
1256
|
-
throw
|
|
1257
|
-
body:
|
|
1258
|
-
cause:
|
|
1259
|
-
url:
|
|
1270
|
+
return g;
|
|
1271
|
+
} catch (p) {
|
|
1272
|
+
throw p instanceof le || p instanceof nn ? p : new le({
|
|
1273
|
+
body: a,
|
|
1274
|
+
cause: p,
|
|
1275
|
+
url: n
|
|
1260
1276
|
});
|
|
1261
1277
|
}
|
|
1262
1278
|
}
|
|
1263
1279
|
};
|
|
1264
1280
|
}
|
|
1265
|
-
|
|
1281
|
+
function Ua(e) {
|
|
1282
|
+
try {
|
|
1283
|
+
const t = new URL(e), n = (() => {
|
|
1284
|
+
if (t.username) {
|
|
1285
|
+
const r = `${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;
|
|
1286
|
+
return t.username = "", t.password = "", {
|
|
1287
|
+
url: t.toString(),
|
|
1288
|
+
headers: { Authorization: `Basic ${btoa(r)}` }
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
})();
|
|
1292
|
+
return { url: t.toString(), ...n };
|
|
1293
|
+
} catch {
|
|
1294
|
+
return { url: e };
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
const Fa = `Ethereum Signed Message:
|
|
1266
1298
|
`;
|
|
1267
|
-
function
|
|
1268
|
-
const t = typeof e == "string" ?
|
|
1269
|
-
return
|
|
1299
|
+
function Oa(e) {
|
|
1300
|
+
const t = typeof e == "string" ? Se(e) : typeof e.raw == "string" ? e.raw : me(e.raw), n = Se(`${Fa}${Xe(t)}`);
|
|
1301
|
+
return Z([n, t]);
|
|
1270
1302
|
}
|
|
1271
|
-
function
|
|
1272
|
-
return O(
|
|
1303
|
+
function fr(e, t) {
|
|
1304
|
+
return O(Oa(e), t);
|
|
1273
1305
|
}
|
|
1274
|
-
class
|
|
1306
|
+
class Da extends _ {
|
|
1275
1307
|
constructor({ domain: t }) {
|
|
1276
|
-
super(`Invalid domain "${
|
|
1308
|
+
super(`Invalid domain "${U(t)}".`, {
|
|
1277
1309
|
metaMessages: ["Must be a valid EIP-712 domain."]
|
|
1278
1310
|
});
|
|
1279
1311
|
}
|
|
1280
1312
|
}
|
|
1281
|
-
class
|
|
1313
|
+
class qa extends _ {
|
|
1282
1314
|
constructor({ primaryType: t, types: n }) {
|
|
1283
1315
|
super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`, {
|
|
1284
1316
|
docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror",
|
|
@@ -1286,7 +1318,7 @@ class Oa extends $ {
|
|
|
1286
1318
|
});
|
|
1287
1319
|
}
|
|
1288
1320
|
}
|
|
1289
|
-
class
|
|
1321
|
+
class La extends _ {
|
|
1290
1322
|
constructor({ type: t }) {
|
|
1291
1323
|
super(`Struct type "${t}" is invalid.`, {
|
|
1292
1324
|
metaMessages: ["Struct type must not be a Solidity type."],
|
|
@@ -1294,58 +1326,58 @@ class Da extends $ {
|
|
|
1294
1326
|
});
|
|
1295
1327
|
}
|
|
1296
1328
|
}
|
|
1297
|
-
function
|
|
1298
|
-
const { domain: t, message: n, primaryType: r, types: s } = e, a = (c,
|
|
1299
|
-
const
|
|
1300
|
-
for (const
|
|
1301
|
-
const { name:
|
|
1302
|
-
h === "address" && (
|
|
1329
|
+
function Ma(e) {
|
|
1330
|
+
const { domain: t, message: n, primaryType: r, types: s } = e, a = (c, d) => {
|
|
1331
|
+
const u = { ...d };
|
|
1332
|
+
for (const f of c) {
|
|
1333
|
+
const { name: l, type: h } = f;
|
|
1334
|
+
h === "address" && (u[l] = u[l].toLowerCase());
|
|
1303
1335
|
}
|
|
1304
|
-
return
|
|
1336
|
+
return u;
|
|
1305
1337
|
}, o = s.EIP712Domain ? t ? a(s.EIP712Domain, t) : {} : {}, i = (() => {
|
|
1306
1338
|
if (r !== "EIP712Domain")
|
|
1307
1339
|
return a(s[r], n);
|
|
1308
1340
|
})();
|
|
1309
|
-
return
|
|
1341
|
+
return U({ domain: o, message: i, primaryType: r, types: s });
|
|
1310
1342
|
}
|
|
1311
|
-
function
|
|
1343
|
+
function lr(e) {
|
|
1312
1344
|
const { domain: t, message: n, primaryType: r, types: s } = e, a = (o, i) => {
|
|
1313
1345
|
for (const c of o) {
|
|
1314
|
-
const { name:
|
|
1315
|
-
if (
|
|
1316
|
-
const [g, y, m] =
|
|
1317
|
-
C(
|
|
1346
|
+
const { name: d, type: u } = c, f = i[d], l = u.match(Gr);
|
|
1347
|
+
if (l && (typeof f == "number" || typeof f == "bigint")) {
|
|
1348
|
+
const [g, y, m] = l;
|
|
1349
|
+
C(f, {
|
|
1318
1350
|
signed: y === "int",
|
|
1319
1351
|
size: Number.parseInt(m, 10) / 8
|
|
1320
1352
|
});
|
|
1321
1353
|
}
|
|
1322
|
-
if (
|
|
1323
|
-
throw new
|
|
1324
|
-
const h =
|
|
1354
|
+
if (u === "address" && typeof f == "string" && !jn(f))
|
|
1355
|
+
throw new Rs({ address: f });
|
|
1356
|
+
const h = u.match(Zr);
|
|
1325
1357
|
if (h) {
|
|
1326
1358
|
const [g, y] = h;
|
|
1327
|
-
if (y && Xe(
|
|
1328
|
-
throw new
|
|
1359
|
+
if (y && Xe(f) !== Number.parseInt(y, 10))
|
|
1360
|
+
throw new Jr({
|
|
1329
1361
|
expectedSize: Number.parseInt(y, 10),
|
|
1330
|
-
givenSize: Xe(
|
|
1362
|
+
givenSize: Xe(f)
|
|
1331
1363
|
});
|
|
1332
1364
|
}
|
|
1333
|
-
const p = s[
|
|
1334
|
-
p && (
|
|
1365
|
+
const p = s[u];
|
|
1366
|
+
p && (ja(u), a(p, f));
|
|
1335
1367
|
}
|
|
1336
1368
|
};
|
|
1337
1369
|
if (s.EIP712Domain && t) {
|
|
1338
1370
|
if (typeof t != "object")
|
|
1339
|
-
throw new
|
|
1371
|
+
throw new Da({ domain: t });
|
|
1340
1372
|
a(s.EIP712Domain, t);
|
|
1341
1373
|
}
|
|
1342
1374
|
if (r !== "EIP712Domain")
|
|
1343
1375
|
if (s[r])
|
|
1344
1376
|
a(s[r], n);
|
|
1345
1377
|
else
|
|
1346
|
-
throw new
|
|
1378
|
+
throw new qa({ primaryType: r, types: s });
|
|
1347
1379
|
}
|
|
1348
|
-
function
|
|
1380
|
+
function hr({ domain: e }) {
|
|
1349
1381
|
return [
|
|
1350
1382
|
typeof e?.name == "string" && { name: "name", type: "string" },
|
|
1351
1383
|
e?.version && { name: "version", type: "string" },
|
|
@@ -1360,50 +1392,50 @@ function lr({ domain: e }) {
|
|
|
1360
1392
|
e?.salt && { name: "salt", type: "bytes32" }
|
|
1361
1393
|
].filter(Boolean);
|
|
1362
1394
|
}
|
|
1363
|
-
function
|
|
1395
|
+
function ja(e) {
|
|
1364
1396
|
if (e === "address" || e === "bool" || e === "string" || e.startsWith("bytes") || e.startsWith("uint") || e.startsWith("int"))
|
|
1365
|
-
throw new
|
|
1397
|
+
throw new La({ type: e });
|
|
1366
1398
|
}
|
|
1367
|
-
function
|
|
1399
|
+
function Ha(e) {
|
|
1368
1400
|
const { domain: t = {}, message: n, primaryType: r } = e, s = {
|
|
1369
|
-
EIP712Domain:
|
|
1401
|
+
EIP712Domain: hr({ domain: t }),
|
|
1370
1402
|
...e.types
|
|
1371
1403
|
};
|
|
1372
|
-
|
|
1404
|
+
lr({
|
|
1373
1405
|
domain: t,
|
|
1374
1406
|
message: n,
|
|
1375
1407
|
primaryType: r,
|
|
1376
1408
|
types: s
|
|
1377
1409
|
});
|
|
1378
1410
|
const a = ["0x1901"];
|
|
1379
|
-
return t && a.push(
|
|
1411
|
+
return t && a.push(Wa({
|
|
1380
1412
|
domain: t,
|
|
1381
1413
|
types: s
|
|
1382
|
-
})), r !== "EIP712Domain" && a.push(
|
|
1414
|
+
})), r !== "EIP712Domain" && a.push(pr({
|
|
1383
1415
|
data: n,
|
|
1384
1416
|
primaryType: r,
|
|
1385
1417
|
types: s
|
|
1386
|
-
})), O(
|
|
1418
|
+
})), O(Z(a));
|
|
1387
1419
|
}
|
|
1388
|
-
function
|
|
1389
|
-
return
|
|
1420
|
+
function Wa({ domain: e, types: t }) {
|
|
1421
|
+
return pr({
|
|
1390
1422
|
data: e,
|
|
1391
1423
|
primaryType: "EIP712Domain",
|
|
1392
1424
|
types: t
|
|
1393
1425
|
});
|
|
1394
1426
|
}
|
|
1395
|
-
function
|
|
1396
|
-
const r =
|
|
1427
|
+
function pr({ data: e, primaryType: t, types: n }) {
|
|
1428
|
+
const r = mr({
|
|
1397
1429
|
data: e,
|
|
1398
1430
|
primaryType: t,
|
|
1399
1431
|
types: n
|
|
1400
1432
|
});
|
|
1401
1433
|
return O(r);
|
|
1402
1434
|
}
|
|
1403
|
-
function
|
|
1404
|
-
const r = [{ type: "bytes32" }], s = [
|
|
1435
|
+
function mr({ data: e, primaryType: t, types: n }) {
|
|
1436
|
+
const r = [{ type: "bytes32" }], s = [Va({ primaryType: t, types: n })];
|
|
1405
1437
|
for (const a of n[t]) {
|
|
1406
|
-
const [o, i] =
|
|
1438
|
+
const [o, i] = br({
|
|
1407
1439
|
types: n,
|
|
1408
1440
|
name: a.name,
|
|
1409
1441
|
type: a.type,
|
|
@@ -1411,42 +1443,42 @@ function pr({ data: e, primaryType: t, types: n }) {
|
|
|
1411
1443
|
});
|
|
1412
1444
|
r.push(o), s.push(i);
|
|
1413
1445
|
}
|
|
1414
|
-
return
|
|
1446
|
+
return An(r, s);
|
|
1415
1447
|
}
|
|
1416
|
-
function
|
|
1417
|
-
const n =
|
|
1448
|
+
function Va({ primaryType: e, types: t }) {
|
|
1449
|
+
const n = ce(Ga({ primaryType: e, types: t }));
|
|
1418
1450
|
return O(n);
|
|
1419
1451
|
}
|
|
1420
|
-
function
|
|
1452
|
+
function Ga({ primaryType: e, types: t }) {
|
|
1421
1453
|
let n = "";
|
|
1422
|
-
const r =
|
|
1454
|
+
const r = yr({ primaryType: e, types: t });
|
|
1423
1455
|
r.delete(e);
|
|
1424
1456
|
const s = [e, ...Array.from(r).sort()];
|
|
1425
1457
|
for (const a of s)
|
|
1426
1458
|
n += `${a}(${t[a].map(({ name: o, type: i }) => `${i} ${o}`).join(",")})`;
|
|
1427
1459
|
return n;
|
|
1428
1460
|
}
|
|
1429
|
-
function
|
|
1461
|
+
function yr({ primaryType: e, types: t }, n = /* @__PURE__ */ new Set()) {
|
|
1430
1462
|
const s = e.match(/^\w*/u)?.[0];
|
|
1431
1463
|
if (n.has(s) || t[s] === void 0)
|
|
1432
1464
|
return n;
|
|
1433
1465
|
n.add(s);
|
|
1434
1466
|
for (const a of t[s])
|
|
1435
|
-
|
|
1467
|
+
yr({ primaryType: a.type, types: t }, n);
|
|
1436
1468
|
return n;
|
|
1437
1469
|
}
|
|
1438
|
-
function
|
|
1470
|
+
function br({ types: e, name: t, type: n, value: r }) {
|
|
1439
1471
|
if (e[n] !== void 0)
|
|
1440
1472
|
return [
|
|
1441
1473
|
{ type: "bytes32" },
|
|
1442
|
-
O(
|
|
1474
|
+
O(mr({ data: r, primaryType: n, types: e }))
|
|
1443
1475
|
];
|
|
1444
1476
|
if (n === "bytes")
|
|
1445
|
-
return
|
|
1477
|
+
return [{ type: "bytes32" }, O(r)];
|
|
1446
1478
|
if (n === "string")
|
|
1447
|
-
return [{ type: "bytes32" }, O(
|
|
1479
|
+
return [{ type: "bytes32" }, O(ce(r))];
|
|
1448
1480
|
if (n.lastIndexOf("]") === n.length - 1) {
|
|
1449
|
-
const s = n.slice(0, n.lastIndexOf("[")), a = r.map((o) =>
|
|
1481
|
+
const s = n.slice(0, n.lastIndexOf("[")), a = r.map((o) => br({
|
|
1450
1482
|
name: t,
|
|
1451
1483
|
type: s,
|
|
1452
1484
|
types: e,
|
|
@@ -1454,12 +1486,12 @@ function yr({ types: e, name: t, type: n, value: r }) {
|
|
|
1454
1486
|
}));
|
|
1455
1487
|
return [
|
|
1456
1488
|
{ type: "bytes32" },
|
|
1457
|
-
O(
|
|
1489
|
+
O(An(a.map(([o]) => o), a.map(([, o]) => o)))
|
|
1458
1490
|
];
|
|
1459
1491
|
}
|
|
1460
1492
|
return [{ type: n }, r];
|
|
1461
1493
|
}
|
|
1462
|
-
class
|
|
1494
|
+
class Za extends Map {
|
|
1463
1495
|
constructor(t) {
|
|
1464
1496
|
super(), Object.defineProperty(this, "maxSize", {
|
|
1465
1497
|
enumerable: !0,
|
|
@@ -1480,36 +1512,36 @@ class Ha extends Map {
|
|
|
1480
1512
|
return this;
|
|
1481
1513
|
}
|
|
1482
1514
|
}
|
|
1483
|
-
const
|
|
1484
|
-
checksum: /* @__PURE__ */ new
|
|
1485
|
-
}, je =
|
|
1486
|
-
function
|
|
1487
|
-
const { as: n = typeof e == "string" ? "Hex" : "Bytes" } = t, r =
|
|
1515
|
+
const Ja = {
|
|
1516
|
+
checksum: /* @__PURE__ */ new Za(8192)
|
|
1517
|
+
}, je = Ja.checksum;
|
|
1518
|
+
function gr(e, t = {}) {
|
|
1519
|
+
const { as: n = typeof e == "string" ? "Hex" : "Bytes" } = t, r = Cs(Ls(e));
|
|
1488
1520
|
return n === "Bytes" ? r : G(r);
|
|
1489
1521
|
}
|
|
1490
|
-
const
|
|
1522
|
+
const Ya = /^0x[a-fA-F0-9]{40}$/;
|
|
1491
1523
|
function De(e, t = {}) {
|
|
1492
1524
|
const { strict: n = !0 } = t;
|
|
1493
|
-
if (!
|
|
1525
|
+
if (!Ya.test(e))
|
|
1494
1526
|
throw new fn({
|
|
1495
1527
|
address: e,
|
|
1496
|
-
cause: new
|
|
1528
|
+
cause: new Ka()
|
|
1497
1529
|
});
|
|
1498
1530
|
if (n) {
|
|
1499
1531
|
if (e.toLowerCase() === e)
|
|
1500
1532
|
return;
|
|
1501
|
-
if (
|
|
1533
|
+
if (wr(e) !== e)
|
|
1502
1534
|
throw new fn({
|
|
1503
1535
|
address: e,
|
|
1504
|
-
cause: new
|
|
1536
|
+
cause: new Qa()
|
|
1505
1537
|
});
|
|
1506
1538
|
}
|
|
1507
1539
|
}
|
|
1508
|
-
function
|
|
1540
|
+
function wr(e) {
|
|
1509
1541
|
if (je.has(e))
|
|
1510
1542
|
return je.get(e);
|
|
1511
1543
|
De(e, { strict: !1 });
|
|
1512
|
-
const t = e.substring(2).toLowerCase(), n =
|
|
1544
|
+
const t = e.substring(2).toLowerCase(), n = gr(js(t), { as: "Bytes" }), r = t.split("");
|
|
1513
1545
|
for (let a = 0; a < 40; a += 2)
|
|
1514
1546
|
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());
|
|
1515
1547
|
const s = `0x${r.join("")}`;
|
|
@@ -1523,7 +1555,7 @@ function rt(e, t = {}) {
|
|
|
1523
1555
|
return !1;
|
|
1524
1556
|
}
|
|
1525
1557
|
}
|
|
1526
|
-
class fn extends
|
|
1558
|
+
class fn extends R {
|
|
1527
1559
|
constructor({ address: t, cause: n }) {
|
|
1528
1560
|
super(`Address "${t}" is invalid.`, {
|
|
1529
1561
|
cause: n
|
|
@@ -1535,7 +1567,7 @@ class fn extends I {
|
|
|
1535
1567
|
});
|
|
1536
1568
|
}
|
|
1537
1569
|
}
|
|
1538
|
-
class
|
|
1570
|
+
class Ka extends R {
|
|
1539
1571
|
constructor() {
|
|
1540
1572
|
super("Address is not a 20 byte (40 hexadecimal character) value."), Object.defineProperty(this, "name", {
|
|
1541
1573
|
enumerable: !0,
|
|
@@ -1545,7 +1577,7 @@ class Ja extends I {
|
|
|
1545
1577
|
});
|
|
1546
1578
|
}
|
|
1547
1579
|
}
|
|
1548
|
-
class
|
|
1580
|
+
class Qa extends R {
|
|
1549
1581
|
constructor() {
|
|
1550
1582
|
super("Address does not match its checksum counterpart."), Object.defineProperty(this, "name", {
|
|
1551
1583
|
enumerable: !0,
|
|
@@ -1555,85 +1587,85 @@ class Ya extends I {
|
|
|
1555
1587
|
});
|
|
1556
1588
|
}
|
|
1557
1589
|
}
|
|
1558
|
-
const
|
|
1590
|
+
const Xa = /^(.*)\[([0-9]*)\]$/, eo = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, vr = /^(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)?$/, ln = 2n ** 256n - 1n;
|
|
1559
1591
|
function se(e, t, n) {
|
|
1560
|
-
const { checksumAddress: r, staticPosition: s } = n, a =
|
|
1592
|
+
const { checksumAddress: r, staticPosition: s } = n, a = xt(t.type);
|
|
1561
1593
|
if (a) {
|
|
1562
1594
|
const [o, i] = a;
|
|
1563
|
-
return
|
|
1595
|
+
return no(e, { ...t, type: i }, { checksumAddress: r, length: o, staticPosition: s });
|
|
1564
1596
|
}
|
|
1565
1597
|
if (t.type === "tuple")
|
|
1566
|
-
return
|
|
1598
|
+
return oo(e, t, {
|
|
1567
1599
|
checksumAddress: r,
|
|
1568
1600
|
staticPosition: s
|
|
1569
1601
|
});
|
|
1570
1602
|
if (t.type === "address")
|
|
1571
|
-
return
|
|
1603
|
+
return to(e, { checksum: r });
|
|
1572
1604
|
if (t.type === "bool")
|
|
1573
|
-
return
|
|
1605
|
+
return ro(e);
|
|
1574
1606
|
if (t.type.startsWith("bytes"))
|
|
1575
|
-
return
|
|
1607
|
+
return so(e, t, { staticPosition: s });
|
|
1576
1608
|
if (t.type.startsWith("uint") || t.type.startsWith("int"))
|
|
1577
|
-
return
|
|
1609
|
+
return ao(e, t);
|
|
1578
1610
|
if (t.type === "string")
|
|
1579
|
-
return
|
|
1580
|
-
throw new
|
|
1611
|
+
return io(e, { staticPosition: s });
|
|
1612
|
+
throw new At(t.type);
|
|
1581
1613
|
}
|
|
1582
1614
|
const hn = 32, st = 32;
|
|
1583
|
-
function
|
|
1615
|
+
function to(e, t = {}) {
|
|
1584
1616
|
const { checksum: n = !1 } = t, r = e.readBytes(32);
|
|
1585
|
-
return [((a) => n ?
|
|
1617
|
+
return [((a) => n ? wr(a) : a)(G(Ws(r, -20))), 32];
|
|
1586
1618
|
}
|
|
1587
|
-
function
|
|
1619
|
+
function no(e, t, n) {
|
|
1588
1620
|
const { checksumAddress: r, length: s, staticPosition: a } = n;
|
|
1589
1621
|
if (!s) {
|
|
1590
|
-
const c =
|
|
1591
|
-
e.setPosition(
|
|
1592
|
-
const
|
|
1622
|
+
const c = W(e.readBytes(st)), d = a + c, u = d + hn;
|
|
1623
|
+
e.setPosition(d);
|
|
1624
|
+
const f = W(e.readBytes(hn)), l = ye(t);
|
|
1593
1625
|
let h = 0;
|
|
1594
1626
|
const p = [];
|
|
1595
|
-
for (let g = 0; g <
|
|
1596
|
-
e.setPosition(
|
|
1627
|
+
for (let g = 0; g < f; ++g) {
|
|
1628
|
+
e.setPosition(u + (l ? g * 32 : h));
|
|
1597
1629
|
const [y, m] = se(e, t, {
|
|
1598
1630
|
checksumAddress: r,
|
|
1599
|
-
staticPosition:
|
|
1631
|
+
staticPosition: u
|
|
1600
1632
|
});
|
|
1601
1633
|
h += m, p.push(y);
|
|
1602
1634
|
}
|
|
1603
1635
|
return e.setPosition(a + 32), [p, 32];
|
|
1604
1636
|
}
|
|
1605
|
-
if (
|
|
1606
|
-
const c =
|
|
1607
|
-
for (let
|
|
1608
|
-
e.setPosition(
|
|
1609
|
-
const [
|
|
1637
|
+
if (ye(t)) {
|
|
1638
|
+
const c = W(e.readBytes(st)), d = a + c, u = [];
|
|
1639
|
+
for (let f = 0; f < s; ++f) {
|
|
1640
|
+
e.setPosition(d + f * 32);
|
|
1641
|
+
const [l] = se(e, t, {
|
|
1610
1642
|
checksumAddress: r,
|
|
1611
|
-
staticPosition:
|
|
1643
|
+
staticPosition: d
|
|
1612
1644
|
});
|
|
1613
|
-
|
|
1645
|
+
u.push(l);
|
|
1614
1646
|
}
|
|
1615
|
-
return e.setPosition(a + 32), [
|
|
1647
|
+
return e.setPosition(a + 32), [u, 32];
|
|
1616
1648
|
}
|
|
1617
1649
|
let o = 0;
|
|
1618
1650
|
const i = [];
|
|
1619
1651
|
for (let c = 0; c < s; ++c) {
|
|
1620
|
-
const [
|
|
1652
|
+
const [d, u] = se(e, t, {
|
|
1621
1653
|
checksumAddress: r,
|
|
1622
1654
|
staticPosition: a + o
|
|
1623
1655
|
});
|
|
1624
|
-
o +=
|
|
1656
|
+
o += u, i.push(d);
|
|
1625
1657
|
}
|
|
1626
1658
|
return [i, o];
|
|
1627
1659
|
}
|
|
1628
|
-
function
|
|
1629
|
-
return [
|
|
1660
|
+
function ro(e) {
|
|
1661
|
+
return [Gs(e.readBytes(32), { size: 32 }), 32];
|
|
1630
1662
|
}
|
|
1631
|
-
function
|
|
1663
|
+
function so(e, t, { staticPosition: n }) {
|
|
1632
1664
|
const [r, s] = t.type.split("bytes");
|
|
1633
1665
|
if (!s) {
|
|
1634
|
-
const o =
|
|
1666
|
+
const o = W(e.readBytes(32));
|
|
1635
1667
|
e.setPosition(n + o);
|
|
1636
|
-
const i =
|
|
1668
|
+
const i = W(e.readBytes(32));
|
|
1637
1669
|
if (i === 0)
|
|
1638
1670
|
return e.setPosition(n + 32), ["0x", 32];
|
|
1639
1671
|
const c = e.readBytes(i);
|
|
@@ -1641,48 +1673,48 @@ function no(e, t, { staticPosition: n }) {
|
|
|
1641
1673
|
}
|
|
1642
1674
|
return [G(e.readBytes(Number.parseInt(s, 10), 32)), 32];
|
|
1643
1675
|
}
|
|
1644
|
-
function
|
|
1676
|
+
function ao(e, t) {
|
|
1645
1677
|
const n = t.type.startsWith("int"), r = Number.parseInt(t.type.split("int")[1] || "256", 10), s = e.readBytes(32);
|
|
1646
1678
|
return [
|
|
1647
|
-
r > 48 ? Vs(s, { signed: n }) :
|
|
1679
|
+
r > 48 ? Vs(s, { signed: n }) : W(s, { signed: n }),
|
|
1648
1680
|
32
|
|
1649
1681
|
];
|
|
1650
1682
|
}
|
|
1651
|
-
function
|
|
1683
|
+
function oo(e, t, n) {
|
|
1652
1684
|
const { checksumAddress: r, staticPosition: s } = n, a = t.components.length === 0 || t.components.some(({ name: c }) => !c), o = a ? [] : {};
|
|
1653
1685
|
let i = 0;
|
|
1654
|
-
if (
|
|
1655
|
-
const c =
|
|
1656
|
-
for (let
|
|
1657
|
-
const
|
|
1658
|
-
e.setPosition(
|
|
1659
|
-
const [
|
|
1686
|
+
if (ye(t)) {
|
|
1687
|
+
const c = W(e.readBytes(st)), d = s + c;
|
|
1688
|
+
for (let u = 0; u < t.components.length; ++u) {
|
|
1689
|
+
const f = t.components[u];
|
|
1690
|
+
e.setPosition(d + i);
|
|
1691
|
+
const [l, h] = se(e, f, {
|
|
1660
1692
|
checksumAddress: r,
|
|
1661
|
-
staticPosition:
|
|
1693
|
+
staticPosition: d
|
|
1662
1694
|
});
|
|
1663
|
-
i += h, o[a ?
|
|
1695
|
+
i += h, o[a ? u : f?.name] = l;
|
|
1664
1696
|
}
|
|
1665
1697
|
return e.setPosition(s + 32), [o, 32];
|
|
1666
1698
|
}
|
|
1667
1699
|
for (let c = 0; c < t.components.length; ++c) {
|
|
1668
|
-
const
|
|
1700
|
+
const d = t.components[c], [u, f] = se(e, d, {
|
|
1669
1701
|
checksumAddress: r,
|
|
1670
1702
|
staticPosition: s
|
|
1671
1703
|
});
|
|
1672
|
-
o[a ? c :
|
|
1704
|
+
o[a ? c : d?.name] = u, i += f;
|
|
1673
1705
|
}
|
|
1674
1706
|
return [o, i];
|
|
1675
1707
|
}
|
|
1676
|
-
function
|
|
1677
|
-
const n =
|
|
1708
|
+
function io(e, { staticPosition: t }) {
|
|
1709
|
+
const n = W(e.readBytes(32)), r = t + n;
|
|
1678
1710
|
e.setPosition(r);
|
|
1679
|
-
const s =
|
|
1711
|
+
const s = W(e.readBytes(32));
|
|
1680
1712
|
if (s === 0)
|
|
1681
1713
|
return e.setPosition(t + 32), ["", 32];
|
|
1682
|
-
const a = e.readBytes(s, 32), o =
|
|
1714
|
+
const a = e.readBytes(s, 32), o = Zs(Yn(a));
|
|
1683
1715
|
return e.setPosition(t + 32), [o, 32];
|
|
1684
1716
|
}
|
|
1685
|
-
function
|
|
1717
|
+
function co({ checksumAddress: e, parameters: t, values: n }) {
|
|
1686
1718
|
const r = [];
|
|
1687
1719
|
for (let s = 0; s < t.length; s++)
|
|
1688
1720
|
r.push(Et({
|
|
@@ -1693,10 +1725,10 @@ function oo({ checksumAddress: e, parameters: t, values: n }) {
|
|
|
1693
1725
|
return r;
|
|
1694
1726
|
}
|
|
1695
1727
|
function Et({ checksumAddress: e = !1, parameter: t, value: n }) {
|
|
1696
|
-
const r = t, s =
|
|
1728
|
+
const r = t, s = xt(r.type);
|
|
1697
1729
|
if (s) {
|
|
1698
1730
|
const [a, o] = s;
|
|
1699
|
-
return
|
|
1731
|
+
return fo(n, {
|
|
1700
1732
|
checksumAddress: e,
|
|
1701
1733
|
length: a,
|
|
1702
1734
|
parameter: {
|
|
@@ -1706,28 +1738,28 @@ function Et({ checksumAddress: e = !1, parameter: t, value: n }) {
|
|
|
1706
1738
|
});
|
|
1707
1739
|
}
|
|
1708
1740
|
if (r.type === "tuple")
|
|
1709
|
-
return
|
|
1741
|
+
return yo(n, {
|
|
1710
1742
|
checksumAddress: e,
|
|
1711
1743
|
parameter: r
|
|
1712
1744
|
});
|
|
1713
1745
|
if (r.type === "address")
|
|
1714
|
-
return
|
|
1746
|
+
return uo(n, {
|
|
1715
1747
|
checksum: e
|
|
1716
1748
|
});
|
|
1717
1749
|
if (r.type === "bool")
|
|
1718
|
-
return
|
|
1750
|
+
return ho(n);
|
|
1719
1751
|
if (r.type.startsWith("uint") || r.type.startsWith("int")) {
|
|
1720
|
-
const a = r.type.startsWith("int"), [, , o = "256"] =
|
|
1721
|
-
return
|
|
1752
|
+
const a = r.type.startsWith("int"), [, , o = "256"] = vr.exec(r.type) ?? [];
|
|
1753
|
+
return po(n, {
|
|
1722
1754
|
signed: a,
|
|
1723
1755
|
size: Number(o)
|
|
1724
1756
|
});
|
|
1725
1757
|
}
|
|
1726
1758
|
if (r.type.startsWith("bytes"))
|
|
1727
|
-
return
|
|
1759
|
+
return lo(n, { type: r.type });
|
|
1728
1760
|
if (r.type === "string")
|
|
1729
|
-
return
|
|
1730
|
-
throw new
|
|
1761
|
+
return mo(n);
|
|
1762
|
+
throw new At(r.type);
|
|
1731
1763
|
}
|
|
1732
1764
|
function Pt(e) {
|
|
1733
1765
|
let t = 0;
|
|
@@ -1739,23 +1771,23 @@ function Pt(e) {
|
|
|
1739
1771
|
let s = 0;
|
|
1740
1772
|
for (let a = 0; a < e.length; a++) {
|
|
1741
1773
|
const { dynamic: o, encoded: i } = e[a];
|
|
1742
|
-
o ? (n.push(
|
|
1774
|
+
o ? (n.push(oe(t + s, { size: 32 })), r.push(i), s += Q(i)) : n.push(i);
|
|
1743
1775
|
}
|
|
1744
1776
|
return q(...n, ...r);
|
|
1745
1777
|
}
|
|
1746
|
-
function
|
|
1778
|
+
function uo(e, t) {
|
|
1747
1779
|
const { checksum: n = !1 } = t;
|
|
1748
1780
|
return De(e, { strict: n }), {
|
|
1749
1781
|
dynamic: !1,
|
|
1750
|
-
encoded:
|
|
1782
|
+
encoded: pe(e.toLowerCase())
|
|
1751
1783
|
};
|
|
1752
1784
|
}
|
|
1753
|
-
function
|
|
1785
|
+
function fo(e, t) {
|
|
1754
1786
|
const { checksumAddress: n, length: r, parameter: s } = t, a = r === null;
|
|
1755
1787
|
if (!Array.isArray(e))
|
|
1756
|
-
throw new
|
|
1788
|
+
throw new Ao(e);
|
|
1757
1789
|
if (!a && e.length !== r)
|
|
1758
|
-
throw new
|
|
1790
|
+
throw new To({
|
|
1759
1791
|
expectedLength: r,
|
|
1760
1792
|
givenLength: e.length,
|
|
1761
1793
|
type: `${s.type}[${r}]`
|
|
@@ -1763,20 +1795,20 @@ function co(e, t) {
|
|
|
1763
1795
|
let o = !1;
|
|
1764
1796
|
const i = [];
|
|
1765
1797
|
for (let c = 0; c < e.length; c++) {
|
|
1766
|
-
const
|
|
1798
|
+
const d = Et({
|
|
1767
1799
|
checksumAddress: n,
|
|
1768
1800
|
parameter: s,
|
|
1769
1801
|
value: e[c]
|
|
1770
1802
|
});
|
|
1771
|
-
|
|
1803
|
+
d.dynamic && (o = !0), i.push(d);
|
|
1772
1804
|
}
|
|
1773
1805
|
if (a || o) {
|
|
1774
1806
|
const c = Pt(i);
|
|
1775
1807
|
if (a) {
|
|
1776
|
-
const
|
|
1808
|
+
const d = oe(i.length, { size: 32 });
|
|
1777
1809
|
return {
|
|
1778
1810
|
dynamic: !0,
|
|
1779
|
-
encoded: i.length > 0 ? q(
|
|
1811
|
+
encoded: i.length > 0 ? q(d, c) : d
|
|
1780
1812
|
};
|
|
1781
1813
|
}
|
|
1782
1814
|
if (o)
|
|
@@ -1787,32 +1819,32 @@ function co(e, t) {
|
|
|
1787
1819
|
encoded: q(...i.map(({ encoded: c }) => c))
|
|
1788
1820
|
};
|
|
1789
1821
|
}
|
|
1790
|
-
function
|
|
1822
|
+
function lo(e, { type: t }) {
|
|
1791
1823
|
const [, n] = t.split("bytes"), r = Q(e);
|
|
1792
1824
|
if (!n) {
|
|
1793
1825
|
let s = e;
|
|
1794
1826
|
return r % 32 !== 0 && (s = ae(s, Math.ceil((e.length - 2) / 2 / 32) * 32)), {
|
|
1795
1827
|
dynamic: !0,
|
|
1796
|
-
encoded: q(
|
|
1828
|
+
encoded: q(pe(oe(r, { size: 32 })), s)
|
|
1797
1829
|
};
|
|
1798
1830
|
}
|
|
1799
1831
|
if (r !== Number.parseInt(n, 10))
|
|
1800
|
-
throw new
|
|
1832
|
+
throw new Pr({
|
|
1801
1833
|
expectedSize: Number.parseInt(n, 10),
|
|
1802
1834
|
value: e
|
|
1803
1835
|
});
|
|
1804
1836
|
return { dynamic: !1, encoded: ae(e) };
|
|
1805
1837
|
}
|
|
1806
|
-
function
|
|
1838
|
+
function ho(e) {
|
|
1807
1839
|
if (typeof e != "boolean")
|
|
1808
|
-
throw new
|
|
1809
|
-
return { dynamic: !1, encoded:
|
|
1840
|
+
throw new R(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);
|
|
1841
|
+
return { dynamic: !1, encoded: pe(In(e)) };
|
|
1810
1842
|
}
|
|
1811
|
-
function
|
|
1843
|
+
function po(e, { signed: t, size: n }) {
|
|
1812
1844
|
if (typeof n == "number") {
|
|
1813
1845
|
const r = 2n ** (BigInt(n) - (t ? 1n : 0n)) - 1n, s = t ? -r - 1n : 0n;
|
|
1814
1846
|
if (e > r || e < s)
|
|
1815
|
-
throw new
|
|
1847
|
+
throw new Yr({
|
|
1816
1848
|
max: r.toString(),
|
|
1817
1849
|
min: s.toString(),
|
|
1818
1850
|
signed: t,
|
|
@@ -1822,58 +1854,58 @@ function lo(e, { signed: t, size: n }) {
|
|
|
1822
1854
|
}
|
|
1823
1855
|
return {
|
|
1824
1856
|
dynamic: !1,
|
|
1825
|
-
encoded:
|
|
1857
|
+
encoded: oe(e, {
|
|
1826
1858
|
size: 32,
|
|
1827
1859
|
signed: t
|
|
1828
1860
|
})
|
|
1829
1861
|
};
|
|
1830
1862
|
}
|
|
1831
|
-
function
|
|
1863
|
+
function mo(e) {
|
|
1832
1864
|
const t = ft(e), n = Math.ceil(Q(t) / 32), r = [];
|
|
1833
1865
|
for (let s = 0; s < n; s++)
|
|
1834
|
-
r.push(ae(
|
|
1866
|
+
r.push(ae(j(t, s * 32, (s + 1) * 32)));
|
|
1835
1867
|
return {
|
|
1836
1868
|
dynamic: !0,
|
|
1837
|
-
encoded: q(ae(
|
|
1869
|
+
encoded: q(ae(oe(Q(t), { size: 32 })), ...r)
|
|
1838
1870
|
};
|
|
1839
1871
|
}
|
|
1840
|
-
function
|
|
1872
|
+
function yo(e, t) {
|
|
1841
1873
|
const { checksumAddress: n, parameter: r } = t;
|
|
1842
1874
|
let s = !1;
|
|
1843
1875
|
const a = [];
|
|
1844
1876
|
for (let o = 0; o < r.components.length; o++) {
|
|
1845
|
-
const i = r.components[o], c = Array.isArray(e) ? o : i.name,
|
|
1877
|
+
const i = r.components[o], c = Array.isArray(e) ? o : i.name, d = Et({
|
|
1846
1878
|
checksumAddress: n,
|
|
1847
1879
|
parameter: i,
|
|
1848
1880
|
value: e[c]
|
|
1849
1881
|
});
|
|
1850
|
-
a.push(
|
|
1882
|
+
a.push(d), d.dynamic && (s = !0);
|
|
1851
1883
|
}
|
|
1852
1884
|
return {
|
|
1853
1885
|
dynamic: s,
|
|
1854
1886
|
encoded: s ? Pt(a) : q(...a.map(({ encoded: o }) => o))
|
|
1855
1887
|
};
|
|
1856
1888
|
}
|
|
1857
|
-
function
|
|
1889
|
+
function xt(e) {
|
|
1858
1890
|
const t = e.match(/^(.*)\[(\d+)?\]$/);
|
|
1859
1891
|
return t ? (
|
|
1860
1892
|
// Return `null` if the array is dynamic.
|
|
1861
1893
|
[t[2] ? Number(t[2]) : null, t[1]]
|
|
1862
1894
|
) : void 0;
|
|
1863
1895
|
}
|
|
1864
|
-
function
|
|
1896
|
+
function ye(e) {
|
|
1865
1897
|
const { type: t } = e;
|
|
1866
1898
|
if (t === "string" || t === "bytes" || t.endsWith("[]"))
|
|
1867
1899
|
return !0;
|
|
1868
1900
|
if (t === "tuple")
|
|
1869
|
-
return e.components?.some(
|
|
1870
|
-
const n =
|
|
1871
|
-
return !!(n &&
|
|
1901
|
+
return e.components?.some(ye);
|
|
1902
|
+
const n = xt(e.type);
|
|
1903
|
+
return !!(n && ye({
|
|
1872
1904
|
...e,
|
|
1873
1905
|
type: n[1]
|
|
1874
1906
|
}));
|
|
1875
1907
|
}
|
|
1876
|
-
const
|
|
1908
|
+
const bo = {
|
|
1877
1909
|
bytes: new Uint8Array(),
|
|
1878
1910
|
dataView: new DataView(new ArrayBuffer(0)),
|
|
1879
1911
|
position: 0,
|
|
@@ -1882,14 +1914,14 @@ const mo = {
|
|
|
1882
1914
|
recursiveReadLimit: Number.POSITIVE_INFINITY,
|
|
1883
1915
|
assertReadLimit() {
|
|
1884
1916
|
if (this.recursiveReadCount >= this.recursiveReadLimit)
|
|
1885
|
-
throw new
|
|
1917
|
+
throw new vo({
|
|
1886
1918
|
count: this.recursiveReadCount + 1,
|
|
1887
1919
|
limit: this.recursiveReadLimit
|
|
1888
1920
|
});
|
|
1889
1921
|
},
|
|
1890
1922
|
assertPosition(e) {
|
|
1891
1923
|
if (e < 0 || e > this.bytes.length - 1)
|
|
1892
|
-
throw new
|
|
1924
|
+
throw new wo({
|
|
1893
1925
|
length: this.bytes.length,
|
|
1894
1926
|
position: e
|
|
1895
1927
|
});
|
|
@@ -1995,11 +2027,11 @@ const mo = {
|
|
|
1995
2027
|
this.positionReadCount.set(this.position, e + 1), e > 0 && this.recursiveReadCount++;
|
|
1996
2028
|
}
|
|
1997
2029
|
};
|
|
1998
|
-
function
|
|
1999
|
-
const n = Object.create(
|
|
2030
|
+
function go(e, { recursiveReadLimit: t = 8192 } = {}) {
|
|
2031
|
+
const n = Object.create(bo);
|
|
2000
2032
|
return n.bytes = e, n.dataView = new DataView(e.buffer, e.byteOffset, e.byteLength), n.positionReadCount = /* @__PURE__ */ new Map(), n.recursiveReadLimit = t, n;
|
|
2001
2033
|
}
|
|
2002
|
-
class pn extends
|
|
2034
|
+
class pn extends R {
|
|
2003
2035
|
constructor({ offset: t }) {
|
|
2004
2036
|
super(`Offset \`${t}\` cannot be negative.`), Object.defineProperty(this, "name", {
|
|
2005
2037
|
enumerable: !0,
|
|
@@ -2009,7 +2041,7 @@ class pn extends I {
|
|
|
2009
2041
|
});
|
|
2010
2042
|
}
|
|
2011
2043
|
}
|
|
2012
|
-
class
|
|
2044
|
+
class wo extends R {
|
|
2013
2045
|
constructor({ length: t, position: n }) {
|
|
2014
2046
|
super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`), Object.defineProperty(this, "name", {
|
|
2015
2047
|
enumerable: !0,
|
|
@@ -2019,7 +2051,7 @@ class bo extends I {
|
|
|
2019
2051
|
});
|
|
2020
2052
|
}
|
|
2021
2053
|
}
|
|
2022
|
-
class
|
|
2054
|
+
class vo extends R {
|
|
2023
2055
|
constructor({ count: t, limit: n }) {
|
|
2024
2056
|
super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`), Object.defineProperty(this, "name", {
|
|
2025
2057
|
enumerable: !0,
|
|
@@ -2029,37 +2061,37 @@ class go extends I {
|
|
|
2029
2061
|
});
|
|
2030
2062
|
}
|
|
2031
2063
|
}
|
|
2032
|
-
function
|
|
2033
|
-
const { as: r = "Array", checksumAddress: s = !1 } = n, a = typeof t == "string" ?
|
|
2064
|
+
function Eo(e, t, n = {}) {
|
|
2065
|
+
const { as: r = "Array", checksumAddress: s = !1 } = n, a = typeof t == "string" ? Jn(t) : t, o = go(a);
|
|
2034
2066
|
if (ne(a) === 0 && e.length > 0)
|
|
2035
|
-
throw new
|
|
2067
|
+
throw new xo();
|
|
2036
2068
|
if (ne(a) && ne(a) < 32)
|
|
2037
|
-
throw new
|
|
2069
|
+
throw new Po({
|
|
2038
2070
|
data: typeof t == "string" ? t : G(t),
|
|
2039
2071
|
parameters: e,
|
|
2040
2072
|
size: ne(a)
|
|
2041
2073
|
});
|
|
2042
2074
|
let i = 0;
|
|
2043
2075
|
const c = r === "Array" ? [] : {};
|
|
2044
|
-
for (let
|
|
2045
|
-
const
|
|
2076
|
+
for (let d = 0; d < e.length; ++d) {
|
|
2077
|
+
const u = e[d];
|
|
2046
2078
|
o.setPosition(i);
|
|
2047
|
-
const [
|
|
2079
|
+
const [f, l] = se(o, u, {
|
|
2048
2080
|
checksumAddress: s,
|
|
2049
2081
|
staticPosition: 0
|
|
2050
2082
|
});
|
|
2051
|
-
i +=
|
|
2083
|
+
i += l, r === "Array" ? c.push(f) : c[u.name ?? d] = f;
|
|
2052
2084
|
}
|
|
2053
2085
|
return c;
|
|
2054
2086
|
}
|
|
2055
|
-
function
|
|
2087
|
+
function Tt(e, t, n) {
|
|
2056
2088
|
const { checksumAddress: r = !1 } = {};
|
|
2057
2089
|
if (e.length !== t.length)
|
|
2058
|
-
throw new
|
|
2090
|
+
throw new xr({
|
|
2059
2091
|
expectedLength: e.length,
|
|
2060
2092
|
givenLength: t.length
|
|
2061
2093
|
});
|
|
2062
|
-
const s =
|
|
2094
|
+
const s = co({
|
|
2063
2095
|
checksumAddress: r,
|
|
2064
2096
|
parameters: e,
|
|
2065
2097
|
values: t
|
|
@@ -2068,7 +2100,7 @@ function At(e, t, n) {
|
|
|
2068
2100
|
}
|
|
2069
2101
|
function at(e, t) {
|
|
2070
2102
|
if (e.length !== t.length)
|
|
2071
|
-
throw new
|
|
2103
|
+
throw new xr({
|
|
2072
2104
|
expectedLength: e.length,
|
|
2073
2105
|
givenLength: t.length
|
|
2074
2106
|
});
|
|
@@ -2083,51 +2115,51 @@ function at(e, t) {
|
|
|
2083
2115
|
function t(n, r, s = !1) {
|
|
2084
2116
|
if (n === "address") {
|
|
2085
2117
|
const c = r;
|
|
2086
|
-
return De(c),
|
|
2118
|
+
return De(c), pe(c.toLowerCase(), s ? 32 : 0);
|
|
2087
2119
|
}
|
|
2088
2120
|
if (n === "string")
|
|
2089
2121
|
return ft(r);
|
|
2090
2122
|
if (n === "bytes")
|
|
2091
2123
|
return r;
|
|
2092
2124
|
if (n === "bool")
|
|
2093
|
-
return
|
|
2094
|
-
const a = n.match(
|
|
2125
|
+
return pe(In(r), s ? 32 : 1);
|
|
2126
|
+
const a = n.match(vr);
|
|
2095
2127
|
if (a) {
|
|
2096
|
-
const [c,
|
|
2097
|
-
return
|
|
2098
|
-
size: s ? 32 :
|
|
2099
|
-
signed:
|
|
2128
|
+
const [c, d, u = "256"] = a, f = Number.parseInt(u, 10) / 8;
|
|
2129
|
+
return oe(r, {
|
|
2130
|
+
size: s ? 32 : f,
|
|
2131
|
+
signed: d === "int"
|
|
2100
2132
|
});
|
|
2101
2133
|
}
|
|
2102
|
-
const o = n.match(
|
|
2134
|
+
const o = n.match(eo);
|
|
2103
2135
|
if (o) {
|
|
2104
|
-
const [c,
|
|
2105
|
-
if (Number.parseInt(
|
|
2106
|
-
throw new
|
|
2107
|
-
expectedSize: Number.parseInt(
|
|
2136
|
+
const [c, d] = o;
|
|
2137
|
+
if (Number.parseInt(d, 10) !== (r.length - 2) / 2)
|
|
2138
|
+
throw new Pr({
|
|
2139
|
+
expectedSize: Number.parseInt(d, 10),
|
|
2108
2140
|
value: r
|
|
2109
2141
|
});
|
|
2110
2142
|
return ae(r, s ? 32 : 0);
|
|
2111
2143
|
}
|
|
2112
|
-
const i = n.match(
|
|
2144
|
+
const i = n.match(Xa);
|
|
2113
2145
|
if (i && Array.isArray(r)) {
|
|
2114
|
-
const [c,
|
|
2115
|
-
for (let
|
|
2116
|
-
|
|
2117
|
-
return
|
|
2146
|
+
const [c, d] = i, u = [];
|
|
2147
|
+
for (let f = 0; f < r.length; f++)
|
|
2148
|
+
u.push(t(d, r[f], !0));
|
|
2149
|
+
return u.length === 0 ? "0x" : q(...u);
|
|
2118
2150
|
}
|
|
2119
|
-
throw new
|
|
2151
|
+
throw new At(n);
|
|
2120
2152
|
}
|
|
2121
2153
|
e.encode = t;
|
|
2122
2154
|
})(at || (at = {}));
|
|
2123
|
-
function
|
|
2155
|
+
function Er(e) {
|
|
2124
2156
|
return Array.isArray(e) && typeof e[0] == "string" || typeof e == "string" ? on(e) : e;
|
|
2125
2157
|
}
|
|
2126
|
-
class
|
|
2158
|
+
class Po extends R {
|
|
2127
2159
|
constructor({ data: t, parameters: n, size: r }) {
|
|
2128
2160
|
super(`Data size of ${r} bytes is too small for given parameters.`, {
|
|
2129
2161
|
metaMessages: [
|
|
2130
|
-
`Params: (${
|
|
2162
|
+
`Params: (${Kr(n)})`,
|
|
2131
2163
|
`Data: ${t} (${r} bytes)`
|
|
2132
2164
|
]
|
|
2133
2165
|
}), Object.defineProperty(this, "name", {
|
|
@@ -2138,7 +2170,7 @@ class vo extends I {
|
|
|
2138
2170
|
});
|
|
2139
2171
|
}
|
|
2140
2172
|
}
|
|
2141
|
-
class
|
|
2173
|
+
class xo extends R {
|
|
2142
2174
|
constructor() {
|
|
2143
2175
|
super('Cannot decode zero data ("0x") with ABI parameters.'), Object.defineProperty(this, "name", {
|
|
2144
2176
|
enumerable: !0,
|
|
@@ -2148,7 +2180,7 @@ class Eo extends I {
|
|
|
2148
2180
|
});
|
|
2149
2181
|
}
|
|
2150
2182
|
}
|
|
2151
|
-
class
|
|
2183
|
+
class To extends R {
|
|
2152
2184
|
constructor({ expectedLength: t, givenLength: n, type: r }) {
|
|
2153
2185
|
super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`), Object.defineProperty(this, "name", {
|
|
2154
2186
|
enumerable: !0,
|
|
@@ -2158,7 +2190,7 @@ class Po extends I {
|
|
|
2158
2190
|
});
|
|
2159
2191
|
}
|
|
2160
2192
|
}
|
|
2161
|
-
class
|
|
2193
|
+
class Pr extends R {
|
|
2162
2194
|
constructor({ expectedSize: t, value: n }) {
|
|
2163
2195
|
super(`Size of bytes "${n}" (bytes${Q(n)}) does not match expected size (bytes${t}).`), Object.defineProperty(this, "name", {
|
|
2164
2196
|
enumerable: !0,
|
|
@@ -2168,7 +2200,7 @@ class Er extends I {
|
|
|
2168
2200
|
});
|
|
2169
2201
|
}
|
|
2170
2202
|
}
|
|
2171
|
-
class
|
|
2203
|
+
class xr extends R {
|
|
2172
2204
|
constructor({ expectedLength: t, givenLength: n }) {
|
|
2173
2205
|
super([
|
|
2174
2206
|
"ABI encoding parameters/values length mismatch.",
|
|
@@ -2183,7 +2215,7 @@ class Pr extends I {
|
|
|
2183
2215
|
});
|
|
2184
2216
|
}
|
|
2185
2217
|
}
|
|
2186
|
-
class
|
|
2218
|
+
class Ao extends R {
|
|
2187
2219
|
constructor(t) {
|
|
2188
2220
|
super(`Value \`${t}\` is not a valid array.`), Object.defineProperty(this, "name", {
|
|
2189
2221
|
enumerable: !0,
|
|
@@ -2193,7 +2225,7 @@ class To extends I {
|
|
|
2193
2225
|
});
|
|
2194
2226
|
}
|
|
2195
2227
|
}
|
|
2196
|
-
class
|
|
2228
|
+
class At extends R {
|
|
2197
2229
|
constructor(t) {
|
|
2198
2230
|
super(`Type \`${t}\` is not a valid ABI Type.`), Object.defineProperty(this, "name", {
|
|
2199
2231
|
enumerable: !0,
|
|
@@ -2206,25 +2238,25 @@ class xt extends I {
|
|
|
2206
2238
|
function Tr(e, t = {}) {
|
|
2207
2239
|
const { recovered: n } = t;
|
|
2208
2240
|
if (typeof e.r > "u")
|
|
2209
|
-
throw new
|
|
2241
|
+
throw new He({ signature: e });
|
|
2210
2242
|
if (typeof e.s > "u")
|
|
2211
|
-
throw new
|
|
2243
|
+
throw new He({ signature: e });
|
|
2212
2244
|
if (n && typeof e.yParity > "u")
|
|
2213
|
-
throw new
|
|
2245
|
+
throw new He({ signature: e });
|
|
2214
2246
|
if (e.r < 0n || e.r > ln)
|
|
2215
|
-
throw new
|
|
2247
|
+
throw new Bo({ value: e.r });
|
|
2216
2248
|
if (e.s < 0n || e.s > ln)
|
|
2217
|
-
throw new
|
|
2249
|
+
throw new $o({ value: e.s });
|
|
2218
2250
|
if (typeof e.yParity == "number" && e.yParity !== 0 && e.yParity !== 1)
|
|
2219
2251
|
throw new Rt({ value: e.yParity });
|
|
2220
2252
|
}
|
|
2221
|
-
function
|
|
2253
|
+
function Io(e) {
|
|
2222
2254
|
return Ar(G(e));
|
|
2223
2255
|
}
|
|
2224
2256
|
function Ar(e) {
|
|
2225
2257
|
if (e.length !== 130 && e.length !== 132)
|
|
2226
|
-
throw new
|
|
2227
|
-
const t = BigInt(
|
|
2258
|
+
throw new So({ signature: e });
|
|
2259
|
+
const t = BigInt(j(e, 0, 32)), n = BigInt(j(e, 32, 64)), r = (() => {
|
|
2228
2260
|
const s = +`0x${e.slice(130)}`;
|
|
2229
2261
|
if (!Number.isNaN(s))
|
|
2230
2262
|
try {
|
|
@@ -2242,26 +2274,26 @@ function Ar(e) {
|
|
|
2242
2274
|
yParity: r
|
|
2243
2275
|
};
|
|
2244
2276
|
}
|
|
2245
|
-
function
|
|
2277
|
+
function Ro(e) {
|
|
2246
2278
|
if (!(typeof e.r > "u") && !(typeof e.s > "u"))
|
|
2247
|
-
return
|
|
2279
|
+
return Co(e);
|
|
2248
2280
|
}
|
|
2249
|
-
function
|
|
2250
|
-
const t = typeof e == "string" ? Ar(e) : e instanceof Uint8Array ?
|
|
2281
|
+
function Co(e) {
|
|
2282
|
+
const t = typeof e == "string" ? Ar(e) : e instanceof Uint8Array ? Io(e) : typeof e.r == "string" ? No(e) : e.v ? ko(e) : {
|
|
2251
2283
|
r: e.r,
|
|
2252
2284
|
s: e.s,
|
|
2253
2285
|
...typeof e.yParity < "u" ? { yParity: e.yParity } : {}
|
|
2254
2286
|
};
|
|
2255
2287
|
return Tr(t), t;
|
|
2256
2288
|
}
|
|
2257
|
-
function
|
|
2289
|
+
function ko(e) {
|
|
2258
2290
|
return {
|
|
2259
2291
|
r: e.r,
|
|
2260
2292
|
s: e.s,
|
|
2261
2293
|
yParity: It(e.v)
|
|
2262
2294
|
};
|
|
2263
2295
|
}
|
|
2264
|
-
function
|
|
2296
|
+
function No(e) {
|
|
2265
2297
|
const t = (() => {
|
|
2266
2298
|
const n = e.v ? Number(e.v) : void 0;
|
|
2267
2299
|
let r = e.yParity ? Number(e.yParity) : void 0;
|
|
@@ -2282,14 +2314,14 @@ function It(e) {
|
|
|
2282
2314
|
return 1;
|
|
2283
2315
|
if (e >= 35)
|
|
2284
2316
|
return e % 2 === 0 ? 1 : 0;
|
|
2285
|
-
throw new
|
|
2317
|
+
throw new _o({ value: e });
|
|
2286
2318
|
}
|
|
2287
|
-
class
|
|
2319
|
+
class So extends R {
|
|
2288
2320
|
constructor({ signature: t }) {
|
|
2289
2321
|
super(`Value \`${t}\` is an invalid signature size.`, {
|
|
2290
2322
|
metaMessages: [
|
|
2291
2323
|
"Expected: 64 bytes or 65 bytes.",
|
|
2292
|
-
`Received ${Q(
|
|
2324
|
+
`Received ${Q(Xr(t))} bytes.`
|
|
2293
2325
|
]
|
|
2294
2326
|
}), Object.defineProperty(this, "name", {
|
|
2295
2327
|
enumerable: !0,
|
|
@@ -2299,9 +2331,9 @@ class ko extends I {
|
|
|
2299
2331
|
});
|
|
2300
2332
|
}
|
|
2301
2333
|
}
|
|
2302
|
-
class
|
|
2334
|
+
class He extends R {
|
|
2303
2335
|
constructor({ signature: t }) {
|
|
2304
|
-
super(`Signature \`${
|
|
2336
|
+
super(`Signature \`${Qr(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`), Object.defineProperty(this, "name", {
|
|
2305
2337
|
enumerable: !0,
|
|
2306
2338
|
configurable: !0,
|
|
2307
2339
|
writable: !0,
|
|
@@ -2309,7 +2341,7 @@ class We extends I {
|
|
|
2309
2341
|
});
|
|
2310
2342
|
}
|
|
2311
2343
|
}
|
|
2312
|
-
class
|
|
2344
|
+
class Bo extends R {
|
|
2313
2345
|
constructor({ value: t }) {
|
|
2314
2346
|
super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`), Object.defineProperty(this, "name", {
|
|
2315
2347
|
enumerable: !0,
|
|
@@ -2319,7 +2351,7 @@ class No extends I {
|
|
|
2319
2351
|
});
|
|
2320
2352
|
}
|
|
2321
2353
|
}
|
|
2322
|
-
class
|
|
2354
|
+
class $o extends R {
|
|
2323
2355
|
constructor({ value: t }) {
|
|
2324
2356
|
super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`), Object.defineProperty(this, "name", {
|
|
2325
2357
|
enumerable: !0,
|
|
@@ -2329,7 +2361,7 @@ class Bo extends I {
|
|
|
2329
2361
|
});
|
|
2330
2362
|
}
|
|
2331
2363
|
}
|
|
2332
|
-
class Rt extends
|
|
2364
|
+
class Rt extends R {
|
|
2333
2365
|
constructor({ value: t }) {
|
|
2334
2366
|
super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`), Object.defineProperty(this, "name", {
|
|
2335
2367
|
enumerable: !0,
|
|
@@ -2339,7 +2371,7 @@ class Rt extends I {
|
|
|
2339
2371
|
});
|
|
2340
2372
|
}
|
|
2341
2373
|
}
|
|
2342
|
-
class
|
|
2374
|
+
class _o extends R {
|
|
2343
2375
|
constructor({ value: t }) {
|
|
2344
2376
|
super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`), Object.defineProperty(this, "name", {
|
|
2345
2377
|
enumerable: !0,
|
|
@@ -2349,11 +2381,11 @@ class So extends I {
|
|
|
2349
2381
|
});
|
|
2350
2382
|
}
|
|
2351
2383
|
}
|
|
2352
|
-
function
|
|
2353
|
-
return typeof e.chainId == "string" ?
|
|
2384
|
+
function zo(e, t = {}) {
|
|
2385
|
+
return typeof e.chainId == "string" ? Uo(e) : { ...e, ...t.signature };
|
|
2354
2386
|
}
|
|
2355
|
-
function
|
|
2356
|
-
const { address: t, chainId: n, nonce: r } = e, s =
|
|
2387
|
+
function Uo(e) {
|
|
2388
|
+
const { address: t, chainId: n, nonce: r } = e, s = Ro(e);
|
|
2357
2389
|
return {
|
|
2358
2390
|
address: t,
|
|
2359
2391
|
chainId: Number(n),
|
|
@@ -2361,19 +2393,19 @@ function _o(e) {
|
|
|
2361
2393
|
...s
|
|
2362
2394
|
};
|
|
2363
2395
|
}
|
|
2364
|
-
const
|
|
2365
|
-
function
|
|
2396
|
+
const Fo = "0x8010801080108010801080108010801080108010801080108010801080108010", Oo = Er("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");
|
|
2397
|
+
function Ir(e) {
|
|
2366
2398
|
if (typeof e == "string") {
|
|
2367
|
-
if (
|
|
2368
|
-
throw new
|
|
2399
|
+
if (j(e, -32) !== Fo)
|
|
2400
|
+
throw new Lo(e);
|
|
2369
2401
|
} else
|
|
2370
2402
|
Tr(e.authorization);
|
|
2371
2403
|
}
|
|
2372
|
-
function
|
|
2373
|
-
|
|
2374
|
-
const t = gn(
|
|
2404
|
+
function Do(e) {
|
|
2405
|
+
Ir(e);
|
|
2406
|
+
const t = gn(j(e, -64, -32)), n = j(e, -t - 64, -64), r = j(e, 0, -t - 64), [s, a, o] = Eo(Oo, n);
|
|
2375
2407
|
return {
|
|
2376
|
-
authorization:
|
|
2408
|
+
authorization: zo({
|
|
2377
2409
|
address: s.delegation,
|
|
2378
2410
|
chainId: Number(s.chainId),
|
|
2379
2411
|
nonce: s.nonce,
|
|
@@ -2385,14 +2417,14 @@ function Uo(e) {
|
|
|
2385
2417
|
...o && o !== "0x" ? { data: o, to: a } : {}
|
|
2386
2418
|
};
|
|
2387
2419
|
}
|
|
2388
|
-
function
|
|
2420
|
+
function qo(e) {
|
|
2389
2421
|
try {
|
|
2390
|
-
return
|
|
2422
|
+
return Ir(e), !0;
|
|
2391
2423
|
} catch {
|
|
2392
2424
|
return !1;
|
|
2393
2425
|
}
|
|
2394
2426
|
}
|
|
2395
|
-
let
|
|
2427
|
+
let Lo = class extends R {
|
|
2396
2428
|
constructor(t) {
|
|
2397
2429
|
super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`), Object.defineProperty(this, "name", {
|
|
2398
2430
|
enumerable: !0,
|
|
@@ -2402,60 +2434,63 @@ let Do = class extends I {
|
|
|
2402
2434
|
});
|
|
2403
2435
|
}
|
|
2404
2436
|
};
|
|
2405
|
-
function
|
|
2437
|
+
function Mo(e) {
|
|
2406
2438
|
return e.map((t) => ({
|
|
2407
2439
|
...t,
|
|
2408
2440
|
value: BigInt(t.value)
|
|
2409
2441
|
}));
|
|
2410
2442
|
}
|
|
2411
|
-
function
|
|
2443
|
+
function jo(e) {
|
|
2412
2444
|
return {
|
|
2413
2445
|
...e,
|
|
2414
2446
|
balance: e.balance ? BigInt(e.balance) : void 0,
|
|
2415
2447
|
nonce: e.nonce ? ke(e.nonce) : void 0,
|
|
2416
|
-
storageProof: e.storageProof ?
|
|
2448
|
+
storageProof: e.storageProof ? Mo(e.storageProof) : void 0
|
|
2417
2449
|
};
|
|
2418
2450
|
}
|
|
2419
|
-
async function
|
|
2451
|
+
async function Ho(e, { address: t, blockNumber: n, blockTag: r, storageKeys: s }) {
|
|
2420
2452
|
const a = r ?? "latest", o = n !== void 0 ? C(n) : void 0, i = await e.request({
|
|
2421
2453
|
method: "eth_getProof",
|
|
2422
2454
|
params: [t, s, o || a]
|
|
2423
2455
|
});
|
|
2424
|
-
return
|
|
2456
|
+
return jo(i);
|
|
2425
2457
|
}
|
|
2426
|
-
async function
|
|
2458
|
+
async function Wo(e, { address: t, blockNumber: n, blockTag: r = "latest", slot: s }) {
|
|
2427
2459
|
const a = n !== void 0 ? C(n) : void 0;
|
|
2428
2460
|
return await e.request({
|
|
2429
2461
|
method: "eth_getStorageAt",
|
|
2430
2462
|
params: [t, s, a || r]
|
|
2431
2463
|
});
|
|
2432
2464
|
}
|
|
2433
|
-
async function Ct(e, { blockHash: t, blockNumber: n, blockTag: r, hash: s, index: a }) {
|
|
2434
|
-
const
|
|
2435
|
-
let
|
|
2436
|
-
if (s ?
|
|
2465
|
+
async function Ct(e, { blockHash: t, blockNumber: n, blockTag: r, hash: s, index: a, sender: o, nonce: i }) {
|
|
2466
|
+
const c = r || "latest", d = n !== void 0 ? C(n) : void 0;
|
|
2467
|
+
let u = null;
|
|
2468
|
+
if (s ? u = await e.request({
|
|
2437
2469
|
method: "eth_getTransactionByHash",
|
|
2438
2470
|
params: [s]
|
|
2439
|
-
}, { dedupe: !0 }) : t ?
|
|
2471
|
+
}, { dedupe: !0 }) : t ? u = await e.request({
|
|
2440
2472
|
method: "eth_getTransactionByBlockHashAndIndex",
|
|
2441
2473
|
params: [t, C(a)]
|
|
2442
|
-
}, { dedupe: !0 }) :
|
|
2474
|
+
}, { dedupe: !0 }) : typeof a == "number" ? u = await e.request({
|
|
2443
2475
|
method: "eth_getTransactionByBlockNumberAndIndex",
|
|
2444
|
-
params: [
|
|
2445
|
-
}, { dedupe: !!
|
|
2446
|
-
|
|
2476
|
+
params: [d || c, C(a)]
|
|
2477
|
+
}, { dedupe: !!d }) : o && typeof i == "number" && (u = await e.request({
|
|
2478
|
+
method: "eth_getTransactionBySenderAndNonce",
|
|
2479
|
+
params: [o, C(i)]
|
|
2480
|
+
}, { dedupe: !0 })), !u)
|
|
2481
|
+
throw new Hn({
|
|
2447
2482
|
blockHash: t,
|
|
2448
2483
|
blockNumber: n,
|
|
2449
|
-
blockTag:
|
|
2484
|
+
blockTag: c,
|
|
2450
2485
|
hash: s,
|
|
2451
2486
|
index: a
|
|
2452
2487
|
});
|
|
2453
|
-
return (e.chain?.formatters?.transaction?.format ||
|
|
2488
|
+
return (e.chain?.formatters?.transaction?.format || ks)(u, "getTransaction");
|
|
2454
2489
|
}
|
|
2455
|
-
async function
|
|
2490
|
+
async function Vo(e, { hash: t, transactionReceipt: n }) {
|
|
2456
2491
|
const [r, s] = await Promise.all([
|
|
2457
|
-
|
|
2458
|
-
t ?
|
|
2492
|
+
T(e, Oe, "getBlockNumber")({}),
|
|
2493
|
+
t ? T(e, Ct, "getTransaction")({ hash: t }) : void 0
|
|
2459
2494
|
]), a = n?.blockNumber || s?.blockNumber;
|
|
2460
2495
|
return a ? r - a + 1n : 0n;
|
|
2461
2496
|
}
|
|
@@ -2468,14 +2503,14 @@ async function Ce(e, { hash: t }) {
|
|
|
2468
2503
|
throw new Wn({ hash: t });
|
|
2469
2504
|
return (e.chain?.formatters?.transactionReceipt?.format || Vn)(n, "getTransactionReceipt");
|
|
2470
2505
|
}
|
|
2471
|
-
async function
|
|
2472
|
-
const { account: n, authorizationList: r, allowFailure: s = !0, blockNumber: a, blockOverrides: o, blockTag: i, stateOverride: c } = t,
|
|
2506
|
+
async function Go(e, t) {
|
|
2507
|
+
const { account: n, authorizationList: r, allowFailure: s = !0, blockNumber: a, blockOverrides: o, blockTag: i, stateOverride: c } = t, d = t.contracts, { batchSize: u = t.batchSize ?? 1024, deployless: f = t.deployless ?? !1 } = typeof e.batch?.multicall == "object" ? e.batch.multicall : {}, l = (() => {
|
|
2473
2508
|
if (t.multicallAddress)
|
|
2474
2509
|
return t.multicallAddress;
|
|
2475
|
-
if (
|
|
2510
|
+
if (f)
|
|
2476
2511
|
return null;
|
|
2477
2512
|
if (e.chain)
|
|
2478
|
-
return
|
|
2513
|
+
return ge({
|
|
2479
2514
|
blockNumber: a,
|
|
2480
2515
|
chain: e.chain,
|
|
2481
2516
|
contract: "multicall3"
|
|
@@ -2483,44 +2518,44 @@ async function Vo(e, t) {
|
|
|
2483
2518
|
throw new Error("client chain not configured. multicallAddress is required.");
|
|
2484
2519
|
})(), h = [[]];
|
|
2485
2520
|
let p = 0, g = 0;
|
|
2486
|
-
for (let b = 0; b <
|
|
2487
|
-
const { abi: w, address:
|
|
2521
|
+
for (let b = 0; b < d.length; b++) {
|
|
2522
|
+
const { abi: w, address: P, args: A, functionName: x } = d[b];
|
|
2488
2523
|
try {
|
|
2489
|
-
const
|
|
2490
|
-
g += (
|
|
2491
|
-
|
|
2492
|
-
g >
|
|
2493
|
-
h[p].length > 0 && (p++, g = (
|
|
2524
|
+
const v = Y({ abi: w, args: A, functionName: x });
|
|
2525
|
+
g += (v.length - 2) / 2, // Check if batching is enabled.
|
|
2526
|
+
u > 0 && // Check if the current size of the batch exceeds the size limit.
|
|
2527
|
+
g > u && // Check if the current chunk is not already empty.
|
|
2528
|
+
h[p].length > 0 && (p++, g = (v.length - 2) / 2, h[p] = []), h[p] = [
|
|
2494
2529
|
...h[p],
|
|
2495
2530
|
{
|
|
2496
2531
|
allowFailure: !0,
|
|
2497
|
-
callData:
|
|
2498
|
-
target:
|
|
2532
|
+
callData: v,
|
|
2533
|
+
target: P
|
|
2499
2534
|
}
|
|
2500
2535
|
];
|
|
2501
|
-
} catch (
|
|
2502
|
-
const
|
|
2536
|
+
} catch (v) {
|
|
2537
|
+
const I = Ke(v, {
|
|
2503
2538
|
abi: w,
|
|
2504
|
-
address:
|
|
2505
|
-
args:
|
|
2539
|
+
address: P,
|
|
2540
|
+
args: A,
|
|
2506
2541
|
docsPath: "/docs/contract/multicall",
|
|
2507
|
-
functionName:
|
|
2542
|
+
functionName: x,
|
|
2508
2543
|
sender: n
|
|
2509
2544
|
});
|
|
2510
2545
|
if (!s)
|
|
2511
|
-
throw
|
|
2546
|
+
throw I;
|
|
2512
2547
|
h[p] = [
|
|
2513
2548
|
...h[p],
|
|
2514
2549
|
{
|
|
2515
2550
|
allowFailure: !0,
|
|
2516
2551
|
callData: "0x",
|
|
2517
|
-
target:
|
|
2552
|
+
target: P
|
|
2518
2553
|
}
|
|
2519
2554
|
];
|
|
2520
2555
|
}
|
|
2521
2556
|
}
|
|
2522
|
-
const y = await Promise.allSettled(h.map((b) =>
|
|
2523
|
-
...
|
|
2557
|
+
const y = await Promise.allSettled(h.map((b) => T(e, D, "readContract")({
|
|
2558
|
+
...l === null ? { code: Cn } : { address: l },
|
|
2524
2559
|
abi: Rn,
|
|
2525
2560
|
account: n,
|
|
2526
2561
|
args: [b],
|
|
@@ -2536,7 +2571,7 @@ async function Vo(e, t) {
|
|
|
2536
2571
|
if (w.status === "rejected") {
|
|
2537
2572
|
if (!s)
|
|
2538
2573
|
throw w.reason;
|
|
2539
|
-
for (let
|
|
2574
|
+
for (let A = 0; A < h[b].length; A++)
|
|
2540
2575
|
m.push({
|
|
2541
2576
|
status: "failure",
|
|
2542
2577
|
error: w.reason,
|
|
@@ -2544,79 +2579,79 @@ async function Vo(e, t) {
|
|
|
2544
2579
|
});
|
|
2545
2580
|
continue;
|
|
2546
2581
|
}
|
|
2547
|
-
const
|
|
2548
|
-
for (let
|
|
2549
|
-
const { returnData:
|
|
2582
|
+
const P = w.value;
|
|
2583
|
+
for (let A = 0; A < P.length; A++) {
|
|
2584
|
+
const { returnData: x, success: v } = P[A], { callData: I } = h[b][A], { abi: N, address: k, functionName: B, args: S } = d[m.length];
|
|
2550
2585
|
try {
|
|
2551
|
-
if (
|
|
2586
|
+
if (I === "0x")
|
|
2552
2587
|
throw new kn();
|
|
2553
|
-
if (!
|
|
2554
|
-
throw new Nn({ data:
|
|
2555
|
-
const
|
|
2588
|
+
if (!v)
|
|
2589
|
+
throw new Nn({ data: x });
|
|
2590
|
+
const z = _e({
|
|
2556
2591
|
abi: N,
|
|
2557
|
-
args:
|
|
2558
|
-
data:
|
|
2559
|
-
functionName:
|
|
2592
|
+
args: S,
|
|
2593
|
+
data: x,
|
|
2594
|
+
functionName: B
|
|
2560
2595
|
});
|
|
2561
|
-
m.push(s ? { result:
|
|
2562
|
-
} catch (
|
|
2563
|
-
const
|
|
2596
|
+
m.push(s ? { result: z, status: "success" } : z);
|
|
2597
|
+
} catch (z) {
|
|
2598
|
+
const V = Ke(z, {
|
|
2564
2599
|
abi: N,
|
|
2565
|
-
address:
|
|
2566
|
-
args:
|
|
2600
|
+
address: k,
|
|
2601
|
+
args: S,
|
|
2567
2602
|
docsPath: "/docs/contract/multicall",
|
|
2568
|
-
functionName:
|
|
2603
|
+
functionName: B
|
|
2569
2604
|
});
|
|
2570
2605
|
if (!s)
|
|
2571
|
-
throw
|
|
2572
|
-
m.push({ error:
|
|
2606
|
+
throw V;
|
|
2607
|
+
m.push({ error: V, result: void 0, status: "failure" });
|
|
2573
2608
|
}
|
|
2574
2609
|
}
|
|
2575
2610
|
}
|
|
2576
|
-
if (m.length !==
|
|
2577
|
-
throw new
|
|
2611
|
+
if (m.length !== d.length)
|
|
2612
|
+
throw new _("multicall results mismatch");
|
|
2578
2613
|
return m;
|
|
2579
2614
|
}
|
|
2580
2615
|
async function ot(e, t) {
|
|
2581
2616
|
const { blockNumber: n, blockTag: r = e.experimental_blockTag ?? "latest", blocks: s, returnFullTransactions: a, traceTransfers: o, validation: i } = t;
|
|
2582
2617
|
try {
|
|
2583
2618
|
const c = [];
|
|
2584
|
-
for (const
|
|
2585
|
-
const h =
|
|
2586
|
-
const m = y, b = m.account ?
|
|
2619
|
+
for (const l of s) {
|
|
2620
|
+
const h = l.blockOverrides ? es(l.blockOverrides) : void 0, p = l.calls.map((y) => {
|
|
2621
|
+
const m = y, b = m.account ? F(m.account) : void 0, w = m.abi ? Y(m) : m.data, P = {
|
|
2587
2622
|
...m,
|
|
2588
2623
|
account: b,
|
|
2589
|
-
data: m.dataSuffix ?
|
|
2624
|
+
data: m.dataSuffix ? Z([w || "0x", m.dataSuffix]) : w,
|
|
2590
2625
|
from: m.from ?? b?.address
|
|
2591
2626
|
};
|
|
2592
|
-
return ze(
|
|
2593
|
-
}), g =
|
|
2627
|
+
return ze(P), Ue(P);
|
|
2628
|
+
}), g = l.stateOverrides ? ts(l.stateOverrides) : void 0;
|
|
2594
2629
|
c.push({
|
|
2595
2630
|
blockOverrides: h,
|
|
2596
2631
|
calls: p,
|
|
2597
2632
|
stateOverrides: g
|
|
2598
2633
|
});
|
|
2599
2634
|
}
|
|
2600
|
-
const
|
|
2635
|
+
const u = (typeof n == "bigint" ? C(n) : void 0) || r;
|
|
2601
2636
|
return (await e.request({
|
|
2602
2637
|
method: "eth_simulateV1",
|
|
2603
2638
|
params: [
|
|
2604
2639
|
{ blockStateCalls: c, returnFullTransactions: a, traceTransfers: o, validation: i },
|
|
2605
|
-
|
|
2640
|
+
u
|
|
2606
2641
|
]
|
|
2607
|
-
})).map((
|
|
2608
|
-
...
|
|
2609
|
-
calls:
|
|
2610
|
-
const { abi: y, args: m, functionName: b, to: w } = s[h].calls[g],
|
|
2642
|
+
})).map((l, h) => ({
|
|
2643
|
+
...Ns(l),
|
|
2644
|
+
calls: l.calls.map((p, g) => {
|
|
2645
|
+
const { abi: y, args: m, functionName: b, to: w } = s[h].calls[g], P = p.error?.data ?? p.returnData, A = BigInt(p.gasUsed), x = p.logs?.map((k) => Ne(k)), v = p.status === "0x1" ? "success" : "failure", I = y && v === "success" && P !== "0x" ? _e({
|
|
2611
2646
|
abi: y,
|
|
2612
|
-
data:
|
|
2647
|
+
data: P,
|
|
2613
2648
|
functionName: b
|
|
2614
2649
|
}) : null, N = (() => {
|
|
2615
|
-
if (
|
|
2650
|
+
if (v === "success")
|
|
2616
2651
|
return;
|
|
2617
|
-
let
|
|
2618
|
-
if (p.error?.data === "0x" ?
|
|
2619
|
-
return Ke(
|
|
2652
|
+
let k;
|
|
2653
|
+
if (p.error?.data === "0x" ? k = new kn() : p.error && (k = new Nn(p.error)), !!k)
|
|
2654
|
+
return Ke(k, {
|
|
2620
2655
|
abi: y ?? [],
|
|
2621
2656
|
address: w ?? "0x",
|
|
2622
2657
|
args: m,
|
|
@@ -2624,12 +2659,12 @@ async function ot(e, t) {
|
|
|
2624
2659
|
});
|
|
2625
2660
|
})();
|
|
2626
2661
|
return {
|
|
2627
|
-
data:
|
|
2628
|
-
gasUsed:
|
|
2629
|
-
logs:
|
|
2630
|
-
status:
|
|
2631
|
-
...
|
|
2632
|
-
result:
|
|
2662
|
+
data: P,
|
|
2663
|
+
gasUsed: A,
|
|
2664
|
+
logs: x,
|
|
2665
|
+
status: v,
|
|
2666
|
+
...v === "success" ? {
|
|
2667
|
+
result: I
|
|
2633
2668
|
} : {
|
|
2634
2669
|
error: N
|
|
2635
2670
|
}
|
|
@@ -2637,8 +2672,8 @@ async function ot(e, t) {
|
|
|
2637
2672
|
})
|
|
2638
2673
|
}));
|
|
2639
2674
|
} catch (c) {
|
|
2640
|
-
const
|
|
2641
|
-
throw
|
|
2675
|
+
const d = c, u = ns(d, {});
|
|
2676
|
+
throw u instanceof Ss ? d : u;
|
|
2642
2677
|
}
|
|
2643
2678
|
}
|
|
2644
2679
|
function it(e) {
|
|
@@ -2663,7 +2698,7 @@ function it(e) {
|
|
|
2663
2698
|
}
|
|
2664
2699
|
}
|
|
2665
2700
|
if (!a)
|
|
2666
|
-
throw new
|
|
2701
|
+
throw new R("Unable to normalize signature.");
|
|
2667
2702
|
return s;
|
|
2668
2703
|
}
|
|
2669
2704
|
function ct(e, t) {
|
|
@@ -2685,11 +2720,11 @@ function ct(e, t) {
|
|
|
2685
2720
|
})) : !1;
|
|
2686
2721
|
}
|
|
2687
2722
|
}
|
|
2688
|
-
function
|
|
2723
|
+
function Rr(e, t, n) {
|
|
2689
2724
|
for (const r in e) {
|
|
2690
2725
|
const s = e[r], a = t[r];
|
|
2691
2726
|
if (s.type === "tuple" && a.type === "tuple" && "components" in s && "components" in a)
|
|
2692
|
-
return
|
|
2727
|
+
return Rr(s.components, a.components, n[r]);
|
|
2693
2728
|
const o = [s.type, a.type];
|
|
2694
2729
|
if (o.includes("address") && o.includes("bytes20") ? !0 : o.includes("address") && o.includes("string") ? rt(n[r], {
|
|
2695
2730
|
strict: !1
|
|
@@ -2699,7 +2734,7 @@ function Ir(e, t, n) {
|
|
|
2699
2734
|
return o;
|
|
2700
2735
|
}
|
|
2701
2736
|
}
|
|
2702
|
-
function
|
|
2737
|
+
function Cr(e, t = {}) {
|
|
2703
2738
|
const { prepare: n = !0 } = t, r = Array.isArray(e) || typeof e == "string" ? an(e) : e;
|
|
2704
2739
|
return {
|
|
2705
2740
|
...r,
|
|
@@ -2707,7 +2742,7 @@ function Rr(e, t = {}) {
|
|
|
2707
2742
|
};
|
|
2708
2743
|
}
|
|
2709
2744
|
function qe(e, t, n) {
|
|
2710
|
-
const { args: r = [], prepare: s = !0 } = n ?? {}, a =
|
|
2745
|
+
const { args: r = [], prepare: s = !0 } = n ?? {}, a = rs(t, { strict: !1 }), o = e.filter((d) => a ? d.type === "function" || d.type === "error" ? kr(d) === j(t, 0, 4) : d.type === "event" ? re(d) === t : !1 : "name" in d && d.name === t);
|
|
2711
2746
|
if (o.length === 0)
|
|
2712
2747
|
throw new $e({ name: t });
|
|
2713
2748
|
if (o.length === 1)
|
|
@@ -2716,42 +2751,42 @@ function qe(e, t, n) {
|
|
|
2716
2751
|
...s ? { hash: re(o[0]) } : {}
|
|
2717
2752
|
};
|
|
2718
2753
|
let i;
|
|
2719
|
-
for (const
|
|
2720
|
-
if (!("inputs" in
|
|
2754
|
+
for (const d of o) {
|
|
2755
|
+
if (!("inputs" in d))
|
|
2721
2756
|
continue;
|
|
2722
2757
|
if (!r || r.length === 0) {
|
|
2723
|
-
if (!
|
|
2758
|
+
if (!d.inputs || d.inputs.length === 0)
|
|
2724
2759
|
return {
|
|
2725
|
-
...
|
|
2726
|
-
...s ? { hash: re(
|
|
2760
|
+
...d,
|
|
2761
|
+
...s ? { hash: re(d) } : {}
|
|
2727
2762
|
};
|
|
2728
2763
|
continue;
|
|
2729
2764
|
}
|
|
2730
|
-
if (!
|
|
2765
|
+
if (!d.inputs || d.inputs.length === 0 || d.inputs.length !== r.length)
|
|
2731
2766
|
continue;
|
|
2732
|
-
if (r.every((
|
|
2733
|
-
const h = "inputs" in
|
|
2734
|
-
return h ? ct(
|
|
2767
|
+
if (r.every((f, l) => {
|
|
2768
|
+
const h = "inputs" in d && d.inputs[l];
|
|
2769
|
+
return h ? ct(f, h) : !1;
|
|
2735
2770
|
})) {
|
|
2736
2771
|
if (i && "inputs" in i && i.inputs) {
|
|
2737
|
-
const
|
|
2738
|
-
if (
|
|
2739
|
-
throw new
|
|
2740
|
-
abiItem:
|
|
2741
|
-
type:
|
|
2772
|
+
const f = Rr(d.inputs, i.inputs, r);
|
|
2773
|
+
if (f)
|
|
2774
|
+
throw new Jo({
|
|
2775
|
+
abiItem: d,
|
|
2776
|
+
type: f[0]
|
|
2742
2777
|
}, {
|
|
2743
2778
|
abiItem: i,
|
|
2744
|
-
type:
|
|
2779
|
+
type: f[1]
|
|
2745
2780
|
});
|
|
2746
2781
|
}
|
|
2747
|
-
i =
|
|
2782
|
+
i = d;
|
|
2748
2783
|
}
|
|
2749
2784
|
}
|
|
2750
2785
|
const c = (() => {
|
|
2751
2786
|
if (i)
|
|
2752
2787
|
return i;
|
|
2753
|
-
const [
|
|
2754
|
-
return { ...
|
|
2788
|
+
const [d, ...u] = o;
|
|
2789
|
+
return { ...d, overloads: u };
|
|
2755
2790
|
})();
|
|
2756
2791
|
if (!c)
|
|
2757
2792
|
throw new $e({ name: t });
|
|
@@ -2760,7 +2795,7 @@ function qe(e, t, n) {
|
|
|
2760
2795
|
...s ? { hash: re(c) } : {}
|
|
2761
2796
|
};
|
|
2762
2797
|
}
|
|
2763
|
-
function
|
|
2798
|
+
function kr(...e) {
|
|
2764
2799
|
const t = (() => {
|
|
2765
2800
|
if (Array.isArray(e[0])) {
|
|
2766
2801
|
const [n, r] = e;
|
|
@@ -2768,9 +2803,9 @@ function Cr(...e) {
|
|
|
2768
2803
|
}
|
|
2769
2804
|
return e[0];
|
|
2770
2805
|
})();
|
|
2771
|
-
return
|
|
2806
|
+
return j(re(t), 0, 4);
|
|
2772
2807
|
}
|
|
2773
|
-
function
|
|
2808
|
+
function Zo(...e) {
|
|
2774
2809
|
const t = (() => {
|
|
2775
2810
|
if (Array.isArray(e[0])) {
|
|
2776
2811
|
const [r, s] = e;
|
|
@@ -2788,9 +2823,9 @@ function re(...e) {
|
|
|
2788
2823
|
}
|
|
2789
2824
|
return e[0];
|
|
2790
2825
|
})();
|
|
2791
|
-
return typeof t != "string" && "hash" in t && t.hash ? t.hash :
|
|
2826
|
+
return typeof t != "string" && "hash" in t && t.hash ? t.hash : gr(ft(Zo(t)));
|
|
2792
2827
|
}
|
|
2793
|
-
class
|
|
2828
|
+
class Jo extends R {
|
|
2794
2829
|
constructor(t, n) {
|
|
2795
2830
|
super("Found ambiguous types in overloaded ABI Items.", {
|
|
2796
2831
|
metaMessages: [
|
|
@@ -2809,7 +2844,7 @@ class Go extends I {
|
|
|
2809
2844
|
});
|
|
2810
2845
|
}
|
|
2811
2846
|
}
|
|
2812
|
-
class $e extends
|
|
2847
|
+
class $e extends R {
|
|
2813
2848
|
constructor({ name: t, data: n, type: r = "item" }) {
|
|
2814
2849
|
const s = t ? ` with name "${t}"` : n ? ` with data "${n}"` : "";
|
|
2815
2850
|
super(`ABI ${r}${s} not found.`), Object.defineProperty(this, "name", {
|
|
@@ -2820,40 +2855,40 @@ class $e extends I {
|
|
|
2820
2855
|
});
|
|
2821
2856
|
}
|
|
2822
2857
|
}
|
|
2823
|
-
function
|
|
2858
|
+
function Yo(...e) {
|
|
2824
2859
|
const [t, n] = (() => {
|
|
2825
2860
|
if (Array.isArray(e[0])) {
|
|
2826
2861
|
const [a, o] = e;
|
|
2827
|
-
return [
|
|
2862
|
+
return [Qo(a), o];
|
|
2828
2863
|
}
|
|
2829
2864
|
return e;
|
|
2830
2865
|
})(), { bytecode: r, args: s } = n;
|
|
2831
|
-
return q(r, t.inputs?.length && s?.length ?
|
|
2866
|
+
return q(r, t.inputs?.length && s?.length ? Tt(t.inputs, s) : "0x");
|
|
2832
2867
|
}
|
|
2833
|
-
function
|
|
2834
|
-
return
|
|
2868
|
+
function Ko(e) {
|
|
2869
|
+
return Cr(e);
|
|
2835
2870
|
}
|
|
2836
|
-
function
|
|
2871
|
+
function Qo(e) {
|
|
2837
2872
|
const t = e.find((n) => n.type === "constructor");
|
|
2838
2873
|
if (!t)
|
|
2839
2874
|
throw new $e({ name: "constructor" });
|
|
2840
2875
|
return t;
|
|
2841
2876
|
}
|
|
2842
|
-
function
|
|
2877
|
+
function Xo(...e) {
|
|
2843
2878
|
const [t, n = []] = (() => {
|
|
2844
2879
|
if (Array.isArray(e[0])) {
|
|
2845
|
-
const [
|
|
2846
|
-
return [mn(
|
|
2880
|
+
const [d, u, f] = e;
|
|
2881
|
+
return [mn(d, u, { args: f }), f];
|
|
2847
2882
|
}
|
|
2848
2883
|
const [i, c] = e;
|
|
2849
2884
|
return [i, c];
|
|
2850
2885
|
})(), { overloads: r } = t, s = r ? mn([t, ...r], t.name, {
|
|
2851
2886
|
args: n
|
|
2852
|
-
}) : t, a =
|
|
2887
|
+
}) : t, a = ei(s), o = n.length > 0 ? Tt(s.inputs, n) : void 0;
|
|
2853
2888
|
return o ? q(a, o) : a;
|
|
2854
2889
|
}
|
|
2855
2890
|
function ee(e, t = {}) {
|
|
2856
|
-
return
|
|
2891
|
+
return Cr(e, t);
|
|
2857
2892
|
}
|
|
2858
2893
|
function mn(e, t, n) {
|
|
2859
2894
|
const r = qe(e, t, n);
|
|
@@ -2861,139 +2896,139 @@ function mn(e, t, n) {
|
|
|
2861
2896
|
throw new $e({ name: t, type: "function" });
|
|
2862
2897
|
return r;
|
|
2863
2898
|
}
|
|
2864
|
-
function
|
|
2865
|
-
return
|
|
2899
|
+
function ei(e) {
|
|
2900
|
+
return kr(e);
|
|
2866
2901
|
}
|
|
2867
|
-
const
|
|
2868
|
-
async function
|
|
2869
|
-
const { blockNumber: n, blockTag: r, calls: s, stateOverrides: a, traceAssetChanges: o, traceTransfers: i, validation: c } = t,
|
|
2870
|
-
if (o && !
|
|
2871
|
-
throw new
|
|
2872
|
-
const
|
|
2873
|
-
bytecode:
|
|
2902
|
+
const ti = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", M = "0x0000000000000000000000000000000000000000", ni = "0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";
|
|
2903
|
+
async function ri(e, t) {
|
|
2904
|
+
const { blockNumber: n, blockTag: r, calls: s, stateOverrides: a, traceAssetChanges: o, traceTransfers: i, validation: c } = t, d = t.account ? F(t.account) : void 0;
|
|
2905
|
+
if (o && !d)
|
|
2906
|
+
throw new _("`account` is required when `traceAssetChanges` is true");
|
|
2907
|
+
const u = d ? Yo(Ko("constructor(bytes, bytes)"), {
|
|
2908
|
+
bytecode: ss,
|
|
2874
2909
|
args: [
|
|
2875
|
-
|
|
2876
|
-
|
|
2910
|
+
ni,
|
|
2911
|
+
Xo(ee("function getBalance(address)"), [d.address])
|
|
2877
2912
|
]
|
|
2878
|
-
}) : void 0,
|
|
2879
|
-
if (!
|
|
2913
|
+
}) : void 0, f = o ? await Promise.all(t.calls.map(async (E) => {
|
|
2914
|
+
if (!E.data && !E.abi)
|
|
2880
2915
|
return;
|
|
2881
|
-
const { accessList:
|
|
2882
|
-
account:
|
|
2883
|
-
...
|
|
2884
|
-
data:
|
|
2916
|
+
const { accessList: $ } = await cr(e, {
|
|
2917
|
+
account: d.address,
|
|
2918
|
+
...E,
|
|
2919
|
+
data: E.abi ? Y(E) : E.data
|
|
2885
2920
|
});
|
|
2886
|
-
return
|
|
2887
|
-
})).then((
|
|
2921
|
+
return $.map(({ address: de, storageKeys: Pe }) => Pe.length > 0 ? de : null);
|
|
2922
|
+
})).then((E) => E.flat().filter(Boolean)) : [], l = await ot(e, {
|
|
2888
2923
|
blockNumber: n,
|
|
2889
2924
|
blockTag: r,
|
|
2890
2925
|
blocks: [
|
|
2891
2926
|
...o ? [
|
|
2892
2927
|
// ETH pre balances
|
|
2893
2928
|
{
|
|
2894
|
-
calls: [{ data:
|
|
2929
|
+
calls: [{ data: u }],
|
|
2895
2930
|
stateOverrides: a
|
|
2896
2931
|
},
|
|
2897
2932
|
// Asset pre balances
|
|
2898
2933
|
{
|
|
2899
|
-
calls:
|
|
2934
|
+
calls: f.map((E, $) => ({
|
|
2900
2935
|
abi: [
|
|
2901
2936
|
ee("function balanceOf(address) returns (uint256)")
|
|
2902
2937
|
],
|
|
2903
2938
|
functionName: "balanceOf",
|
|
2904
|
-
args: [
|
|
2905
|
-
to:
|
|
2906
|
-
from:
|
|
2907
|
-
nonce:
|
|
2939
|
+
args: [d.address],
|
|
2940
|
+
to: E,
|
|
2941
|
+
from: M,
|
|
2942
|
+
nonce: $
|
|
2908
2943
|
})),
|
|
2909
2944
|
stateOverrides: [
|
|
2910
2945
|
{
|
|
2911
|
-
address:
|
|
2946
|
+
address: M,
|
|
2912
2947
|
nonce: 0
|
|
2913
2948
|
}
|
|
2914
2949
|
]
|
|
2915
2950
|
}
|
|
2916
2951
|
] : [],
|
|
2917
2952
|
{
|
|
2918
|
-
calls: [...s, {}].map((
|
|
2919
|
-
...
|
|
2920
|
-
from:
|
|
2953
|
+
calls: [...s, {}].map((E) => ({
|
|
2954
|
+
...E,
|
|
2955
|
+
from: d?.address
|
|
2921
2956
|
})),
|
|
2922
2957
|
stateOverrides: a
|
|
2923
2958
|
},
|
|
2924
2959
|
...o ? [
|
|
2925
2960
|
// ETH post balances
|
|
2926
2961
|
{
|
|
2927
|
-
calls: [{ data:
|
|
2962
|
+
calls: [{ data: u }]
|
|
2928
2963
|
},
|
|
2929
2964
|
// Asset post balances
|
|
2930
2965
|
{
|
|
2931
|
-
calls:
|
|
2966
|
+
calls: f.map((E, $) => ({
|
|
2932
2967
|
abi: [
|
|
2933
2968
|
ee("function balanceOf(address) returns (uint256)")
|
|
2934
2969
|
],
|
|
2935
2970
|
functionName: "balanceOf",
|
|
2936
|
-
args: [
|
|
2937
|
-
to:
|
|
2938
|
-
from:
|
|
2939
|
-
nonce:
|
|
2971
|
+
args: [d.address],
|
|
2972
|
+
to: E,
|
|
2973
|
+
from: M,
|
|
2974
|
+
nonce: $
|
|
2940
2975
|
})),
|
|
2941
2976
|
stateOverrides: [
|
|
2942
2977
|
{
|
|
2943
|
-
address:
|
|
2978
|
+
address: M,
|
|
2944
2979
|
nonce: 0
|
|
2945
2980
|
}
|
|
2946
2981
|
]
|
|
2947
2982
|
},
|
|
2948
2983
|
// Decimals
|
|
2949
2984
|
{
|
|
2950
|
-
calls:
|
|
2951
|
-
to:
|
|
2985
|
+
calls: f.map((E, $) => ({
|
|
2986
|
+
to: E,
|
|
2952
2987
|
abi: [
|
|
2953
2988
|
ee("function decimals() returns (uint256)")
|
|
2954
2989
|
],
|
|
2955
2990
|
functionName: "decimals",
|
|
2956
|
-
from:
|
|
2957
|
-
nonce:
|
|
2991
|
+
from: M,
|
|
2992
|
+
nonce: $
|
|
2958
2993
|
})),
|
|
2959
2994
|
stateOverrides: [
|
|
2960
2995
|
{
|
|
2961
|
-
address:
|
|
2996
|
+
address: M,
|
|
2962
2997
|
nonce: 0
|
|
2963
2998
|
}
|
|
2964
2999
|
]
|
|
2965
3000
|
},
|
|
2966
3001
|
// Token URI
|
|
2967
3002
|
{
|
|
2968
|
-
calls:
|
|
2969
|
-
to:
|
|
3003
|
+
calls: f.map((E, $) => ({
|
|
3004
|
+
to: E,
|
|
2970
3005
|
abi: [
|
|
2971
3006
|
ee("function tokenURI(uint256) returns (string)")
|
|
2972
3007
|
],
|
|
2973
3008
|
functionName: "tokenURI",
|
|
2974
3009
|
args: [0n],
|
|
2975
|
-
from:
|
|
2976
|
-
nonce:
|
|
3010
|
+
from: M,
|
|
3011
|
+
nonce: $
|
|
2977
3012
|
})),
|
|
2978
3013
|
stateOverrides: [
|
|
2979
3014
|
{
|
|
2980
|
-
address:
|
|
3015
|
+
address: M,
|
|
2981
3016
|
nonce: 0
|
|
2982
3017
|
}
|
|
2983
3018
|
]
|
|
2984
3019
|
},
|
|
2985
3020
|
// Symbols
|
|
2986
3021
|
{
|
|
2987
|
-
calls:
|
|
2988
|
-
to:
|
|
3022
|
+
calls: f.map((E, $) => ({
|
|
3023
|
+
to: E,
|
|
2989
3024
|
abi: [ee("function symbol() returns (string)")],
|
|
2990
3025
|
functionName: "symbol",
|
|
2991
|
-
from:
|
|
2992
|
-
nonce:
|
|
3026
|
+
from: M,
|
|
3027
|
+
nonce: $
|
|
2993
3028
|
})),
|
|
2994
3029
|
stateOverrides: [
|
|
2995
3030
|
{
|
|
2996
|
-
address:
|
|
3031
|
+
address: M,
|
|
2997
3032
|
nonce: 0
|
|
2998
3033
|
}
|
|
2999
3034
|
]
|
|
@@ -3002,56 +3037,56 @@ async function ti(e, t) {
|
|
|
3002
3037
|
],
|
|
3003
3038
|
traceTransfers: i,
|
|
3004
3039
|
validation: c
|
|
3005
|
-
}), h = o ?
|
|
3006
|
-
for (const [
|
|
3007
|
-
const
|
|
3008
|
-
if (typeof
|
|
3040
|
+
}), h = o ? l[2] : l[0], [p, g, , y, m, b, w, P] = o ? l : [], { calls: A, ...x } = h, v = A.slice(0, -1) ?? [], I = p?.calls ?? [], N = g?.calls ?? [], k = [...I, ...N].map((E) => E.status === "success" ? J(E.data) : null), B = y?.calls ?? [], S = m?.calls ?? [], z = [...B, ...S].map((E) => E.status === "success" ? J(E.data) : null), V = (b?.calls ?? []).map((E) => E.status === "success" ? E.result : null), ue = (P?.calls ?? []).map((E) => E.status === "success" ? E.result : null), Ee = (w?.calls ?? []).map((E) => E.status === "success" ? E.result : null), L = [];
|
|
3041
|
+
for (const [E, $] of z.entries()) {
|
|
3042
|
+
const de = k[E];
|
|
3043
|
+
if (typeof $ != "bigint" || typeof de != "bigint")
|
|
3009
3044
|
continue;
|
|
3010
|
-
const Pe =
|
|
3011
|
-
address:
|
|
3045
|
+
const Pe = V[E - 1], zr = ue[E - 1], Ur = Ee[E - 1], Nt = E === 0 ? {
|
|
3046
|
+
address: ti,
|
|
3012
3047
|
decimals: 18,
|
|
3013
3048
|
symbol: "ETH"
|
|
3014
3049
|
} : {
|
|
3015
|
-
address:
|
|
3016
|
-
decimals:
|
|
3017
|
-
symbol:
|
|
3050
|
+
address: f[E - 1],
|
|
3051
|
+
decimals: Ur || Pe ? Number(Pe ?? 1) : void 0,
|
|
3052
|
+
symbol: zr ?? void 0
|
|
3018
3053
|
};
|
|
3019
|
-
|
|
3054
|
+
L.some((Fr) => Fr.token.address === Nt.address) || L.push({
|
|
3020
3055
|
token: Nt,
|
|
3021
3056
|
value: {
|
|
3022
|
-
pre:
|
|
3023
|
-
post:
|
|
3024
|
-
diff:
|
|
3057
|
+
pre: de,
|
|
3058
|
+
post: $,
|
|
3059
|
+
diff: $ - de
|
|
3025
3060
|
}
|
|
3026
3061
|
});
|
|
3027
3062
|
}
|
|
3028
3063
|
return {
|
|
3029
|
-
assetChanges:
|
|
3030
|
-
block:
|
|
3031
|
-
results:
|
|
3064
|
+
assetChanges: L,
|
|
3065
|
+
block: x,
|
|
3066
|
+
results: v
|
|
3032
3067
|
};
|
|
3033
3068
|
}
|
|
3034
|
-
const
|
|
3035
|
-
function
|
|
3036
|
-
if (
|
|
3037
|
-
throw new
|
|
3069
|
+
const Nr = "0x6492649264926492649264926492649264926492649264926492649264926492";
|
|
3070
|
+
function si(e) {
|
|
3071
|
+
if (j(e, -32) !== Nr)
|
|
3072
|
+
throw new ii(e);
|
|
3038
3073
|
}
|
|
3039
|
-
function
|
|
3074
|
+
function ai(e) {
|
|
3040
3075
|
const { data: t, signature: n, to: r } = e;
|
|
3041
|
-
return q(
|
|
3076
|
+
return q(Tt(Er("address, bytes, bytes"), [
|
|
3042
3077
|
r,
|
|
3043
3078
|
t,
|
|
3044
3079
|
n
|
|
3045
|
-
]),
|
|
3080
|
+
]), Nr);
|
|
3046
3081
|
}
|
|
3047
|
-
function
|
|
3082
|
+
function oi(e) {
|
|
3048
3083
|
try {
|
|
3049
|
-
return
|
|
3084
|
+
return si(e), !0;
|
|
3050
3085
|
} catch {
|
|
3051
3086
|
return !1;
|
|
3052
3087
|
}
|
|
3053
3088
|
}
|
|
3054
|
-
class
|
|
3089
|
+
class ii extends R {
|
|
3055
3090
|
constructor(t) {
|
|
3056
3091
|
super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`), Object.defineProperty(this, "name", {
|
|
3057
3092
|
enumerable: !0,
|
|
@@ -3061,57 +3096,60 @@ class ai extends I {
|
|
|
3061
3096
|
});
|
|
3062
3097
|
}
|
|
3063
3098
|
}
|
|
3064
|
-
function
|
|
3099
|
+
function ci({ r: e, s: t, to: n = "hex", v: r, yParity: s }) {
|
|
3065
3100
|
const a = (() => {
|
|
3066
3101
|
if (s === 0 || s === 1)
|
|
3067
3102
|
return s;
|
|
3068
3103
|
if (r && (r === 27n || r === 28n || r >= 35n))
|
|
3069
3104
|
return r % 2n === 0n ? 1 : 0;
|
|
3070
3105
|
throw new Error("Invalid `v` or `yParity` value");
|
|
3071
|
-
})(), o = `0x${new Fs.Signature(
|
|
3106
|
+
})(), o = `0x${new Fs.Signature(J(e), J(t)).toCompactHex()}${a === 0 ? "1b" : "1c"}`;
|
|
3072
3107
|
return n === "hex" ? o : Bs(o);
|
|
3073
3108
|
}
|
|
3074
3109
|
async function Le(e, t) {
|
|
3075
|
-
const { address: n,
|
|
3076
|
-
|
|
3077
|
-
return
|
|
3110
|
+
const { address: n, chain: r = e.chain, hash: s, erc6492VerifierAddress: a = t.universalSignatureVerifierAddress ?? r?.contracts?.erc6492Verifier?.address, multicallAddress: o = t.multicallAddress ?? r?.contracts?.multicall3?.address } = t;
|
|
3111
|
+
if (r?.verifyHash)
|
|
3112
|
+
return await r.verifyHash(e, t);
|
|
3113
|
+
const i = (() => {
|
|
3114
|
+
const c = t.signature;
|
|
3115
|
+
return Ln(c) ? c : typeof c == "object" && "r" in c && "s" in c ? ci(c) : me(c);
|
|
3078
3116
|
})();
|
|
3079
3117
|
try {
|
|
3080
|
-
return
|
|
3118
|
+
return qo(i) ? await ui(e, {
|
|
3081
3119
|
...t,
|
|
3082
|
-
multicallAddress:
|
|
3083
|
-
signature:
|
|
3084
|
-
}) : await
|
|
3120
|
+
multicallAddress: o,
|
|
3121
|
+
signature: i
|
|
3122
|
+
}) : await di(e, {
|
|
3085
3123
|
...t,
|
|
3086
|
-
verifierAddress:
|
|
3087
|
-
signature:
|
|
3124
|
+
verifierAddress: a,
|
|
3125
|
+
signature: i
|
|
3088
3126
|
});
|
|
3089
|
-
} catch (
|
|
3127
|
+
} catch (c) {
|
|
3090
3128
|
try {
|
|
3091
|
-
if (
|
|
3129
|
+
if (Fe(mt(n), await as({ hash: s, signature: i })))
|
|
3092
3130
|
return !0;
|
|
3093
3131
|
} catch {
|
|
3094
3132
|
}
|
|
3095
|
-
if (
|
|
3133
|
+
if (c instanceof X)
|
|
3096
3134
|
return !1;
|
|
3097
|
-
throw
|
|
3135
|
+
throw c;
|
|
3098
3136
|
}
|
|
3099
3137
|
}
|
|
3100
|
-
async function
|
|
3101
|
-
const { address: n, blockNumber: r, blockTag: s, hash: a, multicallAddress: o } = t, { authorization: i, data: c, signature:
|
|
3138
|
+
async function ui(e, t) {
|
|
3139
|
+
const { address: n, blockNumber: r, blockTag: s, hash: a, multicallAddress: o } = t, { authorization: i, data: c, signature: d, to: u } = Do(t.signature);
|
|
3102
3140
|
if (await nt(e, {
|
|
3103
3141
|
address: n,
|
|
3104
3142
|
blockNumber: r,
|
|
3105
3143
|
blockTag: s
|
|
3106
|
-
}) ===
|
|
3107
|
-
return await
|
|
3144
|
+
}) === $s(["0xef0100", i.address]))
|
|
3145
|
+
return await fi(e, {
|
|
3108
3146
|
address: n,
|
|
3109
3147
|
blockNumber: r,
|
|
3110
3148
|
blockTag: s,
|
|
3111
3149
|
hash: a,
|
|
3112
|
-
signature:
|
|
3150
|
+
signature: d
|
|
3113
3151
|
});
|
|
3114
|
-
const
|
|
3152
|
+
const l = {
|
|
3115
3153
|
address: i.address,
|
|
3116
3154
|
chainId: Number(i.chainId),
|
|
3117
3155
|
nonce: Number(i.nonce),
|
|
@@ -3119,14 +3157,14 @@ async function ii(e, t) {
|
|
|
3119
3157
|
s: C(i.s, { size: 32 }),
|
|
3120
3158
|
yParity: i.yParity
|
|
3121
3159
|
};
|
|
3122
|
-
if (!await
|
|
3160
|
+
if (!await ka({
|
|
3123
3161
|
address: n,
|
|
3124
|
-
authorization:
|
|
3162
|
+
authorization: l
|
|
3125
3163
|
}))
|
|
3126
3164
|
throw new X();
|
|
3127
|
-
const p = await
|
|
3165
|
+
const p = await T(e, D, "readContract")({
|
|
3128
3166
|
...o ? { address: o } : { code: Cn },
|
|
3129
|
-
authorizationList: [
|
|
3167
|
+
authorizationList: [l],
|
|
3130
3168
|
abi: Rn,
|
|
3131
3169
|
blockNumber: r,
|
|
3132
3170
|
blockTag: "pending",
|
|
@@ -3136,17 +3174,17 @@ async function ii(e, t) {
|
|
|
3136
3174
|
...c ? [
|
|
3137
3175
|
{
|
|
3138
3176
|
allowFailure: !0,
|
|
3139
|
-
target:
|
|
3177
|
+
target: u ?? n,
|
|
3140
3178
|
callData: c
|
|
3141
3179
|
}
|
|
3142
3180
|
] : [],
|
|
3143
3181
|
{
|
|
3144
3182
|
allowFailure: !0,
|
|
3145
3183
|
target: n,
|
|
3146
|
-
callData:
|
|
3147
|
-
abi:
|
|
3184
|
+
callData: Y({
|
|
3185
|
+
abi: Sn,
|
|
3148
3186
|
functionName: "isValidSignature",
|
|
3149
|
-
args: [a,
|
|
3187
|
+
args: [a, d]
|
|
3150
3188
|
})
|
|
3151
3189
|
}
|
|
3152
3190
|
]
|
|
@@ -3156,53 +3194,53 @@ async function ii(e, t) {
|
|
|
3156
3194
|
return !0;
|
|
3157
3195
|
throw new X();
|
|
3158
3196
|
}
|
|
3159
|
-
async function
|
|
3160
|
-
const { address: n, factory: r, factoryData: s, hash: a, signature: o, verifierAddress: i, ...c } = t,
|
|
3197
|
+
async function di(e, t) {
|
|
3198
|
+
const { address: n, factory: r, factoryData: s, hash: a, signature: o, verifierAddress: i, ...c } = t, d = await (async () => !r && !s || oi(o) ? o : ai({
|
|
3161
3199
|
data: s,
|
|
3162
3200
|
signature: o,
|
|
3163
3201
|
to: r
|
|
3164
|
-
}))(),
|
|
3202
|
+
}))(), u = i ? {
|
|
3165
3203
|
to: i,
|
|
3166
|
-
data:
|
|
3204
|
+
data: Y({
|
|
3167
3205
|
abi: rn,
|
|
3168
3206
|
functionName: "isValidSig",
|
|
3169
|
-
args: [n, a,
|
|
3207
|
+
args: [n, a, d]
|
|
3170
3208
|
}),
|
|
3171
3209
|
...c
|
|
3172
3210
|
} : {
|
|
3173
|
-
data:
|
|
3211
|
+
data: Bn({
|
|
3174
3212
|
abi: rn,
|
|
3175
|
-
args: [n, a,
|
|
3176
|
-
bytecode:
|
|
3213
|
+
args: [n, a, d],
|
|
3214
|
+
bytecode: os
|
|
3177
3215
|
}),
|
|
3178
3216
|
...c
|
|
3179
|
-
}, { data:
|
|
3180
|
-
throw
|
|
3217
|
+
}, { data: f } = await T(e, $n, "call")(u).catch((l) => {
|
|
3218
|
+
throw l instanceof is ? new X() : l;
|
|
3181
3219
|
});
|
|
3182
|
-
if (
|
|
3220
|
+
if (_s(f ?? "0x0"))
|
|
3183
3221
|
return !0;
|
|
3184
3222
|
throw new X();
|
|
3185
3223
|
}
|
|
3186
|
-
async function
|
|
3224
|
+
async function fi(e, t) {
|
|
3187
3225
|
const { address: n, blockNumber: r, blockTag: s, hash: a, signature: o } = t;
|
|
3188
|
-
if ((await
|
|
3226
|
+
if ((await T(e, D, "readContract")({
|
|
3189
3227
|
address: n,
|
|
3190
|
-
abi:
|
|
3228
|
+
abi: Sn,
|
|
3191
3229
|
args: [a, o],
|
|
3192
3230
|
blockNumber: r,
|
|
3193
3231
|
blockTag: s,
|
|
3194
3232
|
functionName: "isValidSignature"
|
|
3195
3233
|
}).catch((c) => {
|
|
3196
|
-
throw c instanceof
|
|
3234
|
+
throw c instanceof cs ? new X() : c;
|
|
3197
3235
|
})).startsWith("0x1626ba7e"))
|
|
3198
3236
|
return !0;
|
|
3199
3237
|
throw new X();
|
|
3200
3238
|
}
|
|
3201
3239
|
class X extends Error {
|
|
3202
3240
|
}
|
|
3203
|
-
async function
|
|
3204
|
-
const i =
|
|
3205
|
-
return
|
|
3241
|
+
async function li(e, { address: t, message: n, factory: r, factoryData: s, signature: a, ...o }) {
|
|
3242
|
+
const i = fr(n);
|
|
3243
|
+
return T(e, Le, "verifyHash")({
|
|
3206
3244
|
address: t,
|
|
3207
3245
|
factory: r,
|
|
3208
3246
|
factoryData: s,
|
|
@@ -3211,54 +3249,54 @@ async function di(e, { address: t, message: n, factory: r, factoryData: s, signa
|
|
|
3211
3249
|
...o
|
|
3212
3250
|
});
|
|
3213
3251
|
}
|
|
3214
|
-
async function
|
|
3215
|
-
const { address: n, factory: r, factoryData: s, signature: a, message: o, primaryType: i, types: c, domain:
|
|
3216
|
-
return
|
|
3252
|
+
async function hi(e, t) {
|
|
3253
|
+
const { address: n, factory: r, factoryData: s, signature: a, message: o, primaryType: i, types: c, domain: d, ...u } = t, f = Ha({ message: o, primaryType: i, types: c, domain: d });
|
|
3254
|
+
return T(e, Le, "verifyHash")({
|
|
3217
3255
|
address: n,
|
|
3218
3256
|
factory: r,
|
|
3219
3257
|
factoryData: s,
|
|
3220
|
-
hash:
|
|
3258
|
+
hash: f,
|
|
3221
3259
|
signature: a,
|
|
3222
|
-
...
|
|
3260
|
+
...u
|
|
3223
3261
|
});
|
|
3224
3262
|
}
|
|
3225
|
-
function
|
|
3263
|
+
function Sr(e, { emitOnBegin: t = !1, emitMissed: n = !1, onBlockNumber: r, onError: s, poll: a, pollingInterval: o = e.pollingInterval }) {
|
|
3226
3264
|
const i = typeof a < "u" ? a : !(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"));
|
|
3227
3265
|
let c;
|
|
3228
3266
|
return i ? (() => {
|
|
3229
|
-
const
|
|
3267
|
+
const f = U([
|
|
3230
3268
|
"watchBlockNumber",
|
|
3231
3269
|
e.uid,
|
|
3232
3270
|
t,
|
|
3233
3271
|
n,
|
|
3234
3272
|
o
|
|
3235
3273
|
]);
|
|
3236
|
-
return K(
|
|
3274
|
+
return K(f, { onBlockNumber: r, onError: s }, (l) => be(async () => {
|
|
3237
3275
|
try {
|
|
3238
|
-
const h = await
|
|
3276
|
+
const h = await T(e, Oe, "getBlockNumber")({ cacheTime: 0 });
|
|
3239
3277
|
if (c !== void 0) {
|
|
3240
3278
|
if (h === c)
|
|
3241
3279
|
return;
|
|
3242
3280
|
if (h - c > 1 && n)
|
|
3243
3281
|
for (let p = c + 1n; p < h; p++)
|
|
3244
|
-
|
|
3282
|
+
l.onBlockNumber(p, c), c = p;
|
|
3245
3283
|
}
|
|
3246
|
-
(c === void 0 || h > c) && (
|
|
3284
|
+
(c === void 0 || h > c) && (l.onBlockNumber(h, c), c = h);
|
|
3247
3285
|
} catch (h) {
|
|
3248
|
-
|
|
3286
|
+
l.onError?.(h);
|
|
3249
3287
|
}
|
|
3250
3288
|
}, {
|
|
3251
3289
|
emitOnBegin: t,
|
|
3252
3290
|
interval: o
|
|
3253
3291
|
}));
|
|
3254
3292
|
})() : (() => {
|
|
3255
|
-
const
|
|
3293
|
+
const f = U([
|
|
3256
3294
|
"watchBlockNumber",
|
|
3257
3295
|
e.uid,
|
|
3258
3296
|
t,
|
|
3259
3297
|
n
|
|
3260
3298
|
]);
|
|
3261
|
-
return K(
|
|
3299
|
+
return K(f, { onBlockNumber: r, onError: s }, (l) => {
|
|
3262
3300
|
let h = !0, p = () => h = !1;
|
|
3263
3301
|
return (async () => {
|
|
3264
3302
|
try {
|
|
@@ -3273,11 +3311,11 @@ function Nr(e, { emitOnBegin: t = !1, emitMissed: n = !1, onBlockNumber: r, onEr
|
|
|
3273
3311
|
onData(m) {
|
|
3274
3312
|
if (!h)
|
|
3275
3313
|
return;
|
|
3276
|
-
const b =
|
|
3277
|
-
|
|
3314
|
+
const b = J(m.result?.number);
|
|
3315
|
+
l.onBlockNumber(b, c), c = b;
|
|
3278
3316
|
},
|
|
3279
3317
|
onError(m) {
|
|
3280
|
-
|
|
3318
|
+
l.onError?.(m);
|
|
3281
3319
|
}
|
|
3282
3320
|
});
|
|
3283
3321
|
p = y, h || p();
|
|
@@ -3295,123 +3333,123 @@ async function Br(e, t) {
|
|
|
3295
3333
|
hash: s,
|
|
3296
3334
|
onReplaced: a,
|
|
3297
3335
|
retryCount: o = 6,
|
|
3298
|
-
retryDelay: i = ({ count:
|
|
3336
|
+
retryDelay: i = ({ count: A }) => ~~(1 << A) * 200,
|
|
3299
3337
|
// exponential backoff
|
|
3300
3338
|
timeout: c = 18e4
|
|
3301
|
-
} = t,
|
|
3302
|
-
let
|
|
3303
|
-
const { promise: m, resolve: b, reject: w } = vn(),
|
|
3304
|
-
y?.(), g?.(), w(new
|
|
3339
|
+
} = t, d = U(["waitForTransactionReceipt", e.uid, s]), u = t.pollingInterval ? t.pollingInterval : e.chain?.experimental_preconfirmationTime ? e.chain.experimental_preconfirmationTime : e.pollingInterval;
|
|
3340
|
+
let f, l, h, p = !1, g, y;
|
|
3341
|
+
const { promise: m, resolve: b, reject: w } = vn(), P = c ? setTimeout(() => {
|
|
3342
|
+
y?.(), g?.(), w(new zs({ hash: s }));
|
|
3305
3343
|
}, c) : void 0;
|
|
3306
|
-
return g = K(
|
|
3307
|
-
if (h = await
|
|
3344
|
+
return g = K(d, { onReplaced: a, resolve: b, reject: w }, async (A) => {
|
|
3345
|
+
if (h = await T(e, Ce, "getTransactionReceipt")({ hash: s }).catch(() => {
|
|
3308
3346
|
}), h && r <= 1) {
|
|
3309
|
-
clearTimeout(
|
|
3347
|
+
clearTimeout(P), A.resolve(h), g?.();
|
|
3310
3348
|
return;
|
|
3311
3349
|
}
|
|
3312
|
-
y =
|
|
3350
|
+
y = T(e, Sr, "watchBlockNumber")({
|
|
3313
3351
|
emitMissed: !0,
|
|
3314
3352
|
emitOnBegin: !0,
|
|
3315
3353
|
poll: !0,
|
|
3316
|
-
pollingInterval:
|
|
3317
|
-
async onBlockNumber(
|
|
3318
|
-
const
|
|
3319
|
-
clearTimeout(
|
|
3354
|
+
pollingInterval: u,
|
|
3355
|
+
async onBlockNumber(x) {
|
|
3356
|
+
const v = (N) => {
|
|
3357
|
+
clearTimeout(P), y?.(), N(), g?.();
|
|
3320
3358
|
};
|
|
3321
|
-
let
|
|
3359
|
+
let I = x;
|
|
3322
3360
|
if (!p)
|
|
3323
3361
|
try {
|
|
3324
3362
|
if (h) {
|
|
3325
|
-
if (r > 1 && (!h.blockNumber ||
|
|
3363
|
+
if (r > 1 && (!h.blockNumber || I - h.blockNumber + 1n < r))
|
|
3326
3364
|
return;
|
|
3327
|
-
|
|
3365
|
+
v(() => A.resolve(h));
|
|
3328
3366
|
return;
|
|
3329
3367
|
}
|
|
3330
|
-
if (n && !
|
|
3331
|
-
|
|
3368
|
+
if (n && !f && (p = !0, await Be(async () => {
|
|
3369
|
+
f = await T(e, Ct, "getTransaction")({ hash: s }), f.blockNumber && (I = f.blockNumber);
|
|
3332
3370
|
}, {
|
|
3333
3371
|
delay: i,
|
|
3334
3372
|
retryCount: o
|
|
3335
|
-
}), p = !1), h = await
|
|
3373
|
+
}), p = !1), h = await T(e, Ce, "getTransactionReceipt")({ hash: s }), r > 1 && (!h.blockNumber || I - h.blockNumber + 1n < r))
|
|
3336
3374
|
return;
|
|
3337
|
-
|
|
3375
|
+
v(() => A.resolve(h));
|
|
3338
3376
|
} catch (N) {
|
|
3339
|
-
if (N instanceof
|
|
3340
|
-
if (!
|
|
3377
|
+
if (N instanceof Hn || N instanceof Wn) {
|
|
3378
|
+
if (!f) {
|
|
3341
3379
|
p = !1;
|
|
3342
3380
|
return;
|
|
3343
3381
|
}
|
|
3344
3382
|
try {
|
|
3345
|
-
|
|
3346
|
-
const
|
|
3347
|
-
blockNumber:
|
|
3383
|
+
l = f, p = !0;
|
|
3384
|
+
const k = await Be(() => T(e, te, "getBlock")({
|
|
3385
|
+
blockNumber: I,
|
|
3348
3386
|
includeTransactions: !0
|
|
3349
3387
|
}), {
|
|
3350
3388
|
delay: i,
|
|
3351
3389
|
retryCount: o,
|
|
3352
|
-
shouldRetry: ({ error:
|
|
3390
|
+
shouldRetry: ({ error: z }) => z instanceof us
|
|
3353
3391
|
});
|
|
3354
3392
|
p = !1;
|
|
3355
|
-
const
|
|
3356
|
-
if (!
|
|
3357
|
-
hash:
|
|
3358
|
-
}), r > 1 && (!h.blockNumber ||
|
|
3393
|
+
const B = k.transactions.find(({ from: z, nonce: V }) => z === l.from && V === l.nonce);
|
|
3394
|
+
if (!B || (h = await T(e, Ce, "getTransactionReceipt")({
|
|
3395
|
+
hash: B.hash
|
|
3396
|
+
}), r > 1 && (!h.blockNumber || I - h.blockNumber + 1n < r)))
|
|
3359
3397
|
return;
|
|
3360
|
-
let
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
reason:
|
|
3364
|
-
replacedTransaction:
|
|
3365
|
-
transaction:
|
|
3398
|
+
let S = "replaced";
|
|
3399
|
+
B.to === l.to && B.value === l.value && B.input === l.input ? S = "repriced" : B.from === B.to && B.value === 0n && (S = "cancelled"), v(() => {
|
|
3400
|
+
A.onReplaced?.({
|
|
3401
|
+
reason: S,
|
|
3402
|
+
replacedTransaction: l,
|
|
3403
|
+
transaction: B,
|
|
3366
3404
|
transactionReceipt: h
|
|
3367
|
-
}),
|
|
3405
|
+
}), A.resolve(h);
|
|
3368
3406
|
});
|
|
3369
|
-
} catch (
|
|
3370
|
-
|
|
3407
|
+
} catch (k) {
|
|
3408
|
+
v(() => A.reject(k));
|
|
3371
3409
|
}
|
|
3372
3410
|
} else
|
|
3373
|
-
|
|
3411
|
+
v(() => A.reject(N));
|
|
3374
3412
|
}
|
|
3375
3413
|
}
|
|
3376
3414
|
});
|
|
3377
3415
|
}), m;
|
|
3378
3416
|
}
|
|
3379
|
-
function
|
|
3380
|
-
const
|
|
3381
|
-
let
|
|
3382
|
-
return
|
|
3383
|
-
const p =
|
|
3417
|
+
function pi(e, { blockTag: t = e.experimental_blockTag ?? "latest", emitMissed: n = !1, emitOnBegin: r = !1, onBlock: s, onError: a, includeTransactions: o, poll: i, pollingInterval: c = e.pollingInterval }) {
|
|
3418
|
+
const d = typeof i < "u" ? i : !(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")), u = o ?? !1;
|
|
3419
|
+
let f;
|
|
3420
|
+
return d ? (() => {
|
|
3421
|
+
const p = U([
|
|
3384
3422
|
"watchBlocks",
|
|
3385
3423
|
e.uid,
|
|
3386
3424
|
t,
|
|
3387
3425
|
n,
|
|
3388
3426
|
r,
|
|
3389
|
-
|
|
3427
|
+
u,
|
|
3390
3428
|
c
|
|
3391
3429
|
]);
|
|
3392
|
-
return K(p, { onBlock: s, onError: a }, (g) =>
|
|
3430
|
+
return K(p, { onBlock: s, onError: a }, (g) => be(async () => {
|
|
3393
3431
|
try {
|
|
3394
|
-
const y = await
|
|
3432
|
+
const y = await T(e, te, "getBlock")({
|
|
3395
3433
|
blockTag: t,
|
|
3396
|
-
includeTransactions:
|
|
3434
|
+
includeTransactions: u
|
|
3397
3435
|
});
|
|
3398
|
-
if (y.number !== null &&
|
|
3399
|
-
if (y.number ===
|
|
3436
|
+
if (y.number !== null && f?.number != null) {
|
|
3437
|
+
if (y.number === f.number)
|
|
3400
3438
|
return;
|
|
3401
|
-
if (y.number -
|
|
3402
|
-
for (let m =
|
|
3403
|
-
const b = await
|
|
3439
|
+
if (y.number - f.number > 1 && n)
|
|
3440
|
+
for (let m = f?.number + 1n; m < y.number; m++) {
|
|
3441
|
+
const b = await T(e, te, "getBlock")({
|
|
3404
3442
|
blockNumber: m,
|
|
3405
|
-
includeTransactions:
|
|
3443
|
+
includeTransactions: u
|
|
3406
3444
|
});
|
|
3407
|
-
g.onBlock(b,
|
|
3445
|
+
g.onBlock(b, f), f = b;
|
|
3408
3446
|
}
|
|
3409
3447
|
}
|
|
3410
3448
|
// If no previous block exists, emit.
|
|
3411
|
-
(
|
|
3449
|
+
(f?.number == null || // If the block tag is "pending" with no block number, emit.
|
|
3412
3450
|
t === "pending" && y?.number == null || // If the next block number is greater than the previous block number, emit.
|
|
3413
3451
|
// We don't want to emit blocks in the past.
|
|
3414
|
-
y.number !== null && y.number >
|
|
3452
|
+
y.number !== null && y.number > f.number) && (g.onBlock(y, f), f = y);
|
|
3415
3453
|
} catch (y) {
|
|
3416
3454
|
g.onError?.(y);
|
|
3417
3455
|
}
|
|
@@ -3423,15 +3461,15 @@ function li(e, { blockTag: t = e.experimental_blockTag ?? "latest", emitMissed:
|
|
|
3423
3461
|
let p = !0, g = !0, y = () => p = !1;
|
|
3424
3462
|
return (async () => {
|
|
3425
3463
|
try {
|
|
3426
|
-
r &&
|
|
3464
|
+
r && T(e, te, "getBlock")({
|
|
3427
3465
|
blockTag: t,
|
|
3428
|
-
includeTransactions:
|
|
3466
|
+
includeTransactions: u
|
|
3429
3467
|
}).then((w) => {
|
|
3430
3468
|
p && g && (s(w, void 0), g = !1);
|
|
3431
3469
|
}).catch(a);
|
|
3432
3470
|
const m = (() => {
|
|
3433
3471
|
if (e.transport.type === "fallback") {
|
|
3434
|
-
const w = e.transport.transports.find((
|
|
3472
|
+
const w = e.transport.transports.find((P) => P.config.type === "webSocket" || P.config.type === "ipc");
|
|
3435
3473
|
return w ? w.value : e.transport;
|
|
3436
3474
|
}
|
|
3437
3475
|
return e.transport;
|
|
@@ -3440,12 +3478,12 @@ function li(e, { blockTag: t = e.experimental_blockTag ?? "latest", emitMissed:
|
|
|
3440
3478
|
async onData(w) {
|
|
3441
3479
|
if (!p)
|
|
3442
3480
|
return;
|
|
3443
|
-
const
|
|
3481
|
+
const P = await T(e, te, "getBlock")({
|
|
3444
3482
|
blockNumber: w.result?.number,
|
|
3445
|
-
includeTransactions:
|
|
3483
|
+
includeTransactions: u
|
|
3446
3484
|
}).catch(() => {
|
|
3447
3485
|
});
|
|
3448
|
-
p && (s(
|
|
3486
|
+
p && (s(P, f), g = !1, f = P);
|
|
3449
3487
|
},
|
|
3450
3488
|
onError(w) {
|
|
3451
3489
|
a?.(w);
|
|
@@ -3458,27 +3496,27 @@ function li(e, { blockTag: t = e.experimental_blockTag ?? "latest", emitMissed:
|
|
|
3458
3496
|
})(), () => y();
|
|
3459
3497
|
})();
|
|
3460
3498
|
}
|
|
3461
|
-
function
|
|
3462
|
-
const
|
|
3463
|
-
return
|
|
3464
|
-
const y =
|
|
3499
|
+
function mi(e, { address: t, args: n, batch: r = !0, event: s, events: a, fromBlock: o, onError: i, onLogs: c, poll: d, pollingInterval: u = e.pollingInterval, strict: f }) {
|
|
3500
|
+
const l = typeof d < "u" ? d : 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")), h = f ?? !1;
|
|
3501
|
+
return l ? (() => {
|
|
3502
|
+
const y = U([
|
|
3465
3503
|
"watchEvent",
|
|
3466
3504
|
t,
|
|
3467
3505
|
n,
|
|
3468
3506
|
r,
|
|
3469
3507
|
e.uid,
|
|
3470
3508
|
s,
|
|
3471
|
-
|
|
3509
|
+
u,
|
|
3472
3510
|
o
|
|
3473
3511
|
]);
|
|
3474
3512
|
return K(y, { onLogs: c, onError: i }, (m) => {
|
|
3475
3513
|
let b;
|
|
3476
3514
|
o !== void 0 && (b = o - 1n);
|
|
3477
|
-
let w,
|
|
3478
|
-
const
|
|
3479
|
-
if (!
|
|
3515
|
+
let w, P = !1;
|
|
3516
|
+
const A = be(async () => {
|
|
3517
|
+
if (!P) {
|
|
3480
3518
|
try {
|
|
3481
|
-
w = await
|
|
3519
|
+
w = await T(e, ur, "createEventFilter")({
|
|
3482
3520
|
address: t,
|
|
3483
3521
|
args: n,
|
|
3484
3522
|
event: s,
|
|
@@ -3488,40 +3526,40 @@ function hi(e, { address: t, args: n, batch: r = !0, event: s, events: a, fromBl
|
|
|
3488
3526
|
});
|
|
3489
3527
|
} catch {
|
|
3490
3528
|
}
|
|
3491
|
-
|
|
3529
|
+
P = !0;
|
|
3492
3530
|
return;
|
|
3493
3531
|
}
|
|
3494
3532
|
try {
|
|
3495
|
-
let
|
|
3533
|
+
let x;
|
|
3496
3534
|
if (w)
|
|
3497
|
-
|
|
3535
|
+
x = await T(e, lt, "getFilterChanges")({ filter: w });
|
|
3498
3536
|
else {
|
|
3499
|
-
const
|
|
3500
|
-
b && b !==
|
|
3537
|
+
const v = await T(e, Oe, "getBlockNumber")({});
|
|
3538
|
+
b && b !== v ? x = await T(e, _n, "getLogs")({
|
|
3501
3539
|
address: t,
|
|
3502
3540
|
args: n,
|
|
3503
3541
|
event: s,
|
|
3504
3542
|
events: a,
|
|
3505
3543
|
fromBlock: b + 1n,
|
|
3506
|
-
toBlock:
|
|
3507
|
-
}) :
|
|
3544
|
+
toBlock: v
|
|
3545
|
+
}) : x = [], b = v;
|
|
3508
3546
|
}
|
|
3509
|
-
if (
|
|
3547
|
+
if (x.length === 0)
|
|
3510
3548
|
return;
|
|
3511
3549
|
if (r)
|
|
3512
|
-
m.onLogs(
|
|
3550
|
+
m.onLogs(x);
|
|
3513
3551
|
else
|
|
3514
|
-
for (const
|
|
3515
|
-
m.onLogs([
|
|
3516
|
-
} catch (
|
|
3517
|
-
w &&
|
|
3552
|
+
for (const v of x)
|
|
3553
|
+
m.onLogs([v]);
|
|
3554
|
+
} catch (x) {
|
|
3555
|
+
w && x instanceof Je && (P = !1), m.onError?.(x);
|
|
3518
3556
|
}
|
|
3519
3557
|
}, {
|
|
3520
3558
|
emitOnBegin: !0,
|
|
3521
|
-
interval:
|
|
3559
|
+
interval: u
|
|
3522
3560
|
});
|
|
3523
3561
|
return async () => {
|
|
3524
|
-
w && await
|
|
3562
|
+
w && await T(e, ht, "uninstallFilter")({ filter: w }), A();
|
|
3525
3563
|
};
|
|
3526
3564
|
});
|
|
3527
3565
|
})() : (() => {
|
|
@@ -3530,163 +3568,163 @@ function hi(e, { address: t, args: n, batch: r = !0, event: s, events: a, fromBl
|
|
|
3530
3568
|
try {
|
|
3531
3569
|
const b = (() => {
|
|
3532
3570
|
if (e.transport.type === "fallback") {
|
|
3533
|
-
const
|
|
3534
|
-
return
|
|
3571
|
+
const x = e.transport.transports.find((v) => v.config.type === "webSocket" || v.config.type === "ipc");
|
|
3572
|
+
return x ? x.value : e.transport;
|
|
3535
3573
|
}
|
|
3536
3574
|
return e.transport;
|
|
3537
3575
|
})(), w = a ?? (s ? [s] : void 0);
|
|
3538
|
-
let
|
|
3539
|
-
w && (
|
|
3540
|
-
abi: [
|
|
3541
|
-
eventName:
|
|
3576
|
+
let P = [];
|
|
3577
|
+
w && (P = [w.flatMap((v) => xn({
|
|
3578
|
+
abi: [v],
|
|
3579
|
+
eventName: v.name,
|
|
3542
3580
|
args: n
|
|
3543
|
-
}))], s && (
|
|
3544
|
-
const { unsubscribe:
|
|
3545
|
-
params: ["logs", { address: t, topics:
|
|
3546
|
-
onData(
|
|
3581
|
+
}))], s && (P = P[0]));
|
|
3582
|
+
const { unsubscribe: A } = await b.subscribe({
|
|
3583
|
+
params: ["logs", { address: t, topics: P }],
|
|
3584
|
+
onData(x) {
|
|
3547
3585
|
if (!y)
|
|
3548
3586
|
return;
|
|
3549
|
-
const
|
|
3587
|
+
const v = x.result;
|
|
3550
3588
|
try {
|
|
3551
|
-
const { eventName:
|
|
3589
|
+
const { eventName: I, args: N } = ds({
|
|
3552
3590
|
abi: w ?? [],
|
|
3553
|
-
data:
|
|
3554
|
-
topics:
|
|
3591
|
+
data: v.data,
|
|
3592
|
+
topics: v.topics,
|
|
3555
3593
|
strict: h
|
|
3556
|
-
}),
|
|
3557
|
-
c([
|
|
3558
|
-
} catch (
|
|
3559
|
-
let N,
|
|
3560
|
-
if (
|
|
3561
|
-
if (
|
|
3594
|
+
}), k = Ne(v, { args: N, eventName: I });
|
|
3595
|
+
c([k]);
|
|
3596
|
+
} catch (I) {
|
|
3597
|
+
let N, k;
|
|
3598
|
+
if (I instanceof fs || I instanceof ls) {
|
|
3599
|
+
if (f)
|
|
3562
3600
|
return;
|
|
3563
|
-
N =
|
|
3601
|
+
N = I.abiItem.name, k = I.abiItem.inputs?.some((S) => !("name" in S && S.name));
|
|
3564
3602
|
}
|
|
3565
|
-
const
|
|
3566
|
-
args:
|
|
3603
|
+
const B = Ne(v, {
|
|
3604
|
+
args: k ? [] : {},
|
|
3567
3605
|
eventName: N
|
|
3568
3606
|
});
|
|
3569
|
-
c([
|
|
3607
|
+
c([B]);
|
|
3570
3608
|
}
|
|
3571
3609
|
},
|
|
3572
|
-
onError(
|
|
3573
|
-
i?.(
|
|
3610
|
+
onError(x) {
|
|
3611
|
+
i?.(x);
|
|
3574
3612
|
}
|
|
3575
3613
|
});
|
|
3576
|
-
m =
|
|
3614
|
+
m = A, y || m();
|
|
3577
3615
|
} catch (b) {
|
|
3578
3616
|
i?.(b);
|
|
3579
3617
|
}
|
|
3580
3618
|
})(), () => m();
|
|
3581
3619
|
})();
|
|
3582
3620
|
}
|
|
3583
|
-
function
|
|
3621
|
+
function yi(e, { batch: t = !0, onError: n, onTransactions: r, poll: s, pollingInterval: a = e.pollingInterval }) {
|
|
3584
3622
|
return (typeof s < "u" ? s : e.transport.type !== "webSocket" && e.transport.type !== "ipc") ? (() => {
|
|
3585
|
-
const
|
|
3623
|
+
const d = U([
|
|
3586
3624
|
"watchPendingTransactions",
|
|
3587
3625
|
e.uid,
|
|
3588
3626
|
t,
|
|
3589
3627
|
a
|
|
3590
3628
|
]);
|
|
3591
|
-
return K(
|
|
3592
|
-
let
|
|
3593
|
-
const
|
|
3629
|
+
return K(d, { onTransactions: r, onError: n }, (u) => {
|
|
3630
|
+
let f;
|
|
3631
|
+
const l = be(async () => {
|
|
3594
3632
|
try {
|
|
3595
|
-
if (!
|
|
3633
|
+
if (!f)
|
|
3596
3634
|
try {
|
|
3597
|
-
|
|
3635
|
+
f = await T(e, dr, "createPendingTransactionFilter")({});
|
|
3598
3636
|
return;
|
|
3599
3637
|
} catch (p) {
|
|
3600
|
-
throw
|
|
3638
|
+
throw l(), p;
|
|
3601
3639
|
}
|
|
3602
|
-
const h = await
|
|
3640
|
+
const h = await T(e, lt, "getFilterChanges")({ filter: f });
|
|
3603
3641
|
if (h.length === 0)
|
|
3604
3642
|
return;
|
|
3605
3643
|
if (t)
|
|
3606
|
-
|
|
3644
|
+
u.onTransactions(h);
|
|
3607
3645
|
else
|
|
3608
3646
|
for (const p of h)
|
|
3609
|
-
|
|
3647
|
+
u.onTransactions([p]);
|
|
3610
3648
|
} catch (h) {
|
|
3611
|
-
|
|
3649
|
+
u.onError?.(h);
|
|
3612
3650
|
}
|
|
3613
3651
|
}, {
|
|
3614
3652
|
emitOnBegin: !0,
|
|
3615
3653
|
interval: a
|
|
3616
3654
|
});
|
|
3617
3655
|
return async () => {
|
|
3618
|
-
|
|
3656
|
+
f && await T(e, ht, "uninstallFilter")({ filter: f }), l();
|
|
3619
3657
|
};
|
|
3620
3658
|
});
|
|
3621
3659
|
})() : (() => {
|
|
3622
|
-
let
|
|
3660
|
+
let d = !0, u = () => d = !1;
|
|
3623
3661
|
return (async () => {
|
|
3624
3662
|
try {
|
|
3625
|
-
const { unsubscribe:
|
|
3663
|
+
const { unsubscribe: f } = await e.transport.subscribe({
|
|
3626
3664
|
params: ["newPendingTransactions"],
|
|
3627
|
-
onData(
|
|
3628
|
-
if (!
|
|
3665
|
+
onData(l) {
|
|
3666
|
+
if (!d)
|
|
3629
3667
|
return;
|
|
3630
|
-
const h =
|
|
3668
|
+
const h = l.result;
|
|
3631
3669
|
r([h]);
|
|
3632
3670
|
},
|
|
3633
|
-
onError(
|
|
3634
|
-
n?.(
|
|
3671
|
+
onError(l) {
|
|
3672
|
+
n?.(l);
|
|
3635
3673
|
}
|
|
3636
3674
|
});
|
|
3637
|
-
|
|
3638
|
-
} catch (
|
|
3639
|
-
n?.(
|
|
3675
|
+
u = f, d || u();
|
|
3676
|
+
} catch (f) {
|
|
3677
|
+
n?.(f);
|
|
3640
3678
|
}
|
|
3641
|
-
})(), () =>
|
|
3679
|
+
})(), () => u();
|
|
3642
3680
|
})();
|
|
3643
3681
|
}
|
|
3644
|
-
function
|
|
3645
|
-
const { scheme: t, statement: n, ...r } = e.match(
|
|
3682
|
+
function bi(e) {
|
|
3683
|
+
const { scheme: t, statement: n, ...r } = e.match(gi)?.groups ?? {}, { chainId: s, expirationTime: a, issuedAt: o, notBefore: i, requestId: c, ...d } = e.match(wi)?.groups ?? {}, u = e.split("Resources:")[1]?.split(`
|
|
3646
3684
|
- `).slice(1);
|
|
3647
3685
|
return {
|
|
3648
3686
|
...r,
|
|
3649
|
-
...
|
|
3687
|
+
...d,
|
|
3650
3688
|
...s ? { chainId: Number(s) } : {},
|
|
3651
3689
|
...a ? { expirationTime: new Date(a) } : {},
|
|
3652
3690
|
...o ? { issuedAt: new Date(o) } : {},
|
|
3653
3691
|
...i ? { notBefore: new Date(i) } : {},
|
|
3654
3692
|
...c ? { requestId: c } : {},
|
|
3655
|
-
...
|
|
3693
|
+
...u ? { resources: u } : {},
|
|
3656
3694
|
...t ? { scheme: t } : {},
|
|
3657
3695
|
...n ? { statement: n } : {}
|
|
3658
3696
|
};
|
|
3659
3697
|
}
|
|
3660
|
-
const
|
|
3661
|
-
function
|
|
3698
|
+
const gi = /^(?:(?<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)?/, wi = /(?: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>.+))?/;
|
|
3699
|
+
function vi(e) {
|
|
3662
3700
|
const { address: t, domain: n, message: r, nonce: s, scheme: a, time: o = /* @__PURE__ */ new Date() } = e;
|
|
3663
3701
|
if (n && r.domain !== n || s && r.nonce !== s || a && r.scheme !== a || r.expirationTime && o >= r.expirationTime || r.notBefore && o < r.notBefore)
|
|
3664
3702
|
return !1;
|
|
3665
3703
|
try {
|
|
3666
|
-
if (!r.address || !
|
|
3704
|
+
if (!r.address || !jn(r.address, { strict: !1 }) || t && !Fe(r.address, t))
|
|
3667
3705
|
return !1;
|
|
3668
3706
|
} catch {
|
|
3669
3707
|
return !1;
|
|
3670
3708
|
}
|
|
3671
3709
|
return !0;
|
|
3672
3710
|
}
|
|
3673
|
-
async function
|
|
3674
|
-
const { address: n, domain: r, message: s, nonce: a, scheme: o, signature: i, time: c = /* @__PURE__ */ new Date(), ...
|
|
3675
|
-
if (!
|
|
3711
|
+
async function Ei(e, t) {
|
|
3712
|
+
const { address: n, domain: r, message: s, nonce: a, scheme: o, signature: i, time: c = /* @__PURE__ */ new Date(), ...d } = t, u = bi(s);
|
|
3713
|
+
if (!u.address || !vi({
|
|
3676
3714
|
address: n,
|
|
3677
3715
|
domain: r,
|
|
3678
|
-
message:
|
|
3716
|
+
message: u,
|
|
3679
3717
|
nonce: a,
|
|
3680
3718
|
scheme: o,
|
|
3681
3719
|
time: c
|
|
3682
3720
|
}))
|
|
3683
3721
|
return !1;
|
|
3684
|
-
const
|
|
3722
|
+
const l = fr(s);
|
|
3685
3723
|
return Le(e, {
|
|
3686
|
-
address:
|
|
3687
|
-
hash:
|
|
3724
|
+
address: u.address,
|
|
3725
|
+
hash: l,
|
|
3688
3726
|
signature: i,
|
|
3689
|
-
...
|
|
3727
|
+
...d
|
|
3690
3728
|
});
|
|
3691
3729
|
}
|
|
3692
3730
|
async function kt(e, { serializedTransaction: t, throwOnReceiptRevert: n, timeout: r }) {
|
|
@@ -3695,79 +3733,80 @@ async function kt(e, { serializedTransaction: t, throwOnReceiptRevert: n, timeou
|
|
|
3695
3733
|
params: r ? [t, C(r)] : [t]
|
|
3696
3734
|
}, { retryCount: 0 }), o = (e.chain?.formatters?.transactionReceipt?.format || Vn)(s);
|
|
3697
3735
|
if (o.status === "reverted" && n)
|
|
3698
|
-
throw new
|
|
3736
|
+
throw new Gn({ receipt: o });
|
|
3699
3737
|
return o;
|
|
3700
3738
|
}
|
|
3701
|
-
function
|
|
3739
|
+
function Pi(e) {
|
|
3702
3740
|
return {
|
|
3703
3741
|
call: (t) => $n(e, t),
|
|
3704
|
-
createAccessList: (t) =>
|
|
3705
|
-
createBlockFilter: () =>
|
|
3706
|
-
createContractEventFilter: (t) =>
|
|
3707
|
-
createEventFilter: (t) =>
|
|
3708
|
-
createPendingTransactionFilter: () =>
|
|
3709
|
-
estimateContractGas: (t) =>
|
|
3710
|
-
estimateGas: (t) =>
|
|
3711
|
-
getBalance: (t) =>
|
|
3712
|
-
getBlobBaseFee: () =>
|
|
3742
|
+
createAccessList: (t) => cr(e, t),
|
|
3743
|
+
createBlockFilter: () => wa(e),
|
|
3744
|
+
createContractEventFilter: (t) => Es(e, t),
|
|
3745
|
+
createEventFilter: (t) => ur(e, t),
|
|
3746
|
+
createPendingTransactionFilter: () => dr(e),
|
|
3747
|
+
estimateContractGas: (t) => vs(e, t),
|
|
3748
|
+
estimateGas: (t) => ws(e, t),
|
|
3749
|
+
getBalance: (t) => va(e, t),
|
|
3750
|
+
getBlobBaseFee: () => Ea(e),
|
|
3713
3751
|
getBlock: (t) => te(e, t),
|
|
3714
3752
|
getBlockNumber: (t) => Oe(e, t),
|
|
3715
|
-
getBlockTransactionCount: (t) =>
|
|
3753
|
+
getBlockTransactionCount: (t) => Pa(e, t),
|
|
3716
3754
|
getBytecode: (t) => nt(e, t),
|
|
3717
|
-
getChainId: () =>
|
|
3755
|
+
getChainId: () => we(e),
|
|
3718
3756
|
getCode: (t) => nt(e, t),
|
|
3719
|
-
getContractEvents: (t) =>
|
|
3757
|
+
getContractEvents: (t) => gs(e, t),
|
|
3720
3758
|
getEip712Domain: (t) => Ta(e, t),
|
|
3721
|
-
getEnsAddress: (t) =>
|
|
3722
|
-
getEnsAvatar: (t) =>
|
|
3723
|
-
getEnsName: (t) =>
|
|
3724
|
-
getEnsResolver: (t) =>
|
|
3725
|
-
getEnsText: (t) =>
|
|
3726
|
-
getFeeHistory: (t) =>
|
|
3727
|
-
estimateFeesPerGas: (t) =>
|
|
3759
|
+
getEnsAddress: (t) => ra(e, t),
|
|
3760
|
+
getEnsAvatar: (t) => ya(e, t),
|
|
3761
|
+
getEnsName: (t) => ba(e, t),
|
|
3762
|
+
getEnsResolver: (t) => ga(e, t),
|
|
3763
|
+
getEnsText: (t) => ir(e, t),
|
|
3764
|
+
getFeeHistory: (t) => Ra(e, t),
|
|
3765
|
+
estimateFeesPerGas: (t) => bs(e, t),
|
|
3728
3766
|
getFilterChanges: (t) => lt(e, t),
|
|
3729
|
-
getFilterLogs: (t) =>
|
|
3730
|
-
getGasPrice: () =>
|
|
3767
|
+
getFilterLogs: (t) => Ca(e, t),
|
|
3768
|
+
getGasPrice: () => ys(e),
|
|
3731
3769
|
getLogs: (t) => _n(e, t),
|
|
3732
|
-
getProof: (t) =>
|
|
3733
|
-
estimateMaxPriorityFeePerGas: (t) =>
|
|
3734
|
-
|
|
3770
|
+
getProof: (t) => Ho(e, t),
|
|
3771
|
+
estimateMaxPriorityFeePerGas: (t) => ms(e, t),
|
|
3772
|
+
fillTransaction: (t) => Fn(e, t),
|
|
3773
|
+
getStorageAt: (t) => Wo(e, t),
|
|
3735
3774
|
getTransaction: (t) => Ct(e, t),
|
|
3736
|
-
getTransactionConfirmations: (t) =>
|
|
3737
|
-
getTransactionCount: (t) =>
|
|
3775
|
+
getTransactionConfirmations: (t) => Vo(e, t),
|
|
3776
|
+
getTransactionCount: (t) => Un(e, t),
|
|
3738
3777
|
getTransactionReceipt: (t) => Ce(e, t),
|
|
3739
|
-
multicall: (t) =>
|
|
3778
|
+
multicall: (t) => Go(e, t),
|
|
3740
3779
|
prepareTransactionRequest: (t) => pt(e, t),
|
|
3741
3780
|
readContract: (t) => D(e, t),
|
|
3742
3781
|
sendRawTransaction: (t) => zn(e, t),
|
|
3743
3782
|
sendRawTransactionSync: (t) => kt(e, t),
|
|
3744
3783
|
simulate: (t) => ot(e, t),
|
|
3745
3784
|
simulateBlocks: (t) => ot(e, t),
|
|
3746
|
-
simulateCalls: (t) =>
|
|
3747
|
-
simulateContract: (t) =>
|
|
3785
|
+
simulateCalls: (t) => ri(e, t),
|
|
3786
|
+
simulateContract: (t) => ps(e, t),
|
|
3748
3787
|
verifyHash: (t) => Le(e, t),
|
|
3749
|
-
verifyMessage: (t) =>
|
|
3750
|
-
verifySiweMessage: (t) =>
|
|
3751
|
-
verifyTypedData: (t) =>
|
|
3788
|
+
verifyMessage: (t) => li(e, t),
|
|
3789
|
+
verifySiweMessage: (t) => Ei(e, t),
|
|
3790
|
+
verifyTypedData: (t) => hi(e, t),
|
|
3752
3791
|
uninstallFilter: (t) => ht(e, t),
|
|
3753
3792
|
waitForTransactionReceipt: (t) => Br(e, t),
|
|
3754
|
-
watchBlocks: (t) =>
|
|
3755
|
-
watchBlockNumber: (t) =>
|
|
3756
|
-
watchContractEvent: (t) =>
|
|
3757
|
-
watchEvent: (t) =>
|
|
3758
|
-
watchPendingTransactions: (t) =>
|
|
3793
|
+
watchBlocks: (t) => pi(e, t),
|
|
3794
|
+
watchBlockNumber: (t) => Sr(e, t),
|
|
3795
|
+
watchContractEvent: (t) => hs(e, t),
|
|
3796
|
+
watchEvent: (t) => mi(e, t),
|
|
3797
|
+
watchPendingTransactions: (t) => yi(e, t)
|
|
3759
3798
|
};
|
|
3760
3799
|
}
|
|
3761
|
-
function
|
|
3800
|
+
function Gi(e) {
|
|
3762
3801
|
const { key: t = "public", name: n = "Public Client" } = e;
|
|
3763
|
-
return
|
|
3802
|
+
return rr({
|
|
3764
3803
|
...e,
|
|
3765
3804
|
key: t,
|
|
3766
3805
|
name: n,
|
|
3767
3806
|
type: "publicClient"
|
|
3768
|
-
}).extend(
|
|
3807
|
+
}).extend(Pi);
|
|
3769
3808
|
}
|
|
3770
|
-
async function
|
|
3809
|
+
async function xi(e, { chain: t }) {
|
|
3771
3810
|
const { id: n, name: r, nativeCurrency: s, rpcUrls: a, blockExplorers: o } = t;
|
|
3772
3811
|
await e.request({
|
|
3773
3812
|
method: "wallet_addEthereumChain",
|
|
@@ -3782,171 +3821,172 @@ async function Ei(e, { chain: t }) {
|
|
|
3782
3821
|
]
|
|
3783
3822
|
}, { dedupe: !0, retryCount: 0 });
|
|
3784
3823
|
}
|
|
3785
|
-
function
|
|
3786
|
-
const { abi: n, args: r, bytecode: s, ...a } = t, o =
|
|
3824
|
+
function Ti(e, t) {
|
|
3825
|
+
const { abi: n, args: r, bytecode: s, ...a } = t, o = Bn({ abi: n, args: r, bytecode: s });
|
|
3787
3826
|
return ut(e, {
|
|
3788
3827
|
...a,
|
|
3789
3828
|
...a.authorizationList ? { to: null } : {},
|
|
3790
3829
|
data: o
|
|
3791
3830
|
});
|
|
3792
3831
|
}
|
|
3793
|
-
async function
|
|
3794
|
-
return e.account?.type === "local" ? [e.account.address] : (await e.request({ method: "eth_accounts" }, { dedupe: !0 })).map((n) =>
|
|
3832
|
+
async function Ai(e) {
|
|
3833
|
+
return e.account?.type === "local" ? [e.account.address] : (await e.request({ method: "eth_accounts" }, { dedupe: !0 })).map((n) => Us(n));
|
|
3795
3834
|
}
|
|
3796
|
-
async function
|
|
3797
|
-
const { account: n = e.account, chainId: r } = t, s = n ?
|
|
3835
|
+
async function Ii(e, t = {}) {
|
|
3836
|
+
const { account: n = e.account, chainId: r } = t, s = n ? F(n) : void 0, a = r ? [s?.address, [C(r)]] : [s?.address], o = await e.request({
|
|
3798
3837
|
method: "wallet_getCapabilities",
|
|
3799
3838
|
params: a
|
|
3800
3839
|
}), i = {};
|
|
3801
|
-
for (const [c,
|
|
3840
|
+
for (const [c, d] of Object.entries(o)) {
|
|
3802
3841
|
i[Number(c)] = {};
|
|
3803
|
-
for (let [
|
|
3804
|
-
|
|
3842
|
+
for (let [u, f] of Object.entries(d))
|
|
3843
|
+
u === "addSubAccount" && (u = "unstable_addSubAccount"), i[Number(c)][u] = f;
|
|
3805
3844
|
}
|
|
3806
3845
|
return typeof r == "number" ? i[r] : i;
|
|
3807
3846
|
}
|
|
3808
|
-
async function
|
|
3847
|
+
async function Ri(e) {
|
|
3809
3848
|
return await e.request({ method: "wallet_getPermissions" }, { dedupe: !0 });
|
|
3810
3849
|
}
|
|
3811
|
-
async function
|
|
3850
|
+
async function $r(e, t) {
|
|
3812
3851
|
const { account: n = e.account, chainId: r, nonce: s } = t;
|
|
3813
3852
|
if (!n)
|
|
3814
|
-
throw new
|
|
3853
|
+
throw new ie({
|
|
3815
3854
|
docsPath: "/docs/eip7702/prepareAuthorization"
|
|
3816
3855
|
});
|
|
3817
|
-
const a =
|
|
3856
|
+
const a = F(n), o = (() => {
|
|
3818
3857
|
if (t.executor)
|
|
3819
|
-
return t.executor === "self" ? t.executor :
|
|
3858
|
+
return t.executor === "self" ? t.executor : F(t.executor);
|
|
3820
3859
|
})(), i = {
|
|
3821
3860
|
address: t.contractAddress ?? t.address,
|
|
3822
3861
|
chainId: r,
|
|
3823
3862
|
nonce: s
|
|
3824
3863
|
};
|
|
3825
|
-
return typeof i.chainId > "u" && (i.chainId = e.chain?.id ?? await
|
|
3864
|
+
return typeof i.chainId > "u" && (i.chainId = e.chain?.id ?? await T(e, we, "getChainId")({})), typeof i.nonce > "u" && (i.nonce = await T(e, Un, "getTransactionCount")({
|
|
3826
3865
|
address: a.address,
|
|
3827
3866
|
blockTag: "pending"
|
|
3828
|
-
}), (o === "self" || o?.address &&
|
|
3867
|
+
}), (o === "self" || o?.address && Fe(o.address, a.address)) && (i.nonce += 1)), i;
|
|
3829
3868
|
}
|
|
3830
|
-
async function
|
|
3869
|
+
async function Ci(e) {
|
|
3831
3870
|
return (await e.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((n) => mt(n));
|
|
3832
3871
|
}
|
|
3833
|
-
async function
|
|
3872
|
+
async function ki(e, t) {
|
|
3834
3873
|
return e.request({
|
|
3835
3874
|
method: "wallet_requestPermissions",
|
|
3836
3875
|
params: [t]
|
|
3837
3876
|
}, { retryCount: 0 });
|
|
3838
3877
|
}
|
|
3839
|
-
async function
|
|
3840
|
-
const { chain: n = e.chain } = t, r = t.timeout ?? Math.max((n?.blockTime ?? 0) * 3, 5e3), s = await
|
|
3841
|
-
return await
|
|
3878
|
+
async function Ni(e, t) {
|
|
3879
|
+
const { chain: n = e.chain } = t, r = t.timeout ?? Math.max((n?.blockTime ?? 0) * 3, 5e3), s = await Xn(e, t);
|
|
3880
|
+
return await tr(e, {
|
|
3842
3881
|
...t,
|
|
3843
3882
|
id: s.id,
|
|
3844
3883
|
timeout: r
|
|
3845
3884
|
});
|
|
3846
3885
|
}
|
|
3847
|
-
const
|
|
3848
|
-
async function
|
|
3849
|
-
const { account: n = e.account,
|
|
3886
|
+
const We = new Mn(128);
|
|
3887
|
+
async function _r(e, t) {
|
|
3888
|
+
const { account: n = e.account, assertChainId: r = !0, chain: s = e.chain, accessList: a, authorizationList: o, blobs: i, data: c, dataSuffix: d = typeof e.dataSuffix == "string" ? e.dataSuffix : e.dataSuffix?.value, gas: u, gasPrice: f, maxFeePerBlobGas: l, maxFeePerGas: h, maxPriorityFeePerGas: p, nonce: g, pollingInterval: y, throwOnReceiptRevert: m, type: b, value: w, ...P } = t, A = t.timeout ?? Math.max((s?.blockTime ?? 0) * 3, 5e3);
|
|
3850
3889
|
if (typeof n > "u")
|
|
3851
|
-
throw new
|
|
3890
|
+
throw new ie({
|
|
3852
3891
|
docsPath: "/docs/actions/wallet/sendTransactionSync"
|
|
3853
3892
|
});
|
|
3854
|
-
const
|
|
3893
|
+
const x = n ? F(n) : null;
|
|
3855
3894
|
try {
|
|
3856
3895
|
ze(t);
|
|
3857
|
-
const
|
|
3896
|
+
const v = await (async () => {
|
|
3858
3897
|
if (t.to)
|
|
3859
3898
|
return t.to;
|
|
3860
|
-
if (t.to !== null &&
|
|
3861
|
-
return await
|
|
3862
|
-
authorization:
|
|
3899
|
+
if (t.to !== null && o && o.length > 0)
|
|
3900
|
+
return await Tn({
|
|
3901
|
+
authorization: o[0]
|
|
3863
3902
|
}).catch(() => {
|
|
3864
|
-
throw new
|
|
3903
|
+
throw new _("`to` is required. Could not infer from `authorizationList`.");
|
|
3865
3904
|
});
|
|
3866
3905
|
})();
|
|
3867
|
-
if (
|
|
3868
|
-
let
|
|
3869
|
-
|
|
3870
|
-
currentChainId:
|
|
3871
|
-
chain:
|
|
3906
|
+
if (x?.type === "json-rpc" || x === null) {
|
|
3907
|
+
let I;
|
|
3908
|
+
s !== null && (I = await T(e, we, "getChainId")({}), r && On({
|
|
3909
|
+
currentChainId: I,
|
|
3910
|
+
chain: s
|
|
3872
3911
|
}));
|
|
3873
|
-
const
|
|
3912
|
+
const N = e.chain?.formatters?.transactionRequest?.format, B = (N || Ue)({
|
|
3874
3913
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
3875
|
-
...Pn(
|
|
3876
|
-
accessList:
|
|
3877
|
-
account:
|
|
3878
|
-
authorizationList:
|
|
3879
|
-
blobs:
|
|
3880
|
-
chainId:
|
|
3881
|
-
data:
|
|
3882
|
-
gas:
|
|
3883
|
-
gasPrice:
|
|
3884
|
-
maxFeePerBlobGas:
|
|
3885
|
-
maxFeePerGas:
|
|
3886
|
-
maxPriorityFeePerGas:
|
|
3887
|
-
nonce:
|
|
3888
|
-
to:
|
|
3889
|
-
type:
|
|
3890
|
-
value:
|
|
3891
|
-
}, "sendTransaction"),
|
|
3914
|
+
...Pn(P, { format: N }),
|
|
3915
|
+
accessList: a,
|
|
3916
|
+
account: x,
|
|
3917
|
+
authorizationList: o,
|
|
3918
|
+
blobs: i,
|
|
3919
|
+
chainId: I,
|
|
3920
|
+
data: c && Z([c, d ?? "0x"]),
|
|
3921
|
+
gas: u,
|
|
3922
|
+
gasPrice: f,
|
|
3923
|
+
maxFeePerBlobGas: l,
|
|
3924
|
+
maxFeePerGas: h,
|
|
3925
|
+
maxPriorityFeePerGas: p,
|
|
3926
|
+
nonce: g,
|
|
3927
|
+
to: v,
|
|
3928
|
+
type: b,
|
|
3929
|
+
value: w
|
|
3930
|
+
}, "sendTransaction"), S = We.get(e.uid), z = S ? "wallet_sendTransaction" : "eth_sendTransaction", V = await (async () => {
|
|
3892
3931
|
try {
|
|
3893
3932
|
return await e.request({
|
|
3894
|
-
method:
|
|
3895
|
-
params: [
|
|
3933
|
+
method: z,
|
|
3934
|
+
params: [B]
|
|
3896
3935
|
}, { retryCount: 0 });
|
|
3897
|
-
} catch (
|
|
3898
|
-
if (
|
|
3899
|
-
throw
|
|
3900
|
-
const
|
|
3901
|
-
if (
|
|
3936
|
+
} catch (Ee) {
|
|
3937
|
+
if (S === !1)
|
|
3938
|
+
throw Ee;
|
|
3939
|
+
const L = Ee;
|
|
3940
|
+
if (L.name === "InvalidInputRpcError" || L.name === "InvalidParamsRpcError" || L.name === "MethodNotFoundRpcError" || L.name === "MethodNotSupportedRpcError")
|
|
3902
3941
|
return await e.request({
|
|
3903
3942
|
method: "wallet_sendTransaction",
|
|
3904
|
-
params: [
|
|
3905
|
-
}, { retryCount: 0 }).then((
|
|
3906
|
-
const
|
|
3907
|
-
throw
|
|
3943
|
+
params: [B]
|
|
3944
|
+
}, { retryCount: 0 }).then((E) => (We.set(e.uid, !0), E)).catch((E) => {
|
|
3945
|
+
const $ = E;
|
|
3946
|
+
throw $.name === "MethodNotFoundRpcError" || $.name === "MethodNotSupportedRpcError" ? (We.set(e.uid, !1), L) : $;
|
|
3908
3947
|
});
|
|
3909
|
-
throw
|
|
3948
|
+
throw L;
|
|
3910
3949
|
}
|
|
3911
|
-
})(),
|
|
3950
|
+
})(), ue = await T(e, Br, "waitForTransactionReceipt")({
|
|
3912
3951
|
checkReplacement: !1,
|
|
3913
|
-
hash:
|
|
3914
|
-
pollingInterval:
|
|
3915
|
-
timeout:
|
|
3952
|
+
hash: V,
|
|
3953
|
+
pollingInterval: y,
|
|
3954
|
+
timeout: A
|
|
3916
3955
|
});
|
|
3917
|
-
if (
|
|
3918
|
-
throw new
|
|
3919
|
-
return
|
|
3956
|
+
if (m && ue.status === "reverted")
|
|
3957
|
+
throw new Gn({ receipt: ue });
|
|
3958
|
+
return ue;
|
|
3920
3959
|
}
|
|
3921
|
-
if (
|
|
3922
|
-
const
|
|
3923
|
-
account:
|
|
3924
|
-
accessList:
|
|
3925
|
-
authorizationList:
|
|
3926
|
-
blobs:
|
|
3927
|
-
chain:
|
|
3928
|
-
data:
|
|
3929
|
-
gas:
|
|
3930
|
-
gasPrice:
|
|
3931
|
-
maxFeePerBlobGas:
|
|
3932
|
-
maxFeePerGas:
|
|
3933
|
-
maxPriorityFeePerGas:
|
|
3934
|
-
nonce:
|
|
3935
|
-
nonceManager:
|
|
3936
|
-
parameters: [...
|
|
3937
|
-
type:
|
|
3938
|
-
value:
|
|
3939
|
-
...
|
|
3940
|
-
to:
|
|
3941
|
-
}),
|
|
3942
|
-
serializer:
|
|
3960
|
+
if (x?.type === "local") {
|
|
3961
|
+
const I = await T(e, pt, "prepareTransactionRequest")({
|
|
3962
|
+
account: x,
|
|
3963
|
+
accessList: a,
|
|
3964
|
+
authorizationList: o,
|
|
3965
|
+
blobs: i,
|
|
3966
|
+
chain: s,
|
|
3967
|
+
data: c && Z([c, d ?? "0x"]),
|
|
3968
|
+
gas: u,
|
|
3969
|
+
gasPrice: f,
|
|
3970
|
+
maxFeePerBlobGas: l,
|
|
3971
|
+
maxFeePerGas: h,
|
|
3972
|
+
maxPriorityFeePerGas: p,
|
|
3973
|
+
nonce: g,
|
|
3974
|
+
nonceManager: x.nonceManager,
|
|
3975
|
+
parameters: [...Ps, "sidecars"],
|
|
3976
|
+
type: b,
|
|
3977
|
+
value: w,
|
|
3978
|
+
...P,
|
|
3979
|
+
to: v
|
|
3980
|
+
}), N = s?.serializers?.transaction, k = await x.signTransaction(I, {
|
|
3981
|
+
serializer: N
|
|
3943
3982
|
});
|
|
3944
|
-
return await
|
|
3983
|
+
return await T(e, kt, "sendRawTransactionSync")({
|
|
3945
3984
|
serializedTransaction: k,
|
|
3946
|
-
throwOnReceiptRevert:
|
|
3985
|
+
throwOnReceiptRevert: m,
|
|
3986
|
+
timeout: t.timeout
|
|
3947
3987
|
});
|
|
3948
3988
|
}
|
|
3949
|
-
throw
|
|
3989
|
+
throw x?.type === "smart" ? new Re({
|
|
3950
3990
|
metaMessages: [
|
|
3951
3991
|
"Consider using the `sendUserOperation` Action instead."
|
|
3952
3992
|
],
|
|
@@ -3954,30 +3994,30 @@ async function $r(e, t) {
|
|
|
3954
3994
|
type: "smart"
|
|
3955
3995
|
}) : new Re({
|
|
3956
3996
|
docsPath: "/docs/actions/wallet/sendTransactionSync",
|
|
3957
|
-
type:
|
|
3997
|
+
type: x?.type
|
|
3958
3998
|
});
|
|
3959
|
-
} catch (
|
|
3960
|
-
throw
|
|
3999
|
+
} catch (v) {
|
|
4000
|
+
throw v instanceof Re ? v : wn(v, {
|
|
3961
4001
|
...t,
|
|
3962
|
-
account:
|
|
4002
|
+
account: x,
|
|
3963
4003
|
chain: t.chain || void 0
|
|
3964
4004
|
});
|
|
3965
4005
|
}
|
|
3966
4006
|
}
|
|
3967
|
-
async function
|
|
4007
|
+
async function Si(e, t) {
|
|
3968
4008
|
const { id: n } = t;
|
|
3969
4009
|
await e.request({
|
|
3970
4010
|
method: "wallet_showCallsStatus",
|
|
3971
4011
|
params: [n]
|
|
3972
4012
|
});
|
|
3973
4013
|
}
|
|
3974
|
-
async function
|
|
4014
|
+
async function Bi(e, t) {
|
|
3975
4015
|
const { account: n = e.account } = t;
|
|
3976
4016
|
if (!n)
|
|
3977
|
-
throw new
|
|
4017
|
+
throw new ie({
|
|
3978
4018
|
docsPath: "/docs/eip7702/signAuthorization"
|
|
3979
4019
|
});
|
|
3980
|
-
const r =
|
|
4020
|
+
const r = F(n);
|
|
3981
4021
|
if (!r.signAuthorization)
|
|
3982
4022
|
throw new Re({
|
|
3983
4023
|
docsPath: "/docs/eip7702/signAuthorization",
|
|
@@ -3986,40 +4026,40 @@ async function Ni(e, t) {
|
|
|
3986
4026
|
],
|
|
3987
4027
|
type: r.type
|
|
3988
4028
|
});
|
|
3989
|
-
const s = await
|
|
4029
|
+
const s = await $r(e, t);
|
|
3990
4030
|
return r.signAuthorization(s);
|
|
3991
4031
|
}
|
|
3992
|
-
async function
|
|
4032
|
+
async function $i(e, { account: t = e.account, message: n }) {
|
|
3993
4033
|
if (!t)
|
|
3994
|
-
throw new
|
|
4034
|
+
throw new ie({
|
|
3995
4035
|
docsPath: "/docs/actions/wallet/signMessage"
|
|
3996
4036
|
});
|
|
3997
|
-
const r =
|
|
4037
|
+
const r = F(t);
|
|
3998
4038
|
if (r.signMessage)
|
|
3999
4039
|
return r.signMessage({ message: n });
|
|
4000
|
-
const s = typeof n == "string" ?
|
|
4040
|
+
const s = typeof n == "string" ? Se(n) : n.raw instanceof Uint8Array ? ce(n.raw) : n.raw;
|
|
4001
4041
|
return e.request({
|
|
4002
4042
|
method: "personal_sign",
|
|
4003
4043
|
params: [s, r.address]
|
|
4004
4044
|
}, { retryCount: 0 });
|
|
4005
4045
|
}
|
|
4006
|
-
async function
|
|
4046
|
+
async function _i(e, t) {
|
|
4007
4047
|
const { account: n = e.account, chain: r = e.chain, ...s } = t;
|
|
4008
4048
|
if (!n)
|
|
4009
|
-
throw new
|
|
4049
|
+
throw new ie({
|
|
4010
4050
|
docsPath: "/docs/actions/wallet/signTransaction"
|
|
4011
4051
|
});
|
|
4012
|
-
const a =
|
|
4052
|
+
const a = F(n);
|
|
4013
4053
|
ze({
|
|
4014
4054
|
account: a,
|
|
4015
4055
|
...t
|
|
4016
4056
|
});
|
|
4017
|
-
const o = await
|
|
4018
|
-
r !== null &&
|
|
4057
|
+
const o = await T(e, we, "getChainId")({});
|
|
4058
|
+
r !== null && On({
|
|
4019
4059
|
currentChainId: o,
|
|
4020
4060
|
chain: r
|
|
4021
4061
|
});
|
|
4022
|
-
const c = (r?.formatters || e.chain?.formatters)?.transactionRequest?.format ||
|
|
4062
|
+
const c = (r?.formatters || e.chain?.formatters)?.transactionRequest?.format || Ue;
|
|
4023
4063
|
return a.signTransaction ? a.signTransaction({
|
|
4024
4064
|
...s,
|
|
4025
4065
|
chainId: o
|
|
@@ -4037,25 +4077,25 @@ async function Si(e, t) {
|
|
|
4037
4077
|
]
|
|
4038
4078
|
}, { retryCount: 0 });
|
|
4039
4079
|
}
|
|
4040
|
-
async function
|
|
4080
|
+
async function zi(e, t) {
|
|
4041
4081
|
const { account: n = e.account, domain: r, message: s, primaryType: a } = t;
|
|
4042
4082
|
if (!n)
|
|
4043
|
-
throw new
|
|
4083
|
+
throw new ie({
|
|
4044
4084
|
docsPath: "/docs/actions/wallet/signTypedData"
|
|
4045
4085
|
});
|
|
4046
|
-
const o =
|
|
4047
|
-
EIP712Domain:
|
|
4086
|
+
const o = F(n), i = {
|
|
4087
|
+
EIP712Domain: hr({ domain: r }),
|
|
4048
4088
|
...t.types
|
|
4049
4089
|
};
|
|
4050
|
-
if (
|
|
4090
|
+
if (lr({ domain: r, message: s, primaryType: a, types: i }), o.signTypedData)
|
|
4051
4091
|
return o.signTypedData({ domain: r, message: s, primaryType: a, types: i });
|
|
4052
|
-
const c =
|
|
4092
|
+
const c = Ma({ domain: r, message: s, primaryType: a, types: i });
|
|
4053
4093
|
return e.request({
|
|
4054
4094
|
method: "eth_signTypedData_v4",
|
|
4055
4095
|
params: [o.address, c]
|
|
4056
4096
|
}, { retryCount: 0 });
|
|
4057
4097
|
}
|
|
4058
|
-
async function
|
|
4098
|
+
async function Ui(e, { id: t }) {
|
|
4059
4099
|
await e.request({
|
|
4060
4100
|
method: "wallet_switchEthereumChain",
|
|
4061
4101
|
params: [
|
|
@@ -4065,58 +4105,59 @@ async function _i(e, { id: t }) {
|
|
|
4065
4105
|
]
|
|
4066
4106
|
}, { retryCount: 0 });
|
|
4067
4107
|
}
|
|
4068
|
-
async function
|
|
4108
|
+
async function Fi(e, t) {
|
|
4069
4109
|
return await e.request({
|
|
4070
4110
|
method: "wallet_watchAsset",
|
|
4071
4111
|
params: t
|
|
4072
4112
|
}, { retryCount: 0 });
|
|
4073
4113
|
}
|
|
4074
|
-
async function
|
|
4075
|
-
return
|
|
4114
|
+
async function Oi(e, t) {
|
|
4115
|
+
return Dn.internal(e, _r, "sendTransactionSync", t);
|
|
4076
4116
|
}
|
|
4077
|
-
function
|
|
4117
|
+
function Di(e) {
|
|
4078
4118
|
return {
|
|
4079
|
-
addChain: (t) =>
|
|
4080
|
-
deployContract: (t) =>
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4119
|
+
addChain: (t) => xi(e, t),
|
|
4120
|
+
deployContract: (t) => Ti(e, t),
|
|
4121
|
+
fillTransaction: (t) => Fn(e, t),
|
|
4122
|
+
getAddresses: () => Ai(e),
|
|
4123
|
+
getCallsStatus: (t) => er(e, t),
|
|
4124
|
+
getCapabilities: (t) => Ii(e, t),
|
|
4125
|
+
getChainId: () => we(e),
|
|
4126
|
+
getPermissions: () => Ri(e),
|
|
4127
|
+
prepareAuthorization: (t) => $r(e, t),
|
|
4087
4128
|
prepareTransactionRequest: (t) => pt(e, t),
|
|
4088
|
-
requestAddresses: () =>
|
|
4089
|
-
requestPermissions: (t) =>
|
|
4090
|
-
sendCalls: (t) =>
|
|
4091
|
-
sendCallsSync: (t) =>
|
|
4129
|
+
requestAddresses: () => Ci(e),
|
|
4130
|
+
requestPermissions: (t) => ki(e, t),
|
|
4131
|
+
sendCalls: (t) => Xn(e, t),
|
|
4132
|
+
sendCallsSync: (t) => Ni(e, t),
|
|
4092
4133
|
sendRawTransaction: (t) => zn(e, t),
|
|
4093
4134
|
sendRawTransactionSync: (t) => kt(e, t),
|
|
4094
4135
|
sendTransaction: (t) => ut(e, t),
|
|
4095
|
-
sendTransactionSync: (t) =>
|
|
4096
|
-
showCallsStatus: (t) =>
|
|
4097
|
-
signAuthorization: (t) =>
|
|
4098
|
-
signMessage: (t) =>
|
|
4099
|
-
signTransaction: (t) =>
|
|
4100
|
-
signTypedData: (t) =>
|
|
4101
|
-
switchChain: (t) =>
|
|
4102
|
-
waitForCallsStatus: (t) =>
|
|
4103
|
-
watchAsset: (t) =>
|
|
4104
|
-
writeContract: (t) =>
|
|
4105
|
-
writeContractSync: (t) =>
|
|
4136
|
+
sendTransactionSync: (t) => _r(e, t),
|
|
4137
|
+
showCallsStatus: (t) => Si(e, t),
|
|
4138
|
+
signAuthorization: (t) => Bi(e, t),
|
|
4139
|
+
signMessage: (t) => $i(e, t),
|
|
4140
|
+
signTransaction: (t) => _i(e, t),
|
|
4141
|
+
signTypedData: (t) => zi(e, t),
|
|
4142
|
+
switchChain: (t) => Ui(e, t),
|
|
4143
|
+
waitForCallsStatus: (t) => tr(e, t),
|
|
4144
|
+
watchAsset: (t) => Fi(e, t),
|
|
4145
|
+
writeContract: (t) => Dn(e, t),
|
|
4146
|
+
writeContractSync: (t) => Oi(e, t)
|
|
4106
4147
|
};
|
|
4107
4148
|
}
|
|
4108
|
-
function
|
|
4149
|
+
function Zi(e) {
|
|
4109
4150
|
const { key: t = "wallet", name: n = "Wallet Client", transport: r } = e;
|
|
4110
|
-
return
|
|
4151
|
+
return rr({
|
|
4111
4152
|
...e,
|
|
4112
4153
|
key: t,
|
|
4113
4154
|
name: n,
|
|
4114
4155
|
transport: r,
|
|
4115
4156
|
type: "walletClient"
|
|
4116
|
-
}).extend(
|
|
4157
|
+
}).extend(Di);
|
|
4117
4158
|
}
|
|
4118
|
-
function
|
|
4119
|
-
const
|
|
4159
|
+
function qi({ key: e, methods: t, name: n, request: r, retryCount: s = 3, retryDelay: a = 150, timeout: o, type: i }, c) {
|
|
4160
|
+
const d = nr();
|
|
4120
4161
|
return {
|
|
4121
4162
|
config: {
|
|
4122
4163
|
key: e,
|
|
@@ -4128,11 +4169,11 @@ function Oi({ key: e, methods: t, name: n, request: r, retryCount: s = 3, retryD
|
|
|
4128
4169
|
timeout: o,
|
|
4129
4170
|
type: i
|
|
4130
4171
|
},
|
|
4131
|
-
request:
|
|
4172
|
+
request: Sa(r, { methods: t, retryCount: s, retryDelay: a, uid: d }),
|
|
4132
4173
|
value: c
|
|
4133
4174
|
};
|
|
4134
4175
|
}
|
|
4135
|
-
class
|
|
4176
|
+
class Li extends _ {
|
|
4136
4177
|
constructor() {
|
|
4137
4178
|
super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.", {
|
|
4138
4179
|
docsPath: "/docs/clients/intro",
|
|
@@ -4140,51 +4181,51 @@ class Di extends $ {
|
|
|
4140
4181
|
});
|
|
4141
4182
|
}
|
|
4142
4183
|
}
|
|
4143
|
-
function
|
|
4144
|
-
const { batch: n, fetchFn: r, fetchOptions: s, key: a = "http", methods: o, name: i = "HTTP JSON-RPC", onFetchRequest: c, onFetchResponse:
|
|
4145
|
-
return ({ chain:
|
|
4146
|
-
const { batchSize: g = 1e3, wait: y = 0 } = typeof n == "object" ? n : {}, m = t.retryCount ?? h, b = p ?? t.timeout ?? 1e4, w = e ||
|
|
4184
|
+
function Ji(e, t = {}) {
|
|
4185
|
+
const { batch: n, fetchFn: r, fetchOptions: s, key: a = "http", methods: o, name: i = "HTTP JSON-RPC", onFetchRequest: c, onFetchResponse: d, retryDelay: u, raw: f } = t;
|
|
4186
|
+
return ({ chain: l, retryCount: h, timeout: p }) => {
|
|
4187
|
+
const { batchSize: g = 1e3, wait: y = 0 } = typeof n == "object" ? n : {}, m = t.retryCount ?? h, b = p ?? t.timeout ?? 1e4, w = e || l?.rpcUrls.default.http[0];
|
|
4147
4188
|
if (!w)
|
|
4148
|
-
throw new
|
|
4149
|
-
const
|
|
4189
|
+
throw new Li();
|
|
4190
|
+
const P = za(w, {
|
|
4150
4191
|
fetchFn: r,
|
|
4151
4192
|
fetchOptions: s,
|
|
4152
4193
|
onRequest: c,
|
|
4153
|
-
onResponse:
|
|
4194
|
+
onResponse: d,
|
|
4154
4195
|
timeout: b
|
|
4155
4196
|
});
|
|
4156
|
-
return
|
|
4197
|
+
return qi({
|
|
4157
4198
|
key: a,
|
|
4158
4199
|
methods: o,
|
|
4159
4200
|
name: i,
|
|
4160
|
-
async request({ method:
|
|
4161
|
-
const
|
|
4201
|
+
async request({ method: A, params: x }) {
|
|
4202
|
+
const v = { method: A, params: x }, { schedule: I } = xs({
|
|
4162
4203
|
id: w,
|
|
4163
4204
|
wait: y,
|
|
4164
|
-
shouldSplitBatch(
|
|
4165
|
-
return
|
|
4205
|
+
shouldSplitBatch(S) {
|
|
4206
|
+
return S.length > g;
|
|
4166
4207
|
},
|
|
4167
|
-
fn: (
|
|
4168
|
-
body:
|
|
4208
|
+
fn: (S) => P.request({
|
|
4209
|
+
body: S
|
|
4169
4210
|
}),
|
|
4170
|
-
sort: (
|
|
4171
|
-
}), N = async (
|
|
4172
|
-
await
|
|
4173
|
-
body:
|
|
4211
|
+
sort: (S, z) => S.id - z.id
|
|
4212
|
+
}), N = async (S) => n ? I(S) : [
|
|
4213
|
+
await P.request({
|
|
4214
|
+
body: S
|
|
4174
4215
|
})
|
|
4175
|
-
], [{ error:
|
|
4176
|
-
if (
|
|
4177
|
-
return { error:
|
|
4178
|
-
if (
|
|
4216
|
+
], [{ error: k, result: B }] = await N(v);
|
|
4217
|
+
if (f)
|
|
4218
|
+
return { error: k, result: B };
|
|
4219
|
+
if (k)
|
|
4179
4220
|
throw new Ts({
|
|
4180
|
-
body:
|
|
4181
|
-
error:
|
|
4221
|
+
body: v,
|
|
4222
|
+
error: k,
|
|
4182
4223
|
url: w
|
|
4183
4224
|
});
|
|
4184
|
-
return
|
|
4225
|
+
return B;
|
|
4185
4226
|
},
|
|
4186
4227
|
retryCount: m,
|
|
4187
|
-
retryDelay:
|
|
4228
|
+
retryDelay: u,
|
|
4188
4229
|
timeout: b,
|
|
4189
4230
|
type: "http"
|
|
4190
4231
|
}, {
|
|
@@ -4194,9 +4235,9 @@ function Gi(e, t = {}) {
|
|
|
4194
4235
|
};
|
|
4195
4236
|
}
|
|
4196
4237
|
export {
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4238
|
+
Gi as a,
|
|
4239
|
+
qi as b,
|
|
4240
|
+
Zi as c,
|
|
4241
|
+
Ji as h
|
|
4201
4242
|
};
|
|
4202
|
-
//# sourceMappingURL=http-
|
|
4243
|
+
//# sourceMappingURL=http-DfLfk9B5.js.map
|