Skip to content

Commit

Permalink
Fix: xcm transfer (#2893)
Browse files Browse the repository at this point in the history
  • Loading branch information
Asmadek authored Dec 24, 2024
1 parent e13327e commit 6b52c90
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
10 changes: 0 additions & 10 deletions src/renderer/shared/api/xcm/lib/xcm-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,6 @@ function createJunctionFromObject(data: Record<string, unknown>) {

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]))
Expand Down
15 changes: 8 additions & 7 deletions src/renderer/widgets/Transfer/model/xcm-transfer-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ const saveConfigFx = attach({ effect: xcmModel.effects.saveConfigFx });
const fetchConfigFx = attach({ effect: xcmModel.effects.fetchConfigFx });

const getXcmParaIdFx = createEffect((api: ApiPromise): Promise<number | null> => {
try {
return getParachainId(api);
} catch {
return Promise.resolve(null);
}
return getParachainId(api);
});

const $xcmAsset = combine(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -257,7 +253,12 @@ sample({

sample({
clock: getXcmParaIdFx.doneData,
filter: (xcmParaId) => xcmParaId !== null,
target: $xcmParaId,
});

sample({
clock: getXcmParaIdFx.fail,
fn: () => null,
target: $xcmParaId,
});

Expand Down

0 comments on commit 6b52c90

Please sign in to comment.