Skip to main content

mina_sdk/
queries.rs

1//! GraphQL query and mutation strings for the Mina daemon API.
2
3pub const SYNC_STATUS: &str = r#"query { syncStatus }"#;
4
5pub const DAEMON_STATUS: &str = r#"query {
6    daemonStatus {
7        syncStatus
8        blockchainLength
9        highestBlockLengthReceived
10        uptimeSecs
11        stateHash
12        commitId
13        peers {
14            peerId
15            host
16            libp2pPort
17        }
18    }
19}"#;
20
21pub const NETWORK_ID: &str = r#"query { networkID }"#;
22
23pub const GET_ACCOUNT: &str = r#"query ($publicKey: PublicKey!) {
24    account(publicKey: $publicKey) {
25        publicKey
26        nonce
27        delegate
28        tokenId
29        balance {
30            total
31            liquid
32            locked
33        }
34    }
35}"#;
36
37pub const GET_ACCOUNT_WITH_TOKEN: &str = r#"query ($publicKey: PublicKey!, $token: TokenId!) {
38    account(publicKey: $publicKey, token: $token) {
39        publicKey
40        nonce
41        delegate
42        tokenId
43        balance {
44            total
45            liquid
46            locked
47        }
48    }
49}"#;
50
51pub const BEST_CHAIN: &str = r#"query ($maxLength: Int) {
52    bestChain(maxLength: $maxLength) {
53        stateHash
54        commandTransactionCount
55        creatorAccount {
56            publicKey
57        }
58        protocolState {
59            consensusState {
60                blockHeight
61                slotSinceGenesis
62                slot
63            }
64        }
65    }
66}"#;
67
68pub const GET_PEERS: &str = r#"query {
69    getPeers {
70        peerId
71        host
72        libp2pPort
73    }
74}"#;
75
76pub const POOLED_USER_COMMANDS: &str = r#"query ($publicKey: PublicKey) {
77    pooledUserCommands(publicKey: $publicKey) {
78        id
79        hash
80        kind
81        nonce
82        amount
83        fee
84        from
85        to
86    }
87}"#;
88
89pub const SEND_PAYMENT: &str = r#"mutation ($input: SendPaymentInput!) {
90    sendPayment(input: $input) {
91        payment {
92            id
93            hash
94            nonce
95        }
96    }
97}"#;
98
99pub const SEND_DELEGATION: &str = r#"mutation ($input: SendDelegationInput!) {
100    sendDelegation(input: $input) {
101        delegation {
102            id
103            hash
104            nonce
105        }
106    }
107}"#;
108
109pub const SET_SNARK_WORKER: &str = r#"mutation ($input: SetSnarkWorkerInput!) {
110    setSnarkWorker(input: $input) {
111        lastSnarkWorker
112    }
113}"#;
114
115pub const SET_SNARK_WORK_FEE: &str = r#"mutation ($fee: UInt64!) {
116    setSnarkWorkFee(input: {fee: $fee}) {
117        lastFee
118    }
119}"#;