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

Commit 5119509

Browse files
author
Brord van Wierst
authored
Merge pull request #186 from iotaledger/dev
Merged 1.0.0beta6 into master
2 parents 2cbc93a + 74570b5 commit 5119509

File tree

187 files changed

+4024
-2946
lines changed

Some content is hidden

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

187 files changed

+4024
-2946
lines changed

README.md

+11-6
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-beta5'
72+
compile 'com.github.iotaledger:iota-java:1.0.0-beta6'
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>e4fd314b3e</version>` or `<version>1.0.0-beta5</version>`
99+
`<version>efdc784d8a9ef</version>` or `<version>1.0.0-beta6</version>`
100100
101101
**Note:** Find the latest version on the [Jitpack](https://jitpack.io/#iotaledger/iota-java) page.
102102
@@ -119,6 +119,9 @@ You'll have a .jar file called `jota-[VERSION]-jar-with-dependencies.jar`, depen
119119
## Getting Started
120120
121121
After you've [downloaded the library](#downloading-the-library), you can connect to an IRI node to send transactions to it and interact with the ledger.
122+
An extended guide can be found on our [documentation website](https://docs.iota.org/docs/iota-java/0.1/README), we strongly recommend you to go here for starting
123+
off. A quick starting tutorial is shown below.
124+
122125
123126
To connect to a local IRI node, do the following:
124127
@@ -139,6 +142,7 @@ GetNodeInfoResponse response = api.getNodeInfo();
139142
```
140143

