MCPcopy Create free account
hub / github.com/0xsequence/czip / WriteCalls

Method WriteCalls

compressor/encode.go:1068–1097  ·  view source on GitHub ↗
(tos [][]byte, datas [][]byte)

Source from the content-addressed store, hash-verified

1066}
1067
1068func (buf *Buffer) WriteCalls(tos [][]byte, datas [][]byte) (EncodeType, error) {
1069 if len(tos) == 0 {
1070 return Stateless, fmt.Errorf("calls are empty")
1071 }
1072
1073 if len(tos) > 255 {
1074 return Stateless, fmt.Errorf("calls exceeds 255")
1075 }
1076
1077 if len(tos) != len(datas) {
1078 return Stateless, fmt.Errorf("calls and datas have different lengths")
1079 }
1080
1081 // The first byte is the number of calls
1082 buf.commitUint(uint(len(tos)))
1083 buf.end([]byte{}, Stateless)
1084
1085 encodeType := Stateless
1086
1087 for i, to := range tos {
1088 t, err := buf.WriteCall(to, datas[i])
1089 if err != nil {
1090 return Stateless, err
1091 }
1092
1093 encodeType = maxPriority(encodeType, t)
1094 }
1095
1096 return encodeType, nil
1097}

Callers 1

writeCallsForMethodFunction · 0.80

Calls 4

commitUintMethod · 0.95
endMethod · 0.95
WriteCallMethod · 0.95
maxPriorityFunction · 0.85

Tested by

no test coverage detected