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

Merge main into dev branch 4 #59

Merged
merged 32 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8325cb3
feat: Add github actions
maiquanghiep Aug 5, 2024
faf0625
add publish workflow
maiquanghiep Aug 5, 2024
e42634d
Update artifact name
maiquanghiep Aug 5, 2024
9e2be8f
Fix the artifact name
maiquanghiep Aug 5, 2024
1a538d6
Add matrix to dockerhub_publish
maiquanghiep Aug 5, 2024
5cc8870
Add matrix to dockerhub_publish
maiquanghiep Aug 5, 2024
d6fd426
Add mainnet env
maiquanghiep Aug 5, 2024
165426e
Remove docker entry-point
maiquanghiep Aug 5, 2024
f2cf524
Remove docker entry-point
maiquanghiep Aug 5, 2024
7eea32d
Remove docker entry-point
maiquanghiep Aug 5, 2024
d2b35bb
Add all envs
maiquanghiep Aug 6, 2024
a40bf5d
Add lint_test inputs
maiquanghiep Aug 6, 2024
07f8481
Trigger condition
maiquanghiep Aug 6, 2024
3219f04
Add the tag
maiquanghiep Aug 7, 2024
570eb90
Test publish
maiquanghiep Aug 7, 2024
8e5f3f1
fix: FAQ shall have dynamically injected confirmation depth
jrwbabylonlab Aug 7, 2024
2f54e9e
fix tooltip word wrap issue
jeremy-babylonlabs Aug 6, 2024
254c7c2
closes #42 and #45
jeremy-babylonlabs Aug 6, 2024
54709fa
get confirmation depth in Summary
jeremy-babylonlabs Aug 6, 2024
b6d9bf0
bump version
jeremy-babylonlabs Aug 6, 2024
ca5e0e7
revert #45
jeremy-babylonlabs Aug 7, 2024
dbc2bbb
fix: timeout on the wallet getInscriptions method
jrwbabylonlab Aug 7, 2024
d0a9408
Revert testing
maiquanghiep Aug 7, 2024
de42e69
Remove Circleci
maiquanghiep Aug 7, 2024
3b4bbb7
feat: Add Github Actions (#41)
maiquanghiep Aug 7, 2024
93f5110
update comments
jeremy-babylonlabs Aug 7, 2024
576853d
bugfix - tooltip not displaying properly (#44)
jeremy-babylonlabs Aug 7, 2024
63c9a12
fix: App URL (#39)
gbarkhatov Aug 7, 2024
cace884
fix: timeout on the wallet getInscriptions method (#57)
jrwbabylonlab Aug 8, 2024
f32bc64
chore: improve the msg when staking amount exceeds the available bala…
jrwbabylonlab Aug 8, 2024
4739984
fix: FAQ shall have dynamically injected confirmation depth (#53)
jrwbabylonlab Aug 8, 2024
d35eed8
remove the finality provider directory
jrwbabylonlab Aug 8, 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
95 changes: 0 additions & 95 deletions .circleci/config.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: ci

on:
pull_request:
branches:
- "**"

jobs:
lint_test:
uses: babylonlabs-io/.github/.github/workflows/[email protected]
with:
run-build: true
run-unit-tests: true
118 changes: 118 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: docker_publish

on:
push:
branches:
- "main"
- "dev"
tags:
- "*"

jobs:
lint_test:
uses: babylonlabs-io/.github/.github/workflows/[email protected]
with:
run-build: true
run-unit-tests: true

docker_build:
needs: [lint_test]
runs-on: ubuntu-22.04
strategy:
matrix:
environment: [devnet, staging, testnet, mainnet-private, mainnet]
environment: ${{ matrix.environment }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
uses: docker/build-push-action@v6
with:
tags: simple-staking:${{ github.sha }}
outputs: type=docker,dest=/tmp/simple-staking-${{ matrix.environment }}.tar
build-args: |
NEXT_PUBLIC_MEMPOOL_API=${{ vars.NEXT_PUBLIC_MEMPOOL_API }}
NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_NETWORK=${{ vars.NEXT_PUBLIC_NETWORK }}
NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES=${{ vars.NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES }}

- name: Upload Docker image to workspace
uses: actions/upload-artifact@v4
with:
name: simple-staking-${{ matrix.environment }}
path: /tmp/simple-staking-${{ matrix.environment }}.tar

dockerhub_publish:
runs-on: ubuntu-22.04
strategy:
matrix:
environment: [devnet, staging, testnet, mainnet-private, mainnet]
needs: ["docker_build"]
steps:
- name: Download Docker image from workspace
uses: actions/download-artifact@v4
with:
name: simple-staking-${{ matrix.environment }}
path: /tmp/

- name: Load Docker image
run: docker load -i /tmp/simple-staking-${{ matrix.environment }}.tar

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push Docker image with SHA
run: |
docker tag simple-staking:${{ github.sha }} ${{ vars.DOCKERHUB_REGISTRY_ID }}/simple-staking:${{ github.sha }}-${{ matrix.environment }}
docker push ${{ vars.DOCKERHUB_REGISTRY_ID }}/simple-staking:${{ github.sha }}-${{ matrix.environment }}

- name: Push Docker image with Tag
if: startsWith(github.ref, 'refs/tags/')
run: |
docker tag simple-staking:${{ github.sha }} ${{ vars.DOCKERHUB_REGISTRY_ID }}/simple-staking:${{ github.ref_name }}-${{ matrix.environment }}
docker push ${{ vars.DOCKERHUB_REGISTRY_ID }}/simple-staking:${{ github.ref_name }}-${{ matrix.environment }}

ecr_publish:
runs-on: ubuntu-22.04
strategy:
matrix:
environment: [devnet, staging, testnet, mainnet-private, mainnet]
needs: ["docker_build"]
steps:
- name: Download Docker image from workspace
uses: actions/download-artifact@v4
with:
name: simple-staking-${{ matrix.environment }}
path: /tmp/

- name: Load Docker image
run: docker load -i /tmp/simple-staking-${{ matrix.environment }}.tar

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_ECR_REGION }}

- name: Login to Amazon ECR Private
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Push Docker image with SHA
run: |
docker tag simple-staking:${{ github.sha }} ${{ vars.AWS_ECR_REGISTRY_ID }}/simple-staking:${{ github.sha }}-${{ matrix.environment }}
docker push ${{ vars.AWS_ECR_REGISTRY_ID }}/simple-staking:${{ github.sha }}-${{ matrix.environment }}

- name: Push Docker image with Tag
if: startsWith(github.ref, 'refs/tags/')
run: |
docker tag simple-staking:${{ github.sha }} ${{ vars.AWS_ECR_REGISTRY_ID }}/simple-staking:${{ github.ref_name }}-${{ matrix.environment }}
docker push ${{ vars.AWS_ECR_REGISTRY_ID }}/simple-staking:${{ github.ref_name }}-${{ matrix.environment }}
27 changes: 14 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ COPY next.config.mjs .
COPY tsconfig.json .
COPY tailwind.config.ts .
COPY postcss.config.js .
COPY docker-entrypoint.sh .

# We replace NEXT_PUBLIC_* variables here with placeholders
# as next.js automatically replaces those during building
# Later the docker-entrypoint.sh script finds such variables and replaces them
# with the docker environment variables we have set
RUN NEXT_PUBLIC_MEMPOOL_API=APP_NEXT_PUBLIC_MEMPOOL_API \
NEXT_PUBLIC_API_URL=APP_NEXT_PUBLIC_API_URL \
NEXT_PUBLIC_NETWORK=APP_NEXT_PUBLIC_NETWORK \
NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES=APP_NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES \
npm run build

ARG NEXT_PUBLIC_MEMPOOL_API
ENV NEXT_PUBLIC_MEMPOOL_API=${NEXT_PUBLIC_MEMPOOL_API}

ARG NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}

ARG NEXT_PUBLIC_NETWORK
ENV NEXT_PUBLIC_NETWORK=${NEXT_PUBLIC_NETWORK}

ARG NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES
ENV NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES=${NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES}

RUN npm run build

# Step 2. Production image, copy all the files and run next
FROM node:22-alpine3.19 AS runner
Expand All @@ -35,7 +38,6 @@ RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs

COPY --from=builder --chown=nextjs:nodejs /app/docker-entrypoint.sh ./docker-entrypoint.sh
COPY --from=builder /app/public ./public

# Automatically leverage output traces to reduce image size
Expand All @@ -46,6 +48,5 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# Uncomment the following line to disable telemetry at run time
ENV NEXT_TELEMETRY_DISABLED 1

ENTRYPOINT ["/app/docker-entrypoint.sh"]
CMD ["node", "server.js"]
STOPSIGNAL SIGTERM
15 changes: 0 additions & 15 deletions docker-entrypoint.sh

This file was deleted.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-staking",
"version": "0.2.30",
"version": "0.2.31",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Connect/ConnectSmall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const ConnectSmall: React.FC<ConnectSmallProps> = ({
>
<AiOutlineInfoCircle />
</span>
<Tooltip id="tooltip-connect" />
<Tooltip id="tooltip-connect" className="tooltip-wrap" />
</>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Delegations/Delegation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const Delegation: React.FC<DelegationProps> = ({
>
<AiOutlineInfoCircle />
</span>
<Tooltip id={`tooltip-${stakingTxHash}`} />
<Tooltip id={`tooltip-${stakingTxHash}`} className="tooltip-wrap" />
</div>
</div>
{generateActionButton()}
Expand Down
35 changes: 33 additions & 2 deletions src/app/components/FAQ/FAQ.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,48 @@
import { useEffect, useState } from "react";

import { useGlobalParams } from "@/app/context/api/GlobalParamsProvider";
import { useBtcHeight } from "@/app/context/mempool/BtcHeightProvider";
import { getNetworkConfig } from "@/config/network.config";
import {
getCurrentGlobalParamsVersion,
ParamsWithContext,
} from "@/utils/globalParams";

import { Section } from "./Section";
import { questions } from "./data/questions";
import { Section } from "./Section";

interface FAQProps {}

export const FAQ: React.FC<FAQProps> = () => {
const [paramWithCtx, setParamWithCtx] = useState<
ParamsWithContext | undefined
>();
const { coinName } = getNetworkConfig();
const btcHeight = useBtcHeight();
const globalParams = useGlobalParams();

useEffect(() => {
if (!btcHeight || !globalParams.data) {
return;
}
const paramsWithCtx = getCurrentGlobalParamsVersion(
btcHeight + 1,
globalParams.data,
);
if (!paramsWithCtx) {
return;
}
setParamWithCtx(paramsWithCtx);
}, [globalParams, btcHeight]);

return (
<div className="container mx-auto flex flex-col gap-2 p-6">
<h3 className="mb-4 font-bold">FAQ</h3>
<div className="flex flex-col gap-4">
{questions(coinName).map((question) => (
{questions(
coinName,
paramWithCtx?.currentVersion?.confirmationDepth,
).map((question) => (
<Section
key={question.title}
title={question.title}
Expand Down
Loading