use serde::{Deserialize, Serialize};
use crate::compat::Signature;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum MagicResponse {
V1(MagicResponseV1),
}
impl MagicResponse {
pub fn ok(&self) -> bool {
match self {
Self::V1(value) => value.ok,
}
}
pub fn data(&self) -> &[u8] {
match self {
Self::V1(value) => &value.data,
}
}
pub fn error(&self) -> &String {
match self {
Self::V1(value) => &value.error,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MagicResponseV1 {
pub ok: bool,
pub data: Vec<u8>,
pub error: String,
pub receipt: Option<ActionReceipt>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ActionReceipt {
pub signature: Signature,
}