From c33127b9bfa1fd082c8c9bc7ad1cf2c5f3f023ea Mon Sep 17 00:00:00 2001 From: sunerok Date: Thu, 25 Jul 2024 13:59:05 -0400 Subject: [PATCH] revert n prepare for koala --- README.md | 13 +- build.gradle | 2 +- core/build.gradle | 8 +- .../{vergepay => verge}/core/CoreUtils.java | 0 .../core/Preconditions.java | 0 .../core/coins/BitcoinMain.java | 0 .../core/coins/BitcoinTest.java | 0 .../core/coins/BurstMain.java | 0 .../core/coins/CoinID.java | 0 .../core/coins/CoinType.java | 0 .../core/coins/FeePolicy.java | 0 .../core/coins/FiatType.java | 0 .../core/coins/FiatValue.java | 0 .../core/coins/LitecoinMain.java | 0 .../core/coins/LitecoinTest.java | 0 .../core/coins/NxtMain.java | 0 .../core/coins/SoftDustPolicy.java | 0 .../{vergepay => verge}/core/coins/Value.java | 0 .../core/coins/ValueType.java | 0 .../core/coins/VergeMain.java | 0 .../core/coins/families/BitFamily.java | 0 .../core/coins/families/ClamsFamily.java | 23 ++ .../core/coins/families/Families.java | 0 .../verge/core/coins/families/NuFamily.java | 12 + .../core/coins/families/NxtFamily.java | 0 .../core/coins/families/PeerFamily.java | 0 .../verge/core/coins/families/ReddFamily.java | 12 + .../core/coins/families/VpncoinFamily.java | 23 ++ .../core/coins/nxt/Account.java | 0 .../core/coins/nxt/Appendix.java | 0 .../core/coins/nxt/Attachment.java | 0 .../core/coins/nxt/Constants.java | 0 .../core/coins/nxt/Convert.java | 0 .../core/coins/nxt/Crypto.java | 0 .../core/coins/nxt/Curve25519.java | 0 .../core/coins/nxt/EncryptedData.java | 0 .../core/coins/nxt/NxtException.java | 0 .../core/coins/nxt/ReedSolomon.java | 0 .../core/coins/nxt/Transaction.java | 0 .../core/coins/nxt/TransactionImpl.java | 0 .../core/coins/nxt/TransactionType.java | 0 .../exceptions/AddressMalformedException.java | 0 .../Bip44KeyLookAheadExceededException.java | 0 .../exceptions/InvalidMessageSignature.java | 0 .../exceptions/KeyIsEncryptedException.java | 0 .../MissingPrivateKeyException.java | 0 .../exceptions/NoSuchPocketException.java | 0 .../TransactionBroadcastException.java | 0 .../UnsupportedCoinTypeException.java | 0 .../core/exchange/shapeshift/Connection.java | 0 .../core/exchange/shapeshift/ShapeShift.java | 0 .../shapeshift/data/ShapeShiftAmountTx.java | 0 .../shapeshift/data/ShapeShiftBase.java | 0 .../shapeshift/data/ShapeShiftCoin.java | 0 .../shapeshift/data/ShapeShiftCoins.java | 0 .../shapeshift/data/ShapeShiftEmail.java | 0 .../shapeshift/data/ShapeShiftException.java | 0 .../data/ShapeShiftExchangeRate.java | 0 .../shapeshift/data/ShapeShiftLimit.java | 0 .../shapeshift/data/ShapeShiftMarketInfo.java | 0 .../shapeshift/data/ShapeShiftNormalTx.java | 0 .../shapeshift/data/ShapeShiftPairBase.java | 0 .../shapeshift/data/ShapeShiftRate.java | 0 .../shapeshift/data/ShapeShiftTime.java | 0 .../shapeshift/data/ShapeShiftTxStatus.java | 0 .../core/messages/MessageFactory.java | 0 .../core/messages/TxMessage.java | 0 .../core/network/AddressStatus.java | 0 .../core/network/BlockHeader.java | 0 .../core/network/CoinAddress.java | 0 .../core/network/ConnectivityHelper.java | 0 .../core/network/NxtServerClient.java | 0 .../core/network/ServerClient.java | 0 .../core/network/ServerClients.java | 6 + .../interfaces/BlockchainConnection.java | 0 .../interfaces/ConnectionEventListener.java | 0 .../interfaces/TransactionEventListener.java | 0 .../core/protos/Protos.java | 0 .../{vergepay => verge}/core/uri/CoinURI.java | 27 +- .../core/uri/CoinURIParseException.java | 0 .../uri/OptionalFieldValidationException.java | 0 .../uri/RequiredFieldValidationException.java | 0 .../core/util/BitAddressUtils.java | 0 .../core/util/Currencies.java | 0 .../core/util/ExchangeRate.java | 0 .../core/util/ExchangeRateBase.java | 0 .../core/util/GenericUtils.java | 0 .../core/util/HardwareSoftwareCompliance.java | 0 .../core/util/KeyUtils.java | 0 .../core/util/MonetaryFormat.java | 0 .../core/util/TypeUtils.java | 0 .../core/wallet/AbstractAddress.java | 0 .../core/wallet/AbstractTransaction.java | 0 .../core/wallet/AbstractWallet.java | 0 .../core/wallet/BitWalletBase.java | 0 .../core/wallet/BitWalletSingleKey.java | 0 .../core/wallet/SendRequest.java | 0 .../core/wallet/SerializedKey.java | 0 .../core/wallet/SignedMessage.java | 0 .../core/wallet/SimpleHDKeyChain.java | 0 .../core/wallet/SimpleKeyChain.java | 0 .../core/wallet/TransactionCreator.java | 0 .../core/wallet/TransactionWatcherWallet.java | 0 .../core/wallet/Wallet.java | 4 + .../core/wallet/WalletAccount.java | 0 .../wallet/WalletAccountEventListener.java | 0 .../core/wallet/WalletCoinSelector.java | 0 .../core/wallet/WalletConnectivityStatus.java | 0 .../core/wallet/WalletFiles.java | 0 .../core/wallet/WalletPocketHD.java | 0 .../WalletPocketProtobufSerializer.java | 0 .../core/wallet/WalletProtobufSerializer.java | 0 .../core/wallet/WalletTransaction.java | 0 .../wallet/families/bitcoin/BitAddress.java | 0 .../bitcoin/BitBlockchainConnection.java | 0 .../families/bitcoin/BitSendRequest.java | 0 .../families/bitcoin/BitTransaction.java | 0 .../bitcoin/BitTransactionEventListener.java | 0 .../bitcoin/BitWalletTransaction.java | 0 .../families/bitcoin/CoinSelection.java | 0 .../wallet/families/bitcoin/CoinSelector.java | 0 .../bitcoin/EmptyTransactionOutput.java | 0 .../families/bitcoin/OutPointOutput.java | 0 .../families/bitcoin/TrimmedOutPoint.java | 0 .../families/bitcoin/TrimmedOutput.java | 0 .../families/bitcoin/TrimmedTransaction.java | 0 .../wallet/families/clams/ClamsTxMessage.java | 121 ++++++ .../core/wallet/families/nxt/NxtAddress.java | 0 .../wallet/families/nxt/NxtFamilyKey.java | 0 .../wallet/families/nxt/NxtFamilyWallet.java | 0 .../NxtFamilyWalletProtobufSerializer.java | 0 .../wallet/families/nxt/NxtSendRequest.java | 0 .../wallet/families/nxt/NxtTransaction.java | 0 .../wallet/families/nxt/NxtTxMessage.java | 0 .../families/vpncoin/VpncoinTxMessage.java | 363 ++++++++++++++++++ .../stratumj/ServerAddress.java | 0 .../stratumj/StratumClient.java | 0 .../stratumj/messages/BaseMessage.java | 0 .../stratumj/messages/CallMessage.java | 0 .../stratumj/messages/MessageException.java | 0 .../stratumj/messages/ResultMessage.java | 0 .../core/coins/ValueTest.java | 23 +- .../core/coins/nxt/NxtFamilyTest.java | 0 .../exchange/shapeshift/ExchangeRateTest.java | 67 ++++ .../exchange/shapeshift/MessagesTest.java | 49 ++- .../core/exchange/shapeshift/ServerTest.java | 72 +++- .../core/uri/CoinURITest.java | 19 + .../core/util/ExchangeRateTest.java | 25 +- .../core/util/GenericUtilsTests.java | 11 + .../core/util/MonetaryFormatTest.java | 0 .../core/wallet/SimpleHDKeyChainTest.java | 0 .../core/wallet/SweepWalletTest.java | 0 .../core/wallet/WalletPocketHDTest.java | 187 +++++++-- .../core/wallet/WalletTest.java | 4 +- .../families/bitcoin/BitAddressTest.java | 0 .../families/bitcoin/TransactionTest.java | 38 ++ .../families/nxt/NxtFamilyWalletTest.java | 0 .../families/vpncoin/TransactionTest.java | 84 +++- .../stratumj/CommunicationsTest.java | 0 .../stratumj/MessagesTest.java | 0 .../exchange/shapeshift/ExchangeRateTest.java | 65 ---- .../families/bitcoin/TransactionTest.java | 22 -- gradle.properties | 1 + gradle/wrapper/gradle-wrapper.properties | 3 +- wallet/build.gradle | 34 +- .../support-v4-preferencefragment-1.0.0.aar | Bin 12223 -> 0 bytes 166 files changed, 1104 insertions(+), 214 deletions(-) rename core/src/main/java/com/{vergepay => verge}/core/CoreUtils.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/Preconditions.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/BitcoinMain.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/BitcoinTest.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/BurstMain.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/CoinID.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/CoinType.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/FeePolicy.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/FiatType.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/FiatValue.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/LitecoinMain.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/LitecoinTest.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/NxtMain.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/SoftDustPolicy.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/Value.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/ValueType.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/VergeMain.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/families/BitFamily.java (100%) create mode 100644 core/src/main/java/com/verge/core/coins/families/ClamsFamily.java rename core/src/main/java/com/{vergepay => verge}/core/coins/families/Families.java (100%) create mode 100644 core/src/main/java/com/verge/core/coins/families/NuFamily.java rename core/src/main/java/com/{vergepay => verge}/core/coins/families/NxtFamily.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/families/PeerFamily.java (100%) create mode 100644 core/src/main/java/com/verge/core/coins/families/ReddFamily.java create mode 100644 core/src/main/java/com/verge/core/coins/families/VpncoinFamily.java rename core/src/main/java/com/{vergepay => verge}/core/coins/nxt/Account.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/nxt/Appendix.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/nxt/Attachment.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/nxt/Constants.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/nxt/Convert.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/nxt/Crypto.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/nxt/Curve25519.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/nxt/EncryptedData.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/nxt/NxtException.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/nxt/ReedSolomon.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/nxt/Transaction.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/nxt/TransactionImpl.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/coins/nxt/TransactionType.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exceptions/AddressMalformedException.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exceptions/Bip44KeyLookAheadExceededException.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exceptions/InvalidMessageSignature.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exceptions/KeyIsEncryptedException.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exceptions/MissingPrivateKeyException.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exceptions/NoSuchPocketException.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exceptions/TransactionBroadcastException.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exceptions/UnsupportedCoinTypeException.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/Connection.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/ShapeShift.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/data/ShapeShiftAmountTx.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/data/ShapeShiftBase.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/data/ShapeShiftCoin.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/data/ShapeShiftCoins.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/data/ShapeShiftEmail.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/data/ShapeShiftException.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/data/ShapeShiftExchangeRate.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/data/ShapeShiftLimit.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/data/ShapeShiftMarketInfo.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/data/ShapeShiftNormalTx.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/data/ShapeShiftPairBase.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/data/ShapeShiftRate.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/data/ShapeShiftTime.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/exchange/shapeshift/data/ShapeShiftTxStatus.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/messages/MessageFactory.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/messages/TxMessage.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/network/AddressStatus.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/network/BlockHeader.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/network/CoinAddress.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/network/ConnectivityHelper.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/network/NxtServerClient.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/network/ServerClient.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/network/ServerClients.java (92%) rename core/src/main/java/com/{vergepay => verge}/core/network/interfaces/BlockchainConnection.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/network/interfaces/ConnectionEventListener.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/network/interfaces/TransactionEventListener.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/protos/Protos.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/uri/CoinURI.java (99%) rename core/src/main/java/com/{vergepay => verge}/core/uri/CoinURIParseException.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/uri/OptionalFieldValidationException.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/uri/RequiredFieldValidationException.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/util/BitAddressUtils.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/util/Currencies.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/util/ExchangeRate.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/util/ExchangeRateBase.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/util/GenericUtils.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/util/HardwareSoftwareCompliance.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/util/KeyUtils.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/util/MonetaryFormat.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/util/TypeUtils.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/AbstractAddress.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/AbstractTransaction.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/AbstractWallet.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/BitWalletBase.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/BitWalletSingleKey.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/SendRequest.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/SerializedKey.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/SignedMessage.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/SimpleHDKeyChain.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/SimpleKeyChain.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/TransactionCreator.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/TransactionWatcherWallet.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/Wallet.java (98%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/WalletAccount.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/WalletAccountEventListener.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/WalletCoinSelector.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/WalletConnectivityStatus.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/WalletFiles.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/WalletPocketHD.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/WalletPocketProtobufSerializer.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/WalletProtobufSerializer.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/WalletTransaction.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/bitcoin/BitAddress.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/bitcoin/BitBlockchainConnection.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/bitcoin/BitSendRequest.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/bitcoin/BitTransaction.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/bitcoin/BitTransactionEventListener.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/bitcoin/BitWalletTransaction.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/bitcoin/CoinSelection.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/bitcoin/CoinSelector.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/bitcoin/EmptyTransactionOutput.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/bitcoin/OutPointOutput.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/bitcoin/TrimmedOutPoint.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/bitcoin/TrimmedOutput.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/bitcoin/TrimmedTransaction.java (100%) create mode 100644 core/src/main/java/com/verge/core/wallet/families/clams/ClamsTxMessage.java rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/nxt/NxtAddress.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/nxt/NxtFamilyKey.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/nxt/NxtFamilyWallet.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/nxt/NxtFamilyWalletProtobufSerializer.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/nxt/NxtSendRequest.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/nxt/NxtTransaction.java (100%) rename core/src/main/java/com/{vergepay => verge}/core/wallet/families/nxt/NxtTxMessage.java (100%) create mode 100644 core/src/main/java/com/verge/core/wallet/families/vpncoin/VpncoinTxMessage.java rename core/src/main/java/com/{vergepay => verge}/stratumj/ServerAddress.java (100%) rename core/src/main/java/com/{vergepay => verge}/stratumj/StratumClient.java (100%) rename core/src/main/java/com/{vergepay => verge}/stratumj/messages/BaseMessage.java (100%) rename core/src/main/java/com/{vergepay => verge}/stratumj/messages/CallMessage.java (100%) rename core/src/main/java/com/{vergepay => verge}/stratumj/messages/MessageException.java (100%) rename core/src/main/java/com/{vergepay => verge}/stratumj/messages/ResultMessage.java (100%) rename core/src/test/java/com/{vergepay => coinomi}/core/coins/ValueTest.java (92%) rename core/src/test/java/com/{vergepay => coinomi}/core/coins/nxt/NxtFamilyTest.java (100%) create mode 100644 core/src/test/java/com/coinomi/core/exchange/shapeshift/ExchangeRateTest.java rename core/src/test/java/com/{vergepay => coinomi}/core/exchange/shapeshift/MessagesTest.java (93%) rename core/src/test/java/com/{vergepay => coinomi}/core/exchange/shapeshift/ServerTest.java (86%) rename core/src/test/java/com/{vergepay => coinomi}/core/uri/CoinURITest.java (95%) rename core/src/test/java/com/{vergepay => coinomi}/core/util/ExchangeRateTest.java (90%) rename core/src/test/java/com/{vergepay => coinomi}/core/util/GenericUtilsTests.java (86%) rename core/src/test/java/com/{vergepay => coinomi}/core/util/MonetaryFormatTest.java (100%) rename core/src/test/java/com/{vergepay => coinomi}/core/wallet/SimpleHDKeyChainTest.java (100%) rename core/src/test/java/com/{vergepay => coinomi}/core/wallet/SweepWalletTest.java (100%) rename core/src/test/java/com/{vergepay => coinomi}/core/wallet/WalletPocketHDTest.java (83%) rename core/src/test/java/com/{vergepay => coinomi}/core/wallet/WalletTest.java (97%) rename core/src/test/java/com/{vergepay => coinomi}/core/wallet/families/bitcoin/BitAddressTest.java (100%) create mode 100644 core/src/test/java/com/coinomi/core/wallet/families/bitcoin/TransactionTest.java rename core/src/test/java/com/{vergepay => coinomi}/core/wallet/families/nxt/NxtFamilyWalletTest.java (100%) rename core/src/test/java/com/{vergepay => coinomi}/core/wallet/families/vpncoin/TransactionTest.java (66%) rename core/src/test/java/com/{vergepay => coinomi}/stratumj/CommunicationsTest.java (100%) rename core/src/test/java/com/{vergepay => coinomi}/stratumj/MessagesTest.java (100%) delete mode 100644 core/src/test/java/com/vergepay/core/exchange/shapeshift/ExchangeRateTest.java delete mode 100644 core/src/test/java/com/vergepay/core/wallet/families/bitcoin/TransactionTest.java delete mode 100644 wallet/support-v4-preferencefragment-1.0.0.aar diff --git a/README.md b/README.md index ea1d69e..bbff6d1 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,17 @@ Verge Tor Wallet for Android ============================ +

android logo

+ ## Building the app Install [Android Studio](https://developer.android.com/sdk/installing/studio.html). Once it is running, import tordroid by navigating to where you cloned or downloaded it and selecting settings.gradle. When it is finished importing, click on the SDK Manager ![SDK Manager](https://developer.android.com/images/tools/sdk-manager-studio.png). -You will want to install Android 15, SDK version 35 (API 35). +You will want to install Android 13, SDK version 33 (API 33).

-Make sure that you have JDK 17 installed before building. -You can get it [here from Oracle (login required)](https://www.oracle.com/java/technologies/downloads/?er=221886#java17). +Make sure that you have JDK 11 installed before building. +You can get it [here from Oracle (login required)](https://www.oracle.com/pk/java/technologies/javase/jdk11-archive-downloads.html). Once you have that installed, navigate to File > Project Structure > SDK Location and change the path of your current JDK to the path of the new JDK.

@@ -24,4 +26,7 @@ and enable USB Debugging. Then plug your phone into your computer and hit the green play button at the top of Android Studio. It will load for a moment before prompting you to select which device to install it on. Select your device from the list, and hit continue. -
+

+**NOTE** +If you are attempting to build on a Lollipop emulator, please ensure that you are using *Android 5.*.* armeabi-v7*. +It will not build on an x86/x86_64 emulator. diff --git a/build.gradle b/build.gradle index 0336c56..2597c85 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:8.5.1' + classpath 'com.android.tools.build:gradle:8.0.2' // classpath 'org.robolectric:robolectric-gradle-plugin:0.11.+' // NOTE: Do not place your application dependencies here; they belong diff --git a/core/build.gradle b/core/build.gradle index b9a00ba..7013fd9 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -17,13 +17,13 @@ dependencies { api 'com.google.code.findbugs:jsr305:3.0.2' //latest as of 10/2023 api 'com.madgag.spongycastle:core:1.58.0.0' //latest as of 10/2023 api 'com.lambdaworks:scrypt:1.4.0' //latest as of 10/2023 - api 'com.google.protobuf:protobuf-java:3.25.3' // updated on 7/22/2024 - api 'org.slf4j:slf4j-jdk14:2.0.13' //latest release ver as of 7/22/2024 - api 'org.json:json:20240303' //latest as of 7/22/2024 + api 'com.google.protobuf:protobuf-java:3.24.3' //latest as of 9/23 + api 'org.slf4j:slf4j-jdk14:2.0.9' //latest release ver as of 10/23 + api 'org.json:json:20231013' //latest as of 10/23 api 'com.squareup.okhttp:okhttp:2.7.5' //latest as of 10/23 testImplementation 'junit:junit:4.13.2' - testImplementation 'org.mockito:mockito-all:1.10.19' + testImplementation 'org.mockito:mockito-all:1.9.5' testImplementation 'com.squareup.okhttp:mockwebserver:2.7.5' } diff --git a/core/src/main/java/com/vergepay/core/CoreUtils.java b/core/src/main/java/com/verge/core/CoreUtils.java similarity index 100% rename from core/src/main/java/com/vergepay/core/CoreUtils.java rename to core/src/main/java/com/verge/core/CoreUtils.java diff --git a/core/src/main/java/com/vergepay/core/Preconditions.java b/core/src/main/java/com/verge/core/Preconditions.java similarity index 100% rename from core/src/main/java/com/vergepay/core/Preconditions.java rename to core/src/main/java/com/verge/core/Preconditions.java diff --git a/core/src/main/java/com/vergepay/core/coins/BitcoinMain.java b/core/src/main/java/com/verge/core/coins/BitcoinMain.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/BitcoinMain.java rename to core/src/main/java/com/verge/core/coins/BitcoinMain.java diff --git a/core/src/main/java/com/vergepay/core/coins/BitcoinTest.java b/core/src/main/java/com/verge/core/coins/BitcoinTest.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/BitcoinTest.java rename to core/src/main/java/com/verge/core/coins/BitcoinTest.java diff --git a/core/src/main/java/com/vergepay/core/coins/BurstMain.java b/core/src/main/java/com/verge/core/coins/BurstMain.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/BurstMain.java rename to core/src/main/java/com/verge/core/coins/BurstMain.java diff --git a/core/src/main/java/com/vergepay/core/coins/CoinID.java b/core/src/main/java/com/verge/core/coins/CoinID.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/CoinID.java rename to core/src/main/java/com/verge/core/coins/CoinID.java diff --git a/core/src/main/java/com/vergepay/core/coins/CoinType.java b/core/src/main/java/com/verge/core/coins/CoinType.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/CoinType.java rename to core/src/main/java/com/verge/core/coins/CoinType.java diff --git a/core/src/main/java/com/vergepay/core/coins/FeePolicy.java b/core/src/main/java/com/verge/core/coins/FeePolicy.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/FeePolicy.java rename to core/src/main/java/com/verge/core/coins/FeePolicy.java diff --git a/core/src/main/java/com/vergepay/core/coins/FiatType.java b/core/src/main/java/com/verge/core/coins/FiatType.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/FiatType.java rename to core/src/main/java/com/verge/core/coins/FiatType.java diff --git a/core/src/main/java/com/vergepay/core/coins/FiatValue.java b/core/src/main/java/com/verge/core/coins/FiatValue.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/FiatValue.java rename to core/src/main/java/com/verge/core/coins/FiatValue.java diff --git a/core/src/main/java/com/vergepay/core/coins/LitecoinMain.java b/core/src/main/java/com/verge/core/coins/LitecoinMain.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/LitecoinMain.java rename to core/src/main/java/com/verge/core/coins/LitecoinMain.java diff --git a/core/src/main/java/com/vergepay/core/coins/LitecoinTest.java b/core/src/main/java/com/verge/core/coins/LitecoinTest.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/LitecoinTest.java rename to core/src/main/java/com/verge/core/coins/LitecoinTest.java diff --git a/core/src/main/java/com/vergepay/core/coins/NxtMain.java b/core/src/main/java/com/verge/core/coins/NxtMain.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/NxtMain.java rename to core/src/main/java/com/verge/core/coins/NxtMain.java diff --git a/core/src/main/java/com/vergepay/core/coins/SoftDustPolicy.java b/core/src/main/java/com/verge/core/coins/SoftDustPolicy.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/SoftDustPolicy.java rename to core/src/main/java/com/verge/core/coins/SoftDustPolicy.java diff --git a/core/src/main/java/com/vergepay/core/coins/Value.java b/core/src/main/java/com/verge/core/coins/Value.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/Value.java rename to core/src/main/java/com/verge/core/coins/Value.java diff --git a/core/src/main/java/com/vergepay/core/coins/ValueType.java b/core/src/main/java/com/verge/core/coins/ValueType.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/ValueType.java rename to core/src/main/java/com/verge/core/coins/ValueType.java diff --git a/core/src/main/java/com/vergepay/core/coins/VergeMain.java b/core/src/main/java/com/verge/core/coins/VergeMain.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/VergeMain.java rename to core/src/main/java/com/verge/core/coins/VergeMain.java diff --git a/core/src/main/java/com/vergepay/core/coins/families/BitFamily.java b/core/src/main/java/com/verge/core/coins/families/BitFamily.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/families/BitFamily.java rename to core/src/main/java/com/verge/core/coins/families/BitFamily.java diff --git a/core/src/main/java/com/verge/core/coins/families/ClamsFamily.java b/core/src/main/java/com/verge/core/coins/families/ClamsFamily.java new file mode 100644 index 0000000..865eaab --- /dev/null +++ b/core/src/main/java/com/verge/core/coins/families/ClamsFamily.java @@ -0,0 +1,23 @@ +package com.vergepay.core.coins.families; + +import com.vergepay.core.messages.MessageFactory; +import com.vergepay.core.wallet.families.clams.ClamsTxMessage; + +import javax.annotation.Nullable; + +/** + * @author John L. Jegutanis + * + * This family contains Clams + */ +public class ClamsFamily extends BitFamily { + { + family = Families.CLAMS; + } + + @Override + @Nullable + public MessageFactory getMessagesFactory() { + return ClamsTxMessage.getFactory(); + } +} diff --git a/core/src/main/java/com/vergepay/core/coins/families/Families.java b/core/src/main/java/com/verge/core/coins/families/Families.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/families/Families.java rename to core/src/main/java/com/verge/core/coins/families/Families.java diff --git a/core/src/main/java/com/verge/core/coins/families/NuFamily.java b/core/src/main/java/com/verge/core/coins/families/NuFamily.java new file mode 100644 index 0000000..cf32ed9 --- /dev/null +++ b/core/src/main/java/com/verge/core/coins/families/NuFamily.java @@ -0,0 +1,12 @@ +package com.vergepay.core.coins.families; + +/** + * @author John L. Jegutanis + * + * This family contains NuBits, NuShares, BlockShares, etc + */ +public abstract class NuFamily extends BitFamily { + { + family = Families.NUBITS; + } +} diff --git a/core/src/main/java/com/vergepay/core/coins/families/NxtFamily.java b/core/src/main/java/com/verge/core/coins/families/NxtFamily.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/families/NxtFamily.java rename to core/src/main/java/com/verge/core/coins/families/NxtFamily.java diff --git a/core/src/main/java/com/vergepay/core/coins/families/PeerFamily.java b/core/src/main/java/com/verge/core/coins/families/PeerFamily.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/families/PeerFamily.java rename to core/src/main/java/com/verge/core/coins/families/PeerFamily.java diff --git a/core/src/main/java/com/verge/core/coins/families/ReddFamily.java b/core/src/main/java/com/verge/core/coins/families/ReddFamily.java new file mode 100644 index 0000000..fd152e8 --- /dev/null +++ b/core/src/main/java/com/verge/core/coins/families/ReddFamily.java @@ -0,0 +1,12 @@ +package com.vergepay.core.coins.families; + +/** + * @author John L. Jegutanis + * + * This family contains Reddcoin, Cannacoin, etc + */ +public abstract class ReddFamily extends BitFamily { + { + family = Families.REDDCOIN; + } +} \ No newline at end of file diff --git a/core/src/main/java/com/verge/core/coins/families/VpncoinFamily.java b/core/src/main/java/com/verge/core/coins/families/VpncoinFamily.java new file mode 100644 index 0000000..ce5158b --- /dev/null +++ b/core/src/main/java/com/verge/core/coins/families/VpncoinFamily.java @@ -0,0 +1,23 @@ +package com.vergepay.core.coins.families; + +import com.vergepay.core.messages.MessageFactory; +import com.vergepay.core.wallet.families.vpncoin.VpncoinTxMessage; + +import javax.annotation.Nullable; + +/** + * @author John L. Jegutanis + * + * This family contains Vpncoin + */ +public abstract class VpncoinFamily extends BitFamily { + { + family = Families.VPNCOIN; + } + + @Override + @Nullable + public MessageFactory getMessagesFactory() { + return VpncoinTxMessage.getFactory(); + } +} \ No newline at end of file diff --git a/core/src/main/java/com/vergepay/core/coins/nxt/Account.java b/core/src/main/java/com/verge/core/coins/nxt/Account.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/nxt/Account.java rename to core/src/main/java/com/verge/core/coins/nxt/Account.java diff --git a/core/src/main/java/com/vergepay/core/coins/nxt/Appendix.java b/core/src/main/java/com/verge/core/coins/nxt/Appendix.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/nxt/Appendix.java rename to core/src/main/java/com/verge/core/coins/nxt/Appendix.java diff --git a/core/src/main/java/com/vergepay/core/coins/nxt/Attachment.java b/core/src/main/java/com/verge/core/coins/nxt/Attachment.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/nxt/Attachment.java rename to core/src/main/java/com/verge/core/coins/nxt/Attachment.java diff --git a/core/src/main/java/com/vergepay/core/coins/nxt/Constants.java b/core/src/main/java/com/verge/core/coins/nxt/Constants.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/nxt/Constants.java rename to core/src/main/java/com/verge/core/coins/nxt/Constants.java diff --git a/core/src/main/java/com/vergepay/core/coins/nxt/Convert.java b/core/src/main/java/com/verge/core/coins/nxt/Convert.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/nxt/Convert.java rename to core/src/main/java/com/verge/core/coins/nxt/Convert.java diff --git a/core/src/main/java/com/vergepay/core/coins/nxt/Crypto.java b/core/src/main/java/com/verge/core/coins/nxt/Crypto.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/nxt/Crypto.java rename to core/src/main/java/com/verge/core/coins/nxt/Crypto.java diff --git a/core/src/main/java/com/vergepay/core/coins/nxt/Curve25519.java b/core/src/main/java/com/verge/core/coins/nxt/Curve25519.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/nxt/Curve25519.java rename to core/src/main/java/com/verge/core/coins/nxt/Curve25519.java diff --git a/core/src/main/java/com/vergepay/core/coins/nxt/EncryptedData.java b/core/src/main/java/com/verge/core/coins/nxt/EncryptedData.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/nxt/EncryptedData.java rename to core/src/main/java/com/verge/core/coins/nxt/EncryptedData.java diff --git a/core/src/main/java/com/vergepay/core/coins/nxt/NxtException.java b/core/src/main/java/com/verge/core/coins/nxt/NxtException.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/nxt/NxtException.java rename to core/src/main/java/com/verge/core/coins/nxt/NxtException.java diff --git a/core/src/main/java/com/vergepay/core/coins/nxt/ReedSolomon.java b/core/src/main/java/com/verge/core/coins/nxt/ReedSolomon.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/nxt/ReedSolomon.java rename to core/src/main/java/com/verge/core/coins/nxt/ReedSolomon.java diff --git a/core/src/main/java/com/vergepay/core/coins/nxt/Transaction.java b/core/src/main/java/com/verge/core/coins/nxt/Transaction.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/nxt/Transaction.java rename to core/src/main/java/com/verge/core/coins/nxt/Transaction.java diff --git a/core/src/main/java/com/vergepay/core/coins/nxt/TransactionImpl.java b/core/src/main/java/com/verge/core/coins/nxt/TransactionImpl.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/nxt/TransactionImpl.java rename to core/src/main/java/com/verge/core/coins/nxt/TransactionImpl.java diff --git a/core/src/main/java/com/vergepay/core/coins/nxt/TransactionType.java b/core/src/main/java/com/verge/core/coins/nxt/TransactionType.java similarity index 100% rename from core/src/main/java/com/vergepay/core/coins/nxt/TransactionType.java rename to core/src/main/java/com/verge/core/coins/nxt/TransactionType.java diff --git a/core/src/main/java/com/vergepay/core/exceptions/AddressMalformedException.java b/core/src/main/java/com/verge/core/exceptions/AddressMalformedException.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exceptions/AddressMalformedException.java rename to core/src/main/java/com/verge/core/exceptions/AddressMalformedException.java diff --git a/core/src/main/java/com/vergepay/core/exceptions/Bip44KeyLookAheadExceededException.java b/core/src/main/java/com/verge/core/exceptions/Bip44KeyLookAheadExceededException.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exceptions/Bip44KeyLookAheadExceededException.java rename to core/src/main/java/com/verge/core/exceptions/Bip44KeyLookAheadExceededException.java diff --git a/core/src/main/java/com/vergepay/core/exceptions/InvalidMessageSignature.java b/core/src/main/java/com/verge/core/exceptions/InvalidMessageSignature.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exceptions/InvalidMessageSignature.java rename to core/src/main/java/com/verge/core/exceptions/InvalidMessageSignature.java diff --git a/core/src/main/java/com/vergepay/core/exceptions/KeyIsEncryptedException.java b/core/src/main/java/com/verge/core/exceptions/KeyIsEncryptedException.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exceptions/KeyIsEncryptedException.java rename to core/src/main/java/com/verge/core/exceptions/KeyIsEncryptedException.java diff --git a/core/src/main/java/com/vergepay/core/exceptions/MissingPrivateKeyException.java b/core/src/main/java/com/verge/core/exceptions/MissingPrivateKeyException.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exceptions/MissingPrivateKeyException.java rename to core/src/main/java/com/verge/core/exceptions/MissingPrivateKeyException.java diff --git a/core/src/main/java/com/vergepay/core/exceptions/NoSuchPocketException.java b/core/src/main/java/com/verge/core/exceptions/NoSuchPocketException.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exceptions/NoSuchPocketException.java rename to core/src/main/java/com/verge/core/exceptions/NoSuchPocketException.java diff --git a/core/src/main/java/com/vergepay/core/exceptions/TransactionBroadcastException.java b/core/src/main/java/com/verge/core/exceptions/TransactionBroadcastException.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exceptions/TransactionBroadcastException.java rename to core/src/main/java/com/verge/core/exceptions/TransactionBroadcastException.java diff --git a/core/src/main/java/com/vergepay/core/exceptions/UnsupportedCoinTypeException.java b/core/src/main/java/com/verge/core/exceptions/UnsupportedCoinTypeException.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exceptions/UnsupportedCoinTypeException.java rename to core/src/main/java/com/verge/core/exceptions/UnsupportedCoinTypeException.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/Connection.java b/core/src/main/java/com/verge/core/exchange/shapeshift/Connection.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/Connection.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/Connection.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/ShapeShift.java b/core/src/main/java/com/verge/core/exchange/shapeshift/ShapeShift.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/ShapeShift.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/ShapeShift.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftAmountTx.java b/core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftAmountTx.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftAmountTx.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftAmountTx.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftBase.java b/core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftBase.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftBase.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftBase.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftCoin.java b/core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftCoin.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftCoin.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftCoin.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftCoins.java b/core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftCoins.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftCoins.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftCoins.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftEmail.java b/core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftEmail.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftEmail.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftEmail.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftException.java b/core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftException.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftException.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftException.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftExchangeRate.java b/core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftExchangeRate.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftExchangeRate.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftExchangeRate.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftLimit.java b/core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftLimit.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftLimit.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftLimit.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftMarketInfo.java b/core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftMarketInfo.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftMarketInfo.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftMarketInfo.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftNormalTx.java b/core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftNormalTx.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftNormalTx.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftNormalTx.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftPairBase.java b/core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftPairBase.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftPairBase.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftPairBase.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftRate.java b/core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftRate.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftRate.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftRate.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftTime.java b/core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftTime.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftTime.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftTime.java diff --git a/core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftTxStatus.java b/core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftTxStatus.java similarity index 100% rename from core/src/main/java/com/vergepay/core/exchange/shapeshift/data/ShapeShiftTxStatus.java rename to core/src/main/java/com/verge/core/exchange/shapeshift/data/ShapeShiftTxStatus.java diff --git a/core/src/main/java/com/vergepay/core/messages/MessageFactory.java b/core/src/main/java/com/verge/core/messages/MessageFactory.java similarity index 100% rename from core/src/main/java/com/vergepay/core/messages/MessageFactory.java rename to core/src/main/java/com/verge/core/messages/MessageFactory.java diff --git a/core/src/main/java/com/vergepay/core/messages/TxMessage.java b/core/src/main/java/com/verge/core/messages/TxMessage.java similarity index 100% rename from core/src/main/java/com/vergepay/core/messages/TxMessage.java rename to core/src/main/java/com/verge/core/messages/TxMessage.java diff --git a/core/src/main/java/com/vergepay/core/network/AddressStatus.java b/core/src/main/java/com/verge/core/network/AddressStatus.java similarity index 100% rename from core/src/main/java/com/vergepay/core/network/AddressStatus.java rename to core/src/main/java/com/verge/core/network/AddressStatus.java diff --git a/core/src/main/java/com/vergepay/core/network/BlockHeader.java b/core/src/main/java/com/verge/core/network/BlockHeader.java similarity index 100% rename from core/src/main/java/com/vergepay/core/network/BlockHeader.java rename to core/src/main/java/com/verge/core/network/BlockHeader.java diff --git a/core/src/main/java/com/vergepay/core/network/CoinAddress.java b/core/src/main/java/com/verge/core/network/CoinAddress.java similarity index 100% rename from core/src/main/java/com/vergepay/core/network/CoinAddress.java rename to core/src/main/java/com/verge/core/network/CoinAddress.java diff --git a/core/src/main/java/com/vergepay/core/network/ConnectivityHelper.java b/core/src/main/java/com/verge/core/network/ConnectivityHelper.java similarity index 100% rename from core/src/main/java/com/vergepay/core/network/ConnectivityHelper.java rename to core/src/main/java/com/verge/core/network/ConnectivityHelper.java diff --git a/core/src/main/java/com/vergepay/core/network/NxtServerClient.java b/core/src/main/java/com/verge/core/network/NxtServerClient.java similarity index 100% rename from core/src/main/java/com/vergepay/core/network/NxtServerClient.java rename to core/src/main/java/com/verge/core/network/NxtServerClient.java diff --git a/core/src/main/java/com/vergepay/core/network/ServerClient.java b/core/src/main/java/com/verge/core/network/ServerClient.java similarity index 100% rename from core/src/main/java/com/vergepay/core/network/ServerClient.java rename to core/src/main/java/com/verge/core/network/ServerClient.java diff --git a/core/src/main/java/com/vergepay/core/network/ServerClients.java b/core/src/main/java/com/verge/core/network/ServerClients.java similarity index 92% rename from core/src/main/java/com/vergepay/core/network/ServerClients.java rename to core/src/main/java/com/verge/core/network/ServerClients.java index 1657bd3..ca47ed6 100644 --- a/core/src/main/java/com/vergepay/core/network/ServerClients.java +++ b/core/src/main/java/com/verge/core/network/ServerClients.java @@ -2,6 +2,7 @@ import com.vergepay.core.coins.CoinType; import com.vergepay.core.coins.families.BitFamily; +import com.vergepay.core.coins.families.NxtFamily; import com.vergepay.core.exceptions.UnsupportedCoinTypeException; import com.vergepay.core.network.interfaces.BlockchainConnection; import com.vergepay.core.wallet.WalletAccount; @@ -75,6 +76,11 @@ private BlockchainConnection getConnection(CoinType type) { client.setCacheDir(cacheDir, cacheSize); connections.put(type, client); return client; + } else if (type instanceof NxtFamily) { + NxtServerClient client = new NxtServerClient(addresses.get(type), connectivityHelper); + client.setCacheDir(cacheDir, cacheSize); + connections.put(type, client); + return client; } else { throw new UnsupportedCoinTypeException(type); } diff --git a/core/src/main/java/com/vergepay/core/network/interfaces/BlockchainConnection.java b/core/src/main/java/com/verge/core/network/interfaces/BlockchainConnection.java similarity index 100% rename from core/src/main/java/com/vergepay/core/network/interfaces/BlockchainConnection.java rename to core/src/main/java/com/verge/core/network/interfaces/BlockchainConnection.java diff --git a/core/src/main/java/com/vergepay/core/network/interfaces/ConnectionEventListener.java b/core/src/main/java/com/verge/core/network/interfaces/ConnectionEventListener.java similarity index 100% rename from core/src/main/java/com/vergepay/core/network/interfaces/ConnectionEventListener.java rename to core/src/main/java/com/verge/core/network/interfaces/ConnectionEventListener.java diff --git a/core/src/main/java/com/vergepay/core/network/interfaces/TransactionEventListener.java b/core/src/main/java/com/verge/core/network/interfaces/TransactionEventListener.java similarity index 100% rename from core/src/main/java/com/vergepay/core/network/interfaces/TransactionEventListener.java rename to core/src/main/java/com/verge/core/network/interfaces/TransactionEventListener.java diff --git a/core/src/main/java/com/vergepay/core/protos/Protos.java b/core/src/main/java/com/verge/core/protos/Protos.java similarity index 100% rename from core/src/main/java/com/vergepay/core/protos/Protos.java rename to core/src/main/java/com/verge/core/protos/Protos.java diff --git a/core/src/main/java/com/vergepay/core/uri/CoinURI.java b/core/src/main/java/com/verge/core/uri/CoinURI.java similarity index 99% rename from core/src/main/java/com/vergepay/core/uri/CoinURI.java rename to core/src/main/java/com/verge/core/uri/CoinURI.java index 059543f..e6fca9e 100644 --- a/core/src/main/java/com/vergepay/core/uri/CoinURI.java +++ b/core/src/main/java/com/verge/core/uri/CoinURI.java @@ -1,7 +1,6 @@ - /* * Copyright 2012, 2014 the original author or authors. - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or @@ -14,7 +13,7 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * */ package com.vergepay.core.uri; @@ -81,7 +80,7 @@ *
  • {@code label} any URL encoded alphanumeric
  • *
  • {@code message} any URL encoded alphanumeric
  • * - * + * * @author Andreas Schildbach (initial code) * @author Jim Burton (enhancements for MultiBit) * @author Gary Rowe (BIP21 support) @@ -149,7 +148,7 @@ public CoinURI(@Nullable CoinType uriType, String input) throws CoinURIParseExce // URI is formed as bitcoin:
    ? // blockchain.info generates URIs of non-BIP compliant form bitcoin://address?.... // We support both until Ben fixes his code. - + // Remove the bitcoin scheme. // (Note: getSchemeSpecificPart() is not used as it unescapes the label and parse then fails. // For instance with : bitcoin:129mVqKUmJ9uwPxKJBnNdABbuaaNfho4Ha?amount=0.06&label=Tom%20%26%20Jerry @@ -370,7 +369,7 @@ private void parseParameters(String[] nameValuePairTokens, List possib /** * Put the value against the key in the map checking for duplication. This avoids address field overwrite etc. - * + * * @param key The key for the map * @param value The value to store */ @@ -480,7 +479,7 @@ public URI getAddressRequestUriResponse(String address) { } return null; } - + /** * @param name The name of the parameter * @return The parameter value, or null if not present @@ -552,30 +551,30 @@ public static String convertToCoinURI(AbstractAddress address, @Nullable Value a if (amount != null && amount.signum() < 0) { throw new IllegalArgumentException("Coin must be positive"); } - + StringBuilder builder = new StringBuilder(); // Removing appending verge: to all data // builder.append(type.getUriScheme()).append(":").append(addressStr); builder.append(addressStr); boolean questionMarkHasBeenOutput = false; - + if (amount != null) { builder.append(QUESTION_MARK_SEPARATOR).append(FIELD_AMOUNT).append("="); builder.append(GenericUtils.formatCoinValue(type, amount, true)); questionMarkHasBeenOutput = true; } - + if (label != null && !"".equals(label)) { if (questionMarkHasBeenOutput) { builder.append(AMPERSAND_SEPARATOR); } else { - builder.append(QUESTION_MARK_SEPARATOR); + builder.append(QUESTION_MARK_SEPARATOR); questionMarkHasBeenOutput = true; } builder.append(FIELD_LABEL).append("=").append(encodeURLString(label)); } - + if (message != null && !"".equals(message)) { if (questionMarkHasBeenOutput) { builder.append(AMPERSAND_SEPARATOR); @@ -593,13 +592,13 @@ public static String convertToCoinURI(AbstractAddress address, @Nullable Value a } builder.append(FIELD_PUBKEY).append("=").append(encodeURLString(pubkey)); } - + return builder.toString(); } /** * Encode a string using URL encoding - * + * * @param stringToEncode The string to URL encode */ static String encodeURLString(String stringToEncode) { diff --git a/core/src/main/java/com/vergepay/core/uri/CoinURIParseException.java b/core/src/main/java/com/verge/core/uri/CoinURIParseException.java similarity index 100% rename from core/src/main/java/com/vergepay/core/uri/CoinURIParseException.java rename to core/src/main/java/com/verge/core/uri/CoinURIParseException.java diff --git a/core/src/main/java/com/vergepay/core/uri/OptionalFieldValidationException.java b/core/src/main/java/com/verge/core/uri/OptionalFieldValidationException.java similarity index 100% rename from core/src/main/java/com/vergepay/core/uri/OptionalFieldValidationException.java rename to core/src/main/java/com/verge/core/uri/OptionalFieldValidationException.java diff --git a/core/src/main/java/com/vergepay/core/uri/RequiredFieldValidationException.java b/core/src/main/java/com/verge/core/uri/RequiredFieldValidationException.java similarity index 100% rename from core/src/main/java/com/vergepay/core/uri/RequiredFieldValidationException.java rename to core/src/main/java/com/verge/core/uri/RequiredFieldValidationException.java diff --git a/core/src/main/java/com/vergepay/core/util/BitAddressUtils.java b/core/src/main/java/com/verge/core/util/BitAddressUtils.java similarity index 100% rename from core/src/main/java/com/vergepay/core/util/BitAddressUtils.java rename to core/src/main/java/com/verge/core/util/BitAddressUtils.java diff --git a/core/src/main/java/com/vergepay/core/util/Currencies.java b/core/src/main/java/com/verge/core/util/Currencies.java similarity index 100% rename from core/src/main/java/com/vergepay/core/util/Currencies.java rename to core/src/main/java/com/verge/core/util/Currencies.java diff --git a/core/src/main/java/com/vergepay/core/util/ExchangeRate.java b/core/src/main/java/com/verge/core/util/ExchangeRate.java similarity index 100% rename from core/src/main/java/com/vergepay/core/util/ExchangeRate.java rename to core/src/main/java/com/verge/core/util/ExchangeRate.java diff --git a/core/src/main/java/com/vergepay/core/util/ExchangeRateBase.java b/core/src/main/java/com/verge/core/util/ExchangeRateBase.java similarity index 100% rename from core/src/main/java/com/vergepay/core/util/ExchangeRateBase.java rename to core/src/main/java/com/verge/core/util/ExchangeRateBase.java diff --git a/core/src/main/java/com/vergepay/core/util/GenericUtils.java b/core/src/main/java/com/verge/core/util/GenericUtils.java similarity index 100% rename from core/src/main/java/com/vergepay/core/util/GenericUtils.java rename to core/src/main/java/com/verge/core/util/GenericUtils.java diff --git a/core/src/main/java/com/vergepay/core/util/HardwareSoftwareCompliance.java b/core/src/main/java/com/verge/core/util/HardwareSoftwareCompliance.java similarity index 100% rename from core/src/main/java/com/vergepay/core/util/HardwareSoftwareCompliance.java rename to core/src/main/java/com/verge/core/util/HardwareSoftwareCompliance.java diff --git a/core/src/main/java/com/vergepay/core/util/KeyUtils.java b/core/src/main/java/com/verge/core/util/KeyUtils.java similarity index 100% rename from core/src/main/java/com/vergepay/core/util/KeyUtils.java rename to core/src/main/java/com/verge/core/util/KeyUtils.java diff --git a/core/src/main/java/com/vergepay/core/util/MonetaryFormat.java b/core/src/main/java/com/verge/core/util/MonetaryFormat.java similarity index 100% rename from core/src/main/java/com/vergepay/core/util/MonetaryFormat.java rename to core/src/main/java/com/verge/core/util/MonetaryFormat.java diff --git a/core/src/main/java/com/vergepay/core/util/TypeUtils.java b/core/src/main/java/com/verge/core/util/TypeUtils.java similarity index 100% rename from core/src/main/java/com/vergepay/core/util/TypeUtils.java rename to core/src/main/java/com/verge/core/util/TypeUtils.java diff --git a/core/src/main/java/com/vergepay/core/wallet/AbstractAddress.java b/core/src/main/java/com/verge/core/wallet/AbstractAddress.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/AbstractAddress.java rename to core/src/main/java/com/verge/core/wallet/AbstractAddress.java diff --git a/core/src/main/java/com/vergepay/core/wallet/AbstractTransaction.java b/core/src/main/java/com/verge/core/wallet/AbstractTransaction.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/AbstractTransaction.java rename to core/src/main/java/com/verge/core/wallet/AbstractTransaction.java diff --git a/core/src/main/java/com/vergepay/core/wallet/AbstractWallet.java b/core/src/main/java/com/verge/core/wallet/AbstractWallet.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/AbstractWallet.java rename to core/src/main/java/com/verge/core/wallet/AbstractWallet.java diff --git a/core/src/main/java/com/vergepay/core/wallet/BitWalletBase.java b/core/src/main/java/com/verge/core/wallet/BitWalletBase.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/BitWalletBase.java rename to core/src/main/java/com/verge/core/wallet/BitWalletBase.java diff --git a/core/src/main/java/com/vergepay/core/wallet/BitWalletSingleKey.java b/core/src/main/java/com/verge/core/wallet/BitWalletSingleKey.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/BitWalletSingleKey.java rename to core/src/main/java/com/verge/core/wallet/BitWalletSingleKey.java diff --git a/core/src/main/java/com/vergepay/core/wallet/SendRequest.java b/core/src/main/java/com/verge/core/wallet/SendRequest.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/SendRequest.java rename to core/src/main/java/com/verge/core/wallet/SendRequest.java diff --git a/core/src/main/java/com/vergepay/core/wallet/SerializedKey.java b/core/src/main/java/com/verge/core/wallet/SerializedKey.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/SerializedKey.java rename to core/src/main/java/com/verge/core/wallet/SerializedKey.java diff --git a/core/src/main/java/com/vergepay/core/wallet/SignedMessage.java b/core/src/main/java/com/verge/core/wallet/SignedMessage.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/SignedMessage.java rename to core/src/main/java/com/verge/core/wallet/SignedMessage.java diff --git a/core/src/main/java/com/vergepay/core/wallet/SimpleHDKeyChain.java b/core/src/main/java/com/verge/core/wallet/SimpleHDKeyChain.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/SimpleHDKeyChain.java rename to core/src/main/java/com/verge/core/wallet/SimpleHDKeyChain.java diff --git a/core/src/main/java/com/vergepay/core/wallet/SimpleKeyChain.java b/core/src/main/java/com/verge/core/wallet/SimpleKeyChain.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/SimpleKeyChain.java rename to core/src/main/java/com/verge/core/wallet/SimpleKeyChain.java diff --git a/core/src/main/java/com/vergepay/core/wallet/TransactionCreator.java b/core/src/main/java/com/verge/core/wallet/TransactionCreator.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/TransactionCreator.java rename to core/src/main/java/com/verge/core/wallet/TransactionCreator.java diff --git a/core/src/main/java/com/vergepay/core/wallet/TransactionWatcherWallet.java b/core/src/main/java/com/verge/core/wallet/TransactionWatcherWallet.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/TransactionWatcherWallet.java rename to core/src/main/java/com/verge/core/wallet/TransactionWatcherWallet.java diff --git a/core/src/main/java/com/vergepay/core/wallet/Wallet.java b/core/src/main/java/com/verge/core/wallet/Wallet.java similarity index 98% rename from core/src/main/java/com/vergepay/core/wallet/Wallet.java rename to core/src/main/java/com/verge/core/wallet/Wallet.java index 6953c51..f6bb68e 100644 --- a/core/src/main/java/com/vergepay/core/wallet/Wallet.java +++ b/core/src/main/java/com/verge/core/wallet/Wallet.java @@ -4,8 +4,10 @@ import com.vergepay.core.coins.CoinType; import com.vergepay.core.coins.Value; import com.vergepay.core.coins.families.BitFamily; +import com.vergepay.core.coins.families.NxtFamily; import com.vergepay.core.exceptions.UnsupportedCoinTypeException; import com.vergepay.core.protos.Protos; +import com.vergepay.core.wallet.families.nxt.NxtFamilyWallet; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Splitter; import com.google.common.collect.ImmutableList; @@ -288,6 +290,8 @@ private WalletAccount createAndAddAccount(CoinType coinType, @Nullable KeyParame if (coinType instanceof BitFamily) { newPocket = new WalletPocketHD(rootKey, coinType, getKeyCrypter(), key); + } else if (coinType instanceof NxtFamily) { + newPocket = new NxtFamilyWallet(rootKey, coinType, getKeyCrypter(), key); } else { throw new UnsupportedCoinTypeException(coinType); } diff --git a/core/src/main/java/com/vergepay/core/wallet/WalletAccount.java b/core/src/main/java/com/verge/core/wallet/WalletAccount.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/WalletAccount.java rename to core/src/main/java/com/verge/core/wallet/WalletAccount.java diff --git a/core/src/main/java/com/vergepay/core/wallet/WalletAccountEventListener.java b/core/src/main/java/com/verge/core/wallet/WalletAccountEventListener.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/WalletAccountEventListener.java rename to core/src/main/java/com/verge/core/wallet/WalletAccountEventListener.java diff --git a/core/src/main/java/com/vergepay/core/wallet/WalletCoinSelector.java b/core/src/main/java/com/verge/core/wallet/WalletCoinSelector.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/WalletCoinSelector.java rename to core/src/main/java/com/verge/core/wallet/WalletCoinSelector.java diff --git a/core/src/main/java/com/vergepay/core/wallet/WalletConnectivityStatus.java b/core/src/main/java/com/verge/core/wallet/WalletConnectivityStatus.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/WalletConnectivityStatus.java rename to core/src/main/java/com/verge/core/wallet/WalletConnectivityStatus.java diff --git a/core/src/main/java/com/vergepay/core/wallet/WalletFiles.java b/core/src/main/java/com/verge/core/wallet/WalletFiles.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/WalletFiles.java rename to core/src/main/java/com/verge/core/wallet/WalletFiles.java diff --git a/core/src/main/java/com/vergepay/core/wallet/WalletPocketHD.java b/core/src/main/java/com/verge/core/wallet/WalletPocketHD.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/WalletPocketHD.java rename to core/src/main/java/com/verge/core/wallet/WalletPocketHD.java diff --git a/core/src/main/java/com/vergepay/core/wallet/WalletPocketProtobufSerializer.java b/core/src/main/java/com/verge/core/wallet/WalletPocketProtobufSerializer.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/WalletPocketProtobufSerializer.java rename to core/src/main/java/com/verge/core/wallet/WalletPocketProtobufSerializer.java diff --git a/core/src/main/java/com/vergepay/core/wallet/WalletProtobufSerializer.java b/core/src/main/java/com/verge/core/wallet/WalletProtobufSerializer.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/WalletProtobufSerializer.java rename to core/src/main/java/com/verge/core/wallet/WalletProtobufSerializer.java diff --git a/core/src/main/java/com/vergepay/core/wallet/WalletTransaction.java b/core/src/main/java/com/verge/core/wallet/WalletTransaction.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/WalletTransaction.java rename to core/src/main/java/com/verge/core/wallet/WalletTransaction.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/bitcoin/BitAddress.java b/core/src/main/java/com/verge/core/wallet/families/bitcoin/BitAddress.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/bitcoin/BitAddress.java rename to core/src/main/java/com/verge/core/wallet/families/bitcoin/BitAddress.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/bitcoin/BitBlockchainConnection.java b/core/src/main/java/com/verge/core/wallet/families/bitcoin/BitBlockchainConnection.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/bitcoin/BitBlockchainConnection.java rename to core/src/main/java/com/verge/core/wallet/families/bitcoin/BitBlockchainConnection.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/bitcoin/BitSendRequest.java b/core/src/main/java/com/verge/core/wallet/families/bitcoin/BitSendRequest.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/bitcoin/BitSendRequest.java rename to core/src/main/java/com/verge/core/wallet/families/bitcoin/BitSendRequest.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/bitcoin/BitTransaction.java b/core/src/main/java/com/verge/core/wallet/families/bitcoin/BitTransaction.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/bitcoin/BitTransaction.java rename to core/src/main/java/com/verge/core/wallet/families/bitcoin/BitTransaction.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/bitcoin/BitTransactionEventListener.java b/core/src/main/java/com/verge/core/wallet/families/bitcoin/BitTransactionEventListener.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/bitcoin/BitTransactionEventListener.java rename to core/src/main/java/com/verge/core/wallet/families/bitcoin/BitTransactionEventListener.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/bitcoin/BitWalletTransaction.java b/core/src/main/java/com/verge/core/wallet/families/bitcoin/BitWalletTransaction.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/bitcoin/BitWalletTransaction.java rename to core/src/main/java/com/verge/core/wallet/families/bitcoin/BitWalletTransaction.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/bitcoin/CoinSelection.java b/core/src/main/java/com/verge/core/wallet/families/bitcoin/CoinSelection.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/bitcoin/CoinSelection.java rename to core/src/main/java/com/verge/core/wallet/families/bitcoin/CoinSelection.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/bitcoin/CoinSelector.java b/core/src/main/java/com/verge/core/wallet/families/bitcoin/CoinSelector.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/bitcoin/CoinSelector.java rename to core/src/main/java/com/verge/core/wallet/families/bitcoin/CoinSelector.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/bitcoin/EmptyTransactionOutput.java b/core/src/main/java/com/verge/core/wallet/families/bitcoin/EmptyTransactionOutput.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/bitcoin/EmptyTransactionOutput.java rename to core/src/main/java/com/verge/core/wallet/families/bitcoin/EmptyTransactionOutput.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/bitcoin/OutPointOutput.java b/core/src/main/java/com/verge/core/wallet/families/bitcoin/OutPointOutput.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/bitcoin/OutPointOutput.java rename to core/src/main/java/com/verge/core/wallet/families/bitcoin/OutPointOutput.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/bitcoin/TrimmedOutPoint.java b/core/src/main/java/com/verge/core/wallet/families/bitcoin/TrimmedOutPoint.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/bitcoin/TrimmedOutPoint.java rename to core/src/main/java/com/verge/core/wallet/families/bitcoin/TrimmedOutPoint.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/bitcoin/TrimmedOutput.java b/core/src/main/java/com/verge/core/wallet/families/bitcoin/TrimmedOutput.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/bitcoin/TrimmedOutput.java rename to core/src/main/java/com/verge/core/wallet/families/bitcoin/TrimmedOutput.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/bitcoin/TrimmedTransaction.java b/core/src/main/java/com/verge/core/wallet/families/bitcoin/TrimmedTransaction.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/bitcoin/TrimmedTransaction.java rename to core/src/main/java/com/verge/core/wallet/families/bitcoin/TrimmedTransaction.java diff --git a/core/src/main/java/com/verge/core/wallet/families/clams/ClamsTxMessage.java b/core/src/main/java/com/verge/core/wallet/families/clams/ClamsTxMessage.java new file mode 100644 index 0000000..d78308a --- /dev/null +++ b/core/src/main/java/com/verge/core/wallet/families/clams/ClamsTxMessage.java @@ -0,0 +1,121 @@ +package com.vergepay.core.wallet.families.clams; + +import com.vergepay.core.messages.MessageFactory; +import com.vergepay.core.messages.TxMessage; +import com.vergepay.core.wallet.AbstractTransaction; +import com.vergepay.core.wallet.families.bitcoin.BitTransaction; +import com.google.common.base.Charsets; + +import org.bitcoinj.core.Transaction; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.annotation.Nullable; + +import static com.vergepay.core.Preconditions.checkArgument; + +/** + * @author John L. Jegutanis + */ +public class ClamsTxMessage implements TxMessage { + private static final Logger log = LoggerFactory.getLogger(ClamsTxMessage.class); + + public static final int MAX_MESSAGE_BYTES = 140; + + private String message; + + ClamsTxMessage(String message) { + setMessage(message); + } + + private final static ClamsMessageFactory instance = new ClamsMessageFactory(); + public static MessageFactory getFactory() { + return instance; + } + + public static ClamsTxMessage create(String message) throws IllegalArgumentException { + return new ClamsTxMessage(message); + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + checkArgument(serialize(message).length <= MAX_MESSAGE_BYTES, "Message is too big"); + this.message = message; + } + + @Nullable + public static ClamsTxMessage parse(AbstractTransaction tx) { + try { + Transaction rawTx = ((BitTransaction) tx).getRawTransaction(); + byte[] bytes = rawTx.getExtraBytes(); + if (bytes == null || bytes.length == 0) return null; + checkArgument(bytes.length <= MAX_MESSAGE_BYTES, "Maximum data size exceeded"); + + return new ClamsTxMessage(new String(bytes, Charsets.UTF_8)); + } catch (Exception e) { + log.info("Could not parse message: {}", e.getMessage()); + return null; + } + } + + public boolean isEmpty() { + return isNullOrEmpty(message); + } + + private static boolean isNullOrEmpty(String str) { + return str == null || str.trim().isEmpty(); + } + + @Override + public Type getType() { + return Type.PUBLIC; // Only public is supported + } + + @Override + public String toString() { + return message; + } + + @Override + public void serializeTo(AbstractTransaction transaction) { + if (transaction instanceof BitTransaction) { + Transaction rawTx = ((BitTransaction) transaction).getRawTransaction(); + rawTx.setExtraBytes(serialize(message)); + } + } + + static byte[] serialize(String message) { + return message.getBytes(Charsets.UTF_8); + } + + public static class ClamsMessageFactory implements MessageFactory { + @Override + public int maxMessageSizeBytes() { + return MAX_MESSAGE_BYTES; + } + + @Override + public boolean canHandlePublicMessages() { + return true; + } + + @Override + public boolean canHandlePrivateMessages() { + return false; + } + + @Override + public TxMessage createPublicMessage(String message) { + return create(message); + } + + @Nullable + @Override + public TxMessage extractPublicMessage(AbstractTransaction transaction) { + return parse(transaction); + } + } +} \ No newline at end of file diff --git a/core/src/main/java/com/vergepay/core/wallet/families/nxt/NxtAddress.java b/core/src/main/java/com/verge/core/wallet/families/nxt/NxtAddress.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/nxt/NxtAddress.java rename to core/src/main/java/com/verge/core/wallet/families/nxt/NxtAddress.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/nxt/NxtFamilyKey.java b/core/src/main/java/com/verge/core/wallet/families/nxt/NxtFamilyKey.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/nxt/NxtFamilyKey.java rename to core/src/main/java/com/verge/core/wallet/families/nxt/NxtFamilyKey.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/nxt/NxtFamilyWallet.java b/core/src/main/java/com/verge/core/wallet/families/nxt/NxtFamilyWallet.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/nxt/NxtFamilyWallet.java rename to core/src/main/java/com/verge/core/wallet/families/nxt/NxtFamilyWallet.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/nxt/NxtFamilyWalletProtobufSerializer.java b/core/src/main/java/com/verge/core/wallet/families/nxt/NxtFamilyWalletProtobufSerializer.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/nxt/NxtFamilyWalletProtobufSerializer.java rename to core/src/main/java/com/verge/core/wallet/families/nxt/NxtFamilyWalletProtobufSerializer.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/nxt/NxtSendRequest.java b/core/src/main/java/com/verge/core/wallet/families/nxt/NxtSendRequest.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/nxt/NxtSendRequest.java rename to core/src/main/java/com/verge/core/wallet/families/nxt/NxtSendRequest.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/nxt/NxtTransaction.java b/core/src/main/java/com/verge/core/wallet/families/nxt/NxtTransaction.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/nxt/NxtTransaction.java rename to core/src/main/java/com/verge/core/wallet/families/nxt/NxtTransaction.java diff --git a/core/src/main/java/com/vergepay/core/wallet/families/nxt/NxtTxMessage.java b/core/src/main/java/com/verge/core/wallet/families/nxt/NxtTxMessage.java similarity index 100% rename from core/src/main/java/com/vergepay/core/wallet/families/nxt/NxtTxMessage.java rename to core/src/main/java/com/verge/core/wallet/families/nxt/NxtTxMessage.java diff --git a/core/src/main/java/com/verge/core/wallet/families/vpncoin/VpncoinTxMessage.java b/core/src/main/java/com/verge/core/wallet/families/vpncoin/VpncoinTxMessage.java new file mode 100644 index 0000000..9acf4e8 --- /dev/null +++ b/core/src/main/java/com/verge/core/wallet/families/vpncoin/VpncoinTxMessage.java @@ -0,0 +1,363 @@ +package com.vergepay.core.wallet.families.vpncoin; + +import com.vergepay.core.messages.MessageFactory; +import com.vergepay.core.messages.TxMessage; +import com.vergepay.core.wallet.AbstractTransaction; +import com.vergepay.core.wallet.families.bitcoin.BitTransaction; +import com.google.common.base.Charsets; + +import org.bitcoinj.core.Transaction; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.spongycastle.util.encoders.Base64; + +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.zip.DataFormatException; +import java.util.zip.Inflater; + +import javax.annotation.Nullable; + +import static com.vergepay.core.Preconditions.checkArgument; + +/** + * @author John L. Jegutanis + */ +public class VpncoinTxMessage implements TxMessage { + private static final Logger log = LoggerFactory.getLogger(VpncoinTxMessage.class); + + static final int SIZE_LENGTH = 4; + + public static final int MAX_TX_DATA = 65536; + public static final int MAX_TX_DATA_FROM = 128; + public static final int MAX_TX_DATA_SUBJ = 128; + public static final int MAX_TX_DATA_MSG = MAX_TX_DATA - MAX_TX_DATA_FROM - MAX_TX_DATA_SUBJ; + + static final Pattern MESSAGE_REGEX = + Pattern.compile("(?s)@(?:FROM|SUBJ|MSG)=.*?(?=@(?:FROM|SUBJ|MSG)=|$)"); + + static final String FROM = "@FROM="; + static final String SUBJ = "@SUBJ="; + static final String MSG = "@MSG="; + + private String from; + private String subject; + private String message; + + VpncoinTxMessage() { } + + VpncoinTxMessage(String message) { + setMessage(message); + } + + VpncoinTxMessage(String from, String subject, String message) { + setFrom(from); + setSubject(subject); + setMessage(message); + } + + private final static VpncoinMessageFactory instance = new VpncoinMessageFactory(); + public static MessageFactory getFactory() { + return instance; + } + + public static VpncoinTxMessage create(String message) throws IllegalArgumentException { + return new VpncoinTxMessage(message); + } + + public String getFrom() { + return from; + } + + public String getSubject() { + return subject; + } + + public String getMessage() { + return message; + } + + public void setFrom(String from) { + checkArgument(from.length() <= MAX_TX_DATA_FROM, "'From' field size exceeded"); + this.from = from; + } + + public void setSubject(String subject) { + checkArgument(subject.length() <= MAX_TX_DATA_SUBJ, "'Subject' field size exceeded"); + this.subject = subject; + } + + public void setMessage(String message) { + checkArgument(message.length() <= MAX_TX_DATA_MSG, "'Message' field size exceeded"); + this.message = message; + } + + @Nullable + public static VpncoinTxMessage parse(AbstractTransaction tx) { + Transaction rawTx = null; + byte[] bytes; + String fullMessage = null; + try { + rawTx = ((BitTransaction) tx).getRawTransaction(); + bytes = rawTx.getExtraBytes(); + if (bytes == null || bytes.length == 0) return null; + + fullMessage = new String(bytes, Charsets.UTF_8); + return parseUnencrypted(fullMessage); + } catch (Exception e) { + if (rawTx == null || fullMessage == null) return null; + try { + return parseEncrypted(rawTx.getTime(), fullMessage); + } catch (Exception e1) { + log.info("Could not parse message: {}", e1.getMessage()); + return null; + } + } + } + + @Nullable + public static VpncoinTxMessage parse(String fullMessage) { + if (fullMessage == null || fullMessage.length() == 0) { + return null; + } + + try { + return parseUnencrypted(fullMessage); + } catch (Exception e) { + log.info("Could not parse message: {}", e.getLocalizedMessage()); + return null; + } + } + + public boolean isEmpty() { + return isNullOrEmpty(from) && isNullOrEmpty(subject) && isNullOrEmpty(message); + } + + private static boolean isNullOrEmpty(String str) { + return str == null || str.trim().isEmpty(); + } + + @Override + public Type getType() { + return Type.PUBLIC; // Only public is supported + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + if (!isNullOrEmpty(from)) { + sb.append(from); + } + if (!isNullOrEmpty(subject)) { + if (sb.length() != 0) sb.append("\n\n"); + sb.append(subject); + } + if (!isNullOrEmpty(message)) { + if (sb.length() != 0) sb.append("\n\n"); + sb.append(message); + } + + return sb.toString(); + } + + @Override + public void serializeTo(AbstractTransaction transaction) { + if (transaction instanceof BitTransaction) { + Transaction rawTx = ((BitTransaction) transaction).getRawTransaction(); + rawTx.setExtraBytes(serialize()); + } + } + + byte[] serialize() { + StringBuilder sb = new StringBuilder(); + if (!isNullOrEmpty(from)) { + sb.append(FROM); + sb.append(from); + } + if (!isNullOrEmpty(subject)) { + sb.append(SUBJ); + sb.append(subject); + } + if (!isNullOrEmpty(message)) { + sb.append(MSG); + sb.append(message); + } + + return sb.toString().getBytes(Charsets.UTF_8); + } + + static VpncoinTxMessage parseEncrypted(long key, String fullMessage) throws Exception { + return parseUnencrypted(decrypt(key, fullMessage)); + } + + static VpncoinTxMessage parseUnencrypted(String fullMessage) throws Exception { + checkArgument(fullMessage.length() <= MAX_TX_DATA, "Maximum data size exceeded"); + + Matcher matcher = MESSAGE_REGEX.matcher(fullMessage); + VpncoinTxMessage msg = new VpncoinTxMessage(); + while (matcher.find()) { + String part = matcher.group(); + // Be more relaxed about each field size that we receive from the network + if (part.startsWith(FROM)) { + msg.from = part.replace(FROM, ""); + } else if (part.startsWith(SUBJ)) { + msg.subject = part.replace(SUBJ, ""); + } else if (part.startsWith(MSG)) { + msg.message = part.replace(MSG, ""); + } + } + if (msg.isEmpty()) { + throw new Exception("Message is empty"); + } + return msg; + } + + static int checksum(byte[] data, int offset) { + int crc = 0xffff; + for (int i = offset; i < data.length; i++) { + byte b = data[i]; + crc = ((crc >> 4) & 0x0fff) ^ CRC_TBL[((crc ^ b) & 15)]; + b >>= 4; + crc = ((crc >> 4) & 0x0fff) ^ CRC_TBL[((crc ^ b) & 15)]; + } + return ~crc & 0xffff; + } + + static byte[] uncompress(ByteBuffer compressed) throws DataFormatException { + if (compressed.remaining() <= SIZE_LENGTH) { + throw new DataFormatException("Invalid compressed data size"); + } + Inflater inflater = new Inflater(); + + // The first 4 bytes of the input is an integer encoding the size of the uncompressed data + int expectedSize = compressed.getInt(); + + // Check the maximum data that we are willing to handle + if (expectedSize > MAX_TX_DATA * 2) { + throw new DataFormatException("Maximum data size exceeded"); + } + + // Ignore the size bytes when uncompressing + inflater.setInput(compressed.array(), compressed.position(), compressed.remaining()); + byte[] buffer = new byte[expectedSize]; + int size = inflater.inflate(buffer); + + // Check that the uncompressed size matches the expected size + if (expectedSize != size) throw new DataFormatException("Unexpected data size"); + if (!inflater.finished()) throw new DataFormatException("Data larger than expected"); + + return buffer; + } + + static String decrypt(long key, String fullMessage) throws DataFormatException { + byte[] bytes = decryptBytes(key, Base64.decode(fullMessage)); + return new String(bytes); + } + + static byte[] decryptBytes(long key, byte[] data) throws DataFormatException { + byte[] m_keyParts = makeKey(key); + byte version = data[0]; + + if (version != 3) { //we only work with version 3 + throw new IllegalArgumentException("Invalid version or not a cyphertext."); + } + + byte flags = data[1]; + ByteBuffer buffer = ByteBuffer.wrap(Arrays.copyOfRange(data, 2, data.length)); + + byte lastByte = 0; + while (buffer.hasRemaining()) { + int pos = buffer.position(); + byte curByte = buffer.get(); + buffer.position(pos); + buffer.put((byte)(curByte ^ lastByte ^ m_keyParts[pos % 8])); + lastByte = curByte; + } + buffer.rewind(); + //chop off the random number at the start + buffer.get(); + + boolean integrityOk = true; + if (CryptoFlag.CryptoFlagChecksum.isSet(flags)) { + int storedChecksum = buffer.getShort() & 0xffff; + int checksum = checksum(buffer.array(), buffer.position()); + integrityOk = (checksum == storedChecksum); + } else if (CryptoFlag.CryptoFlagHash.isSet(flags)) { + throw new RuntimeException("Not implemented"); + } + + if (!integrityOk) throw new DataFormatException("Integrity failed"); + + if (CryptoFlag.CryptoFlagCompression.isSet(flags)) { + return uncompress(buffer); + } else { + return Arrays.copyOfRange(buffer.array(), buffer.position(), buffer.array().length); + } + } + + private static byte[] makeKey(long key) { + byte[] m_keyParts = new byte[8]; + for (int i=0;i<8;i++) { + long part = key; + for (int j=i; j>0; j--) + part = part >> 8; + part = part & 0xff; + m_keyParts[i] = (byte) part; + } + return m_keyParts; + } + + enum CryptoFlag { + CryptoFlagNone((byte)0), + CryptoFlagCompression((byte)0x01), + CryptoFlagChecksum((byte)0x02), + CryptoFlagHash((byte)0x04); + + private final byte flag; + + CryptoFlag(byte b) { + flag = b; + } + + public boolean isSet(byte flags) { + return (flags & flag) == flag; + } + } + + static final int[] CRC_TBL = { + 0x0000, 0x1081, 0x2102, 0x3183, + 0x4204, 0x5285, 0x6306, 0x7387, + 0x8408, 0x9489, 0xa50a, 0xb58b, + 0xc60c, 0xd68d, 0xe70e, 0xf78f + }; + + public static class VpncoinMessageFactory implements MessageFactory { + @Override + public int maxMessageSizeBytes() { + return MAX_TX_DATA_MSG; + } + + @Override + public boolean canHandlePublicMessages() { + return true; + } + + @Override + public boolean canHandlePrivateMessages() { + return false; + } + + @Override + public TxMessage createPublicMessage(String message) { + return create(message); + } + + @Override + @Nullable + public TxMessage extractPublicMessage(AbstractTransaction transaction) { + return parse(transaction); + } + } +} \ No newline at end of file diff --git a/core/src/main/java/com/vergepay/stratumj/ServerAddress.java b/core/src/main/java/com/verge/stratumj/ServerAddress.java similarity index 100% rename from core/src/main/java/com/vergepay/stratumj/ServerAddress.java rename to core/src/main/java/com/verge/stratumj/ServerAddress.java diff --git a/core/src/main/java/com/vergepay/stratumj/StratumClient.java b/core/src/main/java/com/verge/stratumj/StratumClient.java similarity index 100% rename from core/src/main/java/com/vergepay/stratumj/StratumClient.java rename to core/src/main/java/com/verge/stratumj/StratumClient.java diff --git a/core/src/main/java/com/vergepay/stratumj/messages/BaseMessage.java b/core/src/main/java/com/verge/stratumj/messages/BaseMessage.java similarity index 100% rename from core/src/main/java/com/vergepay/stratumj/messages/BaseMessage.java rename to core/src/main/java/com/verge/stratumj/messages/BaseMessage.java diff --git a/core/src/main/java/com/vergepay/stratumj/messages/CallMessage.java b/core/src/main/java/com/verge/stratumj/messages/CallMessage.java similarity index 100% rename from core/src/main/java/com/vergepay/stratumj/messages/CallMessage.java rename to core/src/main/java/com/verge/stratumj/messages/CallMessage.java diff --git a/core/src/main/java/com/vergepay/stratumj/messages/MessageException.java b/core/src/main/java/com/verge/stratumj/messages/MessageException.java similarity index 100% rename from core/src/main/java/com/vergepay/stratumj/messages/MessageException.java rename to core/src/main/java/com/verge/stratumj/messages/MessageException.java diff --git a/core/src/main/java/com/vergepay/stratumj/messages/ResultMessage.java b/core/src/main/java/com/verge/stratumj/messages/ResultMessage.java similarity index 100% rename from core/src/main/java/com/vergepay/stratumj/messages/ResultMessage.java rename to core/src/main/java/com/verge/stratumj/messages/ResultMessage.java diff --git a/core/src/test/java/com/vergepay/core/coins/ValueTest.java b/core/src/test/java/com/coinomi/core/coins/ValueTest.java similarity index 92% rename from core/src/test/java/com/vergepay/core/coins/ValueTest.java rename to core/src/test/java/com/coinomi/core/coins/ValueTest.java index c0ebfe5..69fd637 100644 --- a/core/src/test/java/com/vergepay/core/coins/ValueTest.java +++ b/core/src/test/java/com/coinomi/core/coins/ValueTest.java @@ -36,10 +36,11 @@ public class ValueTest { final CoinType BTC = BitcoinMain.get(); final CoinType LTC = LitecoinMain.get(); - final CoinType XVG = VergeMain.get(); + final CoinType PPC = PeercoinMain.get(); + final CoinType NBT = NuBitsMain.get(); final FiatType USD = FiatType.get("USD"); - ValueType[] types = {BTC, LTC, USD}; + ValueType[] types = {BTC, LTC, NBT, USD}; @Test public void parseCoin() { @@ -51,8 +52,12 @@ public void parseCoin() { assertEquals(133700, BTC.value("0.001337").value); // Peercoin family - assertEquals(1337000, XVG.value("1.337").value); - assertEquals(1337, XVG.value("0.001337").value); + assertEquals(1337000, PPC.value("1.337").value); + assertEquals(1337, PPC.value("0.001337").value); + + // NuBits family + assertEquals(13370, NBT.value("1.337").value); + assertEquals(13, NBT.value("0.0013").value); } @Test(expected = ArithmeticException.class) @@ -61,8 +66,8 @@ public void parseCoinErrorBitcoin() { } @Test(expected = ArithmeticException.class) - public void parseCoinErrorVerge() { - XVG.value("3.14159265"); + public void parseCoinErrorPeercoin() { + PPC.value("3.14159265"); } @Test @@ -156,7 +161,7 @@ public void testEquals() { Value btcSatoshi2 = Value.valueOf(BitcoinMain.get(), 1); Value btcValue = Value.parse(BitcoinMain.get(), "3.14159"); Value ltcSatoshi = Value.valueOf(LitecoinMain.get(), 1); - Value ppcValue = Value.parse(VergeMain.get(), "3.14159"); + Value ppcValue = Value.parse(PeercoinMain.get(), "3.14159"); assertTrue(btcSatoshi.equals(btcSatoshi2)); assertFalse(btcSatoshi.equals(ltcSatoshi)); @@ -189,8 +194,8 @@ public void testMathOperators() { assertEquals(LTC.value("1"), LTC.value("100").subtract(LTC.value("99"))); assertEquals(LTC.value("1"), LTC.value("100").subtract("99")); assertEquals(100L, USD.value("100").divide(USD.value("1"))); - assertArrayEquals(new Value[]{XVG.value("0.0001"), XVG.value("0.0002")}, - XVG.value("0.0012").divideAndRemainder(10)); + assertArrayEquals(new Value[]{NBT.value("0.0001"), NBT.value("0.0002")}, + NBT.value("0.0012").divideAndRemainder(10)); // max assertEquals(BTC.value("10"), Value.max(BTC.value("1"), BTC.value("10"))); assertEquals(BTC.value("0.5"), Value.max(BTC.value("0.5"), BTC.value("-0.5"))); diff --git a/core/src/test/java/com/vergepay/core/coins/nxt/NxtFamilyTest.java b/core/src/test/java/com/coinomi/core/coins/nxt/NxtFamilyTest.java similarity index 100% rename from core/src/test/java/com/vergepay/core/coins/nxt/NxtFamilyTest.java rename to core/src/test/java/com/coinomi/core/coins/nxt/NxtFamilyTest.java diff --git a/core/src/test/java/com/coinomi/core/exchange/shapeshift/ExchangeRateTest.java b/core/src/test/java/com/coinomi/core/exchange/shapeshift/ExchangeRateTest.java new file mode 100644 index 0000000..8c90b37 --- /dev/null +++ b/core/src/test/java/com/coinomi/core/exchange/shapeshift/ExchangeRateTest.java @@ -0,0 +1,67 @@ +package com.vergepay.core.exchange.shapeshift; + +import com.vergepay.core.coins.BitcoinMain; +import com.vergepay.core.coins.CoinType; +import com.vergepay.core.coins.DogecoinMain; +import com.vergepay.core.coins.FiatValue; +import com.vergepay.core.coins.NuBitsMain; +import com.vergepay.core.exchange.shapeshift.data.ShapeShiftExchangeRate; +import com.vergepay.core.util.ExchangeRateBase; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * @author John L. Jegutanis + */ +public class ExchangeRateTest { + final CoinType BTC = BitcoinMain.get(); + final CoinType DOGE = DogecoinMain.get(); + final CoinType NBT = NuBitsMain.get(); + + + @Test + public void baseFee() { + ShapeShiftExchangeRate rate = new ShapeShiftExchangeRate(BTC, NBT, "100", "0.01"); + + assertEquals(BTC.value("1"), rate.value1); + assertEquals(NBT.value("100"), rate.value2); + assertEquals(NBT.value("0.01"), rate.minerFee); + + assertEquals(NBT.value("99.99"), rate.convert(BTC.oneCoin())); + assertEquals(BTC.value("1"), rate.convert(NBT.value("99.99"))); + + rate = new ShapeShiftExchangeRate(BTC.oneCoin(), + DOGE.value("1911057.69230769"), DOGE.value("1")); + assertEquals(BTC.value("1"), rate.value1); + assertEquals(DOGE.value("1911057.69230769"), rate.value2); + assertEquals(DOGE.value("1"), rate.minerFee); + assertEquals(BTC.value("0.00052379"), rate.convert(DOGE.value("1000"))); + + rate = new ShapeShiftExchangeRate(BTC.oneCoin(), + DOGE.value("1878207.54716981"), DOGE.value("1")); + assertEquals(BTC.value("1"), rate.value1); + assertEquals(DOGE.value("1878207.54716981"), rate.value2); + assertEquals(DOGE.value("1"), rate.minerFee); + assertEquals(BTC.value("0.00532476"), rate.convert(DOGE.value("10000"))); + } + + @Test + public void zeroValues() { + ShapeShiftExchangeRate rate = new ShapeShiftExchangeRate(BTC, NBT, "100", "0.01"); + assertEquals(BTC.value("0"), rate.convert(NBT.value("0"))); + assertEquals(NBT.value("0"), rate.convert(BTC.value("0"))); + } + + @Test + public void smallValues() { + ShapeShiftExchangeRate rate = new ShapeShiftExchangeRate(DOGE, BTC, "5.1e-7", "0.0001"); + assertEquals(BTC.value("0"), rate.convert(DOGE.value("1"))); + } + + @Test(expected = IllegalArgumentException.class) + public void zeroExchangeRate() throws Exception { + new ShapeShiftExchangeRate(BTC, NBT, "0", "0.01"); + } +} \ No newline at end of file diff --git a/core/src/test/java/com/vergepay/core/exchange/shapeshift/MessagesTest.java b/core/src/test/java/com/coinomi/core/exchange/shapeshift/MessagesTest.java similarity index 93% rename from core/src/test/java/com/vergepay/core/exchange/shapeshift/MessagesTest.java rename to core/src/test/java/com/coinomi/core/exchange/shapeshift/MessagesTest.java index 172a3a2..6287b71 100644 --- a/core/src/test/java/com/vergepay/core/exchange/shapeshift/MessagesTest.java +++ b/core/src/test/java/com/coinomi/core/exchange/shapeshift/MessagesTest.java @@ -2,7 +2,10 @@ import com.vergepay.core.coins.BitcoinMain; import com.vergepay.core.coins.CoinType; +import com.vergepay.core.coins.DogecoinMain; import com.vergepay.core.coins.LitecoinMain; +import com.vergepay.core.coins.NuBitsMain; +import com.vergepay.core.coins.PeercoinMain; import com.vergepay.core.coins.Value; import com.vergepay.core.exchange.shapeshift.data.ShapeShiftAmountTx; import com.vergepay.core.exchange.shapeshift.data.ShapeShiftCoin; @@ -29,6 +32,9 @@ public class MessagesTest { final CoinType BTC = BitcoinMain.get(); final CoinType LTC = LitecoinMain.get(); + final CoinType DOGE = DogecoinMain.get(); + final CoinType NBT = NuBitsMain.get(); + final CoinType PPC = PeercoinMain.get(); final Value ONE_BTC = BTC.oneCoin(); @Test @@ -107,11 +113,14 @@ public void testMarketInfo() throws JSONException, ShapeShiftException { assertEquals("btc_nbt", marketInfo.pair); assertTrue(marketInfo.isPair("BTC_NBT")); assertTrue(marketInfo.isPair("btc_nbt")); + assertTrue(marketInfo.isPair(BTC, NBT)); assertFalse(marketInfo.isPair("doge_ltc")); + assertFalse(marketInfo.isPair(DOGE, LTC)); assertNotNull(marketInfo.rate); assertNotNull(marketInfo.limit); assertNotNull(marketInfo.minimum); + assertEquals(NBT.value("99.99"), marketInfo.rate.convert(BTC.value("1"))); assertEquals(BTC.value("4"), marketInfo.limit); assertEquals(BTC.value("0.00000104"), marketInfo.minimum); } @@ -126,7 +135,9 @@ public void testMarketInfo2() throws JSONException, ShapeShiftException { "limit: 2162.11925969,\n" + "minimum: 0.17391304\n" + "}")); - assertEquals(BTC.value("0.00098678").subtract("0.0001"), info.rate.convert(LTC.value("1"))); + assertEquals(BTC.value("0.00098678").subtract("0.0001"), info.rate.convert(PPC.value("1"))); + assertEquals(PPC.value("2162.119259"), info.limit); + assertEquals(PPC.value("0.173914"), info.minimum); info = new ShapeShiftMarketInfo(new JSONObject( "{\n" + @@ -136,6 +147,7 @@ public void testMarketInfo2() throws JSONException, ShapeShiftException { "limit: 1.1185671,\n" + "minimum: 0.0000198\n" + "}")); + assertEquals(PPC.value("866.739130").subtract("0.01"), info.rate.convert(BTC.value("1"))); assertEquals(BTC.value("1.1185671"), info.limit); assertEquals(BTC.value("0.0000198"), info.minimum); @@ -147,6 +159,7 @@ public void testMarketInfo2() throws JSONException, ShapeShiftException { "limit: 3.70968678,\n" + "minimum: 0.00008692\n" + "}")); + assertEquals(NBT.value("226.3957").subtract("0.01"), info.rate.convert(BTC.value("1"))); assertEquals(BTC.value("3.70968678"), info.limit); assertEquals(BTC.value("0.00008692"), info.minimum); @@ -158,7 +171,9 @@ public void testMarketInfo2() throws JSONException, ShapeShiftException { "limit: 1021.50337123,\n" + "minimum: 0.04542677\n" + "}")); - assertEquals(BTC.value("0.00433171").subtract("0.0001"), info.rate.convert(LTC.value("1"))); + assertEquals(BTC.value("0.00433171").subtract("0.0001"), info.rate.convert(NBT.value("1"))); + assertEquals(NBT.value("1021.5033"), info.limit); + assertEquals(NBT.value("0.0455"), info.minimum); } @Test @@ -193,8 +208,8 @@ public void testRateWithoutMinerFee2() throws JSONException, ShapeShiftException assertEquals("btc_nbt", rate.pair); assertNotNull(rate.rate); - assertEquals(LTC, rate.rate.convert(ONE_BTC).type); - assertEquals(BTC, rate.rate.convert(LTC.oneCoin()).type); + assertEquals(NBT, rate.rate.convert(ONE_BTC).type); + assertEquals(BTC, rate.rate.convert(NBT.oneCoin()).type); } @Test @@ -211,8 +226,8 @@ public void testRateWithMinerFee() throws JSONException, ShapeShiftException { assertEquals("btc_nbt", rate.pair); assertNotNull(rate.rate); - assertEquals(LTC.value("99.99"), rate.rate.convert(BTC.value("1"))); - assertEquals(BTC.value("1"), rate.rate.convert(LTC.value("99.99"))); + assertEquals(NBT.value("99.99"), rate.rate.convert(BTC.value("1"))); + assertEquals(BTC.value("1"), rate.rate.convert(NBT.value("99.99"))); } @Test @@ -249,8 +264,8 @@ public void testLimit2() throws JSONException, ShapeShiftException { assertNotNull(limit.limit); assertNotNull(limit.minimum); - assertEquals(LTC.value("1015.1535"), limit.limit); - assertEquals(LTC.value("0.0532"), limit.minimum); + assertEquals(NBT.value("1015.1535"), limit.limit); + assertEquals(NBT.value("0.0532"), limit.minimum); } @Test @@ -368,9 +383,9 @@ public void testTxStatus3Alt() throws JSONException, ShapeShiftException { assertEquals("1NDQPAGamGePkSZXW2CYBzXJEefB7N4bTN", txStatus.address.toString()); assertEquals(BTC, txStatus.address.getType()); assertEquals("BB6kZZi87mCd7mC1tWWJjuKGPTYQ1n2Fcg", txStatus.withdraw.toString()); - assertEquals(LTC, txStatus.withdraw.getType()); + assertEquals(NBT, txStatus.withdraw.getType()); assertEquals(BTC.value("0.01"), txStatus.incomingValue); - assertEquals(LTC.value("2.33"), txStatus.outgoingValue); + assertEquals(NBT.value("2.33"), txStatus.outgoingValue); assertEquals("66fa0b4c11227f9f05efa13d23e58c65b50acbd6395a126b5cd751064e6e79df", txStatus.transactionId); } @@ -425,7 +440,7 @@ public void testNormalTx() throws JSONException, ShapeShiftException { assertEquals("18ETaXCYhJ8sxurh41vpKC3E6Tu7oJ94q8", normalTx.deposit.toString()); assertEquals(BTC, normalTx.deposit.getType()); assertEquals("DMHLQYG4j96V8cZX9WSuXxLs5RnZn6ibrV", normalTx.withdrawal.toString()); - assertEquals(LTC, normalTx.withdrawal.getType()); + assertEquals(DOGE, normalTx.withdrawal.getType()); } @Test @@ -450,10 +465,10 @@ public void testAmountTxWithoutMinerFee() throws JSONException, ShapeShiftExcept assertEquals(BTC, amountTx.deposit.getType()); assertEquals(BTC.value("0.00052327"), amountTx.depositAmount); assertEquals("DMHLQYG4j96V8cZX9WSuXxLs5RnZn6ibrV", amountTx.withdrawal.toString()); - assertEquals(LTC, amountTx.withdrawal.getType()); - assertEquals(LTC.value("1000"), amountTx.withdrawalAmount); + assertEquals(DOGE, amountTx.withdrawal.getType()); + assertEquals(DOGE.value("1000"), amountTx.withdrawalAmount); assertEquals(1427149038191L, amountTx.expiration.getTime()); - assertEquals(BTC.value("0.00052327"), amountTx.rate.convert(Value.parse(LTC, "1000"))); + assertEquals(BTC.value("0.00052327"), amountTx.rate.convert(Value.parse(DOGE, "1000"))); } @Test @@ -479,10 +494,10 @@ public void testAmountTxWithMinerFee() throws JSONException, ShapeShiftException assertEquals(BTC, amountTx.deposit.getType()); assertEquals(BTC.value("0.00052379"), amountTx.depositAmount); assertEquals("DMHLQYG4j96V8cZX9WSuXxLs5RnZn6ibrV", amountTx.withdrawal.toString()); - assertEquals(LTC, amountTx.withdrawal.getType()); - assertEquals(LTC.value("1000"), amountTx.withdrawalAmount); + assertEquals(DOGE, amountTx.withdrawal.getType()); + assertEquals(DOGE.value("1000"), amountTx.withdrawalAmount); assertEquals(1427149038191L, amountTx.expiration.getTime()); - assertEquals(BTC.value("0.00052379"), amountTx.rate.convert(Value.parse(LTC, "1000"))); + assertEquals(BTC.value("0.00052379"), amountTx.rate.convert(Value.parse(DOGE, "1000"))); } @Test diff --git a/core/src/test/java/com/vergepay/core/exchange/shapeshift/ServerTest.java b/core/src/test/java/com/coinomi/core/exchange/shapeshift/ServerTest.java similarity index 86% rename from core/src/test/java/com/vergepay/core/exchange/shapeshift/ServerTest.java rename to core/src/test/java/com/coinomi/core/exchange/shapeshift/ServerTest.java index ab01190..3772468 100644 --- a/core/src/test/java/com/vergepay/core/exchange/shapeshift/ServerTest.java +++ b/core/src/test/java/com/coinomi/core/exchange/shapeshift/ServerTest.java @@ -2,7 +2,9 @@ import com.vergepay.core.coins.BitcoinMain; import com.vergepay.core.coins.CoinType; +import com.vergepay.core.coins.DogecoinMain; import com.vergepay.core.coins.LitecoinMain; +import com.vergepay.core.coins.NuBitsMain; import com.vergepay.core.coins.Value; import com.vergepay.core.exceptions.AddressMalformedException; import com.vergepay.core.exchange.shapeshift.data.ShapeShiftAmountTx; @@ -41,6 +43,9 @@ public class ServerTest { final CoinType BTC = BitcoinMain.get(); final CoinType LTC = LitecoinMain.get(); + final CoinType DOGE = DogecoinMain.get(); + final CoinType NBT = NuBitsMain.get(); + private MockWebServer server; private ShapeShift shapeShift; @@ -88,7 +93,7 @@ public void testGetMarketInfo() throws ShapeShiftException, IOException, Interru // Schedule some responses. server.enqueue(new MockResponse().setBody(MARKET_INFO_BTC_NBT_JSON)); - ShapeShiftMarketInfo marketInfoReply = shapeShift.getMarketInfo(BTC, LTC); + ShapeShiftMarketInfo marketInfoReply = shapeShift.getMarketInfo(BTC, NBT); assertFalse(marketInfoReply.isError); assertEquals("btc_nbt", marketInfoReply.pair); assertNotNull(marketInfoReply.rate); @@ -97,7 +102,7 @@ public void testGetMarketInfo() throws ShapeShiftException, IOException, Interru assertNotNull(marketInfoReply.limit); assertNotNull(marketInfoReply.minimum); - assertEquals(LTC.value("99.99"), marketInfoReply.rate.convert(BTC.value("1"))); + assertEquals(NBT.value("99.99"), marketInfoReply.rate.convert(BTC.value("1"))); assertEquals(BTC.value("4"), marketInfoReply.limit); assertEquals(BTC.value("0.00000104"), marketInfoReply.minimum); @@ -148,7 +153,7 @@ public void testGetTime() throws ShapeShiftException, IOException, InterruptedEx server.enqueue(new MockResponse().setBody(GET_TIME_PENDING_JSON)); server.enqueue(new MockResponse().setBody(GET_TIME_EXPIRED_JSON)); - AbstractAddress address = LitecoinMain.get().newAddress("BPjxHqswNZB5vznbrAAxi5zGVq3ruhtBU8"); + AbstractAddress address = NuBitsMain.get().newAddress("BPjxHqswNZB5vznbrAAxi5zGVq3ruhtBU8"); ShapeShiftTime timeReply = shapeShift.getTime(address); assertFalse(timeReply.isError); @@ -228,7 +233,7 @@ public void testNormalTransaction() throws ShapeShiftException, IOException, Int // Schedule some responses. server.enqueue(new MockResponse().setBody(NORMAL_TRANSACTION_JSON)); - AbstractAddress withdrawal = LTC.newAddress("DMHLQYG4j96V8cZX9WSuXxLs5RnZn6ibrV"); + AbstractAddress withdrawal = DOGE.newAddress("DMHLQYG4j96V8cZX9WSuXxLs5RnZn6ibrV"); AbstractAddress refund = BTC.newAddress("1Nz4xHJjNCnZFPjRUq8CN4BZEXTgLZfeUW"); ShapeShiftNormalTx normalTxReply = shapeShift.exchange(withdrawal, refund); assertFalse(normalTxReply.isError); @@ -236,7 +241,7 @@ public void testNormalTransaction() throws ShapeShiftException, IOException, Int assertEquals("18ETaXCYhJ8sxurh41vpKC3E6Tu7oJ94q8", normalTxReply.deposit.toString()); assertEquals(BTC, normalTxReply.deposit.getType()); assertEquals(withdrawal.toString(), normalTxReply.withdrawal.toString()); - assertEquals(LTC, normalTxReply.withdrawal.getType()); + assertEquals(DOGE, normalTxReply.withdrawal.getType()); // Optional: confirm that your app made the HTTP requests you were expecting. RecordedRequest request = server.takeRequest(); @@ -254,9 +259,9 @@ public void testFixedAmountTransaction() throws ShapeShiftException, IOException // Schedule some responses. server.enqueue(new MockResponse().setBody(FIXED_AMOUNT_TRANSACTION_JSON)); - AbstractAddress withdrawal = LTC.newAddress("DMHLQYG4j96V8cZX9WSuXxLs5RnZn6ibrV"); + AbstractAddress withdrawal = DOGE.newAddress("DMHLQYG4j96V8cZX9WSuXxLs5RnZn6ibrV"); AbstractAddress refund = BTC.newAddress("1Nz4xHJjNCnZFPjRUq8CN4BZEXTgLZfeUW"); - Value amount = LTC.value("1000"); + Value amount = DOGE.value("1000"); ShapeShiftAmountTx amountTxReply = shapeShift.exchangeForAmount(amount, withdrawal, refund); assertFalse(amountTxReply.isError); assertEquals("btc_doge", amountTxReply.pair); @@ -267,12 +272,12 @@ public void testFixedAmountTransaction() throws ShapeShiftException, IOException assertEquals(BTC, amountTxReply.depositAmount.type); assertEquals(withdrawal.toString(), amountTxReply.withdrawal.toString()); - assertEquals(LTC, amountTxReply.withdrawal.getType()); + assertEquals(DOGE, amountTxReply.withdrawal.getType()); assertEquals(amount.toPlainString(), amountTxReply.withdrawalAmount.toPlainString()); - assertEquals(LTC, amountTxReply.withdrawalAmount.type); + assertEquals(DOGE, amountTxReply.withdrawalAmount.type); assertEquals(1427149038191L, amountTxReply.expiration.getTime()); - assertEquals(BTC.value(".00052379"), amountTxReply.rate.convert(Value.parse(LTC, "1000"))); + assertEquals(BTC.value(".00052379"), amountTxReply.rate.convert(Value.parse(DOGE, "1000"))); // Optional: confirm that your app made the HTTP requests you were expecting. RecordedRequest request = server.takeRequest(); @@ -331,7 +336,14 @@ public void testGetMarketInfoFail() throws ShapeShiftException, IOException { public void testGetRateFail() throws ShapeShiftException, IOException { server.enqueue(new MockResponse().setBody(GET_RATE_BTC_LTC_JSON)); // Incorrect pair - shapeShift.getRate(BTC, LTC); + shapeShift.getRate(NBT, LTC); + } + + @Test(expected = ShapeShiftException.class) + public void testGetLimitFail() throws ShapeShiftException, IOException { + server.enqueue(new MockResponse().setBody(GET_LIMIT_BTC_LTC_JSON)); + // Incorrect pair + shapeShift.getLimit(LTC, DOGE); } @Test(expected = ShapeShiftException.class) @@ -341,6 +353,44 @@ public void testGetTxStatusFail() throws ShapeShiftException, AddressMalformedEx shapeShift.getTxStatus(BTC.newAddress("18ETaXCYhJ8sxurh41vpKC3E6Tu7oJ94q8")); } + @Test(expected = ShapeShiftException.class) + public void testNormalTransactionFail() throws ShapeShiftException, AddressMalformedException, IOException { + server.enqueue(new MockResponse().setBody(NORMAL_TRANSACTION_JSON)); + // Incorrect Dogecoin address, correct is DMHLQYG4j96V8cZX9WSuXxLs5RnZn6ibrV + shapeShift.exchange(DOGE.newAddress("DSntbp199h851m3Y1g3ruYCQHzWYCZQmmA"), + BTC.newAddress("1Nz4xHJjNCnZFPjRUq8CN4BZEXTgLZfeUW")); + } + + @Test(expected = ShapeShiftException.class) + public void testFixedAmountTransactionFail() + throws ShapeShiftException, AddressMalformedException, IOException { + server.enqueue(new MockResponse().setBody(FIXED_AMOUNT_TRANSACTION_JSON)); + // We withdraw Dogecoins to a Bitcoin address + shapeShift.exchangeForAmount(DOGE.value("1000"), + BTC.newAddress("18ETaXCYhJ8sxurh41vpKC3E6Tu7oJ94q8"), + BTC.newAddress("1Nz4xHJjNCnZFPjRUq8CN4BZEXTgLZfeUW")); + } + + @Test(expected = ShapeShiftException.class) + public void testFixedAmountTransactionFail2() + throws ShapeShiftException, AddressMalformedException, IOException { + server.enqueue(new MockResponse().setBody(FIXED_AMOUNT_TRANSACTION_JSON)); + // Incorrect Dogecoin address, correct is DMHLQYG4j96V8cZX9WSuXxLs5RnZn6ibrV + shapeShift.exchangeForAmount(DOGE.value("1000"), + DOGE.newAddress("DSntbp199h851m3Y1g3ruYCQHzWYCZQmmA"), + BTC.newAddress("1Nz4xHJjNCnZFPjRUq8CN4BZEXTgLZfeUW")); + } + + @Test(expected = ShapeShiftException.class) + public void testFixedAmountTransactionFail3() + throws ShapeShiftException, AddressMalformedException, IOException { + server.enqueue(new MockResponse().setBody(FIXED_AMOUNT_TRANSACTION_JSON)); + // Incorrect amount, correct is 1000 + shapeShift.exchangeForAmount(DOGE.value("1"), + DOGE.newAddress("DMHLQYG4j96V8cZX9WSuXxLs5RnZn6ibrV"), + BTC.newAddress("1Nz4xHJjNCnZFPjRUq8CN4BZEXTgLZfeUW")); + } + public static final String GET_COINS_JSON = "{" + "BTC: {" + diff --git a/core/src/test/java/com/vergepay/core/uri/CoinURITest.java b/core/src/test/java/com/coinomi/core/uri/CoinURITest.java similarity index 95% rename from core/src/test/java/com/vergepay/core/uri/CoinURITest.java rename to core/src/test/java/com/coinomi/core/uri/CoinURITest.java index ebff193..61e58db 100644 --- a/core/src/test/java/com/vergepay/core/uri/CoinURITest.java +++ b/core/src/test/java/com/coinomi/core/uri/CoinURITest.java @@ -22,6 +22,7 @@ import com.vergepay.core.coins.BitcoinTest; import com.vergepay.core.coins.CoinType; import com.vergepay.core.coins.LitecoinMain; +import com.vergepay.core.coins.PeercoinMain; import com.vergepay.core.util.GenericUtils; import com.vergepay.core.wallet.families.bitcoin.BitAddress; import com.vergepay.core.wallet.families.nxt.NxtAddress; @@ -94,6 +95,12 @@ public void testAltChainsConvertToCoinURI() throws Exception { goodAddress = BitAddress.from(LTC, hash160); goodAddressStr = goodAddress.toString(); assertEquals("litecoin:" + goodAddressStr + "?amount=12.34&label=Hello&message=AMessage", CoinURI.convertToCoinURI(goodAddress, LTC.value("12.34"), "Hello", "AMessage")); + + + // Peercoin + goodAddress = BitAddress.from(PPC, hash160); + goodAddressStr = goodAddress.toString(); + assertEquals("peercoin:" + goodAddressStr + "?amount=12.34&label=Hello&message=AMessage", CoinURI.convertToCoinURI(goodAddress, PPC.value("12.34"), "Hello", "AMessage")); } @Test @@ -124,6 +131,18 @@ public void testAltChainsGoodAmount() throws Exception { goodAddressStr = goodAddress.toString(); testObject = new CoinURI(LTC, "litecoin:" + goodAddressStr + "?amount=12.34"); assertEquals("12.34", GenericUtils.formatCoinValue(LTC, testObject.getAmount())); + + // Dogecoin + goodAddress = BitAddress.from(DOGE, hash160); + goodAddressStr = goodAddress.toString(); + testObject = new CoinURI(DOGE, "dogecoin:" + goodAddressStr + "?amount=12.34"); + assertEquals("12.34", GenericUtils.formatCoinValue(DOGE, testObject.getAmount())); + + // Peercoin + goodAddress = BitAddress.from(PPC, hash160); + goodAddressStr = goodAddress.toString(); + testObject = new CoinURI(PPC, "peercoin:" + goodAddressStr + "?amount=12.34"); + assertEquals("12.34", GenericUtils.formatCoinValue(PPC, testObject.getAmount())); } @Test diff --git a/core/src/test/java/com/vergepay/core/util/ExchangeRateTest.java b/core/src/test/java/com/coinomi/core/util/ExchangeRateTest.java similarity index 90% rename from core/src/test/java/com/vergepay/core/util/ExchangeRateTest.java rename to core/src/test/java/com/coinomi/core/util/ExchangeRateTest.java index 8b55838..52cb7a8 100644 --- a/core/src/test/java/com/vergepay/core/util/ExchangeRateTest.java +++ b/core/src/test/java/com/coinomi/core/util/ExchangeRateTest.java @@ -22,6 +22,7 @@ import com.vergepay.core.coins.FiatType; import com.vergepay.core.coins.FiatValue; import com.vergepay.core.coins.LitecoinMain; +import com.vergepay.core.coins.NuBitsMain; import com.vergepay.core.coins.Value; import org.junit.Test; @@ -33,9 +34,9 @@ public class ExchangeRateTest { final CoinType BTC = BitcoinMain.get(); final CoinType LTC = LitecoinMain.get(); - final CoinType XVG = LitecoinMain.get(); + final CoinType NBT = NuBitsMain.get(); final Value oneBtc = BTC.oneCoin(); - final Value oneXvg = XVG.oneCoin(); + final Value oneNbt = NBT.oneCoin(); @Test public void getOtherType() throws Exception { @@ -47,10 +48,10 @@ public void getOtherType() throws Exception { @Test public void canConvert() throws Exception { - ExchangeRateBase rate = new ExchangeRateBase(oneBtc, oneXvg); + ExchangeRateBase rate = new ExchangeRateBase(oneBtc, oneNbt); - assertTrue(rate.canConvert(BTC, XVG)); - assertTrue(rate.canConvert(XVG, BTC)); + assertTrue(rate.canConvert(BTC, NBT)); + assertTrue(rate.canConvert(NBT, BTC)); assertFalse(rate.canConvert(LTC, BTC)); assertFalse(rate.canConvert(LTC, FiatType.get("USD"))); } @@ -78,8 +79,8 @@ public void cryptoToCryptoRate() throws Exception { assertEquals("0.01", rate.convert(LTC.oneCoin()).toPlainString()); // 250NBT = 1BTC - rate = new ExchangeRateBase(oneXvg.multiply(250), oneBtc); - assertEquals("0.004", rate.convert(oneXvg).toPlainString()); + rate = new ExchangeRateBase(oneNbt.multiply(250), oneBtc); + assertEquals("0.004", rate.convert(oneNbt).toPlainString()); assertEquals("2500", rate.convert(oneBtc.multiply(10)).toPlainString()); } @@ -99,23 +100,23 @@ public void cryptoToCryptoRateParseConstructor() throws Exception { public void scalingAndRounding() throws Exception { // 1BTC = 100.1234567890NBT // This rate causes the BTC & NBT to overflow so it sets the correct scale and rounding - ExchangeRateBase rate = new ExchangeRateBase(BTC, XVG, "100.1234567890"); + ExchangeRateBase rate = new ExchangeRateBase(BTC, NBT, "100.1234567890"); // Check the rate's internal state assertEquals("100000", rate.value1.toPlainString()); assertEquals("10012345.6789", rate.value2.toPlainString()); // Make some conversions - assertEquals("0.00998767", rate.convert(oneXvg).toPlainString()); - assertEquals("0.000001", rate.convert(Value.parse(XVG, "0.0001")).toPlainString()); + assertEquals("0.00998767", rate.convert(oneNbt).toPlainString()); + assertEquals("0.000001", rate.convert(Value.parse(NBT, "0.0001")).toPlainString()); assertEquals("0.0001", rate.convert(Value.parse(BTC, "0.00000099")).toPlainString()); assertEquals("0.0099", rate.convert(Value.parse(BTC, "0.000099")).toPlainString()); assertEquals("10012345.6789", rate.convert(oneBtc.multiply(100000)).toPlainString()); assertEquals("1001.2346", rate.convert(oneBtc.multiply(10)).toPlainString()); - assertEquals("998766.95438852", rate.convert(oneXvg.multiply(100000000)).toPlainString()); + assertEquals("998766.95438852", rate.convert(oneNbt.multiply(100000000)).toPlainString()); // Check too precise rates - rate = new ExchangeRateBase(BTC, XVG, "100.12345678901999"); + rate = new ExchangeRateBase(BTC, NBT, "100.12345678901999"); assertEquals("100000", rate.value1.toPlainString()); assertEquals("10012345.6789", rate.value2.toPlainString()); } diff --git a/core/src/test/java/com/vergepay/core/util/GenericUtilsTests.java b/core/src/test/java/com/coinomi/core/util/GenericUtilsTests.java similarity index 86% rename from core/src/test/java/com/vergepay/core/util/GenericUtilsTests.java rename to core/src/test/java/com/coinomi/core/util/GenericUtilsTests.java index bc5bca0..e92bfd6 100644 --- a/core/src/test/java/com/vergepay/core/util/GenericUtilsTests.java +++ b/core/src/test/java/com/coinomi/core/util/GenericUtilsTests.java @@ -24,14 +24,25 @@ public class GenericUtilsTests { @Test public void getPossibleTypes() throws AddressMalformedException { List types = GenericUtils.getPossibleTypes("BPa5FmbZRGpmNfy4qaUzarXwSSFbJKFRMQ"); + assertTrue(types.contains(BlackcoinMain.get())); + assertTrue(types.contains(NuBitsMain.get())); assertTrue(GenericUtils.hasMultipleTypes("BPa5FmbZRGpmNfy4qaUzarXwSSFbJKFRMQ")); // Many coins share Bitcoin's multisig addresses... types = GenericUtils.getPossibleTypes("3Lp1ZbdoDfZF21BLMBpctM6CrM6j4t2JyU"); assertTrue(types.contains(BitcoinMain.get())); assertTrue(types.contains(LitecoinMain.get())); + assertTrue(types.contains(FeathercoinMain.get())); + assertTrue(types.contains(DigitalcoinMain.get())); assertTrue(GenericUtils.hasMultipleTypes("3Lp1ZbdoDfZF21BLMBpctM6CrM6j4t2JyU")); + // Address method + AbstractAddress address = BlackcoinMain.get().newAddress("BPa5FmbZRGpmNfy4qaUzarXwSSFbJKFRMQ"); + types = GenericUtils.getPossibleTypes(address); + assertTrue(types.contains(BlackcoinMain.get())); + assertTrue(types.contains(NuBitsMain.get())); + assertTrue(GenericUtils.hasMultipleTypes(address)); + // Classic Bitcoin addresses should have only one type types = GenericUtils.getPossibleTypes("1AjnxP4frz7Nb4v2soLnhN2uV9UocqvaGH"); assertTrue(types.contains(BitcoinMain.get())); diff --git a/core/src/test/java/com/vergepay/core/util/MonetaryFormatTest.java b/core/src/test/java/com/coinomi/core/util/MonetaryFormatTest.java similarity index 100% rename from core/src/test/java/com/vergepay/core/util/MonetaryFormatTest.java rename to core/src/test/java/com/coinomi/core/util/MonetaryFormatTest.java diff --git a/core/src/test/java/com/vergepay/core/wallet/SimpleHDKeyChainTest.java b/core/src/test/java/com/coinomi/core/wallet/SimpleHDKeyChainTest.java similarity index 100% rename from core/src/test/java/com/vergepay/core/wallet/SimpleHDKeyChainTest.java rename to core/src/test/java/com/coinomi/core/wallet/SimpleHDKeyChainTest.java diff --git a/core/src/test/java/com/vergepay/core/wallet/SweepWalletTest.java b/core/src/test/java/com/coinomi/core/wallet/SweepWalletTest.java similarity index 100% rename from core/src/test/java/com/vergepay/core/wallet/SweepWalletTest.java rename to core/src/test/java/com/coinomi/core/wallet/SweepWalletTest.java diff --git a/core/src/test/java/com/vergepay/core/wallet/WalletPocketHDTest.java b/core/src/test/java/com/coinomi/core/wallet/WalletPocketHDTest.java similarity index 83% rename from core/src/test/java/com/vergepay/core/wallet/WalletPocketHDTest.java rename to core/src/test/java/com/coinomi/core/wallet/WalletPocketHDTest.java index 3af9818..6c7a387 100644 --- a/core/src/test/java/com/vergepay/core/wallet/WalletPocketHDTest.java +++ b/core/src/test/java/com/coinomi/core/wallet/WalletPocketHDTest.java @@ -2,7 +2,10 @@ import com.vergepay.core.coins.BitcoinMain; import com.vergepay.core.coins.CoinType; +import com.vergepay.core.coins.DogecoinTest; +import com.vergepay.core.coins.NuBitsMain; import com.vergepay.core.coins.Value; +import com.vergepay.core.coins.VpncoinMain; import com.vergepay.core.exceptions.AddressMalformedException; import com.vergepay.core.exceptions.Bip44KeyLookAheadExceededException; import com.vergepay.core.exceptions.KeyIsEncryptedException; @@ -67,11 +70,14 @@ */ public class WalletPocketHDTest { static final CoinType BTC = BitcoinMain.get(); + static final CoinType DOGE = DogecoinTest.get(); + static final CoinType NBT = NuBitsMain.get(); + static final CoinType VPN = VpncoinMain.get(); static final List MNEMONIC = ImmutableList.of("citizen", "fever", "scale", "nurse", "brief", "round", "ski", "fiction", "car", "fitness", "pluck", "act"); static final byte[] AES_KEY_BYTES = {0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7}; static final long AMOUNT_TO_SEND = 2700000000L; static final String MESSAGE = "test"; - static final String MESSAGE_UNICODE = "test"; + static final String MESSAGE_UNICODE = "δοκιμή испытание 测试"; static final String EXPECTED_BITCOIN_SIG = "IMBbIFDDuUwomYlvSjwWytqP/CXYym2yOKbJUx8Y+ujzZKBwoCFMr73GUxpr1Ird/DvnNZcsQLphvx18ftqN54o="; static final String EXPECTED_BITCOIN_SIG_UNICODE = "IGGZEOBsVny5dozTOfc2/3UuvmZGdDI4XK/03HIk34PILd2oXbnq+87GINT3lumeXcgSO2NkGzUFcQ1SCSVI3Hk="; static final String EXPECTED_NUBITS_SIG = "IMuzNZTZIjZjLicyDFGzqFl21vqNBGW1N5m4qHBRqbTvLBbkQeGjraeLmZEt7mRH4MSMPLFXW2T3Maz+HYx1tEc="; @@ -80,11 +86,20 @@ public class WalletPocketHDTest { DeterministicSeed seed = new DeterministicSeed(MNEMONIC, null, "", 0); DeterministicKey masterKey = HDKeyDerivation.createMasterPrivateKey(checkNotNull(seed.getSeedBytes())); DeterministicHierarchy hierarchy = new DeterministicHierarchy(masterKey); + DeterministicKey rootKey = hierarchy.get(DOGE.getBip44Path(0), false, true); KeyParameter aesKey = new KeyParameter(AES_KEY_BYTES); KeyCrypter crypter = new KeyCrypterScrypt(); WalletPocketHD pocket; + @Before + public void setup() { + BriefLogFormatter.init(); + + pocket = new WalletPocketHD(rootKey, DOGE, null, null); + pocket.keys.setLookaheadSize(20); + } + @Test public void testId() throws Exception { assertEquals("8747886e9a77fe2a1588df3168b867648434d6d339b0b448793ae1db8f283f41", pocket.getId()); @@ -93,9 +108,9 @@ public void testId() throws Exception { @Test public void testSingleAddressWallet() throws Exception { ECKey key = pocket.keys.getCurrentUnusedKey(KeyChain.KeyPurpose.RECEIVE_FUNDS); - BitWalletSingleKey bitWalletSingleKey = new BitWalletSingleKey(BTC, key); - bitWalletSingleKey.onConnection(getBlockchainConnection(BTC)); - assertEquals(BTC.value("10"), bitWalletSingleKey.getBalance()); + BitWalletSingleKey bitWalletSingleKey = new BitWalletSingleKey(DOGE, key); + bitWalletSingleKey.onConnection(getBlockchainConnection(DOGE)); + assertEquals(DOGE.value("10"), bitWalletSingleKey.getBalance()); } @Test @@ -104,10 +119,65 @@ public void xpubWallet() { DeterministicKey key = DeterministicKey.deserializeB58(null, xpub); WalletPocketHD account = new WalletPocketHD(key, BTC, null, null); assertEquals("1KUDsEDqSBAgxubSEWszoA9xscNRRCmujM", account.getReceiveAddress().toString()); - account = new WalletPocketHD(key, BTC, null, null); + account = new WalletPocketHD(key, NBT, null, null); assertEquals("BNvJUwg3BgkbQk5br1CxvHxdcDp1EC3saE", account.getReceiveAddress().toString()); } + @Test + public void xpubWalletSerialized() throws Exception { + WalletPocketHD account = new WalletPocketHD(rootKey, BTC, null, null); + Protos.WalletPocket proto = account.toProtobuf(); + WalletPocketHD newAccount = new WalletPocketProtobufSerializer().readWallet(proto, null); + assertEquals(account.getPublicKeySerialized(), newAccount.getPublicKeySerialized()); + } + + @Test + public void signMessage() throws AddressMalformedException, MissingPrivateKeyException, KeyIsEncryptedException { + WalletPocketHD pocketHD = new WalletPocketHD(rootKey, BTC, null, null); + pocketHD.getReceiveAddress(); // Generate the first key + SignedMessage signedMessage = new SignedMessage("1KUDsEDqSBAgxubSEWszoA9xscNRRCmujM", MESSAGE); + pocketHD.signMessage(signedMessage, null); + assertEquals(EXPECTED_BITCOIN_SIG, signedMessage.getSignature()); + + signedMessage = new SignedMessage("1KUDsEDqSBAgxubSEWszoA9xscNRRCmujM", MESSAGE_UNICODE); + pocketHD.signMessage(signedMessage, null); + assertEquals(EXPECTED_BITCOIN_SIG_UNICODE, signedMessage.getSignature()); + + pocketHD = new WalletPocketHD(rootKey, NBT, null, null); + pocketHD.getReceiveAddress(); // Generate the first key + signedMessage = new SignedMessage("BNvJUwg3BgkbQk5br1CxvHxdcDp1EC3saE", MESSAGE); + pocketHD.signMessage(signedMessage, null); + assertEquals(EXPECTED_NUBITS_SIG, signedMessage.getSignature()); + + signedMessage = new SignedMessage("BNvJUwg3BgkbQk5br1CxvHxdcDp1EC3saE", MESSAGE_UNICODE); + pocketHD.signMessage(signedMessage, null); + assertEquals(EXPECTED_NUBITS_SIG_UNICODE, signedMessage.getSignature()); + } + + @Test + public void signMessageEncrypted() throws AddressMalformedException, MissingPrivateKeyException, KeyIsEncryptedException { + WalletPocketHD pocketHD = new WalletPocketHD(rootKey, BTC, null, null); + pocketHD.getReceiveAddress(); // Generate the first key + pocketHD.encrypt(crypter, aesKey); + SignedMessage signedMessage = new SignedMessage("1KUDsEDqSBAgxubSEWszoA9xscNRRCmujM", MESSAGE); + pocketHD.signMessage(signedMessage, aesKey); + assertEquals(EXPECTED_BITCOIN_SIG, signedMessage.getSignature()); + + signedMessage = new SignedMessage("1KUDsEDqSBAgxubSEWszoA9xscNRRCmujM", MESSAGE_UNICODE); + pocketHD.signMessage(signedMessage, aesKey); + assertEquals(EXPECTED_BITCOIN_SIG_UNICODE, signedMessage.getSignature()); + } + + @Test + public void signMessageEncryptedFailed() throws AddressMalformedException, MissingPrivateKeyException, KeyIsEncryptedException { + WalletPocketHD pocketHD = new WalletPocketHD(rootKey, BTC, null, null); + pocketHD.getReceiveAddress(); // Generate the first key + pocketHD.encrypt(crypter, aesKey); + SignedMessage signedMessage = new SignedMessage("1KUDsEDqSBAgxubSEWszoA9xscNRRCmujM", MESSAGE); + pocketHD.signMessage(signedMessage, null); + assertEquals(SignedMessage.Status.KeyIsEncrypted, signedMessage.status); + } + @Test public void watchingAddresses() { List watchingAddresses = pocket.getAddressesToWatch(); @@ -152,7 +222,7 @@ public void issuedKeysLimit() throws Exception { assertEquals(19, pocket.getIssuedReceiveAddresses().size()); } - pocket.onConnection(getBlockchainConnection(BTC)); + pocket.onConnection(getBlockchainConnection(DOGE)); assertTrue(pocket.canCreateFreshReceiveAddress()); try { @@ -189,7 +259,7 @@ public void issuedKeysLimit2() throws Exception { public void usedAddresses() throws Exception { assertEquals(0, pocket.getUsedAddresses().size()); - pocket.onConnection(getBlockchainConnection(BTC)); + pocket.onConnection(getBlockchainConnection(DOGE)); // Receive and change addresses assertEquals(13, pocket.getUsedAddresses().size()); @@ -262,14 +332,14 @@ private void setTrustedTransaction(WalletPocketHD account, Sha256Hash txId) { @Test public void testLoading() throws Exception { assertFalse(pocket.isLoading()); - pocket.onConnection(getBlockchainConnection(BTC)); + pocket.onConnection(getBlockchainConnection(DOGE)); // TODO add fine grained control to the blockchain connection in order to test the loading status assertFalse(pocket.isLoading()); } @Test public void fillTransactions() throws Exception { - pocket.onConnection(getBlockchainConnection(BTC)); + pocket.onConnection(getBlockchainConnection(DOGE)); checkUnspentOutputs(getDummyUtxoSet(), pocket); assertEquals(11000000000L, pocket.getBalance().value); @@ -299,7 +369,62 @@ public void fillTransactions() throws Exception { assertEquals(11000000000L, pocket.getBalance().value); } - + + @Test + public void serializeTransactionsBtc() throws Exception, Bip44KeyLookAheadExceededException { + WalletPocketHD account = new WalletPocketHD(rootKey, BTC, null, null); + Transaction tx = new Transaction(BTC); + tx.addOutput(BTC.oneCoin().toCoin(), account.getReceiveAddress()); + account.addNewTransactionIfNeeded(tx); + testWalletSerializationForCoin(account); + } + + @Test + public void serializeTransactionsNbt() throws Exception, Bip44KeyLookAheadExceededException { + WalletPocketHD account = new WalletPocketHD(rootKey, NBT, null, null); + Transaction tx = new Transaction(NBT); + tx.addOutput(NBT.oneCoin().toCoin(), account.getReceiveAddress()); + account.addNewTransactionIfNeeded(tx); + testWalletSerializationForCoin(account); + } + + @Test + public void serializeTransactionsVpn() throws Exception, Bip44KeyLookAheadExceededException { + WalletPocketHD account = new WalletPocketHD(rootKey, VPN, null, null); + // Test tx with null extra bytes + Transaction tx = new Transaction(VPN); + tx.setTime(0x99999999); + tx.addOutput(VPN.oneCoin().toCoin(), account.getFreshReceiveAddress()); + account.addNewTransactionIfNeeded(tx); + WalletPocketHD newAccount = testWalletSerializationForCoin(account); + Transaction newTx = newAccount.getRawTransaction(tx.getHash()); + assertNotNull(newTx); + assertNotNull(newTx.getExtraBytes()); + assertEquals(0, newTx.getExtraBytes().length); + // Test tx with empty extra bytes + tx = new Transaction(VPN); + tx.setTime(0x99999999); + tx.setExtraBytes(new byte[0]); + tx.addOutput(VPN.oneCoin().toCoin(), account.getFreshReceiveAddress()); + account.addNewTransactionIfNeeded(tx); + newAccount = testWalletSerializationForCoin(account); + newTx = newAccount.getRawTransaction(tx.getHash()); + assertNotNull(newTx); + assertNotNull(newTx.getExtraBytes()); + assertEquals(0, newTx.getExtraBytes().length); + // Test tx with extra bytes + tx = new Transaction(VPN); + tx.setTime(0x99999999); + byte[] bytes = {0x1, 0x2, 0x3}; + tx.setExtraBytes(bytes); + tx.addOutput(VPN.oneCoin().toCoin(), account.getFreshReceiveAddress()); + account.addNewTransactionIfNeeded(tx); + newAccount = testWalletSerializationForCoin(account); + newTx = newAccount.getRawTransaction(tx.getHash()); + assertNotNull(newTx); + assertArrayEquals(bytes, newTx.getExtraBytes()); + } + private WalletPocketHD testWalletSerializationForCoin(WalletPocketHD account) throws UnreadableWalletException { Protos.WalletPocket proto = account.toProtobuf(); WalletPocketHD newAccount = new WalletPocketProtobufSerializer().readWallet(proto, null); @@ -315,7 +440,7 @@ private WalletPocketHD testWalletSerializationForCoin(WalletPocketHD account) th @Test public void serializeUnencryptedNormal() throws Exception { - pocket.onConnection(getBlockchainConnection(BTC)); + pocket.onConnection(getBlockchainConnection(DOGE)); Protos.WalletPocket walletPocketProto = pocket.toProtobuf(); System.out.println(walletPocketProto.toString()); @@ -323,7 +448,7 @@ public void serializeUnencryptedNormal() throws Exception { WalletPocketHD newPocket = new WalletPocketProtobufSerializer().readWallet(walletPocketProto, null); assertEquals(pocket.getBalance().value, newPocket.getBalance().value); - assertEquals(BTC.value(11000000000l), newPocket.getBalance()); + assertEquals(DOGE.value(11000000000l), newPocket.getBalance()); Map expectedUtxoSet = getDummyUtxoSet(); checkUnspentOutputs(expectedUtxoSet, pocket); @@ -352,7 +477,7 @@ public void serializeUnencryptedNormal() throws Exception { assertEquals(18, newPocket.keys.getNumIssuedExternalKeys()); assertEquals(9, newPocket.keys.getNumIssuedInternalKeys()); - newPocket.onConnection(getBlockchainConnection(BTC)); + newPocket.onConnection(getBlockchainConnection(DOGE)); // No addresses left to subscribe List addressesToWatch = newPocket.getAddressesToWatch(); @@ -423,15 +548,15 @@ public void serializeEncryptedEmpty() throws Exception { public void serializeEncryptedNormal() throws Exception { pocket.maybeInitializeAllKeys(); pocket.encrypt(crypter, aesKey); - pocket.onConnection(getBlockchainConnection(BTC)); + pocket.onConnection(getBlockchainConnection(DOGE)); - assertEquals(BTC.value(11000000000l), pocket.getBalance()); + assertEquals(DOGE.value(11000000000l), pocket.getBalance()); assertAllKeysEncrypted(pocket); WalletPocketHD newPocket = new WalletPocketProtobufSerializer().readWallet(pocket.toProtobuf(), crypter); - assertEquals(BTC.value(11000000000l), newPocket.getBalance()); + assertEquals(DOGE.value(11000000000l), newPocket.getBalance()); Map expectedUtxoSet = getDummyUtxoSet(); checkUnspentOutputs(expectedUtxoSet, pocket); @@ -473,28 +598,28 @@ private void assertAllKeysEncrypted(WalletPocketHD pocket) { @Test public void createDustTransactionFee() throws Exception { - pocket.onConnection(getBlockchainConnection(BTC)); + pocket.onConnection(getBlockchainConnection(DOGE)); - BitAddress toAddr = BitAddress.from(BTC, "nZB8PHkfgJvuCJqchSexmfY3ABXa2aE1vp"); + BitAddress toAddr = BitAddress.from(DOGE, "nZB8PHkfgJvuCJqchSexmfY3ABXa2aE1vp"); - Value softDust = BTC.getSoftDustLimit(); + Value softDust = DOGE.getSoftDustLimit(); assertNotNull(softDust); // Send a soft dust - BitSendRequest sendRequest = pocket.sendCoinsOffline(toAddr, softDust.subtract(BTC.value(1))); + BitSendRequest sendRequest = pocket.sendCoinsOffline(toAddr, softDust.subtract(DOGE.value(1))); pocket.completeTransaction(sendRequest); - assertEquals(BTC.getFeeValue().multiply(2), sendRequest.tx.getFee()); + assertEquals(DOGE.getFeeValue().multiply(2), sendRequest.tx.getFee()); } @Test public void createTransactionAndBroadcast() throws Exception { - pocket.onConnection(getBlockchainConnection(BTC)); + pocket.onConnection(getBlockchainConnection(DOGE)); - BitAddress toAddr = BitAddress.from(BTC, "nZB8PHkfgJvuCJqchSexmfY3ABXa2aE1vp"); + BitAddress toAddr = BitAddress.from(DOGE, "nZB8PHkfgJvuCJqchSexmfY3ABXa2aE1vp"); Value orgBalance = pocket.getBalance(); - BitSendRequest sendRequest = pocket.sendCoinsOffline(toAddr, BTC.value(AMOUNT_TO_SEND)); + BitSendRequest sendRequest = pocket.sendCoinsOffline(toAddr, DOGE.value(AMOUNT_TO_SEND)); sendRequest.shuffleOutputs = false; - sendRequest.feePerTxSize = BTC.value(0); + sendRequest.feePerTxSize = DOGE.value(0); pocket.completeTransaction(sendRequest); // FIXME, mock does not work here @@ -521,7 +646,7 @@ HashMap getDummyStatuses() throws AddressMalform HashMap status = new HashMap<>(40); for (int i = 0; i < addresses.size(); i++) { - AbstractAddress address = BTC.newAddress(addresses.get(i)); + AbstractAddress address = DOGE.newAddress(addresses.get(i)); status.put(address, new AddressStatus(address, statuses[i])); } @@ -537,7 +662,7 @@ private HashMap> getDummyHistoryTXs() thro for (int j = 0; j < jsonArray.length(); j++) { list.add(new HistoryTx(jsonArray.getJSONObject(j))); } - htxs.put(BTC.newAddress(addresses.get(i)), list); + htxs.put(DOGE.newAddress(addresses.get(i)), list); } return htxs; @@ -552,7 +677,7 @@ private HashMap> getDummyUnspentTXs() thro for (int j = 0; j < jsonArray.length(); j++) { list.add(new UnspentTx(jsonArray.getJSONObject(j))); } - utxs.put(BTC.newAddress(addresses.get(i)), list); + utxs.put(DOGE.newAddress(addresses.get(i)), list); } return utxs; @@ -562,15 +687,15 @@ private Map getDummyUtxoSet() throws AddressMal final HashMap unspentOutputs = new HashMap<>(); for (int i = 0; i < statuses.length; i++) { - BitAddress address = (BitAddress) BTC.newAddress(addresses.get(i)); + BitAddress address = (BitAddress) DOGE.newAddress(addresses.get(i)); JSONArray utxoArray = new JSONArray(unspent[i]); for (int j = 0; j < utxoArray.length(); j++) { JSONObject utxoObject = utxoArray.getJSONObject(j); //"[{\"tx_hash\": \"ef74da273e8a77e2d60b707414fb7e0ccb35c7b1b936800a49fe953195b1799f\", \"tx_pos\": 11, \"value\": 500000000, \"height\": 160267}]", - TrimmedOutPoint outPoint = new TrimmedOutPoint(BTC, utxoObject.getInt("tx_pos"), + TrimmedOutPoint outPoint = new TrimmedOutPoint(DOGE, utxoObject.getInt("tx_pos"), new Sha256Hash(utxoObject.getString("tx_hash"))); - TransactionOutput output = new TransactionOutput(BTC, null, + TransactionOutput output = new TransactionOutput(DOGE, null, Coin.valueOf(utxoObject.getLong("value")), address); OutPointOutput utxo = new OutPointOutput(outPoint, output, false); unspentOutputs.put(outPoint, utxo); diff --git a/core/src/test/java/com/vergepay/core/wallet/WalletTest.java b/core/src/test/java/com/coinomi/core/wallet/WalletTest.java similarity index 97% rename from core/src/test/java/com/vergepay/core/wallet/WalletTest.java rename to core/src/test/java/com/coinomi/core/wallet/WalletTest.java index a7f0bea..caf1801 100644 --- a/core/src/test/java/com/vergepay/core/wallet/WalletTest.java +++ b/core/src/test/java/com/coinomi/core/wallet/WalletTest.java @@ -27,7 +27,7 @@ */ public class WalletTest { static final List MNEMONIC = ImmutableList.of("citizen", "fever", "scale", "nurse", "brief", "round", "ski", "fiction", "car", "fitness", "pluck", "act"); - CoinType type = BitcoinMain.get(); + CoinType type = BitcoinTest.get(); private Wallet wallet; static final byte[] aesKeyBytes = {0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7}; KeyParameter aesKey = new KeyParameter(aesKeyBytes); @@ -40,7 +40,7 @@ public void setup() throws IOException, MnemonicException { wallet = new Wallet(MNEMONIC); ImmutableList typesToCreate = ImmutableList.of(BitcoinMain.get(), - LitecoinMain.get()); + LitecoinMain.get() wallet.createAccounts(typesToCreate, true, aesKey); } diff --git a/core/src/test/java/com/vergepay/core/wallet/families/bitcoin/BitAddressTest.java b/core/src/test/java/com/coinomi/core/wallet/families/bitcoin/BitAddressTest.java similarity index 100% rename from core/src/test/java/com/vergepay/core/wallet/families/bitcoin/BitAddressTest.java rename to core/src/test/java/com/coinomi/core/wallet/families/bitcoin/BitAddressTest.java diff --git a/core/src/test/java/com/coinomi/core/wallet/families/bitcoin/TransactionTest.java b/core/src/test/java/com/coinomi/core/wallet/families/bitcoin/TransactionTest.java new file mode 100644 index 0000000..3cfd998 --- /dev/null +++ b/core/src/test/java/com/coinomi/core/wallet/families/bitcoin/TransactionTest.java @@ -0,0 +1,38 @@ +package com.vergepay.core.wallet.families.bitcoin; + +import com.vergepay.core.coins.CannacoinMain; +import com.vergepay.core.coins.NuBitsMain; +import com.vergepay.core.coins.PeercoinMain; + +import org.bitcoinj.core.Transaction; +import org.junit.Test; +import org.spongycastle.util.encoders.Hex; + +import static org.junit.Assert.assertEquals; + +/** + * @author John L. Jegutanis + */ +public class TransactionTest { + String peercoinHash = "f1311469970c2a7bd1a0f69affe627222e7bae446dbafdbe90479706b75263ca"; + Transaction peercoinTx = new Transaction(PeercoinMain.get(), Hex.decode("01000000896dc3550448d7832861e532b3fbd225017cb7ca9a20caf79b6f802255520b37415959570d030000006c493046022100871f5b7a75cc9732d4c1410787a7e07131c74410420efaf7e5f438f86a3933fa022100dff501634f5d3fd64075f685173830c5023824cbfc46ea013d29da78c7eda9d3012103bcce424f94449613ad54050739ed5a5f79bc97cb526c5e850f19e6fcf030f5d2ffffffff8b015753b65cf8a5fa8af15aa955d2925d9138dde80ac07f94056a56331a7407010000006b483045022054030eb85636ddb9362505af46d334cd16c5df09245f9ad44d7d065ec7a4de420221009368aa9b145ec952dd5c2edd65a32210049328b8d57681e367da72bfc63e9029012103bcce424f94449613ad54050739ed5a5f79bc97cb526c5e850f19e6fcf030f5d2ffffffffb7eb79dd9205847bb19571b544e96d3f479f1aebc7818b185c31b150b2157453010000006b48304502205c7b91f7057563c992ce2d1a56b7c7b61394f327ccd5e0d6ceafb6c42d70e330022100ba76acfb2b5e1592b03e9f32c4c0756d56e73f99a78766d12915effd0648f635012103bcce424f94449613ad54050739ed5a5f79bc97cb526c5e850f19e6fcf030f5d2ffffffff33c208bc6fe2c2c12c218617325849536c9adc24e673d25c24758d3dd96cbdef540000006c493046022100a03ff05c33b2ac34aff5a8dfb4b545d14cf53887d70ec48a9ae203038b9f228f022100f287e59fdd132b11c095ec105b9b7d4f9cd18cb2de26f9de32912d626dc870d50121038a64028ae8fe1801158a8f72f6f9e8757fe46c06fed4705424aa7a0cb50ce371ffffffff0162b31701000000001976a914181805d5c08a3f5cc0c0c1e6fd40304259dbaddc88ac00000000")); + String nuBitsHash = "95cde4252ec3d369462f2ba13cab68d19ede4966b19bce951cb1eb872aeebfdf"; + Transaction nuBitsTx = new Transaction(NuBitsMain.get(), Hex.decode("01000000da65c45501a9a56af031323ff6f0f45281660567389328dfc1d83e88cd6b29b505cf402a43010000006c4930460221008a12caa723b15eb6057478a0f1029f5c99921a426fec44cdacec4f0f11e75971022100f05c8344323bb1b184eb5868f702fdfb7f523d73776c2c78df70867a75baaaeb01210254eac4efa6c28776e4d63e0c65587be41c559bc3cb639ab5dfd572d252ece7d5ffffffff0769000000000000001976a9143de7f23c25936b9bddc3b21fae3082fcfc09fd9888ac66000000000000001976a9147c46bc2b5ad3ca40c6f4d039afe3ecd743487d0a88ac68000000000000001976a9149a9e312da46341905f87f599fefff65f415ccbe388ac4e040000000000001976a914de31e58402ae8c6ced0169b3bd07fee0248ae5da88ac21710200000000001976a914912958e7ee82e34b18babfaa5d240e89b81ee01188ac68000000000000001976a9144d27246db88ccacae6ad86cd65753e51efd37e7288ac6a000000000000001976a9146043d55ef117b0cdeb8e5c8247eb14858930557e88ac0000000042")); + String cannacoinHash = "e2329805f536c1f7aaa2d199fe8be8f98ead72f72abc28785f11b927996975da"; + Transaction cannacoinTx = new Transaction(CannacoinMain.get(), Hex.decode("0200000001c3ca26255b0ea4e5f0ce72d30a529fa8f154a4b14669a6a12c2abcf2e2831650010000006b483045022100fc8d7234352eda12025a4bb4d89872d4fbdb24ef0adc3ca1b6f184f2a90d94bb022023e26ea1c0605148975e4458258827123737a8a47f44446f852df0c3a69c7160012102ec2091d47d010eb4a949dc7e470db08df242b1164ea7e63b154982b8b1071037ffffffff0238098b00000000001976a914b1adb719e8e6a6fff83e6e35dc0ac053b206ed7888acc2536908000000001976a91476074a88f5224d534ae7f458935e1c411e627f2588ac000000003d55c654")); + + @Test + public void peercoinTxTest() { + assertEquals(peercoinHash, peercoinTx.getHashAsString()); + } + + @Test + public void nuBitsTxTest() { + assertEquals(nuBitsHash, nuBitsTx.getHashAsString()); + } + + @Test + public void cannacoinTxTest() { + assertEquals(cannacoinHash, cannacoinTx.getHashAsString()); + } +} diff --git a/core/src/test/java/com/vergepay/core/wallet/families/nxt/NxtFamilyWalletTest.java b/core/src/test/java/com/coinomi/core/wallet/families/nxt/NxtFamilyWalletTest.java similarity index 100% rename from core/src/test/java/com/vergepay/core/wallet/families/nxt/NxtFamilyWalletTest.java rename to core/src/test/java/com/coinomi/core/wallet/families/nxt/NxtFamilyWalletTest.java diff --git a/core/src/test/java/com/vergepay/core/wallet/families/vpncoin/TransactionTest.java b/core/src/test/java/com/coinomi/core/wallet/families/vpncoin/TransactionTest.java similarity index 66% rename from core/src/test/java/com/vergepay/core/wallet/families/vpncoin/TransactionTest.java rename to core/src/test/java/com/coinomi/core/wallet/families/vpncoin/TransactionTest.java index c7cc1d1..6b84765 100644 --- a/core/src/test/java/com/vergepay/core/wallet/families/vpncoin/TransactionTest.java +++ b/core/src/test/java/com/coinomi/core/wallet/families/vpncoin/TransactionTest.java @@ -1,6 +1,6 @@ package com.vergepay.core.wallet.families.vpncoin; -import com.vergepay.core.coins.BitcoinMain; +import com.vergepay.core.coins.VpncoinMain; import com.vergepay.core.messages.MessageFactory; import com.google.common.base.Charsets; @@ -34,11 +34,21 @@ public class TransactionTest { "Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue."; String TX_HASH_1 = "192c485deab867c994a2396c815a48e4c3808c166b4edd70f87085e22c1417e5"; - Transaction TX_1 = new Transaction(BitcoinMain.get(), Hex.decode("0100000089cec45502c8f83c02c59583876c6e1fa447e7ab6083e392753ddf8707269b36340afcf028000000006a47304402206552a703cc1865c72bc43899d4841502f52f5110d2cb637983965e153abe197802200b31b94c1d014fc0ea360f5d29a79ab98421f6104145477a7077540393aeb0bd0121028cbb0a3d32a4e076c5131c90b49ddcb940eaa67cf918a1484ca69d19d475a579ffffffff35908ed4a3aa92f2c0b19605a07fbb9a76146db542cc30b9d5e75d2259ac8735010000006a473044022053a2f59dc313e43c96b01b3787bfab948aa1b95a40a1b9691eff01545d924d9e02204845df419347bff68207febe7fe05bed41daa5164d7f26ec170cac7455b0e4d601210282a4a113c70c352ee86d2a60297a7eeb719664f8610514d442346d7999ffa3b6ffffffff0220b81800000000001976a914a620a48d22391100afceaff72c73a4032f3fb02b88ac00e40b54020000001976a914ce7f924d1886c3525e8454eebda251a0f0d1b10b88ac00000000384177494d6465373776652b6737566e5665466c354e5641312f47487735363251324c31592b6c464543566f64495031622f73577533664d3d")); + Transaction TX_1 = new Transaction(VpncoinMain.get(), Hex.decode("0100000089cec45502c8f83c02c59583876c6e1fa447e7ab6083e392753ddf8707269b36340afcf028000000006a47304402206552a703cc1865c72bc43899d4841502f52f5110d2cb637983965e153abe197802200b31b94c1d014fc0ea360f5d29a79ab98421f6104145477a7077540393aeb0bd0121028cbb0a3d32a4e076c5131c90b49ddcb940eaa67cf918a1484ca69d19d475a579ffffffff35908ed4a3aa92f2c0b19605a07fbb9a76146db542cc30b9d5e75d2259ac8735010000006a473044022053a2f59dc313e43c96b01b3787bfab948aa1b95a40a1b9691eff01545d924d9e02204845df419347bff68207febe7fe05bed41daa5164d7f26ec170cac7455b0e4d601210282a4a113c70c352ee86d2a60297a7eeb719664f8610514d442346d7999ffa3b6ffffffff0220b81800000000001976a914a620a48d22391100afceaff72c73a4032f3fb02b88ac00e40b54020000001976a914ce7f924d1886c3525e8454eebda251a0f0d1b10b88ac00000000384177494d6465373776652b6737566e5665466c354e5641312f47487735363251324c31592b6c464543566f64495031622f73577533664d3d")); String TX_HASH_2 = "9925c0724b5ce11e13c9cb1349cb084377ab6e3245112eec109d54d3bcf38b34"; - Transaction TX_2 = new Transaction(BitcoinMain.get(), Hex.decode("01000000347bc75501f4fddc83d4a27cb80e73547503e23f3f9336effa180aed06cf60c65f6625059c010000006b483045022100be8e81194d4e77ca53cf472973f065f04709a8fe7b429955b829b08c69ac6213022040db08bb6f8a9d8a78157752c1f534239d9d339546423d5cfd1462fda5408b9101210351548af711794d4e556d2c215bd25f9d2a4d7ec5c99d5ca42d4c33fb21307835ffffffff02f09eb31e030000001976a914a620a48d22391100afceaff72c73a4032f3fb02b88ac00e40b54020000001976a914ce7f924d1886c3525e8454eebda251a0f0d1b10b88ac000000006c4177493672364f32384b4c746f4b6b30584a313638307173426642336353526d4c424842425750515566362b3835536f55745a58687a6e705938692b4f724e6a316761504a46766561324776452b6b384e6430536c316e6c483955596c535438543563457075566f77513d3d")); + Transaction TX_2 = new Transaction(VpncoinMain.get(), Hex.decode("01000000347bc75501f4fddc83d4a27cb80e73547503e23f3f9336effa180aed06cf60c65f6625059c010000006b483045022100be8e81194d4e77ca53cf472973f065f04709a8fe7b429955b829b08c69ac6213022040db08bb6f8a9d8a78157752c1f534239d9d339546423d5cfd1462fda5408b9101210351548af711794d4e556d2c215bd25f9d2a4d7ec5c99d5ca42d4c33fb21307835ffffffff02f09eb31e030000001976a914a620a48d22391100afceaff72c73a4032f3fb02b88ac00e40b54020000001976a914ce7f924d1886c3525e8454eebda251a0f0d1b10b88ac000000006c4177493672364f32384b4c746f4b6b30584a313638307173426642336353526d4c424842425750515566362b3835536f55745a58687a6e705938692b4f724e6a316761504a46766561324776452b6b384e6430536c316e6c483955596c535438543563457075566f77513d3d")); String TX_HASH_3 = "51f0ce3a8c56078d2d05660a042b820dffd2c81f370ab5af0d1135477461348a"; - Transaction TX_3 = new Transaction(BitcoinMain.get(), Hex.decode("01000000f07ac75501b14681fad878ae6d2416816be38bc926a5d428c7140a43e8dc4a64b61f324306010000006b483045022100f7beded6ce2b642af5523e1141032c68bc76fed629080766891b7aa54a4831b802200ad9a30203b93a3661f8132e5f132d865328874e709fe14b953c2ab72e20c7d50121025e3c4bfdc18ea84ec3403360c4b5f01b71fc4cdca5e170e508b05a121ffd5230ffffffff02f00f1789000000001976a914a620a48d22391100afceaff72c73a4032f3fb02b88ac00e40b54020000001976a914ce7f924d1886c3525e8454eebda251a0f0d1b10b88ac00000000fd900241774d4b5161667938764532546d53443139395669636e46735751425631766c70495256726e6e6b597149774d36734c6c6b7a736b793946414c58744b75317a716859417578796c3831717542773245694462426a7245716b3868532f4e5467563476334e3872752f304151656a384f7578392b75676d6e6a575231705945715a5a484d34323338794f50305076613668355935437a54654959715047513279374c54572b4e456c6e354d796e7155586e465739774944687776582b4d3347464771534266746651743654666152776373743631436e4876397a704d6263546170644e6b7249767a474533684a4b2b6945577147434a6f644c4274426b656b7035365073787558716562653068764843724b4f4e7553587a5a6447436f506868344b476f635876394b6c4b6d53706f6863434e4f504f2f376d47784874503159577747636336687644764e4d653374454b5179424835526c4d3771637067513764563174647374646c4f704c50696f643865666b57704336584e4135633259546266325a66376d2b524c2b3367586763636b32616f764349305778336575437a5642486963664c346634376247413634314e2b59523561724376645458444e667665586e446a723065443263474f594639672f433646625a7165553567376947466a79715a6467504134326b4b5176496b54437a796c464576334a6a2b5859526f537635367a7979595a65544563484b6d2f446f454f6162736d5633467542786b5337377845352b455a447a74735a42754843667234304e68616c5967532b2b41644f684273533069575150504646496349326b42663963506b6d356842763161717654346a663145426a2b73483076793444764a7a747233392f33715733513064374b797665704c3338646b413d3d")); + Transaction TX_3 = new Transaction(VpncoinMain.get(), Hex.decode("01000000f07ac75501b14681fad878ae6d2416816be38bc926a5d428c7140a43e8dc4a64b61f324306010000006b483045022100f7beded6ce2b642af5523e1141032c68bc76fed629080766891b7aa54a4831b802200ad9a30203b93a3661f8132e5f132d865328874e709fe14b953c2ab72e20c7d50121025e3c4bfdc18ea84ec3403360c4b5f01b71fc4cdca5e170e508b05a121ffd5230ffffffff02f00f1789000000001976a914a620a48d22391100afceaff72c73a4032f3fb02b88ac00e40b54020000001976a914ce7f924d1886c3525e8454eebda251a0f0d1b10b88ac00000000fd900241774d4b5161667938764532546d53443139395669636e46735751425631766c70495256726e6e6b597149774d36734c6c6b7a736b793946414c58744b75317a716859417578796c3831717542773245694462426a7245716b3868532f4e5467563476334e3872752f304151656a384f7578392b75676d6e6a575231705945715a5a484d34323338794f50305076613668355935437a54654959715047513279374c54572b4e456c6e354d796e7155586e465739774944687776582b4d3347464771534266746651743654666152776373743631436e4876397a704d6263546170644e6b7249767a474533684a4b2b6945577147434a6f644c4274426b656b7035365073787558716562653068764843724b4f4e7553587a5a6447436f506868344b476f635876394b6c4b6d53706f6863434e4f504f2f376d47784874503159577747636336687644764e4d653374454b5179424835526c4d3771637067513764563174647374646c4f704c50696f643865666b57704336584e4135633259546266325a66376d2b524c2b3367586763636b32616f764349305778336575437a5642486963664c346634376247413634314e2b59523561724376645458444e667665586e446a723065443263474f594639672f433646625a7165553567376947466a79715a6467504134326b4b5176496b54437a796c464576334a6a2b5859526f537635367a7979595a65544563484b6d2f446f454f6162736d5633467542786b5337377845352b455a447a74735a42754843667234304e68616c5967532b2b41644f684273533069575150504646496349326b42663963506b6d356842763161717654346a663145426a2b73483076793444764a7a747233392f33715733513064374b797665704c3338646b413d3d")); + + @Test + public void decrypt() throws Exception { + assertArrayEquals(ORIGINAL_BYTES, VpncoinTxMessage.decryptBytes(ENCRYPTION_KEY, ENCRYPTED)); + } + + @Test + public void uncompress() throws Exception { + assertArrayEquals(ORIGINAL_BYTES, VpncoinTxMessage.uncompress(ByteBuffer.wrap(COMPRESSED))); + } @Test public void hashes() { @@ -46,7 +56,67 @@ public void hashes() { assertEquals(TX_HASH_2, TX_2.getHashAsString()); assertEquals(TX_HASH_3, TX_3.getHashAsString()); } + @Test + public void messageRegex() { + String messageString = "@FROM=" + FROM_USER + "@SUBJ=" + SUBJECT + "@MSG=" + MESSAGE; + Matcher matcher = VpncoinTxMessage.MESSAGE_REGEX.matcher(messageString); + assertTrue(matcher.find()); + assertEquals("@FROM=" + FROM_USER, matcher.group()); + assertTrue(matcher.find()); + assertEquals("@SUBJ=" + SUBJECT, matcher.group()); + assertTrue(matcher.find()); + assertEquals("@MSG=" + MESSAGE, matcher.group()); + } + + @Test + public void emptyMessages() { + MessageFactory factory = VpncoinTxMessage.getFactory(); + assertEquals("", factory.createPublicMessage("").toString()); + assertEquals("", factory.createPublicMessage(" ").toString()); + assertEquals("", factory.createPublicMessage("\n\n").toString()); + assertEquals("", factory.createPublicMessage(" \t \t").toString()); + + assertEquals(0, ((VpncoinTxMessage)factory.createPublicMessage("")).serialize().length); + assertEquals(0, ((VpncoinTxMessage)factory.createPublicMessage(" ")).serialize().length); + assertEquals(0, ((VpncoinTxMessage)factory.createPublicMessage("\n\n")).serialize().length); + assertEquals(0, ((VpncoinTxMessage)factory.createPublicMessage(" \t \t")).serialize().length); + } + + @Test + public void messageStringParsing() { + VpncoinTxMessage message = VpncoinTxMessage.parse("@FROM=" + FROM_USER + "@SUBJ=" + SUBJECT + "@MSG=" + MESSAGE); + assertEquals(FROM_USER, message.getFrom()); + assertEquals(SUBJECT, message.getSubject()); + assertEquals(MESSAGE, message.getMessage()); + assertEquals(FROM_USER + "\n\n"+SUBJECT+"\n\n"+MESSAGE, message.toString()); + message = VpncoinTxMessage.parse("@MSG=" + MESSAGE); + assertNull(message.getFrom()); + assertNull(message.getSubject()); + assertEquals(MESSAGE, message.getMessage()); + assertEquals(MESSAGE, message.toString()); + } + + @Test + public void messageSerialization() { + VpncoinTxMessage message = new VpncoinTxMessage(FROM_USER, SUBJECT, MESSAGE); + String expected = "@FROM="+FROM_USER+"@SUBJ="+SUBJECT+"@MSG="+MESSAGE; + assertArrayEquals(expected.getBytes(Charsets.UTF_8), message.serialize()); + + message = new VpncoinTxMessage(MESSAGE); + assertNull(message.getFrom()); + assertNull(message.getSubject()); + assertArrayEquals(("@MSG=" + MESSAGE).getBytes(Charsets.UTF_8), message.serialize()); + } + + @Test + public void messageToString() { + VpncoinTxMessage message = new VpncoinTxMessage(FROM_USER, SUBJECT, MESSAGE); + assertEquals(FROM_USER + "\n\n"+SUBJECT+"\n\n"+MESSAGE, message.toString()); + + message = new VpncoinTxMessage(MESSAGE); + assertEquals(MESSAGE, message.toString()); + } /* @Test public void messagesEncrypted() { @@ -58,9 +128,9 @@ public void messagesEncrypted() { message = VpncoinTxMessage.parse(TX_2); assert message != null; - assertEquals("bit lee, message.getFrom()); - assertEquals("hello, message.getSubject()); - assertEquals("thanks" + + assertEquals("比特李", message.getFrom()); + assertEquals("信息", message.getSubject()); + assertEquals("сообщение\n" + "μήνυμα\n" + "رسالة", message.getMessage()); diff --git a/core/src/test/java/com/vergepay/stratumj/CommunicationsTest.java b/core/src/test/java/com/coinomi/stratumj/CommunicationsTest.java similarity index 100% rename from core/src/test/java/com/vergepay/stratumj/CommunicationsTest.java rename to core/src/test/java/com/coinomi/stratumj/CommunicationsTest.java diff --git a/core/src/test/java/com/vergepay/stratumj/MessagesTest.java b/core/src/test/java/com/coinomi/stratumj/MessagesTest.java similarity index 100% rename from core/src/test/java/com/vergepay/stratumj/MessagesTest.java rename to core/src/test/java/com/coinomi/stratumj/MessagesTest.java diff --git a/core/src/test/java/com/vergepay/core/exchange/shapeshift/ExchangeRateTest.java b/core/src/test/java/com/vergepay/core/exchange/shapeshift/ExchangeRateTest.java deleted file mode 100644 index cf07423..0000000 --- a/core/src/test/java/com/vergepay/core/exchange/shapeshift/ExchangeRateTest.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.vergepay.core.exchange.shapeshift; - -import com.vergepay.core.coins.BitcoinMain; -import com.vergepay.core.coins.CoinType; -import com.vergepay.core.coins.FiatValue; -import com.vergepay.core.coins.VergeMain; -import com.vergepay.core.exchange.shapeshift.data.ShapeShiftExchangeRate; -import com.vergepay.core.util.ExchangeRateBase; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -/** - * @author John L. Jegutanis - */ -public class ExchangeRateTest { - final CoinType BTC = BitcoinMain.get(); - final CoinType XVG = VergeMain.get(); - - - @Test - public void baseFee() { - ShapeShiftExchangeRate rate = new ShapeShiftExchangeRate(BTC, XVG, "100", "0.01"); - - assertEquals(BTC.value("1"), rate.value1); - assertEquals(XVG.value("100"), rate.value2); - assertEquals(XVG.value("0.01"), rate.minerFee); - - assertEquals(XVG.value("99.99"), rate.convert(BTC.oneCoin())); - assertEquals(BTC.value("1"), rate.convert(XVG.value("99.99"))); - - rate = new ShapeShiftExchangeRate(BTC.oneCoin(), - XVG.value("1911057.69230769"), XVG.value("1")); - assertEquals(BTC.value("1"), rate.value1); - assertEquals(XVG.value("1911057.69230769"), rate.value2); - assertEquals(XVG.value("1"), rate.minerFee); - assertEquals(BTC.value("0.00052379"), rate.convert(XVG.value("1000"))); - - rate = new ShapeShiftExchangeRate(BTC.oneCoin(), - XVG.value("1878207.54716981"), XVG.value("1")); - assertEquals(BTC.value("1"), rate.value1); - assertEquals(XVG.value("1878207.54716981"), rate.value2); - assertEquals(XVG.value("1"), rate.minerFee); - assertEquals(BTC.value("0.00532476"), rate.convert(XVG.value("10000"))); - } - - @Test - public void zeroValues() { - ShapeShiftExchangeRate rate = new ShapeShiftExchangeRate(BTC, XVG, "100", "0.01"); - assertEquals(BTC.value("0"), rate.convert(XVG.value("0"))); - assertEquals(XVG.value("0"), rate.convert(BTC.value("0"))); - } - - @Test - public void smallValues() { - ShapeShiftExchangeRate rate = new ShapeShiftExchangeRate(XVG, BTC, "5.1e-7", "0.0001"); - assertEquals(BTC.value("0"), rate.convert(XVG.value("1"))); - } - - @Test(expected = IllegalArgumentException.class) - public void zeroExchangeRate() throws Exception { - new ShapeShiftExchangeRate(BTC, XVG, "0", "0.01"); - } -} \ No newline at end of file diff --git a/core/src/test/java/com/vergepay/core/wallet/families/bitcoin/TransactionTest.java b/core/src/test/java/com/vergepay/core/wallet/families/bitcoin/TransactionTest.java deleted file mode 100644 index e390aaa..0000000 --- a/core/src/test/java/com/vergepay/core/wallet/families/bitcoin/TransactionTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.vergepay.core.wallet.families.bitcoin; - -import com.vergepay.core.coins.VergeMain; - -import org.bitcoinj.core.Transaction; -import org.junit.Test; -import org.spongycastle.util.encoders.Hex; - -import static org.junit.Assert.assertEquals; - -/** - * @author John L. Jegutanis - */ -public class TransactionTest { - String vergeHash = "f1311469970c2a7bd1a0f69affe627222e7bae446dbafdbe90479706b75263ca"; - Transaction vergeTx = new Transaction(VergeMain.get(), Hex.decode("01000000896dc3550448d7832861e532b3fbd225017cb7ca9a20caf79b6f802255520b37415959570d030000006c493046022100871f5b7a75cc9732d4c1410787a7e07131c74410420efaf7e5f438f86a3933fa022100dff501634f5d3fd64075f685173830c5023824cbfc46ea013d29da78c7eda9d3012103bcce424f94449613ad54050739ed5a5f79bc97cb526c5e850f19e6fcf030f5d2ffffffff8b015753b65cf8a5fa8af15aa955d2925d9138dde80ac07f94056a56331a7407010000006b483045022054030eb85636ddb9362505af46d334cd16c5df09245f9ad44d7d065ec7a4de420221009368aa9b145ec952dd5c2edd65a32210049328b8d57681e367da72bfc63e9029012103bcce424f94449613ad54050739ed5a5f79bc97cb526c5e850f19e6fcf030f5d2ffffffffb7eb79dd9205847bb19571b544e96d3f479f1aebc7818b185c31b150b2157453010000006b48304502205c7b91f7057563c992ce2d1a56b7c7b61394f327ccd5e0d6ceafb6c42d70e330022100ba76acfb2b5e1592b03e9f32c4c0756d56e73f99a78766d12915effd0648f635012103bcce424f94449613ad54050739ed5a5f79bc97cb526c5e850f19e6fcf030f5d2ffffffff33c208bc6fe2c2c12c218617325849536c9adc24e673d25c24758d3dd96cbdef540000006c493046022100a03ff05c33b2ac34aff5a8dfb4b545d14cf53887d70ec48a9ae203038b9f228f022100f287e59fdd132b11c095ec105b9b7d4f9cd18cb2de26f9de32912d626dc870d50121038a64028ae8fe1801158a8f72f6f9e8757fe46c06fed4705424aa7a0cb50ce371ffffffff0162b31701000000001976a914181805d5c08a3f5cc0c0c1e6fd40304259dbaddc88ac00000000")); - - @Test - public void vergeTxTest() { - assertEquals(vergeHash, vergeTx.getHashAsString()); - } -} diff --git a/gradle.properties b/gradle.properties index 7f5f271..f95d3e4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,6 +14,7 @@ # org.gradle.configureondemand=true # org.gradle.jvmargs=-Xms512m -Xmx2048m -XX:MaxPermSize=512m # +android.defaults.buildfeatures.buildconfig=true android.nonFinalResIds=false android.nonTransitiveRClass=false org.gradle.jvmargs=-Xmx1920M \ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b9771be..da1db5f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Tue Jul 23 18:23:13 EDT 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/wallet/build.gradle b/wallet/build.gradle index 09bb893..1bdd3b1 100644 --- a/wallet/build.gradle +++ b/wallet/build.gradle @@ -1,8 +1,8 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 34 - buildToolsVersion '34.0.0' + compileSdkVersion 33 + buildToolsVersion '33.0.0' compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -12,12 +12,12 @@ android { defaultConfig { applicationId "com.vergepay.wallet" - minSdk 34 - targetSdkVersion 34 - compileSdkVersion 34 + minSdk 31 + targetSdkVersion 33 + compileSdkVersion 33 ndkVersion "21.3.6528147" //shouldn't matter but gradle complains - versionCode 2060 - versionName "v2.6" + versionCode 20559 + versionName "v2.59" ndk { abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64' } @@ -25,9 +25,11 @@ android { buildTypes { release { + minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { + minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } @@ -38,6 +40,12 @@ android { } } + repositories { + flatDir { + dirs 'aars' + } + } + //sourceSets { // unitTest { // java.srcDir file('src/test/java') @@ -53,15 +61,15 @@ android { // androidTestCompile 'org.robolectric:robolectric:2.3' // androidTestCompile 'com.squareup:fest-android:1.0.+' implementation project(':core') - implementation 'com.android.support:gridlayout-v7:28.0.0' //most recent as of 7/23/2024 - implementation 'com.android.support:support-v4:28.0.0' //most recent as of 7/23/2024 - implementation 'com.android.support:appcompat-v7:28.0.0' //most recent as of 7/23/2024 + implementation 'com.android.support:gridlayout-v7:28.0.0' + implementation 'com.android.support:support-v4:28.0.0' + implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.google.guava:guava:21.0' //TODO ToStringHelper update for 19.0+ implementation 'com.google.code.findbugs:jsr305:3.0.2' // most recent as of 7/2023 implementation 'com.madgag.spongycastle:core:1.58.0.0' // most recent as of 7/2023 - implementation 'com.google.protobuf:protobuf-java:3.25.3' // most used as of 7/23/2024 - implementation 'com.google.zxing:core:3.5.3' //most recent as of 7/23/2024 - implementation 'ch.acra:acra:4.11.1' //most recent as of 7/23/2024 + implementation 'com.google.protobuf:protobuf-java:3.24.3' //latest as of 10/2023 + implementation 'com.google.zxing:core:3.5.2' //most recent as of 10/2023 + implementation 'ch.acra:acra:4.11.1' //most recent as of 10/2023 implementation 'com.android.support:support-v4-preferencefragment:1.0.0@aar' implementation 'com.jakewharton:butterknife:8.8.1' // ButterKnife.findById() is deprecated, needs FindByViewId() updates annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0' diff --git a/wallet/support-v4-preferencefragment-1.0.0.aar b/wallet/support-v4-preferencefragment-1.0.0.aar deleted file mode 100644 index 8b3474fe12ae3c2a608d5399fdb90a1054f2f4ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12223 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