@edel-finance/swap-widget 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +175 -0
- package/dist/adapters/angular.d.ts +32 -0
- package/dist/adapters/angular.js +84 -0
- package/dist/adapters/solid.d.ts +56 -0
- package/dist/adapters/solid.js +41 -0
- package/dist/adapters/svelte.d.ts +26 -0
- package/dist/adapters/svelte.js +45 -0
- package/dist/adapters/vue.d.ts +58 -0
- package/dist/adapters/vue.js +124 -0
- package/dist/embed.d.ts +58 -5
- package/dist/embed.js +211 -31
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/logos.d.ts +59 -0
- package/dist/logos.js +161 -0
- package/dist/theme.d.ts +18 -0
- package/dist/theme.js +592 -175
- package/dist/widget.d.ts +26 -2
- package/dist/widget.js +188 -15
- package/package.json +28 -5
package/dist/embed.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { EdelNetwork } from "@edel-finance/sdk";
|
|
2
|
-
import
|
|
1
|
+
import type { EdelNetwork, SwapOrder, SwapQuote } from "@edel-finance/sdk";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { type SwapWidgetTheme } from "./theme.js";
|
|
4
|
+
import { type EdelSwapWidgetProps } from "./widget.js";
|
|
3
5
|
export interface SwapWidgetEmbedOptions {
|
|
4
6
|
/** Target Edel network (MainNet or TestNet). Defaults to "mainnet". */
|
|
5
7
|
network?: EdelNetwork;
|
|
@@ -17,6 +19,50 @@ export interface SwapWidgetEmbedOptions {
|
|
|
17
19
|
embedOrigin?: string;
|
|
18
20
|
}
|
|
19
21
|
export declare const SWAP_WIDGET_ORIGINS: Record<EdelNetwork, string>;
|
|
22
|
+
export declare const EDEL_SWAP_WIDGET_TAG: "edel-swap-widget";
|
|
23
|
+
export declare const EDEL_SWAP_WIDGET_EVENTS: {
|
|
24
|
+
readonly quote: "edel-swap-quote";
|
|
25
|
+
readonly complete: "edel-swap-complete";
|
|
26
|
+
readonly error: "edel-swap-error";
|
|
27
|
+
readonly slippageChange: "edel-swap-slippage-change";
|
|
28
|
+
};
|
|
29
|
+
export interface EdelSwapWidgetErrorDetail {
|
|
30
|
+
message: string;
|
|
31
|
+
error: Error;
|
|
32
|
+
}
|
|
33
|
+
export interface EdelSwapWidgetSlippageDetail {
|
|
34
|
+
maxSlippageBps: number;
|
|
35
|
+
}
|
|
36
|
+
export interface EdelSwapWidgetEventMap {
|
|
37
|
+
"edel-swap-quote": CustomEvent<SwapQuote>;
|
|
38
|
+
"edel-swap-complete": CustomEvent<SwapOrder>;
|
|
39
|
+
"edel-swap-error": CustomEvent<EdelSwapWidgetErrorDetail>;
|
|
40
|
+
"edel-swap-slippage-change": CustomEvent<EdelSwapWidgetSlippageDetail>;
|
|
41
|
+
}
|
|
42
|
+
export interface MountedEdelSwapWidget {
|
|
43
|
+
/** Update widget props without remounting the underlying React root. */
|
|
44
|
+
update(nextProps: Partial<EdelSwapWidgetProps>): void;
|
|
45
|
+
/** Unmount the widget and release DOM/React resources. */
|
|
46
|
+
unmount(): void;
|
|
47
|
+
/** Return the currently applied props snapshot. */
|
|
48
|
+
getProps(): EdelSwapWidgetProps;
|
|
49
|
+
}
|
|
50
|
+
export interface WidgetRootLike {
|
|
51
|
+
render(element: ReturnType<typeof createElement>): void;
|
|
52
|
+
unmount(): void;
|
|
53
|
+
}
|
|
54
|
+
export interface MountEdelSwapWidgetOptions {
|
|
55
|
+
/** Attach and render inside an open Shadow DOM root for full CSS isolation. Defaults to true. */
|
|
56
|
+
shadowDom?: boolean;
|
|
57
|
+
/** Dispatch standard CustomEvents on the target element for widget lifecycle events. */
|
|
58
|
+
dispatchEvents?: boolean;
|
|
59
|
+
/** Optional custom React root factory (primarily for headless unit tests). */
|
|
60
|
+
createRootImpl?: (container: Element) => WidgetRootLike;
|
|
61
|
+
}
|
|
62
|
+
export interface EdelSwapWidgetElement extends HTMLElement {
|
|
63
|
+
widgetProps: Partial<EdelSwapWidgetProps>;
|
|
64
|
+
setProps(nextProps: Partial<EdelSwapWidgetProps>): void;
|
|
65
|
+
}
|
|
20
66
|
/**
|
|
21
67
|
* Builds the canonical iframe URL for embedding the Edel Swap Widget in
|
|
22
68
|
* partner dApps (SuperNova, Loop, institutional portals) or standalone pages.
|
|
@@ -28,9 +74,16 @@ export declare function buildSwapWidgetUrl(options?: SwapWidgetEmbedOptions): st
|
|
|
28
74
|
export declare function buildSwapWidgetEmbedSnippet(options?: SwapWidgetEmbedOptions & {
|
|
29
75
|
height?: number | string;
|
|
30
76
|
}): string;
|
|
77
|
+
/**
|
|
78
|
+
* Imperatively mounts the interactive `<EdelSwapWidget />` into any DOM element,
|
|
79
|
+
* with Shadow DOM CSS isolation enabled by default so host styles in Vue, Svelte,
|
|
80
|
+
* Angular, SolidJS, or plain HTML never collide with the widget.
|
|
81
|
+
*/
|
|
82
|
+
export declare function mountEdelSwapWidget(target: HTMLElement, props?: EdelSwapWidgetProps, options?: MountEdelSwapWidgetOptions): MountedEdelSwapWidget;
|
|
31
83
|
/**
|
|
32
84
|
* Registers the `<edel-swap-widget>` Custom Element (Web Component) with Shadow DOM
|
|
33
|
-
* CSS isolation
|
|
34
|
-
*
|
|
85
|
+
* CSS isolation. Mounts the full interactive React `<EdelSwapWidget />` inside an open
|
|
86
|
+
* Shadow Root and dispatches standard `CustomEvent`s (`edel-swap-quote`,
|
|
87
|
+
* `edel-swap-complete`, `edel-swap-error`, `edel-swap-slippage-change`).
|
|
35
88
|
*/
|
|
36
|
-
export declare function registerEdelSwapWidgetElement(tagName?: string): void;
|
|
89
|
+
export declare function registerEdelSwapWidgetElement(tagName?: string, options?: Pick<MountEdelSwapWidgetOptions, "createRootImpl">): void;
|
package/dist/embed.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
import { getIsolatedWidgetCss } from "./theme.js";
|
|
4
|
+
import { EdelSwapWidget } from "./widget.js";
|
|
1
5
|
export const SWAP_WIDGET_ORIGINS = {
|
|
2
6
|
mainnet: "https://app.edel.finance/embed/swap",
|
|
3
7
|
testnet: "https://testnet.edel.finance/embed/swap",
|
|
4
8
|
};
|
|
9
|
+
export const EDEL_SWAP_WIDGET_TAG = "edel-swap-widget";
|
|
10
|
+
export const EDEL_SWAP_WIDGET_EVENTS = {
|
|
11
|
+
quote: "edel-swap-quote",
|
|
12
|
+
complete: "edel-swap-complete",
|
|
13
|
+
error: "edel-swap-error",
|
|
14
|
+
slippageChange: "edel-swap-slippage-change",
|
|
15
|
+
};
|
|
5
16
|
/**
|
|
6
17
|
* Builds the canonical iframe URL for embedding the Edel Swap Widget in
|
|
7
18
|
* partner dApps (SuperNova, Loop, institutional portals) or standalone pages.
|
|
@@ -34,51 +45,220 @@ export function buildSwapWidgetEmbedSnippet(options = {}) {
|
|
|
34
45
|
` style="border:0;border-radius:18px;overflow:hidden;max-width:440px;"></iframe>`,
|
|
35
46
|
].join("\n");
|
|
36
47
|
}
|
|
48
|
+
function buildShadowStyles(theme) {
|
|
49
|
+
return `:host{display:block;max-width:440px;width:100%;}\n${getIsolatedWidgetCss(theme)}`;
|
|
50
|
+
}
|
|
51
|
+
function dispatchWidgetEvent(target, type, detail) {
|
|
52
|
+
if (typeof CustomEvent === "undefined" || typeof target.dispatchEvent !== "function") {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
target.dispatchEvent(new CustomEvent(type, {
|
|
56
|
+
detail,
|
|
57
|
+
bubbles: true,
|
|
58
|
+
composed: true,
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
function decoratePropsWithEvents(target, props, dispatchEvents) {
|
|
62
|
+
if (!dispatchEvents) {
|
|
63
|
+
return props;
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
...props,
|
|
67
|
+
onQuote: (quote) => {
|
|
68
|
+
props.onQuote?.(quote);
|
|
69
|
+
dispatchWidgetEvent(target, EDEL_SWAP_WIDGET_EVENTS.quote, quote);
|
|
70
|
+
},
|
|
71
|
+
onSwapComplete: (order) => {
|
|
72
|
+
props.onSwapComplete?.(order);
|
|
73
|
+
dispatchWidgetEvent(target, EDEL_SWAP_WIDGET_EVENTS.complete, order);
|
|
74
|
+
},
|
|
75
|
+
onError: (error) => {
|
|
76
|
+
props.onError?.(error);
|
|
77
|
+
dispatchWidgetEvent(target, EDEL_SWAP_WIDGET_EVENTS.error, {
|
|
78
|
+
message: error.message,
|
|
79
|
+
error,
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
onSlippageChange: (maxSlippageBps) => {
|
|
83
|
+
props.onSlippageChange?.(maxSlippageBps);
|
|
84
|
+
dispatchWidgetEvent(target, EDEL_SWAP_WIDGET_EVENTS.slippageChange, {
|
|
85
|
+
maxSlippageBps,
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Imperatively mounts the interactive `<EdelSwapWidget />` into any DOM element,
|
|
92
|
+
* with Shadow DOM CSS isolation enabled by default so host styles in Vue, Svelte,
|
|
93
|
+
* Angular, SolidJS, or plain HTML never collide with the widget.
|
|
94
|
+
*/
|
|
95
|
+
export function mountEdelSwapWidget(target, props = {}, options = {}) {
|
|
96
|
+
const useShadowDom = options.shadowDom !== false;
|
|
97
|
+
const dispatchEvents = options.dispatchEvents === true;
|
|
98
|
+
const createRootFn = options.createRootImpl ?? ((container) => createRoot(container));
|
|
99
|
+
let currentProps = { ...props };
|
|
100
|
+
let unmounted = false;
|
|
101
|
+
const ownerDoc = target.ownerDocument ?? (typeof document !== "undefined" ? document : undefined);
|
|
102
|
+
if (!ownerDoc) {
|
|
103
|
+
throw new Error("mountEdelSwapWidget requires a browser DOM environment.");
|
|
104
|
+
}
|
|
105
|
+
let styleEl = null;
|
|
106
|
+
let hostRoot = target;
|
|
107
|
+
if (useShadowDom && (target.shadowRoot || typeof target.attachShadow === "function")) {
|
|
108
|
+
const shadow = target.shadowRoot ?? target.attachShadow({ mode: "open" });
|
|
109
|
+
hostRoot = shadow;
|
|
110
|
+
const existingStyle = typeof shadow.querySelector === "function"
|
|
111
|
+
? shadow.querySelector('style[data-edel-swap-widget-styles="true"]')
|
|
112
|
+
: null;
|
|
113
|
+
if (existingStyle) {
|
|
114
|
+
styleEl = existingStyle;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
styleEl = ownerDoc.createElement("style");
|
|
118
|
+
styleEl.setAttribute("data-edel-swap-widget-styles", "true");
|
|
119
|
+
shadow.appendChild(styleEl);
|
|
120
|
+
}
|
|
121
|
+
styleEl.textContent = buildShadowStyles(currentProps.theme ?? "dark");
|
|
122
|
+
}
|
|
123
|
+
const mountNode = ownerDoc.createElement("div");
|
|
124
|
+
mountNode.setAttribute("data-edel-swap-widget-mount", "true");
|
|
125
|
+
hostRoot.appendChild(mountNode);
|
|
126
|
+
const root = createRootFn(mountNode);
|
|
127
|
+
const renderCurrent = () => {
|
|
128
|
+
if (unmounted)
|
|
129
|
+
return;
|
|
130
|
+
if (styleEl) {
|
|
131
|
+
styleEl.textContent = buildShadowStyles(currentProps.theme ?? "dark");
|
|
132
|
+
}
|
|
133
|
+
const effectiveProps = decoratePropsWithEvents(target, currentProps, dispatchEvents);
|
|
134
|
+
root.render(createElement(EdelSwapWidget, effectiveProps));
|
|
135
|
+
};
|
|
136
|
+
renderCurrent();
|
|
137
|
+
return {
|
|
138
|
+
update(nextProps) {
|
|
139
|
+
if (unmounted)
|
|
140
|
+
return;
|
|
141
|
+
currentProps = { ...currentProps, ...nextProps };
|
|
142
|
+
renderCurrent();
|
|
143
|
+
},
|
|
144
|
+
unmount() {
|
|
145
|
+
if (unmounted)
|
|
146
|
+
return;
|
|
147
|
+
unmounted = true;
|
|
148
|
+
root.unmount();
|
|
149
|
+
if (mountNode.parentNode) {
|
|
150
|
+
mountNode.parentNode.removeChild(mountNode);
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
getProps() {
|
|
154
|
+
return { ...currentProps };
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function parseOptionalInt(raw) {
|
|
159
|
+
if (raw === null || raw.trim() === "")
|
|
160
|
+
return undefined;
|
|
161
|
+
const n = Number(raw);
|
|
162
|
+
return Number.isFinite(n) ? Math.round(n) : undefined;
|
|
163
|
+
}
|
|
164
|
+
function readElementAttributeProps(el) {
|
|
165
|
+
const networkAttr = el.getAttribute("network");
|
|
166
|
+
const themeAttr = el.getAttribute("theme");
|
|
167
|
+
const props = {
|
|
168
|
+
network: networkAttr === "testnet" ? "testnet" : "mainnet",
|
|
169
|
+
theme: themeAttr === "light" ? "light" : "dark",
|
|
170
|
+
};
|
|
171
|
+
const integratorId = el.getAttribute("integrator-id") ?? el.getAttribute("partner-id");
|
|
172
|
+
if (integratorId)
|
|
173
|
+
props.integratorId = integratorId;
|
|
174
|
+
const defaultFrom = el.getAttribute("from");
|
|
175
|
+
if (defaultFrom)
|
|
176
|
+
props.defaultFrom = defaultFrom;
|
|
177
|
+
const defaultTo = el.getAttribute("to");
|
|
178
|
+
if (defaultTo)
|
|
179
|
+
props.defaultTo = defaultTo;
|
|
180
|
+
const maxSlippageBps = parseOptionalInt(el.getAttribute("max-slippage-bps"));
|
|
181
|
+
if (maxSlippageBps !== undefined)
|
|
182
|
+
props.defaultMaxSlippageBps = maxSlippageBps;
|
|
183
|
+
const integratorFeeBps = parseOptionalInt(el.getAttribute("integrator-fee-bps"));
|
|
184
|
+
if (integratorFeeBps !== undefined)
|
|
185
|
+
props.integratorFeeBps = integratorFeeBps;
|
|
186
|
+
const recipientAddress = el.getAttribute("recipient-address");
|
|
187
|
+
if (recipientAddress)
|
|
188
|
+
props.recipientAddress = recipientAddress;
|
|
189
|
+
return props;
|
|
190
|
+
}
|
|
37
191
|
/**
|
|
38
192
|
* Registers the `<edel-swap-widget>` Custom Element (Web Component) with Shadow DOM
|
|
39
|
-
* CSS isolation
|
|
40
|
-
*
|
|
193
|
+
* CSS isolation. Mounts the full interactive React `<EdelSwapWidget />` inside an open
|
|
194
|
+
* Shadow Root and dispatches standard `CustomEvent`s (`edel-swap-quote`,
|
|
195
|
+
* `edel-swap-complete`, `edel-swap-error`, `edel-swap-slippage-change`).
|
|
41
196
|
*/
|
|
42
|
-
export function registerEdelSwapWidgetElement(tagName =
|
|
43
|
-
if (typeof
|
|
197
|
+
export function registerEdelSwapWidgetElement(tagName = EDEL_SWAP_WIDGET_TAG, options = {}) {
|
|
198
|
+
if (typeof customElements === "undefined" || typeof HTMLElement === "undefined") {
|
|
44
199
|
return;
|
|
45
200
|
}
|
|
46
201
|
if (customElements.get(tagName)) {
|
|
47
202
|
return;
|
|
48
203
|
}
|
|
49
|
-
class
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
super();
|
|
53
|
-
this.shadow = this.attachShadow({ mode: "open" });
|
|
54
|
-
}
|
|
204
|
+
class EdelSwapWidgetCustomElement extends HTMLElement {
|
|
205
|
+
mounted = null;
|
|
206
|
+
customProps = {};
|
|
55
207
|
static get observedAttributes() {
|
|
56
|
-
return [
|
|
208
|
+
return [
|
|
209
|
+
"network",
|
|
210
|
+
"integrator-id",
|
|
211
|
+
"partner-id",
|
|
212
|
+
"from",
|
|
213
|
+
"to",
|
|
214
|
+
"theme",
|
|
215
|
+
"max-slippage-bps",
|
|
216
|
+
"integrator-fee-bps",
|
|
217
|
+
"recipient-address",
|
|
218
|
+
];
|
|
219
|
+
}
|
|
220
|
+
get widgetProps() {
|
|
221
|
+
return { ...this.customProps };
|
|
222
|
+
}
|
|
223
|
+
set widgetProps(nextProps) {
|
|
224
|
+
this.customProps = { ...nextProps };
|
|
225
|
+
this.syncMount();
|
|
226
|
+
}
|
|
227
|
+
setProps(nextProps) {
|
|
228
|
+
this.customProps = { ...this.customProps, ...nextProps };
|
|
229
|
+
this.syncMount();
|
|
57
230
|
}
|
|
58
231
|
connectedCallback() {
|
|
59
|
-
this.
|
|
232
|
+
this.syncMount();
|
|
60
233
|
}
|
|
61
234
|
attributeChangedCallback() {
|
|
62
|
-
this.
|
|
235
|
+
if (this.mounted) {
|
|
236
|
+
this.syncMount();
|
|
237
|
+
}
|
|
63
238
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
239
|
+
disconnectedCallback() {
|
|
240
|
+
this.mounted?.unmount();
|
|
241
|
+
this.mounted = null;
|
|
242
|
+
}
|
|
243
|
+
resolveMergedProps() {
|
|
244
|
+
return {
|
|
245
|
+
...readElementAttributeProps(this),
|
|
246
|
+
...this.customProps,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
syncMount() {
|
|
250
|
+
const merged = this.resolveMergedProps();
|
|
251
|
+
if (!this.mounted) {
|
|
252
|
+
this.mounted = mountEdelSwapWidget(this, merged, {
|
|
253
|
+
shadowDom: true,
|
|
254
|
+
dispatchEvents: true,
|
|
255
|
+
createRootImpl: options.createRootImpl,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
this.mounted.update(merged);
|
|
260
|
+
}
|
|
81
261
|
}
|
|
82
262
|
}
|
|
83
|
-
customElements.define(tagName,
|
|
263
|
+
customElements.define(tagName, EdelSwapWidgetCustomElement);
|
|
84
264
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { buildSwapWidgetEmbedSnippet, buildSwapWidgetUrl, registerEdelSwapWidgetElement, SWAP_WIDGET_ORIGINS, type SwapWidgetEmbedOptions, } from "./embed.js";
|
|
1
|
+
export { buildSwapWidgetEmbedSnippet, buildSwapWidgetUrl, EDEL_SWAP_WIDGET_EVENTS, EDEL_SWAP_WIDGET_TAG, type EdelSwapWidgetElement, type EdelSwapWidgetErrorDetail, type EdelSwapWidgetEventMap, type EdelSwapWidgetSlippageDetail, type MountEdelSwapWidgetOptions, type MountedEdelSwapWidget, mountEdelSwapWidget, registerEdelSwapWidgetElement, SWAP_WIDGET_ORIGINS, type SwapWidgetEmbedOptions, type WidgetRootLike, } from "./embed.js";
|
|
2
|
+
export { CantonChainBadge, EdelBrandMark, type EdelBrandMarkProps, getTokenDisplayName, getTokenMonogram, isValidHttpsLogoUrl, KNOWN_ASSET_NAMES, KNOWN_TOKEN_LOGO_SYMBOLS, type KnownTokenLogoSymbol, MAINNET_SPOT_LOGO_URLS, TokenLogo, type TokenLogoProps, TokenOnChainLogo, type TokenOnChainLogoProps, } from "./logos.js";
|
|
2
3
|
export { ALPINE_FOREST_THEMES, type AlpineThemeTokens, getIsolatedWidgetCss, type SwapWidgetTheme, } from "./theme.js";
|
|
3
|
-
export { DEFAULT_SWAP_ASSETS, DEFAULT_WIDGET_QUOTE_TTL_SECONDS, DEFAULT_WIDGET_SLIPPAGE_BPS, EdelSwapWidget, type EdelSwapWidgetProps, formatBps, formatPresetPercent, getStepState, parseCustomSlippagePercent, resolveInitialSlippageBps, SLIPPAGE_PRESETS_BPS, SWAP_STATUS_STEPS, } from "./widget.js";
|
|
4
|
+
export { DEFAULT_SWAP_ASSETS, DEFAULT_WIDGET_QUOTE_TTL_SECONDS, DEFAULT_WIDGET_SLIPPAGE_BPS, EdelSwapWidget, type EdelSwapWidgetProps, extractMarketLogoUrls, filterTokenOptions, formatBps, formatPresetPercent, getStepState, getSwapRailProgress, parseCustomSlippagePercent, resolveInitialSlippageBps, SLIPPAGE_PRESETS_BPS, SWAP_RAIL_STEPS, SWAP_STATUS_STEPS, type SwapRailProgress, } from "./widget.js";
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { buildSwapWidgetEmbedSnippet, buildSwapWidgetUrl, registerEdelSwapWidgetElement, SWAP_WIDGET_ORIGINS, } from "./embed.js";
|
|
1
|
+
export { buildSwapWidgetEmbedSnippet, buildSwapWidgetUrl, EDEL_SWAP_WIDGET_EVENTS, EDEL_SWAP_WIDGET_TAG, mountEdelSwapWidget, registerEdelSwapWidgetElement, SWAP_WIDGET_ORIGINS, } from "./embed.js";
|
|
2
|
+
export { CantonChainBadge, EdelBrandMark, getTokenDisplayName, getTokenMonogram, isValidHttpsLogoUrl, KNOWN_ASSET_NAMES, KNOWN_TOKEN_LOGO_SYMBOLS, MAINNET_SPOT_LOGO_URLS, TokenLogo, TokenOnChainLogo, } from "./logos.js";
|
|
2
3
|
export { ALPINE_FOREST_THEMES, getIsolatedWidgetCss, } from "./theme.js";
|
|
3
|
-
export { DEFAULT_SWAP_ASSETS, DEFAULT_WIDGET_QUOTE_TTL_SECONDS, DEFAULT_WIDGET_SLIPPAGE_BPS, EdelSwapWidget, formatBps, formatPresetPercent, getStepState, parseCustomSlippagePercent, resolveInitialSlippageBps, SLIPPAGE_PRESETS_BPS, SWAP_STATUS_STEPS, } from "./widget.js";
|
|
4
|
+
export { DEFAULT_SWAP_ASSETS, DEFAULT_WIDGET_QUOTE_TTL_SECONDS, DEFAULT_WIDGET_SLIPPAGE_BPS, EdelSwapWidget, extractMarketLogoUrls, filterTokenOptions, formatBps, formatPresetPercent, getStepState, getSwapRailProgress, parseCustomSlippagePercent, resolveInitialSlippageBps, SLIPPAGE_PRESETS_BPS, SWAP_RAIL_STEPS, SWAP_STATUS_STEPS, } from "./widget.js";
|
package/dist/logos.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export declare const KNOWN_TOKEN_LOGO_SYMBOLS: readonly ["USDCx", "CC", "EDELx", "NVDAe", "SPYe", "QQQe", "SPCXe", "ANTe", "TTWOe", "ETH", "BTC"];
|
|
2
|
+
export type KnownTokenLogoSymbol = (typeof KNOWN_TOKEN_LOGO_SYMBOLS)[number];
|
|
3
|
+
/** Human-readable display names for Edel Markets Spot & Canton assets. */
|
|
4
|
+
export declare const KNOWN_ASSET_NAMES: Readonly<Record<string, string>>;
|
|
5
|
+
/**
|
|
6
|
+
* Canonical MainNet Spot market logo URLs served by https://mainnet.edel-api.xyz/v2/markets.
|
|
7
|
+
* Used as fallback hydration and in Storybook fixtures so every preview matches MainNet/TestNet 1:1.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MAINNET_SPOT_LOGO_URLS: Readonly<Record<string, string>>;
|
|
10
|
+
/**
|
|
11
|
+
* Resolve the display name for a token symbol.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getTokenDisplayName(symbol: string, fallbackName?: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Derive a crisp 2-3 character uppercase monogram for fallback token badges.
|
|
16
|
+
* Strips trailing lowercase wrapper suffixes (e.g. `e` or `x`) just like Edel Markets.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getTokenMonogram(symbol: string): string;
|
|
19
|
+
export interface EdelBrandMarkProps {
|
|
20
|
+
size?: number;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Official Edel botanical brand mark (self-contained inline SVG, Shadow DOM safe).
|
|
25
|
+
*/
|
|
26
|
+
export declare function EdelBrandMark({ size, className }: EdelBrandMarkProps): import("react").JSX.Element;
|
|
27
|
+
export interface TokenLogoProps {
|
|
28
|
+
symbol: string;
|
|
29
|
+
size?: number;
|
|
30
|
+
className?: string;
|
|
31
|
+
/** Optional HTTPS token logo URL from Edel Markets API; falls back to inline SVG on error. */
|
|
32
|
+
logoUrl?: string | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Validate that a remote token logo URL uses the HTTPS protocol.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isValidHttpsLogoUrl(url: unknown): url is string;
|
|
38
|
+
/**
|
|
39
|
+
* Circular token logo for Edel Markets assets.
|
|
40
|
+
* Renders the official remote HTTPS logo when provided and falls back to the
|
|
41
|
+
* self-contained inline SVG on load error or when no logoUrl is available.
|
|
42
|
+
*/
|
|
43
|
+
export declare function TokenLogo({ symbol, size, className, logoUrl }: TokenLogoProps): import("react").JSX.Element;
|
|
44
|
+
/**
|
|
45
|
+
* Official Canton network chain mini-badge SVG (verbatim from edel-markets-frontend
|
|
46
|
+
* `apps/trade/public/brand/bridge/chains/canton.svg`, Shadow DOM safe).
|
|
47
|
+
*/
|
|
48
|
+
export declare function CantonChainBadge({ size }: {
|
|
49
|
+
size?: number;
|
|
50
|
+
}): import("react").JSX.Element;
|
|
51
|
+
export interface TokenOnChainLogoProps extends TokenLogoProps {
|
|
52
|
+
/** Whether to render the Canton chain mini-badge in the bottom-right corner. Defaults to true. */
|
|
53
|
+
showChainBadge?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Token logo paired with the Canton network mini-badge in the bottom-right corner,
|
|
57
|
+
* matching edel-markets-frontend's `TokenOnChain` component 1:1.
|
|
58
|
+
*/
|
|
59
|
+
export declare function TokenOnChainLogo({ symbol, size, className, logoUrl, showChainBadge, }: TokenOnChainLogoProps): import("react").JSX.Element;
|
package/dist/logos.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useState } from "react";
|
|
3
|
+
export const KNOWN_TOKEN_LOGO_SYMBOLS = [
|
|
4
|
+
"USDCx",
|
|
5
|
+
"CC",
|
|
6
|
+
"EDELx",
|
|
7
|
+
"NVDAe",
|
|
8
|
+
"SPYe",
|
|
9
|
+
"QQQe",
|
|
10
|
+
"SPCXe",
|
|
11
|
+
"ANTe",
|
|
12
|
+
"TTWOe",
|
|
13
|
+
"ETH",
|
|
14
|
+
"BTC",
|
|
15
|
+
];
|
|
16
|
+
/** Human-readable display names for Edel Markets Spot & Canton assets. */
|
|
17
|
+
export const KNOWN_ASSET_NAMES = {
|
|
18
|
+
USDCx: "USD Coin (Canton)",
|
|
19
|
+
CC: "Canton Coin",
|
|
20
|
+
EDELx: "Edel Token",
|
|
21
|
+
NVDAe: "NVIDIA Token",
|
|
22
|
+
SPYe: "S&P 500 Token",
|
|
23
|
+
QQQe: "Nasdaq 100 Token",
|
|
24
|
+
SPCXe: "SpaceX Token",
|
|
25
|
+
ANTe: "Anthropic Token",
|
|
26
|
+
TTWOe: "Take-Two Token",
|
|
27
|
+
ETH: "Ethereum",
|
|
28
|
+
BTC: "Bitcoin",
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Canonical MainNet Spot market logo URLs served by https://mainnet.edel-api.xyz/v2/markets.
|
|
32
|
+
* Used as fallback hydration and in Storybook fixtures so every preview matches MainNet/TestNet 1:1.
|
|
33
|
+
*/
|
|
34
|
+
export const MAINNET_SPOT_LOGO_URLS = {
|
|
35
|
+
ANTe: "https://bhdrneuruse570eo.public.blob.vercel-storage.com/market-logos/ANTe/8bc9ce9480dbfc3d28dec69c678bd2ad82f00b1b7d64fc51d1b452f343a5fab2.png",
|
|
36
|
+
CC: "https://bhdrneuruse570eo.public.blob.vercel-storage.com/market-logos/CC/6fd7361736ae91fb020514aaf13f8f54bbbcc1e6af6c07a4ec6f1dc66a2f01ac.png",
|
|
37
|
+
EDELx: "https://bhdrneuruse570eo.public.blob.vercel-storage.com/market-logos/EDELx/c154c3058c198a47412a96499125f7e9d0739abfef1745c8a9f534db7372d831.png",
|
|
38
|
+
NVDAe: "https://bhdrneuruse570eo.public.blob.vercel-storage.com/market-logos/NVDAe/1bd2b458c46bc021a4de27ca5270c0cf8d03774c4965d6d9053a19451caa5b30.png",
|
|
39
|
+
QQQe: "https://bhdrneuruse570eo.public.blob.vercel-storage.com/market-logos/QQQe/3ac2253d6335e49d502e2c3d4436175f6a744f3ba64f9b8e9835188da3a9f40f.png",
|
|
40
|
+
SPCXe: "https://bhdrneuruse570eo.public.blob.vercel-storage.com/market-logos/SPCXe/a25ac7435b310daab040d0e5db228b1e64b6a3a45486eb76b7454cc41442c50e.png",
|
|
41
|
+
SPYe: "https://bhdrneuruse570eo.public.blob.vercel-storage.com/market-logos/SPYe/9b28e1b8f8f331b3fc55cf603d5fdaa5208543f1c5688a7faba5e5dcf5cf486b.png",
|
|
42
|
+
TTWOe: "https://bhdrneuruse570eo.public.blob.vercel-storage.com/market-logos/TTWOe/6d301d44dec5bd30c85ec2d93a76cbc24288e002a6a7ff4373796c22036b2d46.png",
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Resolve the display name for a token symbol.
|
|
46
|
+
*/
|
|
47
|
+
export function getTokenDisplayName(symbol, fallbackName) {
|
|
48
|
+
if (fallbackName?.trim())
|
|
49
|
+
return fallbackName.trim();
|
|
50
|
+
return KNOWN_ASSET_NAMES[symbol] ?? `${symbol} (Canton)`;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Derive a crisp 2-3 character uppercase monogram for fallback token badges.
|
|
54
|
+
* Strips trailing lowercase wrapper suffixes (e.g. `e` or `x`) just like Edel Markets.
|
|
55
|
+
*/
|
|
56
|
+
export function getTokenMonogram(symbol) {
|
|
57
|
+
const cleaned = symbol.trim();
|
|
58
|
+
if (!cleaned)
|
|
59
|
+
return "?";
|
|
60
|
+
const base = cleaned.replace(/[a-z]+$/u, "") || cleaned;
|
|
61
|
+
return base.slice(0, 3).toUpperCase();
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Official Edel botanical brand mark (self-contained inline SVG, Shadow DOM safe).
|
|
65
|
+
*/
|
|
66
|
+
export function EdelBrandMark({ size = 22, className }) {
|
|
67
|
+
return (_jsxs("svg", { width: size, height: Math.round((size * 69) / 78), viewBox: "0 0 78 69", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", focusable: "false", "data-edel-brand-mark": "true", children: [_jsx("path", { d: "M21.1645 7.51419C21.9479 8.67468 22.9488 9.80616 24.1093 10.8796C25.2843 11.9386 26.6334 12.925 28.1275 13.7954L38.9201 20.091C38.9926 20.1345 39.0796 20.1781 39.1522 20.2216C39.2247 20.2651 39.3117 20.2941 39.3843 20.3231C39.4568 20.3521 39.5438 20.3811 39.6164 20.3957C39.6889 20.4102 39.7759 20.4392 39.8485 20.4537C40.2546 20.5262 40.6318 20.4972 40.9509 20.3811C41.2701 20.2651 41.5312 20.062 41.7052 19.8154C41.8793 19.5688 41.9664 19.2642 41.9373 18.945C41.9083 18.6259 41.7633 18.2632 41.4876 17.9151L34.8438 9.51604C34.075 8.54413 33.1901 7.63024 32.2182 6.78888C31.2463 5.94753 30.1874 5.1787 29.0414 4.4679C27.8954 3.7716 26.6624 3.13333 25.3713 2.5821C24.0658 2.03087 22.6732 1.55216 21.2371 1.175C21.063 1.13148 20.8889 1.08797 20.7003 1.04445C20.5263 1.00093 20.3377 0.95741 20.1636 0.913892C19.9895 0.870373 19.801 0.826855 19.6269 0.797842C19.4383 0.754324 19.2642 0.725312 19.0756 0.681793C18.9741 1.76975 19.1047 2.88673 19.4528 4.03271C19.801 5.19321 20.3812 6.38271 21.15 7.5287", fill: "currentColor" }), _jsx("path", { d: "M52.0916 22.4555C52.3962 22.6731 52.7298 22.8327 53.0925 22.9052C53.1505 22.9052 53.223 22.9197 53.2811 22.9342C53.3391 22.9342 53.4116 22.9342 53.4696 22.9342C53.5277 22.9342 53.6002 22.9342 53.6582 22.9197C53.7163 22.9052 53.7888 22.9052 53.8468 22.8762L61.6076 20.8018C62.565 20.5407 63.3773 20.1635 64.0591 19.6558C64.7264 19.1626 65.2631 18.5824 65.6548 17.9006C66.0465 17.2478 66.2931 16.508 66.4091 15.7102C66.5252 14.9268 66.5107 14.0855 66.3656 13.2151C66.2496 13.1716 66.148 13.1426 66.032 13.0991C65.9159 13.0555 65.8144 13.0265 65.6983 12.983C65.5823 12.954 65.4807 12.9105 65.3647 12.8815C65.2486 12.8524 65.1471 12.8234 65.0311 12.7944C64.1462 12.5623 63.2903 12.4173 62.4635 12.3737C61.6221 12.3302 60.8243 12.3737 60.0699 12.5043C59.3011 12.6494 58.5903 12.896 57.923 13.2296C57.2558 13.5778 56.6465 14.042 56.1388 14.6077L51.3082 19.8734C51.0906 20.1055 51.0036 20.3956 51.0036 20.7003C51.0036 21.0049 51.1197 21.324 51.3082 21.6287C51.4968 21.9333 51.7579 22.2089 52.048 22.4265", fill: "currentColor" }), _jsx("path", { d: "M71.6314 30.4194C70.5144 29.6651 69.354 29.0413 68.179 28.5481C67.004 28.0549 65.7999 27.6922 64.6104 27.5037C64.6104 27.5037 64.5814 27.5037 64.5669 27.5037H64.5379C64.5379 27.5037 64.5089 27.5037 64.4944 27.5037H64.4654L54.9493 25.995C54.4561 25.9225 54.079 26.0095 53.8034 26.2271C53.5277 26.4447 53.3537 26.7638 53.3102 27.141C53.2666 27.5182 53.3392 27.9388 53.5568 28.3595C53.7743 28.7657 54.108 29.1574 54.6012 29.462L64.5524 35.5546C65.1617 35.9317 65.7564 36.2509 66.3657 36.5555C66.9604 36.8456 67.5697 37.1067 68.1645 37.3098C68.7592 37.5274 69.3395 37.7015 69.9052 37.832C70.4709 37.9626 71.0367 38.0641 71.5734 38.1222C72.2262 38.1947 72.8499 38.2092 73.4592 38.1657C74.054 38.1222 74.6197 38.0351 75.1564 37.8756C75.6931 37.7305 76.1863 37.5274 76.6505 37.2808C77.1147 37.0342 77.5209 36.7441 77.9126 36.3959C76.9552 35.1774 75.9397 34.0604 74.8808 33.0595C73.8364 32.0731 72.7339 31.2027 71.6169 30.4484", fill: "currentColor" }), _jsx("path", { d: "M38.891 27.0975C39.4422 26.9379 39.8049 26.6188 40.008 26.2416C40.2111 25.8645 40.2401 25.4293 40.1385 24.9941C40.037 24.5589 39.7904 24.1382 39.4277 23.8046C39.0651 23.471 38.5864 23.2098 37.9916 23.0938L24.791 20.7293C24.791 20.7293 24.7475 20.7293 24.7185 20.7293C24.6895 20.7293 24.675 20.7293 24.646 20.7293C24.6169 20.7293 24.6024 20.7293 24.5734 20.7293C24.5444 20.7293 24.5299 20.7293 24.5009 20.7293C22.5861 20.4102 20.6132 20.2796 18.6404 20.3376C16.6095 20.3957 14.5497 20.6568 12.5188 21.121C10.4009 21.5997 8.29752 22.296 6.23764 23.2098C4.09073 24.1527 2.00185 25.3422 0 26.7784C1.00092 27.5037 2.07438 28.1564 3.20586 28.7512C4.33734 29.3314 5.51234 29.8537 6.73085 30.2888C7.93486 30.724 9.18239 31.0867 10.4589 31.3768C11.7065 31.6669 12.983 31.87 14.2595 32.0006C15.2895 32.1021 16.3194 32.1746 17.3494 32.1746C18.3648 32.1746 19.3802 32.1456 20.3666 32.0586C21.3531 31.9716 22.325 31.841 23.2679 31.6524C24.2108 31.4784 25.1247 31.2463 26.0095 30.9851L38.891 27.1265V27.0975Z", fill: "currentColor" }), _jsx("path", { d: "M44.8675 30.724C44.6499 30.4629 44.3743 30.2453 44.0697 30.0712C43.7651 29.9117 43.4459 29.7956 43.1123 29.7521C42.9527 29.7376 42.8076 29.7231 42.6481 29.7376C42.4885 29.7376 42.3435 29.7811 42.1984 29.8246C42.0533 29.8682 41.9083 29.9407 41.7777 30.0132C41.6472 30.1003 41.5021 30.2018 41.386 30.3324L32.2037 39.7759C30.7385 41.2845 29.433 43.0252 28.345 44.9401C27.199 46.9564 26.2561 49.1613 25.5743 51.5403C24.849 54.0209 24.4139 56.661 24.2688 59.3882C24.1237 62.2314 24.3123 65.1616 24.878 68.0919C27.5472 66.8588 29.9842 65.3357 32.1456 63.5805C34.2055 61.9123 36.0188 60.041 37.5564 58.0536C39.0215 56.1533 40.2256 54.1224 41.1539 52.0481C42.0533 50.0462 42.6916 47.9863 43.0688 45.8975L45.4623 32.6969C45.5348 32.3197 45.5058 31.957 45.3897 31.6234C45.2882 31.2898 45.1141 30.9851 44.882 30.724", fill: "currentColor" }), _jsx("path", { d: "M66.5687 52.0336C65.9305 50.1333 65.1471 48.32 64.2187 46.6228C63.3049 44.9546 62.2604 43.3879 61.0854 41.9518L52.7734 31.841C52.6428 31.696 52.5268 31.5654 52.3962 31.4493C52.2657 31.3333 52.1206 31.2318 51.9901 31.1592C51.845 31.0722 51.7144 31.0142 51.5694 30.9706C51.4243 30.9271 51.2793 30.8836 51.1487 30.8691C50.8441 30.8256 50.5539 30.8691 50.2928 30.9416C50.0317 31.0287 49.7996 31.1737 49.611 31.3768C49.4225 31.5799 49.2919 31.841 49.2339 32.1311C49.1759 32.4358 49.1904 32.7839 49.2919 33.1756L52.991 46.3617C53.5567 48.3635 54.3401 50.3218 55.312 52.2076C56.3129 54.1225 57.5024 55.9357 58.8515 57.5894C60.215 59.2576 61.7237 60.7373 63.3339 61.9848C64.944 63.2323 66.6413 64.2332 68.382 64.9295C68.4836 62.6231 68.353 60.3456 68.0339 58.1552C67.7292 56.0373 67.236 53.9919 66.5832 52.0336", fill: "currentColor" }), _jsx("path", { d: "M49.9301 7.96388C49.8141 7.04999 49.5385 6.1361 49.1468 5.20771C48.7551 4.30833 48.2474 3.40895 47.6091 2.53858C46.9854 1.66821 46.2456 0.826851 45.3897 0C44.5919 0.319135 43.9101 0.739814 43.3443 1.27654C42.7641 1.81327 42.3144 2.45154 41.9953 3.19135C41.6761 3.94567 41.502 4.78703 41.473 5.70092C41.4585 6.64382 41.6036 7.65925 41.9372 8.7182L44.5773 17.2768C44.6499 17.4944 44.7514 17.6975 44.882 17.8861C45.0125 18.0747 45.1721 18.2342 45.3462 18.3793C45.5202 18.5244 45.7088 18.6404 45.9119 18.7274C46.115 18.8145 46.3181 18.887 46.5212 18.9305C46.7243 18.974 46.9273 18.9886 47.1159 18.974C47.3045 18.974 47.4786 18.916 47.6381 18.8435C47.7977 18.771 47.9283 18.6694 48.0443 18.5389C48.1459 18.4083 48.2329 18.2487 48.2764 18.0457L49.8141 10.7055C50.0026 9.82066 50.0172 8.89227 49.9011 7.96388", fill: "currentColor" })] }));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Validate that a remote token logo URL uses the HTTPS protocol.
|
|
71
|
+
*/
|
|
72
|
+
export function isValidHttpsLogoUrl(url) {
|
|
73
|
+
if (typeof url !== "string")
|
|
74
|
+
return false;
|
|
75
|
+
const trimmed = url.trim();
|
|
76
|
+
if (!trimmed)
|
|
77
|
+
return false;
|
|
78
|
+
try {
|
|
79
|
+
return new URL(trimmed).protocol === "https:";
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Circular token logo for Edel Markets assets.
|
|
87
|
+
* Renders the official remote HTTPS logo when provided and falls back to the
|
|
88
|
+
* self-contained inline SVG on load error or when no logoUrl is available.
|
|
89
|
+
*/
|
|
90
|
+
export function TokenLogo({ symbol, size = 22, className, logoUrl }) {
|
|
91
|
+
const clipId = useId();
|
|
92
|
+
const [failedUrl, setFailedUrl] = useState(null);
|
|
93
|
+
const safeLogoUrl = isValidHttpsLogoUrl(logoUrl) ? logoUrl.trim() : null;
|
|
94
|
+
if (safeLogoUrl && failedUrl !== safeLogoUrl) {
|
|
95
|
+
return (_jsx("img", { src: safeLogoUrl, alt: symbol, width: size, height: size, loading: "lazy", referrerPolicy: "no-referrer", className: className, "data-token-logo": symbol, "data-token-logo-src": "remote", style: {
|
|
96
|
+
width: size,
|
|
97
|
+
height: size,
|
|
98
|
+
borderRadius: "9999px",
|
|
99
|
+
objectFit: "cover",
|
|
100
|
+
display: "block",
|
|
101
|
+
flexShrink: 0,
|
|
102
|
+
}, onError: () => setFailedUrl(safeLogoUrl) }));
|
|
103
|
+
}
|
|
104
|
+
const normalized = symbol.trim().toUpperCase();
|
|
105
|
+
if (normalized === "USDCX" || normalized === "USDC" || normalized === "USD.E") {
|
|
106
|
+
return (_jsx("svg", { width: size, height: size, viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", focusable: "false", "data-token-logo": symbol, children: _jsxs("g", { fill: "none", children: [_jsx("circle", { fill: "#3E73C4", cx: "16", cy: "16", r: "16" }), _jsxs("g", { fill: "#FFFFFF", children: [_jsx("path", { d: "M20.022 18.124c0-2.124-1.28-2.852-3.84-3.156-1.828-.243-2.193-.728-2.193-1.578 0-.85.61-1.396 1.828-1.396 1.097 0 1.707.364 2.011 1.275a.458.458 0 00.427.303h.975a.416.416 0 00.427-.425v-.06a3.04 3.04 0 00-2.743-2.489V9.142c0-.243-.183-.425-.487-.486h-.915c-.243 0-.426.182-.487.486v1.396c-1.829.242-2.986 1.456-2.986 2.974 0 2.002 1.218 2.791 3.778 3.095 1.707.303 2.255.668 2.255 1.639 0 .97-.853 1.638-2.011 1.638-1.585 0-2.133-.667-2.316-1.578-.06-.242-.244-.364-.427-.364h-1.036a.416.416 0 00-.426.425v.06c.243 1.518 1.219 2.61 3.23 2.914v1.457c0 .242.183.425.487.485h.915c.243 0 .426-.182.487-.485V21.34c1.829-.303 3.047-1.578 3.047-3.217z" }), _jsx("path", { d: "M12.892 24.497c-4.754-1.7-7.192-6.98-5.424-11.653.914-2.55 2.925-4.491 5.424-5.402.244-.121.365-.303.365-.607v-.85c0-.242-.121-.424-.365-.485-.061 0-.183 0-.244.06a10.895 10.895 0 00-7.13 13.717c1.096 3.4 3.717 6.01 7.13 7.102.244.121.488 0 .548-.243.061-.06.061-.122.061-.243v-.85c0-.182-.182-.424-.365-.546zm6.46-18.936c-.244-.122-.488 0-.548.242-.061.061-.061.122-.061.243v.85c0 .243.182.485.365.607 4.754 1.7 7.192 6.98 5.424 11.653-.914 2.55-2.925 4.491-5.424 5.402-.244.121-.365.303-.365.607v.85c0 .242.121.424.365.485.061 0 .183 0 .244-.06a10.895 10.895 0 007.13-13.717c-1.096-3.46-3.778-6.07-7.13-7.162z" })] })] }) }));
|
|
107
|
+
}
|
|
108
|
+
if (normalized === "CC") {
|
|
109
|
+
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 512 512", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", focusable: "false", "data-token-logo": symbol, children: [_jsx("defs", { children: _jsx("clipPath", { id: clipId, children: _jsx("circle", { cx: "256", cy: "256", r: "256" }) }) }), _jsxs("g", { clipPath: `url(#${clipId})`, children: [_jsx("rect", { width: "512", height: "512", fill: "#f3ff97" }), _jsx("path", { d: "M364.88441,307.73299l-6.56929,6.56929c-46.56818,34.73862-68.607,35.45496-93.99604,35.45496-27.66964,0-53.51797-7.77619-75.4906-21.26563-.94822-.58233-1.8879-1.17278-2.81947-1.77989-.04142-.02497-.09137-.05827-.1332-.08325-.88974-.5738-1.77136-1.15593-2.64445-1.75471-.56568-.38254-1.13096-.7736-1.69664-1.17278-2.0211-1.4138-4.00038-2.87754-5.93823-4.38291-.27452-.21604-.54863-.43228-.82314-.65685-.07513-.04995-.14985-.10822-.21645-.16629-.66517-.52406-1.3141-1.04811-1.96262-1.58862-.85685-.69847-1.70476-1.4138-2.53643-2.13724-.72365-.61563-1.43918-1.2475-2.14577-1.87978-.01665-.01665-.0333-.02477-.04183-.04142-.32406-.28284-.64852-.58233-.96446-.87329-.69035-.62375-1.3807-1.26415-2.0544-1.90455-.5738-.54883-1.13948-1.08953-1.69664-1.64669-.26599-.24954-.52385-.50741-.7736-.76507-.66517-.65705-1.32222-1.32243-1.97075-1.99613-.00853,0-.00853-.00832-.00853-.00832-.76507-.79004-1.52202-1.59674-2.27044-2.40343-.04142-.04162-.07472-.08325-.11655-.12467-.63187-.68203-1.25563-1.3807-1.87125-2.07917-.15797-.1665-.30741-.33279-.44873-.50741-.66558-.74862-1.3141-1.50537-1.9545-2.27044-.707-.83999-1.414-1.68831-2.09582-2.55328,0,0-.01665-.00832-.01665-.01665-.6404-.79004-1.27268-1.59674-1.8879-2.40343-.26599-.34091-.53238-.69035-.79837-1.03959-.29929-.39918-.59898-.79857-.88974-1.19776-.15837-.20792-.30781-.41583-.45766-.62375-.33259-.44893-.65705-.89806-.97299-1.3472-.20792-.28284-.40771-.56548-.6071-.85664-.34111-.47391-.66517-.95634-.98964-1.43045-.31634-.45746-.62375-.90659-.93157-1.36385-2.27856-3.40992-4.41621-6.92787-6.40401-10.53738-.28264-.5072-.55715-1.02294-.83167-1.53847-.76507-1.42212-1.50537-2.85277-2.21196-4.29987-.20792-.42416-.41583-.84812-.61563-1.27248-.29929-.6071-.59045-1.23085-.87309-1.84628-.22457-.48223-.44101-.95634-.65705-1.43877-.23309-.5072-.45726-1.02294-.68223-1.53847-.17462-.39918-.34924-.79837-.51533-1.19755-.15797-.36609-.31634-.7403-.46578-1.11451-.17462-.40751-.34111-.81502-.5072-1.22253-.1332-.32446-.26639-.65705-.39106-.98964-.14132-.35776-.28264-.707-.41583-1.06476-.21604-.5405-.42396-1.08933-.62375-1.63816-.41583-1.11451-.81502-2.23734-1.20608-3.35997-.16609-.48243-.33259-.96487-.49055-1.4473-.12467-.36589-.24122-.73177-.35736-1.10598l45.82463,45.82483c-3.24343-9.94673-5.30595-20.41731-6.02107-31.2623l-46.24899-46.24919c-.00853-.04975-.00853-.09137-.00853-.14132-.05807-.56548-.0999-1.13928-.14132-1.71329-.05807-.7068-.0999-1.40547-.14132-2.11247-.0999-1.61339-.17462-3.2351-.21645-4.85682-.01665-.56548-.0333-1.12283-.04142-1.68831-.00853-.78172-.01665-1.56364-.01665-2.34536,0-1.69664.0333-3.39307.08325-5.08159l46.7229,46.7233c.49908-7.49334,1.63004-14.80375,3.35185-21.88958l-47.48837-47.48817c.15797-.83167.32446-1.66334.5072-2.48688.04995-.24934.0999-.49055.15797-.7401.09178-.47411.1998-.93989.30781-1.39715.12467-.5738.25787-1.13948.39918-1.70496.00853-.04995.02518-.10822.04142-.15797.1665-.71532.34964-1.43045.53238-2.14577.10843-.39918.20792-.79837.31634-1.19755.10802-.39918.20792-.79004.32406-1.18923.15797-.57401.32446-1.14781.49908-1.72161.10802-.36609.21645-.73197.33259-1.09786l.00853.00832,48.04553,48.04553c2.18719-6.0296,4.79875-11.85128,7.80908-17.42342l-48.97669-48.97709c1.8879-4.13337,6.22087-12.07585,6.22087-12.07585l49.68369,49.68409c.23309-.35776,11.36885-7.13578,16.01815-9.23161,17.59784-7.95913,37.79098-12.47503,59.25641-12.47503,33.59934,0,64.0718,11.07768,86.40179,29.06679l13.31523,13.31503,36.56013-36.56013,12.59158-12.59158-45.61712-45.61691c-12.32559-13.12376-27.14579-23.92713-43.72109-31.66169-11.46834-5.36422-23.77728-9.25638-36.67627-11.43545l49.61709,49.61749c-6.00442-.8735-12.14204-1.414-18.39621-1.61359l-49.92531-49.92511c-1.83796-.07472-3.68403-.10802-5.53904-.10802-6.31224,0-12.52458.40751-18.61265,1.18923l49.84206,49.84186c-5.17316.59045-10.25454,1.42212-15.21126,2.47836l-49.58419-49.58399c-6.59487,1.56364-13.01554,3.59287-19.21163,6.0296l49.11841,49.11841c-4.5157,1.61339-8.89049,3.41805-13.11543,5.41417l-48.76877-48.76918c-5.4891,2.80282-10.77027,5.95488-15.81836,9.42287l48.34481,48.34481c-3.64261,2.35369-7.12726,4.86534-10.42916,7.52664l-48.14542-48.14522c-4.59083,3.79246-8.94856,7.86755-13.02366,12.20884l48.11172,48.11192c-2.95226,3.20201-5.67996,6.54533-8.15019,10.01333l-48.35334-48.35314c-2.03044,2.59166-3.96423,5.25823-5.81112,7.98634-2.19694,1.34415-5.45295,3.44241-7.00462,4.44707-39.87868,25.72366-66.28417,70.53388-66.28417,121.51523,0,47.31315,22.74582,89.31202,57.89966,115.66755l20.27761,20.27741c8.61598,11.49372,18.77874,21.66461,30.17236,30.17256,9.58937,7.16056,20.0433,13.14873,31.17134,17.74768l-50.36591-50.36571c7.68441,3.19348,15.70993,5.73843,23.99332,7.56806l50.28307,50.29119h.00812c8.99851,1.96262,18.30484,3.06048,27.83573,3.21013l-50.14094-50.13302c1.11431.02497,2.22861.04162,3.34333.04162,4.97336,0,9.88013-.24954,14.7203-.74842l49.9915,49.9915c7.06919-.78172,13.98893-2.09582,20.72553-3.89215l-49.78399-49.78379c4.74067-1.20588,9.38957-2.63633,13.93045-4.30799l49.64227,49.63394c5.81356-2.20384,11.46062-4.79042,16.89124-7.72624l-49.43435-49.44267c4.09175-2.12892,8.07547-4.45783,11.926-6.96929l49.30968,49.30948c6.1628-4.11672,12.00966-8.69922,17.49022-13.71401l-49.11841-49.11841c2.01176-1.79816,5.13336-4.51936,8.86856-7.78999l48.63314,48.63314.02477.02497,44.74403-44.74383-48.64451-48.6443Z", fill: "#030206" })] })] }));
|
|
110
|
+
}
|
|
111
|
+
if (normalized === "EDELX" || normalized === "EDEL") {
|
|
112
|
+
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", focusable: "false", "data-token-logo": symbol, children: [_jsx("circle", { cx: "16", cy: "16", r: "15.5", fill: "#0F2E22", stroke: "#2A5241" }), _jsxs("g", { transform: "translate(6.2, 7.2) scale(0.252)", fill: "#52E0A8", children: [_jsx("path", { d: "M21.1645 7.51419C21.9479 8.67468 22.9488 9.80616 24.1093 10.8796C25.2843 11.9386 26.6334 12.925 28.1275 13.7954L38.9201 20.091C39.3843 20.3231 39.6164 20.3957 39.8485 20.4537C40.6318 20.4972 41.2701 20.2651 41.7052 19.8154C41.9664 19.2642 41.9083 18.6259 41.4876 17.9151L34.8438 9.51604C31.2463 5.94753 26.6624 3.13333 21.2371 1.175L19.0756 0.681793C18.9741 1.76975 19.4528 4.03271 21.15 7.5287" }), _jsx("path", { d: "M52.0916 22.4555C52.7298 22.8327 53.2811 22.9342 53.8468 22.8762L61.6076 20.8018C64.7264 19.1626 66.5252 16.508 66.3656 13.2151C63.2903 12.4173 59.3011 12.6494 56.1388 14.6077L51.3082 19.8734C51.0036 20.7003 51.3082 21.6287 52.048 22.4265" }), _jsx("path", { d: "M71.6314 30.4194C69.354 29.0413 67.004 28.0549 64.4654 27.5037L54.9493 25.995C53.5277 26.4447 53.2666 27.5182 54.6012 29.462L64.5524 35.5546C68.7592 37.5274 73.4592 38.2092 77.9126 36.3959C75.9397 34.0604 73.8364 32.0731 71.6169 30.4484" }), _jsx("path", { d: "M38.891 27.0975C40.2111 25.8645 40.037 24.5589 37.9916 23.0938L24.5009 20.7293C16.6095 20.3957 8.29752 22.296 0 26.7784C5.51234 29.8537 12.983 31.87 20.3666 32.0586L38.891 27.0975Z" }), _jsx("path", { d: "M44.8675 30.724C43.7651 29.9117 42.3435 29.7811 41.386 30.3324L32.2037 39.7759C26.2561 49.1613 24.1237 59.3882 24.878 68.0919C34.2055 61.9123 41.1539 54.1224 43.0688 45.8975L45.4623 32.6969C45.5058 31.957 45.2882 31.2898 44.882 30.724" }), _jsx("path", { d: "M66.5687 52.0336C65.1471 48.32 63.3049 44.9546 61.0854 41.9518L52.7734 31.841C51.4243 30.9271 49.611 31.3768 49.2919 33.1756L52.991 46.3617C55.312 52.2076 60.215 59.2576 68.382 64.9295C68.353 60.3456 67.7292 56.0373 66.5832 52.0336" }), _jsx("path", { d: "M49.9301 7.96388C49.1468 5.20771 47.6091 2.53858 45.3897 0C42.7641 1.81327 41.4585 4.78703 41.9372 8.7182L44.5773 17.2768C45.3462 18.3793 47.1159 18.9886 48.2764 18.0457L49.8141 10.7055C50.0172 9.82066 50.0172 8.89227 49.9011 7.96388" })] })] }));
|
|
113
|
+
}
|
|
114
|
+
if (normalized === "NVDAE" || normalized === "NVDA") {
|
|
115
|
+
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", focusable: "false", "data-token-logo": symbol, children: [_jsx("circle", { cx: "16", cy: "16", r: "16", fill: "#76B900" }), _jsx("path", { d: "M7.5 16.2C9.6 12.2 13.1 10 17.2 10C20.9 10 23.6 12.1 24.9 15.2C23.1 18.7 19.8 21 15.9 21C13 21 10.6 19.6 9.2 17.4C10.9 15.1 13.4 13.8 16.4 13.8C18.8 13.8 20.6 15 21.5 16.8C20.1 18.1 18.3 18.8 16.2 18.8C14.3 18.8 12.8 18 11.9 16.8", stroke: "#FFFFFF", strokeWidth: "2.1", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("circle", { cx: "16.4", cy: "16.2", r: "2", fill: "#FFFFFF" })] }));
|
|
116
|
+
}
|
|
117
|
+
if (normalized === "SPYE" || normalized === "SPY") {
|
|
118
|
+
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", focusable: "false", "data-token-logo": symbol, children: [_jsx("circle", { cx: "16", cy: "16", r: "16", fill: "#1E3A8A" }), _jsx("rect", { x: "8.5", y: "18", width: "3.4", height: "6", rx: "1", fill: "#93C5FD" }), _jsx("rect", { x: "14.3", y: "14", width: "3.4", height: "10", rx: "1", fill: "#FFFFFF" }), _jsx("rect", { x: "20.1", y: "9.5", width: "3.4", height: "14.5", rx: "1", fill: "#52E0A8" }), _jsx("path", { d: "M8.5 14.5L14.5 11.2L22 7.8", stroke: "#FFFFFF", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
119
|
+
}
|
|
120
|
+
if (normalized === "QQQE" || normalized === "QQQ") {
|
|
121
|
+
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", focusable: "false", "data-token-logo": symbol, children: [_jsx("circle", { cx: "16", cy: "16", r: "16", fill: "#0090DA" }), _jsx("circle", { cx: "15.5", cy: "15.5", r: "6.8", stroke: "#FFFFFF", strokeWidth: "2.6" }), _jsx("path", { d: "M18.8 18.8L23.2 23.2", stroke: "#FFFFFF", strokeWidth: "2.6", strokeLinecap: "round" })] }));
|
|
122
|
+
}
|
|
123
|
+
if (normalized === "SPCXE" || normalized === "SPCX") {
|
|
124
|
+
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", focusable: "false", "data-token-logo": symbol, children: [_jsx("circle", { cx: "16", cy: "16", r: "16", fill: "#0F172A" }), _jsx("path", { d: "M9.5 10.5L17.6 19.5", stroke: "#E2E8F0", strokeWidth: "2.3", strokeLinecap: "round" }), _jsx("path", { d: "M8.5 22.2C12.2 16.4 17.6 12.2 24.4 9.6", stroke: "#FFFFFF", strokeWidth: "2.4", strokeLinecap: "round" }), _jsx("circle", { cx: "24.2", cy: "9.7", r: "1.4", fill: "#52E0A8" })] }));
|
|
125
|
+
}
|
|
126
|
+
if (normalized === "ANTE" || normalized === "ANT") {
|
|
127
|
+
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", focusable: "false", "data-token-logo": symbol, children: [_jsx("circle", { cx: "16", cy: "16", r: "16", fill: "#D97757" }), _jsx("path", { d: "M8.5 22.5L13.3 9.5H15.8L20.5 22.5M10.7 18H18.3M19.8 9.5L24.2 22.5", stroke: "#FFFFFF", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
128
|
+
}
|
|
129
|
+
if (normalized === "TTWOE" || normalized === "TTWO") {
|
|
130
|
+
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", focusable: "false", "data-token-logo": symbol, children: [_jsx("circle", { cx: "16", cy: "16", r: "16", fill: "#D92D20" }), _jsx("text", { x: "16", y: "20.5", textAnchor: "middle", fill: "#FFFFFF", fontSize: "12.5", fontWeight: "800", fontFamily: "-apple-system, BlinkMacSystemFont, Inter, sans-serif", letterSpacing: "-0.5", children: "T2" })] }));
|
|
131
|
+
}
|
|
132
|
+
if (normalized === "ETH") {
|
|
133
|
+
return (_jsx("svg", { width: size, height: size, viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", focusable: "false", "data-token-logo": symbol, children: _jsxs("g", { fill: "none", fillRule: "evenodd", children: [_jsx("circle", { cx: "16", cy: "16", r: "16", fill: "#627EEA" }), _jsxs("g", { fill: "#FFFFFF", fillRule: "nonzero", children: [_jsx("path", { fillOpacity: "0.602", d: "M16.498 4v8.87l7.497 3.35z" }), _jsx("path", { d: "M16.498 4L9 16.22l7.498-3.35z" }), _jsx("path", { fillOpacity: "0.602", d: "M16.498 21.968v6.027L24 17.616z" }), _jsx("path", { d: "M16.498 27.995v-6.028L9 17.616z" }), _jsx("path", { fillOpacity: "0.2", d: "M16.498 20.573l7.497-4.353-7.497-3.348z" }), _jsx("path", { fillOpacity: "0.602", d: "M9 16.22l7.498 4.353v-7.701z" })] })] }) }));
|
|
134
|
+
}
|
|
135
|
+
if (normalized === "BTC") {
|
|
136
|
+
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", focusable: "false", "data-token-logo": symbol, children: [_jsx("circle", { cx: "16", cy: "16", r: "16", fill: "#F7931A" }), _jsx("text", { x: "16", y: "21.5", textAnchor: "middle", fill: "#FFFFFF", fontSize: "16", fontWeight: "800", fontFamily: "-apple-system, BlinkMacSystemFont, Inter, sans-serif", children: "\u20BF" })] }));
|
|
137
|
+
}
|
|
138
|
+
const monogram = getTokenMonogram(symbol);
|
|
139
|
+
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", focusable: "false", "data-token-logo": symbol, "data-token-logo-fallback": "true", children: [_jsx("circle", { cx: "16", cy: "16", r: "15.25", fill: "#12261E", stroke: "#2A5241", strokeWidth: "1.5" }), _jsx("text", { x: "16", y: "19.6", textAnchor: "middle", fill: "#8bfbd5", fontSize: monogram.length >= 3 ? "9.5" : "11.5", fontWeight: "700", fontFamily: "-apple-system, BlinkMacSystemFont, Inter, sans-serif", children: monogram })] }));
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Official Canton network chain mini-badge SVG (verbatim from edel-markets-frontend
|
|
143
|
+
* `apps/trade/public/brand/bridge/chains/canton.svg`, Shadow DOM safe).
|
|
144
|
+
*/
|
|
145
|
+
export function CantonChainBadge({ size = 12 }) {
|
|
146
|
+
const clipId = useId();
|
|
147
|
+
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 512 512", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", "data-chain-badge": "canton", style: { display: "block", borderRadius: "50%" }, children: [_jsx("defs", { children: _jsx("clipPath", { id: clipId, children: _jsx("circle", { cx: "256", cy: "256", r: "256" }) }) }), _jsxs("g", { clipPath: `url(#${clipId})`, children: [_jsx("rect", { width: "512", height: "512", fill: "#f3ff97" }), _jsx("path", { d: "M364.88441,307.73299l-6.56929,6.56929c-46.56818,34.73862-68.607,35.45496-93.99604,35.45496-27.66964,0-53.51797-7.77619-75.4906-21.26563-.94822-.58233-1.8879-1.17278-2.81947-1.77989-.04142-.02497-.09137-.05827-.1332-.08325-.88974-.5738-1.77136-1.15593-2.64445-1.75471-.56568-.38254-1.13096-.7736-1.69664-1.17278-2.0211-1.4138-4.00038-2.87754-5.93823-4.38291-.27452-.21604-.54863-.43228-.82314-.65685-.07513-.04995-.14985-.10822-.21645-.16629-.66517-.52406-1.3141-1.04811-1.96262-1.58862-.85685-.69847-1.70476-1.4138-2.53643-2.13724-.72365-.61563-1.43918-1.2475-2.14577-1.87978-.01665-.01665-.0333-.02477-.04183-.04142-.32406-.28284-.64852-.58233-.96446-.87329-.69035-.62375-1.3807-1.26415-2.0544-1.90455-.5738-.54883-1.13948-1.08953-1.69664-1.64669-.26599-.24954-.52385-.50741-.7736-.76507-.66517-.65705-1.32222-1.32243-1.97075-1.99613-.00853,0-.00853-.00832-.00853-.00832-.76507-.79004-1.52202-1.59674-2.27044-2.40343-.04142-.04162-.07472-.08325-.11655-.12467-.63187-.68203-1.25563-1.3807-1.87125-2.07917-.15797-.1665-.30741-.33279-.44873-.50741-.66558-.74862-1.3141-1.50537-1.9545-2.27044-.707-.83999-1.414-1.68831-2.09582-2.55328,0,0-.01665-.00832-.01665-.01665-.6404-.79004-1.27268-1.59674-1.8879-2.40343-.26599-.34091-.53238-.69035-.79837-1.03959-.29929-.39918-.59898-.79857-.88974-1.19776-.15837-.20792-.30781-.41583-.45766-.62375-.33259-.44893-.65705-.89806-.97299-1.3472-.20792-.28284-.40771-.56548-.6071-.85664-.34111-.47391-.66517-.95634-.98964-1.43045-.31634-.45746-.62375-.90659-.93157-1.36385-2.27856-3.40992-4.41621-6.92787-6.40401-10.53738-.28264-.5072-.55715-1.02294-.83167-1.53847-.76507-1.42212-1.50537-2.85277-2.21196-4.29987-.20792-.42416-.41583-.84812-.61563-1.27248-.29929-.6071-.59045-1.23085-.87309-1.84628-.22457-.48223-.44101-.95634-.65705-1.43877-.23309-.5072-.45726-1.02294-.68223-1.53847-.17462-.39918-.34924-.79837-.51533-1.19755-.15797-.36609-.31634-.7403-.46578-1.11451-.17462-.40751-.34111-.81502-.5072-1.22253-.1332-.32446-.26639-.65705-.39106-.98964-.14132-.35776-.28264-.707-.41583-1.06476-.21604-.5405-.42396-1.08933-.62375-1.63816-.41583-1.11451-.81502-2.23734-1.20608-3.35997-.16609-.48243-.33259-.96487-.49055-1.4473-.12467-.36589-.24122-.73177-.35736-1.10598l45.82463,45.82483c-3.24343-9.94673-5.30595-20.41731-6.02107-31.2623l-46.24899-46.24919c-.00853-.04975-.00853-.09137-.00853-.14132-.05807-.56548-.0999-1.13928-.14132-1.71329-.05807-.7068-.0999-1.40547-.14132-2.11247-.0999-1.61339-.17462-3.2351-.21645-4.85682-.01665-.56548-.0333-1.12283-.04142-1.68831-.00853-.78172-.01665-1.56364-.01665-2.34536,0-1.69664.0333-3.39307.08325-5.08159l46.7229,46.7233c.49908-7.49334,1.63004-14.80375,3.35185-21.88958l-47.48837-47.48817c.15797-.83167.32446-1.66334.5072-2.48688.04995-.24934.0999-.49055.15797-.7401.09178-.47411.1998-.93989.30781-1.39715.12467-.5738.25787-1.13948.39918-1.70496.00853-.04995.02518-.10822.04142-.15797.1665-.71532.34964-1.43045.53238-2.14577.10843-.39918.20792-.79837.31634-1.19755.10802-.39918.20792-.79004.32406-1.18923.15797-.57401.32446-1.14781.49908-1.72161.10802-.36609.21645-.73197.33259-1.09786l.00853.00832,48.04553,48.04553c2.18719-6.0296,4.79875-11.85128,7.80908-17.42342l-48.97669-48.97709c1.8879-4.13337,6.22087-12.07585,6.22087-12.07585l49.68369,49.68409c.23309-.35776,11.36885-7.13578,16.01815-9.23161,17.59784-7.95913,37.79098-12.47503,59.25641-12.47503,33.59934,0,64.0718,11.07768,86.40179,29.06679l13.31523,13.31503,36.56013-36.56013,12.59158-12.59158-45.61712-45.61691c-12.32559-13.12376-27.14579-23.92713-43.72109-31.66169-11.46834-5.36422-23.77728-9.25638-36.67627-11.43545l49.61709,49.61749c-6.00442-.8735-12.14204-1.414-18.39621-1.61359l-49.92531-49.92511c-1.83796-.07472-3.68403-.10802-5.53904-.10802-6.31224,0-12.52458.40751-18.61265,1.18923l49.84206,49.84186c-5.17316.59045-10.25454,1.42212-15.21126,2.47836l-49.58419-49.58399c-6.59487,1.56364-13.01554,3.59287-19.21163,6.0296l49.11841,49.11841c-4.5157,1.61339-8.89049,3.41805-13.11543,5.41417l-48.76877-48.76918c-5.4891,2.80282-10.77027,5.95488-15.81836,9.42287l48.34481,48.34481c-3.64261,2.35369-7.12726,4.86534-10.42916,7.52664l-48.14542-48.14522c-4.59083,3.79246-8.94856,7.86755-13.02366,12.20884l48.11172,48.11192c-2.95226,3.20201-5.67996,6.54533-8.15019,10.01333l-48.35334-48.35314c-2.03044,2.59166-3.96423,5.25823-5.81112,7.98634-2.19694,1.34415-5.45295,3.44241-7.00462,4.44707-39.87868,25.72366-66.28417,70.53388-66.28417,121.51523,0,47.31315,22.74582,89.31202,57.89966,115.66755l20.27761,20.27741c8.61598,11.49372,18.77874,21.66461,30.17236,30.17256,9.58937,7.16056,20.0433,13.14873,31.17134,17.74768l-50.36591-50.36571c7.68441,3.19348,15.70993,5.73843,23.99332,7.56806l50.28307,50.29119h.00812c8.99851,1.96262,18.30484,3.06048,27.83573,3.21013l-50.14094-50.13302c1.11431.02497,2.22861.04162,3.34333.04162,4.97336,0,9.88013-.24954,14.7203-.74842l49.9915,49.9915c7.06919-.78172,13.98893-2.09582,20.72553-3.89215l-49.78399-49.78379c4.74067-1.20588,9.38957-2.63633,13.93045-4.30799l49.64227,49.63394c5.81356-2.20384,11.46062-4.79042,16.89124-7.72624l-49.43435-49.44267c4.09175-2.12892,8.07547-4.45783,11.926-6.96929l49.30968,49.30948c6.1628-4.11672,12.00966-8.69922,17.49022-13.71401l-49.11841-49.11841c2.01176-1.79816,5.13336-4.51936,8.86856-7.78999l48.63314,48.63314.02477.02497,44.74403-44.74383-48.64451-48.6443Z", fill: "#030206" })] })] }));
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Token logo paired with the Canton network mini-badge in the bottom-right corner,
|
|
151
|
+
* matching edel-markets-frontend's `TokenOnChain` component 1:1.
|
|
152
|
+
*/
|
|
153
|
+
export function TokenOnChainLogo({ symbol, size = 24, className, logoUrl, showChainBadge = true, }) {
|
|
154
|
+
const badge = Math.round(size * 0.46);
|
|
155
|
+
const normalized = symbol.trim().toUpperCase();
|
|
156
|
+
const shouldBadge = showChainBadge && normalized !== "CC";
|
|
157
|
+
if (!shouldBadge) {
|
|
158
|
+
return _jsx(TokenLogo, { symbol: symbol, size: size, className: className, logoUrl: logoUrl });
|
|
159
|
+
}
|
|
160
|
+
return (_jsxs("span", { className: "edel-sw-on-chain", style: { width: size, height: size }, "aria-hidden": "true", children: [_jsx(TokenLogo, { symbol: symbol, size: size, className: className, logoUrl: logoUrl }), _jsx("span", { className: "edel-sw-on-chain-badge", style: { width: badge + 4, height: badge + 4 }, children: _jsx(CantonChainBadge, { size: badge }) })] }));
|
|
161
|
+
}
|