@rhinestone/deposit-modal 0.1.62 → 0.1.63

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.
@@ -21,7 +21,7 @@
21
21
 
22
22
 
23
23
 
24
- var _chunkMVFMDKAScjs = require('./chunk-MVFMDKAS.cjs');
24
+ var _chunk5SR5N75Icjs = require('./chunk-5SR5N75I.cjs');
25
25
 
26
26
 
27
27
 
@@ -142,7 +142,7 @@ function WithdrawFormStep({
142
142
  setIsSwitching(true);
143
143
  switchChain(asset.chainId).catch((err) => {
144
144
  const raw = err instanceof Error ? err.message : "Failed to switch chain";
145
- setError(_chunkMVFMDKAScjs.formatUserError.call(void 0, raw));
145
+ setError(_chunk5SR5N75Icjs.formatUserError.call(void 0, raw));
146
146
  }).finally(() => {
147
147
  setIsSwitching(false);
148
148
  });
@@ -162,7 +162,7 @@ function WithdrawFormStep({
162
162
  return;
163
163
  }
164
164
  try {
165
- const bal = _chunkMVFMDKAScjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
165
+ const bal = _chunk5SR5N75Icjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
166
166
  address: asset.token,
167
167
  abi: _viem.erc20Abi,
168
168
  functionName: "balanceOf",
@@ -265,7 +265,7 @@ function WithdrawFormStep({
265
265
  await onSubmit(recipient, amount);
266
266
  } catch (err) {
267
267
  const raw = err instanceof Error ? err.message : "Withdrawal failed";
268
- setError(_chunkMVFMDKAScjs.formatUserError.call(void 0, raw));
268
+ setError(_chunk5SR5N75Icjs.formatUserError.call(void 0, raw));
269
269
  } finally {
270
270
  setIsSubmitting(false);
271
271
  }
@@ -273,11 +273,11 @@ function WithdrawFormStep({
273
273
  if (isBalanceLoading) {
274
274
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
275
275
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-withdraw-loading", children: [
276
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.Spinner, { className: "rs-spinner--lg" }),
276
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5SR5N75Icjs.Spinner, { className: "rs-spinner--lg" }),
277
277
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-title", children: "Loading on-chain balance" }),
278
278
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-subtitle", children: chainMismatch ? `Switch to ${_chunkR6U6BHCVcjs.getChainName.call(void 0, asset.chainId)} to continue.` : "Please wait before withdrawing." })
279
279
  ] }),
280
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.PoweredBy, {})
280
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5SR5N75Icjs.PoweredBy, {})
281
281
  ] });
282
282
  }
283
283
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
@@ -376,7 +376,7 @@ function WithdrawFormStep({
376
376
  ] })
377
377
  ] }),
378
378
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-amount-info", children: [
379
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunkMVFMDKAScjs.currencyFormatter.format(amountUsd) : "$0.00" }),
379
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunk5SR5N75Icjs.currencyFormatter.format(amountUsd) : "$0.00" }),
380
380
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
381
381
  "Balance: ",
382
382
  formattedBalance,
@@ -570,7 +570,7 @@ function WithdrawFormStep({
570
570
  ] })
571
571
  ] }),
572
572
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
573
- _chunkMVFMDKAScjs.Button,
573
+ _chunk5SR5N75Icjs.Button,
574
574
  {
575
575
  onClick: handleWithdraw,
576
576
  fullWidth: true,
@@ -579,7 +579,7 @@ function WithdrawFormStep({
579
579
  children: isBusy ? "Preparing..." : !recipient ? "Enter Recipient Address" : !amount ? "Enter Withdraw Amount" : "Withdraw"
580
580
  }
581
581
  ) }),
582
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.PoweredBy, {})
582
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5SR5N75Icjs.PoweredBy, {})
583
583
  ] });
584
584
  }
585
585
  WithdrawFormStep.displayName = "WithdrawFormStep";
