Skip to content

Commit

Permalink
Publish (#7)
Browse files Browse the repository at this point in the history
* fix

* fix

* fix

* fix
  • Loading branch information
kigawas authored May 30, 2020
1 parent a943f56 commit 4f87900
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Test with pytest
run: |
pytest
poetry run pytest
- name: Publish
env:
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
# python-bip44

Simple python bip44 implementation. Mnemonic + bip32.
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/4e4aa71f4a234dca809d014b0b214220)](https://www.codacy.com/manual/kigawas/python-bip44)
[![CI](https://github.com/kigawas/python-bip44/workflows/Build%20and%20test/badge.svg)](https://github.com/kigawas/python-bip44/actions)
[![Codecov](https://img.shields.io/codecov/c/github/kigawas/python-bip44.svg)](https://codecov.io/gh/kigawas/python-bip44)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/bip44.svg)](https://pypi.org/project/bip44/)
[![PyPI](https://img.shields.io/pypi/v/bip44.svg)](https://pypi.org/project/bip44/)
[![License](https://img.shields.io/github/license/kigawas/python-bip44.svg)](https://github.com/kigawas/python-bip44)

Simple Python bip44 implementation. Mnemonic + bip32.

## Install

`pip install bip44`

## Quick Start

```python
>>> from coincurve import PrivateKey
>>> from bip44.wallet import Wallet
>>> from bip44 import Wallet
>>> from bip44.utils import get_eth_addr
>>> mnemonic = "purity tunnel grid error scout long fruit false embody caught skin gate"
>>> w = Wallet(mnemonic)
Expand Down
3 changes: 0 additions & 3 deletions bip44/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from typing import List

from bip32 import HARDENED_INDEX
from coincurve import PublicKey
from sha3 import keccak_256 as _keccak_256

Expand Down
9 changes: 6 additions & 3 deletions bip44/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@
"ETH": (44 + HARDENED_INDEX, 60 + HARDENED_INDEX),
}

_Mnemonic = Mnemonic("english")

__all__ = ("Wallet",)


class Wallet:
def __init__(self, mnemonic: str):
def __init__(self, mnemonic: str, language: str = "english"):
"""BIP44 HD wallet with a master mnemonic
:param mnemonic (str): The master mnemonic to derive keys
:param language (str, optional): The mnemonic's language, default: "english"
"""
self._mnemonic = mnemonic
self._seed = _Mnemonic.to_seed(mnemonic)
self._seed = Mnemonic(language).to_seed(mnemonic)
self._bip32 = BIP32.from_seed(self._seed)

def _derive_secret(self, path: Union[str, Iterable[int]]) -> bytes:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "bip44"
version = "0.0.2"
description = "Simple python bip44 implementation. Mnemonic + bip32."
description = "Simple Python bip44 implementation. Mnemonic + bip32."
repository = "https://github.com/kigawas/python-bip44"
authors = ["Weiliang Li <to.be.impressive@gmail.com>"]
maintainers = ["Weiliang Li <to.be.impressive@gmail.com>"]
Expand Down

0 comments on commit 4f87900

Please sign in to comment.