Skip to content

Commit

Permalink
Merge pull request #106 from cryptape/rc/v0.22.2
Browse files Browse the repository at this point in the history
Rc/v0.22.2
  • Loading branch information
duanyytop authored Apr 9, 2019
2 parents 34db086 + afd3668 commit d33ee6e
Show file tree
Hide file tree
Showing 15 changed files with 1,013 additions and 410 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
All notable changes to this project will be documented in this file.

# [v0.22.2](https://github.com/cryptape/cita-sdk-java/compare/v0.22.1...v0.22.2) (2019-04-09)

### Feature

* refactor http json response handle method

# [v0.22.1](https://github.com/cryptape/cita-sdk-java/compare/v0.22...v0.22.1) (2019-03-29)

### Feature
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

cita-sdk-java, originally adapted from Ethereum web3j, is a Java library for working with Smart Contract and integrating with clients on CITA.

For detailed documentation, see [documentation](docs/index.md).

## Features

- Complete implementation of CITA JSON-RPC API over HTTP.
Expand All @@ -27,12 +29,12 @@ maven
<dependency>
<groupId>com.cryptape.cita</groupId>
<artifactId>core</artifactId>
<version>0.22.1</version>
<version>0.22.2</version>
</dependency>
```
Gradle
```
compile 'com.cryptape.cita:core:0.22.1'
compile 'com.cryptape.cita:core:0.22.2'
```

Install manually
Expand Down Expand Up @@ -144,9 +146,12 @@ Please find complete code in [TokenAccountExample](https://github.com/cryptape/c

## 简介
cita-sdk-java 是对以太坊 Web3j 进行改写,适配 CITA 的一个 Java 开发包。cita-sdk-java 集成了与 CITA 客户端交互的功能,可以用来对 CITA 发送交易,系统配置,信息查询。

开发请参考[详细文档](docs/index.md)

## 特性
- 通过 HTTP 协议,实现了 CITA 所定义的所有 JSON-RPC 方法。
- 可以通过 Solidity 智能合约生成该合约的 Java 类。这个智能合约的 Java 类作为 java 对只能合约的包裹层,可以使开发和通过 java 方便地对智能合约进行部署和合约方法的调用(支持Solidity 和 Truffle 的格式)。
- 可以通过 Solidity 智能合约生成该合约的 Java 类。这个智能合约的 Java 类作为 java 对智能合约的包裹层,可以使开发和通过 java 方便地对智能合约进行部署和合约方法的调用(支持Solidity 和 Truffle 的格式)。
- 适配安卓

## 开始
Expand All @@ -161,12 +166,12 @@ Gradle 4.3
<dependency>
<groupId>com.cryptape.cita</groupId>
<artifactId>core</artifactId>
<version>0.22.1</version>
<version>0.22.2</version>
</dependency>
```
Gradle
```
compile 'com.cryptape.cita:core:0.22.1'
compile 'com.cryptape.cita:core:0.22.2'
```

手动安装
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public AppSendTransaction deploy(
version, chainId, value);
}

public Future<AppSendTransaction> deployAsync(
public Flowable<AppSendTransaction> deployAsync(
File contractFile, String nonce, long quota,
int version, BigInteger chainId, String value)
throws IOException, InterruptedException, CompiledContract.ContractCompileError {
Expand All @@ -70,7 +70,6 @@ public Future<AppSendTransaction> deployAsync(
version, chainId, value);
}

// eth_call: nonce and quota is null
// sendTransaction: nonce and quota is necessary
public Object callContract(
String contractAddress, String funcName,
Expand Down Expand Up @@ -101,7 +100,7 @@ public Object callContract(

Function func;
if (functionAbi.isConstant()) {
// eth_call
// call
List<TypedAbi.ArgRetType> retsType = new ArrayList<>();
List<TypeReference<?>> retsTypeRef = new ArrayList<>();
List<AbiDefinition.NamedType> outputs = functionAbi.getOutputs();
Expand All @@ -111,7 +110,7 @@ public Object callContract(
retsTypeRef.add(retType.getTypeReference());
}
func = new Function(functionAbi.getName(), params, retsTypeRef);
return ethCall(contractAddress, func, retsType);
return appCall(contractAddress, func, retsType);
} else {
// send_transaction
func = new Function(functionAbi.getName(), params, Collections.emptyList());
Expand All @@ -120,7 +119,7 @@ public Object callContract(
}
}

public Object ethCall(String contractAddress, Function func, List<TypedAbi.ArgRetType> retsType)
public Object appCall(String contractAddress, Function func, List<TypedAbi.ArgRetType> retsType)
throws IOException {
String data = FunctionEncoder.encode(func);
AppCall call = this.service.appCall(new Call(this.transactionManager.getFromAddress(),
Expand Down
Loading

0 comments on commit d33ee6e

Please sign in to comment.