@rhinestone/deposit-modal 0.1.47 → 0.1.48

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.
@@ -25,7 +25,7 @@ import {
25
25
  toEvmCaip2,
26
26
  tokenFormatter,
27
27
  txRefsMatch
28
- } from "./chunk-QIK6ONMQ.mjs";
28
+ } from "./chunk-FKNYONM2.mjs";
29
29
  import {
30
30
  DEFAULT_BACKEND_URL,
31
31
  DEFAULT_SIGNER_ADDRESS,
@@ -253,6 +253,7 @@ function AssetSelectStep({
253
253
  publicClient,
254
254
  defaultSourceChain,
255
255
  defaultSourceToken,
256
+ allowedRoutes,
256
257
  service,
257
258
  onContinue,
258
259
  onTotalBalanceComputed,
@@ -325,13 +326,25 @@ function AssetSelectStep({
325
326
  onTotalBalanceComputed?.(total);
326
327
  if (assets.length > 0) onAssetsLoaded?.(assets);
327
328
  }, [assets, onTotalBalanceComputed, onAssetsLoaded]);
329
+ const allowedChainSet = useMemo(
330
+ () => allowedRoutes?.sourceChains ? new Set(allowedRoutes.sourceChains) : null,
331
+ [allowedRoutes?.sourceChains]
332
+ );
333
+ const allowedTokenSet = useMemo(
334
+ () => allowedRoutes?.sourceTokens ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
335
+ [allowedRoutes?.sourceTokens]
336
+ );
328
337
  const rows = useMemo(() => {
329
338
  return assets.filter((a) => {
330
339
  try {
331
- return BigInt(a.balance ?? "0") > BigInt(0);
340
+ if (BigInt(a.balance ?? "0") <= BigInt(0)) return false;
332
341
  } catch {
333
342
  return false;
334
343
  }
344
+ if (allowedChainSet && !allowedChainSet.has(a.chainId)) return false;
345
+ if (allowedTokenSet && !allowedTokenSet.has(a.symbol.toUpperCase()))
346
+ return false;
347
+ return true;
335
348
  }).sort((a, b) => {
336
349
  const usdA = a.balanceUsd ?? 0;
337
350
  const usdB = b.balanceUsd ?? 0;
@@ -342,7 +355,7 @@ function AssetSelectStep({
342
355
  if (balB < balA) return -1;
343
356
  return 0;
344
357
  });
345
- }, [assets]);
358
+ }, [assets, allowedChainSet, allowedTokenSet]);
346
359
  const selectedAsset = selectedAssetId && assets.find((asset) => asset.id === selectedAssetId);
347
360
  const formatBalance = (asset) => {
348
361
  if (!asset.balance) return "--";
@@ -2462,6 +2475,7 @@ function DepositFlow({
2462
2475
  onRequestConnect,
2463
2476
  connectButtonLabel,
2464
2477
  uiConfig,
2478
+ allowedRoutes,
2465
2479
  onStepChange,
2466
2480
  onTotalBalanceChange,
2467
2481
  onClose,
@@ -3348,6 +3362,7 @@ function DepositFlow({
3348
3362
  publicClient: getReadClientForChain(ownerChainId),
3349
3363
  defaultSourceChain,
3350
3364
  defaultSourceToken,
3365
+ allowedRoutes,
3351
3366
  service,
3352
3367
  onContinue: handleAssetContinue,
3353
3368
  onTotalBalanceComputed: handleTotalBalanceComputed,
@@ -3417,7 +3432,7 @@ function DepositFlow({
3417
3432
  // src/DepositModal.tsx
3418
3433
  import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
3419
3434
  var ReownDepositInner = lazy(
3420
- () => import("./DepositModalReown-DKLN3IE3.mjs").then((m) => ({ default: m.DepositModalReown }))
3435
+ () => import("./DepositModalReown-3V2EFXH5.mjs").then((m) => ({ default: m.DepositModalReown }))
3421
3436
  );
3422
3437
  function DepositModal(props) {
3423
3438
  const needsReown = !!props.reownAppId;
@@ -3454,6 +3469,7 @@ function DepositModalInner({
3454
3469
  theme,
3455
3470
  branding,
3456
3471
  uiConfig,
3472
+ allowedRoutes,
3457
3473
  className,
3458
3474
  onReady,
3459
3475
  onConnected,
@@ -3631,6 +3647,7 @@ function DepositModalInner({
3631
3647
  onRequestConnect,
3632
3648
  connectButtonLabel,
3633
3649
  uiConfig,
3650
+ allowedRoutes,
3634
3651
  onStepChange: handleStepChange,
3635
3652
  onTotalBalanceChange: handleTotalBalanceChange,
3636
3653
  onClose,