Binary Data

Note

By default ctc will perform end-to-end encoding/decoding of many operations. The low-level functions listed here are only needed if you need to work directly with raw binary data.

Examples

binary_data

Reference

ctc.binary.decode_call_data(call_data, function_abi=None, contract_abi=None)
Parameters
  • call_data (Union[bytes, str]) –

  • function_abi (Union[FunctionABI, NoneType]) –

  • contract_abi (Union[List[Union[FunctionABI, EventABI, ErrorABI]], NoneType]) –

Return type

<class ‘DecodedCallData’>

ctc.binary.decode_function_output(encoded_output, output_types=None, function_abi=None, delist_single_outputs=True, package_named_outputs=False)
ctc.binary.decode_types(data, types)
Parameters
  • data (<class 'bytes'>) –

  • types (<class 'str'>) –

Return type

Any

ctc.binary.encode_call_data(*, function_selector=None, parameter_types=None, parameters=None, encoded_parameters=None, function_abi=None)
Parameters
  • function_selector (Union[str, NoneType]) –

  • parameter_types (Union[str, NoneType]) –

  • parameters (Union[Sequence[Any], Mapping[str, Any], NoneType]) –

  • encoded_parameters (Union[bytes, str, NoneType]) –

  • function_abi (Union[FunctionABI, NoneType]) –

Return type

<class ‘str’>

ctc.binary.encode_types(data, types)
Parameters
  • data (Any) –

  • types (<class 'str'>) –

Return type

<class ‘bytes’>