1 | // Copyright 2017-2022 @polkadot/api authors & contributors
|
2 | // SPDX-License-Identifier: Apache-2.0
|
3 |
|
4 | import { lazyDeriveSection } from '@polkadot/api-derive';
|
5 | /**
|
6 | * This is a section decorator which keeps all type information.
|
7 | */
|
8 | export function decorateDeriveSections(decorateMethod, derives) {
|
9 | const getKeys = s => Object.keys(derives[s]);
|
10 | const creator = (s, m) => decorateMethod(derives[s][m]);
|
11 | const result = {};
|
12 | const names = Object.keys(derives);
|
13 | for (let i = 0; i < names.length; i++) {
|
14 | lazyDeriveSection(result, names[i], getKeys, creator);
|
15 | }
|
16 | return result;
|
17 | } |
\ | No newline at end of file |