Skip to content

Commit 7f1bfe5

Browse files
committed
Merge branch 'release/1.8.0'
2 parents fa70f8e + 98d5104 commit 7f1bfe5

File tree

15 files changed

+183
-8
lines changed

15 files changed

+183
-8
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: "\U0001F41C Bug report"
3+
about: Report a reproducible bug.
4+
title: ''
5+
labels: new-bug
6+
assignees: ''
7+
8+
---
9+
10+
### Subject of the issue
11+
12+
<!-- Describe your issue here. -->
13+
14+
### Your environment
15+
16+
<!--
17+
* Software version: `algod -v`
18+
* Node status if applicable: `goal node status`
19+
* Operating System details.
20+
* In many cases log files and cadaver files are also useful to include. Since these files may be large, an Algorand developer may request them later. These files may include public addresses that you're participating with. If that is a concern please be sure to scrub that data.
21+
-->
22+
23+
### Steps to reproduce
24+
25+
1.
26+
2.
27+
28+
### Expected behaviour
29+
30+
### Actual behaviour
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: "\U0001F514 Feature Request"
3+
about: Suggestions for how we can improve the algorand platform.
4+
title: ''
5+
labels: new-feature-request
6+
assignees: ''
7+
---
8+
9+
## Problem
10+
11+
<!-- What is the problem that we’re trying to solve? -->
12+
13+
## Solution
14+
15+
<!-- Do you have a potential/suggested solution? Document more than one if possible. -->
16+
17+
## Dependencies
18+
19+
<!-- Does the solution have any team or design dependencies? -->
20+
21+
## Urgency
22+
23+
<!-- What is the urgency here and why? -->

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 1.8.0
2+
- Added toSeed() method in Account.java
3+
- Regenerate HTTP Client (Asset b64 fields + App extra pages)
4+
- Set default header for base execute
5+
16
# 1.7.0
27
- Implement dynamic opcode accounting, backward jumps, loops, callsub, retsub
38
- Implement ability to pool fees
@@ -7,8 +12,6 @@
712

