Skip to content

Commit

Permalink
Merge pull request #72 from citahub/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
rainchen authored Feb 28, 2020
2 parents 73de565 + 3da14be commit 5dd4744
Show file tree
Hide file tree
Showing 9 changed files with 232 additions and 116 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: node_js
sudo: true
node_js:
- '10.16'
#before_install:
# - yarn audit
install:
- yarn
script:
- yarn run build
- docker build -t microscope .
- docker run --name microscope -d -p 8080:80 microscope
- curl 127.0.0.1:8080
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:10 as node

WORKDIR /app

COPY package*.json ./
COPY yarn.lock ..

RUN yarn
COPY . .

RUN npm run build

FROM nginx
EXPOSE 80

COPY --from=node /app/build /usr/share/nginx/html
37 changes: 37 additions & 0 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,40 @@ English | [简体中文](./README-CN.md)
yarn install
```

* 修改配置, 在"src/utils/config.ts"

```
const api: API = {
serverList: [
{
name: 'Re-Birth Server',
url: 'https://rebirth.citahub.com'
},
{
name: 'CITA Node Server',
url: 'https://testnet.citahub.com'
}
],
jsonRpc: '/',
url: '/api/info/url',
status: '/api/status',
statistics: '/api/statistics',
blockList: '/api/blocks',
blockListV2: '/api/v2/blocks',
transactionList: '/api/transactions',
ercTransactionList: '/api/erc20/transfers'
}
const config: Config = {
api: api,
apiTimeout: 15000,
apiTimeoutMsg: 'api timeout,try it later',
apiErrorMsg: 'network error!',
icpRecordName: '',
icpRecordUrl: ''
}
```

* 调试环境

```
Expand All @@ -87,6 +121,9 @@ English | [简体中文](./README-CN.md)

* 验证是否成功通过访问 https://YOUR_GITHUB_USERNAME.github.io/microscope-v2/ i.e. if your github name is cryptape then replace YOUR_GITHUB_USERNAME with cryptape.

# 使用docker 部署一个microscope
1. docker build -t microscope . 构建docker镜像
2. docker run --name microscope -d -p 80:80 microscope 后台启动镜像,绑定80端口

# 目录结构

Expand Down
41 changes: 39 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ English | [简体中文](./README-CN.md)


# Run

* Prerequisite

node ^8.10.0 || ^10.13.0 || >=11.10.1
Expand All @@ -68,6 +68,40 @@ English | [简体中文](./README-CN.md)
yarn install
```

* modify config in "src/utils/config.ts"

```
const api: API = {
serverList: [
{
name: 'Re-Birth Server',
url: 'https://rebirth.citahub.com'
},
{
name: 'CITA Node Server',
url: 'https://testnet.citahub.com'
}
],
jsonRpc: '/',
url: '/api/info/url',
status: '/api/status',
statistics: '/api/statistics',
blockList: '/api/blocks',
blockListV2: '/api/v2/blocks',
transactionList: '/api/transactions',
ercTransactionList: '/api/erc20/transfers'
}
const config: Config = {
api: api,
apiTimeout: 15000,
apiTimeoutMsg: 'api timeout,try it later',
apiErrorMsg: 'network error!',
icpRecordName: '',
icpRecordUrl: ''
}
```
* Develop Environment
```
Expand All @@ -89,6 +123,9 @@ English | [简体中文](./README-CN.md)
* Verify that it works by visiting https://YOUR_GITHUB_USERNAME.github.io/microscope-v2/ i.e. if your github name is cryptape then replace YOUR_GITHUB_USERNAME with cryptape.
# Having a microscope on docker
1. docker build -t microscope . build docker image
2. docker run --name microscope -d -p 80:80 microscope run microscope on port 80
# Directory Structure
Expand Down Expand Up @@ -122,7 +159,7 @@ English | [简体中文](./README-CN.md)
* /src/layouts/search/ -------- Search Failed Page
* /src/layouts/common --------- Transaction Table、Transaction Search Modal、Block Search Modal
* /src/components/ ------------ Basic Components,header/content/footer/loading/tab/toast/modal
* /src/components/redux ------- redux reduce/action/state
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"keywords": [],
"author": "[email protected]",
"dependencies": {
"@cryptape/cita-sdk": "^0.24.0",
"@citahub/cita-sdk": "^1.0.1",
"@types/echarts": "^4.1.9",
"@types/history": "^4.7.2",
"@types/react": "^16.7.18",
Expand All @@ -48,7 +48,7 @@
"babel-preset-react": "6.24.1",
"babel-register": "^6.26.0",
"bootstrap": "^4.1.3",
"copy-webpack-plugin": "^5.0.3",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.0.0",
"echarts": "^4.1.0",
"echarts-for-react": "^2.0.15-beta.0",
Expand Down Expand Up @@ -85,7 +85,7 @@
"ts-loader": "^6.0.4",
"typescript": "^3.2.2",
"web3-eth-abi": "^1.0.0-beta.55",
"webpack": "^4.0.0",
"webpack": "^4.41.2",
"webpack-cli": "^3.1.2",
"webpack-merge": "^4.1.4"
},
Expand Down
2 changes: 1 addition & 1 deletion src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const api: API = {
},
{
name: 'CITA Node Server',
url: 'https://node.citahub.com'
url: 'https://testnet.citahub.com'
}
],
jsonRpc: '/',
Expand Down
3 changes: 3 additions & 0 deletions src/utils/hex.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import citaSDK from './sdk'

const web3Utils = require('web3-utils')
const BN = web3Utils.BN
export function valueFormat(
Expand Down Expand Up @@ -87,6 +89,7 @@ export function getContractData(
) {
getAbi(contractAddress)
.then((abis: any) => {
new citaSDK.base.Contract(abis)
const fnHash = data.slice(0, 10)
abis.forEach((_abi: any) => {
if (_abi.signature === fnHash) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ServerNode } from './config'
import { getSelectNetwork } from './storage'
import CITASDK from '@cryptape/cita-sdk'
import CITASDK from '@citahub/cita-sdk'

var serverNode: ServerNode = getSelectNetwork()
const citaSDK = CITASDK(serverNode.url)
Expand Down
Loading

0 comments on commit 5dd4744

Please sign in to comment.