diff --git a/.gitignore b/.gitignore index 51494ea33..cc788f2f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ .gradle/ .idea/ -build \ No newline at end of file +build + +## eclipse ## +.classpath +.project +.settings/ +bin/ diff --git a/src/main/java/org/fisco/bcos/sdk/model/SolidityConstructor.java b/src/main/java/org/fisco/bcos/sdk/model/SolidityConstructor.java new file mode 100644 index 000000000..66b31ab94 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/model/SolidityConstructor.java @@ -0,0 +1,98 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.model; + +import java.util.List; + +/** + * Constructor @Description: SolidityConstructor + * + * @author maojiayu + * @data Jul 17, 2020 2:36:50 PM + */ +public class SolidityConstructor { + + private String contractName; + private List params; + private String binary; + private String abi; + private String data; + + /** + * @param contractName + * @param params + * @param binary + * @param abi + * @param data + */ + public SolidityConstructor( + String contractName, List params, String binary, String abi, String data) { + this.contractName = contractName; + this.params = params; + this.binary = binary; + this.abi = abi; + this.data = data; + } + + /** @return the contractName */ + public String getContractName() { + return contractName; + } + + /** @param contractName the contractName to set */ + public void setContractName(String contractName) { + this.contractName = contractName; + } + + /** @return the params */ + public List getParams() { + return params; + } + + /** @param params the params to set */ + public void setParams(List params) { + this.params = params; + } + + /** @return the binary */ + public String getBinary() { + return binary; + } + + /** @param binary the binary to set */ + public void setBinary(String binary) { + this.binary = binary; + } + + /** @return the abi */ + public String getAbi() { + return abi; + } + + /** @param abi the abi to set */ + public void setAbi(String abi) { + this.abi = abi; + } + + /** @return the data */ + public String getData() { + return data; + } + + /** @param data the data to set */ + public void setData(String data) { + this.data = data; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/model/SolidityFunction.java b/src/main/java/org/fisco/bcos/sdk/model/SolidityFunction.java new file mode 100644 index 000000000..634e005df --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/model/SolidityFunction.java @@ -0,0 +1,23 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.model; + +/** + * Function @Description: SolidityFunction + * + * @author maojiayu + * @data Jul 17, 2020 2:36:36 PM + */ +public class SolidityFunction {} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/executor/TransactionBuilder.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/executor/TransactionBuilder.java new file mode 100644 index 000000000..cc8503920 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/executor/TransactionBuilder.java @@ -0,0 +1,42 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.impl.executor; + +import java.math.BigInteger; +import org.fisco.bcos.sdk.client.response.BcosTransaction; +import org.fisco.bcos.sdk.transaction.core.interf.executor.TransactionBuilderInterface; + +public class TransactionBuilder implements TransactionBuilderInterface { + + @Override + public BcosTransaction createTransaction( + BigInteger gasPrice, + BigInteger gasLimit, + String to, + String data, + BigInteger value, + BigInteger chainId, + BigInteger groupId, + String extraData) { + // TODO Auto-generated method stub + return null; + } + + @Override + public BcosTransaction createTransaction(String to, String data, BigInteger groupId) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/executor/TransactionDecoder.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/executor/TransactionDecoder.java new file mode 100644 index 000000000..7eda63563 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/executor/TransactionDecoder.java @@ -0,0 +1,107 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.impl.executor; + +import java.util.List; +import java.util.Map; +import org.fisco.bcos.sdk.client.response.BcosTransaction; +import org.fisco.bcos.sdk.client.response.BcosTransactionReceipt; +import org.fisco.bcos.sdk.transaction.core.interf.executor.TransactionDecoderInterface; +import org.fisco.bcos.sdk.transaction.domain.EventLog; +import org.fisco.bcos.sdk.transaction.domain.EventResultEntity; +import org.fisco.bcos.sdk.transaction.domain.InputAndOutputResult; +import org.fisco.bcos.sdk.transaction.domain.TransactionResponse; + +public class TransactionDecoder implements TransactionDecoderInterface { + + @Override + public BcosTransaction decodeRlp(String hex) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String decodeCall(String abi, String output) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String decodeOutputReturnJson(String contractName, String input, String output) { + // TODO Auto-generated method stub + return null; + } + + @Override + public InputAndOutputResult decodeOutputReturnObject( + String contractName, String input, String output) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String decodeEventReturnJson( + String contractName, BcosTransactionReceipt transactionReceipt) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map>> decodeEventReturnObject( + String contractName, BcosTransactionReceipt transactionReceipt) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String decodeEventReturnJson(String contractName, List logList) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map>> decodeEventReturnObject( + String contractName, List logList) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String decodeEventReturnJson( + String contractName, String eventName, List logList) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map>> decodeEventReturnObject( + String contractName, String eventName, List logList) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String decodeReceiptMessage(String input) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TransactionResponse decodeTransactionReceipt( + String contractName, BcosTransactionReceipt transactionReceipt) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/executor/TransactionEncoder.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/executor/TransactionEncoder.java new file mode 100644 index 000000000..2699a6fe3 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/executor/TransactionEncoder.java @@ -0,0 +1,28 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.impl.executor; + +import org.fisco.bcos.sdk.client.response.BcosTransaction; +import org.fisco.bcos.sdk.crypto.signature.SignatureResult; +import org.fisco.bcos.sdk.transaction.core.interf.executor.TransactionEncoderInterface; + +public class TransactionEncoder implements TransactionEncoderInterface { + + @Override + public byte[] encode(BcosTransaction transaction, SignatureResult signature) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/executor/TransactionPusher.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/executor/TransactionPusher.java new file mode 100644 index 000000000..ab25eafaa --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/executor/TransactionPusher.java @@ -0,0 +1,54 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.impl.executor; + +import java.util.concurrent.CompletableFuture; +import org.fisco.bcos.sdk.client.RespCallback; +import org.fisco.bcos.sdk.client.response.BcosTransactionReceipt; +import org.fisco.bcos.sdk.client.response.Call; +import org.fisco.bcos.sdk.transaction.core.interf.executor.TransactionPusherInterface; + +public class TransactionPusher implements TransactionPusherInterface { + + @Override + public void pushOnly(String signedTransaction) { + // TODO Auto-generated method stub + + } + + @Override + public BcosTransactionReceipt push(String signedTransaction) { + // TODO Auto-generated method stub + return null; + } + + @Override + public BcosTransactionReceipt push(String signedTransaction, RespCallback callback) { + // TODO Auto-generated method stub + return null; + } + + @Override + public CompletableFuture pushAsync(String signedTransaction) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Call push(String from, String to, String encodedFunction) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/executor/TransactionSigner.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/executor/TransactionSigner.java new file mode 100644 index 000000000..7732cb1d4 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/executor/TransactionSigner.java @@ -0,0 +1,61 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.impl.executor; + +import org.fisco.bcos.sdk.client.response.BcosTransaction; +import org.fisco.bcos.sdk.crypto.keypair.CryptoKeyPair; +import org.fisco.bcos.sdk.transaction.core.interf.executor.TransactionSignerInterface; + +public class TransactionSigner implements TransactionSignerInterface { + + private int encryptType; + private CryptoKeyPair cryptoKeyPair; + + /** + * @param encryptType + * @param cryptoKeyPair + */ + public TransactionSigner(int encryptType, CryptoKeyPair cryptoKeyPair) { + super(); + this.encryptType = encryptType; + this.cryptoKeyPair = cryptoKeyPair; + } + + @Override + public byte[] sign(BcosTransaction bcosTransaction) { + // TODO Auto-generated method stub + return null; + } + + /** @return the encryptType */ + public int getEncryptType() { + return encryptType; + } + + /** @param encryptType the encryptType to set */ + public void setEncryptType(int encryptType) { + this.encryptType = encryptType; + } + + /** @return the cryptoKeyPair */ + public CryptoKeyPair getCryptoKeyPair() { + return cryptoKeyPair; + } + + /** @param cryptoKeyPair the cryptoKeyPair to set */ + public void setCryptoKeyPair(CryptoKeyPair cryptoKeyPair) { + this.cryptoKeyPair = cryptoKeyPair; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/function/FunctionBuilder.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/function/FunctionBuilder.java new file mode 100644 index 000000000..977c79a7d --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/function/FunctionBuilder.java @@ -0,0 +1,36 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.impl.function; + +import java.util.List; +import org.fisco.bcos.sdk.model.SolidityConstructor; +import org.fisco.bcos.sdk.model.SolidityFunction; +import org.fisco.bcos.sdk.transaction.core.interf.function.FunctionBuilderInterface; + +public class FunctionBuilder implements FunctionBuilderInterface { + + @Override + public SolidityFunction buildFunction( + String contractName, String contractAddress, String functionName, List args) { + // TODO Auto-generated method stub + return null; + } + + @Override + public SolidityConstructor buildConstructor(String contractName, List args) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/function/FunctionEncoder.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/function/FunctionEncoder.java new file mode 100644 index 000000000..aafc95755 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/function/FunctionEncoder.java @@ -0,0 +1,40 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.impl.function; + +import org.fisco.bcos.sdk.model.SolidityConstructor; +import org.fisco.bcos.sdk.model.SolidityFunction; +import org.fisco.bcos.sdk.transaction.core.interf.function.FunctionEncoderInterface; + +/** + * FunctionEncoder @Description: FunctionEncoder + * + * @author maojiayu + * @data Jul 17, 2020 2:47:58 PM + */ +public class FunctionEncoder implements FunctionEncoderInterface { + + @Override + public String encodeFunction(SolidityFunction solidityFunction) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String encodeConstructor(SolidityConstructor constuctor) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/function/FunctionReturnDecoder.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/function/FunctionReturnDecoder.java new file mode 100644 index 000000000..7b80ef3f1 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/impl/function/FunctionReturnDecoder.java @@ -0,0 +1,26 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.impl.function; + +import org.fisco.bcos.sdk.transaction.core.interf.function.FunctionReturnDecoderInterface; + +public class FunctionReturnDecoder implements FunctionReturnDecoderInterface { + + @Override + public String decodeCall(String rawInput, String abi) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/executor/TransactionBuilderInterface.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/executor/TransactionBuilderInterface.java new file mode 100644 index 000000000..bcac88d7f --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/executor/TransactionBuilderInterface.java @@ -0,0 +1,47 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.interf.executor; + +import java.math.BigInteger; +import org.fisco.bcos.sdk.client.response.BcosTransaction; + +/** + * TransactionBuilderInterface @Description: TransactionBuilderInterface + * + * @author maojiayu + * @data Jul 17, 2020 11:02:36 AM + */ +public interface TransactionBuilderInterface { + + public BcosTransaction createTransaction( + BigInteger gasPrice, + BigInteger gasLimit, + String to, + String data, + BigInteger value, + BigInteger chainId, + BigInteger groupId, + String extraData); + + /** + * Create fisco bcos transaction for short + * + * @param to, target address + * @param data, encoded data + * @param groupId + * @return BcosTransaction + */ + public BcosTransaction createTransaction(String to, String data, BigInteger groupId); +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/executor/TransactionDecoderInterface.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/executor/TransactionDecoderInterface.java new file mode 100644 index 000000000..3395f95cb --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/executor/TransactionDecoderInterface.java @@ -0,0 +1,64 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.interf.executor; + +import java.util.List; +import java.util.Map; +import org.fisco.bcos.sdk.client.response.BcosTransaction; +import org.fisco.bcos.sdk.client.response.BcosTransactionReceipt; +import org.fisco.bcos.sdk.transaction.domain.EventLog; +import org.fisco.bcos.sdk.transaction.domain.EventResultEntity; +import org.fisco.bcos.sdk.transaction.domain.InputAndOutputResult; +import org.fisco.bcos.sdk.transaction.domain.TransactionResponse; + +/** + * TransactionDecoderInterface @Description: TransactionDecoderInterface + * + * @author maojiayu + * @data Jul 17, 2020 11:38:41 AM + */ +public interface TransactionDecoderInterface { + + public BcosTransaction decodeRlp(String hex); + + public String decodeCall(String abi, String output); + + public String decodeOutputReturnJson(String contractName, String input, String output); + + public InputAndOutputResult decodeOutputReturnObject( + String contractName, String input, String output); + + public String decodeEventReturnJson( + String contractName, BcosTransactionReceipt transactionReceipt); + + public Map>> decodeEventReturnObject( + String contractName, BcosTransactionReceipt transactionReceipt); + + public String decodeEventReturnJson(String contractName, List logList); + + public Map>> decodeEventReturnObject( + String contractName, List logList); + + public String decodeEventReturnJson( + String contractName, String eventName, List logList); + + public Map>> decodeEventReturnObject( + String contractName, String eventName, List logList); + + public String decodeReceiptMessage(String input); + + public TransactionResponse decodeTransactionReceipt( + String contractName, BcosTransactionReceipt transactionReceipt); +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/executor/TransactionEncoderInterface.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/executor/TransactionEncoderInterface.java new file mode 100644 index 000000000..2f02d46cd --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/executor/TransactionEncoderInterface.java @@ -0,0 +1,29 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.interf.executor; + +import org.fisco.bcos.sdk.client.response.BcosTransaction; +import org.fisco.bcos.sdk.crypto.signature.SignatureResult; + +/** + * TransactionEncoderInterface @Description: TransactionEncoderInterface + * + * @author maojiayu + * @data Jul 17, 2020 11:59:49 AM + */ +public interface TransactionEncoderInterface { + + byte[] encode(BcosTransaction transaction, SignatureResult signature); +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/executor/TransactionPusherInterface.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/executor/TransactionPusherInterface.java new file mode 100644 index 000000000..acc970520 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/executor/TransactionPusherInterface.java @@ -0,0 +1,39 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.interf.executor; + +import java.util.concurrent.CompletableFuture; +import org.fisco.bcos.sdk.client.RespCallback; +import org.fisco.bcos.sdk.client.response.BcosTransactionReceipt; +import org.fisco.bcos.sdk.client.response.Call; + +/** + * TransactionPusher @Description: TransactionPusherInterface + * + * @author maojiayu + * @data Jul 17, 2020 2:13:39 PM + */ +public interface TransactionPusherInterface { + + public void pushOnly(String signedTransaction); + + public BcosTransactionReceipt push(String signedTransaction); + + public BcosTransactionReceipt push(String signedTransaction, RespCallback callback); + + public CompletableFuture pushAsync(String signedTransaction); + + public Call push(String from, String to, String encodedFunction); +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/executor/TransactionSignerInterface.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/executor/TransactionSignerInterface.java new file mode 100644 index 000000000..f162087c3 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/executor/TransactionSignerInterface.java @@ -0,0 +1,28 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.interf.executor; + +import org.fisco.bcos.sdk.client.response.BcosTransaction; + +/** + * TransactionSignerInterface @Description: TransactionSignerInterface + * + * @author maojiayu + * @data Jul 17, 2020 11:11:24 AM + */ +public interface TransactionSignerInterface { + + byte[] sign(BcosTransaction bcosTransaction); +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/function/FunctionBuilderInterface.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/function/FunctionBuilderInterface.java new file mode 100644 index 000000000..5fdfd6dfc --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/function/FunctionBuilderInterface.java @@ -0,0 +1,33 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.interf.function; + +import java.util.List; +import org.fisco.bcos.sdk.model.SolidityConstructor; +import org.fisco.bcos.sdk.model.SolidityFunction; + +/** + * FunctionBuilderInterface @Description: FunctionBuilderInterface + * + * @author maojiayu + * @data Jul 17, 2020 2:34:36 PM + */ +public interface FunctionBuilderInterface { + + public SolidityFunction buildFunction( + String contractName, String contractAddress, String functionName, List args); + + public SolidityConstructor buildConstructor(String contractName, List args); +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/function/FunctionEncoderInterface.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/function/FunctionEncoderInterface.java new file mode 100644 index 000000000..4797ffced --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/function/FunctionEncoderInterface.java @@ -0,0 +1,31 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.interf.function; + +import org.fisco.bcos.sdk.model.SolidityConstructor; +import org.fisco.bcos.sdk.model.SolidityFunction; + +/** + * FunctionEncoderInterface @Description: FunctionEncoderInterface + * + * @author maojiayu + * @data Jul 17, 2020 2:46:31 PM + */ +public interface FunctionEncoderInterface { + + public String encodeFunction(SolidityFunction solidityFunction); + + public String encodeConstructor(SolidityConstructor constuctor); +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/function/FunctionReturnDecoderInterface.java b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/function/FunctionReturnDecoderInterface.java new file mode 100644 index 000000000..25a75062e --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/core/interf/function/FunctionReturnDecoderInterface.java @@ -0,0 +1,26 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.core.interf.function; + +/** + * FunctionReturnDecoder @Description: FunctionReturnDecoderInterface + * + * @author maojiayu + * @data Jul 17, 2020 2:48:54 PM + */ +public interface FunctionReturnDecoderInterface { + + public String decodeCall(String rawInput, String abi); +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/domain/EventLog.java b/src/main/java/org/fisco/bcos/sdk/transaction/domain/EventLog.java new file mode 100644 index 000000000..59b5b81ae --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/domain/EventLog.java @@ -0,0 +1,17 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.domain; + +public class EventLog {} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/domain/EventResultEntity.java b/src/main/java/org/fisco/bcos/sdk/transaction/domain/EventResultEntity.java new file mode 100644 index 000000000..597fb3de6 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/domain/EventResultEntity.java @@ -0,0 +1,17 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.domain; + +public class EventResultEntity {} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/domain/InputAndOutputResult.java b/src/main/java/org/fisco/bcos/sdk/transaction/domain/InputAndOutputResult.java new file mode 100644 index 000000000..a469936a7 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/domain/InputAndOutputResult.java @@ -0,0 +1,17 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.domain; + +public class InputAndOutputResult {} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/domain/TransactionResponse.java b/src/main/java/org/fisco/bcos/sdk/transaction/domain/TransactionResponse.java new file mode 100644 index 000000000..1a00e5c35 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/domain/TransactionResponse.java @@ -0,0 +1,17 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.domain; + +public class TransactionResponse {} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/CallRequest.java b/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/CallRequest.java new file mode 100644 index 000000000..c4d725ef7 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/CallRequest.java @@ -0,0 +1,61 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.domain.dto; + +/** + * CallRequest @Description: CallRequest + * + * @author maojiayu + * @data Jul 17, 2020 3:09:48 PM + */ +public class CallRequest extends CommonRequest { + private String from; + private String to; + private String encodedFunction; + private String abi; + + /** @return the from */ + public String getFrom() { + return from; + } + /** @param from the from to set */ + public void setFrom(String from) { + this.from = from; + } + /** @return the to */ + public String getTo() { + return to; + } + /** @param to the to to set */ + public void setTo(String to) { + this.to = to; + } + /** @return the encodedFunction */ + public String getEncodedFunction() { + return encodedFunction; + } + /** @param encodedFunction the encodedFunction to set */ + public void setEncodedFunction(String encodedFunction) { + this.encodedFunction = encodedFunction; + } + /** @return the abi */ + public String getAbi() { + return abi; + } + /** @param abi the abi to set */ + public void setAbi(String abi) { + this.abi = abi; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/CallResponse.java b/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/CallResponse.java new file mode 100644 index 000000000..441e95312 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/CallResponse.java @@ -0,0 +1,35 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.domain.dto; + +/** + * CallResponse @Description: CallResponse + * + * @author maojiayu + * @data Jul 17, 2020 3:20:06 PM + */ +public class CallResponse extends CommonResponse { + private String values; + + /** @return the values */ + public String getValues() { + return values; + } + + /** @param values the values to set */ + public void setValues(String values) { + this.values = values; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/CommonRequest.java b/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/CommonRequest.java new file mode 100644 index 000000000..54cc8c99f --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/CommonRequest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.domain.dto; + +/** + * CommonTransactionRequest @Description: CommonRequest + * + * @author maojiayu + * @data Jul 17, 2020 3:07:28 PM + */ +public class CommonRequest { + + private int groupId; + + /** @return the groupId */ + public int getGroupId() { + return groupId; + } + + /** @param groupId the groupId to set */ + public void setGroupId(int groupId) { + this.groupId = groupId; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/CommonResponse.java b/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/CommonResponse.java new file mode 100644 index 000000000..08dc412c0 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/CommonResponse.java @@ -0,0 +1,46 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.domain.dto; + +/** + * CommonResponse @Description: CommonResponse + * + * @author maojiayu + * @data Jul 17, 2020 3:15:35 PM + */ +public class CommonResponse { + private int returnCode; + private String returnMessage; + + /** @return the returnCode */ + public int getReturnCode() { + return returnCode; + } + + /** @param returnCode the returnCode to set */ + public void setReturnCode(int returnCode) { + this.returnCode = returnCode; + } + + /** @return the returnMessage */ + public String getReturnMessage() { + return returnMessage; + } + + /** @param returnMessage the returnMessage to set */ + public void setReturnMessage(String returnMessage) { + this.returnMessage = returnMessage; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/TransactionRequest.java b/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/TransactionRequest.java new file mode 100644 index 000000000..17893e224 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/TransactionRequest.java @@ -0,0 +1,46 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.domain.dto; + +/** + * TransactionRequest @Description: TransactionRequest + * + * @author maojiayu + * @data Jul 17, 2020 3:08:41 PM + */ +public class TransactionRequest extends CommonRequest { + private String contractName; + private String signedData; + + /** @return the contractName */ + public String getContractName() { + return contractName; + } + + /** @param contractName the contractName to set */ + public void setContractName(String contractName) { + this.contractName = contractName; + } + + /** @return the signedData */ + public String getSignedData() { + return signedData; + } + + /** @param signedData the signedData to set */ + public void setSignedData(String signedData) { + this.signedData = signedData; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/TransactionResponse.java b/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/TransactionResponse.java new file mode 100644 index 000000000..2110e59ca --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/domain/dto/TransactionResponse.java @@ -0,0 +1,71 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.domain.dto; + +import org.fisco.bcos.sdk.client.response.BcosTransactionReceipt; + +/** + * TransactionResponse @Description: TransactionResponse + * + * @author maojiayu + * @data Jul 17, 2020 3:16:51 PM + */ +public class TransactionResponse extends CommonResponse { + private BcosTransactionReceipt bcosTransactionReceipt; + private String contractAddress; + private String values; + private String events; + private String receiptMessages; + /** @return the bcosTransactionReceipt */ + public BcosTransactionReceipt getBcosTransactionReceipt() { + return bcosTransactionReceipt; + } + /** @param bcosTransactionReceipt the bcosTransactionReceipt to set */ + public void setBcosTransactionReceipt(BcosTransactionReceipt bcosTransactionReceipt) { + this.bcosTransactionReceipt = bcosTransactionReceipt; + } + /** @return the contractAddress */ + public String getContractAddress() { + return contractAddress; + } + /** @param contractAddress the contractAddress to set */ + public void setContractAddress(String contractAddress) { + this.contractAddress = contractAddress; + } + /** @return the values */ + public String getValues() { + return values; + } + /** @param values the values to set */ + public void setValues(String values) { + this.values = values; + } + /** @return the events */ + public String getEvents() { + return events; + } + /** @param events the events to set */ + public void setEvents(String events) { + this.events = events; + } + /** @return the receiptMessages */ + public String getReceiptMessages() { + return receiptMessages; + } + /** @param receiptMessages the receiptMessages to set */ + public void setReceiptMessages(String receiptMessages) { + this.receiptMessages = receiptMessages; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/manager/TransactionManager.java b/src/main/java/org/fisco/bcos/sdk/transaction/manager/TransactionManager.java new file mode 100644 index 000000000..d8ae581ef --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/manager/TransactionManager.java @@ -0,0 +1,76 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.manager; + +import java.util.concurrent.CompletableFuture; +import org.fisco.bcos.sdk.client.RespCallback; +import org.fisco.bcos.sdk.client.response.BcosTransactionReceipt; +import org.fisco.bcos.sdk.transaction.domain.dto.CallRequest; +import org.fisco.bcos.sdk.transaction.domain.dto.CallResponse; +import org.fisco.bcos.sdk.transaction.domain.dto.TransactionRequest; +import org.fisco.bcos.sdk.transaction.domain.dto.TransactionResponse; + +/** + * TransactionManager @Description: TransactionManager + * + * @author maojiayu + * @data Jul 17, 2020 3:23:19 PM + */ +public class TransactionManager implements TransactionManagerInterface { + + @Override + public TransactionResponse deploy(TransactionRequest transactionRequest) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void sendTransactionOnly(TransactionRequest transactionRequest) { + // TODO Auto-generated method stub + + } + + @Override + public TransactionResponse sendTransaction(TransactionRequest transactionRequest) { + // TODO Auto-generated method stub + return null; + } + + @Override + public BcosTransactionReceipt sendTransaction( + int groupId, String signedTransaction, RespCallback callback) { + // TODO Auto-generated method stub + return null; + } + + @Override + public CompletableFuture sendTransactionAsync( + TransactionRequest transactionRequest) { + // TODO Auto-generated method stub + return null; + } + + @Override + public CallResponse sendCall(CallRequest callRequest) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getCurrentExternalAccountAddress() { + // TODO Auto-generated method stub + return null; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/manager/TransactionManagerInterface.java b/src/main/java/org/fisco/bcos/sdk/transaction/manager/TransactionManagerInterface.java new file mode 100644 index 000000000..59a19e283 --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/manager/TransactionManagerInterface.java @@ -0,0 +1,48 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.manager; + +import java.util.concurrent.CompletableFuture; +import org.fisco.bcos.sdk.client.RespCallback; +import org.fisco.bcos.sdk.client.response.BcosTransactionReceipt; +import org.fisco.bcos.sdk.transaction.domain.dto.CallRequest; +import org.fisco.bcos.sdk.transaction.domain.dto.CallResponse; +import org.fisco.bcos.sdk.transaction.domain.dto.TransactionRequest; +import org.fisco.bcos.sdk.transaction.domain.dto.TransactionResponse; + +/** + * TransactionManagerInterface @Description: TransactionManagerInterface + * + * @author maojiayu + * @data Jul 17, 2020 2:59:21 PM + */ +public interface TransactionManagerInterface { + + public TransactionResponse deploy(TransactionRequest transactionRequest); + + public void sendTransactionOnly(TransactionRequest transactionRequest); + + public TransactionResponse sendTransaction(TransactionRequest transactionRequest); + + public BcosTransactionReceipt sendTransaction( + int groupId, String signedTransaction, RespCallback callback); + + public CompletableFuture sendTransactionAsync( + TransactionRequest transactionRequest); + + public CallResponse sendCall(CallRequest callRequest); + + public String getCurrentExternalAccountAddress(); +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/tools/ContractLoader.java b/src/main/java/org/fisco/bcos/sdk/transaction/tools/ContractLoader.java new file mode 100644 index 000000000..55a75dc5a --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/tools/ContractLoader.java @@ -0,0 +1,84 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.tools; + +import org.apache.commons.lang3.tuple.Pair; + +/** + * ContractLoader @Description: ContractLoader + * + * @author maojiayu + * @data Jul 17, 2020 3:24:40 PM + */ +public class ContractLoader { + private int readType; + private String path; + + /** + * @param readType + * @param path + */ + public ContractLoader(int readType, String path) { + super(); + this.readType = readType; + this.path = path; + } + + public String getABIByContractName(String contractName) { + // TODO + return null; + } + + public String getBinaryByContractName(String contractName) { + // TODO + return null; + } + + public Pair getABIAndBinaryByContractName(String contractName) { + // TODO + return null; + } + + // TODO + /* + * public AbiDefinition getConstructorABIByContractName(String contractName) { + * + * } + * + * public List getFunctionABIListByContractName(String contractName) { + * + * } + */ + + /** @return the readType */ + public int getReadType() { + return readType; + } + + /** @param readType the readType to set */ + public void setReadType(int readType) { + this.readType = readType; + } + + /** @return the path */ + public String getPath() { + return path; + } + + /** @param path the path to set */ + public void setPath(String path) { + this.path = path; + } +} diff --git a/src/main/java/org/fisco/bcos/sdk/transaction/tools/SolTypeConverter.java b/src/main/java/org/fisco/bcos/sdk/transaction/tools/SolTypeConverter.java new file mode 100644 index 000000000..5eef7c5eb --- /dev/null +++ b/src/main/java/org/fisco/bcos/sdk/transaction/tools/SolTypeConverter.java @@ -0,0 +1,30 @@ +/* + * Copyright 2014-2020 [fisco-dev] + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.fisco.bcos.sdk.transaction.tools; + +/** + * SolTypeConverter @Description: SolTypeConverter + * + * @author maojiayu + * @data Jul 17, 2020 3:35:09 PM + */ +public class SolTypeConverter { + + // TODO + /* + * public static List convertToSolType(AbiDefinition abiDefinition, List javaArgs) {} + */ + +}