Add LocationToAccountApi::convert_location runtime API (#5917)

* Add `LocationToAccountApi::convert_location` runtime API

* lint

* Fix test

* Adjust to latest
This commit is contained in:
Branislav Kontur
2024-06-25 10:28:56 -04:00
committed by GitHub
parent b0acdbd96c
commit b1ec8d160a
8 changed files with 67 additions and 1 deletions
@@ -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 => {
@@ -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';
+1
View File
@@ -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';
@@ -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;
@@ -0,0 +1,4 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
export * from './types.js';
@@ -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
}
]
};
@@ -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';