diff --git a/.env.example b/.env.example index 3d588df..0e0e752 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,5 @@ -# You should copy this file to .env.mainnet or .env.testnet and fill in the values. -# then run the proper script `pnpm run dev` (testnet) o `pnpm run dev:mainnet` (mainnet) +# Copy this file to .env.mainnet or .env.testnet and fill in the values. +# Then run: pnpm run dev (testnet) or pnpm run dev:mainnet (mainnet) -NUXT_HUB_PROJECT_KEY= NUXT_PUBLIC_NIMIQ_NETWORK=test-albatross ALBATROSS_RPC_NODE_URL= diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0cdeaf5..68d8d94 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: NUXT_PUBLIC_NIMIQ_NETWORK: ${{ vars.NUXT_PUBLIC_NIMIQ_NETWORK }} - name: Validate JSON files - run: pnpm run validate:json-files github + run: pnpm run validate:json-files - name: Test run: pnpm run test diff --git a/.github/workflows/nuxt-hub.yml b/.github/workflows/nuxt-hub.yml deleted file mode 100644 index a9339f3..0000000 --- a/.github/workflows/nuxt-hub.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: Deploy to NuxtHub -on: - push: - branches: - - '*' - -jobs: - deploy-testnet: - name: Deploy to NuxtHub Testnet - runs-on: ubuntu-latest - environment: - name: ${{ github.ref == 'refs/heads/main' && 'production-testnet' || 'preview-testnet' }} - url: ${{ steps.deploy-testnet.outputs.deployment-url }} - permissions: - contents: read - id-token: write - - steps: - - uses: actions/checkout@v4 - - - name: Install pnpm - uses: pnpm/action-setup@v4 - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: pnpm - - - name: Install dependencies - run: pnpm install - env: - ALBATROSS_RPC_NODE_URL: ${{ secrets.ALBATROSS_RPC_NODE_URL }} - NUXT_PUBLIC_NIMIQ_NETWORK: ${{ vars.NUXT_PUBLIC_NIMIQ_NETWORK }} - - - name: Build application - run: pnpm run build - env: - ALBATROSS_RPC_NODE_URL: ${{ secrets.ALBATROSS_RPC_NODE_URL }} - NUXT_PUBLIC_NIMIQ_NETWORK: ${{ vars.NUXT_PUBLIC_NIMIQ_NETWORK }} - - - name: Deploy to NuxtHub ${{ vars.NUXT_HUB_ENV }} Testnet - uses: nuxt-hub/action@v1 - id: deploy-testnet - with: - project-key: ${{ vars.NUXT_HUB_PROJECT_KEY }} - - deploy-mainnet: - name: Deploy to NuxtHub Mainnet - runs-on: ubuntu-latest - environment: - name: ${{ github.ref == 'refs/heads/main' && 'production-mainnet' || 'preview-mainnet' }} - url: ${{ steps.deploy-mainnet.outputs.deployment-url }} - permissions: - contents: read - id-token: write - - steps: - - uses: actions/checkout@v4 - - - name: Install pnpm - uses: pnpm/action-setup@v4 - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: pnpm - - - name: Install dependencies - run: pnpm install - env: - ALBATROSS_RPC_NODE_URL: ${{ secrets.ALBATROSS_RPC_NODE_URL }} - NUXT_PUBLIC_NIMIQ_NETWORK: ${{ vars.NUXT_PUBLIC_NIMIQ_NETWORK }} - - - name: Build application - run: pnpm run build - env: - ALBATROSS_RPC_NODE_URL: ${{ secrets.ALBATROSS_RPC_NODE_URL }} - NUXT_PUBLIC_NIMIQ_NETWORK: ${{ vars.NUXT_PUBLIC_NIMIQ_NETWORK }} - - - name: Deploy to NuxtHub ${{ vars.NUXT_HUB_ENV }} Mainnet - uses: nuxt-hub/action@v1 - id: deploy-mainnet - with: - project-key: ${{ vars.NUXT_HUB_PROJECT_KEY }} diff --git a/.github/workflows/sync.yaml b/.github/workflows/sync.yaml deleted file mode 100644 index 8156915..0000000 --- a/.github/workflows/sync.yaml +++ /dev/null @@ -1,99 +0,0 @@ -name: Sync - -on: - schedule: - - cron: '0 * * * *' # Runs hourly - workflow_dispatch: # Allows manual triggering of the workflow - -jobs: - sync: - runs-on: ubuntu-latest - continue-on-error: true - strategy: - matrix: - endpoint: - - https://validators-api-mainnet.pages.dev - - https://validators-api-testnet.pages.dev - - https://dev.validators-api-mainnet.pages.dev - - https://dev.validators-api-testnet.pages.dev - steps: - # - name: Stream sync API - # run: | - # # --no-buffer (or -N) tells curl to flush each chunk as soon as it arrives, - # # so can see Nitro stream lines in real time. - # curl -fsS --no-buffer "${{ matrix.endpoint }}/api/v1/sync/sse" || { - # echo "Sync request failed for ${{ matrix.endpoint }}" - # exit 1 - # } - - name: Sync missing epochs - env: - ENDPOINT: ${{ matrix.endpoint }} - run: | - set -eo pipefail - echo "🔄 Starting missing-epoch sync at $ENDPOINT" - - while true; do - # call and capture both body and HTTP status in one go - resp=$(curl -sS -w "HTTPSTATUS:%{http_code}" \ - "$ENDPOINT/api/v1/sync/missing-epoch") - - body=${resp%HTTPSTATUS:*} - status=${resp##*HTTPSTATUS:} - - echo "HTTP status: $status" - echo "$body" - - # any non-200 is a hard failure - if [[ "$status" -ne 200 ]]; then - echo "❌ HTTP $status returned" - exit 1 - fi - - # JSON error field? - if echo "$body" | jq -e 'has("error")' >/dev/null; then - echo "❌ Server error:" $(echo "$body" | jq -r '.error') - exit 1 - fi - - # parse out sync flags - isSynced=$(echo "$body" | jq -r '.isSynced // false') - syncedEpoch=$(echo "$body" | jq -r '.syncedEpoch // "N/A"') - totalMissing=$(echo "$body" | jq -r '.totalMissing // "N/A"') - - if [[ "$isSynced" == "true" ]]; then - echo "✅ All epochs synced (last synced epoch: $syncedEpoch)" - break - fi - - next=$(echo "$body" | jq -r '.next // "N/A"') - echo "✅ Synced up to epoch $syncedEpoch → next: $next ($totalMissing remaining)" - sleep 1 - done - - - name: Sync snapshot - env: - ENDPOINT: ${{ matrix.endpoint }} - run: | - set -eo pipefail - echo "🔄 Syncing snapshot at $ENDPOINT" - - resp=$(curl -sS -w "HTTPSTATUS:%{http_code}" \ - "$ENDPOINT/api/v1/sync/snapshot") - - body=${resp%HTTPSTATUS:*} - status=${resp##*HTTPSTATUS:} - - echo "HTTP status: $status" - echo "$body" - - if [[ "$status" -ne 200 ]]; then - echo "❌ HTTP $status returned" - exit 1 - fi - - if echo "$body" | jq -e 'has("error")' >/dev/null; then - echo "❌ Server error:" $(echo "$body" | jq -r '.error') - exit 1 - fi - - echo "✅ Snapshot sync completed successfully" diff --git a/README.md b/README.md index 3f62fa2..ad03225 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@