From 5c734d9a3d73e76a4d16ae3aac52572e3c20e823 Mon Sep 17 00:00:00 2001 From: iqdecay Date: Tue, 9 Jan 2024 13:09:03 +0100 Subject: [PATCH] chore!: remove duplicate function (#1243) The `decode_receipt_return` function was a duplicate of the `decode` function. BREAKING CHANGE: - Remove the `ABIDecoder::decode_receipt_return` function --- packages/fuels-core/src/codec/abi_decoder.rs | 5 ----- packages/fuels-core/src/codec/logs.rs | 7 +++---- packages/fuels-programs/src/receipt_parser.rs | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/fuels-core/src/codec/abi_decoder.rs b/packages/fuels-core/src/codec/abi_decoder.rs index 16afa156a2..336183999c 100644 --- a/packages/fuels-core/src/codec/abi_decoder.rs +++ b/packages/fuels-core/src/codec/abi_decoder.rs @@ -60,11 +60,6 @@ impl ABIDecoder { BoundedDecoder::new(self.config).decode(param_type, bytes) } - /// Decode data from one of the receipt returns. - pub fn decode_receipt_return(&self, param_type: &ParamType, bytes: &[u8]) -> Result { - BoundedDecoder::new(self.config).decode(param_type, bytes) - } - /// Same as `decode` but decodes multiple `ParamType`s in one go. /// # Examples /// ``` diff --git a/packages/fuels-core/src/codec/logs.rs b/packages/fuels-core/src/codec/logs.rs index 2a40cf1565..1daae05ed5 100644 --- a/packages/fuels-core/src/codec/logs.rs +++ b/packages/fuels-core/src/codec/logs.rs @@ -35,8 +35,7 @@ impl LogFormatter { bytes: &[u8], ) -> Result { Self::can_decode_log_with_type::()?; - let token = - ABIDecoder::new(decoder_config).decode_receipt_return(&T::param_type(), bytes)?; + let token = ABIDecoder::new(decoder_config).decode(&T::param_type(), bytes)?; Ok(format!("{:?}", T::from_token(token)?)) } @@ -189,8 +188,8 @@ impl LogDecoder { .extract_log_id_and_data() .filter_map(|(log_id, bytes)| { target_ids.contains(&log_id).then(|| { - let token = ABIDecoder::new(self.decoder_config) - .decode_receipt_return(&T::param_type(), &bytes)?; + let token = + ABIDecoder::new(self.decoder_config).decode(&T::param_type(), &bytes)?; T::from_token(token) }) }) diff --git a/packages/fuels-programs/src/receipt_parser.rs b/packages/fuels-programs/src/receipt_parser.rs index 0cc166f4a3..7804de9129 100644 --- a/packages/fuels-programs/src/receipt_parser.rs +++ b/packages/fuels-programs/src/receipt_parser.rs @@ -49,7 +49,7 @@ impl ReceiptParser { .extract_raw_data(output_param, &contract_id) .ok_or_else(|| Self::missing_receipts_error(output_param))?; - self.decoder.decode_receipt_return(output_param, &data) + self.decoder.decode(output_param, &data) } fn missing_receipts_error(output_param: &ParamType) -> Error {