mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 21:47:56 +00:00
31a0f86382
Centralized common code into shared/ folder to eliminate duplication and improve maintainability across all three frontend projects (web, mobile, pezkuwi-sdk-ui). Changes: - Added token types and constants to shared/types/tokens.ts - TokenInfo, PoolInfo, SwapQuote, and other DEX types - KNOWN_TOKENS with HEZ, PEZ, wUSDT definitions - Token logos (🟡🟣💵) - Added Kurdistan color palette to shared/constants/ - Kesk, Sor, Zer, Spî, Reş color definitions - Added TOKEN_DISPLAY_SYMBOLS mapping (USDT vs wUSDT) - Updated blockchain configuration in shared/blockchain/polkadot.ts - Added beta testnet endpoint (wss://beta-rpc.pezkuwi.art) - Defined DEFAULT_ENDPOINT constant - Moved i18n to shared/i18n/ - Centralized translation files for 6 languages (EN, TR, KMR, CKB, AR, FA) - Added LANGUAGES configuration with RTL support - Created isRTL() helper function - Updated web and mobile to import from shared - web/src/types/dex.ts now re-exports from shared - web/src/contexts/PolkadotContext.tsx uses DEFAULT_ENDPOINT - mobile/src/i18n/index.ts uses shared translations - mobile/src/contexts/PolkadotContext.tsx uses DEFAULT_ENDPOINT - Updated shared/README.md with comprehensive documentation This architecture reduces code duplication and ensures consistency across all frontend projects.
85 lines
1.7 KiB
TypeScript
85 lines
1.7 KiB
TypeScript
/**
|
|
* Shared constants for Pezkuwi Web App Projects
|
|
*/
|
|
|
|
import type { TokenInfo } from '../types/tokens';
|
|
|
|
/**
|
|
* Application version
|
|
*/
|
|
export const APP_VERSION = '1.0.0';
|
|
|
|
/**
|
|
* Supported languages
|
|
*/
|
|
export const SUPPORTED_LANGUAGES = [
|
|
{ code: 'en', name: 'English' },
|
|
{ code: 'tr', name: 'Türkçe' },
|
|
{ code: 'kmr', name: 'Kurdî' },
|
|
{ code: 'ckb', name: 'سۆرانی' },
|
|
{ code: 'ar', name: 'العربية' },
|
|
{ code: 'fa', name: 'فارسی' },
|
|
] as const;
|
|
|
|
/**
|
|
* Default language
|
|
*/
|
|
export const DEFAULT_LANGUAGE = 'en';
|
|
|
|
/**
|
|
* API timeouts (in milliseconds)
|
|
*/
|
|
export const TIMEOUTS = {
|
|
API_REQUEST: 30000,
|
|
BLOCKCHAIN_QUERY: 60000,
|
|
TRANSACTION: 120000,
|
|
} as const;
|
|
|
|
/**
|
|
* Kurdistan color palette
|
|
*/
|
|
export const KURDISTAN_COLORS = {
|
|
kesk: '#00A94F', // Green (Kesk)
|
|
sor: '#EE2A35', // Red (Sor)
|
|
zer: '#FFD700', // Yellow/Gold (Zer)
|
|
spi: '#FFFFFF', // White (Spî)
|
|
res: '#000000', // Black (Reş)
|
|
} as const;
|
|
|
|
/**
|
|
* Known tokens on the Pezkuwi blockchain
|
|
*/
|
|
export const KNOWN_TOKENS: Record<number, TokenInfo> = {
|
|
0: {
|
|
id: 0,
|
|
symbol: 'wHEZ',
|
|
name: 'Wrapped HEZ',
|
|
decimals: 12,
|
|
logo: '🟡',
|
|
},
|
|
1: {
|
|
id: 1,
|
|
symbol: 'PEZ',
|
|
name: 'Pezkuwi Token',
|
|
decimals: 12,
|
|
logo: '🟣',
|
|
},
|
|
2: {
|
|
id: 2,
|
|
symbol: 'wUSDT',
|
|
name: 'Wrapped USDT',
|
|
decimals: 6,
|
|
logo: '💵',
|
|
},
|
|
};
|
|
|
|
/**
|
|
* Display token symbols (what users see vs. blockchain IDs)
|
|
* Example: Users see "USDT" but it's wUSDT (asset ID 2) on blockchain
|
|
*/
|
|
export const TOKEN_DISPLAY_SYMBOLS: Record<string, string> = {
|
|
'wHEZ': 'HEZ', // Display HEZ instead of wHEZ
|
|
'wUSDT': 'USDT', // Display USDT instead of wUSDT
|
|
'PEZ': 'PEZ', // PEZ stays as is
|
|
};
|