algorand / algorand/py-algorand-sdk

Remove or enhance AlgodResponseType

Aperta
#506 2 commenti 1 reazione 0 assegnatari Vedi su GitHub
new-feature-request
Lingua principale
Python
Stelle
274
Fork
145
Merge medio
3h 1m
PR unite (30g)
2

Descrizione

## 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.
```py
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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.