@rash2x/bridge-widget 0.6.28 → 0.6.29
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/evaa-bridge.cjs +1 -1
- package/dist/evaa-bridge.mjs +1 -1
- package/dist/{index-D1Vzcfyk.js → index-BqFCsB_A.js} +36 -24
- package/dist/index-BqFCsB_A.js.map +1 -0
- package/dist/{index-D6vg_rMM.cjs → index-BsYvWq1w.cjs} +2 -2
- package/dist/{index-D6vg_rMM.cjs.map → index-BsYvWq1w.cjs.map} +1 -1
- package/dist/{index-CjIST-mb.cjs → index-BtLimmVe.cjs} +36 -24
- package/dist/index-BtLimmVe.cjs.map +1 -0
- package/dist/{index-qwLU8D7B.js → index-ieIpvYrV.js} +2 -2
- package/dist/{index-qwLU8D7B.js.map → index-ieIpvYrV.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-CjIST-mb.cjs.map +0 -1
- package/dist/index-D1Vzcfyk.js.map +0 -1
package/dist/evaa-bridge.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-BtLimmVe.cjs");
|
|
4
4
|
exports.DEFAULT_SLIPPAGE_BPS = index.DEFAULT_SLIPPAGE_BPS;
|
|
5
5
|
exports.EvaaBridge = index.EvaaBridge;
|
|
6
6
|
exports.RoutePriority = index.RoutePriority;
|
package/dist/evaa-bridge.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { U, d, f, e, H, B, F, X, N, z, $, G, A, D, Z, w, s, v, r, p, q, L, a2, a9, a4, a6, x, I, y, a5, J, a3, a7, a8, Y, W, P, _, a1, aa, Q, S, a0, K, V, t, o, i, u, l, m, j, n, h, k } from "./index-
|
|
1
|
+
import { U, d, f, e, H, B, F, X, N, z, $, G, A, D, Z, w, s, v, r, p, q, L, a2, a9, a4, a6, x, I, y, a5, J, a3, a7, a8, Y, W, P, _, a1, aa, Q, S, a0, K, V, t, o, i, u, l, m, j, n, h, k } from "./index-BqFCsB_A.js";
|
|
2
2
|
export {
|
|
3
3
|
U as DEFAULT_SLIPPAGE_BPS,
|
|
4
4
|
d as EvaaBridge,
|
|
@@ -1302,6 +1302,19 @@ function getRouteDisplayName(route) {
|
|
|
1302
1302
|
if (routeLower.includes("v2")) return "Stargate V2";
|
|
1303
1303
|
return route.split(/[/\-_]/).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
1304
1304
|
}
|
|
1305
|
+
const toSharedDecimals = (amount, fromDecimals, toDecimals) => {
|
|
1306
|
+
const value = BigInt(amount);
|
|
1307
|
+
const diff = BigInt(toDecimals) - BigInt(fromDecimals);
|
|
1308
|
+
if (diff === 0n) return value.toString();
|
|
1309
|
+
if (diff > 0n) return (value * 10n ** diff).toString();
|
|
1310
|
+
const divisor = 10n ** -diff;
|
|
1311
|
+
if (value % divisor !== 0n) {
|
|
1312
|
+
throw new Error(
|
|
1313
|
+
`Cannot convert amount ${amount} from ${fromDecimals} to ${toDecimals} decimals. Got dust: ${value % divisor}`
|
|
1314
|
+
);
|
|
1315
|
+
}
|
|
1316
|
+
return (value / divisor).toString();
|
|
1317
|
+
};
|
|
1305
1318
|
function useBridgeQuote() {
|
|
1306
1319
|
const { assetMatrix, selectedAssetSymbol } = useTokensStore();
|
|
1307
1320
|
const { fromChain, toChain, chains } = useChainsStore();
|
|
@@ -1380,14 +1393,19 @@ function useBridgeQuote() {
|
|
|
1380
1393
|
const dstAddrApi = addrForApi(toChain.chainKey, dstAddress);
|
|
1381
1394
|
const dstNativeAmount = getDstNativeAmount(toChain.chainKey);
|
|
1382
1395
|
const slippageDecimal = getSlippageDecimal();
|
|
1383
|
-
const
|
|
1396
|
+
const dstAmountLD = toSharedDecimals(
|
|
1397
|
+
srcAmountLD,
|
|
1398
|
+
srcTokenOnFrom.decimals,
|
|
1399
|
+
dstTokenOnTo.decimals
|
|
1400
|
+
);
|
|
1401
|
+
const dstAmountMinLD = (BigInt(dstAmountLD) * BigInt(9500) / BigInt(1e4)).toString();
|
|
1384
1402
|
const quoteRoute = await getQuotesByPriority({
|
|
1385
1403
|
srcChainKey: fromChain.chainKey,
|
|
1386
1404
|
dstChainKey: toChain.chainKey,
|
|
1387
1405
|
srcToken: srcTokenOnFrom.address,
|
|
1388
1406
|
dstToken: dstTokenOnTo.address,
|
|
1389
1407
|
srcAmountLD,
|
|
1390
|
-
dstAmountMinLD
|
|
1408
|
+
dstAmountMinLD,
|
|
1391
1409
|
srcAddress: srcAddrApi,
|
|
1392
1410
|
dstAddress: dstAddrApi,
|
|
1393
1411
|
dstNativeAmount,
|
|
@@ -2890,7 +2908,6 @@ const SwapSection = ({
|
|
|
2890
2908
|
return formatUsd(amt * priceUsd);
|
|
2891
2909
|
}, [amount, priceUsd]);
|
|
2892
2910
|
const isUsdLoading = Boolean(amount && parseFloat(amount) > 0 && !priceUsd);
|
|
2893
|
-
const isInsufficientBalance = !!(amount && balance.balance && parseFloat(amount) > balance.balance);
|
|
2894
2911
|
const onChangeChain = useCallback(
|
|
2895
2912
|
(c2) => {
|
|
2896
2913
|
onSelect?.(c2);
|
|
@@ -2903,6 +2920,9 @@ const SwapSection = ({
|
|
|
2903
2920
|
onAmountChange(balance.balance.toString());
|
|
2904
2921
|
}
|
|
2905
2922
|
}, [balance.balance, onAmountChange]);
|
|
2923
|
+
const isInsufficientBalance = useMemo(() => {
|
|
2924
|
+
return !!(isSource && amount && balance.balance && parseFloat(amount) > balance.balance);
|
|
2925
|
+
}, [amount, balance.balance, isSource]);
|
|
2906
2926
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2907
2927
|
/* @__PURE__ */ jsxs(
|
|
2908
2928
|
"div",
|
|
@@ -2959,7 +2979,7 @@ const SwapSection = ({
|
|
|
2959
2979
|
addressType: isSource ? "src" : "dst"
|
|
2960
2980
|
}
|
|
2961
2981
|
),
|
|
2962
|
-
|
|
2982
|
+
isInsufficientBalance ? /* @__PURE__ */ jsx("span", { className: "leading-5 text-sm font-medium text-destructive", children: t2("transaction.insufficientBalance") }) : isUsdLoading ? /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-12 rounded-md" }) : /* @__PURE__ */ jsx("span", { className: "leading-5 text-sm font-medium text-muted-foreground", children: computedFiat })
|
|
2963
2983
|
] })
|
|
2964
2984
|
]
|
|
2965
2985
|
}
|
|
@@ -3015,13 +3035,7 @@ const AnotherAddress = () => {
|
|
|
3015
3035
|
if (customDstAddress !== trimmed) {
|
|
3016
3036
|
setCustomDstAddress(trimmed);
|
|
3017
3037
|
}
|
|
3018
|
-
}, [
|
|
3019
|
-
isEnabled2,
|
|
3020
|
-
trimmed,
|
|
3021
|
-
isValid,
|
|
3022
|
-
setCustomDstAddress,
|
|
3023
|
-
customDstAddress
|
|
3024
|
-
]);
|
|
3038
|
+
}, [isEnabled2, trimmed, isValid, setCustomDstAddress, customDstAddress]);
|
|
3025
3039
|
const onPaste = async () => {
|
|
3026
3040
|
try {
|
|
3027
3041
|
const text = await navigator.clipboard.readText?.() ?? "";
|
|
@@ -3078,9 +3092,7 @@ const AnotherAddress = () => {
|
|
|
3078
3092
|
),
|
|
3079
3093
|
value && /* @__PURE__ */ jsx(Fragment, { children: invalid ? /* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-destructive", children: t2("bridge.addressDoesntMatch", {
|
|
3080
3094
|
network: toChain?.name ?? "selected"
|
|
3081
|
-
}) }) : /* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground", children: t2("bridge.checkBeforeTransfer"
|
|
3082
|
-
defaultValue: "Check correctness before transfer"
|
|
3083
|
-
}) }) })
|
|
3095
|
+
}) }) : /* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground", children: t2("bridge.checkBeforeTransfer") }) })
|
|
3084
3096
|
] }),
|
|
3085
3097
|
!value ? /* @__PURE__ */ jsx(
|
|
3086
3098
|
Button,
|
|
@@ -4412,9 +4424,9 @@ const ProgressStep = ({
|
|
|
4412
4424
|
title: t2("transaction.steps.completed")
|
|
4413
4425
|
}
|
|
4414
4426
|
];
|
|
4415
|
-
return /* @__PURE__ */ jsx(DialogContent, { showCloseButton: false, className: "overflow-hidden", children: /* @__PURE__ */ jsxs("div", { className: "flex relative flex-col gap-6 flex-1 items-center justify-start text-center bg-background p-6", children: [
|
|
4427
|
+
return /* @__PURE__ */ jsx(DialogContent, { showCloseButton: false, className: "overflow-hidden md:max-w-[420px] p-10", children: /* @__PURE__ */ jsxs("div", { className: "flex relative flex-col gap-6 flex-1 items-center justify-start text-center bg-background p-6", children: [
|
|
4416
4428
|
icon,
|
|
4417
|
-
/* @__PURE__ */ jsx(DialogHeader, { className: "pr-0", children: /* @__PURE__ */ jsx(DialogTitle, { children: t2("transaction.inProgress") }) }),
|
|
4429
|
+
/* @__PURE__ */ jsx(DialogHeader, { className: "pr-0 !sm:text-center", children: /* @__PURE__ */ jsx(DialogTitle, { children: t2("transaction.inProgress") }) }),
|
|
4418
4430
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
4419
4431
|
/* @__PURE__ */ jsx("div", { className: "absolute left-5 top-5 bottom-5 border-l border-dashed border-foreground/50" }),
|
|
4420
4432
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-6 relative z-10", children: steps.map((step) => /* @__PURE__ */ jsxs(
|
|
@@ -4439,10 +4451,10 @@ const FailedStep = ({
|
|
|
4439
4451
|
}) => {
|
|
4440
4452
|
const { current, reset } = useTransactionStore();
|
|
4441
4453
|
const { t: t2 } = useBridgeTranslation();
|
|
4442
|
-
return /* @__PURE__ */ jsxs(DialogContent, { showCloseButton: true, className: "overflow-hidden", children: [
|
|
4454
|
+
return /* @__PURE__ */ jsxs(DialogContent, { showCloseButton: true, className: "overflow-hidden md:max-w-[420px] p-10", children: [
|
|
4443
4455
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col relative gap-4 flex-1 items-center justify-start text-center", children: [
|
|
4444
4456
|
icon,
|
|
4445
|
-
/* @__PURE__ */ jsxs(DialogHeader, { className: "pr-0", children: [
|
|
4457
|
+
/* @__PURE__ */ jsxs(DialogHeader, { className: "pr-0 !sm:text-center", children: [
|
|
4446
4458
|
/* @__PURE__ */ jsx(DialogTitle, { children: t2("transaction.failed") }),
|
|
4447
4459
|
current?.errorCode && /* @__PURE__ */ jsx(DialogDescription$1, { children: t2(
|
|
4448
4460
|
`errors.${current.errorCode}`,
|
|
@@ -4554,10 +4566,10 @@ const SuccessStep = ({
|
|
|
4554
4566
|
openTransactionInExplorer(srcChainKey, srcTxHash);
|
|
4555
4567
|
}
|
|
4556
4568
|
};
|
|
4557
|
-
return /* @__PURE__ */ jsxs(DialogContent, { showCloseButton: true, className: "overflow-hidden", children: [
|
|
4569
|
+
return /* @__PURE__ */ jsxs(DialogContent, { showCloseButton: true, className: "overflow-hidden md:max-w-[420px] p-10", children: [
|
|
4558
4570
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 flex-1 justify-start items-center text-center bg-background", children: [
|
|
4559
4571
|
icon,
|
|
4560
|
-
/* @__PURE__ */ jsx(DialogHeader, { className: "pr-0", children: /* @__PURE__ */ jsx(DialogTitle, { children: t2("transaction.success") }) }),
|
|
4572
|
+
/* @__PURE__ */ jsx(DialogHeader, { className: "pr-0 !sm:text-center", children: /* @__PURE__ */ jsx(DialogTitle, { children: t2("transaction.success") }) }),
|
|
4561
4573
|
/* @__PURE__ */ jsxs("div", { className: "w-full space-y-2 mt-4 relative z-10 pb-14", children: [
|
|
4562
4574
|
metadata?.srcAmountHuman && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
|
|
4563
4575
|
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: t2("transaction.bridged") }),
|
|
@@ -4630,9 +4642,9 @@ const ConfirmStep = ({
|
|
|
4630
4642
|
}) => {
|
|
4631
4643
|
const { t: t2 } = useBridgeTranslation();
|
|
4632
4644
|
const { formatTime } = useCountdown(90);
|
|
4633
|
-
return /* @__PURE__ */ jsx(DialogContent, { showCloseButton: false, className: "overflow-hidden", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col relative gap-4 flex-1 items-center justify-start text-center", children: [
|
|
4645
|
+
return /* @__PURE__ */ jsx(DialogContent, { showCloseButton: false, className: "overflow-hidden md:max-w-[420px] p-10", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col relative gap-4 flex-1 items-center justify-start text-center", children: [
|
|
4634
4646
|
icon,
|
|
4635
|
-
/* @__PURE__ */ jsxs(DialogHeader, { className: "pr-0", children: [
|
|
4647
|
+
/* @__PURE__ */ jsxs(DialogHeader, { className: "pr-0 !sm:text-center", children: [
|
|
4636
4648
|
/* @__PURE__ */ jsx(DialogTitle, { children: t2("transaction.confirm") }),
|
|
4637
4649
|
/* @__PURE__ */ jsx(DialogDescription, { children: t2("transaction.signTransaction") })
|
|
4638
4650
|
] }),
|
|
@@ -26105,7 +26117,7 @@ class WalletConnectModal {
|
|
|
26105
26117
|
}
|
|
26106
26118
|
async initUi() {
|
|
26107
26119
|
if (typeof window !== "undefined") {
|
|
26108
|
-
await import("./index-
|
|
26120
|
+
await import("./index-ieIpvYrV.js");
|
|
26109
26121
|
const modal = document.createElement("wcm-modal");
|
|
26110
26122
|
document.body.insertAdjacentElement("beforeend", modal);
|
|
26111
26123
|
OptionsCtrl.setIsUiLoaded(true);
|
|
@@ -26856,4 +26868,4 @@ export {
|
|
|
26856
26868
|
getQuoteFees as y,
|
|
26857
26869
|
calculateMinReceived as z
|
|
26858
26870
|
};
|
|
26859
|
-
//# sourceMappingURL=index-
|
|
26871
|
+
//# sourceMappingURL=index-BqFCsB_A.js.map
|