eql_core 0.1.10

EVM Query Language core components
Documentation
program = _{SOI ~ (get){1, } ~ silent_eoi}

get       = {
    "GET" ~ WHITESPACE* ~ fields* ~ WHITESPACE* ~ "FROM" ~ WHITESPACE* ~ entity ~ WHITESPACE* ~ entity_id ~ WHITESPACE* ~ "ON" ~ WHITESPACE* ~ chain ~ exp_separator* ~ WHITESPACE*
}
fields    = { (account_field_list | block_field_list | tx_field_list) }
entity    = { "account" | "block" | "tx" }
entity_id = { hash | account_id | block_id }

// Account
account_field_list = _{ account_field ~ (", " ~ account_field)* }
account_field = {
    "nonce" |
    "balance" |
    "code"
}
account_id = { address | ens }

// Block
block_field_list = _{ block_field ~ (", " ~ block_field_list)* }
// TODO: Check if we need uncles
block_field      =  { 
    "hash" |
    "parent_hash" |
    "timestamp" | 
    "state_root" |
    "transactions_root" |
    "receipts_root" |
    "logs_bloom" |
    "extra_data" |
    "mix_hash" |
    "total_difficulty" |
    "base_fee_per_gas" |
    "withdrawals_root" |
    "blob_gas_used" |
    "excess_blob_gas" |
    "parent_beacon_block_root" |
    "parent_beacon_block_root" |
    "size"
}
block_id    = { block_tag ~ ":" ~ block_tag | block_tag }
block_tag = { "latest" | "earliest" | "pending" | "finalized" | "safe" | integer }

// Transaction
tx_field_list = _{ tx_field ~ (", " ~ tx_field)* }
tx_field = {
    "transaction_type" |
    "hash" |
    "from" | 
    "to" | 
    "data" | 
    "value" | 
    "fee" |
    "gas_price" |
    "gas" |
    "status" |
    "chain_id" |
    "v" |
    "r" |
    "s" |

    // EIP-4844
    "max_fee_per_blob_gas" |
    "blob_versioned_hashes" |

    // EIP-1559
    "max_fee_per_gas" |
    "max_priority_fee_per_gas" |

    // EIP-2930
    "access_list" |
    "y_parity"
}

// Terminals
unit = { "ether" | "gwei" | "wei" }
number = { float | integer }
integer = { (ASCII_DIGIT)+ }
float = { integer ~ "." ~ integer }
chain = { "eth" | "arb" | "op" | "base" | "blast" | "polygon" | "sepolia" }
address = { "0x" ~ (ASCII_HEX_DIGIT){40} }
hash = { "0x" ~ (ASCII_HEX_DIGIT){64} }
ens = { (ASCII_ALPHANUMERIC)+ ~ ".eth" }

// Helpers
WHITESPACE = _{ " " | "\t" | NEWLINE }
exp_separator = _{"," | ";"}
silent_eoi = _{ !ANY }