-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: support xcm version4 * feat: support xcm v4 * fix: disable test
- Loading branch information
1 parent
99cfcb6
commit c7e0d40
Showing
6 changed files
with
526 additions
and
446 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,41 @@ | ||
import { AnyApi } from "@acala-network/sdk-core"; | ||
|
||
export function checkMessageVersionIsV3(api: AnyApi) { | ||
export type XCMVersion = "V1" | "V3" | "V4"; | ||
|
||
export function checkMessageVersion(api: AnyApi) { | ||
return "V4"; | ||
|
||
let version: XCMVersion = "V1"; | ||
|
||
try { | ||
const keys = (api?.createType("XcmVersionedMultiLocation") as any) | ||
.defKeys as string[]; | ||
|
||
return keys.includes("V3"); | ||
if (keys.includes("V3")) { | ||
version = "V3"; | ||
} | ||
} catch (e) { | ||
try { | ||
const keys = (api?.createType("StagingXcmVersionedMultiLocation") as any) | ||
.defKeys as string[]; | ||
// ignore | ||
} | ||
|
||
try { | ||
const keys = (api?.createType("StagingXcmVersionedMultiLocation") as any) | ||
.defKeys as string[]; | ||
|
||
return keys.includes("V3"); | ||
} catch (e) { | ||
// ignore | ||
if (keys.includes("V3")) { | ||
version = "V3"; | ||
} | ||
// ignore error | ||
} catch (e) { | ||
// ignore | ||
} | ||
|
||
try { | ||
api?.createType("XcmVersionedLocation") as any; | ||
|
||
version = "V4"; | ||
} catch (e) { | ||
// ignore | ||
} | ||
|
||
return false; | ||
return version; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.