Move test files to correct packages (#4345)
* Move test files to correct packages * Adjust
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ const config = require('@polkadot/dev/config/jest.cjs');
|
||||
module.exports = {
|
||||
...config,
|
||||
moduleNameMapper: {
|
||||
'@polkadot/api-(contract-support|contract|derive)(.*)$': '<rootDir>/packages/api-$1/src/$2',
|
||||
'@polkadot/api-(contract|derive)(.*)$': '<rootDir>/packages/api-$1/src/$2',
|
||||
// eslint-disable-next-line sort-keys
|
||||
'@polkadot/api(.*)$': '<rootDir>/packages/api/src/$1',
|
||||
'@polkadot/rpc-(core|provider)(.*)$': '<rootDir>/packages/rpc-$1/src/$2',
|
||||
|
||||
@@ -1,201 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -1,3 +0,0 @@
|
||||
# @polkadot/api-contract-support
|
||||
|
||||
Test contracts
|
||||
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"contributors": [],
|
||||
"description": "Sample contracts as development support",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract-support#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/api-contract-support",
|
||||
"repository": {
|
||||
"directory": "packages/api-contract-support",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/api.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "6.12.2-10",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.5"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
// Copyright 2017-2021 @polkadot/types-support authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { detectPackage } from '@polkadot/util';
|
||||
|
||||
import { packageInfo } from './packageInfo';
|
||||
|
||||
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname, []);
|
||||
@@ -1,6 +0,0 @@
|
||||
// Copyright 2017-2021 @polkadot/types-support authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import './detectPackage';
|
||||
|
||||
export { packageInfo } from './packageInfo';
|
||||
@@ -1,6 +0,0 @@
|
||||
// Copyright 2017-2021 @polkadot/api-contract-support authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-contract-support', version: '6.12.2-10' };
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src",
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["src/**/*.json", "src/**/*.ts"],
|
||||
"references": []
|
||||
}
|
||||
@@ -28,8 +28,5 @@
|
||||
"@polkadot/types": "6.12.2-10",
|
||||
"@polkadot/util": "^8.1.2",
|
||||
"rxjs": "^7.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/api-contract-support": "6.12.2-10"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ import type { Registry } from '@polkadot/types/types';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
import abis from '@polkadot/api-contract-support/contracts';
|
||||
import { TypeDefInfo } from '@polkadot/types/types';
|
||||
import { blake2AsHex } from '@polkadot/util-crypto';
|
||||
|
||||
import abis from '../test/contracts';
|
||||
import { Abi } from '.';
|
||||
|
||||
interface SpecDef {
|
||||
@@ -80,7 +80,7 @@ describe('Abi', (): void => {
|
||||
it(`initializes from a contract ABI (${abiName})`, (): void => {
|
||||
const abi = new Abi(abis[abiName]);
|
||||
const json = stringifyJson(abi.registry);
|
||||
const cmpPath = path.join(__dirname, `../../../api-contract-support/src/compare/${abiName}.test.json`);
|
||||
const cmpPath = path.join(__dirname, `../test/compare/${abiName}.test.json`);
|
||||
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import abis from '@polkadot/api-contract-support/contracts';
|
||||
import { v0ToLatest, v1ToLatest } from '@polkadot/api-contract/Abi/toLatest';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
|
||||
import { v0ToLatest, v1ToLatest } from './toLatest';
|
||||
import abis from '../test/contracts';
|
||||
|
||||
describe('v0ToLatest', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -5,14 +5,14 @@ import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
import { toPromiseMethod } from '@polkadot/api';
|
||||
import v0contractFlipper from '@polkadot/api-contract-support/contracts/ink/v0/flipper.contract.json';
|
||||
import v0abiFlipper from '@polkadot/api-contract-support/contracts/ink/v0/flipper.json';
|
||||
import v1contractFlipper from '@polkadot/api-contract-support/contracts/ink/v1/flipper.contract.json';
|
||||
|
||||
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 { Code } from './Code';
|
||||
import { mockApi } from './mock';
|
||||
|
||||
const v0wasmFlipper = fs.readFileSync(path.join(__dirname, '../../../api-contract-support/src/contracts/ink/v0/flipper.wasm'));
|
||||
const v0wasmFlipper = fs.readFileSync(path.join(__dirname, '../test/contracts/ink/v0/flipper.wasm'));
|
||||
|
||||
describe('Code', (): void => {
|
||||
it('can construct with an individual ABI/WASM combo', (): void => {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
// Simple non-runnable checks to test type definitions in the editor itself
|
||||
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import abiIncrementer from '@polkadot/api-contract-support/contracts/ink/v0/incrementer.json';
|
||||
import { BlueprintPromise, ContractPromise } from '@polkadot/api-contract';
|
||||
import { createTestPairs, TestKeyringMap } from '@polkadot/keyring/testingPairs';
|
||||
|
||||
import { BlueprintPromise, ContractPromise } from '.';
|
||||
import abiIncrementer from './test/contracts/ink/v0/incrementer.json';
|
||||
|
||||
async function checkBlueprint (api: ApiPromise, pairs: TestKeyringMap): Promise<void> {
|
||||
const blueprint = new BlueprintPromise(api, abiIncrementer as Record<string, unknown>, '0x1234');
|
||||
|
||||
@@ -3,12 +3,18 @@
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src",
|
||||
"resolveJsonModule": true
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"exclude": [
|
||||
"**/test/**/*.json",
|
||||
"**/test/**/*.ts",
|
||||
"**/test/**/*.wasm",
|
||||
"**/*.manual.ts",
|
||||
"**/*.spec.ts",
|
||||
"mock.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../api" },
|
||||
{ "path": "../api-contract-support" },
|
||||
{ "path": "../types" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src",
|
||||
"emitDeclarationOnly": false,
|
||||
"resolveJsonModule": true,
|
||||
"noEmit": true
|
||||
},
|
||||
"include": [
|
||||
"**/test/**/*.json",
|
||||
"**/test/**/*.ts",
|
||||
"**/test/**/*.wasm",
|
||||
"**/*.manual.ts",
|
||||
"**/*.spec.ts",
|
||||
"mock.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../api" },
|
||||
{ "path": "../api-contract" },
|
||||
{ "path": "../types" }
|
||||
]
|
||||
}
|
||||
@@ -25,5 +25,8 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.5",
|
||||
"@polkadot/util": "^8.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/types": "^6.12.2-9"
|
||||
}
|
||||
}
|
||||
|
||||
+2
-5
@@ -1,13 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { CodecDate } from '@polkadot/types-codec';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { CodecDate, Compact, U32 } from '@polkadot/types-codec';
|
||||
import { BN } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { U32 } from '../primitive';
|
||||
import { Compact } from '.';
|
||||
|
||||
describe('Compact', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { DoNotConstruct } from '.';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { DoNotConstruct } from '@polkadot/types-codec';
|
||||
|
||||
describe('DoNotConstruct', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
@@ -3,12 +3,10 @@
|
||||
|
||||
import type { CodecRegistry } from '@polkadot/types-codec/types';
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { Enum, Null, Text, U32 } from '@polkadot/types-codec';
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Null, Text, U32 } from '../primitive';
|
||||
import { Enum } from '.';
|
||||
|
||||
describe('Enum', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Int } from '.';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { Int } from '@polkadot/types-codec';
|
||||
|
||||
describe('Int', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Null } from '.';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { Null } from '@polkadot/types-codec';
|
||||
|
||||
describe('Null', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
+2
-3
@@ -1,9 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Bytes, Text, U32 } from '../primitive';
|
||||
import { Option } from '.';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { Bytes, Option, Text, U32 } from '@polkadot/types-codec';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
+2
-4
@@ -1,12 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { Result, Text, u32 } from '@polkadot/types-codec';
|
||||
import { hexToString } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Text, u32 } from '../primitive';
|
||||
import { Result } from '.';
|
||||
|
||||
describe('Result', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
const Type = Result.with({ Err: Text, Ok: u32 });
|
||||
+3
-7
@@ -1,17 +1,13 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { BlockNumber, VoteThreshold } from '@polkadot/types/interfaces';
|
||||
import type { AnyTupleValue, CodecTo } from '@polkadot/types-codec/types';
|
||||
import type { VoteThreshold } from '../interfaces/elections';
|
||||
import type { BlockNumber } from '../interfaces/runtime';
|
||||
|
||||
import { Metadata, TypeRegistry } from '@polkadot/types';
|
||||
import { Text, Tuple, U32, U128 } from '@polkadot/types-codec';
|
||||
import rpcMetadata from '@polkadot/types-support/metadata/static-substrate';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Metadata } from '../metadata';
|
||||
import { Text, U32, U128 } from '../primitive';
|
||||
import { Tuple } from '.';
|
||||
|
||||
describe('Tuple', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
let tuple: Tuple;
|
||||
@@ -1,11 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { UInt } from '@polkadot/types-codec';
|
||||
import { BN, BN_TWO, isBn } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { UInt } from '.';
|
||||
|
||||
describe('UInt', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { PropIndex } from '../interfaces/democracy';
|
||||
import type { Codec, CodecTo, ITuple } from '../types';
|
||||
import type { PropIndex } from '@polkadot/types/interfaces/democracy';
|
||||
import type { Codec, CodecTo, ITuple } from '@polkadot/types-codec/types';
|
||||
|
||||
import { createTypeUnsafe, GenericAccountId as AccountId, Metadata, TypeRegistry } from '@polkadot/types';
|
||||
import { Text, Vec } from '@polkadot/types-codec';
|
||||
import rpcMetadata from '@polkadot/types-support/metadata/static-substrate';
|
||||
import { randomAsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import { createTypeUnsafe, TypeRegistry } from '../create';
|
||||
import { GenericAccountId as AccountId } from '../generic';
|
||||
import { Metadata } from '../metadata';
|
||||
import { Text } from '../primitive';
|
||||
import { Vec } from '.';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
const metadata = new Metadata(registry, rpcMetadata);
|
||||
|
||||
+2
-3
@@ -1,9 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Text, u16 } from '../primitive';
|
||||
import { VecFixed } from '.';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { Text, u16, VecFixed } from '@polkadot/types-codec';
|
||||
|
||||
describe('VecFixed', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
+5
-6
@@ -1,15 +1,14 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { I32, Text, U32 } from '../primitive';
|
||||
import { Constructor } from '../types';
|
||||
import { ITuple } from '../types/interfaces';
|
||||
import { BTreeMap, Enum, Struct, Tuple } from '.';
|
||||
import type { CodecClass, ITuple } from '@polkadot/types-codec/types';
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { BTreeMap, Enum, I32, Struct, Text, Tuple, U32 } from '@polkadot/types-codec';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
class U32TextTuple extends (Tuple.with([U32, Text]) as unknown as Constructor<ITuple<[U32, Text]>>) {}
|
||||
class U32TextTuple extends (Tuple.with([U32, Text]) as unknown as CodecClass<ITuple<[U32, Text]>>) {}
|
||||
// Reason: We purposefully want `text` to be the first key of the struct and take priority during sorting
|
||||
// eslint-disable-next-line sort-keys
|
||||
class MockStruct extends Struct.with({ text: Text, int: I32 }) {}
|
||||
+5
-6
@@ -1,17 +1,16 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { CodecTo } from '@polkadot/types-codec/types';
|
||||
import type { CodecClass, CodecTo } from '@polkadot/types-codec/types';
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { BTreeSet, Enum, I32, Struct, Text, Tuple, U32 } from '@polkadot/types-codec';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { I32, Text, U32 } from '../primitive';
|
||||
import { Constructor } from '../types';
|
||||
import { ITuple } from '../types/interfaces';
|
||||
import { BTreeSet, Enum, Struct, Tuple } from '.';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
class U32TextTuple extends (Tuple.with([U32, Text]) as unknown as Constructor<ITuple<[U32, Text]>>) {}
|
||||
class U32TextTuple extends (Tuple.with([U32, Text]) as unknown as CodecClass<ITuple<[U32, Text]>>) {}
|
||||
// Reason: We purposefully want `text` to be the first key of the struct and take priority during sorting
|
||||
// eslint-disable-next-line sort-keys
|
||||
class MockStruct extends Struct.with({ text: Text, int: I32 }) {}
|
||||
+1
-1
@@ -1,9 +1,9 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { hexToU8a } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { BitVec } from './';
|
||||
|
||||
// form Inclusion BitVec<lsb0, u8>
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Bytes } from '.';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { Bytes } from '@polkadot/types-codec';
|
||||
|
||||
describe('Bytes', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
+2
-3
@@ -1,9 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Text, U32 } from '../primitive';
|
||||
import { HashMap, Struct } from '.';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { HashMap, Struct, Text, U32 } from '@polkadot/types-codec';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create/registry';
|
||||
import { Linkage } from '.';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { Linkage } from '@polkadot/types-codec';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
+2
-3
@@ -3,9 +3,8 @@
|
||||
|
||||
import type { CodecTo } from '@polkadot/types-codec/types';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Text, U32 } from '../primitive';
|
||||
import { CodecMap } from '.';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { CodecMap, Text, U32 } from '@polkadot/types-codec';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
const mockU32TextMap = new Map<Text, U32>();
|
||||
+2
-3
@@ -1,9 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { U32 } from '../primitive';
|
||||
import { Range } from '.';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { Range, U32 } from '@polkadot/types-codec';
|
||||
|
||||
describe('Range', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
+2
-3
@@ -1,11 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { Text, Type } from '@polkadot/types-codec';
|
||||
import { stringToU8a, u8aConcat } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Text, Type } from '.';
|
||||
|
||||
describe('Type', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { U8aFixed } from '.';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { U8aFixed } from '@polkadot/types-codec';
|
||||
|
||||
describe('U8aFixed', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { WrapperOpaque } from '.';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { WrapperOpaque } from '@polkadot/types-codec';
|
||||
|
||||
describe('WrapperOpaque', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
|
||||
import type { CodecTo } from '@polkadot/types-codec/types';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Bool } from '.';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { Bool } from '@polkadot/types-codec';
|
||||
|
||||
describe('Bool', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
+2
-4
@@ -3,12 +3,10 @@
|
||||
|
||||
import type { CodecTo } from '@polkadot/types-codec/types';
|
||||
|
||||
import { CodecDate } from '@polkadot/types-codec';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { CodecDate, U64 } from '@polkadot/types-codec';
|
||||
import { BN } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { U64 } from '../primitive';
|
||||
|
||||
describe('Date', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
import type { AnyU8a, CodecTo } from '@polkadot/types-codec/types';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Raw } from '.';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { Raw } from '@polkadot/types-codec';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { CodecSet } from '.';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { CodecSet } from '@polkadot/types-codec';
|
||||
|
||||
// TODO actually import these from definitions, don't re-define here
|
||||
const SET_FIELDS = {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user