decodeEventLog(eventFragment, data, topics) {
        if (typeof (eventFragment) === "string") {
            eventFragment = this.getEvent(eventFragment);
        }
        if (topics != null && !eventFragment.anonymous) {
            let topicHash = this.getEventTopic(eventFragment);
            if (!isHexString(topics[0], 32) || topics[0].toLowerCase() !== topicHash) {
                logger$d.throwError("fragment/topic mismatch", Logger.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] });
            }
            topics = topics.slice(1);
        }
        let indexed = [];
        let nonIndexed = [];
        let dynamic = [];
        eventFragment.inputs.forEach((param, index) => {
            if (param.indexed) {
                if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") {
                    indexed.push(ParamType.fromObject({ type: "bytes32", name: param.name }));
                    dynamic.push(true);
                }
                else {
                    indexed.push(param);
                    dynamic.push(false);
                }
            }
            else {
                nonIndexed.push(param);
                dynamic.push(false);
            }
        });
        let resultIndexed = (topics != null) ? this._abiCoder.decode(indexed, concat(topics)) : null;
        let resultNonIndexed = this._abiCoder.decode(nonIndexed, data, true);
        let result = [];
        let nonIndexedIndex = 0, indexedIndex = 0;
        eventFragment.inputs.forEach((param, index) => {
            if (param.indexed) {
                if (resultIndexed == null) {
                    result[index] = new Indexed({ _isIndexed: true, hash: null });
                }
                else if (dynamic[index]) {
                    result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] });
                }
                else {
                    try {
                        result[index] = resultIndexed[indexedIndex++];
                    }
                    catch (error) {
                        result[index] = error;
                    }
                }
            }
            else {
                try {
                    result[index] = resultNonIndexed[nonIndexedIndex++];
                }
                catch (error) {
                    result[index] = error;
                }
            }
            // Add the keyword argument if named and safe
            if (param.name && result[param.name] == null) {
                const value = result[index];
                // Make error named values throw on access
                if (value instanceof Error) {
                    Object.defineProperty(result, param.name, {
                        enumerable: true,
                        get: () => { throw wrapAccessError(`property ${JSON.stringify(param.name)}`, value); }
                    });
                }
                else {
                    result[param.name] = value;
                }
            }
        });
        // Make all error indexed values throw on access
        for (let i = 0; i < result.length; i++) {
            const value = result[i];
            if (value instanceof Error) {
                Object.defineProperty(result, i, {
                    enumerable: true,
                    get: () => { throw wrapAccessError(`index ${i}`, value); }
                });
            }
        }
        return Object.freeze(result);
    }
// Decode a filter for the event and the search criteria
Decode a filter for the event and the search criteria
Decode a filter for the event and the search criteria
decodeEventLog(eventFragment, data, topics) {
        if (typeof (eventFragment) === "string") {
            eventFragment = this.getEvent(eventFragment);
        }
        if (topics != null && !eventFragment.anonymous) {
            let topicHash = this.getEventTopic(eventFragment);
            if (!isHexString(topics[0], 32) || topics[0].toLowerCase() !== topicHash) {
                logger$d.throwError("fragment/topic mismatch", Logger.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] });
            }
            topics = topics.slice(1);
        }
        let indexed = [];
        let nonIndexed = [];
        let dynamic = [];
        eventFragment.inputs.forEach((param, index) => {
            if (param.indexed) {
                if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") {
                    indexed.push(ParamType.fromObject({ type: "bytes32", name: param.name }));
                    dynamic.push(true);
                }
                else {
                    indexed.push(param);
                    dynamic.push(false);
                }
            }
            else {
                nonIndexed.push(param);
                dynamic.push(false);
            }
        });
        let resultIndexed = (topics != null) ? this._abiCoder.decode(indexed, concat(topics)) : null;
        let resultNonIndexed = this._abiCoder.decode(nonIndexed, data, true);
        let result = [];
        let nonIndexedIndex = 0, indexedIndex = 0;
        eventFragment.inputs.forEach((param, index) => {
            if (param.indexed) {
                if (resultIndexed == null) {
                    result[index] = new Indexed({ _isIndexed: true, hash: null });
                }
                else if (dynamic[index]) {
                    result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] });
                }
                else {
                    try {
                        result[index] = resultIndexed[indexedIndex++];
                    }
                    catch (error) {
                        result[index] = error;
                    }
                }
            }
            else {
                try {
                    result[index] = resultNonIndexed[nonIndexedIndex++];
                }
                catch (error) {
                    result[index] = error;
                }
            }
            if (param.name && result[param.name] == null) {
                const value = result[index];
                if (value instanceof Error) {
                    Object.defineProperty(result, param.name, {
                        enumerable: true,
                        get: () => { throw wrapAccessError(`property ${JSON.stringify(param.name)}`, value); }
                    });
                }
                else {
                    result[param.name] = value;
                }
            }
        });
        for (let i = 0; i < result.length; i++) {
            const value = result[i];
            if (value instanceof Error) {
                Object.defineProperty(result, i, {
                    enumerable: true,
                    get: () => { throw wrapAccessError(`index ${i}`, value); }
                });
            }
        }
        return Object.freeze(result);
    }
