primal100 / pybitcointools

Simple, common-sense Bitcoin-themed Python ECC library
Other
335 stars 151 forks source link

sys:1: RuntimeWarning: coroutine 'BaseCoin.history' was never awaited #48

Closed BalogunMalikO closed 1 year ago

BalogunMalikO commented 1 year ago

I get this error "sys:1: RuntimeWarning: coroutine 'BaseCoin.history' was never awaited" whenever i try to some methods like (get_balances, histoty etc). Can someone kindly help me out here

primal100 commented 1 year ago

Hi,

This works fine for me:

from cryptos.coins import Bitcoin
c = Bitcoin()
c.history('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa')

Probably you are importing from cryptos.async_coins in which case you need to use an asyncio event loop and await.

b0r1ngx commented 3 months ago

Hello @primal100, @BalogunMalikO, with this code:

from cryptos.coins import Litecoin

passphrase = '...'
litecoin = Litecoin(testnet=False)
ltc_wallet = litecoin.p2wpkh_wallet(seed=passphrase)
ltc_wallet.send(to='LL...ho', value=790000, fee=470)

I'm get sys:1: RuntimeWarning: coroutine 'BaseCoin.unspent' was never awaited:

File ".../venv/lib/python3.11/site-packages/cryptos/transaction.py", line 604, in select high = [u for u in unspents if u["value"] >= value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'coroutine' object is not iterable sys:1: RuntimeWarning: coroutine 'BaseCoin.unspent' was never awaited

I'm on macOS