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

Function addEncodeCallCommands

compressor/cmd/czip-compressor/main.go:160–190  ·  view source on GitHub ↗
(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

158}
159
160func addEncodeCallCommands(cmd *cobra.Command) {
161 encodeCallCmd := &cobra.Command{
162 Use: "encode-call",
163 Short: "Compress a call to a contract: <data> <to>",
164 }
165 encodeCallCmd.AddCommand(&cobra.Command{
166 Use: "decode",
167 Short: "The decompressor contract will only return the decompressed call.",
168 Args: cobra.ExactArgs(2),
169 Run: func(cmd *cobra.Command, args []string) {
170 writeCallForMethod(cmd, compressor.METHOD_DECODE_CALL, args)
171 },
172 })
173 encodeCallCmd.AddCommand(&cobra.Command{
174 Use: "call",
175 Short: "The decompressor contract will execute the decompressed call, discarting the result.",
176 Args: cobra.ExactArgs(2),
177 Run: func(cmd *cobra.Command, args []string) {
178 writeCallForMethod(cmd, compressor.METHOD_EXECUTE_CALL, args)
179 },
180 })
181 encodeCallCmd.AddCommand(&cobra.Command{
182 Use: "call-return",
183 Short: "The decompressor contract will execute the decompressed call and return the result.",
184 Args: cobra.ExactArgs(2),
185 Run: func(cmd *cobra.Command, args []string) {
186 writeCallForMethod(cmd, compressor.METHOD_EXECUTE_CALL_RETURN, args)
187 },
188 })
189 cmd.AddCommand(encodeCallCmd)
190}
191
192func writeCallForMethod(cmd *cobra.Command, method uint, args []string) {
193 buf, err := useBuffer(method, cmd)

Callers 1

initFunction · 0.85

Calls 1

writeCallForMethodFunction · 0.85

Tested by

no test coverage detected