Off-Chain Protocol: Optional Result Field
- Dominant language
- JavaScript
- Stars
- 43
- Forks
- 47
- PR merge metrics
- No merged PRs in 30d
Description
---
dip: 161
title: Off-Chain Protocol: Optional Result Field
author: Xiao Li (@xli), SunMi Lee (@sunmilee), David Wolinsky (@davidiw)
type: Informational
discussion-to: https://github.com/diem/dip/issues/161
created: 2021-04-07
updated: 2021-04-07
---
# Overview
Both the Off-Chain Protocol and Travel Rule Exchange (or PaymentCommand) are defined in [DIP-1](https://github.com/diem/dip/blob/main/dips/dip-1.mdx). The Off-Chain Protocol was defined in such a way as to support the minimal requirements for these exchanges, specifically, in this case, asynchronous responses to requests. Many types of communication benefit from synchronous responses as it provides for both protocol simplicity and reduced latency. In order to support synchronous commands, the `CommandResponseObject` can leverage an optional field: `result`. The `result` field, if defined, must contain `__ObjectType` that should uniquely define the shape or other fields within the `result`.
Here's an example from [DIP-10](https://github.com/diem/dip/blob/main/dips/dip-10.md):
```
{
"_ObjectType": "CommandResponseObject",
"status": "success",
"result": {
"_ObjectType": "ReferenceIDCommandResponse",
"recipient_address": "c5ab123458df0003415689adbb47326d",
},
"cid": "12ce83f6-6d18-0d6e-08b6-c00fdbbf085a",
}
```
Contributor guide
Assessment
This issue has not been assessed yet.