go-ethereum: github.com/axiomzen/go-ethereum/graphql Index | Files

package graphql

import "github.com/axiomzen/go-ethereum/graphql"

Package graphql provides a GraphQL interface to Ethereum node data.

Index

Package Files

graphiql.go graphql.go schema.go service.go

Variables

var BlockInvariantError = errors.New("Block objects must be instantiated with at least one of num or hash.")
var OnlyOnMainChainError = errors.New("This operation is only available for blocks on the canonical chain.")

type Account Uses

type Account struct {
    // contains filtered or unexported fields
}

Account represents an Ethereum account at a particular block.

func (*Account) Address Uses

func (a *Account) Address(ctx context.Context) (common.Address, error)

func (*Account) Balance Uses

func (a *Account) Balance(ctx context.Context) (hexutil.Big, error)

func (*Account) Code Uses

func (a *Account) Code(ctx context.Context) (hexutil.Bytes, error)

func (*Account) Storage Uses

func (a *Account) Storage(ctx context.Context, args struct{ Slot common.Hash }) (common.Hash, error)

func (*Account) TransactionCount Uses

func (a *Account) TransactionCount(ctx context.Context) (hexutil.Uint64, error)

type Block Uses

type Block struct {
    // contains filtered or unexported fields
}

Block represents an Ethereum block. backend, and either num or hash are mandatory. All other fields are lazily fetched when required.

func (*Block) Account Uses

func (b *Block) Account(ctx context.Context, args struct {
    Address common.Address
}) (*Account, error)

func (*Block) Call Uses

func (b *Block) Call(ctx context.Context, args struct {
    Data ethapi.CallArgs
}) (*CallResult, error)

func (*Block) Difficulty Uses

func (b *Block) Difficulty(ctx context.Context) (hexutil.Big, error)

func (*Block) EstimateGas Uses

func (b *Block) EstimateGas(ctx context.Context, args struct {
    Data ethapi.CallArgs
}) (hexutil.Uint64, error)

func (*Block) ExtraData Uses

func (b *Block) ExtraData(ctx context.Context) (hexutil.Bytes, error)

func (*Block) GasLimit Uses

func (b *Block) GasLimit(ctx context.Context) (hexutil.Uint64, error)

func (*Block) GasUsed Uses

func (b *Block) GasUsed(ctx context.Context) (hexutil.Uint64, error)

func (*Block) Hash Uses

func (b *Block) Hash(ctx context.Context) (common.Hash, error)

func (*Block) Logs Uses

func (b *Block) Logs(ctx context.Context, args struct{ Filter BlockFilterCriteria }) ([]*Log, error)

func (*Block) LogsBloom Uses

func (b *Block) LogsBloom(ctx context.Context) (hexutil.Bytes, error)

func (*Block) Miner Uses

func (b *Block) Miner(ctx context.Context, args BlockNumberArgs) (*Account, error)

func (*Block) MixHash Uses

func (b *Block) MixHash(ctx context.Context) (common.Hash, error)

func (*Block) Nonce Uses

func (b *Block) Nonce(ctx context.Context) (hexutil.Bytes, error)

func (*Block) Number Uses

func (b *Block) Number(ctx context.Context) (hexutil.Uint64, error)

func (*Block) OmmerAt Uses

func (b *Block) OmmerAt(ctx context.Context, args struct{ Index int32 }) (*Block, error)

func (*Block) OmmerCount Uses

func (b *Block) OmmerCount(ctx context.Context) (*int32, error)

func (*Block) OmmerHash Uses

func (b *Block) OmmerHash(ctx context.Context) (common.Hash, error)

func (*Block) Ommers Uses

func (b *Block) Ommers(ctx context.Context) (*[]*Block, error)

func (*Block) Parent Uses

func (b *Block) Parent(ctx context.Context) (*Block, error)

func (*Block) ReceiptsRoot Uses

func (b *Block) ReceiptsRoot(ctx context.Context) (common.Hash, error)

func (*Block) StateRoot Uses

func (b *Block) StateRoot(ctx context.Context) (common.Hash, error)

func (*Block) Timestamp Uses

