From 80209da5c5e673aa1256a79ffcb00c4a817a4c4c Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Tue, 22 Dec 2020 15:30:48 +0100 Subject: [PATCH] Add frontier RPCs (& types for them) (#2976) * Add frontier RPCs (& types for them) * Add filters * Cleanup optional params * Add ethereum module aliasses * Split rpc * Split net RPC * full block details * onlyHex * Revert onlyHex change --- packages/api/src/augment/rpc.ts | 155 +++++++++- packages/rpc-core/src/index.ts | 2 + packages/types-known/src/modules.ts | 7 + packages/types/src/augment/registry.ts | 94 +++++- packages/types/src/codec/AbstractInt.ts | 4 +- packages/types/src/interfaces/definitions.ts | 2 +- .../types/src/interfaces/eth/definitions.ts | 232 +++++++++++++++ .../src/interfaces/{ethereum => eth}/index.ts | 0 packages/types/src/interfaces/eth/rpc.ts | 272 +++++++++++++++++ packages/types/src/interfaces/eth/types.ts | 274 ++++++++++++++++++ .../src/interfaces/ethereum/definitions.ts | 15 - .../types/src/interfaces/ethereum/types.ts | 12 - packages/types/src/interfaces/jsonrpc.ts | 12 +- .../src/interfaces/runtime/definitions.ts | 4 + .../types/src/interfaces/runtime/types.ts | 12 + packages/types/src/interfaces/types.ts | 2 +- packages/types/src/types/definitions.ts | 2 + 17 files changed, 1063 insertions(+), 38 deletions(-) create mode 100644 packages/types/src/interfaces/eth/definitions.ts rename packages/types/src/interfaces/{ethereum => eth}/index.ts (100%) create mode 100644 packages/types/src/interfaces/eth/rpc.ts create mode 100644 packages/types/src/interfaces/eth/types.ts delete mode 100644 packages/types/src/interfaces/ethereum/definitions.ts delete mode 100644 packages/types/src/interfaces/ethereum/types.ts diff --git a/packages/api/src/augment/rpc.ts b/packages/api/src/augment/rpc.ts index 0cdfb93643..29fe2e6302 100644 --- a/packages/api/src/augment/rpc.ts +++ b/packages/api/src/augment/rpc.ts @@ -2,7 +2,7 @@ /* eslint-disable */ import type { Metadata } from '@polkadot/metadata'; -import type { Bytes, HashMap, Json, Null, Option, StorageKey, Text, Vec, bool, u32, u64 } from '@polkadot/types'; +import type { Bytes, HashMap, Json, Null, Option, StorageKey, Text, U256, U64, Vec, bool, u32, u64 } from '@polkadot/types'; import type { AnyNumber, Codec, IExtrinsic, Observable } from '@polkadot/types/types'; import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author'; import type { EpochAuthorship } from '@polkadot/types/interfaces/babe'; @@ -11,12 +11,13 @@ import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate'; import type { AuthorityId } from '@polkadot/types/interfaces/consensus'; import type { ContractCallRequest, ContractExecResult } from '@polkadot/types/interfaces/contracts'; import type { CreatedBlock } from '@polkadot/types/interfaces/engine'; +import type { EthCallRequest, EthFilter, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth'; import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics'; import type { EncodedFinalityProofs, JustificationNotification, ReportedRoundStates } from '@polkadot/types/interfaces/grandpa'; import type { StorageKind } from '@polkadot/types/interfaces/offchain'; import type { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment'; import type { RpcMethods } from '@polkadot/types/interfaces/rpc'; -import type { AccountId, BlockNumber, H256, Hash, Header, Index, Justification, KeyValue, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime'; +import type { AccountId, BlockNumber, H160, H256, H64, Hash, Header, Index, Justification, KeyValue, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime'; import type { ReadProof, RuntimeVersion } from '@polkadot/types/interfaces/state'; import type { ApplyExtrinsicResult, ChainProperties, ChainType, Health, NetworkState, NodeRole, PeerInfo, SyncState } from '@polkadot/types/interfaces/system'; @@ -134,6 +135,156 @@ declare module '@polkadot/rpc-core/types.jsonrpc' { **/ finalizeBlock: AugmentedRpc<(hash: BlockHash | string | Uint8Array, justification?: Justification | string | Uint8Array) => Observable>; }; + eth: { + /** + * Returns accounts list. + **/ + accounts: AugmentedRpc<() => Observable>>; + /** + * Returns balance of the given account. + **/ + blockNumber: AugmentedRpc<() => Observable>; + /** + * Call contract, returning the output data. + **/ + call: AugmentedRpc<(request: EthCallRequest | { from?: any; to?: any; gasPrice?: any; gas?: any; value?: any; data?: any; nonce?: any } | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable>; + /** + * Returns the chain ID used for transaction signing at the current best block. None is returned if not available. + **/ + chainId: AugmentedRpc<() => Observable>; + /** + * Returns block author. + **/ + coinbase: AugmentedRpc<() => Observable>; + /** + * Estimate gas needed for execution of given contract. + **/ + estimateGas: AugmentedRpc<(request: EthCallRequest | { from?: any; to?: any; gasPrice?: any; gas?: any; value?: any; data?: any; nonce?: any } | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable>; + /** + * Returns current gas price. + **/ + gasPrice: AugmentedRpc<() => Observable>; + /** + * Returns balance of the given account. + **/ + getBalance: AugmentedRpc<(address: H160 | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable>; + /** + * Returns block with given hash. + **/ + getBlockByHash: AugmentedRpc<(hash: H256 | string | Uint8Array, full: bool | boolean | Uint8Array) => Observable>>; + /** + * Returns block with given number. + **/ + getBlockByNumber: AugmentedRpc<(block: BlockNumber | AnyNumber | Uint8Array, full: bool | boolean | Uint8Array) => Observable>>; + /** + * Returns the number of transactions in a block with given hash. + **/ + getBlockTransactionCountByHash: AugmentedRpc<(hash: H256 | string | Uint8Array) => Observable>; + /** + * Returns the number of transactions in a block with given block number. + **/ + getBlockTransactionCountByNumber: AugmentedRpc<(block: BlockNumber | AnyNumber | Uint8Array) => Observable>; + /** + * Returns the code at given address at given time (block number). + **/ + getCode: AugmentedRpc<(address: H160 | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable>; + /** + * Returns logs matching given filter object. + **/ + getLogs: AugmentedRpc<(filter: EthFilter | { fromBlock?: any; toBlock?: any; blockHash?: any; address?: any; topics?: any } | string | Uint8Array) => Observable>>; + /** + * Returns content of the storage at given address. + **/ + getStorageAt: AugmentedRpc<(address: H160 | string | Uint8Array, index: U256 | AnyNumber | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable>; + /** + * Returns transaction at given block hash and index. + **/ + getTransactionByBlockHashAndIndex: AugmentedRpc<(hash: H256 | string | Uint8Array, index: U256 | AnyNumber | Uint8Array) => Observable>; + /** + * Returns transaction by given block number and index. + **/ + getTransactionByBlockNumberAndIndex: AugmentedRpc<(number: BlockNumber | AnyNumber | Uint8Array, index: U256 | AnyNumber | Uint8Array) => Observable>; + /** + * Get transaction by its hash. + **/ + getTransactionByHash: AugmentedRpc<(hash: H256 | string | Uint8Array) => Observable>; + /** + * Returns the number of transactions sent from given address at given time (block number). + **/ + getTransactionCount: AugmentedRpc<(hash: H256 | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable>; + /** + * Returns transaction receipt by transaction hash. + **/ + getTransactionReceipt: AugmentedRpc<(hash: H256 | string | Uint8Array) => Observable>; + /** + * Returns an uncles at given block and index. + **/ + getUncleByBlockHashAndIndex: AugmentedRpc<(hash: H256 | string | Uint8Array, index: U256 | AnyNumber | Uint8Array) => Observable>; + /** + * Returns an uncles at given block and index. + **/ + getUncleByBlockNumberAndIndex: AugmentedRpc<(number: BlockNumber | AnyNumber | Uint8Array, index: U256 | AnyNumber | Uint8Array) => Observable>; + /** + * Returns the number of uncles in a block with given hash. + **/ + getUncleCountByBlockHash: AugmentedRpc<(hash: H256 | string | Uint8Array) => Observable>; + /** + * Returns the number of uncles in a block with given block number. + **/ + getUncleCountByBlockNumber: AugmentedRpc<(number: BlockNumber | AnyNumber | Uint8Array) => Observable>; + /** + * Returns the hash of the current block, the seedHash, and the boundary condition to be met. + **/ + getWork: AugmentedRpc<() => Observable>; + /** + * Returns the number of hashes per second that the node is mining with. + **/ + hashrate: AugmentedRpc<() => Observable>; + /** + * Returns true if client is actively listening for network connections. Otherwise false. + **/ + listening: AugmentedRpc<() => Observable>; + /** + * Returns true if client is actively mining new blocks. + **/ + mining: AugmentedRpc<() => Observable>; + /** + * Returns number of peers connected to node. + **/ + peerCount: AugmentedRpc<() => Observable>; + /** + * Returns protocol version encoded as a string (quotes are necessary). + **/ + protocolVersion: AugmentedRpc<() => Observable>; + /** + * Sends signed transaction, returning its hash. + **/ + sendRawTransaction: AugmentedRpc<(bytes: Bytes | string | Uint8Array) => Observable>; + /** + * Sends transaction; will block waiting for signer to return the transaction hash + **/ + sendTransaction: AugmentedRpc<(tx: EthTransactionRequest | { from?: any; to?: any; gasPrice?: any; gas?: any; value?: any; data?: any; nonce?: any } | string | Uint8Array) => Observable>; + /** + * Used for submitting mining hashrate. + **/ + submitHashrate: AugmentedRpc<(index: U256 | AnyNumber | Uint8Array, hash: H256 | string | Uint8Array) => Observable>; + /** + * Used for submitting a proof-of-work solution. + **/ + submitWork: AugmentedRpc<(nonce: H64 | string | Uint8Array, headerHash: H256 | string | Uint8Array, mixDigest: H256 | string | Uint8Array) => Observable>; + /** + * Subscribe to Eth subscription. + **/ + subscribe: AugmentedRpc<(kind: EthSubKind | 'newHeads' | 'logs' | 'newPendingTransactions' | 'syncing' | number | Uint8Array, params?: EthSubParams | { None: any } | { Logs: any } | string | Uint8Array) => Observable>; + /** + * Returns an object with data about the sync status or false. + **/ + syncing: AugmentedRpc<() => Observable>; + /** + * Returns protocol version. + **/ + version: AugmentedRpc<() => Observable>; + }; grandpa: { /** * Prove finality for the range (begin; end] hash. diff --git a/packages/rpc-core/src/index.ts b/packages/rpc-core/src/index.ts index 7f4eb34406..67ddcd7500 100644 --- a/packages/rpc-core/src/index.ts +++ b/packages/rpc-core/src/index.ts @@ -106,6 +106,8 @@ export class RpcCore implements RpcInterface { public readonly engine!: RpcInterface['engine']; + public readonly eth!: RpcInterface['eth']; + public readonly grandpa!: RpcInterface['grandpa']; public readonly offchain!: RpcInterface['offchain']; diff --git a/packages/types-known/src/modules.ts b/packages/types-known/src/modules.ts index 67e9531716..1b1082aa32 100644 --- a/packages/types-known/src/modules.ts +++ b/packages/types-known/src/modules.ts @@ -14,6 +14,13 @@ const typesModules: Record = { contracts: { StorageKey: 'ContractStorageKey' }, + ethereum: { + Block: 'EthBlock', + Header: 'EthHeader', + Receipt: 'EthReceipt', + Transaction: 'EthTransaction', + TransactionStatus: 'EthTransactionStatus' + }, grandpa: { Equivocation: 'GrandpaEquivocation', EquivocationProof: 'GrandpaEquivocationProof' diff --git a/packages/types/src/augment/registry.ts b/packages/types/src/augment/registry.ts index 3852604fba..53d6cb33a8 100644 --- a/packages/types/src/augment/registry.ts +++ b/packages/types/src/augment/registry.ts @@ -19,7 +19,7 @@ import type { ContractConstructorSpec, ContractContractSpec, ContractCryptoHashe import type { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PreimageStatus, PreimageStatusAvailable, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy'; import type { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections'; import type { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine'; -import type { EthereumAccountId, EthereumLookupSource } from '@polkadot/types/interfaces/ethereum'; +import type { EthAccount, EthBlock, EthBloom, EthCallRequest, EthFilter, EthFilterAddress, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionCondition, EthTransactionRequest, EthTransactionStatus, EthWork, EthereumAccountId, EthereumLookupSource, EthereumSignature } from '@polkadot/types/interfaces/eth'; import type { Account, Log, Vicinity } from '@polkadot/types/interfaces/evm'; import type { AnySignature, EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV4, ExtrinsicSignature, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV4, ImmortalEra, MortalEra, MultiSignature, Signature, SignerPayload, Sr25519Signature } from '@polkadot/types/interfaces/extrinsics'; import type { AssetOptions, Owner, PermissionLatest, PermissionVersions, PermissionsV1 } from '@polkadot/types/interfaces/genericAsset'; @@ -36,7 +36,7 @@ import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/ty import type { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase'; import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery'; import type { RpcMethods } from '@polkadot/types/interfaces/rpc'; -import type { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, CallHash, CallHashOf, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H160, H256, H512, Hash, Header, I32F32, Index, IndicesLookupSource, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, OpaqueCall, Origin, OriginCaller, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, StorageData, TransactionPriority, U32F32, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime'; +import type { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, CallHash, CallHashOf, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H512, H64, Hash, Header, I32F32, Index, IndicesLookupSource, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, OpaqueCall, Origin, OriginCaller, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, StorageData, TransactionPriority, U32F32, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime'; import type { SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray, SiTypeDefComposite, SiTypeDefPrimitive, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiVariant } from '@polkadot/types/interfaces/scaleInfo'; import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler'; import type { FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys7, SessionKeys8, SessionKeys9, ValidatorCount } from '@polkadot/types/interfaces/session'; @@ -284,6 +284,12 @@ declare module '@polkadot/types/types/registry' { ExtrinsicsWeight: ExtrinsicsWeight; 'Option': Option; 'Vec': Vec; + H64: H64; + 'Option': Option; + 'Vec': Vec; + H128: H128; + 'Option': Option; + 'Vec': Vec; H160: H160; 'Option': Option; 'Vec': Vec; @@ -293,6 +299,12 @@ declare module '@polkadot/types/types/registry' { H512: H512; 'Option': Option; 'Vec': Vec; + H1024: H1024; + 'Option': Option; + 'Vec': Vec; + H2048: H2048; + 'Option': Option; + 'Vec': Vec; Hash: Hash; 'Option': Option; 'Vec': Vec; @@ -1835,6 +1847,84 @@ declare module '@polkadot/types/types/registry' { EthereumLookupSource: EthereumLookupSource; 'Option': Option; 'Vec': Vec; + EthereumSignature: EthereumSignature; + 'Option': Option; + 'Vec': Vec; + EthAccount: EthAccount; + 'Option': Option; + 'Vec': Vec; + EthBlock: EthBlock; + 'Option': Option; + 'Vec': Vec; + EthBloom: EthBloom; + 'Option': Option; + 'Vec': Vec; + EthCallRequest: EthCallRequest; + 'Option': Option; + 'Vec': Vec; + EthFilter: EthFilter; + 'Option': Option; + 'Vec': Vec; + EthFilterAddress: EthFilterAddress; + 'Option': Option; + 'Vec': Vec; + EthFilterTopic: EthFilterTopic; + 'Option': Option; + 'Vec': Vec; + EthFilterTopicEntry: EthFilterTopicEntry; + 'Option': Option; + 'Vec': Vec; + EthFilterTopicInner: EthFilterTopicInner; + 'Option': Option; + 'Vec': Vec; + EthHeader: EthHeader; + 'Option': Option; + 'Vec': Vec; + EthLog: EthLog; + 'Option': Option; + 'Vec': Vec; + EthReceipt: EthReceipt; + 'Option': Option; + 'Vec': Vec; + EthRichBlock: EthRichBlock; + 'Option': Option; + 'Vec': Vec; + EthRichHeader: EthRichHeader; + 'Option': Option; + 'Vec': Vec; + EthStorageProof: EthStorageProof; + 'Option': Option; + 'Vec': Vec; + EthSubKind: EthSubKind; + 'Option': Option; + 'Vec': Vec; + EthSubParams: EthSubParams; + 'Option': Option; + 'Vec': Vec; + EthSubResult: EthSubResult; + 'Option': Option; + 'Vec': Vec; + EthSyncInfo: EthSyncInfo; + 'Option': Option; + 'Vec': Vec; + EthSyncStatus: EthSyncStatus; + 'Option': Option; + 'Vec': Vec; + EthTransaction: EthTransaction; + 'Option': Option; + 'Vec': Vec; + EthTransactionCondition: EthTransactionCondition; + 'Option': Option; + 'Vec': Vec; + EthTransactionRequest: EthTransactionRequest; + 'Option': Option; + 'Vec': Vec; + EthTransactionStatus: EthTransactionStatus; + 'Option': Option; + 'Vec': Vec; + EthWork: EthWork; + 'Option': Option; + 'Vec': Vec; DoubleMapTypeV9: DoubleMapTypeV9; 'Option': Option; 'Vec': Vec; diff --git a/packages/types/src/codec/AbstractInt.ts b/packages/types/src/codec/AbstractInt.ts index 37aae5dee3..398787f49e 100644 --- a/packages/types/src/codec/AbstractInt.ts +++ b/packages/types/src/codec/AbstractInt.ts @@ -186,11 +186,11 @@ export abstract class AbstractInt extends BN implements Codec { /** * @description Converts the Object to JSON, typically used for RPC transfers */ - public toJSON (): any { + public toJSON (onlyHex = false): any { // FIXME this return type should by string | number, but BN's return type // is string. // Maximum allowed integer for JS is 2^53 - 1, set limit at 52 - return super.bitLength() > 52 + return onlyHex || (super.bitLength() > 52) ? this.toHex() : this.toNumber(); } diff --git a/packages/types/src/interfaces/definitions.ts b/packages/types/src/interfaces/definitions.ts index 1872f0c0b5..4ecd39bf49 100644 --- a/packages/types/src/interfaces/definitions.ts +++ b/packages/types/src/interfaces/definitions.ts @@ -49,7 +49,7 @@ export { default as contractsAbi } from './contractsAbi/definitions'; export { default as scaleInfo } from './scaleInfo/definitions'; // other useful types -export { default as ethereum } from './ethereum/definitions'; +export { default as eth } from './eth/definitions'; // pull in metadata & rpc last, assuming that is uses info from above export { default as metadata } from './metadata/definitions'; diff --git a/packages/types/src/interfaces/eth/definitions.ts b/packages/types/src/interfaces/eth/definitions.ts new file mode 100644 index 0000000000..2a321e63fb --- /dev/null +++ b/packages/types/src/interfaces/eth/definitions.ts @@ -0,0 +1,232 @@ +// Copyright 2017-2020 @polkadot/types authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +// order important in structs... :) +/* eslint-disable sort-keys */ + +// As per frontier + +import type { DefinitionsTypes } from '../../types'; + +import { rpc } from './rpc'; + +const types: DefinitionsTypes = { + EthereumAccountId: 'GenericEthereumAccountId', + EthereumLookupSource: 'GenericEthereumLookupSource', + EthereumSignature: '[u8; 65]', + EthAccount: { + address: 'H160', + balance: 'U256', + nonce: 'U256', + codeHash: 'H256', + storageHash: 'H256', + accountProof: 'Vec', + storageProof: 'Vec' + }, + EthBlock: { + _alias: { + blockHash: 'hash', + blockSize: 'size' + }, + blockHash: 'Option', + parentHash: 'H256', + sha3Uncles: 'H256', + author: 'H160', + miner: 'H160', + stateRoot: 'H256', + transactionsRoot: 'H256', + receiptsRoot: 'H256', + number: 'Option', + gasUsed: 'U256', + gasLimit: 'U256', + extraData: 'Bytes', + logsBloom: 'H2048', + timestamp: 'U256', + difficulty: 'U256', + totalDifficulty: 'Option', + sealFields: 'Vec', + uncles: 'Vec', + transactions: 'Vec', + blockSize: 'Option' + }, + EthBloom: 'H2048', + EthCallRequest: { + from: 'Option', + to: 'Option', + gasPrice: 'Option', + gas: 'Option', + value: 'Option', + data: 'Option', + nonce: 'Option' + }, + EthFilter: { + fromBlock: 'Option', + toBlock: 'Option', + blockHash: 'Option', + address: 'Option', + topics: 'Option' + }, + EthFilterAddress: { + _enum: { + Single: 'H160', + Multiple: 'Vec', + Null: 'Null' + } + }, + EthFilterTopic: { + _enum: { + Single: 'EthFilterTopicInner', + Multiple: 'Vec', + Null: 'Null' + } + }, + EthFilterTopicEntry: 'Option', + EthFilterTopicInner: { + _enum: { + Single: 'EthFilterTopicEntry', + Multiple: 'Vec', + Null: 'Null' + } + }, + EthHeader: { + _alias: { + blockHash: 'hash', + blockSize: 'size' + }, + blockHash: 'Option', + parentHash: 'H256', + sha3Uncles: 'H256', + author: 'H160', + miner: 'H160', + stateRoot: 'H256', + transactionsRoot: 'H256', + receiptsRoot: 'H256', + number: 'Option', + gasUsed: 'U256', + gasLimit: 'U256', + extraData: 'Bytes', + logsBloom: 'H2048', + timestamp: 'U256', + difficulty: 'U256', + sealFields: 'Vec', + blockSize: 'Option' + }, + EthLog: { + address: 'H160', + topics: 'Vec', + data: 'Bytes', + blockHash: 'Option', + blockNumber: 'Option', + transactionHash: 'Option', + transactionIndex: 'Option', + logIndex: 'Option', + transactionLogIndex: 'Option', + removed: 'bool' + }, + EthReceipt: { + transactionHash: 'Option', + transactionIndex: 'Option', + blockHash: 'Option', + from: 'Option', + to: 'Option', + blockNumber: 'Option', + cumulativeGasUsed: 'U256', + gasUsed: 'Option', + contractAddress: 'Option', + logs: 'Vec', + root: 'Option', + logsBloom: 'H2048', + statusCode: 'Option' + }, + EthRichBlock: 'EthBlock', + EthRichHeader: 'EthHeader', + EthStorageProof: { + key: 'U256', + value: 'U256', + proof: 'Vec' + }, + EthSubKind: { + _enum: ['newHeads', 'logs', 'newPendingTransactions', 'syncing'] + }, + EthSubParams: { + _enum: { + None: 'Null', + Logs: 'EthFilter' + } + }, + EthSubResult: { + _enum: { + Header: 'EthRichHeader', + Log: 'EthLog', + TransactionHash: 'H256', + SyncState: 'EthSyncStatus' + } + }, + EthSyncInfo: { + startingBlock: 'U256', + currentBlock: 'U256', + highestBlock: 'U256', + warpChunksAmount: 'Option', + warpChunksProcessed: 'Option' + }, + EthSyncStatus: { + _enum: { + Info: 'EthSyncInfo', + None: 'Null' + } + }, + EthTransaction: { + blockHash: 'Option', + blockNumber: 'Option', + chainId: 'Option', + condition: 'Option', + creates: 'Option', + from: 'H160', + gas: 'U256', + gasPrice: 'U256', + hash: 'H256', + input: 'Bytes', + nonce: 'U256', + publicKey: 'Option', + r: 'U256', + raw: 'Bytes', + s: 'U256', + standardV: 'U256', + to: 'Option', + transactionIndex: 'Option', + v: 'U256', + value: 'U256' + }, + EthTransactionCondition: { + _enum: { + block: 'u64', + time: 'u64' + } + }, + EthTransactionRequest: { + from: 'Option', + to: 'Option', + gasPrice: 'Option', + gas: 'Option', + value: 'Option', + data: 'Option', + nonce: 'Option' + }, + EthTransactionStatus: { + transactionHash: 'H256', + transactionIndex: 'u32', + from: 'H160', + to: 'Option', + contractAddress: 'Option', + logs: 'Vec', + logsBloom: 'EthBloom' + }, + EthWork: { + pow_hash: 'H256', + seed_hash: 'H256', + target: 'H256', + number: 'Option' + } +}; + +export default { rpc, types }; diff --git a/packages/types/src/interfaces/ethereum/index.ts b/packages/types/src/interfaces/eth/index.ts similarity index 100% rename from packages/types/src/interfaces/ethereum/index.ts rename to packages/types/src/interfaces/eth/index.ts diff --git a/packages/types/src/interfaces/eth/rpc.ts b/packages/types/src/interfaces/eth/rpc.ts new file mode 100644 index 0000000000..ecab7ec610 --- /dev/null +++ b/packages/types/src/interfaces/eth/rpc.ts @@ -0,0 +1,272 @@ +// Copyright 2017-2020 @polkadot/types authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +// As per frontier + +import type { DefinitionsRpc } from '../../types'; + +// We use aliasSection here to override since these are in another namespace +const netRpc: DefinitionsRpc = { + listening: { + aliasSection: 'net', + description: 'Returns true if client is actively listening for network connections. Otherwise false.', + params: [], + type: 'bool' + }, + peerCount: { + aliasSection: 'net', + description: 'Returns number of peers connected to node.', + params: [], + type: 'String' + }, + version: { + aliasSection: 'net', + description: 'Returns protocol version.', + params: [], + type: 'String' + } +}; + +export const rpc: DefinitionsRpc = { + ...netRpc, + accounts: { + description: 'Returns accounts list.', + params: [], + type: 'Vec' + }, + blockNumber: { + description: 'Returns balance of the given account.', + params: [], + type: 'U256' + }, + call: { + description: 'Call contract, returning the output data.', + params: [ + { name: 'request', type: 'EthCallRequest' }, + { isOptional: true, name: 'number', type: 'BlockNumber' } + ], + type: 'Bytes' + }, + chainId: { + description: 'Returns the chain ID used for transaction signing at the current best block. None is returned if not available.', + params: [], + type: 'U64' + }, + coinbase: { + description: 'Returns block author.', + params: [], + type: 'H160' + }, + estimateGas: { + description: 'Estimate gas needed for execution of given contract.', + params: [ + { name: 'request', type: 'EthCallRequest' }, + { isOptional: true, name: 'number', type: 'BlockNumber' } + ], + type: 'U256' + }, + gasPrice: { + description: 'Returns current gas price.', + params: [], + type: 'U256' + }, + getBalance: { + description: 'Returns balance of the given account.', + params: [ + { name: 'address', type: 'H160' }, + { isOptional: true, name: 'number', type: 'BlockNumber' } + ], + type: 'U256' + }, + getBlockByHash: { + description: 'Returns block with given hash.', + params: [ + { name: 'hash', type: 'H256' }, + { name: 'full', type: 'bool' } + ], + type: 'Option' + }, + getBlockByNumber: { + description: 'Returns block with given number.', + params: [ + { name: 'block', type: 'BlockNumber' }, + { name: 'full', type: 'bool' } + ], + type: 'Option' + }, + getBlockTransactionCountByHash: { + description: 'Returns the number of transactions in a block with given hash.', + params: [ + { name: 'hash', type: 'H256' } + ], + type: 'U256' + }, + getBlockTransactionCountByNumber: { + description: 'Returns the number of transactions in a block with given block number.', + params: [ + { name: 'block', type: 'BlockNumber' } + ], + type: 'U256' + }, + getCode: { + description: 'Returns the code at given address at given time (block number).', + params: [ + { name: 'address', type: 'H160' }, + { isOptional: true, name: 'number', type: 'BlockNumber' } + ], + type: 'Bytes' + }, + getLogs: { + description: 'Returns logs matching given filter object.', + params: [ + { name: 'filter', type: 'EthFilter' } + ], + type: 'Vec' + }, + getStorageAt: { + description: 'Returns content of the storage at given address.', + params: [ + { name: 'address', type: 'H160' }, + { name: 'index', type: 'U256' }, + { isOptional: true, name: 'number', type: 'BlockNumber' } + ], + type: 'H256' + }, + getTransactionByBlockHashAndIndex: { + description: 'Returns transaction at given block hash and index.', + params: [ + { name: 'hash', type: 'H256' }, + { name: 'index', type: 'U256' } + ], + type: 'EthTransaction' + }, + getTransactionByBlockNumberAndIndex: { + description: 'Returns transaction by given block number and index.', + params: [ + { name: 'number', type: 'BlockNumber' }, + { name: 'index', type: 'U256' } + ], + type: 'EthTransaction' + }, + getTransactionByHash: { + description: 'Get transaction by its hash.', + params: [ + { name: 'hash', type: 'H256' } + ], + type: 'EthTransaction' + }, + getTransactionCount: { + description: 'Returns the number of transactions sent from given address at given time (block number).', + params: [ + { name: 'hash', type: 'H256' }, + { isOptional: true, name: 'number', type: 'BlockNumber' } + ], + type: 'U256' + }, + getTransactionReceipt: { + description: 'Returns transaction receipt by transaction hash.', + params: [ + { name: 'hash', type: 'H256' } + ], + type: 'EthReceipt' + }, + getUncleByBlockHashAndIndex: { + description: 'Returns an uncles at given block and index.', + params: [ + { name: 'hash', type: 'H256' }, + { name: 'index', type: 'U256' } + ], + type: 'EthRichBlock' + }, + getUncleByBlockNumberAndIndex: { + description: 'Returns an uncles at given block and index.', + params: [ + { name: 'number', type: 'BlockNumber' }, + { name: 'index', type: 'U256' } + ], + type: 'EthRichBlock' + }, + getUncleCountByBlockHash: { + description: 'Returns the number of uncles in a block with given hash.', + params: [ + { name: 'hash', type: 'H256' } + ], + type: 'U256' + }, + getUncleCountByBlockNumber: { + description: 'Returns the number of uncles in a block with given block number.', + params: [ + { name: 'number', type: 'BlockNumber' } + ], + type: 'U256' + }, + getWork: { + description: 'Returns the hash of the current block, the seedHash, and the boundary condition to be met.', + params: [], + type: 'EthWork' + }, + hashrate: { + description: 'Returns the number of hashes per second that the node is mining with.', + params: [], + type: 'U256' + }, + mining: { + description: 'Returns true if client is actively mining new blocks.', + params: [], + type: 'bool' + }, + protocolVersion: { + description: 'Returns protocol version encoded as a string (quotes are necessary).', + params: [], + type: 'u64' + }, + sendRawTransaction: { + description: 'Sends signed transaction, returning its hash.', + params: [ + { name: 'bytes', type: 'Bytes' } + ], + type: 'H256' + }, + sendTransaction: { + description: 'Sends transaction; will block waiting for signer to return the transaction hash', + params: [ + { name: 'tx', type: 'EthTransactionRequest' } + ], + type: 'H256' + }, + submitHashrate: { + description: 'Used for submitting mining hashrate.', + params: [ + { name: 'index', type: 'U256' }, + { name: 'hash', type: 'H256' } + ], + type: 'bool' + }, + submitWork: { + description: 'Used for submitting a proof-of-work solution.', + params: [ + { name: 'nonce', type: 'H64' }, + { name: 'headerHash', type: 'H256' }, + { name: 'mixDigest', type: 'H256' } + ], + type: 'bool' + }, + subscribe: { + description: 'Subscribe to Eth subscription.', + params: [ + { name: 'kind', type: 'EthSubKind' }, + { isOptional: true, name: 'params', type: 'EthSubParams' } + ], + pubsub: [ + 'subscription', + 'subscribe', + 'unsubscribe' + ], + type: 'Null' + }, + syncing: { + description: 'Returns an object with data about the sync status or false.', + params: [], + type: 'EthSyncStatus' + } +}; diff --git a/packages/types/src/interfaces/eth/types.ts b/packages/types/src/interfaces/eth/types.ts new file mode 100644 index 0000000000..88edbb4bfe --- /dev/null +++ b/packages/types/src/interfaces/eth/types.ts @@ -0,0 +1,274 @@ +// Auto-generated via `yarn polkadot-types-from-defs`, do not edit +/* eslint-disable */ + +import type { Bytes, Enum, GenericEthereumAccountId, GenericEthereumLookupSource, Option, Struct, U256, U64, U8aFixed, Vec, bool, u32, u64 } from '@polkadot/types'; +import type { BlockNumber, H160, H2048, H256, H512 } from '@polkadot/types/interfaces/runtime'; + +/** @name EthAccount */ +export interface EthAccount extends Struct { + readonly address: H160; + readonly balance: U256; + readonly nonce: U256; + readonly codeHash: H256; + readonly storageHash: H256; + readonly accountProof: Vec; + readonly storageProof: Vec; +} + +/** @name EthBlock */ +export interface EthBlock extends Struct { + readonly blockHash: Option; + readonly parentHash: H256; + readonly sha3Uncles: H256; + readonly author: H160; + readonly miner: H160; + readonly stateRoot: H256; + readonly transactionsRoot: H256; + readonly receiptsRoot: H256; + readonly number: Option; + readonly gasUsed: U256; + readonly gasLimit: U256; + readonly extraData: Bytes; + readonly logsBloom: H2048; + readonly timestamp: U256; + readonly difficulty: U256; + readonly totalDifficulty: Option; + readonly sealFields: Vec; + readonly uncles: Vec; + readonly transactions: Vec; + readonly blockSize: Option; +} + +/** @name EthBloom */ +export interface EthBloom extends H2048 {} + +/** @name EthCallRequest */ +export interface EthCallRequest extends Struct { + readonly from: Option; + readonly to: Option; + readonly gasPrice: Option; + readonly gas: Option; + readonly value: Option; + readonly data: Option; + readonly nonce: Option; +} + +/** @name EthereumAccountId */ +export interface EthereumAccountId extends GenericEthereumAccountId {} + +/** @name EthereumLookupSource */ +export interface EthereumLookupSource extends GenericEthereumLookupSource {} + +/** @name EthereumSignature */ +export interface EthereumSignature extends U8aFixed {} + +/** @name EthFilter */ +export interface EthFilter extends Struct { + readonly fromBlock: Option; + readonly toBlock: Option; + readonly blockHash: Option; + readonly address: Option; + readonly topics: Option; +} + +/** @name EthFilterAddress */ +export interface EthFilterAddress extends Enum { + readonly isSingle: boolean; + readonly asSingle: H160; + readonly isMultiple: boolean; + readonly asMultiple: Vec; + readonly isNull: boolean; +} + +/** @name EthFilterTopic */ +export interface EthFilterTopic extends Enum { + readonly isSingle: boolean; + readonly asSingle: EthFilterTopicInner; + readonly isMultiple: boolean; + readonly asMultiple: Vec; + readonly isNull: boolean; +} + +/** @name EthFilterTopicEntry */ +export interface EthFilterTopicEntry extends Option {} + +/** @name EthFilterTopicInner */ +export interface EthFilterTopicInner extends Enum { + readonly isSingle: boolean; + readonly asSingle: EthFilterTopicEntry; + readonly isMultiple: boolean; + readonly asMultiple: Vec; + readonly isNull: boolean; +} + +/** @name EthHeader */ +export interface EthHeader extends Struct { + readonly blockHash: Option; + readonly parentHash: H256; + readonly sha3Uncles: H256; + readonly author: H160; + readonly miner: H160; + readonly stateRoot: H256; + readonly transactionsRoot: H256; + readonly receiptsRoot: H256; + readonly number: Option; + readonly gasUsed: U256; + readonly gasLimit: U256; + readonly extraData: Bytes; + readonly logsBloom: H2048; + readonly timestamp: U256; + readonly difficulty: U256; + readonly sealFields: Vec; + readonly blockSize: Option; +} + +/** @name EthLog */ +export interface EthLog extends Struct { + readonly address: H160; + readonly topics: Vec; + readonly data: Bytes; + readonly blockHash: Option; + readonly blockNumber: Option; + readonly transactionHash: Option; + readonly transactionIndex: Option; + readonly logIndex: Option; + readonly transactionLogIndex: Option; + readonly removed: bool; +} + +/** @name EthReceipt */ +export interface EthReceipt extends Struct { + readonly transactionHash: Option; + readonly transactionIndex: Option; + readonly blockHash: Option; + readonly from: Option; + readonly to: Option; + readonly blockNumber: Option; + readonly cumulativeGasUsed: U256; + readonly gasUsed: Option; + readonly contractAddress: Option; + readonly logs: Vec; + readonly root: Option; + readonly logsBloom: H2048; + readonly statusCode: Option; +} + +/** @name EthRichBlock */ +export interface EthRichBlock extends EthBlock {} + +/** @name EthRichHeader */ +export interface EthRichHeader extends EthHeader {} + +/** @name EthStorageProof */ +export interface EthStorageProof extends Struct { + readonly key: U256; + readonly value: U256; + readonly proof: Vec; +} + +/** @name EthSubKind */ +export interface EthSubKind extends Enum { + readonly isNewHeads: boolean; + readonly isLogs: boolean; + readonly isNewPendingTransactions: boolean; + readonly isSyncing: boolean; +} + +/** @name EthSubParams */ +export interface EthSubParams extends Enum { + readonly isNone: boolean; + readonly isLogs: boolean; + readonly asLogs: EthFilter; +} + +/** @name EthSubResult */ +export interface EthSubResult extends Enum { + readonly isHeader: boolean; + readonly asHeader: EthRichHeader; + readonly isLog: boolean; + readonly asLog: EthLog; + readonly isTransactionHash: boolean; + readonly asTransactionHash: H256; + readonly isSyncState: boolean; + readonly asSyncState: EthSyncStatus; +} + +/** @name EthSyncInfo */ +export interface EthSyncInfo extends Struct { + readonly startingBlock: U256; + readonly currentBlock: U256; + readonly highestBlock: U256; + readonly warpChunksAmount: Option; + readonly warpChunksProcessed: Option; +} + +/** @name EthSyncStatus */ +export interface EthSyncStatus extends Enum { + readonly isInfo: boolean; + readonly asInfo: EthSyncInfo; + readonly isNone: boolean; +} + +/** @name EthTransaction */ +export interface EthTransaction extends Struct { + readonly blockHash: Option; + readonly blockNumber: Option; + readonly chainId: Option; + readonly condition: Option; + readonly creates: Option; + readonly from: H160; + readonly gas: U256; + readonly gasPrice: U256; + readonly hash: H256; + readonly input: Bytes; + readonly nonce: U256; + readonly publicKey: Option; + readonly r: U256; + readonly raw: Bytes; + readonly s: U256; + readonly standardV: U256; + readonly to: Option; + readonly transactionIndex: Option; + readonly v: U256; + readonly value: U256; +} + +/** @name EthTransactionCondition */ +export interface EthTransactionCondition extends Enum { + readonly isBlock: boolean; + readonly asBlock: u64; + readonly isTime: boolean; + readonly asTime: u64; +} + +/** @name EthTransactionRequest */ +export interface EthTransactionRequest extends Struct { + readonly from: Option; + readonly to: Option; + readonly gasPrice: Option; + readonly gas: Option; + readonly value: Option; + readonly data: Option; + readonly nonce: Option; +} + +/** @name EthTransactionStatus */ +export interface EthTransactionStatus extends Struct { + readonly transactionHash: H256; + readonly transactionIndex: u32; + readonly from: H160; + readonly to: Option; + readonly contractAddress: Option; + readonly logs: Vec; + readonly logsBloom: EthBloom; +} + +/** @name EthWork */ +export interface EthWork extends Struct { + readonly pow_hash: H256; + readonly seed_hash: H256; + readonly target: H256; + readonly number: Option; +} + +export type PHANTOM_ETH = 'eth'; diff --git a/packages/types/src/interfaces/ethereum/definitions.ts b/packages/types/src/interfaces/ethereum/definitions.ts deleted file mode 100644 index 6ced443030..0000000000 --- a/packages/types/src/interfaces/ethereum/definitions.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2017-2020 @polkadot/types authors & contributors -// SPDX-License-Identifier: Apache-2.0 - -// order important in structs... :) -/* eslint-disable sort-keys */ - -import type { Definitions } from '../../types'; - -export default { - rpc: {}, - types: { - EthereumAccountId: 'GenericEthereumAccountId', - EthereumLookupSource: 'GenericEthereumLookupSource' - } -} as Definitions; diff --git a/packages/types/src/interfaces/ethereum/types.ts b/packages/types/src/interfaces/ethereum/types.ts deleted file mode 100644 index 88712e5d2a..0000000000 --- a/packages/types/src/interfaces/ethereum/types.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Auto-generated via `yarn polkadot-types-from-defs`, do not edit -/* eslint-disable */ - -import type { GenericEthereumAccountId, GenericEthereumLookupSource } from '@polkadot/types'; - -/** @name EthereumAccountId */ -export interface EthereumAccountId extends GenericEthereumAccountId {} - -/** @name EthereumLookupSource */ -export interface EthereumLookupSource extends GenericEthereumLookupSource {} - -export type PHANTOM_ETHEREUM = 'ethereum'; diff --git a/packages/types/src/interfaces/jsonrpc.ts b/packages/types/src/interfaces/jsonrpc.ts index ed4ec5efac..f45b4951c9 100644 --- a/packages/types/src/interfaces/jsonrpc.ts +++ b/packages/types/src/interfaces/jsonrpc.ts @@ -10,13 +10,19 @@ const jsonrpc: Record> = {}; Object .keys(definitions) .filter((key) => Object.keys(definitions[key as 'babe'].rpc || {}).length !== 0) - .forEach((section): void => { - jsonrpc[section] = {}; + .forEach((_section): void => { + jsonrpc[_section] = {}; Object - .entries(definitions[section as 'babe'].rpc) + .entries(definitions[_section as 'babe'].rpc) .forEach(([method, def]): void => { const isSubscription = !!(def as DefinitionRpcSub).pubsub; + const section = def.aliasSection || _section; + + // allow for section overrides + if (!jsonrpc[section]) { + jsonrpc[section] = {}; + } jsonrpc[section][method] = ({ ...def, isSubscription, jsonrpc: `${section}_${method}`, method, section }); }); diff --git a/packages/types/src/interfaces/runtime/definitions.ts b/packages/types/src/interfaces/runtime/definitions.ts index bba6904d6f..c2a5ed0863 100644 --- a/packages/types/src/interfaces/runtime/definitions.ts +++ b/packages/types/src/interfaces/runtime/definitions.ts @@ -61,9 +61,13 @@ export default { normal: 'Weight', operational: 'Weight' }, + H64: '[u8; 8; H64]', + H128: '[u8; 16; H64]', H160: '[u8; 20; H160]', H256: '[u8; 32; H256]', H512: '[u8; 64; H512]', + H1024: '[u8; 128; H1024]', + H2048: '[u8; 256; H2048]', Hash: 'H256', Header: { parentHash: 'Hash', diff --git a/packages/types/src/interfaces/runtime/types.ts b/packages/types/src/interfaces/runtime/types.ts index f9eb40d2df..712a248a20 100644 --- a/packages/types/src/interfaces/runtime/types.ts +++ b/packages/types/src/interfaces/runtime/types.ts @@ -102,15 +102,27 @@ export interface FixedU128 extends UInt {} /** @name FixedU64 */ export interface FixedU64 extends UInt {} +/** @name H1024 */ +export interface H1024 extends U8aFixed {} + +/** @name H128 */ +export interface H128 extends U8aFixed {} + /** @name H160 */ export interface H160 extends U8aFixed {} +/** @name H2048 */ +export interface H2048 extends U8aFixed {} + /** @name H256 */ export interface H256 extends U8aFixed {} /** @name H512 */ export interface H512 extends U8aFixed {} +/** @name H64 */ +export interface H64 extends U8aFixed {} + /** @name Hash */ export interface Hash extends H256 {} diff --git a/packages/types/src/interfaces/types.ts b/packages/types/src/interfaces/types.ts index 0addaad6f5..6ef68a4a0c 100644 --- a/packages/types/src/interfaces/types.ts +++ b/packages/types/src/interfaces/types.ts @@ -40,7 +40,7 @@ export * from './poll/types'; export * from './purchase/types'; export * from './contractsAbi/types'; export * from './scaleInfo/types'; -export * from './ethereum/types'; +export * from './eth/types'; export * from './metadata/types'; export * from './rpc/types'; export * from './author/types'; diff --git a/packages/types/src/types/definitions.ts b/packages/types/src/types/definitions.ts index 9f3e92965a..d2fd77241b 100644 --- a/packages/types/src/types/definitions.ts +++ b/packages/types/src/types/definitions.ts @@ -21,8 +21,10 @@ export interface DefinitionRpcParam { export interface DefinitionRpc { alias?: string[]; + aliasSection?: string; description: string; endpoint?: string; + isSigned?: boolean; params: DefinitionRpcParam[]; type: DefinitionTypeType; }