Skip to content

Commit

Permalink
doc: update method parameters description
Browse files Browse the repository at this point in the history
  • Loading branch information
duanyytop committed Apr 4, 2019
1 parent 4bf5000 commit e6f4bf8
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 19 deletions.
20 changes: 16 additions & 4 deletions docs/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,22 @@ Account 使用了 CompiledContract 类,可以直接读取 Solidity 合约文
### New account

**方法名**

`Account(String privateKey, CITAj service)`

实例化Account对象。

**参数**

* privateKey - 发送交易地址的私钥
* service - CITAj 实例

**返回值**

Account

**示例**

```
String privateKey = "{private key}";
CITAj service = CITAj.build(new HttpService("http://127.0.0.1"));
Expand All @@ -32,9 +37,11 @@ Account account = new Account(privateKey, service);
**方法名**

`AppSendTransaction deploy(File contractFile, BigInteger nonce, long quota, int version, int chainId, String value)`

部署合约。

**参数**

* contractFile - solidity智能合约文件
* nonce - 随机数用于防止重放攻击
* quota - 用户支付矿工的费用
Expand All @@ -43,6 +50,7 @@ Account account = new Account(privateKey, service);
* value - 交易中原生token的数量

**返回值**

AppSendTransaction

**示例**
Expand All @@ -58,22 +66,26 @@ AppSendTransaction appSendTransaction = account.deploy(new File(path), randomNon
**方法名**

`Object callContract(String contractAddress, String funcName, BigInteger nonce, long quota, int version, int chainId, String value, Object... args)`

调用合约方法,根据Abi中对方法的定义判断使用sendRawTransaction还是app_call。

**参数**
* to - 交易将要的发送地址
* data - 编码后交易数据(abi)
* quota - 用户支付矿工的费用

* contractAddress - 合约地址
* funcName - 合约方法名称
* nonce - 随机数用于防止重放攻击
* valid_until_block - 超时机制,超过设定块高取消交易
* quota - 用户支付矿工的费用
* version - 链的版本信息
* chainId - 链Id
* value - 交易中原生token的数量
* args - 合约方法参数

**返回值**

Object

**示例**

```
String privateKey = "{private key}";
CITAj service = CITAj.build(new HttpService("http://127.0.0.1"));
Expand Down
Loading

0 comments on commit e6f4bf8

Please sign in to comment.