MCPcopy
hub / github.com/canopy-network/canopy / NewAny

Function NewAny

lib/util.go:511–521  ·  view source on GitHub ↗

NewAny() converts a proto.Message into an anypb.Any type

(message proto.Message)

Source from the content-addressed store, hash-verified

509
510// NewAny() converts a proto.Message into an anypb.Any type
511func NewAny(message proto.Message) (*anypb.Any, ErrorI) {
512 // convert the message to a proto any
513 a, err := anypb.New(message)
514 // if an error occurred during the conversion
515 if err != nil {
516 // exit with error
517 return nil, ErrToAny(err)
518 }
519 // exit with any
520 return a, nil
521}
522
523// FromAny() converts an anypb.Any type back into a proto.Message
524func FromAny(any *anypb.Any) (proto.Message, ErrorI) {

Callers 15

newTestTxResultFunction · 0.92
TestCheckSignatureFunction · 0.92
TestCheckMessageFunction · 0.92
TestHandleMessageFunction · 0.92
TestApproveProposalFunction · 0.92
UnmarshalJSONMethod · 0.92
RLPToCanopyTransactionFunction · 0.92
NewChangeParamTxUint64Function · 0.92
NewChangeParamTxStringFunction · 0.92
NewTransactionFunction · 0.92

Calls 2

ErrToAnyFunction · 0.85
NewMethod · 0.65

Tested by 15

newTestTxResultFunction · 0.74
TestCheckSignatureFunction · 0.74
TestCheckMessageFunction · 0.74
TestHandleMessageFunction · 0.74
TestApproveProposalFunction · 0.74
msgFunction · 0.74
TestMaxPacketSizeFunction · 0.74
TestAnyPbFunction · 0.68
TestAddTransactionFunction · 0.68