├── install.sh ├── Archi.png ├── .gitignore ├── src ├── main │ └── java │ │ └── multichain │ │ ├── object │ │ ├── MultichainStreamItemJsonValueObject.java │ │ ├── MultichainStreamItemTextValueObject.java │ │ ├── queryobjects │ │ │ ├── DataParam.java │ │ │ ├── TxIdVout.java │ │ │ ├── StreamData.java │ │ │ ├── DataParamHex.java │ │ │ ├── ParamIssue.java │ │ │ ├── ParamIssueMore.java │ │ │ ├── CustomParamString.java │ │ │ ├── AssetQuantity.java │ │ │ ├── AssetParams.java │ │ │ ├── StreamDataText.java │ │ │ ├── StreamDataCache.java │ │ │ ├── StreamDataJson.java │ │ │ ├── RawStreamParam.java │ │ │ ├── DataParamIssueMore.java │ │ │ ├── DataParamStreamItem.java │ │ │ ├── DataParamCreate.java │ │ │ ├── RawParam.java │ │ │ └── DataParamIssue.java │ │ ├── Create.java │ │ ├── AssetInfo.java │ │ ├── ScriptSig.java │ │ ├── MemPoolInfo.java │ │ ├── TxIdVout.java │ │ ├── formatters │ │ │ ├── HexFormatter.java │ │ │ ├── GsonFormatters.java │ │ │ └── GenericOutputFormatter.java │ │ ├── AddedNodeInfoAddress.java │ │ ├── ChunkqueueInfo.java │ │ ├── ChunkqueueTotal.java │ │ ├── MultisigAddress.java │ │ ├── BalanceWalletTransaction.java │ │ ├── SinceBlock.java │ │ ├── SignedTransactionRAW.java │ │ ├── NetworkInfoLocalAddress.java │ │ ├── TransactionWalletVout.java │ │ ├── ChunkqueueInfoElt.java │ │ ├── MultiChainRPCAnswer.java │ │ ├── TransactionWalletVin.java │ │ ├── NetTotals.java │ │ ├── BalanceAssetGeneral.java │ │ ├── AddedNodeInfo.java │ │ ├── KeyPairs.java │ │ ├── Transaction.java │ │ ├── TransactionListElement.java │ │ ├── ChainTip.java │ │ ├── MultiChainInfo.java │ │ ├── Permission.java │ │ ├── LastBlockInfo.java │ │ ├── Publisher.java │ │ ├── AssetIssues.java │ │ ├── BalanceAssetWalletTransaction.java │ │ ├── ScriptPubKey.java │ │ ├── TransactionRAWVin.java │ │ ├── NetworkInfoNetwork.java │ │ ├── AddressReceived.java │ │ ├── TransactionDetail.java │ │ ├── Script.java │ │ ├── BlockTemplateTransation.java │ │ ├── TransactionGeneral.java │ │ ├── AssetWalletTransaction.java │ │ ├── StreamKey.java │ │ ├── Unspent.java │ │ ├── RawMemPoolTransaction.java │ │ ├── ChunkqueueTotalElt.java │ │ ├── TxOutInfo.java │ │ ├── WalletInfo.java │ │ ├── MultiBalance.java │ │ ├── TransactionRAWVout.java │ │ ├── TxOut.java │ │ ├── AssetTransaction.java │ │ ├── TransactionRAW.java │ │ ├── TransactionWalletVInfo.java │ │ ├── Item.java │ │ ├── NetworkInfo.java │ │ ├── TransactionBase.java │ │ ├── BlockchainInfo.java │ │ ├── PermissionDetailed.java │ │ ├── MiningInfo.java │ │ ├── StreamKeyInfo.java │ │ ├── Stream.java │ │ ├── TransactionCurrency.java │ │ ├── BlockTemplate.java │ │ ├── Block.java │ │ └── BalanceAsset.java │ │ └── command │ │ ├── RuntimeParameters.java │ │ ├── GrantElt.java │ │ ├── MultichainException.java │ │ ├── CommandManager.java │ │ └── QueryBuilderCommon.java └── test │ └── java │ └── multichain │ └── command │ └── TestConst.java └── pom.xml /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mvn clean install 3 | -------------------------------------------------------------------------------- /Archi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubert-marteau/MultiChainJavaAPI/HEAD/Archi.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | /bin 14 | /.classpath 15 | /.project 16 | /.gitignore 17 | /target 18 | /.settings 19 | *.iml 20 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/MultichainStreamItemJsonValueObject.java: -------------------------------------------------------------------------------- 1 | package multichain.object; 2 | 3 | /** 4 | * @author mengl 5 | */ 6 | public class MultichainStreamItemJsonValueObject { 7 | @SuppressWarnings("unused") 8 | private Object json; 9 | 10 | public MultichainStreamItemJsonValueObject(Object json) { 11 | this.json = json; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/MultichainStreamItemTextValueObject.java: -------------------------------------------------------------------------------- 1 | package multichain.object; 2 | 3 | /** 4 | * @author mengl 5 | */ 6 | public class MultichainStreamItemTextValueObject { 7 | @SuppressWarnings("unused") 8 | private String text; 9 | 10 | public MultichainStreamItemTextValueObject(String text) { 11 | this.text = text; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/java/multichain/command/TestConst.java: -------------------------------------------------------------------------------- 1 | package multichain.command; 2 | 3 | public class TestConst { 4 | // Blockchain called ABC001 5 | public static String MULTICHAIN_SERVER_IP = "localhost"; 6 | public static String MULTICHAIN_SERVER_PORT = "4336"; 7 | public static String MULTICHAIN_SERVER_LOGIN = "multichainrpc"; 8 | public static String MULTICHAIN_SERVER_PWD = "BkrV57WKJGW9nTsp596zfL4juGL59FawcyTWmCLMVm9p"; 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/DataParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public interface DataParam { 15 | Object getFormatedvalue(); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/Create.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class Create extends Stream { 15 | String type = null; 16 | 17 | /** 18 | * @return the type 19 | */ 20 | public String getType() { 21 | return type; 22 | } 23 | 24 | /** 25 | * @param type the type to set 26 | */ 27 | public void setType(String type) { 28 | this.type = type; 29 | } 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/AssetInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public class AssetInfo extends BalanceAsset { 17 | List issues = null; 18 | 19 | /** 20 | * @return the issues 21 | */ 22 | public List getIssues() { 23 | return issues; 24 | } 25 | 26 | /** 27 | * @param issues the issues to set 28 | */ 29 | public void setIssues(List issues) { 30 | this.issues = issues; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/ScriptSig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class ScriptSig { 15 | String asm = null; 16 | String hex = null; 17 | 18 | /** 19 | * @return the asm 20 | */ 21 | public String getAsm() { 22 | return asm; 23 | } 24 | 25 | /** 26 | * @param asm the asm to set 27 | */ 28 | public void setAsm(String asm) { 29 | this.asm = asm; 30 | } 31 | 32 | /** 33 | * @return the hex 34 | */ 35 | public String getHex() { 36 | return hex; 37 | } 38 | 39 | /** 40 | * @param hex the hex to set 41 | */ 42 | public void setHex(String hex) { 43 | this.hex = hex; 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/TxIdVout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class TxIdVout { 15 | String txid; 16 | int vout; 17 | 18 | /** 19 | * @return the txId 20 | */ 21 | public String getTxId() { 22 | return txid; 23 | } 24 | 25 | /** 26 | * @param txId the txId to set 27 | */ 28 | public void setTxId(String txId) { 29 | this.txid = txId; 30 | } 31 | 32 | /** 33 | * @return the vOut 34 | */ 35 | public int getvOut() { 36 | return vout; 37 | } 38 | 39 | /** 40 | * @param vOut the vOut to set 41 | */ 42 | public void setvOut(int vOut) { 43 | this.vout = vOut; 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/MemPoolInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class MemPoolInfo { 15 | Long size = null; 16 | Long bytes = null; 17 | 18 | /** 19 | * @return the size 20 | */ 21 | public Long getSize() { 22 | return size; 23 | } 24 | 25 | /** 26 | * @param size the size to set 27 | */ 28 | public void setSize(Long size) { 29 | this.size = size; 30 | } 31 | 32 | /** 33 | * @return the bytes 34 | */ 35 | public Long getBytes() { 36 | return bytes; 37 | } 38 | 39 | /** 40 | * @param bytes the bytes to set 41 | */ 42 | public void setBytes(Long bytes) { 43 | this.bytes = bytes; 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/TxIdVout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class TxIdVout { 15 | String txid = null; 16 | Long vout = null; 17 | 18 | /** 19 | * @return the txid 20 | */ 21 | public String getTxid() { 22 | return txid; 23 | } 24 | 25 | /** 26 | * @param txid the txid to set 27 | */ 28 | public void setTxid(String txid) { 29 | this.txid = txid; 30 | } 31 | 32 | /** 33 | * @return the vout 34 | */ 35 | public Long getVout() { 36 | return vout; 37 | } 38 | 39 | /** 40 | * @param vout the vout to set 41 | */ 42 | public void setVout(Long vout) { 43 | this.vout = vout; 44 | } 45 | 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/StreamData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | import com.google.gson.Gson; 11 | import com.google.gson.GsonBuilder; 12 | import com.google.gson.JsonElement; 13 | import com.google.gson.JsonObject; 14 | 15 | /** 16 | * @author Ub - H. MARTEAU 17 | * @version 2.0.2 18 | */ 19 | public abstract class StreamData { 20 | public abstract JsonObject getPublicationValue(); 21 | 22 | protected JsonObject getJsonValue(Object object) { 23 | final GsonBuilder builder = new GsonBuilder(); 24 | final Gson gson = builder.create(); 25 | 26 | JsonElement jsonElement = gson.toJsonTree(object); 27 | JsonObject jsonObject = (JsonObject) jsonElement; 28 | // property removal 29 | jsonObject.remove("property"); 30 | 31 | return jsonObject; 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/formatters/HexFormatter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.formatters; 9 | 10 | import java.nio.charset.StandardCharsets; 11 | import org.apache.commons.codec.DecoderException; 12 | import org.apache.commons.codec.binary.Hex; 13 | 14 | /** 15 | * @author Ub - H. MARTEAU 16 | * @version 2.0.1 17 | */ 18 | public class HexFormatter { 19 | private HexFormatter() { 20 | super(); 21 | } 22 | 23 | public static String toHex(String asciiValue) { 24 | return Hex.encodeHexString(asciiValue.getBytes(StandardCharsets.UTF_8)); 25 | } 26 | 27 | public static String fromHex(String hexValue) { 28 | try { 29 | final byte[] bytes = Hex.decodeHex(hexValue.toCharArray()); 30 | return new String(bytes, StandardCharsets.UTF_8); 31 | } catch (DecoderException e) { 32 | return null; 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/AddedNodeInfoAddress.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class AddedNodeInfoAddress { 15 | String address = null; 16 | String connected = null; 17 | 18 | /** 19 | * @return the address 20 | */ 21 | public String getAddress() { 22 | return address; 23 | } 24 | 25 | /** 26 | * @param address the address to set 27 | */ 28 | public void setAddress(String address) { 29 | this.address = address; 30 | } 31 | 32 | /** 33 | * @return the connected 34 | */ 35 | public String getConnected() { 36 | return connected; 37 | } 38 | 39 | /** 40 | * @param connected the connected to set 41 | */ 42 | public void setConnected(String connected) { 43 | this.connected = connected; 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/ChunkqueueInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class ChunkqueueInfo { 15 | ChunkqueueInfoElt chunks = null; 16 | ChunkqueueInfoElt bytes = null; 17 | 18 | /** 19 | * @return the chunks 20 | */ 21 | public ChunkqueueInfoElt getChunks() { 22 | return chunks; 23 | } 24 | 25 | /** 26 | * @param chunks the chunks to set 27 | */ 28 | public void setChunks(ChunkqueueInfoElt chunks) { 29 | this.chunks = chunks; 30 | } 31 | 32 | /** 33 | * @return the bytes 34 | */ 35 | public ChunkqueueInfoElt getBytes() { 36 | return bytes; 37 | } 38 | 39 | /** 40 | * @param bytes the bytes to set 41 | */ 42 | public void setBytes(ChunkqueueInfoElt bytes) { 43 | this.bytes = bytes; 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/DataParamHex.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class DataParamHex implements DataParam { 15 | private String hexValue = null; 16 | 17 | @Override 18 | public String getFormatedvalue() { 19 | return getHexValue(); 20 | } 21 | 22 | /** 23 | * 24 | */ 25 | public DataParamHex() { 26 | super(); 27 | } 28 | 29 | /** 30 | * @param hexValue 31 | */ 32 | public DataParamHex(String hexValue) { 33 | this.hexValue = hexValue; 34 | } 35 | 36 | /** 37 | * @return the hexValue 38 | */ 39 | public String getHexValue() { 40 | return hexValue; 41 | } 42 | 43 | /** 44 | * @param hexValue the hexValue to set 45 | */ 46 | public void setHexValue(String hexValue) { 47 | this.hexValue = hexValue; 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/ChunkqueueTotal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class ChunkqueueTotal { 15 | ChunkqueueTotalElt chunks = null; 16 | ChunkqueueTotalElt bytes = null; 17 | 18 | /** 19 | * @return the chunks 20 | */ 21 | public ChunkqueueTotalElt getChunks() { 22 | return chunks; 23 | } 24 | 25 | /** 26 | * @param chunks the chunks to set 27 | */ 28 | public void setChunks(ChunkqueueTotalElt chunks) { 29 | this.chunks = chunks; 30 | } 31 | 32 | /** 33 | * @return the bytes 34 | */ 35 | public ChunkqueueTotalElt getBytes() { 36 | return bytes; 37 | } 38 | 39 | /** 40 | * @param bytes the bytes to set 41 | */ 42 | public void setBytes(ChunkqueueTotalElt bytes) { 43 | this.bytes = bytes; 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/MultisigAddress.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class MultisigAddress { 15 | String address = null; 16 | String redeemScript = null; 17 | 18 | /** 19 | * @return the address 20 | */ 21 | public String getAddress() { 22 | return address; 23 | } 24 | 25 | /** 26 | * @param address the address to set 27 | */ 28 | public void setAddress(String address) { 29 | this.address = address; 30 | } 31 | 32 | /** 33 | * @return the redeemScript 34 | */ 35 | public String getRedeemScript() { 36 | return redeemScript; 37 | } 38 | 39 | /** 40 | * @param redeemScript the redeemScript to set 41 | */ 42 | public void setRedeemScript(String redeemScript) { 43 | this.redeemScript = redeemScript; 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/ParamIssue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class ParamIssue { 15 | private Long raw = null; 16 | 17 | /** 18 | * 19 | */ 20 | public ParamIssue() { 21 | super(); 22 | // TODO Auto-generated constructor stub 23 | } 24 | 25 | public boolean isFilled() { 26 | boolean filled = true; 27 | 28 | if (raw == null || raw < 0) { 29 | filled = false; 30 | } 31 | 32 | return filled; 33 | } 34 | 35 | /** 36 | * @param raw 37 | * @param asset 38 | */ 39 | public ParamIssue(Long raw) { 40 | this.raw = raw; 41 | } 42 | 43 | /** 44 | * @return the raw 45 | */ 46 | public Long getRaw() { 47 | return raw; 48 | } 49 | 50 | /** 51 | * @param raw the raw to set 52 | */ 53 | public void setRaw(Long raw) { 54 | this.raw = raw; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/BalanceWalletTransaction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public class BalanceWalletTransaction { 17 | Double amount = null; 18 | List assets; 19 | 20 | /** 21 | * @return the amount 22 | */ 23 | public double getAmount() { 24 | return amount; 25 | } 26 | 27 | /** 28 | * @param amount the amount to set 29 | */ 30 | public void setAmount(double amount) { 31 | this.amount = amount; 32 | } 33 | 34 | /** 35 | * @return the assets 36 | */ 37 | public List getAssets() { 38 | return assets; 39 | } 40 | 41 | /** 42 | * @param assets the assets to set 43 | */ 44 | public void setAssets(List assets) { 45 | this.assets = assets; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/SinceBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public class SinceBlock { 17 | List transactions = null; 18 | String lastblock = null; 19 | 20 | /** 21 | * @return the transactions 22 | */ 23 | public List getTransactions() { 24 | return transactions; 25 | } 26 | 27 | /** 28 | * @param transactions the transactions to set 29 | */ 30 | public void setTransactions(List transactions) { 31 | this.transactions = transactions; 32 | } 33 | 34 | /** 35 | * @return the lastblock 36 | */ 37 | public String getLastblock() { 38 | return lastblock; 39 | } 40 | 41 | /** 42 | * @param lastblock the lastblock to set 43 | */ 44 | public void setLastblock(String lastblock) { 45 | this.lastblock = lastblock; 46 | } 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/SignedTransactionRAW.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class SignedTransactionRAW { 15 | String hex = null; 16 | Boolean complete = null; 17 | 18 | /* 19 | * (non-Javadoc) 20 | * 21 | * @see java.lang.Object#toString() 22 | */ 23 | @Override 24 | public String toString() { 25 | return "SignedTransactionRAW [hex=" + hex + ", complete=" + complete + "]"; 26 | } 27 | 28 | /** 29 | * @return the hex 30 | */ 31 | public String getHex() { 32 | return hex; 33 | } 34 | 35 | /** 36 | * @param hex the hex to set 37 | */ 38 | public void setHex(String hex) { 39 | this.hex = hex; 40 | } 41 | 42 | /** 43 | * @return the complete 44 | */ 45 | public boolean isComplete() { 46 | return complete; 47 | } 48 | 49 | /** 50 | * @param complete the complete to set 51 | */ 52 | public void setComplete(boolean complete) { 53 | this.complete = complete; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/ParamIssueMore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class ParamIssueMore extends ParamIssue { 15 | private String asset = null; 16 | 17 | /** 18 | * 19 | */ 20 | public ParamIssueMore() { 21 | super(); 22 | // TODO Auto-generated constructor stub 23 | } 24 | 25 | public boolean isFilled() { 26 | boolean filled = true; 27 | 28 | filled = super.isFilled(); 29 | 30 | if (asset == null || asset.isEmpty()) { 31 | filled = filled && false; 32 | } 33 | 34 | return filled; 35 | } 36 | 37 | /** 38 | * @param raw 39 | * @param asset 40 | */ 41 | public ParamIssueMore(Long raw, String asset) { 42 | super(raw); 43 | this.asset = asset; 44 | } 45 | 46 | /** 47 | * @return the asset 48 | */ 49 | public String getAsset() { 50 | return asset; 51 | } 52 | 53 | /** 54 | * @param asset the asset to set 55 | */ 56 | public void setAsset(String asset) { 57 | this.asset = asset; 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/CustomParamString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class CustomParamString { 15 | String name; 16 | String value; 17 | 18 | /** 19 | * 20 | */ 21 | public CustomParamString() { 22 | super(); 23 | // TODO Auto-generated constructor stub 24 | } 25 | 26 | /** 27 | * @param name 28 | * @param value 29 | */ 30 | public CustomParamString(String name, String value) { 31 | super(); 32 | this.name = name; 33 | this.value = value; 34 | } 35 | 36 | /** 37 | * @return the name 38 | */ 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | /** 44 | * @param name the name to set 45 | */ 46 | public void setName(String name) { 47 | this.name = name; 48 | } 49 | 50 | /** 51 | * @return the value 52 | */ 53 | public String getValue() { 54 | return value; 55 | } 56 | 57 | /** 58 | * @param value the value to set 59 | */ 60 | public void setValue(String value) { 61 | this.value = value; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/NetworkInfoLocalAddress.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class NetworkInfoLocalAddress { 15 | String address = null; 16 | Long port = null; 17 | Long score = null; 18 | 19 | /** 20 | * @return the address 21 | */ 22 | public String getAddress() { 23 | return address; 24 | } 25 | 26 | /** 27 | * @param address the address to set 28 | */ 29 | public void setAddress(String address) { 30 | this.address = address; 31 | } 32 | 33 | /** 34 | * @return the port 35 | */ 36 | public Long getPort() { 37 | return port; 38 | } 39 | 40 | /** 41 | * @param port the port to set 42 | */ 43 | public void setPort(Long port) { 44 | this.port = port; 45 | } 46 | 47 | /** 48 | * @return the score 49 | */ 50 | public Long getScore() { 51 | return score; 52 | } 53 | 54 | /** 55 | * @param score the score to set 56 | */ 57 | public void setScore(Long score) { 58 | this.score = score; 59 | } 60 | 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/TransactionWalletVout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | public class TransactionWalletVout extends TransactionWalletVInfo { 18 | Long n = null; 19 | List items; 20 | 21 | /** 22 | * 23 | */ 24 | public TransactionWalletVout() { 25 | super(); 26 | items = new ArrayList(); 27 | } 28 | 29 | /** 30 | * @param info 31 | */ 32 | public TransactionWalletVout(TransactionWalletVInfo info) { 33 | super(info); 34 | items = new ArrayList(); 35 | } 36 | 37 | /** 38 | * @return the n 39 | */ 40 | public long getN() { 41 | return n; 42 | } 43 | 44 | /** 45 | * @param n the n to set 46 | */ 47 | public void setN(long n) { 48 | this.n = n; 49 | } 50 | 51 | /** 52 | * @return the items 53 | */ 54 | public List getItems() { 55 | return items; 56 | } 57 | 58 | /** 59 | * @param items the items to set 60 | */ 61 | public void setItems(List items) { 62 | this.items = items; 63 | } 64 | 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/multichain/command/RuntimeParameters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.command; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 4.15 13 | */ 14 | public class RuntimeParameters { 15 | String datadir = null; 16 | String rpcport = null; 17 | 18 | /** 19 | * 20 | */ 21 | public RuntimeParameters() { 22 | super(); 23 | // TODO Auto-generated constructor stub 24 | } 25 | 26 | /** 27 | * @param datadir 28 | * @param rpcport 29 | */ 30 | public RuntimeParameters(String datadir, String rpcport) { 31 | super(); 32 | this.datadir = datadir; 33 | this.rpcport = rpcport; 34 | } 35 | 36 | /** 37 | * @return the datadir 38 | */ 39 | public String getDatadir() { 40 | return datadir; 41 | } 42 | /** 43 | * @param datadir the datadir to set 44 | */ 45 | public void setDatadir(String datadir) { 46 | this.datadir = datadir; 47 | } 48 | /** 49 | * @return the rpcport 50 | */ 51 | public String getRpcport() { 52 | return rpcport; 53 | } 54 | /** 55 | * @param rpcport the rpcport to set 56 | */ 57 | public void setRpcport(String rpcport) { 58 | this.rpcport = rpcport; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/ChunkqueueInfoElt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class ChunkqueueInfoElt { 15 | Long waiting = null; 16 | Long querying = null; 17 | Long retrieving = null; 18 | 19 | /** 20 | * @return the waiting 21 | */ 22 | public Long getWaiting() { 23 | return waiting; 24 | } 25 | 26 | /** 27 | * @param waiting the waiting to set 28 | */ 29 | public void setWaiting(Long waiting) { 30 | this.waiting = waiting; 31 | } 32 | 33 | /** 34 | * @return the querying 35 | */ 36 | public Long getQuerying() { 37 | return querying; 38 | } 39 | 40 | /** 41 | * @param querying the querying to set 42 | */ 43 | public void setQuerying(Long querying) { 44 | this.querying = querying; 45 | } 46 | 47 | /** 48 | * @return the retrieving 49 | */ 50 | public Long getRetrieving() { 51 | return retrieving; 52 | } 53 | 54 | /** 55 | * @param retrieving the retrieving to set 56 | */ 57 | public void setRetrieving(Long retrieving) { 58 | this.retrieving = retrieving; 59 | } 60 | 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/formatters/GsonFormatters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.formatters; 9 | 10 | import java.util.List; 11 | import com.google.gson.Gson; 12 | import com.google.gson.GsonBuilder; 13 | 14 | /** 15 | * @author Ub - H. MARTEAU 16 | * @version 2.0.1 17 | */ 18 | public class GsonFormatters { 19 | protected GsonFormatters() { 20 | super(); 21 | } 22 | 23 | protected static String formatJson(String[] values) { 24 | final GsonBuilder builder = new GsonBuilder(); 25 | final Gson gson = builder.create(); 26 | 27 | return gson.toJson(values); 28 | } 29 | 30 | protected static String formatJson(List values) { 31 | final GsonBuilder builder = new GsonBuilder(); 32 | final Gson gson = builder.create(); 33 | 34 | return gson.toJson(values); 35 | } 36 | 37 | protected static String formatJson(Object value) { 38 | final GsonBuilder builder = new GsonBuilder(); 39 | final Gson gson = builder.create(); 40 | return gson.toJson(value); 41 | } 42 | 43 | protected static String formatJsonWithCustomBuilder(Object value, GsonBuilder builder) { 44 | return builder.create().toJson(value); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/AssetQuantity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class AssetQuantity { 15 | String name; 16 | float quantity; 17 | 18 | /** 19 | * @param name 20 | * @param quantity 21 | */ 22 | public AssetQuantity(String name, float quantity) { 23 | super(); 24 | this.name = name; 25 | this.quantity = quantity; 26 | } 27 | 28 | public boolean isFilled() { 29 | if (name == null || "".equals(name)) { 30 | return false; 31 | } 32 | return true; 33 | } 34 | 35 | /** 36 | * @return the name 37 | */ 38 | public String getName() { 39 | return name; 40 | } 41 | 42 | /** 43 | * @param name the name to set 44 | */ 45 | public void setName(String name) { 46 | this.name = name; 47 | } 48 | 49 | /** 50 | * @return the quantity 51 | */ 52 | public float getQuantity() { 53 | return quantity; 54 | } 55 | 56 | /** 57 | * @param quantity the quantity to set 58 | */ 59 | public void setQuantity(float quantity) { 60 | this.quantity = quantity; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/MultiChainRPCAnswer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import com.google.gson.internal.LinkedTreeMap; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public class MultiChainRPCAnswer { 17 | 18 | Object result = null; 19 | LinkedTreeMap error; 20 | String id = null; 21 | 22 | /** 23 | * @return the result 24 | */ 25 | public Object getResult() { 26 | return result; 27 | } 28 | 29 | /** 30 | * @param result the result to set 31 | */ 32 | public void setResult(Object result) { 33 | this.result = result; 34 | } 35 | 36 | /** 37 | * @return the error 38 | */ 39 | public LinkedTreeMap getError() { 40 | return error; 41 | } 42 | 43 | /** 44 | * @param error the error to set 45 | */ 46 | public void setError(LinkedTreeMap error) { 47 | this.error = error; 48 | } 49 | 50 | /** 51 | * @return the id 52 | */ 53 | public String getId() { 54 | return id; 55 | } 56 | 57 | /** 58 | * @param id the id to set 59 | */ 60 | public void setId(String id) { 61 | this.id = id; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/multichain/command/GrantElt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.command; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public enum GrantElt { 17 | CONNECT("connect"), 18 | SEND("send"), 19 | RECEIVE("receive"), 20 | ISSUE("issue"), 21 | MINE("mine"), 22 | ACTIVATE("activate"), 23 | ADMIN("admin"), 24 | CREATE("create"); 25 | 26 | String grant = null; 27 | 28 | private GrantElt(String grant) { 29 | this.grant = grant; 30 | } 31 | 32 | public static String grantElements(List grantelements) { 33 | StringBuilder value = new StringBuilder(""); 34 | 35 | if (!grantelements.isEmpty()) { 36 | value.append(grantelements.get(0).getGrant()); 37 | for (int i = 1; i < grantelements.size(); i++) { 38 | value.append(","); 39 | value.append(grantelements.get(i).getGrant()); 40 | } 41 | } 42 | 43 | return value.toString(); 44 | } 45 | 46 | /** 47 | * @return the grant 48 | */ 49 | public String getGrant() { 50 | return grant; 51 | } 52 | 53 | /** 54 | * @param grant the grant to set 55 | */ 56 | public void setGrant(String grant) { 57 | this.grant = grant; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/TransactionWalletVin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class TransactionWalletVin extends TransactionWalletVInfo { 15 | Long n = null; 16 | String txid = null; 17 | Long vout = null; 18 | 19 | 20 | /** 21 | * @param info 22 | */ 23 | public TransactionWalletVin(TransactionWalletVInfo info) { 24 | super(info); 25 | } 26 | 27 | /** 28 | * 29 | */ 30 | public TransactionWalletVin() { 31 | super(); 32 | } 33 | 34 | /** 35 | * @return the txid 36 | */ 37 | public String getTxid() { 38 | return txid; 39 | } 40 | 41 | /** 42 | * @param txid the txid to set 43 | */ 44 | public void setTxid(String txid) { 45 | this.txid = txid; 46 | } 47 | 48 | /** 49 | * @return the n 50 | */ 51 | public long getN() { 52 | return n; 53 | } 54 | 55 | /** 56 | * @param n the n to set 57 | */ 58 | public void setN(long n) { 59 | this.n = n; 60 | } 61 | 62 | /** 63 | * @return the vout 64 | */ 65 | public Long getVout() { 66 | return vout; 67 | } 68 | 69 | /** 70 | * @param vout the vout to set 71 | */ 72 | public void setVout(Long vout) { 73 | this.vout = vout; 74 | } 75 | 76 | 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/NetTotals.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class NetTotals { 15 | Long totalbytesrecv = null; 16 | Long totalbytessent = null; 17 | Long timemillis = null; 18 | 19 | /** 20 | * @return the totalbytesrecv 21 | */ 22 | public Long getTotalbytesrecv() { 23 | return totalbytesrecv; 24 | } 25 | 26 | /** 27 | * @param totalbytesrecv the totalbytesrecv to set 28 | */ 29 | public void setTotalbytesrecv(Long totalbytesrecv) { 30 | this.totalbytesrecv = totalbytesrecv; 31 | } 32 | 33 | /** 34 | * @return the totalbytessent 35 | */ 36 | public Long getTotalbytessent() { 37 | return totalbytessent; 38 | } 39 | 40 | /** 41 | * @param totalbytessent the totalbytessent to set 42 | */ 43 | public void setTotalbytessent(Long totalbytessent) { 44 | this.totalbytessent = totalbytessent; 45 | } 46 | 47 | /** 48 | * @return the timemillis 49 | */ 50 | public Long getTimemillis() { 51 | return timemillis; 52 | } 53 | 54 | /** 55 | * @param timemillis the timemillis to set 56 | */ 57 | public void setTimemillis(Long timemillis) { 58 | this.timemillis = timemillis; 59 | } 60 | 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/BalanceAssetGeneral.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class BalanceAssetGeneral { 15 | String name = null; 16 | String assetref = null; 17 | Double qty = null; 18 | 19 | /* 20 | * (non-Javadoc) 21 | * 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "BalanceAssetGeneral [name=" + name + ", assetref=" + assetref + ", qty=" + qty + "]"; 27 | } 28 | 29 | /** 30 | * @return the name 31 | */ 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | /** 37 | * @param name the name to set 38 | */ 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | /** 44 | * @return the assetref 45 | */ 46 | public String getAssetref() { 47 | return assetref; 48 | } 49 | 50 | /** 51 | * @param assetref the assetref to set 52 | */ 53 | public void setAssetref(String assetref) { 54 | this.assetref = assetref; 55 | } 56 | 57 | /** 58 | * @return the qty 59 | */ 60 | public double getQty() { 61 | return qty; 62 | } 63 | 64 | /** 65 | * @param qty the qty to set 66 | */ 67 | public void setQty(double qty) { 68 | this.qty = qty; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/AddedNodeInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public class AddedNodeInfo { 17 | String addednode = null; 18 | Boolean connected = null; 19 | List addresses = null; 20 | 21 | /** 22 | * @return the addednode 23 | */ 24 | public String getAddednode() { 25 | return addednode; 26 | } 27 | 28 | /** 29 | * @param addednode the addednode to set 30 | */ 31 | public void setAddednode(String addednode) { 32 | this.addednode = addednode; 33 | } 34 | 35 | /** 36 | * @return the connected 37 | */ 38 | public Boolean getConnected() { 39 | return connected; 40 | } 41 | 42 | /** 43 | * @param connected the connected to set 44 | */ 45 | public void setConnected(Boolean connected) { 46 | this.connected = connected; 47 | } 48 | 49 | /** 50 | * @return the addresses 51 | */ 52 | public List getAddresses() { 53 | return addresses; 54 | } 55 | 56 | /** 57 | * @param addresses the addresses to set 58 | */ 59 | public void setAddresses(List addresses) { 60 | this.addresses = addresses; 61 | } 62 | 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/KeyPairs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class KeyPairs { 15 | String address = null; 16 | String pubkey = null; 17 | String privkey = null; 18 | 19 | /* 20 | * (non-Javadoc) 21 | * 22 | * @see java.lang.Object#toString() 23 | */ 24 | @Override 25 | public String toString() { 26 | return "KeyPairs [address=" + address + ", pubkey=" + pubkey + ", privkey=" + privkey + "]"; 27 | } 28 | 29 | /** 30 | * @return the address 31 | */ 32 | public String getAddress() { 33 | return address; 34 | } 35 | 36 | /** 37 | * @param address the address to set 38 | */ 39 | public void setAddress(String address) { 40 | this.address = address; 41 | } 42 | 43 | /** 44 | * @return the pubkey 45 | */ 46 | public String getPubkey() { 47 | return pubkey; 48 | } 49 | 50 | /** 51 | * @param pubkey the pubkey to set 52 | */ 53 | public void setPubkey(String pubkey) { 54 | this.pubkey = pubkey; 55 | } 56 | 57 | /** 58 | * @return the privkey 59 | */ 60 | public String getPrivkey() { 61 | return privkey; 62 | } 63 | 64 | /** 65 | * @param privkey the privkey to set 66 | */ 67 | public void setPrivkey(String privkey) { 68 | this.privkey = privkey; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/Transaction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | public class Transaction extends TransactionGeneral { 18 | List details; 19 | String hex = null; 20 | 21 | /** 22 | * 23 | */ 24 | public Transaction() { 25 | super(); 26 | details = new ArrayList(); 27 | } 28 | 29 | /** 30 | * 31 | */ 32 | public Transaction(TransactionBase transactionBase) { 33 | super(transactionBase); 34 | details = new ArrayList(); 35 | } 36 | 37 | /** 38 | * @return the details 39 | */ 40 | public List getDetails() { 41 | return details; 42 | } 43 | 44 | /** 45 | * @param details the details to set 46 | */ 47 | public void setDetails(List details) { 48 | this.details = details; 49 | } 50 | 51 | /** 52 | * @param detail the detail to add to details 53 | */ 54 | public void addDetails(TransactionDetail detail) { 55 | this.details.add(detail); 56 | } 57 | 58 | /** 59 | * @return the hex 60 | */ 61 | public String getHex() { 62 | return hex; 63 | } 64 | 65 | /** 66 | * @param hex the hex to set 67 | */ 68 | public void setHex(String hex) { 69 | this.hex = hex; 70 | } 71 | 72 | 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/TransactionListElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class TransactionListElement extends TransactionGeneral { 15 | String account = null; 16 | String address = null; 17 | String category = null; 18 | Long vout = null; 19 | 20 | /** 21 | * @return the account 22 | */ 23 | public String getAccount() { 24 | return account; 25 | } 26 | 27 | /** 28 | * @param account the account to set 29 | */ 30 | public void setAccount(String account) { 31 | this.account = account; 32 | } 33 | 34 | /** 35 | * @return the address 36 | */ 37 | public String getAddress() { 38 | return address; 39 | } 40 | 41 | /** 42 | * @param address the address to set 43 | */ 44 | public void setAddress(String address) { 45 | this.address = address; 46 | } 47 | 48 | /** 49 | * @return the category 50 | */ 51 | public String getCategory() { 52 | return category; 53 | } 54 | 55 | /** 56 | * @param category the category to set 57 | */ 58 | public void setCategory(String category) { 59 | this.category = category; 60 | } 61 | 62 | /** 63 | * @return the vout 64 | */ 65 | public long getVout() { 66 | return vout; 67 | } 68 | 69 | /** 70 | * @param vout the vout to set 71 | */ 72 | public void setVout(long vout) { 73 | this.vout = vout; 74 | } 75 | 76 | 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/ChainTip.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class ChainTip { 15 | String height = null; 16 | String hash = null; 17 | Long branchlen = null; 18 | String status = null; 19 | 20 | /** 21 | * @return the height 22 | */ 23 | public String getHeight() { 24 | return height; 25 | } 26 | 27 | /** 28 | * @param height the height to set 29 | */ 30 | public void setHeight(String height) { 31 | this.height = height; 32 | } 33 | 34 | /** 35 | * @return the hash 36 | */ 37 | public String getHash() { 38 | return hash; 39 | } 40 | 41 | /** 42 | * @param hash the hash to set 43 | */ 44 | public void setHash(String hash) { 45 | this.hash = hash; 46 | } 47 | 48 | /** 49 | * @return the branchlen 50 | */ 51 | public Long getBranchlen() { 52 | return branchlen; 53 | } 54 | 55 | /** 56 | * @param branchlen the branchlen to set 57 | */ 58 | public void setBranchlen(Long branchlen) { 59 | this.branchlen = branchlen; 60 | } 61 | 62 | /** 63 | * @return the status 64 | */ 65 | public String getStatus() { 66 | return status; 67 | } 68 | 69 | /** 70 | * @param status the status to set 71 | */ 72 | public void setStatus(String status) { 73 | this.status = status; 74 | } 75 | 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/AssetParams.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.2 13 | */ 14 | public class AssetParams { 15 | String name; 16 | boolean open; 17 | String restrict = null; 18 | 19 | /** 20 | * @param name 21 | * @param open 22 | */ 23 | public AssetParams(String name, boolean open) { 24 | super(); 25 | this.name = name; 26 | this.open = open; 27 | } 28 | 29 | /** 30 | * @param name 31 | * @param open 32 | * @param restrict 33 | */ 34 | public AssetParams(String name, boolean open, String restrict) { 35 | super(); 36 | this.name = name; 37 | this.open = open; 38 | this.restrict = restrict; 39 | } 40 | 41 | /** 42 | * @return the restrict 43 | */ 44 | public String getRestrict() { 45 | return restrict; 46 | } 47 | 48 | /** 49 | * set the restrict 50 | * @param restrict 51 | */ 52 | public void setRestrict(String restrict) { 53 | this.restrict = restrict; 54 | } 55 | 56 | /** 57 | * @return the name 58 | */ 59 | public String getName() { 60 | return name; 61 | } 62 | 63 | /** 64 | * @param name the name to set 65 | */ 66 | public void setName(String name) { 67 | this.name = name; 68 | } 69 | 70 | /** 71 | * @return the open 72 | */ 73 | public boolean isOpen() { 74 | return open; 75 | } 76 | 77 | /** 78 | * @param open the open to set 79 | */ 80 | public void setOpen(boolean open) { 81 | this.open = open; 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/StreamDataText.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | import com.google.gson.JsonObject; 11 | import com.google.gson.internal.LinkedTreeMap; 12 | import multichain.object.formatters.GenericOutputFormatter; 13 | 14 | /** 15 | * @author Ub - H. MARTEAU 16 | * @version 2.0.2 17 | */ 18 | public class StreamDataText extends StreamData { 19 | private String text; 20 | 21 | /** 22 | * 23 | */ 24 | public StreamDataText() { 25 | super(); 26 | } 27 | 28 | /** 29 | * @param text 30 | */ 31 | public StreamDataText(String text) { 32 | super(); 33 | this.text = text; 34 | } 35 | 36 | /** 37 | * @param jsonObject 38 | */ 39 | public StreamDataText(LinkedTreeMap jsonObject) { 40 | this(((StreamDataText) GenericOutputFormatter.format(jsonObject, StreamDataText.class)) 41 | .getText()); 42 | } 43 | 44 | /** 45 | * @param jsonObject 46 | */ 47 | public StreamDataText(Object jsonObject) { 48 | this(((StreamDataText) GenericOutputFormatter.format((LinkedTreeMap) jsonObject, 49 | StreamDataText.class)).getText()); 50 | } 51 | 52 | /** 53 | * @return the text 54 | */ 55 | public String getText() { 56 | return text; 57 | } 58 | 59 | /** 60 | * @param text the text to set 61 | */ 62 | public void setText(String text) { 63 | this.text = text; 64 | } 65 | 66 | @Override 67 | public JsonObject getPublicationValue() { 68 | return getJsonValue(this); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/StreamDataCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | import com.google.gson.JsonObject; 11 | import com.google.gson.internal.LinkedTreeMap; 12 | import multichain.object.formatters.GenericOutputFormatter; 13 | 14 | /** 15 | * @author Ub - H. MARTEAU 16 | * @version 2.0.2 17 | */ 18 | public class StreamDataCache extends StreamData { 19 | private String cache; 20 | 21 | /** 22 | * 23 | */ 24 | public StreamDataCache() { 25 | super(); 26 | } 27 | 28 | /** 29 | * @param text 30 | */ 31 | public StreamDataCache(String cache) { 32 | super(); 33 | this.cache = cache; 34 | } 35 | 36 | /** 37 | * @param jsonObject 38 | */ 39 | public StreamDataCache(LinkedTreeMap jsonObject) { 40 | this(((StreamDataCache) GenericOutputFormatter.format(jsonObject, StreamDataCache.class)) 41 | .getCache()); 42 | } 43 | 44 | /** 45 | * @param jsonObject 46 | */ 47 | public StreamDataCache(Object jsonObject) { 48 | this(((StreamDataCache) GenericOutputFormatter.format((LinkedTreeMap) jsonObject, 49 | StreamDataCache.class)).getCache()); 50 | } 51 | 52 | 53 | @Override 54 | public JsonObject getPublicationValue() { 55 | return getJsonValue(this); 56 | } 57 | 58 | /** 59 | * @return the cache 60 | */ 61 | public String getCache() { 62 | return cache; 63 | } 64 | 65 | /** 66 | * @param cache the cache to set 67 | */ 68 | public void setCache(String cache) { 69 | this.cache = cache; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/StreamDataJson.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | import com.google.gson.JsonObject; 11 | import com.google.gson.internal.LinkedTreeMap; 12 | import multichain.object.formatters.GenericOutputFormatter; 13 | 14 | /** 15 | * @author Ub - H. MARTEAU 16 | * @version 2.0.2 17 | */ 18 | public class StreamDataJson extends StreamData { 19 | private JsonObject json; 20 | 21 | /** 22 | * 23 | */ 24 | public StreamDataJson() { 25 | super(); 26 | } 27 | 28 | /** 29 | * @param json 30 | */ 31 | public StreamDataJson(JsonObject json) { 32 | super(); 33 | this.json = json; 34 | } 35 | 36 | /** 37 | * @param jsonObject 38 | */ 39 | public StreamDataJson(LinkedTreeMap jsonObject) { 40 | this(((StreamDataJson) GenericOutputFormatter.format(jsonObject, StreamDataJson.class)) 41 | .getJson()); 42 | } 43 | 44 | /** 45 | * @param jsonObject 46 | */ 47 | public StreamDataJson(Object jsonObject) { 48 | this(((StreamDataJson) GenericOutputFormatter.format((LinkedTreeMap) jsonObject, 49 | StreamDataJson.class)).getJson()); 50 | } 51 | 52 | 53 | 54 | @Override 55 | public JsonObject getPublicationValue() { 56 | return getJsonValue(this); 57 | } 58 | 59 | /** 60 | * @return the json 61 | */ 62 | public JsonObject getJson() { 63 | return json; 64 | } 65 | 66 | /** 67 | * @param json the json to set 68 | */ 69 | public void setJson(JsonObject json) { 70 | this.json = json; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/MultiChainInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public class MultiChainInfo { 17 | 18 | /* 19 | * {"method":"issue","params":["169dyfazv83kBFXdUFyjChVR9kqDcve4VQtUaN", "Data source 2" 20 | * ,10000,1.00000000],"id":1,"chain_name":"testIssue"} 21 | */ 22 | String method = null; 23 | List params; 24 | Integer id = null; 25 | String chain_name = null; 26 | 27 | /** 28 | * @return the method 29 | */ 30 | public String getMethod() { 31 | return method; 32 | } 33 | 34 | /** 35 | * @param method the method to set 36 | */ 37 | public void setMethod(String method) { 38 | this.method = method; 39 | } 40 | 41 | /** 42 | * @return the params 43 | */ 44 | public List getParams() { 45 | return params; 46 | } 47 | 48 | /** 49 | * @param params the params to set 50 | */ 51 | public void setParams(List params) { 52 | this.params = params; 53 | } 54 | 55 | /** 56 | * @return the id 57 | */ 58 | public int getId() { 59 | return id; 60 | } 61 | 62 | /** 63 | * @param id the id to set 64 | */ 65 | public void setId(int id) { 66 | this.id = id; 67 | } 68 | 69 | /** 70 | * @return the chain_name 71 | */ 72 | public String getChain_name() { 73 | return chain_name; 74 | } 75 | 76 | /** 77 | * @param chain_name the chain_name to set 78 | */ 79 | public void setChain_name(String chain_name) { 80 | this.chain_name = chain_name; 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/Permission.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class Permission { 15 | 16 | String address = null; 17 | String type = null; 18 | Long startblock = null; 19 | Long endblock = null; 20 | 21 | /* 22 | * (non-Javadoc) 23 | * 24 | * @see java.lang.Object#toString() 25 | */ 26 | @Override 27 | public String toString() { 28 | return "Permission [address=" + address + ", type=" + type + ", startblock=" + startblock 29 | + ", endblock=" + endblock + "]"; 30 | } 31 | 32 | /** 33 | * @return the type 34 | */ 35 | public String getType() { 36 | return type; 37 | } 38 | 39 | /** 40 | * @param type the type to set 41 | */ 42 | public void setType(String type) { 43 | this.type = type; 44 | } 45 | 46 | /** 47 | * @return the startblock 48 | */ 49 | public long getStartblock() { 50 | return startblock; 51 | } 52 | 53 | /** 54 | * @param startblock the startblock to set 55 | */ 56 | public void setStartblock(long startblock) { 57 | this.startblock = startblock; 58 | } 59 | 60 | /** 61 | * @return the endblock 62 | */ 63 | public long getEndblock() { 64 | return endblock; 65 | } 66 | 67 | /** 68 | * @param endblock the endblock to set 69 | */ 70 | public void setEndblock(long endblock) { 71 | this.endblock = endblock; 72 | } 73 | 74 | /** 75 | * @return the address 76 | */ 77 | public String getAddress() { 78 | return address; 79 | } 80 | 81 | /** 82 | * @param address the address to set 83 | */ 84 | public void setAddress(String address) { 85 | this.address = address; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/LastBlockInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class LastBlockInfo { 15 | String hash = null; 16 | Long height = null; 17 | Long time = null; 18 | Long txcount = null; 19 | String miner = null; 20 | 21 | /** 22 | * @return the hash 23 | */ 24 | public String getHash() { 25 | return hash; 26 | } 27 | 28 | /** 29 | * @param hash the hash to set 30 | */ 31 | public void setHash(String hash) { 32 | this.hash = hash; 33 | } 34 | 35 | /** 36 | * @return the height 37 | */ 38 | public Long getHeight() { 39 | return height; 40 | } 41 | 42 | /** 43 | * @param height the height to set 44 | */ 45 | public void setHeight(Long height) { 46 | this.height = height; 47 | } 48 | 49 | /** 50 | * @return the time 51 | */ 52 | public Long getTime() { 53 | return time; 54 | } 55 | 56 | /** 57 | * @param time the time to set 58 | */ 59 | public void setTime(Long time) { 60 | this.time = time; 61 | } 62 | 63 | /** 64 | * @return the txcount 65 | */ 66 | public Long getTxcount() { 67 | return txcount; 68 | } 69 | 70 | /** 71 | * @param txcount the txcount to set 72 | */ 73 | public void setTxcount(Long txcount) { 74 | this.txcount = txcount; 75 | } 76 | 77 | /** 78 | * @return the miner 79 | */ 80 | public String getMiner() { 81 | return miner; 82 | } 83 | 84 | /** 85 | * @param miner the miner to set 86 | */ 87 | public void setMiner(String miner) { 88 | this.miner = miner; 89 | } 90 | 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/RawStreamParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | import multichain.object.formatters.GsonFormatters; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public class RawStreamParam extends GsonFormatters { 17 | String for_; 18 | String key; 19 | String data; 20 | 21 | /** 22 | * @param for_ 23 | * @param key 24 | * @param data 25 | */ 26 | public RawStreamParam(String for_, String key, String data) { 27 | super(); 28 | this.for_ = for_; 29 | this.key = key; 30 | this.data = data; 31 | } 32 | 33 | public boolean isFilled() { 34 | if (for_ == null || "".equals(for_)) { 35 | return false; 36 | } 37 | if (key == null || "".equals(key)) { 38 | return false; 39 | } 40 | if (data == null || "".equals(data)) { 41 | return false; 42 | } 43 | 44 | return true; 45 | } 46 | 47 | 48 | /** 49 | * @return the for_ 50 | */ 51 | public String getFor_() { 52 | return for_; 53 | } 54 | 55 | /** 56 | * @param for_ the for_ to set 57 | */ 58 | public void setFor_(String for_) { 59 | this.for_ = for_; 60 | } 61 | 62 | /** 63 | * @return the key 64 | */ 65 | public String getKey() { 66 | return key; 67 | } 68 | 69 | /** 70 | * @param key the key to set 71 | */ 72 | public void setKey(String key) { 73 | this.key = key; 74 | } 75 | 76 | /** 77 | * @return the data 78 | */ 79 | public String getData() { 80 | return data; 81 | } 82 | 83 | /** 84 | * @param data the data to set 85 | */ 86 | public void setData(String data) { 87 | this.data = data; 88 | } 89 | 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/Publisher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class Publisher { 15 | String publisher = null; 16 | Long items = null; 17 | Long confirmed = null; 18 | StreamKeyItem first = null; 19 | StreamKeyItem last = null; 20 | 21 | /** 22 | * @return the publisher 23 | */ 24 | public String getPublisher() { 25 | return publisher; 26 | } 27 | 28 | /** 29 | * @param publisher the publisher to set 30 | */ 31 | public void setPublisher(String publisher) { 32 | this.publisher = publisher; 33 | } 34 | 35 | /** 36 | * @return the items 37 | */ 38 | public Long getItems() { 39 | return items; 40 | } 41 | 42 | /** 43 | * @param items the items to set 44 | */ 45 | public void setItems(Long items) { 46 | this.items = items; 47 | } 48 | 49 | /** 50 | * @return the confirmed 51 | */ 52 | public Long getConfirmed() { 53 | return confirmed; 54 | } 55 | 56 | /** 57 | * @param confirmed the confirmed to set 58 | */ 59 | public void setConfirmed(Long confirmed) { 60 | this.confirmed = confirmed; 61 | } 62 | 63 | /** 64 | * @return the first 65 | */ 66 | public StreamKeyItem getFirst() { 67 | return first; 68 | } 69 | 70 | /** 71 | * @param first the first to set 72 | */ 73 | public void setFirst(StreamKeyItem first) { 74 | this.first = first; 75 | } 76 | 77 | /** 78 | * @return the last 79 | */ 80 | public StreamKeyItem getLast() { 81 | return last; 82 | } 83 | 84 | /** 85 | * @param last the last to set 86 | */ 87 | public void setLast(StreamKeyItem last) { 88 | this.last = last; 89 | } 90 | 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/AssetIssues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | public class AssetIssues { 18 | 19 | String txid = null; 20 | Long qty = null; 21 | Long raw = null; 22 | Map details = null; 23 | List issuers = null; 24 | 25 | /** 26 | * @return the txid 27 | */ 28 | public String getTxid() { 29 | return txid; 30 | } 31 | 32 | /** 33 | * @param txid the txid to set 34 | */ 35 | public void setTxid(String txid) { 36 | this.txid = txid; 37 | } 38 | 39 | /** 40 | * @return the qty 41 | */ 42 | public Long getQty() { 43 | return qty; 44 | } 45 | 46 | /** 47 | * @param qty the qty to set 48 | */ 49 | public void setQty(Long qty) { 50 | this.qty = qty; 51 | } 52 | 53 | /** 54 | * @return the raw 55 | */ 56 | public Long getRaw() { 57 | return raw; 58 | } 59 | 60 | /** 61 | * @param raw the raw to set 62 | */ 63 | public void setRaw(Long raw) { 64 | this.raw = raw; 65 | } 66 | 67 | /** 68 | * @return the details 69 | */ 70 | public Map getDetails() { 71 | return details; 72 | } 73 | 74 | /** 75 | * @param details the details to set 76 | */ 77 | public void setDetails(Map details) { 78 | this.details = details; 79 | } 80 | 81 | /** 82 | * @return the issuers 83 | */ 84 | public List getIssuers() { 85 | return issuers; 86 | } 87 | 88 | /** 89 | * @param issuers the issuers to set 90 | */ 91 | public void setIssuers(List issuers) { 92 | this.issuers = issuers; 93 | } 94 | 95 | 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/BalanceAssetWalletTransaction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class BalanceAssetWalletTransaction { 15 | String name = null; 16 | String assetref = null; 17 | Double qty = null; 18 | String type = null; 19 | 20 | /* 21 | * (non-Javadoc) 22 | * 23 | * @see java.lang.Object#toString() 24 | */ 25 | @Override 26 | public String toString() { 27 | return "BalanceWalletTransaction [name=" + name + ", assetref=" + assetref + ", qty=" + qty 28 | + "]"; 29 | } 30 | 31 | /** 32 | * @return the name 33 | */ 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | /** 39 | * @param name the name to set 40 | */ 41 | public void setName(String name) { 42 | this.name = name; 43 | } 44 | 45 | /** 46 | * @return the assetref 47 | */ 48 | public String getAssetref() { 49 | return assetref; 50 | } 51 | 52 | /** 53 | * @param assetref the assetref to set 54 | */ 55 | public void setAssetref(String assetref) { 56 | this.assetref = assetref; 57 | } 58 | 59 | /** 60 | * @return the qty 61 | */ 62 | public double getQty() { 63 | return qty; 64 | } 65 | 66 | /** 67 | * @param qty the qty to set 68 | */ 69 | public void setQty(double qty) { 70 | this.qty = qty; 71 | } 72 | 73 | /** 74 | * @return the type 75 | */ 76 | public String getType() { 77 | return type; 78 | } 79 | 80 | /** 81 | * @param type the type to set 82 | */ 83 | public void setType(String type) { 84 | this.type = type; 85 | } 86 | 87 | /** 88 | * @param qty the qty to set 89 | */ 90 | public void setQty(Double qty) { 91 | this.qty = qty; 92 | } 93 | 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/DataParamIssueMore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | import java.util.HashMap; 11 | import java.util.Map; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | public class DataParamIssueMore implements DataParam { 18 | // "update" : asset-identifier (string,required) Asset identifier - one of the following: asset 19 | // txid, asset reference, asset name. 20 | // "details" : (object, optional) a json object with custom fields 21 | // { 22 | // "param-name": "param-value" (strings, required) The key is the parameter name, the value is 23 | // parameter value 24 | // ,... 25 | // } 26 | 27 | private String update = null; 28 | private Map details = null; 29 | 30 | @Override 31 | public DataParamIssueMore getFormatedvalue() { 32 | return this; 33 | } 34 | 35 | /** 36 | * 37 | */ 38 | public DataParamIssueMore() { 39 | super(); 40 | // TODO Auto-generated constructor stub 41 | } 42 | 43 | /** 44 | * @param update 45 | * @param details 46 | */ 47 | public DataParamIssueMore(String update, Map details) { 48 | this.update = update; 49 | this.details = details; 50 | } 51 | 52 | /** 53 | * @return the update 54 | */ 55 | public String getUpdate() { 56 | return update; 57 | } 58 | 59 | /** 60 | * @param update the update to set 61 | */ 62 | public void setUpdate(String update) { 63 | this.update = update; 64 | } 65 | 66 | /** 67 | * @return the details 68 | */ 69 | public Map getDetails() { 70 | return details; 71 | } 72 | 73 | /** 74 | * @param details the details to set 75 | */ 76 | public void addDetails(CustomParamString detail) { 77 | if (details == null) { 78 | details = new HashMap<>(); 79 | } 80 | details.put(detail.getName(), detail.getValue()); 81 | } 82 | 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/ScriptPubKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | public class ScriptPubKey { 18 | String asm = null; 19 | String hex = null; 20 | Long reqSigs = null; 21 | String type = null; 22 | List addresses; 23 | 24 | /** 25 | * 26 | */ 27 | public ScriptPubKey() { 28 | super(); 29 | addresses = new ArrayList(); 30 | } 31 | 32 | /** 33 | * @return the asm 34 | */ 35 | public String getAsm() { 36 | return asm; 37 | } 38 | 39 | /** 40 | * @param asm the asm to set 41 | */ 42 | public void setAsm(String asm) { 43 | this.asm = asm; 44 | } 45 | 46 | /** 47 | * @return the hex 48 | */ 49 | public String getHex() { 50 | return hex; 51 | } 52 | 53 | /** 54 | * @param hex the hex to set 55 | */ 56 | public void setHex(String hex) { 57 | this.hex = hex; 58 | } 59 | 60 | /** 61 | * @return the reqSigs 62 | */ 63 | public long getReqSigs() { 64 | return reqSigs; 65 | } 66 | 67 | /** 68 | * @param reqSigs the reqSigs to set 69 | */ 70 | public void setReqSigs(long reqSigs) { 71 | this.reqSigs = reqSigs; 72 | } 73 | 74 | /** 75 | * @return the type 76 | */ 77 | public String getType() { 78 | return type; 79 | } 80 | 81 | /** 82 | * @param type the type to set 83 | */ 84 | public void setType(String type) { 85 | this.type = type; 86 | } 87 | 88 | /** 89 | * @return the addresses 90 | */ 91 | public List getAddresses() { 92 | return addresses; 93 | } 94 | 95 | /** 96 | * @param addresses the addresses to set 97 | */ 98 | public void setAddresses(List addresses) { 99 | this.addresses = addresses; 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/TransactionRAWVin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class TransactionRAWVin { 15 | String txid = null; 16 | Long vout = null; 17 | ScriptSig scriptSig = null; 18 | String coinbase = null; 19 | Long sequence = null; 20 | 21 | /** 22 | * 23 | */ 24 | public TransactionRAWVin() { 25 | super(); 26 | scriptSig = new ScriptSig(); 27 | } 28 | 29 | /** 30 | * @return the txid 31 | */ 32 | public String getTxid() { 33 | return txid; 34 | } 35 | 36 | /** 37 | * @param txid the txid to set 38 | */ 39 | public void setTxid(String txid) { 40 | this.txid = txid; 41 | } 42 | 43 | /** 44 | * @return the vout 45 | */ 46 | public long getVout() { 47 | return vout; 48 | } 49 | 50 | /** 51 | * @param vout the vout to set 52 | */ 53 | public void setVout(long vout) { 54 | this.vout = vout; 55 | } 56 | 57 | /** 58 | * @return the scriptSig 59 | */ 60 | public ScriptSig getScriptSig() { 61 | return scriptSig; 62 | } 63 | 64 | /** 65 | * @param scriptSig the scriptSig to set 66 | */ 67 | public void setScriptSig(ScriptSig scriptSig) { 68 | this.scriptSig = scriptSig; 69 | } 70 | 71 | /** 72 | * @return the sequence 73 | */ 74 | public long getSequence() { 75 | return sequence; 76 | } 77 | 78 | /** 79 | * @param sequence the sequence to set 80 | */ 81 | public void setSequence(long sequence) { 82 | this.sequence = sequence; 83 | } 84 | 85 | /** 86 | * @return the coinbase 87 | */ 88 | public String getCoinbase() { 89 | return coinbase; 90 | } 91 | 92 | /** 93 | * @param coinbase the coinbase to set 94 | */ 95 | public void setCoinbase(String coinbase) { 96 | this.coinbase = coinbase; 97 | } 98 | 99 | 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/NetworkInfoNetwork.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 5 | * 6 | */ 7 | package multichain.object; 8 | 9 | /** 10 | * @author Ub - H. MARTEAU 11 | * @version 2.0.1 12 | */ 13 | public class NetworkInfoNetwork { 14 | 15 | String name = null; 16 | Boolean limited = null; 17 | Boolean reachable = null; 18 | String proxy = null; 19 | 20 | /** 21 | * @return the name 22 | */ 23 | public String getName() { 24 | 25 | return name; 26 | } 27 | 28 | /** 29 | * @param name 30 | * the name to set 31 | */ 32 | public void setName(final String name) { 33 | 34 | this.name = name; 35 | } 36 | 37 | /** 38 | * @return the limited 39 | */ 40 | public Boolean getLimited() { 41 | 42 | return limited; 43 | } 44 | 45 | /** 46 | * @param limited 47 | * the limited to set 48 | */ 49 | public void setLimited(final Boolean limited) { 50 | 51 | this.limited = limited; 52 | } 53 | 54 | /** 55 | * @return the reachable 56 | */ 57 | public Boolean getReachable() { 58 | 59 | return reachable; 60 | } 61 | 62 | /** 63 | * @param reachable 64 | * the reachable to set 65 | */ 66 | public void setReachable(final Boolean reachable) { 67 | 68 | this.reachable = reachable; 69 | } 70 | 71 | /** 72 | * @return the proxy 73 | */ 74 | public String getProxy() { 75 | 76 | return proxy; 77 | } 78 | 79 | /** 80 | * @param proxy 81 | * the proxy to set 82 | */ 83 | public void setProxy(final String proxy) { 84 | 85 | this.proxy = proxy; 86 | } 87 | 88 | /* 89 | * (non-Javadoc) 90 | * 91 | * @see java.lang.Object#toString() 92 | */ 93 | @Override 94 | public String toString() { 95 | 96 | return String.format("NetworkInfoNetwork [name=%s, limited=%s, reachable=%s, proxy=%s]", name, limited, reachable, proxy); 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/AddressReceived.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class AddressReceived { 15 | Boolean involvesWatchonly = null; 16 | String address = null; 17 | String account = null; 18 | Double amount = null; 19 | Long confirmations = null; 20 | 21 | /** 22 | * @return the involvesWatchonly 23 | */ 24 | public Boolean getInvolvesWatchonly() { 25 | return involvesWatchonly; 26 | } 27 | 28 | /** 29 | * @param involvesWatchonly the involvesWatchonly to set 30 | */ 31 | public void setInvolvesWatchonly(Boolean involvesWatchonly) { 32 | this.involvesWatchonly = involvesWatchonly; 33 | } 34 | 35 | /** 36 | * @return the address 37 | */ 38 | public String getAddress() { 39 | return address; 40 | } 41 | 42 | /** 43 | * @param address the address to set 44 | */ 45 | public void setAddress(String address) { 46 | this.address = address; 47 | } 48 | 49 | /** 50 | * @return the account 51 | */ 52 | public String getAccount() { 53 | return account; 54 | } 55 | 56 | /** 57 | * @param account the account to set 58 | */ 59 | public void setAccount(String account) { 60 | this.account = account; 61 | } 62 | 63 | /** 64 | * @return the amount 65 | */ 66 | public Double getAmount() { 67 | return amount; 68 | } 69 | 70 | /** 71 | * @param amount the amount to set 72 | */ 73 | public void setAmount(Double amount) { 74 | this.amount = amount; 75 | } 76 | 77 | /** 78 | * @return the confirmations 79 | */ 80 | public Long getConfirmations() { 81 | return confirmations; 82 | } 83 | 84 | /** 85 | * @param confirmations the confirmations to set 86 | */ 87 | public void setConfirmations(Long confirmations) { 88 | this.confirmations = confirmations; 89 | } 90 | 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/multichain/command/MultichainException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.command; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 4.13 13 | */ 14 | public class MultichainException extends Exception { 15 | 16 | private String object; 17 | private String reason; 18 | 19 | /** 20 | * Serial 21 | */ 22 | private static final long serialVersionUID = 2412952380749244614L; 23 | 24 | public MultichainException(String excep_object, String excep_reason) { 25 | object = excep_object; 26 | reason = excep_reason; 27 | } 28 | 29 | 30 | 31 | /* 32 | * (non-Javadoc) 33 | * 34 | * @see java.lang.Object#toString() 35 | */ 36 | @Override 37 | public String toString() { 38 | return "MultichainException [\r\n" + " object=" + object + ",\r\n" 39 | + " reason=" + reason + ",\r\n" + " message=" + super.getMessage() 40 | + ",\r\n" + " cause=" + getCause() + "\r\n]"; 41 | } 42 | 43 | public String toShortString() { 44 | return "MultichainException [\r\n" + " object=" + object + ",\r\n" 45 | + " reason=" + reason + "\r\n]"; 46 | } 47 | 48 | /** 49 | * @return the object 50 | */ 51 | public String getObject() { 52 | return object; 53 | } 54 | 55 | /** 56 | * @param object 57 | * the object to set 58 | */ 59 | public void setObject(String object) { 60 | this.object = object; 61 | } 62 | 63 | /** 64 | * @return the reason 65 | */ 66 | public String getReason() { 67 | return reason; 68 | } 69 | 70 | /** 71 | * @param reason 72 | * the reason to set 73 | */ 74 | public void setReason(String reason) { 75 | this.reason = reason; 76 | } 77 | 78 | 79 | 80 | /* (non-Javadoc) 81 | * @see java.lang.Throwable#getMessage() 82 | */ 83 | @Override 84 | public String getMessage() { 85 | return toString(); 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/multichain/command/CommandManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.command; 9 | 10 | import multichain.object.formatters.GenericOutputFormatter; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public class CommandManager extends QueryBuilderCommon { 17 | 18 | public CommandManager(String ip, String port, String login, String password) { 19 | initialize(ip, port, login, password, null); 20 | } 21 | 22 | public CommandManager(String ip, String port, String login, String password, 23 | RuntimeParameters runtimeparameters) { 24 | initialize(ip, port, login, password, runtimeparameters); 25 | } 26 | 27 | 28 | public Object invoke(CommandElt command, Object... parameters) throws MultichainException { 29 | // Command Management 30 | Object commandValue = execute(command, parameters); 31 | 32 | // Ouput Management 33 | Class[] returnedTypes = command.getReturnedClass(); 34 | if (returnedTypes != null && returnedTypes.length > 0) { 35 | try { 36 | if (command.isResultByList()) { 37 | return GenericOutputFormatter.formatList(commandValue, returnedTypes); 38 | } else { 39 | return GenericOutputFormatter.format(commandValue, returnedTypes); 40 | } 41 | } catch (Exception e) { 42 | // TODO log exception 43 | return commandValue; 44 | } 45 | } else { 46 | return commandValue; 47 | } 48 | } 49 | 50 | public Object invokeWithControl(CommandElt command, Object... parameters) 51 | throws MultichainException { 52 | 53 | // Input Management 54 | @SuppressWarnings("unused") 55 | Object commandParameters = command.getCommandParameters(); 56 | boolean controlValue = true; // Will be done in 6.02 57 | 58 | if (controlValue) { 59 | return invoke(command, parameters); 60 | } else { 61 | throw new MultichainException("Arguments Problem", "Arguments aren't validate by control !"); 62 | 63 | } 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/TransactionDetail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class TransactionDetail { 15 | String account = null; 16 | String address = null; 17 | String category = null; 18 | Double amount = null; 19 | Long vout = null; 20 | Double fee = null; 21 | 22 | /** 23 | * @return the account 24 | */ 25 | public String getAccount() { 26 | return account; 27 | } 28 | 29 | /** 30 | * @param account the account to set 31 | */ 32 | public void setAccount(String account) { 33 | this.account = account; 34 | } 35 | 36 | /** 37 | * @return the address 38 | */ 39 | public String getAddress() { 40 | return address; 41 | } 42 | 43 | /** 44 | * @param address the address to set 45 | */ 46 | public void setAddress(String address) { 47 | this.address = address; 48 | } 49 | 50 | /** 51 | * @return the category 52 | */ 53 | public String getCategory() { 54 | return category; 55 | } 56 | 57 | /** 58 | * @param category the category to set 59 | */ 60 | public void setCategory(String category) { 61 | this.category = category; 62 | } 63 | 64 | /** 65 | * @return the amount 66 | */ 67 | public double getAmount() { 68 | return amount; 69 | } 70 | 71 | /** 72 | * @param amount the amount to set 73 | */ 74 | public void setAmount(double amount) { 75 | this.amount = amount; 76 | } 77 | 78 | /** 79 | * @return the vout 80 | */ 81 | public long getVout() { 82 | return vout; 83 | } 84 | 85 | /** 86 | * @param vout the vout to set 87 | */ 88 | public void setVout(long vout) { 89 | this.vout = vout; 90 | } 91 | 92 | /** 93 | * @return the fee 94 | */ 95 | public double getFee() { 96 | return fee; 97 | } 98 | 99 | /** 100 | * @param fee the fee to set 101 | */ 102 | public void setFee(double fee) { 103 | this.fee = fee; 104 | } 105 | 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/formatters/GenericOutputFormatter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.formatters; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | import com.google.gson.Gson; 13 | import com.google.gson.GsonBuilder; 14 | import com.google.gson.internal.LinkedTreeMap; 15 | 16 | /** 17 | * @author Ub - H. MARTEAU 18 | * @version 2.0.1 19 | */ 20 | public class GenericOutputFormatter { 21 | /** 22 | * 23 | */ 24 | private GenericOutputFormatter() { 25 | super(); 26 | } 27 | 28 | 29 | public static final Object format(Object jsonValue, Class[] valueTypes) { 30 | int indexType = 0; 31 | boolean formatted = false; 32 | Object returnedValue = null; 33 | 34 | while (indexType < valueTypes.length && !formatted) { 35 | try { 36 | returnedValue = format(jsonValue, valueTypes[indexType]); 37 | formatted = true; 38 | } catch (Exception e) { 39 | indexType++; 40 | formatted = false; 41 | } 42 | 43 | } 44 | return returnedValue; 45 | } 46 | 47 | 48 | public static final T format(Object jsonValue, Class valueType) { 49 | T returnedValue = null; 50 | 51 | if (jsonValue != null 52 | && (LinkedTreeMap.class.isInstance(jsonValue) || valueType.isInstance(jsonValue))) { 53 | GsonBuilder builder = new GsonBuilder(); 54 | Gson gson = builder.create(); 55 | 56 | String nomalizedJsonValue = gson.toJson(jsonValue); 57 | returnedValue = gson.fromJson(nomalizedJsonValue, valueType); 58 | } 59 | 60 | return returnedValue; 61 | } 62 | 63 | @SuppressWarnings("unchecked") 64 | public static final List formatList(Object jsonValues, Class[] valueTypes) { 65 | List returnedValue = new ArrayList<>(); 66 | 67 | if (jsonValues != null && ArrayList.class.isInstance(jsonValues)) { 68 | for (Object jsonValue : (ArrayList) jsonValues) { 69 | returnedValue.add((T) format(jsonValue, valueTypes)); 70 | } 71 | } 72 | 73 | return returnedValue; 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/Script.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public class Script { 17 | String asm = null; 18 | String hex = null; 19 | String type = null; 20 | Long reqSigs = null; 21 | List addresses = null; 22 | String p2sh = null; 23 | 24 | /** 25 | * @return the asm 26 | */ 27 | public String getAsm() { 28 | return asm; 29 | } 30 | 31 | /** 32 | * @param asm the asm to set 33 | */ 34 | public void setAsm(String asm) { 35 | this.asm = asm; 36 | } 37 | 38 | /** 39 | * @return the hex 40 | */ 41 | public String getHex() { 42 | return hex; 43 | } 44 | 45 | /** 46 | * @param hex the hex to set 47 | */ 48 | public void setHex(String hex) { 49 | this.hex = hex; 50 | } 51 | 52 | /** 53 | * @return the type 54 | */ 55 | public String getType() { 56 | return type; 57 | } 58 | 59 | /** 60 | * @param type the type to set 61 | */ 62 | public void setType(String type) { 63 | this.type = type; 64 | } 65 | 66 | /** 67 | * @return the reqSigs 68 | */ 69 | public Long getReqSigs() { 70 | return reqSigs; 71 | } 72 | 73 | /** 74 | * @param reqSigs the reqSigs to set 75 | */ 76 | public void setReqSigs(Long reqSigs) { 77 | this.reqSigs = reqSigs; 78 | } 79 | 80 | /** 81 | * @return the addresses 82 | */ 83 | public List getAddresses() { 84 | return addresses; 85 | } 86 | 87 | /** 88 | * @param addresses the addresses to set 89 | */ 90 | public void setAddresses(List addresses) { 91 | this.addresses = addresses; 92 | } 93 | 94 | /** 95 | * @return the p2sh 96 | */ 97 | public String getP2sh() { 98 | return p2sh; 99 | } 100 | 101 | /** 102 | * @param p2sh the p2sh to set 103 | */ 104 | public void setP2sh(String p2sh) { 105 | this.p2sh = p2sh; 106 | } 107 | 108 | 109 | } 110 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/DataParamStreamItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | import java.util.HashMap; 11 | import java.util.Map; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | public class DataParamStreamItem implements DataParam { 18 | // "for" : stream-identifier (string,required) Stream identifier - one of the following: stream 19 | // txid, stream reference, stream name. 20 | // "key" : key (string,optional, default: "") Item key 21 | // "data" : data-hex (string,optional, default: "") Data hex string 22 | 23 | private String for_; 24 | private String key; 25 | private String data; 26 | 27 | 28 | @Override 29 | public Map getFormatedvalue() { 30 | Map value = new HashMap<>(); 31 | 32 | value.put("for", for_); 33 | value.put("key", key); 34 | value.put("data", data); 35 | 36 | return value; 37 | } 38 | 39 | /** 40 | * 41 | */ 42 | public DataParamStreamItem() { 43 | super(); 44 | // TODO Auto-generated constructor stub 45 | } 46 | 47 | /** 48 | * @param for_ 49 | * @param key 50 | * @param data 51 | */ 52 | public DataParamStreamItem(String for_, String key, String data) { 53 | this.for_ = for_; 54 | this.key = key; 55 | this.data = data; 56 | } 57 | 58 | /** 59 | * @return the for_ 60 | */ 61 | public String getFor() { 62 | return for_; 63 | } 64 | 65 | /** 66 | * @param for_ the for_ to set 67 | */ 68 | public void setFor(String for_) { 69 | this.for_ = for_; 70 | } 71 | 72 | /** 73 | * @return the key 74 | */ 75 | public String getKey() { 76 | return key; 77 | } 78 | 79 | /** 80 | * @param key the key to set 81 | */ 82 | public void setKey(String key) { 83 | this.key = key; 84 | } 85 | 86 | /** 87 | * @return the data 88 | */ 89 | public String getData() { 90 | return data; 91 | } 92 | 93 | /** 94 | * @param data the data to set 95 | */ 96 | public void setData(String data) { 97 | this.data = data; 98 | } 99 | 100 | 101 | 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/BlockTemplateTransation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public class BlockTemplateTransation { 17 | String data = null; 18 | String hash = null; 19 | List depends = null; 20 | Long fee = null; 21 | Long sigops = null; 22 | Boolean required = null; 23 | 24 | /** 25 | * @return the data 26 | */ 27 | public String getData() { 28 | return data; 29 | } 30 | 31 | /** 32 | * @param data the data to set 33 | */ 34 | public void setData(String data) { 35 | this.data = data; 36 | } 37 | 38 | /** 39 | * @return the hash 40 | */ 41 | public String getHash() { 42 | return hash; 43 | } 44 | 45 | /** 46 | * @param hash the hash to set 47 | */ 48 | public void setHash(String hash) { 49 | this.hash = hash; 50 | } 51 | 52 | /** 53 | * @return the depends 54 | */ 55 | public List getDepends() { 56 | return depends; 57 | } 58 | 59 | /** 60 | * @param depends the depends to set 61 | */ 62 | public void setDepends(List depends) { 63 | this.depends = depends; 64 | } 65 | 66 | /** 67 | * @return the fee 68 | */ 69 | public Long getFee() { 70 | return fee; 71 | } 72 | 73 | /** 74 | * @param fee the fee to set 75 | */ 76 | public void setFee(Long fee) { 77 | this.fee = fee; 78 | } 79 | 80 | /** 81 | * @return the sigops 82 | */ 83 | public Long getSigops() { 84 | return sigops; 85 | } 86 | 87 | /** 88 | * @param sigops the sigops to set 89 | */ 90 | public void setSigops(Long sigops) { 91 | this.sigops = sigops; 92 | } 93 | 94 | /** 95 | * @return the required 96 | */ 97 | public Boolean getRequired() { 98 | return required; 99 | } 100 | 101 | /** 102 | * @param required the required to set 103 | */ 104 | public void setRequired(Boolean required) { 105 | this.required = required; 106 | } 107 | 108 | 109 | } 110 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/TransactionGeneral.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | abstract class TransactionGeneral extends TransactionBase { 18 | Double amount = null; 19 | Double fee = null; 20 | List walletconflicts; 21 | 22 | /** 23 | * 24 | */ 25 | public TransactionGeneral() { 26 | super(); 27 | walletconflicts = new ArrayList(); 28 | } 29 | 30 | /** 31 | * 32 | */ 33 | public TransactionGeneral(TransactionBase transactionBase) { 34 | super(transactionBase); 35 | walletconflicts = new ArrayList(); 36 | } 37 | 38 | /** 39 | * @param amount 40 | * @param fee 41 | * @param walletconflicts 42 | */ 43 | public TransactionGeneral(TransactionGeneral transactionGeneral) { 44 | super(transactionGeneral); 45 | this.amount = transactionGeneral.getAmount(); 46 | this.fee = transactionGeneral.getFee(); 47 | this.walletconflicts = transactionGeneral.getWalletconflicts(); 48 | } 49 | 50 | /** 51 | * @return the amount 52 | */ 53 | public double getAmount() { 54 | return amount; 55 | } 56 | 57 | /** 58 | * @param amount the amount to set 59 | */ 60 | public void setAmount(double amount) { 61 | this.amount = amount; 62 | } 63 | 64 | /** 65 | * @return the fee 66 | */ 67 | public double getFee() { 68 | return fee; 69 | } 70 | 71 | /** 72 | * @param fee the fee to set 73 | */ 74 | public void setFee(double fee) { 75 | this.fee = fee; 76 | } 77 | 78 | /** 79 | * @return the walletconflicts 80 | */ 81 | public List getWalletconflicts() { 82 | return walletconflicts; 83 | } 84 | 85 | /** 86 | * @param walletconflicts the walletconflicts to set 87 | */ 88 | public void setWalletconflicts(List walletconflicts) { 89 | this.walletconflicts = walletconflicts; 90 | } 91 | 92 | /** 93 | * @param walletconflict the walletconflict to add to walletconflicts 94 | */ 95 | public void addWalletconflicts(String walletconflict) { 96 | this.walletconflicts.add(walletconflict); 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/AssetWalletTransaction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public class AssetWalletTransaction extends BalanceAssetWalletTransaction { 17 | Long multiple = null; 18 | Double units = null; 19 | Boolean open = null; 20 | 21 | Object details; 22 | Long raw = null; 23 | List addresses; 24 | 25 | 26 | /** 27 | * @return the details 28 | */ 29 | public Object getDetails() { 30 | return details; 31 | } 32 | 33 | /** 34 | * @param details the details to set 35 | */ 36 | public void setDetails(Object details) { 37 | this.details = details; 38 | } 39 | 40 | /** 41 | * @return the raw 42 | */ 43 | public long getRaw() { 44 | return raw; 45 | } 46 | 47 | /** 48 | * @param raw the raw to set 49 | */ 50 | public void setRaw(long raw) { 51 | this.raw = raw; 52 | } 53 | 54 | /** 55 | * @return the addresses 56 | */ 57 | public List getAddresses() { 58 | return addresses; 59 | } 60 | 61 | /** 62 | * @param addresses the addresses to set 63 | */ 64 | public void setAddresses(List addresses) { 65 | this.addresses = addresses; 66 | } 67 | 68 | /** 69 | * @return the multiple 70 | */ 71 | public long getMultiple() { 72 | return multiple; 73 | } 74 | 75 | /** 76 | * @param multiple the multiple to set 77 | */ 78 | public void setMultiple(long multiple) { 79 | this.multiple = multiple; 80 | } 81 | 82 | /** 83 | * @return the units 84 | */ 85 | public double getUnits() { 86 | return units; 87 | } 88 | 89 | /** 90 | * @param units the units to set 91 | */ 92 | public void setUnits(double units) { 93 | this.units = units; 94 | } 95 | 96 | /** 97 | * @return the open 98 | */ 99 | public boolean isOpen() { 100 | return open; 101 | } 102 | 103 | /** 104 | * @param open the open to set 105 | */ 106 | public void setOpen(boolean open) { 107 | this.open = open; 108 | } 109 | 110 | 111 | 112 | } 113 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/StreamKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class StreamKey { 15 | String key = null; 16 | Long items = null; 17 | Long confirmed = null; 18 | StreamKeyInfo first = null; 19 | StreamKeyInfo last = null; 20 | 21 | /* 22 | * (non-Javadoc) 23 | * 24 | * @see java.lang.Object#toString() 25 | */ 26 | @Override 27 | public String toString() { 28 | String value = "StreamKey [key=" + key + ", items=" + items + ", confirmed=" + confirmed; 29 | if (first != null) { 30 | value += ", first=" + first.toString(); 31 | } 32 | if (last != null) { 33 | value += ", last=" + last.toString(); 34 | } 35 | value += "]"; 36 | 37 | return value; 38 | } 39 | 40 | /** 41 | * @return the key 42 | */ 43 | public String getKey() { 44 | return key; 45 | } 46 | 47 | /** 48 | * @param key the key to set 49 | */ 50 | public void setKey(String key) { 51 | this.key = key; 52 | } 53 | 54 | /** 55 | * @return the items 56 | */ 57 | public long getItems() { 58 | return items; 59 | } 60 | 61 | /** 62 | * @param items the items to set 63 | */ 64 | public void setItems(long items) { 65 | this.items = items; 66 | } 67 | 68 | /** 69 | * @return the confirmed 70 | */ 71 | public long getConfirmed() { 72 | return confirmed; 73 | } 74 | 75 | /** 76 | * @param confirmed the confirmed to set 77 | */ 78 | public void setConfirmed(long confirmed) { 79 | this.confirmed = confirmed; 80 | } 81 | 82 | /** 83 | * @return the first 84 | */ 85 | public StreamKeyInfo getFirst() { 86 | return first; 87 | } 88 | 89 | /** 90 | * @param first the first to set 91 | */ 92 | public void setFirst(StreamKeyInfo first) { 93 | this.first = first; 94 | } 95 | 96 | /** 97 | * @return the last 98 | */ 99 | public StreamKeyInfo getLast() { 100 | return last; 101 | } 102 | 103 | /** 104 | * @param last the last to set 105 | */ 106 | public void setLast(StreamKeyInfo last) { 107 | this.last = last; 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/Unspent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class Unspent { 15 | String txid = null; 16 | Long vout = null; 17 | String address = null; 18 | String account = null; 19 | String scriptPubKey = null; 20 | Double amount = null; 21 | Long confirmations = null; 22 | 23 | /** 24 | * @return the txid 25 | */ 26 | public String getTxid() { 27 | return txid; 28 | } 29 | 30 | /** 31 | * @param txid the txid to set 32 | */ 33 | public void setTxid(String txid) { 34 | this.txid = txid; 35 | } 36 | 37 | /** 38 | * @return the vout 39 | */ 40 | public Long getVout() { 41 | return vout; 42 | } 43 | 44 | /** 45 | * @param vout the vout to set 46 | */ 47 | public void setVout(Long vout) { 48 | this.vout = vout; 49 | } 50 | 51 | /** 52 | * @return the address 53 | */ 54 | public String getAddress() { 55 | return address; 56 | } 57 | 58 | /** 59 | * @param address the address to set 60 | */ 61 | public void setAddress(String address) { 62 | this.address = address; 63 | } 64 | 65 | /** 66 | * @return the account 67 | */ 68 | public String getAccount() { 69 | return account; 70 | } 71 | 72 | /** 73 | * @param account the account to set 74 | */ 75 | public void setAccount(String account) { 76 | this.account = account; 77 | } 78 | 79 | /** 80 | * @return the scriptPubKey 81 | */ 82 | public String getScriptPubKey() { 83 | return scriptPubKey; 84 | } 85 | 86 | /** 87 | * @param scriptPubKey the scriptPubKey to set 88 | */ 89 | public void setScriptPubKey(String scriptPubKey) { 90 | this.scriptPubKey = scriptPubKey; 91 | } 92 | 93 | /** 94 | * @return the amount 95 | */ 96 | public Double getAmount() { 97 | return amount; 98 | } 99 | 100 | /** 101 | * @param amount the amount to set 102 | */ 103 | public void setAmount(Double amount) { 104 | this.amount = amount; 105 | } 106 | 107 | /** 108 | * @return the confirmations 109 | */ 110 | public Long getConfirmations() { 111 | return confirmations; 112 | } 113 | 114 | /** 115 | * @param confirmations the confirmations to set 116 | */ 117 | public void setConfirmations(Long confirmations) { 118 | this.confirmations = confirmations; 119 | } 120 | 121 | 122 | } 123 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/RawMemPoolTransaction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public class RawMemPoolTransaction { 17 | Long size = null; 18 | Double fee = null; 19 | Long time = null; 20 | Long height = null; 21 | Long startingpriority = null; 22 | Long currentpriority = null; 23 | List depends = null; 24 | 25 | /** 26 | * @return the size 27 | */ 28 | public Long getSize() { 29 | return size; 30 | } 31 | 32 | /** 33 | * @param size the size to set 34 | */ 35 | public void setSize(Long size) { 36 | this.size = size; 37 | } 38 | 39 | /** 40 | * @return the fee 41 | */ 42 | public Double getFee() { 43 | return fee; 44 | } 45 | 46 | /** 47 | * @param fee the fee to set 48 | */ 49 | public void setFee(Double fee) { 50 | this.fee = fee; 51 | } 52 | 53 | /** 54 | * @return the time 55 | */ 56 | public Long getTime() { 57 | return time; 58 | } 59 | 60 | /** 61 | * @param time the time to set 62 | */ 63 | public void setTime(Long time) { 64 | this.time = time; 65 | } 66 | 67 | /** 68 | * @return the height 69 | */ 70 | public Long getHeight() { 71 | return height; 72 | } 73 | 74 | /** 75 | * @param height the height to set 76 | */ 77 | public void setHeight(Long height) { 78 | this.height = height; 79 | } 80 | 81 | /** 82 | * @return the startingpriority 83 | */ 84 | public Long getStartingpriority() { 85 | return startingpriority; 86 | } 87 | 88 | /** 89 | * @param startingpriority the startingpriority to set 90 | */ 91 | public void setStartingpriority(Long startingpriority) { 92 | this.startingpriority = startingpriority; 93 | } 94 | 95 | /** 96 | * @return the currentpriority 97 | */ 98 | public Long getCurrentpriority() { 99 | return currentpriority; 100 | } 101 | 102 | /** 103 | * @param currentpriority the currentpriority to set 104 | */ 105 | public void setCurrentpriority(Long currentpriority) { 106 | this.currentpriority = currentpriority; 107 | } 108 | 109 | /** 110 | * @return the depends 111 | */ 112 | public List getDepends() { 113 | return depends; 114 | } 115 | 116 | /** 117 | * @param depends the depends to set 118 | */ 119 | public void setDepends(List depends) { 120 | this.depends = depends; 121 | } 122 | 123 | 124 | } 125 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/ChunkqueueTotalElt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class ChunkqueueTotalElt { 15 | Long queries = null; 16 | Long responded = null; 17 | Long unresponded = null; 18 | Long requests = null; 19 | Long delivered = null; 20 | Long undelivered = null; 21 | Long baddelivered = null; 22 | 23 | /** 24 | * @return the queries 25 | */ 26 | public Long getQueries() { 27 | return queries; 28 | } 29 | 30 | /** 31 | * @param queries the queries to set 32 | */ 33 | public void setQueries(Long queries) { 34 | this.queries = queries; 35 | } 36 | 37 | /** 38 | * @return the responded 39 | */ 40 | public Long getResponded() { 41 | return responded; 42 | } 43 | 44 | /** 45 | * @param responded the responded to set 46 | */ 47 | public void setResponded(Long responded) { 48 | this.responded = responded; 49 | } 50 | 51 | /** 52 | * @return the unresponded 53 | */ 54 | public Long getUnresponded() { 55 | return unresponded; 56 | } 57 | 58 | /** 59 | * @param unresponded the unresponded to set 60 | */ 61 | public void setUnresponded(Long unresponded) { 62 | this.unresponded = unresponded; 63 | } 64 | 65 | /** 66 | * @return the requests 67 | */ 68 | public Long getRequests() { 69 | return requests; 70 | } 71 | 72 | /** 73 | * @param requests the requests to set 74 | */ 75 | public void setRequests(Long requests) { 76 | this.requests = requests; 77 | } 78 | 79 | /** 80 | * @return the delivered 81 | */ 82 | public Long getDelivered() { 83 | return delivered; 84 | } 85 | 86 | /** 87 | * @param delivered the delivered to set 88 | */ 89 | public void setDelivered(Long delivered) { 90 | this.delivered = delivered; 91 | } 92 | 93 | /** 94 | * @return the undelivered 95 | */ 96 | public Long getUndelivered() { 97 | return undelivered; 98 | } 99 | 100 | /** 101 | * @param undelivered the undelivered to set 102 | */ 103 | public void setUndelivered(Long undelivered) { 104 | this.undelivered = undelivered; 105 | } 106 | 107 | /** 108 | * @return the baddelivered 109 | */ 110 | public Long getBaddelivered() { 111 | return baddelivered; 112 | } 113 | 114 | /** 115 | * @param baddelivered the baddelivered to set 116 | */ 117 | public void setBaddelivered(Long baddelivered) { 118 | this.baddelivered = baddelivered; 119 | } 120 | 121 | 122 | } 123 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/DataParamCreate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | import java.util.HashMap; 11 | import java.util.Map; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | public class DataParamCreate implements DataParam { 18 | // "create" : stream (string,required) stream 19 | // "name" : stream-name (string,optional) Stream name 20 | // "open" : true|false (string,optional, default: false) If true, anyone can publish 21 | // "details" : (object,optional) a json object with custom fields 22 | // { 23 | // "param-name": "param-value" (strings, required) The key is the parameter name, the value is 24 | // parameter value 25 | // ,... 26 | // } 27 | 28 | private String create = "stream"; 29 | private String name = null; 30 | private Boolean open = null; 31 | private Map details = null; 32 | 33 | @Override 34 | public DataParamCreate getFormatedvalue() { 35 | return this; 36 | } 37 | 38 | /** 39 | * 40 | */ 41 | public DataParamCreate() { 42 | super(); 43 | // TODO Auto-generated constructor stub 44 | } 45 | 46 | /** 47 | * @param create 48 | * @param name 49 | * @param open 50 | * @param details 51 | */ 52 | public DataParamCreate(String create, String name, Boolean open, Map details) { 53 | this.create = create; 54 | this.name = name; 55 | this.open = open; 56 | this.details = details; 57 | } 58 | 59 | /** 60 | * @return the create 61 | */ 62 | public String getCreate() { 63 | return create; 64 | } 65 | 66 | /** 67 | * @return the name 68 | */ 69 | public String getName() { 70 | return name; 71 | } 72 | 73 | /** 74 | * @param name the name to set 75 | */ 76 | public void setName(String name) { 77 | this.name = name; 78 | } 79 | 80 | /** 81 | * @return the open 82 | */ 83 | public Boolean getOpen() { 84 | return open; 85 | } 86 | 87 | /** 88 | * @param open the open to set 89 | */ 90 | public void setOpen(Boolean open) { 91 | this.open = open; 92 | } 93 | 94 | /** 95 | * @return the details 96 | */ 97 | public Map getDetails() { 98 | return details; 99 | } 100 | 101 | /** 102 | * @param details the details to set 103 | */ 104 | public void setDetails(Map details) { 105 | this.details = details; 106 | } 107 | 108 | /** 109 | * @param details the details to set 110 | */ 111 | public void addDetails(CustomParamString detail) { 112 | if (details == null) { 113 | details = new HashMap<>(); 114 | } 115 | details.put(detail.getName(), detail.getValue()); 116 | } 117 | 118 | 119 | 120 | } 121 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/TxOutInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class TxOutInfo { 15 | Long height = null; 16 | String bestblock = null; 17 | Long transactions = null; 18 | Long txouts = null; 19 | Long bytes_serialized = null; 20 | String hash_serialized = null; 21 | Double total_amount = null; 22 | 23 | /** 24 | * @return the height 25 | */ 26 | public Long getHeight() { 27 | return height; 28 | } 29 | 30 | /** 31 | * @param height the height to set 32 | */ 33 | public void setHeight(Long height) { 34 | this.height = height; 35 | } 36 | 37 | /** 38 | * @return the bestblock 39 | */ 40 | public String getBestblock() { 41 | return bestblock; 42 | } 43 | 44 | /** 45 | * @param bestblock the bestblock to set 46 | */ 47 | public void setBestblock(String bestblock) { 48 | this.bestblock = bestblock; 49 | } 50 | 51 | /** 52 | * @return the transactions 53 | */ 54 | public Long getTransactions() { 55 | return transactions; 56 | } 57 | 58 | /** 59 | * @param transactions the transactions to set 60 | */ 61 | public void setTransactions(Long transactions) { 62 | this.transactions = transactions; 63 | } 64 | 65 | /** 66 | * @return the txouts 67 | */ 68 | public Long getTxouts() { 69 | return txouts; 70 | } 71 | 72 | /** 73 | * @param txouts the txouts to set 74 | */ 75 | public void setTxouts(Long txouts) { 76 | this.txouts = txouts; 77 | } 78 | 79 | /** 80 | * @return the bytes_serialized 81 | */ 82 | public Long getBytes_serialized() { 83 | return bytes_serialized; 84 | } 85 | 86 | /** 87 | * @param bytes_serialized the bytes_serialized to set 88 | */ 89 | public void setBytes_serialized(Long bytes_serialized) { 90 | this.bytes_serialized = bytes_serialized; 91 | } 92 | 93 | /** 94 | * @return the hash_serialized 95 | */ 96 | public String getHash_serialized() { 97 | return hash_serialized; 98 | } 99 | 100 | /** 101 | * @param hash_serialized the hash_serialized to set 102 | */ 103 | public void setHash_serialized(String hash_serialized) { 104 | this.hash_serialized = hash_serialized; 105 | } 106 | 107 | /** 108 | * @return the total_amount 109 | */ 110 | public Double getTotal_amount() { 111 | return total_amount; 112 | } 113 | 114 | /** 115 | * @param total_amount the total_amount to set 116 | */ 117 | public void setTotal_amount(Double total_amount) { 118 | this.total_amount = total_amount; 119 | } 120 | 121 | 122 | } 123 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/WalletInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class WalletInfo { 15 | Long walletversion = null; 16 | Long balance = null; 17 | Long txcount = null; 18 | Long walletdbversion = null; 19 | Long keypoololdest = null; 20 | Long keypoolsize = null; 21 | Long unlocked_until = null; 22 | 23 | /** 24 | * @return the walletversion 25 | */ 26 | public Long getWalletversion() { 27 | return walletversion; 28 | } 29 | 30 | /** 31 | * @param walletversion the walletversion to set 32 | */ 33 | public void setWalletversion(Long walletversion) { 34 | this.walletversion = walletversion; 35 | } 36 | 37 | /** 38 | * @return the balance 39 | */ 40 | public Long getBalance() { 41 | return balance; 42 | } 43 | 44 | /** 45 | * @param balance the balance to set 46 | */ 47 | public void setBalance(Long balance) { 48 | this.balance = balance; 49 | } 50 | 51 | /** 52 | * @return the txcount 53 | */ 54 | public Long getTxcount() { 55 | return txcount; 56 | } 57 | 58 | /** 59 | * @param txcount the txcount to set 60 | */ 61 | public void setTxcount(Long txcount) { 62 | this.txcount = txcount; 63 | } 64 | 65 | /** 66 | * @return the walletdbversion 67 | */ 68 | public Long getWalletdbversion() { 69 | return walletdbversion; 70 | } 71 | 72 | /** 73 | * @param walletdbversion the walletdbversion to set 74 | */ 75 | public void setWalletdbversion(Long walletdbversion) { 76 | this.walletdbversion = walletdbversion; 77 | } 78 | 79 | /** 80 | * @return the keypoololdest 81 | */ 82 | public Long getKeypoololdest() { 83 | return keypoololdest; 84 | } 85 | 86 | /** 87 | * @param keypoololdest the keypoololdest to set 88 | */ 89 | public void setKeypoololdest(Long keypoololdest) { 90 | this.keypoololdest = keypoololdest; 91 | } 92 | 93 | /** 94 | * @return the keypoolsize 95 | */ 96 | public Long getKeypoolsize() { 97 | return keypoolsize; 98 | } 99 | 100 | /** 101 | * @param keypoolsize the keypoolsize to set 102 | */ 103 | public void setKeypoolsize(Long keypoolsize) { 104 | this.keypoolsize = keypoolsize; 105 | } 106 | 107 | /** 108 | * @return the unlocked_until 109 | */ 110 | public Long getUnlocked_until() { 111 | return unlocked_until; 112 | } 113 | 114 | /** 115 | * @param unlocked_until the unlocked_until to set 116 | */ 117 | public void setUnlocked_until(Long unlocked_until) { 118 | this.unlocked_until = unlocked_until; 119 | } 120 | 121 | 122 | } 123 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/MultiBalance.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.HashMap; 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | /** 15 | * @author Ub - H. MARTEAU 16 | * @version 2.0.1 17 | */ 18 | public class MultiBalance extends HashMap> { 19 | 20 | /** 21 | * 22 | */ 23 | private static final long serialVersionUID = 8083084604911767367L; 24 | 25 | /** 26 | * 27 | */ 28 | public MultiBalance() { 29 | super(); 30 | } 31 | 32 | /** 33 | * @param initialCapacity 34 | * @param loadFactor 35 | */ 36 | public MultiBalance(int initialCapacity, float loadFactor) { 37 | super(initialCapacity, loadFactor); 38 | } 39 | 40 | /** 41 | * @param initialCapacity 42 | */ 43 | public MultiBalance(int initialCapacity) { 44 | super(initialCapacity); 45 | } 46 | 47 | /** 48 | * @param m 49 | */ 50 | public MultiBalance(Map> m) { 51 | super(m); 52 | } 53 | 54 | /* 55 | * (non-Javadoc) 56 | * 57 | * @see java.lang.Object#toString() 58 | */ 59 | @Override 60 | public String toString() { 61 | String multiBalance = "MultiBalance ["; 62 | for (String key : this.keySet()) { 63 | multiBalance += key + ":"; 64 | 65 | List listBalanceAsset = this.get(key); 66 | for (BalanceAssetGeneral balanceAsset : listBalanceAsset) { 67 | multiBalance += balanceAsset.toString() + ","; 68 | } 69 | } 70 | multiBalance += "]"; 71 | 72 | return multiBalance; 73 | } 74 | 75 | // /** 76 | // * @return the label 77 | // */ 78 | // public String getLabel() { 79 | // return label; 80 | // } 81 | // 82 | // /** 83 | // * @param label 84 | // * the label to set 85 | // */ 86 | // public void setLabel(String label) { 87 | // this.label = label; 88 | // } 89 | // 90 | // /** 91 | // * @return the assets 92 | // */ 93 | // public List getAssets() { 94 | // return assets; 95 | // } 96 | // 97 | // public BalanceAsset getFirstAsset() { 98 | // BalanceAsset returnedValue; 99 | // if (this.assets != null && this.assets.size() > 0) { 100 | // returnedValue = this.assets.get(0); 101 | // } else { 102 | // returnedValue = new BalanceAsset(); 103 | // } 104 | // return returnedValue; 105 | // } 106 | // 107 | // /** 108 | // * @param assets 109 | // * the assets to set 110 | // */ 111 | // public void setAssets(List assets) { 112 | // this.assets = assets; 113 | // } 114 | // 115 | // /** 116 | // * @param asset 117 | // * to add 118 | // */ 119 | // public void addAsset(BalanceAsset asset) { 120 | // this.assets.add(asset); 121 | // } 122 | } 123 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/TransactionRAWVout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | public class TransactionRAWVout { 18 | Double value = null; 19 | Long n = null; 20 | ScriptPubKey scriptPubKey; 21 | List assets; 22 | List permissions; 23 | List items; 24 | 25 | /** 26 | * 27 | */ 28 | public TransactionRAWVout() { 29 | super(); 30 | scriptPubKey = new ScriptPubKey(); 31 | assets = new ArrayList(); 32 | permissions = new ArrayList(); 33 | items = new ArrayList(); 34 | } 35 | 36 | /** 37 | * @return the value 38 | */ 39 | public double getValue() { 40 | return value; 41 | } 42 | 43 | /** 44 | * @param value the value to set 45 | */ 46 | public void setValue(double value) { 47 | this.value = value; 48 | } 49 | 50 | /** 51 | * @return the n 52 | */ 53 | public long getN() { 54 | return n; 55 | } 56 | 57 | /** 58 | * @param n the n to set 59 | */ 60 | public void setN(long n) { 61 | this.n = n; 62 | } 63 | 64 | /** 65 | * @return the scriptPubKey 66 | */ 67 | public ScriptPubKey getScriptPubKey() { 68 | return scriptPubKey; 69 | } 70 | 71 | /** 72 | * @param scriptPubKey the scriptPubKey to set 73 | */ 74 | public void setScriptPubKey(ScriptPubKey scriptPubKey) { 75 | this.scriptPubKey = scriptPubKey; 76 | } 77 | 78 | /** 79 | * @return the assets 80 | */ 81 | public List getAssets() { 82 | return assets; 83 | } 84 | 85 | /** 86 | * @param assets the assets to set 87 | */ 88 | public void setAssets(List assets) { 89 | this.assets = assets; 90 | } 91 | 92 | /** 93 | * @param asset to add to the assets list 94 | */ 95 | public void addAsset(BalanceAsset asset) { 96 | this.assets.add(asset); 97 | } 98 | 99 | /** 100 | * @return the permissions 101 | */ 102 | public List getPermissions() { 103 | return permissions; 104 | } 105 | 106 | /** 107 | * @param permissions the permissions to set 108 | */ 109 | public void setPermissions(List permissions) { 110 | this.permissions = permissions; 111 | } 112 | 113 | /** 114 | * @param permissions the permissions to set 115 | */ 116 | public void addPermission(Permission permission) { 117 | this.permissions.add(permission); 118 | } 119 | 120 | /** 121 | * @return the items 122 | */ 123 | public List getItems() { 124 | return items; 125 | } 126 | 127 | /** 128 | * @param items the items to set 129 | */ 130 | public void setItems(List items) { 131 | this.items = items; 132 | } 133 | 134 | 135 | } 136 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.multichainjavaapi 5 | MultiChainJavaAPI 6 | 2.0.2-SNAPSHOT 7 | 8 | 9 | UTF-8 10 | 1.8 11 | 3.1 12 | 3.1.3 13 | 4.3.6 14 | 2.8.1 15 | 1.10 16 | 4.1 17 | 18 | 19 | 20 | scm:git:git://github.com/SimplyUb/MultiChainJavaAPI.git 21 | scm:git:git@github.com/SimplyUb/MultiChainJavaAPI.git 22 | https://github.com/SimplyUb/MultiChainJavaAPI 23 | 24 | 25 | 26 | 27 | 28 | maven-compiler-plugin 29 | ${maven-compiler-plugin.version} 30 | 31 | ${java.version} 32 | ${java.version} 33 | 34 | 35 | 36 | maven-assembly-plugin 37 | 38 | 39 | package 40 | 41 | single 42 | 43 | 44 | 45 | 46 | 47 | jar-with-dependencies 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | org.apache.xmlrpc 56 | xmlrpc-client 57 | ${xmlrpc-client.version} 58 | 59 | 60 | org.apache.httpcomponents 61 | httpclient 62 | ${httpclient.version} 63 | 64 | 65 | com.google.code.gson 66 | gson 67 | ${gson.version} 68 | 69 | 70 | commons-codec 71 | commons-codec 72 | ${commons-codec.version} 73 | 74 | 75 | org.apache.commons 76 | commons-collections4 77 | ${commons-collections4.version} 78 | 79 | 80 | 81 | junit 82 | junit 83 | 4.12 84 | test 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/TxOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | public class TxOut { 18 | 19 | String bestblock = null; 20 | Long confirmations = null; 21 | Double value = null; 22 | ScriptPubKey scriptPubKey = null; 23 | Long version = null; 24 | Boolean coinbase = null; 25 | List assets; 26 | 27 | public TxOut() { 28 | super(); 29 | scriptPubKey = new ScriptPubKey(); 30 | assets = new ArrayList(); 31 | } 32 | 33 | /** 34 | * @return the bestblock 35 | */ 36 | public String getBestblock() { 37 | return bestblock; 38 | } 39 | 40 | /** 41 | * @param bestblock the bestblock to set 42 | */ 43 | public void setBestblock(String bestblock) { 44 | this.bestblock = bestblock; 45 | } 46 | 47 | /** 48 | * @return the confirmations 49 | */ 50 | public long getConfirmations() { 51 | return confirmations; 52 | } 53 | 54 | /** 55 | * @param confirmations the confirmations to set 56 | */ 57 | public void setConfirmations(long confirmations) { 58 | this.confirmations = confirmations; 59 | } 60 | 61 | /** 62 | * @return the value 63 | */ 64 | public double getValue() { 65 | return value; 66 | } 67 | 68 | /** 69 | * @param value the value to set 70 | */ 71 | public void setValue(double value) { 72 | this.value = value; 73 | } 74 | 75 | /** 76 | * @return the scriptPubKey 77 | */ 78 | public ScriptPubKey getScriptPubKey() { 79 | return scriptPubKey; 80 | } 81 | 82 | /** 83 | * @param scriptPubKey the scriptPubKey to set 84 | */ 85 | public void setScriptPubKey(ScriptPubKey scriptPubKey) { 86 | this.scriptPubKey = scriptPubKey; 87 | } 88 | 89 | /** 90 | * @return the version 91 | */ 92 | public long getVersion() { 93 | return version; 94 | } 95 | 96 | /** 97 | * @param version the version to set 98 | */ 99 | public void setVersion(long version) { 100 | this.version = version; 101 | } 102 | 103 | /** 104 | * @return the coinbase 105 | */ 106 | public boolean isCoinbase() { 107 | return coinbase; 108 | } 109 | 110 | /** 111 | * @param coinbase the coinbase to set 112 | */ 113 | public void setCoinbase(boolean coinbase) { 114 | this.coinbase = coinbase; 115 | } 116 | 117 | /** 118 | * @return the assets 119 | */ 120 | public List getAssets() { 121 | return assets; 122 | } 123 | 124 | /** 125 | * @param assets the assets to set 126 | */ 127 | public void setAssets(List assets) { 128 | this.assets = assets; 129 | } 130 | 131 | /** 132 | * @param asset the asset to add 133 | */ 134 | public void addAsset(BalanceAsset asset) { 135 | this.assets.add(asset); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/RawParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | import java.util.HashMap; 11 | import java.util.List; 12 | import java.util.Map; 13 | import multichain.object.formatters.GsonFormatters; 14 | 15 | /** 16 | * @author Ub - H. MARTEAU 17 | * @version 2.0.1 18 | */ 19 | public class RawParam extends GsonFormatters { 20 | String address; 21 | float amount = -1; 22 | List assets; 23 | 24 | /** 25 | * @param address 26 | * @param amount 27 | * @param assets 28 | */ 29 | public RawParam(String address, float amount) { 30 | super(); 31 | this.address = address; 32 | this.amount = amount; 33 | } 34 | 35 | /** 36 | * @param address 37 | * @param amount 38 | * @param assets 39 | */ 40 | public RawParam(String address, List assets) { 41 | super(); 42 | this.address = address; 43 | this.assets = assets; 44 | } 45 | 46 | public boolean isFilled() { 47 | if (address == null || "".equals(address)) { 48 | return false; 49 | } 50 | if (amount >= 0) { 51 | return true; 52 | } else { 53 | if (assets == null || assets.size() == 0) { 54 | return false; 55 | } 56 | boolean assetReturn = false; 57 | for (AssetQuantity asset : assets) { 58 | assetReturn = assetReturn || asset.isFilled(); 59 | } 60 | } 61 | 62 | return true; 63 | } 64 | 65 | public Object getValue() { 66 | Map filledAssets = new HashMap(); 67 | if (assets != null && assets.size() != 0) { 68 | for (AssetQuantity asset : assets) { 69 | if (asset.isFilled()) { 70 | filledAssets.put(asset.getName(), new Float(asset.getQuantity())); 71 | } 72 | } 73 | } 74 | if (filledAssets.size() > 0) { 75 | return filledAssets; 76 | } else { 77 | return amount; 78 | } 79 | } 80 | 81 | /** 82 | * @return the address 83 | */ 84 | public String getAddress() { 85 | return address; 86 | } 87 | 88 | /** 89 | * @param address the address to set 90 | */ 91 | public void setAddress(String address) { 92 | this.address = address; 93 | } 94 | 95 | /** 96 | * @return the amount 97 | */ 98 | public float getAmount() { 99 | return amount; 100 | } 101 | 102 | /** 103 | * @param amount the amount to set 104 | */ 105 | public void setAmount(float amount) { 106 | this.amount = amount; 107 | } 108 | 109 | /** 110 | * @return the assets 111 | */ 112 | public List getAssets() { 113 | return assets; 114 | } 115 | 116 | /** 117 | * @param assets the assets to set 118 | */ 119 | public void setAssets(List assets) { 120 | this.assets = assets; 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/AssetTransaction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | public class AssetTransaction { 18 | 19 | Map addresses; 20 | List items; 21 | List data; 22 | Long confirmations; 23 | String blockhash; 24 | Long blockindex; 25 | Long blocktime; 26 | String txid; 27 | Boolean valid; 28 | Long time; 29 | Long timereceived; 30 | List vin; 31 | List vout; 32 | 33 | public AssetTransaction() {} 34 | 35 | public Map getAddresses() { 36 | return addresses; 37 | } 38 | 39 | public void setAddresses(Map addresses) { 40 | this.addresses = addresses; 41 | } 42 | 43 | public List getItems() { 44 | return items; 45 | } 46 | 47 | public void setItems(List items) { 48 | this.items = items; 49 | } 50 | 51 | public List getData() { 52 | return data; 53 | } 54 | 55 | public void setData(List data) { 56 | this.data = data; 57 | } 58 | 59 | public Long getConfirmations() { 60 | return confirmations; 61 | } 62 | 63 | public void setConfirmations(Long confirmations) { 64 | this.confirmations = confirmations; 65 | } 66 | 67 | public String getBlockhash() { 68 | return blockhash; 69 | } 70 | 71 | public void setBlockhash(String blockhash) { 72 | this.blockhash = blockhash; 73 | } 74 | 75 | public Long getBlockindex() { 76 | return blockindex; 77 | } 78 | 79 | public void setBlockindex(Long blockindex) { 80 | this.blockindex = blockindex; 81 | } 82 | 83 | public Long getBlocktime() { 84 | return blocktime; 85 | } 86 | 87 | public void setBlocktime(Long blocktime) { 88 | this.blocktime = blocktime; 89 | } 90 | 91 | public String getTxid() { 92 | return txid; 93 | } 94 | 95 | public void setTxid(String txid) { 96 | this.txid = txid; 97 | } 98 | 99 | public Boolean getValid() { 100 | return valid; 101 | } 102 | 103 | public void setValid(Boolean valid) { 104 | this.valid = valid; 105 | } 106 | 107 | public Long getTime() { 108 | return time; 109 | } 110 | 111 | public void setTime(Long time) { 112 | this.time = time; 113 | } 114 | 115 | public Long getTimereceived() { 116 | return timereceived; 117 | } 118 | 119 | public void setTimereceived(Long timereceived) { 120 | this.timereceived = timereceived; 121 | } 122 | 123 | public List getVin() { 124 | return vin; 125 | } 126 | 127 | public void setVin(List vin) { 128 | this.vin = vin; 129 | } 130 | 131 | public List getVout() { 132 | return vout; 133 | } 134 | 135 | public void setVout(List vout) { 136 | this.vout = vout; 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/queryobjects/DataParamIssue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object.queryobjects; 9 | 10 | import java.util.HashMap; 11 | import java.util.Map; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | public class DataParamIssue implements DataParam { 18 | // "create" : asset (string,required) asset 19 | // "name" : asset-name (string,optional) Asset name 20 | // "multiple" : n (numeric,optional, default 1) Number of raw units in one displayed unit 21 | // "open" : true|false (boolean, optional, default false) True if follow-on issues are allowed 22 | // "details" : (object, optional) a json object with custom fields 23 | // { 24 | // "param-name": "param-value" (strings, required) The key is the parameter name, the value is 25 | // parameter value 26 | // ,... 27 | // } 28 | 29 | private String create = "asset"; 30 | private String name = null; 31 | private Long multiple = null; 32 | private Boolean open = null; 33 | private Map details = null; 34 | 35 | @Override 36 | public DataParamIssue getFormatedvalue() { 37 | return this; 38 | } 39 | 40 | /** 41 | * 42 | */ 43 | public DataParamIssue() { 44 | super(); 45 | // TODO Auto-generated constructor stub 46 | } 47 | 48 | /** 49 | * @param name 50 | * @param multiple 51 | * @param open 52 | * @param details 53 | */ 54 | public DataParamIssue(String name, Long multiple, Boolean open, Map details) { 55 | this.name = name; 56 | this.multiple = multiple; 57 | this.open = open; 58 | this.details = details; 59 | } 60 | 61 | /** 62 | * @return the name 63 | */ 64 | public String getName() { 65 | return name; 66 | } 67 | 68 | /** 69 | * @param name the name to set 70 | */ 71 | public void setName(String name) { 72 | this.name = name; 73 | } 74 | 75 | /** 76 | * @return the multiple 77 | */ 78 | public Long getMultiple() { 79 | return multiple; 80 | } 81 | 82 | /** 83 | * @param multiple the multiple to set 84 | */ 85 | public void setMultiple(Long multiple) { 86 | this.multiple = multiple; 87 | } 88 | 89 | /** 90 | * @return the open 91 | */ 92 | public Boolean isOpen() { 93 | return open; 94 | } 95 | 96 | /** 97 | * @return the open 98 | */ 99 | public Boolean getOpen() { 100 | return open; 101 | } 102 | 103 | /** 104 | * @param open the open to set 105 | */ 106 | public void setOpen(Boolean open) { 107 | this.open = open; 108 | } 109 | 110 | /** 111 | * @return the details 112 | */ 113 | public Map getDetails() { 114 | return details; 115 | } 116 | 117 | /** 118 | * @param details the details to set 119 | */ 120 | public void addDetails(CustomParamString detail) { 121 | if (details == null) { 122 | details = new HashMap<>(); 123 | } 124 | details.put(detail.getName(), detail.getValue()); 125 | } 126 | 127 | /** 128 | * @return the create 129 | */ 130 | public String getCreate() { 131 | return create; 132 | } 133 | 134 | 135 | } 136 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/TransactionRAW.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | public class TransactionRAW { 18 | String txid = null; 19 | Integer version = null; 20 | Long locktime = null; 21 | List vin; 22 | List vout; 23 | AssetWalletTransaction issue = null; 24 | List data; 25 | 26 | /** 27 | * 28 | */ 29 | public TransactionRAW() { 30 | super(); 31 | vin = new ArrayList(); 32 | vout = new ArrayList(); 33 | data = new ArrayList(); 34 | } 35 | 36 | /** 37 | * @return the txid 38 | */ 39 | public String getTxid() { 40 | return txid; 41 | } 42 | 43 | /** 44 | * @param txid the txid to set 45 | */ 46 | public void setTxid(String txid) { 47 | this.txid = txid; 48 | } 49 | 50 | /** 51 | * @return the locktime 52 | */ 53 | public long getLocktime() { 54 | return locktime; 55 | } 56 | 57 | /** 58 | * @param locktime the locktime to set 59 | */ 60 | public void setLocktime(long locktime) { 61 | this.locktime = locktime; 62 | } 63 | 64 | /** 65 | * @return the data 66 | */ 67 | public List getData() { 68 | return data; 69 | } 70 | 71 | /** 72 | * @param data the data to set 73 | */ 74 | public void setData(List data) { 75 | this.data = data; 76 | } 77 | 78 | /** 79 | * @param data to add to the data list 80 | */ 81 | public void addData(String data) { 82 | this.data.add(data); 83 | } 84 | 85 | /** 86 | * @return the vin 87 | */ 88 | public List getVin() { 89 | return vin; 90 | } 91 | 92 | /** 93 | * @param vins the vin to set 94 | */ 95 | public void setVin(List vin) { 96 | this.vin = vin; 97 | } 98 | 99 | /** 100 | * @param vin to add to the vin list 101 | */ 102 | public void addVin(TransactionRAWVin vin) { 103 | this.vin.add(vin); 104 | } 105 | 106 | /** 107 | * @return the vout 108 | */ 109 | public List getVout() { 110 | return vout; 111 | } 112 | 113 | /** 114 | * @param vouts the vout to set 115 | */ 116 | public void setVout(List vout) { 117 | this.vout = vout; 118 | } 119 | 120 | /** 121 | * @param vout to add to the vout list 122 | */ 123 | public void addVout(TransactionRAWVout vout) { 124 | this.vout.add(vout); 125 | } 126 | 127 | 128 | 129 | /** 130 | * @return the version 131 | */ 132 | public int getVersion() { 133 | return version; 134 | } 135 | 136 | 137 | 138 | /** 139 | * @param version the version to set 140 | */ 141 | public void setVersion(int version) { 142 | this.version = version; 143 | } 144 | 145 | /** 146 | * @return the issue 147 | */ 148 | public AssetWalletTransaction getIssue() { 149 | return issue; 150 | } 151 | 152 | /** 153 | * @param issue the issue to set 154 | */ 155 | public void setIssue(AssetWalletTransaction issue) { 156 | this.issue = issue; 157 | } 158 | 159 | } 160 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/TransactionWalletVInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | public class TransactionWalletVInfo { 18 | List addresses; 19 | String type = null; 20 | Boolean ismine = null; 21 | Boolean iswatchonly = null; 22 | Double amount = null; 23 | List assets; 24 | List permissions; 25 | 26 | /** 27 | * 28 | */ 29 | public TransactionWalletVInfo() { 30 | super(); 31 | addresses = new ArrayList(); 32 | assets = new ArrayList(); 33 | permissions = new ArrayList(); 34 | type = null; 35 | } 36 | 37 | /** 38 | * 39 | */ 40 | public TransactionWalletVInfo(TransactionWalletVInfo info) { 41 | super(); 42 | this.addresses = info.getAddresses(); 43 | this.type = info.getType(); 44 | this.ismine = info.isIsmine(); 45 | this.iswatchonly = info.isIswatchonly(); 46 | this.assets = info.getAssets(); 47 | this.permissions = info.getPermissions(); 48 | } 49 | 50 | /** 51 | * @return the type 52 | */ 53 | public String getType() { 54 | return type; 55 | } 56 | 57 | /** 58 | * @param type the type to set 59 | */ 60 | public void setType(String type) { 61 | this.type = type; 62 | } 63 | 64 | /** 65 | * @return the ismine 66 | */ 67 | public boolean isIsmine() { 68 | return ismine; 69 | } 70 | 71 | /** 72 | * @param ismine the ismine to set 73 | */ 74 | public void setIsmine(boolean ismine) { 75 | this.ismine = ismine; 76 | } 77 | 78 | /** 79 | * @return the iswatchonly 80 | */ 81 | public boolean isIswatchonly() { 82 | return iswatchonly; 83 | } 84 | 85 | /** 86 | * @param iswatchonly the iswatchonly to set 87 | */ 88 | public void setIswatchonly(boolean iswatchonly) { 89 | this.iswatchonly = iswatchonly; 90 | } 91 | 92 | /** 93 | * @return the addresses 94 | */ 95 | public List getAddresses() { 96 | return addresses; 97 | } 98 | 99 | /** 100 | * @param addresses the addresses to set 101 | */ 102 | public void setAddresses(List addresses) { 103 | this.addresses = addresses; 104 | } 105 | 106 | /** 107 | * @return the assets 108 | */ 109 | public List getAssets() { 110 | return assets; 111 | } 112 | 113 | /** 114 | * @param assets the assets to set 115 | */ 116 | public void setAssets(List assets) { 117 | this.assets = assets; 118 | } 119 | 120 | /** 121 | * @return the amount 122 | */ 123 | public double getAmount() { 124 | return amount; 125 | } 126 | 127 | /** 128 | * @param amount the amount to set 129 | */ 130 | public void setAmount(double amount) { 131 | this.amount = amount; 132 | } 133 | 134 | /** 135 | * @return the permissions 136 | */ 137 | public List getPermissions() { 138 | return permissions; 139 | } 140 | 141 | /** 142 | * @param permissions the permissions to set 143 | */ 144 | public void setPermissions(List permissions) { 145 | this.permissions = permissions; 146 | } 147 | 148 | } 149 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/Item.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 5 | * 6 | */ 7 | package multichain.object; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * @author Ub - H. MARTEAU 13 | * @version 2.0.1 14 | */ 15 | public class Item { 16 | 17 | String type = null; // For example "Stream" 18 | String name = null; // For example name of the Stream 19 | String streamref = null; 20 | List publishers; // @ of publishers 21 | List keys = null; // For example key used to publish in the Stream 22 | Boolean offchain = null; // For example data published in the Stream 23 | Boolean available = null; 24 | Object data = null; 25 | 26 | /** 27 | * @return the type 28 | */ 29 | public String getType() { 30 | 31 | return type; 32 | } 33 | 34 | /** 35 | * @param type 36 | * the type to set 37 | */ 38 | public void setType(final String type) { 39 | 40 | this.type = type; 41 | } 42 | 43 | /** 44 | * @return the name 45 | */ 46 | public String getName() { 47 | 48 | return name; 49 | } 50 | 51 | /** 52 | * @param name 53 | * the name to set 54 | */ 55 | public void setName(final String name) { 56 | 57 | this.name = name; 58 | } 59 | 60 | /** 61 | * @return the streamref 62 | */ 63 | public String getStreamref() { 64 | 65 | return streamref; 66 | } 67 | 68 | /** 69 | * @param streamref 70 | * the streamref to set 71 | */ 72 | public void setStreamref(final String streamref) { 73 | 74 | this.streamref = streamref; 75 | } 76 | 77 | /** 78 | * @return the publishers 79 | */ 80 | public List getPublishers() { 81 | 82 | return publishers; 83 | } 84 | 85 | /** 86 | * @param publishers 87 | * the publishers to set 88 | */ 89 | public void setPublishers(final List publishers) { 90 | 91 | this.publishers = publishers; 92 | } 93 | 94 | /** 95 | * @return the keys 96 | */ 97 | public List getKeys() { 98 | 99 | return keys; 100 | } 101 | 102 | /** 103 | * @param keys 104 | * the keys to set 105 | */ 106 | public void setKeys(final List keys) { 107 | 108 | this.keys = keys; 109 | } 110 | 111 | /** 112 | * @return the offchain 113 | */ 114 | public Boolean getOffchain() { 115 | 116 | return offchain; 117 | } 118 | 119 | /** 120 | * @param offchain 121 | * the offchain to set 122 | */ 123 | public void setOffchain(final Boolean offchain) { 124 | 125 | this.offchain = offchain; 126 | } 127 | 128 | /** 129 | * @return the available 130 | */ 131 | public Boolean getAvailable() { 132 | 133 | return available; 134 | } 135 | 136 | /** 137 | * @param available 138 | * the available to set 139 | */ 140 | public void setAvailable(final Boolean available) { 141 | 142 | this.available = available; 143 | } 144 | 145 | /** 146 | * @return the data 147 | */ 148 | public Object getData() { 149 | 150 | return data; 151 | } 152 | 153 | /** 154 | * @param data 155 | * the data to set 156 | */ 157 | public void setData(final Object data) { 158 | 159 | this.data = data; 160 | } 161 | 162 | /* 163 | * (non-Javadoc) 164 | * 165 | * @see java.lang.Object#toString() 166 | */ 167 | @Override 168 | public String toString() { 169 | 170 | return String.format("Item [type=%s, name=%s, streamref=%s, publishers=%s, keys=%s, offchain=%s, available=%s, data=%s]", type, name, streamref, 171 | publishers, keys, offchain, available, data); 172 | } 173 | 174 | } 175 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/NetworkInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public class NetworkInfo { 17 | Long version = null; 18 | String subversion = null; 19 | Long protocolversion = null; 20 | String localservices = null; 21 | Long timeoffset = null; 22 | Long connections = null; 23 | List networks = null; 24 | Double relayfee = null; 25 | List localaddresses = null; 26 | 27 | /** 28 | * @return the version 29 | */ 30 | public Long getVersion() { 31 | return version; 32 | } 33 | 34 | /** 35 | * @param version the version to set 36 | */ 37 | public void setVersion(Long version) { 38 | this.version = version; 39 | } 40 | 41 | /** 42 | * @return the subversion 43 | */ 44 | public String getSubversion() { 45 | return subversion; 46 | } 47 | 48 | /** 49 | * @param subversion the subversion to set 50 | */ 51 | public void setSubversion(String subversion) { 52 | this.subversion = subversion; 53 | } 54 | 55 | /** 56 | * @return the protocolversion 57 | */ 58 | public Long getProtocolversion() { 59 | return protocolversion; 60 | } 61 | 62 | /** 63 | * @param protocolversion the protocolversion to set 64 | */ 65 | public void setProtocolversion(Long protocolversion) { 66 | this.protocolversion = protocolversion; 67 | } 68 | 69 | /** 70 | * @return the localservices 71 | */ 72 | public String getLocalservices() { 73 | return localservices; 74 | } 75 | 76 | /** 77 | * @param localservices the localservices to set 78 | */ 79 | public void setLocalservices(String localservices) { 80 | this.localservices = localservices; 81 | } 82 | 83 | /** 84 | * @return the timeoffset 85 | */ 86 | public Long getTimeoffset() { 87 | return timeoffset; 88 | } 89 | 90 | /** 91 | * @param timeoffset the timeoffset to set 92 | */ 93 | public void setTimeoffset(Long timeoffset) { 94 | this.timeoffset = timeoffset; 95 | } 96 | 97 | /** 98 | * @return the connections 99 | */ 100 | public Long getConnections() { 101 | return connections; 102 | } 103 | 104 | /** 105 | * @param connections the connections to set 106 | */ 107 | public void setConnections(Long connections) { 108 | this.connections = connections; 109 | } 110 | 111 | /** 112 | * @return the networks 113 | */ 114 | public List getNetworks() { 115 | return networks; 116 | } 117 | 118 | /** 119 | * @param networks the networks to set 120 | */ 121 | public void setNetworks(List networks) { 122 | this.networks = networks; 123 | } 124 | 125 | /** 126 | * @return the relayfee 127 | */ 128 | public Double getRelayfee() { 129 | return relayfee; 130 | } 131 | 132 | /** 133 | * @param relayfee the relayfee to set 134 | */ 135 | public void setRelayfee(Double relayfee) { 136 | this.relayfee = relayfee; 137 | } 138 | 139 | /** 140 | * @return the localaddresses 141 | */ 142 | public List getLocaladdresses() { 143 | return localaddresses; 144 | } 145 | 146 | /** 147 | * @param localaddresses the localaddresses to set 148 | */ 149 | public void setLocaladdresses(List localaddresses) { 150 | this.localaddresses = localaddresses; 151 | } 152 | 153 | 154 | } 155 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/TransactionBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class TransactionBase { 15 | Long confirmations = null; 16 | String blockhash = null; 17 | Long blockindex = null; 18 | Long blocktime = null; 19 | String txid = null; 20 | Boolean valid = null; 21 | Long time = null; 22 | Long timereceived = null; 23 | Long version = null; 24 | Long locktime = null; 25 | 26 | /** 27 | * 28 | */ 29 | public TransactionBase() { 30 | super(); 31 | // TODO Auto-generated constructor stub 32 | } 33 | 34 | /** 35 | * @param confirmations 36 | * @param blockhash 37 | * @param blockindex 38 | * @param blocktime 39 | * @param txid 40 | * @param time 41 | * @param timereceived 42 | * @param version 43 | * @param locktime 44 | */ 45 | public TransactionBase(TransactionBase transactionBase) { 46 | super(); 47 | this.confirmations = transactionBase.confirmations; 48 | this.blockhash = transactionBase.blockhash; 49 | this.blockindex = transactionBase.blockindex; 50 | this.blocktime = transactionBase.blocktime; 51 | this.txid = transactionBase.txid; 52 | this.time = transactionBase.time; 53 | this.timereceived = transactionBase.timereceived; 54 | this.version = transactionBase.version; 55 | this.locktime = transactionBase.locktime; 56 | } 57 | 58 | /** 59 | * @return the confirmations 60 | */ 61 | public long getConfirmations() { 62 | return confirmations; 63 | } 64 | 65 | /** 66 | * @param confirmations the confirmations to set 67 | */ 68 | public void setConfirmations(long confirmations) { 69 | this.confirmations = confirmations; 70 | } 71 | 72 | /** 73 | * @return the blockhash 74 | */ 75 | public String getBlockhash() { 76 | return blockhash; 77 | } 78 | 79 | /** 80 | * @param blockhash the blockhash to set 81 | */ 82 | public void setBlockhash(String blockhash) { 83 | this.blockhash = blockhash; 84 | } 85 | 86 | /** 87 | * @return the blockindex 88 | */ 89 | public long getBlockindex() { 90 | return blockindex; 91 | } 92 | 93 | /** 94 | * @param blockindex the blockindex to set 95 | */ 96 | public void setBlockindex(long blockindex) { 97 | this.blockindex = blockindex; 98 | } 99 | 100 | /** 101 | * @return the blocktime 102 | */ 103 | public long getBlocktime() { 104 | return blocktime; 105 | } 106 | 107 | /** 108 | * @param blocktime the blocktime to set 109 | */ 110 | public void setBlocktime(long blocktime) { 111 | this.blocktime = blocktime; 112 | } 113 | 114 | /** 115 | * @return the txid 116 | */ 117 | public String getTxid() { 118 | return txid; 119 | } 120 | 121 | /** 122 | * @param txid the txid to set 123 | */ 124 | public void setTxid(String txid) { 125 | this.txid = txid; 126 | } 127 | 128 | /** 129 | * @return the time 130 | */ 131 | public long getTime() { 132 | return time; 133 | } 134 | 135 | /** 136 | * @param time the time to set 137 | */ 138 | public void setTime(long time) { 139 | this.time = time; 140 | } 141 | 142 | /** 143 | * @return the timereceived 144 | */ 145 | public long getTimereceived() { 146 | return timereceived; 147 | } 148 | 149 | /** 150 | * @param timereceived the timereceived to set 151 | */ 152 | public void setTimereceived(long timereceived) { 153 | this.timereceived = timereceived; 154 | } 155 | 156 | /** 157 | * @return the valid 158 | */ 159 | public boolean isValid() { 160 | return valid; 161 | } 162 | 163 | /** 164 | * @param valid the valid to set 165 | */ 166 | public void setValid(boolean valid) { 167 | this.valid = valid; 168 | } 169 | 170 | 171 | } 172 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/BlockchainInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class BlockchainInfo { 15 | String chain = null; 16 | String chainname = null; 17 | String description = null; 18 | String protocol = null; 19 | String setupblocks = null; 20 | Long blocks = null; 21 | Long headers = null; 22 | String bestblockhash = null; 23 | Long difficulty = null; 24 | Long verificationprogress = null; 25 | String chainwork = null; 26 | 27 | /** 28 | * @return the chain 29 | */ 30 | public String getChain() { 31 | return chain; 32 | } 33 | 34 | /** 35 | * @param chain the chain to set 36 | */ 37 | public void setChain(String chain) { 38 | this.chain = chain; 39 | } 40 | 41 | /** 42 | * @return the chainname 43 | */ 44 | public String getChainname() { 45 | return chainname; 46 | } 47 | 48 | /** 49 | * @param chainname the chainname to set 50 | */ 51 | public void setChainname(String chainname) { 52 | this.chainname = chainname; 53 | } 54 | 55 | /** 56 | * @return the description 57 | */ 58 | public String getDescription() { 59 | return description; 60 | } 61 | 62 | /** 63 | * @param description the description to set 64 | */ 65 | public void setDescription(String description) { 66 | this.description = description; 67 | } 68 | 69 | /** 70 | * @return the protocol 71 | */ 72 | public String getProtocol() { 73 | return protocol; 74 | } 75 | 76 | /** 77 | * @param protocol the protocol to set 78 | */ 79 | public void setProtocol(String protocol) { 80 | this.protocol = protocol; 81 | } 82 | 83 | /** 84 | * @return the setupblocks 85 | */ 86 | public String getSetupblocks() { 87 | return setupblocks; 88 | } 89 | 90 | /** 91 | * @param setupblocks the setupblocks to set 92 | */ 93 | public void setSetupblocks(String setupblocks) { 94 | this.setupblocks = setupblocks; 95 | } 96 | 97 | /** 98 | * @return the blocks 99 | */ 100 | public Long getBlocks() { 101 | return blocks; 102 | } 103 | 104 | /** 105 | * @param blocks the blocks to set 106 | */ 107 | public void setBlocks(Long blocks) { 108 | this.blocks = blocks; 109 | } 110 | 111 | /** 112 | * @return the headers 113 | */ 114 | public Long getHeaders() { 115 | return headers; 116 | } 117 | 118 | /** 119 | * @param headers the headers to set 120 | */ 121 | public void setHeaders(Long headers) { 122 | this.headers = headers; 123 | } 124 | 125 | /** 126 | * @return the bestblockhash 127 | */ 128 | public String getBestblockhash() { 129 | return bestblockhash; 130 | } 131 | 132 | /** 133 | * @param bestblockhash the bestblockhash to set 134 | */ 135 | public void setBestblockhash(String bestblockhash) { 136 | this.bestblockhash = bestblockhash; 137 | } 138 | 139 | /** 140 | * @return the difficulty 141 | */ 142 | public Long getDifficulty() { 143 | return difficulty; 144 | } 145 | 146 | /** 147 | * @param difficulty the difficulty to set 148 | */ 149 | public void setDifficulty(Long difficulty) { 150 | this.difficulty = difficulty; 151 | } 152 | 153 | /** 154 | * @return the verificationprogress 155 | */ 156 | public Long getVerificationprogress() { 157 | return verificationprogress; 158 | } 159 | 160 | /** 161 | * @param verificationprogress the verificationprogress to set 162 | */ 163 | public void setVerificationprogress(Long verificationprogress) { 164 | this.verificationprogress = verificationprogress; 165 | } 166 | 167 | /** 168 | * @return the chainwork 169 | */ 170 | public String getChainwork() { 171 | return chainwork; 172 | } 173 | 174 | /** 175 | * @param chainwork the chainwork to set 176 | */ 177 | public void setChainwork(String chainwork) { 178 | this.chainwork = chainwork; 179 | } 180 | 181 | 182 | } 183 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/PermissionDetailed.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public class PermissionDetailed { 17 | 18 | Boolean connect = null; 19 | Boolean send = null; 20 | Boolean receive = null; 21 | Boolean create = null; 22 | Boolean issue = null; 23 | Boolean mine = null; 24 | Boolean admin = null; 25 | Boolean activate = null; 26 | Long startblock = null; 27 | Long endblock = null; 28 | Long timestamp = null; 29 | List addresses = null; 30 | 31 | /** 32 | * 33 | */ 34 | public PermissionDetailed() { 35 | super(); 36 | } 37 | 38 | /** 39 | * @return the addresses 40 | */ 41 | public List getAddresses() { 42 | return addresses; 43 | } 44 | 45 | /** 46 | * @param addresses the addresses to set 47 | */ 48 | public void setAddresses(List addresses) { 49 | this.addresses = addresses; 50 | } 51 | 52 | /** 53 | * @return the connect 54 | */ 55 | public Boolean getConnect() { 56 | return connect; 57 | } 58 | 59 | /** 60 | * @param connect the connect to set 61 | */ 62 | public void setConnect(Boolean connect) { 63 | this.connect = connect; 64 | } 65 | 66 | /** 67 | * @return the send 68 | */ 69 | public Boolean getSend() { 70 | return send; 71 | } 72 | 73 | /** 74 | * @param send the send to set 75 | */ 76 | public void setSend(Boolean send) { 77 | this.send = send; 78 | } 79 | 80 | /** 81 | * @return the receive 82 | */ 83 | public Boolean getReceive() { 84 | return receive; 85 | } 86 | 87 | /** 88 | * @param receive the receive to set 89 | */ 90 | public void setReceive(Boolean receive) { 91 | this.receive = receive; 92 | } 93 | 94 | /** 95 | * @return the create 96 | */ 97 | public Boolean getCreate() { 98 | return create; 99 | } 100 | 101 | /** 102 | * @param create the create to set 103 | */ 104 | public void setCreate(Boolean create) { 105 | this.create = create; 106 | } 107 | 108 | /** 109 | * @return the issue 110 | */ 111 | public Boolean getIssue() { 112 | return issue; 113 | } 114 | 115 | /** 116 | * @param issue the issue to set 117 | */ 118 | public void setIssue(Boolean issue) { 119 | this.issue = issue; 120 | } 121 | 122 | /** 123 | * @return the mine 124 | */ 125 | public Boolean getMine() { 126 | return mine; 127 | } 128 | 129 | /** 130 | * @param mine the mine to set 131 | */ 132 | public void setMine(Boolean mine) { 133 | this.mine = mine; 134 | } 135 | 136 | /** 137 | * @return the admin 138 | */ 139 | public Boolean getAdmin() { 140 | return admin; 141 | } 142 | 143 | /** 144 | * @param admin the admin to set 145 | */ 146 | public void setAdmin(Boolean admin) { 147 | this.admin = admin; 148 | } 149 | 150 | /** 151 | * @return the activate 152 | */ 153 | public Boolean getActivate() { 154 | return activate; 155 | } 156 | 157 | /** 158 | * @param activate the activate to set 159 | */ 160 | public void setActivate(Boolean activate) { 161 | this.activate = activate; 162 | } 163 | 164 | /** 165 | * @return the startblock 166 | */ 167 | public Long getStartblock() { 168 | return startblock; 169 | } 170 | 171 | /** 172 | * @param startblock the startblock to set 173 | */ 174 | public void setStartblock(Long startblock) { 175 | this.startblock = startblock; 176 | } 177 | 178 | /** 179 | * @return the endblock 180 | */ 181 | public Long getEndblock() { 182 | return endblock; 183 | } 184 | 185 | /** 186 | * @param endblock the endblock to set 187 | */ 188 | public void setEndblock(Long endblock) { 189 | this.endblock = endblock; 190 | } 191 | 192 | /** 193 | * @return the timestamp 194 | */ 195 | public Long getTimestamp() { 196 | return timestamp; 197 | } 198 | 199 | /** 200 | * @param timestamp the timestamp to set 201 | */ 202 | public void setTimestamp(Long timestamp) { 203 | this.timestamp = timestamp; 204 | } 205 | 206 | 207 | } 208 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/MiningInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class MiningInfo { 15 | Long blocks = null; 16 | Long currentblocksize = null; 17 | Long currentblocktx = null; 18 | Double difficulty = null; 19 | String errors = null; 20 | Long genproclimit = null; 21 | Long networkhashps = null; 22 | Long pooledtx = null; 23 | Boolean testnet = null; 24 | String chain = null; 25 | Boolean generate = null; 26 | Long hashespersec = null; 27 | 28 | /** 29 | * @return the blocks 30 | */ 31 | public Long getBlocks() { 32 | return blocks; 33 | } 34 | 35 | /** 36 | * @param blocks the blocks to set 37 | */ 38 | public void setBlocks(Long blocks) { 39 | this.blocks = blocks; 40 | } 41 | 42 | /** 43 | * @return the currentblocksize 44 | */ 45 | public Long getCurrentblocksize() { 46 | return currentblocksize; 47 | } 48 | 49 | /** 50 | * @param currentblocksize the currentblocksize to set 51 | */ 52 | public void setCurrentblocksize(Long currentblocksize) { 53 | this.currentblocksize = currentblocksize; 54 | } 55 | 56 | /** 57 | * @return the currentblocktx 58 | */ 59 | public Long getCurrentblocktx() { 60 | return currentblocktx; 61 | } 62 | 63 | /** 64 | * @param currentblocktx the currentblocktx to set 65 | */ 66 | public void setCurrentblocktx(Long currentblocktx) { 67 | this.currentblocktx = currentblocktx; 68 | } 69 | 70 | /** 71 | * @return the difficulty 72 | */ 73 | public Double getDifficulty() { 74 | return difficulty; 75 | } 76 | 77 | /** 78 | * @param difficulty the difficulty to set 79 | */ 80 | public void setDifficulty(Double difficulty) { 81 | this.difficulty = difficulty; 82 | } 83 | 84 | /** 85 | * @return the errors 86 | */ 87 | public String getErrors() { 88 | return errors; 89 | } 90 | 91 | /** 92 | * @param errors the errors to set 93 | */ 94 | public void setErrors(String errors) { 95 | this.errors = errors; 96 | } 97 | 98 | /** 99 | * @return the genproclimit 100 | */ 101 | public Long getGenproclimit() { 102 | return genproclimit; 103 | } 104 | 105 | /** 106 | * @param genproclimit the genproclimit to set 107 | */ 108 | public void setGenproclimit(Long genproclimit) { 109 | this.genproclimit = genproclimit; 110 | } 111 | 112 | /** 113 | * @return the networkhashps 114 | */ 115 | public Long getNetworkhashps() { 116 | return networkhashps; 117 | } 118 | 119 | /** 120 | * @param networkhashps the networkhashps to set 121 | */ 122 | public void setNetworkhashps(Long networkhashps) { 123 | this.networkhashps = networkhashps; 124 | } 125 | 126 | /** 127 | * @return the pooledtx 128 | */ 129 | public Long getPooledtx() { 130 | return pooledtx; 131 | } 132 | 133 | /** 134 | * @param pooledtx the pooledtx to set 135 | */ 136 | public void setPooledtx(Long pooledtx) { 137 | this.pooledtx = pooledtx; 138 | } 139 | 140 | /** 141 | * @return the testnet 142 | */ 143 | public Boolean getTestnet() { 144 | return testnet; 145 | } 146 | 147 | /** 148 | * @param testnet the testnet to set 149 | */ 150 | public void setTestnet(Boolean testnet) { 151 | this.testnet = testnet; 152 | } 153 | 154 | /** 155 | * @return the chain 156 | */ 157 | public String getChain() { 158 | return chain; 159 | } 160 | 161 | /** 162 | * @param chain the chain to set 163 | */ 164 | public void setChain(String chain) { 165 | this.chain = chain; 166 | } 167 | 168 | /** 169 | * @return the generate 170 | */ 171 | public Boolean getGenerate() { 172 | return generate; 173 | } 174 | 175 | /** 176 | * @param generate the generate to set 177 | */ 178 | public void setGenerate(Boolean generate) { 179 | this.generate = generate; 180 | } 181 | 182 | /** 183 | * @return the hashespersec 184 | */ 185 | public Long getHashespersec() { 186 | return hashespersec; 187 | } 188 | 189 | /** 190 | * @param hashespersec the hashespersec to set 191 | */ 192 | public void setHashespersec(Long hashespersec) { 193 | this.hashespersec = hashespersec; 194 | } 195 | 196 | 197 | } 198 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/StreamKeyInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.2 15 | */ 16 | public class StreamKeyInfo { 17 | List publishers; 18 | String key = null; 19 | Object data = null; 20 | Long confirmations = null; 21 | String blockhash = null; 22 | Long blockindex = null; 23 | Long blocktime = null; 24 | String txid = null; 25 | Long vout = null; 26 | Boolean valid = null; 27 | Long time = null; 28 | Long timereceived = null; 29 | 30 | /* 31 | * (non-Javadoc) 32 | * 33 | * @see java.lang.Object#toString() 34 | */ 35 | @Override 36 | public String toString() { 37 | return "StreamKeyInfo [publishers=" + publishers + ", key=" + key + ", data=" + data 38 | + ", confirmations=" + confirmations + ", blockhash=" + blockhash + ", blockindex=" 39 | + blockindex + ", blocktime=" + blocktime + ", txid=" + txid + ", vout=" + vout + ", valid=" 40 | + valid + ", time=" + time + ", timereceived=" + timereceived + "]"; 41 | } 42 | 43 | /** 44 | * @return the publishers 45 | */ 46 | public List getPublishers() { 47 | return publishers; 48 | } 49 | 50 | /** 51 | * @param publishers the publishers to set 52 | */ 53 | public void setPublishers(List publishers) { 54 | this.publishers = publishers; 55 | } 56 | 57 | /** 58 | * @return the key 59 | */ 60 | public String getKey() { 61 | return key; 62 | } 63 | 64 | /** 65 | * @param key the key to set 66 | */ 67 | public void setKey(String key) { 68 | this.key = key; 69 | } 70 | 71 | /** 72 | * @return the data 73 | */ 74 | public Object getData() { 75 | return data; 76 | } 77 | 78 | /** 79 | * @param data the data to set 80 | */ 81 | public void setData(Object data) { 82 | this.data = data; 83 | } 84 | 85 | /** 86 | * @return the confirmations 87 | */ 88 | public long getConfirmations() { 89 | return confirmations; 90 | } 91 | 92 | /** 93 | * @param confirmations the confirmations to set 94 | */ 95 | public void setConfirmations(long confirmations) { 96 | this.confirmations = confirmations; 97 | } 98 | 99 | /** 100 | * @return the blockhash 101 | */ 102 | public String getBlockhash() { 103 | return blockhash; 104 | } 105 | 106 | /** 107 | * @param blockhash the blockhash to set 108 | */ 109 | public void setBlockhash(String blockhash) { 110 | this.blockhash = blockhash; 111 | } 112 | 113 | /** 114 | * @return the blockindex 115 | */ 116 | public long getBlockindex() { 117 | return blockindex; 118 | } 119 | 120 | /** 121 | * @param blockindex the blockindex to set 122 | */ 123 | public void setBlockindex(long blockindex) { 124 | this.blockindex = blockindex; 125 | } 126 | 127 | /** 128 | * @return the blocktime 129 | */ 130 | public long getBlocktime() { 131 | return blocktime; 132 | } 133 | 134 | /** 135 | * @param blocktime the blocktime to set 136 | */ 137 | public void setBlocktime(long blocktime) { 138 | this.blocktime = blocktime; 139 | } 140 | 141 | /** 142 | * @return the txid 143 | */ 144 | public String getTxid() { 145 | return txid; 146 | } 147 | 148 | /** 149 | * @param txid the txid to set 150 | */ 151 | public void setTxid(String txid) { 152 | this.txid = txid; 153 | } 154 | 155 | /** 156 | * @return the vout 157 | */ 158 | public long getVout() { 159 | return vout; 160 | } 161 | 162 | /** 163 | * @param vout the vout to set 164 | */ 165 | public void setVout(long vout) { 166 | this.vout = vout; 167 | } 168 | 169 | /** 170 | * @return the valid 171 | */ 172 | public boolean isValid() { 173 | return valid; 174 | } 175 | 176 | /** 177 | * @param valid the valid to set 178 | */ 179 | public void setValid(boolean valid) { 180 | this.valid = valid; 181 | } 182 | 183 | /** 184 | * @return the time 185 | */ 186 | public long getTime() { 187 | return time; 188 | } 189 | 190 | /** 191 | * @param time the time to set 192 | */ 193 | public void setTime(long time) { 194 | this.time = time; 195 | } 196 | 197 | /** 198 | * @return the timereceived 199 | */ 200 | public long getTimereceived() { 201 | return timereceived; 202 | } 203 | 204 | /** 205 | * @param timereceived the timereceived to set 206 | */ 207 | public void setTimereceived(long timereceived) { 208 | this.timereceived = timereceived; 209 | } 210 | 211 | } 212 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/Stream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU & Jagrut KOSTI 14 | * @version 2.0.1 15 | */ 16 | public class Stream { 17 | String name = null; 18 | String createtxid = null; 19 | String streamref = null; 20 | Boolean open = null; 21 | Object details = null; 22 | List creators; 23 | Boolean subscribed = null; 24 | Boolean synchronized_ = null; 25 | Integer items = null; 26 | Integer confirmed = null; 27 | Integer keys = null; 28 | Integer publishers = null; 29 | 30 | /* 31 | * (non-Javadoc) 32 | * 33 | * @see java.lang.Object#toString() 34 | */ 35 | @Override 36 | public String toString() { 37 | return "Stream [name=" + name + ", createtxid=" + createtxid + ", streamref=" + streamref 38 | + ", open=" + open + ", details=" + details + ", creators=" + creators + ", subscribed=" 39 | + subscribed + ", synchronized_=" + synchronized_ + ", items=" + items + ", confirmed=" 40 | + confirmed + ", keys=" + keys + ", publishers=" + publishers + "]"; 41 | } 42 | 43 | /** 44 | * @return the name 45 | */ 46 | public String getName() { 47 | return name; 48 | } 49 | 50 | /** 51 | * @param name the name to set 52 | */ 53 | public void setName(String name) { 54 | this.name = name; 55 | } 56 | 57 | /** 58 | * @return the createtxid 59 | */ 60 | public String getCreatetxid() { 61 | return createtxid; 62 | } 63 | 64 | /** 65 | * @param createtxid the createtxid to set 66 | */ 67 | public void setCreatetxid(String createtxid) { 68 | this.createtxid = createtxid; 69 | } 70 | 71 | /** 72 | * @return the streamref 73 | */ 74 | public String getStreamref() { 75 | return streamref; 76 | } 77 | 78 | /** 79 | * @param streamref the streamref to set 80 | */ 81 | public void setStreamref(String streamref) { 82 | this.streamref = streamref; 83 | } 84 | 85 | /** 86 | * @return the open 87 | */ 88 | public boolean isOpen() { 89 | return open; 90 | } 91 | 92 | /** 93 | * @param open the open to set 94 | */ 95 | public void setOpen(boolean open) { 96 | this.open = open; 97 | } 98 | 99 | /** 100 | * @return the details 101 | */ 102 | public Object getDetails() { 103 | return details; 104 | } 105 | 106 | /** 107 | * @param details the details to set 108 | */ 109 | public void setDetails(Object details) { 110 | this.details = details; 111 | } 112 | 113 | /** 114 | * @return the creators 115 | */ 116 | public List getCreators() { 117 | return creators; 118 | } 119 | 120 | /** 121 | * @param creators the creators to set 122 | */ 123 | public void setCreators(List creators) { 124 | this.creators = creators; 125 | } 126 | 127 | /** 128 | * @return the subscribed 129 | */ 130 | public boolean isSubscribed() { 131 | return subscribed; 132 | } 133 | 134 | /** 135 | * @param subscribed the subscribed to set 136 | */ 137 | public void setSubscribed(boolean subscribed) { 138 | this.subscribed = subscribed; 139 | } 140 | 141 | /** 142 | * @return the synchronized_ 143 | */ 144 | public boolean isSynchronized_() { 145 | return synchronized_; 146 | } 147 | 148 | /** 149 | * @param synchronized_ the synchronized_ to set 150 | */ 151 | public void setSynchronized_(boolean synchronized_) { 152 | this.synchronized_ = synchronized_; 153 | } 154 | 155 | /** 156 | * @return the items 157 | */ 158 | public int getItems() { 159 | return items; 160 | } 161 | 162 | /** 163 | * @param items the items to set 164 | */ 165 | public void setItems(int items) { 166 | this.items = items; 167 | } 168 | 169 | /** 170 | * @return the confirmed 171 | */ 172 | public int getConfirmed() { 173 | return confirmed; 174 | } 175 | 176 | /** 177 | * @param confirmed the confirmed to set 178 | */ 179 | public void setConfirmed(int confirmed) { 180 | this.confirmed = confirmed; 181 | } 182 | 183 | /** 184 | * @return the keys 185 | */ 186 | public int getKeys() { 187 | return keys; 188 | } 189 | 190 | /** 191 | * @param keys the keys to set 192 | */ 193 | public void setKeys(int keys) { 194 | this.keys = keys; 195 | } 196 | 197 | /** 198 | * @return the publishers 199 | */ 200 | public int getPublishers() { 201 | return publishers; 202 | } 203 | 204 | /** 205 | * @param publishers the publishers to set 206 | */ 207 | public void setPublishers(int publishers) { 208 | this.publishers = publishers; 209 | } 210 | } 211 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/TransactionCurrency.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | /** 11 | * @author Ub - H. MARTEAU 12 | * @version 2.0.1 13 | */ 14 | public class TransactionCurrency { 15 | String account = null; 16 | String address = null; 17 | String category = null; 18 | Double amount = null; 19 | Long vout = null; 20 | Double fee = null; 21 | Long confirmations = null; 22 | String blockhash = null; 23 | Long blockindex = null; 24 | Long blocktime = null; 25 | String txid = null; 26 | Long time = null; 27 | Long timereceived = null; 28 | String comment = null; 29 | String to = null; 30 | 31 | /** 32 | * @return the account 33 | */ 34 | public String getAccount() { 35 | return account; 36 | } 37 | 38 | /** 39 | * @param account the account to set 40 | */ 41 | public void setAccount(String account) { 42 | this.account = account; 43 | } 44 | 45 | /** 46 | * @return the address 47 | */ 48 | public String getAddress() { 49 | return address; 50 | } 51 | 52 | /** 53 | * @param address the address to set 54 | */ 55 | public void setAddress(String address) { 56 | this.address = address; 57 | } 58 | 59 | /** 60 | * @return the category 61 | */ 62 | public String getCategory() { 63 | return category; 64 | } 65 | 66 | /** 67 | * @param category the category to set 68 | */ 69 | public void setCategory(String category) { 70 | this.category = category; 71 | } 72 | 73 | /** 74 | * @return the amount 75 | */ 76 | public Double getAmount() { 77 | return amount; 78 | } 79 | 80 | /** 81 | * @param amount the amount to set 82 | */ 83 | public void setAmount(Double amount) { 84 | this.amount = amount; 85 | } 86 | 87 | /** 88 | * @return the vout 89 | */ 90 | public Long getVout() { 91 | return vout; 92 | } 93 | 94 | /** 95 | * @param vout the vout to set 96 | */ 97 | public void setVout(Long vout) { 98 | this.vout = vout; 99 | } 100 | 101 | /** 102 | * @return the fee 103 | */ 104 | public Double getFee() { 105 | return fee; 106 | } 107 | 108 | /** 109 | * @param fee the fee to set 110 | */ 111 | public void setFee(Double fee) { 112 | this.fee = fee; 113 | } 114 | 115 | /** 116 | * @return the confirmations 117 | */ 118 | public Long getConfirmations() { 119 | return confirmations; 120 | } 121 | 122 | /** 123 | * @param confirmations the confirmations to set 124 | */ 125 | public void setConfirmations(Long confirmations) { 126 | this.confirmations = confirmations; 127 | } 128 | 129 | /** 130 | * @return the blockhash 131 | */ 132 | public String getBlockhash() { 133 | return blockhash; 134 | } 135 | 136 | /** 137 | * @param blockhash the blockhash to set 138 | */ 139 | public void setBlockhash(String blockhash) { 140 | this.blockhash = blockhash; 141 | } 142 | 143 | /** 144 | * @return the blockindex 145 | */ 146 | public Long getBlockindex() { 147 | return blockindex; 148 | } 149 | 150 | /** 151 | * @param blockindex the blockindex to set 152 | */ 153 | public void setBlockindex(Long blockindex) { 154 | this.blockindex = blockindex; 155 | } 156 | 157 | /** 158 | * @return the blocktime 159 | */ 160 | public Long getBlocktime() { 161 | return blocktime; 162 | } 163 | 164 | /** 165 | * @param blocktime the blocktime to set 166 | */ 167 | public void setBlocktime(Long blocktime) { 168 | this.blocktime = blocktime; 169 | } 170 | 171 | /** 172 | * @return the txid 173 | */ 174 | public String getTxid() { 175 | return txid; 176 | } 177 | 178 | /** 179 | * @param txid the txid to set 180 | */ 181 | public void setTxid(String txid) { 182 | this.txid = txid; 183 | } 184 | 185 | /** 186 | * @return the time 187 | */ 188 | public Long getTime() { 189 | return time; 190 | } 191 | 192 | /** 193 | * @param time the time to set 194 | */ 195 | public void setTime(Long time) { 196 | this.time = time; 197 | } 198 | 199 | /** 200 | * @return the timereceived 201 | */ 202 | public Long getTimereceived() { 203 | return timereceived; 204 | } 205 | 206 | /** 207 | * @param timereceived the timereceived to set 208 | */ 209 | public void setTimereceived(Long timereceived) { 210 | this.timereceived = timereceived; 211 | } 212 | 213 | /** 214 | * @return the comment 215 | */ 216 | public String getComment() { 217 | return comment; 218 | } 219 | 220 | /** 221 | * @param comment the comment to set 222 | */ 223 | public void setComment(String comment) { 224 | this.comment = comment; 225 | } 226 | 227 | /** 228 | * @return the to 229 | */ 230 | public String getTo() { 231 | return to; 232 | } 233 | 234 | /** 235 | * @param to the to to set 236 | */ 237 | public void setTo(String to) { 238 | this.to = to; 239 | } 240 | 241 | 242 | } 243 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/BlockTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | public class BlockTemplate { 18 | Long version = null; 19 | Double previousblockhash = null; 20 | List transactions = null; 21 | Map coinbaseaux = null; 22 | Long coinbasevalue = null; 23 | String coinbasetxn = null; 24 | String target = null; 25 | String mintime = null; 26 | List mutable = null; 27 | String noncerange = null; 28 | Long sigoplimit = null; 29 | Long sizelimit = null; 30 | Long curtime = null; 31 | String bits = null; 32 | Long height = null; 33 | 34 | /** 35 | * @return the version 36 | */ 37 | public Long getVersion() { 38 | return version; 39 | } 40 | 41 | /** 42 | * @param version the version to set 43 | */ 44 | public void setVersion(Long version) { 45 | this.version = version; 46 | } 47 | 48 | /** 49 | * @return the previousblockhash 50 | */ 51 | public Double getPreviousblockhash() { 52 | return previousblockhash; 53 | } 54 | 55 | /** 56 | * @param previousblockhash the previousblockhash to set 57 | */ 58 | public void setPreviousblockhash(Double previousblockhash) { 59 | this.previousblockhash = previousblockhash; 60 | } 61 | 62 | /** 63 | * @return the transactions 64 | */ 65 | public List getTransactions() { 66 | return transactions; 67 | } 68 | 69 | /** 70 | * @param transactions the transactions to set 71 | */ 72 | public void setTransactions(List transactions) { 73 | this.transactions = transactions; 74 | } 75 | 76 | /** 77 | * @return the coinbaseaux 78 | */ 79 | public Map getCoinbaseaux() { 80 | return coinbaseaux; 81 | } 82 | 83 | /** 84 | * @param coinbaseaux the coinbaseaux to set 85 | */ 86 | public void setCoinbaseaux(Map coinbaseaux) { 87 | this.coinbaseaux = coinbaseaux; 88 | } 89 | 90 | /** 91 | * @return the coinbasevalue 92 | */ 93 | public Long getCoinbasevalue() { 94 | return coinbasevalue; 95 | } 96 | 97 | /** 98 | * @param coinbasevalue the coinbasevalue to set 99 | */ 100 | public void setCoinbasevalue(Long coinbasevalue) { 101 | this.coinbasevalue = coinbasevalue; 102 | } 103 | 104 | /** 105 | * @return the coinbasetxn 106 | */ 107 | public String getCoinbasetxn() { 108 | return coinbasetxn; 109 | } 110 | 111 | /** 112 | * @param coinbasetxn the coinbasetxn to set 113 | */ 114 | public void setCoinbasetxn(String coinbasetxn) { 115 | this.coinbasetxn = coinbasetxn; 116 | } 117 | 118 | /** 119 | * @return the target 120 | */ 121 | public String getTarget() { 122 | return target; 123 | } 124 | 125 | /** 126 | * @param target the target to set 127 | */ 128 | public void setTarget(String target) { 129 | this.target = target; 130 | } 131 | 132 | /** 133 | * @return the mintime 134 | */ 135 | public String getMintime() { 136 | return mintime; 137 | } 138 | 139 | /** 140 | * @param mintime the mintime to set 141 | */ 142 | public void setMintime(String mintime) { 143 | this.mintime = mintime; 144 | } 145 | 146 | /** 147 | * @return the mutable 148 | */ 149 | public List getMutable() { 150 | return mutable; 151 | } 152 | 153 | /** 154 | * @param mutable the mutable to set 155 | */ 156 | public void setMutable(List mutable) { 157 | this.mutable = mutable; 158 | } 159 | 160 | /** 161 | * @return the noncerange 162 | */ 163 | public String getNoncerange() { 164 | return noncerange; 165 | } 166 | 167 | /** 168 | * @param noncerange the noncerange to set 169 | */ 170 | public void setNoncerange(String noncerange) { 171 | this.noncerange = noncerange; 172 | } 173 | 174 | /** 175 | * @return the sigoplimit 176 | */ 177 | public Long getSigoplimit() { 178 | return sigoplimit; 179 | } 180 | 181 | /** 182 | * @param sigoplimit the sigoplimit to set 183 | */ 184 | public void setSigoplimit(Long sigoplimit) { 185 | this.sigoplimit = sigoplimit; 186 | } 187 | 188 | /** 189 | * @return the sizelimit 190 | */ 191 | public Long getSizelimit() { 192 | return sizelimit; 193 | } 194 | 195 | /** 196 | * @param sizelimit the sizelimit to set 197 | */ 198 | public void setSizelimit(Long sizelimit) { 199 | this.sizelimit = sizelimit; 200 | } 201 | 202 | /** 203 | * @return the curtime 204 | */ 205 | public Long getCurtime() { 206 | return curtime; 207 | } 208 | 209 | /** 210 | * @param curtime the curtime to set 211 | */ 212 | public void setCurtime(Long curtime) { 213 | this.curtime = curtime; 214 | } 215 | 216 | /** 217 | * @return the bits 218 | */ 219 | public String getBits() { 220 | return bits; 221 | } 222 | 223 | /** 224 | * @param bits the bits to set 225 | */ 226 | public void setBits(String bits) { 227 | this.bits = bits; 228 | } 229 | 230 | /** 231 | * @return the height 232 | */ 233 | public Long getHeight() { 234 | return height; 235 | } 236 | 237 | /** 238 | * @param height the height to set 239 | */ 240 | public void setHeight(Long height) { 241 | this.height = height; 242 | } 243 | 244 | 245 | } 246 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/Block.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * @author Ub - H. MARTEAU 15 | * @version 2.0.1 16 | */ 17 | public class Block { 18 | String hash = null; 19 | String miner = null; 20 | Long confirmations = null; 21 | Long size = null; 22 | Long height = null; 23 | Long version = null; 24 | String merkleroot = null; 25 | List tx; 26 | Long time = null; 27 | Long nonce = null; 28 | String bits = null; 29 | Double difficulty = null; 30 | String chainwork = null; 31 | String previousblockhash = null; 32 | String nextblockhash = null; 33 | 34 | /** 35 | * 36 | */ 37 | public Block() { 38 | super(); 39 | tx = new ArrayList(); 40 | } 41 | 42 | /** 43 | * @return the hash 44 | */ 45 | public String getHash() { 46 | return hash; 47 | } 48 | 49 | /** 50 | * @param hash the hash to set 51 | */ 52 | public void setHash(String hash) { 53 | this.hash = hash; 54 | } 55 | 56 | /** 57 | * @return the miner 58 | */ 59 | public String getMiner() { 60 | return miner; 61 | } 62 | 63 | /** 64 | * @param miner the miner to set 65 | */ 66 | public void setMiner(String miner) { 67 | this.miner = miner; 68 | } 69 | 70 | /** 71 | * @return the confirmations 72 | */ 73 | public long getConfirmations() { 74 | return confirmations; 75 | } 76 | 77 | /** 78 | * @param confirmations the confirmations to set 79 | */ 80 | public void setConfirmations(long confirmations) { 81 | this.confirmations = confirmations; 82 | } 83 | 84 | /** 85 | * @return the size 86 | */ 87 | public long getSize() { 88 | return size; 89 | } 90 | 91 | /** 92 | * @param size the size to set 93 | */ 94 | public void setSize(long size) { 95 | this.size = size; 96 | } 97 | 98 | /** 99 | * @return the height 100 | */ 101 | public long getHeight() { 102 | return height; 103 | } 104 | 105 | /** 106 | * @param height the height to set 107 | */ 108 | public void setHeight(long height) { 109 | this.height = height; 110 | } 111 | 112 | /** 113 | * @return the version 114 | */ 115 | public long getVersion() { 116 | return version; 117 | } 118 | 119 | /** 120 | * @param version the version to set 121 | */ 122 | public void setVersion(long version) { 123 | this.version = version; 124 | } 125 | 126 | /** 127 | * @return the merkleroot 128 | */ 129 | public String getMerkleroot() { 130 | return merkleroot; 131 | } 132 | 133 | /** 134 | * @param merkleroot the merkleroot to set 135 | */ 136 | public void setMerkleroot(String merkleroot) { 137 | this.merkleroot = merkleroot; 138 | } 139 | 140 | /** 141 | * @return the tx 142 | */ 143 | public List getTx() { 144 | return tx; 145 | } 146 | 147 | /** 148 | * @param tx the tx to set 149 | */ 150 | public void setTx(List tx) { 151 | this.tx = tx; 152 | } 153 | 154 | /** 155 | * @param tx the tx to set 156 | */ 157 | public void addTx(String value) { 158 | this.tx.add(value); 159 | } 160 | 161 | 162 | /** 163 | * @return the time 164 | */ 165 | public long getTime() { 166 | return time; 167 | } 168 | 169 | /** 170 | * @param time the time to set 171 | */ 172 | public void setTime(long time) { 173 | this.time = time; 174 | } 175 | 176 | /** 177 | * @return the nonce 178 | */ 179 | public long getNonce() { 180 | return nonce; 181 | } 182 | 183 | /** 184 | * @param nonce the nonce to set 185 | */ 186 | public void setNonce(long nonce) { 187 | this.nonce = nonce; 188 | } 189 | 190 | /** 191 | * @return the bits 192 | */ 193 | public String getBits() { 194 | return bits; 195 | } 196 | 197 | /** 198 | * @param bits the bits to set 199 | */ 200 | public void setBits(String bits) { 201 | this.bits = bits; 202 | } 203 | 204 | /** 205 | * @return the difficulty 206 | */ 207 | public double getDifficulty() { 208 | return difficulty; 209 | } 210 | 211 | /** 212 | * @param difficulty the difficulty to set 213 | */ 214 | public void setDifficulty(double difficulty) { 215 | this.difficulty = difficulty; 216 | } 217 | 218 | /** 219 | * @return the chainwork 220 | */ 221 | public String getChainwork() { 222 | return chainwork; 223 | } 224 | 225 | /** 226 | * @param chainwork the chainwork to set 227 | */ 228 | public void setChainwork(String chainwork) { 229 | this.chainwork = chainwork; 230 | } 231 | 232 | /** 233 | * @return the previousblockhash 234 | */ 235 | public String getPreviousblockhash() { 236 | return previousblockhash; 237 | } 238 | 239 | /** 240 | * @param previousblockhash the previousblockhash to set 241 | */ 242 | public void setPreviousblockhash(String previousblockhash) { 243 | this.previousblockhash = previousblockhash; 244 | } 245 | 246 | /** 247 | * @return the nextblockhash 248 | */ 249 | public String getNextblockhash() { 250 | return nextblockhash; 251 | } 252 | 253 | /** 254 | * @param nextblockhash the nextblockhash to set 255 | */ 256 | public void setNextblockhash(String nextblockhash) { 257 | this.nextblockhash = nextblockhash; 258 | } 259 | 260 | public String toStringTx() { 261 | String toString = " - "; 262 | for (String value : tx) { 263 | toString += value + " - "; 264 | } 265 | return toString; 266 | } 267 | 268 | /* 269 | * (non-Javadoc) 270 | * 271 | * @see java.lang.Object#toString() 272 | */ 273 | @Override 274 | public String toString() { 275 | return "Block [hash=" + hash + ", miner=" + miner + ", confirmations=" + confirmations 276 | + ", size=" + size + ", height=" + height + ", version=" + version + ", merkleroot=" 277 | + merkleroot + ", tx=" + toStringTx() + ", time=" + time + ", nonce=" + nonce + ", bits=" 278 | + bits + ", difficulty=" + difficulty + ", chainwork=" + chainwork + ", previousblockhash=" 279 | + previousblockhash + ", nextblockhash=" + nextblockhash + "]"; 280 | } 281 | 282 | 283 | } 284 | -------------------------------------------------------------------------------- /src/main/java/multichain/command/QueryBuilderCommon.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.command; 9 | 10 | import java.io.IOException; 11 | import java.io.UnsupportedEncodingException; 12 | import java.util.ArrayList; 13 | import java.util.Arrays; 14 | import java.util.HashMap; 15 | import java.util.List; 16 | import java.util.Map; 17 | import java.util.UUID; 18 | import org.apache.http.HttpEntity; 19 | import org.apache.http.auth.AuthScope; 20 | import org.apache.http.auth.UsernamePasswordCredentials; 21 | import org.apache.http.client.ClientProtocolException; 22 | import org.apache.http.client.CredentialsProvider; 23 | import org.apache.http.client.methods.CloseableHttpResponse; 24 | import org.apache.http.client.methods.HttpPost; 25 | import org.apache.http.entity.StringEntity; 26 | import org.apache.http.impl.client.BasicCredentialsProvider; 27 | import org.apache.http.impl.client.CloseableHttpClient; 28 | import org.apache.http.impl.client.HttpClientBuilder; 29 | import org.apache.http.util.EntityUtils; 30 | import com.google.gson.Gson; 31 | import com.google.gson.GsonBuilder; 32 | import com.google.gson.internal.LinkedTreeMap; 33 | import multichain.object.MultiChainRPCAnswer; 34 | import multichain.object.formatters.GsonFormatters; 35 | 36 | /** 37 | * @author Ub - H. MARTEAU 38 | * @version 2.0.1 39 | */ 40 | abstract class QueryBuilderCommon extends GsonFormatters { 41 | 42 | private CloseableHttpClient httpclient = null; 43 | private HttpPost httppost = null; 44 | private RuntimeParameters queryParameters = null; 45 | 46 | 47 | protected QueryBuilderCommon() { 48 | super(); 49 | } 50 | 51 | protected void initialize(String ip, String port, String login, String password, 52 | RuntimeParameters queryParameter) { 53 | httppost = new HttpPost("http://" + ip + ":" + port); 54 | 55 | CredentialsProvider provider = new BasicCredentialsProvider(); 56 | UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(login, password); 57 | provider.setCredentials(AuthScope.ANY, credentials); 58 | queryParameters = queryParameter; 59 | 60 | httpclient = HttpClientBuilder.create().setDefaultCredentialsProvider(provider).build(); 61 | 62 | } 63 | 64 | /** 65 | * 66 | * @param command 67 | * @param parameters 68 | * 69 | * @return 70 | * 71 | * example : MultichainQueryBuidlder.executeProcess(MultichainCommand .SENDTOADDRESS, 72 | * "1EyXuq2JVrj4E3CpM9iNGNSqBpZ2iTPdwGKgvf {\"rdcoin\":0.01}" 73 | * @throws MultichainException 74 | */ 75 | protected Object execute(CommandElt command, Object... parameters) throws MultichainException { 76 | 77 | if (httpclient != null && httppost != null) { 78 | try { 79 | // Generate Mapping of calling arguments 80 | Map entityValues = prepareMap(this.queryParameters, command, parameters); 81 | // Generate the entity and initialize request 82 | StringEntity rpcEntity = prepareRpcEntity(entityValues); 83 | httppost.setEntity(rpcEntity); 84 | // Execute the request and get the answer 85 | return executeRequest(); 86 | 87 | } catch (IOException e) { 88 | e.printStackTrace(); 89 | throw new MultichainException(null, e.toString()); 90 | } 91 | } else { 92 | throw new MultichainException("Initialization Problem", 93 | "MultiChainCommand not initialized, please specify ip, port, user and pwd !"); 94 | } 95 | } 96 | 97 | 98 | protected StringEntity prepareRpcEntity(Map entityValues) 99 | throws UnsupportedEncodingException { 100 | return new StringEntity(formatJson(entityValues)); 101 | } 102 | 103 | private Object executeRequest() throws IOException, ClientProtocolException, MultichainException { 104 | CloseableHttpResponse response = httpclient.execute(httppost); 105 | 106 | HttpEntity entity = response.getEntity(); 107 | 108 | String rpcAnswer = EntityUtils.toString(entity); 109 | response.close(); 110 | 111 | final Gson gson = new GsonBuilder().create(); 112 | final MultiChainRPCAnswer multiChainRPCAnswer = 113 | gson.fromJson(rpcAnswer, MultiChainRPCAnswer.class); 114 | 115 | if (multiChainRPCAnswer != null && multiChainRPCAnswer.getError() == null) { 116 | return multiChainRPCAnswer.getResult(); 117 | } else if (multiChainRPCAnswer != null && multiChainRPCAnswer.getError() != null) { 118 | throw new MultichainException( 119 | "code :" + multiChainRPCAnswer.getError().get("code").toString(), 120 | "message : " + multiChainRPCAnswer.getError().get("message").toString()); 121 | } else { 122 | throw new MultichainException(null, "General RPC Exceution Technical Error"); 123 | } 124 | } 125 | 126 | private Map prepareMap(RuntimeParameters queryparameter, CommandElt command, 127 | Object... parameters) { 128 | Map entityValues = new HashMap(); 129 | entityValues.put("id", UUID.randomUUID().toString()); 130 | if (queryparameter != null) { 131 | if (queryparameter.getDatadir() != null && !queryparameter.getDatadir().isEmpty()) { 132 | entityValues.put("datadir", queryparameter.getDatadir()); 133 | } 134 | if (queryparameter.getRpcport() != null && !queryparameter.getRpcport().isEmpty()) { 135 | entityValues.put("rpcport", queryparameter.getRpcport()); 136 | } 137 | } 138 | entityValues.put("method", command.getCommandline()); 139 | List paramList = new ArrayList(Arrays.asList(parameters)); 140 | entityValues.put("params", paramList); 141 | return entityValues; 142 | } 143 | 144 | @SuppressWarnings("rawtypes") 145 | protected boolean verifyInstance(Object obj, Class TheClass) { 146 | return TheClass.isInstance(obj); 147 | } 148 | 149 | @SuppressWarnings("rawtypes") 150 | protected boolean verifyInstanceofList(List obj, Class TheClass) { 151 | boolean verify = true; 152 | 153 | // Verify only the first Element of the list 154 | if (obj.size() > 0) { 155 | Object objElt = obj.get(0); 156 | if (!LinkedTreeMap.class.isInstance(objElt)) { 157 | verify = TheClass.isInstance(objElt); 158 | } 159 | } 160 | 161 | return verify; 162 | } 163 | 164 | } 165 | -------------------------------------------------------------------------------- /src/main/java/multichain/object/BalanceAsset.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Worldline, Inc. 3 | * 4 | * MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file. 5 | * https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE 6 | * 7 | */ 8 | package multichain.object; 9 | 10 | import java.util.Map; 11 | 12 | /** 13 | * @author Ub - H. MARTEAU 14 | * @version 2.0.1 15 | */ 16 | public class BalanceAsset { 17 | String name = null; 18 | String issuetxid = null; 19 | String assetref = null; 20 | Long multiple = null; 21 | Double units = null; 22 | Boolean open = null; 23 | Map details = null; 24 | Map restrict = null; 25 | Double qty = null; 26 | Long raw = null; 27 | Double issueqty = null; 28 | Long issueraw = null; 29 | Boolean subscribed = null; 30 | String type = null; 31 | 32 | /* 33 | * (non-Javadoc) 34 | * 35 | * @see java.lang.Object#toString() 36 | */ 37 | @Override 38 | public String toString() { 39 | return "BalanceAsset [name=" + name + ", issuetxid=" + issuetxid + ", assetref=" + assetref 40 | + ", multiple=" + multiple + ", units=" + units + ", open=" + open + ", details=" + details 41 | + ", restrict=" + restrict 42 | + ", qty=" + qty + ", raw=" + raw + ", issueqty=" + issueqty + ", issueraw=" + issueraw 43 | + ", subscribed=" + subscribed + "]"; 44 | } 45 | 46 | /** 47 | * get restrict 48 | * @return 49 | */ 50 | public Map getRestrict() { 51 | return restrict; 52 | } 53 | 54 | /** 55 | * set restrict 56 | * @param restrict 57 | */ 58 | public void setRestrict(Map restrict) { 59 | this.restrict = restrict; 60 | } 61 | 62 | /** 63 | * 64 | */ 65 | public BalanceAsset() { 66 | super(); 67 | } 68 | 69 | /** 70 | * @return the multiple 71 | */ 72 | public long getMultiple() { 73 | return multiple; 74 | } 75 | 76 | /** 77 | * @param multiple the multiple to set 78 | */ 79 | public void setMultiple(long multiple) { 80 | this.multiple = multiple; 81 | } 82 | 83 | /** 84 | * @return the units 85 | */ 86 | public double getUnits() { 87 | return units; 88 | } 89 | 90 | /** 91 | * @param units the units to set 92 | */ 93 | public void setUnits(double units) { 94 | this.units = units; 95 | } 96 | 97 | /** 98 | * @return the open 99 | */ 100 | public boolean isOpen() { 101 | return open; 102 | } 103 | 104 | /** 105 | * @param open the open to set 106 | */ 107 | public void setOpen(boolean open) { 108 | this.open = open; 109 | } 110 | 111 | /** 112 | * @return the details 113 | */ 114 | public Map getDetails() { 115 | return details; 116 | } 117 | 118 | /** 119 | * @param details the details to set 120 | */ 121 | public void setDetails(Map details) { 122 | this.details = details; 123 | } 124 | 125 | /** 126 | * @return the assetref 127 | */ 128 | public String getAssetref() { 129 | return assetref; 130 | } 131 | 132 | /** 133 | * @param assetref the assetref to set 134 | */ 135 | public void setAssetref(String assetref) { 136 | this.assetref = assetref; 137 | } 138 | 139 | /** 140 | * @return the issuetxid 141 | */ 142 | public String getIssuetxid() { 143 | return issuetxid; 144 | } 145 | 146 | /** 147 | * @param issuetxid the issuetxid to set 148 | */ 149 | public void setIssuetxid(String issuetxid) { 150 | this.issuetxid = issuetxid; 151 | } 152 | 153 | /** 154 | * @return the subscribed 155 | */ 156 | public boolean isSubscribed() { 157 | return subscribed; 158 | } 159 | 160 | /** 161 | * @param subscribed the subscribed to set 162 | */ 163 | public void setSubscribed(boolean subscribed) { 164 | this.subscribed = subscribed; 165 | } 166 | 167 | /** 168 | * @return the name 169 | */ 170 | public String getName() { 171 | return name; 172 | } 173 | 174 | /** 175 | * @param name the name to set 176 | */ 177 | public void setName(String name) { 178 | this.name = name; 179 | } 180 | 181 | /** 182 | * @return the open 183 | */ 184 | public Boolean getOpen() { 185 | return open; 186 | } 187 | 188 | /** 189 | * @param open the open to set 190 | */ 191 | public void setOpen(Boolean open) { 192 | this.open = open; 193 | } 194 | 195 | /** 196 | * @return the qty 197 | */ 198 | public Double getQty() { 199 | return qty; 200 | } 201 | 202 | /** 203 | * @param qty the qty to set 204 | */ 205 | public void setQty(Double qty) { 206 | this.qty = qty; 207 | } 208 | 209 | /** 210 | * @return the raw 211 | */ 212 | public Long getRaw() { 213 | return raw; 214 | } 215 | 216 | /** 217 | * @param raw the raw to set 218 | */ 219 | public void setRaw(Long raw) { 220 | this.raw = raw; 221 | } 222 | 223 | /** 224 | * @return the subscribed 225 | */ 226 | public Boolean getSubscribed() { 227 | return subscribed; 228 | } 229 | 230 | /** 231 | * @param subscribed the subscribed to set 232 | */ 233 | public void setSubscribed(Boolean subscribed) { 234 | this.subscribed = subscribed; 235 | } 236 | 237 | /** 238 | * @return the type 239 | */ 240 | public String getType() { 241 | return type; 242 | } 243 | 244 | /** 245 | * @param type the type to set 246 | */ 247 | public void setType(String type) { 248 | this.type = type; 249 | } 250 | 251 | /** 252 | * @param multiple the multiple to set 253 | */ 254 | public void setMultiple(Long multiple) { 255 | this.multiple = multiple; 256 | } 257 | 258 | /** 259 | * @param units the units to set 260 | */ 261 | public void setUnits(Double units) { 262 | this.units = units; 263 | } 264 | 265 | /** 266 | * @return the issueqty 267 | */ 268 | public Double getIssueqty() { 269 | return issueqty; 270 | } 271 | 272 | /** 273 | * @param issueqty the issueqty to set 274 | */ 275 | public void setIssueqty(Double issueqty) { 276 | this.issueqty = issueqty; 277 | } 278 | 279 | /** 280 | * @return the issueraw 281 | */ 282 | public Long getIssueraw() { 283 | return issueraw; 284 | } 285 | 286 | /** 287 | * @param issueraw the issueraw to set 288 | */ 289 | public void setIssueraw(Long issueraw) { 290 | this.issueraw = issueraw; 291 | } 292 | 293 | } 294 | --------------------------------------------------------------------------------