Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Rollups Explorer

[![Coverage Status](https://coveralls.io/repos/github/cartesi/rollups-explorer/badge.svg?branch=feature/97-upload-test-coverage-to-coveralls)](https://coveralls.io/github/cartesi/rollups-explorer?branch=feature/97-upload-test-coverage-to-coveralls)
[![Coverage Status](https://coveralls.io/repos/github/cartesi/rollups-explorer/badge.svg?branch=main)](https://coveralls.io/github/cartesi/rollups-explorer?branch=main)

This is a monorepo managed by [turborepo](https://turbo.build/repo) using [Yarn v1](https://classic.yarnpkg.com/) as the package manager. It holds two web apps and a few packages. A nextJS app called [web](./apps//web/) that is the rollups-explorer UI. The second is a Storybook app called [workshop](./apps/workshop/) to support showcase and quick development of components. The backend for the rollups-explorer can be found [here](https://github.com/cartesi/rollups-explorer-api)

Expand Down
12 changes: 10 additions & 2 deletions apps/web/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import type { Types } from "@graphql-codegen/plugin-helpers";
import { join, sep } from "path";

const basePath = join("src", "graphql");
const rollupsBasePath = join("graphql", "rollups");
// FIXUP: to be replaced with new deployed API.
const explorerSchema = "https://api.cartesiscan.io/graphql";
const explorerAPIQueries = join(".", "graphql", "queries.graphql");
const rollupsSchema = join(".", "graphql", "rollups", "schema.graphql");
const rollupsDocuments = join(".", "graphql", "rollups", "queries.graphql");
const rollupsSchema = join(".", rollupsBasePath, "schema.graphql");
const rollupsDocuments = join(".", rollupsBasePath, "queries.graphql");
const rollupsV2Schema = join(".", rollupsBasePath, "v2", "schema.graphql");
const rollupsV2Documents = join(".", rollupsBasePath, "v2", "queries.graphql");

console.info(`Codegen will use schema URL: ${explorerSchema}`);

Expand All @@ -18,6 +21,11 @@ interface CommonConfig extends Pick<Types.Config, "schema" | "documents"> {
type Generates = Partial<Pick<Types.Config, "generates">>;

const setup: CommonConfig[] = [
{
dirname: "rollups/v2",
schema: rollupsV2Schema,
documents: rollupsV2Documents,
},
{
dirname: "rollups",
schema: rollupsSchema,
Expand Down
17 changes: 10 additions & 7 deletions apps/web/graphql/queries.graphql
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
fragment ApplicationRequiredFields on Application {
id
address
rollupVersion
}

fragment InputItem on Input {
id
application {
id
address
...ApplicationRequiredFields
}
chain {
id
Expand Down Expand Up @@ -88,8 +93,7 @@ query statsApplicationsOwner($ownerAddress: String, $chainId: String) {

query applications($limit: Int, $where: ApplicationWhereInput) {
applications(where: $where, limit: $limit) {
id
address
...ApplicationRequiredFields
}
}

Expand All @@ -110,10 +114,9 @@ query multiTokens($limit: Int, $where: MultiTokenWhereInput) {
}

fragment ApplicationItem on Application {
id
...ApplicationRequiredFields
owner
timestamp
address
timestamp
factory {
id
address
Expand Down
110 changes: 110 additions & 0 deletions apps/web/graphql/rollups/v2/queries.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# FRAGMENTS

fragment pageInfoFields on PageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}

fragment vouchersFields on Input {
vouchers(first: $firstVouchers, after: $vouchersNextPage, before: $vouchersPrevPage, last: $lastVouchers) {
totalCount
edges {
node {
index
input {
index
}
destination
payload
proof {
outputIndex
outputHashesSiblings
}
}
cursor
}
pageInfo {
...pageInfoFields
}
}
}

fragment noticesFields on Input {
notices(first: $firstNotices, after: $noticesNextPage, before: $noticesPrevPage, last: $lastNotices){
totalCount
edges {
node {
index
payload
}
cursor
}
pageInfo {
...pageInfoFields
}
}
}

fragment reportsFields on Input {
reports(first: $firstReports, after: $reportsNextPage, before: $reportsPrevPage, last: $lastReports) {
totalCount
edges {
node {
index
payload
}
cursor
}
pageInfo {
...pageInfoFields
}
}
}


# QUERIES

query inputDetails (
$inputId: String!
$firstNotices: Int
$lastNotices: Int
$noticesNextPage: String
$noticesPrevPage: String
$firstReports: Int
$lastReports: Int
$reportsNextPage: String
$reportsPrevPage: String
$firstVouchers: Int
$lastVouchers: Int
$vouchersNextPage: String
$vouchersPrevPage: String
) {
input(id: $inputId){
...vouchersFields
...noticesFields
...reportsFields
}
}

query checkStatus {
inputs {
totalCount
}
vouchers {
totalCount
}
reports {
totalCount
}
notices {
totalCount
}
}

query inputStatus($id: String!) {
input(id: $id) {
status
}
}
Loading