private ResultWrapper <Quantity> GetAccountBalance(Address address, BlockParameter blockParameter) { if (blockParameter.Type == BlockParameterType.Pending) { var balance = _blockchainBridge.GetBalance(address); return(ResultWrapper <Quantity> .Success(new Quantity(balance))); } var block = GetBlock(blockParameter); if (block.Result.ResultType == ResultType.Failure) { return(ResultWrapper <Quantity> .Fail(block.Result.Error)); } return(GetAccountBalance(address, block.Data.Header.StateRoot)); }
private ResultWrapper <BigInteger?> GetAccountBalance(Address address, BlockParameter blockParameter) { if (blockParameter.Type == BlockParameterType.Pending) { var balance = _blockchainBridge.GetBalance(address); return(ResultWrapper <BigInteger?> .Success(balance)); } var block = GetBlock(blockParameter); if (block.Result.ResultType == ResultType.Failure) { return(ResultWrapper <BigInteger?> .Fail(block.Result.Error, ErrorType.InternalError, null)); } return(GetAccountBalance(address, block.Data.Header.StateRoot)); }