-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
Problem Description
I'm trying to read all price from solana by each time I call the function. When I set solana_network
with devnet
, it was working perfect. However, when I try to use mainet
, testnet
, or pythnet
, it can't work anymore.
Calling method
solana_network="mainnet"
use_program = True
async def SolanaPythClientPriceFunction():
async with PythClient(
first_mapping_account_key=get_key(solana_network, "mapping"),
program_key=get_key(solana_network, "program") if use_program else None,
) as c:
await c.refresh_all_prices()
Debug Console Output
.....venv\Lib\site-packages\pythclient\pythclient.py", line 185, in _refresh_mapping_accounts
raise exceptions.MissingAccountException(f"need account {key} but missing in getProgramAccount response")
pythclient.exceptions.MissingAccountException: need account AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J but missing in getProgramAccount response
I checked the variables with debugger.
pyth-client-py/pythclient/pythclient.py
Lines 174 to 193 in bdd32b4
async def _refresh_mapping_accounts(self, *, account_json: Optional[Dict[str, Any]] = None, slot: Optional[int] = None) -> List[PythMappingAccount]: | |
key = self._first_mapping_account_key | |
existing_mappings = dict((mapping.key, mapping) for mapping in self._mapping_accounts) if self._mapping_accounts else {} | |
mapping_accounts: List[PythMappingAccount] = [] | |
while key: | |
m = existing_mappings.get(key) or PythMappingAccount(key, self.solana) | |
if account_json is not None: | |
m_data = account_json.get(str(key)) | |
if m_data is None: | |
raise exceptions.MissingAccountException(f"need account {key} but missing in getProgramAccount response") | |
assert slot | |
m.update_with_rpc_response(slot, m_data) | |
else: | |
await m.update() | |
mapping_accounts.append(m) | |
key = m.next_account_key | |
self._mapping_accounts = mapping_accounts | |
return self._mapping_accounts |
Until L180, everything works fine. Both key was correctly assigned values. But then, at L183,
m_data = account_json.get(AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J )
it reads empty data.
Is this an error with mapping key? ( I checked with Pyth Network Website, the key is as same as here) Or with the method that I calling it?
Metadata
Metadata
Assignees
Labels
No labels