Add Whisper types

This commit is contained in:
coffeepots 2018-08-21 22:21:41 +01:00 committed by zah
parent 3f2f8f83b4
commit 3f3c4249ba
1 changed files with 37 additions and 0 deletions

View File

@ -105,3 +105,40 @@ type
root*: Hash256 # post-transaction stateroot (pre Byzantium).
status*: int # 1 = success, 0 = failure.
FilterDataKind* = enum fkItem, fkList
FilterData* = object
# Difficult to process variant objects in input data, as kind is immutable.
# TODO: This might need more work to handle "or" options
kind*: FilterDataKind
items*: seq[FilterData]
item*: UInt256
FilterOptions* = object
# Parameter from user
fromBlock*: string # (optional, default: "latest") integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions.
toBlock*: string # (optional, default: "latest") integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions.
address*: EthAddress # (optional) contract address or a list of addresses from which logs should originate.
topics*: seq[FilterData] # (optional) list of DATA topics. Topics are order-dependent. Each topic can also be a list of DATA with "or" options.
WhisperPost* = object
# Parameter from user
source*: WhisperIdentityStr # (optional) the identity of the sender.
to*: WhisperIdentityStr # (optional) the identity of the receiver. When present whisper will encrypt the message so that only the receiver can decrypt it.
topics*: seq[HexDataStr] # list of DATA topics, for the receiver to identify messages.
payload*: HexDataStr # the payload of the message.
priority*: int # integer of the priority in a rang from.
ttl*: int # integer of the time to live in seconds.
WhisperIdentity = array[60, byte]
WhisperMessage* = object
# Returned to user
hash*: Hash256 # the hash of the message.
source*: WhisperIdentity # the sender of the message, if a sender was specified.
to*: WhisperIdentity # the receiver of the message, if a receiver was specified.
expiry*: int # integer of the time in seconds when this message should expire.
ttl*: int # integer of the time the message should float in the system in seconds.
sent*: int # integer of the unix timestamp when the message was sent.
topics*: seq[UInt256] # list of DATA topics the message contained.
payload*: Blob # the payload of the message.
workProved*: int # integer of the work this message required before it was send.