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

Fixes for release v1.37.0 #2476

Merged
merged 17 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
/public/assets/envs.js
/public/assets/configs
/public/icons/sprite.svg
/public/icons/sprite.*.svg
/public/icons/README.md
/analyze

Expand Down
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,18 @@ WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Generate .env.registry with ENVs list and save build args into .env file
COPY --chmod=755 ./deploy/scripts/collect_envs.sh ./
RUN ./collect_envs.sh ./docs/ENVS.md
# Build SVG sprite and generate .env.registry with ENVs list and save build args into .env file
RUN set -a && \
source ./deploy/scripts/build_sprite.sh && \
./deploy/scripts/collect_envs.sh ./docs/ENVS.md && \
set +a

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
# ENV NEXT_TELEMETRY_DISABLED 1

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


Expand Down
2 changes: 2 additions & 0 deletions configs/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const baseUrl = [
appPort && ':' + appPort,
].filter(Boolean).join('');
const isDev = getEnvValue('NEXT_PUBLIC_APP_ENV') === 'development';
const spriteHash = getEnvValue('NEXT_PUBLIC_ICON_SPRITE_HASH');

const app = Object.freeze({
isDev,
Expand All @@ -18,6 +19,7 @@ const app = Object.freeze({
port: appPort,
baseUrl,
useProxy: getEnvValue('NEXT_PUBLIC_USE_NEXT_JS_PROXY') === 'true',
spriteHash,
});

export default app;
21 changes: 21 additions & 0 deletions deploy/scripts/build_sprite.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

yarn icons build -i ./icons -o ./public/icons --optimize

# Skip hash creation and renaming for playwright environment
if [ "$NEXT_PUBLIC_APP_ENV" != "pw" ]; then
# Generate hash from the sprite file
HASH=$(md5sum ./public/icons/sprite.svg | cut -d' ' -f1 | head -c 8)

# Remove old sprite files
rm -f ./public/icons/sprite.*.svg

# Rename the new sprite file
mv ./public/icons/sprite.svg "./public/icons/sprite.${HASH}.svg"

export NEXT_PUBLIC_ICON_SPRITE_HASH=${HASH}

echo "SVG sprite created: sprite.${HASH}.svg"
else
echo "SVG sprite created: sprite.svg (hash skipped for playwright environment)"
fi
1 change: 1 addition & 0 deletions docs/BUILD-TIME_ENVS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ These variables are passed to the app during the image build process. They canno
| NEXT_PUBLIC_GIT_COMMIT_SHA | `string` | SHA of the latest commit in the branch from which image is built | false | `29d0613e` |
| NEXT_PUBLIC_GIT_TAG | `string` | Git tag of the latest commit in the branch from which image is built | true | `v1.0.0` |
| NEXT_OPEN_TELEMETRY_ENABLED | `boolean` | Enables OpenTelemetry SDK | true | `true` |
| NEXT_PUBLIC_ICON_SPRITE_HASH | `string` | Hash post-fix of the SVG sprite file (generated automatically during the sprite build) | `08be4b10` | `true` |
7 changes: 7 additions & 0 deletions icons/monaco/cargo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/monaco/rust.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/monaco/toml.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/contexts/rewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function RewardsContextProvider({ children }: Props) {
// Save the API token to cookies and state
const saveApiToken = useCallback((token: string | undefined) => {
if (token) {
cookies.set(cookies.NAMES.REWARDS_API_TOKEN, token);
cookies.set(cookies.NAMES.REWARDS_API_TOKEN, token, { expires: 365 });
} else {
cookies.remove(cookies.NAMES.REWARDS_API_TOKEN);
}
Expand Down
2 changes: 2 additions & 0 deletions lib/mixpanel/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import getPageType from './getPageType';
import getUuid from './getUuid';
import logEvent from './logEvent';
import reset from './reset';
import useInit from './useInit';
import useLogPageView from './useLogPageView';
import * as userProfile from './userProfile';
Expand All @@ -13,4 +14,5 @@ export {
getPageType,
getUuid,
userProfile,
reset,
};
10 changes: 10 additions & 0 deletions lib/mixpanel/reset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import mixpanel from 'mixpanel-browser';

import config from 'configs/app';

export default function reset() {
if (!config.features.mixpanel.isEnabled) {
return;
}
mixpanel.reset();
}
1 change: 1 addition & 0 deletions lib/web3/wagmiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const wagmi = (() => {
projectId: feature.walletConnect.projectId,
ssr: true,
batch: { multicall: { wait: 100 } },
syncConnectedChain: false,
});

return { config: wagmiAdapter.wagmiConfig, adapter: wagmiAdapter };
Expand Down
2 changes: 1 addition & 1 deletion mocks/address/tabCounters.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { AddressTabsCounters } from 'types/api/address';

export const base: AddressTabsCounters = {
internal_txs_count: 13,
internal_transactions_count: 13,
logs_count: 51,
token_balances_count: 3,
token_transfers_count: 3,
Expand Down
2 changes: 1 addition & 1 deletion mocks/blocks/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export const withBlobTxs: Block = {
blob_gas_used: '393216',
burnt_blob_fees: '8461393325064192',
excess_blob_gas: '79429632',
blob_tx_count: 1,
blob_transaction_count: 1,
};

export const withWithdrawals: Block = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"lint:envs-validator:test": "cd ./deploy/tools/envs-validator && ./test.sh",
"prepare": "husky install",
"svg:format": "svgo -r ./icons",
"svg:build-sprite": "icons build -i ./icons -o ./public/icons --optimize",
"svg:build-sprite": "./deploy/scripts/build_sprite.sh",
"test:pw": "./tools/scripts/pw.sh",
"test:pw:local": "export NODE_PATH=$(pwd)/node_modules && yarn test:pw",
"test:pw:docker": "docker run --rm --ipc=host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.49.0-noble ./tools/scripts/pw.docker.sh",
Expand Down
3 changes: 3 additions & 0 deletions public/icons/name.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,13 @@
| "merits_with_dot"
| "merits"
| "minus"
| "monaco/cargo"
| "monaco/file"
| "monaco/folder-open"
| "monaco/folder"
| "monaco/rust"
| "monaco/solidity"
| "monaco/toml"
| "monaco/vyper"
| "moon-with-star"
| "moon"
Expand Down
2 changes: 1 addition & 1 deletion stubs/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const ADDRESS_COUNTERS: AddressCounters = {
};

export const ADDRESS_TABS_COUNTERS: AddressTabsCounters = {
internal_txs_count: 10,
internal_transactions_count: 10,
logs_count: 10,
token_balances_count: 10,
token_transfers_count: 10,
Expand Down
3 changes: 2 additions & 1 deletion tools/scripts/dev.preset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ dotenv \
-e $config_file \
-- bash -c './deploy/scripts/download_assets.sh ./public/assets/configs'

yarn svg:build-sprite
source ./deploy/scripts/build_sprite.sh
echo ""

# generate envs.js file and run the app
dotenv \
-v NEXT_PUBLIC_GIT_COMMIT_SHA=$(git rev-parse --short HEAD) \
-v NEXT_PUBLIC_GIT_TAG=$(git describe --tags --abbrev=0) \
-v NEXT_PUBLIC_ICON_SPRITE_HASH="${NEXT_PUBLIC_ICON_SPRITE_HASH}" \
-e $config_file \
-e $secrets_file \
-- bash -c './deploy/scripts/make_envs_script.sh && next dev -p $NEXT_PUBLIC_APP_PORT' |
Expand Down
3 changes: 2 additions & 1 deletion tools/scripts/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ dotenv \
-e .env \
-- bash -c './deploy/scripts/download_assets.sh ./public/assets/configs'

yarn svg:build-sprite
source ./deploy/scripts/build_sprite.sh
echo ""

# generate envs.js file and run the app
dotenv \
-v NEXT_PUBLIC_GIT_COMMIT_SHA=$(git rev-parse --short HEAD) \
-v NEXT_PUBLIC_GIT_TAG=$(git describe --tags --abbrev=0) \
-v NEXT_PUBLIC_ICON_SPRITE_HASH="${NEXT_PUBLIC_ICON_SPRITE_HASH}" \
-e .env.secrets \
-e .env.development.local \
-e .env.local \
Expand Down
2 changes: 2 additions & 0 deletions tools/scripts/pw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ dotenv \
-e $config_file \
-- bash -c './deploy/scripts/make_envs_script.sh ./playwright/envs.js'

# Important to set this variable here, so the sprite will be built correctly
export NEXT_PUBLIC_APP_ENV=pw
yarn svg:build-sprite

# Check if the "--affected" argument is present in the script args
Expand Down
2 changes: 1 addition & 1 deletion types/api/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export type AddressWithdrawalsItem = {
};

export type AddressTabsCounters = {
internal_txs_count: number | null;
internal_transactions_count: number | null;
logs_count: number | null;
token_balances_count: number | null;
token_transfers_count: number | null;
Expand Down
2 changes: 1 addition & 1 deletion types/api/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export interface Block {
blob_gas_used?: string;
burnt_blob_fees?: string;
excess_blob_gas?: string;
blob_tx_count?: number;
blob_transaction_count?: number;
// ZKSYNC FIELDS
zksync?: Omit<ZkSyncBatchesItem, 'number' | 'transaction_count' | 'timestamp'> & {
batch_number: number | null;
Expand Down
2 changes: 1 addition & 1 deletion types/api/verifiedContracts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface VerifiedContractsSorting {
sort: 'balance' | 'txs_count';
sort: 'balance' | 'transactions_count';
order: 'asc' | 'desc';
}

Expand Down
2 changes: 1 addition & 1 deletion ui/address/contract/ContractSourceAddressSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const ContractSourceAddressSelector = ({ className, selectedItem, onItemSelect,
<Select
options={ options }
name="contract-source-address"
defaultValue={ options[0].value }
defaultValue={ selectedItem.address }
onChange={ handleItemSelect }
isLoading={ isLoading }
maxW={{ base: '180px', lg: 'none' }}
Expand Down
4 changes: 2 additions & 2 deletions ui/block/BlockDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ const BlockDetails = ({ query }: Props) => {
</LinkInternal>
);

const blockBlobTxsNum = (config.features.dataAvailability.isEnabled && data.blob_tx_count) ? (
const blockBlobTxsNum = (config.features.dataAvailability.isEnabled && data.blob_transaction_count) ? (
<>
<span> including </span>
<LinkInternal href={ route({ pathname: '/block/[height_or_hash]', query: { height_or_hash: heightOrHash, tab: 'blob_txs' } }) }>
{ data.blob_tx_count } blob txn{ data.blob_tx_count === 1 ? '' : 's' }
{ data.blob_transaction_count } blob txn{ data.blob_transaction_count === 1 ? '' : 's' }
</LinkInternal>
</>
) : null;
Expand Down
2 changes: 1 addition & 1 deletion ui/block/useBlockBlobTxsQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function useBlockBlobTxsQuery({ heightOrHash, blockQuery, tab }:
pathParams: { height_or_hash: heightOrHash },
filters: { type: 'blob_transaction' },
options: {
enabled: Boolean(tab === 'blob_txs' && !blockQuery.isPlaceholderData && blockQuery.data?.blob_tx_count),
enabled: Boolean(tab === 'blob_txs' && !blockQuery.isPlaceholderData && blockQuery.data?.blob_transaction_count),
placeholderData: generateListStub<'block_txs'>(TX, 3, { next_page_params: null }),
refetchOnMount: false,
},
Expand Down
2 changes: 1 addition & 1 deletion ui/blocks/BlocksTableItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const BlocksTableItem = ({ data, isLoading, enableTimeIncrement }: Props) => {
) }
{ !isRollup && !config.UI.views.block.hiddenFields?.base_fee && Boolean(baseFeeValue) && (
<Td fontSize="sm" isNumeric>
<Skeleton isLoaded={ !isLoading } display="inline-block">
<Skeleton isLoaded={ !isLoading } display="inline-block" whiteSpace="pre-wrap" wordBreak="break-word">
{ baseFeeValue }
</Skeleton>
</Td>
Expand Down
2 changes: 1 addition & 1 deletion ui/pages/Address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ const AddressPageContent = () => {
{
id: 'internal_txns',
title: 'Internal txns',
count: addressTabsCountersQuery.data?.internal_txs_count,
count: addressTabsCountersQuery.data?.internal_transactions_count,
component: <AddressInternalTxs scrollRef={ tabsScrollRef } shouldRender={ !isTabsLoading } isQueryEnabled={ areQueriesEnabled }/>,
},
addressTabsCountersQuery.data?.celo_election_rewards_count ? {
Expand Down
2 changes: 1 addition & 1 deletion ui/pages/Block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const BlockPageContent = () => {
</>
),
},
config.features.dataAvailability.isEnabled && blockQuery.data?.blob_tx_count ?
config.features.dataAvailability.isEnabled && blockQuery.data?.blob_transaction_count ?
{
id: 'blob_txs',
title: 'Blob txns',
Expand Down
2 changes: 1 addition & 1 deletion ui/pages/RewardsDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const RewardsDashboard = () => {
<>
See the{ ' ' }
<LinkExternal
href="https://docs.blockscout.com/using-blockscout/merits/streak-number-and-daily-rewards"
href="https://docs.blockscout.com/using-blockscout/merits/streak-rewards"
isExternal
>
docs
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions ui/pools/PoolsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ type Props = {

const PoolsTable = ({ items, page, isLoading, top }: Props) => {
return (
<Table>
<Table minWidth="900px">
<Thead top={ top ?? ACTION_BAR_HEIGHT_DESKTOP }>
<Tr>
<Th width="70%">Pool</Th>
<Th width="30%">DEX </Th>
<Th width="120px" isNumeric>
<Th width="130px" isNumeric>
<Flex alignItems="center" justifyContent="end">
FDV
<Hint
Expand All @@ -33,8 +33,8 @@ const PoolsTable = ({ items, page, isLoading, top }: Props) => {
/>
</Flex>
</Th>
<Th width="120px" isNumeric>Market cap</Th>
<Th width="120px" isNumeric>Liquidity</Th>
<Th width="130px" isNumeric>Market cap</Th>
<Th width="130px" isNumeric>Liquidity</Th>
<Th width="75px" isNumeric>View in</Th>
</Tr>
</Thead>
Expand Down
9 changes: 7 additions & 2 deletions ui/pools/PoolsTableItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ const PoolsTableItem = ({
<Skeleton isLoaded={ !isLoading }>
<Text px={ 2 }>{ getItemIndex(index, page) }</Text>
</Skeleton>
<Box>
<Box overflow="hidden">
<PoolEntity pool={ item } fontWeight={ 700 } mb={ 2 } isLoading={ isLoading }/>
<AddressEntity address={{ hash: item.contract_address }} noIcon isLoading={ isLoading }/>
<AddressEntity
address={{ hash: item.contract_address }}
noIcon
isLoading={ isLoading }
truncation="constant_long"
/>
</Box>
</Flex>
</Td>
Expand Down
4 changes: 3 additions & 1 deletion ui/shared/IconSvg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { Skeleton, chakra } from '@chakra-ui/react';
import { type IconName } from 'public/icons/name';
import React from 'react';

export const href = '/icons/sprite.svg';
import config from 'configs/app';

export const href = config.app.spriteHash ? `/icons/sprite.${ config.app.spriteHash }.svg` : '/icons/sprite.svg';

export { IconName };

Expand Down
12 changes: 12 additions & 0 deletions ui/shared/monaco/CodeEditorFileIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ const CodeEditorFileIcon = ({ className, fileName }: Props) => {
return 'monaco/solidity';
}

if (/.rs$/.test(fileName)) {
return 'monaco/rust';
}

if (/^Cargo\./.test(fileName)) {
return 'monaco/cargo';
}

if (/.toml$/.test(fileName)) {
return 'monaco/toml';
}

return 'monaco/file';
})();

Expand Down
Loading
Loading