Skip to content

Commit d8415f1

Browse files
committed
Merge remote-tracking branch 'origin/master' into HEAD
2 parents ee44867 + 3dd63dc commit d8415f1

23 files changed

+766
-143
lines changed

.circleci/config.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,18 @@ jobs:
1919
- libs/stellar-sdk.jar
2020
deploy:
2121
docker:
22-
- image: cibuilds/github:0.10
22+
- image: cimg/go:1.17
2323
steps:
2424
- attach_workspace:
2525
at: ./build
2626
- run:
27-
name: "Publish Release on GitHub"
27+
name: "Install github.com/github-release/github-release v0.10.0"
2828
command: |
29-
ghr -replace -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${CIRCLE_TAG} ./build/libs
29+
go get github.com/github-release/github-release@v0.10.0
30+
- run:
31+
name: "Upload JAR to GitHub Release"
32+
command: |
33+
github-release upload -s ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t ${CIRCLE_TAG} -f ./build/libs/stellar-sdk.jar -n java-stellar-sdk.jar
3034
3135
after_deploy:
3236
docker:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Update CompletedSprint on Issue Closed
2+
3+
on:
4+
issues:
5+
types: [closed]
6+
pull_request:
7+
types: [closed]
8+
9+
jobs:
10+
update-completed-sprint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Generate token
14+
id: generate_token
15+
uses: tibdex/github-app-token@v1
16+
with:
17+
app_id: ${{ secrets.GH_PROJECT_MANAGEMENT_APP_ID }}
18+
private_key: ${{ secrets.GH_PROJECT_MANAGEMENT_APP_PEM }}
19+
- name: Update CompletedSprint on Issue Closed
20+
id: update_completedsprint_on_issue_closed
21+
uses: stellar/actions/update-completed-sprint-on-issue-closed@main
22+
with:
23+
project_name: "Platform Scrum"
24+
field_name: "CompletedSprint"
25+
project_token: ${{ steps.generate_token.outputs.token }}

CHANGELOG.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,58 @@
22

33
As this project is pre 1.0, breaking changes may happen for minor version bumps. A breaking change will get clearly notified in this log.
44

