fix: correct wHEZ asset ID from 0 to 2

tokenWrapper pallet on Asset Hub creates wHEZ as Asset ID 2, not 0.

Asset IDs on Asset Hub:
- Asset 1: PEZ
- Asset 2: wHEZ (via tokenWrapper)
- Asset 1000: wUSDT

Updated:
- shared/constants/index.ts: KNOWN_TOKENS
- shared/lib/wallet.ts: ASSET_IDS.WHEZ default
- AccountBalance.tsx: pool queries
- InitializeHezPoolModal.tsx: balance query
This commit is contained in:
2026-02-04 13:52:47 +03:00
parent c8fef32558
commit db381c803d
4 changed files with 18 additions and 12 deletions
+2 -2
View File
@@ -175,13 +175,13 @@ export const AccountBalance: React.FC = () => {
// Only fetch HEZ from DEX if not already set
if (hezPrice === 0) {
const whezPoolId = api.createType('(u32, u32)', [0, ASSET_IDS.WUSDT]);
const whezPoolId = api.createType('(u32, u32)', [ASSET_IDS.WHEZ, ASSET_IDS.WUSDT]);
const whezPalletIdType = api.createType('[u8; 8]', PALLET_ID);
const whezFullTuple = api.createType('([u8; 8], (u32, u32))', [whezPalletIdType, whezPoolId]);
const whezAccountHash = blake2AsU8a(whezFullTuple.toU8a(), 256);
const whezPoolAccountId = api.createType('AccountId32', whezAccountHash);
const whezReserve0Query = await api.query.assets.account(0, whezPoolAccountId);
const whezReserve0Query = await api.query.assets.account(ASSET_IDS.WHEZ, whezPoolAccountId);
const whezReserve1Query = await api.query.assets.account(ASSET_IDS.WUSDT, whezPoolAccountId);
if (whezReserve0Query.isSome && whezReserve1Query.isSome) {
@@ -85,8 +85,8 @@ export const InitializeHezPoolModal: React.FC<InitializeHezPoolModalProps> = ({
const freeBalance = balance.data.free.toString();
setHezBalance(freeBalance);
// wHEZ balance (asset 0 on Asset Hub)
const whezData = await assetHubApi.query.assets.account(0, account);
// wHEZ balance (asset 2 on Asset Hub - tokenWrapper creates asset 2)
const whezData = await assetHubApi.query.assets.account(2, account);
setWhezBalance(whezData.isSome ? whezData.unwrap().balance.toString() : '0');
} catch (error) {
if (import.meta.env.DEV) console.error('Failed to fetch balances from Asset Hub:', error);