Skip to content

Commit

Permalink
Merge pull request #448 from BalancerMaxis/lookup_unique_address_on_a…
Browse files Browse the repository at this point in the history
…ll_chains

feat: Lookup unique address on all chains
  • Loading branch information
Tritium-VLK authored Oct 23, 2024
2 parents e136544 + cc2284e commit a657b83
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bal_addresses/addresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,25 @@ def generate_flatbook(self):
flatbook["rate_providers"] = self.flatten_dict(self.rate_providers)
return self.flatten_dict(flatbook)

@staticmethod
def get_address_all_chains(search_string: str) -> dict[str, dict[str, str]]:
"""
Finds addresses for a unique name across all chains
returns a dict with chain as keys and a dict with "path" and "address"
Will throw MultipleMatchesError if the string is not unique on each and every chain
"""
result = {}
for chain in AddrBook.chain_ids_by_name.keys():
print(f"Processing {chain}")
addr_book = AddrBook(chain)
try:
info = addr_book.search_unique(search_string)
result[chain] = info
except NoResultError:
result[chain] = None
print("Not Found")
return result


# Version outside class to allow for recursion on the uninitialized class
def checksum_address_dict(addresses):
Expand Down

0 comments on commit a657b83

Please sign in to comment.