@spicenet-io/spiceflow-ui 1.9.1 → 1.9.3

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.cjs.js CHANGED
@@ -4131,11 +4131,13 @@ const DepositStatusPanel = ({
4131
4131
  border: `1px solid ${theme.colors.border}`,
4132
4132
  borderRadius: theme.borderRadius.lg,
4133
4133
  padding: theme.spacing.lg,
4134
- color: theme.colors.text
4134
+ color: theme.colors.text,
4135
+ overflow: "visible"
4135
4136
  };
4136
4137
  const headerStyles = {
4137
4138
  textAlign: "center",
4138
- marginBottom: theme.spacing.lg
4139
+ marginBottom: theme.spacing.lg,
4140
+ overflow: "visible"
4139
4141
  };
4140
4142
  const iconContainerStyles = {
4141
4143
  width: "5rem",
@@ -4157,7 +4159,10 @@ const DepositStatusPanel = ({
4157
4159
  };
4158
4160
  const descriptionStyles = {
4159
4161
  fontSize: theme.typography.fontSize.sm,
4160
- color: theme.colors.textMuted
4162
+ color: theme.colors.textMuted,
4163
+ wordWrap: "break-word",
4164
+ overflowWrap: "break-word",
4165
+ whiteSpace: "normal"
4161
4166
  };
4162
4167
  const buttonContainerStyles = {
4163
4168
  display: "flex",
@@ -4311,11 +4316,80 @@ const DepositStatusPanel = ({
4311
4316
  fullWidth: true,
4312
4317
  onClick: onNewDeposit,
4313
4318
  theme,
4319
+ style: {
4320
+ width: "100%",
4321
+ padding: "16px",
4322
+ backgroundColor: "#ea4b4b",
4323
+ color: "#0e0d0b",
4324
+ border: "1px solid #0e0d0b",
4325
+ fontWeight: 500,
4326
+ fontSize: "18px",
4327
+ textTransform: "uppercase",
4328
+ cursor: "pointer",
4329
+ marginTop: "20px",
4330
+ display: "flex",
4331
+ alignItems: "center",
4332
+ justifyContent: "center",
4333
+ gap: "8px",
4334
+ transition: "all 150ms ease"
4335
+ },
4314
4336
  children: "New Deposit"
4315
4337
  }
4316
4338
  ),
4317
- intentStatus.overallStatus === "failed" && onRetry && /* @__PURE__ */ jsxRuntime.jsx(Button.Button, { variant: "error", fullWidth: true, onClick: onRetry, theme, children: "Try Again" }),
4318
- intentStatus.overallStatus === "processing" && /* @__PURE__ */ jsxRuntime.jsx(Button.Button, { variant: "ghost", fullWidth: true, onClick: onClose, theme, children: "Cancel" })
4339
+ intentStatus.overallStatus === "failed" && onRetry && /* @__PURE__ */ jsxRuntime.jsx(
4340
+ Button.Button,
4341
+ {
4342
+ variant: "error",
4343
+ fullWidth: true,
4344
+ onClick: onRetry,
4345
+ theme,
4346
+ style: {
4347
+ width: "100%",
4348
+ padding: "16px",
4349
+ backgroundColor: "#ea4b4b",
4350
+ color: "#0e0d0b",
4351
+ border: "1px solid #0e0d0b",
4352
+ fontWeight: 500,
4353
+ fontSize: "18px",
4354
+ textTransform: "uppercase",
4355
+ cursor: "pointer",
4356
+ marginTop: "20px",
4357
+ display: "flex",
4358
+ alignItems: "center",
4359
+ justifyContent: "center",
4360
+ gap: "8px",
4361
+ transition: "all 150ms ease"
4362
+ },
4363
+ children: "Try Again"
4364
+ }
4365
+ ),
4366
+ intentStatus.overallStatus === "processing" && /* @__PURE__ */ jsxRuntime.jsx(
4367
+ Button.Button,
4368
+ {
4369
+ variant: "ghost",
4370
+ fullWidth: true,
4371
+ onClick: onClose,
4372
+ theme,
4373
+ style: {
4374
+ width: "100%",
4375
+ padding: "16px",
4376
+ backgroundColor: "#ea4b4b",
4377
+ color: "#0e0d0b",
4378
+ border: "1px solid #0e0d0b",
4379
+ fontWeight: 500,
4380
+ fontSize: "18px",
4381
+ textTransform: "uppercase",
4382
+ cursor: "pointer",
4383
+ marginTop: "20px",
4384
+ display: "flex",
4385
+ alignItems: "center",
4386
+ justifyContent: "center",
4387
+ gap: "8px",
4388
+ transition: "all 150ms ease"
4389
+ },
4390
+ children: "Cancel"
4391
+ }
4392
+ )
4319
4393
  ] })
4320
4394
  ] });
