diff --git a/packages/types/src/augment/registry.ts b/packages/types/src/augment/registry.ts index 1f3fe5a70c..81c9edbbde 100644 --- a/packages/types/src/augment/registry.ts +++ b/packages/types/src/augment/registry.ts @@ -21,7 +21,7 @@ import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot 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 { EthAccount, EthBlock, EthBloom, EthCallRequest, EthFilter, EthFilterAddress, EthFilterChanges, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionAction, EthTransactionCondition, EthTransactionRequest, EthTransactionStatus, EthWork, EthereumAccountId, EthereumLookupSource, EthereumSignature } from '@polkadot/types/interfaces/eth'; +import type { EthAccount, EthBlock, EthBloom, EthCallRequest, EthFilter, EthFilterAddress, EthFilterChanges, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionAction, EthTransactionCondition, EthTransactionRequest, EthTransactionSignature, EthTransactionStatus, EthWork, EthereumAccountId, EthereumLookupSource, EthereumSignature } from '@polkadot/types/interfaces/eth'; import type { EvmAccount, EvmLog, EvmVicinity, ExitError, ExitFatal, ExitReason, ExitRevert, ExitSucceed } 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'; @@ -41,7 +41,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, CodecHash, Consensus, ConsensusEngineId, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H512, H64, Hash, Header, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, StorageData, StorageProof, TransactionPriority, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime'; +import type { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, CallHash, CallHashOf, ChangesTrieConfiguration, CodecHash, Consensus, ConsensusEngineId, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H32, H512, H64, Hash, Header, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, StorageData, StorageProof, TransactionPriority, U32F32, ValidatorId, ValidatorIdOf, 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 { 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'; @@ -385,6 +385,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -457,6 +458,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -1177,6 +1179,7 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -1249,6 +1252,7 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -1969,6 +1973,7 @@ declare module '@polkadot/types/types/registry' { EthTransactionAction: EthTransactionAction; EthTransactionCondition: EthTransactionCondition; EthTransactionRequest: EthTransactionRequest; + EthTransactionSignature: EthTransactionSignature; EthTransactionStatus: EthTransactionStatus; EthWork: EthWork; Event: Event; @@ -2041,6 +2046,7 @@ declare module '@polkadot/types/types/registry' { H160: H160; H2048: H2048; H256: H256; + H32: H32; H512: H512; H64: H64; Hash: Hash; diff --git a/packages/types/src/interfaces/eth/definitions.ts b/packages/types/src/interfaces/eth/definitions.ts index 6d3ed68592..b1a69cdac8 100644 --- a/packages/types/src/interfaces/eth/definitions.ts +++ b/packages/types/src/interfaces/eth/definitions.ts @@ -24,6 +24,28 @@ const types: DefinitionsTypes = { storageProof: 'Vec' }, EthBlock: { + header: 'EthHeader', + transactions: 'Vec', + ommers: 'Vec' + }, + EthHeader: { + parentHash: 'H256', + ommersHash: 'H256', + beneficiary: 'H160', + stateRoot: 'H256', + transactionsRoot: 'H256', + receiptsRoot: 'H256', + logsBloom: 'EthBloom', + difficulty: 'U256', + number: 'U256', + gasLimit: 'U256', + gasUsed: 'U256', + timestamp: 'u64', + extraData: 'Bytes', + mixMash: 'H256', + nonce: 'H64' + }, + EthRichBlock: { _alias: { blockHash: 'hash', blockSize: 'size' @@ -40,7 +62,7 @@ const types: DefinitionsTypes = { gasUsed: 'U256', gasLimit: 'U256', extraData: 'Bytes', - logsBloom: 'H2048', + logsBloom: 'EthBloom', timestamp: 'U256', difficulty: 'U256', totalDifficulty: 'Option', @@ -95,7 +117,7 @@ const types: DefinitionsTypes = { Null: 'Null' } }, - EthHeader: { + EthRichHeader: { _alias: { blockHash: 'hash', blockSize: 'size' @@ -112,7 +134,7 @@ const types: DefinitionsTypes = { gasUsed: 'U256', gasLimit: 'U256', extraData: 'Bytes', - logsBloom: 'H2048', + logsBloom: 'EthBloom', timestamp: 'U256', difficulty: 'U256', sealFields: 'Vec', @@ -142,11 +164,9 @@ const types: DefinitionsTypes = { contractAddress: 'Option', logs: 'Vec', root: 'Option', - logsBloom: 'H2048', + logsBloom: 'EthBloom', statusCode: 'Option' }, - EthRichBlock: 'EthBlock', - EthRichHeader: 'EthHeader', EthStorageProof: { key: 'U256', value: 'U256', @@ -189,35 +209,13 @@ const types: DefinitionsTypes = { action: 'EthTransactionAction', value: 'U256', input: 'Bytes', - // TransactionSignature (embedded) + signature: 'EthTransactionSignature' + }, + EthTransactionSignature: { v: 'u64', r: 'H256', s: 'H256' }, - // as per the RPC definition - // TODO: Check these, re-add - // EthTransaction: { - // // hash in Rust - // transactionHash: 'H256', - // nonce: 'U256', - // blockHash: 'Option', - // blockNumber: 'Option', - // transactionIndex: 'Option', - // from: 'H160', - // to: 'Option', - // value: 'U256', - // gasPrice: 'U256', - // gas: 'U256', - // input: 'Bytes', - // creates: 'Option', - // raw: 'Bytes', - // publicKey: 'Option', - // chainId: 'Option', - // standardV: 'U256', - // v: 'U256', - // r: 'U256', - // s: 'U256' - // }, EthTransactionAction: { _enum: { Call: 'H160', diff --git a/packages/types/src/interfaces/eth/types.ts b/packages/types/src/interfaces/eth/types.ts index b3c3167de6..e5c43006e2 100644 --- a/packages/types/src/interfaces/eth/types.ts +++ b/packages/types/src/interfaces/eth/types.ts @@ -2,7 +2,7 @@ /* 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 } from '@polkadot/types/interfaces/runtime'; +import type { BlockNumber, H160, H2048, H256, H64 } from '@polkadot/types/interfaces/runtime'; /** @name EthAccount */ export interface EthAccount extends Struct { @@ -17,26 +17,9 @@ export interface EthAccount extends Struct { /** @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 header: EthHeader; readonly transactions: Vec; - readonly blockSize: Option; + readonly ommers: Vec; } /** @name EthBloom */ @@ -112,23 +95,21 @@ export interface EthFilterTopicInner extends Enum { /** @name EthHeader */ export interface EthHeader extends Struct { - readonly blockHash: Option; readonly parentHash: H256; - readonly sha3Uncles: H256; - readonly author: H160; - readonly miner: H160; + readonly ommersHash: H256; + readonly beneficiary: 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 logsBloom: EthBloom; readonly difficulty: U256; - readonly sealFields: Vec; - readonly blockSize: Option; + readonly number: U256; + readonly gasLimit: U256; + readonly gasUsed: U256; + readonly timestamp: u64; + readonly extraData: Bytes; + readonly mixMash: H256; + readonly nonce: H64; } /** @name EthLog */ @@ -158,15 +139,54 @@ export interface EthReceipt extends Struct { readonly contractAddress: Option; readonly logs: Vec; readonly root: Option; - readonly logsBloom: H2048; + readonly logsBloom: EthBloom; readonly statusCode: Option; } /** @name EthRichBlock */ -export interface EthRichBlock extends EthBlock {} +export interface EthRichBlock 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: EthBloom; + readonly timestamp: U256; + readonly difficulty: U256; + readonly totalDifficulty: Option; + readonly sealFields: Vec; + readonly uncles: Vec; + readonly transactions: Vec; + readonly blockSize: Option; +} /** @name EthRichHeader */ -export interface EthRichHeader extends EthHeader {} +export interface EthRichHeader 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: EthBloom; + readonly timestamp: U256; + readonly difficulty: U256; + readonly sealFields: Vec; + readonly blockSize: Option; +} /** @name EthStorageProof */ export interface EthStorageProof extends Struct { @@ -226,9 +246,7 @@ export interface EthTransaction extends Struct { readonly action: EthTransactionAction; readonly value: U256; readonly input: Bytes; - readonly v: u64; - readonly r: H256; - readonly s: H256; + readonly signature: EthTransactionSignature; } /** @name EthTransactionAction */ @@ -257,6 +275,13 @@ export interface EthTransactionRequest extends Struct { readonly nonce: Option; } +/** @name EthTransactionSignature */ +export interface EthTransactionSignature extends Struct { + readonly v: u64; + readonly r: H256; + readonly s: H256; +} + /** @name EthTransactionStatus */ export interface EthTransactionStatus extends Struct { readonly transactionHash: H256; diff --git a/packages/types/src/interfaces/runtime/definitions.ts b/packages/types/src/interfaces/runtime/definitions.ts index 91db90009a..7518f90e83 100644 --- a/packages/types/src/interfaces/runtime/definitions.ts +++ b/packages/types/src/interfaces/runtime/definitions.ts @@ -62,8 +62,9 @@ export default { normal: 'Weight', operational: 'Weight' }, + H32: '[u8; 8; H32]', H64: '[u8; 8; H64]', - H128: '[u8; 16; H64]', + H128: '[u8; 16; H128]', H160: '[u8; 20; H160]', H256: '[u8; 32; H256]', H512: '[u8; 64; H512]', diff --git a/packages/types/src/interfaces/runtime/types.ts b/packages/types/src/interfaces/runtime/types.ts index fb570d0429..112434b28e 100644 --- a/packages/types/src/interfaces/runtime/types.ts +++ b/packages/types/src/interfaces/runtime/types.ts @@ -123,6 +123,9 @@ export interface H2048 extends U8aFixed {} /** @name H256 */ export interface H256 extends U8aFixed {} +/** @name H32 */ +export interface H32 extends U8aFixed {} + /** @name H512 */ export interface H512 extends U8aFixed {}