813
# 1.6.0
914
- Add static qualifiers to json creators for onCompletion enum serialization.
10-
- Bump guava from 28.2-android to 29.0-android in /generator.
11-
- Bump guava from 28.2-android to 29.0-android.
1215
- Corrected Exception message for Keccak-256 hash function.
1316
- Add TEAL 3 support.
1417
- Regenerated comment.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Maven:
2323
<dependency>
2424
<groupId>com.algorand</groupId>
2525
<artifactId>algosdk</artifactId>
26-
<version>1.7.0</version>
26+
<version>1.8.0</version>
2727
</dependency>
2828
```
2929

generator/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
<dependency>
169169
<groupId>com.algorand</groupId>
170170
<artifactId>algosdk</artifactId>
171-
<version>1.7.0</version>
171+
<version>1.8.0</version>
172172
</dependency>
173173

174174
<!-- testing -->

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.algorand</groupId>
66
<artifactId>algosdk</artifactId>
7-
<version>1.7.0</version>
7+
<version>1.8.0</version>
88
<packaging>jar</packaging>
99

1010
<name>${project.groupId}:${project.artifactId}</name>

src/main/java/com/algorand/algosdk/account/Account.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,16 @@ public Signature tealSignFromProgram(byte[] data, byte[] program) throws NoSuchA
559559
return this.tealSign(data, lsig.toAddress());
560560
}
561561

562+
/**
563+
* 25 word mnemonic is obtained and converted to 32 byte private key.
564+
*
565+
* @return 32 byte private key
566+
*/
567+
public byte[] toSeed() throws GeneralSecurityException {
568+
String mnemonic = toMnemonic();
569+
return Mnemonic.toKey(mnemonic);
570+
}
571+
562572
// Return a pre-set seed in response to nextBytes or generateSeed
563573
private static class FixedSecureRandom extends SecureRandom {
564574
private final byte[] fixedValue;

src/main/java/com/algorand/algosdk/v2/client/common/Client.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public Response executeCall(QueryData qData, HttpMethod httpMethod, String[] hea
103103
MediaType.parse("Binary data"),
104104
qData.bodySegments.isEmpty() ? new byte[0] : qData.bodySegments.get(0));
105105
reqBuilder.post(rb);
106+
reqBuilder.addHeader("Content-Type","application/x-binary");
106107
break;
107108
}
108109

src/main/java/com/algorand/algosdk/v2/client/model/Account.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ public String address() throws NoSuchAlgorithmException {
5353
@JsonProperty("apps-local-state")
5454
public List<ApplicationLocalState> appsLocalState = new ArrayList<ApplicationLocalState>();
5555

56+
/**
57+
* (teap) the sum of all extra application program pages for this account.
58+
*/
59+
@JsonProperty("apps-total-extra-pages")
60+
public Long appsTotalExtraPages;
61+
5662
/**
5763
* (tsch) stores the sum of all of the local schemas and global schemas in this
5864
* account.
@@ -184,6 +190,7 @@ public boolean equals(Object o) {
184190
if (!Objects.deepEquals(this.amount, other.amount)) return false;
185191
if (!Objects.deepEquals(this.amountWithoutPendingRewards, other.amountWithoutPendingRewards)) return false;
186192
if (!Objects.deepEquals(this.appsLocalState, other.appsLocalState)) return false;
193+
if (!Objects.deepEquals(this.appsTotalExtraPages, other.appsTotalExtraPages)) return false;
187194
if (!Objects.deepEquals(this.appsTotalSchema, other.appsTotalSchema)) return false;
188195
if (!Objects.deepEquals(this.assets, other.assets)) return false;
189196
if (!Objects.deepEquals(this.authAddr, other.authAddr)) return false;

src/main/java/com/algorand/algosdk/v2/client/model/ApplicationParams.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ public String creator() throws NoSuchAlgorithmException {
5959
}
6060
public Address creator;
6161

62+
/**
63+
* (epp) the amount of extra program pages available to this app.
64+
*/
65+
@JsonProperty("extra-program-pages")
66+
public Long extraProgramPages;
67+
6268
/**
6369
* [\gs) global schema
6470
*/
@@ -87,6 +93,7 @@ public boolean equals(Object o) {
8793
if (!Objects.deepEquals(this.approvalProgram, other.approvalProgram)) return false;
8894
if (!Objects.deepEquals(this.clearStateProgram, other.clearStateProgram)) return false;
8995
if (!Objects.deepEquals(this.creator, other.creator)) return false;
96+
if (!Objects.deepEquals(this.extraProgramPages, other.extraProgramPages)) return false;
9097
if (!Objects.deepEquals(this.globalState, other.globalState)) return false;
9198
if (!Objects.deepEquals(this.globalStateSchema, other.globalStateSchema)) return false;
9299
if (!Objects.deepEquals(this.localStateSchema, other.localStateSchema)) return false;

src/main/java/com/algorand/algosdk/v2/client/model/AssetParams.java

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,25 @@ public String metadataHash() {
7272
public byte[] metadataHash;
7373

7474
/**
75-
* (an) Name of this asset, as supplied by the creator.
75+
* (an) Name of this asset, as supplied by the creator. Included only when the
76+
* asset name is composed of printable utf-8 characters.
7677
*/
7778
@JsonProperty("name")
7879
public String name;
7980

81+
/**
82+
* Base64 encoded name of this asset, as supplied by the creator.
83+
*/
84+
@JsonProperty("name-b64")
85+
public void nameB64(String base64Encoded) {
86+
this.nameB64 = Encoder.decodeFromBase64(base64Encoded);
87+
}
88+
@JsonProperty("name-b64")
89+
public String nameB64() {
90+
return Encoder.encodeToBase64(this.nameB64);
91+
}
92+
public byte[] nameB64;
93+
8094
/**
8195
* (r) Address of account holding reserve (non-minted) units of this asset.
8296
*/
@@ -90,17 +104,45 @@ public String metadataHash() {
90104
public java.math.BigInteger total;
91105

92106
/**
93-
* (un) Name of a unit of this asset, as supplied by the creator.
107+
* (un) Name of a unit of this asset, as supplied by the creator. Included only
108+
* when the name of a unit of this asset is composed of printable utf-8 characters.
94109
*/
95110
@JsonProperty("unit-name")
96111
public String unitName;
97112

98113
/**
99-
* (au) URL where more information about the asset can be retrieved.
114+
* Base64 encoded name of a unit of this asset, as supplied by the creator.
115+
*/
116+
@JsonProperty("unit-name-b64")
117+
public void unitNameB64(String base64Encoded) {
118+
this.unitNameB64 = Encoder.decodeFromBase64(base64Encoded);
119+
}
120+
@JsonProperty("unit-name-b64")
121+
public String unitNameB64() {
122+
return Encoder.encodeToBase64(this.unitNameB64);
123+
}
124+
public byte[] unitNameB64;
125+
126+
/**
127+
* (au) URL where more information about the asset can be retrieved. Included only
128+
* when the URL is composed of printable utf-8 characters.
100129
*/
101130
@JsonProperty("url")
102131
public String url;
103132

133+
/**
134+
* Base64 encoded URL where more information about the asset can be retrieved.
135+
*/
136+
@JsonProperty("url-b64")
137+
public void urlB64(String base64Encoded) {
138+
this.urlB64 = Encoder.decodeFromBase64(base64Encoded);
139+
}
140+
@JsonProperty("url-b64")
141+
public String urlB64() {
142+
return Encoder.encodeToBase64(this.urlB64);
143+
}
144+
public byte[] urlB64;
145+
104146
@Override
105147
public boolean equals(Object o) {
106148

@@ -116,10 +158,13 @@ public boolean equals(Object o) {
116158
if (!Objects.deepEquals(this.manager, other.manager)) return false;
117159
if (!Objects.deepEquals(this.metadataHash, other.metadataHash)) return false;
118160
if (!Objects.deepEquals(this.name, other.name)) return false;
161+
if (!Objects.deepEquals(this.nameB64, other.nameB64)) return false;
119162
if (!Objects.deepEquals(this.reserve, other.reserve)) return false;
120163
if (!Objects.deepEquals(this.total, other.total)) return false;
121164
if (!Objects.deepEquals(this.unitName, other.unitName)) return false;
165+
if (!Objects.deepEquals(this.unitNameB64, other.unitNameB64)) return false;
122166
if (!Objects.deepEquals(this.url, other.url)) return false;
167+
if (!Objects.deepEquals(this.urlB64, other.urlB64)) return false;
123168

124169
return true;
125170
}

src/main/java/com/algorand/algosdk/v2/client/model/TransactionApplication.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ public String clearStateProgram() {
9797
}
9898
public byte[] clearStateProgram;
9999

100+
/**
101+
* (epp) specifies the additional app program len requested in pages.
102+
*/
103+
@JsonProperty("extra-program-pages")
104+
public Long extraProgramPages;
105+
100106
/**
101107
* (apfa) Lists the applications in addition to the application-id whose global
102108
* states may be accessed by this application's approval-program and
@@ -156,6 +162,7 @@ public boolean equals(Object o) {
156162
if (!Objects.deepEquals(this.applicationId, other.applicationId)) return false;
157163
if (!Objects.deepEquals(this.approvalProgram, other.approvalProgram)) return false;
158164
if (!Objects.deepEquals(this.clearStateProgram, other.clearStateProgram)) return false;
165+
if (!Objects.deepEquals(this.extraProgramPages, other.extraProgramPages)) return false;
159166
if (!Objects.deepEquals(this.foreignApps, other.foreignApps)) return false;
160167
if (!Objects.deepEquals(this.foreignAssets, other.foreignAssets)) return false;
161168
if (!Objects.deepEquals(this.globalStateSchema, other.globalStateSchema)) return false;

src/test/java/com/algorand/algosdk/account/TestAccount.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,4 +326,12 @@ public void testTealSign() throws Exception {
326326
}
327327
assertThat(verified).isTrue();
328328
}
329+
330+
@Test
331+
void testToSeed() throws Exception {
332+
final String FROM_SK = "actress tongue harbor tray suspect odor load topple vocal avoid ignore apple lunch unknown tissue museum once switch captain place lemon sail outdoor absent creek";
333+
byte[] seed = Mnemonic.toKey(FROM_SK);
334+
Account account = new Account(seed);
335+
assertThat(account.toSeed()).isEqualTo(seed);
336+
}
329337
}

templates/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM algorand-generator

templates/generate.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# Navigate back to the project directory
5+
rootdir=`dirname $0`
6+
pushd $rootdir/.. > /dev/null
7+
8+
$GENERATOR \
9+
java \
10+
-c "src/main/java/com/algorand/algosdk/v2/client/common" \
11+
-cp "com.algorand.algosdk.v2.client.common" \
12+
-m "src/main/java/com/algorand/algosdk/v2/client/model" \
13+
-mp "com.algorand.algosdk.v2.client.model" \
14+
-n "AlgodClient" \
15+
-p "src/main/java/com/algorand/algosdk/v2/client/algod" \
16+
-pp "com.algorand.algosdk.v2.client.algod" \
17+
-t "X-Algo-API-Token" \
18+
-tr \
19+
-s "$ALGOD_SPEC"
20+
21+
# There is one enum only defined by indexer. Run this second to avoid
22+
# overwriting the second one.
23+
$GENERATOR \
24+
java \
25+
-c "src/main/java/com/algorand/algosdk/v2/client/common" \
26+
-cp "com.algorand.algosdk.v2.client.common" \
27+
-m "src/main/java/com/algorand/algosdk/v2/client/model" \
28+
-mp "com.algorand.algosdk.v2.client.model" \
29+
-n "IndexerClient" \
30+
-p "src/main/java/com/algorand/algosdk/v2/client/indexer" \
31+
-pp "com.algorand.algosdk.v2.client.indexer" \
32+
-t "X-Indexer-API-Token" \
33+
-s "$INDEXER_SPEC"

0 commit comments

Comments
 (0)