From ea66c75bbb209c7a42b6bb9bc45a5b502b38b26c Mon Sep 17 00:00:00 2001 From: Bruno Menezes Date: Tue, 29 Aug 2023 14:37:06 +1200 Subject: [PATCH] chore(rollups): Rename folders from 0.9 to 1.0 for consistency --- .../containers/rollups/DApp.test.tsx | 4 +- .../containers/rollups/LocalDApps.test.tsx | 4 +- .../services/useApplications.test.tsx | 4 +- apps/rollups/codegen.yml | 6 +- .../documents/{0.9 => 1.0}/queries.graphql | 0 apps/rollups/graphql/mock/server.ts | 2 +- .../rollups/graphql/schema/0.8/schema.graphql | 258 ------------------ .../schema/{0.9 => 1.0}/schema.graphql | 0 apps/rollups/src/containers/rollups/DApp.tsx | 2 +- apps/rollups/src/services/useApplications.tsx | 4 +- 10 files changed, 13 insertions(+), 271 deletions(-) rename apps/rollups/graphql/documents/{0.9 => 1.0}/queries.graphql (100%) delete mode 100644 apps/rollups/graphql/schema/0.8/schema.graphql rename apps/rollups/graphql/schema/{0.9 => 1.0}/schema.graphql (100%) diff --git a/apps/rollups/__tests__/containers/rollups/DApp.test.tsx b/apps/rollups/__tests__/containers/rollups/DApp.test.tsx index aedaa8c0..7cdf8f46 100644 --- a/apps/rollups/__tests__/containers/rollups/DApp.test.tsx +++ b/apps/rollups/__tests__/containers/rollups/DApp.test.tsx @@ -19,9 +19,9 @@ import { PageInfo, useDappQuery, useInputEdgeQuery, -} from '../../../src/generated/graphql/rollups/0.9'; +} from '../../../src/generated/graphql/rollups/1.0'; import { withChakraTheme } from '../../test-utilities'; -const path = '../../../src/generated/graphql/rollups/0.9'; +const path = '../../../src/generated/graphql/rollups/1.0'; jest.mock(path, () => { const originalModule = jest.requireActual(path); return { diff --git a/apps/rollups/__tests__/containers/rollups/LocalDApps.test.tsx b/apps/rollups/__tests__/containers/rollups/LocalDApps.test.tsx index af01c00d..ff61fc80 100644 --- a/apps/rollups/__tests__/containers/rollups/LocalDApps.test.tsx +++ b/apps/rollups/__tests__/containers/rollups/LocalDApps.test.tsx @@ -11,12 +11,12 @@ import { act, render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { withChakraTheme } from '../../test-utilities'; import { DappsSummary, LocalDAppList, } from '../../../src/containers/rollups/LocalDApps'; import { useApplications } from '../../../src/services/useApplications'; +import { withChakraTheme } from '../../test-utilities'; const path = '../../../src/services/useApplications'; jest.mock(path, () => { @@ -134,7 +134,7 @@ describe('LocalDApps container', () => { const errorMessage = 'Error XYZ'; const applications = [ { - factoryVersion: '0.9', + factoryVersion: '1.0', address: 'some-address', inputs: [], deploymentTimestamp: new Date().getTime() / 1000, diff --git a/apps/rollups/__tests__/services/useApplications.test.tsx b/apps/rollups/__tests__/services/useApplications.test.tsx index 9d60758f..fc1eb9f6 100644 --- a/apps/rollups/__tests__/services/useApplications.test.tsx +++ b/apps/rollups/__tests__/services/useApplications.test.tsx @@ -134,7 +134,7 @@ describe('useApplications Hook', () => { expect(isDeploymentCalled).toBe(true); }); - it('should retrieve DApp (v0.9) information directly from smartcontract', async () => { + it('should retrieve DApp (v1.0) information directly from smartcontract', async () => { const factory = buildUseRollupFactoryReturn(); factory.queryFilter = jest.fn(() => Promise.resolve([buildApplicationCreatedEvent()]) @@ -150,7 +150,7 @@ describe('useApplications Hook', () => { expect(result.current.applications).toHaveLength(1); expect(result.current.applications[0]).toHaveProperty( 'factoryVersion', - '0.9' + '1.0' ); expect(result.current.applications[0]).toHaveProperty( 'address', diff --git a/apps/rollups/codegen.yml b/apps/rollups/codegen.yml index a9d201f8..a3572c6b 100644 --- a/apps/rollups/codegen.yml +++ b/apps/rollups/codegen.yml @@ -8,11 +8,11 @@ generates: - typescript - typescript-operations - typescript-urql - ./src/generated/graphql/rollups/0.9/index.ts: + ./src/generated/graphql/rollups/1.0/index.ts: schema: - - ./graphql/schema/0.9/schema.graphql + - ./graphql/schema/1.0/schema.graphql documents: - - ./graphql/documents/0.9/queries.graphql + - ./graphql/documents/1.0/queries.graphql plugins: - typescript - typescript-operations diff --git a/apps/rollups/graphql/documents/0.9/queries.graphql b/apps/rollups/graphql/documents/1.0/queries.graphql similarity index 100% rename from apps/rollups/graphql/documents/0.9/queries.graphql rename to apps/rollups/graphql/documents/1.0/queries.graphql diff --git a/apps/rollups/graphql/mock/server.ts b/apps/rollups/graphql/mock/server.ts index decaf96f..305e154d 100644 --- a/apps/rollups/graphql/mock/server.ts +++ b/apps/rollups/graphql/mock/server.ts @@ -6,7 +6,7 @@ import { createServer } from 'node:http'; import { join } from 'path'; import { BigInt, Float, Int, String } from './custom-scalars'; const typeDefs = readFileSync( - join(process.cwd(), 'graphql/schema/0.9/schema.graphql'), + join(process.cwd(), 'graphql/schema/1.0/schema.graphql'), { encoding: 'utf-8', } diff --git a/apps/rollups/graphql/schema/0.8/schema.graphql b/apps/rollups/graphql/schema/0.8/schema.graphql deleted file mode 100644 index cba214c3..00000000 --- a/apps/rollups/graphql/schema/0.8/schema.graphql +++ /dev/null @@ -1,258 +0,0 @@ -type Proof { - "Hashes given in Ethereum hex binary format (32 bytes), starting with '0x'" - outputHashesRootHash: String! - vouchersEpochRootHash: String! - noticesEpochRootHash: String! - machineStateHash: String! - keccakInHashesSiblings: [String!]! - outputHashesInEpochSiblings: [String!]! -} - -type EpochConnection { - totalCount: Int! - edges: [EpochEdge!]! - nodes: [Epoch!]! - pageInfo: PageInfo! -} - -type Input { - id: ID! - index: Int! - epoch: Epoch! - msgSender: String! - timestamp: BigInt! - blockNumber: BigInt! - "Get voucher from this particular input given the voucher's index" - voucher(index: Int!): Voucher! - "Get notice from this particular input given the notice's index" - notice(index: Int!): Notice! - "Get report from this particular input given report's index" - report(index: Int!): Report! - "Get vouchers from this particular input with additional ability to filter and paginate them" - vouchers( - first: Int - last: Int - after: String - before: String - where: VoucherFilter - ): VoucherConnection! - "Get notices from this particular input with additional ability to filter and paginate them" - notices( - first: Int - last: Int - after: String - before: String - where: NoticeFilter - ): NoticeConnection! - "Get reports from this particular input with additional ability to filter and paginate them" - reports( - first: Int - last: Int - after: String - before: String - where: ReportFilter - ): ReportConnection! -} - -type Voucher { - id: ID! - index: Int! - input: Input! - proof: Proof - "Destination address as an Ethereum hex binary format (20 bytes), starting with '0x'" - destination: String! - "Payload in Ethereum hex binary format, starting with '0x'" - payload: String! -} - -type Query { - epoch(id: ID!): Epoch! - epochI(index: Int!): Epoch! - input(id: ID!): Input! - notice(id: ID!): Notice! - report(id: ID!): Report! - voucher(id: ID!): Voucher! - epochs( - first: Int - last: Int - after: String - before: String - ): EpochConnection! - "Get all available inputs with additional ability to filter and paginate them" - inputs( - first: Int - last: Int - after: String - before: String - where: InputFilter - ): InputConnection! - "Get all available vouchers with additional ability to filter and paginate them" - vouchers( - first: Int - last: Int - after: String - before: String - where: VoucherFilter - ): VoucherConnection! - "Get all available notices with additional ability to filter and paginate them" - notices( - first: Int - last: Int - after: String - before: String - where: NoticeFilter - ): NoticeConnection! - "Get all available reports with additional ability to filter and paginate them" - reports( - first: Int - last: Int - after: String - before: String - where: ReportFilter - ): ReportConnection! -} - -type NoticeEdge { - node: Notice! - cursor: String! -} - -input NoticeFilter { - dummy: String! -} - -type Epoch { - id: ID! - index: Int! - "Get input from this particular epoch given the input's index" - input(index: Int!): Input! - inputs( - first: Int - last: Int - after: String - before: String - where: InputFilter - ): InputConnection! - "Get vouchers from this particular epoch with additional ability to filter and paginate them" - vouchers( - first: Int - last: Int - after: String - before: String - where: VoucherFilter - ): VoucherConnection! - "Get notices from this particular input with additional ability to filter and paginate them" - notices( - first: Int - last: Int - after: String - before: String - where: NoticeFilter - ): NoticeConnection! - "Get reports from this particular epoch with additional ability to filter and paginate them" - reports( - first: Int - last: Int - after: String - before: String - where: ReportFilter - ): ReportConnection! -} - -input VoucherFilter { - destination: String! -} - -type InputConnection { - totalCount: Int! - edges: [InputEdge!]! - nodes: [Input!]! - pageInfo: PageInfo! -} - -input ReportFilter { - dummy: String! -} - -type EpochEdge { - node: Epoch! - cursor: String! -} - -type VoucherConnection { - totalCount: Int! - edges: [VoucherEdge!]! - nodes: [Voucher!]! - pageInfo: PageInfo! -} - -type Notice { - id: ID! - index: Int! - proof: Proof - input: Input! - "Keccak in Ethereum hex binary format, starting with '0x'" - keccak: String! - "Payload in Ethereum hex binary format, starting with '0x'" - payload: String! -} - -type ReportEdge { - node: Report! - cursor: String! -} - -type ReportConnection { - totalCount: Int! - edges: [ReportEdge!]! - nodes: [Report!]! - pageInfo: PageInfo! -} - -input InputFilter { - msgSender: String - blockNumber: BigInt - blockNumberLowerThan: BigInt - blockNumberGreaterThan: BigInt - timestampLowerThan: BigInt - timestampGreaterThan: BigInt -} - -scalar BigInt - -type NoticeConnection { - totalCount: Int! - edges: [NoticeEdge!]! - nodes: [Notice!]! - pageInfo: PageInfo! -} - -type InputEdge { - node: Input! - cursor: String! -} - -"Connection pattern cursor based pagination page info" -type PageInfo { - startCursor: String! - endCursor: String! - hasNextPage: Boolean! - hasPreviousPage: Boolean! -} - -type VoucherEdge { - node: Voucher! - cursor: String! -} - -type Report { - id: ID! - index: Int! - input: Input! - "Payload in Ethereum hex binary format, starting with '0x'" - payload: String! -} - -schema { - query: Query -} diff --git a/apps/rollups/graphql/schema/0.9/schema.graphql b/apps/rollups/graphql/schema/1.0/schema.graphql similarity index 100% rename from apps/rollups/graphql/schema/0.9/schema.graphql rename to apps/rollups/graphql/schema/1.0/schema.graphql diff --git a/apps/rollups/src/containers/rollups/DApp.tsx b/apps/rollups/src/containers/rollups/DApp.tsx index 4e413986..1ecf192d 100644 --- a/apps/rollups/src/containers/rollups/DApp.tsx +++ b/apps/rollups/src/containers/rollups/DApp.tsx @@ -35,7 +35,7 @@ import { FC, ReactElement, useState } from 'react'; import { useDappQuery, useInputEdgeQuery, -} from '../../generated/graphql/rollups/0.9'; +} from '../../generated/graphql/rollups/1.0'; import { DappStats } from './DappStats'; const ReactJson = dynamic(import('react-json-view'), { ssr: false }); diff --git a/apps/rollups/src/services/useApplications.tsx b/apps/rollups/src/services/useApplications.tsx index 7c198a57..f1e8e745 100644 --- a/apps/rollups/src/services/useApplications.tsx +++ b/apps/rollups/src/services/useApplications.tsx @@ -34,7 +34,7 @@ interface Application { } type FactoryType = CartesiDAppFactory; -type FactoryVersion = '0.8' | '0.9'; +type FactoryVersion = '1.0'; /** * Fetch the DApp information (i.e. Address) from a specific factory version from a block-number @@ -112,7 +112,7 @@ export const useApplications = (): Applications => { Promise.all([ fetchApplications( factory, - '0.9', + '1.0', deployBlock, (dapp: string, blockNumber?: number) => inputBoxMeta.getInputs(dapp, blockNumber)