From 431e15c7aed236e7c19ebeb0d45186f09356287d Mon Sep 17 00:00:00 2001 From: catbref Date: Sat, 1 Jun 2019 15:13:12 +0100 Subject: [PATCH] interim commit after refactoring TransactionData, and subclasses --- .../data/transaction/ATTransactionData.java | 15 +---- .../AccountFlagsTransactionData.java | 21 ++----- .../AddGroupAdminTransactionData.java | 20 +------ .../transaction/ArbitraryTransactionData.java | 38 +++--------- .../data/transaction/BaseTransactionData.java | 28 +++++++++ .../transaction/BuyNameTransactionData.java | 20 +++---- .../CancelAssetOrderTransactionData.java | 18 +----- .../CancelGroupBanTransactionData.java | 18 ++---- .../CancelGroupInviteTransactionData.java | 19 ++---- .../CancelSellNameTransactionData.java | 21 +------ .../CreateAssetOrderTransactionData.java | 26 ++------ .../CreateGroupTransactionData.java | 25 +++----- .../CreatePollTransactionData.java | 22 +------ .../transaction/DeployAtTransactionData.java | 20 +------ .../EnableForgingTransactionData.java | 19 +----- .../transaction/GenesisTransactionData.java | 24 ++------ .../GroupApprovalTransactionData.java | 21 ++----- .../transaction/GroupBanTransactionData.java | 24 +++----- .../GroupInviteTransactionData.java | 20 ++----- .../transaction/GroupKickTransactionData.java | 22 ++----- .../IssueAssetTransactionData.java | 23 ++------ .../transaction/JoinGroupTransactionData.java | 19 ++---- .../LeaveGroupTransactionData.java | 20 ++----- .../transaction/MessageTransactionData.java | 22 ++----- .../MultiPaymentTransactionData.java | 20 +------ .../transaction/PaymentTransactionData.java | 18 +----- .../ProxyForgingTransactionData.java | 20 +++---- .../RegisterNameTransactionData.java | 20 +------ .../RemoveGroupAdminTransactionData.java | 19 ++---- .../transaction/SellNameTransactionData.java | 19 +----- .../transaction/SetGroupTransactionData.java | 17 ++---- .../data/transaction/TransactionData.java | 59 ++++++++++++------- .../TransferAssetTransactionData.java | 27 ++------- .../UpdateAssetTransactionData.java | 22 ++----- .../UpdateGroupTransactionData.java | 31 +++------- .../UpdateNameTransactionData.java | 21 ++----- .../VoteOnPollTransactionData.java | 20 ++----- 37 files changed, 239 insertions(+), 599 deletions(-) create mode 100644 src/main/java/org/qora/data/transaction/BaseTransactionData.java diff --git a/src/main/java/org/qora/data/transaction/ATTransactionData.java b/src/main/java/org/qora/data/transaction/ATTransactionData.java index 60fa3abf..81957019 100644 --- a/src/main/java/org/qora/data/transaction/ATTransactionData.java +++ b/src/main/java/org/qora/data/transaction/ATTransactionData.java @@ -7,7 +7,6 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import org.qora.account.GenesisAccount; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -36,10 +35,10 @@ public class ATTransactionData extends TransactionData { } /** From repository */ - public ATTransactionData(long timestamp, int txGroupId, byte[] reference, String atAddress, String recipient, BigDecimal amount, Long assetId, - byte[] message, BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.AT, timestamp, txGroupId, reference, GenesisAccount.PUBLIC_KEY, fee, approvalStatus, height, signature); + public ATTransactionData(BaseTransactionData baseTransactionData, String atAddress, String recipient, BigDecimal amount, Long assetId, byte[] message) { + super(TransactionType.AT, baseTransactionData); + this.creatorPublicKey = GenesisAccount.PUBLIC_KEY; this.atAddress = atAddress; this.recipient = recipient; this.amount = amount; @@ -47,14 +46,6 @@ public class ATTransactionData extends TransactionData { this.message = message; } - // Never from network/API! - - /** New, unsigned */ - public ATTransactionData(long timestamp, int txGroupId, byte[] reference, String atAddress, String recipient, BigDecimal amount, Long assetId, - byte[] message, BigDecimal fee) { - this(timestamp, txGroupId, reference, atAddress, recipient, amount, assetId, message, fee, null, null, null); - } - // Getters/Setters public String getATAddress() { diff --git a/src/main/java/org/qora/data/transaction/AccountFlagsTransactionData.java b/src/main/java/org/qora/data/transaction/AccountFlagsTransactionData.java index 338ea4a5..51ecff1a 100644 --- a/src/main/java/org/qora/data/transaction/AccountFlagsTransactionData.java +++ b/src/main/java/org/qora/data/transaction/AccountFlagsTransactionData.java @@ -1,7 +1,5 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -10,7 +8,6 @@ import javax.xml.bind.annotation.XmlElement; import org.eclipse.persistence.oxm.annotations.XmlDiscriminatorValue; import org.qora.account.GenesisAccount; import org.qora.block.GenesisBlock; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -46,9 +43,9 @@ public class AccountFlagsTransactionData extends TransactionData { } /** From repository */ - public AccountFlagsTransactionData(long timestamp, int groupId, byte[] reference, byte[] creatorPublicKey, String target, int andMask, int orMask, - int xorMask, Integer previousFlags, BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.ACCOUNT_FLAGS, timestamp, groupId, reference, creatorPublicKey, fee, approvalStatus, height, signature); + public AccountFlagsTransactionData(BaseTransactionData baseTransactionData, + String target, int andMask, int orMask, int xorMask, Integer previousFlags) { + super(TransactionType.ACCOUNT_FLAGS, baseTransactionData); this.target = target; this.andMask = andMask; @@ -58,15 +55,9 @@ public class AccountFlagsTransactionData extends TransactionData { } /** From network/API */ - public AccountFlagsTransactionData(long timestamp, int groupId, byte[] reference, byte[] creatorPublicKey, String target, int andMask, int orMask, - int xorMask, BigDecimal fee, byte[] signature) { - this(timestamp, groupId, reference, creatorPublicKey, target, andMask, orMask, xorMask, null, fee, null, null, signature); - } - - /** New, unsigned */ - public AccountFlagsTransactionData(long timestamp, int groupId, byte[] reference, byte[] creatorPublicKey, String target, int andMask, int orMask, - int xorMask, BigDecimal fee) { - this(timestamp, groupId, reference, creatorPublicKey, target, andMask, orMask, xorMask, fee, null); + public AccountFlagsTransactionData(BaseTransactionData baseTransactionData, + String target, int andMask, int orMask, int xorMask) { + this(baseTransactionData, target, andMask, orMask, xorMask, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/AddGroupAdminTransactionData.java b/src/main/java/org/qora/data/transaction/AddGroupAdminTransactionData.java index c8ecb15e..0dc152e0 100644 --- a/src/main/java/org/qora/data/transaction/AddGroupAdminTransactionData.java +++ b/src/main/java/org/qora/data/transaction/AddGroupAdminTransactionData.java @@ -1,13 +1,10 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import org.eclipse.persistence.oxm.annotations.XmlDiscriminatorValue; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -40,25 +37,14 @@ public class AddGroupAdminTransactionData extends TransactionData { this.creatorPublicKey = this.ownerPublicKey; } - /** From repository */ - public AddGroupAdminTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, int groupId, String member, BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.ADD_GROUP_ADMIN, timestamp, txGroupId, reference, ownerPublicKey, fee, approvalStatus, height, signature); + public AddGroupAdminTransactionData(BaseTransactionData baseTransactionData, int groupId, String member) { + super(TransactionType.ADD_GROUP_ADMIN, baseTransactionData); - this.ownerPublicKey = ownerPublicKey; + this.ownerPublicKey = baseTransactionData.creatorPublicKey; this.groupId = groupId; this.member = member; } - /** From network/API */ - public AddGroupAdminTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, int groupId, String member, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, ownerPublicKey, groupId, member, fee, null, null, signature); - } - - /** New, unsigned */ - public AddGroupAdminTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, int groupId, String member, BigDecimal fee) { - this(timestamp, txGroupId, reference, ownerPublicKey, groupId, member, fee, null); - } - // Getters / setters public byte[] getOwnerPublicKey() { diff --git a/src/main/java/org/qora/data/transaction/ArbitraryTransactionData.java b/src/main/java/org/qora/data/transaction/ArbitraryTransactionData.java index ee2bc2b1..ab72ad03 100644 --- a/src/main/java/org/qora/data/transaction/ArbitraryTransactionData.java +++ b/src/main/java/org/qora/data/transaction/ArbitraryTransactionData.java @@ -1,6 +1,5 @@ package org.qora.data.transaction; -import java.math.BigDecimal; import java.util.List; import javax.xml.bind.Unmarshaller; @@ -9,7 +8,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import org.eclipse.persistence.oxm.annotations.XmlDiscriminatorValue; import org.qora.data.PaymentData; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -53,12 +51,12 @@ public class ArbitraryTransactionData extends TransactionData { this.creatorPublicKey = this.senderPublicKey; } - /** From repository */ - public ArbitraryTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, int version, int service, - byte[] data, DataType dataType, List payments, BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.ARBITRARY, timestamp, txGroupId, reference, senderPublicKey, fee, approvalStatus, height, signature); + /** V3 */ + public ArbitraryTransactionData(BaseTransactionData baseTransactionData, + int version, int service, byte[] data, DataType dataType, List payments) { + super(TransactionType.ARBITRARY, baseTransactionData); - this.senderPublicKey = senderPublicKey; + this.senderPublicKey = baseTransactionData.creatorPublicKey; this.version = version; this.service = service; this.data = data; @@ -66,28 +64,10 @@ public class ArbitraryTransactionData extends TransactionData { this.payments = payments; } - /** From network/API (V3) */ - public ArbitraryTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, int version, int service, - byte[] data, DataType dataType, List payments, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, senderPublicKey, version, service, data, dataType, payments, fee, null, null, signature); - } - - /** From network/API (V1) */ - public ArbitraryTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, int version, int service, byte[] data, - DataType dataType, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, senderPublicKey, version, service, data, dataType, null, fee, null, null, signature); - } - - /** New, unsigned (V3) */ - public ArbitraryTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, int version, int service, byte[] data, - DataType dataType, List payments, BigDecimal fee) { - this(timestamp, txGroupId, reference, senderPublicKey, version, service, data, dataType, payments, fee, null); - } - - /** New, unsigned (V1) */ - public ArbitraryTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, int version, int service, byte[] data, - DataType dataType, BigDecimal fee) { - this(timestamp, txGroupId, reference, senderPublicKey, version, service, data, dataType, null, fee, null); + /** V1 */ + public ArbitraryTransactionData(BaseTransactionData baseTransactionData, + int version, int service, byte[] data, DataType dataType) { + this(baseTransactionData, version, service, data, dataType, null); } // Getters/Setters diff --git a/src/main/java/org/qora/data/transaction/BaseTransactionData.java b/src/main/java/org/qora/data/transaction/BaseTransactionData.java new file mode 100644 index 00000000..86da7b44 --- /dev/null +++ b/src/main/java/org/qora/data/transaction/BaseTransactionData.java @@ -0,0 +1,28 @@ +package org.qora.data.transaction; + +import java.math.BigDecimal; + +import org.qora.transaction.Transaction.ApprovalStatus; + +public class BaseTransactionData extends TransactionData { + + /** Constructor for use by repository. */ + public BaseTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, BigDecimal fee, + ApprovalStatus approvalStatus, Integer blockHeight, Integer approvalHeight, byte[] signature) { + this.timestamp = timestamp; + this.txGroupId = txGroupId; + this.reference = reference; + this.creatorPublicKey = creatorPublicKey; + this.fee = fee; + this.approvalStatus = approvalStatus; + this.blockHeight = blockHeight; + this.approvalHeight = approvalHeight; + this.signature = signature; + } + + /** Constructor for use by transaction transformer. */ + public BaseTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, BigDecimal fee, byte[] signature) { + this(timestamp, txGroupId, reference, creatorPublicKey, fee, null, null, null, signature); + } + +} diff --git a/src/main/java/org/qora/data/transaction/BuyNameTransactionData.java b/src/main/java/org/qora/data/transaction/BuyNameTransactionData.java index 2ee9ec43..c5b1ce53 100644 --- a/src/main/java/org/qora/data/transaction/BuyNameTransactionData.java +++ b/src/main/java/org/qora/data/transaction/BuyNameTransactionData.java @@ -8,7 +8,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -31,6 +30,7 @@ public class BuyNameTransactionData extends TransactionData { private BigDecimal amount; @Schema(description = "seller's address", example = "QgV4s3xnzLhVBEJxcYui4u4q11yhUHsd9v") private String seller; + // For internal use when orphaning @XmlTransient @Schema(hidden = true) @@ -48,11 +48,11 @@ public class BuyNameTransactionData extends TransactionData { } /** From repository */ - public BuyNameTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] buyerPublicKey, String name, BigDecimal amount, String seller, - byte[] nameReference, BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.BUY_NAME, timestamp, txGroupId, reference, buyerPublicKey, fee, approvalStatus, height, signature); + public BuyNameTransactionData(BaseTransactionData baseTransactionData, + String name, BigDecimal amount, String seller, byte[] nameReference) { + super(TransactionType.BUY_NAME, baseTransactionData); - this.buyerPublicKey = buyerPublicKey; + this.buyerPublicKey = baseTransactionData.creatorPublicKey; this.name = name; this.amount = amount; this.seller = seller; @@ -60,14 +60,8 @@ public class BuyNameTransactionData extends TransactionData { } /** From network/API */ - public BuyNameTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] buyerPublicKey, String name, BigDecimal amount, String seller, - BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, buyerPublicKey, name, amount, seller, null, fee, null, null, signature); - } - - /** New, unsigned */ - public BuyNameTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] buyerPublicKey, String name, BigDecimal amount, String seller, BigDecimal fee) { - this(timestamp, txGroupId, reference, buyerPublicKey, name, amount, seller, fee, null); + public BuyNameTransactionData(BaseTransactionData baseTransactionData, String name, BigDecimal amount, String seller) { + this(baseTransactionData, name, amount, seller, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/CancelAssetOrderTransactionData.java b/src/main/java/org/qora/data/transaction/CancelAssetOrderTransactionData.java index e32922c2..54ffb738 100644 --- a/src/main/java/org/qora/data/transaction/CancelAssetOrderTransactionData.java +++ b/src/main/java/org/qora/data/transaction/CancelAssetOrderTransactionData.java @@ -1,13 +1,10 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import org.qora.transaction.Transaction; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -28,23 +25,12 @@ public class CancelAssetOrderTransactionData extends TransactionData { super(TransactionType.CANCEL_ASSET_ORDER); } - /** From network/API */ - public CancelAssetOrderTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, byte[] orderId, BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(Transaction.TransactionType.CANCEL_ASSET_ORDER, timestamp, txGroupId, reference, creatorPublicKey, fee, approvalStatus, height, signature); + public CancelAssetOrderTransactionData(BaseTransactionData baseTransactionData, byte[] orderId) { + super(Transaction.TransactionType.CANCEL_ASSET_ORDER, baseTransactionData); this.orderId = orderId; } - /** From network/API */ - public CancelAssetOrderTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, byte[] orderId, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, creatorPublicKey, orderId, fee, null, null, signature); - } - - /** New, unsigned */ - public CancelAssetOrderTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, byte[] orderId, BigDecimal fee) { - this(timestamp, txGroupId, reference, creatorPublicKey, orderId, fee, null); - } - // Getters/Setters public byte[] getOrderId() { diff --git a/src/main/java/org/qora/data/transaction/CancelGroupBanTransactionData.java b/src/main/java/org/qora/data/transaction/CancelGroupBanTransactionData.java index 29854c1a..44800bbe 100644 --- a/src/main/java/org/qora/data/transaction/CancelGroupBanTransactionData.java +++ b/src/main/java/org/qora/data/transaction/CancelGroupBanTransactionData.java @@ -1,13 +1,11 @@ package org.qora.data.transaction; -import java.math.BigDecimal; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlTransient; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -42,24 +40,18 @@ public class CancelGroupBanTransactionData extends TransactionData { } /** From repository */ - public CancelGroupBanTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] adminPublicKey, int groupId, String member, byte[] banReference, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.CANCEL_GROUP_BAN, timestamp, txGroupId, reference, adminPublicKey, fee, approvalStatus, height, signature); + public CancelGroupBanTransactionData(BaseTransactionData baseTransactionData, int groupId, String member, byte[] banReference) { + super(TransactionType.CANCEL_GROUP_BAN, baseTransactionData); - this.adminPublicKey = adminPublicKey; + this.adminPublicKey = baseTransactionData.creatorPublicKey; this.groupId = groupId; this.member = member; this.banReference = banReference; } /** From network/API */ - public CancelGroupBanTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] adminPublicKey, int groupId, String member, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, adminPublicKey, groupId, member, null, fee, null, null, signature); - } - - /** New, unsigned */ - public CancelGroupBanTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] adminPublicKey, int groupId, String member, BigDecimal fee) { - this(timestamp, txGroupId, reference, adminPublicKey, groupId, member, fee, null); + public CancelGroupBanTransactionData(BaseTransactionData baseTransactionData, int groupId, String member) { + this(baseTransactionData, groupId, member, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/CancelGroupInviteTransactionData.java b/src/main/java/org/qora/data/transaction/CancelGroupInviteTransactionData.java index 4dff9ddd..a2d2df45 100644 --- a/src/main/java/org/qora/data/transaction/CancelGroupInviteTransactionData.java +++ b/src/main/java/org/qora/data/transaction/CancelGroupInviteTransactionData.java @@ -1,13 +1,10 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlTransient; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -42,24 +39,18 @@ public class CancelGroupInviteTransactionData extends TransactionData { } /** From repository */ - public CancelGroupInviteTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] adminPublicKey, int groupId, String invitee, byte[] inviteReference, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.CANCEL_GROUP_INVITE, timestamp, txGroupId, reference, adminPublicKey, fee, approvalStatus, height, signature); + public CancelGroupInviteTransactionData(BaseTransactionData baseTransactionData, int groupId, String invitee, byte[] inviteReference) { + super(TransactionType.CANCEL_GROUP_INVITE, baseTransactionData); - this.adminPublicKey = adminPublicKey; + this.adminPublicKey = baseTransactionData.creatorPublicKey; this.groupId = groupId; this.invitee = invitee; this.inviteReference = inviteReference; } /** From network/API */ - public CancelGroupInviteTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] adminPublicKey, int groupId, String invitee, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, adminPublicKey, groupId, invitee, null, fee, null, null, signature); - } - - /** New, unsigned */ - public CancelGroupInviteTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] adminPublicKey, int groupId, String invitee, BigDecimal fee) { - this(timestamp, txGroupId, reference, adminPublicKey, groupId, invitee, fee, null); + public CancelGroupInviteTransactionData(BaseTransactionData baseTransactionData, int groupId, String invitee) { + this(baseTransactionData, groupId, invitee, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/CancelSellNameTransactionData.java b/src/main/java/org/qora/data/transaction/CancelSellNameTransactionData.java index 4ed5c5ea..2ce01daa 100644 --- a/src/main/java/org/qora/data/transaction/CancelSellNameTransactionData.java +++ b/src/main/java/org/qora/data/transaction/CancelSellNameTransactionData.java @@ -1,12 +1,9 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -33,25 +30,13 @@ public class CancelSellNameTransactionData extends TransactionData { this.creatorPublicKey = this.ownerPublicKey; } - /** From repository */ - public CancelSellNameTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, String name, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.CANCEL_SELL_NAME, timestamp, txGroupId, reference, ownerPublicKey, fee, approvalStatus, height, signature); + public CancelSellNameTransactionData(BaseTransactionData baseTransactionData, String name) { + super(TransactionType.CANCEL_SELL_NAME, baseTransactionData); - this.ownerPublicKey = ownerPublicKey; + this.ownerPublicKey = baseTransactionData.creatorPublicKey; this.name = name; } - /** From network/API */ - public CancelSellNameTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, String name, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, ownerPublicKey, name, fee, null, null, signature); - } - - /** New, unsigned */ - public CancelSellNameTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, String name, BigDecimal fee) { - this(timestamp, txGroupId, reference, ownerPublicKey, name, fee, null); - } - // Getters / setters public byte[] getOwnerPublicKey() { diff --git a/src/main/java/org/qora/data/transaction/CreateAssetOrderTransactionData.java b/src/main/java/org/qora/data/transaction/CreateAssetOrderTransactionData.java index 6277ef40..29696976 100644 --- a/src/main/java/org/qora/data/transaction/CreateAssetOrderTransactionData.java +++ b/src/main/java/org/qora/data/transaction/CreateAssetOrderTransactionData.java @@ -8,7 +8,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import org.qora.block.BlockChain; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -80,9 +79,9 @@ public class CreateAssetOrderTransactionData extends TransactionData { } /** Constructs using data from repository, including optional asset names. */ - public CreateAssetOrderTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, long haveAssetId, long wantAssetId, - BigDecimal amount, BigDecimal price, BigDecimal fee, String haveAssetName, String wantAssetName, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.CREATE_ASSET_ORDER, timestamp, txGroupId, reference, creatorPublicKey, fee, approvalStatus, height, signature); + public CreateAssetOrderTransactionData(BaseTransactionData baseTransactionData, + long haveAssetId, long wantAssetId, BigDecimal amount, BigDecimal price, String haveAssetName, String wantAssetName) { + super(TransactionType.CREATE_ASSET_ORDER, baseTransactionData); this.haveAssetId = haveAssetId; this.wantAssetId = wantAssetId; @@ -93,22 +92,9 @@ public class CreateAssetOrderTransactionData extends TransactionData { this.wantAssetName = wantAssetName; } - /** Constructs using data from repository, excluding optional asset names. */ - public CreateAssetOrderTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, long haveAssetId, long wantAssetId, - BigDecimal amount, BigDecimal price, BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - this(timestamp, txGroupId, reference, creatorPublicKey, haveAssetId, wantAssetId, amount, price, fee, null, null, approvalStatus, height, signature); - } - - /** From network/API */ - public CreateAssetOrderTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, long haveAssetId, long wantAssetId, - BigDecimal amount, BigDecimal price, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, creatorPublicKey, haveAssetId, wantAssetId, amount, price, fee, null, null, signature); - } - - /** New, unsigned */ - public CreateAssetOrderTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, long haveAssetId, long wantAssetId, - BigDecimal amount, BigDecimal price, BigDecimal fee) { - this(timestamp, txGroupId, reference, creatorPublicKey, haveAssetId, wantAssetId, amount, price, fee, null); + /** Constructor excluding optional asset names. */ + public CreateAssetOrderTransactionData(BaseTransactionData baseTransactionData, long haveAssetId, long wantAssetId, BigDecimal amount, BigDecimal price) { + this(baseTransactionData, haveAssetId, wantAssetId, amount, price, null, null); } // Getters/Setters diff --git a/src/main/java/org/qora/data/transaction/CreateGroupTransactionData.java b/src/main/java/org/qora/data/transaction/CreateGroupTransactionData.java index b290e7ae..7e7555d2 100644 --- a/src/main/java/org/qora/data/transaction/CreateGroupTransactionData.java +++ b/src/main/java/org/qora/data/transaction/CreateGroupTransactionData.java @@ -1,14 +1,11 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import org.eclipse.persistence.oxm.annotations.XmlDiscriminatorValue; import org.qora.group.Group.ApprovalThreshold; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -69,12 +66,11 @@ public class CreateGroupTransactionData extends TransactionData { } /** From repository */ - public CreateGroupTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, String owner, String groupName, String description, - boolean isOpen, ApprovalThreshold approvalThreshold, int minimumBlockDelay, int maximumBlockDelay, Integer groupId, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.CREATE_GROUP, timestamp, txGroupId, reference, creatorPublicKey, fee, approvalStatus, height, signature); + public CreateGroupTransactionData(BaseTransactionData baseTransactionData, + String owner, String groupName, String description, boolean isOpen, + ApprovalThreshold approvalThreshold, int minimumBlockDelay, int maximumBlockDelay, Integer groupId) { + super(TransactionType.CREATE_GROUP, baseTransactionData); - this.creatorPublicKey = creatorPublicKey; this.owner = owner; this.groupName = groupName; this.description = description; @@ -86,15 +82,10 @@ public class CreateGroupTransactionData extends TransactionData { } /** From network/API */ - public CreateGroupTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, String owner, String groupName, String description, - boolean isOpen, ApprovalThreshold approvalThreshold, int minimumBlockDelay, int maximumBlockDelay, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, creatorPublicKey, owner, groupName, description, isOpen, approvalThreshold, minimumBlockDelay, maximumBlockDelay, null, fee, null, null, signature); - } - - /** New, unsigned */ - public CreateGroupTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, String owner, String groupName, String description, - boolean isOpen, ApprovalThreshold approvalThreshold, int minimumBlockDelay, int maximumBlockDelay, BigDecimal fee) { - this(timestamp, txGroupId, reference, creatorPublicKey, owner, groupName, description, isOpen, approvalThreshold, minimumBlockDelay, maximumBlockDelay, fee, null); + public CreateGroupTransactionData(BaseTransactionData baseTransactionData, + String owner, String groupName, String description, boolean isOpen, + ApprovalThreshold approvalThreshold, int minimumBlockDelay, int maximumBlockDelay) { + this(baseTransactionData, owner, groupName, description, isOpen, approvalThreshold, minimumBlockDelay, maximumBlockDelay, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/CreatePollTransactionData.java b/src/main/java/org/qora/data/transaction/CreatePollTransactionData.java index 7d8ccac8..21831304 100644 --- a/src/main/java/org/qora/data/transaction/CreatePollTransactionData.java +++ b/src/main/java/org/qora/data/transaction/CreatePollTransactionData.java @@ -1,6 +1,5 @@ package org.qora.data.transaction; -import java.math.BigDecimal; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; @@ -8,7 +7,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import org.qora.data.voting.PollOptionData; import org.qora.transaction.Transaction; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -31,11 +29,9 @@ public class CreatePollTransactionData extends TransactionData { super(TransactionType.CREATE_POLL); } - /** From repository */ - public CreatePollTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, String owner, - String pollName, String description, List pollOptions, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(Transaction.TransactionType.CREATE_POLL, timestamp, txGroupId, reference, creatorPublicKey, fee, approvalStatus, height, signature); + public CreatePollTransactionData(BaseTransactionData baseTransactionData, + String owner, String pollName, String description, List pollOptions) { + super(Transaction.TransactionType.CREATE_POLL, baseTransactionData); this.owner = owner; this.pollName = pollName; @@ -43,18 +39,6 @@ public class CreatePollTransactionData extends TransactionData { this.pollOptions = pollOptions; } - /** From network/API */ - public CreatePollTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, String owner, - String pollName, String description, List pollOptions, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, creatorPublicKey, owner, pollName, description, pollOptions, fee, null, null, signature); - } - - /** New, unsigned */ - public CreatePollTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, String owner, - String pollName, String description, List pollOptions, BigDecimal fee) { - this(timestamp, txGroupId, reference, creatorPublicKey, owner, pollName, description, pollOptions, fee, null); - } - // Getters/setters public String getOwner() { diff --git a/src/main/java/org/qora/data/transaction/DeployAtTransactionData.java b/src/main/java/org/qora/data/transaction/DeployAtTransactionData.java index b5e064f7..7cc6f80d 100644 --- a/src/main/java/org/qora/data/transaction/DeployAtTransactionData.java +++ b/src/main/java/org/qora/data/transaction/DeployAtTransactionData.java @@ -5,7 +5,6 @@ import java.math.BigDecimal; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -32,10 +31,9 @@ public class DeployAtTransactionData extends TransactionData { super(TransactionType.DEPLOY_AT); } - /** From repository */ - public DeployAtTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, String aTAddress, String name, String description, - String aTType, String tags, byte[] creationBytes, BigDecimal amount, long assetId, BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.DEPLOY_AT, timestamp, txGroupId, reference, creatorPublicKey, fee, approvalStatus, height, signature); + public DeployAtTransactionData(BaseTransactionData baseTransactionData, + String aTAddress, String name, String description, String aTType, String tags, byte[] creationBytes, BigDecimal amount, long assetId) { + super(TransactionType.DEPLOY_AT, baseTransactionData); this.aTAddress = aTAddress; this.name = name; @@ -47,18 +45,6 @@ public class DeployAtTransactionData extends TransactionData { this.assetId = assetId; } - /** From network/API */ - public DeployAtTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, String name, String description, - String aTType, String tags, byte[] creationBytes, BigDecimal amount, long assetId, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, creatorPublicKey, null, name, description, aTType, tags, creationBytes, amount, assetId, fee, null, null, signature); - } - - /** New, unsigned */ - public DeployAtTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, String name, String description, - String aTType, String tags, byte[] creationBytes, BigDecimal amount, long assetId, BigDecimal fee) { - this(timestamp, txGroupId, reference, creatorPublicKey, name, description, aTType, tags, creationBytes, amount, assetId, fee, null); - } - // Getters/Setters public String getName() { diff --git a/src/main/java/org/qora/data/transaction/EnableForgingTransactionData.java b/src/main/java/org/qora/data/transaction/EnableForgingTransactionData.java index fff47588..c0be4ab5 100644 --- a/src/main/java/org/qora/data/transaction/EnableForgingTransactionData.java +++ b/src/main/java/org/qora/data/transaction/EnableForgingTransactionData.java @@ -1,12 +1,9 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -25,24 +22,12 @@ public class EnableForgingTransactionData extends TransactionData { super(TransactionType.ENABLE_FORGING); } - /** From repository */ - public EnableForgingTransactionData(long timestamp, int groupId, byte[] reference, byte[] creatorPublicKey, String target, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.ENABLE_FORGING, timestamp, groupId, reference, creatorPublicKey, fee, approvalStatus, height, signature); + public EnableForgingTransactionData(BaseTransactionData baseTransactionData, String target) { + super(TransactionType.ENABLE_FORGING, baseTransactionData); this.target = target; } - /** From network/API */ - public EnableForgingTransactionData(long timestamp, int groupId, byte[] reference, byte[] creatorPublicKey, String target, BigDecimal fee, byte[] signature) { - this(timestamp, groupId, reference, creatorPublicKey, target, fee, null, null, signature); - } - - /** New, unsigned */ - public EnableForgingTransactionData(long timestamp, int groupId, byte[] reference, byte[] creatorPublicKey, String target, BigDecimal fee) { - this(timestamp, groupId, reference, creatorPublicKey, target, fee, null); - } - // Getters / setters public String getTarget() { diff --git a/src/main/java/org/qora/data/transaction/GenesisTransactionData.java b/src/main/java/org/qora/data/transaction/GenesisTransactionData.java index c3cd54a5..f938f572 100644 --- a/src/main/java/org/qora/data/transaction/GenesisTransactionData.java +++ b/src/main/java/org/qora/data/transaction/GenesisTransactionData.java @@ -6,10 +6,7 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import org.eclipse.persistence.oxm.annotations.XmlDiscriminatorValue; -import org.qora.account.GenesisAccount; import org.qora.asset.Asset; -import org.qora.group.Group; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -38,9 +35,10 @@ public class GenesisTransactionData extends TransactionData { } /** From repository (V2) */ - public GenesisTransactionData(long timestamp, String recipient, BigDecimal amount, long assetId, byte[] signature) { + public GenesisTransactionData(BaseTransactionData baseTransactionData, String recipient, BigDecimal amount, long assetId) { // No groupID, null reference, zero fee, no approval required, height always 1 - super(TransactionType.GENESIS, timestamp, Group.NO_GROUP, null, GenesisAccount.PUBLIC_KEY, BigDecimal.ZERO, ApprovalStatus.NOT_REQUIRED, 1, signature); + // super(TransactionType.GENESIS, timestamp, Group.NO_GROUP, null, GenesisAccount.PUBLIC_KEY, BigDecimal.ZERO, ApprovalStatus.NOT_REQUIRED, 1, signature); + super(TransactionType.GENESIS, baseTransactionData); this.recipient = recipient; this.amount = amount; @@ -48,20 +46,8 @@ public class GenesisTransactionData extends TransactionData { } /** From repository (V1, where asset locked to QORA) */ - public GenesisTransactionData(long timestamp, String recipient, BigDecimal amount, byte[] signature) { - this(timestamp, recipient, amount, Asset.QORA, signature); - } - - // Never from network/API! - - /** New, unsigned (V2) */ - public GenesisTransactionData(long timestamp, String recipient, BigDecimal amount, long assetId) { - this(timestamp, recipient, amount, assetId, null); - } - - /** New, unsigned (V1) */ - public GenesisTransactionData(long timestamp, String recipient, BigDecimal amount) { - this(timestamp, recipient, amount, Asset.QORA, null); + public GenesisTransactionData(BaseTransactionData baseTransactionData, String recipient, BigDecimal amount) { + this(baseTransactionData, recipient, amount, Asset.QORA); } // Getters/Setters diff --git a/src/main/java/org/qora/data/transaction/GroupApprovalTransactionData.java b/src/main/java/org/qora/data/transaction/GroupApprovalTransactionData.java index b8321e2b..53f76c96 100644 --- a/src/main/java/org/qora/data/transaction/GroupApprovalTransactionData.java +++ b/src/main/java/org/qora/data/transaction/GroupApprovalTransactionData.java @@ -1,13 +1,10 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlTransient; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -57,26 +54,18 @@ public class GroupApprovalTransactionData extends TransactionData { } /** From repository */ - public GroupApprovalTransactionData(long timestamp, int groupId, byte[] reference, byte[] adminPublicKey, byte[] pendingSignature, boolean approval, - byte[] priorReference, BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.GROUP_APPROVAL, timestamp, groupId, reference, adminPublicKey, fee, approvalStatus, height, signature); + public GroupApprovalTransactionData(BaseTransactionData baseTransactionData, byte[] pendingSignature, boolean approval, byte[] priorReference) { + super(TransactionType.GROUP_APPROVAL, baseTransactionData); - this.adminPublicKey = adminPublicKey; + this.adminPublicKey = baseTransactionData.creatorPublicKey; this.pendingSignature = pendingSignature; this.approval = approval; this.priorReference = priorReference; } /** From network/API */ - public GroupApprovalTransactionData(long timestamp, int groupId, byte[] reference, byte[] adminPublicKey, byte[] pendingSignature, boolean approval, - BigDecimal fee, byte[] signature) { - this(timestamp, groupId, reference, adminPublicKey, pendingSignature, approval, null, fee, null, null, signature); - } - - /** New, unsigned */ - public GroupApprovalTransactionData(long timestamp, int groupId, byte[] reference, byte[] adminPublicKey, byte[] pendingSignature, boolean approval, - BigDecimal fee) { - this(timestamp, groupId, reference, adminPublicKey, pendingSignature, approval, fee, null); + public GroupApprovalTransactionData(BaseTransactionData baseTransactionData, byte[] pendingSignature, boolean approval) { + this(baseTransactionData, pendingSignature, approval, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/GroupBanTransactionData.java b/src/main/java/org/qora/data/transaction/GroupBanTransactionData.java index f785ed28..acc8b4ea 100644 --- a/src/main/java/org/qora/data/transaction/GroupBanTransactionData.java +++ b/src/main/java/org/qora/data/transaction/GroupBanTransactionData.java @@ -1,13 +1,10 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlTransient; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -77,12 +74,12 @@ public class GroupBanTransactionData extends TransactionData { } /** From repository */ - public GroupBanTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] adminPublicKey, int groupId, String member, - String reason, int timeToLive, byte[] memberReference, byte[] adminReference, byte[] joinInviteReference, Integer previousGroupId, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.GROUP_BAN, timestamp, txGroupId, reference, adminPublicKey, fee, approvalStatus, height, signature); + public GroupBanTransactionData(BaseTransactionData baseTransactionData, + int groupId, String member, String reason, int timeToLive, + byte[] memberReference, byte[] adminReference, byte[] joinInviteReference, Integer previousGroupId) { + super(TransactionType.GROUP_BAN, baseTransactionData); - this.adminPublicKey = adminPublicKey; + this.adminPublicKey = baseTransactionData.creatorPublicKey; this.groupId = groupId; this.offender = member; this.reason = reason; @@ -94,15 +91,8 @@ public class GroupBanTransactionData extends TransactionData { } /** From network/API */ - public GroupBanTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] adminPublicKey, int groupId, String offender, String reason, - int timeToLive, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, adminPublicKey, groupId, offender, reason, timeToLive, null, null, null, null, fee, null, null, signature); - } - - /** New, unsigned */ - public GroupBanTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] adminPublicKey, int groupId, String offender, String reason, - int timeToLive, BigDecimal fee) { - this(timestamp, txGroupId, reference, adminPublicKey, groupId, offender, reason, timeToLive, fee, null); + public GroupBanTransactionData(BaseTransactionData baseTransactionData, int groupId, String member, String reason, int timeToLive) { + this(baseTransactionData, groupId, member, reason, timeToLive, null, null, null, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/GroupInviteTransactionData.java b/src/main/java/org/qora/data/transaction/GroupInviteTransactionData.java index 20293daa..3856f23a 100644 --- a/src/main/java/org/qora/data/transaction/GroupInviteTransactionData.java +++ b/src/main/java/org/qora/data/transaction/GroupInviteTransactionData.java @@ -1,14 +1,11 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlTransient; import org.eclipse.persistence.oxm.annotations.XmlDiscriminatorValue; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -52,11 +49,11 @@ public class GroupInviteTransactionData extends TransactionData { } /** From repository */ - public GroupInviteTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] adminPublicKey, int groupId, String invitee, int timeToLive, byte[] joinReference, Integer previousGroupId, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.GROUP_INVITE, timestamp, txGroupId, reference, adminPublicKey, fee, approvalStatus, height, signature); + public GroupInviteTransactionData(BaseTransactionData baseTransactionData, + int groupId, String invitee, int timeToLive, byte[] joinReference, Integer previousGroupId) { + super(TransactionType.GROUP_INVITE, baseTransactionData); - this.adminPublicKey = adminPublicKey; + this.adminPublicKey = baseTransactionData.creatorPublicKey; this.groupId = groupId; this.invitee = invitee; this.timeToLive = timeToLive; @@ -65,13 +62,8 @@ public class GroupInviteTransactionData extends TransactionData { } /** From network/API */ - public GroupInviteTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] adminPublicKey, int groupId, String invitee, int timeToLive, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, adminPublicKey, groupId, invitee, timeToLive, null, null, fee, null, null, signature); - } - - /** New, unsigned */ - public GroupInviteTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] adminPublicKey, int groupId, String invitee, int timeToLive, BigDecimal fee) { - this(timestamp, txGroupId, reference, adminPublicKey, groupId, invitee, timeToLive, fee, null); + public GroupInviteTransactionData(BaseTransactionData baseTransactionData, int groupId, String invitee, int timeToLive) { + this(baseTransactionData, groupId, invitee, timeToLive, null, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/GroupKickTransactionData.java b/src/main/java/org/qora/data/transaction/GroupKickTransactionData.java index ae61f31c..299efc8a 100644 --- a/src/main/java/org/qora/data/transaction/GroupKickTransactionData.java +++ b/src/main/java/org/qora/data/transaction/GroupKickTransactionData.java @@ -1,13 +1,10 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlTransient; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -74,12 +71,11 @@ public class GroupKickTransactionData extends TransactionData { } /** From repository */ - public GroupKickTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] adminPublicKey, int groupId, String member, - String reason, byte[] memberReference, byte[] adminReference, byte[] joinReference, Integer previousGroupId, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.GROUP_KICK, timestamp, txGroupId, reference, adminPublicKey, fee, approvalStatus, height, signature); + public GroupKickTransactionData(BaseTransactionData baseTransactionData, + int groupId, String member, String reason, byte[] memberReference, byte[] adminReference, byte[] joinReference, Integer previousGroupId) { + super(TransactionType.GROUP_KICK, baseTransactionData); - this.adminPublicKey = adminPublicKey; + this.adminPublicKey = baseTransactionData.creatorPublicKey; this.groupId = groupId; this.member = member; this.reason = reason; @@ -90,14 +86,8 @@ public class GroupKickTransactionData extends TransactionData { } /** From network/API */ - public GroupKickTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] adminPublicKey, int groupId, String member, String reason, - BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, adminPublicKey, groupId, member, reason, null, null, null, null, fee, null, null, signature); - } - - /** New, unsigned */ - public GroupKickTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] adminPublicKey, int groupId, String member, String reason, BigDecimal fee) { - this(timestamp, txGroupId, reference, adminPublicKey, groupId, member, reason, fee, null); + public GroupKickTransactionData(BaseTransactionData baseTransactionData, int groupId, String member, String reason) { + this(baseTransactionData, groupId, member, reason, null, null, null, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/IssueAssetTransactionData.java b/src/main/java/org/qora/data/transaction/IssueAssetTransactionData.java index 15093f2c..37bf80ba 100644 --- a/src/main/java/org/qora/data/transaction/IssueAssetTransactionData.java +++ b/src/main/java/org/qora/data/transaction/IssueAssetTransactionData.java @@ -1,7 +1,5 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -9,7 +7,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import org.eclipse.persistence.oxm.annotations.XmlDiscriminatorValue; import org.qora.account.GenesisAccount; import org.qora.block.GenesisBlock; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -61,13 +58,12 @@ public class IssueAssetTransactionData extends TransactionData { } /** From repository */ - public IssueAssetTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] issuerPublicKey, Long assetId, String owner, - String assetName, String description, long quantity, boolean isDivisible, String data, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.ISSUE_ASSET, timestamp, txGroupId, reference, issuerPublicKey, fee, approvalStatus, height, signature); + public IssueAssetTransactionData(BaseTransactionData baseTransactionData, + Long assetId, String owner, String assetName, String description, long quantity, boolean isDivisible, String data) { + super(TransactionType.ISSUE_ASSET, baseTransactionData); this.assetId = assetId; - this.issuerPublicKey = issuerPublicKey; + this.issuerPublicKey = baseTransactionData.creatorPublicKey; this.owner = owner; this.assetName = assetName; this.description = description; @@ -77,15 +73,8 @@ public class IssueAssetTransactionData extends TransactionData { } /** From network/API */ - public IssueAssetTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] issuerPublicKey, String owner, String assetName, - String description, long quantity, boolean isDivisible, String data, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, issuerPublicKey, null, owner, assetName, description, quantity, isDivisible, data, fee, null, null, signature); - } - - /** New, unsigned */ - public IssueAssetTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] issuerPublicKey, String owner, String assetName, - String description, long quantity, boolean isDivisible, String data, BigDecimal fee) { - this(timestamp, txGroupId, reference, issuerPublicKey, owner, assetName, description, quantity, isDivisible, data, fee, null); + public IssueAssetTransactionData(BaseTransactionData baseTransactionData, String owner, String assetName, String description, long quantity, boolean isDivisible, String data) { + this(baseTransactionData, null, owner, assetName, description, quantity, isDivisible, data); } // Getters/Setters diff --git a/src/main/java/org/qora/data/transaction/JoinGroupTransactionData.java b/src/main/java/org/qora/data/transaction/JoinGroupTransactionData.java index 93b1a1d8..fced52a9 100644 --- a/src/main/java/org/qora/data/transaction/JoinGroupTransactionData.java +++ b/src/main/java/org/qora/data/transaction/JoinGroupTransactionData.java @@ -1,14 +1,11 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlTransient; import org.eclipse.persistence.oxm.annotations.XmlDiscriminatorValue; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -48,24 +45,18 @@ public class JoinGroupTransactionData extends TransactionData { } /** From repository */ - public JoinGroupTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] joinerPublicKey, int groupId, byte[] inviteReference, Integer previousGroupId, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.JOIN_GROUP, timestamp, txGroupId, reference, joinerPublicKey, fee, approvalStatus, height, signature); + public JoinGroupTransactionData(BaseTransactionData baseTransactionData, int groupId, byte[] inviteReference, Integer previousGroupId) { + super(TransactionType.JOIN_GROUP, baseTransactionData); - this.joinerPublicKey = joinerPublicKey; + this.joinerPublicKey = baseTransactionData.creatorPublicKey; this.groupId = groupId; this.inviteReference = inviteReference; this.previousGroupId = previousGroupId; } /** From network/API */ - public JoinGroupTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] joinerPublicKey, int groupId, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, joinerPublicKey, groupId, null, null, fee, null, null, signature); - } - - /** New, unsigned */ - public JoinGroupTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] joinerPublicKey, int groupId, BigDecimal fee) { - this(timestamp, txGroupId, reference, joinerPublicKey, groupId, fee, null); + public JoinGroupTransactionData(BaseTransactionData baseTransactionData, int groupId) { + this(baseTransactionData, groupId, null, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/LeaveGroupTransactionData.java b/src/main/java/org/qora/data/transaction/LeaveGroupTransactionData.java index 0cd3534b..36fbedd6 100644 --- a/src/main/java/org/qora/data/transaction/LeaveGroupTransactionData.java +++ b/src/main/java/org/qora/data/transaction/LeaveGroupTransactionData.java @@ -1,13 +1,10 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlTransient; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -50,11 +47,11 @@ public class LeaveGroupTransactionData extends TransactionData { } /** From repository */ - public LeaveGroupTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] leaverPublicKey, int groupId, byte[] memberReference, byte[] adminReference, Integer previousGroupId, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.LEAVE_GROUP, timestamp, txGroupId, reference, leaverPublicKey, fee, approvalStatus, height, signature); + public LeaveGroupTransactionData(BaseTransactionData baseTransactionData, + int groupId, byte[] memberReference, byte[] adminReference, Integer previousGroupId) { + super(TransactionType.LEAVE_GROUP, baseTransactionData); - this.leaverPublicKey = leaverPublicKey; + this.leaverPublicKey = baseTransactionData.creatorPublicKey; this.groupId = groupId; this.memberReference = memberReference; this.adminReference = adminReference; @@ -62,13 +59,8 @@ public class LeaveGroupTransactionData extends TransactionData { } /** From network/API */ - public LeaveGroupTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] leaverPublicKey, int groupId, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, leaverPublicKey, groupId, null, null, null, fee, null, null, signature); - } - - /** New, unsigned */ - public LeaveGroupTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] leaverPublicKey, int groupId, BigDecimal fee) { - this(timestamp, txGroupId, reference, leaverPublicKey, groupId, fee, null); + public LeaveGroupTransactionData(BaseTransactionData baseTransactionData, int groupId) { + this(baseTransactionData, groupId, null, null, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/MessageTransactionData.java b/src/main/java/org/qora/data/transaction/MessageTransactionData.java index f7013117..1a00fbfa 100644 --- a/src/main/java/org/qora/data/transaction/MessageTransactionData.java +++ b/src/main/java/org/qora/data/transaction/MessageTransactionData.java @@ -7,7 +7,6 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import org.qora.asset.Asset; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -38,12 +37,11 @@ public class MessageTransactionData extends TransactionData { this.creatorPublicKey = this.senderPublicKey; } - /** From repository */ - public MessageTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, int version, String recipient, Long assetId, - BigDecimal amount, byte[] data, boolean isText, boolean isEncrypted, BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.MESSAGE, timestamp, txGroupId, reference, senderPublicKey, fee, approvalStatus, height, signature); + public MessageTransactionData(BaseTransactionData baseTransactionData, + int version, String recipient, Long assetId, BigDecimal amount, byte[] data, boolean isText, boolean isEncrypted) { + super(TransactionType.MESSAGE, baseTransactionData); - this.senderPublicKey = senderPublicKey; + this.senderPublicKey = baseTransactionData.creatorPublicKey; this.version = version; this.recipient = recipient; @@ -58,18 +56,6 @@ public class MessageTransactionData extends TransactionData { this.isEncrypted = isEncrypted; } - /** From network/API */ - public MessageTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, int version, String recipient, Long assetId, - BigDecimal amount, byte[] data, boolean isText, boolean isEncrypted, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, senderPublicKey, version, recipient, assetId, amount, data, isText, isEncrypted, fee, null, null, signature); - } - - /** New, unsigned */ - public MessageTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, int version, String recipient, Long assetId, - BigDecimal amount, byte[] data, boolean isText, boolean isEncrypted, BigDecimal fee) { - this(timestamp, txGroupId, reference, senderPublicKey, version, recipient, assetId, amount, data, isText, isEncrypted, fee, null); - } - // Getters/Setters public byte[] getSenderPublicKey() { diff --git a/src/main/java/org/qora/data/transaction/MultiPaymentTransactionData.java b/src/main/java/org/qora/data/transaction/MultiPaymentTransactionData.java index 5155549d..c960c591 100644 --- a/src/main/java/org/qora/data/transaction/MultiPaymentTransactionData.java +++ b/src/main/java/org/qora/data/transaction/MultiPaymentTransactionData.java @@ -1,6 +1,5 @@ package org.qora.data.transaction; -import java.math.BigDecimal; import java.util.List; import javax.xml.bind.Unmarshaller; @@ -9,7 +8,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import org.qora.data.PaymentData; import org.qora.transaction.Transaction; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -34,25 +32,13 @@ public class MultiPaymentTransactionData extends TransactionData { this.creatorPublicKey = this.senderPublicKey; } - /** From repository */ - public MultiPaymentTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, List payments, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(Transaction.TransactionType.MULTI_PAYMENT, timestamp, txGroupId, reference, senderPublicKey, fee, approvalStatus, height, signature); + public MultiPaymentTransactionData(BaseTransactionData baseTransactionData, List payments) { + super(Transaction.TransactionType.MULTI_PAYMENT, baseTransactionData); - this.senderPublicKey = senderPublicKey; + this.senderPublicKey = baseTransactionData.creatorPublicKey; this.payments = payments; } - /** From network/API */ - public MultiPaymentTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, List payments, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, senderPublicKey, payments, fee, null, null, signature); - } - - /** New, unsigned */ - public MultiPaymentTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, List payments, BigDecimal fee) { - this(timestamp, txGroupId, reference, senderPublicKey, payments, fee, null); - } - // Getters/setters public byte[] getSenderPublicKey() { diff --git a/src/main/java/org/qora/data/transaction/PaymentTransactionData.java b/src/main/java/org/qora/data/transaction/PaymentTransactionData.java index 3a62dd39..84f858dc 100644 --- a/src/main/java/org/qora/data/transaction/PaymentTransactionData.java +++ b/src/main/java/org/qora/data/transaction/PaymentTransactionData.java @@ -7,7 +7,6 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -41,25 +40,14 @@ public class PaymentTransactionData extends TransactionData { } /** From repository */ - public PaymentTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, String recipient, BigDecimal amount, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.PAYMENT, timestamp, txGroupId, reference, senderPublicKey, fee, approvalStatus, height, signature); + public PaymentTransactionData(BaseTransactionData baseTransactionData, String recipient, BigDecimal amount) { + super(TransactionType.PAYMENT, baseTransactionData); - this.senderPublicKey = senderPublicKey; + this.senderPublicKey = baseTransactionData.creatorPublicKey; this.recipient = recipient; this.amount = amount; } - /** From network/API */ - public PaymentTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, String recipient, BigDecimal amount, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, senderPublicKey, recipient, amount, fee, null, null, signature); - } - - /** New, unsigned */ - public PaymentTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, String recipient, BigDecimal amount, BigDecimal fee) { - this(timestamp, txGroupId, reference, senderPublicKey, recipient, amount, fee, null); - } - // Getters/Setters public byte[] getSenderPublicKey() { diff --git a/src/main/java/org/qora/data/transaction/ProxyForgingTransactionData.java b/src/main/java/org/qora/data/transaction/ProxyForgingTransactionData.java index 3bec21dc..3498e31f 100644 --- a/src/main/java/org/qora/data/transaction/ProxyForgingTransactionData.java +++ b/src/main/java/org/qora/data/transaction/ProxyForgingTransactionData.java @@ -7,7 +7,6 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlTransient; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -44,12 +43,11 @@ public class ProxyForgingTransactionData extends TransactionData { } /** From repository */ - public ProxyForgingTransactionData(long timestamp, int groupId, byte[] reference, byte[] forgerPublicKey, String recipient, - byte[] proxyPublicKey, BigDecimal share, BigDecimal previousShare, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.PROXY_FORGING, timestamp, groupId, reference, forgerPublicKey, fee, approvalStatus, height, signature); + public ProxyForgingTransactionData(BaseTransactionData baseTransactionData, + String recipient, byte[] proxyPublicKey, BigDecimal share, BigDecimal previousShare) { + super(TransactionType.PROXY_FORGING, baseTransactionData); - this.forgerPublicKey = forgerPublicKey; + this.forgerPublicKey = baseTransactionData.creatorPublicKey; this.recipient = recipient; this.proxyPublicKey = proxyPublicKey; this.share = share; @@ -57,13 +55,9 @@ public class ProxyForgingTransactionData extends TransactionData { } /** From network/API */ - public ProxyForgingTransactionData(long timestamp, int groupId, byte[] reference, byte[] forgerPublicKey, String recipient, byte[] proxyPublicKey, BigDecimal share, BigDecimal fee, byte[] signature) { - this(timestamp, groupId, reference, forgerPublicKey, recipient, proxyPublicKey, share, null, fee, null, null, signature); - } - - /** New, unsigned */ - public ProxyForgingTransactionData(long timestamp, int groupId, byte[] reference, byte[] forgerPublicKey, String recipient, byte[] proxyPublicKey, BigDecimal share, BigDecimal fee) { - this(timestamp, groupId, reference, forgerPublicKey, recipient, proxyPublicKey, share, fee, null); + public ProxyForgingTransactionData(BaseTransactionData baseTransactionData, + String recipient, byte[] proxyPublicKey, BigDecimal share) { + this(baseTransactionData, recipient, proxyPublicKey, share, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/RegisterNameTransactionData.java b/src/main/java/org/qora/data/transaction/RegisterNameTransactionData.java index f430c5be..b784a825 100644 --- a/src/main/java/org/qora/data/transaction/RegisterNameTransactionData.java +++ b/src/main/java/org/qora/data/transaction/RegisterNameTransactionData.java @@ -1,12 +1,9 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -38,26 +35,15 @@ public class RegisterNameTransactionData extends TransactionData { } /** From repository */ - public RegisterNameTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] registrantPublicKey, String owner, String name, String data, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.REGISTER_NAME, timestamp, txGroupId, reference, registrantPublicKey, fee, approvalStatus, height, signature); + public RegisterNameTransactionData(BaseTransactionData baseTransactionData, String owner, String name, String data) { + super(TransactionType.REGISTER_NAME, baseTransactionData); - this.registrantPublicKey = registrantPublicKey; + this.registrantPublicKey = baseTransactionData.creatorPublicKey; this.owner = owner; this.name = name; this.data = data; } - /** From network/API */ - public RegisterNameTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] registrantPublicKey, String owner, String name, String data, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, registrantPublicKey, owner, name, data, fee, null, null, signature); - } - - /** New, unsigned */ - public RegisterNameTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] registrantPublicKey, String owner, String name, String data, BigDecimal fee) { - this(timestamp, txGroupId, reference, registrantPublicKey, owner, name, data, fee, null); - } - // Getters / setters public byte[] getRegistrantPublicKey() { diff --git a/src/main/java/org/qora/data/transaction/RemoveGroupAdminTransactionData.java b/src/main/java/org/qora/data/transaction/RemoveGroupAdminTransactionData.java index b25f5670..d18e8cbe 100644 --- a/src/main/java/org/qora/data/transaction/RemoveGroupAdminTransactionData.java +++ b/src/main/java/org/qora/data/transaction/RemoveGroupAdminTransactionData.java @@ -1,13 +1,10 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlTransient; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -42,24 +39,18 @@ public class RemoveGroupAdminTransactionData extends TransactionData { } /** From repository */ - public RemoveGroupAdminTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, int groupId, String admin, byte[] adminReference, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.REMOVE_GROUP_ADMIN, timestamp, txGroupId, reference, ownerPublicKey, fee, approvalStatus, height, signature); + public RemoveGroupAdminTransactionData(BaseTransactionData baseTransactionData, int groupId, String admin, byte[] adminReference) { + super(TransactionType.REMOVE_GROUP_ADMIN, baseTransactionData); - this.ownerPublicKey = ownerPublicKey; + this.ownerPublicKey = baseTransactionData.creatorPublicKey; this.groupId = groupId; this.admin = admin; this.adminReference = adminReference; } /** From network/API */ - public RemoveGroupAdminTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, int groupId, String admin, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, ownerPublicKey, groupId, admin, null, fee, null, null, signature); - } - - /** New, unsigned */ - public RemoveGroupAdminTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, int groupId, String admin, BigDecimal fee) { - this(timestamp, txGroupId, reference, ownerPublicKey, groupId, admin, fee, null); + public RemoveGroupAdminTransactionData(BaseTransactionData baseTransactionData, int groupId, String admin) { + this(baseTransactionData, groupId, admin, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/SellNameTransactionData.java b/src/main/java/org/qora/data/transaction/SellNameTransactionData.java index 00c2bca9..b59cdb19 100644 --- a/src/main/java/org/qora/data/transaction/SellNameTransactionData.java +++ b/src/main/java/org/qora/data/transaction/SellNameTransactionData.java @@ -7,7 +7,6 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -40,26 +39,14 @@ public class SellNameTransactionData extends TransactionData { this.creatorPublicKey = this.ownerPublicKey; } - /** From repository */ - public SellNameTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, String name, BigDecimal amount, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.SELL_NAME, timestamp, txGroupId, reference, ownerPublicKey, fee, approvalStatus, height, signature); + public SellNameTransactionData(BaseTransactionData baseTransactionData, String name, BigDecimal amount) { + super(TransactionType.SELL_NAME, baseTransactionData); - this.ownerPublicKey = ownerPublicKey; + this.ownerPublicKey = baseTransactionData.creatorPublicKey; this.name = name; this.amount = amount; } - /** From network/API */ - public SellNameTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, String name, BigDecimal amount, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, ownerPublicKey, name, amount, fee, null, null, signature); - } - - /** New, unsigned */ - public SellNameTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, String name, BigDecimal amount, BigDecimal fee) { - this(timestamp, txGroupId, reference, ownerPublicKey, name, amount, fee, null); - } - // Getters / setters public byte[] getOwnerPublicKey() { diff --git a/src/main/java/org/qora/data/transaction/SetGroupTransactionData.java b/src/main/java/org/qora/data/transaction/SetGroupTransactionData.java index 7f7e5bfd..e068dd70 100644 --- a/src/main/java/org/qora/data/transaction/SetGroupTransactionData.java +++ b/src/main/java/org/qora/data/transaction/SetGroupTransactionData.java @@ -1,13 +1,10 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlTransient; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -43,22 +40,16 @@ public class SetGroupTransactionData extends TransactionData { } /** From repository */ - public SetGroupTransactionData(long timestamp, int groupId, byte[] reference, byte[] creatorPublicKey, int defaultGroupId, Integer previousDefaultGroupId, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.SET_GROUP, timestamp, groupId, reference, creatorPublicKey, fee, approvalStatus, height, signature); + public SetGroupTransactionData(BaseTransactionData baseTransactionData, int defaultGroupId, Integer previousDefaultGroupId) { + super(TransactionType.SET_GROUP, baseTransactionData); this.defaultGroupId = defaultGroupId; this.previousDefaultGroupId = previousDefaultGroupId; } /** From network/API */ - public SetGroupTransactionData(long timestamp, int groupId, byte[] reference, byte[] creatorPublicKey, int defaultGroupId, BigDecimal fee, byte[] signature) { - this(timestamp, groupId, reference, creatorPublicKey, defaultGroupId, null, fee, null, null, signature); - } - - /** New, unsigned */ - public SetGroupTransactionData(long timestamp, int groupId, byte[] reference, byte[] creatorPublicKey, int defaultGroupId, BigDecimal fee) { - this(timestamp, groupId, reference, creatorPublicKey, defaultGroupId, fee, null); + public SetGroupTransactionData(BaseTransactionData baseTransactionData, int defaultGroupId) { + this(baseTransactionData, defaultGroupId, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/TransactionData.java b/src/main/java/org/qora/data/transaction/TransactionData.java index 5023a2d9..f9540cb2 100644 --- a/src/main/java/org/qora/data/transaction/TransactionData.java +++ b/src/main/java/org/qora/data/transaction/TransactionData.java @@ -63,13 +63,19 @@ public abstract class TransactionData { protected byte[] signature; @Schema(description = "groupID for this transaction") protected int txGroupId; - @Schema(description = "group-approval status") - protected ApprovalStatus approvalStatus; // Not always present @Schema(accessMode = AccessMode.READ_ONLY, hidden = true, description = "height of block containing transaction") protected Integer blockHeight; + // Not always present + @Schema(description = "group-approval status") + protected ApprovalStatus approvalStatus; + + // Not always present + @Schema(accessMode = AccessMode.READ_ONLY, hidden = true, description = "block height when transaction approved") + protected Integer approvalHeight; + // Constructors // For JAXB @@ -81,20 +87,19 @@ public abstract class TransactionData { this.type = type; } - public TransactionData(TransactionType type, long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, BigDecimal fee, ApprovalStatus approvalStatus, Integer blockHeight, byte[] signature) { + /** Constructor for use by transaction subclasses. */ + protected TransactionData(TransactionType type, BaseTransactionData baseTransactionData) { this.type = type; - this.timestamp = timestamp; - this.txGroupId = txGroupId; - this.reference = reference; - this.creatorPublicKey = creatorPublicKey; - this.fee = fee; - this.approvalStatus = approvalStatus; - this.blockHeight = blockHeight; - this.signature = signature; - } - public TransactionData(TransactionType type, long timestamp, int txGroupId, byte[] reference, byte[] creatorPublicKey, BigDecimal fee) { - this(type, timestamp, txGroupId, reference, creatorPublicKey, fee, null, null, null); + this.timestamp = baseTransactionData.timestamp; + this.txGroupId = baseTransactionData.txGroupId; + this.reference = baseTransactionData.reference; + this.creatorPublicKey = baseTransactionData.creatorPublicKey; + this.fee = baseTransactionData.fee; + this.signature = baseTransactionData.signature; + this.blockHeight = baseTransactionData.blockHeight; + this.approvalStatus = baseTransactionData.approvalStatus; + this.approvalHeight = baseTransactionData.approvalHeight; } // Getters/setters @@ -140,14 +145,6 @@ public abstract class TransactionData { this.fee = fee; } - public ApprovalStatus getApprovalStatus() { - return approvalStatus; - } - - public void setApprovalStatus(ApprovalStatus approvalStatus) { - this.approvalStatus = approvalStatus; - } - public byte[] getSignature() { return this.signature; } @@ -165,6 +162,24 @@ public abstract class TransactionData { this.blockHeight = blockHeight; } + public ApprovalStatus getApprovalStatus() { + return approvalStatus; + } + + @XmlTransient + public void setApprovalStatus(ApprovalStatus approvalStatus) { + this.approvalStatus = approvalStatus; + } + + public Integer getApprovalHeight() { + return this.approvalHeight; + } + + @XmlTransient + public void setApprovalHeight(Integer approvalHeight) { + this.approvalHeight = approvalHeight; + } + // JAXB special @XmlElement(name = "creatorAddress") diff --git a/src/main/java/org/qora/data/transaction/TransferAssetTransactionData.java b/src/main/java/org/qora/data/transaction/TransferAssetTransactionData.java index c92665f8..411191e2 100644 --- a/src/main/java/org/qora/data/transaction/TransferAssetTransactionData.java +++ b/src/main/java/org/qora/data/transaction/TransferAssetTransactionData.java @@ -6,7 +6,6 @@ import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -41,33 +40,19 @@ public class TransferAssetTransactionData extends TransactionData { } /** Constructs using data from repository, including optional assetName. */ - public TransferAssetTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, String recipient, BigDecimal amount, - long assetId, BigDecimal fee, String assetName, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.TRANSFER_ASSET, timestamp, txGroupId, reference, senderPublicKey, fee, approvalStatus, height, signature); + public TransferAssetTransactionData(BaseTransactionData baseTransactionData, String recipient, BigDecimal amount, long assetId, String assetName) { + super(TransactionType.TRANSFER_ASSET, baseTransactionData); - this.senderPublicKey = senderPublicKey; + this.senderPublicKey = baseTransactionData.creatorPublicKey; this.recipient = recipient; this.amount = amount; this.assetId = assetId; this.assetName = assetName; } - /** Constructs using data from repository, excluding optional assetName. */ - public TransferAssetTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, String recipient, BigDecimal amount, - long assetId, BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - this(timestamp, txGroupId, reference, senderPublicKey, recipient, amount, assetId, fee, null, null, null, signature); - } - - /** From network/API */ - public TransferAssetTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, String recipient, BigDecimal amount, - long assetId, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, senderPublicKey, recipient, amount, assetId, fee, null, null, null, signature); - } - - /** New, unsigned */ - public TransferAssetTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] senderPublicKey, String recipient, BigDecimal amount, - long assetId, BigDecimal fee) { - this(timestamp, txGroupId, reference, senderPublicKey, recipient, amount, assetId, fee, null); + /** Constructor excluding optional assetName. */ + public TransferAssetTransactionData(BaseTransactionData baseTransactionData, String recipient, BigDecimal amount, long assetId) { + this(baseTransactionData, recipient, amount, assetId, null); } // Getters/setters diff --git a/src/main/java/org/qora/data/transaction/UpdateAssetTransactionData.java b/src/main/java/org/qora/data/transaction/UpdateAssetTransactionData.java index fae79b38..69c1e799 100644 --- a/src/main/java/org/qora/data/transaction/UpdateAssetTransactionData.java +++ b/src/main/java/org/qora/data/transaction/UpdateAssetTransactionData.java @@ -1,13 +1,10 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlTransient; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -44,12 +41,12 @@ public class UpdateAssetTransactionData extends TransactionData { } /** From repository */ - public UpdateAssetTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, long assetId, String newOwner, - String newDescription, String newData, BigDecimal fee, byte[] orphanReference, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.UPDATE_ASSET, timestamp, txGroupId, reference, ownerPublicKey, fee, approvalStatus, height, signature); + public UpdateAssetTransactionData(BaseTransactionData baseTransactionData, + long assetId, String newOwner, String newDescription, String newData, byte[] orphanReference) { + super(TransactionType.UPDATE_ASSET, baseTransactionData); this.assetId = assetId; - this.ownerPublicKey = ownerPublicKey; + this.ownerPublicKey = baseTransactionData.creatorPublicKey; this.newOwner = newOwner; this.newDescription = newDescription; this.newData = newData; @@ -57,15 +54,8 @@ public class UpdateAssetTransactionData extends TransactionData { } /** From network/API */ - public UpdateAssetTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, long assetId, String newOwner, - String newDescription, String newData, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, ownerPublicKey, assetId, newOwner, newDescription, newData, fee, null, null, null, signature); - } - - /** New, unsigned */ - public UpdateAssetTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, long assetId, String newOwner, - String newDescription, String newData, BigDecimal fee) { - this(timestamp, txGroupId, reference, ownerPublicKey, assetId, newOwner, newDescription, newData, fee, null); + public UpdateAssetTransactionData(BaseTransactionData baseTransactionData, long assetId, String newOwner, String newDescription, String newData) { + this(baseTransactionData, assetId, newOwner, newDescription, newData, null); } // Getters/Setters diff --git a/src/main/java/org/qora/data/transaction/UpdateGroupTransactionData.java b/src/main/java/org/qora/data/transaction/UpdateGroupTransactionData.java index 14b3c6f3..066da097 100644 --- a/src/main/java/org/qora/data/transaction/UpdateGroupTransactionData.java +++ b/src/main/java/org/qora/data/transaction/UpdateGroupTransactionData.java @@ -1,7 +1,5 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -9,7 +7,6 @@ import javax.xml.bind.annotation.XmlTransient; import org.eclipse.persistence.oxm.annotations.XmlDiscriminatorValue; import org.qora.group.Group.ApprovalThreshold; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -83,13 +80,12 @@ public class UpdateGroupTransactionData extends TransactionData { } /** From repository */ - public UpdateGroupTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, int groupId, - String newOwner, String newDescription, boolean newIsOpen, ApprovalThreshold newApprovalThreshold, - int newMinimumBlockDelay, int newMaximumBlockDelay, byte[] groupReference, - BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.UPDATE_GROUP, timestamp, txGroupId, reference, ownerPublicKey, fee, approvalStatus, height, signature); + public UpdateGroupTransactionData(BaseTransactionData baseTransactionData, + int groupId, String newOwner, String newDescription, boolean newIsOpen, ApprovalThreshold newApprovalThreshold, + int newMinimumBlockDelay, int newMaximumBlockDelay, byte[] groupReference) { + super(TransactionType.UPDATE_GROUP, baseTransactionData); - this.ownerPublicKey = ownerPublicKey; + this.ownerPublicKey = baseTransactionData.creatorPublicKey; this.newOwner = newOwner; this.groupId = groupId; this.newDescription = newDescription; @@ -101,19 +97,10 @@ public class UpdateGroupTransactionData extends TransactionData { } /** From network/API */ - public UpdateGroupTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, int groupId, - String newOwner, String newDescription, boolean newIsOpen, ApprovalThreshold newApprovalThreshold, - int newMinimumBlockDelay, int newMaximumBlockDelay, BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, ownerPublicKey, groupId, newOwner, newDescription, newIsOpen, newApprovalThreshold, - newMinimumBlockDelay, newMaximumBlockDelay, null, fee, null, null, signature); - } - - /** New, unsigned */ - public UpdateGroupTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, int groupId, - String newOwner, String newDescription, boolean newIsOpen, ApprovalThreshold newApprovalThreshold, - int newMinimumBlockDelay, int newMaximumBlockDelay, BigDecimal fee) { - this(timestamp, txGroupId, reference, ownerPublicKey, groupId, newOwner, newDescription, newIsOpen, newApprovalThreshold, - newMinimumBlockDelay, newMaximumBlockDelay, fee, null); + public UpdateGroupTransactionData(BaseTransactionData baseTransactionData, + int groupId, String newOwner, String newDescription, boolean newIsOpen, ApprovalThreshold newApprovalThreshold, + int newMinimumBlockDelay, int newMaximumBlockDelay) { + this(baseTransactionData, groupId, newOwner, newDescription, newIsOpen, newApprovalThreshold, newMinimumBlockDelay, newMaximumBlockDelay, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/UpdateNameTransactionData.java b/src/main/java/org/qora/data/transaction/UpdateNameTransactionData.java index e157b8e1..3974d40a 100644 --- a/src/main/java/org/qora/data/transaction/UpdateNameTransactionData.java +++ b/src/main/java/org/qora/data/transaction/UpdateNameTransactionData.java @@ -1,13 +1,10 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlTransient; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -43,11 +40,10 @@ public class UpdateNameTransactionData extends TransactionData { } /** From repository */ - public UpdateNameTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, String newOwner, String name, String newData, - byte[] nameReference, BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.UPDATE_NAME, timestamp, txGroupId, reference, ownerPublicKey, fee, approvalStatus, height, signature); + public UpdateNameTransactionData(BaseTransactionData baseTransactionData, String newOwner, String name, String newData, byte[] nameReference) { + super(TransactionType.UPDATE_NAME, baseTransactionData); - this.ownerPublicKey = ownerPublicKey; + this.ownerPublicKey = baseTransactionData.creatorPublicKey; this.newOwner = newOwner; this.name = name; this.newData = newData; @@ -55,15 +51,8 @@ public class UpdateNameTransactionData extends TransactionData { } /** From network/API */ - public UpdateNameTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, String newOwner, String name, String newData, - BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, ownerPublicKey, newOwner, name, newData, null, fee, null, null, signature); - } - - /** New, unsigned */ - public UpdateNameTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] ownerPublicKey, String newOwner, String name, String newData, - BigDecimal fee) { - this(timestamp, txGroupId, reference, ownerPublicKey, newOwner, name, newData, fee, null); + public UpdateNameTransactionData(BaseTransactionData baseTransactionData, String newOwner, String name, String newData) { + this(baseTransactionData, newOwner, name, newData, null); } // Getters / setters diff --git a/src/main/java/org/qora/data/transaction/VoteOnPollTransactionData.java b/src/main/java/org/qora/data/transaction/VoteOnPollTransactionData.java index 63c241e7..620b8446 100644 --- a/src/main/java/org/qora/data/transaction/VoteOnPollTransactionData.java +++ b/src/main/java/org/qora/data/transaction/VoteOnPollTransactionData.java @@ -1,12 +1,9 @@ package org.qora.data.transaction; -import java.math.BigDecimal; - import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import org.qora.transaction.Transaction.ApprovalStatus; import org.qora.transaction.Transaction.TransactionType; import io.swagger.v3.oas.annotations.media.Schema; @@ -34,25 +31,18 @@ public class VoteOnPollTransactionData extends TransactionData { } /** From repository */ - public VoteOnPollTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] voterPublicKey, String pollName, int optionIndex, - Integer previousOptionIndex, BigDecimal fee, ApprovalStatus approvalStatus, Integer height, byte[] signature) { - super(TransactionType.VOTE_ON_POLL, timestamp, txGroupId, reference, voterPublicKey, fee, approvalStatus, height, signature); + public VoteOnPollTransactionData(BaseTransactionData baseTransactionData, String pollName, int optionIndex, Integer previousOptionIndex) { + super(TransactionType.VOTE_ON_POLL, baseTransactionData); - this.voterPublicKey = voterPublicKey; + this.voterPublicKey = baseTransactionData.creatorPublicKey; this.pollName = pollName; this.optionIndex = optionIndex; this.previousOptionIndex = previousOptionIndex; } /** From network/API */ - public VoteOnPollTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] voterPublicKey, String pollName, int optionIndex, - BigDecimal fee, byte[] signature) { - this(timestamp, txGroupId, reference, voterPublicKey, pollName, optionIndex, null, fee, null, null, signature); - } - - /** New, unsigned */ - public VoteOnPollTransactionData(long timestamp, int txGroupId, byte[] reference, byte[] voterPublicKey, String pollName, int optionIndex, BigDecimal fee) { - this(timestamp, txGroupId, reference, voterPublicKey, pollName, optionIndex, fee, null); + public VoteOnPollTransactionData(BaseTransactionData baseTransactionData, String pollName, int optionIndex) { + this(baseTransactionData, pollName, optionIndex, null); } // Getters / setters