This interface is used to query the amount of account's unbound ong.

        :param base58_address: a base58 encode address which indicate which account's unbound ong we want to query.
        :return: the amount of unbound ong in the form of int.
425038
def query_unbound_ong(self, base58_address: str) -> int:
        
        contract_address = self.get_asset_address('ont')
        unbound_ong = self.__sdk.rpc.get_allowance("ong", Address(contract_address).b58encode(), base58_address)
        return int(unbound_ong)
946363
def get_module_at_address(self, address):
        
        bases = self.get_module_bases()
        bases.sort()
        bases.append(long(0x10000000000000000))  # max. 64 bit address + 1
        if address >= bases[0]:
            i = 0
            max_i = len(bases) - 1
            while i < max_i:
                begin, end = bases[i:i+2]
                if begin <= address < end:
                    module = self.get_module(begin)
                    here   = module.is_address_here(address)
                    if here is False:
                        break
                    else:   # True or None
                        return module
                i = i + 1
        return None
1046570
def b58decode_int(v):
    ''''''
    v = v.rstrip()
    v = scrub_input(v)

    decimal = 0
    for char in v:
        decimal = decimal * 58 + alphabet.index(char)
    return decimal
851982
def byte_bounds_offset(self):
        
        if self.data.base is None:
            if self.is_indexed:
                basearray = self.data.np_data
            else:
                basearray = self.data
            return 0, len(basearray)
        return int(self.data_start - self.base_start), int(self.data_end - self.base_start)
90656
def get_unspents(self):
        
        self.unspents[:] = NetworkAPI.get_unspent(self.address)
        self.balance = sum(unspent.amount for unspent in self.unspents)
        return self.unspents
1009256
def rpc_get_account_record(self, address, token_type, **con_info):
        
        if not check_account_address(address):
            return {'error': 'Invalid address', 'http_status': 400}

        if not check_token_type(token_type):
            return {'error': 'Invalid token type', 'http_status': 400}

        # must be b58
        if is_c32_address(address):
            address = c32ToB58(address)

        db = get_db_state(self.working_dir)
        account = db.get_account(address, token_type)
        db.close()

        if account is None:
            return {'error': 'No such account', 'http_status': 404}

        state = self.export_account_state(account)
        return self.success_response({'account': state})
771488
def get_balance(self, address):
        
        spendables = self.get_unspent_outputs(address)
        if not spendables:
            logging.warning('address %s has a balance of 0', address)
            return 0

        balance = sum(s.coin_value for s in spendables)
        return balance
743241
def address(self, is_compressed=None):
        
        return self._network.address.for_p2pkh(self.hash160(is_compressed=is_compressed))
1185491
def namedb_get_account_at(cur, address, block_number):
    
    query = 'SELECT * FROM accounts WHERE address = ? AND block_id = ? ORDER BY block_id DESC, vtxindex DESC'
    args = (address, block_number)
    history_rows = namedb_query_execute(cur, query, args)
    ret = []

    for row in history_rows:
        tmp = {}
        tmp.update(row)
        ret.append(tmp)

    if len(ret) > 0:
        # account changed in this block
        return ret
    
    # if the account did not change in this block, then find the latest version of this account at this block
    query = 'SELECT * from accounts WHERE address = ? AND block_id < ? ORDER BY block_id DESC,vtxindex DESC LIMIT 1'
    args = (address, block_number)
    history_rows = namedb_query_execute(cur, query, args)

    for row in history_rows:
        tmp = {}
        tmp.update(row)
        ret.append(tmp)

    return ret
75585
def parse_addresses (self):
        
        # cut off leading mailto: and unquote
        url = urllib.unquote(self.base_url[7:])
        # search for cc, bcc, to and store in headers
        mode = 0 # 0=default, 1=quote, 2=esc
        quote = None
        i = 0
        for i, c in enumerate(url):
            if mode == 0:
                if c == '?':
                    break
                elif c in '<"':
                    quote = c
                    mode = 1
                elif c == '\\':
                    mode = 2
            elif mode==1:
                if c == '"' and quote == '"':
                    mode = 0
                elif c == '>' and quote == '<':
                    mode = 0
            elif mode == 2:
                mode = 0
        if i < (len(url) - 1):
            self.addresses.update(getaddresses(url[:i]))
            try:
                headers = urlparse.parse_qs(url[(i+1):], strict_parsing=True)
                for key, vals in headers.items():
                    if key.lower() in EMAIL_CGI_ADDRESS:
                        # Only the first header value is added
                        self.addresses.update(getaddresses(urllib.unquote(vals[0])))
                    if key.lower() == EMAIL_CGI_SUBJECT:
                        self.subject = vals[0]
            except ValueError as err:
                self.add_warning(_("Error parsing CGI values: %s") % str(err))
        else:
            self.addresses.update(getaddresses(url))
        log.debug(LOG_CHECK, "addresses: %s", self.addresses)
1202092
def encode_base58_address(hex, addr_version)
      base = addr_version + hex
      Base58.encode(base + calc_checksum(base))
    end
1110327
def listunspent(self, address: str) -> list:
        ''''''

        try:
            return cast(dict, self.ext_fetch('listunspent/' + address))['unspent_outputs']
        except KeyError:
            raise InsufficientFunds('Insufficient funds.')
1147450
def int_to_base36(i):
    
    if six.PY2:
        char_set = '0123456789abcdefghijklmnopqrstuvwxyz'
        if i < 0:
            raise ValueError("Negative base36 conversion input.")
        if not isinstance(i, six.integer_types):
            raise TypeError("Non-integer base36 conversion input.")
        if i < 36:
            return char_set[i]
        b36 = ''
        while i != 0:
            i, n = divmod(i, 36)
            b36 = char_set[n] + b36
    else:
        from django.utils.http import int_to_base36
        b36 = int_to_base36(i)
    return b36
410394
def get_account_balance(self, account):
        
        balance = namedb_get_account_balance(account)
        assert isinstance(balance, (int,long)), 'BUG: account balance of {} is {} (type {})'.format(account['address'], balance, type(balance))
        return balance
153407
def rpc_get_account_history(self, address, page, **con_info):
        
        if not check_account_address(address):
            return {'error': 'Invalid address', 'http_status': 400}

        if not check_count(page):
            return {'error': 'Invalid page', 'http_status': 400}

        # must be b58
        if is_c32_address(address):
            address = c32ToB58(address)

        db = get_db_state(self.working_dir)
        page_size = 20
        account_history = db.get_account_history(address, offset=(page * page_size), count=page_size)
        db.close()

        # return credit_value and debit_value as strings, so the unwitting JS developer doesn't get confused
        # as to why large balances get mysteriously converted to doubles.
        ret = [self.export_account_state(hist) for hist in account_history]
        return self.success_response({'history': ret})
391796
def rpc_get_account_tokens(self, address, **con_info):
        
        if not check_account_address(address):
            return {'error': 'Invalid address', 'http_status': 400}

        # must be b58
        if is_c32_address(address):
            address = c32ToB58(address)

        db = get_db_state(self.working_dir)
        token_list = db.get_account_tokens(address)
        db.close()
        return self.success_response({'token_types': token_list})
552588
def b58decode(v):
    ''''''
    v = v.rstrip()
    v = scrub_input(v)

    origlen = len(v)
    v = v.lstrip(alphabet[0:1])
    newlen = len(v)

    acc = b58decode_int(v)

    result = []
    while acc > 0:
        acc, mod = divmod(acc, 256)
        result.append(mod)

    return (b'\0' * (origlen - newlen) + bseq(reversed(result)))