paritytech / capi

[WIP] A framework for crafting interactions with Substrate chains
https://docs.capi.dev
Apache License 2.0
104 stars 10 forks source link

XCM types #241

Open rphmeier opened 2 years ago

rphmeier commented 2 years ago

Are XCMv2 (and soon, v3) types included in the repo?

harrysolovay commented 2 years ago

We generally avoid hand-typing the on-chain world. However, devs can convert from raw JS equivalents.

Here is an excerpt of the type conversion doc:

RustTypeScript
```rs type T0 = (); type T1 = (A,); type T2 = (A, B); type T3 = Vec; type T4 = [u8; n]; type T5 = Vec; type T6 = [A; n]; type T7 = Option; type T8 = Result; struct S0; struct S1(A); struct S2(A, B); struct S3 { a: A }; enum E0 { A, B, C, }; enum E1 { A, B(C), D(E, F), G { h: H }, }; ``` ```ts type T0 = null; type T1 = A; type T2 = [A, B]; type T3 = Uint8Array; type T4 = Uint8Array & { length: n }; type T5 = A[]; type T6 = A[] & { length: n }; type T7 = A | undefined; type T8 = O | ChainError; type S0 = null; type S1 = A; type S2 = [A, B]; type S3 = { a: A }; type E0 = | "A" | "B" | "C"; type E1 = | { type: "A" } | { type: "B"; value: C } | { type: "D"; value: [E, F] } | { type: "G"; h: H }; ```

