@n1xyz/wallet-widget 0.0.5 → 0.0.8

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.
Files changed (92) hide show
  1. package/dist/Logic/sessionManager.d.ts +1 -1
  2. package/dist/Logic/sessionManager.js +9 -5
  3. package/dist/Logic/transactionManager.js +7 -3
  4. package/dist/Logic/utils.js +9 -12
  5. package/dist/Modal/N1WalletModal.js +2 -3
  6. package/dist/Modal/NTSFlow/NTSFlow.js +7 -3
  7. package/dist/Modal/NTSFlow/components/BackButton.js +0 -1
  8. package/dist/Modal/NTSFlow/views/CreateSessionView.js +1 -1
  9. package/dist/Modal/NordFlow/NordFlow.js +27 -22
  10. package/dist/Modal/NordFlow/components/ChainButton.d.ts +1 -1
  11. package/dist/Modal/NordFlow/components/ChainButton.js +8 -8
  12. package/dist/Modal/NordFlow/components/EVMChainsButton.d.ts +8 -0
  13. package/dist/Modal/NordFlow/components/EVMChainsButton.js +18 -0
  14. package/dist/Modal/NordFlow/components/MoreButton.d.ts +8 -0
  15. package/dist/Modal/NordFlow/components/MoreButton.js +18 -0
  16. package/dist/Modal/NordFlow/components/TransactionTable.d.ts +1 -1
  17. package/dist/Modal/NordFlow/components/TransactionTable.js +8 -6
  18. package/dist/Modal/NordFlow/constants.js +9 -4
  19. package/dist/Modal/NordFlow/hooks/useDepositFlow.js +39 -18
  20. package/dist/Modal/NordFlow/hooks/useFlowState.js +5 -4
  21. package/dist/Modal/NordFlow/hooks/useNordInstance.js +17 -8
  22. package/dist/Modal/NordFlow/hooks/useNordWalletConnect.js +28 -20
  23. package/dist/Modal/NordFlow/screens/02-EvmWalletAuthScreen.js +1 -1
  24. package/dist/Modal/NordFlow/screens/03-ChainSelectionScreen.js +39 -23
  25. package/dist/Modal/NordFlow/screens/04-AmountInputScreen.d.ts +4 -1
  26. package/dist/Modal/NordFlow/screens/04-AmountInputScreen.js +38 -16
  27. package/dist/Modal/NordFlow/screens/05-DepositProgressScreen.d.ts +1 -1
  28. package/dist/Modal/NordFlow/screens/05-DepositProgressScreen.js +3 -2
  29. package/dist/Modal/NordFlow/screens/06-DepositSuccessScreen.js +3 -1
  30. package/dist/Modal/NordFlow/screens/07-AuthLoadingScreen.d.ts +1 -1
  31. package/dist/Modal/NordFlow/screens/07-AuthLoadingScreen.js +19 -10
  32. package/dist/Modal/NordFlow/screens/08-FinalSuccessScreen.d.ts +1 -1
  33. package/dist/Modal/NordFlow/screens/08-FinalSuccessScreen.js +3 -3
  34. package/dist/Modal/NordFlow/screens/09-ErrorScreen.d.ts +1 -1
  35. package/dist/Modal/NordFlow/screens/09-ErrorScreen.js +11 -6
  36. package/dist/Modal/NordFlow/types.d.ts +4 -1
  37. package/dist/Modal/NordFlow/types.js +1 -0
  38. package/dist/Modal/NordFlow/utils/imageUtils.js +3 -3
  39. package/dist/Modal/NordFlow/utils/nordUtils.js +3 -1
  40. package/dist/Modal/Sidebar/N1Sidebar.js +11 -5
  41. package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketOverview.d.ts +1 -1
  42. package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketSelector.d.ts +1 -1
  43. package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketSelector.js +7 -3
  44. package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketStats.d.ts +1 -1
  45. package/dist/Modal/Sidebar/NordTradingView/NordTradingView.js +7 -7
  46. package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBook.js +27 -16
  47. package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookDepthVisualizer.d.ts +1 -1
  48. package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookHeader.d.ts +1 -1
  49. package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookHeader.js +3 -2
  50. package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookTable.d.ts +1 -1
  51. package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookTable.js +2 -3
  52. package/dist/Modal/Sidebar/NordTradingView/TradeForm/AmountInput.d.ts +1 -1
  53. package/dist/Modal/Sidebar/NordTradingView/TradeForm/BuySellTabs.js +2 -2
  54. package/dist/Modal/Sidebar/NordTradingView/TradeForm/FillModeSelector.d.ts +1 -1
  55. package/dist/Modal/Sidebar/NordTradingView/TradeForm/FillModeSelector.js +16 -13
  56. package/dist/Modal/Sidebar/NordTradingView/TradeForm/OrderTypeSelector.d.ts +1 -1
  57. package/dist/Modal/Sidebar/NordTradingView/TradeForm/OrderTypeSelector.js +17 -11
  58. package/dist/Modal/Sidebar/NordTradingView/TradeForm/PriceInput.d.ts +1 -1
  59. package/dist/Modal/Sidebar/NordTradingView/TradeForm/SubmitButton.d.ts +1 -1
  60. package/dist/Modal/Sidebar/NordTradingView/TradeForm/SubmitButton.js +2 -2
  61. package/dist/Modal/Sidebar/NordTradingView/TradeForm/TotalCalculator.d.ts +1 -1
  62. package/dist/Modal/Sidebar/NordTradingView/TradeForm/TotalCalculator.js +3 -1
  63. package/dist/Modal/Sidebar/NordTradingView/TradeForm/TradeForm.js +21 -11
  64. package/dist/Modal/Sidebar/NordTradingView/UserBalances/UserBalances.js +1 -1
  65. package/dist/Modal/Sidebar/NordTradingView/UserOrders/UserOrders.js +11 -6
  66. package/dist/Modal/Sidebar/NordTradingView/UserPositions/UserPositions.js +14 -7
  67. package/dist/Provider/LazyWalletProvider.js +11 -5
  68. package/dist/Provider/N1WalletProvider.js +6 -5
  69. package/dist/components/logos/ArbitrumLogo.d.ts +8 -0
  70. package/dist/components/logos/ArbitrumLogo.js +5 -0
  71. package/dist/components/logos/BaseLogo.d.ts +8 -0
  72. package/dist/components/logos/BaseLogo.js +5 -0
  73. package/dist/components/logos/BeraLogo.d.ts +8 -0
  74. package/dist/components/logos/BeraLogo.js +5 -0
  75. package/dist/components/logos/BitcoinLogo.d.ts +8 -0
  76. package/dist/components/logos/BitcoinLogo.js +5 -0
  77. package/dist/components/logos/EVMChainsGroup.d.ts +7 -0
  78. package/dist/components/logos/EVMChainsGroup.js +18 -0
  79. package/dist/components/logos/EthereumLogo.d.ts +8 -0
  80. package/dist/components/logos/EthereumLogo.js +5 -0
  81. package/dist/components/logos/HyperliquidLogo.d.ts +8 -0
  82. package/dist/components/logos/HyperliquidLogo.js +5 -0
  83. package/dist/components/logos/MoreChainsGroup.d.ts +7 -0
  84. package/dist/components/logos/MoreChainsGroup.js +18 -0
  85. package/dist/components/logos/OptimismLogo.d.ts +8 -0
  86. package/dist/components/logos/OptimismLogo.js +5 -0
  87. package/dist/components/logos/SolanaLogo.d.ts +8 -0
  88. package/dist/components/logos/SolanaLogo.js +5 -0
  89. package/dist/components/logos/index.d.ts +10 -0
  90. package/dist/components/logos/index.js +10 -0
  91. package/dist/main.css +1 -1
  92. package/package.json +1 -1
@@ -36,13 +36,24 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  };
37
37
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
38
38
  import { useCallback, useEffect, useRef, useState } from 'react';
39
- import { useN1WalletContext, useN1WalletInternalContext } from '../../../Provider/hooks';
39
+ import { useN1WalletContext, useN1WalletInternalContext, } from '../../../Provider/hooks';
40
40
  import { ImageWithFallback } from '../components';
