Skip to content

Commit

Permalink
fix: Fix styling issue of download contract source code button on zke…
Browse files Browse the repository at this point in the history
…vm.polygonscan.com and add contributing documentation
  • Loading branch information
0xbe37e committed Mar 21, 2024
1 parent 0262ce6 commit 2433c9a
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 81 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### v4.7.0

- [feat] Integration with Blockscout explorer
- [update] Update dedaub decompile functionality
- [fix] Fix the styling issue of the "Download Contract Source Code" button on zkevm.polygonscan.com

### v4.6.0

- [feat] Added support for basescan in deth
Expand Down
89 changes: 89 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Contributing

thanks for your interest in contributing to MetaSuites! Please take a moment to review this document before submitting a pull request.

## Important

When submitting a pull request (PR), please ensure that it is merged into the `develop` branch rather than the `main` branch.

## Cloning the repository

To start contributing to the project, clone it to your local machine using git:

```shell
git clone https://github.com/blocksecteam/metasuites.git --recurse-submodules
```

## Installing Node.js

You need to install Node.js v18.12.0 or higher. You can run the following commands in your terminal to check your local Node.js versions:

```shell
node -v
```

If the versions are not correct or you don't have Node.js or Bun installed, download and follow their setup instructions:

- Install Node.js using [fnm](https://github.com/Schniz/fnm) or from the [official website](https://nodejs.org)
- Install Node.js using [nvm](https://github.com/nvm-sh/nvm#installing-and-updating) running `nvm use` will automatically choose the right node version for you.

## Installing yarn

```shell
npm install -g yarn
```

## Installing dependencies

Once in the project's root directory, run the following command to install the project's dependencies:

```shell
yarn install
```

## Running the test suite

you may run `yarn start` to locally debug the interface in the production environment.Please note that do not run yarn dev locally, as it will request the API of BlockSec's development environment, which is internal-use only.

```shell
yarn start
```

## Running Linting

You can run the linter by itself with `yarn lint`.

## Changing dependencies

Whenever you change dependencies (adding, removing, or updating, either in `package.json` or `yarn.lock`), `yarn.lock` must be kept up-to-date.

## Building

### Chrome and Firefox

- Build the project to the `/dist/*` folder with `yarn build:prod` or `yarn build-firefox:prod`.

```shell
# chrome
yarn build:prod
# firefox
yarn build-firefox:prod
# safari
yarn build-safari:prod
xcrun safari-web-extension-converter --macos-only /path/to/metasuites/dist/safari-extension
```

### Safari

Install Xcode (for building the Safari package)

To build the extension for distribution, or to run it locally for testing purposes, follow these steps:

```shell
# step 1
yarn build-safari:prod
# step 2
xcrun safari-web-extension-converter --macos-only /path/to/metasuites/dist/safari-extension
```

For more information on building and debugging Safari extensions, see the [official documentation](https://developer.apple.com/documentation/safariservices/safari_web_extensions/).
79 changes: 13 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,72 +10,6 @@ MetaSuites supports Google Chrome, Firefox and Safari. We recommend using the la

For up to the minute news, follow our [Twitter](https://twitter.com/MetaDockTeam) or [Medium](https://blocksecteam.medium.com/getting-started-with-metasuites-5e3b3aeb64d4) pages.

## Building

- Install [Node.js](https://nodejs.org) version 18.12.0 or later
- If you are using [nvm](https://github.com/nvm-sh/nvm#installing-and-updating) (recommended) running `nvm use` will automatically choose the right node version for you.
- Install [Yarn](https://yarnpkg.com/en/docs/install)
- Xcode (for building the Safari package)

```shell
npm install -g yarn
```

- Install dependencies: `yarn install` or `yarn`

```shell
yarn install
# or
yarn
```

### Chrome and Firefox

- Build the project to the `/dist/*` folder with `yarn build:prod` or `yarn build-firefox:prod`.

```shell
# chrome
yarn build:prod
# firefox
yarn build-firefox:prod
# safari
yarn build-safari:prod
xcrun safari-web-extension-converter --macos-only /path/to/metasuites/dist/safari-extension
```

- Optionally, you may run `yarn dev` to run dev mode.

```shell
yarn dev
```

### Safari

To build the extension for distribution, or to run it locally for testing purposes, follow these steps:

```shell
# step 1
yarn build-safari:prod
# step 2
xcrun safari-web-extension-converter --macos-only /path/to/metasuites/dist/safari-extension
```

For more information on building and debugging Safari extensions, see the [official documentation](https://developer.apple.com/documentation/safariservices/safari_web_extensions/).

## Contributing

### Development builds

To start a development build (e.g. with logging and file watching) run `yarn dev`.

### Running Linting

You can run the linter by itself with `yarn lint`.

### Changing dependencies

Whenever you change dependencies (adding, removing, or updating, either in `package.json` or `yarn.lock`), `yarn.lock` must be kept up-to-date.

## Features

- [x] Show the fund flow chart
Expand Down Expand Up @@ -120,8 +54,21 @@ Whenever you change dependencies (adding, removing, or updating, either in `pack
- moonscan.io
- snowtrace.io
- optimistic.etherscan.io
- nova.arbiscan.io
- bttcscan.com
- celoscan.io
- gnosisscan.io
- basescan.org
- lineascan.build
- wemixscan.com
- opensea.io
- tronscan.org
- era.zksync.network
- blockscout.com

## Contributing

If you're interested in contributing, please read the [Contributing Guide](https://github.com/blocksecteam/metasuites/blob/main/CONTRIBUTING.md) before submitting a pull request.

## Changelog

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"name": "metasuites",
"version": "4.6.0",
"version": "4.7.0",
"repository": {
"type": "git",
"url": "https://github.com/blocksecteam/metasuites.git"
},
"engines": {
"node": ">=18.12.0"
"node": ">=18.17.0"
},
"type": "module",
"scripts": {
"dev": "vite --mode development",
"start": "vite --mode production",
"build:prod": "vite build --mode production --outDir dist/chrome-extension",
"build:test": "vite build --mode test --outDir dist/chrome-extension",
"build-firefox:prod": "vite build --mode production --outDir dist/firefox-extension && node build/firefox.js",
Expand Down
8 changes: 2 additions & 6 deletions src/common/constants/support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ export const DEDAUB_SUPPORT_DIRECT_LIST = [
{
chain: 'base',
pathname: 'base'
},
}
]

export const ETHERSCAN_DETH_SUPPORT_LIST = [
Expand Down Expand Up @@ -796,11 +796,7 @@ export class TransactionParsers extends BaseConstant {
'openchain',
'https://openchain.xyz/trace'
)
static DEDAUB = new BaseConstant(
'dedaub',
'dedaub',
'https://app.dedaub.com'
)
static DEDAUB = new BaseConstant('dedaub', 'dedaub', 'https://app.dedaub.com')
}

export const PROXY_LOG_SUPPORT_LIST = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ const DecompileInDedaubBtn: FC<Props> = ({ mainAddress, chain }) => {
.then(response => response.text())
.then(data => {
window.open(
`https://app.dedaub.com/decompile?md5=${data.replace(/"/g, '')}&chain=${chain}&address=${mainAddress}`
`https://app.dedaub.com/decompile?md5=${data.replace(
/"/g,
''
)}&chain=${chain}&address=${mainAddress}`
)
})
.catch(() => {
Expand Down
6 changes: 4 additions & 2 deletions src/content/etherscan/feat-scripts/tx-address-labels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import { GET_ADDRESS_LABELS, GET_IMPL_LABELS } from '@common/constants'
import { TokenSymbol } from '@common/components'

const isFromToAddress = (el: HTMLElement) => {
return !!$(el).parent().siblings("a.js-clipboard[aria-label='Copy Address']")
.length
return !!$(el)
.parent()
.siblings("a.js-clipboard[aria-label='Copy Address']")
.find("i[id^='linkIcon-']").length
}

const getAddressTag = (
Expand Down
1 change: 0 additions & 1 deletion src/content/scans/components/Button/index.module.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@import '@common/styles/common.less';

.btn {
font-weight: 500;
text-align: center;
vertical-align: middle;
cursor: pointer;
Expand Down
8 changes: 7 additions & 1 deletion src/content/scans/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ const Button: FC<PropsWithChildren<Props>> = props => {
onClick
} = props

const classNames = cls(styles.btn, `btn-${type}`, `btn-${size}`, className)
const classNames = cls(
styles.btn,
'btn',
`btn-${type}`,
`btn-${size}`,
className
)

const stylesheet = Object.assign(
{
Expand Down
5 changes: 4 additions & 1 deletion src/content/scans/components/DecompileInDedaubBtn/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ const DecompileInDedaubBtn: FC<Props> = ({ mainAddress, chain }) => {
.then(response => response.text())
.then(data => {
window.open(
`https://app.dedaub.com/decompile?md5=${data.replace(/"/g, '')}&chain=${chain}&address=${mainAddress}`
`https://app.dedaub.com/decompile?md5=${data.replace(
/"/g,
''
)}&chain=${chain}&address=${mainAddress}`
)
})
.catch(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const DownloadSourceCodeBtn: FC<PostAddressParams> = ({ chain, address }) => {
new URLSearchParams({ chain, address })
}
type="secondary"
icon={<IconDownload mr={4} color="#fff" />}
icon={<IconDownload mr={4} color="var(--bs-btn-color, white)" />}
>
Download as Zip
</Button>
Expand Down

0 comments on commit 2433c9a

Please sign in to comment.