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