141144
**Note:** To separate your IRI node configuration from the implementation, you can also specify your IRI node configuration in a [**Java `.properties` file**](https://en.wikipedia.org/wiki/.properties) or as command line flags. These options are useful if you develop an open-source app which is deployed on a CI and don't want contributors to see the internal IRI node configuration.
145+
To make the API read from this file, add the configuration to the builder like so: `.config(new FileConfig("node_config.properties"))`
142146

143147
**Example .properties files**
144148

@@ -175,9 +179,10 @@ Here are some of the most commonly used API functions:
175179
## Examples
176180

177181
We have a list of test cases on the [`src/test/java` directory][tests] that you can use as a reference when developing apps with IOTA.
178-
A good starter is the [`IotaAPITest` case](https://github.com/iotaledger/iota-java/blob/master/jota/src/test/java/jota/IotaAPITest.java).
182+
A good starter is the [`IotaAPITest` case](https://github.com/iotaledger/iota-java/blob/master/jota/src/test/java/org/iota/jota/IotaAPITest.java).
179183

180184
## Change logs:
185+
- Changes in [**1.0.0-beta6**](https://github.com/iotaledger/iota-java/compare/1.0.0-beta5...1.0.0-beta6)
181186
- Changes in [**1.0.0-beta5**](https://github.com/iotaledger/iota-java/compare/1.0.0-beta4...1.0.0-beta5)
182187
- Changes in [**1.0.0-beta4**](https://github.com/iotaledger/iota-java/compare/1.0.0-beta3...1.0.0-beta4)
183188
- Changes in [**1.0.0-beta3**](https://github.com/iotaledger/iota-java/compare/1.0.0-beta2...1.0.0-beta3)
@@ -194,15 +199,15 @@ A good starter is the [`IotaAPITest` case](https://github.com/iotaledger/iota-ja
194199
## Supporting the project
195200

196201
If the IOTA Java client library has been useful to you and you feel like contributing, consider posting a [bug report](https://github.com/iotaledger/iota-java/issues/new-issue), feature request or a [pull request](https://github.com/iotaledger/iota-java/pulls/).
197-
We have some [basic contribution guidelines](contribution-guidelines.md) to keep our code base stable and consistent.
202+
We have some [basic contribution guidelines](CONTRIBUTING.md) to keep our code base stable and consistent.
198203

199204
## Joining the Discussion
200205

201206
If you want to get involved in the community, need help with getting setup, have any issues related with the library or just want to discuss blockchain, distributed ledgers, and IoT with other people, feel free to join our [Discord](https://discordapp.com/invite/fNGZXvh).
202207

203208
## License
204209

205-
The Apache 2.0 license can be found [here](license).
210+
The Apache 2.0 license can be found [here](LICENSE).
206211

207212
[iota-logo]: https://avatars0.githubusercontent.com/u/20126597?s=200&v=4
208213
[codacy]: https://www.codacy.com/app/kwek20/iota-java?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=iotaledger/iota-java&amp;utm_campaign=Badge_Grade
@@ -223,6 +228,6 @@ The Apache 2.0 license can be found [here](license).
223228
[pull-requests]: https://github.com/iotaledger/iota-java/pulls
224229
[new-pull-request]: https://github.com/iotaledger/iota-java/compare
225230
[contribution-guidelines]: https://github.com/iotaledger/iota-java/blob/master/CONTRIBUTING.md
226-
[tests]: https://github.com/iotaledger/iota-java/tree/master/jota/src/test/java/jota
231+
[tests]: https://github.com/iotaledger/iota-java/tree/master/jota/src/test/java/org/iota/jota
227232
[iota-discord]: https://discord.gg/7Gu2mG5
228233
[iota-forum]: https://forum.iota.org/

docs/iota-java/addRemainder.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
# [addRemainder](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/IotaAPI.java#L1598)
3+
List<String> addRemainder(String seed , int security , List<[Input](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/model/Input.java)> inputs , [Bundle](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/model/Bundle.java) bundle , String tag , long totalValue , String remainderAddress , List<String> signatureFragments)
4+
5+
Uses input, and adds to the bundle, untill `totalValue` is reached. If there is a remainder left on the last input, a remainder transfer is added.
6+
> **Important note:** This API is currently in Beta and is subject to change. Use of these APIs in production applications is not supported.
7+
8+
## Input
9+
| Parameter | Type | Required or Optional | Description |
10+
|:---------------|:--------|:--------| :--------|
11+
| seed | String | Required | The tryte-encoded seed. It should be noted that this seed is not transferred. |
12+
| security | int | Required | Security level to be used for the private key / address. Can be 1, 2 or 3. |
13+
| inputs | List<[Input](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/model/Input.java)> | Required | List of inputs used for funding the transfer. |
14+
| bundle | [Bundle](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/model/Bundle.java) | Required | The [Bundle](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/model/Bundle.java) to be populated. |
15+
| tag | String | Required | The tag to add to each bundle entry (input and remainder) |
16+
| totalValue | long | Required | The total value of the desired transaction |
17+
| remainderAddress | String | Required | The address used for sending the remainder value (of the last input). If this is `null`, [getNextAvailableAddress(String, int, boolean)](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/IotaAPI.java#L115) is used. |
18+
| signatureFragments | List<String> | Required | The signature fragments (message), used for signing.Should be 2187 characters long, can be padded with 9s. |
19+
20+
## Output
21+
| Return type | Description |
22+
|--|--|
23+
| List<String> | A list of signed inputs to be used in a transaction |
24+
25+
## Exceptions
26+
| Exceptions | Description |
27+
|:---------------|:--------|
28+
| [ArgumentException](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/error/ArgumentException.java) | When the seed is invalid |
29+
| [ArgumentException](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/error/ArgumentException.java) | When the security level is wrong. |
30+
| IllegalStateException | When the inputs do not contain enough balance to reach <tt>totalValue</tt>. |
31+
32+
## Related APIs (link to other product documentation)
33+
| API | Description |
34+
|:---------------|:--------|
35+
| [signInputsAndReturn(String, List, Bundle, List, org.iota.jota.pow.ICurl)](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/utils/IotaAPIUtils.java#L64) | Finalizes and signs the bundle transactions. Bundle and inputs are assumed correct. |
36+
| [getNextAvailableAddress(String, int, boolean)](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/IotaAPI.java#L115) | Checks all addresses until the first unspent address is found. Starts at index 0. |
37+
38+
## Example
39+
40+
```Java
41+
IotaAPI iotaAPI = new IotaAPI.Builder().build();
42+
43+
try {
44+
List<String> response = iotaAPI.addRemainder("GJRKVXECSQFPQOEMFNKWZLBKMYXUW9ZX9DCBBKFUFFICTCL9BXCWDEUQWHWRDYYSJEBYRRTJJZEVFXROV", "365", ["inputs", "inputs"], "bundle", "OVTBVZF9UHIMBKAE9NQZUNWZ9AUWGAMTKUPG9BOEOS9LFYYYXGPCOZWVXARKK9QXJJEQITVIODK9AZNOG", "totalvalue", "VIGLBXE9SWTYGJYDLSPNGVTRLIVRVGHXFMMZAIXNGFWZVQYXMQISB99MACJ9XUOVMSXALC99YPWAVCCJL", ["AFGGZR9I9GCPKYAE9PEWRIUDIUBQKQWUOR9BIL9QKUQOTAKTNKYLRTBQ9HL9NRULMPJIDEWIEAMWLLERI", "YHKJKHNRUFGRJ9CYZVFOJXLAWNWC9OEPXMTNPLNUBGKKFI9AOBWTNQZPARWILW9FHSUVRSLFNJNTLVI9K"]);
45+
} catch (ArgumentException e) {
46+
// Handle error
47+
e.printStackTrace();
48+
}
49+
```
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
# [bundlesFromAddresses](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/IotaAPI.java#L309)
3+
[Bundle[]](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/model/Bundle.java) bundlesFromAddresses(Boolean inclusionStates , String[] addresses)
4+
5+
Internal function to get the formatted bundles of a list of addresses.
6+
> **Important note:** This API is currently in Beta and is subject to change. Use of these APIs in production applications is not supported.
7+
8+
## Input
9+
| Parameter | Type | Required or Optional | Description |
10+
|:---------------|:--------|:--------| :--------|
11+
| inclusionStates | Boolean | Required | Array of addresses. |
12+
| addresses | String[] | Required | If `true`, it also gets the inclusion state of each bundle. |
13+
14+
## Output
15+
| Return type | Description |
16+
|--|--|
17+
| [Bundle[]](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/model/Bundle.java) | All the transaction bundles for the addresses, or `null` when our thread gets interrupted |
18+
19+
## Exceptions
20+
| Exceptions | Description |
21+
|:---------------|:--------|
22+
| [ArgumentException](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/error/ArgumentException.java) | When the addresses are invalid |
23+
| IllegalStateException | When inclusion state/confirmed could not be determined (<tt>null</tt> returned) |
24+
25+
26+
## Example
27+
28+
```Java
29+
IotaAPI iotaAPI = new IotaAPI.Builder().build();
30+
31+
try {
32+
Bundle response = iotaAPI.bundlesFromAddresses("true", ["KVB9GPIDVFGM9MIVJES9IPRRFUSBWWFLG9BYEOY9JIBMIMBTERXSIXSUUGYEQZZQEQGBKZJNZZVIOSZDL", "LNIHWRCCWVTEZYGEWDZBRHIWVXWCIKSSPGYPB9PU9JYOIP9VQDJU9ADCCZLDDQXCHNLKFLNRKOJZUOIVC"]);
33+
} catch (ArgumentException e) {
34+
// Handle error
35+
e.printStackTrace();
36+
}
37+
```

docs/iota-java/reference/checkWereAddressSpentFrom.md renamed to docs/iota-java/checkWereAddressSpentFrom.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

2-
# [checkWereAddressSpentFrom](https://github.com/iotaledger/iota-java/blob/dev/jota/src/main/java/jota/IotaAPI.java#L823)
2+
# [checkWereAddressSpentFrom](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/IotaAPI.java#L1022)
33
boolean[] checkWereAddressSpentFrom(String[] addresses)
44

5-
Check if a list of addresses was ever spent from, in the current epoch, or in previous epochs. If the address has a checksum, it is removed
5+
Check if a list of addresses was ever spent from, in the current epoch, or in previous epochs. Addresses must have a checksum.
66
> **Important note:** This API is currently in Beta and is subject to change. Use of these APIs in production applications is not supported.
77
88
## Input
@@ -18,7 +18,7 @@ Check if a list of addresses was ever spent from, in the current epoch, or in pr
1818
## Exceptions
1919
| Exceptions | Description |
2020
|:---------------|:--------|
21-
| [ArgumentException](https://github.com/iotaledger/iota-java/blob/dev/jota/src/main/java/jota/error/ArgumentException.java) | |
21+
| [ArgumentException](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/error/ArgumentException.java) | when an address is invalid |
2222

2323

2424
## Example
@@ -27,7 +27,7 @@ Check if a list of addresses was ever spent from, in the current epoch, or in pr
2727
IotaAPI iotaAPI = new IotaAPI.Builder().build();
2828

2929
try {
30-
boolean response = iotaAPI.checkWereAddressSpentFrom(["QBMKILBOYESLUCXMNIQIBBOICSRWMO9PMY99YHPACWLFPXLCVAELQZNRFLJPGDHWZHGIQYDG9JLREW99WOEWUXYVLVRXPXJJWSY9LCGSRYKLPZRSEHKKYNBSD9ESNDN9YUPBOGBXOBPOKASLNUEHANHCNWD99GLLMF", "RUKJQZIQHBSPRVRFOQMPIZOTP9FGQBVREIVLYL9HBSMTJCKBNLARQNLVWMEFAJQSEHVZPI9XRPJAKDAHOVRBMRUKREZWXVJEZGXIPREGDPWNFZDWIEPNDLNAN9CGEKEGUPIQNVC9KZGLUISHLZMOQGIHVJOZRRULGG"]);
30+
boolean response = iotaAPI.checkWereAddressSpentFrom(["WXBYKDMRDYKCQBJWZZFPNHKZLYINE9TLYSETXLOFXQKRUKDVRGWFQHVPSNHJMNIHU9QVPLPQKSNXRBLAV", "JYWRGZDJJCRUOUVZJKNWGMEWOLJEEQLHAIVM9D9GWEZN9YJZWYLOBGUCBBWIMEUQDYZG9HPVAZZDSVLSP"]);
3131
} catch (ArgumentException e) {
3232
// Handle error
3333
e.printStackTrace();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2+
# [findTransactionObjectsByAddresses](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/IotaAPI.java#L480)
3+
List<[Transaction](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/model/Transaction.java)> findTransactionObjectsByAddresses(String[] addresses)
4+
5+
Wrapper function: Finds transactions, gets trytes and turns it into [Transaction](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/model/Transaction.java) objects.
6+
> **Important note:** This API is currently in Beta and is subject to change. Use of these APIs in production applications is not supported.
7+
8+
## Input
9+
| Parameter | Type | Required or Optional | Description |
10+
|:---------------|:--------|:--------| :--------|
11+
| addresses | String[] | Required | The addresses we should get the transactions for, must contain checksums |
12+
13+
## Output
14+
List<[Transaction](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/model/Transaction.java)>, which contains the following fields:
15+
| Return type | Description |
16+
|--|--|
17+
| long attachmentTimestampLowerBound | |
18+
| long attachmentTimestampUpperBound | |
19+
| String hash | Get the hash. |
20+
| String signatureFragments | Get the signature fragments. |
21+
| String address | Get the address. |
22+
| long value | Get the value. |
23+
| String tag | Get the tag. |
24+
| long timestamp | Get the timestamp. |
25+
| long currentIndex | Get the current index. |
26+
| long lastIndex | Get the last index. |
27+
| String bundle | Get the bundle. |
28+
| String trunkTransaction | Get the trunk transaction. |
29+
| String branchTransaction | Get the branch transaction. |
30+
| String nonce | Get the nonce. |
31+
| Boolean persistence | Get the persistence. |
32+
| String obsoleteTag | Get the obsoleteTag. |
33+
| long attachmentTimestamp | Get the attachmentTimestamp. |
34+
| boolean tailTransaction | Checks if the current index is 0 |
35+
36+
## Exceptions
37+
| Exceptions | Description |
38+
|:---------------|:--------|
39+
| [ArgumentException](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/error/ArgumentException.java) | if addresses is not a valid array of hashes |
40+
41+
## Related APIs (link to other product documentation)
42+
| API | Description |
43+
|:---------------|:--------|
44+
| [findTransactionsByAddresses(String...)](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/IotaAPICore.java#L273) | Find the transactions by addresses with checksum |
45+
| [findTransactionsObjectsByHashes](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/IotaAPI.java#L454) | Wrapper function: get trytes and turns into [Transaction](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/model/Transaction.java) objects. Gets the trytes and transaction object from a list of transaction hashes. |
46+
47+
## Example
48+
49+
```Java
50+
IotaAPI iotaAPI = new IotaAPI.Builder().build();
51+
52+
try {
53+
List<Transaction> response = iotaAPI.findTransactionObjectsByAddresses(["AYZWDCHCJLLEAXMLMHR9OKZW9KXFQEJVMNNMQCFYAOMVRIIAOYNUVAINKORAFDADZRHFCYWIZVSHZFNLS", "ZHCFE9YXMOOHCHCKFRTCIXCXPTRFHIUITFSUEYORRLQVWKVQQUJTAALHEGJJIWAHEMZNSVDHPLCFTCGMV"]);
54+
} catch (ArgumentException e) {
55+
// Handle error
56+
e.printStackTrace();
57+
}
58+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
# [findTransactionObjectsByApprovees](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/IotaAPI.java#L516)
3+
List<[Transaction](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/model/Transaction.java)> findTransactionObjectsByApprovees(String[] approvees)
4+
5+
Wrapper function: Finds transactions, gets trytes and turns it into [Transaction](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/model/Transaction.java) objects.
6+
> **Important note:** This API is currently in Beta and is subject to change. Use of these APIs in production applications is not supported.
7+
8+
## Input
9+
| Parameter | Type | Required or Optional | Description |
10+
|:---------------|:--------|:--------| :--------|
11+
| approvees | String[] | Required | The transaction hashes of which we want to approvers |
12+
13+
## Output
14+
List<[Transaction](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/model/Transaction.java)>, which contains the following fields:
15+
| Return type | Description |
16+
|--|--|
17+
| long attachmentTimestampLowerBound | |
18+
| long attachmentTimestampUpperBound | |
19+
| String hash | Get the hash. |
20+
| String signatureFragments | Get the signature fragments. |
21+
| String address | Get the address. |
22+
| long value | Get the value. |
23+
| String tag | Get the tag. |
24+
| long timestamp | Get the timestamp. |
25+
| long currentIndex | Get the current index. |
26+
| long lastIndex | Get the last index. |
27+
| String bundle | Get the bundle. |
28+
| String trunkTransaction | Get the trunk transaction. |
29+
| String branchTransaction | Get the branch transaction. |
30+
| String nonce | Get the nonce. |
31+
| Boolean persistence | Get the persistence. |
32+
| String obsoleteTag | Get the obsoleteTag. |
33+
| long attachmentTimestamp | Get the attachmentTimestamp. |
34+
| boolean tailTransaction | Checks if the current index is 0 |
35+
36+
## Exceptions
37+
| Exceptions | Description |
38+
|:---------------|:--------|
39+
| [ArgumentException](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/error/ArgumentException.java) | if addresses is not a valid array of hashes |
40+
41+
## Related APIs (link to other product documentation)
42+
| API | Description |
43+
|:---------------|:--------|
44+
| [findTransactionsByApprovees](https://github.com/iotaledger/iota-java/blob/master/jota/src/main/java/org/iota/jota/IotaAPICore.java#L304) | Find the transactions by approvees |
45+
46+
## Example
47+
48+
```Java
49+
IotaAPI iotaAPI = new IotaAPI.Builder().build();
50+
51+
try {
52+
List<Transaction> response = iotaAPI.findTransactionObjectsByApprovees(["VKXPUUA9QIRJCIPIOGOWCLTDHNPAM99NYWPKOCVDKJVES9EWQ9TN9IMIU9GRTANLI9QMZEBGNZTOR9OVB", "FQCOXX99V9HMBAKSFKJTMDYUPKNYLGFE9LAJMRFQIGTOQNGXWEXVGALCEHHTC9LFTQY9IRJWLZZFFAGUN"]);
53+
} catch (ArgumentException e) {
54+
// Handle error
55+
e.printStackTrace();
56+
}
57+
```

0 commit comments

Comments
 (0)