@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.
Files changed (91) 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 +26 -21
  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 +4 -4
  19. package/dist/Modal/NordFlow/hooks/useDepositFlow.js +31 -16
  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 +3 -1
  26. package/dist/Modal/NordFlow/screens/04-AmountInputScreen.js +37 -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 +3 -1
  37. package/dist/Modal/NordFlow/utils/imageUtils.js +3 -3
  38. package/dist/Modal/NordFlow/utils/nordUtils.js +3 -1
  39. package/dist/Modal/Sidebar/N1Sidebar.js +11 -5
  40. package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketOverview.d.ts +1 -1
  41. package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketSelector.d.ts +1 -1
  42. package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketSelector.js +7 -3
  43. package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketStats.d.ts +1 -1
  44. package/dist/Modal/Sidebar/NordTradingView/NordTradingView.js +7 -7
  45. package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBook.js +27 -16
  46. package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookDepthVisualizer.d.ts +1 -1
  47. package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookHeader.d.ts +1 -1
  48. package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookHeader.js +3 -2
  49. package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookTable.d.ts +1 -1
  50. package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookTable.js +2 -3
  51. package/dist/Modal/Sidebar/NordTradingView/TradeForm/AmountInput.d.ts +1 -1
  52. package/dist/Modal/Sidebar/NordTradingView/TradeForm/BuySellTabs.js +2 -2
  53. package/dist/Modal/Sidebar/NordTradingView/TradeForm/FillModeSelector.d.ts +1 -1
  54. package/dist/Modal/Sidebar/NordTradingView/TradeForm/FillModeSelector.js +16 -13
  55. package/dist/Modal/Sidebar/NordTradingView/TradeForm/OrderTypeSelector.d.ts +1 -1
  56. package/dist/Modal/Sidebar/NordTradingView/TradeForm/OrderTypeSelector.js +17 -11
  57. package/dist/Modal/Sidebar/NordTradingView/TradeForm/PriceInput.d.ts +1 -1
  58. package/dist/Modal/Sidebar/NordTradingView/TradeForm/SubmitButton.d.ts +1 -1
  59. package/dist/Modal/Sidebar/NordTradingView/TradeForm/SubmitButton.js +2 -2
  60. package/dist/Modal/Sidebar/NordTradingView/TradeForm/TotalCalculator.d.ts +1 -1
  61. package/dist/Modal/Sidebar/NordTradingView/TradeForm/TotalCalculator.js +3 -1
  62. package/dist/Modal/Sidebar/NordTradingView/TradeForm/TradeForm.js +21 -11
  63. package/dist/Modal/Sidebar/NordTradingView/UserBalances/UserBalances.js +1 -1
  64. package/dist/Modal/Sidebar/NordTradingView/UserOrders/UserOrders.js +11 -6
  65. package/dist/Modal/Sidebar/NordTradingView/UserPositions/UserPositions.js +14 -7
  66. package/dist/Provider/LazyWalletProvider.js +10 -4
  67. package/dist/Provider/N1WalletProvider.js +6 -5
  68. package/dist/components/logos/ArbitrumLogo.d.ts +8 -0
  69. package/dist/components/logos/ArbitrumLogo.js +5 -0
  70. package/dist/components/logos/BaseLogo.d.ts +8 -0
  71. package/dist/components/logos/BaseLogo.js +5 -0
  72. package/dist/components/logos/BeraLogo.d.ts +8 -0
  73. package/dist/components/logos/BeraLogo.js +5 -0
  74. package/dist/components/logos/BitcoinLogo.d.ts +8 -0
  75. package/dist/components/logos/BitcoinLogo.js +5 -0
  76. package/dist/components/logos/EVMChainsGroup.d.ts +7 -0
  77. package/dist/components/logos/EVMChainsGroup.js +18 -0
  78. package/dist/components/logos/EthereumLogo.d.ts +8 -0
  79. package/dist/components/logos/EthereumLogo.js +5 -0
  80. package/dist/components/logos/HyperliquidLogo.d.ts +8 -0
  81. package/dist/components/logos/HyperliquidLogo.js +5 -0
  82. package/dist/components/logos/MoreChainsGroup.d.ts +7 -0
  83. package/dist/components/logos/MoreChainsGroup.js +18 -0
  84. package/dist/components/logos/OptimismLogo.d.ts +8 -0
  85. package/dist/components/logos/OptimismLogo.js +5 -0
  86. package/dist/components/logos/SolanaLogo.d.ts +8 -0
  87. package/dist/components/logos/SolanaLogo.js +5 -0
  88. package/dist/components/logos/index.d.ts +10 -0
  89. package/dist/components/logos/index.js +10 -0
  90. package/dist/main.css +1 -1
  91. package/package.json +1 -1
