kopia lustrzana https://github.com/bugout-dev/moonstream
Add changes.
rodzic
d0ee979593
commit
483a52bed8
|
@ -47,6 +47,7 @@ from .settings import (
|
|||
)
|
||||
from .settings import bugout_client as bc, entity_client as ec
|
||||
from .web3_provider import multicall, FunctionSignature, connect
|
||||
from .selectors_storage import selectors
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -818,12 +819,16 @@ def get_list_of_support_interfaces(
|
|||
|
||||
calls = []
|
||||
|
||||
for interaface in support_interfaces:
|
||||
list_of_interfaces = list(selectors.keys())
|
||||
|
||||
list_of_interfaces.sort()
|
||||
|
||||
for interaface in list_of_interfaces:
|
||||
calls.append(
|
||||
(
|
||||
contract.address,
|
||||
FunctionSignature(contract.get_function_by_name("supportsInterface"))
|
||||
.encode_data([bytes.fromhex(interaface["selector"].replace("0x", ""))])
|
||||
.encode_data([bytes.fromhex(interaface)])
|
||||
.hex(),
|
||||
)
|
||||
)
|
||||
|
@ -839,22 +844,19 @@ def get_list_of_support_interfaces(
|
|||
|
||||
result = {}
|
||||
|
||||
for i, interface in enumerate(support_interfaces):
|
||||
info = {
|
||||
"name": interface["name"],
|
||||
"selector": interface["selector"],
|
||||
"supported": False,
|
||||
}
|
||||
for i, selector in enumerate(list_of_interfaces):
|
||||
|
||||
if multicall_result[i][0]:
|
||||
info["supported"] = FunctionSignature(
|
||||
supported = FunctionSignature(
|
||||
contract.get_function_by_name("supportsInterface")
|
||||
).decode_data(multicall_result[i][1])
|
||||
print(supported[0], selector, selectors[selector]["name"])
|
||||
if supported[0]:
|
||||
|
||||
result[interface["name"]] = {
|
||||
"supported": info["supported"],
|
||||
"selector": info["selector"],
|
||||
}
|
||||
result[selectors[selector]["name"]] = { # type: ignore
|
||||
"selector": selector,
|
||||
"abi": selectors[selector]["abi"], # type: ignore
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
|
|
|
@ -618,12 +618,12 @@ async def address_info(request: Request, address: str):
|
|||
|
||||
with ThreadPoolExecutor(max_workers=5) as executor:
|
||||
futures.append(
|
||||
executor.submit(
|
||||
check_if_smartcontract,
|
||||
address=address,
|
||||
blockchain_type=blockchain_type,
|
||||
access_id=access_id,
|
||||
)
|
||||
executor.submit(
|
||||
check_if_smartcontract,
|
||||
address=address,
|
||||
blockchain_type=blockchain_type,
|
||||
access_id=access_id,
|
||||
)
|
||||
)
|
||||
|
||||
for future in as_completed(futures):
|
||||
|
@ -692,6 +692,12 @@ def get_contract_interfaces(
|
|||
logger.error(f"Error reading contract info from Brood API: {str(e)}")
|
||||
raise MoonstreamHTTPException(status_code=500, internal_error=e)
|
||||
|
||||
if len(resource.resources) == 0:
|
||||
raise MoonstreamHTTPException(
|
||||
status_code=404,
|
||||
detail="Not found access id",
|
||||
)
|
||||
|
||||
access_id = resource.resources[0].resource_data["access_id"]
|
||||
|
||||
if not access_id:
|
||||
|
|
File diff suppressed because one or more lines are too long
Ładowanie…
Reference in New Issue