Remove injectDefinitions import, prefer injector (#1195)
* Convert RPC classes to primitive classes or /srml types * Lint passes... lokking at tests next. * Tests pass. * Types with basic docs (lots of work here) * Update StorageKey.spec.ts * Add injector to metadata doc generation * Fix import * Remove injectDefinitions import, prefer injector
This commit is contained in:
@@ -2,14 +2,13 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import '@polkadot/types/injector';
|
||||
|
||||
import { ClassOf, Metadata } from '@polkadot/types';
|
||||
import json from '@polkadot/types/Metadata/static';
|
||||
import { injectDefinitions } from '@polkadot/types/srml';
|
||||
|
||||
import fromMetadata from '../fromMetadata';
|
||||
|
||||
injectDefinitions();
|
||||
|
||||
// Use the pre-generated metadata
|
||||
const metadata = new Metadata(json);
|
||||
const consts = fromMetadata(metadata);
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import '@polkadot/types/injector';
|
||||
|
||||
import { Extrinsic, Metadata } from '@polkadot/types';
|
||||
import { injectDefinitions } from '@polkadot/types/srml';
|
||||
import json from '@polkadot/types/Metadata/v7/static';
|
||||
|
||||
import fromMetadata from '.';
|
||||
|
||||
injectDefinitions();
|
||||
|
||||
// Use the pre-generated metadata
|
||||
const metadata = new Metadata(json);
|
||||
const newExtrinsics = fromMetadata(metadata);
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import '@polkadot/types/injector';
|
||||
|
||||
import testingPairs from '@polkadot/keyring/testingPairs';
|
||||
import { injectDefinitions } from '@polkadot/types/srml';
|
||||
import { Extrinsic } from '@polkadot/types';
|
||||
|
||||
import extrinsics from './static';
|
||||
@@ -11,10 +12,6 @@ import extrinsics from './static';
|
||||
const keyring = testingPairs({ type: 'ed25519' }, false);
|
||||
|
||||
describe('extrinsics', (): void => {
|
||||
beforeEach((): void => {
|
||||
injectDefinitions();
|
||||
});
|
||||
|
||||
it('encodes an actual transfer (actual data)', (): void => {
|
||||
expect(
|
||||
new Extrinsic(
|
||||
|
||||
@@ -2,16 +2,15 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import '@polkadot/types/injector';
|
||||
|
||||
import testingPairs from '@polkadot/keyring/testingPairs';
|
||||
import { Metadata } from '@polkadot/types';
|
||||
import json from '@polkadot/types/Metadata/static';
|
||||
import { injectDefinitions } from '@polkadot/types/srml';
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
|
||||
import fromMetadata from '../fromMetadata';
|
||||
|
||||
injectDefinitions();
|
||||
|
||||
const keyring = testingPairs({ type: 'ed25519' });
|
||||
|
||||
// Use the pre-generated metadata
|
||||
|
||||
@@ -2,15 +2,11 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { injectDefinitions } from '@polkadot/types/srml';
|
||||
import '@polkadot/types/injector';
|
||||
|
||||
import { storage } from './storage';
|
||||
|
||||
describe('storage', (): void => {
|
||||
beforeEach((): void => {
|
||||
injectDefinitions();
|
||||
});
|
||||
|
||||
it('should return well known keys', (): void => {
|
||||
expect(typeof storage.substrate).toBe('object');
|
||||
|
||||
|
||||
@@ -2,15 +2,11 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { injectDefinitions } from '@polkadot/types/srml';
|
||||
import '@polkadot/types/injector';
|
||||
|
||||
import { authorityCount, authorityPrefix, changesTrieConfig, childStorageKeyPrefix, code, extrinsicIndex, heapPages } from './substrate';
|
||||
|
||||
describe('substrate', (): void => {
|
||||
beforeEach((): void => {
|
||||
injectDefinitions();
|
||||
});
|
||||
|
||||
// @deprecated: The ':auth:' (authorityPrefix) and ':auth:len' (authorityCount) storage keys
|
||||
// have been removed in https://github.com/paritytech/substrate/pull/2802
|
||||
it('authorityCount should return the correct storage key', (): void => {
|
||||
|
||||
Reference in New Issue
Block a user