| 875 | } |
| 876 | // @TODO: Use the coders for this; to properly support tuples, etc. |
| 877 | const encodeTopic = (param, value) => { |
| 878 | if (param.type === "string") { |
| 879 | return (0, index_js_2.id)(value); |
| 880 | } |
| 881 | else if (param.type === "bytes") { |
| 882 | return (0, index_js_1.keccak256)((0, index_js_3.hexlify)(value)); |
| 883 | } |
| 884 | if (param.type === "bool" && typeof (value) === "boolean") { |
| 885 | value = (value ? "0x01" : "0x00"); |
| 886 | } |
| 887 | else if (param.type.match(/^u?int/)) { |
| 888 | value = (0, index_js_3.toBeHex)(value); // @TODO: Should this toTwos?? |
| 889 | } |
| 890 | else if (param.type.match(/^bytes/)) { |
| 891 | value = (0, index_js_3.zeroPadBytes)(value, 32); |
| 892 | } |
| 893 | else if (param.type === "address") { |
| 894 | // Check addresses are valid |
| 895 | this.#abiCoder.encode(["address"], [value]); |
| 896 | } |
| 897 | return (0, index_js_3.zeroPadValue)((0, index_js_3.hexlify)(value), 32); |
| 898 | }; |
| 899 | values.forEach((value, index) => { |
| 900 | const param = fragment.inputs[index]; |
| 901 | if (!param.indexed) { |