com.casper.sdk.model.transaction.target.Transaction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of casper-java-sdk Show documentation
Show all versions of casper-java-sdk Show documentation
SDK to streamline the 3rd party Java client integration processes. Such 3rd parties include exchanges & app developers.
The newest version!
package com.casper.sdk.model.transaction.target;
import com.casper.sdk.model.deploy.Deploy;
import com.casper.sdk.model.transaction.AbstractTransaction;
import com.casper.sdk.model.transaction.TransactionV1;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* Transaction response obtained using the info_get_transaction RPC call.
*
* @author [email protected]
*/
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Transaction {
@JsonProperty("Deploy")
private Deploy deploy;
@JsonProperty("Version1")
private TransactionV1 version1;
public Transaction(final AbstractTransaction transaction) {
this.deploy = transaction instanceof Deploy ? (Deploy) transaction : null;
this.version1 = transaction instanceof TransactionV1 ? (TransactionV1) transaction : null;
}
@JsonIgnore
public T get() {
return (T) (version1 != null ? version1 : deploy);
}
}