(cmd *cobra.Command)
| 97 | } |
| 98 | |
| 99 | func addEncodeCallsCommands(cmd *cobra.Command) { |
| 100 | encodeCallsCmd := &cobra.Command{ |
| 101 | Use: "encode-calls", |
| 102 | Short: "Compress multiple calls to many contracts: <data> <to> <data> <to> ... <data> <to>", |
| 103 | } |
| 104 | encodeCallsCmd.AddCommand(&cobra.Command{ |
| 105 | Use: "decode", |
| 106 | Short: "The decompressor contract will only return the decompressed calls.", |
| 107 | Args: validateCallsArgs, |
| 108 | Run: func(cmd *cobra.Command, args []string) { |
| 109 | writeCallsForMethod(cmd, compressor.METHOD_DECODE_N_CALLS, args) |
| 110 | }, |
| 111 | }) |
| 112 | encodeCallsCmd.AddCommand(&cobra.Command{ |
| 113 | Use: "call", |
| 114 | Short: "The decompressor contract will execute the decompressed calls, discarting the results.", |
| 115 | Args: validateCallsArgs, |
| 116 | Run: func(cmd *cobra.Command, args []string) { |
| 117 | writeCallsForMethod(cmd, compressor.METHOD_EXECUTE_N_CALLS, args) |
| 118 | }, |
| 119 | }) |
| 120 | cmd.AddCommand(encodeCallsCmd) |
| 121 | } |
| 122 | |
| 123 | func validateCallsArgs(cmd *cobra.Command, args []string) error { |
| 124 | if len(args) < 2 { |
no test coverage detected