Skip to content

Comments

More fixes to XCM V3#74

Merged
albertov19 merged 6 commits intomainfrom
albertov19/xcmv3
May 5, 2023
Merged

More fixes to XCM V3#74
albertov19 merged 6 commits intomainfrom
albertov19/xcmv3

Conversation

@albertov19
Copy link
Collaborator

Probably some work still needed as this will change with the next runtime

@albertov19 albertov19 requested a review from jboetticher April 21, 2023 09:01
@albertov19 albertov19 changed the title Revamps Account Coverter More fixes to XCM V3 May 3, 2023
Copy link
Contributor

@jboetticher jboetticher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm approving this, but I think that you could make a helper function since the same logic seems to be repeating:

export async function getXCMVersion(api) {
    // Get XCM Version - Not great but there is no chain state approach
    const xcmpQueueVersion = (await api.query.xcmpQueue.palletVersion()) as any;
    const xcmSafeVersion = (await api.query.polkadotXcm.safeXcmVersion()) as any;
    const xcmVersion = `V${Math.max(xcmpQueueVersion, xcmSafeVersion).toString()}`;
  
    // Get XCM Versioned Multilocation Type
    const isV3 = xcmVersion === "V3";
    const xcmType = isV3 ? "XcmV3MultiLocation" : "XcmV1MultiLocation";

    return [xcmVersion, isV3, xcmType];
}

@albertov19
Copy link
Collaborator Author

@jboetticher I did my function without noticing you provided one haha. Anyways I implemented it. Did not use isV3 because I prefer to check version in the codes themselves than in the helper.

I'll merge

@albertov19 albertov19 merged commit 172f605 into main May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants