Use type asserts for json imports (#5072)
This commit is contained in:
+2
-2
@@ -37,9 +37,9 @@
|
||||
"@babel/core": "^7.18.6",
|
||||
"@babel/register": "^7.18.6",
|
||||
"@babel/runtime": "^7.18.6",
|
||||
"@polkadot/dev": "^0.67.76",
|
||||
"@polkadot/dev": "^0.67.78",
|
||||
"@polkadot/typegen": "workspace:packages/typegen",
|
||||
"@types/jest": "^28.1.4",
|
||||
"@types/jest": "^28.1.5",
|
||||
"copyfiles": "^2.4.1"
|
||||
},
|
||||
"resolutions": {
|
||||
|
||||
@@ -6,9 +6,9 @@ import path from 'path';
|
||||
|
||||
import { toPromiseMethod } from '@polkadot/api';
|
||||
|
||||
import v0contractFlipper from '../test/contracts/ink/v0/flipper.contract.json';
|
||||
import v0abiFlipper from '../test/contracts/ink/v0/flipper.json';
|
||||
import v1contractFlipper from '../test/contracts/ink/v1/flipper.contract.json';
|
||||
import v0contractFlipper from '../test/contracts/ink/v0/flipper.contract.json' assert { type: 'json' };
|
||||
import v0abiFlipper from '../test/contracts/ink/v0/flipper.json' assert { type: 'json' };
|
||||
import v1contractFlipper from '../test/contracts/ink/v1/flipper.contract.json' assert { type: 'json' };
|
||||
import { Code } from './Code';
|
||||
import { mockApi } from './mock';
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import { ApiPromise } from '@polkadot/api';
|
||||
import { BlueprintPromise, ContractPromise } from '@polkadot/api-contract';
|
||||
import { createTestPairs, TestKeyringMap } from '@polkadot/keyring/testingPairs';
|
||||
|
||||
import abiIncrementer from './test/contracts/ink/v0/incrementer.json';
|
||||
import abiIncrementer from './test/contracts/ink/v0/incrementer.json' assert { type: 'json' };
|
||||
|
||||
async function checkBlueprint (api: ApiPromise, pairs: TestKeyringMap): Promise<void> {
|
||||
const blueprint = new BlueprintPromise(api, abiIncrementer as Record<string, unknown>, '0x1234');
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright 2017-2022 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { default as delegator } from './delegator.json';
|
||||
export { default as dns } from './dns.json';
|
||||
export { default as erc20 } from './erc20.json';
|
||||
export { default as erc721 } from './erc721.json';
|
||||
export { default as flipper } from './flipper.json';
|
||||
export { default as flipperBundle } from './flipper.contract.json';
|
||||
export { default as incrementer } from './incrementer.json';
|
||||
export { default as multisigPlain } from './multisig_plain.json';
|
||||
export { default as delegator } from './delegator.json' assert { type: 'json' };
|
||||
export { default as dns } from './dns.json' assert { type: 'json' };
|
||||
export { default as erc20 } from './erc20.json' assert { type: 'json' };
|
||||
export { default as erc721 } from './erc721.json' assert { type: 'json' };
|
||||
export { default as flipper } from './flipper.json' assert { type: 'json' };
|
||||
export { default as flipperBundle } from './flipper.contract.json' assert { type: 'json' };
|
||||
export { default as incrementer } from './incrementer.json' assert { type: 'json' };
|
||||
export { default as multisigPlain } from './multisig_plain.json' assert { type: 'json' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2017-2022 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { default as flipper } from './flipper.contract.json';
|
||||
export { default as flipper } from './flipper.contract.json' assert { type: 'json' };
|
||||
// A complex contract example with traits.
|
||||
export { default as psp22 } from './psp22_minter_pauser.contract.json';
|
||||
export { default as psp22 } from './psp22_minter_pauser.contract.json' assert { type: 'json' };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright 2017-2022 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { default as erc20 } from './erc20.contract.json';
|
||||
export { default as flipper } from './flipper.contract.json';
|
||||
export { default as erc20 } from './erc20.contract.json' assert { type: 'json' };
|
||||
export { default as flipper } from './flipper.contract.json' assert { type: 'json' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2017-2022 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { default as flipper } from './flipper.contract.json';
|
||||
export { default as flipper } from './flipper.contract.json' assert { type: 'json' };
|
||||
// A complex contract example with traits.
|
||||
export { default as traitErc20 } from './trait_erc20.contract.json';
|
||||
export { default as traitErc20 } from './trait_erc20.contract.json' assert { type: 'json' };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2022 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { default as ints256 } from './ints256.json';
|
||||
export { default as ints256 } from './ints256.json' assert { type: 'json' };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2022 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { default as assetTransfer } from './assetTransfer.json';
|
||||
export { default as enumExample } from './enumExample.json';
|
||||
export { default as recursive } from './recursive.contract.json';
|
||||
export { default as withString } from './withString.json';
|
||||
export { default as assetTransfer } from './assetTransfer.json' assert { type: 'json' };
|
||||
export { default as enumExample } from './enumExample.json' assert { type: 'json' };
|
||||
export { default as recursive } from './recursive.contract.json' assert { type: 'json' };
|
||||
export { default as withString } from './withString.json' assert { type: 'json' };
|
||||
|
||||
@@ -13,8 +13,8 @@ import EventEmitter from 'eventemitter3';
|
||||
import { createTestKeyring } from '@polkadot/keyring/testing';
|
||||
import { decorateStorage, Metadata } from '@polkadot/types';
|
||||
import jsonrpc from '@polkadot/types/interfaces/jsonrpc';
|
||||
import rpcHeader from '@polkadot/types-support/json/Header.004.json';
|
||||
import rpcSignedBlock from '@polkadot/types-support/json/SignedBlock.004.immortal.json';
|
||||
import rpcHeader from '@polkadot/types-support/json/Header.004.json' assert { type: 'json' };
|
||||
import rpcSignedBlock from '@polkadot/types-support/json/SignedBlock.004.immortal.json' assert { type: 'json' };
|
||||
import rpcMetadata from '@polkadot/types-support/metadata/static-substrate';
|
||||
import { BN, bnToU8a, logger, u8aToHex } from '@polkadot/util';
|
||||
import { randomAsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
|
||||
import { Raw } from '@polkadot/types-codec';
|
||||
import jsonVec from '@polkadot/types-support/json/AccountIdVec.001.json';
|
||||
import jsonVec from '@polkadot/types-support/json/AccountIdVec.001.json' assert { type: 'json' };
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { GenericAccountId as AccountId } from '.';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import type { BlockValue } from './Block';
|
||||
|
||||
import block00300 from '@polkadot/types-support/json/SignedBlock.003.00.json';
|
||||
import block00300 from '@polkadot/types-support/json/SignedBlock.003.00.json' assert { type: 'json' };
|
||||
import metadataStatic from '@polkadot/types-support/metadata/static-substrate';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import type { ExtrinsicStatus } from './types';
|
||||
|
||||
import rpc from '@polkadot/types-support/json/ExtrinsicStatus.001.json';
|
||||
import rpc from '@polkadot/types-support/json/ExtrinsicStatus.001.json' assert { type: 'json' };
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
|
||||
import json3 from '@polkadot/types-support/json/GrandpaRoundstate.001.json';
|
||||
import json3 from '@polkadot/types-support/json/GrandpaRoundstate.001.json' assert { type: 'json' };
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
|
||||
import json3 from '@polkadot/types-support/json/Header.003.json';
|
||||
import json3 from '@polkadot/types-support/json/Header.003.json' assert { type: 'json' };
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
|
||||
import json1 from '@polkadot/types-support/json/Header.001.json';
|
||||
import json2 from '@polkadot/types-support/json/Header.002.json';
|
||||
import json3 from '@polkadot/types-support/json/Header.003.json';
|
||||
import block00300 from '@polkadot/types-support/json/SignedBlock.003.00.json';
|
||||
import block00301 from '@polkadot/types-support/json/SignedBlock.003.01.json';
|
||||
import json1 from '@polkadot/types-support/json/Header.001.json' assert { type: 'json' };
|
||||
import json2 from '@polkadot/types-support/json/Header.002.json' assert { type: 'json' };
|
||||
import json3 from '@polkadot/types-support/json/Header.003.json' assert { type: 'json' };
|
||||
import block00300 from '@polkadot/types-support/json/SignedBlock.003.00.json' assert { type: 'json' };
|
||||
import block00301 from '@polkadot/types-support/json/SignedBlock.003.01.json' assert { type: 'json' };
|
||||
import { BN } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import type { RuntimeVersion } from './types';
|
||||
|
||||
import rpc from '@polkadot/types-support/json/RuntimeVersion.002.json';
|
||||
import rpc from '@polkadot/types-support/json/RuntimeVersion.002.json' assert { type: 'json' };
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
import json from '@polkadot/types-support/json/StorageChangeSet.001.json';
|
||||
import json from '@polkadot/types-support/json/StorageChangeSet.001.json' assert { type: 'json' };
|
||||
|
||||
describe('StorageChangeSet', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
|
||||
import json1 from '@polkadot/types-support/json/EventRecord.001.json';
|
||||
import json3 from '@polkadot/types-support/json/EventRecord.003.json';
|
||||
import json1 from '@polkadot/types-support/json/EventRecord.001.json' assert { type: 'json' };
|
||||
import json3 from '@polkadot/types-support/json/EventRecord.003.json' assert { type: 'json' };
|
||||
import rpcMetadata from '@polkadot/types-support/metadata/static-substrate';
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import substrateData from '@polkadot/types-support/metadata/v10/substrate-hex';
|
||||
import substrateJson from '@polkadot/types-support/metadata/v10/substrate-json.json';
|
||||
import substrateJson from '@polkadot/types-support/metadata/v10/substrate-json.json' assert { type: 'json' };
|
||||
|
||||
import { testMeta } from '../util/testUtil';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import substrateData from '@polkadot/types-support/metadata/v11/substrate-hex';
|
||||
import substrateJson from '@polkadot/types-support/metadata/v11/substrate-json.json';
|
||||
import substrateJson from '@polkadot/types-support/metadata/v11/substrate-json.json' assert { type: 'json' };
|
||||
|
||||
import { testMeta } from '../util/testUtil';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import substrateData from '@polkadot/types-support/metadata/v12/substrate-hex';
|
||||
import substrateJson from '@polkadot/types-support/metadata/v12/substrate-json.json';
|
||||
import substrateJson from '@polkadot/types-support/metadata/v12/substrate-json.json' assert { type: 'json' };
|
||||
|
||||
import { testMeta } from '../util/testUtil';
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import kusamaData from '@polkadot/types-support/metadata/v13/kusama-hex';
|
||||
import kusamaJson from '@polkadot/types-support/metadata/v13/kusama-json.json';
|
||||
import kusamaJson from '@polkadot/types-support/metadata/v13/kusama-json.json' assert { type: 'json' };
|
||||
import polkadotData from '@polkadot/types-support/metadata/v13/polkadot-hex';
|
||||
import polkadotJson from '@polkadot/types-support/metadata/v13/polkadot-json.json';
|
||||
import polkadotJson from '@polkadot/types-support/metadata/v13/polkadot-json.json' assert { type: 'json' };
|
||||
import substrateData from '@polkadot/types-support/metadata/v13/substrate-hex';
|
||||
import substrateJson from '@polkadot/types-support/metadata/v13/substrate-json.json';
|
||||
import substrateJson from '@polkadot/types-support/metadata/v13/substrate-json.json' assert { type: 'json' };
|
||||
|
||||
import { testMeta } from '../util/testUtil';
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import kusamaData from '@polkadot/types-support/metadata/v14/kusama-hex';
|
||||
import kusamaJson from '@polkadot/types-support/metadata/v14/kusama-json.json';
|
||||
import kusamaTypes from '@polkadot/types-support/metadata/v14/kusama-types.json';
|
||||
import kusamaJson from '@polkadot/types-support/metadata/v14/kusama-json.json' assert { type: 'json' };
|
||||
import kusamaTypes from '@polkadot/types-support/metadata/v14/kusama-types.json' assert { type: 'json' };
|
||||
import polkadotData from '@polkadot/types-support/metadata/v14/polkadot-hex';
|
||||
import polkadotJson from '@polkadot/types-support/metadata/v14/polkadot-json.json';
|
||||
import polkadotTypes from '@polkadot/types-support/metadata/v14/polkadot-types.json';
|
||||
import polkadotJson from '@polkadot/types-support/metadata/v14/polkadot-json.json' assert { type: 'json' };
|
||||
import polkadotTypes from '@polkadot/types-support/metadata/v14/polkadot-types.json' assert { type: 'json' };
|
||||
import substrateData from '@polkadot/types-support/metadata/v14/substrate-hex';
|
||||
import substrateJson from '@polkadot/types-support/metadata/v14/substrate-json.json';
|
||||
import substrateTypes from '@polkadot/types-support/metadata/v14/substrate-types.json';
|
||||
import substrateJson from '@polkadot/types-support/metadata/v14/substrate-json.json' assert { type: 'json' };
|
||||
import substrateTypes from '@polkadot/types-support/metadata/v14/substrate-types.json' assert { type: 'json' };
|
||||
|
||||
import { testMeta } from '../util/testUtil';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import substrateData from '@polkadot/types-support/metadata/v9/substrate-hex';
|
||||
import substrateJson from '@polkadot/types-support/metadata/v9/substrate-json.json';
|
||||
import substrateJson from '@polkadot/types-support/metadata/v9/substrate-json.json' assert { type: 'json' };
|
||||
|
||||
import { testMeta } from '../util/testUtil';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user