-
Notifications
You must be signed in to change notification settings - Fork 106
/
taprpc_utils.go
42 lines (37 loc) · 1.39 KB
/
taprpc_utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package taprpc
import "google.golang.org/protobuf/encoding/protojson"
var (
// ProtoJSONMarshalOpts is a struct that holds the default marshal
// options for marshaling protobuf messages into JSON in a
// human-readable way. This should only be used in the CLI and in
// integration tests.
ProtoJSONMarshalOpts = &protojson.MarshalOptions{
EmitUnpopulated: true,
UseProtoNames: true,
Indent: " ",
UseHexForBytes: true,
}
// ProtoJSONUnmarshalOpts is a struct that holds the default unmarshal
// options for un-marshaling lncli JSON into protobuf messages. This
// should only be used in the CLI and in integration tests.
ProtoJSONUnmarshalOpts = &protojson.UnmarshalOptions{
AllowPartial: false,
UseHexForBytes: true,
}
// RESTJsonMarshalOpts is a struct that holds the default marshal
// options for marshaling protobuf messages into REST JSON in a
// human-readable way. This should be used when interacting with the
// REST proxy only.
RESTJsonMarshalOpts = &protojson.MarshalOptions{
EmitUnpopulated: true,
UseProtoNames: true,
UseHexForBytes: true,
}
// RESTJsonUnmarshalOpts is a struct that holds the default unmarshal
// options for un-marshaling REST JSON into protobuf messages. This
// should be used when interacting with the REST proxy only.
RESTJsonUnmarshalOpts = &protojson.UnmarshalOptions{
AllowPartial: false,
UseHexForBytes: true,
}
)