Add system_chainType RPC (#2149)

This commit is contained in:
Jaco Greeff
2020-04-09 14:28:43 +02:00
committed by GitHub
parent 9cd4bf7cf7
commit 6a8e5370b6
4 changed files with 31 additions and 2 deletions
+5 -1
View File
@@ -18,7 +18,7 @@ import { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import { RpcMethods } from '@polkadot/types/interfaces/rpc';
import { AccountId, BlockNumber, H256, Hash, Header, Index, Justification, KeyValue, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime';
import { RuntimeVersion } from '@polkadot/types/interfaces/state';
import { ChainProperties, Health, NetworkState, NodeRole, PeerInfo } from '@polkadot/types/interfaces/system';
import { ChainProperties, ChainType, Health, NetworkState, NodeRole, PeerInfo } from '@polkadot/types/interfaces/system';
import { Observable } from 'rxjs';
declare module '@polkadot/rpc-core/types.jsonrpc' {
@@ -242,6 +242,10 @@ declare module '@polkadot/rpc-core/types.jsonrpc' {
* Retrieves the chain
**/
chain: AugmentedRpc<() => Observable<Text>>;
/**
* Retrieves the chain type
**/
chainType: AugmentedRpc<() => Observable<ChainType>>;
/**
* Return health status of the node
**/
+4 -1
View File
@@ -37,7 +37,7 @@ import { FullIdentification, IdentificationTuple, Keys, SessionIndex, SessionKey
import { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
import { ActiveEraInfo, CompactAssignments, CompactScore, ElectionCompute, ElectionResult, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, PhragmenScore, Points, ReleasesStaking, RewardDestination, RewardPoint, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196 } from '@polkadot/types/interfaces/staking';
import { ApiId, KeyValueOption, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state';
import { AccountInfo, ChainProperties, DigestOf, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, EventRecordTo76, Health, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, Phase, RefCount } from '@polkadot/types/interfaces/system';
import { AccountInfo, ChainProperties, ChainType, DigestOf, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, EventRecordTo76, Health, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, Phase, RefCount } from '@polkadot/types/interfaces/system';
import { OpenTip, OpenTipFinder, OpenTipTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
import { Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
@@ -893,6 +893,9 @@ declare module '@polkadot/types/types/registry' {
ChainProperties: ChainProperties;
'Option<ChainProperties>': Option<ChainProperties>;
'Vec<ChainProperties>': Vec<ChainProperties>;
ChainType: ChainType;
'Option<ChainType>': Option<ChainType>;
'Vec<ChainType>': Vec<ChainType>;
DigestOf: DigestOf;
'Option<DigestOf>': Option<DigestOf>;
'Vec<DigestOf>': Vec<DigestOf>;
@@ -24,6 +24,11 @@ export default {
params: [],
type: 'Text'
},
chainType: {
description: 'Retrieves the chain type',
params: [],
type: 'ChainType'
},
properties: {
description: 'Get a custom set of properties as a JSON object, defined in the chain spec',
params: [],
@@ -81,6 +86,14 @@ export default {
tokenDecimals: 'Option<u32>',
tokenSymbol: 'Option<Text>'
},
ChainType: {
_enum: {
Development: 'Null',
Local: 'Null',
Live: 'Null',
Custom: 'Text'
}
},
DigestOf: 'Digest',
DispatchError: {
_enum: {
@@ -22,6 +22,15 @@ export interface ChainProperties extends Struct {
readonly tokenSymbol: Option<Text>;
}
/** @name ChainType */
export interface ChainType extends Enum {
readonly isDevelopment: boolean;
readonly isLocal: boolean;
readonly isLive: boolean;
readonly isCustom: boolean;
readonly asCustom: Text;
}
/** @name DigestOf */
export interface DigestOf extends Digest {}