1 | import { lazyDeriveSection } from '@polkadot/api-derive';
|
2 | /**
|
3 | * This is a section decorator which keeps all type information.
|
4 | */
|
5 | export function decorateDeriveSections(decorateMethod, derives) {
|
6 | const getKeys = (s) => Object.keys(derives[s]);
|
7 | const creator = (s, m) => decorateMethod(derives[s][m]);
|
8 | const result = {};
|
9 | const names = Object.keys(derives);
|
10 | for (let i = 0, count = names.length; i < count; i++) {
|
11 | lazyDeriveSection(result, names[i], getKeys, creator);
|
12 | }
|
13 | return result;
|
14 | }
|