@n1xyz/wallet-widget 0.0.5 → 0.0.7
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/Logic/sessionManager.d.ts +1 -1
- package/dist/Logic/sessionManager.js +9 -5
- package/dist/Logic/transactionManager.js +7 -3
- package/dist/Logic/utils.js +9 -12
- package/dist/Modal/N1WalletModal.js +2 -3
- package/dist/Modal/NTSFlow/NTSFlow.js +7 -3
- package/dist/Modal/NTSFlow/components/BackButton.js +0 -1
- package/dist/Modal/NTSFlow/views/CreateSessionView.js +1 -1
- package/dist/Modal/NordFlow/NordFlow.js +26 -21
- package/dist/Modal/NordFlow/components/ChainButton.d.ts +1 -1
- package/dist/Modal/NordFlow/components/ChainButton.js +8 -8
- package/dist/Modal/NordFlow/components/EVMChainsButton.d.ts +8 -0
- package/dist/Modal/NordFlow/components/EVMChainsButton.js +18 -0
- package/dist/Modal/NordFlow/components/MoreButton.d.ts +8 -0
- package/dist/Modal/NordFlow/components/MoreButton.js +18 -0
- package/dist/Modal/NordFlow/components/TransactionTable.d.ts +1 -1
- package/dist/Modal/NordFlow/components/TransactionTable.js +8 -6
- package/dist/Modal/NordFlow/constants.js +4 -4
- package/dist/Modal/NordFlow/hooks/useDepositFlow.js +31 -16
- package/dist/Modal/NordFlow/hooks/useFlowState.js +5 -4
- package/dist/Modal/NordFlow/hooks/useNordInstance.js +17 -8
- package/dist/Modal/NordFlow/hooks/useNordWalletConnect.js +28 -20
- package/dist/Modal/NordFlow/screens/02-EvmWalletAuthScreen.js +1 -1
- package/dist/Modal/NordFlow/screens/03-ChainSelectionScreen.js +39 -23
- package/dist/Modal/NordFlow/screens/04-AmountInputScreen.d.ts +3 -1
- package/dist/Modal/NordFlow/screens/04-AmountInputScreen.js +37 -16
- package/dist/Modal/NordFlow/screens/05-DepositProgressScreen.d.ts +1 -1
- package/dist/Modal/NordFlow/screens/05-DepositProgressScreen.js +3 -2
- package/dist/Modal/NordFlow/screens/06-DepositSuccessScreen.js +3 -1
- package/dist/Modal/NordFlow/screens/07-AuthLoadingScreen.d.ts +1 -1
- package/dist/Modal/NordFlow/screens/07-AuthLoadingScreen.js +19 -10
- package/dist/Modal/NordFlow/screens/08-FinalSuccessScreen.d.ts +1 -1
- package/dist/Modal/NordFlow/screens/08-FinalSuccessScreen.js +3 -3
- package/dist/Modal/NordFlow/screens/09-ErrorScreen.d.ts +1 -1
- package/dist/Modal/NordFlow/screens/09-ErrorScreen.js +11 -6
- package/dist/Modal/NordFlow/types.d.ts +3 -1
- package/dist/Modal/NordFlow/utils/imageUtils.js +3 -3
- package/dist/Modal/NordFlow/utils/nordUtils.js +3 -1
- package/dist/Modal/Sidebar/N1Sidebar.js +11 -5
- package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketOverview.d.ts +1 -1
- package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketSelector.d.ts +1 -1
- package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketSelector.js +7 -3
- package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketStats.d.ts +1 -1
- package/dist/Modal/Sidebar/NordTradingView/NordTradingView.js +7 -7
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBook.js +27 -16
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookDepthVisualizer.d.ts +1 -1
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookHeader.d.ts +1 -1
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookHeader.js +3 -2
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookTable.d.ts +1 -1
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookTable.js +2 -3
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/AmountInput.d.ts +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/BuySellTabs.js +2 -2
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/FillModeSelector.d.ts +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/FillModeSelector.js +16 -13
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/OrderTypeSelector.d.ts +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/OrderTypeSelector.js +17 -11
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/PriceInput.d.ts +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/SubmitButton.d.ts +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/SubmitButton.js +2 -2
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/TotalCalculator.d.ts +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/TotalCalculator.js +3 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/TradeForm.js +21 -11
- package/dist/Modal/Sidebar/NordTradingView/UserBalances/UserBalances.js +1 -1
- package/dist/Modal/Sidebar/NordTradingView/UserOrders/UserOrders.js +11 -6
- package/dist/Modal/Sidebar/NordTradingView/UserPositions/UserPositions.js +14 -7
- package/dist/Provider/LazyWalletProvider.js +10 -4
- package/dist/Provider/N1WalletProvider.js +6 -5
- package/dist/components/logos/ArbitrumLogo.d.ts +8 -0
- package/dist/components/logos/ArbitrumLogo.js +5 -0
- package/dist/components/logos/BaseLogo.d.ts +8 -0
- package/dist/components/logos/BaseLogo.js +5 -0
- package/dist/components/logos/BeraLogo.d.ts +8 -0
- package/dist/components/logos/BeraLogo.js +5 -0
- package/dist/components/logos/BitcoinLogo.d.ts +8 -0
- package/dist/components/logos/BitcoinLogo.js +5 -0
- package/dist/components/logos/EVMChainsGroup.d.ts +7 -0
- package/dist/components/logos/EVMChainsGroup.js +18 -0
- package/dist/components/logos/EthereumLogo.d.ts +8 -0
- package/dist/components/logos/EthereumLogo.js +5 -0
- package/dist/components/logos/HyperliquidLogo.d.ts +8 -0
- package/dist/components/logos/HyperliquidLogo.js +5 -0
- package/dist/components/logos/MoreChainsGroup.d.ts +7 -0
- package/dist/components/logos/MoreChainsGroup.js +18 -0
- package/dist/components/logos/OptimismLogo.d.ts +8 -0
- package/dist/components/logos/OptimismLogo.js +5 -0
- package/dist/components/logos/SolanaLogo.d.ts +8 -0
- package/dist/components/logos/SolanaLogo.js +5 -0
- package/dist/components/logos/index.d.ts +10 -0
- package/dist/components/logos/index.js +10 -0
- package/dist/main.css +1 -1
- package/package.json +1 -1
|
@@ -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(
|
|
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(
|
|
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', {
|
|
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' &&
|
|
122
|
-
? '
|
|
123
|
-
|
|
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
|
|
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 '
|
|
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
|
|
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
|
|
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 &&
|
|
14
|
-
error.message
|
|
15
|
-
(error.
|
|
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') ||
|
|
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') ||
|
|
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') ||
|
|
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
|
*/
|
|
@@ -90,9 +91,10 @@ export interface WaitingMessageState {
|
|
|
90
91
|
export interface Chain {
|
|
91
92
|
id: string;
|
|
92
93
|
name: string;
|
|
93
|
-
logo: string;
|
|
94
|
+
logo: string | React.ReactNode;
|
|
94
95
|
disabled?: boolean;
|
|
95
96
|
network?: string;
|
|
97
|
+
description?: string;
|
|
96
98
|
}
|
|
97
99
|
export interface App {
|
|
98
100
|
name: string;
|
|
@@ -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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
|
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 ?
|
|
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 &&
|
|
182
|
-
.
|
|
183
|
-
|
|
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 &&
|
|
18
|
-
|
|
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
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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-
|
|
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
|
}
|
|
@@ -84,17 +84,22 @@ export default function OrderBook(_a) {
|
|
|
84
84
|
return [4 /*yield*/, nord.getOrderbook({ symbol: marketSymbol })];
|
|
85
85
|
case 2:
|
|
86
86
|
orderbook = _a.sent();
|
|
87
|
-
console.log(orderbook, "orderbook");
|
|
88
87
|
bids = Array.isArray(orderbook.bids[0])
|
|
89
88
|
? orderbook.bids
|
|
90
|
-
: orderbook.bids.map(function (entry) { return [
|
|
89
|
+
: orderbook.bids.map(function (entry) { return [
|
|
90
|
+
entry.price,
|
|
91
|
+
entry.size,
|
|
92
|
+
]; });
|
|
91
93
|
asks = Array.isArray(orderbook.asks[0])
|
|
92
94
|
? orderbook.asks
|
|
93
|
-
: orderbook.asks.map(function (entry) { return [
|
|
95
|
+
: orderbook.asks.map(function (entry) { return [
|
|
96
|
+
entry.price,
|
|
97
|
+
entry.size,
|
|
98
|
+
]; });
|
|
94
99
|
setOrderBookData({
|
|
95
100
|
bids: bids,
|
|
96
101
|
asks: asks,
|
|
97
|
-
timestamp: Date.now()
|
|
102
|
+
timestamp: Date.now(),
|
|
98
103
|
});
|
|
99
104
|
// Subscribe to real-time updates
|
|
100
105
|
subscription = nord.subscribeOrderbook(marketSymbol);
|
|
@@ -103,16 +108,22 @@ export default function OrderBook(_a) {
|
|
|
103
108
|
if (!prev)
|
|
104
109
|
return update;
|
|
105
110
|
// Convert OrderbookEntry[] to [number, number][] if needed
|
|
106
|
-
var updatedBids = update.bids
|
|
107
|
-
update.bids.map(function (entry) { return [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
prev.
|
|
111
|
+
var updatedBids = update.bids
|
|
112
|
+
? update.bids.map(function (entry) { return [
|
|
113
|
+
entry.price,
|
|
114
|
+
entry.size,
|
|
115
|
+
]; })
|
|
116
|
+
: prev.bids;
|
|
117
|
+
var updatedAsks = update.asks
|
|
118
|
+
? update.asks.map(function (entry) { return [
|
|
119
|
+
entry.price,
|
|
120
|
+
entry.size,
|
|
121
|
+
]; })
|
|
122
|
+
: prev.asks;
|
|
112
123
|
return {
|
|
113
124
|
bids: updatedBids,
|
|
114
125
|
asks: updatedAsks,
|
|
115
|
-
timestamp: Date.now()
|
|
126
|
+
timestamp: Date.now(),
|
|
116
127
|
};
|
|
117
128
|
});
|
|
118
129
|
});
|
|
@@ -141,20 +152,21 @@ export default function OrderBook(_a) {
|
|
|
141
152
|
var aggregateOrderBook = function (data, level) {
|
|
142
153
|
if (!data)
|
|
143
154
|
return null;
|
|
144
|
-
console.log(data, "zzzz");
|
|
145
155
|
var aggregatedBids = {};
|
|
146
156
|
var aggregatedAsks = {};
|
|
147
157
|
// Aggregate bids
|
|
148
158
|
data.bids.forEach(function (_a) {
|
|
149
159
|
var price = _a[0], size = _a[1];
|
|
150
160
|
var aggregatedPrice = Math.floor(price / level) * level;
|
|
151
|
-
aggregatedBids[aggregatedPrice] =
|
|
161
|
+
aggregatedBids[aggregatedPrice] =
|
|
162
|
+
(aggregatedBids[aggregatedPrice] || 0) + size;
|
|
152
163
|
});
|
|
153
164
|
// Aggregate asks
|
|
154
165
|
data.asks.forEach(function (_a) {
|
|
155
166
|
var price = _a[0], size = _a[1];
|
|
156
167
|
var aggregatedPrice = Math.ceil(price / level) * level;
|
|
157
|
-
aggregatedAsks[aggregatedPrice] =
|
|
168
|
+
aggregatedAsks[aggregatedPrice] =
|
|
169
|
+
(aggregatedAsks[aggregatedPrice] || 0) + size;
|
|
158
170
|
});
|
|
159
171
|
// Convert back to arrays and sort
|
|
160
172
|
var bids = Object.entries(aggregatedBids)
|
|
@@ -169,11 +181,10 @@ export default function OrderBook(_a) {
|
|
|
169
181
|
return [parseFloat(price), size];
|
|
170
182
|
})
|
|
171
183
|
.sort(function (a, b) { return a[0] - b[0]; });
|
|
172
|
-
console.log(bids, asks);
|
|
173
184
|
return {
|
|
174
185
|
bids: bids,
|
|
175
186
|
asks: asks,
|
|
176
|
-
timestamp: data.timestamp
|
|
187
|
+
timestamp: data.timestamp,
|
|
177
188
|
};
|
|
178
189
|
};
|
|
179
190
|
var aggregatedData = aggregateOrderBook(orderBookData, aggregationLevel);
|
|
@@ -6,5 +6,5 @@ interface OrderBookDepthVisualizerProps {
|
|
|
6
6
|
} | null;
|
|
7
7
|
maxSize: number;
|
|
8
8
|
}
|
|
9
|
-
export default function OrderBookDepthVisualizer({ data, maxSize }: OrderBookDepthVisualizerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export default function OrderBookDepthVisualizer({ data, maxSize, }: OrderBookDepthVisualizerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
10
10
|
export {};
|
|
@@ -3,5 +3,5 @@ interface OrderBookHeaderProps {
|
|
|
3
3
|
aggregationLevel: number;
|
|
4
4
|
onAggregationChange: (level: number) => void;
|
|
5
5
|
}
|
|
6
|
-
export default function OrderBookHeader({ marketSymbol, aggregationLevel, onAggregationChange }: OrderBookHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default function OrderBookHeader({ marketSymbol, aggregationLevel, onAggregationChange, }: OrderBookHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -10,7 +10,8 @@ export default function OrderBookHeader(_a) {
|
|
|
10
10
|
// Close dropdown when clicking outside
|
|
11
11
|
useEffect(function () {
|
|
12
12
|
function handleClickOutside(event) {
|
|
13
|
-
if (dropdownRef.current &&
|
|
13
|
+
if (dropdownRef.current &&
|
|
14
|
+
!dropdownRef.current.contains(event.target)) {
|
|
14
15
|
setIsOpen(false);
|
|
15
16
|
}
|
|
16
17
|
}
|
|
@@ -19,7 +20,7 @@ export default function OrderBookHeader(_a) {
|
|
|
19
20
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
20
21
|
};
|
|
21
22
|
}, []);
|
|
22
|
-
return (_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("h2", { className: "text-base font-semibold text-gray-900 dark:text-gray-100", children: ["Order Book
|
|
23
|
+
return (_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("h2", { className: "text-base font-semibold text-gray-900 dark:text-gray-100", children: ["Order Book", ' ', marketSymbol ? _jsx("span", { className: "text-main", children: marketSymbol }) : ''] }), _jsxs("div", { className: "relative", ref: dropdownRef, children: [_jsxs("button", { onClick: function () { return setIsOpen(!isOpen); }, className: "flex items-center gap-1 px-2 py-1 bg-gray-100 dark:bg-gray-950 rounded-sm text-xs text-gray-900 dark:text-gray-100 border border-gray-200 dark:border-gray-800 hover:border-main dark:hover:border-main transition-colors duration-200", children: [_jsxs("span", { children: ["Precision:", ' ', _jsx("span", { className: "font-mono font-medium", children: aggregationLevel })] }), _jsx(ChevronDown, { size: 14, className: "transition-transform duration-200 ".concat(isOpen ? 'rotate-180 text-main' : 'text-gray-500 dark:text-gray-400') })] }), isOpen && (_jsx("div", { className: "absolute right-0 z-50 mt-1 w-36 bg-white dark:bg-gray-950 rounded-sm shadow-lg border border-gray-200 dark:border-gray-800 overflow-hidden", children: aggregationOptions.map(function (level) { return (_jsx("button", { onClick: function () {
|
|
23
24
|
onAggregationChange(level);
|
|
24
25
|
setIsOpen(false);
|
|
25
26
|
}, className: "w-full text-left px-3 py-1.5 text-xs hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors duration-200 ".concat(aggregationLevel === level
|
|
@@ -7,5 +7,5 @@ interface OrderBookTableProps {
|
|
|
7
7
|
loading: boolean;
|
|
8
8
|
maxSize: number;
|
|
9
9
|
}
|
|
10
|
-
export default function OrderBookTable({ data, loading, maxSize }: OrderBookTableProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default function OrderBookTable({ data, loading, maxSize, }: OrderBookTableProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -5,7 +5,6 @@ export default function OrderBookTable(_a) {
|
|
|
5
5
|
if (!data) {
|
|
6
6
|
return (_jsx("div", { className: "flex items-center justify-center h-40", children: _jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: "No orderbook data available" }) }));
|
|
7
7
|
}
|
|
8
|
-
console.log(data);
|
|
9
8
|
// Limit the number of rows to display
|
|
10
9
|
var maxRows = 8;
|
|
11
10
|
var bids = data.bids.slice(0, maxRows);
|
|
@@ -14,9 +13,9 @@ export default function OrderBookTable(_a) {
|
|
|
14
13
|
var price = _a[0], size = _a[1];
|
|
15
14
|
var sizePercentage = (size / maxSize) * 100;
|
|
16
15
|
return (_jsxs("div", { className: "grid grid-cols-3 gap-1 relative", children: [_jsx("div", { className: "text-left text-xs" }), _jsx("div", { className: "text-center text-xs font-medium text-red-600 dark:text-red-400 font-mono z-10", children: price.toFixed(4) }), _jsx("div", { className: "text-right text-xs font-medium text-gray-900 dark:text-gray-100 font-mono z-10", children: size.toFixed(4) }), _jsx("div", { className: "absolute top-0 right-0 h-full bg-red-100/50 dark:bg-red-900/10 z-0", style: { width: "".concat(sizePercentage, "%") } })] }, "ask-".concat(index)));
|
|
17
|
-
}) }), bids.length > 0 && asks.length > 0 && (_jsx("div", { className: "py-1 px-2 mb-2 border border-gray-200 dark:border-gray-800 rounded-sm text-center", children: _jsxs("span", { className: "text-[10px] text-gray-500 dark:text-gray-400", children: ["Spread:
|
|
16
|
+
}) }), bids.length > 0 && asks.length > 0 && (_jsx("div", { className: "py-1 px-2 mb-2 border border-gray-200 dark:border-gray-800 rounded-sm text-center", children: _jsxs("span", { className: "text-[10px] text-gray-500 dark:text-gray-400", children: ["Spread:", ' ', _jsx("span", { className: "font-mono font-medium", children: (asks[asks.length - 1][0] - bids[0][0]).toFixed(4) }), ' ', "(", _jsxs("span", { className: "font-mono", children: [((asks[asks.length - 1][0] / bids[0][0] - 1) * 100).toFixed(2), "%"] }), ")"] }) })), _jsx("div", { className: "space-y-px", children: bids.map(function (_a, index) {
|
|
18
17
|
var price = _a[0], size = _a[1];
|
|
19
18
|
var sizePercentage = (size / maxSize) * 100;
|
|
20
19
|
return (_jsxs("div", { className: "grid grid-cols-3 gap-1 relative", children: [_jsx("div", { className: "text-left text-xs font-medium text-gray-900 dark:text-gray-100 font-mono z-10", children: size.toFixed(4) }), _jsx("div", { className: "text-center text-xs font-medium text-green-600 dark:text-green-400 font-mono z-10", children: price.toFixed(4) }), _jsx("div", { className: "text-right text-xs" }), _jsx("div", { className: "absolute top-0 left-0 h-full bg-green-100/50 dark:bg-green-900/10 z-0", style: { width: "".concat(sizePercentage, "%") } })] }, "bid-".concat(index)));
|
|
21
|
-
}) }), _jsxs("div", { className: "mt-2 text-[10px] text-gray-500 dark:text-gray-400 text-right", children: ["Last updated:
|
|
20
|
+
}) }), _jsxs("div", { className: "mt-2 text-[10px] text-gray-500 dark:text-gray-400 text-right", children: ["Last updated:", ' ', _jsx("span", { className: "font-mono", children: new Date(data.timestamp).toLocaleTimeString() })] })] }));
|
|
22
21
|
}
|
|
@@ -3,5 +3,5 @@ interface AmountInputProps {
|
|
|
3
3
|
onChange: (amount: string) => void;
|
|
4
4
|
marketInfo?: any;
|
|
5
5
|
}
|
|
6
|
-
export default function AmountInput({ amount, onChange, marketInfo }: AmountInputProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default function AmountInput({ amount, onChange, marketInfo, }: AmountInputProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -15,9 +15,9 @@ export default function BuySellTabs(_a) {
|
|
|
15
15
|
? 'left-0 bg-emerald-600 dark:bg-emerald-600 rounded-r-sm'
|
|
16
16
|
: 'left-1/2 bg-red-700 dark:bg-red-700 rounded-l-sm') }), _jsxs("button", { type: "button", onClick: function () { return handleSideChange('BUY'); }, onMouseEnter: function () { return setHoveredSide('BUY'); }, onMouseLeave: function () { return setHoveredSide(null); }, className: "flex-1 py-2 text-center text-sm font-medium transition-colors duration-200 relative overflow-hidden z-10", children: [_jsx("span", { className: "relative transition-colors duration-300 ".concat(side === 'BUY' ? 'text-white' : 'text-gray-700 dark:text-gray-300'), children: "Buy" }), side === 'BUY' && hoveredSide === 'BUY' && !animating && (_jsx("span", { className: "absolute inset-0 bg-gradient-to-r from-transparent via-white to-transparent opacity-25 pointer-events-none translate-x-[-200%] animate-shimmer", style: {
|
|
17
17
|
backgroundSize: '200% 100%',
|
|
18
|
-
animationDuration: '1.5s'
|
|
18
|
+
animationDuration: '1.5s',
|
|
19
19
|
} }))] }), _jsxs("button", { type: "button", onClick: function () { return handleSideChange('SELL'); }, onMouseEnter: function () { return setHoveredSide('SELL'); }, onMouseLeave: function () { return setHoveredSide(null); }, className: "flex-1 py-2 text-center text-sm font-medium transition-colors duration-200 relative overflow-hidden z-10", children: [_jsx("span", { className: "relative transition-colors duration-300 ".concat(side === 'SELL' ? 'text-white' : 'text-gray-700 dark:text-gray-300'), children: "Sell" }), side === 'SELL' && hoveredSide === 'SELL' && !animating && (_jsx("span", { className: "absolute inset-0 bg-gradient-to-r from-transparent via-white to-transparent opacity-25 pointer-events-none translate-x-[-200%] animate-shimmer", style: {
|
|
20
20
|
backgroundSize: '200% 100%',
|
|
21
|
-
animationDuration: '1.5s'
|
|
21
|
+
animationDuration: '1.5s',
|
|
22
22
|
} }))] })] }));
|
|
23
23
|
}
|
|
@@ -3,5 +3,5 @@ interface FillModeSelectorProps {
|
|
|
3
3
|
fillMode: FillMode;
|
|
4
4
|
onFillModeChange: (mode: FillMode) => void;
|
|
5
5
|
}
|
|
6
|
-
export default function FillModeSelector({ fillMode, onFillModeChange }: FillModeSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default function FillModeSelector({ fillMode, onFillModeChange, }: FillModeSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export {};
|