// Path: app/src/main/java/rehanced/com/simpleetherwallet/data/WalletDisplay.java
// public class WalletDisplay implements Comparable {
// 
//     public static final byte NORMAL = 0;
//     public static final byte WATCH_ONLY = 1;
//     public static final byte CONTACT = 2;
// 
//     private String name;
//     private String publicKey;
//     private BigInteger balance;
//     private byte type;
// 
//     public WalletDisplay(String name, String publicKey, BigInteger balance, byte type) {
//         this.name = name;
//         this.publicKey = publicKey;
//         this.balance = balance;
//         this.type = type;
//     }
// 
//     public WalletDisplay(String name, String publicKey) {
//         this.name = name;
//         this.publicKey = publicKey;
//         this.balance = null;
//         this.type = CONTACT;
//     }
// 
//     public byte getType() {
//         return type;
//     }
// 
//     public void setType(byte type) {
//         this.type = type;
//     }
// 
//     public BigInteger getBalanceNative() {
//         return balance;
//     }
// 
//     public void setBalance(BigInteger balance) {
//         this.balance = balance;
//     }
// 
//     public double getBalance() {
//         return new BigDecimal(balance).divide(ExchangeCalculator.ONE_ETHER, 8, BigDecimal.ROUND_UP).doubleValue();
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getPublicKey() {
//         return publicKey.toLowerCase();
//     }
// 
//     public void setPublicKey(String publicKey) {
//         this.publicKey = publicKey;
//     }
// 
//     @Override
//     public int compareTo(@NonNull Object o) {
//         return name.compareTo(((WalletDisplay) o).getName());
//     }
// }


import android.content.Context;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import rehanced.com.simpleetherwallet.data.WalletDisplay;

    private AddressNameConverter(Context context) {
        try {
            load(context);
            if (!contains("0xa9981a33f6b1a18da5db58148b2357f22b44e1e0")) {
                put("0xa9981a33f6b1a18da5db58148b2357f22b44e1e0", "Lunary Development ✓", context);
            }
        } catch (Exception e) {
            addressbook = new HashMap<String, String>();
            put("0xa9981a33f6b1a18da5db58148b2357f22b44e1e0", "Lunary Development ✓", context);
        }
        wellknown_addresses = new WellKnownAddresses();
    }

    public synchronized void put(String addresse, String name, Context context) {
        if (name == null || name.length() == 0)
            addressbook.remove(addresse);
        else
            addressbook.put(addresse, name.length() > 22 ? name.substring(0, 22) : name);
        save(context);
    }

    public String get(String addresse) {
        return addressbook.get(addresse);
    }

    public boolean contains(String addresse) {
        return addressbook.containsKey(addresse);
    }

// Path: app/src/main/java/rehanced/com/simpleetherwallet/data/WalletDisplay.java
// public class WalletDisplay implements Comparable {
// 
//     public static final byte NORMAL = 0;
//     public static final byte WATCH_ONLY = 1;
//     public static final byte CONTACT = 2;
// 
//     private String name;
//     private String publicKey;
//     private BigInteger balance;
//     private byte type;
// 
//     public WalletDisplay(String name, String publicKey, BigInteger balance, byte type) {
//         this.name = name;
//         this.publicKey = publicKey;
//         this.balance = balance;
//         this.type = type;
//     }
// 
//     public WalletDisplay(String name, String publicKey) {
//         this.name = name;
//         this.publicKey = publicKey;
//         this.balance = null;
//         this.type = CONTACT;
//     }
// 
//     public byte getType() {
//         return type;
//     }
// 
//     public void setType(byte type) {
//         this.type = type;
//     }
// 
//     public BigInteger getBalanceNative() {
//         return balance;
//     }
// 
//     public void setBalance(BigInteger balance) {
//         this.balance = balance;
//     }
// 
//     public double getBalance() {
//         return new BigDecimal(balance).divide(ExchangeCalculator.ONE_ETHER, 8, BigDecimal.ROUND_UP).doubleValue();
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getPublicKey() {
//         return publicKey.toLowerCase();
//     }
// 
//     public void setPublicKey(String publicKey) {
//         this.publicKey = publicKey;
//     }
// 
//     @Override
//     public int compareTo(@NonNull Object o) {
//         return name.compareTo(((WalletDisplay) o).getName());
//     }
// }


// Path: app/src/main/java/rehanced/com/simpleetherwallet/utils/AddressNameConverter.java
import android.content.Context;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import rehanced.com.simpleetherwallet.data.WalletDisplay;


    private AddressNameConverter(Context context) {
        try {
            load(context);
            if (!contains("0xa9981a33f6b1a18da5db58148b2357f22b44e1e0")) {
                put("0xa9981a33f6b1a18da5db58148b2357f22b44e1e0", "Lunary Development ✓", context);
            }
        } catch (Exception e) {
            addressbook = new HashMap<String, String>();
            put("0xa9981a33f6b1a18da5db58148b2357f22b44e1e0", "Lunary Development ✓", context);
        }
        wellknown_addresses = new WellKnownAddresses();
    }

    public synchronized void put(String addresse, String name, Context context) {
        if (name == null || name.length() == 0)
            addressbook.remove(addresse);
        else
            addressbook.put(addresse, name.length() > 22 ? name.substring(0, 22) : name);
        save(context);
    }

    public String get(String addresse) {
        return addressbook.get(addresse);
    }

    public boolean contains(String addresse) {
        return addressbook.containsKey(addresse);
    }

    public ArrayList<WalletDisplay> getAsAddressbook() {