(notify interface{})
| 40 | } |
| 41 | |
| 42 | func stringify(notify interface{}) interface{} { |
| 43 | switch val := notify.(type) { |
| 44 | case []byte: |
| 45 | return hex.EncodeToString(val) |
| 46 | case common.Address: |
| 47 | return val.ToBase58() |
| 48 | case bool, string: |
| 49 | return val |
| 50 | case common.Uint256: |
| 51 | return val.ToHexString() |
| 52 | case *big.Int: |
| 53 | return fmt.Sprintf("%d", val) |
| 54 | case []interface{}: |
| 55 | list := make([]interface{}, 0, len(val)) |
| 56 | for _, v := range val { |
| 57 | list = append(list, stringify(v)) |
| 58 | } |
| 59 | return list |
| 60 | default: |
| 61 | log.Warn("notify codec: unsupported type:", reflect.TypeOf(val).String()) |
| 62 | |
| 63 | return val |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | // input byte array should be the following format |
| 68 | // evt\0(4byte) + type(1byte) + usize( bytearray or list) (4 bytes) + data... |
no test coverage detected