def _encode_abi(cls, abi, arguments, data=None): argument_types = get_abi_input_types(abi) if not check_if_arguments_can_be_encoded(abi, arguments, {}): raise TypeError( "One or more arguments could not be encoded to the necessary " "ABI type. Expected types are: {0}".format( ', '.join(argument_types), )) try: encoded_arguments = encode_abi( argument_types, force_obj_to_bytes(arguments), ) except EncodingError as e: raise TypeError( "One or more arguments could not be encoded to the necessary " "ABI type: {0}".format(str(e))) if data: return add_0x_prefix( force_bytes(remove_0x_prefix(data)) + force_bytes(remove_0x_prefix(encode_hex(encoded_arguments)))) else: return encode_hex(encoded_arguments)
def _encode_abi(cls, abi, arguments, data=None): argument_types = get_abi_input_types(abi) if not check_if_arguments_can_be_encoded(abi, arguments, {}): raise TypeError( "One or more arguments could not be encoded to the necessary " "ABI type. Expected types are: {0}".format( ', '.join(argument_types), ) ) try: encoded_arguments = encode_abi( argument_types, force_obj_to_bytes(arguments), ) except EncodingError as e: raise TypeError( "One or more arguments could not be encoded to the necessary " "ABI type: {0}".format(str(e)) ) if data: return add_0x_prefix( force_bytes(remove_0x_prefix(data)) + force_bytes(remove_0x_prefix(encode_hex(encoded_arguments))) ) else: return encode_hex(encoded_arguments)
def encodeABI(cls, fn_name, arguments, data=None): """ encodes the arguments using the Ethereum ABI. """ function_abi = cls.find_matching_fn_abi(fn_name, force_obj_to_bytes(arguments)) return cls._encodeABI(function_abi, arguments, data)
def _encodeABI(cls, abi, arguments, data=None): arguent_types = get_abi_input_types(abi) encoded_arguments = encode_abi(arguent_types, force_obj_to_bytes(arguments)) if data: return add_0x_prefix( force_bytes(remove_0x_prefix(data)) + force_bytes(remove_0x_prefix(encode_hex(encoded_arguments))) ) else: return encode_hex(encoded_arguments)
def _encodeABI(cls, abi, arguments, data=None): arguent_types = get_abi_input_types(abi) encoded_arguments = encode_abi(arguent_types, force_obj_to_bytes(arguments)) if data: return add_0x_prefix( force_bytes(remove_0x_prefix(data)) + force_bytes(remove_0x_prefix(encode_hex(encoded_arguments)))) else: return encode_hex(encoded_arguments)
def encodeABI(cls, fn_name, arguments, data=None): """ encodes the arguments using the Ethereum ABI. """ function_abi = cls.find_matching_abi(fn_name, force_obj_to_bytes(arguments)) return cls._encodeABI(function_abi, arguments, data)