desmos_std/
types.rs

1use crate::query_types::DesmosQueryWrapper;
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5pub type Deps<'a> = cosmwasm_std::Deps<'a, DesmosQueryWrapper>;
6pub type DepsMut<'a> = cosmwasm_std::DepsMut<'a, DesmosQueryWrapper>;
7
8#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
9#[serde(rename_all = "snake_case")]
10pub enum DesmosRoute {
11    Posts,
12    Subspaces,
13    Profiles,
14}
15
16/// This file contains all the desmos related types used inside desmos' contracts
17#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
18#[serde(rename_all = "snake_case")]
19pub struct Attribute {
20    pub key: String,
21    pub value: String,
22}
23
24#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
25#[serde(rename_all = "snake_case")]
26pub struct Attachment {
27    pub uri: String,
28    pub mime_type: String,
29    pub tags: Option<Vec<String>>,
30}
31
32#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
33#[serde(rename_all = "snake_case")]
34pub struct ProvidedAnswer {
35    pub answer_id: String,
36    pub text: String,
37}
38
39#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
40#[serde(rename_all = "snake_case")]
41pub struct Poll {
42    pub question: String,
43    pub provided_answers: Vec<ProvidedAnswer>,
44    pub end_date: String,
45    pub allows_multiple_answers: bool,
46    pub allows_answer_edits: bool,
47}
48
49#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
50#[serde(rename_all = "snake_case")]
51pub struct Post {
52    pub post_id: String,
53    pub parent_id: Option<String>,
54    pub message: String,
55    pub created: String,
56    pub last_edited: String,
57    pub comments_state: String,
58    pub subspace: String,
59    pub additional_attributes: Option<Vec<Attribute>>,
60    pub creator: String,
61    pub attachments: Option<Vec<Attachment>>,
62    pub poll: Option<Poll>,
63}
64
65#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
66#[serde(rename_all = "snake_case")]
67pub struct Report {
68    pub post_id: String,
69    pub kind: String,
70    pub message: String,
71    pub user: String,
72}
73
74#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
75#[serde(rename_all = "snake_case")]
76pub struct Reaction {
77    pub post_id: String,
78    pub short_code: String,
79    pub value: String,
80    pub owner: String,
81}