Add MVP Python package structure
This commit is contained in:
parent
45cdd6911a
commit
5e376db385
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ bdkpython.egg-info/
|
||||
__pycache__/
|
||||
libbdkffi.dylib
|
||||
.idea/
|
||||
.DS_Store
|
||||
|
@ -7,21 +7,25 @@ Install the latest release using
|
||||
```shell
|
||||
pip install bdkpython
|
||||
```
|
||||
<br/>
|
||||
|
||||
## Run the tests
|
||||
```shell
|
||||
python -m tox
|
||||
```
|
||||
<br/>
|
||||
|
||||
## Build the package
|
||||
```shell
|
||||
python -m build
|
||||
```
|
||||
<br/>
|
||||
|
||||
## Install locally
|
||||
```shell
|
||||
pip install ./dist/bdkpython-0.0.1-py3-none-any.whl
|
||||
```
|
||||
<br/>
|
||||
|
||||
## Known issues
|
||||
Note that until the fix is merged upstream in [uniffi-rs](https://github.com/mozilla/uniffi-rs), the `loadIndirect()` function in the `bdk.py` module must be replaced with the following:
|
||||
|
13
setup.py
Normal file
13
setup.py
Normal file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name='bdkpython',
|
||||
version='0.0.1',
|
||||
packages=find_packages(where="src"),
|
||||
package_dir={"": "src"},
|
||||
package_data={"bdkpython": ["*.dylib"]},
|
||||
include_package_data=True,
|
||||
zip_safe=False,
|
||||
)
|
1
src/bdkpython/__init__.py
Normal file
1
src/bdkpython/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from bdkpython.bdk import *
|
1891
src/bdkpython/bdk.py
Normal file
1891
src/bdkpython/bdk.py
Normal file
File diff suppressed because it is too large
Load Diff
33
tests/test_bdk.py
Normal file
33
tests/test_bdk.py
Normal file
@ -0,0 +1,33 @@
|
||||
import bdkpython as bdk
|
||||
|
||||
|
||||
# taken from bdk test suite @ https://github.com/bitcoindevkit/bdk/blob/master/src/descriptor/template.rs#L676
|
||||
descriptor = "wpkh(tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy/84h/0h/0h/0/*)"
|
||||
config = bdk.DatabaseConfig.MEMORY("")
|
||||
client = bdk.BlockchainConfig.ELECTRUM(
|
||||
bdk.ElectrumConfig(
|
||||
"ssl://electrum.blockstream.info:60002",
|
||||
None,
|
||||
5,
|
||||
None,
|
||||
100
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def test_address_BIP84_testnet():
|
||||
wallet = bdk.OfflineWallet(descriptor, bdk.Network.TESTNET, config)
|
||||
address = wallet.get_new_address()
|
||||
assert address == "tb1qkmvk2nadgplmd57ztld8nf8v2yxkzmdvvztyse"
|
||||
|
||||
# def test_wallet_balance():
|
||||
# wallet = bdk.OnlineWallet(
|
||||
# descriptor=descriptor,
|
||||
# change_descriptor=descriptor,
|
||||
# network=bdk.Network.TESTNET,
|
||||
# database_config=config,
|
||||
# blockchain_config=client
|
||||
# )
|
||||
# wallet.sync()
|
||||
# balance = wallet.get_balance()
|
||||
# assert balance > 0
|
Loading…
x
Reference in New Issue
Block a user