mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 02:07:55 +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:
Binary file not shown.
|
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 263 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 263 KiB |
@@ -23,22 +23,23 @@ const projectRoot = __dirname;
|
|||||||
// FILE EXTENSIONS
|
// FILE EXTENSIONS
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|
||||||
|
// Extend default extensions instead of replacing them
|
||||||
config.resolver.sourceExts = [
|
config.resolver.sourceExts = [
|
||||||
|
...config.resolver.sourceExts,
|
||||||
'expo.ts',
|
'expo.ts',
|
||||||
'expo.tsx',
|
'expo.tsx',
|
||||||
'expo.js',
|
'expo.js',
|
||||||
'expo.jsx',
|
'expo.jsx',
|
||||||
'ts',
|
|
||||||
'tsx',
|
|
||||||
'js',
|
|
||||||
'jsx',
|
|
||||||
'json',
|
|
||||||
'wasm',
|
'wasm',
|
||||||
'svg',
|
|
||||||
'cjs',
|
|
||||||
'mjs',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// SVG should be handled as source file for react-native-svg transformer
|
||||||
|
// Remove svg from assetExts if present, add to sourceExts
|
||||||
|
config.resolver.assetExts = config.resolver.assetExts.filter(ext => ext !== 'svg');
|
||||||
|
if (!config.resolver.sourceExts.includes('svg')) {
|
||||||
|
config.resolver.sourceExts.push('svg');
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
// NODE POLYFILLS
|
// NODE POLYFILLS
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|||||||
+8
-3
@@ -38,7 +38,7 @@
|
|||||||
"@pezkuwi/util": "14.0.11",
|
"@pezkuwi/util": "14.0.11",
|
||||||
"@pezkuwi/util-crypto": "14.0.11",
|
"@pezkuwi/util-crypto": "14.0.11",
|
||||||
"@react-native-async-storage/async-storage": "^2.2.0",
|
"@react-native-async-storage/async-storage": "^2.2.0",
|
||||||
"@react-native-picker/picker": "^2.9.2",
|
"@react-native-picker/picker": "2.11.1",
|
||||||
"@react-navigation/bottom-tabs": "^7.8.5",
|
"@react-navigation/bottom-tabs": "^7.8.5",
|
||||||
"@react-navigation/native": "^7.1.20",
|
"@react-navigation/native": "^7.1.20",
|
||||||
"@react-navigation/stack": "^7.6.4",
|
"@react-navigation/stack": "^7.6.4",
|
||||||
@@ -88,9 +88,9 @@
|
|||||||
"@pezkuwi/util-crypto": "14.0.11"
|
"@pezkuwi/util-crypto": "14.0.11"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@expo/ngrok": "^4.1.0",
|
||||||
"@pezkuwi/extension-dapp": "0.62.14",
|
"@pezkuwi/extension-dapp": "0.62.14",
|
||||||
"@pezkuwi/extension-inject": "0.62.14",
|
"@pezkuwi/extension-inject": "0.62.14",
|
||||||
"@expo/ngrok": "^4.1.0",
|
|
||||||
"@testing-library/jest-native": "^5.4.3",
|
"@testing-library/jest-native": "^5.4.3",
|
||||||
"@testing-library/react-native": "^13.3.3",
|
"@testing-library/react-native": "^13.3.3",
|
||||||
"@types/invariant": "^2",
|
"@types/invariant": "^2",
|
||||||
@@ -110,5 +110,10 @@
|
|||||||
"typescript": "~5.9.2",
|
"typescript": "~5.9.2",
|
||||||
"typescript-eslint": "^8.47.0"
|
"typescript-eslint": "^8.47.0"
|
||||||
},
|
},
|
||||||
"private": true
|
"private": true,
|
||||||
|
"expo": {
|
||||||
|
"install": {
|
||||||
|
"exclude": ["@types/react"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,12 @@ export const Card: React.FC<CardProps> = ({
|
|||||||
testID={testID}
|
testID={testID}
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
style={({ pressed }) => [
|
style={({ pressed }) => [
|
||||||
...cardStyle,
|
styles.card,
|
||||||
|
variant === 'elevated' && styles.elevated,
|
||||||
|
variant === 'outlined' && styles.outlined,
|
||||||
|
variant === 'filled' && styles.filled,
|
||||||
|
elevation ? { elevation } : null,
|
||||||
|
style,
|
||||||
pressed && styles.pressed,
|
pressed && styles.pressed,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -56,7 +61,7 @@ export const Card: React.FC<CardProps> = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return <View testID={testID} style={cardStyle}>{content}</View>;
|
return <View testID={testID} style={cardStyle as any}>{content}</View>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ const ChangePasswordModal: React.FC<ChangePasswordModalProps> = ({
|
|||||||
{
|
{
|
||||||
text: 'Send Reset Link',
|
text: 'Send Reset Link',
|
||||||
onPress: async () => {
|
onPress: async () => {
|
||||||
const { error } = await resetPassword(user.email);
|
const { error } = await resetPassword(user.email!);
|
||||||
if (error) {
|
if (error) {
|
||||||
Alert.alert('Error', error.message || 'Failed to send reset email');
|
Alert.alert('Error', error.message || 'Failed to send reset email');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ interface InputProps extends TextInputProps {
|
|||||||
leftIcon?: React.ReactNode;
|
leftIcon?: React.ReactNode;
|
||||||
rightIcon?: React.ReactNode;
|
rightIcon?: React.ReactNode;
|
||||||
onRightIconPress?: () => void;
|
onRightIconPress?: () => void;
|
||||||
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,6 +31,7 @@ export const Input: React.FC<InputProps> = ({
|
|||||||
rightIcon,
|
rightIcon,
|
||||||
onRightIconPress,
|
onRightIconPress,
|
||||||
style,
|
style,
|
||||||
|
disabled,
|
||||||
...props
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
const [isFocused, setIsFocused] = useState(false);
|
const [isFocused, setIsFocused] = useState(false);
|
||||||
@@ -58,8 +60,8 @@ export const Input: React.FC<InputProps> = ({
|
|||||||
{leftIcon && <View style={styles.leftIcon}>{leftIcon}</View>}
|
{leftIcon && <View style={styles.leftIcon}>{leftIcon}</View>}
|
||||||
<TextInput
|
<TextInput
|
||||||
{...props}
|
{...props}
|
||||||
editable={props.editable !== undefined ? props.editable : !props.disabled}
|
editable={props.editable !== undefined ? props.editable : !disabled}
|
||||||
style={[styles.input, leftIcon && styles.inputWithLeftIcon, style]}
|
style={[styles.input, leftIcon && styles.inputWithLeftIcon, style] as any}
|
||||||
onFocus={(e) => {
|
onFocus={(e) => {
|
||||||
setIsFocused(true);
|
setIsFocused(true);
|
||||||
props.onFocus?.(e);
|
props.onFocus?.(e);
|
||||||
@@ -94,7 +96,6 @@ const styles = StyleSheet.create({
|
|||||||
fontWeight: '500',
|
fontWeight: '500',
|
||||||
color: AppColors.textSecondary,
|
color: AppColors.textSecondary,
|
||||||
marginBottom: 8,
|
marginBottom: 8,
|
||||||
transition: 'all 0.2s',
|
|
||||||
},
|
},
|
||||||
labelFocused: {
|
labelFocused: {
|
||||||
color: KurdistanColors.kesk,
|
color: KurdistanColors.kesk,
|
||||||
@@ -115,7 +116,6 @@ const styles = StyleSheet.create({
|
|||||||
inputContainerFocused: {
|
inputContainerFocused: {
|
||||||
borderColor: KurdistanColors.kesk,
|
borderColor: KurdistanColors.kesk,
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
boxShadow: '0px 2px 4px rgba(0, 128, 0, 0.1)',
|
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
},
|
},
|
||||||
inputContainerError: {
|
inputContainerError: {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export const Skeleton: React.FC<SkeletonProps> = ({
|
|||||||
<Animated.View
|
<Animated.View
|
||||||
style={[
|
style={[
|
||||||
styles.skeleton,
|
styles.skeleton,
|
||||||
{ width, height, borderRadius, opacity },
|
{ width, height, borderRadius, opacity } as any,
|
||||||
style,
|
style,
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -56,11 +56,11 @@ export function ValidatorSelectionSheet({
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Fallback to general staking validators if validatorPool pallet is not found/used
|
// Fallback to general staking validators if validatorPool pallet is not found/used
|
||||||
const rawStakingValidators = await api.query.staking.validators();
|
const rawStakingValidators = await api.query.staking.validators() as any;
|
||||||
for (const validatorAddress of rawStakingValidators.keys) {
|
for (const validatorAddress of (rawStakingValidators.keys || [])) {
|
||||||
const address = validatorAddress.args[0].toString();
|
const address = validatorAddress.args[0].toString();
|
||||||
// Fetch more details about each validator if needed, e.g., commission, total stake
|
// Fetch more details about each validator if needed, e.g., commission, total stake
|
||||||
const validatorPrefs = await api.query.staking.validators(address);
|
const validatorPrefs = await api.query.staking.validators(address) as any;
|
||||||
const commission = validatorPrefs.commission.toNumber() / 10_000_000; // Assuming 10^7 for percentage
|
const commission = validatorPrefs.commission.toNumber() / 10_000_000; // Assuming 10^7 for percentage
|
||||||
|
|
||||||
// For simplicity, total stake and nominators are placeholders for now
|
// For simplicity, total stake and nominators are placeholders for now
|
||||||
|
|||||||
@@ -3,11 +3,16 @@ import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
|
|||||||
import { LinearGradient } from 'expo-linear-gradient';
|
import { LinearGradient } from 'expo-linear-gradient';
|
||||||
import { KurdistanColors } from '../../theme/colors';
|
import { KurdistanColors } from '../../theme/colors';
|
||||||
import type { StackHeaderProps } from '@react-navigation/stack';
|
import type { StackHeaderProps } from '@react-navigation/stack';
|
||||||
|
import type { BottomTabHeaderProps } from '@react-navigation/bottom-tabs';
|
||||||
|
|
||||||
interface GradientHeaderProps extends StackHeaderProps {
|
type HeaderPropsBase = StackHeaderProps | BottomTabHeaderProps;
|
||||||
|
|
||||||
|
interface GradientHeaderProps extends Omit<HeaderPropsBase, 'progress' | 'styleInterpolator'> {
|
||||||
subtitle?: string;
|
subtitle?: string;
|
||||||
rightButtons?: React.ReactNode;
|
rightButtons?: React.ReactNode;
|
||||||
gradientColors?: [string, string];
|
gradientColors?: [string, string];
|
||||||
|
progress?: unknown;
|
||||||
|
styleInterpolator?: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GradientHeader: React.FC<GradientHeaderProps> = ({
|
export const GradientHeader: React.FC<GradientHeaderProps> = ({
|
||||||
@@ -18,11 +23,12 @@ export const GradientHeader: React.FC<GradientHeaderProps> = ({
|
|||||||
rightButtons,
|
rightButtons,
|
||||||
gradientColors = [KurdistanColors.kesk, '#008f43'],
|
gradientColors = [KurdistanColors.kesk, '#008f43'],
|
||||||
}) => {
|
}) => {
|
||||||
const title = options.headerTitle !== undefined
|
const getTitle = () => {
|
||||||
? options.headerTitle
|
if (typeof options.headerTitle === 'string') return options.headerTitle;
|
||||||
: options.title !== undefined
|
if (typeof options.title === 'string') return options.title;
|
||||||
? options.title
|
return route.name;
|
||||||
: route.name;
|
};
|
||||||
|
const title = getTitle();
|
||||||
|
|
||||||
const canGoBack = navigation.canGoBack();
|
const canGoBack = navigation.canGoBack();
|
||||||
|
|
||||||
@@ -51,8 +57,10 @@ export const GradientHeader: React.FC<GradientHeaderProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface SimpleHeaderProps extends StackHeaderProps {
|
interface SimpleHeaderProps extends Omit<HeaderPropsBase, 'progress' | 'styleInterpolator'> {
|
||||||
rightButtons?: React.ReactNode;
|
rightButtons?: React.ReactNode;
|
||||||
|
progress?: unknown;
|
||||||
|
styleInterpolator?: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SimpleHeader: React.FC<SimpleHeaderProps> = ({
|
export const SimpleHeader: React.FC<SimpleHeaderProps> = ({
|
||||||
@@ -61,11 +69,12 @@ export const SimpleHeader: React.FC<SimpleHeaderProps> = ({
|
|||||||
route,
|
route,
|
||||||
rightButtons,
|
rightButtons,
|
||||||
}) => {
|
}) => {
|
||||||
const title = options.headerTitle !== undefined
|
const getTitle = () => {
|
||||||
? options.headerTitle
|
if (typeof options.headerTitle === 'string') return options.headerTitle;
|
||||||
: options.title !== undefined
|
if (typeof options.title === 'string') return options.title;
|
||||||
? options.title
|
return route.name;
|
||||||
: route.name;
|
};
|
||||||
|
const title = getTitle();
|
||||||
|
|
||||||
const canGoBack = navigation.canGoBack();
|
const canGoBack = navigation.canGoBack();
|
||||||
|
|
||||||
@@ -104,8 +113,10 @@ export const BackButton: React.FC<{ onPress?: () => void; color?: string }> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface AppBarHeaderProps extends StackHeaderProps {
|
interface AppBarHeaderProps extends Omit<HeaderPropsBase, 'progress' | 'styleInterpolator'> {
|
||||||
rightButtons?: React.ReactNode;
|
rightButtons?: React.ReactNode;
|
||||||
|
progress?: unknown;
|
||||||
|
styleInterpolator?: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AppBarHeader: React.FC<AppBarHeaderProps> = ({
|
export const AppBarHeader: React.FC<AppBarHeaderProps> = ({
|
||||||
@@ -114,11 +125,12 @@ export const AppBarHeader: React.FC<AppBarHeaderProps> = ({
|
|||||||
route,
|
route,
|
||||||
rightButtons,
|
rightButtons,
|
||||||
}) => {
|
}) => {
|
||||||
const title = options.headerTitle !== undefined
|
const getTitle = () => {
|
||||||
? options.headerTitle
|
if (typeof options.headerTitle === 'string') return options.headerTitle;
|
||||||
: options.title !== undefined
|
if (typeof options.title === 'string') return options.title;
|
||||||
? options.title
|
return route.name;
|
||||||
: route.name;
|
};
|
||||||
|
const title = getTitle();
|
||||||
|
|
||||||
const canGoBack = navigation.canGoBack();
|
const canGoBack = navigation.canGoBack();
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ export const PezkuwiProvider: React.FC<PezkuwiProviderProps> = ({ children }) =>
|
|||||||
newApi.registry.setChainProperties(
|
newApi.registry.setChainProperties(
|
||||||
newApi.registry.createType('ChainProperties', {
|
newApi.registry.createType('ChainProperties', {
|
||||||
ss58Format: networkConfig.ss58Format,
|
ss58Format: networkConfig.ss58Format,
|
||||||
})
|
}) as any
|
||||||
);
|
);
|
||||||
console.log(`✅ [Pezkuwi] API created with SS58 format: ${networkConfig.ss58Format}`);
|
console.log(`✅ [Pezkuwi] API created with SS58 format: ${networkConfig.ss58Format}`);
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ const AuthScreen: React.FC = () => {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { error: signInError } = await signIn(loginEmail, loginPassword, rememberMe);
|
const { error: signInError } = await signIn(loginEmail, loginPassword);
|
||||||
|
|
||||||
if (signInError) {
|
if (signInError) {
|
||||||
if (signInError.message?.includes('Invalid login credentials')) {
|
if (signInError.message?.includes('Invalid login credentials')) {
|
||||||
|
|||||||
@@ -411,7 +411,7 @@ const DashboardScreen: React.FC<DashboardScreenProps> = () => {
|
|||||||
{kycStatus === 'NotStarted' && (
|
{kycStatus === 'NotStarted' && (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={styles.kycButton}
|
style={styles.kycButton}
|
||||||
onPress={() => navigation.navigate('BeCitizen')}
|
onPress={() => navigation.navigate('BeCitizenChoice')}
|
||||||
>
|
>
|
||||||
<Text style={styles.kycButtonText}>Apply</Text>
|
<Text style={styles.kycButtonText}>Apply</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
@@ -454,7 +454,7 @@ const DashboardScreen: React.FC<DashboardScreenProps> = () => {
|
|||||||
{renderAppIcon('Justice', '⚖️', () => showComingSoon('Dad / Justice'), true, true)}
|
{renderAppIcon('Justice', '⚖️', () => showComingSoon('Dad / Justice'), true, true)}
|
||||||
{renderAppIcon('Proposals', '📜', () => showComingSoon('Proposals'), true, true)}
|
{renderAppIcon('Proposals', '📜', () => showComingSoon('Proposals'), true, true)}
|
||||||
{renderAppIcon('Polls', '📊', () => showComingSoon('Public Polls'), true, true)}
|
{renderAppIcon('Polls', '📊', () => showComingSoon('Public Polls'), true, true)}
|
||||||
{renderAppIcon('Identity', '🆔', () => navigation.navigate('BeCitizen'), true)}
|
{renderAppIcon('Identity', '🆔', () => navigation.navigate('BeCitizenChoice'), true)}
|
||||||
</View>
|
</View>
|
||||||
</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.',
|
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
|
image: '🪪', // Will use emoji/icon for now
|
||||||
rarity: 'legendary',
|
rarity: 'legendary',
|
||||||
mintDate: new Date(nftData?.mintedAt || Date.now()).toISOString(),
|
mintDate: new Date((nftData?.mintedAt as number | string | undefined) || Date.now()).toISOString(),
|
||||||
attributes: [
|
attributes: [
|
||||||
{ trait: 'Type', value: 'Citizenship' },
|
{ trait: 'Type', value: 'Citizenship' },
|
||||||
{ trait: 'Nation', value: 'Kurdistan' },
|
{ trait: 'Nation', value: 'Kurdistan' },
|
||||||
|
|||||||
@@ -91,18 +91,18 @@ const PoolBrowserScreen: React.FC = () => {
|
|||||||
try {
|
try {
|
||||||
if (asset1 === 0) {
|
if (asset1 === 0) {
|
||||||
// Native token (wHEZ)
|
// 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();
|
reserve1 = balance1.data.free.toString();
|
||||||
} else {
|
} 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';
|
reserve1 = balance1.isSome ? balance1.unwrap().balance.toString() : '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset2 === 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();
|
reserve2 = balance2.data.free.toString();
|
||||||
} else {
|
} 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';
|
reserve2 = balance2.isSome ? balance2.unwrap().balance.toString() : '0';
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ import {
|
|||||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||||
import * as SecureStore from 'expo-secure-store';
|
import * as SecureStore from 'expo-secure-store';
|
||||||
import { Clipboard } from 'react-native';
|
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 { KurdistanColors } from '../theme/colors';
|
||||||
import { useTheme } from '../contexts/ThemeContext';
|
import { useTheme } from '../contexts/ThemeContext';
|
||||||
import { useBiometricAuth } from '../contexts/BiometricAuthContext';
|
import { useBiometricAuth } from '../contexts/BiometricAuthContext';
|
||||||
@@ -152,7 +153,7 @@ const SettingToggle = ({
|
|||||||
// --- MAIN SCREEN ---
|
// --- MAIN SCREEN ---
|
||||||
|
|
||||||
const SettingsScreen: React.FC = () => {
|
const SettingsScreen: React.FC = () => {
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation<NavigationProp<RootStackParamList>>();
|
||||||
const { isDarkMode, toggleDarkMode, colors, fontSize, setFontSize } = useTheme();
|
const { isDarkMode, toggleDarkMode, colors, fontSize, setFontSize } = useTheme();
|
||||||
const { isBiometricEnabled, enableBiometric, disableBiometric, biometricType, autoLockTimer, setAutoLockTimer } = useBiometricAuth();
|
const { isBiometricEnabled, enableBiometric, disableBiometric, biometricType, autoLockTimer, setAutoLockTimer } = useBiometricAuth();
|
||||||
const { signOut, user } = useAuth();
|
const { signOut, user } = useAuth();
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export default function StakingScreen() {
|
|||||||
const scores = await getAllScores(api, selectedAccount.address);
|
const scores = await getAllScores(api, selectedAccount.address);
|
||||||
|
|
||||||
// 3. Get Current Era
|
// 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();
|
const currentEra = currentEraOpt.unwrapOrDefault().toNumber();
|
||||||
|
|
||||||
// Calculations
|
// Calculations
|
||||||
|
|||||||
@@ -78,10 +78,10 @@ const SwapScreen: React.FC = () => {
|
|||||||
// Fetch From Token Balance
|
// Fetch From Token Balance
|
||||||
try {
|
try {
|
||||||
if (fromToken.symbol === 'HEZ') {
|
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());
|
setFromBalance(accountInfo.data.free.toString());
|
||||||
} else {
|
} 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');
|
setFromBalance(balanceData.isSome ? balanceData.unwrap().balance.toString() : '0');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -92,10 +92,10 @@ const SwapScreen: React.FC = () => {
|
|||||||
// Fetch To Token Balance
|
// Fetch To Token Balance
|
||||||
try {
|
try {
|
||||||
if (toToken.symbol === 'HEZ') {
|
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());
|
setToBalance(accountInfo.data.free.toString());
|
||||||
} else {
|
} 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');
|
setToBalance(balanceData.isSome ? balanceData.unwrap().balance.toString() : '0');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -205,13 +205,13 @@ const WalletScreen: React.FC = () => {
|
|||||||
accountId = selectedAccount.address as any;
|
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);
|
const hezBalance = (Number(accountInfo.data.free.toString()) / 1e12).toFixed(2);
|
||||||
|
|
||||||
let pezBalance = '0.00';
|
let pezBalance = '0.00';
|
||||||
try {
|
try {
|
||||||
if (api.query.assets?.account) {
|
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);
|
if (pezAsset.isSome) pezBalance = (Number(pezAsset.unwrap().balance.toString()) / 1e12).toFixed(2);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -222,9 +222,9 @@ const WalletScreen: React.FC = () => {
|
|||||||
try {
|
try {
|
||||||
if (api.query.assets?.account) {
|
if (api.query.assets?.account) {
|
||||||
// Check ID 1000 first (as per constants), fallback to 2 just in case
|
// 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) {
|
if (usdtAsset.isNone) {
|
||||||
usdtAsset = await api.query.assets.account(2, accountId);
|
usdtAsset = await api.query.assets.account(2, accountId) as any;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usdtAsset.isSome) {
|
if (usdtAsset.isSome) {
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ const DelegationScreen: React.FC = () => {
|
|||||||
|
|
||||||
// Fetch user's delegations
|
// Fetch user's delegations
|
||||||
if (selectedAccount) {
|
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) {
|
if (userVoting.isDelegating) {
|
||||||
const delegating = userVoting.asDelegating;
|
const delegating = userVoting.asDelegating;
|
||||||
setUserDelegations([{
|
setUserDelegations([{
|
||||||
|
|||||||
@@ -47,12 +47,12 @@ const ElectionsScreen: React.FC = () => {
|
|||||||
|
|
||||||
// Fetch commission proposals (acting as elections)
|
// Fetch commission proposals (acting as elections)
|
||||||
if (api.query.dynamicCommissionCollective?.proposals) {
|
if (api.query.dynamicCommissionCollective?.proposals) {
|
||||||
const proposalHashes = await api.query.dynamicCommissionCollective.proposals();
|
const proposalHashes = await api.query.dynamicCommissionCollective.proposals() as any;
|
||||||
|
|
||||||
const electionsData: ElectionInfo[] = [];
|
const electionsData: ElectionInfo[] = [];
|
||||||
|
|
||||||
for (const hash of proposalHashes) {
|
for (const hash of (proposalHashes || [])) {
|
||||||
const voting = await api.query.dynamicCommissionCollective.voting(hash);
|
const voting = await api.query.dynamicCommissionCollective.voting(hash) as any;
|
||||||
if (voting.isSome) {
|
if (voting.isSome) {
|
||||||
const voteData = voting.unwrap();
|
const voteData = voting.unwrap();
|
||||||
electionsData.push({
|
electionsData.push({
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ const ForumScreen: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getCategoryById = (categoryId: string): Category | undefined => {
|
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 => {
|
const getTimeAgo = (dateString: string): string => {
|
||||||
@@ -209,7 +209,7 @@ const ForumScreen: React.FC = () => {
|
|||||||
📋 All Topics
|
📋 All Topics
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
{CATEGORIES.map((category) => (
|
{categories.map((category) => (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
key={category.id}
|
key={category.id}
|
||||||
style={[
|
style={[
|
||||||
|
|||||||
Vendored
+65
@@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
* Type augmentations for Polkadot.js Codec type
|
||||||
|
* These extend the base Codec type with Option-like methods
|
||||||
|
*/
|
||||||
|
|
||||||
|
import '@pezkuwi/types';
|
||||||
|
|
||||||
|
declare module '@pezkuwi/types/types/codec' {
|
||||||
|
interface Codec {
|
||||||
|
// Option methods
|
||||||
|
isNone: boolean;
|
||||||
|
isSome: boolean;
|
||||||
|
isEmpty: boolean;
|
||||||
|
unwrap(): any;
|
||||||
|
unwrapOr<T>(defaultValue: T): any;
|
||||||
|
unwrapOrDefault(): any;
|
||||||
|
|
||||||
|
// Primitive conversions
|
||||||
|
toNumber(): number;
|
||||||
|
toBigInt(): bigint;
|
||||||
|
toJSON(): any;
|
||||||
|
toString(): string;
|
||||||
|
toHex(): string;
|
||||||
|
|
||||||
|
// Common properties
|
||||||
|
data?: any;
|
||||||
|
free?: any;
|
||||||
|
balance?: any;
|
||||||
|
commission?: any;
|
||||||
|
keys?: any;
|
||||||
|
|
||||||
|
// Delegation checks
|
||||||
|
isDelegating?: boolean;
|
||||||
|
asDelegating?: any;
|
||||||
|
|
||||||
|
// Iterator support
|
||||||
|
[Symbol.iterator]?(): Iterator<any>;
|
||||||
|
map?<T>(fn: (value: any) => T): T[];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '@pezkuwi/types-codec' {
|
||||||
|
interface Codec {
|
||||||
|
isNone: boolean;
|
||||||
|
isSome: boolean;
|
||||||
|
isEmpty: boolean;
|
||||||
|
unwrap(): any;
|
||||||
|
unwrapOr<T>(defaultValue: T): any;
|
||||||
|
unwrapOrDefault(): any;
|
||||||
|
toNumber(): number;
|
||||||
|
toBigInt(): bigint;
|
||||||
|
toJSON(): any;
|
||||||
|
toString(): string;
|
||||||
|
toHex(): string;
|
||||||
|
data?: any;
|
||||||
|
free?: any;
|
||||||
|
balance?: any;
|
||||||
|
commission?: any;
|
||||||
|
keys?: any;
|
||||||
|
isDelegating?: boolean;
|
||||||
|
asDelegating?: any;
|
||||||
|
[Symbol.iterator]?(): Iterator<any>;
|
||||||
|
map?<T>(fn: (value: any) => T): T[];
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+58
@@ -0,0 +1,58 @@
|
|||||||
|
/**
|
||||||
|
* Type declarations for external modules
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Pezkuwi extension types
|
||||||
|
declare module '@pezkuwi/extension-inject/types' {
|
||||||
|
import type { Signer } from '@pezkuwi/api/types';
|
||||||
|
|
||||||
|
export interface InjectedAccountWithMeta {
|
||||||
|
address: string;
|
||||||
|
meta: {
|
||||||
|
name?: string;
|
||||||
|
source: string;
|
||||||
|
genesisHash?: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface InjectedExtension {
|
||||||
|
name: string;
|
||||||
|
version: string;
|
||||||
|
accounts: {
|
||||||
|
get: () => Promise<InjectedAccountWithMeta[]>;
|
||||||
|
subscribe: (cb: (accounts: InjectedAccountWithMeta[]) => void) => () => void;
|
||||||
|
};
|
||||||
|
signer: Signer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '@pezkuwi/extension-dapp' {
|
||||||
|
import type { InjectedAccountWithMeta } from '@pezkuwi/extension-inject/types';
|
||||||
|
|
||||||
|
interface InjectedWeb3 {
|
||||||
|
signer: any;
|
||||||
|
name: string;
|
||||||
|
version: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function web3Enable(appName: string): Promise<InjectedWeb3[]>;
|
||||||
|
export function web3Accounts(): Promise<InjectedAccountWithMeta[]>;
|
||||||
|
export function web3FromAddress(address: string): Promise<InjectedWeb3>;
|
||||||
|
export function web3FromSource(source: string): Promise<InjectedWeb3>;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Path alias for shared lib - used in web context
|
||||||
|
declare module '@/lib/supabase' {
|
||||||
|
export const supabase: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Import.meta.env for Vite-like environments
|
||||||
|
interface ImportMetaEnv {
|
||||||
|
readonly VITE_PINATA_API_KEY?: string;
|
||||||
|
readonly VITE_PINATA_SECRET_KEY?: string;
|
||||||
|
[key: string]: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ImportMeta {
|
||||||
|
readonly env: ImportMetaEnv;
|
||||||
|
}
|
||||||
@@ -8,7 +8,10 @@
|
|||||||
"@pezkuwi/utils/*": ["../shared/utils/*"],
|
"@pezkuwi/utils/*": ["../shared/utils/*"],
|
||||||
"@pezkuwi/theme/*": ["../shared/theme/*"],
|
"@pezkuwi/theme/*": ["../shared/theme/*"],
|
||||||
"@pezkuwi/types/*": ["../shared/types/*"],
|
"@pezkuwi/types/*": ["../shared/types/*"],
|
||||||
"@pezkuwi/i18n": ["../shared/i18n"]
|
"@pezkuwi/i18n": ["../shared/i18n"],
|
||||||
}
|
"@/*": ["src/*"]
|
||||||
}
|
},
|
||||||
|
"typeRoots": ["./src/types", "./node_modules/@types"]
|
||||||
|
},
|
||||||
|
"include": ["src/**/*.ts", "src/**/*.tsx", "shared/**/*.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ export async function isStakingScoreTracking(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const startBlock = await api.query.stakingScore.stakingStartBlock(address);
|
const startBlock = await api.query.stakingScore.stakingStartBlock(address) as any;
|
||||||
return !startBlock.isNone;
|
return !startBlock.isNone;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error checking staking score tracking:', error);
|
console.error('Error checking staking score tracking:', error);
|
||||||
@@ -281,7 +281,7 @@ export async function isStaking(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ledger = await api.query.staking.ledger(address);
|
const ledger = await api.query.staking.ledger(address) as any;
|
||||||
return !ledger.isNone;
|
return !ledger.isNone;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error checking staking status:', error);
|
console.error('Error checking staking status:', error);
|
||||||
@@ -370,7 +370,7 @@ export async function getCitizenDataCid(
|
|||||||
// Try to get from identity storage
|
// Try to get from identity storage
|
||||||
// This assumes the pallet stores IPFS CID somewhere
|
// This assumes the pallet stores IPFS CID somewhere
|
||||||
// Adjust based on actual pallet storage structure
|
// Adjust based on actual pallet storage structure
|
||||||
const identity = await api.query.identityKyc.identities(address);
|
const identity = await api.query.identityKyc.identities(address) as any;
|
||||||
|
|
||||||
if (identity.isNone) {
|
if (identity.isNone) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ export async function checkStakingScoreTracking(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const startBlock = await api.query.stakingScore.stakingStartBlock(address);
|
const startBlock = await api.query.stakingScore.stakingStartBlock(address) as any;
|
||||||
return !startBlock.isNone;
|
return !startBlock.isNone;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error checking staking score tracking:', error);
|
console.error('Error checking staking score tracking:', error);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export async function getMultisigMembers(
|
|||||||
if (memberConfig.isUnique) {
|
if (memberConfig.isUnique) {
|
||||||
// Query from chain for unique roles
|
// Query from chain for unique roles
|
||||||
try {
|
try {
|
||||||
const holder = await api.query.tiki.tikiHolder(memberConfig.tiki);
|
const holder = await api.query.tiki.tikiHolder(memberConfig.tiki) as any;
|
||||||
if (holder.isSome) {
|
if (holder.isSome) {
|
||||||
const address = holder.unwrap().toString();
|
const address = holder.unwrap().toString();
|
||||||
members.push(address);
|
members.push(address);
|
||||||
@@ -137,7 +137,7 @@ export async function getMultisigMemberInfo(
|
|||||||
|
|
||||||
if (memberConfig.isUnique) {
|
if (memberConfig.isUnique) {
|
||||||
try {
|
try {
|
||||||
const holder = await api.query.tiki.tikiHolder(memberConfig.tiki);
|
const holder = await api.query.tiki.tikiHolder(memberConfig.tiki) as any;
|
||||||
if (holder.isSome) {
|
if (holder.isSome) {
|
||||||
address = holder.unwrap().toString();
|
address = holder.unwrap().toString();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user