'timestamp': to_integer_if_hex, 'hash': apply_formatter_if(is_not_null, to_hexbytes(32)), 'logsBloom': to_hexbytes(256), 'miner': apply_formatter_if(is_not_null, to_checksum_address), 'mixHash': to_hexbytes(32), 'nonce': apply_formatter_if(is_not_null, to_hexbytes(8, variable_length=True)), 'number': apply_formatter_if(is_not_null, to_integer_if_hex), 'parentHash': apply_formatter_if(is_not_null, to_hexbytes(32)), 'sha3Uncles': apply_formatter_if(is_not_null, to_hexbytes(32)), 'uncles': apply_formatter_to_array(to_hexbytes(32)), 'difficulty': to_integer_if_hex, 'receiptsRoot': to_hexbytes(32), 'stateRoot': to_hexbytes(32), 'totalDifficulty': to_integer_if_hex, 'transactions': apply_one_of_formatters(( (apply_formatter_to_array(transaction_formatter), is_array_of_dicts), (apply_formatter_to_array(to_hexbytes(32)), is_array_of_strings), )), 'transactionsRoot': to_hexbytes(32), } block_formatter = apply_formatters_to_dict(BLOCK_FORMATTERS) SYNCING_FORMATTERS = { 'startingBlock': to_integer_if_hex, 'currentBlock': to_integer_if_hex, 'highestBlock': to_integer_if_hex, 'knownStates': to_integer_if_hex, 'pulledStates': to_integer_if_hex, }
apply_formatter_if(is_not_null, to_hexbytes(32)), 'sha3Uncles': apply_formatter_if(is_not_null, to_hexbytes(32)), 'uncles': apply_formatter_to_array(to_hexbytes(32)), 'difficulty': to_integer_if_hex, 'receiptsRoot': to_hexbytes(32), 'stateRoot': to_hexbytes(32), 'totalDifficulty': to_integer_if_hex, 'transactions': apply_one_of_formatters(( (apply_formatter_to_array(transaction_formatter), is_array_of_dicts), (apply_formatter_to_array(to_hexbytes(32)), is_array_of_strings), )), 'transactionsRoot': to_hexbytes(32), } block_formatter = apply_formatters_to_dict(BLOCK_FORMATTERS) SYNCING_FORMATTERS = { 'startingBlock': to_integer_if_hex, 'currentBlock': to_integer_if_hex, 'highestBlock': to_integer_if_hex, 'knownStates': to_integer_if_hex, 'pulledStates': to_integer_if_hex, }
} receipt_formatter = apply_formatters_to_dict(RECEIPT_FORMATTERS) BLOCK_FORMATTERS = { 'gasLimit': to_integer_if_hex, 'gasUsed': to_integer_if_hex, 'size': to_integer_if_hex, 'timestamp': to_integer_if_hex, 'hash': to_ascii_if_bytes, 'number': apply_formatter_if(to_integer_if_hex, is_not_null), 'difficulty': to_integer_if_hex, 'totalDifficulty': to_integer_if_hex, 'transactions': apply_one_of_formatters(( (apply_formatter_to_array(transaction_formatter), is_array_of_dicts), (apply_formatter_to_array(to_ascii_if_bytes), is_array_of_strings), )), } block_formatter = apply_formatters_to_dict(BLOCK_FORMATTERS) SYNCING_FORMATTERS = { 'startingBlock': to_integer_if_hex, 'currentBlock': to_integer_if_hex, 'highestBlock': to_integer_if_hex, 'knownStates': to_integer_if_hex, 'pulledStates': to_integer_if_hex, }