4321
4395
  };
@@ -5084,6 +5158,825 @@ const DepositWidgetModal = ({
5084
5158
  );
5085
5159
  };
5086
5160
 
5161
+ const AssetInput = ({
5162
+ asset,
5163
+ amount,
5164
+ onAmountChange,
5165
+ onPercentageClick,
5166
+ usdValue,
5167
+ disabled,
5168
+ styles,
5169
+ theme
5170
+ }) => {
5171
+ const balance = asset.balanceFormatted ?? 0;
5172
+ const numericAmount = parseFloat(amount) || 0;
5173
+ const currentPercentage = balance > 0 ? numericAmount / balance * 100 : 0;
5174
+ const handleInputChange = (e) => {
5175
+ const value = e.target.value;
5176
+ if (value === "" || /^\d*\.?\d*$/.test(value)) {
5177
+ onAmountChange(value);
5178
+ }
5179
+ };
5180
+ return /* @__PURE__ */ jsxRuntime.jsx(
5181
+ "div",
5182
+ {
5183
+ style: {
5184
+ backgroundColor: "#e9e9e9",
5185
+ border: "0.5px solid #a8a8a7",
5186
+ borderRadius: "6px",
5187
+ padding: "16px",
5188
+ height: "144px",
5189
+ display: "flex",
5190
+ flexDirection: "column",
5191
+ gap: "8px",
5192
+ position: "relative"
5193
+ },
5194
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
5195
+ "div",
5196
+ {
5197
+ style: {
5198
+ flex: 1,
5199
+ display: "flex",
5200
+ alignItems: "center",
5201
+ justifyContent: "space-between"
5202
+ },
5203
+ children: [
5204
+ /* @__PURE__ */ jsxRuntime.jsx(
5205
+ "div",
5206
+ {
5207
+ style: {
5208
+ display: "flex",
5209
+ flexDirection: "column",
5210
+ justifyContent: "space-between",
5211
+ height: "100%"
5212
+ },
5213
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
5214
+ /* @__PURE__ */ jsxRuntime.jsx(
5215
+ "span",
5216
+ {
5217
+ style: {
5218
+ fontFamily: styles?.fontFamily || theme.typography.fontFamily,
5219
+ fontSize: "16px",
5220
+ fontWeight: 500,
5221
+ color: "#7d7c7b",
5222
+ lineHeight: "24px"
5223
+ },
5224
+ children: "Amount"
5225
+ }
5226
+ ),
5227
+ /* @__PURE__ */ jsxRuntime.jsx(
5228
+ "input",
5229
+ {
5230
+ type: "text",
5231
+ value: amount,
5232
+ onChange: handleInputChange,
5233
+ placeholder: "0.00",
5234
+ disabled,
5235
+ style: {
5236
+ fontFamily: styles?.fontFamily || theme.typography.fontFamily,
5237
+ fontSize: "40px",
5238
+ fontWeight: 700,
5239
+ color: disabled ? "rgba(14, 13, 11, 0.16)" : amount ? "#0e0d0b" : "#d1d5db",
5240
+ lineHeight: "1.08",
5241
+ letterSpacing: "-1.2px",
5242
+ backgroundColor: "transparent",
5243
+ border: "none",
5244
+ outline: "none",
5245
+ padding: 0,
5246
+ width: "100%",
5247
+ maxWidth: "200px"
5248
+ }
5249
+ }
5250
+ )
5251
+ ] })
5252
+ }
5253
+ ),
5254
+ /* @__PURE__ */ jsxRuntime.jsxs(
5255
+ "div",
5256
+ {
5257
+ style: {
5258
+ display: "flex",
5259
+ flexDirection: "column",
5260
+ alignItems: "flex-end",
5261
+ justifyContent: "space-between",
5262
+ height: "100%",
5263
+ gap: "12px"
5264
+ },
5265
+ children: [
5266
+ /* @__PURE__ */ jsxRuntime.jsxs(
5267
+ "div",
5268
+ {
5269
+ style: {
5270
+ display: "flex",
5271
+ flexDirection: "column",
5272
+ gap: "8px",
5273
+ alignItems: "flex-end"
5274
+ },
5275
+ children: [
5276
+ /* @__PURE__ */ jsxRuntime.jsxs(
5277
+ "span",
5278
+ {
5279
+ style: {
5280
+ fontFamily: styles?.fontFamily || theme.typography.fontFamily,
5281
+ fontSize: "12px",
5282
+ fontWeight: 500,
5283
+ color: "#71757a",
5284
+ lineHeight: "16px"
5285
+ },
5286
+ children: [
5287
+ "Balance: ",
5288
+ balance.toFixed(4)
5289
+ ]
5290
+ }
5291
+ ),
5292
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "128px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
5293
+ "div",
5294
+ {
5295
+ style: {
5296
+ border: "1px solid #CDCFD1",
5297
+ borderRadius: "6px 6px 6px 6px",
5298
+ backgroundColor: "#ffffff",
5299
+ padding: "8px 12px 8px 8px",
5300
+ display: "flex",
5301
+ alignItems: "center",
5302
+ gap: "8px"
5303
+ },
5304
+ children: [
5305
+ /* @__PURE__ */ jsxRuntime.jsx(
5306
+ TokenIcon,
5307
+ {
5308
+ symbol: asset.symbol,
5309
+ logoURI: asset.logoURI,
5310
+ size: 30,
5311
+ theme
5312
+ }
5313
+ ),
5314
+ /* @__PURE__ */ jsxRuntime.jsx(
5315
+ "span",
5316
+ {
5317
+ style: {
5318
+ fontFamily: styles?.fontFamily || theme.typography.fontFamily,
5319
+ fontSize: "16px",
5320
+ fontWeight: 500,
5321
+ color: "#3c3e42",
5322
+ lineHeight: "1.5"
5323
+ },
5324
+ children: asset.symbol
5325
+ }
5326
+ )
5327
+ ]
5328
+ }
5329
+ ) })
5330
+ ]
5331
+ }
5332
+ ),
5333
+ /* @__PURE__ */ jsxRuntime.jsx(
5334
+ "div",
5335
+ {
5336
+ style: {
5337
+ display: "flex",
5338
+ gap: "10px",
5339
+ height: "14px",
5340
+ alignItems: "center",
5341
+ justifyContent: "flex-end"
5342
+ },
5343
+ children: [0, 25, 50, 75, 100].map((pct, index) => {
5344
+ const isActive = Math.abs(currentPercentage - pct) < 1;
5345
+ const isLast = index === 4;
5346
+ const fillPercent = pct / 100;
5347
+ return /* @__PURE__ */ jsxRuntime.jsx(
5348
+ "button",
5349
+ {
5350
+ onClick: () => onPercentageClick(pct),
5351
+ disabled,
5352
+ title: `${pct}%`,
5353
+ style: {
5354
+ width: "14px",
5355
+ height: "14px",
5356
+ padding: 0,
5357
+ border: "none",
5358
+ backgroundColor: "transparent",
5359
+ cursor: disabled ? "not-allowed" : "pointer",
5360
+ opacity: isActive ? 1 : 0.5
5361
+ },
5362
+ children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", children: [
5363
+ /* @__PURE__ */ jsxRuntime.jsx(
5364
+ "circle",
5365
+ {
5366
+ cx: "7",
5367
+ cy: "7",
5368
+ r: "6.84375",
5369
+ fill: isLast ? "#ea4b4b" : "none",
5370
+ stroke: isLast ? "#ea4b4b" : "#3C3E42",
5371
+ strokeWidth: "0.3125"
5372
+ }
5373
+ ),
5374
+ !isLast && fillPercent > 0 && /* @__PURE__ */ jsxRuntime.jsx(
5375
+ "path",
5376
+ {
5377
+ d: `M 7 7 L 7 0.15625 A 6.84375 6.84375 0 ${fillPercent > 0.5 ? 1 : 0} 1 ${7 + 6.84375 * Math.sin(fillPercent * 2 * Math.PI)} ${7 - 6.84375 * Math.cos(fillPercent * 2 * Math.PI)} Z`,
5378
+ fill: "#3C3E42"
5379
+ }
5380
+ )
5381
+ ] })
5382
+ },
5383
+ pct
5384
+ );
5385
+ })
5386
+ }
5387
+ )
5388
+ ]
5389
+ }
5390
+ )
5391
+ ]
5392
+ }
5393
+ )
5394
+ }
5395
+ );
5396
+ };
5397
+
5398
+ const CrossChainDepositModal = ({
5399
+ isOpen,
5400
+ onClose,
5401
+ onComplete,
5402
+ chainId,
5403
+ externalWalletAddress,
5404
+ escrowAddress = "0xeee2b52e7CFe6e2168341a34cEB783b68FEdf1A2",
5405
+ getChainConfig,
5406
+ getSupportedTokens
5407
+ }) => {
5408
+ const theme = Button.createTheme("light");
5409
+ const [selectedAssets, setSelectedAssets] = React.useState(/* @__PURE__ */ new Map());
5410
+ const [isExecuting, setIsExecuting] = React.useState(false);
5411
+ const [error, setError] = React.useState(null);
5412
+ const [depositResults, setDepositResults] = React.useState([]);
5413
+ const [isSuccess, setIsSuccess] = React.useState(false);
5414
+ const { chain: currentChain } = wagmi.useAccount();
5415
+ const { data: walletClient, isLoading: isWalletClientLoading } = wagmi.useWalletClient();
5416
+ const { switchChainAsync } = wagmi.useSwitchChain();
5417
+ const supportedTokens = React.useMemo(
5418
+ () => getSupportedTokens(chainId),
5419
+ [chainId, getSupportedTokens]
5420
+ );
5421
+ const { data: tokenBalances } = wagmi.useReadContracts({
5422
+ contracts: supportedTokens.map((token) => ({
5423
+ address: token.address,
5424
+ abi: viem.erc20Abi,
5425
+ functionName: "balanceOf",
5426
+ args: [externalWalletAddress],
5427
+ chainId
5428
+ }))
5429
+ });
5430
+ const assets = React.useMemo(() => {
5431
+ const chainConfig2 = getChainConfig(chainId);
5432
+ if (!chainConfig2) return [];
5433
+ const assetList = [];
5434
+ supportedTokens.forEach((token, index) => {
5435
+ const balanceResult = tokenBalances?.[index];
5436
+ const balance = balanceResult?.status === "success" ? balanceResult.result : BigInt(0);
5437
+ const balanceFormatted = Number(balance) / Math.pow(10, token.decimals);
5438
+ assetList.push({
5439
+ address: token.address,
5440
+ symbol: token.symbol,
5441
+ name: token.name,
5442
+ decimals: token.decimals,
5443
+ isNative: false,
5444
+ chainId,
5445
+ balance,
5446
+ balanceFormatted
5447
+ });
5448
+ });
5449
+ return assetList;
5450
+ }, [chainId, tokenBalances, supportedTokens, getChainConfig]);
5451
+ React.useEffect(() => {
5452
+ if (assets.length > 0 && selectedAssets.size > 0) {
5453
+ const updatedSelections = new Map(selectedAssets);
5454
+ let hasChanges = false;
5455
+ selectedAssets.forEach((selection, address) => {
5456
+ const updatedAsset = assets.find((a) => a.address === address);
5457
+ if (updatedAsset && updatedAsset.balanceFormatted !== selection.asset.balanceFormatted) {
5458
+ updatedSelections.set(address, { ...selection, asset: updatedAsset });
5459
+ hasChanges = true;
5460
+ }
5461
+ });
5462
+ if (hasChanges) {
5463
+ setSelectedAssets(updatedSelections);
5464
+ }
5465
+ }
5466
+ }, [assets, selectedAssets]);
5467
+ const chainConfig = getChainConfig(chainId);
5468
+ const toggleAssetSelection = (asset) => {
5469
+ const newSelections = new Map(selectedAssets);
5470
+ if (newSelections.has(asset.address)) {
5471
+ newSelections.delete(asset.address);
5472
+ } else {
5473
+ newSelections.set(asset.address, { asset, amount: "" });
5474
+ }
5475
+ setSelectedAssets(newSelections);
5476
+ setError(null);
5477
+ };
5478
+ const handleAmountChange = (address, value) => {
5479
+ if (value === "" || /^\d*\.?\d*$/.test(value)) {
5480
+ const newSelections = new Map(selectedAssets);
5481
+ const selection = newSelections.get(address);
5482
+ if (selection) {
5483
+ newSelections.set(address, { ...selection, amount: value });
5484
+ setSelectedAssets(newSelections);
5485
+ setError(null);
5486
+ }
5487
+ }
5488
+ };
5489
+ const handlePercentageClick = (address, percentage) => {
5490
+ const selection = selectedAssets.get(address);
5491
+ if (selection?.asset.balanceFormatted !== void 0) {
5492
+ const amount = selection.asset.balanceFormatted * percentage / 100;
5493
+ handleAmountChange(address, amount.toString());
5494
+ }
5495
+ };
5496
+ const executeDeposit = React.useCallback(async () => {
5497
+ if (selectedAssets.size === 0) {
5498
+ setError("Please select at least one asset");
5499
+ return;
5500
+ }
5501
+ for (const [address, selection] of Array.from(selectedAssets.entries())) {
5502
+ if (!selection.amount) {
5503
+ setError(`Please enter an amount for ${selection.asset.symbol}`);
5504
+ return;
5505
+ }
5506
+ const amount = parseFloat(selection.amount);
5507
+ if (isNaN(amount) || amount <= 0) {
5508
+ setError(`Please enter a valid amount for ${selection.asset.symbol}`);
5509
+ return;
5510
+ }
5511
+ const currentAsset = assets.find((a) => a.address === address);
5512
+ const currentBalance = currentAsset?.balanceFormatted ?? selection.asset.balanceFormatted;
5513
+ if (currentBalance !== void 0 && amount > currentBalance) {
5514
+ setError(`Insufficient ${selection.asset.symbol} balance`);
5515
+ return;
5516
+ }
5517
+ }
5518
+ if (!walletClient) {
5519
+ setError("Wallet not connected. Please reconnect your external wallet.");
5520
+ return;
5521
+ }
5522
+ setIsExecuting(true);
5523
+ setError(null);
5524
+ const results = [];
5525
+ try {
5526
+ if (currentChain?.id !== chainId) {
5527
+ await switchChainAsync({
5528
+ chainId
5529
+ });
5530
+ }
5531
+ for (const [, selection] of Array.from(selectedAssets.entries())) {
5532
+ const { asset, amount } = selection;
5533
+ try {
5534
+ const amountWei = viem.parseUnits(amount, asset.decimals);
5535
+ let hash;
5536
+ if (asset.isNative) {
5537
+ hash = await walletClient.sendTransaction({
5538
+ to: escrowAddress,
5539
+ value: amountWei
5540
+ });
5541
+ } else {
5542
+ const data = viem.encodeFunctionData({
5543
+ abi: viem.erc20Abi,
5544
+ functionName: "transfer",
5545
+ args: [escrowAddress, amountWei]
5546
+ });
5547
+ hash = await walletClient.sendTransaction({
5548
+ to: asset.address,
5549
+ data
5550
+ });
5551
+ }
5552
+ await relayerService.submitSpiceDeposit({
5553
+ txHash: hash,
5554
+ sender: externalWalletAddress,
5555
+ tokenAddress: asset.address,
5556
+ chainId,
5557
+ amount: amount.toString(),
5558
+ user: escrowAddress,
5559
+ isDeposit: true
5560
+ });
5561
+ results.push({ asset, txHash: hash, success: true });
5562
+ } catch (err) {
5563
+ console.error(`Deposit error for ${asset.symbol}:`, err);
5564
+ const error2 = err;
5565
+ let errorMsg = error2?.message || "Deposit failed";
5566
+ if (error2?.code === 4001 || error2?.message?.includes("rejected")) {
5567
+ errorMsg = "Transaction rejected by user";
5568
+ } else if (error2?.message?.includes("insufficient funds")) {
5569
+ errorMsg = "Insufficient funds for transaction";
5570
+ }
5571
+ results.push({ asset, txHash: "", success: false, error: errorMsg });
5572
+ }
5573
+ }
5574
+ setDepositResults(results);
5575
+ setIsSuccess(true);
5576
+ } catch (err) {
5577
+ console.error("Deposit error:", err);
5578
+ const error2 = err;
5579
+ setError(error2?.message || "Deposit failed");
5580
+ } finally {
5581
+ setIsExecuting(false);
5582
+ }
5583
+ }, [
5584
+ selectedAssets,
5585
+ walletClient,
5586
+ currentChain,
5587
+ chainId,
5588
+ switchChainAsync,
5589
+ escrowAddress,
5590
+ assets,
5591
+ externalWalletAddress
5592
+ ]);
5593
+ React.useEffect(() => {
5594
+ if (!isOpen) {
5595
+ setSelectedAssets(/* @__PURE__ */ new Map());
5596
+ setError(null);
5597
+ setDepositResults([]);
5598
+ setIsSuccess(false);
5599
+ setIsExecuting(false);
5600
+ }
5601
+ }, [isOpen]);
5602
+ const canDeposit = selectedAssets.size > 0 && Array.from(selectedAssets.values()).every(
5603
+ (s) => s.amount && parseFloat(s.amount) > 0
5604
+ ) && !isExecuting && !isSuccess && walletClient;
5605
+ const subtitle = /* @__PURE__ */ jsxRuntime.jsxs(
5606
+ "div",
5607
+ {
5608
+ style: {
5609
+ display: "flex",
5610
+ alignItems: "flex-start",
5611
+ gap: "5px",
5612
+ backgroundColor: "#f9fafb",
5613
+ border: "1px solid #ed6969",
5614
+ borderRadius: "8px",
5615
+ padding: "10px",
5616
+ margin: "0 0 0 0"
5617
+ },
5618
+ children: [
5619
+ /* @__PURE__ */ jsxRuntime.jsx(
5620
+ "img",
5621
+ {
5622
+ src: img$c,
5623
+ alt: "Info",
5624
+ style: {
5625
+ width: "14px",
5626
+ height: "14px",
5627
+ marginTop: "2px",
5628
+ flexShrink: 0
5629
+ }
5630
+ }
5631
+ ),
5632
+ /* @__PURE__ */ jsxRuntime.jsxs(
5633
+ "p",
5634
+ {
5635
+ style: {
5636
+ fontSize: "13px",
5637
+ color: "#374151",
5638
+ margin: 0,
5639
+ lineHeight: "1.5"
5640
+ },
5641
+ children: [
5642
+ "Select tokens and enter amounts to deposit to your Spicenet Account on",
5643
+ " ",
5644
+ chainConfig?.displayName || `Chain ${chainId}`,
5645
+ "."
5646
+ ]
5647
+ }
5648
+ )
5649
+ ]
5650
+ }
5651
+ );
5652
+ const successOverlay = isSuccess && depositResults.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
5653
+ "div",
5654
+ {
5655
+ style: {
5656
+ position: "absolute",
5657
+ inset: 0,
5658
+ backgroundColor: "white",
5659
+ zIndex: 10,
5660
+ borderRadius: "12px",
5661
+ padding: "24px",
5662
+ display: "flex",
5663
+ flexDirection: "column",
5664
+ alignItems: "center",
5665
+ justifyContent: "flex-start",
5666
+ gap: "16px",
5667
+ overflowY: "auto",
5668
+ paddingTop: "40px"
5669
+ },
5670
+ children: [
5671
+ /* @__PURE__ */ jsxRuntime.jsx(
5672
+ "div",
5673
+ {
5674
+ style: {
5675
+ width: "64px",
5676
+ height: "64px",
5677
+ borderRadius: "50%",
5678
+ backgroundColor: "#dcfce7",
5679
+ display: "flex",
5680
+ alignItems: "center",
5681
+ justifyContent: "center"
5682
+ },
5683
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "28px", color: "#16a34a" }, children: "\u2713" })
5684
+ }
5685
+ ),
5686
+ /* @__PURE__ */ jsxRuntime.jsx(
5687
+ "p",
5688
+ {
5689
+ style: {
5690
+ fontWeight: 600,
5691
+ fontSize: "18px",
5692
+ color: "#166534",
5693
+ margin: 0
5694
+ },
5695
+ children: "Deposits Complete!"
5696
+ }
5697
+ ),
5698
+ /* @__PURE__ */ jsxRuntime.jsx(
5699
+ "div",
5700
+ {
5701
+ style: {
5702
+ width: "100%",
5703
+ maxHeight: "200px",
5704
+ overflowY: "auto",
5705
+ display: "flex",
5706
+ flexDirection: "column",
5707
+ gap: "8px"
5708
+ },
5709
+ children: depositResults.map((result, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
5710
+ "div",
5711
+ {
5712
+ style: {
5713
+ padding: "12px",
5714
+ borderRadius: "8px",
5715
+ border: `1px solid ${result.success ? "#bbf7d0" : "#fecaca"}`,
5716
+ backgroundColor: result.success ? "#f0fdf4" : "#fef2f2",
5717
+ overflow: "visible"
5718
+ },
5719
+ children: [
5720
+ /* @__PURE__ */ jsxRuntime.jsxs(
5721
+ "div",
5722
+ {
5723
+ style: {
5724
+ display: "flex",
5725
+ justifyContent: "space-between",
5726
+ alignItems: "center"
5727
+ },
5728
+ children: [
5729
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 500 }, children: result.asset.symbol }),
5730
+ /* @__PURE__ */ jsxRuntime.jsx(
5731
+ "span",
5732
+ {
5733
+ style: {
5734
+ color: result.success ? "#16a34a" : "#dc2626",
5735
+ fontSize: "14px"
5736
+ },
5737
+ children: result.success ? "\u2713 Success" : "\u2717 Failed"
5738
+ }
5739
+ )
5740
+ ]
5741
+ }
5742
+ ),
5743
+ result.success && result.txHash && /* @__PURE__ */ jsxRuntime.jsx(
5744
+ "a",
5745
+ {
5746
+ href: `${chainConfig?.blockExplorers?.default?.url}/tx/${result.txHash}`,
5747
+ target: "_blank",
5748
+ rel: "noopener noreferrer",
5749
+ style: {
5750
+ fontSize: "12px",
5751
+ color: theme.colors.primary,
5752
+ textDecoration: "none"
5753
+ },
5754
+ children: "View on Explorer \u2192"
5755
+ }
5756
+ ),
5757
+ result.error && /* @__PURE__ */ jsxRuntime.jsx(
5758
+ "p",
5759
+ {
5760
+ style: {
5761
+ fontSize: "12px",
5762
+ color: "#dc2626",
5763
+ margin: "4px 0 0 0",
5764
+ wordWrap: "break-word",
5765
+ overflowWrap: "break-word",
5766
+ whiteSpace: "normal"
5767
+ },
5768
+ children: result.error
5769
+ }
5770
+ )
5771
+ ]
5772
+ },
5773
+ idx
5774
+ ))
5775
+ }
5776
+ ),
5777
+ /* @__PURE__ */ jsxRuntime.jsx(
5778
+ "button",
5779
+ {
5780
+ onClick: onComplete,
5781
+ style: {
5782
+ width: "100%",
5783
+ padding: "14px",
5784
+ borderRadius: "8px",
5785
+ backgroundColor: theme.colors.primary,
5786
+ color: "white",
5787
+ border: "none",
5788
+ fontWeight: 600,
5789
+ fontSize: "16px",
5790
+ cursor: "pointer",
5791
+ marginTop: "8px"
5792
+ },
5793
+ children: "Done"
5794
+ }
5795
+ )
5796
+ ]
5797
+ }
5798
+ ) : null;
5799
+ return /* @__PURE__ */ jsxRuntime.jsx(
5800
+ SpiceModalShell,
5801
+ {
5802
+ isOpen,
5803
+ onClose,
5804
+ title: "Deposit to Spicenet",
5805
+ subtitle,
5806
+ theme,
5807
+ maxWidth: "480px",
5808
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "0 24px 24px 24px", position: "relative" }, children: [
5809
+ successOverlay,
5810
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: "16px" }, children: [
5811
+ /* @__PURE__ */ jsxRuntime.jsxs(
5812
+ "div",
5813
+ {
5814
+ style: {
5815
+ display: "flex",
5816
+ alignItems: "center",
5817
+ gap: "6px",
5818
+ marginBottom: "12px"
5819
+ },
5820
+ children: [
5821
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "14px", color: "#6b7280" }, children: "\u25CE" }),
5822
+ /* @__PURE__ */ jsxRuntime.jsx(
5823
+ "label",
5824
+ {
5825
+ style: {
5826
+ fontSize: "14px",
5827
+ fontWeight: 500,
5828
+ color: "#374151"
5829
+ },
5830
+ children: "Select Assets to Deposit"
5831
+ }
5832
+ )
5833
+ ]
5834
+ }
5835
+ ),
5836
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" }, children: assets.map((asset) => {
5837
+ const isSelected = selectedAssets.has(asset.address);
5838
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5839
+ "button",
5840
+ {
5841
+ onClick: () => toggleAssetSelection(asset),
5842
+ style: {
5843
+ padding: "8px 16px",
5844
+ borderRadius: "8px",
5845
+ border: `2px solid ${isSelected ? theme.colors.primary : "#e5e7eb"}`,
5846
+ backgroundColor: isSelected ? "#FEF2F2" : "white",
5847
+ cursor: "pointer",
5848
+ display: "flex",
5849
+ alignItems: "center",
5850
+ gap: "8px",
5851
+ transition: "all 150ms ease"
5852
+ },
5853
+ children: [
5854
+ /* @__PURE__ */ jsxRuntime.jsx(
5855
+ "div",
5856
+ {
5857
+ style: {
5858
+ width: "24px",
5859
+ height: "24px",
5860
+ borderRadius: "50%",
5861
+ backgroundColor: asset.symbol === "USDC" ? "#2775CA" : asset.symbol === "USDT" ? "#26A17B" : "#F7931A",
5862
+ display: "flex",
5863
+ alignItems: "center",
5864
+ justifyContent: "center",
5865
+ color: "white",
5866
+ fontSize: "10px",
5867
+ fontWeight: 700
5868
+ },
5869
+ children: asset.symbol === "USDC" ? "$" : asset.symbol === "USDT" ? "\u20AE" : "\u20BF"
5870
+ }
5871
+ ),
5872
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 600, color: "#111827" }, children: asset.symbol }),
5873
+ asset.balanceFormatted !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs(
5874
+ "span",
5875
+ {
5876
+ style: {
5877
+ fontSize: "13px",
5878
+ color: "#9ca3af",
5879
+ fontFamily: "monospace"
5880
+ },
5881
+ children: [
5882
+ "(",
5883
+ asset.balanceFormatted.toFixed(4),
5884
+ ")"
5885
+ ]
5886
+ }
5887
+ )
5888
+ ]
5889
+ },
5890
+ asset.address
5891
+ );
5892
+ }) })
5893
+ ] }),
5894
+ selectedAssets.size > 0 && /* @__PURE__ */ jsxRuntime.jsx(
5895
+ "div",
5896
+ {
5897
+ style: { display: "flex", flexDirection: "column", gap: "16px" },
5898
+ children: Array.from(selectedAssets.values()).map(({ asset, amount }) => /* @__PURE__ */ jsxRuntime.jsx(
5899
+ AssetInput,
5900
+ {
5901
+ asset,
5902
+ amount,
5903
+ onAmountChange: (value) => handleAmountChange(asset.address, value),
5904
+ onPercentageClick: (pct) => handlePercentageClick(asset.address, pct),
5905
+ theme,
5906
+ disabled: isExecuting
5907
+ },
5908
+ asset.address
5909
+ ))
5910
+ }
5911
+ ),
5912
+ error && /* @__PURE__ */ jsxRuntime.jsx(
5913
+ "div",
5914
+ {
5915
+ style: {
5916
+ padding: "12px",
5917
+ backgroundColor: "#fef2f2",
5918
+ border: "1px solid #fecaca",
5919
+ borderRadius: "8px",
5920
+ marginTop: "16px"
5921
+ },
5922
+ children: /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontSize: "14px", color: "#dc2626", margin: 0 }, children: error })
5923
+ }
5924
+ ),
5925
+ !isSuccess && /* @__PURE__ */ jsxRuntime.jsx(
5926
+ Button.Button,
5927
+ {
5928
+ variant: "outline",
5929
+ fullWidth: true,
5930
+ onClick: executeDeposit,
5931
+ loading: isExecuting,
5932
+ disabled: !canDeposit,
5933
+ theme,
5934
+ style: {
5935
+ width: "100%",
5936
+ padding: "16px",
5937
+ backgroundColor: "#ea4b4b",
5938
+ color: "#0e0d0b",
5939
+ border: "1px solid #0e0d0b",
5940
+ fontWeight: 500,
5941
+ fontSize: "18px",
5942
+ textTransform: "uppercase",
5943
+ cursor: canDeposit ? "pointer" : "not-allowed",
5944
+ marginTop: "20px",
5945
+ display: "flex",
5946
+ alignItems: "center",
5947
+ justifyContent: "center",
5948
+ gap: "8px",
5949
+ transition: "all 150ms ease"
5950
+ },
5951
+ children: isExecuting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5952
+ /* @__PURE__ */ jsxRuntime.jsx(
5953
+ "div",
5954
+ {
5955
+ style: {
5956
+ width: "18px",
5957
+ height: "18px",
5958
+ border: "2px solid white",
5959
+ borderTopColor: "transparent",
5960
+ borderRadius: "50%",
5961
+ animation: "spin 1s linear infinite"
5962
+ }
5963
+ }
5964
+ ),
5965
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "PROCESSING..." })
5966
+ ] }) : isWalletClientLoading ? "CONNECTING WALLET..." : !walletClient ? "WALLET NOT CONNECTED" : selectedAssets.size === 0 ? "SELECT ASSETS" : !Array.from(selectedAssets.values()).every((s) => s.amount) ? "ENTER AMOUNTS" : "DEPOSIT"
5967
+ }
5968
+ ),
5969
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
5970
+ @keyframes spin {
5971
+ from { transform: rotate(0deg); }
5972
+ to { transform: rotate(360deg); }
5973
+ }
5974
+ ` })
5975
+ ] })
5976
+ }
5977
+ );
5978
+ };
5979
+
5087
5980
  /**
5088
5981
  * @license lucide-react v0.383.0 - ISC
5089
5982
  *
@@ -12654,6 +13547,7 @@ const useDepositInput = () => {
12654
13547
  };
12655
13548
 
12656
13549
  exports.ConnectWalletModal = ConnectWalletModal;
13550
+ exports.CrossChainDepositModal = CrossChainDepositModal;
12657
13551
  exports.DepositModal = DepositModal;
12658
13552
  exports.DepositWidget = DepositWidget;
12659
13553
  exports.DepositWidgetModal = DepositWidgetModal;