diff --git a/packages/chopsticks/src/cli.ts b/packages/chopsticks/src/cli.ts index 9f8f1ea4..3c2a0afe 100644 --- a/packages/chopsticks/src/cli.ts +++ b/packages/chopsticks/src/cli.ts @@ -5,7 +5,7 @@ import type { MiddlewareFunction } from 'yargs' import { hideBin } from 'yargs/helpers' import { z } from 'zod' -import { Blockchain, connectParachains, connectVertical, environment } from '@acala-network/chopsticks-core' +import { type Blockchain, connectParachains, connectVertical, environment } from '@acala-network/chopsticks-core' import { setupWithServer } from './index.js' import { loadRpcMethodsByScripts, pluginExtendCli } from './plugins/index.js' import { configSchema, fetchConfig, getYargsOptions } from './schema/index.js' diff --git a/packages/chopsticks/src/context.ts b/packages/chopsticks/src/context.ts index e4480a2a..8cc7d3e8 100644 --- a/packages/chopsticks/src/context.ts +++ b/packages/chopsticks/src/context.ts @@ -1,10 +1,17 @@ import './utils/tunnel.js' -import { BlockEntry, GenesisProvider, defaultLogger, isUrl, setup, timeTravel } from '@acala-network/chopsticks-core' +import { + type BlockEntry, + GenesisProvider, + defaultLogger, + isUrl, + setup, + timeTravel, +} from '@acala-network/chopsticks-core' import { SqliteDatabase } from '@acala-network/chopsticks-db' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import axios from 'axios' import { apiFetching } from './logger.js' -import { Config } from './schema/index.js' +import type { Config } from './schema/index.js' import { startFetchStorageWorker } from './utils/fetch-storages.js' import { overrideStorage, overrideWasm } from './utils/override.js' diff --git a/packages/chopsticks/src/plugins/decode-key/cli.ts b/packages/chopsticks/src/plugins/decode-key/cli.ts index 60120a3e..50bce8c0 100644 --- a/packages/chopsticks/src/plugins/decode-key/cli.ts +++ b/packages/chopsticks/src/plugins/decode-key/cli.ts @@ -1,5 +1,5 @@ import { decodeKey } from '@acala-network/chopsticks-core' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import type { Argv } from 'yargs' import { setupContext } from '../../context.js' import { configSchema, getYargsOptions } from '../../schema/index.js' diff --git a/packages/chopsticks/src/plugins/dry-run/dry-run-extrinsic.ts b/packages/chopsticks/src/plugins/dry-run/dry-run-extrinsic.ts index 406278a3..d3c58a9d 100644 --- a/packages/chopsticks/src/plugins/dry-run/dry-run-extrinsic.ts +++ b/packages/chopsticks/src/plugins/dry-run/dry-run-extrinsic.ts @@ -1,12 +1,12 @@ import { writeFileSync } from 'node:fs' import { blake2AsHex } from '@polkadot/util-crypto' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { setupContext } from '../../context.js' import { defaultLogger } from '../../logger.js' import { generateHtmlDiffPreviewFile } from '../../utils/generate-html-diff.js' import { openHtml } from '../../utils/open-html.js' -import { DryRunSchemaType } from './index.js' +import type { DryRunSchemaType } from './index.js' export const dryRunExtrinsic = async (argv: DryRunSchemaType) => { const context = await setupContext(argv) diff --git a/packages/chopsticks/src/plugins/dry-run/dry-run-preimage.ts b/packages/chopsticks/src/plugins/dry-run/dry-run-preimage.ts index 31e14511..46fe8a3c 100644 --- a/packages/chopsticks/src/plugins/dry-run/dry-run-preimage.ts +++ b/packages/chopsticks/src/plugins/dry-run/dry-run-preimage.ts @@ -1,13 +1,13 @@ import { compactAddLength, hexToU8a } from '@polkadot/util' import { blake2AsHex } from '@polkadot/util-crypto' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { Block, newHeader, runTask, setStorage, taskHandler } from '@acala-network/chopsticks-core' import { setupContext } from '../../context.js' import { defaultLogger } from '../../logger.js' import { generateHtmlDiffPreviewFile } from '../../utils/generate-html-diff.js' import { openHtml } from '../../utils/open-html.js' -import { DryRunSchemaType } from './index.js' +import type { DryRunSchemaType } from './index.js' export const dryRunPreimage = async (argv: DryRunSchemaType) => { const context = await setupContext(argv) diff --git a/packages/chopsticks/src/plugins/dry-run/rpc.ts b/packages/chopsticks/src/plugins/dry-run/rpc.ts index 24bc1de2..0917a832 100644 --- a/packages/chopsticks/src/plugins/dry-run/rpc.ts +++ b/packages/chopsticks/src/plugins/dry-run/rpc.ts @@ -1,6 +1,6 @@ import { z } from 'zod' -import { Context, ResponseError } from '@acala-network/chopsticks-core' +import { type Context, ResponseError } from '@acala-network/chopsticks-core' import { zHash, zHex } from '../../schema/index.js' import { decodeStorageDiff } from '../../utils/decoder.js' import { generateHtmlDiff } from '../../utils/generate-html-diff.js' diff --git a/packages/chopsticks/src/plugins/follow-chain/cli.ts b/packages/chopsticks/src/plugins/follow-chain/cli.ts index 1788cca5..e521d448 100644 --- a/packages/chopsticks/src/plugins/follow-chain/cli.ts +++ b/packages/chopsticks/src/plugins/follow-chain/cli.ts @@ -1,6 +1,6 @@ import { Block, defaultLogger, runTask, taskHandler } from '@acala-network/chopsticks-core' -import { Header } from '@polkadot/types/interfaces' -import { HexString } from '@polkadot/util/types' +import type { Header } from '@polkadot/types/interfaces' +import type { HexString } from '@polkadot/util/types' import _ from 'lodash' import type { Argv } from 'yargs' import { z } from 'zod' diff --git a/packages/chopsticks/src/plugins/index.ts b/packages/chopsticks/src/plugins/index.ts index 3f95cee7..695d4d41 100644 --- a/packages/chopsticks/src/plugins/index.ts +++ b/packages/chopsticks/src/plugins/index.ts @@ -1,5 +1,5 @@ import { lstatSync, readFileSync, readdirSync } from 'node:fs' -import { Handlers, environment } from '@acala-network/chopsticks-core' +import { type Handlers, environment } from '@acala-network/chopsticks-core' import _ from 'lodash' import type { Argv } from 'yargs' diff --git a/packages/chopsticks/src/plugins/run-block/cli.ts b/packages/chopsticks/src/plugins/run-block/cli.ts index 259186b8..c6a52b25 100644 --- a/packages/chopsticks/src/plugins/run-block/cli.ts +++ b/packages/chopsticks/src/plugins/run-block/cli.ts @@ -1,5 +1,5 @@ import { writeFileSync } from 'node:fs' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import _ from 'lodash' import type { Argv } from 'yargs' import { z } from 'zod' diff --git a/packages/chopsticks/src/plugins/run-block/rpc.ts b/packages/chopsticks/src/plugins/run-block/rpc.ts index 8f18fd7a..c8024e5c 100644 --- a/packages/chopsticks/src/plugins/run-block/rpc.ts +++ b/packages/chopsticks/src/plugins/run-block/rpc.ts @@ -1,14 +1,14 @@ -import { GenericExtrinsic } from '@polkadot/types' -import { Header } from '@polkadot/types/interfaces' +import type { GenericExtrinsic } from '@polkadot/types' +import type { Header } from '@polkadot/types/interfaces' import { u8aToHex } from '@polkadot/util' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import _ from 'lodash' import { z } from 'zod' import { Block, - Context, - RuntimeLog, + type Context, + type RuntimeLog, compactHex, decodeKeyValue, runTask, diff --git a/packages/chopsticks/src/plugins/trace-transaction/index.ts b/packages/chopsticks/src/plugins/trace-transaction/index.ts index cf3cb5e5..0783c86b 100644 --- a/packages/chopsticks/src/plugins/trace-transaction/index.ts +++ b/packages/chopsticks/src/plugins/trace-transaction/index.ts @@ -1,7 +1,7 @@ import { writeFileSync } from 'node:fs' import { pinoLogger } from '@acala-network/chopsticks-core' import _ from 'lodash' -import { Argv } from 'yargs' +import type { Argv } from 'yargs' import { z } from 'zod' import { setupContext } from '../../context.js' diff --git a/packages/chopsticks/src/plugins/trace-transaction/types.ts b/packages/chopsticks/src/plugins/trace-transaction/types.ts index ed3a04d0..58054303 100644 --- a/packages/chopsticks/src/plugins/trace-transaction/types.ts +++ b/packages/chopsticks/src/plugins/trace-transaction/types.ts @@ -1,5 +1,5 @@ -import { Registry } from '@polkadot/types/types' -import { HexString } from '@polkadot/util/types' +import type { Registry } from '@polkadot/types/types' +import type { HexString } from '@polkadot/util/types' export type CallTrace = { type: 'CALL' | 'CALLCODE' | 'STATICCALL' | 'DELEGATECALL' | 'CREATE' | 'SUICIDE' diff --git a/packages/chopsticks/src/plugins/trace-transaction/utils.ts b/packages/chopsticks/src/plugins/trace-transaction/utils.ts index 5a9eb688..7dcc8e03 100644 --- a/packages/chopsticks/src/plugins/trace-transaction/utils.ts +++ b/packages/chopsticks/src/plugins/trace-transaction/utils.ts @@ -1,11 +1,11 @@ -import { Block, Blockchain, RuntimeVersion, pinoLogger } from '@acala-network/chopsticks-core' +import { Block, type Blockchain, type RuntimeVersion, pinoLogger } from '@acala-network/chopsticks-core' import { blake2AsHex } from '@polkadot/util-crypto' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import _ from 'lodash' import { overrideWasm } from '../../utils/override.js' import { opName } from './table.js' -import { Step, TraceOutcome, registerTypes } from './types.js' +import { type Step, type TraceOutcome, registerTypes } from './types.js' /** * Fetches the runtime with tracing feature from Github releases. diff --git a/packages/chopsticks/src/rpc/index.ts b/packages/chopsticks/src/rpc/index.ts index 6ef7a94c..346f6ba5 100644 --- a/packages/chopsticks/src/rpc/index.ts +++ b/packages/chopsticks/src/rpc/index.ts @@ -1,8 +1,8 @@ import { - Context, - Handlers, + type Context, + type Handlers, ResponseError, - SubscriptionManager, + type SubscriptionManager, allHandlers as coreHandlers, defaultLogger, } from '@acala-network/chopsticks-core' diff --git a/packages/chopsticks/src/schema/index.ts b/packages/chopsticks/src/schema/index.ts index 678a583c..227b054e 100644 --- a/packages/chopsticks/src/schema/index.ts +++ b/packages/chopsticks/src/schema/index.ts @@ -1,12 +1,12 @@ import { readFileSync } from 'node:fs' import { basename, extname } from 'node:path' import { BuildBlockMode, defaultLogger, genesisSchema, isUrl } from '@acala-network/chopsticks-core' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import axios from 'axios' import yaml from 'js-yaml' import _ from 'lodash' -import { Options } from 'yargs' -import { ZodNativeEnum, ZodRawShape, ZodTypeAny, z } from 'zod' +import type { Options } from 'yargs' +import { ZodNativeEnum, type ZodRawShape, type ZodTypeAny, z } from 'zod' export const zHex = z.custom((val: any) => /^0x\w+$/.test(val)) export const zHash = z.string().length(66).and(zHex) diff --git a/packages/chopsticks/src/schema/parse.test.ts b/packages/chopsticks/src/schema/parse.test.ts index 48a818b0..8d58ab64 100644 --- a/packages/chopsticks/src/schema/parse.test.ts +++ b/packages/chopsticks/src/schema/parse.test.ts @@ -8,7 +8,7 @@ import { configSchema, fetchConfig } from './index.js' function getAllFiles(dirPath: string) { const files = readdirSync(dirPath) const arrayOfFiles: string[] = [] - files.forEach(function (file) { + files.forEach((file) => { arrayOfFiles.push(path.join(dirPath, '/', file)) }) diff --git a/packages/chopsticks/src/server.ts b/packages/chopsticks/src/server.ts index 27a3302a..a6f7f967 100644 --- a/packages/chopsticks/src/server.ts +++ b/packages/chopsticks/src/server.ts @@ -1,6 +1,6 @@ import http from 'node:http' -import { ResponseError, SubscriptionManager } from '@acala-network/chopsticks-core' -import { AddressInfo, WebSocket, WebSocketServer } from 'ws' +import { ResponseError, type SubscriptionManager } from '@acala-network/chopsticks-core' +import { type AddressInfo, WebSocket, WebSocketServer } from 'ws' import { z } from 'zod' import { defaultLogger, truncate } from './logger.js' diff --git a/packages/chopsticks/src/setup-with-server.ts b/packages/chopsticks/src/setup-with-server.ts index 3f463b44..46e22106 100644 --- a/packages/chopsticks/src/setup-with-server.ts +++ b/packages/chopsticks/src/setup-with-server.ts @@ -1,7 +1,7 @@ import { defaultLogger } from '@acala-network/chopsticks-core' import { setupContext } from './context.js' import { handler } from './rpc/index.js' -import { Config } from './schema/index.js' +import type { Config } from './schema/index.js' import { createServer } from './server.js' export const setupWithServer = async (argv: Config) => { diff --git a/packages/chopsticks/src/utils/decoder.ts b/packages/chopsticks/src/utils/decoder.ts index 6bef7a4a..7a995843 100644 --- a/packages/chopsticks/src/utils/decoder.ts +++ b/packages/chopsticks/src/utils/decoder.ts @@ -1,5 +1,5 @@ -import { Block, decodeBlockStorageDiff } from '@acala-network/chopsticks-core' -import { HexString } from '@polkadot/util/types' +import { type Block, decodeBlockStorageDiff } from '@acala-network/chopsticks-core' +import type { HexString } from '@polkadot/util/types' import { create } from 'jsondiffpatch' import _ from 'lodash' diff --git a/packages/chopsticks/src/utils/fetch-storages.test.ts b/packages/chopsticks/src/utils/fetch-storages.test.ts index 39d8565f..79a4cff0 100644 --- a/packages/chopsticks/src/utils/fetch-storages.test.ts +++ b/packages/chopsticks/src/utils/fetch-storages.test.ts @@ -3,13 +3,13 @@ import { resolve } from 'node:path' import { SqliteDatabase } from '@acala-network/chopsticks-db' import { ApiPromise } from '@polkadot/api' import { WsProvider } from '@polkadot/rpc-provider' -import { ProviderInterface } from '@polkadot/rpc-provider/types' +import type { ProviderInterface } from '@polkadot/rpc-provider/types' import { xxhashAsHex } from '@polkadot/util-crypto' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { Like } from 'typeorm' import { afterAll, beforeAll, describe, expect, it } from 'vitest' -import { FetchStorageConfig, fetchStorages, getPrefixesFromConfig } from './fetch-storages.js' +import { type FetchStorageConfig, fetchStorages, getPrefixesFromConfig } from './fetch-storages.js' describe('fetch-storages', () => { let api: ApiPromise diff --git a/packages/chopsticks/src/utils/fetch-storages.ts b/packages/chopsticks/src/utils/fetch-storages.ts index bad1604f..4d2ba6fa 100644 --- a/packages/chopsticks/src/utils/fetch-storages.ts +++ b/packages/chopsticks/src/utils/fetch-storages.ts @@ -4,12 +4,12 @@ import { SqliteDatabase } from '@acala-network/chopsticks-db' import { ApiPromise } from '@polkadot/api' import { WsProvider } from '@polkadot/rpc-provider' import { expandMetadata } from '@polkadot/types' -import { StorageEntryMetadataLatest } from '@polkadot/types/interfaces' -import { DecoratedMeta, ModuleStorage } from '@polkadot/types/metadata/decorate/types' -import { StorageEntry } from '@polkadot/types/primitive/types' +import type { StorageEntryMetadataLatest } from '@polkadot/types/interfaces' +import type { DecoratedMeta, ModuleStorage } from '@polkadot/types/metadata/decorate/types' +import type { StorageEntry } from '@polkadot/types/primitive/types' import { compactStripLength, stringCamelCase, u8aToHex } from '@polkadot/util' import { xxhashAsHex } from '@polkadot/util-crypto' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { releaseProxy, wrap } from 'comlink' import nodeEndpoint from 'comlink/dist/umd/node-adapter.js' import _ from 'lodash' diff --git a/packages/chopsticks/src/utils/generate-html-diff.ts b/packages/chopsticks/src/utils/generate-html-diff.ts index d7e465b5..43fb3c84 100644 --- a/packages/chopsticks/src/utils/generate-html-diff.ts +++ b/packages/chopsticks/src/utils/generate-html-diff.ts @@ -1,6 +1,6 @@ import { mkdirSync, readFileSync, writeFileSync } from 'node:fs' -import { Block } from '@acala-network/chopsticks-core' -import { HexString } from '@polkadot/util/types' +import type { Block } from '@acala-network/chopsticks-core' +import type { HexString } from '@polkadot/util/types' import _ from 'lodash' import { decodeStorageDiff } from './decoder.js' diff --git a/packages/chopsticks/src/utils/override.ts b/packages/chopsticks/src/utils/override.ts index 559f0f5d..98537850 100644 --- a/packages/chopsticks/src/utils/override.ts +++ b/packages/chopsticks/src/utils/override.ts @@ -1,6 +1,6 @@ import { existsSync, readFileSync } from 'node:fs' -import { Blockchain, StorageValues, isUrl, setStorage } from '@acala-network/chopsticks-core' -import { HexString } from '@polkadot/util/types' +import { type Blockchain, type StorageValues, isUrl, setStorage } from '@acala-network/chopsticks-core' +import type { HexString } from '@polkadot/util/types' import axios from 'axios' import yaml from 'js-yaml' diff --git a/packages/core/src/api.ts b/packages/core/src/api.ts index adc25f2f..cf7d2361 100644 --- a/packages/core/src/api.ts +++ b/packages/core/src/api.ts @@ -1,9 +1,9 @@ -import { ProviderInterface, ProviderInterfaceCallback } from '@polkadot/rpc-provider/types' -import { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types' -import { HexString } from '@polkadot/util/types' +import type { ProviderInterface, ProviderInterfaceCallback } from '@polkadot/rpc-provider/types' +import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types' +import type { HexString } from '@polkadot/util/types' import _ from 'lodash' -import { ChainProperties, Header, SignedBlock } from './index.js' +import type { ChainProperties, Header, SignedBlock } from './index.js' import { prefixedChildKey, splitChildKey, stripChildPrefix } from './utils/index.js' /** diff --git a/packages/core/src/blockchain/block-builder.ts b/packages/core/src/blockchain/block-builder.ts index 8e114e0c..65820b01 100644 --- a/packages/core/src/blockchain/block-builder.ts +++ b/packages/core/src/blockchain/block-builder.ts @@ -1,5 +1,5 @@ -import { GenericExtrinsic } from '@polkadot/types' -import { +import type { GenericExtrinsic } from '@polkadot/types' +import type { AccountInfo, ApplyExtrinsicResult, Call, @@ -11,14 +11,14 @@ import { } from '@polkadot/types/interfaces' import { compactAddLength, hexToU8a, stringToHex, u8aConcat } from '@polkadot/util' import { blake2AsU8a } from '@polkadot/util-crypto' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { defaultLogger, truncate } from '../logger.js' import { compactHex, getCurrentSlot } from '../utils/index.js' -import { TaskCallResponse } from '../wasm-executor/index.js' +import type { TaskCallResponse } from '../wasm-executor/index.js' import { Block } from './block.js' -import { InherentProvider } from './inherent/index.js' +import type { InherentProvider } from './inherent/index.js' import { StorageLayer, StorageValueKind } from './storage-layer.js' -import { BuildBlockParams } from './txpool.js' +import type { BuildBlockParams } from './txpool.js' const logger = defaultLogger.child({ name: 'block-builder' }) diff --git a/packages/core/src/blockchain/block.ts b/packages/core/src/blockchain/block.ts index e14ce5d1..984c9e10 100644 --- a/packages/core/src/blockchain/block.ts +++ b/packages/core/src/blockchain/block.ts @@ -1,20 +1,20 @@ -import { Metadata, TypeRegistry } from '@polkadot/types' -import { Header } from '@polkadot/types/interfaces' +import { Metadata, type TypeRegistry } from '@polkadot/types' +import type { Header } from '@polkadot/types/interfaces' import { expandMetadata } from '@polkadot/types/metadata' -import { DecoratedMeta } from '@polkadot/types/metadata/decorate/types' -import { StorageEntry } from '@polkadot/types/primitive/types' +import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types' +import type { StorageEntry } from '@polkadot/types/primitive/types' import { hexToU8a, stringToHex } from '@polkadot/util' import type { HexString } from '@polkadot/util/types' import { compactHex } from '../utils/index.js' import { getRuntimeVersion, runTask, taskHandler } from '../wasm-executor/index.js' import type { RuntimeVersion, TaskCallResponse } from '../wasm-executor/index.js' -import { Blockchain } from './index.js' +import type { Blockchain } from './index.js' import { RemoteStorageLayer, StorageLayer, - StorageLayerProvider, - StorageValue, + type StorageLayerProvider, + type StorageValue, StorageValueKind, } from './storage-layer.js' diff --git a/packages/core/src/blockchain/get-keys-paged.test.ts b/packages/core/src/blockchain/get-keys-paged.test.ts index 3a038a5f..767b02fc 100644 --- a/packages/core/src/blockchain/get-keys-paged.test.ts +++ b/packages/core/src/blockchain/get-keys-paged.test.ts @@ -1,7 +1,7 @@ import _ from 'lodash' import { describe, expect, it, vi } from 'vitest' import { Api } from '../api.js' -import { RemoteStorageLayer, StorageLayer, StorageValue, StorageValueKind } from './storage-layer.js' +import { RemoteStorageLayer, StorageLayer, type StorageValue, StorageValueKind } from './storage-layer.js' describe('getKeysPaged', () => { const hash = '0x1111111111111111111111111111111111111111111111111111111111111111' @@ -462,7 +462,7 @@ describe('getKeysPaged', () => { } const allKeys = pages - .flatMap((x) => x) + .flat() .reduce((acc, x) => { if (acc.includes(x)) { return acc diff --git a/packages/core/src/blockchain/head-state.ts b/packages/core/src/blockchain/head-state.ts index 5e3db26b..3bbcae2b 100644 --- a/packages/core/src/blockchain/head-state.ts +++ b/packages/core/src/blockchain/head-state.ts @@ -1,5 +1,5 @@ import { defaultLogger } from '../logger.js' -import { Block } from './block.js' +import type { Block } from './block.js' type Callback = (block: Block, pairs: [string, string | null][]) => void | Promise diff --git a/packages/core/src/blockchain/index.ts b/packages/core/src/blockchain/index.ts index 505cfb76..46a53cce 100644 --- a/packages/core/src/blockchain/index.ts +++ b/packages/core/src/blockchain/index.ts @@ -1,26 +1,32 @@ import { Metadata, TypeRegistry } from '@polkadot/types' import { getSpecExtensions, getSpecHasher, getSpecTypes } from '@polkadot/types-known/util' import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types' -import { ApplyExtrinsicResult, ChainProperties, Header } from '@polkadot/types/interfaces' +import type { ApplyExtrinsicResult, ChainProperties, Header } from '@polkadot/types/interfaces' import type { TransactionValidity } from '@polkadot/types/interfaces/txqueue' -import { RegisteredTypes } from '@polkadot/types/types' +import type { RegisteredTypes } from '@polkadot/types/types' import { objectSpread, u8aConcat, u8aToHex } from '@polkadot/util' import { blake2AsHex, xxhashAsHex } from '@polkadot/util-crypto' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import _ from 'lodash' -import { Api } from '../api.js' -import { Database } from '../database.js' +import type { Api } from '../api.js' +import type { Database } from '../database.js' import { defaultLogger } from '../logger.js' import { OffchainWorker } from '../offchain.js' import { compactHex } from '../utils/index.js' -import { RuntimeVersion } from '../wasm-executor/index.js' +import type { RuntimeVersion } from '../wasm-executor/index.js' import { dryRunExtrinsic, dryRunInherents } from './block-builder.js' import { Block } from './block.js' import { HeadState } from './head-state.js' -import { InherentProvider } from './inherent/index.js' -import { StorageValue } from './storage-layer.js' -import { BuildBlockMode, BuildBlockParams, DownwardMessage, HorizontalMessage, TxPool } from './txpool.js' +import type { InherentProvider } from './inherent/index.js' +import type { StorageValue } from './storage-layer.js' +import { + type BuildBlockMode, + type BuildBlockParams, + type DownwardMessage, + type HorizontalMessage, + TxPool, +} from './txpool.js' const logger = defaultLogger.child({ name: 'blockchain' }) diff --git a/packages/core/src/blockchain/inherent/index.ts b/packages/core/src/blockchain/inherent/index.ts index c4d3bee4..48d8a2e0 100644 --- a/packages/core/src/blockchain/inherent/index.ts +++ b/packages/core/src/blockchain/inherent/index.ts @@ -1,6 +1,6 @@ -import { HexString } from '@polkadot/util/types' -import { Block } from '../block.js' -import { BuildBlockParams } from '../txpool.js' +import type { HexString } from '@polkadot/util/types' +import type { Block } from '../block.js' +import type { BuildBlockParams } from '../txpool.js' import { ParaInherentEnter } from './para-enter.js' import { SetBabeRandomness } from './parachain/babe-randomness.js' import { SetNimbusAuthorInherent } from './parachain/nimbus-author-inherent.js' diff --git a/packages/core/src/blockchain/inherent/para-enter.ts b/packages/core/src/blockchain/inherent/para-enter.ts index 0b8cfda4..eb47746c 100644 --- a/packages/core/src/blockchain/inherent/para-enter.ts +++ b/packages/core/src/blockchain/inherent/para-enter.ts @@ -1,9 +1,9 @@ import { GenericExtrinsic } from '@polkadot/types' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' -import { Block } from '../block.js' -import { BuildBlockParams } from '../txpool.js' -import { InherentProvider } from './index.js' +import type { Block } from '../block.js' +import type { BuildBlockParams } from '../txpool.js' +import type { InherentProvider } from './index.js' export class ParaInherentEnter implements InherentProvider { async createInherents(newBlock: Block, _params: BuildBlockParams): Promise { diff --git a/packages/core/src/blockchain/inherent/parachain/babe-randomness.ts b/packages/core/src/blockchain/inherent/parachain/babe-randomness.ts index e21c07b9..5af572cc 100644 --- a/packages/core/src/blockchain/inherent/parachain/babe-randomness.ts +++ b/packages/core/src/blockchain/inherent/parachain/babe-randomness.ts @@ -1,9 +1,9 @@ import { GenericExtrinsic } from '@polkadot/types' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' -import { Block } from '../../block.js' -import { BuildBlockParams } from '../../txpool.js' -import { InherentProvider } from '../index.js' +import type { Block } from '../../block.js' +import type { BuildBlockParams } from '../../txpool.js' +import type { InherentProvider } from '../index.js' // Support for Moonbeam pallet-randomness mandatory inherent export class SetBabeRandomness implements InherentProvider { diff --git a/packages/core/src/blockchain/inherent/parachain/nimbus-author-inherent.ts b/packages/core/src/blockchain/inherent/parachain/nimbus-author-inherent.ts index 34fcabcb..373c1632 100644 --- a/packages/core/src/blockchain/inherent/parachain/nimbus-author-inherent.ts +++ b/packages/core/src/blockchain/inherent/parachain/nimbus-author-inherent.ts @@ -1,9 +1,9 @@ import { GenericExtrinsic } from '@polkadot/types' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { compactHex } from '../../../utils/index.js' -import { Block } from '../../block.js' -import { BuildBlockParams } from '../../txpool.js' -import { InherentProvider } from '../index.js' +import type { Block } from '../../block.js' +import type { BuildBlockParams } from '../../txpool.js' +import type { InherentProvider } from '../index.js' // Support for Nimbus Author Inherent export class SetNimbusAuthorInherent implements InherentProvider { async createInherents(newBlock: Block, _params: BuildBlockParams): Promise { diff --git a/packages/core/src/blockchain/inherent/parachain/validation-data.ts b/packages/core/src/blockchain/inherent/parachain/validation-data.ts index 038b9514..5806c6cb 100644 --- a/packages/core/src/blockchain/inherent/parachain/validation-data.ts +++ b/packages/core/src/blockchain/inherent/parachain/validation-data.ts @@ -1,7 +1,7 @@ import { GenericExtrinsic } from '@polkadot/types' -import { AbridgedHrmpChannel, HrmpChannelId, Slot } from '@polkadot/types/interfaces' -import { BN, hexToU8a, u8aConcat, u8aToHex } from '@polkadot/util' -import { HexString } from '@polkadot/util/types' +import type { AbridgedHrmpChannel, HrmpChannelId, Slot } from '@polkadot/types/interfaces' +import { type BN, hexToU8a, u8aConcat, u8aToHex } from '@polkadot/util' +import type { HexString } from '@polkadot/util/types' import _ from 'lodash' import { blake2AsHex, blake2AsU8a } from '@polkadot/util-crypto' @@ -16,9 +16,9 @@ import { upgradeGoAheadSignal, } from '../../../utils/proof.js' import { createProof, decodeProof } from '../../../wasm-executor/index.js' -import { Block } from '../../block.js' -import { BuildBlockParams, DownwardMessage, HorizontalMessage } from '../../txpool.js' -import { InherentProvider } from '../index.js' +import type { Block } from '../../block.js' +import type { BuildBlockParams, DownwardMessage, HorizontalMessage } from '../../txpool.js' +import type { InherentProvider } from '../index.js' const MOCK_VALIDATION_DATA = { validationData: { diff --git a/packages/core/src/blockchain/inherent/timestamp.ts b/packages/core/src/blockchain/inherent/timestamp.ts index 27f256ef..ea665c5b 100644 --- a/packages/core/src/blockchain/inherent/timestamp.ts +++ b/packages/core/src/blockchain/inherent/timestamp.ts @@ -1,8 +1,8 @@ import { GenericExtrinsic } from '@polkadot/types' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { getCurrentTimestamp, getSlotDuration } from '../../utils/index.js' -import { Block } from '../block.js' -import { InherentProvider } from './index.js' +import type { Block } from '../block.js' +import type { InherentProvider } from './index.js' export class SetTimestamp implements InherentProvider { async createInherents(newBlock: Block): Promise { diff --git a/packages/core/src/blockchain/storage-layer.ts b/packages/core/src/blockchain/storage-layer.ts index 0e88333f..26d2110d 100644 --- a/packages/core/src/blockchain/storage-layer.ts +++ b/packages/core/src/blockchain/storage-layer.ts @@ -1,8 +1,8 @@ -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import _ from 'lodash' -import { Api } from '../api.js' -import { Database } from '../database.js' +import type { Api } from '../api.js' +import type { Database } from '../database.js' import { defaultLogger } from '../logger.js' import { CHILD_PREFIX_LENGTH, PREFIX_LENGTH, isPrefixedChildKey } from '../utils/index.js' import KeyCache from '../utils/key-cache.js' @@ -11,7 +11,7 @@ const logger = defaultLogger.child({ name: 'layer' }) const BATCH_SIZE = 1000 -export const enum StorageValueKind { +export enum StorageValueKind { Deleted = 'Deleted', DeletedPrefix = 'DeletedPrefix', } diff --git a/packages/core/src/blockchain/txpool.ts b/packages/core/src/blockchain/txpool.ts index 24834e94..8f9f8835 100644 --- a/packages/core/src/blockchain/txpool.ts +++ b/packages/core/src/blockchain/txpool.ts @@ -1,14 +1,14 @@ -import { GenericExtrinsic } from '@polkadot/types' +import type { GenericExtrinsic } from '@polkadot/types' import { hexToU8a } from '@polkadot/util/hex/toU8a' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { EventEmitter } from 'eventemitter3' import _ from 'lodash' import { defaultLogger, truncate } from '../logger.js' -import { Deferred, defer } from '../utils/index.js' +import { type Deferred, defer } from '../utils/index.js' import { buildBlock } from './block-builder.js' -import { Blockchain } from './index.js' -import { InherentProvider } from './inherent/index.js' +import type { Blockchain } from './index.js' +import type { InherentProvider } from './inherent/index.js' const logger = defaultLogger.child({ name: 'txpool' }) diff --git a/packages/core/src/chopsticks-provider.ts b/packages/core/src/chopsticks-provider.ts index 638afa58..fd4c78ca 100644 --- a/packages/core/src/chopsticks-provider.ts +++ b/packages/core/src/chopsticks-provider.ts @@ -1,4 +1,4 @@ -import { +import type { ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, @@ -6,10 +6,10 @@ import { } from '@polkadot/rpc-provider/types' import { EventEmitter } from 'eventemitter3' -import { Blockchain } from './blockchain/index.js' -import { Database } from './database.js' +import type { Blockchain } from './blockchain/index.js' +import type { Database } from './database.js' import { defaultLogger } from './logger.js' -import { Handlers, allHandlers } from './rpc/index.js' +import { type Handlers, allHandlers } from './rpc/index.js' import { setup } from './setup.js' const providerHandlers: Handlers = { diff --git a/packages/core/src/database.ts b/packages/core/src/database.ts index 29a0338c..c6329316 100644 --- a/packages/core/src/database.ts +++ b/packages/core/src/database.ts @@ -1,4 +1,4 @@ -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' export interface BlockEntry { hash: HexString diff --git a/packages/core/src/genesis-provider.ts b/packages/core/src/genesis-provider.ts index 146f5abc..fbb7deba 100644 --- a/packages/core/src/genesis-provider.ts +++ b/packages/core/src/genesis-provider.ts @@ -1,15 +1,15 @@ -import { +import type { ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted, } from '@polkadot/rpc-provider/types' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { EventEmitter } from 'eventemitter3' import { defaultLogger, isPrefixedChildKey } from './index.js' -import { Genesis, genesisSchema } from './schema/index.js' -import { JsCallback, calculateStateRoot, emptyTaskHandler } from './wasm-executor/index.js' +import { type Genesis, genesisSchema } from './schema/index.js' +import { type JsCallback, calculateStateRoot, emptyTaskHandler } from './wasm-executor/index.js' /** * Provider to start a chain from genesis @@ -121,14 +121,14 @@ export class GenesisProvider implements ProviderInterface { const storage = this.#genesis.genesis.raw.top return { ...emptyTaskHandler, - getStorage: async function (key: HexString) { + getStorage: async (key: HexString) => { if (isPrefixedChildKey(key)) { defaultLogger.warn({ key }, 'genesis child storage not supported') return undefined } return storage[key] }, - getNextKey: async function (prefix: HexString, key: HexString) { + getNextKey: async (prefix: HexString, key: HexString) => { if (isPrefixedChildKey(key)) { defaultLogger.warn({ prefix, key }, 'genesis child storage not supported') return undefined diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index c1e70f49..9c9519e3 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -8,7 +8,7 @@ * @packageDocumentation */ -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' export type ChainProperties = { ss58Format?: number diff --git a/packages/core/src/offchain.ts b/packages/core/src/offchain.ts index b7514e24..d9300d2e 100644 --- a/packages/core/src/offchain.ts +++ b/packages/core/src/offchain.ts @@ -1,7 +1,7 @@ import { blake2AsHex } from '@polkadot/util-crypto' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { queueScheduler } from 'rxjs' -import { Block } from './blockchain/block.js' +import type { Block } from './blockchain/block.js' import { defaultLogger } from './logger.js' const logger = defaultLogger.child({ name: 'offchain' }) diff --git a/packages/core/src/rpc/dev/new-block.ts b/packages/core/src/rpc/dev/new-block.ts index c62df8ee..1307fc7a 100644 --- a/packages/core/src/rpc/dev/new-block.ts +++ b/packages/core/src/rpc/dev/new-block.ts @@ -1,6 +1,6 @@ -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { z } from 'zod' -import { Context, ResponseError, zHex } from '../shared.js' +import { type Context, ResponseError, zHex } from '../shared.js' import { defaultLogger } from '../../logger.js' diff --git a/packages/core/src/rpc/dev/set-block-build-mode.ts b/packages/core/src/rpc/dev/set-block-build-mode.ts index a924fc0a..8110d161 100644 --- a/packages/core/src/rpc/dev/set-block-build-mode.ts +++ b/packages/core/src/rpc/dev/set-block-build-mode.ts @@ -1,6 +1,6 @@ import { BuildBlockMode } from '../../blockchain/txpool.js' import { defaultLogger } from '../../logger.js' -import { Context, ResponseError } from '../shared.js' +import { type Context, ResponseError } from '../shared.js' /** * Set block build mode. diff --git a/packages/core/src/rpc/dev/set-head.ts b/packages/core/src/rpc/dev/set-head.ts index 0485ee98..05a50834 100644 --- a/packages/core/src/rpc/dev/set-head.ts +++ b/packages/core/src/rpc/dev/set-head.ts @@ -1,6 +1,6 @@ import { z } from 'zod' -import { Block } from '../../blockchain/block.js' -import { Context, ResponseError, zHash } from '../shared.js' +import type { Block } from '../../blockchain/block.js' +import { type Context, ResponseError, zHash } from '../shared.js' const schema = zHash.or(z.number()) type Params = z.infer diff --git a/packages/core/src/rpc/dev/set-runtime-log-level.ts b/packages/core/src/rpc/dev/set-runtime-log-level.ts index ea0babb8..c36b8af6 100644 --- a/packages/core/src/rpc/dev/set-runtime-log-level.ts +++ b/packages/core/src/rpc/dev/set-runtime-log-level.ts @@ -1,5 +1,5 @@ import { defaultLogger } from '../../logger.js' -import { Context, ResponseError } from '../shared.js' +import { type Context, ResponseError } from '../shared.js' /** * Set runtime log level. diff --git a/packages/core/src/rpc/dev/set-storage.ts b/packages/core/src/rpc/dev/set-storage.ts index 9b51e5b6..01a38369 100644 --- a/packages/core/src/rpc/dev/set-storage.ts +++ b/packages/core/src/rpc/dev/set-storage.ts @@ -1,8 +1,8 @@ -import { HexString } from '@polkadot/util/types' -import { Context, ResponseError } from '../shared.js' +import type { HexString } from '@polkadot/util/types' +import { type Context, ResponseError } from '../shared.js' import { defaultLogger } from '../../logger.js' -import { StorageValues, setStorage } from '../../utils/set-storage.js' +import { type StorageValues, setStorage } from '../../utils/set-storage.js' /** * Set storage values. diff --git a/packages/core/src/rpc/dev/time-travel.ts b/packages/core/src/rpc/dev/time-travel.ts index 040a2cce..ad7cbc44 100644 --- a/packages/core/src/rpc/dev/time-travel.ts +++ b/packages/core/src/rpc/dev/time-travel.ts @@ -1,5 +1,5 @@ import { timeTravel } from '../../utils/time-travel.js' -import { Context, ResponseError } from '../shared.js' +import { type Context, ResponseError } from '../shared.js' /** * Travel to a specific time. diff --git a/packages/core/src/rpc/index.ts b/packages/core/src/rpc/index.ts index 64f11af3..512a9ec0 100644 --- a/packages/core/src/rpc/index.ts +++ b/packages/core/src/rpc/index.ts @@ -1,6 +1,6 @@ import dev from './dev/index.js' import rpcSpec from './rpc-spec/index.js' -import { Handlers } from './shared.js' +import type { Handlers } from './shared.js' import substrate from './substrate/index.js' export const allHandlers: Handlers = { diff --git a/packages/core/src/rpc/rpc-spec/chainHead_v1.ts b/packages/core/src/rpc/rpc-spec/chainHead_v1.ts index c736a2d5..0067656b 100644 --- a/packages/core/src/rpc/rpc-spec/chainHead_v1.ts +++ b/packages/core/src/rpc/rpc-spec/chainHead_v1.ts @@ -1,7 +1,7 @@ -import { HexString } from '@polkadot/util/types' -import { Block } from '../../blockchain/block.js' +import type { HexString } from '@polkadot/util/types' +import type { Block } from '../../blockchain/block.js' import { defaultLogger } from '../../logger.js' -import { Handler, ResponseError, SubscriptionManager } from '../shared.js' +import { type Handler, ResponseError, type SubscriptionManager } from '../shared.js' const logger = defaultLogger.child({ name: 'rpc-chainHead_v1' }) diff --git a/packages/core/src/rpc/rpc-spec/chainSpec_v1.ts b/packages/core/src/rpc/rpc-spec/chainSpec_v1.ts index 0e86d861..4b6cc965 100644 --- a/packages/core/src/rpc/rpc-spec/chainSpec_v1.ts +++ b/packages/core/src/rpc/rpc-spec/chainSpec_v1.ts @@ -1,6 +1,6 @@ -import { HexString } from '@polkadot/util/types' -import { ChainProperties } from '../../index.js' -import { Handler, ResponseError } from '../shared.js' +import type { HexString } from '@polkadot/util/types' +import type { ChainProperties } from '../../index.js' +import { type Handler, ResponseError } from '../shared.js' export const chainSpec_v1_chainName: Handler<[], string> = async (context) => { return context.chain.api.getSystemChain() diff --git a/packages/core/src/rpc/rpc-spec/transaction_v1.ts b/packages/core/src/rpc/rpc-spec/transaction_v1.ts index 37df89d5..e5aa89ee 100644 --- a/packages/core/src/rpc/rpc-spec/transaction_v1.ts +++ b/packages/core/src/rpc/rpc-spec/transaction_v1.ts @@ -1,6 +1,6 @@ -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { defaultLogger } from '../../logger.js' -import { Handler } from '../shared.js' +import type { Handler } from '../shared.js' const logger = defaultLogger.child({ name: 'rpc-transaction_v1' }) const randomId = () => Math.random().toString(36).substring(2) diff --git a/packages/core/src/rpc/shared.ts b/packages/core/src/rpc/shared.ts index cd8bf8f9..32de0cb9 100644 --- a/packages/core/src/rpc/shared.ts +++ b/packages/core/src/rpc/shared.ts @@ -1,7 +1,7 @@ -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { z } from 'zod' -import { Blockchain } from '../blockchain/index.js' +import type { Blockchain } from '../blockchain/index.js' import { defaultLogger } from '../logger.js' export const logger = defaultLogger.child({ name: 'rpc' }) diff --git a/packages/core/src/rpc/substrate/archive.ts b/packages/core/src/rpc/substrate/archive.ts index c9b4ffa2..f71749a4 100644 --- a/packages/core/src/rpc/substrate/archive.ts +++ b/packages/core/src/rpc/substrate/archive.ts @@ -1,6 +1,6 @@ -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' -import { Handler, ResponseError } from '../shared.js' +import { type Handler, ResponseError } from '../shared.js' import { chain_getBlockHash } from './chain.js' import { state_call } from './state.js' diff --git a/packages/core/src/rpc/substrate/author.ts b/packages/core/src/rpc/substrate/author.ts index 99e415df..8045d0cd 100644 --- a/packages/core/src/rpc/substrate/author.ts +++ b/packages/core/src/rpc/substrate/author.ts @@ -1,10 +1,10 @@ -import { TransactionValidityError } from '@polkadot/types/interfaces' -import { HexString } from '@polkadot/util/types' +import type { TransactionValidityError } from '@polkadot/types/interfaces' +import type { HexString } from '@polkadot/util/types' -import { Block } from '../../blockchain/block.js' +import type { Block } from '../../blockchain/block.js' import { APPLY_EXTRINSIC_ERROR } from '../../blockchain/txpool.js' import { defaultLogger } from '../../logger.js' -import { Handler, ResponseError, SubscriptionManager } from '../shared.js' +import { type Handler, ResponseError, type SubscriptionManager } from '../shared.js' const logger = defaultLogger.child({ name: 'rpc-author' }) diff --git a/packages/core/src/rpc/substrate/chain.ts b/packages/core/src/rpc/substrate/chain.ts index 73e6a359..925f1a0c 100644 --- a/packages/core/src/rpc/substrate/chain.ts +++ b/packages/core/src/rpc/substrate/chain.ts @@ -1,9 +1,9 @@ -import { Header as CodecHeader } from '@polkadot/types/interfaces' +import type { Header as CodecHeader } from '@polkadot/types/interfaces' import { hexToNumber, isHex } from '@polkadot/util' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import type { Header } from '../../index.js' -import { Handler, ResponseError } from '../shared.js' +import { type Handler, ResponseError } from '../shared.js' const processHeader = ({ parentHash, number, stateRoot, extrinsicsRoot, digest }: CodecHeader) => { return { diff --git a/packages/core/src/rpc/substrate/payment.ts b/packages/core/src/rpc/substrate/payment.ts index 3f881ab4..8a4146a6 100644 --- a/packages/core/src/rpc/substrate/payment.ts +++ b/packages/core/src/rpc/substrate/payment.ts @@ -1,7 +1,7 @@ import { hexToU8a } from '@polkadot/util' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' -import { Handler, ResponseError } from '../shared.js' +import { type Handler, ResponseError } from '../shared.js' /** * @param context diff --git a/packages/core/src/rpc/substrate/state.ts b/packages/core/src/rpc/substrate/state.ts index aab251d4..1d25c2ae 100644 --- a/packages/core/src/rpc/substrate/state.ts +++ b/packages/core/src/rpc/substrate/state.ts @@ -1,11 +1,11 @@ import { stringToHex } from '@polkadot/util' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' -import { Block } from '../../blockchain/block.js' +import type { Block } from '../../blockchain/block.js' import { defaultLogger } from '../../logger.js' import { isPrefixedChildKey, prefixedChildKey, stripChildPrefix } from '../../utils/index.js' -import { RuntimeVersion } from '../../wasm-executor/index.js' -import { Handler, ResponseError } from '../shared.js' +import type { RuntimeVersion } from '../../wasm-executor/index.js' +import { type Handler, ResponseError } from '../shared.js' const logger = defaultLogger.child({ name: 'rpc-state' }) diff --git a/packages/core/src/rpc/substrate/system.ts b/packages/core/src/rpc/substrate/system.ts index 3a3d67b4..668cce44 100644 --- a/packages/core/src/rpc/substrate/system.ts +++ b/packages/core/src/rpc/substrate/system.ts @@ -1,9 +1,9 @@ -import { Index } from '@polkadot/types/interfaces' +import type { Index } from '@polkadot/types/interfaces' import { hexToU8a } from '@polkadot/util' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' -import { ChainProperties } from '../../index.js' -import { Handler } from '../shared.js' +import type { ChainProperties } from '../../index.js' +import type { Handler } from '../shared.js' export const system_localPeerId = async () => '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY' export const system_nodeRoles = async () => ['Full'] diff --git a/packages/core/src/setup.ts b/packages/core/src/setup.ts index b1f3166a..ba81dc1c 100644 --- a/packages/core/src/setup.ts +++ b/packages/core/src/setup.ts @@ -1,15 +1,15 @@ import '@polkadot/types-codec' import { HttpProvider, WsProvider } from '@polkadot/rpc-provider' -import { ProviderInterface } from '@polkadot/rpc-provider/types' -import { RegisteredTypes } from '@polkadot/types/types' -import { HexString } from '@polkadot/util/types' +import type { ProviderInterface } from '@polkadot/rpc-provider/types' +import type { RegisteredTypes } from '@polkadot/types/types' +import type { HexString } from '@polkadot/util/types' import { Api } from './api.js' import { Blockchain } from './blockchain/index.js' import { inherentProviders } from './blockchain/inherent/index.js' -import { BuildBlockMode } from './blockchain/txpool.js' -import { Database } from './database.js' -import { GenesisProvider } from './genesis-provider.js' +import type { BuildBlockMode } from './blockchain/txpool.js' +import type { Database } from './database.js' +import type { GenesisProvider } from './genesis-provider.js' import { defaultLogger } from './logger.js' export type SetupOptions = { diff --git a/packages/core/src/utils/decoder.ts b/packages/core/src/utils/decoder.ts index 5597c6f9..984e62f7 100644 --- a/packages/core/src/utils/decoder.ts +++ b/packages/core/src/utils/decoder.ts @@ -1,13 +1,13 @@ import '@polkadot/types-codec' -import { StorageKey } from '@polkadot/types' -import { Registry } from '@polkadot/types-codec/types' -import { DecoratedMeta } from '@polkadot/types/metadata/decorate/types' -import { StorageEntry } from '@polkadot/types/primitive/types' +import type { StorageKey } from '@polkadot/types' +import type { Registry } from '@polkadot/types-codec/types' +import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types' +import type { StorageEntry } from '@polkadot/types/primitive/types' import { hexToU8a, u8aToHex } from '@polkadot/util' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import _ from 'lodash' import { LRUCache } from 'lru-cache' -import { Block } from '../blockchain/block.js' +import type { Block } from '../blockchain/block.js' import { defaultLogger } from '../logger.js' import { decodeWellKnownKey } from './well-known-keys.js' diff --git a/packages/core/src/utils/index.ts b/packages/core/src/utils/index.ts index c51caa14..6644abb0 100644 --- a/packages/core/src/utils/index.ts +++ b/packages/core/src/utils/index.ts @@ -1,11 +1,11 @@ -import { StorageKey } from '@polkadot/types' -import { BN, compactStripLength, u8aToHex } from '@polkadot/util' +import type { StorageKey } from '@polkadot/types' +import { type BN, compactStripLength, u8aToHex } from '@polkadot/util' import { hexAddPrefix, hexStripPrefix } from '@polkadot/util/hex' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { getAuraSlotDuration } from '../wasm-executor/index.js' -import { Block } from '../blockchain/block.js' -import { Blockchain } from '../blockchain/index.js' +import type { Block } from '../blockchain/block.js' +import type { Blockchain } from '../blockchain/index.js' export * from './set-storage.js' export * from './time-travel.js' diff --git a/packages/core/src/utils/key-cache.ts b/packages/core/src/utils/key-cache.ts index c22e0d91..15d4a557 100644 --- a/packages/core/src/utils/key-cache.ts +++ b/packages/core/src/utils/key-cache.ts @@ -1,4 +1,4 @@ -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import _ from 'lodash' export default class KeyCache { diff --git a/packages/core/src/utils/proof.ts b/packages/core/src/utils/proof.ts index 03879bab..ea14739d 100644 --- a/packages/core/src/utils/proof.ts +++ b/packages/core/src/utils/proof.ts @@ -1,8 +1,8 @@ -import { u32 } from '@polkadot/types' -import { HrmpChannelId } from '@polkadot/types/interfaces' +import type { u32 } from '@polkadot/types' +import type { HrmpChannelId } from '@polkadot/types/interfaces' import { hexToU8a, u8aConcat, u8aToHex } from '@polkadot/util' import { xxhashAsU8a } from '@polkadot/util-crypto' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' export const WELL_KNOWN_KEYS = { EPOCH_INDEX: '0x1cb6f36e027abb2091cfb5110ab5087f38316cbf8fa0da822a20ac1c55bf1be3' as HexString, diff --git a/packages/core/src/utils/set-storage.ts b/packages/core/src/utils/set-storage.ts index e1819e88..bca614bf 100644 --- a/packages/core/src/utils/set-storage.ts +++ b/packages/core/src/utils/set-storage.ts @@ -1,10 +1,10 @@ import { StorageKey } from '@polkadot/types' -import { DecoratedMeta } from '@polkadot/types/metadata/decorate/types' +import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types' import { u8aToHex } from '@polkadot/util' import { stringCamelCase } from '@polkadot/util/string' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' -import { Blockchain } from '../blockchain/index.js' +import type { Blockchain } from '../blockchain/index.js' import { StorageValueKind } from '../blockchain/storage-layer.js' type RawStorageValues = [string, string | null][] diff --git a/packages/core/src/utils/time-travel.ts b/packages/core/src/utils/time-travel.ts index 2b066fd4..5e12bf83 100644 --- a/packages/core/src/utils/time-travel.ts +++ b/packages/core/src/utils/time-travel.ts @@ -1,7 +1,7 @@ -import { BN, u8aToHex } from '@polkadot/util' -import { HexString } from '@polkadot/util/types' +import { type BN, u8aToHex } from '@polkadot/util' +import type { HexString } from '@polkadot/util/types' -import { Blockchain } from '../blockchain/index.js' +import type { Blockchain } from '../blockchain/index.js' import { compactHex, getSlotDuration } from './index.js' import { setStorage } from './set-storage.js' diff --git a/packages/core/src/utils/well-known-keys.ts b/packages/core/src/utils/well-known-keys.ts index fdac53ac..d1bc69d6 100644 --- a/packages/core/src/utils/well-known-keys.ts +++ b/packages/core/src/utils/well-known-keys.ts @@ -1,7 +1,7 @@ -import { Registry } from '@polkadot/types-codec/types' +import type { Registry } from '@polkadot/types-codec/types' import { hexToU8a, stringToHex } from '@polkadot/util' import { blake2AsHex } from '@polkadot/util-crypto' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' const decodeValue = (type: string) => (registry: Registry, value: HexString) => { return registry.createType(type, hexToU8a(value)).toJSON() diff --git a/packages/core/src/wasm-executor/executor.test.ts b/packages/core/src/wasm-executor/executor.test.ts index 33125842..c3409140 100644 --- a/packages/core/src/wasm-executor/executor.test.ts +++ b/packages/core/src/wasm-executor/executor.test.ts @@ -1,7 +1,7 @@ import { readFileSync } from 'node:fs' import path from 'node:path' import { TypeRegistry } from '@polkadot/types' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import * as Comlink from 'comlink' import _ from 'lodash' import { describe, expect, it } from 'vitest' diff --git a/packages/core/src/wasm-executor/index.ts b/packages/core/src/wasm-executor/index.ts index 38652234..895fed4d 100644 --- a/packages/core/src/wasm-executor/index.ts +++ b/packages/core/src/wasm-executor/index.ts @@ -1,15 +1,15 @@ import { hexToString, hexToU8a, u8aToBn } from '@polkadot/util' import { randomAsHex } from '@polkadot/util-crypto' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import * as Comlink from 'comlink' import _ from 'lodash' -import { Block } from '../blockchain/block.js' +import type { Block } from '../blockchain/block.js' import { defaultLogger, truncate } from '../logger.js' import { PREFIX_LENGTH, stripChildPrefix } from '../utils/index.js' import type { JsCallback } from '@acala-network/chopsticks-executor' -export { JsCallback } +export type { JsCallback } export type RuntimeVersion = { specName: string @@ -141,10 +141,8 @@ export const runTask = async (task: TaskCall, callback: JsCallback = emptyTaskHa export const taskHandler = (block: Block): JsCallback => { return { - getStorage: async function (key: HexString) { - return block.get(key) - }, - getNextKey: async function (prefix: HexString, key: HexString) { + getStorage: async (key: HexString) => block.get(key), + getNextKey: async (prefix: HexString, key: HexString) => { const [nextKey] = await block.getKeysPaged({ prefix: prefix.length === 2 /** 0x */ ? key.slice(0, PREFIX_LENGTH) : prefix, pageSize: 1, @@ -152,17 +150,13 @@ export const taskHandler = (block: Block): JsCallback => { }) return nextKey && stripChildPrefix(nextKey as HexString) }, - offchainGetStorage: async function (key: HexString) { + offchainGetStorage: async (key: HexString) => { if (!block.chain.offchainWorker) throw new Error('offchain worker not found') return block.chain.offchainWorker.get(key) as string }, - offchainTimestamp: async function () { - return Date.now() - }, - offchainRandomSeed: async function () { - return randomAsHex(32) - }, - offchainSubmitTransaction: async function (tx: HexString) { + offchainTimestamp: async () => Date.now(), + offchainRandomSeed: async () => randomAsHex(32), + offchainSubmitTransaction: async (tx: HexString) => { if (!block.chain.offchainWorker) throw new Error('offchain worker not found') try { const hash = await block.chain.offchainWorker.pushExtrinsic(block, tx) @@ -177,22 +171,22 @@ export const taskHandler = (block: Block): JsCallback => { } export const emptyTaskHandler = { - getStorage: async function (_key: HexString) { + getStorage: async (_key: HexString) => { throw new Error('Method not implemented') }, - getNextKey: async function (_prefix: HexString, _key: HexString) { + getNextKey: async (_prefix: HexString, _key: HexString) => { throw new Error('Method not implemented') }, - offchainGetStorage: async function (_key: HexString) { + offchainGetStorage: async (_key: HexString) => { throw new Error('Method not implemented') }, - offchainTimestamp: async function () { + offchainTimestamp: async () => { throw new Error('Method not implemented') }, - offchainRandomSeed: async function () { + offchainRandomSeed: async () => { throw new Error('Method not implemented') }, - offchainSubmitTransaction: async function (_tx: HexString) { + offchainSubmitTransaction: async (_tx: HexString) => { throw new Error('Method not implemented') }, } diff --git a/packages/core/src/xcm/downward.ts b/packages/core/src/xcm/downward.ts index 7191a726..8bcb8c6c 100644 --- a/packages/core/src/xcm/downward.ts +++ b/packages/core/src/xcm/downward.ts @@ -1,7 +1,7 @@ import { hexToU8a } from '@polkadot/util' -import { Blockchain } from '../blockchain/index.js' -import { DownwardMessage } from '../blockchain/txpool.js' +import type { Blockchain } from '../blockchain/index.js' +import type { DownwardMessage } from '../blockchain/txpool.js' import { compactHex, getParaId } from '../utils/index.js' import { setStorage } from '../utils/set-storage.js' import { xcmLogger } from './index.js' diff --git a/packages/core/src/xcm/horizontal.ts b/packages/core/src/xcm/horizontal.ts index c5d98334..1fe1ea10 100644 --- a/packages/core/src/xcm/horizontal.ts +++ b/packages/core/src/xcm/horizontal.ts @@ -1,7 +1,7 @@ import { hexToU8a } from '@polkadot/util' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' -import { Blockchain } from '../blockchain/index.js' +import type { Blockchain } from '../blockchain/index.js' import { compactHex } from '../utils/index.js' import { xcmLogger } from './index.js' diff --git a/packages/core/src/xcm/index.ts b/packages/core/src/xcm/index.ts index 60bfbd0d..7cff2790 100644 --- a/packages/core/src/xcm/index.ts +++ b/packages/core/src/xcm/index.ts @@ -1,4 +1,4 @@ -import { Blockchain } from '../blockchain/index.js' +import type { Blockchain } from '../blockchain/index.js' import { defaultLogger } from '../logger.js' import { getParaId } from '../utils/index.js' import { connectDownward } from './downward.js' diff --git a/packages/core/src/xcm/upward.ts b/packages/core/src/xcm/upward.ts index 668496ac..98adb84c 100644 --- a/packages/core/src/xcm/upward.ts +++ b/packages/core/src/xcm/upward.ts @@ -1,6 +1,6 @@ import { hexToU8a } from '@polkadot/util' -import { Blockchain } from '../blockchain/index.js' +import type { Blockchain } from '../blockchain/index.js' import { compactHex, getParaId } from '../utils/index.js' export const connectUpward = async (parachain: Blockchain, relaychain: Blockchain) => { diff --git a/packages/db/src/base-sql.ts b/packages/db/src/base-sql.ts index f70ef381..2b5266db 100644 --- a/packages/db/src/base-sql.ts +++ b/packages/db/src/base-sql.ts @@ -1,6 +1,6 @@ -import { BlockEntry, Database, KeyValueEntry } from '@acala-network/chopsticks-core' -import { HexString } from '@polkadot/util/types' -import { DataSource } from 'typeorm' +import type { BlockEntry, Database, KeyValueEntry } from '@acala-network/chopsticks-core' +import type { HexString } from '@polkadot/util/types' +import type { DataSource } from 'typeorm' import { BlockEntity, KeyValuePair } from './db/entities.js' diff --git a/packages/db/src/browser.ts b/packages/db/src/browser.ts index 9bfdc3de..ec9f9550 100644 --- a/packages/db/src/browser.ts +++ b/packages/db/src/browser.ts @@ -1,5 +1,5 @@ -import { BlockEntry, Database, KeyValueEntry } from '@acala-network/chopsticks-core' -import { DBSchema, IDBPDatabase, openDB } from 'idb' +import type { BlockEntry, Database, KeyValueEntry } from '@acala-network/chopsticks-core' +import { type DBSchema, type IDBPDatabase, openDB } from 'idb' interface Schema extends DBSchema { keyValue: { diff --git a/packages/db/src/db/entities.ts b/packages/db/src/db/entities.ts index dec79762..d9245554 100644 --- a/packages/db/src/db/entities.ts +++ b/packages/db/src/db/entities.ts @@ -1,4 +1,4 @@ -import { BlockEntry, KeyValueEntry } from '@acala-network/chopsticks-core' +import type { BlockEntry, KeyValueEntry } from '@acala-network/chopsticks-core' import { EntitySchema } from 'typeorm' export const KeyValuePair = new EntitySchema({ diff --git a/packages/db/src/index.ts b/packages/db/src/index.ts index 6714c622..14cb008d 100644 --- a/packages/db/src/index.ts +++ b/packages/db/src/index.ts @@ -1,4 +1,4 @@ -import { DataSource } from 'typeorm' +import type { DataSource } from 'typeorm' import { BaseSqlDatabase } from './base-sql.js' import { openDb } from './db/index.js' diff --git a/packages/e2e/src/author.test.ts b/packages/e2e/src/author.test.ts index 9d6f9d92..c4242fb4 100644 --- a/packages/e2e/src/author.test.ts +++ b/packages/e2e/src/author.test.ts @@ -1,4 +1,4 @@ -import { SubmittableResult } from '@polkadot/api' +import type { SubmittableResult } from '@polkadot/api' import { afterAll, describe, expect, it } from 'vitest' import { check, defer, mockCallback, testingPairs } from './helper.js' diff --git a/packages/e2e/src/chainHead_v1.test.ts b/packages/e2e/src/chainHead_v1.test.ts index c05129fe..22fc8015 100644 --- a/packages/e2e/src/chainHead_v1.test.ts +++ b/packages/e2e/src/chainHead_v1.test.ts @@ -1,4 +1,4 @@ -import { RuntimeContext } from '@polkadot-api/observable-client' +import type { RuntimeContext } from '@polkadot-api/observable-client' import { describe, expect, it } from 'vitest' import { getPolkadotSigner } from 'polkadot-api/signer' diff --git a/packages/e2e/src/helper.ts b/packages/e2e/src/helper.ts index 55dae2c5..7692a216 100644 --- a/packages/e2e/src/helper.ts +++ b/packages/e2e/src/helper.ts @@ -1,16 +1,16 @@ import { getObservableClient } from '@polkadot-api/observable-client' -import { SubstrateClient, createClient as createSubstrateClient } from '@polkadot-api/substrate-client' +import { type SubstrateClient, createClient as createSubstrateClient } from '@polkadot-api/substrate-client' import { getWsProvider } from '@polkadot-api/ws-provider/node' import { ApiPromise, HttpProvider, WsProvider } from '@polkadot/api' -import { ProviderInterface } from '@polkadot/rpc-provider/types' -import { RegisteredTypes } from '@polkadot/types/types' -import { HexString } from '@polkadot/util/types' -import { PolkadotClient, createClient } from 'polkadot-api' -import { Observable } from 'rxjs' -import { Mock, beforeAll, beforeEach, expect, vi } from 'vitest' +import type { ProviderInterface } from '@polkadot/rpc-provider/types' +import type { RegisteredTypes } from '@polkadot/types/types' +import type { HexString } from '@polkadot/util/types' +import { type PolkadotClient, createClient } from 'polkadot-api' +import type { Observable } from 'rxjs' +import { type Mock, beforeAll, beforeEach, expect, vi } from 'vitest' import { Api } from '@acala-network/chopsticks' -import { Blockchain, BuildBlockMode, StorageValues } from '@acala-network/chopsticks-core' +import { Blockchain, BuildBlockMode, type StorageValues } from '@acala-network/chopsticks-core' import { inherentProviders } from '@acala-network/chopsticks-core/blockchain/inherent/index.js' import { defer } from '@acala-network/chopsticks-core/utils/index.js' import { SqliteDatabase } from '@acala-network/chopsticks-db' diff --git a/packages/e2e/src/hrmp.test.ts b/packages/e2e/src/hrmp.test.ts index ce6d7755..41e119bb 100644 --- a/packages/e2e/src/hrmp.test.ts +++ b/packages/e2e/src/hrmp.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest' -import { HorizontalMessage } from '@acala-network/chopsticks-core/blockchain/txpool.js' +import type { HorizontalMessage } from '@acala-network/chopsticks-core/blockchain/txpool.js' import { checkSystemEvents, setupContext } from './helper.js' diff --git a/packages/e2e/src/networks.ts b/packages/e2e/src/networks.ts index ad5ed005..ce9d63a6 100644 --- a/packages/e2e/src/networks.ts +++ b/packages/e2e/src/networks.ts @@ -1,6 +1,6 @@ import { config as dotenvConfig } from 'dotenv' -import { SetupOption, setupContext } from '@acala-network/chopsticks-testing' +import { type SetupOption, setupContext } from '@acala-network/chopsticks-testing' dotenvConfig() diff --git a/packages/e2e/src/rpc-spec.test.ts b/packages/e2e/src/rpc-spec.test.ts index 9f8f7680..c8af9cd4 100644 --- a/packages/e2e/src/rpc-spec.test.ts +++ b/packages/e2e/src/rpc-spec.test.ts @@ -1,4 +1,4 @@ -import { RuntimeContext } from '@polkadot-api/observable-client' +import type { RuntimeContext } from '@polkadot-api/observable-client' import { ApiPromise } from '@polkadot/api' import { firstValueFrom } from 'rxjs' import { describe, expect, it } from 'vitest' diff --git a/packages/e2e/src/state.test.ts b/packages/e2e/src/state.test.ts index 1f132333..831350c1 100644 --- a/packages/e2e/src/state.test.ts +++ b/packages/e2e/src/state.test.ts @@ -1,7 +1,7 @@ import { readFileSync } from 'node:fs' import path from 'node:path' import { runTask, taskHandler } from '@acala-network/chopsticks-core' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { describe, expect, it } from 'vitest' import { api, chain, check, checkHex, env, mockCallback, setupApi, testingPairs } from './helper.js' diff --git a/packages/e2e/src/xcm.test.ts b/packages/e2e/src/xcm.test.ts index 29bfe49e..62ed9474 100644 --- a/packages/e2e/src/xcm.test.ts +++ b/packages/e2e/src/xcm.test.ts @@ -1,12 +1,12 @@ import { beforeEach, describe, it } from 'vitest' import { setStorage } from '@acala-network/chopsticks-core' -import { DownwardMessage } from '@acala-network/chopsticks-core/blockchain/txpool.js' +import type { DownwardMessage } from '@acala-network/chopsticks-core/blockchain/txpool.js' import { connectDownward } from '@acala-network/chopsticks-core/xcm/downward.js' import { connectUpward } from '@acala-network/chopsticks-core/xcm/upward.js' import { check, checkSystemEvents, testingPairs } from './helper.js' -import networks, { Network } from './networks.js' +import networks, { type Network } from './networks.js' const downwardMessages: DownwardMessage[] = [ { diff --git a/packages/testing/src/check.ts b/packages/testing/src/check.ts index 577f5406..d000f65e 100644 --- a/packages/testing/src/check.ts +++ b/packages/testing/src/check.ts @@ -1,5 +1,5 @@ -import { ApiPromise } from '@polkadot/api' -import { Codec } from '@polkadot/types/types' +import type { ApiPromise } from '@polkadot/api' +import type { Codec } from '@polkadot/types/types' type CodecOrArray = Codec | Codec[] @@ -169,7 +169,7 @@ export class Checker { const processNumber = (value: number) => { if (precision > 0) { - const rounded = parseFloat(value.toPrecision(precision)) + const rounded = Number.parseFloat(value.toPrecision(precision)) if (rounded === value) { return rounded } @@ -191,7 +191,7 @@ export class Checker { if (typeof obj === 'string') { if (redactNumber && obj.match(/0x000000[0-9a-f]{26}/)) { // this is very likely u128 encoded in hex - const num = parseInt(obj) + const num = Number.parseInt(obj) return processNumber(num) } if (redactHash && obj.match(/0x[0-9a-f]{64}/)) { @@ -204,7 +204,7 @@ export class Checker { return '(address)' } if (redactNumber && obj.match(/^-?[\d,]+$/)) { - const num = parseInt(obj.replace(/,/g, '')) + const num = Number.parseInt(obj.replace(/,/g, '')) return processNumber(num) } return obj diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 58b2cf45..67414104 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -1,6 +1,6 @@ import { BuildBlockMode, - StorageValues, + type StorageValues, connectParachains, connectVertical, defaultLogger, @@ -8,13 +8,13 @@ import { fetchConfig, setupWithServer, } from '@acala-network/chopsticks' -import { NewBlockParams } from '@acala-network/chopsticks-core/rpc/dev/new-block.js' -import { Config } from '@acala-network/chopsticks/schema/index.js' +import type { NewBlockParams } from '@acala-network/chopsticks-core/rpc/dev/new-block.js' +import type { Config } from '@acala-network/chopsticks/schema/index.js' import { ApiPromise, WsProvider } from '@polkadot/api' -import { SubmittableExtrinsic } from '@polkadot/api-base/types' +import type { SubmittableExtrinsic } from '@polkadot/api-base/types' import { Keyring, createTestKeyring } from '@polkadot/keyring' -import { Codec } from '@polkadot/types/types' -import { HexString } from '@polkadot/util/types' +import type { Codec } from '@polkadot/types/types' +import type { HexString } from '@polkadot/util/types' const logger = defaultLogger.child({ name: 'utils' }) diff --git a/packages/utils/src/signFake.ts b/packages/utils/src/signFake.ts index 3c6b5f61..de799998 100644 --- a/packages/utils/src/signFake.ts +++ b/packages/utils/src/signFake.ts @@ -1,6 +1,6 @@ -import { ApiPromise } from '@polkadot/api' -import { GenericExtrinsic } from '@polkadot/types' -import { SignatureOptions } from '@polkadot/types/types' +import type { ApiPromise } from '@polkadot/api' +import type { GenericExtrinsic } from '@polkadot/types' +import type { SignatureOptions } from '@polkadot/types/types' export type SignFakeOptions = Partial diff --git a/packages/web-test/src/App.tsx b/packages/web-test/src/App.tsx index 23e75540..c2542ee2 100644 --- a/packages/web-test/src/App.tsx +++ b/packages/web-test/src/App.tsx @@ -17,7 +17,7 @@ import { import { styled } from '@mui/system' import { ApiPromise } from '@polkadot/api' import { createTestPairs } from '@polkadot/keyring' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' import { useEffect, useState } from 'react' const { alice, bob } = createTestPairs() diff --git a/packages/web-test/src/vite-env.d.ts b/packages/web-test/src/vite-env.d.ts index 0bd28fbf..60a8fae0 100644 --- a/packages/web-test/src/vite-env.d.ts +++ b/packages/web-test/src/vite-env.d.ts @@ -1,7 +1,7 @@ /// -import { Blockchain } from '@acala-network/chopsticks-core' -import { ApiPromise } from '@polkadot/api' +import type { Blockchain } from '@acala-network/chopsticks-core' +import type { ApiPromise } from '@polkadot/api' declare global { // eslint-disable-next-line no-var diff --git a/packages/web-test/tests/index.spec.ts b/packages/web-test/tests/index.spec.ts index 03c48fba..a5a0fde4 100644 --- a/packages/web-test/tests/index.spec.ts +++ b/packages/web-test/tests/index.spec.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test' -import { HexString } from '@polkadot/util/types' +import type { HexString } from '@polkadot/util/types' test.describe('index', () => { test.beforeEach(async ({ page }) => {