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

io.everitoken.sdk.java.dto.Transaction Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
package io.everitoken.sdk.java.dto;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;

import io.everitoken.sdk.java.abi.Action;

public class Transaction {
    private final List actions;
    private final String expiration;
    private final long refBlockNumber;
    private final long refBlockPrefix;
    private final long maxCharge;
    private final String payer;
    private final List transactionExtensions = new ArrayList<>();

    @JSONField(serialize = false, deserialize = false)
    private TransactionDigest transactionDigest;

    public Transaction(final List actions, final String expiration, final long refBlockNumber,
            final long refBlockPrefix, final long maxCharge, final String payer) {

        this.actions = actions.stream().map(JSONObject::parseObject).map(Action::ofRaw).collect(Collectors.toList());
        this.expiration = expiration;
        this.refBlockNumber = refBlockNumber;
        this.refBlockPrefix = refBlockPrefix;
        this.maxCharge = maxCharge;
        this.payer = payer;
    }

    @JSONField(name = "actions")
    public List getActions() {
        return actions;
    }

    public String getExpiration() {
        return expiration;
    }

    @JSONField(name = "ref_block_num")
    public long getRefBlockNumber() {
        return refBlockNumber;
    }

    @JSONField(name = "ref_block_prefix")
    public long getRefBlockPrefix() {
        return refBlockPrefix;
    }

    @JSONField(name = "max_charge")
    public long getMaxCharge() {
        return maxCharge;
    }

    public String getPayer() {
        return payer;
    }

    public TransactionDigest getTransactionDigest() {
        return transactionDigest;
    }

    public void setTransactionDigest(TransactionDigest transactionDigest) {
        this.transactionDigest = transactionDigest;
    }

    @JSONField(name = "transaction_extensions")
    public List getTransactionExtensions() {
        return transactionExtensions;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy