Skip to content
Permalink
Browse files

Remove pycoin.ui module. Fix recipes.

  • Loading branch information
richardkiss committed Dec 27, 2018
1 parent 43629c9 commit 644eb292f012d0d6bad04888462dec4e39c33efb
@@ -9,7 +9,6 @@
import sys

from pycoin.encoding.hexbytes import h2b
from pycoin.ui.parseable_str import parseable_str
from pycoin.networks.default import get_current_netcode
from pycoin.networks.registry import network_codes, network_for_netcode

@@ -165,7 +164,7 @@ def parse_key(item, networks):
item = Key(hash160=h2b(item)).address()
networks = [default_network]

item = parseable_str(item)
item = default_network.str(item)

for network in networks:
for f in "hierarchical_key private_key public_key address".split():
@@ -1,6 +1,6 @@
from pycoin.encoding.bytes32 import from_bytes_32
from pycoin.networks.ParseAPI import BitcoinishPayable, ParseAPI
from pycoin.ui.parseable_str import parseable_str, parse_b58
from pycoin.networks.parseable_str import parseable_str, parse_b58

from .hash import groestlHash

@@ -1,9 +1,10 @@
from .parseable_str import parse_b58_double_sha256, parse_bech32, parse_colon_prefix, parseable_str

from pycoin.contrib import segwit_addr
from pycoin.encoding.bytes32 import from_bytes_32
from pycoin.encoding.sec import is_sec_compressed, sec_to_public_pair
from pycoin.intbytes import int2byte
from pycoin.encoding.hexbytes import b2h, h2b
from pycoin.ui.parseable_str import parse_b58_double_sha256, parse_bech32, parse_colon_prefix, parseable_str


class BitcoinishPayable(object):
@@ -18,6 +18,7 @@
from .AddressAPI import make_address_api
from .ParseAPI import ParseAPI
from .ContractAPI import ContractAPI
from .parseable_str import parseable_str


class Network(object):
@@ -205,4 +206,6 @@ def sec_text_for_blob(blob):
network.who_signed = WhoSigned(
script_tools, network.address, network.Key._default_generator)

network.str = parseable_str

return network
File renamed without changes.
No changes.
@@ -20,7 +20,7 @@ def main():
hwif = f.readline().strip()

# turn the bip32 text into a BIP32Node object
BIP32_KEY = network.ui.parse(hwif)
BIP32_KEY = network.parse(hwif)

# create three sec_keys (these are public keys, streamed using the SEC format)

@@ -32,10 +32,10 @@ def main():

# create the 2-of-3 multisig script
# any 2 signatures can release the funds
pay_to_multisig_script = network.script.for_multisig(2, public_key_sec_list)
pay_to_multisig_script = network.contract.for_multisig(2, public_key_sec_list)

# create a "2-of-3" multisig address_for_multisig
the_address = network.ui.address_for_p2s(pay_to_multisig_script)
the_address = network.address.for_p2s(pay_to_multisig_script)

print("Here is your pay 2-of-3 address: %s" % the_address)

@@ -6,7 +6,6 @@
import sys

from pycoin.symbols.btc import network
from pycoin.ui.validate import is_address_valid


def main():
@@ -16,12 +15,12 @@ def main():

# validate the address
address = sys.argv[1]
assert is_address_valid(address)
assert network.parse.address(address) is not None

print("creating coinbase transaction to %s" % address)

tx_in = network.tx.TxIn.coinbase_tx_in(script=b'')
tx_out = network.tx.TxOut(50*1e8, network.ui.script_for_address(address))
tx_out = network.tx.TxOut(50*1e8, network.contract.for_address(address))
tx = network.tx(1, [tx_in], [tx_out])
print("Here is the tx as hex:\n%s" % tx.as_hex())

@@ -10,7 +10,6 @@
import sys

from pycoin.coins.tx_utils import create_tx
from pycoin.ui.validate import is_address_valid
from pycoin.symbols.btc import network


@@ -29,7 +28,7 @@ def main():

# make sure the address is valid
payable = sys.argv[3]
assert is_address_valid(payable)
assert network.parse.address(payable) is not None

# create the unsigned transaction
tx = create_tx([spendable], [payable])
@@ -4,7 +4,6 @@

from pycoin.coins.tx_utils import sign_tx
from pycoin.encoding.hexbytes import h2b
from pycoin.ui.validate import is_wif_valid
from pycoin.solve.utils import build_p2sh_lookup
from pycoin.symbols.btc import network

@@ -22,7 +21,7 @@ def main():
# get the WIF
with open(sys.argv[2], "r") as f:
wif = f.readline().strip()
assert is_wif_valid(wif)
assert network.parse.wif(wif) is not None

# create the p2sh_lookup
with open(sys.argv[3], "r") as f:
@@ -35,8 +34,8 @@ def main():
# sign the transaction with the given WIF
sign_tx(tx, wifs=[wif], p2sh_lookup=p2sh_lookup)

bad_solution_count = tx.bad_signature_count()
print("tx %s now has %d bad signature(s)" % (tx.id(), bad_solution_count))
bad_solution_count = tx.bad_solution_count()
print("tx %s now has %d bad solution(s)" % (tx.id(), bad_solution_count))

include_unspents = (bad_solution_count > 0)
print("Here is the tx as hex:\n%s" % tx.as_hex(include_unspents=include_unspents))
@@ -30,7 +30,6 @@
"pycoin.services",
"pycoin.solve",
"pycoin.symbols",
"pycoin.ui",
"pycoin.vm",
"pycoin.wallet"
],

0 comments on commit 644eb29

Please sign in to comment.
You can’t perform that action at this time.