Exemplo n.º 1
0
    def test_inputs(self):
        """ Check if BTC key being used has enough inputs
        """

        from registrar.config import BTC_PRIV_KEY
        btc_address = get_address_from_privkey(BTC_PRIV_KEY)

        #print "Testing address: %s" % btc_address

        client = BlockcypherClient(api_key=BLOCKCYPHER_TOKEN)

        unspents = get_unspents(btc_address, client)

        total_satoshis = 0
        counter = 0
        for unspent in unspents:

            counter += 1
            total_satoshis += unspent['value']

        btc_amount = satoshis_to_btc(total_satoshis)
        btc_amount = float(btc_amount)

        self.assertGreater(btc_amount,
                           0.01,
                           msg="Don't have enough inputs in btc address")
Exemplo n.º 2
0
def get_balance_from_unspents(address):
    """ Check if BTC key being used has enough balance on unspents
    """

    client = BlockcypherClient(api_key=BLOCKCYPHER_TOKEN)

    unspents = get_unspents(address, client)

    total_satoshis = 0
    counter = 0

    for unspent in unspents:

        counter += 1
        total_satoshis += unspent['value']

    btc_amount = satoshis_to_btc(total_satoshis)
    btc_amount = float(btc_amount)

    return btc_amount
Exemplo n.º 3
0
def get_balance_from_unspents(address):
    """ Check if BTC key being used has enough balance on unspents
    """

    client = BlockcypherClient(api_key=BLOCKCYPHER_TOKEN)

    unspents = get_unspents(address, client)

    total_satoshis = 0
    counter = 0

    for unspent in unspents:

        counter += 1
        total_satoshis += unspent['value']

    btc_amount = satoshis_to_btc(total_satoshis)
    btc_amount = float(btc_amount)

    return btc_amount
Exemplo n.º 4
0
    def test_inputs(self):
        """ Check if BTC key being used has enough inputs
        """

        from registrar.config import BTC_PRIV_KEY
        btc_address = get_address_from_privkey(BTC_PRIV_KEY)

        #print "Testing address: %s" % btc_address

        client = BlockcypherClient(api_key=BLOCKCYPHER_TOKEN)

        unspents = get_unspents(btc_address, client)

        total_satoshis = 0
        counter = 0
        for unspent in unspents:

            counter += 1
            total_satoshis += unspent['value']

        btc_amount = satoshis_to_btc(total_satoshis)
        btc_amount = float(btc_amount)

        self.assertGreater(btc_amount, 0.01, msg="Don't have enough inputs in btc address")
Exemplo n.º 5
0
 def test_blockcypher_get_unspents(self):
     client = blockcypher.BlockcypherClient()
     unspents = blockcypher.get_unspents(self.address, client)
     self.compare_total_value(unspents)
     self.compare_unspents(unspents)
Exemplo n.º 6
0
 def test_blockcypher_get_unspents(self):
     client = blockcypher.BlockcypherClient()
     unspents = blockcypher.get_unspents(self.address, client)
     self.compare_total_value(unspents)
     self.compare_unspents(unspents)