account discriminator macro

This commit is contained in:
Hardhat Chad
2024-08-25 14:52:10 +00:00
parent 630b0efd64
commit dce5c11a12
7 changed files with 43 additions and 30 deletions

View File

@@ -54,9 +54,15 @@ macro_rules! impl_instruction_from_bytes {
#[macro_export]
macro_rules! account {
($struct_name:ident) => {
($discriminator_name:ident, $struct_name:ident) => {
$crate::impl_to_bytes!($struct_name);
$crate::impl_account_from_bytes!($struct_name);
impl $crate::Discriminator for $struct_name {
fn discriminator() -> u8 {
$discriminator_name::$struct_name.into()
}
}
};
}