@rhinestone/deposit-modal 0.1.51 → 0.1.53

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-BNSX25TA.mjs";
28
+ } from "./chunk-REDAO3MS.mjs";
29
29
  import {
30
30
  DEFAULT_BACKEND_URL,
31
31
  DEFAULT_SIGNER_ADDRESS,
@@ -695,9 +695,8 @@ function AmountStep({
695
695
  return;
696
696
  }
697
697
  if (uiConfig?.minDepositUsd && usdValue < uiConfig.minDepositUsd) {
698
- setError(
699
- `Minimum deposit is ${currencyFormatter.format(uiConfig.minDepositUsd)}`
700
- );
698
+ setAmount(uiConfig.minDepositUsd.toString());
699
+ setError(null);
701
700
  return;
702
701
  }
703
702
  }
@@ -737,7 +736,7 @@ function AmountStep({
737
736
  autoFocus: true
738
737
  }
739
738
  ) }),
740
- !isSourceStablecoin && /* @__PURE__ */ jsx3("div", { className: "rs-amount-available", children: /* @__PURE__ */ jsxs3("span", { className: "rs-amount-available-value", children: [
739
+ /* @__PURE__ */ jsx3("div", { className: "rs-amount-available", children: /* @__PURE__ */ jsxs3("span", { className: "rs-amount-available-value", children: [
741
740
  formattedBalance,
742
741
  " ",
743
742
  asset.symbol,
@@ -881,6 +880,10 @@ function AmountStep({
881
880
  }
882
881
  )
883
882
  ] }),
883
+ uiConfig?.minDepositUsd && /* @__PURE__ */ jsxs3("div", { className: "rs-amount-minimum", children: [
884
+ currencyFormatter.format(uiConfig.minDepositUsd),
885
+ " minimum deposit"
886
+ ] }),
884
887
  error && /* @__PURE__ */ jsxs3("div", { className: "rs-amount-error", children: [
885
888
  /* @__PURE__ */ jsx3(
886
889
  "svg",
@@ -909,7 +912,7 @@ function AmountStep({
909
912
  onClick: handleContinue,
910
913
  fullWidth: true,
911
914
  disabled: !amount || chainMismatch,
912
- children: "Continue"
915
+ children: uiConfig?.minDepositUsd && parseFloat(amount) > 0 && parseFloat(amount) < uiConfig.minDepositUsd ? "Update order" : "Continue"
913
916
  }
914
917
  ) }),
915
918
  /* @__PURE__ */ jsx3(PoweredBy, {})
@@ -2122,9 +2125,8 @@ function SolanaAmountStep({
2122
2125
  return;
2123
2126
  }
2124
2127
  if (uiConfig?.minDepositUsd && usdValue < uiConfig.minDepositUsd) {
2125
- setError(
2126
- `Minimum deposit is ${currencyFormatter.format(uiConfig.minDepositUsd)}`
2127
- );
2128
+ setAmount(uiConfig.minDepositUsd.toString());
2129
+ setError(null);
2128
2130
  return;
2129
2131
  }
2130
2132
  }
@@ -2223,6 +2225,10 @@ function SolanaAmountStep({
2223
2225
  }
2224
2226
  )
2225
2227
  ] }),
2228
+ uiConfig?.minDepositUsd && /* @__PURE__ */ jsxs8("div", { className: "rs-amount-minimum", children: [
2229
+ currencyFormatter.format(uiConfig.minDepositUsd),
2230
+ " minimum deposit"
2231
+ ] }),
2226
2232
  error && /* @__PURE__ */ jsxs8("div", { className: "rs-amount-error", children: [
2227
2233
  /* @__PURE__ */ jsx8(
2228
2234
  "svg",
@@ -2251,7 +2257,7 @@ function SolanaAmountStep({
2251
2257
  onClick: handleContinue,
2252
2258
  fullWidth: true,
2253
2259
  disabled: !amount,
2254
- children: "Continue"
2260
+ children: uiConfig?.minDepositUsd && parseFloat(amount) > 0 && parseFloat(amount) < uiConfig.minDepositUsd ? "Update order" : "Continue"
2255
2261
  }
2256
2262
  ) }),
2257
2263
  /* @__PURE__ */ jsx8(PoweredBy, {})
@@ -2522,6 +2528,7 @@ function SolanaConfirmStep({
2522
2528
 
2523
2529
  // src/DepositFlow.tsx
2524
2530
  import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
2531
+ var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
2525
2532
  function isSameRoute(sourceChain, sourceToken, targetChain, targetToken) {
2526
2533
  return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
2527
2534
  }
@@ -2532,6 +2539,7 @@ function DepositFlow({
2532
2539
  dappWalletClient,
2533
2540
  dappPublicClient,
2534
2541
  dappAddress,
2542
+ hasDappWalletClientProp,
2535
2543
  targetChain,
2536
2544
  targetToken,
2537
2545
  service,
@@ -2561,11 +2569,18 @@ function DepositFlow({
2561
2569
  onError,
2562
2570
  debug
2563
2571
  }) {
2572
+ const hasInitialReownSession = Boolean(
2573
+ enableSolana ? reownWallet?.isConnected || reownWallet?.address : reownWallet?.address
2574
+ );
2575
+ const hasInitialWalletHydrationPending = Boolean(
2576
+ dappAddress && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasInitialReownSession && !reownWallet.isReady)
2577
+ );
2564
2578
  const [step, setStep] = useState10({ type: "setup" });
2565
2579
  const [flowMode, setFlowMode] = useState10(null);
2566
2580
  const [totalBalanceUsd, setTotalBalanceUsd] = useState10(0);
2567
2581
  const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = useState10(false);
2568
2582
  const [selectedWalletId, setSelectedWalletId] = useState10(null);
2583
+ const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = useState10(() => !hasInitialWalletHydrationPending);
2569
2584
  const flowModeRef = useRef5(null);
2570
2585
  const portfolioAssetsRef = useRef5([]);
2571
2586
  const stableWalletSignerRef = useRef5(null);
@@ -2663,7 +2678,21 @@ function DepositFlow({
2663
2678
  const hasReownSession = Boolean(
2664
2679
  enableSolana ? reownWallet?.isConnected || reownWallet?.address : reownWallet?.address
2665
2680
  );
2681
+ const isWalletHydrationPending = Boolean(
2682
+ dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
2683
+ );
2666
2684
  const showConnectStep = flowMode === null && !canAutoLock && !isConnectSelectionConfirmed;
2685
+ useEffect9(() => {
2686
+ if (!isWalletHydrationPending) {
2687
+ setHasQrAutoAdvanceGraceElapsed(true);
2688
+ return;
2689
+ }
2690
+ setHasQrAutoAdvanceGraceElapsed(false);
2691
+ const timeout = window.setTimeout(() => {
2692
+ setHasQrAutoAdvanceGraceElapsed(true);
2693
+ }, QR_AUTO_ADVANCE_HYDRATION_GRACE_MS);
2694
+ return () => window.clearTimeout(timeout);
2695
+ }, [isWalletHydrationPending]);
2667
2696
  const walletSelectionKey = useMemo7(() => {
2668
2697
  if (flowMode !== "wallet") return null;
2669
2698
  if (canAutoLock) {
@@ -3192,13 +3221,14 @@ function DepositFlow({
3192
3221
  return;
3193
3222
  }
3194
3223
  }
3195
- if (!hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient) {
3224
+ if (!hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
3196
3225
  handleSelectTransferCrypto();
3197
3226
  setIsConnectSelectionConfirmed(true);
3198
3227
  }
3199
3228
  }, [
3200
3229
  hasWalletOptions,
3201
3230
  hasReownSession,
3231
+ hasQrAutoAdvanceGraceElapsed,
3202
3232
  enableSolana,
3203
3233
  isConnectSelectionConfirmed,
3204
3234
  flowMode,
@@ -3527,20 +3557,37 @@ function DepositFlow({
3527
3557
  // src/DepositModal.tsx
3528
3558
  import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
3529
3559
  var ReownDepositInner = lazy(
3530
- () => import("./DepositModalReown-BMHCHJ2P.mjs").then((m) => ({ default: m.DepositModalReown }))
3560
+ () => import("./DepositModalReown-LNZ46L4O.mjs").then((m) => ({ default: m.DepositModalReown }))
3531
3561
  );
3532
3562
  function DepositModal(props) {
3533
3563
  const needsReown = !!props.reownAppId;
3564
+ const hasDappWalletClientProp = Object.prototype.hasOwnProperty.call(
3565
+ props,
3566
+ "dappWalletClient"
3567
+ );
3534
3568
  if (needsReown) {
3535
- return /* @__PURE__ */ jsx11(Suspense, { fallback: null, children: /* @__PURE__ */ jsx11(ReownDepositInner, { ...props }) });
3569
+ return /* @__PURE__ */ jsx11(Suspense, { fallback: null, children: /* @__PURE__ */ jsx11(
3570
+ ReownDepositInner,
3571
+ {
3572
+ ...props,
3573
+ hasDappWalletClientProp
3574
+ }
3575
+ ) });
3536
3576
  }
3537
- return /* @__PURE__ */ jsx11(DepositModalInner, { ...props });
3577
+ return /* @__PURE__ */ jsx11(
3578
+ DepositModalInner,
3579
+ {
3580
+ ...props,
3581
+ hasDappWalletClientProp
3582
+ }
3583
+ );
3538
3584
  }
3539
3585
  DepositModal.displayName = "DepositModal";
3540
3586
  function DepositModalInner({
3541
3587
  dappWalletClient,
3542
3588
  dappPublicClient,
3543
3589
  dappAddress,
3590
+ hasDappWalletClientProp,
3544
3591
  targetChain: targetChainProp,
3545
3592
  targetToken,
3546
3593
  isOpen,
@@ -3677,13 +3724,44 @@ function DepositModalInner({
3677
3724
  }
3678
3725
  ),
3679
3726
  /* @__PURE__ */ jsx11("span", { className: "rs-modal-header-title", children: title }),
3680
- showStepper && /* @__PURE__ */ jsx11("div", { className: "rs-modal-progress", style: { marginLeft: 8 }, children: [0, 1, 2, 3, 4].map((i) => /* @__PURE__ */ jsx11(
3681
- "div",
3682
- {
3683
- className: `rs-modal-progress-dot ${i <= currentStepIndex ? "rs-modal-progress-dot--active" : "rs-modal-progress-dot--inactive"}`
3684
- },
3685
- i
3686
- )) })
3727
+ showStepper && currentStepIndex >= 2 && /* @__PURE__ */ jsxs11("div", { className: "rs-step-indicator", style: { marginLeft: 8 }, children: [
3728
+ /* @__PURE__ */ jsx11(
3729
+ "div",
3730
+ {
3731
+ className: `rs-step-indicator-node ${currentStepIndex >= 4 ? "rs-step-indicator-node--complete" : "rs-step-indicator-node--active"}`,
3732
+ children: currentStepIndex >= 4 ? /* @__PURE__ */ jsx11(
3733
+ "svg",
3734
+ {
3735
+ viewBox: "0 0 24 24",
3736
+ fill: "none",
3737
+ stroke: "currentColor",
3738
+ strokeWidth: "3",
3739
+ children: /* @__PURE__ */ jsx11(
3740
+ "path",
3741
+ {
3742
+ strokeLinecap: "round",
3743
+ strokeLinejoin: "round",
3744
+ d: "M5 12l5 5L20 7"
3745
+ }
3746
+ )
3747
+ }
3748
+ ) : "1"
3749
+ }
3750
+ ),
3751
+ /* @__PURE__ */ jsx11(
3752
+ "div",
3753
+ {
3754
+ className: `rs-step-indicator-line ${currentStepIndex >= 4 ? "rs-step-indicator-line--active" : ""}`
3755
+ }
3756
+ ),
3757
+ /* @__PURE__ */ jsx11(
3758
+ "div",
3759
+ {
3760
+ className: `rs-step-indicator-node ${currentStepIndex >= 4 ? "rs-step-indicator-node--active" : "rs-step-indicator-node--inactive"}`,
3761
+ children: "2"
3762
+ }
3763
+ )
3764
+ ] })
3687
3765
  ] }),
3688
3766
  balance && /* @__PURE__ */ jsxs11("div", { className: "rs-modal-header-balance", children: [
3689
3767
  /* @__PURE__ */ jsxs11("span", { children: [
@@ -3726,6 +3804,7 @@ function DepositModalInner({
3726
3804
  dappWalletClient,
3727
3805
  dappPublicClient,
3728
3806
  dappAddress,
3807
+ hasDappWalletClientProp,
3729
3808
  targetChain,
3730
3809
  targetToken,
3731
3810
  service,
package/dist/deposit.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk2AS2NAJ2cjs = require('./chunk-2AS2NAJ2.cjs');
4
- require('./chunk-NU3ES4JY.cjs');
3
+ var _chunk47WDWD6Zcjs = require('./chunk-47WDWD6Z.cjs');
4
+ require('./chunk-DBBSH7HP.cjs');
5
5
  require('./chunk-NELAYNA3.cjs');
6
6
 
7
7
 
8
- exports.DepositModal = _chunk2AS2NAJ2cjs.DepositModal;
8
+ exports.DepositModal = _chunk47WDWD6Zcjs.DepositModal;
package/dist/deposit.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DepositModal
3
- } from "./chunk-SKL3JJP6.mjs";
4
- import "./chunk-BNSX25TA.mjs";
3
+ } from "./chunk-ZB5Y2ACC.mjs";
4
+ import "./chunk-REDAO3MS.mjs";
5
5
  import "./chunk-ZJQZEIHA.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 _chunk2AS2NAJ2cjs = require('./chunk-2AS2NAJ2.cjs');
3
+ var _chunk47WDWD6Zcjs = require('./chunk-47WDWD6Z.cjs');
4
4
 
5
5
 
6
- var _chunkDKYHVAHNcjs = require('./chunk-DKYHVAHN.cjs');
7
- require('./chunk-NU3ES4JY.cjs');
6
+ var _chunkK57KO3SWcjs = require('./chunk-K57KO3SW.cjs');
7
+ require('./chunk-DBBSH7HP.cjs');
8
8
 
9
9
 
10
10
 
@@ -66,4 +66,4 @@ var _chunkNELAYNA3cjs = require('./chunk-NELAYNA3.cjs');
66
66
 
67
67
 
68
68
 
69
- exports.CHAIN_BY_ID = _chunkNELAYNA3cjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkNELAYNA3cjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkNELAYNA3cjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal = _chunk2AS2NAJ2cjs.DepositModal; exports.NATIVE_TOKEN_ADDRESS = _chunkNELAYNA3cjs.NATIVE_TOKEN_ADDRESS; exports.SOURCE_CHAINS = _chunkNELAYNA3cjs.SOURCE_CHAINS; exports.SUPPORTED_CHAINS = _chunkNELAYNA3cjs.SUPPORTED_CHAINS; exports.WithdrawModal = _chunkDKYHVAHNcjs.WithdrawModal; exports.chainRegistry = _chunkNELAYNA3cjs.chainRegistry; exports.findChainIdForToken = _chunkNELAYNA3cjs.findChainIdForToken; exports.getChainBadge = _chunkNELAYNA3cjs.getChainBadge; exports.getChainIcon = _chunkNELAYNA3cjs.getChainIcon; exports.getChainId = _chunkNELAYNA3cjs.getChainId; exports.getChainName = _chunkNELAYNA3cjs.getChainName; exports.getChainObject = _chunkNELAYNA3cjs.getChainObject; exports.getExplorerName = _chunkNELAYNA3cjs.getExplorerName; exports.getExplorerTxUrl = _chunkNELAYNA3cjs.getExplorerTxUrl; exports.getExplorerUrl = _chunkNELAYNA3cjs.getExplorerUrl; exports.getSupportedChainIds = _chunkNELAYNA3cjs.getSupportedChainIds; exports.getSupportedTargetTokens = _chunkNELAYNA3cjs.getSupportedTargetTokens; exports.getSupportedTokenSymbolsForChain = _chunkNELAYNA3cjs.getSupportedTokenSymbolsForChain; exports.getTargetTokenSymbolsForChain = _chunkNELAYNA3cjs.getTargetTokenSymbolsForChain; exports.getTokenAddress = _chunkNELAYNA3cjs.getTokenAddress; exports.getTokenDecimals = _chunkNELAYNA3cjs.getTokenDecimals; exports.getTokenDecimalsByAddress = _chunkNELAYNA3cjs.getTokenDecimalsByAddress; exports.getTokenIcon = _chunkNELAYNA3cjs.getTokenIcon; exports.getTokenSymbol = _chunkNELAYNA3cjs.getTokenSymbol; exports.getUsdcAddress = _chunkNELAYNA3cjs.getUsdcAddress; exports.getUsdcDecimals = _chunkNELAYNA3cjs.getUsdcDecimals; exports.isSupportedTokenAddressForChain = _chunkNELAYNA3cjs.isSupportedTokenAddressForChain;
69
+ exports.CHAIN_BY_ID = _chunkNELAYNA3cjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkNELAYNA3cjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkNELAYNA3cjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal = _chunk47WDWD6Zcjs.DepositModal; exports.NATIVE_TOKEN_ADDRESS = _chunkNELAYNA3cjs.NATIVE_TOKEN_ADDRESS; exports.SOURCE_CHAINS = _chunkNELAYNA3cjs.SOURCE_CHAINS; exports.SUPPORTED_CHAINS = _chunkNELAYNA3cjs.SUPPORTED_CHAINS; exports.WithdrawModal = _chunkK57KO3SWcjs.WithdrawModal; exports.chainRegistry = _chunkNELAYNA3cjs.chainRegistry; exports.findChainIdForToken = _chunkNELAYNA3cjs.findChainIdForToken; exports.getChainBadge = _chunkNELAYNA3cjs.getChainBadge; exports.getChainIcon = _chunkNELAYNA3cjs.getChainIcon; exports.getChainId = _chunkNELAYNA3cjs.getChainId; exports.getChainName = _chunkNELAYNA3cjs.getChainName; exports.getChainObject = _chunkNELAYNA3cjs.getChainObject; exports.getExplorerName = _chunkNELAYNA3cjs.getExplorerName; exports.getExplorerTxUrl = _chunkNELAYNA3cjs.getExplorerTxUrl; exports.getExplorerUrl = _chunkNELAYNA3cjs.getExplorerUrl; exports.getSupportedChainIds = _chunkNELAYNA3cjs.getSupportedChainIds; exports.getSupportedTargetTokens = _chunkNELAYNA3cjs.getSupportedTargetTokens; exports.getSupportedTokenSymbolsForChain = _chunkNELAYNA3cjs.getSupportedTokenSymbolsForChain; exports.getTargetTokenSymbolsForChain = _chunkNELAYNA3cjs.getTargetTokenSymbolsForChain; exports.getTokenAddress = _chunkNELAYNA3cjs.getTokenAddress; exports.getTokenDecimals = _chunkNELAYNA3cjs.getTokenDecimals; exports.getTokenDecimalsByAddress = _chunkNELAYNA3cjs.getTokenDecimalsByAddress; exports.getTokenIcon = _chunkNELAYNA3cjs.getTokenIcon; exports.getTokenSymbol = _chunkNELAYNA3cjs.getTokenSymbol; exports.getUsdcAddress = _chunkNELAYNA3cjs.getUsdcAddress; exports.getUsdcDecimals = _chunkNELAYNA3cjs.getUsdcDecimals; exports.isSupportedTokenAddressForChain = _chunkNELAYNA3cjs.isSupportedTokenAddressForChain;
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  DepositModal
3
- } from "./chunk-SKL3JJP6.mjs";
3
+ } from "./chunk-ZB5Y2ACC.mjs";
4
4
  import {
5
5
  WithdrawModal
6
- } from "./chunk-G2GXEC7C.mjs";
7
- import "./chunk-BNSX25TA.mjs";
6
+ } from "./chunk-4BL7RCZB.mjs";
7
+ import "./chunk-REDAO3MS.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 _chunk2AS2NAJ2cjs = require('./chunk-2AS2NAJ2.cjs');
3
+ var _chunk47WDWD6Zcjs = require('./chunk-47WDWD6Z.cjs');
4
4
 
5
5
 
6
- var _chunkDKYHVAHNcjs = require('./chunk-DKYHVAHN.cjs');
7
- require('./chunk-NU3ES4JY.cjs');
6
+ var _chunkK57KO3SWcjs = require('./chunk-K57KO3SW.cjs');
7
+ require('./chunk-DBBSH7HP.cjs');
8
8
  require('./chunk-NELAYNA3.cjs');
9
9
 
10
10
 
11
11
 
12
- exports.DepositModal = _chunk2AS2NAJ2cjs.DepositModal; exports.WithdrawModal = _chunkDKYHVAHNcjs.WithdrawModal;
12
+ exports.DepositModal = _chunk47WDWD6Zcjs.DepositModal; exports.WithdrawModal = _chunkK57KO3SWcjs.WithdrawModal;
package/dist/reown.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  DepositModal
3
- } from "./chunk-SKL3JJP6.mjs";
3
+ } from "./chunk-ZB5Y2ACC.mjs";
4
4
  import {
5
5
  WithdrawModal
6
- } from "./chunk-G2GXEC7C.mjs";
7
- import "./chunk-BNSX25TA.mjs";
6
+ } from "./chunk-4BL7RCZB.mjs";
7
+ import "./chunk-REDAO3MS.mjs";
8
8
  import "./chunk-ZJQZEIHA.mjs";
9
9
  export {
10
10
  DepositModal,