support Ripple (XRP)

This commit is contained in:
woodser 2025-08-10 12:38:19 -04:00 committed by woodser
parent 6537586976
commit 7298a6373a
7 changed files with 110 additions and 0 deletions

View file

@ -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);
}
}

View 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());
}
}

View file

@ -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

View 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");
}
}

View file

@ -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"));

View file

@ -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");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB