@embarkai/ui-kit 0.4.25 → 0.4.27

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.
@@ -1,980 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
- var _chunkYVHXT2JXcjs = require('./chunk-YVHXT2JX.cjs');
20
- require('./chunk-NES46LXF.cjs');
21
- require('./chunk-B254FLAW.cjs');
22
- require('./chunk-DACL62OU.cjs');
23
-
24
- // src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx
25
- var _react = require('react');
26
-
27
- // src/internal/components/SendMenu/hyperbridge/components/TokenSelector.tsx
28
- var _lodashes = require('lodash-es');
29
- var _lucidereact = require('lucide-react');
30
-
31
-
32
- // src/internal/components/SendMenu/hyperbridge/lib/chains.ts
33
- var _read = require('@embarkai/core/read');
34
- var _chains = require('wagmi/chains');
35
- var CHAINS_META = {
36
- lumiaprism: {
37
- chainID: _read.lumiaMainnetChain.id,
38
- chainLabel: _read.lumiaMainnetChain.name,
39
- chainName: "lumiaprism",
40
- // exact hyperlane registry chain name
41
- Icon: _chunkYVHXT2JXcjs.LumiaIcon
42
- },
43
- bsc: {
44
- chainID: _chains.bsc.id,
45
- chainLabel: _chains.bsc.name,
46
- chainName: "bsc",
47
- // exact hyperlane registry chain name
48
- Icon: _chunkYVHXT2JXcjs.BnbIcon
49
- },
50
- ethereum: {
51
- chainID: _chains.mainnet.id,
52
- chainLabel: _chains.mainnet.name,
53
- chainName: "ethereum",
54
- // exact hyperlane registry chain name
55
- Icon: _chunkYVHXT2JXcjs.EthereumIcon
56
- }
57
- // base: {
58
- // chainID: base.id,
59
- // chainLabel: base.name,
60
- // chainName: 'ethereum', // exact hyperlane registry chain name
61
- // Icon: EthereumIcon
62
- // },
63
- };
64
-
65
- // src/internal/components/SendMenu/hyperbridge/lib/warp.ts
66
-
67
- var _registry = require('@hyperlane-xyz/registry');
68
-
69
-
70
-
71
- var _sdk = require('@hyperlane-xyz/sdk');
72
-
73
- var WARP_ROUTES = [
74
- {
75
- symbol: "LUMIA",
76
- icon: _chunkYVHXT2JXcjs.TOKENS_ICONS.LUMIA,
77
- id: "LUMIA/arbitrum-avalanche-base-bsc-ethereum-lumiaprism-optimism-polygon",
78
- // Canonical LUMIA warp route (includes BSC + Lumia Prism).
79
- name: "bsc-lumiaprism",
80
- chainPair: [
81
- {
82
- chainID: _chains.bsc.id,
83
- chainLabel: _chains.bsc.name,
84
- chainName: "bsc",
85
- Icon: _chunkYVHXT2JXcjs.BnbIcon
86
- },
87
- {
88
- chainID: _read.lumiaMainnetChain.id,
89
- chainLabel: _read.lumiaMainnetChain.name,
90
- chainName: "lumiaprism",
91
- Icon: _chunkYVHXT2JXcjs.LumiaIcon
92
- }
93
- ]
94
- },
95
- {
96
- symbol: "USDT",
97
- icon: _chunkYVHXT2JXcjs.TOKENS_ICONS.USDT,
98
- id: "USDT/ethereum-lumiaprism",
99
- name: "ethereum-lumiaprism",
100
- chainPair: [
101
- {
102
- chainID: _chains.base.id,
103
- chainLabel: _chains.base.name,
104
- chainName: "ethereum",
105
- Icon: _chunkYVHXT2JXcjs.EthereumIcon
106
- },
107
- {
108
- chainID: _read.lumiaMainnetChain.id,
109
- chainLabel: _read.lumiaMainnetChain.name,
110
- chainName: "lumiaprism",
111
- Icon: _chunkYVHXT2JXcjs.LumiaIcon
112
- }
113
- ]
114
- },
115
- {
116
- symbol: "USDC",
117
- icon: _chunkYVHXT2JXcjs.TOKENS_ICONS.USDC,
118
- id: "USDC/lumia",
119
- name: "ethereum-lumiaprism",
120
- chainPair: [
121
- {
122
- chainID: _chains.base.id,
123
- chainLabel: _chains.base.name,
124
- chainName: "ethereum",
125
- Icon: _chunkYVHXT2JXcjs.EthereumIcon
126
- },
127
- {
128
- chainID: _read.lumiaMainnetChain.id,
129
- chainLabel: _read.lumiaMainnetChain.name,
130
- chainName: "lumiaprism",
131
- Icon: _chunkYVHXT2JXcjs.LumiaIcon
132
- }
133
- ]
134
- }
135
- ];
136
- function buildLumiaWarpConfig(warpRouteId) {
137
- const config = _registry.warpRouteConfigs[warpRouteId];
138
- if (!config) {
139
- console.warn(`[HYPERLANE SDK] Warp route ${warpRouteId} not found in @hyperlane-xyz/registry`);
140
- return null;
141
- }
142
- return config;
143
- }
144
- function tokenConnectionId(chainName, addressOrDenom) {
145
- return `ethereum|${chainName}|${addressOrDenom}`.toLowerCase();
146
- }
147
- function filterWarpConfigForChains(config, chains) {
148
- const chainSet = new Set(chains);
149
- const tokens = config.tokens.filter((t) => chainSet.has(t.chainName) && t.addressOrDenom);
150
- const allowedConnectionIds = new Set(tokens.map((t) => tokenConnectionId(t.chainName, t.addressOrDenom)));
151
- const prunedTokens = tokens.map((token) => ({
152
- ...token,
153
- connections: (_nullishCoalesce(token.connections, () => ( []))).filter((c) => allowedConnectionIds.has(c.token.toLowerCase()))
154
- }));
155
- return { ...config, tokens: prunedTokens };
156
- }
157
- function isDirectRouteAvailable(config, originChain, destinationChain) {
158
- const originTokens = config.tokens.find((t) => t.chainName === originChain);
159
- const destinationTokens = config.tokens.find((t) => t.chainName === destinationChain);
160
- if (!originTokens || !destinationTokens) return false;
161
- const destinationTokensId = `ethereum|${destinationChain}|${destinationTokens.addressOrDenom}`.toLowerCase();
162
- return (_nullishCoalesce(originTokens.connections, () => ( []))).some((c) => c.token.toLowerCase() === destinationTokensId);
163
- }
164
- function createMultiProtocolProvider(chainNames) {
165
- const metadata = {};
166
- for (const name of chainNames) {
167
- const meta = _registry.chainMetadata[name];
168
- if (meta) metadata[name] = meta;
169
- }
170
- return new (0, _sdk.MultiProtocolProvider)(metadata);
171
- }
172
- function createWarpCore(config, chainNames) {
173
- const multiProvider = createMultiProtocolProvider(chainNames);
174
- return _sdk.WarpCore.FromConfig(multiProvider, config);
175
- }
176
-
177
- // src/internal/components/SendMenu/hyperbridge/components/TokenSelector.tsx
178
- var _jsxruntime = require('react/jsx-runtime');
179
- var BRIDGE_CHAINS_LIST = _lodashes.toPairs.call(void 0, CHAINS_META).map(([chainName]) => chainName);
180
- function RouteItem(props) {
181
- const { id, icon: Icon, chainPair, symbol } = props;
182
- const hyperRouteID = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.hyperRoute);
183
- const selectRoute = _react.useCallback.call(void 0, (routeId) => {
184
- const {
185
- //
186
- setHyperRoute,
187
- setBridgeStep,
188
- setWarpCore,
189
- setWarpCoreConfig,
190
- setOriginChain,
191
- setDestinationChain
192
- } = _chunkYVHXT2JXcjs.useBridgeStore.getState();
193
- setHyperRoute(routeId);
194
- const warpConfig = buildLumiaWarpConfig(routeId);
195
- if (!warpConfig) {
196
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setError(`Warp route ${routeId} not found in @hyperlane-xyz/registry`);
197
- setBridgeStep("select");
198
- return;
199
- }
200
- console.log("[HYPERLANE SDK] Selecting route", routeId);
201
- const filteredConfig = filterWarpConfigForChains(warpConfig, BRIDGE_CHAINS_LIST);
202
- const warpCore = createWarpCore(filteredConfig, BRIDGE_CHAINS_LIST);
203
- setWarpCore(warpCore);
204
- setWarpCoreConfig(filteredConfig);
205
- setOriginChain(chainPair[0].chainName);
206
- setDestinationChain(chainPair[1].chainName);
207
- setBridgeStep("select");
208
- }, []);
209
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
210
- _chunkYVHXT2JXcjs.Button,
211
- {
212
- size: "large",
213
- variant: hyperRouteID === id ? "default" : "outline",
214
- className: "justify-between",
215
- onClick: () => selectRoute(id),
216
- children: [
217
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
218
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Icon, { className: "w-6 h-6" }),
219
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: symbol.toUpperCase() })
220
- ] }),
221
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: chainPair.map((chain, chIdx) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
222
- chIdx > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArrowLeftRightIcon, { className: "w-4 h-4" }),
223
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, chain.Icon, { className: "w-4 h-4" })
224
- ] }, `${id}-icon-${chain.chainID}-${chIdx}`)) })
225
- ]
226
- }
227
- );
228
- }
229
- function TokenSelector() {
230
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: WARP_ROUTES.map((hyperRoute) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, RouteItem, { ...hyperRoute }, hyperRoute.id)) });
231
- }
232
-
233
- // src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts
234
- var _utils = require('@hyperlane-xyz/utils');
235
- var _reactquery = require('@tanstack/react-query');
236
-
237
-
238
-
239
- // src/internal/components/SendMenu/hyperbridge/lib/executeWarpTxs.ts
240
-
241
- async function executeWarpTransactions(txs) {
242
- const { publicClient, session } = _chunkYVHXT2JXcjs.useSession.getState();
243
- if (!session) {
244
- throw new Error("No active session");
245
- }
246
- if (!publicClient) {
247
- throw new Error("No public client available");
248
- }
249
- const hashes = [];
250
- for (const tx of txs) {
251
- if (tx.type !== _sdk.ProviderType.EthersV5) {
252
- throw new Error(`Unsupported transaction provider: ${tx.type}`);
253
- }
254
- const populated = tx.transaction;
255
- if (!populated.to) {
256
- throw new Error("Transaction missing `to` address");
257
- }
258
- const hash = await _chunkYVHXT2JXcjs.sendUserOperation.call(void 0, session, {
259
- to: populated.to,
260
- data: _nullishCoalesce(populated.data, () => ( "0x")),
261
- value: (populated.value ? BigInt(populated.value.toString()) : 0n).toString(),
262
- chainId: publicClient.chain.id
263
- });
264
- hashes.push(hash);
265
- }
266
- return hashes;
267
- }
268
-
269
- // src/internal/components/SendMenu/hyperbridge/hooks/useWarpCore.ts
270
-
271
-
272
- var BRIDGE_CHAINS_LIST2 = _lodashes.toPairs.call(void 0, CHAINS_META).map(([chainName]) => chainName);
273
- var DEFAULT_WARP_ROUTE_ID = "USDT/ethereum-lumiaprism";
274
- function useWarpCore() {
275
- _react.useEffect.call(void 0, () => {
276
- const existingWarpCore = _chunkYVHXT2JXcjs.useBridgeStore.getState().warpCore;
277
- if (!!existingWarpCore) return;
278
- const {
279
- hyperRoute,
280
- originChain,
281
- destinationChain,
282
- setWarpCore,
283
- setWarpCoreConfig,
284
- setBridgeStep,
285
- setHyperRoute,
286
- setOriginChain,
287
- setDestinationChain
288
- } = _chunkYVHXT2JXcjs.useBridgeStore.getState();
289
- const hyperRouteID = hyperRoute || DEFAULT_WARP_ROUTE_ID;
290
- console.debug("[HYPERLANE SDK] Initializing WarpCore...", hyperRouteID);
291
- const fullConfig = buildLumiaWarpConfig(hyperRouteID);
292
- if (!fullConfig) {
293
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setError(`Warp route ${hyperRouteID} not found in @hyperlane-xyz/registry`);
294
- setBridgeStep("select");
295
- return;
296
- }
297
- const filteredConfig = filterWarpConfigForChains(fullConfig, BRIDGE_CHAINS_LIST2);
298
- const warpCore = createWarpCore(filteredConfig, BRIDGE_CHAINS_LIST2);
299
- setWarpCore(warpCore);
300
- setWarpCoreConfig(filteredConfig);
301
- if (hyperRoute !== hyperRouteID) setHyperRoute(hyperRouteID);
302
- const chainsPair = _optionalChain([WARP_ROUTES, 'access', _ => _.find, 'call', _2 => _2((warpRoute) => warpRoute.id === hyperRouteID), 'optionalAccess', _3 => _3.chainPair]);
303
- if (!!chainsPair) {
304
- console.debug(`[HYPERLANE SDK] chain pair ${chainsPair.map((c) => c.chainName).join(" - ")}`);
305
- const persistedOrigin = originChain && chainsPair.find((c) => c.chainName === originChain);
306
- const persistedDestination = destinationChain && chainsPair.find((c) => c.chainName === destinationChain);
307
- setOriginChain(_optionalChain([persistedOrigin, 'optionalAccess', _4 => _4.chainName]) || chainsPair[0].chainName);
308
- setDestinationChain(_optionalChain([persistedDestination, 'optionalAccess', _5 => _5.chainName]) || chainsPair[1].chainName);
309
- }
310
- return () => {
311
- setWarpCore(null);
312
- setWarpCoreConfig(null);
313
- };
314
- }, []);
315
- }
316
-
317
- // src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts
318
- function findToken(warpCore, chain) {
319
- return warpCore.tokens.find((t) => t.chainName === chain);
320
- }
321
- function findDestinationToken(warpCore, origin, destination) {
322
- if (!origin.getConnectionForChain(destination)) return void 0;
323
- return warpCore.tokens.find((t) => t.chainName === destination);
324
- }
325
- function useBridge() {
326
- const { t } = _chunkYVHXT2JXcjs.useT.call(void 0, );
327
- useWarpCore();
328
- const address = _chunkYVHXT2JXcjs.useSession.call(void 0, (st) => st.address);
329
- const currentChainId = _chunkYVHXT2JXcjs.useSession.call(void 0, (st) => st.activeChainId);
330
- const warpCore = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.warpCore);
331
- const amountToBridge = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.amount);
332
- const swapDirection = _react.useCallback.call(void 0, () => {
333
- const {
334
- bridgeStep,
335
- originChain,
336
- destinationChain,
337
- amount,
338
- //
339
- setOriginChain,
340
- setDestinationChain,
341
- setAmount,
342
- setQuote
343
- } = _chunkYVHXT2JXcjs.useBridgeStore.getState();
344
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setError(null);
345
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setRenderKey(`${bridgeStep}-swaped-${Date.now()}`);
346
- setOriginChain(destinationChain);
347
- setDestinationChain(originChain);
348
- const cacheAmount = amount;
349
- setAmount("0");
350
- setQuote(null);
351
- setTimeout(() => setAmount(cacheAmount), 500);
352
- }, []);
353
- const { mutate: estimateQuote } = _reactquery.useMutation.call(void 0, {
354
- mutationFn: async (amountToBridge2) => {
355
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setError(null);
356
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setIsUiLocked(true);
357
- const {
358
- //
359
- bridgeStep,
360
- originChain,
361
- destinationChain,
362
- recipient,
363
- // setQuote,
364
- setIsQuoteEstimating
365
- } = _chunkYVHXT2JXcjs.useBridgeStore.getState();
366
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setRenderKey(`${bridgeStep}-quoted-${Date.now()}`);
367
- setIsQuoteEstimating(true);
368
- const originToken = findToken(warpCore, originChain);
369
- const destToken = originToken ? findDestinationToken(warpCore, originToken, destinationChain) : void 0;
370
- if (!originToken || !destToken) {
371
- throw new Error(
372
- // @ts-expect-error i18n typing
373
- t("passport:bridgeMenu.errors.noConnections", { originChain, destinationChain })
374
- );
375
- }
376
- const wei = _utils.toWei.call(void 0, amountToBridge2, originToken.decimals);
377
- const originTokenAmount = originToken.amount(wei);
378
- const { igpQuote, tokenFeeQuote } = await warpCore.getInterchainTransferFee({
379
- originTokenAmount,
380
- destination: destinationChain,
381
- sender: address,
382
- recipient: recipient || address,
383
- destinationToken: destToken
384
- });
385
- const localQuote = await warpCore.getLocalTransferFeeAmount({
386
- originToken,
387
- destination: destinationChain,
388
- sender: address,
389
- interchainFee: igpQuote,
390
- tokenFeeQuote,
391
- amount: BigInt(wei.toString()),
392
- destinationToken: destToken
393
- });
394
- return {
395
- amount: amountToBridge2,
396
- igpFee: String(igpQuote.getDecimalFormattedAmount()),
397
- localFee: String(localQuote.getDecimalFormattedAmount()),
398
- tokenFee: tokenFeeQuote ? String(tokenFeeQuote.getDecimalFormattedAmount()) : void 0,
399
- igpSymbol: igpQuote.token.symbol,
400
- localSymbol: localQuote.token.symbol
401
- };
402
- },
403
- onSuccess: (quote) => {
404
- const { bridgeStep, setQuote, setIsQuoteEstimating } = _chunkYVHXT2JXcjs.useBridgeStore.getState();
405
- setQuote(quote);
406
- setIsQuoteEstimating(false);
407
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setIsUiLocked(false);
408
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setRenderKey(`${bridgeStep}-quoted-${Date.now()}`);
409
- },
410
- onError: (error) => {
411
- const { setQuote, setIsQuoteEstimating } = _chunkYVHXT2JXcjs.useBridgeStore.getState();
412
- console.error("[HYPERLANE SDK] Quote estimation error", error);
413
- setQuote(null);
414
- setIsQuoteEstimating(false);
415
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setIsUiLocked(false);
416
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
417
- }
418
- });
419
- const defferedQuoteEstimation = _react.useCallback.call(void 0,
420
- _lodashes.debounce.call(void 0, (amountToBridge2) => {
421
- estimateQuote(amountToBridge2);
422
- }, 600),
423
- []
424
- );
425
- _react.useEffect.call(void 0, () => {
426
- if (!amountToBridge || !Number(amountToBridge)) return;
427
- const { originChain, destinationChain } = _chunkYVHXT2JXcjs.useBridgeStore.getState();
428
- if (!originChain || !destinationChain) return;
429
- const warpCoreConfig = _chunkYVHXT2JXcjs.useBridgeStore.getState().warpCoreConfig;
430
- const routeReady = isDirectRouteAvailable(warpCoreConfig, originChain, destinationChain);
431
- if (!routeReady) {
432
- console.warn("[HYPERLANE SDK] route not ready");
433
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setError(
434
- // @ts-expect-error i18n typing
435
- t("passport:bridgeMenu.errors.routeUnavailable", { originChain, destinationChain })
436
- );
437
- return;
438
- }
439
- defferedQuoteEstimation(amountToBridge);
440
- }, [amountToBridge]);
441
- const { mutate: bridgeAsset, isPending: isAssetBridging } = _reactquery.useMutation.call(void 0, {
442
- mutationFn: async () => {
443
- const {
444
- //
445
- originChain,
446
- destinationChain,
447
- amount,
448
- recipient,
449
- setBridgeTxStatus,
450
- setLastTxHashes
451
- } = _chunkYVHXT2JXcjs.useBridgeStore.getState();
452
- _chunkYVHXT2JXcjs.useLayoutStore.getState().setIsDialogForced(true);
453
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setIsUiLocked(true);
454
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setError(null);
455
- setBridgeTxStatus(null);
456
- setLastTxHashes([]);
457
- const expectedChainId = warpCore.multiProvider.getChainId(originChain);
458
- console.warn("[HYPERLANE SDK] expectedChainId", expectedChainId, "currentChainId", currentChainId);
459
- if (currentChainId !== expectedChainId) {
460
- throw new Error(t("passport:bridgeMenu.errors.wrongNetwork"));
461
- }
462
- const originToken = findToken(warpCore, originChain);
463
- const destToken = originToken ? findDestinationToken(warpCore, originToken, destinationChain) : void 0;
464
- if (!originToken || !destToken) {
465
- throw new Error(
466
- // @ts-expect-error i18n typing
467
- t("passport:bridgeMenu.errors.noConnections", { originChain, destinationChain })
468
- );
469
- }
470
- setBridgeTxStatus(t("passport:bridgeMenu.statuses.txPrepare"));
471
- const wei = _utils.toWei.call(void 0, amount, originToken.decimals);
472
- const originTokenAmount = originToken.amount(wei);
473
- const to = recipient || address;
474
- console.log("[HYPERLANE SDK] tokens:\n", originToken, "->", destToken);
475
- const { igpQuote, tokenFeeQuote } = await warpCore.getInterchainTransferFee({
476
- originTokenAmount,
477
- destination: destinationChain,
478
- sender: address,
479
- recipient: to,
480
- destinationToken: destToken
481
- });
482
- const txs = await warpCore.getTransferRemoteTxs({
483
- originTokenAmount,
484
- destination: destinationChain,
485
- sender: address,
486
- recipient: to,
487
- interchainFee: igpQuote,
488
- tokenFeeQuote,
489
- destinationToken: destToken
490
- });
491
- setBridgeTxStatus(
492
- // @ts-expect-error i18n typing
493
- t("passport:bridgeMenu.statuses.txSending", { txCount: txs.length })
494
- );
495
- return await executeWarpTransactions(txs);
496
- },
497
- onSuccess: (hashes) => {
498
- const { setBridgeStep, setBridgeTxStatus, setLastTxHashes, destinationChain } = _chunkYVHXT2JXcjs.useBridgeStore.getState();
499
- setLastTxHashes(hashes);
500
- setBridgeTxStatus(
501
- // @ts-expect-error i18n typing
502
- t("passport:bridgeMenu.statuses.txSent", { destination: destinationChain })
503
- );
504
- _chunkYVHXT2JXcjs.useLayoutStore.getState().setIsDialogForced(false);
505
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setIsUiLocked(false);
506
- setBridgeStep("success");
507
- },
508
- onError: (error) => {
509
- console.error("[HYPERLANE SDK] Bridge execution error", error);
510
- const { setBridgeTxStatus } = _chunkYVHXT2JXcjs.useBridgeStore.getState();
511
- setBridgeTxStatus(null);
512
- _chunkYVHXT2JXcjs.useLayoutStore.getState().setIsDialogForced(false);
513
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setIsUiLocked(false);
514
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
515
- }
516
- });
517
- return {
518
- swapDirection,
519
- bridgeAsset,
520
- isAssetBridging
521
- };
522
- }
523
-
524
- // src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts
525
-
526
- function useMenuTitle() {
527
- const { t } = _chunkYVHXT2JXcjs.useT.call(void 0, );
528
- const bridgeStep = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.bridgeStep);
529
- const hyperRouteMeta = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => WARP_ROUTES.find((route) => route.id === st.hyperRoute));
530
- _react.useEffect.call(void 0, () => {
531
- const updateMenuTitle = _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setMenuTitle;
532
- switch (true) {
533
- case bridgeStep === "select-token":
534
- updateMenuTitle(t("passport:bridgeMenu.labels.selectToken"));
535
- break;
536
- case bridgeStep === "confirm":
537
- updateMenuTitle(t("passport:bridgeMenu.labels.confirm"));
538
- break;
539
- case bridgeStep === "success":
540
- updateMenuTitle(t("passport:bridgeMenu.labels.bridgeTransactions"));
541
- break;
542
- default:
543
- updateMenuTitle(
544
- // @ts-expect-error i18n typings
545
- t("passport:bridgeMenu.labels.bridgeAsset", {
546
- asset: _optionalChain([hyperRouteMeta, 'optionalAccess', _6 => _6.symbol]) || "Asset"
547
- })
548
- );
549
- break;
550
- }
551
- }, [bridgeStep, hyperRouteMeta, t]);
552
- }
553
-
554
- // src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx
555
-
556
-
557
-
558
- // src/internal/components/SendMenu/hyperbridge/utils.ts
559
- var _viem = require('viem');
560
- function isNftAsset(asset) {
561
- if (!asset) return false;
562
- return asset.type === "erc721" || asset.type === "erc1155";
563
- }
564
- function getAssetBalance(asset) {
565
- if (!asset) return 0;
566
- if (isNftAsset(asset)) return 1;
567
- return Number(_viem.formatUnits.call(void 0, BigInt(asset.balance || "0"), asset.decimals || 18));
568
- }
569
-
570
- // src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx
571
-
572
- function SelectStep({ swapChains }) {
573
- const address = _chunkYVHXT2JXcjs.useSession.call(void 0, (st) => st.address);
574
- const { t } = _chunkYVHXT2JXcjs.useT.call(void 0, );
575
- const {
576
- originChain,
577
- destinationChain,
578
- hyperRoute,
579
- amount,
580
- isQuoteEstimating,
581
- quote,
582
- recipient,
583
- setBridgeStep,
584
- setAmount,
585
- setRecipient
586
- } = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, );
587
- const {
588
- assets,
589
- refreshBalances,
590
- isLoading: isAssetsLoading
591
- } = _chunkYVHXT2JXcjs.useBlockscoutAssets.call(void 0, {
592
- address
593
- });
594
- const selectedWarpRoute = WARP_ROUTES.find((route) => route.id === hyperRoute);
595
- const routeTokenBalanace = assets.find((a) => a.symbol === selectedWarpRoute.symbol);
596
- const balance = routeTokenBalanace ? getAssetBalance(routeTokenBalanace) : null;
597
- const isError = _chunkYVHXT2JXcjs.useFlowSelectorStore.call(void 0, (st) => !!st.error);
598
- const OriginChainIcon = originChain ? _optionalChain([CHAINS_META, 'access', _7 => _7[originChain], 'optionalAccess', _8 => _8.Icon]) : null;
599
- const DestinationChainIcon = destinationChain ? _optionalChain([CHAINS_META, 'access', _9 => _9[destinationChain], 'optionalAccess', _10 => _10.Icon]) : null;
600
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)] items-center", children: [
601
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
602
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between gap-[var(--ui-kit-gap)] text-[10px]", children: [
603
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-[var(--ui-kit-fg-muted)]", children: t("passport:bridgeMenu.labels.selectToken") }),
604
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "w-4 h-4" }),
605
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-[var(--ui-kit-gap)] leading-4", children: [
606
- isAssetsLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.LoaderIcon, { className: "w-4 h-4 animate-spin" }),
607
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-[var(--ui-kit-fg-muted)]", children: [
608
- t("passport:common.balance"),
609
- ": "
610
- ] }),
611
- !isAssetsLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "font-semibold", children: [
612
- _chunkYVHXT2JXcjs.formatPrice.call(void 0, balance || 0),
613
- " ",
614
- _optionalChain([selectedWarpRoute, 'optionalAccess', _11 => _11.symbol])
615
- ] })
616
- ] })
617
- ] }),
618
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
619
- _chunkYVHXT2JXcjs.Button,
620
- {
621
- disabled: isQuoteEstimating,
622
- variant: "outline",
623
- className: "w-full justify-between",
624
- onClick: () => {
625
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setError(null);
626
- setBridgeStep("select-token");
627
- refreshBalances();
628
- },
629
- children: [
630
- selectedWarpRoute && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: [
631
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, selectedWarpRoute.icon, { className: "w-6 h-6" }),
632
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: selectedWarpRoute.symbol })
633
- ] }),
634
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-[var(--ui-kit-gap)]", children: _optionalChain([selectedWarpRoute, 'optionalAccess', _12 => _12.chainPair, 'optionalAccess', _13 => _13.map, 'call', _14 => _14((chain, chIdx) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
635
- chIdx > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArrowLeftRightIcon, { className: "w-4 h-4 opacity-50" }),
636
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, chain.Icon, { className: "w-4 h-4 opacity-50" })
637
- ] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))]) })
638
- ]
639
- }
640
- ),
641
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
642
- "div",
643
- {
644
- className: _chunkYVHXT2JXcjs.cn.call(void 0,
645
- "flex items-center justify-between gap-[var(--ui-kit-gap)]",
646
- "text-[10px] text-[var(--ui-kit-fg-muted)] leading-4"
647
- ),
648
- children: [
649
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "block text-[10px] text-[var(--ui-kit-fg-muted)]", children: t("passport:bridgeMenu.labels.fromChain") }),
650
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "block text-[10px] text-[var(--ui-kit-fg-muted)]", children: t("passport:bridgeMenu.labels.toChain") })
651
- ]
652
- }
653
- ),
654
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "w-full flex items-center justify-center", children: [
655
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
656
- _chunkYVHXT2JXcjs.Badge,
657
- {
658
- variant: "outline",
659
- size: "large",
660
- className: "block flex-1 flex gap-[var(--ui-kit-gap)] justify-center",
661
- children: [
662
- OriginChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, OriginChainIcon, { className: "w-6 h-6" }),
663
- originChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "block max-w-[100px] truncate", children: _optionalChain([CHAINS_META, 'access', _15 => _15[originChain], 'optionalAccess', _16 => _16.chainLabel]) })
664
- ]
665
- }
666
- ),
667
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
668
- _chunkYVHXT2JXcjs.Button,
669
- {
670
- size: "icon",
671
- disabled: isQuoteEstimating,
672
- variant: "ghost",
673
- onClick: swapChains,
674
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArrowRightLeftIcon, { className: "w-4 h-4 " })
675
- }
676
- ),
677
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
678
- _chunkYVHXT2JXcjs.Badge,
679
- {
680
- variant: "outline",
681
- size: "large",
682
- className: "block flex-1 flex gap-[var(--ui-kit-gap)] justify-center",
683
- children: [
684
- DestinationChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DestinationChainIcon, { className: "w-6 h-6" }),
685
- destinationChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "block max-w-[100px] truncate", children: _optionalChain([CHAINS_META, 'access', _17 => _17[destinationChain], 'optionalAccess', _18 => _18.chainLabel]) })
686
- ]
687
- }
688
- )
689
- ] }),
690
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
691
- "div",
692
- {
693
- className: _chunkYVHXT2JXcjs.cn.call(void 0,
694
- //
695
- "w-full flex flex-col",
696
- "text-[10px]",
697
- "gap-[var(--ui-kit-gap)]"
698
- ),
699
- children: [
700
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-[var(--ui-kit-fg-muted)] leading-4", children: t("passport:common.amount") }),
701
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
702
- _chunkYVHXT2JXcjs.Input,
703
- {
704
- type: "text",
705
- disabled: isQuoteEstimating || !originChain || !destinationChain || !hyperRoute,
706
- placeholder: t("passport:common.amount"),
707
- onChange: (e) => {
708
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setError(null);
709
- let { value } = e.target;
710
- const regex = /^(0|[1-9]\d*)(\.\d{0,5})?$/;
711
- if (value.length > 1 && value.startsWith("0") && !value.startsWith("0.")) {
712
- value = value.slice(1);
713
- }
714
- if (regex.test(value) || value === "") {
715
- if (value === "") {
716
- setAmount("0");
717
- } else {
718
- setAmount(value);
719
- }
720
- }
721
- },
722
- value: amount
723
- }
724
- )
725
- ]
726
- }
727
- ),
728
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
729
- "div",
730
- {
731
- className: _chunkYVHXT2JXcjs.cn.call(void 0,
732
- //
733
- "w-full flex flex-col",
734
- "text-[10px]",
735
- "gap-[var(--ui-kit-gap)] pb-[var(--ui-kit-pd)]"
736
- ),
737
- children: [
738
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-[var(--ui-kit-fg-muted)] leading-4", children: t("passport:bridgeMenu.labels.optionalRecipient") }),
739
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
740
- _chunkYVHXT2JXcjs.Input,
741
- {
742
- type: "text",
743
- disabled: isQuoteEstimating || !originChain || !destinationChain || !hyperRoute,
744
- placeholder: t("passport:bridgeMenu.labels.optionalRecipient") + " (ex: 0x...)",
745
- value: recipient || "",
746
- Icon: _lucidereact.Wallet2Icon,
747
- onChange: (e) => {
748
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setError(null);
749
- setRecipient(e.target.value);
750
- },
751
- element: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
752
- _chunkYVHXT2JXcjs.Button,
753
- {
754
- size: "icon",
755
- disabled: isQuoteEstimating,
756
- variant: "ghost",
757
- onClick: (e) => {
758
- e.stopPropagation();
759
- setRecipient(null);
760
- },
761
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.XIcon, { className: "w-4 h-4" })
762
- }
763
- )
764
- }
765
- )
766
- ]
767
- }
768
- )
769
- ] }),
770
- quote && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVHXT2JXcjs.Highlight, { type: "info", className: "flex flex-col gap-[var(--ui-kit-gap)] w-full", children: [
771
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "flex-1 flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
772
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.quote.amount") }),
773
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: _chunkYVHXT2JXcjs.formatPrice.call(void 0, Number(quote.amount)) })
774
- ] }),
775
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "flex-1 flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
776
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.quote.igpFee") }),
777
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "strong", { children: [
778
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkYVHXT2JXcjs.formatPrice.call(void 0, Number(quote.igpFee)) }),
779
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
780
- " ",
781
- quote.igpSymbol
782
- ] })
783
- ] })
784
- ] }),
785
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "flex-1 flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
786
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.quote.localFee") }),
787
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "strong", { children: [
788
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkYVHXT2JXcjs.formatPrice.call(void 0, Number(quote.localFee)) }),
789
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
790
- " ",
791
- quote.localSymbol
792
- ] })
793
- ] })
794
- ] }),
795
- quote.tokenFee && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "flex-1 flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
796
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.quote.tokenFee") }),
797
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: _chunkYVHXT2JXcjs.formatPrice.call(void 0, Number(quote.tokenFee)) })
798
- ] })
799
- ] }),
800
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
801
- _chunkYVHXT2JXcjs.Button,
802
- {
803
- size: "large",
804
- variant: "default",
805
- className: "w-full",
806
- disabled: isQuoteEstimating || isError || !quote,
807
- onClick: () => _chunkYVHXT2JXcjs.useBridgeStore.getState().setBridgeStep("confirm"),
808
- children: [
809
- isQuoteEstimating && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.LoaderIcon, { className: "h-4 w-4 animate-spin" }),
810
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t(
811
- (() => {
812
- switch (true) {
813
- // case isWalletChainConnecting:
814
- // return 'passport:bridgeMenu.statuses.switchingWalletChain'
815
- case isQuoteEstimating:
816
- return "passport:bridgeMenu.statuses.qouteEstimating";
817
- default:
818
- return "passport:bridgeMenu.actions.confirmBridge";
819
- }
820
- })()
821
- ).toUpperCase() })
822
- ]
823
- }
824
- )
825
- ] });
826
- }
827
-
828
- // src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
829
-
830
-
831
- var P_CN = "flex-1 flex items-center justify-between gap-[var(--ui-kit-gap)]";
832
- function ConfirmStep(props) {
833
- const { isAssetBridging, bridgeAsset } = props;
834
- const { t } = _chunkYVHXT2JXcjs.useT.call(void 0, );
835
- const address = _chunkYVHXT2JXcjs.useSession.call(void 0, (st) => st.address);
836
- const isError = _chunkYVHXT2JXcjs.useFlowSelectorStore.call(void 0, (st) => !!st.error);
837
- const quote = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.quote);
838
- const originChain = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.originChain);
839
- const destinationChain = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.destinationChain);
840
- const recipient = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.recipient);
841
- const bridgeTxStatus = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.bridgeTxStatus);
842
- const recipientAddress = (recipient || address).slice(0, 6) + "..." + (recipient || address).slice(-4);
843
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
844
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVHXT2JXcjs.Highlight, { type: "info", className: "flex flex-col gap-[var(--ui-kit-gap)] w-full", children: [
845
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: P_CN, children: [
846
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.quote.recipient") }),
847
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: recipientAddress })
848
- ] }),
849
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: P_CN, children: [
850
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.labels.fromChain") }),
851
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: CHAINS_META[originChain].chainLabel })
852
- ] }),
853
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: P_CN, children: [
854
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.labels.toChain") }),
855
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: CHAINS_META[destinationChain].chainLabel })
856
- ] }),
857
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: P_CN, children: [
858
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.quote.amount") }),
859
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: _chunkYVHXT2JXcjs.formatPrice.call(void 0, Number(quote.amount)) })
860
- ] }),
861
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "flex-1 flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
862
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.quote.igpFee") }),
863
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "strong", { children: [
864
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkYVHXT2JXcjs.formatPrice.call(void 0, Number(quote.igpFee)) }),
865
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
866
- " ",
867
- quote.igpSymbol
868
- ] })
869
- ] })
870
- ] }),
871
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "flex-1 flex items-center justify-between gap-[var(--ui-kit-gap)]", children: [
872
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.quote.localFee") }),
873
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "strong", { children: [
874
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkYVHXT2JXcjs.formatPrice.call(void 0, Number(quote.localFee)) }),
875
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
876
- " ",
877
- quote.localSymbol
878
- ] })
879
- ] })
880
- ] }),
881
- quote.tokenFee && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: P_CN, children: [
882
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.quote.tokenFee") }),
883
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: _chunkYVHXT2JXcjs.formatPrice.call(void 0, Number(quote.tokenFee)) })
884
- ] })
885
- ] }),
886
- !isError && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
887
- _chunkYVHXT2JXcjs.Button,
888
- {
889
- size: "large",
890
- variant: "default",
891
- disabled: isAssetBridging,
892
- onClick: () => bridgeAsset(),
893
- className: "w-full",
894
- children: [
895
- isAssetBridging && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.LoaderIcon, { className: "h-4 w-4 animate-spin" }),
896
- isAssetBridging ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.statuses.txExecuting").toUpperCase() }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: (bridgeTxStatus || t("passport:common.continue")).toUpperCase() })
897
- ]
898
- }
899
- )
900
- ] });
901
- }
902
-
903
- // src/internal/components/SendMenu/hyperbridge/steps/SuccessStep.tsx
904
-
905
- var P_CN2 = "w-full flex-1 flex items-center justify-between gap-[var(--ui-kit-gap)]";
906
- function SuccessStep() {
907
- const { t } = _chunkYVHXT2JXcjs.useT.call(void 0, );
908
- const address = _chunkYVHXT2JXcjs.useSession.call(void 0, (st) => st.address);
909
- const amount = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.amount);
910
- const originChain = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.originChain);
911
- const destinationChain = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.destinationChain);
912
- const recipient = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.recipient);
913
- const lastTxHashes = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.lastTxHashes);
914
- const bridgeTxStatus = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.bridgeTxStatus);
915
- const recipientAddress = (recipient || address).slice(0, 6) + "..." + (recipient || address).slice(-4);
916
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
917
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVHXT2JXcjs.Highlight, { type: "success", className: "flex flex-col gap-[var(--ui-kit-gap)] w-full", children: [
918
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: P_CN2, children: [
919
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.quote.status") }),
920
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: bridgeTxStatus })
921
- ] }),
922
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: P_CN2, children: [
923
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.quote.recipient") }),
924
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: recipientAddress })
925
- ] }),
926
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: P_CN2, children: [
927
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.labels.fromChain") }),
928
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: CHAINS_META[originChain].chainLabel })
929
- ] }),
930
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: P_CN2, children: [
931
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.labels.toChain") }),
932
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: CHAINS_META[destinationChain].chainLabel })
933
- ] }),
934
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: P_CN2, children: [
935
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("passport:bridgeMenu.quote.amount") }),
936
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: _chunkYVHXT2JXcjs.formatPrice.call(void 0, Number(amount)) })
937
- ] }),
938
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mt-[var(--ui-kit-gap)]", children: t("passport:bridgeMenu.labels.bridgeTransactions") + ":" }),
939
- lastTxHashes.map((hash) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "truncate max-w-full font-mono! text-sm", children: hash }, hash))
940
- ] }),
941
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
942
- _chunkYVHXT2JXcjs.Button,
943
- {
944
- size: "large",
945
- variant: "default",
946
- className: "w-full",
947
- onClick: () => {
948
- _chunkYVHXT2JXcjs.useFlowSelectorStore.getState().setError(null);
949
- _chunkYVHXT2JXcjs.useBridgeStore.getState().setBridgeTxStatus(null);
950
- _chunkYVHXT2JXcjs.useBridgeStore.getState().setLastTxHashes([]);
951
- _chunkYVHXT2JXcjs.useBridgeStore.getState().setBridgeStep("select");
952
- },
953
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: `${t("passport:common.continue")}`.toUpperCase() })
954
- }
955
- )
956
- ] });
957
- }
958
-
959
- // src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx
960
-
961
- function HyperlaneBridge() {
962
- const { swapDirection, bridgeAsset, isAssetBridging } = useBridge();
963
- useMenuTitle();
964
- const bridgeStep = _chunkYVHXT2JXcjs.useBridgeStore.call(void 0, (st) => st.bridgeStep);
965
- _react.useEffect.call(void 0, () => () => _chunkYVHXT2JXcjs.useBridgeStore.getState().resetSelections(), []);
966
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
967
- bridgeStep === "select-token" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenSelector, {}),
968
- bridgeStep === "select" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectStep, { swapChains: swapDirection }),
969
- bridgeStep === "confirm" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ConfirmStep, { isAssetBridging, bridgeAsset }),
970
- bridgeStep === "success" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SuccessStep, {})
971
- ] });
972
- }
973
-
974
- // src/internal/components/SendMenu/hyperbridge/index.ts
975
- var hyperbridge_default = HyperlaneBridge;
976
-
977
-
978
-
979
- exports.default = hyperbridge_default; exports.useBridgeStore = _chunkYVHXT2JXcjs.useBridgeStore;
980
- //# sourceMappingURL=hyperbridge-4LS4PDRE.cjs.map