UNPKG

508 BJavaScriptView Raw
1import { lazyDeriveSection } from '@polkadot/api-derive';
2/**
3 * This is a section decorator which keeps all type information.
4 */
5export 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; i < names.length; i++) {
11 lazyDeriveSection(result, names[i], getKeys, creator);
12 }
13 return result;
14}