Fix Block model to match server: nest header with camelCase keys
The block endpoint returns block id / prev / timestamp nested under a
"header" object with camelCase keys (blockId, dcId, prevId, prevProof,
timestamp) and a proof of just {proof}. The previous flat snake_case
Block fields never matched the response and always deserialized empty.
Add a BlockHeader dataclass, nest it in Block, make proof.scheme
optional, and cover it with a unit test. Verified live against a dev
chain.
This commit is contained in:
@@ -45,6 +45,7 @@ from .contract import ContractClient
|
||||
from .errors import DragonchainAPIError, DragonchainError
|
||||
from .models import (
|
||||
Block,
|
||||
BlockHeader,
|
||||
BlockProof,
|
||||
GrpcConnectionInfo,
|
||||
ListResponse,
|
||||
@@ -121,6 +122,7 @@ __all__ = [
|
||||
"TransactionTypeClient",
|
||||
# models
|
||||
"Block",
|
||||
"BlockHeader",
|
||||
"BlockProof",
|
||||
"GrpcConnectionInfo",
|
||||
"ListResponse",
|
||||
|
||||
Reference in New Issue
Block a user