-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #335 from /issues/332
Issues/332
- Loading branch information
Showing
19 changed files
with
2,167 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
/** | ||
* An addressable entity. | ||
* Methods and type signatures supported by a contract. | ||
* | ||
* @author [email protected] | ||
*/ | ||
|
41 changes: 41 additions & 0 deletions
41
src/main/java/com/casper/sdk/model/entity/contract/ByteCode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.casper.sdk.model.entity.contract; | ||
|
||
import com.casper.sdk.model.key.Tag; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.*; | ||
|
||
/** | ||
* A container for contract's Wasm bytes | ||
* | ||
* @author [email protected] | ||
*/ | ||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class ByteCode { | ||
|
||
/** The type of Byte code */ | ||
@JsonProperty("kind") | ||
private ByteCodes kind; | ||
/** Byte code */ | ||
@JsonProperty("bytes") | ||
private String bytes; | ||
|
||
public enum ByteCodes implements Tag { | ||
/** Empty byte code */ | ||
Empty(0), | ||
/** Byte code to be executed with the version 1 Casper execution engine */ | ||
V1CasperWasm(1); | ||
private final byte tag; | ||
ByteCodes(final int tag) { | ||
this.tag = (byte) tag; | ||
} | ||
@Override | ||
public byte getByteTag() { | ||
return tag; | ||
} | ||
|
||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/com/casper/sdk/model/entity/contract/NamedKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.casper.sdk.model.entity.contract; | ||
|
||
import com.casper.sdk.model.clvalue.AbstractCLValue; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.*; | ||
|
||
/** | ||
* A key with a name | ||
* | ||
* @author [email protected] | ||
*/ | ||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class NamedKey { | ||
|
||
@JsonProperty("named_key") | ||
private AbstractCLValue<?,?> namedKey; | ||
|
||
@JsonProperty("name") | ||
private AbstractCLValue<?,?> name; | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/com/casper/sdk/model/entity/contract/Package.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.casper.sdk.model.entity.contract; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.*; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Package associated with a native contract implementation | ||
* | ||
* @author [email protected] | ||
*/ | ||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class Package { | ||
|
||
/** All versions (enabled & disabled) */ | ||
@JsonProperty("versions") | ||
private List<Versions> versions; | ||
|
||
/** Collection of disabled entity versions. | ||
* The runtime will not permit disabled entity versions to be executed */ | ||
@JsonProperty("disabled_versions") | ||
private List<Versions> disabledVersions; | ||
|
||
/** Mapping maintaining the set of URefs associated with each "user group". | ||
* This can be used to control access to methods in a particular version of the entity. | ||
* A method is callable by any context which "knows" any of the URefs associated with the method's user group */ | ||
@JsonProperty("groups") | ||
private List<String> groups; | ||
|
||
/** A flag that determines whether an entity is locked */ | ||
@JsonProperty("lock_status") | ||
private PackageStatus lockStatus; | ||
|
||
/** | ||
* Determines the lock status of the package | ||
*/ | ||
public enum PackageStatus { | ||
// The package is locked and cannot be versioned | ||
Locked, | ||
// The package is unlocked and can be versioned | ||
Unlocked | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/casper/sdk/model/entity/contract/VersionKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.casper.sdk.model.entity.contract; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.*; | ||
|
||
/** | ||
* Child of {@link Versions} | ||
* | ||
* @author [email protected] | ||
*/ | ||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class VersionKey { | ||
|
||
/** Major element of `ProtocolVersion` a `ContractVersion` is compatible with */ | ||
@JsonProperty("protocol_version_major") | ||
private int protocolVersionMajor; | ||
|
||
/** Automatically incremented value for a contract version within a major `ProtocolVersion` */ | ||
@JsonProperty("entity_version") | ||
private int entityVersion; | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/casper/sdk/model/entity/contract/Versions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.casper.sdk.model.entity.contract; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.*; | ||
|
||
|
||
/** | ||
* Child of {@link Package} | ||
* | ||
* @author [email protected] | ||
*/ | ||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class Versions { | ||
|
||
/** Major element of `ProtocolVersion` combined with `EntityVersion` */ | ||
@JsonProperty("entity_version_key") | ||
private VersionKey entityVersionKey; | ||
|
||
/** Addressable Entity */ | ||
@JsonProperty("addressable_entity_hash") | ||
private String addressableEntityHash; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/com/casper/sdk/model/transaction/kind/AddressableEntityKind.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.casper.sdk.model.transaction.kind; | ||
|
||
import com.casper.sdk.model.entity.AddressableEntity; | ||
import com.casper.sdk.model.entity.Entity; | ||
import com.casper.sdk.model.storedvalue.StoredValue; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.*; | ||
|
||
/** | ||
* An AddressableEntityKind | ||
* See {@link AddressableEntity} | ||
* | ||
* @author [email protected] | ||
*/ | ||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class AddressableEntityKind implements StoredValue<Entity> { | ||
|
||
@JsonProperty("AddressableEntity") | ||
private Entity value; | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/casper/sdk/model/transaction/kind/ByteCodeKind.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.casper.sdk.model.transaction.kind; | ||
|
||
import com.casper.sdk.model.entity.contract.ByteCode; | ||
import com.casper.sdk.model.storedvalue.StoredValue; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.*; | ||
|
||
/** | ||
* A ByteCode kind | ||
* See {@link ByteCode} | ||
* | ||
* @author [email protected] | ||
*/ | ||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class ByteCodeKind implements StoredValue<ByteCode> { | ||
|
||
@JsonProperty("ByteCode") | ||
private ByteCode value; | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/com/casper/sdk/model/transaction/kind/EntryPointKind.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.casper.sdk.model.transaction.kind; | ||
|
||
import com.casper.sdk.model.contract.EntryPoint; | ||
import com.casper.sdk.model.contract.EntryPointValue; | ||
import com.casper.sdk.model.storedvalue.StoredValue; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.*; | ||
|
||
/** | ||
* An EntryPointKind | ||
* See {@link EntryPoint} | ||
* | ||
* @author [email protected] | ||
*/ | ||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class EntryPointKind implements StoredValue<EntryPointValue> { | ||
|
||
@JsonProperty("EntryPoint") | ||
private EntryPointValue value; | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/casper/sdk/model/transaction/kind/NamedKeyKind.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.casper.sdk.model.transaction.kind; | ||
|
||
import com.casper.sdk.model.entity.contract.NamedKey; | ||
import com.casper.sdk.model.storedvalue.StoredValue; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.*; | ||
|
||
/** | ||
* A NamedKeyKind | ||
* See {@link NamedKey} | ||
* | ||
* @author [email protected] | ||
*/ | ||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class NamedKeyKind implements StoredValue<NamedKey> { | ||
|
||
@JsonProperty("NamedKey") | ||
private NamedKey value; | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/casper/sdk/model/transaction/kind/PackageKind.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.casper.sdk.model.transaction.kind; | ||
|
||
import com.casper.sdk.model.entity.contract.Package; | ||
import com.casper.sdk.model.storedvalue.StoredValue; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.*; | ||
|
||
/** | ||
* A PackageKind | ||
* See {@link Package} | ||
* | ||
* @author [email protected] | ||
*/ | ||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class PackageKind implements StoredValue<Package> { | ||
|
||
@JsonProperty("Package") | ||
private Package value; | ||
|
||
} |
Oops, something went wrong.