From 1c00cb4c4ec0801500c0e080ca32ec2ee53b76ba Mon Sep 17 00:00:00 2001 From: Jaco Date: Wed, 5 May 2021 22:35:28 +0300 Subject: [PATCH] Align RPCs with Substrate master (#3493) * Align RPCs with Substrate master * Build interfaces, apply fixes * Metadata v13 changes --- CHANGELOG.md | 8 ++- packages/api/src/augment/rpc.ts | 16 +++++- packages/types/src/augment/registry.ts | 37 +++++++++++++- .../src/interfaces/contracts/definitions.ts | 45 +++++++++++++++++ .../types/src/interfaces/contracts/types.ts | 37 ++++++++++++++ .../types/src/interfaces/state/definitions.ts | 50 +++++++++++++++++++ packages/types/src/interfaces/state/types.ts | 46 ++++++++++++++++- .../src/interfaces/system/definitions.ts | 5 ++ 8 files changed, 237 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84f7fc0080..f883532352 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,8 @@ Upgrade priority: Medium. Required for the next v0.9.0 Polkadot/Kusama chains -- **Breaking change** The previously deprecated contracts interfaces (marked as deprecated, should have been dropped with the 4.0 release), has been removed. Update to `.query.*`, `.tx.*` and `.tx.*` interfaces. +- **Breaking change** The previously deprecated contracts interfaces, has been removed. Update to `.query.*`, `.tx.*` and `.tx.*` interfaces as per the previous code usage hints. +- **Important** By default the `isPedantic` mode is now switched on for storage queries. This means that the API will fail on any types where the input/output decoding doesn't match 100% Changes: @@ -16,9 +17,12 @@ Changes: - Adjust `ContractInfo` type as per latest Substrate - Adjust `DigestItem` type as per latest Substrate - Adjust re-encoding of `BitVec` based on decoded length +- Added `contracts_instantiate`, `state_traceBlock` & `system_reservedPeers` RPCs - Prepare for auto-capability detection with historic `.at` queries -- Add known upgrade block for Westend 900 +- Add known upgrade block for Westend 900 & 9000 - Remove all deprecated interfaces inside `@polkadot/api-contracts` +- Initial support for NMap storage keys +- Support metadata v13 from Substrate (upcoming upgrade) ## 4.8.1 May 2, 2021 diff --git a/packages/api/src/augment/rpc.ts b/packages/api/src/augment/rpc.ts index fb4b8339ca..e57bfd2f47 100644 --- a/packages/api/src/augment/rpc.ts +++ b/packages/api/src/augment/rpc.ts @@ -10,7 +10,7 @@ import type { BeefySignedCommitment } from '@polkadot/types/interfaces/beefy'; import type { BlockHash } from '@polkadot/types/interfaces/chain'; 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 { ContractCallRequest, ContractExecResult, ContractInstantiateResult, InstantiateRequest } from '@polkadot/types/interfaces/contracts'; import type { CreatedBlock } from '@polkadot/types/interfaces/engine'; import type { EthAccount, EthCallRequest, EthFilter, EthFilterChanges, EthLog, EthReceipt, EthRichBlock, EthSubKind, EthSubParams, EthSyncStatus, EthTransaction, EthTransactionRequest, EthWork } from '@polkadot/types/interfaces/eth'; import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics'; @@ -20,7 +20,7 @@ import type { StorageKind } from '@polkadot/types/interfaces/offchain'; import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment'; import type { RpcMethods } from '@polkadot/types/interfaces/rpc'; 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 { ReadProof, RuntimeVersion, TraceBlockResponse } from '@polkadot/types/interfaces/state'; import type { ApplyExtrinsicResult, ChainProperties, ChainType, Health, NetworkState, NodeRole, PeerInfo, SyncState } from '@polkadot/types/interfaces/system'; declare module '@polkadot/rpc-core/types.jsonrpc' { @@ -128,6 +128,10 @@ declare module '@polkadot/rpc-core/types.jsonrpc' { * Returns the value under a specified storage key in a contract **/ getStorage: AugmentedRpc<(address: AccountId | string | Uint8Array, key: H256 | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable>>; + /** + * Instantiate a new contract + **/ + instantiate: AugmentedRpc<(request: InstantiateRequest | { origin?: any; endowment?: any; gasLimit?: any; code?: any; data?: any; salt?: any } | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable>; /** * Returns the projected time a given contract will be able to sustain paying its rent **/ @@ -442,6 +446,10 @@ declare module '@polkadot/rpc-core/types.jsonrpc' { * Subscribes to storage changes for the provided keys **/ subscribeStorage: AugmentedRpc<(keys?: Vec | (StorageKey | string | Uint8Array | any)[]) => Observable>; + /** + * Provides a way to trace the re-execution of a single block + **/ + traceBlock: AugmentedRpc<(block: Hash | string | Uint8Array, targets: Option | null | object | string | Uint8Array, storageKeys: Option | null | object | string | Uint8Array) => Observable>; }; syncstate: { /** @@ -510,6 +518,10 @@ declare module '@polkadot/rpc-core/types.jsonrpc' { * Remove a reserved peer **/ removeReservedPeer: AugmentedRpc<(peerId: Text | string) => Observable>; + /** + * Returns the list of reserved peers + **/ + reservedPeers: AugmentedRpc<() => Observable>>; /** * Resets the log filter to Substrate defaults **/ diff --git a/packages/types/src/augment/registry.ts b/packages/types/src/augment/registry.ts index fea9b227ef..edaae41ea5 100644 --- a/packages/types/src/augment/registry.ts +++ b/packages/types/src/augment/registry.ts @@ -15,7 +15,7 @@ import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate'; import type { EthereumAddress, StatementKind } from '@polkadot/types/interfaces/claims'; import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective'; import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus'; -import type { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractInfo, ContractStorageKey, DeletedContract, Gas, HostFnWeights, HostFnWeightsTo264, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts'; +import type { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractInfo, ContractInstantiateResult, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateReturnValue, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts'; import type { ContractConstructorSpec, ContractContractSpec, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpec, ContractEventSpec, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpec, ContractMessageSpec, ContractProject, ContractProjectContract, ContractProjectSource, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi'; import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot/types/interfaces/crowdloan'; 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'; @@ -47,7 +47,7 @@ import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, Sch import type { BeefyKey, FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys10, SessionKeys10B, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys6B, SessionKeys7, SessionKeys7B, SessionKeys8, SessionKeys8B, SessionKeys9, SessionKeys9B, ValidatorCount } from '@polkadot/types/interfaces/session'; import type { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society'; import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactScore, CompactScoreCompact, ElectionCompute, ElectionPhase, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, ExtendedBalance, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RawSolution, ReadySolution, RewardDestination, RewardPoint, RoundSnapshot, SeatHolder, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SolutionOrSnapshotSize, SolutionSupport, SolutionSupports, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, VoteWeight, Voter } from '@polkadot/types/interfaces/staking'; -import type { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state'; +import type { ApiId, BlockTrace, BlockTraceEvent, BlockTraceEventData, BlockTraceSpan, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet, TraceBlockResponse, TraceError } from '@polkadot/types/interfaces/state'; import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support'; import type { AccountInfo, AccountInfoWithDualRefCount, AccountInfoWithProviders, AccountInfoWithRefCount, AccountInfoWithTripleRefCount, ApplyExtrinsicResult, BlockLength, BlockWeights, ChainProperties, ChainType, ConsumedWeight, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, PerDispatchClassU32, PerDispatchClassWeight, PerDispatchClassWeightsPerClass, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TokenError, TransactionValidityError, UnknownTransaction, WeightPerClass } from '@polkadot/types/interfaces/system'; import type { Bounty, BountyIndex, BountyStatus, BountyStatusActive, BountyStatusCuratorProposed, BountyStatusPendingPayout, OpenTip, OpenTipFinderTo225, OpenTipTip, OpenTipTo225, TreasuryProposal } from '@polkadot/types/interfaces/treasury'; @@ -225,6 +225,10 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; + 'Option': Option; + 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -285,6 +289,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -404,6 +409,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -512,6 +518,8 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -725,6 +733,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -861,6 +870,8 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -1043,6 +1054,10 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; + 'Vec': Vec; + 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -1103,6 +1118,7 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -1222,6 +1238,7 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -1330,6 +1347,8 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -1543,6 +1562,7 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -1679,6 +1699,8 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -1861,6 +1883,10 @@ declare module '@polkadot/types/types/registry' { BlockHash: BlockHash; BlockLength: BlockLength; BlockNumber: BlockNumber; + BlockTrace: BlockTrace; + BlockTraceEvent: BlockTraceEvent; + BlockTraceEventData: BlockTraceEventData; + BlockTraceSpan: BlockTraceSpan; BlockWeights: BlockWeights; BodyId: BodyId; BodyPart: BodyPart; @@ -1921,6 +1947,7 @@ declare module '@polkadot/types/types/registry' { ContractExecResultTo255: ContractExecResultTo255; ContractExecResultTo260: ContractExecResultTo260; ContractInfo: ContractInfo; + ContractInstantiateResult: ContractInstantiateResult; ContractLayoutArray: ContractLayoutArray; ContractLayoutCell: ContractLayoutCell; ContractLayoutEnum: ContractLayoutEnum; @@ -2040,6 +2067,7 @@ declare module '@polkadot/types/types/registry' { EvmAccount: EvmAccount; EvmLog: EvmLog; EvmVicinity: EvmVicinity; + ExecReturnValue: ExecReturnValue; ExitError: ExitError; ExitFatal: ExitFatal; ExitReason: ExitReason; @@ -2148,6 +2176,8 @@ declare module '@polkadot/types/types/registry' { Index: Index; IndicesLookupSource: IndicesLookupSource; IndividualExposure: IndividualExposure; + InstantiateRequest: InstantiateRequest; + InstantiateReturnValue: InstantiateReturnValue; InstructionWeights: InstructionWeights; InvalidDisputeStatementKind: InvalidDisputeStatementKind; InvalidTransaction: InvalidTransaction; @@ -2361,6 +2391,7 @@ declare module '@polkadot/types/types/registry' { Releases: Releases; Remark: Remark; Renouncing: Renouncing; + RentProjection: RentProjection; ReportedRoundStates: ReportedRoundStates; Reporter: Reporter; ReportIdOf: ReportIdOf; @@ -2497,6 +2528,8 @@ declare module '@polkadot/types/types/registry' { Timepoint: Timepoint; TokenError: TokenError; TombstoneContractInfo: TombstoneContractInfo; + TraceBlockResponse: TraceBlockResponse; + TraceError: TraceError; TransactionPriority: TransactionPriority; TransactionValidityError: TransactionValidityError; TransientValidationData: TransientValidationData; diff --git a/packages/types/src/interfaces/contracts/definitions.ts b/packages/types/src/interfaces/contracts/definitions.ts index e312ec6709..23513969e5 100644 --- a/packages/types/src/interfaces/contracts/definitions.ts +++ b/packages/types/src/interfaces/contracts/definitions.ts @@ -24,6 +24,22 @@ export default { ], type: 'ContractExecResult' }, + instantiate: { + description: 'Instantiate a new contract', + params: [ + { + name: 'request', + type: 'InstantiateRequest' + }, + { + name: 'at', + type: 'BlockHash', + isHstoric: true, + isOptional: true + } + ], + type: 'ContractInstantiateResult' + }, getStorage: { description: 'Returns the value under a specified storage key in a contract', params: [ @@ -141,6 +157,10 @@ export default { pairCount: 'u32', trieId: 'TrieId' }, + ExecReturnValue: { + flags: 'u32', + data: 'Bytes' + }, Gas: 'u64', HostFnWeightsTo264: { caller: 'Weight', @@ -243,6 +263,25 @@ export default { hashBlake2128PerByte: 'Weight', rentParams: 'Weight' }, + InstantiateRequest: { + origin: 'AccountId', + endowment: 'Balance', + gasLimit: 'Gas', + code: 'Bytes', + data: 'Bytes', + salt: 'Bytes' + }, + ContractInstantiateResult: { + _enum: { + Ok: 'InstantiateReturnValue', + Err: 'Null' + } + }, + InstantiateReturnValue: { + result: 'ExecReturnValue', + accountId: 'AccountId', + rentProjection: 'Option' + }, InstructionWeights: { i64const: 'u32', i64load: 'u32', @@ -326,6 +365,12 @@ export default { code: 'Bytes', originalCodeLen: 'u32' }, + RentProjection: { + _enum: { + EvictionAt: 'BlockNumber', + NoEviction: 'Null' + } + }, ScheduleTo212: { version: 'u32', putCodePerByteCost: 'Gas', diff --git a/packages/types/src/interfaces/contracts/types.ts b/packages/types/src/interfaces/contracts/types.ts index 6fff35cf75..6f8b080887 100644 --- a/packages/types/src/interfaces/contracts/types.ts +++ b/packages/types/src/interfaces/contracts/types.ts @@ -102,6 +102,13 @@ export interface ContractInfo extends Enum { readonly asTombstone: TombstoneContractInfo; } +/** @name ContractInstantiateResult */ +export interface ContractInstantiateResult extends Enum { + readonly isOk: boolean; + readonly asOk: InstantiateReturnValue; + readonly isErr: boolean; +} + /** @name ContractStorageKey */ export interface ContractStorageKey extends U8aFixed {} @@ -111,6 +118,12 @@ export interface DeletedContract extends Struct { readonly trieId: TrieId; } +/** @name ExecReturnValue */ +export interface ExecReturnValue extends Struct { + readonly flags: u32; + readonly data: Bytes; +} + /** @name Gas */ export interface Gas extends u64 {} @@ -219,6 +232,23 @@ export interface HostFnWeightsTo264 extends Struct { readonly hashBlake2128PerByte: Weight; } +/** @name InstantiateRequest */ +export interface InstantiateRequest extends Struct { + readonly origin: AccountId; + readonly endowment: Balance; + readonly gasLimit: Gas; + readonly code: Bytes; + readonly data: Bytes; + readonly salt: Bytes; +} + +/** @name InstantiateReturnValue */ +export interface InstantiateReturnValue extends Struct { + readonly result: ExecReturnValue; + readonly accountId: AccountId; + readonly rentProjection: Option; +} + /** @name InstructionWeights */ export interface InstructionWeights extends Struct { readonly i64const: u32; @@ -310,6 +340,13 @@ export interface PrefabWasmModule extends Struct { readonly originalCodeLen: u32; } +/** @name RentProjection */ +export interface RentProjection extends Enum { + readonly isEvictionAt: boolean; + readonly asEvictionAt: BlockNumber; + readonly isNoEviction: boolean; +} + /** @name Schedule */ export interface Schedule extends Struct { readonly version: u32; diff --git a/packages/types/src/interfaces/state/definitions.ts b/packages/types/src/interfaces/state/definitions.ts index 388716875b..f86dab7db7 100644 --- a/packages/types/src/interfaces/state/definitions.ts +++ b/packages/types/src/interfaces/state/definitions.ts @@ -352,10 +352,51 @@ export default { 'unsubscribeStorage' ], type: 'StorageChangeSet' + }, + traceBlock: { + description: 'Provides a way to trace the re-execution of a single block', + params: [ + { + name: 'block', + type: 'Hash' + }, + { + name: 'targets', + type: 'Option' + }, + { + name: 'storageKeys', + type: 'Option' + } + ], + type: 'TraceBlockResponse' } }, types: { ApiId: '[u8; 8]', + BlockTrace: { + blockHash: 'Text', + parentHash: 'Text', + tracingTargets: 'Text', + storageKeys: 'Text', + spans: 'Vec', + events: 'Vec' + }, + BlockTraceEvent: { + target: 'Text', + data: 'BlockTraceEventData', + parentId: 'Option' + }, + BlockTraceEventData: { + stringValues: 'HashMap' + }, + BlockTraceSpan: { + id: 'u64', + parentId: 'Option', + name: 'Text', + target: 'Text', + wasm: 'bool' + }, KeyValueOption: '(StorageKey, Option)', ReadProof: { at: 'Hash', @@ -374,6 +415,15 @@ export default { StorageChangeSet: { block: 'Hash', changes: 'Vec' + }, + TraceBlockResponse: { + _enum: { + TraceError: 'TraceError', + BlockTrace: 'BlockTrace' + } + }, + TraceError: { + error: 'Text' } } } as Definitions; diff --git a/packages/types/src/interfaces/state/types.ts b/packages/types/src/interfaces/state/types.ts index fdc611a2dd..538c063e81 100644 --- a/packages/types/src/interfaces/state/types.ts +++ b/packages/types/src/interfaces/state/types.ts @@ -1,13 +1,44 @@ // Auto-generated via `yarn polkadot-types-from-defs`, do not edit /* eslint-disable */ -import type { Bytes, Option, StorageKey, Struct, Text, U8aFixed, Vec, u32 } from '@polkadot/types'; +import type { Bytes, Enum, HashMap, Option, StorageKey, Struct, Text, U8aFixed, Vec, bool, u32, u64 } from '@polkadot/types'; import type { ITuple } from '@polkadot/types/types'; import type { Hash, StorageData } from '@polkadot/types/interfaces/runtime'; /** @name ApiId */ export interface ApiId extends U8aFixed {} +/** @name BlockTrace */ +export interface BlockTrace extends Struct { + readonly blockHash: Text; + readonly parentHash: Text; + readonly tracingTargets: Text; + readonly storageKeys: Text; + readonly spans: Vec; + readonly events: Vec; +} + +/** @name BlockTraceEvent */ +export interface BlockTraceEvent extends Struct { + readonly target: Text; + readonly data: BlockTraceEventData; + readonly parentId: Option; +} + +/** @name BlockTraceEventData */ +export interface BlockTraceEventData extends Struct { + readonly stringValues: HashMap; +} + +/** @name BlockTraceSpan */ +export interface BlockTraceSpan extends Struct { + readonly id: u64; + readonly parentId: Option; + readonly name: Text; + readonly target: Text; + readonly wasm: bool; +} + /** @name KeyValueOption */ export interface KeyValueOption extends ITuple<[StorageKey, Option]> {} @@ -37,4 +68,17 @@ export interface StorageChangeSet extends Struct { readonly changes: Vec; } +/** @name TraceBlockResponse */ +export interface TraceBlockResponse extends Enum { + readonly isTraceError: boolean; + readonly asTraceError: TraceError; + readonly isBlockTrace: boolean; + readonly asBlockTrace: BlockTrace; +} + +/** @name TraceError */ +export interface TraceError extends Struct { + readonly error: Text; +} + export type PHANTOM_STATE = 'state'; diff --git a/packages/types/src/interfaces/system/definitions.ts b/packages/types/src/interfaces/system/definitions.ts index 90879398b0..74ae19f2c5 100644 --- a/packages/types/src/interfaces/system/definitions.ts +++ b/packages/types/src/interfaces/system/definitions.ts @@ -107,6 +107,11 @@ export default { ], type: 'Text' }, + reservedPeers: { + description: 'Returns the list of reserved peers', + params: [], + type: 'Vec' + }, nodeRoles: { description: 'Returns the roles the node is running as', params: [],