From b5b4fc054d617fa1bed067a295f9226bdea4faf9 Mon Sep 17 00:00:00 2001 From: meherett Date: Sun, 12 Mar 2023 16:17:39 +0300 Subject: [PATCH] New Cryptocurrency: Ripple `XRP` wallet protocol added. --- README.md | 1 + hdwallet/cryptocurrencies.py | 80 ++++++++++++++++++------------------ hdwallet/symbols.py | 3 ++ tests/test_symbols.py | 1 + 4 files changed, 45 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index dd9769a..6bb9af3 100644 --- a/README.md +++ b/README.md @@ -337,6 +337,7 @@ This library simplifies the process of creating a new hierarchical deterministic | Rapids | `RPD` | Yes | No | No | 320 | `m/44'/320'/0'/0/0` | | Ravencoin | `RVN` | Yes | No | No | 175 | `m/44'/175'/0'/0/0` | | Reddcoin | `RDD` | Yes | No | No | 4 | `m/44'/4'/0'/0/0` | +| Ripple | `XRP` | Yes | No | No | 144 | `m/44'/144'/0'/0/0` | | Rubycoin | `RBY` | Yes | No | No | 16 | `m/44'/16'/0'/0/0` | | Safecoin | `SAFE` | Yes | No | No | 19165 | `m/44'/19165'/0'/0/0` | | Saluscoin | `SLS` | Yes | No | No | 572 | `m/44'/572'/0'/0/0` | diff --git a/hdwallet/cryptocurrencies.py b/hdwallet/cryptocurrencies.py index cd84ef7..ef24396 100644 --- a/hdwallet/cryptocurrencies.py +++ b/hdwallet/cryptocurrencies.py @@ -4911,6 +4911,46 @@ class ReddcoinMainnet(Cryptocurrency): WIF_SECRET_KEY = 0xbd +class RippleMainnet(Cryptocurrency): + + NAME = "Ripple" + SYMBOL = "XRP" + NETWORK = "mainnet" + SOURCE_CODE = None + COIN_TYPE = CoinType({ + "INDEX": 144, + "HARDENED": True + }) + + SCRIPT_ADDRESS = 0x00 + PUBLIC_KEY_ADDRESS = 0x00 + SEGWIT_ADDRESS = SegwitAddress({ + "HRP": None, + "VERSION": 0x00 + }) + + EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({ + "P2PKH": 0x488ade4, + "P2SH": 0x488ade4, + "P2WPKH": None, + "P2WPKH_IN_P2SH": None, + "P2WSH": None, + "P2WSH_IN_P2SH": None + }) + EXTENDED_PUBLIC_KEY = ExtendedPublicKey({ + "P2PKH": 0x488b21e, + "P2SH": 0x488b21e, + "P2WPKH": None, + "P2WPKH_IN_P2SH": None, + "P2WSH": None, + "P2WSH_IN_P2SH": None + }) + + MASSAGE_PREFIX = None + DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0" + WIF_SECRET_KEY = 0x80 + + class RubycoinMainnet(Cryptocurrency): NAME = "Rubycoin" @@ -6193,46 +6233,6 @@ class WincoinMainnet(Cryptocurrency): WIF_SECRET_KEY = 0xc9 -class RippleMainnet(Cryptocurrency): - - NAME = "Ripple" - SYMBOL = "XRP" - NETWORK = "mainnet" - SOURCE_CODE = None - COIN_TYPE = CoinType({ - "INDEX": 144, - "HARDENED": True - }) - - SCRIPT_ADDRESS = 0x00 - PUBLIC_KEY_ADDRESS = 0x00 - SEGWIT_ADDRESS = SegwitAddress({ - "HRP": None, - "VERSION": 0x00 - }) - - EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({ - "P2PKH": 0x488ade4, - "P2SH": 0x488ade4, - "P2WPKH": None, - "P2WPKH_IN_P2SH": None, - "P2WSH": None, - "P2WSH_IN_P2SH": None - }) - EXTENDED_PUBLIC_KEY = ExtendedPublicKey({ - "P2PKH": 0x488b21e, - "P2SH": 0x488b21e, - "P2WPKH": None, - "P2WPKH_IN_P2SH": None, - "P2WSH": None, - "P2WSH_IN_P2SH": None - }) - - MASSAGE_PREFIX = None - DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0" - WIF_SECRET_KEY = 0x80 - - class XUEZMainnet(Cryptocurrency): NAME = "XUEZ" diff --git a/hdwallet/symbols.py b/hdwallet/symbols.py index 968efd3..531f6ea 100644 --- a/hdwallet/symbols.py +++ b/hdwallet/symbols.py @@ -276,6 +276,8 @@ XUEZ = "XUEZ" # XinFin XDC = "XDC" +# Ripple +XRP = "XRP" #Ycash YEC = "YEC" # ZClassic @@ -425,6 +427,7 @@ "WC", "XUEZ", "XDC", + "XRP", "YEC", "ZCL", "ZEC", "ZECTEST", diff --git a/tests/test_symbols.py b/tests/test_symbols.py index 32065c6..f1d1d5f 100644 --- a/tests/test_symbols.py +++ b/tests/test_symbols.py @@ -160,6 +160,7 @@ def test_symbols(): assert WC == "WC" assert XUEZ == "XUEZ" assert XDC == "XDC" + assert XRP == "XRP" assert YEC == "YEC" assert ZCL == "ZCL" assert ZEC == "ZEC"