Skip to content

Commit a4e2633

Browse files
committed
Merge branch 'main' of github.com:FuelLabs/fuel-explorer into pn/chore/mint-tx
2 parents 138cf6e + 5c3269d commit a4e2633

File tree

30 files changed

+273
-134
lines changed

30 files changed

+273
-134
lines changed

.github/actions/docker-publish/action.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ inputs:
1919
dockerfile:
2020
description: 'Path to the Dockerfile'
2121
required: true
22+
context:
23+
description: 'Path to the Context'
24+
default: .
25+
required: true
2226
build-args:
2327
description: 'List of build-time variables'
2428
required: false
@@ -65,7 +69,7 @@ runs:
6569
uses: docker/build-push-action@v4
6670
id: publish
6771
with:
68-
context: .
72+
context: ${{ inputs.context }}
6973
file: ${{ inputs.dockerfile }}
7074
push: true
7175
tags: ${{ steps.meta.outputs.tags }}

.github/workflows/docker-publish.yml

+1
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ jobs:
3030
password: ${{ secrets.GITHUB_TOKEN }}
3131
image: ghcr.io/fuellabs/fuel-explorer
3232
dockerfile: deployment/Dockerfile
33+
context: ./packages/graphql

contracts/predicate/scripts/run-predicate.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ import { BaseAssetId, Predicate, Provider, Wallet, bn, hexlify } from 'fuels';
22
import { promises as fs } from 'node:fs';
33
import { resolve } from 'node:path';
44

5-
const { FUEL_PROVIDER_BETA5, PRIVATE_KEY } = process.env;
5+
const { FUEL_PROVIDER, PRIVATE_KEY } = process.env;
66
const BIN_PATH = resolve(__dirname, '../out/debug/predicate-app.bin');
77
const AMOUNT = 300_000;
88

