コード例 #1
0
ファイル: EthModule.cs プロジェクト: chidionyema/nethermind
        public ResultWrapper <IEnumerable <object> > eth_getFilterChanges(BigInteger filterId)
        {
            var        id         = (int)filterId;
            FilterType filterType = _blockchainBridge.GetFilterType(id);

            switch (filterType)
            {
            case FilterType.BlockFilter:
                return(_blockchainBridge.FilterExists(id)
                        ? ResultWrapper <IEnumerable <object> > .Success(_blockchainBridge.GetBlockFilterChanges(id)
                                                                         .Select(b => new Data.Data(b.Bytes)).ToArray())
                        : ResultWrapper <IEnumerable <object> > .Fail($"Filter with id: '{filterId}' does not exist."));

            case FilterType.PendingTransactionFilter:
                return(_blockchainBridge.FilterExists(id)
                        ? ResultWrapper <IEnumerable <object> > .Success(_blockchainBridge
                                                                         .GetPendingTransactionFilterChanges(id).Select(b => new Data.Data(b.Bytes)).ToArray())
                        : ResultWrapper <IEnumerable <object> > .Fail($"Filter with id: '{filterId}' does not exist."));

            case FilterType.LogFilter:
                return(_blockchainBridge.FilterExists(id)
                        ? ResultWrapper <IEnumerable <object> > .Success(
                           _blockchainBridge.GetLogFilterChanges(id).ToArray())
                        : ResultWrapper <IEnumerable <object> > .Fail($"Filter with id: '{filterId}' does not exist."));

            default:
                throw new NotSupportedException($"Filter type {filterType} is not supported");
            }
        }
コード例 #2
0
        public ResultWrapper <IEnumerable <object> > eth_getFilterChanges(UInt256 filterId)
        {
            int        id         = (int)filterId;
            FilterType filterType = _blockchainBridge.GetFilterType(id);

            switch (filterType)
            {
            case FilterType.BlockFilter:
            {
                return(_blockchainBridge.FilterExists(id)
                        ? ResultWrapper <IEnumerable <object> > .Success(_blockchainBridge.GetBlockFilterChanges(id))
                        : ResultWrapper <IEnumerable <object> > .Fail($"Filter with id: '{filterId}' does not exist."));
            }

            case FilterType.PendingTransactionFilter:
            {
                return(_blockchainBridge.FilterExists(id)
                        ? ResultWrapper <IEnumerable <object> > .Success(_blockchainBridge.GetPendingTransactionFilterChanges(id))
                        : ResultWrapper <IEnumerable <object> > .Fail($"Filter with id: '{filterId}' does not exist."));
            }

            case FilterType.LogFilter:
            {
                return(_blockchainBridge.FilterExists(id)
                        ? ResultWrapper <IEnumerable <object> > .Success(
                           _blockchainBridge.GetLogFilterChanges(id).ToArray())
                        : ResultWrapper <IEnumerable <object> > .Fail($"Filter with id: '{filterId}' does not exist."));
            }

            default:
            {
                throw new NotSupportedException($"Filter type {filterType} is not supported");
            }
            }
        }