js-algorand-sdk
js-algorand-sdk copied to clipboard
BlockResponse class incorrectly modeled
Subject of the issue
The BlockResponse.from_obj_for_encoding() returns a class object that has incorrect typing.
- Software version: 2.7.0
Steps to reproduce
const blockRespRaw = algodClient.block(12345).do()
const incorrectTypedBlockResponse = modelsv2.BlockResponse.from_object_for_encoding(blockResponseRaw)
Expected behaviour
Passing the algodClient.block() through modelsv2.BlockResponse.from_obj_for_encoding() should produce an object in which the block property is a Block and not a BlockHeader.
Actual behaviour
Instead, the block property of the BlockResponse class is typed as a BlockHeader and thus does not allow accessing the rest of the block contents.
Good point, this type is not accurate
Fixed by #875