Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/addresses.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from embit import script
from embit import ec
from binascii import hexlify, unhexlify

from embit import ec, script
from embit.networks import NETWORKS
from binascii import unhexlify, hexlify


def main():
Expand Down
4 changes: 3 additions & 1 deletion examples/change.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
- checks that change output is from the same wallet as well
- prints out transaction information for the user
"""
from embit import bip39, bip32, psbt, script, ec

from binascii import a2b_base64, b2a_base64
from io import BytesIO

from embit import bip32, bip39, ec, psbt, script


def parse_multisig(sc):
"""Takes a script and extracts m,n and pubkeys from it"""
Expand Down
14 changes: 9 additions & 5 deletions examples/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
and build PSBT transaction for signing.
Requires `requests` module (`pip3 install requests`)
"""

import requests

from embit import bip32, finalizer, script
from embit.descriptor import Descriptor
from embit.ec import PublicKey
from embit.networks import NETWORKS
from embit.psbt import PSBT, DerivationPath
from embit.ec import PublicKey
from embit.transaction import Transaction, TransactionInput, TransactionOutput
from embit import script, bip32, finalizer

# link to the explorer API (esplora or mempool.space)
# API = "https://mempool.space/testnet/api"
Expand Down Expand Up @@ -117,9 +119,11 @@
"witness_script": ws,
"redeem_script": rs,
"bip32_derivations": bip32_derivations,
"witness_utxo": TransactionOutput(utxo["value"], script_pubkey)
if d.is_segwit
else None,
"witness_utxo": (
TransactionOutput(utxo["value"], script_pubkey)
if d.is_segwit
else None
),
}
for utxo in utxoarr
]
Expand Down
7 changes: 3 additions & 4 deletions examples/hdkey.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from embit import script
from embit import bip32
from embit import bip39
from embit.networks import NETWORKS
import random

from embit import bip32, bip39, script
from embit.networks import NETWORKS

# example of key and address derivations from mnemonic
# you can check that everything works right
# on https://iancoleman.io/bip39/
Expand Down
12 changes: 4 additions & 8 deletions examples/psbt.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
from embit import script
from embit import bip32
from embit import bip39
from embit.networks import NETWORKS
from embit import psbt
from binascii import unhexlify, hexlify

# base64 encoding
from binascii import a2b_base64, b2a_base64
from binascii import a2b_base64, b2a_base64, hexlify

from embit import bip32, bip39, psbt, script
from embit.networks import NETWORKS
Comment thread
qlrd marked this conversation as resolved.
Resolved

# example of key and address derivations from mnemonic
# you can check that everything works right
Expand Down
8 changes: 3 additions & 5 deletions examples/transactions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from embit import script
from embit import ec
from embit.networks import NETWORKS
from binascii import unhexlify, hexlify
from binascii import hexlify, unhexlify

from embit import ec, script
from embit.transaction import Transaction, TransactionInput, TransactionOutput
from embit import compact


def main():
Expand Down
Loading