def sources(self, community): ''' Get available sources in a given community :param community: The community where we want available sources :return: List of InputSource ucoinpy objects ''' data = community.request(bma.tx.Sources, req_args={'pubkey': self.pubkey}) tx = [] for s in data['sources']: tx.append(InputSource.from_bma(s)) return tx
def load_from_json(self, data): self._transfers = [] data_sent = data['transfers'] for s in data_sent: if s['metadata']['issuer'] == self.wallet.pubkey: self._transfers.append(Transfer.load(s)) else: self._transfers.append(Received.load(s)) for s in data['sources']: self.available_sources.append(InputSource.from_inline(s['inline'])) self.latest_block = data['latest_block']
def load_from_json(self, data): self._transfers = [] data_sent = data['transfers'] for s in data_sent: self._transfers.append(Transfer.load(s)) for s in data['sources']: self.available_sources.append(InputSource.from_inline(s['inline'])) for d in data['dividends']: self._dividends.append(d) self.latest_block = data['latest_block']
async def sources(self, community): """ Get available sources in a given community :param sakia.core.community.Community community: The community where we want available sources :return: List of InputSource ucoinpy objects """ tx = [] try: data = await community.bma_access.future_request(bma.tx.Sources, req_args={'pubkey': self.pubkey}) for s in data['sources']: tx.append(InputSource.from_bma(s)) except NoPeerAvailable as e: logging.debug(str(e)) return tx