@@ -906,22 +906,22 @@ function WithdrawFlow({
906
906
  onError,
907
907
  debug
908
908
  }) {
909
- const onStepChangeRef = _chunkMVFMDKAScjs.useLatestRef.call(void 0, onStepChange);
910
- const onTotalBalanceChangeRef = _chunkMVFMDKAScjs.useLatestRef.call(void 0, onTotalBalanceChange);
911
- const onEventRef = _chunkMVFMDKAScjs.useLatestRef.call(void 0, onEvent);
909
+ const onStepChangeRef = _chunk5SR5N75Icjs.useLatestRef.call(void 0, onStepChange);
910
+ const onTotalBalanceChangeRef = _chunk5SR5N75Icjs.useLatestRef.call(void 0, onTotalBalanceChange);
911
+ const onEventRef = _chunk5SR5N75Icjs.useLatestRef.call(void 0, onEvent);
912
912
  const [step, setStep] = _react.useState.call(void 0, { type: "form" });
913
913
  const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
914
914
  const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
915
915
  const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = _react.useState.call(void 0, false);
916
916
  const logFlow = _react.useCallback.call(void 0,
917
917
  (message, data) => {
918
- _chunkMVFMDKAScjs.debugLog.call(void 0, debug, "withdraw-flow", message, data);
918
+ _chunk5SR5N75Icjs.debugLog.call(void 0, debug, "withdraw-flow", message, data);
919
919
  },
920
920
  [debug]
921
921
  );
922
922
  const logFlowError = _react.useCallback.call(void 0,
923
923
  (message, error, data) => {
924
- _chunkMVFMDKAScjs.debugError.call(void 0, debug, "withdraw-flow", message, error, data);
924
+ _chunk5SR5N75Icjs.debugError.call(void 0, debug, "withdraw-flow", message, error, data);
925
925
  },
926
926
  [debug]
927
927
  );
@@ -980,14 +980,14 @@ function WithdrawFlow({
980
980
  return {
981
981
  ownerAddress: dappAddress,
982
982
  walletClient: _nullishCoalesce(dappWalletClient, () => ( void 0)),
983
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, sourceChain))),
983
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunk5SR5N75Icjs.getPublicClient.call(void 0, sourceChain))),
984
984
  switchChain: dappSwitchChain
985
985
  };
986
986
  }
987
987
  return {
988
988
  ownerAddress: dappWalletClient.account.address,
989
989
  walletClient: dappWalletClient,
990
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, sourceChain))),
990
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunk5SR5N75Icjs.getPublicClient.call(void 0, sourceChain))),
991
991
  switchChain: dappSwitchChain
992
992
  };
993
993
  }
@@ -998,7 +998,7 @@ function WithdrawFlow({
998
998
  return {
999
999
  ownerAddress: dappWalletClient.account.address,
1000
1000
  walletClient: dappWalletClient,
1001
- publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, sourceChain))),
1001
+ publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunk5SR5N75Icjs.getPublicClient.call(void 0, sourceChain))),
1002
1002
  switchChain: dappSwitchChain
1003
1003
  };
1004
1004
  }
