type Query {
  block(chainId: Int!, number: Int): Block
  blockByHash(chainId: Int!, hash: String!): Block
  blocks(chainId: Int!, page: Int, pageSize: Int): BlockConnection!
  
  transaction(chainId: Int!, hash: String!): Transaction
  transactions(chainId: Int!, page: Int, pageSize: Int): TransactionConnection!
  
  address(chainId: Int!, address: String!): Address
}

type Block {
  chainId: Int!
  number: Int!
  hash: String!
  parentHash: String!
  timestamp: String!
  miner: String!
  transactionCount: Int!
  gasUsed: Int!
  gasLimit: Int!
  transactions: [Transaction!]!
}

type Transaction {
  chainId: Int!
  hash: String!
  blockNumber: Int!
  from: String!
  to: String
  value: String!
  gasPrice: Int
  gasUsed: Int
  status: Int
  logs: [Log!]!
  trace: Trace
}

type Log {
  address: String!
  topics: [String!]!
  data: String!
  logIndex: Int!
}

type Trace {
  calls: [CallTrace!]!
}

type CallTrace {
  type: String!
  from: String!
  to: String!
  value: String!
  gas: Int!
  gasUsed: Int!
  input: String!
  output: String!
}

type Address {
  address: String!
  chainId: Int!
  transactionCount: Int!
  tokenCount: Int!
  isContract: Boolean!
  label: String
  tags: [String!]!
}

type BlockConnection {
  edges: [BlockEdge!]!
  pageInfo: PageInfo!
}

type BlockEdge {
  node: Block!
  cursor: String!
}

type TransactionConnection {
  edges: [TransactionEdge!]!
  pageInfo: PageInfo!
}

type TransactionEdge {
  node: Transaction!
  cursor: String!
}

type PageInfo {
  hasNextPage: Boolean!
  hasPreviousPage: Boolean!
  startCursor: String
  endCursor: String
}

type Subscription {
  newBlock(chainId: Int!): Block!
  newTransaction(chainId: Int!): Transaction!
}

