(cmd *cobra.Command)
| 158 | } |
| 159 | |
| 160 | func 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 | |
| 192 | func writeCallForMethod(cmd *cobra.Command, method uint, args []string) { |
| 193 | buf, err := useBuffer(method, cmd) |
no test coverage detected