Skip to content

Commit

Permalink
Add xcm base types
Browse files Browse the repository at this point in the history
  • Loading branch information
TarikGul committed Oct 23, 2023
1 parent ce2d8e9 commit 957dba4
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions src/createXcmTypes/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import type { ApiPromise } from '@polkadot/api';
import { u32 } from '@polkadot/types';
import type { VersionedMultiAssets, WeightLimitV2 } from '@polkadot/types/interfaces';
import type { AnyJson } from '@polkadot/types/types';

import type { Registry } from '../registry';
import type { RequireOnlyOne, XCMDestBenificiary, XcmMultiLocation, XcmVersionedMultiAsset, XcmWeight } from '../types';
Expand All @@ -28,6 +29,89 @@ export type XcmJunction = {
Parachain: string;
};

export type XcmV2MultiLocation = {
parents: number;
interior: XcmV2Junctions;
};

export type XcmV2Junctions = {
Here: '' | null;
X1: XcmV2Junction;
X2: [XcmV2Junction, XcmV2Junction];
X3: [XcmV2Junction, XcmV2Junction, XcmV2Junction];
X4: [XcmV2Junction, XcmV2Junction, XcmV2Junction, XcmV2Junction];
X5: [XcmV2Junction, XcmV2Junction, XcmV2Junction, XcmV2Junction, XcmV2Junction];
X6: [XcmV2Junction, XcmV2Junction, XcmV2Junction, XcmV2Junction, XcmV2Junction, XcmV2Junction];
X7: [XcmV2Junction, XcmV2Junction, XcmV2Junction, XcmV2Junction, XcmV2Junction, XcmV2Junction, XcmV2Junction];
X8: [
XcmV2Junction,
XcmV2Junction,
XcmV2Junction,
XcmV2Junction,
XcmV2Junction,
XcmV2Junction,
XcmV2Junction,
XcmV2Junction
];
};

export type XcmV2Junction = RequireOnlyOne<XcmV2JunctionBase>;

export type XcmV2JunctionBase = {
Parachain: number;
AccountId32: { network?: XcmV2Network; id: string };
AccountIndex64: { network?: XcmV2Network; id: string };
AccountKey20: { network?: XcmV2Network; id: string };
PalletInstance: number;
GeneralIndex: string | number;
GeneralKey: string;
OnlyChild: AnyJson;
Plurality: { id: AnyJson; part: AnyJson };
};

export type XcmV2Network = string | null;

export type XcmV3MultiLocation = {
parents: number;
interior: XcmV3Junctions;
};

export type XcmV3Junctions = {
Here: '' | null;
X1: XcmV3Junction;
X2: [XcmV3Junction, XcmV3Junction];
X3: [XcmV3Junction, XcmV3Junction, XcmV3Junction];
X4: [XcmV3Junction, XcmV3Junction, XcmV3Junction, XcmV3Junction];
X5: [XcmV3Junction, XcmV3Junction, XcmV3Junction, XcmV3Junction, XcmV3Junction];
X6: [XcmV3Junction, XcmV3Junction, XcmV3Junction, XcmV3Junction, XcmV3Junction, XcmV3Junction];
X7: [XcmV3Junction, XcmV3Junction, XcmV3Junction, XcmV3Junction, XcmV3Junction, XcmV3Junction, XcmV3Junction];
X8: [
XcmV3Junction,
XcmV3Junction,
XcmV3Junction,
XcmV3Junction,
XcmV3Junction,
XcmV3Junction,
XcmV3Junction,
XcmV3Junction
];
};

export type XcmV3Junction = RequireOnlyOne<XcmV3JunctionBase>;

export type XcmV3JunctionBase = {
Parachain: number;
AccountId32: { network?: XcmV2Network; id: string };
AccountIndex64: { network?: XcmV2Network; id: string };
AccountKey20: { network?: XcmV2Network; id: string };
PalletInstance: number;
GeneralIndex: string | number;
GeneralKey: string;
OnlyChild: AnyJson;
Plurality: { id: AnyJson; part: AnyJson };
GlobalConsensus: string | AnyJson;
};

export interface CreateAssetsOpts {
registry: Registry;
isForeignAssetsTransfer: boolean;
Expand Down

0 comments on commit 957dba4

Please sign in to comment.