41
- import { ANIMATION_EASE, MAX_DEPOSIT, MIN_DEPOSIT } from '../constants';
41
+ import { ANIMATION_EASE } from '../constants';
42
42
  import { formatAmount, isNordConfigured } from '../utils/nordUtils';
43
43
  export function AmountInputScreen(_a) {
44
44
  var _this = this;
45
- var amount = _a.amount, onAmountChange = _a.onAmountChange, onContinue = _a.onContinue, balance = _a.balance, propFaucetUrl = _a.faucetUrl, refreshBalance = _a.refreshBalance;
45
+ var _amount = _a.amount, // Renamed to _amount since we're not using the prop
46
+ onAmountChange = _a.onAmountChange, onContinue = _a.onContinue, _balance = _a.balance, // Renamed to _balance since we're overriding it
47
+ propFaucetUrl = _a.faucetUrl, refreshBalance = _a.refreshBalance, depositError = _a.depositError;
48
+ // Hard code amount to 100
49
+ var amount = '100';
50
+ // Hard code balance to 0 to allow faucet to trigger
51
+ var balance = 0;
52
+ // Force the amount to be 100 on component mount only, not on every render
53
+ useEffect(function () {
54
+ onAmountChange('100');
55
+ // Empty dependency array ensures this only runs once on mount
56
+ }, []);
46
57
  var _b = useState(false), isHovered = _b[0], setIsHovered = _b[1];
47
58
  var _c = useState(false), isFaucetLoading = _c[0], setIsFaucetLoading = _c[1];
48
59
  var _d = useState(null), faucetError = _d[0], setFaucetError = _d[1];
@@ -74,16 +85,15 @@ export function AmountInputScreen(_a) {
74
85
  }
75
86
  }
76
87
  }, [nord]);
77
- var handleAmountChange = function (e) {
78
- var value = e.target.value;
79
- if (/^\d*\.?\d*$/.test(value)) {
80
- onAmountChange(value);
81
- }
82
- };
88
+ // Removed handleAmountChange since we don't want user to edit the amount
83
89
  // todo:fix
84
90
  var isValidAmount = true;
91
+ // Hard code MIN_DEPOSIT to 100
92
+ var hardcodedMinDeposit = 100;
93
+ // Hard code MAX_DEPOSIT to 100
94
+ var hardcodedMaxDeposit = 100;
85
95
  // Check if faucet is enabled and balance is low
86
- var shouldShowFaucet = faucetUrl && balance < MIN_DEPOSIT && !tokensObtained;
96
+ var shouldShowFaucet = faucetUrl && balance < hardcodedMinDeposit && !tokensObtained;
87
97
  // Determine if we should show the faucet overlay
88
98
  var showFaucetOverlay = (shouldShowFaucet && (isFaucetLoading || faucetError)) || showFaucetSuccess;
89
99
  // Function to request tokens from faucet
@@ -110,7 +120,9 @@ export function AmountInputScreen(_a) {
110
120
  case 2:
111
121
  response = _a.sent();
112
122
  if (!!response.ok) return [3 /*break*/, 4];
113
- return [4 /*yield*/, response.json().catch(function () { return ({ error: 'Failed to request tokens' }); })];
123
+ return [4 /*yield*/, response
124
+ .json()
125
+ .catch(function () { return ({ error: 'Failed to request tokens' }); })];
114
126
  case 3:
115
127
  errorData = _a.sent();
116
128
  throw new Error(errorData.error || 'Failed to request tokens');
@@ -143,23 +155,33 @@ export function AmountInputScreen(_a) {
143
155
  }); }, [faucetUrl, address, refreshBalance]);
144
156
  // Request tokens automatically when faucet is enabled and balance is low
145
157
  useEffect(function () {
146
- if (shouldShowFaucet && !isFaucetLoading && !faucetError && !showFaucetSuccess) {
158
+ if (shouldShowFaucet &&
159
+ !isFaucetLoading &&
160
+ !faucetError &&
161
+ !showFaucetSuccess &&
162
+ depositError == null) {
147
163
  requestTestnetTokens();
148
164
  }
149
- }, [shouldShowFaucet, isFaucetLoading, faucetError, showFaucetSuccess, requestTestnetTokens]);
165
+ }, [
166
+ shouldShowFaucet,
167
+ isFaucetLoading,
168
+ faucetError,
169
+ showFaucetSuccess,
170
+ requestTestnetTokens,
171
+ ]);
150
172
  // Reset tokensObtained state if balance changes to a higher value
151
173
  useEffect(function () {
152
174
  // If balance has increased and is now sufficient, reset the tokensObtained flag
153
- if (balance > prevBalanceRef.current && balance >= MIN_DEPOSIT) {
175
+ if (balance > prevBalanceRef.current && balance >= hardcodedMinDeposit) {
154
176
  setTokensObtained(false);
155
177
  setShowFaucetSuccess(false);
156
178
  }
157
179
  // Update the previous balance reference
158
180
  prevBalanceRef.current = balance;
159
- }, [balance]);
181
+ }, [balance, hardcodedMinDeposit]);
160
182
  // Format the balance with the appropriate number of decimal places
161
183
  var formattedBalance = formatAmount(balance, tokenDecimals);
