def to_ltc(self, type: str) -> str: if isinstance(self.key, (Secp256k1Priv, Secp256k1Pub)): if self.version == Version.PRIVATE: return litecoin.serialize_privkey(self.key.get_private_bytes(), True, type) else: return litecoin.pubkey_to_address(type, self.key.get_public_bytes().hex()) else: raise ValueError("Can only derive LTC from Secp256k1")
def test_serialize_privkey(self): for priv_details in self.priv_pub_addr: txin_type, privkey, compressed = deserialize_privkey( priv_details['priv']) priv2 = serialize_privkey(privkey, compressed, txin_type) self.assertEqual(priv_details['exported_privkey'], priv2)
def test_serialize_privkey(self): for priv_details in self.priv_pub_addr: txin_type, privkey, compressed = deserialize_privkey(priv_details['priv']) priv2 = serialize_privkey(privkey, compressed, txin_type) self.assertEqual(priv_details['exported_privkey'], priv2)
def to_ltc(self, type: str) -> str: if self.version == Version.PRIVATE: return litecoin.serialize_privkey(self.key.get_private_bytes(), True, type) else: return litecoin.pubkey_to_address(type, self.key.get_public_bytes().hex())