Fix long description examples after API change

This commit is contained in:
thunderbiscuit 2022-02-16 21:31:39 -05:00
parent a6943af686
commit 7982a73aa7
No known key found for this signature in database
GPG Key ID: 88253696EB836462

View File

@ -13,25 +13,11 @@ The Python language bindings for the [bitcoindevkit](https://github.com/bitcoind
pip install bdkpython pip install bdkpython
``` ```
## Simple examples ## Simple example
**Generate a testnet address**
```python ```python
import bdkpython as bdk import bdkpython as bdk
descriptor = "wpkh(tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy/84h/1h/0h/0/*)"
config = bdk.DatabaseConfig.MEMORY("")
wallet = bdk.OfflineWallet(descriptor, bdk.Network.TESTNET, config)
address = wallet.get_new_address()
print(f"New BIP84 testnet address: {address}")
```
**Sync a wallet using Electrum**
```python
import bdkpython as bdk
descriptor = "wpkh(tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy/84h/1h/0h/0/*)" descriptor = "wpkh(tprv8ZgxMBicQKsPcx5nBGsR63Pe8KnRUqmbJNENAfGftF3yuXoMMoVJJcYeUw5eVkm9WBPjWYt6HMWYJNesB5HaNVBaFc1M6dRjWSYnmewUMYy/84h/1h/0h/0/*)"
config = bdk.DatabaseConfig.MEMORY("") config = bdk.DatabaseConfig.MEMORY("")
client = bdk.BlockchainConfig.ELECTRUM( client = bdk.BlockchainConfig.ELECTRUM(
@ -44,7 +30,7 @@ client = bdk.BlockchainConfig.ELECTRUM(
) )
) )
wallet = bdk.OnlineWallet( wallet = bdk.Wallet(
descriptor=descriptor, descriptor=descriptor,
change_descriptor=descriptor, change_descriptor=descriptor,
network=bdk.Network.TESTNET, network=bdk.Network.TESTNET,
@ -52,15 +38,19 @@ wallet = bdk.OnlineWallet(
blockchain_config=client blockchain_config=client
) )
# print new receive address
address = wallet.get_new_address()
print(f"New BIP84 testnet address: {address}")
# print wallet balance
class LogProgress(bdk.BdkProgress): class LogProgress(bdk.BdkProgress):
def update(self, progress, update): def update(self, progress, update):
pass pass
wallet.sync(progress_update=LogProgress(), max_address_param=20) wallet.sync(progress_update=LogProgress(), max_address_param=20)
balance = wallet.get_balance() balance = wallet.get_balance()
print(f"Wallet balance is: {balance}") print(f"Wallet balance is: {balance}")
```
""" """
rust_ext = RustExtension( rust_ext = RustExtension(
@ -71,7 +61,7 @@ rust_ext = RustExtension(
setup( setup(
name = 'bdkpython', name = 'bdkpython',
version = '0.0.4', version = '0.1.0',
description="The Python language bindings for the bitcoindevkit", description="The Python language bindings for the bitcoindevkit",
long_description=LONG_DESCRIPTION, long_description=LONG_DESCRIPTION,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',