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