@rhinestone/deposit-modal 0.1.67 → 0.1.69

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,8 +695,8 @@ 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,
@@ -640,16 +708,16 @@ function createDepositService(baseUrl, options) {
640
708
  }
641
709
  function normalizeDirectPortfolio(data) {
642
710
  const rawTokens = _nullishCoalesce(_nullishCoalesce(extractArray(data, "tokens"), () => ( extractArray(
643
- _optionalChain([data, 'optionalAccess', _19 => _19.data]),
711
+ _optionalChain([data, 'optionalAccess', _21 => _21.data]),
644
712
  "tokens"
645
713
  ))), () => ( []));
646
- const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess', _20 => _20.data]), "totalUsd"))), () => ( 0));
714
+ const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess', _22 => _22.data]), "totalUsd"))), () => ( 0));
647
715
  const tokens = rawTokens.map((token) => normalizeDirectToken(token)).filter((token) => Boolean(token));
648
716
  return { tokens, totalUsd };
649
717
  }
650
718
  function extractOrchestratorPortfolio(data) {
651
719
  const portfolio = _nullishCoalesce(extractArray(data, "portfolio"), () => ( extractArray(
652
- _optionalChain([data, 'optionalAccess', _21 => _21.data]),
720
+ _optionalChain([data, 'optionalAccess', _23 => _23.data]),
653
721
  "portfolio"
654
722
  )));
655
723
  if (!portfolio || !Array.isArray(portfolio)) return null;
@@ -660,7 +728,7 @@ function normalizeOrchestratorPortfolio(data) {
660
728
  for (const tokenData of data.portfolio || []) {
661
729
  const chainBalances = _nullishCoalesce(_nullishCoalesce(tokenData.tokenChainBalance, () => ( tokenData.chainBalances)), () => ( []));
662
730
  for (const chainBalance of chainBalances) {
663
- const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _22 => _22.balance, 'optionalAccess', _23 => _23.unlocked]), () => ( "0"));
731
+ const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _24 => _24.balance, 'optionalAccess', _25 => _25.unlocked]), () => ( "0"));
664
732
  const normalizedName = tokenData.tokenName.trim();
665
733
  const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
666
734
  const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => ( _chunkMUWVDVY4cjs.getTokenAddress.call(void 0, tokenData.tokenName, chainBalance.chainId)));
@@ -694,7 +762,7 @@ function normalizeDirectToken(token) {
694
762
  if (chainId === null) return null;
695
763
  const symbol = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "symbol"), () => ( extractString(token, "tokenSymbol"))), () => ( extractString(token, "tokenName"))), () => ( extractString(token, "name")));
696
764
  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()])));
765
+ 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
766
  if (!balanceValue) return null;
699
767
  const address = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "address"), () => ( extractString(token, "tokenAddress"))), () => ( extractString(
700
768
  token.token,
@@ -719,7 +787,7 @@ function normalizeDirectToken(token) {
719
787
  }
720
788
  function extractTokenAddress(tokenData, chainId) {
721
789
  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]])));
790
+ 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
791
  }
