Skip to content

Commit d9ea5e3

Browse files
author
ub
committed
Little issue correction to allow transaction with currency value at 0.0
1 parent 70639c0 commit d9ea5e3

File tree

4 files changed

+231
-8
lines changed

4 files changed

+231
-8
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.multichainjavaapi</groupId>
55
<artifactId>MultiChainJavaAPI</artifactId>
6-
<version>0.4.16-SNAPSHOT</version>
6+
<version>0.4.17-SNAPSHOT</version>
77

88
<properties>
99
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

src/main/java/multichain/command/builders/QueryBuilderRAWTransaction.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/**
2323
* @author Ub - H. MARTEAU
24-
* @version 4.16
24+
* @version 4.17
2525
*/
2626
public class QueryBuilderRAWTransaction extends QueryBuilderCommon {
2727

@@ -295,13 +295,16 @@ protected Object executeCreateRawTransaction(List<TxIdVout> inputs, List<Address
295295
input.isFilled();
296296
}
297297

298-
if (addessBalances == null || addessBalances.isEmpty()) {
299-
throw new MultichainException("Address Balance", "Address Balance needed to create a RAW Transaction");
300-
}
298+
// if (addessBalances == null || addessBalances.isEmpty()) {
299+
// throw new MultichainException("Address Balance", "Address Balance needed to create a RAW Transaction");
300+
// }
301+
//addessBalances can be null or empty in case of call for Stream Creation : only data is present
301302
Map<String, Object> mapOuput = new HashMap<String, Object>();
302-
for (AddressBalance addessBalance : addessBalances) {
303-
addessBalance.isFilled();
304-
mapOuput.put(addessBalance.getAddress(), addessBalance.getValue());
303+
if (addessBalances != null && !addessBalances.isEmpty()) {
304+
for (AddressBalance addessBalance : addessBalances) {
305+
addessBalance.isFilled();
306+
mapOuput.put(addessBalance.getAddress(), addessBalance.getValue());
307+
}
305308
}
306309

307310
if (data != null) {
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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 4.17
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 parameter value
24+
// ,...
25+
// }
26+
27+
private String create = "stream";
28+
private String name = null;
29+
private Boolean open = null;
30+
private Map<String, String> details = null;
31+
32+
@Override
33+
public DataParamCreate getFormatedvalue() {
34+
return this;
35+
}
36+
37+
/**
38+
*
39+
*/
40+
public DataParamCreate() {
41+
super();
42+
// TODO Auto-generated constructor stub
43+
}
44+
45+
/**
46+
* @param create
47+
* @param name
48+
* @param open
49+
* @param details
50+
*/
51+
public DataParamCreate(String create, String name, Boolean open, Map<String, String> details) {
52+
this.create = create;
53+
this.name = name;
54+
this.open = open;
55+
this.details = details;
56+
}
57+
58+
/**
59+
* @return the create
60+
*/
61+
public String getCreate() {
62+
return create;
63+
}
64+
65+
/**
66+
* @return the name
67+
*/
68+
public String getName() {
69+
return name;
70+
}
71+
72+
/**
73+
* @param name the name to set
74+
*/
75+
public void setName(String name) {
76+
this.name = name;
77+
}
78+
79+
/**
80+
* @return the open
81+
*/
82+
public Boolean getOpen() {
83+
return open;
84+
}
85+
86+
/**
87+
* @param open the open to set
88+
*/
89+
public void setOpen(Boolean open) {
90+
this.open = open;
91+
}
92+
93+
/**
94+
* @return the details
95+
*/
96+
public Map<String, String> getDetails() {
97+
return details;
98+
}
99+
100+
/**
101+
* @param details the details to set
102+
*/
103+
public void setDetails(Map<String, String> details) {
104+
this.details = details;
105+
}
106+
107+
/**
108+
* @param details the details to set
109+
*/
110+
public void addDetails(CustomParamString detail) {
111+
if (details == null) {
112+
details = new HashMap<>();
113+
}
114+
details.put(detail.getName(), detail.getValue());
115+
}
116+
117+
118+
119+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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 4.17
16+
*/
17+
public class DataParamStreamItem implements DataParam {
18+
// "for" : stream-identifier (string,required) Stream identifier - one of the following: stream txid, stream reference, stream name.
19+
// "key" : key (string,optional, default: "") Item key
20+
// "data" : data-hex (string,optional, default: "") Data hex string
21+
22+
private String for_;
23+
private String key;
24+
private String data;
25+
26+
27+
@Override
28+
public Map<String, String> getFormatedvalue() {
29+
Map<String, String> value = new HashMap<>();
30+
31+
value.put("for", for_);
32+
value.put("key", key);
33+
value.put("data", data);
34+
35+
return value;
36+
}
37+
38+
/**
39+
*
40+
*/
41+
public DataParamStreamItem() {
42+
super();
43+
// TODO Auto-generated constructor stub
44+
}
45+
46+
/**
47+
* @param for_
48+
* @param key
49+
* @param data
50+
*/
51+
public DataParamStreamItem(String for_, String key, String data) {
52+
this.for_ = for_;
53+
this.key = key;
54+
this.data = data;
55+
}
56+
57+
/**
58+
* @return the for_
59+
*/
60+
public String getFor() {
61+
return for_;
62+
}
63+
64+
/**
65+
* @param for_ the for_ to set
66+
*/
67+
public void setFor(String for_) {
68+
this.for_ = for_;
69+
}
70+
71+
/**
72+
* @return the key
73+
*/
74+
public String getKey() {
75+
return key;
76+
}
77+
78+
/**
79+
* @param key the key to set
80+
*/
81+
public void setKey(String key) {
82+
this.key = key;
83+
}
84+
85+
/**
86+
* @return the data
87+
*/
88+
public String getData() {
89+
return data;
90+
}
91+
92+
/**
93+
* @param data the data to set
94+
*/
95+
public void setData(String data) {
96+
this.data = data;
97+
}
98+
99+
100+
101+
}

0 commit comments

Comments
 (0)