Skip to content

Commit

Permalink
Support xcmPallet.transferAssets
Browse files Browse the repository at this point in the history
  • Loading branch information
valentunn committed Nov 19, 2024
1 parent 2d4cbaf commit 9f30cc3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ sealed class AssetLocationPath {
}

enum class XcmTransferType {
X_TOKENS, XCM_PALLET_RESERVE, XCM_PALLET_TELEPORT, UNKNOWN
X_TOKENS,
XCM_PALLET_RESERVE,
XCM_PALLET_TELEPORT,
XCM_PALLET_TRANSFER_ASSETS,
UNKNOWN
}

enum class XCMInstructionType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ private fun mapXcmTransferTypeFromRemote(remote: String): XcmTransferType {
"xtokens" -> XcmTransferType.X_TOKENS
"xcmpallet" -> XcmTransferType.XCM_PALLET_RESERVE
"xcmpallet-teleport" -> XcmTransferType.XCM_PALLET_TELEPORT
"xcmpallet-transferAssets" -> XcmTransferType.XCM_PALLET_TRANSFER_ASSETS
else -> XcmTransferType.UNKNOWN
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class RealCrossChainTransactor(
XcmTransferType.X_TOKENS -> xTokensTransfer(configuration, transfer, crossChainFee)
XcmTransferType.XCM_PALLET_RESERVE -> xcmPalletReserveTransfer(configuration, transfer, crossChainFee)
XcmTransferType.XCM_PALLET_TELEPORT -> xcmPalletTeleport(configuration, transfer, crossChainFee)
XcmTransferType.XCM_PALLET_TRANSFER_ASSETS -> xcmPalletTransferAssets(configuration, transfer, crossChainFee)
XcmTransferType.UNKNOWN -> throw IllegalArgumentException("Unknown transfer type")
}
}
Expand Down Expand Up @@ -126,6 +127,20 @@ class RealCrossChainTransactor(
}

private fun destWeightEncodable(weight: Weight): Any = weight

private suspend fun ExtrinsicBuilder.xcmPalletTransferAssets(
configuration: CrossChainTransferConfiguration,
assetTransfer: AssetTransfer,
crossChainFee: Balance
) {
xcmPalletTransfer(
configuration = configuration,
assetTransfer = assetTransfer,
crossChainFee = crossChainFee,
callName = "transfer_assets"
)
}

private suspend fun ExtrinsicBuilder.xcmPalletReserveTransfer(
configuration: CrossChainTransferConfiguration,
assetTransfer: AssetTransfer,
Expand Down

0 comments on commit 9f30cc3

Please sign in to comment.