@acala-network/type-definitions
Version:
Polkadot.js type definations for Acala Network
22 lines (21 loc) • 716 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
function jsonrpcFromDefs(definitions, jsonrpc = {}) {
Object.keys(definitions)
.filter((key) => Object.keys(definitions[key]?.rpc || {}).length !== 0)
.forEach((section) => {
jsonrpc[section] = {};
Object.entries(definitions[section].rpc).forEach(([method, def]) => {
const isSubscription = !!def.pubsub;
jsonrpc[section][method] = {
...def,
isSubscription,
jsonrpc: `${section}_${method}`,
method,
section
};
});
});
return jsonrpc;
}
exports.default = jsonrpcFromDefs;
;