9-
if (!FUEL_PROVIDER_BETA5 || !PRIVATE_KEY) {
10-
throw new Error('Missing some config on your .env file');
9+
if (!FUEL_PROVIDER || !PRIVATE_KEY) {
10+
throw new Error('Missing some config in .env file. Should have FUEL_PROVIDER and PRIVATE_KEY');
1111
}
1212

1313
async function main() {
1414
const binHex = hexlify(await fs.readFile(BIN_PATH));
15-
const provider = await Provider.create(FUEL_PROVIDER_BETA5!);
15+
const provider = await Provider.create(FUEL_PROVIDER!);
1616
const wallet = Wallet.fromPrivateKey(PRIVATE_KEY!, provider);
1717
const { minGasPrice: gasPrice } = wallet.provider.getGasConfig();
1818
const walletAddress = wallet.address.toB256();

deployment/Dockerfile

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@ FROM node:20-slim AS base
44

55
# Expose the ENVs to the env of the container
66
ENV PORT="${PORT}"
7-
ENV FUEL_PROVIDER_BETA5="${FUEL_PROVIDER_BETA5}"
7+
ENV FUEL_PROVIDER="${FUEL_PROVIDER:-https://beta-5.fuel.network/graphql}"
88
ENV PNPM_HOME="/pnpm"
99
ENV PATH="$PNPM_HOME:$PATH"
10+
ENV SERVER_BUILD=true
1011

1112
# Enable pnpm using corepack form node.js
1213
RUN corepack enable
1314

1415
COPY . /app-explorer
1516
WORKDIR /app-explorer
1617

17-
RUN pnpm install --frozen-lockfile
18+
RUN pnpm install
1819

19-
EXPOSE 4444
20+
EXPOSE ${PORT}
2021

21-
WORKDIR /app-explorer/packages/graphql
22+
WORKDIR /app-explorer
2223

23-
CMD ["pnpm", "start"]
24+
CMD ["pnpm", "server:start"]

docker/erc20-deployer/Dockerfile

+1-8
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,4 @@ ENV PK_ETH_WALLET="${PK_ETH_WALLET}"
2626
EXPOSE ${PORT}
2727

2828
# copy over script and run
29-
CMD ["pnpm", "start"]
30-
31-
32-
# L1_CHAIN_HTTP=http://localhost:8545 \
33-
# FUEL_GRAPHQL_ENDPOINT=http://localhost:4000/graphql \
34-
# DEPLOYMENTS_HTTP=http://localhost:8080 \
35-
# PK_ETH_WALLET=59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d \
36-
# pnpm start
29+
CMD ["pnpm", "start"]

docker/l1-chain/Dockerfile

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# ====== Build Image ======
2-
FROM node:20-alpine AS BUILD_IMAGE
2+
FROM node:18-alpine AS BUILD_IMAGE
33

44
# dependencies
55
RUN apk --no-cache add git
66
RUN npm i -g pnpm
77

8-
98
# set workdir
109
WORKDIR /l1chain
1110

@@ -18,7 +17,7 @@ ADD ./.fuelChainConsts.env /l1chain/portal-contracts/.fuelChainConsts.env
1817
WORKDIR /l1chain/portal-contracts
1918

2019
# build the ethereum contracts and environment
21-
RUN pnpm install --force
20+
RUN pnpm install
2221
# replace the fuel chain consts values and change contract code
2322
RUN pnpm ts-node scripts/replaceFuelChainConsts.ts
2423
# run contract compile with the new consts
@@ -29,7 +28,7 @@ RUN pnpm compile
2928
COPY ./hardhat/hardhat.config.ts .
3029

3130
# ====== Final Image ======
32-
FROM node:20-alpine
31+
FROM node:18-alpine
3332

3433
ARG L1_IP=0.0.0.0
3534
ARG L1_PORT=8545

packages/app-explorer/.env.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
FUEL_PROVIDER_BETA5=https://beta-5.fuel.network/graphql
1+
FUEL_PROVIDER=https://beta-5.fuel.network/graphql

packages/app-explorer/.env.production

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
FUEL_PROVIDER_BETA5=https://beta-5.fuel.network/graphql
1+
FUEL_PROVIDER=https://beta-5.fuel.network/graphql

packages/app-explorer/src/app/api/graphql/route.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { createExecutor, createSchema } from '@fuel-explorer/graphql';
22
import { ContextDomain } from '@fuel-explorer/graphql/src/domains/Context';
33
import { createYoga } from 'graphql-yoga';
4+
import { requireEnv } from '~/systems/utils/requireEnv';
5+
6+
const { FUEL_PROVIDER: url } = requireEnv(['FUEL_PROVIDER']);
47

5-
const url = process.env.FUEL_PROVIDER_BETA5!;
68
const executor = createExecutor(async ({ body }) => {
79
return fetch(url, {
810
body,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export function requireEnv<
2+
A extends string[],
3+
B extends { [key in A[number]]: string },
4+
>(keys: string[]): B {
5+
return keys.reduce((ret, key) => {
6+
if (!process.env[key]) {
7+
throw new Error(`Environment variable ${key} is required`);
8+
}
9+
ret[key] = process.env[key]!;
10+
return ret;
11+
}, {} as B);
12+
}

packages/app-portal/.env.production

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VITE_ETH_CHAIN=sepolia
22
VITE_FUEL_CHAIN=fuelBeta5
3-
VITE_FUEL_VERSION=0.20.7
3+
VITE_FUEL_VERSION=0.22.0
44
VITE_IS_PUBLIC_PREVIEW=true
55
VITE_WALLET_INSTALL=https://chrome.google.com/webstore/detail/fuel-wallet/dldjpboieedgcmpkchcjcbijingjcgok
66
VITE_WALLET_INSTALL_NEXT=https://next-wallet.fuel.network/docs/install/#install-from-source-code

packages/app-portal/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5-
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
5+
<link rel="icon" type="image/svg+xml" href="/fuel-logo.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>Fuel Portal</title>
88
</head>

packages/graphql/.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_moduels
2+
.turbo
3+
dist

packages/graphql/.env.example

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
FUEL_PROVIDER_BETA5=https://beta-5.fuel.network/graphql
2-
SERVER_PORT=4000
1+
FUEL_PROVIDER=https://beta-5.fuel.network/graphql
2+
SERVER_PORT=4444

packages/graphql/.env.production

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
FUEL_PROVIDER_BETA5=https://beta-5.fuel.network/graphql
1+
FUEL_PROVIDER=https://beta-5.fuel.network/graphql
2+
SERVER_PORT=4444

packages/graphql/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,13 @@ This is a mock api for block-explorer
77
```sh
88
pnpm dev
99
```
10+
11+
## Docker
12+
13+
```
14+
docker run \
15+
-e FUEL_PROVIDER=https://beta-5.fuel.network/graphql \
16+
-e SERVER_PORT=3000 \
17+
-p 3333:3000 \
18+
ghcr.io/fuellabs/fuel-explorer:main
19+
```

packages/graphql/codegen.fuel.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import type { CodegenConfig } from '@graphql-codegen/cli';
22

3-
console.log(`process.env.FUEL_PROVIDER_BETA5`, process.env.FUEL_PROVIDER_BETA5);
3+
import { requireEnv } from './src/utils/requireEnv';
4+
5+
const { FUEL_PROVIDER } = requireEnv([
6+
['FUEL_PROVIDER', 'https://beta-5.fuel.network/graphql'],
7+
]);
48

59
const config: CodegenConfig = {
610
generates: {
711
'./src/schemas/fuelcore.graphql': {
8-
schema:
9-
process.env.FUEL_PROVIDER_BETA5 ||
10-
'https://beta-5.fuel.network/graphql',
12+
schema: FUEL_PROVIDER,
1113
plugins: ['schema-ast'],
1214
config: {
1315
includeDirectives: true,

packages/graphql/package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
"typings": "./src/index.ts",
1111
"scripts": {
1212
"build": "run-s codegen:fuel build:lib",
13-
"build:lib": "tsup --dts",
13+
"build:lib": "tsup",
1414
"build:watch": "pnpm build:lib --watch",
1515
"codegen:fuel": "gql-gen -r dotenv/config --config codegen.fuel.ts",
1616
"codegen:app": "gql-gen -r dotenv/config --config codegen.ts",
1717
"dev": "pnpm build:watch",
18-
"start": "pnpm dev",
18+
"server:start": "node ./dist/index.js",
1919
"fix:generated": "node ./scripts/fix-generated.mjs",
2020
"ts:check": "tsc --noEmit",
2121
"prepare": "pnpm build"
@@ -43,7 +43,8 @@
4343
"graphql-tag": "2.12.6",
4444
"lodash": "^4.17.21",
4545
"tai64": "1.0.0",
46-
"typescript": "5.3.3"
46+
"typescript": "5.3.3",
47+
"wait-port": "1.1.0"
4748
},
4849
"devDependencies": {
4950
"@babel/cli": "7.23.9",
@@ -63,7 +64,9 @@
6364
"execa": "8.0.1",
6465
"graphql-codegen-typescript-common": "0.18.2",
6566
"graphql-codegen-typescript-mock-data": "3.7.1",
67+
"npm-run-all": "^4.1.5",
6668
"tsconfig-paths": "^4.2.0",
69+
"tsup": "8.0.1",
6770
"tsx": "4.7.0"
6871
}
6972
}

packages/graphql/src/bin.ts

-73
This file was deleted.

packages/graphql/src/bin/index.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { runServerCodegen, runServer } from './server';
2+
3+
const { CODE_GEN = 'false' } = process.env;
4+
5+
if (CODE_GEN === 'true') {
6+
runServerCodegen();
7+
} else {
8+
runServer();
9+
}

0 commit comments

Comments
 (0)