Skip to content

Commit

Permalink
chore!: remove duplicate function (#1243)
Browse files Browse the repository at this point in the history
The `decode_receipt_return` function was a duplicate of the `decode`
function.
BREAKING CHANGE:
- Remove the `ABIDecoder::decode_receipt_return` function
  • Loading branch information
iqdecay authored Jan 9, 2024
1 parent 638a548 commit 5c734d9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
5 changes: 0 additions & 5 deletions packages/fuels-core/src/codec/abi_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Token> {
BoundedDecoder::new(self.config).decode(param_type, bytes)
}

/// Same as `decode` but decodes multiple `ParamType`s in one go.
/// # Examples
/// ```
Expand Down
7 changes: 3 additions & 4 deletions packages/fuels-core/src/codec/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ impl LogFormatter {
bytes: &[u8],
) -> Result<String> {
Self::can_decode_log_with_type::<T>()?;
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)?))
}

Expand Down Expand Up @@ -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)
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/fuels-programs/src/receipt_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5c734d9

Please sign in to comment.