(param: ParamType, value: any)
| 1019 | |
| 1020 | // @TODO: Use the coders for this; to properly support tuples, etc. |
| 1021 | const encodeTopic = (param: ParamType, value: any): string => { |
| 1022 | if (param.type === "string") { |
| 1023 | return id(value); |
| 1024 | } else if (param.type === "bytes") { |
| 1025 | return keccak256(hexlify(value)); |
| 1026 | } |
| 1027 | |
| 1028 | if (param.type === "bool" && typeof(value) === "boolean") { |
| 1029 | value = (value ? "0x01": "0x00"); |
| 1030 | } else if (param.type.match(/^u?int/)) { |
| 1031 | value = toBeHex(value); // @TODO: Should this toTwos?? |
| 1032 | } else if (param.type.match(/^bytes/)) { |
| 1033 | value = zeroPadBytes(value, 32); |
| 1034 | } else if (param.type === "address") { |
| 1035 | // Check addresses are valid |
| 1036 | this.#abiCoder.encode( [ "address" ], [ value ]); |
| 1037 | } |
| 1038 | |
| 1039 | return zeroPadValue(hexlify(value), 32); |
| 1040 | }; |
| 1041 | |
| 1042 | values.forEach((value, index) => { |
| 1043 |
nothing calls this directly
no test coverage detected