Filter modules (query & storage) without methods (#1311)

This commit is contained in:
Jaco Greeff 2019-06-19 08:25:50 +02:00 committed by GitHub
parent 2ad6ea4a67
commit 51e188d4f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 2 deletions

View File

@ -10,7 +10,7 @@ import ApiPromise from '@polkadot/api/promise';
export default function createOptions (api: ApiPromise, sectionName: string): DropdownOptions {
const section = api.tx[sectionName];
if (!section) {
if (!section || Object.keys(section).length === 0) {
return [];
}

View File

@ -10,6 +10,7 @@ export default function createOptions (api: ApiPromise): DropdownOptions {
return Object
.keys(api.tx)
.sort()
.filter((name) => Object.keys(api.tx[name]).length)
.map((name) => ({
text: name,
value: name

View File

@ -11,7 +11,7 @@ import ApiPromise from '@polkadot/api/promise';
export default function createOptions (api: ApiPromise, sectionName: string): DropdownOptions {
const section = api.query[sectionName];
if (!section) {
if (!section || Object.keys(section).length === 0) {
return [];
}

View File

@ -10,6 +10,7 @@ export default function createOptions (api: ApiPromise): DropdownOptions {
return Object
.keys(api.query)
.sort()
.filter((name) => Object.keys(api.query[name]).length)
.map((name) => ({
text: name,
value: name