@rhinestone/deposit-modal 0.1.68 → 0.1.70

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.
@@ -215,6 +215,69 @@ function isSolanaCaip2(value) {
215
215
  }
216
216
 
217
217
  // src/core/deposit-service.ts
218
+ function depositRowToEvent(row) {
219
+ const status = row.status;
220
+ if (!status) return void 0;
221
+ const deposit = {
222
+ transactionHash: row.txHash,
223
+ chain: row.chain,
224
+ amount: _nullishCoalesce(row.sourceAmount, () => ( row.amount)),
225
+ asset: row.token,
226
+ token: row.token
227
+ };
228
+ const source = row.sourceTxHash ? { transactionHash: row.sourceTxHash, chain: row.chain } : { transactionHash: row.txHash, chain: row.chain };
229
+ const destination = row.destinationTxHash ? {
230
+ transactionHash: row.destinationTxHash,
231
+ chain: row.targetChain,
232
+ amount: _nullishCoalesce(row.destinationAmount, () => ( void 0))
233
+ } : void 0;
234
+ const time = _nullishCoalesce(_nullishCoalesce(row.completedAt, () => ( row.createdAt)), () => ( void 0));
235
+ if (status === "completed") {
236
+ return {
237
+ type: "post-bridge-swap-complete",
238
+ time: _nullishCoalesce(time, () => ( void 0)),
239
+ data: {
240
+ deposit,
241
+ source,
242
+ ...destination && { destination },
243
+ ...destination && {
244
+ swap: { transactionHash: destination.transactionHash }
245
+ }
246
+ }
247
+ };
248
+ }
249
+ if (status === "failed" || status === "refunded") {
250
+ return {
251
+ type: "bridge-failed",
252
+ time: _nullishCoalesce(time, () => ( void 0)),
253
+ data: {
254
+ deposit,
255
+ source,
256
+ ...row.errorCode && { error: { code: row.errorCode } }
257
+ }
258
+ };
259
+ }
260
+ if (status === "processing") {
261
+ return {
262
+ type: "bridge-started",
263
+ time: _nullishCoalesce(time, () => ( void 0)),
264
+ data: {
265
+ deposit,
266
+ source
267
+ }
268
+ };
269
+ }
270
+ return {
271
+ type: "deposit-received",
272
+ time: _nullishCoalesce(time, () => ( void 0)),
273
+ data: {
274
+ transactionHash: row.txHash,
275
+ chain: row.chain,
276
+ amount: row.amount,
277
+ token: row.token
278
+ }
279
+ };
280
+ }
218
281
  function jsonReplacer(_key, value) {
219
282
  return typeof value === "bigint" ? value.toString() : value;
220
283
  }
@@ -488,15 +551,14 @@ function createDepositService(baseUrl, options) {
488
551
  async fetchStatus(address, txHash) {
489
552
  const normalized = txHash.startsWith("0x") || txHash.startsWith("0X") ? txHash.toLowerCase() : txHash;
490
553
  const txHashParam = encodeURIComponent(normalized);
491
- const url = apiUrl(`/status/${address}?txHash=${txHashParam}`);
492
- const response = await fetch(
493
- url,
494
- {
495
- method: "GET",
496
- headers: { "Content-Type": "application/json" },
497
- cache: "no-store"
498
- }
554
+ const url = apiUrl(
555
+ `/deposits?account=${encodeURIComponent(address)}&txHash=${txHashParam}&limit=1`
499
556
  );
557
+ const response = await fetch(url, {
558
+ method: "GET",
559
+ headers: { "Content-Type": "application/json" },
560
+ cache: "no-store"
561
+ });
500
562
  if (!response.ok) {
501
563
  debugLog(debug, scope, "fetchStatus:miss", {
502
564
  address,
@@ -505,16 +567,20 @@ function createDepositService(baseUrl, options) {
505
567
  });
506
568
  return { lastEvent: void 0 };
507
569
  }
508
- const result = await response.json();
570
+ const body = await response.json();
571
+ const row = _optionalChain([body, 'access', _11 => _11.deposits, 'optionalAccess', _12 => _12[0]]);
572
+ const lastEvent = row ? depositRowToEvent(row) : void 0;
509
573
  debugLog(debug, scope, "fetchStatus:success", {
510
574
  address,
511
575
  txHash: shortRef(normalized),
512
- eventType: _optionalChain([result, 'optionalAccess', _11 => _11.lastEvent, 'optionalAccess', _12 => _12.type])
576
+ eventType: _optionalChain([lastEvent, 'optionalAccess', _13 => _13.type])
513
577
  });
514
- return result;
578
+ return { lastEvent };
515
579
  },
516
580
  async fetchLatestStatus(address) {
517
- const url = apiUrl(`/status/${address}`);
581
+ const url = apiUrl(
582
+ `/deposits?account=${encodeURIComponent(address)}&limit=1`
583
+ );
518
584
  const response = await fetch(url, {
519
585
  method: "GET",
520
586
  headers: { "Content-Type": "application/json" },
@@ -527,16 +593,18 @@ function createDepositService(baseUrl, options) {
527
593
  });
528
594
  return { lastEvent: void 0 };
529
595
  }
530
- const result = await response.json();
596
+ const body = await response.json();
597
+ const row = _optionalChain([body, 'access', _14 => _14.deposits, 'optionalAccess', _15 => _15[0]]);
598
+ const lastEvent = row ? depositRowToEvent(row) : void 0;
531
599
  debugLog(debug, scope, "fetchLatestStatus:success", {
532
600
  address,
533
- eventType: _optionalChain([result, 'optionalAccess', _13 => _13.lastEvent, 'optionalAccess', _14 => _14.type])
601
+ eventType: _optionalChain([lastEvent, 'optionalAccess', _16 => _16.type])
534
602
  });
535
- return result;
603
+ return { lastEvent };
536
604
  },
537
605
  async relayWithdraw(params) {
538
606
  const { smartAccount, chainId, safeAddress, safeTransaction, signature } = params;
539
- const url = apiUrl(`/relay-withdraw`);
607
+ const url = apiUrl(`/safe/withdraw`);
540
608
  debugLog(debug, scope, "relayWithdraw:request", {
541
609
  url,
542
610
  smartAccount,
@@ -592,7 +660,7 @@ function createDepositService(baseUrl, options) {
592
660
  smartAccount,
593
661
  chainId,
594
662
  safeAddress,
595
- txHash: _optionalChain([result, 'optionalAccess', _15 => _15.txHash]) ? shortRef(result.txHash) : void 0
663
+ txHash: _optionalChain([result, 'optionalAccess', _17 => _17.txHash]) ? shortRef(result.txHash) : void 0
596
664
  });
597
665
  return result;
598
666
  },
@@ -627,29 +695,73 @@ function createDepositService(baseUrl, options) {
627
695
  );
628
696
  }
629
697
  const data = await response.json();
630
- const deposits = Array.isArray(_optionalChain([data, 'optionalAccess', _16 => _16.deposits])) ? data.deposits : [];
631
- const nextCursor = _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _17 => _17.nextCursor]), () => ( _optionalChain([data, 'optionalAccess', _18 => _18.next_cursor]))), () => ( null));
698
+ const deposits = Array.isArray(_optionalChain([data, 'optionalAccess', _18 => _18.deposits])) ? data.deposits : [];
699
+ const nextCursor = _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _19 => _19.nextCursor]), () => ( _optionalChain([data, 'optionalAccess', _20 => _20.next_cursor]))), () => ( null));
632
700
  debugLog(debug, scope, "fetchDepositHistory:success", {
633
701
  account: shortRef(params.account),
634
702
  count: deposits.length,
635
703
  hasMore: Boolean(nextCursor)
636
704
  });
