Fix cross-chain XCM config parsing for destination field

The XCM config JSON has a nested structure where chainId and assetId
are inside a "destination" object, but the Kotlin class expected them
at the root level. This was causing NullPointerException when parsing
cross-chain transfer configurations.

Changes:
- Add XcmTransferDestinationRemote class to represent nested destination
- Update DynamicXcmTransferRemote to use destination object instead of
  flat chainId/assetId fields
- Update Dynamic.kt mapping to access transfer.destination.chainId/assetId

This fixes cross-chain transfers between Pezkuwi, Pezkuwi Asset Hub,
and Pezkuwi People chains.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-08 05:23:23 +03:00
parent 81c3e1bbaa
commit 9babf454c9
2 changed files with 11 additions and 3 deletions
@@ -63,7 +63,10 @@ private fun constructTransfersForChain(configRemote: DynamicCrossChainOriginChai
assetId = assetConfig.assetId,
destinations = assetConfig.xcmTransfers.map { transfer ->
TransferDestination(
fullChainAssetId = FullChainAssetId(transfer.chainId, transfer.assetId),
fullChainAssetId = FullChainAssetId(
transfer.destination.chainId,
transfer.destination.assetId
),
hasDeliveryFee = transfer.hasDeliveryFee ?: false,
supportsXcmExecute = transfer.supportsXcmExecute ?: false,
)
@@ -33,8 +33,13 @@ class DynamicCrossChainOriginAssetRemote(
)
class DynamicXcmTransferRemote(
val chainId: ChainId,
val assetId: Int,
val destination: XcmTransferDestinationRemote,
val type: String?,
val hasDeliveryFee: Boolean?,
val supportsXcmExecute: Boolean?,
)
class XcmTransferDestinationRemote(
val chainId: ChainId,
val assetId: Int,
)