program = _{ (get){1, } }
get = {
"GET" ~ WHITESPACE* ~ fields* ~ WHITESPACE* ~ "FROM" ~ WHITESPACE* ~ entity ~ WHITESPACE* ~ entity_id ~ WHITESPACE* ~ "ON" ~ WHITESPACE* ~ chain
}
fields = { (account_field_list | block_field_list | tx_field_list) }
entity = { "account" | "block" | "tx" }
entity_id = { hash | account_id | integer }
// Account
account_field_list = _{ account_field ~ (", " ~ account_field)* }
account_field = { "nonce" | "balance" }
account_id = { address | ens }
// Block
block_field_list = _{ block_field ~ (", " ~ block_field_list)* }
block_field = { "number" | "timestamp" | "size" | "hash" | "parent_hash" | "reward" }
// Transaction
tx_field_list = _{ tx_field ~ (", " ~ tx_field)* }
tx_field = { "hash" | "from" | "to" | "data" | "value" | "fee" | "gas_price" | "timestamp" | "status" }
// Terminals
unit = { "ether" | "gwei" | "wei" }
number = { float | integer }
integer = { (ASCII_DIGIT)+ }
float = { integer ~ "." ~ integer }
chain = { "eth" | "arb" | "op" | "base" | "blast" | "polygon" }
address = { "0x" ~ (ASCII_HEX_DIGIT){40} }
hash = { "0x" ~ (ASCII_HEX_DIGIT){64} }
ens = { (ASCII_ALPHANUMERIC)+ ~ ".eth" }
// Helpers
WHITESPACE = _{ " " | "\t" | "\r" | "\n" }