Skip to content

Commit

Permalink
graphql: add support for retrieving the chain id (#21451)
Browse files Browse the repository at this point in the history
  • Loading branch information
islishude authored Aug 25, 2020
1 parent d13b8e5 commit 341f451
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions graphql/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,10 @@ func (r *Resolver) ProtocolVersion(ctx context.Context) (int32, error) {
return int32(r.backend.ProtocolVersion()), nil
}

func (r *Resolver) ChainID(ctx context.Context) (hexutil.Big, error) {
return hexutil.Big(*r.backend.ChainConfig().ChainID), nil
}

// SyncState represents the synchronisation status returned from the `syncing` accessor.
type SyncState struct {
progress ethereum.SyncProgress
Expand Down
2 changes: 2 additions & 0 deletions graphql/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ const schema string = `
protocolVersion: Int!
# Syncing returns information on the current synchronisation state.
syncing: SyncState
# ChainID returns the current chain ID for transaction replay protection.
chainID: BigInt!
}
type Mutation {
Expand Down

0 comments on commit 341f451

Please sign in to comment.