ReturnData
use fuel_types::ContractId;
pub struct ReturnData {
id: ContractId,
data: Vec<u8>,
}
- A
ReturnData
receipt is generated when returning a reference type in a Sway contract; this includes all types except non-reference types. - The
data
field will include the returned value as a hexadecimal. - Read more about
ReturnData
in the Fuel protocol ABI spec
You can handle functions that produce a ReturnData
receipt type by using the returned type as a function parameter.
Note: the example below will run both when the type
MyStruct
is logged as well as whenMyStruct
is returned from a function.
fn handle_return_data(data: MyStruct) {
// handle the returned data
}