github.com/ethereum/go-ethereum@v1.14.3/graphql/schema.go (about)

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