does not name a type for IPAddress and Serial

Why am I getting does not name a type for IPAddress and Serial? I want an ESP8266 to pass through serial int data from an Uno to UDP packets to send to another ESP8266.

int code, x;

IPAddress ip(192, 168, 1, 139);
const char* ssid = "JMR";
const char* password = "crystal2965";
#include <SPI.h>         // needed for Arduino versions later than 0018
#include <Ethernet.h>
#include <EthernetUdp.h>         // UDP library from: bjoern@cs.stanford.edu 12/30/2008
#include <ESP8266WiFi.h>
#include <WiFiClient.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
  WiFi.mode(WIFI_STA);
WiFi.config(192, 168, 1, 137);
WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Node7b: Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

unsigned int localPort = 8888;      // local port to listen on

// buffers for receiving and sending data
char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; //buffer to hold incoming packet,

// An EthernetUDP instance to let us send and receive packets over UDP
EthernetUDP Udp;

void setup() {
  // start the Ethernet and UDP:
  Udp.begin(localPort);
  Serial.begin(115200);
}

void loop() {

if (Serial.available) {
  code = Serial.read();
    // send a reply, to the IP address and port that sent us the packet we received
    x = Udp.beginPacket(ip, 8888);
    Serial.print("Packet status: "); Serial.print(x);
    Serial.print("Sent: "); Serial.print(code);
    Udp.write(code);
    Udp.endPacket();
  }
  delay(100);
}

Log:

Build options changed, rebuilding all
node7b1:16: error: 'IPAddress' does not name a type

 IPAddress ip(192, 168, 1, 139);

 ^

node7b1:27: error: 'WiFi' does not name a type

   WiFi.mode(WIFI_STA);

   ^

node7b1:28: error: 'WiFi' does not name a type

 WiFi.config(192, 168, 1, 137);

 ^

node7b1:29: error: 'WiFi' does not name a type

 WiFi.begin(ssid, password);

 ^

node7b1:30: error: 'Serial' does not name a type

   Serial.println("");

   ^

node7b1:33: error: expected unqualified-id before 'while'

   while (WiFi.status() != WL_CONNECTED) {

   ^

node7b1:37: error: 'Serial' does not name a type

   Serial.println("");

   ^

node7b1:38: error: 'Serial' does not name a type

   Serial.print("Node7b: Connected to ");

   ^

node7b1:39: error: 'Serial' does not name a type

   Serial.println(ssid);

   ^

node7b1:40: error: 'Serial' does not name a type

   Serial.print("IP address: ");

   ^

node7b1:41: error: 'Serial' does not name a type

   Serial.println(WiFi.localIP());

   ^

C:\Users\matt\Documents\Arduino\node7b1\node7b1.ino: In function 'void loop()':

node7b1:59: error: cannot convert 'HardwareSerial::available' from type 'int (HardwareSerial::)()' to type 'bool'

 if (Serial.available) {

                     ^

node7b1:62: error: 'ip' was not declared in this scope

     x = Udp.beginPacket(ip, 8888);

                         ^

Multiple libraries were found for "EthernetUdp.h"
 Used: C:\Users\matt\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\libraries\Ethernet
 Not used: C:\Program Files (x86)\Arduino\libraries\Ethernet
 Not used: C:\Program Files (x86)\Arduino\libraries\Ethernet
 Not used: C:\Program Files (x86)\Arduino\libraries\Ethernet
 Not used: C:\Program Files (x86)\Arduino\libraries\Ethernet
exit status 1
'IPAddress' does not name a type