(cmd *cobra.Command, method uint, args []string)
| 133 | } |
| 134 | |
| 135 | func 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 | |
| 160 | func addEncodeCallCommands(cmd *cobra.Command) { |
| 161 | encodeCallCmd := &cobra.Command{ |
no test coverage detected