mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-06-12 20:11:03 +00:00
fix: resolve all lint warnings in mobile and web apps
This commit is contained in:
@@ -64,7 +64,7 @@ const PezkuwiWebView: React.FC<PezkuwiWebViewProps> = ({
|
|||||||
if (session?.access_token) {
|
if (session?.access_token) {
|
||||||
setSessionToken(session.access_token);
|
setSessionToken(session.access_token);
|
||||||
setRefreshToken(session.refresh_token || null);
|
setRefreshToken(session.refresh_token || null);
|
||||||
if (__DEV__) console.log('[WebView] Session token retrieved for SSO');
|
if (__DEV__) console.warn('[WebView] Session token retrieved for SSO');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (__DEV__) console.warn('[WebView] Failed to get session:', error);
|
if (__DEV__) console.warn('[WebView] Failed to get session:', error);
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ export const ENV: EnvConfig = {
|
|||||||
|
|
||||||
// Log environment on startup (dev only)
|
// Log environment on startup (dev only)
|
||||||
if (ENV.isDevelopment && ENV.debug) {
|
if (ENV.isDevelopment && ENV.debug) {
|
||||||
console.log('🔧 Environment Config:', {
|
console.warn('[ENV] Environment Config:', {
|
||||||
env: ENV.env,
|
env: ENV.env,
|
||||||
network: ENV.network,
|
network: ENV.network,
|
||||||
wsEndpoint: ENV.wsEndpoint,
|
wsEndpoint: ENV.wsEndpoint,
|
||||||
|
|||||||
@@ -158,15 +158,15 @@ export const PezkuwiProvider: React.FC<PezkuwiProviderProps> = ({ children }) =>
|
|||||||
|
|
||||||
const initApi = async () => {
|
const initApi = async () => {
|
||||||
try {
|
try {
|
||||||
console.log('🔗 [Pezkuwi] Starting API initialization...');
|
if (__DEV__) console.warn('[Pezkuwi] Starting API initialization...');
|
||||||
setIsApiReady(false);
|
setIsApiReady(false);
|
||||||
setError(null); // Clear previous errors
|
setError(null); // Clear previous errors
|
||||||
|
|
||||||
const networkConfig = NETWORKS[currentNetwork];
|
const networkConfig = NETWORKS[currentNetwork];
|
||||||
console.log(`🌐 [Pezkuwi] Connecting to ${networkConfig.displayName} at ${networkConfig.rpcEndpoint}`);
|
if (__DEV__) console.warn(`[Pezkuwi] Connecting to ${networkConfig.displayName} at ${networkConfig.rpcEndpoint}`);
|
||||||
|
|
||||||
const provider = new WsProvider(networkConfig.rpcEndpoint);
|
const provider = new WsProvider(networkConfig.rpcEndpoint);
|
||||||
console.log('📡 [Pezkuwi] WsProvider created, creating API...');
|
if (__DEV__) console.warn('[Pezkuwi] WsProvider created, creating API...');
|
||||||
const newApi = await ApiPromise.create({ provider });
|
const newApi = await ApiPromise.create({ provider });
|
||||||
|
|
||||||
// Set SS58 format for address encoding/decoding
|
// Set SS58 format for address encoding/decoding
|
||||||
@@ -175,13 +175,13 @@ export const PezkuwiProvider: React.FC<PezkuwiProviderProps> = ({ children }) =>
|
|||||||
ss58Format: networkConfig.ss58Format,
|
ss58Format: networkConfig.ss58Format,
|
||||||
}) as unknown as Parameters<typeof newApi.registry.setChainProperties>[0]
|
}) as unknown as Parameters<typeof newApi.registry.setChainProperties>[0]
|
||||||
);
|
);
|
||||||
console.log(`✅ [Pezkuwi] API created with SS58 format: ${networkConfig.ss58Format}`);
|
if (__DEV__) console.warn(`[Pezkuwi] API created with SS58 format: ${networkConfig.ss58Format}`);
|
||||||
|
|
||||||
if (isSubscribed) {
|
if (isSubscribed) {
|
||||||
setApi(newApi);
|
setApi(newApi);
|
||||||
setIsApiReady(true);
|
setIsApiReady(true);
|
||||||
setError(null); // Clear any previous errors
|
setError(null); // Clear any previous errors
|
||||||
console.log('✅ [Pezkuwi] Connected to', networkConfig.displayName);
|
if (__DEV__) console.warn('[Pezkuwi] Connected to', networkConfig.displayName);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('❌ [Pezkuwi] Failed to connect to blockchain:', err);
|
console.error('❌ [Pezkuwi] Failed to connect to blockchain:', err);
|
||||||
@@ -193,10 +193,10 @@ export const PezkuwiProvider: React.FC<PezkuwiProviderProps> = ({ children }) =>
|
|||||||
setApi(null); // ✅ FIX: Clear API on error
|
setApi(null); // ✅ FIX: Clear API on error
|
||||||
|
|
||||||
// Retry connection after 5 seconds
|
// Retry connection after 5 seconds
|
||||||
console.log('🔄 [Pezkuwi] Will retry connection in 5 seconds...');
|
if (__DEV__) console.warn('[Pezkuwi] Will retry connection in 5 seconds...');
|
||||||
retryTimeout = setTimeout(() => {
|
retryTimeout = setTimeout(() => {
|
||||||
if (isSubscribed) {
|
if (isSubscribed) {
|
||||||
console.log('🔄 [Pezkuwi] Retrying blockchain connection...');
|
if (__DEV__) console.warn('[Pezkuwi] Retrying blockchain connection...');
|
||||||
initApi();
|
initApi();
|
||||||
}
|
}
|
||||||
}, 5000);
|
}, 5000);
|
||||||
@@ -216,6 +216,7 @@ export const PezkuwiProvider: React.FC<PezkuwiProviderProps> = ({ children }) =>
|
|||||||
api.disconnect();
|
api.disconnect();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [currentNetwork]);
|
}, [currentNetwork]);
|
||||||
|
|
||||||
// Initialize crypto and keyring
|
// Initialize crypto and keyring
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ export const LPStakingModal: React.FC<LPStakingModalProps> = ({ isOpen, onClose
|
|||||||
};
|
};
|
||||||
|
|
||||||
fetchPools();
|
fetchPools();
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [assetHubApi, isAssetHubReady, isOpen, selectedAccount, selectedPool]);
|
}, [assetHubApi, isAssetHubReady, isOpen, selectedAccount, selectedPool]);
|
||||||
|
|
||||||
const formatAmount = (amount: string, decimals: number = 12): string => {
|
const formatAmount = (amount: string, decimals: number = 12): string => {
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ export function DisputeResolutionPanel() {
|
|||||||
return () => {
|
return () => {
|
||||||
supabase.removeChannel(channel);
|
supabase.removeChannel(channel);
|
||||||
};
|
};
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Filter disputes by status
|
// Filter disputes by status
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ export const XCMBridgeSetupModal: React.FC<XCMBridgeSetupModalProps> = ({
|
|||||||
setErrorMessage(error instanceof Error ? error.message : 'Status check failed');
|
setErrorMessage(error instanceof Error ? error.message : 'Status check failed');
|
||||||
setStep('error');
|
setStep('error');
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [assetHubApi, isAssetHubReady]);
|
}, [assetHubApi, isAssetHubReady]);
|
||||||
|
|
||||||
// Reset when modal opens/closes
|
// Reset when modal opens/closes
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ export function CourseList({ enrolledCourseIds, onEnroll }: CourseListProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fetchCourses();
|
fetchCourses();
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleEnroll = async (courseId: number) => {
|
const handleEnroll = async (courseId: number) => {
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ export const StakingDashboard: React.FC = () => {
|
|||||||
fetchStakingData();
|
fetchStakingData();
|
||||||
const interval = setInterval(fetchStakingData, 30000); // Refresh every 30s
|
const interval = setInterval(fetchStakingData, 30000); // Refresh every 30s
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [assetHubApi, peopleApi, isAssetHubReady, isPeopleReady, selectedAccount]);
|
}, [assetHubApi, peopleApi, isAssetHubReady, isPeopleReady, selectedAccount]);
|
||||||
|
|
||||||
// Fetch PEZ rewards data separately from People Chain
|
// Fetch PEZ rewards data separately from People Chain
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ export function ValidatorPoolDashboard() {
|
|||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [api, selectedAccount]);
|
}, [api, selectedAccount]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export default function EmailVerification() {
|
|||||||
} else if (token) {
|
} else if (token) {
|
||||||
verifyEmail(token);
|
verifyEmail(token);
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [token, type]);
|
}, [token, type]);
|
||||||
|
|
||||||
const verifyEmail = async (verifyToken: string) => {
|
const verifyEmail = async (verifyToken: string) => {
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ export default function P2PDispute() {
|
|||||||
return () => {
|
return () => {
|
||||||
supabase.removeChannel(channel);
|
supabase.removeChannel(channel);
|
||||||
};
|
};
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [disputeId]);
|
}, [disputeId]);
|
||||||
|
|
||||||
const handleFileUpload = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleFileUpload = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ export default function P2PTrade() {
|
|||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [tradeId]);
|
}, [tradeId]);
|
||||||
|
|
||||||
// Initial fetch
|
// Initial fetch
|
||||||
@@ -213,6 +214,7 @@ export default function P2PTrade() {
|
|||||||
updateTimer();
|
updateTimer();
|
||||||
const interval = setInterval(updateTimer, 1000);
|
const interval = setInterval(updateTimer, 1000);
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [trade?.payment_deadline, trade?.status]);
|
}, [trade?.payment_deadline, trade?.status]);
|
||||||
|
|
||||||
// Format time remaining
|
// Format time remaining
|
||||||
|
|||||||
Reference in New Issue
Block a user