Esempio n. 1
0
        /// <summary>
        /// Retrieve the logs for a certain filter. Logs marks changes of state on the blockchain for events. Unlike <see cref="Eth1.Api.GetFilterChangesFromLogs" /> or <see cref="Eth1.Api.GetFilterLogs" /> this is made to be used in a non-incremental manner (aka no poll) and will return the Logs that satisfy the filter condition.
        /// </summary>
        /// <param name="filter">Filter conditions.</param>
        /// <returns>Logs that satisfy the <paramref name="filter" />.</returns>
        public async Task <Log[]> GetLogs(LogFilter filter)
        {
            string jsonResponse = await _in3.SendRpc(EthGetLogs, new object[] { filter.ToRPc() });

            return(RpcHandler.From <Log[]>(jsonResponse));
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call <see cref="Eth1.Api.GetFilterChangesFromLogs" />.
        /// Filters are event catchers running on the Ethereum Client. Incubed has a client-side implementation.
        /// An event will be stored in case it is within to and from blocks, or in the block of blockhash, contains a
        /// transaction to the designed address, and has a word listed on topics.
        /// </summary>
        /// <param name="filter">Model that holds the data for the filter creation.</param>
        /// <returns>The filter id.</returns>
        /// <remarks>
        /// <para>Use the returned filter id to perform other filter operations.</para>
        /// </remarks>
        public async Task <long> NewLogFilter(LogFilter filter)
        {
            string jsonResponse = await _in3.SendRpc(EthNewFilter, new object[] { filter.ToRPc() });

            return(Convert.ToInt64(RpcHandler.From <string>(jsonResponse), 16));
        }