(fragment, data, topics)
| 963 | } |
| 964 | // Decode a filter for the event and the search criteria |
| 965 | decodeEventLog(fragment, data, topics) { |
| 966 | if (typeof (fragment) === "string") { |
| 967 | const f = this.getEvent(fragment); |
| 968 | (0, index_js_3.assertArgument)(f, "unknown event", "eventFragment", fragment); |
| 969 | fragment = f; |
| 970 | } |
| 971 | if (topics != null && !fragment.anonymous) { |
| 972 | const eventTopic = fragment.topicHash; |
| 973 | (0, index_js_3.assertArgument)((0, index_js_3.isHexString)(topics[0], 32) && topics[0].toLowerCase() === eventTopic, "fragment/topic mismatch", "topics[0]", topics[0]); |
| 974 | topics = topics.slice(1); |
| 975 | } |
| 976 | const indexed = []; |
| 977 | const nonIndexed = []; |
| 978 | const dynamic = []; |
| 979 | fragment.inputs.forEach((param, index) => { |
| 980 | if (param.indexed) { |
| 981 | if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") { |
| 982 | indexed.push(fragments_js_1.ParamType.from({ type: "bytes32", name: param.name })); |
| 983 | dynamic.push(true); |
| 984 | } |
| 985 | else { |
| 986 | indexed.push(param); |
| 987 | dynamic.push(false); |
| 988 | } |
| 989 | } |
| 990 | else { |
| 991 | nonIndexed.push(param); |
| 992 | dynamic.push(false); |
| 993 | } |
| 994 | }); |
| 995 | const resultIndexed = (topics != null) ? this.#abiCoder.decode(indexed, (0, index_js_3.concat)(topics)) : null; |
| 996 | const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true); |
| 997 | //const result: (Array<any> & { [ key: string ]: any }) = [ ]; |
| 998 | const values = []; |
| 999 | const keys = []; |
| 1000 | let nonIndexedIndex = 0, indexedIndex = 0; |
| 1001 | fragment.inputs.forEach((param, index) => { |
| 1002 | let value = null; |
| 1003 | if (param.indexed) { |
| 1004 | if (resultIndexed == null) { |
| 1005 | value = new Indexed(null); |
| 1006 | } |
| 1007 | else if (dynamic[index]) { |
| 1008 | value = new Indexed(resultIndexed[indexedIndex++]); |
| 1009 | } |
| 1010 | else { |
| 1011 | try { |
| 1012 | value = resultIndexed[indexedIndex++]; |
| 1013 | } |
| 1014 | catch (error) { |
| 1015 | value = error; |
| 1016 | } |
| 1017 | } |
| 1018 | } |
| 1019 | else { |
| 1020 | try { |
| 1021 | value = resultNonIndexed[nonIndexedIndex++]; |
| 1022 | } |
no test coverage detected