Cleanup exports (less indirection) (#3226)

* Cleanup exports (less indirection)

* packageInfo import
This commit is contained in:
Jaco Greeff
2021-02-27 13:17:07 +01:00
committed by GitHub
parent 47afe2cfc6
commit a0d6384b01
13 changed files with 16 additions and 42 deletions
-1
View File
@@ -2,6 +2,5 @@
// SPDX-License-Identifier: Apache-2.0
export { Abi } from './Abi';
export { Blueprint as BlueprintRx, Code as CodeRx, Contract as ContractRx } from './rx';
export { Blueprint as BlueprintPromise, Code as CodePromise, Contract as ContractPromise } from './promise';
+2 -4
View File
@@ -5,7 +5,7 @@ import type { DeriveCache } from './types';
const mapCache = new Map<string, any>();
const deriveMapCache: DeriveCache = {
export const deriveMapCache: DeriveCache = {
del: (key: string): void => {
mapCache.delete(key);
},
@@ -24,11 +24,9 @@ const deriveMapCache: DeriveCache = {
}
};
const deriveNoopCache: DeriveCache = {
export const deriveNoopCache: DeriveCache = {
del: (): void => undefined,
forEach: () => undefined,
get: (): undefined => undefined,
set: (_: string, value: unknown): unknown => value
};
export { deriveMapCache, deriveNoopCache };
+1 -1
View File
@@ -9,7 +9,7 @@ import type { ApiInterfaceRx, ApiTypes, DecoratedErrors, DecoratedEvents, Decora
import { assertReturn } from '@polkadot/util';
import { packageInfo } from '../detectPackage';
import { packageInfo } from '../packageInfo';
import { Init } from './Init';
interface PkgJson {
-2
View File
@@ -21,5 +21,3 @@ import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname);
export { packageInfo };
+1 -2
View File
@@ -7,6 +7,5 @@ export { Keyring } from '@polkadot/keyring';
export { WsProvider } from '@polkadot/rpc-provider/ws';
export { ApiPromise } from './promise';
export { ApiRx } from './rx';
export { SubmittableResult } from './submittable';
export { ApiRx } from './rx';
+1 -1
View File
@@ -30,4 +30,4 @@ export function expandMetadata (registry: Registry, metadata: Metadata): Decorat
};
}
export { decorateConstants, decorateExtrinsics, decorateStorage };
export { decorateConstants, decorateErrors, decorateEvents, decorateExtrinsics, decorateStorage };
-2
View File
@@ -21,5 +21,3 @@ import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname);
export { packageInfo };
+2 -7
View File
@@ -5,9 +5,9 @@
import nock from 'nock';
const TEST_HTTP_URL = 'http://localhost:9944';
export const TEST_HTTP_URL = 'http://localhost:9944';
function mockHttp (requests: any[]): any {
export function mockHttp (requests: any[]): any {
nock.cleanAll();
return requests.reduce((scope, request: any): nock.Scope => {
@@ -21,8 +21,3 @@ function mockHttp (requests: any[]): any {
});
}, nock(TEST_HTTP_URL));
}
export {
TEST_HTTP_URL,
mockHttp
};
+3 -8
View File
@@ -3,8 +3,6 @@
import { Server, WebSocket } from 'mock-socket';
const TEST_WS_URL = 'ws://localhost:9955';
interface Scope {
body: { [index: string]: Record<string, any> };
requests: number;
@@ -29,6 +27,8 @@ interface ReplyDef {
global.WebSocket = WebSocket;
export const TEST_WS_URL = 'ws://localhost:9955';
// should be JSONRPC def return
function createError ({ error: { code, message }, id }: ErrorDef): any {
return {
@@ -51,7 +51,7 @@ function createReply ({ id, reply: { result } }: ReplyDef): any {
}
// scope definition returned
function mockWs (requests: ({ method: string } & ErrorDef)[], wsUrl: string = TEST_WS_URL): Scope {
export function mockWs (requests: ({ method: string } & ErrorDef)[], wsUrl: string = TEST_WS_URL): Scope {
const server = new Server(wsUrl);
let requestCount = 0;
@@ -85,8 +85,3 @@ function mockWs (requests: ({ method: string } & ErrorDef)[], wsUrl: string = TE
return scope;
}
export {
TEST_WS_URL,
mockWs
};
-2
View File
@@ -21,5 +21,3 @@ import { detectPackage } from '@polkadot/util';
import { packageInfo } from './packageInfo';
detectPackage(packageInfo, typeof __dirname !== 'undefined' && __dirname);
export { packageInfo };
@@ -12,12 +12,10 @@ import { u32 } from '../primitive/U32';
// there are all reversed since it is actually encoded as u32, LE,
// this means that FRNK has the bytes as KNRF
const CID_AURA = 0x61727561; // 'aura'
const CID_BABE = 0x45424142; // 'BABE'
const CID_GRPA = 0x4b4e5246; // 'FRNK' (don't ask, used to be afg1)
const CID_POW = 0x5f776f70; // 'pow_'
export { CID_AURA, CID_BABE, CID_GRPA, CID_POW };
export const CID_AURA = 0x61727561; // 'aura'
export const CID_BABE = 0x45424142; // 'BABE'
export const CID_GRPA = 0x4b4e5246; // 'FRNK' (don't ask, used to be afg1)
export const CID_POW = 0x5f776f70; // 'pow_'
/**
* @name GenericConsensusEngineId
@@ -6,7 +6,7 @@
import type { Definitions } from '../../types';
const AllConvictions = [
export const AllConvictions = [
// 0.1x votes, unlocked.
'None',
// 1x votes, locked for an enactment period following a successful vote.
@@ -23,8 +23,6 @@ const AllConvictions = [
'Locked6x'
];
export { AllConvictions };
export default {
rpc: {},
types: {
@@ -6,7 +6,7 @@
import type { Definitions } from '../../types';
const AllHashers = {
export const AllHashers = {
Blake2_128: null, // eslint-disable-line camelcase
Blake2_256: null, // eslint-disable-line camelcase
Blake2_128Concat: null, // eslint-disable-line camelcase
@@ -17,8 +17,6 @@ const AllHashers = {
Identity: null
};
export { AllHashers };
export default {
rpc: {},
types: {