Filter section/method options (#7881)
This commit is contained in:
parent
3ffe266e72
commit
22df6366ae
@ -19,6 +19,7 @@ export default function createOptions (runtime: Record<string, Record<string, De
|
||||
|
||||
return Object
|
||||
.keys(runtime[sectionName])
|
||||
.filter((s) => !s.startsWith('$'))
|
||||
.sort()
|
||||
.map((m) => section[m])
|
||||
.map(({ description, method, params }): DropdownOption => {
|
||||
|
||||
@ -7,6 +7,7 @@ import type { DropdownOptions } from '../../util/types';
|
||||
export default function createOptions (runtime: Record<string, Record<string, DefinitionCallNamed>>): DropdownOptions {
|
||||
return Object
|
||||
.keys(runtime)
|
||||
.filter((s) => !s.startsWith('$'))
|
||||
.sort()
|
||||
.filter((s) => Object.keys(runtime[s]).length !== 0)
|
||||
.map((value): { text: string; value: string } => ({
|
||||
|
||||
@ -18,6 +18,7 @@ export default function createOptions (api: ApiPromise, sectionName: string): Dr
|
||||
|
||||
return Object
|
||||
.keys(section)
|
||||
.filter((s) => !s.startsWith('$'))
|
||||
.sort()
|
||||
.map((value): DropdownOption => {
|
||||
const method = (section[value] as ConstantCodec);
|
||||
|
||||
@ -8,6 +8,7 @@ import { ApiPromise } from '@polkadot/api';
|
||||
export default function createOptions (api: ApiPromise): DropdownOptions {
|
||||
return Object
|
||||
.keys(api.consts)
|
||||
.filter((s) => !s.startsWith('$'))
|
||||
.sort()
|
||||
.filter((name): number => Object.keys(api.consts[name]).length)
|
||||
.map((name): { text: string; value: string } => ({
|
||||
|
||||
@ -16,6 +16,7 @@ export default function createOptions (api: ApiPromise, sectionName: string): Dr
|
||||
|
||||
return Object
|
||||
.keys(section)
|
||||
.filter((s) => !s.startsWith('$'))
|
||||
.sort()
|
||||
.map((value): DropdownOption => {
|
||||
const method = section[value];
|
||||
|
||||
@ -8,6 +8,7 @@ import { ApiPromise } from '@polkadot/api';
|
||||
export default function createOptions (api: ApiPromise): DropdownOptions {
|
||||
return Object
|
||||
.keys(api.tx)
|
||||
.filter((s) => !s.startsWith('$'))
|
||||
.sort()
|
||||
.filter((name): number => Object.keys(api.tx[name]).length)
|
||||
.map((name): { text: string; value: string } => ({
|
||||
|
||||
@ -17,6 +17,7 @@ export default function createOptions (api: ApiPromise, rpcs: Record<string, Rec
|
||||
|
||||
return Object
|
||||
.keys((api.rpc as Record<string, Record<string, unknown>>)[sectionName])
|
||||
.filter((s) => !s.startsWith('$'))
|
||||
.sort()
|
||||
.map((methodName) => section[methodName])
|
||||
.filter((ext): ext is DefinitionRpcExt => !!ext)
|
||||
|
||||
@ -8,6 +8,7 @@ import { ApiPromise } from '@polkadot/api';
|
||||
export default function createOptions (api: ApiPromise): DropdownOptions {
|
||||
return Object
|
||||
.keys(api.rpc)
|
||||
.filter((s) => !s.startsWith('$'))
|
||||
.sort()
|
||||
.filter((section) => Object.keys((api.rpc as Record<string, Record<string, unknown>>)[section]).length !== 0)
|
||||
.map((name): { text: string; value: string } => ({
|
||||
|
||||
@ -19,6 +19,7 @@ export function keyOptions (api: ApiPromise, sectionName: string): DropdownOptio
|
||||
|
||||
return Object
|
||||
.keys(section)
|
||||
.filter((s) => !s.startsWith('$'))
|
||||
.sort()
|
||||
.map((value): DropdownOption => {
|
||||
const { meta: { docs, modifier, name, type } } = section[value] as unknown as StorageEntry;
|
||||
|
||||
@ -8,6 +8,7 @@ import { ApiPromise } from '@polkadot/api';
|
||||
export function sectionOptions (api: ApiPromise): DropdownOptions {
|
||||
return Object
|
||||
.keys(api.query)
|
||||
.filter((s) => !s.startsWith('$'))
|
||||
.sort()
|
||||
.filter((n) => Object.keys(api.query[n]).length)
|
||||
.map((value): DropdownOption => ({
|
||||
|
||||
Loading…
Reference in New Issue
Block a user