Regarding XCM types, here are corresponding TS types (generated by WIP #229).

See types ```ts export namespace xcm { export const $versionedMultiAssets: $.Codec = _codec.$144; export const $versionedMultiLocation: $.Codec = _codec.$149; export const $versionedResponse: $.Codec = _codec.$680; export const $versionedXcm: $.Codec = _codec.$413; export type VersionedMultiAssets = xcm.VersionedMultiAssets.V0 | xcm.VersionedMultiAssets.V1; export namespace VersionedMultiAssets { export interface V0 { type: "V0"; value: Array; } export interface V1 { type: "V1"; value: xcm.v1.multiasset.MultiAssets; } } export type VersionedMultiLocation = | xcm.VersionedMultiLocation.V0 | xcm.VersionedMultiLocation.V1; export namespace VersionedMultiLocation { export interface V0 { type: "V0"; value: xcm.v0.multi_location.MultiLocation; } export interface V1 { type: "V1"; value: xcm.v1.multilocation.MultiLocation; } } export type VersionedResponse = | xcm.VersionedResponse.V0 | xcm.VersionedResponse.V1 | xcm.VersionedResponse.V2; export namespace VersionedResponse { export interface V0 { type: "V0"; value: xcm.v0.Response; } export interface V1 { type: "V1"; value: xcm.v1.Response; } export interface V2 { type: "V2"; value: xcm.v2.Response; } } export type VersionedXcm = xcm.VersionedXcm.V0 | xcm.VersionedXcm.V1 | xcm.VersionedXcm.V2; export namespace VersionedXcm { export interface V0 { type: "V0"; value: xcm.v0.Xcm; } export interface V1 { type: "V1"; value: xcm.v1.Xcm; } export interface V2 { type: "V2"; value: Array; } } export namespace v0 { export const $originKind: $.Codec = _codec.$137; export const $response: $.Codec = _codec.$418; export const $xcm: $.Codec = _codec.$414; export type OriginKind = "Native" | "SovereignAccount" | "Superuser" | "Xcm"; export type Response = xcm.v0.Response.Assets; export namespace Response { export interface Assets { type: "Assets"; value: Array; } } export type Xcm = | xcm.v0.Xcm.WithdrawAsset | xcm.v0.Xcm.ReserveAssetDeposit | xcm.v0.Xcm.TeleportAsset | xcm.v0.Xcm.QueryResponse | xcm.v0.Xcm.TransferAsset | xcm.v0.Xcm.TransferReserveAsset | xcm.v0.Xcm.Transact | xcm.v0.Xcm.HrmpNewChannelOpenRequest | xcm.v0.Xcm.HrmpChannelAccepted | xcm.v0.Xcm.HrmpChannelClosing | xcm.v0.Xcm.RelayedFrom; export namespace Xcm { export interface HrmpChannelAccepted { type: "HrmpChannelAccepted"; recipient: Compact; } export interface HrmpChannelClosing { type: "HrmpChannelClosing"; initiator: Compact; sender: Compact; recipient: Compact; } export interface HrmpNewChannelOpenRequest { type: "HrmpNewChannelOpenRequest"; sender: Compact; max_message_size: Compact; max_capacity: Compact; } export interface QueryResponse { type: "QueryResponse"; query_id: Compact; response: xcm.v0.Response; } export interface RelayedFrom { type: "RelayedFrom"; who: xcm.v0.multi_location.MultiLocation; message: xcm.v0.Xcm; } export interface ReserveAssetDeposit { type: "ReserveAssetDeposit"; assets: Array; effects: Array; } export interface TeleportAsset { type: "TeleportAsset"; assets: Array; effects: Array; } export interface Transact { type: "Transact"; origin_type: xcm.v0.OriginKind; require_weight_at_most: u64; call: { encoded: Uint8Array }; } export interface TransferAsset { type: "TransferAsset"; assets: Array; dest: xcm.v0.multi_location.MultiLocation; } export interface TransferReserveAsset { type: "TransferReserveAsset"; assets: Array; dest: xcm.v0.multi_location.MultiLocation; effects: Array; } export interface WithdrawAsset { type: "WithdrawAsset"; assets: Array; effects: Array; } } export namespace junction { export const $bodyId: $.Codec = _codec.$122; export const $bodyPart: $.Codec = _codec.$123; export const $junction: $.Codec = _codec.$148; export const $networkId: $.Codec = _codec.$120; export type BodyId = | xcm.v0.junction.BodyId.Unit | xcm.v0.junction.BodyId.Named | xcm.v0.junction.BodyId.Index | xcm.v0.junction.BodyId.Executive | xcm.v0.junction.BodyId.Technical | xcm.v0.junction.BodyId.Legislative | xcm.v0.junction.BodyId.Judicial; export namespace BodyId { export interface Executive { type: "Executive"; } export interface Index { type: "Index"; value: Compact; } export interface Judicial { type: "Judicial"; } export interface Legislative { type: "Legislative"; } export interface Named { type: "Named"; value: Uint8Array; } export interface Technical { type: "Technical"; } export interface Unit { type: "Unit"; } } export type BodyPart = | xcm.v0.junction.BodyPart.Voice | xcm.v0.junction.BodyPart.Members | xcm.v0.junction.BodyPart.Fraction | xcm.v0.junction.BodyPart.AtLeastProportion | xcm.v0.junction.BodyPart.MoreThanProportion; export namespace BodyPart { export interface AtLeastProportion { type: "AtLeastProportion"; nom: Compact; denom: Compact; } export interface Fraction { type: "Fraction"; nom: Compact; denom: Compact; } export interface Members { type: "Members"; count: Compact; } export interface MoreThanProportion { type: "MoreThanProportion"; nom: Compact; denom: Compact; } export interface Voice { type: "Voice"; } } export type Junction = | xcm.v0.junction.Junction.Parent | xcm.v0.junction.Junction.Parachain | xcm.v0.junction.Junction.AccountId32 | xcm.v0.junction.Junction.AccountIndex64 | xcm.v0.junction.Junction.AccountKey20 | xcm.v0.junction.Junction.PalletInstance | xcm.v0.junction.Junction.GeneralIndex | xcm.v0.junction.Junction.GeneralKey | xcm.v0.junction.Junction.OnlyChild | xcm.v0.junction.Junction.Plurality; export namespace Junction { export interface AccountId32 { type: "AccountId32"; network: xcm.v0.junction.NetworkId; id: Uint8Array; } export interface AccountIndex64 { type: "AccountIndex64"; network: xcm.v0.junction.NetworkId; index: Compact; } export interface AccountKey20 { type: "AccountKey20"; network: xcm.v0.junction.NetworkId; key: Uint8Array; } export interface GeneralIndex { type: "GeneralIndex"; value: Compact; } export interface GeneralKey { type: "GeneralKey"; value: Uint8Array; } export interface OnlyChild { type: "OnlyChild"; } export interface PalletInstance { type: "PalletInstance"; value: u8; } export interface Parachain { type: "Parachain"; value: Compact; } export interface Parent { type: "Parent"; } export interface Plurality { type: "Plurality"; id: xcm.v0.junction.BodyId; part: xcm.v0.junction.BodyPart; } } export type NetworkId = | xcm.v0.junction.NetworkId.Any | xcm.v0.junction.NetworkId.Named | xcm.v0.junction.NetworkId.Polkadot | xcm.v0.junction.NetworkId.Kusama; export namespace NetworkId { export interface Any { type: "Any"; } export interface Kusama { type: "Kusama"; } export interface Named { type: "Named"; value: Uint8Array; } export interface Polkadot { type: "Polkadot"; } } } export namespace multi_asset { export const $multiAsset: $.Codec = _codec.$146; export type MultiAsset = | xcm.v0.multi_asset.MultiAsset.None | xcm.v0.multi_asset.MultiAsset.All | xcm.v0.multi_asset.MultiAsset.AllFungible | xcm.v0.multi_asset.MultiAsset.AllNonFungible | xcm.v0.multi_asset.MultiAsset.AllAbstractFungible | xcm.v0.multi_asset.MultiAsset.AllAbstractNonFungible | xcm.v0.multi_asset.MultiAsset.AllConcreteFungible | xcm.v0.multi_asset.MultiAsset.AllConcreteNonFungible | xcm.v0.multi_asset.MultiAsset.AbstractFungible | xcm.v0.multi_asset.MultiAsset.AbstractNonFungible | xcm.v0.multi_asset.MultiAsset.ConcreteFungible | xcm.v0.multi_asset.MultiAsset.ConcreteNonFungible; export namespace MultiAsset { export interface AbstractFungible { type: "AbstractFungible"; id: Uint8Array; amount: Compact; } export interface AbstractNonFungible { type: "AbstractNonFungible"; class: Uint8Array; instance: xcm.v1.multiasset.AssetInstance; } export interface All { type: "All"; } export interface AllAbstractFungible { type: "AllAbstractFungible"; id: Uint8Array; } export interface AllAbstractNonFungible { type: "AllAbstractNonFungible"; class: Uint8Array; } export interface AllConcreteFungible { type: "AllConcreteFungible"; id: xcm.v0.multi_location.MultiLocation; } export interface AllConcreteNonFungible { type: "AllConcreteNonFungible"; class: xcm.v0.multi_location.MultiLocation; } export interface AllFungible { type: "AllFungible"; } export interface AllNonFungible { type: "AllNonFungible"; } export interface ConcreteFungible { type: "ConcreteFungible"; id: xcm.v0.multi_location.MultiLocation; amount: Compact; } export interface ConcreteNonFungible { type: "ConcreteNonFungible"; class: xcm.v0.multi_location.MultiLocation; instance: xcm.v1.multiasset.AssetInstance; } export interface None { type: "None"; } } } export namespace multi_location { export const $multiLocation: $.Codec = _codec.$147; export type MultiLocation = | xcm.v0.multi_location.MultiLocation.Null | xcm.v0.multi_location.MultiLocation.X1 | xcm.v0.multi_location.MultiLocation.X2 | xcm.v0.multi_location.MultiLocation.X3 | xcm.v0.multi_location.MultiLocation.X4 | xcm.v0.multi_location.MultiLocation.X5 | xcm.v0.multi_location.MultiLocation.X6 | xcm.v0.multi_location.MultiLocation.X7 | xcm.v0.multi_location.MultiLocation.X8; export namespace MultiLocation { export interface Null { type: "Null"; } export interface X1 { type: "X1"; value: xcm.v0.junction.Junction; } export interface X2 { type: "X2"; value: [xcm.v0.junction.Junction, xcm.v0.junction.Junction]; } export interface X3 { type: "X3"; value: [xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction]; } export interface X4 { type: "X4"; value: [ xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, ]; } export interface X5 { type: "X5"; value: [ xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, ]; } export interface X6 { type: "X6"; value: [ xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, ]; } export interface X7 { type: "X7"; value: [ xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, ]; } export interface X8 { type: "X8"; value: [ xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, xcm.v0.junction.Junction, ]; } } } export namespace order { export const $order: $.Codec = _codec.$416; export type Order = | xcm.v0.order.Order.Null | xcm.v0.order.Order.DepositAsset | xcm.v0.order.Order.DepositReserveAsset | xcm.v0.order.Order.ExchangeAsset | xcm.v0.order.Order.InitiateReserveWithdraw | xcm.v0.order.Order.InitiateTeleport | xcm.v0.order.Order.QueryHolding | xcm.v0.order.Order.BuyExecution; export namespace Order { export interface BuyExecution { type: "BuyExecution"; fees: xcm.v0.multi_asset.MultiAsset; weight: u64; debt: u64; halt_on_error: boolean; xcm: Array; } export interface DepositAsset { type: "DepositAsset"; assets: Array; dest: xcm.v0.multi_location.MultiLocation; } export interface DepositReserveAsset { type: "DepositReserveAsset"; assets: Array; dest: xcm.v0.multi_location.MultiLocation; effects: Array; } export interface ExchangeAsset { type: "ExchangeAsset"; give: Array; receive: Array; } export interface InitiateReserveWithdraw { type: "InitiateReserveWithdraw"; assets: Array; reserve: xcm.v0.multi_location.MultiLocation; effects: Array; } export interface InitiateTeleport { type: "InitiateTeleport"; assets: Array; dest: xcm.v0.multi_location.MultiLocation; effects: Array; } export interface Null { type: "Null"; } export interface QueryHolding { type: "QueryHolding"; query_id: Compact; dest: xcm.v0.multi_location.MultiLocation; assets: Array; } } } } export namespace v1 { export const $response: $.Codec = _codec.$423; export const $xcm: $.Codec = _codec.$419; export type Response = xcm.v1.Response.Assets | xcm.v1.Response.Version; export namespace Response { export interface Assets { type: "Assets"; value: xcm.v1.multiasset.MultiAssets; } export interface Version { type: "Version"; value: u32; } } export type Xcm = | xcm.v1.Xcm.WithdrawAsset | xcm.v1.Xcm.ReserveAssetDeposited | xcm.v1.Xcm.ReceiveTeleportedAsset | xcm.v1.Xcm.QueryResponse | xcm.v1.Xcm.TransferAsset | xcm.v1.Xcm.TransferReserveAsset | xcm.v1.Xcm.Transact | xcm.v1.Xcm.HrmpNewChannelOpenRequest | xcm.v1.Xcm.HrmpChannelAccepted | xcm.v1.Xcm.HrmpChannelClosing | xcm.v1.Xcm.RelayedFrom | xcm.v1.Xcm.SubscribeVersion | xcm.v1.Xcm.UnsubscribeVersion; export namespace Xcm { export interface HrmpChannelAccepted { type: "HrmpChannelAccepted"; recipient: Compact; } export interface HrmpChannelClosing { type: "HrmpChannelClosing"; initiator: Compact; sender: Compact; recipient: Compact; } export interface HrmpNewChannelOpenRequest { type: "HrmpNewChannelOpenRequest"; sender: Compact; max_message_size: Compact; max_capacity: Compact; } export interface QueryResponse { type: "QueryResponse"; query_id: Compact; response: xcm.v1.Response; } export interface ReceiveTeleportedAsset { type: "ReceiveTeleportedAsset"; assets: xcm.v1.multiasset.MultiAssets; effects: Array; } export interface RelayedFrom { type: "RelayedFrom"; who: xcm.v1.multilocation.Junctions; message: xcm.v1.Xcm; } export interface ReserveAssetDeposited { type: "ReserveAssetDeposited"; assets: xcm.v1.multiasset.MultiAssets; effects: Array; } export interface SubscribeVersion { type: "SubscribeVersion"; query_id: Compact; max_response_weight: Compact; } export interface Transact { type: "Transact"; origin_type: xcm.v0.OriginKind; require_weight_at_most: u64; call: { encoded: Uint8Array }; } export interface TransferAsset { type: "TransferAsset"; assets: xcm.v1.multiasset.MultiAssets; beneficiary: xcm.v1.multilocation.MultiLocation; } export interface TransferReserveAsset { type: "TransferReserveAsset"; assets: xcm.v1.multiasset.MultiAssets; dest: xcm.v1.multilocation.MultiLocation; effects: Array; } export interface UnsubscribeVersion { type: "UnsubscribeVersion"; } export interface WithdrawAsset { type: "WithdrawAsset"; assets: xcm.v1.multiasset.MultiAssets; effects: Array; } } export namespace junction { export const $junction: $.Codec = _codec.$118; export type Junction = | xcm.v1.junction.Junction.Parachain | xcm.v1.junction.Junction.AccountId32 | xcm.v1.junction.Junction.AccountIndex64 | xcm.v1.junction.Junction.AccountKey20 | xcm.v1.junction.Junction.PalletInstance | xcm.v1.junction.Junction.GeneralIndex | xcm.v1.junction.Junction.GeneralKey | xcm.v1.junction.Junction.OnlyChild | xcm.v1.junction.Junction.Plurality; export namespace Junction { export interface AccountId32 { type: "AccountId32"; network: xcm.v0.junction.NetworkId; id: Uint8Array; } export interface AccountIndex64 { type: "AccountIndex64"; network: xcm.v0.junction.NetworkId; index: Compact; } export interface AccountKey20 { type: "AccountKey20"; network: xcm.v0.junction.NetworkId; key: Uint8Array; } export interface GeneralIndex { type: "GeneralIndex"; value: Compact; } export interface GeneralKey { type: "GeneralKey"; value: Uint8Array; } export interface OnlyChild { type: "OnlyChild"; } export interface PalletInstance { type: "PalletInstance"; value: u8; } export interface Parachain { type: "Parachain"; value: Compact; } export interface Plurality { type: "Plurality"; id: xcm.v0.junction.BodyId; part: xcm.v0.junction.BodyPart; } } } export namespace multiasset { export const $assetId: $.Codec = _codec.$130; export const $assetInstance: $.Codec = _codec.$132; export const $fungibility: $.Codec = _codec.$131; export const $multiAsset: $.Codec = _codec.$129; export const $multiAssetFilter: $.Codec = _codec.$139; export const $multiAssets: $.Codec = _codec.$127; export const $wildFungibility: $.Codec = _codec.$141; export const $wildMultiAsset: $.Codec = _codec.$140; export type AssetId = xcm.v1.multiasset.AssetId.Concrete | xcm.v1.multiasset.AssetId.Abstract; export namespace AssetId { export interface Abstract { type: "Abstract"; value: Uint8Array; } export interface Concrete { type: "Concrete"; value: xcm.v1.multilocation.MultiLocation; } } export type AssetInstance = | xcm.v1.multiasset.AssetInstance.Undefined | xcm.v1.multiasset.AssetInstance.Index | xcm.v1.multiasset.AssetInstance.Array4 | xcm.v1.multiasset.AssetInstance.Array8 | xcm.v1.multiasset.AssetInstance.Array16 | xcm.v1.multiasset.AssetInstance.Array32 | xcm.v1.multiasset.AssetInstance.Blob; export namespace AssetInstance { export interface Array16 { type: "Array16"; value: Uint8Array; } export interface Array32 { type: "Array32"; value: Uint8Array; } export interface Array4 { type: "Array4"; value: Uint8Array; } export interface Array8 { type: "Array8"; value: Uint8Array; } export interface Blob { type: "Blob"; value: Uint8Array; } export interface Index { type: "Index"; value: Compact; } export interface Undefined { type: "Undefined"; } } export type Fungibility = | xcm.v1.multiasset.Fungibility.Fungible | xcm.v1.multiasset.Fungibility.NonFungible; export namespace Fungibility { export interface Fungible { type: "Fungible"; value: Compact; } export interface NonFungible { type: "NonFungible"; value: xcm.v1.multiasset.AssetInstance; } } export interface MultiAsset { id: xcm.v1.multiasset.AssetId; fun: xcm.v1.multiasset.Fungibility; } export type MultiAssetFilter = | xcm.v1.multiasset.MultiAssetFilter.Definite | xcm.v1.multiasset.MultiAssetFilter.Wild; export namespace MultiAssetFilter { export interface Definite { type: "Definite"; value: xcm.v1.multiasset.MultiAssets; } export interface Wild { type: "Wild"; value: xcm.v1.multiasset.WildMultiAsset; } } export type MultiAssets = Array; export type WildFungibility = "Fungible" | "NonFungible"; export type WildMultiAsset = | xcm.v1.multiasset.WildMultiAsset.All | xcm.v1.multiasset.WildMultiAsset.AllOf; export namespace WildMultiAsset { export interface All { type: "All"; } export interface AllOf { type: "AllOf"; id: xcm.v1.multiasset.AssetId; fun: xcm.v1.multiasset.WildFungibility; } } } export namespace multilocation { export const $junctions: $.Codec = _codec.$117; export const $multiLocation: $.Codec = _codec.$116; export type Junctions = | xcm.v1.multilocation.Junctions.Here | xcm.v1.multilocation.Junctions.X1 | xcm.v1.multilocation.Junctions.X2 | xcm.v1.multilocation.Junctions.X3 | xcm.v1.multilocation.Junctions.X4 | xcm.v1.multilocation.Junctions.X5 | xcm.v1.multilocation.Junctions.X6 | xcm.v1.multilocation.Junctions.X7 | xcm.v1.multilocation.Junctions.X8; export namespace Junctions { export interface Here { type: "Here"; } export interface X1 { type: "X1"; value: xcm.v1.junction.Junction; } export interface X2 { type: "X2"; value: [xcm.v1.junction.Junction, xcm.v1.junction.Junction]; } export interface X3 { type: "X3"; value: [xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction]; } export interface X4 { type: "X4"; value: [ xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, ]; } export interface X5 { type: "X5"; value: [ xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, ]; } export interface X6 { type: "X6"; value: [ xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, ]; } export interface X7 { type: "X7"; value: [ xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, ]; } export interface X8 { type: "X8"; value: [ xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, xcm.v1.junction.Junction, ]; } } export interface MultiLocation { parents: u8; interior: xcm.v1.multilocation.Junctions; } } export namespace order { export const $order: $.Codec = _codec.$421; export type Order = | xcm.v1.order.Order.Noop | xcm.v1.order.Order.DepositAsset | xcm.v1.order.Order.DepositReserveAsset | xcm.v1.order.Order.ExchangeAsset | xcm.v1.order.Order.InitiateReserveWithdraw | xcm.v1.order.Order.InitiateTeleport | xcm.v1.order.Order.QueryHolding | xcm.v1.order.Order.BuyExecution; export namespace Order { export interface BuyExecution { type: "BuyExecution"; fees: xcm.v1.multiasset.MultiAsset; weight: u64; debt: u64; halt_on_error: boolean; instructions: Array; } export interface DepositAsset { type: "DepositAsset"; assets: xcm.v1.multiasset.MultiAssetFilter; max_assets: u32; beneficiary: xcm.v1.multilocation.MultiLocation; } export interface DepositReserveAsset { type: "DepositReserveAsset"; assets: xcm.v1.multiasset.MultiAssetFilter; max_assets: u32; dest: xcm.v1.multilocation.MultiLocation; effects: Array; } export interface ExchangeAsset { type: "ExchangeAsset"; give: xcm.v1.multiasset.MultiAssetFilter; receive: xcm.v1.multiasset.MultiAssets; } export interface InitiateReserveWithdraw { type: "InitiateReserveWithdraw"; assets: xcm.v1.multiasset.MultiAssetFilter; reserve: xcm.v1.multilocation.MultiLocation; effects: Array; } export interface InitiateTeleport { type: "InitiateTeleport"; assets: xcm.v1.multiasset.MultiAssetFilter; dest: xcm.v1.multilocation.MultiLocation; effects: Array; } export interface Noop { type: "Noop"; } export interface QueryHolding { type: "QueryHolding"; query_id: Compact; dest: xcm.v1.multilocation.MultiLocation; assets: xcm.v1.multiasset.MultiAssetFilter; } } } } export namespace v2 { export const $instruction: $.Codec = _codec.$126; export const $response: $.Codec = _codec.$134; export const $weightLimit: $.Codec = _codec.$142; export type Instruction = | xcm.v2.Instruction.WithdrawAsset | xcm.v2.Instruction.ReserveAssetDeposited | xcm.v2.Instruction.ReceiveTeleportedAsset | xcm.v2.Instruction.QueryResponse | xcm.v2.Instruction.TransferAsset | xcm.v2.Instruction.TransferReserveAsset | xcm.v2.Instruction.Transact | xcm.v2.Instruction.HrmpNewChannelOpenRequest | xcm.v2.Instruction.HrmpChannelAccepted | xcm.v2.Instruction.HrmpChannelClosing | xcm.v2.Instruction.ClearOrigin | xcm.v2.Instruction.DescendOrigin | xcm.v2.Instruction.ReportError | xcm.v2.Instruction.DepositAsset | xcm.v2.Instruction.DepositReserveAsset | xcm.v2.Instruction.ExchangeAsset | xcm.v2.Instruction.InitiateReserveWithdraw | xcm.v2.Instruction.InitiateTeleport | xcm.v2.Instruction.QueryHolding | xcm.v2.Instruction.BuyExecution | xcm.v2.Instruction.RefundSurplus | xcm.v2.Instruction.SetErrorHandler | xcm.v2.Instruction.SetAppendix | xcm.v2.Instruction.ClearError | xcm.v2.Instruction.ClaimAsset | xcm.v2.Instruction.Trap | xcm.v2.Instruction.SubscribeVersion | xcm.v2.Instruction.UnsubscribeVersion; export namespace Instruction { export interface BuyExecution { type: "BuyExecution"; fees: xcm.v1.multiasset.MultiAsset; weight_limit: xcm.v2.WeightLimit; } export interface ClaimAsset { type: "ClaimAsset"; assets: xcm.v1.multiasset.MultiAssets; ticket: xcm.v1.multilocation.MultiLocation; } export interface ClearError { type: "ClearError"; } export interface ClearOrigin { type: "ClearOrigin"; } export interface DepositAsset { type: "DepositAsset"; assets: xcm.v1.multiasset.MultiAssetFilter; max_assets: Compact; beneficiary: xcm.v1.multilocation.MultiLocation; } export interface DepositReserveAsset { type: "DepositReserveAsset"; assets: xcm.v1.multiasset.MultiAssetFilter; max_assets: Compact; dest: xcm.v1.multilocation.MultiLocation; xcm: Array; } export interface DescendOrigin { type: "DescendOrigin"; value: xcm.v1.multilocation.Junctions; } export interface ExchangeAsset { type: "ExchangeAsset"; give: xcm.v1.multiasset.MultiAssetFilter; receive: xcm.v1.multiasset.MultiAssets; } export interface HrmpChannelAccepted { type: "HrmpChannelAccepted"; recipient: Compact; } export interface HrmpChannelClosing { type: "HrmpChannelClosing"; initiator: Compact; sender: Compact; recipient: Compact; } export interface HrmpNewChannelOpenRequest { type: "HrmpNewChannelOpenRequest"; sender: Compact; max_message_size: Compact; max_capacity: Compact; } export interface InitiateReserveWithdraw { type: "InitiateReserveWithdraw"; assets: xcm.v1.multiasset.MultiAssetFilter; reserve: xcm.v1.multilocation.MultiLocation; xcm: Array; } export interface InitiateTeleport { type: "InitiateTeleport"; assets: xcm.v1.multiasset.MultiAssetFilter; dest: xcm.v1.multilocation.MultiLocation; xcm: Array; } export interface QueryHolding { type: "QueryHolding"; query_id: Compact; dest: xcm.v1.multilocation.MultiLocation; assets: xcm.v1.multiasset.MultiAssetFilter; max_response_weight: Compact; } export interface QueryResponse { type: "QueryResponse"; query_id: Compact; response: xcm.v2.Response; max_weight: Compact; } export interface ReceiveTeleportedAsset { type: "ReceiveTeleportedAsset"; value: xcm.v1.multiasset.MultiAssets; } export interface RefundSurplus { type: "RefundSurplus"; } export interface ReportError { type: "ReportError"; query_id: Compact; dest: xcm.v1.multilocation.MultiLocation; max_response_weight: Compact; } export interface ReserveAssetDeposited { type: "ReserveAssetDeposited"; value: xcm.v1.multiasset.MultiAssets; } export interface SetAppendix { type: "SetAppendix"; value: Array; } export interface SetErrorHandler { type: "SetErrorHandler"; value: Array; } export interface SubscribeVersion { type: "SubscribeVersion"; query_id: Compact; max_response_weight: Compact; } export interface Transact { type: "Transact"; origin_type: xcm.v0.OriginKind; require_weight_at_most: Compact; call: { encoded: Uint8Array }; } export interface TransferAsset { type: "TransferAsset"; assets: xcm.v1.multiasset.MultiAssets; beneficiary: xcm.v1.multilocation.MultiLocation; } export interface TransferReserveAsset { type: "TransferReserveAsset"; assets: xcm.v1.multiasset.MultiAssets; dest: xcm.v1.multilocation.MultiLocation; xcm: Array; } export interface Trap { type: "Trap"; value: Compact; } export interface UnsubscribeVersion { type: "UnsubscribeVersion"; } export interface WithdrawAsset { type: "WithdrawAsset"; value: xcm.v1.multiasset.MultiAssets; } } export type Response = | xcm.v2.Response.Null | xcm.v2.Response.Assets | xcm.v2.Response.ExecutionResult | xcm.v2.Response.Version; export namespace Response { export interface Assets { type: "Assets"; value: xcm.v1.multiasset.MultiAssets; } export interface ExecutionResult { type: "ExecutionResult"; value: [u32, xcm.v2.traits.Error] | undefined; } export interface Null { type: "Null"; } export interface Version { type: "Version"; value: u32; } } export type WeightLimit = xcm.v2.WeightLimit.Unlimited | xcm.v2.WeightLimit.Limited; export namespace WeightLimit { export interface Limited { type: "Limited"; value: Compact; } export interface Unlimited { type: "Unlimited"; } } export namespace traits { export const $error: $.Codec = _codec.$104; export const $outcome: $.Codec = _codec.$103; export type Error = | xcm.v2.traits.Error.Overflow | xcm.v2.traits.Error.Unimplemented | xcm.v2.traits.Error.UntrustedReserveLocation | xcm.v2.traits.Error.UntrustedTeleportLocation | xcm.v2.traits.Error.MultiLocationFull | xcm.v2.traits.Error.MultiLocationNotInvertible | xcm.v2.traits.Error.BadOrigin | xcm.v2.traits.Error.InvalidLocation | xcm.v2.traits.Error.AssetNotFound | xcm.v2.traits.Error.FailedToTransactAsset | xcm.v2.traits.Error.NotWithdrawable | xcm.v2.traits.Error.LocationCannotHold | xcm.v2.traits.Error.ExceedsMaxMessageSize | xcm.v2.traits.Error.DestinationUnsupported | xcm.v2.traits.Error.Transport | xcm.v2.traits.Error.Unroutable | xcm.v2.traits.Error.UnknownClaim | xcm.v2.traits.Error.FailedToDecode | xcm.v2.traits.Error.MaxWeightInvalid | xcm.v2.traits.Error.NotHoldingFees | xcm.v2.traits.Error.TooExpensive | xcm.v2.traits.Error.Trap | xcm.v2.traits.Error.UnhandledXcmVersion | xcm.v2.traits.Error.WeightLimitReached | xcm.v2.traits.Error.Barrier | xcm.v2.traits.Error.WeightNotComputable; export namespace Error { export interface AssetNotFound { type: "AssetNotFound"; } export interface BadOrigin { type: "BadOrigin"; } export interface Barrier { type: "Barrier"; } export interface DestinationUnsupported { type: "DestinationUnsupported"; } export interface ExceedsMaxMessageSize { type: "ExceedsMaxMessageSize"; } export interface FailedToDecode { type: "FailedToDecode"; } export interface FailedToTransactAsset { type: "FailedToTransactAsset"; } export interface InvalidLocation { type: "InvalidLocation"; } export interface LocationCannotHold { type: "LocationCannotHold"; } export interface MaxWeightInvalid { type: "MaxWeightInvalid"; } export interface MultiLocationFull { type: "MultiLocationFull"; } export interface MultiLocationNotInvertible { type: "MultiLocationNotInvertible"; } export interface NotHoldingFees { type: "NotHoldingFees"; } export interface NotWithdrawable { type: "NotWithdrawable"; } export interface Overflow { type: "Overflow"; } export interface TooExpensive { type: "TooExpensive"; } export interface Transport { type: "Transport"; } export interface Trap { type: "Trap"; value: u64; } export interface UnhandledXcmVersion { type: "UnhandledXcmVersion"; } export interface Unimplemented { type: "Unimplemented"; } export interface UnknownClaim { type: "UnknownClaim"; } export interface Unroutable { type: "Unroutable"; } export interface UntrustedReserveLocation { type: "UntrustedReserveLocation"; } export interface UntrustedTeleportLocation { type: "UntrustedTeleportLocation"; } export interface WeightLimitReached { type: "WeightLimitReached"; value: u64; } export interface WeightNotComputable { type: "WeightNotComputable"; } } export type Outcome = | xcm.v2.traits.Outcome.Complete | xcm.v2.traits.Outcome.Incomplete | xcm.v2.traits.Outcome.Error; export namespace Outcome { export interface Complete { type: "Complete"; value: u64; } export interface Error { type: "Error"; value: xcm.v2.traits.Error; } export interface Incomplete { type: "Incomplete"; value: [u64, xcm.v2.traits.Error]; } } } } } ```

As long as V3 is correctly represented in FRAME metadata, the codec derivation and codegen should produce the correct output.

Tagging @tjjfvi––our type conversion expert––incase he'd like to add anything.

@rphmeier, does this answer your question?