Skip to content

Remove or enhance AlgodResponseType #506

Open
@tulustul

Description

@tulustul

Problem

Version 2.1.0 introduced AlgodResponseType that is returned by most of AlgodClient methods.
It's a union of dict and bytes meaning that I must cast the response type every time I use any algod method.

last_round = cast(dict, algod_client.status())["last-round"]
# instead of 
last_round = algod_client.status()["last-round"]

This complicates the code for no real benefit as the underlying dict is still not typed and the type checker has no idea what fields are inside the dict.

Now I have to add the pointless casting to my multiple repositories that use the algod.

It's a counter-productive way of typing things.

Solution

One of two things:

  1. Remove the return type completely on the algod methods.
  2. Make two versions of each method - one that returns bytes and one that returns a dict. A nice addition would be to have the dict fully typed.

Dependencies

N/A

Urgency

Low, nothing is broken but it prevents me from updating.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions