#
Optional Result Field in Off-Chain ProtocolDIP | 161 |
Title | Optional Result Field in Off-Chain Protocol |
Author | Sunmi Lee (@sunmilee), David Wolinsky (@davidiw) |
Status | LastCall |
Type | Informational |
Created | 04/08/2020 |
#
OverviewThis DIP describes an optional result field in Off-Chain command response, and is an extension of DIP-1.
Both the Off-Chain Protocol and Travel Rule Exchange (or PaymentCommand) are defined in DIP-1. The Off-Chain Protocol in its current definition lacks a way to return a complex result outside of a success or a failure. Many types of communication benefit from having richer information in responses that may prevent the need for another message exchange, leading to simpler protocol and reduced latency.
In order to support this, the CommandResponseObject
can leverage an optional result
field. The result
field, if defined, must contain _ObjectType
that uniquely defines other fields within the result.
Here's an example from DIP-10:
CommandResponseObject:
Field | Type | Required? | Description |
---|---|---|---|
_ObjectType | str | Y | The fixed string CommandResponseObject . |
status | str | Y | Either success or failure . |
error | OffChainErrorObject | N | Details of the error when status == "failure" |
result | Object | N | An optional JSON object that may be defined when status == "success". |
cid | str | N | The Command identifier to which this is a response. Must be a UUID according to RFC4122 with "-"'s included and must match the 'cid' of the CommandRequestObject. This field must be set unless the request to which this is responding is unparseable. |