public void SetValue(BlockParameterType parameterType) { if (parameterType == BlockParameterType.blockNumber) throw new ArgumentException("Please provide the blockNumber when setting the type as blockNumber", "parameterType"); ParameterType = parameterType; BlockNumber = null; }
public void SetValue(BlockParameterType parameterType) { if (parameterType == BlockParameterType.blockNumber) { throw new ArgumentException("Please provide the blockNumber when setting the type as blockNumber", "parameterType"); } this.ParameterType = parameterType; BlockNumber = null; }
public static FilterBlockType ToFilterBlockType(this BlockParameterType type) { return(type switch { BlockParameterType.Latest => FilterBlockType.Latest, BlockParameterType.Earliest => FilterBlockType.Earliest, BlockParameterType.Pending => FilterBlockType.Pending, BlockParameterType.BlockNumber => FilterBlockType.BlockNumber, _ => FilterBlockType.Latest });
public void Can_read_type(string input, BlockParameterType output) { using StringReader reader = new StringReader(input); using JsonTextReader textReader = new JsonTextReader(reader); JsonSerializer serializer = new JsonSerializer(); BlockParameterConverter converter = new BlockParameterConverter(); serializer.Converters.Add(converter); BlockParameter blockParameter = serializer.Deserialize <BlockParameter>(textReader); Assert.AreEqual(output, blockParameter.Type); }
private FilterBlockType MapFilterBlockType(BlockParameterType type) { switch (type) { case BlockParameterType.Latest: return(FilterBlockType.Latest); case BlockParameterType.Earliest: return(FilterBlockType.Earliest); case BlockParameterType.Pending: return(FilterBlockType.Pending); case BlockParameterType.BlockId: return(FilterBlockType.BlockId); default: return(FilterBlockType.Latest); } }
public static FilterBlockType ToFilterBlockType(this BlockParameterType type) { switch (type) { case BlockParameterType.Latest: return(FilterBlockType.Latest); case BlockParameterType.Earliest: return(FilterBlockType.Earliest); case BlockParameterType.Pending: return(FilterBlockType.Pending); case BlockParameterType.BlockNumber: return(FilterBlockType.BlockNumber); default: return(FilterBlockType.Latest); } }
public void Can_write_type(string output, BlockParameterType input) { BlockParameter blockParameter = new BlockParameter(input); using StringWriter reader = new StringWriter(); using JsonTextWriter textWriter = new JsonTextWriter(reader); JsonSerializer serializer = new JsonSerializer(); BlockParameterConverter converter = new BlockParameterConverter(); serializer.Converters.Add(converter); serializer.Serialize(textWriter, blockParameter); Assert.AreEqual(output, reader.ToString()); }
public void SetValue(BigInteger blockNumber) { ParameterType = BlockParameterType.blockNumber; BlockNumber = new HexBigInteger(blockNumber); }
public BlockParameter(BlockParameterType type) { Type = type; BlockId = new Quantity(BigInteger.Zero); }
public BlockParameter(BlockParameterType type) { Type = type; BlockId = null; }
public FilterBuilder FromBlock(BlockParameterType blockType) { _fromBlock = new BlockParameter(blockType); return(this); }
public void SetValue(string blockNumberHex) { ParameterType = BlockParameterType.blockNumber; BlockNumber = new HexBigInteger(blockNumberHex); }
public void SetValue(HexBigInteger blockNumber) { ParameterType = BlockParameterType.blockNumber; BlockNumber = blockNumber; }
public BlockParameter(BlockParameterType type) { Type = type; }
public BlockParameter(BlockParameterType type) { Type = type; BlockNumber = null; }
private BlockParameter(BlockParameterType type) { ParameterType = type; }
public DefaultBlockParameter(BlockParameterType blockParameterType) { ParameterType = blockParameterType; }