Skip to content

Commit

Permalink
Fix the cross chain api change problem (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-bahjati authored Oct 7, 2022
1 parent 4adacfc commit bfe3162
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pyth_observer/crosschain.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ async def get_crosschain_prices(self):
# return a dictionary of id -> {price, conf, expo} for fast lookup
return {
data["id"]: {
"price": int(data["price"]) * 10 ** data["expo"],
"conf": int(data["conf"]) * 10 ** data["expo"],
"publish_time": data["publish_time"],
"prev_publish_time": data["prev_publish_time"],
"price": int(data["price"]["price"]) * 10 ** data["price"]["expo"],
"conf": int(data["price"]["conf"]) * 10 ** data["price"]["expo"],
"publish_time": data["price"]["publish_time"],
}
for data in latest_price_feeds
}

2 comments on commit bfe3162

@cryptofitzle
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, it seems that this change creates this alert during startup of pyth-observer:

2022-10-07 08:14:48.285 | INFO     | __main__:run_alerts:105 - Starting pyth-observer against mainnet: https://api.mainnet-beta.solana.com/
Traceback (most recent call last):
  File "/data/observer.py", line 328, in <module>
    asyncio.run(main(args=args))
  File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/data/observer.py", line 225, in main
    await asyncio.gather(
  File "/data/observer.py", line 223, in run_crosschain_get_price
    crosschain_prices = await crosschain_price_observer.get_crosschain_prices()
  File "/usr/local/lib/python3.8/site-packages/throttler/decorators.py", line 14, in wrapper
    return await func(*args, **kwargs)
  File "/data/pyth_observer/crosschain.py", line 33, in get_crosschain_prices
    return {
  File "/data/pyth_observer/crosschain.py", line 35, in <dictcomp>
    "price": int(data["price"]) * 10 ** data["expo"],
TypeError: int() argument must be a string, a bytes-like object or a number, not 'dict'

@cryptofitzle
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on second thought/view: the error message was a red herring. After pulling the latest podman image, pyth-observer startup was successful.

Please sign in to comment.