Commit Graph

12 Commits

Author SHA1 Message Date
catbref
4be58514c0 Unify API calls that return lists + offload pagination to repository
API calls that return lists now take limit, offset and reverse params.

API calls that used to return data & optional list (e.g. blockWithTransactions)
now only return base data. The optional lists can be fetched via
a different API call.

Also: SLF4J now routes logging to log4j2 so start up output cleaned up.
Suppressed extraneous Jersey warning about Providers during start-up injection.
2019-01-24 16:42:55 +00:00
catbref
17f3958ad6 Fix ApiService to use new org.qora.* package names
Also add missing default for blockchain config file to Settings
2019-01-04 16:00:37 +00:00
catbref
5c6e239d76 initial work towards OSGi
refactored packages so they all start with org.qora

added some attempt at OSGi mega bundle using Maven (doesn't work)
2019-01-04 10:19:33 +00:00
catbref
c4ed4b378c Refactoring, new translations, cleaning up warnings.
Refactored to standard Maven layout:
src/main/java
src/main/resources
src/test/java
etc.

New translation code that uses locale-specific ResourceBundles
to load translations on demand.

Reworked API error/exceptions code to a shorter, simpler
@ApiErrors annotation. Processing of @ApiErrors annotations
produces an example for each possible API error and includes
API error string in HTTP response code, e.g.
400 INVALID_SIGNATURE
Missing API error cases added to each API call.

Translation of openAPI.json removed (for now).

block-explorer.html and BIP39 wordlists now read as resources
instead of direct from disk.

Java compile warnings fixed.
Some runtime warnings remain:

WARNING: A provider api.resource.ApiDefinition registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime.
WARNING: A provider api.resource.AnnotationPostProcessor registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime.
WARN org.reflections.Reflections - given scan urls are empty. set urls in the configuration
2018-12-21 11:14:16 +00:00
catbref
3ec3c69447 API: wholesale conversion back to Base58
XmlJavaTypeAdapter api.Base58TypeAdapter converts byte[] to Base58.
This XmlAdapter is applied at package-level to all packages inside data and api.models.
So no need to annotate every byte[] property!
Added package-info-maven-plugin to pom.xml to do this.

block-explorer.html fixed to show/use base58 again

Some data objects (e.g. TransactionData) have added XmlElements that
convert public keys to addresses, for convenience.

Several API calls updated to return specifically text/plain instead
of ambiguous application/json and/or text/plain. (Typically
API calls that return a single value, e.g. an integer, like /blocks/height).
2018-12-13 17:25:47 +00:00
catbref
ad9fa9bf9d More work on API plus basic block explorer
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
2018-12-04 16:34:55 +00:00
catbref
9dcdcb0ffe Files missing from previous commit (somehow) 2018-12-03 13:12:52 +00:00
catbref
90094be95a CIYAM-ATv2 can be used with any asset, not just QORA.
Some initial BTC cross-chain support. (Needs more work).

Unified timestamp for V2 switchover to block version 4,
applicable to several transaction types.

Qora-specific interface to CIYAM ATv2 library.

Beware: some areas still work-in-progress!
2018-12-03 13:05:38 +00:00
catbref
6fa874bc77 Modified Maven pom.xml to use HSQLDB jar in lib/ rather than from repo,
as it has bug fixes we need, applied since HSQLDB v2.4.1.

Modified Eclipse Java formatting settings for better enum layout.
2018-09-28 12:31:02 +01:00
catbref
519331f823 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"
2018-06-13 11:46:33 +01:00
catbref
3b02432b73 more work on DAO - for illustrative purposes only!! 2018-06-08 13:30:12 +01:00
catbref
a2b5fa140b Initial stab at migrating to HSQLDB for Qora gen2
Most SQL tables defined but only payment transactions actually implemented.
Maven support added.

Some code imported from 'old' Qora:

RIPEMD160 renamed as BrokenMD160 and deprecated.
whispersystem's Ed25519 implementation (to be replaced with bouncycastle).
Basic Account/PublicKeyAccount/PrivateKeyAccount code.
Some utils like Base58 and Pair.

To use:

Use maven to fetch dependencies.
Build project.
Fire up an old-gen Qora node.
Run src/test/update.java as a JUnit test to build DB structure.
Run src/test/migrate.java as a JUnit test to migrate old Qora blocks to DB.

You should now be able to run src/test/load.java and src/test/save.java
as JUnit tests demonstrating loading/saving Transactions from/to database.

This commit done while halfway through adding Block support!
2018-05-16 11:46:44 +01:00