@spicenet-io/spiceflow-ui 1.9.0 → 1.9.2

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.js CHANGED
@@ -1,15 +1,15 @@
1
1
  "use client";
2
- import { defineChain, createPublicClient, http, isAddress, getAddress, parseEther, parseUnits, encodeFunctionData } from 'viem';
2
+ import { defineChain, createPublicClient, http, isAddress, getAddress, parseEther, parseUnits, erc20Abi, encodeFunctionData } from 'viem';
3
3
  import { basecampTestnet, citreaTestnet, baseSepolia, arbitrumSepolia, sepolia } from 'viem/chains';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import React, { useState, useRef, useEffect, useCallback, createContext, useContext, useTransition, useMemo, forwardRef, createElement } from 'react';
6
- import { c as createTheme, B as Button, d as defaultTheme } from './Button-aWXByNBC.js';
6
+ import { c as createTheme, B as Button, d as defaultTheme } from './Button-CWjGZdAM.js';
7
7
  import { getBalance, readContract } from 'viem/actions';
8
8
  import { createPortal } from 'react-dom';
9
9
  import { useWallets, usePrivy, useSign7702Authorization, useSignMessage } from '@privy-io/react-auth';
10
10
  import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
11
11
  import { getAccountNonce, hashChainBatches, getAuthorizationHash } from 'spiceflow-core-test';
12
- import { useAccount, useConnect, useDisconnect, useSwitchChain, useWalletClient, http as http$1, createConfig, WagmiProvider } from 'wagmi';
12
+ import { useAccount, useWalletClient, useSwitchChain, useReadContracts, useConnect, useDisconnect, http as http$1, createConfig, WagmiProvider } from 'wagmi';
13
13
  import { DynamicLogin } from './auth-dynamic.js';
14
14
  import { PrivyLogin } from './auth-privy.js';
15
15
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
@@ -5082,6 +5082,777 @@ const DepositWidgetModal = ({
5082
5082
  );
5083
5083
  };
5084
5084
 
