sui_graphql_client/query_types/coin.rs
1// Copyright (c) Mysten Labs, Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4// ===========================================================================
5// Coin(s) Queries
6// ===========================================================================
7
8#[derive(cynic::QueryFragment, Debug)]
9#[cynic(schema = "rpc", graphql_type = "Query", variables = "CoinMetadataArgs")]
10pub struct CoinMetadataQuery {
11 #[arguments(coinType: $coin_type)]
12 pub coin_metadata: Option<CoinMetadata>,
13}
14
15// ===========================================================================
16// Coin(s) Query Args
17// ===========================================================================
18
19#[derive(cynic::QueryVariables, Debug)]
20pub struct CoinMetadataArgs<'a> {
21 pub coin_type: &'a str,
22}
23
24// ===========================================================================
25// Types
26// ===========================================================================
27
28use crate::query_types::schema;
29use crate::query_types::Address;
30use crate::query_types::BigInt;
31
32/// The coin metadata associated with the given coin type.
33#[derive(cynic::QueryFragment, Debug)]
34#[cynic(schema = "rpc", graphql_type = "CoinMetadata")]
35pub struct CoinMetadata {
36 /// The CoinMetadata object ID.
37 pub address: Address,
38 /// The number of decimal places used to represent the token.
39 pub decimals: Option<i32>,
40 /// Optional description of the token, provided by the creator of the token.
41 pub description: Option<String>,
42 /// Icon URL of the coin.
43 pub icon_url: Option<String>,
44 /// Full, official name of the token.
45 pub name: Option<String>,
46 /// The token's identifying abbreviation.
47 pub symbol: Option<String>,
48 /// The overall quantity of tokens that will be issued.
49 pub supply: Option<BigInt>,
50 /// Version of the token.
51 pub version: u64,
52}