Skip to content

Commit 207d356

Browse files
Use unpack_from_slice In Token Program Parser
1 parent a8851b8 commit 207d356

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/parser/src/token_program/account_parser.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ pub enum TokenProgramState {
1919
impl TokenProgramState {
2020
pub fn try_unpack(data_bytes: &[u8]) -> ParseResult<Self> {
2121
let acc = match data_bytes.len() {
22-
Mint::LEN => Mint::unpack(data_bytes).map(Self::Mint).map_err(Into::into),
23-
Account::LEN => Account::unpack(data_bytes)
22+
Mint::LEN => Mint::unpack_from_slice(data_bytes).map(Self::Mint).map_err(Into::into),
23+
Account::LEN => Account::unpack_from_slice(data_bytes)
2424
.map(Self::TokenAccount)
2525
.map_err(Into::into),
26-
Multisig::LEN => Multisig::unpack(data_bytes)
26+
Multisig::LEN => Multisig::unpack_from_slice(data_bytes)
2727
.map(Self::Multisig)
2828
.map_err(Into::into),
29-
_ => Err(ParseError::from("Invalid Account data length".to_owned())),
29+
_ => return Err(ParseError::Filtered)
3030
};
3131

3232
#[cfg(feature = "tracing")]
@@ -172,4 +172,4 @@ mod tests {
172172

173173
assert_eq!(mint.decimals, 10);
174174
}
175-
}
175+
}

0 commit comments

Comments
 (0)