From 6b52c90ed846de0e89c2101ad9e6f1913edef444 Mon Sep 17 00:00:00 2001 From: Aleksandr Makhnev Date: Tue, 24 Dec 2024 13:44:41 +0500 Subject: [PATCH] Fix: xcm transfer (#2893) --- src/renderer/shared/api/xcm/lib/xcm-utils.ts | 10 ---------- .../widgets/Transfer/model/xcm-transfer-model.ts | 15 ++++++++------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/renderer/shared/api/xcm/lib/xcm-utils.ts b/src/renderer/shared/api/xcm/lib/xcm-utils.ts index 22c8f561c..4a95cf335 100644 --- a/src/renderer/shared/api/xcm/lib/xcm-utils.ts +++ b/src/renderer/shared/api/xcm/lib/xcm-utils.ts @@ -105,16 +105,6 @@ function createJunctionFromObject(data: Record) { if (entries.length === 0) return 'Here'; - if (entries.length === 1) { - return { - X1: [ - { - [JunctionType[entries[0][0] as JunctionTypeKey]]: entries[0][1], - }, - ], - }; - } - return { [`X${entries.length}`]: entries .sort((a, b) => sortJunctions(a[0], b[0])) diff --git a/src/renderer/widgets/Transfer/model/xcm-transfer-model.ts b/src/renderer/widgets/Transfer/model/xcm-transfer-model.ts index b0a62e883..01fd01048 100644 --- a/src/renderer/widgets/Transfer/model/xcm-transfer-model.ts +++ b/src/renderer/widgets/Transfer/model/xcm-transfer-model.ts @@ -32,11 +32,7 @@ const saveConfigFx = attach({ effect: xcmModel.effects.saveConfigFx }); const fetchConfigFx = attach({ effect: xcmModel.effects.fetchConfigFx }); const getXcmParaIdFx = createEffect((api: ApiPromise): Promise => { - try { - return getParachainId(api); - } catch { - return Promise.resolve(null); - } + return getParachainId(api); }); const $xcmAsset = combine( @@ -136,7 +132,7 @@ const $txDestination = combine( (params) => { const { api, destination, network, xcmParaId, transferDirection } = params; - if (!api || !network || xcmParaId === null || !transferDirection) return undefined; + if (!api || !network || !transferDirection) return undefined; if (transferDirection.type === XcmTransferType.XTOKENS && destination) { return xcmService.getVersionedDestinationLocation( @@ -257,7 +253,12 @@ sample({ sample({ clock: getXcmParaIdFx.doneData, - filter: (xcmParaId) => xcmParaId !== null, + target: $xcmParaId, +}); + +sample({ + clock: getXcmParaIdFx.fail, + fn: () => null, target: $xcmParaId, });