@hfunlabs/hypurr-connect 0.1.13 → 0.1.15
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 +12 -0
- package/dist/index.d.ts +89 -4
- package/dist/index.js +1858 -348
- package/dist/index.js.map +1 -1
- package/package.json +17 -6
- package/src/AddWalletModal.tsx +744 -0
- package/src/AgentExpiryWarning.tsx +129 -0
- package/src/DeleteWalletModal.tsx +5 -1
- package/src/HypurrConnectProvider.tsx +193 -1
- package/src/LoginModal.tsx +30 -19
- package/src/RenameWalletModal.tsx +5 -1
- package/src/RenewAgentModal.tsx +380 -0
- package/src/UserProfileModal.tsx +157 -25
- package/src/WalletSelectorDropdown.tsx +146 -6
- package/src/agent.ts +38 -12
- package/src/agentWallet.ts +86 -0
- package/src/css.d.ts +1 -0
- package/src/icons/lucide.tsx +61 -0
- package/src/index.ts +17 -1
- package/src/profileStyles.ts +58 -0
- package/src/styles.css +1 -0
- package/src/tailwind.css +77 -0
- package/src/types.ts +13 -0
package/dist/index.js
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
// #style-inject:#style-inject
|
|
2
|
+
function styleInject(css, { insertAt } = {}) {
|
|
3
|
+
if (!css || typeof document === "undefined") return;
|
|
4
|
+
const head = document.head || document.getElementsByTagName("head")[0];
|
|
5
|
+
const style = document.createElement("style");
|
|
6
|
+
style.type = "text/css";
|
|
7
|
+
if (insertAt === "top") {
|
|
8
|
+
if (head.firstChild) {
|
|
9
|
+
head.insertBefore(style, head.firstChild);
|
|
10
|
+
} else {
|
|
11
|
+
head.appendChild(style);
|
|
12
|
+
}
|
|
13
|
+
} else {
|
|
14
|
+
head.appendChild(style);
|
|
15
|
+
}
|
|
16
|
+
if (style.styleSheet) {
|
|
17
|
+
style.styleSheet.cssText = css;
|
|
18
|
+
} else {
|
|
19
|
+
style.appendChild(document.createTextNode(css));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/styles.css
|
|
24
|
+
styleInject(".hypurr-connect .btn-raised {\n background-color: #0d1219;\n background-image:\n linear-gradient(\n 180deg,\n hsla(0, 0%, 100%, .03),\n transparent);\n box-shadow:\n inset 0 1px 0 hsla(0, 0%, 100%, .1),\n inset 0 -1px 0 rgba(0, 0, 0, .35),\n inset 0 0 0 1px #262a30;\n color: #aab1c1;\n transition:\n background-color .15s,\n color .15s,\n background-image .15s,\n box-shadow .15s;\n}\n.hypurr-connect .btn-raised:hover:not(:disabled) {\n background-color: #15171a;\n background-image:\n linear-gradient(\n 180deg,\n hsla(0, 0%, 100%, .04),\n transparent);\n box-shadow:\n inset 0 1px 0 hsla(0, 0%, 100%, .14),\n inset 0 -1px 0 rgba(0, 0, 0, .4),\n inset 0 0 0 1px #444548;\n color: #d1d5db;\n}\n.hypurr-connect .btn-raised-active {\n background-color: #1e2124;\n background-image:\n linear-gradient(\n 180deg,\n hsla(0, 0%, 100%, .05),\n transparent);\n box-shadow:\n inset 0 1px 0 hsla(0, 0%, 100%, .18),\n inset 0 -1px 0 rgba(0, 0, 0, .45),\n inset 0 0 0 1px #4b4d50,\n 0 1px 2px rgba(0, 0, 0, .5);\n color: #fff;\n}\n.hypurr-connect .btn-raised-active,\n.hypurr-connect .btn-raised-disabled {\n transition:\n background-color .15s,\n color .15s,\n background-image .15s,\n box-shadow .15s;\n}\n.hypurr-connect .btn-raised-disabled {\n background-color: #0d1219;\n background-image:\n linear-gradient(\n 180deg,\n hsla(0, 0%, 100%, .02),\n transparent);\n box-shadow:\n inset 0 1px 0 hsla(0, 0%, 100%, .05),\n inset 0 -1px 0 rgba(0, 0, 0, .25),\n inset 0 0 0 1px #1c2026;\n color: #7d8597;\n cursor: not-allowed;\n}\n.hypurr-connect .\\!visible {\n visibility: visible !important;\n}\n.hypurr-connect .visible {\n visibility: visible;\n}\n.hypurr-connect .fixed {\n position: fixed;\n}\n.hypurr-connect .absolute {\n position: absolute;\n}\n.hypurr-connect .relative {\n position: relative;\n}\n.hypurr-connect .inset-0 {\n inset: 0;\n}\n.hypurr-connect .right-2 {\n right: .5rem;\n}\n.hypurr-connect .right-6 {\n right: 1.5rem;\n}\n.hypurr-connect .top-1\\/2 {\n top: 50%;\n}\n.hypurr-connect .z-\\[100\\] {\n z-index: 100;\n}\n.hypurr-connect .z-\\[101\\] {\n z-index: 101;\n}\n.hypurr-connect .z-\\[110\\] {\n z-index: 110;\n}\n.hypurr-connect .z-\\[111\\] {\n z-index: 111;\n}\n.hypurr-connect .mb-1\\.5 {\n margin-bottom: .375rem;\n}\n.hypurr-connect .mb-2 {\n margin-bottom: .5rem;\n}\n.hypurr-connect .mt-0\\.5 {\n margin-top: .125rem;\n}\n.hypurr-connect .mt-1 {\n margin-top: .25rem;\n}\n.hypurr-connect .mt-1\\.5 {\n margin-top: .375rem;\n}\n.hypurr-connect .block {\n display: block;\n}\n.hypurr-connect .inline-block {\n display: inline-block;\n}\n.hypurr-connect .inline {\n display: inline;\n}\n.hypurr-connect .flex {\n display: flex;\n}\n.hypurr-connect .inline-flex {\n display: inline-flex;\n}\n.hypurr-connect .grid {\n display: grid;\n}\n.hypurr-connect .contents {\n display: contents;\n}\n.hypurr-connect .hidden {\n display: none;\n}\n.hypurr-connect .h-8 {\n height: 2rem;\n}\n.hypurr-connect .w-8 {\n width: 2rem;\n}\n.hypurr-connect .w-full {\n width: 100%;\n}\n.hypurr-connect .min-w-0 {\n min-width: 0;\n}\n.hypurr-connect .max-w-md {\n max-width: 28rem;\n}\n.hypurr-connect .flex-1 {\n flex: 1 1 0%;\n}\n.hypurr-connect .flex-shrink-0 {\n flex-shrink: 0;\n}\n.hypurr-connect .-translate-y-1\\/2 {\n --tw-translate-y:-50%;\n}\n.hypurr-connect .-translate-y-1\\/2,\n.hypurr-connect .transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.hypurr-connect .cursor-not-allowed {\n cursor: not-allowed;\n}\n.hypurr-connect .grid-cols-4 {\n grid-template-columns: repeat(4, minmax(0, 1fr));\n}\n.hypurr-connect .items-start {\n align-items: flex-start;\n}\n.hypurr-connect .items-center {\n align-items: center;\n}\n.hypurr-connect .justify-center {\n justify-content: center;\n}\n.hypurr-connect .justify-between {\n justify-content: space-between;\n}\n.hypurr-connect .gap-1\\.5 {\n gap: .375rem;\n}\n.hypurr-connect .gap-2 {\n gap: .5rem;\n}\n.hypurr-connect .gap-3 {\n gap: .75rem;\n}\n.hypurr-connect :is(.space-y-2 > :not([hidden]) ~ :not([hidden])) {\n --tw-space-y-reverse:0;\n margin-top: calc(.5rem*(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(.5rem*var(--tw-space-y-reverse));\n}\n.hypurr-connect :is(.space-y-3 > :not([hidden]) ~ :not([hidden])) {\n --tw-space-y-reverse:0;\n margin-top: calc(.75rem*(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(.75rem*var(--tw-space-y-reverse));\n}\n.hypurr-connect :is(.space-y-4 > :not([hidden]) ~ :not([hidden])) {\n --tw-space-y-reverse:0;\n margin-top: calc(1rem*(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1rem*var(--tw-space-y-reverse));\n}\n.hypurr-connect .overflow-hidden {\n overflow: hidden;\n}\n.hypurr-connect .truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.hypurr-connect .break-all {\n word-break: break-all;\n}\n.hypurr-connect .rounded {\n border-radius: .25rem;\n}\n.hypurr-connect .rounded-lg {\n border-radius: .5rem;\n}\n.hypurr-connect .rounded-md {\n border-radius: .375rem;\n}\n.hypurr-connect .border {\n border-width: 1px;\n}\n.hypurr-connect .border-b {\n border-bottom-width: 1px;\n}\n.hypurr-connect .border-amber-500\\/25 {\n border-color: rgba(245, 158, 11, .25);\n}\n.hypurr-connect .border-gray-700 {\n --tw-border-opacity:1;\n border-color: rgb(55 65 81/var(--tw-border-opacity,1));\n}\n.hypurr-connect .border-purple-500 {\n --tw-border-opacity:1;\n border-color: rgb(185 125 241/var(--tw-border-opacity,1));\n}\n.hypurr-connect .border-surface-bd {\n --tw-border-opacity:1;\n border-color: rgb(38 42 48/var(--tw-border-opacity,1));\n}\n.hypurr-connect .border-trade-down\\/20 {\n border-color: hsla(0, 91%, 71%, .2);\n}\n.hypurr-connect .border-trade-down\\/50 {\n border-color: hsla(0, 91%, 71%, .5);\n}\n.hypurr-connect .border-white\\/\\[0\\.06\\] {\n border-color: hsla(0, 0%, 100%, .06);\n}\n.hypurr-connect .border-white\\/\\[0\\.08\\] {\n border-color: hsla(0, 0%, 100%, .08);\n}\n.hypurr-connect .bg-amber-500\\/\\[0\\.08\\] {\n background-color: rgba(245, 158, 11, .08);\n}\n.hypurr-connect .bg-black\\/70 {\n background-color: rgba(0, 0, 0, .7);\n}\n.hypurr-connect .bg-surface-btn\\/90 {\n background-color: rgba(13, 18, 25, .9);\n}\n.hypurr-connect .bg-surface-modal {\n --tw-bg-opacity:1;\n background-color: rgb(14 18 24/var(--tw-bg-opacity,1));\n}\n.hypurr-connect .bg-trade-down\\/\\[0\\.08\\] {\n background-color: hsla(0, 91%, 71%, .08);\n}\n.hypurr-connect .bg-transparent {\n background-color: transparent;\n}\n.hypurr-connect .bg-white\\/\\[0\\.03\\] {\n background-color: hsla(0, 0%, 100%, .03);\n}\n.hypurr-connect .bg-white\\/\\[0\\.06\\] {\n background-color: hsla(0, 0%, 100%, .06);\n}\n.hypurr-connect .p-1\\.5 {\n padding: .375rem;\n}\n.hypurr-connect .p-3 {\n padding: .75rem;\n}\n.hypurr-connect .p-4 {\n padding: 1rem;\n}\n.hypurr-connect .px-3 {\n padding-left: .75rem;\n padding-right: .75rem;\n}\n.hypurr-connect .px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.hypurr-connect .py-1\\.5 {\n padding-top: .375rem;\n padding-bottom: .375rem;\n}\n.hypurr-connect .py-2 {\n padding-top: .5rem;\n padding-bottom: .5rem;\n}\n.hypurr-connect .py-2\\.5 {\n padding-top: .625rem;\n padding-bottom: .625rem;\n}\n.hypurr-connect .py-5 {\n padding-top: 1.25rem;\n}\n.hypurr-connect .pb-5,\n.hypurr-connect .py-5 {\n padding-bottom: 1.25rem;\n}\n.hypurr-connect .pb-6 {\n padding-bottom: 1.5rem;\n}\n.hypurr-connect .pr-11 {\n padding-right: 2.75rem;\n}\n.hypurr-connect .pt-5 {\n padding-top: 1.25rem;\n}\n.hypurr-connect .pt-6 {\n padding-top: 1.5rem;\n}\n.hypurr-connect .font-mono {\n font-family:\n Google Sans Code,\n Roboto Mono,\n ui-monospace,\n SFMono-Regular,\n Menlo,\n Monaco,\n Consolas,\n monospace;\n}\n.hypurr-connect .font-sans {\n font-family:\n Inter,\n ui-sans-serif,\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n Segoe UI,\n Roboto,\n Helvetica Neue,\n Arial,\n sans-serif;\n}\n.hypurr-connect .text-base {\n font-size: 12.5px;\n line-height: 1rem;\n}\n.hypurr-connect .text-lg {\n font-size: 14px;\n line-height: 1.25rem;\n}\n.hypurr-connect .font-medium {\n font-weight: 500;\n}\n.hypurr-connect .font-semibold {\n font-weight: 600;\n}\n.hypurr-connect .uppercase {\n text-transform: uppercase;\n}\n.hypurr-connect .tabular-nums {\n --tw-numeric-spacing:tabular-nums;\n font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);\n}\n.hypurr-connect .tracking-\\[0\\.1em\\] {\n letter-spacing: .1em;\n}\n.hypurr-connect .text-amber-200 {\n --tw-text-opacity:1;\n color: rgb(253 230 138/var(--tw-text-opacity,1));\n}\n.hypurr-connect .text-amber-400 {\n --tw-text-opacity:1;\n color: rgb(251 191 36/var(--tw-text-opacity,1));\n}\n.hypurr-connect .text-gray-400 {\n --tw-text-opacity:1;\n color: rgb(170 177 193/var(--tw-text-opacity,1));\n}\n.hypurr-connect .text-gray-500 {\n --tw-text-opacity:1;\n color: rgb(107 114 128/var(--tw-text-opacity,1));\n}\n.hypurr-connect .text-gray-600 {\n --tw-text-opacity:1;\n color: rgb(125 133 151/var(--tw-text-opacity,1));\n}\n.hypurr-connect .text-purple-400 {\n --tw-text-opacity:1;\n color: rgb(216 180 254/var(--tw-text-opacity,1));\n}\n.hypurr-connect .text-trade-down {\n --tw-text-opacity:1;\n color: rgb(248 113 113/var(--tw-text-opacity,1));\n}\n.hypurr-connect .text-trade-up {\n --tw-text-opacity:1;\n color: rgb(52 211 153/var(--tw-text-opacity,1));\n}\n.hypurr-connect .text-white {\n --tw-text-opacity:1;\n color: rgb(255 255 255/var(--tw-text-opacity,1));\n}\n.hypurr-connect .placeholder-gray-600::-moz-placeholder {\n --tw-placeholder-opacity:1;\n color: rgb(125 133 151/var(--tw-placeholder-opacity,1));\n}\n.hypurr-connect .placeholder-gray-600::placeholder {\n --tw-placeholder-opacity:1;\n color: rgb(125 133 151/var(--tw-placeholder-opacity,1));\n}\n.hypurr-connect .shadow-modal {\n --tw-shadow:0 25px 50px -12px rgba(0,0,0,.6);\n --tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color);\n box-shadow:\n var(--tw-ring-offset-shadow,0 0 #0000),\n var(--tw-ring-shadow,0 0 #0000),\n var(--tw-shadow);\n}\n.hypurr-connect .outline {\n outline-style: solid;\n}\n.hypurr-connect .blur {\n --tw-blur:blur(8px);\n}\n.hypurr-connect .blur,\n.hypurr-connect .drop-shadow {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.hypurr-connect .drop-shadow {\n --tw-drop-shadow:drop-shadow(0 1px 2px rgba(0,0,0,.1)) drop-shadow(0 1px 1px rgba(0,0,0,.06));\n}\n.hypurr-connect .filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.hypurr-connect .backdrop-blur-sm {\n --tw-backdrop-blur:blur(4px);\n -webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);\n backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);\n}\n.hypurr-connect .transition {\n transition-property:\n color,\n background-color,\n border-color,\n text-decoration-color,\n fill,\n stroke,\n opacity,\n box-shadow,\n transform,\n filter,\n -webkit-backdrop-filter;\n transition-property:\n color,\n background-color,\n border-color,\n text-decoration-color,\n fill,\n stroke,\n opacity,\n box-shadow,\n transform,\n filter,\n backdrop-filter;\n transition-property:\n color,\n background-color,\n border-color,\n text-decoration-color,\n fill,\n stroke,\n opacity,\n box-shadow,\n transform,\n filter,\n backdrop-filter,\n -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(.4, 0, .2, 1);\n transition-duration: .15s;\n}\n.hypurr-connect .transition-colors {\n transition-property:\n color,\n background-color,\n border-color,\n text-decoration-color,\n fill,\n stroke;\n transition-timing-function: cubic-bezier(.4, 0, .2, 1);\n transition-duration: .15s;\n}\n.hypurr-connect .hover\\:bg-purple-500\\/10:hover {\n background-color: rgba(185, 125, 241, .1);\n}\n.hypurr-connect .hover\\:text-gray-300:hover {\n --tw-text-opacity:1;\n color: rgb(209 213 219/var(--tw-text-opacity,1));\n}\n.hypurr-connect .hover\\:text-white:hover {\n --tw-text-opacity:1;\n color: rgb(255 255 255/var(--tw-text-opacity,1));\n}\n.hypurr-connect .focus\\:outline-none:focus {\n outline: 2px solid transparent;\n outline-offset: 2px;\n}\n.hypurr-connect .disabled\\:cursor-not-allowed:disabled {\n cursor: not-allowed;\n}\n.hypurr-connect .disabled\\:opacity-40:disabled {\n opacity: .4;\n}\n.hypurr-connect .disabled\\:opacity-50:disabled {\n opacity: .5;\n}\n");
|
|
25
|
+
|
|
1
26
|
// src/HypurrConnectProvider.tsx
|
|
2
27
|
import {
|
|
3
28
|
ExchangeClient,
|
|
@@ -62,22 +87,36 @@ async function generateAgentKey() {
|
|
|
62
87
|
const signer = new PrivateKeySigner(privateKey);
|
|
63
88
|
return { privateKey, address: signer.address };
|
|
64
89
|
}
|
|
65
|
-
|
|
90
|
+
function isNamedAgent(agent) {
|
|
91
|
+
return agent.name.replace(/ valid_until \d+$/, "") === AGENT_NAME;
|
|
92
|
+
}
|
|
93
|
+
async function fetchExtraAgents(userAddress, isTestnet) {
|
|
66
94
|
const url = isTestnet ? "https://api.hyperliquid-testnet.xyz/info" : "https://api.hyperliquid.xyz/info";
|
|
67
95
|
const res = await fetch(url, {
|
|
68
96
|
method: "POST",
|
|
69
97
|
headers: { "Content-Type": "application/json" },
|
|
70
98
|
body: JSON.stringify({ type: "extraAgents", user: userAddress })
|
|
71
99
|
});
|
|
72
|
-
if (!res.ok) return
|
|
100
|
+
if (!res.ok) return [];
|
|
73
101
|
const agents = await res.json();
|
|
74
|
-
if (!Array.isArray(agents)) return
|
|
102
|
+
if (!Array.isArray(agents)) return [];
|
|
103
|
+
return agents.map((agent) => ({
|
|
104
|
+
...agent,
|
|
105
|
+
validUntil: agent.validUntil * 1e3
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
async function fetchActiveAgent(userAddress, isTestnet) {
|
|
75
109
|
const nowMs = Date.now();
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
);
|
|
110
|
+
const agents = await fetchExtraAgents(userAddress, isTestnet);
|
|
111
|
+
const match = agents.find((a) => isNamedAgent(a) && a.validUntil > nowMs);
|
|
79
112
|
if (!match) return null;
|
|
80
|
-
return
|
|
113
|
+
return match;
|
|
114
|
+
}
|
|
115
|
+
async function fetchAgentByAddress(userAddress, agentAddress, isTestnet) {
|
|
116
|
+
const agents = await fetchExtraAgents(userAddress, isTestnet);
|
|
117
|
+
return agents.find(
|
|
118
|
+
(agent) => agent.address.toLowerCase() === agentAddress.toLowerCase()
|
|
119
|
+
) ?? null;
|
|
81
120
|
}
|
|
82
121
|
async function isAgentValid(stored, userAddress, isTestnet) {
|
|
83
122
|
if (stored.validUntil <= Date.now()) return false;
|
|
@@ -197,6 +236,57 @@ var GrpcExchangeTransport = class {
|
|
|
197
236
|
}
|
|
198
237
|
};
|
|
199
238
|
|
|
239
|
+
// src/agentWallet.ts
|
|
240
|
+
var MS_PER_SECOND = 1e3;
|
|
241
|
+
var NS_PER_MS = 1e6;
|
|
242
|
+
var MS_PER_DAY = 24 * 60 * 60 * 1e3;
|
|
243
|
+
var TELEGRAM_AGENT_APPROVAL_NAME = "xyz";
|
|
244
|
+
var DEFAULT_AGENT_APPROVAL_DURATION_MS = MS_PER_DAY;
|
|
245
|
+
var AGENT_APPROVAL_DURATION_OPTIONS = [
|
|
246
|
+
{ label: "1 day", durationMs: MS_PER_DAY },
|
|
247
|
+
{ label: "7 days", durationMs: 7 * MS_PER_DAY },
|
|
248
|
+
{ label: "30 days", durationMs: 30 * MS_PER_DAY },
|
|
249
|
+
{ label: "90 days", durationMs: 90 * MS_PER_DAY }
|
|
250
|
+
];
|
|
251
|
+
function toFiniteNumber(value) {
|
|
252
|
+
if (value === void 0) return 0;
|
|
253
|
+
const numeric = typeof value === "bigint" ? Number(value) : Number(value);
|
|
254
|
+
return Number.isFinite(numeric) ? numeric : 0;
|
|
255
|
+
}
|
|
256
|
+
function normalizeAgentApprovalDurationMs(durationMs) {
|
|
257
|
+
return typeof durationMs === "number" && Number.isFinite(durationMs) && durationMs > 0 ? durationMs : DEFAULT_AGENT_APPROVAL_DURATION_MS;
|
|
258
|
+
}
|
|
259
|
+
function createTelegramAgentApprovalName(durationMs) {
|
|
260
|
+
const expiresAt = Date.now() + normalizeAgentApprovalDurationMs(durationMs);
|
|
261
|
+
return `${TELEGRAM_AGENT_APPROVAL_NAME} valid_until ${expiresAt}`;
|
|
262
|
+
}
|
|
263
|
+
function agentExpiresAtMs(wallet) {
|
|
264
|
+
if (!wallet.isAgent || !wallet.agentExpiresAt) return null;
|
|
265
|
+
const timestamp = wallet.agentExpiresAt;
|
|
266
|
+
if (timestamp instanceof Date) return timestamp.getTime();
|
|
267
|
+
if (typeof timestamp === "number") return timestamp;
|
|
268
|
+
if (typeof timestamp === "string") {
|
|
269
|
+
const parsed = Date.parse(timestamp);
|
|
270
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
271
|
+
}
|
|
272
|
+
const seconds = toFiniteNumber(timestamp.seconds);
|
|
273
|
+
const nanos = toFiniteNumber(timestamp.nanos);
|
|
274
|
+
const ms = seconds * MS_PER_SECOND + Math.floor(nanos / NS_PER_MS);
|
|
275
|
+
return Number.isFinite(ms) && ms > 0 ? ms : null;
|
|
276
|
+
}
|
|
277
|
+
function formatAgentExpiry(expiresAtMs) {
|
|
278
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
279
|
+
dateStyle: "medium",
|
|
280
|
+
timeStyle: "short"
|
|
281
|
+
}).format(new Date(expiresAtMs));
|
|
282
|
+
}
|
|
283
|
+
function getAgentExpiryTitle(wallet) {
|
|
284
|
+
const expiresAtMs = agentExpiresAtMs(wallet);
|
|
285
|
+
if (!expiresAtMs || expiresAtMs > Date.now()) return null;
|
|
286
|
+
const expiresAt = formatAgentExpiry(expiresAtMs);
|
|
287
|
+
return `Agent approval expired ${expiresAt}. Connect the owner wallet to renew this agent.`;
|
|
288
|
+
}
|
|
289
|
+
|
|
200
290
|
// src/HypurrConnectProvider.tsx
|
|
201
291
|
import { jsx } from "react/jsx-runtime";
|
|
202
292
|
var TELEGRAM_STORAGE_KEY = "hypurr-connect-tg-jwt";
|
|
@@ -205,6 +295,23 @@ var TELEGRAM_AUTH_STATE_KEY = "hypurr-connect-auth-state";
|
|
|
205
295
|
var TELEGRAM_AUTH_MESSAGE = "hypurr-connect:telegram-auth";
|
|
206
296
|
var DEFAULT_AUTH_HUB_URL = "https://auth.hypurr.fun/login";
|
|
207
297
|
var DEFAULT_MEDIA_URL = "https://media.hypurr.fun";
|
|
298
|
+
var USER_SIGNED_DOMAIN_NAME = "HyperliquidSignTransaction";
|
|
299
|
+
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
300
|
+
var APPROVE_AGENT_PRIMARY_TYPE = "HyperliquidTransaction:ApproveAgent";
|
|
301
|
+
var APPROVE_AGENT_TYPES = {
|
|
302
|
+
[APPROVE_AGENT_PRIMARY_TYPE]: [
|
|
303
|
+
{ name: "hyperliquidChain", type: "string" },
|
|
304
|
+
{ name: "agentAddress", type: "address" },
|
|
305
|
+
{ name: "agentName", type: "string" },
|
|
306
|
+
{ name: "nonce", type: "uint64" }
|
|
307
|
+
]
|
|
308
|
+
};
|
|
309
|
+
var EIP712_DOMAIN_TYPES = [
|
|
310
|
+
{ name: "name", type: "string" },
|
|
311
|
+
{ name: "version", type: "string" },
|
|
312
|
+
{ name: "chainId", type: "uint256" },
|
|
313
|
+
{ name: "verifyingContract", type: "address" }
|
|
314
|
+
];
|
|
208
315
|
var IGNORED_EXTERNAL_SIGNATURE = "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b";
|
|
209
316
|
var DEFAULT_TELEGRAM_SCOPES = [
|
|
210
317
|
"telegram:user:read",
|
|
@@ -239,6 +346,46 @@ function normalizeMediaUrl(mediaUrl) {
|
|
|
239
346
|
function isAddress(value) {
|
|
240
347
|
return !!value && /^0x[a-fA-F0-9]{40}$/.test(value);
|
|
241
348
|
}
|
|
349
|
+
function createApproveAgentAction(params) {
|
|
350
|
+
const nonce = Date.now();
|
|
351
|
+
return {
|
|
352
|
+
action: {
|
|
353
|
+
type: "approveAgent",
|
|
354
|
+
signatureChainId: `0x${params.chainId.toString(16)}`,
|
|
355
|
+
hyperliquidChain: params.isTestnet ? "Testnet" : "Mainnet",
|
|
356
|
+
agentAddress: params.agentAddress.toLowerCase(),
|
|
357
|
+
agentName: params.agentName,
|
|
358
|
+
nonce
|
|
359
|
+
},
|
|
360
|
+
nonce
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
async function signApproveAgentAction(params) {
|
|
364
|
+
const { action } = createApproveAgentAction(params);
|
|
365
|
+
const signatureHex = await params.signTypedDataAsync({
|
|
366
|
+
domain: {
|
|
367
|
+
name: USER_SIGNED_DOMAIN_NAME,
|
|
368
|
+
version: "1",
|
|
369
|
+
chainId: params.chainId,
|
|
370
|
+
verifyingContract: ZERO_ADDRESS
|
|
371
|
+
},
|
|
372
|
+
types: {
|
|
373
|
+
EIP712Domain: EIP712_DOMAIN_TYPES,
|
|
374
|
+
...APPROVE_AGENT_TYPES
|
|
375
|
+
},
|
|
376
|
+
primaryType: APPROVE_AGENT_PRIMARY_TYPE,
|
|
377
|
+
message: {
|
|
378
|
+
hyperliquidChain: action.hyperliquidChain,
|
|
379
|
+
agentAddress: action.agentAddress,
|
|
380
|
+
agentName: action.agentName,
|
|
381
|
+
nonce: action.nonce
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
return {
|
|
385
|
+
action,
|
|
386
|
+
signatureHex
|
|
387
|
+
};
|
|
388
|
+
}
|
|
242
389
|
function getRawSignedTransaction(result) {
|
|
243
390
|
if (typeof result === "string" && result.startsWith("0x")) {
|
|
244
391
|
return result;
|
|
@@ -877,6 +1024,104 @@ function HypurrConnectProvider({
|
|
|
877
1024
|
},
|
|
878
1025
|
[tgClient, telegramRpcOptions, refreshWallets]
|
|
879
1026
|
);
|
|
1027
|
+
const renewAgentWallet = useCallback(
|
|
1028
|
+
async ({
|
|
1029
|
+
walletId,
|
|
1030
|
+
ownerAddress,
|
|
1031
|
+
signTypedDataAsync,
|
|
1032
|
+
chainId,
|
|
1033
|
+
approvalDurationMs,
|
|
1034
|
+
agentName
|
|
1035
|
+
}) => {
|
|
1036
|
+
if (authMethod !== "telegram") {
|
|
1037
|
+
throw new Error(
|
|
1038
|
+
"[HypurrConnect] Agent wallet renewal is only available for Telegram wallets."
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
if (!isAddress(ownerAddress)) {
|
|
1042
|
+
throw new Error(
|
|
1043
|
+
"[HypurrConnect] Connect the owner EOA wallet before renewing this agent."
|
|
1044
|
+
);
|
|
1045
|
+
}
|
|
1046
|
+
if (!telegramRpcOptions) {
|
|
1047
|
+
throw new Error("[HypurrConnect] No Telegram RPC session available.");
|
|
1048
|
+
}
|
|
1049
|
+
const wallet = wallets.find((w) => w.id === walletId);
|
|
1050
|
+
if (!wallet) {
|
|
1051
|
+
throw new Error("[HypurrConnect] Agent wallet not found.");
|
|
1052
|
+
}
|
|
1053
|
+
if (!wallet.isAgent) {
|
|
1054
|
+
throw new Error(
|
|
1055
|
+
"[HypurrConnect] Selected wallet is not an agent wallet."
|
|
1056
|
+
);
|
|
1057
|
+
}
|
|
1058
|
+
if (!isAddress(wallet.ethereumAddress)) {
|
|
1059
|
+
throw new Error(
|
|
1060
|
+
"[HypurrConnect] Agent wallet does not have a valid owner EVM address."
|
|
1061
|
+
);
|
|
1062
|
+
}
|
|
1063
|
+
if (ownerAddress.toLowerCase() !== wallet.ethereumAddress.toLowerCase()) {
|
|
1064
|
+
throw new Error(
|
|
1065
|
+
"[HypurrConnect] Connect the owner EOA for this agent wallet before renewing."
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
const agentAddress = wallet.agentEthereumAddress?.value;
|
|
1069
|
+
if (!isAddress(agentAddress)) {
|
|
1070
|
+
throw new Error(
|
|
1071
|
+
"[HypurrConnect] Agent wallet does not have a valid agent EVM address."
|
|
1072
|
+
);
|
|
1073
|
+
}
|
|
1074
|
+
const isTestnet = config.isTestnet ?? false;
|
|
1075
|
+
const approvalAgentName = agentName ?? createTelegramAgentApprovalName(approvalDurationMs);
|
|
1076
|
+
setTgError(null);
|
|
1077
|
+
try {
|
|
1078
|
+
const { action, signatureHex } = await signApproveAgentAction({
|
|
1079
|
+
signTypedDataAsync,
|
|
1080
|
+
agentAddress,
|
|
1081
|
+
agentName: approvalAgentName,
|
|
1082
|
+
chainId,
|
|
1083
|
+
isTestnet
|
|
1084
|
+
});
|
|
1085
|
+
await tgClient.hyperliquidAgentWalletRenew(
|
|
1086
|
+
{
|
|
1087
|
+
authData: {},
|
|
1088
|
+
address: { value: wallet.ethereumAddress },
|
|
1089
|
+
signature: {
|
|
1090
|
+
agentAddress: action.agentAddress,
|
|
1091
|
+
agentName: action.agentName,
|
|
1092
|
+
nonce: action.nonce,
|
|
1093
|
+
chainId,
|
|
1094
|
+
signature: signatureHex
|
|
1095
|
+
}
|
|
1096
|
+
},
|
|
1097
|
+
telegramRpcOptions
|
|
1098
|
+
);
|
|
1099
|
+
const remote = await fetchAgentByAddress(
|
|
1100
|
+
ownerAddress,
|
|
1101
|
+
agentAddress,
|
|
1102
|
+
isTestnet
|
|
1103
|
+
);
|
|
1104
|
+
if (remote && remote.validUntil <= Date.now()) {
|
|
1105
|
+
throw new Error(
|
|
1106
|
+
"[HypurrConnect] Agent renewal was submitted, but the agent is still expired."
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
refreshWallets();
|
|
1110
|
+
} catch (err) {
|
|
1111
|
+
console.error("[HypurrConnect] Agent wallet renewal failed:", err);
|
|
1112
|
+
setTgError(err instanceof Error ? err.message : String(err));
|
|
1113
|
+
throw err;
|
|
1114
|
+
}
|
|
1115
|
+
},
|
|
1116
|
+
[
|
|
1117
|
+
authMethod,
|
|
1118
|
+
config.isTestnet,
|
|
1119
|
+
refreshWallets,
|
|
1120
|
+
telegramRpcOptions,
|
|
1121
|
+
tgClient,
|
|
1122
|
+
wallets
|
|
1123
|
+
]
|
|
1124
|
+
);
|
|
880
1125
|
const createWalletPack = useCallback(
|
|
881
1126
|
async (name) => {
|
|
882
1127
|
const { response } = await tgClient.telegramChatWalletPackCreate(
|
|
@@ -1052,7 +1297,9 @@ function HypurrConnectProvider({
|
|
|
1052
1297
|
sessionStorage.setItem(TELEGRAM_AUTH_STATE_KEY, state);
|
|
1053
1298
|
const configuredReturnTo = config.telegram?.returnTo;
|
|
1054
1299
|
const returnTo = typeof configuredReturnTo === "function" ? configuredReturnTo() : configuredReturnTo || currentReturnTo();
|
|
1055
|
-
const authUrl = new URL(
|
|
1300
|
+
const authUrl = new URL(
|
|
1301
|
+
config.telegram?.authHubUrl || DEFAULT_AUTH_HUB_URL
|
|
1302
|
+
);
|
|
1056
1303
|
authUrl.searchParams.set("return_to", returnTo);
|
|
1057
1304
|
authUrl.searchParams.set("state", state);
|
|
1058
1305
|
authUrl.searchParams.set("scope", normalizeScopes(config.telegram?.scope));
|
|
@@ -1219,6 +1466,7 @@ function HypurrConnectProvider({
|
|
|
1219
1466
|
createWallet,
|
|
1220
1467
|
deleteWallet,
|
|
1221
1468
|
renameWallet,
|
|
1469
|
+
renewAgentWallet,
|
|
1222
1470
|
refreshWallets,
|
|
1223
1471
|
packs,
|
|
1224
1472
|
createWalletPack,
|
|
@@ -1261,6 +1509,7 @@ function HypurrConnectProvider({
|
|
|
1261
1509
|
createWallet,
|
|
1262
1510
|
deleteWallet,
|
|
1263
1511
|
renameWallet,
|
|
1512
|
+
renewAgentWallet,
|
|
1264
1513
|
refreshWallets,
|
|
1265
1514
|
packs,
|
|
1266
1515
|
createWalletPack,
|
|
@@ -1434,6 +1683,7 @@ function TelegramColorIcon({ style }) {
|
|
|
1434
1683
|
// src/LoginModal.tsx
|
|
1435
1684
|
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1436
1685
|
var MOBILE_BREAKPOINT = 640;
|
|
1686
|
+
var DEFAULT_BACKGROUND_COLOR = "rgba(20,20,20,0.95)";
|
|
1437
1687
|
var btnStyle = {
|
|
1438
1688
|
display: "flex",
|
|
1439
1689
|
height: 53,
|
|
@@ -1441,18 +1691,18 @@ var btnStyle = {
|
|
|
1441
1691
|
alignItems: "center",
|
|
1442
1692
|
gap: 12,
|
|
1443
1693
|
overflow: "hidden",
|
|
1444
|
-
borderRadius:
|
|
1445
|
-
background: "rgba(255,255,255,0.
|
|
1446
|
-
padding: "
|
|
1694
|
+
borderRadius: 4,
|
|
1695
|
+
background: "rgba(255,255,255,0.1)",
|
|
1696
|
+
padding: "4px 24px",
|
|
1447
1697
|
fontSize: 14,
|
|
1448
|
-
fontWeight:
|
|
1449
|
-
letterSpacing: "-0.
|
|
1698
|
+
fontWeight: 500,
|
|
1699
|
+
letterSpacing: "-0.03em",
|
|
1450
1700
|
color: "#fff",
|
|
1451
1701
|
cursor: "pointer",
|
|
1452
1702
|
border: "none",
|
|
1453
1703
|
transition: "background 150ms"
|
|
1454
1704
|
};
|
|
1455
|
-
var btnHoverBg = { background: "rgba(255,255,255,0.
|
|
1705
|
+
var btnHoverBg = { background: "rgba(255,255,255,0.15)" };
|
|
1456
1706
|
var backdropStyle = {
|
|
1457
1707
|
position: "fixed",
|
|
1458
1708
|
inset: 0,
|
|
@@ -1479,13 +1729,12 @@ var modalBoxStyle = {
|
|
|
1479
1729
|
overflow: "hidden",
|
|
1480
1730
|
borderRadius: 12,
|
|
1481
1731
|
border: "1px solid rgba(255,255,255,0.1)",
|
|
1482
|
-
background: "#282828",
|
|
1483
1732
|
padding: 24
|
|
1484
1733
|
};
|
|
1485
1734
|
var headingStyle = {
|
|
1486
|
-
fontSize:
|
|
1487
|
-
fontWeight:
|
|
1488
|
-
letterSpacing: "-0.
|
|
1735
|
+
fontSize: 20,
|
|
1736
|
+
fontWeight: 500,
|
|
1737
|
+
letterSpacing: "-0.03em",
|
|
1489
1738
|
color: "#fff",
|
|
1490
1739
|
margin: 0
|
|
1491
1740
|
};
|
|
@@ -1494,7 +1743,7 @@ var dividerStyle = {
|
|
|
1494
1743
|
width: "100%",
|
|
1495
1744
|
background: "rgba(255,255,255,0.05)"
|
|
1496
1745
|
};
|
|
1497
|
-
var iconSize = { width:
|
|
1746
|
+
var iconSize = { width: 26, height: 26 };
|
|
1498
1747
|
var mobileQuery = typeof window !== "undefined" ? window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT}px)`) : null;
|
|
1499
1748
|
function subscribeMobile(cb) {
|
|
1500
1749
|
mobileQuery?.addEventListener("change", cb);
|
|
@@ -1521,7 +1770,11 @@ function HoverButton({
|
|
|
1521
1770
|
}
|
|
1522
1771
|
);
|
|
1523
1772
|
}
|
|
1524
|
-
function LoginModal({
|
|
1773
|
+
function LoginModal({
|
|
1774
|
+
onConnectWallet,
|
|
1775
|
+
walletIcon,
|
|
1776
|
+
backgroundColor = DEFAULT_BACKGROUND_COLOR
|
|
1777
|
+
}) {
|
|
1525
1778
|
const { loginTelegram, loginModalOpen, closeLoginModal } = useHypurrConnectInternal();
|
|
1526
1779
|
const handleTelegramAuth = useCallback2(() => {
|
|
1527
1780
|
closeLoginModal();
|
|
@@ -1561,7 +1814,15 @@ function LoginModal({ onConnectWallet, walletIcon }) {
|
|
|
1561
1814
|
}
|
|
1562
1815
|
)
|
|
1563
1816
|
] });
|
|
1564
|
-
return /* @__PURE__ */ jsx4(AnimatePresence, { children: loginModalOpen && (isMobile ? /* @__PURE__ */ jsx4(
|
|
1817
|
+
return /* @__PURE__ */ jsx4(AnimatePresence, { children: loginModalOpen && (isMobile ? /* @__PURE__ */ jsx4(
|
|
1818
|
+
MobileDrawer,
|
|
1819
|
+
{
|
|
1820
|
+
onClose: closeLoginModal,
|
|
1821
|
+
backgroundColor,
|
|
1822
|
+
children: modalContent
|
|
1823
|
+
},
|
|
1824
|
+
"drawer"
|
|
1825
|
+
) : /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1565
1826
|
/* @__PURE__ */ jsx4(
|
|
1566
1827
|
motion.div,
|
|
1567
1828
|
{
|
|
@@ -1586,7 +1847,7 @@ function LoginModal({ onConnectWallet, walletIcon }) {
|
|
|
1586
1847
|
children: /* @__PURE__ */ jsxs3(
|
|
1587
1848
|
motion.div,
|
|
1588
1849
|
{
|
|
1589
|
-
style: modalBoxStyle,
|
|
1850
|
+
style: { ...modalBoxStyle, background: backgroundColor },
|
|
1590
1851
|
initial: { scale: 0.96, opacity: 0, y: 8 },
|
|
1591
1852
|
animate: { scale: 1, opacity: 1, y: 0 },
|
|
1592
1853
|
exit: { scale: 0.96, opacity: 0, y: 8 },
|
|
@@ -1618,7 +1879,6 @@ var drawerSheetStyle = {
|
|
|
1618
1879
|
borderLeft: "1px solid rgba(255,255,255,0.1)",
|
|
1619
1880
|
borderRight: "1px solid rgba(255,255,255,0.1)",
|
|
1620
1881
|
borderTop: "1px solid rgba(255,255,255,0.1)",
|
|
1621
|
-
background: "#282828",
|
|
1622
1882
|
padding: "12px 24px max(24px, env(safe-area-inset-bottom))"
|
|
1623
1883
|
};
|
|
1624
1884
|
var drawerBgStyle = {
|
|
@@ -1628,7 +1888,6 @@ var drawerBgStyle = {
|
|
|
1628
1888
|
top: 0,
|
|
1629
1889
|
bottom: "-100vh",
|
|
1630
1890
|
zIndex: -1,
|
|
1631
|
-
background: "#282828",
|
|
1632
1891
|
borderTopLeftRadius: 12,
|
|
1633
1892
|
borderTopRightRadius: 12
|
|
1634
1893
|
};
|
|
@@ -1641,12 +1900,13 @@ var grabHandleStyle = {
|
|
|
1641
1900
|
margin: "0 auto",
|
|
1642
1901
|
height: 4,
|
|
1643
1902
|
width: 100,
|
|
1644
|
-
borderRadius:
|
|
1903
|
+
borderRadius: 4,
|
|
1645
1904
|
background: "rgba(255,255,255,0.05)"
|
|
1646
1905
|
};
|
|
1647
1906
|
function MobileDrawer({
|
|
1648
1907
|
children,
|
|
1649
|
-
onClose
|
|
1908
|
+
onClose,
|
|
1909
|
+
backgroundColor
|
|
1650
1910
|
}) {
|
|
1651
1911
|
const controls = useAnimationControls();
|
|
1652
1912
|
const handleDragEnd = useCallback2(
|
|
@@ -1675,7 +1935,7 @@ function MobileDrawer({
|
|
|
1675
1935
|
/* @__PURE__ */ jsxs3(
|
|
1676
1936
|
motion.div,
|
|
1677
1937
|
{
|
|
1678
|
-
style: drawerSheetStyle,
|
|
1938
|
+
style: { ...drawerSheetStyle, background: backgroundColor },
|
|
1679
1939
|
initial: { y: "100%" },
|
|
1680
1940
|
animate: { y: 0 },
|
|
1681
1941
|
exit: { y: "100%" },
|
|
@@ -1685,7 +1945,7 @@ function MobileDrawer({
|
|
|
1685
1945
|
dragElastic: { top: 0, bottom: 0.4 },
|
|
1686
1946
|
onDragEnd: handleDragEnd,
|
|
1687
1947
|
children: [
|
|
1688
|
-
/* @__PURE__ */ jsx4("div", { style: drawerBgStyle }),
|
|
1948
|
+
/* @__PURE__ */ jsx4("div", { style: { ...drawerBgStyle, background: backgroundColor } }),
|
|
1689
1949
|
/* @__PURE__ */ jsx4("div", { style: grabHandleAreaStyle, children: /* @__PURE__ */ jsx4("div", { style: grabHandleStyle }) }),
|
|
1690
1950
|
/* @__PURE__ */ jsx4("p", { style: headingStyle, children: "Connect" }),
|
|
1691
1951
|
children
|
|
@@ -1696,28 +1956,9 @@ function MobileDrawer({
|
|
|
1696
1956
|
] });
|
|
1697
1957
|
}
|
|
1698
1958
|
|
|
1699
|
-
// src/
|
|
1700
|
-
import { AnimatePresence as AnimatePresence5, motion as motion5 } from "framer-motion";
|
|
1701
|
-
import {
|
|
1702
|
-
Fragment as Fragment5,
|
|
1703
|
-
useCallback as useCallback6,
|
|
1704
|
-
useMemo as useMemo2,
|
|
1705
|
-
useState as useState5
|
|
1706
|
-
} from "react";
|
|
1707
|
-
|
|
1708
|
-
// src/UserProfileModal.tsx
|
|
1709
|
-
import { AnimatePresence as AnimatePresence4, motion as motion4 } from "framer-motion";
|
|
1710
|
-
import {
|
|
1711
|
-
useCallback as useCallback5,
|
|
1712
|
-
useState as useState4
|
|
1713
|
-
} from "react";
|
|
1714
|
-
|
|
1715
|
-
// src/DeleteWalletModal.tsx
|
|
1959
|
+
// src/AddWalletModal.tsx
|
|
1716
1960
|
import { AnimatePresence as AnimatePresence2, motion as motion2 } from "framer-motion";
|
|
1717
|
-
import {
|
|
1718
|
-
useCallback as useCallback3,
|
|
1719
|
-
useState as useState2
|
|
1720
|
-
} from "react";
|
|
1961
|
+
import { useCallback as useCallback3, useState as useState2 } from "react";
|
|
1721
1962
|
|
|
1722
1963
|
// src/icons/lucide.tsx
|
|
1723
1964
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
@@ -1764,6 +2005,47 @@ function Wallet(props) {
|
|
|
1764
2005
|
/* @__PURE__ */ jsx5("path", { d: "M18 12a2 2 0 0 0-2 2c0 1.1.9 2 2 2h4v-4z" })
|
|
1765
2006
|
] });
|
|
1766
2007
|
}
|
|
2008
|
+
function Bot(props) {
|
|
2009
|
+
return /* @__PURE__ */ jsxs4("svg", { ...svgBase(props), children: [
|
|
2010
|
+
/* @__PURE__ */ jsx5("path", { d: "M12 8V4H8" }),
|
|
2011
|
+
/* @__PURE__ */ jsx5("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }),
|
|
2012
|
+
/* @__PURE__ */ jsx5("path", { d: "M2 14h2" }),
|
|
2013
|
+
/* @__PURE__ */ jsx5("path", { d: "M20 14h2" }),
|
|
2014
|
+
/* @__PURE__ */ jsx5("path", { d: "M15 13v2" }),
|
|
2015
|
+
/* @__PURE__ */ jsx5("path", { d: "M9 13v2" })
|
|
2016
|
+
] });
|
|
2017
|
+
}
|
|
2018
|
+
function Eye(props) {
|
|
2019
|
+
return /* @__PURE__ */ jsxs4("svg", { ...svgBase(props), children: [
|
|
2020
|
+
/* @__PURE__ */ jsx5("path", { d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" }),
|
|
2021
|
+
/* @__PURE__ */ jsx5("circle", { cx: "12", cy: "12", r: "3" })
|
|
2022
|
+
] });
|
|
2023
|
+
}
|
|
2024
|
+
function EyeOff(props) {
|
|
2025
|
+
return /* @__PURE__ */ jsxs4("svg", { ...svgBase(props), children: [
|
|
2026
|
+
/* @__PURE__ */ jsx5("path", { d: "M10.733 5.076a10.74 10.74 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.8 10.8 0 0 1-1.444 2.49" }),
|
|
2027
|
+
/* @__PURE__ */ jsx5("path", { d: "M14.084 14.158a3 3 0 0 1-4.242-4.242" }),
|
|
2028
|
+
/* @__PURE__ */ jsx5("path", { d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" }),
|
|
2029
|
+
/* @__PURE__ */ jsx5("path", { d: "m2 2 20 20" })
|
|
2030
|
+
] });
|
|
2031
|
+
}
|
|
2032
|
+
function Check(props) {
|
|
2033
|
+
return /* @__PURE__ */ jsx5("svg", { ...svgBase(props), children: /* @__PURE__ */ jsx5("path", { d: "M20 6 9 17l-5-5" }) });
|
|
2034
|
+
}
|
|
2035
|
+
function KeyRound(props) {
|
|
2036
|
+
return /* @__PURE__ */ jsxs4("svg", { ...svgBase(props), children: [
|
|
2037
|
+
/* @__PURE__ */ jsx5("path", { d: "M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z" }),
|
|
2038
|
+
/* @__PURE__ */ jsx5("circle", { cx: "16.5", cy: "7.5", r: ".5", fill: "currentColor" })
|
|
2039
|
+
] });
|
|
2040
|
+
}
|
|
2041
|
+
function RefreshCw(props) {
|
|
2042
|
+
return /* @__PURE__ */ jsxs4("svg", { ...svgBase(props), children: [
|
|
2043
|
+
/* @__PURE__ */ jsx5("path", { d: "M3 12a9 9 0 0 1 15.18-6.49" }),
|
|
2044
|
+
/* @__PURE__ */ jsx5("path", { d: "M21 3v6h-6" }),
|
|
2045
|
+
/* @__PURE__ */ jsx5("path", { d: "M21 12a9 9 0 0 1-15.18 6.49" }),
|
|
2046
|
+
/* @__PURE__ */ jsx5("path", { d: "M3 21v-6h6" })
|
|
2047
|
+
] });
|
|
2048
|
+
}
|
|
1767
2049
|
function TrendingUp(props) {
|
|
1768
2050
|
return /* @__PURE__ */ jsxs4("svg", { ...svgBase(props), children: [
|
|
1769
2051
|
/* @__PURE__ */ jsx5("polyline", { points: "22 7 13.5 15.5 8.5 10.5 2 17" }),
|
|
@@ -1838,21 +2120,1026 @@ function LogOut(props) {
|
|
|
1838
2120
|
/* @__PURE__ */ jsx5("line", { x1: "21", x2: "9", y1: "12", y2: "12" })
|
|
1839
2121
|
] });
|
|
1840
2122
|
}
|
|
1841
|
-
function Plus(props) {
|
|
1842
|
-
return /* @__PURE__ */ jsxs4("svg", { ...svgBase(props), children: [
|
|
1843
|
-
/* @__PURE__ */ jsx5("path", { d: "M5 12h14" }),
|
|
1844
|
-
/* @__PURE__ */ jsx5("path", { d: "M12 5v14" })
|
|
2123
|
+
function Plus(props) {
|
|
2124
|
+
return /* @__PURE__ */ jsxs4("svg", { ...svgBase(props), children: [
|
|
2125
|
+
/* @__PURE__ */ jsx5("path", { d: "M5 12h14" }),
|
|
2126
|
+
/* @__PURE__ */ jsx5("path", { d: "M12 5v14" })
|
|
2127
|
+
] });
|
|
2128
|
+
}
|
|
2129
|
+
function X(props) {
|
|
2130
|
+
return /* @__PURE__ */ jsxs4("svg", { ...svgBase(props), children: [
|
|
2131
|
+
/* @__PURE__ */ jsx5("path", { d: "M18 6 6 18" }),
|
|
2132
|
+
/* @__PURE__ */ jsx5("path", { d: "m6 6 12 12" })
|
|
2133
|
+
] });
|
|
2134
|
+
}
|
|
2135
|
+
function SpinKeyframes() {
|
|
2136
|
+
return /* @__PURE__ */ jsx5("style", { children: `@keyframes hypurr-spin { to { transform: rotate(360deg); } }` });
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
// src/AddWalletModal.tsx
|
|
2140
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2141
|
+
var WALLET_NAME_REGEX = /^[a-zA-Z0-9/]*$/;
|
|
2142
|
+
var PRIVATE_KEY_REGEX = /^(0x)?[a-fA-F0-9]{64}$/;
|
|
2143
|
+
var BASE_TAB_KEYS = ["generate", "import", "api"];
|
|
2144
|
+
function createAuthSignatureRequest(chainId, hyperliquidChain, agentAddress, approvalDurationMs) {
|
|
2145
|
+
const nonce = Date.now();
|
|
2146
|
+
return {
|
|
2147
|
+
domain: {
|
|
2148
|
+
name: "HyperliquidSignTransaction",
|
|
2149
|
+
version: "1",
|
|
2150
|
+
chainId,
|
|
2151
|
+
verifyingContract: "0x0000000000000000000000000000000000000000"
|
|
2152
|
+
},
|
|
2153
|
+
types: {
|
|
2154
|
+
"HyperliquidTransaction:ApproveAgent": [
|
|
2155
|
+
{ name: "hyperliquidChain", type: "string" },
|
|
2156
|
+
{ name: "agentAddress", type: "address" },
|
|
2157
|
+
{ name: "agentName", type: "string" },
|
|
2158
|
+
{ name: "nonce", type: "uint64" }
|
|
2159
|
+
]
|
|
2160
|
+
},
|
|
2161
|
+
primaryType: "HyperliquidTransaction:ApproveAgent",
|
|
2162
|
+
message: {
|
|
2163
|
+
hyperliquidChain,
|
|
2164
|
+
agentAddress: agentAddress.toLowerCase(),
|
|
2165
|
+
agentName: createTelegramAgentApprovalName(approvalDurationMs),
|
|
2166
|
+
nonce
|
|
2167
|
+
}
|
|
2168
|
+
};
|
|
2169
|
+
}
|
|
2170
|
+
var tabClass = (selected) => `flex-1 py-1.5 rounded text-base font-medium flex items-center justify-center gap-1.5 ${selected ? "btn-raised-active" : "btn-raised"}`;
|
|
2171
|
+
var inputClass = (hasError) => `w-full bg-surface-btn/90 border ${hasError ? "border-trade-down/50" : "border-surface-bd"} rounded-lg px-3 py-2.5 text-white placeholder-gray-600 focus:outline-none font-mono text-base`;
|
|
2172
|
+
var formatAddress = (address) => `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
2173
|
+
function AddWalletModal({
|
|
2174
|
+
isOpen,
|
|
2175
|
+
onClose,
|
|
2176
|
+
ownerAddress,
|
|
2177
|
+
isWalletConnected,
|
|
2178
|
+
chainId,
|
|
2179
|
+
signTypedDataAsync,
|
|
2180
|
+
onConnectWallet,
|
|
2181
|
+
onDisconnectWallet,
|
|
2182
|
+
onWalletAdded,
|
|
2183
|
+
onAddReadOnlyWallet,
|
|
2184
|
+
onNotify,
|
|
2185
|
+
hyperliquidChain = "Mainnet",
|
|
2186
|
+
agentApprovalDurationOptions,
|
|
2187
|
+
defaultAgentApprovalDurationMs = DEFAULT_AGENT_APPROVAL_DURATION_MS
|
|
2188
|
+
}) {
|
|
2189
|
+
const tabKeys = onAddReadOnlyWallet ? [...BASE_TAB_KEYS, "readonly"] : BASE_TAB_KEYS;
|
|
2190
|
+
const [activeTab, setActiveTab] = useState2("generate");
|
|
2191
|
+
const [isLoading, setIsLoading] = useState2(false);
|
|
2192
|
+
const [walletName, setWalletName] = useState2("");
|
|
2193
|
+
const [newWalletName, setNewWalletName] = useState2("");
|
|
2194
|
+
const [importWalletName, setImportWalletName] = useState2("");
|
|
2195
|
+
const [importPrivateKey, setImportPrivateKey] = useState2("");
|
|
2196
|
+
const [showImportPrivateKey, setShowImportPrivateKey] = useState2(false);
|
|
2197
|
+
const [readOnlyAddress, setReadOnlyAddress] = useState2("");
|
|
2198
|
+
const [agentApprovalDurationMs, setAgentApprovalDurationMs] = useState2(
|
|
2199
|
+
defaultAgentApprovalDurationMs
|
|
2200
|
+
);
|
|
2201
|
+
const [error, setError] = useState2(null);
|
|
2202
|
+
const {
|
|
2203
|
+
authMethod,
|
|
2204
|
+
createWallet,
|
|
2205
|
+
isLoading: userLoading,
|
|
2206
|
+
refreshWallets,
|
|
2207
|
+
telegramClient,
|
|
2208
|
+
telegramRpcOptions
|
|
2209
|
+
} = useHypurrConnectInternal();
|
|
2210
|
+
const isValidWalletName = walletName.length > 0 && WALLET_NAME_REGEX.test(walletName);
|
|
2211
|
+
const isValidNewWalletName = newWalletName.length > 0 && WALLET_NAME_REGEX.test(newWalletName);
|
|
2212
|
+
const isValidImportWalletName = importWalletName.length > 0 && WALLET_NAME_REGEX.test(importWalletName);
|
|
2213
|
+
const trimmedImportPrivateKey = importPrivateKey.trim();
|
|
2214
|
+
const isValidImportPrivateKey = PRIVATE_KEY_REGEX.test(
|
|
2215
|
+
trimmedImportPrivateKey
|
|
2216
|
+
);
|
|
2217
|
+
const isProcessing = isLoading || userLoading;
|
|
2218
|
+
const durationOptions = agentApprovalDurationOptions && agentApprovalDurationOptions.length > 0 ? agentApprovalDurationOptions : AGENT_APPROVAL_DURATION_OPTIONS;
|
|
2219
|
+
const handleClose = useCallback3(() => {
|
|
2220
|
+
if (isProcessing) return;
|
|
2221
|
+
setError(null);
|
|
2222
|
+
setImportPrivateKey("");
|
|
2223
|
+
setShowImportPrivateKey(false);
|
|
2224
|
+
onClose();
|
|
2225
|
+
}, [isProcessing, onClose]);
|
|
2226
|
+
const assertTelegramReady = useCallback3(() => {
|
|
2227
|
+
if (authMethod !== "telegram" || !telegramRpcOptions) {
|
|
2228
|
+
throw new Error("Telegram login is required to add wallets");
|
|
2229
|
+
}
|
|
2230
|
+
}, [authMethod, telegramRpcOptions]);
|
|
2231
|
+
const completeWalletAdded = useCallback3(
|
|
2232
|
+
async (wallet) => {
|
|
2233
|
+
refreshWallets();
|
|
2234
|
+
await onWalletAdded?.(wallet);
|
|
2235
|
+
},
|
|
2236
|
+
[onWalletAdded, refreshWallets]
|
|
2237
|
+
);
|
|
2238
|
+
const handleCreateWallet = useCallback3(async () => {
|
|
2239
|
+
if (!isValidNewWalletName) {
|
|
2240
|
+
setError("Wallet name may only contain letters, numbers, and /");
|
|
2241
|
+
return;
|
|
2242
|
+
}
|
|
2243
|
+
setError(null);
|
|
2244
|
+
setIsLoading(true);
|
|
2245
|
+
try {
|
|
2246
|
+
assertTelegramReady();
|
|
2247
|
+
const wallet = await createWallet(newWalletName);
|
|
2248
|
+
await completeWalletAdded(wallet);
|
|
2249
|
+
onNotify?.({ type: "success", message: "Wallet created successfully" });
|
|
2250
|
+
setNewWalletName("");
|
|
2251
|
+
handleClose();
|
|
2252
|
+
} catch (e) {
|
|
2253
|
+
const message = e instanceof Error ? e.message : "Failed to create wallet";
|
|
2254
|
+
setError(message);
|
|
2255
|
+
onNotify?.({ type: "error", message });
|
|
2256
|
+
} finally {
|
|
2257
|
+
setIsLoading(false);
|
|
2258
|
+
}
|
|
2259
|
+
}, [
|
|
2260
|
+
assertTelegramReady,
|
|
2261
|
+
completeWalletAdded,
|
|
2262
|
+
createWallet,
|
|
2263
|
+
handleClose,
|
|
2264
|
+
isValidNewWalletName,
|
|
2265
|
+
newWalletName,
|
|
2266
|
+
onNotify
|
|
2267
|
+
]);
|
|
2268
|
+
const handleImportWallet = useCallback3(async () => {
|
|
2269
|
+
if (!isValidImportWalletName) {
|
|
2270
|
+
setError("Wallet name may only contain letters, numbers, and /");
|
|
2271
|
+
return;
|
|
2272
|
+
}
|
|
2273
|
+
if (!isValidImportPrivateKey) {
|
|
2274
|
+
setError("Please enter a valid 64-character hex private key");
|
|
2275
|
+
return;
|
|
2276
|
+
}
|
|
2277
|
+
setError(null);
|
|
2278
|
+
setIsLoading(true);
|
|
2279
|
+
try {
|
|
2280
|
+
assertTelegramReady();
|
|
2281
|
+
const response = await telegramClient.hyperliquidWalletImport(
|
|
2282
|
+
{
|
|
2283
|
+
authData: {},
|
|
2284
|
+
name: importWalletName,
|
|
2285
|
+
privateKey: trimmedImportPrivateKey
|
|
2286
|
+
},
|
|
2287
|
+
telegramRpcOptions
|
|
2288
|
+
);
|
|
2289
|
+
await completeWalletAdded(response.response.wallet);
|
|
2290
|
+
onNotify?.({ type: "success", message: "Wallet imported successfully" });
|
|
2291
|
+
setImportWalletName("");
|
|
2292
|
+
setImportPrivateKey("");
|
|
2293
|
+
handleClose();
|
|
2294
|
+
} catch (e) {
|
|
2295
|
+
const message = e instanceof Error ? e.message : "Failed to import wallet";
|
|
2296
|
+
setError(message);
|
|
2297
|
+
onNotify?.({ type: "error", message });
|
|
2298
|
+
} finally {
|
|
2299
|
+
setIsLoading(false);
|
|
2300
|
+
}
|
|
2301
|
+
}, [
|
|
2302
|
+
assertTelegramReady,
|
|
2303
|
+
completeWalletAdded,
|
|
2304
|
+
handleClose,
|
|
2305
|
+
importWalletName,
|
|
2306
|
+
isValidImportPrivateKey,
|
|
2307
|
+
isValidImportWalletName,
|
|
2308
|
+
onNotify,
|
|
2309
|
+
telegramClient,
|
|
2310
|
+
telegramRpcOptions,
|
|
2311
|
+
trimmedImportPrivateKey
|
|
2312
|
+
]);
|
|
2313
|
+
const handleSignAndAdd = useCallback3(async () => {
|
|
2314
|
+
if (!ownerAddress) {
|
|
2315
|
+
onConnectWallet?.();
|
|
2316
|
+
return;
|
|
2317
|
+
}
|
|
2318
|
+
if (!signTypedDataAsync || !chainId) {
|
|
2319
|
+
setError("Wallet signing is not ready yet");
|
|
2320
|
+
return;
|
|
2321
|
+
}
|
|
2322
|
+
if (!isValidWalletName) {
|
|
2323
|
+
setError("Wallet name may only contain letters, numbers, and /");
|
|
2324
|
+
return;
|
|
2325
|
+
}
|
|
2326
|
+
setError(null);
|
|
2327
|
+
setIsLoading(true);
|
|
2328
|
+
try {
|
|
2329
|
+
assertTelegramReady();
|
|
2330
|
+
const res = await telegramClient.hyperliquidAgentSignatureCreate(
|
|
2331
|
+
{ authData: {}, address: ownerAddress },
|
|
2332
|
+
telegramRpcOptions
|
|
2333
|
+
);
|
|
2334
|
+
const agentAddress = res.response.agent;
|
|
2335
|
+
const request = createAuthSignatureRequest(
|
|
2336
|
+
chainId,
|
|
2337
|
+
hyperliquidChain,
|
|
2338
|
+
agentAddress,
|
|
2339
|
+
agentApprovalDurationMs
|
|
2340
|
+
);
|
|
2341
|
+
const signature = await signTypedDataAsync(request);
|
|
2342
|
+
await telegramClient.hyperliquidAgentWalletCreate(
|
|
2343
|
+
{
|
|
2344
|
+
authData: {},
|
|
2345
|
+
name: walletName,
|
|
2346
|
+
signature: {
|
|
2347
|
+
agentAddress: request.message.agentAddress,
|
|
2348
|
+
agentName: request.message.agentName,
|
|
2349
|
+
nonce: request.message.nonce,
|
|
2350
|
+
chainId,
|
|
2351
|
+
signature
|
|
2352
|
+
}
|
|
2353
|
+
},
|
|
2354
|
+
telegramRpcOptions
|
|
2355
|
+
);
|
|
2356
|
+
await completeWalletAdded();
|
|
2357
|
+
onNotify?.({ type: "success", message: "Wallet added successfully" });
|
|
2358
|
+
onDisconnectWallet?.();
|
|
2359
|
+
setWalletName("");
|
|
2360
|
+
handleClose();
|
|
2361
|
+
} catch (e) {
|
|
2362
|
+
const message = e instanceof Error ? e.message : "Failed to add wallet";
|
|
2363
|
+
setError(message);
|
|
2364
|
+
onNotify?.({ type: "error", message });
|
|
2365
|
+
} finally {
|
|
2366
|
+
setIsLoading(false);
|
|
2367
|
+
}
|
|
2368
|
+
}, [
|
|
2369
|
+
assertTelegramReady,
|
|
2370
|
+
agentApprovalDurationMs,
|
|
2371
|
+
chainId,
|
|
2372
|
+
completeWalletAdded,
|
|
2373
|
+
handleClose,
|
|
2374
|
+
hyperliquidChain,
|
|
2375
|
+
isValidWalletName,
|
|
2376
|
+
onConnectWallet,
|
|
2377
|
+
onDisconnectWallet,
|
|
2378
|
+
onNotify,
|
|
2379
|
+
ownerAddress,
|
|
2380
|
+
signTypedDataAsync,
|
|
2381
|
+
telegramClient,
|
|
2382
|
+
telegramRpcOptions,
|
|
2383
|
+
walletName
|
|
2384
|
+
]);
|
|
2385
|
+
const handleAddReadOnly = useCallback3(async () => {
|
|
2386
|
+
const trimmed = readOnlyAddress.trim();
|
|
2387
|
+
if (!trimmed) {
|
|
2388
|
+
setError("Please enter a wallet address");
|
|
2389
|
+
return;
|
|
2390
|
+
}
|
|
2391
|
+
if (!/^0x[a-fA-F0-9]{40}$/.test(trimmed)) {
|
|
2392
|
+
setError("Invalid Ethereum address format");
|
|
2393
|
+
return;
|
|
2394
|
+
}
|
|
2395
|
+
setError(null);
|
|
2396
|
+
setIsLoading(true);
|
|
2397
|
+
try {
|
|
2398
|
+
await onAddReadOnlyWallet?.(trimmed);
|
|
2399
|
+
onNotify?.({ type: "success", message: "Read-only wallet added" });
|
|
2400
|
+
setReadOnlyAddress("");
|
|
2401
|
+
handleClose();
|
|
2402
|
+
} catch (e) {
|
|
2403
|
+
const message = e instanceof Error ? e.message : "Failed to add wallet";
|
|
2404
|
+
setError(message);
|
|
2405
|
+
onNotify?.({ type: "error", message });
|
|
2406
|
+
} finally {
|
|
2407
|
+
setIsLoading(false);
|
|
2408
|
+
}
|
|
2409
|
+
}, [handleClose, onAddReadOnlyWallet, onNotify, readOnlyAddress]);
|
|
2410
|
+
return /* @__PURE__ */ jsx6(AnimatePresence2, { children: isOpen && /* @__PURE__ */ jsxs5(motion2.div, { className: "hypurr-connect", style: { display: "contents" }, children: [
|
|
2411
|
+
/* @__PURE__ */ jsx6(SpinKeyframes, {}),
|
|
2412
|
+
/* @__PURE__ */ jsx6(
|
|
2413
|
+
motion2.div,
|
|
2414
|
+
{
|
|
2415
|
+
className: "fixed inset-0 z-[100] bg-black/70 backdrop-blur-sm",
|
|
2416
|
+
initial: { opacity: 0 },
|
|
2417
|
+
animate: { opacity: 1 },
|
|
2418
|
+
exit: { opacity: 0 },
|
|
2419
|
+
transition: { duration: 0.15 },
|
|
2420
|
+
onClick: handleClose
|
|
2421
|
+
}
|
|
2422
|
+
),
|
|
2423
|
+
/* @__PURE__ */ jsx6("div", { className: "fixed inset-0 z-[101] flex items-center justify-center p-4", children: /* @__PURE__ */ jsxs5(
|
|
2424
|
+
motion2.div,
|
|
2425
|
+
{
|
|
2426
|
+
className: "relative w-full max-w-md overflow-hidden rounded-lg border border-surface-bd bg-surface-modal font-sans shadow-modal",
|
|
2427
|
+
initial: { opacity: 0, y: 8 },
|
|
2428
|
+
animate: { opacity: 1, y: 0 },
|
|
2429
|
+
exit: { opacity: 0, y: 8 },
|
|
2430
|
+
transition: { duration: 0.18, ease: "easeOut" },
|
|
2431
|
+
onClick: (event) => event.stopPropagation(),
|
|
2432
|
+
children: [
|
|
2433
|
+
/* @__PURE__ */ jsxs5("div", { className: "relative flex items-center justify-center border-b border-white/[0.06] px-6 pb-5 pt-6", children: [
|
|
2434
|
+
/* @__PURE__ */ jsx6("h3", { className: "text-lg font-semibold text-white", children: "Add Wallet" }),
|
|
2435
|
+
/* @__PURE__ */ jsx6(
|
|
2436
|
+
"button",
|
|
2437
|
+
{
|
|
2438
|
+
onClick: handleClose,
|
|
2439
|
+
disabled: isProcessing,
|
|
2440
|
+
className: "absolute right-6 text-gray-400 transition-colors hover:text-white disabled:cursor-not-allowed disabled:opacity-40",
|
|
2441
|
+
"aria-label": "Close",
|
|
2442
|
+
children: /* @__PURE__ */ jsx6(X, { size: 16 })
|
|
2443
|
+
}
|
|
2444
|
+
)
|
|
2445
|
+
] }),
|
|
2446
|
+
/* @__PURE__ */ jsx6("div", { className: "flex gap-1.5 px-6 pt-5", children: tabKeys.map((tab) => /* @__PURE__ */ jsx6(
|
|
2447
|
+
"button",
|
|
2448
|
+
{
|
|
2449
|
+
type: "button",
|
|
2450
|
+
onClick: () => {
|
|
2451
|
+
setError(null);
|
|
2452
|
+
setActiveTab(tab);
|
|
2453
|
+
},
|
|
2454
|
+
className: tabClass(activeTab === tab),
|
|
2455
|
+
children: tab === "generate" ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2456
|
+
/* @__PURE__ */ jsx6(Plus, { size: 13 }),
|
|
2457
|
+
" New"
|
|
2458
|
+
] }) : tab === "import" ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2459
|
+
/* @__PURE__ */ jsx6(KeyRound, { size: 13 }),
|
|
2460
|
+
" Import"
|
|
2461
|
+
] }) : tab === "api" ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2462
|
+
/* @__PURE__ */ jsx6(Wallet, { size: 13 }),
|
|
2463
|
+
" Link"
|
|
2464
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2465
|
+
/* @__PURE__ */ jsx6(Eye, { size: 13 }),
|
|
2466
|
+
" Watch"
|
|
2467
|
+
] })
|
|
2468
|
+
},
|
|
2469
|
+
tab
|
|
2470
|
+
)) }),
|
|
2471
|
+
/* @__PURE__ */ jsxs5("div", { className: "px-6 pb-6 pt-5", children: [
|
|
2472
|
+
activeTab === "generate" && /* @__PURE__ */ jsxs5("section", { className: "space-y-4", children: [
|
|
2473
|
+
/* @__PURE__ */ jsx6("p", { className: "text-base text-gray-400", children: "Create a new Hyperliquid wallet." }),
|
|
2474
|
+
/* @__PURE__ */ jsx6(
|
|
2475
|
+
WalletNameInput,
|
|
2476
|
+
{
|
|
2477
|
+
value: newWalletName,
|
|
2478
|
+
setValue: setNewWalletName,
|
|
2479
|
+
isValid: isValidNewWalletName,
|
|
2480
|
+
clearError: () => setError(null),
|
|
2481
|
+
placeholder: "MyNewWallet"
|
|
2482
|
+
}
|
|
2483
|
+
),
|
|
2484
|
+
/* @__PURE__ */ jsx6(
|
|
2485
|
+
"button",
|
|
2486
|
+
{
|
|
2487
|
+
onClick: handleCreateWallet,
|
|
2488
|
+
disabled: isProcessing || !isValidNewWalletName,
|
|
2489
|
+
className: `flex w-full items-center justify-center gap-2 rounded-lg py-2 text-base font-medium ${!isProcessing && isValidNewWalletName ? "btn-raised" : "btn-raised-disabled"}`,
|
|
2490
|
+
children: isProcessing ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2491
|
+
/* @__PURE__ */ jsx6(Loader2, { size: 14 }),
|
|
2492
|
+
" Creating..."
|
|
2493
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2494
|
+
/* @__PURE__ */ jsx6(Plus, { size: 14 }),
|
|
2495
|
+
" Create Wallet"
|
|
2496
|
+
] })
|
|
2497
|
+
}
|
|
2498
|
+
),
|
|
2499
|
+
error && /* @__PURE__ */ jsx6(ErrorBox, { message: error })
|
|
2500
|
+
] }),
|
|
2501
|
+
activeTab === "import" && /* @__PURE__ */ jsxs5("section", { className: "space-y-4", children: [
|
|
2502
|
+
/* @__PURE__ */ jsx6("p", { className: "text-base text-gray-400", children: "Import a Hyperliquid wallet with its private key." }),
|
|
2503
|
+
/* @__PURE__ */ jsx6(
|
|
2504
|
+
WalletNameInput,
|
|
2505
|
+
{
|
|
2506
|
+
value: importWalletName,
|
|
2507
|
+
setValue: setImportWalletName,
|
|
2508
|
+
isValid: isValidImportWalletName,
|
|
2509
|
+
clearError: () => setError(null),
|
|
2510
|
+
placeholder: "MyImportedWallet"
|
|
2511
|
+
}
|
|
2512
|
+
),
|
|
2513
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
2514
|
+
/* @__PURE__ */ jsx6("label", { className: "mb-2 block text-base uppercase tracking-[0.1em] text-gray-400", children: "Private Key" }),
|
|
2515
|
+
/* @__PURE__ */ jsxs5("div", { className: "relative", children: [
|
|
2516
|
+
/* @__PURE__ */ jsx6(
|
|
2517
|
+
"input",
|
|
2518
|
+
{
|
|
2519
|
+
type: showImportPrivateKey ? "text" : "password",
|
|
2520
|
+
value: importPrivateKey,
|
|
2521
|
+
onChange: (event) => {
|
|
2522
|
+
setImportPrivateKey(event.target.value);
|
|
2523
|
+
setError(null);
|
|
2524
|
+
},
|
|
2525
|
+
placeholder: "0x...",
|
|
2526
|
+
spellCheck: false,
|
|
2527
|
+
autoComplete: "off",
|
|
2528
|
+
className: `${inputClass(
|
|
2529
|
+
!!importPrivateKey && !isValidImportPrivateKey
|
|
2530
|
+
)} pr-11`
|
|
2531
|
+
}
|
|
2532
|
+
),
|
|
2533
|
+
/* @__PURE__ */ jsx6(
|
|
2534
|
+
"button",
|
|
2535
|
+
{
|
|
2536
|
+
type: "button",
|
|
2537
|
+
onClick: () => setShowImportPrivateKey((visible) => !visible),
|
|
2538
|
+
className: "absolute right-2 top-1/2 -translate-y-1/2 p-1.5 text-gray-500 transition-colors hover:text-gray-300",
|
|
2539
|
+
"aria-label": showImportPrivateKey ? "Hide private key" : "Show private key",
|
|
2540
|
+
children: showImportPrivateKey ? /* @__PURE__ */ jsx6(EyeOff, { size: 15 }) : /* @__PURE__ */ jsx6(Eye, { size: 15 })
|
|
2541
|
+
}
|
|
2542
|
+
)
|
|
2543
|
+
] })
|
|
2544
|
+
] }),
|
|
2545
|
+
/* @__PURE__ */ jsx6(
|
|
2546
|
+
"button",
|
|
2547
|
+
{
|
|
2548
|
+
onClick: handleImportWallet,
|
|
2549
|
+
disabled: isProcessing || !isValidImportWalletName || !isValidImportPrivateKey,
|
|
2550
|
+
className: `flex w-full items-center justify-center gap-2 rounded-lg border bg-transparent py-2 text-base font-medium transition-colors ${!isProcessing && isValidImportWalletName && isValidImportPrivateKey ? "border-purple-500 text-purple-400 hover:bg-purple-500/10" : "cursor-not-allowed border-gray-700 text-gray-600"}`,
|
|
2551
|
+
children: isProcessing ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2552
|
+
/* @__PURE__ */ jsx6(Loader2, { size: 14 }),
|
|
2553
|
+
" Importing..."
|
|
2554
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2555
|
+
/* @__PURE__ */ jsx6(KeyRound, { size: 14 }),
|
|
2556
|
+
" Import Wallet"
|
|
2557
|
+
] })
|
|
2558
|
+
}
|
|
2559
|
+
),
|
|
2560
|
+
error && /* @__PURE__ */ jsx6(ErrorBox, { message: error })
|
|
2561
|
+
] }),
|
|
2562
|
+
activeTab === "api" && /* @__PURE__ */ jsxs5("section", { className: "space-y-4", children: [
|
|
2563
|
+
/* @__PURE__ */ jsx6("p", { className: "text-base text-gray-400", children: "Connect your wallet and sign to link it for trading." }),
|
|
2564
|
+
!isWalletConnected || !ownerAddress ? /* @__PURE__ */ jsxs5(
|
|
2565
|
+
"button",
|
|
2566
|
+
{
|
|
2567
|
+
onClick: onConnectWallet,
|
|
2568
|
+
className: "btn-raised flex w-full items-center justify-center gap-2 rounded-lg py-2 text-base font-medium",
|
|
2569
|
+
children: [
|
|
2570
|
+
/* @__PURE__ */ jsx6(Wallet, { size: 14 }),
|
|
2571
|
+
" Connect Wallet"
|
|
2572
|
+
]
|
|
2573
|
+
}
|
|
2574
|
+
) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2575
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3 rounded-lg border border-white/[0.06] bg-white/[0.03] px-3 py-2.5", children: [
|
|
2576
|
+
/* @__PURE__ */ jsx6("div", { className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-md border border-white/[0.08] bg-white/[0.06]", children: /* @__PURE__ */ jsx6(Wallet, { size: 14, className: "text-gray-400" }) }),
|
|
2577
|
+
/* @__PURE__ */ jsxs5("div", { className: "min-w-0 flex-1", children: [
|
|
2578
|
+
/* @__PURE__ */ jsx6("p", { className: "text-base text-gray-400", children: "Connected" }),
|
|
2579
|
+
/* @__PURE__ */ jsx6("p", { className: "font-mono text-base text-white", children: formatAddress(ownerAddress) })
|
|
2580
|
+
] }),
|
|
2581
|
+
/* @__PURE__ */ jsx6(
|
|
2582
|
+
Check,
|
|
2583
|
+
{
|
|
2584
|
+
size: 16,
|
|
2585
|
+
className: "flex-shrink-0 text-trade-up"
|
|
2586
|
+
}
|
|
2587
|
+
)
|
|
2588
|
+
] }),
|
|
2589
|
+
/* @__PURE__ */ jsx6(
|
|
2590
|
+
WalletNameInput,
|
|
2591
|
+
{
|
|
2592
|
+
value: walletName,
|
|
2593
|
+
setValue: setWalletName,
|
|
2594
|
+
isValid: isValidWalletName,
|
|
2595
|
+
clearError: () => setError(null),
|
|
2596
|
+
placeholder: "MyWallet"
|
|
2597
|
+
}
|
|
2598
|
+
),
|
|
2599
|
+
/* @__PURE__ */ jsx6(
|
|
2600
|
+
ApprovalDurationPicker,
|
|
2601
|
+
{
|
|
2602
|
+
value: agentApprovalDurationMs,
|
|
2603
|
+
onChange: setAgentApprovalDurationMs,
|
|
2604
|
+
options: durationOptions,
|
|
2605
|
+
disabled: isProcessing
|
|
2606
|
+
}
|
|
2607
|
+
),
|
|
2608
|
+
/* @__PURE__ */ jsx6(
|
|
2609
|
+
"button",
|
|
2610
|
+
{
|
|
2611
|
+
onClick: handleSignAndAdd,
|
|
2612
|
+
disabled: isProcessing || !isValidWalletName,
|
|
2613
|
+
className: `flex w-full items-center justify-center gap-2 rounded-lg py-2 text-base font-medium ${!isProcessing && isValidWalletName ? "btn-raised" : "btn-raised-disabled"}`,
|
|
2614
|
+
children: isProcessing ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2615
|
+
/* @__PURE__ */ jsx6(Loader2, { size: 14 }),
|
|
2616
|
+
" Signing..."
|
|
2617
|
+
] }) : "Sign & Add Wallet"
|
|
2618
|
+
}
|
|
2619
|
+
),
|
|
2620
|
+
onDisconnectWallet && /* @__PURE__ */ jsx6(
|
|
2621
|
+
"button",
|
|
2622
|
+
{
|
|
2623
|
+
onClick: onDisconnectWallet,
|
|
2624
|
+
className: "w-full py-1.5 text-base text-gray-400 transition-colors hover:text-gray-300",
|
|
2625
|
+
children: "Disconnect & use different wallet"
|
|
2626
|
+
}
|
|
2627
|
+
)
|
|
2628
|
+
] }),
|
|
2629
|
+
error && /* @__PURE__ */ jsx6(ErrorBox, { message: error })
|
|
2630
|
+
] }),
|
|
2631
|
+
activeTab === "readonly" && onAddReadOnlyWallet && /* @__PURE__ */ jsxs5("section", { className: "space-y-4", children: [
|
|
2632
|
+
/* @__PURE__ */ jsx6("p", { className: "text-base text-gray-400", children: "View positions and balances without trading access." }),
|
|
2633
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
2634
|
+
/* @__PURE__ */ jsx6("label", { className: "mb-2 block text-base uppercase tracking-[0.1em] text-gray-400", children: "Wallet Address" }),
|
|
2635
|
+
/* @__PURE__ */ jsx6(
|
|
2636
|
+
"input",
|
|
2637
|
+
{
|
|
2638
|
+
type: "text",
|
|
2639
|
+
value: readOnlyAddress,
|
|
2640
|
+
onChange: (event) => setReadOnlyAddress(event.target.value),
|
|
2641
|
+
placeholder: "0x...",
|
|
2642
|
+
className: inputClass()
|
|
2643
|
+
}
|
|
2644
|
+
)
|
|
2645
|
+
] }),
|
|
2646
|
+
/* @__PURE__ */ jsx6(
|
|
2647
|
+
"button",
|
|
2648
|
+
{
|
|
2649
|
+
onClick: handleAddReadOnly,
|
|
2650
|
+
disabled: isProcessing || !readOnlyAddress.trim(),
|
|
2651
|
+
className: `flex w-full items-center justify-center gap-2 rounded-lg py-2 text-base font-medium ${!isProcessing && readOnlyAddress.trim() ? "btn-raised" : "btn-raised-disabled"}`,
|
|
2652
|
+
children: isProcessing ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2653
|
+
/* @__PURE__ */ jsx6(Loader2, { size: 14 }),
|
|
2654
|
+
" Adding..."
|
|
2655
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2656
|
+
/* @__PURE__ */ jsx6(Eye, { size: 14 }),
|
|
2657
|
+
" Add Watch Wallet"
|
|
2658
|
+
] })
|
|
2659
|
+
}
|
|
2660
|
+
),
|
|
2661
|
+
error && /* @__PURE__ */ jsx6(ErrorBox, { message: error })
|
|
2662
|
+
] })
|
|
2663
|
+
] })
|
|
2664
|
+
]
|
|
2665
|
+
}
|
|
2666
|
+
) })
|
|
2667
|
+
] }) });
|
|
2668
|
+
}
|
|
2669
|
+
function WalletNameInput({
|
|
2670
|
+
value,
|
|
2671
|
+
setValue,
|
|
2672
|
+
isValid,
|
|
2673
|
+
clearError,
|
|
2674
|
+
placeholder
|
|
2675
|
+
}) {
|
|
2676
|
+
return /* @__PURE__ */ jsxs5("div", { children: [
|
|
2677
|
+
/* @__PURE__ */ jsx6("label", { className: "mb-2 block text-base uppercase tracking-[0.1em] text-gray-400", children: "Wallet Name" }),
|
|
2678
|
+
/* @__PURE__ */ jsx6(
|
|
2679
|
+
"input",
|
|
2680
|
+
{
|
|
2681
|
+
type: "text",
|
|
2682
|
+
value,
|
|
2683
|
+
onChange: (event) => {
|
|
2684
|
+
const nextValue = event.target.value;
|
|
2685
|
+
if (WALLET_NAME_REGEX.test(nextValue) || nextValue === "") {
|
|
2686
|
+
setValue(nextValue);
|
|
2687
|
+
clearError();
|
|
2688
|
+
}
|
|
2689
|
+
},
|
|
2690
|
+
placeholder,
|
|
2691
|
+
className: inputClass(!!value && !isValid)
|
|
2692
|
+
}
|
|
2693
|
+
),
|
|
2694
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-1.5 text-base text-gray-600", children: "Letters, numbers, and / only" })
|
|
2695
|
+
] });
|
|
2696
|
+
}
|
|
2697
|
+
function ApprovalDurationPicker({
|
|
2698
|
+
value,
|
|
2699
|
+
onChange,
|
|
2700
|
+
options,
|
|
2701
|
+
disabled
|
|
2702
|
+
}) {
|
|
2703
|
+
return /* @__PURE__ */ jsxs5("div", { children: [
|
|
2704
|
+
/* @__PURE__ */ jsx6("label", { className: "mb-2 block text-base uppercase tracking-[0.1em] text-gray-400", children: "Approval Duration" }),
|
|
2705
|
+
/* @__PURE__ */ jsx6("div", { className: "grid grid-cols-4 gap-1.5", children: options.map((option) => /* @__PURE__ */ jsx6(
|
|
2706
|
+
"button",
|
|
2707
|
+
{
|
|
2708
|
+
type: "button",
|
|
2709
|
+
onClick: () => onChange(option.durationMs),
|
|
2710
|
+
disabled,
|
|
2711
|
+
className: `rounded py-1.5 text-base font-medium disabled:cursor-not-allowed disabled:opacity-50 ${value === option.durationMs ? "btn-raised-active" : "btn-raised"}`,
|
|
2712
|
+
children: option.label
|
|
2713
|
+
},
|
|
2714
|
+
`${option.label}-${option.durationMs}`
|
|
2715
|
+
)) })
|
|
2716
|
+
] });
|
|
2717
|
+
}
|
|
2718
|
+
function ErrorBox({ message }) {
|
|
2719
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex items-start gap-2 rounded-lg border border-trade-down/20 bg-trade-down/[0.08] p-3", children: [
|
|
2720
|
+
/* @__PURE__ */ jsx6(
|
|
2721
|
+
AlertTriangle,
|
|
2722
|
+
{
|
|
2723
|
+
size: 14,
|
|
2724
|
+
className: "mt-0.5 flex-shrink-0 text-trade-down"
|
|
2725
|
+
}
|
|
2726
|
+
),
|
|
2727
|
+
/* @__PURE__ */ jsx6("p", { className: "text-base text-trade-down", children: message })
|
|
2728
|
+
] });
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2731
|
+
// src/RenewAgentModal.tsx
|
|
2732
|
+
import { AnimatePresence as AnimatePresence3, motion as motion3 } from "framer-motion";
|
|
2733
|
+
import { useCallback as useCallback4, useMemo as useMemo2, useState as useState3 } from "react";
|
|
2734
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2735
|
+
var isHexAddress = (address) => !!address && /^0x[a-fA-F0-9]{40}$/.test(address);
|
|
2736
|
+
var formatAddress2 = (address) => address ? `${address.slice(0, 6)}...${address.slice(-4)}` : "";
|
|
2737
|
+
var isSameAddress = (a, b) => isHexAddress(a) && isHexAddress(b) && a.toLowerCase() === b.toLowerCase();
|
|
2738
|
+
function RenewAgentModal({
|
|
2739
|
+
isOpen,
|
|
2740
|
+
onClose,
|
|
2741
|
+
wallet,
|
|
2742
|
+
ownerAddress,
|
|
2743
|
+
isWalletConnected,
|
|
2744
|
+
chainId,
|
|
2745
|
+
signTypedDataAsync,
|
|
2746
|
+
onConnectWallet,
|
|
2747
|
+
onDisconnectWallet,
|
|
2748
|
+
onRenewed,
|
|
2749
|
+
onNotify,
|
|
2750
|
+
approvalDurationOptions,
|
|
2751
|
+
defaultApprovalDurationMs = DEFAULT_AGENT_APPROVAL_DURATION_MS
|
|
2752
|
+
}) {
|
|
2753
|
+
const { renewAgentWallet } = useHypurrConnectInternal();
|
|
2754
|
+
const [isRenewing, setIsRenewing] = useState3(false);
|
|
2755
|
+
const [approvalDurationMs, setApprovalDurationMs] = useState3(
|
|
2756
|
+
defaultApprovalDurationMs
|
|
2757
|
+
);
|
|
2758
|
+
const [error, setError] = useState3(null);
|
|
2759
|
+
const expiryMessage = useMemo2(
|
|
2760
|
+
() => wallet ? getAgentExpiryTitle(wallet) : null,
|
|
2761
|
+
[wallet]
|
|
2762
|
+
);
|
|
2763
|
+
const currentExpiryMs = useMemo2(
|
|
2764
|
+
() => wallet ? agentExpiresAtMs(wallet) : null,
|
|
2765
|
+
[wallet]
|
|
2766
|
+
);
|
|
2767
|
+
const durationOptions = approvalDurationOptions && approvalDurationOptions.length > 0 ? approvalDurationOptions : AGENT_APPROVAL_DURATION_OPTIONS;
|
|
2768
|
+
const expectedOwnerAddress = wallet?.ethereumAddress ?? null;
|
|
2769
|
+
const agentAddress = wallet?.agentEthereumAddress?.value ?? null;
|
|
2770
|
+
const hasExpectedOwner = isHexAddress(expectedOwnerAddress);
|
|
2771
|
+
const hasAgentAddress = isHexAddress(agentAddress);
|
|
2772
|
+
const hasConnectedOwner = isWalletConnected && isHexAddress(ownerAddress);
|
|
2773
|
+
const ownerMatches = isSameAddress(ownerAddress, expectedOwnerAddress);
|
|
2774
|
+
const ownerReady = ownerMatches && !!chainId;
|
|
2775
|
+
const canRenew = !!wallet && hasAgentAddress && ownerReady && !!signTypedDataAsync && !isRenewing;
|
|
2776
|
+
const handleClose = useCallback4(() => {
|
|
2777
|
+
if (isRenewing) return;
|
|
2778
|
+
setError(null);
|
|
2779
|
+
onClose();
|
|
2780
|
+
}, [isRenewing, onClose]);
|
|
2781
|
+
const handleRenew = useCallback4(async () => {
|
|
2782
|
+
if (!wallet) return;
|
|
2783
|
+
if (!isHexAddress(agentAddress)) {
|
|
2784
|
+
setError("This wallet is missing its agent address.");
|
|
2785
|
+
return;
|
|
2786
|
+
}
|
|
2787
|
+
if (!isHexAddress(expectedOwnerAddress)) {
|
|
2788
|
+
setError("This wallet is missing its owner address.");
|
|
2789
|
+
return;
|
|
2790
|
+
}
|
|
2791
|
+
if (!isHexAddress(ownerAddress)) {
|
|
2792
|
+
onConnectWallet?.();
|
|
2793
|
+
return;
|
|
2794
|
+
}
|
|
2795
|
+
if (!isSameAddress(ownerAddress, expectedOwnerAddress)) {
|
|
2796
|
+
setError(
|
|
2797
|
+
`Connect the owner wallet ${formatAddress2(expectedOwnerAddress)} to renew this agent.`
|
|
2798
|
+
);
|
|
2799
|
+
return;
|
|
2800
|
+
}
|
|
2801
|
+
if (!chainId || !signTypedDataAsync) {
|
|
2802
|
+
setError("Wallet signing is not ready yet");
|
|
2803
|
+
return;
|
|
2804
|
+
}
|
|
2805
|
+
setError(null);
|
|
2806
|
+
setIsRenewing(true);
|
|
2807
|
+
try {
|
|
2808
|
+
await renewAgentWallet({
|
|
2809
|
+
walletId: wallet.id,
|
|
2810
|
+
ownerAddress,
|
|
2811
|
+
signTypedDataAsync,
|
|
2812
|
+
chainId,
|
|
2813
|
+
approvalDurationMs
|
|
2814
|
+
});
|
|
2815
|
+
await onRenewed?.(wallet);
|
|
2816
|
+
onNotify?.({ type: "success", message: "Agent wallet renewed" });
|
|
2817
|
+
onClose();
|
|
2818
|
+
} catch (e) {
|
|
2819
|
+
const message = e instanceof Error ? e.message : "Failed to renew agent wallet";
|
|
2820
|
+
setError(message);
|
|
2821
|
+
onNotify?.({ type: "error", message });
|
|
2822
|
+
} finally {
|
|
2823
|
+
setIsRenewing(false);
|
|
2824
|
+
}
|
|
2825
|
+
}, [
|
|
2826
|
+
agentAddress,
|
|
2827
|
+
approvalDurationMs,
|
|
2828
|
+
chainId,
|
|
2829
|
+
expectedOwnerAddress,
|
|
2830
|
+
onClose,
|
|
2831
|
+
onConnectWallet,
|
|
2832
|
+
onNotify,
|
|
2833
|
+
onRenewed,
|
|
2834
|
+
ownerAddress,
|
|
2835
|
+
renewAgentWallet,
|
|
2836
|
+
signTypedDataAsync,
|
|
2837
|
+
wallet
|
|
2838
|
+
]);
|
|
2839
|
+
return /* @__PURE__ */ jsx7(AnimatePresence3, { children: isOpen && wallet && /* @__PURE__ */ jsxs6(motion3.div, { className: "hypurr-connect", style: { display: "contents" }, children: [
|
|
2840
|
+
/* @__PURE__ */ jsx7(SpinKeyframes, {}),
|
|
2841
|
+
/* @__PURE__ */ jsx7(
|
|
2842
|
+
motion3.div,
|
|
2843
|
+
{
|
|
2844
|
+
className: "fixed inset-0 z-[110] bg-black/70 backdrop-blur-sm",
|
|
2845
|
+
initial: { opacity: 0 },
|
|
2846
|
+
animate: { opacity: 1 },
|
|
2847
|
+
exit: { opacity: 0 },
|
|
2848
|
+
transition: { duration: 0.15 },
|
|
2849
|
+
onClick: handleClose
|
|
2850
|
+
}
|
|
2851
|
+
),
|
|
2852
|
+
/* @__PURE__ */ jsx7("div", { className: "fixed inset-0 z-[111] flex items-center justify-center p-4", children: /* @__PURE__ */ jsxs6(
|
|
2853
|
+
motion3.div,
|
|
2854
|
+
{
|
|
2855
|
+
className: "relative w-full max-w-md overflow-hidden rounded-lg border border-surface-bd bg-surface-modal font-sans shadow-modal",
|
|
2856
|
+
initial: { opacity: 0, y: 8 },
|
|
2857
|
+
animate: { opacity: 1, y: 0 },
|
|
2858
|
+
exit: { opacity: 0, y: 8 },
|
|
2859
|
+
transition: { duration: 0.18, ease: "easeOut" },
|
|
2860
|
+
onClick: (event) => event.stopPropagation(),
|
|
2861
|
+
children: [
|
|
2862
|
+
/* @__PURE__ */ jsxs6("div", { className: "relative flex items-center justify-center border-b border-white/[0.06] px-6 pb-5 pt-6", children: [
|
|
2863
|
+
/* @__PURE__ */ jsx7("h3", { className: "text-lg font-semibold text-white", children: "Renew Agent Wallet" }),
|
|
2864
|
+
/* @__PURE__ */ jsx7(
|
|
2865
|
+
"button",
|
|
2866
|
+
{
|
|
2867
|
+
onClick: handleClose,
|
|
2868
|
+
disabled: isRenewing,
|
|
2869
|
+
className: "absolute right-6 text-gray-400 transition-colors hover:text-white disabled:cursor-not-allowed disabled:opacity-40",
|
|
2870
|
+
"aria-label": "Close",
|
|
2871
|
+
children: /* @__PURE__ */ jsx7(X, { size: 16 })
|
|
2872
|
+
}
|
|
2873
|
+
)
|
|
2874
|
+
] }),
|
|
2875
|
+
/* @__PURE__ */ jsxs6("div", { className: "space-y-4 px-6 py-5", children: [
|
|
2876
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-start gap-2 rounded-lg border border-amber-500/25 bg-amber-500/[0.08] p-3", children: [
|
|
2877
|
+
/* @__PURE__ */ jsx7(
|
|
2878
|
+
AlertTriangle,
|
|
2879
|
+
{
|
|
2880
|
+
size: 14,
|
|
2881
|
+
className: "mt-0.5 flex-shrink-0 text-amber-400"
|
|
2882
|
+
}
|
|
2883
|
+
),
|
|
2884
|
+
/* @__PURE__ */ jsx7("p", { className: "text-base text-amber-200", children: expiryMessage ?? (currentExpiryMs ? `Current approval expires ${formatAgentExpiry(
|
|
2885
|
+
currentExpiryMs
|
|
2886
|
+
)}. Renew to extend this agent wallet.` : "Renew this agent wallet with a fresh owner approval.") })
|
|
2887
|
+
] }),
|
|
2888
|
+
/* @__PURE__ */ jsxs6("div", { className: "rounded-lg border border-white/[0.06] bg-white/[0.03] p-3", children: [
|
|
2889
|
+
/* @__PURE__ */ jsx7("p", { className: "mb-1.5 text-base uppercase tracking-[0.1em] text-gray-400", children: "Agent address" }),
|
|
2890
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-3", children: [
|
|
2891
|
+
/* @__PURE__ */ jsxs6("div", { className: "min-w-0", children: [
|
|
2892
|
+
/* @__PURE__ */ jsx7("p", { className: "truncate text-base font-medium text-white", children: wallet.name || "Unnamed Wallet" }),
|
|
2893
|
+
/* @__PURE__ */ jsx7("p", { className: "font-mono text-base text-gray-400", children: hasAgentAddress ? formatAddress2(agentAddress) : "Missing agent address" })
|
|
2894
|
+
] }),
|
|
2895
|
+
/* @__PURE__ */ jsx7(
|
|
2896
|
+
AlertTriangle,
|
|
2897
|
+
{
|
|
2898
|
+
size: 16,
|
|
2899
|
+
className: "flex-shrink-0 text-amber-400"
|
|
2900
|
+
}
|
|
2901
|
+
)
|
|
2902
|
+
] })
|
|
2903
|
+
] }),
|
|
2904
|
+
ownerReady ? /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-3 rounded-lg border border-white/[0.06] bg-white/[0.03] px-3 py-2.5", children: [
|
|
2905
|
+
/* @__PURE__ */ jsx7("div", { className: "flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-md border border-white/[0.08] bg-white/[0.06]", children: /* @__PURE__ */ jsx7(Wallet, { size: 14, className: "text-gray-400" }) }),
|
|
2906
|
+
/* @__PURE__ */ jsxs6("div", { className: "min-w-0 flex-1", children: [
|
|
2907
|
+
/* @__PURE__ */ jsx7("p", { className: "text-base text-gray-400", children: "Owner wallet connected" }),
|
|
2908
|
+
/* @__PURE__ */ jsx7("p", { className: "font-mono text-base text-white", children: formatAddress2(ownerAddress) })
|
|
2909
|
+
] }),
|
|
2910
|
+
/* @__PURE__ */ jsx7(Check, { size: 16, className: "flex-shrink-0 text-trade-up" })
|
|
2911
|
+
] }) : hasConnectedOwner && !ownerMatches ? /* @__PURE__ */ jsxs6("div", { className: "space-y-3 rounded-lg border border-trade-down/20 bg-trade-down/[0.08] p-3", children: [
|
|
2912
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-start gap-2", children: [
|
|
2913
|
+
/* @__PURE__ */ jsx7(
|
|
2914
|
+
AlertTriangle,
|
|
2915
|
+
{
|
|
2916
|
+
size: 14,
|
|
2917
|
+
className: "mt-0.5 flex-shrink-0 text-trade-down"
|
|
2918
|
+
}
|
|
2919
|
+
),
|
|
2920
|
+
/* @__PURE__ */ jsxs6("div", { className: "min-w-0", children: [
|
|
2921
|
+
/* @__PURE__ */ jsx7("p", { className: "text-base text-trade-down", children: "Wrong owner wallet connected" }),
|
|
2922
|
+
/* @__PURE__ */ jsxs6("p", { className: "mt-1 font-mono text-base text-gray-400", children: [
|
|
2923
|
+
"Connected ",
|
|
2924
|
+
formatAddress2(ownerAddress)
|
|
2925
|
+
] }),
|
|
2926
|
+
/* @__PURE__ */ jsxs6("p", { className: "font-mono text-base text-gray-400", children: [
|
|
2927
|
+
"Required ",
|
|
2928
|
+
formatAddress2(expectedOwnerAddress)
|
|
2929
|
+
] })
|
|
2930
|
+
] })
|
|
2931
|
+
] }),
|
|
2932
|
+
onDisconnectWallet && /* @__PURE__ */ jsx7(
|
|
2933
|
+
"button",
|
|
2934
|
+
{
|
|
2935
|
+
onClick: onDisconnectWallet,
|
|
2936
|
+
disabled: isRenewing,
|
|
2937
|
+
className: "btn-raised flex w-full items-center justify-center gap-2 rounded-lg py-2 text-base font-medium disabled:cursor-not-allowed disabled:opacity-40",
|
|
2938
|
+
children: "Disconnect Wallet"
|
|
2939
|
+
}
|
|
2940
|
+
)
|
|
2941
|
+
] }) : /* @__PURE__ */ jsxs6(
|
|
2942
|
+
"button",
|
|
2943
|
+
{
|
|
2944
|
+
onClick: onConnectWallet,
|
|
2945
|
+
className: "btn-raised flex w-full items-center justify-center gap-2 rounded-lg py-2 text-base font-medium",
|
|
2946
|
+
children: [
|
|
2947
|
+
/* @__PURE__ */ jsx7(Wallet, { size: 14 }),
|
|
2948
|
+
" Connect Owner Wallet",
|
|
2949
|
+
hasExpectedOwner ? ` ${formatAddress2(expectedOwnerAddress)}` : ""
|
|
2950
|
+
]
|
|
2951
|
+
}
|
|
2952
|
+
),
|
|
2953
|
+
/* @__PURE__ */ jsx7(
|
|
2954
|
+
ApprovalDurationPicker2,
|
|
2955
|
+
{
|
|
2956
|
+
value: approvalDurationMs,
|
|
2957
|
+
onChange: setApprovalDurationMs,
|
|
2958
|
+
options: durationOptions,
|
|
2959
|
+
disabled: isRenewing
|
|
2960
|
+
}
|
|
2961
|
+
),
|
|
2962
|
+
error && /* @__PURE__ */ jsxs6("div", { className: "flex items-start gap-2 rounded-lg border border-trade-down/20 bg-trade-down/[0.08] p-3", children: [
|
|
2963
|
+
/* @__PURE__ */ jsx7(
|
|
2964
|
+
AlertTriangle,
|
|
2965
|
+
{
|
|
2966
|
+
size: 14,
|
|
2967
|
+
className: "mt-0.5 flex-shrink-0 text-trade-down"
|
|
2968
|
+
}
|
|
2969
|
+
),
|
|
2970
|
+
/* @__PURE__ */ jsx7("p", { className: "text-base text-trade-down", children: error })
|
|
2971
|
+
] })
|
|
2972
|
+
] }),
|
|
2973
|
+
/* @__PURE__ */ jsxs6("div", { className: "space-y-2 px-6 pb-6", children: [
|
|
2974
|
+
/* @__PURE__ */ jsx7(
|
|
2975
|
+
"button",
|
|
2976
|
+
{
|
|
2977
|
+
onClick: handleRenew,
|
|
2978
|
+
disabled: !canRenew,
|
|
2979
|
+
className: `flex w-full items-center justify-center gap-2 rounded-lg py-2 text-base font-medium ${canRenew ? "btn-raised" : "btn-raised-disabled"}`,
|
|
2980
|
+
children: isRenewing ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2981
|
+
/* @__PURE__ */ jsx7(Loader2, { size: 14 }),
|
|
2982
|
+
" Renewing..."
|
|
2983
|
+
] }) : "Renew Agent Wallet"
|
|
2984
|
+
}
|
|
2985
|
+
),
|
|
2986
|
+
ownerReady && onDisconnectWallet && /* @__PURE__ */ jsx7(
|
|
2987
|
+
"button",
|
|
2988
|
+
{
|
|
2989
|
+
onClick: onDisconnectWallet,
|
|
2990
|
+
disabled: isRenewing,
|
|
2991
|
+
className: "w-full py-1.5 text-base text-gray-400 transition-colors hover:text-gray-300 disabled:cursor-not-allowed disabled:opacity-40",
|
|
2992
|
+
children: "Disconnect & use different owner"
|
|
2993
|
+
}
|
|
2994
|
+
)
|
|
2995
|
+
] })
|
|
2996
|
+
]
|
|
2997
|
+
}
|
|
2998
|
+
) })
|
|
2999
|
+
] }) });
|
|
3000
|
+
}
|
|
3001
|
+
function ApprovalDurationPicker2({
|
|
3002
|
+
value,
|
|
3003
|
+
onChange,
|
|
3004
|
+
options,
|
|
3005
|
+
disabled
|
|
3006
|
+
}) {
|
|
3007
|
+
return /* @__PURE__ */ jsxs6("div", { children: [
|
|
3008
|
+
/* @__PURE__ */ jsx7("label", { className: "mb-2 block text-base uppercase tracking-[0.1em] text-gray-400", children: "Approval Duration" }),
|
|
3009
|
+
/* @__PURE__ */ jsx7("div", { className: "grid grid-cols-4 gap-1.5", children: options.map((option) => /* @__PURE__ */ jsx7(
|
|
3010
|
+
"button",
|
|
3011
|
+
{
|
|
3012
|
+
type: "button",
|
|
3013
|
+
onClick: () => onChange(option.durationMs),
|
|
3014
|
+
disabled,
|
|
3015
|
+
className: `rounded py-1.5 text-base font-medium disabled:cursor-not-allowed disabled:opacity-50 ${value === option.durationMs ? "btn-raised-active" : "btn-raised"}`,
|
|
3016
|
+
children: option.label
|
|
3017
|
+
},
|
|
3018
|
+
`${option.label}-${option.durationMs}`
|
|
3019
|
+
)) })
|
|
1845
3020
|
] });
|
|
1846
3021
|
}
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
3022
|
+
|
|
3023
|
+
// src/WalletSelectorDropdown.tsx
|
|
3024
|
+
import { AnimatePresence as AnimatePresence7, motion as motion7 } from "framer-motion";
|
|
3025
|
+
import {
|
|
3026
|
+
Fragment as Fragment8,
|
|
3027
|
+
useCallback as useCallback9,
|
|
3028
|
+
useMemo as useMemo3,
|
|
3029
|
+
useState as useState8
|
|
3030
|
+
} from "react";
|
|
3031
|
+
|
|
3032
|
+
// src/AgentExpiryWarning.tsx
|
|
3033
|
+
import {
|
|
3034
|
+
useCallback as useCallback5,
|
|
3035
|
+
useRef as useRef2,
|
|
3036
|
+
useState as useState4
|
|
3037
|
+
} from "react";
|
|
3038
|
+
import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3039
|
+
var EXPIRED_AGENT_COLOR = "#f59e0b";
|
|
3040
|
+
function AgentExpiryWarningIcon({
|
|
3041
|
+
message,
|
|
3042
|
+
onClick,
|
|
3043
|
+
size = 13
|
|
3044
|
+
}) {
|
|
3045
|
+
const triggerRef = useRef2(null);
|
|
3046
|
+
const [tooltipPosition, setTooltipPosition] = useState4(null);
|
|
3047
|
+
const setTriggerRef = useCallback5((node) => {
|
|
3048
|
+
triggerRef.current = node;
|
|
3049
|
+
}, []);
|
|
3050
|
+
const showTooltip = useCallback5(() => {
|
|
3051
|
+
const rect = triggerRef.current?.getBoundingClientRect();
|
|
3052
|
+
if (!rect) return;
|
|
3053
|
+
const tooltipWidth = 260;
|
|
3054
|
+
const left = Math.min(
|
|
3055
|
+
Math.max(rect.left + rect.width / 2, tooltipWidth / 2 + 8),
|
|
3056
|
+
window.innerWidth - tooltipWidth / 2 - 8
|
|
3057
|
+
);
|
|
3058
|
+
const top = rect.bottom + 8 < window.innerHeight - 48 ? rect.bottom + 8 : Math.max(8, rect.top - 44);
|
|
3059
|
+
setTooltipPosition({ left, top });
|
|
3060
|
+
}, []);
|
|
3061
|
+
const hideTooltip = useCallback5(() => {
|
|
3062
|
+
setTooltipPosition(null);
|
|
3063
|
+
}, []);
|
|
3064
|
+
const triggerStyle = {
|
|
3065
|
+
width: size + 5,
|
|
3066
|
+
height: size + 5,
|
|
3067
|
+
padding: 0,
|
|
3068
|
+
border: "none",
|
|
3069
|
+
borderRadius: 4,
|
|
3070
|
+
background: "transparent",
|
|
3071
|
+
color: EXPIRED_AGENT_COLOR,
|
|
3072
|
+
display: "inline-flex",
|
|
3073
|
+
alignItems: "center",
|
|
3074
|
+
justifyContent: "center",
|
|
3075
|
+
flexShrink: 0,
|
|
3076
|
+
cursor: onClick ? "pointer" : "help"
|
|
3077
|
+
};
|
|
3078
|
+
const sharedProps = {
|
|
3079
|
+
ref: setTriggerRef,
|
|
3080
|
+
"aria-label": "Agent approval expired",
|
|
3081
|
+
onMouseEnter: showTooltip,
|
|
3082
|
+
onMouseLeave: hideTooltip,
|
|
3083
|
+
onFocus: showTooltip,
|
|
3084
|
+
onBlur: hideTooltip,
|
|
3085
|
+
style: triggerStyle
|
|
3086
|
+
};
|
|
3087
|
+
return /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
3088
|
+
onClick ? /* @__PURE__ */ jsx8(
|
|
3089
|
+
"button",
|
|
3090
|
+
{
|
|
3091
|
+
type: "button",
|
|
3092
|
+
...sharedProps,
|
|
3093
|
+
onClick: (event) => {
|
|
3094
|
+
event.stopPropagation();
|
|
3095
|
+
onClick();
|
|
3096
|
+
},
|
|
3097
|
+
children: /* @__PURE__ */ jsx8(AlertTriangle, { size, color: EXPIRED_AGENT_COLOR })
|
|
3098
|
+
}
|
|
3099
|
+
) : /* @__PURE__ */ jsx8("span", { ...sharedProps, children: /* @__PURE__ */ jsx8(AlertTriangle, { size, color: EXPIRED_AGENT_COLOR }) }),
|
|
3100
|
+
tooltipPosition && /* @__PURE__ */ jsx8(
|
|
3101
|
+
"div",
|
|
3102
|
+
{
|
|
3103
|
+
role: "tooltip",
|
|
3104
|
+
style: {
|
|
3105
|
+
position: "fixed",
|
|
3106
|
+
left: tooltipPosition.left,
|
|
3107
|
+
top: tooltipPosition.top,
|
|
3108
|
+
transform: "translateX(-50%)",
|
|
3109
|
+
zIndex: 1e4,
|
|
3110
|
+
width: 260,
|
|
3111
|
+
maxWidth: "calc(100vw - 16px)",
|
|
3112
|
+
padding: "7px 9px",
|
|
3113
|
+
borderRadius: 6,
|
|
3114
|
+
border: "1px solid rgba(255,255,255,0.12)",
|
|
3115
|
+
background: "#111827",
|
|
3116
|
+
boxShadow: "0 10px 28px rgba(0,0,0,0.45)",
|
|
3117
|
+
color: "#e5e7eb",
|
|
3118
|
+
fontSize: 12,
|
|
3119
|
+
lineHeight: "1rem",
|
|
3120
|
+
fontWeight: 500,
|
|
3121
|
+
pointerEvents: "none",
|
|
3122
|
+
whiteSpace: "normal"
|
|
3123
|
+
},
|
|
3124
|
+
children: message
|
|
3125
|
+
}
|
|
3126
|
+
)
|
|
1851
3127
|
] });
|
|
1852
3128
|
}
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
}
|
|
3129
|
+
|
|
3130
|
+
// src/UserProfileModal.tsx
|
|
3131
|
+
import { AnimatePresence as AnimatePresence6, motion as motion6 } from "framer-motion";
|
|
3132
|
+
import {
|
|
3133
|
+
useCallback as useCallback8,
|
|
3134
|
+
useState as useState7
|
|
3135
|
+
} from "react";
|
|
3136
|
+
|
|
3137
|
+
// src/DeleteWalletModal.tsx
|
|
3138
|
+
import { AnimatePresence as AnimatePresence4, motion as motion4 } from "framer-motion";
|
|
3139
|
+
import {
|
|
3140
|
+
useCallback as useCallback6,
|
|
3141
|
+
useState as useState5
|
|
3142
|
+
} from "react";
|
|
1856
3143
|
|
|
1857
3144
|
// src/profileStyles.ts
|
|
1858
3145
|
var profileColors = {
|
|
@@ -1880,6 +3167,44 @@ var fontFamily = {
|
|
|
1880
3167
|
sans: "Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif",
|
|
1881
3168
|
mono: "Google Sans Code, Roboto Mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"
|
|
1882
3169
|
};
|
|
3170
|
+
var parseSrgb = (color) => {
|
|
3171
|
+
const value = color.trim();
|
|
3172
|
+
const shortHex = /^#([0-9a-f]{3})$/i.exec(value);
|
|
3173
|
+
if (shortHex) {
|
|
3174
|
+
const [r, g, b] = shortHex[1].split("").map((c) => parseInt(c + c, 16));
|
|
3175
|
+
return [r, g, b];
|
|
3176
|
+
}
|
|
3177
|
+
const longHex = /^#([0-9a-f]{6})$/i.exec(value);
|
|
3178
|
+
if (longHex) {
|
|
3179
|
+
const v = longHex[1];
|
|
3180
|
+
return [
|
|
3181
|
+
parseInt(v.slice(0, 2), 16),
|
|
3182
|
+
parseInt(v.slice(2, 4), 16),
|
|
3183
|
+
parseInt(v.slice(4, 6), 16)
|
|
3184
|
+
];
|
|
3185
|
+
}
|
|
3186
|
+
const rgb = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*[\d.]+\s*)?\)$/i.exec(
|
|
3187
|
+
value
|
|
3188
|
+
);
|
|
3189
|
+
if (rgb) {
|
|
3190
|
+
return [parseInt(rgb[1], 10), parseInt(rgb[2], 10), parseInt(rgb[3], 10)];
|
|
3191
|
+
}
|
|
3192
|
+
return null;
|
|
3193
|
+
};
|
|
3194
|
+
var relativeLuminance = (color) => {
|
|
3195
|
+
const rgb = parseSrgb(color);
|
|
3196
|
+
if (!rgb) return null;
|
|
3197
|
+
const [r, g, b] = rgb.map((c) => {
|
|
3198
|
+
const v = c / 255;
|
|
3199
|
+
return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
|
|
3200
|
+
});
|
|
3201
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
3202
|
+
};
|
|
3203
|
+
var pickContrastColor = (background, lightFg = profileColors.text, darkFg = "#0a0a0a") => {
|
|
3204
|
+
const lum = relativeLuminance(background);
|
|
3205
|
+
if (lum === null) return lightFg;
|
|
3206
|
+
return lum > 0.5 ? darkFg : lightFg;
|
|
3207
|
+
};
|
|
1883
3208
|
var colorWithAlpha = (color, alpha) => {
|
|
1884
3209
|
const hex = color.trim();
|
|
1885
3210
|
const shortHex = /^#([0-9a-f]{3})$/i.exec(hex);
|
|
@@ -2018,7 +3343,7 @@ var dangerOutlineButtonStyle = (enabled, hovered = false) => ({
|
|
|
2018
3343
|
});
|
|
2019
3344
|
|
|
2020
3345
|
// src/DeleteWalletModal.tsx
|
|
2021
|
-
import { Fragment as
|
|
3346
|
+
import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2022
3347
|
var DANGER_BG = "rgba(248,113,113,0.07)";
|
|
2023
3348
|
var DANGER_BORDER = "rgba(248,113,113,0.2)";
|
|
2024
3349
|
var backdropStyle2 = modalBackdropStyle(110);
|
|
@@ -2098,20 +3423,21 @@ function DeleteWalletModal({
|
|
|
2098
3423
|
onConfirm,
|
|
2099
3424
|
onNotify
|
|
2100
3425
|
}) {
|
|
2101
|
-
const [confirmName, setConfirmName] =
|
|
2102
|
-
const [isDeleting, setIsDeleting] =
|
|
2103
|
-
const [error, setError] =
|
|
2104
|
-
const [deleteHovered, setDeleteHovered] =
|
|
3426
|
+
const [confirmName, setConfirmName] = useState5("");
|
|
3427
|
+
const [isDeleting, setIsDeleting] = useState5(false);
|
|
3428
|
+
const [error, setError] = useState5(null);
|
|
3429
|
+
const [deleteHovered, setDeleteHovered] = useState5(false);
|
|
2105
3430
|
const walletName = wallet?.name || "Unnamed Wallet";
|
|
3431
|
+
const displayAddress = wallet?.isAgent && wallet.agentEthereumAddress?.value ? wallet.agentEthereumAddress.value : wallet?.ethereumAddress;
|
|
2106
3432
|
const isNameMatch = confirmName === walletName;
|
|
2107
3433
|
const canDelete = isNameMatch && !isDeleting;
|
|
2108
|
-
const handleClose =
|
|
3434
|
+
const handleClose = useCallback6(() => {
|
|
2109
3435
|
if (isDeleting) return;
|
|
2110
3436
|
setConfirmName("");
|
|
2111
3437
|
setError(null);
|
|
2112
3438
|
onClose();
|
|
2113
3439
|
}, [isDeleting, onClose]);
|
|
2114
|
-
const handleDelete =
|
|
3440
|
+
const handleDelete = useCallback6(async () => {
|
|
2115
3441
|
if (!wallet || !isNameMatch) return;
|
|
2116
3442
|
setError(null);
|
|
2117
3443
|
setIsDeleting(true);
|
|
@@ -2126,10 +3452,10 @@ function DeleteWalletModal({
|
|
|
2126
3452
|
setIsDeleting(false);
|
|
2127
3453
|
}
|
|
2128
3454
|
}, [wallet, isNameMatch, onConfirm, onClose, onNotify]);
|
|
2129
|
-
return /* @__PURE__ */
|
|
2130
|
-
/* @__PURE__ */
|
|
2131
|
-
/* @__PURE__ */
|
|
2132
|
-
|
|
3455
|
+
return /* @__PURE__ */ jsx9(AnimatePresence4, { children: isOpen && wallet && /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
3456
|
+
/* @__PURE__ */ jsx9(SpinKeyframes, {}),
|
|
3457
|
+
/* @__PURE__ */ jsx9(
|
|
3458
|
+
motion4.div,
|
|
2133
3459
|
{
|
|
2134
3460
|
style: backdropStyle2,
|
|
2135
3461
|
initial: { opacity: 0 },
|
|
@@ -2140,8 +3466,8 @@ function DeleteWalletModal({
|
|
|
2140
3466
|
},
|
|
2141
3467
|
"backdrop"
|
|
2142
3468
|
),
|
|
2143
|
-
/* @__PURE__ */
|
|
2144
|
-
|
|
3469
|
+
/* @__PURE__ */ jsx9("div", { style: wrapperStyle, children: /* @__PURE__ */ jsxs8(
|
|
3470
|
+
motion4.div,
|
|
2145
3471
|
{
|
|
2146
3472
|
style: panelStyle,
|
|
2147
3473
|
initial: { opacity: 0, y: 8 },
|
|
@@ -2150,22 +3476,22 @@ function DeleteWalletModal({
|
|
|
2150
3476
|
transition: { duration: 0.18, ease: "easeOut" },
|
|
2151
3477
|
onClick: (e) => e.stopPropagation(),
|
|
2152
3478
|
children: [
|
|
2153
|
-
/* @__PURE__ */
|
|
2154
|
-
/* @__PURE__ */
|
|
2155
|
-
/* @__PURE__ */
|
|
3479
|
+
/* @__PURE__ */ jsxs8("div", { style: headerStyle, children: [
|
|
3480
|
+
/* @__PURE__ */ jsx9("h3", { style: titleStyle, children: "Delete Wallet" }),
|
|
3481
|
+
/* @__PURE__ */ jsx9(
|
|
2156
3482
|
"button",
|
|
2157
3483
|
{
|
|
2158
3484
|
onClick: handleClose,
|
|
2159
3485
|
disabled: isDeleting,
|
|
2160
3486
|
style: closeBtnStyle(isDeleting),
|
|
2161
3487
|
"aria-label": "Close",
|
|
2162
|
-
children: /* @__PURE__ */
|
|
3488
|
+
children: /* @__PURE__ */ jsx9(X, { size: 16 })
|
|
2163
3489
|
}
|
|
2164
3490
|
)
|
|
2165
3491
|
] }),
|
|
2166
|
-
/* @__PURE__ */
|
|
2167
|
-
/* @__PURE__ */
|
|
2168
|
-
/* @__PURE__ */
|
|
3492
|
+
/* @__PURE__ */ jsxs8("div", { style: bodyStyle, children: [
|
|
3493
|
+
/* @__PURE__ */ jsxs8("div", { style: warningBoxStyle, children: [
|
|
3494
|
+
/* @__PURE__ */ jsx9(
|
|
2169
3495
|
AlertTriangle,
|
|
2170
3496
|
{
|
|
2171
3497
|
size: 15,
|
|
@@ -2173,8 +3499,8 @@ function DeleteWalletModal({
|
|
|
2173
3499
|
style: { flexShrink: 0, marginTop: 2 }
|
|
2174
3500
|
}
|
|
2175
3501
|
),
|
|
2176
|
-
/* @__PURE__ */
|
|
2177
|
-
/* @__PURE__ */
|
|
3502
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
3503
|
+
/* @__PURE__ */ jsx9(
|
|
2178
3504
|
"p",
|
|
2179
3505
|
{
|
|
2180
3506
|
style: {
|
|
@@ -2187,7 +3513,7 @@ function DeleteWalletModal({
|
|
|
2187
3513
|
children: "This action cannot be undone"
|
|
2188
3514
|
}
|
|
2189
3515
|
),
|
|
2190
|
-
/* @__PURE__ */
|
|
3516
|
+
/* @__PURE__ */ jsx9(
|
|
2191
3517
|
"p",
|
|
2192
3518
|
{
|
|
2193
3519
|
style: {
|
|
@@ -2201,8 +3527,8 @@ function DeleteWalletModal({
|
|
|
2201
3527
|
)
|
|
2202
3528
|
] })
|
|
2203
3529
|
] }),
|
|
2204
|
-
/* @__PURE__ */
|
|
2205
|
-
/* @__PURE__ */
|
|
3530
|
+
/* @__PURE__ */ jsxs8("div", { style: infoBoxStyle, children: [
|
|
3531
|
+
/* @__PURE__ */ jsx9(
|
|
2206
3532
|
"p",
|
|
2207
3533
|
{
|
|
2208
3534
|
style: {
|
|
@@ -2213,7 +3539,7 @@ function DeleteWalletModal({
|
|
|
2213
3539
|
children: "Wallet to delete"
|
|
2214
3540
|
}
|
|
2215
3541
|
),
|
|
2216
|
-
/* @__PURE__ */
|
|
3542
|
+
/* @__PURE__ */ jsx9(
|
|
2217
3543
|
"p",
|
|
2218
3544
|
{
|
|
2219
3545
|
style: {
|
|
@@ -2226,7 +3552,7 @@ function DeleteWalletModal({
|
|
|
2226
3552
|
children: walletName
|
|
2227
3553
|
}
|
|
2228
3554
|
),
|
|
2229
|
-
/* @__PURE__ */
|
|
3555
|
+
/* @__PURE__ */ jsx9(
|
|
2230
3556
|
"p",
|
|
2231
3557
|
{
|
|
2232
3558
|
style: {
|
|
@@ -2237,15 +3563,15 @@ function DeleteWalletModal({
|
|
|
2237
3563
|
fontFamily: fontFamily.mono,
|
|
2238
3564
|
wordBreak: "break-all"
|
|
2239
3565
|
},
|
|
2240
|
-
children:
|
|
3566
|
+
children: displayAddress
|
|
2241
3567
|
}
|
|
2242
3568
|
)
|
|
2243
3569
|
] }),
|
|
2244
|
-
/* @__PURE__ */
|
|
2245
|
-
/* @__PURE__ */
|
|
3570
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
3571
|
+
/* @__PURE__ */ jsxs8("label", { style: labelStyle, children: [
|
|
2246
3572
|
"Type",
|
|
2247
3573
|
" ",
|
|
2248
|
-
/* @__PURE__ */
|
|
3574
|
+
/* @__PURE__ */ jsxs8(
|
|
2249
3575
|
"span",
|
|
2250
3576
|
{
|
|
2251
3577
|
style: {
|
|
@@ -2262,7 +3588,7 @@ function DeleteWalletModal({
|
|
|
2262
3588
|
" ",
|
|
2263
3589
|
"to confirm"
|
|
2264
3590
|
] }),
|
|
2265
|
-
/* @__PURE__ */
|
|
3591
|
+
/* @__PURE__ */ jsx9(
|
|
2266
3592
|
"input",
|
|
2267
3593
|
{
|
|
2268
3594
|
type: "text",
|
|
@@ -2274,7 +3600,7 @@ function DeleteWalletModal({
|
|
|
2274
3600
|
}
|
|
2275
3601
|
)
|
|
2276
3602
|
] }),
|
|
2277
|
-
error && /* @__PURE__ */
|
|
3603
|
+
error && /* @__PURE__ */ jsxs8(
|
|
2278
3604
|
"div",
|
|
2279
3605
|
{
|
|
2280
3606
|
style: {
|
|
@@ -2287,7 +3613,7 @@ function DeleteWalletModal({
|
|
|
2287
3613
|
borderRadius: 8
|
|
2288
3614
|
},
|
|
2289
3615
|
children: [
|
|
2290
|
-
/* @__PURE__ */
|
|
3616
|
+
/* @__PURE__ */ jsx9(
|
|
2291
3617
|
AlertTriangle,
|
|
2292
3618
|
{
|
|
2293
3619
|
size: 14,
|
|
@@ -2295,7 +3621,7 @@ function DeleteWalletModal({
|
|
|
2295
3621
|
style: { flexShrink: 0, marginTop: 2 }
|
|
2296
3622
|
}
|
|
2297
3623
|
),
|
|
2298
|
-
/* @__PURE__ */
|
|
3624
|
+
/* @__PURE__ */ jsx9(
|
|
2299
3625
|
"p",
|
|
2300
3626
|
{
|
|
2301
3627
|
style: {
|
|
@@ -2311,7 +3637,7 @@ function DeleteWalletModal({
|
|
|
2311
3637
|
}
|
|
2312
3638
|
)
|
|
2313
3639
|
] }),
|
|
2314
|
-
/* @__PURE__ */
|
|
3640
|
+
/* @__PURE__ */ jsx9("div", { style: footerStyle, children: /* @__PURE__ */ jsx9(
|
|
2315
3641
|
"button",
|
|
2316
3642
|
{
|
|
2317
3643
|
onClick: handleDelete,
|
|
@@ -2319,11 +3645,11 @@ function DeleteWalletModal({
|
|
|
2319
3645
|
onMouseEnter: () => setDeleteHovered(true),
|
|
2320
3646
|
onMouseLeave: () => setDeleteHovered(false),
|
|
2321
3647
|
style: deleteButtonStyle(canDelete, deleteHovered),
|
|
2322
|
-
children: isDeleting ? /* @__PURE__ */
|
|
2323
|
-
/* @__PURE__ */
|
|
3648
|
+
children: isDeleting ? /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
3649
|
+
/* @__PURE__ */ jsx9(Loader2, { size: 14 }),
|
|
2324
3650
|
" Deleting..."
|
|
2325
|
-
] }) : /* @__PURE__ */
|
|
2326
|
-
/* @__PURE__ */
|
|
3651
|
+
] }) : /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
3652
|
+
/* @__PURE__ */ jsx9(Trash2, { size: 14 }),
|
|
2327
3653
|
" Delete Wallet"
|
|
2328
3654
|
] })
|
|
2329
3655
|
}
|
|
@@ -2336,15 +3662,15 @@ function DeleteWalletModal({
|
|
|
2336
3662
|
}
|
|
2337
3663
|
|
|
2338
3664
|
// src/RenameWalletModal.tsx
|
|
2339
|
-
import { AnimatePresence as
|
|
3665
|
+
import { AnimatePresence as AnimatePresence5, motion as motion5 } from "framer-motion";
|
|
2340
3666
|
import {
|
|
2341
|
-
useCallback as
|
|
3667
|
+
useCallback as useCallback7,
|
|
2342
3668
|
useEffect as useEffect2,
|
|
2343
|
-
useState as
|
|
3669
|
+
useState as useState6
|
|
2344
3670
|
} from "react";
|
|
2345
|
-
import { Fragment as
|
|
3671
|
+
import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2346
3672
|
var DANGER_BORDER2 = "rgba(248,113,113,0.2)";
|
|
2347
|
-
var
|
|
3673
|
+
var WALLET_NAME_REGEX2 = /^[a-zA-Z0-9/]+$/;
|
|
2348
3674
|
var backdropStyle3 = modalBackdropStyle(110);
|
|
2349
3675
|
var wrapperStyle2 = modalWrapperStyle2(111, 16);
|
|
2350
3676
|
var panelStyle2 = {
|
|
@@ -2412,26 +3738,27 @@ function RenameWalletModal({
|
|
|
2412
3738
|
onConfirm,
|
|
2413
3739
|
onNotify
|
|
2414
3740
|
}) {
|
|
2415
|
-
const [name, setName] =
|
|
2416
|
-
const [isRenaming, setIsRenaming] =
|
|
2417
|
-
const [error, setError] =
|
|
2418
|
-
const [saveHovered, setSaveHovered] =
|
|
3741
|
+
const [name, setName] = useState6("");
|
|
3742
|
+
const [isRenaming, setIsRenaming] = useState6(false);
|
|
3743
|
+
const [error, setError] = useState6(null);
|
|
3744
|
+
const [saveHovered, setSaveHovered] = useState6(false);
|
|
2419
3745
|
const currentName = wallet?.name || "Unnamed";
|
|
3746
|
+
const displayAddress = wallet?.isAgent && wallet.agentEthereumAddress?.value ? wallet.agentEthereumAddress.value : wallet?.ethereumAddress;
|
|
2420
3747
|
const trimmedName = name.trim();
|
|
2421
3748
|
const isNameChanged = trimmedName !== currentName;
|
|
2422
|
-
const isNameValid =
|
|
3749
|
+
const isNameValid = WALLET_NAME_REGEX2.test(trimmedName);
|
|
2423
3750
|
const canSubmit = isNameValid && isNameChanged && !isRenaming;
|
|
2424
3751
|
useEffect2(() => {
|
|
2425
3752
|
if (!wallet) return;
|
|
2426
3753
|
setName(wallet.name || "");
|
|
2427
3754
|
setError(null);
|
|
2428
3755
|
}, [wallet]);
|
|
2429
|
-
const handleClose =
|
|
3756
|
+
const handleClose = useCallback7(() => {
|
|
2430
3757
|
if (isRenaming) return;
|
|
2431
3758
|
setError(null);
|
|
2432
3759
|
onClose();
|
|
2433
3760
|
}, [isRenaming, onClose]);
|
|
2434
|
-
const handleRename =
|
|
3761
|
+
const handleRename = useCallback7(async () => {
|
|
2435
3762
|
if (!wallet || !isNameValid || !isNameChanged) return;
|
|
2436
3763
|
setError(null);
|
|
2437
3764
|
setIsRenaming(true);
|
|
@@ -2453,10 +3780,10 @@ function RenameWalletModal({
|
|
|
2453
3780
|
onClose,
|
|
2454
3781
|
onNotify
|
|
2455
3782
|
]);
|
|
2456
|
-
return /* @__PURE__ */
|
|
2457
|
-
/* @__PURE__ */
|
|
2458
|
-
/* @__PURE__ */
|
|
2459
|
-
|
|
3783
|
+
return /* @__PURE__ */ jsx10(AnimatePresence5, { children: isOpen && wallet && /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
|
3784
|
+
/* @__PURE__ */ jsx10(SpinKeyframes, {}),
|
|
3785
|
+
/* @__PURE__ */ jsx10(
|
|
3786
|
+
motion5.div,
|
|
2460
3787
|
{
|
|
2461
3788
|
style: backdropStyle3,
|
|
2462
3789
|
initial: { opacity: 0 },
|
|
@@ -2467,8 +3794,8 @@ function RenameWalletModal({
|
|
|
2467
3794
|
},
|
|
2468
3795
|
"backdrop"
|
|
2469
3796
|
),
|
|
2470
|
-
/* @__PURE__ */
|
|
2471
|
-
|
|
3797
|
+
/* @__PURE__ */ jsx10("div", { style: wrapperStyle2, children: /* @__PURE__ */ jsxs9(
|
|
3798
|
+
motion5.div,
|
|
2472
3799
|
{
|
|
2473
3800
|
style: panelStyle2,
|
|
2474
3801
|
initial: { opacity: 0, y: 8 },
|
|
@@ -2477,22 +3804,22 @@ function RenameWalletModal({
|
|
|
2477
3804
|
transition: { duration: 0.18, ease: "easeOut" },
|
|
2478
3805
|
onClick: (e) => e.stopPropagation(),
|
|
2479
3806
|
children: [
|
|
2480
|
-
/* @__PURE__ */
|
|
2481
|
-
/* @__PURE__ */
|
|
2482
|
-
/* @__PURE__ */
|
|
3807
|
+
/* @__PURE__ */ jsxs9("div", { style: headerStyle2, children: [
|
|
3808
|
+
/* @__PURE__ */ jsx10("h3", { style: titleStyle, children: "Rename Wallet" }),
|
|
3809
|
+
/* @__PURE__ */ jsx10(
|
|
2483
3810
|
"button",
|
|
2484
3811
|
{
|
|
2485
3812
|
onClick: handleClose,
|
|
2486
3813
|
disabled: isRenaming,
|
|
2487
3814
|
style: closeBtnStyle(isRenaming),
|
|
2488
3815
|
"aria-label": "Close",
|
|
2489
|
-
children: /* @__PURE__ */
|
|
3816
|
+
children: /* @__PURE__ */ jsx10(X, { size: 16 })
|
|
2490
3817
|
}
|
|
2491
3818
|
)
|
|
2492
3819
|
] }),
|
|
2493
|
-
/* @__PURE__ */
|
|
2494
|
-
/* @__PURE__ */
|
|
2495
|
-
/* @__PURE__ */
|
|
3820
|
+
/* @__PURE__ */ jsxs9("div", { style: bodyStyle2, children: [
|
|
3821
|
+
/* @__PURE__ */ jsxs9("div", { style: infoBoxStyle2, children: [
|
|
3822
|
+
/* @__PURE__ */ jsx10(
|
|
2496
3823
|
"p",
|
|
2497
3824
|
{
|
|
2498
3825
|
style: {
|
|
@@ -2503,7 +3830,7 @@ function RenameWalletModal({
|
|
|
2503
3830
|
children: "Wallet"
|
|
2504
3831
|
}
|
|
2505
3832
|
),
|
|
2506
|
-
/* @__PURE__ */
|
|
3833
|
+
/* @__PURE__ */ jsx10(
|
|
2507
3834
|
"p",
|
|
2508
3835
|
{
|
|
2509
3836
|
style: {
|
|
@@ -2516,7 +3843,7 @@ function RenameWalletModal({
|
|
|
2516
3843
|
children: currentName
|
|
2517
3844
|
}
|
|
2518
3845
|
),
|
|
2519
|
-
/* @__PURE__ */
|
|
3846
|
+
/* @__PURE__ */ jsx10(
|
|
2520
3847
|
"p",
|
|
2521
3848
|
{
|
|
2522
3849
|
style: {
|
|
@@ -2527,13 +3854,13 @@ function RenameWalletModal({
|
|
|
2527
3854
|
fontFamily: fontFamily.mono,
|
|
2528
3855
|
wordBreak: "break-all"
|
|
2529
3856
|
},
|
|
2530
|
-
children:
|
|
3857
|
+
children: displayAddress
|
|
2531
3858
|
}
|
|
2532
3859
|
)
|
|
2533
3860
|
] }),
|
|
2534
|
-
/* @__PURE__ */
|
|
2535
|
-
/* @__PURE__ */
|
|
2536
|
-
/* @__PURE__ */
|
|
3861
|
+
/* @__PURE__ */ jsxs9("div", { children: [
|
|
3862
|
+
/* @__PURE__ */ jsx10("label", { style: labelStyle2, children: "Wallet name" }),
|
|
3863
|
+
/* @__PURE__ */ jsx10(
|
|
2537
3864
|
"input",
|
|
2538
3865
|
{
|
|
2539
3866
|
type: "text",
|
|
@@ -2551,7 +3878,7 @@ function RenameWalletModal({
|
|
|
2551
3878
|
style: inputStyle2(!!error, isRenaming)
|
|
2552
3879
|
}
|
|
2553
3880
|
),
|
|
2554
|
-
/* @__PURE__ */
|
|
3881
|
+
/* @__PURE__ */ jsx10(
|
|
2555
3882
|
"p",
|
|
2556
3883
|
{
|
|
2557
3884
|
style: {
|
|
@@ -2564,7 +3891,7 @@ function RenameWalletModal({
|
|
|
2564
3891
|
}
|
|
2565
3892
|
)
|
|
2566
3893
|
] }),
|
|
2567
|
-
error && /* @__PURE__ */
|
|
3894
|
+
error && /* @__PURE__ */ jsxs9(
|
|
2568
3895
|
"div",
|
|
2569
3896
|
{
|
|
2570
3897
|
style: {
|
|
@@ -2577,7 +3904,7 @@ function RenameWalletModal({
|
|
|
2577
3904
|
borderRadius: 8
|
|
2578
3905
|
},
|
|
2579
3906
|
children: [
|
|
2580
|
-
/* @__PURE__ */
|
|
3907
|
+
/* @__PURE__ */ jsx10(
|
|
2581
3908
|
AlertTriangle,
|
|
2582
3909
|
{
|
|
2583
3910
|
size: 14,
|
|
@@ -2585,7 +3912,7 @@ function RenameWalletModal({
|
|
|
2585
3912
|
style: { flexShrink: 0, marginTop: 2 }
|
|
2586
3913
|
}
|
|
2587
3914
|
),
|
|
2588
|
-
/* @__PURE__ */
|
|
3915
|
+
/* @__PURE__ */ jsx10(
|
|
2589
3916
|
"p",
|
|
2590
3917
|
{
|
|
2591
3918
|
style: {
|
|
@@ -2601,7 +3928,7 @@ function RenameWalletModal({
|
|
|
2601
3928
|
}
|
|
2602
3929
|
)
|
|
2603
3930
|
] }),
|
|
2604
|
-
/* @__PURE__ */
|
|
3931
|
+
/* @__PURE__ */ jsx10("div", { style: footerStyle2, children: /* @__PURE__ */ jsx10(
|
|
2605
3932
|
"button",
|
|
2606
3933
|
{
|
|
2607
3934
|
onClick: handleRename,
|
|
@@ -2609,11 +3936,11 @@ function RenameWalletModal({
|
|
|
2609
3936
|
onMouseEnter: () => setSaveHovered(true),
|
|
2610
3937
|
onMouseLeave: () => setSaveHovered(false),
|
|
2611
3938
|
style: saveButtonStyle(canSubmit, saveHovered),
|
|
2612
|
-
children: isRenaming ? /* @__PURE__ */
|
|
2613
|
-
/* @__PURE__ */
|
|
3939
|
+
children: isRenaming ? /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
|
3940
|
+
/* @__PURE__ */ jsx10(Loader2, { size: 14 }),
|
|
2614
3941
|
" Saving..."
|
|
2615
|
-
] }) : /* @__PURE__ */
|
|
2616
|
-
/* @__PURE__ */
|
|
3942
|
+
] }) : /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
|
3943
|
+
/* @__PURE__ */ jsx10(Pencil, { size: 14 }),
|
|
2617
3944
|
" Save Name"
|
|
2618
3945
|
] })
|
|
2619
3946
|
}
|
|
@@ -2626,7 +3953,7 @@ function RenameWalletModal({
|
|
|
2626
3953
|
}
|
|
2627
3954
|
|
|
2628
3955
|
// src/UserProfileModal.tsx
|
|
2629
|
-
import { Fragment as
|
|
3956
|
+
import { Fragment as Fragment7, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2630
3957
|
var DEFAULT_SLIPPAGE_OPTIONS = [
|
|
2631
3958
|
{ label: "0.5%", value: 5e-3 },
|
|
2632
3959
|
{ label: "1%", value: 0.01 },
|
|
@@ -2691,12 +4018,39 @@ var walletRowStyle = {
|
|
|
2691
4018
|
border: `1px solid ${profileColors.surfaceBd}`,
|
|
2692
4019
|
transition: "background-color 150ms, border-color 150ms"
|
|
2693
4020
|
};
|
|
4021
|
+
function getWalletTypeMeta(wallet) {
|
|
4022
|
+
if (wallet.isAgent) {
|
|
4023
|
+
return {
|
|
4024
|
+
label: "Agent wallet",
|
|
4025
|
+
color: "#38bdf8",
|
|
4026
|
+
background: "rgba(56,189,248,0.16)",
|
|
4027
|
+
border: "rgba(56,189,248,0.34)",
|
|
4028
|
+
icon: /* @__PURE__ */ jsx11(Bot, { size: 10 })
|
|
4029
|
+
};
|
|
4030
|
+
}
|
|
4031
|
+
if (wallet.isReadOnly) {
|
|
4032
|
+
return {
|
|
4033
|
+
label: "Read-only wallet",
|
|
4034
|
+
color: "#a78bfa",
|
|
4035
|
+
background: "rgba(167,139,250,0.16)",
|
|
4036
|
+
border: "rgba(167,139,250,0.34)",
|
|
4037
|
+
icon: /* @__PURE__ */ jsx11(Eye, { size: 10 })
|
|
4038
|
+
};
|
|
4039
|
+
}
|
|
4040
|
+
return {
|
|
4041
|
+
label: "Private-key wallet",
|
|
4042
|
+
color: "#34d399",
|
|
4043
|
+
background: "rgba(52,211,153,0.16)",
|
|
4044
|
+
border: "rgba(52,211,153,0.34)",
|
|
4045
|
+
icon: /* @__PURE__ */ jsx11(KeyRound, { size: 10 })
|
|
4046
|
+
};
|
|
4047
|
+
}
|
|
2694
4048
|
function ToggleSwitch({
|
|
2695
4049
|
checked,
|
|
2696
4050
|
onChange,
|
|
2697
4051
|
accentColor
|
|
2698
4052
|
}) {
|
|
2699
|
-
return /* @__PURE__ */
|
|
4053
|
+
return /* @__PURE__ */ jsx11(
|
|
2700
4054
|
"button",
|
|
2701
4055
|
{
|
|
2702
4056
|
onClick: onChange,
|
|
@@ -2715,7 +4069,7 @@ function ToggleSwitch({
|
|
|
2715
4069
|
padding: 0,
|
|
2716
4070
|
transition: "background 150ms"
|
|
2717
4071
|
},
|
|
2718
|
-
children: /* @__PURE__ */
|
|
4072
|
+
children: /* @__PURE__ */ jsx11(
|
|
2719
4073
|
"span",
|
|
2720
4074
|
{
|
|
2721
4075
|
style: {
|
|
@@ -2723,9 +4077,9 @@ function ToggleSwitch({
|
|
|
2723
4077
|
height: 12,
|
|
2724
4078
|
width: 12,
|
|
2725
4079
|
borderRadius: "50%",
|
|
2726
|
-
background: profileColors.text,
|
|
4080
|
+
background: checked ? pickContrastColor(accentColor) : profileColors.text,
|
|
2727
4081
|
transform: checked ? "translateX(20px)" : "translateX(4px)",
|
|
2728
|
-
transition: "transform 150ms"
|
|
4082
|
+
transition: "transform 150ms, background 150ms"
|
|
2729
4083
|
}
|
|
2730
4084
|
}
|
|
2731
4085
|
)
|
|
@@ -2738,8 +4092,8 @@ function RaisedButton({
|
|
|
2738
4092
|
children,
|
|
2739
4093
|
style
|
|
2740
4094
|
}) {
|
|
2741
|
-
const [hovered, setHovered] =
|
|
2742
|
-
return /* @__PURE__ */
|
|
4095
|
+
const [hovered, setHovered] = useState7(false);
|
|
4096
|
+
return /* @__PURE__ */ jsx11(
|
|
2743
4097
|
"button",
|
|
2744
4098
|
{
|
|
2745
4099
|
type: "button",
|
|
@@ -2762,8 +4116,8 @@ function SlippageButton({
|
|
|
2762
4116
|
onClick,
|
|
2763
4117
|
children
|
|
2764
4118
|
}) {
|
|
2765
|
-
const [hovered, setHovered] =
|
|
2766
|
-
return /* @__PURE__ */
|
|
4119
|
+
const [hovered, setHovered] = useState7(false);
|
|
4120
|
+
return /* @__PURE__ */ jsx11(
|
|
2767
4121
|
"button",
|
|
2768
4122
|
{
|
|
2769
4123
|
type: "button",
|
|
@@ -2791,6 +4145,7 @@ function UserProfileModal({
|
|
|
2791
4145
|
onWalletDeleted,
|
|
2792
4146
|
onWalletRenamed,
|
|
2793
4147
|
onShowPortfolio,
|
|
4148
|
+
onRenewAgentWallet,
|
|
2794
4149
|
onNotify,
|
|
2795
4150
|
accentColor,
|
|
2796
4151
|
principalColors
|
|
@@ -2802,9 +4157,9 @@ function UserProfileModal({
|
|
|
2802
4157
|
renameWallet,
|
|
2803
4158
|
authMethod
|
|
2804
4159
|
} = useHypurrConnectInternal();
|
|
2805
|
-
const [settingsTab, setSettingsTab] =
|
|
2806
|
-
const [walletToDelete, setWalletToDelete] =
|
|
2807
|
-
const [walletToRename, setWalletToRename] =
|
|
4160
|
+
const [settingsTab, setSettingsTab] = useState7("ui");
|
|
4161
|
+
const [walletToDelete, setWalletToDelete] = useState7(null);
|
|
4162
|
+
const [walletToRename, setWalletToRename] = useState7(null);
|
|
2808
4163
|
const profilePic = user?.photoUrl || "";
|
|
2809
4164
|
const displayName = user?.displayName || "";
|
|
2810
4165
|
const hfunScore = user?.hfunScore ?? null;
|
|
@@ -2812,30 +4167,30 @@ function UserProfileModal({
|
|
|
2812
4167
|
const telegramId = user?.telegramId;
|
|
2813
4168
|
const wallets = userWallets ?? [];
|
|
2814
4169
|
const colors = resolvePrincipalColors(accentColor, principalColors);
|
|
2815
|
-
const handleDeleteWallet =
|
|
4170
|
+
const handleDeleteWallet = useCallback8(
|
|
2816
4171
|
async (walletId) => {
|
|
2817
4172
|
await deleteWallet(walletId);
|
|
2818
4173
|
onWalletDeleted?.(walletId);
|
|
2819
4174
|
},
|
|
2820
4175
|
[deleteWallet, onWalletDeleted]
|
|
2821
4176
|
);
|
|
2822
|
-
const handleRenameWallet =
|
|
4177
|
+
const handleRenameWallet = useCallback8(
|
|
2823
4178
|
async (walletId, name) => {
|
|
2824
4179
|
await renameWallet(walletId, name);
|
|
2825
4180
|
onWalletRenamed?.(walletId, name);
|
|
2826
4181
|
},
|
|
2827
4182
|
[renameWallet, onWalletRenamed]
|
|
2828
4183
|
);
|
|
2829
|
-
const handleCopyAddress =
|
|
4184
|
+
const handleCopyAddress = useCallback8(() => {
|
|
2830
4185
|
if (!displayName) return;
|
|
2831
4186
|
navigator.clipboard.writeText(displayName);
|
|
2832
4187
|
onNotify?.({ type: "success", message: "Address copied" });
|
|
2833
4188
|
}, [displayName, onNotify]);
|
|
2834
|
-
return /* @__PURE__ */
|
|
2835
|
-
/* @__PURE__ */
|
|
2836
|
-
/* @__PURE__ */
|
|
2837
|
-
/* @__PURE__ */
|
|
2838
|
-
|
|
4189
|
+
return /* @__PURE__ */ jsxs10(Fragment7, { children: [
|
|
4190
|
+
/* @__PURE__ */ jsx11(AnimatePresence6, { children: isOpen && /* @__PURE__ */ jsxs10(Fragment7, { children: [
|
|
4191
|
+
/* @__PURE__ */ jsx11(SpinKeyframes, {}),
|
|
4192
|
+
/* @__PURE__ */ jsx11(
|
|
4193
|
+
motion6.div,
|
|
2839
4194
|
{
|
|
2840
4195
|
style: backdropStyle4,
|
|
2841
4196
|
initial: { opacity: 0 },
|
|
@@ -2846,8 +4201,8 @@ function UserProfileModal({
|
|
|
2846
4201
|
},
|
|
2847
4202
|
"backdrop"
|
|
2848
4203
|
),
|
|
2849
|
-
/* @__PURE__ */
|
|
2850
|
-
|
|
4204
|
+
/* @__PURE__ */ jsx11("div", { style: wrapperStyle3, onClick: onClose, children: /* @__PURE__ */ jsxs10(
|
|
4205
|
+
motion6.div,
|
|
2851
4206
|
{
|
|
2852
4207
|
style: panelStyle3,
|
|
2853
4208
|
initial: { opacity: 0, y: 8 },
|
|
@@ -2856,20 +4211,20 @@ function UserProfileModal({
|
|
|
2856
4211
|
transition: { duration: 0.18, ease: "easeOut" },
|
|
2857
4212
|
onClick: (e) => e.stopPropagation(),
|
|
2858
4213
|
children: [
|
|
2859
|
-
/* @__PURE__ */
|
|
2860
|
-
/* @__PURE__ */
|
|
2861
|
-
/* @__PURE__ */
|
|
4214
|
+
/* @__PURE__ */ jsxs10("div", { style: headerStyle3, children: [
|
|
4215
|
+
/* @__PURE__ */ jsx11("h3", { style: titleStyle, children: "Profile & Settings" }),
|
|
4216
|
+
/* @__PURE__ */ jsx11(
|
|
2862
4217
|
"button",
|
|
2863
4218
|
{
|
|
2864
4219
|
onClick: onClose,
|
|
2865
4220
|
style: closeBtnStyle(),
|
|
2866
4221
|
"aria-label": "Close",
|
|
2867
|
-
children: /* @__PURE__ */
|
|
4222
|
+
children: /* @__PURE__ */ jsx11(X, { size: 16 })
|
|
2868
4223
|
}
|
|
2869
4224
|
)
|
|
2870
4225
|
] }),
|
|
2871
|
-
/* @__PURE__ */
|
|
2872
|
-
authMethod === "eoa" && !profilePic ? /* @__PURE__ */
|
|
4226
|
+
/* @__PURE__ */ jsxs10("div", { style: profileSectionStyle, children: [
|
|
4227
|
+
authMethod === "eoa" && !profilePic ? /* @__PURE__ */ jsxs10(
|
|
2873
4228
|
"div",
|
|
2874
4229
|
{
|
|
2875
4230
|
style: {
|
|
@@ -2879,7 +4234,7 @@ function UserProfileModal({
|
|
|
2879
4234
|
borderRadius: 8
|
|
2880
4235
|
},
|
|
2881
4236
|
children: [
|
|
2882
|
-
/* @__PURE__ */
|
|
4237
|
+
/* @__PURE__ */ jsx11(
|
|
2883
4238
|
"p",
|
|
2884
4239
|
{
|
|
2885
4240
|
style: {
|
|
@@ -2890,7 +4245,7 @@ function UserProfileModal({
|
|
|
2890
4245
|
children: "Wallet"
|
|
2891
4246
|
}
|
|
2892
4247
|
),
|
|
2893
|
-
/* @__PURE__ */
|
|
4248
|
+
/* @__PURE__ */ jsxs10(
|
|
2894
4249
|
"div",
|
|
2895
4250
|
{
|
|
2896
4251
|
style: {
|
|
@@ -2900,7 +4255,7 @@ function UserProfileModal({
|
|
|
2900
4255
|
gap: 8
|
|
2901
4256
|
},
|
|
2902
4257
|
children: [
|
|
2903
|
-
/* @__PURE__ */
|
|
4258
|
+
/* @__PURE__ */ jsx11(
|
|
2904
4259
|
"p",
|
|
2905
4260
|
{
|
|
2906
4261
|
style: {
|
|
@@ -2914,7 +4269,7 @@ function UserProfileModal({
|
|
|
2914
4269
|
children: displayName
|
|
2915
4270
|
}
|
|
2916
4271
|
),
|
|
2917
|
-
/* @__PURE__ */
|
|
4272
|
+
/* @__PURE__ */ jsx11(
|
|
2918
4273
|
"button",
|
|
2919
4274
|
{
|
|
2920
4275
|
onClick: handleCopyAddress,
|
|
@@ -2927,7 +4282,7 @@ function UserProfileModal({
|
|
|
2927
4282
|
display: "flex"
|
|
2928
4283
|
},
|
|
2929
4284
|
"aria-label": "Copy address",
|
|
2930
|
-
children: /* @__PURE__ */
|
|
4285
|
+
children: /* @__PURE__ */ jsx11(Copy, { size: 13 })
|
|
2931
4286
|
}
|
|
2932
4287
|
)
|
|
2933
4288
|
]
|
|
@@ -2935,7 +4290,7 @@ function UserProfileModal({
|
|
|
2935
4290
|
)
|
|
2936
4291
|
]
|
|
2937
4292
|
}
|
|
2938
|
-
) : /* @__PURE__ */
|
|
4293
|
+
) : /* @__PURE__ */ jsxs10(
|
|
2939
4294
|
"div",
|
|
2940
4295
|
{
|
|
2941
4296
|
style: {
|
|
@@ -2944,7 +4299,7 @@ function UserProfileModal({
|
|
|
2944
4299
|
gap: 16
|
|
2945
4300
|
},
|
|
2946
4301
|
children: [
|
|
2947
|
-
profilePic ? /* @__PURE__ */
|
|
4302
|
+
profilePic ? /* @__PURE__ */ jsx11(
|
|
2948
4303
|
"img",
|
|
2949
4304
|
{
|
|
2950
4305
|
src: profilePic,
|
|
@@ -2956,7 +4311,7 @@ function UserProfileModal({
|
|
|
2956
4311
|
border: `1px solid ${profileColors.surfaceBd}`
|
|
2957
4312
|
}
|
|
2958
4313
|
}
|
|
2959
|
-
) : /* @__PURE__ */
|
|
4314
|
+
) : /* @__PURE__ */ jsx11(
|
|
2960
4315
|
"div",
|
|
2961
4316
|
{
|
|
2962
4317
|
style: {
|
|
@@ -2976,8 +4331,8 @@ function UserProfileModal({
|
|
|
2976
4331
|
children: displayName?.charAt(0)
|
|
2977
4332
|
}
|
|
2978
4333
|
),
|
|
2979
|
-
/* @__PURE__ */
|
|
2980
|
-
/* @__PURE__ */
|
|
4334
|
+
/* @__PURE__ */ jsxs10("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
4335
|
+
/* @__PURE__ */ jsx11(
|
|
2981
4336
|
"h4",
|
|
2982
4337
|
{
|
|
2983
4338
|
style: {
|
|
@@ -2993,7 +4348,7 @@ function UserProfileModal({
|
|
|
2993
4348
|
children: displayName
|
|
2994
4349
|
}
|
|
2995
4350
|
),
|
|
2996
|
-
telegramId && /* @__PURE__ */
|
|
4351
|
+
telegramId && /* @__PURE__ */ jsxs10(
|
|
2997
4352
|
"p",
|
|
2998
4353
|
{
|
|
2999
4354
|
style: {
|
|
@@ -3012,7 +4367,7 @@ function UserProfileModal({
|
|
|
3012
4367
|
]
|
|
3013
4368
|
}
|
|
3014
4369
|
),
|
|
3015
|
-
user && /* @__PURE__ */
|
|
4370
|
+
user && /* @__PURE__ */ jsxs10(
|
|
3016
4371
|
"div",
|
|
3017
4372
|
{
|
|
3018
4373
|
style: {
|
|
@@ -3022,8 +4377,8 @@ function UserProfileModal({
|
|
|
3022
4377
|
gap: 10
|
|
3023
4378
|
},
|
|
3024
4379
|
children: [
|
|
3025
|
-
/* @__PURE__ */
|
|
3026
|
-
/* @__PURE__ */
|
|
4380
|
+
/* @__PURE__ */ jsxs10("div", { style: statBoxStyle, children: [
|
|
4381
|
+
/* @__PURE__ */ jsxs10(
|
|
3027
4382
|
"div",
|
|
3028
4383
|
{
|
|
3029
4384
|
style: {
|
|
@@ -3034,12 +4389,12 @@ function UserProfileModal({
|
|
|
3034
4389
|
marginBottom: 6
|
|
3035
4390
|
},
|
|
3036
4391
|
children: [
|
|
3037
|
-
/* @__PURE__ */
|
|
3038
|
-
/* @__PURE__ */
|
|
4392
|
+
/* @__PURE__ */ jsx11(Star, { size: 13, color: "#eab308", fill: "#eab308" }),
|
|
4393
|
+
/* @__PURE__ */ jsx11("span", { style: upperLabelStyle, children: "Hfun Score" })
|
|
3039
4394
|
]
|
|
3040
4395
|
}
|
|
3041
4396
|
),
|
|
3042
|
-
/* @__PURE__ */
|
|
4397
|
+
/* @__PURE__ */ jsx11(
|
|
3043
4398
|
"p",
|
|
3044
4399
|
{
|
|
3045
4400
|
style: {
|
|
@@ -3054,8 +4409,8 @@ function UserProfileModal({
|
|
|
3054
4409
|
}
|
|
3055
4410
|
)
|
|
3056
4411
|
] }),
|
|
3057
|
-
/* @__PURE__ */
|
|
3058
|
-
/* @__PURE__ */
|
|
4412
|
+
/* @__PURE__ */ jsxs10("div", { style: statBoxStyle, children: [
|
|
4413
|
+
/* @__PURE__ */ jsxs10(
|
|
3059
4414
|
"div",
|
|
3060
4415
|
{
|
|
3061
4416
|
style: {
|
|
@@ -3066,12 +4421,12 @@ function UserProfileModal({
|
|
|
3066
4421
|
marginBottom: 6
|
|
3067
4422
|
},
|
|
3068
4423
|
children: [
|
|
3069
|
-
/* @__PURE__ */
|
|
3070
|
-
/* @__PURE__ */
|
|
4424
|
+
/* @__PURE__ */ jsx11(User, { size: 13 }),
|
|
4425
|
+
/* @__PURE__ */ jsx11("span", { style: upperLabelStyle, children: "Reputation" })
|
|
3071
4426
|
]
|
|
3072
4427
|
}
|
|
3073
4428
|
),
|
|
3074
|
-
/* @__PURE__ */
|
|
4429
|
+
/* @__PURE__ */ jsx11(
|
|
3075
4430
|
"p",
|
|
3076
4431
|
{
|
|
3077
4432
|
style: {
|
|
@@ -3090,43 +4445,43 @@ function UserProfileModal({
|
|
|
3090
4445
|
}
|
|
3091
4446
|
)
|
|
3092
4447
|
] }),
|
|
3093
|
-
/* @__PURE__ */
|
|
3094
|
-
/* @__PURE__ */
|
|
3095
|
-
/* @__PURE__ */
|
|
4448
|
+
/* @__PURE__ */ jsxs10("div", { style: settingsSectionStyle, children: [
|
|
4449
|
+
/* @__PURE__ */ jsxs10("div", { style: tabRowStyle, children: [
|
|
4450
|
+
/* @__PURE__ */ jsxs10(
|
|
3096
4451
|
RaisedButton,
|
|
3097
4452
|
{
|
|
3098
4453
|
selected: settingsTab === "ui",
|
|
3099
4454
|
onClick: () => setSettingsTab("ui"),
|
|
3100
4455
|
children: [
|
|
3101
|
-
/* @__PURE__ */
|
|
4456
|
+
/* @__PURE__ */ jsx11(Zap, { size: 13 }),
|
|
3102
4457
|
" UI"
|
|
3103
4458
|
]
|
|
3104
4459
|
}
|
|
3105
4460
|
),
|
|
3106
|
-
/* @__PURE__ */
|
|
4461
|
+
/* @__PURE__ */ jsxs10(
|
|
3107
4462
|
RaisedButton,
|
|
3108
4463
|
{
|
|
3109
4464
|
selected: settingsTab === "trading",
|
|
3110
4465
|
onClick: () => setSettingsTab("trading"),
|
|
3111
4466
|
children: [
|
|
3112
|
-
/* @__PURE__ */
|
|
4467
|
+
/* @__PURE__ */ jsx11(TrendingUp, { size: 13 }),
|
|
3113
4468
|
" Trading"
|
|
3114
4469
|
]
|
|
3115
4470
|
}
|
|
3116
4471
|
),
|
|
3117
|
-
/* @__PURE__ */
|
|
4472
|
+
/* @__PURE__ */ jsxs10(
|
|
3118
4473
|
RaisedButton,
|
|
3119
4474
|
{
|
|
3120
4475
|
selected: settingsTab === "wallets",
|
|
3121
4476
|
onClick: () => setSettingsTab("wallets"),
|
|
3122
4477
|
children: [
|
|
3123
|
-
/* @__PURE__ */
|
|
4478
|
+
/* @__PURE__ */ jsx11(Wallet, { size: 13 }),
|
|
3124
4479
|
" Wallets"
|
|
3125
4480
|
]
|
|
3126
4481
|
}
|
|
3127
4482
|
)
|
|
3128
4483
|
] }),
|
|
3129
|
-
settingsTab === "ui" && /* @__PURE__ */
|
|
4484
|
+
settingsTab === "ui" && /* @__PURE__ */ jsx11(
|
|
3130
4485
|
"div",
|
|
3131
4486
|
{
|
|
3132
4487
|
style: {
|
|
@@ -3134,7 +4489,7 @@ function UserProfileModal({
|
|
|
3134
4489
|
flexDirection: "column",
|
|
3135
4490
|
gap: 12
|
|
3136
4491
|
},
|
|
3137
|
-
children: /* @__PURE__ */
|
|
4492
|
+
children: /* @__PURE__ */ jsxs10(
|
|
3138
4493
|
"div",
|
|
3139
4494
|
{
|
|
3140
4495
|
style: {
|
|
@@ -3144,7 +4499,7 @@ function UserProfileModal({
|
|
|
3144
4499
|
padding: "8px 0"
|
|
3145
4500
|
},
|
|
3146
4501
|
children: [
|
|
3147
|
-
/* @__PURE__ */
|
|
4502
|
+
/* @__PURE__ */ jsxs10(
|
|
3148
4503
|
"div",
|
|
3149
4504
|
{
|
|
3150
4505
|
style: {
|
|
@@ -3153,9 +4508,9 @@ function UserProfileModal({
|
|
|
3153
4508
|
gap: 12
|
|
3154
4509
|
},
|
|
3155
4510
|
children: [
|
|
3156
|
-
/* @__PURE__ */
|
|
3157
|
-
/* @__PURE__ */
|
|
3158
|
-
/* @__PURE__ */
|
|
4511
|
+
/* @__PURE__ */ jsx11(Zap, { size: 16, color: profileColors.muted }),
|
|
4512
|
+
/* @__PURE__ */ jsxs10("div", { children: [
|
|
4513
|
+
/* @__PURE__ */ jsx11(
|
|
3159
4514
|
"p",
|
|
3160
4515
|
{
|
|
3161
4516
|
style: {
|
|
@@ -3168,7 +4523,7 @@ function UserProfileModal({
|
|
|
3168
4523
|
children: "Animations"
|
|
3169
4524
|
}
|
|
3170
4525
|
),
|
|
3171
|
-
/* @__PURE__ */
|
|
4526
|
+
/* @__PURE__ */ jsx11(
|
|
3172
4527
|
"p",
|
|
3173
4528
|
{
|
|
3174
4529
|
style: {
|
|
@@ -3184,7 +4539,7 @@ function UserProfileModal({
|
|
|
3184
4539
|
]
|
|
3185
4540
|
}
|
|
3186
4541
|
),
|
|
3187
|
-
/* @__PURE__ */
|
|
4542
|
+
/* @__PURE__ */ jsx11(
|
|
3188
4543
|
ToggleSwitch,
|
|
3189
4544
|
{
|
|
3190
4545
|
checked: animationsEnabled,
|
|
@@ -3197,8 +4552,8 @@ function UserProfileModal({
|
|
|
3197
4552
|
)
|
|
3198
4553
|
}
|
|
3199
4554
|
),
|
|
3200
|
-
settingsTab === "trading" && /* @__PURE__ */
|
|
3201
|
-
/* @__PURE__ */
|
|
4555
|
+
settingsTab === "trading" && /* @__PURE__ */ jsxs10("div", { style: { padding: "8px 0" }, children: [
|
|
4556
|
+
/* @__PURE__ */ jsxs10(
|
|
3202
4557
|
"div",
|
|
3203
4558
|
{
|
|
3204
4559
|
style: {
|
|
@@ -3208,9 +4563,9 @@ function UserProfileModal({
|
|
|
3208
4563
|
marginBottom: 12
|
|
3209
4564
|
},
|
|
3210
4565
|
children: [
|
|
3211
|
-
/* @__PURE__ */
|
|
3212
|
-
/* @__PURE__ */
|
|
3213
|
-
/* @__PURE__ */
|
|
4566
|
+
/* @__PURE__ */ jsx11(TrendingUp, { size: 16, color: profileColors.muted }),
|
|
4567
|
+
/* @__PURE__ */ jsxs10("div", { children: [
|
|
4568
|
+
/* @__PURE__ */ jsx11(
|
|
3214
4569
|
"p",
|
|
3215
4570
|
{
|
|
3216
4571
|
style: {
|
|
@@ -3223,7 +4578,7 @@ function UserProfileModal({
|
|
|
3223
4578
|
children: "Default Slippage"
|
|
3224
4579
|
}
|
|
3225
4580
|
),
|
|
3226
|
-
/* @__PURE__ */
|
|
4581
|
+
/* @__PURE__ */ jsx11(
|
|
3227
4582
|
"p",
|
|
3228
4583
|
{
|
|
3229
4584
|
style: {
|
|
@@ -3239,7 +4594,7 @@ function UserProfileModal({
|
|
|
3239
4594
|
]
|
|
3240
4595
|
}
|
|
3241
4596
|
),
|
|
3242
|
-
/* @__PURE__ */
|
|
4597
|
+
/* @__PURE__ */ jsx11("div", { style: { display: "flex", gap: 6 }, children: slippageOptions.map((option) => /* @__PURE__ */ jsx11(
|
|
3243
4598
|
SlippageButton,
|
|
3244
4599
|
{
|
|
3245
4600
|
onClick: () => onSlippageChange(option.value),
|
|
@@ -3249,7 +4604,7 @@ function UserProfileModal({
|
|
|
3249
4604
|
option.value
|
|
3250
4605
|
)) })
|
|
3251
4606
|
] }),
|
|
3252
|
-
settingsTab === "wallets" && /* @__PURE__ */
|
|
4607
|
+
settingsTab === "wallets" && /* @__PURE__ */ jsxs10(
|
|
3253
4608
|
"div",
|
|
3254
4609
|
{
|
|
3255
4610
|
style: {
|
|
@@ -3258,7 +4613,7 @@ function UserProfileModal({
|
|
|
3258
4613
|
gap: 8
|
|
3259
4614
|
},
|
|
3260
4615
|
children: [
|
|
3261
|
-
wallets.length === 0 ? /* @__PURE__ */
|
|
4616
|
+
wallets.length === 0 ? /* @__PURE__ */ jsxs10(
|
|
3262
4617
|
"div",
|
|
3263
4618
|
{
|
|
3264
4619
|
style: {
|
|
@@ -3266,7 +4621,7 @@ function UserProfileModal({
|
|
|
3266
4621
|
padding: "32px 0"
|
|
3267
4622
|
},
|
|
3268
4623
|
children: [
|
|
3269
|
-
/* @__PURE__ */
|
|
4624
|
+
/* @__PURE__ */ jsx11(
|
|
3270
4625
|
"div",
|
|
3271
4626
|
{
|
|
3272
4627
|
style: {
|
|
@@ -3279,10 +4634,10 @@ function UserProfileModal({
|
|
|
3279
4634
|
justifyContent: "center",
|
|
3280
4635
|
margin: "0 auto 12px"
|
|
3281
4636
|
},
|
|
3282
|
-
children: /* @__PURE__ */
|
|
4637
|
+
children: /* @__PURE__ */ jsx11(Wallet, { size: 18, color: profileColors.muted })
|
|
3283
4638
|
}
|
|
3284
4639
|
),
|
|
3285
|
-
/* @__PURE__ */
|
|
4640
|
+
/* @__PURE__ */ jsx11(
|
|
3286
4641
|
"p",
|
|
3287
4642
|
{
|
|
3288
4643
|
style: {
|
|
@@ -3296,7 +4651,7 @@ function UserProfileModal({
|
|
|
3296
4651
|
)
|
|
3297
4652
|
]
|
|
3298
4653
|
}
|
|
3299
|
-
) : /* @__PURE__ */
|
|
4654
|
+
) : /* @__PURE__ */ jsx11(
|
|
3300
4655
|
"div",
|
|
3301
4656
|
{
|
|
3302
4657
|
style: {
|
|
@@ -3306,20 +4661,21 @@ function UserProfileModal({
|
|
|
3306
4661
|
flexDirection: "column",
|
|
3307
4662
|
gap: 6
|
|
3308
4663
|
},
|
|
3309
|
-
children: wallets.map((wallet) => /* @__PURE__ */
|
|
4664
|
+
children: wallets.map((wallet) => /* @__PURE__ */ jsx11(
|
|
3310
4665
|
WalletRow,
|
|
3311
4666
|
{
|
|
3312
4667
|
wallet,
|
|
3313
4668
|
colors,
|
|
3314
4669
|
onRename: () => setWalletToRename(wallet),
|
|
3315
4670
|
onDelete: () => setWalletToDelete(wallet),
|
|
4671
|
+
onRenewAgentWallet: wallet.isAgent && onRenewAgentWallet ? () => onRenewAgentWallet(wallet) : void 0,
|
|
3316
4672
|
onShowPortfolio: onShowPortfolio ? () => onShowPortfolio(wallet) : void 0
|
|
3317
4673
|
},
|
|
3318
4674
|
wallet.id
|
|
3319
4675
|
))
|
|
3320
4676
|
}
|
|
3321
4677
|
),
|
|
3322
|
-
/* @__PURE__ */
|
|
4678
|
+
/* @__PURE__ */ jsxs10(
|
|
3323
4679
|
"p",
|
|
3324
4680
|
{
|
|
3325
4681
|
style: {
|
|
@@ -3341,7 +4697,7 @@ function UserProfileModal({
|
|
|
3341
4697
|
}
|
|
3342
4698
|
)
|
|
3343
4699
|
] }),
|
|
3344
|
-
/* @__PURE__ */
|
|
4700
|
+
/* @__PURE__ */ jsx11("div", { style: { padding: "0 24px 24px" }, children: /* @__PURE__ */ jsx11(
|
|
3345
4701
|
"button",
|
|
3346
4702
|
{
|
|
3347
4703
|
onClick: onClose,
|
|
@@ -3363,7 +4719,7 @@ function UserProfileModal({
|
|
|
3363
4719
|
"panel"
|
|
3364
4720
|
) })
|
|
3365
4721
|
] }) }),
|
|
3366
|
-
/* @__PURE__ */
|
|
4722
|
+
/* @__PURE__ */ jsx11(
|
|
3367
4723
|
DeleteWalletModal,
|
|
3368
4724
|
{
|
|
3369
4725
|
isOpen: !!walletToDelete,
|
|
@@ -3373,7 +4729,7 @@ function UserProfileModal({
|
|
|
3373
4729
|
onNotify
|
|
3374
4730
|
}
|
|
3375
4731
|
),
|
|
3376
|
-
/* @__PURE__ */
|
|
4732
|
+
/* @__PURE__ */ jsx11(
|
|
3377
4733
|
RenameWalletModal,
|
|
3378
4734
|
{
|
|
3379
4735
|
isOpen: !!walletToRename,
|
|
@@ -3391,84 +4747,134 @@ function WalletRow({
|
|
|
3391
4747
|
colors,
|
|
3392
4748
|
onRename,
|
|
3393
4749
|
onDelete,
|
|
4750
|
+
onRenewAgentWallet,
|
|
3394
4751
|
onShowPortfolio
|
|
3395
4752
|
}) {
|
|
3396
|
-
const [hovered, setHovered] =
|
|
3397
|
-
|
|
4753
|
+
const [hovered, setHovered] = useState7(false);
|
|
4754
|
+
const agentExpiryTitle = getAgentExpiryTitle(wallet);
|
|
4755
|
+
const isAgentExpired = !!agentExpiryTitle;
|
|
4756
|
+
const displayAddress = wallet.isAgent && wallet.agentEthereumAddress?.value ? wallet.agentEthereumAddress.value : wallet.ethereumAddress;
|
|
4757
|
+
const typeMeta = getWalletTypeMeta(wallet);
|
|
4758
|
+
return /* @__PURE__ */ jsxs10(
|
|
3398
4759
|
"div",
|
|
3399
4760
|
{
|
|
3400
4761
|
style: {
|
|
3401
4762
|
...walletRowStyle,
|
|
3402
|
-
background: hovered ? profileColors.surfaceBtnHover : profileColors.surfaceBtn,
|
|
3403
|
-
borderColor: hovered ? profileColors.surfaceBdHover : profileColors.surfaceBd
|
|
4763
|
+
background: isAgentExpired ? hovered ? "rgba(245,158,11,0.12)" : "rgba(245,158,11,0.07)" : hovered ? profileColors.surfaceBtnHover : profileColors.surfaceBtn,
|
|
4764
|
+
borderColor: isAgentExpired ? "rgba(245,158,11,0.34)" : hovered ? profileColors.surfaceBdHover : profileColors.surfaceBd
|
|
3404
4765
|
},
|
|
3405
4766
|
onMouseEnter: () => setHovered(true),
|
|
3406
4767
|
onMouseLeave: () => setHovered(false),
|
|
3407
4768
|
children: [
|
|
3408
|
-
/* @__PURE__ */
|
|
4769
|
+
/* @__PURE__ */ jsxs10(
|
|
3409
4770
|
"div",
|
|
3410
4771
|
{
|
|
3411
4772
|
style: {
|
|
4773
|
+
position: "relative",
|
|
3412
4774
|
width: 32,
|
|
3413
4775
|
height: 32,
|
|
3414
4776
|
borderRadius: 6,
|
|
3415
|
-
background: colors.accentBackground,
|
|
3416
|
-
border: `1px solid ${colors.accentBorder}`,
|
|
4777
|
+
background: isAgentExpired ? "rgba(245,158,11,0.12)" : colors.accentBackground,
|
|
4778
|
+
border: `1px solid ${isAgentExpired ? "rgba(245,158,11,0.34)" : colors.accentBorder}`,
|
|
3417
4779
|
display: "flex",
|
|
3418
4780
|
alignItems: "center",
|
|
3419
4781
|
justifyContent: "center",
|
|
3420
4782
|
flexShrink: 0
|
|
3421
4783
|
},
|
|
3422
|
-
children:
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
4784
|
+
children: [
|
|
4785
|
+
/* @__PURE__ */ jsx11(
|
|
4786
|
+
"span",
|
|
4787
|
+
{
|
|
4788
|
+
style: {
|
|
4789
|
+
fontSize: 12.5,
|
|
4790
|
+
lineHeight: "1rem",
|
|
4791
|
+
fontWeight: 600,
|
|
4792
|
+
color: isAgentExpired ? EXPIRED_AGENT_COLOR : colors.accentText
|
|
4793
|
+
},
|
|
4794
|
+
children: (wallet.name || "W")[0].toUpperCase()
|
|
4795
|
+
}
|
|
4796
|
+
),
|
|
4797
|
+
/* @__PURE__ */ jsx11(
|
|
4798
|
+
"span",
|
|
4799
|
+
{
|
|
4800
|
+
role: "img",
|
|
4801
|
+
"aria-label": typeMeta.label,
|
|
4802
|
+
title: typeMeta.label,
|
|
4803
|
+
style: {
|
|
4804
|
+
position: "absolute",
|
|
4805
|
+
right: -5,
|
|
4806
|
+
bottom: -5,
|
|
4807
|
+
width: 16,
|
|
4808
|
+
height: 16,
|
|
4809
|
+
borderRadius: "50%",
|
|
4810
|
+
display: "flex",
|
|
4811
|
+
alignItems: "center",
|
|
4812
|
+
justifyContent: "center",
|
|
4813
|
+
color: typeMeta.color,
|
|
4814
|
+
background: typeMeta.background,
|
|
4815
|
+
border: `1px solid ${typeMeta.border}`,
|
|
4816
|
+
boxShadow: "0 1px 4px rgba(0,0,0,0.35)"
|
|
4817
|
+
},
|
|
4818
|
+
children: typeMeta.icon
|
|
4819
|
+
}
|
|
4820
|
+
)
|
|
4821
|
+
]
|
|
3434
4822
|
}
|
|
3435
4823
|
),
|
|
3436
|
-
/* @__PURE__ */
|
|
3437
|
-
/* @__PURE__ */
|
|
3438
|
-
"
|
|
4824
|
+
/* @__PURE__ */ jsxs10("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
4825
|
+
/* @__PURE__ */ jsx11(
|
|
4826
|
+
"div",
|
|
3439
4827
|
{
|
|
3440
4828
|
style: {
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
color: profileColors.text,
|
|
3446
|
-
overflow: "hidden",
|
|
3447
|
-
textOverflow: "ellipsis",
|
|
3448
|
-
whiteSpace: "nowrap"
|
|
4829
|
+
display: "flex",
|
|
4830
|
+
alignItems: "center",
|
|
4831
|
+
gap: 5,
|
|
4832
|
+
minWidth: 0
|
|
3449
4833
|
},
|
|
3450
|
-
children:
|
|
4834
|
+
children: /* @__PURE__ */ jsx11(
|
|
4835
|
+
"p",
|
|
4836
|
+
{
|
|
4837
|
+
style: {
|
|
4838
|
+
margin: 0,
|
|
4839
|
+
fontSize: 12.5,
|
|
4840
|
+
lineHeight: "1rem",
|
|
4841
|
+
fontWeight: 500,
|
|
4842
|
+
color: isAgentExpired ? EXPIRED_AGENT_COLOR : profileColors.text,
|
|
4843
|
+
overflow: "hidden",
|
|
4844
|
+
textOverflow: "ellipsis",
|
|
4845
|
+
whiteSpace: "nowrap"
|
|
4846
|
+
},
|
|
4847
|
+
children: wallet.name || "Unnamed"
|
|
4848
|
+
}
|
|
4849
|
+
)
|
|
3451
4850
|
}
|
|
3452
4851
|
),
|
|
3453
|
-
/* @__PURE__ */
|
|
4852
|
+
/* @__PURE__ */ jsxs10(
|
|
3454
4853
|
"p",
|
|
3455
4854
|
{
|
|
3456
4855
|
style: {
|
|
3457
4856
|
margin: 0,
|
|
3458
4857
|
fontSize: 12.5,
|
|
3459
4858
|
lineHeight: "1rem",
|
|
3460
|
-
color: profileColors.muted,
|
|
4859
|
+
color: isAgentExpired ? "rgba(245,158,11,0.76)" : profileColors.muted,
|
|
3461
4860
|
fontFamily: fontFamily.mono
|
|
3462
4861
|
},
|
|
3463
4862
|
children: [
|
|
3464
|
-
|
|
4863
|
+
displayAddress?.slice(0, 6),
|
|
3465
4864
|
"...",
|
|
3466
|
-
|
|
4865
|
+
displayAddress?.slice(-4)
|
|
3467
4866
|
]
|
|
3468
4867
|
}
|
|
3469
4868
|
)
|
|
3470
4869
|
] }),
|
|
3471
|
-
/* @__PURE__ */
|
|
4870
|
+
agentExpiryTitle && /* @__PURE__ */ jsx11(
|
|
4871
|
+
AgentExpiryWarningIcon,
|
|
4872
|
+
{
|
|
4873
|
+
message: agentExpiryTitle,
|
|
4874
|
+
onClick: onRenewAgentWallet
|
|
4875
|
+
}
|
|
4876
|
+
),
|
|
4877
|
+
/* @__PURE__ */ jsxs10(
|
|
3472
4878
|
"div",
|
|
3473
4879
|
{
|
|
3474
4880
|
style: {
|
|
@@ -3480,7 +4886,18 @@ function WalletRow({
|
|
|
3480
4886
|
transition: "opacity 120ms"
|
|
3481
4887
|
},
|
|
3482
4888
|
children: [
|
|
3483
|
-
|
|
4889
|
+
wallet.isAgent && onRenewAgentWallet && /* @__PURE__ */ jsx11(
|
|
4890
|
+
IconBtn,
|
|
4891
|
+
{
|
|
4892
|
+
color: isAgentExpired ? EXPIRED_AGENT_COLOR : colors.accent,
|
|
4893
|
+
hoverBackgroundColor: isAgentExpired ? "rgba(245,158,11,0.12)" : colors.accentHoverBackground,
|
|
4894
|
+
title: "Renew agent wallet",
|
|
4895
|
+
ariaLabel: `Renew agent wallet for ${wallet.name || "wallet"}`,
|
|
4896
|
+
onClick: onRenewAgentWallet,
|
|
4897
|
+
children: /* @__PURE__ */ jsx11(RefreshCw, { size: 13 })
|
|
4898
|
+
}
|
|
4899
|
+
),
|
|
4900
|
+
onShowPortfolio && /* @__PURE__ */ jsx11(
|
|
3484
4901
|
IconBtn,
|
|
3485
4902
|
{
|
|
3486
4903
|
color: colors.accent,
|
|
@@ -3488,10 +4905,10 @@ function WalletRow({
|
|
|
3488
4905
|
title: "View portfolio",
|
|
3489
4906
|
ariaLabel: `View portfolio for ${wallet.name || "wallet"}`,
|
|
3490
4907
|
onClick: onShowPortfolio,
|
|
3491
|
-
children: /* @__PURE__ */
|
|
4908
|
+
children: /* @__PURE__ */ jsx11(LayoutDashboard, { size: 13 })
|
|
3492
4909
|
}
|
|
3493
4910
|
),
|
|
3494
|
-
/* @__PURE__ */
|
|
4911
|
+
/* @__PURE__ */ jsx11(
|
|
3495
4912
|
IconBtn,
|
|
3496
4913
|
{
|
|
3497
4914
|
color: colors.accent,
|
|
@@ -3499,10 +4916,10 @@ function WalletRow({
|
|
|
3499
4916
|
title: "Rename wallet",
|
|
3500
4917
|
ariaLabel: `Rename ${wallet.name || "wallet"}`,
|
|
3501
4918
|
onClick: onRename,
|
|
3502
|
-
children: /* @__PURE__ */
|
|
4919
|
+
children: /* @__PURE__ */ jsx11(Pencil, { size: 13 })
|
|
3503
4920
|
}
|
|
3504
4921
|
),
|
|
3505
|
-
/* @__PURE__ */
|
|
4922
|
+
/* @__PURE__ */ jsx11(
|
|
3506
4923
|
IconBtn,
|
|
3507
4924
|
{
|
|
3508
4925
|
color: "#ef4444",
|
|
@@ -3510,7 +4927,7 @@ function WalletRow({
|
|
|
3510
4927
|
title: "Delete wallet",
|
|
3511
4928
|
ariaLabel: `Delete ${wallet.name || "wallet"}`,
|
|
3512
4929
|
onClick: onDelete,
|
|
3513
|
-
children: /* @__PURE__ */
|
|
4930
|
+
children: /* @__PURE__ */ jsx11(Trash2, { size: 13 })
|
|
3514
4931
|
}
|
|
3515
4932
|
)
|
|
3516
4933
|
]
|
|
@@ -3528,8 +4945,8 @@ function IconBtn({
|
|
|
3528
4945
|
ariaLabel,
|
|
3529
4946
|
onClick
|
|
3530
4947
|
}) {
|
|
3531
|
-
const [hovered, setHovered] =
|
|
3532
|
-
return /* @__PURE__ */
|
|
4948
|
+
const [hovered, setHovered] = useState7(false);
|
|
4949
|
+
return /* @__PURE__ */ jsx11(
|
|
3533
4950
|
"button",
|
|
3534
4951
|
{
|
|
3535
4952
|
onMouseEnter: () => setHovered(true),
|
|
@@ -3555,8 +4972,8 @@ function IconBtn({
|
|
|
3555
4972
|
}
|
|
3556
4973
|
|
|
3557
4974
|
// src/WalletSelectorDropdown.tsx
|
|
3558
|
-
import { Fragment as
|
|
3559
|
-
var
|
|
4975
|
+
import { Fragment as Fragment9, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4976
|
+
var DEFAULT_BACKGROUND_COLOR2 = "rgba(20,20,20,0.95)";
|
|
3560
4977
|
var getWalletNameParts = (name) => (name ?? "").split("/").map((part) => part.trim()).filter(Boolean);
|
|
3561
4978
|
var buildWalletListEntries = (wallets) => {
|
|
3562
4979
|
const standalone = [];
|
|
@@ -3625,6 +5042,28 @@ var formatCompactAddress = (addr) => {
|
|
|
3625
5042
|
if (!addr) return "";
|
|
3626
5043
|
return `${addr.slice(0, 4)}...${addr.slice(-2)}`;
|
|
3627
5044
|
};
|
|
5045
|
+
var getDisplayAddress = (wallet) => wallet.isAgent && wallet.agentEthereumAddress?.value ? wallet.agentEthereumAddress.value : wallet.ethereumAddress;
|
|
5046
|
+
function getWalletTypeMeta2(wallet) {
|
|
5047
|
+
if (wallet.isAgent) {
|
|
5048
|
+
return {
|
|
5049
|
+
label: "Agent wallet",
|
|
5050
|
+
color: "#38bdf8",
|
|
5051
|
+
icon: /* @__PURE__ */ jsx12(Bot, { size: 12 })
|
|
5052
|
+
};
|
|
5053
|
+
}
|
|
5054
|
+
if (wallet.isReadOnly) {
|
|
5055
|
+
return {
|
|
5056
|
+
label: "Read-only wallet",
|
|
5057
|
+
color: "#a78bfa",
|
|
5058
|
+
icon: /* @__PURE__ */ jsx12(Eye, { size: 12 })
|
|
5059
|
+
};
|
|
5060
|
+
}
|
|
5061
|
+
return {
|
|
5062
|
+
label: "Private-key wallet",
|
|
5063
|
+
color: "#34d399",
|
|
5064
|
+
icon: /* @__PURE__ */ jsx12(KeyRound, { size: 12 })
|
|
5065
|
+
};
|
|
5066
|
+
}
|
|
3628
5067
|
var rootStyle = {
|
|
3629
5068
|
position: "absolute",
|
|
3630
5069
|
right: 0,
|
|
@@ -3667,6 +5106,7 @@ function WalletSelectorDropdown({
|
|
|
3667
5106
|
onClose,
|
|
3668
5107
|
onAddWallet,
|
|
3669
5108
|
onShowPortfolio,
|
|
5109
|
+
onRenewAgentWallet,
|
|
3670
5110
|
onLogout,
|
|
3671
5111
|
onNotify,
|
|
3672
5112
|
vipThreshold = 10,
|
|
@@ -3679,19 +5119,20 @@ function WalletSelectorDropdown({
|
|
|
3679
5119
|
onWalletRenamed,
|
|
3680
5120
|
accentColor,
|
|
3681
5121
|
principalColors,
|
|
3682
|
-
backgroundColor =
|
|
5122
|
+
backgroundColor = DEFAULT_BACKGROUND_COLOR2,
|
|
5123
|
+
extraFooterItems
|
|
3683
5124
|
}) {
|
|
3684
5125
|
const { user, wallets, selectedWalletId, selectWallet, logout, authMethod } = useHypurrConnectInternal();
|
|
3685
|
-
const [profileOpen, setProfileOpen] =
|
|
3686
|
-
const openProfile =
|
|
5126
|
+
const [profileOpen, setProfileOpen] = useState8(false);
|
|
5127
|
+
const openProfile = useCallback9(() => {
|
|
3687
5128
|
setProfileOpen(true);
|
|
3688
5129
|
onClose();
|
|
3689
5130
|
}, [onClose]);
|
|
3690
|
-
const walletListEntries =
|
|
5131
|
+
const walletListEntries = useMemo3(
|
|
3691
5132
|
() => buildWalletListEntries(Array.isArray(wallets) ? wallets : void 0),
|
|
3692
5133
|
[wallets]
|
|
3693
5134
|
);
|
|
3694
|
-
const handleCopyAddress =
|
|
5135
|
+
const handleCopyAddress = useCallback9(
|
|
3695
5136
|
(address) => {
|
|
3696
5137
|
if (!address) return;
|
|
3697
5138
|
navigator.clipboard.writeText(address);
|
|
@@ -3699,7 +5140,7 @@ function WalletSelectorDropdown({
|
|
|
3699
5140
|
},
|
|
3700
5141
|
[onNotify]
|
|
3701
5142
|
);
|
|
3702
|
-
const handleLogout =
|
|
5143
|
+
const handleLogout = useCallback9(() => {
|
|
3703
5144
|
onLogout?.();
|
|
3704
5145
|
logout();
|
|
3705
5146
|
onClose();
|
|
@@ -3712,13 +5153,19 @@ function WalletSelectorDropdown({
|
|
|
3712
5153
|
const renderWalletRow = (item, depth) => {
|
|
3713
5154
|
const { wallet, label } = item;
|
|
3714
5155
|
const isSelected = wallet.id === selectedWalletId;
|
|
3715
|
-
const
|
|
3716
|
-
|
|
5156
|
+
const displayAddress = getDisplayAddress(wallet);
|
|
5157
|
+
const compactAddress = formatCompactAddress(displayAddress);
|
|
5158
|
+
const agentExpiryTitle = getAgentExpiryTitle({
|
|
5159
|
+
isAgent: !!wallet.isAgent,
|
|
5160
|
+
agentExpiresAt: wallet.agentExpiresAt
|
|
5161
|
+
});
|
|
5162
|
+
return /* @__PURE__ */ jsx12(
|
|
3717
5163
|
WalletRow2,
|
|
3718
5164
|
{
|
|
3719
5165
|
depth,
|
|
3720
5166
|
isSelected,
|
|
3721
5167
|
label,
|
|
5168
|
+
walletType: getWalletTypeMeta2(wallet),
|
|
3722
5169
|
compactAddress,
|
|
3723
5170
|
onSelect: () => {
|
|
3724
5171
|
selectWallet(wallet.id);
|
|
@@ -3728,15 +5175,20 @@ function WalletSelectorDropdown({
|
|
|
3728
5175
|
onShowPortfolio(wallet);
|
|
3729
5176
|
onClose();
|
|
3730
5177
|
} : void 0,
|
|
3731
|
-
onCopy: () => handleCopyAddress(
|
|
5178
|
+
onCopy: () => handleCopyAddress(displayAddress),
|
|
5179
|
+
agentExpiryTitle,
|
|
5180
|
+
onRenewAgentWallet: wallet.isAgent && onRenewAgentWallet ? () => {
|
|
5181
|
+
onRenewAgentWallet(wallet);
|
|
5182
|
+
onClose();
|
|
5183
|
+
} : void 0,
|
|
3732
5184
|
colors
|
|
3733
5185
|
},
|
|
3734
5186
|
wallet.id
|
|
3735
5187
|
);
|
|
3736
5188
|
};
|
|
3737
|
-
return /* @__PURE__ */
|
|
3738
|
-
/* @__PURE__ */
|
|
3739
|
-
|
|
5189
|
+
return /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
5190
|
+
/* @__PURE__ */ jsx12(AnimatePresence7, { children: isOpen && /* @__PURE__ */ jsxs11(
|
|
5191
|
+
motion7.div,
|
|
3740
5192
|
{
|
|
3741
5193
|
style: { ...rootStyle, background: backgroundColor },
|
|
3742
5194
|
initial: { opacity: 0, scale: 0.95 },
|
|
@@ -3744,7 +5196,7 @@ function WalletSelectorDropdown({
|
|
|
3744
5196
|
exit: { opacity: 0, scale: 0.95 },
|
|
3745
5197
|
transition: { duration: 0.15, ease: "easeOut" },
|
|
3746
5198
|
children: [
|
|
3747
|
-
/* @__PURE__ */
|
|
5199
|
+
/* @__PURE__ */ jsxs11(
|
|
3748
5200
|
"button",
|
|
3749
5201
|
{
|
|
3750
5202
|
onClick: openProfile,
|
|
@@ -3767,7 +5219,7 @@ function WalletSelectorDropdown({
|
|
|
3767
5219
|
onMouseEnter: (e) => e.currentTarget.style.background = "rgba(255,255,255,0.06)",
|
|
3768
5220
|
onMouseLeave: (e) => e.currentTarget.style.background = "transparent",
|
|
3769
5221
|
children: [
|
|
3770
|
-
profilePic ? /* @__PURE__ */
|
|
5222
|
+
profilePic ? /* @__PURE__ */ jsxs11(
|
|
3771
5223
|
"div",
|
|
3772
5224
|
{
|
|
3773
5225
|
style: {
|
|
@@ -3777,7 +5229,7 @@ function WalletSelectorDropdown({
|
|
|
3777
5229
|
background: isVip ? "linear-gradient(to right, #fde047, #eab308, #ca8a04)" : "transparent"
|
|
3778
5230
|
},
|
|
3779
5231
|
children: [
|
|
3780
|
-
/* @__PURE__ */
|
|
5232
|
+
/* @__PURE__ */ jsx12(
|
|
3781
5233
|
"img",
|
|
3782
5234
|
{
|
|
3783
5235
|
src: profilePic,
|
|
@@ -3790,7 +5242,7 @@ function WalletSelectorDropdown({
|
|
|
3790
5242
|
}
|
|
3791
5243
|
}
|
|
3792
5244
|
),
|
|
3793
|
-
isVip && /* @__PURE__ */
|
|
5245
|
+
isVip && /* @__PURE__ */ jsx12(
|
|
3794
5246
|
Crown,
|
|
3795
5247
|
{
|
|
3796
5248
|
size: 12,
|
|
@@ -3806,7 +5258,7 @@ function WalletSelectorDropdown({
|
|
|
3806
5258
|
)
|
|
3807
5259
|
]
|
|
3808
5260
|
}
|
|
3809
|
-
) : authMethod === "eoa" ? /* @__PURE__ */
|
|
5261
|
+
) : authMethod === "eoa" ? /* @__PURE__ */ jsx12(
|
|
3810
5262
|
"div",
|
|
3811
5263
|
{
|
|
3812
5264
|
style: {
|
|
@@ -3820,9 +5272,9 @@ function WalletSelectorDropdown({
|
|
|
3820
5272
|
justifyContent: "center",
|
|
3821
5273
|
flexShrink: 0
|
|
3822
5274
|
},
|
|
3823
|
-
children: /* @__PURE__ */
|
|
5275
|
+
children: /* @__PURE__ */ jsx12(Wallet, { size: 14, color: colors.accentText })
|
|
3824
5276
|
}
|
|
3825
|
-
) : /* @__PURE__ */
|
|
5277
|
+
) : /* @__PURE__ */ jsxs11(
|
|
3826
5278
|
"div",
|
|
3827
5279
|
{
|
|
3828
5280
|
style: {
|
|
@@ -3841,7 +5293,7 @@ function WalletSelectorDropdown({
|
|
|
3841
5293
|
},
|
|
3842
5294
|
children: [
|
|
3843
5295
|
displayName.charAt(0),
|
|
3844
|
-
isVip && /* @__PURE__ */
|
|
5296
|
+
isVip && /* @__PURE__ */ jsx12(
|
|
3845
5297
|
Crown,
|
|
3846
5298
|
{
|
|
3847
5299
|
size: 12,
|
|
@@ -3858,8 +5310,8 @@ function WalletSelectorDropdown({
|
|
|
3858
5310
|
]
|
|
3859
5311
|
}
|
|
3860
5312
|
),
|
|
3861
|
-
/* @__PURE__ */
|
|
3862
|
-
/* @__PURE__ */
|
|
5313
|
+
/* @__PURE__ */ jsx12("div", { style: { overflow: "hidden", flex: 1 }, children: /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
5314
|
+
/* @__PURE__ */ jsx12(
|
|
3863
5315
|
"p",
|
|
3864
5316
|
{
|
|
3865
5317
|
style: {
|
|
@@ -3874,7 +5326,7 @@ function WalletSelectorDropdown({
|
|
|
3874
5326
|
children: displayName
|
|
3875
5327
|
}
|
|
3876
5328
|
),
|
|
3877
|
-
hfunScore > 0 && /* @__PURE__ */
|
|
5329
|
+
hfunScore > 0 && /* @__PURE__ */ jsxs11(
|
|
3878
5330
|
"span",
|
|
3879
5331
|
{
|
|
3880
5332
|
style: {
|
|
@@ -3889,7 +5341,7 @@ function WalletSelectorDropdown({
|
|
|
3889
5341
|
borderRadius: 4
|
|
3890
5342
|
},
|
|
3891
5343
|
children: [
|
|
3892
|
-
/* @__PURE__ */
|
|
5344
|
+
/* @__PURE__ */ jsx12(Star, { size: 10, color: "#eab308", fill: "#eab308" }),
|
|
3893
5345
|
hfunScore.toFixed(0)
|
|
3894
5346
|
]
|
|
3895
5347
|
}
|
|
@@ -3898,9 +5350,9 @@ function WalletSelectorDropdown({
|
|
|
3898
5350
|
]
|
|
3899
5351
|
}
|
|
3900
5352
|
),
|
|
3901
|
-
/* @__PURE__ */
|
|
3902
|
-
/* @__PURE__ */
|
|
3903
|
-
/* @__PURE__ */
|
|
5353
|
+
/* @__PURE__ */ jsxs11("div", { style: { borderBottom: sectionBorder }, children: [
|
|
5354
|
+
/* @__PURE__ */ jsx12("div", { style: sectionHeaderStyle, children: "Wallets" }),
|
|
5355
|
+
/* @__PURE__ */ jsx12(
|
|
3904
5356
|
"div",
|
|
3905
5357
|
{
|
|
3906
5358
|
style: {
|
|
@@ -3915,8 +5367,8 @@ function WalletSelectorDropdown({
|
|
|
3915
5367
|
const isSelectedGroup = entry.items.some(
|
|
3916
5368
|
(item) => item.wallet.id === selectedWalletId
|
|
3917
5369
|
);
|
|
3918
|
-
return /* @__PURE__ */
|
|
3919
|
-
/* @__PURE__ */
|
|
5370
|
+
return /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
5371
|
+
/* @__PURE__ */ jsxs11(
|
|
3920
5372
|
"div",
|
|
3921
5373
|
{
|
|
3922
5374
|
style: {
|
|
@@ -3931,8 +5383,8 @@ function WalletSelectorDropdown({
|
|
|
3931
5383
|
color: isSelectedGroup ? "#e5e7eb" : "#6b7280"
|
|
3932
5384
|
},
|
|
3933
5385
|
children: [
|
|
3934
|
-
/* @__PURE__ */
|
|
3935
|
-
/* @__PURE__ */
|
|
5386
|
+
/* @__PURE__ */ jsx12(Folder, { size: 12, style: { flexShrink: 0 } }),
|
|
5387
|
+
/* @__PURE__ */ jsx12(
|
|
3936
5388
|
"span",
|
|
3937
5389
|
{
|
|
3938
5390
|
style: {
|
|
@@ -3945,7 +5397,7 @@ function WalletSelectorDropdown({
|
|
|
3945
5397
|
children: entry.path
|
|
3946
5398
|
}
|
|
3947
5399
|
),
|
|
3948
|
-
/* @__PURE__ */
|
|
5400
|
+
/* @__PURE__ */ jsx12(
|
|
3949
5401
|
"span",
|
|
3950
5402
|
{
|
|
3951
5403
|
style: {
|
|
@@ -3964,7 +5416,7 @@ function WalletSelectorDropdown({
|
|
|
3964
5416
|
})
|
|
3965
5417
|
}
|
|
3966
5418
|
),
|
|
3967
|
-
authMethod !== "eoa" && onAddWallet && /* @__PURE__ */
|
|
5419
|
+
authMethod !== "eoa" && onAddWallet && /* @__PURE__ */ jsxs11(
|
|
3968
5420
|
"button",
|
|
3969
5421
|
{
|
|
3970
5422
|
onClick: () => {
|
|
@@ -3988,26 +5440,36 @@ function WalletSelectorDropdown({
|
|
|
3988
5440
|
onMouseEnter: (e) => e.currentTarget.style.background = "rgba(255,255,255,0.06)",
|
|
3989
5441
|
onMouseLeave: (e) => e.currentTarget.style.background = "transparent",
|
|
3990
5442
|
children: [
|
|
3991
|
-
/* @__PURE__ */
|
|
5443
|
+
/* @__PURE__ */ jsx12(Plus, { size: 14 }),
|
|
3992
5444
|
"Add Wallet"
|
|
3993
5445
|
]
|
|
3994
5446
|
}
|
|
3995
5447
|
)
|
|
3996
5448
|
] }),
|
|
3997
|
-
/* @__PURE__ */
|
|
3998
|
-
/* @__PURE__ */
|
|
5449
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
5450
|
+
/* @__PURE__ */ jsx12(
|
|
3999
5451
|
FooterBtn,
|
|
4000
5452
|
{
|
|
4001
5453
|
onClick: openProfile,
|
|
4002
|
-
icon: /* @__PURE__ */
|
|
5454
|
+
icon: /* @__PURE__ */ jsx12(User, { size: 14 }),
|
|
4003
5455
|
label: "Profile & Settings"
|
|
4004
5456
|
}
|
|
4005
5457
|
),
|
|
4006
|
-
/* @__PURE__ */
|
|
5458
|
+
extraFooterItems?.map((item) => /* @__PURE__ */ jsx12(
|
|
5459
|
+
FooterBtn,
|
|
5460
|
+
{
|
|
5461
|
+
onClick: item.onClick,
|
|
5462
|
+
icon: item.icon,
|
|
5463
|
+
label: item.label,
|
|
5464
|
+
hoverColor: item.hoverColor
|
|
5465
|
+
},
|
|
5466
|
+
item.key
|
|
5467
|
+
)),
|
|
5468
|
+
/* @__PURE__ */ jsx12(
|
|
4007
5469
|
FooterBtn,
|
|
4008
5470
|
{
|
|
4009
5471
|
onClick: handleLogout,
|
|
4010
|
-
icon: /* @__PURE__ */
|
|
5472
|
+
icon: /* @__PURE__ */ jsx12(LogOut, { size: 14 }),
|
|
4011
5473
|
label: "Logout",
|
|
4012
5474
|
hoverColor: "#ef4444"
|
|
4013
5475
|
}
|
|
@@ -4016,7 +5478,7 @@ function WalletSelectorDropdown({
|
|
|
4016
5478
|
]
|
|
4017
5479
|
}
|
|
4018
5480
|
) }),
|
|
4019
|
-
/* @__PURE__ */
|
|
5481
|
+
/* @__PURE__ */ jsx12(
|
|
4020
5482
|
UserProfileModal,
|
|
4021
5483
|
{
|
|
4022
5484
|
isOpen: profileOpen,
|
|
@@ -4030,6 +5492,7 @@ function WalletSelectorDropdown({
|
|
|
4030
5492
|
principalColors,
|
|
4031
5493
|
onWalletDeleted,
|
|
4032
5494
|
onWalletRenamed,
|
|
5495
|
+
onRenewAgentWallet,
|
|
4033
5496
|
onShowPortfolio: onShowPortfolio ? (wallet) => {
|
|
4034
5497
|
onShowPortfolio(wallet);
|
|
4035
5498
|
setProfileOpen(false);
|
|
@@ -4045,7 +5508,7 @@ function FooterBtn({
|
|
|
4045
5508
|
label,
|
|
4046
5509
|
hoverColor = "#fff"
|
|
4047
5510
|
}) {
|
|
4048
|
-
return /* @__PURE__ */
|
|
5511
|
+
return /* @__PURE__ */ jsxs11(
|
|
4049
5512
|
"button",
|
|
4050
5513
|
{
|
|
4051
5514
|
onClick,
|
|
@@ -4069,13 +5532,19 @@ function WalletRow2({
|
|
|
4069
5532
|
depth,
|
|
4070
5533
|
isSelected,
|
|
4071
5534
|
label,
|
|
5535
|
+
walletType,
|
|
4072
5536
|
compactAddress,
|
|
4073
5537
|
onSelect,
|
|
4074
5538
|
onShowPortfolio,
|
|
4075
5539
|
onCopy,
|
|
5540
|
+
agentExpiryTitle,
|
|
5541
|
+
onRenewAgentWallet,
|
|
4076
5542
|
colors
|
|
4077
5543
|
}) {
|
|
4078
|
-
|
|
5544
|
+
const isAgentExpired = !!agentExpiryTitle;
|
|
5545
|
+
const walletTextColor = isAgentExpired ? EXPIRED_AGENT_COLOR : "#d1d5db";
|
|
5546
|
+
const mutedTextColor = isAgentExpired ? "rgba(245,158,11,0.78)" : "#6b7280";
|
|
5547
|
+
return /* @__PURE__ */ jsxs11(
|
|
4079
5548
|
"div",
|
|
4080
5549
|
{
|
|
4081
5550
|
style: {
|
|
@@ -4085,7 +5554,7 @@ function WalletRow2({
|
|
|
4085
5554
|
paddingTop: 6,
|
|
4086
5555
|
paddingBottom: 6,
|
|
4087
5556
|
fontSize: 14,
|
|
4088
|
-
color:
|
|
5557
|
+
color: walletTextColor,
|
|
4089
5558
|
display: "flex",
|
|
4090
5559
|
alignItems: "center",
|
|
4091
5560
|
background: isSelected ? "rgba(255,255,255,0.06)" : "transparent",
|
|
@@ -4102,7 +5571,7 @@ function WalletRow2({
|
|
|
4102
5571
|
if (actions) actions.style.opacity = "0";
|
|
4103
5572
|
},
|
|
4104
5573
|
children: [
|
|
4105
|
-
/* @__PURE__ */
|
|
5574
|
+
/* @__PURE__ */ jsxs11(
|
|
4106
5575
|
"button",
|
|
4107
5576
|
{
|
|
4108
5577
|
onClick: onSelect,
|
|
@@ -4119,50 +5588,74 @@ function WalletRow2({
|
|
|
4119
5588
|
cursor: "pointer",
|
|
4120
5589
|
padding: 0
|
|
4121
5590
|
},
|
|
4122
|
-
children:
|
|
4123
|
-
/* @__PURE__ */
|
|
5591
|
+
children: [
|
|
5592
|
+
/* @__PURE__ */ jsx12(
|
|
4124
5593
|
"span",
|
|
4125
5594
|
{
|
|
5595
|
+
title: walletType.label,
|
|
5596
|
+
"aria-label": walletType.label,
|
|
4126
5597
|
style: {
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
5598
|
+
display: "inline-flex",
|
|
5599
|
+
alignItems: "center",
|
|
5600
|
+
justifyContent: "center",
|
|
5601
|
+
flexShrink: 0,
|
|
5602
|
+
color: isAgentExpired ? walletTextColor : walletType.color
|
|
4132
5603
|
},
|
|
4133
|
-
children:
|
|
5604
|
+
children: walletType.icon
|
|
4134
5605
|
}
|
|
4135
5606
|
),
|
|
4136
|
-
/* @__PURE__ */
|
|
5607
|
+
label ? /* @__PURE__ */ jsxs11(Fragment9, { children: [
|
|
5608
|
+
/* @__PURE__ */ jsx12(
|
|
5609
|
+
"span",
|
|
5610
|
+
{
|
|
5611
|
+
style: {
|
|
5612
|
+
overflow: "hidden",
|
|
5613
|
+
textOverflow: "ellipsis",
|
|
5614
|
+
whiteSpace: "nowrap",
|
|
5615
|
+
color: isAgentExpired ? walletTextColor : isSelected ? "#fff" : void 0,
|
|
5616
|
+
fontWeight: isSelected ? 500 : void 0
|
|
5617
|
+
},
|
|
5618
|
+
children: label
|
|
5619
|
+
}
|
|
5620
|
+
),
|
|
5621
|
+
/* @__PURE__ */ jsxs11(
|
|
5622
|
+
"span",
|
|
5623
|
+
{
|
|
5624
|
+
style: {
|
|
5625
|
+
fontSize: 12,
|
|
5626
|
+
fontWeight: 400,
|
|
5627
|
+
flexShrink: 0,
|
|
5628
|
+
color: mutedTextColor
|
|
5629
|
+
},
|
|
5630
|
+
children: [
|
|
5631
|
+
"(",
|
|
5632
|
+
compactAddress,
|
|
5633
|
+
")"
|
|
5634
|
+
]
|
|
5635
|
+
}
|
|
5636
|
+
)
|
|
5637
|
+
] }) : /* @__PURE__ */ jsx12(
|
|
4137
5638
|
"span",
|
|
4138
5639
|
{
|
|
4139
5640
|
style: {
|
|
4140
5641
|
fontSize: 12,
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
color: "#6b7280"
|
|
5642
|
+
color: isAgentExpired ? walletTextColor : isSelected ? "#fff" : "#9ca3af",
|
|
5643
|
+
fontWeight: isSelected ? 500 : void 0
|
|
4144
5644
|
},
|
|
4145
|
-
children:
|
|
4146
|
-
"(",
|
|
4147
|
-
compactAddress,
|
|
4148
|
-
")"
|
|
4149
|
-
]
|
|
5645
|
+
children: compactAddress
|
|
4150
5646
|
}
|
|
4151
5647
|
)
|
|
4152
|
-
]
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
children: compactAddress
|
|
4161
|
-
}
|
|
4162
|
-
)
|
|
5648
|
+
]
|
|
5649
|
+
}
|
|
5650
|
+
),
|
|
5651
|
+
agentExpiryTitle && /* @__PURE__ */ jsx12(
|
|
5652
|
+
AgentExpiryWarningIcon,
|
|
5653
|
+
{
|
|
5654
|
+
message: agentExpiryTitle,
|
|
5655
|
+
onClick: onRenewAgentWallet
|
|
4163
5656
|
}
|
|
4164
5657
|
),
|
|
4165
|
-
/* @__PURE__ */
|
|
5658
|
+
/* @__PURE__ */ jsxs11(
|
|
4166
5659
|
"div",
|
|
4167
5660
|
{
|
|
4168
5661
|
"data-row-actions": true,
|
|
@@ -4173,7 +5666,19 @@ function WalletRow2({
|
|
|
4173
5666
|
transition: "opacity 120ms"
|
|
4174
5667
|
},
|
|
4175
5668
|
children: [
|
|
4176
|
-
|
|
5669
|
+
onRenewAgentWallet && /* @__PURE__ */ jsx12(
|
|
5670
|
+
RowIconBtn,
|
|
5671
|
+
{
|
|
5672
|
+
title: "Renew agent wallet",
|
|
5673
|
+
hoverColor: isAgentExpired ? EXPIRED_AGENT_COLOR : colors.accent,
|
|
5674
|
+
onClick: (e) => {
|
|
5675
|
+
e.stopPropagation();
|
|
5676
|
+
onRenewAgentWallet();
|
|
5677
|
+
},
|
|
5678
|
+
children: /* @__PURE__ */ jsx12(RefreshCw, { size: 12 })
|
|
5679
|
+
}
|
|
5680
|
+
),
|
|
5681
|
+
onShowPortfolio && /* @__PURE__ */ jsx12(
|
|
4177
5682
|
RowIconBtn,
|
|
4178
5683
|
{
|
|
4179
5684
|
title: "View portfolio",
|
|
@@ -4182,10 +5687,10 @@ function WalletRow2({
|
|
|
4182
5687
|
e.stopPropagation();
|
|
4183
5688
|
onShowPortfolio();
|
|
4184
5689
|
},
|
|
4185
|
-
children: /* @__PURE__ */
|
|
5690
|
+
children: /* @__PURE__ */ jsx12(LayoutDashboard, { size: 12 })
|
|
4186
5691
|
}
|
|
4187
5692
|
),
|
|
4188
|
-
/* @__PURE__ */
|
|
5693
|
+
/* @__PURE__ */ jsx12(
|
|
4189
5694
|
RowIconBtn,
|
|
4190
5695
|
{
|
|
4191
5696
|
title: "Copy address",
|
|
@@ -4194,7 +5699,7 @@ function WalletRow2({
|
|
|
4194
5699
|
e.stopPropagation();
|
|
4195
5700
|
onCopy();
|
|
4196
5701
|
},
|
|
4197
|
-
children: /* @__PURE__ */
|
|
5702
|
+
children: /* @__PURE__ */ jsx12(Copy, { size: 12 })
|
|
4198
5703
|
}
|
|
4199
5704
|
)
|
|
4200
5705
|
]
|
|
@@ -4210,7 +5715,7 @@ function RowIconBtn({
|
|
|
4210
5715
|
onClick,
|
|
4211
5716
|
hoverColor = profileColors.text
|
|
4212
5717
|
}) {
|
|
4213
|
-
return /* @__PURE__ */
|
|
5718
|
+
return /* @__PURE__ */ jsx12(
|
|
4214
5719
|
"button",
|
|
4215
5720
|
{
|
|
4216
5721
|
onClick,
|
|
@@ -4245,16 +5750,21 @@ function createEoaSigner(signTypedDataAsync, chainId, options = {}) {
|
|
|
4245
5750
|
};
|
|
4246
5751
|
}
|
|
4247
5752
|
export {
|
|
5753
|
+
AGENT_APPROVAL_DURATION_OPTIONS,
|
|
5754
|
+
AddWalletModal,
|
|
5755
|
+
DEFAULT_AGENT_APPROVAL_DURATION_MS,
|
|
4248
5756
|
DeleteWalletModal,
|
|
4249
5757
|
GrpcExchangeTransport,
|
|
4250
5758
|
HypurrConnectProvider,
|
|
4251
5759
|
LoginModal,
|
|
4252
5760
|
PrivateKeySigner,
|
|
4253
5761
|
RenameWalletModal,
|
|
5762
|
+
RenewAgentModal,
|
|
4254
5763
|
UserProfileModal,
|
|
4255
5764
|
WalletSelectorDropdown,
|
|
4256
5765
|
createEoaSigner,
|
|
4257
5766
|
createStaticClient,
|
|
5767
|
+
createTelegramAgentApprovalName,
|
|
4258
5768
|
createTelegramClient,
|
|
4259
5769
|
useHypurrConnect
|
|
4260
5770
|
};
|