multicoyn-sdk 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +212 -66
- package/dist/{ccip-Piyq8VMB.js → ccip-DIsMfc62.js} +1 -1
- package/dist/{ccip-DKvRoXP4.cjs → ccip-DpYR9KrU.cjs} +1 -1
- package/dist/components/PaymentModal.d.ts +1 -1
- package/dist/components/PaymentSummary.d.ts +1 -1
- package/dist/{index-w8B8C2nn.js → index-BqTi7WKI.js} +1200 -1178
- package/dist/{index-54Nnnds1.cjs → index-DqlG-QlC.cjs} +11 -11
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/multicoyn-sdk.css +1 -1
- package/package.json +1 -1
|
@@ -1,350 +1,10 @@
|
|
|
1
1
|
import { jsx as u, jsxs as w, Fragment as pr } from "react/jsx-runtime";
|
|
2
|
-
import { useState as V, useMemo as
|
|
2
|
+
import { useState as V, useMemo as mr, useEffect as ve, createContext as yr, useContext as br } from "react";
|
|
3
3
|
import { useWriteContract as wt, useWaitForTransactionReceipt as xt, useReadContract as j, useAccount as Ge, useConfig as hr, useBalance as gr, useConnect as wr, WagmiProvider as xr } from "wagmi";
|
|
4
4
|
import { createPortal as Tr } from "react-dom";
|
|
5
5
|
import { parseUnits as vr, maxUint256 as Er, formatUnits as Ce, defineChain as Pr } from "viem";
|
|
6
6
|
import { QueryClientProvider as Sr, QueryClient as Ar } from "@tanstack/react-query";
|
|
7
7
|
import { getDefaultConfig as $r, RainbowKitProvider as Cr } from "@rainbow-me/rainbowkit";
|
|
8
|
-
function Ir({ size: e = 26, className: t = "" }) {
|
|
9
|
-
return /* @__PURE__ */ u(
|
|
10
|
-
"svg",
|
|
11
|
-
{
|
|
12
|
-
width: e,
|
|
13
|
-
height: e,
|
|
14
|
-
viewBox: "0 0 26 26",
|
|
15
|
-
fill: "none",
|
|
16
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
17
|
-
className: t,
|
|
18
|
-
children: /* @__PURE__ */ u(
|
|
19
|
-
"path",
|
|
20
|
-
{
|
|
21
|
-
d: "M6.5 6.5L19.5 19.5M6.5 19.5L19.5 6.5",
|
|
22
|
-
stroke: "currentColor",
|
|
23
|
-
strokeWidth: "2.5",
|
|
24
|
-
strokeLinecap: "round",
|
|
25
|
-
strokeLinejoin: "round"
|
|
26
|
-
}
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
function kr({ size: e = 16, className: t = "" }) {
|
|
32
|
-
return /* @__PURE__ */ w(
|
|
33
|
-
"svg",
|
|
34
|
-
{
|
|
35
|
-
width: e,
|
|
36
|
-
height: e,
|
|
37
|
-
viewBox: "0 0 16 16",
|
|
38
|
-
fill: "none",
|
|
39
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
40
|
-
className: t,
|
|
41
|
-
children: [
|
|
42
|
-
/* @__PURE__ */ u(
|
|
43
|
-
"path",
|
|
44
|
-
{
|
|
45
|
-
d: "M7.33333 12.6667C10.2789 12.6667 12.6667 10.2789 12.6667 7.33333C12.6667 4.38781 10.2789 2 7.33333 2C4.38781 2 2 4.38781 2 7.33333C2 10.2789 4.38781 12.6667 7.33333 12.6667Z",
|
|
46
|
-
stroke: "currentColor",
|
|
47
|
-
strokeWidth: "1.5",
|
|
48
|
-
strokeLinecap: "round",
|
|
49
|
-
strokeLinejoin: "round"
|
|
50
|
-
}
|
|
51
|
-
),
|
|
52
|
-
/* @__PURE__ */ u(
|
|
53
|
-
"path",
|
|
54
|
-
{
|
|
55
|
-
d: "M14 14L11.1 11.1",
|
|
56
|
-
stroke: "currentColor",
|
|
57
|
-
strokeWidth: "1.5",
|
|
58
|
-
strokeLinecap: "round",
|
|
59
|
-
strokeLinejoin: "round"
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
function Nr({ size: e = 16, className: t = "" }) {
|
|
67
|
-
return /* @__PURE__ */ w(
|
|
68
|
-
"svg",
|
|
69
|
-
{
|
|
70
|
-
width: e,
|
|
71
|
-
height: e,
|
|
72
|
-
viewBox: "0 0 16 16",
|
|
73
|
-
fill: "none",
|
|
74
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
75
|
-
className: t,
|
|
76
|
-
children: [
|
|
77
|
-
/* @__PURE__ */ u(
|
|
78
|
-
"path",
|
|
79
|
-
{
|
|
80
|
-
d: "M8 14.6667C11.6819 14.6667 14.6667 11.6819 14.6667 8C14.6667 4.3181 11.6819 1.33333 8 1.33333C4.3181 1.33333 1.33333 4.3181 1.33333 8C1.33333 11.6819 4.3181 14.6667 8 14.6667Z",
|
|
81
|
-
stroke: "currentColor",
|
|
82
|
-
strokeWidth: "1.5",
|
|
83
|
-
strokeLinecap: "round",
|
|
84
|
-
strokeLinejoin: "round"
|
|
85
|
-
}
|
|
86
|
-
),
|
|
87
|
-
/* @__PURE__ */ u(
|
|
88
|
-
"path",
|
|
89
|
-
{
|
|
90
|
-
d: "M8 10.6667V8",
|
|
91
|
-
stroke: "currentColor",
|
|
92
|
-
strokeWidth: "1.5",
|
|
93
|
-
strokeLinecap: "round",
|
|
94
|
-
strokeLinejoin: "round"
|
|
95
|
-
}
|
|
96
|
-
),
|
|
97
|
-
/* @__PURE__ */ u(
|
|
98
|
-
"path",
|
|
99
|
-
{
|
|
100
|
-
d: "M8 5.33333H8.00667",
|
|
101
|
-
stroke: "currentColor",
|
|
102
|
-
strokeWidth: "1.5",
|
|
103
|
-
strokeLinecap: "round",
|
|
104
|
-
strokeLinejoin: "round"
|
|
105
|
-
}
|
|
106
|
-
)
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
function Rr({
|
|
112
|
-
size: e = 134,
|
|
113
|
-
className: t = ""
|
|
114
|
-
}) {
|
|
115
|
-
return /* @__PURE__ */ w(
|
|
116
|
-
"svg",
|
|
117
|
-
{
|
|
118
|
-
width: e,
|
|
119
|
-
height: e,
|
|
120
|
-
viewBox: "0 0 134 132",
|
|
121
|
-
fill: "none",
|
|
122
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
123
|
-
className: t,
|
|
124
|
-
children: [
|
|
125
|
-
/* @__PURE__ */ u("circle", { cx: "67", cy: "66", r: "55", fill: "#5EEAD4", fillOpacity: "0.2" }),
|
|
126
|
-
/* @__PURE__ */ u("circle", { cx: "67", cy: "66", r: "45", fill: "#5EEAD4", fillOpacity: "0.3" }),
|
|
127
|
-
/* @__PURE__ */ u("rect", { x: "35", y: "30", width: "45", height: "72", rx: "4", fill: "#14B8A6" }),
|
|
128
|
-
/* @__PURE__ */ u("rect", { x: "38", y: "35", width: "39", height: "55", rx: "2", fill: "#0D9488" }),
|
|
129
|
-
/* @__PURE__ */ w("g", { className: "animate-pulse", children: [
|
|
130
|
-
/* @__PURE__ */ u("rect", { x: "55", y: "50", width: "50", height: "32", rx: "3", fill: "#1E293B" }),
|
|
131
|
-
/* @__PURE__ */ u("rect", { x: "60", y: "56", width: "20", height: "3", rx: "1", fill: "#475569" }),
|
|
132
|
-
/* @__PURE__ */ u("rect", { x: "60", y: "62", width: "30", height: "2", rx: "1", fill: "#475569" }),
|
|
133
|
-
/* @__PURE__ */ u("rect", { x: "60", y: "68", width: "15", height: "2", rx: "1", fill: "#475569" })
|
|
134
|
-
] }),
|
|
135
|
-
/* @__PURE__ */ u("ellipse", { cx: "95", cy: "85", rx: "12", ry: "8", fill: "#FCD9BD" }),
|
|
136
|
-
/* @__PURE__ */ u("rect", { x: "88", y: "78", width: "8", height: "20", rx: "4", fill: "#FCD9BD" }),
|
|
137
|
-
/* @__PURE__ */ u("circle", { cx: "20", cy: "25", r: "8", fill: "#FCD34D" }),
|
|
138
|
-
/* @__PURE__ */ u("text", { x: "20", y: "29", textAnchor: "middle", fontSize: "10", fill: "#92400E", children: "$" }),
|
|
139
|
-
/* @__PURE__ */ u("circle", { cx: "115", cy: "35", r: "6", fill: "#FCD34D" }),
|
|
140
|
-
/* @__PURE__ */ u("text", { x: "115", y: "38", textAnchor: "middle", fontSize: "8", fill: "#92400E", children: "$" }),
|
|
141
|
-
/* @__PURE__ */ u("circle", { cx: "110", cy: "20", r: "5", fill: "#FCD34D", fillOpacity: "0.6" })
|
|
142
|
-
]
|
|
143
|
-
}
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
function Mr({ size: e = 95, className: t = "" }) {
|
|
147
|
-
return /* @__PURE__ */ w(
|
|
148
|
-
"svg",
|
|
149
|
-
{
|
|
150
|
-
width: e * 2.1,
|
|
151
|
-
height: e,
|
|
152
|
-
viewBox: "0 0 200 95",
|
|
153
|
-
fill: "none",
|
|
154
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
155
|
-
className: t,
|
|
156
|
-
children: [
|
|
157
|
-
/* @__PURE__ */ u("circle", { cx: "30", cy: "20", r: "3", fill: "#FCD34D" }),
|
|
158
|
-
/* @__PURE__ */ u("circle", { cx: "170", cy: "25", r: "4", fill: "#5EEAD4" }),
|
|
159
|
-
/* @__PURE__ */ u("circle", { cx: "25", cy: "70", r: "2", fill: "#A78BFA" }),
|
|
160
|
-
/* @__PURE__ */ u("circle", { cx: "175", cy: "65", r: "3", fill: "#F472B6" }),
|
|
161
|
-
/* @__PURE__ */ u("circle", { cx: "50", cy: "85", r: "2", fill: "#60A5FA" }),
|
|
162
|
-
/* @__PURE__ */ u("circle", { cx: "150", cy: "80", r: "2", fill: "#FCD34D" }),
|
|
163
|
-
/* @__PURE__ */ u("path", { d: "M45 30L46 33L49 33L47 35L48 38L45 36L42 38L43 35L41 33L44 33Z", fill: "#FCD34D" }),
|
|
164
|
-
/* @__PURE__ */ u("path", { d: "M160 45L161 47L163 47L161.5 48.5L162 51L160 49.5L158 51L158.5 48.5L157 47L159 47Z", fill: "#FCD34D" }),
|
|
165
|
-
/* @__PURE__ */ u("circle", { cx: "100", cy: "47", r: "35", fill: "url(#successGradient)" }),
|
|
166
|
-
/* @__PURE__ */ u("circle", { cx: "100", cy: "47", r: "30", fill: "#22C55E" }),
|
|
167
|
-
/* @__PURE__ */ u(
|
|
168
|
-
"path",
|
|
169
|
-
{
|
|
170
|
-
d: "M85 47L95 57L115 37",
|
|
171
|
-
stroke: "white",
|
|
172
|
-
strokeWidth: "5",
|
|
173
|
-
strokeLinecap: "round",
|
|
174
|
-
strokeLinejoin: "round"
|
|
175
|
-
}
|
|
176
|
-
),
|
|
177
|
-
/* @__PURE__ */ u("circle", { cx: "100", cy: "47", r: "38", stroke: "#22C55E", strokeWidth: "2", strokeOpacity: "0.3" }),
|
|
178
|
-
/* @__PURE__ */ u("circle", { cx: "100", cy: "47", r: "42", stroke: "#22C55E", strokeWidth: "1", strokeOpacity: "0.2" }),
|
|
179
|
-
/* @__PURE__ */ u("defs", { children: /* @__PURE__ */ w("linearGradient", { id: "successGradient", x1: "65", y1: "12", x2: "135", y2: "82", gradientUnits: "userSpaceOnUse", children: [
|
|
180
|
-
/* @__PURE__ */ u("stop", { stopColor: "#4ADE80" }),
|
|
181
|
-
/* @__PURE__ */ u("stop", { offset: "1", stopColor: "#16A34A" })
|
|
182
|
-
] }) })
|
|
183
|
-
]
|
|
184
|
-
}
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
const ho = 30, go = 3e-3, wo = 5, Dr = 8, Or = 10 ** Dr, xo = BigInt(
|
|
188
|
-
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
|
189
|
-
), F = {
|
|
190
|
-
ETH: { symbol: "ETH", decimals: 18, name: "Ether" },
|
|
191
|
-
USDC: { symbol: "USDC", decimals: 6, name: "USD Coin" },
|
|
192
|
-
USDT: { symbol: "USDT", decimals: 6, name: "Tether USD" },
|
|
193
|
-
DAI: { symbol: "DAI", decimals: 18, name: "Dai Stablecoin" },
|
|
194
|
-
WBTC: { symbol: "WBTC", decimals: 8, name: "Wrapped Bitcoin" },
|
|
195
|
-
IDRX: { symbol: "IDRX", decimals: 18, name: "Indonesian Rupiah" }
|
|
196
|
-
};
|
|
197
|
-
function Tt(e) {
|
|
198
|
-
if (!e) return "USDT";
|
|
199
|
-
switch (e.toUpperCase()) {
|
|
200
|
-
case "IDR":
|
|
201
|
-
return "IDRX";
|
|
202
|
-
case "USD":
|
|
203
|
-
return "USDT";
|
|
204
|
-
default:
|
|
205
|
-
return e.toUpperCase();
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
function me(e, t = 2) {
|
|
209
|
-
const n = e.toFixed(t), [r, s] = n.split("."), i = r.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
210
|
-
return s ? `${i}.${s}` : i;
|
|
211
|
-
}
|
|
212
|
-
function Br({
|
|
213
|
-
token: e,
|
|
214
|
-
onChange: t,
|
|
215
|
-
totalAmount: n,
|
|
216
|
-
displayAmount: r,
|
|
217
|
-
currency: s,
|
|
218
|
-
disabled: i = !1
|
|
219
|
-
}) {
|
|
220
|
-
const a = (h) => {
|
|
221
|
-
t(Number(h.target.value));
|
|
222
|
-
}, o = n * e.percentage / 100, c = e.priceUSD > 0 ? o / e.priceUSD : 0, d = c <= e.amount, l = e.priceUSD > 0, b = Tt(s), y = (r ?? n) * e.percentage / 100;
|
|
223
|
-
return /* @__PURE__ */ w("div", { className: "flex items-center gap-1.5 w-full", children: [
|
|
224
|
-
/* @__PURE__ */ w("div", { className: "flex items-center gap-3 w-35", children: [
|
|
225
|
-
/* @__PURE__ */ w("div", { className: "relative size-[30px]", children: [
|
|
226
|
-
/* @__PURE__ */ u(
|
|
227
|
-
"div",
|
|
228
|
-
{
|
|
229
|
-
className: `size-[30px] rounded-full bg-dark-4 overflow-hidden flex items-center justify-center ${l ? "" : "opacity-50"}`,
|
|
230
|
-
children: e.tokenIcon ? /* @__PURE__ */ u(
|
|
231
|
-
"img",
|
|
232
|
-
{
|
|
233
|
-
src: e.tokenIcon,
|
|
234
|
-
alt: e.name,
|
|
235
|
-
className: "size-full object-cover"
|
|
236
|
-
}
|
|
237
|
-
) : /* @__PURE__ */ u("span", { className: "text-xs font-semibold text-white", children: e.symbol.slice(0, 2) })
|
|
238
|
-
}
|
|
239
|
-
),
|
|
240
|
-
/* @__PURE__ */ u("div", { className: "absolute right-[-2px] bottom-[-2px] size-[12px] rounded-full bg-dark-3 border border-dark-2 overflow-hidden flex items-center justify-center", children: e.chainIcon ? /* @__PURE__ */ u(
|
|
241
|
-
"img",
|
|
242
|
-
{
|
|
243
|
-
src: e.chainIcon,
|
|
244
|
-
alt: e.chain,
|
|
245
|
-
className: "size-full object-cover"
|
|
246
|
-
}
|
|
247
|
-
) : /* @__PURE__ */ u("span", { className: "text-[6px] font-semibold text-white", children: e.chain.slice(0, 1) }) })
|
|
248
|
-
] }),
|
|
249
|
-
/* @__PURE__ */ w("div", { className: "flex flex-col gap-1 text-xs text-white", children: [
|
|
250
|
-
/* @__PURE__ */ u("span", { className: "font-semibold", children: e.name }),
|
|
251
|
-
/* @__PURE__ */ w("span", { className: "font-normal opacity-75", children: [
|
|
252
|
-
e.amount.toFixed(4),
|
|
253
|
-
" ",
|
|
254
|
-
e.symbol
|
|
255
|
-
] }),
|
|
256
|
-
/* @__PURE__ */ u(
|
|
257
|
-
"span",
|
|
258
|
-
{
|
|
259
|
-
className: `text-[10px] ${l ? "text-white/50" : "text-yellow-500"}`,
|
|
260
|
-
children: l ? `$${e.priceUSD.toFixed(2)}/${e.symbol}` : "Price loading..."
|
|
261
|
-
}
|
|
262
|
-
)
|
|
263
|
-
] })
|
|
264
|
-
] }),
|
|
265
|
-
/* @__PURE__ */ w("div", { className: `flex-1 relative h-1.5 ${i ? "opacity-50" : ""}`, children: [
|
|
266
|
-
/* @__PURE__ */ u("div", { className: "absolute inset-0 bg-white/40 rounded-full" }),
|
|
267
|
-
/* @__PURE__ */ u(
|
|
268
|
-
"div",
|
|
269
|
-
{
|
|
270
|
-
className: "absolute left-0 top-0 h-full bg-secondary rounded-full transition-all",
|
|
271
|
-
style: { width: `${e.percentage}%` }
|
|
272
|
-
}
|
|
273
|
-
),
|
|
274
|
-
/* @__PURE__ */ u(
|
|
275
|
-
"input",
|
|
276
|
-
{
|
|
277
|
-
type: "range",
|
|
278
|
-
min: "0",
|
|
279
|
-
max: "100",
|
|
280
|
-
value: e.percentage,
|
|
281
|
-
onChange: a,
|
|
282
|
-
className: `absolute inset-0 w-full h-full opacity-0 ${i ? "cursor-not-allowed" : "cursor-pointer"}`,
|
|
283
|
-
disabled: i || e.amount === 0 || !l
|
|
284
|
-
}
|
|
285
|
-
)
|
|
286
|
-
] }),
|
|
287
|
-
/* @__PURE__ */ w("div", { className: "flex flex-col items-end gap-0.5 min-w-25", children: [
|
|
288
|
-
/* @__PURE__ */ w("span", { className: "text-xs font-semibold text-white", children: [
|
|
289
|
-
e.percentage,
|
|
290
|
-
"% = ",
|
|
291
|
-
me(y),
|
|
292
|
-
" ",
|
|
293
|
-
b
|
|
294
|
-
] }),
|
|
295
|
-
e.percentage > 0 && /* @__PURE__ */ w(
|
|
296
|
-
"span",
|
|
297
|
-
{
|
|
298
|
-
className: `text-[10px] ${d ? "text-white/60" : "text-red-500"}`,
|
|
299
|
-
children: [
|
|
300
|
-
me(c, 4),
|
|
301
|
-
" ",
|
|
302
|
-
e.symbol,
|
|
303
|
-
!d && " ⚠️"
|
|
304
|
-
]
|
|
305
|
-
}
|
|
306
|
-
)
|
|
307
|
-
] })
|
|
308
|
-
] });
|
|
309
|
-
}
|
|
310
|
-
function Ur({ items: e, fee: t = 0.3, currency: n }) {
|
|
311
|
-
const s = e.reduce((a, o) => a + o.price, 0) + t, i = Tt(n);
|
|
312
|
-
return /* @__PURE__ */ w("div", { className: "bg-dark-4 rounded-md p-3 flex flex-col gap-3 w-full", children: [
|
|
313
|
-
/* @__PURE__ */ u("p", { className: "font-medium text-base text-white", children: "Payment Summary" }),
|
|
314
|
-
e.map((a, o) => /* @__PURE__ */ w(
|
|
315
|
-
"div",
|
|
316
|
-
{
|
|
317
|
-
className: "flex items-center justify-between text-xs text-white",
|
|
318
|
-
children: [
|
|
319
|
-
/* @__PURE__ */ u("span", { className: "flex-1", children: a.name }),
|
|
320
|
-
/* @__PURE__ */ w("span", { className: "text-right", children: [
|
|
321
|
-
me(a.price),
|
|
322
|
-
" ",
|
|
323
|
-
i
|
|
324
|
-
] })
|
|
325
|
-
]
|
|
326
|
-
},
|
|
327
|
-
o
|
|
328
|
-
)),
|
|
329
|
-
/* @__PURE__ */ w("div", { className: "flex items-center justify-between text-xs text-white", children: [
|
|
330
|
-
/* @__PURE__ */ u("span", { className: "flex-1", children: "Fee" }),
|
|
331
|
-
/* @__PURE__ */ w("span", { className: "text-right", children: [
|
|
332
|
-
me(t),
|
|
333
|
-
" ",
|
|
334
|
-
i
|
|
335
|
-
] })
|
|
336
|
-
] }),
|
|
337
|
-
/* @__PURE__ */ u("div", { className: "h-px bg-white/20" }),
|
|
338
|
-
/* @__PURE__ */ w("div", { className: "flex items-center justify-between text-white", children: [
|
|
339
|
-
/* @__PURE__ */ u("span", { className: "text-xs", children: "Total Payment" }),
|
|
340
|
-
/* @__PURE__ */ w("span", { className: "text-base font-semibold text-right", children: [
|
|
341
|
-
me(s),
|
|
342
|
-
" ",
|
|
343
|
-
i
|
|
344
|
-
] })
|
|
345
|
-
] })
|
|
346
|
-
] });
|
|
347
|
-
}
|
|
348
8
|
const O = {
|
|
349
9
|
PAYMENT_ROUTER: "0x73Dbc7447E3B097cFc8b08ee7896a9D27D67e2B4",
|
|
350
10
|
TOKEN_REGISTRY: "0x1d2C6dfB2f127d6F3c14859c9E54cbc27bd7FcCE"
|
|
@@ -357,7 +17,7 @@ const O = {
|
|
|
357
17
|
WBTC: "0x1BEC7ec7F995B9bcd93F411B2cE7d289C6b05f03",
|
|
358
18
|
// Settlement Tokens
|
|
359
19
|
IDRX: "0x39B9205cDC53114c0B0F22F04C1215A13197b4d9"
|
|
360
|
-
}, Lr = /* @__PURE__ */ JSON.parse('[{"inputs":[{"internalType":"address","name":"_tokenRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CashbackSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"CollectedTokensWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"EmergencyPoolWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"merchant","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MerchantSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"newMinimum","type":"uint256"}],"name":"MinimumPoolBalanceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"paymentId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"merchant","type":"address"},{"indexed":true,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalPaidUSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"productPriceUSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeUSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"excessUSD","type":"uint256"},{"indexed":false,"internalType":"bool","name":"settleInIDR","type":"bool"},{"indexed":false,"internalType":"uint256","name":"settlementAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cashbackAmount","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"bool","name":"externalCallSuccess","type":"bool"}],"name":"PaymentExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SettlementPoolFunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"idrx","type":"address"},{"indexed":true,"internalType":"address","name":"usdt","type":"address"}],"name":"SettlementTokensUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"FEE_BASIS_POINTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"IDRX_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_CASHBACK_USD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATIVE_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDT_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"calculateTotalValue","outputs":[{"internalType":"uint256","name":"totalUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculateUSDValue","outputs":[{"internalType":"uint256","name":"usdValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"collectedBalances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emergencyWithdrawPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"fundSettlementPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getCollectedBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"paymentId","type":"bytes32"}],"name":"getPayment","outputs":[{"components":[{"internalType":"address","name":"merchant","type":"address"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"uint256","name":"totalPaidUSD","type":"uint256"},{"internalType":"uint256","name":"productPriceUSD","type":"uint256"},{"internalType":"uint256","name":"feeUSD","type":"uint256"},{"internalType":"uint256","name":"excessUSD","type":"uint256"},{"internalType":"bool","name":"settleInIDR","type":"bool"},{"internalType":"uint256","name":"settlementAmount","type":"uint256"},{"internalType":"uint256","name":"cashbackAmount","type":"uint256"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct IPaymentRouter.Payment","name":"payment","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getSettlementPoolBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"minimumPoolBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"merchantAddress","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"productPriceUSD","type":"uint256"},{"internalType":"bool","name":"settleInIDR","type":"bool"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"name":"pay","outputs":[{"internalType":"bytes32","name":"paymentId","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minimum","type":"uint256"}],"name":"setMinimumPoolBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_idrx","type":"address"},{"internalType":"address","name":"_usdt","type":"address"}],"name":"setSettlementTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"settlementPools","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenRegistry","outputs":[{"internalType":"contract ITokenRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"expectedUSD","type":"uint256"}],"name":"validatePayment","outputs":[{"internalType":"bool","name":"valid","type":"bool"},{"internalType":"uint256","name":"actualUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawCollectedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]'), Fr = [
|
|
20
|
+
}, kr = /* @__PURE__ */ JSON.parse('[{"inputs":[{"internalType":"address","name":"_tokenRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CashbackSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"CollectedTokensWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"EmergencyPoolWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"merchant","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MerchantSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"newMinimum","type":"uint256"}],"name":"MinimumPoolBalanceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"paymentId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"merchant","type":"address"},{"indexed":true,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalPaidUSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"productPriceUSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeUSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"excessUSD","type":"uint256"},{"indexed":false,"internalType":"bool","name":"settleInIDR","type":"bool"},{"indexed":false,"internalType":"uint256","name":"settlementAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cashbackAmount","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"bool","name":"externalCallSuccess","type":"bool"}],"name":"PaymentExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SettlementPoolFunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"idrx","type":"address"},{"indexed":true,"internalType":"address","name":"usdt","type":"address"}],"name":"SettlementTokensUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"FEE_BASIS_POINTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"IDRX_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_CASHBACK_USD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATIVE_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDT_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"calculateTotalValue","outputs":[{"internalType":"uint256","name":"totalUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculateUSDValue","outputs":[{"internalType":"uint256","name":"usdValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"collectedBalances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emergencyWithdrawPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"fundSettlementPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getCollectedBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"paymentId","type":"bytes32"}],"name":"getPayment","outputs":[{"components":[{"internalType":"address","name":"merchant","type":"address"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"uint256","name":"totalPaidUSD","type":"uint256"},{"internalType":"uint256","name":"productPriceUSD","type":"uint256"},{"internalType":"uint256","name":"feeUSD","type":"uint256"},{"internalType":"uint256","name":"excessUSD","type":"uint256"},{"internalType":"bool","name":"settleInIDR","type":"bool"},{"internalType":"uint256","name":"settlementAmount","type":"uint256"},{"internalType":"uint256","name":"cashbackAmount","type":"uint256"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct IPaymentRouter.Payment","name":"payment","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getSettlementPoolBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"minimumPoolBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"merchantAddress","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"productPriceUSD","type":"uint256"},{"internalType":"bool","name":"settleInIDR","type":"bool"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"name":"pay","outputs":[{"internalType":"bytes32","name":"paymentId","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minimum","type":"uint256"}],"name":"setMinimumPoolBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_idrx","type":"address"},{"internalType":"address","name":"_usdt","type":"address"}],"name":"setSettlementTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"settlementPools","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenRegistry","outputs":[{"internalType":"contract ITokenRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"expectedUSD","type":"uint256"}],"name":"validatePayment","outputs":[{"internalType":"bool","name":"valid","type":"bool"},{"internalType":"uint256","name":"actualUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawCollectedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]'), Ir = [
|
|
361
21
|
{
|
|
362
22
|
inputs: [],
|
|
363
23
|
stateMutability: "nonpayable",
|
|
@@ -839,7 +499,7 @@ const O = {
|
|
|
839
499
|
stateMutability: "nonpayable",
|
|
840
500
|
type: "function"
|
|
841
501
|
}
|
|
842
|
-
],
|
|
502
|
+
], Nr = [
|
|
843
503
|
{
|
|
844
504
|
inputs: [],
|
|
845
505
|
stateMutability: "nonpayable",
|
|
@@ -1248,113 +908,463 @@ const O = {
|
|
|
1248
908
|
{
|
|
1249
909
|
inputs: [
|
|
1250
910
|
{
|
|
1251
|
-
internalType: "address",
|
|
1252
|
-
name: "newOwner",
|
|
1253
|
-
type: "address"
|
|
911
|
+
internalType: "address",
|
|
912
|
+
name: "newOwner",
|
|
913
|
+
type: "address"
|
|
914
|
+
}
|
|
915
|
+
],
|
|
916
|
+
name: "transferOwnership",
|
|
917
|
+
outputs: [],
|
|
918
|
+
stateMutability: "nonpayable",
|
|
919
|
+
type: "function"
|
|
920
|
+
}
|
|
921
|
+
], De = kr, Z = Ir, te = Nr;
|
|
922
|
+
function Tt() {
|
|
923
|
+
const { writeContract: e, data: t, isPending: n, error: r } = wt(), { isLoading: s, isSuccess: a } = xt({
|
|
924
|
+
hash: t
|
|
925
|
+
});
|
|
926
|
+
return {
|
|
927
|
+
// Write functions
|
|
928
|
+
registerToken: (b, x, S, N) => {
|
|
929
|
+
e({
|
|
930
|
+
address: O.TOKEN_REGISTRY,
|
|
931
|
+
abi: Z,
|
|
932
|
+
functionName: "registerToken",
|
|
933
|
+
args: [b, x, S, N]
|
|
934
|
+
});
|
|
935
|
+
},
|
|
936
|
+
setTokenEnabled: (b, x) => {
|
|
937
|
+
e({
|
|
938
|
+
address: O.TOKEN_REGISTRY,
|
|
939
|
+
abi: Z,
|
|
940
|
+
functionName: "setTokenEnabled",
|
|
941
|
+
args: [b, x]
|
|
942
|
+
});
|
|
943
|
+
},
|
|
944
|
+
updatePriceFeed: (b, x) => {
|
|
945
|
+
e({
|
|
946
|
+
address: O.TOKEN_REGISTRY,
|
|
947
|
+
abi: Z,
|
|
948
|
+
functionName: "updatePriceFeed",
|
|
949
|
+
args: [b, x]
|
|
950
|
+
});
|
|
951
|
+
},
|
|
952
|
+
setMinPaymentAmount: (b, x) => {
|
|
953
|
+
e({
|
|
954
|
+
address: O.TOKEN_REGISTRY,
|
|
955
|
+
abi: Z,
|
|
956
|
+
functionName: "setMinPaymentAmount",
|
|
957
|
+
args: [b, x]
|
|
958
|
+
});
|
|
959
|
+
},
|
|
960
|
+
grantRole: (b, x) => {
|
|
961
|
+
e({
|
|
962
|
+
address: O.TOKEN_REGISTRY,
|
|
963
|
+
abi: Z,
|
|
964
|
+
functionName: "grantRole",
|
|
965
|
+
args: [b, x]
|
|
966
|
+
});
|
|
967
|
+
},
|
|
968
|
+
revokeRole: (b, x) => {
|
|
969
|
+
e({
|
|
970
|
+
address: O.TOKEN_REGISTRY,
|
|
971
|
+
abi: Z,
|
|
972
|
+
functionName: "revokeRole",
|
|
973
|
+
args: [b, x]
|
|
974
|
+
});
|
|
975
|
+
},
|
|
976
|
+
// Read hooks
|
|
977
|
+
useGetTokenConfig: (b) => j({
|
|
978
|
+
address: O.TOKEN_REGISTRY,
|
|
979
|
+
abi: Z,
|
|
980
|
+
functionName: "getTokenConfig",
|
|
981
|
+
args: [b]
|
|
982
|
+
}),
|
|
983
|
+
useGetTokenPrice: (b) => j({
|
|
984
|
+
address: O.TOKEN_REGISTRY,
|
|
985
|
+
abi: Z,
|
|
986
|
+
functionName: "getTokenPriceUSD",
|
|
987
|
+
args: [b]
|
|
988
|
+
}),
|
|
989
|
+
useGetRegisteredTokens: () => j({
|
|
990
|
+
address: O.TOKEN_REGISTRY,
|
|
991
|
+
abi: Z,
|
|
992
|
+
functionName: "getRegisteredTokens"
|
|
993
|
+
}),
|
|
994
|
+
useGetRegisteredTokenCount: () => j({
|
|
995
|
+
address: O.TOKEN_REGISTRY,
|
|
996
|
+
abi: Z,
|
|
997
|
+
functionName: "getRegisteredTokenCount"
|
|
998
|
+
}),
|
|
999
|
+
useIsTokenEnabled: (b) => j({
|
|
1000
|
+
address: O.TOKEN_REGISTRY,
|
|
1001
|
+
abi: Z,
|
|
1002
|
+
functionName: "isTokenEnabled",
|
|
1003
|
+
args: [b]
|
|
1004
|
+
}),
|
|
1005
|
+
useHasRole: (b, x) => j({
|
|
1006
|
+
address: O.TOKEN_REGISTRY,
|
|
1007
|
+
abi: Z,
|
|
1008
|
+
functionName: "hasRole",
|
|
1009
|
+
args: [b, x]
|
|
1010
|
+
}),
|
|
1011
|
+
// Transaction state
|
|
1012
|
+
hash: t,
|
|
1013
|
+
isPending: n,
|
|
1014
|
+
isConfirming: s,
|
|
1015
|
+
isConfirmed: a,
|
|
1016
|
+
error: r
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
const ho = 30, go = 3e-3, wo = 5, Rr = 8, Mr = 10 ** Rr, xo = BigInt(
|
|
1020
|
+
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
|
1021
|
+
), F = {
|
|
1022
|
+
ETH: { symbol: "ETH", decimals: 18, name: "Ether" },
|
|
1023
|
+
USDC: { symbol: "USDC", decimals: 6, name: "USD Coin" },
|
|
1024
|
+
USDT: { symbol: "USDT", decimals: 6, name: "Tether USD" },
|
|
1025
|
+
DAI: { symbol: "DAI", decimals: 18, name: "Dai Stablecoin" },
|
|
1026
|
+
WBTC: { symbol: "WBTC", decimals: 8, name: "Wrapped Bitcoin" },
|
|
1027
|
+
IDRX: { symbol: "IDRX", decimals: 18, name: "Indonesian Rupiah" }
|
|
1028
|
+
};
|
|
1029
|
+
function vt(e) {
|
|
1030
|
+
if (!e) return "USDT";
|
|
1031
|
+
switch (e.toUpperCase()) {
|
|
1032
|
+
case "IDR":
|
|
1033
|
+
return "IDRX";
|
|
1034
|
+
case "USD":
|
|
1035
|
+
return "USDT";
|
|
1036
|
+
default:
|
|
1037
|
+
return e.toUpperCase();
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
function be(e, t = 2) {
|
|
1041
|
+
const n = e.toFixed(t), [r, s] = n.split("."), a = r.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
1042
|
+
return s ? `${a}.${s}` : a;
|
|
1043
|
+
}
|
|
1044
|
+
function Dr({ size: e = 26, className: t = "" }) {
|
|
1045
|
+
return /* @__PURE__ */ u(
|
|
1046
|
+
"svg",
|
|
1047
|
+
{
|
|
1048
|
+
width: e,
|
|
1049
|
+
height: e,
|
|
1050
|
+
viewBox: "0 0 26 26",
|
|
1051
|
+
fill: "none",
|
|
1052
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1053
|
+
className: t,
|
|
1054
|
+
children: /* @__PURE__ */ u(
|
|
1055
|
+
"path",
|
|
1056
|
+
{
|
|
1057
|
+
d: "M6.5 6.5L19.5 19.5M6.5 19.5L19.5 6.5",
|
|
1058
|
+
stroke: "currentColor",
|
|
1059
|
+
strokeWidth: "2.5",
|
|
1060
|
+
strokeLinecap: "round",
|
|
1061
|
+
strokeLinejoin: "round"
|
|
1062
|
+
}
|
|
1063
|
+
)
|
|
1064
|
+
}
|
|
1065
|
+
);
|
|
1066
|
+
}
|
|
1067
|
+
function Or({ size: e = 16, className: t = "" }) {
|
|
1068
|
+
return /* @__PURE__ */ w(
|
|
1069
|
+
"svg",
|
|
1070
|
+
{
|
|
1071
|
+
width: e,
|
|
1072
|
+
height: e,
|
|
1073
|
+
viewBox: "0 0 16 16",
|
|
1074
|
+
fill: "none",
|
|
1075
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1076
|
+
className: t,
|
|
1077
|
+
children: [
|
|
1078
|
+
/* @__PURE__ */ u(
|
|
1079
|
+
"path",
|
|
1080
|
+
{
|
|
1081
|
+
d: "M7.33333 12.6667C10.2789 12.6667 12.6667 10.2789 12.6667 7.33333C12.6667 4.38781 10.2789 2 7.33333 2C4.38781 2 2 4.38781 2 7.33333C2 10.2789 4.38781 12.6667 7.33333 12.6667Z",
|
|
1082
|
+
stroke: "currentColor",
|
|
1083
|
+
strokeWidth: "1.5",
|
|
1084
|
+
strokeLinecap: "round",
|
|
1085
|
+
strokeLinejoin: "round"
|
|
1086
|
+
}
|
|
1087
|
+
),
|
|
1088
|
+
/* @__PURE__ */ u(
|
|
1089
|
+
"path",
|
|
1090
|
+
{
|
|
1091
|
+
d: "M14 14L11.1 11.1",
|
|
1092
|
+
stroke: "currentColor",
|
|
1093
|
+
strokeWidth: "1.5",
|
|
1094
|
+
strokeLinecap: "round",
|
|
1095
|
+
strokeLinejoin: "round"
|
|
1096
|
+
}
|
|
1097
|
+
)
|
|
1098
|
+
]
|
|
1099
|
+
}
|
|
1100
|
+
);
|
|
1101
|
+
}
|
|
1102
|
+
function Br({ size: e = 16, className: t = "" }) {
|
|
1103
|
+
return /* @__PURE__ */ w(
|
|
1104
|
+
"svg",
|
|
1105
|
+
{
|
|
1106
|
+
width: e,
|
|
1107
|
+
height: e,
|
|
1108
|
+
viewBox: "0 0 16 16",
|
|
1109
|
+
fill: "none",
|
|
1110
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1111
|
+
className: t,
|
|
1112
|
+
children: [
|
|
1113
|
+
/* @__PURE__ */ u(
|
|
1114
|
+
"path",
|
|
1115
|
+
{
|
|
1116
|
+
d: "M8 14.6667C11.6819 14.6667 14.6667 11.6819 14.6667 8C14.6667 4.3181 11.6819 1.33333 8 1.33333C4.3181 1.33333 1.33333 4.3181 1.33333 8C1.33333 11.6819 4.3181 14.6667 8 14.6667Z",
|
|
1117
|
+
stroke: "currentColor",
|
|
1118
|
+
strokeWidth: "1.5",
|
|
1119
|
+
strokeLinecap: "round",
|
|
1120
|
+
strokeLinejoin: "round"
|
|
1121
|
+
}
|
|
1122
|
+
),
|
|
1123
|
+
/* @__PURE__ */ u(
|
|
1124
|
+
"path",
|
|
1125
|
+
{
|
|
1126
|
+
d: "M8 10.6667V8",
|
|
1127
|
+
stroke: "currentColor",
|
|
1128
|
+
strokeWidth: "1.5",
|
|
1129
|
+
strokeLinecap: "round",
|
|
1130
|
+
strokeLinejoin: "round"
|
|
1131
|
+
}
|
|
1132
|
+
),
|
|
1133
|
+
/* @__PURE__ */ u(
|
|
1134
|
+
"path",
|
|
1135
|
+
{
|
|
1136
|
+
d: "M8 5.33333H8.00667",
|
|
1137
|
+
stroke: "currentColor",
|
|
1138
|
+
strokeWidth: "1.5",
|
|
1139
|
+
strokeLinecap: "round",
|
|
1140
|
+
strokeLinejoin: "round"
|
|
1141
|
+
}
|
|
1142
|
+
)
|
|
1143
|
+
]
|
|
1144
|
+
}
|
|
1145
|
+
);
|
|
1146
|
+
}
|
|
1147
|
+
function Ur({
|
|
1148
|
+
size: e = 134,
|
|
1149
|
+
className: t = ""
|
|
1150
|
+
}) {
|
|
1151
|
+
return /* @__PURE__ */ w(
|
|
1152
|
+
"svg",
|
|
1153
|
+
{
|
|
1154
|
+
width: e,
|
|
1155
|
+
height: e,
|
|
1156
|
+
viewBox: "0 0 134 132",
|
|
1157
|
+
fill: "none",
|
|
1158
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1159
|
+
className: t,
|
|
1160
|
+
children: [
|
|
1161
|
+
/* @__PURE__ */ u("circle", { cx: "67", cy: "66", r: "55", fill: "#5EEAD4", fillOpacity: "0.2" }),
|
|
1162
|
+
/* @__PURE__ */ u("circle", { cx: "67", cy: "66", r: "45", fill: "#5EEAD4", fillOpacity: "0.3" }),
|
|
1163
|
+
/* @__PURE__ */ u("rect", { x: "35", y: "30", width: "45", height: "72", rx: "4", fill: "#14B8A6" }),
|
|
1164
|
+
/* @__PURE__ */ u("rect", { x: "38", y: "35", width: "39", height: "55", rx: "2", fill: "#0D9488" }),
|
|
1165
|
+
/* @__PURE__ */ w("g", { className: "animate-pulse", children: [
|
|
1166
|
+
/* @__PURE__ */ u("rect", { x: "55", y: "50", width: "50", height: "32", rx: "3", fill: "#1E293B" }),
|
|
1167
|
+
/* @__PURE__ */ u("rect", { x: "60", y: "56", width: "20", height: "3", rx: "1", fill: "#475569" }),
|
|
1168
|
+
/* @__PURE__ */ u("rect", { x: "60", y: "62", width: "30", height: "2", rx: "1", fill: "#475569" }),
|
|
1169
|
+
/* @__PURE__ */ u("rect", { x: "60", y: "68", width: "15", height: "2", rx: "1", fill: "#475569" })
|
|
1170
|
+
] }),
|
|
1171
|
+
/* @__PURE__ */ u("ellipse", { cx: "95", cy: "85", rx: "12", ry: "8", fill: "#FCD9BD" }),
|
|
1172
|
+
/* @__PURE__ */ u("rect", { x: "88", y: "78", width: "8", height: "20", rx: "4", fill: "#FCD9BD" }),
|
|
1173
|
+
/* @__PURE__ */ u("circle", { cx: "20", cy: "25", r: "8", fill: "#FCD34D" }),
|
|
1174
|
+
/* @__PURE__ */ u("text", { x: "20", y: "29", textAnchor: "middle", fontSize: "10", fill: "#92400E", children: "$" }),
|
|
1175
|
+
/* @__PURE__ */ u("circle", { cx: "115", cy: "35", r: "6", fill: "#FCD34D" }),
|
|
1176
|
+
/* @__PURE__ */ u("text", { x: "115", y: "38", textAnchor: "middle", fontSize: "8", fill: "#92400E", children: "$" }),
|
|
1177
|
+
/* @__PURE__ */ u("circle", { cx: "110", cy: "20", r: "5", fill: "#FCD34D", fillOpacity: "0.6" })
|
|
1178
|
+
]
|
|
1179
|
+
}
|
|
1180
|
+
);
|
|
1181
|
+
}
|
|
1182
|
+
function Lr({ size: e = 95, className: t = "" }) {
|
|
1183
|
+
return /* @__PURE__ */ w(
|
|
1184
|
+
"svg",
|
|
1185
|
+
{
|
|
1186
|
+
width: e * 2.1,
|
|
1187
|
+
height: e,
|
|
1188
|
+
viewBox: "0 0 200 95",
|
|
1189
|
+
fill: "none",
|
|
1190
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1191
|
+
className: t,
|
|
1192
|
+
children: [
|
|
1193
|
+
/* @__PURE__ */ u("circle", { cx: "30", cy: "20", r: "3", fill: "#FCD34D" }),
|
|
1194
|
+
/* @__PURE__ */ u("circle", { cx: "170", cy: "25", r: "4", fill: "#5EEAD4" }),
|
|
1195
|
+
/* @__PURE__ */ u("circle", { cx: "25", cy: "70", r: "2", fill: "#A78BFA" }),
|
|
1196
|
+
/* @__PURE__ */ u("circle", { cx: "175", cy: "65", r: "3", fill: "#F472B6" }),
|
|
1197
|
+
/* @__PURE__ */ u("circle", { cx: "50", cy: "85", r: "2", fill: "#60A5FA" }),
|
|
1198
|
+
/* @__PURE__ */ u("circle", { cx: "150", cy: "80", r: "2", fill: "#FCD34D" }),
|
|
1199
|
+
/* @__PURE__ */ u("path", { d: "M45 30L46 33L49 33L47 35L48 38L45 36L42 38L43 35L41 33L44 33Z", fill: "#FCD34D" }),
|
|
1200
|
+
/* @__PURE__ */ u("path", { d: "M160 45L161 47L163 47L161.5 48.5L162 51L160 49.5L158 51L158.5 48.5L157 47L159 47Z", fill: "#FCD34D" }),
|
|
1201
|
+
/* @__PURE__ */ u("circle", { cx: "100", cy: "47", r: "35", fill: "url(#successGradient)" }),
|
|
1202
|
+
/* @__PURE__ */ u("circle", { cx: "100", cy: "47", r: "30", fill: "#22C55E" }),
|
|
1203
|
+
/* @__PURE__ */ u(
|
|
1204
|
+
"path",
|
|
1205
|
+
{
|
|
1206
|
+
d: "M85 47L95 57L115 37",
|
|
1207
|
+
stroke: "white",
|
|
1208
|
+
strokeWidth: "5",
|
|
1209
|
+
strokeLinecap: "round",
|
|
1210
|
+
strokeLinejoin: "round"
|
|
1211
|
+
}
|
|
1212
|
+
),
|
|
1213
|
+
/* @__PURE__ */ u("circle", { cx: "100", cy: "47", r: "38", stroke: "#22C55E", strokeWidth: "2", strokeOpacity: "0.3" }),
|
|
1214
|
+
/* @__PURE__ */ u("circle", { cx: "100", cy: "47", r: "42", stroke: "#22C55E", strokeWidth: "1", strokeOpacity: "0.2" }),
|
|
1215
|
+
/* @__PURE__ */ u("defs", { children: /* @__PURE__ */ w("linearGradient", { id: "successGradient", x1: "65", y1: "12", x2: "135", y2: "82", gradientUnits: "userSpaceOnUse", children: [
|
|
1216
|
+
/* @__PURE__ */ u("stop", { stopColor: "#4ADE80" }),
|
|
1217
|
+
/* @__PURE__ */ u("stop", { offset: "1", stopColor: "#16A34A" })
|
|
1218
|
+
] }) })
|
|
1219
|
+
]
|
|
1220
|
+
}
|
|
1221
|
+
);
|
|
1222
|
+
}
|
|
1223
|
+
function Fr({
|
|
1224
|
+
items: e,
|
|
1225
|
+
fee: t = 0.3,
|
|
1226
|
+
currency: n
|
|
1227
|
+
}) {
|
|
1228
|
+
const s = e.reduce((i, o) => i + o.price, 0) + t, a = vt(n);
|
|
1229
|
+
return /* @__PURE__ */ w("div", { className: "mc:bg-dark-4 mc:rounded-md mc:p-3 mc:flex mc:flex-col mc:gap-3 mc:w-full", children: [
|
|
1230
|
+
/* @__PURE__ */ u("p", { className: "mc:font-medium mc:text-sm mc:sm:text-base mc:text-white mc:break-words", children: "Payment Summary" }),
|
|
1231
|
+
e.map((i, o) => /* @__PURE__ */ w(
|
|
1232
|
+
"div",
|
|
1233
|
+
{
|
|
1234
|
+
className: "mc:flex mc:items-center mc:justify-between mc:text-xs mc:text-white mc:gap-2",
|
|
1235
|
+
children: [
|
|
1236
|
+
/* @__PURE__ */ u("span", { className: "mc:flex-1 mc:min-w-0 mc:break-words", children: i.name }),
|
|
1237
|
+
/* @__PURE__ */ w("span", { className: "mc:text-right mc:flex-shrink-0", children: [
|
|
1238
|
+
be(i.price),
|
|
1239
|
+
" ",
|
|
1240
|
+
a
|
|
1241
|
+
] })
|
|
1242
|
+
]
|
|
1243
|
+
},
|
|
1244
|
+
o
|
|
1245
|
+
)),
|
|
1246
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:justify-between mc:text-xs mc:text-white mc:gap-2", children: [
|
|
1247
|
+
/* @__PURE__ */ u("span", { className: "mc:flex-1", children: "Fee" }),
|
|
1248
|
+
/* @__PURE__ */ w("span", { className: "mc:text-right mc:flex-shrink-0", children: [
|
|
1249
|
+
be(t),
|
|
1250
|
+
" ",
|
|
1251
|
+
a
|
|
1252
|
+
] })
|
|
1253
|
+
] }),
|
|
1254
|
+
/* @__PURE__ */ u("div", { className: "mc:h-px mc:bg-white/20" }),
|
|
1255
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:justify-between mc:text-white mc:gap-2", children: [
|
|
1256
|
+
/* @__PURE__ */ u("span", { className: "mc:text-xs", children: "Total Payment" }),
|
|
1257
|
+
/* @__PURE__ */ w("span", { className: "mc:text-sm mc:sm:text-base mc:font-semibold mc:text-right mc:break-words", children: [
|
|
1258
|
+
be(s),
|
|
1259
|
+
" ",
|
|
1260
|
+
a
|
|
1261
|
+
] })
|
|
1262
|
+
] })
|
|
1263
|
+
] });
|
|
1264
|
+
}
|
|
1265
|
+
function jr({
|
|
1266
|
+
token: e,
|
|
1267
|
+
onChange: t,
|
|
1268
|
+
totalAmount: n,
|
|
1269
|
+
displayAmount: r,
|
|
1270
|
+
currency: s,
|
|
1271
|
+
disabled: a = !1
|
|
1272
|
+
}) {
|
|
1273
|
+
const i = (h) => {
|
|
1274
|
+
t(Number(h.target.value));
|
|
1275
|
+
}, o = n * e.percentage / 100, c = e.priceUSD > 0 ? o / e.priceUSD : 0, d = c <= e.amount, l = e.priceUSD > 0, y = vt(s), m = (r ?? n) * e.percentage / 100;
|
|
1276
|
+
return /* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:gap-1.5 mc:sm:gap-2 mc:w-full mc:flex-wrap", children: [
|
|
1277
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:gap-2 mc:sm:gap-3 mc:min-w-0 mc:flex-1 mc:sm:flex-initial", children: [
|
|
1278
|
+
/* @__PURE__ */ w("div", { className: "mc:relative mc:size-[30px] mc:shrink-0", children: [
|
|
1279
|
+
/* @__PURE__ */ u(
|
|
1280
|
+
"div",
|
|
1281
|
+
{
|
|
1282
|
+
className: `mc:size-[30px] mc:rounded-full mc:bg-dark-4 mc:overflow-hidden mc:flex mc:items-center mc:justify-center ${l ? "" : "mc:opacity-50"}`,
|
|
1283
|
+
children: e.tokenIcon ? /* @__PURE__ */ u(
|
|
1284
|
+
"img",
|
|
1285
|
+
{
|
|
1286
|
+
src: e.tokenIcon,
|
|
1287
|
+
alt: e.name,
|
|
1288
|
+
className: "mc:size-full mc:object-cover"
|
|
1289
|
+
}
|
|
1290
|
+
) : /* @__PURE__ */ u("span", { className: "mc:text-xs mc:font-semibold mc:text-white", children: e.symbol.slice(0, 2) })
|
|
1291
|
+
}
|
|
1292
|
+
),
|
|
1293
|
+
/* @__PURE__ */ u("div", { className: "mc:absolute mc:right-[-2px] mc:bottom-[-2px] mc:size-[12px] mc:rounded-full mc:bg-dark-3 mc:border mc:border-dark-2 mc:overflow-hidden mc:flex mc:items-center mc:justify-center", children: e.chainIcon ? /* @__PURE__ */ u(
|
|
1294
|
+
"img",
|
|
1295
|
+
{
|
|
1296
|
+
src: e.chainIcon,
|
|
1297
|
+
alt: e.chain,
|
|
1298
|
+
className: "mc:size-full mc:object-cover"
|
|
1299
|
+
}
|
|
1300
|
+
) : /* @__PURE__ */ u("span", { className: "mc:text-[6px] mc:font-semibold mc:text-white", children: e.chain.slice(0, 1) }) })
|
|
1301
|
+
] }),
|
|
1302
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:flex-col mc:gap-1 mc:text-xs mc:text-white mc:min-w-0", children: [
|
|
1303
|
+
/* @__PURE__ */ u("span", { className: "mc:font-semibold mc:wrap-break-word", children: e.name }),
|
|
1304
|
+
/* @__PURE__ */ w("span", { className: "mc:font-normal mc:opacity-75 mc:wrap-break-word", children: [
|
|
1305
|
+
e.amount.toFixed(4),
|
|
1306
|
+
" ",
|
|
1307
|
+
e.symbol
|
|
1308
|
+
] }),
|
|
1309
|
+
/* @__PURE__ */ u(
|
|
1310
|
+
"span",
|
|
1311
|
+
{
|
|
1312
|
+
className: `mc:text-[10px] mc:wrap-break-word ${l ? "mc:text-white/50" : "mc:text-yellow-500"}`,
|
|
1313
|
+
children: l ? `$${e.priceUSD.toFixed(2)}/${e.symbol}` : "Price loading..."
|
|
1314
|
+
}
|
|
1315
|
+
)
|
|
1316
|
+
] })
|
|
1317
|
+
] }),
|
|
1318
|
+
/* @__PURE__ */ w(
|
|
1319
|
+
"div",
|
|
1320
|
+
{
|
|
1321
|
+
className: `mc:flex-1 mc:relative mc:h-1.5 mc:min-w-[100px] ${a ? "mc:opacity-50" : ""}`,
|
|
1322
|
+
children: [
|
|
1323
|
+
/* @__PURE__ */ u("div", { className: "mc:absolute mc:inset-0 mc:bg-white/40 mc:rounded-full" }),
|
|
1324
|
+
/* @__PURE__ */ u(
|
|
1325
|
+
"div",
|
|
1326
|
+
{
|
|
1327
|
+
className: "mc:absolute mc:left-0 mc:top-0 mc:h-full mc:bg-secondary mc:rounded-full mc:transition-all",
|
|
1328
|
+
style: { width: `${e.percentage}%` }
|
|
1329
|
+
}
|
|
1330
|
+
),
|
|
1331
|
+
/* @__PURE__ */ u(
|
|
1332
|
+
"input",
|
|
1333
|
+
{
|
|
1334
|
+
type: "range",
|
|
1335
|
+
min: "0",
|
|
1336
|
+
max: "100",
|
|
1337
|
+
value: e.percentage,
|
|
1338
|
+
onChange: i,
|
|
1339
|
+
className: `mc:absolute mc:inset-0 mc:w-full mc:h-full mc:opacity-0 ${a ? "mc:cursor-not-allowed" : "mc:cursor-pointer"}`,
|
|
1340
|
+
disabled: a || e.amount === 0 || !l
|
|
1341
|
+
}
|
|
1342
|
+
)
|
|
1343
|
+
]
|
|
1254
1344
|
}
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
address: O.TOKEN_REGISTRY,
|
|
1279
|
-
abi: Z,
|
|
1280
|
-
functionName: "setTokenEnabled",
|
|
1281
|
-
args: [m, x]
|
|
1282
|
-
});
|
|
1283
|
-
},
|
|
1284
|
-
updatePriceFeed: (m, x) => {
|
|
1285
|
-
e({
|
|
1286
|
-
address: O.TOKEN_REGISTRY,
|
|
1287
|
-
abi: Z,
|
|
1288
|
-
functionName: "updatePriceFeed",
|
|
1289
|
-
args: [m, x]
|
|
1290
|
-
});
|
|
1291
|
-
},
|
|
1292
|
-
setMinPaymentAmount: (m, x) => {
|
|
1293
|
-
e({
|
|
1294
|
-
address: O.TOKEN_REGISTRY,
|
|
1295
|
-
abi: Z,
|
|
1296
|
-
functionName: "setMinPaymentAmount",
|
|
1297
|
-
args: [m, x]
|
|
1298
|
-
});
|
|
1299
|
-
},
|
|
1300
|
-
grantRole: (m, x) => {
|
|
1301
|
-
e({
|
|
1302
|
-
address: O.TOKEN_REGISTRY,
|
|
1303
|
-
abi: Z,
|
|
1304
|
-
functionName: "grantRole",
|
|
1305
|
-
args: [m, x]
|
|
1306
|
-
});
|
|
1307
|
-
},
|
|
1308
|
-
revokeRole: (m, x) => {
|
|
1309
|
-
e({
|
|
1310
|
-
address: O.TOKEN_REGISTRY,
|
|
1311
|
-
abi: Z,
|
|
1312
|
-
functionName: "revokeRole",
|
|
1313
|
-
args: [m, x]
|
|
1314
|
-
});
|
|
1315
|
-
},
|
|
1316
|
-
// Read hooks
|
|
1317
|
-
useGetTokenConfig: (m) => j({
|
|
1318
|
-
address: O.TOKEN_REGISTRY,
|
|
1319
|
-
abi: Z,
|
|
1320
|
-
functionName: "getTokenConfig",
|
|
1321
|
-
args: [m]
|
|
1322
|
-
}),
|
|
1323
|
-
useGetTokenPrice: (m) => j({
|
|
1324
|
-
address: O.TOKEN_REGISTRY,
|
|
1325
|
-
abi: Z,
|
|
1326
|
-
functionName: "getTokenPriceUSD",
|
|
1327
|
-
args: [m]
|
|
1328
|
-
}),
|
|
1329
|
-
useGetRegisteredTokens: () => j({
|
|
1330
|
-
address: O.TOKEN_REGISTRY,
|
|
1331
|
-
abi: Z,
|
|
1332
|
-
functionName: "getRegisteredTokens"
|
|
1333
|
-
}),
|
|
1334
|
-
useGetRegisteredTokenCount: () => j({
|
|
1335
|
-
address: O.TOKEN_REGISTRY,
|
|
1336
|
-
abi: Z,
|
|
1337
|
-
functionName: "getRegisteredTokenCount"
|
|
1338
|
-
}),
|
|
1339
|
-
useIsTokenEnabled: (m) => j({
|
|
1340
|
-
address: O.TOKEN_REGISTRY,
|
|
1341
|
-
abi: Z,
|
|
1342
|
-
functionName: "isTokenEnabled",
|
|
1343
|
-
args: [m]
|
|
1344
|
-
}),
|
|
1345
|
-
useHasRole: (m, x) => j({
|
|
1346
|
-
address: O.TOKEN_REGISTRY,
|
|
1347
|
-
abi: Z,
|
|
1348
|
-
functionName: "hasRole",
|
|
1349
|
-
args: [m, x]
|
|
1350
|
-
}),
|
|
1351
|
-
// Transaction state
|
|
1352
|
-
hash: t,
|
|
1353
|
-
isPending: n,
|
|
1354
|
-
isConfirming: s,
|
|
1355
|
-
isConfirmed: i,
|
|
1356
|
-
error: r
|
|
1357
|
-
};
|
|
1345
|
+
),
|
|
1346
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:flex-col mc:items-end mc:gap-0.5 mc:min-w-0 mc:w-full mc:sm:w-auto", children: [
|
|
1347
|
+
/* @__PURE__ */ w("span", { className: "mc:text-xs mc:font-semibold mc:text-white mc:text-right mc:wrap-break-word", children: [
|
|
1348
|
+
e.percentage,
|
|
1349
|
+
"% = ",
|
|
1350
|
+
be(m),
|
|
1351
|
+
" ",
|
|
1352
|
+
y
|
|
1353
|
+
] }),
|
|
1354
|
+
e.percentage > 0 && /* @__PURE__ */ w(
|
|
1355
|
+
"span",
|
|
1356
|
+
{
|
|
1357
|
+
className: `mc:text-[10px] mc:text-right mc:wrap-break-word ${d ? "mc:text-white/60" : "mc:text-red-500"}`,
|
|
1358
|
+
children: [
|
|
1359
|
+
be(c, 4),
|
|
1360
|
+
" ",
|
|
1361
|
+
e.symbol,
|
|
1362
|
+
!d && " ⚠️"
|
|
1363
|
+
]
|
|
1364
|
+
}
|
|
1365
|
+
)
|
|
1366
|
+
] })
|
|
1367
|
+
] });
|
|
1358
1368
|
}
|
|
1359
1369
|
const zr = 1e8;
|
|
1360
1370
|
function _r({
|
|
@@ -1363,25 +1373,25 @@ function _r({
|
|
|
1363
1373
|
totalAmount: n,
|
|
1364
1374
|
currency: r = "USD",
|
|
1365
1375
|
items: s,
|
|
1366
|
-
tokens:
|
|
1367
|
-
onPaymentSubmit:
|
|
1376
|
+
tokens: a,
|
|
1377
|
+
onPaymentSubmit: i,
|
|
1368
1378
|
fee: o = 3e-3,
|
|
1369
1379
|
transactionHash: c,
|
|
1370
1380
|
isProcessing: d,
|
|
1371
1381
|
isSuccess: l,
|
|
1372
|
-
conversionRate:
|
|
1382
|
+
conversionRate: y = 1
|
|
1373
1383
|
}) {
|
|
1374
|
-
const p =
|
|
1384
|
+
const p = Tt(), { data: m } = p.useGetTokenPrice(E.NATIVE), { data: h } = p.useGetTokenPrice(E.USDC), { data: v } = p.useGetTokenPrice(E.USDT), { data: P } = p.useGetTokenPrice(E.DAI), { data: T } = p.useGetTokenPrice(E.WBTC), [b, x] = V([]), [S, N] = V(""), [D, J] = V(!0), [Q, H] = V("form"), [q, U] = V(0), [le, $] = V(""), [L, M] = V([]), [z, W] = V(
|
|
1375
1385
|
"Preparing payment..."
|
|
1376
|
-
), re =
|
|
1386
|
+
), re = mr(
|
|
1377
1387
|
() => JSON.stringify(
|
|
1378
|
-
|
|
1388
|
+
a.map((g) => ({
|
|
1379
1389
|
id: g.id,
|
|
1380
1390
|
amount: g.amount,
|
|
1381
1391
|
priceUSD: g.priceUSD
|
|
1382
1392
|
}))
|
|
1383
1393
|
),
|
|
1384
|
-
[
|
|
1394
|
+
[a]
|
|
1385
1395
|
), R = (g) => {
|
|
1386
1396
|
if (!g) return 0;
|
|
1387
1397
|
if (Array.isArray(g) && g.length >= 1) {
|
|
@@ -1392,43 +1402,43 @@ function _r({
|
|
|
1392
1402
|
return 0;
|
|
1393
1403
|
};
|
|
1394
1404
|
ve(() => {
|
|
1395
|
-
if (e &&
|
|
1396
|
-
const g =
|
|
1397
|
-
let
|
|
1398
|
-
return A.address === E.NATIVE &&
|
|
1405
|
+
if (e && a.length > 0) {
|
|
1406
|
+
const g = a.map((A) => {
|
|
1407
|
+
let I = A.priceUSD;
|
|
1408
|
+
return A.address === E.NATIVE && m ? I = R(m) : A.address === E.USDC && h ? I = R(h) : A.address === E.USDT && v ? I = R(v) : A.address === E.DAI && P ? I = R(P) : A.address === E.WBTC && T && (I = R(T)), { ...A, priceUSD: I };
|
|
1399
1409
|
});
|
|
1400
1410
|
if (D) {
|
|
1401
1411
|
g.forEach((C) => {
|
|
1402
1412
|
C.percentage = 0;
|
|
1403
1413
|
});
|
|
1404
|
-
const A = n + o * n,
|
|
1414
|
+
const A = n + o * n, I = g.filter(
|
|
1405
1415
|
(C) => (C.address === E.USDC || C.address === E.USDT || C.address === E.DAI) && C.amount > 0 && C.priceUSD > 0
|
|
1406
1416
|
), G = g.filter(
|
|
1407
1417
|
(C) => C.address !== E.USDC && C.address !== E.USDT && C.address !== E.DAI && C.amount > 0 && C.priceUSD > 0
|
|
1408
|
-
), xe =
|
|
1418
|
+
), xe = I.reduce(
|
|
1409
1419
|
(C, Y) => C + Y.amount * Y.priceUSD,
|
|
1410
1420
|
0
|
|
1411
1421
|
);
|
|
1412
|
-
if (
|
|
1413
|
-
const C = Math.floor(100 /
|
|
1414
|
-
|
|
1415
|
-
Me.percentage = C + (
|
|
1422
|
+
if (I.length > 0 && xe >= A) {
|
|
1423
|
+
const C = Math.floor(100 / I.length), Y = 100 - C * I.length;
|
|
1424
|
+
I.forEach((Me, ye) => {
|
|
1425
|
+
Me.percentage = C + (ye === 0 ? Y : 0);
|
|
1416
1426
|
});
|
|
1417
|
-
} else if (
|
|
1427
|
+
} else if (I.length > 0) {
|
|
1418
1428
|
const C = xe / A * 100, Y = Math.floor(
|
|
1419
|
-
C /
|
|
1429
|
+
C / I.length
|
|
1420
1430
|
);
|
|
1421
|
-
|
|
1431
|
+
I.forEach((fe) => {
|
|
1422
1432
|
fe.percentage = Y;
|
|
1423
1433
|
});
|
|
1424
|
-
const
|
|
1434
|
+
const ye = 100 - I.reduce(
|
|
1425
1435
|
(fe, Xe) => fe + Xe.percentage,
|
|
1426
1436
|
0
|
|
1427
1437
|
);
|
|
1428
|
-
if (G.length > 0 &&
|
|
1438
|
+
if (G.length > 0 && ye > 0) {
|
|
1429
1439
|
const fe = Math.floor(
|
|
1430
|
-
|
|
1431
|
-
), Xe =
|
|
1440
|
+
ye / G.length
|
|
1441
|
+
), Xe = ye - fe * G.length;
|
|
1432
1442
|
G.forEach((lr, fr) => {
|
|
1433
1443
|
lr.percentage = fe + (fr === 0 ? Xe : 0);
|
|
1434
1444
|
});
|
|
@@ -1439,8 +1449,8 @@ function _r({
|
|
|
1439
1449
|
);
|
|
1440
1450
|
if (C.length > 0) {
|
|
1441
1451
|
const Y = Math.floor(100 / C.length), Me = 100 - Y * C.length;
|
|
1442
|
-
C.forEach((
|
|
1443
|
-
|
|
1452
|
+
C.forEach((ye, fe) => {
|
|
1453
|
+
ye.percentage = Y + (fe === 0 ? Me : 0);
|
|
1444
1454
|
});
|
|
1445
1455
|
}
|
|
1446
1456
|
}
|
|
@@ -1450,7 +1460,7 @@ function _r({
|
|
|
1450
1460
|
}, [
|
|
1451
1461
|
e,
|
|
1452
1462
|
re,
|
|
1453
|
-
|
|
1463
|
+
m,
|
|
1454
1464
|
h,
|
|
1455
1465
|
v,
|
|
1456
1466
|
P,
|
|
@@ -1461,38 +1471,38 @@ function _r({
|
|
|
1461
1471
|
}, [e]), ve(() => {
|
|
1462
1472
|
l && c ? (U(100), $(c), H("success"), W("Payment completed!")) : d && (U(80), W("Confirming transaction..."));
|
|
1463
1473
|
}, [l, d, c]);
|
|
1464
|
-
const K =
|
|
1474
|
+
const K = b.reduce((g, A) => g + A.percentage, 0), me = vt(r), ee = r === "IDR" ? 1 / y : 1, nr = s.map((g) => ({
|
|
1465
1475
|
...g,
|
|
1466
1476
|
price: g.price
|
|
1467
|
-
})), Bt = o * n, We = n + Bt, rr = Bt * ee, Ke = We * ee, Ye =
|
|
1477
|
+
})), Bt = o * n, We = n + Bt, rr = Bt * ee, Ke = We * ee, Ye = b.some((g) => g.percentage === 0 ? !1 : !g.priceUSD || g.priceUSD <= 0), Ze = b.some((g) => {
|
|
1468
1478
|
if (g.percentage === 0) return !1;
|
|
1469
1479
|
const A = We * g.percentage / 100;
|
|
1470
1480
|
return (g.priceUSD > 0 ? A / g.priceUSD : 0) > g.amount;
|
|
1471
1481
|
}), sr = (g, A) => {
|
|
1472
1482
|
x(
|
|
1473
|
-
(
|
|
1483
|
+
(I) => I.map((G) => G.id === g ? { ...G, percentage: A } : G)
|
|
1474
1484
|
);
|
|
1475
|
-
},
|
|
1485
|
+
}, ar = () => {
|
|
1476
1486
|
if (!D) {
|
|
1477
|
-
const g =
|
|
1487
|
+
const g = b.filter((G) => G.amount > 0 && G.priceUSD > 0), A = Math.floor(100 / g.length), I = 100 - A * g.length;
|
|
1478
1488
|
x(
|
|
1479
1489
|
(G) => G.map((xe, C) => ({
|
|
1480
1490
|
...xe,
|
|
1481
|
-
percentage: xe.amount > 0 && xe.priceUSD > 0 ? A + (C === 0 ?
|
|
1491
|
+
percentage: xe.amount > 0 && xe.priceUSD > 0 ? A + (C === 0 ? I : 0) : 0
|
|
1482
1492
|
}))
|
|
1483
1493
|
);
|
|
1484
1494
|
}
|
|
1485
1495
|
J(!D);
|
|
1486
|
-
},
|
|
1496
|
+
}, ir = b.filter(
|
|
1487
1497
|
(g) => g.amount > 0 && (g.name.toLowerCase().includes(S.toLowerCase()) || g.symbol.toLowerCase().includes(S.toLowerCase()) || g.chain.toLowerCase().includes(S.toLowerCase()))
|
|
1488
1498
|
), or = async () => {
|
|
1489
1499
|
H("processing"), U(10), W("Checking token approvals...");
|
|
1490
|
-
const g =
|
|
1500
|
+
const g = b.filter(
|
|
1491
1501
|
(A) => A.percentage > 0 && A.address !== E.NATIVE
|
|
1492
1502
|
);
|
|
1493
1503
|
g.length > 0 && (W(
|
|
1494
1504
|
`Requesting approval for ${g.length} token(s)...`
|
|
1495
|
-
), M(g.map((A) => A.symbol))), U(30), W("Processing payment..."),
|
|
1505
|
+
), M(g.map((A) => A.symbol))), U(30), W("Processing payment..."), i(b), U(60);
|
|
1496
1506
|
}, cr = () => {
|
|
1497
1507
|
t();
|
|
1498
1508
|
}, ur = () => (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
|
|
@@ -1501,67 +1511,67 @@ function _r({
|
|
|
1501
1511
|
year: "numeric"
|
|
1502
1512
|
});
|
|
1503
1513
|
if (!e) return null;
|
|
1504
|
-
const dr = /* @__PURE__ */ w("div", { className: "multicoyn-sdk fixed inset-0 z-
|
|
1514
|
+
const dr = /* @__PURE__ */ w("div", { className: "multicoyn-sdk mc:fixed mc:inset-0 mc:z-9999 mc:flex mc:items-center mc:justify-center", children: [
|
|
1505
1515
|
/* @__PURE__ */ u(
|
|
1506
1516
|
"div",
|
|
1507
1517
|
{
|
|
1508
|
-
className: "absolute inset-0 bg-black/60 backdrop-blur-sm",
|
|
1518
|
+
className: "mc:absolute mc:inset-0 mc:bg-black/60 mc:backdrop-blur-sm",
|
|
1509
1519
|
onClick: Q === "form" ? t : void 0
|
|
1510
1520
|
}
|
|
1511
1521
|
),
|
|
1512
|
-
Q === "processing" && /* @__PURE__ */ w("div", { className: "relative bg-dark-2 border border-border rounded-xl p-4 flex flex-col gap-5 items-center justify-center w-[400px] min-h-[280px] mx-4 animate-slide-in-right", children: [
|
|
1513
|
-
/* @__PURE__ */ u(
|
|
1514
|
-
/* @__PURE__ */ w("div", { className: "flex flex-col gap-3 items-center w-[300px]", children: [
|
|
1515
|
-
/* @__PURE__ */ w("div", { className: "relative w-[234px] h-1.5", children: [
|
|
1516
|
-
/* @__PURE__ */ u("div", { className: "absolute inset-0 bg-dark-4 rounded-full" }),
|
|
1522
|
+
Q === "processing" && /* @__PURE__ */ w("div", { className: "mc:relative mc:bg-dark-2 mc:border mc:border-border mc:rounded-xl mc:p-4 mc:flex mc:flex-col mc:gap-5 mc:items-center mc:justify-center mc:w-full mc:max-w-[400px] mc:min-h-[280px] mc:mx-4 animate-slide-in-right", children: [
|
|
1523
|
+
/* @__PURE__ */ u(Ur, { size: 134 }),
|
|
1524
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:flex-col mc:gap-3 mc:items-center mc:w-full mc:max-w-[300px] mc:px-2", children: [
|
|
1525
|
+
/* @__PURE__ */ w("div", { className: "mc:relative mc:w-full mc:max-w-[234px] mc:h-1.5", children: [
|
|
1526
|
+
/* @__PURE__ */ u("div", { className: "mc:absolute mc:inset-0 mc:bg-dark-4 mc:rounded-full" }),
|
|
1517
1527
|
/* @__PURE__ */ u(
|
|
1518
1528
|
"div",
|
|
1519
1529
|
{
|
|
1520
|
-
className: "absolute left-0 top-0 h-full bg-secondary rounded-full transition-all duration-300",
|
|
1530
|
+
className: "mc:absolute mc:left-0 mc:top-0 mc:h-full mc:bg-secondary mc:rounded-full mc:transition-all mc:duration-300",
|
|
1521
1531
|
style: { width: `${Math.min(q, 100)}%` }
|
|
1522
1532
|
}
|
|
1523
1533
|
)
|
|
1524
1534
|
] }),
|
|
1525
|
-
/* @__PURE__ */ u("p", { className: "text-sm text-white text-center", children: z }),
|
|
1526
|
-
L.length > 0 && /* @__PURE__ */ w("div", { className: "text-xs text-white/60 text-center", children: [
|
|
1535
|
+
/* @__PURE__ */ u("p", { className: "mc:text-sm mc:text-white mc:text-center mc:wrap-break-word mc:px-2", children: z }),
|
|
1536
|
+
L.length > 0 && /* @__PURE__ */ w("div", { className: "mc:text-xs mc:text-white/60 mc:text-center mc:wrap-break-word mc:px-2", children: [
|
|
1527
1537
|
"Approving: ",
|
|
1528
1538
|
L.join(", ")
|
|
1529
1539
|
] })
|
|
1530
1540
|
] })
|
|
1531
1541
|
] }),
|
|
1532
|
-
Q === "success" && /* @__PURE__ */ w("div", { className: "relative bg-dark-2 border border-border rounded-xl p-4 flex flex-col gap-8 items-start w-[380px] mx-4 animate-slide-in-right", children: [
|
|
1533
|
-
/* @__PURE__ */ w("div", { className: "flex flex-col gap-6 items-center w-full", children: [
|
|
1534
|
-
/* @__PURE__ */ u(
|
|
1535
|
-
/* @__PURE__ */ u("div", { className: "flex flex-col items-center justify-center w-full", children: /* @__PURE__ */ w("div", { className: "flex flex-col gap-1 items-center text-white", children: [
|
|
1536
|
-
/* @__PURE__ */ u("p", { className: "text-lg font-semibold", children: "Payment Success" }),
|
|
1537
|
-
/* @__PURE__ */ u("p", { className: "text-sm", children: "Your payment has been successfully done." })
|
|
1542
|
+
Q === "success" && /* @__PURE__ */ w("div", { className: "mc:relative mc:bg-dark-2 mc:border mc:border-border mc:rounded-xl mc:p-4 mc:flex mc:flex-col mc:gap-8 mc:items-start mc:w-full mc:max-w-[380px] mc:mx-4 animate-slide-in-right", children: [
|
|
1543
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:flex-col mc:gap-6 mc:items-center mc:w-full", children: [
|
|
1544
|
+
/* @__PURE__ */ u(Lr, { size: 95 }),
|
|
1545
|
+
/* @__PURE__ */ u("div", { className: "mc:flex mc:flex-col mc:items-center mc:justify-center mc:w-full", children: /* @__PURE__ */ w("div", { className: "mc:flex mc:flex-col mc:gap-1 mc:items-center mc:text-white mc:px-2", children: [
|
|
1546
|
+
/* @__PURE__ */ u("p", { className: "mc:text-lg mc:font-semibold mc:text-center", children: "Payment Success" }),
|
|
1547
|
+
/* @__PURE__ */ u("p", { className: "mc:text-sm mc:text-center", children: "Your payment has been successfully done." })
|
|
1538
1548
|
] }) }),
|
|
1539
|
-
/* @__PURE__ */ u("div", { className: "bg-dark-4 border border-white/10 rounded-lg py-3 px-
|
|
1540
|
-
/* @__PURE__ */ u("p", { className: "text-xs text-white", children: "Order Details:" }),
|
|
1541
|
-
/* @__PURE__ */ w("div", { className: "flex items-center gap-8 text-sm text-white w-full", children: [
|
|
1542
|
-
/* @__PURE__ */ u("span", { className: "w-[85px]", children: "Item" }),
|
|
1543
|
-
/* @__PURE__ */ u("span", { className: "flex-1 text-right", children: s[0]?.name || "Item" })
|
|
1549
|
+
/* @__PURE__ */ u("div", { className: "mc:bg-dark-4 mc:border mc:border-white/10 mc:rounded-lg mc:py-3 mc:px-4 mc:w-full mc:max-w-[348px] mc:flex mc:flex-col mc:items-center", children: /* @__PURE__ */ w("div", { className: "mc:flex mc:flex-col mc:gap-2 mc:w-full", children: [
|
|
1550
|
+
/* @__PURE__ */ u("p", { className: "mc:text-xs mc:text-white", children: "Order Details:" }),
|
|
1551
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:gap-4 mc:sm:gap-8 mc:text-sm mc:text-white mc:w-full", children: [
|
|
1552
|
+
/* @__PURE__ */ u("span", { className: "mc:min-w-[85px] mc:shrink-0", children: "Item" }),
|
|
1553
|
+
/* @__PURE__ */ u("span", { className: "mc:flex-1 mc:text-right mc:wrap-break-word", children: s[0]?.name || "Item" })
|
|
1544
1554
|
] }),
|
|
1545
|
-
/* @__PURE__ */ w("div", { className: "flex items-center gap-8 text-white w-full", children: [
|
|
1546
|
-
/* @__PURE__ */ u("span", { className: "text-sm w-[106px]", children: "Total Payment" }),
|
|
1547
|
-
/* @__PURE__ */ w("span", { className: "flex-1 text-base font-semibold text-right", children: [
|
|
1548
|
-
|
|
1555
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:gap-4 mc:sm:gap-8 mc:text-white mc:w-full", children: [
|
|
1556
|
+
/* @__PURE__ */ u("span", { className: "mc:text-sm mc:min-w-[106px] mc:shrink-0", children: "Total Payment" }),
|
|
1557
|
+
/* @__PURE__ */ w("span", { className: "mc:flex-1 mc:text-base mc:font-semibold mc:text-right mc:wrap-break-word", children: [
|
|
1558
|
+
be(Ke),
|
|
1549
1559
|
" ",
|
|
1550
|
-
|
|
1560
|
+
me
|
|
1551
1561
|
] })
|
|
1552
1562
|
] })
|
|
1553
1563
|
] }) })
|
|
1554
1564
|
] }),
|
|
1555
|
-
/* @__PURE__ */ u("div", { className: "h-px w-[320px] bg-white/20" }),
|
|
1556
|
-
/* @__PURE__ */ w("div", { className: "flex flex-col gap-2 items-center justify-center w-full text-xs text-white px-5", children: [
|
|
1557
|
-
/* @__PURE__ */ u("p", { children: ur() }),
|
|
1565
|
+
/* @__PURE__ */ u("div", { className: "mc:h-px mc:w-full mc:max-w-[320px] mc:bg-white/20" }),
|
|
1566
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:flex-col mc:gap-2 mc:items-center mc:justify-center mc:w-full mc:text-xs mc:text-white mc:px-5", children: [
|
|
1567
|
+
/* @__PURE__ */ u("p", { className: "mc:text-center", children: ur() }),
|
|
1558
1568
|
le && /* @__PURE__ */ u(
|
|
1559
1569
|
"a",
|
|
1560
1570
|
{
|
|
1561
1571
|
href: `https://sepolia-blockscout.lisk.com/tx/${le}`,
|
|
1562
1572
|
target: "_blank",
|
|
1563
1573
|
rel: "noopener noreferrer",
|
|
1564
|
-
className: "text-cyan hover:underline",
|
|
1574
|
+
className: "mc:text-cyan hover:mc:underline mc:text-center mc:break-all",
|
|
1565
1575
|
children: "View Transaction"
|
|
1566
1576
|
}
|
|
1567
1577
|
)
|
|
@@ -1570,40 +1580,46 @@ function _r({
|
|
|
1570
1580
|
"button",
|
|
1571
1581
|
{
|
|
1572
1582
|
onClick: cr,
|
|
1573
|
-
className: "w-full h-[42px] bg-secondary hover:bg-secondary/90 rounded-lg flex items-center justify-center text-sm font-semibold text-white transition-all",
|
|
1583
|
+
className: "mc:w-full mc:h-[42px] mc:bg-secondary hover:mc:bg-secondary/90 mc:rounded-lg mc:flex mc:items-center mc:justify-center mc:text-sm mc:font-semibold mc:text-white mc:transition-all",
|
|
1574
1584
|
children: "Back to Home"
|
|
1575
1585
|
}
|
|
1576
1586
|
)
|
|
1577
1587
|
] }),
|
|
1578
|
-
Q === "form" && /* @__PURE__ */ w("div", { className: "relative bg-dark-2 border border-border rounded-xl p-4 flex flex-col gap-5 max-w-[1000px] w-full mx-4 max-h-[90vh] overflow-y-auto animate-slide-in-right", children: [
|
|
1579
|
-
/* @__PURE__ */ w("div", { className: "flex items-center gap-4", children: [
|
|
1580
|
-
/* @__PURE__ */ w("div", { className: "flex-1 flex flex-col gap-1", children: [
|
|
1581
|
-
/* @__PURE__ */ u("h2", { className: "text-xl text-white font-normal", children: "Complete Payment" }),
|
|
1582
|
-
/* @__PURE__ */ u("p", { className: "text-base text-white/70", children: "Choose how you want to pay (supports multi-token for wallets)" })
|
|
1588
|
+
Q === "form" && /* @__PURE__ */ w("div", { className: "mc:relative mc:bg-dark-2 mc:border mc:border-border mc:rounded-xl mc:p-4 mc:flex mc:flex-col mc:gap-5 mc:max-w-[1000px] mc:w-full mc:mx-4 mc:max-h-[90vh] mc:overflow-y-auto animate-slide-in-right", children: [
|
|
1589
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:gap-4", children: [
|
|
1590
|
+
/* @__PURE__ */ w("div", { className: "mc:flex-1 mc:flex mc:flex-col mc:gap-1 mc:min-w-0", children: [
|
|
1591
|
+
/* @__PURE__ */ u("h2", { className: "mc:text-lg mc:sm:text-xl mc:text-white mc:font-normal mc:wrap-break-word", children: "Complete Payment" }),
|
|
1592
|
+
/* @__PURE__ */ u("p", { className: "mc:text-sm mc:sm:text-base mc:text-white/70 mc:wrap-break-word", children: "Choose how you want to pay (supports multi-token for wallets)" })
|
|
1583
1593
|
] }),
|
|
1584
1594
|
/* @__PURE__ */ u(
|
|
1585
1595
|
"button",
|
|
1586
1596
|
{
|
|
1587
1597
|
onClick: t,
|
|
1588
|
-
className: "text-white/60 hover:text-white transition-colors",
|
|
1589
|
-
children: /* @__PURE__ */ u(
|
|
1598
|
+
className: "mc:text-white/60 hover:mc:text-white mc:transition-colors mc:shrink-0",
|
|
1599
|
+
children: /* @__PURE__ */ u(Dr, { size: 26 })
|
|
1590
1600
|
}
|
|
1591
1601
|
)
|
|
1592
1602
|
] }),
|
|
1593
|
-
/* @__PURE__ */ w("div", { className: "flex gap-5 flex-col lg:flex-row", children: [
|
|
1594
|
-
/* @__PURE__ */ w("div", { className: "flex-1 flex flex-col gap-5", children: [
|
|
1595
|
-
/* @__PURE__ */ w("div", { className: "bg-dark-4 rounded-md p-4 flex items-center gap-5", children: [
|
|
1596
|
-
/* @__PURE__ */ u("span", { className: "text-base text-white/60 w-[
|
|
1597
|
-
/* @__PURE__ */ w("span", { className: "text-xl font-bold text-white text-right flex-1", children: [
|
|
1598
|
-
|
|
1603
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:gap-5 mc:flex-col mc:lg:flex-row", children: [
|
|
1604
|
+
/* @__PURE__ */ w("div", { className: "mc:flex-1 mc:flex mc:flex-col mc:gap-5", children: [
|
|
1605
|
+
/* @__PURE__ */ w("div", { className: "mc:bg-dark-4 mc:rounded-md mc:p-4 mc:flex mc:items-center mc:gap-3 mc:sm:gap-5 mc:flex-col mc:md:flex-row", children: [
|
|
1606
|
+
/* @__PURE__ */ u("span", { className: "mc:text-sm mc:sm:text-base mc:text-white/60 mc:min-w-[120px] mc:shrink-0", children: "Total Required" }),
|
|
1607
|
+
/* @__PURE__ */ w("span", { className: "mc:text-lg mc:sm:text-xl mc:font-bold mc:text-white mc:text-right mc:flex-1 mc:min-w-0 mc:wrap-break-word", children: [
|
|
1608
|
+
be(Ke),
|
|
1599
1609
|
" ",
|
|
1600
|
-
|
|
1610
|
+
me
|
|
1601
1611
|
] })
|
|
1602
1612
|
] }),
|
|
1603
|
-
/* @__PURE__ */ w("div", { className: "flex items-center gap-5", children: [
|
|
1604
|
-
/* @__PURE__ */ u("span", { className: "text-base text-white flex-1", children: "Use your tokens" }),
|
|
1605
|
-
/* @__PURE__ */ w("div", { className: "bg-dark-4 rounded-md px-3 py-2 flex items-center gap-2", children: [
|
|
1606
|
-
/* @__PURE__ */ u(
|
|
1613
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:gap-3 mc:sm:gap-5 mc:flex-wrap", children: [
|
|
1614
|
+
/* @__PURE__ */ u("span", { className: "mc:text-sm mc:sm:text-base mc:text-white mc:flex-1 mc:min-w-0", children: "Use your tokens" }),
|
|
1615
|
+
/* @__PURE__ */ w("div", { className: "mc:bg-dark-4 mc:rounded-md mc:px-3 mc:py-2 mc:flex mc:items-center mc:gap-2 mc:flex-1 mc:sm:flex-initial mc:min-w-0", children: [
|
|
1616
|
+
/* @__PURE__ */ u(
|
|
1617
|
+
Or,
|
|
1618
|
+
{
|
|
1619
|
+
size: 16,
|
|
1620
|
+
className: "mc:text-white/60 mc:shrink-0"
|
|
1621
|
+
}
|
|
1622
|
+
),
|
|
1607
1623
|
/* @__PURE__ */ u(
|
|
1608
1624
|
"input",
|
|
1609
1625
|
{
|
|
@@ -1611,20 +1627,26 @@ function _r({
|
|
|
1611
1627
|
placeholder: "Search token or chain..",
|
|
1612
1628
|
value: S,
|
|
1613
1629
|
onChange: (g) => N(g.target.value),
|
|
1614
|
-
className: "bg-transparent border-none outline-none text-base text-white/60 placeholder:text-white/60"
|
|
1630
|
+
className: "mc:bg-transparent mc:border-none mc:outline-none mc:text-sm mc:sm:text-base mc:text-white/60 placeholder:mc:text-white/60 mc:w-full mc:min-w-0"
|
|
1615
1631
|
}
|
|
1616
1632
|
)
|
|
1617
1633
|
] })
|
|
1618
1634
|
] }),
|
|
1619
|
-
/* @__PURE__ */ w("div", { className: "bg-dark-3 rounded-md p-3 flex flex-col gap-4", children: [
|
|
1620
|
-
/* @__PURE__ */ w("div", { className: "flex items-center gap-6", children: [
|
|
1621
|
-
/* @__PURE__ */ w("div", { className: "flex-1 flex items-center gap-2", children: [
|
|
1622
|
-
/* @__PURE__ */ u(
|
|
1623
|
-
|
|
1635
|
+
/* @__PURE__ */ w("div", { className: "mc:bg-dark-3 mc:rounded-md mc:p-3 mc:flex mc:flex-col mc:gap-4", children: [
|
|
1636
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:gap-3 mc:sm:gap-6 mc:flex-col mc:md:flex-row", children: [
|
|
1637
|
+
/* @__PURE__ */ w("div", { className: "mc:flex-1 mc:flex mc:items-center mc:gap-2 mc:min-w-0 mc:flex-wrap", children: [
|
|
1638
|
+
/* @__PURE__ */ u(
|
|
1639
|
+
Br,
|
|
1640
|
+
{
|
|
1641
|
+
size: 16,
|
|
1642
|
+
className: "mc:text-white/60 mc:shrink-0"
|
|
1643
|
+
}
|
|
1644
|
+
),
|
|
1645
|
+
/* @__PURE__ */ u("span", { className: "mc:text-xs mc:sm:text-sm mc:italic mc:text-white mc:wrap-break-word", children: "Set the coins amount until 100%" }),
|
|
1624
1646
|
/* @__PURE__ */ w(
|
|
1625
1647
|
"span",
|
|
1626
1648
|
{
|
|
1627
|
-
className: `bg-dark-4 rounded-full px-2 py-1 text-xs font-semibold ${K === 100 ? "text-cyan" : "text-warning"}`,
|
|
1649
|
+
className: `mc:bg-dark-4 mc:rounded-full mc:px-2 mc:py-1 mc:text-xs mc:font-semibold mc:shrink-0 ${K === 100 ? "mc:text-cyan" : "mc:text-warning"}`,
|
|
1628
1650
|
children: [
|
|
1629
1651
|
K,
|
|
1630
1652
|
"/100%"
|
|
@@ -1632,25 +1654,25 @@ function _r({
|
|
|
1632
1654
|
}
|
|
1633
1655
|
)
|
|
1634
1656
|
] }),
|
|
1635
|
-
/* @__PURE__ */ w("div", { className: "flex items-center gap-2", children: [
|
|
1636
|
-
/* @__PURE__ */ u("span", { className: "text-sm text-white", children: "Auto Optimize" }),
|
|
1657
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:gap-2 mc:shrink-0", children: [
|
|
1658
|
+
/* @__PURE__ */ u("span", { className: "mc:text-xs mc:sm:text-sm mc:text-white", children: "Auto Optimize" }),
|
|
1637
1659
|
/* @__PURE__ */ u(
|
|
1638
1660
|
"button",
|
|
1639
1661
|
{
|
|
1640
|
-
onClick:
|
|
1641
|
-
className: `w-7 h-4 rounded-full relative transition-colors ${D ? "bg-cyan" : "bg-white/40"}`,
|
|
1662
|
+
onClick: ar,
|
|
1663
|
+
className: `mc:w-7 mc:h-4 mc:rounded-full mc:relative mc:transition-colors ${D ? "mc:bg-cyan" : "mc:bg-white/40"}`,
|
|
1642
1664
|
children: /* @__PURE__ */ u(
|
|
1643
1665
|
"div",
|
|
1644
1666
|
{
|
|
1645
|
-
className: `absolute top-0.5 size-3 rounded-full bg-white transition-transform ${D ? "translate-x-3.5" : "translate-x-0.5"}`
|
|
1667
|
+
className: `mc:absolute mc:top-0.5 mc:size-3 mc:rounded-full mc:bg-white mc:transition-transform ${D ? "mc:translate-x-3.5" : "mc:translate-x-0.5"}`
|
|
1646
1668
|
}
|
|
1647
1669
|
)
|
|
1648
1670
|
}
|
|
1649
1671
|
)
|
|
1650
1672
|
] })
|
|
1651
1673
|
] }),
|
|
1652
|
-
|
|
1653
|
-
|
|
1674
|
+
ir.map((g) => /* @__PURE__ */ u(
|
|
1675
|
+
jr,
|
|
1654
1676
|
{
|
|
1655
1677
|
token: g,
|
|
1656
1678
|
totalAmount: We,
|
|
@@ -1663,8 +1685,8 @@ function _r({
|
|
|
1663
1685
|
))
|
|
1664
1686
|
] })
|
|
1665
1687
|
] }),
|
|
1666
|
-
/* @__PURE__ */ u("div", { className: "w-full lg:w-[320px]", children: /* @__PURE__ */ u(
|
|
1667
|
-
|
|
1688
|
+
/* @__PURE__ */ u("div", { className: "mc:w-full mc:lg:w-[320px]", children: /* @__PURE__ */ u(
|
|
1689
|
+
Fr,
|
|
1668
1690
|
{
|
|
1669
1691
|
items: nr,
|
|
1670
1692
|
fee: rr,
|
|
@@ -1677,8 +1699,8 @@ function _r({
|
|
|
1677
1699
|
{
|
|
1678
1700
|
onClick: or,
|
|
1679
1701
|
disabled: K !== 100 || Ze || Ye,
|
|
1680
|
-
className: `w-full lg:w-[620px] h-[42px] rounded-lg flex items-center justify-center text-sm font-semibold text-white transition-all ${K === 100 && !Ze && !Ye ? "bg-secondary hover:bg-secondary/90" : "bg-secondary/50 cursor-not-allowed"}`,
|
|
1681
|
-
children: Ye ? "Price data unavailable - Please wait" : Ze ? "Insufficient Balance" : K !== 100 ? `Complete to 100% (${K}%)` : "Pay with MultiCoyn"
|
|
1702
|
+
className: `mc:w-full mc:lg:w-[620px] mc:h-[42px] mc:rounded-lg mc:flex mc:items-center mc:justify-center mc:text-xs mc:sm:text-sm mc:font-semibold mc:text-white mc:transition-all mc:px-2 mc:wrap-break-word ${K === 100 && !Ze && !Ye ? "mc:bg-secondary hover:mc:bg-secondary/90" : "mc:bg-secondary/50 mc:cursor-not-allowed"}`,
|
|
1703
|
+
children: /* @__PURE__ */ u("span", { className: "mc:text-center", children: Ye ? "Price data unavailable - Please wait" : Ze ? "Insufficient Balance" : K !== 100 ? `Complete to 100% (${K}%)` : "Pay with MultiCoyn" })
|
|
1682
1704
|
}
|
|
1683
1705
|
)
|
|
1684
1706
|
] })
|
|
@@ -1830,16 +1852,16 @@ let Je = {
|
|
|
1830
1852
|
version: `viem@${en}`
|
|
1831
1853
|
}, f = class st extends Error {
|
|
1832
1854
|
constructor(t, n = {}) {
|
|
1833
|
-
const r = n.cause instanceof st ? n.cause.details : n.cause?.message ? n.cause.message : n.details, s = n.cause instanceof st && n.cause.docsPath || n.docsPath,
|
|
1855
|
+
const r = n.cause instanceof st ? n.cause.details : n.cause?.message ? n.cause.message : n.details, s = n.cause instanceof st && n.cause.docsPath || n.docsPath, a = Je.getDocsUrl?.({ ...n, docsPath: s }), i = [
|
|
1834
1856
|
t || "An error occurred.",
|
|
1835
1857
|
"",
|
|
1836
1858
|
...n.metaMessages ? [...n.metaMessages, ""] : [],
|
|
1837
|
-
...
|
|
1859
|
+
...a ? [`Docs: ${a}`] : [],
|
|
1838
1860
|
...r ? [`Details: ${r}`] : [],
|
|
1839
1861
|
...Je.version ? [`Version: ${Je.version}`] : []
|
|
1840
1862
|
].join(`
|
|
1841
1863
|
`);
|
|
1842
|
-
super(
|
|
1864
|
+
super(i, n.cause ? { cause: n.cause } : void 0), Object.defineProperty(this, "details", {
|
|
1843
1865
|
enumerable: !0,
|
|
1844
1866
|
configurable: !0,
|
|
1845
1867
|
writable: !0,
|
|
@@ -2143,14 +2165,14 @@ function ts(e, { dir: t, size: n = 32 } = {}) {
|
|
|
2143
2165
|
});
|
|
2144
2166
|
const r = new Uint8Array(n);
|
|
2145
2167
|
for (let s = 0; s < n; s++) {
|
|
2146
|
-
const
|
|
2147
|
-
r[
|
|
2168
|
+
const a = t === "right";
|
|
2169
|
+
r[a ? s : n - s - 1] = e[a ? s : e.length - s - 1];
|
|
2148
2170
|
}
|
|
2149
2171
|
return r;
|
|
2150
2172
|
}
|
|
2151
2173
|
let an = class extends f {
|
|
2152
|
-
constructor({ max: t, min: n, signed: r, size: s, value:
|
|
2153
|
-
super(`Number "${
|
|
2174
|
+
constructor({ max: t, min: n, signed: r, size: s, value: a }) {
|
|
2175
|
+
super(`Number "${a}" is not in safe ${s ? `${s * 8}-bit ${r ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${n} to ${t})` : `(above ${n})`}`, { name: "IntegerOutOfRangeError" });
|
|
2154
2176
|
}
|
|
2155
2177
|
};
|
|
2156
2178
|
class ns extends f {
|
|
@@ -2184,15 +2206,15 @@ function on(e, t = {}) {
|
|
|
2184
2206
|
const r = BigInt(e);
|
|
2185
2207
|
if (!n)
|
|
2186
2208
|
return r;
|
|
2187
|
-
const s = (e.length - 2) / 2,
|
|
2188
|
-
return r <=
|
|
2209
|
+
const s = (e.length - 2) / 2, a = (1n << BigInt(s) * 8n - 1n) - 1n;
|
|
2210
|
+
return r <= a ? r : r - BigInt(`0x${"f".padStart(s * 2, "f")}`) - 1n;
|
|
2189
2211
|
}
|
|
2190
2212
|
function ss(e, t = {}) {
|
|
2191
2213
|
return Number(on(e, t));
|
|
2192
2214
|
}
|
|
2193
|
-
const
|
|
2194
|
-
function
|
|
2195
|
-
return typeof e == "number" || typeof e == "bigint" ?
|
|
2215
|
+
const as = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
|
|
2216
|
+
function is(e, t = {}) {
|
|
2217
|
+
return typeof e == "number" || typeof e == "bigint" ? k(e, t) : typeof e == "string" ? un(e, t) : typeof e == "boolean" ? cn(e, t) : ue(e, t);
|
|
2196
2218
|
}
|
|
2197
2219
|
function cn(e, t = {}) {
|
|
2198
2220
|
const n = `0x${Number(e)}`;
|
|
@@ -2201,20 +2223,20 @@ function cn(e, t = {}) {
|
|
|
2201
2223
|
function ue(e, t = {}) {
|
|
2202
2224
|
let n = "";
|
|
2203
2225
|
for (let s = 0; s < e.length; s++)
|
|
2204
|
-
n +=
|
|
2226
|
+
n += as[e[s]];
|
|
2205
2227
|
const r = `0x${n}`;
|
|
2206
2228
|
return typeof t.size == "number" ? (se(r, { size: t.size }), Ae(r, { dir: "right", size: t.size })) : r;
|
|
2207
2229
|
}
|
|
2208
|
-
function
|
|
2230
|
+
function k(e, t = {}) {
|
|
2209
2231
|
const { signed: n, size: r } = t, s = BigInt(e);
|
|
2210
|
-
let
|
|
2211
|
-
r ? n ?
|
|
2212
|
-
const
|
|
2213
|
-
if (
|
|
2232
|
+
let a;
|
|
2233
|
+
r ? n ? a = (1n << BigInt(r) * 8n - 1n) - 1n : a = 2n ** (BigInt(r) * 8n) - 1n : typeof e == "number" && (a = BigInt(Number.MAX_SAFE_INTEGER));
|
|
2234
|
+
const i = typeof a == "bigint" && n ? -a - 1n : 0;
|
|
2235
|
+
if (a && s > a || s < i) {
|
|
2214
2236
|
const c = typeof e == "bigint" ? "n" : "";
|
|
2215
2237
|
throw new an({
|
|
2216
|
-
max:
|
|
2217
|
-
min: `${
|
|
2238
|
+
max: a ? `${a}${c}` : void 0,
|
|
2239
|
+
min: `${i}${c}`,
|
|
2218
2240
|
signed: n,
|
|
2219
2241
|
size: r,
|
|
2220
2242
|
value: `${e}${c}`
|
|
@@ -2236,7 +2258,7 @@ function us(e, t = {}) {
|
|
|
2236
2258
|
const n = new Uint8Array(1);
|
|
2237
2259
|
return n[0] = Number(e), typeof t.size == "number" ? (se(n, { size: t.size }), Ae(n, { size: t.size })) : n;
|
|
2238
2260
|
}
|
|
2239
|
-
const
|
|
2261
|
+
const ae = {
|
|
2240
2262
|
zero: 48,
|
|
2241
2263
|
nine: 57,
|
|
2242
2264
|
A: 65,
|
|
@@ -2245,29 +2267,29 @@ const ie = {
|
|
|
2245
2267
|
f: 102
|
|
2246
2268
|
};
|
|
2247
2269
|
function jt(e) {
|
|
2248
|
-
if (e >=
|
|
2249
|
-
return e -
|
|
2250
|
-
if (e >=
|
|
2251
|
-
return e - (
|
|
2252
|
-
if (e >=
|
|
2253
|
-
return e - (
|
|
2270
|
+
if (e >= ae.zero && e <= ae.nine)
|
|
2271
|
+
return e - ae.zero;
|
|
2272
|
+
if (e >= ae.A && e <= ae.F)
|
|
2273
|
+
return e - (ae.A - 10);
|
|
2274
|
+
if (e >= ae.a && e <= ae.f)
|
|
2275
|
+
return e - (ae.a - 10);
|
|
2254
2276
|
}
|
|
2255
2277
|
function At(e, t = {}) {
|
|
2256
2278
|
let n = e;
|
|
2257
2279
|
t.size && (se(n, { size: t.size }), n = Ae(n, { dir: "right", size: t.size }));
|
|
2258
2280
|
let r = n.slice(2);
|
|
2259
2281
|
r.length % 2 && (r = `0${r}`);
|
|
2260
|
-
const s = r.length / 2,
|
|
2261
|
-
for (let
|
|
2282
|
+
const s = r.length / 2, a = new Uint8Array(s);
|
|
2283
|
+
for (let i = 0, o = 0; i < s; i++) {
|
|
2262
2284
|
const c = jt(r.charCodeAt(o++)), d = jt(r.charCodeAt(o++));
|
|
2263
2285
|
if (c === void 0 || d === void 0)
|
|
2264
2286
|
throw new f(`Invalid byte sequence ("${r[o - 2]}${r[o - 1]}" in "${r}").`);
|
|
2265
|
-
i
|
|
2287
|
+
a[i] = c * 16 + d;
|
|
2266
2288
|
}
|
|
2267
|
-
return
|
|
2289
|
+
return a;
|
|
2268
2290
|
}
|
|
2269
2291
|
function ds(e, t) {
|
|
2270
|
-
const n =
|
|
2292
|
+
const n = k(e, t);
|
|
2271
2293
|
return At(n);
|
|
2272
2294
|
}
|
|
2273
2295
|
function ln(e, t = {}) {
|
|
@@ -2281,13 +2303,13 @@ function ls(e, t = !1) {
|
|
|
2281
2303
|
function fs(e, t = !1) {
|
|
2282
2304
|
const n = e.length;
|
|
2283
2305
|
let r = new Uint32Array(n), s = new Uint32Array(n);
|
|
2284
|
-
for (let
|
|
2285
|
-
const { h:
|
|
2286
|
-
[r[
|
|
2306
|
+
for (let a = 0; a < n; a++) {
|
|
2307
|
+
const { h: i, l: o } = ls(e[a], t);
|
|
2308
|
+
[r[a], s[a]] = [i, o];
|
|
2287
2309
|
}
|
|
2288
2310
|
return [r, s];
|
|
2289
2311
|
}
|
|
2290
|
-
const ps = (e, t, n) => e << n | t >>> 32 - n,
|
|
2312
|
+
const ps = (e, t, n) => e << n | t >>> 32 - n, ms = (e, t, n) => t << n | e >>> 32 - n, ys = (e, t, n) => t << n - 32 | e >>> 64 - n, bs = (e, t, n) => e << n - 32 | t >>> 64 - n;
|
|
2291
2313
|
function hs(e) {
|
|
2292
2314
|
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
2293
2315
|
}
|
|
@@ -2344,35 +2366,35 @@ function Ss(e) {
|
|
|
2344
2366
|
const t = (r) => e().update(pn(r)).digest(), n = e();
|
|
2345
2367
|
return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
|
|
2346
2368
|
}
|
|
2347
|
-
const As = BigInt(0),
|
|
2348
|
-
for (let e = 0, t =
|
|
2349
|
-
[n, r] = [r, (2 * n + 3 * r) % 5],
|
|
2369
|
+
const As = BigInt(0), ke = BigInt(1), $s = BigInt(2), Cs = BigInt(7), ks = BigInt(256), Is = BigInt(113), mn = [], yn = [], bn = [];
|
|
2370
|
+
for (let e = 0, t = ke, n = 1, r = 0; e < 24; e++) {
|
|
2371
|
+
[n, r] = [r, (2 * n + 3 * r) % 5], mn.push(2 * (5 * r + n)), yn.push((e + 1) * (e + 2) / 2 % 64);
|
|
2350
2372
|
let s = As;
|
|
2351
|
-
for (let
|
|
2352
|
-
t = (t <<
|
|
2353
|
-
|
|
2373
|
+
for (let a = 0; a < 7; a++)
|
|
2374
|
+
t = (t << ke ^ (t >> Cs) * Is) % ks, t & $s && (s ^= ke << (ke << /* @__PURE__ */ BigInt(a)) - ke);
|
|
2375
|
+
bn.push(s);
|
|
2354
2376
|
}
|
|
2355
|
-
const hn = fs(
|
|
2377
|
+
const hn = fs(bn, !0), Ns = hn[0], Rs = hn[1], Ht = (e, t, n) => n > 32 ? ys(e, t, n) : ps(e, t, n), Wt = (e, t, n) => n > 32 ? bs(e, t, n) : ms(e, t, n);
|
|
2356
2378
|
function Ms(e, t = 24) {
|
|
2357
2379
|
const n = new Uint32Array(10);
|
|
2358
2380
|
for (let r = 24 - t; r < 24; r++) {
|
|
2359
|
-
for (let
|
|
2360
|
-
n[
|
|
2361
|
-
for (let
|
|
2362
|
-
const o = (
|
|
2363
|
-
for (let
|
|
2364
|
-
e[
|
|
2381
|
+
for (let i = 0; i < 10; i++)
|
|
2382
|
+
n[i] = e[i] ^ e[i + 10] ^ e[i + 20] ^ e[i + 30] ^ e[i + 40];
|
|
2383
|
+
for (let i = 0; i < 10; i += 2) {
|
|
2384
|
+
const o = (i + 8) % 10, c = (i + 2) % 10, d = n[c], l = n[c + 1], y = Ht(d, l, 1) ^ n[o], p = Wt(d, l, 1) ^ n[o + 1];
|
|
2385
|
+
for (let m = 0; m < 50; m += 10)
|
|
2386
|
+
e[i + m] ^= y, e[i + m + 1] ^= p;
|
|
2365
2387
|
}
|
|
2366
|
-
let s = e[2],
|
|
2367
|
-
for (let
|
|
2368
|
-
const o =
|
|
2369
|
-
s = e[l],
|
|
2388
|
+
let s = e[2], a = e[3];
|
|
2389
|
+
for (let i = 0; i < 24; i++) {
|
|
2390
|
+
const o = yn[i], c = Ht(s, a, o), d = Wt(s, a, o), l = mn[i];
|
|
2391
|
+
s = e[l], a = e[l + 1], e[l] = c, e[l + 1] = d;
|
|
2370
2392
|
}
|
|
2371
|
-
for (let
|
|
2393
|
+
for (let i = 0; i < 50; i += 10) {
|
|
2372
2394
|
for (let o = 0; o < 10; o++)
|
|
2373
|
-
n[o] = e[
|
|
2395
|
+
n[o] = e[i + o];
|
|
2374
2396
|
for (let o = 0; o < 10; o++)
|
|
2375
|
-
e[
|
|
2397
|
+
e[i + o] ^= ~n[(o + 2) % 10] & n[(o + 4) % 10];
|
|
2376
2398
|
}
|
|
2377
2399
|
e[0] ^= Ns[r], e[1] ^= Rs[r];
|
|
2378
2400
|
}
|
|
@@ -2380,8 +2402,8 @@ function Ms(e, t = 24) {
|
|
|
2380
2402
|
}
|
|
2381
2403
|
class $t extends Ps {
|
|
2382
2404
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
2383
|
-
constructor(t, n, r, s = !1,
|
|
2384
|
-
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = t, this.suffix = n, this.outputLen = r, this.enableXOF = s, this.rounds =
|
|
2405
|
+
constructor(t, n, r, s = !1, a = 24) {
|
|
2406
|
+
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = t, this.suffix = n, this.outputLen = r, this.enableXOF = s, this.rounds = a, _t(r), !(0 < t && t < 200))
|
|
2385
2407
|
throw new Error("only keccak-f1600 function is supported");
|
|
2386
2408
|
this.state = new Uint8Array(200), this.state32 = ws(this.state);
|
|
2387
2409
|
}
|
|
@@ -2394,10 +2416,10 @@ class $t extends Ps {
|
|
|
2394
2416
|
update(t) {
|
|
2395
2417
|
Gt(this), t = pn(t), Fe(t);
|
|
2396
2418
|
const { blockLen: n, state: r } = this, s = t.length;
|
|
2397
|
-
for (let
|
|
2398
|
-
const
|
|
2399
|
-
for (let o = 0; o <
|
|
2400
|
-
r[this.pos++] ^= t[
|
|
2419
|
+
for (let a = 0; a < s; ) {
|
|
2420
|
+
const i = Math.min(n - this.pos, s - a);
|
|
2421
|
+
for (let o = 0; o < i; o++)
|
|
2422
|
+
r[this.pos++] ^= t[a++];
|
|
2401
2423
|
this.pos === n && this.keccak();
|
|
2402
2424
|
}
|
|
2403
2425
|
return this;
|
|
@@ -2412,10 +2434,10 @@ class $t extends Ps {
|
|
|
2412
2434
|
writeInto(t) {
|
|
2413
2435
|
Gt(this, !1), Fe(t), this.finish();
|
|
2414
2436
|
const n = this.state, { blockLen: r } = this;
|
|
2415
|
-
for (let s = 0,
|
|
2437
|
+
for (let s = 0, a = t.length; s < a; ) {
|
|
2416
2438
|
this.posOut >= r && this.keccak();
|
|
2417
|
-
const
|
|
2418
|
-
t.set(n.subarray(this.posOut, this.posOut +
|
|
2439
|
+
const i = Math.min(r - this.posOut, a - s);
|
|
2440
|
+
t.set(n.subarray(this.posOut, this.posOut + i), s), this.posOut += i, s += i;
|
|
2419
2441
|
}
|
|
2420
2442
|
return t;
|
|
2421
2443
|
}
|
|
@@ -2439,14 +2461,14 @@ class $t extends Ps {
|
|
|
2439
2461
|
this.destroyed = !0, fn(this.state);
|
|
2440
2462
|
}
|
|
2441
2463
|
_cloneInto(t) {
|
|
2442
|
-
const { blockLen: n, suffix: r, outputLen: s, rounds:
|
|
2443
|
-
return t || (t = new $t(n, r, s,
|
|
2464
|
+
const { blockLen: n, suffix: r, outputLen: s, rounds: a, enableXOF: i } = this;
|
|
2465
|
+
return t || (t = new $t(n, r, s, i, a)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = a, t.suffix = r, t.outputLen = s, t.enableXOF = i, t.destroyed = this.destroyed, t;
|
|
2444
2466
|
}
|
|
2445
2467
|
}
|
|
2446
2468
|
const Ds = (e, t, n) => Ss(() => new $t(t, e, n)), Os = Ds(1, 136, 256 / 8);
|
|
2447
2469
|
function gn(e, t) {
|
|
2448
2470
|
const n = t || "hex", r = Os(Re(e, { strict: !1 }) ? dn(e) : e);
|
|
2449
|
-
return n === "bytes" ? r :
|
|
2471
|
+
return n === "bytes" ? r : is(r);
|
|
2450
2472
|
}
|
|
2451
2473
|
class wn extends Map {
|
|
2452
2474
|
constructor(t) {
|
|
@@ -2482,10 +2504,10 @@ function xn(e, t) {
|
|
|
2482
2504
|
if (qe.has(`${e}.${t}`))
|
|
2483
2505
|
return qe.get(`${e}.${t}`);
|
|
2484
2506
|
const n = e.substring(2).toLowerCase(), r = gn(ln(n), "bytes"), s = n.split("");
|
|
2485
|
-
for (let
|
|
2486
|
-
r[
|
|
2487
|
-
const
|
|
2488
|
-
return qe.set(`${e}.${t}`,
|
|
2507
|
+
for (let i = 0; i < 40; i += 2)
|
|
2508
|
+
r[i >> 1] >> 4 >= 8 && s[i] && (s[i] = s[i].toUpperCase()), (r[i >> 1] & 15) >= 8 && s[i + 1] && (s[i + 1] = s[i + 1].toUpperCase());
|
|
2509
|
+
const a = `0x${s.join("")}`;
|
|
2510
|
+
return qe.set(`${e}.${t}`, a), a;
|
|
2489
2511
|
}
|
|
2490
2512
|
class Kt extends f {
|
|
2491
2513
|
constructor({ offset: t }) {
|
|
@@ -2709,23 +2731,23 @@ function Pn(e, t) {
|
|
|
2709
2731
|
const n = Ks({
|
|
2710
2732
|
params: e,
|
|
2711
2733
|
values: t
|
|
2712
|
-
}), r =
|
|
2734
|
+
}), r = It(n);
|
|
2713
2735
|
return r.length === 0 ? "0x" : r;
|
|
2714
2736
|
}
|
|
2715
2737
|
function Ks({ params: e, values: t }) {
|
|
2716
2738
|
const n = [];
|
|
2717
2739
|
for (let r = 0; r < e.length; r++)
|
|
2718
|
-
n.push(
|
|
2740
|
+
n.push(kt({ param: e[r], value: t[r] }));
|
|
2719
2741
|
return n;
|
|
2720
2742
|
}
|
|
2721
|
-
function
|
|
2743
|
+
function kt({ param: e, value: t }) {
|
|
2722
2744
|
const n = Nt(e.type);
|
|
2723
2745
|
if (n) {
|
|
2724
2746
|
const [r, s] = n;
|
|
2725
2747
|
return Zs(t, { length: r, param: { ...e, type: s } });
|
|
2726
2748
|
}
|
|
2727
2749
|
if (e.type === "tuple")
|
|
2728
|
-
return
|
|
2750
|
+
return ea(t, {
|
|
2729
2751
|
param: e
|
|
2730
2752
|
});
|
|
2731
2753
|
if (e.type === "address")
|
|
@@ -2747,17 +2769,17 @@ function It({ param: e, value: t }) {
|
|
|
2747
2769
|
docsPath: "/docs/contract/encodeAbiParameters"
|
|
2748
2770
|
});
|
|
2749
2771
|
}
|
|
2750
|
-
function
|
|
2772
|
+
function It(e) {
|
|
2751
2773
|
let t = 0;
|
|
2752
|
-
for (let
|
|
2753
|
-
const { dynamic:
|
|
2754
|
-
|
|
2774
|
+
for (let a = 0; a < e.length; a++) {
|
|
2775
|
+
const { dynamic: i, encoded: o } = e[a];
|
|
2776
|
+
i ? t += 32 : t += B(o);
|
|
2755
2777
|
}
|
|
2756
2778
|
const n = [], r = [];
|
|
2757
2779
|
let s = 0;
|
|
2758
|
-
for (let
|
|
2759
|
-
const { dynamic:
|
|
2760
|
-
|
|
2780
|
+
for (let a = 0; a < e.length; a++) {
|
|
2781
|
+
const { dynamic: i, encoded: o } = e[a];
|
|
2782
|
+
i ? (n.push(k(t + s, { size: 32 })), r.push(o), s += B(o)) : n.push(o);
|
|
2761
2783
|
}
|
|
2762
2784
|
return Se([...n, ...r]);
|
|
2763
2785
|
}
|
|
@@ -2777,26 +2799,26 @@ function Zs(e, { length: t, param: n }) {
|
|
|
2777
2799
|
type: `${n.type}[${t}]`
|
|
2778
2800
|
});
|
|
2779
2801
|
let s = !1;
|
|
2780
|
-
const
|
|
2781
|
-
for (let
|
|
2782
|
-
const o =
|
|
2783
|
-
o.dynamic && (s = !0),
|
|
2802
|
+
const a = [];
|
|
2803
|
+
for (let i = 0; i < e.length; i++) {
|
|
2804
|
+
const o = kt({ param: n, value: e[i] });
|
|
2805
|
+
o.dynamic && (s = !0), a.push(o);
|
|
2784
2806
|
}
|
|
2785
2807
|
if (r || s) {
|
|
2786
|
-
const
|
|
2808
|
+
const i = It(a);
|
|
2787
2809
|
if (r) {
|
|
2788
|
-
const o =
|
|
2810
|
+
const o = k(a.length, { size: 32 });
|
|
2789
2811
|
return {
|
|
2790
2812
|
dynamic: !0,
|
|
2791
|
-
encoded:
|
|
2813
|
+
encoded: a.length > 0 ? Se([o, i]) : o
|
|
2792
2814
|
};
|
|
2793
2815
|
}
|
|
2794
2816
|
if (s)
|
|
2795
|
-
return { dynamic: !0, encoded:
|
|
2817
|
+
return { dynamic: !0, encoded: i };
|
|
2796
2818
|
}
|
|
2797
2819
|
return {
|
|
2798
2820
|
dynamic: !1,
|
|
2799
|
-
encoded: Se(
|
|
2821
|
+
encoded: Se(a.map(({ encoded: i }) => i))
|
|
2800
2822
|
};
|
|
2801
2823
|
}
|
|
2802
2824
|
function Xs(e, { param: t }) {
|
|
@@ -2808,7 +2830,7 @@ function Xs(e, { param: t }) {
|
|
|
2808
2830
|
size: Math.ceil((e.length - 2) / 2 / 32) * 32
|
|
2809
2831
|
})), {
|
|
2810
2832
|
dynamic: !0,
|
|
2811
|
-
encoded: Se([pe(
|
|
2833
|
+
encoded: Se([pe(k(r, { size: 32 })), s])
|
|
2812
2834
|
};
|
|
2813
2835
|
}
|
|
2814
2836
|
if (r !== Number.parseInt(n, 10))
|
|
@@ -2837,7 +2859,7 @@ function Qs(e, { signed: t, size: n = 256 }) {
|
|
|
2837
2859
|
}
|
|
2838
2860
|
return {
|
|
2839
2861
|
dynamic: !1,
|
|
2840
|
-
encoded:
|
|
2862
|
+
encoded: k(e, {
|
|
2841
2863
|
size: 32,
|
|
2842
2864
|
signed: t
|
|
2843
2865
|
})
|
|
@@ -2852,24 +2874,24 @@ function qs(e) {
|
|
|
2852
2874
|
return {
|
|
2853
2875
|
dynamic: !0,
|
|
2854
2876
|
encoded: Se([
|
|
2855
|
-
pe(
|
|
2877
|
+
pe(k(B(t), { size: 32 })),
|
|
2856
2878
|
...r
|
|
2857
2879
|
])
|
|
2858
2880
|
};
|
|
2859
2881
|
}
|
|
2860
|
-
function
|
|
2882
|
+
function ea(e, { param: t }) {
|
|
2861
2883
|
let n = !1;
|
|
2862
2884
|
const r = [];
|
|
2863
2885
|
for (let s = 0; s < t.components.length; s++) {
|
|
2864
|
-
const
|
|
2865
|
-
param:
|
|
2866
|
-
value: e[
|
|
2886
|
+
const a = t.components[s], i = Array.isArray(e) ? s : a.name, o = kt({
|
|
2887
|
+
param: a,
|
|
2888
|
+
value: e[i]
|
|
2867
2889
|
});
|
|
2868
2890
|
r.push(o), o.dynamic && (n = !0);
|
|
2869
2891
|
}
|
|
2870
2892
|
return {
|
|
2871
2893
|
dynamic: n,
|
|
2872
|
-
encoded: n ?
|
|
2894
|
+
encoded: n ? It(r) : Se(r.map(({ encoded: s }) => s))
|
|
2873
2895
|
};
|
|
2874
2896
|
}
|
|
2875
2897
|
function Nt(e) {
|
|
@@ -2890,62 +2912,62 @@ function Sn(e, t) {
|
|
|
2890
2912
|
size: B(t)
|
|
2891
2913
|
});
|
|
2892
2914
|
let s = 0;
|
|
2893
|
-
const
|
|
2894
|
-
for (let
|
|
2895
|
-
const o = e[
|
|
2915
|
+
const a = [];
|
|
2916
|
+
for (let i = 0; i < e.length; ++i) {
|
|
2917
|
+
const o = e[i];
|
|
2896
2918
|
r.setPosition(s);
|
|
2897
2919
|
const [c, d] = Ee(r, o, {
|
|
2898
2920
|
staticPosition: 0
|
|
2899
2921
|
});
|
|
2900
|
-
s += d,
|
|
2922
|
+
s += d, a.push(c);
|
|
2901
2923
|
}
|
|
2902
|
-
return
|
|
2924
|
+
return a;
|
|
2903
2925
|
}
|
|
2904
2926
|
function Ee(e, t, { staticPosition: n }) {
|
|
2905
2927
|
const r = Nt(t.type);
|
|
2906
2928
|
if (r) {
|
|
2907
|
-
const [s,
|
|
2908
|
-
return
|
|
2929
|
+
const [s, a] = r;
|
|
2930
|
+
return na(e, { ...t, type: a }, { length: s, staticPosition: n });
|
|
2909
2931
|
}
|
|
2910
2932
|
if (t.type === "tuple")
|
|
2911
|
-
return
|
|
2933
|
+
return ia(e, t, { staticPosition: n });
|
|
2912
2934
|
if (t.type === "address")
|
|
2913
|
-
return
|
|
2935
|
+
return ta(e);
|
|
2914
2936
|
if (t.type === "bool")
|
|
2915
|
-
return
|
|
2937
|
+
return ra(e);
|
|
2916
2938
|
if (t.type.startsWith("bytes"))
|
|
2917
|
-
return
|
|
2939
|
+
return sa(e, t, { staticPosition: n });
|
|
2918
2940
|
if (t.type.startsWith("uint") || t.type.startsWith("int"))
|
|
2919
|
-
return
|
|
2941
|
+
return aa(e, t);
|
|
2920
2942
|
if (t.type === "string")
|
|
2921
|
-
return
|
|
2943
|
+
return oa(e, { staticPosition: n });
|
|
2922
2944
|
throw new Qr(t.type, {
|
|
2923
2945
|
docsPath: "/docs/contract/decodeAbiParameters"
|
|
2924
2946
|
});
|
|
2925
2947
|
}
|
|
2926
|
-
const Yt = 32,
|
|
2927
|
-
function
|
|
2948
|
+
const Yt = 32, at = 32;
|
|
2949
|
+
function ta(e) {
|
|
2928
2950
|
const t = e.readBytes(32);
|
|
2929
2951
|
return [xn(ue(En(t, -20))), 32];
|
|
2930
2952
|
}
|
|
2931
|
-
function
|
|
2953
|
+
function na(e, t, { length: n, staticPosition: r }) {
|
|
2932
2954
|
if (!n) {
|
|
2933
|
-
const
|
|
2955
|
+
const i = ce(e.readBytes(at)), o = r + i, c = o + Yt;
|
|
2934
2956
|
e.setPosition(o);
|
|
2935
2957
|
const d = ce(e.readBytes(Yt)), l = Ne(t);
|
|
2936
|
-
let
|
|
2958
|
+
let y = 0;
|
|
2937
2959
|
const p = [];
|
|
2938
|
-
for (let
|
|
2939
|
-
e.setPosition(c + (l ?
|
|
2960
|
+
for (let m = 0; m < d; ++m) {
|
|
2961
|
+
e.setPosition(c + (l ? m * 32 : y));
|
|
2940
2962
|
const [h, v] = Ee(e, t, {
|
|
2941
2963
|
staticPosition: c
|
|
2942
2964
|
});
|
|
2943
|
-
|
|
2965
|
+
y += v, p.push(h);
|
|
2944
2966
|
}
|
|
2945
2967
|
return e.setPosition(r + 32), [p, 32];
|
|
2946
2968
|
}
|
|
2947
2969
|
if (Ne(t)) {
|
|
2948
|
-
const
|
|
2970
|
+
const i = ce(e.readBytes(at)), o = r + i, c = [];
|
|
2949
2971
|
for (let d = 0; d < n; ++d) {
|
|
2950
2972
|
e.setPosition(o + d * 32);
|
|
2951
2973
|
const [l] = Ee(e, t, {
|
|
@@ -2956,23 +2978,23 @@ function ni(e, t, { length: n, staticPosition: r }) {
|
|
|
2956
2978
|
return e.setPosition(r + 32), [c, 32];
|
|
2957
2979
|
}
|
|
2958
2980
|
let s = 0;
|
|
2959
|
-
const
|
|
2960
|
-
for (let
|
|
2981
|
+
const a = [];
|
|
2982
|
+
for (let i = 0; i < n; ++i) {
|
|
2961
2983
|
const [o, c] = Ee(e, t, {
|
|
2962
2984
|
staticPosition: r + s
|
|
2963
2985
|
});
|
|
2964
|
-
s += c,
|
|
2986
|
+
s += c, a.push(o);
|
|
2965
2987
|
}
|
|
2966
|
-
return [
|
|
2988
|
+
return [a, s];
|
|
2967
2989
|
}
|
|
2968
|
-
function
|
|
2990
|
+
function ra(e) {
|
|
2969
2991
|
return [Gs(e.readBytes(32), { size: 32 }), 32];
|
|
2970
2992
|
}
|
|
2971
|
-
function
|
|
2993
|
+
function sa(e, t, { staticPosition: n }) {
|
|
2972
2994
|
const [r, s] = t.type.split("bytes");
|
|
2973
2995
|
if (!s) {
|
|
2974
|
-
const
|
|
2975
|
-
e.setPosition(n +
|
|
2996
|
+
const i = ce(e.readBytes(32));
|
|
2997
|
+
e.setPosition(n + i);
|
|
2976
2998
|
const o = ce(e.readBytes(32));
|
|
2977
2999
|
if (o === 0)
|
|
2978
3000
|
return e.setPosition(n + 32), ["0x", 32];
|
|
@@ -2981,44 +3003,44 @@ function si(e, t, { staticPosition: n }) {
|
|
|
2981
3003
|
}
|
|
2982
3004
|
return [ue(e.readBytes(Number.parseInt(s, 10), 32)), 32];
|
|
2983
3005
|
}
|
|
2984
|
-
function
|
|
3006
|
+
function aa(e, t) {
|
|
2985
3007
|
const n = t.type.startsWith("int"), r = Number.parseInt(t.type.split("int")[1] || "256", 10), s = e.readBytes(32);
|
|
2986
3008
|
return [
|
|
2987
3009
|
r > 48 ? _s(s, { signed: n }) : ce(s, { signed: n }),
|
|
2988
3010
|
32
|
|
2989
3011
|
];
|
|
2990
3012
|
}
|
|
2991
|
-
function
|
|
2992
|
-
const r = t.components.length === 0 || t.components.some(({ name:
|
|
2993
|
-
let
|
|
3013
|
+
function ia(e, t, { staticPosition: n }) {
|
|
3014
|
+
const r = t.components.length === 0 || t.components.some(({ name: i }) => !i), s = r ? [] : {};
|
|
3015
|
+
let a = 0;
|
|
2994
3016
|
if (Ne(t)) {
|
|
2995
|
-
const
|
|
3017
|
+
const i = ce(e.readBytes(at)), o = n + i;
|
|
2996
3018
|
for (let c = 0; c < t.components.length; ++c) {
|
|
2997
3019
|
const d = t.components[c];
|
|
2998
|
-
e.setPosition(o +
|
|
2999
|
-
const [l,
|
|
3020
|
+
e.setPosition(o + a);
|
|
3021
|
+
const [l, y] = Ee(e, d, {
|
|
3000
3022
|
staticPosition: o
|
|
3001
3023
|
});
|
|
3002
|
-
|
|
3024
|
+
a += y, s[r ? c : d?.name] = l;
|
|
3003
3025
|
}
|
|
3004
3026
|
return e.setPosition(n + 32), [s, 32];
|
|
3005
3027
|
}
|
|
3006
|
-
for (let
|
|
3007
|
-
const o = t.components[
|
|
3028
|
+
for (let i = 0; i < t.components.length; ++i) {
|
|
3029
|
+
const o = t.components[i], [c, d] = Ee(e, o, {
|
|
3008
3030
|
staticPosition: n
|
|
3009
3031
|
});
|
|
3010
|
-
s[r ?
|
|
3032
|
+
s[r ? i : o?.name] = c, a += d;
|
|
3011
3033
|
}
|
|
3012
|
-
return [s,
|
|
3034
|
+
return [s, a];
|
|
3013
3035
|
}
|
|
3014
|
-
function
|
|
3036
|
+
function oa(e, { staticPosition: t }) {
|
|
3015
3037
|
const n = ce(e.readBytes(32)), r = t + n;
|
|
3016
3038
|
e.setPosition(r);
|
|
3017
3039
|
const s = ce(e.readBytes(32));
|
|
3018
3040
|
if (s === 0)
|
|
3019
3041
|
return e.setPosition(t + 32), ["", 32];
|
|
3020
|
-
const
|
|
3021
|
-
return e.setPosition(t + 32), [
|
|
3042
|
+
const a = e.readBytes(s, 32), i = Vs(St(a));
|
|
3043
|
+
return e.setPosition(t + 32), [i, 32];
|
|
3022
3044
|
}
|
|
3023
3045
|
function Ne(e) {
|
|
3024
3046
|
const { type: t } = e;
|
|
@@ -3029,23 +3051,23 @@ function Ne(e) {
|
|
|
3029
3051
|
const n = Nt(e.type);
|
|
3030
3052
|
return !!(n && Ne({ ...e, type: n[1] }));
|
|
3031
3053
|
}
|
|
3032
|
-
const
|
|
3033
|
-
function
|
|
3034
|
-
return
|
|
3054
|
+
const ca = (e) => gn(dn(e));
|
|
3055
|
+
function ua(e) {
|
|
3056
|
+
return ca(e);
|
|
3035
3057
|
}
|
|
3036
|
-
const
|
|
3037
|
-
let X = class
|
|
3058
|
+
const da = "1.2.3";
|
|
3059
|
+
let X = class it extends Error {
|
|
3038
3060
|
constructor(t, n = {}) {
|
|
3039
|
-
const r = n.cause instanceof
|
|
3061
|
+
const r = n.cause instanceof it ? n.cause.details : n.cause?.message ? n.cause.message : n.details, s = n.cause instanceof it && n.cause.docsPath || n.docsPath, a = [
|
|
3040
3062
|
t || "An error occurred.",
|
|
3041
3063
|
"",
|
|
3042
3064
|
...n.metaMessages ? [...n.metaMessages, ""] : [],
|
|
3043
3065
|
...s ? [`Docs: https://abitype.dev${s}`] : [],
|
|
3044
3066
|
...r ? [`Details: ${r}`] : [],
|
|
3045
|
-
`Version: abitype@${
|
|
3067
|
+
`Version: abitype@${da}`
|
|
3046
3068
|
].join(`
|
|
3047
3069
|
`);
|
|
3048
|
-
super(
|
|
3070
|
+
super(a), Object.defineProperty(this, "details", {
|
|
3049
3071
|
enumerable: !0,
|
|
3050
3072
|
configurable: !0,
|
|
3051
3073
|
writable: !0,
|
|
@@ -3083,8 +3105,8 @@ function ot(e) {
|
|
|
3083
3105
|
t = "(";
|
|
3084
3106
|
const n = e.components.length;
|
|
3085
3107
|
for (let s = 0; s < n; s++) {
|
|
3086
|
-
const
|
|
3087
|
-
t += ot(
|
|
3108
|
+
const a = e.components[s];
|
|
3109
|
+
t += ot(a), s < n - 1 && (t += ", ");
|
|
3088
3110
|
}
|
|
3089
3111
|
const r = de(Zt, e.type);
|
|
3090
3112
|
return t += `)${r?.array || ""}`, ot({
|
|
@@ -3094,7 +3116,7 @@ function ot(e) {
|
|
|
3094
3116
|
}
|
|
3095
3117
|
return "indexed" in e && e.indexed && (t = `${t} indexed`), e.name ? `${t} ${e.name}` : t;
|
|
3096
3118
|
}
|
|
3097
|
-
function
|
|
3119
|
+
function Ie(e) {
|
|
3098
3120
|
let t = "";
|
|
3099
3121
|
const n = e.length;
|
|
3100
3122
|
for (let r = 0; r < n; r++) {
|
|
@@ -3103,61 +3125,61 @@ function ke(e) {
|
|
|
3103
3125
|
}
|
|
3104
3126
|
return t;
|
|
3105
3127
|
}
|
|
3106
|
-
function
|
|
3107
|
-
return e.type === "function" ? `function ${e.name}(${
|
|
3108
|
-
}
|
|
3109
|
-
const In = /^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
|
|
3110
|
-
function fi(e) {
|
|
3111
|
-
return In.test(e);
|
|
3112
|
-
}
|
|
3113
|
-
function pi(e) {
|
|
3114
|
-
return de(In, e);
|
|
3128
|
+
function la(e) {
|
|
3129
|
+
return e.type === "function" ? `function ${e.name}(${Ie(e.inputs)})${e.stateMutability && e.stateMutability !== "nonpayable" ? ` ${e.stateMutability}` : ""}${e.outputs?.length ? ` returns (${Ie(e.outputs)})` : ""}` : e.type === "event" ? `event ${e.name}(${Ie(e.inputs)})` : e.type === "error" ? `error ${e.name}(${Ie(e.inputs)})` : e.type === "constructor" ? `constructor(${Ie(e.inputs)})${e.stateMutability === "payable" ? " payable" : ""}` : e.type === "fallback" ? `fallback() external${e.stateMutability === "payable" ? " payable" : ""}` : "receive() external payable";
|
|
3115
3130
|
}
|
|
3116
|
-
const kn = /^
|
|
3117
|
-
function
|
|
3131
|
+
const kn = /^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
|
|
3132
|
+
function fa(e) {
|
|
3118
3133
|
return kn.test(e);
|
|
3119
3134
|
}
|
|
3120
|
-
function
|
|
3135
|
+
function pa(e) {
|
|
3121
3136
|
return de(kn, e);
|
|
3122
3137
|
}
|
|
3138
|
+
const In = /^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
|
|
3139
|
+
function ma(e) {
|
|
3140
|
+
return In.test(e);
|
|
3141
|
+
}
|
|
3142
|
+
function ya(e) {
|
|
3143
|
+
return de(In, e);
|
|
3144
|
+
}
|
|
3123
3145
|
const Nn = /^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;
|
|
3124
|
-
function
|
|
3146
|
+
function ba(e) {
|
|
3125
3147
|
return Nn.test(e);
|
|
3126
3148
|
}
|
|
3127
|
-
function
|
|
3149
|
+
function ha(e) {
|
|
3128
3150
|
return de(Nn, e);
|
|
3129
3151
|
}
|
|
3130
3152
|
const Rn = /^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;
|
|
3131
3153
|
function Mn(e) {
|
|
3132
3154
|
return Rn.test(e);
|
|
3133
3155
|
}
|
|
3134
|
-
function
|
|
3156
|
+
function ga(e) {
|
|
3135
3157
|
return de(Rn, e);
|
|
3136
3158
|
}
|
|
3137
3159
|
const Dn = /^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;
|
|
3138
|
-
function
|
|
3160
|
+
function wa(e) {
|
|
3139
3161
|
return Dn.test(e);
|
|
3140
3162
|
}
|
|
3141
|
-
function
|
|
3163
|
+
function xa(e) {
|
|
3142
3164
|
return de(Dn, e);
|
|
3143
3165
|
}
|
|
3144
3166
|
const On = /^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;
|
|
3145
|
-
function
|
|
3167
|
+
function Ta(e) {
|
|
3146
3168
|
return On.test(e);
|
|
3147
3169
|
}
|
|
3148
|
-
function
|
|
3170
|
+
function va(e) {
|
|
3149
3171
|
return de(On, e);
|
|
3150
3172
|
}
|
|
3151
|
-
const
|
|
3152
|
-
function
|
|
3153
|
-
return
|
|
3173
|
+
const Ea = /^receive\(\) external payable$/;
|
|
3174
|
+
function Pa(e) {
|
|
3175
|
+
return Ea.test(e);
|
|
3154
3176
|
}
|
|
3155
|
-
const
|
|
3177
|
+
const Sa = /* @__PURE__ */ new Set(["indexed"]), ct = /* @__PURE__ */ new Set([
|
|
3156
3178
|
"calldata",
|
|
3157
3179
|
"memory",
|
|
3158
3180
|
"storage"
|
|
3159
3181
|
]);
|
|
3160
|
-
class
|
|
3182
|
+
class Aa extends X {
|
|
3161
3183
|
constructor({ type: t }) {
|
|
3162
3184
|
super("Unknown type.", {
|
|
3163
3185
|
metaMessages: [
|
|
@@ -3171,7 +3193,7 @@ class Ai extends X {
|
|
|
3171
3193
|
});
|
|
3172
3194
|
}
|
|
3173
3195
|
}
|
|
3174
|
-
class $
|
|
3196
|
+
class $a extends X {
|
|
3175
3197
|
constructor({ type: t }) {
|
|
3176
3198
|
super("Unknown type.", {
|
|
3177
3199
|
metaMessages: [`Type "${t}" is not a valid ABI type.`]
|
|
@@ -3183,7 +3205,7 @@ class $i extends X {
|
|
|
3183
3205
|
});
|
|
3184
3206
|
}
|
|
3185
3207
|
}
|
|
3186
|
-
class
|
|
3208
|
+
class Ca extends X {
|
|
3187
3209
|
constructor({ param: t }) {
|
|
3188
3210
|
super("Invalid ABI parameter.", {
|
|
3189
3211
|
details: t
|
|
@@ -3195,7 +3217,7 @@ class Ci extends X {
|
|
|
3195
3217
|
});
|
|
3196
3218
|
}
|
|
3197
3219
|
}
|
|
3198
|
-
class
|
|
3220
|
+
class ka extends X {
|
|
3199
3221
|
constructor({ param: t, name: n }) {
|
|
3200
3222
|
super("Invalid ABI parameter.", {
|
|
3201
3223
|
details: t,
|
|
@@ -3210,7 +3232,7 @@ class Ii extends X {
|
|
|
3210
3232
|
});
|
|
3211
3233
|
}
|
|
3212
3234
|
}
|
|
3213
|
-
class
|
|
3235
|
+
class Ia extends X {
|
|
3214
3236
|
constructor({ param: t, type: n, modifier: r }) {
|
|
3215
3237
|
super("Invalid ABI parameter.", {
|
|
3216
3238
|
details: t,
|
|
@@ -3225,7 +3247,7 @@ class ki extends X {
|
|
|
3225
3247
|
});
|
|
3226
3248
|
}
|
|
3227
3249
|
}
|
|
3228
|
-
class
|
|
3250
|
+
class Na extends X {
|
|
3229
3251
|
constructor({ param: t, type: n, modifier: r }) {
|
|
3230
3252
|
super("Invalid ABI parameter.", {
|
|
3231
3253
|
details: t,
|
|
@@ -3241,7 +3263,7 @@ class Ni extends X {
|
|
|
3241
3263
|
});
|
|
3242
3264
|
}
|
|
3243
3265
|
}
|
|
3244
|
-
class
|
|
3266
|
+
class Ra extends X {
|
|
3245
3267
|
constructor({ abiParameter: t }) {
|
|
3246
3268
|
super("Invalid ABI parameter.", {
|
|
3247
3269
|
details: JSON.stringify(t, null, 2),
|
|
@@ -3266,7 +3288,7 @@ class $e extends X {
|
|
|
3266
3288
|
});
|
|
3267
3289
|
}
|
|
3268
3290
|
}
|
|
3269
|
-
class
|
|
3291
|
+
class Ma extends X {
|
|
3270
3292
|
constructor({ signature: t }) {
|
|
3271
3293
|
super("Unknown signature.", {
|
|
3272
3294
|
details: t
|
|
@@ -3278,7 +3300,7 @@ class Mi extends X {
|
|
|
3278
3300
|
});
|
|
3279
3301
|
}
|
|
3280
3302
|
}
|
|
3281
|
-
class
|
|
3303
|
+
class Da extends X {
|
|
3282
3304
|
constructor({ signature: t }) {
|
|
3283
3305
|
super("Invalid struct signature.", {
|
|
3284
3306
|
details: t,
|
|
@@ -3291,7 +3313,7 @@ class Di extends X {
|
|
|
3291
3313
|
});
|
|
3292
3314
|
}
|
|
3293
3315
|
}
|
|
3294
|
-
class
|
|
3316
|
+
class Oa extends X {
|
|
3295
3317
|
constructor({ type: t }) {
|
|
3296
3318
|
super("Circular reference detected.", {
|
|
3297
3319
|
metaMessages: [`Struct "${t}" is a circular reference.`]
|
|
@@ -3303,7 +3325,7 @@ class Oi extends X {
|
|
|
3303
3325
|
});
|
|
3304
3326
|
}
|
|
3305
3327
|
}
|
|
3306
|
-
class
|
|
3328
|
+
class Ba extends X {
|
|
3307
3329
|
constructor({ current: t, depth: n }) {
|
|
3308
3330
|
super("Unbalanced parentheses.", {
|
|
3309
3331
|
metaMessages: [
|
|
@@ -3318,16 +3340,16 @@ class Bi extends X {
|
|
|
3318
3340
|
});
|
|
3319
3341
|
}
|
|
3320
3342
|
}
|
|
3321
|
-
function
|
|
3343
|
+
function Ua(e, t, n) {
|
|
3322
3344
|
let r = "";
|
|
3323
3345
|
if (n)
|
|
3324
3346
|
for (const s of Object.entries(n)) {
|
|
3325
3347
|
if (!s)
|
|
3326
3348
|
continue;
|
|
3327
|
-
let
|
|
3328
|
-
for (const
|
|
3329
|
-
|
|
3330
|
-
r += `(${s[0]}{${
|
|
3349
|
+
let a = "";
|
|
3350
|
+
for (const i of s[1])
|
|
3351
|
+
a += `[${i.type}${i.name ? `:${i.name}` : ""}]`;
|
|
3352
|
+
r += `(${s[0]}{${a}})`;
|
|
3331
3353
|
}
|
|
3332
3354
|
return t ? `${t}:${e}${r}` : `${e}${r}`;
|
|
3333
3355
|
}
|
|
@@ -3385,40 +3407,40 @@ const et = /* @__PURE__ */ new Map([
|
|
|
3385
3407
|
{ type: "uint256", name: "tokenId", indexed: !0 }
|
|
3386
3408
|
]
|
|
3387
3409
|
]);
|
|
3388
|
-
function
|
|
3389
|
-
if (
|
|
3390
|
-
return
|
|
3391
|
-
if (
|
|
3392
|
-
return
|
|
3393
|
-
if (
|
|
3394
|
-
return
|
|
3395
|
-
if (
|
|
3396
|
-
return
|
|
3397
|
-
if (
|
|
3398
|
-
return
|
|
3399
|
-
if (
|
|
3410
|
+
function La(e, t = {}) {
|
|
3411
|
+
if (ba(e))
|
|
3412
|
+
return Fa(e, t);
|
|
3413
|
+
if (ma(e))
|
|
3414
|
+
return ja(e, t);
|
|
3415
|
+
if (fa(e))
|
|
3416
|
+
return za(e, t);
|
|
3417
|
+
if (wa(e))
|
|
3418
|
+
return _a(e, t);
|
|
3419
|
+
if (Ta(e))
|
|
3420
|
+
return Ga(e);
|
|
3421
|
+
if (Pa(e))
|
|
3400
3422
|
return {
|
|
3401
3423
|
type: "receive",
|
|
3402
3424
|
stateMutability: "payable"
|
|
3403
3425
|
};
|
|
3404
|
-
throw new
|
|
3426
|
+
throw new Ma({ signature: e });
|
|
3405
3427
|
}
|
|
3406
|
-
function
|
|
3407
|
-
const n =
|
|
3428
|
+
function Fa(e, t = {}) {
|
|
3429
|
+
const n = ha(e);
|
|
3408
3430
|
if (!n)
|
|
3409
3431
|
throw new $e({ signature: e, type: "function" });
|
|
3410
|
-
const r = ne(n.parameters), s = [],
|
|
3411
|
-
for (let o = 0; o <
|
|
3432
|
+
const r = ne(n.parameters), s = [], a = r.length;
|
|
3433
|
+
for (let o = 0; o < a; o++)
|
|
3412
3434
|
s.push(we(r[o], {
|
|
3413
3435
|
modifiers: ct,
|
|
3414
3436
|
structs: t,
|
|
3415
3437
|
type: "function"
|
|
3416
3438
|
}));
|
|
3417
|
-
const
|
|
3439
|
+
const i = [];
|
|
3418
3440
|
if (n.returns) {
|
|
3419
3441
|
const o = ne(n.returns), c = o.length;
|
|
3420
3442
|
for (let d = 0; d < c; d++)
|
|
3421
|
-
|
|
3443
|
+
i.push(we(o[d], {
|
|
3422
3444
|
modifiers: ct,
|
|
3423
3445
|
structs: t,
|
|
3424
3446
|
type: "function"
|
|
@@ -3429,46 +3451,46 @@ function Fi(e, t = {}) {
|
|
|
3429
3451
|
type: "function",
|
|
3430
3452
|
stateMutability: n.stateMutability ?? "nonpayable",
|
|
3431
3453
|
inputs: s,
|
|
3432
|
-
outputs:
|
|
3454
|
+
outputs: i
|
|
3433
3455
|
};
|
|
3434
3456
|
}
|
|
3435
|
-
function
|
|
3436
|
-
const n =
|
|
3457
|
+
function ja(e, t = {}) {
|
|
3458
|
+
const n = ya(e);
|
|
3437
3459
|
if (!n)
|
|
3438
3460
|
throw new $e({ signature: e, type: "event" });
|
|
3439
|
-
const r = ne(n.parameters), s = [],
|
|
3440
|
-
for (let
|
|
3441
|
-
s.push(we(r[
|
|
3442
|
-
modifiers:
|
|
3461
|
+
const r = ne(n.parameters), s = [], a = r.length;
|
|
3462
|
+
for (let i = 0; i < a; i++)
|
|
3463
|
+
s.push(we(r[i], {
|
|
3464
|
+
modifiers: Sa,
|
|
3443
3465
|
structs: t,
|
|
3444
3466
|
type: "event"
|
|
3445
3467
|
}));
|
|
3446
3468
|
return { name: n.name, type: "event", inputs: s };
|
|
3447
3469
|
}
|
|
3448
|
-
function
|
|
3449
|
-
const n =
|
|
3470
|
+
function za(e, t = {}) {
|
|
3471
|
+
const n = pa(e);
|
|
3450
3472
|
if (!n)
|
|
3451
3473
|
throw new $e({ signature: e, type: "error" });
|
|
3452
|
-
const r = ne(n.parameters), s = [],
|
|
3453
|
-
for (let
|
|
3454
|
-
s.push(we(r[
|
|
3474
|
+
const r = ne(n.parameters), s = [], a = r.length;
|
|
3475
|
+
for (let i = 0; i < a; i++)
|
|
3476
|
+
s.push(we(r[i], { structs: t, type: "error" }));
|
|
3455
3477
|
return { name: n.name, type: "error", inputs: s };
|
|
3456
3478
|
}
|
|
3457
|
-
function
|
|
3458
|
-
const n =
|
|
3479
|
+
function _a(e, t = {}) {
|
|
3480
|
+
const n = xa(e);
|
|
3459
3481
|
if (!n)
|
|
3460
3482
|
throw new $e({ signature: e, type: "constructor" });
|
|
3461
|
-
const r = ne(n.parameters), s = [],
|
|
3462
|
-
for (let
|
|
3463
|
-
s.push(we(r[
|
|
3483
|
+
const r = ne(n.parameters), s = [], a = r.length;
|
|
3484
|
+
for (let i = 0; i < a; i++)
|
|
3485
|
+
s.push(we(r[i], { structs: t, type: "constructor" }));
|
|
3464
3486
|
return {
|
|
3465
3487
|
type: "constructor",
|
|
3466
3488
|
stateMutability: n.stateMutability ?? "nonpayable",
|
|
3467
3489
|
inputs: s
|
|
3468
3490
|
};
|
|
3469
3491
|
}
|
|
3470
|
-
function
|
|
3471
|
-
const t =
|
|
3492
|
+
function Ga(e) {
|
|
3493
|
+
const t = va(e);
|
|
3472
3494
|
if (!t)
|
|
3473
3495
|
throw new $e({ signature: e, type: "fallback" });
|
|
3474
3496
|
return {
|
|
@@ -3476,41 +3498,41 @@ function Gi(e) {
|
|
|
3476
3498
|
stateMutability: t.stateMutability ?? "nonpayable"
|
|
3477
3499
|
};
|
|
3478
3500
|
}
|
|
3479
|
-
const
|
|
3501
|
+
const Va = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, Ha = /^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, Wa = /^u?int$/;
|
|
3480
3502
|
function we(e, t) {
|
|
3481
|
-
const n =
|
|
3503
|
+
const n = Ua(e, t?.type, t?.structs);
|
|
3482
3504
|
if (et.has(n))
|
|
3483
3505
|
return et.get(n);
|
|
3484
|
-
const r = Cn.test(e), s = de(r ?
|
|
3506
|
+
const r = Cn.test(e), s = de(r ? Ha : Va, e);
|
|
3485
3507
|
if (!s)
|
|
3486
|
-
throw new
|
|
3487
|
-
if (s.name &&
|
|
3488
|
-
throw new
|
|
3489
|
-
const
|
|
3508
|
+
throw new Ca({ param: e });
|
|
3509
|
+
if (s.name && Ya(s.name))
|
|
3510
|
+
throw new ka({ param: e, name: s.name });
|
|
3511
|
+
const a = s.name ? { name: s.name } : {}, i = s.modifier === "indexed" ? { indexed: !0 } : {}, o = t?.structs ?? {};
|
|
3490
3512
|
let c, d = {};
|
|
3491
3513
|
if (r) {
|
|
3492
3514
|
c = "tuple";
|
|
3493
|
-
const
|
|
3494
|
-
for (let h = 0; h <
|
|
3495
|
-
p.push(we(
|
|
3515
|
+
const y = ne(s.type), p = [], m = y.length;
|
|
3516
|
+
for (let h = 0; h < m; h++)
|
|
3517
|
+
p.push(we(y[h], { structs: o }));
|
|
3496
3518
|
d = { components: p };
|
|
3497
3519
|
} else if (s.type in o)
|
|
3498
3520
|
c = "tuple", d = { components: o[s.type] };
|
|
3499
|
-
else if (
|
|
3521
|
+
else if (Wa.test(s.type))
|
|
3500
3522
|
c = `${s.type}256`;
|
|
3501
3523
|
else if (s.type === "address payable")
|
|
3502
3524
|
c = "address";
|
|
3503
3525
|
else if (c = s.type, t?.type !== "struct" && !Bn(c))
|
|
3504
|
-
throw new $
|
|
3526
|
+
throw new $a({ type: c });
|
|
3505
3527
|
if (s.modifier) {
|
|
3506
3528
|
if (!t?.modifiers?.has?.(s.modifier))
|
|
3507
|
-
throw new
|
|
3529
|
+
throw new Ia({
|
|
3508
3530
|
param: e,
|
|
3509
3531
|
type: t?.type,
|
|
3510
3532
|
modifier: s.modifier
|
|
3511
3533
|
});
|
|
3512
|
-
if (ct.has(s.modifier) && !
|
|
3513
|
-
throw new
|
|
3534
|
+
if (ct.has(s.modifier) && !Za(c, !!s.array))
|
|
3535
|
+
throw new Na({
|
|
3514
3536
|
param: e,
|
|
3515
3537
|
type: t?.type,
|
|
3516
3538
|
modifier: s.modifier
|
|
@@ -3518,54 +3540,54 @@ function we(e, t) {
|
|
|
3518
3540
|
}
|
|
3519
3541
|
const l = {
|
|
3520
3542
|
type: `${c}${s.array ?? ""}`,
|
|
3521
|
-
...i,
|
|
3522
3543
|
...a,
|
|
3544
|
+
...i,
|
|
3523
3545
|
...d
|
|
3524
3546
|
};
|
|
3525
3547
|
return et.set(n, l), l;
|
|
3526
3548
|
}
|
|
3527
3549
|
function ne(e, t = [], n = "", r = 0) {
|
|
3528
3550
|
const s = e.trim().length;
|
|
3529
|
-
for (let
|
|
3530
|
-
const
|
|
3531
|
-
switch (
|
|
3551
|
+
for (let a = 0; a < s; a++) {
|
|
3552
|
+
const i = e[a], o = e.slice(a + 1);
|
|
3553
|
+
switch (i) {
|
|
3532
3554
|
case ",":
|
|
3533
|
-
return r === 0 ? ne(o, [...t, n.trim()]) : ne(o, t, `${n}${
|
|
3555
|
+
return r === 0 ? ne(o, [...t, n.trim()]) : ne(o, t, `${n}${i}`, r);
|
|
3534
3556
|
case "(":
|
|
3535
|
-
return ne(o, t, `${n}${
|
|
3557
|
+
return ne(o, t, `${n}${i}`, r + 1);
|
|
3536
3558
|
case ")":
|
|
3537
|
-
return ne(o, t, `${n}${
|
|
3559
|
+
return ne(o, t, `${n}${i}`, r - 1);
|
|
3538
3560
|
default:
|
|
3539
|
-
return ne(o, t, `${n}${
|
|
3561
|
+
return ne(o, t, `${n}${i}`, r);
|
|
3540
3562
|
}
|
|
3541
3563
|
}
|
|
3542
3564
|
if (n === "")
|
|
3543
3565
|
return t;
|
|
3544
3566
|
if (r !== 0)
|
|
3545
|
-
throw new
|
|
3567
|
+
throw new Ba({ current: n, depth: r });
|
|
3546
3568
|
return t.push(n.trim()), t;
|
|
3547
3569
|
}
|
|
3548
3570
|
function Bn(e) {
|
|
3549
3571
|
return e === "address" || e === "bool" || e === "function" || e === "string" || An.test(e) || $n.test(e);
|
|
3550
3572
|
}
|
|
3551
|
-
const
|
|
3552
|
-
function
|
|
3553
|
-
return e === "address" || e === "bool" || e === "function" || e === "string" || e === "tuple" || An.test(e) || $n.test(e) ||
|
|
3573
|
+
const Ka = /^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;
|
|
3574
|
+
function Ya(e) {
|
|
3575
|
+
return e === "address" || e === "bool" || e === "function" || e === "string" || e === "tuple" || An.test(e) || $n.test(e) || Ka.test(e);
|
|
3554
3576
|
}
|
|
3555
|
-
function
|
|
3577
|
+
function Za(e, t) {
|
|
3556
3578
|
return t || e === "bytes" || e === "string" || e === "tuple";
|
|
3557
3579
|
}
|
|
3558
|
-
function
|
|
3580
|
+
function Xa(e) {
|
|
3559
3581
|
const t = {}, n = e.length;
|
|
3560
|
-
for (let
|
|
3561
|
-
const o = e[
|
|
3582
|
+
for (let i = 0; i < n; i++) {
|
|
3583
|
+
const o = e[i];
|
|
3562
3584
|
if (!Mn(o))
|
|
3563
3585
|
continue;
|
|
3564
|
-
const c =
|
|
3586
|
+
const c = ga(o);
|
|
3565
3587
|
if (!c)
|
|
3566
3588
|
throw new $e({ signature: o, type: "struct" });
|
|
3567
|
-
const d = c.properties.split(";"), l = [],
|
|
3568
|
-
for (let p = 0; p <
|
|
3589
|
+
const d = c.properties.split(";"), l = [], y = d.length;
|
|
3590
|
+
for (let p = 0; p < y; p++) {
|
|
3569
3591
|
const h = d[p].trim();
|
|
3570
3592
|
if (!h)
|
|
3571
3593
|
continue;
|
|
@@ -3575,93 +3597,93 @@ function Xi(e) {
|
|
|
3575
3597
|
l.push(v);
|
|
3576
3598
|
}
|
|
3577
3599
|
if (!l.length)
|
|
3578
|
-
throw new
|
|
3600
|
+
throw new Da({ signature: o });
|
|
3579
3601
|
t[c.name] = l;
|
|
3580
3602
|
}
|
|
3581
|
-
const r = {}, s = Object.entries(t),
|
|
3582
|
-
for (let
|
|
3583
|
-
const [o, c] = s[
|
|
3603
|
+
const r = {}, s = Object.entries(t), a = s.length;
|
|
3604
|
+
for (let i = 0; i < a; i++) {
|
|
3605
|
+
const [o, c] = s[i];
|
|
3584
3606
|
r[o] = Un(c, t);
|
|
3585
3607
|
}
|
|
3586
3608
|
return r;
|
|
3587
3609
|
}
|
|
3588
|
-
const
|
|
3610
|
+
const Ja = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;
|
|
3589
3611
|
function Un(e = [], t = {}, n = /* @__PURE__ */ new Set()) {
|
|
3590
3612
|
const r = [], s = e.length;
|
|
3591
|
-
for (let
|
|
3592
|
-
const
|
|
3593
|
-
if (Cn.test(
|
|
3594
|
-
r.push(
|
|
3613
|
+
for (let a = 0; a < s; a++) {
|
|
3614
|
+
const i = e[a];
|
|
3615
|
+
if (Cn.test(i.type))
|
|
3616
|
+
r.push(i);
|
|
3595
3617
|
else {
|
|
3596
|
-
const c = de(
|
|
3618
|
+
const c = de(Ja, i.type);
|
|
3597
3619
|
if (!c?.type)
|
|
3598
|
-
throw new
|
|
3620
|
+
throw new Ra({ abiParameter: i });
|
|
3599
3621
|
const { array: d, type: l } = c;
|
|
3600
3622
|
if (l in t) {
|
|
3601
3623
|
if (n.has(l))
|
|
3602
|
-
throw new
|
|
3624
|
+
throw new Oa({ type: l });
|
|
3603
3625
|
r.push({
|
|
3604
|
-
...
|
|
3626
|
+
...i,
|
|
3605
3627
|
type: `tuple${d ?? ""}`,
|
|
3606
3628
|
components: Un(t[l], t, /* @__PURE__ */ new Set([...n, l]))
|
|
3607
3629
|
});
|
|
3608
3630
|
} else if (Bn(l))
|
|
3609
|
-
r.push(
|
|
3631
|
+
r.push(i);
|
|
3610
3632
|
else
|
|
3611
|
-
throw new
|
|
3633
|
+
throw new Aa({ type: l });
|
|
3612
3634
|
}
|
|
3613
3635
|
}
|
|
3614
3636
|
return r;
|
|
3615
3637
|
}
|
|
3616
3638
|
function Ln(e) {
|
|
3617
|
-
const t =
|
|
3639
|
+
const t = Xa(e), n = [], r = e.length;
|
|
3618
3640
|
for (let s = 0; s < r; s++) {
|
|
3619
|
-
const
|
|
3620
|
-
Mn(
|
|
3641
|
+
const a = e[s];
|
|
3642
|
+
Mn(a) || n.push(La(a, t));
|
|
3621
3643
|
}
|
|
3622
3644
|
return n;
|
|
3623
3645
|
}
|
|
3624
|
-
function
|
|
3625
|
-
let t = !0, n = "", r = 0, s = "",
|
|
3626
|
-
for (let
|
|
3627
|
-
const o = e[
|
|
3646
|
+
function Qa(e) {
|
|
3647
|
+
let t = !0, n = "", r = 0, s = "", a = !1;
|
|
3648
|
+
for (let i = 0; i < e.length; i++) {
|
|
3649
|
+
const o = e[i];
|
|
3628
3650
|
if (["(", ")", ","].includes(o) && (t = !0), o === "(" && r++, o === ")" && r--, !!t) {
|
|
3629
3651
|
if (r === 0) {
|
|
3630
3652
|
if (o === " " && ["event", "function", ""].includes(s))
|
|
3631
3653
|
s = "";
|
|
3632
3654
|
else if (s += o, o === ")") {
|
|
3633
|
-
|
|
3655
|
+
a = !0;
|
|
3634
3656
|
break;
|
|
3635
3657
|
}
|
|
3636
3658
|
continue;
|
|
3637
3659
|
}
|
|
3638
3660
|
if (o === " ") {
|
|
3639
|
-
e[
|
|
3661
|
+
e[i - 1] !== "," && n !== "," && n !== ",(" && (n = "", t = !1);
|
|
3640
3662
|
continue;
|
|
3641
3663
|
}
|
|
3642
3664
|
s += o, n += o;
|
|
3643
3665
|
}
|
|
3644
3666
|
}
|
|
3645
|
-
if (!
|
|
3667
|
+
if (!a)
|
|
3646
3668
|
throw new f("Unable to normalize signature.");
|
|
3647
3669
|
return s;
|
|
3648
3670
|
}
|
|
3649
|
-
const
|
|
3650
|
-
const t = typeof e == "string" ? e :
|
|
3651
|
-
return
|
|
3671
|
+
const qa = (e) => {
|
|
3672
|
+
const t = typeof e == "string" ? e : la(e);
|
|
3673
|
+
return Qa(t);
|
|
3652
3674
|
};
|
|
3653
3675
|
function Fn(e) {
|
|
3654
|
-
return
|
|
3676
|
+
return ua(qa(e));
|
|
3655
3677
|
}
|
|
3656
|
-
const
|
|
3678
|
+
const ei = Fn, Rt = (e) => je(Fn(e), 0, 4);
|
|
3657
3679
|
function Mt(e) {
|
|
3658
|
-
const { abi: t, args: n = [], name: r } = e, s = Re(r, { strict: !1 }),
|
|
3659
|
-
if (
|
|
3680
|
+
const { abi: t, args: n = [], name: r } = e, s = Re(r, { strict: !1 }), a = t.filter((o) => s ? o.type === "function" ? Rt(o) === r : o.type === "event" ? ei(o) === r : !1 : "name" in o && o.name === r);
|
|
3681
|
+
if (a.length === 0)
|
|
3660
3682
|
return;
|
|
3661
|
-
if (
|
|
3662
|
-
return
|
|
3663
|
-
let
|
|
3664
|
-
for (const o of
|
|
3683
|
+
if (a.length === 1)
|
|
3684
|
+
return a[0];
|
|
3685
|
+
let i;
|
|
3686
|
+
for (const o of a) {
|
|
3665
3687
|
if (!("inputs" in o))
|
|
3666
3688
|
continue;
|
|
3667
3689
|
if (!n || n.length === 0) {
|
|
@@ -3672,24 +3694,24 @@ function Mt(e) {
|
|
|
3672
3694
|
if (!o.inputs || o.inputs.length === 0 || o.inputs.length !== n.length)
|
|
3673
3695
|
continue;
|
|
3674
3696
|
if (n.every((d, l) => {
|
|
3675
|
-
const
|
|
3676
|
-
return
|
|
3697
|
+
const y = "inputs" in o && o.inputs[l];
|
|
3698
|
+
return y ? ut(d, y) : !1;
|
|
3677
3699
|
})) {
|
|
3678
|
-
if (
|
|
3679
|
-
const d = jn(o.inputs,
|
|
3700
|
+
if (i && "inputs" in i && i.inputs) {
|
|
3701
|
+
const d = jn(o.inputs, i.inputs, n);
|
|
3680
3702
|
if (d)
|
|
3681
3703
|
throw new Xr({
|
|
3682
3704
|
abiItem: o,
|
|
3683
3705
|
type: d[0]
|
|
3684
3706
|
}, {
|
|
3685
|
-
abiItem:
|
|
3707
|
+
abiItem: i,
|
|
3686
3708
|
type: d[1]
|
|
3687
3709
|
});
|
|
3688
3710
|
}
|
|
3689
|
-
|
|
3711
|
+
i = o;
|
|
3690
3712
|
}
|
|
3691
3713
|
}
|
|
3692
|
-
return
|
|
3714
|
+
return i || a[0];
|
|
3693
3715
|
}
|
|
3694
3716
|
function ut(e, t) {
|
|
3695
3717
|
const n = typeof e, r = t.type;
|
|
@@ -3703,7 +3725,7 @@ function ut(e, t) {
|
|
|
3703
3725
|
case "string":
|
|
3704
3726
|
return n === "string";
|
|
3705
3727
|
default:
|
|
3706
|
-
return r === "tuple" && "components" in t ? Object.values(t.components).every((s,
|
|
3728
|
+
return r === "tuple" && "components" in t ? Object.values(t.components).every((s, a) => n === "object" && ut(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) => ut(s, {
|
|
3707
3729
|
...t,
|
|
3708
3730
|
// Pop off `[]` or `[M]` from end of type
|
|
3709
3731
|
type: r.replace(/(\[[0-9]{0,}\])$/, "")
|
|
@@ -3712,47 +3734,47 @@ function ut(e, t) {
|
|
|
3712
3734
|
}
|
|
3713
3735
|
function jn(e, t, n) {
|
|
3714
3736
|
for (const r in e) {
|
|
3715
|
-
const s = e[r],
|
|
3716
|
-
if (s.type === "tuple" &&
|
|
3717
|
-
return jn(s.components,
|
|
3718
|
-
const
|
|
3719
|
-
if (
|
|
3720
|
-
return
|
|
3737
|
+
const s = e[r], a = t[r];
|
|
3738
|
+
if (s.type === "tuple" && a.type === "tuple" && "components" in s && "components" in a)
|
|
3739
|
+
return jn(s.components, a.components, n[r]);
|
|
3740
|
+
const i = [s.type, a.type];
|
|
3741
|
+
if (i.includes("address") && i.includes("bytes20") ? !0 : i.includes("address") && i.includes("string") ? ge(n[r], { strict: !1 }) : i.includes("address") && i.includes("bytes") ? ge(n[r], { strict: !1 }) : !1)
|
|
3742
|
+
return i;
|
|
3721
3743
|
}
|
|
3722
3744
|
}
|
|
3723
3745
|
const tt = "/docs/contract/decodeFunctionResult";
|
|
3724
3746
|
function zn(e) {
|
|
3725
3747
|
const { abi: t, args: n, functionName: r, data: s } = e;
|
|
3726
|
-
let
|
|
3748
|
+
let a = t[0];
|
|
3727
3749
|
if (r) {
|
|
3728
3750
|
const o = Mt({ abi: t, args: n, name: r });
|
|
3729
3751
|
if (!o)
|
|
3730
3752
|
throw new Ue(r, { docsPath: tt });
|
|
3731
|
-
|
|
3753
|
+
a = o;
|
|
3732
3754
|
}
|
|
3733
|
-
if (
|
|
3755
|
+
if (a.type !== "function")
|
|
3734
3756
|
throw new Ue(void 0, { docsPath: tt });
|
|
3735
|
-
if (!
|
|
3736
|
-
throw new Zr(
|
|
3737
|
-
const
|
|
3738
|
-
if (
|
|
3739
|
-
return
|
|
3740
|
-
if (
|
|
3741
|
-
return
|
|
3757
|
+
if (!a.outputs)
|
|
3758
|
+
throw new Zr(a.name, { docsPath: tt });
|
|
3759
|
+
const i = Sn(a.outputs, s);
|
|
3760
|
+
if (i && i.length > 1)
|
|
3761
|
+
return i;
|
|
3762
|
+
if (i && i.length === 1)
|
|
3763
|
+
return i[0];
|
|
3742
3764
|
}
|
|
3743
3765
|
const Xt = "/docs/contract/encodeFunctionData";
|
|
3744
|
-
function
|
|
3766
|
+
function ti(e) {
|
|
3745
3767
|
const { abi: t, args: n, functionName: r } = e;
|
|
3746
3768
|
let s = t[0];
|
|
3747
3769
|
if (r) {
|
|
3748
|
-
const
|
|
3770
|
+
const a = Mt({
|
|
3749
3771
|
abi: t,
|
|
3750
3772
|
args: n,
|
|
3751
3773
|
name: r
|
|
3752
3774
|
});
|
|
3753
|
-
if (!
|
|
3775
|
+
if (!a)
|
|
3754
3776
|
throw new Ue(r, { docsPath: Xt });
|
|
3755
|
-
s =
|
|
3777
|
+
s = a;
|
|
3756
3778
|
}
|
|
3757
3779
|
if (s.type !== "function")
|
|
3758
3780
|
throw new Ue(void 0, { docsPath: Xt });
|
|
@@ -3762,8 +3784,8 @@ function ta(e) {
|
|
|
3762
3784
|
};
|
|
3763
3785
|
}
|
|
3764
3786
|
function _n(e) {
|
|
3765
|
-
const { args: t } = e, { abi: n, functionName: r } = e.abi.length === 1 && e.functionName?.startsWith("0x") ? e :
|
|
3766
|
-
return Ct([
|
|
3787
|
+
const { args: t } = e, { abi: n, functionName: r } = e.abi.length === 1 && e.functionName?.startsWith("0x") ? e : ti(e), s = n[0], a = r, i = "inputs" in s && s.inputs ? Pn(s.inputs, t ?? []) : void 0;
|
|
3788
|
+
return Ct([a, i ?? "0x"]);
|
|
3767
3789
|
}
|
|
3768
3790
|
class dt extends f {
|
|
3769
3791
|
constructor({ blockNumber: t, chain: n, contract: r }) {
|
|
@@ -3787,7 +3809,7 @@ class Gn extends f {
|
|
|
3787
3809
|
});
|
|
3788
3810
|
}
|
|
3789
3811
|
}
|
|
3790
|
-
function
|
|
3812
|
+
function ni({ blockNumber: e, chain: t, contract: n }) {
|
|
3791
3813
|
const r = t?.contracts?.[n];
|
|
3792
3814
|
if (!r)
|
|
3793
3815
|
throw new dt({
|
|
@@ -3808,7 +3830,7 @@ function na({ blockNumber: e, chain: t, contract: n }) {
|
|
|
3808
3830
|
function Dt(e) {
|
|
3809
3831
|
return typeof e == "string" ? { address: e, type: "json-rpc" } : e;
|
|
3810
3832
|
}
|
|
3811
|
-
const
|
|
3833
|
+
const ri = {
|
|
3812
3834
|
1: "An `assert` condition failed.",
|
|
3813
3835
|
17: "Arithmetic operation resulted in underflow or overflow.",
|
|
3814
3836
|
18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
|
|
@@ -3818,7 +3840,7 @@ const ra = {
|
|
|
3818
3840
|
50: "Array index is out of bounds.",
|
|
3819
3841
|
65: "Allocated too much memory or created an array which is too large.",
|
|
3820
3842
|
81: "Attempted to call a zero-initialized variable of internal function type."
|
|
3821
|
-
},
|
|
3843
|
+
}, si = {
|
|
3822
3844
|
inputs: [
|
|
3823
3845
|
{
|
|
3824
3846
|
name: "message",
|
|
@@ -3827,7 +3849,7 @@ const ra = {
|
|
|
3827
3849
|
],
|
|
3828
3850
|
name: "Error",
|
|
3829
3851
|
type: "error"
|
|
3830
|
-
},
|
|
3852
|
+
}, ai = {
|
|
3831
3853
|
inputs: [
|
|
3832
3854
|
{
|
|
3833
3855
|
name: "reason",
|
|
@@ -3837,30 +3859,30 @@ const ra = {
|
|
|
3837
3859
|
name: "Panic",
|
|
3838
3860
|
type: "error"
|
|
3839
3861
|
};
|
|
3840
|
-
function
|
|
3862
|
+
function ii(e) {
|
|
3841
3863
|
const { abi: t, data: n } = e, r = je(n, 0, 4);
|
|
3842
3864
|
if (r === "0x")
|
|
3843
3865
|
throw new Pt();
|
|
3844
|
-
const
|
|
3845
|
-
if (!
|
|
3866
|
+
const a = [...t || [], si, ai].find((i) => i.type === "error" && r === Rt(Pe(i)));
|
|
3867
|
+
if (!a)
|
|
3846
3868
|
throw new nn(r, {
|
|
3847
3869
|
docsPath: "/docs/contract/decodeErrorResult"
|
|
3848
3870
|
});
|
|
3849
3871
|
return {
|
|
3850
|
-
abiItem:
|
|
3851
|
-
args: "inputs" in
|
|
3852
|
-
errorName:
|
|
3872
|
+
abiItem: a,
|
|
3873
|
+
args: "inputs" in a && a.inputs && a.inputs.length > 0 ? Sn(a.inputs, je(n, 4)) : void 0,
|
|
3874
|
+
errorName: a.name
|
|
3853
3875
|
};
|
|
3854
3876
|
}
|
|
3855
3877
|
const Ot = (e, t, n) => JSON.stringify(e, (r, s) => typeof s == "bigint" ? s.toString() : s, n);
|
|
3856
3878
|
function Vn({ abiItem: e, args: t, includeFunctionName: n = !0, includeName: r = !1 }) {
|
|
3857
3879
|
if ("name" in e && "inputs" in e && e.inputs)
|
|
3858
|
-
return `${n ? e.name : ""}(${e.inputs.map((s,
|
|
3880
|
+
return `${n ? e.name : ""}(${e.inputs.map((s, a) => `${r && s.name ? `${s.name}: ` : ""}${typeof t[a] == "object" ? Ot(t[a]) : t[a]}`).join(", ")})`;
|
|
3859
3881
|
}
|
|
3860
|
-
const
|
|
3882
|
+
const oi = {
|
|
3861
3883
|
gwei: 9,
|
|
3862
3884
|
wei: 18
|
|
3863
|
-
},
|
|
3885
|
+
}, ci = {
|
|
3864
3886
|
ether: -9,
|
|
3865
3887
|
wei: 9
|
|
3866
3888
|
};
|
|
@@ -3868,26 +3890,26 @@ function Hn(e, t) {
|
|
|
3868
3890
|
let n = e.toString();
|
|
3869
3891
|
const r = n.startsWith("-");
|
|
3870
3892
|
r && (n = n.slice(1)), n = n.padStart(t, "0");
|
|
3871
|
-
let [s,
|
|
3893
|
+
let [s, a] = [
|
|
3872
3894
|
n.slice(0, n.length - t),
|
|
3873
3895
|
n.slice(n.length - t)
|
|
3874
3896
|
];
|
|
3875
|
-
return
|
|
3897
|
+
return a = a.replace(/(0+)$/, ""), `${r ? "-" : ""}${s || "0"}${a ? `.${a}` : ""}`;
|
|
3876
3898
|
}
|
|
3877
|
-
function
|
|
3878
|
-
return Hn(e,
|
|
3899
|
+
function ui(e, t = "wei") {
|
|
3900
|
+
return Hn(e, oi[t]);
|
|
3879
3901
|
}
|
|
3880
3902
|
function he(e, t = "wei") {
|
|
3881
|
-
return Hn(e,
|
|
3903
|
+
return Hn(e, ci[t]);
|
|
3882
3904
|
}
|
|
3883
|
-
class
|
|
3905
|
+
class di extends f {
|
|
3884
3906
|
constructor({ address: t }) {
|
|
3885
3907
|
super(`State for account "${t}" is set multiple times.`, {
|
|
3886
3908
|
name: "AccountStateConflictError"
|
|
3887
3909
|
});
|
|
3888
3910
|
}
|
|
3889
3911
|
}
|
|
3890
|
-
class
|
|
3912
|
+
class li extends f {
|
|
3891
3913
|
constructor() {
|
|
3892
3914
|
super("state and stateDiff are set on the same account.", {
|
|
3893
3915
|
name: "StateAssignmentConflictError"
|
|
@@ -3898,7 +3920,7 @@ function Jt(e) {
|
|
|
3898
3920
|
return e.reduce((t, { slot: n, value: r }) => `${t} ${n}: ${r}
|
|
3899
3921
|
`, "");
|
|
3900
3922
|
}
|
|
3901
|
-
function
|
|
3923
|
+
function fi(e) {
|
|
3902
3924
|
return e.reduce((t, { address: n, ...r }) => {
|
|
3903
3925
|
let s = `${t} ${n}:
|
|
3904
3926
|
`;
|
|
@@ -3916,23 +3938,23 @@ function Wn(e) {
|
|
|
3916
3938
|
return t.map(([r, s]) => ` ${`${r}:`.padEnd(n + 1)} ${s}`).join(`
|
|
3917
3939
|
`);
|
|
3918
3940
|
}
|
|
3919
|
-
const
|
|
3920
|
-
class
|
|
3921
|
-
constructor(t, { account: n, docsPath: r, chain: s, data:
|
|
3941
|
+
const pi = (e) => e, Kn = (e) => e;
|
|
3942
|
+
class mi extends f {
|
|
3943
|
+
constructor(t, { account: n, docsPath: r, chain: s, data: a, gas: i, gasPrice: o, maxFeePerGas: c, maxPriorityFeePerGas: d, nonce: l, to: y, value: p, stateOverride: m }) {
|
|
3922
3944
|
const h = n ? Dt(n) : void 0;
|
|
3923
3945
|
let v = Wn({
|
|
3924
3946
|
from: h?.address,
|
|
3925
|
-
to:
|
|
3926
|
-
value: typeof p < "u" && `${
|
|
3927
|
-
data:
|
|
3928
|
-
gas:
|
|
3947
|
+
to: y,
|
|
3948
|
+
value: typeof p < "u" && `${ui(p)} ${s?.nativeCurrency?.symbol || "ETH"}`,
|
|
3949
|
+
data: a,
|
|
3950
|
+
gas: i,
|
|
3929
3951
|
gasPrice: typeof o < "u" && `${he(o)} gwei`,
|
|
3930
3952
|
maxFeePerGas: typeof c < "u" && `${he(c)} gwei`,
|
|
3931
3953
|
maxPriorityFeePerGas: typeof d < "u" && `${he(d)} gwei`,
|
|
3932
3954
|
nonce: l
|
|
3933
3955
|
});
|
|
3934
|
-
|
|
3935
|
-
${
|
|
3956
|
+
m && (v += `
|
|
3957
|
+
${fi(m)}`), super(t.shortMessage, {
|
|
3936
3958
|
cause: t,
|
|
3937
3959
|
docsPath: r,
|
|
3938
3960
|
metaMessages: [
|
|
@@ -3949,26 +3971,26 @@ ${fa(y)}`), super(t.shortMessage, {
|
|
|
3949
3971
|
}), this.cause = t;
|
|
3950
3972
|
}
|
|
3951
3973
|
}
|
|
3952
|
-
class
|
|
3953
|
-
constructor(t, { abi: n, args: r, contractAddress: s, docsPath:
|
|
3954
|
-
const c = Mt({ abi: n, args: r, name:
|
|
3974
|
+
class yi extends f {
|
|
3975
|
+
constructor(t, { abi: n, args: r, contractAddress: s, docsPath: a, functionName: i, sender: o }) {
|
|
3976
|
+
const c = Mt({ abi: n, args: r, name: i }), d = c ? Vn({
|
|
3955
3977
|
abiItem: c,
|
|
3956
3978
|
args: r,
|
|
3957
3979
|
includeFunctionName: !1,
|
|
3958
3980
|
includeName: !1
|
|
3959
|
-
}) : void 0, l = c ? Pe(c, { includeName: !0 }) : void 0,
|
|
3960
|
-
address: s &&
|
|
3981
|
+
}) : void 0, l = c ? Pe(c, { includeName: !0 }) : void 0, y = Wn({
|
|
3982
|
+
address: s && pi(s),
|
|
3961
3983
|
function: l,
|
|
3962
|
-
args: d && d !== "()" && `${[...Array(
|
|
3984
|
+
args: d && d !== "()" && `${[...Array(i?.length ?? 0).keys()].map(() => " ").join("")}${d}`,
|
|
3963
3985
|
sender: o
|
|
3964
3986
|
});
|
|
3965
|
-
super(t.shortMessage || `An unknown error occurred while executing the contract function "${
|
|
3987
|
+
super(t.shortMessage || `An unknown error occurred while executing the contract function "${i}".`, {
|
|
3966
3988
|
cause: t,
|
|
3967
|
-
docsPath:
|
|
3989
|
+
docsPath: a,
|
|
3968
3990
|
metaMessages: [
|
|
3969
3991
|
...t.metaMessages ? [...t.metaMessages, " "] : [],
|
|
3970
|
-
|
|
3971
|
-
|
|
3992
|
+
y && "Contract Call:",
|
|
3993
|
+
y
|
|
3972
3994
|
].filter(Boolean),
|
|
3973
3995
|
name: "ContractFunctionExecutionError"
|
|
3974
3996
|
}), Object.defineProperty(this, "abi", {
|
|
@@ -4006,39 +4028,39 @@ class ba extends f {
|
|
|
4006
4028
|
configurable: !0,
|
|
4007
4029
|
writable: !0,
|
|
4008
4030
|
value: void 0
|
|
4009
|
-
}), this.abi = n, this.args = r, this.cause = t, this.contractAddress = s, this.functionName =
|
|
4031
|
+
}), this.abi = n, this.args = r, this.cause = t, this.contractAddress = s, this.functionName = i, this.sender = o;
|
|
4010
4032
|
}
|
|
4011
4033
|
}
|
|
4012
|
-
class
|
|
4034
|
+
class bi extends f {
|
|
4013
4035
|
constructor({ abi: t, data: n, functionName: r, message: s }) {
|
|
4014
|
-
let
|
|
4036
|
+
let a, i, o, c;
|
|
4015
4037
|
if (n && n !== "0x")
|
|
4016
4038
|
try {
|
|
4017
|
-
|
|
4018
|
-
const { abiItem: l, errorName:
|
|
4019
|
-
if (
|
|
4039
|
+
i = ii({ abi: t, data: n });
|
|
4040
|
+
const { abiItem: l, errorName: y, args: p } = i;
|
|
4041
|
+
if (y === "Error")
|
|
4020
4042
|
c = p[0];
|
|
4021
|
-
else if (
|
|
4022
|
-
const [
|
|
4023
|
-
c =
|
|
4043
|
+
else if (y === "Panic") {
|
|
4044
|
+
const [m] = p;
|
|
4045
|
+
c = ri[m];
|
|
4024
4046
|
} else {
|
|
4025
|
-
const
|
|
4047
|
+
const m = l ? Pe(l, { includeName: !0 }) : void 0, h = l && p ? Vn({
|
|
4026
4048
|
abiItem: l,
|
|
4027
4049
|
args: p,
|
|
4028
4050
|
includeFunctionName: !1,
|
|
4029
4051
|
includeName: !1
|
|
4030
4052
|
}) : void 0;
|
|
4031
4053
|
o = [
|
|
4032
|
-
|
|
4033
|
-
h && h !== "()" ? ` ${[...Array(
|
|
4054
|
+
m ? `Error: ${m}` : "",
|
|
4055
|
+
h && h !== "()" ? ` ${[...Array(y?.length ?? 0).keys()].map(() => " ").join("")}${h}` : ""
|
|
4034
4056
|
];
|
|
4035
4057
|
}
|
|
4036
4058
|
} catch (l) {
|
|
4037
|
-
|
|
4059
|
+
a = l;
|
|
4038
4060
|
}
|
|
4039
4061
|
else s && (c = s);
|
|
4040
4062
|
let d;
|
|
4041
|
-
|
|
4063
|
+
a instanceof nn && (d = a.signature, o = [
|
|
4042
4064
|
`Unable to decode signature "${d}" as it was not found on the provided ABI.`,
|
|
4043
4065
|
"Make sure you are using the correct ABI and that the error exists on it.",
|
|
4044
4066
|
`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${d}.`
|
|
@@ -4047,7 +4069,7 @@ class ma extends f {
|
|
|
4047
4069
|
c || d
|
|
4048
4070
|
].join(`
|
|
4049
4071
|
`) : `The contract function "${r}" reverted.`, {
|
|
4050
|
-
cause:
|
|
4072
|
+
cause: a,
|
|
4051
4073
|
metaMessages: o,
|
|
4052
4074
|
name: "ContractFunctionRevertedError"
|
|
4053
4075
|
}), Object.defineProperty(this, "data", {
|
|
@@ -4070,10 +4092,10 @@ class ma extends f {
|
|
|
4070
4092
|
configurable: !0,
|
|
4071
4093
|
writable: !0,
|
|
4072
4094
|
value: void 0
|
|
4073
|
-
}), this.data =
|
|
4095
|
+
}), this.data = i, this.raw = n, this.reason = c, this.signature = d;
|
|
4074
4096
|
}
|
|
4075
4097
|
}
|
|
4076
|
-
class
|
|
4098
|
+
class hi extends f {
|
|
4077
4099
|
constructor({ functionName: t }) {
|
|
4078
4100
|
super(`The contract function "${t}" returned no data ("0x").`, {
|
|
4079
4101
|
metaMessages: [
|
|
@@ -4086,7 +4108,7 @@ class ha extends f {
|
|
|
4086
4108
|
});
|
|
4087
4109
|
}
|
|
4088
4110
|
}
|
|
4089
|
-
class
|
|
4111
|
+
class gi extends f {
|
|
4090
4112
|
constructor({ factory: t }) {
|
|
4091
4113
|
super(`Deployment for counterfactual contract call failed${t ? ` for factory "${t}".` : ""}`, {
|
|
4092
4114
|
metaMessages: [
|
|
@@ -4113,21 +4135,21 @@ class Yn extends f {
|
|
|
4113
4135
|
}), this.data = t;
|
|
4114
4136
|
}
|
|
4115
4137
|
}
|
|
4116
|
-
function
|
|
4138
|
+
function wi(e, t, n) {
|
|
4117
4139
|
const r = e[t.name];
|
|
4118
4140
|
if (typeof r == "function")
|
|
4119
4141
|
return r;
|
|
4120
4142
|
const s = e[n];
|
|
4121
|
-
return typeof s == "function" ? s : (
|
|
4143
|
+
return typeof s == "function" ? s : (a) => t(e, a);
|
|
4122
4144
|
}
|
|
4123
4145
|
class Co extends f {
|
|
4124
|
-
constructor({ body: t, cause: n, details: r, headers: s, status:
|
|
4146
|
+
constructor({ body: t, cause: n, details: r, headers: s, status: a, url: i }) {
|
|
4125
4147
|
super("HTTP request failed.", {
|
|
4126
4148
|
cause: n,
|
|
4127
4149
|
details: r,
|
|
4128
4150
|
metaMessages: [
|
|
4129
|
-
|
|
4130
|
-
`URL: ${Kn(
|
|
4151
|
+
a && `Status: ${a}`,
|
|
4152
|
+
`URL: ${Kn(i)}`,
|
|
4131
4153
|
t && `Request body: ${Ot(t)}`
|
|
4132
4154
|
].filter(Boolean),
|
|
4133
4155
|
name: "HttpRequestError"
|
|
@@ -4151,7 +4173,7 @@ class Co extends f {
|
|
|
4151
4173
|
configurable: !0,
|
|
4152
4174
|
writable: !0,
|
|
4153
4175
|
value: void 0
|
|
4154
|
-
}), this.body = t, this.headers = s, this.status =
|
|
4176
|
+
}), this.body = t, this.headers = s, this.status = a, this.url = i;
|
|
4155
4177
|
}
|
|
4156
4178
|
}
|
|
4157
4179
|
class Zn extends f {
|
|
@@ -4179,20 +4201,20 @@ class Zn extends f {
|
|
|
4179
4201
|
}), this.code = n.code, this.data = n.data, this.url = r;
|
|
4180
4202
|
}
|
|
4181
4203
|
}
|
|
4182
|
-
const
|
|
4204
|
+
const xi = -1;
|
|
4183
4205
|
class Xn extends f {
|
|
4184
|
-
constructor(t, { code: n, docsPath: r, metaMessages: s, name:
|
|
4185
|
-
super(
|
|
4206
|
+
constructor(t, { code: n, docsPath: r, metaMessages: s, name: a, shortMessage: i }) {
|
|
4207
|
+
super(i, {
|
|
4186
4208
|
cause: t,
|
|
4187
4209
|
docsPath: r,
|
|
4188
4210
|
metaMessages: s || t?.metaMessages,
|
|
4189
|
-
name:
|
|
4211
|
+
name: a || "RpcError"
|
|
4190
4212
|
}), Object.defineProperty(this, "code", {
|
|
4191
4213
|
enumerable: !0,
|
|
4192
4214
|
configurable: !0,
|
|
4193
4215
|
writable: !0,
|
|
4194
4216
|
value: void 0
|
|
4195
|
-
}), this.name =
|
|
4217
|
+
}), this.name = a || t.name, this.code = t instanceof Zn ? t.code : n ?? xi;
|
|
4196
4218
|
}
|
|
4197
4219
|
}
|
|
4198
4220
|
class Ve extends Xn {
|
|
@@ -4229,26 +4251,26 @@ Object.defineProperty(He, "code", {
|
|
|
4229
4251
|
writable: !0,
|
|
4230
4252
|
value: -32e3
|
|
4231
4253
|
});
|
|
4232
|
-
const
|
|
4233
|
-
function
|
|
4234
|
-
const o = e instanceof Yn ? e : e instanceof f ? e.walk((h) => "data" in h) || e.walk() : {}, { code: c, data: d, details: l, message:
|
|
4254
|
+
const Ti = 3;
|
|
4255
|
+
function vi(e, { abi: t, address: n, args: r, docsPath: s, functionName: a, sender: i }) {
|
|
4256
|
+
const o = e instanceof Yn ? e : e instanceof f ? e.walk((h) => "data" in h) || e.walk() : {}, { code: c, data: d, details: l, message: y, shortMessage: p } = o, m = e instanceof Pt ? new hi({ functionName: a }) : [Ti, Ve.code].includes(c) && (d || l || y || p) || c === He.code && l === "execution reverted" && d ? new bi({
|
|
4235
4257
|
abi: t,
|
|
4236
4258
|
data: typeof d == "object" ? d.data : d,
|
|
4237
|
-
functionName:
|
|
4238
|
-
message: o instanceof Zn ? l : p ??
|
|
4259
|
+
functionName: a,
|
|
4260
|
+
message: o instanceof Zn ? l : p ?? y
|
|
4239
4261
|
}) : e;
|
|
4240
|
-
return new
|
|
4262
|
+
return new yi(m, {
|
|
4241
4263
|
abi: t,
|
|
4242
4264
|
args: r,
|
|
4243
4265
|
contractAddress: n,
|
|
4244
4266
|
docsPath: s,
|
|
4245
|
-
functionName:
|
|
4246
|
-
sender:
|
|
4267
|
+
functionName: a,
|
|
4268
|
+
sender: i
|
|
4247
4269
|
});
|
|
4248
4270
|
}
|
|
4249
|
-
const
|
|
4250
|
-
function
|
|
4251
|
-
return
|
|
4271
|
+
const Ei = "0.1.1";
|
|
4272
|
+
function Pi() {
|
|
4273
|
+
return Ei;
|
|
4252
4274
|
}
|
|
4253
4275
|
class _ extends Error {
|
|
4254
4276
|
static setStaticOptions(t) {
|
|
@@ -4263,13 +4285,13 @@ class _ extends Error {
|
|
|
4263
4285
|
return n.cause.shortMessage;
|
|
4264
4286
|
}
|
|
4265
4287
|
return n.cause && "details" in n.cause && typeof n.cause.details == "string" ? n.cause.details : n.cause?.message ? n.cause.message : n.details;
|
|
4266
|
-
})(), s = n.cause instanceof _ && n.cause.docsPath || n.docsPath,
|
|
4288
|
+
})(), s = n.cause instanceof _ && n.cause.docsPath || n.docsPath, a = n.docsOrigin ?? _.prototype.docsOrigin, i = `${a}${s ?? ""}`, o = !!(n.version ?? _.prototype.showVersion), c = n.version ?? _.prototype.version, d = [
|
|
4267
4289
|
t || "An error occurred.",
|
|
4268
4290
|
...n.metaMessages ? ["", ...n.metaMessages] : [],
|
|
4269
4291
|
...r || s || o ? [
|
|
4270
4292
|
"",
|
|
4271
4293
|
r ? `Details: ${r}` : void 0,
|
|
4272
|
-
s ? `See: ${
|
|
4294
|
+
s ? `See: ${i}` : void 0,
|
|
4273
4295
|
o ? `Version: ${c}` : void 0
|
|
4274
4296
|
] : []
|
|
4275
4297
|
].filter((l) => typeof l == "string").join(`
|
|
@@ -4319,7 +4341,7 @@ class _ extends Error {
|
|
|
4319
4341
|
configurable: !0,
|
|
4320
4342
|
writable: !0,
|
|
4321
4343
|
value: "BaseError"
|
|
4322
|
-
}), this.cause = n.cause, this.details = r, this.docs =
|
|
4344
|
+
}), this.cause = n.cause, this.details = r, this.docs = i, this.docsOrigin = a, this.docsPath = s, this.shortMessage = t, this.showVersion = o, this.version = c;
|
|
4323
4345
|
}
|
|
4324
4346
|
walk(t) {
|
|
4325
4347
|
return Jn(this, t);
|
|
@@ -4332,20 +4354,20 @@ Object.defineProperty(_, "defaultStaticOptions", {
|
|
|
4332
4354
|
value: {
|
|
4333
4355
|
docsOrigin: "https://oxlib.sh",
|
|
4334
4356
|
showVersion: !1,
|
|
4335
|
-
version: `ox@${
|
|
4357
|
+
version: `ox@${Pi()}`
|
|
4336
4358
|
}
|
|
4337
4359
|
});
|
|
4338
4360
|
_.setStaticOptions(_.defaultStaticOptions);
|
|
4339
4361
|
function Jn(e, t) {
|
|
4340
4362
|
return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause ? Jn(e.cause, t) : t ? null : e;
|
|
4341
4363
|
}
|
|
4342
|
-
function
|
|
4364
|
+
function Si(e, t = {}) {
|
|
4343
4365
|
const { dir: n, size: r = 32 } = t;
|
|
4344
4366
|
if (r === 0)
|
|
4345
4367
|
return e;
|
|
4346
4368
|
const s = e.replace("0x", "");
|
|
4347
4369
|
if (s.length > r * 2)
|
|
4348
|
-
throw new
|
|
4370
|
+
throw new Ci({
|
|
4349
4371
|
size: Math.ceil(s.length / 2),
|
|
4350
4372
|
targetSize: r,
|
|
4351
4373
|
type: "Hex"
|
|
@@ -4354,28 +4376,28 @@ function Sa(e, t = {}) {
|
|
|
4354
4376
|
}
|
|
4355
4377
|
function oe(e, t = {}) {
|
|
4356
4378
|
const { signed: n, size: r } = t, s = BigInt(e);
|
|
4357
|
-
let
|
|
4358
|
-
r ? n ?
|
|
4359
|
-
const
|
|
4360
|
-
if (
|
|
4379
|
+
let a;
|
|
4380
|
+
r ? n ? a = (1n << BigInt(r) * 8n - 1n) - 1n : a = 2n ** (BigInt(r) * 8n) - 1n : typeof e == "number" && (a = BigInt(Number.MAX_SAFE_INTEGER));
|
|
4381
|
+
const i = typeof a == "bigint" && n ? -a - 1n : 0;
|
|
4382
|
+
if (a && s > a || s < i) {
|
|
4361
4383
|
const d = typeof e == "bigint" ? "n" : "";
|
|
4362
|
-
throw new $
|
|
4363
|
-
max:
|
|
4364
|
-
min: `${
|
|
4384
|
+
throw new $i({
|
|
4385
|
+
max: a ? `${a}${d}` : void 0,
|
|
4386
|
+
min: `${i}${d}`,
|
|
4365
4387
|
signed: n,
|
|
4366
4388
|
size: r,
|
|
4367
4389
|
value: `${e}${d}`
|
|
4368
4390
|
});
|
|
4369
4391
|
}
|
|
4370
4392
|
const c = `0x${(n && s < 0 ? BigInt.asUintN(r * 8, BigInt(s)) : s).toString(16)}`;
|
|
4371
|
-
return r ?
|
|
4393
|
+
return r ? Ai(c, r) : c;
|
|
4372
4394
|
}
|
|
4373
|
-
function
|
|
4374
|
-
return
|
|
4395
|
+
function Ai(e, t) {
|
|
4396
|
+
return Si(e, { dir: "left", size: t });
|
|
4375
4397
|
}
|
|
4376
|
-
class $
|
|
4377
|
-
constructor({ max: t, min: n, signed: r, size: s, value:
|
|
4378
|
-
super(`Number \`${
|
|
4398
|
+
class $i extends _ {
|
|
4399
|
+
constructor({ max: t, min: n, signed: r, size: s, value: a }) {
|
|
4400
|
+
super(`Number \`${a}\` is not in safe${s ? ` ${s * 8}-bit` : ""}${r ? " signed" : " unsigned"} integer range ${t ? `(\`${n}\` to \`${t}\`)` : `(above \`${n}\`)`}`), Object.defineProperty(this, "name", {
|
|
4379
4401
|
enumerable: !0,
|
|
4380
4402
|
configurable: !0,
|
|
4381
4403
|
writable: !0,
|
|
@@ -4383,7 +4405,7 @@ class $a extends _ {
|
|
|
4383
4405
|
});
|
|
4384
4406
|
}
|
|
4385
4407
|
}
|
|
4386
|
-
class
|
|
4408
|
+
class Ci extends _ {
|
|
4387
4409
|
constructor({ size: t, targetSize: n, type: r }) {
|
|
4388
4410
|
super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`), Object.defineProperty(this, "name", {
|
|
4389
4411
|
enumerable: !0,
|
|
@@ -4393,7 +4415,7 @@ class Ca extends _ {
|
|
|
4393
4415
|
});
|
|
4394
4416
|
}
|
|
4395
4417
|
}
|
|
4396
|
-
function
|
|
4418
|
+
function ki(e) {
|
|
4397
4419
|
return {
|
|
4398
4420
|
address: e.address,
|
|
4399
4421
|
amount: oe(e.amount),
|
|
@@ -4401,7 +4423,7 @@ function Ia(e) {
|
|
|
4401
4423
|
validatorIndex: oe(e.validatorIndex)
|
|
4402
4424
|
};
|
|
4403
4425
|
}
|
|
4404
|
-
function
|
|
4426
|
+
function Ii(e) {
|
|
4405
4427
|
return {
|
|
4406
4428
|
...typeof e.baseFeePerGas == "bigint" && {
|
|
4407
4429
|
baseFeePerGas: oe(e.baseFeePerGas)
|
|
@@ -4425,24 +4447,24 @@ function ka(e) {
|
|
|
4425
4447
|
time: oe(e.time)
|
|
4426
4448
|
},
|
|
4427
4449
|
...e.withdrawals && {
|
|
4428
|
-
withdrawals: e.withdrawals.map(
|
|
4450
|
+
withdrawals: e.withdrawals.map(ki)
|
|
4429
4451
|
}
|
|
4430
4452
|
};
|
|
4431
4453
|
}
|
|
4432
|
-
const Na = "0x82ad56cb", Ra = "0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe", Ma = "0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe", Da = "0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033", nt = "/docs/contract/encodeDeployData";
|
|
4454
|
+
const Ni = "0x82ad56cb", Ri = "0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe", Mi = "0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe", Di = "0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033", nt = "/docs/contract/encodeDeployData";
|
|
4433
4455
|
function Qn(e) {
|
|
4434
4456
|
const { abi: t, args: n, bytecode: r } = e;
|
|
4435
4457
|
if (!n || n.length === 0)
|
|
4436
4458
|
return r;
|
|
4437
|
-
const s = t.find((
|
|
4459
|
+
const s = t.find((i) => "type" in i && i.type === "constructor");
|
|
4438
4460
|
if (!s)
|
|
4439
4461
|
throw new Vr({ docsPath: nt });
|
|
4440
4462
|
if (!("inputs" in s))
|
|
4441
4463
|
throw new Lt({ docsPath: nt });
|
|
4442
4464
|
if (!s.inputs || s.inputs.length === 0)
|
|
4443
4465
|
throw new Lt({ docsPath: nt });
|
|
4444
|
-
const
|
|
4445
|
-
return Ct([r,
|
|
4466
|
+
const a = Pn(s.inputs, n);
|
|
4467
|
+
return Ct([r, a]);
|
|
4446
4468
|
}
|
|
4447
4469
|
class Te extends f {
|
|
4448
4470
|
constructor({ cause: t, message: n } = {}) {
|
|
@@ -4519,18 +4541,18 @@ Object.defineProperty(pt, "nodeMessage", {
|
|
|
4519
4541
|
writable: !0,
|
|
4520
4542
|
value: /nonce too low|transaction already imported|already known/
|
|
4521
4543
|
});
|
|
4522
|
-
class
|
|
4544
|
+
class mt extends f {
|
|
4523
4545
|
constructor({ cause: t, nonce: n } = {}) {
|
|
4524
4546
|
super(`Nonce provided for the transaction ${n ? `(${n}) ` : ""}exceeds the maximum allowed nonce.`, { cause: t, name: "NonceMaxValueError" });
|
|
4525
4547
|
}
|
|
4526
4548
|
}
|
|
4527
|
-
Object.defineProperty(
|
|
4549
|
+
Object.defineProperty(mt, "nodeMessage", {
|
|
4528
4550
|
enumerable: !0,
|
|
4529
4551
|
configurable: !0,
|
|
4530
4552
|
writable: !0,
|
|
4531
4553
|
value: /nonce has max value/
|
|
4532
4554
|
});
|
|
4533
|
-
class
|
|
4555
|
+
class yt extends f {
|
|
4534
4556
|
constructor({ cause: t } = {}) {
|
|
4535
4557
|
super([
|
|
4536
4558
|
"The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
|
|
@@ -4551,13 +4573,13 @@ class bt extends f {
|
|
|
4551
4573
|
});
|
|
4552
4574
|
}
|
|
4553
4575
|
}
|
|
4554
|
-
Object.defineProperty(
|
|
4576
|
+
Object.defineProperty(yt, "nodeMessage", {
|
|
4555
4577
|
enumerable: !0,
|
|
4556
4578
|
configurable: !0,
|
|
4557
4579
|
writable: !0,
|
|
4558
4580
|
value: /insufficient funds|exceeds transaction sender account balance/
|
|
4559
4581
|
});
|
|
4560
|
-
class
|
|
4582
|
+
class bt extends f {
|
|
4561
4583
|
constructor({ cause: t, gas: n } = {}) {
|
|
4562
4584
|
super(`The amount of gas ${n ? `(${n}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, {
|
|
4563
4585
|
cause: t,
|
|
@@ -4565,7 +4587,7 @@ class mt extends f {
|
|
|
4565
4587
|
});
|
|
4566
4588
|
}
|
|
4567
4589
|
}
|
|
4568
|
-
Object.defineProperty(
|
|
4590
|
+
Object.defineProperty(bt, "nodeMessage", {
|
|
4569
4591
|
enumerable: !0,
|
|
4570
4592
|
configurable: !0,
|
|
4571
4593
|
writable: !0,
|
|
@@ -4624,7 +4646,7 @@ class qn extends f {
|
|
|
4624
4646
|
});
|
|
4625
4647
|
}
|
|
4626
4648
|
}
|
|
4627
|
-
function
|
|
4649
|
+
function Oi(e, t) {
|
|
4628
4650
|
const n = (e.details || "").toLowerCase(), r = e instanceof f ? e.walk((s) => s?.code === Te.code) : e;
|
|
4629
4651
|
return r instanceof f ? new Te({
|
|
4630
4652
|
cause: e,
|
|
@@ -4638,7 +4660,7 @@ function Oa(e, t) {
|
|
|
4638
4660
|
}) : lt.nodeMessage.test(n) ? new lt({
|
|
4639
4661
|
cause: e,
|
|
4640
4662
|
maxFeePerGas: t?.maxFeePerGas
|
|
4641
|
-
}) : ft.nodeMessage.test(n) ? new ft({ cause: e, nonce: t?.nonce }) : pt.nodeMessage.test(n) ? new pt({ cause: e, nonce: t?.nonce }) :
|
|
4663
|
+
}) : ft.nodeMessage.test(n) ? new ft({ cause: e, nonce: t?.nonce }) : pt.nodeMessage.test(n) ? new pt({ cause: e, nonce: t?.nonce }) : mt.nodeMessage.test(n) ? new mt({ cause: e, nonce: t?.nonce }) : yt.nodeMessage.test(n) ? new yt({ cause: e }) : bt.nodeMessage.test(n) ? new bt({ cause: e, gas: t?.gas }) : ht.nodeMessage.test(n) ? new ht({ cause: e, gas: t?.gas }) : gt.nodeMessage.test(n) ? new gt({ cause: e }) : _e.nodeMessage.test(n) ? new _e({
|
|
4642
4664
|
cause: e,
|
|
4643
4665
|
maxFeePerGas: t?.maxFeePerGas,
|
|
4644
4666
|
maxPriorityFeePerGas: t?.maxPriorityFeePerGas
|
|
@@ -4646,51 +4668,51 @@ function Oa(e, t) {
|
|
|
4646
4668
|
cause: e
|
|
4647
4669
|
});
|
|
4648
4670
|
}
|
|
4649
|
-
function
|
|
4671
|
+
function Bi(e, { docsPath: t, ...n }) {
|
|
4650
4672
|
const r = (() => {
|
|
4651
|
-
const s =
|
|
4673
|
+
const s = Oi(e, n);
|
|
4652
4674
|
return s instanceof qn ? e : s;
|
|
4653
4675
|
})();
|
|
4654
|
-
return new
|
|
4676
|
+
return new mi(r, {
|
|
4655
4677
|
docsPath: t,
|
|
4656
4678
|
...n
|
|
4657
4679
|
});
|
|
4658
4680
|
}
|
|
4659
|
-
function
|
|
4681
|
+
function Ui(e, { format: t }) {
|
|
4660
4682
|
if (!t)
|
|
4661
4683
|
return {};
|
|
4662
4684
|
const n = {};
|
|
4663
|
-
function r(
|
|
4664
|
-
const
|
|
4665
|
-
for (const o of
|
|
4666
|
-
o in e && (n[o] = e[o]),
|
|
4685
|
+
function r(a) {
|
|
4686
|
+
const i = Object.keys(a);
|
|
4687
|
+
for (const o of i)
|
|
4688
|
+
o in e && (n[o] = e[o]), a[o] && typeof a[o] == "object" && !Array.isArray(a[o]) && r(a[o]);
|
|
4667
4689
|
}
|
|
4668
4690
|
const s = t(e || {});
|
|
4669
4691
|
return r(s), n;
|
|
4670
4692
|
}
|
|
4671
|
-
const
|
|
4693
|
+
const Li = {
|
|
4672
4694
|
legacy: "0x0",
|
|
4673
4695
|
eip2930: "0x1",
|
|
4674
4696
|
eip1559: "0x2",
|
|
4675
4697
|
eip4844: "0x3",
|
|
4676
4698
|
eip7702: "0x4"
|
|
4677
4699
|
};
|
|
4678
|
-
function
|
|
4700
|
+
function Fi(e, t) {
|
|
4679
4701
|
const n = {};
|
|
4680
|
-
return typeof e.authorizationList < "u" && (n.authorizationList =
|
|
4702
|
+
return typeof e.authorizationList < "u" && (n.authorizationList = ji(e.authorizationList)), typeof e.accessList < "u" && (n.accessList = e.accessList), typeof e.blobVersionedHashes < "u" && (n.blobVersionedHashes = e.blobVersionedHashes), typeof e.blobs < "u" && (typeof e.blobs[0] != "string" ? n.blobs = e.blobs.map((r) => ue(r)) : n.blobs = e.blobs), typeof e.data < "u" && (n.data = e.data), e.account && (n.from = e.account.address), typeof e.from < "u" && (n.from = e.from), typeof e.gas < "u" && (n.gas = k(e.gas)), typeof e.gasPrice < "u" && (n.gasPrice = k(e.gasPrice)), typeof e.maxFeePerBlobGas < "u" && (n.maxFeePerBlobGas = k(e.maxFeePerBlobGas)), typeof e.maxFeePerGas < "u" && (n.maxFeePerGas = k(e.maxFeePerGas)), typeof e.maxPriorityFeePerGas < "u" && (n.maxPriorityFeePerGas = k(e.maxPriorityFeePerGas)), typeof e.nonce < "u" && (n.nonce = k(e.nonce)), typeof e.to < "u" && (n.to = e.to), typeof e.type < "u" && (n.type = Li[e.type]), typeof e.value < "u" && (n.value = k(e.value)), n;
|
|
4681
4703
|
}
|
|
4682
|
-
function
|
|
4704
|
+
function ji(e) {
|
|
4683
4705
|
return e.map((t) => ({
|
|
4684
4706
|
address: t.address,
|
|
4685
|
-
r: t.r ?
|
|
4686
|
-
s: t.s ?
|
|
4687
|
-
chainId:
|
|
4688
|
-
nonce:
|
|
4689
|
-
...typeof t.yParity < "u" ? { yParity:
|
|
4690
|
-
...typeof t.v < "u" && typeof t.yParity > "u" ? { v:
|
|
4707
|
+
r: t.r ? k(BigInt(t.r)) : t.r,
|
|
4708
|
+
s: t.s ? k(BigInt(t.s)) : t.s,
|
|
4709
|
+
chainId: k(t.chainId),
|
|
4710
|
+
nonce: k(t.nonce),
|
|
4711
|
+
...typeof t.yParity < "u" ? { yParity: k(t.yParity) } : {},
|
|
4712
|
+
...typeof t.v < "u" && typeof t.yParity > "u" ? { v: k(t.v) } : {}
|
|
4691
4713
|
}));
|
|
4692
4714
|
}
|
|
4693
|
-
function
|
|
4715
|
+
function zi() {
|
|
4694
4716
|
let e = () => {
|
|
4695
4717
|
}, t = () => {
|
|
4696
4718
|
};
|
|
@@ -4699,29 +4721,29 @@ function za() {
|
|
|
4699
4721
|
}), resolve: e, reject: t };
|
|
4700
4722
|
}
|
|
4701
4723
|
const rt = /* @__PURE__ */ new Map();
|
|
4702
|
-
function
|
|
4703
|
-
const
|
|
4724
|
+
function _i({ fn: e, id: t, shouldSplitBatch: n, wait: r = 0, sort: s }) {
|
|
4725
|
+
const a = async () => {
|
|
4704
4726
|
const l = c();
|
|
4705
|
-
|
|
4706
|
-
const
|
|
4707
|
-
|
|
4727
|
+
i();
|
|
4728
|
+
const y = l.map(({ args: p }) => p);
|
|
4729
|
+
y.length !== 0 && e(y).then((p) => {
|
|
4708
4730
|
s && Array.isArray(p) && p.sort(s);
|
|
4709
|
-
for (let
|
|
4710
|
-
const { resolve: h } = l[
|
|
4711
|
-
h?.([p[
|
|
4731
|
+
for (let m = 0; m < l.length; m++) {
|
|
4732
|
+
const { resolve: h } = l[m];
|
|
4733
|
+
h?.([p[m], p]);
|
|
4712
4734
|
}
|
|
4713
4735
|
}).catch((p) => {
|
|
4714
|
-
for (let
|
|
4715
|
-
const { reject: h } = l[
|
|
4736
|
+
for (let m = 0; m < l.length; m++) {
|
|
4737
|
+
const { reject: h } = l[m];
|
|
4716
4738
|
h?.(p);
|
|
4717
4739
|
}
|
|
4718
4740
|
});
|
|
4719
|
-
},
|
|
4741
|
+
}, i = () => rt.delete(t), o = () => c().map(({ args: l }) => l), c = () => rt.get(t) || [], d = (l) => rt.set(t, [...c(), l]);
|
|
4720
4742
|
return {
|
|
4721
|
-
flush:
|
|
4743
|
+
flush: i,
|
|
4722
4744
|
async schedule(l) {
|
|
4723
|
-
const { promise:
|
|
4724
|
-
return n?.([...o(), l]) &&
|
|
4745
|
+
const { promise: y, resolve: p, reject: m } = zi();
|
|
4746
|
+
return n?.([...o(), l]) && a(), c().length > 0 ? (d({ args: l, resolve: p, reject: m }), y) : (d({ args: l, resolve: p, reject: m }), setTimeout(a, r), y);
|
|
4725
4747
|
}
|
|
4726
4748
|
};
|
|
4727
4749
|
}
|
|
@@ -4743,16 +4765,16 @@ function Qt(e) {
|
|
|
4743
4765
|
return t[n] = r, t;
|
|
4744
4766
|
}, {});
|
|
4745
4767
|
}
|
|
4746
|
-
function
|
|
4747
|
-
const { balance: t, nonce: n, state: r, stateDiff: s, code:
|
|
4748
|
-
if (
|
|
4749
|
-
if (
|
|
4750
|
-
throw new
|
|
4751
|
-
|
|
4768
|
+
function Gi(e) {
|
|
4769
|
+
const { balance: t, nonce: n, state: r, stateDiff: s, code: a } = e, i = {};
|
|
4770
|
+
if (a !== void 0 && (i.code = a), t !== void 0 && (i.balance = k(t)), n !== void 0 && (i.nonce = k(n)), r !== void 0 && (i.state = Qt(r)), s !== void 0) {
|
|
4771
|
+
if (i.state)
|
|
4772
|
+
throw new li();
|
|
4773
|
+
i.stateDiff = Qt(s);
|
|
4752
4774
|
}
|
|
4753
|
-
return
|
|
4775
|
+
return i;
|
|
4754
4776
|
}
|
|
4755
|
-
function
|
|
4777
|
+
function Vi(e) {
|
|
4756
4778
|
if (!e)
|
|
4757
4779
|
return;
|
|
4758
4780
|
const t = {};
|
|
@@ -4760,43 +4782,43 @@ function Va(e) {
|
|
|
4760
4782
|
if (!ge(n, { strict: !1 }))
|
|
4761
4783
|
throw new Le({ address: n });
|
|
4762
4784
|
if (t[n])
|
|
4763
|
-
throw new
|
|
4764
|
-
t[n] =
|
|
4785
|
+
throw new di({ address: n });
|
|
4786
|
+
t[n] = Gi(r);
|
|
4765
4787
|
}
|
|
4766
4788
|
return t;
|
|
4767
4789
|
}
|
|
4768
|
-
const
|
|
4769
|
-
function
|
|
4770
|
-
const { account: t, maxFeePerGas: n, maxPriorityFeePerGas: r, to: s } = e,
|
|
4771
|
-
if (
|
|
4772
|
-
throw new Le({ address:
|
|
4790
|
+
const Hi = 2n ** 256n - 1n;
|
|
4791
|
+
function Wi(e) {
|
|
4792
|
+
const { account: t, maxFeePerGas: n, maxPriorityFeePerGas: r, to: s } = e, a = t ? Dt(t) : void 0;
|
|
4793
|
+
if (a && !ge(a.address))
|
|
4794
|
+
throw new Le({ address: a.address });
|
|
4773
4795
|
if (s && !ge(s))
|
|
4774
4796
|
throw new Le({ address: s });
|
|
4775
|
-
if (n && n >
|
|
4797
|
+
if (n && n > Hi)
|
|
4776
4798
|
throw new ze({ maxFeePerGas: n });
|
|
4777
4799
|
if (r && n && r > n)
|
|
4778
4800
|
throw new _e({ maxFeePerGas: n, maxPriorityFeePerGas: r });
|
|
4779
4801
|
}
|
|
4780
|
-
async function
|
|
4781
|
-
const { account: n = e.account, authorizationList: r, batch: s = !!e.batch?.multicall, blockNumber:
|
|
4782
|
-
if (l && (p ||
|
|
4802
|
+
async function Ki(e, t) {
|
|
4803
|
+
const { account: n = e.account, authorizationList: r, batch: s = !!e.batch?.multicall, blockNumber: a, blockTag: i = e.experimental_blockTag ?? "latest", accessList: o, blobs: c, blockOverrides: d, code: l, data: y, factory: p, factoryData: m, gas: h, gasPrice: v, maxFeePerBlobGas: P, maxFeePerGas: T, maxPriorityFeePerGas: b, nonce: x, to: S, value: N, stateOverride: D, ...J } = t, Q = n ? Dt(n) : void 0;
|
|
4804
|
+
if (l && (p || m))
|
|
4783
4805
|
throw new f("Cannot provide both `code` & `factory`/`factoryData` as parameters.");
|
|
4784
4806
|
if (l && S)
|
|
4785
4807
|
throw new f("Cannot provide both `code` & `to` as parameters.");
|
|
4786
|
-
const H = l &&
|
|
4808
|
+
const H = l && y, q = p && m && S && y, U = H || q, le = H ? er({
|
|
4787
4809
|
code: l,
|
|
4788
|
-
data:
|
|
4789
|
-
}) : q ?
|
|
4790
|
-
data:
|
|
4810
|
+
data: y
|
|
4811
|
+
}) : q ? Xi({
|
|
4812
|
+
data: y,
|
|
4791
4813
|
factory: p,
|
|
4792
|
-
factoryData:
|
|
4814
|
+
factoryData: m,
|
|
4793
4815
|
to: S
|
|
4794
|
-
}) :
|
|
4816
|
+
}) : y;
|
|
4795
4817
|
try {
|
|
4796
|
-
|
|
4797
|
-
const L = (typeof
|
|
4818
|
+
Wi(t);
|
|
4819
|
+
const L = (typeof a == "bigint" ? k(a) : void 0) || i, M = d ? Ii(d) : void 0, z = Vi(D), W = e.chain?.formatters?.transactionRequest?.format, R = (W || Fi)({
|
|
4798
4820
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
4799
|
-
...
|
|
4821
|
+
...Ui(J, { format: W }),
|
|
4800
4822
|
accessList: o,
|
|
4801
4823
|
account: Q,
|
|
4802
4824
|
authorizationList: r,
|
|
@@ -4806,17 +4828,17 @@ async function Ka(e, t) {
|
|
|
4806
4828
|
gasPrice: v,
|
|
4807
4829
|
maxFeePerBlobGas: P,
|
|
4808
4830
|
maxFeePerGas: T,
|
|
4809
|
-
maxPriorityFeePerGas:
|
|
4831
|
+
maxPriorityFeePerGas: b,
|
|
4810
4832
|
nonce: x,
|
|
4811
4833
|
to: U ? void 0 : S,
|
|
4812
4834
|
value: N
|
|
4813
4835
|
}, "call");
|
|
4814
|
-
if (s &&
|
|
4836
|
+
if (s && Yi({ request: R }) && !z && !M)
|
|
4815
4837
|
try {
|
|
4816
|
-
return await
|
|
4838
|
+
return await Zi(e, {
|
|
4817
4839
|
...R,
|
|
4818
|
-
blockNumber:
|
|
4819
|
-
blockTag:
|
|
4840
|
+
blockNumber: a,
|
|
4841
|
+
blockTag: i
|
|
4820
4842
|
});
|
|
4821
4843
|
} catch (ee) {
|
|
4822
4844
|
if (!(ee instanceof Gn) && !(ee instanceof dt))
|
|
@@ -4828,44 +4850,44 @@ async function Ka(e, t) {
|
|
|
4828
4850
|
L
|
|
4829
4851
|
];
|
|
4830
4852
|
return z && M ? [...ee, z, M] : z ? [...ee, z] : M ? [...ee, {}, M] : ee;
|
|
4831
|
-
})(),
|
|
4853
|
+
})(), me = await e.request({
|
|
4832
4854
|
method: "eth_call",
|
|
4833
4855
|
params: K
|
|
4834
4856
|
});
|
|
4835
|
-
return
|
|
4857
|
+
return me === "0x" ? { data: void 0 } : { data: me };
|
|
4836
4858
|
} catch ($) {
|
|
4837
|
-
const L =
|
|
4859
|
+
const L = Ji($), { offchainLookup: M, offchainLookupSignature: z } = await import("./ccip-DIsMfc62.js");
|
|
4838
4860
|
if (e.ccipRead !== !1 && L?.slice(0, 10) === z && S)
|
|
4839
4861
|
return { data: await M(e, { data: L, to: S }) };
|
|
4840
|
-
throw U && L?.slice(0, 10) === "0x101bb98d" ? new
|
|
4862
|
+
throw U && L?.slice(0, 10) === "0x101bb98d" ? new gi({ factory: p }) : Bi($, {
|
|
4841
4863
|
...t,
|
|
4842
4864
|
account: Q,
|
|
4843
4865
|
chain: e.chain
|
|
4844
4866
|
});
|
|
4845
4867
|
}
|
|
4846
4868
|
}
|
|
4847
|
-
function
|
|
4869
|
+
function Yi({ request: e }) {
|
|
4848
4870
|
const { data: t, to: n, ...r } = e;
|
|
4849
|
-
return !(!t || t.startsWith(
|
|
4871
|
+
return !(!t || t.startsWith(Ni) || !n || Object.values(r).filter((s) => typeof s < "u").length > 0);
|
|
4850
4872
|
}
|
|
4851
|
-
async function
|
|
4852
|
-
const { batchSize: n = 1024, deployless: r = !1, wait: s = 0 } = typeof e.batch?.multicall == "object" ? e.batch.multicall : {}, { blockNumber:
|
|
4873
|
+
async function Zi(e, t) {
|
|
4874
|
+
const { batchSize: n = 1024, deployless: r = !1, wait: s = 0 } = typeof e.batch?.multicall == "object" ? e.batch.multicall : {}, { blockNumber: a, blockTag: i = e.experimental_blockTag ?? "latest", data: o, to: c } = t, d = (() => {
|
|
4853
4875
|
if (r)
|
|
4854
4876
|
return null;
|
|
4855
4877
|
if (t.multicallAddress)
|
|
4856
4878
|
return t.multicallAddress;
|
|
4857
4879
|
if (e.chain)
|
|
4858
|
-
return
|
|
4859
|
-
blockNumber:
|
|
4880
|
+
return ni({
|
|
4881
|
+
blockNumber: a,
|
|
4860
4882
|
chain: e.chain,
|
|
4861
4883
|
contract: "multicall3"
|
|
4862
4884
|
});
|
|
4863
4885
|
throw new Gn();
|
|
4864
|
-
})(),
|
|
4865
|
-
id: `${e.uid}.${
|
|
4886
|
+
})(), y = (typeof a == "bigint" ? k(a) : void 0) || i, { schedule: p } = _i({
|
|
4887
|
+
id: `${e.uid}.${y}`,
|
|
4866
4888
|
wait: s,
|
|
4867
4889
|
shouldSplitBatch(v) {
|
|
4868
|
-
return v.reduce((T, { data:
|
|
4890
|
+
return v.reduce((T, { data: b }) => T + (b.length - 2), 0) > n * 2;
|
|
4869
4891
|
},
|
|
4870
4892
|
fn: async (v) => {
|
|
4871
4893
|
const P = v.map((x) => ({
|
|
@@ -4876,100 +4898,100 @@ async function Za(e, t) {
|
|
|
4876
4898
|
abi: Ut,
|
|
4877
4899
|
args: [P],
|
|
4878
4900
|
functionName: "aggregate3"
|
|
4879
|
-
}),
|
|
4901
|
+
}), b = await e.request({
|
|
4880
4902
|
method: "eth_call",
|
|
4881
4903
|
params: [
|
|
4882
4904
|
{
|
|
4883
4905
|
...d === null ? {
|
|
4884
4906
|
data: er({
|
|
4885
|
-
code:
|
|
4907
|
+
code: Di,
|
|
4886
4908
|
data: T
|
|
4887
4909
|
})
|
|
4888
4910
|
} : { to: d, data: T }
|
|
4889
4911
|
},
|
|
4890
|
-
|
|
4912
|
+
y
|
|
4891
4913
|
]
|
|
4892
4914
|
});
|
|
4893
4915
|
return zn({
|
|
4894
4916
|
abi: Ut,
|
|
4895
4917
|
args: [P],
|
|
4896
4918
|
functionName: "aggregate3",
|
|
4897
|
-
data:
|
|
4919
|
+
data: b || "0x"
|
|
4898
4920
|
});
|
|
4899
4921
|
}
|
|
4900
|
-
}), [{ returnData:
|
|
4922
|
+
}), [{ returnData: m, success: h }] = await p({ data: o, to: c });
|
|
4901
4923
|
if (!h)
|
|
4902
|
-
throw new Yn({ data:
|
|
4903
|
-
return
|
|
4924
|
+
throw new Yn({ data: m });
|
|
4925
|
+
return m === "0x" ? { data: void 0 } : { data: m };
|
|
4904
4926
|
}
|
|
4905
4927
|
function er(e) {
|
|
4906
4928
|
const { code: t, data: n } = e;
|
|
4907
4929
|
return Qn({
|
|
4908
4930
|
abi: Ln(["constructor(bytes, bytes)"]),
|
|
4909
|
-
bytecode:
|
|
4931
|
+
bytecode: Ri,
|
|
4910
4932
|
args: [t, n]
|
|
4911
4933
|
});
|
|
4912
4934
|
}
|
|
4913
|
-
function
|
|
4935
|
+
function Xi(e) {
|
|
4914
4936
|
const { data: t, factory: n, factoryData: r, to: s } = e;
|
|
4915
4937
|
return Qn({
|
|
4916
4938
|
abi: Ln(["constructor(address, bytes, address, bytes)"]),
|
|
4917
|
-
bytecode:
|
|
4939
|
+
bytecode: Mi,
|
|
4918
4940
|
args: [s, t, n, r]
|
|
4919
4941
|
});
|
|
4920
4942
|
}
|
|
4921
|
-
function
|
|
4943
|
+
function Ji(e) {
|
|
4922
4944
|
if (!(e instanceof f))
|
|
4923
4945
|
return;
|
|
4924
4946
|
const t = e.walk();
|
|
4925
4947
|
return typeof t?.data == "object" ? t.data?.data : t.data;
|
|
4926
4948
|
}
|
|
4927
|
-
async function
|
|
4928
|
-
const { abi: n, address: r, args: s, functionName:
|
|
4949
|
+
async function Qi(e, t) {
|
|
4950
|
+
const { abi: n, address: r, args: s, functionName: a, ...i } = t, o = _n({
|
|
4929
4951
|
abi: n,
|
|
4930
4952
|
args: s,
|
|
4931
|
-
functionName:
|
|
4953
|
+
functionName: a
|
|
4932
4954
|
});
|
|
4933
4955
|
try {
|
|
4934
|
-
const { data: c } = await
|
|
4935
|
-
...
|
|
4956
|
+
const { data: c } = await wi(e, Ki, "call")({
|
|
4957
|
+
...i,
|
|
4936
4958
|
data: o,
|
|
4937
4959
|
to: r
|
|
4938
4960
|
});
|
|
4939
4961
|
return zn({
|
|
4940
4962
|
abi: n,
|
|
4941
4963
|
args: s,
|
|
4942
|
-
functionName:
|
|
4964
|
+
functionName: a,
|
|
4943
4965
|
data: c || "0x"
|
|
4944
4966
|
});
|
|
4945
4967
|
} catch (c) {
|
|
4946
|
-
throw
|
|
4968
|
+
throw vi(c, {
|
|
4947
4969
|
abi: n,
|
|
4948
4970
|
address: r,
|
|
4949
4971
|
args: s,
|
|
4950
4972
|
docsPath: "/docs/contract/readContract",
|
|
4951
|
-
functionName:
|
|
4973
|
+
functionName: a
|
|
4952
4974
|
});
|
|
4953
4975
|
}
|
|
4954
4976
|
}
|
|
4955
|
-
function
|
|
4977
|
+
function qi(e, t, n) {
|
|
4956
4978
|
const r = e[t.name];
|
|
4957
4979
|
if (typeof r == "function")
|
|
4958
4980
|
return r;
|
|
4959
4981
|
const s = e[n];
|
|
4960
|
-
return typeof s == "function" ? s : (
|
|
4982
|
+
return typeof s == "function" ? s : (a) => t(e, a);
|
|
4961
4983
|
}
|
|
4962
4984
|
function eo(e, t) {
|
|
4963
4985
|
const { chainId: n, ...r } = t, s = e.getClient({ chainId: n });
|
|
4964
|
-
return
|
|
4986
|
+
return qi(s, Qi, "readContract")(r);
|
|
4965
4987
|
}
|
|
4966
4988
|
function to() {
|
|
4967
4989
|
const { address: e } = Ge(), t = hr(), {
|
|
4968
4990
|
writeContractAsync: n,
|
|
4969
4991
|
data: r,
|
|
4970
4992
|
isPending: s,
|
|
4971
|
-
error:
|
|
4972
|
-
} = wt(), { isLoading:
|
|
4993
|
+
error: a
|
|
4994
|
+
} = wt(), { isLoading: i, isSuccess: o } = xt({
|
|
4973
4995
|
hash: r
|
|
4974
4996
|
}), c = () => j({
|
|
4975
4997
|
address: O.PAYMENT_ROUTER,
|
|
@@ -4983,7 +5005,7 @@ function to() {
|
|
|
4983
5005
|
address: O.PAYMENT_ROUTER,
|
|
4984
5006
|
abi: De,
|
|
4985
5007
|
functionName: "paused"
|
|
4986
|
-
}),
|
|
5008
|
+
}), y = async (h, v) => {
|
|
4987
5009
|
try {
|
|
4988
5010
|
return await eo(t, {
|
|
4989
5011
|
address: h,
|
|
@@ -5000,7 +5022,7 @@ function to() {
|
|
|
5000
5022
|
if (h === "0x0000000000000000000000000000000000000000")
|
|
5001
5023
|
return null;
|
|
5002
5024
|
try {
|
|
5003
|
-
return await
|
|
5025
|
+
return await y(h, e) >= v ? (console.log(
|
|
5004
5026
|
`Sufficient allowance for ${h}, skipping approval`
|
|
5005
5027
|
), null) : (console.log(`Requesting infinite approval for ${h}`), await n({
|
|
5006
5028
|
address: h,
|
|
@@ -5019,7 +5041,7 @@ function to() {
|
|
|
5019
5041
|
tokens: v,
|
|
5020
5042
|
totalAmountUSD: P,
|
|
5021
5043
|
settleInIDR: T,
|
|
5022
|
-
target:
|
|
5044
|
+
target: b,
|
|
5023
5045
|
callData: x
|
|
5024
5046
|
}) => {
|
|
5025
5047
|
if (!e)
|
|
@@ -5048,7 +5070,7 @@ function to() {
|
|
|
5048
5070
|
throw new Error(`Failed to approve ${L.symbol}: ${M}`);
|
|
5049
5071
|
}
|
|
5050
5072
|
}
|
|
5051
|
-
const q = BigInt(Math.floor(P *
|
|
5073
|
+
const q = BigInt(Math.floor(P * Mr)), U = b || "0x0000000000000000000000000000000000000000", le = x || "0x";
|
|
5052
5074
|
return await n({
|
|
5053
5075
|
address: O.PAYMENT_ROUTER,
|
|
5054
5076
|
abi: De,
|
|
@@ -5072,39 +5094,39 @@ function to() {
|
|
|
5072
5094
|
// Transaction state
|
|
5073
5095
|
hash: r,
|
|
5074
5096
|
isPending: s,
|
|
5075
|
-
isConfirming:
|
|
5097
|
+
isConfirming: i,
|
|
5076
5098
|
isConfirmed: o,
|
|
5077
|
-
error:
|
|
5099
|
+
error: a
|
|
5078
5100
|
};
|
|
5079
5101
|
}
|
|
5080
5102
|
function Be(e) {
|
|
5081
|
-
const { address: t } = Ge(), { writeContract: n, data: r, isPending: s, error:
|
|
5103
|
+
const { address: t } = Ge(), { writeContract: n, data: r, isPending: s, error: a } = wt(), { isLoading: i, isSuccess: o } = xt({
|
|
5082
5104
|
hash: r
|
|
5083
5105
|
});
|
|
5084
5106
|
return {
|
|
5085
5107
|
// Write functions
|
|
5086
|
-
transfer: (T,
|
|
5108
|
+
transfer: (T, b) => {
|
|
5087
5109
|
n({
|
|
5088
5110
|
address: e,
|
|
5089
5111
|
abi: te,
|
|
5090
5112
|
functionName: "transfer",
|
|
5091
|
-
args: [T,
|
|
5113
|
+
args: [T, b]
|
|
5092
5114
|
});
|
|
5093
5115
|
},
|
|
5094
|
-
approve: (T,
|
|
5116
|
+
approve: (T, b) => {
|
|
5095
5117
|
n({
|
|
5096
5118
|
address: e,
|
|
5097
5119
|
abi: te,
|
|
5098
5120
|
functionName: "approve",
|
|
5099
|
-
args: [T,
|
|
5121
|
+
args: [T, b]
|
|
5100
5122
|
});
|
|
5101
5123
|
},
|
|
5102
|
-
transferFrom: (T,
|
|
5124
|
+
transferFrom: (T, b, x) => {
|
|
5103
5125
|
n({
|
|
5104
5126
|
address: e,
|
|
5105
5127
|
abi: te,
|
|
5106
5128
|
functionName: "transferFrom",
|
|
5107
|
-
args: [T,
|
|
5129
|
+
args: [T, b, x]
|
|
5108
5130
|
});
|
|
5109
5131
|
},
|
|
5110
5132
|
// Read hooks
|
|
@@ -5129,64 +5151,64 @@ function Be(e) {
|
|
|
5129
5151
|
functionName: "totalSupply"
|
|
5130
5152
|
}),
|
|
5131
5153
|
useBalanceOf: (T) => {
|
|
5132
|
-
const
|
|
5154
|
+
const b = T || t;
|
|
5133
5155
|
return j({
|
|
5134
5156
|
address: e,
|
|
5135
5157
|
abi: te,
|
|
5136
5158
|
functionName: "balanceOf",
|
|
5137
|
-
args:
|
|
5138
|
-
query: { enabled: !!
|
|
5159
|
+
args: b ? [b] : void 0,
|
|
5160
|
+
query: { enabled: !!b }
|
|
5139
5161
|
});
|
|
5140
5162
|
},
|
|
5141
|
-
useAllowance: (T,
|
|
5163
|
+
useAllowance: (T, b) => j({
|
|
5142
5164
|
address: e,
|
|
5143
5165
|
abi: te,
|
|
5144
5166
|
functionName: "allowance",
|
|
5145
|
-
args: T &&
|
|
5146
|
-
query: { enabled: !!(T &&
|
|
5167
|
+
args: T && b ? [T, b] : void 0,
|
|
5168
|
+
query: { enabled: !!(T && b) }
|
|
5147
5169
|
}),
|
|
5148
5170
|
// Transaction state
|
|
5149
5171
|
hash: r,
|
|
5150
5172
|
isPending: s,
|
|
5151
|
-
isConfirming:
|
|
5173
|
+
isConfirming: i,
|
|
5152
5174
|
isConfirmed: o,
|
|
5153
|
-
error:
|
|
5175
|
+
error: a
|
|
5154
5176
|
};
|
|
5155
5177
|
}
|
|
5156
5178
|
function no() {
|
|
5157
5179
|
const { address: e } = Ge(), { data: t, isLoading: n } = gr({
|
|
5158
5180
|
address: e
|
|
5159
|
-
}), r = Be(E.USDC), s = Be(E.USDT),
|
|
5181
|
+
}), r = Be(E.USDC), s = Be(E.USDT), a = Be(E.DAI), i = Be(E.WBTC), { data: o, isLoading: c } = r.useBalanceOf(e), { data: d, isLoading: l } = s.useBalanceOf(e), { data: y, isLoading: p } = a.useBalanceOf(e), { data: m, isLoading: h } = i.useBalanceOf(e);
|
|
5160
5182
|
return {
|
|
5161
5183
|
balances: {
|
|
5162
5184
|
ETH: t ? parseFloat(Ce(t.value, 18)) : 0,
|
|
5163
5185
|
USDC: o ? parseFloat(Ce(o, 6)) : 0,
|
|
5164
5186
|
USDT: d ? parseFloat(Ce(d, 6)) : 0,
|
|
5165
|
-
DAI:
|
|
5166
|
-
WBTC:
|
|
5187
|
+
DAI: y ? parseFloat(Ce(y, 18)) : 0,
|
|
5188
|
+
WBTC: m ? parseFloat(Ce(m, 8)) : 0
|
|
5167
5189
|
},
|
|
5168
5190
|
isLoading: !e || n || c || l || p || h
|
|
5169
5191
|
};
|
|
5170
5192
|
}
|
|
5171
5193
|
function ro() {
|
|
5172
|
-
const e =
|
|
5194
|
+
const e = Tt(), {
|
|
5173
5195
|
data: t,
|
|
5174
5196
|
isLoading: n,
|
|
5175
5197
|
error: r
|
|
5176
5198
|
} = e.useGetTokenPrice(E.NATIVE), {
|
|
5177
5199
|
data: s,
|
|
5178
|
-
isLoading:
|
|
5179
|
-
error:
|
|
5200
|
+
isLoading: a,
|
|
5201
|
+
error: i
|
|
5180
5202
|
} = e.useGetTokenPrice(E.USDC), {
|
|
5181
5203
|
data: o,
|
|
5182
5204
|
isLoading: c,
|
|
5183
5205
|
error: d
|
|
5184
5206
|
} = e.useGetTokenPrice(E.USDT), {
|
|
5185
5207
|
data: l,
|
|
5186
|
-
isLoading:
|
|
5208
|
+
isLoading: y,
|
|
5187
5209
|
error: p
|
|
5188
5210
|
} = e.useGetTokenPrice(E.DAI), {
|
|
5189
|
-
data:
|
|
5211
|
+
data: m,
|
|
5190
5212
|
isLoading: h,
|
|
5191
5213
|
error: v
|
|
5192
5214
|
} = e.useGetTokenPrice(E.WBTC), P = 1e8, T = (x) => {
|
|
@@ -5206,27 +5228,27 @@ function ro() {
|
|
|
5206
5228
|
return console.error("Error converting price:", S), 0;
|
|
5207
5229
|
}
|
|
5208
5230
|
};
|
|
5209
|
-
r && console.error("ETH price error:", r),
|
|
5210
|
-
const
|
|
5231
|
+
r && console.error("ETH price error:", r), i && console.error("USDC price error:", i), d && console.error("USDT price error:", d), p && console.error("DAI price error:", p), v && console.error("WBTC price error:", v);
|
|
5232
|
+
const b = {
|
|
5211
5233
|
ETH: T(t),
|
|
5212
5234
|
USDC: T(s) || 1,
|
|
5213
5235
|
USDT: T(o) || 1,
|
|
5214
5236
|
DAI: T(l) || 1,
|
|
5215
|
-
WBTC: T(
|
|
5237
|
+
WBTC: T(m)
|
|
5216
5238
|
};
|
|
5217
|
-
return console.log("Converted prices:",
|
|
5218
|
-
prices:
|
|
5219
|
-
isLoading: n ||
|
|
5239
|
+
return console.log("Converted prices:", b), {
|
|
5240
|
+
prices: b,
|
|
5241
|
+
isLoading: n || a || c || y || h,
|
|
5220
5242
|
errors: {
|
|
5221
5243
|
ETH: r,
|
|
5222
|
-
USDC:
|
|
5244
|
+
USDC: i,
|
|
5223
5245
|
USDT: d,
|
|
5224
5246
|
DAI: p,
|
|
5225
5247
|
WBTC: v
|
|
5226
5248
|
}
|
|
5227
5249
|
};
|
|
5228
5250
|
}
|
|
5229
|
-
class
|
|
5251
|
+
class ie extends Error {
|
|
5230
5252
|
code;
|
|
5231
5253
|
details;
|
|
5232
5254
|
constructor(t, n, r) {
|
|
@@ -5236,39 +5258,39 @@ class ae extends Error {
|
|
|
5236
5258
|
function qt(e) {
|
|
5237
5259
|
if (e instanceof Error) {
|
|
5238
5260
|
if (e.message.includes("User rejected") || e.message.includes("User denied"))
|
|
5239
|
-
return new
|
|
5261
|
+
return new ie("Transaction cancelled by user", "USER_REJECTED", e);
|
|
5240
5262
|
if (e.message.includes("Failed to approve"))
|
|
5241
|
-
return new
|
|
5263
|
+
return new ie(e.message, "APPROVAL_FAILED", e);
|
|
5242
5264
|
if (e.message.includes("insufficient funds"))
|
|
5243
|
-
return new
|
|
5265
|
+
return new ie(
|
|
5244
5266
|
"Insufficient funds for gas",
|
|
5245
5267
|
"INSUFFICIENT_FUNDS",
|
|
5246
5268
|
e
|
|
5247
5269
|
);
|
|
5248
5270
|
if (e.message.includes("Wallet not connected"))
|
|
5249
|
-
return new
|
|
5271
|
+
return new ie("Please connect your wallet", "WALLET_NOT_CONNECTED", e);
|
|
5250
5272
|
if (e.message.includes("network"))
|
|
5251
|
-
return new
|
|
5273
|
+
return new ie("Network error. Please check your connection", "NETWORK_ERROR", e);
|
|
5252
5274
|
if (e.message.includes("insufficient payment") || e.message.includes("PaymentRouter: insufficient"))
|
|
5253
|
-
return new
|
|
5275
|
+
return new ie("Payment amount is insufficient. This may be due to price fluctuation. Please try again.", "INSUFFICIENT_PAYMENT", e);
|
|
5254
5276
|
if (e.message.includes("execution reverted"))
|
|
5255
|
-
return new
|
|
5277
|
+
return new ie("Transaction failed. Please try again", "CONTRACT_ERROR", e);
|
|
5256
5278
|
if (e.message)
|
|
5257
|
-
return new
|
|
5279
|
+
return new ie(e.message, "ERROR", e);
|
|
5258
5280
|
}
|
|
5259
|
-
return new
|
|
5281
|
+
return new ie("An unknown error occurred. Please try again", "UNKNOWN", e);
|
|
5260
5282
|
}
|
|
5261
|
-
const so = 1e8,
|
|
5262
|
-
function
|
|
5283
|
+
const so = 1e8, ao = (e) => e.reduce((t, n) => t + n.price, 0);
|
|
5284
|
+
function ko({
|
|
5263
5285
|
merchantAddress: e,
|
|
5264
5286
|
items: t,
|
|
5265
5287
|
config: n,
|
|
5266
5288
|
onPaymentComplete: r,
|
|
5267
5289
|
onPaymentError: s,
|
|
5268
|
-
className:
|
|
5269
|
-
children:
|
|
5290
|
+
className: a = "",
|
|
5291
|
+
children: i
|
|
5270
5292
|
}) {
|
|
5271
|
-
const { isConnected: o } = Ge(), { connect: c, connectors: d } = wr(), l = n?.currency ?? "USD",
|
|
5293
|
+
const { isConnected: o } = Ge(), { connect: c, connectors: d } = wr(), l = n?.currency ?? "USD", y = n?.target, p = n?.callData, m = ao(t), [h, v] = V(!1), [P, T] = V([]), b = Tt(), { balances: x, isLoading: S } = no(), { prices: N, isLoading: D } = ro(), { data: J } = b.useGetTokenPrice(E.IDRX), { executePayment: Q, isConfirmed: H, hash: q, error: U, isPending: le, isConfirming: $ } = to(), M = (() => {
|
|
5272
5294
|
if (!J) return 1 / 15600;
|
|
5273
5295
|
if (Array.isArray(J) && J.length >= 1) {
|
|
5274
5296
|
const R = J[0];
|
|
@@ -5276,7 +5298,7 @@ function Io({
|
|
|
5276
5298
|
return Number(R) / so;
|
|
5277
5299
|
}
|
|
5278
5300
|
return 1 / 15600;
|
|
5279
|
-
})(), z = l === "IDR" ?
|
|
5301
|
+
})(), z = l === "IDR" ? m * M : m, W = () => {
|
|
5280
5302
|
o ? v(!0) : c({ connector: d[0] });
|
|
5281
5303
|
}, re = async (R) => {
|
|
5282
5304
|
try {
|
|
@@ -5285,12 +5307,12 @@ function Io({
|
|
|
5285
5307
|
tokens: R,
|
|
5286
5308
|
totalAmountUSD: z,
|
|
5287
5309
|
settleInIDR: l === "IDR",
|
|
5288
|
-
target:
|
|
5310
|
+
target: y,
|
|
5289
5311
|
callData: p
|
|
5290
5312
|
});
|
|
5291
5313
|
} catch (K) {
|
|
5292
|
-
const
|
|
5293
|
-
s?.(
|
|
5314
|
+
const me = qt(K);
|
|
5315
|
+
s?.(me);
|
|
5294
5316
|
}
|
|
5295
5317
|
};
|
|
5296
5318
|
return ve(() => {
|
|
@@ -5387,8 +5409,8 @@ function Io({
|
|
|
5387
5409
|
{
|
|
5388
5410
|
onClick: W,
|
|
5389
5411
|
disabled: S || D,
|
|
5390
|
-
className: `bg-secondary hover:bg-secondary/90 text-white font-semibold py-3 px-6 rounded-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed ${
|
|
5391
|
-
children:
|
|
5412
|
+
className: `mc:bg-secondary hover:mc:bg-secondary/90 mc:text-white mc:font-semibold mc:py-3 mc:px-6 mc:rounded-lg mc:transition-all disabled:mc:opacity-50 disabled:mc:cursor-not-allowed ${a}`,
|
|
5413
|
+
children: i || (o ? "Pay with MultiCoyn" : "Connect Wallet to Pay")
|
|
5392
5414
|
}
|
|
5393
5415
|
),
|
|
5394
5416
|
o && /* @__PURE__ */ u(
|
|
@@ -5409,7 +5431,7 @@ function Io({
|
|
|
5409
5431
|
)
|
|
5410
5432
|
] });
|
|
5411
5433
|
}
|
|
5412
|
-
const
|
|
5434
|
+
const io = Pr({
|
|
5413
5435
|
id: 4202,
|
|
5414
5436
|
name: "Lisk Sepolia",
|
|
5415
5437
|
nativeCurrency: {
|
|
@@ -5431,27 +5453,27 @@ const ao = Pr({
|
|
|
5431
5453
|
testnet: !0
|
|
5432
5454
|
}), oo = $r({
|
|
5433
5455
|
appName: "MultiCoyn Payment SDK",
|
|
5434
|
-
projectId: "
|
|
5435
|
-
chains: [
|
|
5456
|
+
projectId: "YOUR_PROJECT_ID",
|
|
5457
|
+
chains: [io],
|
|
5436
5458
|
ssr: !1
|
|
5437
5459
|
}), co = new Ar();
|
|
5438
|
-
function
|
|
5460
|
+
function Io({ children: e }) {
|
|
5439
5461
|
return /* @__PURE__ */ u(xr, { config: oo, children: /* @__PURE__ */ u(Sr, { client: co, children: /* @__PURE__ */ u(Cr, { children: e }) }) });
|
|
5440
5462
|
}
|
|
5441
|
-
const tr =
|
|
5463
|
+
const tr = yr(
|
|
5442
5464
|
void 0
|
|
5443
5465
|
);
|
|
5444
5466
|
function No({
|
|
5445
5467
|
children: e,
|
|
5446
5468
|
initialConfig: t = {}
|
|
5447
5469
|
}) {
|
|
5448
|
-
const [n, r] = V(t), s = (
|
|
5449
|
-
r((
|
|
5470
|
+
const [n, r] = V(t), s = (a) => {
|
|
5471
|
+
r((i) => ({ ...i, ...a }));
|
|
5450
5472
|
};
|
|
5451
5473
|
return /* @__PURE__ */ u(tr.Provider, { value: { config: n, updateConfig: s }, children: e });
|
|
5452
5474
|
}
|
|
5453
5475
|
function Ro() {
|
|
5454
|
-
const e =
|
|
5476
|
+
const e = br(tr);
|
|
5455
5477
|
if (!e)
|
|
5456
5478
|
throw new Error("usePaymentConfig must be used within PaymentProvider");
|
|
5457
5479
|
return e;
|
|
@@ -5461,7 +5483,7 @@ export {
|
|
|
5461
5483
|
f as B,
|
|
5462
5484
|
O as C,
|
|
5463
5485
|
to as D,
|
|
5464
|
-
|
|
5486
|
+
Tt as E,
|
|
5465
5487
|
Be as F,
|
|
5466
5488
|
no as G,
|
|
5467
5489
|
Co as H,
|
|
@@ -5469,15 +5491,15 @@ export {
|
|
|
5469
5491
|
ro as J,
|
|
5470
5492
|
ho as K,
|
|
5471
5493
|
go as L,
|
|
5472
|
-
|
|
5494
|
+
ko as M,
|
|
5473
5495
|
wo as N,
|
|
5474
|
-
|
|
5475
|
-
|
|
5496
|
+
Mr as O,
|
|
5497
|
+
Fr as P,
|
|
5476
5498
|
xo as Q,
|
|
5477
5499
|
F as R,
|
|
5478
5500
|
E as T,
|
|
5479
|
-
|
|
5480
|
-
|
|
5501
|
+
Rr as U,
|
|
5502
|
+
Io as W,
|
|
5481
5503
|
Po as a,
|
|
5482
5504
|
Eo as b,
|
|
5483
5505
|
Ct as c,
|
|
@@ -5488,13 +5510,13 @@ export {
|
|
|
5488
5510
|
Ue as h,
|
|
5489
5511
|
Zr as i,
|
|
5490
5512
|
vo as j,
|
|
5491
|
-
|
|
5513
|
+
si as k,
|
|
5492
5514
|
ge as l,
|
|
5493
5515
|
Le as m,
|
|
5494
5516
|
Kn as n,
|
|
5495
5517
|
Ot as o,
|
|
5496
|
-
|
|
5497
|
-
|
|
5518
|
+
ii as p,
|
|
5519
|
+
Ki as q,
|
|
5498
5520
|
Se as r,
|
|
5499
5521
|
je as s,
|
|
5500
5522
|
Rt as t,
|
|
@@ -5502,6 +5524,6 @@ export {
|
|
|
5502
5524
|
No as v,
|
|
5503
5525
|
Ro as w,
|
|
5504
5526
|
oo as x,
|
|
5505
|
-
|
|
5527
|
+
io as y,
|
|
5506
5528
|
To as z
|
|
5507
5529
|
};
|