Static Lifetime on id method and i8, i16 support #15
Annotations
2 errors
|
Test
Process completed with exit code 1.
|
|
test/accountsParserPage.test.ts > it renders accounts parsers:
test/_setup.ts#L7
AssertionError: expected '//! This code was AUTOGENERATED using…' to contain 'fn id(&self) -> std::borrow::Cow<str>'
- Expected
+ Received
- fn id(&self) -> std::borrow::Cow<str>
+ //! This code was AUTOGENERATED using the codama library.
+ //! Please DO NOT EDIT THIS FILE, instead use visitors
+ //! to add features, then rerun codama to update it.
+ //!
+ //! <https://github.com/codama-idl/codama>
+ //!
+
+ use crate::accounts::Mint;
+ use crate::accounts::Account;
+ use crate::accounts::Metadata;
+ use crate::accounts::MasterEdition;
+ use crate::accounts::Edition;
+ use crate::ID;
+
+ use crate::deserialize_checked;
+
+ /// Test Program State
+ #[allow(clippy::large_enum_variant)]
+ #[derive(Debug)]
+ #[cfg_attr(feature = "tracing", derive(strum_macros::Display))]
+ pub enum TestProgramState {
+ Mint(Mint),
+ Account(Account),
+ Metadata(Metadata),
+ MasterEdition(MasterEdition),
+ Edition(Edition),
+ }
+
+ impl TestProgramState {
+ pub fn try_unpack(data_bytes:&[u8]) -> yellowstone_vixen_core::ParseResult<Self>{
+ let data_len = data_bytes.len();
+ const MINT_LEN:usize = std::mem::size_of::<Mint>();
+ const ACCOUNT_LEN:usize = std::mem::size_of::<Account>();
+ const METADATA_LEN:usize = std::mem::size_of::<Metadata>();
+ const MASTEREDITION_LEN:usize = std::mem::size_of::<MasterEdition>();
+ const EDITION_LEN:usize = std::mem::size_of::<Edition>();
+
+ let acc =match data_len {
+ MINT_LEN => Ok(
+ TestProgramState::Mint(
+ deserialize_checked(data_bytes, &data_len.to_le_bytes())?
+ )
+ ),
+ ACCOUNT_LEN => Ok(
+ TestProgramState::Account(
+ deserialize_checked(data_bytes, &data_len.to_le_bytes())?
+ )
+ ),
+ METADATA_LEN => Ok(
+ TestProgramState::Metadata(
+ deserialize_checked(data_bytes, &data_len.to_le_bytes())?
+ )
+ ),
+ MASTEREDITION_LEN => Ok(
+ TestProgramState::MasterEdition(
+ deserialize_checked(data_bytes, &data_len.to_le_bytes())?
+ )
+ ),
+ EDITION_LEN => Ok(
+ TestProgramState::Edition(
+ deserialize_checked(data_bytes, &data_len.to_le_bytes())?
+ )
+ ),
+ _ => Err(yellowstone_vixen_core::ParseError::from("Invalid Account data length".to_owned())),
+ };
+
+ #[cfg(feature = "tracing")]
+ match &acc {
+ Ok(acc) => {
+ tracing::info!(
+ name: "correctly_parsed_account",
+ name = "account_update",
+ program = ID.to_string(),
+ account = acc.to_string()
+ );
+ },
+ Err(e) => {
+ tracing::info!(
+ name: "incorrectly_parsed_account",
+ name = "account_update",
+ program = ID.to_string(),
+ account = "error",
+ data_len = ?data_len,
+ error = ?e
+ );
+ },
+ }
+
+ acc
+ }
+ }
+
+ #[derive(Debug, Copy, Clone)]
+ pub struct AccountParser;
+
+ impl yellowstone_vixen_core::Parser for AccountParser {
+ type Input = yellowstone_vixen_core::AccountUpdate;
+ type Output = TestProgramState;
+
+ fn id(&self) -> std::borrow::Cow<'static
|