5085
+ const CrossChainDepositModal = ({
5086
+ isOpen,
5087
+ onClose,
5088
+ onComplete,
5089
+ chainId,
5090
+ externalWalletAddress,
5091
+ escrowAddress = "0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",
5092
+ getChainConfig,
5093
+ getSupportedTokens
5094
+ }) => {
5095
+ const theme = createTheme("light");
5096
+ const [selectedAssets, setSelectedAssets] = useState(/* @__PURE__ */ new Map());
5097
+ const [isExecuting, setIsExecuting] = useState(false);
5098
+ const [error, setError] = useState(null);
5099
+ const [depositResults, setDepositResults] = useState([]);
5100
+ const [isSuccess, setIsSuccess] = useState(false);
5101
+ const { chain: currentChain } = useAccount();
5102
+ const { data: walletClient, isLoading: isWalletClientLoading } = useWalletClient();
5103
+ const { switchChainAsync } = useSwitchChain();
5104
+ const supportedTokens = useMemo(
5105
+ () => getSupportedTokens(chainId),
5106
+ [chainId, getSupportedTokens]
5107
+ );
5108
+ const { data: tokenBalances } = useReadContracts({
5109
+ contracts: supportedTokens.map((token) => ({
5110
+ address: token.address,
5111
+ abi: erc20Abi,
5112
+ functionName: "balanceOf",
5113
+ args: [externalWalletAddress],
5114
+ chainId
5115
+ }))
5116
+ });
5117
+ const assets = useMemo(() => {
5118
+ const chainConfig2 = getChainConfig(chainId);
5119
+ if (!chainConfig2) return [];
5120
+ const assetList = [];
5121
+ supportedTokens.forEach((token, index) => {
5122
+ const balanceResult = tokenBalances?.[index];
5123
+ const balance = balanceResult?.status === "success" ? balanceResult.result : BigInt(0);
5124
+ const balanceFormatted = Number(balance) / Math.pow(10, token.decimals);
5125
+ assetList.push({
5126
+ address: token.address,
5127
+ symbol: token.symbol,
5128
+ name: token.name,
5129
+ decimals: token.decimals,
5130
+ isNative: false,
5131
+ chainId,
5132
+ balance,
5133
+ balanceFormatted
5134
+ });
5135
+ });
5136
+ return assetList;
5137
+ }, [chainId, tokenBalances, supportedTokens, getChainConfig]);
5138
+ useEffect(() => {
5139
+ if (assets.length > 0 && selectedAssets.size > 0) {
5140
+ const updatedSelections = new Map(selectedAssets);
5141
+ let hasChanges = false;
5142
+ selectedAssets.forEach((selection, address) => {
5143
+ const updatedAsset = assets.find((a) => a.address === address);
5144
+ if (updatedAsset && updatedAsset.balanceFormatted !== selection.asset.balanceFormatted) {
5145
+ updatedSelections.set(address, { ...selection, asset: updatedAsset });
5146
+ hasChanges = true;
5147
+ }
5148
+ });
5149
+ if (hasChanges) {
5150
+ setSelectedAssets(updatedSelections);
5151
+ }
5152
+ }
5153
+ }, [assets, selectedAssets]);
5154
+ const chainConfig = getChainConfig(chainId);
5155
+ const toggleAssetSelection = (asset) => {
5156
+ const newSelections = new Map(selectedAssets);
5157
+ if (newSelections.has(asset.address)) {
5158
+ newSelections.delete(asset.address);
5159
+ } else {
5160
+ newSelections.set(asset.address, { asset, amount: "" });
5161
+ }
5162
+ setSelectedAssets(newSelections);
5163
+ setError(null);
5164
+ };
5165
+ const handleAmountChange = (address, value) => {
5166
+ if (value === "" || /^\d*\.?\d*$/.test(value)) {
5167
+ const newSelections = new Map(selectedAssets);
5168
+ const selection = newSelections.get(address);
5169
+ if (selection) {
5170
+ newSelections.set(address, { ...selection, amount: value });
5171
+ setSelectedAssets(newSelections);
5172
+ setError(null);
5173
+ }
5174
+ }
5175
+ };
5176
+ const handlePercentageClick = (address, percentage) => {
5177
+ const selection = selectedAssets.get(address);
5178
+ if (selection?.asset.balanceFormatted !== void 0) {
5179
+ const amount = selection.asset.balanceFormatted * percentage / 100;
5180
+ handleAmountChange(address, amount.toString());
5181
+ }
5182
+ };
5183
+ const executeDeposit = useCallback(async () => {
5184
+ if (selectedAssets.size === 0) {
5185
+ setError("Please select at least one asset");
5186
+ return;
5187
+ }
5188
+ for (const [address, selection] of Array.from(selectedAssets.entries())) {
5189
+ if (!selection.amount) {
5190
+ setError(`Please enter an amount for ${selection.asset.symbol}`);
5191
+ return;
5192
+ }
5193
+ const amount = parseFloat(selection.amount);
5194
+ if (isNaN(amount) || amount <= 0) {
5195
+ setError(`Please enter a valid amount for ${selection.asset.symbol}`);
5196
+ return;
5197
+ }
5198
+ const currentAsset = assets.find((a) => a.address === address);
5199
+ const currentBalance = currentAsset?.balanceFormatted ?? selection.asset.balanceFormatted;
5200
+ if (currentBalance !== void 0 && amount > currentBalance) {
5201
+ setError(`Insufficient ${selection.asset.symbol} balance`);
5202
+ return;
5203
+ }
5204
+ }
5205
+ if (!walletClient) {
5206
+ setError("Wallet not connected. Please reconnect your external wallet.");
5207
+ return;
5208
+ }
5209
+ setIsExecuting(true);
5210
+ setError(null);
5211
+ const results = [];
5212
+ try {
5213
+ if (currentChain?.id !== chainId) {
5214
+ await switchChainAsync({
5215
+ chainId
5216
+ });
5217
+ }
5218
+ for (const [, selection] of Array.from(selectedAssets.entries())) {
5219
+ const { asset, amount } = selection;
5220
+ try {
5221
+ const amountWei = parseUnits(amount, asset.decimals);
5222
+ let hash;
5223
+ if (asset.isNative) {
5224
+ hash = await walletClient.sendTransaction({
5225
+ to: escrowAddress,
5226
+ value: amountWei
5227
+ });
5228
+ } else {
5229
+ const data = encodeFunctionData({
5230
+ abi: erc20Abi,
5231
+ functionName: "transfer",
5232
+ args: [escrowAddress, amountWei]
5233
+ });
5234
+ hash = await walletClient.sendTransaction({
5235
+ to: asset.address,
5236
+ data
5237
+ });
5238
+ }
5239
+ await relayerService.submitSpiceDeposit({
5240
+ txHash: hash,
5241
+ sender: externalWalletAddress,
5242
+ tokenAddress: asset.address,
5243
+ chainId,
5244
+ amount: amount.toString(),
5245
+ user: escrowAddress,
5246
+ isDeposit: true
5247
+ });
5248
+ results.push({ asset, txHash: hash, success: true });
5249
+ } catch (err) {
5250
+ console.error(`Deposit error for ${asset.symbol}:`, err);
5251
+ const error2 = err;
5252
+ let errorMsg = error2?.message || "Deposit failed";
5253
+ if (error2?.code === 4001 || error2?.message?.includes("rejected")) {
5254
+ errorMsg = "Transaction rejected by user";
5255
+ } else if (error2?.message?.includes("insufficient funds")) {
5256
+ errorMsg = "Insufficient funds for transaction";
5257
+ }
5258
+ results.push({ asset, txHash: "", success: false, error: errorMsg });
5259
+ }
5260
+ }
5261
+ setDepositResults(results);
5262
+ setIsSuccess(true);
5263
+ } catch (err) {
5264
+ console.error("Deposit error:", err);
5265
+ const error2 = err;
5266
+ setError(error2?.message || "Deposit failed");
5267
+ } finally {
5268
+ setIsExecuting(false);
5269
+ }
5270
+ }, [
5271
+ selectedAssets,
5272
+ walletClient,
5273
+ currentChain,
5274
+ chainId,
5275
+ switchChainAsync,
5276
+ escrowAddress,
5277
+ assets,
5278
+ externalWalletAddress
5279
+ ]);
5280
+ useEffect(() => {
5281
+ if (!isOpen) {
5282
+ setSelectedAssets(/* @__PURE__ */ new Map());
5283
+ setError(null);
5284
+ setDepositResults([]);
5285
+ setIsSuccess(false);
5286
+ setIsExecuting(false);
5287
+ }
5288
+ }, [isOpen]);
5289
+ const canDeposit = selectedAssets.size > 0 && Array.from(selectedAssets.values()).every(
5290
+ (s) => s.amount && parseFloat(s.amount) > 0
5291
+ ) && !isExecuting && !isSuccess && walletClient;
5292
+ const subtitle = /* @__PURE__ */ jsxs(
5293
+ "div",
5294
+ {
5295
+ style: {
5296
+ display: "flex",
5297
+ alignItems: "flex-start",
5298
+ gap: "8px",
5299
+ backgroundColor: "#f9fafb",
5300
+ border: "1px solid #e5e7eb",
5301
+ borderRadius: "8px",
5302
+ padding: "12px",
5303
+ margin: "-16px 0 0 0"
5304
+ },
5305
+ children: [
5306
+ /* @__PURE__ */ jsx(
5307
+ "img",
5308
+ {
5309
+ src: img$c,
5310
+ alt: "Info",
5311
+ style: {
5312
+ width: "14px",
5313
+ height: "14px",
5314
+ marginTop: "2px",
5315
+ flexShrink: 0
5316
+ }
5317
+ }
5318
+ ),
5319
+ /* @__PURE__ */ jsxs(
5320
+ "p",
5321
+ {
5322
+ style: {
5323
+ fontSize: "13px",
5324
+ color: "#374151",
5325
+ margin: 0,
5326
+ lineHeight: "1.5"
5327
+ },
5328
+ children: [
5329
+ "Select tokens and enter amounts to deposit to your Spicenet Account on",
5330
+ " ",
5331
+ chainConfig?.displayName || `Chain ${chainId}`,
5332
+ "."
5333
+ ]
5334
+ }
5335
+ )
5336
+ ]
5337
+ }
5338
+ );
5339
+ const successOverlay = isSuccess && depositResults.length > 0 ? /* @__PURE__ */ jsxs(
5340
+ "div",
5341
+ {
5342
+ style: {
5343
+ position: "absolute",
5344
+ inset: 0,
5345
+ backgroundColor: "white",
5346
+ zIndex: 10,
5347
+ borderRadius: "12px",
5348
+ padding: "24px",
5349
+ display: "flex",
5350
+ flexDirection: "column",
5351
+ alignItems: "center",
5352
+ justifyContent: "center",
5353
+ gap: "16px"
5354
+ },
5355
+ children: [
5356
+ /* @__PURE__ */ jsx(
5357
+ "div",
5358
+ {
5359
+ style: {
5360
+ width: "64px",
5361
+ height: "64px",
5362
+ borderRadius: "50%",
5363
+ backgroundColor: "#dcfce7",
5364
+ display: "flex",
5365
+ alignItems: "center",
5366
+ justifyContent: "center"
5367
+ },
5368
+ children: /* @__PURE__ */ jsx("span", { style: { fontSize: "28px", color: "#16a34a" }, children: "\u2713" })
5369
+ }
5370
+ ),
5371
+ /* @__PURE__ */ jsx(
5372
+ "p",
5373
+ {
5374
+ style: {
5375
+ fontWeight: 600,
5376
+ fontSize: "18px",
5377
+ color: "#166534",
5378
+ margin: 0
5379
+ },
5380
+ children: "Deposits Complete!"
5381
+ }
5382
+ ),
5383
+ /* @__PURE__ */ jsx(
5384
+ "div",
5385
+ {
5386
+ style: {
5387
+ width: "100%",
5388
+ maxHeight: "200px",
5389
+ overflowY: "auto",
5390
+ display: "flex",
5391
+ flexDirection: "column",
5392
+ gap: "8px"
5393
+ },
5394
+ children: depositResults.map((result, idx) => /* @__PURE__ */ jsxs(
5395
+ "div",
5396
+ {
5397
+ style: {
5398
+ padding: "12px",
5399
+ borderRadius: "8px",
5400
+ border: `1px solid ${result.success ? "#bbf7d0" : "#fecaca"}`,
5401
+ backgroundColor: result.success ? "#f0fdf4" : "#fef2f2"
5402
+ },
5403
+ children: [
5404
+ /* @__PURE__ */ jsxs(
5405
+ "div",
5406
+ {
5407
+ style: {
5408
+ display: "flex",
5409
+ justifyContent: "space-between",
5410
+ alignItems: "center"
5411
+ },
5412
+ children: [
5413
+ /* @__PURE__ */ jsx("span", { style: { fontWeight: 500 }, children: result.asset.symbol }),
5414
+ /* @__PURE__ */ jsx(
5415
+ "span",
5416
+ {
5417
+ style: {
5418
+ color: result.success ? "#16a34a" : "#dc2626",
5419
+ fontSize: "14px"
5420
+ },
5421
+ children: result.success ? "\u2713 Success" : "\u2717 Failed"
5422
+ }
5423
+ )
5424
+ ]
5425
+ }
5426
+ ),
5427
+ result.success && result.txHash && /* @__PURE__ */ jsx(
5428
+ "a",
5429
+ {
5430
+ href: `${chainConfig?.blockExplorers?.default?.url}/tx/${result.txHash}`,
5431
+ target: "_blank",
5432
+ rel: "noopener noreferrer",
5433
+ style: {
5434
+ fontSize: "12px",
5435
+ color: theme.colors.primary,
5436
+ textDecoration: "none"
5437
+ },
5438
+ children: "View on Explorer \u2192"
5439
+ }
5440
+ ),
5441
+ result.error && /* @__PURE__ */ jsx(
5442
+ "p",
5443
+ {
5444
+ style: {
5445
+ fontSize: "12px",
5446
+ color: "#dc2626",
5447
+ margin: "4px 0 0 0"
5448
+ },
5449
+ children: result.error
5450
+ }
5451
+ )
5452
+ ]
5453
+ },
5454
+ idx
5455
+ ))
5456
+ }
5457
+ ),
5458
+ /* @__PURE__ */ jsx(
5459
+ "button",
5460
+ {
5461
+ onClick: onComplete,
5462
+ style: {
5463
+ width: "100%",
5464
+ padding: "14px",
5465
+ borderRadius: "8px",
5466
+ backgroundColor: theme.colors.primary,
5467
+ color: "white",
5468
+ border: "none",
5469
+ fontWeight: 600,
5470
+ fontSize: "16px",
5471
+ cursor: "pointer",
5472
+ marginTop: "8px"
5473
+ },
5474
+ children: "Done"
5475
+ }
5476
+ )
5477
+ ]
5478
+ }
5479
+ ) : null;
5480
+ const PercentageButton = ({ percentage, isSelected, onClick }) => {
5481
+ const getFillLevel = () => {
5482
+ if (percentage === 0) return "empty";
5483
+ if (percentage === 25) return "quarter";
5484
+ if (percentage === 50) return "half";
5485
+ if (percentage === 75) return "three-quarter";
5486
+ return "full";
5487
+ };
5488
+ const fillLevel = getFillLevel();
5489
+ const size = 20;
5490
+ return /* @__PURE__ */ jsx(
5491
+ "button",
5492
+ {
5493
+ onClick,
5494
+ style: {
5495
+ width: size,
5496
+ height: size,
5497
+ borderRadius: "50%",
5498
+ border: `2px solid ${isSelected ? theme.colors.primary : "#d1d5db"}`,
5499
+ backgroundColor: "transparent",
5500
+ cursor: "pointer",
5501
+ padding: 0,
5502
+ position: "relative",
5503
+ overflow: "hidden"
5504
+ },
5505
+ title: `${percentage}%`,
5506
+ children: fillLevel === "full" ? /* @__PURE__ */ jsx(
5507
+ "div",
5508
+ {
5509
+ style: {
5510
+ position: "absolute",
5511
+ inset: 0,
5512
+ backgroundColor: theme.colors.primary,
5513
+ borderRadius: "50%"
5514
+ }
5515
+ }
5516
+ ) : fillLevel !== "empty" && /* @__PURE__ */ jsx(
5517
+ "div",
5518
+ {
5519
+ style: {
5520
+ position: "absolute",
5521
+ bottom: 0,
5522
+ left: 0,
5523
+ right: 0,
5524
+ height: fillLevel === "quarter" ? "25%" : fillLevel === "half" ? "50%" : "75%",
5525
+ backgroundColor: "#9ca3af"
5526
+ }
5527
+ }
5528
+ )
5529
+ }
5530
+ );
5531
+ };
5532
+ return /* @__PURE__ */ jsx(
5533
+ SpiceModalShell,
5534
+ {
5535
+ isOpen,
5536
+ onClose,
5537
+ title: "Deposit to Spicenet",
5538
+ subtitle,
5539
+ theme,
5540
+ maxWidth: "480px",
5541
+ children: /* @__PURE__ */ jsxs("div", { style: { padding: "0 24px 24px 24px", position: "relative" }, children: [
5542
+ successOverlay,
5543
+ /* @__PURE__ */ jsxs("div", { style: { marginBottom: "16px" }, children: [
5544
+ /* @__PURE__ */ jsxs(
5545
+ "div",
5546
+ {
5547
+ style: {
5548
+ display: "flex",
5549
+ alignItems: "center",
5550
+ gap: "6px",
5551
+ marginBottom: "12px"
5552
+ },
5553
+ children: [
5554
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "14px", color: "#6b7280" }, children: "\u25CE" }),
5555
+ /* @__PURE__ */ jsx(
5556
+ "label",
5557
+ {
5558
+ style: {
5559
+ fontSize: "14px",
5560
+ fontWeight: 500,
5561
+ color: "#374151"
5562
+ },
5563
+ children: "Select Assets to Deposit"
5564
+ }
5565
+ )
5566
+ ]
5567
+ }
5568
+ ),
5569
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" }, children: assets.map((asset) => {
5570
+ const isSelected = selectedAssets.has(asset.address);
5571
+ return /* @__PURE__ */ jsxs(
5572
+ "button",
5573
+ {
5574
+ onClick: () => toggleAssetSelection(asset),
5575
+ style: {
5576
+ padding: "8px 16px",
5577
+ borderRadius: "8px",
5578
+ border: `2px solid ${isSelected ? theme.colors.primary : "#e5e7eb"}`,
5579
+ backgroundColor: isSelected ? "#FEF2F2" : "white",
5580
+ cursor: "pointer",
5581
+ display: "flex",
5582
+ alignItems: "center",
5583
+ gap: "8px",
5584
+ transition: "all 150ms ease"
5585
+ },
5586
+ children: [
5587
+ /* @__PURE__ */ jsx(
5588
+ "div",
5589
+ {
5590
+ style: {
5591
+ width: "24px",
5592
+ height: "24px",
5593
+ borderRadius: "50%",
5594
+ backgroundColor: asset.symbol === "USDC" ? "#2775CA" : asset.symbol === "USDT" ? "#26A17B" : "#F7931A",
5595
+ display: "flex",
5596
+ alignItems: "center",
5597
+ justifyContent: "center",
5598
+ color: "white",
5599
+ fontSize: "10px",
5600
+ fontWeight: 700
5601
+ },
5602
+ children: asset.symbol === "USDC" ? "$" : asset.symbol === "USDT" ? "\u20AE" : "\u20BF"
5603
+ }
5604
+ ),
5605
+ /* @__PURE__ */ jsx("span", { style: { fontWeight: 600, color: "#111827" }, children: asset.symbol }),
5606
+ asset.balanceFormatted !== void 0 && /* @__PURE__ */ jsxs(
5607
+ "span",
5608
+ {
5609
+ style: {
5610
+ fontSize: "13px",
5611
+ color: "#9ca3af",
5612
+ fontFamily: "monospace"
5613
+ },
5614
+ children: [
5615
+ "(",
5616
+ asset.balanceFormatted.toFixed(4),
5617
+ ")"
5618
+ ]
5619
+ }
5620
+ )
5621
+ ]
5622
+ },
5623
+ asset.address
5624
+ );
5625
+ }) })
5626
+ ] }),
5627
+ selectedAssets.size > 0 && /* @__PURE__ */ jsx(
5628
+ "div",
5629
+ {
5630
+ style: { display: "flex", flexDirection: "column", gap: "16px" },
5631
+ children: Array.from(selectedAssets.values()).map(({ asset, amount }) => {
5632
+ const numericAmount = parseFloat(amount) || 0;
5633
+ const balance = asset.balanceFormatted || 0;
5634
+ const percentage = balance > 0 ? numericAmount / balance * 100 : 0;
5635
+ return /* @__PURE__ */ jsxs(
5636
+ "div",
5637
+ {
5638
+ style: {
5639
+ backgroundColor: "#f9fafb",
5640
+ borderRadius: "12px",
5641
+ padding: "16px",
5642
+ border: "1px solid #e5e7eb"
5643
+ },
5644
+ children: [
5645
+ /* @__PURE__ */ jsxs(
5646
+ "div",
5647
+ {
5648
+ style: {
5649
+ display: "flex",
5650
+ justifyContent: "space-between",
5651
+ alignItems: "center",
5652
+ marginBottom: "12px"
5653
+ },
5654
+ children: [
5655
+ /* @__PURE__ */ jsxs(
5656
+ "span",
5657
+ {
5658
+ style: {
5659
+ fontSize: "14px",
5660
+ fontWeight: 500,
5661
+ color: "#374151"
5662
+ },
5663
+ children: [
5664
+ asset.symbol,
5665
+ " Amount"
5666
+ ]
5667
+ }
5668
+ ),
5669
+ /* @__PURE__ */ jsxs(
5670
+ "div",
5671
+ {
5672
+ style: {
5673
+ display: "flex",
5674
+ alignItems: "center",
5675
+ gap: "8px"
5676
+ },
5677
+ children: [
5678
+ /* @__PURE__ */ jsxs("span", { style: { fontSize: "13px", color: "#6b7280" }, children: [
5679
+ "Balance: ",
5680
+ (asset.balanceFormatted || 0).toFixed(4)
5681
+ ] }),
5682
+ /* @__PURE__ */ jsxs(
5683
+ "div",
5684
+ {
5685
+ style: {
5686
+ display: "flex",
5687
+ alignItems: "center",
5688
+ gap: "6px",
5689
+ padding: "4px 10px",
5690
+ backgroundColor: "white",
5691
+ borderRadius: "20px",
5692
+ border: "1px solid #e5e7eb"
5693
+ },
5694
+ children: [
5695
+ /* @__PURE__ */ jsx(
5696
+ "div",
5697
+ {
5698
+ style: {
5699
+ width: "20px",
5700
+ height: "20px",
5701
+ borderRadius: "50%",
5702
+ backgroundColor: asset.symbol === "USDC" ? "#2775CA" : asset.symbol === "USDT" ? "#26A17B" : "#F7931A",
5703
+ display: "flex",
5704
+ alignItems: "center",
5705
+ justifyContent: "center",
5706
+ color: "white",
5707
+ fontSize: "9px",
5708
+ fontWeight: 700
5709
+ },
5710
+ children: asset.symbol === "USDC" ? "$" : asset.symbol === "USDT" ? "\u20AE" : "\u20BF"
5711
+ }
5712
+ ),
5713
+ /* @__PURE__ */ jsx(
5714
+ "span",
5715
+ {
5716
+ style: {
5717
+ fontSize: "13px",
5718
+ fontWeight: 500,
5719
+ color: "#111827"
5720
+ },
5721
+ children: asset.symbol
5722
+ }
5723
+ )
5724
+ ]
5725
+ }
5726
+ )
5727
+ ]
5728
+ }
5729
+ )
5730
+ ]
5731
+ }
5732
+ ),
5733
+ /* @__PURE__ */ jsxs(
5734
+ "div",
5735
+ {
5736
+ style: {
5737
+ display: "flex",
5738
+ alignItems: "center",
5739
+ gap: "12px"
5740
+ },
5741
+ children: [
5742
+ /* @__PURE__ */ jsx(
5743
+ "input",
5744
+ {
5745
+ type: "text",
5746
+ value: amount,
5747
+ onChange: (e) => handleAmountChange(asset.address, e.target.value),
5748
+ placeholder: "0.00",
5749
+ style: {
5750
+ flex: 1,
5751
+ fontSize: "32px",
5752
+ fontWeight: 600,
5753
+ color: amount ? "#111827" : "#d1d5db",
5754
+ backgroundColor: "transparent",
5755
+ border: "none",
5756
+ outline: "none",
5757
+ padding: 0,
5758
+ fontFamily: "system-ui, -apple-system, sans-serif"
5759
+ }
5760
+ }
5761
+ ),
5762
+ /* @__PURE__ */ jsx(
5763
+ "div",
5764
+ {
5765
+ style: {
5766
+ display: "flex",
5767
+ gap: "6px",
5768
+ alignItems: "center"
5769
+ },
5770
+ children: [0, 25, 50, 75, 100].map((pct) => /* @__PURE__ */ jsx(
5771
+ PercentageButton,
5772
+ {
5773
+ percentage: pct,
5774
+ isSelected: Math.abs(percentage - pct) < 1,
5775
+ onClick: () => handlePercentageClick(asset.address, pct)
5776
+ },
5777
+ pct
5778
+ ))
5779
+ }
5780
+ )
5781
+ ]
5782
+ }
5783
+ )
5784
+ ]
5785
+ },
5786
+ asset.address
5787
+ );
5788
+ })
5789
+ }
5790
+ ),
5791
+ error && /* @__PURE__ */ jsx(
5792
+ "div",
5793
+ {
5794
+ style: {
5795
+ padding: "12px",
5796
+ backgroundColor: "#fef2f2",
5797
+ border: "1px solid #fecaca",
5798
+ borderRadius: "8px",
5799
+ marginTop: "16px"
5800
+ },
5801
+ children: /* @__PURE__ */ jsx("p", { style: { fontSize: "14px", color: "#dc2626", margin: 0 }, children: error })
5802
+ }
5803
+ ),
5804
+ !isSuccess && /* @__PURE__ */ jsx(
5805
+ "button",
5806
+ {
5807
+ onClick: executeDeposit,
5808
+ disabled: !canDeposit,
5809
+ style: {
5810
+ width: "100%",
5811
+ padding: "16px",
5812
+ borderRadius: "8px",
5813
+ backgroundColor: canDeposit ? theme.colors.primary : "#e5e7eb",
5814
+ color: canDeposit ? "white" : "#9ca3af",
5815
+ border: "none",
5816
+ fontWeight: 600,
5817
+ fontSize: "15px",
5818
+ letterSpacing: "0.5px",
5819
+ cursor: canDeposit ? "pointer" : "not-allowed",
5820
+ marginTop: "20px",
5821
+ display: "flex",
5822
+ alignItems: "center",
5823
+ justifyContent: "center",
5824
+ gap: "8px",
5825
+ transition: "all 150ms ease"
5826
+ },
5827
+ children: isExecuting ? /* @__PURE__ */ jsxs(Fragment, { children: [
5828
+ /* @__PURE__ */ jsx(
5829
+ "div",
5830
+ {
5831
+ style: {
5832
+ width: "18px",
5833
+ height: "18px",
5834
+ border: "2px solid white",
5835
+ borderTopColor: "transparent",
5836
+ borderRadius: "50%",
5837
+ animation: "spin 1s linear infinite"
5838
+ }
5839
+ }
5840
+ ),
5841
+ /* @__PURE__ */ jsx("span", { children: "PROCESSING..." })
5842
+ ] }) : isWalletClientLoading ? "CONNECTING WALLET..." : !walletClient ? "WALLET NOT CONNECTED" : selectedAssets.size === 0 ? "SELECT ASSETS" : !Array.from(selectedAssets.values()).every((s) => s.amount) ? "ENTER AMOUNTS" : "DEPOSIT"
5843
+ }
5844
+ ),
5845
+ /* @__PURE__ */ jsx("style", { children: `
5846
+ @keyframes spin {
5847
+ from { transform: rotate(0deg); }
5848
+ to { transform: rotate(360deg); }
5849
+ }
5850
+ ` })
5851
+ ] })
5852
+ }
5853
+ );
5854
+ };
5855
+
5085
5856
  /**
5086
5857
  * @license lucide-react v0.383.0 - ISC
5087
5858
  *
@@ -12651,4 +13422,4 @@ const useDepositInput = () => {
12651
13422
  };
12652
13423
  };
12653
13424
 
12654
- export { ConnectWalletModal, DepositModal, DepositWidget, DepositWidgetModal, LpModal, ProviderLogin, SelectChainModal, SpiceBalance, SpiceDeposit, SpiceFlowProvider, SpiceFlowProviderContext, SpiceWithdraw, SwapWidget, WithdrawModal, fetchBalances, relayerService, useAssets, useDepositInput, useFromInput, useSpiceBalance, useStatus, useToInputUpdate, useWallet };
13425
+ export { ConnectWalletModal, CrossChainDepositModal, DepositModal, DepositWidget, DepositWidgetModal, LpModal, ProviderLogin, SelectChainModal, SpiceBalance, SpiceDeposit, SpiceFlowProvider, SpiceFlowProviderContext, SpiceWithdraw, SwapWidget, WithdrawModal, fetchBalances, relayerService, useAssets, useDepositInput, useFromInput, useSpiceBalance, useStatus, useToInputUpdate, useWallet };