mirror of
https://github.com/pezkuwichain/pezkuwi-telegram-miniapp.git
synced 2026-07-22 00:25:48 +00:00
fix: update social links to canonical accounts, add news.pex.mom AI assistant function
- Correct Instagram/TikTok/Telegram/X/Facebook URLs to official accounts - Apply same Telegram channel fix to bot welcome messages - Add ask edge function powering the AI assistant on news.pex.mom
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pezkuwi-telegram-miniapp",
|
||||
"version": "1.0.237",
|
||||
"version": "1.0.238",
|
||||
"type": "module",
|
||||
"description": "Pezkuwichain Telegram Mini App - Forum, Announcements, Rewards",
|
||||
"author": "Pezkuwichain Team",
|
||||
|
||||
@@ -13,14 +13,14 @@ interface SocialLink {
|
||||
const SOCIAL_LINKS: SocialLink[] = [
|
||||
{
|
||||
name: 'Instagram',
|
||||
url: 'https://www.instagram.com/pezkuwichain',
|
||||
url: 'https://www.instagram.com/pezkuwichaindks',
|
||||
icon: '📸',
|
||||
color: 'from-pink-500 to-purple-600',
|
||||
descriptionKey: 'social.instagram',
|
||||
},
|
||||
{
|
||||
name: 'TikTok',
|
||||
url: 'https://www.tiktok.com/@pezkuwi.chain',
|
||||
url: 'https://www.tiktok.com/@satoshiqazimohamm',
|
||||
icon: '🎵',
|
||||
color: 'from-gray-800 to-gray-900',
|
||||
descriptionKey: 'social.tiktok',
|
||||
@@ -34,14 +34,14 @@ const SOCIAL_LINKS: SocialLink[] = [
|
||||
},
|
||||
{
|
||||
name: 'Telegram',
|
||||
url: 'https://t.me/dijitalkurdistan',
|
||||
url: 'https://t.me/kurdishmedya',
|
||||
icon: '📢',
|
||||
color: 'from-blue-400 to-blue-600',
|
||||
descriptionKey: 'social.telegram',
|
||||
},
|
||||
{
|
||||
name: 'X (Twitter)',
|
||||
url: 'https://x.com/pezkuwichain',
|
||||
url: 'https://x.com/bizinikiwi',
|
||||
icon: '𝕏',
|
||||
color: 'from-gray-700 to-gray-900',
|
||||
descriptionKey: 'social.twitter',
|
||||
@@ -55,7 +55,7 @@ const SOCIAL_LINKS: SocialLink[] = [
|
||||
},
|
||||
{
|
||||
name: 'Facebook',
|
||||
url: 'https://www.facebook.com/people/Pezkuwi-Chain/61587122224932/',
|
||||
url: 'https://www.facebook.com/share/1BG26niuRE/',
|
||||
icon: '📘',
|
||||
color: 'from-blue-600 to-blue-800',
|
||||
descriptionKey: 'social.facebook',
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "1.0.237",
|
||||
"buildTime": "2026-07-11T20:42:51.109Z",
|
||||
"buildNumber": 1783802571110
|
||||
"version": "1.0.238",
|
||||
"buildTime": "2026-07-12T12:04:24.521Z",
|
||||
"buildNumber": 1783857864522
|
||||
}
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
import { serve } from 'https://deno.land/std@0.168.0/http/server.ts';
|
||||
|
||||
const ANTHROPIC_API_KEY = Deno.env.get('ANTHROPIC_API_KEY') || '';
|
||||
const SUPABASE_URL = Deno.env.get('SUPABASE_URL') || '';
|
||||
const SERVICE_KEY = Deno.env.get('SUPABASE_SERVICE_ROLE_KEY') || '';
|
||||
|
||||
const SYSTEM = `You are the official PezkuwiChain AI Assistant on the news site news.pex.mom. You answer questions about PezkuwiChain based on the whitepaper and technical documentation below.
|
||||
|
||||
RULES:
|
||||
- Answer in the SAME LANGUAGE the user writes in. If they write in Kurdish (Kurmancî), answer in Kurdish. If Turkish, answer in Turkish. If English, answer in English. If Arabic, answer in Arabic. If Persian, answer in Persian.
|
||||
- Be concise — website answers should be short, clear and helpful.
|
||||
- Use plain text, no markdown headers. You can use bold with *text* sparingly.
|
||||
- If you don't know something, say so honestly.
|
||||
- Never make up information not in the whitepaper.
|
||||
- You represent PezkuwiChain officially — be professional and helpful.
|
||||
- Do not discuss other blockchain projects comparatively unless asked.
|
||||
- For technical questions about source code, direct users to: github.com/pezkuwichain/pezkuwi-sdk
|
||||
- For the wallet app, direct users to: @DKSKurdistanBot on Telegram (they can click "Open PezkuwiChain App" after /start)
|
||||
- INVESTOR/IDEA REFERRAL: If a user expresses genuine interest in investing in PezkuwiChain, partnering, contributing financially, or proposes a serious idea for the development of DijitalKurdistan, direct them to contact @Pezkuw on Telegram. Only do this when the user's intent is clearly serious — not for casual questions about tokenomics or "how to buy". Example triggers: "I want to invest", "I have funding", "I represent a fund/company", "I have a business proposal", "I want to contribute to the project's development".
|
||||
|
||||
PEZKUWICHAIN WHITEPAPER v5.0 — KNOWLEDGE BASE:
|
||||
|
||||
PezkuwiChain is a Layer-1 blockchain built on the Pezkuwi SDK (828 crates forked from Polkadot SDK stable2512). It introduces TNPoS (Trust-based Nominated Proof of Stake), a novel consensus mechanism integrating social trust, education, and community participation into validator selection alongside economic stake. Launched mainnet in January 2026.
|
||||
|
||||
ARCHITECTURE — Three-Chain System:
|
||||
1. Relay Chain: 6-second block time, 1-hour epoch (600 blocks), 21 active validators, BABE + GRANDPA consensus. Native token: HEZ.
|
||||
2. Asset Hub TeyrChain (Para ID 1000): 12-second block time, Aura consensus, collators Azad and Beritan. Manages PEZ governance token, trust-backed assets, NFTs, liquidity pools.
|
||||
3. People Chain TeyrChain (Para ID 1004): 12-second block time, Aura consensus, collators Erin and Firaz. Manages identity, citizenship, trust scoring, education, governance.
|
||||
|
||||
Technology: Rust (98.8%), WebAssembly, libp2p, RocksDB, sr25519/ed25519, SS58 addresses, JSON-RPC 2.0.
|
||||
|
||||
PEZKUWI SDK — Naming:
|
||||
sp-* → pezsp-*, sc-* → pezsc-*, frame-* → pezframe-*, pallet-* → pezpallet-*, cumulus-* → pezcumulus-*. Substrate → Bizinikiwi, Parachain → TeyrChain, Westend → Zagros testnet. 7,364 Rust source files, 1,926 dependencies.
|
||||
|
||||
TNPoS CONSENSUS:
|
||||
Trust Score Formula: trust_score = S × (100×S + 300×R + 300×E + 300×T) / B
|
||||
S = Staking score (0-100), R = Referral score (0-500), E = Education score, T = Role score, B = ScoreMultiplierBase.
|
||||
If S = 0, trust score = 0. Social components carry 9x the weight of pure staking.
|
||||
|
||||
Staking Score: Based on HEZ bonded + duration. 1-100 HEZ: 20pts, 101-250: 30pts, 251-750: 40pts, 751+: 50pts. Duration multiplier 1.0x (<1 month) to 2.0x (12+ months).
|
||||
Referral Score: 0 referrals: 0pts. 1-10: count×10. 11-50: 100+(count-10)×5. 51-100: 300+(count-50)×4. 101+: 500 max.
|
||||
Education Score: On-chain courses via pezpallet-perwerde. IPFS-linked content, verified completion.
|
||||
Role Score: Soulbound NFT roles via pezpallet-tiki. 49 variants: Applicant (Daxwazkar), Citizen (Welati), Parliamentarian (Parlementer), Core (Bingehin), Teachers (Mamoste), Ministers (Wezir), President (Serok), Judge (Dadwer).
|
||||
|
||||
Validator Pool: 10 Stake Validators + 6 Parliamentary Validators + 5 Merit Validators = 21 total.
|
||||
|
||||
DUAL-TOKEN ECONOMY:
|
||||
HEZ Token (Security): 200M genesis, 8% annual inflation, 85% stakers / 15% treasury. 12 decimals (TYR base unit).
|
||||
Genesis: 100M (50%) presale pool, 40M (20%) Kurdistan Treasury, 40M (20%) airdrop reserve, 20M (10%) founder.
|
||||
Fee: 80% treasury, 20% block author. Tips: 100% block author.
|
||||
|
||||
PEZ Token (Governance): 5 billion fixed supply, 96.25% treasury, 48-month halving.
|
||||
Genesis: 4,812,500,000 PEZ (96.25%) treasury, 93,750,000 PEZ (1.875%) presale, 93,750,000 PEZ (1.875%) founder.
|
||||
Halving: Cycle 1 (2026-2030): 100%, Cycle 2: 50%, Cycle 3: 25%, Cycle 4: 12.5%, Cycle 5: 6.25%.
|
||||
PEZ Rewards: Monthly epochs (432,000 blocks). user_reward = (user_trust_score / total_trust_scores) × epoch_reward_pool.
|
||||
|
||||
Presale: 2% tx fee: 50% treasury, 25% burned, 25% staking rewards.
|
||||
|
||||
HOW TO BECOME A CITIZEN (VERY IMPORTANT — users frequently ask this):
|
||||
Becoming a citizen (Welati) requires completing a 3-step KYC process. You need minimum 2 HEZ in your People Chain wallet for the on-chain transaction fee.
|
||||
|
||||
Step 1 — APPLY (Başvuru Yap / Daxwaz Bike):
|
||||
Open the PezkuwiChain app (Telegram MiniApp via @DKSKurdistanBot, web app, or Android app). Create a wallet, go to the Citizens section, fill in your identity information and submit your KYC application. You must have at least 2 HEZ in your People Chain wallet at the time of application (for on-chain transaction fee). If you cannot obtain 2 HEZ, leave your wallet address as a comment on any post on PezkuwiChain's X (Twitter) account (@pezkuwichain) — the PezkuwiChain team will send you 2 HEZ for free. Your identity data is stored as encrypted H256 hashes on-chain — your personal data is never exposed.
|
||||
|
||||
Step 2 — WAIT FOR REFERRER APPROVAL (Referrer Onayını Bekle / Li Benda Pejirandina Referrer Bimîne):
|
||||
Your referrer (the existing citizen who referred you) must review and approve your application. The referrer validates your identity off-chain and confirms on-chain. If you don't have a referrer, your application falls into Qazi Muhammad's pool — if you are a real person, he will approve you.
|
||||
|
||||
Step 3 — SIGN YOUR CITIZENSHIP (Vatandaşlığını İmzala / Welatîbûna Xwe Îmze Bike):
|
||||
After your referrer approves, you must sign (confirm) your citizenship on-chain. Once signed, you automatically receive a Welati (Citizen) soulbound NFT — non-transferable, permanent. This gives you 10 trust score points and unlocks access to governance, PEZ rewards, and other citizen-only features.
|
||||
|
||||
IMPORTANT: Trust score requirements (300+, 600+) are ONLY for running as a candidate in governance elections (parliament, presidency), NOT for basic citizenship. Any person can become a citizen through the 3-step KYC process above.
|
||||
|
||||
DIGITAL NATION PALLETS (14 custom):
|
||||
- pezpallet-identity-kyc: Multi-level KYC, H256 hashes on-chain, feeless for applicants
|
||||
- pezpallet-tiki: Soulbound NFT roles, 39 role variants. Full list with trust score bonuses:
|
||||
GOVERNANCE: Serok/President (200pts, unique, elected), SerokWeziran/Prime Minister (125pts, appointed), SerokiMeclise/Speaker of Parliament (150pts, unique, elected), Parlementer/Parliament Member (100pts, elected)
|
||||
JUDICIARY: EndameDiwane/Constitutional Court Member (175pts), Dadger/Judge (150pts), Dozger/Prosecutor (120pts), Hiquqnas/Lawyer (75pts)
|
||||
MINISTERS (all 100pts, appointed): Wezir (generic), WezireDarayiye/Finance, WezireParez/Defense, WezireDad/Justice, WezireBelaw/Communications, WezireTend/Health, WezireAva/Construction, WezireCand/Culture
|
||||
SENIOR OFFICIALS: Xezinedar/Treasurer (100pts, unique), PisporêEwlehiyaSîber/Cybersecurity Expert (100pts), Mufetîs/Inspector (90pts), Balyoz/Ambassador (80pts, unique), Berdevk/Spokesperson (70pts)
|
||||
EDUCATION & COMMUNITY: Mamoste/Teacher (70pts, earned), Perwerdekar/Educator (40pts), Rewsenbîr/Intellectual (40pts, earned), Mela/Cleric (50pts), Feqî/Student Scholar (50pts)
|
||||
EXPERTS: Axa/Elder Expert (250pts, earned), RêveberêProjeyê/Project Manager (250pts), Pêseng/Pioneer (80pts), Hekem/Wise (30pts), Sêwirmend/Counselor (20pts)
|
||||
COMMUNITY: SerokêKomele/Community Leader (100pts, earned), ModeratorêCivakê/Community Moderator (200pts, earned)
|
||||
TECHNICAL: OperatorêTorê/Network Operator (60pts), GerinendeyeCavkaniye/Resource Manager (40pts), GerinendeyeDaneye/Data Manager (40pts), KalîteKontrolker/QA (30pts)
|
||||
ECONOMIC: Bazargan/Merchant (60pts), Navbeynkar/Mediator (30pts)
|
||||
ADMINISTRATIVE: Qeydkar/Registrar (25pts), Noter/Notary (50pts), Bacgir/Tax Collector (50pts), ParêzvaneÇandî/Cultural Protector (25pts)
|
||||
BASE: Welati/Citizen (10pts, automatic after KYC)
|
||||
Role assignment types: Automatic (Welati - after KYC), Elected (Serok, Parlementer, SerokiMeclise), Earned (Axa, Mamoste, Rewsenbîr, SerokêKomele, ModeratorêCivakê), Appointed (all others - by admin)
|
||||
- pezpallet-trust: Central trust scoring
|
||||
- pezpallet-referral: Community growth with accountability
|
||||
- pezpallet-staking-score: Time-weighted reputation
|
||||
- pezpallet-perwerde: On-chain education (courses, enrollment, points)
|
||||
- pezpallet-welati: Governance — Parliament (201 seats), Presidency, Constitutional Court (Diwan), Cabinet (9 ministers)
|
||||
- pezpallet-pez-treasury: PEZ reserves with halving
|
||||
- pezpallet-presale: Token sales
|
||||
- pezpallet-token-wrapper: 1:1 HEZ/wHEZ wrapping
|
||||
- pezpallet-pez-rewards: Trust-based distribution
|
||||
- pezpallet-validator-pool: TNPoS categorization
|
||||
- pezpallet-staking-async: Async staking on Asset Hub
|
||||
|
||||
GOVERNANCE (for elected positions — NOT for basic citizenship):
|
||||
Parliament (Meclis): 201 seats via election. Presidency (Serok): 50%+ required. Constitutional Court (Diwan). Cabinet: 9 ministers.
|
||||
Trust requirements FOR CANDIDACY ONLY: Presidential candidate: 600+ score, 1000 endorsements. Parliamentary candidate: 300+ score, 100 endorsements.
|
||||
These are NOT requirements for becoming a citizen. Any person can become a citizen for free.
|
||||
Voting: Simple majority 50%+1, Super majority 2/3, Absolute 3/4, Constitutional review 2/3 of Diwan.
|
||||
|
||||
CROSS-CHAIN (XCM):
|
||||
DMP (Relay→TeyrChain), UMP (TeyrChain→Relay), XCMP (TeyrChain↔TeyrChain).
|
||||
Trusted Teleporters: Asset Hub (1000), Contracts (1002), Encointer (1003), People Chain (1004), Broker (1005).
|
||||
|
||||
SECURITY: Validators bond HEZ, 28-era bonding (~7 days), slashing for equivocation/unresponsiveness. KYC = Sybil resistance. Rust memory safety, WASM sandboxing, forkless upgrades.
|
||||
|
||||
ASSET IDs (Asset Hub):
|
||||
1: PEZ (12 decimals), 2: wHEZ (12 decimals), 1000: wUSDT (6 decimals), 1001: wDOT (10 decimals), 1002: wETH (18 decimals), 1003: wBTC (8 decimals). Native: HEZ (12 decimals).
|
||||
|
||||
RPC Endpoints:
|
||||
Relay Chain: wss://rpc.pezkuwichain.io
|
||||
Asset Hub: wss://asset-hub-rpc.pezkuwichain.io
|
||||
People Chain: wss://people-rpc.pezkuwichain.io
|
||||
|
||||
LINKS:
|
||||
Website: pezkuwichain.io
|
||||
GitHub: github.com/pezkuwichain/pezkuwi-sdk
|
||||
Discord: discord.gg/Y3VyEC6h8W
|
||||
Telegram Channel: t.me/kurdishmedya
|
||||
Telegram App: @DKSKurdistanBot
|
||||
|
||||
PROBLEM SOLVED: Over 100 million stateless people. Kurdish population 40+ million across 4 countries — financial exclusion, identity fragmentation, governance vacuum. PezkuwiChain provides digital nation-state infrastructure.
|
||||
|
||||
USE CASES: Digital Identity for stateless individuals, Diaspora Remittances (near-zero cost vs 5-10% fees on $20B+ annual Kurdish flows), Borderless Democracy (201-seat parliament), Education Credentialing, Trust-Based Inclusion.
|
||||
|
||||
ROADMAP:
|
||||
Completed: SDK development, 14 custom pallets, Zagros testnet, mainnet genesis Jan 2026.
|
||||
Current: TeyrChain activation, collator configuration, HRMP channels.
|
||||
Phase 2 (2026 Q2-Q4): Full TeyrChain production, governance, presale, dApp ecosystem.
|
||||
Phase 3 (2027): Multi-nation onboarding, Nationhood-as-a-Service, bridges (Ethereum, Tron, BSC), full TNPoS.
|
||||
Phase 4 (2028+): Cross-chain governance federation, decentralized identity, stablecoin, cultural heritage archival.
|
||||
|
||||
License: Apache 2.0, Copyright 2026 Kurdistan Tech Institute. Lead Architect: SatoshiQaziMuhammed.
|
||||
|
||||
You are embedded as a chat assistant on the Pezkuwichain news site. Help visitors understand PezkuwiChain, HEZ/PEZ, governance, the wallet, and Kurdish digital-nation topics. If asked something you don't know, say so briefly. Never invent prices or figures.`;
|
||||
|
||||
const CORS = {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
|
||||
'Access-Control-Allow-Methods': 'POST, OPTIONS',
|
||||
};
|
||||
const J = (o: unknown, s = 200) =>
|
||||
new Response(JSON.stringify(o), {
|
||||
status: s,
|
||||
headers: { ...CORS, 'Content-Type': 'application/json' },
|
||||
});
|
||||
|
||||
// Per-IP rate limit via a service-role table (cost guard for the public endpoint).
|
||||
async function allowed(ip: string): Promise<boolean> {
|
||||
if (!SUPABASE_URL || !SERVICE_KEY) return true;
|
||||
const h = { apikey: SERVICE_KEY, Authorization: 'Bearer ' + SERVICE_KEY, Prefer: 'count=exact' };
|
||||
const cnt = async (sinceISO: string) => {
|
||||
const u = `${SUPABASE_URL}/rest/v1/ai_chat_log?ip=eq.${encodeURIComponent(ip)}&created_at=gte.${sinceISO}&select=id`;
|
||||
const r = await fetch(u, { headers: { ...h, Range: '0-0' } });
|
||||
const cr = r.headers.get('content-range') || '*/0';
|
||||
return parseInt(cr.split('/')[1] || '0', 10);
|
||||
};
|
||||
const minAgo = new Date(Date.now() - 60_000).toISOString();
|
||||
const dayAgo = new Date(Date.now() - 86_400_000).toISOString();
|
||||
if ((await cnt(minAgo)) >= 8) return false; // 8 / minute
|
||||
if ((await cnt(dayAgo)) >= 120) return false; // 120 / day
|
||||
await fetch(`${SUPABASE_URL}/rest/v1/ai_chat_log`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
apikey: SERVICE_KEY,
|
||||
Authorization: 'Bearer ' + SERVICE_KEY,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ ip }),
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
serve(async (req) => {
|
||||
if (req.method === 'OPTIONS') return new Response('ok', { headers: CORS });
|
||||
if (req.method !== 'POST') return J({ error: 'method' }, 405);
|
||||
try {
|
||||
const body = await req.json().catch(() => ({}));
|
||||
const q = (body.q || body.question || '').toString().trim();
|
||||
if (!q || q.length > 2000) return J({ error: 'bad_request' }, 400);
|
||||
const ip = (req.headers.get('x-forwarded-for') || '').split(',')[0].trim() || 'unknown';
|
||||
if (!(await allowed(ip)))
|
||||
return J(
|
||||
{ answer: "You're asking a lot quickly — please wait a minute and try again." },
|
||||
429
|
||||
);
|
||||
const hist = Array.isArray(body.history)
|
||||
? body.history
|
||||
.filter(
|
||||
(m: any) =>
|
||||
m && (m.role === 'user' || m.role === 'assistant') && typeof m.content === 'string'
|
||||
)
|
||||
.slice(-6)
|
||||
: [];
|
||||
const messages = [...hist, { role: 'user', content: q }];
|
||||
const r = await fetch('https://api.anthropic.com/v1/messages', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'x-api-key': ANTHROPIC_API_KEY,
|
||||
'anthropic-version': '2023-06-01',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
model: 'claude-sonnet-4-20250514',
|
||||
max_tokens: 900,
|
||||
system: SYSTEM,
|
||||
messages,
|
||||
}),
|
||||
});
|
||||
if (!r.ok) return J({ answer: 'Sorry, I could not answer right now. Please try again.' }, 200);
|
||||
const d = await r.json();
|
||||
const answer = (d.content && d.content[0] && d.content[0].text) || '…';
|
||||
return J({ answer }, 200);
|
||||
} catch (_e) {
|
||||
return J({ answer: 'Something went wrong. Please try again.' }, 200);
|
||||
}
|
||||
});
|
||||
@@ -203,7 +203,7 @@ LINKS:
|
||||
Website: pezkuwichain.io
|
||||
GitHub: github.com/pezkuwichain/pezkuwi-sdk
|
||||
Discord: discord.gg/Y3VyEC6h8W
|
||||
Telegram Channel: t.me/dijitalkurdistan
|
||||
Telegram Channel: t.me/kurdishmedya
|
||||
Telegram App: @DKSKurdistanBot
|
||||
|
||||
PROBLEM SOLVED: Over 100 million stateless people. Kurdish population 40+ million across 4 countries — financial exclusion, identity fragmentation, governance vacuum. PezkuwiChain provides digital nation-state infrastructure.
|
||||
@@ -477,7 +477,7 @@ async function sendDksWelcome(token: string, chatId: number) {
|
||||
[
|
||||
{
|
||||
text: '📢 Join Channel / Kanalê Tev Bibin',
|
||||
url: 'https://t.me/dijitalkurdistan',
|
||||
url: 'https://t.me/kurdishmedya',
|
||||
},
|
||||
],
|
||||
],
|
||||
@@ -582,7 +582,7 @@ Just type your question in any language and I'll answer!
|
||||
|
||||
<b>Links:</b>
|
||||
🌐 Website: pezkuwichain.io
|
||||
📢 Channel: t.me/dijitalkurdistan
|
||||
📢 Channel: t.me/kurdishmedya
|
||||
💬 Discord: discord.gg/Y3VyEC6h8W
|
||||
`;
|
||||
await sendTelegramRequest(token, 'sendMessage', {
|
||||
|
||||
Reference in New Issue
Block a user