multicoyn-sdk 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ccip-DKvRoXP4.cjs → ccip-BBBr8vlp.cjs} +1 -1
- package/dist/{ccip-Piyq8VMB.js → ccip-BamGZKKI.js} +1 -1
- package/dist/components/PaymentSummary.d.ts +1 -1
- package/dist/{index-w8B8C2nn.js → index-C1S0YnyW.js} +287 -277
- package/dist/{index-54Nnnds1.cjs → index-Daw_yCWZ.cjs} +10 -10
- 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,5 +1,5 @@
|
|
|
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";
|
|
@@ -205,7 +205,7 @@ function Tt(e) {
|
|
|
205
205
|
return e.toUpperCase();
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function be(e, t = 2) {
|
|
209
209
|
const n = e.toFixed(t), [r, s] = n.split("."), i = r.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
210
210
|
return s ? `${i}.${s}` : i;
|
|
211
211
|
}
|
|
@@ -219,36 +219,36 @@ function Br({
|
|
|
219
219
|
}) {
|
|
220
220
|
const a = (h) => {
|
|
221
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,
|
|
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: [
|
|
222
|
+
}, o = n * e.percentage / 100, c = e.priceUSD > 0 ? o / e.priceUSD : 0, d = c <= e.amount, l = e.priceUSD > 0, y = Tt(s), m = (r ?? n) * e.percentage / 100;
|
|
223
|
+
return /* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:gap-1.5 mc:w-full", children: [
|
|
224
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:gap-3 mc:w-35", children: [
|
|
225
|
+
/* @__PURE__ */ w("div", { className: "mc:relative mc:size-[30px]", children: [
|
|
226
226
|
/* @__PURE__ */ u(
|
|
227
227
|
"div",
|
|
228
228
|
{
|
|
229
|
-
className: `size-[30px] rounded-full bg-dark-4 overflow-hidden flex items-center justify-center ${l ? "" : "opacity-50"}`,
|
|
229
|
+
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"}`,
|
|
230
230
|
children: e.tokenIcon ? /* @__PURE__ */ u(
|
|
231
231
|
"img",
|
|
232
232
|
{
|
|
233
233
|
src: e.tokenIcon,
|
|
234
234
|
alt: e.name,
|
|
235
|
-
className: "size-full object-cover"
|
|
235
|
+
className: "mc:size-full mc:object-cover"
|
|
236
236
|
}
|
|
237
|
-
) : /* @__PURE__ */ u("span", { className: "text-xs font-semibold text-white", children: e.symbol.slice(0, 2) })
|
|
237
|
+
) : /* @__PURE__ */ u("span", { className: "mc:text-xs mc:font-semibold mc:text-white", children: e.symbol.slice(0, 2) })
|
|
238
238
|
}
|
|
239
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(
|
|
240
|
+
/* @__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(
|
|
241
241
|
"img",
|
|
242
242
|
{
|
|
243
243
|
src: e.chainIcon,
|
|
244
244
|
alt: e.chain,
|
|
245
|
-
className: "size-full object-cover"
|
|
245
|
+
className: "mc:size-full mc:object-cover"
|
|
246
246
|
}
|
|
247
|
-
) : /* @__PURE__ */ u("span", { className: "text-[6px] font-semibold text-white", children: e.chain.slice(0, 1) }) })
|
|
247
|
+
) : /* @__PURE__ */ u("span", { className: "mc:text-[6px] mc:font-semibold mc:text-white", children: e.chain.slice(0, 1) }) })
|
|
248
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: [
|
|
249
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:flex-col mc:gap-1 mc:text-xs mc:text-white", children: [
|
|
250
|
+
/* @__PURE__ */ u("span", { className: "mc:font-semibold", children: e.name }),
|
|
251
|
+
/* @__PURE__ */ w("span", { className: "mc:font-normal mc:opacity-75", children: [
|
|
252
252
|
e.amount.toFixed(4),
|
|
253
253
|
" ",
|
|
254
254
|
e.symbol
|
|
@@ -256,48 +256,54 @@ function Br({
|
|
|
256
256
|
/* @__PURE__ */ u(
|
|
257
257
|
"span",
|
|
258
258
|
{
|
|
259
|
-
className: `text-[10px] ${l ? "text-white/50" : "text-yellow-500"}`,
|
|
259
|
+
className: `mc:text-[10px] ${l ? "mc:text-white/50" : "mc:text-yellow-500"}`,
|
|
260
260
|
children: l ? `$${e.priceUSD.toFixed(2)}/${e.symbol}` : "Price loading..."
|
|
261
261
|
}
|
|
262
262
|
)
|
|
263
263
|
] })
|
|
264
264
|
] }),
|
|
265
|
-
/* @__PURE__ */ w(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
"
|
|
269
|
-
|
|
270
|
-
className: "absolute
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
265
|
+
/* @__PURE__ */ w(
|
|
266
|
+
"div",
|
|
267
|
+
{
|
|
268
|
+
className: `mc:flex-1 mc:relative mc:h-1.5 ${i ? "mc:opacity-50" : ""}`,
|
|
269
|
+
children: [
|
|
270
|
+
/* @__PURE__ */ u("div", { className: "mc:absolute mc:inset-0 mc:bg-white/40 mc:rounded-full" }),
|
|
271
|
+
/* @__PURE__ */ u(
|
|
272
|
+
"div",
|
|
273
|
+
{
|
|
274
|
+
className: "mc:absolute mc:left-0 mc:top-0 mc:h-full mc:bg-secondary mc:rounded-full mc:transition-all",
|
|
275
|
+
style: { width: `${e.percentage}%` }
|
|
276
|
+
}
|
|
277
|
+
),
|
|
278
|
+
/* @__PURE__ */ u(
|
|
279
|
+
"input",
|
|
280
|
+
{
|
|
281
|
+
type: "range",
|
|
282
|
+
min: "0",
|
|
283
|
+
max: "100",
|
|
284
|
+
value: e.percentage,
|
|
285
|
+
onChange: a,
|
|
286
|
+
className: `mc:absolute mc:inset-0 mc:w-full mc:h-full mc:opacity-0 ${i ? "mc:cursor-not-allowed" : "mc:cursor-pointer"}`,
|
|
287
|
+
disabled: i || e.amount === 0 || !l
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
),
|
|
293
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:flex-col mc:items-end mc:gap-0.5 mc:min-w-25", children: [
|
|
294
|
+
/* @__PURE__ */ w("span", { className: "mc:text-xs mc:font-semibold mc:text-white", children: [
|
|
289
295
|
e.percentage,
|
|
290
296
|
"% = ",
|
|
291
|
-
|
|
297
|
+
be(m),
|
|
292
298
|
" ",
|
|
293
|
-
|
|
299
|
+
y
|
|
294
300
|
] }),
|
|
295
301
|
e.percentage > 0 && /* @__PURE__ */ w(
|
|
296
302
|
"span",
|
|
297
303
|
{
|
|
298
|
-
className: `text-[10px] ${d ? "text-white/60" : "text-red-500"}`,
|
|
304
|
+
className: `mc:text-[10px] ${d ? "mc:text-white/60" : "mc:text-red-500"}`,
|
|
299
305
|
children: [
|
|
300
|
-
|
|
306
|
+
be(c, 4),
|
|
301
307
|
" ",
|
|
302
308
|
e.symbol,
|
|
303
309
|
!d && " ⚠️"
|
|
@@ -307,18 +313,22 @@ function Br({
|
|
|
307
313
|
] })
|
|
308
314
|
] });
|
|
309
315
|
}
|
|
310
|
-
function Ur({
|
|
316
|
+
function Ur({
|
|
317
|
+
items: e,
|
|
318
|
+
fee: t = 0.3,
|
|
319
|
+
currency: n
|
|
320
|
+
}) {
|
|
311
321
|
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" }),
|
|
322
|
+
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: [
|
|
323
|
+
/* @__PURE__ */ u("p", { className: "mc:font-medium mc:text-base mc:text-white", children: "Payment Summary" }),
|
|
314
324
|
e.map((a, o) => /* @__PURE__ */ w(
|
|
315
325
|
"div",
|
|
316
326
|
{
|
|
317
|
-
className: "flex items-center justify-between text-xs text-white",
|
|
327
|
+
className: "mc:flex mc:items-center mc:justify-between mc:text-xs mc:text-white",
|
|
318
328
|
children: [
|
|
319
|
-
/* @__PURE__ */ u("span", { className: "flex-1", children: a.name }),
|
|
320
|
-
/* @__PURE__ */ w("span", { className: "text-right", children: [
|
|
321
|
-
|
|
329
|
+
/* @__PURE__ */ u("span", { className: "mc:flex-1", children: a.name }),
|
|
330
|
+
/* @__PURE__ */ w("span", { className: "mc:text-right", children: [
|
|
331
|
+
be(a.price),
|
|
322
332
|
" ",
|
|
323
333
|
i
|
|
324
334
|
] })
|
|
@@ -326,19 +336,19 @@ function Ur({ items: e, fee: t = 0.3, currency: n }) {
|
|
|
326
336
|
},
|
|
327
337
|
o
|
|
328
338
|
)),
|
|
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
|
-
|
|
339
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:justify-between mc:text-xs mc:text-white", children: [
|
|
340
|
+
/* @__PURE__ */ u("span", { className: "mc:flex-1", children: "Fee" }),
|
|
341
|
+
/* @__PURE__ */ w("span", { className: "mc:text-right", children: [
|
|
342
|
+
be(t),
|
|
333
343
|
" ",
|
|
334
344
|
i
|
|
335
345
|
] })
|
|
336
346
|
] }),
|
|
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
|
-
|
|
347
|
+
/* @__PURE__ */ u("div", { className: "mc:h-px mc:bg-white/20" }),
|
|
348
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:justify-between mc:text-white", children: [
|
|
349
|
+
/* @__PURE__ */ u("span", { className: "mc:text-xs", children: "Total Payment" }),
|
|
350
|
+
/* @__PURE__ */ w("span", { className: "mc:text-base mc:font-semibold mc:text-right", children: [
|
|
351
|
+
be(s),
|
|
342
352
|
" ",
|
|
343
353
|
i
|
|
344
354
|
] })
|
|
@@ -1265,66 +1275,66 @@ function vt() {
|
|
|
1265
1275
|
});
|
|
1266
1276
|
return {
|
|
1267
1277
|
// Write functions
|
|
1268
|
-
registerToken: (
|
|
1278
|
+
registerToken: (b, x, S, N) => {
|
|
1269
1279
|
e({
|
|
1270
1280
|
address: O.TOKEN_REGISTRY,
|
|
1271
1281
|
abi: Z,
|
|
1272
1282
|
functionName: "registerToken",
|
|
1273
|
-
args: [
|
|
1283
|
+
args: [b, x, S, N]
|
|
1274
1284
|
});
|
|
1275
1285
|
},
|
|
1276
|
-
setTokenEnabled: (
|
|
1286
|
+
setTokenEnabled: (b, x) => {
|
|
1277
1287
|
e({
|
|
1278
1288
|
address: O.TOKEN_REGISTRY,
|
|
1279
1289
|
abi: Z,
|
|
1280
1290
|
functionName: "setTokenEnabled",
|
|
1281
|
-
args: [
|
|
1291
|
+
args: [b, x]
|
|
1282
1292
|
});
|
|
1283
1293
|
},
|
|
1284
|
-
updatePriceFeed: (
|
|
1294
|
+
updatePriceFeed: (b, x) => {
|
|
1285
1295
|
e({
|
|
1286
1296
|
address: O.TOKEN_REGISTRY,
|
|
1287
1297
|
abi: Z,
|
|
1288
1298
|
functionName: "updatePriceFeed",
|
|
1289
|
-
args: [
|
|
1299
|
+
args: [b, x]
|
|
1290
1300
|
});
|
|
1291
1301
|
},
|
|
1292
|
-
setMinPaymentAmount: (
|
|
1302
|
+
setMinPaymentAmount: (b, x) => {
|
|
1293
1303
|
e({
|
|
1294
1304
|
address: O.TOKEN_REGISTRY,
|
|
1295
1305
|
abi: Z,
|
|
1296
1306
|
functionName: "setMinPaymentAmount",
|
|
1297
|
-
args: [
|
|
1307
|
+
args: [b, x]
|
|
1298
1308
|
});
|
|
1299
1309
|
},
|
|
1300
|
-
grantRole: (
|
|
1310
|
+
grantRole: (b, x) => {
|
|
1301
1311
|
e({
|
|
1302
1312
|
address: O.TOKEN_REGISTRY,
|
|
1303
1313
|
abi: Z,
|
|
1304
1314
|
functionName: "grantRole",
|
|
1305
|
-
args: [
|
|
1315
|
+
args: [b, x]
|
|
1306
1316
|
});
|
|
1307
1317
|
},
|
|
1308
|
-
revokeRole: (
|
|
1318
|
+
revokeRole: (b, x) => {
|
|
1309
1319
|
e({
|
|
1310
1320
|
address: O.TOKEN_REGISTRY,
|
|
1311
1321
|
abi: Z,
|
|
1312
1322
|
functionName: "revokeRole",
|
|
1313
|
-
args: [
|
|
1323
|
+
args: [b, x]
|
|
1314
1324
|
});
|
|
1315
1325
|
},
|
|
1316
1326
|
// Read hooks
|
|
1317
|
-
useGetTokenConfig: (
|
|
1327
|
+
useGetTokenConfig: (b) => j({
|
|
1318
1328
|
address: O.TOKEN_REGISTRY,
|
|
1319
1329
|
abi: Z,
|
|
1320
1330
|
functionName: "getTokenConfig",
|
|
1321
|
-
args: [
|
|
1331
|
+
args: [b]
|
|
1322
1332
|
}),
|
|
1323
|
-
useGetTokenPrice: (
|
|
1333
|
+
useGetTokenPrice: (b) => j({
|
|
1324
1334
|
address: O.TOKEN_REGISTRY,
|
|
1325
1335
|
abi: Z,
|
|
1326
1336
|
functionName: "getTokenPriceUSD",
|
|
1327
|
-
args: [
|
|
1337
|
+
args: [b]
|
|
1328
1338
|
}),
|
|
1329
1339
|
useGetRegisteredTokens: () => j({
|
|
1330
1340
|
address: O.TOKEN_REGISTRY,
|
|
@@ -1336,17 +1346,17 @@ function vt() {
|
|
|
1336
1346
|
abi: Z,
|
|
1337
1347
|
functionName: "getRegisteredTokenCount"
|
|
1338
1348
|
}),
|
|
1339
|
-
useIsTokenEnabled: (
|
|
1349
|
+
useIsTokenEnabled: (b) => j({
|
|
1340
1350
|
address: O.TOKEN_REGISTRY,
|
|
1341
1351
|
abi: Z,
|
|
1342
1352
|
functionName: "isTokenEnabled",
|
|
1343
|
-
args: [
|
|
1353
|
+
args: [b]
|
|
1344
1354
|
}),
|
|
1345
|
-
useHasRole: (
|
|
1355
|
+
useHasRole: (b, x) => j({
|
|
1346
1356
|
address: O.TOKEN_REGISTRY,
|
|
1347
1357
|
abi: Z,
|
|
1348
1358
|
functionName: "hasRole",
|
|
1349
|
-
args: [
|
|
1359
|
+
args: [b, x]
|
|
1350
1360
|
}),
|
|
1351
1361
|
// Transaction state
|
|
1352
1362
|
hash: t,
|
|
@@ -1369,11 +1379,11 @@ function _r({
|
|
|
1369
1379
|
transactionHash: c,
|
|
1370
1380
|
isProcessing: d,
|
|
1371
1381
|
isSuccess: l,
|
|
1372
|
-
conversionRate:
|
|
1382
|
+
conversionRate: y = 1
|
|
1373
1383
|
}) {
|
|
1374
|
-
const p = vt(), { data:
|
|
1384
|
+
const p = vt(), { 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
|
i.map((g) => ({
|
|
1379
1389
|
id: g.id,
|
|
@@ -1395,7 +1405,7 @@ function _r({
|
|
|
1395
1405
|
if (e && i.length > 0) {
|
|
1396
1406
|
const g = i.map((A) => {
|
|
1397
1407
|
let k = A.priceUSD;
|
|
1398
|
-
return A.address === E.NATIVE &&
|
|
1408
|
+
return A.address === E.NATIVE && m ? k = R(m) : A.address === E.USDC && h ? k = R(h) : A.address === E.USDT && v ? k = R(v) : A.address === E.DAI && P ? k = R(P) : A.address === E.WBTC && T && (k = R(T)), { ...A, priceUSD: k };
|
|
1399
1409
|
});
|
|
1400
1410
|
if (D) {
|
|
1401
1411
|
g.forEach((C) => {
|
|
@@ -1411,8 +1421,8 @@ function _r({
|
|
|
1411
1421
|
);
|
|
1412
1422
|
if (k.length > 0 && xe >= A) {
|
|
1413
1423
|
const C = Math.floor(100 / k.length), Y = 100 - C * k.length;
|
|
1414
|
-
k.forEach((Me,
|
|
1415
|
-
Me.percentage = C + (
|
|
1424
|
+
k.forEach((Me, ye) => {
|
|
1425
|
+
Me.percentage = C + (ye === 0 ? Y : 0);
|
|
1416
1426
|
});
|
|
1417
1427
|
} else if (k.length > 0) {
|
|
1418
1428
|
const C = xe / A * 100, Y = Math.floor(
|
|
@@ -1421,14 +1431,14 @@ function _r({
|
|
|
1421
1431
|
k.forEach((fe) => {
|
|
1422
1432
|
fe.percentage = Y;
|
|
1423
1433
|
});
|
|
1424
|
-
const
|
|
1434
|
+
const ye = 100 - k.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,10 +1471,10 @@ 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 = Tt(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;
|
|
@@ -1474,7 +1484,7 @@ function _r({
|
|
|
1474
1484
|
);
|
|
1475
1485
|
}, ir = () => {
|
|
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), k = 100 - A * g.length;
|
|
1478
1488
|
x(
|
|
1479
1489
|
(G) => G.map((xe, C) => ({
|
|
1480
1490
|
...xe,
|
|
@@ -1483,16 +1493,16 @@ function _r({
|
|
|
1483
1493
|
);
|
|
1484
1494
|
}
|
|
1485
1495
|
J(!D);
|
|
1486
|
-
}, ar =
|
|
1496
|
+
}, ar = 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..."), a(
|
|
1505
|
+
), M(g.map((A) => A.symbol))), U(30), W("Processing payment..."), a(b), U(60);
|
|
1496
1506
|
}, cr = () => {
|
|
1497
1507
|
t();
|
|
1498
1508
|
}, ur = () => (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
|
|
@@ -1501,59 +1511,59 @@ 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-[9999] flex items-center justify-center", children: [
|
|
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: [
|
|
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-[400px] mc:min-h-[280px] mc:mx-4 animate-slide-in-right", children: [
|
|
1513
1523
|
/* @__PURE__ */ u(Rr, { size: 134 }),
|
|
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" }),
|
|
1524
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:flex-col mc:gap-3 mc:items-center mc:w-[300px]", children: [
|
|
1525
|
+
/* @__PURE__ */ w("div", { className: "mc:relative mc: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", children: z }),
|
|
1536
|
+
L.length > 0 && /* @__PURE__ */ w("div", { className: "mc:text-xs mc:text-white/60 mc:text-center", 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: [
|
|
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-[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: [
|
|
1534
1544
|
/* @__PURE__ */ u(Mr, { size: 95 }),
|
|
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." })
|
|
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", children: [
|
|
1546
|
+
/* @__PURE__ */ u("p", { className: "mc:text-lg mc:font-semibold", children: "Payment Success" }),
|
|
1547
|
+
/* @__PURE__ */ u("p", { className: "mc:text-sm", 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-0 w-[348px] flex flex-col items-center", children: /* @__PURE__ */ w("div", { className: "flex flex-col gap-2 w-[318px]", children: [
|
|
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-0 mc: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-[318px]", 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-8 mc:text-sm mc:text-white mc:w-full", children: [
|
|
1552
|
+
/* @__PURE__ */ u("span", { className: "mc:w-[85px]", children: "Item" }),
|
|
1553
|
+
/* @__PURE__ */ u("span", { className: "mc:flex-1 mc:text-right", 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-8 mc:text-white mc:w-full", children: [
|
|
1556
|
+
/* @__PURE__ */ u("span", { className: "mc:text-sm mc:w-[106px]", children: "Total Payment" }),
|
|
1557
|
+
/* @__PURE__ */ w("span", { className: "mc:flex-1 mc:text-base mc:font-semibold mc:text-right", 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: [
|
|
1565
|
+
/* @__PURE__ */ u("div", { className: "mc:h-px mc: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: [
|
|
1557
1567
|
/* @__PURE__ */ u("p", { children: ur() }),
|
|
1558
1568
|
le && /* @__PURE__ */ u(
|
|
1559
1569
|
"a",
|
|
@@ -1561,7 +1571,7 @@ function _r({
|
|
|
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",
|
|
1565
1575
|
children: "View Transaction"
|
|
1566
1576
|
}
|
|
1567
1577
|
)
|
|
@@ -1570,40 +1580,40 @@ 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", children: [
|
|
1591
|
+
/* @__PURE__ */ u("h2", { className: "mc:text-xl mc:text-white mc:font-normal", children: "Complete Payment" }),
|
|
1592
|
+
/* @__PURE__ */ u("p", { className: "mc:text-base mc:text-white/70", 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",
|
|
1598
|
+
className: "mc:text-white/60 hover:mc:text-white mc:transition-colors",
|
|
1589
1599
|
children: /* @__PURE__ */ u(Ir, { 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-[340px]", children: "Total Required" }),
|
|
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-5", children: [
|
|
1606
|
+
/* @__PURE__ */ u("span", { className: "mc:text-base mc:text-white/60 mc:w-[340px]", children: "Total Required" }),
|
|
1607
|
+
/* @__PURE__ */ w("span", { className: "mc:text-xl mc:font-bold mc:text-white mc:text-right mc:flex-1", 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(kr, { size: 16, className: "text-white/60" }),
|
|
1613
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:gap-5", children: [
|
|
1614
|
+
/* @__PURE__ */ u("span", { className: "mc:text-base mc:text-white mc:flex-1", 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", children: [
|
|
1616
|
+
/* @__PURE__ */ u(kr, { size: 16, className: "mc:text-white/60" }),
|
|
1607
1617
|
/* @__PURE__ */ u(
|
|
1608
1618
|
"input",
|
|
1609
1619
|
{
|
|
@@ -1611,20 +1621,20 @@ function _r({
|
|
|
1611
1621
|
placeholder: "Search token or chain..",
|
|
1612
1622
|
value: S,
|
|
1613
1623
|
onChange: (g) => N(g.target.value),
|
|
1614
|
-
className: "bg-transparent border-none outline-none text-base text-white/60 placeholder:text-white/60"
|
|
1624
|
+
className: "mc:bg-transparent mc:border-none mc:outline-none mc:text-base mc:text-white/60 placeholder:mc:text-white/60"
|
|
1615
1625
|
}
|
|
1616
1626
|
)
|
|
1617
1627
|
] })
|
|
1618
1628
|
] }),
|
|
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(Nr, { size: 16, className: "text-white/60" }),
|
|
1623
|
-
/* @__PURE__ */ u("span", { className: "text-sm italic text-white", children: "Set the coins amount until 100%" }),
|
|
1629
|
+
/* @__PURE__ */ w("div", { className: "mc:bg-dark-3 mc:rounded-md mc:p-3 mc:flex mc:flex-col mc:gap-4", children: [
|
|
1630
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:gap-6", children: [
|
|
1631
|
+
/* @__PURE__ */ w("div", { className: "mc:flex-1 mc:flex mc:items-center mc:gap-2", children: [
|
|
1632
|
+
/* @__PURE__ */ u(Nr, { size: 16, className: "mc:text-white/60" }),
|
|
1633
|
+
/* @__PURE__ */ u("span", { className: "mc:text-sm mc:italic mc:text-white", children: "Set the coins amount until 100%" }),
|
|
1624
1634
|
/* @__PURE__ */ w(
|
|
1625
1635
|
"span",
|
|
1626
1636
|
{
|
|
1627
|
-
className: `bg-dark-4 rounded-full px-2 py-1 text-xs font-semibold ${K === 100 ? "text-cyan" : "text-warning"}`,
|
|
1637
|
+
className: `mc:bg-dark-4 mc:rounded-full mc:px-2 mc:py-1 mc:text-xs mc:font-semibold ${K === 100 ? "mc:text-cyan" : "mc:text-warning"}`,
|
|
1628
1638
|
children: [
|
|
1629
1639
|
K,
|
|
1630
1640
|
"/100%"
|
|
@@ -1632,17 +1642,17 @@ function _r({
|
|
|
1632
1642
|
}
|
|
1633
1643
|
)
|
|
1634
1644
|
] }),
|
|
1635
|
-
/* @__PURE__ */ w("div", { className: "flex items-center gap-2", children: [
|
|
1636
|
-
/* @__PURE__ */ u("span", { className: "text-sm text-white", children: "Auto Optimize" }),
|
|
1645
|
+
/* @__PURE__ */ w("div", { className: "mc:flex mc:items-center mc:gap-2", children: [
|
|
1646
|
+
/* @__PURE__ */ u("span", { className: "mc:text-sm mc:text-white", children: "Auto Optimize" }),
|
|
1637
1647
|
/* @__PURE__ */ u(
|
|
1638
1648
|
"button",
|
|
1639
1649
|
{
|
|
1640
1650
|
onClick: ir,
|
|
1641
|
-
className: `w-7 h-4 rounded-full relative transition-colors ${D ? "bg-cyan" : "bg-white/40"}`,
|
|
1651
|
+
className: `mc:w-7 mc:h-4 mc:rounded-full mc:relative mc:transition-colors ${D ? "mc:bg-cyan" : "mc:bg-white/40"}`,
|
|
1642
1652
|
children: /* @__PURE__ */ u(
|
|
1643
1653
|
"div",
|
|
1644
1654
|
{
|
|
1645
|
-
className: `absolute top-0.5 size-3 rounded-full bg-white transition-transform ${D ? "translate-x-3.5" : "translate-x-0.5"}`
|
|
1655
|
+
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
1656
|
}
|
|
1647
1657
|
)
|
|
1648
1658
|
}
|
|
@@ -1663,7 +1673,7 @@ function _r({
|
|
|
1663
1673
|
))
|
|
1664
1674
|
] })
|
|
1665
1675
|
] }),
|
|
1666
|
-
/* @__PURE__ */ u("div", { className: "w-full lg:w-[320px]", children: /* @__PURE__ */ u(
|
|
1676
|
+
/* @__PURE__ */ u("div", { className: "mc:w-full mc:lg:w-[320px]", children: /* @__PURE__ */ u(
|
|
1667
1677
|
Ur,
|
|
1668
1678
|
{
|
|
1669
1679
|
items: nr,
|
|
@@ -1677,7 +1687,7 @@ function _r({
|
|
|
1677
1687
|
{
|
|
1678
1688
|
onClick: or,
|
|
1679
1689
|
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"}`,
|
|
1690
|
+
className: `mc:w-full mc:lg:w-[620px] mc:h-[42px] mc:rounded-lg mc:flex mc:items-center mc:justify-center mc:text-sm mc:font-semibold mc:text-white mc:transition-all ${K === 100 && !Ze && !Ye ? "mc:bg-secondary hover:mc:bg-secondary/90" : "mc:bg-secondary/50 mc:cursor-not-allowed"}`,
|
|
1681
1691
|
children: Ye ? "Price data unavailable - Please wait" : Ze ? "Insufficient Balance" : K !== 100 ? `Complete to 100% (${K}%)` : "Pay with MultiCoyn"
|
|
1682
1692
|
}
|
|
1683
1693
|
)
|
|
@@ -2287,7 +2297,7 @@ function fs(e, t = !1) {
|
|
|
2287
2297
|
}
|
|
2288
2298
|
return [r, s];
|
|
2289
2299
|
}
|
|
2290
|
-
const ps = (e, t, n) => e << n | t >>> 32 - n,
|
|
2300
|
+
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
2301
|
function hs(e) {
|
|
2292
2302
|
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
2293
2303
|
}
|
|
@@ -2344,28 +2354,28 @@ function Ss(e) {
|
|
|
2344
2354
|
const t = (r) => e().update(pn(r)).digest(), n = e();
|
|
2345
2355
|
return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
|
|
2346
2356
|
}
|
|
2347
|
-
const As = BigInt(0), Ie = BigInt(1), $s = BigInt(2), Cs = BigInt(7), Is = BigInt(256), ks = BigInt(113),
|
|
2357
|
+
const As = BigInt(0), Ie = BigInt(1), $s = BigInt(2), Cs = BigInt(7), Is = BigInt(256), ks = BigInt(113), mn = [], yn = [], bn = [];
|
|
2348
2358
|
for (let e = 0, t = Ie, n = 1, r = 0; e < 24; e++) {
|
|
2349
|
-
[n, r] = [r, (2 * n + 3 * r) % 5],
|
|
2359
|
+
[n, r] = [r, (2 * n + 3 * r) % 5], mn.push(2 * (5 * r + n)), yn.push((e + 1) * (e + 2) / 2 % 64);
|
|
2350
2360
|
let s = As;
|
|
2351
2361
|
for (let i = 0; i < 7; i++)
|
|
2352
2362
|
t = (t << Ie ^ (t >> Cs) * ks) % Is, t & $s && (s ^= Ie << (Ie << /* @__PURE__ */ BigInt(i)) - Ie);
|
|
2353
|
-
|
|
2363
|
+
bn.push(s);
|
|
2354
2364
|
}
|
|
2355
|
-
const hn = fs(
|
|
2365
|
+
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
2366
|
function Ms(e, t = 24) {
|
|
2357
2367
|
const n = new Uint32Array(10);
|
|
2358
2368
|
for (let r = 24 - t; r < 24; r++) {
|
|
2359
2369
|
for (let a = 0; a < 10; a++)
|
|
2360
2370
|
n[a] = e[a] ^ e[a + 10] ^ e[a + 20] ^ e[a + 30] ^ e[a + 40];
|
|
2361
2371
|
for (let a = 0; a < 10; a += 2) {
|
|
2362
|
-
const o = (a + 8) % 10, c = (a + 2) % 10, d = n[c], l = n[c + 1],
|
|
2363
|
-
for (let
|
|
2364
|
-
e[a +
|
|
2372
|
+
const o = (a + 8) % 10, c = (a + 2) % 10, d = n[c], l = n[c + 1], y = Ht(d, l, 1) ^ n[o], p = Wt(d, l, 1) ^ n[o + 1];
|
|
2373
|
+
for (let m = 0; m < 50; m += 10)
|
|
2374
|
+
e[a + m] ^= y, e[a + m + 1] ^= p;
|
|
2365
2375
|
}
|
|
2366
2376
|
let s = e[2], i = e[3];
|
|
2367
2377
|
for (let a = 0; a < 24; a++) {
|
|
2368
|
-
const o =
|
|
2378
|
+
const o = yn[a], c = Ht(s, i, o), d = Wt(s, i, o), l = mn[a];
|
|
2369
2379
|
s = e[l], i = e[l + 1], e[l] = c, e[l + 1] = d;
|
|
2370
2380
|
}
|
|
2371
2381
|
for (let a = 0; a < 50; a += 10) {
|
|
@@ -2933,14 +2943,14 @@ function ni(e, t, { length: n, staticPosition: r }) {
|
|
|
2933
2943
|
const a = ce(e.readBytes(it)), o = r + a, c = o + Yt;
|
|
2934
2944
|
e.setPosition(o);
|
|
2935
2945
|
const d = ce(e.readBytes(Yt)), l = Ne(t);
|
|
2936
|
-
let
|
|
2946
|
+
let y = 0;
|
|
2937
2947
|
const p = [];
|
|
2938
|
-
for (let
|
|
2939
|
-
e.setPosition(c + (l ?
|
|
2948
|
+
for (let m = 0; m < d; ++m) {
|
|
2949
|
+
e.setPosition(c + (l ? m * 32 : y));
|
|
2940
2950
|
const [h, v] = Ee(e, t, {
|
|
2941
2951
|
staticPosition: c
|
|
2942
2952
|
});
|
|
2943
|
-
|
|
2953
|
+
y += v, p.push(h);
|
|
2944
2954
|
}
|
|
2945
2955
|
return e.setPosition(r + 32), [p, 32];
|
|
2946
2956
|
}
|
|
@@ -2996,10 +3006,10 @@ function ai(e, t, { staticPosition: n }) {
|
|
|
2996
3006
|
for (let c = 0; c < t.components.length; ++c) {
|
|
2997
3007
|
const d = t.components[c];
|
|
2998
3008
|
e.setPosition(o + i);
|
|
2999
|
-
const [l,
|
|
3009
|
+
const [l, y] = Ee(e, d, {
|
|
3000
3010
|
staticPosition: o
|
|
3001
3011
|
});
|
|
3002
|
-
i +=
|
|
3012
|
+
i += y, s[r ? c : d?.name] = l;
|
|
3003
3013
|
}
|
|
3004
3014
|
return e.setPosition(n + 32), [s, 32];
|
|
3005
3015
|
}
|
|
@@ -3114,14 +3124,14 @@ function pi(e) {
|
|
|
3114
3124
|
return de(In, e);
|
|
3115
3125
|
}
|
|
3116
3126
|
const kn = /^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
|
|
3117
|
-
function
|
|
3127
|
+
function mi(e) {
|
|
3118
3128
|
return kn.test(e);
|
|
3119
3129
|
}
|
|
3120
|
-
function
|
|
3130
|
+
function yi(e) {
|
|
3121
3131
|
return de(kn, e);
|
|
3122
3132
|
}
|
|
3123
3133
|
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
|
|
3134
|
+
function bi(e) {
|
|
3125
3135
|
return Nn.test(e);
|
|
3126
3136
|
}
|
|
3127
3137
|
function hi(e) {
|
|
@@ -3386,9 +3396,9 @@ const et = /* @__PURE__ */ new Map([
|
|
|
3386
3396
|
]
|
|
3387
3397
|
]);
|
|
3388
3398
|
function Li(e, t = {}) {
|
|
3389
|
-
if (
|
|
3399
|
+
if (bi(e))
|
|
3390
3400
|
return Fi(e, t);
|
|
3391
|
-
if (
|
|
3401
|
+
if (mi(e))
|
|
3392
3402
|
return ji(e, t);
|
|
3393
3403
|
if (fi(e))
|
|
3394
3404
|
return zi(e, t);
|
|
@@ -3433,7 +3443,7 @@ function Fi(e, t = {}) {
|
|
|
3433
3443
|
};
|
|
3434
3444
|
}
|
|
3435
3445
|
function ji(e, t = {}) {
|
|
3436
|
-
const n =
|
|
3446
|
+
const n = yi(e);
|
|
3437
3447
|
if (!n)
|
|
3438
3448
|
throw new $e({ signature: e, type: "event" });
|
|
3439
3449
|
const r = ne(n.parameters), s = [], i = r.length;
|
|
@@ -3490,9 +3500,9 @@ function we(e, t) {
|
|
|
3490
3500
|
let c, d = {};
|
|
3491
3501
|
if (r) {
|
|
3492
3502
|
c = "tuple";
|
|
3493
|
-
const
|
|
3494
|
-
for (let h = 0; h <
|
|
3495
|
-
p.push(we(
|
|
3503
|
+
const y = ne(s.type), p = [], m = y.length;
|
|
3504
|
+
for (let h = 0; h < m; h++)
|
|
3505
|
+
p.push(we(y[h], { structs: o }));
|
|
3496
3506
|
d = { components: p };
|
|
3497
3507
|
} else if (s.type in o)
|
|
3498
3508
|
c = "tuple", d = { components: o[s.type] };
|
|
@@ -3564,8 +3574,8 @@ function Xi(e) {
|
|
|
3564
3574
|
const c = gi(o);
|
|
3565
3575
|
if (!c)
|
|
3566
3576
|
throw new $e({ signature: o, type: "struct" });
|
|
3567
|
-
const d = c.properties.split(";"), l = [],
|
|
3568
|
-
for (let p = 0; p <
|
|
3577
|
+
const d = c.properties.split(";"), l = [], y = d.length;
|
|
3578
|
+
for (let p = 0; p < y; p++) {
|
|
3569
3579
|
const h = d[p].trim();
|
|
3570
3580
|
if (!h)
|
|
3571
3581
|
continue;
|
|
@@ -3672,8 +3682,8 @@ function Mt(e) {
|
|
|
3672
3682
|
if (!o.inputs || o.inputs.length === 0 || o.inputs.length !== n.length)
|
|
3673
3683
|
continue;
|
|
3674
3684
|
if (n.every((d, l) => {
|
|
3675
|
-
const
|
|
3676
|
-
return
|
|
3685
|
+
const y = "inputs" in o && o.inputs[l];
|
|
3686
|
+
return y ? ut(d, y) : !1;
|
|
3677
3687
|
})) {
|
|
3678
3688
|
if (a && "inputs" in a && a.inputs) {
|
|
3679
3689
|
const d = jn(o.inputs, a.inputs, n);
|
|
@@ -3917,12 +3927,12 @@ function Wn(e) {
|
|
|
3917
3927
|
`);
|
|
3918
3928
|
}
|
|
3919
3929
|
const pa = (e) => e, Kn = (e) => e;
|
|
3920
|
-
class
|
|
3921
|
-
constructor(t, { account: n, docsPath: r, chain: s, data: i, gas: a, gasPrice: o, maxFeePerGas: c, maxPriorityFeePerGas: d, nonce: l, to:
|
|
3930
|
+
class ma extends f {
|
|
3931
|
+
constructor(t, { account: n, docsPath: r, chain: s, data: i, gas: a, gasPrice: o, maxFeePerGas: c, maxPriorityFeePerGas: d, nonce: l, to: y, value: p, stateOverride: m }) {
|
|
3922
3932
|
const h = n ? Dt(n) : void 0;
|
|
3923
3933
|
let v = Wn({
|
|
3924
3934
|
from: h?.address,
|
|
3925
|
-
to:
|
|
3935
|
+
to: y,
|
|
3926
3936
|
value: typeof p < "u" && `${ua(p)} ${s?.nativeCurrency?.symbol || "ETH"}`,
|
|
3927
3937
|
data: i,
|
|
3928
3938
|
gas: a,
|
|
@@ -3931,8 +3941,8 @@ class ya extends f {
|
|
|
3931
3941
|
maxPriorityFeePerGas: typeof d < "u" && `${he(d)} gwei`,
|
|
3932
3942
|
nonce: l
|
|
3933
3943
|
});
|
|
3934
|
-
|
|
3935
|
-
${fa(
|
|
3944
|
+
m && (v += `
|
|
3945
|
+
${fa(m)}`), super(t.shortMessage, {
|
|
3936
3946
|
cause: t,
|
|
3937
3947
|
docsPath: r,
|
|
3938
3948
|
metaMessages: [
|
|
@@ -3949,14 +3959,14 @@ ${fa(y)}`), super(t.shortMessage, {
|
|
|
3949
3959
|
}), this.cause = t;
|
|
3950
3960
|
}
|
|
3951
3961
|
}
|
|
3952
|
-
class
|
|
3962
|
+
class ya extends f {
|
|
3953
3963
|
constructor(t, { abi: n, args: r, contractAddress: s, docsPath: i, functionName: a, sender: o }) {
|
|
3954
3964
|
const c = Mt({ abi: n, args: r, name: a }), d = c ? Vn({
|
|
3955
3965
|
abiItem: c,
|
|
3956
3966
|
args: r,
|
|
3957
3967
|
includeFunctionName: !1,
|
|
3958
3968
|
includeName: !1
|
|
3959
|
-
}) : void 0, l = c ? Pe(c, { includeName: !0 }) : void 0,
|
|
3969
|
+
}) : void 0, l = c ? Pe(c, { includeName: !0 }) : void 0, y = Wn({
|
|
3960
3970
|
address: s && pa(s),
|
|
3961
3971
|
function: l,
|
|
3962
3972
|
args: d && d !== "()" && `${[...Array(a?.length ?? 0).keys()].map(() => " ").join("")}${d}`,
|
|
@@ -3967,8 +3977,8 @@ class ba extends f {
|
|
|
3967
3977
|
docsPath: i,
|
|
3968
3978
|
metaMessages: [
|
|
3969
3979
|
...t.metaMessages ? [...t.metaMessages, " "] : [],
|
|
3970
|
-
|
|
3971
|
-
|
|
3980
|
+
y && "Contract Call:",
|
|
3981
|
+
y
|
|
3972
3982
|
].filter(Boolean),
|
|
3973
3983
|
name: "ContractFunctionExecutionError"
|
|
3974
3984
|
}), Object.defineProperty(this, "abi", {
|
|
@@ -4009,28 +4019,28 @@ class ba extends f {
|
|
|
4009
4019
|
}), this.abi = n, this.args = r, this.cause = t, this.contractAddress = s, this.functionName = a, this.sender = o;
|
|
4010
4020
|
}
|
|
4011
4021
|
}
|
|
4012
|
-
class
|
|
4022
|
+
class ba extends f {
|
|
4013
4023
|
constructor({ abi: t, data: n, functionName: r, message: s }) {
|
|
4014
4024
|
let i, a, o, c;
|
|
4015
4025
|
if (n && n !== "0x")
|
|
4016
4026
|
try {
|
|
4017
4027
|
a = aa({ abi: t, data: n });
|
|
4018
|
-
const { abiItem: l, errorName:
|
|
4019
|
-
if (
|
|
4028
|
+
const { abiItem: l, errorName: y, args: p } = a;
|
|
4029
|
+
if (y === "Error")
|
|
4020
4030
|
c = p[0];
|
|
4021
|
-
else if (
|
|
4022
|
-
const [
|
|
4023
|
-
c = ra[
|
|
4031
|
+
else if (y === "Panic") {
|
|
4032
|
+
const [m] = p;
|
|
4033
|
+
c = ra[m];
|
|
4024
4034
|
} else {
|
|
4025
|
-
const
|
|
4035
|
+
const m = l ? Pe(l, { includeName: !0 }) : void 0, h = l && p ? Vn({
|
|
4026
4036
|
abiItem: l,
|
|
4027
4037
|
args: p,
|
|
4028
4038
|
includeFunctionName: !1,
|
|
4029
4039
|
includeName: !1
|
|
4030
4040
|
}) : void 0;
|
|
4031
4041
|
o = [
|
|
4032
|
-
|
|
4033
|
-
h && h !== "()" ? ` ${[...Array(
|
|
4042
|
+
m ? `Error: ${m}` : "",
|
|
4043
|
+
h && h !== "()" ? ` ${[...Array(y?.length ?? 0).keys()].map(() => " ").join("")}${h}` : ""
|
|
4034
4044
|
];
|
|
4035
4045
|
}
|
|
4036
4046
|
} catch (l) {
|
|
@@ -4231,13 +4241,13 @@ Object.defineProperty(He, "code", {
|
|
|
4231
4241
|
});
|
|
4232
4242
|
const Ta = 3;
|
|
4233
4243
|
function va(e, { abi: t, address: n, args: r, docsPath: s, functionName: i, sender: a }) {
|
|
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:
|
|
4244
|
+
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 ha({ functionName: i }) : [Ta, Ve.code].includes(c) && (d || l || y || p) || c === He.code && l === "execution reverted" && d ? new ba({
|
|
4235
4245
|
abi: t,
|
|
4236
4246
|
data: typeof d == "object" ? d.data : d,
|
|
4237
4247
|
functionName: i,
|
|
4238
|
-
message: o instanceof Zn ? l : p ??
|
|
4248
|
+
message: o instanceof Zn ? l : p ?? y
|
|
4239
4249
|
}) : e;
|
|
4240
|
-
return new
|
|
4250
|
+
return new ya(m, {
|
|
4241
4251
|
abi: t,
|
|
4242
4252
|
args: r,
|
|
4243
4253
|
contractAddress: n,
|
|
@@ -4519,18 +4529,18 @@ Object.defineProperty(pt, "nodeMessage", {
|
|
|
4519
4529
|
writable: !0,
|
|
4520
4530
|
value: /nonce too low|transaction already imported|already known/
|
|
4521
4531
|
});
|
|
4522
|
-
class
|
|
4532
|
+
class mt extends f {
|
|
4523
4533
|
constructor({ cause: t, nonce: n } = {}) {
|
|
4524
4534
|
super(`Nonce provided for the transaction ${n ? `(${n}) ` : ""}exceeds the maximum allowed nonce.`, { cause: t, name: "NonceMaxValueError" });
|
|
4525
4535
|
}
|
|
4526
4536
|
}
|
|
4527
|
-
Object.defineProperty(
|
|
4537
|
+
Object.defineProperty(mt, "nodeMessage", {
|
|
4528
4538
|
enumerable: !0,
|
|
4529
4539
|
configurable: !0,
|
|
4530
4540
|
writable: !0,
|
|
4531
4541
|
value: /nonce has max value/
|
|
4532
4542
|
});
|
|
4533
|
-
class
|
|
4543
|
+
class yt extends f {
|
|
4534
4544
|
constructor({ cause: t } = {}) {
|
|
4535
4545
|
super([
|
|
4536
4546
|
"The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
|
|
@@ -4551,13 +4561,13 @@ class bt extends f {
|
|
|
4551
4561
|
});
|
|
4552
4562
|
}
|
|
4553
4563
|
}
|
|
4554
|
-
Object.defineProperty(
|
|
4564
|
+
Object.defineProperty(yt, "nodeMessage", {
|
|
4555
4565
|
enumerable: !0,
|
|
4556
4566
|
configurable: !0,
|
|
4557
4567
|
writable: !0,
|
|
4558
4568
|
value: /insufficient funds|exceeds transaction sender account balance/
|
|
4559
4569
|
});
|
|
4560
|
-
class
|
|
4570
|
+
class bt extends f {
|
|
4561
4571
|
constructor({ cause: t, gas: n } = {}) {
|
|
4562
4572
|
super(`The amount of gas ${n ? `(${n}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, {
|
|
4563
4573
|
cause: t,
|
|
@@ -4565,7 +4575,7 @@ class mt extends f {
|
|
|
4565
4575
|
});
|
|
4566
4576
|
}
|
|
4567
4577
|
}
|
|
4568
|
-
Object.defineProperty(
|
|
4578
|
+
Object.defineProperty(bt, "nodeMessage", {
|
|
4569
4579
|
enumerable: !0,
|
|
4570
4580
|
configurable: !0,
|
|
4571
4581
|
writable: !0,
|
|
@@ -4638,7 +4648,7 @@ function Oa(e, t) {
|
|
|
4638
4648
|
}) : lt.nodeMessage.test(n) ? new lt({
|
|
4639
4649
|
cause: e,
|
|
4640
4650
|
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 }) :
|
|
4651
|
+
}) : 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
4652
|
cause: e,
|
|
4643
4653
|
maxFeePerGas: t?.maxFeePerGas,
|
|
4644
4654
|
maxPriorityFeePerGas: t?.maxPriorityFeePerGas
|
|
@@ -4651,7 +4661,7 @@ function Ba(e, { docsPath: t, ...n }) {
|
|
|
4651
4661
|
const s = Oa(e, n);
|
|
4652
4662
|
return s instanceof qn ? e : s;
|
|
4653
4663
|
})();
|
|
4654
|
-
return new
|
|
4664
|
+
return new ma(r, {
|
|
4655
4665
|
docsPath: t,
|
|
4656
4666
|
...n
|
|
4657
4667
|
});
|
|
@@ -4703,16 +4713,16 @@ function _a({ fn: e, id: t, shouldSplitBatch: n, wait: r = 0, sort: s }) {
|
|
|
4703
4713
|
const i = async () => {
|
|
4704
4714
|
const l = c();
|
|
4705
4715
|
a();
|
|
4706
|
-
const
|
|
4707
|
-
|
|
4716
|
+
const y = l.map(({ args: p }) => p);
|
|
4717
|
+
y.length !== 0 && e(y).then((p) => {
|
|
4708
4718
|
s && Array.isArray(p) && p.sort(s);
|
|
4709
|
-
for (let
|
|
4710
|
-
const { resolve: h } = l[
|
|
4711
|
-
h?.([p[
|
|
4719
|
+
for (let m = 0; m < l.length; m++) {
|
|
4720
|
+
const { resolve: h } = l[m];
|
|
4721
|
+
h?.([p[m], p]);
|
|
4712
4722
|
}
|
|
4713
4723
|
}).catch((p) => {
|
|
4714
|
-
for (let
|
|
4715
|
-
const { reject: h } = l[
|
|
4724
|
+
for (let m = 0; m < l.length; m++) {
|
|
4725
|
+
const { reject: h } = l[m];
|
|
4716
4726
|
h?.(p);
|
|
4717
4727
|
}
|
|
4718
4728
|
});
|
|
@@ -4720,8 +4730,8 @@ function _a({ fn: e, id: t, shouldSplitBatch: n, wait: r = 0, sort: s }) {
|
|
|
4720
4730
|
return {
|
|
4721
4731
|
flush: a,
|
|
4722
4732
|
async schedule(l) {
|
|
4723
|
-
const { promise:
|
|
4724
|
-
return n?.([...o(), l]) && i(), c().length > 0 ? (d({ args: l, resolve: p, reject:
|
|
4733
|
+
const { promise: y, resolve: p, reject: m } = za();
|
|
4734
|
+
return n?.([...o(), l]) && i(), c().length > 0 ? (d({ args: l, resolve: p, reject: m }), y) : (d({ args: l, resolve: p, reject: m }), setTimeout(i, r), y);
|
|
4725
4735
|
}
|
|
4726
4736
|
};
|
|
4727
4737
|
}
|
|
@@ -4778,20 +4788,20 @@ function Wa(e) {
|
|
|
4778
4788
|
throw new _e({ maxFeePerGas: n, maxPriorityFeePerGas: r });
|
|
4779
4789
|
}
|
|
4780
4790
|
async function Ka(e, t) {
|
|
4781
|
-
const { account: n = e.account, authorizationList: r, batch: s = !!e.batch?.multicall, blockNumber: i, blockTag: a = e.experimental_blockTag ?? "latest", accessList: o, blobs: c, blockOverrides: d, code: l, data:
|
|
4782
|
-
if (l && (p ||
|
|
4791
|
+
const { account: n = e.account, authorizationList: r, batch: s = !!e.batch?.multicall, blockNumber: i, blockTag: a = 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;
|
|
4792
|
+
if (l && (p || m))
|
|
4783
4793
|
throw new f("Cannot provide both `code` & `factory`/`factoryData` as parameters.");
|
|
4784
4794
|
if (l && S)
|
|
4785
4795
|
throw new f("Cannot provide both `code` & `to` as parameters.");
|
|
4786
|
-
const H = l &&
|
|
4796
|
+
const H = l && y, q = p && m && S && y, U = H || q, le = H ? er({
|
|
4787
4797
|
code: l,
|
|
4788
|
-
data:
|
|
4798
|
+
data: y
|
|
4789
4799
|
}) : q ? Xa({
|
|
4790
|
-
data:
|
|
4800
|
+
data: y,
|
|
4791
4801
|
factory: p,
|
|
4792
|
-
factoryData:
|
|
4802
|
+
factoryData: m,
|
|
4793
4803
|
to: S
|
|
4794
|
-
}) :
|
|
4804
|
+
}) : y;
|
|
4795
4805
|
try {
|
|
4796
4806
|
Wa(t);
|
|
4797
4807
|
const L = (typeof i == "bigint" ? I(i) : void 0) || a, M = d ? ka(d) : void 0, z = Va(D), W = e.chain?.formatters?.transactionRequest?.format, R = (W || Fa)({
|
|
@@ -4806,7 +4816,7 @@ async function Ka(e, t) {
|
|
|
4806
4816
|
gasPrice: v,
|
|
4807
4817
|
maxFeePerBlobGas: P,
|
|
4808
4818
|
maxFeePerGas: T,
|
|
4809
|
-
maxPriorityFeePerGas:
|
|
4819
|
+
maxPriorityFeePerGas: b,
|
|
4810
4820
|
nonce: x,
|
|
4811
4821
|
to: U ? void 0 : S,
|
|
4812
4822
|
value: N
|
|
@@ -4828,13 +4838,13 @@ async function Ka(e, t) {
|
|
|
4828
4838
|
L
|
|
4829
4839
|
];
|
|
4830
4840
|
return z && M ? [...ee, z, M] : z ? [...ee, z] : M ? [...ee, {}, M] : ee;
|
|
4831
|
-
})(),
|
|
4841
|
+
})(), me = await e.request({
|
|
4832
4842
|
method: "eth_call",
|
|
4833
4843
|
params: K
|
|
4834
4844
|
});
|
|
4835
|
-
return
|
|
4845
|
+
return me === "0x" ? { data: void 0 } : { data: me };
|
|
4836
4846
|
} catch ($) {
|
|
4837
|
-
const L = Ja($), { offchainLookup: M, offchainLookupSignature: z } = await import("./ccip-
|
|
4847
|
+
const L = Ja($), { offchainLookup: M, offchainLookupSignature: z } = await import("./ccip-BamGZKKI.js");
|
|
4838
4848
|
if (e.ccipRead !== !1 && L?.slice(0, 10) === z && S)
|
|
4839
4849
|
return { data: await M(e, { data: L, to: S }) };
|
|
4840
4850
|
throw U && L?.slice(0, 10) === "0x101bb98d" ? new ga({ factory: p }) : Ba($, {
|
|
@@ -4861,11 +4871,11 @@ async function Za(e, t) {
|
|
|
4861
4871
|
contract: "multicall3"
|
|
4862
4872
|
});
|
|
4863
4873
|
throw new Gn();
|
|
4864
|
-
})(),
|
|
4865
|
-
id: `${e.uid}.${
|
|
4874
|
+
})(), y = (typeof i == "bigint" ? I(i) : void 0) || a, { schedule: p } = _a({
|
|
4875
|
+
id: `${e.uid}.${y}`,
|
|
4866
4876
|
wait: s,
|
|
4867
4877
|
shouldSplitBatch(v) {
|
|
4868
|
-
return v.reduce((T, { data:
|
|
4878
|
+
return v.reduce((T, { data: b }) => T + (b.length - 2), 0) > n * 2;
|
|
4869
4879
|
},
|
|
4870
4880
|
fn: async (v) => {
|
|
4871
4881
|
const P = v.map((x) => ({
|
|
@@ -4876,7 +4886,7 @@ async function Za(e, t) {
|
|
|
4876
4886
|
abi: Ut,
|
|
4877
4887
|
args: [P],
|
|
4878
4888
|
functionName: "aggregate3"
|
|
4879
|
-
}),
|
|
4889
|
+
}), b = await e.request({
|
|
4880
4890
|
method: "eth_call",
|
|
4881
4891
|
params: [
|
|
4882
4892
|
{
|
|
@@ -4887,20 +4897,20 @@ async function Za(e, t) {
|
|
|
4887
4897
|
})
|
|
4888
4898
|
} : { to: d, data: T }
|
|
4889
4899
|
},
|
|
4890
|
-
|
|
4900
|
+
y
|
|
4891
4901
|
]
|
|
4892
4902
|
});
|
|
4893
4903
|
return zn({
|
|
4894
4904
|
abi: Ut,
|
|
4895
4905
|
args: [P],
|
|
4896
4906
|
functionName: "aggregate3",
|
|
4897
|
-
data:
|
|
4907
|
+
data: b || "0x"
|
|
4898
4908
|
});
|
|
4899
4909
|
}
|
|
4900
|
-
}), [{ returnData:
|
|
4910
|
+
}), [{ returnData: m, success: h }] = await p({ data: o, to: c });
|
|
4901
4911
|
if (!h)
|
|
4902
|
-
throw new Yn({ data:
|
|
4903
|
-
return
|
|
4912
|
+
throw new Yn({ data: m });
|
|
4913
|
+
return m === "0x" ? { data: void 0 } : { data: m };
|
|
4904
4914
|
}
|
|
4905
4915
|
function er(e) {
|
|
4906
4916
|
const { code: t, data: n } = e;
|
|
@@ -4983,7 +4993,7 @@ function to() {
|
|
|
4983
4993
|
address: O.PAYMENT_ROUTER,
|
|
4984
4994
|
abi: De,
|
|
4985
4995
|
functionName: "paused"
|
|
4986
|
-
}),
|
|
4996
|
+
}), y = async (h, v) => {
|
|
4987
4997
|
try {
|
|
4988
4998
|
return await eo(t, {
|
|
4989
4999
|
address: h,
|
|
@@ -5000,7 +5010,7 @@ function to() {
|
|
|
5000
5010
|
if (h === "0x0000000000000000000000000000000000000000")
|
|
5001
5011
|
return null;
|
|
5002
5012
|
try {
|
|
5003
|
-
return await
|
|
5013
|
+
return await y(h, e) >= v ? (console.log(
|
|
5004
5014
|
`Sufficient allowance for ${h}, skipping approval`
|
|
5005
5015
|
), null) : (console.log(`Requesting infinite approval for ${h}`), await n({
|
|
5006
5016
|
address: h,
|
|
@@ -5019,7 +5029,7 @@ function to() {
|
|
|
5019
5029
|
tokens: v,
|
|
5020
5030
|
totalAmountUSD: P,
|
|
5021
5031
|
settleInIDR: T,
|
|
5022
|
-
target:
|
|
5032
|
+
target: b,
|
|
5023
5033
|
callData: x
|
|
5024
5034
|
}) => {
|
|
5025
5035
|
if (!e)
|
|
@@ -5048,7 +5058,7 @@ function to() {
|
|
|
5048
5058
|
throw new Error(`Failed to approve ${L.symbol}: ${M}`);
|
|
5049
5059
|
}
|
|
5050
5060
|
}
|
|
5051
|
-
const q = BigInt(Math.floor(P * Or)), U =
|
|
5061
|
+
const q = BigInt(Math.floor(P * Or)), U = b || "0x0000000000000000000000000000000000000000", le = x || "0x";
|
|
5052
5062
|
return await n({
|
|
5053
5063
|
address: O.PAYMENT_ROUTER,
|
|
5054
5064
|
abi: De,
|
|
@@ -5083,28 +5093,28 @@ function Be(e) {
|
|
|
5083
5093
|
});
|
|
5084
5094
|
return {
|
|
5085
5095
|
// Write functions
|
|
5086
|
-
transfer: (T,
|
|
5096
|
+
transfer: (T, b) => {
|
|
5087
5097
|
n({
|
|
5088
5098
|
address: e,
|
|
5089
5099
|
abi: te,
|
|
5090
5100
|
functionName: "transfer",
|
|
5091
|
-
args: [T,
|
|
5101
|
+
args: [T, b]
|
|
5092
5102
|
});
|
|
5093
5103
|
},
|
|
5094
|
-
approve: (T,
|
|
5104
|
+
approve: (T, b) => {
|
|
5095
5105
|
n({
|
|
5096
5106
|
address: e,
|
|
5097
5107
|
abi: te,
|
|
5098
5108
|
functionName: "approve",
|
|
5099
|
-
args: [T,
|
|
5109
|
+
args: [T, b]
|
|
5100
5110
|
});
|
|
5101
5111
|
},
|
|
5102
|
-
transferFrom: (T,
|
|
5112
|
+
transferFrom: (T, b, x) => {
|
|
5103
5113
|
n({
|
|
5104
5114
|
address: e,
|
|
5105
5115
|
abi: te,
|
|
5106
5116
|
functionName: "transferFrom",
|
|
5107
|
-
args: [T,
|
|
5117
|
+
args: [T, b, x]
|
|
5108
5118
|
});
|
|
5109
5119
|
},
|
|
5110
5120
|
// Read hooks
|
|
@@ -5129,21 +5139,21 @@ function Be(e) {
|
|
|
5129
5139
|
functionName: "totalSupply"
|
|
5130
5140
|
}),
|
|
5131
5141
|
useBalanceOf: (T) => {
|
|
5132
|
-
const
|
|
5142
|
+
const b = T || t;
|
|
5133
5143
|
return j({
|
|
5134
5144
|
address: e,
|
|
5135
5145
|
abi: te,
|
|
5136
5146
|
functionName: "balanceOf",
|
|
5137
|
-
args:
|
|
5138
|
-
query: { enabled: !!
|
|
5147
|
+
args: b ? [b] : void 0,
|
|
5148
|
+
query: { enabled: !!b }
|
|
5139
5149
|
});
|
|
5140
5150
|
},
|
|
5141
|
-
useAllowance: (T,
|
|
5151
|
+
useAllowance: (T, b) => j({
|
|
5142
5152
|
address: e,
|
|
5143
5153
|
abi: te,
|
|
5144
5154
|
functionName: "allowance",
|
|
5145
|
-
args: T &&
|
|
5146
|
-
query: { enabled: !!(T &&
|
|
5155
|
+
args: T && b ? [T, b] : void 0,
|
|
5156
|
+
query: { enabled: !!(T && b) }
|
|
5147
5157
|
}),
|
|
5148
5158
|
// Transaction state
|
|
5149
5159
|
hash: r,
|
|
@@ -5156,14 +5166,14 @@ function Be(e) {
|
|
|
5156
5166
|
function no() {
|
|
5157
5167
|
const { address: e } = Ge(), { data: t, isLoading: n } = gr({
|
|
5158
5168
|
address: e
|
|
5159
|
-
}), r = Be(E.USDC), s = Be(E.USDT), i = Be(E.DAI), a = Be(E.WBTC), { data: o, isLoading: c } = r.useBalanceOf(e), { data: d, isLoading: l } = s.useBalanceOf(e), { data:
|
|
5169
|
+
}), r = Be(E.USDC), s = Be(E.USDT), i = Be(E.DAI), a = Be(E.WBTC), { data: o, isLoading: c } = r.useBalanceOf(e), { data: d, isLoading: l } = s.useBalanceOf(e), { data: y, isLoading: p } = i.useBalanceOf(e), { data: m, isLoading: h } = a.useBalanceOf(e);
|
|
5160
5170
|
return {
|
|
5161
5171
|
balances: {
|
|
5162
5172
|
ETH: t ? parseFloat(Ce(t.value, 18)) : 0,
|
|
5163
5173
|
USDC: o ? parseFloat(Ce(o, 6)) : 0,
|
|
5164
5174
|
USDT: d ? parseFloat(Ce(d, 6)) : 0,
|
|
5165
|
-
DAI:
|
|
5166
|
-
WBTC:
|
|
5175
|
+
DAI: y ? parseFloat(Ce(y, 18)) : 0,
|
|
5176
|
+
WBTC: m ? parseFloat(Ce(m, 8)) : 0
|
|
5167
5177
|
},
|
|
5168
5178
|
isLoading: !e || n || c || l || p || h
|
|
5169
5179
|
};
|
|
@@ -5183,10 +5193,10 @@ function ro() {
|
|
|
5183
5193
|
error: d
|
|
5184
5194
|
} = e.useGetTokenPrice(E.USDT), {
|
|
5185
5195
|
data: l,
|
|
5186
|
-
isLoading:
|
|
5196
|
+
isLoading: y,
|
|
5187
5197
|
error: p
|
|
5188
5198
|
} = e.useGetTokenPrice(E.DAI), {
|
|
5189
|
-
data:
|
|
5199
|
+
data: m,
|
|
5190
5200
|
isLoading: h,
|
|
5191
5201
|
error: v
|
|
5192
5202
|
} = e.useGetTokenPrice(E.WBTC), P = 1e8, T = (x) => {
|
|
@@ -5207,16 +5217,16 @@ function ro() {
|
|
|
5207
5217
|
}
|
|
5208
5218
|
};
|
|
5209
5219
|
r && console.error("ETH price error:", r), a && console.error("USDC price error:", a), d && console.error("USDT price error:", d), p && console.error("DAI price error:", p), v && console.error("WBTC price error:", v);
|
|
5210
|
-
const
|
|
5220
|
+
const b = {
|
|
5211
5221
|
ETH: T(t),
|
|
5212
5222
|
USDC: T(s) || 1,
|
|
5213
5223
|
USDT: T(o) || 1,
|
|
5214
5224
|
DAI: T(l) || 1,
|
|
5215
|
-
WBTC: T(
|
|
5225
|
+
WBTC: T(m)
|
|
5216
5226
|
};
|
|
5217
|
-
return console.log("Converted prices:",
|
|
5218
|
-
prices:
|
|
5219
|
-
isLoading: n || i || c ||
|
|
5227
|
+
return console.log("Converted prices:", b), {
|
|
5228
|
+
prices: b,
|
|
5229
|
+
isLoading: n || i || c || y || h,
|
|
5220
5230
|
errors: {
|
|
5221
5231
|
ETH: r,
|
|
5222
5232
|
USDC: a,
|
|
@@ -5268,7 +5278,7 @@ function Io({
|
|
|
5268
5278
|
className: i = "",
|
|
5269
5279
|
children: a
|
|
5270
5280
|
}) {
|
|
5271
|
-
const { isConnected: o } = Ge(), { connect: c, connectors: d } = wr(), l = n?.currency ?? "USD",
|
|
5281
|
+
const { isConnected: o } = Ge(), { connect: c, connectors: d } = wr(), l = n?.currency ?? "USD", y = n?.target, p = n?.callData, m = io(t), [h, v] = V(!1), [P, T] = V([]), b = vt(), { 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
5282
|
if (!J) return 1 / 15600;
|
|
5273
5283
|
if (Array.isArray(J) && J.length >= 1) {
|
|
5274
5284
|
const R = J[0];
|
|
@@ -5276,7 +5286,7 @@ function Io({
|
|
|
5276
5286
|
return Number(R) / so;
|
|
5277
5287
|
}
|
|
5278
5288
|
return 1 / 15600;
|
|
5279
|
-
})(), z = l === "IDR" ?
|
|
5289
|
+
})(), z = l === "IDR" ? m * M : m, W = () => {
|
|
5280
5290
|
o ? v(!0) : c({ connector: d[0] });
|
|
5281
5291
|
}, re = async (R) => {
|
|
5282
5292
|
try {
|
|
@@ -5285,12 +5295,12 @@ function Io({
|
|
|
5285
5295
|
tokens: R,
|
|
5286
5296
|
totalAmountUSD: z,
|
|
5287
5297
|
settleInIDR: l === "IDR",
|
|
5288
|
-
target:
|
|
5298
|
+
target: y,
|
|
5289
5299
|
callData: p
|
|
5290
5300
|
});
|
|
5291
5301
|
} catch (K) {
|
|
5292
|
-
const
|
|
5293
|
-
s?.(
|
|
5302
|
+
const me = qt(K);
|
|
5303
|
+
s?.(me);
|
|
5294
5304
|
}
|
|
5295
5305
|
};
|
|
5296
5306
|
return ve(() => {
|
|
@@ -5387,7 +5397,7 @@ function Io({
|
|
|
5387
5397
|
{
|
|
5388
5398
|
onClick: W,
|
|
5389
5399
|
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 ${i}`,
|
|
5400
|
+
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 ${i}`,
|
|
5391
5401
|
children: a || (o ? "Pay with MultiCoyn" : "Connect Wallet to Pay")
|
|
5392
5402
|
}
|
|
5393
5403
|
),
|
|
@@ -5438,7 +5448,7 @@ const ao = Pr({
|
|
|
5438
5448
|
function ko({ children: e }) {
|
|
5439
5449
|
return /* @__PURE__ */ u(xr, { config: oo, children: /* @__PURE__ */ u(Sr, { client: co, children: /* @__PURE__ */ u(Cr, { children: e }) }) });
|
|
5440
5450
|
}
|
|
5441
|
-
const tr =
|
|
5451
|
+
const tr = yr(
|
|
5442
5452
|
void 0
|
|
5443
5453
|
);
|
|
5444
5454
|
function No({
|
|
@@ -5451,7 +5461,7 @@ function No({
|
|
|
5451
5461
|
return /* @__PURE__ */ u(tr.Provider, { value: { config: n, updateConfig: s }, children: e });
|
|
5452
5462
|
}
|
|
5453
5463
|
function Ro() {
|
|
5454
|
-
const e =
|
|
5464
|
+
const e = br(tr);
|
|
5455
5465
|
if (!e)
|
|
5456
5466
|
throw new Error("usePaymentConfig must be used within PaymentProvider");
|
|
5457
5467
|
return e;
|