mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-23 01:08:26 +00:00
Converted rpc types to Nimbus types in line with changes to hexstrings
This commit is contained in:
parent
4b03f6d4db
commit
b6a73327c3
@ -4,15 +4,22 @@ import eth_common, hexstrings
|
|||||||
Notes:
|
Notes:
|
||||||
* Some of the types suppose 'null' when there is no appropriate value.
|
* Some of the types suppose 'null' when there is no appropriate value.
|
||||||
To allow for this, currently these values are refs so the JSON transform can convert to `JNull`.
|
To allow for this, currently these values are refs so the JSON transform can convert to `JNull`.
|
||||||
|
* Parameter objects from users must have their data verified so will use EthAddressStr instead of EthAddres, for example
|
||||||
|
* Objects returned to the user can use native Nimbus types, where hexstrings provides converters to hex strings.
|
||||||
|
This is because returned arrays in JSON is
|
||||||
|
a) not an efficient use of space
|
||||||
|
b) not the format the user expects (for example addresses are expected to be hex strings prefixed by "0x")
|
||||||
]#
|
]#
|
||||||
|
|
||||||
type
|
type
|
||||||
SyncState* = object
|
SyncState* = object
|
||||||
startingBlock*: HexDataStr
|
# Returned to user
|
||||||
currentBlock*: HexDataStr
|
startingBlock*: BlockNumber
|
||||||
highestBlock*: HexDataStr
|
currentBlock*: BlockNumber
|
||||||
|
highestBlock*: BlockNumber
|
||||||
|
|
||||||
EthSend* = object
|
EthSend* = object
|
||||||
|
# Parameter from user
|
||||||
source*: EthAddressStr # the address the transaction is send from.
|
source*: EthAddressStr # the address the transaction is send from.
|
||||||
to*: EthAddressStr # (optional when creating new contract) the address the transaction is directed to.
|
to*: EthAddressStr # (optional when creating new contract) the address the transaction is directed to.
|
||||||
gas*: GasInt # (optional, default: 90000) integer of the gas provided for the transaction execution. It will return unused gas.
|
gas*: GasInt # (optional, default: 90000) integer of the gas provided for the transaction execution. It will return unused gas.
|
||||||
@ -22,6 +29,7 @@ type
|
|||||||
nonce*: int # (optional) integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce
|
nonce*: int # (optional) integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce
|
||||||
|
|
||||||
EthCall* = object
|
EthCall* = object
|
||||||
|
# Parameter from user
|
||||||
source*: EthAddressStr # (optional) The address the transaction is send from.
|
source*: EthAddressStr # (optional) The address the transaction is send from.
|
||||||
to*: EthAddressStr # The address the transaction is directed to.
|
to*: EthAddressStr # The address the transaction is directed to.
|
||||||
gas*: GasInt # (optional) Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.
|
gas*: GasInt # (optional) Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.
|
||||||
@ -32,48 +40,51 @@ type
|
|||||||
## A block object, or null when no block was found
|
## A block object, or null when no block was found
|
||||||
## Note that this includes slightly different information from eth_common.BlockHeader
|
## Note that this includes slightly different information from eth_common.BlockHeader
|
||||||
BlockObject* = ref object
|
BlockObject* = ref object
|
||||||
number*: int # the block number. null when its pending block.
|
# Returned to user
|
||||||
hash*: EthHashStr # hash of the block. null when its pending block.
|
number*: ref BlockNumber # the block number. null when its pending block.
|
||||||
parentHash*: EthHashStr # hash of the parent block.
|
hash*: ref Hash256 # hash of the block. null when its pending block.
|
||||||
nonce*: int64 # hash of the generated proof-of-work. null when its pending block.
|
parentHash*: Hash256 # hash of the parent block.
|
||||||
sha3Uncles*: EthHashStr # SHA3 of the uncles data in the block.
|
nonce*: uint64 # hash of the generated proof-of-work. null when its pending block.
|
||||||
logsBloom*: HexDataStr # the bloom filter for the logs of the block. null when its pending block.
|
sha3Uncles*: Hash256 # SHA3 of the uncles data in the block.
|
||||||
transactionsRoot*: EthHashStr # the root of the transaction trie of the block.
|
logsBloom*: ref BloomFilter # the bloom filter for the logs of the block. null when its pending block.
|
||||||
stateRoot*: EthHashStr # the root of the final state trie of the block.
|
transactionsRoot*: Hash256 # the root of the transaction trie of the block.
|
||||||
receiptsRoot*: EthHashStr # the root of the receipts trie of the block.
|
stateRoot*: Hash256 # the root of the final state trie of the block.
|
||||||
miner*: EthAddressStr # the address of the beneficiary to whom the mining rewards were given.
|
receiptsRoot*: Hash256 # the root of the receipts trie of the block.
|
||||||
difficulty*: int # integer of the difficulty for this block.
|
miner*: EthAddress # the address of the beneficiary to whom the mining rewards were given.
|
||||||
totalDifficulty*: int # integer of the total difficulty of the chain until this block.
|
difficulty*: UInt256 # integer of the difficulty for this block.
|
||||||
extraData*: string # the "extra data" field of this block.
|
totalDifficulty*: UInt256 # integer of the total difficulty of the chain until this block.
|
||||||
|
extraData*: Blob # the "extra data" field of this block.
|
||||||
size*: int # integer the size of this block in bytes.
|
size*: int # integer the size of this block in bytes.
|
||||||
gasLimit*: int # the maximum gas allowed in this block.
|
gasLimit*: GasInt # the maximum gas allowed in this block.
|
||||||
gasUsed*: int # the total used gas by all transactions in this block.
|
gasUsed*: GasInt # the total used gas by all transactions in this block.
|
||||||
timestamp*: int # the unix timestamp for when the block was collated.
|
timestamp*: EthTime # the unix timestamp for when the block was collated.
|
||||||
transactions*: seq[EthHashStr] # list of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.
|
transactions*: seq[Transaction] # list of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.
|
||||||
uncles*: seq[EthHashStr] # list of uncle hashes.
|
uncles*: seq[BlockHeader] # list of uncle hashes.
|
||||||
|
|
||||||
TransactionObject* = object # A transaction object, or null when no transaction was found:
|
TransactionObject* = object # A transaction object, or null when no transaction was found:
|
||||||
hash*: EthHashStr # hash of the transaction.
|
# Returned to user
|
||||||
|
hash*: Hash256 # hash of the transaction.
|
||||||
nonce*: int64 # TODO: Is int? the number of transactions made by the sender prior to this one.
|
nonce*: int64 # TODO: Is int? the number of transactions made by the sender prior to this one.
|
||||||
blockHash*: EthHashStr # hash of the block where this transaction was in. null when its pending.
|
blockHash*: ref Hash256 # hash of the block where this transaction was in. null when its pending.
|
||||||
blockNumber*: HexQuantityStr # block number where this transaction was in. null when its pending.
|
blockNumber*: ref BlockNumber # block number where this transaction was in. null when its pending.
|
||||||
transactionIndex*: int64 # integer of the transactions index position in the block. null when its pending.
|
transactionIndex*: ref int64 # integer of the transactions index position in the block. null when its pending.
|
||||||
source*: EthAddressStr # address of the sender.
|
source*: EthAddress # address of the sender.
|
||||||
to*: EthAddressStr # address of the receiver. null when its a contract creation transaction.
|
to*: ref EthAddress # address of the receiver. null when its a contract creation transaction.
|
||||||
value*: int64 # value transferred in Wei.
|
value*: int64 # value transferred in Wei.
|
||||||
gasPrice*: GasInt # gas price provided by the sender in Wei.
|
gasPrice*: GasInt # gas price provided by the sender in Wei.
|
||||||
gas*: GasInt # gas provided by the sender.
|
gas*: GasInt # gas provided by the sender.
|
||||||
input*: HexDataStr # the data send along with the transaction.
|
input*: HexDataStr # the data send along with the transaction.
|
||||||
|
|
||||||
LogObject* = object
|
LogObject* = object
|
||||||
|
# Returned to user
|
||||||
removed*: bool # true when the log was removed, due to a chain reorganization. false if its a valid log.
|
removed*: bool # true when the log was removed, due to a chain reorganization. false if its a valid log.
|
||||||
logIndex*: int # integer of the log index position in the block. null when its pending log.
|
logIndex*: ref int # integer of the log index position in the block. null when its pending log.
|
||||||
transactionIndex*: ref int # integer of the transactions index position log was created from. null when its pending log.
|
transactionIndex*: ref int # integer of the transactions index position log was created from. null when its pending log.
|
||||||
transactionHash*: EthHashStr # hash of the transactions this log was created from. null when its pending log.
|
transactionHash*: ref Hash256 # hash of the transactions this log was created from. null when its pending log.
|
||||||
blockHash*: ref EthHashStr # hash of the block where this log was in. null when its pending. null when its pending log.
|
blockHash*: ref Hash256 # hash of the block where this log was in. null when its pending. null when its pending log.
|
||||||
blockNumber*: ref HexDataStr # the block number where this log was in. null when its pending. null when its pending log.
|
blockNumber*: ref BlockNumber # the block number where this log was in. null when its pending. null when its pending log.
|
||||||
address*: EthAddressStr # address from which this log originated.
|
address*: EthAddress # address from which this log originated.
|
||||||
data*: seq[EthHashStr] # contains one or more 32 Bytes non-indexed arguments of the log.
|
data*: seq[Hash256] # contains one or more 32 Bytes non-indexed arguments of the log.
|
||||||
topics*: array[4, EthHashStr] # array of 0 to 4 32 Bytes DATA of indexed log arguments.
|
topics*: array[4, Hash256] # array of 0 to 4 32 Bytes DATA of indexed log arguments.
|
||||||
# (In solidity: The first topic is the hash of the signature of the event.
|
# (In solidity: The first topic is the hash of the signature of the event.
|
||||||
# (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)
|
# (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user