Skip to content

Commit

Permalink
Merge pull request #23 from cryptape/develop
Browse files Browse the repository at this point in the history
update
  • Loading branch information
Keith-CY authored Sep 18, 2018
2 parents 6cf752c + 9115ac4 commit 7634209
Show file tree
Hide file tree
Showing 6 changed files with 350 additions and 236 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ This project rewrite truffle migrate part of truffle-box, so you need to read tr
1. Install Truffle globally

To use our truffle box, you need to install truffle first.
```
```shell
yarn global add truffle
```

2. Download .
2. Download

```shell
git clone https://github.com/cryptape/appchain-truffle-box.git
Expand Down
4 changes: 4 additions & 0 deletions compiled/hellowroldCompiled.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 8 additions & 16 deletions docs/zh/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,16 @@ AppChain-Truffle-Box 是为了使开发者可以借助 Truffle 完成 Nervos App

必须先安装 Truffle 之后才能正确运行 AppChain-Truffle-Box.
```shell
npm install -g truffle
yarn global add truffle
```

2. 在空目录下下载 box
2. 下载项目

```shell
truffle unbox Cryptape/AppChain-Truffle-Box
```

3. Truffle 会自动安装依赖, 但如果安装失败你可以自己手动安装

```shell
npm install
git clone https://github.com/cryptape/appchain-truffle-box.git
cd appchain-truffle-box/
rm -rf .git
yarn install
```

## 设置
Expand Down Expand Up @@ -54,12 +51,7 @@ module.exports = {

### networks

> 可以配置多个 network.
可以通过以下指令来指定 network
```shell
truffle --network [network_name]
```
现在 networks 的属性名只支持 'development'

* `host`[required]
指定 ip 或域名. 不要带协议
Expand Down Expand Up @@ -107,5 +99,5 @@ truffle compile

输入下面的命令可以与 AppChain 交互 (注意这里 **不是** `truffle migrate` 命令)
```shell
npm run migrate
yarn migrate
```
16 changes: 14 additions & 2 deletions migrations/2_helloworld.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
var HelloWorld = artifacts.require('HelloWorld')
const fs = require('fs')
const path = require('path')
const HelloWorld = artifacts.require('HelloWorld')

module.exports = function(deployer) {
deployer.deploy(HelloWorld, '测试').then((res) => {
deployer.deploy(HelloWorld, '测试', { quota: 9999999 }).then((contract) => {
const dirpath = path.resolve(process.cwd(), './compiled')
const fpath = path.resolve(dirpath, 'hellowroldCompiled.js')
const f = fs.openSync(fpath, 'w+')

let data = ''
data += `const address = ${JSON.stringify(contract.address)}\n`
data += `const abi = ${JSON.stringify(contract.abi)}\n\n`
data += `export {address, abi}\n`

fs.writeFileSync(f, data)
})
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"migrate": "appchain-migrate migrate"
},
"devDependencies": {
"@nervos/appchain-truffle-migrate": "0.1.4"
"@nervos/appchain-truffle-migrate": "^0.1.5"
}
}
Loading

0 comments on commit 7634209

Please sign in to comment.