@flapsdk/vault-runtime 0.1.23 → 0.1.25
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 +2 -2
- package/chunk-CPAMDXX7.js +45 -0
- package/chunk-CPAMDXX7.js.map +1 -0
- package/chunk-GA5VEHC2.js +40 -0
- package/chunk-GA5VEHC2.js.map +1 -0
- package/chunk-JLI25XFB.js +78 -0
- package/chunk-JLI25XFB.js.map +1 -0
- package/chunk-SYEMIHOY.js +408 -0
- package/chunk-SYEMIHOY.js.map +1 -0
- package/chunk-WX6B7JWO.js +183 -0
- package/chunk-WX6B7JWO.js.map +1 -0
- package/chunk-XGUVYKIJ.js +185 -0
- package/chunk-XGUVYKIJ.js.map +1 -0
- package/chunk-ZK3O6QPF.js +544 -0
- package/chunk-ZK3O6QPF.js.map +1 -0
- package/host.d.mts +4 -4
- package/host.js +8 -555
- package/host.js.map +1 -1
- package/hostRuntimeConfig-C_JJVgY0.d.mts +34 -0
- package/package.json +2 -2
- package/runtime-contract.json +1 -1
- package/sdk.d.mts +64 -11
- package/sdk.js +103 -509
- package/sdk.js.map +1 -1
- package/server.d.mts +12 -24
- package/server.js +197 -277
- package/server.js.map +1 -1
- package/{txError-XMLOEthr.d.mts → txError-BEercCCG.d.mts} +1 -1
- package/{types-BO7AzXbw.d.mts → types-RxLUOC02.d.mts} +29 -1
- package/ui.d.mts +13 -2
- package/ui.js +3 -522
- package/ui.js.map +1 -1
- package/hostRuntimeConfig-B9Od3Mc7.d.mts +0 -14
package/ui.js
CHANGED
|
@@ -1,525 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
5
|
-
import { clsx } from 'clsx';
|
|
6
|
-
import { twMerge } from 'tailwind-merge';
|
|
7
|
-
import * as React4 from 'react';
|
|
8
|
-
import { useState, useEffect, useMemo } from 'react';
|
|
9
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
10
|
-
import { cva } from 'class-variance-authority';
|
|
11
|
-
import { createPortal } from 'react-dom';
|
|
12
|
-
|
|
13
|
-
function shortenAddress(raw, start = 6, end = 4) {
|
|
14
|
-
if (!raw) return "";
|
|
15
|
-
if (raw.length <= start + end) return raw;
|
|
16
|
-
return `${raw.slice(0, start)}...${raw.slice(-end)}`;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// src/ui/AddressLink.tsx
|
|
20
|
-
function AddressLink({ address, explorerBaseUrl, label }) {
|
|
21
|
-
if (!address) return /* @__PURE__ */ React.createElement("span", null, "-");
|
|
22
|
-
const href = explorerBaseUrl ? `${explorerBaseUrl.replace(/\/$/, "")}/address/${address}` : void 0;
|
|
23
|
-
const content = /* @__PURE__ */ React.createElement("span", { className: "inline-flex min-w-0 items-center gap-1 text-primary" }, /* @__PURE__ */ React.createElement("span", { className: "truncate" }, label || shortenAddress(address)), href ? /* @__PURE__ */ React.createElement(ExternalLink, { className: "h-3.5 w-3.5 shrink-0" }) : null);
|
|
24
|
-
return href ? /* @__PURE__ */ React.createElement("a", { href, target: "_blank", rel: "noreferrer" }, content) : content;
|
|
25
|
-
}
|
|
26
|
-
function cn(...inputs) {
|
|
27
|
-
return twMerge(clsx(inputs));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// src/ui/Alert.tsx
|
|
31
|
-
var toneClass = {
|
|
32
|
-
info: "border-[#303236] bg-black text-[#D4D4D4]",
|
|
33
|
-
success: "border-[#D0FF00]/45 bg-[#101400] text-[#D0FF00]",
|
|
34
|
-
warning: "border-[#FFD166]/45 bg-[#1A1305] text-[#FFD166]",
|
|
35
|
-
danger: "border-[#FF4A55]/55 bg-[#1D0709] text-[#FF8A91]"
|
|
36
|
-
};
|
|
37
|
-
var iconMap = {
|
|
38
|
-
info: Info,
|
|
39
|
-
success: CheckCircle2,
|
|
40
|
-
warning: AlertTriangle,
|
|
41
|
-
danger: AlertTriangle
|
|
42
|
-
};
|
|
43
|
-
function Alert({ children, tone = "info", className }) {
|
|
44
|
-
const Icon = iconMap[tone];
|
|
45
|
-
return /* @__PURE__ */ React.createElement("div", { "data-flap-ui": "alert", className: cn("flex gap-3 rounded-[6px] border p-3 text-sm font-medium leading-6", toneClass[tone], className) }, /* @__PURE__ */ React.createElement(Icon, { className: "mt-0.5 h-4 w-4 shrink-0 opacity-90" }), /* @__PURE__ */ React.createElement("div", { className: "min-w-0 break-words" }, children));
|
|
46
|
-
}
|
|
47
|
-
var buttonVariants = cva(
|
|
48
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-semibold uppercase leading-[1.4] tracking-normal duration-0 hover:transition-colors hover:duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#D0FF00]/45 disabled:pointer-events-none disabled:opacity-50",
|
|
49
|
-
{
|
|
50
|
-
variants: {
|
|
51
|
-
variant: {
|
|
52
|
-
default: "ui20-connect-chamfer text-[#070808] [--ui20-chamfer-bg:#D0FF00] [--ui20-chamfer-border:#D0FF00] hover:[--ui20-chamfer-bg:#BDE800] hover:[--ui20-chamfer-border:#BDE800]",
|
|
53
|
-
secondary: "ui20-connect-chamfer text-white [--ui20-chamfer-bg:#262626] [--ui20-chamfer-border:#262626] hover:text-[#D0FF00] hover:[--ui20-chamfer-bg:#303030] hover:[--ui20-chamfer-border:#303030]",
|
|
54
|
-
outline: "ui20-connect-chamfer text-[#D4D4D4] [--ui20-chamfer-bg:#000000] [--ui20-chamfer-border:#303236] hover:text-[#D0FF00] hover:[--ui20-chamfer-border:#D0FF00]",
|
|
55
|
-
ghost: "rounded-[6px] text-[#D4D4D4] hover:bg-[#131516] hover:text-[#D0FF00]",
|
|
56
|
-
destructive: "ui20-connect-chamfer text-[#FF4A55] [--ui20-chamfer-bg:#000000] [--ui20-chamfer-border:#FF4A55] hover:text-black hover:[--ui20-chamfer-bg:#FF4A55]"
|
|
57
|
-
},
|
|
58
|
-
size: {
|
|
59
|
-
default: "h-10 px-4",
|
|
60
|
-
sm: "h-8 px-3 text-xs",
|
|
61
|
-
lg: "h-12 px-5",
|
|
62
|
-
icon: "h-10 w-10 px-0"
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
defaultVariants: {
|
|
66
|
-
variant: "default",
|
|
67
|
-
size: "default"
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
var Button = React4.forwardRef(
|
|
72
|
-
({ className, variant, size, asChild = false, loading = false, disabled, children, ...props }, ref) => {
|
|
73
|
-
const Comp = asChild ? Slot : "button";
|
|
74
|
-
if (asChild) {
|
|
75
|
-
return /* @__PURE__ */ React4.createElement(Comp, { "data-flap-ui": "button", className: cn(buttonVariants({ variant, size, className })), ref, ...props }, children);
|
|
76
|
-
}
|
|
77
|
-
return /* @__PURE__ */ React4.createElement(
|
|
78
|
-
Comp,
|
|
79
|
-
{
|
|
80
|
-
"data-flap-ui": "button",
|
|
81
|
-
className: cn(buttonVariants({ variant, size, className })),
|
|
82
|
-
ref,
|
|
83
|
-
disabled: disabled || loading,
|
|
84
|
-
...props
|
|
85
|
-
},
|
|
86
|
-
loading ? /* @__PURE__ */ React4.createElement(Loader2, { className: "relative z-10 h-4 w-4 animate-spin" }) : null,
|
|
87
|
-
/* @__PURE__ */ React4.createElement("span", { className: "relative z-10 inline-flex min-w-0 items-center justify-center gap-2" }, children)
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
Button.displayName = "Button";
|
|
92
|
-
var Card = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React4.createElement(
|
|
93
|
-
"div",
|
|
94
|
-
{
|
|
95
|
-
"data-flap-ui": "card",
|
|
96
|
-
ref,
|
|
97
|
-
className: cn(
|
|
98
|
-
"rounded-[8px] border border-[#303236] bg-[#070808] text-white shadow-[0_18px_60px_-42px_rgba(208,255,0,0.45)]",
|
|
99
|
-
className
|
|
100
|
-
),
|
|
101
|
-
...props
|
|
102
|
-
}
|
|
103
|
-
));
|
|
104
|
-
Card.displayName = "Card";
|
|
105
|
-
var CardHeader = React4.forwardRef(
|
|
106
|
-
({ className, ...props }, ref) => /* @__PURE__ */ React4.createElement("div", { "data-flap-ui": "card-header", ref, className: cn("flex flex-col gap-1.5 p-4 sm:p-5", className), ...props })
|
|
107
|
-
);
|
|
108
|
-
CardHeader.displayName = "CardHeader";
|
|
109
|
-
var CardTitle = React4.forwardRef(
|
|
110
|
-
({ className, ...props }, ref) => /* @__PURE__ */ React4.createElement("h3", { "data-flap-ui": "card-title", ref, className: cn("text-base font-semibold uppercase leading-tight tracking-normal text-white sm:text-lg", className), ...props })
|
|
111
|
-
);
|
|
112
|
-
CardTitle.displayName = "CardTitle";
|
|
113
|
-
var CardDescription = React4.forwardRef(
|
|
114
|
-
({ className, ...props }, ref) => /* @__PURE__ */ React4.createElement("p", { "data-flap-ui": "card-description", ref, className: cn("text-sm leading-6 text-[#84888C]", className), ...props })
|
|
115
|
-
);
|
|
116
|
-
CardDescription.displayName = "CardDescription";
|
|
117
|
-
var CardContent = React4.forwardRef(
|
|
118
|
-
({ className, ...props }, ref) => /* @__PURE__ */ React4.createElement("div", { "data-flap-ui": "card-content", ref, className: cn("p-4 pt-0 sm:p-5 sm:pt-0", className), ...props })
|
|
119
|
-
);
|
|
120
|
-
CardContent.displayName = "CardContent";
|
|
121
|
-
function formatMs(ms) {
|
|
122
|
-
const safe = Math.max(0, ms);
|
|
123
|
-
const totalSeconds = Math.floor(safe / 1e3);
|
|
124
|
-
const days = Math.floor(totalSeconds / 86400);
|
|
125
|
-
const hours = Math.floor(totalSeconds % 86400 / 3600);
|
|
126
|
-
const minutes = Math.floor(totalSeconds % 3600 / 60);
|
|
127
|
-
const seconds = totalSeconds % 60;
|
|
128
|
-
if (days > 0) return `${days}d ${hours}h ${minutes}m`;
|
|
129
|
-
if (hours > 0) return `${hours}h ${minutes}m ${seconds}s`;
|
|
130
|
-
return `${minutes}m ${seconds}s`;
|
|
131
|
-
}
|
|
132
|
-
function Countdown({ targetTimeMs, fallback = "-" }) {
|
|
133
|
-
const [now, setNow] = useState(() => Date.now());
|
|
134
|
-
useEffect(() => {
|
|
135
|
-
const timer = window.setInterval(() => setNow(Date.now()), 1e3);
|
|
136
|
-
return () => window.clearInterval(timer);
|
|
137
|
-
}, []);
|
|
138
|
-
const text = useMemo(() => {
|
|
139
|
-
if (!targetTimeMs) return fallback;
|
|
140
|
-
return formatMs(targetTimeMs - now);
|
|
141
|
-
}, [fallback, now, targetTimeMs]);
|
|
142
|
-
return /* @__PURE__ */ React.createElement("span", null, text);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// src/ui/DataRow.tsx
|
|
146
|
-
function DataRow({ label, value, detail, className }) {
|
|
147
|
-
return /* @__PURE__ */ React.createElement("div", { className: cn("flex items-start justify-between gap-4 border-b border-white/8 py-3 last:border-0", className) }, /* @__PURE__ */ React.createElement("div", { className: "min-w-0 text-sm text-white/54" }, label), /* @__PURE__ */ React.createElement("div", { className: "min-w-0 text-right" }, /* @__PURE__ */ React.createElement("div", { className: "break-words text-sm font-semibold text-white" }, value), detail ? /* @__PURE__ */ React.createElement("div", { className: "mt-1 text-xs text-white/42" }, detail) : null));
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// src/ui/DetailTile.tsx
|
|
151
|
-
var toneClass2 = {
|
|
152
|
-
default: "border-[#303236] bg-[#0B0D0E]",
|
|
153
|
-
primary: "border-[#D0FF00]/70 bg-[#101400]",
|
|
154
|
-
success: "border-[#2EDEDB]/45 bg-[#061615]",
|
|
155
|
-
warning: "border-[#FFD166]/45 bg-[#1A1305]",
|
|
156
|
-
muted: "border-[#303236] bg-black"
|
|
157
|
-
};
|
|
158
|
-
function DetailTile({ label, value, detail, icon, tone = "default", className, valueClassName }) {
|
|
159
|
-
return /* @__PURE__ */ React.createElement("div", { "data-flap-ui": "detail-tile", className: cn("min-w-0 rounded-[6px] border p-3", toneClass2[tone], className) }, /* @__PURE__ */ React.createElement("div", { className: "flex min-w-0 items-center gap-2 text-xs font-medium uppercase leading-[1.4] text-[#84888C]" }, icon ? /* @__PURE__ */ React.createElement("span", { className: "shrink-0 text-[#D0FF00]" }, icon) : null, /* @__PURE__ */ React.createElement("span", { className: "min-w-0 truncate" }, label)), /* @__PURE__ */ React.createElement("div", { className: cn("mt-2 min-w-0 break-words text-base font-semibold leading-snug text-white", valueClassName) }, value), detail ? /* @__PURE__ */ React.createElement("div", { className: "mt-1 min-w-0 break-words text-xs leading-5 text-[#84888C]" }, detail) : null);
|
|
160
|
-
}
|
|
161
|
-
var COPY = {
|
|
162
|
-
en: {
|
|
163
|
-
title: "THIRD-PARTY WARNING",
|
|
164
|
-
heading: "YOU ARE LEAVING FLAP",
|
|
165
|
-
description: "You are about to visit a third-party page maintained by an external developer. This site is not operated by FLAP and may contain unknown security or privacy risks.",
|
|
166
|
-
destinationLabel: "Destination",
|
|
167
|
-
invalidDestination: "Unsupported destination",
|
|
168
|
-
acknowledge: "I understand the risks and want to proceed",
|
|
169
|
-
cancel: "CLOSE",
|
|
170
|
-
proceed: "CONTINUE"
|
|
171
|
-
},
|
|
172
|
-
zh: {
|
|
173
|
-
title: "\u7B2C\u4E09\u65B9\u98CE\u9669\u63D0\u793A",
|
|
174
|
-
heading: "\u60A8\u5373\u5C06\u79BB\u5F00 FLAP",
|
|
175
|
-
description: "\u60A8\u5373\u5C06\u8BBF\u95EE\u7531\u5916\u90E8\u5F00\u53D1\u8005\u7EF4\u62A4\u7684\u7B2C\u4E09\u65B9\u9875\u9762\u3002\u8BE5\u7AD9\u70B9\u4E0D\u7531 FLAP \u8FD0\u8425\uFF0C\u53EF\u80FD\u5B58\u5728\u672A\u77E5\u7684\u5B89\u5168\u6216\u9690\u79C1\u98CE\u9669\u3002",
|
|
176
|
-
destinationLabel: "\u76EE\u6807\u5730\u5740",
|
|
177
|
-
invalidDestination: "\u4E0D\u652F\u6301\u7684\u76EE\u6807\u5730\u5740",
|
|
178
|
-
acknowledge: "\u6211\u5DF2\u4E86\u89E3\u98CE\u9669\u5E76\u5E0C\u671B\u7EE7\u7EED",
|
|
179
|
-
cancel: "\u5173\u95ED",
|
|
180
|
-
proceed: "\u7EE7\u7EED"
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
function resolveLocale(locale) {
|
|
184
|
-
return locale && locale.toLowerCase().startsWith("zh") ? "zh" : "en";
|
|
185
|
-
}
|
|
186
|
-
function normalizeExternalUrl(url) {
|
|
187
|
-
try {
|
|
188
|
-
const parsed = new URL(url);
|
|
189
|
-
if (parsed.protocol !== "https:" || parsed.username || parsed.password) return null;
|
|
190
|
-
return parsed.href;
|
|
191
|
-
} catch {
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
function WarningIcon({ className }) {
|
|
196
|
-
return /* @__PURE__ */ React4.createElement("svg", { viewBox: "0 0 80 80", fill: "currentColor", "aria-hidden": "true", shapeRendering: "crispEdges", className }, /* @__PURE__ */ React4.createElement("rect", { x: "32.4395", y: "11.7969", width: "2.62997", height: "6.57492" }), /* @__PURE__ */ React4.createElement("rect", { width: "2.62997", height: "6.57492", transform: "matrix(-1 0 0 1 47.5605 11.7969)" }), /* @__PURE__ */ React4.createElement("rect", { x: "35.0693", y: "9.16699", width: "2.62997", height: "5.25994" }), /* @__PURE__ */ React4.createElement("rect", { x: "37.6982", y: "9.16699", width: "4.60245", height: "2.62997" }), /* @__PURE__ */ React4.createElement("rect", { x: "38.333", y: "6.66699", width: "3.33333", height: "2.5" }), /* @__PURE__ */ React4.createElement("rect", { width: "2.62997", height: "5.25994", transform: "matrix(-1 0 0 1 44.9307 9.16699)" }), /* @__PURE__ */ React4.createElement("rect", { x: "29.8086", y: "16.3989", width: "2.62997", height: "6.57492" }), /* @__PURE__ */ React4.createElement("rect", { width: "2.62997", height: "6.57492", transform: "matrix(-1 0 0 1 50.1914 16.3989)" }), /* @__PURE__ */ React4.createElement("rect", { x: "27.1787", y: "21.6592", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React4.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 52.8213 21.6592)" }), /* @__PURE__ */ React4.createElement("rect", { x: "24.5488", y: "24.2891", width: "2.62997", height: "7.23242" }), /* @__PURE__ */ React4.createElement("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 55.4512 24.2891)" }), /* @__PURE__ */ React4.createElement("rect", { x: "21.9189", y: "29.5488", width: "2.62997", height: "7.23242" }), /* @__PURE__ */ React4.createElement("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 58.0811 29.5488)" }), /* @__PURE__ */ React4.createElement("rect", { x: "19.2891", y: "34.8086", width: "2.62997", height: "7.23242" }), /* @__PURE__ */ React4.createElement("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 60.7109 34.8086)" }), /* @__PURE__ */ React4.createElement("rect", { x: "16.6592", y: "40.0693", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React4.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 63.3408 40.0693)" }), /* @__PURE__ */ React4.createElement("rect", { x: "14.0293", y: "44.6709", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React4.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 65.9707 44.6709)" }), /* @__PURE__ */ React4.createElement("rect", { x: "11.3984", y: "48.6165", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React4.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 68.6016 48.6165)" }), /* @__PURE__ */ React4.createElement("rect", { x: "8.76855", y: "53.8762", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React4.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 71.2314 53.8762)" }), /* @__PURE__ */ React4.createElement("rect", { x: "6.13965", y: "58.4783", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React4.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 73.8604 58.4783)" }), /* @__PURE__ */ React4.createElement("rect", { x: "4.16699", y: "62.4236", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React4.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 75.833 62.4236)" }), /* @__PURE__ */ React4.createElement("rect", { x: "6.79688", y: "68.3406", width: "2.62997", height: "2.62997" }), /* @__PURE__ */ React4.createElement("rect", { x: "70.5742", y: "68.3406", width: "2.62997", height: "2.62997" }), /* @__PURE__ */ React4.createElement("rect", { x: "9.42578", y: "70.9709", width: "61.1468", height: "2.62997" }), /* @__PURE__ */ React4.createElement("rect", { x: "38.333", y: "30.833", width: "4.16667", height: "22.5" }), /* @__PURE__ */ React4.createElement("rect", { x: "38.333", y: "57.5", width: "4.16667", height: "4.16667" }));
|
|
197
|
-
}
|
|
198
|
-
function ExternalLink2({ url, children, locale, className, copy }) {
|
|
199
|
-
const [open, setOpen] = React4.useState(false);
|
|
200
|
-
const [acknowledged, setAcknowledged] = React4.useState(false);
|
|
201
|
-
const [mounted, setMounted] = React4.useState(false);
|
|
202
|
-
const text = { ...COPY[resolveLocale(locale)], ...copy };
|
|
203
|
-
const safeUrl = React4.useMemo(() => normalizeExternalUrl(url), [url]);
|
|
204
|
-
const canProceed = acknowledged && Boolean(safeUrl);
|
|
205
|
-
React4.useEffect(() => {
|
|
206
|
-
setMounted(true);
|
|
207
|
-
}, []);
|
|
208
|
-
const close = React4.useCallback(() => {
|
|
209
|
-
setOpen(false);
|
|
210
|
-
setAcknowledged(false);
|
|
211
|
-
}, []);
|
|
212
|
-
React4.useEffect(() => {
|
|
213
|
-
if (!open) return;
|
|
214
|
-
const onKey = (event) => {
|
|
215
|
-
if (event.key === "Escape") close();
|
|
216
|
-
};
|
|
217
|
-
document.addEventListener("keydown", onKey);
|
|
218
|
-
const previousOverflow = document.body.style.overflow;
|
|
219
|
-
document.body.style.overflow = "hidden";
|
|
220
|
-
return () => {
|
|
221
|
-
document.removeEventListener("keydown", onKey);
|
|
222
|
-
document.body.style.overflow = previousOverflow;
|
|
223
|
-
};
|
|
224
|
-
}, [open, close]);
|
|
225
|
-
const proceed = () => {
|
|
226
|
-
if (!canProceed || !safeUrl) return;
|
|
227
|
-
window.open(safeUrl, "_blank", "noopener,noreferrer");
|
|
228
|
-
close();
|
|
229
|
-
};
|
|
230
|
-
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(
|
|
231
|
-
"button",
|
|
232
|
-
{
|
|
233
|
-
type: "button",
|
|
234
|
-
"data-flap-ui": "external-link",
|
|
235
|
-
onClick: () => setOpen(true),
|
|
236
|
-
className: cn("inline-flex min-w-0 items-center gap-1 text-[#d0ff00] hover:underline", className)
|
|
237
|
-
},
|
|
238
|
-
/* @__PURE__ */ React4.createElement("span", { className: "truncate" }, children),
|
|
239
|
-
/* @__PURE__ */ React4.createElement(ExternalLink, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": "true" })
|
|
240
|
-
), open && mounted ? createPortal(
|
|
241
|
-
/* @__PURE__ */ React4.createElement(
|
|
242
|
-
"div",
|
|
243
|
-
{
|
|
244
|
-
className: "fixed inset-0 z-[2147483647] flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",
|
|
245
|
-
style: { zIndex: 2147483647 },
|
|
246
|
-
onClick: close
|
|
247
|
-
},
|
|
248
|
-
/* @__PURE__ */ React4.createElement(
|
|
249
|
-
"div",
|
|
250
|
-
{
|
|
251
|
-
role: "dialog",
|
|
252
|
-
"aria-modal": "true",
|
|
253
|
-
"aria-label": text.title,
|
|
254
|
-
onClick: (event) => event.stopPropagation(),
|
|
255
|
-
style: {
|
|
256
|
-
width: "min(540px, 100%)",
|
|
257
|
-
maxHeight: "calc(100vh - 2rem)",
|
|
258
|
-
fontFamily: "'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace",
|
|
259
|
-
backgroundColor: "#070808",
|
|
260
|
-
border: "1px solid #414141"
|
|
261
|
-
},
|
|
262
|
-
className: "flex w-[min(540px,100%)] max-h-[calc(100vh-2rem)] flex-col overflow-hidden rounded-[4px] text-white shadow-panel"
|
|
263
|
-
},
|
|
264
|
-
/* @__PURE__ */ React4.createElement(
|
|
265
|
-
"div",
|
|
266
|
-
{
|
|
267
|
-
className: "flex items-center justify-between border-b border-[#484b51] px-6 py-[14px]",
|
|
268
|
-
style: { boxSizing: "border-box", height: "49px", lineHeight: 1 }
|
|
269
|
-
},
|
|
270
|
-
/* @__PURE__ */ React4.createElement(
|
|
271
|
-
"span",
|
|
272
|
-
{
|
|
273
|
-
className: "truncate text-[18px] font-medium uppercase leading-none tracking-[-0.4px]",
|
|
274
|
-
style: { lineHeight: 1 }
|
|
275
|
-
},
|
|
276
|
-
/* @__PURE__ */ React4.createElement("span", { className: "text-[#d0ff00]" }, "//"),
|
|
277
|
-
text.title
|
|
278
|
-
),
|
|
279
|
-
/* @__PURE__ */ React4.createElement(
|
|
280
|
-
"button",
|
|
281
|
-
{
|
|
282
|
-
type: "button",
|
|
283
|
-
onClick: close,
|
|
284
|
-
"aria-label": text.cancel,
|
|
285
|
-
className: "flex size-5 shrink-0 items-center justify-center border border-[#484b51] text-white/80 hover:text-white"
|
|
286
|
-
},
|
|
287
|
-
/* @__PURE__ */ React4.createElement(X, { className: "h-3.5 w-3.5" })
|
|
288
|
-
)
|
|
289
|
-
),
|
|
290
|
-
/* @__PURE__ */ React4.createElement("div", { className: "flex flex-col gap-6 overflow-y-auto p-6" }, /* @__PURE__ */ React4.createElement("div", { className: "flex flex-col items-center gap-5" }, /* @__PURE__ */ React4.createElement(WarningIcon, { className: "h-20 w-20 text-[#f68f15]" }), /* @__PURE__ */ React4.createElement("h2", { className: "text-center text-[18px] font-medium uppercase leading-[1.4] tracking-[-0.4px]" }, text.heading)), /* @__PURE__ */ React4.createElement("p", { className: "text-[14px] leading-[1.4] tracking-[-0.4px] text-[#a0a3a7]" }, text.description), /* @__PURE__ */ React4.createElement("div", { className: "min-w-0 border border-[#262626] bg-[#0a0a0a] px-3 py-2 text-[13px]" }, /* @__PURE__ */ React4.createElement("div", { className: "mb-1 uppercase tracking-[-0.4px] text-[#6b7280]" }, text.destinationLabel), /* @__PURE__ */ React4.createElement("div", { className: "truncate text-[#d4d4d4]", title: safeUrl ?? url }, safeUrl ? new URL(safeUrl).host : text.invalidDestination)), /* @__PURE__ */ React4.createElement("label", { className: "flex cursor-pointer items-center gap-2 text-[14px] leading-[1.4] tracking-[-0.4px] text-white" }, /* @__PURE__ */ React4.createElement(
|
|
291
|
-
"input",
|
|
292
|
-
{
|
|
293
|
-
type: "checkbox",
|
|
294
|
-
checked: acknowledged,
|
|
295
|
-
onChange: (event) => setAcknowledged(event.target.checked),
|
|
296
|
-
className: "sr-only"
|
|
297
|
-
}
|
|
298
|
-
), /* @__PURE__ */ React4.createElement(
|
|
299
|
-
"span",
|
|
300
|
-
{
|
|
301
|
-
"aria-hidden": "true",
|
|
302
|
-
className: cn(
|
|
303
|
-
"flex size-4 shrink-0 items-center justify-center border",
|
|
304
|
-
acknowledged ? "border-[#d0ff00] bg-[#d0ff00] text-[#070808]" : "border-[#a0a3a7] bg-transparent"
|
|
305
|
-
)
|
|
306
|
-
},
|
|
307
|
-
acknowledged ? /* @__PURE__ */ React4.createElement("svg", { viewBox: "0 0 12 12", className: "h-3 w-3", fill: "none", stroke: "currentColor", strokeWidth: 2 }, /* @__PURE__ */ React4.createElement("path", { d: "M2 6.5 L5 9 L10 3", strokeLinecap: "square" })) : null
|
|
308
|
-
), /* @__PURE__ */ React4.createElement("span", { className: "min-w-0" }, text.acknowledge)), /* @__PURE__ */ React4.createElement("div", { className: "flex gap-6" }, /* @__PURE__ */ React4.createElement(
|
|
309
|
-
"button",
|
|
310
|
-
{
|
|
311
|
-
type: "button",
|
|
312
|
-
onClick: close,
|
|
313
|
-
className: "flex flex-1 items-center justify-center rounded-[2px] border border-[#84888c] bg-transparent py-3 text-[14px] font-bold uppercase tracking-[-0.4px] text-white transition-colors hover:border-white"
|
|
314
|
-
},
|
|
315
|
-
text.cancel
|
|
316
|
-
), /* @__PURE__ */ React4.createElement(
|
|
317
|
-
"button",
|
|
318
|
-
{
|
|
319
|
-
type: "button",
|
|
320
|
-
onClick: proceed,
|
|
321
|
-
disabled: !canProceed,
|
|
322
|
-
style: { backgroundColor: canProceed ? "#d0ff00" : "#536600", color: "#070808" },
|
|
323
|
-
className: "flex flex-1 items-center justify-center rounded-[2px] py-3 text-[14px] font-bold uppercase tracking-[-0.4px] transition-colors"
|
|
324
|
-
},
|
|
325
|
-
text.proceed
|
|
326
|
-
)))
|
|
327
|
-
)
|
|
328
|
-
),
|
|
329
|
-
document.body
|
|
330
|
-
) : null);
|
|
331
|
-
}
|
|
332
|
-
var Input = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React4.createElement(
|
|
333
|
-
"input",
|
|
334
|
-
{
|
|
335
|
-
"data-flap-ui": "input",
|
|
336
|
-
ref,
|
|
337
|
-
className: cn(
|
|
338
|
-
"flex h-11 w-full rounded-[6px] border border-[#303236] bg-black px-3 py-2 text-sm font-semibold text-white caret-[#D0FF00] shadow-[inset_0_1px_0_rgba(255,255,255,0.04)] outline-none duration-0 selection:bg-[#D0FF00]/35 selection:text-white placeholder:text-[#84888C] focus:border-[#D0FF00] focus:ring-2 focus:ring-[#D0FF00]/25 disabled:cursor-not-allowed disabled:bg-[#131516] disabled:text-[#84888C] disabled:opacity-80",
|
|
339
|
-
className
|
|
340
|
-
),
|
|
341
|
-
...props
|
|
342
|
-
}
|
|
343
|
-
));
|
|
344
|
-
Input.displayName = "Input";
|
|
345
|
-
|
|
346
|
-
// src/sdk/hostRuntimeConfig.ts
|
|
347
|
-
var taxVaultHostChains = {
|
|
348
|
-
56: {
|
|
349
|
-
portal: "0xe2ce6ab80874fa9fa2aae65d277dd6b8e65c9de0",
|
|
350
|
-
taxTokenHelperAddress: "0x53841c73217735F37BC1775538b03b23feFD8346",
|
|
351
|
-
vaultPortal: "0x90497450f2a706f1951b5bdda52B4E5d16f34C06",
|
|
352
|
-
wrappedNativeTokenAddress: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
|
|
353
|
-
giftVaultFactory: "0x025549F52B03cF36f9e1a337c02d3AA7Af66ab32",
|
|
354
|
-
hostChainSlug: "bnb",
|
|
355
|
-
ipfsGateway: "https://flap.mypinata.cloud"
|
|
356
|
-
},
|
|
357
|
-
97: {
|
|
358
|
-
portal: "0x5bEacaF7ABCbB3aB280e80D007FD31fcE26510e9",
|
|
359
|
-
taxTokenHelperAddress: "0xD64441e5FcD02D342B8cf6eBA10Ef6E40d0dA90f",
|
|
360
|
-
vaultPortal: "0x027e3704fC5C16522e9393d04C60A3ac5c0d775f",
|
|
361
|
-
wrappedNativeTokenAddress: "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd",
|
|
362
|
-
giftVaultFactory: "0xa02DA44D67DB6D692efa7f751b5952bd670d5326",
|
|
363
|
-
hostChainSlug: "bnb-testnet",
|
|
364
|
-
ipfsGateway: "https://magenta-naval-penguin-822.mypinata.cloud"
|
|
365
|
-
},
|
|
366
|
-
4663: {
|
|
367
|
-
portal: "0x26605f322f7fF986f381bB9A6e3f5DAb0bEaEb09",
|
|
368
|
-
taxTokenHelperAddress: "0xb10bD2672aE63735d677164A54B573a016f0203C",
|
|
369
|
-
vaultPortal: "0xe9F7AB7DE8FB8756acbB6a1cd13316a43308197B",
|
|
370
|
-
wrappedNativeTokenAddress: "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",
|
|
371
|
-
giftVaultFactory: "0xe6ca297D1d963b6F00d5b216986123CAeB883AF6",
|
|
372
|
-
hostChainSlug: "robinhood",
|
|
373
|
-
ipfsGateway: "https://flap.mypinata.cloud"
|
|
374
|
-
},
|
|
375
|
-
46630: {
|
|
376
|
-
portal: "0x26605f322f7fF986f381bB9A6e3f5DAb0bEaEb09",
|
|
377
|
-
taxTokenHelperAddress: "0xb10bD2672aE63735d677164A54B573a016f0203C",
|
|
378
|
-
vaultPortal: "0xe9F7AB7DE8FB8756acbB6a1cd13316a43308197B",
|
|
379
|
-
wrappedNativeTokenAddress: "0x7943e237c7F95DA44E0301572D358911207852Fa",
|
|
380
|
-
hostChainSlug: "robinhood-testnet",
|
|
381
|
-
ipfsGateway: "https://flap.mypinata.cloud"
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
function getTaxVaultHostChainConfig(chainId) {
|
|
385
|
-
return taxVaultHostChains[chainId];
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
// src/sdk/ipfsImage.ts
|
|
389
|
-
var DEFAULT_IPFS_IMAGE_GATEWAY = "https://flap.mypinata.cloud";
|
|
390
|
-
var IPFS_IMAGE_GATEWAYS = ["https://flap.mypinata.cloud", "https://magenta-naval-penguin-822.mypinata.cloud"];
|
|
391
|
-
var CID_RE = /^(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|b[a-z2-7]{20,})$/;
|
|
392
|
-
function isIpfsImageCid(value) {
|
|
393
|
-
return CID_RE.test(value.trim());
|
|
394
|
-
}
|
|
395
|
-
function resolveIpfsImageUrls(cid, chainId = 56) {
|
|
396
|
-
if (!isIpfsImageCid(cid)) return [];
|
|
397
|
-
const preferred = (getTaxVaultHostChainConfig(chainId)?.ipfsGateway ?? DEFAULT_IPFS_IMAGE_GATEWAY).replace(/\/+$/, "");
|
|
398
|
-
const gateways = [preferred, ...IPFS_IMAGE_GATEWAYS.map((gateway) => gateway.replace(/\/+$/, ""))];
|
|
399
|
-
return [...new Set(gateways)].map((gateway) => `${gateway}/ipfs/${cid.trim()}`);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
// src/ui/IpfsImage.tsx
|
|
403
|
-
function IpfsImage({ alt, cid, className, decoding = "async", loading = "lazy", onError, ...props }) {
|
|
404
|
-
const urls = React4.useMemo(() => resolveIpfsImageUrls(cid), [cid]);
|
|
405
|
-
const [urlIndex, setUrlIndex] = React4.useState(0);
|
|
406
|
-
const src = urls[urlIndex];
|
|
407
|
-
React4.useEffect(() => {
|
|
408
|
-
setUrlIndex(0);
|
|
409
|
-
}, [cid]);
|
|
410
|
-
if (!src) return null;
|
|
411
|
-
return (
|
|
412
|
-
// eslint-disable-next-line @next/next/no-img-element -- IpfsImage owns CID-to-gateway fallback; next/image cannot represent this boundary.
|
|
413
|
-
/* @__PURE__ */ React4.createElement(
|
|
414
|
-
"img",
|
|
415
|
-
{
|
|
416
|
-
...props,
|
|
417
|
-
alt,
|
|
418
|
-
className: cn("block max-w-full", className),
|
|
419
|
-
decoding,
|
|
420
|
-
loading,
|
|
421
|
-
onError: (event) => {
|
|
422
|
-
if (urlIndex < urls.length - 1) {
|
|
423
|
-
setUrlIndex((index) => Math.min(index + 1, urls.length - 1));
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
426
|
-
onError?.(event);
|
|
427
|
-
},
|
|
428
|
-
src
|
|
429
|
-
}
|
|
430
|
-
)
|
|
431
|
-
);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
// src/ui/IpfsBackground.tsx
|
|
435
|
-
function IpfsBackground({ cid, className, imageClassName, overlayClassName, ...props }) {
|
|
436
|
-
return /* @__PURE__ */ React4.createElement("div", { ...props, "aria-hidden": "true", className: cn("pointer-events-none absolute inset-0 overflow-hidden", className) }, /* @__PURE__ */ React4.createElement(IpfsImage, { alt: "", cid, className: cn("h-full w-full object-cover", imageClassName), loading: "eager" }), overlayClassName ? /* @__PURE__ */ React4.createElement("div", { className: cn("absolute inset-0", overlayClassName) }) : null);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
// src/ui/Metric.tsx
|
|
440
|
-
var toneClass3 = {
|
|
441
|
-
default: "border-[#303236] bg-[#0B0D0E]",
|
|
442
|
-
primary: "border-[#D0FF00]/70 bg-[#101400]",
|
|
443
|
-
success: "border-[#2EDEDB]/45 bg-[#061615]",
|
|
444
|
-
warning: "border-[#FFD166]/45 bg-[#1A1305]",
|
|
445
|
-
muted: "border-[#303236] bg-black"
|
|
446
|
-
};
|
|
447
|
-
var valueToneClass = {
|
|
448
|
-
default: "text-white",
|
|
449
|
-
primary: "text-[#D0FF00]",
|
|
450
|
-
success: "text-[#2EDEDB]",
|
|
451
|
-
warning: "text-[#FFD166]",
|
|
452
|
-
muted: "text-white"
|
|
453
|
-
};
|
|
454
|
-
function Metric({ label, value, hint, tone = "default", className }) {
|
|
455
|
-
return /* @__PURE__ */ React.createElement("div", { "data-flap-ui": "metric", className: cn("rounded-[6px] border p-3", toneClass3[tone], className) }, /* @__PURE__ */ React.createElement("div", { className: "truncate text-xs font-medium uppercase leading-[1.4] text-[#84888C]" }, label), /* @__PURE__ */ React.createElement("div", { className: cn("mt-2 break-words text-xl font-semibold tracking-normal", valueToneClass[tone]) }, value), hint ? /* @__PURE__ */ React.createElement("div", { className: "mt-1 truncate text-xs text-[#D4D4D4]" }, hint) : null);
|
|
456
|
-
}
|
|
457
|
-
function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
|
|
458
|
-
const {
|
|
459
|
-
allow: _allow,
|
|
460
|
-
referrerPolicy: _referrerPolicy,
|
|
461
|
-
sandbox: _sandbox,
|
|
462
|
-
src: _src,
|
|
463
|
-
srcDoc: _srcDoc,
|
|
464
|
-
title: _title,
|
|
465
|
-
...safeProps
|
|
466
|
-
} = props;
|
|
467
|
-
return /* @__PURE__ */ React4.createElement(
|
|
468
|
-
"iframe",
|
|
469
|
-
{
|
|
470
|
-
...safeProps,
|
|
471
|
-
"data-frame-id": frameId,
|
|
472
|
-
"data-frame-provider": provider,
|
|
473
|
-
src,
|
|
474
|
-
title,
|
|
475
|
-
loading: "lazy",
|
|
476
|
-
referrerPolicy: "no-referrer",
|
|
477
|
-
sandbox: "allow-scripts allow-same-origin",
|
|
478
|
-
className: cn("min-h-[360px] w-full rounded-lg border border-[#3a4d66] bg-[#0b111a]", className)
|
|
479
|
-
}
|
|
480
|
-
);
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
// src/ui/StatusBadge.tsx
|
|
484
|
-
var toneClass4 = {
|
|
485
|
-
neutral: "border-[#303236] bg-black text-[#D4D4D4]",
|
|
486
|
-
success: "border-[#D0FF00]/65 bg-[#101400] text-[#D0FF00]",
|
|
487
|
-
warning: "border-[#FFD166]/55 bg-[#1A1305] text-[#FFD166]",
|
|
488
|
-
danger: "border-[#FF4A55]/65 bg-[#1D0709] text-[#FF8A91]"
|
|
489
|
-
};
|
|
490
|
-
function StatusBadge({ children, tone = "neutral" }) {
|
|
491
|
-
return /* @__PURE__ */ React.createElement("span", { "data-flap-ui": "status-badge", className: cn("inline-flex items-center rounded-[6px] border px-2.5 py-1 text-xs font-semibold uppercase leading-none", toneClass4[tone]) }, children);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
// src/ui/TxButton.tsx
|
|
495
|
-
var labels = {
|
|
496
|
-
idle: "",
|
|
497
|
-
validating: "Validating",
|
|
498
|
-
approving: "Approving",
|
|
499
|
-
approval_confirming: "Confirming approval",
|
|
500
|
-
simulating: "Simulating",
|
|
501
|
-
writing: "Sending",
|
|
502
|
-
confirming: "Confirming",
|
|
503
|
-
success: "Done",
|
|
504
|
-
failed: "Retry"
|
|
505
|
-
};
|
|
506
|
-
function TxButton({ state = "idle", idleLabel, children, ...props }) {
|
|
507
|
-
const loading = ["validating", "approving", "approval_confirming", "simulating", "writing", "confirming"].includes(state);
|
|
508
|
-
return /* @__PURE__ */ React.createElement(Button, { loading, ...props }, children || labels[state] || idleLabel);
|
|
509
|
-
}
|
|
510
|
-
function VaultBanner({ title, description, badges, meta, action, icon, className }) {
|
|
511
|
-
return /* @__PURE__ */ React.createElement(
|
|
512
|
-
"section",
|
|
513
|
-
{
|
|
514
|
-
className: cn(
|
|
515
|
-
"rounded-lg border border-[#3b82f6] bg-[#172a5a] p-4 shadow-[inset_0_1px_0_rgba(255,255,255,0.08)]",
|
|
516
|
-
className
|
|
517
|
-
)
|
|
518
|
-
},
|
|
519
|
-
/* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between" }, /* @__PURE__ */ React.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-wrap items-center gap-3" }, /* @__PURE__ */ React.createElement("span", { className: "inline-flex h-4 w-4 shrink-0 items-center justify-center text-[#8fc8ff]" }, icon ?? /* @__PURE__ */ React.createElement(ShieldCheck, { className: "h-4 w-4" })), /* @__PURE__ */ React.createElement("h3", { className: "min-w-0 text-base font-semibold leading-tight text-white" }, title), badges), /* @__PURE__ */ React.createElement("p", { className: "mt-3 max-w-3xl text-sm font-medium leading-6 text-[#d8e2ef]" }, description), meta ? /* @__PURE__ */ React.createElement("div", { className: "mt-2 text-xs font-medium leading-5 text-[#92a4bd]" }, meta) : null), action ? /* @__PURE__ */ React.createElement("div", { className: "shrink-0" }, action) : null)
|
|
520
|
-
);
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
export { AddressLink, Alert, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Countdown, DataRow, DetailTile, ExternalLink2 as ExternalLink, Input, IpfsBackground, IpfsImage, Metric, ReviewedFrame, StatusBadge, TxButton, VaultBanner, buttonVariants };
|
|
2
|
+
export { AddressLink, Alert, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Countdown, DataRow, DetailTile, ExternalLink, Input, IpfsBackground, IpfsImage, Metric, NftMetadataImage, ReviewedFrame, StatusBadge, TxButton, VaultBanner, buttonVariants } from './chunk-ZK3O6QPF.js';
|
|
3
|
+
import './chunk-GA5VEHC2.js';
|
|
4
|
+
import './chunk-CPAMDXX7.js';
|
|
524
5
|
//# sourceMappingURL=ui.js.map
|
|
525
6
|
//# sourceMappingURL=ui.js.map
|