@@ -27,7 +27,7 @@ export declare function createSigningFunction(privateKey: Uint8Array): (message:
27
27
  * Store session keys in local storage
28
28
  * @param data The session key data to store
29
29
  */
30
- export declare function storeSessionKeys({ privKey, walletPublicKey, chainName, sessionMode }: {
30
+ export declare function storeSessionKeys({ privKey, walletPublicKey, chainName, sessionMode, }: {
31
31
  privKey: Uint8Array;
32
32
  walletPublicKey: string;
33
33
  chainName: string;
@@ -96,10 +96,13 @@ export function storeSessionKeys(_a) {
96
96
  walletPublicKey: walletPublicKey,
97
97
  chainName: chainName,
98
98
  createdAt: new Date().toISOString(),
99
- sessionMode: sessionMode.toString()
99
+ sessionMode: sessionMode.toString(),
100
100
  };
101
101
  localStorage.setItem(storageKey, JSON.stringify(data));
102
- logger.debug('Session keys stored in local storage', { walletPublicKey: walletPublicKey, sessionMode: sessionMode });
102
+ logger.debug('Session keys stored in local storage', {
103
+ walletPublicKey: walletPublicKey,
104
+ sessionMode: sessionMode,
105
+ });
103
106
  }
104
107
  /**
105
108
  * Retrieve session keys from local storage
@@ -119,9 +122,10 @@ export function getSessionKeys(walletPublicKey) {
119
122
  }
120
123
  // Convert sessionMode string to enum value
121
124
  if (typeof parsedData.sessionMode === 'string') {
122
- parsedData.sessionMode = parsedData.sessionMode === N1SessionMode.Nord.toString()
123
- ? N1SessionMode.Nord
124
- : N1SessionMode.NTS;
125
+ parsedData.sessionMode =
126
+ parsedData.sessionMode === N1SessionMode.Nord.toString()
127
+ ? N1SessionMode.Nord
128
+ : N1SessionMode.NTS;
125
129
  }
126
130
  else if (parsedData.sessionMode === undefined) {
127
131
  // For backward compatibility, default to NTS mode if not specified
@@ -103,7 +103,7 @@ function createAndSendNordTransaction(data, signMessage) {
103
103
  toAddress: 'Your Account',
104
104
  networkName: getNetworkName(data.chainId),
105
105
  status: 'Completed',
106
- explorerUrl: "https://explorer.nord.network/tx/".concat(transactionId)
106
+ explorerUrl: "https://explorer.nord.network/tx/".concat(transactionId),
107
107
  }];
108
108
  });
109
109
  });
@@ -139,7 +139,7 @@ function createAndSendNTSTransaction(data, signMessage) {
139
139
  toAddress: 'NTS Account',
140
140
  networkName: getNetworkName(data.chainId),
141
141
  status: 'Completed',
142
- explorerUrl: "https://explorer.nts.network/tx/".concat(transactionId)
142
+ explorerUrl: "https://explorer.nts.network/tx/".concat(transactionId),
143
143
  }];
144
144
  }
145
145
  });
@@ -175,7 +175,11 @@ export function checkTransactionStatus(transactionId, chainId, sessionMode) {
175
175
  return __generator(this, function (_a) {
176
176
  switch (_a.label) {
177
177
  case 0:
178
- logger.debug('Checking transaction status', { transactionId: transactionId, chainId: chainId, sessionMode: sessionMode });
178
+ logger.debug('Checking transaction status', {
179
+ transactionId: transactionId,
180
+ chainId: chainId,
181
+ sessionMode: sessionMode,
182
+ });
179
183
  // In a real implementation, this would query the appropriate API based on session mode
180
184
  // For now, we'll simulate a successful transaction
181
185
  // Simulate processing time
@@ -105,16 +105,16 @@ function getMsgBytes(timestamp) {
105
105
  }
106
106
  export function createWebSession(signMessageWithSessionKey, sessionPubKey, walletPubKey) {
107
107
  return __awaiter(this, void 0, void 0, function () {
108
- var timestamp, msg, signature, response, _a, _b;
109
- return __generator(this, function (_c) {
110
- switch (_c.label) {
108
+ var timestamp, msg, signature, response;
109
+ return __generator(this, function (_a) {
110
+ switch (_a.label) {
111
111
  case 0:
112
112
  logger.debug('Creating web session...');
113
113
  timestamp = new Date().getTime();
114
114
  msg = getMsgBytes(timestamp);
115
115
  return [4 /*yield*/, signMessageWithSessionKey(msg)];
116
116
  case 1:
117
- signature = _c.sent();
117
+ signature = _a.sent();
118
118
  if (process.env.SKIP_ARGUS) {
119
119
  return [2 /*return*/];
120
120
  }
@@ -133,14 +133,11 @@ export function createWebSession(signMessageWithSessionKey, sessionPubKey, walle
133
133
  credentials: 'include', // Include cookies in requests
134
134
  })];
135
135
  case 2:
136
- response = _c.sent();
137
- if (!(response.status != 200)) return [3 /*break*/, 4];
138
- _b = (_a = console).log;
139
- return [4 /*yield*/, response.json()];
140
- case 3:
141
- _b.apply(_a, [_c.sent()]);
142
- throw new Error('failed to create a session!');
143
- case 4: return [2 /*return*/];
136
+ response = _a.sent();
137
+ if (response.status != 200) {
138
+ throw new Error('failed to create a session!');
139
+ }
140
+ return [2 /*return*/];
144
141
  }
145
142
  });
146
143
  });
@@ -37,9 +37,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
38
38
  import { bs58Decode, getEd25519PublicKey, signEd25519 } from '@n1xyz/nts-sdk';
39
39
  import { lazy, Suspense, useEffect, useState } from 'react';
40
- import { ANIMATION_EASE, } from './NordFlow/constants';
40
+ import { ANIMATION_EASE } from './NordFlow/constants';
41
41
  import { WalletError, WalletErrorCode } from '../errors/types';
42
- import { getSessionKeysFromLocalStorage, getUser, getUserBalances } from '../Logic/utils';
42
+ import { getSessionKeysFromLocalStorage, getUser, getUserBalances, } from '../Logic/utils';
43
43
  import { useN1WalletContext, useN1WalletInternalContext, } from '../Provider/hooks';
44
44
  import { N1ModalViewMode, N1SessionMode } from '../Provider/types';
45
45
  import { logger } from '../utils/logger';
