mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-10-14 19:40:53 -04:00
support Ripple (XRP)
This commit is contained in:
parent
6537586976
commit
7298a6373a
7 changed files with 110 additions and 0 deletions
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* This file is part of Haveno.
|
||||
*
|
||||
* Haveno 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.
|
||||
*
|
||||
* Haveno 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 Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package haveno.asset;
|
||||
|
||||
/**
|
||||
* Validates a Ripple address using a regular expression.
|
||||
*/
|
||||
public class RippleAddressValidator extends RegexAddressValidator {
|
||||
|
||||
public RippleAddressValidator() {
|
||||
super("^r[1-9A-HJ-NP-Za-km-z]{25,34}$");
|
||||
}
|
||||
|
||||
public RippleAddressValidator(String errorMessageI18nKey) {
|
||||
super("^r[1-9A-HJ-NP-Za-km-z]{25,34}$", errorMessageI18nKey);
|
||||
}
|
||||
}
|
28
assets/src/main/java/haveno/asset/coins/Ripple.java
Normal file
28
assets/src/main/java/haveno/asset/coins/Ripple.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* This file is part of Haveno.
|
||||
*
|
||||
* Haveno 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.
|
||||
*
|
||||
* Haveno 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 Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package haveno.asset.coins;
|
||||
|
||||
import haveno.asset.Coin;
|
||||
import haveno.asset.RippleAddressValidator;
|
||||
|
||||
public class Ripple extends Coin {
|
||||
|
||||
public Ripple() {
|
||||
super("Ripple", "XRP", new RippleAddressValidator());
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ haveno.asset.coins.BitcoinCash
|
|||
haveno.asset.coins.Ether
|
||||
haveno.asset.coins.Litecoin
|
||||
haveno.asset.coins.Monero
|
||||
haveno.asset.coins.Ripple
|
||||
haveno.asset.tokens.TetherUSDERC20
|
||||
haveno.asset.tokens.TetherUSDTRC20
|
||||
haveno.asset.tokens.USDCoinERC20
|
||||
|
|
44
assets/src/test/java/haveno/asset/coins/RippleTest.java
Normal file
44
assets/src/test/java/haveno/asset/coins/RippleTest.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This file is part of Haveno.
|
||||
*
|
||||
* Haveno 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.
|
||||
*
|
||||
* Haveno 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 Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package haveno.asset.coins;
|
||||
|
||||
import haveno.asset.AbstractAssetTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class RippleTest extends AbstractAssetTest {
|
||||
|
||||
public RippleTest() {
|
||||
super(new Ripple());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidAddresses() {
|
||||
assertValidAddress("r9CxAMAoZAgyVGP8CY9F1arzf9bJg3Y7U8");
|
||||
assertValidAddress("rsXMbDtCAmzSWajWiii7ffWygAjYVNDxY7");
|
||||
assertValidAddress("rE3nYkQy121JEVb37JKX8LSH6wUBnNvNo2");
|
||||
assertValidAddress("rMzucuWFUEE6aM9DC992BqqMgZNPrv4kvi");
|
||||
assertValidAddress("rJUmAFPWE36cpdbN4DUEAFBLtG2xkEavY8");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidAddresses() {
|
||||
assertInvalidAddress("RJUmAFPWE36cpdbN4DUEAFBLtG2xkEavY8");
|
||||
assertInvalidAddress("zJUmAFPWE36cpdbN4DUEAFBLtG2xkEavY8");
|
||||
assertInvalidAddress("1LgfapHEPhZbRF9pMd5WPT35hFXcZS1USrW");
|
||||
}
|
||||
}
|
|
@ -200,6 +200,7 @@ public class CurrencyUtil {
|
|||
result.add(new CryptoCurrency("BCH", "Bitcoin Cash"));
|
||||
result.add(new CryptoCurrency("ETH", "Ether"));
|
||||
result.add(new CryptoCurrency("LTC", "Litecoin"));
|
||||
result.add(new CryptoCurrency("XRP", "Ripple"));
|
||||
result.add(new CryptoCurrency("DAI-ERC20", "Dai Stablecoin"));
|
||||
result.add(new CryptoCurrency("USDT-ERC20", "Tether USD"));
|
||||
result.add(new CryptoCurrency("USDT-TRC20", "Tether USD"));
|
||||
|
|
|
@ -353,6 +353,10 @@
|
|||
-fx-image: url("../../images/xmr_logo.png");
|
||||
}
|
||||
|
||||
#image-xrp-logo {
|
||||
-fx-image: url("../../images/xrp_logo.png");
|
||||
}
|
||||
|
||||
#image-dark-mode-toggle {
|
||||
-fx-image: url("../../images/dark_mode_toggle.png");
|
||||
}
|
||||
|
|
BIN
desktop/src/main/resources/images/xrp_logo.png
Normal file
BIN
desktop/src/main/resources/images/xrp_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
Loading…
Add table
Add a link
Reference in a new issue