@avail-project/widgets 0.0.1
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 +34 -0
- package/dist/common/components/ErrorBoundary.d.ts +44 -0
- package/dist/common/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/common/components/ErrorBoundary.js +65 -0
- package/dist/common/hooks/useDebouncedCallback.d.ts +13 -0
- package/dist/common/hooks/useDebouncedCallback.d.ts.map +1 -0
- package/dist/common/hooks/useDebouncedCallback.js +42 -0
- package/dist/common/hooks/useDebouncedValue.d.ts +5 -0
- package/dist/common/hooks/useDebouncedValue.d.ts.map +1 -0
- package/dist/common/hooks/useDebouncedValue.js +15 -0
- package/dist/common/hooks/useInterval.d.ts +11 -0
- package/dist/common/hooks/useInterval.d.ts.map +1 -0
- package/dist/common/hooks/useInterval.js +25 -0
- package/dist/common/hooks/useLatest.d.ts +12 -0
- package/dist/common/hooks/useLatest.d.ts.map +1 -0
- package/dist/common/hooks/useLatest.js +19 -0
- package/dist/common/hooks/useNexusError.d.ts +20 -0
- package/dist/common/hooks/useNexusError.d.ts.map +1 -0
- package/dist/common/hooks/useNexusError.js +120 -0
- package/dist/common/hooks/usePolling.d.ts +7 -0
- package/dist/common/hooks/usePolling.d.ts.map +1 -0
- package/dist/common/hooks/usePolling.js +29 -0
- package/dist/common/hooks/useStableCallback.d.ts +6 -0
- package/dist/common/hooks/useStableCallback.d.ts.map +1 -0
- package/dist/common/hooks/useStableCallback.js +13 -0
- package/dist/common/hooks/useStopwatch.d.ts +17 -0
- package/dist/common/hooks/useStopwatch.d.ts.map +1 -0
- package/dist/common/hooks/useStopwatch.js +44 -0
- package/dist/common/hooks/useTransactionExecution.d.ts +62 -0
- package/dist/common/hooks/useTransactionExecution.d.ts.map +1 -0
- package/dist/common/hooks/useTransactionExecution.js +273 -0
- package/dist/common/hooks/useTransactionFlow.d.ts +71 -0
- package/dist/common/hooks/useTransactionFlow.d.ts.map +1 -0
- package/dist/common/hooks/useTransactionFlow.js +435 -0
- package/dist/common/index.d.ts +17 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +16 -0
- package/dist/common/tx/steps.d.ts +19 -0
- package/dist/common/tx/steps.d.ts.map +1 -0
- package/dist/common/tx/steps.js +89 -0
- package/dist/common/tx/types.d.ts +11 -0
- package/dist/common/tx/types.d.ts.map +1 -0
- package/dist/common/tx/types.js +19 -0
- package/dist/common/tx/useTransactionSteps.d.ts +21 -0
- package/dist/common/tx/useTransactionSteps.d.ts.map +1 -0
- package/dist/common/tx/useTransactionSteps.js +40 -0
- package/dist/common/types/transaction-flow.d.ts +48 -0
- package/dist/common/types/transaction-flow.d.ts.map +1 -0
- package/dist/common/types/transaction-flow.js +2 -0
- package/dist/common/utils/constant.d.ts +99 -0
- package/dist/common/utils/constant.d.ts.map +1 -0
- package/dist/common/utils/constant.js +370 -0
- package/dist/common/utils/token-pricing.d.ts +33 -0
- package/dist/common/utils/token-pricing.d.ts.map +1 -0
- package/dist/common/utils/token-pricing.js +255 -0
- package/dist/common/utils/transaction-flow.d.ts +35 -0
- package/dist/common/utils/transaction-flow.d.ts.map +1 -0
- package/dist/common/utils/transaction-flow.js +65 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/lib/utils.d.ts +4 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +8 -0
- package/dist/nexus/NexusProvider.d.ts +50 -0
- package/dist/nexus/NexusProvider.d.ts.map +1 -0
- package/dist/nexus/NexusProvider.js +572 -0
- package/dist/nexus-widget/components/address-identicon.d.ts +5 -0
- package/dist/nexus-widget/components/address-identicon.d.ts.map +1 -0
- package/dist/nexus-widget/components/address-identicon.js +39 -0
- package/dist/nexus-widget/components/amount-input-unified.d.ts +18 -0
- package/dist/nexus-widget/components/amount-input-unified.d.ts.map +1 -0
- package/dist/nexus-widget/components/amount-input-unified.js +88 -0
- package/dist/nexus-widget/components/deposit-idle-form.d.ts +29 -0
- package/dist/nexus-widget/components/deposit-idle-form.d.ts.map +1 -0
- package/dist/nexus-widget/components/deposit-idle-form.js +506 -0
- package/dist/nexus-widget/components/nexus-widget-progress-screen.d.ts +36 -0
- package/dist/nexus-widget/components/nexus-widget-progress-screen.d.ts.map +1 -0
- package/dist/nexus-widget/components/nexus-widget-progress-screen.js +737 -0
- package/dist/nexus-widget/components/pay-using-selector.d.ts +9 -0
- package/dist/nexus-widget/components/pay-using-selector.d.ts.map +1 -0
- package/dist/nexus-widget/components/pay-using-selector.js +37 -0
- package/dist/nexus-widget/components/pay-with-sources.d.ts +11 -0
- package/dist/nexus-widget/components/pay-with-sources.d.ts.map +1 -0
- package/dist/nexus-widget/components/pay-with-sources.js +266 -0
- package/dist/nexus-widget/components/receive-asset-selector.d.ts +28 -0
- package/dist/nexus-widget/components/receive-asset-selector.d.ts.map +1 -0
- package/dist/nexus-widget/components/receive-asset-selector.js +1178 -0
- package/dist/nexus-widget/components/recipient-input.d.ts +10 -0
- package/dist/nexus-widget/components/recipient-input.d.ts.map +1 -0
- package/dist/nexus-widget/components/recipient-input.js +44 -0
- package/dist/nexus-widget/components/send-idle-form.d.ts +29 -0
- package/dist/nexus-widget/components/send-idle-form.d.ts.map +1 -0
- package/dist/nexus-widget/components/send-idle-form.js +548 -0
- package/dist/nexus-widget/components/status-alerts.d.ts +7 -0
- package/dist/nexus-widget/components/status-alerts.d.ts.map +1 -0
- package/dist/nexus-widget/components/status-alerts.js +17 -0
- package/dist/nexus-widget/components/swap-asset-selector.d.ts +74 -0
- package/dist/nexus-widget/components/swap-asset-selector.d.ts.map +1 -0
- package/dist/nexus-widget/components/swap-asset-selector.js +1910 -0
- package/dist/nexus-widget/components/swap-idle-form.d.ts +29 -0
- package/dist/nexus-widget/components/swap-idle-form.d.ts.map +1 -0
- package/dist/nexus-widget/components/swap-idle-form.js +1289 -0
- package/dist/nexus-widget/components/swap-intent-preview.d.ts +95 -0
- package/dist/nexus-widget/components/swap-intent-preview.d.ts.map +1 -0
- package/dist/nexus-widget/components/swap-intent-preview.js +1050 -0
- package/dist/nexus-widget/nexus-widget.d.ts +4 -0
- package/dist/nexus-widget/nexus-widget.d.ts.map +1 -0
- package/dist/nexus-widget/nexus-widget.js +7819 -0
- package/dist/nexus-widget/sdk-types.d.ts +13 -0
- package/dist/nexus-widget/sdk-types.d.ts.map +1 -0
- package/dist/nexus-widget/sdk-types.js +1 -0
- package/dist/nexus-widget/theme.d.ts +156 -0
- package/dist/nexus-widget/theme.d.ts.map +1 -0
- package/dist/nexus-widget/theme.js +159 -0
- package/dist/nexus-widget/types.d.ts +141 -0
- package/dist/nexus-widget/types.d.ts.map +1 -0
- package/dist/nexus-widget/types.js +1 -0
- package/dist/nexus-widget/utils/citrea-tokens.d.ts +82 -0
- package/dist/nexus-widget/utils/citrea-tokens.d.ts.map +1 -0
- package/dist/nexus-widget/utils/citrea-tokens.js +136 -0
- package/dist/nexus-widget/utils/deposit-source-selection.d.ts +55 -0
- package/dist/nexus-widget/utils/deposit-source-selection.d.ts.map +1 -0
- package/dist/nexus-widget/utils/deposit-source-selection.js +219 -0
- package/dist/swaps/components/stacked-token-icons.d.ts +15 -0
- package/dist/swaps/components/stacked-token-icons.d.ts.map +1 -0
- package/dist/swaps/components/stacked-token-icons.js +38 -0
- package/dist/swaps/components/step-flow.d.ts +32 -0
- package/dist/swaps/components/step-flow.d.ts.map +1 -0
- package/dist/swaps/components/step-flow.js +54 -0
- package/dist/swaps/components/token-icon.d.ts +11 -0
- package/dist/swaps/components/token-icon.d.ts.map +1 -0
- package/dist/swaps/components/token-icon.js +16 -0
- package/dist/swaps/components/transaction-progress.d.ts +43 -0
- package/dist/swaps/components/transaction-progress.d.ts.map +1 -0
- package/dist/swaps/components/transaction-progress.js +94 -0
- package/dist/ui/button.d.ts +11 -0
- package/dist/ui/button.d.ts.map +1 -0
- package/dist/ui/button.js +34 -0
- package/dist/ui/dialog.d.ts +17 -0
- package/dist/ui/dialog.d.ts.map +1 -0
- package/dist/ui/dialog.js +47 -0
- package/package.json +60 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface PayUsingSelectorProps {
|
|
2
|
+
disabled?: boolean;
|
|
3
|
+
hasSources?: boolean;
|
|
4
|
+
label?: string;
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
sublabel?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function PayUsingSelector({ label, sublabel, onClick, disabled, hasSources, }: PayUsingSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=pay-using-selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pay-using-selector.d.ts","sourceRoot":"","sources":["../../../.build-src/nexus-widget/components/pay-using-selector.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAqB,EACrB,QAA0C,EAC1C,OAAO,EACP,QAAgB,EAChB,UAAkB,GACnB,EAAE,qBAAqB,2CA+FvB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
// biome-ignore-all lint: NexusWidget registry component from shadcn registry.
|
|
3
|
+
import { Pencil, Settings } from "lucide-react";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { nexusWidgetTheme } from "../theme";
|
|
6
|
+
export function PayUsingSelector({ label = "Paying with", sublabel = "Auto-selected based on amount", onClick, disabled = false, hasSources = false, }) {
|
|
7
|
+
const isInteractiveRow = !hasSources;
|
|
8
|
+
const content = (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center gap-x-2.5", children: [_jsx("div", { className: "flex items-center justify-center w-7 h-7 rounded-full shrink-0", style: {
|
|
9
|
+
background: "var(--background-tertiary, var(--background-tertiary, #F0F0EF))",
|
|
10
|
+
}, children: _jsx(Settings, { className: "w-3.5 h-3.5 text-gray-500" }) }), _jsxs("div", { className: "flex flex-col gap-y-0.5 text-left", children: [_jsx("span", { style: {
|
|
11
|
+
fontFamily: "var(--font-geist-sans), sans-serif",
|
|
12
|
+
fontWeight: 500,
|
|
13
|
+
fontSize: "13px",
|
|
14
|
+
color: "var(--foreground-primary, var(--foreground-primary, #161615))",
|
|
15
|
+
}, children: label }), _jsx("span", { style: {
|
|
16
|
+
fontFamily: "var(--font-geist-sans), sans-serif",
|
|
17
|
+
fontSize: "11px",
|
|
18
|
+
color: "var(--foreground-muted, var(--foreground-muted, #848483))",
|
|
19
|
+
}, children: sublabel })] })] }), !isInteractiveRow && (_jsxs("button", { className: "flex items-center gap-x-1 px-2 py-1 rounded hover:bg-black/5 transition-colors disabled:opacity-40 disabled:cursor-not-allowed", disabled: disabled, onClick: (e) => {
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
onClick?.();
|
|
22
|
+
}, style: {
|
|
23
|
+
fontFamily: "var(--font-geist-sans), sans-serif",
|
|
24
|
+
fontSize: "13px",
|
|
25
|
+
fontWeight: 500,
|
|
26
|
+
color: "var(--interactive-button-primary-background, var(--foreground-brand))",
|
|
27
|
+
}, children: [_jsx(Pencil, { className: "w-3 h-3" }), "Edit"] }))] }));
|
|
28
|
+
return (_jsx("div", { className: "w-full", children: isInteractiveRow ? (_jsx("button", { className: "w-full flex items-center justify-between px-3 py-2.5 disabled:opacity-50 disabled:cursor-not-allowed transition-all hover:bg-black/5", disabled: disabled, onClick: onClick, style: {
|
|
29
|
+
background: "var(--background-secondary, #F5F5F4)",
|
|
30
|
+
borderRadius: "10px",
|
|
31
|
+
border: "1px solid var(--border-default, var(--border-default, #E8E8E7))",
|
|
32
|
+
}, children: content })) : (_jsx("div", { className: "w-full flex items-center justify-between px-3 py-2.5", style: {
|
|
33
|
+
background: "var(--background-secondary, #F5F5F4)",
|
|
34
|
+
borderRadius: "10px",
|
|
35
|
+
border: "1px solid var(--border-default, var(--border-default, #E8E8E7))",
|
|
36
|
+
}, children: content })) }));
|
|
37
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type SwapTokenOption } from "./swap-asset-selector";
|
|
2
|
+
export declare function PayWithSources({ fromTokens, onOpenSourcePicker, routeStatus, routeMessage, showAutoBadge, isSourcePickerDisabled, reserveSourceRows, }: {
|
|
3
|
+
fromTokens: SwapTokenOption[];
|
|
4
|
+
onOpenSourcePicker: () => void;
|
|
5
|
+
routeStatus?: "loading" | "insufficient";
|
|
6
|
+
routeMessage?: string;
|
|
7
|
+
showAutoBadge?: boolean;
|
|
8
|
+
isSourcePickerDisabled?: boolean;
|
|
9
|
+
reserveSourceRows?: boolean;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=pay-with-sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pay-with-sources.d.ts","sourceRoot":"","sources":["../../../.build-src/nexus-widget/components/pay-with-sources.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAqJ7D,wBAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,aAAoB,EACpB,sBAA8B,EAC9B,iBAAyB,GAC1B,EAAE;IACD,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,WAAW,CAAC,EAAE,SAAS,GAAG,cAAc,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,2CA6TA"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
// biome-ignore-all lint: NexusWidget registry component from shadcn registry.
|
|
3
|
+
import Decimal from "decimal.js";
|
|
4
|
+
import { AlertCircle, ChevronDown, Loader2 } from "lucide-react";
|
|
5
|
+
import React, { useRef, useState } from "react";
|
|
6
|
+
import {} from "./swap-asset-selector";
|
|
7
|
+
const uiFont = '"Geist", system-ui, sans-serif';
|
|
8
|
+
const primary = "#161615";
|
|
9
|
+
const muted = "#848483";
|
|
10
|
+
const border = "#E8E8E7";
|
|
11
|
+
const brand = "var(--foreground-brand)";
|
|
12
|
+
const parseDecimal = (value) => {
|
|
13
|
+
if (value === null || value === undefined || value === "")
|
|
14
|
+
return undefined;
|
|
15
|
+
if (Decimal.isDecimal(value))
|
|
16
|
+
return value;
|
|
17
|
+
const cleaned = String(value).replace(/[^0-9.-]/g, "");
|
|
18
|
+
if (!cleaned || cleaned === "-" || cleaned === "." || cleaned === "-.") {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const parsed = new Decimal(cleaned);
|
|
23
|
+
return parsed.isFinite() ? parsed : undefined;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const formatToken = (value) => {
|
|
30
|
+
const amount = parseDecimal(value) ?? new Decimal(0);
|
|
31
|
+
return amount.toDecimalPlaces(8).toFixed();
|
|
32
|
+
};
|
|
33
|
+
const formatUsd = (value) => {
|
|
34
|
+
const amount = parseDecimal(value) ?? new Decimal(0);
|
|
35
|
+
if (amount.gt(0) && amount.lt(0.01))
|
|
36
|
+
return "<$0.01";
|
|
37
|
+
return `$${amount.toDecimalPlaces(2).toFixed()}`;
|
|
38
|
+
};
|
|
39
|
+
function TokenLogo({ src, label, size = 30, fontSize = 12, style, }) {
|
|
40
|
+
const [failed, setFailed] = useState(!src);
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
setFailed(!src);
|
|
43
|
+
}, [src]);
|
|
44
|
+
if (!failed && src) {
|
|
45
|
+
return (_jsx("img", { alt: label || "", onError: () => setFailed(true), src: src, style: {
|
|
46
|
+
backgroundColor: "#FFFFFE",
|
|
47
|
+
borderRadius: "999px",
|
|
48
|
+
height: size,
|
|
49
|
+
objectFit: "cover",
|
|
50
|
+
width: size,
|
|
51
|
+
...style,
|
|
52
|
+
} }));
|
|
53
|
+
}
|
|
54
|
+
return (_jsx("div", { style: {
|
|
55
|
+
alignItems: "center",
|
|
56
|
+
backgroundColor: "#E8F0FF",
|
|
57
|
+
borderRadius: "999px",
|
|
58
|
+
color: brand,
|
|
59
|
+
display: "flex",
|
|
60
|
+
fontFamily: uiFont,
|
|
61
|
+
fontSize,
|
|
62
|
+
fontWeight: 700,
|
|
63
|
+
height: size,
|
|
64
|
+
justifyContent: "center",
|
|
65
|
+
width: size,
|
|
66
|
+
...style,
|
|
67
|
+
}, children: (label || "?").slice(0, 1).toUpperCase() }));
|
|
68
|
+
}
|
|
69
|
+
function SourceLogoPair({ token }) {
|
|
70
|
+
return (_jsxs("div", { style: { flexShrink: 0, height: 40, position: "relative", width: 40 }, children: [_jsx(TokenLogo, { label: token.symbol, size: 40, src: token.logo }), token.chainLogo && (_jsx(TokenLogo, { label: token.chainName, size: 16, src: token.chainLogo, style: {
|
|
71
|
+
bottom: -1,
|
|
72
|
+
outline: "1.5px solid #FFFFFE",
|
|
73
|
+
position: "absolute",
|
|
74
|
+
right: -1,
|
|
75
|
+
} }))] }));
|
|
76
|
+
}
|
|
77
|
+
function SkeletonRow() {
|
|
78
|
+
return (_jsxs("div", { style: {
|
|
79
|
+
alignItems: "center",
|
|
80
|
+
display: "flex",
|
|
81
|
+
justifyContent: "space-between",
|
|
82
|
+
}, children: [_jsx("div", { className: "animate-pulse", style: {
|
|
83
|
+
background: "linear-gradient(90deg, #F0F0EF 0%, #F7F7F6 48%, #F0F0EF 100%)",
|
|
84
|
+
backgroundSize: "200% 100%",
|
|
85
|
+
borderRadius: "6px",
|
|
86
|
+
height: "32px",
|
|
87
|
+
width: "128px",
|
|
88
|
+
} }), _jsx("div", { className: "animate-pulse", style: {
|
|
89
|
+
background: "linear-gradient(90deg, #F0F0EF 0%, #F7F7F6 48%, #F0F0EF 100%)",
|
|
90
|
+
backgroundSize: "200% 100%",
|
|
91
|
+
borderRadius: "999px",
|
|
92
|
+
height: "32px",
|
|
93
|
+
width: "108px",
|
|
94
|
+
} })] }));
|
|
95
|
+
}
|
|
96
|
+
export function PayWithSources({ fromTokens, onOpenSourcePicker, routeStatus, routeMessage, showAutoBadge = true, isSourcePickerDisabled = false, reserveSourceRows = false, }) {
|
|
97
|
+
const scrollRef = useRef(null);
|
|
98
|
+
const isRouteLoading = routeStatus === "loading";
|
|
99
|
+
const shouldShowSourceSummary = !isRouteLoading && fromTokens.length > 0;
|
|
100
|
+
const shouldScroll = shouldShowSourceSummary && fromTokens.length > 3;
|
|
101
|
+
const autoBadge = (_jsx("span", { style: {
|
|
102
|
+
border: `1px solid ${brand}`,
|
|
103
|
+
borderRadius: "999px",
|
|
104
|
+
color: brand,
|
|
105
|
+
fontFamily: uiFont,
|
|
106
|
+
fontSize: "9px",
|
|
107
|
+
fontWeight: 600,
|
|
108
|
+
letterSpacing: "0.04em",
|
|
109
|
+
lineHeight: "14px",
|
|
110
|
+
padding: "1px 5px",
|
|
111
|
+
}, children: "AUTO" }));
|
|
112
|
+
return (_jsxs("div", { style: {
|
|
113
|
+
backgroundColor: "#FFFFFE",
|
|
114
|
+
border: `1px solid ${border}`,
|
|
115
|
+
borderRadius: "14px",
|
|
116
|
+
boxShadow: "#1616150A 0px 1px 2px",
|
|
117
|
+
boxSizing: "border-box",
|
|
118
|
+
display: "flex",
|
|
119
|
+
flexDirection: "column",
|
|
120
|
+
gap: "14px",
|
|
121
|
+
padding: "16px",
|
|
122
|
+
}, children: [_jsxs("div", { style: {
|
|
123
|
+
alignItems: "center",
|
|
124
|
+
display: "flex",
|
|
125
|
+
justifyContent: "space-between",
|
|
126
|
+
}, children: [_jsxs("div", { style: {
|
|
127
|
+
alignItems: "center",
|
|
128
|
+
color: muted,
|
|
129
|
+
display: "flex",
|
|
130
|
+
fontFamily: uiFont,
|
|
131
|
+
fontSize: "12px",
|
|
132
|
+
fontWeight: 500,
|
|
133
|
+
gap: "6px",
|
|
134
|
+
letterSpacing: "0.08em",
|
|
135
|
+
lineHeight: "20px",
|
|
136
|
+
textTransform: "uppercase",
|
|
137
|
+
}, children: [_jsxs("span", { children: ["Pay With", shouldShowSourceSummary ? ` · ${fromTokens.length} assets` : ""] }), showAutoBadge ? autoBadge : null] }), shouldShowSourceSummary && (_jsx("button", { disabled: isSourcePickerDisabled, onClick: onOpenSourcePicker, style: {
|
|
138
|
+
backgroundColor: isSourcePickerDisabled ? "#F4F4F3" : "#E8F0FF",
|
|
139
|
+
border: "none",
|
|
140
|
+
borderRadius: "4px",
|
|
141
|
+
color: isSourcePickerDisabled ? "#A8A8A6" : brand,
|
|
142
|
+
cursor: isSourcePickerDisabled ? "not-allowed" : "pointer",
|
|
143
|
+
fontFamily: uiFont,
|
|
144
|
+
fontSize: "12px",
|
|
145
|
+
fontWeight: 500,
|
|
146
|
+
lineHeight: "20px",
|
|
147
|
+
opacity: isSourcePickerDisabled ? 0.75 : 1,
|
|
148
|
+
padding: "8px 12px",
|
|
149
|
+
}, type: "button", children: "Edit tokens" }))] }), isRouteLoading ? (_jsxs(_Fragment, { children: [_jsx(SkeletonRow, {}), _jsxs("div", { style: {
|
|
150
|
+
alignItems: "center",
|
|
151
|
+
color: brand,
|
|
152
|
+
display: "flex",
|
|
153
|
+
fontFamily: uiFont,
|
|
154
|
+
fontSize: "14px",
|
|
155
|
+
gap: "6px",
|
|
156
|
+
lineHeight: "20px",
|
|
157
|
+
}, children: [_jsx(Loader2, { className: "animate-spin", style: { height: 14, width: 14 } }), "Calculating best route..."] })] })) : shouldShowSourceSummary ? (_jsxs("div", { style: { position: "relative" }, children: [_jsx("div", { ref: scrollRef, style: {
|
|
158
|
+
display: "flex",
|
|
159
|
+
flexDirection: "column",
|
|
160
|
+
gap: shouldShowSourceSummary ? "14px" : undefined,
|
|
161
|
+
maxHeight: shouldScroll ? "220px" : undefined,
|
|
162
|
+
minHeight: reserveSourceRows && !shouldScroll ? "162px" : undefined,
|
|
163
|
+
overflowY: shouldScroll ? "auto" : undefined,
|
|
164
|
+
paddingRight: shouldScroll ? "8px" : 0,
|
|
165
|
+
}, children: fromTokens.map((token, index) => (_jsxs("div", { style: {
|
|
166
|
+
alignItems: "center",
|
|
167
|
+
display: "flex",
|
|
168
|
+
gap: "14px",
|
|
169
|
+
justifyContent: "space-between",
|
|
170
|
+
minHeight: "44px",
|
|
171
|
+
}, children: [_jsxs("div", { style: {
|
|
172
|
+
alignItems: "center",
|
|
173
|
+
borderTop: index === 0 ? "none" : "1px solid #F0F0EF",
|
|
174
|
+
display: "flex",
|
|
175
|
+
gap: "14px",
|
|
176
|
+
minWidth: 0,
|
|
177
|
+
}, children: [_jsxs("div", { style: {
|
|
178
|
+
alignItems: "center",
|
|
179
|
+
display: "flex",
|
|
180
|
+
gap: "10px",
|
|
181
|
+
minWidth: 0,
|
|
182
|
+
}, children: [_jsx(SourceLogoPair, { token: token }), _jsxs("div", { style: {
|
|
183
|
+
display: "flex",
|
|
184
|
+
flexDirection: "column",
|
|
185
|
+
gap: "3px",
|
|
186
|
+
minWidth: 0,
|
|
187
|
+
}, children: [_jsx("span", { style: {
|
|
188
|
+
color: primary,
|
|
189
|
+
fontFamily: uiFont,
|
|
190
|
+
fontSize: "14px",
|
|
191
|
+
fontWeight: 600,
|
|
192
|
+
}, children: token.symbol }), _jsx("span", { style: {
|
|
193
|
+
color: muted,
|
|
194
|
+
fontFamily: uiFont,
|
|
195
|
+
fontSize: "12px",
|
|
196
|
+
overflow: "hidden",
|
|
197
|
+
textOverflow: "ellipsis",
|
|
198
|
+
whiteSpace: "nowrap",
|
|
199
|
+
}, children: token.isUnified
|
|
200
|
+
? "Unified balance"
|
|
201
|
+
: `on ${token.chainName || "Unknown chain"}` })] })] }), _jsxs("div", { style: {
|
|
202
|
+
display: "flex",
|
|
203
|
+
flexDirection: "column",
|
|
204
|
+
gap: "3px",
|
|
205
|
+
textAlign: "right",
|
|
206
|
+
}, children: [_jsxs("span", { style: {
|
|
207
|
+
color: primary,
|
|
208
|
+
fontFamily: uiFont,
|
|
209
|
+
fontSize: "16px",
|
|
210
|
+
fontWeight: 500,
|
|
211
|
+
lineHeight: "24px",
|
|
212
|
+
}, children: [formatToken(token.userAmount || token.balance), " ", token.symbol] }), _jsx("span", { style: {
|
|
213
|
+
color: muted,
|
|
214
|
+
fontFamily: uiFont,
|
|
215
|
+
fontSize: "14px",
|
|
216
|
+
lineHeight: "20px",
|
|
217
|
+
overflow: "hidden",
|
|
218
|
+
textOverflow: "ellipsis",
|
|
219
|
+
whiteSpace: "nowrap",
|
|
220
|
+
}, children: formatUsd(token.userAmountUsd || token.balanceInFiat) })] })] }, `${token.contractAddress}-${token.chainId ?? "unified"}-${index}`), _jsxs("div", { style: {
|
|
221
|
+
display: "flex",
|
|
222
|
+
flexDirection: "column",
|
|
223
|
+
gap: "3px",
|
|
224
|
+
textAlign: "right",
|
|
225
|
+
}, children: [_jsxs("span", { style: {
|
|
226
|
+
color: primary,
|
|
227
|
+
fontFamily: uiFont,
|
|
228
|
+
fontSize: "16px",
|
|
229
|
+
fontWeight: 500,
|
|
230
|
+
lineHeight: "20px",
|
|
231
|
+
}, children: [formatToken(token.userAmount || token.balance), " ", token.symbol] }), _jsx("span", { style: {
|
|
232
|
+
color: muted,
|
|
233
|
+
fontFamily: uiFont,
|
|
234
|
+
fontSize: "14px",
|
|
235
|
+
lineHeight: "20px",
|
|
236
|
+
}, children: formatUsd(token.userAmountUsd || token.balanceInFiat) })] })] }, `${token.contractAddress}-${token.chainId ?? "unified"}-${index}`))) }), shouldScroll && (_jsx("button", { "aria-label": "Scroll payment sources", onClick: () => scrollRef.current?.scrollBy({ behavior: "smooth", top: 64 }), style: {
|
|
237
|
+
alignItems: "center",
|
|
238
|
+
background: "#FFFFFE",
|
|
239
|
+
border: `1px solid ${border}`,
|
|
240
|
+
borderRadius: "999px",
|
|
241
|
+
bottom: "4px",
|
|
242
|
+
boxShadow: "0 2px 8px rgba(22,22,21,0.08)",
|
|
243
|
+
cursor: "pointer",
|
|
244
|
+
display: "flex",
|
|
245
|
+
height: "22px",
|
|
246
|
+
justifyContent: "center",
|
|
247
|
+
left: "50%",
|
|
248
|
+
padding: 0,
|
|
249
|
+
position: "absolute",
|
|
250
|
+
transform: "translateX(-50%)",
|
|
251
|
+
width: "22px",
|
|
252
|
+
}, type: "button", children: _jsx(ChevronDown, { style: { color: muted, height: 14, width: 14 } }) }))] })) : (_jsx("div", { style: {
|
|
253
|
+
color: primary,
|
|
254
|
+
fontFamily: uiFont,
|
|
255
|
+
fontSize: "14px",
|
|
256
|
+
lineHeight: "20px",
|
|
257
|
+
}, children: "Sources will be auto selected" })), routeStatus === "insufficient" && routeMessage && (_jsxs("div", { style: {
|
|
258
|
+
alignItems: "center",
|
|
259
|
+
color: "#D32F2F",
|
|
260
|
+
display: "flex",
|
|
261
|
+
fontFamily: uiFont,
|
|
262
|
+
fontSize: "14px",
|
|
263
|
+
gap: "8px",
|
|
264
|
+
lineHeight: "20px",
|
|
265
|
+
}, children: [_jsx(AlertCircle, { style: { flexShrink: 0, height: 15, width: 15 } }), routeMessage] }))] }));
|
|
266
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type SwapTokenOption } from "./swap-asset-selector";
|
|
2
|
+
interface ReceiveAssetSelectorProps {
|
|
3
|
+
allowedChainIds?: number[];
|
|
4
|
+
allowedPairs?: {
|
|
5
|
+
chain: number;
|
|
6
|
+
token: string;
|
|
7
|
+
}[];
|
|
8
|
+
additionalTokens?: SwapTokenOption[];
|
|
9
|
+
onBack: () => void;
|
|
10
|
+
onSelect: (token: SwapTokenOption) => void;
|
|
11
|
+
}
|
|
12
|
+
type RawReceiveToken = {
|
|
13
|
+
address?: string;
|
|
14
|
+
decimals?: number;
|
|
15
|
+
logoURI?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
priceUSD?: number | string;
|
|
18
|
+
symbol?: string;
|
|
19
|
+
};
|
|
20
|
+
type RawReceiveTokensData = {
|
|
21
|
+
stableSymbols: string[];
|
|
22
|
+
tokens: Record<string, RawReceiveToken[]>;
|
|
23
|
+
};
|
|
24
|
+
export declare const getCachedReceiveTokenMatch: (token?: SwapTokenOption | null) => SwapTokenOption | null;
|
|
25
|
+
export declare const preloadReceiveTokens: () => Promise<RawReceiveTokensData> | null;
|
|
26
|
+
export declare function ReceiveAssetSelector({ allowedChainIds, allowedPairs, additionalTokens, onSelect, onBack, }: ReceiveAssetSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=receive-asset-selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receive-asset-selector.d.ts","sourceRoot":"","sources":["../../../.build-src/nexus-widget/components/receive-asset-selector.tsx"],"names":[],"mappings":"AA4BA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,uBAAuB,CAAC;AAE/B,UAAU,yBAAyB;IACjC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE;QACb,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IACJ,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;CAC5C;AA4HD,KAAK,eAAe,GAAG;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;CAC3C,CAAC;AAyDF,eAAO,MAAM,0BAA0B,GACrC,QAAQ,eAAe,GAAG,IAAI,KAC7B,eAAe,GAAG,IA0BpB,CAAC;AAEF,eAAO,MAAM,oBAAoB,4CAiIhC,CAAC;AAYF,wBAAgB,oBAAoB,CAAC,EACnC,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,MAAM,GACP,EAAE,yBAAyB,2CAq5C3B"}
|