0

In vyper, how can I convert:

response: Bytes[32] = raw_call(your_contract_address, call_data, max_outsize=32)

to a bytes32 or even just take the first 8 bytes?

response: bytes8 = ?

1 Answer 1

0

You can convert a Bytes[] to bytes32 with the convert method.

response: Bytes[32] = raw_call(your_contract_address, call_data, max_outsize=32)
converted_response: bytes32 = convert(response, bytes32)

Or, you can use extract:

converted_response: bytes32 = extract32(response, 0)

Then, you can convert your bytes32 to bytes8

extra_converted_response: bytes8 = convert(converted_response, bytes8)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.