magicblock_magic_program_api/
response.rs1use serde::{Deserialize, Serialize};
2
3use crate::compat::Signature;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub enum MagicResponse {
7 V1(MagicResponseV1),
8}
9
10impl MagicResponse {
11 pub fn ok(&self) -> bool {
12 match self {
13 Self::V1(value) => value.ok,
14 }
15 }
16
17 pub fn data(&self) -> &[u8] {
18 match self {
19 Self::V1(value) => &value.data,
20 }
21 }
22
23 pub fn error(&self) -> &String {
24 match self {
25 Self::V1(value) => &value.error,
26 }
27 }
28}
29
30#[derive(Debug, Clone, Serialize, Deserialize)]
31pub struct MagicResponseV1 {
32 pub ok: bool,
33 pub data: Vec<u8>,
36 pub error: String,
39 pub receipt: Option<ActionReceipt>,
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize)]
45pub struct ActionReceipt {
46 pub signature: Signature,
48}