All Downloads are FREE. Search and download functionalities are using the official Maven repository.

live.radix.gateway.model.TransactionPreviewRequest Maven / Gradle / Ivy

There is a newer version: 1.9.0
Show newest version
/*
 * Radix Gateway API - Babylon
 * This API is exposed by the Babylon Radix Gateway to enable clients to efficiently query current and historic state on the RadixDLT ledger, and intelligently handle transaction submission.  It is designed for use by wallets and explorers, and for light queries from front-end dApps. For exchange/asset integrations, back-end dApp integrations, or simple use cases, you should consider using the Core API on a Node. A Gateway is only needed for reading historic snapshots of ledger states or a more robust set-up.  The Gateway API is implemented by the [Network Gateway](https://github.com/radixdlt/babylon-gateway), which is configured to read from [full node(s)](https://github.com/radixdlt/babylon-node) to extract and index data from the network.  This document is an API reference documentation, visit [User Guide](https://docs.radixdlt.com/) to learn more about how to run a Gateway of your own.  ## Migration guide  Please see [the latest release notes](https://github.com/radixdlt/babylon-gateway/releases).  ## Integration and forward compatibility guarantees  All responses may have additional fields added at any release, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects.  When the Radix protocol is updated, new functionality may be added, and so discriminated unions returned by the API may need to be updated to have new variants added, corresponding to the updated data. Clients may need to update in advance to be able to handle these new variants when a protocol update comes out.  On the very rare occasions we need to make breaking changes to the API, these will be warned in advance with deprecation notices on previous versions. These deprecation notices will include a safe migration path. Deprecation notes or breaking changes will be flagged clearly in release notes for new versions of the Gateway.  The Gateway DB schema is not subject to any compatibility guarantees, and may be changed at any release. DB changes will be flagged in the release notes so clients doing custom DB integrations can prepare. 
 *
 * The version of the OpenAPI document: v1.9.2-L
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package live.radix.gateway.model;

import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import live.radix.gateway.model.PreviewFlags;
import live.radix.gateway.model.PublicKey;
import live.radix.gateway.model.TransactionPreviewOptIns;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.StringJoiner;

/**
 * TransactionPreviewRequest
 */
