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

Function writeCallsForMethod

compressor/cmd/czip-compressor/main.go:135–158  ·  view source on GitHub ↗
(cmd *cobra.Command, method uint, args []string)

Source from the content-addressed store, hash-verified

133}
134
135func writeCallsForMethod(cmd *cobra.Command, method uint, args []string) {
136 datas := make([][]byte, (len(args))/2)
137 addrs := make([][]byte, (len(args))/2)
138
139 for i := 0; i < len(args); i += 2 {
140 datas[i/2] = common.FromHex(args[i])
141 addrs[i/2] = common.FromHex(args[i+1])
142
143 if len(addrs[i/2]) != 20 {
144 fail(fmt.Errorf("invalid address length"))
145 }
146 }
147
148 buf, err := useBuffer(method, cmd)
149 if err != nil {
150 fail(err)
151 }
152
153 if _, err := buf.WriteCalls(addrs, datas); err != nil {
154 fail(err)
155 }
156
157 fmt.Printf("0x%x\n", buf.Commited)
158}
159
160func addEncodeCallCommands(cmd *cobra.Command) {
161 encodeCallCmd := &cobra.Command{

Callers 1

addEncodeCallsCommandsFunction · 0.85

Calls 3

failFunction · 0.85
useBufferFunction · 0.85
WriteCallsMethod · 0.80

Tested by

no test coverage detected