mirror of
https://github.com/Qortal/qortal.git
synced 2025-11-03 15:37:04 +00:00
Work on Assets conversion
* Added AssetData transfer object * Added IssueAssetTransactionData transfer object * Reworked qora.assets.Asset into business layer object * Reworked qora.transaction.IssueAssetTransaction into business layer object * Added corresponding AssetRepository and support in TransactionRepository et al * Fixed BlockChain in line with asset changes * Some renaming inside GenesisTransaction to reflect use of transfer object, not business object * Business transaction objects now take Repository param * Moved HSQLDB transaction repositories into a sub-package * Changed HSQLDBSaver.execute(Connection connection) to .execute(Repository repository) to fix visibility issues and allow repository more control in the future if need be * Changed from "return null" statements in HSQLDB repositories to throw DataException when an error occurs. Better to throw than to silently return null? * Added static version of PublicKeyAccount.verify() for when a repository-backed PublicKeyAccount is not needed * Fixed getter/setter code template incorrectly producing "this.this.field = param"
This commit is contained in:
@@ -13,6 +13,8 @@ import utils.Base58;
|
||||
public class TransactionTransformer extends Transformer {
|
||||
|
||||
protected static final int TYPE_LENGTH = INT_LENGTH;
|
||||
protected static final int REFERENCE_LENGTH = SIGNATURE_LENGTH;
|
||||
protected static final int BASE_TYPELESS_LENGTH = TYPE_LENGTH + TIMESTAMP_LENGTH + REFERENCE_LENGTH + SIGNATURE_LENGTH;
|
||||
|
||||
public static TransactionData fromBytes(byte[] bytes) throws TransformationException {
|
||||
if (bytes == null)
|
||||
@@ -31,25 +33,34 @@ public class TransactionTransformer extends Transformer {
|
||||
case GENESIS:
|
||||
return GenesisTransactionTransformer.fromByteBuffer(byteBuffer);
|
||||
|
||||
case ISSUE_ASSET:
|
||||
return IssueAssetTransactionTransformer.fromByteBuffer(byteBuffer);
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getDataLength(TransactionData transaction) throws TransformationException {
|
||||
switch (transaction.getType()) {
|
||||
public static int getDataLength(TransactionData transactionData) throws TransformationException {
|
||||
switch (transactionData.getType()) {
|
||||
case GENESIS:
|
||||
return GenesisTransactionTransformer.getDataLength(transaction);
|
||||
return GenesisTransactionTransformer.getDataLength(transactionData);
|
||||
|
||||
case ISSUE_ASSET:
|
||||
return IssueAssetTransactionTransformer.getDataLength(transactionData);
|
||||
|
||||
default:
|
||||
throw new TransformationException("Unsupported transaction type");
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] toBytes(TransactionData transaction) throws TransformationException {
|
||||
switch (transaction.getType()) {
|
||||
public static byte[] toBytes(TransactionData transactionData) throws TransformationException {
|
||||
switch (transactionData.getType()) {
|
||||
case GENESIS:
|
||||
return GenesisTransactionTransformer.toBytes(transaction);
|
||||
return GenesisTransactionTransformer.toBytes(transactionData);
|
||||
|
||||
case ISSUE_ASSET:
|
||||
return IssueAssetTransactionTransformer.toBytes(transactionData);
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user