Add type augmentation for AssetHub (#6148)

* Add api-augmentation for assetHub

* Add lookup types

* lint

* Reorder packages

* Fix build errors

* Rebuild types with master
This commit is contained in:
Valentin Fernandez
2025-05-19 12:18:11 -03:00
committed by GitHub
parent 2bf13b88d9
commit 939173df5c
32 changed files with 18699 additions and 5 deletions
+5 -1
View File
@@ -11,6 +11,8 @@ import Handlebars from 'handlebars';
import path from 'node:path';
import * as defaultDefinitions from '@polkadot/types/interfaces/definitions';
import staticAhKusama from '@polkadot/types-support/metadata/v15/asset-hub-kusama-hex';
import staticAhPolkadot from '@polkadot/types-support/metadata/v15/asset-hub-polkadot-hex';
import staticKusama from '@polkadot/types-support/metadata/v15/kusama-hex';
import staticPolkadot from '@polkadot/types-support/metadata/v15/polkadot-hex';
import staticSubstrate from '@polkadot/types-support/metadata/v15/substrate-hex';
@@ -271,7 +273,9 @@ export function generateDefaultLookup (destDir = 'packages/types-augment/src/loo
: [
['substrate', staticSubstrate],
['polkadot', staticPolkadot],
['kusama', staticKusama]
['kusama', staticKusama],
['assetHubPolkadot', staticAhPolkadot],
['assetHubKusama', staticAhKusama]
]
);
}
+3
View File
@@ -23,6 +23,8 @@ const generateCallsTypesTemplate = Handlebars.compile(readTemplate('calls'));
// This works similar to the PATHS_ALIAS set from the PortableRegistry
const aliases: Record<string, string> = {
AssetHubKusamaRuntimeRuntimeCall: 'RuntimeCall',
AssetHubPolkadotRuntimeRuntimeCall: 'RuntimeCall',
KitchensinkRuntimeRuntimeCall: 'RuntimeCall',
OpaqueValue: 'Bytes',
PolkadotParachainPrimitivesPrimitivesId: 'ParaId',
@@ -35,6 +37,7 @@ const aliases: Record<string, string> = {
PrimitiveTypesU256: 'U256',
SpConsensusBabeOpaqueKeyOwnershipProof: 'OpaqueKeyOwnershipProof',
SpConsensusSlotsSlot: 'Slot',
SpConsensusSlotsSlotDuration: 'SlotDuration',
SpCoreCryptoAccountId32: 'AccountId32',
SpCoreOpaqueMetadata: 'OpaqueMetadata',
SpRuntimeOpaqueValue: 'Bytes',
+3 -1
View File
@@ -4,6 +4,8 @@
import type { HexString } from '@polkadot/util/types';
// TODO: replace v15 to v16 once metadata is updated
import assetHubKusama from '@polkadot/types-support/metadata/v15/asset-hub-kusama-hex';
import assetHubPolkadot from '@polkadot/types-support/metadata/v15/asset-hub-polkadot-hex';
import kusama from '@polkadot/types-support/metadata/v15/kusama-hex';
import polkadot from '@polkadot/types-support/metadata/v15/polkadot-hex';
import substrate from '@polkadot/types-support/metadata/v15/substrate-hex';
@@ -11,7 +13,7 @@ import substrate from '@polkadot/types-support/metadata/v15/substrate-hex';
import { generateDefaultConsts, generateDefaultErrors, generateDefaultEvents, generateDefaultInterface, generateDefaultLookup, generateDefaultQuery, generateDefaultRpc, generateDefaultRuntime, generateDefaultTsDef, generateDefaultTx } from './generate/index.js';
const BASE = 'packages/api-augment/src';
const METAS = Object.entries<HexString>({ kusama, polkadot, substrate });
const METAS = Object.entries<HexString>({ assetHubKusama, assetHubPolkadot, kusama, polkadot, substrate });
export function main (): void {
generateDefaultInterface();