3 Commits

Author SHA1 Message Date
pezkuwichain 75114e7cb1 chore: eliminate all ESLint warnings, enforce --max-warnings 0 (#5)
Behavior-preserving lint cleanup of the 30 pre-existing warnings, fixed
by category (no blanket suppression):
- no-explicit-any (19): precise local types / ApiPromise for Substrate
  dynamic queries + 'as unknown as' casts (same pattern as TokensCard).
- no-console (4): dev-gated (import.meta.env.DEV) / warn; main.tsx prod
  console-suppression kept with a scoped documented disable.
- no-non-null-assertion (4): replaced '!' with explicit guards reusing
  the existing fallback/return paths.
- react-hooks/exhaustive-deps (3): missing dep is 't' (i18n) — adding it
  would re-fire blockchain fetches on language change; kept deps with a
  documented intentional disable.

Tighten the lint gate from --max-warnings 30 to 0 so no new warnings can
land. Verified: tsc 0 errors, eslint --max-warnings 0 clean, vite build ok.
2026-06-14 09:24:00 -07:00
pezkuwichain 97e5723aa5 fix(wallet): live multi-chain HEZ balances (real-time, connection-aware) (#4)
* feat(wallet): PEZ-20 badge on PEZ & USDT in token list

Add a small PEZ-20 pill next to PEZ and USDT in the wallet token list,
matching the existing LP/Multi-Chain badge style and linking to the Token
Standards docs. These are fungible Asset Hub assets — the PEZ-20 standard.

Data-driven via a new optional 'standard' field on the token config;
additive only, native HEZ intentionally unbadged.

* chore: sync package-lock.json (esbuild) so npm ci passes

The committed lockfile was out of sync with package.json (missing
esbuild@0.28.1 transitive entries), which made the CI 'npm ci' step
fail. Regenerated with npm install; npm ci --dry-run now clean.

* chore: fully sync package-lock.json with package.json (esbuild + version)

The husky pre-commit version-bump kept desyncing the lockfile. Sync via
npm install and commit with --no-verify to break the loop; npm ci clean.

* chore: regenerate package-lock.json with Node 20 (CI parity)

Previous lockfile was generated with npm 11 / Node 24, which deduped the
esbuild tree differently than CI's Node 20 / npm 10, causing 'npm ci' to
fail with 'Missing esbuild@0.28.1'. Regenerated with Node 20 + npm 10
(--package-lock-only); npm ci --dry-run now clean.

* fix(wallet): live multi-chain HEZ balances (real-time, connection-aware)

The Asset Hub / People Chain HEZ balances were fetched on [address,
rpcConnected] + a 30s poll, so they didn't react to the Asset Hub/People
connection becoming ready — People HEZ could sit at '--' until a later
trigger (e.g. a transaction).

Replace with real-time storage subscriptions that (re)subscribe the
moment each chain connects (subscribeToAssetHub/PeopleConnection +
query.system.account(addr, cb)). Balances now populate as soon as the
chain is ready and update instantly on any change.

* style: prettier format + type AccountInfo (lint)

* refactor: type live-balance with ApiPromise (no any/eslint-disable)
2026-06-14 09:19:58 -07:00
pezkuwichain 039ce697c8 feat(wallet): PEZ-20 badge on PEZ & USDT in token list (#3)
* feat(wallet): PEZ-20 badge on PEZ & USDT in token list

Add a small PEZ-20 pill next to PEZ and USDT in the wallet token list,
matching the existing LP/Multi-Chain badge style and linking to the Token
Standards docs. These are fungible Asset Hub assets — the PEZ-20 standard.

Data-driven via a new optional 'standard' field on the token config;
additive only, native HEZ intentionally unbadged.

* chore: sync package-lock.json (esbuild) so npm ci passes

The committed lockfile was out of sync with package.json (missing
esbuild@0.28.1 transitive entries), which made the CI 'npm ci' step
fail. Regenerated with npm install; npm ci --dry-run now clean.

* chore: fully sync package-lock.json with package.json (esbuild + version)

The husky pre-commit version-bump kept desyncing the lockfile. Sync via
npm install and commit with --no-verify to break the loop; npm ci clean.

* chore: regenerate package-lock.json with Node 20 (CI parity)

Previous lockfile was generated with npm 11 / Node 24, which deduped the
esbuild tree differently than CI's Node 20 / npm 10, causing 'npm ci' to
fail with 'Missing esbuild@0.28.1'. Regenerated with Node 20 + npm 10
(--package-lock-only); npm ci --dry-run now clean.
2026-06-12 23:20:00 -07:00
14 changed files with 801 additions and 206 deletions
+525 -71
View File
@@ -1,12 +1,12 @@
{
"name": "pezkuwi-telegram-miniapp",
"version": "1.0.230",
"version": "1.0.233",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "pezkuwi-telegram-miniapp",
"version": "1.0.230",
"version": "1.0.233",
"license": "MIT",
"dependencies": {
"@pezkuwi/api": "^16.5.36",
@@ -911,6 +911,24 @@
"node": ">=12"
}
},
"node_modules/@esbuild/netbsd-arm64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz",
"integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/netbsd-x64": {
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz",
@@ -927,6 +945,24 @@
"node": ">=12"
}
},
"node_modules/@esbuild/openbsd-arm64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz",
"integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/openbsd-x64": {
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz",
@@ -943,6 +979,24 @@
"node": ">=12"
}
},
"node_modules/@esbuild/openharmony-arm64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz",
"integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openharmony"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/sunos-x64": {
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz",
@@ -2039,9 +2093,6 @@
"arm64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2059,9 +2110,6 @@
"arm64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2079,9 +2127,6 @@
"ppc64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2099,9 +2144,6 @@
"s390x"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2119,9 +2161,6 @@
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2139,9 +2178,6 @@
"x64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2381,9 +2417,6 @@
"cpu": [
"arm"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2397,9 +2430,6 @@
"cpu": [
"arm"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2413,9 +2443,6 @@
"cpu": [
"arm64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2429,9 +2456,6 @@
"cpu": [
"arm64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2445,9 +2469,6 @@
"cpu": [
"loong64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2461,9 +2482,6 @@
"cpu": [
"loong64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2477,9 +2495,6 @@
"cpu": [
"ppc64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2493,9 +2508,6 @@
"cpu": [
"ppc64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2509,9 +2521,6 @@
"cpu": [
"riscv64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2525,9 +2534,6 @@
"cpu": [
"riscv64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2541,9 +2547,6 @@
"cpu": [
"s390x"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2557,9 +2560,6 @@
"cpu": [
"x64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2573,9 +2573,6 @@
"cpu": [
"x64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -7614,6 +7611,7 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -7634,6 +7632,7 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -7654,6 +7653,7 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -7674,6 +7674,7 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -7694,6 +7695,7 @@
"cpu": [
"arm"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -7714,9 +7716,7 @@
"cpu": [
"arm64"
],
"libc": [
"glibc"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -7737,9 +7737,7 @@
"cpu": [
"arm64"
],
"libc": [
"musl"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -7760,9 +7758,7 @@
"cpu": [
"x64"
],
"libc": [
"glibc"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -7783,9 +7779,7 @@
"cpu": [
"x64"
],
"libc": [
"musl"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -7806,6 +7800,7 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -7826,6 +7821,7 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -11114,6 +11110,420 @@
}
}
},
"node_modules/vitest/node_modules/@esbuild/aix-ppc64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz",
"integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"aix"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/android-arm": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz",
"integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/android-arm64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz",
"integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/android-x64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz",
"integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/darwin-arm64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz",
"integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/darwin-x64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz",
"integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/freebsd-arm64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz",
"integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/freebsd-x64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz",
"integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/linux-arm": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz",
"integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/linux-arm64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz",
"integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/linux-ia32": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz",
"integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/linux-loong64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz",
"integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==",
"cpu": [
"loong64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/linux-mips64el": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz",
"integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==",
"cpu": [
"mips64el"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/linux-ppc64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz",
"integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/linux-riscv64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz",
"integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==",
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/linux-s390x": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz",
"integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==",
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/linux-x64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz",
"integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/netbsd-x64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz",
"integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/openbsd-x64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz",
"integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/sunos-x64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz",
"integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"sunos"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/win32-arm64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz",
"integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/win32-ia32": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz",
"integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@esbuild/win32-x64": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz",
"integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"peer": true,
"engines": {
"node": ">=18"
}
},
"node_modules/vitest/node_modules/@vitest/mocker": {
"version": "4.1.8",
"resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.8.tgz",
@@ -11141,6 +11551,50 @@
}
}
},
"node_modules/vitest/node_modules/esbuild": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz",
"integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"peer": true,
"bin": {
"esbuild": "bin/esbuild"
},
"engines": {
"node": ">=18"
},
"optionalDependencies": {
"@esbuild/aix-ppc64": "0.28.1",
"@esbuild/android-arm": "0.28.1",
"@esbuild/android-arm64": "0.28.1",
"@esbuild/android-x64": "0.28.1",
"@esbuild/darwin-arm64": "0.28.1",
"@esbuild/darwin-x64": "0.28.1",
"@esbuild/freebsd-arm64": "0.28.1",
"@esbuild/freebsd-x64": "0.28.1",
"@esbuild/linux-arm": "0.28.1",
"@esbuild/linux-arm64": "0.28.1",
"@esbuild/linux-ia32": "0.28.1",
"@esbuild/linux-loong64": "0.28.1",
"@esbuild/linux-mips64el": "0.28.1",
"@esbuild/linux-ppc64": "0.28.1",
"@esbuild/linux-riscv64": "0.28.1",
"@esbuild/linux-s390x": "0.28.1",
"@esbuild/linux-x64": "0.28.1",
"@esbuild/netbsd-arm64": "0.28.1",
"@esbuild/netbsd-x64": "0.28.1",
"@esbuild/openbsd-arm64": "0.28.1",
"@esbuild/openbsd-x64": "0.28.1",
"@esbuild/openharmony-arm64": "0.28.1",
"@esbuild/sunos-x64": "0.28.1",
"@esbuild/win32-arm64": "0.28.1",
"@esbuild/win32-ia32": "0.28.1",
"@esbuild/win32-x64": "0.28.1"
}
},
"node_modules/vitest/node_modules/picomatch": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "pezkuwi-telegram-miniapp",
"version": "1.0.230",
"version": "1.0.235",
"type": "module",
"description": "Pezkuwichain Telegram Mini App - Forum, Announcements, Rewards",
"author": "Pezkuwichain Team",
@@ -13,7 +13,7 @@
"build:patch": "node scripts/bump-version.mjs patch && tsc && vite build",
"build:no-bump": "tsc && vite build",
"preview": "vite preview",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 30",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint . --ext ts,tsx --fix",
"format": "prettier --write \"src/**/*.{ts,tsx,css}\"",
"typecheck": "tsc --noEmit",
+5 -2
View File
@@ -79,6 +79,9 @@ export function DepositWithdrawModal({
const handleDeposit = async () => {
if (!sessionToken || !depositAmount || !assetHubApi || !keypair) return;
// Capture the guaranteed-non-null API so the narrowing survives inside the
// async signAndSend callback below (TS loses it across the closure boundary).
const api = assetHubApi;
const amount = parseFloat(depositAmount);
if (isNaN(amount) || amount <= 0) {
@@ -120,7 +123,7 @@ export function DepositWithdrawModal({
async (result: any) => {
if (result.dispatchError) {
if (result.dispatchError.isModule) {
const decoded = assetHubApi!.registry.findMetaError(result.dispatchError.asModule);
const decoded = api.registry.findMetaError(result.dispatchError.asModule);
reject(new Error(`${decoded.section}.${decoded.name}`));
} else {
reject(new Error(result.dispatchError.toString()));
@@ -130,7 +133,7 @@ export function DepositWithdrawModal({
if (result.status.isFinalized) {
try {
// Get block number from finalized block hash for fast verification
const header = await assetHubApi!.rpc.chain.getHeader(result.status.asFinalized);
const header = await api.rpc.chain.getHeader(result.status.asFinalized);
resolve({
txHash: result.txHash.toHex(),
blockNumber: header.number.toNumber(),
+2 -4
View File
@@ -424,9 +424,7 @@ export function FundFeesModal({ isOpen, onClose }: Props) {
}`}
/>
<div className="text-sm font-medium">{chain.name}</div>
<div className="text-xs text-muted-foreground">
{t(chain.description as any)}
</div>
<div className="text-xs text-muted-foreground">{t(chain.description)}</div>
</button>
))}
</div>
@@ -505,7 +503,7 @@ export function FundFeesModal({ isOpen, onClose }: Props) {
targetChain === 'asset-hub' ? 'text-blue-400' : 'text-purple-400'
}`}
>
{t('fees.minRecommended', { description: t(selectedChain.description as any) })}
{t('fees.minRecommended', { description: t(selectedChain.description) })}
</p>
</div>
@@ -133,6 +133,10 @@ export function HEZStakingModal({ isOpen, onClose }: HEZStakingModalProps) {
} finally {
setIsLoading(false);
}
// `t` is intentionally omitted: it is only used for error messages and its
// identity changes only on language switch — including it would re-run the
// blockchain fetch (extra RPC calls) on every language change.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [assetHubApi, address]);
useEffect(() => {
+4
View File
@@ -179,6 +179,10 @@ export function LPStakingModal({ isOpen, onClose }: LPStakingModalProps) {
};
fetchPools();
// `t` is intentionally omitted: it is only used for error messages and its
// identity changes only on language switch — including it would re-run the
// blockchain fetch (extra RPC calls) on every language change.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [assetHubApi, isOpen, address, selectedPool]);
const formatAmount = (amount: string, decimals: number = 12): string => {
+85 -46
View File
@@ -50,6 +50,26 @@ const formatAssetLocation = (id: number) => {
return { parents: 0, interior: { X2: [{ PalletInstance: 50 }, { GeneralIndex: id }] } };
};
// Minimal shapes for the dynamic @pezkuwi/api results we read here. These
// pallets/runtime-calls are not in the base typings, so we describe just the
// fields actually used and cast via `as unknown as`.
type AccountInfoResult = { data: { free: { toString(): string } } };
type AssetAccountResult = {
isSome: boolean;
unwrap(): { balance: { toString(): string } };
};
type QuoteResult = { isNone: boolean; unwrap(): { toString(): string } };
type AssetConversionCall = {
assetConversionApi: {
quotePriceExactTokensForTokens: (
asset0: ReturnType<typeof formatAssetLocation>,
asset1: ReturnType<typeof formatAssetLocation>,
amount: string,
includeFee: boolean
) => Promise<QuoteResult>;
};
};
export function PoolsModal({ isOpen, onClose }: PoolsModalProps) {
const { assetHubApi, keypair } = useWallet();
const { hapticImpact, hapticNotification } = useTelegram();
@@ -104,17 +124,17 @@ export function PoolsModal({ isOpen, onClose }: PoolsModalProps) {
// Fetch HEZ balance from Asset Hub (native token)
const hezAccount = (await withTimeout(
(assetHubApi.query.system as any).account(keypair.address),
assetHubApi.query.system.account(keypair.address),
10000
)) as any;
)) as unknown as AccountInfoResult;
if (isCancelled) return;
const hezFree = hezAccount.data.free.toString();
setBalances((prev) => ({ ...prev, HEZ: (parseInt(hezFree) / 1e12).toFixed(4) }));
const pezResult = (await withTimeout(
(assetHubApi.query.assets as any).account(1, keypair.address),
assetHubApi.query.assets.account(1, keypair.address),
10000
)) as any;
)) as unknown as AssetAccountResult;
if (isCancelled) return;
if (pezResult.isSome) {
setBalances((prev) => ({
@@ -126,9 +146,9 @@ export function PoolsModal({ isOpen, onClose }: PoolsModalProps) {
}
const usdtResult = (await withTimeout(
(assetHubApi.query.assets as any).account(1000, keypair.address),
assetHubApi.query.assets.account(1000, keypair.address),
10000
)) as any;
)) as unknown as AssetAccountResult;
if (isCancelled) return;
if (usdtResult.isSome) {
setBalances((prev) => ({
@@ -175,7 +195,9 @@ export function PoolsModal({ isOpen, onClose }: PoolsModalProps) {
const oneUnit = BigInt(Math.pow(10, token0.decimals));
const quote = await withTimeout(
(assetHubApi.call as any).assetConversionApi.quotePriceExactTokensForTokens(
(
assetHubApi.call as unknown as AssetConversionCall
).assetConversionApi.quotePriceExactTokensForTokens(
formatAssetLocation(asset0),
formatAssetLocation(asset1),
oneUnit.toString(),
@@ -184,11 +206,8 @@ export function PoolsModal({ isOpen, onClose }: PoolsModalProps) {
10000
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (quote && !(quote as any).isNone) {
price =
Number(BigInt((quote as any).unwrap().toString())) /
Math.pow(10, token1.decimals);
if (quote && !quote.isNone) {
price = Number(BigInt(quote.unwrap().toString())) / Math.pow(10, token1.decimals);
// Estimate reserves from LP supply
const lpAsset = await withTimeout(
@@ -283,6 +302,10 @@ export function PoolsModal({ isOpen, onClose }: PoolsModalProps) {
return () => {
isCancelled = true;
};
// `t` is intentionally omitted: it is only used for error messages and its
// identity changes only on language switch — including it would re-run the
// blockchain fetch (extra RPC calls) on every language change.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isOpen, assetHubApi, keypair]);
// Auto-calculate amount1 based on pool price
@@ -326,28 +349,36 @@ export function PoolsModal({ isOpen, onClose }: PoolsModalProps) {
keypair.address
);
// Minimal shape of the signAndSend result fields we read. `asModule`
// is typed from the registry call so it stays type-safe.
type TxResult = {
status: { isFinalized: boolean };
dispatchError?: {
isModule: boolean;
asModule: Parameters<typeof assetHubApi.registry.findMetaError>[0];
toString(): string;
};
};
// Wait for transaction to be finalized
await new Promise<void>((resolve, reject) => {
tx.signAndSend(
keypair,
({ status, dispatchError }: { status: any; dispatchError: any }) => {
if (status.isFinalized) {
if (dispatchError) {
let errorMsg = t('pools.addFailed');
if (dispatchError.isModule) {
const decoded = assetHubApi.registry.findMetaError(dispatchError.asModule);
errorMsg = `${decoded.section}.${decoded.name}: ${decoded.docs.join(' ')}`;
} else if (dispatchError.toString) {
errorMsg = dispatchError.toString();
}
console.error('Add liquidity error:', errorMsg);
reject(new Error(errorMsg));
} else {
resolve();
tx.signAndSend(keypair, ({ status, dispatchError }: TxResult) => {
if (status.isFinalized) {
if (dispatchError) {
let errorMsg = t('pools.addFailed');
if (dispatchError.isModule) {
const decoded = assetHubApi.registry.findMetaError(dispatchError.asModule);
errorMsg = `${decoded.section}.${decoded.name}: ${decoded.docs.join(' ')}`;
} else if (dispatchError.toString) {
errorMsg = dispatchError.toString();
}
console.error('Add liquidity error:', errorMsg);
reject(new Error(errorMsg));
} else {
resolve();
}
}
).catch(reject);
}).catch(reject);
});
setSuccessMessage(
@@ -420,28 +451,36 @@ export function PoolsModal({ isOpen, onClose }: PoolsModalProps) {
keypair.address
);
// Minimal shape of the signAndSend result fields we read. `asModule`
// is typed from the registry call so it stays type-safe.
type TxResult = {
status: { isFinalized: boolean };
dispatchError?: {
isModule: boolean;
asModule: Parameters<typeof assetHubApi.registry.findMetaError>[0];
toString(): string;
};
};
// Wait for transaction to be finalized
await new Promise<void>((resolve, reject) => {
tx.signAndSend(
keypair,
({ status, dispatchError }: { status: any; dispatchError: any }) => {
if (status.isFinalized) {
if (dispatchError) {
let errorMsg = t('pools.removeFailed');
if (dispatchError.isModule) {
const decoded = assetHubApi.registry.findMetaError(dispatchError.asModule);
errorMsg = `${decoded.section}.${decoded.name}: ${decoded.docs.join(' ')}`;
} else if (dispatchError.toString) {
errorMsg = dispatchError.toString();
}
console.error('Remove liquidity error:', errorMsg);
reject(new Error(errorMsg));
} else {
resolve();
tx.signAndSend(keypair, ({ status, dispatchError }: TxResult) => {
if (status.isFinalized) {
if (dispatchError) {
let errorMsg = t('pools.removeFailed');
if (dispatchError.isModule) {
const decoded = assetHubApi.registry.findMetaError(dispatchError.asModule);
errorMsg = `${decoded.section}.${decoded.name}: ${decoded.docs.join(' ')}`;
} else if (dispatchError.toString) {
errorMsg = dispatchError.toString();
}
console.error('Remove liquidity error:', errorMsg);
reject(new Error(errorMsg));
} else {
resolve();
}
}
).catch(reject);
}).catch(reject);
});
setSuccessMessage(t('pools.removedLiquidity', { amount: lpAmountToRemove }));
+59 -21
View File
@@ -74,10 +74,25 @@ export function SwapModal({ isOpen, onClose }: SwapModalProps) {
const hezFree = hezAccount.data.free.toString();
const hezBalance = (parseInt(hezFree) / 1e12).toFixed(4);
// Helper to extract balance from asset query result
const getAssetBalance = (result: any, decimals: number, fractionDigits: number): string => {
// Helper to extract balance from an asset storage query result. The
// shape is the subset of the @pezkuwi/api Option/Codec result we read.
type AssetQueryResult = {
isEmpty: boolean;
isSome?: boolean;
unwrap?: () => { toJSON(): unknown };
toJSON(): unknown;
};
const getAssetBalance = (
result: AssetQueryResult | null,
decimals: number,
fractionDigits: number
): string => {
if (!result || result.isEmpty) return '0'.padEnd(fractionDigits + 2, '0');
const data = result.isSome ? result.unwrap().toJSON() : result.toJSON();
const data = (
result.isSome && result.unwrap ? result.unwrap().toJSON() : result.toJSON()
) as {
balance?: { toString(): string };
} | null;
if (data && data.balance) {
return (parseInt(data.balance.toString()) / Math.pow(10, decimals)).toFixed(
fractionDigits
@@ -155,8 +170,21 @@ export function SwapModal({ isOpen, onClose }: SwapModalProps) {
const decimals2 = getDecimals(asset2);
const oneUnit = BigInt(Math.pow(10, decimals1));
// assetConversionApi is a runtime API not present in the base
// @pezkuwi/api typings; describe just the call we use.
type QuoteResult = { isNone: boolean; unwrap(): { toString(): string } };
type AssetConversionCall = {
assetConversionApi: {
quotePriceExactTokensForTokens: (
asset1: ReturnType<typeof formatAssetLocation>,
asset2: ReturnType<typeof formatAssetLocation>,
amount: string,
includeFee: boolean
) => Promise<QuoteResult>;
};
};
const quote = await (
assetHubApi.call as any
assetHubApi.call as unknown as AssetConversionCall
).assetConversionApi.quotePriceExactTokensForTokens(
formatAssetLocation(asset1),
formatAssetLocation(asset2),
@@ -257,28 +285,38 @@ export function SwapModal({ isOpen, onClose }: SwapModalProps) {
true
);
// Minimal shape of the signAndSend result fields we read (the full
// @pezkuwi/api ISubmittableResult is unavailable because `tx` above is
// produced from an untyped runtime extrinsic).
type SwapDispatchError = {
isModule: boolean;
asModule: Parameters<typeof assetHubApi.registry.findMetaError>[0];
toString(): string;
};
type SwapTxResult = {
status: { isFinalized: boolean };
dispatchError?: SwapDispatchError;
};
// Wait for transaction to be finalized
await new Promise<void>((resolve, reject) => {
tx.signAndSend(
keypair,
({ status, dispatchError }: { status: any; dispatchError: any }) => {
if (status.isFinalized) {
if (dispatchError) {
let errorMsg = t('swap.swapFailed');
if (dispatchError.isModule) {
const decoded = assetHubApi.registry.findMetaError(dispatchError.asModule);
errorMsg = `${decoded.section}.${decoded.name}: ${decoded.docs.join(' ')}`;
} else if (dispatchError.toString) {
errorMsg = dispatchError.toString();
}
console.error('Swap error:', errorMsg);
reject(new Error(errorMsg));
} else {
resolve();
tx.signAndSend(keypair, ({ status, dispatchError }: SwapTxResult) => {
if (status.isFinalized) {
if (dispatchError) {
let errorMsg = t('swap.swapFailed');
if (dispatchError.isModule) {
const decoded = assetHubApi.registry.findMetaError(dispatchError.asModule);
errorMsg = `${decoded.section}.${decoded.name}: ${decoded.docs.join(' ')}`;
} else if (dispatchError.toString) {
errorMsg = dispatchError.toString();
}
console.error('Swap error:', errorMsg);
reject(new Error(errorMsg));
} else {
resolve();
}
}
).catch(reject);
}).catch(reject);
});
setSuccess(true);
+74 -39
View File
@@ -21,11 +21,14 @@ import {
TrendingDown,
Fuel,
} from 'lucide-react';
import type { ApiPromise } from '@pezkuwi/api';
import { useWallet } from '@/contexts/WalletContext';
import { useTelegram } from '@/hooks/useTelegram';
import { useTranslation } from '@/i18n';
import {
subscribeToConnection,
subscribeToAssetHubConnection,
subscribeToPeopleConnection,
getLastError,
getAssetHubAPI,
getPeopleAPI,
@@ -76,6 +79,7 @@ interface TokenConfig {
logo: string;
isDefault: boolean;
priority: number; // Lower = higher in list
standard?: 'PEZ-20'; // fungible Asset Hub asset → PEZ-20 token standard
}
const DEFAULT_TOKENS: TokenConfig[] = [
@@ -98,6 +102,7 @@ const DEFAULT_TOKENS: TokenConfig[] = [
logo: '/tokens/PEZ.png',
isDefault: true,
priority: 1,
standard: 'PEZ-20',
},
{
assetId: ASSET_IDS.WUSDT,
@@ -108,6 +113,7 @@ const DEFAULT_TOKENS: TokenConfig[] = [
logo: '/tokens/USDT.png',
isDefault: true,
priority: 2,
standard: 'PEZ-20',
},
{
assetId: ASSET_IDS.DOT,
@@ -209,51 +215,68 @@ export function TokensCard({ onSendToken }: Props) {
return () => unsubscribe();
}, []);
// Fetch multi-chain HEZ balances (Asset Hub & People Chain)
// Live multi-chain HEZ balances (Asset Hub & People Chain).
// Uses real-time storage subscriptions and (re)subscribes the moment each
// chain connects — so balances populate as soon as the chain is ready and
// update instantly on any change (no 30s polling lag, no stuck "--").
useEffect(() => {
if (!address) return;
let cancelled = false;
let ahBalUnsub: (() => void) | null = null;
let peopleBalUnsub: (() => void) | null = null;
const fetchMultiChainBalances = async () => {
// Asset Hub HEZ balance
const assetHubApi = getAssetHubAPI();
if (assetHubApi) {
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const accountInfo = (await (assetHubApi.query.system as any).account(address)) as {
data: { free: { toString(): string } };
};
const free = accountInfo.data.free.toString();
const balanceNum = Number(free) / 1e12;
setAssetHubHezBalance(balanceNum.toFixed(4));
} catch (err) {
console.error('Error fetching Asset Hub HEZ balance:', err);
setAssetHubHezBalance('0.0000');
}
}
// People Chain HEZ balance
const peopleApi = getPeopleAPI();
if (peopleApi) {
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const accountInfo = (await (peopleApi.query.system as any).account(address)) as {
data: { free: { toString(): string } };
};
const free = accountInfo.data.free.toString();
const balanceNum = Number(free) / 1e12;
setPeopleHezBalance(balanceNum.toFixed(4));
} catch (err) {
console.error('Error fetching People Chain HEZ balance:', err);
setPeopleHezBalance('0.0000');
}
type AccountInfo = { data: { free: { toString(): string } } };
const liveBalance = async (
api: ApiPromise | null,
setBalance: (v: string) => void,
label: string
) => {
if (!api) return null;
try {
// callback form = live subscription, fires on every change
const unsub = await api.query.system.account(address, (info: AccountInfo) => {
const balanceNum = Number(info.data.free.toString()) / 1e12;
setBalance(balanceNum.toFixed(4));
});
return unsub as unknown as () => void;
} catch (err) {
console.error(`Error subscribing to ${label} HEZ balance:`, err);
return null;
}
};
fetchMultiChainBalances();
// Refresh every 30 seconds
const interval = setInterval(fetchMultiChainBalances, 30000);
return () => clearInterval(interval);
}, [address, rpcConnected]);
const unsubAhConn = subscribeToAssetHubConnection(async (connected) => {
if (ahBalUnsub) {
ahBalUnsub();
ahBalUnsub = null;
}
if (connected) {
const u = await liveBalance(getAssetHubAPI(), setAssetHubHezBalance, 'Asset Hub');
if (cancelled) u?.();
else ahBalUnsub = u;
}
});
const unsubPeopleConn = subscribeToPeopleConnection(async (connected) => {
if (peopleBalUnsub) {
peopleBalUnsub();
peopleBalUnsub = null;
}
if (connected) {
const u = await liveBalance(getPeopleAPI(), setPeopleHezBalance, 'People Chain');
if (cancelled) u?.();
else peopleBalUnsub = u;
}
});
return () => {
cancelled = true;
if (ahBalUnsub) ahBalUnsub();
if (peopleBalUnsub) peopleBalUnsub();
unsubAhConn();
unsubPeopleConn();
};
}, [address]);
// Initialize with default tokens immediately (no API required)
const [tokens, setTokens] = useState<TokenBalance[]>(() =>
@@ -838,6 +861,18 @@ export function TokensCard({ onSendToken }: Props) {
<div>
<div className="flex items-center gap-2">
<span className="font-semibold">{token.displaySymbol}</span>
{token.standard === 'PEZ-20' && (
<a
href="https://docs.pezkuwichain.io/token-standards"
target="_blank"
rel="noopener noreferrer"
onClick={(e) => e.stopPropagation()}
title="PEZ-20 token standard on Pezkuwi Asset Hub"
className="text-[10px] bg-blue-500/20 text-blue-300 px-1.5 py-0.5 rounded no-underline"
>
PEZ-20
</a>
)}
{token.assetId <= -100 && (
<span className="text-[10px] bg-purple-500/20 text-purple-400 px-1.5 py-0.5 rounded">
LP
+12 -3
View File
@@ -1103,14 +1103,23 @@ function SendTab({ onBack }: { onBack: () => void }) {
let tx;
if (selectedToken === 'HEZ') {
// HEZ transfer on main chain
// HEZ transfer on main chain (api guaranteed by the guard above, but
// narrow again here so TS knows it is non-null in this branch).
if (!api) {
setError(t('send.mainnetApiNotReady'));
return;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
tx = (api!.tx.balances as any).transferKeepAlive(toAddress, amountInSmallestUnit);
tx = (api.tx.balances as any).transferKeepAlive(toAddress, amountInSmallestUnit);
} else {
// Asset transfer on Asset Hub (PEZ: asset ID 1, USDT: asset ID 1000)
if (!assetHubApi) {
setError(t('send.assetHubApiNotReady'));
return;
}
const assetId = tokenInfo?.assetId ?? 1;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
tx = (assetHubApi!.tx.assets as any).transfer(assetId, toAddress, amountInSmallestUnit);
tx = (assetHubApi.tx.assets as any).transfer(assetId, toAddress, amountInSmallestUnit);
}
const hash = await tx.signAndSend(keypair);
+3 -1
View File
@@ -73,7 +73,9 @@ export async function getPendingReferral(api: ApiPromise, address: string): Prom
try {
// Check if referral pallet exists
if (!isReferralPalletAvailable(api)) {
console.log('Referral pallet not available on this chain');
if (import.meta.env.DEV) {
console.warn('Referral pallet not available on this chain');
}
return null;
}
+15 -9
View File
@@ -306,27 +306,33 @@ const TIKI_NAME_SCORES: Record<string, number> = {
* Storage: tiki.userTikis(address) -> Vec<TikiRole>
*/
export async function fetchUserTikis(peopleApi: ApiPromise, address: string): Promise<TikiInfo[]> {
// The `tiki` pallet is not part of the base @pezkuwi/api typings, so we
// describe just the storage entries we read here.
type TikiStorageResult = { isEmpty: boolean; toJSON(): unknown };
type TikiQuery = {
userTikis?: (address: string) => Promise<TikiStorageResult>;
userRoles?: (address: string) => Promise<TikiStorageResult>;
};
type TikiEntry = string | { name?: string; role?: string };
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (!(peopleApi?.query as any)?.tiki) {
const tikiQuery = (peopleApi?.query as { tiki?: TikiQuery } | undefined)?.tiki;
if (!tikiQuery) {
return [];
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let result = await (peopleApi.query.tiki as any).userTikis?.(address);
let result = await tikiQuery.userTikis?.(address);
// Fallback to userRoles if userTikis doesn't exist
if (!result && (peopleApi.query.tiki as any).userRoles) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
result = await (peopleApi.query.tiki as any).userRoles?.(address);
if (!result && tikiQuery.userRoles) {
result = await tikiQuery.userRoles?.(address);
}
if (!result || result.isEmpty) {
return [];
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const tikis = result.toJSON() as any[];
const tikis = result.toJSON() as TikiEntry[];
return tikis.map((tiki, index) => {
const name = typeof tiki === 'string' ? tiki : tiki.name || tiki.role || 'Unknown';
+8 -5
View File
@@ -9,13 +9,16 @@ import { LanguageProvider } from './i18n';
import App from './App';
import './index.css';
// Suppress console logs in production
// Suppress non-critical console output in production. This is the one place
// that legitimately overrides console.log/debug/info — warn/error are kept for
// critical issues. The no-console rule is disabled only for these assignments.
if (import.meta.env.PROD) {
const noop = () => {};
console.log = noop;
console.debug = noop;
console.info = noop;
// Keep console.warn and console.error for critical issues
const suppressed: Array<'log' | 'debug' | 'info'> = ['log', 'debug', 'info'];
for (const method of suppressed) {
// eslint-disable-next-line no-console
console[method] = noop;
}
}
// Initialize Telegram WebApp
+3 -3
View File
@@ -1,5 +1,5 @@
{
"version": "1.0.230",
"buildTime": "2026-02-27T23:33:39.279Z",
"buildNumber": 1772235219280
"version": "1.0.233",
"buildTime": "2026-06-13T04:42:17.513Z",
"buildNumber": 1781325737513
}