import "github.com/ethereum/go-ethereum/graphql"
Package graphql provides a GraphQL interface to Ethereum node data.
graphiql.go graphql.go schema.go service.go
New constructs a new GraphQL service instance.
type Account struct {
// contains filtered or unexported fields
}
Account represents an Ethereum account at a particular block.
func (a *Account) Storage(ctx context.Context, args struct{ Slot common.Hash }) (common.Hash, error)
type Block struct {
// contains filtered or unexported fields
}
Block represents an Ethereum block. backend, and numberOrHash are mandatory. All other fields are lazily fetched when required.
func (b *Block) Account(ctx context.Context, args struct { Address common.Address }) (*Account, error)
func (b *Block) Call(ctx context.Context, args struct { Data ethapi.CallArgs }) (*CallResult, error)
func (b *Block) EstimateGas(ctx context.Context, args struct { Data ethapi.CallArgs }) (Long, error)
func (b *Block) Logs(ctx context.Context, args struct{ Filter BlockFilterCriteria }) ([]*Log, error)
func (b *Block) TransactionAt(ctx context.Context, args struct{ Index int32 }) (*Transaction, error)
type BlockFilterCriteria struct { Addresses *[]common.Address // restricts matches to events created by specific contracts // The Topic list restricts matches to particular event topics. Each event has a list // of topics. Topics matches a prefix of that list. An empty element slice matches any // topic. Non-empty elements represent an alternative that matches any of the // contained topics. // // Examples: // {} or nil matches any topic list // {{A}} matches topic A in first position // {{}, {B}} matches any topic in first position, B in second position // {{A}, {B}} matches topic A in first position, B in second position // {{A, B}}, {C, D}} matches topic (A OR B) in first position, (C OR D) in second position Topics *[][]common.Hash }
BlockFilterCriteria encapsulates criteria passed to a `logs` accessor inside a block.
type BlockNumberArgs struct { // TODO: Ideally we could use input unions to allow the query to specify the // block parameter by hash, block number, or tag but input unions aren't part of the // standard GraphQL schema SDL yet, see: https://github.com/graphql/graphql-spec/issues/488 Block *hexutil.Uint64 }
BlockNumberArgs encapsulates arguments to accessors that specify a block number.
func (a BlockNumberArgs) NumberOr(current rpc.BlockNumberOrHash) rpc.BlockNumberOrHash
NumberOr returns the provided block number argument, or the "current" block number or hash if none was provided.
func (a BlockNumberArgs) NumberOrLatest() rpc.BlockNumberOrHash
NumberOrLatest returns the provided block number argument, or the "latest" block number if none was provided.
type CallData struct { From *common.Address // The Ethereum address the call is from. To *common.Address // The Ethereum address the call is to. Gas *hexutil.Uint64 // The amount of gas provided for the call. GasPrice *hexutil.Big // The price of each unit of gas, in wei. Value *hexutil.Big // The value sent along with the call. Data *hexutil.Bytes // Any data sent with the call. }
CallData encapsulates arguments to `call` or `estimateGas`. All arguments are optional.
type CallResult struct {
// contains filtered or unexported fields
}
CallResult encapsulates the result of an invocation of the `call` accessor.
func (c *CallResult) Data() hexutil.Bytes
func (c *CallResult) GasUsed() Long
func (c *CallResult) Status() Long
type FilterCriteria struct { FromBlock *hexutil.Uint64 // beginning of the queried range, nil means genesis block ToBlock *hexutil.Uint64 // end of the range, nil means latest block Addresses *[]common.Address // restricts matches to events created by specific contracts // The Topic list restricts matches to particular event topics. Each event has a list // of topics. Topics matches a prefix of that list. An empty element slice matches any // topic. Non-empty elements represent an alternative that matches any of the // contained topics. // // Examples: // {} or nil matches any topic list // {{A}} matches topic A in first position // {{}, {B}} matches any topic in first position, B in second position // {{A}, {B}} matches topic A in first position, B in second position // {{A, B}}, {C, D}} matches topic (A OR B) in first position, (C OR D) in second position Topics *[][]common.Hash }
FilterCriteria encapsulates the arguments to `logs` on the root resolver object.
type GraphiQL struct{}
GraphiQL is an in-browser IDE for exploring GraphiQL APIs. This handler returns GraphiQL when requested.
For more information, see https://github.com/graphql/graphiql.
type Log struct {
// contains filtered or unexported fields
}
Log represents an individual log message. All arguments are mandatory.
func (l *Log) Transaction(ctx context.Context) *Transaction
ImplementsGraphQLType returns true if Long implements the provided GraphQL type.
UnmarshalGraphQL unmarshals the provided GraphQL query data.
type Pending struct {
// contains filtered or unexported fields
}
func (p *Pending) Call(ctx context.Context, args struct { Data ethapi.CallArgs }) (*CallResult, error)
func (p *Pending) EstimateGas(ctx context.Context, args struct { Data ethapi.CallArgs }) (Long, error)
type Resolver struct {
// contains filtered or unexported fields
}
Resolver is the top-level object in the GraphQL hierarchy.
func (r *Resolver) Block(ctx context.Context, args struct { Number *Long Hash *common.Hash }) (*Block, error)
func (r *Resolver) Blocks(ctx context.Context, args struct { From *Long To *Long }) ([]*Block, error)
func (r *Resolver) SendRawTransaction(ctx context.Context, args struct{ Data hexutil.Bytes }) (common.Hash, error)
Syncing returns false in case the node is currently not syncing with the network. It can be up to date or has not yet received the latest block headers from its pears. In case it is synchronizing: - startingBlock: block number this node started to synchronise from - currentBlock: block number this node is currently importing - highestBlock: block number of the highest block header this node has received from peers - pulledStates: number of state entries processed until now - knownStates: number of known state entries that still need to be pulled
func (r *Resolver) Transaction(ctx context.Context, args struct{ Hash common.Hash }) (*Transaction, error)
type SyncState struct {
// contains filtered or unexported fields
}
SyncState represents the synchronisation status returned from the `syncing` accessor.
type Transaction struct {
// contains filtered or unexported fields
}
Transaction represents an Ethereum transaction. backend and hash are mandatory; all others will be fetched when required.
func (t *Transaction) CreatedContract(ctx context.Context, args BlockNumberArgs) (*Account, error)
func (t *Transaction) From(ctx context.Context, args BlockNumberArgs) (*Account, error)
func (t *Transaction) To(ctx context.Context, args BlockNumberArgs) (*Account, error)
Package graphql imports 21 packages (graph) and is imported by 2 packages. Updated 2021-01-28. Refresh now. Tools for package owners.