724
792
  function extractArray(data, key) {
725
793
  if (!data || typeof data !== "object") return null;
@@ -877,19 +945,19 @@ function setVar(targets, prop, value) {
877
945
  function applyTheme(element, theme) {
878
946
  if (!element) return;
879
947
  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])) {
948
+ const targets = _optionalChain([parent, 'optionalAccess', _45 => _45.classList, 'access', _46 => _46.contains, 'call', _47 => _47("rs-modal-content")]) ? [element, parent] : [element];
949
+ if (_optionalChain([theme, 'optionalAccess', _48 => _48.mode])) {
882
950
  element.setAttribute("data-theme", theme.mode);
883
951
  } else {
884
952
  element.removeAttribute("data-theme");
885
953
  }
886
- if (_optionalChain([theme, 'optionalAccess', _47 => _47.fontColor])) {
954
+ if (_optionalChain([theme, 'optionalAccess', _49 => _49.fontColor])) {
887
955
  setVar(targets, "--rs-foreground", theme.fontColor);
888
956
  }
889
- if (_optionalChain([theme, 'optionalAccess', _48 => _48.iconColor])) {
957
+ if (_optionalChain([theme, 'optionalAccess', _50 => _50.iconColor])) {
890
958
  setVar(targets, "--rs-icon", theme.iconColor);
891
959
  }
892
- if (_optionalChain([theme, 'optionalAccess', _49 => _49.ctaColor])) {
960
+ if (_optionalChain([theme, 'optionalAccess', _51 => _51.ctaColor])) {
893
961
  setVar(targets, "--rs-primary", theme.ctaColor);
894
962
  setVar(targets, "--rs-border-accent", theme.ctaColor);
895
963
  setVar(
@@ -897,17 +965,17 @@ function applyTheme(element, theme) {
897
965
  "--rs-primary-hover",
898
966
  _nullishCoalesce(theme.ctaHoverColor, () => ( theme.ctaColor))
899
967
  );
900
- } else if (_optionalChain([theme, 'optionalAccess', _50 => _50.ctaHoverColor])) {
968
+ } else if (_optionalChain([theme, 'optionalAccess', _52 => _52.ctaHoverColor])) {
901
969
  setVar(targets, "--rs-primary-hover", theme.ctaHoverColor);
902
970
  }
903
- if (_optionalChain([theme, 'optionalAccess', _51 => _51.borderColor])) {
971
+ if (_optionalChain([theme, 'optionalAccess', _53 => _53.borderColor])) {
904
972
  setVar(targets, "--rs-border", theme.borderColor);
905
973
  setVar(targets, "--rs-border-surface", theme.borderColor);
906
974
  }
907
- if (_optionalChain([theme, 'optionalAccess', _52 => _52.backgroundColor])) {
975
+ if (_optionalChain([theme, 'optionalAccess', _54 => _54.backgroundColor])) {
908
976
  setVar(targets, "--rs-background", theme.backgroundColor);
909
977
  }
910
- if (_optionalChain([theme, 'optionalAccess', _53 => _53.radius])) {
978
+ if (_optionalChain([theme, 'optionalAccess', _55 => _55.radius])) {
911
979
  const scale = RADIUS_SCALE[theme.radius];
912
980
  setVar(targets, "--rs-radius-sm", scale.sm);
913
981
  setVar(targets, "--rs-radius-md", scale.md);
@@ -1074,16 +1142,16 @@ function ConnectStep({
1074
1142
  continueButtonLabel = "Continue",
1075
1143
  connectButtonLabel = "Connect external wallet"
1076
1144
  }) {
1077
- const hasWalletOptions = (_nullishCoalesce(_optionalChain([walletOptions, 'optionalAccess', _54 => _54.length]), () => ( 0))) > 0;
1145
+ const hasWalletOptions = (_nullishCoalesce(_optionalChain([walletOptions, 'optionalAccess', _56 => _56.length]), () => ( 0))) > 0;
1078
1146
  if (hasWalletOptions) {
1079
- const hasReownWallet = _nullishCoalesce(_optionalChain([walletOptions, 'optionalAccess', _55 => _55.some, 'call', _56 => _56(
1147
+ const hasReownWallet = _nullishCoalesce(_optionalChain([walletOptions, 'optionalAccess', _57 => _57.some, 'call', _58 => _58(
1080
1148
  (option) => option.kind === "external" || option.kind === "solana"
1081
1149
  )]), () => ( false));
1082
1150
  const showConnectDifferentWalletOption = Boolean(onConnect) && !hasReownWallet;
1083
1151
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
1084
1152
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-connect-centered rs-connect-centered--wallets", children: [
1085
1153
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-connect-wallet-list", children: [
1086
- _optionalChain([walletOptions, 'optionalAccess', _57 => _57.map, 'call', _58 => _58((option) => {
1154
+ _optionalChain([walletOptions, 'optionalAccess', _59 => _59.map, 'call', _60 => _60((option) => {
1087
1155
  const isSelected = option.id === selectedWalletId;
1088
1156
  const rawAddress = _nullishCoalesce(_nullishCoalesce(option.address, () => ( option.solanaAddress)), () => ( option.id));
1089
1157
  const shortAddress = rawAddress.length > 12 ? `${rawAddress.slice(0, 6)}...${rawAddress.slice(-4)}` : rawAddress;
@@ -1092,7 +1160,7 @@ function ConnectStep({
1092
1160
  {
1093
1161
  type: "button",
1094
1162
  className: `rs-connect-wallet-row ${isSelected ? "rs-connect-wallet-row--selected" : ""}`,
1095
- onClick: () => _optionalChain([onSelectWallet, 'optionalCall', _59 => _59(option.id)]),
1163
+ onClick: () => _optionalChain([onSelectWallet, 'optionalCall', _61 => _61(option.id)]),
1096
1164
  children: [
1097
1165
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1098
1166
  "div",
@@ -1151,7 +1219,7 @@ function ConnectStep({
1151
1219
  }
1152
1220
  )
1153
1221
  ] }),
1154
- (onDisconnect || onConnect) && _optionalChain([walletOptions, 'optionalAccess', _60 => _60.some, 'call', _61 => _61(
1222
+ (onDisconnect || onConnect) && _optionalChain([walletOptions, 'optionalAccess', _62 => _62.some, 'call', _63 => _63(
1155
1223
  (option) => option.kind === "external" || option.kind === "solana"
1156
1224
  )]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1157
1225
  "button",
@@ -1368,7 +1436,7 @@ function asNumber(value) {
1368
1436
  const trimmed = value.trim();
1369
1437
  if (!trimmed) return void 0;
1370
1438
  const caipMatch = trimmed.match(/^eip155:(\d+)$/);
1371
- if (_optionalChain([caipMatch, 'optionalAccess', _62 => _62[1]])) {
1439
+ if (_optionalChain([caipMatch, 'optionalAccess', _64 => _64[1]])) {
1372
1440
  const parsed2 = Number(caipMatch[1]);
1373
1441
  return Number.isFinite(parsed2) ? parsed2 : void 0;
1374
1442
  }
@@ -1387,28 +1455,28 @@ function asAddress(value) {
1387
1455
  return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
1388
1456
  }
1389
1457
  function getEventTxHash(event) {
1390
- if (!_optionalChain([event, 'optionalAccess', _63 => _63.type])) return void 0;
1458
+ if (!_optionalChain([event, 'optionalAccess', _65 => _65.type])) return void 0;
1391
1459
  if (event.type === "deposit-received") {
1392
- return asString(_optionalChain([event, 'access', _64 => _64.data, 'optionalAccess', _65 => _65.transactionHash]));
1460
+ return asString(_optionalChain([event, 'access', _66 => _66.data, 'optionalAccess', _67 => _67.transactionHash]));
1393
1461
  }
1394
1462
  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]))));
1463
+ const deposit = isRecord(_optionalChain([event, 'access', _68 => _68.data, 'optionalAccess', _69 => _69.deposit])) ? event.data.deposit : void 0;
1464
+ const source = isRecord(_optionalChain([event, 'access', _70 => _70.data, 'optionalAccess', _71 => _71.source])) ? event.data.source : void 0;
1465
+ return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _72 => _72.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _73 => _73.transactionHash]))));
1398
1466
  }
1399
1467
  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]))));
1468
+ const deposit = isRecord(_optionalChain([event, 'access', _74 => _74.data, 'optionalAccess', _75 => _75.deposit])) ? event.data.deposit : void 0;
1469
+ const source = isRecord(_optionalChain([event, 'access', _76 => _76.data, 'optionalAccess', _77 => _77.source])) ? event.data.source : void 0;
1470
+ return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _78 => _78.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _79 => _79.transactionHash]))));
1403
1471
  }
1404
1472
  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]));
1473
+ const deposit = isRecord(_optionalChain([event, 'access', _80 => _80.data, 'optionalAccess', _81 => _81.deposit])) ? event.data.deposit : void 0;
1474
+ return asString(_optionalChain([deposit, 'optionalAccess', _82 => _82.transactionHash]));
1407
1475
  }
1408
1476
  return void 0;
1409
1477
  }
1410
1478
  function getEventSourceDetails(event) {
1411
- if (!_optionalChain([event, 'optionalAccess', _81 => _81.type]) || !isRecord(event.data)) return {};
1479
+ if (!_optionalChain([event, 'optionalAccess', _83 => _83.type]) || !isRecord(event.data)) return {};
1412
1480
  if (event.type === "deposit-received") {
1413
1481
  return {
1414
1482
  chainId: asNumber(event.data.chain),
@@ -1420,15 +1488,15 @@ function getEventSourceDetails(event) {
1420
1488
  const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
1421
1489
  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
1490
  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]))))
1491
+ chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess', _84 => _84.chain])), () => ( asNumber(_optionalChain([deposit, 'optionalAccess', _85 => _85.chain])))),
1492
+ amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess', _86 => _86.amount])), () => ( asAmount(_optionalChain([deposit, 'optionalAccess', _87 => _87.amount])))),
1493
+ 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
1494
  };
1427
1495
  }
1428
1496
  return {};
1429
1497
  }
