@fluent.xyz/connect 0.4.1 → 0.4.2
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/fluent-connect.css +1 -1
- package/dist/index.d.ts +59 -2
- package/dist/index.js +759 -195
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import { clsx } from 'clsx';
|
|
|
18
18
|
import { twMerge } from 'tailwind-merge';
|
|
19
19
|
import { Button as Button$1 } from '@base-ui/react/button';
|
|
20
20
|
import { cva } from 'class-variance-authority';
|
|
21
|
-
import { XIcon, RefreshCw, ChevronLeft, ExternalLink, Copy, Settings, LogOut, Loader2, ChevronDownIcon, CheckIcon, AlertTriangle, Layers, Trash2, Plus, Loader2Icon, ChevronUpIcon, CircleHelp,
|
|
21
|
+
import { XIcon, RefreshCw, X, ChevronLeft, ExternalLink, Copy, Settings, LogOut, Loader2, ChevronDownIcon, CheckIcon, AlertTriangle, Layers, Trash2, Plus, Loader2Icon, ChevronUpIcon, CircleHelp, Wallet, ChevronRight, Check, LogIn, Send, RotateCw, KeyRound, Mail, CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon } from 'lucide-react';
|
|
22
22
|
import { WagmiAdapter } from '@reown/appkit-adapter-wagmi';
|
|
23
23
|
import { createAppKit, useAppKit } from '@reown/appkit/react';
|
|
24
24
|
import { QueryClient, QueryClientContext, QueryClientProvider, useInfiniteQuery, useQuery } from '@tanstack/react-query';
|
|
@@ -6792,6 +6792,35 @@ function encodeBatchCall(call) {
|
|
|
6792
6792
|
};
|
|
6793
6793
|
}
|
|
6794
6794
|
var FLUENT_SEND_TOKEN_OP_ID = "fluent-send-token";
|
|
6795
|
+
function attachFluentPendingTransfers(entries, transfers) {
|
|
6796
|
+
const settled = /* @__PURE__ */ new Map();
|
|
6797
|
+
for (const transfer of transfers) {
|
|
6798
|
+
if (transfer.hash) settled.set(transfer.hash.toLowerCase(), transfer);
|
|
6799
|
+
}
|
|
6800
|
+
if (settled.size === 0) return entries;
|
|
6801
|
+
return entries.map((entry) => {
|
|
6802
|
+
if (entry.kind !== "operation" || entry.movements.length > 0) return entry;
|
|
6803
|
+
const transfer = settled.get(entry.hash.toLowerCase()) ?? settled.get(entry.transactionHash.toLowerCase());
|
|
6804
|
+
if (!transfer) return entry;
|
|
6805
|
+
return {
|
|
6806
|
+
...entry,
|
|
6807
|
+
movements: [
|
|
6808
|
+
{
|
|
6809
|
+
kind: "movement",
|
|
6810
|
+
id: `${entry.id}:${transfer.id}`,
|
|
6811
|
+
status: entry.status,
|
|
6812
|
+
timestamp: entry.timestamp,
|
|
6813
|
+
hash: entry.transactionHash,
|
|
6814
|
+
direction: "sent",
|
|
6815
|
+
tokenIdentity: transfer.tokenIdentity,
|
|
6816
|
+
symbol: transfer.symbol,
|
|
6817
|
+
amount: transfer.amount,
|
|
6818
|
+
counterparty: transfer.to
|
|
6819
|
+
}
|
|
6820
|
+
]
|
|
6821
|
+
};
|
|
6822
|
+
});
|
|
6823
|
+
}
|
|
6795
6824
|
var AMOUNT_SHAPE = /^\d*(\.\d*)?$/;
|
|
6796
6825
|
var ADDRESS_SHAPE = /^0x[0-9a-fA-F]{40}$/;
|
|
6797
6826
|
var fluentTransferAbi = parseAbi([
|
|
@@ -6860,7 +6889,7 @@ function checkFluentTransferFee(params) {
|
|
|
6860
6889
|
const verdict = (message2, sponsorable) => mustPay ? { status: "blocked", message: message2 } : { status: "warning", message: sponsorable };
|
|
6861
6890
|
if (feeBalance === 0n) {
|
|
6862
6891
|
return verdict(
|
|
6863
|
-
`You have
|
|
6892
|
+
`You don't have enough ${symbol} to cover the fee. Select another token you hold.`,
|
|
6864
6893
|
`You have no ${symbol}. This will only go through if the app covers the fee.`
|
|
6865
6894
|
);
|
|
6866
6895
|
}
|
|
@@ -9092,7 +9121,7 @@ function useFluentIframeBridge(iframeRef, { allowedOrigin }) {
|
|
|
9092
9121
|
}
|
|
9093
9122
|
|
|
9094
9123
|
// package.json
|
|
9095
|
-
var version = "0.4.
|
|
9124
|
+
var version = "0.4.2";
|
|
9096
9125
|
|
|
9097
9126
|
// src/core/analytics.ts
|
|
9098
9127
|
var INSTANCE_NAME = "fluent";
|
|
@@ -9492,6 +9521,52 @@ function clearInlineOAuth() {
|
|
|
9492
9521
|
} catch {
|
|
9493
9522
|
}
|
|
9494
9523
|
}
|
|
9524
|
+
function connectDescription(appName) {
|
|
9525
|
+
return `Use Fluent Connect to access ${appName?.trim() || "this app"}.`;
|
|
9526
|
+
}
|
|
9527
|
+
var privacyPolicyUrl = "https://cdn.prod.website-files.com/67ae0a445cb83ac7024dc85a/69bd38dc078b1bd9bb296af3_Fluent%20Foundation%20-%20Privacy%20Policy%20%5BDRAFT%5D.docx.pdf";
|
|
9528
|
+
function FluentBranch({
|
|
9529
|
+
children,
|
|
9530
|
+
className
|
|
9531
|
+
}) {
|
|
9532
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-2", className), children: [
|
|
9533
|
+
children,
|
|
9534
|
+
/* @__PURE__ */ jsxs("p", { className: "px-2.5 text-center text-[10px] leading-snug text-white/50", children: [
|
|
9535
|
+
"Gasless transactions and quick sign.",
|
|
9536
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
9537
|
+
"By continuing, you accept our",
|
|
9538
|
+
" ",
|
|
9539
|
+
/* @__PURE__ */ jsx(
|
|
9540
|
+
"a",
|
|
9541
|
+
{
|
|
9542
|
+
href: privacyPolicyUrl,
|
|
9543
|
+
target: "_blank",
|
|
9544
|
+
rel: "noopener noreferrer",
|
|
9545
|
+
className: "whitespace-nowrap text-white/70 underline underline-offset-2 hover:text-white",
|
|
9546
|
+
children: "Privacy Policy"
|
|
9547
|
+
}
|
|
9548
|
+
),
|
|
9549
|
+
"."
|
|
9550
|
+
] })
|
|
9551
|
+
] });
|
|
9552
|
+
}
|
|
9553
|
+
function OrDivider() {
|
|
9554
|
+
return /* @__PURE__ */ jsxs(
|
|
9555
|
+
"div",
|
|
9556
|
+
{
|
|
9557
|
+
className: "flex items-center gap-3 px-1 py-2 text-[11px] font-medium uppercase tracking-wide text-white/40",
|
|
9558
|
+
"aria-hidden": true,
|
|
9559
|
+
children: [
|
|
9560
|
+
/* @__PURE__ */ jsx("span", { className: "h-px flex-1 bg-white/10" }),
|
|
9561
|
+
"or",
|
|
9562
|
+
/* @__PURE__ */ jsx("span", { className: "h-px flex-1 bg-white/10" })
|
|
9563
|
+
]
|
|
9564
|
+
}
|
|
9565
|
+
);
|
|
9566
|
+
}
|
|
9567
|
+
function WalletBranchNote() {
|
|
9568
|
+
return /* @__PURE__ */ jsx("p", { className: "px-2.5 text-center text-[10px] leading-snug text-white/50", children: "Existing wallet. Manual signing, gas fees may apply." });
|
|
9569
|
+
}
|
|
9495
9570
|
var icons = {
|
|
9496
9571
|
google: (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
9497
9572
|
/* @__PURE__ */ jsx("path", { fill: "#4285F4", d: "M21.6 12.23c0-.71-.06-1.39-.18-2.05H12v3.88h5.38a4.6 4.6 0 0 1-2 3.02v2.51h3.24c1.9-1.75 2.98-4.33 2.98-7.36Z" }),
|
|
@@ -9954,6 +10029,7 @@ function InlineConnectModal(props) {
|
|
|
9954
10029
|
icon: iconName,
|
|
9955
10030
|
primary = false,
|
|
9956
10031
|
link = false,
|
|
10032
|
+
trailing,
|
|
9957
10033
|
disabled = busy || !ready,
|
|
9958
10034
|
className,
|
|
9959
10035
|
...rest
|
|
@@ -9973,7 +10049,8 @@ function InlineConnectModal(props) {
|
|
|
9973
10049
|
...rest,
|
|
9974
10050
|
children: [
|
|
9975
10051
|
icon(iconName),
|
|
9976
|
-
label
|
|
10052
|
+
label,
|
|
10053
|
+
trailing
|
|
9977
10054
|
]
|
|
9978
10055
|
}
|
|
9979
10056
|
);
|
|
@@ -10045,7 +10122,7 @@ function InlineConnectModal(props) {
|
|
|
10045
10122
|
onRetry?.();
|
|
10046
10123
|
};
|
|
10047
10124
|
let title = "Sign in";
|
|
10048
|
-
let description =
|
|
10125
|
+
let description = connectDescription(config?.appName);
|
|
10049
10126
|
let content;
|
|
10050
10127
|
let headerIcon = null;
|
|
10051
10128
|
const authMethodButton = (method) => {
|
|
@@ -10082,62 +10159,79 @@ function InlineConnectModal(props) {
|
|
|
10082
10159
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Sign in" })
|
|
10083
10160
|
] });
|
|
10084
10161
|
content = /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10162
|
+
/* @__PURE__ */ jsxs(FluentBranch, { children: [
|
|
10163
|
+
button("Continue with X", () => oauth("twitter"), {
|
|
10164
|
+
icon: "x",
|
|
10165
|
+
primary: true
|
|
10166
|
+
}),
|
|
10167
|
+
authMethods.map((method) => /* @__PURE__ */ jsx(React.Fragment, { children: authMethodButton(method) }, method))
|
|
10168
|
+
] }),
|
|
10169
|
+
/* @__PURE__ */ jsx(OrDivider, {}),
|
|
10170
|
+
showWallets ? /* @__PURE__ */ jsxs(
|
|
10091
10171
|
"div",
|
|
10092
10172
|
{
|
|
10093
10173
|
className: "flex flex-col gap-2 animate-in fade-in-0 slide-in-from-bottom-1 duration-200 motion-reduce:animate-none",
|
|
10094
10174
|
ref: walletList,
|
|
10095
10175
|
role: "group",
|
|
10096
10176
|
"aria-label": "Other wallets",
|
|
10097
|
-
children:
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10177
|
+
children: [
|
|
10178
|
+
wallet?.choices?.length ? wallet.choices.map((choice) => /* @__PURE__ */ jsxs(
|
|
10179
|
+
"button",
|
|
10180
|
+
{
|
|
10181
|
+
type: "button",
|
|
10182
|
+
className: cn(
|
|
10183
|
+
buttonVariants({ variant: "secondary" }),
|
|
10184
|
+
"w-full"
|
|
10185
|
+
),
|
|
10186
|
+
disabled: busy,
|
|
10187
|
+
onClick: () => connectWallet(choice),
|
|
10188
|
+
children: [
|
|
10189
|
+
choice.icon ? /* @__PURE__ */ jsx(
|
|
10190
|
+
"img",
|
|
10191
|
+
{
|
|
10192
|
+
className: "size-4 shrink-0 rounded-sm object-contain",
|
|
10193
|
+
src: choice.icon,
|
|
10194
|
+
alt: ""
|
|
10195
|
+
}
|
|
10196
|
+
) : icon("wallet"),
|
|
10197
|
+
choice.name
|
|
10198
|
+
]
|
|
10199
|
+
},
|
|
10200
|
+
choice.id
|
|
10201
|
+
)) : /* @__PURE__ */ jsx("p", { className: "px-2.5 text-center text-sm text-muted-foreground", children: "No wallet connections available." }),
|
|
10202
|
+
/* @__PURE__ */ jsx(WalletBranchNote, {})
|
|
10203
|
+
]
|
|
10121
10204
|
}
|
|
10122
|
-
) : /* @__PURE__ */
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10205
|
+
) : /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
10206
|
+
button(
|
|
10207
|
+
"Other wallets",
|
|
10208
|
+
() => {
|
|
10209
|
+
if (!wallet?.connectChoice || !wallet.choices) {
|
|
10210
|
+
track("connect_method_selected", {
|
|
10211
|
+
method: "external"
|
|
10212
|
+
});
|
|
10213
|
+
onExternalWalletSelected();
|
|
10214
|
+
wallet?.open();
|
|
10215
|
+
close();
|
|
10216
|
+
return;
|
|
10217
|
+
}
|
|
10218
|
+
setShowWallets(true);
|
|
10219
|
+
},
|
|
10220
|
+
{
|
|
10221
|
+
icon: "wallet",
|
|
10222
|
+
disabled: busy || !wallet?.configured,
|
|
10223
|
+
className: "justify-start",
|
|
10224
|
+
trailing: /* @__PURE__ */ jsx(
|
|
10225
|
+
ChevronRight,
|
|
10226
|
+
{
|
|
10227
|
+
className: "ml-auto size-4 text-white/50",
|
|
10228
|
+
"aria-hidden": true
|
|
10229
|
+
}
|
|
10230
|
+
)
|
|
10133
10231
|
}
|
|
10134
|
-
|
|
10135
|
-
}
|
|
10136
|
-
|
|
10137
|
-
link: true,
|
|
10138
|
-
disabled: busy || !wallet?.configured
|
|
10139
|
-
}
|
|
10140
|
-
) })
|
|
10232
|
+
),
|
|
10233
|
+
/* @__PURE__ */ jsx(WalletBranchNote, {})
|
|
10234
|
+
] })
|
|
10141
10235
|
] });
|
|
10142
10236
|
} else if (screen === "wallet") {
|
|
10143
10237
|
title = `Connecting to ${walletChoice?.name ?? "wallet"}`;
|
|
@@ -10399,10 +10493,10 @@ function HostedConnectChoiceModal({
|
|
|
10399
10493
|
/* @__PURE__ */ jsxs("div", { className: "z-20", children: [
|
|
10400
10494
|
/* @__PURE__ */ jsxs(DialogHeader, { className: "items-center text-center pt-5 pb-3 px-4", children: [
|
|
10401
10495
|
/* @__PURE__ */ jsx(DialogTitle, { children: "Connect Wallet" }),
|
|
10402
|
-
/* @__PURE__ */ jsx(DialogDescription, { children:
|
|
10496
|
+
/* @__PURE__ */ jsx(DialogDescription, { children: connectDescription(config?.appName) })
|
|
10403
10497
|
] }),
|
|
10404
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col p-2.5", children: [
|
|
10405
|
-
/* @__PURE__ */ jsx(
|
|
10498
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 p-2.5", children: [
|
|
10499
|
+
/* @__PURE__ */ jsx(FluentBranch, { children: /* @__PURE__ */ jsxs(
|
|
10406
10500
|
Button,
|
|
10407
10501
|
{
|
|
10408
10502
|
href: directAuth ? void 0 : fluentAuthorizeUrl,
|
|
@@ -10424,19 +10518,28 @@ function HostedConnectChoiceModal({
|
|
|
10424
10518
|
]
|
|
10425
10519
|
}
|
|
10426
10520
|
) }),
|
|
10427
|
-
/* @__PURE__ */ jsx(
|
|
10521
|
+
/* @__PURE__ */ jsx(OrDivider, {}),
|
|
10522
|
+
/* @__PURE__ */ jsxs(
|
|
10428
10523
|
Button,
|
|
10429
10524
|
{
|
|
10430
|
-
variant: "
|
|
10525
|
+
variant: "secondary",
|
|
10431
10526
|
disabled: !wallet?.configured,
|
|
10432
10527
|
onClick: openWallet,
|
|
10433
|
-
className: "
|
|
10528
|
+
className: "w-full justify-start",
|
|
10434
10529
|
children: [
|
|
10435
10530
|
/* @__PURE__ */ jsx(Wallet, { className: "size-4 shrink-0", "aria-hidden": true }),
|
|
10436
|
-
"Other wallets"
|
|
10531
|
+
"Other wallets",
|
|
10532
|
+
/* @__PURE__ */ jsx(
|
|
10533
|
+
ChevronRight,
|
|
10534
|
+
{
|
|
10535
|
+
className: "ml-auto size-4 text-white/50",
|
|
10536
|
+
"aria-hidden": true
|
|
10537
|
+
}
|
|
10538
|
+
)
|
|
10437
10539
|
]
|
|
10438
10540
|
}
|
|
10439
|
-
)
|
|
10541
|
+
),
|
|
10542
|
+
/* @__PURE__ */ jsx(WalletBranchNote, {}),
|
|
10440
10543
|
!wallet?.configured ? /* @__PURE__ */ jsx("p", { className: "px-2.5 text-xs text-[#ff8fda]", children: "WalletConnect bridge is unavailable." }) : null,
|
|
10441
10544
|
hostedError ? /* @__PURE__ */ jsx("p", { className: "px-2.5 text-xs text-[#ff8fda]", children: hostedError }) : null
|
|
10442
10545
|
] })
|
|
@@ -10627,9 +10730,14 @@ var CHAIN_BADGE = {
|
|
|
10627
10730
|
l1_to_l2: { icon: "eth", iconClassName: "text-white", bgClassName: "bg-[#627EEA]" },
|
|
10628
10731
|
l2_to_l1: { icon: "fluent", iconClassName: "text-foreground", bgClassName: "bg-muted" }
|
|
10629
10732
|
};
|
|
10733
|
+
var RING_BY_SURFACE = {
|
|
10734
|
+
page: "ring-background",
|
|
10735
|
+
row: "ring-[color-mix(in_oklab,var(--color-white)_5%,var(--background))] group-hover:ring-[color-mix(in_oklab,var(--color-white)_10%,var(--background))]"
|
|
10736
|
+
};
|
|
10630
10737
|
function ActivityTokenTile({
|
|
10631
10738
|
tokenSymbol,
|
|
10632
10739
|
badge: badgeKey,
|
|
10740
|
+
surface = "page",
|
|
10633
10741
|
className = "size-10"
|
|
10634
10742
|
}) {
|
|
10635
10743
|
const visual = tokenSymbol ? VISUAL_BY_DEFAULT_SYMBOL[tokenSymbol] : void 0;
|
|
@@ -10643,7 +10751,7 @@ function ActivityTokenTile({
|
|
|
10643
10751
|
/* @__PURE__ */ jsx(
|
|
10644
10752
|
"span",
|
|
10645
10753
|
{
|
|
10646
|
-
className: `absolute -right-0.5 -bottom-0.5 flex size-4 items-center justify-center rounded-full ring-4
|
|
10754
|
+
className: `absolute -right-0.5 -bottom-0.5 flex size-4 items-center justify-center rounded-full ring-4 ${RING_BY_SURFACE[surface]} ${badge.bgClassName}`,
|
|
10647
10755
|
children: /* @__PURE__ */ jsx(Icon, { name: badge.icon, className: `size-2.5 ${badge.iconClassName}` })
|
|
10648
10756
|
}
|
|
10649
10757
|
)
|
|
@@ -10724,6 +10832,7 @@ function formatRowAmount(row) {
|
|
|
10724
10832
|
function HistoryRow({
|
|
10725
10833
|
row,
|
|
10726
10834
|
tag,
|
|
10835
|
+
usd,
|
|
10727
10836
|
onOpen
|
|
10728
10837
|
}) {
|
|
10729
10838
|
STATUS_LABELS[row.status];
|
|
@@ -10733,10 +10842,10 @@ function HistoryRow({
|
|
|
10733
10842
|
{
|
|
10734
10843
|
type: "button",
|
|
10735
10844
|
onClick: onOpen,
|
|
10736
|
-
className: "group flex w-full items-center gap-3 p-2.5 rounded-xl text-left hover:bg-
|
|
10845
|
+
className: "group flex w-full items-center gap-3 p-2.5 rounded-xl text-left hover:bg-white/10",
|
|
10737
10846
|
children: [
|
|
10738
|
-
/* @__PURE__ */ jsx(ActivityTokenTile, { tokenSymbol: row.tokenSymbol, badge: row.direction }),
|
|
10739
|
-
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-
|
|
10847
|
+
/* @__PURE__ */ jsx(ActivityTokenTile, { tokenSymbol: row.tokenSymbol, badge: row.direction, surface: "row" }),
|
|
10848
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
10740
10849
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-sm font-medium leading-4", children: [
|
|
10741
10850
|
rowTitle(row),
|
|
10742
10851
|
tag ? /* @__PURE__ */ jsx(AccountTag, { children: tag }) : null
|
|
@@ -10748,7 +10857,16 @@ function HistoryRow({
|
|
|
10748
10857
|
/* @__PURE__ */ jsx("span", { className: "leading-4", children: formatAddress(row.sentTxHash) })
|
|
10749
10858
|
] })
|
|
10750
10859
|
] }),
|
|
10751
|
-
/* @__PURE__ */
|
|
10860
|
+
/* @__PURE__ */ jsxs("span", { className: "flex shrink-0 flex-col items-end gap-1", children: [
|
|
10861
|
+
amount ? /* @__PURE__ */ jsx("span", { className: "text-sm font-medium leading-4", children: amount }) : null,
|
|
10862
|
+
amount && usd ? /* @__PURE__ */ jsx(
|
|
10863
|
+
"span",
|
|
10864
|
+
{
|
|
10865
|
+
className: `text-sm leading-4 tabular-nums text-muted-foreground ${row.status === "failed" ? "line-through opacity-50" : ""}`,
|
|
10866
|
+
children: usd
|
|
10867
|
+
}
|
|
10868
|
+
) : null
|
|
10869
|
+
] })
|
|
10752
10870
|
]
|
|
10753
10871
|
}
|
|
10754
10872
|
) });
|
|
@@ -10768,7 +10886,8 @@ function HashMenu({
|
|
|
10768
10886
|
hash,
|
|
10769
10887
|
url,
|
|
10770
10888
|
onOpen,
|
|
10771
|
-
label = "Transaction hash"
|
|
10889
|
+
label = "Transaction hash",
|
|
10890
|
+
copyLabel = "Copy address"
|
|
10772
10891
|
}) {
|
|
10773
10892
|
return /* @__PURE__ */ jsxs(
|
|
10774
10893
|
Select,
|
|
@@ -10782,7 +10901,7 @@ function HashMenu({
|
|
|
10782
10901
|
/* @__PURE__ */ jsx(
|
|
10783
10902
|
SelectTrigger,
|
|
10784
10903
|
{
|
|
10785
|
-
"aria-label":
|
|
10904
|
+
"aria-label": `${label} actions`,
|
|
10786
10905
|
title: hash,
|
|
10787
10906
|
className: "!h-auto gap-1 border-0 bg-transparent p-0 text-sm font-medium shadow-none hover:opacity-80 aria-expanded:opacity-80 dark:bg-transparent dark:hover:bg-transparent",
|
|
10788
10907
|
children: /* @__PURE__ */ jsx("span", { children: formatAddress(hash) })
|
|
@@ -10791,7 +10910,7 @@ function HashMenu({
|
|
|
10791
10910
|
/* @__PURE__ */ jsxs(SelectContent, { align: "end", alignItemWithTrigger: false, className: "w-auto", children: [
|
|
10792
10911
|
/* @__PURE__ */ jsxs(SelectItem, { value: "copy", children: [
|
|
10793
10912
|
/* @__PURE__ */ jsx(Copy, { className: "size-4" }),
|
|
10794
|
-
|
|
10913
|
+
copyLabel
|
|
10795
10914
|
] }),
|
|
10796
10915
|
url ? /* @__PURE__ */ jsxs(SelectItem, { value: "open", children: [
|
|
10797
10916
|
/* @__PURE__ */ jsx(ExternalLink, { className: "size-4" }),
|
|
@@ -10805,6 +10924,7 @@ function HashMenu({
|
|
|
10805
10924
|
function BridgeActivityDetail({
|
|
10806
10925
|
selection,
|
|
10807
10926
|
network,
|
|
10927
|
+
usd,
|
|
10808
10928
|
track
|
|
10809
10929
|
}) {
|
|
10810
10930
|
const { row, account } = selection;
|
|
@@ -10830,10 +10950,17 @@ function BridgeActivityDetail({
|
|
|
10830
10950
|
/* @__PURE__ */ jsx(ActivityTokenTile, { tokenSymbol: row.tokenSymbol, badge: row.direction }),
|
|
10831
10951
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-0", children: [
|
|
10832
10952
|
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-2xl font-medium", children: amount ?? rowTitle(row) }),
|
|
10953
|
+
amount && usd ? /* @__PURE__ */ jsx(
|
|
10954
|
+
"span",
|
|
10955
|
+
{
|
|
10956
|
+
className: `text-sm tabular-nums text-muted-foreground ${row.status === "failed" ? "line-through opacity-50" : ""}`,
|
|
10957
|
+
children: usd
|
|
10958
|
+
}
|
|
10959
|
+
) : null,
|
|
10833
10960
|
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: dateTimeFormat.format(new Date(row.sentAt)) })
|
|
10834
10961
|
] })
|
|
10835
10962
|
] }),
|
|
10836
|
-
/* @__PURE__ */ jsxs("dl", { className: "flex flex-col gap-5 text-sm bg-
|
|
10963
|
+
/* @__PURE__ */ jsxs("dl", { className: "flex flex-col gap-5 text-sm bg-white/5 p-4 rounded-2xl", children: [
|
|
10837
10964
|
/* @__PURE__ */ jsx(DetailRow, { label: "Status", children: /* @__PURE__ */ jsx("span", { className: status.className, children: status.label }) }),
|
|
10838
10965
|
/* @__PURE__ */ jsx(DetailRow, { label: "Account", children: /* @__PURE__ */ jsx("span", { title: account, children: formatAddress(account) }) }),
|
|
10839
10966
|
/* @__PURE__ */ jsxs(DetailRow, { label: "Network", children: [
|
|
@@ -10847,7 +10974,7 @@ function BridgeActivityDetail({
|
|
|
10847
10974
|
chainName
|
|
10848
10975
|
] })
|
|
10849
10976
|
] }),
|
|
10850
|
-
/* @__PURE__ */ jsxs("dl", { className: "flex flex-col gap-5 text-sm bg-
|
|
10977
|
+
/* @__PURE__ */ jsxs("dl", { className: "flex flex-col gap-5 text-sm bg-white/5 p-4 rounded-2xl", children: [
|
|
10851
10978
|
/* @__PURE__ */ jsx(DetailRow, { label: "Transaction ID", children: /* @__PURE__ */ jsx(
|
|
10852
10979
|
HashMenu,
|
|
10853
10980
|
{
|
|
@@ -11127,6 +11254,7 @@ var STATUS = {
|
|
|
11127
11254
|
function FluentActivityDetail({
|
|
11128
11255
|
selection,
|
|
11129
11256
|
network,
|
|
11257
|
+
usd,
|
|
11130
11258
|
track
|
|
11131
11259
|
}) {
|
|
11132
11260
|
const { entry, account } = selection;
|
|
@@ -11145,6 +11273,16 @@ function FluentActivityDetail({
|
|
|
11145
11273
|
const popup = globalThis.window?.open(url, "_blank", "noopener,noreferrer");
|
|
11146
11274
|
if (popup) popup.opener = null;
|
|
11147
11275
|
};
|
|
11276
|
+
const accountCell = /* @__PURE__ */ jsx("span", { title: account, children: formatAddress(account) });
|
|
11277
|
+
const counterpartyCell = summary.counterparty ? /* @__PURE__ */ jsx(
|
|
11278
|
+
HashMenu,
|
|
11279
|
+
{
|
|
11280
|
+
hash: summary.counterparty,
|
|
11281
|
+
url: explorerAddress(summary.counterparty, network),
|
|
11282
|
+
onOpen: (url) => openExplorer(url, "explorer"),
|
|
11283
|
+
label: "Address"
|
|
11284
|
+
}
|
|
11285
|
+
) : null;
|
|
11148
11286
|
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-2.5", children: [
|
|
11149
11287
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3 py-3", children: [
|
|
11150
11288
|
movement ? /* @__PURE__ */ jsx(ActivityTokenTile, { tokenSymbol: movement.symbol, badge: "l2_to_l1" }) : /* @__PURE__ */ jsx("span", { className: "flex size-10 shrink-0 items-center justify-center rounded-full bg-foreground/10", children: /* @__PURE__ */ jsx(Layers, { className: "size-4" }) }),
|
|
@@ -11159,6 +11297,16 @@ function FluentActivityDetail({
|
|
|
11159
11297
|
children: heading
|
|
11160
11298
|
}
|
|
11161
11299
|
),
|
|
11300
|
+
usd ? /* @__PURE__ */ jsx(
|
|
11301
|
+
"span",
|
|
11302
|
+
{
|
|
11303
|
+
className: cn(
|
|
11304
|
+
"text-sm tabular-nums text-muted-foreground",
|
|
11305
|
+
entry.status === "failed" && "opacity-50 line-through"
|
|
11306
|
+
),
|
|
11307
|
+
children: usd
|
|
11308
|
+
}
|
|
11309
|
+
) : null,
|
|
11162
11310
|
/* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
|
|
11163
11311
|
summary.title,
|
|
11164
11312
|
" \xB7 ",
|
|
@@ -11166,24 +11314,18 @@ function FluentActivityDetail({
|
|
|
11166
11314
|
] })
|
|
11167
11315
|
] })
|
|
11168
11316
|
] }),
|
|
11169
|
-
/* @__PURE__ */ jsxs("dl", { className: "flex flex-col gap-5 text-sm bg-
|
|
11317
|
+
/* @__PURE__ */ jsxs("dl", { className: "flex flex-col gap-5 text-sm bg-white/5 p-4 rounded-2xl", children: [
|
|
11170
11318
|
/* @__PURE__ */ jsx(DetailRow, { label: "Status", children: /* @__PURE__ */ jsx("span", { className: status.className, children: status.label }) }),
|
|
11171
|
-
|
|
11172
|
-
|
|
11173
|
-
|
|
11174
|
-
|
|
11175
|
-
hash: summary.counterparty,
|
|
11176
|
-
url: explorerAddress(summary.counterparty, network),
|
|
11177
|
-
onOpen: (url) => openExplorer(url, "explorer"),
|
|
11178
|
-
label: "Address"
|
|
11179
|
-
}
|
|
11180
|
-
) }) : null,
|
|
11319
|
+
counterpartyCell ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11320
|
+
/* @__PURE__ */ jsx(DetailRow, { label: "From", children: summary.direction === "sent" ? accountCell : counterpartyCell }),
|
|
11321
|
+
/* @__PURE__ */ jsx(DetailRow, { label: "To", children: summary.direction === "sent" ? counterpartyCell : accountCell })
|
|
11322
|
+
] }) : /* @__PURE__ */ jsx(DetailRow, { label: "Account", children: accountCell }),
|
|
11181
11323
|
/* @__PURE__ */ jsxs(DetailRow, { label: "Network", children: [
|
|
11182
11324
|
/* @__PURE__ */ jsx("span", { className: `flex size-5 items-center justify-center rounded-full ${badge.bgClassName}`, children: /* @__PURE__ */ jsx(Icon, { name: badge.icon, className: `size-3 ${badge.iconClassName}` }) }),
|
|
11183
11325
|
chainName
|
|
11184
11326
|
] })
|
|
11185
11327
|
] }),
|
|
11186
|
-
/* @__PURE__ */ jsxs("dl", { className: "flex flex-col gap-5 text-sm bg-
|
|
11328
|
+
/* @__PURE__ */ jsxs("dl", { className: "flex flex-col gap-5 text-sm bg-white/5 p-4 rounded-2xl", children: [
|
|
11187
11329
|
entry.kind === "operation" ? /* @__PURE__ */ jsx(DetailRow, { label: "Operation ID", children: /* @__PURE__ */ jsx(
|
|
11188
11330
|
HashMenu,
|
|
11189
11331
|
{
|
|
@@ -11207,6 +11349,67 @@ function FluentActivityDetail({
|
|
|
11207
11349
|
] })
|
|
11208
11350
|
] });
|
|
11209
11351
|
}
|
|
11352
|
+
var ESTIMATE_DEBOUNCE_MS = 300;
|
|
11353
|
+
function useTransferFeeEstimate(params) {
|
|
11354
|
+
const { chain, account, token, to, amount } = params;
|
|
11355
|
+
const [estimate, setEstimate] = useState({ status: "idle" });
|
|
11356
|
+
const publicClient = useMemo(
|
|
11357
|
+
() => createPublicClient({ chain, transport: createFluentRpcTransport(chain) }),
|
|
11358
|
+
[chain]
|
|
11359
|
+
);
|
|
11360
|
+
const tokenAddress = token?.address;
|
|
11361
|
+
const native = token ? isFluentNativeToken(token) : false;
|
|
11362
|
+
useEffect(() => {
|
|
11363
|
+
if (!account || !token || to === null || amount === null || !native && !tokenAddress) {
|
|
11364
|
+
setEstimate({ status: "idle" });
|
|
11365
|
+
return;
|
|
11366
|
+
}
|
|
11367
|
+
let cancelled = false;
|
|
11368
|
+
setEstimate({ status: "loading" });
|
|
11369
|
+
const timer = setTimeout(() => {
|
|
11370
|
+
void (async () => {
|
|
11371
|
+
const from = account;
|
|
11372
|
+
const [gas, gasPrice] = await Promise.all([
|
|
11373
|
+
native ? publicClient.estimateGas({ account: from, to, value: amount }) : publicClient.estimateContractGas({
|
|
11374
|
+
account: from,
|
|
11375
|
+
address: tokenAddress,
|
|
11376
|
+
abi: fluentTransferAbi,
|
|
11377
|
+
functionName: "transfer",
|
|
11378
|
+
args: [to, amount]
|
|
11379
|
+
}),
|
|
11380
|
+
publicClient.getGasPrice()
|
|
11381
|
+
]);
|
|
11382
|
+
return gas * gasPrice;
|
|
11383
|
+
})().then(
|
|
11384
|
+
(wei) => {
|
|
11385
|
+
if (!cancelled) setEstimate({ status: "ready", wei });
|
|
11386
|
+
},
|
|
11387
|
+
(error) => {
|
|
11388
|
+
if (cancelled) return;
|
|
11389
|
+
debugError("[FluentWidget] Transfer fee estimate failed", error);
|
|
11390
|
+
setEstimate({ status: "failed" });
|
|
11391
|
+
}
|
|
11392
|
+
);
|
|
11393
|
+
}, ESTIMATE_DEBOUNCE_MS);
|
|
11394
|
+
return () => {
|
|
11395
|
+
cancelled = true;
|
|
11396
|
+
clearTimeout(timer);
|
|
11397
|
+
};
|
|
11398
|
+
}, [publicClient, account, token, native, tokenAddress, to, amount]);
|
|
11399
|
+
return estimate;
|
|
11400
|
+
}
|
|
11401
|
+
function convertFluentFeeToGasToken(params) {
|
|
11402
|
+
const { wei, feeToken, ethValueByToken } = params;
|
|
11403
|
+
const rates = {
|
|
11404
|
+
...FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES,
|
|
11405
|
+
...ethValueByToken
|
|
11406
|
+
};
|
|
11407
|
+
const rate = rates[feeToken.symbol];
|
|
11408
|
+
if (!rate) return void 0;
|
|
11409
|
+
const rateWei = parseUnits(rate, 18);
|
|
11410
|
+
if (rateWei === 0n) return void 0;
|
|
11411
|
+
return wei * 10n ** BigInt(feeToken.decimals) / rateWei;
|
|
11412
|
+
}
|
|
11210
11413
|
var TooltipProvider = Tooltip$1.Provider;
|
|
11211
11414
|
var Tooltip = Tooltip$1.Root;
|
|
11212
11415
|
function TooltipTrigger({ className, ...props }) {
|
|
@@ -11378,6 +11581,27 @@ function TokenSelect({
|
|
|
11378
11581
|
}
|
|
11379
11582
|
);
|
|
11380
11583
|
}
|
|
11584
|
+
function formatEstimatedFee(params) {
|
|
11585
|
+
const { estimate, feeToken, nativeSymbol, ethValueByToken, usdPrices, nativeIdentity } = params;
|
|
11586
|
+
if (estimate.status === "loading") return { value: "Estimating\u2026" };
|
|
11587
|
+
if (estimate.status !== "ready" || !feeToken) return { value: "\u2014" };
|
|
11588
|
+
const inFeeToken = convertFluentFeeToGasToken({ wei: estimate.wei, feeToken, ethValueByToken });
|
|
11589
|
+
const usdOf = (raw, decimals, price) => {
|
|
11590
|
+
if (price === void 0 || raw === 0n) return void 0;
|
|
11591
|
+
const usd = Number(formatUnits(raw, decimals)) * price;
|
|
11592
|
+
return Number.isFinite(usd) && usd > 0 ? formatUsd(usd) : void 0;
|
|
11593
|
+
};
|
|
11594
|
+
if (inFeeToken === void 0) {
|
|
11595
|
+
return {
|
|
11596
|
+
value: `${formatAmount(estimate.wei, 18)} ${nativeSymbol}`,
|
|
11597
|
+
secondary: usdOf(estimate.wei, 18, nativeIdentity ? usdPrices[nativeIdentity] : void 0)
|
|
11598
|
+
};
|
|
11599
|
+
}
|
|
11600
|
+
return {
|
|
11601
|
+
value: `\u2248 ${formatAmount(inFeeToken, feeToken.decimals)} ${feeToken.symbol}`,
|
|
11602
|
+
secondary: usdOf(inFeeToken, feeToken.decimals, usdPrices[feeToken.identity])
|
|
11603
|
+
};
|
|
11604
|
+
}
|
|
11381
11605
|
function SendTokenForm({
|
|
11382
11606
|
tokens,
|
|
11383
11607
|
balances,
|
|
@@ -11438,6 +11662,28 @@ function SendTokenForm({
|
|
|
11438
11662
|
}).ethValueWei,
|
|
11439
11663
|
sponsorshipAvailable
|
|
11440
11664
|
}) : { status: "ok" };
|
|
11665
|
+
const feeEstimate = useTransferFeeEstimate({
|
|
11666
|
+
chain,
|
|
11667
|
+
account: accountAddress,
|
|
11668
|
+
token,
|
|
11669
|
+
to: recipientCheck.status === "ok" ? recipientCheck.address : null,
|
|
11670
|
+
amount: amountCheck?.status === "ok" ? amountCheck.raw : null
|
|
11671
|
+
});
|
|
11672
|
+
const nativeToken = tokens.find(isFluentNativeToken) ?? gasTokens.find(isFluentNativeToken);
|
|
11673
|
+
const estimatedFee = formatEstimatedFee({
|
|
11674
|
+
estimate: feeEstimate,
|
|
11675
|
+
feeToken,
|
|
11676
|
+
nativeSymbol: chain.nativeCurrency.symbol,
|
|
11677
|
+
ethValueByToken,
|
|
11678
|
+
usdPrices,
|
|
11679
|
+
nativeIdentity: nativeToken?.identity
|
|
11680
|
+
});
|
|
11681
|
+
const feeSponsored = Boolean(feeToken && isFluentNativeToken(feeToken) && sponsorshipAvailable);
|
|
11682
|
+
const feeBalanceLabel = (candidate) => {
|
|
11683
|
+
const entry = balanceByIdentity.get(candidate.identity);
|
|
11684
|
+
if (entry?.status === "ready" && entry.raw !== null) return formatAmount(entry.raw, candidate.decimals);
|
|
11685
|
+
return balancesBusy ? "\u2026" : "\u2014";
|
|
11686
|
+
};
|
|
11441
11687
|
const ready = Boolean(token) && recipientCheck.status === "ok" && amountCheck?.status === "ok" && fee.status !== "blocked" && !sending;
|
|
11442
11688
|
const handleSend = async () => {
|
|
11443
11689
|
if (!token || !feeToken) return;
|
|
@@ -11566,16 +11812,23 @@ function SendTokenForm({
|
|
|
11566
11812
|
setGasIdentity(value);
|
|
11567
11813
|
},
|
|
11568
11814
|
children: [
|
|
11569
|
-
/* @__PURE__ */
|
|
11815
|
+
/* @__PURE__ */ jsxs(
|
|
11570
11816
|
SelectTrigger,
|
|
11571
11817
|
{
|
|
11572
11818
|
"aria-label": "Token the fee is paid in",
|
|
11573
11819
|
size: "sm",
|
|
11574
|
-
className: "!h-auto shrink-0 border-0 bg-transparent p-0 text-sm text-foreground shadow-none dark:bg-transparent dark:hover:bg-transparent",
|
|
11575
|
-
children:
|
|
11820
|
+
className: "!h-auto shrink-0 gap-1.5 border-0 bg-transparent p-0 text-sm text-foreground shadow-none dark:bg-transparent dark:hover:bg-transparent",
|
|
11821
|
+
children: [
|
|
11822
|
+
/* @__PURE__ */ jsx(TokenGlyph, { token: feeToken, className: "size-4 [&>svg]:size-2.5 [&>span]:text-[10px]" }),
|
|
11823
|
+
/* @__PURE__ */ jsx("span", { children: feeToken?.symbol ?? "No fee token" })
|
|
11824
|
+
]
|
|
11576
11825
|
}
|
|
11577
11826
|
),
|
|
11578
|
-
/* @__PURE__ */ jsx(SelectContent, { align: "end", alignItemWithTrigger: false, children: gasTokens.map((candidate) => /* @__PURE__ */
|
|
11827
|
+
/* @__PURE__ */ jsx(SelectContent, { align: "end", alignItemWithTrigger: false, className: "min-w-52", children: gasTokens.map((candidate) => /* @__PURE__ */ jsxs(SelectItem, { value: candidate.identity, children: [
|
|
11828
|
+
/* @__PURE__ */ jsx(TokenGlyph, { token: candidate, className: "size-5" }),
|
|
11829
|
+
/* @__PURE__ */ jsx("span", { children: candidate.symbol }),
|
|
11830
|
+
/* @__PURE__ */ jsx("span", { className: "ml-auto pl-4 text-foreground/60", children: feeBalanceLabel(candidate) })
|
|
11831
|
+
] }, candidate.identity)) })
|
|
11579
11832
|
]
|
|
11580
11833
|
}
|
|
11581
11834
|
) : feeToken?.symbol ?? "Native currency",
|
|
@@ -11583,11 +11836,15 @@ function SendTokenForm({
|
|
|
11583
11836
|
tooltip: erc20GasAvailable ? `This transfer only. Your saved choice stays ${defaultGasSymbol}.` : "An external wallet has no paymaster, so it pays the network fee itself."
|
|
11584
11837
|
}
|
|
11585
11838
|
),
|
|
11586
|
-
/* @__PURE__ */
|
|
11587
|
-
|
|
11588
|
-
|
|
11589
|
-
|
|
11590
|
-
|
|
11839
|
+
/* @__PURE__ */ jsx(
|
|
11840
|
+
SummaryRow,
|
|
11841
|
+
{
|
|
11842
|
+
label: "Est. network fee",
|
|
11843
|
+
value: estimatedFee.value,
|
|
11844
|
+
secondary: estimatedFee.secondary,
|
|
11845
|
+
tooltip: feeSponsored ? "What the network charges for this transfer. The app may cover it; the review shows the exact amount." : "What the network charges for this transfer, converted to the fee token at today's rate. The review shows the exact amount."
|
|
11846
|
+
}
|
|
11847
|
+
)
|
|
11591
11848
|
] }) }),
|
|
11592
11849
|
fee.status !== "ok" ? /* @__PURE__ */ jsxs(
|
|
11593
11850
|
"p",
|
|
@@ -11604,7 +11861,12 @@ function SendTokenForm({
|
|
|
11604
11861
|
/* @__PURE__ */ jsx(Button, { className: "w-full", disabled: !ready, onClick: () => void handleSend(), children: sending ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11605
11862
|
/* @__PURE__ */ jsx(Spinner, { className: "size-4" }),
|
|
11606
11863
|
"Sending\u2026"
|
|
11607
|
-
] }) : `Send ${token?.symbol ?? ""}`.trim() })
|
|
11864
|
+
] }) : `Send ${token?.symbol ?? ""}`.trim() }),
|
|
11865
|
+
/* @__PURE__ */ jsxs("span", { className: "text-balance text-center text-[10px] text-foreground/60", children: [
|
|
11866
|
+
"Send only to addresses on ",
|
|
11867
|
+
chain.name,
|
|
11868
|
+
". Transfers are final, and funds sent to another network may be lost."
|
|
11869
|
+
] })
|
|
11608
11870
|
] });
|
|
11609
11871
|
}
|
|
11610
11872
|
function Separator({
|
|
@@ -12430,7 +12692,7 @@ function WalletMenuTokenList({
|
|
|
12430
12692
|
}),
|
|
12431
12693
|
[balanceByIdentity, tokens]
|
|
12432
12694
|
);
|
|
12433
|
-
return /* @__PURE__ */ jsx(TooltipProvider, { delay: 200, children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 rounded-2xl bg-
|
|
12695
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { delay: 200, children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 rounded-2xl bg-white/5 p-1", "aria-label": "Token balances", children: [
|
|
12434
12696
|
sortedRows.map(({ token, balance }) => {
|
|
12435
12697
|
const identity = token.identity;
|
|
12436
12698
|
const symbol = token.symbol;
|
|
@@ -12824,6 +13086,48 @@ function useBridgeHistoryRows({
|
|
|
12824
13086
|
};
|
|
12825
13087
|
}
|
|
12826
13088
|
var dayFormat = new Intl.DateTimeFormat(void 0, { dateStyle: "medium" });
|
|
13089
|
+
function useActivityPrices(usdPrices, tokens) {
|
|
13090
|
+
return useMemo(() => {
|
|
13091
|
+
const bySymbol = /* @__PURE__ */ new Map();
|
|
13092
|
+
for (const token of tokens ?? []) {
|
|
13093
|
+
const price = usdPrices?.[token.identity];
|
|
13094
|
+
if (price !== void 0 && !bySymbol.has(token.symbol)) bySymbol.set(token.symbol, price);
|
|
13095
|
+
}
|
|
13096
|
+
return ({ identity, symbol }) => {
|
|
13097
|
+
const byIdentity = identity ? usdPrices?.[identity] : void 0;
|
|
13098
|
+
if (byIdentity !== void 0) return byIdentity;
|
|
13099
|
+
return symbol ? bySymbol.get(symbol) : void 0;
|
|
13100
|
+
};
|
|
13101
|
+
}, [usdPrices, tokens]);
|
|
13102
|
+
}
|
|
13103
|
+
function formatActivityUsd(amount, usdPrice) {
|
|
13104
|
+
if (usdPrice === void 0) return void 0;
|
|
13105
|
+
const usd = Number(amount) * usdPrice;
|
|
13106
|
+
return Number.isFinite(usd) && usd > 0 ? formatUsd(usd) : void 0;
|
|
13107
|
+
}
|
|
13108
|
+
function formatBridgeRowUsd(row, priceOf) {
|
|
13109
|
+
if (row.amount === void 0 || row.decimals === void 0) return void 0;
|
|
13110
|
+
return formatActivityUsd(formatUnits(row.amount, row.decimals), priceOf({ symbol: row.tokenSymbol }));
|
|
13111
|
+
}
|
|
13112
|
+
function formatFluentEntryUsd(entry, priceOf) {
|
|
13113
|
+
const movements = entry.kind === "movement" ? [entry] : entry.movements;
|
|
13114
|
+
const figures = movements.map((movement) => formatActivityUsd(movement.amount, priceOf(movement)));
|
|
13115
|
+
if (figures.every((figure) => figure === void 0)) return void 0;
|
|
13116
|
+
return figures.map((figure) => figure ?? "\u2014").join(", ");
|
|
13117
|
+
}
|
|
13118
|
+
function ActivityUsd({ usd, failed }) {
|
|
13119
|
+
if (!usd) return null;
|
|
13120
|
+
return /* @__PURE__ */ jsx(
|
|
13121
|
+
"span",
|
|
13122
|
+
{
|
|
13123
|
+
className: cn(
|
|
13124
|
+
"text-sm leading-4 tabular-nums text-muted-foreground",
|
|
13125
|
+
failed && "line-through opacity-50"
|
|
13126
|
+
),
|
|
13127
|
+
children: usd
|
|
13128
|
+
}
|
|
13129
|
+
);
|
|
13130
|
+
}
|
|
12827
13131
|
function groupByDay(items) {
|
|
12828
13132
|
const groups = [];
|
|
12829
13133
|
for (const item of items) {
|
|
@@ -12841,10 +13145,13 @@ function Notice({ title, description }) {
|
|
|
12841
13145
|
/* @__PURE__ */ jsx("span", { className: "text-xs opacity-50", children: description })
|
|
12842
13146
|
] });
|
|
12843
13147
|
}
|
|
12844
|
-
function PendingActivityRow({
|
|
13148
|
+
function PendingActivityRow({
|
|
13149
|
+
transfer,
|
|
13150
|
+
usd
|
|
13151
|
+
}) {
|
|
12845
13152
|
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center gap-3 rounded-xl p-2.5 text-left", children: [
|
|
12846
|
-
/* @__PURE__ */ jsx(ActivityTokenTile, { tokenSymbol: transfer.symbol, badge: "l2_to_l1" }),
|
|
12847
|
-
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-
|
|
13153
|
+
/* @__PURE__ */ jsx(ActivityTokenTile, { tokenSymbol: transfer.symbol, badge: "l2_to_l1", surface: "row" }),
|
|
13154
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
12848
13155
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-sm font-medium leading-4", children: [
|
|
12849
13156
|
"Sending",
|
|
12850
13157
|
/* @__PURE__ */ jsx(Spinner, { className: "size-3 text-muted-foreground" })
|
|
@@ -12854,11 +13161,14 @@ function PendingActivityRow({ transfer }) {
|
|
|
12854
13161
|
formatAddress(transfer.to)
|
|
12855
13162
|
] })
|
|
12856
13163
|
] }),
|
|
12857
|
-
/* @__PURE__ */ jsxs("span", { className: "shrink-0
|
|
12858
|
-
"
|
|
12859
|
-
|
|
12860
|
-
|
|
12861
|
-
|
|
13164
|
+
/* @__PURE__ */ jsxs("span", { className: "flex shrink-0 flex-col items-end gap-1", children: [
|
|
13165
|
+
/* @__PURE__ */ jsxs("span", { className: "text-sm font-medium leading-4 tabular-nums opacity-70", children: [
|
|
13166
|
+
"\u2212",
|
|
13167
|
+
formatFluentLocaleAmount(transfer.amount, 6),
|
|
13168
|
+
" ",
|
|
13169
|
+
transfer.symbol
|
|
13170
|
+
] }),
|
|
13171
|
+
/* @__PURE__ */ jsx(ActivityUsd, { usd })
|
|
12862
13172
|
] })
|
|
12863
13173
|
] }) });
|
|
12864
13174
|
}
|
|
@@ -12880,6 +13190,7 @@ function ActivityAmount({
|
|
|
12880
13190
|
function FluentActivityRow({
|
|
12881
13191
|
entry,
|
|
12882
13192
|
tag,
|
|
13193
|
+
priceOf,
|
|
12883
13194
|
onOpen
|
|
12884
13195
|
}) {
|
|
12885
13196
|
const movement = entry.kind === "movement" ? entry : entry.movements[0];
|
|
@@ -12892,13 +13203,13 @@ function FluentActivityRow({
|
|
|
12892
13203
|
{
|
|
12893
13204
|
type: "button",
|
|
12894
13205
|
onClick: onOpen,
|
|
12895
|
-
className: "group flex w-full items-center gap-3 p-2.5 rounded-xl text-left hover:bg-
|
|
13206
|
+
className: "group flex w-full items-center gap-3 p-2.5 rounded-xl text-left hover:bg-white/10",
|
|
12896
13207
|
children: [
|
|
12897
13208
|
movement ? (
|
|
12898
13209
|
// `l2_to_l1` is the Fluent badge: this row lives on Fluent.
|
|
12899
|
-
/* @__PURE__ */ jsx(ActivityTokenTile, { tokenSymbol: movement.symbol, badge: "l2_to_l1" })
|
|
13210
|
+
/* @__PURE__ */ jsx(ActivityTokenTile, { tokenSymbol: movement.symbol, badge: "l2_to_l1", surface: "row" })
|
|
12900
13211
|
) : /* @__PURE__ */ jsx("span", { className: "flex size-10 shrink-0 items-center justify-center rounded-full bg-foreground/10", children: /* @__PURE__ */ jsx(Layers, { className: "size-4" }) }),
|
|
12901
|
-
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-
|
|
13212
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
12902
13213
|
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-sm font-medium leading-4", children: [
|
|
12903
13214
|
summary.title,
|
|
12904
13215
|
statusLabel ? /* @__PURE__ */ jsx("span", { className: "rounded-md bg-destructive/20 px-1.5 leading-[18px] text-[10px] font-normal text-destructive -my-px", children: statusLabel }) : null,
|
|
@@ -12910,7 +13221,16 @@ function FluentActivityRow({
|
|
|
12910
13221
|
detail
|
|
12911
13222
|
] })
|
|
12912
13223
|
] }),
|
|
12913
|
-
/* @__PURE__ */ jsx("span", { className: "flex shrink-0 flex-col items-end gap-
|
|
13224
|
+
/* @__PURE__ */ jsx("span", { className: "flex shrink-0 flex-col items-end gap-1", children: movements.map((item) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
13225
|
+
/* @__PURE__ */ jsx(ActivityAmount, { movement: item, status: entry.status }),
|
|
13226
|
+
/* @__PURE__ */ jsx(
|
|
13227
|
+
ActivityUsd,
|
|
13228
|
+
{
|
|
13229
|
+
usd: formatActivityUsd(item.amount, priceOf(item)),
|
|
13230
|
+
failed: entry.status === "failed"
|
|
13231
|
+
}
|
|
13232
|
+
)
|
|
13233
|
+
] }, item.id)) })
|
|
12914
13234
|
]
|
|
12915
13235
|
}
|
|
12916
13236
|
) });
|
|
@@ -12919,10 +13239,13 @@ function WalletMenuActivityList({
|
|
|
12919
13239
|
fluent: fluent3,
|
|
12920
13240
|
bridge,
|
|
12921
13241
|
externalWalletAddress,
|
|
13242
|
+
usdPrices,
|
|
13243
|
+
tokens,
|
|
12922
13244
|
onOpenBridgeRow,
|
|
12923
13245
|
onOpenFluentEntry
|
|
12924
13246
|
}) {
|
|
12925
13247
|
const walletAddress = bridge?.address ?? externalWalletAddress;
|
|
13248
|
+
const priceOf = useActivityPrices(usdPrices, tokens);
|
|
12926
13249
|
const twoAccounts = Boolean(
|
|
12927
13250
|
fluent3.address && walletAddress && fluent3.address.toLowerCase() !== walletAddress.toLowerCase()
|
|
12928
13251
|
);
|
|
@@ -12934,13 +13257,26 @@ function WalletMenuActivityList({
|
|
|
12934
13257
|
}
|
|
12935
13258
|
return hashes;
|
|
12936
13259
|
}, [fluent3.entries]);
|
|
13260
|
+
const entries = useMemo(
|
|
13261
|
+
() => attachFluentPendingTransfers(fluent3.entries, fluent3.pending ?? []),
|
|
13262
|
+
[fluent3.entries, fluent3.pending]
|
|
13263
|
+
);
|
|
12937
13264
|
const items = useMemo(() => {
|
|
12938
|
-
const list = (fluent3.pending ?? []).filter(
|
|
13265
|
+
const list = (fluent3.pending ?? []).filter(
|
|
13266
|
+
(transfer) => !transfer.expired && (!transfer.hash || !listedHashes.has(transfer.hash.toLowerCase()))
|
|
13267
|
+
).map((transfer) => ({
|
|
12939
13268
|
id: `pending:${transfer.id}`,
|
|
12940
13269
|
at: transfer.startedAt,
|
|
12941
|
-
node: /* @__PURE__ */ jsx(
|
|
13270
|
+
node: /* @__PURE__ */ jsx(
|
|
13271
|
+
PendingActivityRow,
|
|
13272
|
+
{
|
|
13273
|
+
transfer,
|
|
13274
|
+
usd: formatActivityUsd(transfer.amount, priceOf(transfer))
|
|
13275
|
+
},
|
|
13276
|
+
transfer.id
|
|
13277
|
+
)
|
|
12942
13278
|
}));
|
|
12943
|
-
list.push(...
|
|
13279
|
+
list.push(...entries.map((entry) => ({
|
|
12944
13280
|
id: `fluent:${entry.id}`,
|
|
12945
13281
|
at: entry.timestamp,
|
|
12946
13282
|
node: /* @__PURE__ */ jsx(
|
|
@@ -12948,6 +13284,7 @@ function WalletMenuActivityList({
|
|
|
12948
13284
|
{
|
|
12949
13285
|
entry,
|
|
12950
13286
|
tag: twoAccounts ? fluent3.label : void 0,
|
|
13287
|
+
priceOf,
|
|
12951
13288
|
onOpen: () => onOpenFluentEntry(entry)
|
|
12952
13289
|
}
|
|
12953
13290
|
)
|
|
@@ -12963,6 +13300,7 @@ function WalletMenuActivityList({
|
|
|
12963
13300
|
{
|
|
12964
13301
|
row,
|
|
12965
13302
|
tag: twoAccounts ? "Wallet" : void 0,
|
|
13303
|
+
usd: formatBridgeRowUsd(row, priceOf),
|
|
12966
13304
|
onOpen: () => onOpenBridgeRow({ row, account })
|
|
12967
13305
|
}
|
|
12968
13306
|
)
|
|
@@ -12970,7 +13308,7 @@ function WalletMenuActivityList({
|
|
|
12970
13308
|
}
|
|
12971
13309
|
}
|
|
12972
13310
|
return list.sort((a, b) => b.at - a.at);
|
|
12973
|
-
}, [bridge?.address, bridge?.rows,
|
|
13311
|
+
}, [bridge?.address, bridge?.rows, entries, fluent3.label, fluent3.pending, listedHashes, onOpenBridgeRow, onOpenFluentEntry, priceOf, twoAccounts]);
|
|
12974
13312
|
if (!fluent3.address && !walletAddress) {
|
|
12975
13313
|
return /* @__PURE__ */ jsx(Notice, { title: "Not connected", description: "Connect an account to see its activity." });
|
|
12976
13314
|
}
|
|
@@ -12996,7 +13334,7 @@ function WalletMenuActivityList({
|
|
|
12996
13334
|
}
|
|
12997
13335
|
) : groupByDay(items).map((group) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2.5", children: [
|
|
12998
13336
|
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: dayFormat.format(group.day) }),
|
|
12999
|
-
/* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-1 bg-
|
|
13337
|
+
/* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-1 bg-white/5 rounded-2xl p-1", children: group.items.map((item) => /* @__PURE__ */ jsx(Fragment$1, { children: item.node }, item.id)) })
|
|
13000
13338
|
] }, group.day.getTime())),
|
|
13001
13339
|
items.length > 0 && errors.length > 0 ? /* @__PURE__ */ jsx("p", { className: "text-center text-xs text-destructive", role: "status", children: errors.join(" ") }) : null,
|
|
13002
13340
|
hasMore ? /* @__PURE__ */ jsx(
|
|
@@ -13153,6 +13491,8 @@ function WalletMenuActionCard({
|
|
|
13153
13491
|
tokenListError = null,
|
|
13154
13492
|
onSendToken,
|
|
13155
13493
|
pendingTransfers,
|
|
13494
|
+
onMintUsdnr,
|
|
13495
|
+
mintUsdnrBusy = false,
|
|
13156
13496
|
onRevealAccount,
|
|
13157
13497
|
gasContext
|
|
13158
13498
|
}) {
|
|
@@ -13216,6 +13556,7 @@ function WalletMenuActionCard({
|
|
|
13216
13556
|
const externalWalletAccount = accountKind === "eoa";
|
|
13217
13557
|
const faucetAvailable = isFaucetNetwork(resolvedConfig.network);
|
|
13218
13558
|
const faucetOffered = faucetAvailable && !externalWalletAccount;
|
|
13559
|
+
const usdnrMinter = faucetAvailable ? onMintUsdnr : void 0;
|
|
13219
13560
|
const swapperReady = resolvedConfig.swapper.enabled && Boolean(resolvedConfig.swapper.integratorId) && Boolean(resolvedConfig.swapper.dstChainId) && Boolean(resolvedConfig.swapper.dstTokenAddress);
|
|
13220
13561
|
const handleSwapper = async () => {
|
|
13221
13562
|
setActionStatus(null);
|
|
@@ -13269,6 +13610,14 @@ function WalletMenuActionCard({
|
|
|
13269
13610
|
track("wallet_send_opened");
|
|
13270
13611
|
onTabChange("send");
|
|
13271
13612
|
};
|
|
13613
|
+
const handleMintUsdnr = async (mint) => {
|
|
13614
|
+
setActionStatus(null);
|
|
13615
|
+
if (!accountAddress) {
|
|
13616
|
+
setActionStatus("Wallet address is still preparing");
|
|
13617
|
+
return;
|
|
13618
|
+
}
|
|
13619
|
+
await mint(accountAddress);
|
|
13620
|
+
};
|
|
13272
13621
|
const {
|
|
13273
13622
|
balances,
|
|
13274
13623
|
busy: balancesBusy,
|
|
@@ -13283,6 +13632,7 @@ function WalletMenuActionCard({
|
|
|
13283
13632
|
userTokenStore
|
|
13284
13633
|
});
|
|
13285
13634
|
const { prices, pricesYesterday, busy: pricesBusy } = useFluentTokenUsdPrices(displayTokens);
|
|
13635
|
+
const activityPriceOf = useActivityPrices(prices, displayTokens);
|
|
13286
13636
|
const {
|
|
13287
13637
|
transactions,
|
|
13288
13638
|
busy: transactionsBusy,
|
|
@@ -13447,6 +13797,7 @@ function WalletMenuActionCard({
|
|
|
13447
13797
|
{
|
|
13448
13798
|
selection: activity.selection,
|
|
13449
13799
|
network: resolvedConfig.network,
|
|
13800
|
+
usd: formatBridgeRowUsd(activity.selection.row, activityPriceOf),
|
|
13450
13801
|
track
|
|
13451
13802
|
}
|
|
13452
13803
|
) : /* @__PURE__ */ jsx(
|
|
@@ -13454,6 +13805,7 @@ function WalletMenuActionCard({
|
|
|
13454
13805
|
{
|
|
13455
13806
|
selection: activity.selection,
|
|
13456
13807
|
network: resolvedConfig.network,
|
|
13808
|
+
usd: formatFluentEntryUsd(activity.selection.entry, activityPriceOf),
|
|
13457
13809
|
track
|
|
13458
13810
|
}
|
|
13459
13811
|
);
|
|
@@ -13581,9 +13933,9 @@ function WalletMenuActionCard({
|
|
|
13581
13933
|
{
|
|
13582
13934
|
variant: "secondary",
|
|
13583
13935
|
className: "h-16 w-full",
|
|
13584
|
-
disabled: !actionAddress || !swapperReady,
|
|
13585
|
-
title: swapperReady ? void 0 : "Not configured for this app",
|
|
13586
|
-
onClick: handleSwapper,
|
|
13936
|
+
disabled: usdnrMinter ? mintUsdnrBusy : !actionAddress || !swapperReady,
|
|
13937
|
+
title: usdnrMinter || swapperReady ? void 0 : "Not configured for this app",
|
|
13938
|
+
onClick: usdnrMinter ? () => handleMintUsdnr(usdnrMinter) : handleSwapper,
|
|
13587
13939
|
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
|
|
13588
13940
|
/* @__PURE__ */ jsx(Icon, { name: "plus", className: "size-4" }),
|
|
13589
13941
|
/* @__PURE__ */ jsx("span", { children: "Get USDnr" })
|
|
@@ -13674,6 +14026,8 @@ function WalletMenuActionCard({
|
|
|
13674
14026
|
error: transactionsError
|
|
13675
14027
|
},
|
|
13676
14028
|
externalWalletAddress,
|
|
14029
|
+
usdPrices: prices,
|
|
14030
|
+
tokens: displayTokens,
|
|
13677
14031
|
onOpenBridgeRow: (selection) => {
|
|
13678
14032
|
setActivity({ kind: "bridge", selection });
|
|
13679
14033
|
onTabChange("activity");
|
|
@@ -14999,14 +15353,20 @@ var WALLET_MENU_SUB_PAGES = {
|
|
|
14999
15353
|
settings: { title: "Settings" },
|
|
15000
15354
|
send: { title: "Send" },
|
|
15001
15355
|
bridge: { title: "Bridge" },
|
|
15002
|
-
activity: { title: "Transfer" }
|
|
15356
|
+
activity: { title: "Transfer" },
|
|
15357
|
+
// Closed with an X, not walked back from: leaving it is the rejection.
|
|
15358
|
+
review: { title: "Confirm transaction", dismiss: "close" }
|
|
15003
15359
|
};
|
|
15360
|
+
var REVIEW_TAB = "review";
|
|
15361
|
+
function isReviewTab(tab) {
|
|
15362
|
+
return tab === REVIEW_TAB;
|
|
15363
|
+
}
|
|
15004
15364
|
var BRIDGE_TABS = ["bridge"];
|
|
15005
15365
|
function isBridgeTab(tab) {
|
|
15006
15366
|
return BRIDGE_TABS.includes(tab);
|
|
15007
15367
|
}
|
|
15008
15368
|
function isWalletMenuCardTab(tab) {
|
|
15009
|
-
return !isBridgeTab(tab);
|
|
15369
|
+
return !isBridgeTab(tab) && !isReviewTab(tab);
|
|
15010
15370
|
}
|
|
15011
15371
|
var MOBILE_BREAKPOINT = 768;
|
|
15012
15372
|
function useIsMobile() {
|
|
@@ -15022,6 +15382,85 @@ function useIsMobile() {
|
|
|
15022
15382
|
}, []);
|
|
15023
15383
|
return !!isMobile;
|
|
15024
15384
|
}
|
|
15385
|
+
function TransactionReviewScreen({
|
|
15386
|
+
operation,
|
|
15387
|
+
network,
|
|
15388
|
+
appName,
|
|
15389
|
+
track,
|
|
15390
|
+
onConfirm,
|
|
15391
|
+
onCancel
|
|
15392
|
+
}) {
|
|
15393
|
+
const badge = CHAIN_BADGE.l2_to_l1;
|
|
15394
|
+
const chainName = getFluentBridgeRoute(network)?.destination.name ?? "Fluent";
|
|
15395
|
+
const address = operation.account?.address;
|
|
15396
|
+
const calls = operation.encodedCalls;
|
|
15397
|
+
const openExplorer = (url) => {
|
|
15398
|
+
track("outbound_link_clicked", {
|
|
15399
|
+
label: "explorer",
|
|
15400
|
+
destination_domain: new URL(url, location.href).hostname,
|
|
15401
|
+
surface: "transaction_review"
|
|
15402
|
+
});
|
|
15403
|
+
const popup = globalThis.window?.open(url, "_blank", "noopener,noreferrer");
|
|
15404
|
+
if (popup) popup.opener = null;
|
|
15405
|
+
};
|
|
15406
|
+
return (
|
|
15407
|
+
// `flex-1`: the drawer lays its page out as a flex column, so the page fills
|
|
15408
|
+
// it and the buttons can sit at the bottom whatever the call count.
|
|
15409
|
+
/* @__PURE__ */ jsxs("div", { className: "flex w-full flex-1 flex-col gap-2.5", "aria-label": "Confirm Fluent transaction", children: [
|
|
15410
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3 py-3", children: [
|
|
15411
|
+
/* @__PURE__ */ jsx("span", { className: "flex size-10 shrink-0 items-center justify-center rounded-full bg-foreground/10", children: /* @__PURE__ */ jsx(Layers, { className: "size-4" }) }),
|
|
15412
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-0 text-center", children: [
|
|
15413
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 max-w-full truncate text-2xl font-medium", children: operation.reviewTitle ?? "Confirm transaction" }),
|
|
15414
|
+
/* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
|
|
15415
|
+
appName,
|
|
15416
|
+
" \xB7 ",
|
|
15417
|
+
calls.length === 1 ? "1 call" : `${calls.length} calls`
|
|
15418
|
+
] })
|
|
15419
|
+
] })
|
|
15420
|
+
] }),
|
|
15421
|
+
/* @__PURE__ */ jsxs("dl", { className: "flex flex-col gap-5 rounded-2xl bg-neutral-900 p-4 text-sm", children: [
|
|
15422
|
+
/* @__PURE__ */ jsx(DetailRow, { label: "Signing account", children: address ? /* @__PURE__ */ jsx(
|
|
15423
|
+
HashMenu,
|
|
15424
|
+
{
|
|
15425
|
+
hash: address,
|
|
15426
|
+
url: explorerAddress(address, network),
|
|
15427
|
+
onOpen: openExplorer,
|
|
15428
|
+
label: "Address"
|
|
15429
|
+
}
|
|
15430
|
+
) : "Fluent account" }),
|
|
15431
|
+
/* @__PURE__ */ jsxs(DetailRow, { label: "Network", children: [
|
|
15432
|
+
/* @__PURE__ */ jsx("span", { className: `flex size-5 items-center justify-center rounded-full ${badge.bgClassName}`, children: /* @__PURE__ */ jsx(Icon, { name: badge.icon, className: `size-3 ${badge.iconClassName}` }) }),
|
|
15433
|
+
chainName
|
|
15434
|
+
] })
|
|
15435
|
+
] }),
|
|
15436
|
+
/* @__PURE__ */ jsx("dl", { className: "flex flex-col gap-5 rounded-2xl bg-neutral-900 p-4 text-sm", "aria-label": "Transaction calls", children: calls.map((call, index) => {
|
|
15437
|
+
const label = call.label ?? operation.calls[index]?.method ?? operation.calls[index]?.functionName ?? "Contract call";
|
|
15438
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
15439
|
+
/* @__PURE__ */ jsx(DetailRow, { label, children: /* @__PURE__ */ jsx(
|
|
15440
|
+
HashMenu,
|
|
15441
|
+
{
|
|
15442
|
+
hash: call.to,
|
|
15443
|
+
url: explorerAddress(call.to, network),
|
|
15444
|
+
onOpen: openExplorer,
|
|
15445
|
+
label: "Contract address"
|
|
15446
|
+
}
|
|
15447
|
+
) }),
|
|
15448
|
+
call.value > 0n ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 text-xs text-muted-foreground", children: [
|
|
15449
|
+
/* @__PURE__ */ jsx("span", { children: "Value" }),
|
|
15450
|
+
/* @__PURE__ */ jsxs("span", { className: "font-medium text-foreground/80", title: `${call.value.toString()} wei`, children: [
|
|
15451
|
+
formatAmount(call.value, 18),
|
|
15452
|
+
" ETH"
|
|
15453
|
+
] })
|
|
15454
|
+
] }) : null
|
|
15455
|
+
] }, call.id ?? `${call.to}-${index}`);
|
|
15456
|
+
}) }),
|
|
15457
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-auto flex flex-col gap-2 pt-2", children: [
|
|
15458
|
+
/* @__PURE__ */ jsx(Button, { type: "button", onClick: onConfirm, children: "Confirm and sign" }),
|
|
15459
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "secondary", onClick: onCancel, children: "Cancel" })
|
|
15460
|
+
] })
|
|
15461
|
+
] })
|
|
15462
|
+
);
|
|
15463
|
+
}
|
|
15025
15464
|
function ReviewDialog({
|
|
15026
15465
|
eyebrow,
|
|
15027
15466
|
title,
|
|
@@ -15080,43 +15519,6 @@ function ReviewDialog({
|
|
|
15080
15519
|
if (!topLayer) return overlay;
|
|
15081
15520
|
return createPortal(/* @__PURE__ */ jsx(FluentTopLayerSlot, { children: overlay }), topLayer.element);
|
|
15082
15521
|
}
|
|
15083
|
-
function BatchOperationReviewModal({
|
|
15084
|
-
operation,
|
|
15085
|
-
onConfirm,
|
|
15086
|
-
onCancel
|
|
15087
|
-
}) {
|
|
15088
|
-
if (!operation) return null;
|
|
15089
|
-
return /* @__PURE__ */ jsx(
|
|
15090
|
-
ReviewDialog,
|
|
15091
|
-
{
|
|
15092
|
-
eyebrow: "Fluent transaction review",
|
|
15093
|
-
title: operation.reviewTitle ?? "Confirm transaction",
|
|
15094
|
-
ariaLabel: "Confirm Fluent transaction",
|
|
15095
|
-
address: operation.account?.address,
|
|
15096
|
-
footnote: "Confirming allows the Fluent embedded signer to sign this ZeroDev UserOperation.",
|
|
15097
|
-
onConfirm,
|
|
15098
|
-
onCancel,
|
|
15099
|
-
children: /* @__PURE__ */ jsx("ul", { className: "my-3 flex list-none flex-col gap-2 p-0", "aria-label": "Transaction calls", children: operation.encodedCalls.map((call, index) => /* @__PURE__ */ jsxs(
|
|
15100
|
-
"li",
|
|
15101
|
-
{
|
|
15102
|
-
className: "flex flex-col gap-1 rounded-xl border border-[#49eded]/20 bg-[#49eded]/10 p-3",
|
|
15103
|
-
children: [
|
|
15104
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
15105
|
-
/* @__PURE__ */ jsx("strong", { className: "text-sm", children: call.label ?? operation.calls[index]?.method ?? operation.calls[index]?.functionName ?? "Contract call" }),
|
|
15106
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-white/65", children: formatAddress(call.to) })
|
|
15107
|
-
] }),
|
|
15108
|
-
call.value > 0n ? /* @__PURE__ */ jsxs("small", { className: "text-xs text-white/65", children: [
|
|
15109
|
-
"Value ",
|
|
15110
|
-
call.value.toString(),
|
|
15111
|
-
" wei"
|
|
15112
|
-
] }) : null
|
|
15113
|
-
]
|
|
15114
|
-
},
|
|
15115
|
-
call.id ?? `${call.to}-${index}`
|
|
15116
|
-
)) })
|
|
15117
|
-
}
|
|
15118
|
-
);
|
|
15119
|
-
}
|
|
15120
15522
|
function formatMessage(message2) {
|
|
15121
15523
|
if (typeof message2 === "string") return message2;
|
|
15122
15524
|
return typeof message2.raw === "string" ? message2.raw : bytesToHex(message2.raw);
|
|
@@ -15691,6 +16093,9 @@ function externalWalletSigner(wallet) {
|
|
|
15691
16093
|
const address = typeof account === "string" ? account : account.address;
|
|
15692
16094
|
return {
|
|
15693
16095
|
address,
|
|
16096
|
+
// Quick sign is a Fluent ID preference; an External wallet always reviews, then
|
|
16097
|
+
// shows its own prompt.
|
|
16098
|
+
review: true,
|
|
15694
16099
|
async resolve() {
|
|
15695
16100
|
return {
|
|
15696
16101
|
signMessage: ({ message: message2 }) => walletClient.signMessage({ account, message: message2 }),
|
|
@@ -15710,15 +16115,19 @@ function createFluentSignApi(executor) {
|
|
|
15710
16115
|
};
|
|
15711
16116
|
const smartAccountSigner = () => ({
|
|
15712
16117
|
address: executor.account.address,
|
|
16118
|
+
review: !executor.silentSigning,
|
|
15713
16119
|
async resolve() {
|
|
15714
|
-
const
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
|
|
15718
|
-
|
|
15719
|
-
);
|
|
16120
|
+
const confirmation = executor.silentSigning ? "session" : "always";
|
|
16121
|
+
const kernel = await executor.ensureReady({ confirmation });
|
|
16122
|
+
if (kernel.signerSource === "privy") return kernel.account;
|
|
16123
|
+
if (confirmation === "session") {
|
|
16124
|
+
const prompted = await executor.ensureReady({ confirmation: "always" });
|
|
16125
|
+
if (prompted.signerSource === "privy") return prompted.account;
|
|
15720
16126
|
}
|
|
15721
|
-
|
|
16127
|
+
throw new FluentAuthError(
|
|
16128
|
+
"root_signer_required",
|
|
16129
|
+
"Only the Fluent ID root signer can sign for the smart account."
|
|
16130
|
+
);
|
|
15722
16131
|
}
|
|
15723
16132
|
});
|
|
15724
16133
|
const pickSigner = () => {
|
|
@@ -15734,25 +16143,29 @@ function createFluentSignApi(executor) {
|
|
|
15734
16143
|
return {
|
|
15735
16144
|
async signMessage({ message: message2 }) {
|
|
15736
16145
|
const signer = pickSigner();
|
|
15737
|
-
|
|
15738
|
-
|
|
15739
|
-
|
|
15740
|
-
|
|
15741
|
-
|
|
15742
|
-
|
|
15743
|
-
|
|
16146
|
+
if (signer.review) {
|
|
16147
|
+
await executor.confirm({
|
|
16148
|
+
kind: "message",
|
|
16149
|
+
origin: executor.origin,
|
|
16150
|
+
account: executor.account,
|
|
16151
|
+
address: signer.address,
|
|
16152
|
+
message: message2
|
|
16153
|
+
});
|
|
16154
|
+
}
|
|
15744
16155
|
return (await signer.resolve()).signMessage({ message: message2 });
|
|
15745
16156
|
},
|
|
15746
16157
|
async signTypedData(typedData) {
|
|
15747
16158
|
const signer = pickSigner();
|
|
15748
16159
|
const request = typedData;
|
|
15749
|
-
|
|
15750
|
-
|
|
15751
|
-
|
|
15752
|
-
|
|
15753
|
-
|
|
15754
|
-
|
|
15755
|
-
|
|
16160
|
+
if (signer.review) {
|
|
16161
|
+
await executor.confirm({
|
|
16162
|
+
kind: "typedData",
|
|
16163
|
+
origin: executor.origin,
|
|
16164
|
+
account: executor.account,
|
|
16165
|
+
address: signer.address,
|
|
16166
|
+
typedData: request
|
|
16167
|
+
});
|
|
16168
|
+
}
|
|
15756
16169
|
return (await signer.resolve()).signTypedData(request);
|
|
15757
16170
|
}
|
|
15758
16171
|
};
|
|
@@ -15871,6 +16284,7 @@ function useWidgetExecution(params) {
|
|
|
15871
16284
|
authMode,
|
|
15872
16285
|
account: widgetAccount,
|
|
15873
16286
|
origin: window.location.origin,
|
|
16287
|
+
silentSigning: defaultConfirmationMode === "session",
|
|
15874
16288
|
confirm: confirmSignature,
|
|
15875
16289
|
ensureReady: async (options) => {
|
|
15876
16290
|
const kernel = await smartAccount.ensureExecutionReady(options);
|
|
@@ -15884,7 +16298,14 @@ function useWidgetExecution(params) {
|
|
|
15884
16298
|
},
|
|
15885
16299
|
wallet: wallet?.connected ? wallet : void 0
|
|
15886
16300
|
}),
|
|
15887
|
-
[
|
|
16301
|
+
[
|
|
16302
|
+
authMode,
|
|
16303
|
+
widgetAccount,
|
|
16304
|
+
defaultConfirmationMode,
|
|
16305
|
+
confirmSignature,
|
|
16306
|
+
smartAccount.ensureExecutionReady,
|
|
16307
|
+
wallet
|
|
16308
|
+
]
|
|
15888
16309
|
);
|
|
15889
16310
|
return useMemo(
|
|
15890
16311
|
() => ({
|
|
@@ -15911,6 +16332,7 @@ function useTokenTransfer(params) {
|
|
|
15911
16332
|
async (request) => {
|
|
15912
16333
|
const { token, to, amount, gasSymbol } = request;
|
|
15913
16334
|
const pendingId = beginTransfer({
|
|
16335
|
+
tokenIdentity: token.identity,
|
|
15914
16336
|
symbol: token.symbol,
|
|
15915
16337
|
amount: formatUnits(amount, token.decimals),
|
|
15916
16338
|
to,
|
|
@@ -15954,6 +16376,83 @@ function useTokenTransfer(params) {
|
|
|
15954
16376
|
[beginTransfer, settleTransfer, endTransfer, track, widget]
|
|
15955
16377
|
);
|
|
15956
16378
|
}
|
|
16379
|
+
var FLUENT_USDNR_MINT_OP_ID = "fluent-mint-usdnr";
|
|
16380
|
+
var FLUENT_USDNR_MINT_REVIEW_TITLE = "Get USDnr";
|
|
16381
|
+
var FLUENT_USDNR_MINT_AMOUNT = 1e3;
|
|
16382
|
+
var fluentUsdnrMintAbi = parseAbi(["function mint(address to, uint256 amount)"]);
|
|
16383
|
+
function getFluentUsdnrMintToken() {
|
|
16384
|
+
return getFluentTokenDefaultsForNetwork("testnet").USDnr;
|
|
16385
|
+
}
|
|
16386
|
+
function buildFluentUsdnrMintCall(recipient) {
|
|
16387
|
+
const token = getFluentUsdnrMintToken();
|
|
16388
|
+
return {
|
|
16389
|
+
id: FLUENT_USDNR_MINT_OP_ID,
|
|
16390
|
+
label: `Mint ${FLUENT_USDNR_MINT_AMOUNT} ${token.symbol}`,
|
|
16391
|
+
to: token.address,
|
|
16392
|
+
abi: fluentUsdnrMintAbi,
|
|
16393
|
+
method: "mint",
|
|
16394
|
+
args: [recipient, parseUnits(String(FLUENT_USDNR_MINT_AMOUNT), token.decimals)]
|
|
16395
|
+
};
|
|
16396
|
+
}
|
|
16397
|
+
|
|
16398
|
+
// src/widget/hooks/useUsdnrMint.ts
|
|
16399
|
+
function openExplorerTab(url) {
|
|
16400
|
+
const popup = globalThis.window?.open(url, "_blank", "noopener,noreferrer");
|
|
16401
|
+
if (popup) {
|
|
16402
|
+
popup.opener = null;
|
|
16403
|
+
}
|
|
16404
|
+
}
|
|
16405
|
+
function useUsdnrMint(params) {
|
|
16406
|
+
const { widget, network, gasSymbol, track } = params;
|
|
16407
|
+
const [minting, setMinting] = useState(false);
|
|
16408
|
+
const inFlight = useRef(false);
|
|
16409
|
+
const mintUsdnr = useCallback(
|
|
16410
|
+
async (recipient) => {
|
|
16411
|
+
if (inFlight.current) return { status: "skipped" };
|
|
16412
|
+
inFlight.current = true;
|
|
16413
|
+
setMinting(true);
|
|
16414
|
+
const token = getFluentUsdnrMintToken();
|
|
16415
|
+
try {
|
|
16416
|
+
const operation = widget.createBatchOp({
|
|
16417
|
+
id: FLUENT_USDNR_MINT_OP_ID,
|
|
16418
|
+
reviewTitle: FLUENT_USDNR_MINT_REVIEW_TITLE,
|
|
16419
|
+
calls: [buildFluentUsdnrMintCall(recipient)]
|
|
16420
|
+
});
|
|
16421
|
+
const { hash } = await operation.execute({ gasPayment: { symbol: gasSymbol } });
|
|
16422
|
+
toast.add({
|
|
16423
|
+
type: "success",
|
|
16424
|
+
title: `Minted ${FLUENT_USDNR_MINT_AMOUNT} ${token.symbol}`,
|
|
16425
|
+
description: `Transaction ${formatAddress(hash)}`,
|
|
16426
|
+
actionProps: {
|
|
16427
|
+
children: "View",
|
|
16428
|
+
onClick: () => openExplorerTab(explorerTransaction(hash, network))
|
|
16429
|
+
}
|
|
16430
|
+
});
|
|
16431
|
+
track("wallet_usdnr_minted", { gas_symbol: gasSymbol });
|
|
16432
|
+
return { status: "minted", hash };
|
|
16433
|
+
} catch (error) {
|
|
16434
|
+
if (error instanceof FluentReviewRejectedError) {
|
|
16435
|
+
track("wallet_usdnr_mint_failed", { reason: "rejected" });
|
|
16436
|
+
return { status: "rejected" };
|
|
16437
|
+
}
|
|
16438
|
+
debugError("[FluentWidget] USDnr mint failed", error);
|
|
16439
|
+
const message2 = error instanceof Error ? error.message : "The mint was not sent.";
|
|
16440
|
+
toast.add({
|
|
16441
|
+
type: "error",
|
|
16442
|
+
title: `Could not get ${token.symbol}`,
|
|
16443
|
+
description: message2
|
|
16444
|
+
});
|
|
16445
|
+
track("wallet_usdnr_mint_failed", { reason: "execution_failed" });
|
|
16446
|
+
return { status: "failed", message: message2 };
|
|
16447
|
+
} finally {
|
|
16448
|
+
inFlight.current = false;
|
|
16449
|
+
setMinting(false);
|
|
16450
|
+
}
|
|
16451
|
+
},
|
|
16452
|
+
[gasSymbol, network, track, widget]
|
|
16453
|
+
);
|
|
16454
|
+
return { mintUsdnr, mintingUsdnr: minting };
|
|
16455
|
+
}
|
|
15957
16456
|
function useZeroDevInitializer(params) {
|
|
15958
16457
|
const { smartAccount, directAuth, session, widgetAccount } = params;
|
|
15959
16458
|
const initRequested = useRef(false);
|
|
@@ -17190,6 +17689,7 @@ function FluentAccountDrawer({
|
|
|
17190
17689
|
onAccountMenuAction,
|
|
17191
17690
|
subPageTitle,
|
|
17192
17691
|
onCloseSubPage,
|
|
17692
|
+
subPageDismiss = "back",
|
|
17193
17693
|
settingsOpen,
|
|
17194
17694
|
onCloseSettings,
|
|
17195
17695
|
modal,
|
|
@@ -17200,11 +17700,19 @@ function FluentAccountDrawer({
|
|
|
17200
17700
|
}) {
|
|
17201
17701
|
const subPage = subPageTitle ?? (settingsOpen ? "Settings" : null);
|
|
17202
17702
|
const closeSubPage = onCloseSubPage ?? onCloseSettings;
|
|
17703
|
+
const drawerActions = useRef(null);
|
|
17704
|
+
const wasConnected = useRef(hasConnectedAccount);
|
|
17705
|
+
useEffect(() => {
|
|
17706
|
+
if (wasConnected.current === hasConnectedAccount) return;
|
|
17707
|
+
wasConnected.current = hasConnectedAccount;
|
|
17708
|
+
if (!hasConnectedAccount) drawerActions.current?.unmount();
|
|
17709
|
+
}, [hasConnectedAccount]);
|
|
17203
17710
|
return /* @__PURE__ */ jsxs(
|
|
17204
17711
|
Drawer,
|
|
17205
17712
|
{
|
|
17206
17713
|
open: hasConnectedAccount && accountOpen,
|
|
17207
17714
|
onOpenChange: setAccountOpen,
|
|
17715
|
+
actionsRef: drawerActions,
|
|
17208
17716
|
swipeDirection: isMobile ? "down" : "right",
|
|
17209
17717
|
modal,
|
|
17210
17718
|
disablePointerDismissal,
|
|
@@ -17216,10 +17724,10 @@ function FluentAccountDrawer({
|
|
|
17216
17724
|
"button",
|
|
17217
17725
|
{
|
|
17218
17726
|
type: "button",
|
|
17219
|
-
"aria-label": "Back",
|
|
17220
|
-
className:
|
|
17727
|
+
"aria-label": subPageDismiss === "close" ? "Close" : "Back",
|
|
17728
|
+
className: `absolute inline-flex size-8 items-center justify-center rounded-lg text-foreground/70 transition-colors hover:bg-foreground/5 hover:text-foreground ${subPageDismiss === "close" ? "right-0" : "left-0"}`,
|
|
17221
17729
|
onClick: closeSubPage,
|
|
17222
|
-
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-5" })
|
|
17730
|
+
children: subPageDismiss === "close" ? /* @__PURE__ */ jsx(X, { className: "size-5" }) : /* @__PURE__ */ jsx(ChevronLeft, { className: "size-5" })
|
|
17223
17731
|
}
|
|
17224
17732
|
),
|
|
17225
17733
|
/* @__PURE__ */ jsx(DrawerTitle, { className: "text-sm font-medium leading-none text-foreground", children: subPage })
|
|
@@ -17367,6 +17875,7 @@ function directLoginDialogMarksPresent() {
|
|
|
17367
17875
|
}
|
|
17368
17876
|
var LINK_X_IN_PROGRESS_REFUSAL = "Linking X to your wallet is still in progress. Try again when it finishes.";
|
|
17369
17877
|
var SETTLED_TRANSFER_GRACE_MS = 9e4;
|
|
17878
|
+
var SETTLED_TRANSFER_RETENTION_MS = 30 * 6e4;
|
|
17370
17879
|
var LINK_X_IDENTITY_TOKEN_TIMEOUT_MS = 1e4;
|
|
17371
17880
|
var LINK_X_SIWE_STEP_TIMEOUT_MS = LINK_X_IDENTITY_TOKEN_TIMEOUT_MS;
|
|
17372
17881
|
var LINK_X_WALLET_SIGNATURE_TIMEOUT_MS = 5 * 6e4;
|
|
@@ -17654,6 +18163,10 @@ function FluentWidgetContent({
|
|
|
17654
18163
|
});
|
|
17655
18164
|
const subPage = WALLET_MENU_SUB_PAGES[walletMenuTab] ?? null;
|
|
17656
18165
|
const lastMenuTabRef = useRef(subPage ? "home" : walletMenuTab);
|
|
18166
|
+
const walletMenuTabRef = useRef(walletMenuTab);
|
|
18167
|
+
walletMenuTabRef.current = walletMenuTab;
|
|
18168
|
+
const accountOpenRef = useRef(accountOpen);
|
|
18169
|
+
accountOpenRef.current = accountOpen;
|
|
17657
18170
|
useEffect(() => {
|
|
17658
18171
|
if (!WALLET_MENU_SUB_PAGES[walletMenuTab]) lastMenuTabRef.current = walletMenuTab;
|
|
17659
18172
|
}, [walletMenuTab]);
|
|
@@ -17662,7 +18175,13 @@ function FluentWidgetContent({
|
|
|
17662
18175
|
setWalletMenuTab(lastMenuTabRef.current);
|
|
17663
18176
|
}
|
|
17664
18177
|
}, [accountOpen, setWalletMenuTab, walletMenuTab]);
|
|
18178
|
+
const cancelReviewRef = useRef(() => {
|
|
18179
|
+
});
|
|
17665
18180
|
const closeSubPage = useCallback(() => {
|
|
18181
|
+
if (isReviewTab(walletMenuTab)) {
|
|
18182
|
+
cancelReviewRef.current();
|
|
18183
|
+
return;
|
|
18184
|
+
}
|
|
17666
18185
|
setWalletMenuTab(
|
|
17667
18186
|
WALLET_MENU_SUB_PAGES[walletMenuTab]?.parent ?? lastMenuTabRef.current
|
|
17668
18187
|
);
|
|
@@ -17817,8 +18336,43 @@ function FluentWidgetContent({
|
|
|
17817
18336
|
openConnectFlow();
|
|
17818
18337
|
}, [directAuth, openConnectFlow, startDirectFluentLogin]);
|
|
17819
18338
|
const closeAccountMenu = useCallback(() => setAccountOpen(false), [setAccountOpen]);
|
|
17820
|
-
const
|
|
18339
|
+
const reviewOriginRef = useRef(null);
|
|
18340
|
+
const openReviewPage = useCallback(() => {
|
|
18341
|
+
if (!isReviewTab(walletMenuTabRef.current)) {
|
|
18342
|
+
reviewOriginRef.current = { tab: walletMenuTabRef.current, open: accountOpenRef.current };
|
|
18343
|
+
}
|
|
18344
|
+
setWalletMenuTab(REVIEW_TAB);
|
|
18345
|
+
setAccountOpen(true);
|
|
18346
|
+
}, [setAccountOpen, setWalletMenuTab]);
|
|
18347
|
+
const { batchReview, confirmBatchOperation, acceptBatchReview, rejectBatchReview } = useBatchReview({ onOpen: openReviewPage });
|
|
17821
18348
|
const { signatureReview, confirmSignature, acceptSignatureReview, rejectSignatureReview } = useSignatureReview({ onOpen: closeAccountMenu });
|
|
18349
|
+
const leaveReviewPage = useCallback(
|
|
18350
|
+
(outcome) => {
|
|
18351
|
+
const origin = reviewOriginRef.current;
|
|
18352
|
+
reviewOriginRef.current = null;
|
|
18353
|
+
const wasSend = batchReview?.id === FLUENT_SEND_TOKEN_OP_ID;
|
|
18354
|
+
if (outcome === "confirmed" && wasSend) {
|
|
18355
|
+
setWalletMenuTab("home");
|
|
18356
|
+
setAccountOpen(true);
|
|
18357
|
+
return;
|
|
18358
|
+
}
|
|
18359
|
+
setWalletMenuTab(origin?.tab ?? "home");
|
|
18360
|
+
setAccountOpen(origin?.open ?? false);
|
|
18361
|
+
},
|
|
18362
|
+
[batchReview?.id, setAccountOpen, setWalletMenuTab]
|
|
18363
|
+
);
|
|
18364
|
+
const confirmReview = useCallback(() => {
|
|
18365
|
+
acceptBatchReview();
|
|
18366
|
+
leaveReviewPage("confirmed");
|
|
18367
|
+
}, [acceptBatchReview, leaveReviewPage]);
|
|
18368
|
+
const cancelReview = useCallback(() => {
|
|
18369
|
+
rejectBatchReview();
|
|
18370
|
+
leaveReviewPage("cancelled");
|
|
18371
|
+
}, [leaveReviewPage, rejectBatchReview]);
|
|
18372
|
+
cancelReviewRef.current = cancelReview;
|
|
18373
|
+
useEffect(() => {
|
|
18374
|
+
if (!accountOpen && batchReview) rejectBatchReview();
|
|
18375
|
+
}, [accountOpen, batchReview, rejectBatchReview]);
|
|
17822
18376
|
const widgetApi = useWidgetExecution({
|
|
17823
18377
|
chain,
|
|
17824
18378
|
fluentAccountReady,
|
|
@@ -17853,7 +18407,12 @@ function FluentWidgetContent({
|
|
|
17853
18407
|
setPendingTransfers(
|
|
17854
18408
|
(list) => list.map((transfer) => transfer.id === id ? { ...transfer, hash } : transfer)
|
|
17855
18409
|
);
|
|
17856
|
-
setTimeout(() =>
|
|
18410
|
+
setTimeout(() => {
|
|
18411
|
+
setPendingTransfers(
|
|
18412
|
+
(list) => list.map((transfer) => transfer.id === id ? { ...transfer, expired: true } : transfer)
|
|
18413
|
+
);
|
|
18414
|
+
}, SETTLED_TRANSFER_GRACE_MS);
|
|
18415
|
+
setTimeout(() => endTransfer(id), SETTLED_TRANSFER_RETENTION_MS);
|
|
17857
18416
|
},
|
|
17858
18417
|
[endTransfer]
|
|
17859
18418
|
);
|
|
@@ -17864,6 +18423,12 @@ function FluentWidgetContent({
|
|
|
17864
18423
|
settleTransfer,
|
|
17865
18424
|
endTransfer
|
|
17866
18425
|
});
|
|
18426
|
+
const { mintUsdnr, mintingUsdnr } = useUsdnrMint({
|
|
18427
|
+
widget: widgetApi,
|
|
18428
|
+
network: resolvedConfig.network,
|
|
18429
|
+
gasSymbol: gasPaymentToken,
|
|
18430
|
+
track
|
|
18431
|
+
});
|
|
17867
18432
|
const gasContext = useMemo(
|
|
17868
18433
|
() => resolveFluentTransferGasContext({
|
|
17869
18434
|
fluentAccountAddress,
|
|
@@ -18368,6 +18933,7 @@ function FluentWidgetContent({
|
|
|
18368
18933
|
accountMenuAddress,
|
|
18369
18934
|
onAccountMenuAction: handleAccountMenuAction,
|
|
18370
18935
|
subPageTitle: subPage?.title ?? null,
|
|
18936
|
+
subPageDismiss: subPage?.dismiss,
|
|
18371
18937
|
onCloseSubPage: closeSubPage,
|
|
18372
18938
|
userLogoUrl: accountAvatarUrl,
|
|
18373
18939
|
defaultLogoUrl,
|
|
@@ -18388,7 +18954,17 @@ function FluentWidgetContent({
|
|
|
18388
18954
|
defaultLogoUrl
|
|
18389
18955
|
}
|
|
18390
18956
|
),
|
|
18391
|
-
children:
|
|
18957
|
+
children: isReviewTab(walletMenuTab) ? batchReview ? /* @__PURE__ */ jsx(
|
|
18958
|
+
TransactionReviewScreen,
|
|
18959
|
+
{
|
|
18960
|
+
operation: batchReview,
|
|
18961
|
+
network: resolvedConfig.network,
|
|
18962
|
+
appName: resolvedConfig.appName,
|
|
18963
|
+
track,
|
|
18964
|
+
onConfirm: confirmReview,
|
|
18965
|
+
onCancel: cancelReview
|
|
18966
|
+
}
|
|
18967
|
+
) : null : isWalletMenuCardTab(walletMenuTab) ? /* @__PURE__ */ jsx(
|
|
18392
18968
|
WalletMenuActionCard,
|
|
18393
18969
|
{
|
|
18394
18970
|
track,
|
|
@@ -18418,6 +18994,8 @@ function FluentWidgetContent({
|
|
|
18418
18994
|
onPanelChange: setWalletMenuPanel,
|
|
18419
18995
|
onSendToken: sendToken,
|
|
18420
18996
|
pendingTransfers,
|
|
18997
|
+
onMintUsdnr: mintUsdnr,
|
|
18998
|
+
mintUsdnrBusy: mintingUsdnr,
|
|
18421
18999
|
onRevealAccount: () => setAccountOpen(true),
|
|
18422
19000
|
gasContext
|
|
18423
19001
|
}
|
|
@@ -18475,20 +19053,6 @@ function FluentWidgetContent({
|
|
|
18475
19053
|
}
|
|
18476
19054
|
}
|
|
18477
19055
|
),
|
|
18478
|
-
/* @__PURE__ */ jsx(
|
|
18479
|
-
BatchOperationReviewModal,
|
|
18480
|
-
{
|
|
18481
|
-
operation: batchReview,
|
|
18482
|
-
onConfirm: () => {
|
|
18483
|
-
const wasSend = batchReview?.id === FLUENT_SEND_TOKEN_OP_ID;
|
|
18484
|
-
acceptBatchReview();
|
|
18485
|
-
if (!wasSend) return;
|
|
18486
|
-
setWalletMenuTab("home");
|
|
18487
|
-
setAccountOpen(true);
|
|
18488
|
-
},
|
|
18489
|
-
onCancel: rejectBatchReview
|
|
18490
|
-
}
|
|
18491
|
-
),
|
|
18492
19056
|
/* @__PURE__ */ jsx(
|
|
18493
19057
|
SignatureReviewModal,
|
|
18494
19058
|
{
|