query IdentityNameByIndex($index: Int!) {
  identity(where: { index: { _eq: $index } }) {
    name
  }
}

query NamesByIndexes($indexes: [Int!]!) {
  identity(where: { index: { _in: $indexes } }) {
    index
    name
  }
}

query IdentityInfo($index: Int!) {
  identity(where: { index: { _eq: $index } }) {
    name
    certIssued(orderBy: { expireOn: DESC }, where: { isActive: { _eq: true } }) {
      receiver {
        name
      }
    }
    certReceived(orderBy: { expireOn: DESC }, where: { isActive: { _eq: true } }) {
      issuer {
        name
      }
    }
    linkedAccount {
      id
    }
    smith {
      smithStatus
      smithCertIssued(orderBy: { createdOn: DESC }) {
        receiver {
          identity {
            name
          }
        }
      }
      smithCertReceived(orderBy: { createdOn: DESC }) {
        issuer {
          identity {
            name
          }
        }
      }
    }
  }
}

query IdentityNameByPubkey($pubkey: String!) {
  identity(where: { account: { id: { _eq: $pubkey } } }) {
    name
  }
}

query WasIdentityNameByPubkey($pubkey: String!) {
  accountByPk(id: $pubkey) {
    wasIdentity {
      identity {
        name
      }
    }
  }
}

query LatestBlock {
  block(limit: 1, orderBy: { height: DESC }) {
    height
    hash
  }
}

query BlockByNumber($number: Int!) {
  block(where: { height: { _eq: $number } }) {
    height
    hash
  }
}

query GenesisHash {
  block(where: { height: { _eq: 0 } }) {
    hash
  }
}