scalar BigInt

scalar Bytes

scalar BigDecimal

input Block_height {
  hash: Bytes
  number: Int
}

type Proof {
  data: String!
}

type ResultBoolean {
  value: Boolean!
  proof: Proof
}

type ResultString {
  value: String!
  proof: Proof
}

type ResultInt {
  value: Int!
  proof: Proof
}

type ResultBigInt {
  value: BigInt!
  proof: Proof
}

type _Block_ {
  cid: String!
  hash: String!
  number: Int!
  timestamp: Int!
  parentHash: String!
}

type _Transaction_ {
  hash: String!
  index: Int!
  from: String!
  to: String!
}

type ResultEvent {
  block: _Block_!
  tx: _Transaction_!
  contract: String!
  eventIndex: Int!
  event: Event!
  proof: Proof
}

union Event = TransferEvent | ApprovalEvent | AuthorizationUsedEvent | AdminUpdatedEvent | TaxRateUpdatedEvent | SlotClaimedEvent | SlotDelegateUpdatedEvent | StakeEvent | UnstakeEvent | WithdrawEvent | ApprovalForAllEvent | BlockProducerAddedEvent | BlockProducerRemovedEvent | BlockProducerRewardCollectorChangedEvent | ClaimedEvent | SlashedEvent | MerkleRootUpdatedEvent | AccountUpdatedEvent | PermanentURIEvent | GovernanceChangedEvent | UpdateThresholdChangedEvent | RoleAdminChangedEvent | RoleGrantedEvent | RoleRevokedEvent | RewardScheduleChangedEvent

type TransferEvent {
  from: String!
  to: String!
  value: BigInt
  tokenId: BigInt
}

type ApprovalEvent {
  owner: String!
  spender: String
  value: BigInt
  approved: String
  tokenId: BigInt
}

type AuthorizationUsedEvent {
  authorizer: String!
  nonce: String!
}

type AdminUpdatedEvent {
  newAdmin: String!
  oldAdmin: String!
}

type TaxRateUpdatedEvent {
  newNumerator: Int!
  newDenominator: Int!
  oldNumerator: Int!
  oldDenominator: Int!
}

type SlotClaimedEvent {
  slot: Int!
  owner: String!
  delegate: String!
  newBidAmount: BigInt!
  oldBidAmount: BigInt!
  taxNumerator: Int!
  taxDenominator: Int!
}

type SlotDelegateUpdatedEvent {
  slot: Int!
  owner: String!
  newDelegate: String!
  oldDelegate: String!
}

type StakeEvent {
  staker: String!
  stakeAmount: BigInt!
}

type UnstakeEvent {
  staker: String!
  unstakedAmount: BigInt!
}

type WithdrawEvent {
  withdrawer: String!
  withdrawalAmount: BigInt!
}

type ApprovalForAllEvent {
  owner: String!
  operator: String!
  approved: Boolean!
}

type BlockProducerAddedEvent {
  producer: String!
}

type BlockProducerRemovedEvent {
  producer: String!
}

type BlockProducerRewardCollectorChangedEvent {
  producer: String!
  collector: String!
}

type RewardScheduleChangedEvent {
  # Note: dummy property added as server throws an error for type without any fields.
  dummy: String
}

type ClaimedEvent {
  index: BigInt!
  totalEarned: BigInt!
  account: String!
  claimed: BigInt!
}

type SlashedEvent {
  account: String!
  slashed: BigInt!
}

type MerkleRootUpdatedEvent {
  merkleRoot: String!
  distributionNumber: BigInt!
  metadataURI: String!
}

type AccountUpdatedEvent {
  account: String!
  totalClaimed: BigInt!
  totalSlashed: BigInt!
}

type PermanentURIEvent {
  value: String!
  id: BigInt!
}

type GovernanceChangedEvent {
  from: String!
  to: String!
}

type UpdateThresholdChangedEvent {
  updateThreshold: BigInt!
}

type RoleAdminChangedEvent {
  role: String!
  previousAdminRole: String!
  newAdminRole: String!
}

type RoleGrantedEvent {
  role: String!
  account: String!
  sender: String!
}

type RoleRevokedEvent {
  role: String!
  account: String!
  sender: String!
}

type ResultIPLDBlock {
  block: _Block_!
  contractAddress: String!
  cid: String!
  kind: String!
  data: String!
}

