Add reference ID exchange object types#274
Conversation
beef99c to
cff14cd
Compare
| # The Command identifier to which this is a response. | ||
| cid: typing.Optional[str] = datafield(default=None) | ||
| # An result JSON object that may be defined when status == "success" | ||
| result: typing.Optional[OffChainResultObject] = datafield(default=None) |
There was a problem hiding this comment.
use dict # pyre-ignore for type definition.
when decoding the response object, result is unknown, as caller should base on request command type to decide what is response type, thus it is unknown when we decode CommandResponseObject.
For example: PaymentCommand response should not have result = ReferenceIDCommandResponse.
It is more flexible to let caller to decode the dict to specific type.
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class OffChainResultObject: |
There was a problem hiding this comment.
change this to ReferenceIDCommandResultObject, may also update https://github.com/diem/dip/pull/164/files "CommandResultObject" to use same name,
When there are multiple result objects, it is better we don't mix their fields.
| } | ||
| ) | ||
| # ReferenceIDCommandResponse: Receiver's onchain account identifier | ||
| receiver_address: typing.Optional[str] = datafield(default=None) |
| # The Command identifier to which this is a response. | ||
| cid: typing.Optional[str] = datafield(default=None) | ||
| # An result JSON object that may be defined when status == "success" | ||
| result: dict # pyre-ignore |
c307257 to
1c61c6d
Compare
|
may add a test to test_offchain_types for decoding CommandResponseObject with result dict |
|
@xli want to take a look at the test? |
Adding data types for reference ID exchange as defined by DIP10