@@ -113,7 +113,6 @@ export function N1WalletModal() {
113
113
  _a.label = 4;
114
114
  case 4:
115
115
  logger.group('Session Initialization');
116
- console.log('Session Initialization started');
117
116
  _a.label = 5;
118
117
  case 5:
119
118
  _a.trys.push([5, , 15, 16]);
@@ -16,15 +16,19 @@ var SigningView = lazy(function () {
16
16
  return import('./views/SigningView').then(function (mod) { return ({ default: mod.SigningView }); });
17
17
  });
18
18
  var CreateUserView = lazy(function () {
19
- return import('./views/CreateUserView').then(function (mod) { return ({ default: mod.CreateUserView }); });
19
+ return import('./views/CreateUserView').then(function (mod) { return ({
20
+ default: mod.CreateUserView,
21
+ }); });
20
22
  });
21
23
  var SuccessView = lazy(function () {
22
24
  return import('./views/SuccessView').then(function (mod) { return ({ default: mod.SuccessView }); });
23
25
  });
24
26
  var NoWhitelistView = lazy(function () {
25
- return import('./views/NoWhitelistView').then(function (mod) { return ({ default: mod.NoWhitelistView }); });
27
+ return import('./views/NoWhitelistView').then(function (mod) { return ({
28
+ default: mod.NoWhitelistView,
29
+ }); });
26
30
  });
27
31
  export function NTSFlow(_a) {
28
32
  var viewMode = useN1WalletContext().viewMode;
29
- return (_jsxs(Suspense, { fallback: _jsx(LoadingFallback, {}), children: [viewMode === N1ModalViewMode.Connect && _jsx(ConnectView, {}), viewMode === N1ModalViewMode.CreateSession && (_jsx(CreateSessionView, {})), viewMode === N1ModalViewMode.Signing && _jsx(SigningView, {}), viewMode === N1ModalViewMode.CreatingUser && (_jsx(CreateUserView, {})), viewMode === N1ModalViewMode.Success && _jsx(SuccessView, {}), viewMode === N1ModalViewMode.NoWhitelist && (_jsx(NoWhitelistView, {}))] }));
33
+ return (_jsxs(Suspense, { fallback: _jsx(LoadingFallback, {}), children: [viewMode === N1ModalViewMode.Connect && _jsx(ConnectView, {}), viewMode === N1ModalViewMode.CreateSession && _jsx(CreateSessionView, {}), viewMode === N1ModalViewMode.Signing && _jsx(SigningView, {}), viewMode === N1ModalViewMode.CreatingUser && _jsx(CreateUserView, {}), viewMode === N1ModalViewMode.Success && _jsx(SuccessView, {}), viewMode === N1ModalViewMode.NoWhitelist && _jsx(NoWhitelistView, {})] }));
30
34
  }
@@ -9,7 +9,6 @@ export function BackButton(props) {
9
9
  var _c = useState(false), isPressed = _c[0], setIsPressed = _c[1];
10
10
  function back() {
11
11
  // todo: disconnect
12
- console.log('back');
13
12
  dynamicHandleLogOut();
14
13
  setViewMode(N1ModalViewMode.Connect);
15
14
  }
@@ -172,7 +172,7 @@ export function CreateSessionView() {
172
172
  case 1: return [2 /*return*/, _a.sent()];
173
173
  case 2:
174
174
  _2 = _a.sent();
175
- console.log('error', _2);
175
+ logger.error('Error signing with Ed25519:', _2);
176
176
  throw _2;
177
177
  case 3: return [2 /*return*/];
178
178
  }
@@ -37,13 +37,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
38
38
  import React, { useCallback, useEffect, useState } from 'react';
39
39
  import Logo from '../../components/Logo';
40
- import { useN1WalletContext, useN1WalletInternalContext } from '../../Provider/hooks';
40
+ import { useN1WalletContext, useN1WalletInternalContext, } from '../../Provider/hooks';
41
41
  import { CHAINS } from './constants';
42
42
  import { withImageFallback } from './hoc';
43
- import { useDepositFlow, useFlowState, useInterruptHandler, useNordInstance, useNordWalletConnect } from './hooks';
44
- import { AmountInputScreen, AuthLoadingScreen, ChainSelectionScreen, ConnectWalletScreen, DepositProgressScreen, DepositSuccessScreen, ErrorScreen, EvmWalletAuthScreen, FinalSuccessScreen } from './screens';
43
+ import { useDepositFlow, useFlowState, useInterruptHandler, useNordInstance, useNordWalletConnect, } from './hooks';
44
+ import { AmountInputScreen, AuthLoadingScreen, ChainSelectionScreen, ConnectWalletScreen, DepositProgressScreen, DepositSuccessScreen, ErrorScreen, EvmWalletAuthScreen, FinalSuccessScreen, } from './screens';
45
45
  import { FlowState } from './types';
46
46
  import { getTokenBalance, isNordConfigured } from './utils/nordUtils';
47
+ import { logger } from '../../utils/logger';
47
48
  // Apply the withImageFallback HOC to all screen components
48
49
  var EnhancedConnectWalletScreen = withImageFallback(ConnectWalletScreen);
49
50
  var EnhancedEvmWalletAuthScreen = withImageFallback(EvmWalletAuthScreen);
@@ -68,16 +69,16 @@ export var NordFlow = function (_a) {
68
69
  // Check if Nord is properly configured
69
70
  useEffect(function () {
70
71
  if (nord && !isNordConfigured(nord)) {
71
- console.warn('Nord is available but not properly configured. Some functionality may be limited.');
72
+ logger.warn('Nord is available but not properly configured. Some functionality may be limited.');
72
73
  }
73
74
  }, [nord]);
74
75
  // Handle state changes
75
76
  var handleStateChange = useCallback(function (newState, prevState) {
76
- console.log("State changed from ".concat(prevState, " to ").concat(newState));
77
+ logger.debug("State changed from ".concat(prevState, " to ").concat(newState));
77
78
  }, []);
78
79
  // Handle errors
79
80
  var handleError = useCallback(function (error) {
80
- console.error('Flow error:', error);
81
+ logger.error('Flow error:', error);
81
82
  }, []);
82
83
  // Initialize flow state
83
84
  var _d = useFlowState({
@@ -87,9 +88,9 @@ export var NordFlow = function (_a) {
87
88
  }), state = _d.state, context = _d.context, transition = _d.transition, updateContext = _d.updateContext, recover = _d.recover, recordInterruption = _d.recordInterruption, handleFlowError = _d.handleError, isRecoveryAvailable = _d.isRecoveryAvailable;
88
89
  // Create a wrapped transition function that logs more details
89
90
  var enhancedTransition = useCallback(function (newState, contextUpdates) {
90
- console.log("Attempting transition to ".concat(newState), contextUpdates);
91
+ logger.debug("Attempting transition to ".concat(newState), contextUpdates);
91
92
  var result = transition(newState, contextUpdates);
92
- console.log("Transition to ".concat(newState, " result:"), result);
93
+ logger.debug("Transition to ".concat(newState, " result:"), result);
93
94
  return result;
94
95
  }, [transition]);
95
96
  // Initialize wallet connection
@@ -130,7 +131,7 @@ export var NordFlow = function (_a) {
130
131
  visible: true,
131
132
  title: 'Processing Deposit',
132
133
  subtitle: 'Please wait while we process your deposit',
133
- isTyping: false
134
+ isTyping: false,
134
135
  }), depositMessage = _j[0], setDepositMessage = _j[1];
135
136
  var handleFinish = function () {
136
137
  if (onClose) {
@@ -139,12 +140,12 @@ export var NordFlow = function (_a) {
139
140
  };
140
141
  // Handle chain selection
141
142
  var handleChainSelect = useCallback(function (chainId) {
142
- console.log('Chain selected in NordFlow:', chainId);
143
+ logger.debug('Chain selected in NordFlow:', chainId);
143
144
  // For testnet, we need to use the network ID
144
145
  var selectedChain = chainId;
145
- console.log('Transitioning to AMOUNT_INPUT with chain:', selectedChain);
146
+ logger.debug('Transitioning to AMOUNT_INPUT with chain:', selectedChain);
146
147
  enhancedTransition(FlowState.AMOUNT_INPUT, {
147
- selectedChain: selectedChain
148
+ selectedChain: selectedChain,
148
149
  });
149
150
  }, [enhancedTransition]);
150
151
  // Get the USDC balance
@@ -166,7 +167,7 @@ export var NordFlow = function (_a) {
166
167
  switch (_a.label) {
167
168
  case 0:
168
169
  _a.trys.push([0, 6, , 7]);
169
- console.log('Refreshing balance...');
170
+ logger.debug('Refreshing balance...');
170
171
  if (!(currentNordUser && nord && isNordConfigured(nord))) return [3 /*break*/, 5];
171
172
  _a.label = 1;
172
173
  case 1:
@@ -176,19 +177,19 @@ export var NordFlow = function (_a) {
176
177
  return [4 /*yield*/, userAny.refreshBalances()];
177
178
  case 2:
178
179
  _a.sent();
179
- console.log('Balances refreshed using Nord-TS');
180
+ logger.debug('Balances refreshed using Nord-TS');
180
181
  return [2 /*return*/];
181
182
  case 3: return [3 /*break*/, 5];
182
183
  case 4:
183
184
  error_1 = _a.sent();
184
- console.warn('Error refreshing balances using Nord-TS, falling back to default method:', error_1);
185
+ logger.warn('Error refreshing balances using Nord-TS, falling back to default method:', error_1);
185
186
  return [3 /*break*/, 5];
186
187
  case 5:
187
- console.log('Balance refreshed using default method');
188
+ logger.debug('Balance refreshed using default method');
188
189
  return [3 /*break*/, 7];
189
190
  case 6:
190
191
  error_2 = _a.sent();
191
- console.error('Error refreshing balance:', error_2);
192
+ logger.error('Error refreshing balance:', error_2);
192
193
  return [3 /*break*/, 7];
193
194
  case 7: return [2 /*return*/];
194
195
  }
@@ -196,12 +197,16 @@ export var NordFlow = function (_a) {
196
197
  }); }, [currentNordUser, nord]);
197
198
  // Get available chains from Nord if possible
198
199
  var getAvailableChains = useCallback(function () {
199
- if (nord && isNordConfigured(nord) && nord.markets && nord.markets.length > 0) {
200
+ if (nord &&
201
+ isNordConfigured(nord) &&
202
+ nord.markets &&
203
+ nord.markets.length > 0) {
200
204
  // Map Nord markets to chains format
201
205
  return nord.markets.map(function (market) { return ({
202
206
  id: market.marketId.toString(),
203
207
  name: market.symbol,
204
- logo: "/assets/chains/".concat(market.symbol.toLowerCase(), ".svg"),
208
+ // Use a placeholder or dynamically generated logo instead of non-existent assets
209
+ logo: market.symbol.toLowerCase(), // Just use the symbol as an identifier
205
210
  }); });
206
211
  }
207
212
  // Fallback to predefined chains
@@ -220,7 +225,7 @@ export var NordFlow = function (_a) {
220
225
  case FlowState.AMOUNT_INPUT:
221
226
  return (_jsx(EnhancedAmountInputScreen, { amount: amount, onAmountChange: updateAmount, onContinue: startDeposit, balance: getUsdcBalance(), faucetUrl: faucetUrl, refreshBalance: refreshBalance }));
222
227
  case FlowState.DEPOSIT_PROGRESS:
223
- return (_jsx(EnhancedDepositProgressScreen, { message: depositMessage }));
228
+ return _jsx(EnhancedDepositProgressScreen, { message: depositMessage });
224
229
  case FlowState.DEPOSIT_SUCCESS:
225
230
  // Get transaction details from the deposit flow
226
231
  var txDetails = getTransactionDetails();
@@ -248,7 +253,7 @@ export var NordFlow = function (_a) {
248
253
  }
249
254
  } }));
250
255
  case FlowState.FINAL_SUCCESS:
251
- return (_jsx(EnhancedFinalSuccessScreen, { onDone: handleFinish }));
256
+ return _jsx(EnhancedFinalSuccessScreen, { onDone: handleFinish });
252
257
  case FlowState.ERROR:
253
258
  return (_jsx(EnhancedErrorScreen, { error: context.error, onRetry: function () {
254
259
  // Logic to go back to appropriate state based on error
@@ -4,5 +4,5 @@ interface ChainButtonProps {
4
4
  onClick: (chainId: string) => void;
5
5
  disabled?: boolean;
6
6
  }
7
- export declare function ChainButton({ chain, onClick, disabled }: ChainButtonProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function ChainButton({ chain, onClick, disabled, }: ChainButtonProps): import("react/jsx-runtime").JSX.Element;
8
8
  export {};
@@ -7,15 +7,15 @@ export function ChainButton(_a) {
7
7
  onClick(chain.id);
8
8
  }
9
9
  };
10
- var baseClasses = "flex flex-col items-center justify-center p-6 bg-gray-50 dark:bg-gray-950 border-2 border-gray-100 dark:border-gray-800 transition-all duration-200 group rounded-lg";
11
- var enabledClasses = "hover:border-red-500 dark:hover:border-red-500 hover:bg-red-50/50 dark:hover:bg-gray-900";
12
- var disabledClasses = "opacity-50 cursor-not-allowed";
10
+ var baseClasses = 'flex flex-col items-center justify-center p-6 bg-gray-50 dark:bg-gray-950 border-2 border-gray-100 dark:border-gray-800 transition-all duration-200 group rounded-lg';
11
+ var enabledClasses = 'hover:border-red-500 dark:hover:border-red-500 hover:bg-red-50/50 dark:hover:bg-gray-900';
12
+ var disabledClasses = 'opacity-50 cursor-not-allowed';
13
13
  var buttonClasses = "".concat(baseClasses, " ").concat(disabled ? disabledClasses : enabledClasses);
14
14
  var imageClasses = disabled
15
- ? "opacity-50 grayscale"
16
- : "opacity-90 grayscale group-hover:grayscale-0 group-hover:scale-105 transition-all duration-200";
15
+ ? 'opacity-50 grayscale'
16
+ : 'opacity-90 grayscale group-hover:grayscale-0 group-hover:scale-105 transition-all duration-200';
17
17
  var textClasses = disabled
18
- ? "mt-4 font-medium text-gray-400 dark:text-gray-500"
19
- : "mt-4 font-medium text-gray-600 dark:text-gray-400 group-hover:text-red-500 dark:group-hover:text-gray-50 transition-colors duration-200";
20
- return (_jsxs("button", { onClick: handleClick, className: buttonClasses, disabled: disabled, children: [_jsx(ImageWithFallback, { src: chain.logo, width: 48, height: 48, alt: chain.name, className: imageClasses, fallbackClassName: "w-12 h-12 rounded-full text-lg font-bold opacity-90 group-hover:scale-105 transition-all duration-200", fallbackBgColor: "bg-main/10 dark:bg-main/20", fallbackTextColor: "text-main dark:text-main" }), _jsx("span", { className: textClasses, children: chain.name })] }));
18
+ ? 'mt-4 font-medium text-gray-400 dark:text-gray-500'
19
+ : 'mt-4 font-medium text-gray-600 dark:text-gray-400 group-hover:text-red-500 dark:group-hover:text-gray-50 transition-colors duration-200';
20
+ return (_jsxs("button", { onClick: handleClick, className: buttonClasses, disabled: disabled, children: [typeof chain.logo === 'string' ? (_jsx(ImageWithFallback, { src: chain.logo, width: 48, height: 48, alt: chain.name, className: imageClasses, fallbackClassName: "w-12 h-12 rounded-full text-lg font-bold opacity-90 group-hover:scale-105 transition-all duration-200", fallbackBgColor: "bg-main/10 dark:bg-main/20", fallbackTextColor: "text-main dark:text-main" })) : (_jsx("div", { className: imageClasses, children: chain.logo })), _jsx("span", { className: textClasses, children: chain.name })] }));
21
21
  }
@@ -0,0 +1,8 @@
1
+ import { Chain } from '../types';
2
+ interface EVMChainsButtonProps {
3
+ chain: Chain;
4
+ onClick: (chainId: string) => void;
5
+ disabled?: boolean;
6
+ }
7
+ export declare function EVMChainsButton({ chain, onClick, disabled, }: EVMChainsButtonProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { EVMChainsGroup } from '../../../components/logos';
3
+ export function EVMChainsButton(_a) {
4
+ var chain = _a.chain, onClick = _a.onClick, _b = _a.disabled, disabled = _b === void 0 ? false : _b;
5
+ var handleClick = function () {
6
+ if (!disabled) {
7
+ onClick(chain.id);
8
+ }
9
+ };
10
+ var baseClasses = 'flex flex-col items-center justify-center p-6 bg-gray-50 dark:bg-gray-950 border-2 border-gray-100 dark:border-gray-800 transition-all duration-200 group rounded-lg';
11
+ var enabledClasses = 'hover:border-red-500 dark:hover:border-red-500 hover:bg-red-50/50 dark:hover:bg-gray-900';
12
+ var disabledClasses = 'opacity-50 cursor-not-allowed';
13
+ var buttonClasses = "".concat(baseClasses, " ").concat(disabled ? disabledClasses : enabledClasses);
14
+ var textClasses = disabled
15
+ ? 'mt-4 font-medium text-gray-400 dark:text-gray-500'
16
+ : 'mt-4 font-medium text-gray-600 dark:text-gray-400 group-hover:text-red-500 dark:group-hover:text-gray-50 transition-colors duration-200';
17
+ return (_jsxs("button", { onClick: handleClick, className: buttonClasses, disabled: disabled, children: [_jsx(EVMChainsGroup, { size: 32, className: disabled ? 'opacity-50 grayscale' : 'opacity-90' }), _jsx("span", { className: textClasses, children: chain.name })] }));
18
+ }
@@ -0,0 +1,8 @@
1
+ import { Chain } from '../types';
2
+ interface MoreButtonProps {
3
+ chain: Chain;
4
+ onClick: (chainId: string) => void;
5
+ disabled?: boolean;
6
+ }
7
+ export declare function MoreButton({ chain, onClick, disabled, }: MoreButtonProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { MoreChainsGroup } from '../../../components/logos';
3
+ export function MoreButton(_a) {
4
+ var chain = _a.chain, onClick = _a.onClick, _b = _a.disabled, disabled = _b === void 0 ? false : _b;
5
+ var handleClick = function () {
6
+ if (!disabled) {
7
+ onClick(chain.id);
8
+ }
9
+ };
10
+ var baseClasses = 'flex flex-col items-center justify-center p-6 bg-gray-50 dark:bg-gray-950 border-2 border-gray-100 dark:border-gray-800 transition-all duration-200 group rounded-lg';
11
+ var enabledClasses = 'hover:border-red-500 dark:hover:border-red-500 hover:bg-red-50/50 dark:hover:bg-gray-900';
12
+ var disabledClasses = 'opacity-50 cursor-not-allowed';
13
+ var buttonClasses = "".concat(baseClasses, " ").concat(disabled ? disabledClasses : enabledClasses);
14
+ var textClasses = disabled
15
+ ? 'mt-4 font-medium text-gray-400 dark:text-gray-500'
16
+ : 'mt-4 font-medium text-gray-600 dark:text-gray-400 group-hover:text-red-500 dark:group-hover:text-gray-50 transition-colors duration-200';
17
+ return (_jsxs("button", { onClick: handleClick, className: buttonClasses, disabled: disabled, children: [_jsx(MoreChainsGroup, { size: 32, className: disabled ? 'opacity-50 grayscale' : 'opacity-90' }), _jsx("span", { className: textClasses, children: chain.name })] }));
18
+ }
@@ -9,5 +9,5 @@ interface TransactionTableProps {
9
9
  };
10
10
  onClose?: () => void;
11
11
  }
12
- export declare function TransactionTable({ tableValues, onClose }: TransactionTableProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function TransactionTable({ tableValues, onClose, }: TransactionTableProps): import("react/jsx-runtime").JSX.Element;
13
13
  export {};
@@ -11,20 +11,22 @@ export function TransactionTable(_a) {
11
11
  from: 'From',
12
12
  to: 'To',
13
13
  network: 'Network',
14
- status: 'Status'
14
+ status: 'Status',
15
15
  };
16
16
  return labels[key] || key;
17
17
  };
18
18
  // Get appropriate color for values based on key
19
19
  var getValueStyles = function (key, value) {
20
20
  if (key === 'status') {
21
- if (value.toLowerCase().includes('success') || value.toLowerCase().includes('confirmed')) {
21
+ if (value.toLowerCase().includes('success') ||
22
+ value.toLowerCase().includes('confirmed')) {
22
23
  return 'text-green-500 dark:text-emerald-500 font-medium';
23
24
  }
24
25
  if (value.toLowerCase().includes('pending')) {
25
26
  return 'text-amber-500 dark:text-amber-400 font-medium';
26
27
  }
27
- if (value.toLowerCase().includes('fail') || value.toLowerCase().includes('error')) {
28
+ if (value.toLowerCase().includes('fail') ||
29
+ value.toLowerCase().includes('error')) {
28
30
  return 'text-red-500 dark:text-red-400 font-medium';
29
31
  }
30
32
  }
@@ -68,8 +70,7 @@ export function TransactionTable(_a) {
68
70
  // Order of fields to display
69
71
  var fieldOrder = ['amount', 'status', 'network', 'from', 'to', 'tx'];
70
72
  // Sort entries based on fieldOrder
71
- var sortedEntries = Object.entries(tableValues)
72
- .sort(function (_a, _b) {
73
+ var sortedEntries = Object.entries(tableValues).sort(function (_a, _b) {
73
74
  var keyA = _a[0];
74
75
  var keyB = _b[0];
75
76
  var indexA = fieldOrder.indexOf(keyA);
@@ -78,6 +79,7 @@ export function TransactionTable(_a) {
78
79
  });
79
80
  return (_jsxs("div", { className: "relative w-full h-full bg-gray-100 dark:bg-gray-950 border border-gray-200 dark:border-gray-800 p-5 rounded-sm flex flex-col justify-center", children: [onClose && (_jsx("button", { onClick: onClose, className: "absolute top-3 right-2 text-gray-500 dark:text-gray-600 hover:text-gray-500 dark:hover:text-gray-300 transition-colors duration-200 focus:outline-none", "aria-label": "Close details", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-5 w-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })), _jsx("div", { className: "space-y-3 text-sm pt-5", children: sortedEntries.map(function (_a) {
80
81
  var key = _a[0], value = _a[1];
81
- return (_jsxs("div", { className: "flex items-center justify-between py-2 ", children: [_jsx("span", { className: "text-gray-500 dark:text-gray-400 font-medium min-w-[120px]", children: getLabel(key) }), _jsxs("div", { className: "relative transition-all duration-300 ".concat(value.visible ? 'opacity-100' : 'opacity-0', " max-w-[65%] text-right flex-1"), children: [(key === 'tx' || key === 'from') && getExplorerLink(key, value.text) ? (_jsxs("a", { href: getExplorerLink(key, value.text), target: "_blank", rel: "noopener noreferrer", className: "".concat(getValueStyles(key, value.text), " break-all inline-block group"), title: value.text, children: [_jsx("span", { className: 'underline hover:font-bold', children: getDisplayValue(key, value.text) }), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-3 w-3 ml-1 inline-block opacity-50 group-hover:opacity-100 transition-opacity duration-200", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) })] })) : (_jsx("span", { className: "".concat(getValueStyles(key, value.text), " break-all inline-block"), title: value.text, children: value.text })), value.typing && (_jsx("span", { className: "inline-block ml-1 w-[2px] h-[14px] bg-primary-500 dark:bg-primary-400 animate-pulse" }))] })] }, key));
82
+ return (_jsxs("div", { className: "flex items-center justify-between py-2 ", children: [_jsx("span", { className: "text-gray-500 dark:text-gray-400 font-medium min-w-[120px]", children: getLabel(key) }), _jsxs("div", { className: "relative transition-all duration-300 ".concat(value.visible ? 'opacity-100' : 'opacity-0', " max-w-[65%] text-right flex-1"), children: [(key === 'tx' || key === 'from') &&
83
+ getExplorerLink(key, value.text) ? (_jsxs("a", { href: getExplorerLink(key, value.text), target: "_blank", rel: "noopener noreferrer", className: "".concat(getValueStyles(key, value.text), " break-all inline-block group"), title: value.text, children: [_jsx("span", { className: "underline hover:font-bold", children: getDisplayValue(key, value.text) }), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-3 w-3 ml-1 inline-block opacity-50 group-hover:opacity-100 transition-opacity duration-200", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) })] })) : (_jsx("span", { className: "".concat(getValueStyles(key, value.text), " break-all inline-block"), title: value.text, children: value.text })), value.typing && (_jsx("span", { className: "inline-block ml-1 w-[2px] h-[14px] bg-primary-500 dark:bg-primary-400 animate-pulse" }))] })] }, key));
82
84
  }) })] }));
83
85
  }
@@ -65,9 +65,7 @@ export var STATE_TRANSITIONS = [
65
65
  {
66
66
  from: FlowState.CONNECTING_WALLET,
67
67
  to: FlowState.CHAIN_SELECTION,
68
- condition: function (context) {
69
- return context.walletType === 'solana';
70
- }, // If Solana wallet and no Nord account
68
+ condition: function (context) { return context.walletType === 'solana'; }, // If Solana wallet and no Nord account
71
69
  },
72
70
  {
73
71
  from: FlowState.CONNECTING_WALLET,
@@ -80,7 +78,9 @@ export var STATE_TRANSITIONS = [
80
78
  from: FlowState.CONNECTING_WALLET,
81
79
  to: FlowState.FINAL_SUCCESS,
82
80
  condition: function (context) {
83
- return context.walletType === 'solana' && context.hasNordAccount && context.hasActiveSession;
81
+ return context.walletType === 'solana' &&
82
+ context.hasNordAccount &&
83
+ context.hasActiveSession;
84
84
  }, // If Solana wallet and no Nord account
85
85
  },
86
86
  // From ETH_TO_SOL_AUTH state
@@ -37,11 +37,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  import { useCallback, useEffect, useState } from 'react';
38
38
  import { FlowState } from '../types';
39
39
  import { AVAILABLE_CHAINS } from '../constants';
40
- import { getExplorerUrl } from '../../../Logic/transactionManager';
41
- import { useN1WalletContext, useN1WalletInternalContext } from '../../../Provider/hooks';
40
+ import { getExplorerUrl, } from '../../../Logic/transactionManager';
41
+ import { useN1WalletContext, useN1WalletInternalContext, } from '../../../Provider/hooks';
42
42
  import { N1SessionMode } from '../../../Provider/types';
43
43
  import { isNordConfigured } from '../utils/nordUtils';
44
44
  import { useNordInstance } from './useNordInstance';
45
+ import { logger } from '../../../utils/logger';
45
46
  /**
46
47
  * Hook for handling the deposit flow
47
48
  *
@@ -124,7 +125,7 @@ export var useDepositFlow = function (options) {
124
125
  case 0:
125
126
  if (isDepositing)
126
127
  return [2 /*return*/];
127
- console.log("tah dah!");
128
+ logger.debug('tah dah!');
128
129
  // Validate input
129
130
  if (!selectedChain) {
130
131
  handleError(new Error('No chain selected'));
@@ -183,7 +184,7 @@ export var useDepositFlow = function (options) {
183
184
  if (!accountInitialized) {
184
185
  throw new Error('Account failed to intialize on N1.');
185
186
  }
186
- console.log('Deposit successful using Nord-TS', txId_1);
187
+ logger.debug('Deposit successful using Nord-TS', txId_1);
187
188
  // Make sure we have a valid chain ID
188
189
  if (selectedChain) {
189
190
  result = {
@@ -192,15 +193,17 @@ export var useDepositFlow = function (options) {
192
193
  amount: amount,
193
194
  tokenSymbol: 'USDC', // Default to USDC for now
194
195
  fromAddress: address || 'Your Wallet',
195
- toAddress: currentSessionMode === N1SessionMode.Nord ? 'Nord Account' : 'NTS Account',
196
+ toAddress: currentSessionMode === N1SessionMode.Nord
197
+ ? 'Exchange Account'
198
+ : 'NTS Account',
196
199
  networkName: ((_a = AVAILABLE_CHAINS.find(function (chain) { return chain.id === selectedChain; })) === null || _a === void 0 ? void 0 : _a.name) || selectedChain,
197
200
  status: 'Completed',
198
- explorerUrl: getExplorerUrl(txId_1, selectedChain)
201
+ explorerUrl: getExplorerUrl(txId_1, selectedChain),
199
202
  };
200
203
  // Update state with transaction result
201
204
  setTransactionId(txId_1);
202
205
  setTransactionResult(result);
203
- console.log("yayayyay");
206
+ logger.debug('yayayyay');
204
207
  setTxId(txId_1);
205
208
  return [2 /*return*/]; // Exit the function early since we've handled everything
206
209
  }
@@ -214,22 +217,22 @@ export var useDepositFlow = function (options) {
214
217
  case 11: return [3 /*break*/, 13];
215
218
  case 12:
216
219
  depositError_1 = _b.sent();
217
- console.warn('Error using depositSpl, falling back to mock implementation:', depositError_1);
220
+ logger.warn('Error using depositSpl, falling back to mock implementation:', depositError_1);
218
221
  setIsDepositing(false);
219
222
  return [3 /*break*/, 13];
220
223
  case 13: return [3 /*break*/, 15];
221
224
  case 14:
222
225
  error_1 = _b.sent();
223
- console.error('Error using Nord-TS for deposit:', error_1);
226
+ logger.error('Error using Nord-TS for deposit:', error_1);
224
227
  throw error_1;
225
228
  case 15: return [3 /*break*/, 17];
226
229
  case 16:
227
- console.log("Nord configuration issue:", {
230
+ logger.debug('Nord configuration issue:', {
228
231
  hasNord: !!nord,
229
232
  isConfigured: nord ? isNordConfigured(nord) : false,
230
233
  hasAddress: !!address,
231
234
  hasWalletSignFn: !!signMessageWithWalletKey,
232
- hasSessionSignFn: !!signMessageWithSessionKey
235
+ hasSessionSignFn: !!signMessageWithSessionKey,
233
236
  });
234
237
  throw new Error('Nord is not configured or user is not initialized');
235
238
  case 17: return [3 /*break*/, 19];
@@ -252,7 +255,7 @@ export var useDepositFlow = function (options) {
252
255
  nord,
253
256
  signMessageWithWalletKey,
254
257
  signMessageWithSessionKey,
255
- currentNordUser
258
+ currentNordUser,
256
259
  ]);
257
260
  /**
258
261
  * Complete the deposit process and move to the next screen
@@ -323,7 +326,9 @@ export var useDepositFlow = function (options) {
323
326
  // Ensure we have a valid session mode
324
327
  var currentSessionMode = sessionMode !== null && sessionMode !== void 0 ? sessionMode : N1SessionMode.NTS;
325
328
  // Determine account type based on session mode
326
- var accountType = currentSessionMode === N1SessionMode.Nord ? 'Nord Account' : 'NTS Account';
329
+ var accountType = currentSessionMode === N1SessionMode.Nord
330
+ ? 'Exchange Account'
331
+ : 'NTS Account';
327
332
  if (!transactionResult) {
328
333
  // If we don't have a transaction result yet, return default values
329
334
  return {
@@ -331,7 +336,9 @@ export var useDepositFlow = function (options) {
331
336
  tx: transactionId || 'Processing...',
332
337
  from: address || 'Your Wallet',
333
338
  to: accountType,
334
- network: selectedChain ? ((_a = AVAILABLE_CHAINS.find(function (chain) { return chain.id === selectedChain; })) === null || _a === void 0 ? void 0 : _a.name) || selectedChain : 'Unknown',
339
+ network: selectedChain
340
+ ? ((_a = AVAILABLE_CHAINS.find(function (chain) { return chain.id === selectedChain; })) === null || _a === void 0 ? void 0 : _a.name) || selectedChain
341
+ : 'Unknown',
335
342
  status: 'Processing',
336
343
  explorerUrl: '',
337
344
  };
@@ -344,9 +351,17 @@ export var useDepositFlow = function (options) {
344
351
  to: transactionResult.toAddress,
345
352
  network: transactionResult.networkName,
346
353
  status: transactionResult.status,
347
- explorerUrl: transactionResult.explorerUrl || getExplorerUrl(transactionResult.transactionId, selectedChain || ''),
354
+ explorerUrl: transactionResult.explorerUrl ||
355
+ getExplorerUrl(transactionResult.transactionId, selectedChain || ''),
348
356
  };
349
- }, [transactionResult, amount, transactionId, address, sessionMode, selectedChain]);
357
+ }, [
358
+ transactionResult,
359
+ amount,
360
+ transactionId,
361
+ address,
362
+ sessionMode,
363
+ selectedChain,
364
+ ]);
350
365
  return {
351
366
  selectedChain: selectedChain,
352
367
  setSelectedChain: setSelectedChain,