type Query {
  events(blockHash: String!, contractAddress: String!, name: String): [ResultEvent!]
  eventsInRange(fromBlockNumber: Int!, toBlockNumber: Int!): [ResultEvent!]
  producer(id: String!, block: Block_height): Producer!
  producerSet(id: String!, block: Block_height): ProducerSet!
  producerSetChange(id: String!, block: Block_height): ProducerSetChange!
  producerRewardCollectorChange(id: String!, block: Block_height): ProducerRewardCollectorChange!
  rewardScheduleEntry(id: String!, block: Block_height): RewardScheduleEntry!
  rewardSchedule(id: String!, block: Block_height): RewardSchedule!
  producerEpoch(id: String!, block: Block_height): ProducerEpoch!
  block(id: String!, block: Block_height): Block!
  epoch(id: String!, block: Block_height): Epoch!
  slotClaim(id: String!, block: Block_height): SlotClaim!
  slot(id: String!, block: Block_height): Slot!
  staker(id: String!, block: Block_height): Staker!
  network(id: String!, block: Block_height): Network!
  distributor(id: String!, block: Block_height): Distributor!
  distribution(id: String!, block: Block_height): Distribution!
  claim(id: String!, block: Block_height): Claim!
  slash(id: String!, block: Block_height): Slash!
  account(id: String!, block: Block_height): Account!
  getStateByCID(cid: String!): ResultIPLDBlock
  getState(blockHash: String!, contractAddress: String!, kind: String): ResultIPLDBlock
}

type Producer {
  id: ID!
  active: Boolean!
  rewardCollector: Bytes
  rewards: BigInt!
  confirmedBlocks: BigInt!
  pendingEpochBlocks: BigInt!
}

type ProducerSet {
  id: ID!
  producers: [Producer!]!
}

type ProducerSetChange {
  id: ID!
  blockNumber: BigInt!
  producer: Bytes!
  changeType: ProducerSetChangeType!
}

enum ProducerSetChangeType {
  Added
  Removed
}

type ProducerRewardCollectorChange {
  id: ID!
  blockNumber: BigInt!
  producer: Bytes!
  rewardCollector: Bytes!
}

type RewardScheduleEntry {
  id: ID!
  startTime: BigInt!
  epochDuration: BigInt!
  rewardsPerEpoch: BigInt!
}

type RewardSchedule {
  id: ID!
  rewardScheduleEntries: [RewardScheduleEntry!]!
  lastEpoch: Epoch
  pendingEpoch: Epoch
  activeRewardScheduleEntry: RewardScheduleEntry
}

type Block {
  id: ID!
  fromActiveProducer: Boolean!
  hash: Bytes!
  parentHash: Bytes!
  unclesHash: Bytes!
  author: Bytes!
  stateRoot: Bytes!
  transactionsRoot: Bytes!
  receiptsRoot: Bytes!
  number: BigInt!
  gasUsed: BigInt!
  gasLimit: BigInt!
  timestamp: BigInt!
  difficulty: BigInt!
  totalDifficulty: BigInt!
  size: BigInt
}

type Epoch {
  id: ID!
  finalized: Boolean!
  epochNumber: BigInt!
  startBlock: Block
  endBlock: Block
  producerBlocks: BigInt!
  allBlocks: BigInt!
  producerBlocksRatio: BigDecimal!
  producerRewards: [ProducerEpoch!]!
}

type ProducerEpoch {
  id: ID!
  address: Bytes!
  epoch: Epoch!
  totalRewards: BigInt!
  blocksProduced: BigInt!
  blocksProducedRatio: BigDecimal!
}

type SlotClaim {
  id: ID!
  slot: Slot!
  owner: Bytes!
  winningBid: BigInt!
  oldBid: BigInt!
  startTime: BigInt!
  expirationTime: BigInt!
  taxRatePerDay: BigDecimal!
}

type Slot {
  id: ID!
  owner: Bytes!
  delegate: Bytes!
  winningBid: BigInt!
  oldBid: BigInt!
  startTime: BigInt!
  expirationTime: BigInt!
  taxRatePerDay: BigDecimal!
  claims: [SlotClaim!]!
}

type Staker {
  id: ID!
  staked: BigInt!
  rank: BigInt
}

type Network {
  id: ID!
  slot0: Slot
  slot1: Slot
  slot2: Slot
  stakers: [Staker!]!
  numStakers: BigInt
  totalStaked: BigInt!
  stakedPercentiles: [BigInt!]!
}

type Distributor {
  id: ID!
  currentDistribution: Distribution
}

type Distribution {
  id: ID!
  distributor: Distributor!
  timestamp: BigInt!
  distributionNumber: BigInt!
  merkleRoot: Bytes!
  metadataURI: String!
}

type Claim {
  id: ID!
  timestamp: BigInt!
  index: BigInt!
  account: Account!
  totalEarned: BigInt!
  claimed: BigInt!
}

type Account {
  id: ID!
  totalClaimed: BigInt!
  totalSlashed: BigInt!
  claims: [Claim!]!
  slashes: [Slash!]!
}

type Slash {
  id: ID!
  timestamp: BigInt!
  account: Account!
  slashed: BigInt!
}

type Mutation {
  watchContract(address: String!, kind: String!, checkpoint: Boolean!, startingBlock: Int): Boolean!
}

type Subscription {
  onEvent: ResultEvent!
}
