From 639f6ee3375e7f369d89ae22d92c64e9ea1a88ee Mon Sep 17 00:00:00 2001 From: Martin Harrigan Date: Sun, 20 Jun 2021 12:19:53 +0100 Subject: [PATCH 1/2] List RSK Smart Bitcoin (R-BTC) --- .../bisq/asset/coins/RSKSmartBitcoin.java | 29 +++++++++++++ .../META-INF/services/bisq.asset.Asset | 1 + .../i18n/displayStrings-assets.properties | 3 +- .../bisq/asset/coins/RSKSmartBitcoinTest.java | 42 +++++++++++++++++++ .../java/bisq/core/locale/CurrencyUtil.java | 1 + 5 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 assets/src/main/java/bisq/asset/coins/RSKSmartBitcoin.java create mode 100644 assets/src/test/java/bisq/asset/coins/RSKSmartBitcoinTest.java diff --git a/assets/src/main/java/bisq/asset/coins/RSKSmartBitcoin.java b/assets/src/main/java/bisq/asset/coins/RSKSmartBitcoin.java new file mode 100644 index 00000000000..8fb1d752888 --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/RSKSmartBitcoin.java @@ -0,0 +1,29 @@ +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ + +package bisq.asset.coins; + +import bisq.asset.Coin; +import bisq.asset.EtherAddressValidator; +import bisq.asset.I18n; + +public class RSKSmartBitcoin extends Coin { + + public RSKSmartBitcoin() { + super("RSK Smart Bitcoin", "R-BTC", new EtherAddressValidator(I18n.DISPLAY_STRINGS.getString("account.altcoin.popup.validation.RBTC"))); + } +} diff --git a/assets/src/main/resources/META-INF/services/bisq.asset.Asset b/assets/src/main/resources/META-INF/services/bisq.asset.Asset index 80a6168463b..4fb5ae60f46 100644 --- a/assets/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/assets/src/main/resources/META-INF/services/bisq.asset.Asset @@ -94,6 +94,7 @@ bisq.asset.coins.QMCoin bisq.asset.coins.Qwertycoin bisq.asset.coins.Radium bisq.asset.coins.Remix +bisq.asset.coins.RSKSmartBitcoin bisq.asset.coins.Ryo bisq.asset.coins.Siafund bisq.asset.coins.SiaPrimeCoin diff --git a/assets/src/main/resources/i18n/displayStrings-assets.properties b/assets/src/main/resources/i18n/displayStrings-assets.properties index beabf782fbf..ca1486d5f5c 100644 --- a/assets/src/main/resources/i18n/displayStrings-assets.properties +++ b/assets/src/main/resources/i18n/displayStrings-assets.properties @@ -23,6 +23,7 @@ account.altcoin.popup.validation.XCP=XCP address must start with '1' and must ha account.altcoin.popup.validation.DCR=DCR address must start with 'Dk' or 'Ds' or 'De' or 'DS' or 'Dc' or 'Pm' and must have 34 characters. account.altcoin.popup.validation.ETC=ETC address must start with '0x' and made up of letters A to F and numbers which are 40 characters long. account.altcoin.popup.validation.NMC=NMC address must start with 'N' or 'M' and must be 34 characters long. +account.altcoin.popup.validation.RBTC=RSK Smart Bitcoin address must start with '0x' and must be made up of letters 'A' to 'F' and numbers which are 40 characters long. account.altcoin.popup.validation.SF= Siafund address must be made up of letters A to F and numbers which are 76 characters long. account.altcoin.popup.validation.UNO=UNO address must start with 'u' and must have 34 characters. -account.altcoin.popup.validation.XZC=XZC address must start with 'a' and must have 34 characters. \ No newline at end of file +account.altcoin.popup.validation.XZC=XZC address must start with 'a' and must have 34 characters. diff --git a/assets/src/test/java/bisq/asset/coins/RSKSmartBitcoinTest.java b/assets/src/test/java/bisq/asset/coins/RSKSmartBitcoinTest.java new file mode 100644 index 00000000000..e388a6fd7c1 --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/RSKSmartBitcoinTest.java @@ -0,0 +1,42 @@ +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ + +package bisq.asset.coins; + +import bisq.asset.AbstractAssetTest; + +public class RSKSmartBitcoinTest extends AbstractAssetTest { + + public RSKSmartBitcoinTest() { + super(new RSKSmartBitcoin()); + } + + @Override + public void testValidAddresses() { + assertValidAddress("0x353c13b940aa5eed75aa97d477954289e7880bb8"); + assertValidAddress("0x9f5304DA62A5408416Ea58A17a92611019bD5ce3"); + assertValidAddress("0x180826b05452ce96E157F0708c43381Fee64a6B8"); + + } + + @Override + public void testInvalidAddresses() { + assertInvalidAddress("MxmFPEPzF19JFPU3VPrRXvUbPjMQXnQerY"); + assertInvalidAddress("N22FRU9f3fx7Hty641D5cg95kRK6S3sbf3"); + assertInvalidAddress("MxmFPEPzF19JFPU3VPrRXvUbPjMQXnQerY"); + } +} diff --git a/core/src/main/java/bisq/core/locale/CurrencyUtil.java b/core/src/main/java/bisq/core/locale/CurrencyUtil.java index 2105ad08f3f..d38729f8f0b 100644 --- a/core/src/main/java/bisq/core/locale/CurrencyUtil.java +++ b/core/src/main/java/bisq/core/locale/CurrencyUtil.java @@ -151,6 +151,7 @@ public static List getMainCryptoCurrencies() { result.add(new CryptoCurrency("LTC", "Litecoin")); result.add(new CryptoCurrency("XMR", "Monero")); result.add(new CryptoCurrency("NMC", "Namecoin")); + result.add(new CryptoCurrency("R-BTC", "RSK Smart Bitcoin")); result.add(new CryptoCurrency("SF", "Siafund")); result.add(new CryptoCurrency("ZEC", "Zcash")); result.sort(TradeCurrency::compareTo); From c78cd8b0a05bb4a07f446311d6c404c9f65bd947 Mon Sep 17 00:00:00 2001 From: Martin Harrigan Date: Mon, 12 Jul 2021 13:53:24 +0100 Subject: [PATCH 2/2] Fix spacing --- .../bisq/asset/coins/RSKSmartBitcoinTest.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/assets/src/test/java/bisq/asset/coins/RSKSmartBitcoinTest.java b/assets/src/test/java/bisq/asset/coins/RSKSmartBitcoinTest.java index e388a6fd7c1..3ca22c6d5f6 100644 --- a/assets/src/test/java/bisq/asset/coins/RSKSmartBitcoinTest.java +++ b/assets/src/test/java/bisq/asset/coins/RSKSmartBitcoinTest.java @@ -25,18 +25,17 @@ public RSKSmartBitcoinTest() { super(new RSKSmartBitcoin()); } - @Override - public void testValidAddresses() { - assertValidAddress("0x353c13b940aa5eed75aa97d477954289e7880bb8"); - assertValidAddress("0x9f5304DA62A5408416Ea58A17a92611019bD5ce3"); - assertValidAddress("0x180826b05452ce96E157F0708c43381Fee64a6B8"); - - } + @Override + public void testValidAddresses() { + assertValidAddress("0x353c13b940aa5eed75aa97d477954289e7880bb8"); + assertValidAddress("0x9f5304DA62A5408416Ea58A17a92611019bD5ce3"); + assertValidAddress("0x180826b05452ce96E157F0708c43381Fee64a6B8"); + } - @Override - public void testInvalidAddresses() { - assertInvalidAddress("MxmFPEPzF19JFPU3VPrRXvUbPjMQXnQerY"); - assertInvalidAddress("N22FRU9f3fx7Hty641D5cg95kRK6S3sbf3"); - assertInvalidAddress("MxmFPEPzF19JFPU3VPrRXvUbPjMQXnQerY"); - } + @Override + public void testInvalidAddresses() { + assertInvalidAddress("MxmFPEPzF19JFPU3VPrRXvUbPjMQXnQerY"); + assertInvalidAddress("N22FRU9f3fx7Hty641D5cg95kRK6S3sbf3"); + assertInvalidAddress("MxmFPEPzF19JFPU3VPrRXvUbPjMQXnQerY"); + } }