162
- return (_jsxs("div", { className: "overflow-hidden relative", children: [showFaucetOverlay && (_jsx("div", { className: "absolute inset-0 z-10 bg-white/70 dark:bg-neutral-900/80 backdrop-blur-md flex flex-col items-center justify-center p-6", children: isFaucetLoading ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "relative w-16 h-16 mb-4", children: _jsxs("div", { className: "absolute inset-0 grid grid-cols-2 gap-1", children: [_jsx("div", { className: "relative bg-white dark:bg-neutral-800 border border-gray-100 dark:border-neutral-700 overflow-hidden rounded-sm", children: _jsx("div", { className: "absolute inset-x-0 bottom-0 h-full bg-main/40 dark:bg-main/30 animate-square-loader" }) }), _jsx("div", { className: "relative bg-white dark:bg-neutral-800 border border-gray-100 dark:border-neutral-700 overflow-hidden rounded-sm", children: _jsx("div", { className: "absolute inset-x-0 bottom-0 h-full bg-main/40 dark:bg-main/30 animate-square-loader", style: { animationDelay: '0.2s' } }) }), _jsx("div", { className: "relative bg-white dark:bg-neutral-800 border border-gray-100 dark:border-neutral-700 overflow-hidden rounded-sm", children: _jsx("div", { className: "absolute inset-x-0 bottom-0 h-full bg-main/40 dark:bg-main/30 animate-square-loader", style: { animationDelay: '0.4s' } }) }), _jsx("div", { className: "relative bg-white dark:bg-neutral-800 border border-gray-100 dark:border-neutral-700 overflow-hidden rounded-sm", children: _jsx("div", { className: "absolute inset-x-0 bottom-0 h-full bg-main/40 dark:bg-main/30 animate-square-loader", style: { animationDelay: '0.6s' } }) })] }) }), _jsx("h3", { className: "text-lg font-medium text-gray-800 dark:text-white mb-2", children: "Obtaining Testnet Tokens" }), _jsx("p", { className: "text-sm text-gray-500 dark:text-neutral-400 text-center", children: "Please wait while we request testnet tokens for your wallet..." })] })) : showFaucetSuccess ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-green-500 text-4xl mb-4", children: "\u2713" }), _jsx("h3", { className: "text-lg font-medium text-gray-800 dark:text-white mb-2", children: "Tokens Obtained Successfully" }), _jsx("p", { className: "text-sm text-green-500 dark:text-green-400 text-center mb-4", children: "Your wallet has been funded with testnet tokens." }), _jsx("p", { className: "text-sm text-gray-500 dark:text-neutral-400 text-center", children: "Please wait while your balance updates..." })] })) : faucetError ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-red-500 text-4xl mb-4", children: "\u26A0\uFE0F" }), _jsx("h3", { className: "text-lg font-medium text-gray-800 dark:text-white mb-2", children: "Failed to Get Tokens" }), _jsx("p", { className: "text-sm text-red-500 dark:text-red-400 text-center mb-4", children: faucetError }), _jsx("button", { onClick: requestTestnetTokens, className: "px-4 py-2 bg-main text-white rounded-md hover:bg-main/90 transition-colors", children: "Try Again" })] })) : null })), _jsx("h2", { className: "text-xl text-gray-800 dark:text-white font-semibold mb-6 text-center", children: "Enter Amount" }), _jsxs("div", { className: "space-y-8", children: [_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-sm text-gray-500 dark:text-neutral-400", children: "Amount" }), _jsxs("span", { className: "text-sm text-gray-500 dark:text-neutral-400", children: ["Balance: ", formattedBalance, " ", tokenSymbol] })] }), _jsxs("div", { className: "relative", children: [_jsx("input", { type: "text", defaultValue: amount, onChange: handleAmountChange, placeholder: "0.00", className: "w-full bg-white dark:bg-neutral-950 border-2 border-gray-100 dark:border-neutral-800 rounded-md px-4 py-3 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-0 focus:border-main dark:focus:border-main transition-colors duration-200" }), _jsxs("div", { className: "absolute right-4 top-1/2 -translate-y-1/2 flex items-center gap-2", children: [_jsx(ImageWithFallback, { src: tokenLogo, width: 20, height: 20, alt: tokenSymbol, fallbackClassName: "w-5 h-5 rounded-full text-xs font-bold flex items-center justify-center", fallbackBgColor: "bg-blue-100 dark:bg-blue-900", fallbackTextColor: "text-blue-500 dark:text-blue-300", fallbackText: tokenSymbol.charAt(0) }), _jsx("span", { className: "text-gray-400 dark:text-neutral-500", children: tokenSymbol })] })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-xs text-gray-400 dark:text-neutral-500", children: ["Min: ", MIN_DEPOSIT, " ", tokenSymbol] }), _jsxs("span", { className: "text-xs text-gray-400 dark:text-neutral-500", children: ["Max: ", MAX_DEPOSIT, " ", tokenSymbol] })] })] }), _jsx("button", { onClick: onContinue, disabled: !isValidAmount, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, className: "\n group relative w-full overflow-hidden rounded-md border-2 bg-gray-100 dark:bg-neutral-950 py-4 text-center\n transition-all duration-300 ".concat(ANIMATION_EASE, "\n cursor-pointer border-gray-200 dark:border-gray-800 hover:border-gray-400 dark:hover:border-white/60\n ").concat(!isValidAmount ? 'opacity-50 cursor-not-allowed hover:border-gray-200 dark:hover:border-gray-800' : '', "\n "), style: {
184
+ return (_jsxs("div", { className: "overflow-hidden relative", children: [showFaucetOverlay && (_jsx("div", { className: "absolute inset-0 z-10 bg-white/70 dark:bg-neutral-900/80 backdrop-blur-md flex flex-col items-center justify-center p-6", children: isFaucetLoading ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "relative w-16 h-16 mb-4", children: _jsxs("div", { className: "absolute inset-0 grid grid-cols-2 gap-1", children: [_jsx("div", { className: "relative bg-white dark:bg-neutral-800 border border-gray-100 dark:border-neutral-700 overflow-hidden rounded-sm", children: _jsx("div", { className: "absolute inset-x-0 bottom-0 h-full bg-main/40 dark:bg-main/30 animate-square-loader" }) }), _jsx("div", { className: "relative bg-white dark:bg-neutral-800 border border-gray-100 dark:border-neutral-700 overflow-hidden rounded-sm", children: _jsx("div", { className: "absolute inset-x-0 bottom-0 h-full bg-main/40 dark:bg-main/30 animate-square-loader", style: { animationDelay: '0.2s' } }) }), _jsx("div", { className: "relative bg-white dark:bg-neutral-800 border border-gray-100 dark:border-neutral-700 overflow-hidden rounded-sm", children: _jsx("div", { className: "absolute inset-x-0 bottom-0 h-full bg-main/40 dark:bg-main/30 animate-square-loader", style: { animationDelay: '0.4s' } }) }), _jsx("div", { className: "relative bg-white dark:bg-neutral-800 border border-gray-100 dark:border-neutral-700 overflow-hidden rounded-sm", children: _jsx("div", { className: "absolute inset-x-0 bottom-0 h-full bg-main/40 dark:bg-main/30 animate-square-loader", style: { animationDelay: '0.6s' } }) })] }) }), _jsx("h3", { className: "text-lg font-medium text-gray-800 dark:text-white mb-2", children: "Obtaining Testnet Tokens" }), _jsx("p", { className: "text-sm text-gray-500 dark:text-neutral-400 text-center", children: "Please wait while we request testnet tokens for your wallet..." })] })) : showFaucetSuccess ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-green-500 text-4xl mb-4", children: "\u2713" }), _jsx("h3", { className: "text-lg font-medium text-gray-800 dark:text-white mb-2", children: "Tokens Obtained Successfully" }), _jsx("p", { className: "text-sm text-green-500 dark:text-green-400 text-center mb-4", children: "Your wallet has been funded with testnet tokens." }), _jsx("p", { className: "text-sm text-gray-500 dark:text-neutral-400 text-center", children: "Please wait while your balance updates..." })] })) : faucetError ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-red-500 text-4xl mb-4", children: "\u26A0\uFE0F" }), _jsx("h3", { className: "text-lg font-medium text-gray-800 dark:text-white mb-2", children: "Failed to Get Tokens" }), _jsx("p", { className: "text-sm text-red-500 dark:text-red-400 text-center mb-4", children: faucetError }), _jsx("button", { onClick: requestTestnetTokens, className: "px-4 py-2 bg-main text-white rounded-md hover:bg-main/90 transition-colors", children: "Try Again" })] })) : null })), _jsx("h2", { className: "text-xl text-gray-800 dark:text-white font-semibold mb-6 text-center", children: "Enter Amount" }), _jsxs("div", { className: "space-y-8", children: [_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-sm text-gray-500 dark:text-neutral-400", children: "Amount" }), _jsxs("span", { className: "text-sm text-gray-500 dark:text-neutral-400", children: ["Balance: ", formattedBalance, " ", tokenSymbol] })] }), _jsxs("div", { className: "relative", children: [_jsx("input", { type: "text", value: amount, readOnly: true, className: "w-full bg-white dark:bg-neutral-950 border-2 border-gray-100 dark:border-neutral-800 rounded-md px-4 py-3 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-0 focus:border-main dark:focus:border-main transition-colors duration-200 cursor-not-allowed" }), _jsxs("div", { className: "absolute right-4 top-1/2 -translate-y-1/2 flex items-center gap-2", children: [_jsx(ImageWithFallback, { src: tokenLogo, width: 20, height: 20, alt: tokenSymbol, fallbackClassName: "w-5 h-5 rounded-full text-xs font-bold flex items-center justify-center", fallbackBgColor: "bg-blue-100 dark:bg-blue-900", fallbackTextColor: "text-blue-500 dark:text-blue-300", fallbackText: tokenSymbol.charAt(0) }), _jsx("span", { className: "text-gray-400 dark:text-neutral-500", children: tokenSymbol })] })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-xs text-gray-400 dark:text-neutral-500", children: ["Min: ", hardcodedMinDeposit, " ", tokenSymbol] }), _jsxs("span", { className: "text-xs text-gray-400 dark:text-neutral-500", children: ["Max: ", hardcodedMaxDeposit, " ", tokenSymbol] })] }), depositError && (_jsx("div", { className: "mt-2 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-md", children: _jsxs("div", { className: "flex items-start", children: [_jsx("div", { className: "flex-shrink-0 text-red-500", children: _jsx("svg", { className: "h-5 w-5", viewBox: "0 0 20 20", fill: "currentColor", children: _jsx("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z", clipRule: "evenodd" }) }) }), _jsxs("div", { className: "ml-3", children: [_jsx("h3", { className: "text-sm font-medium text-red-800 dark:text-red-300", children: "Deposit Failed" }), _jsx("div", { className: "mt-2 text-xs text-red-600 dark:text-red-400", children: "Please try again." })] })] }) }))] }), _jsx("button", { onClick: onContinue, disabled: !isValidAmount, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, className: "\n group relative w-full overflow-hidden rounded-md border-2 bg-gray-100 dark:bg-neutral-950 py-4 text-center\n transition-all duration-300 ".concat(ANIMATION_EASE, "\n cursor-pointer border-gray-200 dark:border-gray-800 hover:border-gray-400 dark:hover:border-white/60\n ").concat(!isValidAmount ? 'opacity-50 cursor-not-allowed hover:border-gray-200 dark:hover:border-gray-800' : '', "\n "), style: {
163
185
  transform: isHovered && isValidAmount ? 'scale(0.99)' : 'scale(1)',
164
186
  }, children: _jsx("span", { className: "\n text-base font-medium tracking-wide transition-colors duration-300 ".concat(ANIMATION_EASE, "\n text-gray-700 dark:text-gray-300 group-hover:text-gray-900 dark:group-hover:text-white\n "), children: "Continue" }) })] })] }));
