Cleanup class variable linebreaks (#5422)

This commit is contained in:
Jaco
2023-01-19 08:52:14 +02:00
committed by GitHub
parent 12bf338e40
commit 2eb453c4ce
13 changed files with 12 additions and 82 deletions
@@ -58,7 +58,6 @@ export class Contract<ApiType extends ApiTypes> extends Base<ApiType> {
public readonly address: AccountId;
readonly #query: MapMessageQuery<ApiType> = {};
readonly #tx: MapMessageTx<ApiType> = {};
constructor (api: ApiBase<ApiType>, abi: string | Record<string, unknown> | Abi, address: string | AccountId, decorateMethod: DecorateMethod<ApiType>) {
+11 -38
View File
@@ -60,65 +60,38 @@ function getAtQueryFn<ApiType extends ApiTypes> (api: ApiDecoration<ApiType>, {
export abstract class Decorate<ApiType extends ApiTypes> extends Events {
readonly #instanceId: string;
#registry: Registry;
readonly #runtimeLog: Record<string, boolean> = {};
#registry: Registry;
#storageGetQ: [Observable<Codec[]>, [StorageEntry, unknown[]][]][] = [];
#storageSubQ: [Observable<Codec[]>, [StorageEntry, unknown[]][]][] = [];
// HACK Use BN import so decorateDerive works... yes, wtf.
protected __phantom = new BN(0);
protected _type: ApiTypes;
protected _call: QueryableCalls<ApiType> = {} as QueryableCalls<ApiType>;
protected _consts: QueryableConsts<ApiType> = {} as QueryableConsts<ApiType>;
protected _derive?: ReturnType<Decorate<ApiType>['_decorateDerive']>;
protected _errors: DecoratedErrors<ApiType> = {} as DecoratedErrors<ApiType>;
protected _events: DecoratedEvents<ApiType> = {} as DecoratedEvents<ApiType>;
protected _extrinsics?: SubmittableExtrinsics<ApiType>;
protected _extrinsicType = GenericExtrinsic.LATEST_EXTRINSIC_VERSION;
protected _genesisHash?: Hash;
protected _isConnected: BehaviorSubject<boolean>;
protected _isReady = false;
protected _query: QueryableStorage<ApiType> = {} as QueryableStorage<ApiType>;
protected _queryMulti?: QueryableStorageMulti<ApiType>;
protected _rpc?: DecoratedRpc<ApiType, RpcInterface>;
protected _rpcCore: RpcCore & RpcInterface;
protected _runtimeMap: Record<HexString, string> = {};
protected _runtimeChain?: Text;
protected _runtimeMetadata?: Metadata;
protected _runtimeVersion?: RuntimeVersion;
protected _rx: ApiInterfaceRx = { call: {} as QueryableCalls<'rxjs'>, consts: {} as QueryableConsts<'rxjs'>, query: {} as QueryableStorage<'rxjs'>, tx: {} as SubmittableExtrinsics<'rxjs'> } as ApiInterfaceRx;
protected readonly _options: ApiOptions;
protected _query: QueryableStorage<ApiType> = {} as QueryableStorage<ApiType>;
protected _queryMulti?: QueryableStorageMulti<ApiType>;
protected _rpc?: DecoratedRpc<ApiType, RpcInterface>;
protected _rpcCore: RpcCore & RpcInterface;
protected _runtimeMap: Record<HexString, string> = {};
protected _runtimeChain?: Text;
protected _runtimeMetadata?: Metadata;
protected _runtimeVersion?: RuntimeVersion;
protected _rx: ApiInterfaceRx = {
call: {} as QueryableCalls<'rxjs'>,
consts: {} as QueryableConsts<'rxjs'>,
query: {} as QueryableStorage<'rxjs'>,
tx: {} as SubmittableExtrinsics<'rxjs'>
} as ApiInterfaceRx;
protected _type: ApiTypes;
/**
* This is the one and only method concrete children classes need to implement.
* It's a higher-order function, which takes one argument
-4
View File
@@ -31,13 +31,9 @@ function textToString (t: Text): string {
export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
#atLast: [string, ApiDecoration<ApiType>] | null = null;
#healthTimer: ReturnType<typeof setInterval> | null = null;
#registries: VersionedRegistry<ApiType>[] = [];
#updateSub?: Subscription | null = null;
#waitingRegistries: Record<HexString, Promise<VersionedRegistry<ApiType>>> = {};
constructor (options: ApiOptions, type: ApiTypes, decorateMethod: DecorateMethod<ApiType>) {
-6
View File
@@ -14,17 +14,11 @@ export interface CombinatorFunction {
export class Combinator<T extends unknown[] = unknown[]> {
#allHasFired = false;
#callback: CombinatorCallback<T>;
#fired: boolean[] = [];
#fns: CombinatorFunction[] = [];
#isActive = true;
#results: unknown[] = [];
#subscriptions: UnsubscribePromise[] = [];
constructor (fns: (CombinatorFunction | [CombinatorFunction, ...unknown[]])[], callback: CombinatorCallback<T>) {
@@ -11,9 +11,7 @@ let id = 0;
export class SingleAccountSigner implements Signer {
readonly #keyringPair: KeyringPair;
readonly #registry: Registry;
readonly #signDelay: number;
constructor (registry: Registry, keyringPair: KeyringPair, signDelay = 0) {
-3
View File
@@ -85,7 +85,6 @@ function isTreatAsHex (key: StorageKey): boolean {
*/
export class RpcCore {
#instanceId: string;
#registryDefault: Registry;
#getBlockRegistry?: (blockHash: Uint8Array) => Promise<{ registry: Registry }>;
@@ -94,9 +93,7 @@ export class RpcCore {
readonly #storageCache = new Map<string, Codec>();
public readonly mapping = new Map<string, DefinitionRpcExt>();
public readonly provider: ProviderInterface;
public readonly sections: string[] = [];
/**
-4
View File
@@ -36,13 +36,9 @@ const l = logger('api-http');
*/
export class HttpProvider implements ProviderInterface {
readonly #callCache = new LRUCache();
readonly #coder: RpcCoder;
readonly #endpoint: string;
readonly #headers: Record<string, string>;
readonly #stats: ProviderStats;
/**
@@ -60,6 +60,7 @@ export class ScProvider implements ProviderInterface {
readonly #requests: Map<number, ResponseCallback> = new Map();
readonly #wellKnownChains: Set<ScType.WellKnownChain>;
readonly #eventemitter: EventEmitter = new EventEmitter();
#chain: Promise<ScType.Chain> | null = null;
#isChainReady = false;
-14
View File
@@ -81,35 +81,21 @@ function eraseRecord<T> (record: Record<string, T>, cb?: (item: T) => void): voi
*/
export class WsProvider implements ProviderInterface {
readonly #callCache = new LRUCache();
readonly #coder: RpcCoder;
readonly #endpoints: string[];
readonly #headers: Record<string, string>;
readonly #eventemitter: EventEmitter;
readonly #handlers: Record<string, WsStateAwaiting> = {};
readonly #isReadyPromise: Promise<WsProvider>;
readonly #stats: ProviderStats;
readonly #waitingForId: Record<string, JsonRpcResponse> = {};
#autoConnectMs: number;
#endpointIndex: number;
#isConnected = false;
#subscriptions: Record<string, WsStateSubscription> = {};
#timeoutId?: ReturnType<typeof setInterval> | null = null;
#websocket: WebSocket | null;
#timeout: number;
/**
-1
View File
@@ -104,7 +104,6 @@ export class CodecSet extends Set<string> implements ISet<string> {
public $isStorageFallback?: boolean;
readonly #allowed: SetValues;
readonly #byteLength: number;
constructor (registry: Registry, setValues: SetValues, value?: string[] | Set<string> | Uint8Array | BN | number | string, bitLength = 8) {
-4
View File
@@ -42,13 +42,9 @@ function decodeEvent (registry: Registry, value?: Uint8Array): Decoded {
*/
export class GenericEventData extends Tuple implements IEventData {
readonly #meta: EventMetadataLatest;
readonly #method: string;
readonly #names: string[] | null = null;
readonly #section: string;
readonly #typeDef: TypeDef[];
constructor (registry: Registry, value: Uint8Array, meta: EventMetadataLatest, section = '<unknown>', method = '<unknown>') {
-1
View File
@@ -69,7 +69,6 @@ function decodeVote (registry: Registry, value?: InputTypes): Uint8Array {
*/
export class GenericVote extends U8aFixed {
#aye: boolean;
#conviction: Conviction;
constructor (registry: Registry, value?: InputTypes) {
@@ -172,13 +172,9 @@ export class StorageKey<A extends AnyTuple = AnyTuple> extends Bytes implements
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore This is assigned via this.decodeArgsFromMeta()
#args: A;
#meta?: StorageEntryMetadataLatest;
#outputType: string;
#method?: string;
#section?: string;
constructor (registry: Registry, value?: string | Uint8Array | StorageKey | StorageEntry | [StorageEntry, unknown[]?], override: Partial<StorageKeyExtra> = {}) {