Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new indexer graphql package (L2) #172

Merged
merged 103 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
e7b269e
fix
LuizAsFight Feb 6, 2024
29c9aed
feat: structure changes to portal + migrate bridge tx list (#159)
LuizAsFight Feb 7, 2024
906215f
feat: migrate Layout + Header + BridgeHome (#162)
LuizAsFight Feb 8, 2024
6235f6b
Merge branch 'main' of github.com:FuelLabs/fuel-explorer into lf/feat…
LuizAsFight Feb 8, 2024
de526e0
feat: remove @fuel-ui from bridge transaction Popups (#165)
LuizAsFight Feb 9, 2024
6fbaa3b
Merge branch 'main' of github.com:FuelLabs/fuel-explorer into lf/feat…
LuizAsFight Feb 9, 2024
509e1a9
Merge branch 'main' of github.com:FuelLabs/fuel-explorer into lf/feat…
LuizAsFight Feb 9, 2024
4cb42d7
Merge branch 'main' of github.com:FuelLabs/fuel-explorer into lf/feat…
LuizAsFight Feb 10, 2024
8bd67d4
Merge branch 'main' of github.com:FuelLabs/fuel-explorer into lf/feat…
LuizAsFight Feb 10, 2024
14c25bb
feat: add first version of new graphql package
pedronauck Feb 14, 2024
ee9c284
feat: add server in the new graphql package
pedronauck Feb 14, 2024
89e212f
chore: add build on new graphql package
pedronauck Feb 14, 2024
aaca194
chore: small adjustments
pedronauck Feb 14, 2024
f490c5f
chore: add method on Database
pedronauck Feb 14, 2024
7a2a68c
chore: improve sync
pedronauck Feb 16, 2024
a8797ff
chore: add sync missing
pedronauck Feb 16, 2024
5c30226
chore: improve arch
pedronauck Feb 16, 2024
b05bc57
fix: uncomment docker
pedronauck Feb 16, 2024
0396b5c
fix: biome warnings
pedronauck Feb 16, 2024
d298263
chore: improve architecture
pedronauck Feb 16, 2024
46fb521
chore: deps update
pedronauck Feb 16, 2024
ac17225
fix: build
pedronauck Feb 16, 2024
ad4faa0
chore: fix build
pedronauck Feb 16, 2024
e1a37a6
feat: migrate components to @fuels/ui (#173)
LuizAsFight Feb 19, 2024
f6bcef6
Merge branch 'main' of github.com:FuelLabs/fuel-explorer into lf/feat…
LuizAsFight Feb 19, 2024
febc0db
chore: remove unused
LuizAsFight Feb 20, 2024
2446303
chore: improve arch
pedronauck Feb 20, 2024
242f431
fix: insert in order
pedronauck Feb 21, 2024
dc15b77
chore: some improvements
pedronauck Feb 21, 2024
f5289c9
chore: improve domains
pedronauck Feb 21, 2024
170d149
chore: improve repositories
pedronauck Feb 21, 2024
dee95df
feat: merge routing PR to fuel-ui PR (#181)
LuizAsFight Feb 22, 2024
06103e9
Merge branch 'main' of github.com:FuelLabs/fuel-explorer into lf/feat…
LuizAsFight Feb 22, 2024
64db478
refactor: input amount (#192)
helciofranco Feb 23, 2024
2532826
Merge branch 'main' of github.com:FuelLabs/fuel-explorer into lf/feat…
helciofranco Feb 23, 2024
db9c4d9
Merge branch 'lf/feat/migrate-fuel-ui' of github.com:FuelLabs/fuel-ex…
helciofranco Feb 23, 2024
0785802
Merge branches 'pn/chore/indexer' and 'lf/feat/migrate-fuel-ui' of gi…
pedronauck Feb 25, 2024
3b6a0dc
chore: adjust ui and navigation (#194)
pedronauck Feb 26, 2024
ba9bf14
refactor: improve how we build classNames (#196)
helciofranco Feb 26, 2024
2ed6095
chore: improve dialog ui (#199)
pedronauck Feb 27, 2024
9bb62d9
fix: resolve html hydration issue (#200)
helciofranco Feb 27, 2024
fa55913
fix: explorer bg color on dark theme (#201)
helciofranco Feb 27, 2024
c6f278d
feat: setup project envs for portal / explorer (#190)
LuizAsFight Feb 28, 2024
8a60ced
Merge branch 'lf/feat/migrate-fuel-ui' of github.com:FuelLabs/fuel-ex…
pedronauck Feb 28, 2024
2b32104
Merge branches 'pn/chore/indexer' and 'lf/feat/migrate-fuel-ui' of gi…
pedronauck Feb 28, 2024
f23d120
Merge branch 'main' of github.com:FuelLabs/fuel-explorer into pn/chor…
pedronauck Feb 28, 2024
d6fd9fd
chore: cleanup
pedronauck Feb 28, 2024
c48634d
chore: revamp blocks
pedronauck Feb 29, 2024
b13320b
chore: improve struct
pedronauck Mar 1, 2024
b36a4d1
chore: remove env var
pedronauck Mar 1, 2024
e410458
feat: add find block resolver
pedronauck Mar 1, 2024
6baf45a
feat: add inputs/outputs sync
pedronauck Mar 1, 2024
020efe4
feat: add contracts
pedronauck Mar 1, 2024
d978bad
chore: improve graphql generation
pedronauck Mar 1, 2024
544237e
feat: add chain info
pedronauck Mar 1, 2024
aa042c6
feat: add node info resolver
pedronauck Mar 1, 2024
dc9d3f7
feat: add balance resolver
pedronauck Mar 1, 2024
3cb8342
chore: improve types
pedronauck Mar 1, 2024
e2edcb4
chore: perf on events
pedronauck Mar 1, 2024
cba6e1c
feat: add predicate feature
pedronauck Mar 1, 2024
4e0be63
chore: improve schemas stitch
pedronauck Mar 1, 2024
4fbb645
chore: auto merge resolvers
pedronauck Mar 1, 2024
a393b89
feat: add search resolver
pedronauck Mar 1, 2024
0d429f1
feat: add gasCosts and parsedTime on transaction
pedronauck Mar 2, 2024
6da7e51
chore: adjust models
pedronauck Mar 4, 2024
5328b40
chore: change entity id typing
pedronauck Mar 4, 2024
615f1c0
feat: add grouped inputs on transaction
pedronauck Mar 4, 2024
42e1fa1
chore: input predicate data
pedronauck Mar 4, 2024
0e99b17
feat: add tx grouped inputs
pedronauck Mar 4, 2024
25fbeee
feat: missing fields on transaction
pedronauck Mar 5, 2024
cc9eaaf
feat: add missing block resolvers
pedronauck Mar 5, 2024
559c958
feat: add utxos on balances resolver
pedronauck Mar 5, 2024
15d0559
feat: finish resolvers and domains
pedronauck Mar 7, 2024
d989124
merge
luizstacio Mar 26, 2024
0d055b9
feat: release graphql-new docker image
luizstacio Mar 26, 2024
c53c795
chore: update lock
luizstacio Mar 26, 2024
d792977
chore: start ingest server on start
luizstacio Mar 26, 2024
3d7d5e3
chore: change CI title
luizstacio Mar 26, 2024
f0c4eca
chore: wait for server start to send message
luizstacio Mar 26, 2024
b4073e5
Merge branch 'main' of github.com:FuelLabs/fuel-explorer into pn/chor…
helciofranco Mar 27, 2024
10dfbfa
Merge branch 'main' of github.com:FuelLabs/fuel-explorer into pn/chor…
helciofranco Mar 28, 2024
26e903b
fix: sync react versions between the packages
helciofranco Mar 28, 2024
a478eec
Merge branch 'main' into pn/chore/indexer
luizstacio Mar 29, 2024
b20f671
fix: install
luizstacio Mar 29, 2024
05d45d3
fix: timestamp
pedronauck Mar 29, 2024
9def064
fix: keep syncing blocks after ending
luizstacio Mar 29, 2024
ee9f7d4
feat: purge ingest server (#266)
luizstacio Mar 29, 2024
c8ec761
ci: add missing env
helciofranco Mar 29, 2024
e714898
ci: fix env var example
helciofranco Mar 29, 2024
048e129
Merge branch 'main' into pn/chore/indexer
helciofranco Apr 2, 2024
9dacd9e
Merge branch 'main' into pn/chore/indexer
helciofranco Apr 4, 2024
400f97d
Merge branch 'main' of github.com:FuelLabs/fuel-explorer into pn/chor…
helciofranco Apr 5, 2024
b63d7a4
ci: run healthy check correctly on the pg instance
helciofranco Apr 5, 2024
de9fd0c
Merge branch 'pn/chore/indexer' of github.com:FuelLabs/fuel-explorer …
pedronauck Apr 5, 2024
616f49a
fix: graphql codegen
pedronauck Apr 5, 2024
514b320
chore: overwrite
pedronauck Apr 5, 2024
828b10a
fix: generated graphql sdks
pedronauck Apr 5, 2024
02d828a
feat: add edge to the resolver response
helciofranco Apr 5, 2024
6a18f57
fix: fetch max id correctly
helciofranco Apr 6, 2024
2452a23
fix: detect if there are next/prev pages
helciofranco Apr 8, 2024
bdba5ed
fix: keep compatibility with backwards navigation
helciofranco Apr 9, 2024
f68d135
feat: add queries specific for the sdk app
helciofranco Apr 10, 2024
6b2c971
fix: add missing properties to the output
helciofranco Apr 10, 2024
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
22 changes: 21 additions & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Build and push Ethereum hardhat image
- name: Build and push Fuel Explorer Graphql image
uses: ./.github/actions/docker-publish
id: publish
with:
Expand All @@ -31,3 +31,23 @@ jobs:
image: ghcr.io/fuellabs/fuel-explorer
dockerfile: deployment/Dockerfile
context: ./packages/graphql

# Temporary publish a new version of the graphql-new
# until the graphql removed to use only the new version
build-and-publish-image-v2:
runs-on: buildjet-4vcpu-ubuntu-2204
if: |
(github.event_name == 'release' && github.event.action == 'published') ||
github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3

- name: Build and push Fuel Explorer Graphql image V2
uses: ./.github/actions/docker-publish
id: publish
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
image: ghcr.io/fuellabs/fuel-explorer
dockerfile: deployment/Dockerfile.v2
context: ./packages/graphql-new
3 changes: 3 additions & 0 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:

- name: Create .env file graphql
run: cp packages/graphql/.env.example packages/graphql/.env

- name: Create .env file graphql-new
run: cp packages/graphql-new/.env.example packages/graphql-new/.env

- name: Create .env file explorer
run: cp packages/app-explorer/.env.example packages/app-explorer/.env
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ concurrency:

env:
COVERAGE_FILE: report.json
NEXT_PUBLIC_FUEL_CHAIN_NAME: fuelBeta5
NEXT_PUBLIC_FUEL_CHAIN_NAME: fuelBeta5 # For Next.JS apps
FUEL_PROVIDER: https://beta-5.fuel.network/graphql # For GraphQL apps

jobs:
validate-title:
Expand Down
4 changes: 2 additions & 2 deletions contracts/predicate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"devDependencies": {
"dotenv": "16.4.1",
"fuels": "0.74.0",
"tsx": "4.7.0",
"vitest": "1.2.2"
"vitest": "1.2.2",
"tsx": "4.7.1"
}
}
38 changes: 38 additions & 0 deletions deployment/Dockerfile.v2
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This image contains the graphql server
# built for the fuel-explorer
FROM node:20-slim AS base

# Expose the ENVs to the env of the container
ENV PORT="${PORT}"
ENV FUEL_PROVIDER="${FUEL_PROVIDER:-https://beta-5.fuel.network/graphql}"
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
ENV SERVER_BUILD=true
ENV SYNC_MISSING=false
ENV DB_MIGRATE=false

# Database config
ENV DB_HOST="${DB_HOST}"
ENV DB_PORT="${DB_PORT}"
ENV DB_USER="${DB_USER}"
ENV DB_PASS="${DB_PASS}"
ENV DB_NAME="${DB_NAME}"

# Enable pnpm using corepack form node.js
RUN corepack enable

# Install dependencies for the entire monorepo
COPY . /app-explorer
WORKDIR /app-explorer

# Install dependencies for the entire monorepo
RUN pnpm install
RUN pnpm db:setup

# Expose the specified port
EXPOSE ${PORT}

# Start GraphQL server
WORKDIR /app-explorer

CMD ["pnpm", "server:start"]
23 changes: 22 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.4'
version: "3.4"

services:
l1_chain:
Expand All @@ -14,6 +14,7 @@ services:
fuel_core:
depends_on:
- l1_chain
- fuel-explorer-pgsql
image: fueldev/fuelcore:${DOCKER_TAG_FUEL_CORE:-latest}
platform: linux/amd64
build:
Expand Down Expand Up @@ -69,3 +70,23 @@ services:
ports:
# expose the service to the host for integration testing
- ${ERC20_HTTP_PORT:-8082}:9090

fuel-explorer-pgsql:
image: postgres:latest
platform: linux/amd64
container_name: fuel-explorer-pgsql
ports:
- "5435:5432"
volumes:
- fuel-explorer-pgsql-db:/usr/local/postgres
environment:
- POSTGRES_PASSWORD=postgres
- PGUSER=postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-U", "postgres", "-d", "postgres"]
interval: 5s
timeout: 5s
retries: 5

volumes:
fuel-explorer-pgsql-db:
2 changes: 1 addition & 1 deletion docker/fuel-core/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/fuellabs/fuel-core:v0.22.0
FROM ghcr.io/fuellabs/fuel-core:v0.22.4

ARG FUEL_IP=0.0.0.0
ARG FUEL_PORT=4001
Expand Down
7 changes: 7 additions & 0 deletions docker/fuel-core/chainConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@
"amount": "0x000000e8d4a51000",
"asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
],
"contracts": [
{
"contract_id": "0x1111111111111111111111111111111111111111111111111111111111111111",
"code": "0x2222222222222222222222222222222222222222222222222222222222222222",
"salt": "0x0000000000000000000000000000000000000000000000000000000000000001"
}
]
},
"consensus_parameters": {
Expand Down
1 change: 1 addition & 0 deletions docker/fuel-core/fuel_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ exec /root/fuel-core run \
--enable-relayer \
--relayer $L1_CHAIN_HTTP \
--relayer-v2-listening-contracts $FUEL_MESSAGE_PORTAL_CONTRACT_ADDRESS \
--coinbase-recipient 0x1111111111111111111111111111111111111111111111111111111111111111 \
--poa-interval-period 1s \
--min-gas-price 1 \
--chain ./chainConfig.json \
Expand Down
12 changes: 12 additions & 0 deletions docker/l1-chain/hardhat/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "hardhat-node",
"version": "0.0.0",
"scripts": {
"start": "hardhat node --network hardhat"
},
"license": "MIT",
"dependencies": {
"dotenv": "^16.4.4",
"hardhat": "^2.20.1"
}
}
34 changes: 13 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,18 @@
"@jest/types": "29.6.3",
"@next/eslint-plugin-next": "^14.1.0",
"@nomiclabs/hardhat-etherscan": "^3.1.8",
"@openzeppelin/hardhat-upgrades": "^3.0.2",
"@openzeppelin/hardhat-upgrades": "^3.0.3",
"@playwright/test": "^1.41.2",
"@swc/core": "1.4.0",
"@swc/core": "1.4.1",
"@swc/jest": "0.2.36",
"@types/jest": "29.5.12",
"@types/node": "20.11.16",
"@types/react": "^18.2.54",
"@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"@xstate/cli": "^0.5.17",
"dotenv": "^16.4.1",
"dotenv": "^16.4.4",
"get-tsconfig": "4.7.2",
"hardhat-typechain": "^0.3.5",
"husky": "^9.0.10",
"husky": "^9.0.11",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"jest-transform-stub": "^2.0.0",
Expand All @@ -89,22 +86,17 @@
"npm-run-all": "^4.1.5",
"ts-jest": "^29.1.2",
"ts-node": "10.9.2",
"tsup": "8.0.1",
"tsx": "4.7.0",
"turbo": "^1.12.2",
"tsup": "8.0.2",
"tsx": "4.7.1",
"turbo": "^1.12.4",
"typescript": "5.3.3",
"updates": "^15.1.1"
"updates": "^15.1.2",
"vitest": "1.2.2"
},
"pnpm": {
"peerDependencyRules": {
"allowAny": [
"react",
"react-dom"
],
"ignoreMissing": [
"react",
"react-dom"
]
"allowAny": ["react", "react-dom"],
"ignoreMissing": ["react", "react-dom"]
},
"overrides": {
"glob-parent@<5.1.2": ">=5.1.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/app-commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
},
"dependencies": {
"@fuels/ui": "workspace:*",
"react": "^18.2.0",
"react": "18.2.0",
"tailwind-variants": "0.1.20"
},
"devDependencies": {
"@types/react": "^18.2.54",
"@types/react-dom": "^18.2.18",
"@types/react": "18.2.54",
"@types/react-dom": "18.2.22",
"typescript": "5.3.3"
}
}
12 changes: 6 additions & 6 deletions packages/app-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@
"@storybook/types": "^8.0.0-beta.5",
"@svgr/webpack": "8.1.0",
"@testing-library/dom": "9.3.4",
"@testing-library/jest-dom": "6.3.0",
"@testing-library/jest-dom": "6.4.2",
"@types/node": "20.11.6",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@types/react": "18.2.54",
"@types/react-dom": "18.2.22",
"@types/react-window": "1.8.8",
"@xstate/cli": "^0.5.17",
"autoprefixer": "10.4.17",
"postcss": "8.4.33",
"postcss-import": "16.0.0",
"postcss": "8.4.35",
"postcss-import": "16.0.1",
"radix-ui-themes-with-tailwind": "1.2.6",
"storybook": "^8.0.0-beta.5",
"storybook-addon-theme": "workspace:*",
Expand All @@ -79,7 +79,7 @@
"tsconfig-paths-webpack-plugin": "^4.1.0",
"tsup": "8.0.1",
"typescript": "5.3.3",
"vite": "^5.0.12",
"vite": "^5.1.3",
"vite-tsconfig-paths": "^4.3.1"
},
"browser": {
Expand Down
6 changes: 3 additions & 3 deletions packages/app-portal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
"@tanstack/react-query": "5.0.5",
"@tanstack/react-query-devtools": "5.0.5",
"@types/node": "^18.13.0",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"@types/react": "18.2.54",
"@types/react-dom": "18.2.22",
"@xstate/cli": "^0.5.17",
"npm-run-all": "^4.1.5",
"postcss": "8.4.33",
Expand All @@ -57,4 +57,4 @@
"tailwindcss-radix": "2.8.0",
"typescript": "5.3.3"
}
}
}
4 changes: 4 additions & 0 deletions packages/graphql-new/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_moduels
.turbo
dist
.env
7 changes: 7 additions & 0 deletions packages/graphql-new/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FUEL_PROVIDER=http://beta-5.fuel.network/graphql
SERVER_PORT=3002
DB_HOST="127.0.0.1"
DB_PORT="5435"
DB_USER="postgres"
DB_PASS="postgres"
DB_NAME="postgres"
7 changes: 7 additions & 0 deletions packages/graphql-new/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FUEL_PROVIDER=https://beta-5.fuel.network/graphql
SERVER_PORT=3002
DB_HOST="127.0.0.1"
DB_PORT="5435"
DB_USER="postgres"
DB_PASS="postgres"
DB_NAME="postgres"
26 changes: 26 additions & 0 deletions packages/graphql-new/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Mock API

This is a mock api for block-explorer

## Run development server

```sh
pnpm dev
```

## Docker

```
docker run \
-e FUEL_PROVIDER=http://beta-5.fuel.network/graphql \
-e SERVER_PORT=3000 \
-e SYNC_MISSING=true \
-e DB_MIGRATE=true \
-e DB_HOST=192.168.3.240 \
-e DB_PORT=5435 \
-e DB_USER=postgres \
-e DB_PASS=postgres \
-e DB_NAME=postgres \
-p 3333:3000 \
ghcr.io/fuellabs/fuel-explorer:main
```
19 changes: 19 additions & 0 deletions packages/graphql-new/codegen.fuel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { CodegenConfig } from '@graphql-codegen/cli';
import dotenv from 'dotenv';
dotenv.config();

const SERVER_URL = process.env.FUEL_PROVIDER || 'http://127.0.0.1:4000/graphql';

const config: CodegenConfig = {
overwrite: true,
generates: {
'./src/graphql/schemas/fuelcore.graphql': {
schema: SERVER_URL,
plugins: ['schema-ast'],
config: {
includeDirectives: true,
},
},
},
};
export default config;
Loading
Loading