165
187
  }
@@ -2,5 +2,5 @@ import { WaitingMessageState } from '../types';
2
2
  interface DepositProgressScreenProps {
3
3
  message: WaitingMessageState;
4
4
  }
5
- export declare function DepositProgressScreen({ message, }: DepositProgressScreenProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function DepositProgressScreen({ message }: DepositProgressScreenProps): import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -18,7 +18,7 @@ export function DepositProgressScreen(_a) {
18
18
  var message = _a.message;
19
19
  var sessionMode = useN1WalletInternalContext().sessionMode;
20
20
  var _b = useState(0), elapsedTime = _b[0], setElapsedTime = _b[1];
21
- var maxTime = 90; // Maximum time in seconds
21
+ var maxTime = 300; // Maximum time in seconds
22
22
  // Start timer when component mounts
23
23
  useEffect(function () {
24
24
  var timer = setInterval(function () {
@@ -37,7 +37,8 @@ export function DepositProgressScreen(_a) {
37
37
  var getSessionSpecificMessage = function () {
38
38
  var currentSessionMode = sessionMode !== null && sessionMode !== void 0 ? sessionMode : N1SessionMode.NTS;
39
39
  var accountType = currentSessionMode === N1SessionMode.Nord ? 'Nord' : 'NTS';
40
- return __assign(__assign({}, message), { title: message.title || "Processing ".concat(accountType, " Deposit"), subtitle: message.subtitle || "Please wait while we process your ".concat(accountType, " deposit") });
40
+ return __assign(__assign({}, message), { title: message.title || "Processing ".concat(accountType, " Deposit"), subtitle: message.subtitle ||
41
+ "Please wait while we process your ".concat(accountType, " deposit") });
41
42
  };
42
43
  var sessionMessage = getSessionSpecificMessage();
43
44
  return (_jsxs("div", { className: "overflow-hidden relative", children: [_jsx(WaitingMessage, { message: sessionMessage }), _jsxs("div", { className: "text-center mt-4 text-sm text-gray-500", children: ["Time elapsed: ", elapsedTime, "s / ", maxTime, "s"] })] }));
@@ -113,7 +113,9 @@ export function DepositSuccessScreen(_a) {
113
113
  };
114
114
  return (_jsx("div", { className: "relative w-full px-4", children: _jsx("div", { className: "flex flex-col space-y-6", children: _jsxs("div", { className: "w-full", children: [_jsx("div", { className: "relative w-full px-3 py-3 flex items-center justify-center transition-all duration-300 ".concat(ANIMATION_EASE, " ").concat(showDetails ? 'opacity-0 max-h-0' : 'opacity-100 max-h-[200px]'), children: _jsxs("div", { className: "relative w-full px-5 py-8 transition-all duration-300 ".concat(ANIMATION_EASE, " ").concat(showDetails ? 'max-h-0 overflow-hidden' : 'max-h-[200px]'), children: [_jsx("div", { className: "w-2 h-2 bg-green-200 dark:bg-emerald-800 absolute -top-2 -left-2 rounded-sm" }), _jsx("div", { className: "w-2 h-2 bg-green-200 dark:bg-emerald-800 absolute -top-2 -right-2 rounded-sm" }), _jsx("div", { className: "w-2 h-2 bg-green-200 dark:bg-emerald-800 absolute -bottom-2 -left-2 rounded-sm" }), _jsx("div", { className: "w-2 h-2 bg-green-200 dark:bg-emerald-800 absolute -bottom-2 -right-2 rounded-sm" }), _jsxs("p", { className: "text-5xl md:text-7xl tracking-tight text-green-500/80 dark:text-emerald-500/80 font-medium pt-4 underline text-center animate-fade-up", style: { animationDelay: '0.3s' }, children: ["+", Number(amount).toLocaleString(), _jsx("span", { className: "text-xl md:text-2xl text-green-500/50 dark:text-emerald-500/50 ml-2", children: tokenSymbol })] }), _jsx("div", { className: "absolute bottom-0 left-0 right-0 flex justify-center -mb-3", children: _jsxs("button", { onClick: toggleDetails, className: "\n group flex items-center space-x-1 px-3 py-1 text-xs font-medium \n transition-colors duration-200 focus:outline-none\n ".concat(showDetails
115
115
  ? 'text-green-600 dark:text-emerald-400 hover:text-green-700 dark:hover:text-emerald-300'
116
- : 'text-gray-500 dark:text-gray-400 hover:text-green-600 dark:hover:text-emerald-400', "\n "), children: [_jsx("span", { children: "View details" }), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-3 w-3 transition-transform duration-200", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) })] }) })] }) }), _jsx("div", { className: "transition-all duration-300 ease-in-out overflow-hidden ".concat(showDetails ? 'max-h-[500px] opacity-100 -mt-4' : 'max-h-0 opacity-0'), children: _jsx(TransactionTable, { tableValues: animatedTableValues, onClose: toggleDetails }) }), _jsxs("div", { className: "mt-6", children: [showWaitingMessage && (_jsx("p", { className: "text-sm text-gray-600 dark:text-neutral-400 text-center mb-2 animate-pulse", children: "Please wait a moment..." })), _jsx("button", { onClick: isContinueEnabled ? onContinue : undefined, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, className: "\n group relative w-full overflow-hidden rounded-md border-2 bg-gray-100 dark:bg-neutral-950 py-4 text-center\n transition-all duration-300 ".concat(ANIMATION_EASE, "\n cursor-pointer border-gray-200 dark:border-gray-800 hover:border-gray-400 dark:hover:border-white/60\n ").concat(!isContinueEnabled ? 'opacity-50 cursor-not-allowed' : '', "\n "), style: {
116
+ : 'text-gray-500 dark:text-gray-400 hover:text-green-600 dark:hover:text-emerald-400', "\n "), children: [_jsx("span", { children: "View details" }), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-3 w-3 transition-transform duration-200", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) })] }) })] }) }), _jsx("div", { className: "transition-all duration-300 ease-in-out overflow-hidden ".concat(showDetails
117
+ ? 'max-h-[500px] opacity-100 -mt-4'
118
+ : 'max-h-0 opacity-0'), children: _jsx(TransactionTable, { tableValues: animatedTableValues, onClose: toggleDetails }) }), _jsxs("div", { className: "mt-6", children: [showWaitingMessage && (_jsx("p", { className: "text-sm text-gray-600 dark:text-neutral-400 text-center mb-2 animate-pulse", children: "Please wait a moment..." })), _jsx("button", { onClick: isContinueEnabled ? onContinue : undefined, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, className: "\n group relative w-full overflow-hidden rounded-md border-2 bg-gray-100 dark:bg-neutral-950 py-4 text-center\n transition-all duration-300 ".concat(ANIMATION_EASE, "\n cursor-pointer border-gray-200 dark:border-gray-800 hover:border-gray-400 dark:hover:border-white/60\n ").concat(!isContinueEnabled ? 'opacity-50 cursor-not-allowed' : '', "\n "), style: {
117
119
  transform: isHovered && isContinueEnabled ? 'scale(0.99)' : 'scale(1)',
118
120
  }, disabled: !isContinueEnabled, children: _jsx("span", { className: "\n text-base font-medium tracking-wide transition-colors duration-300 ".concat(ANIMATION_EASE, "\n text-gray-700 dark:text-gray-300 group-hover:text-gray-900 dark:group-hover:text-white\n "), children: "Continue" }) })] })] }) }) }));
119
121
  }
@@ -2,5 +2,5 @@ interface AuthLoadingScreenProps {
2
2
  isCreatingAccount?: boolean;
3
3
  onAuthComplete?: (success: boolean) => void;
4
4
  }
5
- export declare function AuthLoadingScreen({ isCreatingAccount, onAuthComplete }: AuthLoadingScreenProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function AuthLoadingScreen({ isCreatingAccount, onAuthComplete, }: AuthLoadingScreenProps): import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  };
37
37
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
38
38
  import { useEffect, useState, useCallback, useRef } from 'react';
39
- import { useN1WalletContext, useN1WalletInternalContext } from '../../../Provider/hooks';
39
+ import { useN1WalletContext, useN1WalletInternalContext, } from '../../../Provider/hooks';
40
40
  import { LoadingSquares } from '../components/LoadingSquares';
41
41
  import { logger } from '../../../utils/logger';
42
42
  import { ANIMATION_EASE } from '../constants';
@@ -57,12 +57,12 @@ export function AuthLoadingScreen(_a) {
57
57
  case 0:
58
58
  _a.trys.push([0, 3, , 4]);
59
59
  // Step 1: Tell user to sign transaction
60
- setStatusMessage("Please sign the transaction to authenticate your session");
60
+ setStatusMessage('Please sign the transaction to authenticate your session');
61
61
  if (!nordUser) {
62
62
  throw new Error('Nord user is not initialized');
63
63
  }
64
64
  // Step 2: Call nordUser.refreshSession and get sessionId
65
- setStatusMessage("Session is being authenticated...");
65
+ setStatusMessage('Session is being authenticated...');
66
66
  sessionPubKey = nordUser.sessionPubKey;
67
67
  if (!sessionPubKey) {
68
68
  throw new Error('Session public key is not available');
@@ -72,16 +72,16 @@ export function AuthLoadingScreen(_a) {
72
72
  case 1:
73
73
  // Refresh the session
74
74
  _a.sent();
75
- return [4 /*yield*/, nordUser.updateAccountId()
76
- // Get the sessionId after refresh
77
- ];
75
+ return [4 /*yield*/, nordUser.updateAccountId()];
78
76
  case 2:
79
77
  _a.sent();
80
78
  sessionId = nordUser.sessionId;
81
79
  if (!sessionId) {
82
80
  throw new Error('Failed to get session ID after refresh');
83
81
  }
84
- logger.debug('Session refreshed successfully', { sessionId: sessionId.toString() });
82
+ logger.debug('Session refreshed successfully', {
83
+ sessionId: sessionId.toString(),
84
+ });
85
85
  // Step 3: Store sessionId in localStorage
86
86
  if (address) {
87
87
  sessionIdKey = "n1_sessionId_".concat(address);
@@ -118,9 +118,18 @@ export function AuthLoadingScreen(_a) {
118
118
  setStatusMessage(null);
119
119
  performAuth();
120
120
  };
121
- return (_jsxs("div", { className: "flex flex-col items-center justify-center py-12 space-y-6", children: [authStatus === 'loading' && _jsx(LoadingSquares, {}), authStatus === 'success' && (_jsx("div", { className: "text-green-500 text-4xl mb-4", children: "\u2713" })), authStatus === 'error' && (_jsx("div", { className: "text-red-500 text-4xl mb-4", children: "\u26A0\uFE0F" })), _jsxs("div", { className: "space-y-2 text-center w-[300px]", children: [_jsxs("h3", { className: "text-xl text-gray-800 dark:text-white font-semibold", children: [authStatus === 'loading' && (isCreatingAccount ? 'Creating Account' : 'Authenticating'), authStatus === 'success' && (isCreatingAccount ? 'Account Created' : 'Authentication Successful'), authStatus === 'error' && 'Authentication Failed'] }), _jsxs("p", { className: "text-sm text-gray-600 dark:text-neutral-400", children: [authStatus === 'loading' && statusMessage ? statusMessage : ('Please wait while we create your Nord account'), authStatus === 'success' && (isCreatingAccount
122
- ? 'Your account has been created successfully'
123
- : 'You have been logged in successfully'), authStatus === 'error' && (errorMessage || 'There was an error during authentication. Please try again.')] }), authStatus === 'error' && (_jsx("div", { className: "mt-6", children: _jsx("button", { onClick: handleRetry, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, className: "\n group relative w-full overflow-hidden rounded-md border-2 bg-gray-100 dark:bg-neutral-950 py-4 text-center\n transition-all duration-300 ".concat(ANIMATION_EASE, "\n cursor-pointer border-gray-200 dark:border-gray-800 hover:border-gray-400 dark:hover:border-white/60\n "), style: {
121
+ return (_jsxs("div", { className: "flex flex-col items-center justify-center py-12 space-y-6", children: [authStatus === 'loading' && _jsx(LoadingSquares, {}), authStatus === 'success' && (_jsx("div", { className: "text-green-500 text-4xl mb-4", children: "\u2713" })), authStatus === 'error' && (_jsx("div", { className: "text-red-500 text-4xl mb-4", children: "\u26A0\uFE0F" })), _jsxs("div", { className: "space-y-2 text-center w-[300px]", children: [_jsxs("h3", { className: "text-xl text-gray-800 dark:text-white font-semibold", children: [authStatus === 'loading' &&
122
+ (isCreatingAccount ? 'Creating Account' : 'Authenticating'), authStatus === 'success' &&
123
+ (isCreatingAccount
124
+ ? 'Account Created'
125
+ : 'Authentication Successful'), authStatus === 'error' && 'Authentication Failed'] }), _jsxs("p", { className: "text-sm text-gray-600 dark:text-neutral-400", children: [authStatus === 'loading' && statusMessage
126
+ ? statusMessage
127
+ : 'Please wait while we create your Nord account', authStatus === 'success' &&
128
+ (isCreatingAccount
129
+ ? 'Your account has been created successfully'
130
+ : 'You have been logged in successfully'), authStatus === 'error' &&
131
+ (errorMessage ||
132
+ 'There was an error during authentication. Please try again.')] }), authStatus === 'error' && (_jsx("div", { className: "mt-6", children: _jsx("button", { onClick: handleRetry, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, className: "\n group relative w-full overflow-hidden rounded-md border-2 bg-gray-100 dark:bg-neutral-950 py-4 text-center\n transition-all duration-300 ".concat(ANIMATION_EASE, "\n cursor-pointer border-gray-200 dark:border-gray-800 hover:border-gray-400 dark:hover:border-white/60\n "), style: {
124
133
  transform: isHovered ? 'scale(0.99)' : 'scale(1)',
125
134
  }, children: _jsx("span", { className: "\n text-base font-medium tracking-wide transition-colors duration-300 ".concat(ANIMATION_EASE, "\n text-gray-700 dark:text-gray-300 group-hover:text-gray-900 dark:group-hover:text-white\n "), children: "Try Again" }) }) }))] })] }));
126
135
  }
@@ -1,5 +1,5 @@
1
1
  interface FinalSuccessScreenProps {
2
2
  onDone: () => void;
3
3
  }
4
- export declare function FinalSuccessScreen({ onDone, }: FinalSuccessScreenProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare function FinalSuccessScreen({ onDone }: FinalSuccessScreenProps): import("react/jsx-runtime").JSX.Element;
5
5
  export {};
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from 'react';
3
3
  import { ANIMATION_EASE } from '../constants';
4
- import { useN1WalletContext, useN1WalletInternalContext } from '../../../Provider/hooks';
4
+ import { useN1WalletContext, useN1WalletInternalContext, } from '../../../Provider/hooks';
5
5
  import { N1SessionMode } from '../../../Provider/types';
6
6
  import { isNordConfigured } from '../utils/nordUtils';
7
7
  export function FinalSuccessScreen(_a) {
@@ -16,7 +16,7 @@ export function FinalSuccessScreen(_a) {
16
16
  // Get the appropriate title and message based on Nord configuration
17
17
  var getTitle = function () {
18
18
  if (nord && isNordConfigured(nord)) {
19
- return 'Nord Authentication Successful!';
19
+ return 'Authentication Successful!';
20
20
  }
21
21
  else {
22
22
  return 'Authentication Successful!';
@@ -24,7 +24,7 @@ export function FinalSuccessScreen(_a) {
24
24
  };
25
25
  var getMessage = function () {
26
26
  if (sessionMode === N1SessionMode.Nord) {
27
- return 'Your wallet has been successfully connected to Nord';
27
+ return 'Your wallet has been successfully connected';
28
28
  }
29
29
  else {
30
30
  return 'Your wallet has been successfully connected';
@@ -3,5 +3,5 @@ interface ErrorScreenProps {
3
3
  onCancel: () => void;
4
4
  error: Error | null;
5
5
  }
6
- export declare function ErrorScreen({ onRetry, onCancel, error, }: ErrorScreenProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function ErrorScreen({ onRetry, onCancel, error }: ErrorScreenProps): import("react/jsx-runtime").JSX.Element;
7
7
  export {};
@@ -10,9 +10,11 @@ export function ErrorScreen(_a) {
10
10
  var _c = useState(false), isNordError = _c[0], setIsNordError = _c[1];
11
11
  // Check if the error is related to Nord
12
12
  useEffect(function () {
13
- if (error && error.message && (error.message.includes('Nord') ||
14
- error.message.includes('nord') ||
15
- (error.name && error.name.includes('Nord')))) {
13
+ if (error &&
14
+ error.message &&
15
+ (error.message.includes('Nord') ||
16
+ error.message.includes('nord') ||
17
+ (error.name && error.name.includes('Nord')))) {
16
18
  setIsNordError(true);
17
19
  }
18
20
  else {
@@ -25,13 +27,16 @@ export function ErrorScreen(_a) {
25
27
  return 'An unexpected error occurred';
26
28
  // Check for specific Nord-related errors
27
29
  if (isNordError) {
28
- if (error.message.includes('connection') || error.message.includes('network')) {
30
+ if (error.message.includes('connection') ||
31
+ error.message.includes('network')) {
29
32
  return 'Failed to connect to Nord. Please check your network connection and try again.';
30
33
  }
31
- if (error.message.includes('authentication') || error.message.includes('auth')) {
34
+ if (error.message.includes('authentication') ||
35
+ error.message.includes('auth')) {
32
36
  return 'Authentication with Nord failed. Please try again.';
33
37
  }
34
- if (error.message.includes('deposit') || error.message.includes('transaction')) {
38
+ if (error.message.includes('deposit') ||
39
+ error.message.includes('transaction')) {
35
40
  return 'Failed to process your deposit. Please try again.';
36
41
  }
37
42
  return "Nord error: ".concat(error.message);
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  /**
2
3
  * Types for the wallet connection flow state machine
3
4
  */
@@ -28,6 +29,7 @@ export interface FlowContext {
28
29
  amount: string;
29
30
  transactionId: string | null;
30
31
  error: Error | null;
32
+ depositError?: string;
31
33
  lastInterruption: {
32
34
  timestamp: number;
33
35
  state: FlowState;
@@ -90,9 +92,10 @@ export interface WaitingMessageState {
90
92
  export interface Chain {
91
93
  id: string;
92
94
  name: string;
93
- logo: string;
95
+ logo: string | React.ReactNode;
94
96
  disabled?: boolean;
95
97
  network?: string;
98
+ description?: string;
96
99
  }
97
100
  export interface App {
98
101
  name: string;
@@ -28,5 +28,6 @@ export var initialFlowContext = {
28
28
  amount: '',
29
29
  transactionId: null,
30
30
  error: null,
31
+ depositError: undefined,
31
32
  lastInterruption: null,
32
33
  };
@@ -92,9 +92,9 @@ export var getTokenIconUrl = function (tokenSymbol, fallbackUrl) {
92
92
  var baseUrl = 'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets';
93
93
  // Map of token symbols to their respective contract addresses
94
94
  var tokenAddresses = {
95
- 'USDC': '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
96
- 'USDT': '0xdAC17F958D2ee523a2206206994597C13D831ec7',
97
- 'DAI': '0x6B175474E89094C44Da98b954EedeAC495271d0F',
95
+ USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
96
+ USDT: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
97
+ DAI: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
98
98
  // Add more tokens as needed
99
99
  };
100
100
  if (tokenAddresses[tokenSymbol.toUpperCase()]) {
@@ -5,7 +5,9 @@
5
5
  * @returns Formatted transaction ID
6
6
  */
7
7
  export function formatNordTransaction(tx) {
8
- return tx.id ? tx.id.substring(0, 8) + '...' + tx.id.substring(tx.id.length - 8) : 'Unknown';
8
+ return tx.id
9
+ ? tx.id.substring(0, 8) + '...' + tx.id.substring(tx.id.length - 8)
10
+ : 'Unknown';
9
11
  }
10
12
  /**
11
13
  * Get token balance for a specific token
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
38
38
  import BlockiesSvg from 'blockies-react-svg';
39
39
  import QRCodeLoader from '../../components/QRCodeLoader';
40
- import { ArrowDown, ArrowUp, X, ArrowLeft, Maximize2, Minimize2 } from 'lucide-react';
40
+ import { ArrowDown, ArrowUp, X, ArrowLeft, Maximize2, Minimize2, } from 'lucide-react';
41
41
  import { useEffect, useState } from 'react';
42
42
  import { N1ModalViewMode, N1SessionMode } from '../../Provider/types';
43
43
  import { shortenAddress } from '../../utils/shortenString';
@@ -167,7 +167,7 @@ export function N1Sidebar(_) {
167
167
  return (_jsxs("div", { className: "fixed inset-0 bg-white/45 dark:bg-black/45 h-screen w-screen duration-500 ease-[cubic-bezier(0.16,1,0.3,1)] z-[9999] flex items-stretch justify-end backdrop-blur-sm ".concat(!showSidebar ? 'hidden pointer-events-none' : '', " ").concat(closing ? 'opacity-0' : 'opacity-100'), children: [showSidebar && (_jsx("div", { className: "w-screen h-screen fixed top-0 left-0", onClick: function () { return setClosing(true); } })), showSidebar && (_jsxs("div", { className: "relative h-screen bg-gray-50 dark:bg-gray-950 shadow-xl border-l border-gray-200 dark:border-gray-800 duration-500 ease-[cubic-bezier(0.16,1,0.3,1)] overflow-hidden ".concat(closing ? 'translate-x-full' : 'translate-x-0', " ").concat(isFullscreen ? 'w-screen' : 'w-[420px]'), children: [_jsxs("div", { className: "flex justify-between items-center px-6 py-4 border-b border-gray-200 dark:border-gray-800", children: [_jsxs("div", { className: "flex items-center gap-4", children: [currentView !== 'balances' && (_jsx("button", { onClick: function () {
168
168
  setCurrentView('balances');
169
169
  clearSendingForm();
170
- }, className: "text-gray-500 hover:text-red-500 dark:text-gray-400 dark:hover:text-red-500 transition-colors duration-200", children: _jsx(ArrowLeft, { size: 20 }) })), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(BlockiesSvg, { address: address, className: "w-10 h-10 rounded-full" }), _jsxs("div", { className: "flex flex-col", children: [_jsx("span", { className: "font-medium text-gray-900 dark:text-gray-50", children: username }), _jsx("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: shortenAddress(address) })] })] })] }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("button", { onClick: toggleFullscreen, className: "text-gray-400 hover:text-red-500 transition-colors duration-200 h-6 flex items-center", "aria-label": isFullscreen ? "Exit fullscreen" : "Enter fullscreen", children: isFullscreen ? _jsx(Minimize2, { size: 20 }) : _jsx(Maximize2, { size: 20 }) }), _jsx("button", { onClick: handleClose, className: "text-gray-400 hover:text-red-500 transition-colors duration-200 h-6 flex items-center", children: _jsx(X, { size: 20 }) })] })] }), _jsx("div", { className: "p-6 overflow-y-auto h-[calc(100vh-144px)]", children: _jsx("div", { className: "space-y-4", children: sessionMode === N1SessionMode.Nord ? (_jsx(NordTradingView, {})) : (_jsxs(_Fragment, { children: [currentView === 'balances' && (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex justify-between items-center", children: [_jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-gray-50", children: "Balances" }), _jsxs("div", { className: "flex space-x-2", children: [_jsxs("button", { onClick: function () {
170
+ }, className: "text-gray-500 hover:text-red-500 dark:text-gray-400 dark:hover:text-red-500 transition-colors duration-200", children: _jsx(ArrowLeft, { size: 20 }) })), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(BlockiesSvg, { address: address, className: "w-10 h-10 rounded-full" }), _jsxs("div", { className: "flex flex-col", children: [_jsx("span", { className: "font-medium text-gray-900 dark:text-gray-50", children: username }), _jsx("span", { className: "text-sm text-gray-500 dark:text-gray-400", children: shortenAddress(address) })] })] })] }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("button", { onClick: toggleFullscreen, className: "text-gray-400 hover:text-red-500 transition-colors duration-200 h-6 flex items-center", "aria-label": isFullscreen ? 'Exit fullscreen' : 'Enter fullscreen', children: isFullscreen ? (_jsx(Minimize2, { size: 20 })) : (_jsx(Maximize2, { size: 20 })) }), _jsx("button", { onClick: handleClose, className: "text-gray-400 hover:text-red-500 transition-colors duration-200 h-6 flex items-center", children: _jsx(X, { size: 20 }) })] })] }), _jsx("div", { className: "p-6 overflow-y-auto h-[calc(100vh-144px)]", children: _jsx("div", { className: "space-y-4", children: sessionMode === N1SessionMode.Nord ? (_jsx(NordTradingView, {})) : (_jsxs(_Fragment, { children: [currentView === 'balances' && (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex justify-between items-center", children: [_jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-gray-50", children: "Balances" }), _jsxs("div", { className: "flex space-x-2", children: [_jsxs("button", { onClick: function () {
171
171
  setReceiving(true);
172
172
  setSending(false);
173
173
  setCurrentView('receive');
@@ -178,9 +178,15 @@ export function N1Sidebar(_) {
178
178
  }, className: "px-3 py-1.5 bg-blue-100 dark:bg-blue-900/20 hover:bg-blue-200 dark:hover:bg-blue-900/30 text-blue-600 dark:text-blue-400 rounded-lg transition-colors duration-200 flex items-center", children: [_jsx(ArrowUp, { size: 16, className: "mr-1.5" }), "Send"] })] })] }), balances && balances.length > 0 ? (_jsx("div", { className: "space-y-3", children: balances.map(function (balance, index) { return (_jsxs("div", { className: "p-4 bg-white dark:bg-gray-900 rounded-xl shadow-sm border border-gray-200 dark:border-gray-800 flex justify-between items-center", children: [_jsxs("div", { children: [_jsx("div", { className: "font-medium text-gray-900 dark:text-gray-50", children: balance.appType }), _jsx("div", { className: "text-sm text-gray-500 dark:text-gray-400", children: balance.appId })] }), _jsxs("div", { className: "text-right", children: [_jsx("div", { className: "font-medium text-gray-900 dark:text-gray-50", children: balance.balance.toString() }), _jsx("div", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Available" })] })] }, index)); }) })) : (_jsx("div", { className: "p-4 bg-gray-50 dark:bg-gray-800 rounded-xl text-gray-500 dark:text-gray-400 text-center", children: "No balances found" }))] })), currentView === 'send' && (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center", children: [_jsx("button", { onClick: function () {
179
179
  setCurrentView('balances');
180
180
  clearSendingForm();
181
- }, className: "mr-3 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200", children: _jsx(ArrowLeft, { size: 20 }) }), _jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-gray-50", children: "Send Tokens" })] }), error && (_jsx("div", { className: "p-4 bg-red-50 dark:bg-red-900/20 rounded-xl text-red-600 dark:text-red-400 text-sm", children: error })), success && (_jsx("div", { className: "p-4 bg-green-50 dark:bg-green-900/20 rounded-xl text-green-600 dark:text-green-400 text-sm", children: success })), _jsxs("form", { onSubmit: handleSend, className: "space-y-4", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Token" }), _jsxs("select", { value: tokenToSend, onChange: function (e) { return setTokenToSend(e.target.value); }, className: "w-full px-3 py-2 bg-gray-100 dark:bg-gray-800 rounded-lg text-gray-900 dark:text-gray-100 border border-gray-200 dark:border-gray-800", required: true, children: [_jsx("option", { value: "", children: "Select Token" }), balances && balances.map(function (balance, index) { return (_jsxs("option", { value: balance.mint, children: [balance.appType, " (", balance.balance.toString(), ")"] }, index)); })] })] }), tokenToSend && (_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "App ID" }), _jsxs("select", { value: appIdAction, onChange: function (e) { return setAppIdAction(e.target.value); }, className: "w-full px-3 py-2 bg-gray-100 dark:bg-gray-800 rounded-lg text-gray-900 dark:text-gray-100 border border-gray-200 dark:border-gray-800", required: true, children: [_jsx("option", { value: "", children: "Select App ID" }), balances && balances
182
- .filter(function (balance) { return balance.mint === tokenToSend; })
183
- .map(function (balance, index) { return (_jsx("option", { value: balance.appId, children: balance.appId }, index)); })] })] })), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Amount" }), _jsx("input", { type: "text", value: amount, onChange: function (e) { return setAmount(e.target.value); }, className: "w-full px-3 py-2 bg-gray-100 dark:bg-gray-800 rounded-lg text-gray-900 dark:text-gray-100 border border-gray-200 dark:border-gray-800", placeholder: "Enter amount", required: true })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Recipient Address" }), _jsx("input", { type: "text", value: recipientAddress, onChange: function (e) { return setRecipientAddress(e.target.value); }, className: "w-full px-3 py-2 bg-gray-100 dark:bg-gray-800 rounded-lg text-gray-900 dark:text-gray-100 border border-gray-200 dark:border-gray-800", placeholder: "Enter recipient address", required: true })] }), _jsx("button", { type: "submit", disabled: activeSending, className: "w-full py-3 rounded-xl font-medium transition-colors duration-200 ".concat(activeSending
181
+ }, className: "mr-3 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200", children: _jsx(ArrowLeft, { size: 20 }) }), _jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-gray-50", children: "Send Tokens" })] }), error && (_jsx("div", { className: "p-4 bg-red-50 dark:bg-red-900/20 rounded-xl text-red-600 dark:text-red-400 text-sm", children: error })), success && (_jsx("div", { className: "p-4 bg-green-50 dark:bg-green-900/20 rounded-xl text-green-600 dark:text-green-400 text-sm", children: success })), _jsxs("form", { onSubmit: handleSend, className: "space-y-4", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Token" }), _jsxs("select", { value: tokenToSend, onChange: function (e) { return setTokenToSend(e.target.value); }, className: "w-full px-3 py-2 bg-gray-100 dark:bg-gray-800 rounded-lg text-gray-900 dark:text-gray-100 border border-gray-200 dark:border-gray-800", required: true, children: [_jsx("option", { value: "", children: "Select Token" }), balances &&
182
+ balances.map(function (balance, index) { return (_jsxs("option", { value: balance.mint, children: [balance.appType, " (", balance.balance.toString(), ")"] }, index)); })] })] }), tokenToSend && (_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "App ID" }), _jsxs("select", { value: appIdAction, onChange: function (e) { return setAppIdAction(e.target.value); }, className: "w-full px-3 py-2 bg-gray-100 dark:bg-gray-800 rounded-lg text-gray-900 dark:text-gray-100 border border-gray-200 dark:border-gray-800", required: true, children: [_jsx("option", { value: "", children: "Select App ID" }), balances &&
183
+ balances
184
+ .filter(function (balance) {
185
+ return balance.mint === tokenToSend;
186
+ })
187
+ .map(function (balance, index) { return (_jsx("option", { value: balance.appId, children: balance.appId }, index)); })] })] })), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Amount" }), _jsx("input", { type: "text", value: amount, onChange: function (e) { return setAmount(e.target.value); }, className: "w-full px-3 py-2 bg-gray-100 dark:bg-gray-800 rounded-lg text-gray-900 dark:text-gray-100 border border-gray-200 dark:border-gray-800", placeholder: "Enter amount", required: true })] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: "Recipient Address" }), _jsx("input", { type: "text", value: recipientAddress, onChange: function (e) {
188
+ return setRecipientAddress(e.target.value);
189
+ }, className: "w-full px-3 py-2 bg-gray-100 dark:bg-gray-800 rounded-lg text-gray-900 dark:text-gray-100 border border-gray-200 dark:border-gray-800", placeholder: "Enter recipient address", required: true })] }), _jsx("button", { type: "submit", disabled: activeSending, className: "w-full py-3 rounded-xl font-medium transition-colors duration-200 ".concat(activeSending
184
190
  ? 'bg-gray-300 dark:bg-gray-700 text-gray-500 dark:text-gray-400 cursor-not-allowed'
185
191
  : 'bg-blue-600 hover:bg-blue-700 text-white'), children: activeSending ? 'Sending...' : 'Send Tokens' })] })] })), currentView === 'receive' && (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center", children: [_jsx("button", { onClick: function () {
186
192
  setCurrentView('balances');
@@ -3,5 +3,5 @@ interface MarketOverviewProps {
3
3
  onMarketChange: (market: string) => void;
4
4
  className?: string;
5
5
  }
6
- export default function MarketOverview({ selectedMarket, onMarketChange, className }: MarketOverviewProps): import("react/jsx-runtime").JSX.Element;
6
+ export default function MarketOverview({ selectedMarket, onMarketChange, className, }: MarketOverviewProps): import("react/jsx-runtime").JSX.Element;
7
7
  export {};
@@ -2,5 +2,5 @@ interface MarketSelectorProps {
2
2
  selectedMarket: string | null;
3
3
  onMarketChange: (market: string) => void;
4
4
  }
5
- export default function MarketSelector({ selectedMarket, onMarketChange }: MarketSelectorProps): import("react/jsx-runtime").JSX.Element;
5
+ export default function MarketSelector({ selectedMarket, onMarketChange, }: MarketSelectorProps): import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -14,8 +14,10 @@ export default function MarketSelector(_a) {
14
14
  // Close dropdown when clicking outside
15
15
  useEffect(function () {
16
16
  function handleClickOutside(event) {
17
- if (dropdownRef.current && !dropdownRef.current.contains(event.target) &&
18
- buttonRef.current && !buttonRef.current.contains(event.target)) {
17
+ if (dropdownRef.current &&
18
+ !dropdownRef.current.contains(event.target) &&
19
+ buttonRef.current &&
20
+ !buttonRef.current.contains(event.target)) {
19
21
  setIsOpen(false);
20
22
  }
21
23
  }
@@ -34,5 +36,7 @@ export default function MarketSelector(_a) {
34
36
  setSearchQuery('');
35
37
  }, className: "w-full text-left px-4 py-2 hover:bg-gray-50 dark:hover:bg-gray-900 transition-colors duration-200 ".concat(selectedMarket === market.symbol
36
38
  ? 'border-l-2 border-main text-main dark:text-main bg-gray-50 dark:bg-gray-950'
37
- : 'text-gray-900 dark:text-gray-100'), children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "font-medium", children: market.symbol }), market.change24h !== undefined && (_jsxs("span", { className: "text-sm ".concat(market.change24h >= 0 ? 'text-green-500' : 'text-red-500'), children: [market.change24h >= 0 ? '+' : '', market.change24h.toFixed(2), "%"] }))] }) }, market.symbol)); })) : (_jsx("div", { className: "px-4 py-3 text-sm text-gray-500 dark:text-gray-400", children: "No markets found" })) }) }))] }));
39
+ : 'text-gray-900 dark:text-gray-100'), children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "font-medium", children: market.symbol }), market.change24h !== undefined && (_jsxs("span", { className: "text-sm ".concat(market.change24h >= 0
40
+ ? 'text-green-500'
41
+ : 'text-red-500'), children: [market.change24h >= 0 ? '+' : '', market.change24h.toFixed(2), "%"] }))] }) }, market.symbol)); })) : (_jsx("div", { className: "px-4 py-3 text-sm text-gray-500 dark:text-gray-400", children: "No markets found" })) }) }))] }));
38
42
  }
@@ -3,5 +3,5 @@ interface MarketStatsProps {
3
3
  loading: boolean;
4
4
  error: string | null;
5
5
  }
6
- export default function MarketStats({ marketStats, loading, error }: MarketStatsProps): import("react/jsx-runtime").JSX.Element;
6
+ export default function MarketStats({ marketStats, loading, error, }: MarketStatsProps): import("react/jsx-runtime").JSX.Element;
7
7
  export {};
@@ -41,14 +41,14 @@ export default function NordTradingView() {
41
41
  };
42
42
  // Map view types to display names
43
43
  var viewLabels = {
44
- 'orderbook': 'Order Book',
45
- 'tradeform': 'Trade',
46
- 'positions': 'Positions',
47
- 'orders': 'Orders',
48
- 'balances': 'Balances',
49
- 'history': 'History'
44
+ orderbook: 'Order Book',
45
+ tradeform: 'Trade',
46
+ positions: 'Positions',
47
+ orders: 'Orders',
48
+ balances: 'Balances',
49
+ history: 'History',
50
50
  };
51
51
  return (_jsxs("div", { className: "space-y-4 @container", children: [_jsxs("div", { className: "flex flex-col @md:flex-row justify-between items-start @md:items-center bg-transparent mb-3 gap-3 @md:gap-0", children: [_jsx("div", { className: "flex justify-start gap-2 flex-wrap w-full @md:w-auto", children: ['orderbook', 'tradeform', 'positions', 'orders'].map(function (view) { return (_jsxs("button", { onClick: function () { return setActiveView(view); }, className: "\n relative px-4 @md:px-5 py-2 text-sm font-medium tracking-wide transition-all duration-150 \n border ".concat(activeView === view
52
52
  ? 'border-main/80 text-main bg-main/[0.03] shadow-[0_0_0_1px_rgba(255,68,26,0.1)]'
53
- : 'border-gray-200 dark:border-gray-800 text-gray-500 dark:text-gray-400 hover:border-gray-300 dark:hover:border-gray-700', "\n first:ml-0 last:mr-0 group rounded-[2px] overflow-hidden flex-grow @md:flex-grow-0\n "), children: [_jsx("span", { className: "relative z-10", children: viewLabels[view] }), _jsx("span", { className: "\n absolute inset-0 bg-main/[0.02] opacity-0 transition-opacity duration-150\n ".concat(activeView !== view ? 'group-hover:opacity-100' : '', "\n ") })] }, view)); }) }), _jsx("div", { className: "min-w-[160px] w-full @md:w-auto border border-gray-200 dark:border-gray-800 rounded-[2px] overflow-visible hover:border-gray-300 dark:hover:border-gray-700 transition-colors duration-150 relative z-10", children: _jsx("div", { className: "px-5 py-2 text-sm", children: _jsx(MarketOverview, { selectedMarket: selectedMarket, onMarketChange: setSelectedMarket }) }) })] }), _jsx("div", { className: "border border-gray-200 dark:border-gray-800 rounded-[3px] shadow-sm bg-white dark:bg-gray-950", children: renderActiveView() })] }));
53
+ : 'border-gray-200 dark:border-gray-800 text-gray-500 dark:text-gray-400 hover:border-gray-300 dark:hover:border-gray-700', "\n first:ml-0 last:mr-0 group rounded-[2px] overflow-hidden flex-grow @md:flex-grow-0\n "), children: [_jsx("span", { className: "relative z-10", children: viewLabels[view] }), _jsx("span", { className: "\n absolute inset-0 bg-main/[0.02] opacity-0 transition-opacity duration-150\n ".concat(activeView !== view ? 'group-hover:opacity-100' : '', "\n ") })] }, view)); }) }), _jsx("div", { className: "min-w-[160px] w-full @md:w-auto border border-gray-200 dark:border-gray-800 rounded-[2px] overflow-visible hover:border-gray-300 dark:hover:border-gray-700 transition-colors duration-150 relative z-20", children: _jsx("div", { className: "px-5 py-2 text-sm", children: _jsx(MarketOverview, { selectedMarket: selectedMarket, onMarketChange: setSelectedMarket }) }) })] }), _jsx("div", { className: "border border-gray-200 dark:border-gray-800 rounded-[3px] shadow-sm bg-white dark:bg-gray-950", children: renderActiveView() })] }));
54
54
  }