Skip to content

Commit

Permalink
Merge pull request #318 from /issues/314
Browse files Browse the repository at this point in the history
Issues/314 - Legacy API fixes
  • Loading branch information
cnorburn authored Jul 22, 2024
2 parents 74b583c + 40494d1 commit 2d580f6
Show file tree
Hide file tree
Showing 48 changed files with 2,849 additions and 2,893 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ apply plugin: 'java'

group = 'network.casper'
// Version number update for release
version='2.5.8'
version='2.7.0_SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8

Expand Down
42 changes: 32 additions & 10 deletions script/docker-copy-assets
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
#!/usr/bin/env bash
BASEDIR=$(builtin cd .. || exit 1; pwd)
#CONTAINER_NAME="cspr-nctl"
CONTAINER_NAME="cspr-nctl-condor"
CONTAINER_NAME="cspr-cctl"
CCTL_ASSETS=/home/cctl/cctl/assets
#CONTAINER_NAME="cspr-nctl-condor"
# clear the assets folder
rm -rf "${BASEDIR}/assets"
mkdir "${BASEDIR}/assets"
# copy net-1 users
docker cp ${CONTAINER_NAME}:/home/casper/casper-nctl/assets/net-1/users "${BASEDIR}/assets/net-1"
# copy net-1 chainspec
docker cp ${CONTAINER_NAME}:/home/casper/casper-nctl/assets/net-1/chainspec "${BASEDIR}/assets/net-1"
# copy faucet keys
docker cp ${CONTAINER_NAME}:/home/casper/casper-nctl/assets/net-1/faucet "${BASEDIR}/assets/net-1"
#rm -rf "${BASEDIR}/assets"
#mkdir "${BASEDIR}/assets"
## copy net-1 users
#docker cp ${CONTAINER_NAME}:/home/casper/casper-nctl/assets/net-1/users "${BASEDIR}/assets/net-1"
## copy net-1 chainspec
#docker cp ${CONTAINER_NAME}:/home/casper/casper-nctl/assets/net-1/chainspec "${BASEDIR}/assets/net-1"
## copy faucet keys
#docker cp ${CONTAINER_NAME}:/home/casper/casper-nctl/assets/net-1/faucet "${BASEDIR}/assets/net-1"
#



echo -e "Starting assets\n"
echo -e "[ Copying the test node assets to a local directory ]\n"

# clear the assets folder
rm -rf "${BASEDIR}"/assets
mkdir "${BASEDIR}"/assets
mkdir "${BASEDIR}"/assets/net-1
#mkdir "${BASEDIR}"/assets/chainspec
#mkdir "${BASEDIR}"/assets/faucet
# copy net-1 users
docker cp cspr-cctl:$CCTL_ASSETS/users/. "${BASEDIR}"/assets/net-1 > /dev/null 2>&1
# copy net-1 chainspec
docker cp cspr-cctl:$CCTL_ASSETS/genesis "${BASEDIR}"/assets/net-1/chainspec > /dev/null 2>&1
# copy faucet keys
docker cp cspr-cctl:$CCTL_ASSETS/faucet/ "${BASEDIR}"/assets/net-1/faucet > /dev/null 2>&1

echo -e "Finished assets\n"
36 changes: 9 additions & 27 deletions src/main/java/com/casper/sdk/model/bid/Bid.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.*;

