Skip to content

Commit aabd300

Browse files
authored
Merge pull request #142 from proximax-storage/feature/unsigned_version
Support for unsigned version field
2 parents 8d87a85 + 4158c1e commit aabd300

File tree

6 files changed

+19
-20
lines changed

6 files changed

+19
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Minor release with new features and fixes
66
* added MosaicFactory to better support frequent mosaic instantiation and non-standard network currencies
77
* added support for exchange transactions
8+
* added support for unsigned version field for entity info on the chain
89

910
## 0.6.1
1011

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<p align="center"><a href="https://github.com/proximax-storage" target="_blank"><img width="300" srchttps://user-images.githubusercontent.com/29048783/72933958-c8836400-3d30-11ea-99d5-678e20f43e19.png" alt="ProximaX Sirius Blockchain Java SDK"></a></p>
1+
<p align="center"><a href="https://github.com/proximax-storage" target="_blank"><img width="300" src="https://user-images.githubusercontent.com/29048783/72933958-c8836400-3d30-11ea-99d5-678e20f43e19.png" alt="ProximaX Sirius Blockchain Java SDK"></a></p>
22

33
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
44
[![Coverage Status](https://coveralls.io/repos/github/proximax-storage/java-xpx-chain-sdk/badge.svg?branch=master)](https://coveralls.io/github/proximax-storage/java-xpx-chain-sdk?branch=master)

schemas/swagger/swagger.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,7 @@ components:
17331733
* 0xF243 (62019 decimal) - Mosaic_Alias_Resolution.
17341734
NetworkTypeEnum:
17351735
type: integer
1736+
format: int64
17361737
description: |
17371738
The entity version. The higher byte represents the network
17381739
identifier:

src/e2e/java/io/proximax/sdk/E2EBlockchainTest.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,19 @@ void checkBlockchainUpgrade() {
187187

188188
@Test
189189
void loadTransactions() {
190-
for (int i = 0; i<1000; i++) {
190+
// get chain height
191+
final long height = blockchainHttp.getBlockchainHeight().blockingFirst().longValue();
192+
// go over first 50 blocks
193+
for (int i = 0; i<Math.min(height, 50); i++) {
194+
loadTransactions(i);
195+
}
196+
// first 50 blocks got already scanned so start at 50 or last 1000
197+
for (long i = Math.max(height-1000, 50l); i<height; i++) {
191198
loadTransactions(i);
192199
}
193200
}
194201

195-
void loadTransactions(int block) {
202+
void loadTransactions(long block) {
196203
// try to load first 100 transactions and see if we can parse them
197204
List<Transaction> transactions = blockchainHttp.getBlockTransactions(BigInteger.valueOf(block), new QueryParams(100)).blockingFirst();
198205
assertTrue(transactions.size() <= 100);

src/gen/java/io/proximax/sdk/gen/model/BlockDTO.java

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,10 @@
1414
package io.proximax.sdk.gen.model;
1515

1616
import java.util.Objects;
17-
import java.util.Arrays;
18-
import com.google.gson.TypeAdapter;
19-
import com.google.gson.annotations.JsonAdapter;
17+
2018
import com.google.gson.annotations.SerializedName;
21-
import com.google.gson.stream.JsonReader;
22-
import com.google.gson.stream.JsonWriter;
23-
import io.proximax.sdk.gen.model.BlockDTOAllOf;
24-
import io.proximax.sdk.gen.model.EntityDTO;
25-
import io.proximax.sdk.gen.model.EntityTypeEnum;
26-
import io.proximax.sdk.gen.model.UInt64DTO;
27-
import io.proximax.sdk.gen.model.VerifiableEntityDTO;
28-
import io.swagger.annotations.ApiModel;
19+
2920
import io.swagger.annotations.ApiModelProperty;
30-
import java.io.IOException;
3121

3222
/**
3323
* BlockDTO
@@ -44,7 +34,7 @@ public class BlockDTO {
4434

4535
public static final String SERIALIZED_NAME_VERSION = "version";
4636
@SerializedName(SERIALIZED_NAME_VERSION)
47-
private Integer version;
37+
private Long version;
4838

4939
public static final String SERIALIZED_NAME_TYPE = "type";
5040
@SerializedName(SERIALIZED_NAME_TYPE)
@@ -130,7 +120,7 @@ public void setSigner(String signer) {
130120
this.signer = signer;
131121
}
132122

133-
public BlockDTO version(Integer version) {
123+
public BlockDTO version(Long version) {
134124
this.version = version;
135125
return this;
136126
}
@@ -140,11 +130,11 @@ public BlockDTO version(Integer version) {
140130
* @return version
141131
**/
142132
@ApiModelProperty(example = "36867", required = true, value = "The entity version. The higher byte represents the network identifier: * 0x68 (MAIN_NET) - Public main network. * 0x98 (TEST_NET) - Public test network. * 0x60 (MIJIN) - Private network. * 0x90 (MIJIN_TEST) - Private test network. ")
143-
public Integer getVersion() {
133+
public Long getVersion() {
144134
return version;
145135
}
146136

147-
public void setVersion(Integer version) {
137+
public void setVersion(Long version) {
148138
this.version = version;
149139
}
150140

src/test/java/io/proximax/sdk/model/blockchain/BlockInfoTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void createANewBlockInforomDto() {
8484
BlockDTO blockDto = new BlockDTO();
8585
blockDto.setSignature("37351C8244AC166BE6664E3FA954E99A3239AC46E51E2B32CEA1C72DD0851100A7731868E932E1A9BEF8A27D48E1FFEE401E933EB801824373E7537E51733E0F");
8686
blockDto.setSigner("B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF");
87-
blockDto.setVersion(36867);
87+
blockDto.setVersion(36867l);
8888
blockDto.setType(EntityTypeEnum.NUMBER_16705);
8989
blockDto.setHeight(getUint64Dto(2));
9090
blockDto.setTimestamp(getUint64Dto(3));

0 commit comments

Comments
 (0)