5-
## 0.33.0 (Pending)
5+
## Pending
6+
7+
## 0.39.0
8+
9+
* Add SubmitTransactionResponse.ResultCodes.innerTransactionResultCode ([#466](https://github.com/stellar/java-stellar-sdk/pull/466))
10+
11+
## 0.38.0
12+
13+
* Fix android crashing related to okhttp3 ([#457](https://github.com/stellar/java-stellar-sdk/pull/457))
14+
15+
## 0.37.2
16+
17+
* Fix the deployment CI that uploads the jar to the GitHub release [2]. ([#453](https://github.com/stellar/java-stellar-sdk/pull/453))
18+
19+
## 0.37.1
20+
21+
* Fix the deployment CI that uploads the jar to the GitHub release. ([#452](https://github.com/stellar/java-stellar-sdk/pull/452))
22+
23+
## 0.37.0
24+
25+
* Fix missing `auth_clawback_enabled` field in AccountResponse class. ([#449](https://github.com/stellar/java-stellar-sdk/pull/449))
26+
27+
## 0.36.0
28+
29+
* Fix bug in `KeyPair.fromSecretSeed(char[] seed)`. ([#447](https://github.com/stellar/java-stellar-sdk/pull/447))
30+
* Shade kotlin dependencies to prevent 'Duplicate class' errors. ([#448](https://github.com/stellar/java-stellar-sdk/pull/448))
31+
32+
## 0.35.0
33+
34+
* Update JDK compatibility version from Java 1.6 to Java 1.8 and bump the version of few libraries ([#444](https://github.com/stellar/java-stellar-sdk/pull/444)):
35+
* com.squareup.okhttp3 from `v3.11.0` to `v4.10.0`.
36+
* commons-io:commons-io from `v2.6` to `v2.11.0`.
37+
* junit:junit from `v4.12` to `v4.13.2`.
38+
* org.threeten:threetenbp from `v1.4.4` to `v1.6.0`.
39+
* org.mockito:mockito-core from `v2.21.0` to `v4.6.1`.
40+
* javax.xml.bind:jaxb-api from `v2.3.0` to `v2.3.1`.
41+
42+
## 0.34.2
43+
44+
* Bump gson version from `v2.8.5` to `v2.9.0`. ([#443](https://github.com/stellar/java-stellar-sdk/pull/443))
45+
46+
## 0.34.1
47+
48+
* Fix the `Sep10Challenge.verifyTransactionSignatures` method to handle/ignore signers that are not ed25519 compliant. ([#440](https://github.com/stellar/java-stellar-sdk/pull/440))
49+
50+
## 0.34.0
51+
* Add memo to `Sep10Challenge.newChallenge()` and `Sep10Challenge.readChallengeTransaction`. ([#435](https://github.com/stellar/java-stellar-sdk/pull/435))
52+
53+
## 0.33.0
54+
* Update TransactionResponse to include new Protocol 19 Preconditions ([#428](https://github.com/stellar/java-stellar-sdk/pull/428)).
55+
* Fix asset compare to when asset code are equals ([#424](https://github.com/stellar/java-stellar-sdk/pull/424)).
56+
* LiquidityPoolIDDeserializer is missing from the PageDeserializer. ([#422](https://github.com/stellar/java-stellar-sdk/pull/422))
657

758
## 0.32.0
859

build.gradle

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.okhttpclientVersion= '3.11.0'
2+
ext.okhttpclientVersion= '4.10.0'
33
}
44

55
plugins {
@@ -12,11 +12,15 @@ plugins {
1212
id "java-library"
1313
}
1414

15-
sourceCompatibility = 1.8
16-
version = '0.32.0'
15+
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
16+
version = '0.39.0'
1717
group = 'stellar'
1818
jar.enabled = false
1919

20+
compileJava.options.encoding = 'UTF-8'
21+
compileTestJava.options.encoding = 'UTF-8'
22+
javadoc.options.encoding = 'UTF-8'
23+
2024
publishing {
2125
publications {
2226
sdkLibrary(MavenPublication) { publication ->
@@ -35,7 +39,11 @@ shadowJar {
3539
duplicatesStrategy DuplicatesStrategy.EXCLUDE
3640
archiveClassifier.set('')
3741
archiveFileName.set('stellar-sdk.jar')
38-
relocate 'com.','shadow.com.'
42+
relocate('com.', 'shadow.com.') {
43+
// okhttp hardcodes android platform class loading to this package, shadowing would attempt to rewrite the hardcode
44+
// to be 'shadow.com.android.org.conscrypt' which we don't want to happen.
45+
exclude 'com.android.org.conscrypt'
46+
}
3947
relocate 'net.','shadow.net.'
4048
relocate 'javax.annotation', 'shadow.javax.annotation'
4149
relocate 'org.apache','shadow.org.apache'
@@ -45,6 +53,9 @@ shadowJar {
4553
relocate 'org.checkerframework','shadow.org.checkerframework'
4654
relocate 'okhttp3','shadow.okhttp3'
4755
relocate 'okio','shadow.okio'
56+
relocate 'kotlin','shadow.kotlin'
57+
relocate 'org.intellij','shadow.org.intellij'
58+
relocate 'org.jetbrains','shadow.org.jetbrains'
4859
}
4960

5061
repositories {
@@ -57,15 +68,15 @@ dependencies {
5768
implementation 'com.moandjiezana.toml:toml4j:0.7.2'
5869
// use the android version because we don't want java 8 stuff
5970
implementation 'com.google.guava:guava:26.0-android'
60-
implementation 'com.google.code.gson:gson:2.8.5'
61-
implementation 'commons-io:commons-io:2.6'
71+
implementation 'com.google.code.gson:gson:2.9.0'
72+
implementation 'commons-io:commons-io:2.11.0'
6273
implementation 'net.i2p.crypto:eddsa:0.3.0'
63-
implementation 'org.threeten:threetenbp:1.4.4'
74+
implementation 'org.threeten:threetenbp:1.6.0'
6475

65-
testImplementation 'org.mockito:mockito-core:2.21.0'
76+
testImplementation 'org.mockito:mockito-core:4.6.1'
6677
testImplementation "com.squareup.okhttp3:mockwebserver:${okhttpclientVersion}"
67-
testImplementation 'junit:junit:4.12'
68-
testImplementation 'javax.xml.bind:jaxb-api:2.3.0'
78+
testImplementation 'junit:junit:4.13.2'
79+
testImplementation 'javax.xml.bind:jaxb-api:2.3.1'
6980
testImplementation group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '4.12.1'
7081
}
7182
tasks.named('test') { task ->

src/main/java/org/stellar/sdk/KeyPair.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public boolean canSign() {
7373
public static KeyPair fromSecretSeed(char[] seed) {
7474
byte[] decoded = StrKey.decodeStellarSecretSeed(seed);
7575
KeyPair keypair = fromSecretSeed(decoded);
76-
Arrays.fill(decoded, (byte) 0);
7776
return keypair;
7877
}
7978

@@ -309,7 +308,7 @@ public boolean equals(Object object) {
309308
}
310309

311310
KeyPair other = (KeyPair) object;
312-
return this.mPrivateKey.equals(other.mPrivateKey) &&
311+
return Objects.equal(this.mPrivateKey, other.mPrivateKey) &&
313312
this.mPublicKey.equals(other.mPublicKey);
314313

315314
}

src/main/java/org/stellar/sdk/Memo.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package org.stellar.sdk;
22

3-
import com.google.common.io.BaseEncoding;
4-
53
/**
64
* <p>The memo contains optional extra information. It is the responsibility of the client to interpret this value. Memos can be one of the following types:</p>
75
* <ul>
@@ -76,8 +74,7 @@ public static MemoReturnHash returnHash(byte[] bytes) {
7674
* @param hexString
7775
*/
7876
public static MemoReturnHash returnHash(String hexString) {
79-
// We change to lowercase because we want to decode both: upper cased and lower cased alphabets.
80-
return new MemoReturnHash(BaseEncoding.base16().lowerCase().decode(hexString.toLowerCase()));
77+
return new MemoReturnHash(hexString);
8178
}
8279

8380
public static Memo fromXdr(org.stellar.sdk.xdr.Memo memo) {
Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
package org.stellar.sdk;
22

3-
import com.google.common.io.BaseEncoding;
3+
import static com.google.common.base.Preconditions.checkArgument;
4+
import static com.google.common.base.Preconditions.checkNotNull;
45

56
import java.util.Arrays;
67

8+
import com.google.common.io.BaseEncoding;
9+
710
abstract class MemoHashAbstract extends Memo {
811
protected byte[] bytes;
912

1013
public MemoHashAbstract(byte[] bytes) {
11-
if (bytes.length < 32) {
12-
bytes = Util.paddedByteArray(bytes, 32);
13-
} else if (bytes.length > 32) {
14-
throw new MemoTooLongException("MEMO_HASH can contain 32 bytes at max.");
15-
}
16-
14+
checkNotNull(bytes, "bytes cannot be null");
15+
checkArgument(bytes.length == 32, "bytes must be 32-bytes long.");
1716
this.bytes = bytes;
1817
}
1918

@@ -34,29 +33,14 @@ public byte[] getBytes() {
3433
*
3534
* <p>Example:</p>
3635
* <code>
37-
* MemoHash memo = new MemoHash("4142434445");
38-
* memo.getHexValue(); // 4142434445000000000000000000000000000000000000000000000000000000
39-
* memo.getTrimmedHexValue(); // 4142434445
36+
* MemoHash memo = new MemoHash("e98869bba8bce08c10b78406202127f3888c25454cd37b02600862452751f526");
37+
* memo.getHexValue(); // e98869bba8bce08c10b78406202127f3888c25454cd37b02600862452751f526
4038
* </code>
4139
*/
4240
public String getHexValue() {
4341
return BaseEncoding.base16().lowerCase().encode(this.bytes);
4442
}
4543

46-
/**
47-
* <p>Returns hex representation of bytes contained in this memo until null byte (0x00) is found.</p>
48-
*
49-
* <p>Example:</p>
50-
* <code>
51-
* MemoHash memo = new MemoHash("4142434445");
52-
* memo.getHexValue(); // 4142434445000000000000000000000000000000000000000000000000000000
53-
* memo.getTrimmedHexValue(); // 4142434445
54-
* </code>
55-
*/
56-
public String getTrimmedHexValue() {
57-
return this.getHexValue().split("00")[0];
58-
}
59-
6044
@Override
6145
abstract org.stellar.sdk.xdr.Memo toXdr();
6246

@@ -75,6 +59,6 @@ public boolean equals(Object o) {
7559

7660
@Override
7761
public String toString() {
78-
return bytes == null ? "" : Util.paddedByteArrayToString(bytes);
62+
return bytes == null ? "" : getHexValue();
7963
}
8064
}

src/main/java/org/stellar/sdk/MemoText.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package org.stellar.sdk;
22

3+
import static com.google.common.base.Preconditions.checkNotNull;
4+
import static com.google.common.base.Preconditions.checkArgument;
5+
36
import org.stellar.sdk.xdr.MemoType;
47
import org.stellar.sdk.xdr.XdrString;
58

6-
import static com.google.common.base.Preconditions.checkNotNull;
7-
89
/**
910
* Represents MEMO_TEXT.
1011
*/
@@ -20,11 +21,9 @@ public MemoText(byte[] text) {
2021
}
2122

2223
public MemoText(XdrString text) {
23-
this.text = checkNotNull(text, "text cannot be null");
24-
int length = this.text.getBytes().length;
25-
if (length > 28) {
26-
throw new MemoTooLongException("text must be <= 28 bytes. length=" + String.valueOf(length));
27-
}
24+
checkNotNull(text, "text cannot be null");
25+
checkArgument(text.getBytes().length <= 28, "text cannot be more than 28-bytes long.");
26+
this.text = text;
2827
}
2928

3029
public String getText() {

src/main/java/org/stellar/sdk/MemoTooLongException.java

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)