@@ -1028,7 +1028,7 @@ function WithdrawFlow({
1028
1028
  const symbol = _chunkR6U6BHCVcjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
1029
1029
  const decimals = _chunkR6U6BHCVcjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
1030
1030
  return {
1031
- id: _chunkMVFMDKAScjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
1031
+ id: _chunk5SR5N75Icjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
1032
1032
  chainId: sourceChain,
1033
1033
  token: sourceToken,
1034
1034
  symbol,
@@ -1099,15 +1099,15 @@ function WithdrawFlow({
1099
1099
  [logFlowError, onError]
1100
1100
  );
1101
1101
  const resolveSessionOwner = _react.useCallback.call(void 0, async (eoaAddress) => {
1102
- const localOwner = _chunkMVFMDKAScjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
1102
+ const localOwner = _chunk5SR5N75Icjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
1103
1103
  if (localOwner) {
1104
1104
  return {
1105
- account: _chunkMVFMDKAScjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
1105
+ account: _chunk5SR5N75Icjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
1106
1106
  address: localOwner.address
1107
1107
  };
1108
1108
  }
1109
- const created = _chunkMVFMDKAScjs.createSessionOwnerKey.call(void 0, );
1110
- _chunkMVFMDKAScjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
1109
+ const created = _chunk5SR5N75Icjs.createSessionOwnerKey.call(void 0, );
1110
+ _chunk5SR5N75Icjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
1111
1111
  return {
1112
1112
  account: created.account,
1113
1113
  address: created.address
@@ -1147,7 +1147,7 @@ function WithdrawFlow({
1147
1147
  const setup = await service.setupAccount({
1148
1148
  ownerAddress: ownerAddress2,
1149
1149
  sessionOwnerAddress: sessionOwner.address,
1150
- targetChain: _chunkMVFMDKAScjs.toEvmCaip2.call(void 0, targetChain),
1150
+ targetChain: _chunk5SR5N75Icjs.toEvmCaip2.call(void 0, targetChain),
1151
1151
  targetToken,
1152
1152
  signerAddress,
1153
1153
  sessionChainIds,
@@ -1174,7 +1174,7 @@ function WithdrawFlow({
1174
1174
  primaryType: typedData.primaryType,
1175
1175
  message: typedData.message
1176
1176
  });
1177
- const sessionDetails = _chunkMVFMDKAScjs.buildSessionDetails.call(void 0,
1177
+ const sessionDetails = _chunk5SR5N75Icjs.buildSessionDetails.call(void 0,
1178
1178
  setup.sessionDetailsUnsigned,
1179
1179
  signature
1180
1180
  );
@@ -1188,7 +1188,7 @@ function WithdrawFlow({
1188
1188
  eoaAddress: ownerAddress2,
1189
1189
  sessionOwner: sessionOwner.address,
1190
1190
  target: {
1191
- chain: _chunkMVFMDKAScjs.toEvmCaip2.call(void 0, targetChain),
1191
+ chain: _chunk5SR5N75Icjs.toEvmCaip2.call(void 0, targetChain),
1192
1192
  token: targetToken,
1193
1193
  recipient
1194
1194
  }
@@ -1197,7 +1197,7 @@ function WithdrawFlow({
1197
1197
  }
1198
1198
  handleConnected(ownerAddress2, smartAccount);
1199
1199
  const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
1200
- const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _31 => _31.publicClient]), () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, sourceChain)));
1200
+ const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _31 => _31.publicClient]), () => ( _chunk5SR5N75Icjs.getPublicClient.call(void 0, sourceChain)));
1201
1201
  let result;
1202
1202
  if (onSignTransaction) {
1203
1203
  const transferData = isSourceNative ? { to: smartAccount, value: amountUnits, data: "0x" } : {
@@ -1220,7 +1220,7 @@ function WithdrawFlow({
1220
1220
  const { signature } = await onSignTransaction(request);
1221
1221
  const relayResult = await service.relayWithdraw({
1222
1222
  smartAccount,
1223
- chainId: _chunkMVFMDKAScjs.toEvmCaip2.call(void 0, sourceChain),
1223
+ chainId: _chunk5SR5N75Icjs.toEvmCaip2.call(void 0, sourceChain),
1224
1224
  safeAddress,
1225
1225
  safeTransaction: request.typedData.message,
1226
1226
  signature
@@ -1278,7 +1278,7 @@ function WithdrawFlow({
1278
1278
  targetChain,
1279
1279
  targetToken
1280
1280
  });
1281
- handleError(_chunkMVFMDKAScjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
1281
+ handleError(_chunk5SR5N75Icjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
1282
1282
  throw err;
1283
1283
  } finally {
1284
1284
  setIsSubmitting(false);
@@ -1415,7 +1415,7 @@ function WithdrawFlow({
1415
1415
  }, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess', _46 => _46.icon])]);
1416
1416
  if (showConnectStep) {
1417
1417
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1418
- _chunkMVFMDKAScjs.ConnectStep,
1418
+ _chunk5SR5N75Icjs.ConnectStep,
1419
1419
  {
1420
1420
  walletOptions,
1421
1421
  selectedWalletId: selectedWalletIdEffective,
@@ -1438,7 +1438,7 @@ function WithdrawFlow({
1438
1438
  const resolvedOwnerAddress = signerContext.ownerAddress;
1439
1439
  const resolvedConnectedAddress = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _47 => _47.walletClient, 'optionalAccess', _48 => _48.account, 'optionalAccess', _49 => _49.address]), () => ( _optionalChain([reownWallet, 'optionalAccess', _50 => _50.address]))), () => ( _optionalChain([dappWalletClient, 'optionalAccess', _51 => _51.account, 'optionalAccess', _52 => _52.address]))), () => ( resolvedOwnerAddress));
1440
1440
  const resolvedDefaultRecipient = _nullishCoalesce(defaultRecipient, () => ( resolvedConnectedAddress));
1441
- const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, sourceChain)));
1441
+ const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunk5SR5N75Icjs.getPublicClient.call(void 0, sourceChain)));
1442
1442
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
1443
1443
  step.type === "form" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1444
1444
  WithdrawFormStep,
@@ -1465,7 +1465,7 @@ function WithdrawFlow({
1465
1465
  }
1466
1466
  ),
1467
1467
  step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1468
- _chunkMVFMDKAScjs.ProcessingStep,
1468
+ _chunk5SR5N75Icjs.ProcessingStep,
1469
1469
  {
1470
1470
  smartAccount: step.smartAccount,
1471
1471
  txHash: step.txHash,
@@ -1491,7 +1491,7 @@ function WithdrawFlow({
1491
1491
  // src/WithdrawModal.tsx
1492
1492
 
1493
1493
  var ReownWithdrawInner = _react.lazy.call(void 0,
1494
- () => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-K73XDERE.cjs"))).then((m) => ({
1494
+ () => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-RCQFBPOF.cjs"))).then((m) => ({
1495
1495
  default: m.WithdrawModalReown
1496
1496
  }))
1497
1497
  );
@@ -1544,19 +1544,19 @@ function WithdrawModalInner({
1544
1544
  debug
1545
1545
  }) {
1546
1546
  const modalRef = _react.useRef.call(void 0, null);
1547
- const onReadyRef = _chunkMVFMDKAScjs.useLatestRef.call(void 0, onReady);
1547
+ const onReadyRef = _chunk5SR5N75Icjs.useLatestRef.call(void 0, onReady);
1548
1548
  const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
1549
1549
  const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
1550
1550
  const backHandlerRef = _react.useRef.call(void 0, void 0);
1551
1551
  const targetChain = _chunkR6U6BHCVcjs.getChainId.call(void 0, targetChainProp);
1552
1552
  const sourceChain = _chunkR6U6BHCVcjs.getChainId.call(void 0, sourceChainProp);
1553
1553
  const service = _react.useMemo.call(void 0,
1554
- () => _chunkMVFMDKAScjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:withdraw" }),
1554
+ () => _chunk5SR5N75Icjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:withdraw" }),
1555
1555
  [backendUrl, debug]
1556
1556
  );
1557
1557
  _react.useEffect.call(void 0, () => {
1558
1558
  if (isOpen && modalRef.current) {
1559
- _chunkMVFMDKAScjs.applyTheme.call(void 0, modalRef.current, theme);
1559
+ _chunk5SR5N75Icjs.applyTheme.call(void 0, modalRef.current, theme);
1560
1560
  }
1561
1561
  }, [isOpen, theme]);
1562
1562
  const hasCalledReady = _react.useRef.call(void 0, false);
@@ -1592,7 +1592,7 @@ function WithdrawModalInner({
1592
1592
  const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _62 => _62.title]), () => ( "Withdraw"));
1593
1593
  const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
1594
1594
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1595
- _chunkMVFMDKAScjs.Modal,
1595
+ _chunk5SR5N75Icjs.Modal,
1596
1596
  {
1597
1597
  isOpen,
1598
1598
  onClose,
@@ -1651,7 +1651,7 @@ function WithdrawModalInner({
1651
1651
  ] }),
1652
1652
  balance && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-balance", children: [
1653
1653
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-label", children: balance.title }),
1654
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkMVFMDKAScjs.currencyFormatter.format(totalBalanceUsd) : null))) })
1654
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunk5SR5N75Icjs.currencyFormatter.format(totalBalanceUsd) : null))) })
1655
1655
  ] })
