Skip to content

Commit

Permalink
<feat>(console): add v2 extension usage. (#835)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyonRay authored Mar 11, 2024
1 parent 3c7f8e2 commit 4ef8243
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies {
//implementation 'org.fisco-bcos:solcJ:0.5.2.1'
implementation 'org.fisco-bcos:solcJ:0.8.11.1'

implementation ('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:3.6.0') {
implementation ('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:3.7.0-SNAPSHOT') {
exclude group: "org.slf4j"
}

Expand All @@ -53,7 +53,7 @@ dependencies {
implementation('org.jline:jline:3.21.0')
implementation('io.bretty:console-table-builder:1.2')
implementation('com.github.jsqlparser:jsqlparser:2.0')
implementation('org.fisco-bcos.code-generator:bcos-code-generator:1.3.0') {
implementation('org.fisco-bcos.code-generator:bcos-code-generator:1.5.0-SNAPSHOT') {
exclude group: "org.fisco-bcos.java-sdk"
exclude group: "org.slf4j"
}
Expand Down
2 changes: 1 addition & 1 deletion release_note.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.6.0
v3.7.0
10 changes: 10 additions & 0 deletions src/main/java/console/ConsoleInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,21 @@ public void init(String[] args) throws ConfigException {

if (args.length > 3 && "-v1".equals(args[3])) {
// use v1 transaction service
logger.info("use v1 transaction service");
useV1TxService = true;
}
byte[] extension = null;
if (args.length > 3 && "-v2".equals(args[3])) {
logger.info("use v2 transaction service");
useV1TxService = true;
extension = args.length > 4 ? args[4].getBytes() : null;
}
this.consoleClientFace = new ConsoleClientImpl(client);
this.precompiledFace = new PrecompiledImpl(client);
this.consoleContractFace = new ConsoleContractImpl(client, useV1TxService);
if (extension != null) {
((ConsoleContractImpl) this.consoleContractFace).setExtension(extension);
}
this.collaborationFace = new CollaborationImpl(client);
this.authFace = new AuthImpl(client);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/console/common/ConsoleVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class ConsoleVersion {

public static final String Version = "3.6.0";
public static final String Version = "3.7.0";

public static void main(String[] args) {
System.out.println("console version: " + Version);
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/console/contract/ConsoleContractImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class ConsoleContractImpl implements ConsoleContractFace {
private AssembleTransactionService assembleTransactionService = null;
private final TransferTransactionService transferTransactionService;
private final BFSService bfsService;

private byte[] extension = null;
private boolean useTransactionV1 = false;

public ConsoleContractImpl(Client client) {
Expand Down Expand Up @@ -117,6 +117,10 @@ public ConsoleContractImpl(Client client, boolean useTransactionV1) {
}
}

public void setExtension(byte[] extension) {
this.extension = extension;
}

@Override
public void deploy(String[] params, String pwd) throws Exception {
List<String> paramsList = new ArrayList<>(Arrays.asList(params));
Expand Down Expand Up @@ -268,6 +272,7 @@ public TransactionResponse deploySolidity(
if (useTransactionV1) {
DeployTransactionRequestWithStringParams request =
new TransactionRequestBuilder(abiAndBin.getAbi(), bin)
.setExtension(extension)
.buildDeployStringParamsRequest(tempInputParams);
response = assembleTransactionService.deployContract(request);
} else {
Expand Down Expand Up @@ -333,6 +338,7 @@ public TransactionResponse deployWasm(
DeployTransactionRequestWithStringParams request =
new TransactionRequestBuilder(abi, binStr)
.setTo(path)
.setExtension(extension)
.buildDeployStringParamsRequest(inputParams);
response = assembleTransactionService.deployContract(request);
} else {
Expand Down Expand Up @@ -768,6 +774,7 @@ private void sendTransaction(
if (useTransactionV1) {
TransactionRequestWithStringParams request =
new TransactionRequestBuilder(abiAndBin.getAbi(), functionName, contractAddress)
.setExtension(extension)
.buildStringParamsRequest(callParams);
response = assembleTransactionService.sendTransaction(request);
} else {
Expand Down
2 changes: 1 addition & 1 deletion tools/download_console.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package_name="console.tar.gz"
solcj_name=""
solcj_default_version="solcJ-0.8.11.1.jar"
only_solc_flag=""
default_version="3.6.0"
default_version="3.7.0"
download_version="${default_version}"
solc_download_version="3.0.0"
specify_console=0
Expand Down

0 comments on commit 4ef8243

Please sign in to comment.