func (b *Block) Timestamp(ctx context.Context) (hexutil.Uint64, error)

func (*Block) TotalDifficulty Uses

func (b *Block) TotalDifficulty(ctx context.Context) (hexutil.Big, error)

func (*Block) TransactionAt Uses

func (b *Block) TransactionAt(ctx context.Context, args struct{ Index int32 }) (*Transaction, error)

func (*Block) TransactionCount Uses

func (b *Block) TransactionCount(ctx context.Context) (*int32, error)

func (*Block) Transactions Uses

func (b *Block) Transactions(ctx context.Context) (*[]*Transaction, error)

func (*Block) TransactionsRoot Uses

func (b *Block) TransactionsRoot(ctx context.Context) (common.Hash, error)

type BlockFilterCriteria Uses

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 Uses

type BlockNumberArgs struct {
    Block *hexutil.Uint64
}

BlockNumberArgs encapsulates arguments to accessors that specify a block number.

func (BlockNumberArgs) Number Uses

func (a BlockNumberArgs) Number() rpc.BlockNumber

Number returns the provided block number, or rpc.LatestBlockNumber if none was provided.

type BlockType Uses

type BlockType int

type CallData Uses

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 Uses

type CallResult struct {
    // contains filtered or unexported fields
}

CallResult encapsulates the result of an invocation of the `call` accessor.

func (*CallResult) Data Uses

func (c *CallResult) Data() hexutil.Bytes

func (*CallResult) GasUsed Uses

func (c *CallResult) GasUsed() hexutil.Uint64

func (*CallResult) Status Uses

func (c *CallResult) Status() hexutil.Uint64

type FilterCriteria Uses

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 Uses

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.

func (GraphiQL) ServeHTTP Uses

func (h GraphiQL) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Log Uses

type Log struct {
    // contains filtered or unexported fields
}

Log represents an individual log message. All arguments are mandatory.

func (*Log) Account Uses

func (l *Log) Account(ctx context.Context, args BlockNumberArgs) *Account

func (*Log) Data Uses

func (l *Log) Data(ctx context.Context) hexutil.Bytes

func (*Log) Index Uses

func (l *Log) Index(ctx context.Context) int32

func (*Log) Topics Uses

func (l *Log) Topics(ctx context.Context) []common.Hash

func (*Log) Transaction Uses

func (l *Log) Transaction(ctx context.Context) *Transaction

type Pending Uses

type Pending struct {
    // contains filtered or unexported fields
}

func (*Pending) Account Uses

func (p *Pending) Account(ctx context.Context, args struct {
    Address common.Address
}) *Account

func (*Pending) Call Uses

func (p *Pending) Call(ctx context.Context, args struct {
    Data ethapi.CallArgs
}) (*CallResult, error)

func (*Pending) EstimateGas Uses

func (p *Pending) EstimateGas(ctx context.Context, args struct {
    Data ethapi.CallArgs
}) (hexutil.Uint64, error)

func (*Pending) TransactionCount Uses

func (p *Pending) TransactionCount(ctx context.Context) (int32, error)

func (*Pending) Transactions Uses

func (p *Pending) Transactions(ctx context.Context) (*[]*Transaction, error)

type Resolver Uses

type Resolver struct {
    // contains filtered or unexported fields
}

Resolver is the top-level object in the GraphQL hierarchy.

func (*Resolver) Block Uses

func (r *Resolver) Block(ctx context.Context, args struct {
    Number *hexutil.Uint64
    Hash   *common.Hash
}) (*Block, error)

func (*Resolver) Blocks Uses

func (r *Resolver) Blocks(ctx context.Context, args struct {
    From hexutil.Uint64
    To   *hexutil.Uint64
}) ([]*Block, error)

func (*Resolver) GasPrice Uses

func (r *Resolver) GasPrice(ctx context.Context) (hexutil.Big, error)

func (*Resolver) Logs Uses

func (r *Resolver) Logs(ctx context.Context, args struct{ Filter FilterCriteria }) ([]*Log, error)

func (*Resolver) Pending Uses

func (r *Resolver) Pending(ctx context.Context) *Pending

func (*Resolver) ProtocolVersion Uses

