@@ -128,33 +128,35 @@ impl<'a> TryFrom<&solana_program::account_info::AccountInfo<'a>> for {{ account.
128128 }
129129}
130130
131- #[cfg(feature = "anchor")]
132- impl anchor_lang::AccountDeserialize for {{ account .name | pascalCase }} {
133- fn try_deserialize_unchecked(buf: &mut & [u8]) -> anchor_lang::Result<Self > {
134- Ok(Self::deserialize(buf)?)
135- }
136- }
131+ {% if anchorTraits %}
132+ #[cfg(feature = "anchor")]
133+ impl anchor_lang::AccountDeserialize for {{ account .name | pascalCase }} {
134+ fn try_deserialize_unchecked(buf: &mut & [u8]) -> anchor_lang::Result<Self > {
135+ Ok(Self::deserialize(buf)?)
136+ }
137+ }
137138
138- #[cfg(feature = "anchor")]
139- impl anchor_lang::AccountSerialize for {{ account .name | pascalCase }} {}
139+ #[cfg(feature = "anchor")]
140+ impl anchor_lang::AccountSerialize for {{ account .name | pascalCase }} {}
140141
141- #[cfg(feature = "anchor")]
142- impl anchor_lang::Owner for {{ account .name | pascalCase }} {
143- fn owner() -> Pubkey {
144- crate::{{ program .name | snakeCase | upper }} _ID
145- }
146- }
142+ #[cfg(feature = "anchor")]
143+ impl anchor_lang::Owner for {{ account .name | pascalCase }} {
144+ fn owner() -> Pubkey {
145+ crate::{{ program .name | snakeCase | upper }} _ID
146+ }
147+ }
147148
148- #[cfg(feature = "anchor-idl-build")]
149- impl anchor_lang::IdlBuild for {{ account .name | pascalCase }} {}
149+ #[cfg(feature = "anchor-idl-build")]
150+ impl anchor_lang::IdlBuild for {{ account .name | pascalCase }} {}
150151
151- {#
152- This is not used for the IDL generation since default `IdlBuild` impl doesn't include
153- the type in the IDL but it stil needs to be added in order to make compilation work.
154- #}
155- #[cfg(feature = "anchor-idl-build")]
156- impl anchor_lang::Discriminator for {{ account .name | pascalCase }} {
157- const DISCRIMINATOR: [u8; 8] = [0; 8];
158- }
152+ {#
153+ This is not used for the IDL generation since default `IdlBuild` impl doesn't include
154+ the type in the IDL but it stil needs to be added in order to make compilation work.
155+ #}
156+ #[cfg(feature = "anchor-idl-build")]
157+ impl anchor_lang::Discriminator for {{ account .name | pascalCase }} {
158+ const DISCRIMINATOR: [u8; 8] = [0; 8];
159+ }
160+ {% endif %}
159161
160162{% endblock %}
0 commit comments