Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LocationToAccountApi::convert_location runtime API #5917

Merged
merged 4 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/types-augment/src/registry/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import type { ClassDetails, ClassId, ClassMetadata, DepositBalance, DepositBalan
import type { Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
import type { VestingInfo } from '@polkadot/types/interfaces/vesting';
import type { AssetInstance, AssetInstanceV0, AssetInstanceV1, AssetInstanceV2, BodyId, BodyPart, DoubleEncodedCall, Fungibility, FungibilityV0, FungibilityV1, FungibilityV2, InboundStatus, InstructionV2, InteriorMultiLocation, Junction, JunctionV0, JunctionV1, JunctionV2, Junctions, JunctionsV1, JunctionsV2, MultiAsset, MultiAssetFilter, MultiAssetFilterV1, MultiAssetFilterV2, MultiAssetV0, MultiAssetV1, MultiAssetV2, MultiAssets, MultiAssetsV1, MultiAssetsV2, MultiLocation, MultiLocationV0, MultiLocationV1, MultiLocationV2, NetworkId, OriginKindV0, OriginKindV1, OriginKindV2, OutboundStatus, Outcome, QueryId, QueryStatus, QueueConfigData, Response, ResponseV0, ResponseV1, ResponseV2, ResponseV2Error, ResponseV2Result, VersionMigrationStage, VersionedMultiAsset, VersionedMultiAssets, VersionedMultiLocation, VersionedResponse, VersionedXcm, WeightLimitV2, WildFungibility, WildFungibilityV0, WildFungibilityV1, WildFungibilityV2, WildMultiAsset, WildMultiAssetV1, WildMultiAssetV2, Xcm, XcmAssetId, XcmError, XcmErrorV0, XcmErrorV1, XcmErrorV2, XcmOrder, XcmOrderV0, XcmOrderV1, XcmOrderV2, XcmOrigin, XcmOriginKind, XcmV0, XcmV1, XcmV2, XcmVersion, XcmpMessageFormat } from '@polkadot/types/interfaces/xcm';
import type { Error } from '@polkadot/types/interfaces/xcmRuntimeApi';

declare module '@polkadot/types/types/registry' {
interface InterfaceTypes {
Expand Down Expand Up @@ -400,6 +401,7 @@ declare module '@polkadot/types/types/registry' {
EraPoints: EraPoints;
EraRewardPoints: EraRewardPoints;
EraRewards: EraRewards;
Error: Error;
ErrorMetadataLatest: ErrorMetadataLatest;
ErrorMetadataV10: ErrorMetadataV10;
ErrorMetadataV11: ErrorMetadataV11;
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/interfaces/definitions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('runtime definitions', (): void => {
for (const { methods, version } of versions) {
describe(`version ${version}`, (): void => {
const methodsEntries = Object.entries<DefinitionCall>(methods);
const skipInspectTypes = ['StagingXcmV3MultiLocation', 'StagingXcmV3MultiLocation', 'Result<Vec<XcmV3MultiAsset>, FungiblesAccessError>', 'Result<XcmVersionedMultiAssets, FungiblesAccessError>'];
const skipInspectTypes = ['StagingXcmV3MultiLocation', 'StagingXcmV4Location', 'Result<Vec<XcmV3MultiAsset>, FungiblesAccessError>', 'Result<XcmVersionedMultiAssets, FungiblesAccessError>', 'XcmVersionedLocation'];

for (const [key, { params, type }] of methodsEntries) {
describe(`${key}`, (): void => {
Expand Down
3 changes: 3 additions & 0 deletions packages/types/src/interfaces/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ export { default as finality } from './finality/definitions.js';
export { default as parachains } from './parachains/definitions.js';
export { default as poll } from './poll/definitions.js';
export { default as purchase } from './purchase/definitions.js';

// XCM related types
export { default as xcm } from './xcm/definitions.js';
export { default as xcmRuntimeApi } from './xcmRuntimeApi/definitions.js';

// other useful types
export { default as contractsAbi } from './contractsAbi/definitions.js';
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/interfaces/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ export * from './uniques/types.js';
export * from './utility/types.js';
export * from './vesting/types.js';
export * from './xcm/types.js';
export * from './xcmRuntimeApi/types.js';
19 changes: 19 additions & 0 deletions packages/types/src/interfaces/xcmRuntimeApi/definitions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2017-2024 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0

// order important in structs... :)
/* eslint-disable sort-keys */

import type { Definitions } from '../../types/index.js';

import { runtime } from './runtime.js';

export default {
rpc: {},
runtime,
types: {
Error: {
_enum: ['Unsupported', 'VersionedConversionFailed']
}
}
} as Definitions;
4 changes: 4 additions & 0 deletions packages/types/src/interfaces/xcmRuntimeApi/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */

export * from './types.js';
24 changes: 24 additions & 0 deletions packages/types/src/interfaces/xcmRuntimeApi/runtime.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2017-2024 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { DefinitionsCall } from '../../types/index.js';

export const runtime: DefinitionsCall = {
LocationToAccountApi: [
{
methods: {
convert_location: {
description: 'Converts `Location` to `Account` with `AccountId` and Ss58 representation',
params: [
{
name: 'location',
type: 'XcmVersionedLocation'
}
],
type: 'Result<Vec<u8>, Error>'
}
},
version: 1
}
]
};
13 changes: 13 additions & 0 deletions packages/types/src/interfaces/xcmRuntimeApi/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */

import type { Enum } from '@polkadot/types-codec';

/** @name Error */
export interface Error extends Enum {
readonly isUnsupported: boolean;
readonly isVersionedConversionFailed: boolean;
readonly type: 'Unsupported' | 'VersionedConversionFailed';
}

export type PHANTOM_XCMRUNTIMEAPI = 'xcmRuntimeApi';