Split rpc augmentation (#4349)

* Split rpc augmentation

* CC

* Split augmentation trigger

* Exports
This commit is contained in:
Jaco
2021-12-18 13:15:15 +02:00
committed by GitHub
parent 6518166252
commit 6d1b9cbfb2
36 changed files with 365 additions and 49 deletions
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2017-2021 @polkadot/rpc-core authors & contributors
// SPDX-License-Identifier: Apache-2.0
import '@polkadot/rpc-augment/augment';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2021 @polkadot/rpc-core authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { RpcInterface } from '@polkadot/rpc-core/types.jsonrpc';
import type { RpcInterface } from './types';
import { createTestPairs } from '@polkadot/keyring/testingPairs';
import { MockProvider } from '@polkadot/rpc-provider/mock';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2021 @polkadot/rpc-core authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { RpcInterface } from '@polkadot/rpc-core/types.jsonrpc';
import type { RpcInterface } from './types';
import { MockProvider } from '@polkadot/rpc-provider/mock';
import { TypeRegistry } from '@polkadot/types/create';
-12
View File
@@ -1,12 +0,0 @@
// Copyright 2017-2021 @polkadot/rpc-core authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AugmentedRpc } from './types';
export interface RpcInterface {
[section: string]: {
[method: string]: AugmentedRpc<(...params: any[]) => any>;
}
}
export const __PHANTOM_RPC = 'phantom-rpc';
+3 -14
View File
@@ -1,18 +1,7 @@
// Copyright 2017-2021 @polkadot/rpc-core authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { AnyFunction, Codec, DefinitionRpc } from '@polkadot/types/types';
import './augment';
export * from '@polkadot/rpc-core/types.jsonrpc';
export interface RpcInterfaceMethod {
<T extends Codec> (...params: unknown[]): Observable<T>;
raw (...params: unknown[]): Observable<unknown>;
meta: DefinitionRpc;
}
export type AugmentedRpc<F extends AnyFunction> = F & {
raw: <T> (...params: Parameters<F>) => Observable<T>;
meta: DefinitionRpc;
};
export type { RpcInterface } from '@polkadot/rpc-augment/rpc';
export type { AugmentedRpc, RpcInterfaceMethod } from '@polkadot/rpc-augment/types';