1430
1498
  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";
1499
+ 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
1500
  }
1433
1501
  function isHexString(value) {
1434
1502
  return value.startsWith("0x") || value.startsWith("0X");
@@ -1483,7 +1551,7 @@ function isEventForTx(event, txHash) {
1483
1551
  return txRefsMatch(eventTxHash, txHash);
1484
1552
  }
1485
1553
  function formatBridgeFailedMessage(event) {
1486
- const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _96 => _96.data]), () => ( {}));
1554
+ const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _98 => _98.data]), () => ( {}));
1487
1555
  const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
1488
1556
  const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
1489
1557
  function toUserFacingFailure(raw) {
@@ -1515,12 +1583,12 @@ function formatBridgeFailedMessage(event) {
1515
1583
  return { message: "Bridge failed" };
1516
1584
  }
1517
1585
  function parseWebhookTimestamp(event) {
1518
- if (typeof _optionalChain([event, 'optionalAccess', _97 => _97.time]) !== "string") return void 0;
1586
+ if (typeof _optionalChain([event, 'optionalAccess', _99 => _99.time]) !== "string") return void 0;
1519
1587
  const timestamp = Date.parse(event.time);
1520
1588
  return Number.isFinite(timestamp) ? timestamp : void 0;
1521
1589
  }
1522
1590
  function syncPhaseTimings(previous, event) {
1523
- if (!_optionalChain([event, 'optionalAccess', _98 => _98.type])) return previous;
1591
+ if (!_optionalChain([event, 'optionalAccess', _100 => _100.type])) return previous;
1524
1592
  const timestamp = _nullishCoalesce(parseWebhookTimestamp(event), () => ( Date.now()));
1525
1593
  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
1594
  const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "post-bridge-swap-complete") && previous.bridgingAt === void 0;
@@ -1561,9 +1629,9 @@ function getCurrentPhaseId(state, phaseTimings, isEarlyComplete) {
1561
1629
  if (state.type === "complete") {
1562
1630
  return void 0;
1563
1631
  }
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")
1632
+ 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
1633
  return "bridging";
1566
- if (_optionalChain([state, 'access', _103 => _103.lastEvent, 'optionalAccess', _104 => _104.type]) === "deposit-received") return "received";
1634
+ if (_optionalChain([state, 'access', _105 => _105.lastEvent, 'optionalAccess', _106 => _106.type]) === "deposit-received") return "received";
1567
1635
  return "confirming";
1568
1636
  }
1569
1637
  function ProcessingStep({
@@ -1630,7 +1698,7 @@ function ProcessingStep({
1630
1698
  flowLabel
1631
1699
  });
1632
1700
  const context = processingContextRef.current;
1633
- _optionalChain([onDepositCompleteRef, 'access', _105 => _105.current, 'optionalCall', _106 => _106(txHash, void 0, {
1701
+ _optionalChain([onDepositCompleteRef, 'access', _107 => _107.current, 'optionalCall', _108 => _108(txHash, void 0, {
1634
1702
  amount: context.amount,
1635
1703
  sourceChain: context.sourceChain,
1636
1704
  sourceToken: context.sourceToken,
@@ -1667,7 +1735,7 @@ function ProcessingStep({
1667
1735
  _react.useEffect.call(void 0, () => {
1668
1736
  if (!state.lastEvent) return;
1669
1737
  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])]);
1738
+ }, [_optionalChain([state, 'access', _109 => _109.lastEvent, 'optionalAccess', _110 => _110.time]), _optionalChain([state, 'access', _111 => _111.lastEvent, 'optionalAccess', _112 => _112.type])]);
1671
1739
  _react.useEffect.call(void 0, () => {
1672
1740
  savePhaseTimings(txHash, phaseTimings);
1673
1741
  }, [txHash, phaseTimings]);
@@ -1694,21 +1762,21 @@ function ProcessingStep({
1694
1762
  debugLog(debug, "processing", "poll:event", {
1695
1763
  type: lastEvent2.type,
1696
1764
  matchesTx: eventMatchesTx,
1697
- intentId: _optionalChain([eventData, 'optionalAccess', _111 => _111.intentId])
1765
+ intentId: _optionalChain([eventData, 'optionalAccess', _113 => _113.intentId])
1698
1766
  });
1699
1767
  }
1700
1768
  if (!isMounted) return;
1701
1769
  const awaitingPostBridgeSwap = processingContextRef.current.waitForFinalTx && processingContextRef.current.hasPostBridgeActions;
1702
- if (_optionalChain([eventForCurrentTx, 'optionalAccess', _112 => _112.type]) === "post-bridge-swap-complete") {
1770
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _114 => _114.type]) === "post-bridge-swap-complete") {
1703
1771
  setState({ type: "complete", lastEvent: eventForCurrentTx });
1704
- const swapTxHash = _optionalChain([eventForCurrentTx, 'access', _113 => _113.data, 'optionalAccess', _114 => _114.swap, 'optionalAccess', _115 => _115.transactionHash]);
1772
+ const swapTxHash = _optionalChain([eventForCurrentTx, 'access', _115 => _115.data, 'optionalAccess', _116 => _116.swap, 'optionalAccess', _117 => _117.transactionHash]);
1705
1773
  debugLog(debug, "processing", "state:complete", {
1706
1774
  txHash,
1707
1775
  destinationTxHash: swapTxHash,
1708
1776
  event: eventForCurrentTx.type
1709
1777
  });
1710
1778
  const context = processingContextRef.current;
1711
- _optionalChain([onDepositCompleteRef, 'access', _116 => _116.current, 'optionalCall', _117 => _117(txHash, swapTxHash, {
1779
+ _optionalChain([onDepositCompleteRef, 'access', _118 => _118.current, 'optionalCall', _119 => _119(txHash, swapTxHash, {
1712
1780
  amount: context.amount,
1713
1781
  sourceChain: context.sourceChain,
1714
1782
  sourceToken: context.sourceToken,
@@ -1717,7 +1785,7 @@ function ProcessingStep({
1717
1785
  })]);
1718
1786
  return;
1719
1787
  }
1720
- if (_optionalChain([eventForCurrentTx, 'optionalAccess', _118 => _118.type]) === "post-bridge-swap-failed") {
1788
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _120 => _120.type]) === "post-bridge-swap-failed") {
1721
1789
  const formatted = formatBridgeFailedMessage(eventForCurrentTx);
1722
1790
  setState({
1723
1791
  type: "failed",
@@ -1729,19 +1797,19 @@ function ProcessingStep({
1729
1797
  message: formatted.message,
1730
1798
  code: formatted.code
1731
1799
  });
1732
- _optionalChain([onDepositFailedRef, 'access', _119 => _119.current, 'optionalCall', _120 => _120(txHash, formatted.message)]);
1800
+ _optionalChain([onDepositFailedRef, 'access', _121 => _121.current, 'optionalCall', _122 => _122(txHash, formatted.message)]);
1733
1801
  return;
1734
1802
  }
1735
- if (_optionalChain([eventForCurrentTx, 'optionalAccess', _121 => _121.type]) === "bridge-complete" && !awaitingPostBridgeSwap) {
1803
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _123 => _123.type]) === "bridge-complete" && !awaitingPostBridgeSwap) {
1736
1804
  setState({ type: "complete", lastEvent: eventForCurrentTx });
1737
- const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access', _122 => _122.data, 'optionalAccess', _123 => _123.destination, 'optionalAccess', _124 => _124.transactionHash]);
1805
+ const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access', _124 => _124.data, 'optionalAccess', _125 => _125.destination, 'optionalAccess', _126 => _126.transactionHash]);
1738
1806
  debugLog(debug, "processing", "state:complete", {
1739
1807
  txHash,
1740
1808
  destinationTxHash: destinationTxHash2,
1741
1809
  event: eventForCurrentTx.type
1742
1810
  });
1743
1811
  const context = processingContextRef.current;
1744
- _optionalChain([onDepositCompleteRef, 'access', _125 => _125.current, 'optionalCall', _126 => _126(txHash, destinationTxHash2, {
1812
+ _optionalChain([onDepositCompleteRef, 'access', _127 => _127.current, 'optionalCall', _128 => _128(txHash, destinationTxHash2, {
1745
1813
  amount: context.amount,
1746
1814
  sourceChain: context.sourceChain,
1747
1815
  sourceToken: context.sourceToken,
@@ -1750,14 +1818,14 @@ function ProcessingStep({
1750
1818
  })]);
1751
1819
  return;
1752
1820
  }
1753
- if (!waitForFinalTx && _optionalChain([eventForCurrentTx, 'optionalAccess', _127 => _127.type]) === "bridge-started") {
1821
+ if (!waitForFinalTx && _optionalChain([eventForCurrentTx, 'optionalAccess', _129 => _129.type]) === "bridge-started") {
1754
1822
  setState({ type: "complete", lastEvent: eventForCurrentTx });
1755
1823
  debugLog(debug, "processing", "state:early-complete", {
1756
1824
  txHash,
1757
1825
  event: eventForCurrentTx.type
1758
1826
  });
1759
1827
  const context = processingContextRef.current;
1760
- _optionalChain([onDepositCompleteRef, 'access', _128 => _128.current, 'optionalCall', _129 => _129(txHash, void 0, {
1828
+ _optionalChain([onDepositCompleteRef, 'access', _130 => _130.current, 'optionalCall', _131 => _131(txHash, void 0, {
1761
1829
  amount: context.amount,
1762
1830
  sourceChain: context.sourceChain,
1763
1831
  sourceToken: context.sourceToken,
@@ -1766,7 +1834,7 @@ function ProcessingStep({
1766
1834
  })]);
1767
1835
  return;
1768
1836
  }
1769
- if (_optionalChain([eventForCurrentTx, 'optionalAccess', _130 => _130.type]) === "bridge-failed") {
1837
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _132 => _132.type]) === "bridge-failed") {
1770
1838
  const formatted = formatBridgeFailedMessage(eventForCurrentTx);
1771
1839
  setState({
1772
1840
  type: "failed",
@@ -1778,11 +1846,11 @@ function ProcessingStep({
1778
1846
  message: formatted.message,
1779
1847
  code: formatted.code
1780
1848
  });
1781
- _optionalChain([onDepositFailedRef, 'access', _131 => _131.current, 'optionalCall', _132 => _132(txHash, formatted.message)]);
1849
+ _optionalChain([onDepositFailedRef, 'access', _133 => _133.current, 'optionalCall', _134 => _134(txHash, formatted.message)]);
1782
1850
  return;
1783
1851
  }
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"));
1852
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _135 => _135.type]) === "error") {
1853
+ const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access', _136 => _136.data, 'optionalAccess', _137 => _137.message]), () => ( "Unknown error"));
1786
1854
  setState({
1787
1855
  type: "failed",
1788
1856
  message: errorMessage,
@@ -1792,7 +1860,7 @@ function ProcessingStep({
1792
1860
  txHash,
1793
1861
  message: errorMessage
1794
1862
  });
1795
- _optionalChain([onDepositFailedRef, 'access', _136 => _136.current, 'optionalCall', _137 => _137(txHash, errorMessage)]);
1863
+ _optionalChain([onDepositFailedRef, 'access', _138 => _138.current, 'optionalCall', _139 => _139(txHash, errorMessage)]);
1796
1864
  return;
1797
1865
  }
1798
1866
  setState((previous) => ({
@@ -1851,7 +1919,7 @@ function ProcessingStep({
1851
1919
  txHash,
1852
1920
  timeoutMs: ESCALATED_DELAY_MS
1853
1921
  });
1854
- _optionalChain([onErrorRef, 'access', _138 => _138.current, 'optionalCall', _139 => _139(message, "PROCESS_TIMEOUT")]);
1922
+ _optionalChain([onErrorRef, 'access', _140 => _140.current, 'optionalCall', _141 => _141(message, "PROCESS_TIMEOUT")]);
1855
1923
  }, ESCALATED_DELAY_MS);
1856
1924
  return () => clearTimeout(timeoutId);
1857
1925
  }, [debug, directTransfer, onErrorRef, state.type, txHash]);
@@ -1860,13 +1928,13 @@ function ProcessingStep({
1860
1928
  const isProcessing = state.type === "processing";
1861
1929
  const lastEvent = state.lastEvent;
1862
1930
  const failureMessage = state.type === "failed" ? state.message : void 0;
1863
- const isEarlyComplete = !waitForFinalTx && _optionalChain([lastEvent, 'optionalAccess', _140 => _140.type]) === "bridge-started";
1931
+ const isEarlyComplete = !waitForFinalTx && _optionalChain([lastEvent, 'optionalAccess', _142 => _142.type]) === "bridge-started";
1864
1932
  const timelineNowMs = _nullishCoalesce(phaseTimings.endedAt, () => ( Date.now()));
1865
1933
  const flowNoun = flowLabel === "withdraw" ? "withdrawal" : "deposit";
1866
1934
  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;
1935
+ const isPostBridgeSwapEvent = _optionalChain([lastEvent, 'optionalAccess', _143 => _143.type]) === "post-bridge-swap-complete" || _optionalChain([lastEvent, 'optionalAccess', _144 => _144.type]) === "post-bridge-swap-failed";
1936
+ 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;
1937
+ const bridgeTxHash = isPostBridgeSwapEvent ? _optionalChain([lastEvent, 'optionalAccess', _151 => _151.data, 'optionalAccess', _152 => _152.bridge, 'optionalAccess', _153 => _153.transactionHash]) || null : null;
1870
1938
  const sourceDetails = getEventSourceDetails(lastEvent);
1871
1939
  const displaySourceChain = _nullishCoalesce(sourceDetails.chainId, () => ( sourceChain));
1872
1940
  const displaySourceToken = _nullishCoalesce(sourceDetails.token, () => ( sourceToken));
@@ -1897,7 +1965,7 @@ function ProcessingStep({
1897
1965
  const activePhaseElapsedMs = isProcessing && activePhaseStartedAt !== void 0 ? timelineNowMs - activePhaseStartedAt : 0;
1898
1966
  const delayPhaseId = isProcessing && currentPhaseId && activePhaseElapsedMs >= SOFT_DELAY_MS[currentPhaseId] ? currentPhaseId : void 0;
1899
1967
  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.";
1968
+ 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
1969
  const showAlert = !isFailed && (delayPhaseId !== void 0 || hasEscalatedDelay);
1902
1970
  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
1971
  const fillStatus = isComplete ? "Successful" : isFailed ? "Failed" : "Processing";
@@ -78,6 +78,15 @@ function ReownWalletProvider({
78
78
  const config = adapter.wagmiConfig;
79
79
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _wagmi.WagmiProvider, { config, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider, { client: queryClient, children }) });
80
80
  }
81
+ async function disconnectWallet() {
82
+ if (!_react3.modal) {
83
+ console.warn(
84
+ "[rhinestone] disconnectWallet called before the modal provider mounted; no-op."
85
+ );
86
+ return;
87
+ }
88
+ await _react3.modal.disconnect();
89
+ }
81
90
  function useReownWallet() {
82
91
  const { open } = _react3.useAppKit.call(void 0, );
83
92
  const { address, isConnected, caipAddress } = _react3.useAppKitAccount.call(void 0, );
@@ -119,4 +128,5 @@ function useReownWallet() {
119
128
 
120
129
 
121
130
 
122
- exports.ReownWalletProvider = ReownWalletProvider; exports.useReownWallet = useReownWallet;
131
+
132
+ exports.ReownWalletProvider = ReownWalletProvider; exports.disconnectWallet = disconnectWallet; exports.useReownWallet = useReownWallet;
package/dist/deposit.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkUDKZWFCMcjs = require('./chunk-UDKZWFCM.cjs');
4
- require('./chunk-FLVSQDP4.cjs');
3
+ var _chunk6W42ROABcjs = require('./chunk-6W42ROAB.cjs');
4
+ require('./chunk-TCILEYM5.cjs');
5
5
  require('./chunk-MUWVDVY4.cjs');
6
6
 
7
7
 
8
- exports.DepositModal = _chunkUDKZWFCMcjs.DepositModal;
8
+ exports.DepositModal = _chunk6W42ROABcjs.DepositModal;
package/dist/deposit.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DepositModal
3
- } from "./chunk-NFE5ZLD3.mjs";
4
- import "./chunk-IUW3SJQT.mjs";
3
+ } from "./chunk-3RV2B6JM.mjs";
4
+ import "./chunk-DA3XVDNQ.mjs";
5
5
  import "./chunk-SDZKKUCJ.mjs";
6
6
  export {
7
7
  DepositModal