console warnings on the use of node-template (#2191)

* console warnings on the use of node-template

* Message formatting
This commit is contained in:
Jaco Greeff
2020-04-17 12:23:44 +02:00
committed by GitHub
parent 379e841808
commit 9eb44d6e89
11 changed files with 31 additions and 10 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+4 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -12,6 +12,7 @@ import typesChain from './chain';
import typesMeta from './metadata';
import typesModules from './modules';
import typesSpec from './spec';
import warnings from './warnings';
// flatten a VersionedType[] into a Record<string, string>
/** @internal */
@@ -52,6 +53,8 @@ export function getSpecTypes ({ knownTypes }: Registry, chainName: Text | string
const _specName = specName.toString();
const _specVersion = bnToBn(specVersion).toNumber();
(warnings[_specName] || []).forEach((warning) => console.warn(`*** ${warning}`));
return {
...filterVersions(typesSpec[_specName], _specVersion),
...filterVersions(typesChain[_chainName], _specVersion),
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/types authors & contributors
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
+18
View File
@@ -0,0 +1,18 @@
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Type overrides for specific spec types & versions as given in runtimeVersion
const warnings: Record<string, string[]> = {
'node-template': [
'',
'You are using the node-template, depending on your config and age of the template, you may',
'have some unexpected results without applying the correct config for your node type:',
'',
'- If you have trouble sending txs, apply https://polkadot.js.org/api/start/FAQ.html#i-cannot-send-transactions-from-my-node-template-based-chain',
'- If you have trouble parsing events, apply https://polkadot.js.org/api/start/FAQ.html#using-a-non-current-master-node-i-have-issues-parsing-events',
''
]
};
export default warnings;