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:
Satoshi Qazi Muhammed authored and SatoshiQaziMuhammed committed 2026-10-08 03:23:10 +04:00
1 parent 611d410f28
commit 7c6cac97da
19 files changed
+87 -81

No files matched your search

+5 -5
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2025 @pezkuwi/api-derive authors & contributors
// Copyright 2017-2026 @pezkuwi/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DeriveCustom } from '@pezkuwi/api-base/types';
@@ -61,10 +61,6 @@ const checks: Record<string, Avail> = {
instances: ['membership'],
methods: []
},
teyrchains: {
instances: ['teyrchains', 'registrar'],
methods: []
},
session: {
instances: ['session'],
methods: []
@@ -82,6 +78,10 @@ const checks: Record<string, Avail> = {
methods: [],
withDetect: true
},
teyrchains: {
instances: ['teyrchains', 'registrar'],
methods: []
},
treasury: {
instances: ['treasury'],
methods: []
+2 -2
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2025 @pezkuwi/api-derive authors & contributors
// Copyright 2017-2026 @pezkuwi/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AnyFunction } from '@pezkuwi/types/types';
@@ -24,7 +24,7 @@ import * as teyrchains from './teyrchains/index.js';
import * as treasury from './treasury/index.js';
import * as tx from './tx/index.js';
export const derive = { accounts, alliance, bagsList, balances, bounties, chain, contracts, council, crowdloan, democracy, elections, imOnline, membership, teyrchains, session, society, staking, technicalCommittee, treasury, tx };
export const derive = { accounts, alliance, bagsList, balances, bounties, chain, contracts, council, crowdloan, democracy, elections, imOnline, membership, session, society, staking, technicalCommittee, teyrchains, treasury, tx };
type DeriveSection<Section> = {
[M in keyof Section]: Section[M] extends AnyFunction
+2 -3
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2025 @pezkuwi/api authors & contributors
// Copyright 2017-2026 @pezkuwi/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable no-dupe-class-members */
@@ -54,8 +54,7 @@ function makeEraOptions (api: ApiInterfaceRx, registry: Registry, partialOptions
}
return makeSignOptions(api, partialOptions, {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
blockHash: header.hash as any,
blockHash: header.hash,
era: registry.createTypeUnsafe<ExtrinsicEra>('ExtrinsicEra', [{
current: header.number,
period: partialOptions.era || mortalLength
@@ -1,4 +1,4 @@
// Copyright 2017-2025 @pezkuwi/rpc-provider authors & contributors
// Copyright 2017-2026 @pezkuwi/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@pezkuwi/dev-test/globals.d.ts" />
@@ -103,8 +103,10 @@ function getFakeChain (spec: string): MockChain {
};
const nextJsonRpcResponse = (): Promise<string> => {
if (_pendingResponses.length > 0) {
return Promise.resolve(_pendingResponses.shift()!);
const pending = _pendingResponses.shift();
if (pending !== undefined) {
return Promise.resolve(pending);
}
return new Promise((resolve) => {
@@ -141,6 +143,8 @@ function getFakeChain (spec: string): MockChain {
_triggerCallback: triggerCallback,
addChain: (chainSpec) =>
Promise.resolve(getFakeChain(chainSpec)),
jsonRpcResponses,
nextJsonRpcResponse,
remove: () => {
terminateInterceptor();
_isTerminated = true;
@@ -148,9 +152,7 @@ function getFakeChain (spec: string): MockChain {
sendJsonRpc: (rpc) => {
sendJsonRpcInterceptor(rpc);
_receivedRequests.push(rpc);
},
nextJsonRpcResponse,
jsonRpcResponses
}
};
}
@@ -563,6 +565,7 @@ describe('ScProvider', () => {
}, 0);
const cb = jest.fn();
await provider.subscribe(
'foo',
'chain_subscribeNewHeads',
@@ -1,4 +1,4 @@
// Copyright 2017-2025 @pezkuwi/rpc-provider authors & contributors
// Copyright 2017-2026 @pezkuwi/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type * as ScType from '@bizinikiwi/connect';
@@ -53,7 +53,7 @@ interface ActiveSubs {
export class ScProvider implements ProviderInterface {
readonly #Sc: BizinikiwiConnect;
readonly #coder: RpcCoder = new RpcCoder();
readonly #spec: string | ScType.WellKnownChain;
readonly #spec: string;
readonly #sharedSandbox?: ScProvider | undefined;
readonly #subscriptions = new Map<string, [ResponseCallback, { unsubscribeMethod: string; id: string | number }]>();
readonly #resubscribeMethods = new Map<string, ActiveSubs>();
@@ -64,7 +64,7 @@ export class ScProvider implements ProviderInterface {
#chain: Promise<ScType.Chain> | null = null;
#isChainReady = false;
public constructor (Sc: BizinikiwiConnect, spec: string | ScType.WellKnownChain, sharedSandbox?: ScProvider) {
public constructor (Sc: BizinikiwiConnect, spec: string, sharedSandbox?: ScProvider) {
if (!isObject(Sc) || !isObject(Sc.WellKnownChain) || !isFunction(Sc.createScClient)) {
throw new Error('Expected an @bizinikiwi/connect interface as first parameter to ScProvider');
}
@@ -171,15 +171,15 @@ export class ScProvider implements ProviderInterface {
// Start async response processing loop
// This replaces the callback-based API from older @substrate/connect versions
(async () => {
try {
for await (const res of chain.jsonRpcResponses) {
onResponse(res);
}
} catch {
// Chain was removed or connection closed - this is expected
const processResponses = async (): Promise<void> => {
for await (const res of chain.jsonRpcResponses) {
onResponse(res);
}
})();
};
processResponses().catch(() => {
// Chain was removed or connection closed - this is expected
});
this.#isChainReady = false;
+7 -4
View File
@@ -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;
}
+8 -8
View File
@@ -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',
+2 -2
View File
@@ -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();
+4 -4
View File
@@ -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
}
};
+2 -1
View File
@@ -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';
+3 -3
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// Copyright 2017-2026 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { OverrideVersionedType } from '@pezkuwi/types/types';
@@ -26,6 +26,6 @@ export const typesSpec: Record<string, OverrideVersionedType[]> = {
shell,
statemine,
statemint,
zagros,
westmint
westmint,
zagros
};
+2 -2
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2025 @pezkuwi/types authors & contributors
// Copyright 2017-2026 @pezkuwi/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AnyJson, AnyTuple, AnyU8a, ArgsDef, IMethod, Inspect, IOption } from '@pezkuwi/types-codec/types';
@@ -345,7 +345,7 @@ export class GenericExtrinsic<A extends AnyTuple = AnyTuple> extends ExtrinsicBa
this.#hashCache = super.hash as CodecHash;
}
return this.#hashCache!;
return this.#hashCache;
}
/**
+4 -4
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2025 @pezkuwi/types-known authors & contributors
// Copyright 2017-2026 @pezkuwi/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { OverrideModuleType, Registry } from '../types/index.js';
@@ -60,9 +60,6 @@ const typesAlias: Record<string, OverrideModuleType> = {
paraShared: {
ValidatorIndex: 'ParaValidatorIndex'
},
teyrchains: {
Id: 'ParaId'
},
parasDisputes: {
ValidatorIndex: 'ParaValidatorIndex'
},
@@ -94,6 +91,9 @@ const typesAlias: Record<string, OverrideModuleType> = {
staking: {
Compact: 'CompactAssignments'
},
teyrchains: {
Id: 'ParaId'
},
treasury: {
Proposal: 'TreasuryProposal'
},
@@ -1,4 +1,4 @@
// Copyright 2017-2025 @pezkuwi/types authors & contributors
// Copyright 2017-2026 @pezkuwi/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DefinitionsCall } from '../../types/index.js';
@@ -17,7 +17,7 @@ const finalityV1 = {
export const runtime: DefinitionsCall = {
DicleFinalityApi: [finalityV1],
ZagrosFinalityApi: [finalityV1],
PezkuwiFinalityApi: [finalityV1],
PezkuwichainFinalityApi: [finalityV1]
PezkuwichainFinalityApi: [finalityV1],
ZagrosFinalityApi: [finalityV1]
};
+5 -5
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2025 @pezkuwi/types authors & contributors
// Copyright 2017-2026 @pezkuwi/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@pezkuwi/dev-test/globals.d.ts" />
@@ -16,15 +16,15 @@ import { TypeRegistry } from '../create/index.js';
import { Metadata } from './Metadata.js';
const allData: Record<string, HexString> = {
bizinikiwi,
dicle,
pezkuwi,
bizinikiwi
pezkuwi
};
const allDataV14: Record<string, HexString> = {
bizinikiwi: bizinikiwiV14,
dicle: dicleV14,
pezkuwi: pezkuwiV14,
bizinikiwi: bizinikiwiV14
pezkuwi: pezkuwiV14
};
for (const type of ['dicle', 'pezkuwi', 'bizinikiwi'] as const) {
@@ -1,4 +1,4 @@
// Copyright 2017-2025 @pezkuwi/types authors & contributors
// Copyright 2017-2026 @pezkuwi/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import bizinikiwiData from '@pezkuwi/types-support/metadata/v13/bizinikiwi-hex';
@@ -8,6 +8,9 @@ import pezkuwiData from '@pezkuwi/types-support/metadata/v13/pezkuwi-hex';
import { testMeta } from '../util/testUtil.js';
testMeta(13, {
bizinikiwi: {
data: bizinikiwiData
},
dicle: {
data: dicleData,
fails: [
@@ -17,8 +20,5 @@ testMeta(13, {
},
pezkuwi: {
data: pezkuwiData
},
bizinikiwi: {
data: bizinikiwiData
}
});
@@ -1,4 +1,4 @@
// Copyright 2017-2025 @pezkuwi/types authors & contributors
// Copyright 2017-2026 @pezkuwi/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import bizinikiwiData from '@pezkuwi/types-support/metadata/v14/bizinikiwi-hex';
@@ -8,13 +8,13 @@ import pezkuwiData from '@pezkuwi/types-support/metadata/v14/pezkuwi-hex';
import { testMeta } from '../util/testUtil.js';
testMeta(14, {
bizinikiwi: {
data: bizinikiwiData
},
dicle: {
data: dicleData
},
pezkuwi: {
data: pezkuwiData
},
bizinikiwi: {
data: bizinikiwiData
}
});
@@ -1,4 +1,4 @@
// Copyright 2017-2025 @pezkuwi/types authors & contributors
// Copyright 2017-2026 @pezkuwi/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import assetHubDicleData from '@pezkuwi/types-support/metadata/v15/asset-hub-dicle-hex';
@@ -16,13 +16,13 @@ testMeta(15, {
'asset-hub-pezkuwi': {
data: assetHubPezkuwiData
},
bizinikiwi: {
data: bizinikiwiData
},
dicle: {
data: dicleData
},
pezkuwi: {
data: pezkuwiData
},
bizinikiwi: {
data: bizinikiwiData
}
});
+6 -6
View File
@@ -1,18 +1,18 @@
// Copyright 2017-2025 @pezkuwi/typegen authors & contributors
// Copyright 2017-2026 @pezkuwi/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
import fs from 'node:fs';
import { fetch } from '@pezkuwi/x-fetch';
const PREAMBLE = '// Copyright 2017-2025 @pezkuwi/types-support authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable */\n\n';
const PREAMBLE = '// Copyright 2017-2026 @pezkuwi/types-support authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable */\n\n';
const CMD = {
'asset-hub-zagros': `${PREAMBLE}//To run a asset-hub-zagros node please refer to types-support/src/metadata/README.md\n\nexport default`,
'asset-hub-pezkuwi': `${PREAMBLE}//To run a asset-hub-pezkuwi node please refer to types-support/src/metadata/README.md\n\nexport default`,
zagros: `${PREAMBLE}// cargo run --release -- purge-chain -y --chain zagros-dev && cargo run --release -- --chain zagros-dev --alice --force-authoring\n\nexport default`,
pezkuwi: `${PREAMBLE}// cargo run --release -- purge-chain -y --dev && cargo run --release -- --dev\n\nexport default`,
'asset-hub-zagros': `${PREAMBLE}//To run a asset-hub-zagros node please refer to types-support/src/metadata/README.md\n\nexport default`,
bizinikiwi: `${PREAMBLE}// cargo run --release -- purge-chain -y --dev && cargo run --release -- --dev\n\nexport default`,
'bizinikiwi-contracts-node': `${PREAMBLE}// cargo run --release -- purge-chain -y --dev && cargo run --release -- --dev\n\nexport default`
'bizinikiwi-contracts-node': `${PREAMBLE}// cargo run --release -- purge-chain -y --dev && cargo run --release -- --dev\n\nexport default`,
pezkuwi: `${PREAMBLE}// cargo run --release -- purge-chain -y --dev && cargo run --release -- --dev\n\nexport default`,
zagros: `${PREAMBLE}// cargo run --release -- purge-chain -y --chain zagros-dev && cargo run --release -- --chain zagros-dev --alice --force-authoring\n\nexport default`
};
// V15