From 5cb16d7aa42747d9c3412f4552213292e73308b5 Mon Sep 17 00:00:00 2001 From: tjjfvi Date: Sun, 25 Sep 2022 11:58:56 -0700 Subject: [PATCH] ... --- known/rpc/author.ts | 21 +++++++++++---------- known/rpc/babe.ts | 4 ++-- known/rpc/beefy.ts | 6 +++--- known/rpc/chain.ts | 22 +++++++++++----------- known/rpc/childstate.ts | 16 ++++++++-------- known/rpc/contracts.ts | 10 +++++----- known/rpc/framesystem.ts | 6 +++--- known/rpc/grandpa.ts | 8 ++++---- known/rpc/mmr.ts | 6 +++--- known/rpc/offchain.ts | 6 +++--- known/rpc/state.ts | 36 ++++++++++++++++++------------------ known/rpc/statemigration.ts | 4 ++-- known/rpc/system.ts | 36 ++++++++++++++++++------------------ known/rpc/utils.ts | 4 ++-- 14 files changed, 93 insertions(+), 92 deletions(-) diff --git a/known/rpc/author.ts b/known/rpc/author.ts index bb3ba2e40..3fee6778b 100644 --- a/known/rpc/author.ts +++ b/known/rpc/author.ts @@ -1,4 +1,4 @@ -import { Hash, Hex, Result, SerdeEnum, Subscription } from "./utils.ts"; +import { Hash, Hex, RpcResult, SerdeEnum, Subscription } from "./utils.ts"; // https://github.com/paritytech/substrate/blob/e0ccd00/client/transaction-pool/api/src/lib.rs#L104 /** @@ -78,6 +78,7 @@ export type TransactionStatus = SerdeEnum<{ invalid: void; }>; +// https://github.com/paritytech/substrate/blob/e0ccd00/client/rpc-api/src/author/hash.rs /** * RPC Extrinsic or hash * @@ -93,26 +94,26 @@ export type ExtrinsicOrHash = SerdeEnum<{ // https://github.com/paritytech/substrate/blob/e0ccd00/client/rpc-api/src/author/mod.rs#L30 export type AuthorRpc = { /** Submit hex-encoded extrinsic for inclusion in block. */ - author_submitExtrinsic(extrinsic: Hex): Result; + author_submitExtrinsic(extrinsic: Hex): RpcResult; /** Insert a key into the keystore. */ - author_insertKey(keyType: string, suri: string, publicKey: Hex): Result; + author_insertKey(keyType: string, suri: string, publicKey: Hex): RpcResult; /** Generate new session keys and returns the corresponding public keys. */ - author_rotateKeys(): Result; + author_rotateKeys(): RpcResult; /** * Checks if the keystore has private keys for the given session public keys. * `sessionKeys` is the SCALE encoded session keys object from the runtime. * Returns `true` iff all private keys could be found. */ - author_hasSessionKeys(sessionsKeys: Hex): Result; + author_hasSessionKeys(sessionsKeys: Hex): RpcResult; /** * Checks if the keystore has private keys for the given public key and key type. * Returns `true` if a private key could be found. */ - author_hasKey(pubKey: Hex, keyType: string): Result; + author_hasKey(pubKey: Hex, keyType: string): RpcResult; /** Returns all pending extrinsics, potentially grouped by sender. */ - author_pendingExtrinsics(): Result; + author_pendingExtrinsics(): RpcResult; /** Remove given extrinsic from the pool and temporarily ban it to prevent reimporting. */ - author_removeExtrinsic(extrinsics: ExtrinsicOrHash[]): Result; // todo + author_removeExtrinsic(extrinsics: ExtrinsicOrHash[]): RpcResult; // todo /** * Submit an extrinsic to watch. * @@ -121,8 +122,8 @@ export type AuthorRpc = { */ author_submitAndWatchExtrinsic( extrinsic: Hex, - ): Result>; + ): RpcResult>; author_unwatchExtrinsic( subscription: Subscription<"author_submitAndWatchExtrinsic", TransactionStatus>, - ): Result; + ): RpcResult; }; diff --git a/known/rpc/babe.ts b/known/rpc/babe.ts index 8f062f5eb..c2a9153b4 100644 --- a/known/rpc/babe.ts +++ b/known/rpc/babe.ts @@ -1,4 +1,4 @@ -import { AccountId, Result } from "./utils.ts"; +import { AccountId, RpcResult } from "./utils.ts"; // https://github.com/paritytech/substrate/blob/9b01569/client/consensus/babe/rpc/src/lib.rs#L154 /** Holds information about the `slot`'s that can be claimed by a given key. */ @@ -17,5 +17,5 @@ export type BabeRpc = { * Returns data about which slots (primary or secondary) can be claimed in * the current epoch with the keys in the keystore. */ - babe_epochAuthorship(): Result>; + babe_epochAuthorship(): RpcResult>; }; diff --git a/known/rpc/beefy.ts b/known/rpc/beefy.ts index 3a8f83529..bf935b55f 100644 --- a/known/rpc/beefy.ts +++ b/known/rpc/beefy.ts @@ -1,9 +1,9 @@ -import { Hash, Hex, Result, Subscription } from "./utils.ts"; +import { Hash, Hex, RpcResult, Subscription } from "./utils.ts"; // https://github.com/paritytech/substrate/blob/317808a/client/beefy/rpc/src/lib.rs#L84 export type BeefyRpc = { /** Returns the block most recently finalized by BEEFY, alongside side its justification. */ - beefy_subscribeJustifications(): Result< + beefy_subscribeJustifications(): RpcResult< Subscription<"beefy_subscribeJustifications", Hex> >; /** @@ -13,5 +13,5 @@ export type BeefyRpc = { * in the network or if the client is still initializing or syncing with the network. * In such case an error would be returned. */ - beefy_getFinalizedHead(): Result; + beefy_getFinalizedHead(): RpcResult; }; diff --git a/known/rpc/chain.ts b/known/rpc/chain.ts index 51d8581f0..1343d0afb 100644 --- a/known/rpc/chain.ts +++ b/known/rpc/chain.ts @@ -1,5 +1,5 @@ import { HexEncoded } from "../../util/branded.ts"; -import { Hash, Hex, ListOrValue, NumberOrHex, Result, Subscription } from "./utils.ts"; +import { Hash, Hex, ListOrValue, NumberOrHex, RpcResult, Subscription } from "./utils.ts"; // https://github.com/paritytech/substrate/blob/0ba251c/primitives/runtime/src/generic/digest.rs /** Generic header digest. */ @@ -43,34 +43,34 @@ export interface Block { // https://github.com/paritytech/substrate/blob/934fbfd/client/rpc-api/src/chain/mod.rs#L27 export type ChainRpc = { /** Get header. */ - chain_getHeader(hash?: Hash): Result
; + chain_getHeader(hash?: Hash): RpcResult
; /** Get header and body of a relay chain block. */ - chain_getBlock(hash?: Hash): Result; + chain_getBlock(hash?: Hash): RpcResult; /** * Get hash of the n-th block in the canon chain. * * By default returns latest block hash. */ - chain_getBlockHash(height?: ListOrValue): Result>; + chain_getBlockHash(height?: ListOrValue): RpcResult>; chain_getHead: ChainRpc["chain_getBlockHash"]; /** Get hash of the last finalized block in the canon chain. */ - chain_getFinalizedHead(): Result; + chain_getFinalizedHead(): RpcResult; chain_getFinalisedHead: ChainRpc["chain_getFinalizedHead"]; /** All head subscription. */ - chain_subscribeAllHeads(): Result>; + chain_subscribeAllHeads(): RpcResult>; chain_unsubscribeAllHeads( subscription: Subscription<"chain_subscribeAllHeads", Header>, - ): Result; + ): RpcResult; /** New head subscription. */ - chain_subscribeNewHeads(): Result>; + chain_subscribeNewHeads(): RpcResult>; chain_unsubscribeNewHeads( subscription: Subscription<"chain_subscribeAllHeads", Header>, - ): Result; + ): RpcResult; /** Finalized head subscription. */ - chain_subscribeFinalizedHeads(): Result>; + chain_subscribeFinalizedHeads(): RpcResult>; chain_unsubscribeFinalizedHeads( subscription: Subscription<"chain_subscribeAllHeads", Header>, - ): Result; + ): RpcResult; chain_subscribeFinalisedHeads: ChainRpc["chain_subscribeFinalizedHeads"]; chain_unsubscribeFinalisedHeads: ChainRpc["chain_unsubscribeFinalizedHeads"]; }; diff --git a/known/rpc/childstate.ts b/known/rpc/childstate.ts index 6e48fae08..75e025623 100644 --- a/known/rpc/childstate.ts +++ b/known/rpc/childstate.ts @@ -1,4 +1,4 @@ -import { Hash, Hex, Result } from "./utils.ts"; +import { Hash, Hex, RpcResult } from "./utils.ts"; // https://github.com/paritytech/substrate/blob/4d04aba/primitives/storage/src/lib.rs export type StorageKey = Hex; @@ -23,7 +23,7 @@ export type ChildStateRpc = { childStorageKey: PrefixedStorageKey, prefix: StorageKey, hash?: Hash, - ): Result; + ): RpcResult; /** * Returns the keys with prefix from a child storage with pagination support. * Up to `count` keys will be returned. @@ -35,35 +35,35 @@ export type ChildStateRpc = { count: number, startKey?: StorageKey, hash?: Hash, - ): Result; + ): RpcResult; /** Returns a child storage entry at a specific block's state. */ childState_getStorage( childStorageKey: PrefixedStorageKey, key: StorageKey, hash?: Hash, - ): Result; + ): RpcResult; /** Returns child storage entries for multiple keys at a specific block's state. */ childState_getStorageEntries( childStorageKey: PrefixedStorageKey, keys: StorageKey[], hash?: Hash, - ): Result<(StorageData | null)[]>; + ): RpcResult<(StorageData | null)[]>; /** Returns the hash of a child storage entry at a block's state. */ childState_getStorageHash( childStorageKey: PrefixedStorageKey, key: StorageKey, hash?: Hash, - ): Result; + ): RpcResult; /** Returns the size of a child storage entry at a block's state. */ childState_getStorageSize( childStorageKey: PrefixedStorageKey, key: StorageKey, hash?: Hash, - ): Result; + ): RpcResult; /** Returns proof of storage for child key entries at a specific block's state. */ state_getChildReadProof( childStorageKey: PrefixedStorageKey, keys: StorageKey[], hash?: Hash, - ): Result; + ): RpcResult; }; diff --git a/known/rpc/contracts.ts b/known/rpc/contracts.ts index e9fd5750b..07620ac6a 100644 --- a/known/rpc/contracts.ts +++ b/known/rpc/contracts.ts @@ -1,4 +1,4 @@ -import { AccountId, Hash, Hex, NumberOrHex, Result, SerdeEnum, SerdeResult } from "./utils.ts"; +import { AccountId, Hash, Hex, NumberOrHex, RpcResult, SerdeEnum, SerdeResult } from "./utils.ts"; // https://github.com/paritytech/substrate/blob/0246883/frame/contracts/rpc/src/lib.rs#L92 /** A struct that encodes RPC parameters required for a call to a smart-contract. */ @@ -233,7 +233,7 @@ export type ContractsRpc = { contracts_call( callRequest: CallRequest, at?: Hash, - ): Result>>; + ): RpcResult>>; /** * Instantiate a new contract. * @@ -244,7 +244,7 @@ export type ContractsRpc = { */ contracts_instantiate( instantiateRequest: InstantiateRequest, - ): Result>>; + ): RpcResult>>; /** * Upload new code without instantiating a contract from it. * @@ -256,7 +256,7 @@ export type ContractsRpc = { contracts_upload_code( uploadRequest: CodeUploadRequest, at?: Hash, - ): Result>; + ): RpcResult>; /** * Returns the value under a specified storage `key` in a contract given by `address` param, * or `None` if it is not set. @@ -265,5 +265,5 @@ export type ContractsRpc = { accountId: AccountId, key: Hex, aat?: Hash, - ): Result; + ): RpcResult; }; diff --git a/known/rpc/framesystem.ts b/known/rpc/framesystem.ts index 53e075382..8a8a7fbeb 100644 --- a/known/rpc/framesystem.ts +++ b/known/rpc/framesystem.ts @@ -1,4 +1,4 @@ -import { AccountId, Hash, Hex, Result } from "./utils.ts"; +import { AccountId, Hash, Hex, RpcResult } from "./utils.ts"; // https://github.com/paritytech/substrate/blob/eddf888/utils/frame/rpc/system/src/lib.rs#L41 export type FrameSystemRpc = { @@ -9,9 +9,9 @@ export type FrameSystemRpc = { * currently in the pool and if no transactions are found in the pool * it fallbacks to query the index from the runtime (aka. state nonce). */ - system_accountNextIndex(account: AccountId): Result; + system_accountNextIndex(account: AccountId): RpcResult; account_nextIndex: FrameSystemRpc["system_accountNextIndex"]; /** Dry run an extrinsic at a given block. Return SCALE encoded ApplyExtrinsicResult. */ - system_dryRun(extrinsic: Hex, at?: Hash): Result; + system_dryRun(extrinsic: Hex, at?: Hash): RpcResult; system_dryRunAt: FrameSystemRpc["system_dryRun"]; }; diff --git a/known/rpc/grandpa.ts b/known/rpc/grandpa.ts index 08a913ebd..8bd36a368 100644 --- a/known/rpc/grandpa.ts +++ b/known/rpc/grandpa.ts @@ -1,4 +1,4 @@ -import { Hex, Result, Subscription } from "./utils.ts"; +import { Hex, RpcResult, Subscription } from "./utils.ts"; // https://github.com/paritytech/substrate/blob/0ba251c/client/finality-grandpa/rpc/src/report.rs#L116 /** @@ -45,12 +45,12 @@ export type GrandpaRpc = { * Returns the state of the current best round state as well as the * ongoing background rounds. */ - grandpa_roundState(): Result; + grandpa_roundState(): RpcResult; /** * Returns the block most recently finalized by Grandpa, alongside * side its justification. */ - grandpa_subscribeJustifications(): Result< + grandpa_subscribeJustifications(): RpcResult< Subscription<"grandpa_subscribeJustifications", JustificationNotification> >; grandpa_unsubscribeJustifications( @@ -60,5 +60,5 @@ export type GrandpaRpc = { * Prove finality for the given block number by returning the Justification for the last block * in the set and all the intermediary headers to link them together. */ - grandpa_proveFinality(block: number): Result; + grandpa_proveFinality(block: number): RpcResult; }; diff --git a/known/rpc/mmr.ts b/known/rpc/mmr.ts index 539943f27..245b0684d 100644 --- a/known/rpc/mmr.ts +++ b/known/rpc/mmr.ts @@ -1,4 +1,4 @@ -import { Hash, Hex, Result } from "./utils.ts"; +import { Hash, Hex, RpcResult } from "./utils.ts"; // https://github.com/paritytech/substrate/blob/6c5ac31/primitives/merkle-mountain-range/src/lib.rs#L37 /** @@ -44,7 +44,7 @@ export type MmrRpc = { * Returns the (full) leaf itself and a proof for this leaf (compact encoding, i.e. hash of * the leaf). Both parameters are SCALE-encoded. */ - mmr_generateProof(leafIndex: LeafIndex, at?: Hash): Result; + mmr_generateProof(leafIndex: LeafIndex, at?: Hash): RpcResult; /** * Generate MMR proof for the given leaf indices. * @@ -57,5 +57,5 @@ export type MmrRpc = { * The order of entries in the `leaves` field of the returned struct * is the same as the order of the entries in `leaf_indices` supplied */ - mmr_generateBatchProof(leafIndices: LeafIndex[], at?: Hash): Result; + mmr_generateBatchProof(leafIndices: LeafIndex[], at?: Hash): RpcResult; }; diff --git a/known/rpc/offchain.ts b/known/rpc/offchain.ts index aa2e7b7e8..110e66159 100644 --- a/known/rpc/offchain.ts +++ b/known/rpc/offchain.ts @@ -1,4 +1,4 @@ -import { Hex, Result, SerdeEnum } from "./utils.ts"; +import { Hex, RpcResult, SerdeEnum } from "./utils.ts"; /** A type of supported crypto. */ export type StorageKind = SerdeEnum<{ @@ -23,7 +23,7 @@ export type StorageKind = SerdeEnum<{ // https://github.com/paritytech/substrate/blob/7d233c2/client/rpc-api/src/offchain/mod.rs#L28 export type OffchainRpc = { /** Set offchain local storage under given key and prefix. */ - offchain_localStorageSet(kind: StorageKind, key: Hex, value: Hex): Result; + offchain_localStorageSet(kind: StorageKind, key: Hex, value: Hex): RpcResult; /** Get offchain local storage under given key and prefix. */ - offchain_localStorageGet(kind: StorageKind, key: Hex): Result; + offchain_localStorageGet(kind: StorageKind, key: Hex): RpcResult; }; diff --git a/known/rpc/state.ts b/known/rpc/state.ts index ef848eb27..6ef24be2c 100644 --- a/known/rpc/state.ts +++ b/known/rpc/state.ts @@ -1,5 +1,5 @@ import { ReadProof, StorageData, StorageKey } from "./childstate.ts"; -import { Hash, Hex, Result, SerdeEnum, Subscription } from "./utils.ts"; +import { Hash, Hex, RpcResult, SerdeEnum, Subscription } from "./utils.ts"; // https://github.com/paritytech/substrate/blob/01a3ad65/primitives/version/src/lib.rs#L161 /** @@ -162,15 +162,15 @@ export interface Span { // https://github.com/paritytech/substrate/blob/28ac0a8/client/rpc-api/src/state/mod.rs#L35 export type StateRpc = { /** Call a contract at a block's state. */ - state_call(name: string, bytes: Hex, at?: Hash): Result; + state_call(name: string, bytes: Hex, at?: Hash): RpcResult; state_callAt: StateRpc["state_call"]; /** * Returns the keys with prefix, leave empty to get all the keys. * @deprecated [2.0.0] Please use `getKeysPaged` with proper paging support */ - state_getKeys(prefix: StorageKey, at?: Hash): Result; + state_getKeys(prefix: StorageKey, at?: Hash): RpcResult; /** Returns the keys with prefix, leave empty to get all the keys */ - state_getPairs(prefix: StorageKey, at?: Hash): Result<[StorageKey, StorageData][]>; + state_getPairs(prefix: StorageKey, at?: Hash): RpcResult<[StorageKey, StorageData][]>; /** * Returns the keys with prefix with pagination support. * Up to `count` keys will be returned. @@ -181,21 +181,21 @@ export type StateRpc = { count: number, startKey?: StorageKey, at?: Hash, - ): Result; + ): RpcResult; state_getKeysPagedAt: StateRpc["state_getKeysPaged"]; /** Returns a storage entry at a specific block's state. */ - state_getStorage(key: StorageKey, at?: Hash): Result; + state_getStorage(key: StorageKey, at?: Hash): RpcResult; state_getStorageAt: StateRpc["state_getStorage"]; /** Returns the hash of a storage entry at a block's state. */ - state_getStorageHash(key: StorageKey, at?: Hash): Result; + state_getStorageHash(key: StorageKey, at?: Hash): RpcResult; state_getStorageHashAt: StateRpc["state_getStorageHash"]; /** Returns the size of a storage entry at a block's state. */ - state_getStorageSize(key: StorageKey, at?: Hash): Result; + state_getStorageSize(key: StorageKey, at?: Hash): RpcResult; state_getStorageSizeAt: StateRpc["state_getStorageSize"]; /** Returns the runtime metadata as an opaque blob. */ - state_getMetadata(at?: Hash): Result; + state_getMetadata(at?: Hash): RpcResult; /** Get the runtime version. */ - state_getRuntimeVersion(at?: Hash): Result; + state_getRuntimeVersion(at?: Hash): RpcResult; chain_getRuntimeVersion: StateRpc["state_getRuntimeVersion"]; /** * Query historical storage entries (by key) starting from a block given as the second @@ -204,32 +204,32 @@ export type StateRpc = { * NOTE This first returned result contains the initial state of storage for all keys. * Subsequent values in the vector represent changes to the previous state (diffs). */ - state_queryStorage(keys: StorageKey[], block: Hash, at?: Hash): Result; + state_queryStorage(keys: StorageKey[], block: Hash, at?: Hash): RpcResult; /** Query storage entries (by key) starting at block hash given as the second parameter. */ - state_queryStorageAt(keys: StorageKey[], at?: Hash): Result; + state_queryStorageAt(keys: StorageKey[], at?: Hash): RpcResult; /** Returns proof of storage entries at a specific block's state. */ - state_getReadProof(keys: StorageKey[], at?: Hash): Result; + state_getReadProof(keys: StorageKey[], at?: Hash): RpcResult; /** New runtime version subscription */ - state_subscribeRuntimeVersion(): Result< + state_subscribeRuntimeVersion(): RpcResult< Subscription<"state_subscribeRuntimeVersion", RuntimeVersion> >; state_unsubscribeRuntimeVersion( subscription: Subscription<"state_subscribeRuntimeVersion", RuntimeVersion>, - ): Result; + ): RpcResult; chain_subscribeRuntimeVersion: StateRpc["state_subscribeRuntimeVersion"]; chain_unsubscribeRuntimeVersion: StateRpc["state_unsubscribeRuntimeVersion"]; /** New storage subscription */ state_subscribeStorage( keys: StorageKey[] | null, - ): Result>; + ): RpcResult>; state_unsubscribeStorage( subscription: Subscription<"state_subscribeStorage", StorageChangeSet>, - ): Result; + ): RpcResult; /** See https://paritytech.github.io/substrate/master/sc_rpc_api/state/trait.StateApiServer.html#tymethod.trace_block */ state_traceBlock( block: Hash, targets?: string, storageKeys?: string, methods?: string, - ): Result; + ): RpcResult; }; diff --git a/known/rpc/statemigration.ts b/known/rpc/statemigration.ts index 81f0b2f99..a5dbc9a79 100644 --- a/known/rpc/statemigration.ts +++ b/known/rpc/statemigration.ts @@ -1,4 +1,4 @@ -import { Hash, Result } from "./utils.ts"; +import { Hash, RpcResult } from "./utils.ts"; // https://github.com/paritytech/substrate/blob/00cc5f1/utils/frame/rpc/state-trie-migration-rpc/src/lib.rs#L106 export interface MigrationStatusResult { @@ -15,5 +15,5 @@ export type StateMigrationRpc = { * won't change any state. Nonetheless it is a VERY costy call that should be * only exposed to trusted peers. */ - state_trieMigrationStatus(at?: Hash): Result; + state_trieMigrationStatus(at?: Hash): RpcResult; }; diff --git a/known/rpc/system.ts b/known/rpc/system.ts index 1faa1c142..18b3661e3 100644 --- a/known/rpc/system.ts +++ b/known/rpc/system.ts @@ -1,4 +1,4 @@ -import { Hash, Result, SerdeEnum } from "./utils.ts"; +import { Hash, RpcResult, SerdeEnum } from "./utils.ts"; // https://github.com/paritytech/substrate/blob/57e3486/client/chain-spec/src/lib.rs#L198 export type ChainType = SerdeEnum<{ @@ -62,15 +62,15 @@ export interface SyncState { // https://github.com/paritytech/substrate/blob/e0ccd00/client/rpc-api/src/system/mod.rs#L33 export type SystemRpc = { /** Get the node's implementation name. Plain old string. */ - system_name(): Result; + system_name(): RpcResult; /** Get the node implementation's version. Should be a semver string. */ - system_version(): Result; + system_version(): RpcResult; /** Get the chain's name. Given as a string identifier. */ - system_chain(): Result; + system_chain(): RpcResult; /** Get the chain's type. */ - system_chainType(): Result; + system_chainType(): RpcResult; /** Get a custom set of properties as a JSON object, defined in the chain spec. */ - system_properties(): Result>; + system_properties(): RpcResult>; /** * Return health status of the node. * @@ -78,18 +78,18 @@ export type SystemRpc = { * - connected to some peers (unless running in dev mode) * - not performing a major sync */ - system_health(): Result; + system_health(): RpcResult; /** Returns the base58-encoded PeerId of the node. */ - system_localPeerId(): Result; + system_localPeerId(): RpcResult; /** * Returns the multi-addresses that the local node is listening on * * The addresses include a trailing `/p2p/` with the local PeerId, and are thus suitable to * be passed to `addReservedPeer` or as a bootnode address for example. */ - system_localListenAddresses(): Result; + system_localListenAddresses(): RpcResult; /** Returns currently connected peers */ - system_peers(): Result; + system_peers(): RpcResult; /** * Returns current state of the network. * @@ -98,7 +98,7 @@ export type SystemRpc = { */ // TODO: the future of this call is uncertain: https://github.com/paritytech/substrate/issues/1890 // https://github.com/paritytech/substrate/issues/5541 - system_networkState(): Result; + system_networkState(): RpcResult; /** * Adds a reserved peer. Returns the empty string or an error. The string * parameter should encode a `p2p` multiaddr. @@ -106,21 +106,21 @@ export type SystemRpc = { * `/ip4/198.51.100.19/tcp/30333/p2p/QmSk5HQbn6LhUwDiNMseVUjuRYhEtYj4aUZ6WfWoGURpdV` * is an example of a valid, passing multiaddr with PeerId attached. */ - system_addReservedPeer(peer: string): Result; + system_addReservedPeer(peer: string): RpcResult; /** * Remove a reserved peer. Returns the empty string or an error. The string * should encode only the PeerId e.g. `QmSk5HQbn6LhUwDiNMseVUjuRYhEtYj4aUZ6WfWoGURpdV`. */ - system_removeReservedPeer(peerId: string): Result; + system_removeReservedPeer(peerId: string): RpcResult; /** Returns the list of reserved peers */ - system_reservedPeers(): Result; + system_reservedPeers(): RpcResult; /** Returns the roles the node is running as. */ - system_nodeRoles(): Result; + system_nodeRoles(): RpcResult; /** * Returns the state of the syncing of the node: starting block, current best block, highest * known block. */ - system_syncState(): Result; + system_syncState(): RpcResult; /** * Adds the supplied directives to the current log filter * @@ -128,7 +128,7 @@ export type SystemRpc = { * * `sync=debug,state=trace` */ - system_addLogFilter(directives: string): Result; + system_addLogFilter(directives: string): RpcResult; /** Resets the log filter to Substrate defaults */ - system_resetLogFilter(): Result; + system_resetLogFilter(): RpcResult; }; diff --git a/known/rpc/utils.ts b/known/rpc/utils.ts index fdb3707bc..19094b882 100644 --- a/known/rpc/utils.ts +++ b/known/rpc/utils.ts @@ -10,7 +10,7 @@ export type Hex = U.Hex; export type Hash = U.HexHash; export type SubId = string; export type AccountId = string; -export type Subscription = null; +export type Subscription = string & { _subscription: [T, U] }; export type NumberOrHex = U.HexEncoded | number; export type ListOrValue = T | T[]; -export type Result = T; +export type RpcResult = T;