Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit b9d025c

Browse files
authored
Accounts beta release - 1.0.0-beta4 (#157)
* Event management system * Account builder and API builder rewrite for re-usability * Split storage and config modules * Reattach/Promote plugin (runs every 30 seconds, excluding POW time when doing local) * Incoming transfer plugin * Outgoing transfer plugin * Added account state and deposit methods * load/save account state using JSON file * Added a custom seed provider * Address generation cache * Added shutdown event, called before account "shutdown()" * Added some documentation and tests to account module * Added javadoc to connection, allow custom connection methods * Updated to Junit 5 (tests are still Junit 4 using legacy plugin) * Added QRCode and Magnet link creation from a CDA * Addded a MongoDB storage class * Organised imports
1 parent b5df0ce commit b9d025c

File tree

226 files changed

+13087
-929
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+13087
-929
lines changed

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ To download the IOTA Java client library and its dependencies, you can use one o
6969
7070
```gradle
7171
dependencies {
72-
compile 'com.github.iotaledger:iota-java:1.0.0-beta3'
72+
compile 'com.github.iotaledger:iota-java:1.0.0-beta4'
7373
}
7474
```
7575
@@ -96,7 +96,7 @@ To download the IOTA Java client library and its dependencies, you can use one o
9696
```
9797
9898
3. Change the value of the `<version>` tag to either a release number or the first 10 characters of a Git commit hash:
99-
`<version>a98de8ea50</version>` or `<version>1.0.0-beta3</version>`
99+
`<version>51adea1b25</version>` or `<version>1.0.0-beta4</version>`
100100
101101
**Note:** Find the latest version on the [Jitpack](https://jitpack.io/#iotaledger/iota-java) page.
102102
@@ -178,6 +178,7 @@ We have a list of test cases on the [`src/test/java` directory][tests] that you
178178
A good starter is the [`IotaAPITest` case](https://github.com/iotaledger/iota-java/blob/master/jota/src/test/java/jota/IotaAPITest.java).
179179

180180
## Change logs:
181+
- Changes in [**1.0.0-beta4**](https://github.com/iotaledger/iota-java/compare/1.0.0-beta3...1.0.0-beta4)
181182
- Changes in [**1.0.0-beta3**](https://github.com/iotaledger/iota-java/compare/1.0.0-beta2...1.0.0-beta3)
182183
- Changes in [**1.0.0-beta2**](https://github.com/iotaledger/iota-java/compare/1.0.0-beta1...1.0.0-beta2)
183184
- Changes in [**1.0.0-beta1**](https://github.com/iotaledger/iota-java/compare/0.9.10...1.0.0-beta1)
@@ -211,8 +212,8 @@ The Apache 2.0 license can be found [here](license).
211212
[travis-badge]: https://travis-ci.org/iotaledger/iota-java.svg?branch=master
212213
[license]: https://github.com/iotaledger/iota-java/blob/master/LICENSE
213214
[license-badge]: https://img.shields.io/github/license/iotaledger/iota-java.svg
214-
[iota-iri]: https://github.com/iotaledger/iri/tree/v1.5.5
215-
[iota-iri-badge]: https://img.shields.io/badge/IOTA%20IRI%20compatibility-v1.5.5-blue.svg
215+
[iota-iri]: https://github.com/iotaledger/iri/tree/v1.6.1
216+
[iota-iri-badge]: https://img.shields.io/badge/IOTA%20IRI%20compatibility-v1.6.1-blue.svg
216217
[iota-api]: https://iota.readme.io/reference
217218
[iota-api-badge]: https://img.shields.io/badge/IOTA%20API%20coverage-15/15%20commands-green.svg
218219
[javadoc]: https://iotaledger.github.io/iota-java/javadoc/

client.store

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"LXQHWNY9CQOHPNMKFJFIJHGEPAENAOVFRDIBF99PPHDTWJDCGHLYETXT9NPUVSNKT9XDTDYNJKJCPQMZC":{"keyIndex":4,"depositRequests":{"1":{"timeOut":0,"multiUse":false,"expectedAmount":5}},"pendingTransfers":{}}}

jota/client_new.store

Whitespace-only changes.

jota/pom.xml

+56-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.iota</groupId>
77
<artifactId>jota-parent</artifactId>
8-
<version>1.0.0-beta3</version>
8+
<version>1.0.0-beta4</version>
99
</parent>
1010

1111
<name>JOTA : Library</name>
@@ -33,14 +33,66 @@
3333
<artifactId>slf4j-api</artifactId>
3434
</dependency>
3535
<dependency>
36-
<groupId>junit</groupId>
37-
<artifactId>junit</artifactId>
36+
<groupId>net.jadler</groupId>
37+
<artifactId>jadler-all</artifactId>
3838
<scope>test</scope>
3939
</dependency>
40+
41+
<!-- Testing -->
42+
<dependency>
43+
<groupId>org.mockito</groupId>
44+
<artifactId>mockito-core</artifactId>
45+
</dependency>
46+
47+
<dependency>
48+
<groupId>org.hamcrest</groupId>
49+
<artifactId>hamcrest-core</artifactId>
50+
</dependency>
51+
52+
<dependency>
53+
<groupId>org.junit.jupiter</groupId>
54+
<artifactId>junit-jupiter-api</artifactId>
55+
</dependency>
56+
57+
<dependency>
58+
<groupId>org.junit.jupiter</groupId>
59+
<artifactId>junit-jupiter-engine</artifactId>
60+
</dependency>
61+
62+
<dependency>
63+
<groupId>org.junit.vintage</groupId>
64+
<artifactId>junit-vintage-engine</artifactId>
65+
</dependency>
66+
4067
<dependency>
4168
<groupId>net.jadler</groupId>
4269
<artifactId>jadler-all</artifactId>
43-
<scope>test</scope>
70+
</dependency>
71+
72+
<!-- Account specific -->
73+
<dependency>
74+
<groupId>com.google.zxing</groupId>
75+
<artifactId>core</artifactId>
76+
</dependency>
77+
78+
<dependency>
79+
<groupId>com.github.kenglxn.qrgen</groupId>
80+
<artifactId>javase</artifactId>
81+
</dependency>
82+
83+
<dependency>
84+
<groupId>com.fasterxml.jackson.core</groupId>
85+
<artifactId>jackson-databind</artifactId>
86+
</dependency>
87+
88+
<dependency>
89+
<groupId>org.mongodb</groupId>
90+
<artifactId>mongodb-driver</artifactId>
91+
</dependency>
92+
93+
<dependency>
94+
<groupId>org.mongodb</groupId>
95+
<artifactId>bson</artifactId>
4496
</dependency>
4597
</dependencies>
4698
</project>

jota/src/main/java/jota/utils/ExtractJson.java

-12
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
package org.iota.jota;
2+
3+
import java.util.List;
4+
5+
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
6+
import org.apache.commons.lang3.builder.ToStringStyle;
7+
import org.iota.jota.builder.ApiBuilderSettings;
8+
import org.iota.jota.config.options.ApiConfig;
9+
import org.iota.jota.connection.Connection;
10+
import org.iota.jota.pow.ICurl;
11+
12+
/**
13+
*
14+
* The current instance of API configuration options based on env, file and defaults
15+
* Modifications can be made but will not persist throughout restarts
16+
*
17+
*/
18+
public class ApiOptions implements ApiConfig, ApiBuilderSettings {
19+
20+
private int legacyPort;
21+
private String legacyProtocol;
22+
private String legacyHost;
23+
24+
private ICurl customCurl;
25+
private IotaLocalPoW localPoW;
26+
27+
//Nodes are not active
28+
private List<Connection> nodes;
29+
private int timeout;
30+
31+
public ApiOptions(IotaAPI.Builder builder) {
32+
localPoW = builder.getLocalPoW();
33+
customCurl = builder.getCustomCurl();
34+
legacyProtocol = builder.getProtocol();
35+
legacyHost = builder.getHost();
36+
legacyPort = builder.getPort();
37+
nodes = builder.getNodes();
38+
}
39+
40+
41+
public List<Connection> getNodes() {
42+
return nodes;
43+
}
44+
45+
@Override
46+
public boolean hasNodes() {
47+
return this.nodes != null && this.nodes.size() > 0;
48+
}
49+
50+
51+
public void setNodes(List<Connection> nodes) {
52+
this.nodes = nodes;
53+
}
54+
55+
@Override
56+
public int getLegacyPort() {
57+
return legacyPort;
58+
}
59+
60+
61+
public void setLegacyPort(int legacyPort) {
62+
this.legacyPort = legacyPort;
63+
}
64+
65+
@Override
66+
public String getLegacyProtocol() {
67+
return legacyProtocol;
68+
}
69+
70+
71+
public void setLegacyProtocol(String legacyProtocol) {
72+
this.legacyProtocol = legacyProtocol;
73+
}
74+
75+
@Override
76+
public String getLegacyHost() {
77+
return legacyHost;
78+
}
79+
80+
81+
public void setLegacyHost(String legacyHost) {
82+
this.legacyHost = legacyHost;
83+
}
84+
85+
@Override
86+
public ICurl getCustomCurl() {
87+
return customCurl;
88+
}
89+
90+
91+
public void setCustomCurl(ICurl customCurl) {
92+
this.customCurl = customCurl;
93+
}
94+
95+
@Override
96+
public IotaLocalPoW getLocalPoW() {
97+
return localPoW;
98+
}
99+
100+
101+
public void setLocalPoW(IotaLocalPoW localPoW) {
102+
this.localPoW = localPoW;
103+
}
104+
105+
@Override
106+
public int getConnectionTimeout() {
107+
return timeout;
108+
}
109+
110+
public void setTimeout(int timeout) {
111+
this.timeout = timeout;
112+
}
113+
114+
@Override
115+
public String toString() {
116+
return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
117+
}
118+
}

0 commit comments

Comments
 (0)