Skip to content

Commit

Permalink
feat: cast all response int fields to string
Browse files Browse the repository at this point in the history
  • Loading branch information
janezicmatej committed Nov 21, 2024
1 parent 80cb83e commit 321bc65
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion fdc/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,24 @@ def response(self):
c = decode_transaction_data(
a, EMPTY_METHOD_IDENTIFIER + self.response_hex, [abi_bytes_to_hex]
) # type: ignore
return c["data"]

data = c["data"]

ref_stack: list[dict] = [data]
while ref_stack:
d = ref_stack.pop()

for k, v in d.items():
if isinstance(v, dict):
ref_stack.append(v)
if isinstance(v, list):
for i in range(len(v)):
if isinstance(v[i], int):
d[k][i] = str(d[k][i])
if isinstance(v, int):
d[k] = str(d[k])

return data

@classmethod
def from_decoded_dict(cls, attestation_response: FdcAttestationResponse):
Expand Down

0 comments on commit 321bc65

Please sign in to comment.