return is_string(value) and is_hex(value) to_integer_if_hex = apply_formatter_if(is_hexstr, hex_to_integer) is_not_named_block = complement(is_named_block) TRANSACTION_KEY_MAPPINGS = { 'block_hash': 'blockHash', 'block_number': 'blockNumber', 'gas_price': 'gasPrice', 'transaction_hash': 'transactionHash', 'transaction_index': 'transactionIndex', } transaction_key_remapper = apply_key_map(TRANSACTION_KEY_MAPPINGS) LOG_KEY_MAPPINGS = { 'log_index': 'logIndex', 'transaction_index': 'transactionIndex', 'transaction_hash': 'transactionHash', 'block_hash': 'blockHash', 'block_number': 'blockNumber', } log_key_remapper = apply_key_map(LOG_KEY_MAPPINGS) RECEIPT_KEY_MAPPINGS = { 'block_hash': 'blockHash', 'block_number': 'blockNumber', 'contract_address': 'contractAddress',
to_integer_if_hex = apply_formatter_if(is_hexstr, hex_to_integer) is_not_named_block = complement(is_named_block) # --- Request Mapping --- # TRANSACTION_REQUEST_KEY_MAPPING = { 'gasPrice': 'gas_price', 'maxFeePerGas': 'max_fee_per_gas', 'maxPriorityFeePerGas': 'max_priority_fee_per_gas', 'accessList': 'access_list', } transaction_request_remapper = apply_key_map(TRANSACTION_REQUEST_KEY_MAPPING) TRANSACTION_REQUEST_FORMATTERS = { 'gas': to_integer_if_hex, 'gasPrice': to_integer_if_hex, 'value': to_integer_if_hex, 'nonce': to_integer_if_hex, 'maxFeePerGas': to_integer_if_hex, 'maxPriorityFeePerGas': to_integer_if_hex, 'accessList': apply_formatter_to_array( apply_key_map({'storageKeys': 'storage_keys'}) ), } transaction_request_formatter = apply_formatters_to_dict(TRANSACTION_REQUEST_FORMATTERS)
to_integer_if_hex = apply_formatter_if(is_hexstr, hex_to_integer) is_not_named_block = complement(is_named_block) TRANSACTION_KEY_MAPPINGS = { 'block_hash': 'blockHash', 'block_number': 'blockNumber', 'gas_price': 'gasPrice', 'transaction_hash': 'transactionHash', 'transaction_index': 'transactionIndex', } transaction_key_remapper = apply_key_map(TRANSACTION_KEY_MAPPINGS) LOG_KEY_MAPPINGS = { 'log_index': 'logIndex', 'transaction_index': 'transactionIndex', 'transaction_hash': 'transactionHash', 'block_hash': 'blockHash', 'block_number': 'blockNumber', } log_key_remapper = apply_key_map(LOG_KEY_MAPPINGS) RECEIPT_KEY_MAPPINGS = {