|
8 | 8 | from blockcypher import list_wallet_names |
9 | 9 | from blockcypher import create_unsigned_tx, create_hd_wallet, derive_hd_address, delete_wallet |
10 | 10 | from blockcypher import generate_new_address, generate_multisig_address |
| 11 | +from blockcypher import send_faucet_coins |
11 | 12 |
|
12 | 13 | from blockcypher.utils import is_valid_address, uses_only_hash_chars |
13 | 14 |
|
14 | 15 | import os |
| 16 | +import time |
15 | 17 |
|
16 | 18 |
|
17 | 19 | BC_API_KEY = os.getenv('BC_API_KEY') |
@@ -76,6 +78,7 @@ def test_get_addresses_details(self): |
76 | 78 | assert 'script' in txref, txref |
77 | 79 |
|
78 | 80 |
|
| 81 | +@unittest.SkipTest |
79 | 82 | class CreateUnsignedTX(unittest.TestCase): |
80 | 83 |
|
81 | 84 | def setUp(self): |
@@ -196,6 +199,7 @@ def test_create_from_inputs(self): |
196 | 199 |
|
197 | 200 | class GetAddressDetails(unittest.TestCase): |
198 | 201 |
|
| 202 | + @unittest.SkipTest |
199 | 203 | def test_fetching_unspents(self): |
200 | 204 | # This address I previously sent funds to but threw out the private key |
201 | 205 | address_details = get_address_details( |
@@ -284,21 +288,35 @@ def test_unconfirmed_tx_confidence(self): |
284 | 288 | assert 0 <= tx_details['confidence'] <= 1, tx_details |
285 | 289 |
|
286 | 290 |
|
| 291 | +@unittest.SkipTest |
287 | 292 | class CompressedTXSign(unittest.TestCase): |
288 | 293 |
|
289 | 294 | def setUp(self): |
290 | 295 | self.bcy_faucet_addr = 'CFr99841LyMkyX5ZTGepY58rjXJhyNGXHf' |
291 | 296 | self.to_send_satoshis = 1 |
292 | 297 |
|
| 298 | + |
| 299 | + # generate a new address |
| 300 | + response_dict = generate_new_address( |
| 301 | + coin_symbol='bcy', |
| 302 | + api_key=BC_API_KEY, |
| 303 | + ) |
| 304 | + |
293 | 305 | # Note: this is BCY testnet coin, which is completely worthless and available here for free: |
294 | 306 | # https://accounts.blockcypher.com/blockcypher-faucet |
295 | | - self.bcy_pub_addr = 'CCf3dWFULG2JHyYjmLixBSWGxF9YwTGaae' |
296 | | - self.bcy_privkey_hex = '2e376712b1574d4465ce08c0299ebac0f8ee4e1b90c143543c446b13ea31d1d5' |
297 | | - self.bcy_privkey_wif = 'BpssP5kLsnygEaHuodnpQBChvi2YszWGAgstUfDmXTX3Y4EG3pv4' |
298 | | - self.bcy_pubkey_hex = '2e376712b1574d4465ce08c0299ebac0f8ee4e1b90c143543c446b13ea31d1d5' # not actually used |
| 307 | + self.bcy_pub_addr = response_dict['address'] |
| 308 | + self.bcy_privkey_hex = response_dict['private'] |
| 309 | + self.bcy_privkey_wif = response_dict['wif'] |
299 | 310 |
|
300 | | - # Generation steps: |
301 | | - # $ curl -X POST https://api.blockcypher.com/v1/bcy/test/addrs |
| 311 | + |
| 312 | + # fund it |
| 313 | + faucet_response_dict = send_faucet_coins(self.bcy_pub_addr,100000000,BC_API_KEY) |
| 314 | + |
| 315 | + # check that we have a hash |
| 316 | + assert 'tx_ref' in faucet_response_dict, faucet_response_dict |
| 317 | + |
| 318 | + # wait a minute for the transaction to be confirmed |
| 319 | + time.sleep(60) |
302 | 320 |
|
303 | 321 | def test_simple_spend_hex(self): |
304 | 322 | tx_hash = simple_spend( |
@@ -420,30 +438,36 @@ def test_simple_spend_p2sh(self): |
420 | 438 | raise Exception('Invalid Output Address: %s' % output_obj['addresses'][0]) |
421 | 439 |
|
422 | 440 |
|
| 441 | +@unittest.SkipTest |
423 | 442 | class UncompressedTXSign(unittest.TestCase): |
424 | 443 |
|
425 | 444 | def setUp(self): |
426 | 445 | self.bcy_faucet_addr = 'CFr99841LyMkyX5ZTGepY58rjXJhyNGXHf' |
427 | 446 | self.to_send_satoshis = 1 |
428 | 447 |
|
| 448 | + |
| 449 | + # generate a new address |
| 450 | + response_dict = generate_new_address( |
| 451 | + coin_symbol='bcy', |
| 452 | + api_key=BC_API_KEY, |
| 453 | + ) |
| 454 | + |
429 | 455 | # Note: this is BCY testnet coin, which is completely worthless and available here for free: |
430 | 456 | # https://accounts.blockcypher.com/blockcypher-faucet |
431 | | - self.bcy_pub_addr = 'BtbkHeUzCs7ByHgZnX9UmSsqpD9uZcADXB' |
432 | | - self.bcy_privkey_hex = '669c1078565cc25a358dfc291437e10553dbfefe128a18cb48dfe0bd0774d86e' |
433 | | - self.bcy_privkey_wif = '3TgXuPViKviQ1aKd6yVRmyD6oSVougJgagPbAbb7VykAVwYD3PQ' |
434 | | - self.bcy_pubkey_hex = '0484a07ce10c2f562ff9af96442dfff41f1f608c215583802562b3b0b4a73892740d729682eefd329dbf3a92580638e98aaa738bc05ee08605f29d99987f0c4d4a' # not actually used |
435 | | - |
436 | | - # generation steps: |
437 | | - ''' |
438 | | - from bitmerchant.wallet import Wallet |
439 | | - from bitmerchant.network import BlockCypherTestNet |
440 | | -
|
441 | | - wallet = Wallet.new_random_wallet(network=BlockCypherTestNet) |
442 | | - wallet.private_key.get_key() |
443 | | - wallet.private_key.export_to_wif(compressed=False) |
444 | | - wallet.public_key.get_key(compressed=False) |
445 | | - wallet.public_key.to_address(compressed=False) |
446 | | - ''' |
| 457 | + self.bcy_pub_addr = response_dict['address'] |
| 458 | + self.bcy_privkey_hex = response_dict['private'] |
| 459 | + self.bcy_privkey_wif = response_dict['wif'] |
| 460 | + |
| 461 | + |
| 462 | + # fund it |
| 463 | + faucet_response_dict = send_faucet_coins(self.bcy_pub_addr,100000000,BC_API_KEY) |
| 464 | + |
| 465 | + # check that we have a hash |
| 466 | + assert 'tx_ref' in faucet_response_dict, faucet_response_dict |
| 467 | + |
| 468 | + # wait a minute for the transaction to be confirmed |
| 469 | + time.sleep(60) |
| 470 | + |
447 | 471 |
|
448 | 472 | def test_simple_spend_hex(self): |
449 | 473 | tx_hash = simple_spend( |
|
0 commit comments