2020-05-01 15:33:58 +02:00
|
|
|
import logging
|
|
|
|
|
|
|
|
from lbry.conf import Config
|
|
|
|
from lbry.blockchain.ledger import Ledger
|
|
|
|
from lbry.db import Database
|
|
|
|
from lbry.wallet.sync import SPVSync
|
|
|
|
|
|
|
|
from .base import Service
|
2020-05-21 00:05:13 +02:00
|
|
|
from .api import Client
|
2020-05-01 15:33:58 +02:00
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class LightClient(Service):
|
|
|
|
|
|
|
|
def __init__(self, ledger: Ledger, db_url: str):
|
|
|
|
super().__init__(ledger, db_url)
|
|
|
|
self.client = Client(self, Config().api_connection_url)#ledger.conf)
|
|
|
|
self.sync = SPVSync(self)
|
|
|
|
|
|
|
|
async def search_transactions(self, txids):
|
|
|
|
return await self.client.transaction_search(txids=txids)
|
|
|
|
|
|
|
|
async def get_block_address_filters(self):
|
|
|
|
return await self.client.address_block_filters()
|
|
|
|
|
|
|
|
async def get_transaction_address_filters(self, block_hash):
|
|
|
|
return await self.client.address_transaction_filters(block_hash=block_hash)
|