forked from Qortal/qortal
Added FATJAR packaging support to pom.xml Added some "summary" fields to API calls but more need doing. Corrected path clash from having unnecessary @OpenAPIDefinition annotations. Added API "tags" to group similar calls (address-based, block-related, etc.) Fixed addresses/lastreference/{address} Implemented addresses/lastreference/{address}/unconfirmed Implemented addresses/assets/{address} Added /admin/stop and /admin/uptime API calls. Moved general API info into new src/api/ApiDefinition.java Added CORS support to ApiService Added /transactions/address/{address} and /transactions/block/{signature} Replaced references to test.Common.* to do with repository factory. This fixes issues with building FATJAR due to references to test classes that are omitted from FATJAR. Changes to AccountBalanceData, BlockData and TransactionData to support JAX-RS rendering to JSON. Added getUnconfirmedLastReference() to Account. Added getAllBalances(address) to account repository - returns all asset balances for that address. Added getAllSignaturesInvolvingAddress(address) to account repository but currently only uses TransactionRecipients HSQLDB table. (And even that wasn't automatically populated). Included: very basic block explorer to be opened in browser as a file: block-explorer.html
57 lines
1.6 KiB
Java
57 lines
1.6 KiB
Java
import com.google.common.hash.HashCode;
|
|
|
|
import data.transaction.TransactionData;
|
|
import qora.block.BlockChain;
|
|
import repository.DataException;
|
|
import repository.Repository;
|
|
import repository.RepositoryFactory;
|
|
import repository.RepositoryManager;
|
|
import repository.hsqldb.HSQLDBRepositoryFactory;
|
|
import transform.TransformationException;
|
|
import transform.transaction.TransactionTransformer;
|
|
import utils.Base58;
|
|
|
|
public class txhex {
|
|
|
|
public static final String connectionUrl = "jdbc:hsqldb:file:db/test;create=true";
|
|
|
|
public static void main(String[] args) {
|
|
if (args.length == 0) {
|
|
System.err.println("usage: txhex <base58-tx-signature>");
|
|
System.exit(1);
|
|
}
|
|
|
|
byte[] signature = Base58.decode(args[0]);
|
|
|
|
try {
|
|
RepositoryFactory repositoryFactory = new HSQLDBRepositoryFactory(connectionUrl);
|
|
RepositoryManager.setRepositoryFactory(repositoryFactory);
|
|
} catch (DataException e) {
|
|
System.err.println("Couldn't connect to repository: " + e.getMessage());
|
|
System.exit(2);
|
|
}
|
|
|
|
try {
|
|
BlockChain.validate();
|
|
} catch (DataException e) {
|
|
System.err.println("Couldn't validate repository: " + e.getMessage());
|
|
System.exit(2);
|
|
}
|
|
|
|
try (final Repository repository = RepositoryManager.getRepository()) {
|
|
TransactionData transactionData = repository.getTransactionRepository().fromSignature(signature);
|
|
byte[] bytes = TransactionTransformer.toBytes(transactionData);
|
|
System.out.println(HashCode.fromBytes(bytes).toString());
|
|
} catch (DataException | TransformationException e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
try {
|
|
RepositoryManager.closeRepositoryFactory();
|
|
} catch (DataException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
}
|