@latchprotocol/widgets 0.1.0
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/LICENSE +21 -0
- package/README.md +649 -0
- package/dist/adapters/binDistribution.d.ts +19 -0
- package/dist/adapters/binDistribution.d.ts.map +1 -0
- package/dist/adapters/protocol.d.ts +409 -0
- package/dist/adapters/protocol.d.ts.map +1 -0
- package/dist/adapters/sale.d.ts +142 -0
- package/dist/adapters/sale.d.ts.map +1 -0
- package/dist/adapters/viem.d.ts +89 -0
- package/dist/adapters/viem.d.ts.map +1 -0
- package/dist/callpath/constants.d.ts +218 -0
- package/dist/callpath/constants.d.ts.map +1 -0
- package/dist/callpath/launch.d.ts +1979 -0
- package/dist/callpath/launch.d.ts.map +1 -0
- package/dist/callpath/liquidity.d.ts +103 -0
- package/dist/callpath/liquidity.d.ts.map +1 -0
- package/dist/callpath/plan.d.ts +34 -0
- package/dist/callpath/plan.d.ts.map +1 -0
- package/dist/callpath/swap.d.ts +129 -0
- package/dist/callpath/swap.d.ts.map +1 -0
- package/dist/chunks/SwapWidget-DgyHAVc8.js +2404 -0
- package/dist/chunks/SwapWidget-DgyHAVc8.js.map +1 -0
- package/dist/chunks/scan-Dhu7f4Nl.js +2497 -0
- package/dist/chunks/scan-Dhu7f4Nl.js.map +1 -0
- package/dist/chunks/useLocker-D1c_NTk-.js +1613 -0
- package/dist/chunks/useLocker-D1c_NTk-.js.map +1 -0
- package/dist/components/LaunchWidget.d.ts +117 -0
- package/dist/components/LaunchWidget.d.ts.map +1 -0
- package/dist/components/LiquidityWidget.d.ts +33 -0
- package/dist/components/LiquidityWidget.d.ts.map +1 -0
- package/dist/components/LockerWidget.d.ts +51 -0
- package/dist/components/LockerWidget.d.ts.map +1 -0
- package/dist/components/LocksWidgets.d.ts +61 -0
- package/dist/components/LocksWidgets.d.ts.map +1 -0
- package/dist/components/SwapWidget.d.ts +165 -0
- package/dist/components/SwapWidget.d.ts.map +1 -0
- package/dist/components/TokenTrustPanel.d.ts +32 -0
- package/dist/components/TokenTrustPanel.d.ts.map +1 -0
- package/dist/components/lockCharts.d.ts +29 -0
- package/dist/components/lockCharts.d.ts.map +1 -0
- package/dist/components/portal.d.ts +10 -0
- package/dist/components/portal.d.ts.map +1 -0
- package/dist/components/primitives.d.ts +139 -0
- package/dist/components/primitives.d.ts.map +1 -0
- package/dist/components/swap/SwapSettings.d.ts +12 -0
- package/dist/components/swap/SwapSettings.d.ts.map +1 -0
- package/dist/components/swap/TokenSelect.d.ts +61 -0
- package/dist/components/swap/TokenSelect.d.ts.map +1 -0
- package/dist/components/swap/state.d.ts +208 -0
- package/dist/components/swap/state.d.ts.map +1 -0
- package/dist/config/chain.d.ts +163 -0
- package/dist/config/chain.d.ts.map +1 -0
- package/dist/config/integrator.d.ts +121 -0
- package/dist/config/integrator.d.ts.map +1 -0
- package/dist/context/WidgetProvider.d.ts +78 -0
- package/dist/context/WidgetProvider.d.ts.map +1 -0
- package/dist/core/clMath.d.ts +98 -0
- package/dist/core/clMath.d.ts.map +1 -0
- package/dist/core/errors.d.ts +18 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/format.d.ts +47 -0
- package/dist/core/format.d.ts.map +1 -0
- package/dist/core/liquidityGuards.d.ts +53 -0
- package/dist/core/liquidityGuards.d.ts.map +1 -0
- package/dist/core/liquidityRefresh.d.ts +35 -0
- package/dist/core/liquidityRefresh.d.ts.map +1 -0
- package/dist/core/math.d.ts +129 -0
- package/dist/core/math.d.ts.map +1 -0
- package/dist/core/pool.d.ts +33 -0
- package/dist/core/pool.d.ts.map +1 -0
- package/dist/core/tokenLists.d.ts +46 -0
- package/dist/core/tokenLists.d.ts.map +1 -0
- package/dist/embed/iframe.d.ts +185 -0
- package/dist/embed/iframe.d.ts.map +1 -0
- package/dist/embed/lockBadge.d.ts +55 -0
- package/dist/embed/lockBadge.d.ts.map +1 -0
- package/dist/embed/webComponent.d.ts +83 -0
- package/dist/embed/webComponent.d.ts.map +1 -0
- package/dist/embed.d.ts +25 -0
- package/dist/embed.d.ts.map +1 -0
- package/dist/embed.js +543 -0
- package/dist/embed.js.map +1 -0
- package/dist/headless.d.ts +60 -0
- package/dist/headless.d.ts.map +1 -0
- package/dist/headless.js +223 -0
- package/dist/headless.js.map +1 -0
- package/dist/hooks/useAsyncResource.d.ts +38 -0
- package/dist/hooks/useAsyncResource.d.ts.map +1 -0
- package/dist/hooks/useLaunch.d.ts +140 -0
- package/dist/hooks/useLaunch.d.ts.map +1 -0
- package/dist/hooks/useLiquidity.d.ts +91 -0
- package/dist/hooks/useLiquidity.d.ts.map +1 -0
- package/dist/hooks/useLocker.d.ts +77 -0
- package/dist/hooks/useLocker.d.ts.map +1 -0
- package/dist/hooks/useLocks.d.ts +33 -0
- package/dist/hooks/useLocks.d.ts.map +1 -0
- package/dist/hooks/useSwapExecute.d.ts +46 -0
- package/dist/hooks/useSwapExecute.d.ts.map +1 -0
- package/dist/hooks/useSwapQuote.d.ts +51 -0
- package/dist/hooks/useSwapQuote.d.ts.map +1 -0
- package/dist/hooks/useTokenLists.d.ts +26 -0
- package/dist/hooks/useTokenLists.d.ts.map +1 -0
- package/dist/hooks/useTokenTrust.d.ts +40 -0
- package/dist/hooks/useTokenTrust.d.ts.map +1 -0
- package/dist/hooks/useTokens.d.ts +15 -0
- package/dist/hooks/useTokens.d.ts.map +1 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1052 -0
- package/dist/index.js.map +1 -0
- package/dist/latch-embed.d.ts +19 -0
- package/dist/latch-embed.d.ts.map +1 -0
- package/dist/latch-embed.js +950 -0
- package/dist/latch-embed.js.map +1 -0
- package/dist/latch-embed.mjs +13162 -0
- package/dist/latch-embed.mjs.map +1 -0
- package/dist/locker/model.d.ts +73 -0
- package/dist/locker/model.d.ts.map +1 -0
- package/dist/locks/embedModel.d.ts +22 -0
- package/dist/locks/embedModel.d.ts.map +1 -0
- package/dist/locks/fetch.d.ts +60 -0
- package/dist/locks/fetch.d.ts.map +1 -0
- package/dist/locks/model.d.ts +143 -0
- package/dist/locks/model.d.ts.map +1 -0
- package/dist/locks/scan.d.ts +25 -0
- package/dist/locks/scan.d.ts.map +1 -0
- package/dist/styles/css.d.ts +32 -0
- package/dist/styles/css.d.ts.map +1 -0
- package/dist/styles.css +895 -0
- package/dist/trust/model.d.ts +48 -0
- package/dist/trust/model.d.ts.map +1 -0
- package/package.json +102 -0
|
@@ -0,0 +1,2404 @@
|
|
|
1
|
+
import { jsx as e, jsxs as l, Fragment as X } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as ht, useContext as ut, useId as ge, useMemo as A, useState as L, useEffect as I, useCallback as V, forwardRef as pt, useReducer as mt, useRef as oe, useImperativeHandle as gt } from "react";
|
|
3
|
+
import { at as q, aj as Je, bX as le, aS as bt, aA as Q, br as H, bK as ft, bl as Se, bJ as vt, bH as xt, bC as xe, b4 as se, bU as Le, bI as kt, a2 as wt, aB as Pe, az as W, au as $e, bN as yt, a7 as _t, bM as Nt, ah as Ct, ab as Tt, b3 as zt, bE as St, bD as Lt, ak as qe, bO as Pt, b_ as $t, bh as qt, bQ as It, bu as ze, z as Ve, _ as Rt, j as At, aK as Bt, bm as Ft, bV as Mt, bW as Ot, ad as Et, a_ as Qe, bt as jt, aM as Dt, b0 as Ut, bT as Wt, bS as Vt, bb as Qt, a6 as Ht, bo as Yt, an as Kt, bc as Gt, b2 as Xt, aZ as Jt, bn as He, a$ as Zt } from "./scan-Dhu7f4Nl.js";
|
|
4
|
+
import { humanDuration as ea, isDynamicLPFee as ta } from "@latchprotocol/sdk";
|
|
5
|
+
import { formatUnits as Ze } from "viem";
|
|
6
|
+
import * as me from "@radix-ui/react-popover";
|
|
7
|
+
import * as ae from "@radix-ui/react-dialog";
|
|
8
|
+
const et = ht(null), aa = et.Provider;
|
|
9
|
+
function tt() {
|
|
10
|
+
return ut(et) ?? void 0;
|
|
11
|
+
}
|
|
12
|
+
const la = `
|
|
13
|
+
.latch-widget {
|
|
14
|
+
/* Palette */
|
|
15
|
+
--latch-bg: #ffffff;
|
|
16
|
+
--latch-bg-elevated: #f6f7f9;
|
|
17
|
+
--latch-bg-sunken: #eceef2;
|
|
18
|
+
--latch-border: #dfe3e8;
|
|
19
|
+
--latch-border-strong: #c4cad3;
|
|
20
|
+
--latch-text: #10131a;
|
|
21
|
+
--latch-text-muted: #5c6472;
|
|
22
|
+
--latch-text-inverted: #ffffff;
|
|
23
|
+
--latch-accent: #3b5bdb;
|
|
24
|
+
--latch-accent-hover: #2f49b2;
|
|
25
|
+
--latch-accent-text: #ffffff;
|
|
26
|
+
--latch-success: #157347;
|
|
27
|
+
--latch-warning: #9a6700;
|
|
28
|
+
--latch-warning-bg: #fff8e1;
|
|
29
|
+
--latch-danger: #b42318;
|
|
30
|
+
--latch-danger-bg: #fef3f2;
|
|
31
|
+
--latch-focus: #3b5bdb;
|
|
32
|
+
/* The compact swap's Buy side: the CVD-safe "up" colour, with a dark label (6:1). */
|
|
33
|
+
--latch-buy: #1f9e89;
|
|
34
|
+
--latch-buy-hover: #23b39b;
|
|
35
|
+
--latch-buy-text: #04060c;
|
|
36
|
+
|
|
37
|
+
/* Shape and type */
|
|
38
|
+
--latch-radius: 14px;
|
|
39
|
+
--latch-radius-sm: 9px;
|
|
40
|
+
--latch-font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
41
|
+
--latch-font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
|
|
42
|
+
--latch-font-size: 14px;
|
|
43
|
+
--latch-font-size-sm: 12px;
|
|
44
|
+
--latch-font-size-lg: 22px;
|
|
45
|
+
--latch-gap: 12px;
|
|
46
|
+
--latch-padding: 16px;
|
|
47
|
+
--latch-control-height: 44px;
|
|
48
|
+
--latch-shadow: 0 1px 2px rgba(16, 19, 26, 0.06), 0 8px 24px rgba(16, 19, 26, 0.06);
|
|
49
|
+
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
gap: var(--latch-gap);
|
|
54
|
+
width: 100%;
|
|
55
|
+
min-width: 0;
|
|
56
|
+
max-width: 480px;
|
|
57
|
+
padding: var(--latch-padding);
|
|
58
|
+
background: var(--latch-bg);
|
|
59
|
+
color: var(--latch-text);
|
|
60
|
+
border: 1px solid var(--latch-border);
|
|
61
|
+
border-radius: var(--latch-radius);
|
|
62
|
+
box-shadow: var(--latch-shadow);
|
|
63
|
+
font-family: var(--latch-font);
|
|
64
|
+
font-size: var(--latch-font-size);
|
|
65
|
+
line-height: 1.45;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.latch-widget *,
|
|
69
|
+
.latch-widget *::before,
|
|
70
|
+
.latch-widget *::after {
|
|
71
|
+
box-sizing: inherit;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Text takes the WIDGET's ink, not the host page's. A host rule such as
|
|
75
|
+
\`h2 { color: var(--ink) }\` otherwise beats inheritance: a dark-themed widget
|
|
76
|
+
on a light page drew its title in the page's near-black on the widget's
|
|
77
|
+
near-black (1.1:1, axe, the locker embed 2026-09-26). Specificity (0,1,0)
|
|
78
|
+
beats any element selector; every widget class rule below comes later and
|
|
79
|
+
still sets its own colour. A host's own content in a slot is left alone. */
|
|
80
|
+
.latch-widget :where(h1, h2, h3, h4, h5, h6, p, label, legend, dt, dd, li, th, td, figcaption, caption):where(:not(.latch-slot *)) {
|
|
81
|
+
color: inherit;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.latch-widget[data-latch-theme="dark"] {
|
|
85
|
+
--latch-bg: #14161b;
|
|
86
|
+
--latch-bg-elevated: #1c1f26;
|
|
87
|
+
--latch-bg-sunken: #23262f;
|
|
88
|
+
--latch-border: #2b2f38;
|
|
89
|
+
--latch-border-strong: #3d4350;
|
|
90
|
+
--latch-text: #f2f4f8;
|
|
91
|
+
--latch-text-muted: #98a1b1;
|
|
92
|
+
--latch-text-inverted: #14161b;
|
|
93
|
+
--latch-accent: #6b8afd;
|
|
94
|
+
--latch-accent-hover: #849dff;
|
|
95
|
+
--latch-accent-text: #0b0d12;
|
|
96
|
+
--latch-success: #4ade80;
|
|
97
|
+
--latch-warning: #fbbf5c;
|
|
98
|
+
--latch-warning-bg: #33280f;
|
|
99
|
+
--latch-danger: #ff8a80;
|
|
100
|
+
--latch-danger-bg: #3a1a17;
|
|
101
|
+
--latch-focus: #849dff;
|
|
102
|
+
--latch-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@media (prefers-color-scheme: dark) {
|
|
106
|
+
.latch-widget[data-latch-theme="system"] {
|
|
107
|
+
--latch-bg: #14161b;
|
|
108
|
+
--latch-bg-elevated: #1c1f26;
|
|
109
|
+
--latch-bg-sunken: #23262f;
|
|
110
|
+
--latch-border: #2b2f38;
|
|
111
|
+
--latch-border-strong: #3d4350;
|
|
112
|
+
--latch-text: #f2f4f8;
|
|
113
|
+
--latch-text-muted: #98a1b1;
|
|
114
|
+
--latch-text-inverted: #14161b;
|
|
115
|
+
--latch-accent: #6b8afd;
|
|
116
|
+
--latch-accent-hover: #849dff;
|
|
117
|
+
--latch-accent-text: #0b0d12;
|
|
118
|
+
--latch-success: #4ade80;
|
|
119
|
+
--latch-warning: #fbbf5c;
|
|
120
|
+
--latch-warning-bg: #33280f;
|
|
121
|
+
--latch-danger: #ff8a80;
|
|
122
|
+
--latch-danger-bg: #3a1a17;
|
|
123
|
+
--latch-focus: #849dff;
|
|
124
|
+
--latch-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.latch-header {
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: baseline;
|
|
131
|
+
justify-content: space-between;
|
|
132
|
+
gap: 8px;
|
|
133
|
+
flex-wrap: wrap;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.latch-title {
|
|
137
|
+
margin: 0;
|
|
138
|
+
font-size: 16px;
|
|
139
|
+
font-weight: 650;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.latch-subtitle {
|
|
143
|
+
margin: 0;
|
|
144
|
+
color: var(--latch-text-muted);
|
|
145
|
+
font-size: var(--latch-font-size-sm);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.latch-mock-banner {
|
|
149
|
+
display: flex;
|
|
150
|
+
gap: 8px;
|
|
151
|
+
align-items: flex-start;
|
|
152
|
+
padding: 10px 12px;
|
|
153
|
+
border: 1px solid var(--latch-warning);
|
|
154
|
+
border-radius: var(--latch-radius-sm);
|
|
155
|
+
background: var(--latch-warning-bg);
|
|
156
|
+
color: var(--latch-warning);
|
|
157
|
+
font-size: var(--latch-font-size-sm);
|
|
158
|
+
font-weight: 600;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.latch-mock-banner span {
|
|
162
|
+
font-weight: 500;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.latch-field {
|
|
166
|
+
display: flex;
|
|
167
|
+
flex-direction: column;
|
|
168
|
+
gap: 6px;
|
|
169
|
+
padding: 12px;
|
|
170
|
+
background: var(--latch-bg-elevated);
|
|
171
|
+
border: 1px solid var(--latch-border);
|
|
172
|
+
border-radius: var(--latch-radius-sm);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.latch-field-row {
|
|
176
|
+
display: flex;
|
|
177
|
+
align-items: center;
|
|
178
|
+
gap: 8px;
|
|
179
|
+
flex-wrap: wrap;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.latch-label {
|
|
183
|
+
display: block;
|
|
184
|
+
color: var(--latch-text-muted);
|
|
185
|
+
font-size: var(--latch-font-size-sm);
|
|
186
|
+
font-weight: 600;
|
|
187
|
+
letter-spacing: 0.01em;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.latch-amount-input {
|
|
191
|
+
flex: 1 1 120px;
|
|
192
|
+
min-width: 0;
|
|
193
|
+
padding: 0;
|
|
194
|
+
border: 0;
|
|
195
|
+
background: transparent;
|
|
196
|
+
color: var(--latch-text);
|
|
197
|
+
font-family: var(--latch-font);
|
|
198
|
+
font-size: var(--latch-font-size-lg);
|
|
199
|
+
font-weight: 600;
|
|
200
|
+
line-height: 1.2;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.latch-amount-input::placeholder {
|
|
204
|
+
color: var(--latch-text-muted);
|
|
205
|
+
font-weight: 500;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.latch-amount-input:focus-visible,
|
|
209
|
+
.latch-select:focus-visible,
|
|
210
|
+
.latch-button:focus-visible,
|
|
211
|
+
.latch-icon-button:focus-visible,
|
|
212
|
+
.latch-slider:focus-visible,
|
|
213
|
+
.latch-chip:focus-visible {
|
|
214
|
+
outline: 2px solid var(--latch-focus);
|
|
215
|
+
outline-offset: 2px;
|
|
216
|
+
border-radius: 4px;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.latch-select {
|
|
220
|
+
flex: 0 1 auto;
|
|
221
|
+
max-width: 100%;
|
|
222
|
+
height: 34px;
|
|
223
|
+
padding: 0 8px;
|
|
224
|
+
background: var(--latch-bg);
|
|
225
|
+
color: var(--latch-text);
|
|
226
|
+
border: 1px solid var(--latch-border-strong);
|
|
227
|
+
border-radius: 999px;
|
|
228
|
+
font-family: inherit;
|
|
229
|
+
font-size: var(--latch-font-size);
|
|
230
|
+
font-weight: 600;
|
|
231
|
+
cursor: pointer;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.latch-meta {
|
|
235
|
+
display: flex;
|
|
236
|
+
justify-content: space-between;
|
|
237
|
+
gap: 8px;
|
|
238
|
+
color: var(--latch-text-muted);
|
|
239
|
+
font-size: var(--latch-font-size-sm);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.latch-meta-value {
|
|
243
|
+
font-variant-numeric: tabular-nums;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.latch-switch-row {
|
|
247
|
+
display: flex;
|
|
248
|
+
justify-content: center;
|
|
249
|
+
margin: -6px 0;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.latch-icon-button {
|
|
253
|
+
display: inline-flex;
|
|
254
|
+
align-items: center;
|
|
255
|
+
justify-content: center;
|
|
256
|
+
width: 32px;
|
|
257
|
+
height: 32px;
|
|
258
|
+
padding: 0;
|
|
259
|
+
background: var(--latch-bg);
|
|
260
|
+
color: var(--latch-text);
|
|
261
|
+
border: 1px solid var(--latch-border-strong);
|
|
262
|
+
border-radius: 999px;
|
|
263
|
+
cursor: pointer;
|
|
264
|
+
font-size: 15px;
|
|
265
|
+
line-height: 1;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.latch-icon-button:hover {
|
|
269
|
+
background: var(--latch-bg-sunken);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.latch-summary {
|
|
273
|
+
display: flex;
|
|
274
|
+
flex-direction: column;
|
|
275
|
+
gap: 6px;
|
|
276
|
+
padding: 12px;
|
|
277
|
+
background: var(--latch-bg-sunken);
|
|
278
|
+
border-radius: var(--latch-radius-sm);
|
|
279
|
+
font-size: var(--latch-font-size-sm);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.latch-summary dl {
|
|
283
|
+
display: flex;
|
|
284
|
+
flex-direction: column;
|
|
285
|
+
gap: 6px;
|
|
286
|
+
margin: 0;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.latch-summary-row {
|
|
290
|
+
display: flex;
|
|
291
|
+
align-items: baseline;
|
|
292
|
+
justify-content: space-between;
|
|
293
|
+
gap: 10px;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.latch-summary-row dt {
|
|
297
|
+
color: var(--latch-text-muted);
|
|
298
|
+
min-width: 0;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.latch-summary-row dd {
|
|
302
|
+
margin: 0;
|
|
303
|
+
text-align: right;
|
|
304
|
+
font-variant-numeric: tabular-nums;
|
|
305
|
+
overflow-wrap: anywhere;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.latch-summary-row[data-latch-emphasis="fee"] dd {
|
|
309
|
+
color: var(--latch-accent);
|
|
310
|
+
font-weight: 650;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.latch-summary-row[data-latch-severity="high"] dd,
|
|
314
|
+
.latch-summary-row[data-latch-severity="severe"] dd {
|
|
315
|
+
color: var(--latch-danger);
|
|
316
|
+
font-weight: 650;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.latch-route {
|
|
320
|
+
display: flex;
|
|
321
|
+
flex-wrap: wrap;
|
|
322
|
+
align-items: center;
|
|
323
|
+
gap: 4px;
|
|
324
|
+
font-size: var(--latch-font-size-sm);
|
|
325
|
+
color: var(--latch-text-muted);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.latch-route-token {
|
|
329
|
+
padding: 2px 8px;
|
|
330
|
+
background: var(--latch-bg);
|
|
331
|
+
border: 1px solid var(--latch-border);
|
|
332
|
+
border-radius: 999px;
|
|
333
|
+
color: var(--latch-text);
|
|
334
|
+
font-weight: 600;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.latch-button {
|
|
338
|
+
display: inline-flex;
|
|
339
|
+
align-items: center;
|
|
340
|
+
justify-content: center;
|
|
341
|
+
gap: 8px;
|
|
342
|
+
width: 100%;
|
|
343
|
+
min-height: var(--latch-control-height);
|
|
344
|
+
padding: 0 16px;
|
|
345
|
+
background: var(--latch-accent);
|
|
346
|
+
color: var(--latch-accent-text);
|
|
347
|
+
border: 1px solid transparent;
|
|
348
|
+
border-radius: var(--latch-radius-sm);
|
|
349
|
+
font-family: inherit;
|
|
350
|
+
font-size: 15px;
|
|
351
|
+
font-weight: 650;
|
|
352
|
+
cursor: pointer;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.latch-button:hover:not(:disabled) {
|
|
356
|
+
background: var(--latch-accent-hover);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.latch-button:disabled {
|
|
360
|
+
opacity: 0.55;
|
|
361
|
+
cursor: not-allowed;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.latch-button[data-latch-variant="secondary"] {
|
|
365
|
+
background: var(--latch-bg-elevated);
|
|
366
|
+
color: var(--latch-text);
|
|
367
|
+
border-color: var(--latch-border-strong);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.latch-button[data-latch-variant="danger"] {
|
|
371
|
+
background: var(--latch-danger);
|
|
372
|
+
color: var(--latch-text-inverted);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.latch-status {
|
|
376
|
+
min-height: 18px;
|
|
377
|
+
margin: 0;
|
|
378
|
+
font-size: var(--latch-font-size-sm);
|
|
379
|
+
color: var(--latch-text-muted);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.latch-status[data-latch-tone="error"] {
|
|
383
|
+
color: var(--latch-danger);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.latch-status[data-latch-tone="success"] {
|
|
387
|
+
color: var(--latch-success);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.latch-error {
|
|
391
|
+
padding: 10px 12px;
|
|
392
|
+
background: var(--latch-danger-bg);
|
|
393
|
+
border: 1px solid var(--latch-danger);
|
|
394
|
+
border-radius: var(--latch-radius-sm);
|
|
395
|
+
color: var(--latch-danger);
|
|
396
|
+
font-size: var(--latch-font-size-sm);
|
|
397
|
+
overflow-wrap: anywhere;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.latch-tabs {
|
|
401
|
+
display: flex;
|
|
402
|
+
gap: 4px;
|
|
403
|
+
padding: 3px;
|
|
404
|
+
background: var(--latch-bg-sunken);
|
|
405
|
+
border-radius: 999px;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.latch-chip {
|
|
409
|
+
flex: 1 1 0;
|
|
410
|
+
min-width: 0;
|
|
411
|
+
padding: 7px 10px;
|
|
412
|
+
background: transparent;
|
|
413
|
+
color: var(--latch-text-muted);
|
|
414
|
+
border: 0;
|
|
415
|
+
border-radius: 999px;
|
|
416
|
+
font-family: inherit;
|
|
417
|
+
font-size: var(--latch-font-size-sm);
|
|
418
|
+
font-weight: 650;
|
|
419
|
+
cursor: pointer;
|
|
420
|
+
white-space: nowrap;
|
|
421
|
+
overflow: hidden;
|
|
422
|
+
text-overflow: ellipsis;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.latch-chip[aria-selected="true"],
|
|
426
|
+
.latch-chip[aria-pressed="true"] {
|
|
427
|
+
background: var(--latch-bg);
|
|
428
|
+
color: var(--latch-text);
|
|
429
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.latch-progress {
|
|
433
|
+
height: 8px;
|
|
434
|
+
background: var(--latch-bg-sunken);
|
|
435
|
+
border-radius: 999px;
|
|
436
|
+
overflow: hidden;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
.latch-progress-fill {
|
|
440
|
+
height: 100%;
|
|
441
|
+
background: var(--latch-accent);
|
|
442
|
+
border-radius: 999px;
|
|
443
|
+
transition: width 200ms ease;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.latch-slider {
|
|
447
|
+
width: 100%;
|
|
448
|
+
accent-color: var(--latch-accent);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.latch-range-grid {
|
|
452
|
+
display: grid;
|
|
453
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
454
|
+
gap: 8px;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.latch-range-grid input {
|
|
458
|
+
width: 100%;
|
|
459
|
+
min-width: 0;
|
|
460
|
+
height: 36px;
|
|
461
|
+
padding: 0 10px;
|
|
462
|
+
background: var(--latch-bg);
|
|
463
|
+
color: var(--latch-text);
|
|
464
|
+
border: 1px solid var(--latch-border-strong);
|
|
465
|
+
border-radius: var(--latch-radius-sm);
|
|
466
|
+
font-family: var(--latch-font-mono);
|
|
467
|
+
font-size: var(--latch-font-size);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.latch-curve {
|
|
471
|
+
display: block;
|
|
472
|
+
width: 100%;
|
|
473
|
+
height: auto;
|
|
474
|
+
border-radius: var(--latch-radius-sm);
|
|
475
|
+
background: var(--latch-bg-sunken);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.latch-visually-hidden {
|
|
479
|
+
position: absolute;
|
|
480
|
+
width: 1px;
|
|
481
|
+
height: 1px;
|
|
482
|
+
margin: -1px;
|
|
483
|
+
padding: 0;
|
|
484
|
+
border: 0;
|
|
485
|
+
clip: rect(0 0 0 0);
|
|
486
|
+
clip-path: inset(50%);
|
|
487
|
+
overflow: hidden;
|
|
488
|
+
white-space: nowrap;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
.latch-footer {
|
|
492
|
+
display: flex;
|
|
493
|
+
justify-content: space-between;
|
|
494
|
+
gap: 8px;
|
|
495
|
+
color: var(--latch-text-muted);
|
|
496
|
+
font-size: 11px;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.latch-footer a {
|
|
500
|
+
color: inherit;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.latch-launch-legs {
|
|
504
|
+
display: grid;
|
|
505
|
+
gap: 16px;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.latch-empty {
|
|
509
|
+
margin: 0;
|
|
510
|
+
color: var(--latch-text-muted);
|
|
511
|
+
font-size: 13px;
|
|
512
|
+
line-height: 1.5;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
@media (max-width: 380px) {
|
|
516
|
+
.latch-widget {
|
|
517
|
+
--latch-padding: 12px;
|
|
518
|
+
--latch-font-size-lg: 20px;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.latch-range-grid {
|
|
522
|
+
grid-template-columns: minmax(0, 1fr);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
@media (prefers-reduced-motion: reduce) {
|
|
527
|
+
.latch-progress-fill {
|
|
528
|
+
transition: none;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/* ============================================================================
|
|
533
|
+
Swap surface (SwapWidget): panels, big inputs, token buttons, dialog,
|
|
534
|
+
popover, CTA, details. Every colour is a --latch-* token above.
|
|
535
|
+
============================================================================ */
|
|
536
|
+
|
|
537
|
+
.latch-swap { max-width: 480px; }
|
|
538
|
+
.latch-swap__form { display: flex; flex-direction: column; gap: 4px; }
|
|
539
|
+
|
|
540
|
+
.latch-panel {
|
|
541
|
+
background: var(--latch-bg-elevated);
|
|
542
|
+
border: 1px solid transparent;
|
|
543
|
+
border-radius: var(--latch-radius);
|
|
544
|
+
padding: 14px 16px 12px;
|
|
545
|
+
transition: border-color 120ms ease, background 120ms ease;
|
|
546
|
+
}
|
|
547
|
+
.latch-panel:focus-within { border-color: var(--latch-border-strong); background: var(--latch-bg); }
|
|
548
|
+
/* The amount field draws no outline of its own (it is the panel's big number), so the PANEL carries
|
|
549
|
+
the keyboard focus ring; the border-strong change alone was invisible on a dark theme (WCAG 2.4.7). */
|
|
550
|
+
.latch-panel:has(.latch-big-input:focus-visible) { border-color: var(--latch-focus); box-shadow: 0 0 0 1px var(--latch-focus); }
|
|
551
|
+
.latch-panel__top { display: flex; justify-content: space-between; align-items: center; min-height: 18px; }
|
|
552
|
+
.latch-panel__balance { font-size: var(--latch-font-size-sm); color: var(--latch-text-muted); display: inline-flex; gap: 8px; align-items: center; }
|
|
553
|
+
/* Quick amounts under "You pay": real fractions of the balance just read, one row of equal chips. */
|
|
554
|
+
.latch-portions { display: grid; grid-template-columns: repeat(auto-fit, minmax(52px, 1fr)); gap: 8px; margin-top: 12px; }
|
|
555
|
+
.latch-portion {
|
|
556
|
+
font: inherit; font-size: var(--latch-font-size-sm); font-weight: 600; min-height: 36px; padding: 0 8px; border-radius: var(--latch-radius-sm);
|
|
557
|
+
border: 1px solid var(--latch-border); background: var(--latch-bg); color: var(--latch-text); cursor: pointer;
|
|
558
|
+
transition: border-color 120ms, color 120ms;
|
|
559
|
+
}
|
|
560
|
+
.latch-portion:hover { border-color: var(--latch-accent); color: var(--latch-accent); }
|
|
561
|
+
.latch-portion:focus-visible { outline: 2px solid var(--latch-focus); outline-offset: 2px; }
|
|
562
|
+
|
|
563
|
+
/* The compact variant's Buy / Sell pill, in the header where the title was. */
|
|
564
|
+
.latch-sides {
|
|
565
|
+
flex: 1 1 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; min-width: 0;
|
|
566
|
+
border: 1px solid var(--latch-border); border-radius: 999px; background: var(--latch-bg-sunken);
|
|
567
|
+
}
|
|
568
|
+
.latch-sides__btn {
|
|
569
|
+
min-height: 40px; border: 0; border-radius: 999px; background: transparent; color: var(--latch-text);
|
|
570
|
+
font: inherit; font-weight: 600; cursor: pointer; transition: background 120ms, color 120ms;
|
|
571
|
+
}
|
|
572
|
+
.latch-sides__btn:hover { background: var(--latch-bg-elevated); }
|
|
573
|
+
.latch-sides__btn:focus-visible { outline: 2px solid var(--latch-focus); outline-offset: 2px; }
|
|
574
|
+
.latch-sides__btn[data-latch-side="buy"][aria-pressed="true"] { background: var(--latch-buy); color: var(--latch-buy-text); }
|
|
575
|
+
.latch-sides__btn[data-latch-side="sell"][aria-pressed="true"] { background: var(--latch-accent); color: var(--latch-accent-text); }
|
|
576
|
+
.latch-swap .latch-header:has(.latch-sides) { align-items: center; flex-wrap: nowrap; }
|
|
577
|
+
|
|
578
|
+
/* The compact variant's lines, always visible above the button, one fee per line. */
|
|
579
|
+
.latch-lines { margin: 8px 0 0; padding: 4px 4px 0; display: grid; gap: 8px; }
|
|
580
|
+
.latch-lines .latch-details__row { font-size: 13px; }
|
|
581
|
+
.latch-lines output { font: inherit; transition: opacity 150ms; }
|
|
582
|
+
.latch-lines output.is-refreshing { opacity: 0.55; }
|
|
583
|
+
.latch-swap__form[data-latch-variant="compact"][data-latch-swap-side="buy"] .latch-cta { background: var(--latch-buy); color: var(--latch-buy-text); }
|
|
584
|
+
.latch-swap__form[data-latch-variant="compact"][data-latch-swap-side="buy"] .latch-cta:hover:not(:disabled) { background: var(--latch-buy-hover); }
|
|
585
|
+
.latch-panel__main { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
|
|
586
|
+
.latch-big-input {
|
|
587
|
+
flex: 1 1 auto; min-width: 0; width: 100%;
|
|
588
|
+
font-family: var(--latch-font); font-size: 32px; font-weight: 500; letter-spacing: -0.01em;
|
|
589
|
+
background: transparent; border: 0; color: var(--latch-text); padding: 4px 0; outline: none;
|
|
590
|
+
}
|
|
591
|
+
.latch-big-input::placeholder, .latch-big-input__placeholder { color: var(--latch-text-muted); opacity: 0.7; }
|
|
592
|
+
.latch-big-input--out { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity 150ms; }
|
|
593
|
+
.latch-big-input--out.is-refreshing { opacity: 0.55; }
|
|
594
|
+
.latch-panel__error { margin: 6px 0 0; font-size: var(--latch-font-size-sm); color: var(--latch-danger); }
|
|
595
|
+
.latch-panel__note { margin: 6px 0 0; font-size: var(--latch-font-size-sm); color: var(--latch-text-muted); }
|
|
596
|
+
|
|
597
|
+
.latch-token-button {
|
|
598
|
+
flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
|
|
599
|
+
padding: 6px 10px 6px 6px; border-radius: 999px; font: inherit; font-weight: 650; cursor: pointer;
|
|
600
|
+
background: var(--latch-bg); color: var(--latch-text); border: 1px solid var(--latch-border);
|
|
601
|
+
box-shadow: 0 1px 2px rgba(0,0,0,0.06); transition: border-color 120ms, transform 80ms;
|
|
602
|
+
}
|
|
603
|
+
.latch-token-button:hover { border-color: var(--latch-border-strong); }
|
|
604
|
+
.latch-token-button:active { transform: scale(0.98); }
|
|
605
|
+
.latch-token-button__chevron { color: var(--latch-text-muted); font-size: 12px; }
|
|
606
|
+
.latch-token-button--locked { cursor: default; box-shadow: none; background: var(--latch-bg-sunken); }
|
|
607
|
+
.latch-token-button--locked:hover { border-color: var(--latch-border); }
|
|
608
|
+
.latch-slot { display: block; }
|
|
609
|
+
.latch-slot--header { margin-top: -4px; }
|
|
610
|
+
.latch-token-logo { border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--latch-bg-sunken); }
|
|
611
|
+
.latch-token-logo--initials {
|
|
612
|
+
display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
|
|
613
|
+
color: #fff; letter-spacing: 0.01em; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
|
|
614
|
+
background: linear-gradient(140deg, hsl(var(--latch-mono-hue, 215) 62% 52%), hsl(calc(var(--latch-mono-hue, 215) + 28) 58% 34%));
|
|
615
|
+
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
.latch-flip { display: flex; justify-content: center; height: 0; position: relative; z-index: 1; }
|
|
619
|
+
.latch-flip__button {
|
|
620
|
+
position: relative; top: -16px; width: 36px; height: 36px; border-radius: 12px; cursor: pointer;
|
|
621
|
+
background: var(--latch-bg); border: 4px solid var(--latch-bg); color: var(--latch-text);
|
|
622
|
+
box-shadow: 0 0 0 1px var(--latch-border); font-size: 16px; line-height: 1;
|
|
623
|
+
display: inline-flex; align-items: center; justify-content: center; transition: transform 160ms ease, background 120ms;
|
|
624
|
+
}
|
|
625
|
+
.latch-flip__button:hover { background: var(--latch-bg-sunken); transform: rotate(180deg); }
|
|
626
|
+
|
|
627
|
+
.latch-cta {
|
|
628
|
+
margin-top: 8px; width: 100%; height: 52px; border: 0; border-radius: var(--latch-radius);
|
|
629
|
+
background: var(--latch-accent); color: var(--latch-accent-text); font: inherit; font-size: 17px; font-weight: 700;
|
|
630
|
+
cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
|
|
631
|
+
transition: background 120ms, transform 80ms, opacity 120ms;
|
|
632
|
+
}
|
|
633
|
+
.latch-cta:hover:not(:disabled) { background: var(--latch-accent-hover); }
|
|
634
|
+
.latch-cta:active:not(:disabled) { transform: scale(0.995); }
|
|
635
|
+
.latch-cta:disabled { background: var(--latch-bg-sunken); color: var(--latch-text-muted); cursor: not-allowed; }
|
|
636
|
+
.latch-cta[data-latch-busy="true"] { opacity: 0.85; cursor: progress; }
|
|
637
|
+
.latch-spinner {
|
|
638
|
+
width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
|
|
639
|
+
animation: latch-spin 0.8s linear infinite;
|
|
640
|
+
}
|
|
641
|
+
@keyframes latch-spin { to { transform: rotate(360deg); } }
|
|
642
|
+
|
|
643
|
+
.latch-ack {
|
|
644
|
+
display: flex; gap: 10px; align-items: flex-start; margin-top: 6px; padding: 10px 12px;
|
|
645
|
+
border-radius: var(--latch-radius-sm); background: var(--latch-warning-bg); color: var(--latch-text); font-size: var(--latch-font-size-sm);
|
|
646
|
+
}
|
|
647
|
+
.latch-ack input { margin-top: 2px; }
|
|
648
|
+
|
|
649
|
+
.latch-details { margin-top: 8px; border: 1px solid var(--latch-border); border-radius: var(--latch-radius-sm); overflow: hidden; }
|
|
650
|
+
.latch-details__toggle {
|
|
651
|
+
width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px;
|
|
652
|
+
padding: 10px 12px; background: transparent; border: 0; font: inherit; color: var(--latch-text); cursor: pointer; text-align: left;
|
|
653
|
+
}
|
|
654
|
+
.latch-details__toggle:hover { background: var(--latch-bg-elevated); }
|
|
655
|
+
.latch-details__rate { font-weight: 600; cursor: pointer; }
|
|
656
|
+
.latch-details__hint { display: inline-flex; gap: 10px; align-items: center; color: var(--latch-text-muted); font-size: var(--latch-font-size-sm); }
|
|
657
|
+
.latch-details__list { margin: 0; padding: 4px 12px 10px; display: grid; gap: 6px; border-top: 1px solid var(--latch-border); }
|
|
658
|
+
.latch-details__row { display: flex; justify-content: space-between; gap: 12px; font-size: var(--latch-font-size-sm); }
|
|
659
|
+
.latch-details__row dt { color: var(--latch-text-muted); }
|
|
660
|
+
.latch-details__row dd { margin: 0; text-align: right; color: var(--latch-text); overflow-wrap: anywhere; }
|
|
661
|
+
[data-latch-severity="high"] { color: var(--latch-danger) !important; }
|
|
662
|
+
[data-latch-severity="medium"] { color: var(--latch-warning) !important; }
|
|
663
|
+
|
|
664
|
+
.latch-settings-trigger { display: inline-flex; align-items: center; gap: 6px; width: auto; padding: 0 10px; border-radius: 999px; }
|
|
665
|
+
.latch-settings-trigger__value { font-size: var(--latch-font-size-sm); font-weight: 600; }
|
|
666
|
+
|
|
667
|
+
/* Overlays. Portalled into .latch-widget, so they inherit the tokens. */
|
|
668
|
+
.latch-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(2px); animation: latch-fade 120ms ease; z-index: 50; }
|
|
669
|
+
.latch-dialog {
|
|
670
|
+
position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 51;
|
|
671
|
+
width: min(420px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 32px));
|
|
672
|
+
display: flex; flex-direction: column; gap: 10px;
|
|
673
|
+
background: var(--latch-bg); color: var(--latch-text); border: 1px solid var(--latch-border);
|
|
674
|
+
border-radius: var(--latch-radius); box-shadow: var(--latch-shadow); padding: 14px 14px 8px;
|
|
675
|
+
font-family: var(--latch-font); font-size: var(--latch-font-size); animation: latch-pop 140ms ease;
|
|
676
|
+
}
|
|
677
|
+
@keyframes latch-fade { from { opacity: 0; } }
|
|
678
|
+
@keyframes latch-pop { from { opacity: 0; transform: translate(-50%, -48%) scale(0.98); } }
|
|
679
|
+
.latch-dialog__head { display: flex; justify-content: space-between; align-items: center; }
|
|
680
|
+
.latch-dialog__title { margin: 0; font-size: 17px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
|
|
681
|
+
.latch-dialog__count {
|
|
682
|
+
font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums;
|
|
683
|
+
color: var(--latch-text-muted); background: var(--latch-bg-elevated); border: 1px solid var(--latch-border);
|
|
684
|
+
}
|
|
685
|
+
.latch-search-wrap { position: relative; display: flex; align-items: center; }
|
|
686
|
+
.latch-search-wrap__icon { position: absolute; left: 14px; color: var(--latch-text-muted); pointer-events: none; }
|
|
687
|
+
.latch-search-wrap__clear {
|
|
688
|
+
position: absolute; right: 8px; width: 28px; height: 28px; border-radius: 999px; border: 0; cursor: pointer;
|
|
689
|
+
background: var(--latch-bg-sunken); color: var(--latch-text-muted); font-size: 16px; line-height: 1;
|
|
690
|
+
}
|
|
691
|
+
.latch-search-wrap__clear:hover { color: var(--latch-text); }
|
|
692
|
+
.latch-search {
|
|
693
|
+
width: 100%; font: inherit; font-size: 16px; padding: 12px 40px; border-radius: 999px;
|
|
694
|
+
border: 1px solid var(--latch-border); background: var(--latch-bg-elevated); color: var(--latch-text); outline: none;
|
|
695
|
+
transition: border-color 120ms, box-shadow 120ms;
|
|
696
|
+
}
|
|
697
|
+
.latch-search:focus { border-color: var(--latch-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--latch-accent) 22%, transparent); }
|
|
698
|
+
.latch-common { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 4px; }
|
|
699
|
+
.latch-chip--token {
|
|
700
|
+
flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px 0 6px;
|
|
701
|
+
border-radius: 999px; border: 1px solid var(--latch-border); background: var(--latch-bg-elevated); color: var(--latch-text);
|
|
702
|
+
font-weight: 600; transition: border-color 120ms, background 120ms;
|
|
703
|
+
}
|
|
704
|
+
.latch-chip--token:hover { border-color: color-mix(in srgb, var(--latch-accent) 55%, var(--latch-border)); }
|
|
705
|
+
.latch-chip--token[aria-pressed="true"] { border-color: var(--latch-accent); background: color-mix(in srgb, var(--latch-accent) 14%, var(--latch-bg-elevated)); }
|
|
706
|
+
.latch-token-list { list-style: none; margin: 0 -14px; padding: 6px 8px 8px; overflow-y: auto; border-top: 1px solid var(--latch-border); }
|
|
707
|
+
.latch-token-row {
|
|
708
|
+
width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px; min-height: 56px; background: transparent; border: 0;
|
|
709
|
+
border-radius: 12px; font: inherit; color: var(--latch-text); cursor: pointer; text-align: left; transition: background 100ms;
|
|
710
|
+
}
|
|
711
|
+
.latch-token-row:hover:not(:disabled), .latch-token-row:focus-visible { background: var(--latch-bg-elevated); outline: none; }
|
|
712
|
+
.latch-token-row:focus-visible { box-shadow: inset 0 0 0 2px var(--latch-accent); }
|
|
713
|
+
.latch-token-row[aria-selected="true"] { background: color-mix(in srgb, var(--latch-accent) 10%, transparent); }
|
|
714
|
+
.latch-token-row:disabled { opacity: 0.4; cursor: not-allowed; }
|
|
715
|
+
.latch-token-row--note { color: var(--latch-text-muted); font-size: var(--latch-font-size-sm); cursor: default; min-height: 0; }
|
|
716
|
+
.latch-token-row--empty { justify-content: center; text-align: center; padding: 28px 16px; }
|
|
717
|
+
.latch-token-row__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
|
|
718
|
+
.latch-token-row__symbol { font-weight: 650; font-size: 15px; display: inline-flex; align-items: center; flex-wrap: wrap; }
|
|
719
|
+
.latch-token-row__name { font-size: var(--latch-font-size-sm); color: var(--latch-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
720
|
+
.latch-token-row__balance { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; color: var(--latch-text); font-weight: 600; }
|
|
721
|
+
.latch-token-row__balance-sym { font-size: 11px; font-weight: 500; color: var(--latch-text-muted); }
|
|
722
|
+
.latch-token-row__check { color: var(--latch-accent); font-weight: 700; font-size: 15px; margin-left: 4px; }
|
|
723
|
+
@media (prefers-reduced-motion: reduce) {
|
|
724
|
+
.latch-token-row, .latch-chip--token, .latch-search { transition: none; }
|
|
725
|
+
}
|
|
726
|
+
.latch-token-row--unlisted { background: color-mix(in srgb, var(--latch-warning) 8%, transparent); }
|
|
727
|
+
.latch-token-row__badges { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 8px; vertical-align: middle; }
|
|
728
|
+
.latch-badge {
|
|
729
|
+
display: inline-block; padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 16px; letter-spacing: 0.01em;
|
|
730
|
+
border: 1px solid var(--latch-border); background: var(--latch-bg-elevated); color: var(--latch-text-muted); white-space: nowrap;
|
|
731
|
+
}
|
|
732
|
+
.latch-badge[data-latch-tone="info"] { color: var(--latch-accent); border-color: color-mix(in srgb, var(--latch-accent) 35%, transparent); }
|
|
733
|
+
.latch-badge[data-latch-tone="warn"] { color: var(--latch-warning); border-color: color-mix(in srgb, var(--latch-warning) 45%, transparent); }
|
|
734
|
+
.latch-token-group { list-style: none; }
|
|
735
|
+
.latch-token-group__label {
|
|
736
|
+
display: block; padding: 8px 14px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
|
|
737
|
+
color: var(--latch-text-muted); border-top: 1px solid var(--latch-border);
|
|
738
|
+
}
|
|
739
|
+
.latch-token-group:first-child .latch-token-group__label { border-top: 0; }
|
|
740
|
+
.latch-token-group__list { list-style: none; margin: 0; padding: 0; }
|
|
741
|
+
|
|
742
|
+
.latch-popover {
|
|
743
|
+
z-index: 51; width: min(320px, calc(100vw - 32px)); background: var(--latch-bg); color: var(--latch-text);
|
|
744
|
+
border: 1px solid var(--latch-border); border-radius: var(--latch-radius); box-shadow: var(--latch-shadow); padding: 12px;
|
|
745
|
+
display: flex; flex-direction: column; gap: 8px; font-family: var(--latch-font); font-size: var(--latch-font-size); animation: latch-fade 120ms ease;
|
|
746
|
+
}
|
|
747
|
+
.latch-popover__row { display: flex; justify-content: space-between; align-items: center; }
|
|
748
|
+
.latch-popover__value { font-size: var(--latch-font-size-sm); color: var(--latch-text-muted); }
|
|
749
|
+
.latch-custom-slippage { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
|
|
750
|
+
.latch-custom-slippage input {
|
|
751
|
+
width: 56px; font: inherit; font-size: var(--latch-font-size-sm); padding: 6px 8px; border-radius: 999px;
|
|
752
|
+
border: 1px solid var(--latch-border); background: var(--latch-bg); color: var(--latch-text); text-align: right; outline: none;
|
|
753
|
+
}
|
|
754
|
+
.latch-custom-slippage input:focus { border-color: var(--latch-accent); }
|
|
755
|
+
.latch-note { margin: 0; font-size: var(--latch-font-size-sm); color: var(--latch-text-muted); }
|
|
756
|
+
.latch-note--warn { color: var(--latch-warning); }
|
|
757
|
+
.latch-footer--brand { justify-content: center; color: var(--latch-text-muted); font-size: 11px; }
|
|
758
|
+
.latch-footer a { color: var(--latch-accent); text-decoration: none; }
|
|
759
|
+
|
|
760
|
+
/* ============================================================================
|
|
761
|
+
Locks (LocksBadge, LocksPanel): the locked share and a countdown. Every
|
|
762
|
+
colour is a --latch-* token above.
|
|
763
|
+
============================================================================ */
|
|
764
|
+
.latch-locks { gap: 6px; }
|
|
765
|
+
.latch-locks--badge { display: inline-flex; flex-direction: column; width: auto; max-width: 100%; padding: 10px 14px; box-shadow: none; border-radius: var(--latch-radius-sm); }
|
|
766
|
+
.latch-locks--panel { max-width: none; }
|
|
767
|
+
.latch-locks__headline { margin: 0; display: flex; align-items: baseline; gap: 8px; font-weight: 600; overflow-wrap: anywhere; }
|
|
768
|
+
.latch-locks__headline--muted { color: var(--latch-text-muted); font-weight: 500; }
|
|
769
|
+
.latch-locks__headline--error { color: var(--latch-danger); font-weight: 500; }
|
|
770
|
+
.latch-locks__dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--latch-text-muted); transform: translateY(-1px); }
|
|
771
|
+
.latch-locks__dot--locked { background: var(--latch-success); }
|
|
772
|
+
.latch-locks__dot--open { background: var(--latch-warning); }
|
|
773
|
+
.latch-locks__dot--none { background: var(--latch-border-strong); }
|
|
774
|
+
.latch-locks__countdown { margin: 0; font-size: var(--latch-font-size-sm); color: var(--latch-text-muted); overflow-wrap: anywhere; }
|
|
775
|
+
.latch-locks__timer { font-family: var(--latch-font-mono); font-variant-numeric: tabular-nums; color: var(--latch-text); }
|
|
776
|
+
.latch-locks__link { font-size: var(--latch-font-size-sm); color: var(--latch-accent); text-decoration: none; font-weight: 600; }
|
|
777
|
+
.latch-locks__link:hover { text-decoration: underline; }
|
|
778
|
+
.latch-locks__link:focus-visible { outline: 2px solid var(--latch-focus); outline-offset: 2px; border-radius: 4px; }
|
|
779
|
+
.latch-locks__list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
|
|
780
|
+
.latch-locks__item { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--latch-border); border-radius: var(--latch-radius-sm); background: var(--latch-bg-elevated); min-width: 0; }
|
|
781
|
+
.latch-locks__item[data-status="withdrawn"], .latch-locks__item[data-status="claimed"] { opacity: 0.72; }
|
|
782
|
+
.latch-locks__row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
|
|
783
|
+
.latch-locks__status { flex: 0 0 auto; padding: 1px 8px; border: 1px solid currentColor; border-radius: 999px; font-size: 11px; font-weight: 650; white-space: nowrap; }
|
|
784
|
+
.latch-locks__status--locked, .latch-locks__status--cliff, .latch-locks__status--vesting { color: var(--latch-success); }
|
|
785
|
+
.latch-locks__status--unlockable, .latch-locks__status--vested { color: var(--latch-warning); }
|
|
786
|
+
.latch-locks__status--withdrawn, .latch-locks__status--claimed { color: var(--latch-text-muted); }
|
|
787
|
+
.latch-locks__status--permanent { color: var(--latch-accent, var(--latch-success)); }
|
|
788
|
+
.latch-locks__facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 12px; font-size: var(--latch-font-size-sm); }
|
|
789
|
+
.latch-locks__facts div { min-width: 0; }
|
|
790
|
+
.latch-locks__facts dt { color: var(--latch-text-muted); }
|
|
791
|
+
.latch-locks__facts dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
|
|
792
|
+
|
|
793
|
+
/* Lock charts (lockCharts.tsx): a locked-share bar that grows in, and a release
|
|
794
|
+
schedule that draws on. Motion off under prefers-reduced-motion. */
|
|
795
|
+
.latch-sharebar { display: grid; gap: 6px; min-width: 0; }
|
|
796
|
+
.latch-locks--badge .latch-sharebar { min-width: 180px; }
|
|
797
|
+
.latch-sharebar__track { height: 8px; border-radius: 999px; overflow: hidden; background: var(--latch-bg-sunken); }
|
|
798
|
+
.latch-sharebar__grow { display: flex; height: 100%; transform-origin: left center; animation: latch-grow 0.9s cubic-bezier(0.22, 1, 0.36, 1) both; }
|
|
799
|
+
.latch-sharebar__part { flex: 0 0 auto; height: 100%; }
|
|
800
|
+
.latch-sharebar__part + .latch-sharebar__part { box-shadow: inset 2px 0 0 var(--latch-bg); }
|
|
801
|
+
.latch-sharebar__part--permanent, .latch-sharebar__part--lp { background: var(--latch-success); }
|
|
802
|
+
.latch-sharebar__part--time, .latch-sharebar__part--unvested { background: var(--latch-accent); }
|
|
803
|
+
.latch-sharebar__part--vested { background: var(--latch-accent); opacity: 0.45; }
|
|
804
|
+
.latch-sharebar__key { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 11px; color: var(--latch-text-muted); font-variant-numeric: tabular-nums; }
|
|
805
|
+
.latch-sharebar__key li { display: inline-flex; align-items: center; gap: 5px; }
|
|
806
|
+
.latch-sharebar__sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
|
|
807
|
+
.latch-spark { margin: 2px 0 0; display: grid; gap: 4px; }
|
|
808
|
+
.latch-spark__svg { display: block; width: 100%; height: 44px; overflow: visible; cursor: crosshair; border-radius: 4px; }
|
|
809
|
+
.latch-spark__svg:focus-visible { outline: 2px solid var(--latch-focus); outline-offset: 2px; }
|
|
810
|
+
.latch-spark__base { stroke: var(--latch-border); stroke-width: 1; }
|
|
811
|
+
.latch-spark__line { stroke: var(--latch-accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 2000; animation: latch-draw 1.3s cubic-bezier(0.22, 1, 0.36, 1) both; }
|
|
812
|
+
.latch-spark__now { stroke: var(--latch-text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
|
|
813
|
+
.latch-spark__cross { stroke: var(--latch-accent); stroke-width: 1; opacity: 0.6; }
|
|
814
|
+
.latch-spark__cap { font-size: 11px; color: var(--latch-text-muted); overflow-wrap: anywhere; }
|
|
815
|
+
.latch-locks .latch-progress-fill, .latch-locker .latch-progress-fill { transform-origin: left center; animation: latch-grow 0.9s cubic-bezier(0.22, 1, 0.36, 1) both; }
|
|
816
|
+
@keyframes latch-grow { from { transform: scaleX(0.02); } to { transform: scaleX(1); } }
|
|
817
|
+
@keyframes latch-draw { from { stroke-dashoffset: 2000; } to { stroke-dashoffset: 0; } }
|
|
818
|
+
@media (prefers-reduced-motion: reduce) {
|
|
819
|
+
.latch-sharebar__grow, .latch-spark__line, .latch-locks .latch-progress-fill, .latch-locker .latch-progress-fill { animation: none; transform: none; stroke-dashoffset: 0; }
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
/* ============================================================================
|
|
823
|
+
Token trust (TokenTrustPanel): labelled rows, each with its source.
|
|
824
|
+
============================================================================ */
|
|
825
|
+
.latch-trust { max-width: none; gap: 8px; }
|
|
826
|
+
.latch-trust__list { margin: 0; display: grid; gap: 0; }
|
|
827
|
+
.latch-trust__row { display: grid; grid-template-columns: minmax(120px, 180px) 1fr; gap: 4px 14px; padding: 9px 0; border-top: 1px solid var(--latch-border); min-width: 0; }
|
|
828
|
+
.latch-trust__row:first-child { border-top: 0; }
|
|
829
|
+
@media (max-width: 520px) { .latch-trust__row { grid-template-columns: 1fr; } }
|
|
830
|
+
.latch-trust__label { color: var(--latch-text-muted); font-size: var(--latch-font-size-sm); font-weight: 600; }
|
|
831
|
+
.latch-trust__value { margin: 0; min-width: 0; display: grid; gap: 3px; }
|
|
832
|
+
.latch-trust__headline { margin: 0; display: flex; align-items: baseline; gap: 8px; font-weight: 600; overflow-wrap: anywhere; }
|
|
833
|
+
.latch-trust__detail { margin: 0; font-size: var(--latch-font-size-sm); color: var(--latch-text-muted); overflow-wrap: anywhere; }
|
|
834
|
+
.latch-trust__source { margin: 0; display: flex; flex-wrap: wrap; gap: 2px 10px; font-family: var(--latch-font-mono); font-size: 11px; color: var(--latch-text-muted); overflow-wrap: anywhere; }
|
|
835
|
+
.latch-trust__source a { color: inherit; text-decoration: underline; text-decoration-color: var(--latch-border-strong); }
|
|
836
|
+
.latch-trust__source a:hover { color: var(--latch-accent); }
|
|
837
|
+
.latch-trust__dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--latch-border-strong); transform: translateY(-1px); }
|
|
838
|
+
.latch-trust__dot--locked { background: var(--latch-success); }
|
|
839
|
+
.latch-trust__dot--neutral { background: var(--latch-text-muted); }
|
|
840
|
+
.latch-trust__dot--caution { background: var(--latch-warning); }
|
|
841
|
+
.latch-trust__dot--flagged, .latch-trust__dot--error { background: var(--latch-danger); }
|
|
842
|
+
.latch-trust__row[data-tone="flagged"] .latch-trust__headline, .latch-trust__row[data-tone="error"] .latch-trust__headline { color: var(--latch-danger); }
|
|
843
|
+
.latch-trust__subhead { margin: 6px 0 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--latch-text-muted); }
|
|
844
|
+
.latch-trust__pool { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--latch-border); border-radius: var(--latch-radius-sm); background: var(--latch-bg-elevated); min-width: 0; }
|
|
845
|
+
.latch-trust__pool-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
|
|
846
|
+
.latch-trust__pool-head code { font-family: var(--latch-font-mono); font-size: 11px; color: var(--latch-text-muted); }
|
|
847
|
+
.latch-trust__found { margin: 0; font-size: 11px; color: var(--latch-text-muted); }
|
|
848
|
+
.latch-trust__link { font-size: var(--latch-font-size-sm); color: var(--latch-accent); text-decoration: none; font-weight: 600; margin-left: auto; }
|
|
849
|
+
.latch-trust__link:hover { text-decoration: underline; }
|
|
850
|
+
.latch-trust__state { margin: 0; color: var(--latch-text-muted); }
|
|
851
|
+
.latch-trust__state--error { color: var(--latch-danger); }
|
|
852
|
+
.latch-trust__retry { font: inherit; background: none; border: 0; padding: 0; color: var(--latch-accent); cursor: pointer; text-decoration: underline; }
|
|
853
|
+
|
|
854
|
+
/* ============================================================================
|
|
855
|
+
Locker (LockerWidget): lock a position, lock or vest tokens, manage locks.
|
|
856
|
+
============================================================================ */
|
|
857
|
+
.latch-locker { gap: 10px; }
|
|
858
|
+
.latch-locker__tabs { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--latch-bg-sunken); }
|
|
859
|
+
.latch-locker__tab { flex: 1; font: inherit; font-size: var(--latch-font-size-sm); font-weight: 600; padding: 7px 10px; border: 0; border-radius: 999px; background: transparent; color: var(--latch-text-muted); cursor: pointer; }
|
|
860
|
+
.latch-locker__tab[aria-selected="true"] { background: var(--latch-bg); color: var(--latch-text); box-shadow: var(--latch-shadow); }
|
|
861
|
+
.latch-locker__field { display: grid; gap: 4px; font-size: var(--latch-font-size-sm); }
|
|
862
|
+
.latch-locker__field > span { color: var(--latch-text-muted); font-weight: 600; }
|
|
863
|
+
.latch-locker__input { width: 100%; font: inherit; padding: 10px 12px; border-radius: var(--latch-radius-sm); border: 1px solid var(--latch-border); background: var(--latch-bg-elevated); color: var(--latch-text); outline: none; min-width: 0; }
|
|
864
|
+
.latch-locker__input:focus { border-color: var(--latch-accent); }
|
|
865
|
+
.latch-locker__row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
|
|
866
|
+
@media (max-width: 420px) { .latch-locker__row2 { grid-template-columns: 1fr; } }
|
|
867
|
+
.latch-locker__issues { margin: 0; padding-left: 18px; color: var(--latch-danger); font-size: var(--latch-font-size-sm); }
|
|
868
|
+
.latch-locker__fee { margin: 0; padding: 8px 10px; border-radius: var(--latch-radius-sm); background: var(--latch-bg-elevated); font-size: var(--latch-font-size-sm); display: grid; gap: 2px; }
|
|
869
|
+
.latch-locker__fee strong { font-variant-numeric: tabular-nums; }
|
|
870
|
+
.latch-locker__steps { margin: 0; padding-left: 18px; display: grid; gap: 2px; font-size: var(--latch-font-size-sm); color: var(--latch-text-muted); }
|
|
871
|
+
.latch-locker__steps li[data-state="done"] { color: var(--latch-success); }
|
|
872
|
+
.latch-locker__steps li[data-state="active"] { color: var(--latch-text); font-weight: 600; }
|
|
873
|
+
.latch-locker__status { margin: 0; font-size: var(--latch-font-size-sm); overflow-wrap: anywhere; }
|
|
874
|
+
.latch-locker__status[data-kind="error"] { color: var(--latch-danger); }
|
|
875
|
+
.latch-locker__status[data-kind="success"] { color: var(--latch-success); }
|
|
876
|
+
.latch-locker__actions { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
877
|
+
.latch-locker__btn { font: inherit; font-size: var(--latch-font-size-sm); font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--latch-border-strong); background: var(--latch-bg); color: var(--latch-text); cursor: pointer; }
|
|
878
|
+
.latch-locker__btn:hover:not(:disabled) { border-color: var(--latch-accent); color: var(--latch-accent); }
|
|
879
|
+
.latch-locker__btn:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
880
|
+
.latch-locker__choice { display: flex; gap: 12px; flex-wrap: wrap; font-size: var(--latch-font-size-sm); }
|
|
881
|
+
.latch-locker__choice label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
|
|
882
|
+
|
|
883
|
+
/* ============================================================================
|
|
884
|
+
The Latch mark (brand kit masters/latch-mark.svg, loaded as shipped, never
|
|
885
|
+
redrawn). 24 px wide is the kit's minimum; the margin is its clear space
|
|
886
|
+
(the height of the hook's eye at this size).
|
|
887
|
+
============================================================================ */
|
|
888
|
+
.latch-brand { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 11px; color: var(--latch-text-muted); }
|
|
889
|
+
.latch-brand__mark { flex: 0 0 auto; width: 24px; height: auto; margin: 4px; display: block; }
|
|
890
|
+
.latch-brand__spacer { flex: 1; }
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
/* ============================================================================
|
|
894
|
+
Touch (pointer: coarse): 44px targets, and inputs at 16px so iOS Safari does
|
|
895
|
+
not zoom the host page when a field is focused.
|
|
896
|
+
============================================================================ */
|
|
897
|
+
@media (pointer: coarse) {
|
|
898
|
+
.latch-widget input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
|
|
899
|
+
.latch-widget select,
|
|
900
|
+
.latch-widget textarea,
|
|
901
|
+
.latch-locker input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
|
|
902
|
+
.latch-locker select { font-size: max(16px, 1em); }
|
|
903
|
+
.latch-portion, .latch-chip, .latch-select, .latch-settings-trigger, .latch-icon-button,
|
|
904
|
+
.latch-locker__tab, .latch-locker__input, .latch-locker__btn, .latch-button, .latch-token-button { min-height: 44px; }
|
|
905
|
+
.latch-locker__choice label { min-height: 44px; }
|
|
906
|
+
}
|
|
907
|
+
`, Ye = "latch-widgets-styles";
|
|
908
|
+
function na(t = globalThis.document ?? null) {
|
|
909
|
+
if (t === null) return;
|
|
910
|
+
const a = t;
|
|
911
|
+
if (a.getElementById(Ye) !== null) return;
|
|
912
|
+
const n = "createElement" in a ? a : a.ownerDocument;
|
|
913
|
+
if (n === null) return;
|
|
914
|
+
const r = n.createElement("style");
|
|
915
|
+
r.id = Ye, r.textContent = la, ("head" in a && a.head !== null ? a.head : a).appendChild(r);
|
|
916
|
+
}
|
|
917
|
+
function de(t) {
|
|
918
|
+
const { theme: a, adapter: n } = le(), [r, s] = L(null);
|
|
919
|
+
return I(() => {
|
|
920
|
+
na();
|
|
921
|
+
}, []), /* @__PURE__ */ e(aa, { value: r, children: /* @__PURE__ */ l(
|
|
922
|
+
"section",
|
|
923
|
+
{
|
|
924
|
+
ref: s,
|
|
925
|
+
className: `latch-widget${t.className ? ` ${t.className}` : ""}`,
|
|
926
|
+
"data-latch-theme": a,
|
|
927
|
+
"aria-label": t.title,
|
|
928
|
+
children: [
|
|
929
|
+
/* @__PURE__ */ l("header", { className: "latch-header", children: [
|
|
930
|
+
t.headerContent !== void 0 ? /* @__PURE__ */ l(X, { children: [
|
|
931
|
+
/* @__PURE__ */ e("h2", { className: "latch-visually-hidden", children: t.title }),
|
|
932
|
+
t.headerContent
|
|
933
|
+
] }) : /* @__PURE__ */ l("div", { children: [
|
|
934
|
+
/* @__PURE__ */ e("h2", { className: "latch-title", children: t.title }),
|
|
935
|
+
t.subtitle !== void 0 ? /* @__PURE__ */ e("p", { className: "latch-subtitle", children: t.subtitle }) : null
|
|
936
|
+
] }),
|
|
937
|
+
t.headerAction
|
|
938
|
+
] }),
|
|
939
|
+
n.isMock ? /* @__PURE__ */ e(oa, {}) : null,
|
|
940
|
+
t.children
|
|
941
|
+
]
|
|
942
|
+
}
|
|
943
|
+
) });
|
|
944
|
+
}
|
|
945
|
+
function oa() {
|
|
946
|
+
return /* @__PURE__ */ l("div", { className: "latch-mock-banner", role: "note", children: [
|
|
947
|
+
/* @__PURE__ */ e("strong", { children: "Mock data" }),
|
|
948
|
+
/* @__PURE__ */ e("span", { children: "No contracts are deployed. Every price, balance and route shown here is simulated by the development adapter and is not a market quote." })
|
|
949
|
+
] });
|
|
950
|
+
}
|
|
951
|
+
function fe(t) {
|
|
952
|
+
const a = ge(), n = ge(), r = ge(), s = (d) => {
|
|
953
|
+
t.onValueChange?.(d.target.value);
|
|
954
|
+
}, g = (d) => {
|
|
955
|
+
const u = t.tokens.find((i) => i.address === d.target.value);
|
|
956
|
+
u !== void 0 && t.onTokenChange?.(u);
|
|
957
|
+
};
|
|
958
|
+
return /* @__PURE__ */ l("div", { className: "latch-field", children: [
|
|
959
|
+
/* @__PURE__ */ e("label", { className: "latch-label", htmlFor: a, children: t.label }),
|
|
960
|
+
/* @__PURE__ */ l("div", { className: "latch-field-row", children: [
|
|
961
|
+
/* @__PURE__ */ e(
|
|
962
|
+
"input",
|
|
963
|
+
{
|
|
964
|
+
id: a,
|
|
965
|
+
className: "latch-amount-input",
|
|
966
|
+
type: "text",
|
|
967
|
+
inputMode: "decimal",
|
|
968
|
+
autoComplete: "off",
|
|
969
|
+
spellCheck: !1,
|
|
970
|
+
placeholder: t.placeholder ?? "0.0",
|
|
971
|
+
value: t.value,
|
|
972
|
+
readOnly: t.readOnly ?? !1,
|
|
973
|
+
onChange: s,
|
|
974
|
+
"aria-invalid": t.error ? !0 : void 0,
|
|
975
|
+
"aria-describedby": t.error ? r : void 0
|
|
976
|
+
}
|
|
977
|
+
),
|
|
978
|
+
/* @__PURE__ */ e("label", { className: "latch-visually-hidden", htmlFor: n, children: `${t.label} token` }),
|
|
979
|
+
/* @__PURE__ */ l(
|
|
980
|
+
"select",
|
|
981
|
+
{
|
|
982
|
+
id: n,
|
|
983
|
+
className: "latch-select",
|
|
984
|
+
value: t.token?.address ?? "",
|
|
985
|
+
onChange: g,
|
|
986
|
+
disabled: t.onTokenChange === void 0,
|
|
987
|
+
children: [
|
|
988
|
+
t.token === null ? /* @__PURE__ */ e("option", { value: "", children: "Select" }) : null,
|
|
989
|
+
t.tokens.map((d) => /* @__PURE__ */ e("option", { value: d.address, children: d.symbol }, d.address))
|
|
990
|
+
]
|
|
991
|
+
}
|
|
992
|
+
)
|
|
993
|
+
] }),
|
|
994
|
+
/* @__PURE__ */ l("div", { className: "latch-meta", children: [
|
|
995
|
+
/* @__PURE__ */ e("span", { children: t.secondaryText ?? "" }),
|
|
996
|
+
t.balance !== void 0 && t.balance !== null && t.token !== null ? /* @__PURE__ */ l("span", { className: "latch-meta-value", children: [
|
|
997
|
+
"Balance ",
|
|
998
|
+
q(t.balance, t.token.decimals),
|
|
999
|
+
t.onUseMax !== void 0 ? /* @__PURE__ */ l(X, { children: [
|
|
1000
|
+
" ",
|
|
1001
|
+
/* @__PURE__ */ e(
|
|
1002
|
+
"button",
|
|
1003
|
+
{
|
|
1004
|
+
type: "button",
|
|
1005
|
+
className: "latch-chip",
|
|
1006
|
+
style: { display: "inline", flex: "none", padding: "0 6px" },
|
|
1007
|
+
onClick: t.onUseMax,
|
|
1008
|
+
children: "Max"
|
|
1009
|
+
}
|
|
1010
|
+
)
|
|
1011
|
+
] }) : null
|
|
1012
|
+
] }) : /* @__PURE__ */ e("span", {})
|
|
1013
|
+
] }),
|
|
1014
|
+
t.error ? /* @__PURE__ */ e("p", { id: r, className: "latch-status", "data-latch-tone": "error", children: t.error }) : null
|
|
1015
|
+
] });
|
|
1016
|
+
}
|
|
1017
|
+
function S(t) {
|
|
1018
|
+
return /* @__PURE__ */ l(
|
|
1019
|
+
"div",
|
|
1020
|
+
{
|
|
1021
|
+
className: "latch-summary-row",
|
|
1022
|
+
"data-latch-emphasis": t.emphasis,
|
|
1023
|
+
"data-latch-severity": t.severity,
|
|
1024
|
+
children: [
|
|
1025
|
+
/* @__PURE__ */ e("dt", { title: t.title, children: t.label }),
|
|
1026
|
+
/* @__PURE__ */ e("dd", { children: t.value })
|
|
1027
|
+
]
|
|
1028
|
+
}
|
|
1029
|
+
);
|
|
1030
|
+
}
|
|
1031
|
+
function re(t) {
|
|
1032
|
+
return /* @__PURE__ */ e("div", { className: "latch-summary", children: /* @__PURE__ */ e("dl", { children: t.children }) });
|
|
1033
|
+
}
|
|
1034
|
+
function F(t) {
|
|
1035
|
+
return /* @__PURE__ */ e(
|
|
1036
|
+
"p",
|
|
1037
|
+
{
|
|
1038
|
+
className: "latch-status",
|
|
1039
|
+
"data-latch-tone": t.tone ?? "neutral",
|
|
1040
|
+
role: "status",
|
|
1041
|
+
"aria-live": t.assertive === !0 ? "assertive" : "polite",
|
|
1042
|
+
children: t.message
|
|
1043
|
+
}
|
|
1044
|
+
);
|
|
1045
|
+
}
|
|
1046
|
+
function at(t) {
|
|
1047
|
+
return { type: "button", disabled: t === void 0, onClick: t };
|
|
1048
|
+
}
|
|
1049
|
+
function ve(t) {
|
|
1050
|
+
const a = t.needsConnect === !0 ? at(t.onConnectRequest) : null;
|
|
1051
|
+
return /* @__PURE__ */ e(
|
|
1052
|
+
"button",
|
|
1053
|
+
{
|
|
1054
|
+
type: a !== null ? a.type : t.type ?? "button",
|
|
1055
|
+
className: "latch-button",
|
|
1056
|
+
"data-latch-variant": t.variant ?? "primary",
|
|
1057
|
+
disabled: a !== null ? a.disabled : t.disabled === !0 || t.busy === !0,
|
|
1058
|
+
"aria-busy": t.busy === !0 ? !0 : void 0,
|
|
1059
|
+
onClick: a !== null ? a.onClick : t.onClick,
|
|
1060
|
+
children: t.children
|
|
1061
|
+
}
|
|
1062
|
+
);
|
|
1063
|
+
}
|
|
1064
|
+
function ra(t) {
|
|
1065
|
+
const a = Math.max(0, Math.min(100, t.percent));
|
|
1066
|
+
return /* @__PURE__ */ e(
|
|
1067
|
+
"div",
|
|
1068
|
+
{
|
|
1069
|
+
className: "latch-progress",
|
|
1070
|
+
role: "progressbar",
|
|
1071
|
+
"aria-label": t.label,
|
|
1072
|
+
"aria-valuenow": Math.round(a),
|
|
1073
|
+
"aria-valuemin": 0,
|
|
1074
|
+
"aria-valuemax": 100,
|
|
1075
|
+
children: /* @__PURE__ */ e("div", { className: "latch-progress-fill", style: { width: `${a}%` } })
|
|
1076
|
+
}
|
|
1077
|
+
);
|
|
1078
|
+
}
|
|
1079
|
+
function ca(t) {
|
|
1080
|
+
const a = ge();
|
|
1081
|
+
return /* @__PURE__ */ l(X, { children: [
|
|
1082
|
+
/* @__PURE__ */ e("span", { id: a, className: "latch-visually-hidden", children: t.label }),
|
|
1083
|
+
/* @__PURE__ */ e("div", { className: "latch-tabs", role: "tablist", "aria-labelledby": a, children: t.options.map((n) => /* @__PURE__ */ e(
|
|
1084
|
+
"button",
|
|
1085
|
+
{
|
|
1086
|
+
type: "button",
|
|
1087
|
+
role: "tab",
|
|
1088
|
+
className: "latch-chip",
|
|
1089
|
+
"aria-selected": n.value === t.value,
|
|
1090
|
+
tabIndex: n.value === t.value ? 0 : -1,
|
|
1091
|
+
onClick: () => t.onChange(n.value),
|
|
1092
|
+
children: n.label
|
|
1093
|
+
},
|
|
1094
|
+
n.value
|
|
1095
|
+
)) })
|
|
1096
|
+
] });
|
|
1097
|
+
}
|
|
1098
|
+
function Pa(t) {
|
|
1099
|
+
const a = A(
|
|
1100
|
+
() => t.tokens.flatMap((n, r) => {
|
|
1101
|
+
const s = /* @__PURE__ */ e("span", { className: "latch-route-token", children: n }, `token-${n}-${r}`);
|
|
1102
|
+
return r === 0 ? [s] : [
|
|
1103
|
+
/* @__PURE__ */ e("span", { "aria-hidden": "true", children: "→" }, `arrow-${r}`),
|
|
1104
|
+
s
|
|
1105
|
+
];
|
|
1106
|
+
}),
|
|
1107
|
+
[t.tokens]
|
|
1108
|
+
);
|
|
1109
|
+
return /* @__PURE__ */ l("div", { className: "latch-route", children: [
|
|
1110
|
+
a,
|
|
1111
|
+
t.detail !== void 0 ? /* @__PURE__ */ e("span", { children: t.detail }) : null
|
|
1112
|
+
] });
|
|
1113
|
+
}
|
|
1114
|
+
function ke(t) {
|
|
1115
|
+
return t.error === null ? null : /* @__PURE__ */ e("div", { className: "latch-error", role: "alert", children: Je(t.error, t.context) });
|
|
1116
|
+
}
|
|
1117
|
+
function be(t, a) {
|
|
1118
|
+
return t === "timestamp" ? ea(Number(a)) : `${a.toLocaleString()} blocks`;
|
|
1119
|
+
}
|
|
1120
|
+
function ia(t, a) {
|
|
1121
|
+
return t === "timestamp" ? `${new Date(Number(a) * 1e3).toISOString().replace("T", " ").slice(0, 19)} UTC` : `block ${a.toLocaleString()}`;
|
|
1122
|
+
}
|
|
1123
|
+
function sa(t) {
|
|
1124
|
+
const { chain: a, integrator: n, onConnectRequest: r } = le(), s = t.onConnectRequest ?? r, g = vt(), d = t.poolId ?? g.data?.[0]?.poolId ?? null, u = xt(d), i = u.data, m = Se(g), b = Se(u), v = t.poolId !== void 0 ? b : m !== "ready" ? m : b, k = xe().data, [_, T] = L(""), y = i === null || _.trim() === "" ? null : se(_, i.quoteToken.decimals), c = y !== null && y.ok ? y.value : null, h = Le(i?.quoteToken ?? null, k), o = kt({
|
|
1125
|
+
launch: i,
|
|
1126
|
+
amountIn: c,
|
|
1127
|
+
...t.onPurchaseConfirmed ? { onSuccess: t.onPurchaseConfirmed } : {}
|
|
1128
|
+
}), P = A(
|
|
1129
|
+
() => i === null ? null : wt(i),
|
|
1130
|
+
[i]
|
|
1131
|
+
), M = V(
|
|
1132
|
+
(R) => {
|
|
1133
|
+
if (R.preventDefault(), o.execution.needsApproval) {
|
|
1134
|
+
o.execution.approve();
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
o.execution.execute();
|
|
1138
|
+
},
|
|
1139
|
+
[o.execution]
|
|
1140
|
+
), E = t.title ?? (i === null ? "Launch" : `${i.launchToken.symbol} launch`), $ = `Latch Protocol · ${a.name}`;
|
|
1141
|
+
if (i === null || P === null)
|
|
1142
|
+
return /* @__PURE__ */ e(de, { title: E, subtitle: $, children: /* @__PURE__ */ e(
|
|
1143
|
+
lt,
|
|
1144
|
+
{
|
|
1145
|
+
state: v,
|
|
1146
|
+
chainName: a.name,
|
|
1147
|
+
error: t.poolId !== void 0 ? u.error : g.error ?? u.error
|
|
1148
|
+
}
|
|
1149
|
+
) });
|
|
1150
|
+
const { schedule: N } = P, U = c !== null && h.data !== null && c > h.data, ce = o.execution.step === "approving" || o.execution.step === "building" || o.execution.step === "awaiting-signature" || o.execution.step === "pending", J = o.execution.needsApproval ? `Approve ${o.execution.approvals[0]?.token.symbol ?? i.quoteToken.symbol}` : k === null ? "Connect wallet" : o.gate.message !== null ? o.gate.message : U ? `Insufficient ${i.quoteToken.symbol}` : `Buy ${i.launchToken.symbol}`, Z = k !== null && !U && (o.execution.needsApproval || o.canBuy && (y === null || y.ok)), z = o.execution.statusMessage !== "" ? o.execution.statusMessage : o.gate.message !== null ? `${o.gate.message}${o.gate.revert === null ? "" : ` — the hook reverts ${o.gate.revert}`}` : o.quoteStatus === "loading" ? "Fetching a quote" : U ? `Insufficient ${i.quoteToken.symbol}` : "", j = o.execution.step === "error" || o.quoteStatus === "error" || o.gate.reason !== null || U ? "error" : o.execution.step === "success" ? "success" : "neutral";
|
|
1151
|
+
return /* @__PURE__ */ l(de, { title: E, subtitle: $, children: [
|
|
1152
|
+
/* @__PURE__ */ e(da, { view: P }),
|
|
1153
|
+
/* @__PURE__ */ e(pa, { guard: i.guard, schedule: N }),
|
|
1154
|
+
/* @__PURE__ */ e(ua, { launch: i, schedule: N }),
|
|
1155
|
+
/* @__PURE__ */ l("form", { onSubmit: M, noValidate: !0, children: [
|
|
1156
|
+
/* @__PURE__ */ e(
|
|
1157
|
+
fe,
|
|
1158
|
+
{
|
|
1159
|
+
label: `You pay (${i.quoteToken.symbol})`,
|
|
1160
|
+
value: _,
|
|
1161
|
+
onValueChange: T,
|
|
1162
|
+
token: i.quoteToken,
|
|
1163
|
+
tokens: [i.quoteToken],
|
|
1164
|
+
balance: h.data,
|
|
1165
|
+
error: y !== null && !y.ok ? y.message : U ? "Insufficient balance" : null
|
|
1166
|
+
}
|
|
1167
|
+
),
|
|
1168
|
+
/* @__PURE__ */ e(
|
|
1169
|
+
fe,
|
|
1170
|
+
{
|
|
1171
|
+
label: `You receive (${i.launchToken.symbol})`,
|
|
1172
|
+
value: o.breakdown === null ? "" : q(o.breakdown.netAmountOut, i.launchToken.decimals),
|
|
1173
|
+
readOnly: !0,
|
|
1174
|
+
token: i.launchToken,
|
|
1175
|
+
tokens: [i.launchToken],
|
|
1176
|
+
secondaryText: o.quoteIsRefreshing ? "Updating quote..." : ""
|
|
1177
|
+
}
|
|
1178
|
+
),
|
|
1179
|
+
o.breakdown !== null ? /* @__PURE__ */ l(re, { children: [
|
|
1180
|
+
/* @__PURE__ */ e(
|
|
1181
|
+
S,
|
|
1182
|
+
{
|
|
1183
|
+
label: "Rate",
|
|
1184
|
+
value: Pe(o.rate, i.quoteToken.symbol, i.launchToken.symbol)
|
|
1185
|
+
}
|
|
1186
|
+
),
|
|
1187
|
+
/* @__PURE__ */ e(
|
|
1188
|
+
S,
|
|
1189
|
+
{
|
|
1190
|
+
label: "Price impact",
|
|
1191
|
+
value: W(o.breakdown.priceImpactBps),
|
|
1192
|
+
severity: o.breakdown.priceImpactSeverity
|
|
1193
|
+
}
|
|
1194
|
+
),
|
|
1195
|
+
/* @__PURE__ */ e(
|
|
1196
|
+
S,
|
|
1197
|
+
{
|
|
1198
|
+
label: "Launch fee charged",
|
|
1199
|
+
value: Q(i.currentFeePips),
|
|
1200
|
+
title: "The LP fee the hook is overriding this pool with right now. It goes to the pool's liquidity providers, not to the hook."
|
|
1201
|
+
}
|
|
1202
|
+
),
|
|
1203
|
+
n.active ? /* @__PURE__ */ e(
|
|
1204
|
+
S,
|
|
1205
|
+
{
|
|
1206
|
+
label: `Integrator fee (${$e(n.feeBps)})`,
|
|
1207
|
+
value: `${q(o.breakdown.integratorFee, i.launchToken.decimals)} ${i.launchToken.symbol} → ${H(n.referrer)}`,
|
|
1208
|
+
emphasis: "fee",
|
|
1209
|
+
title: "Paid to the site hosting this widget, inside the same transaction as the buy."
|
|
1210
|
+
}
|
|
1211
|
+
) : null,
|
|
1212
|
+
/* @__PURE__ */ e(
|
|
1213
|
+
S,
|
|
1214
|
+
{
|
|
1215
|
+
label: "Minimum received",
|
|
1216
|
+
value: `${q(o.breakdown.minAmountOutNet, i.launchToken.decimals)} ${i.launchToken.symbol}`,
|
|
1217
|
+
title: "Guaranteed floor after slippage and the integrator fee. The transaction reverts below this."
|
|
1218
|
+
}
|
|
1219
|
+
)
|
|
1220
|
+
] }) : null,
|
|
1221
|
+
/* @__PURE__ */ e(F, { message: z, tone: j }),
|
|
1222
|
+
/* @__PURE__ */ e(ve, { type: "submit", disabled: !Z, busy: ce, needsConnect: k === null, ...s === void 0 ? {} : { onConnectRequest: s }, children: J })
|
|
1223
|
+
] }),
|
|
1224
|
+
/* @__PURE__ */ e(ke, { error: o.execution.error ?? o.quoteError }),
|
|
1225
|
+
o.execution.txHash !== null ? /* @__PURE__ */ l("p", { className: "latch-footer", children: [
|
|
1226
|
+
/* @__PURE__ */ e("span", { children: "Transaction" }),
|
|
1227
|
+
/* @__PURE__ */ e("span", { children: H(o.execution.txHash) })
|
|
1228
|
+
] }) : null
|
|
1229
|
+
] });
|
|
1230
|
+
}
|
|
1231
|
+
function lt(t) {
|
|
1232
|
+
switch (t.state) {
|
|
1233
|
+
case "loading":
|
|
1234
|
+
return /* @__PURE__ */ e(F, { message: "Reading the launch schedule from chain", tone: "neutral" });
|
|
1235
|
+
case "not-configured":
|
|
1236
|
+
return /* @__PURE__ */ e("div", { className: "latch-summary", children: /* @__PURE__ */ e(
|
|
1237
|
+
F,
|
|
1238
|
+
{
|
|
1239
|
+
message: `Launches are coming soon on ${t.chainName}.`,
|
|
1240
|
+
tone: "neutral"
|
|
1241
|
+
}
|
|
1242
|
+
) });
|
|
1243
|
+
case "empty":
|
|
1244
|
+
return /* @__PURE__ */ l("div", { className: "latch-summary", children: [
|
|
1245
|
+
/* @__PURE__ */ e(F, { message: "No launch is registered for this pool.", tone: "neutral" }),
|
|
1246
|
+
/* @__PURE__ */ l("p", { className: "latch-subtitle", children: [
|
|
1247
|
+
"The hook answered and holds no launch record. A pool id is only claimed when someone calls ",
|
|
1248
|
+
/* @__PURE__ */ e("code", { children: "configureLaunch" }),
|
|
1249
|
+
", and the hook refuses to let a pool be initialized before that happens."
|
|
1250
|
+
] })
|
|
1251
|
+
] });
|
|
1252
|
+
case "error":
|
|
1253
|
+
return /* @__PURE__ */ l("div", { className: "latch-summary", children: [
|
|
1254
|
+
/* @__PURE__ */ e(
|
|
1255
|
+
F,
|
|
1256
|
+
{
|
|
1257
|
+
message: t.error?.message ?? "The launch could not be read from chain.",
|
|
1258
|
+
tone: "error",
|
|
1259
|
+
assertive: !0
|
|
1260
|
+
}
|
|
1261
|
+
),
|
|
1262
|
+
/* @__PURE__ */ e("p", { className: "latch-subtitle", children: "Nothing is shown in place of the schedule. Retry when the chain is reachable." })
|
|
1263
|
+
] });
|
|
1264
|
+
default:
|
|
1265
|
+
return /* @__PURE__ */ e(F, { message: "Loading", tone: "neutral" });
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
function da(t) {
|
|
1269
|
+
const { launch: a, schedule: n, feeSpanProgressBps: r, feeProjectionDriftPips: s } = t.view;
|
|
1270
|
+
return /* @__PURE__ */ l(X, { children: [
|
|
1271
|
+
/* @__PURE__ */ l(re, { children: [
|
|
1272
|
+
/* @__PURE__ */ e(S, { label: "Phase", value: ha(n) }),
|
|
1273
|
+
/* @__PURE__ */ e(
|
|
1274
|
+
S,
|
|
1275
|
+
{
|
|
1276
|
+
label: "Fee right now",
|
|
1277
|
+
value: Q(a.currentFeePips),
|
|
1278
|
+
title: "Read from currentFee(poolId) on the hook."
|
|
1279
|
+
}
|
|
1280
|
+
),
|
|
1281
|
+
/* @__PURE__ */ e(
|
|
1282
|
+
S,
|
|
1283
|
+
{
|
|
1284
|
+
label: "Fee schedule",
|
|
1285
|
+
value: n.initialFeePips === null || n.finalFeePips === null ? "unknown" : `${Q(n.initialFeePips)} → ${Q(n.finalFeePips)} over ${be(n.durationClock, a.guard.window)}`
|
|
1286
|
+
}
|
|
1287
|
+
),
|
|
1288
|
+
/* @__PURE__ */ e(
|
|
1289
|
+
S,
|
|
1290
|
+
{
|
|
1291
|
+
label: "Opens at",
|
|
1292
|
+
value: n.start === null ? "unknown" : ia(n.durationClock, n.start),
|
|
1293
|
+
title: n.durationClock === "timestamp" ? "Every swap before this block.timestamp reverts TradingNotOpen." : "Every swap before this contract block reverts TradingNotOpen."
|
|
1294
|
+
}
|
|
1295
|
+
),
|
|
1296
|
+
/* @__PURE__ */ e(
|
|
1297
|
+
S,
|
|
1298
|
+
{
|
|
1299
|
+
label: n.untilOpen !== null ? "Until open" : "Left in decay",
|
|
1300
|
+
value: n.untilOpen !== null ? be(n.durationClock, n.untilOpen) : n.remaining !== null ? be(n.durationClock, n.remaining) : "none — the fee has settled"
|
|
1301
|
+
}
|
|
1302
|
+
),
|
|
1303
|
+
/* @__PURE__ */ e(
|
|
1304
|
+
S,
|
|
1305
|
+
{
|
|
1306
|
+
label: "Launch owner",
|
|
1307
|
+
value: H(a.guard.owner),
|
|
1308
|
+
title: "Claimed by first call to configureLaunch. Non-transferable, and powerless from the start on."
|
|
1309
|
+
}
|
|
1310
|
+
)
|
|
1311
|
+
] }),
|
|
1312
|
+
r !== null ? /* @__PURE__ */ l("div", { className: "latch-field", children: [
|
|
1313
|
+
/* @__PURE__ */ e("span", { className: "latch-label", children: "Fee decay" }),
|
|
1314
|
+
/* @__PURE__ */ e(ra, { label: "Fee decay progress", percent: r / 100 }),
|
|
1315
|
+
/* @__PURE__ */ l("div", { className: "latch-meta", children: [
|
|
1316
|
+
/* @__PURE__ */ l("span", { children: [
|
|
1317
|
+
(r / 100).toFixed(1),
|
|
1318
|
+
"% of the way to the final fee"
|
|
1319
|
+
] }),
|
|
1320
|
+
/* @__PURE__ */ l("span", { className: "latch-meta-value", children: [
|
|
1321
|
+
"read at ",
|
|
1322
|
+
a.guard.durationClock === "timestamp" ? "block.timestamp" : "hook block",
|
|
1323
|
+
" ",
|
|
1324
|
+
a.readAt.toLocaleString()
|
|
1325
|
+
] })
|
|
1326
|
+
] })
|
|
1327
|
+
] }) : null,
|
|
1328
|
+
s !== null && s !== 0 ? /* @__PURE__ */ e(
|
|
1329
|
+
F,
|
|
1330
|
+
{
|
|
1331
|
+
message: `The hook reports ${Q(a.currentFeePips)} but this build projects ${Q(a.currentFeePips - s)} for the same block. The figure above is the chain's; the projected curve below may be wrong.`,
|
|
1332
|
+
tone: "error"
|
|
1333
|
+
}
|
|
1334
|
+
) : null
|
|
1335
|
+
] });
|
|
1336
|
+
}
|
|
1337
|
+
function ha(t) {
|
|
1338
|
+
switch (t.phase) {
|
|
1339
|
+
case "unclaimed":
|
|
1340
|
+
return "No launch configured";
|
|
1341
|
+
case "disabled":
|
|
1342
|
+
return "Guard disabled — LP fee pinned, no launch gate";
|
|
1343
|
+
case "pending":
|
|
1344
|
+
return "Not open yet";
|
|
1345
|
+
case "decaying":
|
|
1346
|
+
return "Open — LP fee decaying to its floor";
|
|
1347
|
+
case "settled":
|
|
1348
|
+
return "Open — fee settled";
|
|
1349
|
+
default:
|
|
1350
|
+
return "unknown";
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
function ua(t) {
|
|
1354
|
+
const { launch: a, schedule: n } = t;
|
|
1355
|
+
if (n.maxBuyPerTx === null)
|
|
1356
|
+
return /* @__PURE__ */ e(re, { children: /* @__PURE__ */ e(S, { label: "Per-transaction cap", value: "None configured" }) });
|
|
1357
|
+
const r = `${q(n.maxBuyPerTx, a.quoteToken.decimals)} ${a.quoteToken.symbol}`;
|
|
1358
|
+
return /* @__PURE__ */ l(X, { children: [
|
|
1359
|
+
/* @__PURE__ */ e(re, { children: /* @__PURE__ */ e(
|
|
1360
|
+
S,
|
|
1361
|
+
{
|
|
1362
|
+
label: "Per-transaction cap",
|
|
1363
|
+
value: n.maxBuyPerTxEnforced ? r : `${r} (not enforced right now)`,
|
|
1364
|
+
title: "Checked by the hook on each individual swap."
|
|
1365
|
+
}
|
|
1366
|
+
) }),
|
|
1367
|
+
/* @__PURE__ */ l("p", { className: "latch-subtitle", children: [
|
|
1368
|
+
"This caps one transaction. It is ",
|
|
1369
|
+
/* @__PURE__ */ e("strong", { children: "not" }),
|
|
1370
|
+
" a per-wallet cap and cannot be made into one: the hook only ever sees the router as the caller, so it cannot tell two buyers apart. Splitting a buy across several transactions or several wallets defeats it, and the cap stops applying once the decay window ends."
|
|
1371
|
+
] })
|
|
1372
|
+
] });
|
|
1373
|
+
}
|
|
1374
|
+
function pa(t) {
|
|
1375
|
+
const { guard: a, schedule: n } = t, r = 320, s = 72, g = 48, d = A(() => {
|
|
1376
|
+
if (a.window <= 0) return [];
|
|
1377
|
+
const _ = [];
|
|
1378
|
+
for (let T = 0; T <= g; T += 1) {
|
|
1379
|
+
const y = a.start + BigInt(a.window) * BigInt(T) / BigInt(g);
|
|
1380
|
+
_.push(bt(a, y) ?? a.finalFeePips);
|
|
1381
|
+
}
|
|
1382
|
+
return _;
|
|
1383
|
+
}, [a]);
|
|
1384
|
+
if (d.length === 0 || n.phase === "unclaimed" || n.phase === "disabled")
|
|
1385
|
+
return null;
|
|
1386
|
+
const u = Math.min(...d), m = Math.max(...d) - u || 1, b = d.map((_, T) => {
|
|
1387
|
+
const y = T / g * r, c = s - (_ - u) / m * (s - 8) - 4;
|
|
1388
|
+
return `${T === 0 ? "M" : "L"}${y.toFixed(1)},${c.toFixed(1)}`;
|
|
1389
|
+
}).join(" "), v = n.decayProgressBps ?? 0, w = Math.max(0, Math.min(1e4, v)) / 1e4 * r, k = `${Q(a.initialFeePips)} at the open, ${Q(a.finalFeePips)} after ${be(a.durationClock, a.window)}`;
|
|
1390
|
+
return /* @__PURE__ */ l("figure", { style: { margin: 0 }, children: [
|
|
1391
|
+
/* @__PURE__ */ l(
|
|
1392
|
+
"svg",
|
|
1393
|
+
{
|
|
1394
|
+
className: "latch-curve",
|
|
1395
|
+
viewBox: `0 0 ${r} ${s}`,
|
|
1396
|
+
preserveAspectRatio: "none",
|
|
1397
|
+
role: "img",
|
|
1398
|
+
"aria-label": `Launch fee decay: ${k}. Currently ${(v / 100).toFixed(0)} percent through the window.`,
|
|
1399
|
+
children: [
|
|
1400
|
+
/* @__PURE__ */ e("path", { d: b, fill: "none", stroke: "var(--latch-accent)", strokeWidth: 2 }),
|
|
1401
|
+
/* @__PURE__ */ e(
|
|
1402
|
+
"line",
|
|
1403
|
+
{
|
|
1404
|
+
x1: w,
|
|
1405
|
+
y1: 0,
|
|
1406
|
+
x2: w,
|
|
1407
|
+
y2: s,
|
|
1408
|
+
stroke: "var(--latch-border-strong)",
|
|
1409
|
+
strokeWidth: 1,
|
|
1410
|
+
strokeDasharray: "3 3"
|
|
1411
|
+
}
|
|
1412
|
+
)
|
|
1413
|
+
]
|
|
1414
|
+
}
|
|
1415
|
+
),
|
|
1416
|
+
/* @__PURE__ */ e("figcaption", { className: "latch-subtitle", children: k })
|
|
1417
|
+
] });
|
|
1418
|
+
}
|
|
1419
|
+
function $a(t) {
|
|
1420
|
+
const { chain: a } = le(), n = ft(t.token), r = Se(n), s = `Latch Protocol · ${a.name}`;
|
|
1421
|
+
if (r !== "ready" || n.data === null || n.data.length === 0)
|
|
1422
|
+
return /* @__PURE__ */ e(de, { title: t.title ?? "Launch", subtitle: s, children: r === "ready" || r === "empty" ? /* @__PURE__ */ l("p", { className: "latch-empty", children: [
|
|
1423
|
+
"The kit lists no pools for ",
|
|
1424
|
+
/* @__PURE__ */ e("code", { children: H(t.token) }),
|
|
1425
|
+
". Either it was not launched through this kit, or the token address is wrong."
|
|
1426
|
+
] }) : /* @__PURE__ */ e(lt, { state: r, chainName: a.name, error: n.error }) });
|
|
1427
|
+
const g = n.data[0]?.launchToken.symbol ?? H(t.token);
|
|
1428
|
+
return /* @__PURE__ */ e("div", { className: "latch-launch-legs", children: n.data.map((d, u) => /* @__PURE__ */ e(
|
|
1429
|
+
sa,
|
|
1430
|
+
{
|
|
1431
|
+
poolId: d.poolId,
|
|
1432
|
+
title: `${t.title ?? `${g} launch`} · ${d.pool.poolType === "CL" ? "concentrated" : "bin"} pool vs ${d.quoteToken.symbol}${n.data === null || n.data.length === 1 ? "" : ` (${u + 1} of ${n.data.length})`}`,
|
|
1433
|
+
...t.onPurchaseConfirmed ? { onPurchaseConfirmed: t.onPurchaseConfirmed } : {},
|
|
1434
|
+
...t.onConnectRequest ? { onConnectRequest: t.onConnectRequest } : {}
|
|
1435
|
+
},
|
|
1436
|
+
d.poolId
|
|
1437
|
+
)) });
|
|
1438
|
+
}
|
|
1439
|
+
function qa(t) {
|
|
1440
|
+
const { chain: a, onConnectRequest: n } = le(), r = t.onConnectRequest ?? n, s = yt(), g = xe(), [d, u] = L(t.defaultMode ?? "add"), [i, m] = L(null), [b, v] = L(0), w = t.onLiquidityChanged, k = A(
|
|
1441
|
+
() => _t(() => v((_) => _ + 1), w),
|
|
1442
|
+
[w]
|
|
1443
|
+
);
|
|
1444
|
+
return I(() => {
|
|
1445
|
+
const _ = s.data ?? [];
|
|
1446
|
+
_.length !== 0 && m((T) => T !== null ? T : (t.defaultPoolId ? _.find((c) => c.id === t.defaultPoolId) : void 0) ?? _[0] ?? null);
|
|
1447
|
+
}, [s.data, t.defaultPoolId]), /* @__PURE__ */ l(
|
|
1448
|
+
de,
|
|
1449
|
+
{
|
|
1450
|
+
title: t.title ?? "Liquidity",
|
|
1451
|
+
subtitle: `Latch Protocol · ${a.name}`,
|
|
1452
|
+
children: [
|
|
1453
|
+
/* @__PURE__ */ e(
|
|
1454
|
+
ca,
|
|
1455
|
+
{
|
|
1456
|
+
label: "Liquidity action",
|
|
1457
|
+
value: d,
|
|
1458
|
+
options: [
|
|
1459
|
+
{ value: "add", label: "Add" },
|
|
1460
|
+
{ value: "remove", label: "Remove" }
|
|
1461
|
+
],
|
|
1462
|
+
onChange: u
|
|
1463
|
+
}
|
|
1464
|
+
),
|
|
1465
|
+
/* @__PURE__ */ e(ma, { pools: s.data ?? [], value: i, onChange: m }),
|
|
1466
|
+
i === null ? /* @__PURE__ */ e(F, { message: "No pools are configured for this deployment." }) : d === "add" ? /* @__PURE__ */ e(ga, { pool: i, account: g.data, refreshKey: b, onChanged: k, ...r === void 0 ? {} : { onConnectRequest: r } }) : /* @__PURE__ */ e(fa, { pool: i, account: g.data, refreshKey: b, onChanged: k, ...r === void 0 ? {} : { onConnectRequest: r } })
|
|
1467
|
+
]
|
|
1468
|
+
}
|
|
1469
|
+
);
|
|
1470
|
+
}
|
|
1471
|
+
function ma(t) {
|
|
1472
|
+
return /* @__PURE__ */ l("div", { className: "latch-field", children: [
|
|
1473
|
+
/* @__PURE__ */ e("label", { className: "latch-label", htmlFor: "latch-pool-select", children: "Pool" }),
|
|
1474
|
+
/* @__PURE__ */ l(
|
|
1475
|
+
"select",
|
|
1476
|
+
{
|
|
1477
|
+
id: "latch-pool-select",
|
|
1478
|
+
className: "latch-select",
|
|
1479
|
+
style: { width: "100%", borderRadius: "var(--latch-radius-sm)" },
|
|
1480
|
+
value: t.value?.id ?? "",
|
|
1481
|
+
onChange: (a) => {
|
|
1482
|
+
const n = t.pools.find((r) => r.id === a.target.value);
|
|
1483
|
+
n !== void 0 && t.onChange(n);
|
|
1484
|
+
},
|
|
1485
|
+
children: [
|
|
1486
|
+
t.pools.length === 0 ? /* @__PURE__ */ e("option", { value: "", children: "No pools available" }) : null,
|
|
1487
|
+
t.pools.map((a) => /* @__PURE__ */ l("option", { value: a.id, children: [
|
|
1488
|
+
a.token0.symbol,
|
|
1489
|
+
"/",
|
|
1490
|
+
a.token1.symbol,
|
|
1491
|
+
" · ",
|
|
1492
|
+
a.poolType,
|
|
1493
|
+
" ·",
|
|
1494
|
+
" ",
|
|
1495
|
+
ta(a.lpFeePips) ? "dynamic fee" : Q(a.lpFeePips)
|
|
1496
|
+
] }, a.id))
|
|
1497
|
+
]
|
|
1498
|
+
}
|
|
1499
|
+
)
|
|
1500
|
+
] });
|
|
1501
|
+
}
|
|
1502
|
+
function ga(t) {
|
|
1503
|
+
const { pool: a, refreshKey: n } = t, r = Nt(a), s = r.refetch;
|
|
1504
|
+
I(() => {
|
|
1505
|
+
n > 0 && s();
|
|
1506
|
+
}, [n, s]);
|
|
1507
|
+
const [g, d] = L(null), [u, i] = L({ side: 0, text: "" }), [m, b] = L({ t0: "", t1: "" });
|
|
1508
|
+
I(() => {
|
|
1509
|
+
d(null);
|
|
1510
|
+
}, [a.id]), I(() => {
|
|
1511
|
+
if (g !== null) return;
|
|
1512
|
+
const z = r.data, j = Ct(
|
|
1513
|
+
a,
|
|
1514
|
+
z?.currentTick ?? null,
|
|
1515
|
+
z?.activeId ?? null
|
|
1516
|
+
);
|
|
1517
|
+
j !== null && d(j);
|
|
1518
|
+
}, [a, r.data, g]), I(() => {
|
|
1519
|
+
i({ side: 0, text: "" }), b({ t0: "", t1: "" });
|
|
1520
|
+
}, [a.id]);
|
|
1521
|
+
const v = r.data?.sqrtPriceX96 ?? null, w = g !== null && g.type === "CL" && v !== null ? g : null, k = w === null || v === null ? null : Tt(v, w.tickLower, w.tickUpper), { amount0Text: _, amount1Text: T } = A(() => {
|
|
1522
|
+
if (w === null || v === null || k === null) return { amount0Text: m.t0, amount1Text: m.t1 };
|
|
1523
|
+
const z = u.side === 0 ? a.token0.decimals : a.token1.decimals, j = u.side === 0 ? a.token1.decimals : a.token0.decimals, R = u.text;
|
|
1524
|
+
let Y = "";
|
|
1525
|
+
if (k === "both") {
|
|
1526
|
+
const ee = R.trim() === "" ? null : se(R, z);
|
|
1527
|
+
if (ee !== null && ee.ok) {
|
|
1528
|
+
const K = zt(v, w.tickLower, w.tickUpper, u.side === 0 ? "token0" : "token1", ee.value);
|
|
1529
|
+
Y = K === null ? "" : Ze(K, j);
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
return k === "token0-only" ? { amount0Text: u.side === 0 ? R : "", amount1Text: "0" } : k === "token1-only" ? { amount0Text: "0", amount1Text: u.side === 1 ? R : "" } : u.side === 0 ? { amount0Text: R, amount1Text: Y } : { amount0Text: Y, amount1Text: R };
|
|
1533
|
+
}, [w, v, k, u, m, a.token0.decimals, a.token1.decimals]), y = V((z) => {
|
|
1534
|
+
i({ side: 0, text: z }), b((j) => ({ ...j, t0: z }));
|
|
1535
|
+
}, []), c = V((z) => {
|
|
1536
|
+
i({ side: 1, text: z }), b((j) => ({ ...j, t1: z }));
|
|
1537
|
+
}, []), h = _.trim() === "" ? null : se(_, a.token0.decimals), o = T.trim() === "" ? null : se(T, a.token1.decimals), P = h !== null && h.ok ? h.value : null, M = o !== null && o.ok ? o.value : null, E = k === "token0-only" ? `This range sits above the current price, so it holds only ${a.token0.symbol}.` : k === "token1-only" ? `This range sits below the current price, so it holds only ${a.token1.symbol}.` : k === "both" ? "In range: enter either amount and the other is filled at the pool's current price." : null, $ = St({
|
|
1538
|
+
pool: a,
|
|
1539
|
+
range: g,
|
|
1540
|
+
amount0Desired: P,
|
|
1541
|
+
amount1Desired: M
|
|
1542
|
+
}), N = Lt({ quote: $.data ?? null, onSuccess: t.onChanged }), U = N.insufficient, ce = V(
|
|
1543
|
+
(z) => {
|
|
1544
|
+
if (z.preventDefault(), N.insufficient === null) {
|
|
1545
|
+
if (N.needsApproval) {
|
|
1546
|
+
N.approve();
|
|
1547
|
+
return;
|
|
1548
|
+
}
|
|
1549
|
+
N.execute();
|
|
1550
|
+
}
|
|
1551
|
+
},
|
|
1552
|
+
[N]
|
|
1553
|
+
), J = t.account === null ? "Connect wallet" : U !== null ? `Insufficient ${U.symbol}` : N.needsApproval ? `Approve ${N.approvals[0]?.token.symbol ?? ""}` : "Add liquidity", Z = N.step === "approving" || N.step === "building" || N.step === "awaiting-signature" || N.step === "pending";
|
|
1554
|
+
return /* @__PURE__ */ l("form", { onSubmit: ce, noValidate: !0, children: [
|
|
1555
|
+
g === null ? /* @__PURE__ */ e(F, { message: "Waiting for pool state to seed a default range." }) : /* @__PURE__ */ e(
|
|
1556
|
+
ba,
|
|
1557
|
+
{
|
|
1558
|
+
pool: a,
|
|
1559
|
+
range: g,
|
|
1560
|
+
onChange: d,
|
|
1561
|
+
currentTick: r.data?.currentTick ?? null,
|
|
1562
|
+
activeId: r.data?.activeId ?? null
|
|
1563
|
+
}
|
|
1564
|
+
),
|
|
1565
|
+
E !== null ? /* @__PURE__ */ e("p", { className: "latch-panel__note", children: E }) : null,
|
|
1566
|
+
/* @__PURE__ */ e(
|
|
1567
|
+
fe,
|
|
1568
|
+
{
|
|
1569
|
+
label: `Deposit ${a.token0.symbol}`,
|
|
1570
|
+
value: _,
|
|
1571
|
+
onValueChange: y,
|
|
1572
|
+
readOnly: k === "token1-only",
|
|
1573
|
+
token: a.token0,
|
|
1574
|
+
tokens: [a.token0],
|
|
1575
|
+
error: h !== null && !h.ok ? h.message : null
|
|
1576
|
+
}
|
|
1577
|
+
),
|
|
1578
|
+
/* @__PURE__ */ e(
|
|
1579
|
+
fe,
|
|
1580
|
+
{
|
|
1581
|
+
label: `Deposit ${a.token1.symbol}`,
|
|
1582
|
+
value: T,
|
|
1583
|
+
onValueChange: c,
|
|
1584
|
+
readOnly: k === "token0-only",
|
|
1585
|
+
token: a.token1,
|
|
1586
|
+
tokens: [a.token1],
|
|
1587
|
+
error: o !== null && !o.ok ? o.message : null
|
|
1588
|
+
}
|
|
1589
|
+
),
|
|
1590
|
+
$.data !== null && $.data !== void 0 ? /* @__PURE__ */ l(re, { children: [
|
|
1591
|
+
/* @__PURE__ */ e(
|
|
1592
|
+
S,
|
|
1593
|
+
{
|
|
1594
|
+
label: `${a.token0.symbol} deposited`,
|
|
1595
|
+
value: q($.data.amount0, a.token0.decimals)
|
|
1596
|
+
}
|
|
1597
|
+
),
|
|
1598
|
+
/* @__PURE__ */ e(
|
|
1599
|
+
S,
|
|
1600
|
+
{
|
|
1601
|
+
label: `${a.token1.symbol} deposited`,
|
|
1602
|
+
value: q($.data.amount1, a.token1.decimals)
|
|
1603
|
+
}
|
|
1604
|
+
),
|
|
1605
|
+
/* @__PURE__ */ e(S, { label: "Liquidity", value: $.data.liquidity.toString() }),
|
|
1606
|
+
/* @__PURE__ */ e(S, { label: "Range", value: qe($.data.range) }),
|
|
1607
|
+
$.data.binDistribution !== void 0 ? /* @__PURE__ */ e(
|
|
1608
|
+
S,
|
|
1609
|
+
{
|
|
1610
|
+
label: "Bins used",
|
|
1611
|
+
value: `${$.data.binDistribution.length}`
|
|
1612
|
+
}
|
|
1613
|
+
) : null
|
|
1614
|
+
] }) : null,
|
|
1615
|
+
/* @__PURE__ */ e(
|
|
1616
|
+
F,
|
|
1617
|
+
{
|
|
1618
|
+
message: N.statusMessage,
|
|
1619
|
+
tone: N.step === "error" ? "error" : N.step === "success" ? "success" : "neutral"
|
|
1620
|
+
}
|
|
1621
|
+
),
|
|
1622
|
+
/* @__PURE__ */ e(
|
|
1623
|
+
ve,
|
|
1624
|
+
{
|
|
1625
|
+
type: "submit",
|
|
1626
|
+
disabled: $.data === null || $.data === void 0 || Z || U !== null,
|
|
1627
|
+
busy: Z,
|
|
1628
|
+
needsConnect: t.account === null,
|
|
1629
|
+
...t.onConnectRequest === void 0 ? {} : { onConnectRequest: t.onConnectRequest },
|
|
1630
|
+
children: J
|
|
1631
|
+
}
|
|
1632
|
+
),
|
|
1633
|
+
/* @__PURE__ */ e(ke, { error: N.error !== null ? null : $.error, context: "liquidity" })
|
|
1634
|
+
] });
|
|
1635
|
+
}
|
|
1636
|
+
function ba(t) {
|
|
1637
|
+
const { pool: a, range: n } = t;
|
|
1638
|
+
if (n.type === "CL")
|
|
1639
|
+
return /* @__PURE__ */ l("fieldset", { className: "latch-field", style: { margin: 0 }, children: [
|
|
1640
|
+
/* @__PURE__ */ l("legend", { className: "latch-label", style: { padding: "0 4px" }, children: [
|
|
1641
|
+
"Price range (ticks, spacing ",
|
|
1642
|
+
ze(a),
|
|
1643
|
+
")"
|
|
1644
|
+
] }),
|
|
1645
|
+
/* @__PURE__ */ l("div", { className: "latch-range-grid", children: [
|
|
1646
|
+
/* @__PURE__ */ e("label", { className: "latch-visually-hidden", htmlFor: "latch-tick-lower", children: "Lower tick" }),
|
|
1647
|
+
/* @__PURE__ */ e(
|
|
1648
|
+
"input",
|
|
1649
|
+
{
|
|
1650
|
+
id: "latch-tick-lower",
|
|
1651
|
+
type: "number",
|
|
1652
|
+
step: ze(a),
|
|
1653
|
+
value: n.tickLower,
|
|
1654
|
+
onChange: (s) => t.onChange({
|
|
1655
|
+
type: "CL",
|
|
1656
|
+
tickLower: Number(s.target.value),
|
|
1657
|
+
tickUpper: n.tickUpper
|
|
1658
|
+
})
|
|
1659
|
+
}
|
|
1660
|
+
),
|
|
1661
|
+
/* @__PURE__ */ e("label", { className: "latch-visually-hidden", htmlFor: "latch-tick-upper", children: "Upper tick" }),
|
|
1662
|
+
/* @__PURE__ */ e(
|
|
1663
|
+
"input",
|
|
1664
|
+
{
|
|
1665
|
+
id: "latch-tick-upper",
|
|
1666
|
+
type: "number",
|
|
1667
|
+
step: ze(a),
|
|
1668
|
+
value: n.tickUpper,
|
|
1669
|
+
onChange: (s) => t.onChange({
|
|
1670
|
+
type: "CL",
|
|
1671
|
+
tickLower: n.tickLower,
|
|
1672
|
+
tickUpper: Number(s.target.value)
|
|
1673
|
+
})
|
|
1674
|
+
}
|
|
1675
|
+
)
|
|
1676
|
+
] }),
|
|
1677
|
+
/* @__PURE__ */ l("div", { className: "latch-meta", children: [
|
|
1678
|
+
/* @__PURE__ */ e("span", { children: t.currentTick === null ? "Current tick unknown" : `Current tick ${t.currentTick}` }),
|
|
1679
|
+
/* @__PURE__ */ l("span", { children: [
|
|
1680
|
+
/* @__PURE__ */ e(
|
|
1681
|
+
"button",
|
|
1682
|
+
{
|
|
1683
|
+
type: "button",
|
|
1684
|
+
className: "latch-chip",
|
|
1685
|
+
onClick: () => t.onChange(Ve(n, a, 5)),
|
|
1686
|
+
children: "Widen"
|
|
1687
|
+
}
|
|
1688
|
+
),
|
|
1689
|
+
" ",
|
|
1690
|
+
/* @__PURE__ */ e(
|
|
1691
|
+
"button",
|
|
1692
|
+
{
|
|
1693
|
+
type: "button",
|
|
1694
|
+
className: "latch-chip",
|
|
1695
|
+
onClick: () => t.onChange(Ve(n, a, -5)),
|
|
1696
|
+
children: "Narrow"
|
|
1697
|
+
}
|
|
1698
|
+
)
|
|
1699
|
+
] })
|
|
1700
|
+
] })
|
|
1701
|
+
] });
|
|
1702
|
+
const r = n.binIdUpper - n.binIdLower + 1;
|
|
1703
|
+
return /* @__PURE__ */ l("fieldset", { className: "latch-field", style: { margin: 0 }, children: [
|
|
1704
|
+
/* @__PURE__ */ l("legend", { className: "latch-label", style: { padding: "0 4px" }, children: [
|
|
1705
|
+
"Bin range (step ",
|
|
1706
|
+
Rt(a),
|
|
1707
|
+
")"
|
|
1708
|
+
] }),
|
|
1709
|
+
/* @__PURE__ */ l("label", { className: "latch-label", htmlFor: "latch-bin-width", children: [
|
|
1710
|
+
"Bins each side of active: ",
|
|
1711
|
+
Math.floor((r - 1) / 2)
|
|
1712
|
+
] }),
|
|
1713
|
+
/* @__PURE__ */ e(
|
|
1714
|
+
"input",
|
|
1715
|
+
{
|
|
1716
|
+
id: "latch-bin-width",
|
|
1717
|
+
className: "latch-slider",
|
|
1718
|
+
type: "range",
|
|
1719
|
+
min: 0,
|
|
1720
|
+
max: 30,
|
|
1721
|
+
value: Math.floor((r - 1) / 2),
|
|
1722
|
+
onChange: (s) => {
|
|
1723
|
+
const g = Number(s.target.value);
|
|
1724
|
+
t.onChange({
|
|
1725
|
+
type: "BIN",
|
|
1726
|
+
activeIdDesired: n.activeIdDesired,
|
|
1727
|
+
binIdLower: n.activeIdDesired - g,
|
|
1728
|
+
binIdUpper: n.activeIdDesired + g,
|
|
1729
|
+
idSlippage: n.idSlippage
|
|
1730
|
+
});
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
),
|
|
1734
|
+
/* @__PURE__ */ l("div", { className: "latch-meta", children: [
|
|
1735
|
+
/* @__PURE__ */ e("span", { children: qe(n) }),
|
|
1736
|
+
/* @__PURE__ */ e("span", { children: t.activeId === null ? "Active bin unknown" : `Active bin ${t.activeId}` })
|
|
1737
|
+
] })
|
|
1738
|
+
] });
|
|
1739
|
+
}
|
|
1740
|
+
function fa(t) {
|
|
1741
|
+
const a = Pt(t.account, t.pool, t.refreshKey), [n, r] = L(null), [s, g] = L(5e3), d = A(() => $t(a.data ?? []), [a.data]);
|
|
1742
|
+
I(() => {
|
|
1743
|
+
r((m) => qt(m, d));
|
|
1744
|
+
}, [d]);
|
|
1745
|
+
const u = It({ position: n, percentBps: s, onSuccess: t.onChanged }), i = V(
|
|
1746
|
+
(m) => {
|
|
1747
|
+
m.preventDefault(), u.execute();
|
|
1748
|
+
},
|
|
1749
|
+
[u]
|
|
1750
|
+
);
|
|
1751
|
+
return t.account === null ? /* @__PURE__ */ l(X, { children: [
|
|
1752
|
+
/* @__PURE__ */ e(F, { message: "Connect a wallet to see your positions." }),
|
|
1753
|
+
/* @__PURE__ */ e(ve, { needsConnect: !0, ...t.onConnectRequest === void 0 ? {} : { onConnectRequest: t.onConnectRequest }, children: "Connect wallet" })
|
|
1754
|
+
] }) : d.length === 0 ? /* @__PURE__ */ e(
|
|
1755
|
+
F,
|
|
1756
|
+
{
|
|
1757
|
+
message: a.status === "loading" ? "Loading your positions" : a.status === "error" ? a.error?.message ?? "Could not load positions" : "You have no positions in this pool.",
|
|
1758
|
+
tone: a.status === "error" ? "error" : "neutral"
|
|
1759
|
+
}
|
|
1760
|
+
) : /* @__PURE__ */ l("form", { onSubmit: i, noValidate: !0, children: [
|
|
1761
|
+
/* @__PURE__ */ l("div", { className: "latch-field", children: [
|
|
1762
|
+
/* @__PURE__ */ e("label", { className: "latch-label", htmlFor: "latch-position-select", children: "Position" }),
|
|
1763
|
+
/* @__PURE__ */ e(
|
|
1764
|
+
"select",
|
|
1765
|
+
{
|
|
1766
|
+
id: "latch-position-select",
|
|
1767
|
+
className: "latch-select",
|
|
1768
|
+
style: { width: "100%", borderRadius: "var(--latch-radius-sm)" },
|
|
1769
|
+
value: n?.id ?? "",
|
|
1770
|
+
onChange: (m) => {
|
|
1771
|
+
const b = d.find((v) => v.id === m.target.value);
|
|
1772
|
+
r(b ?? null);
|
|
1773
|
+
},
|
|
1774
|
+
children: d.map((m) => /* @__PURE__ */ e("option", { value: m.id, children: qe(m.range) }, m.id))
|
|
1775
|
+
}
|
|
1776
|
+
)
|
|
1777
|
+
] }),
|
|
1778
|
+
/* @__PURE__ */ l("div", { className: "latch-field", children: [
|
|
1779
|
+
/* @__PURE__ */ l("label", { className: "latch-label", htmlFor: "latch-remove-percent", children: [
|
|
1780
|
+
"Amount to withdraw: ",
|
|
1781
|
+
(s / 100).toFixed(0),
|
|
1782
|
+
"%"
|
|
1783
|
+
] }),
|
|
1784
|
+
/* @__PURE__ */ e(
|
|
1785
|
+
"input",
|
|
1786
|
+
{
|
|
1787
|
+
id: "latch-remove-percent",
|
|
1788
|
+
className: "latch-slider",
|
|
1789
|
+
type: "range",
|
|
1790
|
+
min: 1,
|
|
1791
|
+
max: 100,
|
|
1792
|
+
value: Math.round(s / 100),
|
|
1793
|
+
onChange: (m) => g(Number(m.target.value) * 100)
|
|
1794
|
+
}
|
|
1795
|
+
)
|
|
1796
|
+
] }),
|
|
1797
|
+
u.quote !== null ? /* @__PURE__ */ l(re, { children: [
|
|
1798
|
+
/* @__PURE__ */ e(
|
|
1799
|
+
S,
|
|
1800
|
+
{
|
|
1801
|
+
label: `${t.pool.token0.symbol} returned`,
|
|
1802
|
+
value: q(u.quote.amount0, t.pool.token0.decimals)
|
|
1803
|
+
}
|
|
1804
|
+
),
|
|
1805
|
+
/* @__PURE__ */ e(
|
|
1806
|
+
S,
|
|
1807
|
+
{
|
|
1808
|
+
label: `${t.pool.token1.symbol} returned`,
|
|
1809
|
+
value: q(u.quote.amount1, t.pool.token1.decimals)
|
|
1810
|
+
}
|
|
1811
|
+
)
|
|
1812
|
+
] }) : null,
|
|
1813
|
+
/* @__PURE__ */ e(
|
|
1814
|
+
F,
|
|
1815
|
+
{
|
|
1816
|
+
message: u.statusMessage,
|
|
1817
|
+
tone: u.step === "error" ? "error" : u.step === "success" ? "success" : "neutral"
|
|
1818
|
+
}
|
|
1819
|
+
),
|
|
1820
|
+
/* @__PURE__ */ e(
|
|
1821
|
+
ve,
|
|
1822
|
+
{
|
|
1823
|
+
type: "submit",
|
|
1824
|
+
disabled: n === null || u.quote === null,
|
|
1825
|
+
busy: u.step === "pending" || u.step === "awaiting-signature",
|
|
1826
|
+
children: "Remove liquidity"
|
|
1827
|
+
}
|
|
1828
|
+
),
|
|
1829
|
+
/* @__PURE__ */ e(ke, { error: u.error })
|
|
1830
|
+
] });
|
|
1831
|
+
}
|
|
1832
|
+
const va = [10, 50, 100];
|
|
1833
|
+
function xa(t) {
|
|
1834
|
+
const a = tt(), [n, r] = L(""), s = t.slippageBps === t.defaultSlippageBps && n === "", g = (i) => {
|
|
1835
|
+
r(i);
|
|
1836
|
+
const m = Number.parseFloat(i);
|
|
1837
|
+
if (!Number.isFinite(m) || m < 0) return;
|
|
1838
|
+
const b = Math.round(m * 100);
|
|
1839
|
+
b > At || t.onSlippageChange(b);
|
|
1840
|
+
}, d = t.slippageBps > 100, u = t.slippageBps < 5;
|
|
1841
|
+
return /* @__PURE__ */ l(me.Root, { children: [
|
|
1842
|
+
/* @__PURE__ */ e(me.Trigger, { asChild: !0, children: /* @__PURE__ */ l("button", { type: "button", className: "latch-icon-button latch-settings-trigger", "aria-label": "Swap settings", children: [
|
|
1843
|
+
/* @__PURE__ */ e("span", { "aria-hidden": "true", children: "⚙" }),
|
|
1844
|
+
/* @__PURE__ */ e("span", { className: "latch-settings-trigger__value", children: W(t.slippageBps) })
|
|
1845
|
+
] }) }),
|
|
1846
|
+
/* @__PURE__ */ e(me.Portal, { container: a, children: /* @__PURE__ */ l(me.Content, { className: "latch-popover", align: "end", sideOffset: 8, children: [
|
|
1847
|
+
/* @__PURE__ */ l("div", { className: "latch-popover__row", children: [
|
|
1848
|
+
/* @__PURE__ */ e("span", { className: "latch-label", children: "Max slippage" }),
|
|
1849
|
+
/* @__PURE__ */ e("span", { className: "latch-popover__value", children: s ? "Auto" : "Custom" })
|
|
1850
|
+
] }),
|
|
1851
|
+
/* @__PURE__ */ l("div", { className: "latch-field-row", children: [
|
|
1852
|
+
/* @__PURE__ */ e(
|
|
1853
|
+
"button",
|
|
1854
|
+
{
|
|
1855
|
+
type: "button",
|
|
1856
|
+
className: "latch-chip",
|
|
1857
|
+
"aria-pressed": s,
|
|
1858
|
+
onClick: () => {
|
|
1859
|
+
r(""), t.onSlippageChange(t.defaultSlippageBps);
|
|
1860
|
+
},
|
|
1861
|
+
children: "Auto"
|
|
1862
|
+
}
|
|
1863
|
+
),
|
|
1864
|
+
va.map((i) => /* @__PURE__ */ e(
|
|
1865
|
+
"button",
|
|
1866
|
+
{
|
|
1867
|
+
type: "button",
|
|
1868
|
+
className: "latch-chip",
|
|
1869
|
+
"aria-pressed": !s && n === "" && t.slippageBps === i,
|
|
1870
|
+
onClick: () => {
|
|
1871
|
+
r(""), t.onSlippageChange(i);
|
|
1872
|
+
},
|
|
1873
|
+
children: W(i)
|
|
1874
|
+
},
|
|
1875
|
+
i
|
|
1876
|
+
)),
|
|
1877
|
+
/* @__PURE__ */ l("label", { className: "latch-custom-slippage", children: [
|
|
1878
|
+
/* @__PURE__ */ e("input", { type: "text", inputMode: "decimal", placeholder: "0.50", "aria-label": "Custom slippage, percent", value: n, onChange: (i) => g(i.target.value) }),
|
|
1879
|
+
/* @__PURE__ */ e("span", { children: "%" })
|
|
1880
|
+
] })
|
|
1881
|
+
] }),
|
|
1882
|
+
d ? /* @__PURE__ */ e("p", { className: "latch-note latch-note--warn", children: "Above 1%: a transaction may be front-run for the difference." }) : null,
|
|
1883
|
+
u ? /* @__PURE__ */ e("p", { className: "latch-note latch-note--warn", children: "Below 0.05%: the transaction is likely to revert on a moving price." }) : null,
|
|
1884
|
+
/* @__PURE__ */ l("p", { className: "latch-note", children: [
|
|
1885
|
+
"The transaction reverts if the received amount falls below the minimum shown in the details. Auto is ",
|
|
1886
|
+
W(t.defaultSlippageBps),
|
|
1887
|
+
"."
|
|
1888
|
+
] })
|
|
1889
|
+
] }) })
|
|
1890
|
+
] });
|
|
1891
|
+
}
|
|
1892
|
+
const ka = /^0x[0-9a-fA-F]{40}$/;
|
|
1893
|
+
function ie(t) {
|
|
1894
|
+
const a = t.size ?? 24, n = t.token, r = Ft(n?.logoUrl), [s, g] = L(null);
|
|
1895
|
+
if (r !== null && s !== r)
|
|
1896
|
+
return /* @__PURE__ */ e("img", { className: "latch-token-logo", src: r, alt: "", width: a, height: a, referrerPolicy: "no-referrer", onError: () => g(r) });
|
|
1897
|
+
const d = (n?.symbol ?? "?").slice(0, 4).toUpperCase();
|
|
1898
|
+
return /* @__PURE__ */ e(
|
|
1899
|
+
"span",
|
|
1900
|
+
{
|
|
1901
|
+
className: "latch-token-logo latch-token-logo--initials",
|
|
1902
|
+
style: { width: a, height: a, fontSize: Math.round(a * (d.length > 3 ? 0.3 : 0.38)), "--latch-mono-hue": String(wa(n?.address ?? d)) },
|
|
1903
|
+
"aria-hidden": "true",
|
|
1904
|
+
children: d
|
|
1905
|
+
}
|
|
1906
|
+
);
|
|
1907
|
+
}
|
|
1908
|
+
function wa(t) {
|
|
1909
|
+
let a = 2166136261;
|
|
1910
|
+
const n = t.toLowerCase();
|
|
1911
|
+
for (let r = 0; r < n.length; r++) a = Math.imul(a ^ n.charCodeAt(r), 16777619);
|
|
1912
|
+
return (a >>> 0) % 360;
|
|
1913
|
+
}
|
|
1914
|
+
function ya() {
|
|
1915
|
+
return /* @__PURE__ */ l("svg", { className: "latch-search-wrap__icon", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": "true", children: [
|
|
1916
|
+
/* @__PURE__ */ e("circle", { cx: "11", cy: "11", r: "7" }),
|
|
1917
|
+
/* @__PURE__ */ e("path", { d: "m20 20-3.5-3.5" })
|
|
1918
|
+
] });
|
|
1919
|
+
}
|
|
1920
|
+
function _a(t) {
|
|
1921
|
+
const a = t.token, n = [];
|
|
1922
|
+
return a.stock !== void 0 && (n.push({ key: "stock", label: `${a.stock.issuer} · ${a.stock.ticker}`, tone: "info", title: `Tokenised stock issued by ${a.stock.issuer} (underlying ${a.stock.ticker}). The issuer can pause transfers and upgrade the token.` }), a.stock.rebasing && n.push({ key: "rebasing", label: "rebasing", tone: "warn", title: "The issuer rescales balances. Not usable as a Latch pool currency." })), a.tags?.includes("test") && n.push({ key: "test", label: "test token", tone: "muted", title: "A throwaway token with no economic meaning." }), a.tags?.includes("launch") && n.push({ key: "launch", label: "launch", tone: "muted", title: "Minted by a LaunchpadKitV2 launch; its launch pools are locked forever." }), n.length === 0 ? null : /* @__PURE__ */ e("span", { className: "latch-token-row__badges", children: n.map((r) => /* @__PURE__ */ e("span", { className: "latch-badge", "data-latch-tone": r.tone, title: r.title, children: r.label }, r.key)) });
|
|
1923
|
+
}
|
|
1924
|
+
function Ke(t) {
|
|
1925
|
+
return /* @__PURE__ */ l("span", { className: "latch-token-button latch-token-button--locked", role: "img", "aria-label": `${t.label}: ${t.value?.symbol ?? "loading"} (fixed)`, title: "This pair is fixed on this page", children: [
|
|
1926
|
+
/* @__PURE__ */ e(ie, { token: t.value }),
|
|
1927
|
+
/* @__PURE__ */ e("span", { className: "latch-token-button__symbol", children: t.value?.symbol ?? "…" })
|
|
1928
|
+
] });
|
|
1929
|
+
}
|
|
1930
|
+
function Ge(t) {
|
|
1931
|
+
const { adapter: a } = le(), n = tt(), r = xe(), [s, g] = L(!1), [d, u] = L(""), [i, m] = L({}), [b, v] = L("none");
|
|
1932
|
+
I(() => {
|
|
1933
|
+
if (!s || r.data === null || r.data === void 0) return;
|
|
1934
|
+
let c = !1;
|
|
1935
|
+
const h = r.data;
|
|
1936
|
+
return Promise.all(
|
|
1937
|
+
t.tokens.map(async (o) => {
|
|
1938
|
+
try {
|
|
1939
|
+
return [o.address.toLowerCase(), await a.getBalance(o, h)];
|
|
1940
|
+
} catch {
|
|
1941
|
+
return null;
|
|
1942
|
+
}
|
|
1943
|
+
})
|
|
1944
|
+
).then((o) => {
|
|
1945
|
+
if (c) return;
|
|
1946
|
+
const P = {};
|
|
1947
|
+
for (const M of o) M !== null && (P[M[0]] = M[1]);
|
|
1948
|
+
m(P);
|
|
1949
|
+
}), () => {
|
|
1950
|
+
c = !0;
|
|
1951
|
+
};
|
|
1952
|
+
}, [s, r.data, t.tokens, a]), I(() => {
|
|
1953
|
+
const c = d.trim();
|
|
1954
|
+
if (!ka.test(c)) {
|
|
1955
|
+
v("none");
|
|
1956
|
+
return;
|
|
1957
|
+
}
|
|
1958
|
+
if (t.tokens.some((o) => o.address.toLowerCase() === c.toLowerCase())) {
|
|
1959
|
+
v("none");
|
|
1960
|
+
return;
|
|
1961
|
+
}
|
|
1962
|
+
let h = !1;
|
|
1963
|
+
return v("loading"), a.getToken(c).then((o) => !h && v(o)).catch(() => !h && v(null)), () => {
|
|
1964
|
+
h = !0;
|
|
1965
|
+
};
|
|
1966
|
+
}, [d, t.tokens, a]);
|
|
1967
|
+
const w = A(() => {
|
|
1968
|
+
const c = d.trim().toLowerCase();
|
|
1969
|
+
return [...c === "" ? t.tokens : t.tokens.filter(
|
|
1970
|
+
(o) => o.symbol.toLowerCase().includes(c) || o.name.toLowerCase().includes(c) || o.address.toLowerCase() === c || o.stock !== void 0 && (o.stock.ticker.toLowerCase().includes(c) || o.stock.issuer.toLowerCase().includes(c))
|
|
1971
|
+
)].sort((o, P) => {
|
|
1972
|
+
const M = i[o.address.toLowerCase()] ?? 0n, E = i[P.address.toLowerCase()] ?? 0n;
|
|
1973
|
+
return M === E ? 0 : M > E ? -1 : 1;
|
|
1974
|
+
});
|
|
1975
|
+
}, [t.tokens, d, i]), k = A(() => w.some((c) => c.listSource !== void 0) ? Bt(w) : null, [w]), _ = t.tokens.slice(0, 5), T = (c) => {
|
|
1976
|
+
t.onChange(c), g(!1), u("");
|
|
1977
|
+
}, y = (c) => {
|
|
1978
|
+
const h = i[c.address.toLowerCase()], o = t.exclude?.address.toLowerCase() === c.address.toLowerCase(), P = c.listSource?.alsoIn ?? [];
|
|
1979
|
+
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ l("button", { type: "button", className: "latch-token-row", onClick: () => T(c), disabled: o, "aria-selected": t.value?.address === c.address, role: "option", children: [
|
|
1980
|
+
/* @__PURE__ */ e(ie, { token: c, size: 32 }),
|
|
1981
|
+
/* @__PURE__ */ l("span", { className: "latch-token-row__main", children: [
|
|
1982
|
+
/* @__PURE__ */ l("span", { className: "latch-token-row__symbol", children: [
|
|
1983
|
+
c.symbol,
|
|
1984
|
+
/* @__PURE__ */ e(_a, { token: c })
|
|
1985
|
+
] }),
|
|
1986
|
+
/* @__PURE__ */ l("span", { className: "latch-token-row__name", children: [
|
|
1987
|
+
c.name,
|
|
1988
|
+
c.isNative ? "" : ` · ${H(c.address)}`,
|
|
1989
|
+
P.length > 0 ? ` · also in ${P.join(", ")}` : ""
|
|
1990
|
+
] })
|
|
1991
|
+
] }),
|
|
1992
|
+
h !== void 0 && h > 0n ? /* @__PURE__ */ l("span", { className: "latch-token-row__balance", children: [
|
|
1993
|
+
/* @__PURE__ */ e("span", { children: q(h, c.decimals) }),
|
|
1994
|
+
/* @__PURE__ */ e("span", { className: "latch-token-row__balance-sym", children: c.symbol })
|
|
1995
|
+
] }) : null,
|
|
1996
|
+
t.value?.address.toLowerCase() === c.address.toLowerCase() ? /* @__PURE__ */ e("span", { className: "latch-token-row__check", "aria-hidden": "true", children: "✓" }) : null
|
|
1997
|
+
] }) }, c.address);
|
|
1998
|
+
};
|
|
1999
|
+
return /* @__PURE__ */ l(ae.Root, { open: s, onOpenChange: g, children: [
|
|
2000
|
+
/* @__PURE__ */ e(ae.Trigger, { asChild: !0, children: /* @__PURE__ */ l("button", { type: "button", className: "latch-token-button", "aria-label": `${t.label}: ${t.value?.symbol ?? "choose a token"}`, children: [
|
|
2001
|
+
/* @__PURE__ */ e(ie, { token: t.value }),
|
|
2002
|
+
/* @__PURE__ */ e("span", { className: "latch-token-button__symbol", children: t.value?.symbol ?? "Select" }),
|
|
2003
|
+
/* @__PURE__ */ e("span", { className: "latch-token-button__chevron", "aria-hidden": "true", children: "▾" })
|
|
2004
|
+
] }) }),
|
|
2005
|
+
/* @__PURE__ */ l(ae.Portal, { container: n, children: [
|
|
2006
|
+
/* @__PURE__ */ e(ae.Overlay, { className: "latch-overlay" }),
|
|
2007
|
+
/* @__PURE__ */ l(ae.Content, { className: "latch-dialog", "aria-describedby": void 0, children: [
|
|
2008
|
+
/* @__PURE__ */ l("div", { className: "latch-dialog__head", children: [
|
|
2009
|
+
/* @__PURE__ */ l(ae.Title, { className: "latch-dialog__title", children: [
|
|
2010
|
+
"Select a token ",
|
|
2011
|
+
/* @__PURE__ */ e("span", { className: "latch-dialog__count", children: t.tokens.length })
|
|
2012
|
+
] }),
|
|
2013
|
+
/* @__PURE__ */ e(ae.Close, { className: "latch-icon-button", "aria-label": "Close", children: "×" })
|
|
2014
|
+
] }),
|
|
2015
|
+
/* @__PURE__ */ l("div", { className: "latch-search-wrap", children: [
|
|
2016
|
+
/* @__PURE__ */ e(ya, {}),
|
|
2017
|
+
/* @__PURE__ */ e(
|
|
2018
|
+
"input",
|
|
2019
|
+
{
|
|
2020
|
+
className: "latch-search",
|
|
2021
|
+
type: "text",
|
|
2022
|
+
autoFocus: !0,
|
|
2023
|
+
placeholder: "Search or paste an address",
|
|
2024
|
+
"aria-label": "Search tokens",
|
|
2025
|
+
value: d,
|
|
2026
|
+
onChange: (c) => u(c.target.value),
|
|
2027
|
+
spellCheck: !1,
|
|
2028
|
+
autoComplete: "off"
|
|
2029
|
+
}
|
|
2030
|
+
),
|
|
2031
|
+
d !== "" ? /* @__PURE__ */ e("button", { type: "button", className: "latch-search-wrap__clear", "aria-label": "Clear search", onClick: () => u(""), children: "×" }) : null
|
|
2032
|
+
] }),
|
|
2033
|
+
d === "" && _.length > 0 ? /* @__PURE__ */ e("div", { className: "latch-common", children: _.map((c) => /* @__PURE__ */ l("button", { type: "button", className: "latch-chip latch-chip--token", onClick: () => T(c), "aria-pressed": t.value?.address === c.address, children: [
|
|
2034
|
+
/* @__PURE__ */ e(ie, { token: c, size: 18 }),
|
|
2035
|
+
" ",
|
|
2036
|
+
c.symbol
|
|
2037
|
+
] }, c.address)) }) : null,
|
|
2038
|
+
/* @__PURE__ */ l("ul", { className: "latch-token-list", role: "listbox", "aria-label": "Tokens", children: [
|
|
2039
|
+
b === "loading" ? /* @__PURE__ */ e("li", { className: "latch-token-row latch-token-row--note", children: "Reading the token contract…" }) : null,
|
|
2040
|
+
b === null ? /* @__PURE__ */ e("li", { className: "latch-token-row latch-token-row--note", children: "That address does not answer as an ERC-20." }) : null,
|
|
2041
|
+
b !== "none" && b !== "loading" && b !== null ? /* @__PURE__ */ e("li", { children: /* @__PURE__ */ l("button", { type: "button", className: "latch-token-row latch-token-row--unlisted", onClick: () => T(b), children: [
|
|
2042
|
+
/* @__PURE__ */ e(ie, { token: b, size: 32 }),
|
|
2043
|
+
/* @__PURE__ */ l("span", { className: "latch-token-row__main", children: [
|
|
2044
|
+
/* @__PURE__ */ l("span", { className: "latch-token-row__symbol", children: [
|
|
2045
|
+
b.symbol,
|
|
2046
|
+
/* @__PURE__ */ e("span", { className: "latch-token-row__badges", children: /* @__PURE__ */ e("span", { className: "latch-badge", "data-latch-tone": "warn", title: "Read off the contract at this address. It is in none of this site's lists: check the address yourself before trading.", children: "unlisted" }) })
|
|
2047
|
+
] }),
|
|
2048
|
+
/* @__PURE__ */ l("span", { className: "latch-token-row__name", children: [
|
|
2049
|
+
b.name,
|
|
2050
|
+
" · ",
|
|
2051
|
+
H(b.address),
|
|
2052
|
+
" · not in any of this site’s lists"
|
|
2053
|
+
] })
|
|
2054
|
+
] })
|
|
2055
|
+
] }) }) : null,
|
|
2056
|
+
k === null ? (() => {
|
|
2057
|
+
const c = w.filter((o) => (i[o.address.toLowerCase()] ?? 0n) > 0n), h = w.filter((o) => (i[o.address.toLowerCase()] ?? 0n) === 0n);
|
|
2058
|
+
return c.length === 0 ? w.map(y) : /* @__PURE__ */ l(X, { children: [
|
|
2059
|
+
/* @__PURE__ */ l("li", { className: "latch-token-group", children: [
|
|
2060
|
+
/* @__PURE__ */ e("span", { className: "latch-token-group__label", role: "presentation", children: "Your tokens" }),
|
|
2061
|
+
/* @__PURE__ */ e("ul", { className: "latch-token-group__list", role: "group", "aria-label": "Your tokens", children: c.map(y) })
|
|
2062
|
+
] }),
|
|
2063
|
+
h.length > 0 ? /* @__PURE__ */ l("li", { className: "latch-token-group", children: [
|
|
2064
|
+
/* @__PURE__ */ e("span", { className: "latch-token-group__label", role: "presentation", children: "All tokens" }),
|
|
2065
|
+
/* @__PURE__ */ e("ul", { className: "latch-token-group__list", role: "group", "aria-label": "All tokens", children: h.map(y) })
|
|
2066
|
+
] }) : null
|
|
2067
|
+
] });
|
|
2068
|
+
})() : k.map((c) => /* @__PURE__ */ l("li", { className: "latch-token-group", children: [
|
|
2069
|
+
/* @__PURE__ */ e("span", { className: "latch-token-group__label", role: "presentation", children: c.source ?? "Pools on this site" }),
|
|
2070
|
+
/* @__PURE__ */ e("ul", { className: "latch-token-group__list", role: "group", "aria-label": c.source ?? "Pools on this site", children: c.tokens.map(y) })
|
|
2071
|
+
] }, c.source ?? "__adapter")),
|
|
2072
|
+
w.length === 0 && b === "none" ? /* @__PURE__ */ l("li", { className: "latch-token-row latch-token-row--note latch-token-row--empty", children: [
|
|
2073
|
+
"No token matches “",
|
|
2074
|
+
d.trim(),
|
|
2075
|
+
"”. Paste a contract address to look it up."
|
|
2076
|
+
] }) : null,
|
|
2077
|
+
t.listsLoading === !0 ? /* @__PURE__ */ e("li", { className: "latch-token-row latch-token-row--note", children: "Loading token lists…" }) : null,
|
|
2078
|
+
(t.listFailures ?? []).map((c) => /* @__PURE__ */ l("li", { className: "latch-token-row latch-token-row--note", title: c.message, children: [
|
|
2079
|
+
"A token list did not load: ",
|
|
2080
|
+
c.url
|
|
2081
|
+
] }, c.url))
|
|
2082
|
+
] })
|
|
2083
|
+
] })
|
|
2084
|
+
] })
|
|
2085
|
+
] });
|
|
2086
|
+
}
|
|
2087
|
+
const Xe = 1500;
|
|
2088
|
+
function Na(t, a) {
|
|
2089
|
+
const { adapter: n } = le(), r = Xt(t), s = A(() => t === void 0 ? null : Jt(t), [r]), [g, d] = L({}), u = oe({ adapter: n, addresses: /* @__PURE__ */ new Set() }), i = oe(!0);
|
|
2090
|
+
I(() => (i.current = !0, () => {
|
|
2091
|
+
i.current = !1;
|
|
2092
|
+
}), []);
|
|
2093
|
+
const m = A(() => s === null ? null : { token: He(s.token, a), quote: He(s.quote, a) }, [s, a]);
|
|
2094
|
+
return I(() => {
|
|
2095
|
+
if (!(s === null || m === null)) {
|
|
2096
|
+
u.current.adapter !== n && (u.current = { adapter: n, addresses: /* @__PURE__ */ new Set() });
|
|
2097
|
+
for (const b of ["token", "quote"]) {
|
|
2098
|
+
const v = s[b];
|
|
2099
|
+
if (m[b] !== null || typeof v != "string") continue;
|
|
2100
|
+
const w = v.toLowerCase();
|
|
2101
|
+
u.current.addresses.has(w) || (u.current.addresses.add(w), n.getToken(w).then((k) => i.current && d((_) => ({ ..._, [w]: k }))).catch(() => i.current && d((k) => ({ ...k, [w]: null }))));
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
}, [n, s, m]), A(() => {
|
|
2105
|
+
if (s === null || m === null) return null;
|
|
2106
|
+
const b = (v) => m[v] ?? (typeof s[v] == "string" ? g[s[v].toLowerCase()] ?? null : null);
|
|
2107
|
+
return { token: b("token"), quote: b("quote") };
|
|
2108
|
+
}, [s, m, g]);
|
|
2109
|
+
}
|
|
2110
|
+
const Ia = pt(function(a, n) {
|
|
2111
|
+
const { integrator: r, defaultSlippageBps: s, chain: g, onConnectRequest: d } = le(), u = a.onConnectRequest ?? d, i = Mt(), m = Ot(a.tokenLists), b = xe(), v = A(() => Et(i.data ?? [], m.tokens), [i.data, m.tokens]), w = Qe(a.portions), k = a.pair !== void 0 && a.lockPair === !0, _ = a.variant === "compact", [T, y] = mt(jt, { ...a.pair === void 0 ? {} : { pair: a.pair }, ...a.side === void 0 ? {} : { side: a.side } }, Dt), c = a.side ?? T.side, { tokenIn: h, tokenOut: o } = Ut(T.anchor, c), { amountText: P, impactAck: M } = T, [E, $] = L(s), [N, U] = L(!1), [ce, J] = L(!1);
|
|
2112
|
+
I(() => {
|
|
2113
|
+
if (a.side === void 0) return;
|
|
2114
|
+
const p = ye.current;
|
|
2115
|
+
ye.current = null, y({ type: "set-side", side: a.side, ...p !== null && p.side === a.side ? { amountText: p.text } : {} });
|
|
2116
|
+
}, [a.side]);
|
|
2117
|
+
const Z = Na(a.pair, v);
|
|
2118
|
+
I(() => {
|
|
2119
|
+
Z !== null && y({ type: "pin", anchor: Z });
|
|
2120
|
+
}, [Z]), I(() => {
|
|
2121
|
+
a.pair !== void 0 || v.length === 0 || y({
|
|
2122
|
+
type: "seed",
|
|
2123
|
+
tokens: v,
|
|
2124
|
+
side: c,
|
|
2125
|
+
...a.defaultTokenIn === void 0 ? {} : { defaultTokenIn: a.defaultTokenIn },
|
|
2126
|
+
...a.defaultTokenOut === void 0 ? {} : { defaultTokenOut: a.defaultTokenOut }
|
|
2127
|
+
});
|
|
2128
|
+
}, [v, a.pair, a.defaultTokenIn, a.defaultTokenOut, c]);
|
|
2129
|
+
const z = V((p) => y({ type: "amount", text: p }), []), j = V((p) => y({ type: "ack", value: p }), []), R = A(() => h === null || P.trim() === "" ? null : se(P, h.decimals), [P, h]), Y = R !== null && R.ok ? R.value : null, ee = R !== null && !R.ok ? R.message : null, K = Le(h, b.data), Ie = Le(o, b.data), f = Wt({ tokenIn: h, tokenOut: o, amountIn: Y, slippageBps: E }), Re = f.status !== "idle", x = Re ? f.breakdown : null, G = Re ? f.quote : null, C = Vt({
|
|
2130
|
+
tokenIn: h,
|
|
2131
|
+
tokenOut: o,
|
|
2132
|
+
amountIn: Y,
|
|
2133
|
+
quote: G,
|
|
2134
|
+
breakdown: x,
|
|
2135
|
+
...a.onSwapConfirmed ? { onSuccess: a.onSwapConfirmed } : {}
|
|
2136
|
+
}), we = oe(a.onSideChange);
|
|
2137
|
+
we.current = a.onSideChange;
|
|
2138
|
+
const he = a.side !== void 0, ye = oe(null), _e = V(() => {
|
|
2139
|
+
const p = Zt(c), D = x !== null && o !== null && x.netAmountOut > 0n ? Ze(x.netAmountOut, o.decimals) : "";
|
|
2140
|
+
he ? ye.current = { side: p, text: D } : y({ type: "set-side", side: p, amountText: D }), J(!1), we.current?.(p);
|
|
2141
|
+
}, [c, he, x, o]), Ae = V(
|
|
2142
|
+
(p) => {
|
|
2143
|
+
p !== c && (he || y({ type: "set-side", side: p }), J(!1), we.current?.(p));
|
|
2144
|
+
},
|
|
2145
|
+
[c, he]
|
|
2146
|
+
), Be = oe(a.onNeedsWallet);
|
|
2147
|
+
Be.current = a.onNeedsWallet;
|
|
2148
|
+
const Ne = V(
|
|
2149
|
+
(p) => {
|
|
2150
|
+
const D = Qt(h, K.data, p);
|
|
2151
|
+
return D === null ? (Be.current?.(), !1) : (z(D), !0);
|
|
2152
|
+
},
|
|
2153
|
+
[h, K.data, z]
|
|
2154
|
+
);
|
|
2155
|
+
gt(
|
|
2156
|
+
n,
|
|
2157
|
+
() => ({
|
|
2158
|
+
setAmountIn: z,
|
|
2159
|
+
setPortion: (p) => (Qe([p]), Ne(p)),
|
|
2160
|
+
flip: _e,
|
|
2161
|
+
refreshQuote: f.refetch
|
|
2162
|
+
}),
|
|
2163
|
+
[z, Ne, _e, f.refetch]
|
|
2164
|
+
);
|
|
2165
|
+
const Fe = A(
|
|
2166
|
+
() => Ht({
|
|
2167
|
+
tokenIn: h,
|
|
2168
|
+
tokenOut: o,
|
|
2169
|
+
quote: G,
|
|
2170
|
+
breakdown: x,
|
|
2171
|
+
rate: f.rate,
|
|
2172
|
+
status: f.status,
|
|
2173
|
+
isRefreshing: f.isRefreshing,
|
|
2174
|
+
isMock: f.isMock,
|
|
2175
|
+
updatedAt: f.updatedAt
|
|
2176
|
+
}),
|
|
2177
|
+
[h, o, G, x, f.rate, f.status, f.isRefreshing, f.isMock, f.updatedAt]
|
|
2178
|
+
), Ce = oe(a.onQuote);
|
|
2179
|
+
Ce.current = a.onQuote, I(() => {
|
|
2180
|
+
Ce.current?.(Fe);
|
|
2181
|
+
}, [Fe]), I(
|
|
2182
|
+
() => () => {
|
|
2183
|
+
Ce.current?.(null);
|
|
2184
|
+
},
|
|
2185
|
+
[]
|
|
2186
|
+
);
|
|
2187
|
+
const nt = Y !== null && K.data !== null && Y > K.data, te = x?.priceImpactBps ?? null, Me = te !== null && te >= Xe && !M, ot = V(
|
|
2188
|
+
(p) => {
|
|
2189
|
+
if (p.preventDefault(), C.needsApproval) {
|
|
2190
|
+
C.approve();
|
|
2191
|
+
return;
|
|
2192
|
+
}
|
|
2193
|
+
C.execute();
|
|
2194
|
+
},
|
|
2195
|
+
[C]
|
|
2196
|
+
), ue = x === null || o === null ? "" : q(x.netAmountOut, o.decimals), Oe = A(() => G === null ? [] : Yt(G.route), [G]), rt = C.statusMessage !== "" ? C.statusMessage : f.status === "error" ? f.error === null ? "No route for this pair." : Je(f.error, "quote") : "", ct = C.step === "error" || f.status === "error" ? "error" : C.step === "success" ? "success" : "neutral", pe = C.step === "approving" || C.step === "building" || C.step === "awaiting-signature" || C.step === "pending";
|
|
2197
|
+
let O, Te = !1;
|
|
2198
|
+
const Ee = b.data === null || b.data === void 0;
|
|
2199
|
+
Ee ? O = "Connect wallet" : h === null || o === null ? O = "Select a token" : Y === null || Y === 0n ? O = "Enter an amount" : ee !== null ? O = ee : nt ? O = `Insufficient ${h.symbol}` : (f.status === "loading" || f.status === "idle" && f.isRefreshing) && x === null ? O = "Fetching quote…" : f.status === "error" ? O = "Cannot quote this trade" : C.needsApproval ? (O = `Approve ${C.approvals[0]?.token.symbol ?? h.symbol}`, Te = !pe) : pe ? O = C.step === "pending" ? "Confirming on chain…" : C.step === "awaiting-signature" ? "Confirm in your wallet…" : "Preparing…" : Me ? O = "Acknowledge the price impact" : (O = "Swap", Te = C.canExecute && f.status === "success");
|
|
2200
|
+
const it = f.rate === null || h === null || o === null || f.rate === 0 ? null : ce ? Pe(1 / f.rate, o.symbol, h.symbol) : Pe(f.rate, h.symbol, o.symbol), je = C.txHash === null ? null : Kt(g, C.txHash), ne = a.creatorTax === void 0 ? void 0 : a.creatorTax === null ? null : c === "buy" ? a.creatorTax.buyBps : a.creatorTax.sellBps, De = ne === void 0 ? "" : ne === null || ne === 0 ? "none" : W(ne), Ue = "Taken by the launch pool's hook on this swap, for the creator and the protocol. The quoted output already includes it.", st = a.showSlippageControl !== !1 ? /* @__PURE__ */ e(xa, { slippageBps: E, defaultSlippageBps: s, onSlippageChange: $ }) : void 0, We = _ ? /* @__PURE__ */ l("div", { className: "latch-sides", role: "group", "aria-label": "Buy or sell", children: [
|
|
2201
|
+
/* @__PURE__ */ e("button", { type: "button", className: "latch-sides__btn", "data-latch-side": "buy", "aria-pressed": c === "buy", onClick: () => Ae("buy"), children: "Buy" }),
|
|
2202
|
+
/* @__PURE__ */ e("button", { type: "button", className: "latch-sides__btn", "data-latch-side": "sell", "aria-pressed": c === "sell", onClick: () => Ae("sell"), children: "Sell" })
|
|
2203
|
+
] }) : void 0, dt = w.length > 0 && K.data !== null && h !== null ? /* @__PURE__ */ e("div", { className: "latch-portions", role: "group", "aria-label": "Quick amounts", children: w.map((p) => {
|
|
2204
|
+
const D = Gt(p);
|
|
2205
|
+
return /* @__PURE__ */ e("button", { type: "button", className: "latch-portion", "aria-label": `${D} of your ${h.symbol} balance`, onClick: () => Ne(p), children: D }, p);
|
|
2206
|
+
}) }) : null;
|
|
2207
|
+
return /* @__PURE__ */ l(
|
|
2208
|
+
de,
|
|
2209
|
+
{
|
|
2210
|
+
title: a.title ?? "Swap",
|
|
2211
|
+
className: "latch-swap",
|
|
2212
|
+
headerAction: st,
|
|
2213
|
+
...We === void 0 ? {} : { headerContent: We },
|
|
2214
|
+
children: [
|
|
2215
|
+
a.slots?.header !== void 0 ? /* @__PURE__ */ e("div", { className: "latch-slot latch-slot--header", children: a.slots.header }) : null,
|
|
2216
|
+
/* @__PURE__ */ l("form", { onSubmit: ot, noValidate: !0, className: "latch-swap__form", "data-latch-swap-side": c, "data-latch-variant": _ ? "compact" : "default", "data-latch-pair-locked": k ? "true" : void 0, children: [
|
|
2217
|
+
/* @__PURE__ */ l("div", { className: "latch-panel", "data-latch-side": "sell", children: [
|
|
2218
|
+
/* @__PURE__ */ l("div", { className: "latch-panel__top", children: [
|
|
2219
|
+
/* @__PURE__ */ e("span", { className: "latch-label", children: "You pay" }),
|
|
2220
|
+
K.data !== null && h !== null ? /* @__PURE__ */ l("span", { className: "latch-panel__balance", children: [
|
|
2221
|
+
"Balance ",
|
|
2222
|
+
q(K.data, h.decimals)
|
|
2223
|
+
] }) : null
|
|
2224
|
+
] }),
|
|
2225
|
+
/* @__PURE__ */ l("div", { className: "latch-panel__main", children: [
|
|
2226
|
+
/* @__PURE__ */ e(
|
|
2227
|
+
"input",
|
|
2228
|
+
{
|
|
2229
|
+
className: "latch-big-input",
|
|
2230
|
+
type: "text",
|
|
2231
|
+
inputMode: "decimal",
|
|
2232
|
+
autoComplete: "off",
|
|
2233
|
+
spellCheck: !1,
|
|
2234
|
+
placeholder: "0",
|
|
2235
|
+
"aria-label": `Amount of ${h?.symbol ?? "the input token"} to sell`,
|
|
2236
|
+
value: P,
|
|
2237
|
+
onChange: (p) => z(p.target.value.replace(/,/g, "."))
|
|
2238
|
+
}
|
|
2239
|
+
),
|
|
2240
|
+
k ? /* @__PURE__ */ e(Ke, { label: "Sell", value: h }) : /* @__PURE__ */ e(Ge, { label: "Sell", value: h, tokens: v, exclude: o, listFailures: m.failures, listsLoading: m.status === "loading", onChange: (p) => y({ type: "select-in", token: p, side: c }) })
|
|
2241
|
+
] }),
|
|
2242
|
+
dt,
|
|
2243
|
+
ee !== null ? /* @__PURE__ */ e("p", { className: "latch-panel__error", children: ee }) : null
|
|
2244
|
+
] }),
|
|
2245
|
+
_ ? /* @__PURE__ */ l(X, { children: [
|
|
2246
|
+
/* @__PURE__ */ l("dl", { className: "latch-lines", children: [
|
|
2247
|
+
/* @__PURE__ */ e(B, { label: "You receive", children: /* @__PURE__ */ e("output", { "aria-live": "polite", className: f.isRefreshing ? "is-refreshing" : void 0, children: ue === "" || o === null ? "—" : `${ue} ${o.symbol}` }) }),
|
|
2248
|
+
/* @__PURE__ */ e(B, { label: "Price impact", hint: "How much worse this trade's rate is than the pool's current rate.", ...x === null ? {} : { severity: x.priceImpactSeverity }, children: x === null ? "—" : W(x.priceImpactBps) }),
|
|
2249
|
+
/* @__PURE__ */ e(
|
|
2250
|
+
B,
|
|
2251
|
+
{
|
|
2252
|
+
label: "Pool fee",
|
|
2253
|
+
hint: x?.lpFeeUnknown === !0 ? "This pool's hook decides the fee inside the swap. The quoted output already includes it." : "Set by the pool, paid to its liquidity providers, taken from the input.",
|
|
2254
|
+
children: x === null ? "—" : x.lpFeeUnknown ? "set by hook" : Q(x.lpFeePips)
|
|
2255
|
+
}
|
|
2256
|
+
),
|
|
2257
|
+
ne !== void 0 ? /* @__PURE__ */ e(B, { label: `Creator tax (${c})`, hint: Ue, children: De }) : null,
|
|
2258
|
+
r.active && x !== null && o !== null ? /* @__PURE__ */ l(B, { label: `${r.label ?? "Integrator"} fee (${$e(r.feeBps)})`, hint: "Paid to the site hosting this widget, inside the same transaction.", children: [
|
|
2259
|
+
q(x.integratorFee, o.decimals),
|
|
2260
|
+
" ",
|
|
2261
|
+
o.symbol,
|
|
2262
|
+
" → ",
|
|
2263
|
+
H(r.referrer)
|
|
2264
|
+
] }) : null,
|
|
2265
|
+
/* @__PURE__ */ e(B, { label: `Min. received (${W(E)})`, hint: "Guaranteed floor after slippage and the integrator fee. The transaction reverts below it.", children: x === null || o === null ? "—" : `${q(x.minAmountOutNet, o.decimals)} ${o.symbol}` })
|
|
2266
|
+
] }),
|
|
2267
|
+
f.isMock ? /* @__PURE__ */ e("p", { className: "latch-panel__note", children: "Simulated by the mock adapter" }) : null
|
|
2268
|
+
] }) : /* @__PURE__ */ l(X, { children: [
|
|
2269
|
+
/* @__PURE__ */ e("div", { className: "latch-flip", children: /* @__PURE__ */ e("button", { type: "button", className: "latch-flip__button", onClick: _e, "aria-label": "Swap the input and output tokens", title: "Switch tokens", children: /* @__PURE__ */ e("span", { "aria-hidden": "true", children: "↓" }) }) }),
|
|
2270
|
+
/* @__PURE__ */ l("div", { className: "latch-panel", "data-latch-side": "buy", children: [
|
|
2271
|
+
/* @__PURE__ */ l("div", { className: "latch-panel__top", children: [
|
|
2272
|
+
/* @__PURE__ */ e("span", { className: "latch-label", children: "You receive" }),
|
|
2273
|
+
Ie.data !== null && o !== null ? /* @__PURE__ */ l("span", { className: "latch-panel__balance", children: [
|
|
2274
|
+
"Balance ",
|
|
2275
|
+
q(Ie.data, o.decimals)
|
|
2276
|
+
] }) : null
|
|
2277
|
+
] }),
|
|
2278
|
+
/* @__PURE__ */ l("div", { className: "latch-panel__main", children: [
|
|
2279
|
+
/* @__PURE__ */ e("output", { className: `latch-big-input latch-big-input--out${f.isRefreshing ? " is-refreshing" : ""}`, "aria-live": "polite", "aria-label": `Amount of ${o?.symbol ?? "the output token"} you receive`, children: ue === "" ? /* @__PURE__ */ e("span", { className: "latch-big-input__placeholder", children: "0" }) : ue }),
|
|
2280
|
+
k ? /* @__PURE__ */ e(Ke, { label: "Buy", value: o }) : /* @__PURE__ */ e(Ge, { label: "Buy", value: o, tokens: v, exclude: h, listFailures: m.failures, listsLoading: m.status === "loading", onChange: (p) => y({ type: "select-out", token: p, side: c }) })
|
|
2281
|
+
] }),
|
|
2282
|
+
f.isMock ? /* @__PURE__ */ e("p", { className: "latch-panel__note", children: "Simulated by the mock adapter" }) : null
|
|
2283
|
+
] })
|
|
2284
|
+
] }),
|
|
2285
|
+
Me || te !== null && te >= Xe ? /* @__PURE__ */ l("label", { className: "latch-ack", children: [
|
|
2286
|
+
/* @__PURE__ */ e("input", { type: "checkbox", checked: M, onChange: (p) => j(p.target.checked) }),
|
|
2287
|
+
/* @__PURE__ */ l("span", { children: [
|
|
2288
|
+
"This trade moves the pool price by ",
|
|
2289
|
+
/* @__PURE__ */ e("strong", { children: W(te) }),
|
|
2290
|
+
". I understand I am paying that."
|
|
2291
|
+
] })
|
|
2292
|
+
] }) : null,
|
|
2293
|
+
a.slots?.aboveButton !== void 0 ? /* @__PURE__ */ e("div", { className: "latch-slot latch-slot--above-button", children: a.slots.aboveButton }) : null,
|
|
2294
|
+
Ee ? /* @__PURE__ */ e("button", { ...at(u), className: "latch-cta", "data-latch-busy": "false", children: O }) : /* @__PURE__ */ l("button", { type: "submit", className: "latch-cta", disabled: !Te, "data-latch-busy": pe ? "true" : "false", children: [
|
|
2295
|
+
pe ? /* @__PURE__ */ e("span", { className: "latch-spinner", "aria-hidden": "true" }) : null,
|
|
2296
|
+
O
|
|
2297
|
+
] }),
|
|
2298
|
+
!_ && x !== null && h !== null && o !== null ? /* @__PURE__ */ l("div", { className: "latch-details", "data-open": N ? "true" : "false", children: [
|
|
2299
|
+
/* @__PURE__ */ l("button", { type: "button", className: "latch-details__toggle", "aria-expanded": N, onClick: () => U((p) => !p), children: [
|
|
2300
|
+
/* @__PURE__ */ e(
|
|
2301
|
+
"span",
|
|
2302
|
+
{
|
|
2303
|
+
className: "latch-details__rate",
|
|
2304
|
+
role: "button",
|
|
2305
|
+
tabIndex: 0,
|
|
2306
|
+
onClick: (p) => {
|
|
2307
|
+
p.stopPropagation(), J((D) => !D);
|
|
2308
|
+
},
|
|
2309
|
+
onKeyDown: (p) => {
|
|
2310
|
+
(p.key === "Enter" || p.key === " ") && (p.preventDefault(), p.stopPropagation(), J((D) => !D));
|
|
2311
|
+
},
|
|
2312
|
+
title: "Flip the rate",
|
|
2313
|
+
children: it ?? "Rate unavailable"
|
|
2314
|
+
}
|
|
2315
|
+
),
|
|
2316
|
+
/* @__PURE__ */ l("span", { className: "latch-details__hint", children: [
|
|
2317
|
+
te !== null ? /* @__PURE__ */ l("span", { "data-latch-severity": x.priceImpactSeverity, children: [
|
|
2318
|
+
W(te),
|
|
2319
|
+
" impact"
|
|
2320
|
+
] }) : null,
|
|
2321
|
+
/* @__PURE__ */ e("span", { "aria-hidden": "true", children: N ? "▴" : "▾" })
|
|
2322
|
+
] })
|
|
2323
|
+
] }),
|
|
2324
|
+
N ? /* @__PURE__ */ l("dl", { className: "latch-details__list", children: [
|
|
2325
|
+
/* @__PURE__ */ e(B, { label: "Price impact", hint: "How much worse this trade's rate is than the pool's current rate.", severity: x.priceImpactSeverity, children: W(x.priceImpactBps) }),
|
|
2326
|
+
/* @__PURE__ */ e(B, { label: "Max slippage", hint: "Set in the settings. The transaction reverts if the received amount falls below the minimum.", children: W(x.slippageBps) }),
|
|
2327
|
+
/* @__PURE__ */ l(B, { label: "Minimum received", hint: "Guaranteed floor after slippage and the integrator fee.", children: [
|
|
2328
|
+
q(x.minAmountOutNet, o.decimals),
|
|
2329
|
+
" ",
|
|
2330
|
+
o.symbol
|
|
2331
|
+
] }),
|
|
2332
|
+
/* @__PURE__ */ e(
|
|
2333
|
+
B,
|
|
2334
|
+
{
|
|
2335
|
+
label: "Pool fee",
|
|
2336
|
+
hint: x.lpFeeUnknown ? "This pool's hook decides the fee inside the swap. The quoted output already includes it." : "Set by the pool, paid to its liquidity providers, taken from the input.",
|
|
2337
|
+
children: x.lpFeeUnknown ? "dynamic (hook-set)" : Q(x.lpFeePips)
|
|
2338
|
+
}
|
|
2339
|
+
),
|
|
2340
|
+
ne !== void 0 ? /* @__PURE__ */ e(B, { label: `Creator tax (${c})`, hint: Ue, children: De }) : null,
|
|
2341
|
+
r.active ? /* @__PURE__ */ l(B, { label: `${r.label ?? "Integrator"} fee (${$e(r.feeBps)})`, hint: "Paid to the site hosting this widget, inside the same transaction.", children: [
|
|
2342
|
+
q(x.integratorFee, o.decimals),
|
|
2343
|
+
" ",
|
|
2344
|
+
o.symbol,
|
|
2345
|
+
" → ",
|
|
2346
|
+
H(r.referrer)
|
|
2347
|
+
] }) : null,
|
|
2348
|
+
Oe.length > 1 ? /* @__PURE__ */ l(B, { label: "Route", hint: "The pools this swap goes through, in order.", children: [
|
|
2349
|
+
Oe.join(" → "),
|
|
2350
|
+
G !== null ? ` · ${G.route.length} hop${G.route.length > 1 ? "s" : ""} · ${G.route.map((p) => p.poolType).join(", ")}` : ""
|
|
2351
|
+
] }) : null,
|
|
2352
|
+
f.updatedAt !== null ? /* @__PURE__ */ e(B, { label: "Quote", hint: "Quotes refresh on an interval; the chain recomputes the output at execution.", children: f.isRefreshing ? "refreshing…" : `read ${Math.max(0, Math.round((Date.now() - f.updatedAt) / 1e3))}s ago` }) : null
|
|
2353
|
+
] }) : null
|
|
2354
|
+
] }) : null,
|
|
2355
|
+
/* @__PURE__ */ e(F, { message: rt, tone: ct })
|
|
2356
|
+
] }),
|
|
2357
|
+
/* @__PURE__ */ e(ke, { error: C.error !== null || f.status === "error" ? null : f.error, context: "quote" }),
|
|
2358
|
+
a.slots?.footer !== void 0 ? /* @__PURE__ */ e("div", { className: "latch-slot latch-slot--footer", children: a.slots.footer }) : null,
|
|
2359
|
+
C.txHash !== null ? /* @__PURE__ */ l("p", { className: "latch-footer", children: [
|
|
2360
|
+
/* @__PURE__ */ e("span", { children: C.step === "success" ? "Swapped" : "Transaction" }),
|
|
2361
|
+
je !== null ? /* @__PURE__ */ l("a", { href: je, target: "_blank", rel: "noopener noreferrer", children: [
|
|
2362
|
+
H(C.txHash),
|
|
2363
|
+
" ↗"
|
|
2364
|
+
] }) : /* @__PURE__ */ e("span", { children: H(C.txHash) })
|
|
2365
|
+
] }) : null,
|
|
2366
|
+
/* @__PURE__ */ e("p", { className: "latch-footer latch-footer--brand", children: /* @__PURE__ */ l("span", { children: [
|
|
2367
|
+
"Latch Protocol · ",
|
|
2368
|
+
g.name
|
|
2369
|
+
] }) })
|
|
2370
|
+
]
|
|
2371
|
+
}
|
|
2372
|
+
);
|
|
2373
|
+
});
|
|
2374
|
+
function B(t) {
|
|
2375
|
+
return /* @__PURE__ */ l("div", { className: "latch-details__row", title: t.hint, children: [
|
|
2376
|
+
/* @__PURE__ */ e("dt", { children: t.label }),
|
|
2377
|
+
/* @__PURE__ */ e("dd", { "data-latch-severity": t.severity, children: t.children })
|
|
2378
|
+
] });
|
|
2379
|
+
}
|
|
2380
|
+
export {
|
|
2381
|
+
ve as A,
|
|
2382
|
+
ke as E,
|
|
2383
|
+
pa as F,
|
|
2384
|
+
sa as L,
|
|
2385
|
+
ua as M,
|
|
2386
|
+
ra as P,
|
|
2387
|
+
Pa as R,
|
|
2388
|
+
Ia as S,
|
|
2389
|
+
la as W,
|
|
2390
|
+
qa as a,
|
|
2391
|
+
fe as b,
|
|
2392
|
+
da as c,
|
|
2393
|
+
lt as d,
|
|
2394
|
+
$a as e,
|
|
2395
|
+
oa as f,
|
|
2396
|
+
ca as g,
|
|
2397
|
+
F as h,
|
|
2398
|
+
na as i,
|
|
2399
|
+
re as j,
|
|
2400
|
+
S as k,
|
|
2401
|
+
de as l,
|
|
2402
|
+
at as m
|
|
2403
|
+
};
|
|
2404
|
+
//# sourceMappingURL=SwapWidget-DgyHAVc8.js.map
|