637
705
  return { deposits, nextCursor };
706
+ },
707
+ async checkLiquidity(params) {
708
+ const searchParams = new URLSearchParams({
709
+ sourceChainId: String(params.sourceChainId),
710
+ sourceToken: params.sourceToken,
711
+ destinationChainId: String(params.destinationChainId),
712
+ destinationToken: params.destinationToken,
713
+ amount: params.amount
714
+ });
715
+ const url = apiUrl(`/liquidity?${searchParams.toString()}`);
716
+ debugLog(debug, scope, "checkLiquidity:request", {
717
+ url,
718
+ sourceChainId: params.sourceChainId,
719
+ destinationChainId: params.destinationChainId,
720
+ amount: params.amount
721
+ });
722
+ const response = await fetch(url, {
723
+ method: "GET",
724
+ headers: { "Content-Type": "application/json" },
725
+ cache: "no-store"
726
+ });
727
+ if (!response.ok) {
728
+ const error = await response.json().catch(() => ({ error: "Unknown error" }));
729
+ debugError(debug, scope, "checkLiquidity:failed", error, {
730
+ status: response.status
731
+ });
732
+ throw new Error(
733
+ error.error || `Liquidity check failed: ${response.status}`
734
+ );
735
+ }
736
+ const data = await response.json();
737
+ const result = {
738
+ hasLiquidity: data.hasLiquidity === true,
739
+ symbol: typeof data.symbol === "string" ? data.symbol : "",
740
+ decimals: typeof data.decimals === "number" ? data.decimals : 0,
741
+ unlimited: data.unlimited === true,
742
+ maxAmount: typeof data.maxAmount === "string" ? data.maxAmount : null
743
+ };
744
+ debugLog(debug, scope, "checkLiquidity:success", {
745
+ hasLiquidity: result.hasLiquidity,
746
+ unlimited: result.unlimited,
747
+ maxAmount: result.maxAmount
748
+ });
749
+ return result;
638
750
  }
639
751
  };
640
752
  }
641
753
  function normalizeDirectPortfolio(data) {
642
754
  const rawTokens = _nullishCoalesce(_nullishCoalesce(extractArray(data, "tokens"), () => ( extractArray(
643
- _optionalChain([data, 'optionalAccess', _19 => _19.data]),
755
+ _optionalChain([data, 'optionalAccess', _21 => _21.data]),
644
756
  "tokens"
645
757
  ))), () => ( []));
646
- const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess', _20 => _20.data]), "totalUsd"))), () => ( 0));
758
+ const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess', _22 => _22.data]), "totalUsd"))), () => ( 0));
647
759
  const tokens = rawTokens.map((token) => normalizeDirectToken(token)).filter((token) => Boolean(token));
648
760
  return { tokens, totalUsd };
649
761
  }
650
762
  function extractOrchestratorPortfolio(data) {
651
763
  const portfolio = _nullishCoalesce(extractArray(data, "portfolio"), () => ( extractArray(
652
- _optionalChain([data, 'optionalAccess', _21 => _21.data]),
764
+ _optionalChain([data, 'optionalAccess', _23 => _23.data]),
653
765
  "portfolio"
654
766
  )));
655
767
  if (!portfolio || !Array.isArray(portfolio)) return null;
@@ -660,7 +772,7 @@ function normalizeOrchestratorPortfolio(data) {
660
772
  for (const tokenData of data.portfolio || []) {
661
773
  const chainBalances = _nullishCoalesce(_nullishCoalesce(tokenData.tokenChainBalance, () => ( tokenData.chainBalances)), () => ( []));
662
774
  for (const chainBalance of chainBalances) {
663
- const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _22 => _22.balance, 'optionalAccess', _23 => _23.unlocked]), () => ( "0"));
775
+ const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _24 => _24.balance, 'optionalAccess', _25 => _25.unlocked]), () => ( "0"));
664
776
  const normalizedName = tokenData.tokenName.trim();
665
777
  const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
666
778
  const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => ( _chunkMUWVDVY4cjs.getTokenAddress.call(void 0, tokenData.tokenName, chainBalance.chainId)));
@@ -694,7 +806,7 @@ function normalizeDirectToken(token) {
694
806
  if (chainId === null) return null;
695
807
  const symbol = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "symbol"), () => ( extractString(token, "tokenSymbol"))), () => ( extractString(token, "tokenName"))), () => ( extractString(token, "name")));
