mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-06-13 21:31:01 +00:00
fix: use Asset Hub API for wUSDT and wHEZ transfers
- wUSDT, wHEZ, and PEZ are all on Asset Hub - Transfer was failing because code used relay chain API for wUSDT
This commit is contained in:
@@ -97,12 +97,18 @@ export const TransferModal: React.FC<TransferModalProps> = ({ isOpen, onClose, s
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if PEZ transfer but Asset Hub not ready
|
// Check if Asset Hub transfer (PEZ, wUSDT, wHEZ are on Asset Hub)
|
||||||
const isPezTransfer = currentToken.symbol === 'PEZ' || currentToken.assetId === 1;
|
const isAssetHubTransfer = currentToken.symbol === 'PEZ' ||
|
||||||
if (isPezTransfer && (!assetHubApi || !isAssetHubReady)) {
|
currentToken.symbol === 'USDT' ||
|
||||||
|
currentToken.symbol === 'wUSDT' ||
|
||||||
|
currentToken.symbol === 'wHEZ' ||
|
||||||
|
currentToken.assetId === 1 || // PEZ
|
||||||
|
currentToken.assetId === 2 || // wHEZ
|
||||||
|
currentToken.assetId === 1000; // wUSDT
|
||||||
|
if (isAssetHubTransfer && (!assetHubApi || !isAssetHubReady)) {
|
||||||
toast({
|
toast({
|
||||||
title: "Error",
|
title: "Error",
|
||||||
description: "Asset Hub connection not ready. PEZ is on Asset Hub.",
|
description: "Asset Hub connection not ready. This token is on Asset Hub.",
|
||||||
variant: "destructive",
|
variant: "destructive",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@@ -133,12 +139,12 @@ export const TransferModal: React.FC<TransferModalProps> = ({ isOpen, onClose, s
|
|||||||
|
|
||||||
// Create appropriate transfer transaction based on token type
|
// Create appropriate transfer transaction based on token type
|
||||||
// HEZ uses native token transfer (balances pallet on main chain)
|
// HEZ uses native token transfer (balances pallet on main chain)
|
||||||
// PEZ uses assets pallet on Asset Hub (asset ID: 1)
|
// PEZ, wHEZ, wUSDT use assets pallet on Asset Hub
|
||||||
if (currentToken.assetId === undefined || (selectedToken === 'HEZ' && !selectedAsset)) {
|
if (currentToken.assetId === undefined || (selectedToken === 'HEZ' && !selectedAsset)) {
|
||||||
// Native HEZ token transfer on main chain
|
// Native HEZ token transfer on main chain
|
||||||
transfer = api.tx.balances.transferKeepAlive(recipient, amountInSmallestUnit.toString());
|
transfer = api.tx.balances.transferKeepAlive(recipient, amountInSmallestUnit.toString());
|
||||||
} else if (isPezTransfer) {
|
} else if (isAssetHubTransfer) {
|
||||||
// PEZ transfer on Asset Hub (asset ID: 1)
|
// Asset Hub transfer (PEZ, wHEZ, wUSDT)
|
||||||
targetApi = assetHubApi!;
|
targetApi = assetHubApi!;
|
||||||
transfer = assetHubApi!.tx.assets.transfer(currentToken.assetId, recipient, amountInSmallestUnit.toString());
|
transfer = assetHubApi!.tx.assets.transfer(currentToken.assetId, recipient, amountInSmallestUnit.toString());
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user