├── .editorconfig
├── .gitignore
├── .prettierrc
├── .travis.yml
├── LICENSE
├── README.md
├── config
├── env.js
├── paths.js
├── polyfills.js
├── webpack.config.dev.js
├── webpack.config.prod.js
└── webpackDevServer.config.js
├── images.d.ts
├── package.json
├── public
├── favicon.ico
├── index.html
├── manifest.json
├── og_image.png
└── og_image_corgi.png
├── scripts
├── build-preset
│ ├── corgi.sh
│ └── mainnet.sh
├── build.js
└── start.js
├── src
├── _globals.scss
├── _mixins.scss
├── _variables.scss
├── components
│ ├── asset
│ │ ├── AssetDetails
│ │ │ ├── AssetDetails.scss
│ │ │ └── AssetDetails.tsx
│ │ ├── AssetList
│ │ │ ├── AssetList.scss
│ │ │ └── AssetList.tsx
│ │ └── AssetOwners
│ │ │ ├── AssetOwners.scss
│ │ │ ├── AssetOwners.tsx
│ │ │ └── AssetOwnersChart.tsx
│ ├── block
│ │ ├── BlockDetails
│ │ │ ├── BlockDetails.scss
│ │ │ └── BlockDetails.tsx
│ │ └── BlockList
│ │ │ ├── BlockList.scss
│ │ │ └── BlockList.tsx
│ ├── error
│ │ └── Error
│ │ │ ├── Error.scss
│ │ │ ├── Error.tsx
│ │ │ └── img
│ │ │ └── error-monster.png
│ ├── footer
│ │ ├── Footer.scss
│ │ ├── Footer.tsx
│ │ └── img
│ │ │ ├── codechain-icon.png
│ │ │ ├── codechain-icon.svg
│ │ │ └── logo.png
│ ├── header
│ │ ├── Header
│ │ │ ├── Header.scss
│ │ │ ├── Header.tsx
│ │ │ └── img
│ │ │ │ ├── logo-explorer.png
│ │ │ │ └── logo.png
│ │ └── Search
│ │ │ ├── Search.scss
│ │ │ └── Search.tsx
│ ├── home
│ │ ├── LatestBlocks
│ │ │ ├── LatestBlocks.scss
│ │ │ └── LatestBlocks.tsx
│ │ ├── LatestTransactions
│ │ │ ├── LatestTransactions.scss
│ │ │ └── LatestTransactions.tsx
│ │ └── Summary
│ │ │ ├── Summary.scss
│ │ │ ├── Summary.tsx
│ │ │ ├── WeeklyChart.tsx
│ │ │ └── img
│ │ │ └── empty.png
│ ├── platformAddress
│ │ └── AccountDetails
│ │ │ ├── AccountDetails.scss
│ │ │ └── AccountDetails.tsx
│ ├── status
│ │ ├── ChainInfo
│ │ │ ├── ChainInfo.scss
│ │ │ └── ChainInfo.tsx
│ │ ├── ExplorerInfo
│ │ │ ├── ExplorerInfo.scss
│ │ │ └── ExplorerInfo.tsx
│ │ ├── NodeStatus
│ │ │ ├── NodeStatus.scss
│ │ │ └── NodeStatus.tsx
│ │ ├── SyncStatus
│ │ │ ├── SyncStatus.scss
│ │ │ └── SyncStatus.tsx
│ │ └── TransactionChart
│ │ │ └── TransactionChart.tsx
│ ├── transaction
│ │ ├── BlockTransactionList
│ │ │ ├── BlockTransactionList.scss
│ │ │ ├── BlockTransactionList.tsx
│ │ │ └── BlockTransactionListPage.tsx
│ │ ├── TransactionDetails
│ │ │ ├── CommonDetails
│ │ │ │ └── CommonDetails.tsx
│ │ │ ├── DetailsByType
│ │ │ │ ├── AssetMintDetails
│ │ │ │ │ └── AssetMintDetails.tsx
│ │ │ │ ├── AssetTransferDetails
│ │ │ │ │ └── AssetTransferDetails.tsx
│ │ │ │ ├── ChangeAssetSchemeDetails
│ │ │ │ │ └── ChangeAssetSchemeDetails.tsx
│ │ │ │ ├── CreateShardDetails
│ │ │ │ │ └── CreateShardDetails.tsx
│ │ │ │ ├── CustomDetails
│ │ │ │ │ └── CustomDetails.tsx
│ │ │ │ ├── DetailsByType.tsx
│ │ │ │ ├── IncreaseAssetSupplyDetails
│ │ │ │ │ └── IncreaseAssetSupplyDetails.tsx
│ │ │ │ ├── PayDetails
│ │ │ │ │ └── PayDetails.tsx
│ │ │ │ ├── RemoveDetails
│ │ │ │ │ └── RemoveDetails.tsx
│ │ │ │ ├── SetRegularKeyDetails
│ │ │ │ │ └── SetRegularKeyDetails.tsx
│ │ │ │ ├── SetShardOwnersDetails
│ │ │ │ │ └── SetShardOwnersDetails.tsx
│ │ │ │ ├── SetShardUsersDetails
│ │ │ │ │ └── SetShardUsersDetails.tsx
│ │ │ │ ├── StoreDetails
│ │ │ │ │ └── StoreDetails.tsx
│ │ │ │ ├── UnwrapCCCDetails
│ │ │ │ │ └── UnwrapCCCDetails.tsx
│ │ │ │ └── WrapCCCDetails
│ │ │ │ │ └── WrapCCCDetails.tsx
│ │ │ ├── MoreInfo
│ │ │ │ ├── AssetOutput
│ │ │ │ │ └── AssetOutput.tsx
│ │ │ │ ├── AssetTransferInputs
│ │ │ │ │ └── AssetTransferInputs.tsx
│ │ │ │ ├── AssetTransferOrders
│ │ │ │ │ └── AssetTransferOrders.tsx
│ │ │ │ ├── AssetTransferOutputs
│ │ │ │ │ └── AssetTransferOutputs.tsx
│ │ │ │ └── MoreInfo.tsx
│ │ │ ├── TransactionDetails.scss
│ │ │ └── TransactionDetails.tsx
│ │ ├── TransactionList
│ │ │ ├── TransactionList.scss
│ │ │ ├── TransactionList.tsx
│ │ │ └── img
│ │ │ │ └── arrow.png
│ │ ├── TransactionListItems
│ │ │ └── TransactionListItems.tsx
│ │ └── TransactionSummary
│ │ │ ├── AssetIcon.tsx
│ │ │ ├── TransactionSummary.scss
│ │ │ └── TransactionSummary.tsx
│ └── util
│ │ ├── CommaNumberString
│ │ └── CommaNumberString.tsx
│ │ ├── CopyButton
│ │ ├── CopyButton.scss
│ │ └── CopyButton.tsx
│ │ ├── DataSet
│ │ └── DataSet.tsx
│ │ ├── DataTable
│ │ └── DataTable.tsx
│ │ ├── HealthChecker
│ │ ├── HealthChecker.scss
│ │ └── HealthChecker.tsx
│ │ ├── HexString
│ │ └── HexString.tsx
│ │ ├── ImageLoader
│ │ └── ImageLoader.tsx
│ │ ├── ScrollToTop
│ │ └── ScrollToTop.tsx
│ │ ├── StatusBadge
│ │ ├── StatusBadge.scss
│ │ └── StatusBadge.tsx
│ │ └── TypeBadge
│ │ ├── TypeBadge.scss
│ │ └── TypeBadge.tsx
├── index.scss
├── index.tsx
├── logo.svg
├── pages
│ ├── Asset
│ │ ├── Asset.scss
│ │ └── Asset.tsx
│ ├── AssetTransferAddress
│ │ ├── AssetTransferAddress.scss
│ │ └── AssetTransferAddress.tsx
│ ├── Block
│ │ ├── Block.scss
│ │ └── Block.tsx
│ ├── Blocks
│ │ ├── Blocks.scss
│ │ └── Blocks.tsx
│ ├── Home
│ │ ├── BlockCapacityUsageChart.tsx
│ │ ├── BlockCreationTimeChart.tsx
│ │ ├── FeeStatusChart.tsx
│ │ ├── Home.scss
│ │ ├── Home.tsx
│ │ └── TransactionsCountByTypeChart.tsx
│ ├── NotFound
│ │ ├── NotFound.scss
│ │ └── NotFound.tsx
│ ├── PendingTransactions
│ │ ├── PendingTransactions.scss
│ │ └── PendingTransactions.tsx
│ ├── PlatformAddress
│ │ ├── PlatformAddress.scss
│ │ └── PlatformAddress.tsx
│ ├── Status
│ │ ├── Status.scss
│ │ └── Status.tsx
│ ├── Transaction
│ │ ├── Transaction.scss
│ │ └── Transaction.tsx
│ └── Transactions
│ │ ├── Transactions.scss
│ │ └── Transactions.tsx
├── redux
│ ├── actions.ts
│ └── store.ts
├── register_service_worker.ts
├── request
│ ├── ApiRequest.tsx
│ ├── RequestAssetInfosByName.tsx
│ ├── RequestAssetScheme.tsx
│ ├── RequestAssetTransferAddressUTXO.tsx
│ ├── RequestAssetTypeUTXO.tsx
│ ├── RequestBlock.tsx
│ ├── RequestBlockNumber.tsx
│ ├── RequestBlockTransactions.tsx
│ ├── RequestBlocks.tsx
│ ├── RequestCodeChainStatus.tsx
│ ├── RequestDailyLogs.ts
│ ├── RequestFeeStats.tsx
│ ├── RequestIndexerVersion.tsx
│ ├── RequestNodeStatus.tsx
│ ├── RequestPendingTransactions.tsx
│ ├── RequestPing.tsx
│ ├── RequestPlatformAddressAccount.tsx
│ ├── RequestServerTime.tsx
│ ├── RequestSyncStatus.tsx
│ ├── RequestTotalBlockCount.tsx
│ ├── RequestTotalPlatformBlockCount.tsx
│ ├── RequestTransaction.tsx
│ ├── RequestTransactions.tsx
│ ├── RequestWeeklyLogs.ts
│ └── index.tsx
└── utils
│ ├── Address.ts
│ ├── Asset.ts
│ ├── BalanceHistory.ts
│ ├── Metadata.ts
│ ├── Time.ts
│ └── Transactions.ts
├── tsconfig.json
├── tsconfig.test.json
├── tslint.json
└── yarn.lock
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | end_of_line = lf
5 | charset = utf-8
6 | insert_final_newline = true
7 |
8 | [*.yml]
9 | indent_style = space
10 | indent_size = 2
11 |
12 | [{src,test}/**.{ts,tsx,json,js,jsx}]
13 | trim_trailing_whitespace = true
14 | indent_style = space
15 | indent_size = 4
16 |
17 | # npm inserts a final newline.
18 | [package.json]
19 | trim_trailing_whitespace = false
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 |
6 | # testing
7 | /coverage
8 |
9 | # production
10 | /build
11 |
12 | # misc
13 | .DS_Store
14 | .env.local
15 | .env.development.local
16 | .env.test.local
17 | .env.production.local
18 |
19 | npm-debug.log*
20 | yarn-debug.log*
21 | yarn-error.log*
22 |
23 | # dotenv
24 | .env
25 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "printWidth": 120
3 | }
4 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "12"
4 | before_install:
5 | - npm install -g yarn
6 | install:
7 | - yarn install
8 | script:
9 | - yarn run lint
10 | - yarn run build
11 | cache: yarn
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CodeChain Explorer [](https://gitter.im/CodeChain-io/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [](https://travis-ci.org/CodeChain-io/codechain-explorer)
2 |
3 | CodeChain explorer is a simple, easy to use, open-source visualization tool for viewing activity on the underlying blockchain network.
4 |
5 | ## Table of Contents
6 |
7 | - [Install](https://github.com/CodeChain-io/codechain-explorer#install)
8 | - [Running for development](https://github.com/CodeChain-io/codechain-explorer#running-for-development)
9 | - [Running for production](https://github.com/CodeChain-io/codechain-explorer#running-for-production)
10 |
11 | ## Install
12 |
13 | ### Download
14 |
15 | Download CodeChain-explorer's code from the GitHub repository
16 |
17 | ```
18 | # git clone git@github.com:kodebox-io/codechain-explorer.git
19 | # cd codechain-explorer
20 | ```
21 |
22 | ### Install package
23 |
24 | Use yarn package manager to install packages
25 |
26 | ```
27 | # yarn install
28 | ```
29 |
30 | ## Before starting
31 |
32 | ### Dependency
33 |
34 | - Get [CodeChain-indexer](https://github.com/CodeChain-io/codechain-indexer) ready for indexing block data and running the API server
35 |
36 | ### Running for development
37 |
38 | -The explorer will run at http://localhost:3000
39 |
40 | ```
41 | # yarn run start
42 |
43 | // You can chage the port of test server and the host URL with environment variables.
44 | # PORT=3000 REACT_APP_SERVER_HOST=http://127.0.0.1:8081 yarn run start
45 | ```
46 |
47 | ### Running for production
48 |
49 | #### Build
50 |
51 | Build CodeChain-explorer with the following script. You can get optimized and uglified build code. It will be located in the "/build" directory
52 |
53 | ```
54 | # yarn run build
55 | ```
56 |
57 | - You can change the server host using an environment variable
58 |
59 | ```
60 | # REACT_APP_SERVER_HOST=http://127.0.0.1:8080 yarn run build
61 | ```
62 |
63 | ## Custom Configuration
64 |
65 | ### Build
66 |
67 | | | Default | Options | Description |
68 | | ----------------------------- | --------------------- | ------- | ------------------------------- |
69 | | REACT_APP_SERVER_HOST | http://127.0.0.1:9001 | | |
70 | | REACT_APP_URL | | | This is used for the open graph |
71 | | REACT_APP_HEADER_TITLE | | | |
72 | | REACT_APP_HEADER_SHORT_TITLE | | | |
73 | | REACT_APP_OG_TITLE | | | |
74 | | REACT_APP_OG_DESC | | | |
75 | | REACT_APP_OG_IMAGE | | | |
76 | | REACT_APP_GOOGLE_ANALYTICS_ID | | | |
77 | | PUBLIC_URL | | | |
78 |
--------------------------------------------------------------------------------
/config/env.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const fs = require('fs');
4 | const path = require('path');
5 | const paths = require('./paths');
6 |
7 | // Make sure that including paths.js after env.js will read .env variables.
8 | delete require.cache[require.resolve('./paths')];
9 |
10 | const NODE_ENV = process.env.NODE_ENV;
11 | if (!NODE_ENV) {
12 | throw new Error(
13 | 'The NODE_ENV environment variable is required but was not specified.'
14 | );
15 | }
16 |
17 | // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
18 | var dotenvFiles = [
19 | `${paths.dotenv}.${NODE_ENV}.local`,
20 | `${paths.dotenv}.${NODE_ENV}`,
21 | // Don't include `.env.local` for `test` environment
22 | // since normally you expect tests to produce the same
23 | // results for everyone
24 | NODE_ENV !== 'test' && `${paths.dotenv}.local`,
25 | paths.dotenv,
26 | ].filter(Boolean);
27 |
28 | // Load environment variables from .env* files. Suppress warnings using silent
29 | // if this file is missing. dotenv will never modify any environment variables
30 | // that have already been set. Variable expansion is supported in .env files.
31 | // https://github.com/motdotla/dotenv
32 | // https://github.com/motdotla/dotenv-expand
33 | dotenvFiles.forEach(dotenvFile => {
34 | if (fs.existsSync(dotenvFile)) {
35 | require('dotenv-expand')(
36 | require('dotenv').config({
37 | path: dotenvFile,
38 | })
39 | );
40 | }
41 | });
42 |
43 | // We support resolving modules according to `NODE_PATH`.
44 | // This lets you use absolute paths in imports inside large monorepos:
45 | // https://github.com/facebookincubator/create-react-app/issues/253.
46 | // It works similar to `NODE_PATH` in Node itself:
47 | // https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
48 | // Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
49 | // Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
50 | // https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421
51 | // We also resolve them to make sure all tools using them work consistently.
52 | const appDirectory = fs.realpathSync(process.cwd());
53 | process.env.NODE_PATH = (process.env.NODE_PATH || '')
54 | .split(path.delimiter)
55 | .filter(folder => folder && !path.isAbsolute(folder))
56 | .map(folder => path.resolve(appDirectory, folder))
57 | .join(path.delimiter);
58 |
59 | // Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
60 | // injected into the application via DefinePlugin in Webpack configuration.
61 | const REACT_APP = /^REACT_APP_/i;
62 |
63 | function getClientEnvironment(publicUrl) {
64 | const raw = Object.keys(process.env)
65 | .filter(key => REACT_APP.test(key))
66 | .reduce(
67 | (env, key) => {
68 | env[key] = process.env[key];
69 | return env;
70 | },
71 | {
72 | // Useful for determining whether we’re running in production mode.
73 | // Most importantly, it switches React into the correct mode.
74 | NODE_ENV: process.env.NODE_ENV || 'development',
75 | // Useful for resolving the correct path to static assets in `public`.
76 | // For example,
.
77 | // This should only be used as an escape hatch. Normally you would put
78 | // images into the `src` and `import` them in code to get their paths.
79 | PUBLIC_URL: publicUrl,
80 | }
81 | );
82 | // Stringify all values so we can feed into Webpack DefinePlugin
83 | const stringified = {
84 | 'process.env': Object.keys(raw).reduce(
85 | (env, key) => {
86 | env[key] = JSON.stringify(raw[key]);
87 | return env;
88 | },
89 | {}
90 | ),
91 | };
92 |
93 | return { raw, stringified };
94 | }
95 |
96 | module.exports = getClientEnvironment;
97 |
--------------------------------------------------------------------------------
/config/paths.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const path = require("path");
4 | const fs = require("fs");
5 | const url = require("url");
6 |
7 | // Make sure any symlinks in the project folder are resolved:
8 | // https://github.com/facebookincubator/create-react-app/issues/637
9 | const appDirectory = fs.realpathSync(process.cwd());
10 | const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
11 |
12 | const envPublicUrl = process.env.PUBLIC_URL;
13 |
14 | function ensureSlash(path, needsSlash) {
15 | const hasSlash = path.endsWith("/");
16 | if (hasSlash && !needsSlash) {
17 | return path.substr(path, path.length - 1);
18 | } else if (!hasSlash && needsSlash) {
19 | return `${path}/`;
20 | } else {
21 | return path;
22 | }
23 | }
24 |
25 | const getPublicUrl = appPackageJson => envPublicUrl || require(appPackageJson).homepage;
26 |
27 | // We use `PUBLIC_URL` environment variable or "homepage" field to infer
28 | // "public path" at which the app is served.
29 | // Webpack needs to know it to put the right
45 |
54 |