Skip to content

Commit

Permalink
Add Metis (same of Ethereum)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebellocchia committed Dec 28, 2023
1 parent fbc0f91 commit fd68c7d
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Supported BIP coins:
- Kava
- Kusama (based on BIP44 and ed25519 SLIP-0010, like TrustWallet, it won't generate the same addresses of Polkadot-JS)
- Litecoin (and related test net)
- Metis
- Monero (based on BIP44 and secp256k1 or ed25519 SLIP-0010, it won't generate the same addresses of the official wallets, but it supports subaddresses generation)
- Nano
- Near Protocol
Expand Down
1 change: 1 addition & 0 deletions bip_utils/bip/conf/bip44/bip44_coins.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class Bip44Coins(BipCoins):
KAVA = auto()
KUSAMA_ED25519_SLIP = auto()
LITECOIN = auto()
METIS = auto()
MONERO_ED25519_SLIP = auto()
MONERO_SECP256K1 = auto()
MULTIVERSX = auto()
Expand Down
13 changes: 13 additions & 0 deletions bip_utils/bip/conf/bip44/bip44_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,19 @@ class Bip44Conf:
},
)

# Configuration for Metis
Metis: BipCoinConf = BipCoinConf(
coin_names=CoinsConf.Metis.CoinNames(),
coin_idx=Slip44.ETHEREUM,
is_testnet=False,
def_path=DER_PATH_NON_HARDENED_FULL,
key_net_ver=_BIP44_BTC_KEY_NET_VER_MAIN,
wif_net_ver=None,
bip32_cls=Bip32Slip10Secp256k1,
addr_cls=EthAddrEncoder,
addr_params={},
)

# Configuration for Monero (ed25519 SLIP-0010)
MoneroEd25519Slip: BipCoinConf = BipCoinConf(
coin_names=CoinsConf.MoneroMainNet.CoinNames(),
Expand Down
1 change: 1 addition & 0 deletions bip_utils/bip/conf/bip44/bip44_conf_getter.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class Bip44ConfGetterConst:
Bip44Coins.KUSAMA_ED25519_SLIP: Bip44Conf.KusamaEd25519Slip,
Bip44Coins.LITECOIN: Bip44Conf.LitecoinMainNet,
Bip44Coins.LITECOIN_TESTNET: Bip44Conf.LitecoinTestNet,
Bip44Coins.METIS: Bip44Conf.Metis,
Bip44Coins.MONERO_ED25519_SLIP: Bip44Conf.MoneroEd25519Slip,
Bip44Coins.MONERO_SECP256K1: Bip44Conf.MoneroSecp256k1,
Bip44Coins.MULTIVERSX: Bip44Conf.Elrond,
Expand Down
6 changes: 6 additions & 0 deletions bip_utils/coin_conf/coins_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,12 @@ class CoinsConf:
},
)

# Configuration for Metis
Metis: CoinConf = CoinConf(
coin_name=CoinNames("Metis", "METIS"),
params={},
)

# Configuration for Monero main net
MoneroMainNet: CoinConf = CoinConf(
coin_name=CoinNames("Monero", "XMR"),
Expand Down
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ irisnet
kava
litecoin
matic
metis
monero
multiversx
okex chain
Expand Down
1 change: 1 addition & 0 deletions readme/bip44.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Supported coins enumerative for BIP-0044:
|Kava|`Bip44Coins.KAVA`|-|
|Kusama (ed25519 SLIP-0010)|`Bip44Coins.KUSAMA_ED25519_SLIP`|-|
|Litecoin|`Bip44Coins.LITECOIN`|`Bip44Coins.LITECOIN_TESTNET`|
|Metis|`Bip44Coins.METIS`|-|
|Monero (ed25519 SLIP-0010, please see the Monero paragraph below)|`Bip44Coins.MONERO_ED25519_SLIP`|-|
|Monero (secp256k1, please see the Monero paragraph below)|`Bip44Coins.MONERO_SECP256K1`|-|
|Nano|`Bip44Coins.NANO`|-|
Expand Down
30 changes: 30 additions & 0 deletions tests/bip/bip44/test_bip44.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,30 @@
"LiNDwbwBhX9djY7tb3gWvrXjuWQNerLjnP",
],
},
# Metis
{
"coin": Bip44Coins.METIS,
"names": ("Metis", "METIS"),
"is_testnet": False,
"seed": b"5eb00bbddcf069084889a8ab9155568165f5c453ccb85e70811aaed6f6da5fc19a5ac40b389cd370d086206dec8aa6c43daea6690f20ad3d8d48b2d2ce9e38e4",
"ex_master": "xprv9s21ZrQH143K3GJpoapnV8SFfukcVBSfeCficPSGfubmSFDxo1kuHnLisriDvSnRRuL2Qrg5ggqHKNVpxR86QEC8w35uxmGoggxtQTPvfUu",
"wif_master": "",
"account": {
"ex_pub": "xpub6DCoCpSuQZB2jawqnGMEPS63ePKWkwWPH4TU45Q7LPXWuNd8TMtVxRrgjtEshuqpK3mdhaWHPFsBngh5GFZaM6si3yZdUsT8ddYM3PwnATt",
"ex_priv": "xprv9zDSoJv1aBcjX6sNgEpE2J9K6MV2MUnXuqXsFgzVn3zY2aHyupaFQdYCtdCbNMkvcTdx9FeN49sgXw6mjrhrFLRSzJVnRYPfSCCgjeg4GxY",
},
"chain_ext": {
"ex_pub": "xpub6EF8jXqFeFEW5bwMU7RpQtHkzE4KJxcqJtvkCjJumzW8CPpacXkb92ek4WzLQXjL93HycJwTPUAcuNxCqFPKKU5m5Z2Vq4nCyh5CyPeBFFr",
"ex_priv": "xprvA1FnL2JMosgCs7rtN5tp3kM2SCDpuVtywg19QLuJDey9KbVS4zSLbELGDFdugxESvYxCU1wEJhDmMXvHKwmpCLd8QSoUJCHmVHCGvpFPxiw",
},
"addresses": [
"0x9858EfFD232B4033E47d90003D41EC34EcaEda94",
"0x6Fac4D18c912343BF86fa7049364Dd4E424Ab9C0",
"0xb6716976A3ebe8D39aCEB04372f22Ff8e6802D7A",
"0xF3f50213C1d2e255e4B2bAD430F8A38EEF8D718E",
"0x51cA8ff9f1C0a99f88E86B8112eA3237F55374cA",
],
},
# Monero (ed25519 SLIP-0010)
{
"coin": Bip44Coins.MONERO_ED25519_SLIP,
Expand Down Expand Up @@ -2382,6 +2406,12 @@
"seed": b"5eb00bbddcf069084889a8ab9155568165f5c453ccb85e70811aaed6f6da5fc19a5ac40b389cd370d086206dec8aa6c43daea6690f20ad3d8d48b2d2ce9e38e4",
"default_address": "LUWPbpM43E2p7ZSh8cyTBEkvpHmr3cB8Ez",
},
# Metis
{
"coin": Bip44Coins.METIS,
"seed": b"5eb00bbddcf069084889a8ab9155568165f5c453ccb85e70811aaed6f6da5fc19a5ac40b389cd370d086206dec8aa6c43daea6690f20ad3d8d48b2d2ce9e38e4",
"default_address": "0x9858EfFD232B4033E47d90003D41EC34EcaEda94",
},
# Monero (ed25519 SLIP-0010)
{
"coin": Bip44Coins.MONERO_ED25519_SLIP,
Expand Down

0 comments on commit fd68c7d

Please sign in to comment.