@rash2x/bridge-widget 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/dist/evaa-bridge.cjs +47 -59
- package/dist/evaa-bridge.cjs.map +1 -1
- package/dist/evaa-bridge.mjs +47 -59
- package/dist/evaa-bridge.mjs.map +1 -1
- package/package.json +1 -1
package/dist/evaa-bridge.cjs
CHANGED
|
@@ -1703,7 +1703,7 @@ const VirtualizedTokenList = ({
|
|
|
1703
1703
|
getTokenUsdValue,
|
|
1704
1704
|
onPick
|
|
1705
1705
|
}) => {
|
|
1706
|
-
const
|
|
1706
|
+
const Row = ({ index, style }) => {
|
|
1707
1707
|
const node = nodes[index];
|
|
1708
1708
|
if (node.kind === "header") {
|
|
1709
1709
|
const gap = index === 0 ? 0 : HEADER_TOP_GAP;
|
|
@@ -1750,7 +1750,7 @@ const VirtualizedTokenList = ({
|
|
|
1750
1750
|
itemSize: getItemSize,
|
|
1751
1751
|
overscanCount: 8,
|
|
1752
1752
|
style: { willChange: "transform", paddingBottom: "40px" },
|
|
1753
|
-
children:
|
|
1753
|
+
children: Row
|
|
1754
1754
|
}
|
|
1755
1755
|
);
|
|
1756
1756
|
};
|
|
@@ -2037,7 +2037,7 @@ function Card({ className, ...props }) {
|
|
|
2037
2037
|
{
|
|
2038
2038
|
"data-slot": "card",
|
|
2039
2039
|
className: cn(
|
|
2040
|
-
"bg-card text-card-foreground flex flex-col gap-
|
|
2040
|
+
"bg-card text-card-foreground flex flex-col gap-4 rounded-xl border py-4 shadow-sm",
|
|
2041
2041
|
className
|
|
2042
2042
|
),
|
|
2043
2043
|
...props
|
|
@@ -2050,7 +2050,7 @@ function CardHeader({ className, ...props }) {
|
|
|
2050
2050
|
{
|
|
2051
2051
|
"data-slot": "card-header",
|
|
2052
2052
|
className: cn(
|
|
2053
|
-
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-
|
|
2053
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-4 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-4",
|
|
2054
2054
|
className
|
|
2055
2055
|
),
|
|
2056
2056
|
...props
|
|
@@ -2085,7 +2085,7 @@ function CardContent({ className, ...props }) {
|
|
|
2085
2085
|
"div",
|
|
2086
2086
|
{
|
|
2087
2087
|
"data-slot": "card-content",
|
|
2088
|
-
className: cn("px-
|
|
2088
|
+
className: cn("px-4", className),
|
|
2089
2089
|
...props
|
|
2090
2090
|
}
|
|
2091
2091
|
);
|
|
@@ -2095,7 +2095,7 @@ function CardFooter({ className, ...props }) {
|
|
|
2095
2095
|
"div",
|
|
2096
2096
|
{
|
|
2097
2097
|
"data-slot": "card-footer",
|
|
2098
|
-
className: cn("flex items-center px-
|
|
2098
|
+
className: cn("flex items-center px-4 [.border-t]:pt-4", className),
|
|
2099
2099
|
...props
|
|
2100
2100
|
}
|
|
2101
2101
|
);
|
|
@@ -2960,10 +2960,8 @@ const SwapSection = ({
|
|
|
2960
2960
|
"div",
|
|
2961
2961
|
{
|
|
2962
2962
|
className: cn(
|
|
2963
|
-
"p-4 flex flex-col gap-4 transition-colors bg-
|
|
2964
|
-
|
|
2965
|
-
"bg-input-focus": isSource && isFocused
|
|
2966
|
-
},
|
|
2963
|
+
"p-4 flex flex-col gap-4 transition-colors bg-muted",
|
|
2964
|
+
isSource && isFocused ? "bg-accent" : "",
|
|
2967
2965
|
className
|
|
2968
2966
|
),
|
|
2969
2967
|
children: [
|
|
@@ -3127,7 +3125,7 @@ const ToggleRow = ({ enabled, onToggle }) => {
|
|
|
3127
3125
|
} catch {
|
|
3128
3126
|
}
|
|
3129
3127
|
};
|
|
3130
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4 flex flex-col rounded-b-
|
|
3128
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4 flex flex-col rounded-b-xl gap-2 bg-muted", children: [
|
|
3131
3129
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
3132
3130
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm leading-4.5 font-medium text-muted-foreground", children: t("bridge.sendToAnotherAddress") }),
|
|
3133
3131
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3249,15 +3247,6 @@ function AccordionContent({
|
|
|
3249
3247
|
}
|
|
3250
3248
|
);
|
|
3251
3249
|
}
|
|
3252
|
-
function getRouteDisplayName(route) {
|
|
3253
|
-
if (!route) return "Stargate Bridge";
|
|
3254
|
-
const routeLower = route.toLowerCase();
|
|
3255
|
-
if (routeLower.includes("taxi")) return "Stargate V2 Fast";
|
|
3256
|
-
if (routeLower.includes("bus")) return "Stargate V2 Economy";
|
|
3257
|
-
if (routeLower.includes("oft")) return "OFT Bridge";
|
|
3258
|
-
if (routeLower.includes("v2")) return "Stargate V2";
|
|
3259
|
-
return route.split(/[\/\-_]/).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
3260
|
-
}
|
|
3261
3250
|
function getQuoteAmounts(quote, srcToken, dstToken) {
|
|
3262
3251
|
if (!quote || !srcToken || !dstToken) {
|
|
3263
3252
|
return {
|
|
@@ -3350,12 +3339,21 @@ function getQuoteDetails(quote, srcToken, dstToken, tokens, chains, slippageBps)
|
|
|
3350
3339
|
fees
|
|
3351
3340
|
};
|
|
3352
3341
|
}
|
|
3353
|
-
|
|
3342
|
+
function getRouteDisplayName(route) {
|
|
3343
|
+
if (!route) return "Stargate Bridge";
|
|
3344
|
+
const routeLower = route.toLowerCase();
|
|
3345
|
+
if (routeLower.includes("taxi")) return "Stargate V2 Fast";
|
|
3346
|
+
if (routeLower.includes("bus")) return "Stargate V2 Economy";
|
|
3347
|
+
if (routeLower.includes("oft")) return "OFT Bridge";
|
|
3348
|
+
if (routeLower.includes("v2")) return "Stargate V2";
|
|
3349
|
+
return route.split(/[/\-_]/).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
3350
|
+
}
|
|
3351
|
+
const Details = () => {
|
|
3354
3352
|
const { t } = reactI18next.useTranslation();
|
|
3355
3353
|
const { selectedAssetSymbol, assetMatrix, tokens } = useTokensStore();
|
|
3356
3354
|
const { toChain, fromChain, chains } = useChainsStore();
|
|
3357
3355
|
const { quote, status } = useBridgeQuoteStore();
|
|
3358
|
-
const { slippageBps, routePriority
|
|
3356
|
+
const { slippageBps, routePriority } = useSettingsStore();
|
|
3359
3357
|
const dstToken = resolveTokenOnChainFromMatrix$2(
|
|
3360
3358
|
assetMatrix,
|
|
3361
3359
|
selectedAssetSymbol,
|
|
@@ -3395,9 +3393,8 @@ const ReceiveRow = () => {
|
|
|
3395
3393
|
})();
|
|
3396
3394
|
const currentSlippageText = formatPercentage(slippageBps);
|
|
3397
3395
|
const routeText = quote?.route ? getRouteDisplayName(quote.route) : t(`settings.routePresets.${routePriority}`);
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
/* @__PURE__ */ jsxRuntime.jsx(AccordionTrigger, { className: "w-full gap-1 items-center py-6 px-5 rounded-b-16 data-[state=open]:pb-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex items-center justify-between", children: [
|
|
3396
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Accordion, { type: "single", collapsible: true, className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsxs(AccordionItem, { value: "item-1", className: "bg-muted rounded-xl", children: [
|
|
3397
|
+
/* @__PURE__ */ jsxRuntime.jsx(AccordionTrigger, { className: "w-full gap-1 items-center py-6 px-5 rounded-b-xl data-[state=open]:pb-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex items-center justify-between", children: [
|
|
3401
3398
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-normal text-priority leading-3.5", children: t("bridge.youWillReceive", { defaultValue: "You will receive" }) }),
|
|
3402
3399
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-transparent hover:bg-transparent shadow-none h-4 p-0 px-0 py-0 flex items-center gap-1.5", children: [
|
|
3403
3400
|
/* @__PURE__ */ jsxRuntime.jsx(TokenSymbol, { symbol, className: "w-4 h-4", alt: "token" }),
|
|
@@ -3408,65 +3405,56 @@ const ReceiveRow = () => {
|
|
|
3408
3405
|
] })
|
|
3409
3406
|
] })
|
|
3410
3407
|
] }) }),
|
|
3411
|
-
/* @__PURE__ */ jsxRuntime.jsxs(AccordionContent, { className: "
|
|
3408
|
+
/* @__PURE__ */ jsxRuntime.jsxs(AccordionContent, { className: "px-5 flex flex-col gap-3", children: [
|
|
3412
3409
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3413
|
-
|
|
3410
|
+
DetailsRow,
|
|
3414
3411
|
{
|
|
3415
3412
|
label: t("transaction.route"),
|
|
3416
|
-
|
|
3413
|
+
value: /* @__PURE__ */ jsxRuntime.jsxs("strong", { className: "flex items-center gap-1.5", children: [
|
|
3417
3414
|
/* @__PURE__ */ jsxRuntime.jsx(StargateIcon, { className: "size-4" }),
|
|
3418
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "
|
|
3419
|
-
hasGasOnDestination && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs bg-settings-active text-settings-active-foreground px-1.5 py-0.5 rounded", children: t(`settings.gasPresets.${gasPreset}`) })
|
|
3415
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "", children: routeText })
|
|
3420
3416
|
] })
|
|
3421
3417
|
}
|
|
3422
3418
|
),
|
|
3423
3419
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3424
|
-
|
|
3420
|
+
DetailsRow,
|
|
3425
3421
|
{
|
|
3426
3422
|
label: t("transaction.estTime"),
|
|
3427
3423
|
value: etaText,
|
|
3428
3424
|
isLoading
|
|
3429
3425
|
}
|
|
3430
3426
|
),
|
|
3431
|
-
/* @__PURE__ */ jsxRuntime.jsx(Row, { label: t("transaction.slippage"), value: currentSlippageText }),
|
|
3432
3427
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3433
|
-
|
|
3428
|
+
DetailsRow,
|
|
3429
|
+
{
|
|
3430
|
+
label: t("transaction.slippage"),
|
|
3431
|
+
value: currentSlippageText
|
|
3432
|
+
}
|
|
3433
|
+
),
|
|
3434
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3435
|
+
DetailsRow,
|
|
3434
3436
|
{
|
|
3435
3437
|
label: t("transaction.totalFee"),
|
|
3436
|
-
value:
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3438
|
+
value: /* @__PURE__ */ jsxRuntime.jsxs("strong", { className: "inline-flex items-center gap-1", children: [
|
|
3439
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: totalFeeDisplay }),
|
|
3440
|
+
/* @__PURE__ */ jsxRuntime.jsx(TokenSymbol, { symbol, className: "w-4 h-4", alt: "token" })
|
|
3441
|
+
] }),
|
|
3442
|
+
isLoading
|
|
3440
3443
|
}
|
|
3441
3444
|
)
|
|
3442
3445
|
] })
|
|
3443
3446
|
] }) });
|
|
3444
3447
|
};
|
|
3445
|
-
const
|
|
3448
|
+
const DetailsRow = ({
|
|
3446
3449
|
label,
|
|
3447
3450
|
value,
|
|
3448
|
-
|
|
3449
|
-
className,
|
|
3450
|
-
isLoading = false,
|
|
3451
|
-
token
|
|
3451
|
+
isLoading = false
|
|
3452
3452
|
}) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center", children: [
|
|
3453
3453
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
3454
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-priority font-normal
|
|
3454
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-priority font-normal", children: label }),
|
|
3455
3455
|
/* @__PURE__ */ jsxRuntime.jsx(Tip, { text: label, children: /* @__PURE__ */ jsxRuntime.jsx(TipIcon, { className: "size-4 text-receive-icon" }) })
|
|
3456
3456
|
] }),
|
|
3457
|
-
|
|
3458
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3459
|
-
"p",
|
|
3460
|
-
{
|
|
3461
|
-
className: cn(
|
|
3462
|
-
"text-foreground text-sm font-display leading-[100%]",
|
|
3463
|
-
className
|
|
3464
|
-
),
|
|
3465
|
-
children: value ?? "—"
|
|
3466
|
-
}
|
|
3467
|
-
),
|
|
3468
|
-
token
|
|
3469
|
-
] }))
|
|
3457
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-4 w-16 rounded-md" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-foreground text-sm", children: value ?? "—" })
|
|
3470
3458
|
] });
|
|
3471
3459
|
const useTransactionStore = zustand.create((set, get) => ({
|
|
3472
3460
|
current: void 0,
|
|
@@ -4102,7 +4090,7 @@ const SubmitButton = () => {
|
|
|
4102
4090
|
}
|
|
4103
4091
|
};
|
|
4104
4092
|
const disabled = isBusy || amountNum <= 0 || status === "loading" || isBalanceLoading || hasInsufficientBalance || hasAmountTooLarge || !gas.hasEnoughGas || noRoute || !isValidForTransfer;
|
|
4105
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: handleClick, disabled, className: "w-full", children: label });
|
|
4093
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: handleClick, disabled, className: "w-full mt-4", children: label });
|
|
4106
4094
|
};
|
|
4107
4095
|
function short(addr) {
|
|
4108
4096
|
return addr.slice(0, 4) + "…" + addr.slice(-4);
|
|
@@ -8125,7 +8113,7 @@ const EvaaBridgeContent = ({
|
|
|
8125
8113
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8126
8114
|
SwapSection,
|
|
8127
8115
|
{
|
|
8128
|
-
className: "rounded-t-
|
|
8116
|
+
className: "rounded-t-xl",
|
|
8129
8117
|
label: t("bridge.sourceNetwork"),
|
|
8130
8118
|
balance: fromBalance,
|
|
8131
8119
|
chain: fromChain,
|
|
@@ -8160,7 +8148,7 @@ const EvaaBridgeContent = ({
|
|
|
8160
8148
|
),
|
|
8161
8149
|
/* @__PURE__ */ jsxRuntime.jsx(SubmitButton, {})
|
|
8162
8150
|
] }),
|
|
8163
|
-
/* @__PURE__ */ jsxRuntime.jsx(CardFooter, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8151
|
+
/* @__PURE__ */ jsxRuntime.jsx(CardFooter, { children: /* @__PURE__ */ jsxRuntime.jsx(Details, {}) })
|
|
8164
8152
|
]
|
|
8165
8153
|
}
|
|
8166
8154
|
),
|