696
808
  if (!symbol) return null;
697
- const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call', _24 => _24(token, "balance"), 'optionalAccess', _25 => _25.toString, 'call', _26 => _26()]))), () => ( _optionalChain([extractNumber, 'call', _27 => _27(token, "amount"), 'optionalAccess', _28 => _28.toString, 'call', _29 => _29()]))), () => ( _optionalChain([extractNumber, 'call', _30 => _30(token, "value"), 'optionalAccess', _31 => _31.toString, 'call', _32 => _32()]))), () => ( _optionalChain([extractNumber, 'call', _33 => _33(token, "rawBalance"), 'optionalAccess', _34 => _34.toString, 'call', _35 => _35()])));
809
+ const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call', _26 => _26(token, "balance"), 'optionalAccess', _27 => _27.toString, 'call', _28 => _28()]))), () => ( _optionalChain([extractNumber, 'call', _29 => _29(token, "amount"), 'optionalAccess', _30 => _30.toString, 'call', _31 => _31()]))), () => ( _optionalChain([extractNumber, 'call', _32 => _32(token, "value"), 'optionalAccess', _33 => _33.toString, 'call', _34 => _34()]))), () => ( _optionalChain([extractNumber, 'call', _35 => _35(token, "rawBalance"), 'optionalAccess', _36 => _36.toString, 'call', _37 => _37()])));
698
810
  if (!balanceValue) return null;
