com.casper.sdk.model.transaction.pricing.ClassicPricingMode 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.pricing;
import com.casper.sdk.exception.NoSuchTypeException;
import com.casper.sdk.model.clvalue.serde.Target;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import dev.oak3.sbs4j.SerializerBuffer;
import dev.oak3.sbs4j.exception.ValueSerializationException;
import lombok.*;
import java.math.BigInteger;
/**
* The original payment model, where the creator of the transaction specifies how much they will pay, at what gas price.
*
* @author [email protected]
*/
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Builder
public class ClassicPricingMode implements PricingMode {
/** User-specified payment amount. */
@JsonProperty("payment_amount")
@JsonSerialize(using = ToStringSerializer.class)
private BigInteger paymentAmount;
/**
* User-specified gas_price tolerance (minimum 1). This is interpreted to mean "do not include this transaction in
* a block if the current gas price is greater than this number"
*/
@JsonProperty("gas_price_tolerance")
private int gasPriceTolerance;
/** Standard payment. */
@JsonProperty("standard_payment")
private boolean standardPayment;
@Override
public void serialize(final SerializerBuffer ser, final Target target) throws ValueSerializationException, NoSuchTypeException {
ser.writeU8(getByteTag());
ser.writeU64(paymentAmount);
ser.writeU8((byte) gasPriceTolerance);
ser.writeBool(standardPayment);
}
@Override
@JsonIgnore
public byte getByteTag() {
return CLASSIC_TAG;
}
}