Return a list of Spendable objects for the
        given bitcoin address.
962073
def spendables_for_address(self, address):
        
        spendables = []
        url_append = "?unspentOnly=true&token=%s&includeScript=true" % self.api_key
        url = self.base_url("addrs/%s%s" % (address, url_append))
        result = json.loads(urlopen(url).read().decode("utf8"))
        for txn in result.get("txrefs", []):
            coin_value = txn.get("value")
            script = h2b(txn.get("script"))
            previous_hash = h2b_rev(txn.get("tx_hash"))
            previous_index = txn.get("tx_output_n")
            spendables.append(Tx.Spendable(coin_value, script, previous_hash, previous_index))
        return spendables
673997
def recipients(cls, bigchain):
        """"""

        recipients = []
        for public_key, voting_power in cls.get_validators(bigchain).items():
            recipients.append(([public_key], voting_power))

        return recipients
126058
def get_direct_derivatives(self, address):
    
    derivative_addrs = self._derivatives_by_derived_from.get(address, [])
    return [self.get_target(addr) for addr in derivative_addrs]
394084
def get_billable_items(self):
        
        items = []
        for obj in self.context.getBillableItems():
            if self.is_profile(obj):
                items.append({
                    "obj": obj,
                    "title": obj.Title(),
                    "vat": obj.getAnalysisProfileVAT(),
                    "price": self.format_price(obj.getAnalysisProfilePrice()),
                })
            if self.is_analysis(obj):
                items.append({
                    "obj": obj,
                    "title": obj.Title(),
                    "vat": obj.getVAT(),
                    "price": self.format_price(obj.getPrice()),
                })
        return items
1293114
def get_wallet_addresses(wallet_name, api_key, is_hd_wallet=False,
        zero_balance=None, used=None, omit_addresses=False, coin_symbol='btc'):
    '''
    
    '''
    assert is_valid_coin_symbol(coin_symbol)
    assert api_key
    assert len(wallet_name) <= 25, wallet_name
    assert zero_balance in (None, True, False)
    assert used in (None, True, False)
    assert isinstance(omit_addresses, bool), omit_addresses

    params = {'token': api_key}
    kwargs = {'hd/' if is_hd_wallet else '': wallet_name} # hack!
    url = make_url(coin_symbol, 'wallets', **kwargs)

    if zero_balance is True:
        params['zerobalance'] = 'true'
    elif zero_balance is False:
        params['zerobalance'] = 'false'
    if used is True:
        params['used'] = 'true'
    elif used is False:
        params['used'] = 'false'
    if omit_addresses:
        params['omitWalletAddresses'] = 'true'

    r = requests.get(url, params=params, verify=True, timeout=TIMEOUT_IN_SECONDS)
    return get_valid_json(r)
1372942
def payable(self, s):
        
        s = parseable_str(s)
        return self.address(s) or self.script(s)
1010624
def memory_objects_for_hash(self, n):
        
        return set([self[i] for i in self.addrs_for_hash(n)])
382898
def get_address_transactions(self, address_id, **params):
        """"""
        return self.api_client.get_address_transactions(self.id, address_id, **params)
64257
def transactions_by_address(address, options = {})
      agent.transactions_by_address(self['id'], address, options) do |data, resp|
        yield(data, resp) if block_given?
      end
    end
695728
def currencies(self):
        """"""
        return [m.currency.code for m in self.monies() if m.amount]
540103
def GetCoinAssets(self):
        
        assets = set()
        for coin in self.GetCoins():
            assets.add(coin.Output.AssetId)
        return list(assets)
42419
def items(self):
        ""
        return list(zip(list(self.keys()), list(self.values())))
650383
def hashes(self):
        """"""
        hashes = set()
        if (self.resources is not None):
            for resource in self:
                if (resource.md5 is not None):
                    hashes.add('md5')
                if (resource.sha1 is not None):
                    hashes.add('sha-1')
                if (resource.sha256 is not None):
                    hashes.add('sha-256')
        return(hashes)
1146899
def get_unspents(address, blockchain_client=BlockchainInfoClient()):
    
    if not isinstance(blockchain_client, BlockchainInfoClient):
        raise Exception('A BlockchainInfoClient object is required')

    url = BLOCKCHAIN_API_BASE_URL + "/unspent?format=json&active=" + address

    auth = blockchain_client.auth
    if auth and len(auth) == 2 and isinstance(auth[0], str):
        url = url + "&api_code=" + auth[0]

    r = requests.get(url, auth=auth)
    try:
        unspents = r.json()["unspent_outputs"]
    except ValueError, e:
        raise Exception('Invalid response from blockchain.info.')
    
    return format_unspents(unspents)
1275412
def get_keys_for(self, value):
        
        if callable(value):
            return value(self)
        hash_value = self.get_hash_for(value)
        return self._index[hash_value][:]
372974
def get_accounts(self, fetch=False):
        """"""
        return Accounts(self.resource.accounts, self.client, wallet=self, populate=fetch)
978169
def parse_hash(address):
    '''
    
    '''

    raw = parse(address)

    # Cash addresses
    try:
        if address.find(riemann.network.CASHADDR_PREFIX) == 0:
            if raw.find(riemann.network.CASHADDR_P2SH) == 0:
                return raw[len(riemann.network.CASHADDR_P2SH):]
            if raw.find(riemann.network.CASHADDR_P2PKH) == 0:
                return raw[len(riemann.network.CASHADDR_P2PKH):]
    except TypeError:
        pass

    # Segwit addresses
    try:
        if address.find(riemann.network.BECH32_HRP) == 0:
            if raw.find(riemann.network.P2WSH_PREFIX) == 0:
                return raw[len(riemann.network.P2WSH_PREFIX):]
            if raw.find(riemann.network.P2WPKH_PREFIX) == 0:
                return raw[len(riemann.network.P2WPKH_PREFIX):]
    except TypeError:
        pass

    # Legacy Addresses
    if raw.find(riemann.network.P2SH_PREFIX) == 0:
        return raw[len(riemann.network.P2SH_PREFIX):]
    if raw.find(riemann.network.P2PKH_PREFIX) == 0:
        return raw[len(riemann.network.P2PKH_PREFIX):]