schema.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. // Copyright 2019 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. package graphql
  17. const schema string = `
  18. # Bytes32 is a 32 byte binary string, represented as 0x-prefixed hexadecimal.
  19. scalar Bytes32
  20. # Address is a 20 byte Ethereum address, represented as 0x-prefixed hexadecimal.
  21. scalar Address
  22. # Bytes is an arbitrary length binary string, represented as 0x-prefixed hexadecimal.
  23. # An empty byte string is represented as '0x'. Byte strings must have an even number of hexadecimal nybbles.
  24. scalar Bytes
  25. # BigInt is a large integer. Input is accepted as either a JSON number or as a string.
  26. # Strings may be either decimal or 0x-prefixed hexadecimal. Output values are all
  27. # 0x-prefixed hexadecimal.
  28. scalar BigInt
  29. # Long is a 64 bit unsigned integer.
  30. scalar Long
  31. schema {
  32. query: Query
  33. mutation: Mutation
  34. }
  35. # Account is an Ethereum account at a particular block.
  36. type Account {
  37. # Address is the address owning the account.
  38. address: Address!
  39. # Balance is the balance of the account, in wei.
  40. balance: BigInt!
  41. # TransactionCount is the number of transactions sent from this account,
  42. # or in the case of a contract, the number of contracts created. Otherwise
  43. # known as the nonce.
  44. transactionCount: Long!
  45. # Code contains the smart contract code for this account, if the account
  46. # is a (non-self-destructed) contract.
  47. code: Bytes!
  48. # Storage provides access to the storage of a contract account, indexed
  49. # by its 32 byte slot identifier.
  50. storage(slot: Bytes32!): Bytes32!
  51. }
  52. # Log is an Ethereum event log.
  53. type Log {
  54. # Index is the index of this log in the block.
  55. index: Int!
  56. # Account is the account which generated this log - this will always
  57. # be a contract account.
  58. account(block: Long): Account!
  59. # Topics is a list of 0-4 indexed topics for the log.
  60. topics: [Bytes32!]!
  61. # Data is unindexed data for this log.
  62. data: Bytes!
  63. # Transaction is the transaction that generated this log entry.
  64. transaction: Transaction!
  65. }
  66. #EIP-2718
  67. type AccessTuple{
  68. address: Address!
  69. storageKeys : [Bytes32!]!
  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 been 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. # MaxFeePerGas is the maximum fee per gas offered to include a transaction, in wei.
  91. maxFeePerGas: BigInt
  92. # MaxPriorityFeePerGas is the maximum miner tip per gas offered to include a transaction, in wei.
  93. maxPriorityFeePerGas: BigInt
  94. # EffectiveTip is the actual amount of reward going to miner after considering the max fee cap.
  95. effectiveTip: BigInt
  96. # Gas is the maximum amount of gas this transaction can consume.
  97. gas: Long!
  98. # InputData is the data supplied to the target of the transaction.
  99. inputData: Bytes!
  100. # Block is the block this transaction was mined in. This will be null if
  101. # the transaction has not yet been mined.
  102. block: Block
  103. # Status is the return status of the transaction. This will be 1 if the
  104. # transaction succeeded, or 0 if it failed (due to a revert, or due to
  105. # running out of gas). If the transaction has not yet been mined, this
  106. # field will be null.
  107. status: Long
  108. # GasUsed is the amount of gas that was used processing this transaction.
  109. # If the transaction has not yet been mined, this field will be null.
  110. gasUsed: Long
  111. # CumulativeGasUsed is the total gas used in the block up to and including
  112. # this transaction. If the transaction has not yet been mined, this field
  113. # will be null.
  114. cumulativeGasUsed: Long
  115. # EffectiveGasPrice is actual value per gas deducted from the sender's
  116. # account. Before EIP-1559, this is equal to the transaction's gas price.
  117. # After EIP-1559, it is baseFeePerGas + min(maxFeePerGas - baseFeePerGas,
  118. # maxPriorityFeePerGas). Legacy transactions and EIP-2930 transactions are
  119. # coerced into the EIP-1559 format by setting both maxFeePerGas and
  120. # maxPriorityFeePerGas as the transaction's gas price.
  121. effectiveGasPrice: BigInt
  122. # CreatedContract is the account that was created by a contract creation
  123. # transaction. If the transaction was not a contract creation transaction,
  124. # or it has not yet been mined, this field will be null.
  125. createdContract(block: Long): Account
  126. # Logs is a list of log entries emitted by this transaction. If the
  127. # transaction has not yet been mined, this field will be null.
  128. logs: [Log!]
  129. r: BigInt!
  130. s: BigInt!
  131. v: BigInt!
  132. # Envelope transaction support
  133. type: Int
  134. accessList: [AccessTuple!]
  135. # Raw is the canonical encoding of the transaction.
  136. # For legacy transactions, it returns the RLP encoding.
  137. # For EIP-2718 typed transactions, it returns the type and payload.
  138. raw: Bytes!
  139. # RawReceipt is the canonical encoding of the receipt. For post EIP-2718 typed transactions
  140. # this is equivalent to TxType || ReceiptEncoding.
  141. rawReceipt: Bytes!
  142. }
  143. # BlockFilterCriteria encapsulates log filter criteria for a filter applied
  144. # to a single block.
  145. input BlockFilterCriteria {
  146. # Addresses is list of addresses that are of interest. If this list is
  147. # empty, results will not be filtered by address.
  148. addresses: [Address!]
  149. # Topics list restricts matches to particular event topics. Each event has a list
  150. # of topics. Topics matches a prefix of that list. An empty element array matches any
  151. # topic. Non-empty elements represent an alternative that matches any of the
  152. # contained topics.
  153. #
  154. # Examples:
  155. # - [] or nil matches any topic list
  156. # - [[A]] matches topic A in first position
  157. # - [[], [B]] matches any topic in first position, B in second position
  158. # - [[A], [B]] matches topic A in first position, B in second position
  159. # - [[A, B]], [C, D]] matches topic (A OR B) in first position, (C OR D) in second position
  160. topics: [[Bytes32!]!]
  161. }
  162. # Block is an Ethereum block.
  163. type Block {
  164. # Number is the number of this block, starting at 0 for the genesis block.
  165. number: Long!
  166. # Hash is the block hash of this block.
  167. hash: Bytes32!
  168. # Parent is the parent block of this block.
  169. parent: Block
  170. # Nonce is the block nonce, an 8 byte sequence determined by the miner.
  171. nonce: Bytes!
  172. # TransactionsRoot is the keccak256 hash of the root of the trie of transactions in this block.
  173. transactionsRoot: Bytes32!
  174. # TransactionCount is the number of transactions in this block. if
  175. # transactions are not available for this block, this field will be null.
  176. transactionCount: Int
  177. # StateRoot is the keccak256 hash of the state trie after this block was processed.
  178. stateRoot: Bytes32!
  179. # ReceiptsRoot is the keccak256 hash of the trie of transaction receipts in this block.
  180. receiptsRoot: Bytes32!
  181. # Miner is the account that mined this block.
  182. miner(block: Long): Account!
  183. # ExtraData is an arbitrary data field supplied by the miner.
  184. extraData: Bytes!
  185. # GasLimit is the maximum amount of gas that was available to transactions in this block.
  186. gasLimit: Long!
  187. # GasUsed is the amount of gas that was used executing transactions in this block.
  188. gasUsed: Long!
  189. # BaseFeePerGas is the fee per unit of gas burned by the protocol in this block.
  190. baseFeePerGas: BigInt
  191. # NextBaseFeePerGas is the fee per unit of gas which needs to be burned in the next block.
  192. nextBaseFeePerGas: BigInt
  193. # Timestamp is the unix timestamp at which this block was mined.
  194. timestamp: Long!
  195. # LogsBloom is a bloom filter that can be used to check if a block may
  196. # contain log entries matching a filter.
  197. logsBloom: Bytes!
  198. # MixHash is the hash that was used as an input to the PoW process.
  199. mixHash: Bytes32!
  200. # Difficulty is a measure of the difficulty of mining this block.
  201. difficulty: BigInt!
  202. # TotalDifficulty is the sum of all difficulty values up to and including
  203. # this block.
  204. totalDifficulty: BigInt!
  205. # OmmerCount is the number of ommers (AKA uncles) associated with this
  206. # block. If ommers are unavailable, this field will be null.
  207. ommerCount: Int
  208. # Ommers is a list of ommer (AKA uncle) blocks associated with this block.
  209. # If ommers are unavailable, this field will be null. Depending on your
  210. # node, the transactions, transactionAt, transactionCount, ommers,
  211. # ommerCount and ommerAt fields may not be available on any ommer blocks.
  212. ommers: [Block]
  213. # OmmerAt returns the ommer (AKA uncle) at the specified index. If ommers
  214. # are unavailable, or the index is out of bounds, this field will be null.
  215. ommerAt(index: Int!): Block
  216. # OmmerHash is the keccak256 hash of all the ommers (AKA uncles)
  217. # associated with this block.
  218. ommerHash: Bytes32!
  219. # Transactions is a list of transactions associated with this block. If
  220. # transactions are unavailable for this block, this field will be null.
  221. transactions: [Transaction!]
  222. # TransactionAt returns the transaction at the specified index. If
  223. # transactions are unavailable for this block, or if the index is out of
  224. # bounds, this field will be null.
  225. transactionAt(index: Int!): Transaction
  226. # Logs returns a filtered set of logs from this block.
  227. logs(filter: BlockFilterCriteria!): [Log!]!
  228. # Account fetches an Ethereum account at the current block's state.
  229. account(address: Address!): Account!
  230. # Call executes a local call operation at the current block's state.
  231. call(data: CallData!): CallResult
  232. # EstimateGas estimates the amount of gas that will be required for
  233. # successful execution of a transaction at the current block's state.
  234. estimateGas(data: CallData!): Long!
  235. # RawHeader is the RLP encoding of the block's header.
  236. rawHeader: Bytes!
  237. # Raw is the RLP encoding of the block.
  238. raw: Bytes!
  239. }
  240. # CallData represents the data associated with a local contract call.
  241. # All fields are optional.
  242. input CallData {
  243. # From is the address making the call.
  244. from: Address
  245. # To is the address the call is sent to.
  246. to: Address
  247. # Gas is the amount of gas sent with the call.
  248. gas: Long
  249. # GasPrice is the price, in wei, offered for each unit of gas.
  250. gasPrice: BigInt
  251. # MaxFeePerGas is the maximum fee per gas offered, in wei.
  252. maxFeePerGas: BigInt
  253. # MaxPriorityFeePerGas is the maximum miner tip per gas offered, in wei.
  254. maxPriorityFeePerGas: BigInt
  255. # Value is the value, in wei, sent along with the call.
  256. value: BigInt
  257. # Data is the data sent to the callee.
  258. data: Bytes
  259. }
  260. # CallResult is the result of a local call operation.
  261. type CallResult {
  262. # Data is the return data of the called contract.
  263. data: Bytes!
  264. # GasUsed is the amount of gas used by the call, after any refunds.
  265. gasUsed: Long!
  266. # Status is the result of the call - 1 for success or 0 for failure.
  267. status: Long!
  268. }
  269. # FilterCriteria encapsulates log filter criteria for searching log entries.
  270. input FilterCriteria {
  271. # FromBlock is the block at which to start searching, inclusive. Defaults
  272. # to the latest block if not supplied.
  273. fromBlock: Long
  274. # ToBlock is the block at which to stop searching, inclusive. Defaults
  275. # to the latest block if not supplied.
  276. toBlock: Long
  277. # Addresses is a list of addresses that are of interest. If this list is
  278. # empty, results will not be filtered by address.
  279. addresses: [Address!]
  280. # Topics list restricts matches to particular event topics. Each event has a list
  281. # of topics. Topics matches a prefix of that list. An empty element array matches any
  282. # topic. Non-empty elements represent an alternative that matches any of the
  283. # contained topics.
  284. #
  285. # Examples:
  286. # - [] or nil matches any topic list
  287. # - [[A]] matches topic A in first position
  288. # - [[], [B]] matches any topic in first position, B in second position
  289. # - [[A], [B]] matches topic A in first position, B in second position
  290. # - [[A, B]], [C, D]] matches topic (A OR B) in first position, (C OR D) in second position
  291. topics: [[Bytes32!]!]
  292. }
  293. # SyncState contains the current synchronisation state of the client.
  294. type SyncState{
  295. # StartingBlock is the block number at which synchronisation started.
  296. startingBlock: Long!
  297. # CurrentBlock is the point at which synchronisation has presently reached.
  298. currentBlock: Long!
  299. # HighestBlock is the latest known block number.
  300. highestBlock: Long!
  301. }
  302. # Pending represents the current pending state.
  303. type Pending {
  304. # TransactionCount is the number of transactions in the pending state.
  305. transactionCount: Int!
  306. # Transactions is a list of transactions in the current pending state.
  307. transactions: [Transaction!]
  308. # Account fetches an Ethereum account for the pending state.
  309. account(address: Address!): Account!
  310. # Call executes a local call operation for the pending state.
  311. call(data: CallData!): CallResult
  312. # EstimateGas estimates the amount of gas that will be required for
  313. # successful execution of a transaction for the pending state.
  314. estimateGas(data: CallData!): Long!
  315. }
  316. type Query {
  317. # Block fetches an Ethereum block by number or by hash. If neither is
  318. # supplied, the most recent known block is returned.
  319. block(number: Long, hash: Bytes32): Block
  320. # Blocks returns all the blocks between two numbers, inclusive. If
  321. # to is not supplied, it defaults to the most recent known block.
  322. blocks(from: Long, to: Long): [Block!]!
  323. # Pending returns the current pending state.
  324. pending: Pending!
  325. # Transaction returns a transaction specified by its hash.
  326. transaction(hash: Bytes32!): Transaction
  327. # Logs returns log entries matching the provided filter.
  328. logs(filter: FilterCriteria!): [Log!]!
  329. # GasPrice returns the node's estimate of a gas price sufficient to
  330. # ensure a transaction is mined in a timely fashion.
  331. gasPrice: BigInt!
  332. # MaxPriorityFeePerGas returns the node's estimate of a gas tip sufficient
  333. # to ensure a transaction is mined in a timely fashion.
  334. maxPriorityFeePerGas: BigInt!
  335. # Syncing returns information on the current synchronisation state.
  336. syncing: SyncState
  337. # ChainID returns the current chain ID for transaction replay protection.
  338. chainID: BigInt!
  339. }
  340. type Mutation {
  341. # SendRawTransaction sends an RLP-encoded transaction to the network.
  342. sendRawTransaction(data: Bytes!): Bytes32!
  343. }
  344. `