(param, value)
| 745 | } |
| 746 | // @TODO: Use the coders for this; to properly support tuples, etc. |
| 747 | const encodeTopic = (param, value) => { |
| 748 | if (param.type === "string") { |
| 749 | return id(value); |
| 750 | } |
| 751 | else if (param.type === "bytes") { |
| 752 | return keccak256(value); |
| 753 | } |
| 754 | if (param.type === "bool" && typeof (value) === "boolean") { |
| 755 | value = (value ? "0x01" : "0x00"); |
| 756 | } |
| 757 | else if (param.type.match(/^u?int/)) { |
| 758 | value = toBeHex(value); // @TODO: Should this toTwos?? |
| 759 | } |
| 760 | else if (param.type.match(/^bytes/)) { |
| 761 | value = zeroPadBytes(value, 32); |
| 762 | } |
| 763 | else if (param.type === "address") { |
| 764 | // Check addresses are valid |
| 765 | this.#abiCoder.encode(["address"], [value]); |
| 766 | } |
| 767 | return zeroPadValue(hexlify(value), 32); |
| 768 | }; |
| 769 | values.forEach((value, index) => { |
| 770 | const param = fragment.inputs[index]; |
| 771 | if (!param.indexed) { |
nothing calls this directly
no test coverage detected