@rhinestone/deposit-modal 0.17.0 → 0.19.0

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.
Files changed (62) hide show
  1. package/README.md +109 -0
  2. package/dist/{DepositModalReown-6CXXGQ7X.cjs → DepositModalReown-UITYXJ6W.cjs} +17 -17
  3. package/dist/{DepositModalReown-ELDSTIME.mjs → DepositModalReown-XBNY6QCI.mjs} +4 -4
  4. package/dist/{WithdrawModal-QRMDR5T4.mjs → WithdrawModal-DY6A55OA.mjs} +3 -3
  5. package/dist/WithdrawModal-V42OK7L3.cjs +11 -0
  6. package/dist/bearer-transport-CVHNBgoV.d.cts +14 -0
  7. package/dist/bearer-transport-CVHNBgoV.d.ts +14 -0
  8. package/dist/{chunk-QMGEK623.mjs → chunk-5NWLS5BQ.mjs} +536 -225
  9. package/dist/chunk-ADEWTBSN.cjs +19 -0
  10. package/dist/{chunk-ZHX4QROC.mjs → chunk-BIL4ENC3.mjs} +1 -1
  11. package/dist/{chunk-2W4BJ5I3.cjs → chunk-EG4H7OMC.cjs} +71 -71
  12. package/dist/{chunk-QGNJFDEO.cjs → chunk-HMUGY66O.cjs} +690 -379
  13. package/dist/chunk-ISLVD5HQ.cjs +41 -0
  14. package/dist/{chunk-H66WM5AO.mjs → chunk-NITKDXHR.mjs} +388 -95
  15. package/dist/{chunk-XJMDCBHS.cjs → chunk-OCWSMLOP.cjs} +862 -569
  16. package/dist/chunk-PP4QE32S.mjs +19 -0
  17. package/dist/{chunk-JCWJ6HW7.cjs → chunk-PYOC6K24.cjs} +1 -1
  18. package/dist/{chunk-XCBDJPBD.mjs → chunk-X6N2XPTO.mjs} +1 -1
  19. package/dist/chunk-ZGHVJ2XM.mjs +41 -0
  20. package/dist/compliance.cjs +14 -0
  21. package/dist/compliance.d.cts +10 -0
  22. package/dist/compliance.d.ts +10 -0
  23. package/dist/compliance.mjs +14 -0
  24. package/dist/constants.cjs +3 -3
  25. package/dist/constants.d.cts +1 -1
  26. package/dist/constants.d.ts +1 -1
  27. package/dist/constants.mjs +3 -3
  28. package/dist/deposit.cjs +4 -4
  29. package/dist/deposit.d.cts +2 -2
  30. package/dist/deposit.d.ts +2 -2
  31. package/dist/deposit.mjs +3 -3
  32. package/dist/embed.cjs +16 -16
  33. package/dist/embed.d.cts +1 -1
  34. package/dist/embed.d.ts +1 -1
  35. package/dist/embed.mjs +8 -8
  36. package/dist/index.cjs +5 -5
  37. package/dist/index.d.cts +1 -1
  38. package/dist/index.d.ts +1 -1
  39. package/dist/index.mjs +4 -4
  40. package/dist/offramp.cjs +25 -0
  41. package/dist/offramp.d.cts +28 -0
  42. package/dist/offramp.d.ts +28 -0
  43. package/dist/offramp.mjs +25 -0
  44. package/dist/onramp.cjs +40 -0
  45. package/dist/onramp.d.cts +55 -0
  46. package/dist/onramp.d.ts +55 -0
  47. package/dist/onramp.mjs +40 -0
  48. package/dist/ramp-types-C6aUz4SZ.d.cts +43 -0
  49. package/dist/ramp-types-C6aUz4SZ.d.ts +43 -0
  50. package/dist/server.cjs +54 -2
  51. package/dist/server.d.cts +13 -1
  52. package/dist/server.d.ts +13 -1
  53. package/dist/server.mjs +52 -0
  54. package/dist/styles.css +25 -0
  55. package/dist/{types-B9SbZQIG.d.ts → types-BOxa1DE-.d.ts} +40 -4
  56. package/dist/{types-SwGGf0eH.d.cts → types-BShYNpvO.d.cts} +40 -4
  57. package/dist/withdraw.cjs +4 -4
  58. package/dist/withdraw.d.cts +2 -2
  59. package/dist/withdraw.d.ts +2 -2
  60. package/dist/withdraw.mjs +3 -3
  61. package/package.json +35 -5
  62. package/dist/WithdrawModal-QB2U756L.cjs +0 -11
@@ -1,7 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkJCWJ6HW7cjs = require('./chunk-JCWJ6HW7.cjs');
5
4
 
6
5
 
7
6
 
@@ -32,10 +31,11 @@ var _chunkJCWJ6HW7cjs = require('./chunk-JCWJ6HW7.cjs');
32
31
 
33
32
 
34
33
 
34
+ var _chunkOY5N3E6Lcjs = require('./chunk-OY5N3E6L.cjs');
35
35
 
36
36
 
37
37
 
38
- var _chunkOY5N3E6Lcjs = require('./chunk-OY5N3E6L.cjs');
38
+ var _chunkPYOC6K24cjs = require('./chunk-PYOC6K24.cjs');
39
39
 
40
40
  // src/components/ui/Modal.tsx
41
41
 
@@ -625,6 +625,8 @@ function parseQuotePreview(raw) {
625
625
  }
626
626
  const output = parseQuoteOutput(obj.output);
627
627
  if (!output) return null;
628
+ const input = obj.input === void 0 ? void 0 : parseQuoteOutput(obj.input);
629
+ if (obj.input !== void 0 && !input) return null;
628
630
  const fees = obj.fees;
629
631
  if (typeof fees !== "object" || fees === null) return null;
630
632
  const total = fees.total;
@@ -657,6 +659,7 @@ function parseQuotePreview(raw) {
657
659
  estimatedFillTimeSeconds: obj.estimatedFillTimeSeconds,
658
660
  fees: { total: { usd: totalUsd }, breakdown },
659
661
  output,
662
+ ...input ? { input } : {},
660
663
  ...timing ? { timing } : {}
661
664
  };
662
665
  }
@@ -736,6 +739,31 @@ function resolveAppFeeBps(appFees, sourceChainCaip2, sourceToken) {
736
739
  const bps = _nullishCoalesce(_nullishCoalesce(override, () => ( _optionalChain([appFees, 'optionalAccess', _8 => _8.feeBps]))), () => ( 0));
737
740
  return bps > 0 ? bps : 0;
738
741
  }
