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