@embarkai/ui-kit 0.4.20 → 0.4.22

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