Files
serai/substrate/abi/src/in_instructions.rs

48 lines
1.4 KiB
Rust
Raw Normal View History

use borsh::{BorshSerialize, BorshDeserialize};
use serai_primitives::{
BlockHash, network_id::ExternalNetworkId, validator_sets::Session, instructions::SignedBatch,
};
/// A call to `InInstruction`s.
#[derive(Clone, PartialEq, Eq, Debug, BorshSerialize, BorshDeserialize)]
pub enum Call {
/// Execute a batch of `InInstruction`s.
execute_batch {
/// The batch to execute.
batch: SignedBatch,
},
}
impl Call {
pub(crate) fn is_signed(&self) -> bool {
match self {
Call::execute_batch { .. } => false,
}
}
}
/// An event from `InInstruction`s.
#[derive(Clone, PartialEq, Eq, Debug, BorshSerialize, BorshDeserialize)]
pub enum Event {
/// A batch of `InInstruction`s was executed.
2024-12-31 10:37:19 -05:00
Batch {
/// The network for which a batch was executed.
network: ExternalNetworkId,
/// The session which published the batch.
2024-12-31 10:37:19 -05:00
publishing_session: Session,
/// The ID of the batch.
2024-12-31 10:37:19 -05:00
id: u32,
/// The hash of the block on the external network which caused this batch's creation.
external_network_block_hash: BlockHash,
/// The hash of the `InInstruction`s within this batch.
2024-12-31 10:37:19 -05:00
in_instructions_hash: [u8; 32],
/// The results of each `InInstruction` within the batch.
#[borsh(
serialize_with = "serai_primitives::sp_borsh::borsh_serialize_bitvec",
deserialize_with = "serai_primitives::sp_borsh::borsh_deserialize_bitvec"
)]
2024-12-31 10:37:19 -05:00
in_instruction_results: bitvec::vec::BitVec<u8, bitvec::order::Lsb0>,
},
}