Skip to content

Commit 108ee4e

Browse files
committed
fix: remove duplicate account_exists
1 parent 347ccb7 commit 108ee4e

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

program_admin/__init__.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,6 @@ async def fetch_minimum_balance(self, size: int) -> int:
114114
async with AsyncClient(self.rpc_endpoint) as client:
115115
return (await client.get_minimum_balance_for_rent_exemption(size)).value
116116

117-
async def account_exists(self, key: PublicKey) -> bool:
118-
async with AsyncClient(self.rpc_endpoint) as client:
119-
response = await client.get_account_info(key)
120-
# The RPC returns null if the account does not exist
121-
return bool(response.value)
122-
123117
async def refresh_program_accounts(self):
124118
async with AsyncClient(self.rpc_endpoint) as client:
125119
logger.info("Refreshing program accounts")
@@ -711,7 +705,7 @@ async def sync_publisher_program(
711705
)
712706

713707
# Initialize the publisher program config if it does not exist
714-
if not (await self.account_exists(publisher_program_config)):
708+
if not (await account_exists(self.rpc_endpoint, publisher_program_config)):
715709
initialize_publisher_program_instruction = initialize_publisher_program(
716710
self.publisher_program_key, authority.public_key
717711
)
@@ -723,7 +717,7 @@ async def sync_publisher_program(
723717
publisher, self.publisher_program_key
724718
)
725719

726-
if not (await self.account_exists(publisher_config_account)):
720+
if not (await account_exists(self.rpc_endpoint, publisher_config_account)):
727721
size = 100048 # This size is for a buffer supporting 5000 price updates
728722
lamports = await self.fetch_minimum_balance(size)
729723
buffer_account, create_buffer_instruction = create_buffer_account(

0 commit comments

Comments
 (0)