def listunspent(self, minconf=0, maxconf=9999999, addrs=None): """Return unspent transaction outputs in wallet Outputs will have between minconf and maxconf (inclusive) confirmations, optionally filtered to only include txouts paid to addresses in addrs. """ r = None if addrs is None: r = self._call('listunspent', minconf, maxconf) else: addrs = [str(addr) for addr in addrs] r = self._call('listunspent', minconf, maxconf, addrs) r2 = [] for unspent in r: unspent['outpoint'] = COutPoint(lx(unspent['txid']), unspent['vout']) del unspent['txid'] del unspent['vout'] unspent['address'] = CBitcoinAddress(unspent['address']) unspent['scriptPubKey'] = CScript( unhexlify(unspent['scriptPubKey'])) unspent['amount'] = int(unspent['amount'] * COIN) r2.append(unspent) return r2
def getrawchangeaddress(self): """Returns a new Bitcoin address, for receiving change. This is for use with raw transactions, NOT normal use. """ r = self._call('getrawchangeaddress') return CBitcoinAddress(r)
def validateaddress(self, address): """Return information about an address""" r = self._call('validateaddress', str(address)) if r['isvalid']: r['address'] = CBitcoinAddress(r['address']) if 'pubkey' in r: r['pubkey'] = unhexlify(r['pubkey']) return r
def getnewaddress(self, account=None): """Return a new Bitcoin address for receiving payments. If account is not None, it is added to the address book so payments received with the address will be credited to account. """ r = None if account is not None: r = self._call('getnewaddress', account) else: r = self._call('getnewaddress') return CBitcoinAddress(r)
def getaccountaddress(self, account=None): """Return the current Bitcoin address for receiving payments to this account.""" r = self._call('getaccountaddress', account) return CBitcoinAddress(r)