import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
Expand All @@ -30,47 +26,33 @@
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Bid implements BidKind {
public class Bid {

/**
* The purse that was used for bonding.
*/
/** The purse that was used for bonding. */
@JsonProperty("bonding_purse")
private URef bondingPurse;

/**
* Delegation rate
*/
/** Delegation rate */
@JsonProperty("delegation_rate")
private int delegationRate;

/**
* This validator's delegators, indexed by their public keys
*/
/** This validator's delegators, indexed by their public keys */
@JsonIgnore
@Builder.Default
private Map<PublicKey, Delegator> delegators = new LinkedHashMap<>();

/**
* `true` if validator has been \"evicted\"
*/
/** `true` if validator has been \"evicted\" */
private boolean inactive;

/**
* The amount of tokens staked by a validator (not including delegators).
*/
/** The amount of tokens staked by a validator (not including delegators). */
@JsonIgnore
private BigInteger stakedAmount;

/**
* Validator PublicKey
*/
/** Validator PublicKey */
@JsonProperty("validator_public_key")
private PublicKey validatorPublicKey;

/**
* Vesting schedule for a genesis validator. `None` if non-genesis validator.
*/
/** Vesting schedule for a genesis validator. `None` if non-genesis validator. */
@JsonProperty("vesting_schedule")
private VestingSchedule vestingSchedule;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/casper/sdk/model/bid/BidKind.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({
@JsonSubTypes.Type(value = Bid.class, name = "Unified"),
@JsonSubTypes.Type(value = UnifiedBid.class, name = "Unified"),
@JsonSubTypes.Type(value = ValidatorBid.class, name = "Validator"),
@JsonSubTypes.Type(value = Delegator.class, name = "Delegator"),
@JsonSubTypes.Type(value = DelegatorBid.class, name = "Delegator"),
@JsonSubTypes.Type(value = Bridge.class, name = "Bridge"),
@JsonSubTypes.Type(value = ValidatorCredit.class, name = "Credit")
})
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/casper/sdk/model/bid/Delegator.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Delegator implements BidKind {
public class Delegator {
/**
* @see PublicKey
*/
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/casper/sdk/model/bid/DelegatorBid.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.casper.sdk.model.bid;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

/**
* Condor V2.0.0 implementation of a Delegator.
*
* @author [email protected]
*/
@Getter
@Setter
@AllArgsConstructor
public class DelegatorBid extends Delegator implements BidKind {
}
16 changes: 16 additions & 0 deletions src/main/java/com/casper/sdk/model/bid/UnifiedBid.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.casper.sdk.model.bid;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

/**
* Condor V2.0.0 implementation of a Bid.
*
* @author [email protected]
*/
@Getter
@Setter
@AllArgsConstructor
public class UnifiedBid extends Bid implements BidKind {
}
4 changes: 2 additions & 2 deletions src/main/java/com/casper/sdk/model/bid/ValidatorCredit.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ public class ValidatorCredit implements BidKind {
/** Validator public key */
@JsonProperty("validator_public_key")
private PublicKey validatorPublicKey;
/* The era id the credit was created. */
/** The era id the credit was created. */
@JsonProperty("era_id")
private long eraId;
/* The credit amount. */
/** The credit amount. */
@JsonProperty("amount")
private BigInteger amount;
}
26 changes: 6 additions & 20 deletions src/main/java/com/casper/sdk/model/contract/Contract.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package com.casper.sdk.model.contract;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.*;

import java.util.List;

Expand All @@ -23,33 +19,23 @@
@NoArgsConstructor
public class Contract {

/**
* contract_package_hash(String) - The hash address of the contract package.
*/
/** contract_package_hash(String) - The hash address of the contract package. */
@JsonProperty("contract_package_hash")
private String packageHash;

/**
* contract_wasm_hash(String) The hash address of the contract wasm.
*/
/** contract_wasm_hash(String) The hash address of the contract wasm. */
@JsonProperty("contract_wasm_hash")
private String wasmHash;

/**
* entry_points(Array) - A list of entry points.
*/
/** entry_points(Array) - A list of entry points. */
@JsonProperty("entry_points")
private List<EntryPoint> entryPoints;

/**
* named_keys(Array) - A list of named keys.
*/
/** named_keys(Array) - A list of named keys. */
@JsonProperty("named_keys")
private List<NamedKey> namedKeys;

/**
* protocol_version(String) - ?
*/
/** protocol_version(String) - ? */
@JsonProperty("protocol_version")
private String protocolVersion;
}
Loading

0 comments on commit 2d580f6

Please sign in to comment.