kevinheavey / anchorpy

The Python Anchor client.
https://kevinheavey.github.io/anchorpy/
MIT License
217 stars 59 forks source link

TypeError: get_account_info() missing 1 required positional argument: 'pubkey' #108

Closed artaasd95 closed 1 year ago

artaasd95 commented 1 year ago

Hi, I am running the AsyncClient to fetch accounts,

addr = PublicKey("...")

async def main():

    async with AsyncClient("https://api.devnet.solana.com") as client:
        res = await client.is_connected()
    print(res)  # True

    # Alternatively, close the client explicitly instead of using a context manager:
    client = AsyncClient("https://api.devnet.solana.com")
    res = await client.is_connected()
    print(res)  # True
    await client.close()

    acc = await PostAccount.fetch(AsyncClient, addr)
    if acc is None:
        # the fetch method returns null when the account is uninitialized
        raise ValueError("account not found")

    # convert to a JSON object
    obj = acc.to_json()
    print(obj)

    # load from JSON

    acc_from_json = PostAccount.from_json(obj)

asyncio.run(main())

The traceback:

True
True
Traceback (most recent call last):
  File "F:\programming\intelligent_dex\core_calculations\order_matching.py", line 41, in <module>
    asyncio.run(main())
  File "C:\Anaconda3\envs\solana\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Anaconda3\envs\solana\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "F:\programming\intelligent_dex\core_calculations\order_matching.py", line 27, in main
    acc = await PostAccount.fetch(AsyncClient, addr)
  File "F:\programming\intelligent_dex\core_calculations\my_client\accounts\post_account.py", line 52, in fetch
    resp = await conn.get_account_info(address, commitment=commitment)
TypeError: get_account_info() missing 1 required positional argument: 'pubkey'
kevinheavey commented 1 year ago

I can't reproduce this