699
811
  const address = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "address"), () => ( extractString(token, "tokenAddress"))), () => ( extractString(
700
812
  token.token,
@@ -719,7 +831,7 @@ function normalizeDirectToken(token) {
719
831
  }
720
832
  function extractTokenAddress(tokenData, chainId) {
721
833
  const token = tokenData;
722
- return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access', _36 => _36.addresses, 'optionalAccess', _37 => _37[chainId]]))), () => ( _optionalChain([token, 'access', _38 => _38.token, 'optionalAccess', _39 => _39.address]))), () => ( _optionalChain([token, 'access', _40 => _40.token, 'optionalAccess', _41 => _41.addresses, 'optionalAccess', _42 => _42[chainId]])));
834
+ return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access', _38 => _38.addresses, 'optionalAccess', _39 => _39[chainId]]))), () => ( _optionalChain([token, 'access', _40 => _40.token, 'optionalAccess', _41 => _41.address]))), () => ( _optionalChain([token, 'access', _42 => _42.token, 'optionalAccess', _43 => _43.addresses, 'optionalAccess', _44 => _44[chainId]])));
723
835
  }
724
836
  function extractArray(data, key) {
725
837
  if (!data || typeof data !== "object") return null;
@@ -877,19 +989,19 @@ function setVar(targets, prop, value) {
877
989
  function applyTheme(element, theme) {
878
990
  if (!element) return;
879
991
  const parent = element.parentElement;
880
- const targets = _optionalChain([parent, 'optionalAccess', _43 => _43.classList, 'access', _44 => _44.contains, 'call', _45 => _45("rs-modal-content")]) ? [element, parent] : [element];
881
- if (_optionalChain([theme, 'optionalAccess', _46 => _46.mode])) {
992
+ const targets = _optionalChain([parent, 'optionalAccess', _45 => _45.classList, 'access', _46 => _46.contains, 'call', _47 => _47("rs-modal-content")]) ? [element, parent] : [element];
993
+ if (_optionalChain([theme, 'optionalAccess', _48 => _48.mode])) {
882
994
  element.setAttribute("data-theme", theme.mode);
883
995
  } else {
884
996
  element.removeAttribute("data-theme");
885
997
  }
886
- if (_optionalChain([theme, 'optionalAccess', _47 => _47.fontColor])) {
998
+ if (_optionalChain([theme, 'optionalAccess', _49 => _49.fontColor])) {
887
999
  setVar(targets, "--rs-foreground", theme.fontColor);
888
1000
  }
889
- if (_optionalChain([theme, 'optionalAccess', _48 => _48.iconColor])) {
1001
+ if (_optionalChain([theme, 'optionalAccess', _50 => _50.iconColor])) {
890
1002
  setVar(targets, "--rs-icon", theme.iconColor);
891
1003
  }
892
- if (_optionalChain([theme, 'optionalAccess', _49 => _49.ctaColor])) {
1004
+ if (_optionalChain([theme, 'optionalAccess', _51 => _51.ctaColor])) {
893
1005
  setVar(targets, "--rs-primary", theme.ctaColor);
894
1006
  setVar(targets, "--rs-border-accent", theme.ctaColor);
895
1007
  setVar(
@@ -897,17 +1009,17 @@ function applyTheme(element, theme) {
897
1009
  "--rs-primary-hover",
898
1010
  _nullishCoalesce(theme.ctaHoverColor, () => ( theme.ctaColor))
899
1011
  );
900
- } else if (_optionalChain([theme, 'optionalAccess', _50 => _50.ctaHoverColor])) {
1012
+ } else if (_optionalChain([theme, 'optionalAccess', _52 => _52.ctaHoverColor])) {
901
1013
  setVar(targets, "--rs-primary-hover", theme.ctaHoverColor);
902
1014
  }
903
- if (_optionalChain([theme, 'optionalAccess', _51 => _51.borderColor])) {
1015
+ if (_optionalChain([theme, 'optionalAccess', _53 => _53.borderColor])) {
904
1016
  setVar(targets, "--rs-border", theme.borderColor);
905
1017
  setVar(targets, "--rs-border-surface", theme.borderColor);
906
1018
  }
907
- if (_optionalChain([theme, 'optionalAccess', _52 => _52.backgroundColor])) {
1019
+ if (_optionalChain([theme, 'optionalAccess', _54 => _54.backgroundColor])) {
908
1020
  setVar(targets, "--rs-background", theme.backgroundColor);
909
1021
  }
910
- if (_optionalChain([theme, 'optionalAccess', _53 => _53.radius])) {
1022
+ if (_optionalChain([theme, 'optionalAccess', _55 => _55.radius])) {
911
1023
  const scale = RADIUS_SCALE[theme.radius];
912
1024
  setVar(targets, "--rs-radius-sm", scale.sm);
913
1025
  setVar(targets, "--rs-radius-md", scale.md);
@@ -1074,16 +1186,16 @@ function ConnectStep({
1074
1186
  continueButtonLabel = "Continue",
1075
1187
  connectButtonLabel = "Connect external wallet"
1076
1188
  }) {
1077
- const hasWalletOptions = (_nullishCoalesce(_optionalChain([walletOptions, 'optionalAccess', _54 => _54.length]), () => ( 0))) > 0;
1189
+ const hasWalletOptions = (_nullishCoalesce(_optionalChain([walletOptions, 'optionalAccess', _56 => _56.length]), () => ( 0))) > 0;
1078
1190
  if (hasWalletOptions) {
1079
- const hasReownWallet = _nullishCoalesce(_optionalChain([walletOptions, 'optionalAccess', _55 => _55.some, 'call', _56 => _56(
1191
+ const hasReownWallet = _nullishCoalesce(_optionalChain([walletOptions, 'optionalAccess', _57 => _57.some, 'call', _58 => _58(
1080
1192
  (option) => option.kind === "external" || option.kind === "solana"
1081
1193
  )]), () => ( false));
1082
1194
  const showConnectDifferentWalletOption = Boolean(onConnect) && !hasReownWallet;
1083
1195
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
1084
1196
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-connect-centered rs-connect-centered--wallets", children: [
1085
1197
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-connect-wallet-list", children: [
1086
- _optionalChain([walletOptions, 'optionalAccess', _57 => _57.map, 'call', _58 => _58((option) => {
1198
+ _optionalChain([walletOptions, 'optionalAccess', _59 => _59.map, 'call', _60 => _60((option) => {
1087
1199
  const isSelected = option.id === selectedWalletId;
1088
1200
  const rawAddress = _nullishCoalesce(_nullishCoalesce(option.address, () => ( option.solanaAddress)), () => ( option.id));
1089
1201
  const shortAddress = rawAddress.length > 12 ? `${rawAddress.slice(0, 6)}...${rawAddress.slice(-4)}` : rawAddress;
@@ -1092,7 +1204,7 @@ function ConnectStep({
1092
1204
  {
1093
1205
  type: "button",
1094
1206
  className: `rs-connect-wallet-row ${isSelected ? "rs-connect-wallet-row--selected" : ""}`,
1095
- onClick: () => _optionalChain([onSelectWallet, 'optionalCall', _59 => _59(option.id)]),
1207
+ onClick: () => _optionalChain([onSelectWallet, 'optionalCall', _61 => _61(option.id)]),
1096
1208
  children: [
1097
1209
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1098
1210
  "div",
@@ -1151,7 +1263,7 @@ function ConnectStep({
1151
1263
  }
1152
1264
  )
1153
1265
  ] }),
1154
- (onDisconnect || onConnect) && _optionalChain([walletOptions, 'optionalAccess', _60 => _60.some, 'call', _61 => _61(
1266
+ (onDisconnect || onConnect) && _optionalChain([walletOptions, 'optionalAccess', _62 => _62.some, 'call', _63 => _63(
1155
1267
  (option) => option.kind === "external" || option.kind === "solana"
1156
1268
  )]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1157
1269
  "button",
@@ -1368,7 +1480,7 @@ function asNumber(value) {
1368
1480
  const trimmed = value.trim();
1369
1481
  if (!trimmed) return void 0;
1370
1482
  const caipMatch = trimmed.match(/^eip155:(\d+)$/);
1371
- if (_optionalChain([caipMatch, 'optionalAccess', _62 => _62[1]])) {
1483
+ if (_optionalChain([caipMatch, 'optionalAccess', _64 => _64[1]])) {
1372
1484
  const parsed2 = Number(caipMatch[1]);
1373
1485
  return Number.isFinite(parsed2) ? parsed2 : void 0;
1374
1486
  }
@@ -1387,28 +1499,28 @@ function asAddress(value) {
1387
1499
  return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
1388
1500
  }
1389
1501
  function getEventTxHash(event) {
1390
- if (!_optionalChain([event, 'optionalAccess', _63 => _63.type])) return void 0;
1502
+ if (!_optionalChain([event, 'optionalAccess', _65 => _65.type])) return void 0;
1391
1503
  if (event.type === "deposit-received") {
1392
- return asString(_optionalChain([event, 'access', _64 => _64.data, 'optionalAccess', _65 => _65.transactionHash]));
1504
+ return asString(_optionalChain([event, 'access', _66 => _66.data, 'optionalAccess', _67 => _67.transactionHash]));
1393
1505
  }
1394
1506
  if (event.type === "bridge-started" || event.type === "bridge-complete") {
1395
- const deposit = isRecord(_optionalChain([event, 'access', _66 => _66.data, 'optionalAccess', _67 => _67.deposit])) ? event.data.deposit : void 0;
1396
- const source = isRecord(_optionalChain([event, 'access', _68 => _68.data, 'optionalAccess', _69 => _69.source])) ? event.data.source : void 0;
1397
- return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _70 => _70.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _71 => _71.transactionHash]))));
1507
+ const deposit = isRecord(_optionalChain([event, 'access', _68 => _68.data, 'optionalAccess', _69 => _69.deposit])) ? event.data.deposit : void 0;
1508
+ const source = isRecord(_optionalChain([event, 'access', _70 => _70.data, 'optionalAccess', _71 => _71.source])) ? event.data.source : void 0;
1509
+ return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _72 => _72.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _73 => _73.transactionHash]))));
1398
1510
  }
1399
1511
  if (event.type === "bridge-failed" || event.type === "error") {
1400
- const deposit = isRecord(_optionalChain([event, 'access', _72 => _72.data, 'optionalAccess', _73 => _73.deposit])) ? event.data.deposit : void 0;
1401
- const source = isRecord(_optionalChain([event, 'access', _74 => _74.data, 'optionalAccess', _75 => _75.source])) ? event.data.source : void 0;
1402
- return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _76 => _76.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _77 => _77.transactionHash]))));
1512
+ const deposit = isRecord(_optionalChain([event, 'access', _74 => _74.data, 'optionalAccess', _75 => _75.deposit])) ? event.data.deposit : void 0;
1513
+ const source = isRecord(_optionalChain([event, 'access', _76 => _76.data, 'optionalAccess', _77 => _77.source])) ? event.data.source : void 0;
1514
+ return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _78 => _78.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _79 => _79.transactionHash]))));
1403
1515
  }
1404
1516
  if (event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed") {
1405
- const deposit = isRecord(_optionalChain([event, 'access', _78 => _78.data, 'optionalAccess', _79 => _79.deposit])) ? event.data.deposit : void 0;
1406
- return asString(_optionalChain([deposit, 'optionalAccess', _80 => _80.transactionHash]));
1517
+ const deposit = isRecord(_optionalChain([event, 'access', _80 => _80.data, 'optionalAccess', _81 => _81.deposit])) ? event.data.deposit : void 0;
1518
+ return asString(_optionalChain([deposit, 'optionalAccess', _82 => _82.transactionHash]));
1407
1519
  }
1408
1520
  return void 0;
1409
1521
  }
1410
1522
  function getEventSourceDetails(event) {
1411
- if (!_optionalChain([event, 'optionalAccess', _81 => _81.type]) || !isRecord(event.data)) return {};
1523
+ if (!_optionalChain([event, 'optionalAccess', _83 => _83.type]) || !isRecord(event.data)) return {};
1412
1524
  if (event.type === "deposit-received") {
1413
1525
  return {
1414
1526
  chainId: asNumber(event.data.chain),
@@ -1420,15 +1532,15 @@ function getEventSourceDetails(event) {
1420
1532
  const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
1421
1533
  if (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error" || event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed") {
1422
1534
  return {
1423
- chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess', _82 => _82.chain])), () => ( asNumber(_optionalChain([deposit, 'optionalAccess', _83 => _83.chain])))),
1424
- amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess', _84 => _84.amount])), () => ( asAmount(_optionalChain([deposit, 'optionalAccess', _85 => _85.amount])))),
1425
- token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess', _86 => _86.asset])), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _87 => _87.asset])))), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _88 => _88.token]))))
1535
+ chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess', _84 => _84.chain])), () => ( asNumber(_optionalChain([deposit, 'optionalAccess', _85 => _85.chain])))),
1536
+ amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess', _86 => _86.amount])), () => ( asAmount(_optionalChain([deposit, 'optionalAccess', _87 => _87.amount])))),
1537
+ token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess', _88 => _88.asset])), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _89 => _89.asset])))), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _90 => _90.token]))))
1426
1538
  };
1427
1539
  }
1428
1540
  return {};
1429
1541
  }
1430
1542
  function isDepositEvent(event) {
1431
- return _optionalChain([event, 'optionalAccess', _89 => _89.type]) === "deposit-received" || _optionalChain([event, 'optionalAccess', _90 => _90.type]) === "bridge-started" || _optionalChain([event, 'optionalAccess', _91 => _91.type]) === "bridge-complete" || _optionalChain([event, 'optionalAccess', _92 => _92.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _93 => _93.type]) === "post-bridge-swap-complete" || _optionalChain([event, 'optionalAccess', _94 => _94.type]) === "post-bridge-swap-failed" || _optionalChain([event, 'optionalAccess', _95 => _95.type]) === "error";
1543
+ return _optionalChain([event, 'optionalAccess', _91 => _91.type]) === "deposit-received" || _optionalChain([event, 'optionalAccess', _92 => _92.type]) === "bridge-started" || _optionalChain([event, 'optionalAccess', _93 => _93.type]) === "bridge-complete" || _optionalChain([event, 'optionalAccess', _94 => _94.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _95 => _95.type]) === "post-bridge-swap-complete" || _optionalChain([event, 'optionalAccess', _96 => _96.type]) === "post-bridge-swap-failed" || _optionalChain([event, 'optionalAccess', _97 => _97.type]) === "error";
1432
1544
  }
1433
1545
  function isHexString(value) {
1434
1546
  return value.startsWith("0x") || value.startsWith("0X");
@@ -1483,7 +1595,7 @@ function isEventForTx(event, txHash) {
1483
1595
  return txRefsMatch(eventTxHash, txHash);
1484
1596
  }
1485
1597
  function formatBridgeFailedMessage(event) {
1486
- const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _96 => _96.data]), () => ( {}));
1598
+ const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _98 => _98.data]), () => ( {}));
1487
1599
  const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
1488
1600
  const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
1489
1601
  function toUserFacingFailure(raw) {
@@ -1515,12 +1627,12 @@ function formatBridgeFailedMessage(event) {
1515
1627
  return { message: "Bridge failed" };
1516
1628
  }
1517
1629
  function parseWebhookTimestamp(event) {
1518
- if (typeof _optionalChain([event, 'optionalAccess', _97 => _97.time]) !== "string") return void 0;
1630
+ if (typeof _optionalChain([event, 'optionalAccess', _99 => _99.time]) !== "string") return void 0;
1519
1631
  const timestamp = Date.parse(event.time);
1520
1632
  return Number.isFinite(timestamp) ? timestamp : void 0;
1521
1633
  }
1522
1634
  function syncPhaseTimings(previous, event) {
1523
- if (!_optionalChain([event, 'optionalAccess', _98 => _98.type])) return previous;
1635
+ if (!_optionalChain([event, 'optionalAccess', _100 => _100.type])) return previous;
1524
1636
  const timestamp = _nullishCoalesce(parseWebhookTimestamp(event), () => ( Date.now()));
1525
1637
  const setReceived = (event.type === "deposit-received" || event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed" || event.type === "error") && previous.receivedAt === void 0;
1526
1638
  const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "post-bridge-swap-complete") && previous.bridgingAt === void 0;
@@ -1561,9 +1673,9 @@ function getCurrentPhaseId(state, phaseTimings, isEarlyComplete) {
1561
1673
  if (state.type === "complete") {
1562
1674
  return void 0;
1563
1675
  }
1564
- if (_optionalChain([state, 'access', _99 => _99.lastEvent, 'optionalAccess', _100 => _100.type]) === "bridge-started" || _optionalChain([state, 'access', _101 => _101.lastEvent, 'optionalAccess', _102 => _102.type]) === "bridge-complete")
1676
+ if (_optionalChain([state, 'access', _101 => _101.lastEvent, 'optionalAccess', _102 => _102.type]) === "bridge-started" || _optionalChain([state, 'access', _103 => _103.lastEvent, 'optionalAccess', _104 => _104.type]) === "bridge-complete")
1565
1677
  return "bridging";
1566
- if (_optionalChain([state, 'access', _103 => _103.lastEvent, 'optionalAccess', _104 => _104.type]) === "deposit-received") return "received";
1678
+ if (_optionalChain([state, 'access', _105 => _105.lastEvent, 'optionalAccess', _106 => _106.type]) === "deposit-received") return "received";
1567
1679
  return "confirming";
1568
1680
  }
1569
1681
  function ProcessingStep({
@@ -1630,7 +1742,7 @@ function ProcessingStep({
1630
1742
  flowLabel
1631
1743
  });
1632
1744
  const context = processingContextRef.current;
1633
- _optionalChain([onDepositCompleteRef, 'access', _105 => _105.current, 'optionalCall', _106 => _106(txHash, void 0, {
1745
+ _optionalChain([onDepositCompleteRef, 'access', _107 => _107.current, 'optionalCall', _108 => _108(txHash, void 0, {
1634
1746
  amount: context.amount,
1635
1747
  sourceChain: context.sourceChain,
1636
1748
  sourceToken: context.sourceToken,
@@ -1667,7 +1779,7 @@ function ProcessingStep({
1667
1779
  _react.useEffect.call(void 0, () => {
1668
1780
  if (!state.lastEvent) return;
1669
1781
  setPhaseTimings((previous) => syncPhaseTimings(previous, state.lastEvent));
1670
- }, [_optionalChain([state, 'access', _107 => _107.lastEvent, 'optionalAccess', _108 => _108.time]), _optionalChain([state, 'access', _109 => _109.lastEvent, 'optionalAccess', _110 => _110.type])]);
1782
+ }, [_optionalChain([state, 'access', _109 => _109.lastEvent, 'optionalAccess', _110 => _110.time]), _optionalChain([state, 'access', _111 => _111.lastEvent, 'optionalAccess', _112 => _112.type])]);
1671
1783
  _react.useEffect.call(void 0, () => {
1672
1784
  savePhaseTimings(txHash, phaseTimings);
1673
1785
  }, [txHash, phaseTimings]);
@@ -1694,21 +1806,21 @@ function ProcessingStep({
1694
1806
  debugLog(debug, "processing", "poll:event", {
1695
1807
  type: lastEvent2.type,
1696
1808
  matchesTx: eventMatchesTx,
1697
- intentId: _optionalChain([eventData, 'optionalAccess', _111 => _111.intentId])
1809
+ intentId: _optionalChain([eventData, 'optionalAccess', _113 => _113.intentId])
1698
1810
  });
1699
1811
  }
1700
1812
  if (!isMounted) return;
1701
1813
  const awaitingPostBridgeSwap = processingContextRef.current.waitForFinalTx && processingContextRef.current.hasPostBridgeActions;
1702
- if (_optionalChain([eventForCurrentTx, 'optionalAccess', _112 => _112.type]) === "post-bridge-swap-complete") {
1814
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _114 => _114.type]) === "post-bridge-swap-complete") {
1703
1815
  setState({ type: "complete", lastEvent: eventForCurrentTx });
1704
- const swapTxHash = _optionalChain([eventForCurrentTx, 'access', _113 => _113.data, 'optionalAccess', _114 => _114.swap, 'optionalAccess', _115 => _115.transactionHash]);
1816
+ const swapTxHash = _optionalChain([eventForCurrentTx, 'access', _115 => _115.data, 'optionalAccess', _116 => _116.swap, 'optionalAccess', _117 => _117.transactionHash]);
1705
1817
  debugLog(debug, "processing", "state:complete", {
1706
1818
  txHash,
1707
1819
  destinationTxHash: swapTxHash,
1708
1820
  event: eventForCurrentTx.type
1709
1821
  });
1710
1822
  const context = processingContextRef.current;
1711
- _optionalChain([onDepositCompleteRef, 'access', _116 => _116.current, 'optionalCall', _117 => _117(txHash, swapTxHash, {
1823
+ _optionalChain([onDepositCompleteRef, 'access', _118 => _118.current, 'optionalCall', _119 => _119(txHash, swapTxHash, {
1712
1824
  amount: context.amount,
1713
1825
  sourceChain: context.sourceChain,
1714
1826
  sourceToken: context.sourceToken,
@@ -1717,7 +1829,7 @@ function ProcessingStep({
1717
1829
  })]);
1718
1830
  return;
1719
1831
  }
1720
- if (_optionalChain([eventForCurrentTx, 'optionalAccess', _118 => _118.type]) === "post-bridge-swap-failed") {
1832
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _120 => _120.type]) === "post-bridge-swap-failed") {
1721
1833
  const formatted = formatBridgeFailedMessage(eventForCurrentTx);
1722
1834
  setState({
1723
1835
  type: "failed",
@@ -1729,19 +1841,19 @@ function ProcessingStep({
1729
1841
  message: formatted.message,
1730
1842
  code: formatted.code
1731
1843
  });
1732
- _optionalChain([onDepositFailedRef, 'access', _119 => _119.current, 'optionalCall', _120 => _120(txHash, formatted.message)]);
1844
+ _optionalChain([onDepositFailedRef, 'access', _121 => _121.current, 'optionalCall', _122 => _122(txHash, formatted.message)]);
1733
1845
  return;
1734
1846
  }
1735
- if (_optionalChain([eventForCurrentTx, 'optionalAccess', _121 => _121.type]) === "bridge-complete" && !awaitingPostBridgeSwap) {
1847
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _123 => _123.type]) === "bridge-complete" && !awaitingPostBridgeSwap) {
1736
1848
  setState({ type: "complete", lastEvent: eventForCurrentTx });
1737
- const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access', _122 => _122.data, 'optionalAccess', _123 => _123.destination, 'optionalAccess', _124 => _124.transactionHash]);
1849
+ const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access', _124 => _124.data, 'optionalAccess', _125 => _125.destination, 'optionalAccess', _126 => _126.transactionHash]);
1738
1850
  debugLog(debug, "processing", "state:complete", {
1739
1851
  txHash,
1740
1852
  destinationTxHash: destinationTxHash2,
1741
1853
  event: eventForCurrentTx.type
1742
1854
  });
1743
1855
  const context = processingContextRef.current;
1744
- _optionalChain([onDepositCompleteRef, 'access', _125 => _125.current, 'optionalCall', _126 => _126(txHash, destinationTxHash2, {
1856
+ _optionalChain([onDepositCompleteRef, 'access', _127 => _127.current, 'optionalCall', _128 => _128(txHash, destinationTxHash2, {
1745
1857
  amount: context.amount,
1746
1858
  sourceChain: context.sourceChain,
1747
1859
  sourceToken: context.sourceToken,
@@ -1750,14 +1862,14 @@ function ProcessingStep({
1750
1862
  })]);
1751
1863
  return;
1752
1864
  }
1753
- if (!waitForFinalTx && _optionalChain([eventForCurrentTx, 'optionalAccess', _127 => _127.type]) === "bridge-started") {
1865
+ if (!waitForFinalTx && _optionalChain([eventForCurrentTx, 'optionalAccess', _129 => _129.type]) === "bridge-started") {
1754
1866
  setState({ type: "complete", lastEvent: eventForCurrentTx });
1755
1867
  debugLog(debug, "processing", "state:early-complete", {
1756
1868
  txHash,
1757
1869
  event: eventForCurrentTx.type
1758
1870
  });
1759
1871
  const context = processingContextRef.current;
1760
- _optionalChain([onDepositCompleteRef, 'access', _128 => _128.current, 'optionalCall', _129 => _129(txHash, void 0, {
1872
+ _optionalChain([onDepositCompleteRef, 'access', _130 => _130.current, 'optionalCall', _131 => _131(txHash, void 0, {
1761
1873
  amount: context.amount,
1762
1874
  sourceChain: context.sourceChain,
1763
1875
  sourceToken: context.sourceToken,
@@ -1766,7 +1878,7 @@ function ProcessingStep({
1766
1878
  })]);
1767
1879
  return;
1768
1880
  }
1769
- if (_optionalChain([eventForCurrentTx, 'optionalAccess', _130 => _130.type]) === "bridge-failed") {
1881
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _132 => _132.type]) === "bridge-failed") {
1770
1882
  const formatted = formatBridgeFailedMessage(eventForCurrentTx);
1771
1883
  setState({
1772
1884
  type: "failed",
@@ -1778,11 +1890,11 @@ function ProcessingStep({
1778
1890
  message: formatted.message,
1779
1891
  code: formatted.code
1780
1892
  });
1781
- _optionalChain([onDepositFailedRef, 'access', _131 => _131.current, 'optionalCall', _132 => _132(txHash, formatted.message)]);
1893
+ _optionalChain([onDepositFailedRef, 'access', _133 => _133.current, 'optionalCall', _134 => _134(txHash, formatted.message)]);
1782
1894
  return;
1783
1895
  }
1784
- if (_optionalChain([eventForCurrentTx, 'optionalAccess', _133 => _133.type]) === "error") {
1785
- const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access', _134 => _134.data, 'optionalAccess', _135 => _135.message]), () => ( "Unknown error"));
1896
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _135 => _135.type]) === "error") {
1897
+ const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access', _136 => _136.data, 'optionalAccess', _137 => _137.message]), () => ( "Unknown error"));
1786
1898
  setState({
1787
1899
  type: "failed",
1788
1900
  message: errorMessage,
@@ -1792,7 +1904,7 @@ function ProcessingStep({
1792
1904
  txHash,
1793
1905
  message: errorMessage
1794
1906
  });
1795
- _optionalChain([onDepositFailedRef, 'access', _136 => _136.current, 'optionalCall', _137 => _137(txHash, errorMessage)]);
1907
+ _optionalChain([onDepositFailedRef, 'access', _138 => _138.current, 'optionalCall', _139 => _139(txHash, errorMessage)]);
1796
1908
  return;
1797
1909
  }
1798
1910
  setState((previous) => ({
@@ -1851,7 +1963,7 @@ function ProcessingStep({
1851
1963
  txHash,
1852
1964
  timeoutMs: ESCALATED_DELAY_MS
1853
1965
  });
1854
- _optionalChain([onErrorRef, 'access', _138 => _138.current, 'optionalCall', _139 => _139(message, "PROCESS_TIMEOUT")]);
1966
+ _optionalChain([onErrorRef, 'access', _140 => _140.current, 'optionalCall', _141 => _141(message, "PROCESS_TIMEOUT")]);
1855
1967
  }, ESCALATED_DELAY_MS);
1856
1968
  return () => clearTimeout(timeoutId);
1857
1969
  }, [debug, directTransfer, onErrorRef, state.type, txHash]);
@@ -1860,13 +1972,13 @@ function ProcessingStep({
1860
1972
  const isProcessing = state.type === "processing";
1861
1973
  const lastEvent = state.lastEvent;
1862
1974
  const failureMessage = state.type === "failed" ? state.message : void 0;
1863
- const isEarlyComplete = !waitForFinalTx && _optionalChain([lastEvent, 'optionalAccess', _140 => _140.type]) === "bridge-started";
1975
+ const isEarlyComplete = !waitForFinalTx && _optionalChain([lastEvent, 'optionalAccess', _142 => _142.type]) === "bridge-started";
1864
1976
  const timelineNowMs = _nullishCoalesce(phaseTimings.endedAt, () => ( Date.now()));
1865
1977
  const flowNoun = flowLabel === "withdraw" ? "withdrawal" : "deposit";
1866
1978
  const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : "Deposit";
1867
- const isPostBridgeSwapEvent = _optionalChain([lastEvent, 'optionalAccess', _141 => _141.type]) === "post-bridge-swap-complete" || _optionalChain([lastEvent, 'optionalAccess', _142 => _142.type]) === "post-bridge-swap-failed";
1868
- const destinationTxHash = isPostBridgeSwapEvent ? _optionalChain([lastEvent, 'optionalAccess', _143 => _143.data, 'optionalAccess', _144 => _144.swap, 'optionalAccess', _145 => _145.transactionHash]) || null : _optionalChain([lastEvent, 'optionalAccess', _146 => _146.data, 'optionalAccess', _147 => _147.destination, 'optionalAccess', _148 => _148.transactionHash]) || null;
1869
- const bridgeTxHash = isPostBridgeSwapEvent ? _optionalChain([lastEvent, 'optionalAccess', _149 => _149.data, 'optionalAccess', _150 => _150.bridge, 'optionalAccess', _151 => _151.transactionHash]) || null : null;
1979
+ const isPostBridgeSwapEvent = _optionalChain([lastEvent, 'optionalAccess', _143 => _143.type]) === "post-bridge-swap-complete" || _optionalChain([lastEvent, 'optionalAccess', _144 => _144.type]) === "post-bridge-swap-failed";
1980
+ const destinationTxHash = isPostBridgeSwapEvent ? _optionalChain([lastEvent, 'optionalAccess', _145 => _145.data, 'optionalAccess', _146 => _146.swap, 'optionalAccess', _147 => _147.transactionHash]) || null : _optionalChain([lastEvent, 'optionalAccess', _148 => _148.data, 'optionalAccess', _149 => _149.destination, 'optionalAccess', _150 => _150.transactionHash]) || null;
1981
+ const bridgeTxHash = isPostBridgeSwapEvent ? _optionalChain([lastEvent, 'optionalAccess', _151 => _151.data, 'optionalAccess', _152 => _152.bridge, 'optionalAccess', _153 => _153.transactionHash]) || null : null;
1870
1982
  const sourceDetails = getEventSourceDetails(lastEvent);
1871
1983
  const displaySourceChain = _nullishCoalesce(sourceDetails.chainId, () => ( sourceChain));
1872
1984
  const displaySourceToken = _nullishCoalesce(sourceDetails.token, () => ( sourceToken));
@@ -1897,7 +2009,7 @@ function ProcessingStep({
1897
2009
  const activePhaseElapsedMs = isProcessing && activePhaseStartedAt !== void 0 ? timelineNowMs - activePhaseStartedAt : 0;
1898
2010
  const delayPhaseId = isProcessing && currentPhaseId && activePhaseElapsedMs >= SOFT_DELAY_MS[currentPhaseId] ? currentPhaseId : void 0;
1899
2011
  const headerTitle = isFailed ? `${flowCapitalized} could not be completed` : isComplete ? isEarlyComplete ? `${flowCapitalized} confirmed` : `${flowCapitalized} successful` : delayPhaseId === "received" ? "Bridge pending" : delayPhaseId === "bridging" ? "Bridge delayed" : delayPhaseId === "confirming" ? `Confirming ${flowNoun}` : `Submitting transaction...`;
1900
- const headerDescription = isFailed ? _nullishCoalesce(failureMessage, () => ( "The transfer could not be completed.")) : isComplete ? directTransfer ? "Your transfer is complete." : isEarlyComplete ? "The bridge has started. Funds will arrive shortly." : "Your funds were successfully deposited." : delayPhaseId === "received" ? "Funds are in. We are still waiting for the bridge transaction to begin." : delayPhaseId === "bridging" ? "The bridge has started but settlement is taking longer than expected." : delayPhaseId === "confirming" ? "The source transaction has not been picked up yet, but we are still polling automatically." : _optionalChain([state, 'access', _152 => _152.lastEvent, 'optionalAccess', _153 => _153.type]) === "deposit-received" ? "Transfer received. Preparing bridge execution." : _optionalChain([state, 'access', _154 => _154.lastEvent, 'optionalAccess', _155 => _155.type]) === "bridge-started" ? `Bridge started. Sending funds to ${_chunkMUWVDVY4cjs.getChainName.call(void 0, targetChain)}.` : "Filling your transaction on the blockchain.";
2012
+ const headerDescription = isFailed ? _nullishCoalesce(failureMessage, () => ( "The transfer could not be completed.")) : isComplete ? directTransfer ? "Your transfer is complete." : isEarlyComplete ? "The bridge has started. Funds will arrive shortly." : "Your funds were successfully deposited." : delayPhaseId === "received" ? "Funds are in. We are still waiting for the bridge transaction to begin." : delayPhaseId === "bridging" ? "The bridge has started but settlement is taking longer than expected." : delayPhaseId === "confirming" ? "The source transaction has not been picked up yet, but we are still polling automatically." : _optionalChain([state, 'access', _154 => _154.lastEvent, 'optionalAccess', _155 => _155.type]) === "deposit-received" ? "Transfer received. Preparing bridge execution." : _optionalChain([state, 'access', _156 => _156.lastEvent, 'optionalAccess', _157 => _157.type]) === "bridge-started" ? `Bridge started. Sending funds to ${_chunkMUWVDVY4cjs.getChainName.call(void 0, targetChain)}.` : "Filling your transaction on the blockchain.";
1901
2013
  const showAlert = !isFailed && (delayPhaseId !== void 0 || hasEscalatedDelay);
1902
2014
  const alertMessage = hasEscalatedDelay ? "Taking longer than expected. You can close this window \u2014 processing continues in the background." : "This step is slower than usual but still processing.";
1903
2015
  const fillStatus = isComplete ? "Successful" : isFailed ? "Failed" : "Processing";