func (r *Resolver) ProtocolVersion(ctx context.Context) (int32, error)

func (*Resolver) SendRawTransaction Uses

func (r *Resolver) SendRawTransaction(ctx context.Context, args struct{ Data hexutil.Bytes }) (common.Hash, error)

func (*Resolver) Syncing Uses

func (r *Resolver) Syncing() (*SyncState, 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 (*Resolver) Transaction Uses

func (r *Resolver) Transaction(ctx context.Context, args struct{ Hash common.Hash }) (*Transaction, error)

type Service Uses

type Service struct {
    // contains filtered or unexported fields
}

Service encapsulates a GraphQL service.

func New Uses

func New(backend ethapi.Backend, endpoint string, cors, vhosts []string, timeouts rpc.HTTPTimeouts) (*Service, error)

New constructs a new GraphQL service instance.

func (*Service) APIs Uses

func (s *Service) APIs() []rpc.API

APIs returns the list of APIs exported by this service.

func (*Service) Protocols Uses

func (s *Service) Protocols() []p2p.Protocol

Protocols returns the list of protocols exported by this service.

func (*Service) Start Uses

func (s *Service) Start(server *p2p.Server) error

Start is called after all services have been constructed and the networking layer was also initialized to spawn any goroutines required by the service.

func (*Service) Stop Uses

func (s *Service) Stop() error

Stop terminates all goroutines belonging to the service, blocking until they are all terminated.

type SyncState Uses

type SyncState struct {
    // contains filtered or unexported fields
}

SyncState represents the synchronisation status returned from the `syncing` accessor.

func (*SyncState) CurrentBlock Uses

func (s *SyncState) CurrentBlock() hexutil.Uint64

func (*SyncState) HighestBlock Uses

func (s *SyncState) HighestBlock() hexutil.Uint64

func (*SyncState) KnownStates Uses

func (s *SyncState) KnownStates() *hexutil.Uint64

func (*SyncState) PulledStates Uses

func (s *SyncState) PulledStates() *hexutil.Uint64

func (*SyncState) StartingBlock Uses

func (s *SyncState) StartingBlock() hexutil.Uint64

type Transaction Uses

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 (*Transaction) Block Uses

func (t *Transaction) Block(ctx context.Context) (*Block, error)

func (*Transaction) CreatedContract Uses

func (t *Transaction) CreatedContract(ctx context.Context, args BlockNumberArgs) (*Account, error)

func (*Transaction) CumulativeGasUsed Uses

func (t *Transaction) CumulativeGasUsed(ctx context.Context) (*hexutil.Uint64, error)

func (*Transaction) From Uses

func (t *Transaction) From(ctx context.Context, args BlockNumberArgs) (*Account, error)

func (*Transaction) Gas Uses

func (t *Transaction) Gas(ctx context.Context) (hexutil.Uint64, error)

func (*Transaction) GasPrice Uses

func (t *Transaction) GasPrice(ctx context.Context) (hexutil.Big, error)

func (*Transaction) GasUsed Uses

func (t *Transaction) GasUsed(ctx context.Context) (*hexutil.Uint64, error)

func (*Transaction) Hash Uses

func (tx *Transaction) Hash(ctx context.Context) common.Hash

func (*Transaction) Index Uses

func (t *Transaction) Index(ctx context.Context) (*int32, error)

func (*Transaction) InputData Uses

func (t *Transaction) InputData(ctx context.Context) (hexutil.Bytes, error)

func (*Transaction) Logs Uses

func (t *Transaction) Logs(ctx context.Context) (*[]*Log, error)

func (*Transaction) Nonce Uses

func (t *Transaction) Nonce(ctx context.Context) (hexutil.Uint64, error)

func (*Transaction) Status Uses

func (t *Transaction) Status(ctx context.Context) (*hexutil.Uint64, error)

func (*Transaction) To Uses

func (t *Transaction) To(ctx context.Context, args BlockNumberArgs) (*Account, error)

func (*Transaction) Value Uses

func (t *Transaction) Value(ctx context.Context) (hexutil.Big, error)

Package graphql imports 22 packages (graph). Updated 2019-07-06. Refresh now. Tools for package owners.