ReturnData
use fuel_types::ContractId;
pub struct ReturnData {
id: ContractId,
data: Vec<u8>,
}
- A
ReturnDatareceipt is generated when returning a reference type in a Sway contract; this includes all types except non-reference types. - The
datafield will include the returned value as a hexadecimal. - Read more about
ReturnDatain 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
MyStructis logged as well as whenMyStructis returned from a function.
fn handle_return_data(data: MyStruct) {
// handle the returned data
}