@trustware/sdk-staging 1.1.3-staging.32 → 1.1.4-staging.34

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.
package/dist/index.mjs CHANGED
@@ -59,7 +59,7 @@ var init_constants = __esm({
59
59
  "src/constants.ts"() {
60
60
  "use strict";
61
61
  SDK_NAME = "@trustware/sdk";
62
- SDK_VERSION = "1.1.3";
62
+ SDK_VERSION = "1.1.4-staging.34";
63
63
  API_ROOT = "https://bv-staging-api.trustware.io";
64
64
  GTM_ID = "GTM-TZDGNCXB";
65
65
  API_PREFIX = "/api";
@@ -1312,9 +1312,18 @@ async function connectDetectedWallet(dw, opts) {
1312
1312
  throw new Error("WalletConnect connection failed. Please try again.");
1313
1313
  }
1314
1314
  if (dw.via === "solana-window" || dw.meta.ecosystem === "solana") {
1315
- const api2 = toWalletInterfaceFromDetected(dw);
1316
- if (touchAddress) await api2.getAddress();
1317
- return { via: "eip1193", api: api2 };
1315
+ try {
1316
+ const provider = dw.provider;
1317
+ await provider.connect();
1318
+ return {
1319
+ via: "eip1193",
1320
+ api: toWalletInterfaceFromDetected(dw),
1321
+ error: null
1322
+ };
1323
+ } catch (err) {
1324
+ const errorMsg = err instanceof Error ? err.message : String(err);
1325
+ return { via: "eip1193", api: null, error: errorMsg };
1326
+ }
1318
1327
  }
1319
1328
  if (wagmi) {
1320
1329
  const conn = pickWagmiConnector(
@@ -1325,12 +1334,12 @@ async function connectDetectedWallet(dw, opts) {
1325
1334
  );
1326
1335
  if (conn) {
1327
1336
  await wagmi.connect(conn);
1328
- return { via: "wagmi", api: null };
1337
+ return { via: "wagmi", api: null, error: null };
1329
1338
  }
1330
1339
  }
1331
1340
  const api = toWalletInterfaceFromDetected(dw);
1332
1341
  if (touchAddress) await api.getAddress();
1333
- return { via: "eip1193", api };
1342
+ return { via: "eip1193", api, error: null };
1334
1343
  }
1335
1344
 
1336
1345
  // src/wallets/detect.ts
@@ -2853,6 +2862,7 @@ var WalletManager = class {
2853
2862
  this._wallet = null;
2854
2863
  this._detected = [];
2855
2864
  this._listeners = /* @__PURE__ */ new Set();
2865
+ this._error = null;
2856
2866
  this._identity = new IdentityStore();
2857
2867
  this._providerCleanup = null;
2858
2868
  this._connectedWalletId = null;
@@ -2907,18 +2917,25 @@ var WalletManager = class {
2907
2917
  this.clearConnectedWalletState();
2908
2918
  this.emit();
2909
2919
  try {
2910
- const { api } = await connectDetectedWallet(target, {
2920
+ const { api, error } = await connectDetectedWallet(target, {
2911
2921
  wagmi: opts?.wagmi
2912
2922
  });
2913
- if (api) {
2923
+ if (api && !error) {
2914
2924
  this._wallet = api;
2915
2925
  this._connectedWalletId = target.meta.id;
2916
2926
  this.bindProviderEvents(target);
2917
2927
  await this.syncIdentityFromWallet(target.meta.id);
2928
+ this._status = "connected";
2929
+ this._error = null;
2930
+ return { error: null, api };
2931
+ }
2932
+ if (error) {
2933
+ this._status = "error";
2934
+ this._error = error;
2935
+ return { error, api };
2918
2936
  }
2919
- this._status = "connected";
2920
2937
  } catch (e2) {
2921
- this._error = e2;
2938
+ this._error = e2 instanceof Error ? e2.message : String(e2);
2922
2939
  this._status = "error";
2923
2940
  this.clearConnectedWalletState();
2924
2941
  } finally {
@@ -4929,7 +4946,8 @@ function useDepositNavigationState(initialStep) {
4929
4946
  navigationDirection,
4930
4947
  setCurrentStep,
4931
4948
  goBack,
4932
- resetNavigation
4949
+ resetNavigation,
4950
+ setCurrentStepInternal
4933
4951
  };
4934
4952
  }
4935
4953
 
@@ -5009,6 +5027,9 @@ function useWalletSessionState() {
5009
5027
  }, []);
5010
5028
  const connectWallet = useCallback4(async (wallet) => {
5011
5029
  await walletManager.connectDetected(wallet);
5030
+ const error = walletManager.error;
5031
+ const api = walletManager.wallet;
5032
+ return { error, api };
5012
5033
  }, []);
5013
5034
  const disconnectWallet = useCallback4(async () => {
5014
5035
  await walletManager.disconnect();
@@ -5922,6 +5943,7 @@ function useWalletTokenState({
5922
5943
  setSelectedToken
5923
5944
  }) {
5924
5945
  const [yourWalletTokens, setYourWalletTokens] = useState12([]);
5946
+ const [yourWalletTokensLoading, setYourWalletTokensLoading] = useState12(false);
5925
5947
  const [walletTokensReloadNonce, setWalletTokensReloadNonce] = useState12(0);
5926
5948
  const lastLoadedWalletRef = useRef4(null);
5927
5949
  const { tokens } = useTokens(null);
@@ -5942,6 +5964,7 @@ function useWalletTokenState({
5942
5964
  let cancelled = false;
5943
5965
  async function loadWalletTokens() {
5944
5966
  try {
5967
+ setYourWalletTokensLoading(true);
5945
5968
  if (TrustwareConfigStore.get().features.balanceStreaming) {
5946
5969
  let accumulatedBalances = [];
5947
5970
  for await (const chunk of getBalancesByAddressStream(
@@ -5986,6 +6009,10 @@ function useWalletTokenState({
5986
6009
  if (!cancelled) {
5987
6010
  setYourWalletTokens([]);
5988
6011
  }
6012
+ } finally {
6013
+ if (!cancelled) {
6014
+ setYourWalletTokensLoading(false);
6015
+ }
5989
6016
  }
5990
6017
  }
5991
6018
  void loadWalletTokens();
@@ -6000,7 +6027,8 @@ function useWalletTokenState({
6000
6027
  setSelectedToken,
6001
6028
  tokens,
6002
6029
  walletAddress,
6003
- walletTokensReloadNonce
6030
+ walletTokensReloadNonce,
6031
+ setYourWalletTokensLoading
6004
6032
  ]);
6005
6033
  const reloadWalletTokens = () => {
6006
6034
  setWalletTokensReloadNonce((prev) => prev + 1);
@@ -6008,7 +6036,9 @@ function useWalletTokenState({
6008
6036
  return {
6009
6037
  yourWalletTokens,
6010
6038
  setYourWalletTokens,
6011
- reloadWalletTokens
6039
+ reloadWalletTokens,
6040
+ yourWalletTokensLoading,
6041
+ setYourWalletTokensLoading
6012
6042
  };
6013
6043
  }
6014
6044
  function applyWalletTokenState({
@@ -6164,7 +6194,8 @@ function DepositProvider({
6164
6194
  navigationDirection,
6165
6195
  setCurrentStep,
6166
6196
  goBack,
6167
- resetNavigation
6197
+ resetNavigation,
6198
+ setCurrentStepInternal
6168
6199
  } = useDepositNavigationState(initialStep);
6169
6200
  const { resolvedTheme, toggleTheme } = useThemePreference();
6170
6201
  const {
@@ -6180,7 +6211,12 @@ function DepositProvider({
6180
6211
  const [selectedToken, setSelectedToken] = useState13(null);
6181
6212
  const [selectedChain, setSelectedChain] = useState13(null);
6182
6213
  const [amount, setAmount] = useState13("");
6183
- const { yourWalletTokens, setYourWalletTokens, reloadWalletTokens } = useWalletTokenState({
6214
+ const {
6215
+ yourWalletTokens,
6216
+ setYourWalletTokens,
6217
+ reloadWalletTokens,
6218
+ yourWalletTokensLoading
6219
+ } = useWalletTokenState({
6184
6220
  walletAddress,
6185
6221
  selectedChain,
6186
6222
  setSelectedChain,
@@ -6212,7 +6248,8 @@ function DepositProvider({
6212
6248
  goBack,
6213
6249
  resetState,
6214
6250
  stepHistory,
6215
- navigationDirection
6251
+ navigationDirection,
6252
+ setCurrentStepInternal
6216
6253
  }),
6217
6254
  [
6218
6255
  currentStep,
@@ -6220,6 +6257,7 @@ function DepositProvider({
6220
6257
  navigationDirection,
6221
6258
  resetState,
6222
6259
  setCurrentStep,
6260
+ setCurrentStepInternal,
6223
6261
  stepHistory
6224
6262
  ]
6225
6263
  );
@@ -6231,7 +6269,8 @@ function DepositProvider({
6231
6269
  connectWallet,
6232
6270
  disconnectWallet,
6233
6271
  yourWalletTokens,
6234
- setYourWalletTokens
6272
+ setYourWalletTokens,
6273
+ yourWalletTokensLoading
6235
6274
  }),
6236
6275
  [
6237
6276
  connectWallet,
@@ -6240,7 +6279,8 @@ function DepositProvider({
6240
6279
  setYourWalletTokens,
6241
6280
  walletAddress,
6242
6281
  walletStatus,
6243
- yourWalletTokens
6282
+ yourWalletTokens,
6283
+ yourWalletTokensLoading
6244
6284
  ]
6245
6285
  );
6246
6286
  const formValue = useMemo7(
@@ -7496,23 +7536,39 @@ function SwipeToConfirmTokens({
7496
7536
  justifyContent: "center",
7497
7537
  padding: `0 ${spacing[7]}`,
7498
7538
  transition: "opacity 0.2s",
7499
- ...effectiveProgress > 0.15 && { opacity: 0 }
7539
+ ...effectiveProgress > 0.15 && { opacity: 0 },
7540
+ width: "100%"
7500
7541
  },
7501
7542
  children: /* @__PURE__ */ jsx9(
7502
- "span",
7543
+ "div",
7503
7544
  {
7504
7545
  style: {
7505
- fontSize: isVeryLongText ? fontSize.xs : isLongText ? "0.8125rem" : fontSize.sm,
7506
- color: colors.mutedForeground,
7507
- fontWeight: fontWeight.bold,
7508
- lineHeight: 1.15,
7509
- textAlign: "center",
7546
+ minWidth: 0,
7547
+ flex: 1,
7548
+ overflowX: "hidden",
7510
7549
  whiteSpace: "nowrap",
7511
- overflow: "hidden",
7512
- textOverflow: "ellipsis",
7513
- maxWidth: "100%"
7550
+ scrollbarWidth: "none",
7551
+ maxWidth: "85%"
7514
7552
  },
7515
- children: text
7553
+ children: /* @__PURE__ */ jsx9(
7554
+ "span",
7555
+ {
7556
+ style: {
7557
+ display: "block",
7558
+ // + width: "100%",
7559
+ fontSize: isVeryLongText ? fontSize.xs : isLongText ? "0.8125rem" : fontSize.sm,
7560
+ color: colors.mutedForeground,
7561
+ fontWeight: fontWeight.bold,
7562
+ lineHeight: 1.15,
7563
+ textAlign: "center",
7564
+ whiteSpace: "nowrap",
7565
+ overflow: "hidden",
7566
+ textOverflow: "ellipsis",
7567
+ maxWidth: "100%"
7568
+ },
7569
+ children: text
7570
+ }
7571
+ )
7516
7572
  }
7517
7573
  )
7518
7574
  }
@@ -12452,6 +12508,7 @@ function useHomeWalletActions({
12452
12508
  connectWallet,
12453
12509
  detectedWallets,
12454
12510
  setCurrentStep
12511
+ // setCurrentStepInternal,
12455
12512
  }) {
12456
12513
  const [isCryptoDropdownOpen, setIsCryptoDropdownOpen] = useState21(false);
12457
12514
  const [isFiatDropdownOpen, setIsFiatDropdownOpen] = useState21(false);
@@ -12473,12 +12530,18 @@ function useHomeWalletActions({
12473
12530
  useEffect22(() => {
12474
12531
  getUniversalConnector().then(setUniversalConnector);
12475
12532
  }, []);
12533
+ const { resetNavigation } = useDepositNavigationState("home");
12476
12534
  const handleWalletSelect = async (wallet) => {
12477
12535
  setIsCryptoDropdownOpen(false);
12478
12536
  try {
12479
- await connectWallet(wallet);
12537
+ const { error } = await connectWallet(wallet);
12538
+ if (error) {
12539
+ resetNavigation();
12540
+ return;
12541
+ }
12480
12542
  setCurrentStep("crypto-pay");
12481
12543
  } catch {
12544
+ resetNavigation();
12482
12545
  }
12483
12546
  };
12484
12547
  const handleFiatSelect = () => {
@@ -12514,7 +12577,7 @@ function useHomeWalletActions({
12514
12577
  import { jsx as jsx42, jsxs as jsxs33 } from "react/jsx-runtime";
12515
12578
  function Home({ style: _style }) {
12516
12579
  const { amount, setAmount, amountInputMode, setAmountInputMode } = useDepositForm();
12517
- const { setCurrentStep } = useDepositNavigation();
12580
+ const { setCurrentStep, setCurrentStepInternal } = useDepositNavigation();
12518
12581
  const { connectWallet } = useDepositWallet();
12519
12582
  const { resolvedTheme } = useDepositUi();
12520
12583
  const { fixedFromAmountString, isFixedAmount, minAmountUsd, maxAmountUsd } = useAmountConstraints();
@@ -12543,7 +12606,8 @@ function Home({ style: _style }) {
12543
12606
  } = useHomeWalletActions({
12544
12607
  connectWallet,
12545
12608
  detectedWallets,
12546
- setCurrentStep
12609
+ setCurrentStep,
12610
+ setCurrentStepInternal
12547
12611
  });
12548
12612
  return /* @__PURE__ */ jsxs33(
12549
12613
  "div",
@@ -12823,7 +12887,7 @@ function SelectToken({ style }) {
12823
12887
  );
12824
12888
  }
12825
12889
 
12826
- // src/widget/pages/CryptoPay.tsx
12890
+ // src/widget/pages/CryptoPay/index.tsx
12827
12891
  import { useEffect as useEffect24, useMemo as useMemo18 } from "react";
12828
12892
 
12829
12893
  // src/widget/features/route-preview/hooks/useRoutePreviewModel.ts
@@ -13677,8 +13741,180 @@ function useTransactionActionModel({
13677
13741
  };
13678
13742
  }
13679
13743
 
13680
- // src/widget/pages/CryptoPay.tsx
13681
- import { Fragment as Fragment6, jsx as jsx47, jsxs as jsxs37 } from "react/jsx-runtime";
13744
+ // src/widget/pages/CryptoPay/DefaultCryptoPay.tsx
13745
+ import { jsx as jsx47, jsxs as jsxs37 } from "react/jsx-runtime";
13746
+ var IconWallet = ({ style }) => /* @__PURE__ */ jsxs37(
13747
+ "svg",
13748
+ {
13749
+ xmlns: "http://www.w3.org/2000/svg",
13750
+ width: "24",
13751
+ height: "24",
13752
+ viewBox: "0 0 24 24",
13753
+ fill: "none",
13754
+ stroke: "currentColor",
13755
+ strokeWidth: "1.75",
13756
+ strokeLinecap: "round",
13757
+ strokeLinejoin: "round",
13758
+ style,
13759
+ children: [
13760
+ /* @__PURE__ */ jsx47("path", { d: "M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1" }),
13761
+ /* @__PURE__ */ jsx47("path", { d: "M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4" })
13762
+ ]
13763
+ }
13764
+ );
13765
+ var IconSparkles = ({ style }) => /* @__PURE__ */ jsxs37(
13766
+ "svg",
13767
+ {
13768
+ xmlns: "http://www.w3.org/2000/svg",
13769
+ width: "24",
13770
+ height: "24",
13771
+ viewBox: "0 0 24 24",
13772
+ fill: "none",
13773
+ stroke: "currentColor",
13774
+ strokeWidth: "2",
13775
+ strokeLinecap: "round",
13776
+ strokeLinejoin: "round",
13777
+ style,
13778
+ children: [
13779
+ /* @__PURE__ */ jsx47("path", { d: "m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z" }),
13780
+ /* @__PURE__ */ jsx47("path", { d: "M5 3v4" }),
13781
+ /* @__PURE__ */ jsx47("path", { d: "M19 17v4" }),
13782
+ /* @__PURE__ */ jsx47("path", { d: "M3 5h4" }),
13783
+ /* @__PURE__ */ jsx47("path", { d: "M17 19h4" })
13784
+ ]
13785
+ }
13786
+ );
13787
+ function DefaultCryptoPay() {
13788
+ return /* @__PURE__ */ jsx47(
13789
+ "div",
13790
+ {
13791
+ style: {
13792
+ width: "100%",
13793
+ minHeight: "100%",
13794
+ display: "flex",
13795
+ alignItems: "center",
13796
+ justifyContent: "center",
13797
+ flexDirection: "column"
13798
+ },
13799
+ children: /* @__PURE__ */ jsxs37(
13800
+ "div",
13801
+ {
13802
+ style: {
13803
+ textAlign: "center",
13804
+ flexDirection: "column",
13805
+ display: "flex",
13806
+ alignItems: "center",
13807
+ justifyContent: "center",
13808
+ padding: "2rem"
13809
+ },
13810
+ children: [
13811
+ /* @__PURE__ */ jsxs37(
13812
+ "div",
13813
+ {
13814
+ style: {
13815
+ position: "relative",
13816
+ marginBottom: "1.25rem",
13817
+ display: "inline-block"
13818
+ },
13819
+ children: [
13820
+ /* @__PURE__ */ jsx47(
13821
+ "div",
13822
+ {
13823
+ style: {
13824
+ position: "absolute",
13825
+ inset: 0,
13826
+ borderRadius: "9999px",
13827
+ background: `linear-gradient(135deg, ${colors.green[500]} 0%, ${colors.green[300]} 100%)`,
13828
+ opacity: 0.2,
13829
+ filter: "blur(1rem)"
13830
+ }
13831
+ }
13832
+ ),
13833
+ /* @__PURE__ */ jsx47(
13834
+ "div",
13835
+ {
13836
+ style: {
13837
+ position: "relative",
13838
+ height: "5rem",
13839
+ width: "5rem",
13840
+ borderRadius: "9999px",
13841
+ backgroundColor: colors.card,
13842
+ border: `1px solid ${colors.border}`,
13843
+ display: "flex",
13844
+ alignItems: "center",
13845
+ justifyContent: "center"
13846
+ },
13847
+ children: /* @__PURE__ */ jsx47(
13848
+ IconWallet,
13849
+ {
13850
+ style: {
13851
+ color: colors.green[300]
13852
+ }
13853
+ }
13854
+ )
13855
+ }
13856
+ )
13857
+ ]
13858
+ }
13859
+ ),
13860
+ /* @__PURE__ */ jsxs37(
13861
+ "div",
13862
+ {
13863
+ style: {
13864
+ display: "inline-flex",
13865
+ alignItems: "center",
13866
+ gap: "0.375rem",
13867
+ fontSize: "0.75rem",
13868
+ fontWeight: 500,
13869
+ color: "hsl(158, 84%, 52%)",
13870
+ backgroundColor: "hsla(158, 84%, 52%, 0.1)",
13871
+ border: `1px solid hsla(158, 84%, 52%, 0.2)`,
13872
+ borderRadius: "9999px",
13873
+ padding: "0.25rem 0.75rem",
13874
+ marginBottom: "0.75rem"
13875
+ },
13876
+ children: [
13877
+ /* @__PURE__ */ jsx47(IconSparkles, {}),
13878
+ "Wallet is empty"
13879
+ ]
13880
+ }
13881
+ ),
13882
+ /* @__PURE__ */ jsx47(
13883
+ "h2",
13884
+ {
13885
+ style: {
13886
+ fontSize: "1.5rem",
13887
+ fontWeight: 600,
13888
+ letterSpacing: "-0.025em",
13889
+ marginBottom: "0.375rem",
13890
+ color: colors.foreground
13891
+ },
13892
+ children: "Deposit assets to swap or bridge."
13893
+ }
13894
+ ),
13895
+ /* @__PURE__ */ jsx47(
13896
+ "p",
13897
+ {
13898
+ style: {
13899
+ fontSize: "0.875rem",
13900
+ color: colors.mutedForeground,
13901
+ maxWidth: "24rem",
13902
+ margin: "0 auto",
13903
+ lineHeight: 1.625
13904
+ },
13905
+ children: "You'll need tokens before you can swap or bridge."
13906
+ }
13907
+ )
13908
+ ]
13909
+ }
13910
+ )
13911
+ }
13912
+ );
13913
+ }
13914
+ var DefaultCryptoPay_default = DefaultCryptoPay;
13915
+
13916
+ // src/widget/pages/CryptoPay/index.tsx
13917
+ import { Fragment as Fragment6, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
13682
13918
  var SHOW_FEE_SUMMARY = false;
13683
13919
  function CryptoPay({ style: _style }) {
13684
13920
  const {
@@ -13691,7 +13927,12 @@ function CryptoPay({ style: _style }) {
13691
13927
  amountInputMode,
13692
13928
  setAmountInputMode
13693
13929
  } = useDepositForm();
13694
- const { walletAddress, walletStatus, yourWalletTokens } = useDepositWallet();
13930
+ const {
13931
+ walletAddress,
13932
+ walletStatus,
13933
+ yourWalletTokens,
13934
+ yourWalletTokensLoading
13935
+ } = useDepositWallet();
13695
13936
  const { goBack, setCurrentStep, currentStep } = useDepositNavigation();
13696
13937
  const config = useTrustwareConfig();
13697
13938
  const { fixedFromAmountString, isFixedAmount, minAmountUsd, maxAmountUsd } = useAmountConstraints();
@@ -13700,11 +13941,15 @@ function CryptoPay({ style: _style }) {
13700
13941
  const n = Number(raw);
13701
13942
  return Number.isFinite(n) && n > 0 ? n : void 0;
13702
13943
  }, [config.routes?.options?.routeRefreshMs]);
13703
- const isReady = useMemo18(() => {
13704
- if (selectedToken !== null && yourWalletTokens.length > 0 && selectedToken?.chainData !== void 0) {
13705
- return true;
13706
- }
13707
- }, [selectedToken, yourWalletTokens.length]);
13944
+ const IsPos = (x) => x !== null && x !== void 0 && x.balance !== "0";
13945
+ const showDefaultCryptoPay = useMemo18(() => {
13946
+ const nonZer0Tks = (yourWalletTokens ?? []).filter(IsPos);
13947
+ return !yourWalletTokensLoading && nonZer0Tks.length === 0 && yourWalletTokens.length > 0;
13948
+ }, [yourWalletTokens, yourWalletTokensLoading]);
13949
+ const showSkeleton = useMemo18(() => {
13950
+ return yourWalletTokensLoading || (yourWalletTokens ?? []).length === 0;
13951
+ }, [yourWalletTokens, yourWalletTokensLoading]);
13952
+ const isReady = !yourWalletTokensLoading && selectedToken != null && selectedToken?.chainData !== void 0 && !showDefaultCryptoPay && !showSkeleton;
13708
13953
  const {
13709
13954
  amountComputation,
13710
13955
  amountValidationError,
@@ -13807,7 +14052,7 @@ function CryptoPay({ style: _style }) {
13807
14052
  const handleExpandTokens = () => {
13808
14053
  setCurrentStep("select-token");
13809
14054
  };
13810
- return /* @__PURE__ */ jsxs37(
14055
+ return /* @__PURE__ */ jsxs38(
13811
14056
  "div",
13812
14057
  {
13813
14058
  style: {
@@ -13816,56 +14061,8 @@ function CryptoPay({ style: _style }) {
13816
14061
  minHeight: "500px"
13817
14062
  },
13818
14063
  children: [
13819
- /* @__PURE__ */ jsx47(WidgetPageHeader, { onBack: goBack, title: "Confirm Deposit" }),
13820
- isReady ? /* @__PURE__ */ jsxs37(Fragment6, { children: [
13821
- /* @__PURE__ */ jsx47(
13822
- CryptoPayAmountSection,
13823
- {
13824
- amount,
13825
- amountComputation,
13826
- amountInputMode,
13827
- estimatedReceive,
13828
- effectiveSliderMax,
13829
- effectiveSliderMin,
13830
- gasReservationWei,
13831
- handleAmountChange,
13832
- handleExpandTokens,
13833
- handleSliderChange,
13834
- handleTokenChange,
13835
- hasUsdPrice,
13836
- isFixedAmount,
13837
- isLoadingRoute,
13838
- normalizedTokenBalance,
13839
- orderedTokens,
13840
- parsedAmount,
13841
- selectedChain,
13842
- selectedToken: readySelectedToken,
13843
- setAmountInputMode,
13844
- showFeeSummary: SHOW_FEE_SUMMARY,
13845
- tokenPriceUSD,
13846
- walletAddress,
13847
- yourWalletTokensLength: yourWalletTokens.length
13848
- }
13849
- ),
13850
- /* @__PURE__ */ jsx47(
13851
- CryptoPaySwipeSection,
13852
- {
13853
- actionErrorMessage,
13854
- canSwipe,
13855
- destinationConfig,
13856
- fromChainName: selectedChain?.networkName,
13857
- handleSwipeConfirm,
13858
- isApproving,
13859
- isLoadingRoute,
13860
- isReadingAllowance,
13861
- isWalletConnected,
13862
- needsApproval,
13863
- selectedToken: readySelectedToken,
13864
- swipeResetKey
13865
- }
13866
- ),
13867
- /* @__PURE__ */ jsx47(WidgetSecurityFooter, {})
13868
- ] }) : /* @__PURE__ */ jsx47(
14064
+ /* @__PURE__ */ jsx48(WidgetPageHeader, { onBack: goBack, title: "Confirm Deposit" }),
14065
+ showSkeleton ? /* @__PURE__ */ jsx48(Fragment6, { children: /* @__PURE__ */ jsx48(
13869
14066
  "div",
13870
14067
  {
13871
14068
  style: {
@@ -13874,9 +14071,60 @@ function CryptoPay({ style: _style }) {
13874
14071
  alignItems: "center",
13875
14072
  justifyContent: "center"
13876
14073
  },
13877
- children: /* @__PURE__ */ jsx47(LoadingSkeleton, {})
14074
+ children: /* @__PURE__ */ jsx48(LoadingSkeleton, {})
13878
14075
  }
13879
- )
14076
+ ) }) : /* @__PURE__ */ jsxs38(Fragment6, { children: [
14077
+ isReady && /* @__PURE__ */ jsxs38(Fragment6, { children: [
14078
+ /* @__PURE__ */ jsx48(
14079
+ CryptoPayAmountSection,
14080
+ {
14081
+ amount,
14082
+ amountComputation,
14083
+ amountInputMode,
14084
+ estimatedReceive,
14085
+ effectiveSliderMax,
14086
+ effectiveSliderMin,
14087
+ gasReservationWei,
14088
+ handleAmountChange,
14089
+ handleExpandTokens,
14090
+ handleSliderChange,
14091
+ handleTokenChange,
14092
+ hasUsdPrice,
14093
+ isFixedAmount,
14094
+ isLoadingRoute,
14095
+ normalizedTokenBalance,
14096
+ orderedTokens,
14097
+ parsedAmount,
14098
+ selectedChain,
14099
+ selectedToken: readySelectedToken,
14100
+ setAmountInputMode,
14101
+ showFeeSummary: SHOW_FEE_SUMMARY,
14102
+ tokenPriceUSD,
14103
+ walletAddress,
14104
+ yourWalletTokensLength: yourWalletTokens.length
14105
+ }
14106
+ ),
14107
+ /* @__PURE__ */ jsx48(
14108
+ CryptoPaySwipeSection,
14109
+ {
14110
+ actionErrorMessage,
14111
+ canSwipe,
14112
+ destinationConfig,
14113
+ fromChainName: selectedChain?.networkName,
14114
+ handleSwipeConfirm,
14115
+ isApproving,
14116
+ isLoadingRoute,
14117
+ isReadingAllowance,
14118
+ isWalletConnected,
14119
+ needsApproval,
14120
+ selectedToken: readySelectedToken,
14121
+ swipeResetKey
14122
+ }
14123
+ ),
14124
+ /* @__PURE__ */ jsx48(WidgetSecurityFooter, {})
14125
+ ] }),
14126
+ showDefaultCryptoPay && /* @__PURE__ */ jsx48(DefaultCryptoPay_default, {})
14127
+ ] })
13880
14128
  ]
13881
14129
  }
13882
14130
  );
@@ -13884,7 +14132,7 @@ function CryptoPay({ style: _style }) {
13884
14132
 
13885
14133
  // src/widget/pages/Processing.tsx
13886
14134
  import { useEffect as useEffect25, useMemo as useMemo19, useRef as useRef12 } from "react";
13887
- import { jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
14135
+ import { jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
13888
14136
  function getProgressFromStatus(status) {
13889
14137
  switch (status) {
13890
14138
  case "confirming":
@@ -13960,7 +14208,7 @@ function Processing({ style }) {
13960
14208
  };
13961
14209
  const isIndeterminate = transactionStatus === "confirming" || transactionStatus === "idle";
13962
14210
  const headerTitle = transactionStatus === "success" ? "Complete" : transactionStatus === "error" ? "Failed" : "Processing";
13963
- return /* @__PURE__ */ jsxs38(
14211
+ return /* @__PURE__ */ jsxs39(
13964
14212
  "div",
13965
14213
  {
13966
14214
  style: {
@@ -13970,8 +14218,8 @@ function Processing({ style }) {
13970
14218
  ...style
13971
14219
  },
13972
14220
  children: [
13973
- /* @__PURE__ */ jsx48(WidgetPageHeader, { onClose: handleClose, title: headerTitle }),
13974
- /* @__PURE__ */ jsxs38(
14221
+ /* @__PURE__ */ jsx49(WidgetPageHeader, { onClose: handleClose, title: headerTitle }),
14222
+ /* @__PURE__ */ jsxs39(
13975
14223
  "div",
13976
14224
  {
13977
14225
  style: {
@@ -13983,13 +14231,13 @@ function Processing({ style }) {
13983
14231
  padding: `${spacing[8]} ${spacing[6]}`
13984
14232
  },
13985
14233
  children: [
13986
- /* @__PURE__ */ jsx48(
14234
+ /* @__PURE__ */ jsx49(
13987
14235
  "div",
13988
14236
  {
13989
14237
  style: {
13990
14238
  marginBottom: spacing[6]
13991
14239
  },
13992
- children: /* @__PURE__ */ jsx48(
14240
+ children: /* @__PURE__ */ jsx49(
13993
14241
  CircularProgress,
13994
14242
  {
13995
14243
  progress,
@@ -14001,7 +14249,7 @@ function Processing({ style }) {
14001
14249
  )
14002
14250
  }
14003
14251
  ),
14004
- /* @__PURE__ */ jsx48(
14252
+ /* @__PURE__ */ jsx49(
14005
14253
  "p",
14006
14254
  {
14007
14255
  style: {
@@ -14014,7 +14262,7 @@ function Processing({ style }) {
14014
14262
  children: stepText
14015
14263
  }
14016
14264
  ),
14017
- selectedToken && parsedAmount > 0 && /* @__PURE__ */ jsxs38(
14265
+ selectedToken && parsedAmount > 0 && /* @__PURE__ */ jsxs39(
14018
14266
  "p",
14019
14267
  {
14020
14268
  style: {
@@ -14031,7 +14279,7 @@ function Processing({ style }) {
14031
14279
  ]
14032
14280
  }
14033
14281
  ),
14034
- /* @__PURE__ */ jsx48(
14282
+ /* @__PURE__ */ jsx49(
14035
14283
  TransactionSteps,
14036
14284
  {
14037
14285
  transactionStatus,
@@ -14042,7 +14290,7 @@ function Processing({ style }) {
14042
14290
  }
14043
14291
  }
14044
14292
  ),
14045
- transactionHash ? /* @__PURE__ */ jsx48(
14293
+ transactionHash ? /* @__PURE__ */ jsx49(
14046
14294
  TransactionHashLink,
14047
14295
  {
14048
14296
  explorerUrl,
@@ -14050,7 +14298,7 @@ function Processing({ style }) {
14050
14298
  label: "Transaction"
14051
14299
  }
14052
14300
  ) : null,
14053
- transactionStatus === "error" && /* @__PURE__ */ jsx48(
14301
+ transactionStatus === "error" && /* @__PURE__ */ jsx49(
14054
14302
  "button",
14055
14303
  {
14056
14304
  type: "button",
@@ -14072,7 +14320,7 @@ function Processing({ style }) {
14072
14320
  ]
14073
14321
  }
14074
14322
  ),
14075
- /* @__PURE__ */ jsx48(WidgetSecurityFooter, {})
14323
+ /* @__PURE__ */ jsx49(WidgetSecurityFooter, {})
14076
14324
  ]
14077
14325
  }
14078
14326
  );
@@ -14080,7 +14328,7 @@ function Processing({ style }) {
14080
14328
 
14081
14329
  // src/widget/pages/Success.tsx
14082
14330
  import { lazy, Suspense, useMemo as useMemo20 } from "react";
14083
- import { jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
14331
+ import { jsx as jsx50, jsxs as jsxs40 } from "react/jsx-runtime";
14084
14332
  var ConfettiEffect2 = lazy(() => Promise.resolve().then(() => (init_ConfettiEffect(), ConfettiEffect_exports)));
14085
14333
  function Success({ style }) {
14086
14334
  const { selectedToken, selectedChain, amount } = useDepositForm();
@@ -14103,7 +14351,7 @@ function Success({ style }) {
14103
14351
  const handleDone = () => {
14104
14352
  resetState();
14105
14353
  };
14106
- return /* @__PURE__ */ jsxs39(
14354
+ return /* @__PURE__ */ jsxs40(
14107
14355
  "div",
14108
14356
  {
14109
14357
  style: {
@@ -14116,9 +14364,9 @@ function Success({ style }) {
14116
14364
  ...style
14117
14365
  },
14118
14366
  children: [
14119
- /* @__PURE__ */ jsx49(Suspense, { fallback: null, children: /* @__PURE__ */ jsx49(ConfettiEffect2, { isActive: true, pieceCount: 60, clearDelay: 4e3 }) }),
14120
- /* @__PURE__ */ jsx49(WidgetPageHeader, { title: "Deposit Complete" }),
14121
- /* @__PURE__ */ jsx49(
14367
+ /* @__PURE__ */ jsx50(Suspense, { fallback: null, children: /* @__PURE__ */ jsx50(ConfettiEffect2, { isActive: true, pieceCount: 60, clearDelay: 4e3 }) }),
14368
+ /* @__PURE__ */ jsx50(WidgetPageHeader, { title: "Deposit Complete" }),
14369
+ /* @__PURE__ */ jsx50(
14122
14370
  "div",
14123
14371
  {
14124
14372
  style: {
@@ -14130,7 +14378,7 @@ function Success({ style }) {
14130
14378
  flexDirection: "column",
14131
14379
  alignItems: "center"
14132
14380
  },
14133
- children: /* @__PURE__ */ jsx49(
14381
+ children: /* @__PURE__ */ jsx50(
14134
14382
  SuccessSummaryCard,
14135
14383
  {
14136
14384
  amount: parsedAmount,
@@ -14144,7 +14392,7 @@ function Success({ style }) {
14144
14392
  )
14145
14393
  }
14146
14394
  ),
14147
- /* @__PURE__ */ jsx49(WidgetSecurityFooter, {})
14395
+ /* @__PURE__ */ jsx50(WidgetSecurityFooter, {})
14148
14396
  ]
14149
14397
  }
14150
14398
  );
@@ -14153,7 +14401,7 @@ function Success({ style }) {
14153
14401
  // src/widget/pages/Error.tsx
14154
14402
  import { useMemo as useMemo21, useEffect as useEffect26 } from "react";
14155
14403
  init_store();
14156
- import { jsx as jsx50, jsxs as jsxs40 } from "react/jsx-runtime";
14404
+ import { jsx as jsx51, jsxs as jsxs41 } from "react/jsx-runtime";
14157
14405
  function categorizeError(errorMessage) {
14158
14406
  if (!errorMessage) return "unknown";
14159
14407
  const msg = errorMessage.toLowerCase();
@@ -14283,7 +14531,7 @@ function Error2({ style }) {
14283
14531
  }, [transactionHash, selectedChain]);
14284
14532
  const renderErrorIcon = () => {
14285
14533
  if (errorCategory === "wallet_rejected") {
14286
- return /* @__PURE__ */ jsx50(
14534
+ return /* @__PURE__ */ jsx51(
14287
14535
  "svg",
14288
14536
  {
14289
14537
  style: {
@@ -14296,7 +14544,7 @@ function Error2({ style }) {
14296
14544
  stroke: "currentColor",
14297
14545
  strokeWidth: 2.5,
14298
14546
  "aria-hidden": "true",
14299
- children: /* @__PURE__ */ jsx50(
14547
+ children: /* @__PURE__ */ jsx51(
14300
14548
  "path",
14301
14549
  {
14302
14550
  strokeLinecap: "round",
@@ -14308,7 +14556,7 @@ function Error2({ style }) {
14308
14556
  );
14309
14557
  }
14310
14558
  if (errorCategory === "network_error") {
14311
- return /* @__PURE__ */ jsx50(
14559
+ return /* @__PURE__ */ jsx51(
14312
14560
  "svg",
14313
14561
  {
14314
14562
  style: {
@@ -14321,7 +14569,7 @@ function Error2({ style }) {
14321
14569
  stroke: "currentColor",
14322
14570
  strokeWidth: 2,
14323
14571
  "aria-hidden": "true",
14324
- children: /* @__PURE__ */ jsx50(
14572
+ children: /* @__PURE__ */ jsx51(
14325
14573
  "path",
14326
14574
  {
14327
14575
  strokeLinecap: "round",
@@ -14332,7 +14580,7 @@ function Error2({ style }) {
14332
14580
  }
14333
14581
  );
14334
14582
  }
14335
- return /* @__PURE__ */ jsx50(
14583
+ return /* @__PURE__ */ jsx51(
14336
14584
  "svg",
14337
14585
  {
14338
14586
  style: {
@@ -14345,7 +14593,7 @@ function Error2({ style }) {
14345
14593
  stroke: "currentColor",
14346
14594
  strokeWidth: 2,
14347
14595
  "aria-hidden": "true",
14348
- children: /* @__PURE__ */ jsx50(
14596
+ children: /* @__PURE__ */ jsx51(
14349
14597
  "path",
14350
14598
  {
14351
14599
  strokeLinecap: "round",
@@ -14356,7 +14604,7 @@ function Error2({ style }) {
14356
14604
  }
14357
14605
  );
14358
14606
  };
14359
- return /* @__PURE__ */ jsxs40(
14607
+ return /* @__PURE__ */ jsxs41(
14360
14608
  "div",
14361
14609
  {
14362
14610
  style: {
@@ -14366,8 +14614,8 @@ function Error2({ style }) {
14366
14614
  ...style
14367
14615
  },
14368
14616
  children: [
14369
- /* @__PURE__ */ jsx50(WidgetPageHeader, { title: errorTitle }),
14370
- /* @__PURE__ */ jsx50(
14617
+ /* @__PURE__ */ jsx51(WidgetPageHeader, { title: errorTitle }),
14618
+ /* @__PURE__ */ jsx51(
14371
14619
  ErrorRecoveryCard,
14372
14620
  {
14373
14621
  errorMessage,
@@ -14380,7 +14628,7 @@ function Error2({ style }) {
14380
14628
  transactionHash
14381
14629
  }
14382
14630
  ),
14383
- /* @__PURE__ */ jsx50(WidgetSecurityFooter, {})
14631
+ /* @__PURE__ */ jsx51(WidgetSecurityFooter, {})
14384
14632
  ]
14385
14633
  }
14386
14634
  );
@@ -14402,7 +14650,7 @@ var ACTIVE_TRANSACTION_STATUSES = [
14402
14650
  ];
14403
14651
 
14404
14652
  // src/widget/app/WidgetRouter.tsx
14405
- import { jsx as jsx51 } from "react/jsx-runtime";
14653
+ import { jsx as jsx52 } from "react/jsx-runtime";
14406
14654
  var pageContainerBaseStyle = {
14407
14655
  width: "100%",
14408
14656
  height: "100%",
@@ -14420,19 +14668,19 @@ function WidgetRouter({
14420
14668
  const animationClass = useMemo22(() => {
14421
14669
  return navigationDirection === "forward" ? "tw-animate-slide-in-right" : "tw-animate-slide-in-left";
14422
14670
  }, [navigationDirection]);
14423
- return /* @__PURE__ */ jsx51(
14671
+ return /* @__PURE__ */ jsx52(
14424
14672
  "div",
14425
14673
  {
14426
14674
  className: animationClass,
14427
14675
  style: mergeStyles(pageContainerBaseStyle),
14428
- children: /* @__PURE__ */ jsx51(PageComponent, {})
14676
+ children: /* @__PURE__ */ jsx52(PageComponent, {})
14429
14677
  },
14430
14678
  `${currentStep}-${stepHistory.length}`
14431
14679
  );
14432
14680
  }
14433
14681
 
14434
14682
  // src/widget/TrustwareWidgetV2.tsx
14435
- import { Fragment as Fragment7, jsx as jsx52, jsxs as jsxs41 } from "react/jsx-runtime";
14683
+ import { Fragment as Fragment7, jsx as jsx53, jsxs as jsxs42 } from "react/jsx-runtime";
14436
14684
  var widgetContentContainerStyle = {
14437
14685
  position: "relative",
14438
14686
  width: "100%",
@@ -14474,9 +14722,9 @@ function WidgetContent({
14474
14722
  transactionStatus,
14475
14723
  onStateChange
14476
14724
  ]);
14477
- return /* @__PURE__ */ jsxs41("div", { style: mergeStyles(widgetContentContainerStyle, style), children: [
14478
- showThemeToggle && /* @__PURE__ */ jsx52("div", { style: themeToggleContainerStyle, children: /* @__PURE__ */ jsx52(ThemeToggle, { theme: resolvedTheme, onToggle: toggleTheme }) }),
14479
- /* @__PURE__ */ jsx52(
14725
+ return /* @__PURE__ */ jsxs42("div", { style: mergeStyles(widgetContentContainerStyle, style), children: [
14726
+ showThemeToggle && /* @__PURE__ */ jsx53("div", { style: themeToggleContainerStyle, children: /* @__PURE__ */ jsx53(ThemeToggle, { theme: resolvedTheme, onToggle: toggleTheme }) }),
14727
+ /* @__PURE__ */ jsx53(
14480
14728
  WidgetRouter,
14481
14729
  {
14482
14730
  currentStep,
@@ -14525,16 +14773,16 @@ function WidgetInner({
14525
14773
  const handleRefresh = useCallback15(() => {
14526
14774
  revalidate?.();
14527
14775
  }, [revalidate]);
14528
- return /* @__PURE__ */ jsxs41(Fragment7, { children: [
14529
- /* @__PURE__ */ jsxs41(WidgetContainer, { theme: effectiveTheme, style, children: [
14530
- /* @__PURE__ */ jsx52(
14776
+ return /* @__PURE__ */ jsxs42(Fragment7, { children: [
14777
+ /* @__PURE__ */ jsxs42(WidgetContainer, { theme: effectiveTheme, style, children: [
14778
+ /* @__PURE__ */ jsx53(
14531
14779
  WidgetContent,
14532
14780
  {
14533
14781
  onStateChange,
14534
14782
  showThemeToggle
14535
14783
  }
14536
14784
  ),
14537
- /* @__PURE__ */ jsx52(
14785
+ /* @__PURE__ */ jsx53(
14538
14786
  InitErrorOverlay,
14539
14787
  {
14540
14788
  open: initBlocked,
@@ -14544,7 +14792,7 @@ function WidgetInner({
14544
14792
  }
14545
14793
  )
14546
14794
  ] }),
14547
- /* @__PURE__ */ jsx52(
14795
+ /* @__PURE__ */ jsx53(
14548
14796
  ConfirmCloseDialog,
14549
14797
  {
14550
14798
  open: showConfirmDialog,
@@ -14595,7 +14843,7 @@ var TrustwareWidgetV2 = forwardRef(function TrustwareWidgetV22({
14595
14843
  if (!isOpen) {
14596
14844
  return null;
14597
14845
  }
14598
- return /* @__PURE__ */ jsx52(DepositProvider, { initialStep: effectiveInitialStep, children: /* @__PURE__ */ jsx52(
14846
+ return /* @__PURE__ */ jsx53(DepositProvider, { initialStep: effectiveInitialStep, children: /* @__PURE__ */ jsx53(
14599
14847
  WidgetInner,
14600
14848
  {
14601
14849
  theme,