Skip to content

Commit e729903

Browse files
authored
Merge pull request #115 from kryptokrauts/dev
v2.2.0
2 parents de455e5 + 37ec6cd commit e729903

File tree

85 files changed

+1347
-505
lines changed

Some content is hidden

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

85 files changed

+1347
-505
lines changed

.env

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
AETERNITY_TAG=v5.0.1
2-
SOPHIA_COMPILER_TAG=v4.0.0
3-
AETERNAL_TAG=0.11.1
1+
AETERNITY_TAG=v5.4.1
2+
SOPHIA_COMPILER_TAG=v4.2.0
3+
AETERNAL_TAG=0.13.0
44
NGINX_TAG=1.13.8

.github/FUNDING.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# These are supported funding model platforms
2+
3+
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
custom: ['https://kryptokrauts.com/support/']

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
# aepp-sdk-java
2-
A community developed Java SDK to interact with the æternity blockchain powered by [kryptokrauts.com](https://kryptokrauts.com)!
1+
<p align="center">
2+
<a href="https://kryptokrauts.com">
3+
<img alt="kryptokrauts" src="https://kryptokrauts.com/img/logo.svg" width="60" />
4+
</a>
5+
</p>
6+
<h1 align="center">
7+
kryptokrauts.com
8+
</h1>
9+
10+
The **aepp-sdk-java** is a community developed Java SDK to interact with the æternity blockchain.
311

412
## Latest release
513
[ ![Download](https://api.bintray.com/packages/kryptokrauts/maven/aepp-sdk-java/images/download.svg) ](https://bintray.com/kryptokrauts/maven/aepp-sdk-java/_latestVersion)
@@ -15,14 +23,6 @@ Licensed under the [ISC License](LICENSE)
1523

1624
## Support us
1725

18-
If you like this project we would appreciate your support:
19-
20-
- [ak_5z1fmzTKR1GA1P7qiLDCC1s3V7AK2RRpNbXqUhfHQbUeg7mmV](https://explorer.aepps.com/#/account/ak_5z1fmzTKR1GA1P7qiLDCC1s3V7AK2RRpNbXqUhfHQbUeg7mmV)
21-
22-
## Contributors
23-
24-
Everybody is welcome to contribute to this project.
26+
If you like this project we would appreciate your support. You can find multiple ways to support us here:
2527

26-
Contributors so far:
27-
- [Marco Walz](https://github.com/marc0olo)
28-
- [Michel Meier](https://github.com/mitch-lbw)
28+
- https://kryptokrauts.com/support

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ buildscript {
1212
plugins {
1313
id "com.jfrog.artifactory" version "4.8.1"
1414
id "com.jfrog.bintray" version "1.8.4"
15-
id 'com.github.sherter.google-java-format' version '0.8'
15+
id "com.github.sherter.google-java-format" version "0.8"
16+
id "maven"
1617
id "maven-publish"
1718
id "jacoco"
1819
id "java"
@@ -53,7 +54,7 @@ ext {
5354
vertxVersion = "3.6.3"
5455
jacksonVersion = "2.9.8"
5556

56-
lombokVersion = "1.18.4"
57+
lombokVersion = "1.18.10"
5758

5859
bouncycastleVersion = "1.61"
5960
bitcoinjCoreVersion = "0.14.7"

docs/changelog.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# Changelog
22

3+
## [v2.2.0](https://github.com/kryptokrauts/aepp-sdk-java/releases/tag/v2.2.0)
4+
5+
This release ships some fixes and enhancements.
6+
7+
### Fixes
8+
- [#91](../../../issues/91) show exception details on compiler and aeternal errors
9+
- [#95](../../../issues/95) fix default values in BaseConstants
10+
11+
### Enhancements
12+
- [#96](../../../issues/96) add ResultWrapper for standard java types returned from service calls to omit exceptions being ignored
13+
- [#97](../../../issues/97) introduce configurable way to wait for tx being included in a block
14+
- this is currently covered by the following properties and only relevant in `blockingPostTransaction` calls
15+
- `waitForTxIncludedInBlockEnabled` (default=true)
16+
- `numTrialsToWaitForTxIncludedInBlock` (default=60)
17+
- `millisBetweenTrialsToWaitForTxIncludedInBlock` (default=1000)
18+
- [#98](../../../issues/98) provide a (more) user-friendly way to handle unit conversions
19+
- we introduced a `UnitConversionService`-Interface with a `DefaultUnitConversionService`-Implementation that makes it a bit easier to handle conversions from `AE` to `aettos` or custom tokens that may have less decimals
20+
- [#99](../../../issues/99) prevent exceptions for TxModel classes
21+
- [#107](../../../issues/107) wait for confirmation of transaction
22+
- now it is possible to wait for a transaction to be confirmed
23+
- this is an asynchronous operation and can be configured through the following properties:
24+
- `numOfConfirmations` (default=10)
25+
- the number of confirmations (KeyBlocks) until a transaction is considered confirmed
26+
- this value can also be explicitly set as method parameter
27+
- `millisBetweenTrailsToWaitForConfirmation` (default=10000)
28+
- [#111](../../../issues/111) add "payloadDecoded" attribute to SpendTransactionModel
29+
- now the payload for a SpendTx is automatically decoded
30+
331
## [v2.1.0](https://github.com/kryptokrauts/aepp-sdk-java/releases/tag/v2.1.0)
432

533
This release ships some fixes and enhancements. Additionally we renamed some attributes and model-classes. If you already used [v2.0.0](https://github.com/kryptokrauts/aepp-sdk-java/releases/tag/v2.0.0) it might be needed to fix these changes.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
organization=kryptokrauts
22
group=com.kryptokrauts
33
name=aepp-sdk-java
4-
version=2.1.0-SNAPSHOT
4+
version=2.2.0-SNAPSHOT

src/integrationTest/java/com/kryptokrauts/aeternity/generated/api/AeternalServiceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public void testStatus(TestContext context) {
1212
this.executeTest(
1313
context,
1414
t -> {
15-
Object result = this.aeternityServiceNative.aeternal.blockingGetMdwStatus();
15+
Object result = this.aeternityServiceNative.aeternal.blockingGetMdwStatus().getResult();
1616
try {
1717
_logger.info("aeternal status: {}", objectMapper.writeValueAsString(result));
1818
} catch (JsonProcessingException e) {

src/integrationTest/java/com/kryptokrauts/aeternity/generated/api/BaseTest.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.fasterxml.jackson.databind.ObjectMapper;
44
import com.kryptokrauts.aeternity.sdk.constants.Network;
55
import com.kryptokrauts.aeternity.sdk.constants.VirtualMachine;
6+
import com.kryptokrauts.aeternity.sdk.domain.ObjectResultWrapper;
67
import com.kryptokrauts.aeternity.sdk.domain.secret.impl.BaseKeyPair;
78
import com.kryptokrauts.aeternity.sdk.service.account.domain.AccountResult;
89
import com.kryptokrauts.aeternity.sdk.service.aeternity.AeternityServiceConfiguration;
@@ -102,6 +103,7 @@ public void setupApiClient(TestContext context) throws ConfigurationException {
102103
.baseKeyPair(baseKeyPair)
103104
.vertx(vertx)
104105
.targetVM(targetVM)
106+
.millisBetweenTrailsToWaitForConfirmation(500l)
105107
.compile());
106108
aeternityServiceDebug =
107109
new AeternityServiceFactory()
@@ -252,8 +254,10 @@ protected void waitForBlockHeight(BigInteger blockHeight, Long timeoutMilli) thr
252254

253255
protected String encodeCalldata(
254256
String contractSourceCode, String contractFunction, List<String> contractFunctionParams) {
255-
return this.aeternityServiceNative.compiler.blockingEncodeCalldata(
256-
contractSourceCode, contractFunction, contractFunctionParams);
257+
return this.aeternityServiceNative
258+
.compiler
259+
.blockingEncodeCalldata(contractSourceCode, contractFunction, contractFunctionParams)
260+
.getResult();
257261
}
258262

259263
protected JsonObject decodeCalldata(String encodedValue, String sophiaReturnType) {
@@ -262,7 +266,7 @@ protected JsonObject decodeCalldata(String encodedValue, String sophiaReturnType
262266
encodedValue, sophiaReturnType));
263267
}
264268

265-
protected Object decodeCallResult(
269+
protected ObjectResultWrapper decodeCallResult(
266270
String source, String function, String callResult, String callValue) {
267271
return this.aeternityServiceNative.compiler.blockingDecodeCallResult(
268272
source, function, callResult, callValue);

src/integrationTest/java/com/kryptokrauts/aeternity/generated/api/CompilerServiceTest.java

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.kryptokrauts.aeternity.generated.api;
22

33
import com.fasterxml.jackson.databind.ObjectMapper;
4+
import com.kryptokrauts.aeternity.sdk.domain.ObjectResultWrapper;
45
import com.kryptokrauts.aeternity.sdk.service.compiler.domain.ACIResult;
56
import io.vertx.core.json.JsonObject;
67
import io.vertx.ext.unit.TestContext;
@@ -13,28 +14,19 @@
1314

1415
public class CompilerServiceTest extends BaseTest {
1516

16-
@Test
17-
public void testCompileContract(TestContext context) {
18-
this.executeTest(
19-
context,
20-
t -> {
21-
String byteCode =
22-
this.aeternityServiceNative.compiler.blockingCompile(
23-
TestConstants.testContractSourceCode, null, null);
24-
context.assertEquals(TestConstants.testContractByteCode, byteCode);
25-
});
26-
}
27-
2817
@Test
2918
public void testCompileContractCall(TestContext context) {
3019
this.executeTest(
3120
context,
3221
t -> {
3322
String calldata =
34-
this.aeternityServiceNative.compiler.blockingEncodeCalldata(
35-
TestConstants.testContractSourceCode,
36-
TestConstants.testContractFunction,
37-
TestConstants.testContractFunctionParams);
23+
this.aeternityServiceNative
24+
.compiler
25+
.blockingEncodeCalldata(
26+
TestConstants.testContractSourceCode,
27+
TestConstants.testContractFunction,
28+
TestConstants.testContractFunctionParams)
29+
.getResult();
3830
context.assertEquals(TestConstants.encodedServiceCall, calldata);
3931
});
4032
}
@@ -45,16 +37,16 @@ public void testDecodeCalldata(TestContext context) {
4537
context,
4638
t -> {
4739
try {
48-
Object callData =
40+
ObjectResultWrapper callData =
4941
this.aeternityServiceNative.compiler.blockingDecodeCalldata(
5042
TestConstants.encodedServiceCallAnswer, "int");
51-
_logger.info(callData.toString());
43+
_logger.info(callData.getResult().toString());
5244
context.assertEquals(
5345
new ObjectMapper()
5446
.readValue(TestConstants.serviceCallAnswerJSON, Map.class)
5547
.get("value")
5648
.toString(),
57-
JsonObject.mapFrom(callData).getInteger("value").toString());
49+
JsonObject.mapFrom(callData.getResult()).getInteger("value").toString());
5850
} catch (IOException e) {
5951
context.fail(e);
6052
}
@@ -67,8 +59,10 @@ public void testEncodeCalldata(TestContext context) {
6759
context,
6860
t -> {
6961
String calldata =
70-
this.aeternityServiceNative.compiler.blockingEncodeCalldata(
71-
TestConstants.testContractSourceCode, "init", null);
62+
this.aeternityServiceNative
63+
.compiler
64+
.blockingEncodeCalldata(TestConstants.testContractSourceCode, "init", null)
65+
.getResult();
7266
context.assertEquals(TestConstants.testContractCallData, calldata);
7367
});
7468
}

src/integrationTest/java/com/kryptokrauts/aeternity/generated/api/PaymentSplitterContractTest.java

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ public void a_a_init(TestContext context) throws IOException {
7676
private String generateMapParam(Map<String, Integer> recipientConditions) {
7777
Set<String> recipientConditionSet = new HashSet<>();
7878
recipientConditions.forEach((k, v) -> recipientConditionSet.add("[" + k + "] = " + v));
79+
System.out.println(
80+
"{" + recipientConditionSet.stream().collect(Collectors.joining(", ")) + "}");
7981
return "{" + recipientConditionSet.stream().collect(Collectors.joining(", ")) + "}";
8082
}
8183

@@ -86,11 +88,18 @@ public void a_deployPaymentSplitterTest(TestContext context) throws Throwable {
8688
t -> {
8789
try {
8890
String byteCode =
89-
this.aeternityServiceNative.compiler.blockingCompile(
90-
paymentSplitterSource, null, null);
91+
this.aeternityServiceNative
92+
.compiler
93+
.blockingCompile(paymentSplitterSource, null, null)
94+
.getResult();
9195
String callData =
92-
this.aeternityServiceNative.compiler.blockingEncodeCalldata(
93-
paymentSplitterSource, "init", Arrays.asList(generateMapParam(initialWeights)));
96+
this.aeternityServiceNative
97+
.compiler
98+
.blockingEncodeCalldata(
99+
paymentSplitterSource,
100+
"init",
101+
Arrays.asList(generateMapParam(initialWeights)))
102+
.getResult();
94103

95104
_logger.info("contract bytecode: " + byteCode);
96105
_logger.info("contract calldata: " + callData);
@@ -113,8 +122,10 @@ public void a_deployPaymentSplitterTest(TestContext context) throws Throwable {
113122
.build();
114123

115124
String unsignedTx =
116-
aeternityServiceNative.transactions.blockingCreateUnsignedTransaction(
117-
contractCreate);
125+
aeternityServiceNative
126+
.transactions
127+
.blockingCreateUnsignedTransaction(contractCreate)
128+
.getResult();
118129
_logger.info("Unsigned Tx - hash - dryRun: " + unsignedTx);
119130

120131
DryRunTransactionResults dryRunResults =
@@ -167,7 +178,8 @@ public void b_callPayAndSplitMethodTest(TestContext context) throws Throwable {
167178
BigInteger balanceRecipient1;
168179
BigInteger balanceRecipient2;
169180
BigInteger balanceRecipient3;
170-
// if one of the accounts wasn't active we get an error and know that the
181+
// if one of the accounts wasn't active we get an error and know
182+
// that the
171183
// accounts don't have any balance
172184
balanceRecipient1 =
173185
Optional.ofNullable(getAccount(initialReceiver1.getPublicKey()).getBalance())
@@ -181,8 +193,10 @@ public void b_callPayAndSplitMethodTest(TestContext context) throws Throwable {
181193

182194
BigDecimal paymentValue = UnitConversionUtil.toAettos("1", Unit.AE);
183195
String calldata =
184-
aeternityServiceNative.compiler.blockingEncodeCalldata(
185-
paymentSplitterSource, "payAndSplit", null);
196+
aeternityServiceNative
197+
.compiler
198+
.blockingEncodeCalldata(paymentSplitterSource, "payAndSplit", null)
199+
.getResult();
186200
_logger.info("Contract ID: " + localDeployedContractId);
187201

188202
DryRunTransactionResults dryRunResults =
@@ -237,7 +251,8 @@ public void b_callPayAndSplitMethodTest(TestContext context) throws Throwable {
237251
aeternityServiceNative.transactions.computeTxHash(contractAfterDryRun));
238252
_logger.info("CreateContractTx hash: " + postTransactionResult.getTxHash());
239253

240-
// we wait until the tx is available and the payment should have been splitted
254+
// we wait until the tx is available and the payment should have
255+
// been splitted
241256
TransactionInfoResult txInfoObject =
242257
waitForTxInfoObject(postTransactionResult.getTxHash());
243258
_logger.info(
@@ -277,8 +292,10 @@ public void c_callGetTotalAmountSplitted(TestContext context) throws Throwable {
277292
try {
278293
BigDecimal paymentValue = UnitConversionUtil.toAettos("0", Unit.AE);
279294
String calldata =
280-
aeternityServiceNative.compiler.blockingEncodeCalldata(
281-
paymentSplitterSource, "getTotalAmountSplitted", null);
295+
aeternityServiceNative
296+
.compiler
297+
.blockingEncodeCalldata(paymentSplitterSource, "getTotalAmountSplitted", null)
298+
.getResult();
282299
_logger.info("Contract ID: " + localDeployedContractId);
283300

284301
DryRunTransactionResults dryRunResults =
@@ -329,8 +346,10 @@ public void d_callGetOwner(TestContext context) throws Throwable {
329346
try {
330347
BigDecimal paymentValue = UnitConversionUtil.toAettos("0", Unit.AE);
331348
String calldata =
332-
aeternityServiceNative.compiler.blockingEncodeCalldata(
333-
paymentSplitterSource, "getOwner", null);
349+
aeternityServiceNative
350+
.compiler
351+
.blockingEncodeCalldata(paymentSplitterSource, "getOwner", null)
352+
.getResult();
334353
_logger.info("Contract ID: " + localDeployedContractId);
335354

336355
DryRunTransactionResults dryRunResults =
@@ -397,6 +416,6 @@ protected String createUnsignedContractCallTx(
397416
.virtualMachine(targetVM)
398417
.build();
399418

400-
return aeternityServiceNative.transactions.blockingCreateUnsignedTransaction(model);
419+
return aeternityServiceNative.transactions.blockingCreateUnsignedTransaction(model).getResult();
401420
}
402421
}

0 commit comments

Comments
 (0)