Skip to content

Commit

Permalink
Merge pull request #1283 from novasamatech/fix/moonbeam-xcm
Browse files Browse the repository at this point in the history
Add support for new xcm type
  • Loading branch information
ERussel authored Nov 19, 2024
2 parents 38eee5a + d20c0d4 commit a9f00ff
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions novawallet/Common/Model/Xcm/XcmAssetTransfer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extension XcmAssetTransfer {
case xtokens
case xcmpallet
case teleport = "xcmpallet-teleport"
case xcmpalletTransferAssets = "xcmpallet-transferAssets"
case unknown

init(from decoder: Decoder) throws {
Expand All @@ -34,6 +35,8 @@ extension XcmAssetTransfer {
self = .xcmpallet
case Self.teleport.rawValue:
self = .teleport
case Self.xcmpalletTransferAssets.rawValue:
self = .xcmpalletTransferAssets
default:
self = .unknown
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extension XcmTransferService {
xcmTransfers: xcmTransfers,
runtimeProvider: runtimeProvider
)
case .xcmpallet, .teleport:
case .xcmpallet, .teleport, .xcmpalletTransferAssets:
let multiassetsVersionWrapper = xcmPalletQueryFactory.createLowestMultiassetsVersionWrapper(
for: runtimeProvider
)
Expand Down Expand Up @@ -115,6 +115,14 @@ extension XcmTransferService {
maxWeight: maxWeight,
runtimeProvider: runtimeProvider
)
case .xcmpalletTransferAssets:
return createPalletXcmTransferMapping(
dependingOn: moduleResolutionOperation,
callPathFactory: { Xcm.transferAssetsPath(for: $0) },
destinationAssetOperation: destinationAssetOperation,
maxWeight: maxWeight,
runtimeProvider: runtimeProvider
)
case .unknown:
return .createWithError(XcmAssetTransfer.TransferTypeError.unknownType)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ final class XcmTransferService {
switch transferType {
case .xtokens:
return xTokensQueryFactory.createModuleNameResolutionWrapper(for: runtimeProvider)
case .xcmpallet, .teleport:
case .xcmpallet, .teleport, .xcmpalletTransferAssets:
return xcmPalletQueryFactory.createModuleNameResolutionWrapper(for: runtimeProvider)
case .unknown:
return CompoundOperationWrapper.createWithError(XcmAssetTransfer.TransferTypeError.unknownType)
Expand Down
4 changes: 4 additions & 0 deletions novawallet/Common/Substrate/Calls/Xcm/XcmPalletTransfer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ extension Xcm {
static func limitedTeleportAssetsPath(for module: String) -> CallCodingPath {
CallCodingPath(moduleName: module, callName: "limited_teleport_assets")
}

static func transferAssetsPath(for module: String) -> CallCodingPath {
CallCodingPath(moduleName: module, callName: "transfer_assets")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ final class CrossChainTransferSetupPresenter: CrossChainTransferPresenter,
override func didReceiveCrossChainFee(result: Result<XcmFeeModelProtocol, Error>) {
super.didReceiveCrossChainFee(result: result)

logger?.debug("Did receive result: \(result)")

if case .success = result {
updateOriginFeeView()
updateCrossChainFeeView()
Expand Down

0 comments on commit a9f00ff

Please sign in to comment.