Skip to content

Commit

Permalink
apply type inference and fix tyeps
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaurello committed Nov 13, 2024
1 parent 4c435b1 commit 5ad661f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/builder/src/extrinsic/ExtrinsicBuilder.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,18 @@ export function isXcmV4(xcmVersion: XcmVersion): boolean {
return xcmVersion >= XcmVersion.v4;
}

export function normalizeX1(xcmVersion: XcmVersion, versionedObject: Record<string, AnyJson>) {
export function normalizeX1(
xcmVersion: XcmVersion,
versionedObject: Record<string, AnyJson | object>,
) {
if (!isXcmV4(xcmVersion)) return versionedObject;

const normalizedObject = { ...versionedObject };
const interior = normalizedObject.interior;
const interior = normalizedObject.interior as object;

if (interior?.X1 && !Array.isArray(interior.X1)) {
if ('X1' in interior && interior?.X1 && !Array.isArray(interior.X1)) {
interior.X1 = [interior.X1];
} else if (interior?.x1 && !Array.isArray(interior.x1)) {
} else if ('x1' in interior && interior?.x1 && !Array.isArray(interior.x1)) {
interior.x1 = [interior.x1];
}

Expand Down

0 comments on commit 5ad661f

Please sign in to comment.