742
+ function isRawAmount(value) {
743
+ return typeof value === "string" && /^\d+$/.test(value);
744
+ }
745
+ function isDepositPolicyRefusal(value) {
746
+ return typeof value === "object" && value !== null && "policyRefusal" in value;
747
+ }
748
+ var DEPOSIT_POLICY_REFUSAL_CODES = [
749
+ "TOKEN-3",
750
+ "BALANCE-3",
751
+ "BALANCE-4"
752
+ ];
753
+ var DEPOSIT_PREFLIGHT_TIMEOUT_MS = 1e4;
754
+ async function readPolicyRefusal(response) {
755
+ if (response.status !== 422) return null;
756
+ try {
757
+ const body = await response.json();
758
+ if (!body || typeof body.code !== "string" || !DEPOSIT_POLICY_REFUSAL_CODES.includes(body.code)) {
759
+ return null;
760
+ }
761
+ const message = typeof body.error === "string" && body.error !== "" ? body.error : "This deposit is not accepted.";
762
+ return { policyRefusal: { code: body.code, message } };
763
+ } catch (e4) {
764
+ return null;
765
+ }
766
+ }
739
767
  var PermitDepositSubmitError = class extends Error {
740
768
  constructor(message, safeToTransfer) {
741
769
  super(message);
@@ -762,62 +790,93 @@ function createDepositService(baseUrl, options) {
762
790
  if (value.length <= 20) return value;
763
791
  return `${value.slice(0, 10)}...${value.slice(-8)}`;
764
792
  }
793
+ function withPreflightTimeout(label, fallback, run) {
794
+ const controller = new AbortController();
795
+ return new Promise((resolve) => {
796
+ const timer = setTimeout(() => {
797
+ debugLog(debug, scope, `${label}:timeout`, {
798
+ timeoutMs: DEPOSIT_PREFLIGHT_TIMEOUT_MS
799
+ });
800
+ controller.abort();
801
+ resolve(fallback);
802
+ }, DEPOSIT_PREFLIGHT_TIMEOUT_MS);
803
+ run(controller.signal).then(
804
+ (value) => {
805
+ clearTimeout(timer);
806
+ resolve(value);
807
+ },
808
+ () => {
809
+ clearTimeout(timer);
810
+ resolve(fallback);
811
+ }
812
+ );
813
+ });
814
+ }
765
815
  const PORTFOLIO_CACHE_TTL_MS = 3e4;
766
816
  const portfolioCache = /* @__PURE__ */ new Map();
767
817
  let topTokensPromise = null;
768
818
  let chainsPromise = null;
769
- function parseTopTokens(value) {
770
- if (typeof value !== "object" || value === null || Array.isArray(value)) {
819
+ function parseDepositOptions(value) {
820
+ if (typeof value !== "object" || value === null) return null;
821
+ const { restricted, tokens: rawTokens } = value;
822
+ if (typeof restricted !== "boolean") return null;
823
+ if (typeof rawTokens !== "object" || rawTokens === null || Array.isArray(rawTokens)) {
771
824
  return null;
772
825
  }
773
- const parsed = {};
774
- for (const [chainKey, list] of Object.entries(value)) {
826
+ const tokens = {};
827
+ for (const [chainKey, list] of Object.entries(rawTokens)) {
775
828
  if (!Array.isArray(list)) return null;
776
- const tokens = [];
829
+ const parsed = [];
777
830
  for (const entry of list) {
778
831
  if (typeof entry !== "object" || entry === null) return null;
779
- const { symbol, address, decimals } = entry;
832
+ const { symbol, address, decimals, minAmount, maxAmount } = entry;
780
833
  if (typeof symbol !== "string" || typeof address !== "string" || typeof decimals !== "number") {
781
834
  return null;
782
835
  }
783
- tokens.push({ symbol, address, decimals });
836
+ parsed.push({
837
+ symbol,
838
+ address,
839
+ decimals,
840
+ ...isRawAmount(minAmount) && { minAmount },
841
+ ...isRawAmount(maxAmount) && { maxAmount }
842
+ });
784
843
  }
785
- parsed[chainKey] = tokens;
844
+ tokens[chainKey] = parsed;
786
845
  }
787
- return parsed;
846
+ return { restricted, tokens };
788
847
  }
789
848
  async function requestTopTokens() {
790
849
  try {
791
850
  const response = await fetch(apiUrl("/qr/tokens"), {
792
851
  method: "GET",
793
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, )
852
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, )
794
853
  });
795
854
  if (!response.ok) {
796
855
  debugLog(debug, scope, "getTopTokens:unavailable", {
797
856
  status: response.status
798
857
  });
799
- return null;
858
+ return { ok: false };
800
859
  }
801
- const data = await response.json();
802
- const tokens = parseTopTokens(data.tokens);
803
- if (!tokens) {
860
+ const options2 = parseDepositOptions(await response.json());
861
+ if (!options2) {
804
862
  debugLog(debug, scope, "getTopTokens:malformed");
805
- return null;
863
+ return { ok: false };
806
864
  }
807
865
  debugLog(debug, scope, "getTopTokens:success", {
808
- chains: Object.keys(tokens).length
866
+ chains: Object.keys(options2.tokens).length,
867
+ restricted: options2.restricted
809
868
  });
810
- return tokens;
869
+ return { ok: true, options: options2 };
811
870
  } catch (error) {
812
871
  debugError(debug, scope, "getTopTokens:error", error);
813
- return null;
872
+ return { ok: false };
814
873
  }
815
874
  }
816
875
  async function requestChains() {
817
876
  try {
818
877
  const response = await fetch(apiUrl("/chains"), {
819
878
  method: "GET",
820
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, )
879
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, )
821
880
  });
822
881
  if (!response.ok) {
823
882
  debugLog(debug, scope, "getChains:unavailable", {
@@ -871,7 +930,7 @@ function createDepositService(baseUrl, options) {
871
930
  });
872
931
  const response = await fetch(url, {
873
932
  method: "POST",
874
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
933
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
875
934
  body: JSON.stringify({ account: params })
876
935
  });
877
936
  if (!response.ok) {
@@ -906,7 +965,7 @@ function createDepositService(baseUrl, options) {
906
965
  debugLog(debug, scope, "fetchPortfolio:request", { url, address });
907
966
  const response = await fetch(url, {
908
967
  method: "GET",
909
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, )
968
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, )
910
969
  });
911
970
  if (!response.ok) {
912
971
  const error = await response.json().catch(() => ({ error: "Unknown error" }));
@@ -957,7 +1016,7 @@ function createDepositService(baseUrl, options) {
957
1016
  });
958
1017
  const response = await fetch(url, {
959
1018
  method: "GET",
960
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, )
1019
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, )
961
1020
  });
962
1021
  if (!response.ok) {
963
1022
  const error = await response.json().catch(() => ({ error: "Unknown error" }));
@@ -986,7 +1045,7 @@ function createDepositService(baseUrl, options) {
986
1045
  debugLog(debug, scope, "checkAccount:request", { url, address });
987
1046
  const response = await fetch(url, {
988
1047
  method: "GET",
989
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, )
1048
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, )
990
1049
  });
991
1050
  if (!response.ok) {
992
1051
  const error = await response.json().catch(() => ({ error: "Unknown error" }));
@@ -1022,7 +1081,7 @@ function createDepositService(baseUrl, options) {
1022
1081
  );
1023
1082
  const response = await fetch(url, {
1024
1083
  method: "GET",
1025
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1084
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1026
1085
  cache: "no-store"
1027
1086
  });
1028
1087
  if (!response.ok) {
@@ -1050,7 +1109,7 @@ function createDepositService(baseUrl, options) {
1050
1109
  );
1051
1110
  const response = await fetch(url, {
1052
1111
  method: "GET",
1053
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1112
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1054
1113
  cache: "no-store"
1055
1114
  });
1056
1115
  if (!response.ok) {
@@ -1074,7 +1133,7 @@ function createDepositService(baseUrl, options) {
1074
1133
  );
1075
1134
  const response = await fetch(url, {
1076
1135
  method: "GET",
1077
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1136
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1078
1137
  cache: "no-store"
1079
1138
  });
1080
1139
  if (!response.ok) {
@@ -1096,7 +1155,7 @@ function createDepositService(baseUrl, options) {
1096
1155
  async getPositions(address) {
1097
1156
  const url = apiUrl(`/positions/${address}`);
1098
1157
  debugLog(debug, scope, "getPositions:request", { url, address });
1099
- const response = await fetch(url, { headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ) });
1158
+ const response = await fetch(url, { headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ) });
1100
1159
  if (!response.ok) {
1101
1160
  const error = await response.json().catch(() => ({ error: "Unknown error" }));
1102
1161
  debugError(debug, scope, "getPositions:failed", error, {
@@ -1130,7 +1189,7 @@ function createDepositService(baseUrl, options) {
1130
1189
  });
1131
1190
  const response = await fetch(url, {
1132
1191
  method: "POST",
1133
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1192
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1134
1193
  body: JSON.stringify({ account, market, chainId, asset, amount })
1135
1194
  });
1136
1195
  if (!response.ok) {
@@ -1166,7 +1225,7 @@ function createDepositService(baseUrl, options) {
1166
1225
  });
1167
1226
  const response = await fetch(url, {
1168
1227
  method: "POST",
1169
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1228
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1170
1229
  body: JSON.stringify({
1171
1230
  depositWallet,
1172
1231
  owner,
@@ -1208,7 +1267,7 @@ function createDepositService(baseUrl, options) {
1208
1267
  });
1209
1268
  const response = await fetch(url, {
1210
1269
  method: "GET",
1211
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1270
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1212
1271
  cache: "no-store"
1213
1272
  });
1214
1273
  if (!response.ok) {
@@ -1258,7 +1317,7 @@ function createDepositService(baseUrl, options) {
1258
1317
  });
1259
1318
  const response = await fetch(url, {
1260
1319
  method: "GET",
1261
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1320
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1262
1321
  cache: "no-store"
1263
1322
  });
1264
1323
  if (!response.ok) {
@@ -1295,44 +1354,59 @@ function createDepositService(baseUrl, options) {
1295
1354
  // chain, and a HyperCore source token is a 16-byte Core spot tokenId.
1296
1355
  sourceChainId: params.sourceChainId === "hypercore" ? _chunkOY5N3E6Lcjs.HYPERCORE_SPOT_CAIP2 : `eip155:${params.sourceChainId}`,
1297
1356
  sourceToken: params.sourceToken,
1298
- amount: params.amount
1357
+ // Each direction carries its own amount field and omits the other, which
1358
+ // is what the processor's "exactly one of" refinement checks. Sending
1359
+ // both is a 400, so spread rather than always emitting `amount`.
1360
+ ...params.direction === "exactOut" ? { direction: "exactOut", amountOut: params.amountOut } : { amount: params.amount }
1299
1361
  };
1300
1362
  debugLog(debug, scope, "getQuotePreview:request", {
1301
1363
  url,
1302
1364
  sourceChainId: body.sourceChainId,
1303
1365
  sourceToken: params.sourceToken,
1304
- amount: params.amount
1366
+ direction: _nullishCoalesce(params.direction, () => ( "exactIn")),
1367
+ amount: params.amount,
1368
+ amountOut: params.amountOut
1305
1369
  });
1306
- try {
1307
- const response = await fetch(url, {
1308
- method: "POST",
1309
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1310
- body: JSON.stringify(body),
1311
- cache: "no-store"
1312
- });
1313
- if (!response.ok) {
1314
- debugLog(debug, scope, "getQuotePreview:unavailable", {
1315
- status: response.status
1370
+ return withPreflightTimeout("getQuotePreview", null, async (signal) => {
1371
+ try {
1372
+ const response = await fetch(url, {
1373
+ method: "POST",
1374
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1375
+ body: JSON.stringify(body),
1376
+ cache: "no-store",
1377
+ signal
1316
1378
  });
1317
- return null;
1318
- }
1319
- const quote = parseQuotePreview(await response.json());
1320
- if (!quote) {
1321
- debugLog(debug, scope, "getQuotePreview:unavailable", {
1322
- status: response.status,
1323
- reason: "malformed"
1379
+ if (!response.ok) {
1380
+ const refusal = await readPolicyRefusal(response);
1381
+ if (refusal) {
1382
+ debugLog(debug, scope, "getQuotePreview:refused", {
1383
+ code: refusal.policyRefusal.code
1384
+ });
1385
+ return refusal;
1386
+ }
1387
+ debugLog(debug, scope, "getQuotePreview:unavailable", {
1388
+ status: response.status
1389
+ });
1390
+ return null;
1391
+ }
1392
+ const quote = parseQuotePreview(await response.json());
1393
+ if (!quote) {
1394
+ debugLog(debug, scope, "getQuotePreview:unavailable", {
1395
+ status: response.status,
1396
+ reason: "malformed"
1397
+ });
1398
+ return null;
1399
+ }
1400
+ debugLog(debug, scope, "getQuotePreview:success", {
1401
+ settlementLayer: quote.settlementLayer,
1402
+ totalUsd: quote.fees.total.usd
1324
1403
  });
1404
+ return quote;
1405
+ } catch (error) {
1406
+ debugError(debug, scope, "getQuotePreview:error", error);
1325
1407
  return null;
1326
1408
  }
1327
- debugLog(debug, scope, "getQuotePreview:success", {
1328
- settlementLayer: quote.settlementLayer,
1329
- totalUsd: quote.fees.total.usd
1330
- });
1331
- return quote;
1332
- } catch (error) {
1333
- debugError(debug, scope, "getQuotePreview:error", error);
1334
- return null;
1335
- }
1409
+ });
1336
1410
  },
1337
1411
  async preparePermitDeposit(params) {
1338
1412
  const url = apiUrl("/deposits/permit/prepare");
@@ -1343,88 +1417,98 @@ function createDepositService(baseUrl, options) {
1343
1417
  token: params.token,
1344
1418
  amount: params.amount
1345
1419
  });
1346
- try {
1347
- const response = await fetch(url, {
1348
- method: "POST",
1349
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1350
- body: JSON.stringify({ ...params, kind: "auto" }),
1351
- cache: "no-store"
1352
- });
1353
- if (!response.ok) {
1354
- debugLog(debug, scope, "preparePermitDeposit:unavailable", {
1355
- status: response.status
1356
- });
1357
- return null;
1358
- }
1359
- const data = await response.json();
1360
- if (!data || typeof data.available !== "boolean") {
1361
- debugLog(debug, scope, "preparePermitDeposit:unavailable", {
1362
- status: response.status,
1363
- reason: "malformed"
1420
+ return withPreflightTimeout("preparePermitDeposit", null, async (signal) => {
1421
+ try {
1422
+ const response = await fetch(url, {
1423
+ method: "POST",
1424
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1425
+ body: JSON.stringify({ ...params, kind: "auto" }),
1426
+ cache: "no-store",
1427
+ signal
1364
1428
  });
1365
- return null;
1366
- }
1367
- if (data.available === false) {
1368
- const reason = data.reason;
1369
- if (reason !== "permit2-approval-required" && reason !== "unsupported-token" && reason !== "unsupported-owner") {
1429
+ if (!response.ok) {
1430
+ const refusal = await readPolicyRefusal(response);
1431
+ if (refusal) {
1432
+ debugLog(debug, scope, "preparePermitDeposit:refused", {
1433
+ code: refusal.policyRefusal.code
1434
+ });
1435
+ return refusal;
1436
+ }
1437
+ debugLog(debug, scope, "preparePermitDeposit:unavailable", {
1438
+ status: response.status
1439
+ });
1370
1440
  return null;
1371
1441
  }
1372
- debugLog(debug, scope, "preparePermitDeposit:unavailable", {
1373
- status: response.status,
1374
- reason
1375
- });
1376
- const approval = data.approval;
1377
- const parsedApproval = approval && typeof approval.token === "string" && typeof approval.spender === "string" && typeof approval.minimumAmount === "string" ? {
1378
- token: approval.token,
1379
- spender: approval.spender,
1380
- minimumAmount: approval.minimumAmount
1381
- } : void 0;
1382
- return {
1383
- available: false,
1384
- reason,
1385
- ...parsedApproval && { approval: parsedApproval }
1386
- };
1387
- }
1388
- const authorization = data.authorization;
1389
- if (!authorization || typeof authorization.typedData !== "object" || authorization.typedData === null || typeof authorization.nonce !== "string") {
1390
- return null;
1391
- }
1392
- if (authorization.kind === "erc3009" && typeof authorization.validAfter === "string" && typeof authorization.validBefore === "string") {
1393
- debugLog(debug, scope, "preparePermitDeposit:success", {
1394
- kind: authorization.kind,
1395
- nonce: authorization.nonce
1396
- });
1397
- return {
1398
- available: true,
1399
- authorization: {
1400
- kind: "erc3009",
1401
- typedData: authorization.typedData,
1402
- nonce: authorization.nonce,
1403
- validAfter: authorization.validAfter,
1404
- validBefore: authorization.validBefore
1442
+ const data = await response.json();
1443
+ if (!data || typeof data.available !== "boolean") {
1444
+ debugLog(debug, scope, "preparePermitDeposit:unavailable", {
1445
+ status: response.status,
1446
+ reason: "malformed"
1447
+ });
1448
+ return null;
1449
+ }
1450
+ if (data.available === false) {
1451
+ const reason = data.reason;
1452
+ if (reason !== "permit2-approval-required" && reason !== "unsupported-token" && reason !== "unsupported-owner") {
1453
+ return null;
1405
1454
  }
1406
- };
1407
- }
1408
- if ((authorization.kind === "erc2612" || authorization.kind === "permit2") && typeof authorization.deadline === "string") {
1409
- debugLog(debug, scope, "preparePermitDeposit:success", {
1410
- kind: authorization.kind,
1411
- nonce: authorization.nonce
1412
- });
1413
- return {
1414
- available: true,
1415
- authorization: {
1455
+ debugLog(debug, scope, "preparePermitDeposit:unavailable", {
1456
+ status: response.status,
1457
+ reason
1458
+ });
1459
+ const approval = data.approval;
1460
+ const parsedApproval = approval && typeof approval.token === "string" && typeof approval.spender === "string" && typeof approval.minimumAmount === "string" ? {
1461
+ token: approval.token,
1462
+ spender: approval.spender,
1463
+ minimumAmount: approval.minimumAmount
1464
+ } : void 0;
1465
+ return {
1466
+ available: false,
1467
+ reason,
1468
+ ...parsedApproval && { approval: parsedApproval }
1469
+ };
1470
+ }
1471
+ const authorization = data.authorization;
1472
+ if (!authorization || typeof authorization.typedData !== "object" || authorization.typedData === null || typeof authorization.nonce !== "string") {
1473
+ return null;
1474
+ }
1475
+ if (authorization.kind === "erc3009" && typeof authorization.validAfter === "string" && typeof authorization.validBefore === "string") {
1476
+ debugLog(debug, scope, "preparePermitDeposit:success", {
1416
1477
  kind: authorization.kind,
1417
- typedData: authorization.typedData,
1418
- nonce: authorization.nonce,
1419
- deadline: authorization.deadline
1420
- }
1421
- };
1478
+ nonce: authorization.nonce
1479
+ });
1480
+ return {
1481
+ available: true,
1482
+ authorization: {
1483
+ kind: "erc3009",
1484
+ typedData: authorization.typedData,
1485
+ nonce: authorization.nonce,
1486
+ validAfter: authorization.validAfter,
1487
+ validBefore: authorization.validBefore
1488
+ }
1489
+ };
1490
+ }
1491
+ if ((authorization.kind === "erc2612" || authorization.kind === "permit2") && typeof authorization.deadline === "string") {
1492
+ debugLog(debug, scope, "preparePermitDeposit:success", {
1493
+ kind: authorization.kind,
1494
+ nonce: authorization.nonce
1495
+ });
1496
+ return {
1497
+ available: true,
1498
+ authorization: {
1499
+ kind: authorization.kind,
1500
+ typedData: authorization.typedData,
1501
+ nonce: authorization.nonce,
1502
+ deadline: authorization.deadline
1503
+ }
1504
+ };
1505
+ }
1506
+ return null;
1507
+ } catch (error) {
1508
+ debugError(debug, scope, "preparePermitDeposit:error", error);
1509
+ return null;
1422
1510
  }
1423
- return null;
1424
- } catch (error) {
1425
- debugError(debug, scope, "preparePermitDeposit:error", error);
1426
- return null;
1427
- }
1511
+ });
1428
1512
  },
1429
1513
  async submitPermitDeposit(params) {
1430
1514
  const url = apiUrl("/deposits/permit");
@@ -1440,7 +1524,7 @@ function createDepositService(baseUrl, options) {
1440
1524
  try {
1441
1525
  response = await fetch(url, {
1442
1526
  method: "POST",
1443
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1527
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1444
1528
  body: JSON.stringify(params)
1445
1529
  });
1446
1530
  } catch (error) {
@@ -1491,7 +1575,7 @@ function createDepositService(baseUrl, options) {
1491
1575
  try {
1492
1576
  const response = await fetch(url, {
1493
1577
  method: "GET",
1494
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1578
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1495
1579
  cache: "no-store"
1496
1580
  });
1497
1581
  if (!response.ok) {
@@ -1523,7 +1607,7 @@ function createDepositService(baseUrl, options) {
1523
1607
  try {
1524
1608
  const response = await fetch(url, {
1525
1609
  method: "GET",
1526
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1610
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1527
1611
  cache: "no-store"
1528
1612
  });
1529
1613
  if (!response.ok) {
@@ -1548,7 +1632,7 @@ function createDepositService(baseUrl, options) {
1548
1632
  });
1549
1633
  const response = await fetch(url, {
1550
1634
  method: "POST",
1551
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1635
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1552
1636
  body: JSON.stringify(params)
1553
1637
  });
1554
1638
  if (!response.ok) {
@@ -1580,7 +1664,7 @@ function createDepositService(baseUrl, options) {
1580
1664
  });
1581
1665
  const response = await fetch(url, {
1582
1666
  method: "POST",
1583
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1667
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1584
1668
  body: JSON.stringify(params)
1585
1669
  });
1586
1670
  if (!response.ok) {
@@ -1617,7 +1701,7 @@ function createDepositService(baseUrl, options) {
1617
1701
  debugLog(debug, scope, "getSwappedConnectExchanges:request");
1618
1702
  const response = await fetch(url, {
1619
1703
  method: "GET",
1620
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1704
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1621
1705
  cache: "no-store"
1622
1706
  });
1623
1707
  if (!response.ok) {
@@ -1670,7 +1754,7 @@ function createDepositService(baseUrl, options) {
1670
1754
  try {
1671
1755
  const response = await fetch(url, {
1672
1756
  method: "GET",
1673
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1757
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1674
1758
  cache: "no-store"
1675
1759
  });
1676
1760
  if (!response.ok) {
@@ -1733,9 +1817,11 @@ function createDepositService(baseUrl, options) {
1733
1817
  },
1734
1818
  getTopTokens() {
1735
1819
  if (!topTokensPromise) {
1736
- const attempt = requestTopTokens().then((tokens) => {
1737
- if (!tokens && topTokensPromise === attempt) topTokensPromise = null;
1738
- return tokens;
1820
+ const attempt = requestTopTokens().then((result) => {
1821
+ if (!result.ok && topTokensPromise === attempt) {
1822
+ topTokensPromise = null;
1823
+ }
1824
+ return result;
1739
1825
  });
1740
1826
  topTokensPromise = attempt;
1741
1827
  }
@@ -1756,7 +1842,7 @@ function createDepositService(baseUrl, options) {
1756
1842
  try {
1757
1843
  const response = await fetch(url, {
1758
1844
  method: "GET",
1759
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1845
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1760
1846
  cache: "no-store"
1761
1847
  });
1762
1848
  if (!response.ok) {
@@ -1783,14 +1869,14 @@ function createDepositService(baseUrl, options) {
1783
1869
  );
1784
1870
  const response = await fetch(url, {
1785
1871
  method: "GET",
1786
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
1872
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
1787
1873
  cache: "no-store"
1788
1874
  });
1789
1875
  if (!response.ok) return null;
1790
1876
  let body = null;
1791
1877
  try {
1792
1878
  body = await response.json();
1793
- } catch (e4) {
1879
+ } catch (e5) {
1794
1880
  return null;
1795
1881
  }
1796
1882
  if (!body || body.ok !== true) return null;
@@ -1971,6 +2057,60 @@ function useStableRpcUrls(rpcUrls) {
1971
2057
 
1972
2058
 
1973
2059
 
2060
+
2061
+ // src/core/deposit-bounds.ts
2062
+
2063
+ function findListed(options, chain, token) {
2064
+ const normalize2 = (value) => chain === "solana" ? value : value.toLowerCase();
2065
+ return _optionalChain([options, 'access', _71 => _71.tokens, 'access', _72 => _72[String(chain)], 'optionalAccess', _73 => _73.find, 'call', _74 => _74(
2066
+ (listed) => normalize2(listed.address) === normalize2(token)
2067
+ )]);
2068
+ }
2069
+ function isExcludedByRestrictedList(options, chain, token) {
2070
+ return Boolean(_optionalChain([options, 'optionalAccess', _75 => _75.restricted]) && !findListed(options, chain, token));
2071
+ }
2072
+ function findDepositBounds(options, chain, token) {
2073
+ if (!_optionalChain([options, 'optionalAccess', _76 => _76.restricted])) return void 0;
2074
+ const entry = findListed(options, chain, token);
2075
+ if (!entry || entry.minAmount === void 0 && entry.maxAmount === void 0) {
2076
+ return void 0;
2077
+ }
2078
+ return {
2079
+ symbol: entry.symbol,
2080
+ decimals: entry.decimals,
2081
+ ...entry.minAmount !== void 0 && { minAmount: BigInt(entry.minAmount) },
2082
+ ...entry.maxAmount !== void 0 && { maxAmount: BigInt(entry.maxAmount) }
2083
+ };
2084
+ }
2085
+ function boundMessage(bounds, bound) {
2086
+ const raw = _optionalChain([bounds, 'optionalAccess', _77 => _77[bound]]);
2087
+ if (!bounds || raw === void 0) return null;
2088
+ const amount = new Intl.NumberFormat("en-US", {
2089
+ maximumFractionDigits: Math.min(bounds.decimals, 20)
2090
+ }).format(Number(_viem.formatUnits.call(void 0, raw, bounds.decimals)));
2091
+ return `${bound === "minAmount" ? "Minimum" : "Maximum"} deposit is ${amount} ${bounds.symbol}`;
2092
+ }
2093
+ function depositBoundsViolation(bounds, units) {
2094
+ if (!bounds || units === null || units <= 0n) return null;
2095
+ if (bounds.minAmount !== void 0 && units < bounds.minAmount) {
2096
+ return boundMessage(bounds, "minAmount");
2097
+ }
2098
+ if (bounds.maxAmount !== void 0 && units > bounds.maxAmount) {
2099
+ return boundMessage(bounds, "maxAmount");
2100
+ }
2101
+ return null;
2102
+ }
2103
+ function describePolicyRefusal(refusal, bounds) {
2104
+ switch (refusal.code) {
2105
+ case "BALANCE-4":
2106
+ return _nullishCoalesce(boundMessage(bounds, "minAmount"), () => ( "This amount is below the minimum deposit"));
2107
+ case "BALANCE-3":
2108
+ return _nullishCoalesce(boundMessage(bounds, "maxAmount"), () => ( "This amount is above the maximum deposit"));
2109
+ default:
2110
+ return "This token isn't accepted for deposits";
2111
+ }
2112
+ }
2113
+
1974
2114
  // src/core/public-client.ts
1975
2115
 
1976
2116
  var clientCache = /* @__PURE__ */ new Map();
@@ -2042,7 +2182,7 @@ async function loadViemChains() {
2042
2182
  viemChainsPromise = Promise.resolve().then(() => _interopRequireWildcard(require("viem/chains"))).then((module) => {
2043
2183
  const map = /* @__PURE__ */ new Map();
2044
2184
  for (const value of Object.values(module)) {
2045
- if (value && typeof value === "object" && typeof value.id === "number" && _optionalChain([value, 'access', _71 => _71.rpcUrls, 'optionalAccess', _72 => _72.default, 'optionalAccess', _73 => _73.http, 'optionalAccess', _74 => _74.length])) {
2185
+ if (value && typeof value === "object" && typeof value.id === "number" && _optionalChain([value, 'access', _78 => _78.rpcUrls, 'optionalAccess', _79 => _79.default, 'optionalAccess', _80 => _80.http, 'optionalAccess', _81 => _81.length])) {
2046
2186
  const chain = value;
2047
2187
  const existing = map.get(chain.id);
2048
2188
  if (existing) existing.push(chain);
@@ -2056,7 +2196,7 @@ async function loadViemChains() {
2056
2196
  return viemChainsPromise;
2057
2197
  }
2058
2198
  function pickViemChain(candidates, chain) {
2059
- if (!_optionalChain([candidates, 'optionalAccess', _75 => _75.length])) return void 0;
2199
+ if (!_optionalChain([candidates, 'optionalAccess', _82 => _82.length])) return void 0;
2060
2200
  if (candidates.length === 1) return candidates[0];
2061
2201
  const sameNetworkClass = candidates.filter(
2062
2202
  (candidate) => Boolean(candidate.testnet) === chain.testnet
@@ -2072,10 +2212,10 @@ function pickViemChain(candidates, chain) {
2072
2212
  }
2073
2213
  function resolveRpcUrls(chain, override, viemChains) {
2074
2214
  const urls = [];
2075
- if (_optionalChain([override, 'optionalAccess', _76 => _76.trim, 'call', _77 => _77()])) urls.push(override.trim());
2215
+ if (_optionalChain([override, 'optionalAccess', _83 => _83.trim, 'call', _84 => _84()])) urls.push(override.trim());
2076
2216
  if (chain.publicRpcUrl) urls.push(chain.publicRpcUrl);
2077
2217
  if (chain.chainId !== null && chain.vmType === "evm") {
2078
- const http2 = _optionalChain([pickViemChain, 'call', _78 => _78(_optionalChain([viemChains, 'optionalAccess', _79 => _79.get, 'call', _80 => _80(chain.chainId)]), chain), 'optionalAccess', _81 => _81.rpcUrls, 'optionalAccess', _82 => _82.default, 'optionalAccess', _83 => _83.http]);
2218
+ const http2 = _optionalChain([pickViemChain, 'call', _85 => _85(_optionalChain([viemChains, 'optionalAccess', _86 => _86.get, 'call', _87 => _87(chain.chainId)]), chain), 'optionalAccess', _88 => _88.rpcUrls, 'optionalAccess', _89 => _89.default, 'optionalAccess', _90 => _90.http]);
2079
2219
  if (http2) urls.push(...http2);
2080
2220
  }
2081
2221
  return [...new Set(urls)];
@@ -2084,7 +2224,7 @@ function toViemChain(chain, override, viemChains) {
2084
2224
  if (chain.vmType !== "evm" || chain.chainId === null) return null;
2085
2225
  const rpcUrls = resolveRpcUrls(chain, override, viemChains);
2086
2226
  if (rpcUrls.length === 0) return null;
2087
- const bundled = pickViemChain(_optionalChain([viemChains, 'optionalAccess', _84 => _84.get, 'call', _85 => _85(chain.chainId)]), chain);
2227
+ const bundled = pickViemChain(_optionalChain([viemChains, 'optionalAccess', _91 => _91.get, 'call', _92 => _92(chain.chainId)]), chain);
2088
2228
  if (bundled) {
2089
2229
  if (rpcUrls[0] === bundled.rpcUrls.default.http[0]) return bundled;
2090
2230
  return _viem.defineChain.call(void 0, {
@@ -2115,7 +2255,7 @@ function toViemChains(catalog, overrides, viemChains) {
2115
2255
  for (const entry of catalog.all) {
2116
2256
  const chain = toViemChain(
2117
2257
  entry,
2118
- entry.chainId === null ? void 0 : _optionalChain([overrides, 'optionalAccess', _86 => _86[entry.chainId]]),
2258
+ entry.chainId === null ? void 0 : _optionalChain([overrides, 'optionalAccess', _93 => _93[entry.chainId]]),
2119
2259
  viemChains
2120
2260
  );
2121
2261
  if (chain) chains.push(chain);
@@ -2124,7 +2264,7 @@ function toViemChains(catalog, overrides, viemChains) {
2124
2264
  }
2125
2265
  function needsViemChains(catalog, overrides) {
2126
2266
  return catalog.all.some(
2127
- (chain) => chain.vmType === "evm" && chain.chainId !== null && !chain.publicRpcUrl && !_optionalChain([overrides, 'optionalAccess', _87 => _87[chain.chainId], 'optionalAccess', _88 => _88.trim, 'call', _89 => _89()])
2267
+ (chain) => chain.vmType === "evm" && chain.chainId !== null && !chain.publicRpcUrl && !_optionalChain([overrides, 'optionalAccess', _94 => _94[chain.chainId], 'optionalAccess', _95 => _95.trim, 'call', _96 => _96()])
2128
2268
  );
2129
2269
  }
2130
2270
 
@@ -2135,6 +2275,9 @@ var EMPTY = {
2135
2275
  viemChains: null,
2136
2276
  isLoading: true,
2137
2277
  shortlist: null,
2278
+ depositOptions: { status: "loading" },
2279
+ retryDepositOptions: () => {
2280
+ },
2138
2281
  clientCapableChainIds: null
2139
2282
  };
2140
2283
  var ChainCatalogContext = _react.createContext.call(void 0, EMPTY);
@@ -2200,9 +2343,9 @@ function publishRuntimeChainMeta(catalog) {
2200
2343
  name: chain.name,
2201
2344
  iconUrl: _nullishCoalesce(chain.iconUrl, () => ( void 0)),
2202
2345
  nativeSymbol: chain.nativeToken.symbol,
2203
- explorerUrl: _optionalChain([chain, 'access', _90 => _90.explorer, 'optionalAccess', _91 => _91.url]),
2204
- explorerTxPath: _optionalChain([chain, 'access', _92 => _92.explorer, 'optionalAccess', _93 => _93.txPath]),
2205
- explorerAddressPath: _optionalChain([chain, 'access', _94 => _94.explorer, 'optionalAccess', _95 => _95.addressPath])
2346
+ explorerUrl: _optionalChain([chain, 'access', _97 => _97.explorer, 'optionalAccess', _98 => _98.url]),
2347
+ explorerTxPath: _optionalChain([chain, 'access', _99 => _99.explorer, 'optionalAccess', _100 => _100.txPath]),
2348
+ explorerAddressPath: _optionalChain([chain, 'access', _101 => _101.explorer, 'optionalAccess', _102 => _102.addressPath])
2206
2349
  }));
2207
2350
  })
2208
2351
  );
@@ -2275,7 +2418,7 @@ function useTargetTokens() {
2275
2418
  const { catalog, shortlist } = useChainCatalog();
2276
2419
  return _react.useMemo.call(void 0, () => {
2277
2420
  return (chainId) => {
2278
- const fromShortlist = _optionalChain([shortlist, 'optionalAccess', _96 => _96[String(chainId)]]);
2421
+ const fromShortlist = _optionalChain([shortlist, 'optionalAccess', _103 => _103[String(chainId)]]);
2279
2422
  if (fromShortlist) {
2280
2423
  return fromShortlist.map((token) => ({
2281
2424
  symbol: token.symbol,
@@ -2283,8 +2426,8 @@ function useTargetTokens() {
2283
2426
  decimals: token.decimals
2284
2427
  }));
2285
2428
  }
2286
- const entry = _optionalChain([catalog, 'optionalAccess', _97 => _97.byChainId, 'access', _98 => _98.get, 'call', _99 => _99(chainId)]);
2287
- return Array.isArray(_optionalChain([entry, 'optionalAccess', _100 => _100.supportedTokens])) ? entry.supportedTokens.map((token) => ({
2429
+ const entry = _optionalChain([catalog, 'optionalAccess', _104 => _104.byChainId, 'access', _105 => _105.get, 'call', _106 => _106(chainId)]);
2430
+ return Array.isArray(_optionalChain([entry, 'optionalAccess', _107 => _107.supportedTokens])) ? entry.supportedTokens.map((token) => ({
2288
2431
  symbol: token.symbol,
2289
2432
  address: token.address,
2290
2433
  decimals: token.decimals
@@ -2292,6 +2435,48 @@ function useTargetTokens() {
2292
2435
  };
2293
2436
  }, [catalog, shortlist]);
2294
2437
  }
2438
+ function createDepositOffer(state, retry) {
2439
+ const options = state.status === "ready" ? state.options : null;
2440
+ const restricted = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _108 => _108.restricted]), () => ( false));
2441
+ const listed = (chain) => _optionalChain([options, 'optionalAccess', _109 => _109.tokens, 'access', _110 => _110[String(chain)]]);
2442
+ const isChainOffered = (chain) => {
2443
+ if (!options) return false;
2444
+ const entry = listed(chain);
2445
+ return restricted ? (_nullishCoalesce(_optionalChain([entry, 'optionalAccess', _111 => _111.length]), () => ( 0))) > 0 : _optionalChain([entry, 'optionalAccess', _112 => _112.length]) !== 0;
2446
+ };
2447
+ return {
2448
+ status: state.status,
2449
+ restricted,
2450
+ retry,
2451
+ tokensFor: (chain) => {
2452
+ if (!options) return [];
2453
+ const entry = listed(chain);
2454
+ return restricted ? _nullishCoalesce(entry, () => ( [])) : entry;
2455
+ },
2456
+ isChainOffered
2457
+ };
2458
+ }
2459
+ function useDepositOffer() {
2460
+ const { depositOptions, retryDepositOptions } = useChainCatalog();
2461
+ return _react.useMemo.call(void 0,
2462
+ () => createDepositOffer(depositOptions, retryDepositOptions),
2463
+ [depositOptions, retryDepositOptions]
2464
+ );
2465
+ }
2466
+ function useDepositBounds() {
2467
+ const { depositOptions } = useChainCatalog();
2468
+ return _react.useMemo.call(void 0, () => {
2469
+ const options = depositOptions.status === "ready" ? depositOptions.options : null;
2470
+ return (chain, token) => findDepositBounds(options, chain, token);
2471
+ }, [depositOptions]);
2472
+ }
2473
+ function useRestrictedListExclusion() {
2474
+ const { depositOptions } = useChainCatalog();
2475
+ return _react.useMemo.call(void 0, () => {
2476
+ const options = depositOptions.status === "ready" ? depositOptions.options : null;
2477
+ return (chain, token) => isExcludedByRestrictedList(options, chain, token);
2478
+ }, [depositOptions]);
2479
+ }
2295
2480
  function useIsDepositChain() {
2296
2481
  const ids = useDepositChainIds();
2297
2482
  const { clientCapableChainIds } = useChainCatalog();
@@ -2307,7 +2492,7 @@ function useChainName() {
2307
2492
  if (!catalog) return _chunkOY5N3E6Lcjs.getChainName.call(void 0, chainId);
2308
2493
  const key = catalogKeyForChain(chainId);
2309
2494
  const entry = typeof key === "number" ? catalog.byChainId.get(key) : catalog.byCaip2.get(key);
2310
- return _nullishCoalesce(_optionalChain([entry, 'optionalAccess', _101 => _101.name]), () => ( _chunkOY5N3E6Lcjs.getChainName.call(void 0, chainId)));
2495
+ return _nullishCoalesce(_optionalChain([entry, 'optionalAccess', _113 => _113.name]), () => ( _chunkOY5N3E6Lcjs.getChainName.call(void 0, chainId)));
2311
2496
  };
2312
2497
  }, [catalog]);
2313
2498
  }
@@ -2331,7 +2516,7 @@ function useExplorerTxUrl() {
2331
2516
  return (chainId, txHash) => {
2332
2517
  if (chainId === "hypercore") return _chunkOY5N3E6Lcjs.getExplorerTxUrl.call(void 0, chainId, txHash);
2333
2518
  const key = catalog ? catalogKeyForChain(chainId) : void 0;
2334
- const entry = key === void 0 ? void 0 : typeof key === "number" ? _optionalChain([catalog, 'optionalAccess', _102 => _102.byChainId, 'access', _103 => _103.get, 'call', _104 => _104(key)]) : _optionalChain([catalog, 'optionalAccess', _105 => _105.byCaip2, 'access', _106 => _106.get, 'call', _107 => _107(key)]);
2519
+ const entry = key === void 0 ? void 0 : typeof key === "number" ? _optionalChain([catalog, 'optionalAccess', _114 => _114.byChainId, 'access', _115 => _115.get, 'call', _116 => _116(key)]) : _optionalChain([catalog, 'optionalAccess', _117 => _117.byCaip2, 'access', _118 => _118.get, 'call', _119 => _119(key)]);
2335
2520
  return _nullishCoalesce(catalogExplorerTxUrl(entry, txHash), () => ( _chunkOY5N3E6Lcjs.getExplorerTxUrl.call(void 0, chainId, txHash)));
2336
2521
  };
2337
2522
  }, [catalog]);
@@ -2384,19 +2569,36 @@ function ChainCatalogProvider({
2384
2569
  const chains = toViemChains(catalog, overrides, viemChains);
2385
2570
  if (chains.length > 0) setRuntimeChains(chains);
2386
2571
  }, [catalog, viemChains, overrides]);
2387
- const [shortlist, setShortlist] = _react.useState.call(void 0, null);
2572
+ const [depositOptions, setDepositOptions] = _react.useState.call(void 0, {
2573
+ status: "loading"
2574
+ });
2575
+ const [depositOptionsAttempt, setDepositOptionsAttempt] = _react.useState.call(void 0, 0);
2388
2576
  _react.useEffect.call(void 0, () => {
2389
2577
  let active = true;
2390
- setShortlist(null);
2391
- service.getTopTokens().then((tokens) => {
2392
- if (!active || !tokens) return;
2393
- _chunkOY5N3E6Lcjs.publishShortlistTokens.call(void 0, tokens);
2394
- setShortlist(tokens);
2395
- });
2578
+ setDepositOptions({ status: "loading" });
2579
+ service.getTopTokens().then(
2580
+ (result) => {
2581
+ if (!active) return;
2582
+ if (!_optionalChain([result, 'optionalAccess', _120 => _120.ok])) {
2583
+ setDepositOptions({ status: "error" });
2584
+ return;
2585
+ }
2586
+ _chunkOY5N3E6Lcjs.publishShortlistTokens.call(void 0, result.options.tokens);
2587
+ setDepositOptions({ status: "ready", options: result.options });
2588
+ },
2589
+ () => {
2590
+ if (active) setDepositOptions({ status: "error" });
2591
+ }
2592
+ );
2396
2593
  return () => {
2397
2594
  active = false;
2398
2595
  };
2399
- }, [service]);
2596
+ }, [service, depositOptionsAttempt]);
2597
+ const retryDepositOptions = _react.useCallback.call(void 0,
2598
+ () => setDepositOptionsAttempt((attempt) => attempt + 1),
2599
+ []
2600
+ );
2601
+ const shortlist = depositOptions.status === "ready" ? depositOptions.options.tokens : null;
2400
2602
  const clientCapableChainIds = _react.useMemo.call(void 0, () => {
2401
2603
  if (!catalog) return null;
2402
2604
  return new Set(
@@ -2409,9 +2611,19 @@ function ChainCatalogProvider({
2409
2611
  viemChains,
2410
2612
  isLoading,
2411
2613
  shortlist,
2614
+ depositOptions,
2615
+ retryDepositOptions,
2412
2616
  clientCapableChainIds
2413
2617
  }),
2414
- [catalog, viemChains, isLoading, shortlist, clientCapableChainIds]
2618
+ [
2619
+ catalog,
2620
+ viemChains,
2621
+ isLoading,
2622
+ shortlist,
2623
+ depositOptions,
2624
+ retryDepositOptions,
2625
+ clientCapableChainIds
2626
+ ]
2415
2627
  );
2416
2628
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChainCatalogContext.Provider, { value, children });
2417
2629
  }
@@ -2492,7 +2704,7 @@ function createIngestTransport(options) {
2492
2704
  function report(reason, status) {
2493
2705
  try {
2494
2706
  onFailure({ reason, status, droppedEvents: dropped });
2495
- } catch (e5) {
2707
+ } catch (e6) {
2496
2708
  }
2497
2709
  }
2498
2710
  function drop(batch, reason, status) {
@@ -2546,10 +2758,10 @@ function createIngestTransport(options) {
2546
2758
  }
2547
2759
  function interruptForUnload() {
2548
2760
  for (const wake of [...sleepers]) wake();
2549
- _optionalChain([mintAbort, 'optionalAccess', _108 => _108.abort, 'call', _109 => _109()]);
2761
+ _optionalChain([mintAbort, 'optionalAccess', _121 => _121.abort, 'call', _122 => _122()]);
2550
2762
  }
2551
2763
  function retryDelay(response, attempt) {
2552
- const seconds = Number(_optionalChain([response, 'access', _110 => _110.headers, 'optionalAccess', _111 => _111.get, 'optionalCall', _112 => _112("Retry-After")]));
2764
+ const seconds = Number(_optionalChain([response, 'access', _123 => _123.headers, 'optionalAccess', _124 => _124.get, 'optionalCall', _125 => _125("Retry-After")]));
2553
2765
  if (Number.isFinite(seconds) && seconds > 0) {
2554
2766
  return Math.min(seconds * 1e3, MAX_BACKOFF_MS);
2555
2767
  }
@@ -2564,10 +2776,10 @@ function createIngestTransport(options) {
2564
2776
  try {
2565
2777
  response = await fetchImpl(mintUrl, {
2566
2778
  method: "POST",
2567
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
2568
- signal: _optionalChain([controller, 'optionalAccess', _113 => _113.signal])
2779
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
2780
+ signal: _optionalChain([controller, 'optionalAccess', _126 => _126.signal])
2569
2781
  });
2570
- } catch (e6) {
2782
+ } catch (e7) {
2571
2783
  if (urgency !== DISMISSAL) {
2572
2784
  mintFailures += 1;
2573
2785
  mintBackoffUntil = now() + backoff(mintFailures);
@@ -2595,7 +2807,7 @@ function createIngestTransport(options) {
2595
2807
  token = { value, expiresAt };
2596
2808
  mintFailures = 0;
2597
2809
  mintBackoffUntil = 0;
2598
- } catch (e7) {
2810
+ } catch (e8) {
2599
2811
  mintUnavailable = true;
2600
2812
  report("token_unavailable", response.status);
2601
2813
  }
@@ -2635,7 +2847,7 @@ function createIngestTransport(options) {
2635
2847
  body: bodyOf(batch),
2636
2848
  keepalive: true
2637
2849
  });
2638
- } catch (e8) {
2850
+ } catch (e9) {
2639
2851
  if (terminal || attempt >= MAX_ATTEMPTS) {
2640
2852
  return drop(batch, "network");
2641
2853
  }
@@ -2740,7 +2952,7 @@ function createIngestTransport(options) {
2740
2952
  }
2741
2953
  },
2742
2954
  flush(flushOptions) {
2743
- const dismissal = _nullishCoalesce(_optionalChain([flushOptions, 'optionalAccess', _114 => _114.terminal]), () => ( false));
2955
+ const dismissal = _nullishCoalesce(_optionalChain([flushOptions, 'optionalAccess', _127 => _127.terminal]), () => ( false));
2744
2956
  if (disposed && !dismissal) return;
2745
2957
  clearFlushTimer();
2746
2958
  void run(dismissal ? DISMISSAL : IDLE);
@@ -2755,11 +2967,11 @@ function createIngestTransport(options) {
2755
2967
  };
2756
2968
  }
2757
2969
  function randomUuid() {
2758
- if (typeof _optionalChain([globalThis, 'access', _115 => _115.crypto, 'optionalAccess', _116 => _116.randomUUID]) === "function") {
2970
+ if (typeof _optionalChain([globalThis, 'access', _128 => _128.crypto, 'optionalAccess', _129 => _129.randomUUID]) === "function") {
2759
2971
  return globalThis.crypto.randomUUID();
2760
2972
  }
2761
2973
  const bytes = new Uint8Array(16);
2762
- _optionalChain([globalThis, 'access', _117 => _117.crypto, 'optionalAccess', _118 => _118.getRandomValues, 'optionalCall', _119 => _119(bytes)]);
2974
+ _optionalChain([globalThis, 'access', _130 => _130.crypto, 'optionalAccess', _131 => _131.getRandomValues, 'optionalCall', _132 => _132(bytes)]);
2763
2975
  if (!bytes.some(Boolean)) {
2764
2976
  for (let index = 0; index < bytes.length; index += 1) {
2765
2977
  bytes[index] = Math.floor(Math.random() * 256);
@@ -2773,9 +2985,9 @@ function randomUuid() {
2773
2985
  function resolveProxyOrigin(backendUrl) {
2774
2986
  if (!backendUrl.trim()) return null;
2775
2987
  try {
2776
- const { origin } = new URL(backendUrl, _optionalChain([globalThis, 'access', _120 => _120.location, 'optionalAccess', _121 => _121.href]));
2988
+ const { origin } = new URL(backendUrl, _optionalChain([globalThis, 'access', _133 => _133.location, 'optionalAccess', _134 => _134.href]));
2777
2989
  return origin.startsWith("http") ? origin : null;
2778
- } catch (e9) {
2990
+ } catch (e10) {
2779
2991
  return null;
2780
2992
  }
2781
2993
  }
@@ -2825,13 +3037,13 @@ function AnalyticsSession(props) {
2825
3037
  type: "analytics_ingest_failure",
2826
3038
  session_id: sessionIdRef.current,
2827
3039
  modal,
2828
- widget_version: _chunkJCWJ6HW7cjs.MODAL_VERSION,
3040
+ widget_version: _chunkPYOC6K24cjs.MODAL_VERSION,
2829
3041
  timestamp: nowRef.current().toISOString(),
2830
3042
  reason,
2831
3043
  ...status === void 0 ? {} : { status },
2832
3044
  dropped_events: droppedEvents
2833
3045
  };
2834
- _optionalChain([onEventRef, 'access', _122 => _122.current, 'optionalCall', _123 => _123(event)]);
3046
+ _optionalChain([onEventRef, 'access', _135 => _135.current, 'optionalCall', _136 => _136(event)]);
2835
3047
  },
2836
3048
  [modal]
2837
3049
  );
@@ -2853,7 +3065,7 @@ function AnalyticsSession(props) {
2853
3065
  proxyOrigin,
2854
3066
  sessionId: sessionIdRef.current,
2855
3067
  modal,
2856
- widgetVersion: _chunkJCWJ6HW7cjs.MODAL_VERSION,
3068
+ widgetVersion: _chunkPYOC6K24cjs.MODAL_VERSION,
2857
3069
  sessionProperties: sessionPropertiesRef.current,
2858
3070
  onFailure: (failure) => emitFailure(failure),
2859
3071
  fetchImpl: props.fetchImpl,
@@ -2870,10 +3082,10 @@ function AnalyticsSession(props) {
2870
3082
  const enqueue = _react.useCallback.call(void 0,
2871
3083
  (event) => {
2872
3084
  try {
2873
- _optionalChain([ingestRef, 'access', _124 => _124.current, 'optionalAccess', _125 => _125.transport, 'optionalAccess', _126 => _126.enqueue, 'call', _127 => _127(
3085
+ _optionalChain([ingestRef, 'access', _137 => _137.current, 'optionalAccess', _138 => _138.transport, 'optionalAccess', _139 => _139.enqueue, 'call', _140 => _140(
2874
3086
  event
2875
3087
  )]);
2876
- } catch (e10) {
3088
+ } catch (e11) {
2877
3089
  }
2878
3090
  },
2879
3091
  []
@@ -2909,12 +3121,12 @@ function AnalyticsSession(props) {
2909
3121
  ...payload,
2910
3122
  session_id: sessionIdRef.current,
2911
3123
  modal,
2912
- widget_version: _chunkJCWJ6HW7cjs.MODAL_VERSION,
3124
+ widget_version: _chunkPYOC6K24cjs.MODAL_VERSION,
2913
3125
  timestamp: nowRef.current().toISOString(),
2914
3126
  session_properties: sessionPropertiesRef.current,
2915
3127
  funding_method: fundingMethod
2916
3128
  };
2917
- _optionalChain([onEventRef, 'access', _128 => _128.current, 'optionalCall', _129 => _129(
3129
+ _optionalChain([onEventRef, 'access', _141 => _141.current, 'optionalCall', _142 => _142(
2918
3130
  event
2919
3131
  )]);
2920
3132
  enqueue(event);
@@ -2928,11 +3140,11 @@ function AnalyticsSession(props) {
2928
3140
  ...payload,
2929
3141
  session_id: sessionIdRef.current,
2930
3142
  modal,
2931
- widget_version: _chunkJCWJ6HW7cjs.MODAL_VERSION,
3143
+ widget_version: _chunkPYOC6K24cjs.MODAL_VERSION,
2932
3144
  timestamp: nowRef.current().toISOString(),
2933
3145
  session_properties: sessionPropertiesRef.current
2934
3146
  };
2935
- _optionalChain([onEventRef, 'access', _130 => _130.current, 'optionalCall', _131 => _131(event)]);
3147
+ _optionalChain([onEventRef, 'access', _143 => _143.current, 'optionalCall', _144 => _144(event)]);
2936
3148
  enqueue(event);
2937
3149
  },
2938
3150
  [enqueue, modal, nowRef, onEventRef]
@@ -2944,11 +3156,11 @@ function AnalyticsSession(props) {
2944
3156
  ...payload,
2945
3157
  session_id: sessionIdRef.current,
2946
3158
  modal,
2947
- widget_version: _chunkJCWJ6HW7cjs.MODAL_VERSION,
3159
+ widget_version: _chunkPYOC6K24cjs.MODAL_VERSION,
2948
3160
  timestamp: nowRef.current().toISOString(),
2949
3161
  session_properties: sessionPropertiesRef.current
2950
3162
  };
2951
- _optionalChain([onEventRef, 'access', _132 => _132.current, 'optionalCall', _133 => _133(event)]);
3163
+ _optionalChain([onEventRef, 'access', _145 => _145.current, 'optionalCall', _146 => _146(event)]);
2952
3164
  enqueue(event);
2953
3165
  },
2954
3166
  [enqueue, modal, nowRef, onEventRef]
@@ -2999,6 +3211,7 @@ function toRecoverableDeposit(row, options = {}) {
2999
3211
  depositId: row.id,
3000
3212
  signer,
3001
3213
  destinationPrefill: signer,
3214
+ depositAddress: row.depositAddress,
3002
3215
  sourceChainId,
3003
3216
  targetChainId,
3004
3217
  token: row.token,
@@ -3006,22 +3219,49 @@ function toRecoverableDeposit(row, options = {}) {
3006
3219
  sourceTxHash: sourceDepositTxHash(row)
3007
3220
  };
3008
3221
  }
3222
+ function isDepositSelfDestination(row, destination) {
3223
+ const depositAddress = _optionalChain([row, 'access', _147 => _147.depositAddress, 'optionalAccess', _148 => _148.trim, 'call', _149 => _149()]);
3224
+ const candidate = destination.trim();
3225
+ if (!depositAddress || !candidate) return false;
3226
+ return depositAddress.toLowerCase() === candidate.toLowerCase();
3227
+ }
3009
3228
  function recoveryFailureCause(sourceChainName) {
3010
3229
  return sourceChainName ? `This deposit couldn't be completed. Your funds are still on ${sourceChainName}.` : "This deposit couldn't be completed and your funds were not moved.";
3011
3230
  }
3012
3231
 
3013
3232
  // src/core/history-status.ts
3014
- function normalizeStatus(raw, isSpam) {
3233
+ var UNKNOWN = ["pending", false, []];
3234
+ var STATUS_FACTS = [
3235
+ // `delayed` is held up but still coming on the corridor's schedule.
3236
+ ["pending", true, ["pending", "delayed"]],
3237
+ // Nothing emits `submitted` or `bridging`; they are here so the badge and
3238
+ // the arrival line cannot diverge should a row ever carry them.
3239
+ ["processing", true, ["processing", "submitted", "bridging"]],
3240
+ ["completed", false, ["completed", "complete", "bridge-complete", "processed"]],
3241
+ // `rejected` is recoverable upstream exactly like `failed`, so it must not
3242
+ // read as Pending — a row offering recovery would otherwise claim to still
3243
+ // be on its way.
3244
+ ["failed", false, ["failed", "error", "bridge-failed", "rejected"]],
3245
+ // Where a recovered deposit lands. Terminal and not recoverable again.
3246
+ ["refunded", false, ["refunded"]],
3247
+ // These read Pending but are not arriving: the deposit is bound for a refund
3248
+ // or for manual reconciliation rather than for the recipient, so an arrival
3249
+ // expectation would be a claim about a corridor it never enters.
3250
+ ["pending", false, ["ignored", "expecting_refund", "reconciliation_required"]]
3251
+ ];
3252
+ function lookup(raw) {
3015
3253
  const lower = raw.toLowerCase();
3016
- if (lower === "completed" || lower === "complete" || lower === "bridge-complete" || lower === "processed")
3017
- return "completed";
3018
- if (lower === "failed" || lower === "error" || lower === "bridge-failed" || lower === "rejected") {
3019
- return isSpam ? "spam" : "failed";
3020
- }
3021
- if (lower === "refunded") return "refunded";
3022
- if (lower === "processing" || lower === "submitted" || lower === "bridging")
3023
- return "processing";
3024
- return "pending";
3254
+ return _nullishCoalesce(STATUS_FACTS.find((facts) => facts[2].includes(lower)), () => ( UNKNOWN));
3255
+ }
3256
+ function normalizeStatus(raw, isSpam) {
3257
+ const [badge] = lookup(raw);
3258
+ return isSpam && badge === "failed" ? "spam" : badge;
3259
+ }
3260
+ function isInFlight(status) {
3261
+ return status === "pending" || status === "processing";
3262
+ }
3263
+ function expectsArrival(raw) {
3264
+ return lookup(raw)[1];
3025
3265
  }
3026
3266
  var STATUS_LABEL = {
3027
3267
  pending: "Pending",
@@ -3033,7 +3273,7 @@ var STATUS_LABEL = {
3033
3273
  };
3034
3274
  function filterVisibleDeposits(deposits) {
3035
3275
  const sourceHashes = new Set(
3036
- deposits.map((d) => _optionalChain([d, 'access', _134 => _134.sourceTxHash, 'optionalAccess', _135 => _135.toLowerCase, 'call', _136 => _136()])).filter((h) => Boolean(h))
3276
+ deposits.map((d) => _optionalChain([d, 'access', _150 => _150.sourceTxHash, 'optionalAccess', _151 => _151.toLowerCase, 'call', _152 => _152()])).filter((h) => Boolean(h))
3037
3277
  );
3038
3278
  return deposits.filter(
3039
3279
  (d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
@@ -3041,20 +3281,37 @@ function filterVisibleDeposits(deposits) {
3041
3281
  }
3042
3282
 
3043
3283
  // src/core/history-badge.ts
3044
- function deriveHistoryBadge(deposits, { recipient, canRecover }) {
3284
+ var RECOVERY_INDICATOR_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
3285
+ function deriveHistoryBadgeState(deposits, {
3286
+ recipient,
3287
+ canRecover,
3288
+ evaluatedAt = Date.now()
3289
+ }) {
3045
3290
  const visible = filterVisibleDeposits(deposits);
3046
3291
  if (canRecover) {
3047
- const needsYou = visible.filter(
3048
- (row) => toRecoverableDeposit(row, { recipient }) !== null
3049
- ).length;
3050
- if (needsYou > 0) return { state: "needs-you", count: needsYou };
3051
- }
3052
- const inProgress = visible.filter((row) => {
3053
- const status = normalizeStatus(row.status, row.isSpam);
3054
- return status === "pending" || status === "processing";
3055
- }).length;
3056
- if (inProgress > 0) return { state: "progress", count: inProgress };
3057
- return null;
3292
+ let count = 0;
3293
+ let nextExpiryAt = null;
3294
+ for (const row of visible) {
3295
+ if (toRecoverableDeposit(row, { recipient }) === null) continue;
3296
+ const expiryAt = Date.parse(_nullishCoalesce(row.createdAt, () => ( ""))) + RECOVERY_INDICATOR_WINDOW_MS;
3297
+ if (!(evaluatedAt < expiryAt)) continue;
3298
+ count += 1;
3299
+ nextExpiryAt = nextExpiryAt === null ? expiryAt : Math.min(nextExpiryAt, expiryAt);
3300
+ }
3301
+ if (count > 0) {
3302
+ return {
3303
+ badge: { state: "needs-you", count },
3304
+ nextExpiryAt
3305
+ };
3306
+ }
3307
+ }
3308
+ const inProgress = visible.filter(
3309
+ (row) => isInFlight(normalizeStatus(row.status, row.isSpam))
3310
+ ).length;
3311
+ return {
3312
+ badge: inProgress > 0 ? { state: "progress", count: inProgress } : null,
3313
+ nextExpiryAt: null
3314
+ };
3058
3315
  }
3059
3316
  function historyBadgeAriaLabel(badge) {
3060
3317
  if (!badge) return "Deposit history";
@@ -3134,7 +3391,7 @@ function CdnIcon({
3134
3391
  }
3135
3392
  const isLoading = loadedSrc !== src;
3136
3393
  const settleIfAlreadyComplete = (el) => {
3137
- if (_optionalChain([el, 'optionalAccess', _137 => _137.complete])) setLoadedSrc(src);
3394
+ if (_optionalChain([el, 'optionalAccess', _153 => _153.complete])) setLoadedSrc(src);
3138
3395
  };
3139
3396
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3140
3397
  "img",
@@ -3428,14 +3685,13 @@ function advancePendingTimingState(previous, next) {
3428
3685
  }
3429
3686
 
3430
3687
  // src/core/history-timing.ts
3431
- var TIMED_HISTORY_STATUSES = /* @__PURE__ */ new Set(["pending", "processing", "delayed"]);
3432
3688
  function resolveHistoryTiming({
3433
3689
  status,
3434
3690
  timing,
3435
3691
  createdAt,
3436
3692
  nowMs
3437
3693
  }) {
3438
- if (!TIMED_HISTORY_STATUSES.has(status) || !timing || !createdAt) {
3694
+ if (!expectsArrival(status) || !timing || !createdAt) {
3439
3695
  return void 0;
3440
3696
  }
3441
3697
  const createdAtMs = Date.parse(createdAt);
@@ -3467,7 +3723,7 @@ function formatDate(iso) {
3467
3723
  month: "short",
3468
3724
  year: "numeric"
3469
3725
  });
3470
- } catch (e11) {
3726
+ } catch (e12) {
3471
3727
  return iso;
3472
3728
  }
3473
3729
  }
@@ -3534,7 +3790,7 @@ function formatAmount(rawAmount, token, chainId) {
3534
3790
  let frac = fracStr.slice(0, 5).replace(/0+$/, "");
3535
3791
  if (frac.length < 2) frac = frac.padEnd(2, "0");
3536
3792
  return `${whole}.${frac}`;
3537
- } catch (e12) {
3793
+ } catch (e13) {
3538
3794
  return rawAmount;
3539
3795
  }
3540
3796
  }
@@ -3557,7 +3813,7 @@ function DepositHistoryPanel({
3557
3813
  }) {
3558
3814
  const rootRef = _react.useRef.call(void 0, null);
3559
3815
  _react.useEffect.call(void 0, () => {
3560
- _optionalChain([rootRef, 'access', _138 => _138.current, 'optionalAccess', _139 => _139.toggleAttribute, 'call', _140 => _140("inert", Boolean(obscured))]);
3816
+ _optionalChain([rootRef, 'access', _154 => _154.current, 'optionalAccess', _155 => _155.toggleAttribute, 'call', _156 => _156("inert", Boolean(obscured))]);
3561
3817
  }, [obscured]);
3562
3818
  const handleKeyDown = _react.useCallback.call(void 0,
3563
3819
  (e) => {
@@ -3591,7 +3847,7 @@ function DepositHistoryPanel({
3591
3847
  _react.useEffect.call(void 0, () => {
3592
3848
  const nextBoundary = timingPresentations.reduce(
3593
3849
  (earliest, presentation) => {
3594
- const next = _optionalChain([presentation, 'optionalAccess', _141 => _141.nextTransitionAtMs]);
3850
+ const next = _optionalChain([presentation, 'optionalAccess', _157 => _157.nextTransitionAtMs]);
3595
3851
  if (next === void 0) return earliest;
3596
3852
  return earliest === void 0 || next < earliest ? next : earliest;
3597
3853
  },
@@ -3753,7 +4009,7 @@ function HistoryCard({
3753
4009
  setExpanded(next);
3754
4010
  const depositId = _nullishCoalesce(deposit.id, () => ( deposit.txHash));
3755
4011
  if (!next || !depositId) return;
3756
- _optionalChain([onRowView, 'optionalCall', _142 => _142({
4012
+ _optionalChain([onRowView, 'optionalCall', _158 => _158({
3757
4013
  depositId,
3758
4014
  status,
3759
4015
  recoverable: eligible !== null,
@@ -3840,7 +4096,7 @@ function HistoryCard({
3840
4096
  recoverable && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3841
4097
  Button,
3842
4098
  {
3843
- onClick: () => _optionalChain([onRecover, 'optionalCall', _143 => _143(recoverable)]),
4099
+ onClick: () => _optionalChain([onRecover, 'optionalCall', _159 => _159(recoverable)]),
3844
4100
  fullWidth: true,
3845
4101
  className: "rs-history-card-recover",
3846
4102
  children: [
@@ -3905,7 +4161,7 @@ function ListRow({
3905
4161
  if (disabled) return;
3906
4162
  if (e.key === "Enter" || e.key === " ") {
3907
4163
  e.preventDefault();
3908
- _optionalChain([onClick, 'optionalCall', _144 => _144(e)]);
4164
+ _optionalChain([onClick, 'optionalCall', _160 => _160(e)]);
3909
4165
  }
3910
4166
  };
3911
4167
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -3915,7 +4171,7 @@ function ListRow({
3915
4171
  role: "button",
3916
4172
  tabIndex: disabled ? -1 : 0,
3917
4173
  "aria-disabled": disabled || void 0,
3918
- onClick: disabled ? void 0 : (e) => _optionalChain([onClick, 'optionalCall', _145 => _145(e)]),
4174
+ onClick: disabled ? void 0 : (e) => _optionalChain([onClick, 'optionalCall', _161 => _161(e)]),
3919
4175
  onKeyDown: handleKey,
3920
4176
  children: inner
3921
4177
  }
@@ -3973,7 +4229,7 @@ var RECOVERY_LOOKUP_MISS_COPY = {
3973
4229
  };
3974
4230
  function classifyRecoveryLookup(rows, options = {}) {
3975
4231
  const inScope = options.recipient ? rows.filter(
3976
- (row) => _optionalChain([row, 'access', _146 => _146.recipient, 'optionalAccess', _147 => _147.toLowerCase, 'call', _148 => _148()]) === _optionalChain([options, 'access', _149 => _149.recipient, 'optionalAccess', _150 => _150.toLowerCase, 'call', _151 => _151()])
4232
+ (row) => _optionalChain([row, 'access', _162 => _162.recipient, 'optionalAccess', _163 => _163.toLowerCase, 'call', _164 => _164()]) === _optionalChain([options, 'access', _165 => _165.recipient, 'optionalAccess', _166 => _166.toLowerCase, 'call', _167 => _167()])
3977
4233
  ) : rows;
3978
4234
  const eligible = inScope.map((row) => toRecoverableDeposit(row, options)).filter((deposit) => deposit !== null);
3979
4235
  return {
@@ -4001,7 +4257,7 @@ function RecoveryLookupScreen({
4001
4257
  const valid = isRecoveryTxHash(trimmed);
4002
4258
  _react.useEffect.call(void 0, () => {
4003
4259
  if (trimmed.length > 0 && !valid) {
4004
- _optionalChain([onInvalidRef, 'access', _152 => _152.current, 'optionalCall', _153 => _153()]);
4260
+ _optionalChain([onInvalidRef, 'access', _168 => _168.current, 'optionalCall', _169 => _169()]);
4005
4261
  }
4006
4262
  }, [trimmed, valid, onInvalidRef]);
4007
4263
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
@@ -4086,15 +4342,15 @@ function resolveTokenDisplay(token, chain, fallback) {
4086
4342
  const decimals = _chunkOY5N3E6Lcjs.findTokenDecimals.call(void 0, token, chain);
4087
4343
  if (symbol !== "Token" || decimals !== void 0) {
4088
4344
  return {
4089
- symbol: symbol !== "Token" ? symbol : _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _154 => _154.symbol]), () => ( symbol)),
4090
- decimals: _nullishCoalesce(decimals, () => ( _optionalChain([fallback, 'optionalAccess', _155 => _155.decimals])))
4345
+ symbol: symbol !== "Token" ? symbol : _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _170 => _170.symbol]), () => ( symbol)),
4346
+ decimals: _nullishCoalesce(decimals, () => ( _optionalChain([fallback, 'optionalAccess', _171 => _171.decimals])))
4091
4347
  };
4092
4348
  }
4093
4349
  }
4094
4350
  }
4095
4351
  return {
4096
- symbol: _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _156 => _156.symbol]), () => ( "Token")),
4097
- decimals: _optionalChain([fallback, 'optionalAccess', _157 => _157.decimals])
4352
+ symbol: _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _172 => _172.symbol]), () => ( "Token")),
4353
+ decimals: _optionalChain([fallback, 'optionalAccess', _173 => _173.decimals])
4098
4354
  };
4099
4355
  }
4100
4356
  function maxFractionDigitsFor(symbol) {
@@ -4113,7 +4369,7 @@ function tokenAmountToNumber(rawAmount, decimals) {
4113
4369
  try {
4114
4370
  const value = Number(_viem.formatUnits.call(void 0, BigInt(rawAmount), decimals));
4115
4371
  return Number.isFinite(value) ? value : void 0;
4116
- } catch (e13) {
4372
+ } catch (e14) {
4117
4373
  return void 0;
4118
4374
  }
4119
4375
  }
@@ -4171,7 +4427,7 @@ function formatQuotedReceive(output, fallbackSymbol) {
4171
4427
  let raw;
4172
4428
  try {
4173
4429
  raw = BigInt(output.amount);
4174
- } catch (e14) {
4430
+ } catch (e15) {
4175
4431
  return void 0;
4176
4432
  }
4177
4433
  if (raw <= 0n) return void 0;
@@ -4214,7 +4470,7 @@ function formatRecoveryAmount(amountRaw, decimals, symbol) {
4214
4470
  function toBigInt(value) {
4215
4471
  try {
4216
4472
  return BigInt(value || "0");
4217
- } catch (e15) {
4473
+ } catch (e16) {
4218
4474
  return 0n;
4219
4475
  }
4220
4476
  }
@@ -4348,7 +4604,7 @@ async function submitSignedRecovery(params) {
4348
4604
  // The shared const, so recovery carries `x-deposit-modal-version` like
4349
4605
  // every other backend call. Without it this path would be invisible in the
4350
4606
  // per-client version telemetry the processor records.
4351
- headers: _chunkJCWJ6HW7cjs.serviceHeaders.call(void 0, ),
4607
+ headers: _chunkPYOC6K24cjs.serviceHeaders.call(void 0, ),
4352
4608
  // `depositId` as a string: it is a uint256 upstream and JSON numbers lose
4353
4609
  // precision well before that range.
4354
4610
  body: JSON.stringify({ depositId, destination, signature })
@@ -4707,7 +4963,7 @@ function HistoryFallbackFlow({
4707
4963
  },
4708
4964
  [analytics]
4709
4965
  );
4710
- const lookup = _react.useCallback.call(void 0,
4966
+ const lookup2 = _react.useCallback.call(void 0,
4711
4967
  async (txHash) => {
4712
4968
  const epoch = epochRef.current;
4713
4969
  const isCurrentLookup = () => epochRef.current === epoch;
@@ -4837,7 +5093,7 @@ function HistoryFallbackFlow({
4837
5093
  hint: "The transaction hash from the wallet or exchange you sent from.",
4838
5094
  loading,
4839
5095
  error,
4840
- onSubmit: lookup,
5096
+ onSubmit: lookup2,
4841
5097
  onInvalid: () => analytics.friction("lookup_transaction_hash_invalid", "lookup")
4842
5098
  }
4843
5099
  )
@@ -4927,9 +5183,11 @@ function RecoveryReviewScreen({
4927
5183
  txHash,
4928
5184
  defaultDestination,
4929
5185
  destinationHint,
5186
+ depositAddress,
4930
5187
  submitting,
4931
5188
  onSubmit,
4932
- onDestinationInvalid
5189
+ onDestinationInvalid,
5190
+ onDestinationIsDepositAddress
4933
5191
  }) {
4934
5192
  const { symbol, amount, chainName, chainIcon } = describeRecoveryDeposit({
4935
5193
  chainId,
@@ -4940,13 +5198,30 @@ function RecoveryReviewScreen({
4940
5198
  const [destination, setDestination] = _react.useState.call(void 0,
4941
5199
  _nullishCoalesce(defaultDestination, () => ( ""))
4942
5200
  );
4943
- const destinationValid = _viem.isAddress.call(void 0, destination);
5201
+ const isSelfDestination = isDepositSelfDestination(
5202
+ { depositAddress },
5203
+ destination
5204
+ );
5205
+ const destinationValid = _viem.isAddress.call(void 0, destination) && !isSelfDestination;
4944
5206
  const onDestinationInvalidRef = useLatestRef(onDestinationInvalid);
5207
+ const onDestinationIsDepositAddressRef = useLatestRef(
5208
+ onDestinationIsDepositAddress
5209
+ );
4945
5210
  _react.useEffect.call(void 0, () => {
4946
- if (destination.length > 0 && !destinationValid) {
4947
- _optionalChain([onDestinationInvalidRef, 'access', _158 => _158.current, 'optionalCall', _159 => _159()]);
5211
+ if (destination.length === 0) return;
5212
+ if (isSelfDestination) {
5213
+ _optionalChain([onDestinationIsDepositAddressRef, 'access', _174 => _174.current, 'optionalCall', _175 => _175()]);
5214
+ } else if (!destinationValid) {
5215
+ _optionalChain([onDestinationInvalidRef, 'access', _176 => _176.current, 'optionalCall', _177 => _177()]);
4948
5216
  }
4949
- }, [destination, destinationValid, onDestinationInvalidRef]);
5217
+ }, [
5218
+ destination,
5219
+ destinationValid,
5220
+ isSelfDestination,
5221
+ onDestinationInvalidRef,
5222
+ onDestinationIsDepositAddressRef
5223
+ ]);
5224
+ const selfDestinationError = `${shortenAddress(destination)} is this deposit's own address. Enter a different address.`;
4950
5225
  const txUrl = txHash ? explorerTxUrl(chainId, txHash) : null;
4951
5226
  const txShort = txHash ? shortenHash2(txHash) : "\u2014";
4952
5227
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
@@ -5003,7 +5278,7 @@ function RecoveryReviewScreen({
5003
5278
  value: destination,
5004
5279
  onChange: (e) => setDestination(e.target.value),
5005
5280
  hint: destinationHint,
5006
- error: destination.length > 0 && !destinationValid ? "Enter a valid address" : void 0
5281
+ error: isSelfDestination ? selfDestinationError : destination.length > 0 && !destinationValid ? "Enter a valid address" : void 0
5007
5282
  }
5008
5283
  ),
5009
5284
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -5102,11 +5377,11 @@ function HistoryRecoveryFlow({
5102
5377
  } catch (err) {
5103
5378
  const recoveryError = err instanceof RecoveryError ? err : void 0;
5104
5379
  setError(
5105
- _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _160 => _160.message]), () => ( formatUserError(
5380
+ _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _178 => _178.message]), () => ( formatUserError(
5106
5381
  err instanceof Error ? err.message : "Recovery failed"
5107
5382
  )))
5108
5383
  );
5109
- const canRetry = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _161 => _161.retryable]), () => ( true));
5384
+ const canRetry = _nullishCoalesce(_optionalChain([recoveryError, 'optionalAccess', _179 => _179.retryable]), () => ( true));
5110
5385
  setRetryable(canRetry);
5111
5386
  setPhase("failed");
5112
5387
  const reason = claimFailureReasonForError(err);
@@ -5181,9 +5456,14 @@ function HistoryRecoveryFlow({
5181
5456
  txHash: deposit.sourceTxHash,
5182
5457
  defaultDestination: deposit.destinationPrefill,
5183
5458
  destinationHint: "Prefilled with the account this deposit was for. Editable.",
5459
+ depositAddress: deposit.depositAddress,
5184
5460
  submitting,
5185
5461
  onSubmit: submit,
5186
- onDestinationInvalid: () => analytics.friction("refund_destination_invalid", "review")
5462
+ onDestinationInvalid: () => analytics.friction("refund_destination_invalid", "review"),
5463
+ onDestinationIsDepositAddress: () => analytics.friction(
5464
+ "refund_destination_is_deposit_address",
5465
+ "review"
5466
+ )
5187
5467
  }
5188
5468
  ),
5189
5469
  phase === "success" && outcome && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -5247,8 +5527,8 @@ function HistoryOverlay({
5247
5527
  const endAttempt = _react.useCallback.call(void 0,
5248
5528
  (source, reason) => {
5249
5529
  const claim = claimControllerRef.current;
5250
- _optionalChain([claim, 'optionalAccess', _162 => _162.abandon, 'call', _163 => _163(reason)]);
5251
- _optionalChain([claim, 'optionalAccess', _164 => _164.close, 'call', _165 => _165(source)]);
5530
+ _optionalChain([claim, 'optionalAccess', _180 => _180.abandon, 'call', _181 => _181(reason)]);
5531
+ _optionalChain([claim, 'optionalAccess', _182 => _182.close, 'call', _183 => _183(source)]);
5252
5532
  claimControllerRef.current = null;
5253
5533
  setAttempt(null);
5254
5534
  },
@@ -5306,8 +5586,8 @@ function HistoryOverlay({
5306
5586
  if (!attempt) return;
5307
5587
  return () => {
5308
5588
  const claim = claimControllerRef.current;
5309
- _optionalChain([claim, 'optionalAccess', _166 => _166.abandon, 'call', _167 => _167("modal_close")]);
5310
- _optionalChain([claim, 'optionalAccess', _168 => _168.close, 'call', _169 => _169("host_controlled")]);
5589
+ _optionalChain([claim, 'optionalAccess', _184 => _184.abandon, 'call', _185 => _185("modal_close")]);
5590
+ _optionalChain([claim, 'optionalAccess', _186 => _186.close, 'call', _187 => _187("host_controlled")]);
5311
5591
  };
5312
5592
  }, [attempt]);
5313
5593
  const claimSessionProperties = _react.useMemo.call(void 0,
@@ -5333,7 +5613,7 @@ function HistoryOverlay({
5333
5613
  HistoryRecoveryFlow,
5334
5614
  {
5335
5615
  deposit: recovering,
5336
- entrySource: _nullishCoalesce(_optionalChain([attempt, 'optionalAccess', _170 => _170.entrySource]), () => ( "history_row")),
5616
+ entrySource: _nullishCoalesce(_optionalChain([attempt, 'optionalAccess', _188 => _188.entrySource]), () => ( "history_row")),
5337
5617
  backendUrl,
5338
5618
  signRecovery,
5339
5619
  debug,
@@ -5390,6 +5670,7 @@ function HistoryOverlay({
5390
5670
 
5391
5671
  // src/components/history/useHistoryPanel.ts
5392
5672
 
5673
+ var MAX_TIMEOUT_MS = 2147483647;
5393
5674
  function sortByCreatedAtDesc(items) {
5394
5675
  return [...items].sort((a, b) => {
5395
5676
  const at = a.createdAt ? Date.parse(a.createdAt) : 0;
@@ -5467,13 +5748,26 @@ function useHistoryPanel({
5467
5748
  },
5468
5749
  [recipient, service]
5469
5750
  );
5470
- const badge = _react.useMemo.call(void 0,
5471
- () => deriveHistoryBadge(deposits, { recipient, canRecover }),
5472
- [deposits, recipient, canRecover]
5473
- );
5751
+ const badgeState2 = deriveHistoryBadgeState(deposits, {
5752
+ recipient,
5753
+ canRecover
5754
+ });
5755
+ const badge = badgeState2.badge;
5756
+ _react.useEffect.call(void 0, () => {
5757
+ if (!isOpen || badgeState2.nextExpiryAt === null) return;
5758
+ const delay = Math.min(
5759
+ badgeState2.nextExpiryAt - Date.now(),
5760
+ MAX_TIMEOUT_MS
5761
+ );
5762
+ const timeout = setTimeout(
5763
+ () => setDeposits((current) => current.slice()),
5764
+ delay
5765
+ );
5766
+ return () => clearTimeout(timeout);
5767
+ }, [isOpen, badgeState2.nextExpiryAt]);
5474
5768
  const openPanel = _react.useCallback.call(void 0, () => {
5475
5769
  setIsPanelOpen(true);
5476
- _optionalChain([analytics, 'optionalAccess', _171 => _171.visitOpened, 'call', _172 => _172(badge)]);
5770
+ _optionalChain([analytics, 'optionalAccess', _189 => _189.visitOpened, 'call', _190 => _190(badge)]);
5477
5771
  if (!loadedRef.current || staleRef.current) {
5478
5772
  fetchHistory("initial");
5479
5773
  }
@@ -5481,10 +5775,10 @@ function useHistoryPanel({
5481
5775
  const closePanel = _react.useCallback.call(void 0, () => {
5482
5776
  if (recovering) return;
5483
5777
  setIsPanelOpen(false);
5484
- _optionalChain([analytics, 'optionalAccess', _173 => _173.visitEnded, 'call', _174 => _174()]);
5778
+ _optionalChain([analytics, 'optionalAccess', _191 => _191.visitEnded, 'call', _192 => _192()]);
5485
5779
  }, [analytics, recovering]);
5486
5780
  const loadMore = _react.useCallback.call(void 0, () => {
5487
- _optionalChain([analytics, 'optionalAccess', _175 => _175.loadMore, 'call', _176 => _176(filterVisibleDeposits(deposits).length)]);
5781
+ _optionalChain([analytics, 'optionalAccess', _193 => _193.loadMore, 'call', _194 => _194(filterVisibleDeposits(deposits).length)]);
5488
5782
  fetchHistory("more");
5489
5783
  }, [analytics, deposits, fetchHistory]);
5490
5784
  const markStale = _react.useCallback.call(void 0, () => {
@@ -5512,7 +5806,7 @@ function useHistoryPanel({
5512
5806
  _react.useEffect.call(void 0, () => {
5513
5807
  if (isOpen) return;
5514
5808
  setIsPanelOpen(false);
5515
- _optionalChain([analytics, 'optionalAccess', _177 => _177.visitEnded, 'call', _178 => _178()]);
5809
+ _optionalChain([analytics, 'optionalAccess', _195 => _195.visitEnded, 'call', _196 => _196()]);
5516
5810
  setDeposits([]);
5517
5811
  setHasMore(false);
5518
5812
  setError(null);
@@ -5671,11 +5965,11 @@ var NOTHING_TO_STOP = () => {
5671
5965
  };
5672
5966
  function resolveThemeMode(mode) {
5673
5967
  if (mode !== "system") return mode;
5674
- return _optionalChain([globalThis, 'access', _179 => _179.matchMedia, 'optionalCall', _180 => _180(DARK_SCHEME_QUERY), 'access', _181 => _181.matches]) ? "dark" : "light";
5968
+ return _optionalChain([globalThis, 'access', _197 => _197.matchMedia, 'optionalCall', _198 => _198(DARK_SCHEME_QUERY), 'access', _199 => _199.matches]) ? "dark" : "light";
5675
5969
  }
5676
5970
  function followSystemAppearance(mode, onChange) {
5677
5971
  if (mode !== "system") return NOTHING_TO_STOP;
5678
- const query = _optionalChain([globalThis, 'access', _182 => _182.matchMedia, 'optionalCall', _183 => _183(DARK_SCHEME_QUERY)]);
5972
+ const query = _optionalChain([globalThis, 'access', _200 => _200.matchMedia, 'optionalCall', _201 => _201(DARK_SCHEME_QUERY)]);
5679
5973
  if (!query) return NOTHING_TO_STOP;
5680
5974
  query.addEventListener("change", onChange);
5681
5975
  return () => query.removeEventListener("change", onChange);
@@ -5683,22 +5977,22 @@ function followSystemAppearance(mode, onChange) {
5683
5977
  function applyTheme(element, theme) {
5684
5978
  if (!element) return NOTHING_TO_STOP;
5685
5979
  const parent = element.parentElement;
5686
- const targets = _optionalChain([parent, 'optionalAccess', _184 => _184.classList, 'access', _185 => _185.contains, 'call', _186 => _186("rs-modal-content")]) ? [element, parent] : [element];
5980
+ const targets = _optionalChain([parent, 'optionalAccess', _202 => _202.classList, 'access', _203 => _203.contains, 'call', _204 => _204("rs-modal-content")]) ? [element, parent] : [element];
5687
5981
  const paintMode = () => {
5688
- const resolved = resolveThemeMode(_optionalChain([theme, 'optionalAccess', _187 => _187.mode]));
5982
+ const resolved = resolveThemeMode(_optionalChain([theme, 'optionalAccess', _205 => _205.mode]));
5689
5983
  for (const t of targets) {
5690
5984
  if (resolved) t.setAttribute("data-theme", resolved);
5691
5985
  else t.removeAttribute("data-theme");
5692
5986
  }
5693
5987
  };
5694
5988
  paintMode();
5695
- if (_optionalChain([theme, 'optionalAccess', _188 => _188.fontColor])) {
5989
+ if (_optionalChain([theme, 'optionalAccess', _206 => _206.fontColor])) {
5696
5990
  setVar(targets, "--rs-foreground", theme.fontColor);
5697
5991
  }
5698
- if (_optionalChain([theme, 'optionalAccess', _189 => _189.iconColor])) {
5992
+ if (_optionalChain([theme, 'optionalAccess', _207 => _207.iconColor])) {
5699
5993
  setVar(targets, "--rs-icon", theme.iconColor);
5700
5994
  }
5701
- if (_optionalChain([theme, 'optionalAccess', _190 => _190.ctaColor])) {
5995
+ if (_optionalChain([theme, 'optionalAccess', _208 => _208.ctaColor])) {
5702
5996
  const derived = deriveCustomPrimary(theme.ctaColor);
5703
5997
  if (derived) {
5704
5998
  setVar(targets, "--rs-primary", derived.base);
@@ -5723,25 +6017,25 @@ function applyTheme(element, theme) {
5723
6017
  }
5724
6018
  } else {
5725
6019
  for (const v of CUSTOM_PRIMARY_VARS) clearVar(targets, v);
5726
- if (_optionalChain([theme, 'optionalAccess', _191 => _191.ctaHoverColor])) {
6020
+ if (_optionalChain([theme, 'optionalAccess', _209 => _209.ctaHoverColor])) {
5727
6021
  setVar(targets, "--rs-primary-hover", theme.ctaHoverColor);
5728
6022
  }
5729
6023
  }
5730
- if (_optionalChain([theme, 'optionalAccess', _192 => _192.borderColor])) {
6024
+ if (_optionalChain([theme, 'optionalAccess', _210 => _210.borderColor])) {
5731
6025
  setVar(targets, "--rs-border", theme.borderColor);
5732
6026
  setVar(targets, "--rs-border-surface", theme.borderColor);
5733
6027
  }
5734
- if (_optionalChain([theme, 'optionalAccess', _193 => _193.backgroundColor])) {
6028
+ if (_optionalChain([theme, 'optionalAccess', _211 => _211.backgroundColor])) {
5735
6029
  setVar(targets, "--rs-background", theme.backgroundColor);
5736
6030
  }
5737
- if (_optionalChain([theme, 'optionalAccess', _194 => _194.radius])) {
6031
+ if (_optionalChain([theme, 'optionalAccess', _212 => _212.radius])) {
5738
6032
  const scale = RADIUS_SCALE[theme.radius];
5739
6033
  setVar(targets, "--rs-radius-sm", scale.sm);
5740
6034
  setVar(targets, "--rs-radius-md", scale.md);
5741
6035
  setVar(targets, "--rs-radius-lg", scale.lg);
5742
6036
  setVar(targets, "--rs-radius", scale.md);
5743
6037
  }
5744
- return followSystemAppearance(_optionalChain([theme, 'optionalAccess', _195 => _195.mode]), paintMode);
6038
+ return followSystemAppearance(_optionalChain([theme, 'optionalAccess', _213 => _213.mode]), paintMode);
5745
6039
  }
5746
6040
 
5747
6041
  // src/core/removed-props.ts
@@ -5830,20 +6124,20 @@ function sinkFor(source) {
5830
6124
  if (source.modal === "deposit") {
5831
6125
  const at2 = () => source.controllerRef.current;
5832
6126
  return {
5833
- opened: (detail) => _optionalChain([at2, 'call', _196 => _196(), 'optionalAccess', _197 => _197.historyOpened, 'call', _198 => _198({ ...detail, step: _nullishCoalesce(_optionalChain([at2, 'call', _199 => _199(), 'optionalAccess', _200 => _200.step]), () => ( null)) })]),
5834
- rowViewed: (detail) => _optionalChain([at2, 'call', _201 => _201(), 'optionalAccess', _202 => _202.historyRowViewed, 'call', _203 => _203(detail)]),
5835
- loadMore: (detail) => _optionalChain([at2, 'call', _204 => _204(), 'optionalAccess', _205 => _205.historyLoadMore, 'call', _206 => _206(detail)]),
5836
- fallbackOpened: (detail) => _optionalChain([at2, 'call', _207 => _207(), 'optionalAccess', _208 => _208.historyFallbackOpened, 'call', _209 => _209(detail)]),
5837
- recoveryStarted: (detail) => _optionalChain([at2, 'call', _210 => _210(), 'optionalAccess', _211 => _211.historyRecoveryStarted, 'call', _212 => _212(detail)])
6127
+ opened: (detail) => _optionalChain([at2, 'call', _214 => _214(), 'optionalAccess', _215 => _215.historyOpened, 'call', _216 => _216({ ...detail, step: _nullishCoalesce(_optionalChain([at2, 'call', _217 => _217(), 'optionalAccess', _218 => _218.step]), () => ( null)) })]),
6128
+ rowViewed: (detail) => _optionalChain([at2, 'call', _219 => _219(), 'optionalAccess', _220 => _220.historyRowViewed, 'call', _221 => _221(detail)]),
6129
+ loadMore: (detail) => _optionalChain([at2, 'call', _222 => _222(), 'optionalAccess', _223 => _223.historyLoadMore, 'call', _224 => _224(detail)]),
6130
+ fallbackOpened: (detail) => _optionalChain([at2, 'call', _225 => _225(), 'optionalAccess', _226 => _226.historyFallbackOpened, 'call', _227 => _227(detail)]),
6131
+ recoveryStarted: (detail) => _optionalChain([at2, 'call', _228 => _228(), 'optionalAccess', _229 => _229.historyRecoveryStarted, 'call', _230 => _230(detail)])
5838
6132
  };
5839
6133
  }
5840
6134
  const at = () => source.controllerRef.current;
5841
6135
  return {
5842
- opened: (detail) => _optionalChain([at, 'call', _213 => _213(), 'optionalAccess', _214 => _214.historyOpened, 'call', _215 => _215({ ...detail, step: _nullishCoalesce(_optionalChain([at, 'call', _216 => _216(), 'optionalAccess', _217 => _217.step]), () => ( null)) })]),
5843
- rowViewed: (detail) => _optionalChain([at, 'call', _218 => _218(), 'optionalAccess', _219 => _219.historyRowViewed, 'call', _220 => _220(detail)]),
5844
- loadMore: (detail) => _optionalChain([at, 'call', _221 => _221(), 'optionalAccess', _222 => _222.historyLoadMore, 'call', _223 => _223(detail)]),
5845
- fallbackOpened: (detail) => _optionalChain([at, 'call', _224 => _224(), 'optionalAccess', _225 => _225.historyFallbackOpened, 'call', _226 => _226(detail)]),
5846
- recoveryStarted: (detail) => _optionalChain([at, 'call', _227 => _227(), 'optionalAccess', _228 => _228.historyRecoveryStarted, 'call', _229 => _229(detail)])
6136
+ opened: (detail) => _optionalChain([at, 'call', _231 => _231(), 'optionalAccess', _232 => _232.historyOpened, 'call', _233 => _233({ ...detail, step: _nullishCoalesce(_optionalChain([at, 'call', _234 => _234(), 'optionalAccess', _235 => _235.step]), () => ( null)) })]),
6137
+ rowViewed: (detail) => _optionalChain([at, 'call', _236 => _236(), 'optionalAccess', _237 => _237.historyRowViewed, 'call', _238 => _238(detail)]),
6138
+ loadMore: (detail) => _optionalChain([at, 'call', _239 => _239(), 'optionalAccess', _240 => _240.historyLoadMore, 'call', _241 => _241(detail)]),
6139
+ fallbackOpened: (detail) => _optionalChain([at, 'call', _242 => _242(), 'optionalAccess', _243 => _243.historyFallbackOpened, 'call', _244 => _244(detail)]),
6140
+ recoveryStarted: (detail) => _optionalChain([at, 'call', _245 => _245(), 'optionalAccess', _246 => _246.historyRecoveryStarted, 'call', _247 => _247(detail)])
5847
6141
  };
5848
6142
  }
5849
6143
  function badgeState(badge) {
@@ -5869,7 +6163,7 @@ function createHistoryAnalytics(source) {
5869
6163
  sink.opened({
5870
6164
  history_visit_id: visitId,
5871
6165
  badge: badgeState(badge),
5872
- badge_count: _nullishCoalesce(_optionalChain([badge, 'optionalAccess', _230 => _230.count]), () => ( 0))
6166
+ badge_count: _nullishCoalesce(_optionalChain([badge, 'optionalAccess', _248 => _248.count]), () => ( 0))
5873
6167
  });
5874
6168
  },
5875
6169
  visitEnded() {
@@ -5933,7 +6227,7 @@ function resolveChain(targetChain) {
5933
6227
  return _chunkOY5N3E6Lcjs.targetChainToCaip2.call(void 0, targetChain);
5934
6228
  }
5935
6229
  function resolveToken(targetToken) {
5936
- const raw = _optionalChain([targetToken, 'optionalAccess', _231 => _231.trim, 'call', _232 => _232()]);
6230
+ const raw = _optionalChain([targetToken, 'optionalAccess', _249 => _249.trim, 'call', _250 => _250()]);
5937
6231
  if (!raw) return void 0;
5938
6232
  if (HEX_TOKEN.test(raw)) return raw.toLowerCase();
5939
6233
  if (BASE58_TOKEN.test(raw)) return raw;
@@ -5991,8 +6285,8 @@ function Tooltip({ content, children, className }) {
5991
6285
  function handleOutside(event) {
5992
6286
  const target = event.target;
5993
6287
  if (!target) return;
5994
- if (_optionalChain([triggerRef, 'access', _233 => _233.current, 'optionalAccess', _234 => _234.contains, 'call', _235 => _235(target)])) return;
5995
- if (_optionalChain([bubbleRef, 'access', _236 => _236.current, 'optionalAccess', _237 => _237.contains, 'call', _238 => _238(target)])) return;
6288
+ if (_optionalChain([triggerRef, 'access', _251 => _251.current, 'optionalAccess', _252 => _252.contains, 'call', _253 => _253(target)])) return;
6289
+ if (_optionalChain([bubbleRef, 'access', _254 => _254.current, 'optionalAccess', _255 => _255.contains, 'call', _256 => _256(target)])) return;
5996
6290
  setOpen(false);
5997
6291
  }
5998
6292
  function handleKey(event) {
@@ -6221,7 +6515,7 @@ function asNumber(value) {
6221
6515
  const trimmed = value.trim();
6222
6516
  if (!trimmed) return void 0;
6223
6517
  const caipMatch = trimmed.match(/^eip155:(\d+)$/);
6224
- if (_optionalChain([caipMatch, 'optionalAccess', _239 => _239[1]])) {
6518
+ if (_optionalChain([caipMatch, 'optionalAccess', _257 => _257[1]])) {
6225
6519
  const parsed2 = Number(caipMatch[1]);
6226
6520
  return Number.isFinite(parsed2) ? parsed2 : void 0;
6227
6521
  }
@@ -6240,24 +6534,24 @@ function asAddress(value) {
6240
6534
  return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
6241
6535
  }
6242
6536
  function getEventTxHash(event) {
6243
- if (!_optionalChain([event, 'optionalAccess', _240 => _240.type])) return void 0;
6537
+ if (!_optionalChain([event, 'optionalAccess', _258 => _258.type])) return void 0;
6244
6538
  if (event.type === "deposit-received") {
6245
- return asString(_optionalChain([event, 'access', _241 => _241.data, 'optionalAccess', _242 => _242.transactionHash]));
6539
+ return asString(_optionalChain([event, 'access', _259 => _259.data, 'optionalAccess', _260 => _260.transactionHash]));
6246
6540
  }
6247
6541
  if (event.type === "bridge-started" || event.type === "bridge-complete") {
6248
- const deposit = isRecord(_optionalChain([event, 'access', _243 => _243.data, 'optionalAccess', _244 => _244.deposit])) ? event.data.deposit : void 0;
6249
- const source = isRecord(_optionalChain([event, 'access', _245 => _245.data, 'optionalAccess', _246 => _246.source])) ? event.data.source : void 0;
6250
- return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _247 => _247.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _248 => _248.transactionHash]))));
6542
+ const deposit = isRecord(_optionalChain([event, 'access', _261 => _261.data, 'optionalAccess', _262 => _262.deposit])) ? event.data.deposit : void 0;
6543
+ const source = isRecord(_optionalChain([event, 'access', _263 => _263.data, 'optionalAccess', _264 => _264.source])) ? event.data.source : void 0;
6544
+ return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _265 => _265.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _266 => _266.transactionHash]))));
6251
6545
  }
6252
6546
  if (event.type === "bridge-failed" || event.type === "error") {
6253
- const deposit = isRecord(_optionalChain([event, 'access', _249 => _249.data, 'optionalAccess', _250 => _250.deposit])) ? event.data.deposit : void 0;
6254
- const source = isRecord(_optionalChain([event, 'access', _251 => _251.data, 'optionalAccess', _252 => _252.source])) ? event.data.source : void 0;
6255
- return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _253 => _253.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _254 => _254.transactionHash]))));
6547
+ const deposit = isRecord(_optionalChain([event, 'access', _267 => _267.data, 'optionalAccess', _268 => _268.deposit])) ? event.data.deposit : void 0;
6548
+ const source = isRecord(_optionalChain([event, 'access', _269 => _269.data, 'optionalAccess', _270 => _270.source])) ? event.data.source : void 0;
6549
+ return _nullishCoalesce(asString(_optionalChain([deposit, 'optionalAccess', _271 => _271.transactionHash])), () => ( asString(_optionalChain([source, 'optionalAccess', _272 => _272.transactionHash]))));
6256
6550
  }
6257
6551
  return void 0;
6258
6552
  }
6259
6553
  function getEventSourceDetails(event) {
6260
- if (!_optionalChain([event, 'optionalAccess', _255 => _255.type]) || !isRecord(event.data)) return {};
6554
+ if (!_optionalChain([event, 'optionalAccess', _273 => _273.type]) || !isRecord(event.data)) return {};
6261
6555
  if (event.type === "deposit-received") {
6262
6556
  return {
6263
6557
  chainId: asNumber(event.data.chain),
@@ -6269,9 +6563,9 @@ function getEventSourceDetails(event) {
6269
6563
  const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
6270
6564
  if (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error") {
6271
6565
  return {
6272
- chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess', _256 => _256.chain])), () => ( asNumber(_optionalChain([deposit, 'optionalAccess', _257 => _257.chain])))),
6273
- amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess', _258 => _258.amount])), () => ( asAmount(_optionalChain([deposit, 'optionalAccess', _259 => _259.amount])))),
6274
- token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess', _260 => _260.asset])), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _261 => _261.asset])))), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _262 => _262.token]))))
6566
+ chainId: _nullishCoalesce(asNumber(_optionalChain([source, 'optionalAccess', _274 => _274.chain])), () => ( asNumber(_optionalChain([deposit, 'optionalAccess', _275 => _275.chain])))),
6567
+ amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess', _276 => _276.amount])), () => ( asAmount(_optionalChain([deposit, 'optionalAccess', _277 => _277.amount])))),
6568
+ token: _nullishCoalesce(_nullishCoalesce(asAddress(_optionalChain([source, 'optionalAccess', _278 => _278.asset])), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _279 => _279.asset])))), () => ( asAddress(_optionalChain([deposit, 'optionalAccess', _280 => _280.token]))))
6275
6569
  };
6276
6570
  }
6277
6571
  return {};
@@ -6285,7 +6579,7 @@ function asChain(value) {
6285
6579
  return asNumber(value);
6286
6580
  }
6287
6581
  function getEventDestinationDetails(event) {
6288
- if (!_optionalChain([event, 'optionalAccess', _263 => _263.type]) || !isRecord(event.data)) return {};
6582
+ if (!_optionalChain([event, 'optionalAccess', _281 => _281.type]) || !isRecord(event.data)) return {};
6289
6583
  if (event.type !== "bridge-started" && event.type !== "bridge-complete") {
6290
6584
  return {};
6291
6585
  }
@@ -6295,14 +6589,14 @@ function getEventDestinationDetails(event) {
6295
6589
  return {
6296
6590
  chainId: asChain(destination.chain),
6297
6591
  amount: asAmount(destination.amount),
6298
- token: _optionalChain([token, 'optionalAccess', _264 => _264.trim, 'call', _265 => _265()]) || void 0
6592
+ token: _optionalChain([token, 'optionalAccess', _282 => _282.trim, 'call', _283 => _283()]) || void 0
6299
6593
  };
6300
6594
  }
6301
6595
  function isDepositEvent(event) {
6302
- return _optionalChain([event, 'optionalAccess', _266 => _266.type]) === "deposit-received" || _optionalChain([event, 'optionalAccess', _267 => _267.type]) === "bridge-started" || _optionalChain([event, 'optionalAccess', _268 => _268.type]) === "bridge-complete" || _optionalChain([event, 'optionalAccess', _269 => _269.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _270 => _270.type]) === "error";
6596
+ return _optionalChain([event, 'optionalAccess', _284 => _284.type]) === "deposit-received" || _optionalChain([event, 'optionalAccess', _285 => _285.type]) === "bridge-started" || _optionalChain([event, 'optionalAccess', _286 => _286.type]) === "bridge-complete" || _optionalChain([event, 'optionalAccess', _287 => _287.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _288 => _288.type]) === "error";
6303
6597
  }
6304
6598
  function isFailedEvent(event) {
6305
- return _optionalChain([event, 'optionalAccess', _271 => _271.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _272 => _272.type]) === "error";
6599
+ return _optionalChain([event, 'optionalAccess', _289 => _289.type]) === "bridge-failed" || _optionalChain([event, 'optionalAccess', _290 => _290.type]) === "error";
6306
6600
  }
6307
6601
  function isHexString(value) {
6308
6602
  return value.startsWith("0x") || value.startsWith("0X");
@@ -6314,7 +6608,7 @@ function txRefsMatch(a, b) {
6314
6608
  return a === b;
6315
6609
  }
6316
6610
  function formatBridgeFailedMessage(event) {
6317
- const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _273 => _273.data]), () => ( {}));
6611
+ const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _291 => _291.data]), () => ( {}));
6318
6612
  const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
6319
6613
  const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
6320
6614
  function toUserFacingFailure(raw) {
@@ -6342,7 +6636,7 @@ function formatBridgeFailedMessage(event) {
6342
6636
  return { message: "Bridge failed" };
6343
6637
  }
6344
6638
  function failureMessageForEvent(event) {
6345
- if (_optionalChain([event, 'optionalAccess', _274 => _274.type]) === "error") {
6639
+ if (_optionalChain([event, 'optionalAccess', _292 => _292.type]) === "error") {
6346
6640
  const message = isRecord(event.data) ? asString(event.data.message) : void 0;
6347
6641
  return _nullishCoalesce(message, () => ( "Unknown error"));
6348
6642
  }
@@ -6381,7 +6675,7 @@ async function fetchTokenPriceUsd(service, token) {
6381
6675
  }
6382
6676
  function useTokenPrices(service, tokens) {
6383
6677
  const [prices, setPrices] = _react.useState.call(void 0, {});
6384
- const defined = tokens.filter((t) => Boolean(_optionalChain([t, 'optionalAccess', _275 => _275.symbol])));
6678
+ const defined = tokens.filter((t) => Boolean(_optionalChain([t, 'optionalAccess', _293 => _293.symbol])));
6385
6679
  const entries = [
6386
6680
  ...new Map(
6387
6681
  defined.flatMap((token) => {
@@ -6544,7 +6838,7 @@ function loadPhaseTimings(txHash) {
6544
6838
  const parsed = JSON.parse(raw);
6545
6839
  if (typeof parsed.startedAt !== "number") return null;
6546
6840
  return parsed;
6547
- } catch (e16) {
6841
+ } catch (e17) {
6548
6842
  return null;
6549
6843
  }
6550
6844
  }
@@ -6555,7 +6849,7 @@ function savePhaseTimings(txHash, timings) {
6555
6849
  `${PHASE_TIMINGS_PREFIX}:${txHash}`,
6556
6850
  JSON.stringify(timings)
6557
6851
  );
6558
- } catch (e17) {
6852
+ } catch (e18) {
6559
6853
  }
6560
6854
  }
6561
6855
  function isEventForTx(event, txHash) {
@@ -6564,12 +6858,12 @@ function isEventForTx(event, txHash) {
6564
6858
  return txRefsMatch(eventTxHash, txHash);
6565
6859
  }
6566
6860
  function parseWebhookTimestamp(event) {
6567
- if (typeof _optionalChain([event, 'optionalAccess', _276 => _276.time]) !== "string") return void 0;
6861
+ if (typeof _optionalChain([event, 'optionalAccess', _294 => _294.time]) !== "string") return void 0;
6568
6862
  const timestamp = Date.parse(event.time);
6569
6863
  return Number.isFinite(timestamp) ? timestamp : void 0;
6570
6864
  }
6571
6865
  function syncPhaseTimings(previous, event) {
6572
- if (!_optionalChain([event, 'optionalAccess', _277 => _277.type])) return previous;
6866
+ if (!_optionalChain([event, 'optionalAccess', _295 => _295.type])) return previous;
6573
6867
  const timestamp = _nullishCoalesce(parseWebhookTimestamp(event), () => ( Date.now()));
6574
6868
  const setReceived = (event.type === "deposit-received" || event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error") && previous.receivedAt === void 0;
6575
6869
  const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete") && previous.bridgingAt === void 0;
@@ -6631,46 +6925,52 @@ function getCurrentPhaseId(state, phaseTimings) {
6631
6925
  if (state.type === "complete") {
6632
6926
  return void 0;
6633
6927
  }
6634
- if (_optionalChain([state, 'access', _278 => _278.lastEvent, 'optionalAccess', _279 => _279.type]) === "bridge-started" || _optionalChain([state, 'access', _280 => _280.lastEvent, 'optionalAccess', _281 => _281.type]) === "bridge-complete")
6928
+ if (_optionalChain([state, 'access', _296 => _296.lastEvent, 'optionalAccess', _297 => _297.type]) === "bridge-started" || _optionalChain([state, 'access', _298 => _298.lastEvent, 'optionalAccess', _299 => _299.type]) === "bridge-complete")
6635
6929
  return "bridging";
6636
- if (_optionalChain([state, 'access', _282 => _282.lastEvent, 'optionalAccess', _283 => _283.type]) === "deposit-received") return "received";
6930
+ if (_optionalChain([state, 'access', _300 => _300.lastEvent, 'optionalAccess', _301 => _301.type]) === "deposit-received") return "received";
6637
6931
  return "confirming";
6638
6932
  }
6933
+ function getCompletionDestinationAmount(event) {
6934
+ const amount = _optionalChain([event, 'optionalAccess', _302 => _302.data, 'optionalAccess', _303 => _303.destination, 'optionalAccess', _304 => _304.amount]);
6935
+ return typeof amount === "string" ? amount : void 0;
6936
+ }
6639
6937
  function getCompletionDestinationTxHash(event) {
6640
- const eventData = _optionalChain([event, 'optionalAccess', _284 => _284.data]);
6641
- const swapTxHash = _optionalChain([eventData, 'optionalAccess', _285 => _285.swap, 'optionalAccess', _286 => _286.transactionHash]);
6642
- const destinationTxHash = _optionalChain([eventData, 'optionalAccess', _287 => _287.destination, 'optionalAccess', _288 => _288.transactionHash]);
6938
+ const eventData = _optionalChain([event, 'optionalAccess', _305 => _305.data]);
6939
+ const swapTxHash = _optionalChain([eventData, 'optionalAccess', _306 => _306.swap, 'optionalAccess', _307 => _307.transactionHash]);
6940
+ const destinationTxHash = _optionalChain([eventData, 'optionalAccess', _308 => _308.destination, 'optionalAccess', _309 => _309.transactionHash]);
6643
6941
  return _nullishCoalesce(swapTxHash, () => ( destinationTxHash));
6644
6942
  }
6645
6943
  function getTerminalProcessingOutcome(event) {
6646
- if (_optionalChain([event, 'optionalAccess', _289 => _289.type]) === "post-bridge-swap-complete") {
6944
+ if (_optionalChain([event, 'optionalAccess', _310 => _310.type]) === "post-bridge-swap-complete") {
6647
6945
  return {
6648
6946
  type: "complete",
6649
- destinationTxHash: getCompletionDestinationTxHash(event)
6947
+ destinationTxHash: getCompletionDestinationTxHash(event),
6948
+ destinationAmount: getCompletionDestinationAmount(event)
6650
6949
  };
6651
6950
  }
6652
- if (_optionalChain([event, 'optionalAccess', _290 => _290.type]) === "post-bridge-swap-failed") {
6951
+ if (_optionalChain([event, 'optionalAccess', _311 => _311.type]) === "post-bridge-swap-failed") {
6653
6952
  return {
6654
6953
  type: "failed",
6655
6954
  message: formatBridgeFailedMessage(event).message
6656
6955
  };
6657
6956
  }
6658
- if (_optionalChain([event, 'optionalAccess', _291 => _291.type]) === "bridge-complete") {
6957
+ if (_optionalChain([event, 'optionalAccess', _312 => _312.type]) === "bridge-complete") {
6659
6958
  return {
6660
6959
  type: "complete",
6661
- destinationTxHash: getCompletionDestinationTxHash(event)
6960
+ destinationTxHash: getCompletionDestinationTxHash(event),
6961
+ destinationAmount: getCompletionDestinationAmount(event)
6662
6962
  };
6663
6963
  }
6664
- if (_optionalChain([event, 'optionalAccess', _292 => _292.type]) === "bridge-failed") {
6964
+ if (_optionalChain([event, 'optionalAccess', _313 => _313.type]) === "bridge-failed") {
6665
6965
  return {
6666
6966
  type: "failed",
6667
6967
  message: formatBridgeFailedMessage(event).message
6668
6968
  };
6669
6969
  }
6670
- if (_optionalChain([event, 'optionalAccess', _293 => _293.type]) === "error") {
6970
+ if (_optionalChain([event, 'optionalAccess', _314 => _314.type]) === "error") {
6671
6971
  return {
6672
6972
  type: "failed",
6673
- message: _nullishCoalesce(_optionalChain([event, 'access', _294 => _294.data, 'optionalAccess', _295 => _295.message]), () => ( "Unknown error"))
6973
+ message: _nullishCoalesce(_optionalChain([event, 'access', _315 => _315.data, 'optionalAccess', _316 => _316.message]), () => ( "Unknown error"))
6674
6974
  };
6675
6975
  }
6676
6976
  return null;
@@ -6678,10 +6978,10 @@ function getTerminalProcessingOutcome(event) {
6678
6978
  function getInitialProcessingState(event, txHash) {
6679
6979
  if (!event || !isEventForTx(event, txHash)) return null;
6680
6980
  const terminal = getTerminalProcessingOutcome(event);
6681
- if (_optionalChain([terminal, 'optionalAccess', _296 => _296.type]) === "complete") {
6981
+ if (_optionalChain([terminal, 'optionalAccess', _317 => _317.type]) === "complete") {
6682
6982
  return { type: "complete", lastEvent: event };
6683
6983
  }
6684
- if (_optionalChain([terminal, 'optionalAccess', _297 => _297.type]) === "failed") {
6984
+ if (_optionalChain([terminal, 'optionalAccess', _318 => _318.type]) === "failed") {
6685
6985
  return { type: "failed", message: terminal.message, lastEvent: event };
6686
6986
  }
6687
6987
  if (isDepositEvent(event)) {
@@ -6690,7 +6990,7 @@ function getInitialProcessingState(event, txHash) {
6690
6990
  return null;
6691
6991
  }
6692
6992
  function getSettledSourceTxHash(event, fallbackTxHash) {
6693
- return _nullishCoalesce(_optionalChain([event, 'optionalAccess', _298 => _298.data, 'optionalAccess', _299 => _299.source, 'optionalAccess', _300 => _300.transactionHash]), () => ( fallbackTxHash));
6993
+ return _nullishCoalesce(_optionalChain([event, 'optionalAccess', _319 => _319.data, 'optionalAccess', _320 => _320.source, 'optionalAccess', _321 => _321.transactionHash]), () => ( fallbackTxHash));
6694
6994
  }
6695
6995
  function ProcessingStep({
6696
6996
  smartAccount,
@@ -6770,8 +7070,8 @@ function ProcessingStep({
6770
7070
  const [elapsedSeconds, setElapsedSeconds] = _react.useState.call(void 0,
6771
7071
  () => Math.max(0, Math.floor((Date.now() - startTimeRef.current) / 1e3))
6772
7072
  );
6773
- const [latchedTiming, setLatchedTiming] = _react.useState.call(void 0, _optionalChain([quote, 'optionalAccess', _301 => _301.timing]));
6774
- if (latchedTiming === void 0 && _optionalChain([quote, 'optionalAccess', _302 => _302.timing]) !== void 0) {
7073
+ const [latchedTiming, setLatchedTiming] = _react.useState.call(void 0, _optionalChain([quote, 'optionalAccess', _322 => _322.timing]));
7074
+ if (latchedTiming === void 0 && _optionalChain([quote, 'optionalAccess', _323 => _323.timing]) !== void 0) {
6775
7075
  setLatchedTiming(quote.timing);
6776
7076
  }
6777
7077
  const timingStateRef = _react.useRef.call(void 0, "expected");
@@ -6802,7 +7102,7 @@ function ProcessingStep({
6802
7102
  flowLabel
6803
7103
  });
6804
7104
  const context = processingContextRef.current;
6805
- _optionalChain([onDepositCompleteRef, 'access', _303 => _303.current, 'optionalCall', _304 => _304(txHash, void 0, {
7105
+ _optionalChain([onDepositCompleteRef, 'access', _324 => _324.current, 'optionalCall', _325 => _325(txHash, void 0, {
6806
7106
  amount: context.amount,
6807
7107
  sourceChain: context.sourceChain,
6808
7108
  sourceToken: context.sourceToken,
@@ -6835,7 +7135,7 @@ function ProcessingStep({
6835
7135
  destinationTxHash: outcome.destinationTxHash,
6836
7136
  event: event.type
6837
7137
  });
6838
- _optionalChain([onDepositCompleteRef, 'access', _305 => _305.current, 'optionalCall', _306 => _306(
7138
+ _optionalChain([onDepositCompleteRef, 'access', _326 => _326.current, 'optionalCall', _327 => _327(
6839
7139
  sourceTxHash2,
6840
7140
  outcome.destinationTxHash,
6841
7141
  {
@@ -6845,7 +7145,8 @@ function ProcessingStep({
6845
7145
  sourceDecimals: context.sourceDecimals,
6846
7146
  amountUsd: context.amountUsd,
6847
7147
  targetChain: context.targetChain,
6848
- targetToken: context.targetToken
7148
+ targetToken: context.targetToken,
7149
+ destinationAmount: outcome.destinationAmount
6849
7150
  }
6850
7151
  )]);
6851
7152
  return;
@@ -6855,7 +7156,7 @@ function ProcessingStep({
6855
7156
  message: outcome.message,
6856
7157
  event: event.type
6857
7158
  });
6858
- _optionalChain([onDepositFailedRef, 'access', _307 => _307.current, 'optionalCall', _308 => _308(txHash, outcome.message)]);
7159
+ _optionalChain([onDepositFailedRef, 'access', _328 => _328.current, 'optionalCall', _329 => _329(txHash, outcome.message)]);
6859
7160
  }, [
6860
7161
  debug,
6861
7162
  onDepositCompleteRef,
@@ -6866,8 +7167,8 @@ function ProcessingStep({
6866
7167
  const onSettledChangeRef = _react.useRef.call(void 0, onSettledChange);
6867
7168
  onSettledChangeRef.current = onSettledChange;
6868
7169
  _react.useEffect.call(void 0, () => {
6869
- _optionalChain([onSettledChangeRef, 'access', _309 => _309.current, 'optionalCall', _310 => _310(state.type !== "processing")]);
6870
- return () => _optionalChain([onSettledChangeRef, 'access', _311 => _311.current, 'optionalCall', _312 => _312(false)]);
7170
+ _optionalChain([onSettledChangeRef, 'access', _330 => _330.current, 'optionalCall', _331 => _331(state.type !== "processing")]);
7171
+ return () => _optionalChain([onSettledChangeRef, 'access', _332 => _332.current, 'optionalCall', _333 => _333(false)]);
6871
7172
  }, [state.type]);
6872
7173
  _react.useEffect.call(void 0, () => {
6873
7174
  if (directTransfer || state.type !== "processing") return;
@@ -6893,13 +7194,13 @@ function ProcessingStep({
6893
7194
  updatePhaseTimings(
6894
7195
  (previous) => syncPhaseTimings(previous, state.lastEvent)
6895
7196
  );
6896
- }, [_optionalChain([state, 'access', _313 => _313.lastEvent, 'optionalAccess', _314 => _314.time]), _optionalChain([state, 'access', _315 => _315.lastEvent, 'optionalAccess', _316 => _316.type]), updatePhaseTimings]);
7197
+ }, [_optionalChain([state, 'access', _334 => _334.lastEvent, 'optionalAccess', _335 => _335.time]), _optionalChain([state, 'access', _336 => _336.lastEvent, 'optionalAccess', _337 => _337.type]), updatePhaseTimings]);
6897
7198
  const [swappedFiatContext, setSwappedFiatContext] = _react.useState.call(void 0, null);
6898
7199
  _react.useEffect.call(void 0, () => {
6899
7200
  let cancelled = false;
6900
7201
  let timeoutId;
6901
- const isFiatSwappedOrder = isSwappedOrder && _optionalChain([swappedContext, 'optionalAccess', _317 => _317.variant]) === "fiat";
6902
- const expectedOrderUuid = _nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess', _318 => _318.expectedOrderUuid]), () => ( null));
7202
+ const isFiatSwappedOrder = isSwappedOrder && _optionalChain([swappedContext, 'optionalAccess', _338 => _338.variant]) === "fiat";
7203
+ const expectedOrderUuid = _nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess', _339 => _339.expectedOrderUuid]), () => ( null));
6903
7204
  setSwappedFiatContext(null);
6904
7205
  if (isFiatSwappedOrder && !expectedOrderUuid) {
6905
7206
  return () => {
@@ -6935,7 +7236,7 @@ function ProcessingStep({
6935
7236
  if (isFiatSwappedOrder && !hasFiatReceiptPricing(res)) {
6936
7237
  scheduleRetry();
6937
7238
  }
6938
- } catch (e18) {
7239
+ } catch (e19) {
6939
7240
  scheduleRetry();
6940
7241
  }
6941
7242
  }
@@ -6949,8 +7250,8 @@ function ProcessingStep({
6949
7250
  smartAccount,
6950
7251
  txHash,
6951
7252
  isSwappedOrder,
6952
- _optionalChain([swappedContext, 'optionalAccess', _319 => _319.variant]),
6953
- _optionalChain([swappedContext, 'optionalAccess', _320 => _320.expectedOrderUuid])
7253
+ _optionalChain([swappedContext, 'optionalAccess', _340 => _340.variant]),
7254
+ _optionalChain([swappedContext, 'optionalAccess', _341 => _341.expectedOrderUuid])
6954
7255
  ]);
6955
7256
  _react.useEffect.call(void 0, () => {
6956
7257
  if (directTransfer) return;
@@ -6976,17 +7277,18 @@ function ProcessingStep({
6976
7277
  debugLog(debug, "processing", "poll:event", {
6977
7278
  type: lastEvent2.type,
6978
7279
  matchesTx: eventMatchesTx,
6979
- intentId: _optionalChain([eventData, 'optionalAccess', _321 => _321.intentId])
7280
+ intentId: _optionalChain([eventData, 'optionalAccess', _342 => _342.intentId])
6980
7281
  });
6981
7282
  }
6982
7283
  if (!isMounted) return;
6983
- if (_optionalChain([eventForCurrentTx, 'optionalAccess', _322 => _322.type]) === "bridge-complete") {
7284
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _343 => _343.type]) === "bridge-complete") {
6984
7285
  setState({ type: "complete", lastEvent: eventForCurrentTx });
6985
7286
  const sourceTxHash2 = getSettledSourceTxHash(
6986
7287
  eventForCurrentTx,
6987
7288
  txHash
6988
7289
  );
6989
- const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access', _323 => _323.data, 'optionalAccess', _324 => _324.destination, 'optionalAccess', _325 => _325.transactionHash]);
7290
+ const destination = _optionalChain([eventForCurrentTx, 'access', _344 => _344.data, 'optionalAccess', _345 => _345.destination]);
7291
+ const destinationTxHash2 = _optionalChain([destination, 'optionalAccess', _346 => _346.transactionHash]);
6990
7292
  debugLog(debug, "processing", "state:complete", {
6991
7293
  txHash,
6992
7294
  sourceTxHash: sourceTxHash2,
@@ -6994,18 +7296,19 @@ function ProcessingStep({
6994
7296
  event: eventForCurrentTx.type
6995
7297
  });
6996
7298
  const context = processingContextRef.current;
6997
- _optionalChain([onDepositCompleteRef, 'access', _326 => _326.current, 'optionalCall', _327 => _327(sourceTxHash2, destinationTxHash2, {
7299
+ _optionalChain([onDepositCompleteRef, 'access', _347 => _347.current, 'optionalCall', _348 => _348(sourceTxHash2, destinationTxHash2, {
6998
7300
  amount: context.amount,
6999
7301
  sourceChain: context.sourceChain,
7000
7302
  sourceToken: context.sourceToken,
7001
7303
  sourceDecimals: context.sourceDecimals,
7002
7304
  amountUsd: context.amountUsd,
7003
7305
  targetChain: context.targetChain,
7004
- targetToken: context.targetToken
7306
+ targetToken: context.targetToken,
7307
+ destinationAmount: typeof _optionalChain([destination, 'optionalAccess', _349 => _349.amount]) === "string" ? destination.amount : void 0
7005
7308
  })]);
7006
7309
  return;
7007
7310
  }
7008
- if (_optionalChain([eventForCurrentTx, 'optionalAccess', _328 => _328.type]) === "bridge-failed") {
7311
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _350 => _350.type]) === "bridge-failed") {
7009
7312
  const formatted = formatBridgeFailedMessage(eventForCurrentTx);
7010
7313
  setState({
7011
7314
  type: "failed",
@@ -7017,11 +7320,11 @@ function ProcessingStep({
7017
7320
  message: formatted.message,
7018
7321
  code: formatted.code
7019
7322
  });
7020
- _optionalChain([onDepositFailedRef, 'access', _329 => _329.current, 'optionalCall', _330 => _330(txHash, formatted.message)]);
7323
+ _optionalChain([onDepositFailedRef, 'access', _351 => _351.current, 'optionalCall', _352 => _352(txHash, formatted.message)]);
7021
7324
  return;
7022
7325
  }
7023
- if (_optionalChain([eventForCurrentTx, 'optionalAccess', _331 => _331.type]) === "error") {
7024
- const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access', _332 => _332.data, 'optionalAccess', _333 => _333.message]), () => ( "Unknown error"));
7326
+ if (_optionalChain([eventForCurrentTx, 'optionalAccess', _353 => _353.type]) === "error") {
7327
+ const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access', _354 => _354.data, 'optionalAccess', _355 => _355.message]), () => ( "Unknown error"));
7025
7328
  setState({
7026
7329
  type: "failed",
7027
7330
  message: errorMessage,
@@ -7031,7 +7334,7 @@ function ProcessingStep({
7031
7334
  txHash,
7032
7335
  message: errorMessage
7033
7336
  });
7034
- _optionalChain([onDepositFailedRef, 'access', _334 => _334.current, 'optionalCall', _335 => _335(txHash, errorMessage)]);
7337
+ _optionalChain([onDepositFailedRef, 'access', _356 => _356.current, 'optionalCall', _357 => _357(txHash, errorMessage)]);
7035
7338
  return;
7036
7339
  }
7037
7340
  setState((previous) => ({
@@ -7087,20 +7390,20 @@ function ProcessingStep({
7087
7390
  const lastEvent = state.lastEvent;
7088
7391
  const failureMessage = state.type === "failed" ? state.message : void 0;
7089
7392
  const timelineNowMs = _nullishCoalesce(phaseTimings.endedAt, () => ( Date.now()));
7090
- const flowNoun = flowLabel === "withdraw" ? "withdrawal" : "deposit";
7091
- const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : "Deposit";
7092
- const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess', _336 => _336.data, 'optionalAccess', _337 => _337.destination, 'optionalAccess', _338 => _338.transactionHash]) || null;
7393
+ const flowNoun = flowLabel === "withdraw" ? "withdrawal" : flowLabel === "payment" ? "payment" : "deposit";
7394
+ const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : flowLabel === "payment" ? "Payment" : "Deposit";
7395
+ const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess', _358 => _358.data, 'optionalAccess', _359 => _359.destination, 'optionalAccess', _360 => _360.transactionHash]) || null;
7093
7396
  const sourceTxHash = getSettledSourceTxHash(lastEvent, txHash);
7094
7397
  const sourceDetails = getEventSourceDetails(lastEvent);
7095
7398
  const displaySourceChain = _nullishCoalesce(sourceDetails.chainId, () => ( sourceChain));
7096
7399
  const displaySourceToken = _nullishCoalesce(sourceDetails.token, () => ( sourceToken));
7097
7400
  const displayAmount = _nullishCoalesce(sourceDetails.amount, () => ( amount));
7098
7401
  const targetChainId = _chunkOY5N3E6Lcjs.targetChainToChainId.call(void 0, targetChain);
7099
- const settledSourceTxHash = _optionalChain([lastEvent, 'optionalAccess', _339 => _339.data, 'optionalAccess', _340 => _340.source, 'optionalAccess', _341 => _341.transactionHash]);
7402
+ const settledSourceTxHash = _optionalChain([lastEvent, 'optionalAccess', _361 => _361.data, 'optionalAccess', _362 => _362.source, 'optionalAccess', _363 => _363.transactionHash]);
7100
7403
  const sourceExplorerHash = _nullishCoalesce(settledSourceTxHash, () => ( (sourceTxHashPending ? null : sourceTxHash)));
7101
7404
  _react.useEffect.call(void 0, () => {
7102
7405
  if (sourceTxHashPending && settledSourceTxHash) {
7103
- _optionalChain([onSourceTransactionObserved, 'optionalCall', _342 => _342(settledSourceTxHash)]);
7406
+ _optionalChain([onSourceTransactionObserved, 'optionalCall', _364 => _364(settledSourceTxHash)]);
7104
7407
  }
7105
7408
  }, [onSourceTransactionObserved, settledSourceTxHash, sourceTxHashPending]);
7106
7409
  const sourceExplorerUrl = sourceExplorerHash ? explorerTxUrl(displaySourceChain, sourceExplorerHash) : null;
@@ -7204,7 +7507,7 @@ function ProcessingStep({
7204
7507
  timeoutMs: latchedTiming ? resolveServedThresholds(latchedTiming).escalatedMs : FALLBACK_ESCALATED_DELAY_MS,
7205
7508
  served: latchedTiming !== void 0
7206
7509
  });
7207
- _optionalChain([onErrorRef, 'access', _343 => _343.current, 'optionalCall', _344 => _344(
7510
+ _optionalChain([onErrorRef, 'access', _365 => _365.current, 'optionalCall', _366 => _366(
7208
7511
  "Transfer is taking longer than expected. Your funds are safe and processing will continue automatically.",
7209
7512
  "PROCESS_TIMEOUT"
7210
7513
  )]);
@@ -7222,8 +7525,8 @@ function ProcessingStep({
7222
7525
  const sourceChainName = _chunkOY5N3E6Lcjs.getChainName.call(void 0, displaySourceChain);
7223
7526
  const targetChainName = _chunkOY5N3E6Lcjs.getChainName.call(void 0, targetChainId);
7224
7527
  const timerText = formatTimer(elapsedSeconds);
7225
- const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _345 => _345.feeSponsored]), () => ( false));
7226
- const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _346 => _346.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
7528
+ const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _367 => _367.feeSponsored]), () => ( false));
7529
+ const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _368 => _368.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
7227
7530
  const stateTitle = isComplete ? `${flowCapitalized} successful` : isFailed ? `${flowCapitalized} failed` : "Processing...";
7228
7531
  const handleRetry = _nullishCoalesce(onRetry, () => ( onNewDeposit));
7229
7532
  const headerContent = isComplete ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-body-header", children: [
@@ -7234,20 +7537,20 @@ function ProcessingStep({
7234
7537
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-body-header-text", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "rs-body-header-title", children: stateTitle }) })
7235
7538
  ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WalletIcon, {}), title: stateTitle });
7236
7539
  if (isComplete && isSwappedOrder) {
7237
- const effectivePaymentMethod = _nullishCoalesce(_nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess', _347 => _347.method]), () => ( _optionalChain([swappedFiatContext, 'optionalAccess', _348 => _348.paymentMethod]))), () => ( null));
7540
+ const effectivePaymentMethod = _nullishCoalesce(_nullishCoalesce(_optionalChain([swappedContext, 'optionalAccess', _369 => _369.method]), () => ( _optionalChain([swappedFiatContext, 'optionalAccess', _370 => _370.paymentMethod]))), () => ( null));
7238
7541
  const onrampMethod = effectivePaymentMethod ? formatPaymentMethod(effectivePaymentMethod) : null;
7239
- const onrampMethodIcon = _optionalChain([swappedContext, 'optionalAccess', _349 => _349.variant]) === "connect" && effectivePaymentMethod ? getExchangeLogoSrc(
7542
+ const onrampMethodIcon = _optionalChain([swappedContext, 'optionalAccess', _371 => _371.variant]) === "connect" && effectivePaymentMethod ? getExchangeLogoSrc(
7240
7543
  _nullishCoalesce(onrampMethod, () => ( effectivePaymentMethod)),
7241
7544
  effectivePaymentMethod
7242
7545
  ) : null;
7243
- const connectPaidAmount = _optionalChain([swappedContext, 'optionalAccess', _350 => _350.variant]) === "connect" ? `${formattedSentAmount} ${sourceSymbol}` : null;
7244
- const amountPaid = _nullishCoalesce(connectPaidAmount, () => ( (_optionalChain([swappedFiatContext, 'optionalAccess', _351 => _351.paidAmountUsd]) != null ? `$${swappedFiatContext.paidAmountUsd.toFixed(2)}` : null)));
7546
+ const connectPaidAmount = _optionalChain([swappedContext, 'optionalAccess', _372 => _372.variant]) === "connect" ? `${formattedSentAmount} ${sourceSymbol}` : null;
7547
+ const amountPaid = _nullishCoalesce(connectPaidAmount, () => ( (_optionalChain([swappedFiatContext, 'optionalAccess', _373 => _373.paidAmountUsd]) != null ? `$${swappedFiatContext.paidAmountUsd.toFixed(2)}` : null)));
7245
7548
  const depositedAmount = receiveDisplay;
7246
- const onrampFeeUsd = _nullishCoalesce(_optionalChain([swappedFiatContext, 'optionalAccess', _352 => _352.onrampFeeUsd]), () => ( null));
7549
+ const onrampFeeUsd = _nullishCoalesce(_optionalChain([swappedFiatContext, 'optionalAccess', _374 => _374.onrampFeeUsd]), () => ( null));
7247
7550
  const sponsoredFeeTooltip = "This fee is sponsored for this deposit.";
7248
7551
  const feesTooltip = feeSponsored ? "On-ramp fees are charged by the payment provider. Market and network fees are sponsored for this deposit." : "Fees include on-ramp, market, and network costs for this deposit.";
7249
7552
  const { rows: quoteFeeRows, chargeableUsd } = buildQuoteFeeRows(
7250
- _optionalChain([quote, 'optionalAccess', _353 => _353.fees, 'access', _354 => _354.breakdown]),
7553
+ _optionalChain([quote, 'optionalAccess', _375 => _375.fees, 'access', _376 => _376.breakdown]),
7251
7554
  sponsoredFeeTooltip
7252
7555
  );
7253
7556
  const feeRows = [];
@@ -7334,7 +7637,7 @@ function ProcessingStep({
7334
7637
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Ticker, { value: timerText }) })
7335
7638
  ] }),
7336
7639
  isSwappedOrder ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
7337
- _optionalChain([swappedFiatContext, 'optionalAccess', _355 => _355.paidAmountUsd]) != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
7640
+ _optionalChain([swappedFiatContext, 'optionalAccess', _377 => _377.paidAmountUsd]) != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
7338
7641
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "You pay" }),
7339
7642
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
7340
7643
  "$",
@@ -7346,7 +7649,7 @@ function ProcessingStep({
7346
7649
  ] })
7347
7650
  ] })
7348
7651
  ] }),
7349
- _optionalChain([swappedFiatContext, 'optionalAccess', _356 => _356.onrampFeeUsd]) != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
7652
+ _optionalChain([swappedFiatContext, 'optionalAccess', _378 => _378.onrampFeeUsd]) != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
7350
7653
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "On-ramp fee" }),
7351
7654
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
7352
7655
  "$",
@@ -7413,7 +7716,7 @@ function ProcessingStep({
7413
7716
  ) })
7414
7717
  ] })
7415
7718
  ] }) : (() => {
7416
- const { display, struck } = quoteFeeRow(_optionalChain([quote, 'optionalAccess', _357 => _357.fees]));
7719
+ const { display, struck } = quoteFeeRow(_optionalChain([quote, 'optionalAccess', _379 => _379.fees]));
7417
7720
  if (display !== null) {
7418
7721
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
7419
7722
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fees" }),
@@ -7542,7 +7845,8 @@ function computeRequestKey(input) {
7542
7845
  recipient: normalizeKeyToken(input.recipient),
7543
7846
  outputTokenRules: _nullishCoalesce(input.outputTokenRules, () => ( null)),
7544
7847
  rejectUnmapped: _nullishCoalesce(input.rejectUnmapped, () => ( null)),
7545
- forceRegister: _nullishCoalesce(input.forceRegister, () => ( false))
7848
+ forceRegister: _nullishCoalesce(input.forceRegister, () => ( false)),
7849
+ salt: _nullishCoalesce(input.salt, () => ( null))
7546
7850
  });
7547
7851
  }
7548
7852
  function computeCacheKey(input) {
@@ -7551,7 +7855,8 @@ function computeCacheKey(input) {
7551
7855
  targetToken: normalizeKeyToken(input.targetToken),
7552
7856
  recipient: normalizeKeyToken(input.recipient),
7553
7857
  outputTokenRules: _nullishCoalesce(input.outputTokenRules, () => ( null)),
7554
- rejectUnmapped: _nullishCoalesce(input.rejectUnmapped, () => ( null))
7858
+ rejectUnmapped: _nullishCoalesce(input.rejectUnmapped, () => ( null)),
7859
+ salt: _nullishCoalesce(input.salt, () => ( null))
7555
7860
  });
7556
7861
  }
7557
7862
  function computeIsCacheable(input) {
@@ -7562,7 +7867,7 @@ var setupRequestDedupe = /* @__PURE__ */ new Map();
7562
7867
  function readDedupedAccountSetupResult(requestKey) {
7563
7868
  const now = Date.now();
7564
7869
  const existing = setupRequestDedupe.get(requestKey);
7565
- if (_optionalChain([existing, 'optionalAccess', _358 => _358.settled]) && existing.expiresAt > now && existing.result) {
7870
+ if (_optionalChain([existing, 'optionalAccess', _380 => _380.settled]) && existing.expiresAt > now && existing.result) {
7566
7871
  return existing.result;
7567
7872
  }
7568
7873
  return null;
@@ -7583,7 +7888,7 @@ async function runAccountSetup(input, deps) {
7583
7888
  );
7584
7889
  }
7585
7890
  try {
7586
- const salt = deriveAccountSalt(input);
7891
+ const salt = _nullishCoalesce(input.salt, () => ( deriveAccountSalt(input)));
7587
7892
  debugLog(debug, "account-setup", "setup:start", {
7588
7893
  salt,
7589
7894
  recipient: input.recipient,
@@ -7596,7 +7901,7 @@ async function runAccountSetup(input, deps) {
7596
7901
  chain: _chunkOY5N3E6Lcjs.targetChainToCaip2.call(void 0, input.targetChain),
7597
7902
  token: input.targetToken,
7598
7903
  recipient: input.recipient,
7599
- ..._optionalChain([input, 'access', _359 => _359.outputTokenRules, 'optionalAccess', _360 => _360.length]) && {
7904
+ ..._optionalChain([input, 'access', _381 => _381.outputTokenRules, 'optionalAccess', _382 => _382.length]) && {
7600
7905
  outputTokenRules: input.outputTokenRules
7601
7906
  },
7602
7907
  ...input.rejectUnmapped != null && {
@@ -7777,4 +8082,10 @@ function mapError(error) {
7777
8082
 
7778
8083
 
7779
8084
 
7780
- exports.Modal = Modal; exports.WalletIcon = WalletIcon; exports.ExternalLinkIcon = ExternalLinkIcon; exports.CheckIcon = CheckIcon; exports.TransferCryptoIcon = TransferCryptoIcon; exports.ChevronLeftIcon = ChevronLeftIcon; exports.ChevronDownIcon = ChevronDownIcon; exports.CloseIcon = CloseIcon; exports.HandCoinsIcon = HandCoinsIcon; exports.InfoIcon = InfoIcon; exports.CopyIcon = CopyIcon; exports.CircleArrowOutUpLeftIcon = CircleArrowOutUpLeftIcon; exports.CardIcon = CardIcon; exports.BankIcon = BankIcon; exports.UnplugIcon = UnplugIcon; exports.MigrateAssetsIcon = MigrateAssetsIcon; exports.AppleIcon = AppleIcon; exports.BodyHeader = BodyHeader; exports.CdnIcon = CdnIcon; exports.ListRow = ListRow; exports.PoweredBy = PoweredBy; exports.Spinner = Spinner; exports.catalogKeyForChain = catalogKeyForChain; exports.debugLog = debugLog; exports.debugError = debugError; exports.getAssetId = getAssetId; exports.chainIdsByValue = chainIdsByValue; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.quoteFeeRow = quoteFeeRow; exports.SwappedConnectFeeChangedError = SwappedConnectFeeChangedError; exports.SUPPORTED_CONNECT_EXCHANGE_COUNT = SUPPORTED_CONNECT_EXCHANGE_COUNT; exports.resolveAppFeeBps = resolveAppFeeBps; exports.PermitDepositSubmitError = PermitDepositSubmitError; exports.createDepositService = createDepositService; exports.rpcUrlFor = rpcUrlFor; exports.RpcUrlsProvider = RpcUrlsProvider; exports.useRpcUrls = useRpcUrls; exports.useStableRpcUrls = useStableRpcUrls; exports.getPublicClient = getPublicClient; exports.peekRuntimeChains = peekRuntimeChains; exports.primeRuntimeChains = primeRuntimeChains; exports.useChainCatalog = useChainCatalog; exports.useCatalogChain = useCatalogChain; exports.useDepositChainIds = useDepositChainIds; exports.useDestinationChains = useDestinationChains; exports.useTargetTokens = useTargetTokens; exports.useIsDepositChain = useIsDepositChain; exports.useChainName = useChainName; exports.useReadClient = useReadClient; exports.useExplorerTxUrl = useExplorerTxUrl; exports.ChainCatalogProvider = ChainCatalogProvider; exports.getExchangeLogoSrc = getExchangeLogoSrc; exports.getExchangeLogo = getExchangeLogo; exports.useLatestRef = useLatestRef; exports.Button = Button; exports.Callout = Callout; exports.TokenIcon = TokenIcon; exports.currencyFormatter = currencyFormatter; exports.tokenFormatter = tokenFormatter; exports.isUnsupportedChainSwitchError = isUnsupportedChainSwitchError; exports.formatUserError = formatUserError; exports.Tooltip = Tooltip; exports.formatExpectedDuration = formatExpectedDuration; exports.markSubmissionUncertain = markSubmissionUncertain; exports.isSubmissionUncertain = isSubmissionUncertain; exports.formatTokenAmount = formatTokenAmount; exports.isDisplayStablecoinSymbol = isDisplayStablecoinSymbol; exports.isRecognizedToken = isRecognizedToken; exports.formatQuotedReceive = formatQuotedReceive; exports.formatReceiveEstimate = formatReceiveEstimate; exports.getEventTxHash = getEventTxHash; exports.getEventSourceDetails = getEventSourceDetails; exports.isDepositEvent = isDepositEvent; exports.isFailedEvent = isFailedEvent; exports.txRefsMatch = txRefsMatch; exports.failureMessageForEvent = failureMessageForEvent; exports.fetchTokenPriceUsd = fetchTokenPriceUsd; exports.useTokenPrices = useTokenPrices; exports.ProcessingStep = ProcessingStep; exports.AnalyticsSession = AnalyticsSession; exports.useDepositAnalyticsEmitter = useDepositAnalyticsEmitter; exports.useWithdrawAnalyticsEmitter = useWithdrawAnalyticsEmitter; exports.SetupError = SetupError; exports.deriveAccountSalt = deriveAccountSalt; exports.computeRequestKey = computeRequestKey; exports.computeCacheKey = computeCacheKey; exports.computeIsCacheable = computeIsCacheable; exports.readDedupedAccountSetupResult = readDedupedAccountSetupResult; exports.runAccountSetupDeduped = runAccountSetupDeduped; exports.HistoryEntryButton = HistoryEntryButton; exports.HistoryOverlay = HistoryOverlay; exports.useHistoryPanel = useHistoryPanel; exports.resolveThemeMode = resolveThemeMode; exports.followSystemAppearance = followSystemAppearance; exports.applyTheme = applyTheme; exports.warnRemovedProps = warnRemovedProps; exports.checkBackendUrl = checkBackendUrl; exports.isHistoryEntryVisible = isHistoryEntryVisible; exports.createHistoryAnalytics = createHistoryAnalytics; exports.analyticsTargetProperties = analyticsTargetProperties;
8085
+
8086
+
8087
+
8088
+
8089
+
8090
+
8091
+ exports.Modal = Modal; exports.WalletIcon = WalletIcon; exports.ExternalLinkIcon = ExternalLinkIcon; exports.CheckIcon = CheckIcon; exports.TransferCryptoIcon = TransferCryptoIcon; exports.ChevronLeftIcon = ChevronLeftIcon; exports.ChevronDownIcon = ChevronDownIcon; exports.CloseIcon = CloseIcon; exports.HandCoinsIcon = HandCoinsIcon; exports.InfoIcon = InfoIcon; exports.CopyIcon = CopyIcon; exports.CircleArrowOutUpLeftIcon = CircleArrowOutUpLeftIcon; exports.CardIcon = CardIcon; exports.BankIcon = BankIcon; exports.UnplugIcon = UnplugIcon; exports.MigrateAssetsIcon = MigrateAssetsIcon; exports.AppleIcon = AppleIcon; exports.BodyHeader = BodyHeader; exports.CdnIcon = CdnIcon; exports.ListRow = ListRow; exports.PoweredBy = PoweredBy; exports.Spinner = Spinner; exports.catalogKeyForChain = catalogKeyForChain; exports.debugLog = debugLog; exports.debugError = debugError; exports.getAssetId = getAssetId; exports.chainIdsByValue = chainIdsByValue; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.quoteFeeRow = quoteFeeRow; exports.SwappedConnectFeeChangedError = SwappedConnectFeeChangedError; exports.SUPPORTED_CONNECT_EXCHANGE_COUNT = SUPPORTED_CONNECT_EXCHANGE_COUNT; exports.resolveAppFeeBps = resolveAppFeeBps; exports.isDepositPolicyRefusal = isDepositPolicyRefusal; exports.PermitDepositSubmitError = PermitDepositSubmitError; exports.createDepositService = createDepositService; exports.depositBoundsViolation = depositBoundsViolation; exports.describePolicyRefusal = describePolicyRefusal; exports.rpcUrlFor = rpcUrlFor; exports.RpcUrlsProvider = RpcUrlsProvider; exports.useRpcUrls = useRpcUrls; exports.useStableRpcUrls = useStableRpcUrls; exports.getPublicClient = getPublicClient; exports.peekRuntimeChains = peekRuntimeChains; exports.primeRuntimeChains = primeRuntimeChains; exports.useChainCatalog = useChainCatalog; exports.useCatalogChain = useCatalogChain; exports.useDepositChainIds = useDepositChainIds; exports.useDestinationChains = useDestinationChains; exports.useTargetTokens = useTargetTokens; exports.useDepositOffer = useDepositOffer; exports.useDepositBounds = useDepositBounds; exports.useRestrictedListExclusion = useRestrictedListExclusion; exports.useIsDepositChain = useIsDepositChain; exports.useChainName = useChainName; exports.useReadClient = useReadClient; exports.useExplorerTxUrl = useExplorerTxUrl; exports.ChainCatalogProvider = ChainCatalogProvider; exports.getExchangeLogoSrc = getExchangeLogoSrc; exports.getExchangeLogo = getExchangeLogo; exports.useLatestRef = useLatestRef; exports.Button = Button; exports.Callout = Callout; exports.TokenIcon = TokenIcon; exports.currencyFormatter = currencyFormatter; exports.tokenFormatter = tokenFormatter; exports.isUnsupportedChainSwitchError = isUnsupportedChainSwitchError; exports.formatUserError = formatUserError; exports.Tooltip = Tooltip; exports.formatExpectedDuration = formatExpectedDuration; exports.markSubmissionUncertain = markSubmissionUncertain; exports.isSubmissionUncertain = isSubmissionUncertain; exports.formatTokenAmount = formatTokenAmount; exports.isDisplayStablecoinSymbol = isDisplayStablecoinSymbol; exports.isRecognizedToken = isRecognizedToken; exports.formatQuotedReceive = formatQuotedReceive; exports.formatReceiveEstimate = formatReceiveEstimate; exports.getEventTxHash = getEventTxHash; exports.getEventSourceDetails = getEventSourceDetails; exports.isDepositEvent = isDepositEvent; exports.isFailedEvent = isFailedEvent; exports.txRefsMatch = txRefsMatch; exports.failureMessageForEvent = failureMessageForEvent; exports.fetchTokenPriceUsd = fetchTokenPriceUsd; exports.useTokenPrices = useTokenPrices; exports.ProcessingStep = ProcessingStep; exports.AnalyticsSession = AnalyticsSession; exports.useDepositAnalyticsEmitter = useDepositAnalyticsEmitter; exports.useWithdrawAnalyticsEmitter = useWithdrawAnalyticsEmitter; exports.SetupError = SetupError; exports.deriveAccountSalt = deriveAccountSalt; exports.computeRequestKey = computeRequestKey; exports.computeCacheKey = computeCacheKey; exports.computeIsCacheable = computeIsCacheable; exports.readDedupedAccountSetupResult = readDedupedAccountSetupResult; exports.runAccountSetupDeduped = runAccountSetupDeduped; exports.HistoryEntryButton = HistoryEntryButton; exports.HistoryOverlay = HistoryOverlay; exports.useHistoryPanel = useHistoryPanel; exports.resolveThemeMode = resolveThemeMode; exports.followSystemAppearance = followSystemAppearance; exports.applyTheme = applyTheme; exports.warnRemovedProps = warnRemovedProps; exports.checkBackendUrl = checkBackendUrl; exports.isHistoryEntryVisible = isHistoryEntryVisible; exports.createHistoryAnalytics = createHistoryAnalytics; exports.analyticsTargetProperties = analyticsTargetProperties;