Skip to content

Commit 45e24d3

Browse files
committed
added ability to reset ext tx data and payload
1 parent ec36cba commit 45e24d3

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ project build.gradle
2424
```groovy
2525
2626
ext {
27-
minterBlockchainSDK = "0.13.0"
27+
minterBlockchainSDK = "0.13.1"
2828
}
2929
3030
dependencies {

RELEASE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Release notes
22

3+
## 0.13.1
4+
- Ability to reset transaction data and payload in external transaction builder
5+
36
## 0.13.0
47
- Changes for signing transaction logic
58
- Fixed some api result models

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ buildscript {
3131
mavenLocal()
3232
}
3333
dependencies {
34-
classpath 'com.android.tools.build:gradle:4.0.0'
34+
classpath 'com.android.tools.build:gradle:4.0.1'
3535
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
3636
}
3737
}
@@ -57,12 +57,12 @@ apply plugin: 'com.jfrog.bintray'
5757

5858

5959
group = 'network.minter.android'
60-
version = '0.13.0'
60+
version = '0.13.1'
6161

6262
ext {
6363
minterMinSdk = 16
6464
minterMaxSdk = 29
65-
minterBuildTools = "29.0.2"
65+
minterBuildTools = "29.0.3"
6666
minterLibSupport = "28.0.0"
6767
minterCoreVers = "0.7.1"
6868

src/main/java/network/minter/blockchain/models/operational/ExternalTransaction.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,20 @@ public void cleanup() {
219219
mPayload = null;
220220
}
221221

222+
public void resetPayload(BytesData payload) {
223+
checkArgument(payload.size() <= 1024, "Payload maximum size: 1024 bytes");
224+
mPayload = payload;
225+
}
226+
227+
public <Op extends Operation> void resetData(Op operationData) {
228+
mType = operationData.getType();
229+
mOperationData = operationData;
230+
FieldsValidationResult dataValidation = mOperationData.validate();
231+
if (dataValidation != null) {
232+
checkArgument(dataValidation.isValid(), dataValidation.getInvalidFieldsMessages());
233+
}
234+
}
235+
222236
@Override
223237
public int describeContents() {
224238
return 0;
@@ -250,7 +264,7 @@ void decodeRLP(Object[] raw) {
250264
}
251265

252266
public static class Builder {
253-
private ExternalTransaction mTx;
267+
private final ExternalTransaction mTx;
254268

255269
public Builder() {
256270
mTx = new ExternalTransaction();
@@ -320,6 +334,11 @@ public Builder setPayload(ByteBuffer byteBuffer) {
320334
public <Op extends Operation> Builder setData(Op operationData) {
321335
mTx.mType = operationData.getType();
322336
mTx.mOperationData = operationData;
337+
FieldsValidationResult dataValidation = mTx.mOperationData.validate();
338+
if (dataValidation != null) {
339+
checkArgument(dataValidation.isValid(), dataValidation.getInvalidFieldsMessages());
340+
}
341+
323342
return this;
324343
}
325344

0 commit comments

Comments
 (0)