Skip to content

Commit

Permalink
fix: interlay xcm transfer (#2914)
Browse files Browse the repository at this point in the history
  • Loading branch information
Asmadek authored Dec 27, 2024
1 parent 2815bd7 commit 8bb7d6a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/renderer/shared/api/xcm/service/xcmService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,29 @@ function getEstimatedRequiredDestWeight(
return weight.gte(reserveWeight) ? weight : reserveWeight;
}

function getFixedVersion(location: string) {
return {
// TODO: check Interlay transfer later
INTR: 'V2',
}[location];
}

function getAssetLocation(
api: ApiPromise,
transferType: XcmTransferType,
asset: AssetXCM,
assets: Record<AssetName, AssetLocation>,
assetsConfig: Record<AssetName, AssetLocation>,
amount: BN,
isArray = true,
): NonNullable<unknown> | undefined {
const type = getTypeName(api, transferType, isArray ? 'assets' : 'asset');
const assetVersionType = getTypeVersion(api, type || '');
const assetVersionType = getFixedVersion(asset.assetLocation) || getTypeVersion(api, type || '');

const PathMap: Record<PathType, () => NonNullable<unknown> | undefined> = {
relative: () => xcmUtils.getRelativeAssetLocation(assetVersionType, assets[asset.assetLocation].multiLocation),
absolute: () => xcmUtils.getAbsoluteAssetLocation(assetVersionType, assets[asset.assetLocation].multiLocation),
relative: () =>
xcmUtils.getRelativeAssetLocation(assetVersionType, assetsConfig[asset.assetLocation].multiLocation),
absolute: () =>
xcmUtils.getAbsoluteAssetLocation(assetVersionType, assetsConfig[asset.assetLocation].multiLocation),
concrete: () => xcmUtils.getConcreteAssetLocation(assetVersionType, asset.assetLocationPath.path),
};

Expand Down

0 comments on commit 8bb7d6a

Please sign in to comment.