persistence_std/types/cosmos/nft/
v1beta1.rs

1use persistence_std_derive::CosmwasmExt;
2/// EventSend is emitted on Msg/Send
3#[allow(clippy::derive_partial_eq_without_eq)]
4#[derive(
5    Clone,
6    PartialEq,
7    Eq,
8    ::prost::Message,
9    ::serde::Serialize,
10    ::serde::Deserialize,
11    ::schemars::JsonSchema,
12    CosmwasmExt,
13)]
14#[proto_message(type_url = "/cosmos.nft.v1beta1.EventSend")]
15pub struct EventSend {
16    /// class_id associated with the nft
17    #[prost(string, tag = "1")]
18    #[serde(alias = "classID")]
19    pub class_id: ::prost::alloc::string::String,
20    /// id is a unique identifier of the nft
21    #[prost(string, tag = "2")]
22    #[serde(alias = "ID")]
23    pub id: ::prost::alloc::string::String,
24    /// sender is the address of the owner of nft
25    #[prost(string, tag = "3")]
26    pub sender: ::prost::alloc::string::String,
27    /// receiver is the receiver address of nft
28    #[prost(string, tag = "4")]
29    pub receiver: ::prost::alloc::string::String,
30}
31/// EventMint is emitted on Mint
32#[allow(clippy::derive_partial_eq_without_eq)]
33#[derive(
34    Clone,
35    PartialEq,
36    Eq,
37    ::prost::Message,
38    ::serde::Serialize,
39    ::serde::Deserialize,
40    ::schemars::JsonSchema,
41    CosmwasmExt,
42)]
43#[proto_message(type_url = "/cosmos.nft.v1beta1.EventMint")]
44pub struct EventMint {
45    /// class_id associated with the nft
46    #[prost(string, tag = "1")]
47    #[serde(alias = "classID")]
48    pub class_id: ::prost::alloc::string::String,
49    /// id is a unique identifier of the nft
50    #[prost(string, tag = "2")]
51    #[serde(alias = "ID")]
52    pub id: ::prost::alloc::string::String,
53    /// owner is the owner address of the nft
54    #[prost(string, tag = "3")]
55    pub owner: ::prost::alloc::string::String,
56}
57/// EventBurn is emitted on Burn
58#[allow(clippy::derive_partial_eq_without_eq)]
59#[derive(
60    Clone,
61    PartialEq,
62    Eq,
63    ::prost::Message,
64    ::serde::Serialize,
65    ::serde::Deserialize,
66    ::schemars::JsonSchema,
67    CosmwasmExt,
68)]
69#[proto_message(type_url = "/cosmos.nft.v1beta1.EventBurn")]
70pub struct EventBurn {
71    /// class_id associated with the nft
72    #[prost(string, tag = "1")]
73    #[serde(alias = "classID")]
74    pub class_id: ::prost::alloc::string::String,
75    /// id is a unique identifier of the nft
76    #[prost(string, tag = "2")]
77    #[serde(alias = "ID")]
78    pub id: ::prost::alloc::string::String,
79    /// owner is the owner address of the nft
80    #[prost(string, tag = "3")]
81    pub owner: ::prost::alloc::string::String,
82}
83/// Class defines the class of the nft type.
84#[allow(clippy::derive_partial_eq_without_eq)]
85#[derive(
86    Clone,
87    PartialEq,
88    Eq,
89    ::prost::Message,
90    ::serde::Serialize,
91    ::serde::Deserialize,
92    ::schemars::JsonSchema,
93    CosmwasmExt,
94)]
95#[proto_message(type_url = "/cosmos.nft.v1beta1.Class")]
96pub struct Class {
97    /// id defines the unique identifier of the NFT classification, similar to the contract address of ERC721
98    #[prost(string, tag = "1")]
99    #[serde(alias = "ID")]
100    pub id: ::prost::alloc::string::String,
101    /// name defines the human-readable name of the NFT classification. Optional
102    #[prost(string, tag = "2")]
103    pub name: ::prost::alloc::string::String,
104    /// symbol is an abbreviated name for nft classification. Optional
105    #[prost(string, tag = "3")]
106    pub symbol: ::prost::alloc::string::String,
107    /// description is a brief description of nft classification. Optional
108    #[prost(string, tag = "4")]
109    pub description: ::prost::alloc::string::String,
110    /// uri for the class metadata stored off chain. It can define schema for Class and NFT `Data` attributes. Optional
111    #[prost(string, tag = "5")]
112    pub uri: ::prost::alloc::string::String,
113    /// uri_hash is a hash of the document pointed by uri. Optional
114    #[prost(string, tag = "6")]
115    pub uri_hash: ::prost::alloc::string::String,
116    /// data is the app specific metadata of the NFT class. Optional
117    #[prost(message, optional, tag = "7")]
118    pub data: ::core::option::Option<crate::shim::Any>,
119}
120/// NFT defines the NFT.
121#[allow(clippy::derive_partial_eq_without_eq)]
122#[derive(
123    Clone,
124    PartialEq,
125    Eq,
126    ::prost::Message,
127    ::serde::Serialize,
128    ::serde::Deserialize,
129    ::schemars::JsonSchema,
130    CosmwasmExt,
131)]
132#[proto_message(type_url = "/cosmos.nft.v1beta1.NFT")]
133pub struct Nft {
134    /// class_id associated with the NFT, similar to the contract address of ERC721
135    #[prost(string, tag = "1")]
136    #[serde(alias = "classID")]
137    pub class_id: ::prost::alloc::string::String,
138    /// id is a unique identifier of the NFT
139    #[prost(string, tag = "2")]
140    #[serde(alias = "ID")]
141    pub id: ::prost::alloc::string::String,
142    /// uri for the NFT metadata stored off chain
143    #[prost(string, tag = "3")]
144    pub uri: ::prost::alloc::string::String,
145    /// uri_hash is a hash of the document pointed by uri
146    #[prost(string, tag = "4")]
147    pub uri_hash: ::prost::alloc::string::String,
148    /// data is an app specific data of the NFT. Optional
149    #[prost(message, optional, tag = "10")]
150    pub data: ::core::option::Option<crate::shim::Any>,
151}
152/// GenesisState defines the nft module's genesis state.
153#[allow(clippy::derive_partial_eq_without_eq)]
154#[derive(
155    Clone,
156    PartialEq,
157    Eq,
158    ::prost::Message,
159    ::serde::Serialize,
160    ::serde::Deserialize,
161    ::schemars::JsonSchema,
162    CosmwasmExt,
163)]
164#[proto_message(type_url = "/cosmos.nft.v1beta1.GenesisState")]
165pub struct GenesisState {
166    /// class defines the class of the nft type.
167    #[prost(message, repeated, tag = "1")]
168    pub classes: ::prost::alloc::vec::Vec<Class>,
169    /// entry defines all nft owned by a person.
170    #[prost(message, repeated, tag = "2")]
171    pub entries: ::prost::alloc::vec::Vec<Entry>,
172}
173/// Entry Defines all nft owned by a person
174#[allow(clippy::derive_partial_eq_without_eq)]
175#[derive(
176    Clone,
177    PartialEq,
178    Eq,
179    ::prost::Message,
180    ::serde::Serialize,
181    ::serde::Deserialize,
182    ::schemars::JsonSchema,
183    CosmwasmExt,
184)]
185#[proto_message(type_url = "/cosmos.nft.v1beta1.Entry")]
186pub struct Entry {
187    /// owner is the owner address of the following nft
188    #[prost(string, tag = "1")]
189    pub owner: ::prost::alloc::string::String,
190    /// nfts is a group of nfts of the same owner
191    #[prost(message, repeated, tag = "2")]
192    pub nfts: ::prost::alloc::vec::Vec<Nft>,
193}
194/// QueryBalanceRequest is the request type for the Query/Balance RPC method
195#[allow(clippy::derive_partial_eq_without_eq)]
196#[derive(
197    Clone,
198    PartialEq,
199    Eq,
200    ::prost::Message,
201    ::serde::Serialize,
202    ::serde::Deserialize,
203    ::schemars::JsonSchema,
204    CosmwasmExt,
205)]
206#[proto_message(type_url = "/cosmos.nft.v1beta1.QueryBalanceRequest")]
207#[proto_query(
208    path = "/cosmos.nft.v1beta1.Query/Balance",
209    response_type = QueryBalanceResponse
210)]
211pub struct QueryBalanceRequest {
212    /// class_id associated with the nft
213    #[prost(string, tag = "1")]
214    #[serde(alias = "classID")]
215    pub class_id: ::prost::alloc::string::String,
216    /// owner is the owner address of the nft
217    #[prost(string, tag = "2")]
218    pub owner: ::prost::alloc::string::String,
219}
220/// QueryBalanceResponse is the response type for the Query/Balance RPC method
221#[allow(clippy::derive_partial_eq_without_eq)]
222#[derive(
223    Clone,
224    PartialEq,
225    Eq,
226    ::prost::Message,
227    ::serde::Serialize,
228    ::serde::Deserialize,
229    ::schemars::JsonSchema,
230    CosmwasmExt,
231)]
232#[proto_message(type_url = "/cosmos.nft.v1beta1.QueryBalanceResponse")]
233pub struct QueryBalanceResponse {
234    /// amount is the number of all NFTs of a given class owned by the owner
235    #[prost(uint64, tag = "1")]
236    #[serde(
237        serialize_with = "crate::serde::as_str::serialize",
238        deserialize_with = "crate::serde::as_str::deserialize"
239    )]
240    pub amount: u64,
241}
242/// QueryOwnerRequest is the request type for the Query/Owner RPC method
243#[allow(clippy::derive_partial_eq_without_eq)]
244#[derive(
245    Clone,
246    PartialEq,
247    Eq,
248    ::prost::Message,
249    ::serde::Serialize,
250    ::serde::Deserialize,
251    ::schemars::JsonSchema,
252    CosmwasmExt,
253)]
254#[proto_message(type_url = "/cosmos.nft.v1beta1.QueryOwnerRequest")]
255#[proto_query(
256    path = "/cosmos.nft.v1beta1.Query/Owner",
257    response_type = QueryOwnerResponse
258)]
259pub struct QueryOwnerRequest {
260    /// class_id associated with the nft
261    #[prost(string, tag = "1")]
262    #[serde(alias = "classID")]
263    pub class_id: ::prost::alloc::string::String,
264    /// id is a unique identifier of the NFT
265    #[prost(string, tag = "2")]
266    #[serde(alias = "ID")]
267    pub id: ::prost::alloc::string::String,
268}
269/// QueryOwnerResponse is the response type for the Query/Owner RPC method
270#[allow(clippy::derive_partial_eq_without_eq)]
271#[derive(
272    Clone,
273    PartialEq,
274    Eq,
275    ::prost::Message,
276    ::serde::Serialize,
277    ::serde::Deserialize,
278    ::schemars::JsonSchema,
279    CosmwasmExt,
280)]
281#[proto_message(type_url = "/cosmos.nft.v1beta1.QueryOwnerResponse")]
282pub struct QueryOwnerResponse {
283    /// owner is the owner address of the nft
284    #[prost(string, tag = "1")]
285    pub owner: ::prost::alloc::string::String,
286}
287/// QuerySupplyRequest is the request type for the Query/Supply RPC method
288#[allow(clippy::derive_partial_eq_without_eq)]
289#[derive(
290    Clone,
291    PartialEq,
292    Eq,
293    ::prost::Message,
294    ::serde::Serialize,
295    ::serde::Deserialize,
296    ::schemars::JsonSchema,
297    CosmwasmExt,
298)]
299#[proto_message(type_url = "/cosmos.nft.v1beta1.QuerySupplyRequest")]
300#[proto_query(
301    path = "/cosmos.nft.v1beta1.Query/Supply",
302    response_type = QuerySupplyResponse
303)]
304pub struct QuerySupplyRequest {
305    /// class_id associated with the nft
306    #[prost(string, tag = "1")]
307    #[serde(alias = "classID")]
308    pub class_id: ::prost::alloc::string::String,
309}
310/// QuerySupplyResponse is the response type for the Query/Supply RPC method
311#[allow(clippy::derive_partial_eq_without_eq)]
312#[derive(
313    Clone,
314    PartialEq,
315    Eq,
316    ::prost::Message,
317    ::serde::Serialize,
318    ::serde::Deserialize,
319    ::schemars::JsonSchema,
320    CosmwasmExt,
321)]
322#[proto_message(type_url = "/cosmos.nft.v1beta1.QuerySupplyResponse")]
323pub struct QuerySupplyResponse {
324    /// amount is the number of all NFTs from the given class
325    #[prost(uint64, tag = "1")]
326    #[serde(
327        serialize_with = "crate::serde::as_str::serialize",
328        deserialize_with = "crate::serde::as_str::deserialize"
329    )]
330    pub amount: u64,
331}
332/// QueryNFTstRequest is the request type for the Query/NFTs RPC method
333#[allow(clippy::derive_partial_eq_without_eq)]
334#[derive(
335    Clone,
336    PartialEq,
337    Eq,
338    ::prost::Message,
339    ::serde::Serialize,
340    ::serde::Deserialize,
341    ::schemars::JsonSchema,
342    CosmwasmExt,
343)]
344#[proto_message(type_url = "/cosmos.nft.v1beta1.QueryNFTsRequest")]
345#[proto_query(
346    path = "/cosmos.nft.v1beta1.Query/NFTs",
347    response_type = QueryNfTsResponse
348)]
349pub struct QueryNfTsRequest {
350    /// class_id associated with the nft
351    #[prost(string, tag = "1")]
352    #[serde(alias = "classID")]
353    pub class_id: ::prost::alloc::string::String,
354    /// owner is the owner address of the nft
355    #[prost(string, tag = "2")]
356    pub owner: ::prost::alloc::string::String,
357    /// pagination defines an optional pagination for the request.
358    #[prost(message, optional, tag = "3")]
359    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageRequest>,
360}
361/// QueryNFTsResponse is the response type for the Query/NFTs RPC methods
362#[allow(clippy::derive_partial_eq_without_eq)]
363#[derive(
364    Clone,
365    PartialEq,
366    Eq,
367    ::prost::Message,
368    ::serde::Serialize,
369    ::serde::Deserialize,
370    ::schemars::JsonSchema,
371    CosmwasmExt,
372)]
373#[proto_message(type_url = "/cosmos.nft.v1beta1.QueryNFTsResponse")]
374pub struct QueryNfTsResponse {
375    /// NFT defines the NFT
376    #[prost(message, repeated, tag = "1")]
377    pub nfts: ::prost::alloc::vec::Vec<Nft>,
378    /// pagination defines the pagination in the response.
379    #[prost(message, optional, tag = "2")]
380    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageResponse>,
381}
382/// QueryNFTRequest is the request type for the Query/NFT RPC method
383#[allow(clippy::derive_partial_eq_without_eq)]
384#[derive(
385    Clone,
386    PartialEq,
387    Eq,
388    ::prost::Message,
389    ::serde::Serialize,
390    ::serde::Deserialize,
391    ::schemars::JsonSchema,
392    CosmwasmExt,
393)]
394#[proto_message(type_url = "/cosmos.nft.v1beta1.QueryNFTRequest")]
395#[proto_query(path = "/cosmos.nft.v1beta1.Query/NFT", response_type = QueryNftResponse)]
396pub struct QueryNftRequest {
397    /// class_id associated with the nft
398    #[prost(string, tag = "1")]
399    #[serde(alias = "classID")]
400    pub class_id: ::prost::alloc::string::String,
401    /// id is a unique identifier of the NFT
402    #[prost(string, tag = "2")]
403    #[serde(alias = "ID")]
404    pub id: ::prost::alloc::string::String,
405}
406/// QueryNFTResponse is the response type for the Query/NFT RPC method
407#[allow(clippy::derive_partial_eq_without_eq)]
408#[derive(
409    Clone,
410    PartialEq,
411    Eq,
412    ::prost::Message,
413    ::serde::Serialize,
414    ::serde::Deserialize,
415    ::schemars::JsonSchema,
416    CosmwasmExt,
417)]
418#[proto_message(type_url = "/cosmos.nft.v1beta1.QueryNFTResponse")]
419pub struct QueryNftResponse {
420    /// owner is the owner address of the nft
421    #[prost(message, optional, tag = "1")]
422    pub nft: ::core::option::Option<Nft>,
423}
424/// QueryClassRequest is the request type for the Query/Class RPC method
425#[allow(clippy::derive_partial_eq_without_eq)]
426#[derive(
427    Clone,
428    PartialEq,
429    Eq,
430    ::prost::Message,
431    ::serde::Serialize,
432    ::serde::Deserialize,
433    ::schemars::JsonSchema,
434    CosmwasmExt,
435)]
436#[proto_message(type_url = "/cosmos.nft.v1beta1.QueryClassRequest")]
437#[proto_query(
438    path = "/cosmos.nft.v1beta1.Query/Class",
439    response_type = QueryClassResponse
440)]
441pub struct QueryClassRequest {
442    /// class_id associated with the nft
443    #[prost(string, tag = "1")]
444    #[serde(alias = "classID")]
445    pub class_id: ::prost::alloc::string::String,
446}
447/// QueryClassResponse is the response type for the Query/Class RPC method
448#[allow(clippy::derive_partial_eq_without_eq)]
449#[derive(
450    Clone,
451    PartialEq,
452    Eq,
453    ::prost::Message,
454    ::serde::Serialize,
455    ::serde::Deserialize,
456    ::schemars::JsonSchema,
457    CosmwasmExt,
458)]
459#[proto_message(type_url = "/cosmos.nft.v1beta1.QueryClassResponse")]
460pub struct QueryClassResponse {
461    /// class defines the class of the nft type.
462    #[prost(message, optional, tag = "1")]
463    pub class: ::core::option::Option<Class>,
464}
465/// QueryClassesRequest is the request type for the Query/Classes RPC method
466#[allow(clippy::derive_partial_eq_without_eq)]
467#[derive(
468    Clone,
469    PartialEq,
470    Eq,
471    ::prost::Message,
472    ::serde::Serialize,
473    ::serde::Deserialize,
474    ::schemars::JsonSchema,
475    CosmwasmExt,
476)]
477#[proto_message(type_url = "/cosmos.nft.v1beta1.QueryClassesRequest")]
478#[proto_query(
479    path = "/cosmos.nft.v1beta1.Query/Classes",
480    response_type = QueryClassesResponse
481)]
482pub struct QueryClassesRequest {
483    /// pagination defines an optional pagination for the request.
484    #[prost(message, optional, tag = "1")]
485    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageRequest>,
486}
487/// QueryClassesResponse is the response type for the Query/Classes RPC method
488#[allow(clippy::derive_partial_eq_without_eq)]
489#[derive(
490    Clone,
491    PartialEq,
492    Eq,
493    ::prost::Message,
494    ::serde::Serialize,
495    ::serde::Deserialize,
496    ::schemars::JsonSchema,
497    CosmwasmExt,
498)]
499#[proto_message(type_url = "/cosmos.nft.v1beta1.QueryClassesResponse")]
500pub struct QueryClassesResponse {
501    /// class defines the class of the nft type.
502    #[prost(message, repeated, tag = "1")]
503    pub classes: ::prost::alloc::vec::Vec<Class>,
504    /// pagination defines the pagination in the response.
505    #[prost(message, optional, tag = "2")]
506    pub pagination: ::core::option::Option<super::super::base::query::v1beta1::PageResponse>,
507}
508/// MsgSend represents a message to send a nft from one account to another account.
509#[allow(clippy::derive_partial_eq_without_eq)]
510#[derive(
511    Clone,
512    PartialEq,
513    Eq,
514    ::prost::Message,
515    ::serde::Serialize,
516    ::serde::Deserialize,
517    ::schemars::JsonSchema,
518    CosmwasmExt,
519)]
520#[proto_message(type_url = "/cosmos.nft.v1beta1.MsgSend")]
521pub struct MsgSend {
522    /// class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721
523    #[prost(string, tag = "1")]
524    #[serde(alias = "classID")]
525    pub class_id: ::prost::alloc::string::String,
526    /// id defines the unique identification of nft
527    #[prost(string, tag = "2")]
528    #[serde(alias = "ID")]
529    pub id: ::prost::alloc::string::String,
530    /// sender is the address of the owner of nft
531    #[prost(string, tag = "3")]
532    pub sender: ::prost::alloc::string::String,
533    /// receiver is the receiver address of nft
534    #[prost(string, tag = "4")]
535    pub receiver: ::prost::alloc::string::String,
536}
537/// MsgSendResponse defines the Msg/Send response type.
538#[allow(clippy::derive_partial_eq_without_eq)]
539#[derive(
540    Clone,
541    PartialEq,
542    Eq,
543    ::prost::Message,
544    ::serde::Serialize,
545    ::serde::Deserialize,
546    ::schemars::JsonSchema,
547    CosmwasmExt,
548)]
549#[proto_message(type_url = "/cosmos.nft.v1beta1.MsgSendResponse")]
550pub struct MsgSendResponse {}
551pub struct NftQuerier<'a, Q: cosmwasm_std::CustomQuery> {
552    querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>,
553}
554impl<'a, Q: cosmwasm_std::CustomQuery> NftQuerier<'a, Q> {
555    pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self {
556        Self { querier }
557    }
558    pub fn balance(
559        &self,
560        class_id: ::prost::alloc::string::String,
561        owner: ::prost::alloc::string::String,
562    ) -> Result<QueryBalanceResponse, cosmwasm_std::StdError> {
563        QueryBalanceRequest { class_id, owner }.query(self.querier)
564    }
565    pub fn owner(
566        &self,
567        class_id: ::prost::alloc::string::String,
568        id: ::prost::alloc::string::String,
569    ) -> Result<QueryOwnerResponse, cosmwasm_std::StdError> {
570        QueryOwnerRequest { class_id, id }.query(self.querier)
571    }
572    pub fn supply(
573        &self,
574        class_id: ::prost::alloc::string::String,
575    ) -> Result<QuerySupplyResponse, cosmwasm_std::StdError> {
576        QuerySupplyRequest { class_id }.query(self.querier)
577    }
578    pub fn nf_ts(
579        &self,
580        class_id: ::prost::alloc::string::String,
581        owner: ::prost::alloc::string::String,
582        pagination: ::core::option::Option<super::super::base::query::v1beta1::PageRequest>,
583    ) -> Result<QueryNfTsResponse, cosmwasm_std::StdError> {
584        QueryNfTsRequest {
585            class_id,
586            owner,
587            pagination,
588        }
589        .query(self.querier)
590    }
591    pub fn nft(
592        &self,
593        class_id: ::prost::alloc::string::String,
594        id: ::prost::alloc::string::String,
595    ) -> Result<QueryNftResponse, cosmwasm_std::StdError> {
596        QueryNftRequest { class_id, id }.query(self.querier)
597    }
598    pub fn class(
599        &self,
600        class_id: ::prost::alloc::string::String,
601    ) -> Result<QueryClassResponse, cosmwasm_std::StdError> {
602        QueryClassRequest { class_id }.query(self.querier)
603    }
604    pub fn classes(
605        &self,
606        pagination: ::core::option::Option<super::super::base::query::v1beta1::PageRequest>,
607    ) -> Result<QueryClassesResponse, cosmwasm_std::StdError> {
608        QueryClassesRequest { pagination }.query(self.querier)
609    }
610}