decodeEventLog ( eventFragment , data , topics ) { if ( typeof ( eventFragment ) === "string" ) { eventFragment = this . getEvent ( eventFragment ) ; } if ( topics != null && ! eventFragment . anonymous ) { let topicHash = this . getEventTopic ( eventFragment ) ; if ( ! isHexString ( topics [ 0 ] , 32 ) || topics [ 0 ] . toLowerCase ( ) !== topicHash ) { logger$d . throwError ( "fragment/topic mismatch" , Logger . errors . INVALID_ARGUMENT , { argument : "topics[0]" , expected : topicHash , value : topics [ 0 ] } ) ; } topics = topics . slice ( 1 ) ; } let indexed = [ ] ; let nonIndexed = [ ] ; let dynamic = [ ] ; eventFragment . inputs . forEach ( ( param , index ) => { if ( param . indexed ) { if ( param . type === "string" || param . type === "bytes" || param . baseType === "tuple" || param . baseType === "array" ) { indexed . push ( ParamType . fromObject ( { type : "bytes32" , name : param . name } ) ) ; dynamic . push ( true ) ; } else { indexed . push ( param ) ; dynamic . push ( false ) ; } } else { nonIndexed . push ( param ) ; dynamic . push ( false ) ; } } ) ; let resultIndexed = ( topics != null ) ? this . _abiCoder . decode ( indexed , concat ( topics ) ) : null ; let resultNonIndexed = this . _abiCoder . decode ( nonIndexed , data , true ) ; let result = [ ] ; let nonIndexedIndex = 0 , indexedIndex = 0 ; eventFragment . inputs . forEach ( ( param , index ) => { if ( param . indexed ) { if ( resultIndexed == null ) { result [ index ] = new Indexed ( { _isIndexed : true , hash : null } ) ; } else if ( dynamic [ index ] ) { result [ index ] = new Indexed ( { _isIndexed : true , hash : resultIndexed [ indexedIndex ++ ] } ) ; } else { try { result [ index ] = resultIndexed [ indexedIndex ++ ] ; } catch ( error ) { result [ index ] = error ; } } } else { try { result [ index ] = resultNonIndexed [ nonIndexedIndex ++ ] ; } catch ( error ) { result [ index ] = error ; } } if ( param . name && result [ param . name ] == null ) { const value = result [ index ] ; if ( value instanceof Error ) { Object . defineProperty ( result , param . name , { enumerable : true , get : ( ) => { throw wrapAccessError ( ` ${ JSON . stringify ( param . name ) } ` , value ) ; } } ) ; } else { result [ param . name ] = value ; } } } ) ; for ( let i = 0 ; i < result . length ; i ++ ) { const value = result [ i ] ; if ( value instanceof Error ) { Object . defineProperty ( result , i , { enumerable : true , get : ( ) => { throw wrapAccessError ( ` ${ i } ` , value ) ; } } ) ; } } return Object . freeze ( result ) ; }
Decode a filter for the event and the search criteria
Decode a filter for the event and the search criteria
// Add the keyword argument if named and safe // Make error named values throw on access // Make all error indexed values throw on access