mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-05-06 04:17:56 +00:00
fix: TypeScript errors, shadow deprecations, and build configuration
- Fix shadow style deprecation warnings across components (boxShadow) - Add type declaration files (codec.d.ts, modules.d.ts) - Update metro.config.cjs for proper asset extensions - Update tsconfig.json with module resolution settings - Fix TypeScript errors in shared/lib files - Update app icons (optimized PNG files)
This commit is contained in:
@@ -52,7 +52,7 @@ const AuthScreen: React.FC = () => {
|
||||
setLoading(true);
|
||||
|
||||
try {
|
||||
const { error: signInError } = await signIn(loginEmail, loginPassword, rememberMe);
|
||||
const { error: signInError } = await signIn(loginEmail, loginPassword);
|
||||
|
||||
if (signInError) {
|
||||
if (signInError.message?.includes('Invalid login credentials')) {
|
||||
|
||||
@@ -411,7 +411,7 @@ const DashboardScreen: React.FC<DashboardScreenProps> = () => {
|
||||
{kycStatus === 'NotStarted' && (
|
||||
<TouchableOpacity
|
||||
style={styles.kycButton}
|
||||
onPress={() => navigation.navigate('BeCitizen')}
|
||||
onPress={() => navigation.navigate('BeCitizenChoice')}
|
||||
>
|
||||
<Text style={styles.kycButtonText}>Apply</Text>
|
||||
</TouchableOpacity>
|
||||
@@ -454,7 +454,7 @@ const DashboardScreen: React.FC<DashboardScreenProps> = () => {
|
||||
{renderAppIcon('Justice', '⚖️', () => showComingSoon('Dad / Justice'), true, true)}
|
||||
{renderAppIcon('Proposals', '📜', () => showComingSoon('Proposals'), true, true)}
|
||||
{renderAppIcon('Polls', '📊', () => showComingSoon('Public Polls'), true, true)}
|
||||
{renderAppIcon('Identity', '🆔', () => navigation.navigate('BeCitizen'), true)}
|
||||
{renderAppIcon('Identity', '🆔', () => navigation.navigate('BeCitizenChoice'), true)}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ export default function NFTGalleryScreen() {
|
||||
description: 'Official citizenship NFT of Digital Kurdistan. This NFT represents your verified status as a citizen of the Pezkuwi nation.',
|
||||
image: '🪪', // Will use emoji/icon for now
|
||||
rarity: 'legendary',
|
||||
mintDate: new Date(nftData?.mintedAt || Date.now()).toISOString(),
|
||||
mintDate: new Date((nftData?.mintedAt as number | string | undefined) || Date.now()).toISOString(),
|
||||
attributes: [
|
||||
{ trait: 'Type', value: 'Citizenship' },
|
||||
{ trait: 'Nation', value: 'Kurdistan' },
|
||||
|
||||
@@ -91,18 +91,18 @@ const PoolBrowserScreen: React.FC = () => {
|
||||
try {
|
||||
if (asset1 === 0) {
|
||||
// Native token (wHEZ)
|
||||
const balance1 = await api.query.system.account(poolAccount);
|
||||
const balance1 = await api.query.system.account(poolAccount) as any;
|
||||
reserve1 = balance1.data.free.toString();
|
||||
} else {
|
||||
const balance1 = await api.query.assets.account(asset1, poolAccount);
|
||||
const balance1 = await api.query.assets.account(asset1, poolAccount) as any;
|
||||
reserve1 = balance1.isSome ? balance1.unwrap().balance.toString() : '0';
|
||||
}
|
||||
|
||||
if (asset2 === 0) {
|
||||
const balance2 = await api.query.system.account(poolAccount);
|
||||
const balance2 = await api.query.system.account(poolAccount) as any;
|
||||
reserve2 = balance2.data.free.toString();
|
||||
} else {
|
||||
const balance2 = await api.query.assets.account(asset2, poolAccount);
|
||||
const balance2 = await api.query.assets.account(asset2, poolAccount) as any;
|
||||
reserve2 = balance2.isSome ? balance2.unwrap().balance.toString() : '0';
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@@ -18,7 +18,8 @@ import {
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import * as SecureStore from 'expo-secure-store';
|
||||
import { Clipboard } from 'react-native';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
import { useNavigation, NavigationProp } from '@react-navigation/native';
|
||||
import { RootStackParamList } from '../navigation/AppNavigator';
|
||||
import { KurdistanColors } from '../theme/colors';
|
||||
import { useTheme } from '../contexts/ThemeContext';
|
||||
import { useBiometricAuth } from '../contexts/BiometricAuthContext';
|
||||
@@ -152,7 +153,7 @@ const SettingToggle = ({
|
||||
// --- MAIN SCREEN ---
|
||||
|
||||
const SettingsScreen: React.FC = () => {
|
||||
const navigation = useNavigation();
|
||||
const navigation = useNavigation<NavigationProp<RootStackParamList>>();
|
||||
const { isDarkMode, toggleDarkMode, colors, fontSize, setFontSize } = useTheme();
|
||||
const { isBiometricEnabled, enableBiometric, disableBiometric, biometricType, autoLockTimer, setAutoLockTimer } = useBiometricAuth();
|
||||
const { signOut, user } = useAuth();
|
||||
|
||||
@@ -70,7 +70,7 @@ export default function StakingScreen() {
|
||||
const scores = await getAllScores(api, selectedAccount.address);
|
||||
|
||||
// 3. Get Current Era
|
||||
const currentEraOpt = await api.query.staking.currentEra();
|
||||
const currentEraOpt = await api.query.staking.currentEra() as any;
|
||||
const currentEra = currentEraOpt.unwrapOrDefault().toNumber();
|
||||
|
||||
// Calculations
|
||||
|
||||
@@ -78,10 +78,10 @@ const SwapScreen: React.FC = () => {
|
||||
// Fetch From Token Balance
|
||||
try {
|
||||
if (fromToken.symbol === 'HEZ') {
|
||||
const accountInfo = await api.query.system.account(selectedAccount.address);
|
||||
const accountInfo = await api.query.system.account(selectedAccount.address) as any;
|
||||
setFromBalance(accountInfo.data.free.toString());
|
||||
} else {
|
||||
const balanceData = await api.query.assets.account(fromToken.assetId, selectedAccount.address);
|
||||
const balanceData = await api.query.assets.account(fromToken.assetId, selectedAccount.address) as any;
|
||||
setFromBalance(balanceData.isSome ? balanceData.unwrap().balance.toString() : '0');
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -92,10 +92,10 @@ const SwapScreen: React.FC = () => {
|
||||
// Fetch To Token Balance
|
||||
try {
|
||||
if (toToken.symbol === 'HEZ') {
|
||||
const accountInfo = await api.query.system.account(selectedAccount.address);
|
||||
const accountInfo = await api.query.system.account(selectedAccount.address) as any;
|
||||
setToBalance(accountInfo.data.free.toString());
|
||||
} else {
|
||||
const balanceData = await api.query.assets.account(toToken.assetId, selectedAccount.address);
|
||||
const balanceData = await api.query.assets.account(toToken.assetId, selectedAccount.address) as any;
|
||||
setToBalance(balanceData.isSome ? balanceData.unwrap().balance.toString() : '0');
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@@ -205,13 +205,13 @@ const WalletScreen: React.FC = () => {
|
||||
accountId = selectedAccount.address as any;
|
||||
}
|
||||
|
||||
const accountInfo = await api.query.system.account(accountId);
|
||||
const accountInfo = await api.query.system.account(accountId) as any;
|
||||
const hezBalance = (Number(accountInfo.data.free.toString()) / 1e12).toFixed(2);
|
||||
|
||||
let pezBalance = '0.00';
|
||||
try {
|
||||
if (api.query.assets?.account) {
|
||||
const pezAsset = await api.query.assets.account(1, accountId);
|
||||
const pezAsset = await api.query.assets.account(1, accountId) as any;
|
||||
if (pezAsset.isSome) pezBalance = (Number(pezAsset.unwrap().balance.toString()) / 1e12).toFixed(2);
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -222,9 +222,9 @@ const WalletScreen: React.FC = () => {
|
||||
try {
|
||||
if (api.query.assets?.account) {
|
||||
// Check ID 1000 first (as per constants), fallback to 2 just in case
|
||||
let usdtAsset = await api.query.assets.account(1000, accountId);
|
||||
let usdtAsset = await api.query.assets.account(1000, accountId) as any;
|
||||
if (usdtAsset.isNone) {
|
||||
usdtAsset = await api.query.assets.account(2, accountId);
|
||||
usdtAsset = await api.query.assets.account(2, accountId) as any;
|
||||
}
|
||||
|
||||
if (usdtAsset.isSome) {
|
||||
|
||||
@@ -114,7 +114,7 @@ const DelegationScreen: React.FC = () => {
|
||||
|
||||
// Fetch user's delegations
|
||||
if (selectedAccount) {
|
||||
const userVoting = await api.query.democracy.voting(selectedAccount.address);
|
||||
const userVoting = await api.query.democracy.voting(selectedAccount.address) as any;
|
||||
if (userVoting.isDelegating) {
|
||||
const delegating = userVoting.asDelegating;
|
||||
setUserDelegations([{
|
||||
|
||||
@@ -47,12 +47,12 @@ const ElectionsScreen: React.FC = () => {
|
||||
|
||||
// Fetch commission proposals (acting as elections)
|
||||
if (api.query.dynamicCommissionCollective?.proposals) {
|
||||
const proposalHashes = await api.query.dynamicCommissionCollective.proposals();
|
||||
const proposalHashes = await api.query.dynamicCommissionCollective.proposals() as any;
|
||||
|
||||
const electionsData: ElectionInfo[] = [];
|
||||
|
||||
for (const hash of proposalHashes) {
|
||||
const voting = await api.query.dynamicCommissionCollective.voting(hash);
|
||||
for (const hash of (proposalHashes || [])) {
|
||||
const voting = await api.query.dynamicCommissionCollective.voting(hash) as any;
|
||||
if (voting.isSome) {
|
||||
const voteData = voting.unwrap();
|
||||
electionsData.push({
|
||||
|
||||
@@ -111,7 +111,7 @@ const ForumScreen: React.FC = () => {
|
||||
};
|
||||
|
||||
const getCategoryById = (categoryId: string): Category | undefined => {
|
||||
return CATEGORIES.find(c => c.id === categoryId);
|
||||
return categories.find((c: Category) => c.id === categoryId);
|
||||
};
|
||||
|
||||
const getTimeAgo = (dateString: string): string => {
|
||||
@@ -209,7 +209,7 @@ const ForumScreen: React.FC = () => {
|
||||
📋 All Topics
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
{CATEGORIES.map((category) => (
|
||||
{categories.map((category) => (
|
||||
<TouchableOpacity
|
||||
key={category.id}
|
||||
style={[
|
||||
|
||||
Reference in New Issue
Block a user