@JsonPropertyOrder({
  TransactionPreviewRequest.JSON_PROPERTY_OPT_INS,
  TransactionPreviewRequest.JSON_PROPERTY_MANIFEST,
  TransactionPreviewRequest.JSON_PROPERTY_BLOBS_HEX,
  TransactionPreviewRequest.JSON_PROPERTY_START_EPOCH_INCLUSIVE,
  TransactionPreviewRequest.JSON_PROPERTY_END_EPOCH_EXCLUSIVE,
  TransactionPreviewRequest.JSON_PROPERTY_NOTARY_PUBLIC_KEY,
  TransactionPreviewRequest.JSON_PROPERTY_NOTARY_IS_SIGNATORY,
  TransactionPreviewRequest.JSON_PROPERTY_TIP_PERCENTAGE,
  TransactionPreviewRequest.JSON_PROPERTY_NONCE,
  TransactionPreviewRequest.JSON_PROPERTY_SIGNER_PUBLIC_KEYS,
  TransactionPreviewRequest.JSON_PROPERTY_MESSAGE,
  TransactionPreviewRequest.JSON_PROPERTY_FLAGS
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-12T19:38:04.213407200+02:00[Europe/Kiev]", comments = "Generator version: 7.7.0")
public class TransactionPreviewRequest {
  public static final String JSON_PROPERTY_OPT_INS = "opt_ins";
  private TransactionPreviewOptIns optIns;

  public static final String JSON_PROPERTY_MANIFEST = "manifest";
  private String manifest;

  public static final String JSON_PROPERTY_BLOBS_HEX = "blobs_hex";
  private List blobsHex = new ArrayList<>();

  public static final String JSON_PROPERTY_START_EPOCH_INCLUSIVE = "start_epoch_inclusive";
  private Long startEpochInclusive;

  public static final String JSON_PROPERTY_END_EPOCH_EXCLUSIVE = "end_epoch_exclusive";
  private Long endEpochExclusive;

  public static final String JSON_PROPERTY_NOTARY_PUBLIC_KEY = "notary_public_key";
  private PublicKey notaryPublicKey;

  public static final String JSON_PROPERTY_NOTARY_IS_SIGNATORY = "notary_is_signatory";
  private Boolean notaryIsSignatory;

  public static final String JSON_PROPERTY_TIP_PERCENTAGE = "tip_percentage";
  private Integer tipPercentage;

  public static final String JSON_PROPERTY_NONCE = "nonce";
  private Long nonce;

  public static final String JSON_PROPERTY_SIGNER_PUBLIC_KEYS = "signer_public_keys";
  private List signerPublicKeys = new ArrayList<>();

  public static final String JSON_PROPERTY_MESSAGE = "message";
  private Object message;

  public static final String JSON_PROPERTY_FLAGS = "flags";
  private PreviewFlags flags;

  public TransactionPreviewRequest() {
  }

  public TransactionPreviewRequest optIns(TransactionPreviewOptIns optIns) {
    
    this.optIns = optIns;
    return this;
  }

  /**
   * Get optIns
   * @return optIns
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_OPT_INS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public TransactionPreviewOptIns getOptIns() {
    return optIns;
  }


  @JsonProperty(JSON_PROPERTY_OPT_INS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setOptIns(TransactionPreviewOptIns optIns) {
    this.optIns = optIns;
  }

  public TransactionPreviewRequest manifest(String manifest) {
    
    this.manifest = manifest;
    return this;
  }

  /**
   * A text-representation of a transaction manifest
   * @return manifest
   */
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_MANIFEST)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getManifest() {
    return manifest;
  }


  @JsonProperty(JSON_PROPERTY_MANIFEST)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setManifest(String manifest) {
    this.manifest = manifest;
  }

  public TransactionPreviewRequest blobsHex(List blobsHex) {
    
    this.blobsHex = blobsHex;
    return this;
  }

  public TransactionPreviewRequest addBlobsHexItem(String blobsHexItem) {
    if (this.blobsHex == null) {
      this.blobsHex = new ArrayList<>();
    }
    this.blobsHex.add(blobsHexItem);
    return this;
  }

  /**
   * An array of hex-encoded blob data, if referenced by the manifest.
   * @return blobsHex
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_BLOBS_HEX)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List getBlobsHex() {
    return blobsHex;
  }


  @JsonProperty(JSON_PROPERTY_BLOBS_HEX)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setBlobsHex(List blobsHex) {
    this.blobsHex = blobsHex;
  }

  public TransactionPreviewRequest startEpochInclusive(Long startEpochInclusive) {
    
    this.startEpochInclusive = startEpochInclusive;
    return this;
  }

  /**
   * An integer between `0` and `10^10`, marking the epoch at which the transaction startsbeing valid. If omitted, the current epoch will be used. 
   * minimum: 0
   * maximum: 10000000000
   * @return startEpochInclusive
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_START_EPOCH_INCLUSIVE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Long getStartEpochInclusive() {
    return startEpochInclusive;
  }


  @JsonProperty(JSON_PROPERTY_START_EPOCH_INCLUSIVE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setStartEpochInclusive(Long startEpochInclusive) {
    this.startEpochInclusive = startEpochInclusive;
  }

  public TransactionPreviewRequest endEpochExclusive(Long endEpochExclusive) {
    
    this.endEpochExclusive = endEpochExclusive;
    return this;
  }

  /**
   * An integer between `0` and `10^10`, marking the epoch at which the transaction is no longer valid. If omitted, a maximum epoch (relative to the `start_epoch_inclusive`) will be used. 
   * minimum: 0
   * maximum: 10000000000
   * @return endEpochExclusive
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_END_EPOCH_EXCLUSIVE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Long getEndEpochExclusive() {
    return endEpochExclusive;
  }


  @JsonProperty(JSON_PROPERTY_END_EPOCH_EXCLUSIVE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setEndEpochExclusive(Long endEpochExclusive) {
    this.endEpochExclusive = endEpochExclusive;
  }

  public TransactionPreviewRequest notaryPublicKey(PublicKey notaryPublicKey) {
    
    this.notaryPublicKey = notaryPublicKey;
    return this;
  }

  /**
   * Get notaryPublicKey
   * @return notaryPublicKey
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_NOTARY_PUBLIC_KEY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public PublicKey getNotaryPublicKey() {
    return notaryPublicKey;
  }


  @JsonProperty(JSON_PROPERTY_NOTARY_PUBLIC_KEY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setNotaryPublicKey(PublicKey notaryPublicKey) {
    this.notaryPublicKey = notaryPublicKey;
  }

  public TransactionPreviewRequest notaryIsSignatory(Boolean notaryIsSignatory) {
    
    this.notaryIsSignatory = notaryIsSignatory;
    return this;
  }

  /**
   * Whether the notary should be used as a signer (optional). If not provided, this defaults to false. 
   * @return notaryIsSignatory
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_NOTARY_IS_SIGNATORY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Boolean isNotaryIsSignatory() {
    return notaryIsSignatory;
  }


  @JsonProperty(JSON_PROPERTY_NOTARY_IS_SIGNATORY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setNotaryIsSignatory(Boolean notaryIsSignatory) {
    this.notaryIsSignatory = notaryIsSignatory;
  }

  public TransactionPreviewRequest tipPercentage(Integer tipPercentage) {
    
    this.tipPercentage = tipPercentage;
    return this;
  }

  /**
   * An integer between `0` and `65535`, giving the validator tip as a percentage amount. A value of `1` corresponds to a 1% fee. If not provided, this defaults to 0. 
   * minimum: 0
   * maximum: 65535
   * @return tipPercentage
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_TIP_PERCENTAGE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Integer getTipPercentage() {
    return tipPercentage;
  }


  @JsonProperty(JSON_PROPERTY_TIP_PERCENTAGE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setTipPercentage(Integer tipPercentage) {
    this.tipPercentage = tipPercentage;
  }

  public TransactionPreviewRequest nonce(Long nonce) {
    
    this.nonce = nonce;
    return this;
  }

  /**
   * An integer between `0` and `2^32 - 1`, chosen to allow a unique intent to be created (to enable submitting an otherwise identical/duplicate intent). If not provided, this defaults to 0. 
   * minimum: 0
   * @return nonce
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_NONCE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Long getNonce() {
    return nonce;
  }


  @JsonProperty(JSON_PROPERTY_NONCE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setNonce(Long nonce) {
    this.nonce = nonce;
  }

  public TransactionPreviewRequest signerPublicKeys(List signerPublicKeys) {
    
    this.signerPublicKeys = signerPublicKeys;
    return this;
  }

  public TransactionPreviewRequest addSignerPublicKeysItem(PublicKey signerPublicKeysItem) {
    if (this.signerPublicKeys == null) {
      this.signerPublicKeys = new ArrayList<>();
    }
    this.signerPublicKeys.add(signerPublicKeysItem);
    return this;
  }

  /**
   * A list of public keys to be used as transaction signers. If not provided, this defaults to an empty array. 
   * @return signerPublicKeys
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_SIGNER_PUBLIC_KEYS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List getSignerPublicKeys() {
    return signerPublicKeys;
  }


  @JsonProperty(JSON_PROPERTY_SIGNER_PUBLIC_KEYS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setSignerPublicKeys(List signerPublicKeys) {
    this.signerPublicKeys = signerPublicKeys;
  }

  public TransactionPreviewRequest message(Object message) {
    
    this.message = message;
    return this;
  }

  /**
   * An optional transaction message. Only affects the costing. This type is defined in the Core API as `TransactionMessage`. See the Core API documentation for more details. 
   * @return message
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_MESSAGE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Object getMessage() {
    return message;
  }


  @JsonProperty(JSON_PROPERTY_MESSAGE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMessage(Object message) {
    this.message = message;
  }

  public TransactionPreviewRequest flags(PreviewFlags flags) {
    
    this.flags = flags;
    return this;
  }

  /**
   * Get flags
   * @return flags
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_FLAGS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public PreviewFlags getFlags() {
    return flags;
  }


  @JsonProperty(JSON_PROPERTY_FLAGS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setFlags(PreviewFlags flags) {
    this.flags = flags;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    TransactionPreviewRequest transactionPreviewRequest = (TransactionPreviewRequest) o;
    return Objects.equals(this.optIns, transactionPreviewRequest.optIns) &&
        Objects.equals(this.manifest, transactionPreviewRequest.manifest) &&
        Objects.equals(this.blobsHex, transactionPreviewRequest.blobsHex) &&
        Objects.equals(this.startEpochInclusive, transactionPreviewRequest.startEpochInclusive) &&
        Objects.equals(this.endEpochExclusive, transactionPreviewRequest.endEpochExclusive) &&
        Objects.equals(this.notaryPublicKey, transactionPreviewRequest.notaryPublicKey) &&
        Objects.equals(this.notaryIsSignatory, transactionPreviewRequest.notaryIsSignatory) &&
        Objects.equals(this.tipPercentage, transactionPreviewRequest.tipPercentage) &&
        Objects.equals(this.nonce, transactionPreviewRequest.nonce) &&
        Objects.equals(this.signerPublicKeys, transactionPreviewRequest.signerPublicKeys) &&
        Objects.equals(this.message, transactionPreviewRequest.message) &&
        Objects.equals(this.flags, transactionPreviewRequest.flags);
  }

  @Override
  public int hashCode() {
    return Objects.hash(optIns, manifest, blobsHex, startEpochInclusive, endEpochExclusive, notaryPublicKey, notaryIsSignatory, tipPercentage, nonce, signerPublicKeys, message, flags);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class TransactionPreviewRequest {\n");
    sb.append("    optIns: ").append(toIndentedString(optIns)).append("\n");
    sb.append("    manifest: ").append(toIndentedString(manifest)).append("\n");
    sb.append("    blobsHex: ").append(toIndentedString(blobsHex)).append("\n");
    sb.append("    startEpochInclusive: ").append(toIndentedString(startEpochInclusive)).append("\n");
    sb.append("    endEpochExclusive: ").append(toIndentedString(endEpochExclusive)).append("\n");
    sb.append("    notaryPublicKey: ").append(toIndentedString(notaryPublicKey)).append("\n");
    sb.append("    notaryIsSignatory: ").append(toIndentedString(notaryIsSignatory)).append("\n");
    sb.append("    tipPercentage: ").append(toIndentedString(tipPercentage)).append("\n");
    sb.append("    nonce: ").append(toIndentedString(nonce)).append("\n");
    sb.append("    signerPublicKeys: ").append(toIndentedString(signerPublicKeys)).append("\n");
    sb.append("    message: ").append(toIndentedString(message)).append("\n");
    sb.append("    flags: ").append(toIndentedString(flags)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

  /**
   * Convert the instance into URL query string.
   *
   * @return URL query string
   */
  public String toUrlQueryString() {
    return toUrlQueryString(null);
  }

  /**
   * Convert the instance into URL query string.
   *
   * @param prefix prefix of the query string
   * @return URL query string
   */
  public String toUrlQueryString(String prefix) {
    String suffix = "";
    String containerSuffix = "";
    String containerPrefix = "";
    if (prefix == null) {
      // style=form, explode=true, e.g. /pet?name=cat&type=manx
      prefix = "";
    } else {
      // deepObject style e.g. /pet?id[name]=cat&id[type]=manx
      prefix = prefix + "[";
      suffix = "]";
      containerSuffix = "]";
      containerPrefix = "[";
    }

    StringJoiner joiner = new StringJoiner("&");

    // add `opt_ins` to the URL query string
    if (getOptIns() != null) {
      joiner.add(getOptIns().toUrlQueryString(prefix + "opt_ins" + suffix));
    }

    // add `manifest` to the URL query string
    if (getManifest() != null) {
      try {
        joiner.add(String.format("%smanifest%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getManifest()), "UTF-8").replaceAll("\\+", "%20")));
      } catch (UnsupportedEncodingException e) {
        // Should never happen, UTF-8 is always supported
        throw new RuntimeException(e);
      }
    }

    // add `blobs_hex` to the URL query string
    if (getBlobsHex() != null) {
      for (int i = 0; i < getBlobsHex().size(); i++) {
        try {
          joiner.add(String.format("%sblobs_hex%s%s=%s", prefix, suffix,
              "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
              URLEncoder.encode(String.valueOf(getBlobsHex().get(i)), "UTF-8").replaceAll("\\+", "%20")));
        } catch (UnsupportedEncodingException e) {
          // Should never happen, UTF-8 is always supported
          throw new RuntimeException(e);
        }
      }
    }

    // add `start_epoch_inclusive` to the URL query string
    if (getStartEpochInclusive() != null) {
      try {
        joiner.add(String.format("%sstart_epoch_inclusive%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getStartEpochInclusive()), "UTF-8").replaceAll("\\+", "%20")));
      } catch (UnsupportedEncodingException e) {
        // Should never happen, UTF-8 is always supported
        throw new RuntimeException(e);
      }
    }

    // add `end_epoch_exclusive` to the URL query string
    if (getEndEpochExclusive() != null) {
      try {
        joiner.add(String.format("%send_epoch_exclusive%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getEndEpochExclusive()), "UTF-8").replaceAll("\\+", "%20")));
      } catch (UnsupportedEncodingException e) {
        // Should never happen, UTF-8 is always supported
        throw new RuntimeException(e);
      }
    }

    // add `notary_public_key` to the URL query string
    if (getNotaryPublicKey() != null) {
      joiner.add(getNotaryPublicKey().toUrlQueryString(prefix + "notary_public_key" + suffix));
    }

    // add `notary_is_signatory` to the URL query string
    if (isNotaryIsSignatory() != null) {
      try {
        joiner.add(String.format("%snotary_is_signatory%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(isNotaryIsSignatory()), "UTF-8").replaceAll("\\+", "%20")));
      } catch (UnsupportedEncodingException e) {
        // Should never happen, UTF-8 is always supported
        throw new RuntimeException(e);
      }
    }

    // add `tip_percentage` to the URL query string
    if (getTipPercentage() != null) {
      try {
        joiner.add(String.format("%stip_percentage%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getTipPercentage()), "UTF-8").replaceAll("\\+", "%20")));
      } catch (UnsupportedEncodingException e) {
        // Should never happen, UTF-8 is always supported
        throw new RuntimeException(e);
      }
    }

    // add `nonce` to the URL query string
    if (getNonce() != null) {
      try {
        joiner.add(String.format("%snonce%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getNonce()), "UTF-8").replaceAll("\\+", "%20")));
      } catch (UnsupportedEncodingException e) {
        // Should never happen, UTF-8 is always supported
        throw new RuntimeException(e);
      }
    }

    // add `signer_public_keys` to the URL query string
    if (getSignerPublicKeys() != null) {
      for (int i = 0; i < getSignerPublicKeys().size(); i++) {
        if (getSignerPublicKeys().get(i) != null) {
          joiner.add(getSignerPublicKeys().get(i).toUrlQueryString(String.format("%ssigner_public_keys%s%s", prefix, suffix,
              "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
        }
      }
    }

    // add `message` to the URL query string
    if (getMessage() != null) {
      try {
        joiner.add(String.format("%smessage%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getMessage()), "UTF-8").replaceAll("\\+", "%20")));
      } catch (UnsupportedEncodingException e) {
        // Should never happen, UTF-8 is always supported
        throw new RuntimeException(e);
      }
    }

    // add `flags` to the URL query string
    if (getFlags() != null) {
      joiner.add(getFlags().toUrlQueryString(prefix + "flags" + suffix));
    }

    return joiner.toString();
  }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy