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