kopia lustrzana https://github.com/bugout-dev/moonstream
Return empty list when no text candidates for hex signature
Previously, we were returning `null`.pull/18/head
rodzic
1dc6eeca6a
commit
97d9cdb41e
|
@ -17,12 +17,10 @@ def query_for_text_signatures(
|
|||
session: Session,
|
||||
hex_signature: str,
|
||||
db_model: Union[ESDFunctionSignature, ESDEventSignature],
|
||||
) -> Optional[List[str]]:
|
||||
) -> List[str]:
|
||||
query = session.query(db_model)
|
||||
query = query.filter(db_model.hex_signature == hex_signature)
|
||||
results = query.all()
|
||||
if not results:
|
||||
return None
|
||||
text_signatures = []
|
||||
for el in results:
|
||||
text_signatures.append(el.text_signature)
|
||||
|
@ -97,6 +95,8 @@ def main() -> None:
|
|||
source: Optional[str] = None
|
||||
with args.infile as ifp:
|
||||
source = ifp.read().strip()
|
||||
if source is None:
|
||||
raise ValueError("Could not read ABI.")
|
||||
|
||||
abi = decode_abi(source)
|
||||
print(abi.json())
|
||||
|
|
|
@ -76,13 +76,14 @@ class SubscriptionsListResponse(BaseModel):
|
|||
class EVMFunctionSignature(BaseModel):
|
||||
type = "function"
|
||||
hex_signature: str
|
||||
text_signature_candidates: Optional[List[str]] = None
|
||||
text_signature_candidates: List[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class EVMEventSignature(BaseModel):
|
||||
type = "event"
|
||||
hex_signature: str
|
||||
text_signature_candidates: Optional[List[str]] = None
|
||||
text_signature_candidates: List[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class ContractABI(BaseModel):
|
||||
functions: List[EVMFunctionSignature]
|
||||
|
|
Ładowanie…
Reference in New Issue