(fragment, values)
| 922 | return topics; |
| 923 | } |
| 924 | encodeEventLog(fragment, values) { |
| 925 | if (typeof (fragment) === "string") { |
| 926 | const f = this.getEvent(fragment); |
| 927 | (0, index_js_3.assertArgument)(f, "unknown event", "eventFragment", fragment); |
| 928 | fragment = f; |
| 929 | } |
| 930 | const topics = []; |
| 931 | const dataTypes = []; |
| 932 | const dataValues = []; |
| 933 | if (!fragment.anonymous) { |
| 934 | topics.push(fragment.topicHash); |
| 935 | } |
| 936 | (0, index_js_3.assertArgument)(values.length === fragment.inputs.length, "event arguments/values mismatch", "values", values); |
| 937 | fragment.inputs.forEach((param, index) => { |
| 938 | const value = values[index]; |
| 939 | if (param.indexed) { |
| 940 | if (param.type === "string") { |
| 941 | topics.push((0, index_js_2.id)(value)); |
| 942 | } |
| 943 | else if (param.type === "bytes") { |
| 944 | topics.push((0, index_js_1.keccak256)(value)); |
| 945 | } |
| 946 | else if (param.baseType === "tuple" || param.baseType === "array") { |
| 947 | // @TODO |
| 948 | throw new Error("not implemented"); |
| 949 | } |
| 950 | else { |
| 951 | topics.push(this.#abiCoder.encode([param.type], [value])); |
| 952 | } |
| 953 | } |
| 954 | else { |
| 955 | dataTypes.push(param); |
| 956 | dataValues.push(value); |
| 957 | } |
| 958 | }); |
| 959 | return { |
| 960 | data: this.#abiCoder.encode(dataTypes, dataValues), |
| 961 | topics: topics |
| 962 | }; |
| 963 | } |
| 964 | // Decode a filter for the event and the search criteria |
| 965 | decodeEventLog(fragment, data, topics) { |
| 966 | if (typeof (fragment) === "string") { |
no test coverage detected