Skip to content

Commit

Permalink
Merge pull request #8 from aurora-is-near/sync-17-06
Browse files Browse the repository at this point in the history
Sync with origin
  • Loading branch information
spilin authored Jul 5, 2024
2 parents 29fe1fe + 1d5f744 commit 323b5ca
Show file tree
Hide file tree
Showing 1,375 changed files with 16,369 additions and 11,105 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const RESTRICTED_MODULES = {
{ name: '@chakra-ui/icons', message: 'Using @chakra-ui/icons is prohibited. Please use regular svg-icon instead (see examples in "icons/" folder)' },
{ name: '@metamask/providers', message: 'Please lazy-load @metamask/providers or use useProvider hook instead' },
{ name: '@metamask/post-message-stream', message: 'Please lazy-load @metamask/post-message-stream or use useProvider hook instead' },
{ name: 'playwright/TestApp', message: 'Please use render() fixture from test() function of playwright/lib module' },
],
patterns: [
'icons/*',
Expand Down
116 changes: 116 additions & 0 deletions .github/workflows/copy-issues-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Copy issues labels to pull request

on:
workflow_dispatch:
inputs:
pr_number:
description: Pull request number
required: true
type: string
issues:
description: JSON encoded list of issue ids
required: true
type: string
workflow_call:
inputs:
pr_number:
description: Pull request number
required: true
type: string
issues:
description: JSON encoded list of issue ids
required: true
type: string

jobs:
run:
name: Run
runs-on: ubuntu-latest
steps:
- name: Find unique labels
id: find_unique_labels
uses: actions/github-script@v7
env:
ISSUES: ${{ inputs.issues }}
with:
script: |
const issues = JSON.parse(process.env.ISSUES);
const WHITE_LISTED_LABELS = [
'client feature',
'feature',
'bug',
'dependencies',
'performance',
'chore',
'enhancement',
'refactoring',
'tech',
'ENVs',
]
const labels = await Promise.all(issues.map(getIssueLabels));
const uniqueLabels = uniqueStringArray(labels.flat().filter((label) => WHITE_LISTED_LABELS.includes(label)));
if (uniqueLabels.length === 0) {
core.info('No labels found.\n');
return [];
}
core.info(`Found following labels: ${ uniqueLabels.join(', ') }.\n`);
return uniqueLabels;
async function getIssueLabels(issue) {
core.info(`Obtaining labels list for the issue #${ issue }...`);
try {
const response = await github.request('GET /repos/{owner}/{repo}/issues/{issue_number}/labels', {
owner: 'blockscout',
repo: 'frontend',
issue_number: issue,
});
return response.data.map(({ name }) => name);
} catch (error) {
core.error(`Failed to obtain labels for the issue #${ issue }: ${ error.message }`);
return [];
}
}
function uniqueStringArray(array) {
return Array.from(new Set(array));
}
- name: Update pull request labels
id: update_pr_labels
uses: actions/github-script@v7
env:
LABELS: ${{ steps.find_unique_labels.outputs.result }}
PR_NUMBER: ${{ inputs.pr_number }}
with:
script: |
const labels = JSON.parse(process.env.LABELS);
const prNumber = Number(process.env.PR_NUMBER);
if (labels.length === 0) {
core.info('Nothing to update.\n');
return;
}
for (const label of labels) {
await addLabelToPr(prNumber, label);
}
core.info('Done.\n');
async function addLabelToPr(prNumber, label) {
console.log(`Adding label to the pull request #${ prNumber }...`);
return await github.request('POST /repos/{owner}/{repo}/issues/{issue_number}/labels', {
owner: 'blockscout',
repo: 'frontend',
issue_number: prNumber,
labels: [ label ],
});
}
24 changes: 0 additions & 24 deletions .github/workflows/deploy-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,3 @@ jobs:
name: Publish Docker image
uses: './.github/workflows/publish-image.yml'
secrets: inherit

deploy_main:
name: Deploy frontend
needs: publish_image
uses: blockscout/blockscout-ci-cd/.github/workflows/deploy_helmfile.yaml@master
with:
appName: front
globalEnv: main
helmfileDir: deploy
kubeConfigSecret: ci/data/dev/kubeconfig/k8s-dev
vaultRole: ci-dev
secrets: inherit

deploy_l2:
name: Deploy frontend (L2)
needs: publish_image
uses: blockscout/blockscout-ci-cd/.github/workflows/deploy_helmfile.yaml@master
with:
appName: l2-optimism-goerli
globalEnv: optimism-goerli
helmfileDir: deploy
kubeConfigSecret: ci/data/dev/kubeconfig/k8s-dev
vaultRole: ci-dev
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/deploy-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
type: choice
options:
- none
- arbitrum
- base
- gnosis
- eth
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ jobs:
label_description: Tasks in pre-release right now
secrets: inherit

# Temporary disable this step because it is broken
# There is an issue with building web3modal deps
upload_source_maps:
name: Upload source maps to Sentry
if: false
uses: './.github/workflows/upload-source-maps.yml'
secrets: inherit
20 changes: 15 additions & 5 deletions .github/workflows/project-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
issues: "[${{ github.event.issue.number }}]"
secrets: inherit

review_requested_issues:
pr_linked_issues:
name: Get issues linked to PR
runs-on: ubuntu-latest
if: ${{ github.event.pull_request && github.event.action == 'review_requested' }}
Expand Down Expand Up @@ -76,14 +76,24 @@ jobs:
return issues;
review_requested_tasks:
issues_in_review:
name: Update status for issues in review
needs: [ review_requested_issues ]
if: ${{ needs.review_requested_issues.outputs.issues }}
needs: [ pr_linked_issues ]
if: ${{ needs.pr_linked_issues.outputs.issues }}
uses: './.github/workflows/update-project-cards.yml'
secrets: inherit
with:
project_name: ${{ vars.PROJECT_NAME }}
field_name: Status
field_value: Review
issues: ${{ needs.review_requested_issues.outputs.issues }}
issues: ${{ needs.pr_linked_issues.outputs.issues }}

copy_labels:
name: Copy issues labels to pull request
needs: [ pr_linked_issues ]
if: ${{ needs.pr_linked_issues.outputs.issues }}
uses: './.github/workflows/copy-issues-labels.yml'
secrets: inherit
with:
pr_number: ${{ github.event.pull_request.number }}
issues: ${{ needs.pr_linked_issues.outputs.issues }}
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ jobs:
with:
platforms: linux/amd64,linux/arm64/v8
# Temporary disable this step because it is broken
# There is an issue with building web3modal deps
upload_source_maps:
name: Upload source maps to Sentry
if: false
needs: publish_image
uses: './.github/workflows/upload-source-maps.yml'
secrets: inherit
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# next.js
/.next/
/out/
/public/assets/
/public/envs.js
/public/assets/envs.js
/public/assets/configs
/public/icons/sprite.svg
/public/icons/README.md
/analyze
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ RUN yarn --frozen-lockfile
FROM node:20.11.0-alpine AS builder
RUN apk add --no-cache --upgrade libc6-compat bash

# pass commit sha and git tag to the app image
# pass build args to env variables
ARG GIT_COMMIT_SHA
ENV NEXT_PUBLIC_GIT_COMMIT_SHA=$GIT_COMMIT_SHA
ARG GIT_TAG
ENV NEXT_PUBLIC_GIT_TAG=$GIT_TAG
ARG NEXT_OPEN_TELEMETRY_ENABLED
ENV NEXT_OPEN_TELEMETRY_ENABLED=$NEXT_OPEN_TELEMETRY_ENABLED

ENV NODE_ENV production

Expand All @@ -58,8 +60,8 @@ RUN ./collect_envs.sh ./docs/ENVS.md
# ENV NEXT_TELEMETRY_DISABLED 1

# Build app for production
RUN yarn build
RUN yarn svg:build-sprite
RUN yarn build


### FEATURE REPORTER
Expand Down
1 change: 1 addition & 0 deletions configs/app/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const chain = Object.freeze({
secondaryCoin: {
symbol: getEnvValue('NEXT_PUBLIC_NETWORK_SECONDARY_COIN_SYMBOL'),
},
tokenStandard: getEnvValue('NEXT_PUBLIC_NETWORK_TOKEN_STANDARD_NAME') || 'ERC',
rpcUrl: getEnvValue('NEXT_PUBLIC_NETWORK_RPC_URL'),
isTestnet: getEnvValue('NEXT_PUBLIC_IS_TESTNET') === 'true',
verificationType: getEnvValue('NEXT_PUBLIC_NETWORK_VERIFICATION_TYPE') || 'mining',
Expand Down
21 changes: 21 additions & 0 deletions configs/app/features/deFiDropdown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Feature } from './types';
import type { DeFiDropdownItem } from 'types/client/deFiDropdown';

import { getEnvValue, parseEnvJson } from '../utils';

const items = parseEnvJson<Array<DeFiDropdownItem>>(getEnvValue('NEXT_PUBLIC_DEFI_DROPDOWN_ITEMS')) || [];

const title = 'DeFi dropdown';

const config: Feature<{ items: Array<DeFiDropdownItem> }> = items.length > 0 ?
Object.freeze({
title,
isEnabled: true,
items,
}) :
Object.freeze({
title,
isEnabled: false,
});

export default config;
22 changes: 22 additions & 0 deletions configs/app/features/faultProofSystem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { Feature } from './types';

import { getEnvValue } from '../utils';
import rollup from './rollup';

const title = 'Fault proof system';

const config: Feature<{ isEnabled: true }> = (() => {
if (rollup.isEnabled && rollup.type === 'optimistic' && getEnvValue('NEXT_PUBLIC_FAULT_PROOF_ENABLED') === 'true') {
return Object.freeze({
title,
isEnabled: true,
});
}

return Object.freeze({
title,
isEnabled: false,
});
})();

export default config;
5 changes: 4 additions & 1 deletion configs/app/features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,25 @@ export { default as bridgedTokens } from './bridgedTokens';
export { default as blockchainInteraction } from './blockchainInteraction';
export { default as csvExport } from './csvExport';
export { default as dataAvailability } from './dataAvailability';
export { default as deFiDropdown } from './deFiDropdown';
export { default as faultProofSystem } from './faultProofSystem';
export { default as gasTracker } from './gasTracker';
export { default as googleAnalytics } from './googleAnalytics';
export { default as graphqlApiDocs } from './graphqlApiDocs';
export { default as growthBook } from './growthBook';
export { default as marketplace } from './marketplace';
export { default as metasuites } from './metasuites';
export { default as mixpanel } from './mixpanel';
export { default as multichainButton } from './multichainButton';
export { default as nameService } from './nameService';
export { default as publicTagsSubmission } from './publicTagsSubmission';
export { default as restApiDocs } from './restApiDocs';
export { default as rollup } from './rollup';
export { default as safe } from './safe';
export { default as sentry } from './sentry';
export { default as sol2uml } from './sol2uml';
export { default as stats } from './stats';
export { default as suave } from './suave';
export { default as swapButton } from './swapButton';
export { default as txInterpretation } from './txInterpretation';
export { default as userOps } from './userOps';
export { default as validators } from './validators';
Expand Down
29 changes: 29 additions & 0 deletions configs/app/features/multichainButton.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { Feature } from './types';
import type { MultichainProviderConfig } from 'types/client/multichainProviderConfig';

import { getEnvValue, parseEnvJson } from '../utils';
import marketplace from './marketplace';

const value = parseEnvJson<MultichainProviderConfig>(getEnvValue('NEXT_PUBLIC_MULTICHAIN_BALANCE_PROVIDER_CONFIG'));

const title = 'Multichain balance';

const config: Feature<{name: string; logoUrl?: string; urlTemplate: string; dappId?: string }> = (() => {
if (value) {
return Object.freeze({
title,
isEnabled: true,
name: value.name,
logoUrl: value.logo,
urlTemplate: value.url_template,
dappId: marketplace.isEnabled ? value.dapp_id : undefined,
});
}

return Object.freeze({
title,
isEnabled: false,
});
})();

export default config;
29 changes: 29 additions & 0 deletions configs/app/features/publicTagsSubmission.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { Feature } from './types';

import services from '../services';
import { getEnvValue } from '../utils';
import addressMetadata from './addressMetadata';

const apiHost = getEnvValue('NEXT_PUBLIC_ADMIN_SERVICE_API_HOST');

const title = 'Public tag submission';

const config: Feature<{ api: { endpoint: string; basePath: string } }> = (() => {
if (services.reCaptcha.siteKey && addressMetadata.isEnabled && apiHost) {
return Object.freeze({
title,
isEnabled: true,
api: {
endpoint: apiHost,
basePath: '',
},
});
}

return Object.freeze({
title,
isEnabled: false,
});
})();

export default config;
Loading

0 comments on commit 323b5ca

Please sign in to comment.