github.com/aigarnetwork/aigar@v0.0.0-20191115204914-d59a6eb70f8e/graphql/schema.go (about) 1 // Copyright 2018 The go-ethereum Authors 2 // Copyright 2019 The go-aigar Authors 3 // This file is part of the go-aigar library. 4 // 5 // The go-aigar library is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU Lesser General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // The go-aigar library is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU Lesser General Public License for more details. 14 // 15 // You should have received a copy of the GNU Lesser General Public License 16 // along with the go-aigar library. If not, see <http://www.gnu.org/licenses/>. 17 18 package graphql 19 20 const schema string = ` 21 # Bytes32 is a 32 byte binary string, represented as 0x-prefixed hexadecimal. 22 scalar Bytes32 23 # Address is a 20 byte Ethereum address, represented as 0x-prefixed hexadecimal. 24 scalar Address 25 # Bytes is an arbitrary length binary string, represented as 0x-prefixed hexadecimal. 26 # An empty byte string is represented as '0x'. Byte strings must have an even number of hexadecimal nybbles. 27 scalar Bytes 28 # BigInt is a large integer. Input is accepted as either a JSON number or as a string. 29 # Strings may be either decimal or 0x-prefixed hexadecimal. Output values are all 30 # 0x-prefixed hexadecimal. 31 scalar BigInt 32 # Long is a 64 bit unsigned integer. 33 scalar Long 34 35 schema { 36 query: Query 37 mutation: Mutation 38 } 39 40 # Account is an Ethereum account at a particular block. 41 type Account { 42 # Address is the address owning the account. 43 address: Address! 44 # Balance is the balance of the account, in wei. 45 balance: BigInt! 46 # TransactionCount is the number of transactions sent from this account, 47 # or in the case of a contract, the number of contracts created. Otherwise 48 # known as the nonce. 49 transactionCount: Long! 50 # Code contains the smart contract code for this account, if the account 51 # is a (non-self-destructed) contract. 52 code: Bytes! 53 # Storage provides access to the storage of a contract account, indexed 54 # by its 32 byte slot identifier. 55 storage(slot: Bytes32!): Bytes32! 56 } 57 58 # Log is an Ethereum event log. 59 type Log { 60 # Index is the index of this log in the block. 61 index: Int! 62 # Account is the account which generated this log - this will always 63 # be a contract account. 64 account(block: Long): Account! 65 # Topics is a list of 0-4 indexed topics for the log. 66 topics: [Bytes32!]! 67 # Data is unindexed data for this log. 68 data: Bytes! 69 # Transaction is the transaction that generated this log entry. 70 transaction: Transaction! 71 } 72 73 # Transaction is an Ethereum transaction. 74 type Transaction { 75 # Hash is the hash of this transaction. 76 hash: Bytes32! 77 # Nonce is the nonce of the account this transaction was generated with. 78 nonce: Long! 79 # Index is the index of this transaction in the parent block. This will 80 # be null if the transaction has not yet been mined. 81 index: Int 82 # From is the account that sent this transaction - this will always be 83 # an externally owned account. 84 from(block: Long): Account! 85 # To is the account the transaction was sent to. This is null for 86 # contract-creating transactions. 87 to(block: Long): Account 88 # Value is the value, in wei, sent along with this transaction. 89 value: BigInt! 90 # GasPrice is the price offered to miners for gas, in wei per unit. 91 gasPrice: BigInt! 92 # Gas is the maximum amount of gas this transaction can consume. 93 gas: Long! 94 # InputData is the data supplied to the target of the transaction. 95 inputData: Bytes! 96 # Block is the block this transaction was mined in. This will be null if 97 # the transaction has not yet been mined. 98 block: Block 99 100 # Status is the return status of the transaction. This will be 1 if the 101 # transaction succeeded, or 0 if it failed (due to a revert, or due to 102 # running out of gas). If the transaction has not yet been mined, this 103 # field will be null. 104 status: Long 105 # GasUsed is the amount of gas that was used processing this transaction. 106 # If the transaction has not yet been mined, this field will be null. 107 gasUsed: Long 108 # CumulativeGasUsed is the total gas used in the block up to and including 109 # this transaction. If the transaction has not yet been mined, this field 110 # will be null. 111 cumulativeGasUsed: Long 112 # CreatedContract is the account that was created by a contract creation 113 # transaction. If the transaction was not a contract creation transaction, 114 # or it has not yet been mined, this field will be null. 115 createdContract(block: Long): Account 116 # Logs is a list of log entries emitted by this transaction. If the 117 # transaction has not yet been mined, this field will be null. 118 logs: [Log!] 119 } 120 121 # BlockFilterCriteria encapsulates log filter criteria for a filter applied 122 # to a single block. 123 input BlockFilterCriteria { 124 # Addresses is list of addresses that are of interest. If this list is 125 # empty, results will not be filtered by address. 126 addresses: [Address!] 127 # Topics list restricts matches to particular event topics. Each event has a list 128 # of topics. Topics matches a prefix of that list. An empty element array matches any 129 # topic. Non-empty elements represent an alternative that matches any of the 130 # contained topics. 131 # 132 # Examples: 133 # - [] or nil matches any topic list 134 # - [[A]] matches topic A in first position 135 # - [[], [B]] matches any topic in first position, B in second position 136 # - [[A], [B]] matches topic A in first position, B in second position 137 # - [[A, B]], [C, D]] matches topic (A OR B) in first position, (C OR D) in second position 138 topics: [[Bytes32!]!] 139 } 140 141 # Block is an Ethereum block. 142 type Block { 143 # Number is the number of this block, starting at 0 for the genesis block. 144 number: Long! 145 # Hash is the block hash of this block. 146 hash: Bytes32! 147 # Parent is the parent block of this block. 148 parent: Block 149 # Nonce is the block nonce, an 8 byte sequence determined by the miner. 150 nonce: Bytes! 151 # TransactionsRoot is the keccak256 hash of the root of the trie of transactions in this block. 152 transactionsRoot: Bytes32! 153 # TransactionCount is the number of transactions in this block. if 154 # transactions are not available for this block, this field will be null. 155 transactionCount: Int 156 # StateRoot is the keccak256 hash of the state trie after this block was processed. 157 stateRoot: Bytes32! 158 # ReceiptsRoot is the keccak256 hash of the trie of transaction receipts in this block. 159 receiptsRoot: Bytes32! 160 # Miner is the account that mined this block. 161 miner(block: Long): Account! 162 # ExtraData is an arbitrary data field supplied by the miner. 163 extraData: Bytes! 164 # GasLimit is the maximum amount of gas that was available to transactions in this block. 165 gasLimit: Long! 166 # GasUsed is the amount of gas that was used executing transactions in this block. 167 gasUsed: Long! 168 # Timestamp is the unix timestamp at which this block was mined. 169 timestamp: Long! 170 # LogsBloom is a bloom filter that can be used to check if a block may 171 # contain log entries matching a filter. 172 logsBloom: Bytes! 173 # MixHash is the hash that was used as an input to the PoW process. 174 mixHash: Bytes32! 175 # Difficulty is a measure of the difficulty of mining this block. 176 difficulty: BigInt! 177 # TotalDifficulty is the sum of all difficulty values up to and including 178 # this block. 179 totalDifficulty: BigInt! 180 # OmmerCount is the number of ommers (AKA uncles) associated with this 181 # block. If ommers are unavailable, this field will be null. 182 ommerCount: Int 183 # Ommers is a list of ommer (AKA uncle) blocks associated with this block. 184 # If ommers are unavailable, this field will be null. Depending on your 185 # node, the transactions, transactionAt, transactionCount, ommers, 186 # ommerCount and ommerAt fields may not be available on any ommer blocks. 187 ommers: [Block] 188 # OmmerAt returns the ommer (AKA uncle) at the specified index. If ommers 189 # are unavailable, or the index is out of bounds, this field will be null. 190 ommerAt(index: Int!): Block 191 # OmmerHash is the keccak256 hash of all the ommers (AKA uncles) 192 # associated with this block. 193 ommerHash: Bytes32! 194 # Transactions is a list of transactions associated with this block. If 195 # transactions are unavailable for this block, this field will be null. 196 transactions: [Transaction!] 197 # TransactionAt returns the transaction at the specified index. If 198 # transactions are unavailable for this block, or if the index is out of 199 # bounds, this field will be null. 200 transactionAt(index: Int!): Transaction 201 # Logs returns a filtered set of logs from this block. 202 logs(filter: BlockFilterCriteria!): [Log!]! 203 # Account fetches an Ethereum account at the current block's state. 204 account(address: Address!): Account! 205 # Call executes a local call operation at the current block's state. 206 call(data: CallData!): CallResult 207 # EstimateGas estimates the amount of gas that will be required for 208 # successful execution of a transaction at the current block's state. 209 estimateGas(data: CallData!): Long! 210 } 211 212 # CallData represents the data associated with a local contract call. 213 # All fields are optional. 214 input CallData { 215 # From is the address making the call. 216 from: Address 217 # To is the address the call is sent to. 218 to: Address 219 # Gas is the amount of gas sent with the call. 220 gas: Long 221 # GasPrice is the price, in wei, offered for each unit of gas. 222 gasPrice: BigInt 223 # Value is the value, in wei, sent along with the call. 224 value: BigInt 225 # Data is the data sent to the callee. 226 data: Bytes 227 } 228 229 # CallResult is the result of a local call operation. 230 type CallResult { 231 # Data is the return data of the called contract. 232 data: Bytes! 233 # GasUsed is the amount of gas used by the call, after any refunds. 234 gasUsed: Long! 235 # Status is the result of the call - 1 for success or 0 for failure. 236 status: Long! 237 } 238 239 # FilterCriteria encapsulates log filter criteria for searching log entries. 240 input FilterCriteria { 241 # FromBlock is the block at which to start searching, inclusive. Defaults 242 # to the latest block if not supplied. 243 fromBlock: Long 244 # ToBlock is the block at which to stop searching, inclusive. Defaults 245 # to the latest block if not supplied. 246 toBlock: Long 247 # Addresses is a list of addresses that are of interest. If this list is 248 # empty, results will not be filtered by address. 249 addresses: [Address!] 250 # Topics list restricts matches to particular event topics. Each event has a list 251 # of topics. Topics matches a prefix of that list. An empty element array matches any 252 # topic. Non-empty elements represent an alternative that matches any of the 253 # contained topics. 254 # 255 # Examples: 256 # - [] or nil matches any topic list 257 # - [[A]] matches topic A in first position 258 # - [[], [B]] matches any topic in first position, B in second position 259 # - [[A], [B]] matches topic A in first position, B in second position 260 # - [[A, B]], [C, D]] matches topic (A OR B) in first position, (C OR D) in second position 261 topics: [[Bytes32!]!] 262 } 263 264 # SyncState contains the current synchronisation state of the client. 265 type SyncState{ 266 # StartingBlock is the block number at which synchronisation started. 267 startingBlock: Long! 268 # CurrentBlock is the point at which synchronisation has presently reached. 269 currentBlock: Long! 270 # HighestBlock is the latest known block number. 271 highestBlock: Long! 272 # PulledStates is the number of state entries fetched so far, or null 273 # if this is not known or not relevant. 274 pulledStates: Long 275 # KnownStates is the number of states the node knows of so far, or null 276 # if this is not known or not relevant. 277 knownStates: Long 278 } 279 280 # Pending represents the current pending state. 281 type Pending { 282 # TransactionCount is the number of transactions in the pending state. 283 transactionCount: Int! 284 # Transactions is a list of transactions in the current pending state. 285 transactions: [Transaction!] 286 # Account fetches an Ethereum account for the pending state. 287 account(address: Address!): Account! 288 # Call executes a local call operation for the pending state. 289 call(data: CallData!): CallResult 290 # EstimateGas estimates the amount of gas that will be required for 291 # successful execution of a transaction for the pending state. 292 estimateGas(data: CallData!): Long! 293 } 294 295 type Query { 296 # Block fetches an Ethereum block by number or by hash. If neither is 297 # supplied, the most recent known block is returned. 298 block(number: Long, hash: Bytes32): Block 299 # Blocks returns all the blocks between two numbers, inclusive. If 300 # to is not supplied, it defaults to the most recent known block. 301 blocks(from: Long!, to: Long): [Block!]! 302 # Pending returns the current pending state. 303 pending: Pending! 304 # Transaction returns a transaction specified by its hash. 305 transaction(hash: Bytes32!): Transaction 306 # Logs returns log entries matching the provided filter. 307 logs(filter: FilterCriteria!): [Log!]! 308 # GasPrice returns the node's estimate of a gas price sufficient to 309 # ensure a transaction is mined in a timely fashion. 310 gasPrice: BigInt! 311 # ProtocolVersion returns the current wire protocol version number. 312 protocolVersion: Int! 313 # Syncing returns information on the current synchronisation state. 314 syncing: SyncState 315 } 316 317 type Mutation { 318 # SendRawTransaction sends an RLP-encoded transaction to the network. 319 sendRawTransaction(data: Bytes!): Bytes32! 320 } 321 `