1656
1656
  ] }),
1657
1657
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -1358,6 +1358,10 @@ function getEventTxHash(event) {
1358
1358
  const source = isRecord(event.data?.source) ? event.data.source : void 0;
1359
1359
  return asString(deposit?.transactionHash) ?? asString(source?.transactionHash);
1360
1360
  }
1361
+ if (event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed") {
1362
+ const deposit = isRecord(event.data?.deposit) ? event.data.deposit : void 0;
1363
+ return asString(deposit?.transactionHash);
1364
+ }
1361
1365
  return void 0;
1362
1366
  }
1363
1367
  function getEventSourceDetails(event) {
@@ -1371,7 +1375,7 @@ function getEventSourceDetails(event) {
1371
1375
  }
1372
1376
  const source = isRecord(event.data.source) ? event.data.source : void 0;
1373
1377
  const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
1374
- if (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error") {
1378
+ if (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error" || event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed") {
1375
1379
  return {
1376
1380
  chainId: asNumber(source?.chain) ?? asNumber(deposit?.chain),
1377
1381
  amount: asAmount(source?.amount) ?? asAmount(deposit?.amount),
@@ -1381,7 +1385,7 @@ function getEventSourceDetails(event) {
1381
1385
  return {};
1382
1386
  }
1383
1387
  function isDepositEvent(event) {
1384
- return event?.type === "deposit-received" || event?.type === "bridge-started" || event?.type === "bridge-complete" || event?.type === "bridge-failed" || event?.type === "error";
1388
+ return event?.type === "deposit-received" || event?.type === "bridge-started" || event?.type === "bridge-complete" || event?.type === "bridge-failed" || event?.type === "post-bridge-swap-complete" || event?.type === "post-bridge-swap-failed" || event?.type === "error";
1385
1389
  }
1386
1390
  function isHexString(value) {
1387
1391
  return value.startsWith("0x") || value.startsWith("0X");
@@ -1475,9 +1479,9 @@ function parseWebhookTimestamp(event) {
1475
1479
  function syncPhaseTimings(previous, event) {
1476
1480
  if (!event?.type) return previous;
1477
1481
  const timestamp = parseWebhookTimestamp(event) ?? Date.now();
1478
- 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;
1479
- const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete") && previous.bridgingAt === void 0;
1480
- const setCompleted = event.type === "bridge-complete" && previous.completedAt === void 0;
1482
+ const setReceived = (event.type === "deposit-received" || event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed" || event.type === "error") && previous.receivedAt === void 0;
1483
+ const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "post-bridge-swap-complete") && previous.bridgingAt === void 0;
1484
+ const setCompleted = (event.type === "bridge-complete" || event.type === "post-bridge-swap-complete") && previous.completedAt === void 0;
1481
1485
  if (!setReceived && !setBridging && !setCompleted) return previous;
1482
1486
  return {
1483
1487
  ...previous,
@@ -1514,7 +1518,8 @@ function getCurrentPhaseId(state, phaseTimings, isEarlyComplete) {
1514
1518
  if (state.type === "complete") {
1515
1519
  return void 0;
1516
1520
  }
1517
- if (state.lastEvent?.type === "bridge-started") return "bridging";
1521
+ if (state.lastEvent?.type === "bridge-started" || state.lastEvent?.type === "bridge-complete")
1522
+ return "bridging";
1518
1523
  if (state.lastEvent?.type === "deposit-received") return "received";
1519
1524
  return "confirming";
1520
1525
  }
@@ -1528,6 +1533,7 @@ function ProcessingStep({
1528
1533
  sourceSymbol: providedSourceSymbol,
1529
1534
  sourceDecimals: providedSourceDecimals,
1530
1535
  waitForFinalTx,
1536
+ hasPostBridgeActions,
1531
1537
  service,
1532
1538
  directTransfer,
1533
1539
  flowLabel = "deposit",
@@ -1640,7 +1646,40 @@ function ProcessingStep({
1640
1646
  });
1641
1647
  }
1642
1648
  if (!isMounted) return;
1643
- if (eventForCurrentTx?.type === "bridge-complete") {
1649
+ const awaitingPostBridgeSwap = waitForFinalTx && hasPostBridgeActions;
1650
+ if (eventForCurrentTx?.type === "post-bridge-swap-complete") {
1651
+ setState({ type: "complete", lastEvent: eventForCurrentTx });
1652
+ const swapTxHash = eventForCurrentTx.data?.swap?.transactionHash;
1653
+ debugLog(debug, "processing", "state:complete", {
1654
+ txHash,
1655
+ destinationTxHash: swapTxHash,
1656
+ event: eventForCurrentTx.type
1657
+ });
1658
+ onDepositComplete?.(txHash, swapTxHash, {
1659
+ amount,
1660
+ sourceChain,
1661
+ sourceToken,
1662
+ targetChain,
1663
+ targetToken
1664
+ });
1665
+ return;
1666
+ }
1667
+ if (eventForCurrentTx?.type === "post-bridge-swap-failed") {
1668
+ const formatted = formatBridgeFailedMessage(eventForCurrentTx);
1669
+ setState({
1670
+ type: "failed",
1671
+ message: formatted.message,
1672
+ lastEvent: eventForCurrentTx
1673
+ });
1674
+ debugLog(debug, "processing", "state:failed", {
1675
+ txHash,
1676
+ message: formatted.message,
1677
+ code: formatted.code
1678
+ });
1679
+ onDepositFailed?.(txHash, formatted.message);
1680
+ return;
1681
+ }
1682
+ if (eventForCurrentTx?.type === "bridge-complete" && !awaitingPostBridgeSwap) {
1644
1683
  setState({ type: "complete", lastEvent: eventForCurrentTx });
1645
1684
  const destinationTxHash2 = eventForCurrentTx.data?.destination?.transactionHash;
1646
1685
  debugLog(debug, "processing", "state:complete", {
@@ -1739,6 +1778,7 @@ function ProcessingStep({
1739
1778
  amount,
1740
1779
  debug,
1741
1780
  directTransfer,
1781
+ hasPostBridgeActions,
1742
1782
  onDepositComplete,
1743
1783
  onDepositFailed,
1744
1784
  service,
@@ -1775,12 +1815,15 @@ function ProcessingStep({
1775
1815
  const timelineNowMs = phaseTimings.endedAt ?? Date.now();
1776
1816
  const flowNoun = flowLabel === "withdraw" ? "withdrawal" : "deposit";
1777
1817
  const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : "Deposit";
1778
- const destinationTxHash = lastEvent?.data?.destination?.transactionHash || null;
1818
+ const isPostBridgeSwapEvent = lastEvent?.type === "post-bridge-swap-complete" || lastEvent?.type === "post-bridge-swap-failed";
1819
+ const destinationTxHash = isPostBridgeSwapEvent ? lastEvent?.data?.swap?.transactionHash || null : lastEvent?.data?.destination?.transactionHash || null;
1820
+ const bridgeTxHash = isPostBridgeSwapEvent ? lastEvent?.data?.bridge?.transactionHash || null : null;
1779
1821
  const sourceDetails = getEventSourceDetails(lastEvent);
1780
1822
  const displaySourceChain = sourceDetails.chainId ?? sourceChain;
1781
1823
  const displaySourceToken = sourceDetails.token ?? sourceToken;
1782
1824
  const displayAmount = sourceDetails.amount ?? amount;
1783
1825
  const sourceExplorerUrl = getExplorerTxUrl(displaySourceChain, txHash);
1826
+ const bridgeExplorerUrl = bridgeTxHash ? getExplorerTxUrl(targetChain, bridgeTxHash) : null;
1784
1827
  const destExplorerUrl = destinationTxHash ? getExplorerTxUrl(targetChain, destinationTxHash) : null;
1785
1828
  const isEvmSourceToken = /^0x[a-fA-F0-9]{40}$/.test(displaySourceToken);
1786
1829
  const sourceSymbol = displaySourceChain === "solana" ? providedSourceSymbol ?? "SOL" : isEvmSourceToken ? getTokenSymbol(displaySourceToken, displaySourceChain) : providedSourceSymbol ?? "Token";
@@ -2011,8 +2054,25 @@ function ProcessingStep({
2011
2054
  }
2012
2055
  ) : /* @__PURE__ */ jsx7("span", { style: { fontFamily: "ui-monospace, SFMono-Regular, monospace", fontSize: 12 }, children: truncateHash(txHash) }) })
2013
2056
  ] }),
2057
+ bridgeTxHash && /* @__PURE__ */ jsxs6("div", { className: "rs-card-row", children: [
2058
+ /* @__PURE__ */ jsx7("span", { className: "rs-card-label", children: "Bridge tx" }),
2059
+ /* @__PURE__ */ jsx7("span", { className: "rs-card-value", children: bridgeExplorerUrl ? /* @__PURE__ */ jsxs6(
2060
+ "a",
2061
+ {
2062
+ href: bridgeExplorerUrl,
2063
+ target: "_blank",
2064
+ rel: "noopener noreferrer",
2065
+ className: "rs-card-external-link",
2066
+ style: { gap: 4, fontFamily: "ui-monospace, SFMono-Regular, monospace", fontSize: 12 },
2067
+ children: [
2068
+ truncateHash(bridgeTxHash),
2069
+ txLinkIcon
2070
+ ]
2071
+ }
2072
+ ) : /* @__PURE__ */ jsx7("span", { style: { fontFamily: "ui-monospace, SFMono-Regular, monospace", fontSize: 12 }, children: truncateHash(bridgeTxHash) }) })
2073
+ ] }),
2014
2074
  destinationTxHash && /* @__PURE__ */ jsxs6("div", { className: "rs-card-row", children: [
2015
- /* @__PURE__ */ jsx7("span", { className: "rs-card-label", children: "Destination tx" }),
2075
+ /* @__PURE__ */ jsx7("span", { className: "rs-card-label", children: bridgeTxHash ? "Swap tx" : "Destination tx" }),
2016
2076
  /* @__PURE__ */ jsx7("span", { className: "rs-card-value", children: destExplorerUrl ? /* @__PURE__ */ jsxs6(
2017
2077
  "a",
2018
2078
  {
@@ -26,7 +26,7 @@ import {
26
26
  tokenFormatter,
27
27
  txRefsMatch,
28
28
  useLatestRef
29
- } from "./chunk-NDTY5AUU.mjs";
29
+ } from "./chunk-TDTBAZNO.mjs";
30
30
  import {
31
31
  DEFAULT_BACKEND_URL,
32
32
  DEFAULT_SIGNER_ADDRESS,
@@ -3408,6 +3408,7 @@ function DepositFlow({
3408
3408
  sourceSymbol: step.sourceSymbol,
3409
3409
  sourceDecimals: step.sourceDecimals,
3410
3410
  waitForFinalTx,
3411
+ hasPostBridgeActions: Boolean(postBridgeActions?.length),
3411
3412
  service,
3412
3413
  directTransfer: step.directTransfer,
3413
3414
  onClose,
@@ -3531,6 +3532,7 @@ function DepositFlow({
3531
3532
  sourceSymbol: step.sourceSymbol,
3532
3533
  sourceDecimals: step.sourceDecimals,
3533
3534
  waitForFinalTx,
3535
+ hasPostBridgeActions: Boolean(postBridgeActions?.length),
3534
3536
  service,
3535
3537
  directTransfer: step.directTransfer,
3536
3538
  onClose,
@@ -3646,6 +3648,7 @@ function DepositFlow({
3646
3648
  sourceSymbol: step.sourceSymbol,
3647
3649
  sourceDecimals: step.sourceDecimals,
3648
3650
  waitForFinalTx,
3651
+ hasPostBridgeActions: Boolean(postBridgeActions?.length),
3649
3652
  service,
3650
3653
  directTransfer: step.directTransfer,
3651
3654
  onClose,
@@ -3662,7 +3665,7 @@ function DepositFlow({
3662
3665
  // src/DepositModal.tsx
3663
3666
  import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
3664
3667
  var ReownDepositInner = lazy(
3665
- () => import("./DepositModalReown-5CFJIJO5.mjs").then((m) => ({ default: m.DepositModalReown }))
3668
+ () => import("./DepositModalReown-XOLZ62BQ.mjs").then((m) => ({ default: m.DepositModalReown }))
3666
3669
  );
3667
3670
  function DepositModal(props) {
3668
3671
  const needsReown = !!props.reownAppId;
package/dist/deposit.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk6UBIFHRVcjs = require('./chunk-6UBIFHRV.cjs');
4
- require('./chunk-MVFMDKAS.cjs');
3
+ var _chunkN3BZTUSJcjs = require('./chunk-N3BZTUSJ.cjs');
4
+ require('./chunk-5SR5N75I.cjs');
5
5
  require('./chunk-R6U6BHCV.cjs');
6
6
 
7
7
 
8
- exports.DepositModal = _chunk6UBIFHRVcjs.DepositModal;
8
+ exports.DepositModal = _chunkN3BZTUSJcjs.DepositModal;
package/dist/deposit.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DepositModal
3
- } from "./chunk-QME5ZAI6.mjs";
4
- import "./chunk-NDTY5AUU.mjs";
3
+ } from "./chunk-XVCPUB6K.mjs";
4
+ import "./chunk-TDTBAZNO.mjs";
5
5
  import "./chunk-CIXHTOO3.mjs";
6
6
  export {
7
7
  DepositModal
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk6UBIFHRVcjs = require('./chunk-6UBIFHRV.cjs');
3
+ var _chunkN3BZTUSJcjs = require('./chunk-N3BZTUSJ.cjs');
4
4
 
5
5
 
6
- var _chunkMKU7VETPcjs = require('./chunk-MKU7VETP.cjs');
7
- require('./chunk-MVFMDKAS.cjs');
6
+ var _chunkOFGBTU45cjs = require('./chunk-OFGBTU45.cjs');
7
+ require('./chunk-5SR5N75I.cjs');
8
8
 
9
9
 
10
10
 
@@ -66,4 +66,4 @@ var _chunkR6U6BHCVcjs = require('./chunk-R6U6BHCV.cjs');
66
66
 
67
67
 
68
68
 
69
- exports.CHAIN_BY_ID = _chunkR6U6BHCVcjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkR6U6BHCVcjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkR6U6BHCVcjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal = _chunk6UBIFHRVcjs.DepositModal; exports.NATIVE_TOKEN_ADDRESS = _chunkR6U6BHCVcjs.NATIVE_TOKEN_ADDRESS; exports.SOURCE_CHAINS = _chunkR6U6BHCVcjs.SOURCE_CHAINS; exports.SUPPORTED_CHAINS = _chunkR6U6BHCVcjs.SUPPORTED_CHAINS; exports.WithdrawModal = _chunkMKU7VETPcjs.WithdrawModal; exports.chainRegistry = _chunkR6U6BHCVcjs.chainRegistry; exports.findChainIdForToken = _chunkR6U6BHCVcjs.findChainIdForToken; exports.getChainBadge = _chunkR6U6BHCVcjs.getChainBadge; exports.getChainIcon = _chunkR6U6BHCVcjs.getChainIcon; exports.getChainId = _chunkR6U6BHCVcjs.getChainId; exports.getChainName = _chunkR6U6BHCVcjs.getChainName; exports.getChainObject = _chunkR6U6BHCVcjs.getChainObject; exports.getExplorerName = _chunkR6U6BHCVcjs.getExplorerName; exports.getExplorerTxUrl = _chunkR6U6BHCVcjs.getExplorerTxUrl; exports.getExplorerUrl = _chunkR6U6BHCVcjs.getExplorerUrl; exports.getSupportedChainIds = _chunkR6U6BHCVcjs.getSupportedChainIds; exports.getSupportedTargetTokens = _chunkR6U6BHCVcjs.getSupportedTargetTokens; exports.getSupportedTokenSymbolsForChain = _chunkR6U6BHCVcjs.getSupportedTokenSymbolsForChain; exports.getTargetTokenSymbolsForChain = _chunkR6U6BHCVcjs.getTargetTokenSymbolsForChain; exports.getTokenAddress = _chunkR6U6BHCVcjs.getTokenAddress; exports.getTokenDecimals = _chunkR6U6BHCVcjs.getTokenDecimals; exports.getTokenDecimalsByAddress = _chunkR6U6BHCVcjs.getTokenDecimalsByAddress; exports.getTokenIcon = _chunkR6U6BHCVcjs.getTokenIcon; exports.getTokenSymbol = _chunkR6U6BHCVcjs.getTokenSymbol; exports.getUsdcAddress = _chunkR6U6BHCVcjs.getUsdcAddress; exports.getUsdcDecimals = _chunkR6U6BHCVcjs.getUsdcDecimals; exports.isSupportedTokenAddressForChain = _chunkR6U6BHCVcjs.isSupportedTokenAddressForChain;
69
+ exports.CHAIN_BY_ID = _chunkR6U6BHCVcjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkR6U6BHCVcjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkR6U6BHCVcjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal = _chunkN3BZTUSJcjs.DepositModal; exports.NATIVE_TOKEN_ADDRESS = _chunkR6U6BHCVcjs.NATIVE_TOKEN_ADDRESS; exports.SOURCE_CHAINS = _chunkR6U6BHCVcjs.SOURCE_CHAINS; exports.SUPPORTED_CHAINS = _chunkR6U6BHCVcjs.SUPPORTED_CHAINS; exports.WithdrawModal = _chunkOFGBTU45cjs.WithdrawModal; exports.chainRegistry = _chunkR6U6BHCVcjs.chainRegistry; exports.findChainIdForToken = _chunkR6U6BHCVcjs.findChainIdForToken; exports.getChainBadge = _chunkR6U6BHCVcjs.getChainBadge; exports.getChainIcon = _chunkR6U6BHCVcjs.getChainIcon; exports.getChainId = _chunkR6U6BHCVcjs.getChainId; exports.getChainName = _chunkR6U6BHCVcjs.getChainName; exports.getChainObject = _chunkR6U6BHCVcjs.getChainObject; exports.getExplorerName = _chunkR6U6BHCVcjs.getExplorerName; exports.getExplorerTxUrl = _chunkR6U6BHCVcjs.getExplorerTxUrl; exports.getExplorerUrl = _chunkR6U6BHCVcjs.getExplorerUrl; exports.getSupportedChainIds = _chunkR6U6BHCVcjs.getSupportedChainIds; exports.getSupportedTargetTokens = _chunkR6U6BHCVcjs.getSupportedTargetTokens; exports.getSupportedTokenSymbolsForChain = _chunkR6U6BHCVcjs.getSupportedTokenSymbolsForChain; exports.getTargetTokenSymbolsForChain = _chunkR6U6BHCVcjs.getTargetTokenSymbolsForChain; exports.getTokenAddress = _chunkR6U6BHCVcjs.getTokenAddress; exports.getTokenDecimals = _chunkR6U6BHCVcjs.getTokenDecimals; exports.getTokenDecimalsByAddress = _chunkR6U6BHCVcjs.getTokenDecimalsByAddress; exports.getTokenIcon = _chunkR6U6BHCVcjs.getTokenIcon; exports.getTokenSymbol = _chunkR6U6BHCVcjs.getTokenSymbol; exports.getUsdcAddress = _chunkR6U6BHCVcjs.getUsdcAddress; exports.getUsdcDecimals = _chunkR6U6BHCVcjs.getUsdcDecimals; exports.isSupportedTokenAddressForChain = _chunkR6U6BHCVcjs.isSupportedTokenAddressForChain;
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  DepositModal
3
- } from "./chunk-QME5ZAI6.mjs";
3
+ } from "./chunk-XVCPUB6K.mjs";
4
4
  import {
5
5
  WithdrawModal
6
- } from "./chunk-7YERRXZ4.mjs";
7
- import "./chunk-NDTY5AUU.mjs";
6
+ } from "./chunk-2IFX6ZEE.mjs";
7
+ import "./chunk-TDTBAZNO.mjs";
8
8
  import {
9
9
  CHAIN_BY_ID,
10
10
  DEFAULT_BACKEND_URL,
package/dist/reown.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk6UBIFHRVcjs = require('./chunk-6UBIFHRV.cjs');
3
+ var _chunkN3BZTUSJcjs = require('./chunk-N3BZTUSJ.cjs');
4
4
 
5
5
 
6
- var _chunkMKU7VETPcjs = require('./chunk-MKU7VETP.cjs');
7
- require('./chunk-MVFMDKAS.cjs');
6
+ var _chunkOFGBTU45cjs = require('./chunk-OFGBTU45.cjs');
7
+ require('./chunk-5SR5N75I.cjs');
8
8
  require('./chunk-R6U6BHCV.cjs');
9
9
 
10
10
 
11
11
 
12
- exports.DepositModal = _chunk6UBIFHRVcjs.DepositModal; exports.WithdrawModal = _chunkMKU7VETPcjs.WithdrawModal;
12
+ exports.DepositModal = _chunkN3BZTUSJcjs.DepositModal; exports.WithdrawModal = _chunkOFGBTU45cjs.WithdrawModal;
package/dist/reown.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  DepositModal
3
- } from "./chunk-QME5ZAI6.mjs";
3
+ } from "./chunk-XVCPUB6K.mjs";
4
4
  import {
5
5
  WithdrawModal
6
- } from "./chunk-7YERRXZ4.mjs";
7
- import "./chunk-NDTY5AUU.mjs";
6
+ } from "./chunk-2IFX6ZEE.mjs";
7
+ import "./chunk-TDTBAZNO.mjs";
8
8
  import "./chunk-CIXHTOO3.mjs";
9
9
  export {
10
10
  DepositModal,
package/dist/withdraw.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkMKU7VETPcjs = require('./chunk-MKU7VETP.cjs');
4
- require('./chunk-MVFMDKAS.cjs');
3
+ var _chunkOFGBTU45cjs = require('./chunk-OFGBTU45.cjs');
4
+ require('./chunk-5SR5N75I.cjs');
5
5
  require('./chunk-R6U6BHCV.cjs');
6
6
 
7
7
 
8
- exports.WithdrawModal = _chunkMKU7VETPcjs.WithdrawModal;
8
+ exports.WithdrawModal = _chunkOFGBTU45cjs.WithdrawModal;
package/dist/withdraw.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  WithdrawModal
3
- } from "./chunk-7YERRXZ4.mjs";
4
- import "./chunk-NDTY5AUU.mjs";
3
+ } from "./chunk-2IFX6ZEE.mjs";
4
+ import "./chunk-TDTBAZNO.mjs";
5
5
  import "./chunk-CIXHTOO3.mjs";
6
6
  export {
7
7
  WithdrawModal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhinestone/deposit-modal",
3
- "version": "0.1.62",
3
+ "version": "0.1.63",
4
4
  "description": "React modal component for Rhinestone cross-chain deposits",
5
5
  "author": "Rhinestone <dev@rhinestone.wtf>",
6
6
  "bugs": {