From 5d3e38a74086398a4ad90c1e725b161a98133dfb Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Mon, 2 Oct 2017 14:26:10 -0500 Subject: [PATCH 01/49] Version bump in AndroidManifest --- graphenej/src/main/AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphenej/src/main/AndroidManifest.xml b/graphenej/src/main/AndroidManifest.xml index b86d91f..dcd0451 100644 --- a/graphenej/src/main/AndroidManifest.xml +++ b/graphenej/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="6" + android:versionName="0.4.4" > From 5e88c209e305892c768306026a41351be8ba2466 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Mon, 2 Oct 2017 14:34:50 -0500 Subject: [PATCH 02/49] Package rename --- gradle.properties | 4 +- graphenej/build.gradle | 8 +-- graphenej/src/main/AndroidManifest.xml | 6 +- .../agorise}/graphenej/AccountOptions.java | 6 +- .../agorise}/graphenej/Address.java | 4 +- .../agorise}/graphenej/Asset.java | 2 +- .../agorise}/graphenej/AssetAmount.java | 8 +-- .../agorise}/graphenej/AssetOptions.java | 2 +- .../agorise}/graphenej/Authority.java | 6 +- .../agorise}/graphenej/AuthorityType.java | 2 +- .../agorise}/graphenej/BIP39.java | 2 +- .../agorise}/graphenej/BaseOperation.java | 6 +- .../agorise}/graphenej/BlockData.java | 4 +- .../agorise}/graphenej/BrainKey.java | 4 +- .../agorise}/graphenej/Chains.java | 2 +- .../agorise}/graphenej/Converter.java | 6 +- .../agorise}/graphenej/Extensions.java | 6 +- .../agorise}/graphenej/FileBin.java | 6 +- .../agorise}/graphenej/GrapheneObject.java | 2 +- .../agorise}/graphenej/Invoice.java | 4 +- .../agorise}/graphenej/LimitOrder.java | 4 +- .../agorise}/graphenej/LineItem.java | 2 +- .../agorise}/graphenej/MarketTrade.java | 2 +- .../agorise}/graphenej/ObjectType.java | 2 +- .../agorise}/graphenej/OperationType.java | 2 +- .../agorise}/graphenej/Optional.java | 6 +- .../agorise}/graphenej/OrderBook.java | 4 +- .../agorise}/graphenej/Price.java | 9 +-- .../agorise}/graphenej/PublicKey.java | 4 +- .../agorise}/graphenej/RPC.java | 2 +- .../agorise}/graphenej/Transaction.java | 10 +-- .../agorise}/graphenej/UserAccount.java | 6 +- .../agorise}/graphenej/Util.java | 2 +- .../agorise}/graphenej/Varint.java | 2 +- .../agorise}/graphenej/Vote.java | 4 +- .../graphenej/api/BaseGrapheneHandler.java | 10 ++- .../graphenej/api/GetAccountBalances.java | 16 ++--- .../graphenej/api/GetAccountByName.java | 16 ++--- .../graphenej/api/GetAccountHistory.java | 2 +- .../agorise}/graphenej/api/GetAccounts.java | 18 +++--- .../graphenej/api/GetAllAssetHolders.java | 8 +-- .../graphenej/api/GetBlockHeader.java | 14 ++-- .../graphenej/api/GetKeyReferences.java | 14 ++-- .../graphenej/api/GetLimitOrders.java | 18 +++--- .../graphenej/api/GetMarketHistory.java | 16 ++--- .../agorise}/graphenej/api/GetObjects.java | 24 +++---- .../api/GetRelativeAccountHistory.java | 22 +++---- .../graphenej/api/GetRequiredFees.java | 19 +++--- .../graphenej/api/GetTradeHistory.java | 12 ++-- .../agorise}/graphenej/api/ListAssets.java | 12 ++-- .../graphenej/api/LookupAccounts.java | 12 ++-- .../graphenej/api/LookupAssetSymbols.java | 12 ++-- .../api/SubscriptionMessagesHub.java | 33 +++++----- .../api/TransactionBroadcastSequence.java | 22 +++---- .../graphenej/api/android/NodeConnection.java | 14 ++-- .../api/android/WebsocketWorkerThread.java | 8 +-- .../agorise}/graphenej/brainkeydict.txt | 0 .../graphenej/crypto/AndroidRandomSource.java | 2 +- .../graphenej/crypto/EntropySource.java | 2 +- .../graphenej/crypto/RandomSource.java | 2 +- .../crypto/SecureRandomGenerator.java | 2 +- .../crypto/SecureRandomStrengthener.java | 2 +- .../graphenej/errors/ChecksumException.java | 2 +- .../errors/IncompatibleOperation.java | 2 +- .../errors/IncompleteAssetError.java | 2 +- .../errors/MalformedAddressException.java | 2 +- .../errors/MalformedOperationException.java | 2 +- .../errors/MalformedTransactionException.java | 2 +- .../errors/RepeatedRequestIdException.java | 2 +- .../interfaces/ByteSerializable.java | 2 +- .../interfaces/GrapheneSerializable.java | 2 +- .../interfaces/JsonSerializable.java | 2 +- .../interfaces/NodeErrorListener.java | 4 +- .../graphenej/interfaces/SubscriptionHub.java | 2 +- .../interfaces/SubscriptionListener.java | 6 +- .../interfaces/WitnessResponseListener.java | 6 +- .../models/AccountBalanceUpdate.java | 4 +- .../graphenej/models/AccountProperties.java | 6 +- .../agorise}/graphenej/models/ApiCall.java | 4 +- .../agorise}/graphenej/models/AssetFeed.java | 4 +- .../graphenej/models/AssetHolderCount.java | 4 +- .../graphenej/models/BaseResponse.java | 2 +- .../graphenej/models/BitAssetData.java | 6 +- .../graphenej/models/BlockHeader.java | 2 +- .../models/BroadcastedTransaction.java | 11 +--- .../graphenej/models/BucketObject.java | 4 +- .../models/DynamicGlobalProperties.java | 6 +- .../graphenej/models/HistoricalTransfer.java | 4 +- .../models/SubscriptionResponse.java | 10 +-- .../graphenej/models/WitnessResponse.java | 2 +- .../models/backup/LinkedAccount.java | 2 +- .../models/backup/PrivateKeyBackup.java | 6 +- .../graphenej/models/backup/Wallet.java | 9 ++- .../graphenej/models/backup/WalletBackup.java | 2 +- .../agorise}/graphenej/objects/Memo.java | 17 +++-- .../operations/AccountUpdateOperation.java | 4 +- .../AccountUpdateOperationBuilder.java | 6 +- .../operations/BaseOperationBuilder.java | 4 +- .../operations/LimitOrderCancelOperation.java | 4 +- .../operations/LimitOrderCreateOperation.java | 12 ++-- .../operations/TransferOperation.java | 12 ++-- .../operations/TransferOperationBuilder.java | 10 +-- .../graphenej/test/NaiveSSLContext.java | 2 +- .../agorise}/graphenej/AssetAmountTest.java | 2 +- .../agorise}/graphenej/AssetTest.java | 4 +- .../agorise}/graphenej/AuthorityTest.java | 2 +- .../agorise}/graphenej/BrainKeyTest.java | 2 +- .../agorise}/graphenej/ObjectTypeTest.java | 2 +- .../agorise}/graphenej/PublicKeyTest.java | 3 +- .../agorise}/graphenej/TransactionTest.java | 19 +++--- .../agorise}/graphenej/UserAccountTest.java | 12 ++-- .../agorise}/graphenej/api/BaseApiTest.java | 4 +- .../graphenej/api/GetKeyReferencesTest.java | 14 ++-- .../graphenej/api/GetLimitOrdersTest.java | 22 +++---- .../graphenej/api/GetObjectsTest.java | 16 ++--- .../api/GetRelativeAccountHistoryTest.java | 14 ++-- .../api/SubscriptionMessagesHubTest.java | 20 +++--- .../api/android/NodeConnectionTest.java | 64 +++++++++---------- .../agorise}/graphenej/objects/MemoTest.java | 10 +-- .../AccountUpdateOperationTest.java | 28 ++++---- .../LimitOrderCancelOperationTest.java | 6 +- .../LimitOrderCreateOperationTest.java | 10 +-- 122 files changed, 455 insertions(+), 479 deletions(-) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/AccountOptions.java (96%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/Address.java (94%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/Asset.java (99%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/AssetAmount.java (96%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/AssetOptions.java (98%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/Authority.java (98%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/AuthorityType.java (85%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/BIP39.java (98%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/BaseOperation.java (82%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/BlockData.java (97%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/BrainKey.java (97%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/Chains.java (93%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/Converter.java (97%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/Extensions.java (83%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/FileBin.java (98%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/GrapheneObject.java (99%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/Invoice.java (96%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/LimitOrder.java (97%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/LineItem.java (95%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/MarketTrade.java (80%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/ObjectType.java (99%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/OperationType.java (97%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/Optional.java (87%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/OrderBook.java (97%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/Price.java (77%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/PublicKey.java (92%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/RPC.java (98%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/Transaction.java (98%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/UserAccount.java (98%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/Util.java (99%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/Varint.java (99%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/Vote.java (87%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/BaseGrapheneHandler.java (90%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetAccountBalances.java (90%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetAccountByName.java (89%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetAccountHistory.java (82%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetAccounts.java (91%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetAllAssetHolders.java (95%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetBlockHeader.java (92%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetKeyReferences.java (93%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetLimitOrders.java (91%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetMarketHistory.java (95%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetObjects.java (89%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetRelativeAccountHistory.java (93%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetRequiredFees.java (88%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetTradeHistory.java (93%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/ListAssets.java (95%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/LookupAccounts.java (94%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/LookupAssetSymbols.java (91%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/SubscriptionMessagesHub.java (92%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/TransactionBroadcastSequence.java (93%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/android/NodeConnection.java (91%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/android/WebsocketWorkerThread.java (94%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/brainkeydict.txt (100%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/crypto/AndroidRandomSource.java (98%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/crypto/EntropySource.java (92%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/crypto/RandomSource.java (94%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/crypto/SecureRandomGenerator.java (90%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/crypto/SecureRandomStrengthener.java (99%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/errors/ChecksumException.java (79%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/errors/IncompatibleOperation.java (80%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/errors/IncompleteAssetError.java (89%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/errors/MalformedAddressException.java (80%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/errors/MalformedOperationException.java (80%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/errors/MalformedTransactionException.java (81%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/errors/RepeatedRequestIdException.java (80%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/interfaces/ByteSerializable.java (77%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/interfaces/GrapheneSerializable.java (78%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/interfaces/JsonSerializable.java (86%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/interfaces/NodeErrorListener.java (60%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/interfaces/SubscriptionHub.java (94%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/interfaces/SubscriptionListener.java (85%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/interfaces/WitnessResponseListener.java (55%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/AccountBalanceUpdate.java (83%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/AccountProperties.java (85%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/ApiCall.java (97%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/AssetFeed.java (72%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/AssetHolderCount.java (90%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/BaseResponse.java (92%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/BitAssetData.java (80%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/BlockHeader.java (83%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/BroadcastedTransaction.java (66%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/BucketObject.java (97%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/DynamicGlobalProperties.java (97%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/HistoricalTransfer.java (92%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/SubscriptionResponse.java (97%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/WitnessResponse.java (82%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/backup/LinkedAccount.java (92%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/backup/PrivateKeyBackup.java (88%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/backup/Wallet.java (95%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/models/backup/WalletBackup.java (96%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/objects/Memo.java (95%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/operations/AccountUpdateOperation.java (97%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/operations/AccountUpdateOperationBuilder.java (91%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/operations/BaseOperationBuilder.java (77%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/operations/LimitOrderCancelOperation.java (95%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/operations/LimitOrderCreateOperation.java (96%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/operations/TransferOperation.java (95%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/operations/TransferOperationBuilder.java (86%) rename graphenej/src/main/java/{de/bitsharesmunich => cy/agorise}/graphenej/test/NaiveSSLContext.java (98%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/AssetAmountTest.java (96%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/AssetTest.java (85%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/AuthorityTest.java (98%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/BrainKeyTest.java (95%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/ObjectTypeTest.java (96%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/PublicKeyTest.java (93%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/TransactionTest.java (96%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/UserAccountTest.java (84%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/BaseApiTest.java (87%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetKeyReferencesTest.java (87%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetLimitOrdersTest.java (90%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetObjectsTest.java (92%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/GetRelativeAccountHistoryTest.java (85%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/SubscriptionMessagesHubTest.java (92%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/api/android/NodeConnectionTest.java (95%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/objects/MemoTest.java (96%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/operations/AccountUpdateOperationTest.java (76%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/operations/LimitOrderCancelOperationTest.java (89%) rename graphenej/src/test/java/{de/bitsharesmunich => cy/agorise}/graphenej/operations/LimitOrderCreateOperationTest.java (91%) diff --git a/gradle.properties b/gradle.properties index 1053dd5..80c0e44 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,8 +17,8 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME=0.4.4 -VERSION_CODE=6 +VERSION_NAME=0.4.5 +VERSION_CODE=7 GROUP=com.github.bilthon POM_DESCRIPTION=A Java library for mobile app Developers; Graphene/Bitshares blockchain. diff --git a/graphenej/build.gradle b/graphenej/build.gradle index 64f87e8..14e9c8c 100644 --- a/graphenej/build.gradle +++ b/graphenej/build.gradle @@ -1,5 +1,5 @@ -group 'de.bitsharesmunich' -version '0.4.4' +group 'cy.agorise' +version '0.4.5' apply plugin: 'com.android.library' apply from: 'maven-push.gradle' @@ -21,8 +21,8 @@ android { defaultConfig { minSdkVersion 9 targetSdkVersion 24 - versionCode 6 - versionName "0.4.4" + versionCode 7 + versionName "0.4.5" vectorDrawables.useSupportLibrary = true } diff --git a/graphenej/src/main/AndroidManifest.xml b/graphenej/src/main/AndroidManifest.xml index dcd0451..33b119d 100644 --- a/graphenej/src/main/AndroidManifest.xml +++ b/graphenej/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + package="cy.agorise.graphenej" + android:versionCode="7" + android:versionName="0.4.5" > diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/AccountOptions.java b/graphenej/src/main/java/cy/agorise/graphenej/AccountOptions.java similarity index 96% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/AccountOptions.java rename to graphenej/src/main/java/cy/agorise/graphenej/AccountOptions.java index 43c060e..3a58cab 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/AccountOptions.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/AccountOptions.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.common.primitives.Bytes; import com.google.gson.JsonArray; @@ -12,8 +12,8 @@ import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; -import de.bitsharesmunich.graphenej.errors.MalformedAddressException; -import de.bitsharesmunich.graphenej.interfaces.GrapheneSerializable; +import cy.agorise.graphenej.errors.MalformedAddressException; +import cy.agorise.graphenej.interfaces.GrapheneSerializable; /** * Created by nelson on 12/5/16. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Address.java b/graphenej/src/main/java/cy/agorise/graphenej/Address.java similarity index 94% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/Address.java rename to graphenej/src/main/java/cy/agorise/graphenej/Address.java index b2c9ed0..0a60048 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Address.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Address.java @@ -1,7 +1,7 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.common.primitives.Bytes; -import de.bitsharesmunich.graphenej.errors.MalformedAddressException; +import cy.agorise.graphenej.errors.MalformedAddressException; import org.bitcoinj.core.Base58; import org.bitcoinj.core.ECKey; import org.spongycastle.crypto.digests.RIPEMD160Digest; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Asset.java b/graphenej/src/main/java/cy/agorise/graphenej/Asset.java similarity index 99% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/Asset.java rename to graphenej/src/main/java/cy/agorise/graphenej/Asset.java index 8ea2b77..8c2ec5c 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Asset.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Asset.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.common.primitives.UnsignedLong; import com.google.gson.JsonDeserializationContext; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/AssetAmount.java b/graphenej/src/main/java/cy/agorise/graphenej/AssetAmount.java similarity index 96% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/AssetAmount.java rename to graphenej/src/main/java/cy/agorise/graphenej/AssetAmount.java index cd0ea49..312662e 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/AssetAmount.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/AssetAmount.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.common.math.DoubleMath; import com.google.common.primitives.Bytes; @@ -19,9 +19,9 @@ import java.io.IOException; import java.lang.reflect.Type; import java.math.RoundingMode; -import de.bitsharesmunich.graphenej.errors.IncompatibleOperation; -import de.bitsharesmunich.graphenej.interfaces.ByteSerializable; -import de.bitsharesmunich.graphenej.interfaces.JsonSerializable; +import cy.agorise.graphenej.errors.IncompatibleOperation; +import cy.agorise.graphenej.interfaces.ByteSerializable; +import cy.agorise.graphenej.interfaces.JsonSerializable; /** * Created by nelson on 11/7/16. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/AssetOptions.java b/graphenej/src/main/java/cy/agorise/graphenej/AssetOptions.java similarity index 98% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/AssetOptions.java rename to graphenej/src/main/java/cy/agorise/graphenej/AssetOptions.java index 06fee0b..8ed4205 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/AssetOptions.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/AssetOptions.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.common.primitives.UnsignedLong; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Authority.java b/graphenej/src/main/java/cy/agorise/graphenej/Authority.java similarity index 98% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/Authority.java rename to graphenej/src/main/java/cy/agorise/graphenej/Authority.java index 3bd4dc2..7c2f02e 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Authority.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Authority.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.common.primitives.Bytes; import com.google.gson.JsonArray; @@ -13,8 +13,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import de.bitsharesmunich.graphenej.errors.MalformedAddressException; -import de.bitsharesmunich.graphenej.interfaces.GrapheneSerializable; +import cy.agorise.graphenej.errors.MalformedAddressException; +import cy.agorise.graphenej.interfaces.GrapheneSerializable; /** * Class used to represent the weighted set of keys and accounts that must approve operations. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/AuthorityType.java b/graphenej/src/main/java/cy/agorise/graphenej/AuthorityType.java similarity index 85% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/AuthorityType.java rename to graphenej/src/main/java/cy/agorise/graphenej/AuthorityType.java index ab0faa8..2fb52b8 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/AuthorityType.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/AuthorityType.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; /** * Enum-type used to specify the different roles of an authority. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/BIP39.java b/graphenej/src/main/java/cy/agorise/graphenej/BIP39.java similarity index 98% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/BIP39.java rename to graphenej/src/main/java/cy/agorise/graphenej/BIP39.java index ecb532d..fa882be 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/BIP39.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/BIP39.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import java.util.Arrays; import org.bitcoinj.core.Base58; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/BaseOperation.java b/graphenej/src/main/java/cy/agorise/graphenej/BaseOperation.java similarity index 82% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/BaseOperation.java rename to graphenej/src/main/java/cy/agorise/graphenej/BaseOperation.java index 9a727cd..bafbea9 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/BaseOperation.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/BaseOperation.java @@ -1,9 +1,9 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.gson.JsonArray; import com.google.gson.JsonElement; -import de.bitsharesmunich.graphenej.interfaces.ByteSerializable; -import de.bitsharesmunich.graphenej.interfaces.JsonSerializable; +import cy.agorise.graphenej.interfaces.ByteSerializable; +import cy.agorise.graphenej.interfaces.JsonSerializable; /** * Created by nelson on 11/5/16. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/BlockData.java b/graphenej/src/main/java/cy/agorise/graphenej/BlockData.java similarity index 97% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/BlockData.java rename to graphenej/src/main/java/cy/agorise/graphenej/BlockData.java index 4a65917..d8457f5 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/BlockData.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/BlockData.java @@ -1,6 +1,6 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; -import de.bitsharesmunich.graphenej.interfaces.ByteSerializable; +import cy.agorise.graphenej.interfaces.ByteSerializable; /** * This class encapsulates all block-related information needed in order to build a valid transaction. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/BrainKey.java b/graphenej/src/main/java/cy/agorise/graphenej/BrainKey.java similarity index 97% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/BrainKey.java rename to graphenej/src/main/java/cy/agorise/graphenej/BrainKey.java index 7812ee9..e54e3b7 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/BrainKey.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/BrainKey.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import org.bitcoinj.core.DumpedPrivateKey; import org.bitcoinj.core.ECKey; @@ -10,7 +10,7 @@ import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.ArrayList; -import de.bitsharesmunich.graphenej.crypto.SecureRandomGenerator; +import cy.agorise.graphenej.crypto.SecureRandomGenerator; /** * Class used to encapsulate all BrainKey-related operations. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Chains.java b/graphenej/src/main/java/cy/agorise/graphenej/Chains.java similarity index 93% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/Chains.java rename to graphenej/src/main/java/cy/agorise/graphenej/Chains.java index 775bbf2..c26a7e1 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Chains.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Chains.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; /** * Created by nelson on 11/8/16. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Converter.java b/graphenej/src/main/java/cy/agorise/graphenej/Converter.java similarity index 97% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/Converter.java rename to graphenej/src/main/java/cy/agorise/graphenej/Converter.java index 257c422..f0706f6 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Converter.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Converter.java @@ -1,10 +1,10 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import java.math.BigDecimal; import java.math.MathContext; -import de.bitsharesmunich.graphenej.errors.IncompleteAssetError; -import de.bitsharesmunich.graphenej.models.BucketObject; +import cy.agorise.graphenej.errors.IncompleteAssetError; +import cy.agorise.graphenej.models.BucketObject; /** * Generic converter class used to translate the market information contained in a BucketObject and/or Price instances. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Extensions.java b/graphenej/src/main/java/cy/agorise/graphenej/Extensions.java similarity index 83% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/Extensions.java rename to graphenej/src/main/java/cy/agorise/graphenej/Extensions.java index 1848855..ada71a3 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Extensions.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Extensions.java @@ -1,9 +1,9 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.gson.JsonArray; import com.google.gson.JsonElement; -import de.bitsharesmunich.graphenej.interfaces.ByteSerializable; -import de.bitsharesmunich.graphenej.interfaces.JsonSerializable; +import cy.agorise.graphenej.interfaces.ByteSerializable; +import cy.agorise.graphenej.interfaces.JsonSerializable; import java.util.ArrayList; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/FileBin.java b/graphenej/src/main/java/cy/agorise/graphenej/FileBin.java similarity index 98% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/FileBin.java rename to graphenej/src/main/java/cy/agorise/graphenej/FileBin.java index 703102f..0eb0711 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/FileBin.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/FileBin.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; @@ -13,8 +13,8 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; -import de.bitsharesmunich.graphenej.crypto.SecureRandomStrengthener; -import de.bitsharesmunich.graphenej.models.backup.WalletBackup; +import cy.agorise.graphenej.crypto.SecureRandomStrengthener; +import cy.agorise.graphenej.models.backup.WalletBackup; /** * Class to manage the backup files diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/GrapheneObject.java b/graphenej/src/main/java/cy/agorise/graphenej/GrapheneObject.java similarity index 99% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/GrapheneObject.java rename to graphenej/src/main/java/cy/agorise/graphenej/GrapheneObject.java index aaee8b5..072355b 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/GrapheneObject.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/GrapheneObject.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.gson.annotations.Expose; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Invoice.java b/graphenej/src/main/java/cy/agorise/graphenej/Invoice.java similarity index 96% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/Invoice.java rename to graphenej/src/main/java/cy/agorise/graphenej/Invoice.java index cdd7364..7b1dc37 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Invoice.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Invoice.java @@ -1,11 +1,11 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.gson.Gson; import com.google.gson.JsonElement; import org.bitcoinj.core.Base58; -import de.bitsharesmunich.graphenej.interfaces.JsonSerializable; +import cy.agorise.graphenej.interfaces.JsonSerializable; /** * Class used to handle invoice generation, compression and QR-Code data derivation, diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/LimitOrder.java b/graphenej/src/main/java/cy/agorise/graphenej/LimitOrder.java similarity index 97% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/LimitOrder.java rename to graphenej/src/main/java/cy/agorise/graphenej/LimitOrder.java index 77d5d7c..8d26d76 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/LimitOrder.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/LimitOrder.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; @@ -12,7 +12,7 @@ import java.io.DataOutputStream; import java.io.IOException; import java.lang.reflect.Type; -import de.bitsharesmunich.graphenej.interfaces.ByteSerializable; +import cy.agorise.graphenej.interfaces.ByteSerializable; /** * diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/LineItem.java b/graphenej/src/main/java/cy/agorise/graphenej/LineItem.java similarity index 95% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/LineItem.java rename to graphenej/src/main/java/cy/agorise/graphenej/LineItem.java index 9b58fdb..7442ca9 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/LineItem.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/LineItem.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; /** * Created by nelson on 1/11/17. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/MarketTrade.java b/graphenej/src/main/java/cy/agorise/graphenej/MarketTrade.java similarity index 80% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/MarketTrade.java rename to graphenej/src/main/java/cy/agorise/graphenej/MarketTrade.java index c5aa841..a97220e 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/MarketTrade.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/MarketTrade.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; /** * diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/ObjectType.java b/graphenej/src/main/java/cy/agorise/graphenej/ObjectType.java similarity index 99% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/ObjectType.java rename to graphenej/src/main/java/cy/agorise/graphenej/ObjectType.java index 537eaf1..ee1ce37 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/ObjectType.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/ObjectType.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; /** * Enum type used to list all possible object types and obtain their space + type id diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/OperationType.java b/graphenej/src/main/java/cy/agorise/graphenej/OperationType.java similarity index 97% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/OperationType.java rename to graphenej/src/main/java/cy/agorise/graphenej/OperationType.java index 36d9f52..9ea093d 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/OperationType.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/OperationType.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; /** * Enum type used to keep track of all the operation types and their corresponding ids. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Optional.java b/graphenej/src/main/java/cy/agorise/graphenej/Optional.java similarity index 87% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/Optional.java rename to graphenej/src/main/java/cy/agorise/graphenej/Optional.java index 8f48c5e..c32c83a 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Optional.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Optional.java @@ -1,9 +1,9 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.gson.JsonElement; -import de.bitsharesmunich.graphenej.interfaces.ByteSerializable; -import de.bitsharesmunich.graphenej.interfaces.GrapheneSerializable; +import cy.agorise.graphenej.interfaces.ByteSerializable; +import cy.agorise.graphenej.interfaces.GrapheneSerializable; /** * Container template class used whenever we have an optional field. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/OrderBook.java b/graphenej/src/main/java/cy/agorise/graphenej/OrderBook.java similarity index 97% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/OrderBook.java rename to graphenej/src/main/java/cy/agorise/graphenej/OrderBook.java index 3615b0b..61b5729 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/OrderBook.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/OrderBook.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.common.math.DoubleMath; import com.google.common.primitives.UnsignedLong; @@ -6,7 +6,7 @@ import com.google.common.primitives.UnsignedLong; import java.math.RoundingMode; import java.util.List; -import de.bitsharesmunich.graphenej.operations.LimitOrderCreateOperation; +import cy.agorise.graphenej.operations.LimitOrderCreateOperation; /** * This class will maintain a snapshot of the order book between two assets. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Price.java b/graphenej/src/main/java/cy/agorise/graphenej/Price.java similarity index 77% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/Price.java rename to graphenej/src/main/java/cy/agorise/graphenej/Price.java index 78e6948..f45c56c 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Price.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Price.java @@ -1,11 +1,4 @@ -package de.bitsharesmunich.graphenej; - -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; - -import java.lang.reflect.Type; +package cy.agorise.graphenej; /** * The price struct stores asset prices in the Graphene system. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/PublicKey.java b/graphenej/src/main/java/cy/agorise/graphenej/PublicKey.java similarity index 92% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/PublicKey.java rename to graphenej/src/main/java/cy/agorise/graphenej/PublicKey.java index 5b9e7eb..f20f648 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/PublicKey.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/PublicKey.java @@ -1,11 +1,11 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import org.bitcoinj.core.ECKey; import org.spongycastle.math.ec.ECPoint; import java.io.Serializable; -import de.bitsharesmunich.graphenej.interfaces.ByteSerializable; +import cy.agorise.graphenej.interfaces.ByteSerializable; /** * Created by nelson on 11/30/16. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/RPC.java b/graphenej/src/main/java/cy/agorise/graphenej/RPC.java similarity index 98% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/RPC.java rename to graphenej/src/main/java/cy/agorise/graphenej/RPC.java index 2375925..e1f42c0 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/RPC.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/RPC.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; /** * Created by nelson on 11/16/16. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Transaction.java b/graphenej/src/main/java/cy/agorise/graphenej/Transaction.java similarity index 98% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/Transaction.java rename to graphenej/src/main/java/cy/agorise/graphenej/Transaction.java index 9c8ca5b..68fd11c 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Transaction.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Transaction.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.common.primitives.Bytes; import com.google.gson.GsonBuilder; @@ -24,10 +24,10 @@ import java.util.Date; import java.util.List; import java.util.TimeZone; -import de.bitsharesmunich.graphenej.interfaces.ByteSerializable; -import de.bitsharesmunich.graphenej.interfaces.JsonSerializable; -import de.bitsharesmunich.graphenej.operations.LimitOrderCreateOperation; -import de.bitsharesmunich.graphenej.operations.TransferOperation; +import cy.agorise.graphenej.interfaces.ByteSerializable; +import cy.agorise.graphenej.interfaces.JsonSerializable; +import cy.agorise.graphenej.operations.LimitOrderCreateOperation; +import cy.agorise.graphenej.operations.TransferOperation; /** * Class used to represent a generic Graphene transaction. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/UserAccount.java b/graphenej/src/main/java/cy/agorise/graphenej/UserAccount.java similarity index 98% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/UserAccount.java rename to graphenej/src/main/java/cy/agorise/graphenej/UserAccount.java index 4ad4b12..dee9197 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/UserAccount.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/UserAccount.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -19,8 +19,8 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -import de.bitsharesmunich.graphenej.interfaces.ByteSerializable; -import de.bitsharesmunich.graphenej.interfaces.JsonSerializable; +import cy.agorise.graphenej.interfaces.ByteSerializable; +import cy.agorise.graphenej.interfaces.JsonSerializable; /** * Class that represents a graphene user account. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Util.java b/graphenej/src/main/java/cy/agorise/graphenej/Util.java similarity index 99% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/Util.java rename to graphenej/src/main/java/cy/agorise/graphenej/Util.java index 98fd493..848d89f 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Util.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Util.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.common.primitives.Bytes; import org.tukaani.xz.*; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Varint.java b/graphenej/src/main/java/cy/agorise/graphenej/Varint.java similarity index 99% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/Varint.java rename to graphenej/src/main/java/cy/agorise/graphenej/Varint.java index c06e05a..0206fdc 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Varint.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Varint.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import java.io.DataInput; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Vote.java b/graphenej/src/main/java/cy/agorise/graphenej/Vote.java similarity index 87% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/Vote.java rename to graphenej/src/main/java/cy/agorise/graphenej/Vote.java index 7c50a90..cd22b71 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/Vote.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Vote.java @@ -1,6 +1,6 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; -import de.bitsharesmunich.graphenej.interfaces.ByteSerializable; +import cy.agorise.graphenej.interfaces.ByteSerializable; /** * Created by nelson on 12/5/16. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/BaseGrapheneHandler.java b/graphenej/src/main/java/cy/agorise/graphenej/api/BaseGrapheneHandler.java similarity index 90% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/BaseGrapheneHandler.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/BaseGrapheneHandler.java index 80d7e2b..9a203b6 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/BaseGrapheneHandler.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/BaseGrapheneHandler.java @@ -1,14 +1,12 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.neovisionaries.ws.client.WebSocket; import com.neovisionaries.ws.client.WebSocketAdapter; import com.neovisionaries.ws.client.WebSocketException; -import org.w3c.dom.Node; - -import de.bitsharesmunich.graphenej.interfaces.NodeErrorListener; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.BaseResponse; +import cy.agorise.graphenej.interfaces.NodeErrorListener; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.BaseResponse; /** * Base class that should be extended by any implementation of a specific request to the full node. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetAccountBalances.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountBalances.java similarity index 90% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetAccountBalances.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountBalances.java index 41f6287..e8afee3 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetAccountBalances.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountBalances.java @@ -1,16 +1,16 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.neovisionaries.ws.client.WebSocket; import com.neovisionaries.ws.client.WebSocketFrame; -import de.bitsharesmunich.graphenej.Asset; -import de.bitsharesmunich.graphenej.AssetAmount; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.Asset; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.WitnessResponse; import java.io.Serializable; import java.lang.reflect.Type; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetAccountByName.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountByName.java similarity index 89% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetAccountByName.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountByName.java index d11634f..f2f38f0 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetAccountByName.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountByName.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; @@ -11,13 +11,13 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import de.bitsharesmunich.graphenej.AccountOptions; -import de.bitsharesmunich.graphenej.Authority; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.AccountProperties; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.AccountOptions; +import cy.agorise.graphenej.Authority; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.AccountProperties; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.WitnessResponse; /** * Class that implements get_account_by_name request handler. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetAccountHistory.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountHistory.java similarity index 82% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetAccountHistory.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountHistory.java index 061cedc..76549a2 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetAccountHistory.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountHistory.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; /** * Created by nelson on 12/26/16. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetAccounts.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccounts.java similarity index 91% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetAccounts.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/GetAccounts.java index 9350ee5..50f38e7 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetAccounts.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccounts.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; @@ -11,14 +11,14 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import de.bitsharesmunich.graphenej.AccountOptions; -import de.bitsharesmunich.graphenej.Authority; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.AccountProperties; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.AccountOptions; +import cy.agorise.graphenej.Authority; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.AccountProperties; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.WitnessResponse; /** * Class that implements get_accounts request handler. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetAllAssetHolders.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetAllAssetHolders.java similarity index 95% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetAllAssetHolders.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/GetAllAssetHolders.java index 4147bc5..110aefb 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetAllAssetHolders.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetAllAssetHolders.java @@ -1,13 +1,13 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.neovisionaries.ws.client.WebSocket; import com.neovisionaries.ws.client.WebSocketFrame; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.*; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.*; import java.io.Serializable; import java.lang.reflect.Type; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetBlockHeader.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetBlockHeader.java similarity index 92% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetBlockHeader.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/GetBlockHeader.java index cb59103..d373b83 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetBlockHeader.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetBlockHeader.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; @@ -11,12 +11,12 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.models.BlockHeader; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.BlockHeader; +import cy.agorise.graphenej.models.WitnessResponse; /** * Class that implements get_block_header request handler. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetKeyReferences.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetKeyReferences.java similarity index 93% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetKeyReferences.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/GetKeyReferences.java index 576d6a6..aa2266e 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetKeyReferences.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetKeyReferences.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; @@ -11,12 +11,12 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import de.bitsharesmunich.graphenej.Address; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.Address; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.WitnessResponse; /** * Class that implements get_key_references request handler. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetLimitOrders.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetLimitOrders.java similarity index 91% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetLimitOrders.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/GetLimitOrders.java index 3327ff7..ea67512 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetLimitOrders.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetLimitOrders.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; @@ -12,14 +12,14 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import de.bitsharesmunich.graphenej.AssetAmount; -import de.bitsharesmunich.graphenej.LimitOrder; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.LimitOrder; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.WitnessResponse; /** * Class that implements get_limit_orders request handler. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetMarketHistory.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetMarketHistory.java similarity index 95% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetMarketHistory.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/GetMarketHistory.java index 06e2a7f..488486a 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetMarketHistory.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetMarketHistory.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -14,13 +14,13 @@ import java.util.Date; import java.util.List; import java.util.Map; -import de.bitsharesmunich.graphenej.Asset; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.models.BucketObject; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.Asset; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.BucketObject; +import cy.agorise.graphenej.models.WitnessResponse; /** * Class that implements get_market_history request handler. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetObjects.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetObjects.java similarity index 89% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetObjects.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/GetObjects.java index 9c34966..ab65206 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetObjects.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetObjects.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -15,17 +15,17 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import de.bitsharesmunich.graphenej.AccountOptions; -import de.bitsharesmunich.graphenej.Asset; -import de.bitsharesmunich.graphenej.AssetAmount; -import de.bitsharesmunich.graphenej.Authority; -import de.bitsharesmunich.graphenej.GrapheneObject; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.BitAssetData; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.AccountOptions; +import cy.agorise.graphenej.Asset; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.Authority; +import cy.agorise.graphenej.GrapheneObject; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.BitAssetData; +import cy.agorise.graphenej.models.WitnessResponse; /** * diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetRelativeAccountHistory.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetRelativeAccountHistory.java similarity index 93% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetRelativeAccountHistory.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/GetRelativeAccountHistory.java index 32da128..935618f 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetRelativeAccountHistory.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetRelativeAccountHistory.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -12,16 +12,16 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import de.bitsharesmunich.graphenej.AssetAmount; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.models.HistoricalTransfer; -import de.bitsharesmunich.graphenej.models.WitnessResponse; -import de.bitsharesmunich.graphenej.objects.Memo; -import de.bitsharesmunich.graphenej.operations.TransferOperation; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.HistoricalTransfer; +import cy.agorise.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.objects.Memo; +import cy.agorise.graphenej.operations.TransferOperation; /** * Class used to encapsulate the communication sequence used to retrieve the transaction history of diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetRequiredFees.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetRequiredFees.java similarity index 88% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetRequiredFees.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/GetRequiredFees.java index 553c95d..5879a99 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetRequiredFees.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetRequiredFees.java @@ -1,20 +1,19 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; -import de.bitsharesmunich.graphenej.AssetAmount; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.WitnessResponse; import com.neovisionaries.ws.client.WebSocket; -import com.neovisionaries.ws.client.WebSocketAdapter; import com.neovisionaries.ws.client.WebSocketException; import com.neovisionaries.ws.client.WebSocketFrame; -import de.bitsharesmunich.graphenej.Asset; -import de.bitsharesmunich.graphenej.BaseOperation; +import cy.agorise.graphenej.Asset; +import cy.agorise.graphenej.BaseOperation; import java.io.Serializable; import java.lang.reflect.Type; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetTradeHistory.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetTradeHistory.java similarity index 93% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetTradeHistory.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/GetTradeHistory.java index dde5665..327a04d 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/GetTradeHistory.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetTradeHistory.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; @@ -11,11 +11,11 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import de.bitsharesmunich.graphenej.MarketTrade; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.MarketTrade; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.WitnessResponse; /** * Class that implements get_trade_history request handler. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/ListAssets.java b/graphenej/src/main/java/cy/agorise/graphenej/api/ListAssets.java similarity index 95% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/ListAssets.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/ListAssets.java index 28fb6bb..df85ac3 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/ListAssets.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/ListAssets.java @@ -1,14 +1,14 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.neovisionaries.ws.client.WebSocket; import com.neovisionaries.ws.client.WebSocketFrame; -import de.bitsharesmunich.graphenej.Asset; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.Asset; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.WitnessResponse; import java.io.Serializable; import java.lang.reflect.Type; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/LookupAccounts.java b/graphenej/src/main/java/cy/agorise/graphenej/api/LookupAccounts.java similarity index 94% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/LookupAccounts.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/LookupAccounts.java index 97ab2bf..afae255 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/LookupAccounts.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/LookupAccounts.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; @@ -11,11 +11,11 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.WitnessResponse; /** * Class that implements lookup_accounts request handler. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/LookupAssetSymbols.java b/graphenej/src/main/java/cy/agorise/graphenej/api/LookupAssetSymbols.java similarity index 91% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/LookupAssetSymbols.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/LookupAssetSymbols.java index 2a649d0..d60f90c 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/LookupAssetSymbols.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/LookupAssetSymbols.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; @@ -11,11 +11,11 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import de.bitsharesmunich.graphenej.Asset; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.Asset; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.WitnessResponse; /** * Class that implements lookup_asset_symbols request handler. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/SubscriptionMessagesHub.java b/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java similarity index 92% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/SubscriptionMessagesHub.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java index 2be0780..594f3af 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/SubscriptionMessagesHub.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -13,22 +13,21 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import de.bitsharesmunich.graphenej.AssetAmount; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.Transaction; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.errors.RepeatedRequestIdException; -import de.bitsharesmunich.graphenej.interfaces.NodeErrorListener; -import de.bitsharesmunich.graphenej.interfaces.SubscriptionHub; -import de.bitsharesmunich.graphenej.interfaces.SubscriptionListener; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.DynamicGlobalProperties; -import de.bitsharesmunich.graphenej.models.SubscriptionResponse; -import de.bitsharesmunich.graphenej.models.WitnessResponse; -import de.bitsharesmunich.graphenej.objects.Memo; -import de.bitsharesmunich.graphenej.operations.LimitOrderCreateOperation; -import de.bitsharesmunich.graphenej.operations.TransferOperation; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.Transaction; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.errors.RepeatedRequestIdException; +import cy.agorise.graphenej.interfaces.NodeErrorListener; +import cy.agorise.graphenej.interfaces.SubscriptionHub; +import cy.agorise.graphenej.interfaces.SubscriptionListener; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.DynamicGlobalProperties; +import cy.agorise.graphenej.models.SubscriptionResponse; +import cy.agorise.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.objects.Memo; +import cy.agorise.graphenej.operations.LimitOrderCreateOperation; +import cy.agorise.graphenej.operations.TransferOperation; /** * A WebSocket adapter prepared to be used as a basic dispatch hub for subscription messages. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/TransactionBroadcastSequence.java b/graphenej/src/main/java/cy/agorise/graphenej/api/TransactionBroadcastSequence.java similarity index 93% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/TransactionBroadcastSequence.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/TransactionBroadcastSequence.java index 6064df5..0b17939 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/TransactionBroadcastSequence.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/TransactionBroadcastSequence.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -13,16 +13,16 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import de.bitsharesmunich.graphenej.Asset; -import de.bitsharesmunich.graphenej.AssetAmount; -import de.bitsharesmunich.graphenej.BlockData; -import de.bitsharesmunich.graphenej.RPC; -import de.bitsharesmunich.graphenej.Transaction; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.ApiCall; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.models.DynamicGlobalProperties; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.Asset; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.BlockData; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.Transaction; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.DynamicGlobalProperties; +import cy.agorise.graphenej.models.WitnessResponse; /** * Class that will handle the transaction publication procedure. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/android/NodeConnection.java b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NodeConnection.java similarity index 91% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/android/NodeConnection.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/android/NodeConnection.java index 3bd90e8..98a0b79 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/android/NodeConnection.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NodeConnection.java @@ -1,14 +1,14 @@ -package de.bitsharesmunich.graphenej.api.android; +package cy.agorise.graphenej.api.android; import java.util.ArrayList; import java.util.List; -import de.bitsharesmunich.graphenej.api.BaseGrapheneHandler; -import de.bitsharesmunich.graphenej.api.SubscriptionMessagesHub; -import de.bitsharesmunich.graphenej.errors.RepeatedRequestIdException; -import de.bitsharesmunich.graphenej.interfaces.NodeErrorListener; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.BaseResponse; +import cy.agorise.graphenej.api.BaseGrapheneHandler; +import cy.agorise.graphenej.api.SubscriptionMessagesHub; +import cy.agorise.graphenej.errors.RepeatedRequestIdException; +import cy.agorise.graphenej.interfaces.NodeErrorListener; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.BaseResponse; /** * Class used to encapsulate all connections that should be done to a node (with node hop support). diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/android/WebsocketWorkerThread.java b/graphenej/src/main/java/cy/agorise/graphenej/api/android/WebsocketWorkerThread.java similarity index 94% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/api/android/WebsocketWorkerThread.java rename to graphenej/src/main/java/cy/agorise/graphenej/api/android/WebsocketWorkerThread.java index 76db5e0..231b460 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/api/android/WebsocketWorkerThread.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/android/WebsocketWorkerThread.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api.android; +package cy.agorise.graphenej.api.android; import com.neovisionaries.ws.client.WebSocket; import com.neovisionaries.ws.client.WebSocketException; @@ -10,9 +10,9 @@ import java.security.NoSuchAlgorithmException; import javax.net.ssl.SSLContext; -import de.bitsharesmunich.graphenej.interfaces.NodeErrorListener; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.test.NaiveSSLContext; +import cy.agorise.graphenej.interfaces.NodeErrorListener; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.test.NaiveSSLContext; /** * Class used to encapsulate the thread where the WebSocket does the requests. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/brainkeydict.txt b/graphenej/src/main/java/cy/agorise/graphenej/brainkeydict.txt similarity index 100% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/brainkeydict.txt rename to graphenej/src/main/java/cy/agorise/graphenej/brainkeydict.txt diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/crypto/AndroidRandomSource.java b/graphenej/src/main/java/cy/agorise/graphenej/crypto/AndroidRandomSource.java similarity index 98% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/crypto/AndroidRandomSource.java rename to graphenej/src/main/java/cy/agorise/graphenej/crypto/AndroidRandomSource.java index 0e3863b..d98486b 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/crypto/AndroidRandomSource.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/crypto/AndroidRandomSource.java @@ -32,7 +32,7 @@ * fitness for a particular purpose and non-infringement. */ -package de.bitsharesmunich.graphenej.crypto; +package cy.agorise.graphenej.crypto; import java.io.DataInputStream; import java.io.File; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/crypto/EntropySource.java b/graphenej/src/main/java/cy/agorise/graphenej/crypto/EntropySource.java similarity index 92% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/crypto/EntropySource.java rename to graphenej/src/main/java/cy/agorise/graphenej/crypto/EntropySource.java index 6c07b43..04d4d18 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/crypto/EntropySource.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/crypto/EntropySource.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.crypto; +package cy.agorise.graphenej.crypto; import java.nio.ByteBuffer; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/crypto/RandomSource.java b/graphenej/src/main/java/cy/agorise/graphenej/crypto/RandomSource.java similarity index 94% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/crypto/RandomSource.java rename to graphenej/src/main/java/cy/agorise/graphenej/crypto/RandomSource.java index aaf4940..117714d 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/crypto/RandomSource.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/crypto/RandomSource.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package de.bitsharesmunich.graphenej.crypto; +package cy.agorise.graphenej.crypto; public interface RandomSource { /** diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/crypto/SecureRandomGenerator.java b/graphenej/src/main/java/cy/agorise/graphenej/crypto/SecureRandomGenerator.java similarity index 90% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/crypto/SecureRandomGenerator.java rename to graphenej/src/main/java/cy/agorise/graphenej/crypto/SecureRandomGenerator.java index 5c7a3fa..6cbb960 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/crypto/SecureRandomGenerator.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/crypto/SecureRandomGenerator.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.crypto; +package cy.agorise.graphenej.crypto; import java.security.SecureRandom; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/crypto/SecureRandomStrengthener.java b/graphenej/src/main/java/cy/agorise/graphenej/crypto/SecureRandomStrengthener.java similarity index 99% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/crypto/SecureRandomStrengthener.java rename to graphenej/src/main/java/cy/agorise/graphenej/crypto/SecureRandomStrengthener.java index 093cffd..e35d2ff 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/crypto/SecureRandomStrengthener.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/crypto/SecureRandomStrengthener.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.crypto; +package cy.agorise.graphenej.crypto; import java.nio.ByteBuffer; import java.security.DigestException; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/ChecksumException.java b/graphenej/src/main/java/cy/agorise/graphenej/errors/ChecksumException.java similarity index 79% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/ChecksumException.java rename to graphenej/src/main/java/cy/agorise/graphenej/errors/ChecksumException.java index 394002b..84805d3 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/ChecksumException.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/errors/ChecksumException.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.errors; +package cy.agorise.graphenej.errors; /** * Created by nelson on 12/20/16. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/IncompatibleOperation.java b/graphenej/src/main/java/cy/agorise/graphenej/errors/IncompatibleOperation.java similarity index 80% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/IncompatibleOperation.java rename to graphenej/src/main/java/cy/agorise/graphenej/errors/IncompatibleOperation.java index 5f80ece..410c79a 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/IncompatibleOperation.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/errors/IncompatibleOperation.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.errors; +package cy.agorise.graphenej.errors; /** * Created by nelson on 1/18/17. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/IncompleteAssetError.java b/graphenej/src/main/java/cy/agorise/graphenej/errors/IncompleteAssetError.java similarity index 89% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/IncompleteAssetError.java rename to graphenej/src/main/java/cy/agorise/graphenej/errors/IncompleteAssetError.java index 9b5ee2a..1bbee6a 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/IncompleteAssetError.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/errors/IncompleteAssetError.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.errors; +package cy.agorise.graphenej.errors; /** * Created by nelson on 12/25/16. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/MalformedAddressException.java b/graphenej/src/main/java/cy/agorise/graphenej/errors/MalformedAddressException.java similarity index 80% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/MalformedAddressException.java rename to graphenej/src/main/java/cy/agorise/graphenej/errors/MalformedAddressException.java index 8348d3e..91c25b8 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/MalformedAddressException.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/errors/MalformedAddressException.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.errors; +package cy.agorise.graphenej.errors; /** * Created by nelson on 12/1/16. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/MalformedOperationException.java b/graphenej/src/main/java/cy/agorise/graphenej/errors/MalformedOperationException.java similarity index 80% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/MalformedOperationException.java rename to graphenej/src/main/java/cy/agorise/graphenej/errors/MalformedOperationException.java index 223f17c..f6b95b4 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/MalformedOperationException.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/errors/MalformedOperationException.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.errors; +package cy.agorise.graphenej.errors; /** * Created by nelson on 3/1/17. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/MalformedTransactionException.java b/graphenej/src/main/java/cy/agorise/graphenej/errors/MalformedTransactionException.java similarity index 81% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/MalformedTransactionException.java rename to graphenej/src/main/java/cy/agorise/graphenej/errors/MalformedTransactionException.java index 34e303e..22b1d39 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/MalformedTransactionException.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/errors/MalformedTransactionException.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.errors; +package cy.agorise.graphenej.errors; /** * Created by nelson on 11/14/16. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/RepeatedRequestIdException.java b/graphenej/src/main/java/cy/agorise/graphenej/errors/RepeatedRequestIdException.java similarity index 80% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/RepeatedRequestIdException.java rename to graphenej/src/main/java/cy/agorise/graphenej/errors/RepeatedRequestIdException.java index 74c19e3..587095c 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/errors/RepeatedRequestIdException.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/errors/RepeatedRequestIdException.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.errors; +package cy.agorise.graphenej.errors; /** * Created by nelson on 6/27/17. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/ByteSerializable.java b/graphenej/src/main/java/cy/agorise/graphenej/interfaces/ByteSerializable.java similarity index 77% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/ByteSerializable.java rename to graphenej/src/main/java/cy/agorise/graphenej/interfaces/ByteSerializable.java index b60c6c1..7043f20 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/ByteSerializable.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/interfaces/ByteSerializable.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.interfaces; +package cy.agorise.graphenej.interfaces; /** * Interface implemented by all entities for which makes sense to have a byte-array representation. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/GrapheneSerializable.java b/graphenej/src/main/java/cy/agorise/graphenej/interfaces/GrapheneSerializable.java similarity index 78% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/GrapheneSerializable.java rename to graphenej/src/main/java/cy/agorise/graphenej/interfaces/GrapheneSerializable.java index 93eb781..f7e6d20 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/GrapheneSerializable.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/interfaces/GrapheneSerializable.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.interfaces; +package cy.agorise.graphenej.interfaces; /** * Interface used to group both ByteSerializable and JsonSerializable interfaces. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/JsonSerializable.java b/graphenej/src/main/java/cy/agorise/graphenej/interfaces/JsonSerializable.java similarity index 86% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/JsonSerializable.java rename to graphenej/src/main/java/cy/agorise/graphenej/interfaces/JsonSerializable.java index 5e64e4d..bb52407 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/JsonSerializable.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/interfaces/JsonSerializable.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.interfaces; +package cy.agorise.graphenej.interfaces; import com.google.gson.JsonElement; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/NodeErrorListener.java b/graphenej/src/main/java/cy/agorise/graphenej/interfaces/NodeErrorListener.java similarity index 60% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/NodeErrorListener.java rename to graphenej/src/main/java/cy/agorise/graphenej/interfaces/NodeErrorListener.java index f0386b7..f1afe60 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/NodeErrorListener.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/interfaces/NodeErrorListener.java @@ -1,6 +1,6 @@ -package de.bitsharesmunich.graphenej.interfaces; +package cy.agorise.graphenej.interfaces; -import de.bitsharesmunich.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.BaseResponse; /** * Interface to be implemented by any listener to network errors. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/SubscriptionHub.java b/graphenej/src/main/java/cy/agorise/graphenej/interfaces/SubscriptionHub.java similarity index 94% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/SubscriptionHub.java rename to graphenej/src/main/java/cy/agorise/graphenej/interfaces/SubscriptionHub.java index bca0df0..22c634f 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/SubscriptionHub.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/interfaces/SubscriptionHub.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.interfaces; +package cy.agorise.graphenej.interfaces; import java.util.List; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/SubscriptionListener.java b/graphenej/src/main/java/cy/agorise/graphenej/interfaces/SubscriptionListener.java similarity index 85% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/SubscriptionListener.java rename to graphenej/src/main/java/cy/agorise/graphenej/interfaces/SubscriptionListener.java index 9081991..3bd3f76 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/SubscriptionListener.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/interfaces/SubscriptionListener.java @@ -1,7 +1,7 @@ -package de.bitsharesmunich.graphenej.interfaces; +package cy.agorise.graphenej.interfaces; -import de.bitsharesmunich.graphenej.ObjectType; -import de.bitsharesmunich.graphenej.models.SubscriptionResponse; +import cy.agorise.graphenej.ObjectType; +import cy.agorise.graphenej.models.SubscriptionResponse; /** * Generic interface that must be implemented by any class that wants to be informed about a specific diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/WitnessResponseListener.java b/graphenej/src/main/java/cy/agorise/graphenej/interfaces/WitnessResponseListener.java similarity index 55% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/WitnessResponseListener.java rename to graphenej/src/main/java/cy/agorise/graphenej/interfaces/WitnessResponseListener.java index 0a25d0a..28f1eca 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/interfaces/WitnessResponseListener.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/interfaces/WitnessResponseListener.java @@ -1,7 +1,7 @@ -package de.bitsharesmunich.graphenej.interfaces; +package cy.agorise.graphenej.interfaces; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.WitnessResponse; /** * Class used to represent any listener to network requests. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/AccountBalanceUpdate.java b/graphenej/src/main/java/cy/agorise/graphenej/models/AccountBalanceUpdate.java similarity index 83% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/AccountBalanceUpdate.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/AccountBalanceUpdate.java index 739287b..d155ea7 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/AccountBalanceUpdate.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/AccountBalanceUpdate.java @@ -1,8 +1,8 @@ -package de.bitsharesmunich.graphenej.models; +package cy.agorise.graphenej.models; import java.io.Serializable; -import de.bitsharesmunich.graphenej.GrapheneObject; +import cy.agorise.graphenej.GrapheneObject; /** * Created by nelson on 1/12/17. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/AccountProperties.java b/graphenej/src/main/java/cy/agorise/graphenej/models/AccountProperties.java similarity index 85% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/AccountProperties.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/AccountProperties.java index 44946f0..1a4a84f 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/AccountProperties.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/AccountProperties.java @@ -1,7 +1,7 @@ -package de.bitsharesmunich.graphenej.models; +package cy.agorise.graphenej.models; -import de.bitsharesmunich.graphenej.AccountOptions; -import de.bitsharesmunich.graphenej.Authority; +import cy.agorise.graphenej.AccountOptions; +import cy.agorise.graphenej.Authority; /** * Created by nelson on 11/15/16. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/ApiCall.java b/graphenej/src/main/java/cy/agorise/graphenej/models/ApiCall.java similarity index 97% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/ApiCall.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/ApiCall.java index 2fbaa55..d6be686 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/ApiCall.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/ApiCall.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.models; +package cy.agorise.graphenej.models; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; @@ -6,7 +6,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -import de.bitsharesmunich.graphenej.interfaces.JsonSerializable; +import cy.agorise.graphenej.interfaces.JsonSerializable; import java.io.Serializable; import java.lang.reflect.Type; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/AssetFeed.java b/graphenej/src/main/java/cy/agorise/graphenej/models/AssetFeed.java similarity index 72% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/AssetFeed.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/AssetFeed.java index df7d686..66eef84 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/AssetFeed.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/AssetFeed.java @@ -1,6 +1,6 @@ -package de.bitsharesmunich.graphenej.models; +package cy.agorise.graphenej.models; -import de.bitsharesmunich.graphenej.Price; +import cy.agorise.graphenej.Price; /** * Created by nelson on 1/9/17. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/AssetHolderCount.java b/graphenej/src/main/java/cy/agorise/graphenej/models/AssetHolderCount.java similarity index 90% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/AssetHolderCount.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/AssetHolderCount.java index 9de3ddc..6885415 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/AssetHolderCount.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/AssetHolderCount.java @@ -1,7 +1,7 @@ -package de.bitsharesmunich.graphenej.models; +package cy.agorise.graphenej.models; import com.google.gson.*; -import de.bitsharesmunich.graphenej.Asset; +import cy.agorise.graphenej.Asset; import java.lang.reflect.Type; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/BaseResponse.java b/graphenej/src/main/java/cy/agorise/graphenej/models/BaseResponse.java similarity index 92% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/BaseResponse.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/BaseResponse.java index d4bb18c..50b7622 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/BaseResponse.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/BaseResponse.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.models; +package cy.agorise.graphenej.models; /** * Created by nelson on 11/12/16. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/BitAssetData.java b/graphenej/src/main/java/cy/agorise/graphenej/models/BitAssetData.java similarity index 80% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/BitAssetData.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/BitAssetData.java index 5625a03..1d27222 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/BitAssetData.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/BitAssetData.java @@ -1,7 +1,7 @@ -package de.bitsharesmunich.graphenej.models; +package cy.agorise.graphenej.models; -import de.bitsharesmunich.graphenej.GrapheneObject; -import de.bitsharesmunich.graphenej.Price; +import cy.agorise.graphenej.GrapheneObject; +import cy.agorise.graphenej.Price; /** * This is the representation of the response from the 'get_objects' call with diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/BlockHeader.java b/graphenej/src/main/java/cy/agorise/graphenej/models/BlockHeader.java similarity index 83% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/BlockHeader.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/BlockHeader.java index 4dc5e4f..9ebdef7 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/BlockHeader.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/BlockHeader.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.models; +package cy.agorise.graphenej.models; /** * Created by nelson on 12/13/16. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/BroadcastedTransaction.java b/graphenej/src/main/java/cy/agorise/graphenej/models/BroadcastedTransaction.java similarity index 66% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/BroadcastedTransaction.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/BroadcastedTransaction.java index ee53101..90baa58 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/BroadcastedTransaction.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/BroadcastedTransaction.java @@ -1,14 +1,9 @@ -package de.bitsharesmunich.graphenej.models; +package cy.agorise.graphenej.models; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import de.bitsharesmunich.graphenej.GrapheneObject; -import de.bitsharesmunich.graphenej.Transaction; +import cy.agorise.graphenej.GrapheneObject; +import cy.agorise.graphenej.Transaction; import java.io.Serializable; -import java.lang.reflect.Type; /** * Created by nelson on 1/28/17. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/BucketObject.java b/graphenej/src/main/java/cy/agorise/graphenej/models/BucketObject.java similarity index 97% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/BucketObject.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/BucketObject.java index 96d3ecc..816befd 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/BucketObject.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/BucketObject.java @@ -1,7 +1,7 @@ -package de.bitsharesmunich.graphenej.models; +package cy.agorise.graphenej.models; import com.google.gson.*; -import de.bitsharesmunich.graphenej.Asset; +import cy.agorise.graphenej.Asset; import java.lang.reflect.Type; import java.math.BigDecimal; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/DynamicGlobalProperties.java b/graphenej/src/main/java/cy/agorise/graphenej/models/DynamicGlobalProperties.java similarity index 97% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/DynamicGlobalProperties.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/DynamicGlobalProperties.java index e27cbc0..8c925e2 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/DynamicGlobalProperties.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/DynamicGlobalProperties.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.models; +package cy.agorise.graphenej.models; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; @@ -13,8 +13,8 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; -import de.bitsharesmunich.graphenej.GrapheneObject; -import de.bitsharesmunich.graphenej.Util; +import cy.agorise.graphenej.GrapheneObject; +import cy.agorise.graphenej.Util; /** * Class used to deserialize the 'result' field returned by the full node after making a call diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/HistoricalTransfer.java b/graphenej/src/main/java/cy/agorise/graphenej/models/HistoricalTransfer.java similarity index 92% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/HistoricalTransfer.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/HistoricalTransfer.java index 44d09c0..d14e5b8 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/HistoricalTransfer.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/HistoricalTransfer.java @@ -1,6 +1,6 @@ -package de.bitsharesmunich.graphenej.models; +package cy.agorise.graphenej.models; -import de.bitsharesmunich.graphenej.operations.TransferOperation; +import cy.agorise.graphenej.operations.TransferOperation; /** diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/SubscriptionResponse.java b/graphenej/src/main/java/cy/agorise/graphenej/models/SubscriptionResponse.java similarity index 97% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/SubscriptionResponse.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/SubscriptionResponse.java index 3cb5f78..2b2f6d0 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/SubscriptionResponse.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/SubscriptionResponse.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.models; +package cy.agorise.graphenej.models; import com.google.gson.JsonArray; import com.google.gson.JsonDeserializationContext; @@ -14,10 +14,10 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; -import de.bitsharesmunich.graphenej.GrapheneObject; -import de.bitsharesmunich.graphenej.ObjectType; -import de.bitsharesmunich.graphenej.Transaction; -import de.bitsharesmunich.graphenej.interfaces.SubscriptionListener; +import cy.agorise.graphenej.GrapheneObject; +import cy.agorise.graphenej.ObjectType; +import cy.agorise.graphenej.Transaction; +import cy.agorise.graphenej.interfaces.SubscriptionListener; /** * Class that represents a generic subscription response. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/WitnessResponse.java b/graphenej/src/main/java/cy/agorise/graphenej/models/WitnessResponse.java similarity index 82% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/WitnessResponse.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/WitnessResponse.java index 0f7dc78..2cabae9 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/WitnessResponse.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/WitnessResponse.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.models; +package cy.agorise.graphenej.models; /** * Generic witness response diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/backup/LinkedAccount.java b/graphenej/src/main/java/cy/agorise/graphenej/models/backup/LinkedAccount.java similarity index 92% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/backup/LinkedAccount.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/backup/LinkedAccount.java index ff29243..5bdc52e 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/backup/LinkedAccount.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/backup/LinkedAccount.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.models.backup; +package cy.agorise.graphenej.models.backup; /** * Class used to represent an entry in the "linked_accounts" field of the JSON-formatted backup file. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/backup/PrivateKeyBackup.java b/graphenej/src/main/java/cy/agorise/graphenej/models/backup/PrivateKeyBackup.java similarity index 88% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/backup/PrivateKeyBackup.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/backup/PrivateKeyBackup.java index 68d2f8b..aa77745 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/backup/PrivateKeyBackup.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/backup/PrivateKeyBackup.java @@ -1,7 +1,7 @@ -package de.bitsharesmunich.graphenej.models.backup; +package cy.agorise.graphenej.models.backup; -import de.bitsharesmunich.graphenej.Address; -import de.bitsharesmunich.graphenej.Util; +import cy.agorise.graphenej.Address; +import cy.agorise.graphenej.Util; import org.bitcoinj.core.ECKey; /** diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/backup/Wallet.java b/graphenej/src/main/java/cy/agorise/graphenej/models/backup/Wallet.java similarity index 95% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/backup/Wallet.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/backup/Wallet.java index d4c5218..bfc61dd 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/backup/Wallet.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/backup/Wallet.java @@ -1,11 +1,10 @@ -package de.bitsharesmunich.graphenej.models.backup; +package cy.agorise.graphenej.models.backup; -import de.bitsharesmunich.graphenej.Address; -import de.bitsharesmunich.graphenej.Util; -import de.bitsharesmunich.graphenej.crypto.SecureRandomGenerator; +import cy.agorise.graphenej.Address; +import cy.agorise.graphenej.Util; +import cy.agorise.graphenej.crypto.SecureRandomGenerator; import org.bitcoinj.core.ECKey; import org.bitcoinj.core.Sha256Hash; -import org.spongycastle.crypto.digests.SHA256Digest; import java.io.UnsupportedEncodingException; import java.security.SecureRandom; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/backup/WalletBackup.java b/graphenej/src/main/java/cy/agorise/graphenej/models/backup/WalletBackup.java similarity index 96% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/models/backup/WalletBackup.java rename to graphenej/src/main/java/cy/agorise/graphenej/models/backup/WalletBackup.java index 536c261..bac160f 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/models/backup/WalletBackup.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/backup/WalletBackup.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.models.backup; +package cy.agorise.graphenej.models.backup; import java.util.List; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/objects/Memo.java b/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java similarity index 95% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/objects/Memo.java rename to graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java index a618ba2..353640e 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/objects/Memo.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.objects; +package cy.agorise.graphenej.objects; import com.google.common.primitives.Bytes; import com.google.gson.JsonDeserializationContext; @@ -7,14 +7,13 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; -import de.bitsharesmunich.graphenej.Address; -import de.bitsharesmunich.graphenej.PublicKey; -import de.bitsharesmunich.graphenej.Util; -import de.bitsharesmunich.graphenej.errors.ChecksumException; -import de.bitsharesmunich.graphenej.errors.MalformedAddressException; -import de.bitsharesmunich.graphenej.interfaces.ByteSerializable; -import de.bitsharesmunich.graphenej.interfaces.JsonSerializable; -import de.bitsharesmunich.graphenej.operations.TransferOperation; +import cy.agorise.graphenej.Address; +import cy.agorise.graphenej.PublicKey; +import cy.agorise.graphenej.Util; +import cy.agorise.graphenej.errors.ChecksumException; +import cy.agorise.graphenej.errors.MalformedAddressException; +import cy.agorise.graphenej.interfaces.ByteSerializable; +import cy.agorise.graphenej.interfaces.JsonSerializable; import org.bitcoinj.core.ECKey; import org.spongycastle.math.ec.ECPoint; diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/AccountUpdateOperation.java b/graphenej/src/main/java/cy/agorise/graphenej/operations/AccountUpdateOperation.java similarity index 97% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/AccountUpdateOperation.java rename to graphenej/src/main/java/cy/agorise/graphenej/operations/AccountUpdateOperation.java index 66a7310..b596ccf 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/AccountUpdateOperation.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/operations/AccountUpdateOperation.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.operations; +package cy.agorise.graphenej.operations; import com.google.common.primitives.Bytes; import com.google.common.primitives.UnsignedLong; @@ -6,7 +6,7 @@ import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import de.bitsharesmunich.graphenej.*; +import cy.agorise.graphenej.*; /** * Class used to encapsulate operations related to the ACCOUNT_UPDATE_OPERATION. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/AccountUpdateOperationBuilder.java b/graphenej/src/main/java/cy/agorise/graphenej/operations/AccountUpdateOperationBuilder.java similarity index 91% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/AccountUpdateOperationBuilder.java rename to graphenej/src/main/java/cy/agorise/graphenej/operations/AccountUpdateOperationBuilder.java index f7a088a..f0904e6 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/AccountUpdateOperationBuilder.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/operations/AccountUpdateOperationBuilder.java @@ -1,7 +1,7 @@ -package de.bitsharesmunich.graphenej.operations; +package cy.agorise.graphenej.operations; -import de.bitsharesmunich.graphenej.*; -import de.bitsharesmunich.graphenej.errors.MalformedOperationException; +import cy.agorise.graphenej.*; +import cy.agorise.graphenej.errors.MalformedOperationException; /** * Created by nelson on 3/1/17. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/BaseOperationBuilder.java b/graphenej/src/main/java/cy/agorise/graphenej/operations/BaseOperationBuilder.java similarity index 77% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/BaseOperationBuilder.java rename to graphenej/src/main/java/cy/agorise/graphenej/operations/BaseOperationBuilder.java index 82eed94..d2cd322 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/BaseOperationBuilder.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/operations/BaseOperationBuilder.java @@ -1,6 +1,6 @@ -package de.bitsharesmunich.graphenej.operations; +package cy.agorise.graphenej.operations; -import de.bitsharesmunich.graphenej.BaseOperation; +import cy.agorise.graphenej.BaseOperation; /** * Base template for all operation-specific factory classes. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/LimitOrderCancelOperation.java b/graphenej/src/main/java/cy/agorise/graphenej/operations/LimitOrderCancelOperation.java similarity index 95% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/LimitOrderCancelOperation.java rename to graphenej/src/main/java/cy/agorise/graphenej/operations/LimitOrderCancelOperation.java index 0334255..7b5065e 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/LimitOrderCancelOperation.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/operations/LimitOrderCancelOperation.java @@ -1,10 +1,10 @@ -package de.bitsharesmunich.graphenej.operations; +package cy.agorise.graphenej.operations; import com.google.common.primitives.Bytes; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import de.bitsharesmunich.graphenej.*; +import cy.agorise.graphenej.*; /** * Created by nelson on 3/21/17. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/LimitOrderCreateOperation.java b/graphenej/src/main/java/cy/agorise/graphenej/operations/LimitOrderCreateOperation.java similarity index 96% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/LimitOrderCreateOperation.java rename to graphenej/src/main/java/cy/agorise/graphenej/operations/LimitOrderCreateOperation.java index df3a5f7..64b2f9d 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/LimitOrderCreateOperation.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/operations/LimitOrderCreateOperation.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.operations; +package cy.agorise.graphenej.operations; import com.google.common.primitives.Bytes; import com.google.gson.JsonArray; @@ -15,11 +15,11 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; -import de.bitsharesmunich.graphenej.AssetAmount; -import de.bitsharesmunich.graphenej.BaseOperation; -import de.bitsharesmunich.graphenej.OperationType; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.Util; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.BaseOperation; +import cy.agorise.graphenej.OperationType; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.Util; /** * Operation used to denote the creation of a limit order on the blockchain. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/TransferOperation.java b/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperation.java similarity index 95% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/TransferOperation.java rename to graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperation.java index 89d5b14..0988640 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/TransferOperation.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperation.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.operations; +package cy.agorise.graphenej.operations; import com.google.common.primitives.Bytes; import com.google.gson.GsonBuilder; @@ -13,11 +13,11 @@ import com.google.gson.JsonSerializer; import java.lang.reflect.Type; -import de.bitsharesmunich.graphenej.AssetAmount; -import de.bitsharesmunich.graphenej.BaseOperation; -import de.bitsharesmunich.graphenej.OperationType; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.objects.Memo; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.BaseOperation; +import cy.agorise.graphenej.OperationType; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.objects.Memo; /** * Class used to encapsulate the TransferOperation operation related functionalities. diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/TransferOperationBuilder.java b/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperationBuilder.java similarity index 86% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/TransferOperationBuilder.java rename to graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperationBuilder.java index c080734..709589b 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/operations/TransferOperationBuilder.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperationBuilder.java @@ -1,9 +1,9 @@ -package de.bitsharesmunich.graphenej.operations; +package cy.agorise.graphenej.operations; -import de.bitsharesmunich.graphenej.AssetAmount; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.errors.MalformedOperationException; -import de.bitsharesmunich.graphenej.objects.Memo; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.errors.MalformedOperationException; +import cy.agorise.graphenej.objects.Memo; /** * Factory class used to build a transfer operation diff --git a/graphenej/src/main/java/de/bitsharesmunich/graphenej/test/NaiveSSLContext.java b/graphenej/src/main/java/cy/agorise/graphenej/test/NaiveSSLContext.java similarity index 98% rename from graphenej/src/main/java/de/bitsharesmunich/graphenej/test/NaiveSSLContext.java rename to graphenej/src/main/java/cy/agorise/graphenej/test/NaiveSSLContext.java index 8858aba..ac7c9a3 100644 --- a/graphenej/src/main/java/de/bitsharesmunich/graphenej/test/NaiveSSLContext.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/test/NaiveSSLContext.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.test; +package cy.agorise.graphenej.test; /* * Copyright (C) 2015 Neo Visionaries Inc. diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/AssetAmountTest.java b/graphenej/src/test/java/cy/agorise/graphenej/AssetAmountTest.java similarity index 96% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/AssetAmountTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/AssetAmountTest.java index db6fa3f..8589d93 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/AssetAmountTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/AssetAmountTest.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.common.primitives.UnsignedLong; import org.junit.Before; diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/AssetTest.java b/graphenej/src/test/java/cy/agorise/graphenej/AssetTest.java similarity index 85% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/AssetTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/AssetTest.java index 81d01dc..9bc4a15 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/AssetTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/AssetTest.java @@ -1,6 +1,4 @@ -package de.bitsharesmunich.graphenej; - -import org.junit.*; +package cy.agorise.graphenej; import static org.junit.Assert.*; diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/AuthorityTest.java b/graphenej/src/test/java/cy/agorise/graphenej/AuthorityTest.java similarity index 98% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/AuthorityTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/AuthorityTest.java index eb34c17..23109f1 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/AuthorityTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/AuthorityTest.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import org.junit.After; import org.junit.Before; diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/BrainKeyTest.java b/graphenej/src/test/java/cy/agorise/graphenej/BrainKeyTest.java similarity index 95% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/BrainKeyTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/BrainKeyTest.java index a534eb5..c0a1342 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/BrainKeyTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/BrainKeyTest.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import junit.framework.Assert; diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/ObjectTypeTest.java b/graphenej/src/test/java/cy/agorise/graphenej/ObjectTypeTest.java similarity index 96% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/ObjectTypeTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/ObjectTypeTest.java index 915c313..b0ab3f8 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/ObjectTypeTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/ObjectTypeTest.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import junit.framework.Assert; diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/PublicKeyTest.java b/graphenej/src/test/java/cy/agorise/graphenej/PublicKeyTest.java similarity index 93% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/PublicKeyTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/PublicKeyTest.java index fe6307a..756b776 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/PublicKeyTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/PublicKeyTest.java @@ -1,6 +1,5 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; -import org.bitcoinj.core.*; import org.junit.*; import static org.junit.Assert.*; diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/TransactionTest.java b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java similarity index 96% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/TransactionTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java index f82cd2b..bf4ded1 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/TransactionTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java @@ -1,17 +1,17 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.google.common.primitives.UnsignedLong; import com.neovisionaries.ws.client.WebSocket; import com.neovisionaries.ws.client.WebSocketException; import com.neovisionaries.ws.client.WebSocketFactory; -import de.bitsharesmunich.graphenej.api.GetLimitOrders; -import de.bitsharesmunich.graphenej.api.TransactionBroadcastSequence; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.models.WitnessResponse; -import de.bitsharesmunich.graphenej.objects.Memo; -import de.bitsharesmunich.graphenej.operations.*; -import de.bitsharesmunich.graphenej.test.NaiveSSLContext; +import cy.agorise.graphenej.api.GetLimitOrders; +import cy.agorise.graphenej.api.TransactionBroadcastSequence; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.objects.Memo; +import cy.agorise.graphenej.operations.*; +import cy.agorise.graphenej.test.NaiveSSLContext; import org.bitcoinj.core.ECKey; import org.junit.Assert; import org.junit.Before; @@ -21,7 +21,6 @@ import javax.net.ssl.SSLContext; import java.io.IOException; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; -import java.util.Date; import java.util.List; /** diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/UserAccountTest.java b/graphenej/src/test/java/cy/agorise/graphenej/UserAccountTest.java similarity index 84% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/UserAccountTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/UserAccountTest.java index 644c6f6..69e15c0 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/UserAccountTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/UserAccountTest.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej; +package cy.agorise.graphenej; import com.neovisionaries.ws.client.WebSocketException; @@ -7,11 +7,11 @@ import org.junit.Test; import java.util.ArrayList; import java.util.List; -import de.bitsharesmunich.graphenej.api.BaseApiTest; -import de.bitsharesmunich.graphenej.api.GetObjects; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.api.BaseApiTest; +import cy.agorise.graphenej.api.GetObjects; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.WitnessResponse; /** * Created by nelson on 5/20/17. diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/api/BaseApiTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/BaseApiTest.java similarity index 87% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/api/BaseApiTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/api/BaseApiTest.java index 0a2f24f..d2ec0fc 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/api/BaseApiTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/BaseApiTest.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.neovisionaries.ws.client.WebSocket; import com.neovisionaries.ws.client.WebSocketFactory; @@ -7,7 +7,7 @@ import org.junit.Before; import javax.net.ssl.SSLContext; -import de.bitsharesmunich.graphenej.test.NaiveSSLContext; +import cy.agorise.graphenej.test.NaiveSSLContext; /** * Created by nelson on 4/14/17. diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/api/GetKeyReferencesTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/GetKeyReferencesTest.java similarity index 87% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/api/GetKeyReferencesTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/api/GetKeyReferencesTest.java index c774973..5be267d 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/api/GetKeyReferencesTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/GetKeyReferencesTest.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.neovisionaries.ws.client.WebSocketException; @@ -7,12 +7,12 @@ import org.junit.Test; import java.util.ArrayList; import java.util.List; -import de.bitsharesmunich.graphenej.Address; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.errors.MalformedAddressException; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.Address; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.errors.MalformedAddressException; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.WitnessResponse; /** * Created by nelson on 4/14/17. diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/api/GetLimitOrdersTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/GetLimitOrdersTest.java similarity index 90% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/api/GetLimitOrdersTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/api/GetLimitOrdersTest.java index 74b9764..524d4c7 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/api/GetLimitOrdersTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/GetLimitOrdersTest.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.google.common.primitives.UnsignedLong; import com.neovisionaries.ws.client.WebSocketException; @@ -9,16 +9,16 @@ import org.junit.Test; import java.util.List; -import de.bitsharesmunich.graphenej.Asset; -import de.bitsharesmunich.graphenej.AssetAmount; -import de.bitsharesmunich.graphenej.Converter; -import de.bitsharesmunich.graphenej.LimitOrder; -import de.bitsharesmunich.graphenej.OrderBook; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.models.WitnessResponse; -import de.bitsharesmunich.graphenej.operations.LimitOrderCreateOperation; +import cy.agorise.graphenej.Asset; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.Converter; +import cy.agorise.graphenej.LimitOrder; +import cy.agorise.graphenej.OrderBook; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.operations.LimitOrderCreateOperation; import static org.hamcrest.CoreMatchers.is; diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/api/GetObjectsTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/GetObjectsTest.java similarity index 92% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/api/GetObjectsTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/api/GetObjectsTest.java index 2e36a17..5b76e68 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/api/GetObjectsTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/GetObjectsTest.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.neovisionaries.ws.client.WebSocketException; @@ -9,13 +9,13 @@ import org.junit.Test; import java.util.ArrayList; import java.util.List; -import de.bitsharesmunich.graphenej.Asset; -import de.bitsharesmunich.graphenej.GrapheneObject; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.models.BitAssetData; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.Asset; +import cy.agorise.graphenej.GrapheneObject; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.BitAssetData; +import cy.agorise.graphenej.models.WitnessResponse; /** * Testing the {@link GetObjects} API wrapper and its deserialization diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/api/GetRelativeAccountHistoryTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/GetRelativeAccountHistoryTest.java similarity index 85% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/api/GetRelativeAccountHistoryTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/api/GetRelativeAccountHistoryTest.java index c3ab49e..220a523 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/api/GetRelativeAccountHistoryTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/GetRelativeAccountHistoryTest.java @@ -1,16 +1,16 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.neovisionaries.ws.client.WebSocketException; import org.junit.Test; import java.util.List; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.models.HistoricalTransfer; -import de.bitsharesmunich.graphenej.models.WitnessResponse; -import de.bitsharesmunich.graphenej.operations.TransferOperation; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.HistoricalTransfer; +import cy.agorise.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.operations.TransferOperation; /** * Created by nelson on 9/25/17. diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/api/SubscriptionMessagesHubTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/SubscriptionMessagesHubTest.java similarity index 92% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/api/SubscriptionMessagesHubTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/api/SubscriptionMessagesHubTest.java index 9d4e4b5..f0f3e29 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/api/SubscriptionMessagesHubTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/SubscriptionMessagesHubTest.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api; +package cy.agorise.graphenej.api; import com.neovisionaries.ws.client.WebSocketException; @@ -9,16 +9,14 @@ import java.util.List; import java.util.Timer; import java.util.TimerTask; -import de.bitsharesmunich.graphenej.ObjectType; -import de.bitsharesmunich.graphenej.Transaction; -import de.bitsharesmunich.graphenej.interfaces.NodeErrorListener; -import de.bitsharesmunich.graphenej.interfaces.SubscriptionListener; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.models.BroadcastedTransaction; -import de.bitsharesmunich.graphenej.models.DynamicGlobalProperties; -import de.bitsharesmunich.graphenej.models.SubscriptionResponse; -import de.bitsharesmunich.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.ObjectType; +import cy.agorise.graphenej.Transaction; +import cy.agorise.graphenej.interfaces.NodeErrorListener; +import cy.agorise.graphenej.interfaces.SubscriptionListener; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.BroadcastedTransaction; +import cy.agorise.graphenej.models.DynamicGlobalProperties; +import cy.agorise.graphenej.models.SubscriptionResponse; /** * Class used to encapsulate all tests that relate to the {@see SubscriptionMessagesHub} class. diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/api/android/NodeConnectionTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java similarity index 95% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/api/android/NodeConnectionTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java index 226c92d..a691a19 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/api/android/NodeConnectionTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.api.android; +package cy.agorise.graphenej.api.android; import com.google.common.primitives.UnsignedLong; import com.neovisionaries.ws.client.WebSocket; @@ -17,37 +17,37 @@ import java.util.TimerTask; import javax.net.ssl.SSLContext; -import de.bitsharesmunich.graphenej.Address; -import de.bitsharesmunich.graphenej.Asset; -import de.bitsharesmunich.graphenej.AssetAmount; -import de.bitsharesmunich.graphenej.BaseOperation; -import de.bitsharesmunich.graphenej.BrainKey; -import de.bitsharesmunich.graphenej.Transaction; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.api.GetAccountBalances; -import de.bitsharesmunich.graphenej.api.GetAccountByName; -import de.bitsharesmunich.graphenej.api.GetAccounts; -import de.bitsharesmunich.graphenej.api.GetAllAssetHolders; -import de.bitsharesmunich.graphenej.api.GetBlockHeader; -import de.bitsharesmunich.graphenej.api.GetKeyReferences; -import de.bitsharesmunich.graphenej.api.GetLimitOrders; -import de.bitsharesmunich.graphenej.api.GetMarketHistory; -import de.bitsharesmunich.graphenej.api.GetObjects; -import de.bitsharesmunich.graphenej.api.GetRelativeAccountHistory; -import de.bitsharesmunich.graphenej.api.GetRequiredFees; -import de.bitsharesmunich.graphenej.api.GetTradeHistory; -import de.bitsharesmunich.graphenej.api.ListAssets; -import de.bitsharesmunich.graphenej.api.LookupAccounts; -import de.bitsharesmunich.graphenej.api.LookupAssetSymbols; -import de.bitsharesmunich.graphenej.api.TransactionBroadcastSequence; -import de.bitsharesmunich.graphenej.errors.MalformedAddressException; -import de.bitsharesmunich.graphenej.errors.RepeatedRequestIdException; -import de.bitsharesmunich.graphenej.interfaces.WitnessResponseListener; -import de.bitsharesmunich.graphenej.models.BaseResponse; -import de.bitsharesmunich.graphenej.models.WitnessResponse; -import de.bitsharesmunich.graphenej.operations.TransferOperation; -import de.bitsharesmunich.graphenej.operations.TransferOperationBuilder; -import de.bitsharesmunich.graphenej.test.NaiveSSLContext; +import cy.agorise.graphenej.Address; +import cy.agorise.graphenej.Asset; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.BaseOperation; +import cy.agorise.graphenej.BrainKey; +import cy.agorise.graphenej.Transaction; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.api.GetAccountBalances; +import cy.agorise.graphenej.api.GetAccountByName; +import cy.agorise.graphenej.api.GetAccounts; +import cy.agorise.graphenej.api.GetAllAssetHolders; +import cy.agorise.graphenej.api.GetBlockHeader; +import cy.agorise.graphenej.api.GetKeyReferences; +import cy.agorise.graphenej.api.GetLimitOrders; +import cy.agorise.graphenej.api.GetMarketHistory; +import cy.agorise.graphenej.api.GetObjects; +import cy.agorise.graphenej.api.GetRelativeAccountHistory; +import cy.agorise.graphenej.api.GetRequiredFees; +import cy.agorise.graphenej.api.GetTradeHistory; +import cy.agorise.graphenej.api.ListAssets; +import cy.agorise.graphenej.api.LookupAccounts; +import cy.agorise.graphenej.api.LookupAssetSymbols; +import cy.agorise.graphenej.api.TransactionBroadcastSequence; +import cy.agorise.graphenej.errors.MalformedAddressException; +import cy.agorise.graphenej.errors.RepeatedRequestIdException; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.operations.TransferOperation; +import cy.agorise.graphenej.operations.TransferOperationBuilder; +import cy.agorise.graphenej.test.NaiveSSLContext; /** * Created by nelson on 6/26/17. diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/objects/MemoTest.java b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java similarity index 96% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/objects/MemoTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java index cdc7101..fa787e0 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/objects/MemoTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java @@ -1,11 +1,11 @@ -package de.bitsharesmunich.graphenej.objects; +package cy.agorise.graphenej.objects; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import de.bitsharesmunich.graphenej.Address; -import de.bitsharesmunich.graphenej.PublicKey; -import de.bitsharesmunich.graphenej.Util; -import de.bitsharesmunich.graphenej.errors.ChecksumException; +import cy.agorise.graphenej.Address; +import cy.agorise.graphenej.PublicKey; +import cy.agorise.graphenej.Util; +import cy.agorise.graphenej.errors.ChecksumException; import org.bitcoinj.core.DumpedPrivateKey; import org.bitcoinj.core.ECKey; import org.junit.*; diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/operations/AccountUpdateOperationTest.java b/graphenej/src/test/java/cy/agorise/graphenej/operations/AccountUpdateOperationTest.java similarity index 76% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/operations/AccountUpdateOperationTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/operations/AccountUpdateOperationTest.java index 61ff0d1..59f4192 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/operations/AccountUpdateOperationTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/operations/AccountUpdateOperationTest.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.operations; +package cy.agorise.graphenej.operations; import com.google.common.primitives.UnsignedLong; @@ -9,19 +9,19 @@ import org.junit.Test; import java.util.ArrayList; import java.util.HashMap; -import de.bitsharesmunich.graphenej.AccountOptions; -import de.bitsharesmunich.graphenej.Address; -import de.bitsharesmunich.graphenej.Asset; -import de.bitsharesmunich.graphenej.AssetAmount; -import de.bitsharesmunich.graphenej.Authority; -import de.bitsharesmunich.graphenej.BaseOperation; -import de.bitsharesmunich.graphenej.BlockData; -import de.bitsharesmunich.graphenej.BrainKey; -import de.bitsharesmunich.graphenej.PublicKey; -import de.bitsharesmunich.graphenej.Transaction; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.Util; -import de.bitsharesmunich.graphenej.errors.MalformedAddressException; +import cy.agorise.graphenej.AccountOptions; +import cy.agorise.graphenej.Address; +import cy.agorise.graphenej.Asset; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.Authority; +import cy.agorise.graphenej.BaseOperation; +import cy.agorise.graphenej.BlockData; +import cy.agorise.graphenej.BrainKey; +import cy.agorise.graphenej.PublicKey; +import cy.agorise.graphenej.Transaction; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.Util; +import cy.agorise.graphenej.errors.MalformedAddressException; /** * Created by nelson on 4/18/17. diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/operations/LimitOrderCancelOperationTest.java b/graphenej/src/test/java/cy/agorise/graphenej/operations/LimitOrderCancelOperationTest.java similarity index 89% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/operations/LimitOrderCancelOperationTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/operations/LimitOrderCancelOperationTest.java index a065d45..dbe252f 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/operations/LimitOrderCancelOperationTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/operations/LimitOrderCancelOperationTest.java @@ -1,8 +1,8 @@ -package de.bitsharesmunich.graphenej.operations; +package cy.agorise.graphenej.operations; import com.google.common.primitives.UnsignedLong; -import de.bitsharesmunich.graphenej.*; -import org.junit.Assert; +import cy.agorise.graphenej.*; + import org.junit.Before; import org.junit.Test; diff --git a/graphenej/src/test/java/de/bitsharesmunich/graphenej/operations/LimitOrderCreateOperationTest.java b/graphenej/src/test/java/cy/agorise/graphenej/operations/LimitOrderCreateOperationTest.java similarity index 91% rename from graphenej/src/test/java/de/bitsharesmunich/graphenej/operations/LimitOrderCreateOperationTest.java rename to graphenej/src/test/java/cy/agorise/graphenej/operations/LimitOrderCreateOperationTest.java index b070d00..ae6dafe 100644 --- a/graphenej/src/test/java/de/bitsharesmunich/graphenej/operations/LimitOrderCreateOperationTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/operations/LimitOrderCreateOperationTest.java @@ -1,4 +1,4 @@ -package de.bitsharesmunich.graphenej.operations; +package cy.agorise.graphenej.operations; import com.google.common.primitives.UnsignedLong; @@ -8,10 +8,10 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import de.bitsharesmunich.graphenej.Asset; -import de.bitsharesmunich.graphenej.AssetAmount; -import de.bitsharesmunich.graphenej.UserAccount; -import de.bitsharesmunich.graphenej.Util; +import cy.agorise.graphenej.Asset; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.Util; /** * Created by nelson on 3/6/17. From 6ac84f9a529c47e2dd9546f898c75adc611f4fdd Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Wed, 4 Oct 2017 23:05:14 -0500 Subject: [PATCH 03/49] Decreasing count when removing subscription listener --- .../graphenej/models/SubscriptionResponse.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/models/SubscriptionResponse.java b/graphenej/src/main/java/cy/agorise/graphenej/models/SubscriptionResponse.java index 2b2f6d0..8edbfcd 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/models/SubscriptionResponse.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/SubscriptionResponse.java @@ -111,13 +111,15 @@ public class SubscriptionResponse { * to be removed from the list. */ public void removeSubscriptionListener(SubscriptionListener subscriptionListener){ - int currentCount = listenerTypeCount.get(subscriptionListener.getInterestObjectType()); - if(currentCount != 0){ - this.listenerTypeCount.put(subscriptionListener.getInterestObjectType(), currentCount); - }else{ - System.out.println("Trying to remove subscription listener, but none is registered!"); + if(listenerTypeCount.containsKey(subscriptionListener.getInterestObjectType())){ + int currentCount = listenerTypeCount.get(subscriptionListener.getInterestObjectType()); + if(currentCount > 0){ + this.listenerTypeCount.put(subscriptionListener.getInterestObjectType(), currentCount - 1); + this.mListeners.remove(subscriptionListener); + }else{ + System.out.println("Trying to remove subscription listener, but none is registered!"); + } } - this.mListeners.remove(subscriptionListener); } /** From 61dc72724e7183afaf54a920069126a346bf38de Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 12 Oct 2017 18:22:29 -0500 Subject: [PATCH 04/49] Fixed a bug in the OrderBook.calculateRequiredBase method that made the calculation of the required asset amount to fail some times --- gradle.properties | 2 +- graphenej/build.gradle | 2 +- .../java/cy/agorise/graphenej/OrderBook.java | 8 ++- .../cy/agorise/graphenej/api/BaseApiTest.java | 6 +-- .../graphenej/api/GetLimitOrdersTest.java | 54 ++++++++++++++++++- 5 files changed, 64 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index 80c0e44..bfea545 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME=0.4.5 +VERSION_NAME=0.4.5-SNAPSHOT VERSION_CODE=7 GROUP=com.github.bilthon diff --git a/graphenej/build.gradle b/graphenej/build.gradle index 14e9c8c..e0168b7 100644 --- a/graphenej/build.gradle +++ b/graphenej/build.gradle @@ -22,7 +22,7 @@ android { minSdkVersion 9 targetSdkVersion 24 versionCode 7 - versionName "0.4.5" + versionName "0.4.5-SNAPSHOT" vectorDrawables.useSupportLibrary = true } diff --git a/graphenej/src/main/java/cy/agorise/graphenej/OrderBook.java b/graphenej/src/main/java/cy/agorise/graphenej/OrderBook.java index 61b5729..2fceb6a 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/OrderBook.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/OrderBook.java @@ -89,7 +89,13 @@ public class OrderBook { }else{ // If the offered amount is less than what we need, we exchange the whole order totalBought += orderAmount; - totalSold += order.getSellPrice().quote.getAmount().longValue(); + + // The amount specified in the price ratio is not always all for sale. So in order to calculate + // the amount actually sold we have to do: + // actually_sold = for_sale * quote / base + double sellRatio = ((double) orderAmount) / ((double) order.getSellPrice().base.getAmount().longValue()); + + totalSold += Math.floor(order.getSellPrice().quote.getAmount().doubleValue() * sellRatio); } } } diff --git a/graphenej/src/test/java/cy/agorise/graphenej/api/BaseApiTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/BaseApiTest.java index d2ec0fc..7a3e76a 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/api/BaseApiTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/BaseApiTest.java @@ -10,11 +10,11 @@ import javax.net.ssl.SSLContext; import cy.agorise.graphenej.test.NaiveSSLContext; /** - * Created by nelson on 4/14/17. + * Base class that every test that involves any communication with the API must extend */ public class BaseApiTest { - protected String BLOCK_PAY_DE = System.getenv("OPENLEDGER_EU"); + protected String NODE_URL = System.getenv("NODE_URL"); protected SSLContext context; protected WebSocket mWebSocket; @@ -27,7 +27,7 @@ public class BaseApiTest { // Set the custom SSL context. factory.setSSLContext(context); - mWebSocket = factory.createSocket(BLOCK_PAY_DE); + mWebSocket = factory.createSocket(NODE_URL); } } diff --git a/graphenej/src/test/java/cy/agorise/graphenej/api/GetLimitOrdersTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/GetLimitOrdersTest.java index 524d4c7..d0fd134 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/api/GetLimitOrdersTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/GetLimitOrdersTest.java @@ -5,6 +5,7 @@ import com.neovisionaries.ws.client.WebSocketException; import org.junit.After; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import java.util.List; @@ -23,13 +24,18 @@ import cy.agorise.graphenej.operations.LimitOrderCreateOperation; import static org.hamcrest.CoreMatchers.is; /** - * Created by nelson on 3/24/17. + * Class used to test the 'get_limit_order' API wrapper */ public class GetLimitOrdersTest extends BaseApiTest { private UserAccount seller = new UserAccount("1.2.143563"); private final Asset base = new Asset("1.3.121", "USD", 4); private final Asset quote = new Asset("1.3.0", "BTS", 5); + @Before + public void setup(){ + System.out.println("Connecting to node: "+NODE_URL); + } + @Test public void testGetLimitOrders(){ try { @@ -104,7 +110,7 @@ public class GetLimitOrdersTest extends BaseApiTest { int expiration = (int) ((System.currentTimeMillis() + 60000) / 1000); LimitOrderCreateOperation operation = orderBook.exchange(seller, base, toBuy, expiration); - // Testing the successfull creation of a limit order create operation + // Testing the successful creation of a limit order create operation Assert.assertTrue(operation != null); double price = (double) Math.pow(10, base.getPrecision() - quote.getPrecision()) * operation.getMinToReceive().getAmount().longValue() / operation.getAmountToSell().getAmount().longValue(); System.out.println("price: "+price); @@ -135,6 +141,50 @@ public class GetLimitOrdersTest extends BaseApiTest { } } + @Test + public void testRequiredBase(){ + try { + final Asset _quote = new Asset("1.3.121", "USD", 4); + final Asset _base = new Asset("1.3.0", "BTS", 5); + mWebSocket.addListener(new GetLimitOrders(_base.getObjectId(), _quote.getObjectId(), 100, new WitnessResponseListener() { + @Override + public void onSuccess(WitnessResponse response) { + List orders = (List) response.result; + OrderBook orderBook = new OrderBook(orders); + + long _totalQuote = 1000; + long _totalBase = orderBook.calculateRequiredBase(new AssetAmount(UnsignedLong.valueOf(_totalQuote), _quote)); + + System.out.println(String.format("Base: %s, Quote: %s", _base.getObjectId(), _quote.getObjectId())); + System.out.println(String.format("_totalQuote: %d, _totalBase: %d", _totalQuote, _totalBase)); + + synchronized (GetLimitOrdersTest.this){ + GetLimitOrdersTest.this.notifyAll(); + } + } + + @Override + public void onError(BaseResponse.Error error) { + System.out.println("onError. Msg: "+error.message); + synchronized (GetLimitOrdersTest.this){ + GetLimitOrdersTest.this.notifyAll(); + } + } + })); + + mWebSocket.connect(); + + synchronized (this){ + wait(); + } + + } catch (WebSocketException e) { + System.out.println("WebSocketException. Msg: " + e.getMessage()); + } catch (InterruptedException e) { + System.out.println("InterruptedException. Msg: "+e.getMessage()); + } + } + @After public void tearDown() throws Exception { mWebSocket.disconnect(); From b305faa6625403e4321740e77c0906d34bfe22f6 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 12 Oct 2017 23:34:22 -0500 Subject: [PATCH 05/49] Fixing a bug with memo deserialization --- .../main/java/cy/agorise/graphenej/Util.java | 33 ++++++++++++++----- .../cy/agorise/graphenej/objects/Memo.java | 31 +++++++++-------- .../cy/agorise/graphenej/TransactionTest.java | 30 ++++++++++------- .../java/cy/agorise/graphenej/UtilTest.java | 21 ++++++++++++ .../agorise/graphenej/objects/MemoTest.java | 14 +++++--- 5 files changed, 90 insertions(+), 39 deletions(-) create mode 100644 graphenej/src/test/java/cy/agorise/graphenej/UtilTest.java diff --git a/graphenej/src/main/java/cy/agorise/graphenej/Util.java b/graphenej/src/main/java/cy/agorise/graphenej/Util.java index 848d89f..d746ed0 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/Util.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Util.java @@ -1,7 +1,22 @@ package cy.agorise.graphenej; import com.google.common.primitives.Bytes; -import org.tukaani.xz.*; +import com.google.common.primitives.UnsignedLong; + +import org.spongycastle.crypto.DataLengthException; +import org.spongycastle.crypto.InvalidCipherTextException; +import org.spongycastle.crypto.engines.AESFastEngine; +import org.spongycastle.crypto.modes.CBCBlockCipher; +import org.spongycastle.crypto.paddings.PaddedBufferedBlockCipher; +import org.spongycastle.crypto.params.KeyParameter; +import org.spongycastle.crypto.params.ParametersWithIV; +import org.tukaani.xz.CorruptedInputException; +import org.tukaani.xz.FinishableOutputStream; +import org.tukaani.xz.LZMA2Options; +import org.tukaani.xz.LZMAInputStream; +import org.tukaani.xz.LZMAOutputStream; +import org.tukaani.xz.XZInputStream; +import org.tukaani.xz.XZOutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -13,13 +28,6 @@ import java.security.NoSuchAlgorithmException; import java.util.Arrays; import java.util.logging.Level; import java.util.logging.Logger; -import org.spongycastle.crypto.DataLengthException; -import org.spongycastle.crypto.InvalidCipherTextException; -import org.spongycastle.crypto.engines.AESFastEngine; -import org.spongycastle.crypto.modes.CBCBlockCipher; -import org.spongycastle.crypto.paddings.PaddedBufferedBlockCipher; -import org.spongycastle.crypto.params.KeyParameter; -import org.spongycastle.crypto.params.ParametersWithIV; /** * Class used to encapsulate common utility methods @@ -210,6 +218,15 @@ public class Util { return ByteBuffer.allocate(Long.SIZE / 8).putLong(Long.reverseBytes(input)).array(); } + /** + * Same operation as in the revertInteger function, but with an UnsignedLong object as argument. + * @param input An UnsignedLong class instance + * @return The array of bytes that represent this value in the reverse format. + */ + public static byte[] revertUnsignedLong(UnsignedLong input){ + return ByteBuffer.allocate(Long.SIZE / 8).putLong(Long.reverseBytes(input.longValue())).array(); + } + public static byte[] revertBytes(byte[] array){ byte[] reverted = new byte[array.length]; for(int i = 0; i < reverted.length; i++){ diff --git a/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java b/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java index 353640e..b979e55 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java @@ -1,20 +1,13 @@ package cy.agorise.graphenej.objects; import com.google.common.primitives.Bytes; +import com.google.common.primitives.UnsignedLong; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; -import cy.agorise.graphenej.Address; -import cy.agorise.graphenej.PublicKey; -import cy.agorise.graphenej.Util; -import cy.agorise.graphenej.errors.ChecksumException; -import cy.agorise.graphenej.errors.MalformedAddressException; -import cy.agorise.graphenej.interfaces.ByteSerializable; -import cy.agorise.graphenej.interfaces.JsonSerializable; - import org.bitcoinj.core.ECKey; import org.spongycastle.math.ec.ECPoint; @@ -23,8 +16,17 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; +import cy.agorise.graphenej.Address; +import cy.agorise.graphenej.PublicKey; +import cy.agorise.graphenej.Util; +import cy.agorise.graphenej.errors.ChecksumException; +import cy.agorise.graphenej.errors.MalformedAddressException; +import cy.agorise.graphenej.interfaces.ByteSerializable; +import cy.agorise.graphenej.interfaces.JsonSerializable; + /** - * Created by nelson on 11/9/16. + * Class used to represent a memo data structure + * {@url https://bitshares.org/doxygen/structgraphene_1_1chain_1_1memo__data.html} */ public class Memo implements ByteSerializable, JsonSerializable { public final static String TAG = "Memo"; @@ -35,7 +37,7 @@ public class Memo implements ByteSerializable, JsonSerializable { private Address from; private Address to; - private long nonce; + private UnsignedLong nonce; private byte[] message; private String plaintextMessage; @@ -66,7 +68,7 @@ public class Memo implements ByteSerializable, JsonSerializable { * @param nonce: Nonce used in the encryption. * @param message: Message in ciphertext. */ - public Memo(Address from, Address to, long nonce, byte[] message){ + public Memo(Address from, Address to, UnsignedLong nonce, byte[] message){ this.from = from; this.to = to; this.nonce = nonce; @@ -89,7 +91,7 @@ public class Memo implements ByteSerializable, JsonSerializable { return this.to; } - public long getNonce(){ + public UnsignedLong getNonce(){ return this.nonce; } @@ -235,7 +237,7 @@ public class Memo implements ByteSerializable, JsonSerializable { new byte[]{(byte) this.message.length}, this.message); } else { - byte[] nonceBytes = Util.revertLong(nonce); + byte[] nonceBytes = Util.revertUnsignedLong(nonce); ECPoint senderPoint = ECKey.compressPoint(from.getPublicKey().getKey().getPubKeyPoint()); PublicKey senderPublicKey = new PublicKey(ECKey.fromPublicOnly(senderPoint)); @@ -287,7 +289,7 @@ public class Memo implements ByteSerializable, JsonSerializable { JsonObject jsonObject = json.getAsJsonObject(); String fromAddress = jsonObject.get(KEY_FROM).getAsString(); String toAddress = jsonObject.get(KEY_TO).getAsString(); - long nonce = jsonObject.get(KEY_NONCE).getAsLong(); + UnsignedLong nonce = UnsignedLong.valueOf(jsonObject.get(KEY_NONCE).getAsString()); String msg = jsonObject.get(KEY_MESSAGE).getAsString(); Memo memo = null; @@ -295,6 +297,7 @@ public class Memo implements ByteSerializable, JsonSerializable { Address from = new Address(fromAddress); Address to = new Address(toAddress); byte[] message = Util.hexToBytes(msg); + memo = new Memo(from, to, nonce, message); }catch(MalformedAddressException e){ System.out.println("MalformedAddressException. Msg: "+e.getMessage()); diff --git a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java index bf4ded1..f211c6f 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java @@ -4,24 +4,30 @@ import com.google.common.primitives.UnsignedLong; import com.neovisionaries.ws.client.WebSocket; import com.neovisionaries.ws.client.WebSocketException; import com.neovisionaries.ws.client.WebSocketFactory; + +import org.bitcoinj.core.ECKey; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.List; + +import javax.net.ssl.SSLContext; + import cy.agorise.graphenej.api.GetLimitOrders; import cy.agorise.graphenej.api.TransactionBroadcastSequence; import cy.agorise.graphenej.interfaces.WitnessResponseListener; import cy.agorise.graphenej.models.BaseResponse; import cy.agorise.graphenej.models.WitnessResponse; import cy.agorise.graphenej.objects.Memo; -import cy.agorise.graphenej.operations.*; +import cy.agorise.graphenej.operations.LimitOrderCancelOperation; +import cy.agorise.graphenej.operations.LimitOrderCreateOperation; +import cy.agorise.graphenej.operations.TransferOperation; +import cy.agorise.graphenej.operations.TransferOperationBuilder; import cy.agorise.graphenej.test.NaiveSSLContext; -import org.bitcoinj.core.ECKey; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import javax.net.ssl.SSLContext; -import java.io.IOException; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.List; /** * Created by nelson on 3/6/17. @@ -138,7 +144,7 @@ public class TransactionTest { // Creating memo long nonce = 1; byte[] encryptedMessage = Memo.encryptMessage(sourcePrivateKey, to1, nonce, "another message"); - Memo memo = new Memo(new Address(ECKey.fromPublicOnly(sourcePrivateKey.getPubKey())), new Address(to1.getKey()), nonce, encryptedMessage); + Memo memo = new Memo(new Address(ECKey.fromPublicOnly(sourcePrivateKey.getPubKey())), new Address(to1.getKey()), UnsignedLong.valueOf(nonce), encryptedMessage); // Creating operation 1 TransferOperation transferOperation1 = new TransferOperationBuilder() diff --git a/graphenej/src/test/java/cy/agorise/graphenej/UtilTest.java b/graphenej/src/test/java/cy/agorise/graphenej/UtilTest.java new file mode 100644 index 0000000..9ba1d90 --- /dev/null +++ b/graphenej/src/test/java/cy/agorise/graphenej/UtilTest.java @@ -0,0 +1,21 @@ +package cy.agorise.graphenej; + +import com.google.common.primitives.UnsignedLong; + +import junit.framework.Assert; + +import org.junit.Test; + +/** + * Class used to test Util methods + */ + +public class UtilTest { + + @Test + public void testRevertUnsignedLong(){ + UnsignedLong unsignedLong = UnsignedLong.valueOf("12179241258665439971"); + byte[] reversed = Util.revertUnsignedLong(unsignedLong); + Assert.assertEquals("e3f28878655b05a9", Util.bytesToHex(reversed)); + } +} diff --git a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java index fa787e0..e469578 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java @@ -1,14 +1,18 @@ package cy.agorise.graphenej.objects; +import com.google.common.primitives.UnsignedLong; import com.google.gson.JsonElement; import com.google.gson.JsonObject; + +import org.bitcoinj.core.DumpedPrivateKey; +import org.bitcoinj.core.ECKey; +import org.junit.Before; +import org.junit.Test; + import cy.agorise.graphenej.Address; import cy.agorise.graphenej.PublicKey; import cy.agorise.graphenej.Util; import cy.agorise.graphenej.errors.ChecksumException; -import org.bitcoinj.core.DumpedPrivateKey; -import org.bitcoinj.core.ECKey; -import org.junit.*; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; @@ -130,7 +134,7 @@ public class MemoTest { @Test public void shouldBeJsonObjectSerializable(){ byte[] encrypted = Memo.encryptMessage(sourcePrivate, destinationAddress, 1, shortMessage); - Memo memo = new Memo(sourceAddress, destinationAddress, 1, encrypted); + Memo memo = new Memo(sourceAddress, destinationAddress, UnsignedLong.ONE, encrypted); JsonElement jsonObject = memo.toJsonObject(); JsonObject reference = new JsonObject(); reference.addProperty("from", "BTS8RiFgs8HkcVPVobHLKEv6yL3iXcC9SWjbPVS15dDAXLG9GYhnY"); @@ -144,7 +148,7 @@ public class MemoTest { public void shouldBeByteSerializable(){ String byteReference = "0103d1fb8c7421db64d46fba7e36f428854ca06eff65698b293f37c7ffaa54e2c2b203aece7c31616c02fcc96b50d3397c0e8d33d6384655d477c300d9196c728a5ee20100000000000000104c81c2db6ebc61e3f9e0ead65c0559dd"; byte[] encrypted = Memo.encryptMessage(sourcePrivate, destinationAddress, 1, shortMessage); - Memo memo = new Memo(sourceAddress, destinationAddress, 1, encrypted); + Memo memo = new Memo(sourceAddress, destinationAddress, UnsignedLong.ONE, encrypted); byte[] memoBytes = memo.toBytes(); assertEquals("Memo instance should generate a valid byte array", byteReference, Util.bytesToHex(memoBytes)); } From 69ccbe8cd99e552f90c21336073f342cb9101332 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Tue, 17 Oct 2017 23:19:55 -0500 Subject: [PATCH 06/49] - Reverted the Memo#nonce attribute to the original long type - Properly fixed the deserialization problem and added a specific test case at MemoTest#shouldDeserializeFromString --- .../cy/agorise/graphenej/objects/Memo.java | 14 +++---- .../operations/TransferOperation.java | 9 ++-- .../cy/agorise/graphenej/TransactionTest.java | 2 +- .../agorise/graphenej/objects/MemoTest.java | 42 +++++++++++++------ 4 files changed, 42 insertions(+), 25 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java b/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java index b979e55..f94a901 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java @@ -1,7 +1,6 @@ package cy.agorise.graphenej.objects; import com.google.common.primitives.Bytes; -import com.google.common.primitives.UnsignedLong; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; @@ -37,7 +36,7 @@ public class Memo implements ByteSerializable, JsonSerializable { private Address from; private Address to; - private UnsignedLong nonce; + private long nonce; private byte[] message; private String plaintextMessage; @@ -68,7 +67,7 @@ public class Memo implements ByteSerializable, JsonSerializable { * @param nonce: Nonce used in the encryption. * @param message: Message in ciphertext. */ - public Memo(Address from, Address to, UnsignedLong nonce, byte[] message){ + public Memo(Address from, Address to, long nonce, byte[] message){ this.from = from; this.to = to; this.nonce = nonce; @@ -91,7 +90,7 @@ public class Memo implements ByteSerializable, JsonSerializable { return this.to; } - public UnsignedLong getNonce(){ + public long getNonce(){ return this.nonce; } @@ -237,7 +236,7 @@ public class Memo implements ByteSerializable, JsonSerializable { new byte[]{(byte) this.message.length}, this.message); } else { - byte[] nonceBytes = Util.revertUnsignedLong(nonce); + byte[] nonceBytes = Util.revertLong(nonce); ECPoint senderPoint = ECKey.compressPoint(from.getPublicKey().getKey().getPubKeyPoint()); PublicKey senderPublicKey = new PublicKey(ECKey.fromPublicOnly(senderPoint)); @@ -273,7 +272,7 @@ public class Memo implements ByteSerializable, JsonSerializable { }else{ memoObject.addProperty(KEY_FROM, this.from.toString()); memoObject.addProperty(KEY_TO, this.to.toString()); - memoObject.addProperty(KEY_NONCE, String.format("%d", this.nonce)); + memoObject.addProperty(KEY_NONCE, String.format("%x", this.nonce)); memoObject.addProperty(KEY_MESSAGE, Util.bytesToHex(this.message)); } return memoObject; @@ -289,9 +288,8 @@ public class Memo implements ByteSerializable, JsonSerializable { JsonObject jsonObject = json.getAsJsonObject(); String fromAddress = jsonObject.get(KEY_FROM).getAsString(); String toAddress = jsonObject.get(KEY_TO).getAsString(); - UnsignedLong nonce = UnsignedLong.valueOf(jsonObject.get(KEY_NONCE).getAsString()); + long nonce = Long.parseLong(jsonObject.get(KEY_NONCE).getAsString(), 16); String msg = jsonObject.get(KEY_MESSAGE).getAsString(); - Memo memo = null; try{ Address from = new Address(fromAddress); diff --git a/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperation.java b/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperation.java index 0988640..656c23a 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperation.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperation.java @@ -131,10 +131,11 @@ public class TransferOperation extends BaseOperation { @Override public JsonElement serialize(TransferOperation transfer, Type type, JsonSerializationContext jsonSerializationContext) { - JsonArray arrayRep = new JsonArray(); - arrayRep.add(transfer.getId()); - arrayRep.add(transfer.toJsonObject()); - return arrayRep; +// JsonArray arrayRep = new JsonArray(); +// arrayRep.add(transfer.getId()); +// arrayRep.add(transfer.toJsonObject()); +// return arrayRep; + return transfer.toJsonObject(); } } diff --git a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java index f211c6f..b2de5c3 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java @@ -144,7 +144,7 @@ public class TransactionTest { // Creating memo long nonce = 1; byte[] encryptedMessage = Memo.encryptMessage(sourcePrivateKey, to1, nonce, "another message"); - Memo memo = new Memo(new Address(ECKey.fromPublicOnly(sourcePrivateKey.getPubKey())), new Address(to1.getKey()), UnsignedLong.valueOf(nonce), encryptedMessage); + Memo memo = new Memo(new Address(ECKey.fromPublicOnly(sourcePrivateKey.getPubKey())), new Address(to1.getKey()), nonce, encryptedMessage); // Creating operation 1 TransferOperation transferOperation1 = new TransferOperationBuilder() diff --git a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java index e469578..d316f0e 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java @@ -1,11 +1,12 @@ package cy.agorise.graphenej.objects; -import com.google.common.primitives.UnsignedLong; +import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import org.bitcoinj.core.DumpedPrivateKey; import org.bitcoinj.core.ECKey; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -31,7 +32,7 @@ public class MemoTest { private long nonce; private String sourceWIF = System.getenv("SOURCE_WIF"); private String destinationWIF = System.getenv("DESTINATION_WIF"); - private byte[] memoEncryptedEnvMessage = Util.hexToBytes(System.getenv("MEMO_MESSAGE")); + private byte[] memoEncryptedEnvMessage; //private String sourceWIF = "5J96pne45qWM1WpektoeazN6k9Mt93jQ7LyueRxFfEMTiy6yxjM"; //private String destinationWIF = "5HuGQT8qwHScBgD4XsGbQUmXQF18MrbzxaQDiGGXFNRrCtqgT5Q"; private String shortMessage = "test"; @@ -44,15 +45,21 @@ public class MemoTest { @Before public void setUp() throws Exception { - //Source - sourcePrivate = DumpedPrivateKey.fromBase58(null, sourceWIF).getKey(); - PublicKey publicKey = new PublicKey(ECKey.fromPublicOnly(sourcePrivate.getPubKey())); - sourceAddress = new Address(publicKey.getKey()); + if(System.getenv("MEMO_MESSAGE") != null){ + memoEncryptedEnvMessage = Util.hexToBytes(System.getenv("MEMO_MESSAGE")); + } - //Destination - destinationPrivate = DumpedPrivateKey.fromBase58(null, destinationWIF).getKey(); - publicKey = new PublicKey(ECKey.fromPublicOnly(destinationPrivate.getPubKey())); - destinationAddress = new Address(publicKey.getKey()); + if(sourceWIF != null && destinationWIF != null){ + //Source + sourcePrivate = DumpedPrivateKey.fromBase58(null, sourceWIF).getKey(); + PublicKey publicKey = new PublicKey(ECKey.fromPublicOnly(sourcePrivate.getPubKey())); + sourceAddress = new Address(publicKey.getKey()); + + //Destination + destinationPrivate = DumpedPrivateKey.fromBase58(null, destinationWIF).getKey(); + publicKey = new PublicKey(ECKey.fromPublicOnly(destinationPrivate.getPubKey())); + destinationAddress = new Address(publicKey.getKey()); + } //memo.getNonce() nonce = 5; @@ -134,7 +141,7 @@ public class MemoTest { @Test public void shouldBeJsonObjectSerializable(){ byte[] encrypted = Memo.encryptMessage(sourcePrivate, destinationAddress, 1, shortMessage); - Memo memo = new Memo(sourceAddress, destinationAddress, UnsignedLong.ONE, encrypted); + Memo memo = new Memo(sourceAddress, destinationAddress, 1, encrypted); JsonElement jsonObject = memo.toJsonObject(); JsonObject reference = new JsonObject(); reference.addProperty("from", "BTS8RiFgs8HkcVPVobHLKEv6yL3iXcC9SWjbPVS15dDAXLG9GYhnY"); @@ -148,8 +155,19 @@ public class MemoTest { public void shouldBeByteSerializable(){ String byteReference = "0103d1fb8c7421db64d46fba7e36f428854ca06eff65698b293f37c7ffaa54e2c2b203aece7c31616c02fcc96b50d3397c0e8d33d6384655d477c300d9196c728a5ee20100000000000000104c81c2db6ebc61e3f9e0ead65c0559dd"; byte[] encrypted = Memo.encryptMessage(sourcePrivate, destinationAddress, 1, shortMessage); - Memo memo = new Memo(sourceAddress, destinationAddress, UnsignedLong.ONE, encrypted); + Memo memo = new Memo(sourceAddress, destinationAddress, 1, encrypted); byte[] memoBytes = memo.toBytes(); assertEquals("Memo instance should generate a valid byte array", byteReference, Util.bytesToHex(memoBytes)); } + + @Test + public void shouldDeserializeFromString(){ + String jsonMemo = "{\"from\": \"BTS6nB7gw1EawYXRofLvuivLsboVmh2inXroQgSQqYfAc5Bamk4Vq\",\"to\": \"BTS4xAQGg2ePLeDGZvQFpsh9CjMhQvRnVkPp6jPoE6neVPotRfZX9\",\"nonce\": \"15f2d8ee4ec23\",\"message\": \"b9aeb7632f1f4281eedcf28a684828a42d02de71254fb88e13ddcb9a79adf51d9770c58d7e7efcdbb1515f1136c3be3e\"}"; + GsonBuilder gsonBuilder = new GsonBuilder().registerTypeAdapter(Memo.class, new Memo.MemoDeserializer()); + Memo memo = gsonBuilder.create().fromJson(jsonMemo, Memo.class); + Assert.assertEquals("Source address should match the serialized one", "BTS6nB7gw1EawYXRofLvuivLsboVmh2inXroQgSQqYfAc5Bamk4Vq", memo.getSource().toString()); + Assert.assertEquals("Destination address should match the serialized one", "BTS4xAQGg2ePLeDGZvQFpsh9CjMhQvRnVkPp6jPoE6neVPotRfZX9", memo.getDestination().toString()); + Assert.assertEquals("Nonce should match serialized one", Long.parseLong("15f2d8ee4ec23", 16), memo.getNonce()); + Assert.assertArrayEquals(Util.hexToBytes("b9aeb7632f1f4281eedcf28a684828a42d02de71254fb88e13ddcb9a79adf51d9770c58d7e7efcdbb1515f1136c3be3e"), memo.getByteMessage()); + } } \ No newline at end of file From 3e96bbc9b3a8d2760e18e3eb91f03d50cb6ab7a3 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Wed, 1 Nov 2017 21:18:36 -0500 Subject: [PATCH 07/49] Adding node hopping capabilities to the NodeConnection class along with some tests --- .../graphenej/api/android/NodeConnection.java | 32 +++++++++------- .../api/android/WebsocketWorkerThread.java | 8 +++- .../api/android/NodeConnectionTest.java | 38 +++++++++++-------- 3 files changed, 47 insertions(+), 31 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/android/NodeConnection.java b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NodeConnection.java index 98a0b79..96632fc 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/android/NodeConnection.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NodeConnection.java @@ -67,8 +67,7 @@ public class NodeConnection { * @param urlList: List of URLs of the nodes */ public void addNodeUrls(List urlList){ - List newList = new ArrayList(mUrlList); - newList.addAll(urlList); + mUrlList.addAll(urlList); } /** @@ -91,7 +90,7 @@ public class NodeConnection { @Override public void onError(BaseResponse.Error error) { System.out.println("NodeConnect Error. Msg: "+error); - + mUrlIndex++; connect(mUser, mPassword, mSubscribe, mErrorListener); } }; @@ -114,18 +113,23 @@ public class NodeConnection { * about the failure of the desired broadcast operation. */ public void connect(String user, String password, boolean subscribe, WitnessResponseListener errorListener) { - if(this.mUrlList.size() > 0){ - mUser = user; - mPassword = password; - mSubscribe = subscribe; - System.out.println("Connecting to: "+ this.mUrlList.get(mUrlIndex)); - mErrorListener = errorListener; - mThread = new WebsocketWorkerThread(this.mUrlList.get(mUrlIndex), mInternalErrorListener); - mUrlIndex = mUrlIndex + 1 % this.mUrlList.size(); + if(mUrlList.size() > 0){ + if(mUrlIndex < mUrlList.size()){ + System.out.println("Connecting to: "+ this.mUrlList.get(mUrlIndex)); + mUser = user; + mPassword = password; + mSubscribe = subscribe; + mErrorListener = errorListener; + mThread = new WebsocketWorkerThread(this.mUrlList.get(mUrlIndex), mInternalErrorListener); - mMessagesHub = new SubscriptionMessagesHub(user, password, subscribe, mInternalErrorListener); - mThread.addListener(mMessagesHub); - mThread.start(); + mMessagesHub = new SubscriptionMessagesHub(user, password, subscribe, mInternalErrorListener); + mThread.addListener(mMessagesHub); + mThread.start(); + }else{ + errorListener.onError(new BaseResponse.Error("Can't connect, ran out of URLs!")); + } + }else{ + errorListener.onError(new BaseResponse.Error("Can't connect, missing URL")); } } diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/android/WebsocketWorkerThread.java b/graphenej/src/main/java/cy/agorise/graphenej/api/android/WebsocketWorkerThread.java index 231b460..d8d45a7 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/android/WebsocketWorkerThread.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/android/WebsocketWorkerThread.java @@ -63,6 +63,7 @@ public class WebsocketWorkerThread extends Thread { * about the failure of the connection. */ public WebsocketWorkerThread(String url, NodeErrorListener errorListener){ + mErrorListener = errorListener; try { WebSocketFactory factory = new WebSocketFactory().setConnectionTimeout(TIMEOUT); @@ -74,13 +75,18 @@ public class WebsocketWorkerThread extends Thread { } mWebSocket = factory.createSocket(url); - mErrorListener = errorListener; } catch (IOException e) { System.out.println("IOException. Msg: "+e.getMessage()); + mErrorListener.onError(new BaseResponse.Error(e.getMessage())); } catch(NullPointerException e){ System.out.println("NullPointerException at WebsocketWorkerThreas. Msg: "+e.getMessage()); + mErrorListener.onError(new BaseResponse.Error(e.getMessage())); } catch (NoSuchAlgorithmException e) { System.out.println("NoSuchAlgorithmException. Msg: "+e.getMessage()); + mErrorListener.onError(new BaseResponse.Error(e.getMessage())); + } catch(IllegalArgumentException e){ + System.out.println("IllegalArgumentException. Msg: "+e.getMessage()); + mErrorListener.onError(new BaseResponse.Error(e.getMessage())); } } diff --git a/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java index a691a19..f803d0f 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java @@ -58,17 +58,20 @@ public class NodeConnectionTest { private String NODE_URL_3 = System.getenv("NODE_URL_3"); private String NODE_URL_4 = System.getenv("NODE_URL_4"); private String TEST_ACCOUNT_BRAIN_KEY = System.getenv("TEST_ACCOUNT_BRAIN_KEY"); - private String ACCOUNT_ID_1 = System.getenv("ACCOUNT_ID_1"); - private String ACCOUNT_ID_2 = System.getenv("ACCOUNT_ID_2"); - private String ACCOUNT_NAME = System.getenv("ACCOUNT_NAME"); - private long BlOCK_TEST_NUMBER = Long.parseLong(System.getenv("BlOCK_TEST_NUMBER")); + private String ACCOUNT_ID_1 = "1.2.140994"; + private String ACCOUNT_ID_2 = "1.2.138632"; + private String ACCOUNT_NAME = "bilthon-7"; + private long BlOCK_TEST_NUMBER = 11000000; private Asset BTS = new Asset("1.3.0"); private Asset BLOCKPAY = new Asset("1.3.1072"); private Asset BITDOLAR = new Asset("1.3.121"); //USD Smartcoin private Asset BITEURO = new Asset("1.3.120"); //EUR Smartcoin private NodeConnection nodeConnection; - private TimerTask scheduleTask = new TimerTask() { + /** + * Sample task to be scheduled + */ + private TimerTask getAccountsTask = new TimerTask() { @Override public void run() { System.out.println("Adding request here"); @@ -91,6 +94,9 @@ public class NodeConnectionTest { } }; + /** + * Task that will release the worker thread, effectively terminating this test + */ private TimerTask releaseTask = new TimerTask() { @Override public void run() { @@ -103,12 +109,13 @@ public class NodeConnectionTest { @Test public void testNodeConnection(){ + System.out.println("** Testing simple node connection **"); nodeConnection = NodeConnection.getInstance(); nodeConnection.addNodeUrl(NODE_URL_1); nodeConnection.connect("", "", true, mErrorListener); Timer timer = new Timer(); - timer.schedule(scheduleTask, 5000); + timer.schedule(getAccountsTask, 5000); timer.schedule(releaseTask, 30000); try{ @@ -121,30 +128,29 @@ public class NodeConnectionTest { } } - @Test /** * Test for NodeConnection's addNodeUrl and addNodeUrls working together. * - * Need to setup the NODE_URL_(1 to 4) env to work. Some of the nodes may have invalid nodes - * websockets URL just to test the hop. + * Need to setup the NODE_URL_2 env to work. The first hard-coded URL is wrong and will + * fail. The NodeConnection instance should recover and try the next one in the list. * */ + @Test public void testNodeHopFeature(){ + System.out.println("** Testing node hopping **"); nodeConnection = NodeConnection.getInstance(); - //nodeConnection.addNodeUrl(NODE_URL_4); + //Test adding a "sublist" ArrayList urlList = new ArrayList(){{ - add(NODE_URL_3); - add(NODE_URL_3); + add("wss://eu.openledger.info/wrong"); + add(NODE_URL_2); }}; - //nodeConnection.addNodeUrls(urlList); - nodeConnection.addNodeUrl(NODE_URL_1); + nodeConnection.addNodeUrls(urlList); nodeConnection.connect("", "", true, mErrorListener); Timer timer = new Timer(); - timer.schedule(scheduleTask, 5000); - timer.schedule(releaseTask, 30000); + timer.schedule(releaseTask, 15000); try{ // Holding this thread while we get update notifications From e34596d0b4854afd2b264918135e06ea3c2c36b0 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 2 Nov 2017 11:38:39 -0500 Subject: [PATCH 08/49] Adding a simple key to address derivation test --- .../java/cy/agorise/graphenej/KeyTest.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 graphenej/src/test/java/cy/agorise/graphenej/KeyTest.java diff --git a/graphenej/src/test/java/cy/agorise/graphenej/KeyTest.java b/graphenej/src/test/java/cy/agorise/graphenej/KeyTest.java new file mode 100644 index 0000000..ba5836f --- /dev/null +++ b/graphenej/src/test/java/cy/agorise/graphenej/KeyTest.java @@ -0,0 +1,25 @@ +package cy.agorise.graphenej; + +import junit.framework.Assert; + +import org.bitcoinj.core.DumpedPrivateKey; +import org.bitcoinj.core.ECKey; +import org.junit.Test; + +/** + * Created by nelson on 11/2/17. + */ + +public class KeyTest { + + /** + * Testing key to address derivation + */ + @Test + public void testKeyToAddress(){ + String wif = "5J96pne45qWM1WpektoeazN6k9Mt93jQ7LyueRxFfEMTiy6yxjM"; + ECKey sourcePrivate = DumpedPrivateKey.fromBase58(null, wif).getKey(); + Address address = new Address(ECKey.fromPublicOnly(sourcePrivate.getPubKey())); + Assert.assertEquals("Generated address matches expected one", address.toString(), "BTS8RiFgs8HkcVPVobHLKEv6yL3iXcC9SWjbPVS15dDAXLG9GYhnY"); + } +} From f74f2cefc272edcc8fef28b2c93d5d06e41df5a4 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 2 Nov 2017 11:47:59 -0500 Subject: [PATCH 09/49] Adjusting argument order in order to match expected & actual --- graphenej/src/test/java/cy/agorise/graphenej/KeyTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphenej/src/test/java/cy/agorise/graphenej/KeyTest.java b/graphenej/src/test/java/cy/agorise/graphenej/KeyTest.java index ba5836f..cd1ff32 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/KeyTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/KeyTest.java @@ -20,6 +20,6 @@ public class KeyTest { String wif = "5J96pne45qWM1WpektoeazN6k9Mt93jQ7LyueRxFfEMTiy6yxjM"; ECKey sourcePrivate = DumpedPrivateKey.fromBase58(null, wif).getKey(); Address address = new Address(ECKey.fromPublicOnly(sourcePrivate.getPubKey())); - Assert.assertEquals("Generated address matches expected one", address.toString(), "BTS8RiFgs8HkcVPVobHLKEv6yL3iXcC9SWjbPVS15dDAXLG9GYhnY"); + Assert.assertEquals("Generated address matches expected one", "BTS8RiFgs8HkcVPVobHLKEv6yL3iXcC9SWjbPVS15dDAXLG9GYhnY", address.toString()); } } From 2e928052345d7bb0de68540a3970d1a35a183740 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 2 Nov 2017 15:25:54 -0500 Subject: [PATCH 10/49] Removing dependency on environment variables from the memo testing suite --- .../agorise/graphenej/MemoTestAccounts.java | 17 +++++ .../agorise/graphenej/objects/MemoTest.java | 70 ++++++++----------- 2 files changed, 45 insertions(+), 42 deletions(-) create mode 100644 graphenej/src/test/java/cy/agorise/graphenej/MemoTestAccounts.java diff --git a/graphenej/src/test/java/cy/agorise/graphenej/MemoTestAccounts.java b/graphenej/src/test/java/cy/agorise/graphenej/MemoTestAccounts.java new file mode 100644 index 0000000..e34ee01 --- /dev/null +++ b/graphenej/src/test/java/cy/agorise/graphenej/MemoTestAccounts.java @@ -0,0 +1,17 @@ +package cy.agorise.graphenej; + +/** + * Created by nelson on 11/2/17. + */ + +public class MemoTestAccounts { + public class Bilthon7 { + public static final String BRAINKEY = "PUMPER ISOTOME SERE STAINER CLINGER MOONLIT CHAETA UPBRIM AEDILIC BERTHER NIT SHAP SAID SHADING JUNCOUS CHOUGH"; + public static final String WIF = "5J96pne45qWM1WpektoeazN6k9Mt93jQ7LyueRxFfEMTiy6yxjM"; + } + + public class Bilthon16 { + public static final String BRAINKEY = "BARIC BICKERN LITZ TIPFUL JINGLED POOL TUMBAK PURIST APOPYLE DURAIN SATLIJK FAUCAL"; + public static final String WIF = "5JNxigtdkjkjM1dVGBBLk2axnUZmHrNLK4CqnUjWDzeX18HnyoD"; + } +} diff --git a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java index d316f0e..68055c5 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java @@ -11,6 +11,7 @@ import org.junit.Before; import org.junit.Test; import cy.agorise.graphenej.Address; +import cy.agorise.graphenej.MemoTestAccounts; import cy.agorise.graphenej.PublicKey; import cy.agorise.graphenej.Util; import cy.agorise.graphenej.errors.ChecksumException; @@ -29,26 +30,19 @@ public class MemoTest { private ECKey destinationPrivate; private Address destinationAddress; - private long nonce; - private String sourceWIF = System.getenv("SOURCE_WIF"); - private String destinationWIF = System.getenv("DESTINATION_WIF"); - private byte[] memoEncryptedEnvMessage; - //private String sourceWIF = "5J96pne45qWM1WpektoeazN6k9Mt93jQ7LyueRxFfEMTiy6yxjM"; - //private String destinationWIF = "5HuGQT8qwHScBgD4XsGbQUmXQF18MrbzxaQDiGGXFNRrCtqgT5Q"; + private String sourceWIF = MemoTestAccounts.Bilthon16.WIF; + private String destinationWIF = MemoTestAccounts.Bilthon7.WIF; private String shortMessage = "test"; private String longerMessage = "testing now longer string with some special charaters é ç o ú á í Í mMno!!"; - private byte[] shortEncryptedMessage = Util.hexToBytes("4c81c2db6ebc61e3f9e0ead65c0559dd"); - private byte[] longerEncryptedMessage = Util.hexToBytes("1f8a08f1ff53dcefd48eeb052d26fba425f2a917f508ce61fc3d5696b10efa17"); + private byte[] shortEncryptedMessage = Util.hexToBytes("93c398e05f2a36a535f82880032a062d"); + private long shortEncryptedMessageNonce = 386471255144360L; - private String decodedMessage; + private byte[] longerEncryptedMessage = Util.hexToBytes("8ba8f5ed85ad9f7675bd30408a28d6f6ba138476d1e995dd61c01f0041ab25911e04d93fe4ce30e4f6c9a5134cceb67d653e140aa542da19ce2fc646bcde46e088da06a9327eaac79ffe8bc9d71d586195c04bb023995f18e66c9f9e5c6b0d7c"); + private long longEncryptedMessageNonce = 386469162162343L; @Before public void setUp() throws Exception { - if(System.getenv("MEMO_MESSAGE") != null){ - memoEncryptedEnvMessage = Util.hexToBytes(System.getenv("MEMO_MESSAGE")); - } - if(sourceWIF != null && destinationWIF != null){ //Source sourcePrivate = DumpedPrivateKey.fromBase58(null, sourceWIF).getKey(); @@ -60,35 +54,21 @@ public class MemoTest { publicKey = new PublicKey(ECKey.fromPublicOnly(destinationPrivate.getPubKey())); destinationAddress = new Address(publicKey.getKey()); } - - //memo.getNonce() - nonce = 5; } @Test - public void shouldMatchPredefinedChiphertext(){ - byte[] encrypted = Memo.encryptMessage(sourcePrivate, destinationAddress, 1, shortMessage); + public void shouldMatchPredefinedCiphertext(){ + byte[] encrypted = Memo.encryptMessage(sourcePrivate, destinationAddress, shortEncryptedMessageNonce, shortMessage); assertArrayEquals("Testing with short message and nonce 1", encrypted, shortEncryptedMessage); - byte[] encryptedLong = Memo.encryptMessage(sourcePrivate, destinationAddress, 1, longerMessage); + byte[] encryptedLong = Memo.encryptMessage(sourcePrivate, destinationAddress, longEncryptedMessageNonce, longerMessage); assertArrayEquals("Testing with longer message and nonce 1", encryptedLong, longerEncryptedMessage); } - @Test - public void shouldDecryptEnvMessage(){ - try { - String decrypted = Memo.decryptMessage(destinationPrivate, sourceAddress, nonce, memoEncryptedEnvMessage); - System.out.println("Short Decrypted Message: " + decrypted); - assertEquals("Decrypted message must be equal to original", decrypted, shortMessage); - } catch (ChecksumException e) { - e.printStackTrace(); - } - } - @Test public void shouldDecryptShortMessage(){ try { - String decrypted = Memo.decryptMessage(destinationPrivate, sourceAddress, nonce, shortEncryptedMessage); + String decrypted = Memo.decryptMessage(destinationPrivate, sourceAddress, shortEncryptedMessageNonce, shortEncryptedMessage); System.out.println("Short Decrypted Message: " + decrypted); assertEquals("Decrypted message must be equal to original", decrypted, shortMessage); } catch (ChecksumException e) { @@ -99,7 +79,11 @@ public class MemoTest { @Test public void shouldDecryptLongerMessage(){ try{ - String longDecrypted = Memo.decryptMessage(destinationPrivate, sourceAddress, nonce, longerEncryptedMessage); + System.out.println("Source address: "+sourceAddress.toString()); + System.out.println("Dest address..: "+new Address(ECKey.fromPublicOnly(ECKey.fromPrivate(destinationPrivate.getPrivKeyBytes()).getPubKey())).toString()); + System.out.println("Nonce.........: "+longEncryptedMessageNonce); + System.out.println("Encrypted msg.: "+Util.bytesToHex(longerEncryptedMessage)); + String longDecrypted = Memo.decryptMessage(destinationPrivate, sourceAddress, longEncryptedMessageNonce, longerEncryptedMessage); System.out.println("Long Decrypted Message: " + longDecrypted); assertEquals("The longer message must be equal to the original", longerMessage, longDecrypted); } catch (ChecksumException e) { @@ -110,6 +94,7 @@ public class MemoTest { @Test public void shouldEncryptAndDecryptShortMessage(){ try { + long nonce = 1; byte[] encrypted = Memo.encryptMessage(sourcePrivate, destinationAddress, nonce, shortMessage); String decrypted = Memo.decryptMessage(destinationPrivate, sourceAddress, nonce, encrypted); System.out.println("Short Decrypted Message: " + decrypted); @@ -122,6 +107,7 @@ public class MemoTest { @Test public void shouldEncryptAndDecryptLongerMessage(){ try{ + long nonce = 1; byte[] longEncrypted = Memo.encryptMessage(sourcePrivate, destinationAddress, nonce, longerMessage); String longDecrypted = Memo.decryptMessage(destinationPrivate, sourceAddress, nonce, longEncrypted); System.out.println("Long Decrypted Message: " + longDecrypted); @@ -133,22 +119,22 @@ public class MemoTest { @Test(expected = ChecksumException.class) public void shouldThrowException() throws ChecksumException { - byte[] corrupted = Memo.encryptMessage(sourcePrivate, destinationAddress, nonce, longerMessage); + byte[] corrupted = Memo.encryptMessage(sourcePrivate, destinationAddress, longEncryptedMessageNonce, longerMessage); corrupted[0] = 0; - String longDecrypted = Memo.decryptMessage(destinationPrivate, sourceAddress, nonce, corrupted); + String longDecrypted = Memo.decryptMessage(destinationPrivate, sourceAddress, longEncryptedMessageNonce, corrupted); } @Test public void shouldBeJsonObjectSerializable(){ - byte[] encrypted = Memo.encryptMessage(sourcePrivate, destinationAddress, 1, shortMessage); - Memo memo = new Memo(sourceAddress, destinationAddress, 1, encrypted); + byte[] encrypted = Memo.encryptMessage(sourcePrivate, destinationAddress, shortEncryptedMessageNonce, shortMessage); + Memo memo = new Memo(sourceAddress, destinationAddress, shortEncryptedMessageNonce, encrypted); JsonElement jsonObject = memo.toJsonObject(); - JsonObject reference = new JsonObject(); - reference.addProperty("from", "BTS8RiFgs8HkcVPVobHLKEv6yL3iXcC9SWjbPVS15dDAXLG9GYhnY"); - reference.addProperty("to", "BTS8ADjGaswhfFoxMGxqCdBtzhTBJsrGadCLoc9Ey5AGc8eoVZ5bV"); - reference.addProperty("nonce", "1"); - reference.addProperty("message", "4c81c2db6ebc61e3f9e0ead65c0559dd"); - assertEquals("Memo instance should generate a valid JsonObject",jsonObject, reference); + JsonObject expected = new JsonObject(); + expected.addProperty("from", new Address(ECKey.fromPublicOnly(ECKey.fromPrivate(DumpedPrivateKey.fromBase58(null, MemoTestAccounts.Bilthon16.WIF).getKey().getPrivKeyBytes()).getPubKey())).toString()); + expected.addProperty("to", new Address(ECKey.fromPublicOnly(ECKey.fromPrivate(DumpedPrivateKey.fromBase58(null, MemoTestAccounts.Bilthon7.WIF).getKey().getPrivKeyBytes()).getPubKey())).toString()); + expected.addProperty("nonce", String.format("%d", shortEncryptedMessageNonce)); + expected.addProperty("message", "93c398e05f2a36a535f82880032a062d"); + assertEquals("Memo instance should generate a valid JsonObject",expected, jsonObject); } @Test From 3449e97b5b22d557fd4e59a90be7ce1f3badea48 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 2 Nov 2017 16:09:15 -0500 Subject: [PATCH 11/49] Hardcoding additional account information and thus making the tx test self-contained --- ...emoTestAccounts.java => TestAccounts.java} | 8 +++++- .../cy/agorise/graphenej/TransactionTest.java | 27 ++++++++++--------- .../agorise/graphenej/objects/MemoTest.java | 10 +++---- 3 files changed, 26 insertions(+), 19 deletions(-) rename graphenej/src/test/java/cy/agorise/graphenej/{MemoTestAccounts.java => TestAccounts.java} (68%) diff --git a/graphenej/src/test/java/cy/agorise/graphenej/MemoTestAccounts.java b/graphenej/src/test/java/cy/agorise/graphenej/TestAccounts.java similarity index 68% rename from graphenej/src/test/java/cy/agorise/graphenej/MemoTestAccounts.java rename to graphenej/src/test/java/cy/agorise/graphenej/TestAccounts.java index e34ee01..5eebf78 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/MemoTestAccounts.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/TestAccounts.java @@ -4,7 +4,13 @@ package cy.agorise.graphenej; * Created by nelson on 11/2/17. */ -public class MemoTestAccounts { +public class TestAccounts { + + public class Bilthon5 { + public static final String BRAINKEY = "TIGROID BUTLER GALLOWS PAKEHA MOONJAH ACARI LUPUS BAE ACRISIA ABBACY BASSOON AKUND"; + public static final String WIF = "5Jr84yteNbomGgLq5nvH2Y6WYJCBTsjugPouCtggfS3RguqxDo8"; + } + public class Bilthon7 { public static final String BRAINKEY = "PUMPER ISOTOME SERE STAINER CLINGER MOONLIT CHAETA UPBRIM AEDILIC BERTHER NIT SHAP SAID SHADING JUNCOUS CHOUGH"; public static final String WIF = "5J96pne45qWM1WpektoeazN6k9Mt93jQ7LyueRxFfEMTiy6yxjM"; diff --git a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java index b2de5c3..ea13bd6 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java @@ -33,12 +33,11 @@ import cy.agorise.graphenej.test.NaiveSSLContext; * Created by nelson on 3/6/17. */ public class TransactionTest { - private final String BILTHON_15_BRAIN_KEY = System.getenv("BILTHON_15_BRAINKEY"); - private final String BILTHON_5_BRAIN_KEY = System.getenv("BILTHON_5_BRAINKEY"); - private final String BILTHON_16_BRAIN_KEY = System.getenv("BILTHON_16_BRAINKEY"); + private final String BILTHON_7_BRAIN_KEY = TestAccounts.Bilthon7.BRAINKEY; + private final String BILTHON_5_BRAIN_KEY = TestAccounts.Bilthon5.BRAINKEY; + private final String BILTHON_16_BRAIN_KEY = TestAccounts.Bilthon16.BRAINKEY; - private final String BLOCK_PAY_DE = System.getenv("BLOCKPAY_DE"); - private final String BLOCK_PAY_FR = System.getenv("BLOCKPAY_FR"); + private final String NODE_URL = "wss://eu.openledger.info/ws"; // Transfer operation transaction private final Asset CORE_ASSET = new Asset("1.3.0"); @@ -53,6 +52,8 @@ public class TransactionTest { private AssetAmount minToReceive = new AssetAmount(UnsignedLong.valueOf(520), BIT_USD); private long expiration; + private final long FEE_AMOUNT = 21851; + // Lock object private static final class Lock { } private final Object lockObject = new Lock(); @@ -106,7 +107,7 @@ public class TransactionTest { // Set the custom SSL context. factory.setSSLContext(context); - WebSocket mWebSocket = factory.createSocket(BLOCK_PAY_DE); + WebSocket mWebSocket = factory.createSocket(NODE_URL); mWebSocket.addListener(new TransactionBroadcastSequence(transaction, CORE_ASSET, responseListener)); mWebSocket.connect(); @@ -137,7 +138,7 @@ public class TransactionTest { @Test public void testTransferTransaction(){ - ECKey sourcePrivateKey = new BrainKey(BILTHON_15_BRAIN_KEY, 0).getPrivateKey(); + ECKey sourcePrivateKey = new BrainKey(BILTHON_7_BRAIN_KEY, 0).getPrivateKey(); PublicKey to1 = new PublicKey(ECKey.fromPublicOnly(new BrainKey(BILTHON_5_BRAIN_KEY, 0).getPublicKey())); PublicKey to2 = new PublicKey(ECKey.fromPublicOnly(new BrainKey(BILTHON_16_BRAIN_KEY, 0).getPublicKey())); @@ -151,7 +152,7 @@ public class TransactionTest { .setTransferAmount(new AssetAmount(UnsignedLong.valueOf(1), CORE_ASSET)) .setSource(bilthon_15) .setDestination(bilthon_5) // bilthon-5 - .setFee(new AssetAmount(UnsignedLong.valueOf(264174), CORE_ASSET)) + .setFee(new AssetAmount(UnsignedLong.valueOf(FEE_AMOUNT), CORE_ASSET)) .build(); // Creating operation 2 @@ -159,7 +160,7 @@ public class TransactionTest { .setTransferAmount(new AssetAmount(UnsignedLong.valueOf(1), CORE_ASSET)) .setSource(bilthon_15) // bilthon-15 .setDestination(bilthon_16) // bilthon-16 - .setFee(new AssetAmount(UnsignedLong.valueOf(264174), CORE_ASSET)) + .setFee(new AssetAmount(UnsignedLong.valueOf(FEE_AMOUNT), CORE_ASSET)) .build(); @@ -174,7 +175,7 @@ public class TransactionTest { @Test public void testLimitOrderCreateTransaction(){ - ECKey privateKey = new BrainKey(BILTHON_15_BRAIN_KEY, 0).getPrivateKey(); + ECKey privateKey = new BrainKey(BILTHON_7_BRAIN_KEY, 0).getPrivateKey(); expiration = (System.currentTimeMillis() / 1000) + 60 * 60; // Creating limit order creation operation @@ -210,7 +211,7 @@ public class TransactionTest { public void testLimitOrderCancelTransaction() throws NoSuchAlgorithmException, IOException, WebSocketException { // We first must create a limit order for this test - ECKey privateKey = new BrainKey(BILTHON_15_BRAIN_KEY, 0).getPrivateKey(); + ECKey privateKey = new BrainKey(BILTHON_7_BRAIN_KEY, 0).getPrivateKey(); expiration = (System.currentTimeMillis() / 1000) + 60 * 5; // Creating limit order creation operation @@ -237,7 +238,7 @@ public class TransactionTest { // Set the custom SSL context. factory.setSSLContext(context); - WebSocket mWebSocket = factory.createSocket(BLOCK_PAY_DE); + WebSocket mWebSocket = factory.createSocket(NODE_URL); // Requesting limit order to cancel (Task 2) mWebSocket.addListener(new GetLimitOrders(base.getObjectId(), quote.getObjectId(), 100, new WitnessResponseListener() { @@ -250,7 +251,7 @@ public class TransactionTest { if(order.getSeller().getObjectId().equals(bilthon_15.getObjectId())){ // Instantiating a private key for bilthon-15 - ECKey privateKey = new BrainKey(BILTHON_15_BRAIN_KEY, 0).getPrivateKey(); + ECKey privateKey = new BrainKey(BILTHON_7_BRAIN_KEY, 0).getPrivateKey(); // Creating limit order cancellation operation LimitOrderCancelOperation operation = new LimitOrderCancelOperation(order, bilthon_15); diff --git a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java index 68055c5..b8a37b3 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java @@ -11,7 +11,7 @@ import org.junit.Before; import org.junit.Test; import cy.agorise.graphenej.Address; -import cy.agorise.graphenej.MemoTestAccounts; +import cy.agorise.graphenej.TestAccounts; import cy.agorise.graphenej.PublicKey; import cy.agorise.graphenej.Util; import cy.agorise.graphenej.errors.ChecksumException; @@ -30,8 +30,8 @@ public class MemoTest { private ECKey destinationPrivate; private Address destinationAddress; - private String sourceWIF = MemoTestAccounts.Bilthon16.WIF; - private String destinationWIF = MemoTestAccounts.Bilthon7.WIF; + private String sourceWIF = TestAccounts.Bilthon16.WIF; + private String destinationWIF = TestAccounts.Bilthon7.WIF; private String shortMessage = "test"; private String longerMessage = "testing now longer string with some special charaters é ç o ú á í Í mMno!!"; @@ -130,8 +130,8 @@ public class MemoTest { Memo memo = new Memo(sourceAddress, destinationAddress, shortEncryptedMessageNonce, encrypted); JsonElement jsonObject = memo.toJsonObject(); JsonObject expected = new JsonObject(); - expected.addProperty("from", new Address(ECKey.fromPublicOnly(ECKey.fromPrivate(DumpedPrivateKey.fromBase58(null, MemoTestAccounts.Bilthon16.WIF).getKey().getPrivKeyBytes()).getPubKey())).toString()); - expected.addProperty("to", new Address(ECKey.fromPublicOnly(ECKey.fromPrivate(DumpedPrivateKey.fromBase58(null, MemoTestAccounts.Bilthon7.WIF).getKey().getPrivKeyBytes()).getPubKey())).toString()); + expected.addProperty("from", new Address(ECKey.fromPublicOnly(ECKey.fromPrivate(DumpedPrivateKey.fromBase58(null, TestAccounts.Bilthon16.WIF).getKey().getPrivKeyBytes()).getPubKey())).toString()); + expected.addProperty("to", new Address(ECKey.fromPublicOnly(ECKey.fromPrivate(DumpedPrivateKey.fromBase58(null, TestAccounts.Bilthon7.WIF).getKey().getPrivKeyBytes()).getPubKey())).toString()); expected.addProperty("nonce", String.format("%d", shortEncryptedMessageNonce)); expected.addProperty("message", "93c398e05f2a36a535f82880032a062d"); assertEquals("Memo instance should generate a valid JsonObject",expected, jsonObject); From 3ae4ca10bf91f8192c246e937bdc733a2421e5eb Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 2 Nov 2017 16:15:22 -0500 Subject: [PATCH 12/49] Small change to the setup of the memo test --- bilthon_16_to_bilthon_7_memo.diff | 53 +++++++++++++++++++ .../agorise/graphenej/objects/MemoTest.java | 18 +++---- 2 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 bilthon_16_to_bilthon_7_memo.diff diff --git a/bilthon_16_to_bilthon_7_memo.diff b/bilthon_16_to_bilthon_7_memo.diff new file mode 100644 index 0000000..6e03f7e --- /dev/null +++ b/bilthon_16_to_bilthon_7_memo.diff @@ -0,0 +1,53 @@ +diff --git a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java +index fa787e0..288be8f 100644 +--- a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java ++++ b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java +@@ -2,13 +2,16 @@ package cy.agorise.graphenej.objects; + + import com.google.gson.JsonElement; + import com.google.gson.JsonObject; ++ ++import org.bitcoinj.core.DumpedPrivateKey; ++import org.bitcoinj.core.ECKey; ++import org.junit.Before; ++import org.junit.Test; ++ + import cy.agorise.graphenej.Address; + import cy.agorise.graphenej.PublicKey; + import cy.agorise.graphenej.Util; + import cy.agorise.graphenej.errors.ChecksumException; +-import org.bitcoinj.core.DumpedPrivateKey; +-import org.bitcoinj.core.ECKey; +-import org.junit.*; + + import static org.junit.Assert.assertArrayEquals; + import static org.junit.Assert.assertEquals; +@@ -34,7 +37,7 @@ public class MemoTest { + private String longerMessage = "testing now longer string with some special charaters é ç o ú á í Í mMno!!"; + + private byte[] shortEncryptedMessage = Util.hexToBytes("4c81c2db6ebc61e3f9e0ead65c0559dd"); +- private byte[] longerEncryptedMessage = Util.hexToBytes("1f8a08f1ff53dcefd48eeb052d26fba425f2a917f508ce61fc3d5696b10efa17"); ++ private byte[] longerEncryptedMessage = Util.hexToBytes("8ba8f5ed85ad9f7675bd30408a28d6f6ba138476d1e995dd61c01f0041ab25911e04d93fe4ce30e4f6c9a5134cceb67d653e140aa542da19ce2fc646bcde46e088da06a9327eaac79ffe8bc9d71d586195c04bb023995f18e66c9f9e5c6b0d7c"); + + private String decodedMessage; + +@@ -51,7 +54,7 @@ public class MemoTest { + destinationAddress = new Address(publicKey.getKey()); + + //memo.getNonce() +- nonce = 5; ++ nonce = 386469162162343L; + } + + @Test +@@ -88,6 +91,10 @@ public class MemoTest { + @Test + public void shouldDecryptLongerMessage(){ + try{ ++ System.out.println("Source address: "+sourceAddress.toString()); ++ System.out.println("Dest address..: "+new Address(ECKey.fromPublicOnly(ECKey.fromPrivate(destinationPrivate.getPrivKeyBytes()).getPubKey())).toString()); ++ System.out.println("Nonce.........: "+nonce); ++ System.out.println("Encrypted msg.: "+Util.bytesToHex(longerEncryptedMessage)); + String longDecrypted = Memo.decryptMessage(destinationPrivate, sourceAddress, nonce, longerEncryptedMessage); + System.out.println("Long Decrypted Message: " + longDecrypted); + assertEquals("The longer message must be equal to the original", longerMessage, longDecrypted); diff --git a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java index b8a37b3..8236536 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java @@ -43,17 +43,15 @@ public class MemoTest { @Before public void setUp() throws Exception { - if(sourceWIF != null && destinationWIF != null){ - //Source - sourcePrivate = DumpedPrivateKey.fromBase58(null, sourceWIF).getKey(); - PublicKey publicKey = new PublicKey(ECKey.fromPublicOnly(sourcePrivate.getPubKey())); - sourceAddress = new Address(publicKey.getKey()); + //Source + sourcePrivate = DumpedPrivateKey.fromBase58(null, sourceWIF).getKey(); + PublicKey publicKey = new PublicKey(ECKey.fromPublicOnly(sourcePrivate.getPubKey())); + sourceAddress = new Address(publicKey.getKey()); - //Destination - destinationPrivate = DumpedPrivateKey.fromBase58(null, destinationWIF).getKey(); - publicKey = new PublicKey(ECKey.fromPublicOnly(destinationPrivate.getPubKey())); - destinationAddress = new Address(publicKey.getKey()); - } + //Destination + destinationPrivate = DumpedPrivateKey.fromBase58(null, destinationWIF).getKey(); + publicKey = new PublicKey(ECKey.fromPublicOnly(destinationPrivate.getPubKey())); + destinationAddress = new Address(publicKey.getKey()); } @Test From 62b0a7501bf387ae8673e96a7b6e00ea192d2e0d Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 2 Nov 2017 17:44:14 -0500 Subject: [PATCH 13/49] Adding correct binary sequence that corresponds to the test memo #toBytes desired output --- .../src/test/java/cy/agorise/graphenej/objects/MemoTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java index 8236536..a8a3562 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java @@ -137,7 +137,7 @@ public class MemoTest { @Test public void shouldBeByteSerializable(){ - String byteReference = "0103d1fb8c7421db64d46fba7e36f428854ca06eff65698b293f37c7ffaa54e2c2b203aece7c31616c02fcc96b50d3397c0e8d33d6384655d477c300d9196c728a5ee20100000000000000104c81c2db6ebc61e3f9e0ead65c0559dd"; + String byteReference = "01029392096400eafe5f5ce7e2ab74134c3422fc49e5853bdeb298fb096258e26f6303d1fb8c7421db64d46fba7e36f428854ca06eff65698b293f37c7ffaa54e2c2b20100000000000000104ccbca3750fd2e531441de02b23fe6c7"; byte[] encrypted = Memo.encryptMessage(sourcePrivate, destinationAddress, 1, shortMessage); Memo memo = new Memo(sourceAddress, destinationAddress, 1, encrypted); byte[] memoBytes = memo.toBytes(); From 33a330f44ad434966fd8d566018cd9edb232a46c Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 2 Nov 2017 17:45:08 -0500 Subject: [PATCH 14/49] Fixing test case for the transfer operation transaction broadcast --- .../java/cy/agorise/graphenej/TransactionTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java index ea13bd6..1a176c3 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java @@ -41,13 +41,13 @@ public class TransactionTest { // Transfer operation transaction private final Asset CORE_ASSET = new Asset("1.3.0"); - private final UserAccount bilthon_15 = new UserAccount("1.2.143563"); + private final UserAccount bilthon_7 = new UserAccount("1.2.140994"); private final UserAccount bilthon_5 = new UserAccount("1.2.139313"); private final UserAccount bilthon_16 = new UserAccount("1.2.143569"); // Limit order create transaction private final Asset BIT_USD = new Asset("1.3.121"); - private UserAccount seller = bilthon_15; + private UserAccount seller = bilthon_7; private AssetAmount amountToSell = new AssetAmount(UnsignedLong.valueOf(100000), CORE_ASSET); private AssetAmount minToReceive = new AssetAmount(UnsignedLong.valueOf(520), BIT_USD); private long expiration; @@ -150,7 +150,7 @@ public class TransactionTest { // Creating operation 1 TransferOperation transferOperation1 = new TransferOperationBuilder() .setTransferAmount(new AssetAmount(UnsignedLong.valueOf(1), CORE_ASSET)) - .setSource(bilthon_15) + .setSource(bilthon_7) .setDestination(bilthon_5) // bilthon-5 .setFee(new AssetAmount(UnsignedLong.valueOf(FEE_AMOUNT), CORE_ASSET)) .build(); @@ -158,7 +158,7 @@ public class TransactionTest { // Creating operation 2 TransferOperation transferOperation2 = new TransferOperationBuilder() .setTransferAmount(new AssetAmount(UnsignedLong.valueOf(1), CORE_ASSET)) - .setSource(bilthon_15) // bilthon-15 + .setSource(bilthon_7) // bilthon-15 .setDestination(bilthon_16) // bilthon-16 .setFee(new AssetAmount(UnsignedLong.valueOf(FEE_AMOUNT), CORE_ASSET)) .build(); @@ -248,13 +248,13 @@ public class TransactionTest { System.out.println("onSuccess.1"); List orders = (List) response.result; for(LimitOrder order : orders){ - if(order.getSeller().getObjectId().equals(bilthon_15.getObjectId())){ + if(order.getSeller().getObjectId().equals(bilthon_7.getObjectId())){ // Instantiating a private key for bilthon-15 ECKey privateKey = new BrainKey(BILTHON_7_BRAIN_KEY, 0).getPrivateKey(); // Creating limit order cancellation operation - LimitOrderCancelOperation operation = new LimitOrderCancelOperation(order, bilthon_15); + LimitOrderCancelOperation operation = new LimitOrderCancelOperation(order, bilthon_7); ArrayList operationList = new ArrayList<>(); operationList.add(operation); From fc91f7366c39ea43193fcc5bcbd66f983e796990 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 2 Nov 2017 16:30:25 -0500 Subject: [PATCH 15/49] Experimentally changing the nonce type to BigInteger --- .../cy/agorise/graphenej/objects/Memo.java | 44 ++++++++++++------- .../cy/agorise/graphenej/TransactionTest.java | 3 +- .../agorise/graphenej/objects/MemoTest.java | 18 ++++---- 3 files changed, 41 insertions(+), 24 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java b/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java index f94a901..6472852 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java @@ -11,6 +11,7 @@ import org.bitcoinj.core.ECKey; import org.spongycastle.math.ec.ECPoint; import java.lang.reflect.Type; +import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; @@ -36,7 +37,7 @@ public class Memo implements ByteSerializable, JsonSerializable { private Address from; private Address to; - private long nonce; + private BigInteger nonce; private byte[] message; private String plaintextMessage; @@ -67,7 +68,7 @@ public class Memo implements ByteSerializable, JsonSerializable { * @param nonce: Nonce used in the encryption. * @param message: Message in ciphertext. */ - public Memo(Address from, Address to, long nonce, byte[] message){ + public Memo(Address from, Address to, BigInteger nonce, byte[] message){ this.from = from; this.to = to; this.nonce = nonce; @@ -90,7 +91,7 @@ public class Memo implements ByteSerializable, JsonSerializable { return this.to; } - public long getNonce(){ + public BigInteger getNonce(){ return this.nonce; } @@ -113,15 +114,17 @@ public class Memo implements ByteSerializable, JsonSerializable { * @param message: Plaintext message. * @return: The encrypted version of the message. */ - public static byte[] encryptMessage(ECKey privateKey, PublicKey publicKey, long nonce, String message){ + public static byte[] encryptMessage(ECKey privateKey, PublicKey publicKey, BigInteger nonce, String message){ byte[] encrypted = null; try { MessageDigest sha256 = MessageDigest.getInstance("SHA-256"); MessageDigest sha512 = MessageDigest.getInstance("SHA-512"); // Getting nonce bytes - String stringNonce = String.format("%d", nonce); - byte[] nonceBytes = Arrays.copyOfRange(Util.hexlify(stringNonce), 0, stringNonce.length()); + byte[] paddedNonceBytes = new byte[8]; + byte[] originalNonceBytes = nonce.toByteArray(); + System.arraycopy(originalNonceBytes, 0, paddedNonceBytes, 8 - originalNonceBytes.length, originalNonceBytes.length); +// byte[] nonceBytes = nonce.toByteArray(); // Getting shared secret byte[] secret = publicKey.getKey().getPubKeyPoint().multiply(privateKey.getPrivKey()).normalize().getXCoord().getEncoded(); @@ -129,7 +132,7 @@ public class Memo implements ByteSerializable, JsonSerializable { // SHA-512 of shared secret byte[] ss = sha512.digest(secret); - byte[] seed = Bytes.concat(nonceBytes, Util.hexlify(Util.bytesToHex(ss))); + byte[] seed = Bytes.concat(paddedNonceBytes, Util.hexlify(Util.bytesToHex(ss))); // Calculating checksum byte[] sha256Msg = sha256.digest(message.getBytes()); @@ -154,7 +157,7 @@ public class Memo implements ByteSerializable, JsonSerializable { * @param message: Plaintext message. * @return: The encrypted version of the message. */ - public static byte[] encryptMessage(ECKey privateKey, Address destinationAddress, long nonce, String message){ + public static byte[] encryptMessage(ECKey privateKey, Address destinationAddress, BigInteger nonce, String message){ return encryptMessage(privateKey, destinationAddress.getPublicKey(), nonce, message); } @@ -168,15 +171,19 @@ public class Memo implements ByteSerializable, JsonSerializable { * @return: The plaintext version of the enrcrypted message. * @throws ChecksumException */ - public static String decryptMessage(ECKey privateKey, PublicKey publicKey, long nonce, byte[] message) throws ChecksumException { + public static String decryptMessage(ECKey privateKey, PublicKey publicKey, BigInteger nonce, byte[] message) throws ChecksumException { String plaintext = ""; try { MessageDigest sha256 = MessageDigest.getInstance("SHA-256"); MessageDigest sha512 = MessageDigest.getInstance("SHA-512"); // Getting nonce bytes - String stringNonce = String.format("%d", nonce); - byte[] nonceBytes = Arrays.copyOfRange(Util.hexlify(stringNonce), 0, stringNonce.length()); + byte[] paddedNonceBytes = new byte[8]; + byte[] originalNonceBytes = nonce.toByteArray(); + System.arraycopy(originalNonceBytes, 0, paddedNonceBytes, 8 - originalNonceBytes.length, originalNonceBytes.length); + System.out.println("Nonce Bytes length......: "+originalNonceBytes.length); + System.out.println("Templated Bytes.........: "+Util.bytesToHex(originalNonceBytes)); + System.out.println("Nonce bytes.............: "+Util.bytesToHex(paddedNonceBytes)); // Getting shared secret byte[] secret = publicKey.getKey().getPubKeyPoint().multiply(privateKey.getPrivKey()).normalize().getXCoord().getEncoded(); @@ -184,7 +191,8 @@ public class Memo implements ByteSerializable, JsonSerializable { // SHA-512 of shared secret byte[] ss = sha512.digest(secret); - byte[] seed = Bytes.concat(nonceBytes, Util.hexlify(Util.bytesToHex(ss))); + byte[] seed = Bytes.concat(paddedNonceBytes, Util.hexlify(Util.bytesToHex(ss))); + System.out.println("seed: "+Util.bytesToHex(seed)); // Calculating checksum byte[] sha256Msg = sha256.digest(message); @@ -215,7 +223,7 @@ public class Memo implements ByteSerializable, JsonSerializable { * @return: The plaintext version of the enrcrypted message. * @throws ChecksumException */ - public static String decryptMessage(ECKey privateKey, Address sourceAddress, long nonce, byte[] message) throws ChecksumException { + public static String decryptMessage(ECKey privateKey, Address sourceAddress, BigInteger nonce, byte[] message) throws ChecksumException { return decryptMessage(privateKey, sourceAddress.getPublicKey(), nonce, message); } @@ -236,7 +244,7 @@ public class Memo implements ByteSerializable, JsonSerializable { new byte[]{(byte) this.message.length}, this.message); } else { - byte[] nonceBytes = Util.revertLong(nonce); + byte[] nonceBytes = Util.revertBytes(nonce.toByteArray()); ECPoint senderPoint = ECKey.compressPoint(from.getPublicKey().getKey().getPubKeyPoint()); PublicKey senderPublicKey = new PublicKey(ECKey.fromPublicOnly(senderPoint)); @@ -288,7 +296,13 @@ public class Memo implements ByteSerializable, JsonSerializable { JsonObject jsonObject = json.getAsJsonObject(); String fromAddress = jsonObject.get(KEY_FROM).getAsString(); String toAddress = jsonObject.get(KEY_TO).getAsString(); - long nonce = Long.parseLong(jsonObject.get(KEY_NONCE).getAsString(), 16); + BigInteger nonce; + System.out.println("Trying to deserialize memo with nonce: <"+jsonObject.get(KEY_NONCE).getAsString()+">"); + try{ + nonce = new BigInteger(jsonObject.get(KEY_NONCE).getAsString(), 10); + }catch(NumberFormatException e){ + nonce = new BigInteger(jsonObject.get(KEY_NONCE).getAsString(), 16); + } String msg = jsonObject.get(KEY_MESSAGE).getAsString(); Memo memo = null; try{ diff --git a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java index 1a176c3..a844699 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java @@ -11,6 +11,7 @@ import org.junit.Before; import org.junit.Test; import java.io.IOException; +import java.math.BigInteger; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.List; @@ -143,7 +144,7 @@ public class TransactionTest { PublicKey to2 = new PublicKey(ECKey.fromPublicOnly(new BrainKey(BILTHON_16_BRAIN_KEY, 0).getPublicKey())); // Creating memo - long nonce = 1; + BigInteger nonce = BigInteger.ONE; byte[] encryptedMessage = Memo.encryptMessage(sourcePrivateKey, to1, nonce, "another message"); Memo memo = new Memo(new Address(ECKey.fromPublicOnly(sourcePrivateKey.getPubKey())), new Address(to1.getKey()), nonce, encryptedMessage); diff --git a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java index a8a3562..c22172f 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java @@ -10,6 +10,8 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import java.math.BigInteger; + import cy.agorise.graphenej.Address; import cy.agorise.graphenej.TestAccounts; import cy.agorise.graphenej.PublicKey; @@ -36,10 +38,10 @@ public class MemoTest { private String longerMessage = "testing now longer string with some special charaters é ç o ú á í Í mMno!!"; private byte[] shortEncryptedMessage = Util.hexToBytes("93c398e05f2a36a535f82880032a062d"); - private long shortEncryptedMessageNonce = 386471255144360L; + private BigInteger shortEncryptedMessageNonce = new BigInteger("386471255144360"); private byte[] longerEncryptedMessage = Util.hexToBytes("8ba8f5ed85ad9f7675bd30408a28d6f6ba138476d1e995dd61c01f0041ab25911e04d93fe4ce30e4f6c9a5134cceb67d653e140aa542da19ce2fc646bcde46e088da06a9327eaac79ffe8bc9d71d586195c04bb023995f18e66c9f9e5c6b0d7c"); - private long longEncryptedMessageNonce = 386469162162343L; + private BigInteger longEncryptedMessageNonce = new BigInteger("386469162162343"); @Before public void setUp() throws Exception { @@ -92,7 +94,7 @@ public class MemoTest { @Test public void shouldEncryptAndDecryptShortMessage(){ try { - long nonce = 1; + BigInteger nonce = BigInteger.ONE; byte[] encrypted = Memo.encryptMessage(sourcePrivate, destinationAddress, nonce, shortMessage); String decrypted = Memo.decryptMessage(destinationPrivate, sourceAddress, nonce, encrypted); System.out.println("Short Decrypted Message: " + decrypted); @@ -105,7 +107,7 @@ public class MemoTest { @Test public void shouldEncryptAndDecryptLongerMessage(){ try{ - long nonce = 1; + BigInteger nonce = BigInteger.ONE; byte[] longEncrypted = Memo.encryptMessage(sourcePrivate, destinationAddress, nonce, longerMessage); String longDecrypted = Memo.decryptMessage(destinationPrivate, sourceAddress, nonce, longEncrypted); System.out.println("Long Decrypted Message: " + longDecrypted); @@ -138,20 +140,20 @@ public class MemoTest { @Test public void shouldBeByteSerializable(){ String byteReference = "01029392096400eafe5f5ce7e2ab74134c3422fc49e5853bdeb298fb096258e26f6303d1fb8c7421db64d46fba7e36f428854ca06eff65698b293f37c7ffaa54e2c2b20100000000000000104ccbca3750fd2e531441de02b23fe6c7"; - byte[] encrypted = Memo.encryptMessage(sourcePrivate, destinationAddress, 1, shortMessage); - Memo memo = new Memo(sourceAddress, destinationAddress, 1, encrypted); + byte[] encrypted = Memo.encryptMessage(sourcePrivate, destinationAddress, BigInteger.ONE, shortMessage); + Memo memo = new Memo(sourceAddress, destinationAddress, BigInteger.ONE, encrypted); byte[] memoBytes = memo.toBytes(); assertEquals("Memo instance should generate a valid byte array", byteReference, Util.bytesToHex(memoBytes)); } @Test public void shouldDeserializeFromString(){ - String jsonMemo = "{\"from\": \"BTS6nB7gw1EawYXRofLvuivLsboVmh2inXroQgSQqYfAc5Bamk4Vq\",\"to\": \"BTS4xAQGg2ePLeDGZvQFpsh9CjMhQvRnVkPp6jPoE6neVPotRfZX9\",\"nonce\": \"15f2d8ee4ec23\",\"message\": \"b9aeb7632f1f4281eedcf28a684828a42d02de71254fb88e13ddcb9a79adf51d9770c58d7e7efcdbb1515f1136c3be3e\"}"; + String jsonMemo = "{\"from\": \"BTS6nB7gw1EawYXRofLvuivLsboVmh2inXroQgSQqYfAc5Bamk4Vq\",\"to\": \"BTS4xAQGg2ePLeDGZvQFpsh9CjMhQvRnVkPp6jPoE6neVPotRfZX9\",\"nonce\": \"8000000000000000\",\"message\": \"b9aeb7632f1f4281eedcf28a684828a42d02de71254fb88e13ddcb9a79adf51d9770c58d7e7efcdbb1515f1136c3be3e\"}"; GsonBuilder gsonBuilder = new GsonBuilder().registerTypeAdapter(Memo.class, new Memo.MemoDeserializer()); Memo memo = gsonBuilder.create().fromJson(jsonMemo, Memo.class); Assert.assertEquals("Source address should match the serialized one", "BTS6nB7gw1EawYXRofLvuivLsboVmh2inXroQgSQqYfAc5Bamk4Vq", memo.getSource().toString()); Assert.assertEquals("Destination address should match the serialized one", "BTS4xAQGg2ePLeDGZvQFpsh9CjMhQvRnVkPp6jPoE6neVPotRfZX9", memo.getDestination().toString()); - Assert.assertEquals("Nonce should match serialized one", Long.parseLong("15f2d8ee4ec23", 16), memo.getNonce()); + Assert.assertEquals("Nonce should match serialized one", new BigInteger("8000000000000000", 10), memo.getNonce()); Assert.assertArrayEquals(Util.hexToBytes("b9aeb7632f1f4281eedcf28a684828a42d02de71254fb88e13ddcb9a79adf51d9770c58d7e7efcdbb1515f1136c3be3e"), memo.getByteMessage()); } } \ No newline at end of file From cf647a65badbd923d0f7eac777b228981a8df6cb Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 2 Nov 2017 17:32:55 -0500 Subject: [PATCH 16/49] Adding the memo in both test transfer operations --- .../src/test/java/cy/agorise/graphenej/TransactionTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java index a844699..6b9b1ad 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java @@ -154,6 +154,7 @@ public class TransactionTest { .setSource(bilthon_7) .setDestination(bilthon_5) // bilthon-5 .setFee(new AssetAmount(UnsignedLong.valueOf(FEE_AMOUNT), CORE_ASSET)) + .setMemo(memo) .build(); // Creating operation 2 @@ -162,6 +163,7 @@ public class TransactionTest { .setSource(bilthon_7) // bilthon-15 .setDestination(bilthon_16) // bilthon-16 .setFee(new AssetAmount(UnsignedLong.valueOf(FEE_AMOUNT), CORE_ASSET)) + .setMemo(memo) .build(); From 0192728bd5b3e7a3549fabf5b6abef07835b6252 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 2 Nov 2017 17:38:01 -0500 Subject: [PATCH 17/49] Using hexlify in order to obtain the bytes from the BigInteger nonce --- .../cy/agorise/graphenej/objects/Memo.java | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java b/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java index 6472852..8a12ada 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java @@ -121,10 +121,8 @@ public class Memo implements ByteSerializable, JsonSerializable { MessageDigest sha512 = MessageDigest.getInstance("SHA-512"); // Getting nonce bytes - byte[] paddedNonceBytes = new byte[8]; - byte[] originalNonceBytes = nonce.toByteArray(); - System.arraycopy(originalNonceBytes, 0, paddedNonceBytes, 8 - originalNonceBytes.length, originalNonceBytes.length); -// byte[] nonceBytes = nonce.toByteArray(); + String stringNonce = nonce.toString(); + byte[] nonceBytes = Arrays.copyOfRange(Util.hexlify(stringNonce), 0, stringNonce.length()); // Getting shared secret byte[] secret = publicKey.getKey().getPubKeyPoint().multiply(privateKey.getPrivKey()).normalize().getXCoord().getEncoded(); @@ -132,7 +130,7 @@ public class Memo implements ByteSerializable, JsonSerializable { // SHA-512 of shared secret byte[] ss = sha512.digest(secret); - byte[] seed = Bytes.concat(paddedNonceBytes, Util.hexlify(Util.bytesToHex(ss))); + byte[] seed = Bytes.concat(nonceBytes, Util.hexlify(Util.bytesToHex(ss))); // Calculating checksum byte[] sha256Msg = sha256.digest(message.getBytes()); @@ -178,12 +176,8 @@ public class Memo implements ByteSerializable, JsonSerializable { MessageDigest sha512 = MessageDigest.getInstance("SHA-512"); // Getting nonce bytes - byte[] paddedNonceBytes = new byte[8]; - byte[] originalNonceBytes = nonce.toByteArray(); - System.arraycopy(originalNonceBytes, 0, paddedNonceBytes, 8 - originalNonceBytes.length, originalNonceBytes.length); - System.out.println("Nonce Bytes length......: "+originalNonceBytes.length); - System.out.println("Templated Bytes.........: "+Util.bytesToHex(originalNonceBytes)); - System.out.println("Nonce bytes.............: "+Util.bytesToHex(paddedNonceBytes)); + String stringNonce = nonce.toString(); + byte[] nonceBytes = Arrays.copyOfRange(Util.hexlify(stringNonce), 0, stringNonce.length()); // Getting shared secret byte[] secret = publicKey.getKey().getPubKeyPoint().multiply(privateKey.getPrivKey()).normalize().getXCoord().getEncoded(); @@ -191,8 +185,7 @@ public class Memo implements ByteSerializable, JsonSerializable { // SHA-512 of shared secret byte[] ss = sha512.digest(secret); - byte[] seed = Bytes.concat(paddedNonceBytes, Util.hexlify(Util.bytesToHex(ss))); - System.out.println("seed: "+Util.bytesToHex(seed)); + byte[] seed = Bytes.concat(nonceBytes, Util.hexlify(Util.bytesToHex(ss))); // Calculating checksum byte[] sha256Msg = sha256.digest(message); @@ -244,7 +237,12 @@ public class Memo implements ByteSerializable, JsonSerializable { new byte[]{(byte) this.message.length}, this.message); } else { - byte[] nonceBytes = Util.revertBytes(nonce.toByteArray()); + + byte[] paddedNonceBytes = new byte[8]; + byte[] originalNonceBytes = nonce.toByteArray(); + System.arraycopy(originalNonceBytes, 0, paddedNonceBytes, 8 - originalNonceBytes.length, originalNonceBytes.length); + byte[] nonceBytes = Util.revertBytes(paddedNonceBytes); +// byte[] nonceBytes = Util.revertBytes(nonce.toByteArray()); ECPoint senderPoint = ECKey.compressPoint(from.getPublicKey().getKey().getPubKeyPoint()); PublicKey senderPublicKey = new PublicKey(ECKey.fromPublicOnly(senderPoint)); From 3d4b2719bb1d4726ad318f5d7fa4c70953f5417b Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 2 Nov 2017 17:57:15 -0500 Subject: [PATCH 18/49] Fixing memo toJsonObject test and deserializing memo's nonce only as a decimal number --- .../java/cy/agorise/graphenej/objects/Memo.java | 13 ++++++------- .../java/cy/agorise/graphenej/objects/MemoTest.java | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java b/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java index 8a12ada..27e1b3a 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java @@ -294,13 +294,12 @@ public class Memo implements ByteSerializable, JsonSerializable { JsonObject jsonObject = json.getAsJsonObject(); String fromAddress = jsonObject.get(KEY_FROM).getAsString(); String toAddress = jsonObject.get(KEY_TO).getAsString(); - BigInteger nonce; - System.out.println("Trying to deserialize memo with nonce: <"+jsonObject.get(KEY_NONCE).getAsString()+">"); - try{ - nonce = new BigInteger(jsonObject.get(KEY_NONCE).getAsString(), 10); - }catch(NumberFormatException e){ - nonce = new BigInteger(jsonObject.get(KEY_NONCE).getAsString(), 16); - } + + // Apparently the nonce is always coming from the full node as a string containing a + // decimal number. This is at odds with the result of the #toJsonObject method + // which encodes this data in hexadecimal. + BigInteger nonce = new BigInteger(jsonObject.get(KEY_NONCE).getAsString(), 10); + String msg = jsonObject.get(KEY_MESSAGE).getAsString(); Memo memo = null; try{ diff --git a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java index c22172f..190ce96 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java @@ -132,7 +132,7 @@ public class MemoTest { JsonObject expected = new JsonObject(); expected.addProperty("from", new Address(ECKey.fromPublicOnly(ECKey.fromPrivate(DumpedPrivateKey.fromBase58(null, TestAccounts.Bilthon16.WIF).getKey().getPrivKeyBytes()).getPubKey())).toString()); expected.addProperty("to", new Address(ECKey.fromPublicOnly(ECKey.fromPrivate(DumpedPrivateKey.fromBase58(null, TestAccounts.Bilthon7.WIF).getKey().getPrivKeyBytes()).getPubKey())).toString()); - expected.addProperty("nonce", String.format("%d", shortEncryptedMessageNonce)); + expected.addProperty("nonce", String.format("%x", shortEncryptedMessageNonce)); expected.addProperty("message", "93c398e05f2a36a535f82880032a062d"); assertEquals("Memo instance should generate a valid JsonObject",expected, jsonObject); } From da378506d909936e0ed267453ae59d722bb35f31 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Fri, 3 Nov 2017 00:18:06 -0500 Subject: [PATCH 19/49] v0.4.6-alpha0 --- gradle.properties | 4 ++-- graphenej/build.gradle | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index bfea545..a7a8496 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,8 +17,8 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME=0.4.5-SNAPSHOT -VERSION_CODE=7 +VERSION_NAME=0.4.6-alpha0 +VERSION_CODE=8 GROUP=com.github.bilthon POM_DESCRIPTION=A Java library for mobile app Developers; Graphene/Bitshares blockchain. diff --git a/graphenej/build.gradle b/graphenej/build.gradle index e0168b7..1eaa54e 100644 --- a/graphenej/build.gradle +++ b/graphenej/build.gradle @@ -21,8 +21,8 @@ android { defaultConfig { minSdkVersion 9 targetSdkVersion 24 - versionCode 7 - versionName "0.4.5-SNAPSHOT" + versionCode 8 + versionName "0.4.6-alpha0" vectorDrawables.useSupportLibrary = true } From b1c93a97e1e0a125aa3db666463c701a85faec25 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Fri, 3 Nov 2017 00:28:25 -0500 Subject: [PATCH 20/49] Replacing last argument of the NodeConnection#connect method for a NodeErrorListener instance --- .../agorise/graphenej/api/android/NodeConnection.java | 11 +++++++---- .../graphenej/api/android/NodeConnectionTest.java | 9 ++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/android/NodeConnection.java b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NodeConnection.java index 96632fc..9958aaf 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/android/NodeConnection.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/android/NodeConnection.java @@ -7,7 +7,6 @@ import cy.agorise.graphenej.api.BaseGrapheneHandler; import cy.agorise.graphenej.api.SubscriptionMessagesHub; import cy.agorise.graphenej.errors.RepeatedRequestIdException; import cy.agorise.graphenej.interfaces.NodeErrorListener; -import cy.agorise.graphenej.interfaces.WitnessResponseListener; import cy.agorise.graphenej.models.BaseResponse; /** @@ -17,10 +16,12 @@ import cy.agorise.graphenej.models.BaseResponse; * be used as a singleton under an application. */ public class NodeConnection { + /** * List of URLs of the nodes */ private List mUrlList; + /** * Index of the current node from the list */ @@ -28,8 +29,11 @@ public class NodeConnection { private WebsocketWorkerThread mThread; private SubscriptionMessagesHub mMessagesHub; private long requestCounter = SubscriptionMessagesHub.MANUAL_SUBSCRIPTION_ID + 1; - private WitnessResponseListener mErrorListener; + private NodeErrorListener mErrorListener; + /** + * Singleton instance + */ private static NodeConnection instance; private String mUser; @@ -56,7 +60,6 @@ public class NodeConnection { * @param url: URL of the node */ public void addNodeUrl(String url){ - System.out.println("addNodeUrl: "+url); this.mUrlList.add(url); } @@ -112,7 +115,7 @@ public class NodeConnection { * should be implemented by the party interested in being notified * about the failure of the desired broadcast operation. */ - public void connect(String user, String password, boolean subscribe, WitnessResponseListener errorListener) { + public void connect(String user, String password, boolean subscribe, NodeErrorListener errorListener) { if(mUrlList.size() > 0){ if(mUrlIndex < mUrlList.size()){ System.out.println("Connecting to: "+ this.mUrlList.get(mUrlIndex)); diff --git a/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java index f803d0f..35da61a 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java @@ -42,6 +42,7 @@ import cy.agorise.graphenej.api.LookupAssetSymbols; import cy.agorise.graphenej.api.TransactionBroadcastSequence; import cy.agorise.graphenej.errors.MalformedAddressException; import cy.agorise.graphenej.errors.RepeatedRequestIdException; +import cy.agorise.graphenej.interfaces.NodeErrorListener; import cy.agorise.graphenej.interfaces.WitnessResponseListener; import cy.agorise.graphenej.models.BaseResponse; import cy.agorise.graphenej.models.WitnessResponse; @@ -995,13 +996,7 @@ public class NodeConnectionTest { } - private WitnessResponseListener mErrorListener = new WitnessResponseListener() { - - @Override - public void onSuccess(WitnessResponse response) { - System.out.println("onSuccess"); - } - + private NodeErrorListener mErrorListener = new NodeErrorListener() { @Override public void onError(BaseResponse.Error error) { System.out.println("onError"); From e5ce587f68b2c10e7dfdfc7f0a10eafc048288d5 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Wed, 8 Nov 2017 19:01:42 -0500 Subject: [PATCH 21/49] Added test to non-existing node --- .../api/android/NodeConnectionTest.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java index 35da61a..e29db02 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java @@ -5,6 +5,8 @@ import com.neovisionaries.ws.client.WebSocket; import com.neovisionaries.ws.client.WebSocketException; import com.neovisionaries.ws.client.WebSocketFactory; +import junit.framework.Assert; + import org.bitcoinj.core.ECKey; import org.junit.Test; @@ -129,6 +131,31 @@ public class NodeConnectionTest { } } + @Test + public void testWrongUrl(){ + System.out.println("** Testing simple node connection with wrong URL **"); + nodeConnection = NodeConnection.getInstance(); + nodeConnection.addNodeUrl("wss://non-existing-host"); + nodeConnection.connect("", "", true, new NodeErrorListener() { + @Override + public void onError(BaseResponse.Error error) { + Assert.assertEquals("Can't connect, ran out of URLs!", error.message); + } + }); + + Timer timer = new Timer(); + timer.schedule(releaseTask, 5000); + + try{ + // Holding this thread while we get update notifications + synchronized (this){ + wait(); + } + }catch(InterruptedException e){ + System.out.println("InterruptedException. Msg: "+e.getMessage()); + } + } + /** * Test for NodeConnection's addNodeUrl and addNodeUrls working together. * From c8fe1ec9c4c7f639b2bd2e4e26eb2777174f6556 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 9 Nov 2017 15:08:35 -0500 Subject: [PATCH 22/49] Increasing the message ids of the SubscriptionMessagesHub increase monotonically --- gradle.properties | 2 +- graphenej/build.gradle | 2 +- .../graphenej/api/SubscriptionMessagesHub.java | 11 ++++++----- .../graphenej/api/SubscriptionMessagesHubTest.java | 1 + 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index a7a8496..c915c80 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME=0.4.6-alpha0 +VERSION_NAME=0.4.6-alpha1 VERSION_CODE=8 GROUP=com.github.bilthon diff --git a/graphenej/build.gradle b/graphenej/build.gradle index 1eaa54e..9e79ae6 100644 --- a/graphenej/build.gradle +++ b/graphenej/build.gradle @@ -22,7 +22,7 @@ android { minSdkVersion 9 targetSdkVersion 24 versionCode 8 - versionName "0.4.6-alpha0" + versionName "0.4.6-alpha1" vectorDrawables.useSupportLibrary = true } diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java b/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java index 594f3af..6cab2c8 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java @@ -140,17 +140,17 @@ public class SubscriptionMessagesHub extends BaseGrapheneHandler implements Subs String message = frame.getPayloadText(); System.out.println("<< "+message); if(currentId == LOGIN_ID){ + currentId = GET_DATABASE_ID; ArrayList emptyParams = new ArrayList<>(); ApiCall getDatabaseId = new ApiCall(1, RPC.CALL_DATABASE, emptyParams, RPC.VERSION, currentId); websocket.sendText(getDatabaseId.toJsonString()); - currentId++; }else if(currentId == GET_DATABASE_ID){ Type ApiIdResponse = new TypeToken>() {}.getType(); WitnessResponse witnessResponse = gson.fromJson(message, ApiIdResponse); databaseApiId = witnessResponse.result; subscribe(); - } else if(currentId == SUBSCRIPTION_REQUEST){ + } else if(currentId >= SUBSCRIPTION_REQUEST){ List subscriptionListeners = mSubscriptionDeserializer.getSubscriptionListeners(); if(!isUnsubscribing){ @@ -204,12 +204,12 @@ public class SubscriptionMessagesHub extends BaseGrapheneHandler implements Subs private void subscribe(){ isUnsubscribing = false; + currentId++; ArrayList subscriptionParams = new ArrayList<>(); subscriptionParams.add(String.format("%d", SUBSCRIPTION_NOTIFICATION)); subscriptionParams.add(clearFilter); - ApiCall getDatabaseId = new ApiCall(databaseApiId, RPC.CALL_SET_SUBSCRIBE_CALLBACK, subscriptionParams, RPC.VERSION, SUBSCRIPTION_REQUEST); + ApiCall getDatabaseId = new ApiCall(databaseApiId, RPC.CALL_SET_SUBSCRIBE_CALLBACK, subscriptionParams, RPC.VERSION, currentId); mWebsocket.sendText(getDatabaseId.toJsonString()); - currentId = SUBSCRIPTION_REQUEST; } /** @@ -235,7 +235,8 @@ public class SubscriptionMessagesHub extends BaseGrapheneHandler implements Subs isSubscribed = false; isUnsubscribing = true; - ApiCall unsubscribe = new ApiCall(databaseApiId, RPC.CALL_CANCEL_ALL_SUBSCRIPTIONS, new ArrayList(), RPC.VERSION, SUBSCRIPTION_REQUEST); + currentId++; + ApiCall unsubscribe = new ApiCall(databaseApiId, RPC.CALL_CANCEL_ALL_SUBSCRIPTIONS, new ArrayList(), RPC.VERSION, currentId); mWebsocket.sendText(unsubscribe.toJsonString()); // Clearing all subscription listeners diff --git a/graphenej/src/test/java/cy/agorise/graphenej/api/SubscriptionMessagesHubTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/SubscriptionMessagesHubTest.java index f0f3e29..b6f8fda 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/api/SubscriptionMessagesHubTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/SubscriptionMessagesHubTest.java @@ -20,6 +20,7 @@ import cy.agorise.graphenej.models.SubscriptionResponse; /** * Class used to encapsulate all tests that relate to the {@see SubscriptionMessagesHub} class. + * This test requires setting up the NODE_URL environment variable */ public class SubscriptionMessagesHubTest extends BaseApiTest { From 1e1838245155a975b6a995eeeb7a5fc8528364fa Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 9 Nov 2017 17:49:18 -0500 Subject: [PATCH 23/49] Avoiding a NullPointerException and using a sequential requestId in order to use this class with the NodeConnection --- .../graphenej/api/GetAccountBalances.java | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountBalances.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountBalances.java index e8afee3..e9fe872 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountBalances.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountBalances.java @@ -4,6 +4,13 @@ import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.neovisionaries.ws.client.WebSocket; import com.neovisionaries.ws.client.WebSocketFrame; + +import java.io.Serializable; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + import cy.agorise.graphenej.Asset; import cy.agorise.graphenej.AssetAmount; import cy.agorise.graphenej.RPC; @@ -12,12 +19,6 @@ import cy.agorise.graphenej.interfaces.WitnessResponseListener; import cy.agorise.graphenej.models.ApiCall; import cy.agorise.graphenej.models.WitnessResponse; -import java.io.Serializable; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - /** * Class that implements get_account_balances request handler. * @@ -29,7 +30,7 @@ import java.util.Map; * */ public class GetAccountBalances extends BaseGrapheneHandler { - + private UserAccount mUserAccount; private List mAssetList; private boolean mOneTime; @@ -71,12 +72,14 @@ public class GetAccountBalances extends BaseGrapheneHandler { public void onConnected(WebSocket websocket, Map> headers) throws Exception { ArrayList params = new ArrayList<>(); ArrayList assetList = new ArrayList<>(); - for(Asset asset : mAssetList){ - assetList.add(asset.getObjectId()); + if(mAssetList != null){ + for(Asset asset : mAssetList){ + assetList.add(asset.getObjectId()); + } } params.add(mUserAccount.getObjectId()); params.add(assetList); - ApiCall apiCall = new ApiCall(0, RPC.GET_ACCOUNT_BALANCES, params, RPC.VERSION, 0); + ApiCall apiCall = new ApiCall(0, RPC.GET_ACCOUNT_BALANCES, params, RPC.VERSION, requestId); websocket.sendText(apiCall.toJsonString()); } From 2d81979c084c83a2043c7244547a55f9b0f77572 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 9 Nov 2017 17:50:49 -0500 Subject: [PATCH 24/49] Only subscribing to events if the clearFilter variable is true, and also adding support for handlers added before the connection was established --- .../api/SubscriptionMessagesHub.java | 45 ++++++++++++++++--- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java b/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java index 6cab2c8..bbb3cfb 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java @@ -59,6 +59,7 @@ public class SubscriptionMessagesHub extends BaseGrapheneHandler implements Subs private int databaseApiId = -1; private int subscriptionCounter = 0; private HashMap mHandlerMap = new HashMap<>(); + private List pendingHandlerList = new ArrayList<>(); // State variables private boolean isUnsubscribing; @@ -149,7 +150,19 @@ public class SubscriptionMessagesHub extends BaseGrapheneHandler implements Subs WitnessResponse witnessResponse = gson.fromJson(message, ApiIdResponse); databaseApiId = witnessResponse.result; - subscribe(); + // Subscribing only if the clearFilter parameter is true + if(clearFilter){ + subscribe(); + } + + // Dispatching the onConnected event to every pending handler + if(pendingHandlerList.size() > 0){ + for(BaseGrapheneHandler handler : pendingHandlerList){ + handler.setRequestId(++currentId); + dispatchConnectionEvent(handler); + } + pendingHandlerList.clear(); + } } else if(currentId >= SUBSCRIPTION_REQUEST){ List subscriptionListeners = mSubscriptionDeserializer.getSubscriptionListeners(); @@ -264,13 +277,26 @@ public class SubscriptionMessagesHub extends BaseGrapheneHandler implements Subs subscriptionCounter = 0; } - public void addRequestHandler(BaseGrapheneHandler handler) throws RepeatedRequestIdException { - if(mHandlerMap.get(handler.getRequestId()) != null){ - throw new RepeatedRequestIdException("Already registered handler with id: "+handler.getRequestId()); + /** + * Adds a handler either to the map of handlers or to a list of pending ones + * @param handler The handler of a given request + * @throws RepeatedRequestIdException + */ + public void addRequestHandler(BaseGrapheneHandler handler) { + if(mWebsocket != null && currentId > SUBSCRIPTION_REQUEST){ + handler.setRequestId(++currentId); + mHandlerMap.put(handler.getRequestId(), handler); + dispatchConnectionEvent(handler); + }else{ + pendingHandlerList.add(handler); } + } - mHandlerMap.put(handler.getRequestId(), handler); - + /** + * Informing a handler that we have a connection with the full node. + * @param handler Handler that should be notified. + */ + private void dispatchConnectionEvent(BaseGrapheneHandler handler){ try { // Artificially calling the 'onConnected' method of the handler. // The underlying websocket was already connected, but from the WebSocketAdapter @@ -279,6 +305,13 @@ public class SubscriptionMessagesHub extends BaseGrapheneHandler implements Subs } catch (Exception e) { System.out.println("Exception. Msg: "+e.getMessage()); System.out.println("Exception type: "+e); + for(StackTraceElement el : e.getStackTrace()){ + System.out.println(String.format("at %s.%s(%s:%s)", + el.getClassName(), + el.getMethodName(), + el.getFileName(), + el.getLineNumber())); + } } } } From 2ea1fa9cc73f4fd042907b2297b1f3a6fcbc3f28 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 9 Nov 2017 17:51:29 -0500 Subject: [PATCH 25/49] Using a long data type for the sequenceId variable --- .../main/java/cy/agorise/graphenej/models/ApiCall.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/models/ApiCall.java b/graphenej/src/main/java/cy/agorise/graphenej/models/ApiCall.java index d6be686..58707ae 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/models/ApiCall.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/ApiCall.java @@ -6,13 +6,14 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -import cy.agorise.graphenej.interfaces.JsonSerializable; import java.io.Serializable; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; +import cy.agorise.graphenej.interfaces.JsonSerializable; + /** * Class used to build a Graphene websocket API call. * @see Websocket Calls & Notifications @@ -28,9 +29,9 @@ public class ApiCall implements JsonSerializable { public String jsonrpc; public List params; public int apiId; - public int sequenceId; + public long sequenceId; - public ApiCall(int apiId, String methodToCall, List params, String jsonrpc, int sequenceId){ + public ApiCall(int apiId, String methodToCall, List params, String jsonrpc, long sequenceId){ this.apiId = apiId; this.method = "call"; this.methodToCall = methodToCall; @@ -39,7 +40,7 @@ public class ApiCall implements JsonSerializable { this.sequenceId = sequenceId; } - public ApiCall(int apiId, String method, String methodToCall, List params, String jsonrpc, int sequenceId){ + public ApiCall(int apiId, String method, String methodToCall, List params, String jsonrpc, long sequenceId){ this.apiId = apiId; this.method = method; this.methodToCall = methodToCall; From 3406fcdd68af5843d583a630539072c0642d38a2 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 9 Nov 2017 17:53:28 -0500 Subject: [PATCH 26/49] Fixing the test for the GetAccountBalances API handler when used with the NodeConnection class --- .../api/android/NodeConnectionTest.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java index e29db02..f95c6c0 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/android/NodeConnectionTest.java @@ -67,8 +67,8 @@ public class NodeConnectionTest { private long BlOCK_TEST_NUMBER = 11000000; private Asset BTS = new Asset("1.3.0"); private Asset BLOCKPAY = new Asset("1.3.1072"); - private Asset BITDOLAR = new Asset("1.3.121"); //USD Smartcoin - private Asset BITEURO = new Asset("1.3.120"); //EUR Smartcoin + private Asset BITUSD = new Asset("1.3.121"); //USD Smartcoin + private Asset BITEUR = new Asset("1.3.120"); //EUR Smartcoin private NodeConnection nodeConnection; /** @@ -198,17 +198,20 @@ public class NodeConnectionTest { */ @Test public void testGetAccountBalancesRequest(){ + System.out.println("** Testing GetAccountBalances request **"); + int callbackCount = 0; nodeConnection = NodeConnection.getInstance(); nodeConnection.addNodeUrl(NODE_URL_1); nodeConnection.connect("", "", false, mErrorListener); System.out.println("Adding GetAccountBalances here"); + // Trying to get the balances of ACCOUNT_ID_1 for BTS, bitUSD & bitEUR try{ UserAccount userAccount = new UserAccount(ACCOUNT_ID_1); ArrayList assetList = new ArrayList<>(); assetList.add(BTS); - assetList.add(BITDOLAR); - assetList.add(BITEURO); + assetList.add(BITUSD); + assetList.add(BITEUR); System.out.println("Test: Request to discrete asset list"); nodeConnection.addRequestHandler(new GetAccountBalances(userAccount, assetList, false, new WitnessResponseListener(){ @Override @@ -225,6 +228,7 @@ public class NodeConnectionTest { System.out.println("RepeatedRequestIdException. Msg: "+e.getMessage()); } + // Trying to get the balances of ACCOUNT_ID_1 for all assets try{ UserAccount userAccount = new UserAccount(ACCOUNT_ID_1); System.out.println("Test: Request to all account' assets balance"); @@ -243,6 +247,8 @@ public class NodeConnectionTest { System.out.println("RepeatedRequestIdException. Msg: "+e.getMessage()); } + Timer timer = new Timer(); + timer.schedule(releaseTask, 10000); try{ // Holding this thread while we get update notifications synchronized (this){ @@ -618,7 +624,7 @@ public class NodeConnectionTest { ArrayList objectList = new ArrayList(){{ add(BLOCKPAY.getBitassetId()); add(BTS.getBitassetId()); - add(BITEURO.getBitassetId()); + add(BITEUR.getBitassetId()); }}; System.out.println("Adding GetObjects request"); @@ -916,7 +922,7 @@ public class NodeConnectionTest { ArrayList assetList = new ArrayList(){{ add(BLOCKPAY); add(BTS); - add(BITEURO); + add(BITEUR); }}; System.out.println("Adding LookupAssetSymbols request"); @@ -960,7 +966,7 @@ public class NodeConnectionTest { ArrayList assetList = new ArrayList(){{ add(BLOCKPAY); add(BTS); - add(BITEURO); + add(BITEUR); }}; ECKey privateKey = new BrainKey(TEST_ACCOUNT_BRAIN_KEY, 0).getPrivateKey(); From 70b251a665393ddf88566d8d6859cb28461966fa Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 9 Nov 2017 18:21:41 -0500 Subject: [PATCH 27/49] Adding support for a string-based query when using the LookupAssetSymbols API --- .../graphenej/api/LookupAssetSymbols.java | 15 +++-- .../graphenej/api/LookupAssetSymbolsTest.java | 60 +++++++++++++++++++ 2 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 graphenej/src/test/java/cy/agorise/graphenej/api/LookupAssetSymbolsTest.java diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/LookupAssetSymbols.java b/graphenej/src/main/java/cy/agorise/graphenej/api/LookupAssetSymbols.java index d60f90c..d467dde 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/LookupAssetSymbols.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/LookupAssetSymbols.java @@ -28,7 +28,7 @@ import cy.agorise.graphenej.models.WitnessResponse; */ public class LookupAssetSymbols extends BaseGrapheneHandler { private WitnessResponseListener mListener; - private List assets; + private List assets; private boolean mOneTime; @@ -42,7 +42,7 @@ public class LookupAssetSymbols extends BaseGrapheneHandler { * be implemented by the party interested in being notified about the * success/failure of the operation. */ - public LookupAssetSymbols(List assets, boolean oneTime, WitnessResponseListener listener){ + public LookupAssetSymbols(List assets, boolean oneTime, WitnessResponseListener listener){ super(listener); this.assets = assets; this.mOneTime = oneTime; @@ -57,7 +57,7 @@ public class LookupAssetSymbols extends BaseGrapheneHandler { * be implemented by the party interested in being notified about the * success/failure of the operation. */ - public LookupAssetSymbols(List assets, WitnessResponseListener listener){ + public LookupAssetSymbols(List assets, WitnessResponseListener listener){ this(assets, true, listener); } @@ -65,8 +65,13 @@ public class LookupAssetSymbols extends BaseGrapheneHandler { public void onConnected(WebSocket websocket, Map> headers) throws Exception { ArrayList params = new ArrayList<>(); ArrayList subArray = new ArrayList<>(); - for(Asset asset : this.assets){ - subArray.add(asset.getObjectId()); + for(int i = 0; i < assets.size(); i++){ + Object obj = assets.get(i); + if(obj instanceof String){ + subArray.add((String) obj); + }else{ + subArray.add(((Asset) obj).getObjectId()); + } params.add(subArray); } ApiCall loginCall = new ApiCall(0, RPC.CALL_LOOKUP_ASSET_SYMBOLS, params, RPC.VERSION, 0); diff --git a/graphenej/src/test/java/cy/agorise/graphenej/api/LookupAssetSymbolsTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/LookupAssetSymbolsTest.java new file mode 100644 index 0000000..de0d13c --- /dev/null +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/LookupAssetSymbolsTest.java @@ -0,0 +1,60 @@ +package cy.agorise.graphenej.api; + +import junit.framework.Assert; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import cy.agorise.graphenej.Asset; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.WitnessResponse; + +/** + * Testing the standalone usage of the {@link LookupAssetSymbols} API handler. + */ + +public class LookupAssetSymbolsTest extends BaseApiTest { + + @Test + public void testLookupAssetSymbolsWithString(){ + ArrayList assetSymbols = new ArrayList<>(); + assetSymbols.add("USD"); + mWebSocket.addListener(new LookupAssetSymbols(assetSymbols, true, new WitnessResponseListener() { + @Override + public void onSuccess(WitnessResponse response) { + System.out.println("onSuccess"); + List assets = (List) response.result; + Assert.assertEquals(1, assets.size()); + Assert.assertEquals("1.3.121", assets.get(0).getObjectId()); + } + + @Override + public void onError(BaseResponse.Error error) { + System.out.println("onError"); + } + })); + } + + @Test + public void testLookupAssetSymbolsWithAsset(){ + ArrayList assetSymbols = new ArrayList<>(); + assetSymbols.add(new Asset("1.3.121")); + mWebSocket.addListener(new LookupAssetSymbols(assetSymbols, true, new WitnessResponseListener() { + @Override + public void onSuccess(WitnessResponse response) { + System.out.println("onSuccess"); + List assets = (List) response.result; + Assert.assertEquals(1, assets.size()); + Assert.assertEquals("1.3.121", assets.get(0).getObjectId()); + } + + @Override + public void onError(BaseResponse.Error error) { + System.out.println("onError"); + } + })); + } +} From c2287f5410d28b8f0adcf68f65384b5f46e211f4 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 9 Nov 2017 23:34:48 -0500 Subject: [PATCH 28/49] v0.4.6-alpha1 --- graphenej/build.gradle | 2 +- graphenej/src/main/AndroidManifest.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/graphenej/build.gradle b/graphenej/build.gradle index 9e79ae6..ad657fa 100644 --- a/graphenej/build.gradle +++ b/graphenej/build.gradle @@ -1,5 +1,5 @@ group 'cy.agorise' -version '0.4.5' +version '0.4.6-alpha1' apply plugin: 'com.android.library' apply from: 'maven-push.gradle' diff --git a/graphenej/src/main/AndroidManifest.xml b/graphenej/src/main/AndroidManifest.xml index 33b119d..4a5c4ef 100644 --- a/graphenej/src/main/AndroidManifest.xml +++ b/graphenej/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="8" + android:versionName="0.4.6-alpha1" > From 394ed4b3b0c115bc77bc3da83968583bd47a62ae Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 9 Nov 2017 23:52:50 -0500 Subject: [PATCH 29/49] Adding support for optional decimal or hex representations of the memo's nonce value in the newly introduced toJson method. Also introducing a Serializer --- .../cy/agorise/graphenej/objects/Memo.java | 61 ++++++++++++++++--- .../agorise/graphenej/objects/MemoTest.java | 11 +++- 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java b/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java index 27e1b3a..2f77218 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/objects/Memo.java @@ -1,11 +1,14 @@ package cy.agorise.graphenej.objects; import com.google.common.primitives.Bytes; +import com.google.gson.Gson; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; import org.bitcoinj.core.ECKey; import org.spongycastle.math.ec.ECPoint; @@ -259,21 +262,36 @@ public class Memo implements ByteSerializable, JsonSerializable { } } + /** + * Converts a memo instance to a String. + * + * The nonce is always encoded as a decimal number in a string field. + * @return + */ @Override public String toJsonString() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + Gson gson = new Gson(); + return gson.toJson(toJson(true)); } + /** + * Converts a memo instance into a JsonElement. + * + * This method differs from the {@link #toJson(boolean)} in that here the nonce is encoded as an + * hexadecimal number, while in that one we offer the user to choose either the decimal or hexadecimal + * representations. + * + * @return JsonObject instance representing this memo + */ @Override public JsonElement toJsonObject() { JsonObject memoObject = new JsonObject(); if ((this.from == null) && (this.to == null)) { - // Public memo - // TODO: Add public memo support -// memoObject.addProperty(KEY_FROM, ""); -// memoObject.addProperty(KEY_TO, ""); -// memoObject.addProperty(KEY_NONCE, ""); -// memoObject.addProperty(KEY_MESSAGE, Util.bytesToHex(this.message)); + // TODO: Check if this public memo serialization is accepted + memoObject.addProperty(KEY_FROM, ""); + memoObject.addProperty(KEY_TO, ""); + memoObject.addProperty(KEY_NONCE, ""); + memoObject.addProperty(KEY_MESSAGE, Util.bytesToHex(this.message)); return null; }else{ memoObject.addProperty(KEY_FROM, this.from.toString()); @@ -284,6 +302,22 @@ public class Memo implements ByteSerializable, JsonSerializable { return memoObject; } + /** + * Method that converts the memo into a JsonObject. + * + * @param decimal If true, the nonce is saved as string containing a decimal number representation. + * @return JsonObject instance representing this memo + */ + public JsonElement toJson(boolean decimal){ + JsonElement jsonElement = toJsonObject(); + if(decimal){ + JsonObject jsonObject = (JsonObject) jsonElement; + BigInteger nonce = new BigInteger(jsonObject.get(KEY_NONCE).getAsString(), 16); + jsonObject.addProperty(KEY_NONCE, nonce.toString()); + } + return jsonElement; + } + /** * Class used to deserialize a memo */ @@ -314,4 +348,15 @@ public class Memo implements ByteSerializable, JsonSerializable { return memo; } } -} \ No newline at end of file + + /** + * Class used to serialize a memo + */ + public static class MemoSerializer implements JsonSerializer { + + @Override + public JsonElement serialize(Memo memo, Type typeOfSrc, JsonSerializationContext context) { + return memo.toJson(true); + } + } + } \ No newline at end of file diff --git a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java index 190ce96..303b140 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java @@ -13,8 +13,8 @@ import org.junit.Test; import java.math.BigInteger; import cy.agorise.graphenej.Address; -import cy.agorise.graphenej.TestAccounts; import cy.agorise.graphenej.PublicKey; +import cy.agorise.graphenej.TestAccounts; import cy.agorise.graphenej.Util; import cy.agorise.graphenej.errors.ChecksumException; @@ -148,12 +148,17 @@ public class MemoTest { @Test public void shouldDeserializeFromString(){ - String jsonMemo = "{\"from\": \"BTS6nB7gw1EawYXRofLvuivLsboVmh2inXroQgSQqYfAc5Bamk4Vq\",\"to\": \"BTS4xAQGg2ePLeDGZvQFpsh9CjMhQvRnVkPp6jPoE6neVPotRfZX9\",\"nonce\": \"8000000000000000\",\"message\": \"b9aeb7632f1f4281eedcf28a684828a42d02de71254fb88e13ddcb9a79adf51d9770c58d7e7efcdbb1515f1136c3be3e\"}"; - GsonBuilder gsonBuilder = new GsonBuilder().registerTypeAdapter(Memo.class, new Memo.MemoDeserializer()); + String jsonMemo = "{\"from\":\"BTS6nB7gw1EawYXRofLvuivLsboVmh2inXroQgSQqYfAc5Bamk4Vq\",\"to\":\"BTS4xAQGg2ePLeDGZvQFpsh9CjMhQvRnVkPp6jPoE6neVPotRfZX9\",\"nonce\":\"8000000000000000\",\"message\":\"b9aeb7632f1f4281eedcf28a684828a42d02de71254fb88e13ddcb9a79adf51d9770c58d7e7efcdbb1515f1136c3be3e\"}"; + GsonBuilder gsonBuilder = new GsonBuilder() + .registerTypeAdapter(Memo.class, new Memo.MemoSerializer()) + .registerTypeAdapter(Memo.class, new Memo.MemoDeserializer()); Memo memo = gsonBuilder.create().fromJson(jsonMemo, Memo.class); Assert.assertEquals("Source address should match the serialized one", "BTS6nB7gw1EawYXRofLvuivLsboVmh2inXroQgSQqYfAc5Bamk4Vq", memo.getSource().toString()); Assert.assertEquals("Destination address should match the serialized one", "BTS4xAQGg2ePLeDGZvQFpsh9CjMhQvRnVkPp6jPoE6neVPotRfZX9", memo.getDestination().toString()); Assert.assertEquals("Nonce should match serialized one", new BigInteger("8000000000000000", 10), memo.getNonce()); Assert.assertArrayEquals(Util.hexToBytes("b9aeb7632f1f4281eedcf28a684828a42d02de71254fb88e13ddcb9a79adf51d9770c58d7e7efcdbb1515f1136c3be3e"), memo.getByteMessage()); + + String json = gsonBuilder.create().toJson(memo); + Assert.assertEquals("Serialized memo matches the original one", jsonMemo, json); } } \ No newline at end of file From ab7f88d17cd854dab9eb44d72bfda10421bb9a59 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 16 Nov 2017 10:38:49 -0500 Subject: [PATCH 30/49] Version 0.4.6-alpha2 --- gradle.properties | 2 +- graphenej/build.gradle | 2 +- graphenej/src/main/AndroidManifest.xml | 2 +- .../java/cy/agorise/graphenej/api/GetAccountBalances.java | 2 +- .../graphenej/errors/RepeatedRequestIdException.java | 6 ++++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index c915c80..0c06e84 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME=0.4.6-alpha1 +VERSION_NAME=0.4.6-alpha2 VERSION_CODE=8 GROUP=com.github.bilthon diff --git a/graphenej/build.gradle b/graphenej/build.gradle index ad657fa..59848d2 100644 --- a/graphenej/build.gradle +++ b/graphenej/build.gradle @@ -1,5 +1,5 @@ group 'cy.agorise' -version '0.4.6-alpha1' +version '0.4.6-alpha2' apply plugin: 'com.android.library' apply from: 'maven-push.gradle' diff --git a/graphenej/src/main/AndroidManifest.xml b/graphenej/src/main/AndroidManifest.xml index 4a5c4ef..fe1ec3a 100644 --- a/graphenej/src/main/AndroidManifest.xml +++ b/graphenej/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ + android:versionName="0.4.6-alpha2" > diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountBalances.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountBalances.java index e9fe872..5d65de3 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountBalances.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetAccountBalances.java @@ -30,7 +30,7 @@ import cy.agorise.graphenej.models.WitnessResponse; * */ public class GetAccountBalances extends BaseGrapheneHandler { - + private UserAccount mUserAccount; private List mAssetList; private boolean mOneTime; diff --git a/graphenej/src/main/java/cy/agorise/graphenej/errors/RepeatedRequestIdException.java b/graphenej/src/main/java/cy/agorise/graphenej/errors/RepeatedRequestIdException.java index 587095c..ce8dd6f 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/errors/RepeatedRequestIdException.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/errors/RepeatedRequestIdException.java @@ -1,11 +1,13 @@ package cy.agorise.graphenej.errors; +import cy.agorise.graphenej.api.BaseGrapheneHandler; + /** - * Created by nelson on 6/27/17. + * Thrown by the {@link cy.agorise.graphenej.api.SubscriptionMessagesHub#addRequestHandler(BaseGrapheneHandler)} + * whenever the user tries to register a new handler with a previously registered id */ public class RepeatedRequestIdException extends Exception { - public RepeatedRequestIdException(String message){ super(message); } From 3796ed5f81853205604b57f0a54d1fb6d004422f Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Fri, 17 Nov 2017 16:46:26 -0500 Subject: [PATCH 31/49] Updating the OrderBook class, adding #calculateObtainedQuote and #calculateRequiredBase methods --- .../java/cy/agorise/graphenej/LimitOrder.java | 9 +- .../java/cy/agorise/graphenej/OrderBook.java | 107 +++++++++++------- .../cy/agorise/graphenej/OrderBookTest.java | 64 +++++++++++ .../graphenej/api/GetLimitOrdersTest.java | 48 +------- 4 files changed, 141 insertions(+), 87 deletions(-) create mode 100644 graphenej/src/test/java/cy/agorise/graphenej/OrderBookTest.java diff --git a/graphenej/src/main/java/cy/agorise/graphenej/LimitOrder.java b/graphenej/src/main/java/cy/agorise/graphenej/LimitOrder.java index 8d26d76..50a5c33 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/LimitOrder.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/LimitOrder.java @@ -1,5 +1,6 @@ package cy.agorise.graphenej; +import com.google.common.primitives.UnsignedLong; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; @@ -28,7 +29,7 @@ public class LimitOrder extends GrapheneObject implements ByteSerializable { private String expiration; private UserAccount seller; - private long forSale; + private UnsignedLong forSale; private long deferredFee; private Price sellPrice; @@ -52,11 +53,11 @@ public class LimitOrder extends GrapheneObject implements ByteSerializable { this.seller = seller; } - public long getForSale() { + public UnsignedLong getForSale() { return forSale; } - public void setForSale(long forSale) { + public void setForSale(UnsignedLong forSale) { this.forSale = forSale; } @@ -127,7 +128,7 @@ public class LimitOrder extends GrapheneObject implements ByteSerializable { LimitOrder limitOrder = new LimitOrder(id); limitOrder.setExpiration(expiration); limitOrder.setSeller(seller); - limitOrder.setForSale(Long.parseLong(forSale)); + limitOrder.setForSale(UnsignedLong.valueOf(forSale)); limitOrder.setSellPrice(price); limitOrder.setDeferredFee(deferredFee); return limitOrder; diff --git a/graphenej/src/main/java/cy/agorise/graphenej/OrderBook.java b/graphenej/src/main/java/cy/agorise/graphenej/OrderBook.java index 2fceb6a..a2abb60 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/OrderBook.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/OrderBook.java @@ -1,9 +1,7 @@ package cy.agorise.graphenej; -import com.google.common.math.DoubleMath; import com.google.common.primitives.UnsignedLong; -import java.math.RoundingMode; import java.util.List; import cy.agorise.graphenej.operations.LimitOrderCreateOperation; @@ -14,9 +12,9 @@ import cy.agorise.graphenej.operations.LimitOrderCreateOperation; * It also provides a handy method that should return the appropriate LimitOrderCreateOperation * object needed in case the user wants to perform market-priced operations. * - * It is important to keep the order book updated, ideally by listening to blockchain events, and calling the 'update' method. + * It is important to keep the order book updated, ideally by listening to blockchain events, + * and calling the 'update' method. * - * Created by nelson on 3/25/17. */ public class OrderBook { private List limitOrders; @@ -52,53 +50,86 @@ public class OrderBook { * @return An instance of the LimitOrderCreateOperation class, which is ready to be broadcasted. */ public LimitOrderCreateOperation exchange(UserAccount seller, Asset myBaseAsset, AssetAmount myQuoteAmount, int expiration){ - AssetAmount toSell = new AssetAmount(UnsignedLong.valueOf(calculateRequiredBase(myQuoteAmount)), myBaseAsset); + AssetAmount toSell = new AssetAmount(calculateRequiredBase(myQuoteAmount), myBaseAsset); AssetAmount toReceive = myQuoteAmount; LimitOrderCreateOperation buyOrder = new LimitOrderCreateOperation(seller, toSell, toReceive, expiration, true); return buyOrder; } + public LimitOrderCreateOperation exchange(UserAccount seller, AssetAmount baseAmount, Asset quoteAsset, int expiration){ + AssetAmount minToReceive = new AssetAmount(calculateObtainedQuote(baseAmount), quoteAsset); + return new LimitOrderCreateOperation(seller, baseAmount, minToReceive, expiration, true); + } + /** - * Given a specific amount of a desired asset, this method will calculate how much of the corresponding - * asset we need to offer to perform a successful transaction with the current order book. - * @param quoteAmount: The amount of the desired asset. - * @return: The minimum amount of the base asset that we need to give away + * Method that calculates the amount of an asset that we will obtain (the quote amount) if we trade + * a known fixed amount of the asset we already have (the base amount). + * + * @param baseAmount The fixed amount of the asset we have and want to sell + * @return The equivalent amount to receive in exchange of the base amount */ - public long calculateRequiredBase(AssetAmount quoteAmount){ - long totalBought = 0; - long totalSold = 0; - for(int i = 0; i < this.limitOrders.size() && totalBought < quoteAmount.getAmount().longValue(); i++){ - LimitOrder order = this.limitOrders.get(i); + public UnsignedLong calculateObtainedQuote(AssetAmount baseAmount){ + UnsignedLong myBase = baseAmount.getAmount(); + UnsignedLong obtainedQuote = UnsignedLong.ZERO; + for(int i = 0; i < limitOrders.size() && myBase.compareTo(UnsignedLong.ZERO) > 0; i++){ + LimitOrder order = limitOrders.get(i); - // If the base asset is the same as our quote asset, we have a match - if(order.getSellPrice().base.getAsset().getObjectId().equals(quoteAmount.getAsset().getObjectId())){ - // My quote amount, is the order's base amount - long orderAmount = order.getForSale(); + // Checking to make sure the order matches our needs + if(order.getSellPrice().quote.getAsset().equals(baseAmount.getAsset())){ + UnsignedLong orderBase = order.getSellPrice().base.getAmount(); + UnsignedLong orderQuote = order.getSellPrice().quote.getAmount(); + UnsignedLong availableBase = order.getForSale(); - // The amount of the quote asset we still need - long stillNeed = quoteAmount.getAmount().longValue() - totalBought; - - // If the offered amount is greater than what we still need, we exchange just what we need - if(orderAmount >= stillNeed) { - totalBought += stillNeed; - double additionalRatio = (double) stillNeed / (double) order.getSellPrice().base.getAmount().longValue(); - double additionalAmount = order.getSellPrice().quote.getAmount().longValue() * additionalRatio; - long longAdditional = DoubleMath.roundToLong(additionalAmount, RoundingMode.HALF_UP); - totalSold += longAdditional; + UnsignedLong myQuote = UnsignedLong.valueOf((long)(myBase.times(orderBase).doubleValue() / (orderQuote.doubleValue()))); + if(myQuote.compareTo(availableBase) > 0){ + // We consume this order entirely + // myBase = myBase - (for_sale) * (order_quote / order_base) + myBase = myBase.minus(availableBase.times(orderQuote).dividedBy(orderBase)); + // We need more than this order can offer us, but have to take in consideration how much there really is. + // (order base / order quote) x (available order base / order base) + UnsignedLong thisBatch = UnsignedLong.valueOf((long)(orderBase.times(availableBase).doubleValue() / orderQuote.times(orderBase).doubleValue())); + obtainedQuote = obtainedQuote.plus(thisBatch); }else{ - // If the offered amount is less than what we need, we exchange the whole order - totalBought += orderAmount; - - // The amount specified in the price ratio is not always all for sale. So in order to calculate - // the amount actually sold we have to do: - // actually_sold = for_sale * quote / base - double sellRatio = ((double) orderAmount) / ((double) order.getSellPrice().base.getAmount().longValue()); - - totalSold += Math.floor(order.getSellPrice().quote.getAmount().doubleValue() * sellRatio); + // This order consumes all our base asset + // obtained_quote = obtained_quote + (my base * order_base / order_quote) + obtainedQuote = obtainedQuote.plus(myBase.times(orderBase.dividedBy(orderQuote))); + myBase = UnsignedLong.ZERO; } } } - return totalSold; + return obtainedQuote; + } + + /** + * Method that calculates the amount of an asset that we will consume (the base amount) if we want to obtain + * a known fixed amount of another asset (the quote amount). + * @param quoteAmount The fixed amount of an asset that we want to obtain + * @return The amount of an asset we already have that will be consumed by the trade + */ + public UnsignedLong calculateRequiredBase(AssetAmount quoteAmount){ + UnsignedLong myQuote = quoteAmount.getAmount(); + UnsignedLong obtainedBase = UnsignedLong.ZERO; + for(int i = 0; i < limitOrders.size() && myQuote.compareTo(UnsignedLong.ZERO) > 0; i++){ + LimitOrder order = limitOrders.get(i); + + // Checking to make sure the order matches our needs + if(order.getSellPrice().base.getAsset().equals(quoteAmount.getAsset())){ + UnsignedLong orderBase = order.getSellPrice().base.getAmount(); + UnsignedLong orderQuote = order.getSellPrice().quote.getAmount(); + UnsignedLong forSale = order.getForSale(); + + if(forSale.compareTo(myQuote) > 0){ + // Found an order that fills our requirements + obtainedBase = obtainedBase.plus(UnsignedLong.valueOf((long) (myQuote.doubleValue() * orderQuote.doubleValue() / orderBase.doubleValue()))); + myQuote = UnsignedLong.ZERO; + }else{ + // Found an order that partially fills our needs + obtainedBase = obtainedBase.plus(UnsignedLong.valueOf((long) (forSale.doubleValue() * orderQuote.doubleValue() / orderBase.doubleValue()))); + myQuote = myQuote.minus(forSale); + } + } + } + return obtainedBase; } } diff --git a/graphenej/src/test/java/cy/agorise/graphenej/OrderBookTest.java b/graphenej/src/test/java/cy/agorise/graphenej/OrderBookTest.java new file mode 100644 index 0000000..4973013 --- /dev/null +++ b/graphenej/src/test/java/cy/agorise/graphenej/OrderBookTest.java @@ -0,0 +1,64 @@ +package cy.agorise.graphenej; + +import com.google.common.primitives.UnsignedLong; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; + +import org.junit.Assert; +import org.junit.Test; + +import java.lang.reflect.Type; +import java.util.List; + +import cy.agorise.graphenej.models.WitnessResponse; + +/** + * Testing the {@link OrderBook} class + */ + +public class OrderBookTest { + + @Test + public void testRequiredBase(){ + String serializedOrderBook = "{\"id\": 1,\"result\": [{\"id\": \"1.7.37284933\",\"expiration\": \"2018-11-17T00:03:49\",\"seller\": \"1.2.132823\",\"for_sale\": 10,\"sell_price\": {\"base\": {\"amount\": 1,\"asset_id\": \"1.3.121\"},\"quote\": {\"amount\": 10,\"asset_id\": \"1.3.0\"}},\"deferred_fee\": 0},{\"id\": \"1.7.37284933\",\"expiration\": \"2018-11-17T00:03:49\",\"seller\": \"1.2.132823\",\"for_sale\": 20,\"sell_price\": {\"base\": {\"amount\": 1,\"asset_id\": \"1.3.121\"},\"quote\": {\"amount\": 20,\"asset_id\": \"1.3.0\"}},\"deferred_fee\": 0}]}"; + GsonBuilder builder = new GsonBuilder(); + builder.registerTypeAdapter(AssetAmount.class, new AssetAmount.AssetAmountDeserializer()); + builder.registerTypeAdapter(UserAccount.class, new UserAccount.UserAccountSimpleDeserializer()); + builder.registerTypeAdapter(LimitOrder.class, new LimitOrder.LimitOrderDeserializer()); + Type GetLimitOrdersResponse = new TypeToken>>() {}.getType(); + WitnessResponse> witnessResponse = builder.create().fromJson(serializedOrderBook, GetLimitOrdersResponse); + List orders = witnessResponse.result; + OrderBook orderBook = new OrderBook(orders); + + + final Asset _quote = new Asset("1.3.121", "USD", 4); + final Asset _base = new Asset("1.3.0", "BTS", 5); + long _totalQuote = 14; + UnsignedLong _totalBase = orderBook.calculateRequiredBase(new AssetAmount(UnsignedLong.valueOf(_totalQuote), _quote)); + Assert.assertEquals("Should buy 10 at 10 and 4 at 20, which sums up to 180",180, _totalBase.longValue()); + System.out.println(String.format("Base: %s, Quote: %s", _base.getObjectId(), _quote.getObjectId())); + System.out.println(String.format("_totalQuote: %d, _totalBase: %d", _totalQuote, _totalBase.longValue())); + } + + @Test + public void testRequiredQuote(){ + String serializedOrderBook = "{\"id\":1,\"result\":[{\"id\":\"1.7.37284933\",\"expiration\":\"2018-11-17T00:03:49\",\"seller\":\"1.2.132823\",\"for_sale\":20,\"sell_price\":{\"base\":{\"amount\":20,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":0},{\"id\":\"1.7.37284933\",\"expiration\":\"2018-11-17T00:03:49\",\"seller\":\"1.2.132823\",\"for_sale\":100,\"sell_price\":{\"base\":{\"amount\":10,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":0}]}"; + GsonBuilder builder = new GsonBuilder(); + builder.registerTypeAdapter(AssetAmount.class, new AssetAmount.AssetAmountDeserializer()); + builder.registerTypeAdapter(UserAccount.class, new UserAccount.UserAccountSimpleDeserializer()); + builder.registerTypeAdapter(LimitOrder.class, new LimitOrder.LimitOrderDeserializer()); + Type GetLimitOrdersResponse = new TypeToken>>() {}.getType(); + WitnessResponse> witnessResponse = builder.create().fromJson(serializedOrderBook, GetLimitOrdersResponse); + List orders = witnessResponse.result; + OrderBook orderBook = new OrderBook(orders); + + + final Asset _base = new Asset("1.3.121", "USD", 4); + final Asset _quote = new Asset("1.3.0", "BTS", 5); + long _totalBase = 2; + UnsignedLong _totalQuote = orderBook.calculateObtainedQuote(new AssetAmount(UnsignedLong.valueOf(_totalBase), _base)); + Assert.assertEquals("Should be able to buy 20 on the first order and 10 on the second, totalling 30",30, _totalQuote.longValue()); + System.out.println(String.format("Base: %s, Quote: %s", _base.getObjectId(), _quote.getObjectId())); + System.out.println(String.format("_totalQuote: %d, _totalBase: %d", _totalQuote.longValue(), _totalQuote.longValue())); + } +} diff --git a/graphenej/src/test/java/cy/agorise/graphenej/api/GetLimitOrdersTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/GetLimitOrdersTest.java index d0fd134..fecbeb0 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/api/GetLimitOrdersTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/GetLimitOrdersTest.java @@ -33,7 +33,9 @@ public class GetLimitOrdersTest extends BaseApiTest { @Before public void setup(){ - System.out.println("Connecting to node: "+NODE_URL); + if(NODE_URL != null){ + System.out.println("Connecting to node: "+NODE_URL); + } } @Test @@ -141,50 +143,6 @@ public class GetLimitOrdersTest extends BaseApiTest { } } - @Test - public void testRequiredBase(){ - try { - final Asset _quote = new Asset("1.3.121", "USD", 4); - final Asset _base = new Asset("1.3.0", "BTS", 5); - mWebSocket.addListener(new GetLimitOrders(_base.getObjectId(), _quote.getObjectId(), 100, new WitnessResponseListener() { - @Override - public void onSuccess(WitnessResponse response) { - List orders = (List) response.result; - OrderBook orderBook = new OrderBook(orders); - - long _totalQuote = 1000; - long _totalBase = orderBook.calculateRequiredBase(new AssetAmount(UnsignedLong.valueOf(_totalQuote), _quote)); - - System.out.println(String.format("Base: %s, Quote: %s", _base.getObjectId(), _quote.getObjectId())); - System.out.println(String.format("_totalQuote: %d, _totalBase: %d", _totalQuote, _totalBase)); - - synchronized (GetLimitOrdersTest.this){ - GetLimitOrdersTest.this.notifyAll(); - } - } - - @Override - public void onError(BaseResponse.Error error) { - System.out.println("onError. Msg: "+error.message); - synchronized (GetLimitOrdersTest.this){ - GetLimitOrdersTest.this.notifyAll(); - } - } - })); - - mWebSocket.connect(); - - synchronized (this){ - wait(); - } - - } catch (WebSocketException e) { - System.out.println("WebSocketException. Msg: " + e.getMessage()); - } catch (InterruptedException e) { - System.out.println("InterruptedException. Msg: "+e.getMessage()); - } - } - @After public void tearDown() throws Exception { mWebSocket.disconnect(); From 805903bed44142c2083f614b5fb6ecb19806d1aa Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 23 Nov 2017 19:20:45 -0500 Subject: [PATCH 32/49] Version 0.4.6-alpha3 --- gradle.properties | 2 +- graphenej/build.gradle | 4 ++-- graphenej/src/main/AndroidManifest.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0c06e84..b8883c8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME=0.4.6-alpha2 +VERSION_NAME=0.4.6-alpha3 VERSION_CODE=8 GROUP=com.github.bilthon diff --git a/graphenej/build.gradle b/graphenej/build.gradle index 59848d2..dcce636 100644 --- a/graphenej/build.gradle +++ b/graphenej/build.gradle @@ -1,5 +1,5 @@ group 'cy.agorise' -version '0.4.6-alpha2' +version '0.4.6-alpha3' apply plugin: 'com.android.library' apply from: 'maven-push.gradle' @@ -22,7 +22,7 @@ android { minSdkVersion 9 targetSdkVersion 24 versionCode 8 - versionName "0.4.6-alpha1" + versionName "0.4.6-alpha3" vectorDrawables.useSupportLibrary = true } diff --git a/graphenej/src/main/AndroidManifest.xml b/graphenej/src/main/AndroidManifest.xml index fe1ec3a..5c0e005 100644 --- a/graphenej/src/main/AndroidManifest.xml +++ b/graphenej/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ + android:versionName="0.4.6-alpha3" > From 9a1808d127a417b9fd27f93cb3f0cbe3a37a7b60 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 23 Nov 2017 22:58:22 -0500 Subject: [PATCH 33/49] Modified AssetAmount#multiply() and AssetAmount#divide() to not cast its value to a long primitive and thus preventing some overflow scenarios that the idea of using the UnsignedLong class is suposed to prevent --- .../cy/agorise/graphenej/AssetAmount.java | 9 ++++-- .../cy/agorise/graphenej/AssetAmountTest.java | 29 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/AssetAmount.java b/graphenej/src/main/java/cy/agorise/graphenej/AssetAmount.java index 312662e..9170581 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/AssetAmount.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/AssetAmount.java @@ -17,6 +17,7 @@ import java.io.DataOutput; import java.io.DataOutputStream; import java.io.IOException; import java.lang.reflect.Type; +import java.math.BigDecimal; import java.math.RoundingMode; import cy.agorise.graphenej.errors.IncompatibleOperation; @@ -91,7 +92,9 @@ public class AssetAmount implements ByteSerializable, JsonSerializable { * @return The same AssetAmount instance, but with the changed amount value. */ public AssetAmount multiplyBy(double factor, RoundingMode roundingMode){ - this.amount = UnsignedLong.valueOf(DoubleMath.roundToLong(this.amount.longValue() * factor, roundingMode)); + BigDecimal originalAmount = new BigDecimal(amount.bigIntegerValue()); + BigDecimal decimalResult = originalAmount.multiply(new BigDecimal(factor)); + this.amount = UnsignedLong.valueOf(DoubleMath.roundToBigInteger(decimalResult.doubleValue(), roundingMode)); return this; } @@ -111,7 +114,9 @@ public class AssetAmount implements ByteSerializable, JsonSerializable { * @return: The same AssetAMount instance, but with the divided amount value */ public AssetAmount dividedBy(double divisor, RoundingMode roundingMode){ - this.amount = UnsignedLong.valueOf(DoubleMath.roundToLong(this.amount.longValue() / divisor, roundingMode)); + BigDecimal originalAmount = new BigDecimal(amount.bigIntegerValue()); + BigDecimal decimalAmount = originalAmount.divide(new BigDecimal(divisor), 18, RoundingMode.HALF_UP); + this.amount = UnsignedLong.valueOf(DoubleMath.roundToBigInteger(decimalAmount.doubleValue(), roundingMode)); return this; } diff --git a/graphenej/src/test/java/cy/agorise/graphenej/AssetAmountTest.java b/graphenej/src/test/java/cy/agorise/graphenej/AssetAmountTest.java index 8589d93..4113957 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/AssetAmountTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/AssetAmountTest.java @@ -1,13 +1,14 @@ package cy.agorise.graphenej; import com.google.common.primitives.UnsignedLong; + import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; /** - * Created by nelson on 2/23/17. + * Testing AssetAmount operations. */ public class AssetAmountTest { private final int LARGE_VALUE = 1000; @@ -27,4 +28,28 @@ public class AssetAmountTest { assertEquals(large.subtract(small).getAmount(), new AssetAmount(UnsignedLong.valueOf(LARGE_VALUE - SMALL_VALUE), testAsset).getAmount()); assertEquals(small.subtract(large).getAmount(), new AssetAmount(UnsignedLong.valueOf(Math.abs(SMALL_VALUE - LARGE_VALUE)), testAsset).getAmount()); } + + @Test + public void testMultiplication(){ + // Testing a simple multiplication by a double + AssetAmount result = large.multiplyBy(0.5); + assertEquals(500, result.getAmount().longValue()); + + // Testing the multiplication of a number that would normally give an overflow + AssetAmount max = new AssetAmount(UnsignedLong.valueOf(Long.MAX_VALUE), testAsset); + AssetAmount overMaxLong = max.multiplyBy(1.5); + assertEquals("13835058055282163712", overMaxLong.getAmount().toString(10)); + } + + @Test + public void testDivision(){ + // Testing a simple division by a double + AssetAmount result = large.dividedBy(0.5); + assertEquals(2000, result.getAmount().longValue()); + + // Testing a division of a number that would normally give an overflow + AssetAmount max = new AssetAmount(UnsignedLong.valueOf(Long.MAX_VALUE), testAsset); + AssetAmount overMaxLong = max.dividedBy(0.8); + assertEquals("11529215046068469760", overMaxLong.getAmount().toString()); + } } \ No newline at end of file From fb80fe3c02da7568578962953d9fb8be34b3406a Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 23 Nov 2017 23:38:53 -0500 Subject: [PATCH 34/49] Introducing some copy constructors and making sure #multiplyBy and #divideBy return different instances --- .../main/java/cy/agorise/graphenej/Asset.java | 26 +++++++++++++- .../cy/agorise/graphenej/AssetAmount.java | 34 ++++++++++++++----- .../cy/agorise/graphenej/AssetAmountTest.java | 5 +++ 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/Asset.java b/graphenej/src/main/java/cy/agorise/graphenej/Asset.java index 8c2ec5c..880df66 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/Asset.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Asset.java @@ -10,7 +10,7 @@ import com.google.gson.JsonParseException; import java.lang.reflect.Type; /** - * Created by nelson on 11/9/16. + * Class used to represent a specific asset on the Graphene platform */ public class Asset extends GrapheneObject { public final static String TAG = "Asset"; @@ -83,6 +83,22 @@ public class Asset extends GrapheneObject { this.issuer = issuer; } + /** + * Copy constructor + * @param asset Another asset instance + */ + public Asset(Asset asset){ + super(asset.getObjectId()); + this.symbol = asset.getSymbol(); + this.precision = asset.getPrecision(); + this.issuer = asset.getIssuer(); + this.description = asset.getDescription(); + this.dynamic_asset_data_id = asset.getDynamicAssetDataId(); + this.options = asset.getAssetOptions(); + this.bitasset_data_id = asset.getBitassetId(); + this.mAssetType = asset.getAssetType(); + } + public String getSymbol(){ return this.symbol; } @@ -111,6 +127,14 @@ public class Asset extends GrapheneObject { return description; } + public String getDynamicAssetDataId() { + return dynamic_asset_data_id; + } + + public void setDynamicAssetDataId(String dynamic_asset_data_id) { + this.dynamic_asset_data_id = dynamic_asset_data_id; + } + public void setAssetOptions(AssetOptions options){ this.options = options; } diff --git a/graphenej/src/main/java/cy/agorise/graphenej/AssetAmount.java b/graphenej/src/main/java/cy/agorise/graphenej/AssetAmount.java index 9170581..6ac3a7a 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/AssetAmount.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/AssetAmount.java @@ -25,7 +25,7 @@ import cy.agorise.graphenej.interfaces.ByteSerializable; import cy.agorise.graphenej.interfaces.JsonSerializable; /** - * Created by nelson on 11/7/16. + * Class used to represent a specific amount of a certain asset */ public class AssetAmount implements ByteSerializable, JsonSerializable { /** @@ -37,11 +37,25 @@ public class AssetAmount implements ByteSerializable, JsonSerializable { private UnsignedLong amount; private Asset asset; + /** + * Class constructor + * @param amount The amount + * @param asset The asset + */ public AssetAmount(UnsignedLong amount, Asset asset){ this.amount = amount; this.asset = asset; } + /** + * Copy constructor + * @param assetAmount The other instance + */ + public AssetAmount(AssetAmount assetAmount){ + this.amount = UnsignedLong.valueOf(assetAmount.getAmount().toString()); + this.asset = new Asset(assetAmount.getAsset()); + } + /** * Adds two asset amounts. They must refer to the same Asset type. * @param other: The other AssetAmount to add to this. @@ -94,8 +108,8 @@ public class AssetAmount implements ByteSerializable, JsonSerializable { public AssetAmount multiplyBy(double factor, RoundingMode roundingMode){ BigDecimal originalAmount = new BigDecimal(amount.bigIntegerValue()); BigDecimal decimalResult = originalAmount.multiply(new BigDecimal(factor)); - this.amount = UnsignedLong.valueOf(DoubleMath.roundToBigInteger(decimalResult.doubleValue(), roundingMode)); - return this; + UnsignedLong resultingAmount = UnsignedLong.valueOf(DoubleMath.roundToBigInteger(decimalResult.doubleValue(), roundingMode)); + return new AssetAmount(resultingAmount, new Asset(asset)); } /** @@ -113,11 +127,11 @@ public class AssetAmount implements ByteSerializable, JsonSerializable { * @param divisor: The divisor * @return: The same AssetAMount instance, but with the divided amount value */ - public AssetAmount dividedBy(double divisor, RoundingMode roundingMode){ + public AssetAmount divideBy(double divisor, RoundingMode roundingMode){ BigDecimal originalAmount = new BigDecimal(amount.bigIntegerValue()); BigDecimal decimalAmount = originalAmount.divide(new BigDecimal(divisor), 18, RoundingMode.HALF_UP); - this.amount = UnsignedLong.valueOf(DoubleMath.roundToBigInteger(decimalAmount.doubleValue(), roundingMode)); - return this; + UnsignedLong resultingAmount = UnsignedLong.valueOf(DoubleMath.roundToBigInteger(decimalAmount.doubleValue(), roundingMode)); + return new AssetAmount(resultingAmount, new Asset(asset)); } @@ -127,8 +141,8 @@ public class AssetAmount implements ByteSerializable, JsonSerializable { * @param divisor: The divisor * @return: The same AssetAMount instance, but with the divided amount value */ - public AssetAmount dividedBy(double divisor){ - return this.dividedBy(divisor, RoundingMode.HALF_DOWN); + public AssetAmount divideBy(double divisor){ + return this.divideBy(divisor, RoundingMode.HALF_DOWN); } public void setAmount(UnsignedLong amount){ @@ -141,6 +155,10 @@ public class AssetAmount implements ByteSerializable, JsonSerializable { public Asset getAsset(){ return this.asset; } + public void setAsset(Asset asset){ + this.asset = asset; + } + @Override public byte[] toBytes() { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); diff --git a/graphenej/src/test/java/cy/agorise/graphenej/AssetAmountTest.java b/graphenej/src/test/java/cy/agorise/graphenej/AssetAmountTest.java index 4113957..7d5e215 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/AssetAmountTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/AssetAmountTest.java @@ -6,6 +6,7 @@ import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotSame; /** * Testing AssetAmount operations. @@ -39,6 +40,8 @@ public class AssetAmountTest { AssetAmount max = new AssetAmount(UnsignedLong.valueOf(Long.MAX_VALUE), testAsset); AssetAmount overMaxLong = max.multiplyBy(1.5); assertEquals("13835058055282163712", overMaxLong.getAmount().toString(10)); + + assertNotSame("Making sure the result and original references point to different instances",result, large); } @Test @@ -51,5 +54,7 @@ public class AssetAmountTest { AssetAmount max = new AssetAmount(UnsignedLong.valueOf(Long.MAX_VALUE), testAsset); AssetAmount overMaxLong = max.dividedBy(0.8); assertEquals("11529215046068469760", overMaxLong.getAmount().toString()); + + assertNotSame("Making sure the result and original references point to different instances",result, large); } } \ No newline at end of file From 2e4bd213c71cce4ba6a55ddfbb62b068814bec45 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 23 Nov 2017 23:39:29 -0500 Subject: [PATCH 35/49] Changing method's name --- .../src/test/java/cy/agorise/graphenej/AssetAmountTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphenej/src/test/java/cy/agorise/graphenej/AssetAmountTest.java b/graphenej/src/test/java/cy/agorise/graphenej/AssetAmountTest.java index 7d5e215..cdcddaa 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/AssetAmountTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/AssetAmountTest.java @@ -47,12 +47,12 @@ public class AssetAmountTest { @Test public void testDivision(){ // Testing a simple division by a double - AssetAmount result = large.dividedBy(0.5); + AssetAmount result = large.divideBy(0.5); assertEquals(2000, result.getAmount().longValue()); // Testing a division of a number that would normally give an overflow AssetAmount max = new AssetAmount(UnsignedLong.valueOf(Long.MAX_VALUE), testAsset); - AssetAmount overMaxLong = max.dividedBy(0.8); + AssetAmount overMaxLong = max.divideBy(0.8); assertEquals("11529215046068469760", overMaxLong.getAmount().toString()); assertNotSame("Making sure the result and original references point to different instances",result, large); From ef98d99b1f75a65d6413d98519ec9ceb010203bc Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Mon, 27 Nov 2017 22:54:53 -0500 Subject: [PATCH 36/49] Removed diff file --- bilthon_16_to_bilthon_7_memo.diff | 53 ------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 bilthon_16_to_bilthon_7_memo.diff diff --git a/bilthon_16_to_bilthon_7_memo.diff b/bilthon_16_to_bilthon_7_memo.diff deleted file mode 100644 index 6e03f7e..0000000 --- a/bilthon_16_to_bilthon_7_memo.diff +++ /dev/null @@ -1,53 +0,0 @@ -diff --git a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java -index fa787e0..288be8f 100644 ---- a/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java -+++ b/graphenej/src/test/java/cy/agorise/graphenej/objects/MemoTest.java -@@ -2,13 +2,16 @@ package cy.agorise.graphenej.objects; - - import com.google.gson.JsonElement; - import com.google.gson.JsonObject; -+ -+import org.bitcoinj.core.DumpedPrivateKey; -+import org.bitcoinj.core.ECKey; -+import org.junit.Before; -+import org.junit.Test; -+ - import cy.agorise.graphenej.Address; - import cy.agorise.graphenej.PublicKey; - import cy.agorise.graphenej.Util; - import cy.agorise.graphenej.errors.ChecksumException; --import org.bitcoinj.core.DumpedPrivateKey; --import org.bitcoinj.core.ECKey; --import org.junit.*; - - import static org.junit.Assert.assertArrayEquals; - import static org.junit.Assert.assertEquals; -@@ -34,7 +37,7 @@ public class MemoTest { - private String longerMessage = "testing now longer string with some special charaters é ç o ú á í Í mMno!!"; - - private byte[] shortEncryptedMessage = Util.hexToBytes("4c81c2db6ebc61e3f9e0ead65c0559dd"); -- private byte[] longerEncryptedMessage = Util.hexToBytes("1f8a08f1ff53dcefd48eeb052d26fba425f2a917f508ce61fc3d5696b10efa17"); -+ private byte[] longerEncryptedMessage = Util.hexToBytes("8ba8f5ed85ad9f7675bd30408a28d6f6ba138476d1e995dd61c01f0041ab25911e04d93fe4ce30e4f6c9a5134cceb67d653e140aa542da19ce2fc646bcde46e088da06a9327eaac79ffe8bc9d71d586195c04bb023995f18e66c9f9e5c6b0d7c"); - - private String decodedMessage; - -@@ -51,7 +54,7 @@ public class MemoTest { - destinationAddress = new Address(publicKey.getKey()); - - //memo.getNonce() -- nonce = 5; -+ nonce = 386469162162343L; - } - - @Test -@@ -88,6 +91,10 @@ public class MemoTest { - @Test - public void shouldDecryptLongerMessage(){ - try{ -+ System.out.println("Source address: "+sourceAddress.toString()); -+ System.out.println("Dest address..: "+new Address(ECKey.fromPublicOnly(ECKey.fromPrivate(destinationPrivate.getPrivKeyBytes()).getPubKey())).toString()); -+ System.out.println("Nonce.........: "+nonce); -+ System.out.println("Encrypted msg.: "+Util.bytesToHex(longerEncryptedMessage)); - String longDecrypted = Memo.decryptMessage(destinationPrivate, sourceAddress, nonce, longerEncryptedMessage); - System.out.println("Long Decrypted Message: " + longDecrypted); - assertEquals("The longer message must be equal to the original", longerMessage, longDecrypted); From de11203ef8e2f472d087d97aca6f671673539cd5 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Mon, 27 Nov 2017 22:55:15 -0500 Subject: [PATCH 37/49] Version 0.4.6-alpha4 --- gradle.properties | 2 +- graphenej/build.gradle | 4 ++-- graphenej/src/main/AndroidManifest.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index b8883c8..6d75c4e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME=0.4.6-alpha3 +VERSION_NAME=0.4.6-alpha4 VERSION_CODE=8 GROUP=com.github.bilthon diff --git a/graphenej/build.gradle b/graphenej/build.gradle index dcce636..d49ff19 100644 --- a/graphenej/build.gradle +++ b/graphenej/build.gradle @@ -1,5 +1,5 @@ group 'cy.agorise' -version '0.4.6-alpha3' +version '0.4.6-alpha4' apply plugin: 'com.android.library' apply from: 'maven-push.gradle' @@ -22,7 +22,7 @@ android { minSdkVersion 9 targetSdkVersion 24 versionCode 8 - versionName "0.4.6-alpha3" + versionName "0.4.6-alpha4" vectorDrawables.useSupportLibrary = true } diff --git a/graphenej/src/main/AndroidManifest.xml b/graphenej/src/main/AndroidManifest.xml index 5c0e005..a8dcb89 100644 --- a/graphenej/src/main/AndroidManifest.xml +++ b/graphenej/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ + android:versionName="0.4.6-alpha4" > From 2520099762506c252acf18ba94fc79966425801b Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Mon, 27 Nov 2017 23:05:42 -0500 Subject: [PATCH 38/49] Serializing the memo only when the message bytes is not null --- .../graphenej/operations/TransferOperation.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperation.java b/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperation.java index 656c23a..232a2a1 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperation.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperation.java @@ -121,20 +121,20 @@ public class TransferOperation extends BaseOperation { jsonObject.addProperty(KEY_FROM, from.getObjectId()); jsonObject.addProperty(KEY_TO, to.getObjectId()); jsonObject.add(KEY_AMOUNT, amount.toJsonObject()); - jsonObject.add(KEY_MEMO, memo.toJsonObject()); + if(memo.getByteMessage() != null) + jsonObject.add(KEY_MEMO, memo.toJsonObject()); jsonObject.add(KEY_EXTENSIONS, new JsonArray()); array.add(jsonObject); return array; } + /** + * Serializer used to convert this object into a {@link JsonElement} instance + */ public static class TransferSerializer implements JsonSerializer { @Override public JsonElement serialize(TransferOperation transfer, Type type, JsonSerializationContext jsonSerializationContext) { -// JsonArray arrayRep = new JsonArray(); -// arrayRep.add(transfer.getId()); -// arrayRep.add(transfer.toJsonObject()); -// return arrayRep; return transfer.toJsonObject(); } } @@ -198,7 +198,6 @@ public class TransferOperation extends BaseOperation { Memo memo = context.deserialize(jsonObject.get(KEY_MEMO), Memo.class); transfer.setMemo(memo); } - return transfer; } } From 50bd0aa05cc27a9213396edad5bd9d61b4ccf69e Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Wed, 29 Nov 2017 00:17:47 -0500 Subject: [PATCH 39/49] Version 0.4.6-alpha5 --- gradle.properties | 2 +- graphenej/build.gradle | 4 ++-- graphenej/src/main/AndroidManifest.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6d75c4e..96555c9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME=0.4.6-alpha4 +VERSION_NAME=0.4.6-alpha5 VERSION_CODE=8 GROUP=com.github.bilthon diff --git a/graphenej/build.gradle b/graphenej/build.gradle index d49ff19..0068307 100644 --- a/graphenej/build.gradle +++ b/graphenej/build.gradle @@ -1,5 +1,5 @@ group 'cy.agorise' -version '0.4.6-alpha4' +version '0.4.6-alpha5' apply plugin: 'com.android.library' apply from: 'maven-push.gradle' @@ -22,7 +22,7 @@ android { minSdkVersion 9 targetSdkVersion 24 versionCode 8 - versionName "0.4.6-alpha4" + versionName "0.4.6-alpha5" vectorDrawables.useSupportLibrary = true } diff --git a/graphenej/src/main/AndroidManifest.xml b/graphenej/src/main/AndroidManifest.xml index a8dcb89..0fff95e 100644 --- a/graphenej/src/main/AndroidManifest.xml +++ b/graphenej/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ + android:versionName="0.4.6-alpha5" > From ff856e7e2c270c825f7ba1033a3d503c047f2a30 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Wed, 29 Nov 2017 00:24:13 -0500 Subject: [PATCH 40/49] Fixing small issue with the OrderBook#calculateObtainedQuote() method --- gradle.properties | 2 +- graphenej/build.gradle | 2 +- graphenej/src/main/AndroidManifest.xml | 3 +-- .../java/cy/agorise/graphenej/OrderBook.java | 2 +- .../cy/agorise/graphenej/OrderBookTest.java | 23 +++++++++++++++++++ 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 96555c9..93ed04b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME=0.4.6-alpha5 +VERSION_NAME=0.4.6-alpha6 VERSION_CODE=8 GROUP=com.github.bilthon diff --git a/graphenej/build.gradle b/graphenej/build.gradle index 0068307..1ff0bb3 100644 --- a/graphenej/build.gradle +++ b/graphenej/build.gradle @@ -22,7 +22,7 @@ android { minSdkVersion 9 targetSdkVersion 24 versionCode 8 - versionName "0.4.6-alpha5" + versionName "0.4.6-alpha6" vectorDrawables.useSupportLibrary = true } diff --git a/graphenej/src/main/AndroidManifest.xml b/graphenej/src/main/AndroidManifest.xml index 0fff95e..78bdba2 100644 --- a/graphenej/src/main/AndroidManifest.xml +++ b/graphenej/src/main/AndroidManifest.xml @@ -2,8 +2,7 @@ - + android:versionName="0.4.6-alpha6" > \ No newline at end of file diff --git a/graphenej/src/main/java/cy/agorise/graphenej/OrderBook.java b/graphenej/src/main/java/cy/agorise/graphenej/OrderBook.java index a2abb60..f383a08 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/OrderBook.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/OrderBook.java @@ -93,7 +93,7 @@ public class OrderBook { }else{ // This order consumes all our base asset // obtained_quote = obtained_quote + (my base * order_base / order_quote) - obtainedQuote = obtainedQuote.plus(myBase.times(orderBase.dividedBy(orderQuote))); + obtainedQuote = obtainedQuote.plus(myBase.times(orderBase).dividedBy(orderQuote)); myBase = UnsignedLong.ZERO; } } diff --git a/graphenej/src/test/java/cy/agorise/graphenej/OrderBookTest.java b/graphenej/src/test/java/cy/agorise/graphenej/OrderBookTest.java index 4973013..befc032 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/OrderBookTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/OrderBookTest.java @@ -61,4 +61,27 @@ public class OrderBookTest { System.out.println(String.format("Base: %s, Quote: %s", _base.getObjectId(), _quote.getObjectId())); System.out.println(String.format("_totalQuote: %d, _totalBase: %d", _totalQuote.longValue(), _totalQuote.longValue())); } + + @Test + public void testRequiredQuoteReal(){ + String serializedOrderBook = "{\"id\":1,\"result\":[{\"id\":\"1.7.39826107\",\"expiration\":\"2022-11-29T04:26:23\",\"seller\":\"1.2.384119\",\"for_sale\":100000,\"sell_price\":{\"base\":{\"amount\":100000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":5930000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826091\",\"expiration\":\"2022-11-29T04:26:06\",\"seller\":\"1.2.384119\",\"for_sale\":100000,\"sell_price\":{\"base\":{\"amount\":100000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":5950000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39825780\",\"expiration\":\"2022-11-29T04:24:56\",\"seller\":\"1.2.384119\",\"for_sale\":100000,\"sell_price\":{\"base\":{\"amount\":100000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":5970000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39827059\",\"expiration\":\"2017-11-29T05:31:34\",\"seller\":\"1.2.359723\",\"for_sale\":357277,\"sell_price\":{\"base\":{\"amount\":357277,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":21355520,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39825610\",\"expiration\":\"2022-11-29T04:23:34\",\"seller\":\"1.2.384119\",\"for_sale\":100000,\"sell_price\":{\"base\":{\"amount\":100000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":5990000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826428\",\"expiration\":\"2022-11-29T04:28:45\",\"seller\":\"1.2.384119\",\"for_sale\":1000000,\"sell_price\":{\"base\":{\"amount\":1000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":59990000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39825045\",\"expiration\":\"2022-11-29T04:20:49\",\"seller\":\"1.2.7003\",\"for_sale\":35754092,\"sell_price\":{\"base\":{\"amount\":51008622,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":3060517320,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":0},{\"id\":\"1.7.39827034\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.398049\",\"for_sale\":226328,\"sell_price\":{\"base\":{\"amount\":226328,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":13635626,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826622\",\"expiration\":\"2022-11-29T04:30:07\",\"seller\":\"1.2.384119\",\"for_sale\":1000000,\"sell_price\":{\"base\":{\"amount\":1000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":61000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39825800\",\"expiration\":\"1963-11-25T22:31:44\",\"seller\":\"1.2.95758\",\"for_sale\":1515000,\"sell_price\":{\"base\":{\"amount\":1515000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":92750445,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39827058\",\"expiration\":\"1963-11-29T12:38:45\",\"seller\":\"1.2.36449\",\"for_sale\":75750000,\"sell_price\":{\"base\":{\"amount\":75750000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":\"4638289114\",\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826511\",\"expiration\":\"2017-12-06T04:29:04\",\"seller\":\"1.2.376473\",\"for_sale\":1516515,\"sell_price\":{\"base\":{\"amount\":1516515,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":92858549,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39822796\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.165710\",\"for_sale\":151500,\"sell_price\":{\"base\":{\"amount\":151500,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":9285855,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39791452\",\"expiration\":\"2022-11-29T01:16:22\",\"seller\":\"1.2.28914\",\"for_sale\":16200000,\"sell_price\":{\"base\":{\"amount\":16200000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":1000000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826697\",\"expiration\":\"2022-11-29T04:30:22\",\"seller\":\"1.2.384119\",\"for_sale\":1000000,\"sell_price\":{\"base\":{\"amount\":1000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":62000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39767436\",\"expiration\":\"2022-11-28T23:16:04\",\"seller\":\"1.2.408360\",\"for_sale\":17934080,\"sell_price\":{\"base\":{\"amount\":17934080,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":1112535980,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39770442\",\"expiration\":\"2022-11-28T23:27:12\",\"seller\":\"1.2.429094\",\"for_sale\":1052917,\"sell_price\":{\"base\":{\"amount\":1052917,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":66221194,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1227},{\"id\":\"1.7.39787848\",\"expiration\":\"2022-11-29T00:57:45\",\"seller\":\"1.2.408360\",\"for_sale\":19945106,\"sell_price\":{\"base\":{\"amount\":19945106,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":1256447949,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1257},{\"id\":\"1.7.39826299\",\"expiration\":\"2022-11-29T04:27:44\",\"seller\":\"1.2.384119\",\"for_sale\":3000000,\"sell_price\":{\"base\":{\"amount\":3000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":189000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39726192\",\"expiration\":\"2022-11-28T17:25:39\",\"seller\":\"1.2.398578\",\"for_sale\":316200,\"sell_price\":{\"base\":{\"amount\":316200,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":20000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39724878\",\"expiration\":\"2022-11-28T17:15:53\",\"seller\":\"1.2.472756\",\"for_sale\":5987987,\"sell_price\":{\"base\":{\"amount\":5987987,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":382024828,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39762644\",\"expiration\":\"2022-11-28T23:00:35\",\"seller\":\"1.2.465467\",\"for_sale\":1252843,\"sell_price\":{\"base\":{\"amount\":1252843,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":80000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39817965\",\"expiration\":\"2022-11-29T03:45:43\",\"seller\":\"1.2.384119\",\"for_sale\":3000000,\"sell_price\":{\"base\":{\"amount\":3000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":192000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39718037\",\"expiration\":\"2018-11-28T16:10:58\",\"seller\":\"1.2.132823\",\"for_sale\":1052528,\"sell_price\":{\"base\":{\"amount\":1052528,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":67641517,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39743004\",\"expiration\":\"2022-11-28T20:28:12\",\"seller\":\"1.2.182034\",\"for_sale\":1547001,\"sell_price\":{\"base\":{\"amount\":1547001,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":100000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39718531\",\"expiration\":\"2022-11-28T16:17:33\",\"seller\":\"1.2.424868\",\"for_sale\":100000000,\"sell_price\":{\"base\":{\"amount\":100000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":\"6464124111\",\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39715891\",\"expiration\":\"2022-11-28T15:45:45\",\"seller\":\"1.2.398578\",\"for_sale\":2000000,\"sell_price\":{\"base\":{\"amount\":2000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":129365483,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39819644\",\"expiration\":\"2022-11-29T03:55:12\",\"seller\":\"1.2.384119\",\"for_sale\":3000000,\"sell_price\":{\"base\":{\"amount\":3000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":195000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39711734\",\"expiration\":\"2022-11-28T15:08:31\",\"seller\":\"1.2.432748\",\"for_sale\":16620108,\"sell_price\":{\"base\":{\"amount\":17620000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":1149926586,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":0},{\"id\":\"1.7.39729717\",\"expiration\":\"2022-11-28T18:09:33\",\"seller\":\"1.2.467917\",\"for_sale\":53196,\"sell_price\":{\"base\":{\"amount\":53196,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":3485926,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39739105\",\"expiration\":\"2022-11-28T19:46:30\",\"seller\":\"1.2.450915\",\"for_sale\":1330000,\"sell_price\":{\"base\":{\"amount\":1330000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":87500000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826277\",\"expiration\":\"2022-11-29T04:27:27\",\"seller\":\"1.2.384119\",\"for_sale\":3000000,\"sell_price\":{\"base\":{\"amount\":3000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":198000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39709056\",\"expiration\":\"2022-11-28T14:33:54\",\"seller\":\"1.2.174467\",\"for_sale\":5000000,\"sell_price\":{\"base\":{\"amount\":5000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":330033003,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1221},{\"id\":\"1.7.39710371\",\"expiration\":\"2022-11-28T14:51:11\",\"seller\":\"1.2.424868\",\"for_sale\":50000000,\"sell_price\":{\"base\":{\"amount\":50000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":3309066843,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39645110\",\"expiration\":\"2022-11-28T05:57:36\",\"seller\":\"1.2.398578\",\"for_sale\":150000,\"sell_price\":{\"base\":{\"amount\":150000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":10000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39761502\",\"expiration\":\"2022-11-28T22:57:42\",\"seller\":\"1.2.101673\",\"for_sale\":43700400,\"sell_price\":{\"base\":{\"amount\":43700400,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":2913360000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39770621\",\"expiration\":\"2022-11-28T23:27:40\",\"seller\":\"1.2.445796\",\"for_sale\":11248500,\"sell_price\":{\"base\":{\"amount\":11248500,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":749900000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826381\",\"expiration\":\"2022-11-29T04:28:25\",\"seller\":\"1.2.384119\",\"for_sale\":3000000,\"sell_price\":{\"base\":{\"amount\":3000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":201000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39739797\",\"expiration\":\"2022-11-28T19:59:08\",\"seller\":\"1.2.444127\",\"for_sale\":952159,\"sell_price\":{\"base\":{\"amount\":952159,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":63839890,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39675312\",\"expiration\":\"2022-11-28T09:46:14\",\"seller\":\"1.2.398578\",\"for_sale\":740500,\"sell_price\":{\"base\":{\"amount\":740500,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":50000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39706939\",\"expiration\":\"2022-11-28T14:13:34\",\"seller\":\"1.2.443284\",\"for_sale\":5000000,\"sell_price\":{\"base\":{\"amount\":5000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":337837837,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39732387\",\"expiration\":\"2022-11-28T18:37:11\",\"seller\":\"1.2.384119\",\"for_sale\":5000000,\"sell_price\":{\"base\":{\"amount\":5000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":340000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39707139\",\"expiration\":\"2022-11-28T14:15:15\",\"seller\":\"1.2.443284\",\"for_sale\":5000000,\"sell_price\":{\"base\":{\"amount\":5000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":340136054,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39648077\",\"expiration\":\"2022-11-28T05:25:03\",\"seller\":\"1.2.161162\",\"for_sale\":4572310,\"sell_price\":{\"base\":{\"amount\":4572310,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":312529733,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39587569\",\"expiration\":\"2022-11-27T21:48:15\",\"seller\":\"1.2.449122\",\"for_sale\":2884418,\"sell_price\":{\"base\":{\"amount\":2884418,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":197553404,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39568900\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.166710\",\"for_sale\":15149,\"sell_price\":{\"base\":{\"amount\":15149,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":1039535,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39706235\",\"expiration\":\"2022-11-28T14:09:12\",\"seller\":\"1.2.443284\",\"for_sale\":5000000,\"sell_price\":{\"base\":{\"amount\":5000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":344827586,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39651001\",\"expiration\":\"2022-11-28T06:50:14\",\"seller\":\"1.2.398578\",\"for_sale\":290000,\"sell_price\":{\"base\":{\"amount\":290000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":20000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39774063\",\"expiration\":\"2022-11-28T23:40:02\",\"seller\":\"1.2.386019\",\"for_sale\":849700,\"sell_price\":{\"base\":{\"amount\":849700,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":58600000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39637259\",\"expiration\":\"2022-11-28T04:47:01\",\"seller\":\"1.2.452887\",\"for_sale\":28990,\"sell_price\":{\"base\":{\"amount\":28990,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":2000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39732395\",\"expiration\":\"2022-11-28T18:37:17\",\"seller\":\"1.2.384119\",\"for_sale\":5000000,\"sell_price\":{\"base\":{\"amount\":5000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":345000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39551534\",\"expiration\":\"2022-11-27T17:38:00\",\"seller\":\"1.2.33253\",\"for_sale\":179760,\"sell_price\":{\"base\":{\"amount\":179760,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":12441798,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39533002\",\"expiration\":\"2022-11-27T15:22:59\",\"seller\":\"1.2.388453\",\"for_sale\":933982,\"sell_price\":{\"base\":{\"amount\":2548625,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":176987851,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":0},{\"id\":\"1.7.39788915\",\"expiration\":\"1963-12-26T10:31:44\",\"seller\":\"1.2.92842\",\"for_sale\":9789859,\"sell_price\":{\"base\":{\"amount\":9789859,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":681535516,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39509337\",\"expiration\":\"2018-11-27T04:45:12\",\"seller\":\"1.2.465200\",\"for_sale\":14703,\"sell_price\":{\"base\":{\"amount\":28586,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":2000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":0},{\"id\":\"1.7.39732399\",\"expiration\":\"2022-11-28T18:37:28\",\"seller\":\"1.2.384119\",\"for_sale\":5000000,\"sell_price\":{\"base\":{\"amount\":5000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":350000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39739763\",\"expiration\":\"2022-11-28T19:58:55\",\"seller\":\"1.2.444127\",\"for_sale\":1210229,\"sell_price\":{\"base\":{\"amount\":1210229,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":85199944,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39724012\",\"expiration\":\"2022-11-28T17:07:09\",\"seller\":\"1.2.146567\",\"for_sale\":2000000,\"sell_price\":{\"base\":{\"amount\":2000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":141843971,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39574007\",\"expiration\":\"2022-11-27T19:40:39\",\"seller\":\"1.2.146567\",\"for_sale\":140901,\"sell_price\":{\"base\":{\"amount\":140901,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":10000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39732407\",\"expiration\":\"2022-11-28T18:37:34\",\"seller\":\"1.2.384119\",\"for_sale\":5000000,\"sell_price\":{\"base\":{\"amount\":5000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":355000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39588063\",\"expiration\":\"2022-11-27T21:51:29\",\"seller\":\"1.2.394864\",\"for_sale\":1500000,\"sell_price\":{\"base\":{\"amount\":1500000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":106759916,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39726395\",\"expiration\":\"2022-11-28T17:27:43\",\"seller\":\"1.2.25932\",\"for_sale\":159689,\"sell_price\":{\"base\":{\"amount\":159689,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":11365765,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1248},{\"id\":\"1.7.39713749\",\"expiration\":\"2022-11-28T15:28:20\",\"seller\":\"1.2.467917\",\"for_sale\":17410,\"sell_price\":{\"base\":{\"amount\":17410,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":1243567,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39706578\",\"expiration\":\"2022-11-28T14:11:13\",\"seller\":\"1.2.443284\",\"for_sale\":5000000,\"sell_price\":{\"base\":{\"amount\":5000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":357142857,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39816924\",\"expiration\":\"2022-11-29T03:40:12\",\"seller\":\"1.2.445451\",\"for_sale\":28000000,\"sell_price\":{\"base\":{\"amount\":28000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":2000000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39515307\",\"expiration\":\"2022-11-27T13:19:16\",\"seller\":\"1.2.168996\",\"for_sale\":1677733,\"sell_price\":{\"base\":{\"amount\":1677733,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":120000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39592929\",\"expiration\":\"2022-11-27T22:44:52\",\"seller\":\"1.2.406209\",\"for_sale\":195300,\"sell_price\":{\"base\":{\"amount\":195300,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":14000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39491714\",\"expiration\":\"2022-11-27T10:28:09\",\"seller\":\"1.2.435836\",\"for_sale\":5789525,\"sell_price\":{\"base\":{\"amount\":5789525,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":415284575,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39487775\",\"expiration\":\"2022-11-27T10:03:25\",\"seller\":\"1.2.392110\",\"for_sale\":63392638,\"sell_price\":{\"base\":{\"amount\":80000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":\"5738682718\",\"asset_id\":\"1.3.0\"}},\"deferred_fee\":0},{\"id\":\"1.7.39517335\",\"expiration\":\"2022-11-27T13:34:50\",\"seller\":\"1.2.441250\",\"for_sale\":2050000,\"sell_price\":{\"base\":{\"amount\":2050000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":147482014,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39787574\",\"expiration\":\"2022-11-29T00:56:04\",\"seller\":\"1.2.393319\",\"for_sale\":1389000,\"sell_price\":{\"base\":{\"amount\":1389000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":100000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39732410\",\"expiration\":\"2022-11-28T18:37:41\",\"seller\":\"1.2.384119\",\"for_sale\":5000000,\"sell_price\":{\"base\":{\"amount\":5000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":360000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39517481\",\"expiration\":\"2022-11-27T13:35:35\",\"seller\":\"1.2.441250\",\"for_sale\":2050000,\"sell_price\":{\"base\":{\"amount\":2050000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":148550724,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39732419\",\"expiration\":\"2022-11-28T18:37:46\",\"seller\":\"1.2.384119\",\"for_sale\":5000000,\"sell_price\":{\"base\":{\"amount\":5000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":365000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39435065\",\"expiration\":\"2022-11-27T05:09:48\",\"seller\":\"1.2.457023\",\"for_sale\":10000,\"sell_price\":{\"base\":{\"amount\":10000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":734000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39722683\",\"expiration\":\"2022-11-28T16:55:10\",\"seller\":\"1.2.203202\",\"for_sale\":190965,\"sell_price\":{\"base\":{\"amount\":190965,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":14016831,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39484129\",\"expiration\":\"2022-11-27T09:45:08\",\"seller\":\"1.2.28914\",\"for_sale\":6805000,\"sell_price\":{\"base\":{\"amount\":6805000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":500000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39418777\",\"expiration\":\"2022-11-27T03:18:07\",\"seller\":\"1.2.23586\",\"for_sale\":4000000,\"sell_price\":{\"base\":{\"amount\":4000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":294000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39726984\",\"expiration\":\"2022-11-28T17:33:46\",\"seller\":\"1.2.33175\",\"for_sale\":7048821,\"sell_price\":{\"base\":{\"amount\":7048821,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":518299472,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39649090\",\"expiration\":\"2022-11-28T06:31:01\",\"seller\":\"1.2.444127\",\"for_sale\":1176408,\"sell_price\":{\"base\":{\"amount\":1176408,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":86959941,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39732428\",\"expiration\":\"2022-11-28T18:37:52\",\"seller\":\"1.2.384119\",\"for_sale\":5000000,\"sell_price\":{\"base\":{\"amount\":5000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":370000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39728795\",\"expiration\":\"2022-11-28T17:56:51\",\"seller\":\"1.2.430356\",\"for_sale\":10302063,\"sell_price\":{\"base\":{\"amount\":10302063,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":763115777,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1236},{\"id\":\"1.7.39512722\",\"expiration\":\"2022-11-27T13:04:24\",\"seller\":\"1.2.169756\",\"for_sale\":4995000,\"sell_price\":{\"base\":{\"amount\":4995000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":370000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39418900\",\"expiration\":\"2022-11-27T03:18:58\",\"seller\":\"1.2.23586\",\"for_sale\":3270000,\"sell_price\":{\"base\":{\"amount\":3270000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":245250000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39497263\",\"expiration\":\"2022-11-27T11:11:47\",\"seller\":\"1.2.363509\",\"for_sale\":85806,\"sell_price\":{\"base\":{\"amount\":85806,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":6435450,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39732437\",\"expiration\":\"2022-11-28T18:37:58\",\"seller\":\"1.2.384119\",\"for_sale\":5000000,\"sell_price\":{\"base\":{\"amount\":5000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":375000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39509513\",\"expiration\":\"2022-11-27T12:47:47\",\"seller\":\"1.2.152063\",\"for_sale\":1055407,\"sell_price\":{\"base\":{\"amount\":1055407,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":79353909,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39592860\",\"expiration\":\"2022-11-27T22:43:27\",\"seller\":\"1.2.406209\",\"for_sale\":98420,\"sell_price\":{\"base\":{\"amount\":98420,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":7400000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39732443\",\"expiration\":\"2022-11-28T18:38:03\",\"seller\":\"1.2.384119\",\"for_sale\":5000000,\"sell_price\":{\"base\":{\"amount\":5000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":380000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39697357\",\"expiration\":\"2022-11-28T13:01:34\",\"seller\":\"1.2.474330\",\"for_sale\":393000,\"sell_price\":{\"base\":{\"amount\":393000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":30000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39169827\",\"expiration\":\"2022-11-25T21:52:00\",\"seller\":\"1.2.146567\",\"for_sale\":13090,\"sell_price\":{\"base\":{\"amount\":13090,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":1000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39186397\",\"expiration\":\"2022-11-25T23:51:05\",\"seller\":\"1.2.470440\",\"for_sale\":1308010,\"sell_price\":{\"base\":{\"amount\":1308010,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":100000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39237988\",\"expiration\":\"2022-11-26T05:55:59\",\"seller\":\"1.2.394864\",\"for_sale\":956021,\"sell_price\":{\"base\":{\"amount\":956021,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":73298499,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38477978\",\"expiration\":\"2022-11-22T11:09:49\",\"seller\":\"1.2.32432\",\"for_sale\":928572,\"sell_price\":{\"base\":{\"amount\":928572,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":71428571,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38324090\",\"expiration\":\"2022-11-21T21:13:54\",\"seller\":\"1.2.34866\",\"for_sale\":2363637,\"sell_price\":{\"base\":{\"amount\":2363637,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":181818181,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38323860\",\"expiration\":\"2022-11-21T21:11:28\",\"seller\":\"1.2.110360\",\"for_sale\":100000,\"sell_price\":{\"base\":{\"amount\":100000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":7692307,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38582244\",\"expiration\":\"2022-11-22T21:36:15\",\"seller\":\"1.2.307732\",\"for_sale\":975000,\"sell_price\":{\"base\":{\"amount\":975000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":75000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39534038\",\"expiration\":\"2022-11-27T15:32:58\",\"seller\":\"1.2.89816\",\"for_sale\":26000000,\"sell_price\":{\"base\":{\"amount\":26000000,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":2000000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39419038\",\"expiration\":\"2022-11-27T03:19:36\",\"seller\":\"1.2.23586\",\"for_sale\":3624500,\"sell_price\":{\"base\":{\"amount\":3624500,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":279086500,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38309073\",\"expiration\":\"2022-11-21T19:37:30\",\"seller\":\"1.2.165359\",\"for_sale\":518520,\"sell_price\":{\"base\":{\"amount\":518520,\"asset_id\":\"1.3.121\"},\"quote\":{\"amount\":40000000,\"asset_id\":\"1.3.0\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826987\",\"expiration\":\"2022-11-28T04:31:28\",\"seller\":\"1.2.126225\",\"for_sale\":5637462,\"sell_price\":{\"base\":{\"amount\":5837574,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":100000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":0},{\"id\":\"1.7.39826962\",\"expiration\":\"2022-11-28T04:31:25\",\"seller\":\"1.2.116747\",\"for_sale\":29187564,\"sell_price\":{\"base\":{\"amount\":29187564,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":499999,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826504\",\"expiration\":\"2022-11-29T04:29:06\",\"seller\":\"1.2.470016\",\"for_sale\":4423746,\"sell_price\":{\"base\":{\"amount\":4423746,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":75782,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826958\",\"expiration\":\"1963-11-25T23:31:44\",\"seller\":\"1.2.442895\",\"for_sale\":151718210,\"sell_price\":{\"base\":{\"amount\":151718210,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":2600566,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39825989\",\"expiration\":\"1963-11-25T17:31:44\",\"seller\":\"1.2.359372\",\"for_sale\":70741090,\"sell_price\":{\"base\":{\"amount\":70741090,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1214423,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826801\",\"expiration\":\"1963-11-25T14:31:44\",\"seller\":\"1.2.475168\",\"for_sale\":44187474,\"sell_price\":{\"base\":{\"amount\":44187474,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":758636,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39819539\",\"expiration\":\"2022-11-29T03:54:38\",\"seller\":\"1.2.456209\",\"for_sale\":8799002,\"sell_price\":{\"base\":{\"amount\":8799002,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":151078,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39817429\",\"expiration\":\"2022-11-29T03:40:58\",\"seller\":\"1.2.384257\",\"for_sale\":146100000,\"sell_price\":{\"base\":{\"amount\":146100000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":2512890,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39817124\",\"expiration\":\"2022-11-29T03:41:13\",\"seller\":\"1.2.456209\",\"for_sale\":8799002,\"sell_price\":{\"base\":{\"amount\":8799002,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":151342,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39827040\",\"expiration\":\"2017-11-29T05:31:31\",\"seller\":\"1.2.359723\",\"for_sale\":59168823,\"sell_price\":{\"base\":{\"amount\":59168823,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1021695,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826066\",\"expiration\":\"1963-11-25T22:31:44\",\"seller\":\"1.2.475521\",\"for_sale\":262398871,\"sell_price\":{\"base\":{\"amount\":262398871,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":4531618,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39814186\",\"expiration\":\"2022-11-29T03:30:39\",\"seller\":\"1.2.384257\",\"for_sale\":28800000,\"sell_price\":{\"base\":{\"amount\":28800000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":498237,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826021\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.403430\",\"for_sale\":1768527,\"sell_price\":{\"base\":{\"amount\":1768527,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":30602,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39825992\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.395549\",\"for_sale\":884263,\"sell_price\":{\"base\":{\"amount\":884263,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":15301,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826008\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.368699\",\"for_sale\":884263,\"sell_price\":{\"base\":{\"amount\":884263,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":15301,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826013\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.354462\",\"for_sale\":884263,\"sell_price\":{\"base\":{\"amount\":884263,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":15301,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39825997\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.443891\",\"for_sale\":8842636,\"sell_price\":{\"base\":{\"amount\":8842636,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":153014,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826005\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.423992\",\"for_sale\":8842636,\"sell_price\":{\"base\":{\"amount\":8842636,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":153014,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826034\",\"expiration\":\"1963-11-25T22:31:44\",\"seller\":\"1.2.95758\",\"for_sale\":88426363,\"sell_price\":{\"base\":{\"amount\":88426363,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1530149,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826012\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.465862\",\"for_sale\":104343108,\"sell_price\":{\"base\":{\"amount\":104343108,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1805576,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39813053\",\"expiration\":\"2022-11-29T03:26:57\",\"seller\":\"1.2.440027\",\"for_sale\":793249585,\"sell_price\":{\"base\":{\"amount\":793249585,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":13739082,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826041\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.265788\",\"for_sale\":1716847,\"sell_price\":{\"base\":{\"amount\":1716847,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":29855,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39812537\",\"expiration\":\"2022-11-29T03:23:59\",\"seller\":\"1.2.456209\",\"for_sale\":4580116,\"sell_price\":{\"base\":{\"amount\":4580116,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":79694,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39808094\",\"expiration\":\"2022-11-29T02:58:27\",\"seller\":\"1.2.384257\",\"for_sale\":65885582,\"sell_price\":{\"base\":{\"amount\":237000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":4130886,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":0},{\"id\":\"1.7.39825788\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.398049\",\"for_sale\":29415141,\"sell_price\":{\"base\":{\"amount\":29415141,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":512760,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39825974\",\"expiration\":\"1963-11-26T01:31:44\",\"seller\":\"1.2.284457\",\"for_sale\":176852726,\"sell_price\":{\"base\":{\"amount\":176852726,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":3090599,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826017\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.410471\",\"for_sale\":265279089,\"sell_price\":{\"base\":{\"amount\":265279089,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":4635899,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826241\",\"expiration\":\"2017-12-06T04:27:13\",\"seller\":\"1.2.171023\",\"for_sale\":881150,\"sell_price\":{\"base\":{\"amount\":881150,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":15429,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39815120\",\"expiration\":\"2022-11-29T03:34:31\",\"seller\":\"1.2.96660\",\"for_sale\":\"57100000000\",\"sell_price\":{\"base\":{\"amount\":\"57100000000\",\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1000000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39824425\",\"expiration\":\"2017-12-06T04:19:15\",\"seller\":\"1.2.287187\",\"for_sale\":15907571,\"sell_price\":{\"base\":{\"amount\":15907571,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":279521,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826399\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.399496\",\"for_sale\":448610,\"sell_price\":{\"base\":{\"amount\":448610,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":7908,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39825790\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.396680\",\"for_sale\":8833375,\"sell_price\":{\"base\":{\"amount\":8833375,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":156044,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826308\",\"expiration\":\"1963-11-29T12:38:45\",\"seller\":\"1.2.36449\",\"for_sale\":\"4421486581\",\"sell_price\":{\"base\":{\"amount\":\"4421486581\",\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":78781360,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826064\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.399578\",\"for_sale\":2652790,\"sell_price\":{\"base\":{\"amount\":2652790,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":47267,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826003\",\"expiration\":\"1963-11-25T15:31:44\",\"seller\":\"1.2.453726\",\"for_sale\":2521441,\"sell_price\":{\"base\":{\"amount\":2521441,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":44927,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826816\",\"expiration\":\"1963-11-29T12:38:45\",\"seller\":\"1.2.33015\",\"for_sale\":7356955,\"sell_price\":{\"base\":{\"amount\":7356955,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":131374,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38751649\",\"expiration\":\"2022-11-23T17:29:56\",\"seller\":\"1.2.203202\",\"for_sale\":112000000,\"sell_price\":{\"base\":{\"amount\":112000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":2000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39783095\",\"expiration\":\"2022-11-29T00:21:53\",\"seller\":\"1.2.437844\",\"for_sale\":161968793,\"sell_price\":{\"base\":{\"amount\":161968793,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":2899241,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826049\",\"expiration\":\"1963-11-25T14:31:44\",\"seller\":\"1.2.381972\",\"for_sale\":26527908,\"sell_price\":{\"base\":{\"amount\":26527908,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":474952,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39718235\",\"expiration\":\"2022-11-28T16:13:19\",\"seller\":\"1.2.99949\",\"for_sale\":\"6584400000\",\"sell_price\":{\"base\":{\"amount\":\"6584400000\",\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":118024711,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826039\",\"expiration\":\"1963-11-25T14:31:44\",\"seller\":\"1.2.414841\",\"for_sale\":44213181,\"sell_price\":{\"base\":{\"amount\":44213181,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":794617,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39825977\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.4890\",\"for_sale\":858029,\"sell_price\":{\"base\":{\"amount\":858029,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":15435,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.25560191\",\"expiration\":\"2022-09-01T16:47:07\",\"seller\":\"1.2.338201\",\"for_sale\":3494185,\"sell_price\":{\"base\":{\"amount\":3494185,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":62895,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38522042\",\"expiration\":\"2022-11-22T14:49:29\",\"seller\":\"1.2.183905\",\"for_sale\":2222223,\"sell_price\":{\"base\":{\"amount\":2222223,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":40000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.23679244\",\"expiration\":\"2022-08-18T14:23:42\",\"seller\":\"1.2.32432\",\"for_sale\":55555556,\"sell_price\":{\"base\":{\"amount\":55555556,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38835207\",\"expiration\":\"2022-11-24T06:11:33\",\"seller\":\"1.2.26041\",\"for_sale\":555555556,\"sell_price\":{\"base\":{\"amount\":555555556,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":10000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.36775910\",\"expiration\":\"2022-11-14T06:54:06\",\"seller\":\"1.2.461373\",\"for_sale\":14000000,\"sell_price\":{\"base\":{\"amount\":14000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":252000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38343747\",\"expiration\":\"2022-11-21T23:43:04\",\"seller\":\"1.2.114583\",\"for_sale\":500000000,\"sell_price\":{\"base\":{\"amount\":500000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":9000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826000\",\"expiration\":\"1963-11-25T14:31:44\",\"seller\":\"1.2.379967\",\"for_sale\":8381645,\"sell_price\":{\"base\":{\"amount\":8381645,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":151499,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38446613\",\"expiration\":\"2022-11-22T08:19:40\",\"seller\":\"1.2.444127\",\"for_sale\":77580077,\"sell_price\":{\"base\":{\"amount\":77580077,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1406451,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39826878\",\"expiration\":\"1963-11-25T22:31:44\",\"seller\":\"1.2.450176\",\"for_sale\":4013160,\"sell_price\":{\"base\":{\"amount\":4013160,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":72924,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39813365\",\"expiration\":\"2022-11-29T03:28:19\",\"seller\":\"1.2.470558\",\"for_sale\":27500000,\"sell_price\":{\"base\":{\"amount\":27500000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":500000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39822798\",\"expiration\":\"1963-11-25T09:31:44\",\"seller\":\"1.2.165710\",\"for_sale\":4248765,\"sell_price\":{\"base\":{\"amount\":4248765,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":77287,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38303494\",\"expiration\":\"2022-11-21T18:26:05\",\"seller\":\"1.2.457225\",\"for_sale\":64196743,\"sell_price\":{\"base\":{\"amount\":64196743,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1179750,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38242275\",\"expiration\":\"2022-11-21T11:26:50\",\"seller\":\"1.2.430159\",\"for_sale\":4000000,\"sell_price\":{\"base\":{\"amount\":4000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":73600,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38550329\",\"expiration\":\"2022-11-22T17:20:51\",\"seller\":\"1.2.422975\",\"for_sale\":51173959,\"sell_price\":{\"base\":{\"amount\":51173959,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":946718,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.25546186\",\"expiration\":\"2022-09-01T14:53:32\",\"seller\":\"1.2.158537\",\"for_sale\":212001462,\"sell_price\":{\"base\":{\"amount\":212001462,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":3962986,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39617047\",\"expiration\":\"2022-11-28T01:53:19\",\"seller\":\"1.2.159614\",\"for_sale\":159489634,\"sell_price\":{\"base\":{\"amount\":159489634,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":3000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.15353005\",\"expiration\":\"2022-07-09T12:07:25\",\"seller\":\"1.2.267\",\"for_sale\":265789474,\"sell_price\":{\"base\":{\"amount\":265789474,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":5050000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.21991367\",\"expiration\":\"2022-08-07T07:17:36\",\"seller\":\"1.2.32432\",\"for_sale\":52631579,\"sell_price\":{\"base\":{\"amount\":52631579,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38839709\",\"expiration\":\"2022-11-24T06:37:46\",\"seller\":\"1.2.26041\",\"for_sale\":526315790,\"sell_price\":{\"base\":{\"amount\":526315790,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":10000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39771147\",\"expiration\":\"2022-11-28T23:28:53\",\"seller\":\"1.2.375610\",\"for_sale\":100000000,\"sell_price\":{\"base\":{\"amount\":100000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1900000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38446699\",\"expiration\":\"2022-11-22T08:19:48\",\"seller\":\"1.2.444127\",\"for_sale\":76266740,\"sell_price\":{\"base\":{\"amount\":76266740,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1451774,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.18636813\",\"expiration\":\"2022-07-21T04:14:18\",\"seller\":\"1.2.116476\",\"for_sale\":525000000,\"sell_price\":{\"base\":{\"amount\":525000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":10000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.37077687\",\"expiration\":\"2022-11-16T01:37:47\",\"seller\":\"1.2.203594\",\"for_sale\":300000000,\"sell_price\":{\"base\":{\"amount\":300000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":5752293,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38303501\",\"expiration\":\"2022-11-21T18:26:13\",\"seller\":\"1.2.457225\",\"for_sale\":64196743,\"sell_price\":{\"base\":{\"amount\":64196743,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1243947,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.14883703\",\"expiration\":\"2022-07-07T22:48:58\",\"seller\":\"1.2.267\",\"for_sale\":258974359,\"sell_price\":{\"base\":{\"amount\":258974359,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":5050000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38333659\",\"expiration\":\"2022-11-21T22:24:06\",\"seller\":\"1.2.443514\",\"for_sale\":500000000,\"sell_price\":{\"base\":{\"amount\":500000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":9750000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.23484383\",\"expiration\":\"2022-08-17T06:57:34\",\"seller\":\"1.2.266278\",\"for_sale\":51000000,\"sell_price\":{\"base\":{\"amount\":51000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38258389\",\"expiration\":\"2022-11-21T12:48:52\",\"seller\":\"1.2.388463\",\"for_sale\":199000000,\"sell_price\":{\"base\":{\"amount\":199000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":3940200,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39534012\",\"expiration\":\"2022-11-27T15:32:14\",\"seller\":\"1.2.203202\",\"for_sale\":199900000,\"sell_price\":{\"base\":{\"amount\":199900000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":3958020,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39535581\",\"expiration\":\"2022-11-27T15:44:53\",\"seller\":\"1.2.203202\",\"for_sale\":199900000,\"sell_price\":{\"base\":{\"amount\":199900000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":3958020,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39617049\",\"expiration\":\"2022-11-28T01:53:26\",\"seller\":\"1.2.159614\",\"for_sale\":151438668,\"sell_price\":{\"base\":{\"amount\":151438668,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":3000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38333697\",\"expiration\":\"2022-11-21T22:24:19\",\"seller\":\"1.2.443514\",\"for_sale\":500000000,\"sell_price\":{\"base\":{\"amount\":500000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":9950000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39516285\",\"expiration\":\"2022-11-27T13:27:48\",\"seller\":\"1.2.36352\",\"for_sale\":753012049,\"sell_price\":{\"base\":{\"amount\":753012049,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":15000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39799318\",\"expiration\":\"2022-11-29T01:58:14\",\"seller\":\"1.2.398578\",\"for_sale\":44016437,\"sell_price\":{\"base\":{\"amount\":44016437,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":879448,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38446740\",\"expiration\":\"2022-11-22T08:19:58\",\"seller\":\"1.2.444127\",\"for_sale\":75015943,\"sell_price\":{\"base\":{\"amount\":75015943,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1499362,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39563988\",\"expiration\":\"2022-11-27T19:11:12\",\"seller\":\"1.2.155012\",\"for_sale\":\"10000000000\",\"sell_price\":{\"base\":{\"amount\":\"10000000000\",\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":199990000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38502824\",\"expiration\":\"2022-11-22T13:39:08\",\"seller\":\"1.2.422975\",\"for_sale\":33949422,\"sell_price\":{\"base\":{\"amount\":33949422,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":678988,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.26162941\",\"expiration\":\"2022-09-05T04:26:53\",\"seller\":\"1.2.114303\",\"for_sale\":87304970,\"sell_price\":{\"base\":{\"amount\":87304970,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1746099,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.30738611\",\"expiration\":\"2022-10-04T20:20:55\",\"seller\":\"1.2.394462\",\"for_sale\":648063095,\"sell_price\":{\"base\":{\"amount\":648063095,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":12961261,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39489300\",\"expiration\":\"2022-11-27T10:12:44\",\"seller\":\"1.2.437837\",\"for_sale\":548553862,\"sell_price\":{\"base\":{\"amount\":548553862,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":10971077,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.14756774\",\"expiration\":\"2022-07-07T12:10:46\",\"seller\":\"1.2.267\",\"for_sale\":252500000,\"sell_price\":{\"base\":{\"amount\":252500000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":5050000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.18636812\",\"expiration\":\"2022-07-21T04:14:07\",\"seller\":\"1.2.116476\",\"for_sale\":500000000,\"sell_price\":{\"base\":{\"amount\":500000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":10000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.21991369\",\"expiration\":\"2022-08-07T07:17:44\",\"seller\":\"1.2.32432\",\"for_sale\":50000000,\"sell_price\":{\"base\":{\"amount\":50000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.23216503\",\"expiration\":\"2022-08-15T08:57:18\",\"seller\":\"1.2.266278\",\"for_sale\":50000000,\"sell_price\":{\"base\":{\"amount\":50000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":1000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.23818382\",\"expiration\":\"2022-08-19T14:09:22\",\"seller\":\"1.2.266278\",\"for_sale\":25000000,\"sell_price\":{\"base\":{\"amount\":25000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":500000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.33199477\",\"expiration\":\"2022-10-23T08:11:42\",\"seller\":\"1.2.367064\",\"for_sale\":5000000,\"sell_price\":{\"base\":{\"amount\":5000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":100000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.37868756\",\"expiration\":\"2022-11-19T23:13:33\",\"seller\":\"1.2.104650\",\"for_sale\":\"4500000000\",\"sell_price\":{\"base\":{\"amount\":\"4500000000\",\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":90000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38050853\",\"expiration\":\"2022-11-20T17:59:01\",\"seller\":\"1.2.32653\",\"for_sale\":185000000,\"sell_price\":{\"base\":{\"amount\":185000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":3700000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38270285\",\"expiration\":\"2022-11-21T14:08:27\",\"seller\":\"1.2.404345\",\"for_sale\":2500000,\"sell_price\":{\"base\":{\"amount\":2500000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":50000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.39051789\",\"expiration\":\"2022-11-25T05:52:17\",\"seller\":\"1.2.165313\",\"for_sale\":250000000,\"sell_price\":{\"base\":{\"amount\":250000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":5000000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38038751\",\"expiration\":\"2022-11-20T17:09:43\",\"seller\":\"1.2.99949\",\"for_sale\":\"10628496871\",\"sell_price\":{\"base\":{\"amount\":\"10628496871\",\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":214729924,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38333708\",\"expiration\":\"2022-11-21T22:24:36\",\"seller\":\"1.2.443514\",\"for_sale\":500000000,\"sell_price\":{\"base\":{\"amount\":500000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":10150000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.37016152\",\"expiration\":\"2022-11-15T17:10:45\",\"seller\":\"1.2.99896\",\"for_sale\":1000000000,\"sell_price\":{\"base\":{\"amount\":1000000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":20300010,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38294306\",\"expiration\":\"2022-11-21T17:09:33\",\"seller\":\"1.2.99949\",\"for_sale\":\"9593198903\",\"sell_price\":{\"base\":{\"amount\":\"9593198903\",\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":195599090,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38038797\",\"expiration\":\"2022-11-20T17:09:56\",\"seller\":\"1.2.99949\",\"for_sale\":\"10628496871\",\"sell_price\":{\"base\":{\"amount\":\"10628496871\",\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":216855623,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.14673195\",\"expiration\":\"2022-07-07T03:21:11\",\"seller\":\"1.2.267\",\"for_sale\":183076053,\"sell_price\":{\"base\":{\"amount\":246341464,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":5050000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":0},{\"id\":\"1.7.39707664\",\"expiration\":\"2022-11-28T14:20:03\",\"seller\":\"1.2.443284\",\"for_sale\":3096209579,\"sell_price\":{\"base\":{\"amount\":3096209579,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":63695223,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213},{\"id\":\"1.7.38333740\",\"expiration\":\"2022-11-21T22:24:48\",\"seller\":\"1.2.443514\",\"for_sale\":500000000,\"sell_price\":{\"base\":{\"amount\":500000000,\"asset_id\":\"1.3.0\"},\"quote\":{\"amount\":10300000,\"asset_id\":\"1.3.121\"}},\"deferred_fee\":1213}]}"; + GsonBuilder builder = new GsonBuilder(); + builder.registerTypeAdapter(AssetAmount.class, new AssetAmount.AssetAmountDeserializer()); + builder.registerTypeAdapter(UserAccount.class, new UserAccount.UserAccountSimpleDeserializer()); + builder.registerTypeAdapter(LimitOrder.class, new LimitOrder.LimitOrderDeserializer()); + Type GetLimitOrdersResponse = new TypeToken>>() {}.getType(); + WitnessResponse> witnessResponse = builder.create().fromJson(serializedOrderBook, GetLimitOrdersResponse); + List orders = witnessResponse.result; + OrderBook orderBook = new OrderBook(orders); + + // Testing obtained quote calculation + long receivedValue = 56111; + long agoriseCut = 280; + UnsignedLong merchantsQuote = orderBook.calculateObtainedQuote(new AssetAmount(UnsignedLong.valueOf(receivedValue - agoriseCut), new Asset("1.3.0"))); + Assert.assertEquals(941, merchantsQuote.longValue()); + + // Testing required base calculation + UnsignedLong baseAmount = orderBook.calculateRequiredBase(new AssetAmount(UnsignedLong.valueOf(10000), new Asset("1.3.121"))); + Assert.assertEquals(593000, baseAmount.longValue()); + } } From 74767f2d1d1c63f81e459400d315d2d117bcd461 Mon Sep 17 00:00:00 2001 From: Kostya Shpachenko Date: Tue, 12 Dec 2017 16:36:50 +0200 Subject: [PATCH 41/49] Implemented GetBlock API call --- .../main/java/cy/agorise/graphenej/RPC.java | 1 + .../cy/agorise/graphenej/api/GetBlock.java | 108 ++++++++++++++++++ .../cy/agorise/graphenej/models/Block.java | 71 ++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 graphenej/src/main/java/cy/agorise/graphenej/api/GetBlock.java create mode 100644 graphenej/src/main/java/cy/agorise/graphenej/models/Block.java diff --git a/graphenej/src/main/java/cy/agorise/graphenej/RPC.java b/graphenej/src/main/java/cy/agorise/graphenej/RPC.java index e1f42c0..ea6c509 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/RPC.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/RPC.java @@ -25,6 +25,7 @@ public class RPC { public static final String GET_ACCOUNT_BALANCES = "get_account_balances"; public static final String CALL_LOOKUP_ASSET_SYMBOLS = "lookup_asset_symbols"; public static final String CALL_GET_BLOCK_HEADER = "get_block_header"; + public static final String CALL_GET_BLOCK = "get_block"; public static final String CALL_GET_LIMIT_ORDERS = "get_limit_orders"; public static final String CALL_GET_TRADE_HISTORY = "get_trade_history"; public static final String CALL_GET_MARKET_HISTORY = "get_market_history"; diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/GetBlock.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetBlock.java new file mode 100644 index 0000000..2cef872 --- /dev/null +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetBlock.java @@ -0,0 +1,108 @@ +package cy.agorise.graphenej.api; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.neovisionaries.ws.client.WebSocket; +import com.neovisionaries.ws.client.WebSocketFrame; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.RPC; +import cy.agorise.graphenej.Transaction; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.ApiCall; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.Block; +import cy.agorise.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.operations.TransferOperation; + +import java.io.Serializable; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class GetBlock extends BaseGrapheneHandler { + + private final static int LOGIN_ID = 1; + private final static int GET_DATABASE_ID = 2; + private final static int GET_BLOCK_ID = 3; + + private long blockNumber; + private WitnessResponseListener mListener; + + private int currentId = LOGIN_ID; + + private boolean mOneTime; + + public GetBlock(long blockNumber, boolean oneTime, WitnessResponseListener listener){ + super(listener); + this.blockNumber = blockNumber; + this.mOneTime = oneTime; + this.mListener = listener; + } + + public GetBlock(long blockNumber, WitnessResponseListener listener){ + this(blockNumber, true, listener); + } + + @Override + public void onConnected(WebSocket websocket, Map> headers) throws Exception { + ArrayList loginParams = new ArrayList<>(); + loginParams.add(null); + loginParams.add(null); + ApiCall loginCall = new ApiCall(1, RPC.CALL_LOGIN, loginParams, RPC.VERSION, currentId); + websocket.sendText(loginCall.toJsonString()); + } + + @Override + public void onTextFrame(WebSocket websocket, WebSocketFrame frame) throws Exception { + String response = frame.getPayloadText(); + System.out.println("<<< "+response); + + Gson gson = new Gson(); + BaseResponse baseResponse = gson.fromJson(response, BaseResponse.class); + if(baseResponse.error != null){ + mListener.onError(baseResponse.error); + if(mOneTime){ + websocket.disconnect(); + } + } else { + currentId++; + ArrayList emptyParams = new ArrayList<>(); + if (baseResponse.id == LOGIN_ID) { + ApiCall getDatabaseId = new ApiCall(1, RPC.CALL_DATABASE, emptyParams, RPC.VERSION, currentId); + websocket.sendText(getDatabaseId.toJsonString()); + } else if (baseResponse.id == GET_DATABASE_ID) { + Type ApiIdResponse = new TypeToken>() {}.getType(); + WitnessResponse witnessResponse = gson.fromJson(response, ApiIdResponse); + Integer apiId = witnessResponse.result; + + ArrayList params = new ArrayList<>(); + String blockNum = String.format("%d", this.blockNumber); + params.add(blockNum); + + ApiCall loginCall = new ApiCall(apiId, RPC.CALL_GET_BLOCK, params, RPC.VERSION, currentId); + websocket.sendText(loginCall.toJsonString()); + } else if (baseResponse.id == GET_BLOCK_ID) { + Type BlockResponse = new TypeToken>(){}.getType(); + gson = new GsonBuilder() + .registerTypeAdapter(Transaction.class, new Transaction.TransactionDeserializer()) + .registerTypeAdapter(TransferOperation.class, new TransferOperation.TransferDeserializer()) + .registerTypeAdapter(AssetAmount.class, new AssetAmount.AssetAmountDeserializer()) + .create(); + WitnessResponse blockResponse = gson.fromJson(response, BlockResponse); + mListener.onSuccess(blockResponse); + if (mOneTime) { + websocket.disconnect(); + } + } + } + + } + + @Override + public void onFrameSent(WebSocket websocket, WebSocketFrame frame) throws Exception { + if(frame.isTextFrame()) + System.out.println(">>> "+frame.getPayloadText()); + } +} diff --git a/graphenej/src/main/java/cy/agorise/graphenej/models/Block.java b/graphenej/src/main/java/cy/agorise/graphenej/models/Block.java new file mode 100644 index 0000000..625d9d4 --- /dev/null +++ b/graphenej/src/main/java/cy/agorise/graphenej/models/Block.java @@ -0,0 +1,71 @@ +package cy.agorise.graphenej.models; + +import cy.agorise.graphenej.Transaction; + +import java.util.List; + +public class Block { + private String previous; + private String timestamp; + private String witness; + private String transaction_merkle_root; + private Object[] extensions; + private String witness_signature; + private List transactions; + + public String getPrevious() { + return previous; + } + + public void setPrevious(String previous) { + this.previous = previous; + } + + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + public String getWitness() { + return witness; + } + + public void setWitness(String witness) { + this.witness = witness; + } + + public String getTransaction_merkle_root() { + return transaction_merkle_root; + } + + public void setTransaction_merkle_root(String transaction_merkle_root) { + this.transaction_merkle_root = transaction_merkle_root; + } + + public Object[] getExtensions() { + return extensions; + } + + public void setExtensions(Object[] extensions) { + this.extensions = extensions; + } + + public String getWitness_signature() { + return witness_signature; + } + + public void setWitness_signature(String witness_signature) { + this.witness_signature = witness_signature; + } + + public List getTransactions() { + return transactions; + } + + public void setTransactions(List transactions) { + this.transactions = transactions; + } +} From a849fae997803210444e943decc92ffa4821a32e Mon Sep 17 00:00:00 2001 From: Kostya Shpachenko Date: Tue, 12 Dec 2017 16:37:50 +0200 Subject: [PATCH 42/49] Added test for GetBlock API call --- .../agorise/graphenej/api/GetBlockTest.java | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 graphenej/src/test/java/cy/agorise/graphenej/api/GetBlockTest.java diff --git a/graphenej/src/test/java/cy/agorise/graphenej/api/GetBlockTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/GetBlockTest.java new file mode 100644 index 0000000..1689e04 --- /dev/null +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/GetBlockTest.java @@ -0,0 +1,110 @@ +package cy.agorise.graphenej.api; + +import com.google.common.primitives.UnsignedLong; +import com.neovisionaries.ws.client.WebSocketException; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.BaseOperation; +import cy.agorise.graphenej.Transaction; +import cy.agorise.graphenej.interfaces.WitnessResponseListener; +import cy.agorise.graphenej.models.BaseResponse; +import cy.agorise.graphenej.models.Block; +import cy.agorise.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.operations.TransferOperation; +import org.junit.Assert; +import org.junit.Test; + +import java.util.List; +import java.util.concurrent.Exchanger; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import static org.hamcrest.CoreMatchers.instanceOf; + +public class GetBlockTest extends BaseApiTest { + private final static long BLOCK_NUMBER = 15776988L; + + private final static String EXPECTED_PREVIOUS = "00f0bcdbe3d9dc66d8597e7b013a16d8dea5f778"; + private final static String EXPECTED_TIMESTAMP = "2017-04-18T04:14:51"; + private final static String EXPECTED_WITNESS = "1.6.17"; + private final static String EXPECTED_TRANSACTION_MERKLE_ROOT = "fb87a3f8af907a2450c327d181b2833b8270a504"; + private final static int EXPECTED_EXTENSIONS_SIZE = 0; + private final static String EXPECTED_WITNESS_SIGNATURE = "20160921c8ba0d312dee14bdc780c3d05b27e406e2d014b8a2415e9843bf7075cb7abbc45f5173ffefac69cecf4dd2afa5dce6076bdf24cc577ff49427babe75e1"; + private final static int EXPECTED_TRANSACTIONS_SIZE = 1; + private final static int EXPECTED_OPERATIONS_SIZE = 1; + + private final static UnsignedLong EXPECTED_FEE_AMOUNT = UnsignedLong.valueOf(2048); + private final static String EXPECTED_FEE_ASSET_ID = "1.3.113"; + private final static String EXPECTED_FROM = "1.2.151069"; + private final static String EXPECTED_TO = "1.2.116354"; + private final static UnsignedLong EXPECTED_AMOUNT = UnsignedLong.valueOf(13700); + private final static String EXPECTED_ASSET_ID = "1.3.113"; + + @Test + public void testGetBlock() { + try { + final Exchanger responseExchanger = new Exchanger<>(); + mWebSocket.addListener(new GetBlock(BLOCK_NUMBER, new WitnessResponseListener() { + @Override + public void onSuccess(WitnessResponse response) { + System.out.println("onSuccess"); + try { + responseExchanger.exchange(response.result); + } catch (InterruptedException e) { + System.out.println("InterruptedException in success handler. Msg: " + e.getMessage()); + } + } + + @Override + public void onError(BaseResponse.Error error) { + System.out.println("onError"); + try { + responseExchanger.exchange(null); + } catch (InterruptedException e) { + System.out.println("InterruptedException in error handler. Msg: " + e.getMessage()); + } + } + })); + + mWebSocket.connect(); + + Object responseResult = responseExchanger.exchange(null, 5, TimeUnit.SECONDS); + + Block block = (Block) responseResult; + Assert.assertNotNull(block); + Assert.assertEquals(EXPECTED_PREVIOUS, block.getPrevious()); + Assert.assertEquals(EXPECTED_TIMESTAMP, block.getTimestamp()); + Assert.assertEquals(EXPECTED_WITNESS, block.getWitness()); + Assert.assertEquals(EXPECTED_TRANSACTION_MERKLE_ROOT, block.getTransaction_merkle_root()); + Assert.assertEquals(EXPECTED_EXTENSIONS_SIZE, block.getExtensions().length); + Assert.assertEquals(EXPECTED_WITNESS_SIGNATURE, block.getWitness_signature()); + + List transactions = block.getTransactions(); + Assert.assertEquals(EXPECTED_TRANSACTIONS_SIZE, transactions.size()); + + List operations = transactions.get(0).getOperations(); + Assert.assertEquals(EXPECTED_OPERATIONS_SIZE, operations.size()); + + BaseOperation operation = operations.get(0); + Assert.assertThat(operation, instanceOf(TransferOperation.class)); + + TransferOperation transferOperation = (TransferOperation) operation; + AssetAmount fee = transferOperation.getFee(); + Assert.assertEquals(EXPECTED_FEE_AMOUNT, fee.getAmount()); + Assert.assertEquals(EXPECTED_FEE_ASSET_ID, fee.getAsset().getObjectId()); + Assert.assertEquals(EXPECTED_FROM, transferOperation.getFrom().getObjectId()); + Assert.assertEquals(EXPECTED_TO, transferOperation.getTo().getObjectId()); + AssetAmount assetAmount = transferOperation.getAssetAmount(); + Assert.assertEquals(EXPECTED_AMOUNT, assetAmount.getAmount()); + Assert.assertEquals(EXPECTED_ASSET_ID, assetAmount.getAsset().getObjectId()); + } catch (WebSocketException e) { + System.out.println("WebSocketException. Msg: " + e.getMessage()); + Assert.fail("Fail because of WebSocketException"); + } catch (InterruptedException e) { + System.out.println("InterruptedException. Msg: " + e.getMessage()); + Assert.fail("Fail because of InterruptedException"); + } catch (TimeoutException e) { + System.out.println("TimeoutException. Msg: " + e.getMessage()); + Assert.fail("Fail because of TimeoutException"); + } + } +} From 16d3ff6721a9d870693f542c29db29ab2ede8b63 Mon Sep 17 00:00:00 2001 From: Kostya Shpachenko Date: Wed, 13 Dec 2017 23:55:00 +0200 Subject: [PATCH 43/49] Implemented support of custom operation --- .../main/java/cy/agorise/graphenej/Util.java | 22 ++++ .../graphenej/operations/CustomOperation.java | 124 ++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 graphenej/src/main/java/cy/agorise/graphenej/operations/CustomOperation.java diff --git a/graphenej/src/main/java/cy/agorise/graphenej/Util.java b/graphenej/src/main/java/cy/agorise/graphenej/Util.java index d746ed0..4f80a85 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/Util.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Util.java @@ -26,6 +26,8 @@ import java.nio.ByteBuffer; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -92,6 +94,26 @@ public class Util { return buffer.array(); } + /** + * Serializes long value to a byte array. + * @param data Long value. + * @return Array of bytes. + */ + public static byte[] serializeLongToBytes(long data) { + List bytes = new LinkedList<>(); + long value = data; + do { + byte b = (byte)(value & 0x7F); + value >>= 7; + if (value != 0) { + b |= 0x80; + } + bytes.add(b); + } while (value != 0); + + return Bytes.toArray(bytes); + } + /** * Utility function that compresses data using the LZMA algorithm. * @param inputBytes Input bytes of the data to be compressed. diff --git a/graphenej/src/main/java/cy/agorise/graphenej/operations/CustomOperation.java b/graphenej/src/main/java/cy/agorise/graphenej/operations/CustomOperation.java new file mode 100644 index 0000000..de4d091 --- /dev/null +++ b/graphenej/src/main/java/cy/agorise/graphenej/operations/CustomOperation.java @@ -0,0 +1,124 @@ +package cy.agorise.graphenej.operations; + +import com.google.common.primitives.Bytes; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import cy.agorise.graphenej.*; + +import java.util.LinkedList; +import java.util.List; + +public class CustomOperation extends BaseOperation { + private static final String KEY_FEE = "fee"; + private static final String KEY_PAYER = "payer"; + private static final String KEY_REQUIRED_AUTH = "required_auths"; + private static final String KEY_ID = "id"; + private static final String KEY_DATA = "data"; + + private AssetAmount fee; + private UserAccount payer; + private List requiredAuths; + private int operationId; + private String data; + + public CustomOperation(AssetAmount fee, UserAccount payer, int operationId, List requiredAuths, String data) { + super(OperationType.CUSTOM_OPERATION); + this.fee = fee; + this.payer = payer; + this.operationId = operationId; + this.requiredAuths = new LinkedList<>(); + if (requiredAuths != null) { + this.requiredAuths.addAll(requiredAuths); + } + this.data = data; + } + + public AssetAmount getFee() { + return fee; + } + + @Override + public void setFee(AssetAmount fee) { + this.fee = fee; + } + + public UserAccount getPayer() { + return payer; + } + + public void setPayer(UserAccount payer) { + this.payer = payer; + } + + public List getRequiredAuths() { + return requiredAuths; + } + + public void setRequiredAuths(List requiredAuths) { + this.requiredAuths = requiredAuths; + } + + public int getOperationId() { + return operationId; + } + + public void setOperationId(int operationId) { + this.operationId = operationId; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + @Override + public byte[] toBytes() { + byte[] feeBytes = fee.toBytes(); + byte[] payerBytes = payer.toBytes(); + List requiredAuthsSerialized = new LinkedList<>(); + if (this.requiredAuths != null) { + for (UserAccount userAccount : this.requiredAuths) { + requiredAuthsSerialized.addAll(Bytes.asList(userAccount.toBytes())); + } + } + byte[] requiredAuthsBytes = Bytes.toArray(requiredAuthsSerialized); + byte[] requiredAuthsLength = {(byte)this.requiredAuths.size()}; + byte[] operationIdBytes = Util.revertShort((short)operationId); + byte[] dataLength = Util.serializeLongToBytes(data.length()); + byte[] dataBytes = Util.hexlify(data); + + return Bytes.concat(feeBytes, payerBytes, requiredAuthsLength, requiredAuthsBytes, operationIdBytes, dataLength, dataBytes); + } + + @Override + public String toJsonString() { + return toJsonObject().toString(); + } + + @Override + public JsonElement toJsonObject() { + JsonArray array = new JsonArray(); + array.add(this.getId()); + + JsonObject jsonObject = new JsonObject(); + jsonObject.add(KEY_FEE, fee.toJsonObject()); + jsonObject.addProperty(KEY_PAYER, payer.getObjectId()); + JsonArray requiredAuthArray = new JsonArray(); + if (requiredAuths != null) { + for (UserAccount userAccount : requiredAuths) { + requiredAuthArray.add(userAccount.getObjectId()); + } + } + jsonObject.add(KEY_REQUIRED_AUTH, requiredAuthArray); + jsonObject.addProperty(KEY_ID, operationId); + jsonObject.addProperty(KEY_DATA, Util.bytesToHex(Util.hexlify(data))); + + array.add(jsonObject); + + return array; + } +} From be9a16a48b0f35aa89a618e9def3aecaa8eecb9f Mon Sep 17 00:00:00 2001 From: Kostya Shpachenko Date: Wed, 13 Dec 2017 23:56:41 +0200 Subject: [PATCH 44/49] Added tests for custom operation --- .../cy/agorise/graphenej/TransactionTest.java | 24 ++++++++++++ .../operations/CustomOperationTest.java | 39 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 graphenej/src/test/java/cy/agorise/graphenej/operations/CustomOperationTest.java diff --git a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java index 6b9b1ad..d4dd064 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/TransactionTest.java @@ -14,6 +14,7 @@ import java.io.IOException; import java.math.BigInteger; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import javax.net.ssl.SSLContext; @@ -24,6 +25,7 @@ import cy.agorise.graphenej.interfaces.WitnessResponseListener; import cy.agorise.graphenej.models.BaseResponse; import cy.agorise.graphenej.models.WitnessResponse; import cy.agorise.graphenej.objects.Memo; +import cy.agorise.graphenej.operations.CustomOperation; import cy.agorise.graphenej.operations.LimitOrderCancelOperation; import cy.agorise.graphenej.operations.LimitOrderCreateOperation; import cy.agorise.graphenej.operations.TransferOperation; @@ -53,6 +55,13 @@ public class TransactionTest { private AssetAmount minToReceive = new AssetAmount(UnsignedLong.valueOf(520), BIT_USD); private long expiration; + // Custom operation transaction + private final AssetAmount fee = new AssetAmount(UnsignedLong.valueOf(100000), CORE_ASSET); + private final UserAccount payer = bilthon_7; + private final Integer operationId = 61166; + private final List requiredAuths = Collections.singletonList(payer); + private final String data = "some data"; + private final long FEE_AMOUNT = 21851; // Lock object @@ -322,4 +331,19 @@ public class TransactionTest { } }, lockObject); } + + @Test + public void testCustomOperationTransaction(){ + ECKey sourcePrivateKey = new BrainKey(BILTHON_7_BRAIN_KEY, 0).getPrivateKey(); + + // Creating custom operation + CustomOperation customOperation = new CustomOperation(fee, payer, operationId, requiredAuths, data); + + // Adding operation to the operation list + ArrayList operationList = new ArrayList<>(); + operationList.add(customOperation); + + // Broadcasting transaction + broadcastTransaction(sourcePrivateKey, operationList, listener, null); + } } \ No newline at end of file diff --git a/graphenej/src/test/java/cy/agorise/graphenej/operations/CustomOperationTest.java b/graphenej/src/test/java/cy/agorise/graphenej/operations/CustomOperationTest.java new file mode 100644 index 0000000..6196378 --- /dev/null +++ b/graphenej/src/test/java/cy/agorise/graphenej/operations/CustomOperationTest.java @@ -0,0 +1,39 @@ +package cy.agorise.graphenej.operations; + +import com.google.common.primitives.UnsignedLong; +import cy.agorise.graphenej.Asset; +import cy.agorise.graphenej.AssetAmount; +import cy.agorise.graphenej.UserAccount; +import cy.agorise.graphenej.Util; +import org.junit.Test; + +import java.util.Collections; +import java.util.List; + +import static org.junit.Assert.assertArrayEquals; + +public class CustomOperationTest { + private final Asset CORE_ASSET = new Asset("1.3.0"); + private final AssetAmount fee = new AssetAmount(UnsignedLong.valueOf(100000L), CORE_ASSET); + private final UserAccount payer = new UserAccount("1.2.20"); + private final Integer operationId = 61166; + private final List requiredAuths = Collections.singletonList(payer); + private final String shortData = "some data"; + private final String longData = "very long data, very long data, very long data, very long data, very long data, very long data, very long data, very long data, very long data, very long data, very long data, very long data, very long data, very long data..."; + + private static final byte[] EXPECTED_SERIALIZED_BYTES_1 = Util.hexToBytes("a08601000000000000140114eeee09736f6d652064617461"); + private static final byte[] EXPECTED_SERIALIZED_BYTES_2 = Util.hexToBytes("a08601000000000000140114eeeee50176657279206c6f6e6720646174612c2076657279206c6f6e6720646174612c2076657279206c6f6e6720646174612c2076657279206c6f6e6720646174612c2076657279206c6f6e6720646174612c2076657279206c6f6e6720646174612c202076657279206c6f6e6720646174612c2076657279206c6f6e6720646174612c202076657279206c6f6e6720646174612c2076657279206c6f6e6720646174612c202076657279206c6f6e6720646174612c2076657279206c6f6e6720646174612c202076657279206c6f6e6720646174612c2076657279206c6f6e6720646174612e2e2e"); + + @Test + public void testToBytes() throws Exception { + CustomOperation customOperation1 = new CustomOperation(fee, payer, operationId, requiredAuths, shortData); + byte[] serialized1 = customOperation1.toBytes(); + assertArrayEquals(EXPECTED_SERIALIZED_BYTES_1, serialized1); + + // test with some long data string to check if data length is serialized correctly + CustomOperation customOperation2 = new CustomOperation(fee, payer, operationId, requiredAuths, longData); + byte[] serialized2 = customOperation2.toBytes(); + assertArrayEquals(EXPECTED_SERIALIZED_BYTES_2, serialized2); + } +} + From d0629eab853f5d3cb4f736b3c0a649e994ff91e9 Mon Sep 17 00:00:00 2001 From: Kostya Shpachenko Date: Mon, 18 Dec 2017 15:39:37 +0200 Subject: [PATCH 45/49] Implemented deserialization of custom operation --- .../cy/agorise/graphenej/Transaction.java | 3 +- .../cy/agorise/graphenej/api/GetBlock.java | 4 ++ .../api/SubscriptionMessagesHub.java | 2 + .../graphenej/operations/CustomOperation.java | 71 +++++++++++++++++-- 4 files changed, 74 insertions(+), 6 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/Transaction.java b/graphenej/src/main/java/cy/agorise/graphenej/Transaction.java index 68fd11c..72350f4 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/Transaction.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Transaction.java @@ -11,6 +11,7 @@ import com.google.gson.JsonParseException; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; +import cy.agorise.graphenej.operations.CustomOperation; import org.bitcoinj.core.DumpedPrivateKey; import org.bitcoinj.core.ECKey; import org.bitcoinj.core.Sha256Hash; @@ -343,7 +344,7 @@ public class Transaction implements ByteSerializable, JsonSerializable { } else if (operationId == OperationType.WORKER_CREATE_OPERATION.ordinal()) { //TODO: Add operation deserialization support } else if (operationId == OperationType.CUSTOM_OPERATION.ordinal()) { - //TODO: Add operation deserialization support + operation = context.deserialize(jsonOperation, CustomOperation.class); } else if (operationId == OperationType.ASSERT_OPERATION.ordinal()) { //TODO: Add operation deserialization support } else if (operationId == OperationType.BALANCE_CLAIM_OPERATION.ordinal()) { diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/GetBlock.java b/graphenej/src/main/java/cy/agorise/graphenej/api/GetBlock.java index 2cef872..7d3e882 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/GetBlock.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/GetBlock.java @@ -13,6 +13,8 @@ import cy.agorise.graphenej.models.ApiCall; import cy.agorise.graphenej.models.BaseResponse; import cy.agorise.graphenej.models.Block; import cy.agorise.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.operations.CustomOperation; +import cy.agorise.graphenej.operations.LimitOrderCreateOperation; import cy.agorise.graphenej.operations.TransferOperation; import java.io.Serializable; @@ -88,6 +90,8 @@ public class GetBlock extends BaseGrapheneHandler { gson = new GsonBuilder() .registerTypeAdapter(Transaction.class, new Transaction.TransactionDeserializer()) .registerTypeAdapter(TransferOperation.class, new TransferOperation.TransferDeserializer()) + .registerTypeAdapter(LimitOrderCreateOperation.class, new LimitOrderCreateOperation.LimitOrderCreateDeserializer()) + .registerTypeAdapter(CustomOperation.class, new CustomOperation.CustomOperationDeserializer()) .registerTypeAdapter(AssetAmount.class, new AssetAmount.AssetAmountDeserializer()) .create(); WitnessResponse blockResponse = gson.fromJson(response, BlockResponse); diff --git a/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java b/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java index bbb3cfb..1509be3 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/api/SubscriptionMessagesHub.java @@ -26,6 +26,7 @@ import cy.agorise.graphenej.models.DynamicGlobalProperties; import cy.agorise.graphenej.models.SubscriptionResponse; import cy.agorise.graphenej.models.WitnessResponse; import cy.agorise.graphenej.objects.Memo; +import cy.agorise.graphenej.operations.CustomOperation; import cy.agorise.graphenej.operations.LimitOrderCreateOperation; import cy.agorise.graphenej.operations.TransferOperation; @@ -89,6 +90,7 @@ public class SubscriptionMessagesHub extends BaseGrapheneHandler implements Subs builder.registerTypeAdapter(Transaction.class, new Transaction.TransactionDeserializer()); builder.registerTypeAdapter(TransferOperation.class, new TransferOperation.TransferDeserializer()); builder.registerTypeAdapter(LimitOrderCreateOperation.class, new LimitOrderCreateOperation.LimitOrderCreateDeserializer()); + builder.registerTypeAdapter(CustomOperation.class, new CustomOperation.CustomOperationDeserializer()); builder.registerTypeAdapter(AssetAmount.class, new AssetAmount.AssetAmountDeserializer()); builder.registerTypeAdapter(UserAccount.class, new UserAccount.UserAccountSimpleDeserializer()); builder.registerTypeAdapter(DynamicGlobalProperties.class, new DynamicGlobalProperties.DynamicGlobalPropertiesDeserializer()); diff --git a/graphenej/src/main/java/cy/agorise/graphenej/operations/CustomOperation.java b/graphenej/src/main/java/cy/agorise/graphenej/operations/CustomOperation.java index de4d091..4678be0 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/operations/CustomOperation.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/operations/CustomOperation.java @@ -1,18 +1,17 @@ package cy.agorise.graphenej.operations; import com.google.common.primitives.Bytes; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; +import com.google.gson.*; import cy.agorise.graphenej.*; +import java.lang.reflect.Type; import java.util.LinkedList; import java.util.List; public class CustomOperation extends BaseOperation { private static final String KEY_FEE = "fee"; private static final String KEY_PAYER = "payer"; - private static final String KEY_REQUIRED_AUTH = "required_auths"; + private static final String KEY_REQUIRED_AUTHS = "required_auths"; private static final String KEY_ID = "id"; private static final String KEY_DATA = "data"; @@ -113,7 +112,7 @@ public class CustomOperation extends BaseOperation { requiredAuthArray.add(userAccount.getObjectId()); } } - jsonObject.add(KEY_REQUIRED_AUTH, requiredAuthArray); + jsonObject.add(KEY_REQUIRED_AUTHS, requiredAuthArray); jsonObject.addProperty(KEY_ID, operationId); jsonObject.addProperty(KEY_DATA, Util.bytesToHex(Util.hexlify(data))); @@ -121,4 +120,66 @@ public class CustomOperation extends BaseOperation { return array; } + + /** + * Deserializer used to convert the JSON-formatted representation of a custom_operation + * into its java object version. + * + * The following is an example of the serialized form of this operation: + * + * [ + * 35, + * { + * "fee": { + * "amount": 100000, + * "asset_id": "1.3.0" + * }, + * "payer": "1.2.20", + * "required_auths": [ + * "1.2.20" + * ], + * "id": 61166, + * "data": "736f6d652064617461" + * } + * ] + */ + public static class CustomOperationDeserializer implements JsonDeserializer { + + @Override + public CustomOperation deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + if (json.isJsonArray()){ + // This block is used just to check if we are in the first step of the deserialization + // when we are dealing with an array. + JsonArray serializedCustomOperation = json.getAsJsonArray(); + if (serializedCustomOperation.get(0).getAsInt() != OperationType.CUSTOM_OPERATION.ordinal()){ + // If the operation type does not correspond to a custom operation, we return null + return null; + } else { + // Calling itself recursively, this is only done once, so there will be no problems. + return context.deserialize(serializedCustomOperation.get(1), CustomOperation.class); + } + }else{ + // This block is called in the second recursion and takes care of deserializing the + // limit order data itself. + JsonObject jsonObject = json.getAsJsonObject(); + + AssetAmount fee = context.deserialize(jsonObject.get(KEY_FEE), AssetAmount.class); + String payerId = jsonObject.get(KEY_PAYER) .getAsString(); + UserAccount payer = new UserAccount(payerId); + List requiredAuths = new LinkedList<>(); + JsonElement requiredAuthsElement = jsonObject.get(KEY_REQUIRED_AUTHS); + if ((requiredAuthsElement != null) && (requiredAuthsElement.isJsonArray())) { + JsonArray requiredAuthsArray = requiredAuthsElement.getAsJsonArray(); + for (JsonElement jsonElement : requiredAuthsArray) { + String userAccountId = jsonElement.getAsString(); + requiredAuths.add(new UserAccount(userAccountId)); + } + } + int operationId = jsonObject.get(KEY_ID).getAsInt(); + String data = new String(Util.hexToBytes(jsonObject.get(KEY_DATA).getAsString())); + + return new CustomOperation(fee, payer, operationId, requiredAuths, data); + } + } + } } From a2886ea0a5811c0f18327c77ae81545a01c44719 Mon Sep 17 00:00:00 2001 From: Kostya Shpachenko Date: Mon, 18 Dec 2017 15:40:38 +0200 Subject: [PATCH 46/49] Fixed deserialization of "seller" field of limit_order_create_operation --- .../agorise/graphenej/operations/LimitOrderCreateOperation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/operations/LimitOrderCreateOperation.java b/graphenej/src/main/java/cy/agorise/graphenej/operations/LimitOrderCreateOperation.java index 64b2f9d..773de4e 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/operations/LimitOrderCreateOperation.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/operations/LimitOrderCreateOperation.java @@ -208,7 +208,7 @@ public class LimitOrderCreateOperation extends BaseOperation { JsonObject jsonObject = json.getAsJsonObject(); AssetAmount fee = context.deserialize(jsonObject.get(KEY_FEE), AssetAmount.class); - UserAccount seller = context.deserialize(jsonObject.get(KEY_SELLER), UserAccount.class); + UserAccount seller = new UserAccount(jsonObject.get(KEY_SELLER).getAsString()); AssetAmount amountToSell = context.deserialize(jsonObject.get(KEY_AMOUNT_TO_SELL), AssetAmount.class); AssetAmount minToReceive = context.deserialize(jsonObject.get(KEY_MIN_TO_RECEIVE), AssetAmount.class); String expiration = jsonObject.get(KEY_EXPIRATION).getAsString(); From b60fffdc3b7e59db0755379a575dc86af1802c3f Mon Sep 17 00:00:00 2001 From: Kostya Shpachenko Date: Mon, 18 Dec 2017 15:41:21 +0200 Subject: [PATCH 47/49] Added test of custom operation deserialization --- .../agorise/graphenej/api/GetBlockTest.java | 133 ++++++++++++++---- 1 file changed, 102 insertions(+), 31 deletions(-) diff --git a/graphenej/src/test/java/cy/agorise/graphenej/api/GetBlockTest.java b/graphenej/src/test/java/cy/agorise/graphenej/api/GetBlockTest.java index 1689e04..f6637a5 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/api/GetBlockTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/api/GetBlockTest.java @@ -9,6 +9,7 @@ import cy.agorise.graphenej.interfaces.WitnessResponseListener; import cy.agorise.graphenej.models.BaseResponse; import cy.agorise.graphenej.models.Block; import cy.agorise.graphenej.models.WitnessResponse; +import cy.agorise.graphenej.operations.CustomOperation; import cy.agorise.graphenej.operations.TransferOperation; import org.junit.Assert; import org.junit.Test; @@ -21,29 +22,42 @@ import java.util.concurrent.TimeoutException; import static org.hamcrest.CoreMatchers.instanceOf; public class GetBlockTest extends BaseApiTest { - private final static long BLOCK_NUMBER = 15776988L; + // data for the test with transfer operation + private final static long TRANSFER_BLOCK_NUMBER = 15776988L; - private final static String EXPECTED_PREVIOUS = "00f0bcdbe3d9dc66d8597e7b013a16d8dea5f778"; - private final static String EXPECTED_TIMESTAMP = "2017-04-18T04:14:51"; - private final static String EXPECTED_WITNESS = "1.6.17"; - private final static String EXPECTED_TRANSACTION_MERKLE_ROOT = "fb87a3f8af907a2450c327d181b2833b8270a504"; - private final static int EXPECTED_EXTENSIONS_SIZE = 0; - private final static String EXPECTED_WITNESS_SIGNATURE = "20160921c8ba0d312dee14bdc780c3d05b27e406e2d014b8a2415e9843bf7075cb7abbc45f5173ffefac69cecf4dd2afa5dce6076bdf24cc577ff49427babe75e1"; - private final static int EXPECTED_TRANSACTIONS_SIZE = 1; - private final static int EXPECTED_OPERATIONS_SIZE = 1; + private final static String TRANSFER_EXPECTED_PREVIOUS = "00f0bcdbe3d9dc66d8597e7b013a16d8dea5f778"; + private final static String TRANSFER_EXPECTED_TIMESTAMP = "2017-04-18T04:14:51"; + private final static String TRANSFER_EXPECTED_WITNESS = "1.6.17"; + private final static String TRANSFER_EXPECTED_TRANSACTION_MERKLE_ROOT = "fb87a3f8af907a2450c327d181b2833b8270a504"; + private final static int TRANSFER_EXPECTED_EXTENSIONS_SIZE = 0; + private final static String TRANSFER_EXPECTED_WITNESS_SIGNATURE = "20160921c8ba0d312dee14bdc780c3d05b27e406e2d014b8a2415e9843bf7075cb7abbc45f5173ffefac69cecf4dd2afa5dce6076bdf24cc577ff49427babe75e1"; + private final static int TRANSFER_EXPECTED_TRANSACTIONS_SIZE = 1; + private final static int TRANSFER_EXPECTED_OPERATIONS_SIZE = 1; - private final static UnsignedLong EXPECTED_FEE_AMOUNT = UnsignedLong.valueOf(2048); - private final static String EXPECTED_FEE_ASSET_ID = "1.3.113"; - private final static String EXPECTED_FROM = "1.2.151069"; - private final static String EXPECTED_TO = "1.2.116354"; - private final static UnsignedLong EXPECTED_AMOUNT = UnsignedLong.valueOf(13700); - private final static String EXPECTED_ASSET_ID = "1.3.113"; + private final static UnsignedLong TRANSFER_EXPECTED_FEE_AMOUNT = UnsignedLong.valueOf(2048); + private final static String TRANSFER_EXPECTED_FEE_ASSET_ID = "1.3.113"; + private final static String TRANSFER_EXPECTED_FROM = "1.2.151069"; + private final static String TRANSFER_EXPECTED_TO = "1.2.116354"; + private final static UnsignedLong TRANSFER_EXPECTED_AMOUNT = UnsignedLong.valueOf(13700); + private final static String TRANSFER_EXPECTED_ASSET_ID = "1.3.113"; + + // data for the test with custom operation + private final static long CUSTOM_BLOCK_NUMBER = 22754473L; + private final static int CUSTOM_TRANSACTION_INDEX = 8; + + private final static UnsignedLong CUSTOM_EXPECTED_FEE_AMOUNT = UnsignedLong.valueOf(13798); + private final static String CUSTOM_EXPECTED_FEE_ASSET_ID = "1.3.0"; + private final static String CUSTOM_EXPECTED_PAYER = "1.2.140994"; + private final static int CUSTOM_EXPECTED_REQUIRED_AUTHS_SIZE = 1; + private final static String CUSTOM_EXPECTED_REQUIRED_AUTH = "1.2.140994"; + private final static int CUSTOM_EXPECTED_ID = 61166; + private final static String CUSTOM_EXPECTED_DATA = "some data"; @Test - public void testGetBlock() { + public void testGetBlockWithTransferOperation() { try { final Exchanger responseExchanger = new Exchanger<>(); - mWebSocket.addListener(new GetBlock(BLOCK_NUMBER, new WitnessResponseListener() { + mWebSocket.addListener(new GetBlock(TRANSFER_BLOCK_NUMBER, new WitnessResponseListener() { @Override public void onSuccess(WitnessResponse response) { System.out.println("onSuccess"); @@ -71,31 +85,88 @@ public class GetBlockTest extends BaseApiTest { Block block = (Block) responseResult; Assert.assertNotNull(block); - Assert.assertEquals(EXPECTED_PREVIOUS, block.getPrevious()); - Assert.assertEquals(EXPECTED_TIMESTAMP, block.getTimestamp()); - Assert.assertEquals(EXPECTED_WITNESS, block.getWitness()); - Assert.assertEquals(EXPECTED_TRANSACTION_MERKLE_ROOT, block.getTransaction_merkle_root()); - Assert.assertEquals(EXPECTED_EXTENSIONS_SIZE, block.getExtensions().length); - Assert.assertEquals(EXPECTED_WITNESS_SIGNATURE, block.getWitness_signature()); + Assert.assertEquals(TRANSFER_EXPECTED_PREVIOUS, block.getPrevious()); + Assert.assertEquals(TRANSFER_EXPECTED_TIMESTAMP, block.getTimestamp()); + Assert.assertEquals(TRANSFER_EXPECTED_WITNESS, block.getWitness()); + Assert.assertEquals(TRANSFER_EXPECTED_TRANSACTION_MERKLE_ROOT, block.getTransaction_merkle_root()); + Assert.assertEquals(TRANSFER_EXPECTED_EXTENSIONS_SIZE, block.getExtensions().length); + Assert.assertEquals(TRANSFER_EXPECTED_WITNESS_SIGNATURE, block.getWitness_signature()); List transactions = block.getTransactions(); - Assert.assertEquals(EXPECTED_TRANSACTIONS_SIZE, transactions.size()); + Assert.assertEquals(TRANSFER_EXPECTED_TRANSACTIONS_SIZE, transactions.size()); List operations = transactions.get(0).getOperations(); - Assert.assertEquals(EXPECTED_OPERATIONS_SIZE, operations.size()); + Assert.assertEquals(TRANSFER_EXPECTED_OPERATIONS_SIZE, operations.size()); BaseOperation operation = operations.get(0); Assert.assertThat(operation, instanceOf(TransferOperation.class)); TransferOperation transferOperation = (TransferOperation) operation; AssetAmount fee = transferOperation.getFee(); - Assert.assertEquals(EXPECTED_FEE_AMOUNT, fee.getAmount()); - Assert.assertEquals(EXPECTED_FEE_ASSET_ID, fee.getAsset().getObjectId()); - Assert.assertEquals(EXPECTED_FROM, transferOperation.getFrom().getObjectId()); - Assert.assertEquals(EXPECTED_TO, transferOperation.getTo().getObjectId()); + Assert.assertEquals(TRANSFER_EXPECTED_FEE_AMOUNT, fee.getAmount()); + Assert.assertEquals(TRANSFER_EXPECTED_FEE_ASSET_ID, fee.getAsset().getObjectId()); + Assert.assertEquals(TRANSFER_EXPECTED_FROM, transferOperation.getFrom().getObjectId()); + Assert.assertEquals(TRANSFER_EXPECTED_TO, transferOperation.getTo().getObjectId()); AssetAmount assetAmount = transferOperation.getAssetAmount(); - Assert.assertEquals(EXPECTED_AMOUNT, assetAmount.getAmount()); - Assert.assertEquals(EXPECTED_ASSET_ID, assetAmount.getAsset().getObjectId()); + Assert.assertEquals(TRANSFER_EXPECTED_AMOUNT, assetAmount.getAmount()); + Assert.assertEquals(TRANSFER_EXPECTED_ASSET_ID, assetAmount.getAsset().getObjectId()); + } catch (WebSocketException e) { + System.out.println("WebSocketException. Msg: " + e.getMessage()); + Assert.fail("Fail because of WebSocketException"); + } catch (InterruptedException e) { + System.out.println("InterruptedException. Msg: " + e.getMessage()); + Assert.fail("Fail because of InterruptedException"); + } catch (TimeoutException e) { + System.out.println("TimeoutException. Msg: " + e.getMessage()); + Assert.fail("Fail because of TimeoutException"); + } + } + + @Test + public void testGetBlockWithCustomOperation() { + try { + final Exchanger responseExchanger = new Exchanger<>(); + mWebSocket.addListener(new GetBlock(CUSTOM_BLOCK_NUMBER, new WitnessResponseListener() { + @Override + public void onSuccess(WitnessResponse response) { + System.out.println("onSuccess"); + try { + responseExchanger.exchange(response.result); + } catch (InterruptedException e) { + System.out.println("InterruptedException in success handler. Msg: " + e.getMessage()); + } + } + + @Override + public void onError(BaseResponse.Error error) { + System.out.println("onError"); + try { + responseExchanger.exchange(null); + } catch (InterruptedException e) { + System.out.println("InterruptedException in error handler. Msg: " + e.getMessage()); + } + } + })); + + mWebSocket.connect(); + + Object responseResult = responseExchanger.exchange(null, 5, TimeUnit.SECONDS); + + Block block = (Block) responseResult; + List transactions = block.getTransactions(); + List operations = transactions.get(CUSTOM_TRANSACTION_INDEX).getOperations(); + BaseOperation operation = operations.get(0); + Assert.assertThat(operation, instanceOf(CustomOperation.class)); + + CustomOperation customOperation = (CustomOperation) operation; + AssetAmount fee = customOperation.getFee(); + Assert.assertEquals(CUSTOM_EXPECTED_FEE_AMOUNT, fee.getAmount()); + Assert.assertEquals(CUSTOM_EXPECTED_FEE_ASSET_ID, fee.getAsset().getObjectId()); + Assert.assertEquals(CUSTOM_EXPECTED_PAYER, customOperation.getPayer().getObjectId()); + Assert.assertEquals(CUSTOM_EXPECTED_REQUIRED_AUTHS_SIZE, customOperation.getRequiredAuths().size()); + Assert.assertEquals(CUSTOM_EXPECTED_REQUIRED_AUTH, customOperation.getRequiredAuths().get(0).getObjectId()); + Assert.assertEquals(CUSTOM_EXPECTED_ID, customOperation.getOperationId()); + Assert.assertEquals(CUSTOM_EXPECTED_DATA, customOperation.getData()); } catch (WebSocketException e) { System.out.println("WebSocketException. Msg: " + e.getMessage()); Assert.fail("Fail because of WebSocketException"); From 3c6d96f48a7b04661e6fe1c3cb6dba8107cea3a6 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Tue, 23 Jan 2018 12:03:20 -0500 Subject: [PATCH 48/49] Using the Bitshares mainnet chain id as default, but allowing the user to set it up manually either via constructor or setter method --- .../cy/agorise/graphenej/Transaction.java | 54 ++++++++++++++----- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/Transaction.java b/graphenej/src/main/java/cy/agorise/graphenej/Transaction.java index 72350f4..acf5412 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/Transaction.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/Transaction.java @@ -11,7 +11,6 @@ import com.google.gson.JsonParseException; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; -import cy.agorise.graphenej.operations.CustomOperation; import org.bitcoinj.core.DumpedPrivateKey; import org.bitcoinj.core.ECKey; import org.bitcoinj.core.Sha256Hash; @@ -27,6 +26,7 @@ import java.util.TimeZone; import cy.agorise.graphenej.interfaces.ByteSerializable; import cy.agorise.graphenej.interfaces.JsonSerializable; +import cy.agorise.graphenej.operations.CustomOperation; import cy.agorise.graphenej.operations.LimitOrderCreateOperation; import cy.agorise.graphenej.operations.TransferOperation; @@ -46,29 +46,43 @@ public class Transaction implements ByteSerializable, JsonSerializable { public static final String KEY_REF_BLOCK_NUM = "ref_block_num"; public static final String KEY_REF_BLOCK_PREFIX = "ref_block_prefix"; + // Using the bitshares mainnet chain id by default + private byte[] chainId = Util.hexToBytes(Chains.BITSHARES.CHAIN_ID); private ECKey privateKey; private BlockData blockData; private List operations; private Extensions extensions; /** - * Transaction constructor. - * @param privateKey : Instance of a ECKey containing the private key that will be used to sign this transaction. - * @param blockData : Block data containing important information used to sign a transaction. - * @param operationList : List of operations to include in the transaction. + * Transaction constructor + * @param chainId The chain id + * @param privateKey Private key used to sign this transaction + * @param blockData Block data + * @param operations List of operations contained in this transaction */ - public Transaction(ECKey privateKey, BlockData blockData, List operationList){ + public Transaction(byte[] chainId, ECKey privateKey, BlockData blockData, List operations){ + this.chainId = chainId; this.privateKey = privateKey; this.blockData = blockData; - this.operations = operationList; + this.operations = operations; this.extensions = new Extensions(); } /** * Transaction constructor. - * @param wif: The user's private key in the base58 format. - * @param block_data: Block data containing important information used to sign a transaction. - * @param operation_list: List of operations to include in the transaction. + * @param privateKey Instance of a ECKey containing the private key that will be used to sign this transaction. + * @param blockData Block data containing important information used to sign a transaction. + * @param operationList List of operations to include in the transaction. + */ + public Transaction(ECKey privateKey, BlockData blockData, List operationList){ + this(Util.hexToBytes(Chains.BITSHARES.CHAIN_ID), privateKey, blockData, operationList); + } + + /** + * Transaction constructor. + * @param wif The user's private key in the base58 format. + * @param block_data Block data containing important information used to sign a transaction. + * @param operation_list List of operations to include in the transaction. */ public Transaction(String wif, BlockData block_data, List operation_list){ this(DumpedPrivateKey.fromBase58(null, wif).getKey(), block_data, operation_list); @@ -77,8 +91,8 @@ public class Transaction implements ByteSerializable, JsonSerializable { /** * Constructor used to build a Transaction object without a private key. This kind of object * is used to represent a transaction data that we don't intend to serialize and sign. - * @param blockData: Block data instance, containing information about the location of this transaction in the blockchain. - * @param operationList: The list of operations included in this transaction. + * @param blockData Block data instance, containing information about the location of this transaction in the blockchain. + * @param operationList The list of operations included in this transaction. */ public Transaction(BlockData blockData, List operationList){ this.blockData = blockData; @@ -87,7 +101,7 @@ public class Transaction implements ByteSerializable, JsonSerializable { /** * Updates the block data - * @param blockData: New block data + * @param blockData New block data */ public void setBlockData(BlockData blockData){ this.blockData = blockData; @@ -162,6 +176,18 @@ public class Transaction implements ByteSerializable, JsonSerializable { return sigData; } + public void setChainId(String chainId){ + this.chainId = Util.hexToBytes(chainId); + } + + public void setChainId(byte[] chainId){ + this.chainId = chainId; + } + + public byte[] getChainId(){ + return this.chainId; + } + /** * Method that creates a serialized byte array with compact information about this transaction * that is needed for the creation of a signature. @@ -170,7 +196,7 @@ public class Transaction implements ByteSerializable, JsonSerializable { public byte[] toBytes(){ // Creating a List of Bytes and adding the first bytes from the chain apiId List byteArray = new ArrayList(); - byteArray.addAll(Bytes.asList(Util.hexToBytes(Chains.BITSHARES.CHAIN_ID))); + byteArray.addAll(Bytes.asList(chainId)); // Adding the block data byteArray.addAll(Bytes.asList(this.blockData.toBytes())); From 9af682f0cbe44751c3a4bbd3e3d6c25cdfd4184e Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Thu, 25 Jan 2018 17:58:20 -0500 Subject: [PATCH 49/49] Version bump --- gradle.properties | 4 ++-- graphenej/build.gradle | 7 +++---- graphenej/src/main/AndroidManifest.xml | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index 93ed04b..5bfcab3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,8 +17,8 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME=0.4.6-alpha6 -VERSION_CODE=8 +VERSION_NAME=0.4.6 +VERSION_CODE=9 GROUP=com.github.bilthon POM_DESCRIPTION=A Java library for mobile app Developers; Graphene/Bitshares blockchain. diff --git a/graphenej/build.gradle b/graphenej/build.gradle index 1ff0bb3..0d30268 100644 --- a/graphenej/build.gradle +++ b/graphenej/build.gradle @@ -1,5 +1,5 @@ group 'cy.agorise' -version '0.4.6-alpha5' +version '0.4.6' apply plugin: 'com.android.library' apply from: 'maven-push.gradle' @@ -21,9 +21,8 @@ android { defaultConfig { minSdkVersion 9 targetSdkVersion 24 - versionCode 8 - versionName "0.4.6-alpha6" - + versionCode 9 + versionName "0.4.6" vectorDrawables.useSupportLibrary = true } buildTypes { diff --git a/graphenej/src/main/AndroidManifest.xml b/graphenej/src/main/AndroidManifest.xml index 78bdba2..4df96c3 100644 --- a/graphenej/src/main/AndroidManifest.xml +++ b/graphenej/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="9" + android:versionName="0.4.6" > \ No newline at end of file