Skip to content

Commit f4c2dbc

Browse files
committed
Javadocs, tidy up, more tests with live CCTL data
1 parent 54cbbf3 commit f4c2dbc

21 files changed

+575
-75
lines changed

src/main/java/com/casper/sdk/model/entity/AddressableEntity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
/**
1111
* An addressable entity.
12+
* Methods and type signatures supported by a contract.
1213
*
1314
1415
*/
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.casper.sdk.model.entity.contract;
2+
3+
import com.casper.sdk.model.key.Tag;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import lombok.*;
6+
7+
/**
8+
* A container for contract's Wasm bytes
9+
*
10+
11+
*/
12+
@Getter
13+
@Setter
14+
@Builder
15+
@AllArgsConstructor
16+
@NoArgsConstructor
17+
public class ByteCode {
18+
19+
/** The type of Byte code */
20+
@JsonProperty("kind")
21+
private ByteCodes kind;
22+
/** Byte code */
23+
@JsonProperty("bytes")
24+
private String bytes;
25+
26+
public enum ByteCodes implements Tag {
27+
/** Empty byte code */
28+
Empty(0),
29+
/** Byte code to be executed with the version 1 Casper execution engine */
30+
V1CasperWasm(1);
31+
private final byte tag;
32+
ByteCodes(final int tag) {
33+
this.tag = (byte) tag;
34+
}
35+
@Override
36+
public byte getByteTag() {
37+
return tag;
38+
}
39+
40+
}
41+
}

src/main/java/com/casper/sdk/model/entity/contract/DisabledVersions.java

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

src/main/java/com/casper/sdk/model/entity/contract/NamedKey.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import lombok.*;
66

77
/**
8+
* A key with a name
9+
*
810
911
*/
1012
@Getter

src/main/java/com/casper/sdk/model/entity/contract/Package.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import java.util.List;
77

88
/**
9+
* Package associated with a native contract implementation
10+
*
911
1012
*/
1113
@Getter
@@ -15,16 +17,32 @@
1517
@NoArgsConstructor
1618
public class Package {
1719

20+
/** All versions (enabled & disabled) */
1821
@JsonProperty("versions")
1922
private List<Versions> versions;
2023

24+
/** Collection of disabled entity versions.
25+
* The runtime will not permit disabled entity versions to be executed */
2126
@JsonProperty("disabled_versions")
2227
private List<Versions> disabledVersions;
2328

29+
/** Mapping maintaining the set of URefs associated with each "user group".
30+
* This can be used to control access to methods in a particular version of the entity.
31+
* A method is callable by any context which "knows" any of the URefs associated with the method's user group */
2432
@JsonProperty("groups")
2533
private List<String> groups;
2634

35+
/** A flag that determines whether an entity is locked */
2736
@JsonProperty("lock_status")
2837
private PackageStatus lockStatus;
2938

39+
/**
40+
* Determines the lock status of the package
41+
*/
42+
public enum PackageStatus {
43+
// The package is locked and cannot be versioned
44+
Locked,
45+
// The package is unlocked and can be versioned
46+
Unlocked
47+
}
3048
}

src/main/java/com/casper/sdk/model/entity/contract/PackageStatus.java

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

src/main/java/com/casper/sdk/model/entity/contract/VersionKey.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import lombok.*;
55

66
/**
7+
* Child of {@link Versions}
8+
*
79
810
*/
911
@Getter
@@ -13,9 +15,11 @@
1315
@NoArgsConstructor
1416
public class VersionKey {
1517

18+
/** Major element of `ProtocolVersion` a `ContractVersion` is compatible with */
1619
@JsonProperty("protocol_version_major")
1720
private int protocolVersionMajor;
1821

22+
/** Automatically incremented value for a contract version within a major `ProtocolVersion` */
1923
@JsonProperty("entity_version")
2024
private int entityVersion;
2125

src/main/java/com/casper/sdk/model/entity/contract/Versions.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
import com.fasterxml.jackson.annotation.JsonProperty;
44
import lombok.*;
55

6+
67
/**
8+
* Child of {@link Package}
9+
*
710
811
*/
912
@Getter
@@ -13,11 +16,12 @@
1316
@NoArgsConstructor
1417
public class Versions {
1518

19+
/** Major element of `ProtocolVersion` combined with `EntityVersion` */
1620
@JsonProperty("entity_version_key")
1721
private VersionKey entityVersionKey;
1822

23+
/** Addressable Entity */
1924
@JsonProperty("addressable_entity_hash")
2025
private String addressableEntityHash;
2126

22-
2327
}

src/main/java/com/casper/sdk/model/storedvalue/StoredValueTypeData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public enum StoredValueTypeData {
2828
STORED_VALUE_BID("Bid", StoredValueBid.class),
2929
STORED_VALUE_BID_KIND("BidKind", StoredValueBidKind.class),
3030
STORED_VALUE_WITHDRAW("Withdraw", StoredValueWithdraw.class),
31-
STORED_VALUE_BYTECODE("ByteCode", ByteCode.class),
31+
STORED_VALUE_BYTECODE("ByteCode", ByteCodeKind.class),
3232
STORED_VALUE_ADDRESSABLE_ENTITY("AddressableEntity", AddressableEntityKind.class),
3333
STORED_VALUE_PACKAGE("Package", PackageKind.class),
3434
STORED_VALUE_NAMED_KEY("NamedKey", NamedKeyKind.class),

src/main/java/com/casper/sdk/model/transaction/kind/AddressableEntityKind.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package com.casper.sdk.model.transaction.kind;
22

3+
import com.casper.sdk.model.entity.AddressableEntity;
34
import com.casper.sdk.model.entity.Entity;
45
import com.casper.sdk.model.storedvalue.StoredValue;
56
import com.fasterxml.jackson.annotation.JsonProperty;
67
import lombok.*;
78

89
/**
10+
* An AddressableEntityKind
11+
* See {@link AddressableEntity}
12+
*
913
1014
*/
1115
@Getter

0 commit comments

Comments
 (0)