Skip to content

Commit c3325fd

Browse files
committed
graphql: add schema from go-ethereum
Signed-off-by: jsvisa <[email protected]>
1 parent dede08f commit c3325fd

File tree

1 file changed

+375
-0
lines changed

1 file changed

+375
-0
lines changed

graphql/schemas/schema.gql

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

0 commit comments

Comments
 (0)