1use cosmwasm_std::{Addr, CustomQuery};
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5use crate::types::ProvenanceRoute;
6
7#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema)]
9#[serde(rename_all = "snake_case")]
10pub struct ProvenanceQuery {
11 pub route: ProvenanceRoute, pub params: ProvenanceQueryParams, pub version: String, }
15
16impl CustomQuery for ProvenanceQuery {}
19
20#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema)]
22#[serde(rename_all = "snake_case")]
23pub enum ProvenanceQueryParams {
24 Name(NameQueryParams),
25 Attribute(AttributeQueryParams),
26 Marker(MarkerQueryParams),
27 Metadata(MetadataQueryParams),
28}
29
30#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema)]
32#[serde(rename_all = "snake_case")]
33pub enum NameQueryParams {
34 Resolve { name: String },
35 Lookup { address: Addr },
36}
37
38#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema)]
40#[serde(rename_all = "snake_case")]
41pub enum AttributeQueryParams {
42 GetAttributes { address: Addr, name: String },
43 GetAllAttributes { address: Addr },
44}
45
46#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema)]
48#[serde(rename_all = "snake_case")]
49pub enum MarkerQueryParams {
50 GetMarkerByAddress { address: Addr },
51 GetMarkerByDenom { denom: String },
52}
53
54#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema)]
56#[serde(rename_all = "snake_case")]
57pub enum MetadataQueryParams {
58 GetScope {
59 scope_id: String,
60 },
61 GetSessions {
62 scope_id: String,
63 },
64 GetRecords {
65 scope_id: String,
66 name: Option<String>,
67 },
68}