@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.
- 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 +27 -22
- 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 +9 -4
- package/dist/Modal/NordFlow/hooks/useDepositFlow.js +39 -18
- 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 +4 -1
- package/dist/Modal/NordFlow/screens/04-AmountInputScreen.js +38 -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 +4 -1
- package/dist/Modal/NordFlow/types.js +1 -0
- 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 +11 -5
- 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
|
@@ -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', {
|
|
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 =
|
|
123
|
-
|
|
124
|
-
|
|
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', {
|
|
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
|
package/dist/Logic/utils.js
CHANGED
|
@@ -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
|
|
109
|
-
return __generator(this, function (
|
|
110
|
-
switch (
|
|
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 =
|
|
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 =
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
|
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 ({
|
|
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 ({
|
|
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 &&
|
|
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
|
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
91
|
+
logger.debug("Attempting transition to ".concat(newState), contextUpdates);
|
|
91
92
|
var result = transition(newState, contextUpdates);
|
|
92
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 &&
|
|
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
|
|
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
|
|
@@ -218,9 +223,9 @@ export var NordFlow = function (_a) {
|
|
|
218
223
|
case FlowState.ETH_TO_SOL_AUTH:
|
|
219
224
|
return (_jsx(EnhancedEvmWalletAuthScreen, { onAuth: function () { return transition(FlowState.CHAIN_SELECTION); } }));
|
|
220
225
|
case FlowState.AMOUNT_INPUT:
|
|
221
|
-
return (_jsx(EnhancedAmountInputScreen, { amount: amount, onAmountChange: updateAmount, onContinue: startDeposit, balance: getUsdcBalance(), faucetUrl: faucetUrl, refreshBalance: refreshBalance }));
|
|
226
|
+
return (_jsx(EnhancedAmountInputScreen, { amount: amount, onAmountChange: updateAmount, onContinue: startDeposit, balance: getUsdcBalance(), faucetUrl: faucetUrl, refreshBalance: refreshBalance, depositError: context.depositError }));
|
|
222
227
|
case FlowState.DEPOSIT_PROGRESS:
|
|
223
|
-
return
|
|
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
|
|
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 =
|
|
11
|
-
var enabledClasses =
|
|
12
|
-
var disabledClasses =
|
|
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
|
-
?
|
|
16
|
-
:
|
|
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
|
-
?
|
|
19
|
-
:
|
|
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') ||
|
|
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') ||
|
|
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') &&
|
|
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' &&
|
|
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
|
|
@@ -134,6 +134,11 @@ export var STATE_TRANSITIONS = [
|
|
|
134
134
|
to: FlowState.ERROR,
|
|
135
135
|
// When deposit fails
|
|
136
136
|
},
|
|
137
|
+
{
|
|
138
|
+
from: FlowState.DEPOSIT_PROGRESS,
|
|
139
|
+
to: FlowState.AMOUNT_INPUT,
|
|
140
|
+
// When deposit fails but we want to allow retry
|
|
141
|
+
},
|
|
137
142
|
// From DEPOSIT_SUCCESS state
|
|
138
143
|
{
|
|
139
144
|
from: FlowState.DEPOSIT_SUCCESS,
|