Skip to content

Commit a802550

Browse files
Kristjan Kosicspkjp
authored andcommitted
refactor: changes to Transaction object class (#34)
* Added method to return HashMap of transaction. * Version bump * chore: changelog
1 parent 54df022 commit a802550

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## Unreleased
99

10+
## 0.1.3 - 2019-25-04
11+
12+
### Fixed
13+
- Adjusted the JSON to Java Object conversion to support stricter incoming validation on the core.
14+
1015
## 0.1.2 - 2018-12-11
1116

1217
### Changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ uploadArchives {
4646

4747
pom.project {
4848
groupId = 'org.arkecosystem'
49-
version = '0.1.2'
49+
version = '0.1.3'
5050
artifactId = 'crypto'
5151

5252
name = 'java-crypto'

src/main/java/org/arkecosystem/crypto/transactions/Transaction.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,11 @@ public String serialize() {
214214
}
215215

216216
public String toJson() {
217+
GsonBuilder gsonBuilder = new GsonBuilder();
218+
return gsonBuilder.create().toJson(this.toHashMap());
219+
}
217220

221+
public HashMap toHashMap() {
218222
HashMap<String, Object> map = new HashMap<String, Object>();
219223
map.put("network", this.network);
220224
map.put("id", this.id);
@@ -257,9 +261,7 @@ public String toJson() {
257261
if (!asset.isEmpty()) {
258262
map.put("asset", asset);
259263
}
260-
261-
GsonBuilder gsonBuilder = new GsonBuilder();
262-
return gsonBuilder.create().toJson(map);
264+
return map;
263265
}
264266

265267
private static class TransactionTypeDeserializer implements
@@ -278,5 +280,3 @@ public JsonElement serialize(Types src, Type typeOfSrc, JsonSerializationContext
278280
}
279281
}
280282
}
281-
282-

0 commit comments

Comments
 (0)