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