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

com.casper.sdk.model.transaction.pricing.FixedPricingMode Maven / Gradle / Ivy

Go to download

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 dev.oak3.sbs4j.SerializerBuffer;
import dev.oak3.sbs4j.exception.ValueSerializationException;
import lombok.*;

/**
 * The cost of the transaction is determined by the cost table, per the transaction category.
 *
 * @author [email protected]
 */
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Builder
public class FixedPricingMode implements PricingMode {
    /**
     * 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;

    @Override
    public void serialize(final SerializerBuffer ser, final Target target) throws ValueSerializationException, NoSuchTypeException {
        ser.writeU8(getByteTag());
        ser.writeU8((byte) gasPriceTolerance);
    }

    @JsonIgnore
    @Override
    public byte getByteTag() {
        return FIXED_TAG;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy