Transfer.java

  1. package com.syntifi.casper.sdk.model.transfer;

  2. import com.fasterxml.jackson.annotation.JsonIgnore;
  3. import com.fasterxml.jackson.annotation.JsonProperty;
  4. import com.syntifi.casper.sdk.annotation.ExcludeFromJacocoGeneratedReport;
  5. import lombok.AllArgsConstructor;
  6. import lombok.Builder;
  7. import lombok.Getter;
  8. import lombok.NoArgsConstructor;
  9. import lombok.Setter;

  10. import java.math.BigInteger;

  11. /**
  12.  * Represents a transfer from one purse to another
  13.  *
  14.  * @author Alexandre Carvalho
  15.  * @author Andre Bertolace
  16.  * @since 0.0.1
  17.  */
  18. @Getter
  19. @Setter
  20. @Builder
  21. @AllArgsConstructor
  22. @NoArgsConstructor
  23. public class Transfer {
  24.     @JsonProperty("id")
  25.     private BigInteger id;

  26.     /**
  27.      * Hex-encoded account hash.
  28.      */
  29.     @JsonProperty("to")
  30.     private String to;

  31.     /**
  32.      * Hex-encoded account hash.
  33.      */
  34.     @JsonProperty("from")
  35.     private String from;

  36.     /**
  37.      * Amount transfered
  38.      */
  39.     @JsonIgnore
  40.     private BigInteger amount;

  41.     /**
  42.      * Hex-encoded hash
  43.      */
  44.     @JsonProperty("deploy_hash")
  45.     private String deployHash;

  46.     /**
  47.      * Hex-encoded, formatted URef
  48.      */
  49.     @JsonProperty("source")
  50.     private String source;

  51.     /**
  52.      * Hex-encoded, formatted URef
  53.      */
  54.     @JsonProperty("target")
  55.     private String target;

  56.     /**
  57.      * Decimal representation of a 512-bit integer.
  58.      */
  59.     @JsonIgnore
  60.     private BigInteger gas;

  61.     @JsonProperty("amount")
  62.     @ExcludeFromJacocoGeneratedReport
  63.     protected String getJsonAmount() {
  64.         return this.amount.toString(10);
  65.     }

  66.     @JsonProperty("amount")
  67.     @ExcludeFromJacocoGeneratedReport
  68.     protected void setJsonAmount(String value) {
  69.         this.amount = new BigInteger(value, 10);
  70.     }

  71.     @JsonProperty("gas")
  72.     @ExcludeFromJacocoGeneratedReport
  73.     protected String getJsonGas() {
  74.         return this.gas.toString(10);
  75.     }

  76.     @JsonProperty("gas")
  77.     @ExcludeFromJacocoGeneratedReport
  78.     protected void setJsonGas(String value) {
  79.         this.gas = new BigInteger(value, 10);
  80.     }
  81. }