mirror of
https://github.com/pezkuwichain/pezkuwi-api.git
synced 2026-10-31 14:39:48 +00:00
Fix the lint errors
Most are object keys out of order after the rename (dicle, pezkuwi, bizinikiwi, teyrchains and zagros sort differently from the names they replaced); they are sorted, behaviour is unchanged. The rest: - createClass: header.hash is already the BlockHash type; the `as any` cast is removed - ScProvider: WellKnownChain is a string union in @bizinikiwi/connect, so `string | WellKnownChain` was `string`; the spec parameter says so - ScProvider: the jsonRpcResponses loop is a named async function whose rejection (chain removed, client terminated) is caught explicitly instead of a floating promise - the fake chain in the spec no longer needs a non-null assertion - Extrinsic.hash: redundant non-null assertion removed - metadata-get.mjs writes the 2026 header
This commit is contained in:
1 parent
611d410f28
commit
7c6cac97da
19 files changed
+87
-81
No files matched your search
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2025 @pezkuwi/typegen authors & contributors
|
||||
// Copyright 2017-2026 @pezkuwi/typegen authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { PortableType, SiLookupTypeId, SiPath, SiTypeParameter } from '@pezkuwi/types/interfaces';
|
||||
@@ -28,12 +28,12 @@ function deepRebrandTypeDef (typeDef: TypeDef, isTopLevel = true): TypeDef {
|
||||
|
||||
const rebranded: TypeDef = {
|
||||
...typeDef,
|
||||
type: rebrandTypeName(typeDef.type),
|
||||
lookupName: rebrandedLookupName,
|
||||
lookupNameRoot: typeDef.lookupNameRoot ? rebrandTypeName(typeDef.lookupNameRoot) : typeDef.lookupNameRoot,
|
||||
// For top-level types: set name from lookupName (mimics original: typeDef.name = typeDef.lookupName)
|
||||
// For sub types (enum variants, struct fields): preserve the original name (field/variant name)
|
||||
name: isTopLevel ? (rebrandedLookupName || typeDef.name) : typeDef.name,
|
||||
lookupName: rebrandedLookupName,
|
||||
lookupNameRoot: typeDef.lookupNameRoot ? rebrandTypeName(typeDef.lookupNameRoot) : typeDef.lookupNameRoot
|
||||
type: rebrandTypeName(typeDef.type)
|
||||
};
|
||||
|
||||
// Recursively rebrand sub types (mark as not top-level)
|
||||
@@ -232,6 +232,7 @@ function generateLookupTypes (registry: Registry, filtered: [PortableType, TypeD
|
||||
|
||||
// Add imports for AccountId32 and MultiAddress - needed for all lookup files that use TYPE_MAPPINGS
|
||||
const runtimePath = '@pezkuwi/types/interfaces/runtime';
|
||||
|
||||
if (imports.localTypes[runtimePath]) {
|
||||
imports.localTypes[runtimePath]['AccountId32'] = true;
|
||||
imports.localTypes[runtimePath]['MultiAddress'] = true;
|
||||
@@ -239,6 +240,7 @@ function generateLookupTypes (registry: Registry, filtered: [PortableType, TypeD
|
||||
|
||||
// For non-bizinikiwi files, add base type definitions at the start
|
||||
const baseTypeDefs: string[] = [];
|
||||
|
||||
if (subPath && subPath !== 'bizinikiwi') {
|
||||
// Add PezspCoreCryptoAccountId32 and PezspRuntimeMultiAddress definitions
|
||||
// These extend the standard types and are needed in all lookup files
|
||||
@@ -261,6 +263,7 @@ function generateLookupTypes (registry: Registry, filtered: [PortableType, TypeD
|
||||
if (subPath === 'bizinikiwi') {
|
||||
return exportInterface(rebranded.lookupIndex, rebranded.lookupName, TYPE_MAPPINGS[rebranded.lookupName]);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2025 @pezkuwi/typegen authors & contributors
|
||||
// Copyright 2017-2026 @pezkuwi/typegen authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { RuntimeApiMethodMetadataV16, SiLookupTypeId } from '@pezkuwi/types/interfaces';
|
||||
@@ -23,22 +23,19 @@ const generateCallsTypesTemplate = Handlebars.compile(readTemplate('calls'));
|
||||
|
||||
// This works similar to the PATHS_ALIAS set from the PortableRegistry
|
||||
const aliases: Record<string, string> = {
|
||||
AssetHubZagrosRuntimeRuntimeCall: 'RuntimeCall',
|
||||
AssetHubPezkuwiRuntimeRuntimeCall: 'RuntimeCall',
|
||||
AssetHubDicleRuntimeOriginCaller: 'OriginCaller',
|
||||
AssetHubDicleRuntimeRuntimeCall: 'RuntimeCall',
|
||||
AssetHubPezkuwiRuntimeRuntimeCall: 'RuntimeCall',
|
||||
AssetHubZagrosRuntimeRuntimeCall: 'RuntimeCall',
|
||||
DicleRuntimeConstantsProxyProxyType: 'ProxyType',
|
||||
KitchensinkRuntimeRuntimeCall: 'RuntimeCall',
|
||||
KitchensinkRuntimeRuntimeParametersKey: 'RuntimeParametersKey',
|
||||
OpaqueValue: 'Bytes',
|
||||
PezkuwiTeyrchainPrimitivesPrimitivesId: 'ParaId',
|
||||
PezkuwiTeyrchainPrimitivesPrimitivesValidationCodeHash: 'ValidationCodeHash',
|
||||
PezkuwiPrimitivesV7SlashingOpaqueKeyOwnershipProof: 'OpaqueKeyOwnershipProof',
|
||||
PezkuwiPrimitivesV8SlashingOpaqueKeyOwnershipProof: 'OpaqueKeyOwnershipProof',
|
||||
PezkuwiRuntimeRuntimeCall: 'RuntimeCall',
|
||||
PrimitiveTypesH160: 'H160',
|
||||
PrimitiveTypesH256: 'H256',
|
||||
PrimitiveTypesU256: 'U256',
|
||||
PezkuwiTeyrchainPrimitivesPrimitivesId: 'ParaId',
|
||||
PezkuwiTeyrchainPrimitivesPrimitivesValidationCodeHash: 'ValidationCodeHash',
|
||||
PezspConsensusBabeOpaqueKeyOwnershipProof: 'OpaqueKeyOwnershipProof',
|
||||
PezspConsensusSlotsSlot: 'Slot',
|
||||
PezspConsensusSlotsSlotDuration: 'SlotDuration',
|
||||
@@ -46,6 +43,9 @@ const aliases: Record<string, string> = {
|
||||
PezspCoreOpaqueMetadata: 'OpaqueMetadata',
|
||||
PezspRuntimeOpaqueValue: 'Bytes',
|
||||
PezspRuntimeUncheckedExtrinsic: 'Extrinsic',
|
||||
PrimitiveTypesH160: 'H160',
|
||||
PrimitiveTypesH256: 'H256',
|
||||
PrimitiveTypesU256: 'U256',
|
||||
StagingDicleRuntimeOriginCaller: 'OriginCaller',
|
||||
StagingDicleRuntimeRuntimeCall: 'RuntimeCall',
|
||||
StagingDicleRuntimeRuntimeParameters: 'RuntimeParameters',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2025 @pezkuwi/typegen authors & contributors
|
||||
// Copyright 2017-2026 @pezkuwi/typegen authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@pezkuwi/util/types';
|
||||
@@ -13,7 +13,7 @@ import pezkuwi from '@pezkuwi/types-support/metadata/v15/pezkuwi-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>({ assetHubDicle, assetHubPezkuwi, dicle, pezkuwi, bizinikiwi });
|
||||
const METAS = Object.entries<HexString>({ assetHubDicle, assetHubPezkuwi, bizinikiwi, dicle, pezkuwi });
|
||||
|
||||
export function main (): void {
|
||||
generateDefaultInterface();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2025 @pezkuwi/typegen authors & contributors
|
||||
// Copyright 2017-2026 @pezkuwi/typegen authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { MetadataLatest, RuntimeApiMethodMetadataV16, SiLookupTypeId } from '@pezkuwi/types/interfaces';
|
||||
@@ -92,6 +92,9 @@ const ALL_STATIC: Record<string, StaticDef> = {
|
||||
rpc: assetHubPezkuwiRpc,
|
||||
ver: assetHubPezkuwiVer as unknown as { apis: ApiDef[] }
|
||||
},
|
||||
bizinikiwi: {
|
||||
meta: bizinikiwiMeta
|
||||
},
|
||||
dicle: {
|
||||
meta: dicleMeta,
|
||||
rpc: dicleRpc,
|
||||
@@ -101,9 +104,6 @@ const ALL_STATIC: Record<string, StaticDef> = {
|
||||
meta: pezkuwiMeta,
|
||||
rpc: pezkuwiRpc,
|
||||
ver: pezkuwiVer as unknown as { apis: ApiDef[] }
|
||||
},
|
||||
bizinikiwi: {
|
||||
meta: bizinikiwiMeta
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2025 @pezkuwi/typegen authors & contributors
|
||||
// Copyright 2017-2026 @pezkuwi/typegen authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { AnyString, Registry } from '@pezkuwi/types/types';
|
||||
@@ -263,6 +263,7 @@ const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, def
|
||||
|
||||
return rebrandTypeName(typeDef.lookupName);
|
||||
}
|
||||
|
||||
setImports(definitions, imports, ['U8aFixed']);
|
||||
|
||||
return 'U8aFixed';
|
||||
|
||||
Reference in new issue
Block a user