SDK Data Models

// Selecting Blockchain Network 
BlockchainNetwork: {
    "EthMainnet"
    "EthTestnet"
    "BitcoinMainnet"
    "BitcoinTestnet"
}

// Base Transaction
public class Transaction: NSObject {
    public var blockHash: String?
    public var blockNumber: Int?
    public var from: String?
    public var txFee: Int?                
    public var txHash: String?        
    public var to: String?
    public var value: Double?
    public var timestamp: Date?     
    public var blockchainNetwork: BlockchainNetwork?
    public var fromUserData: UserData?    // User Data of from address account (if exists)
    public var toUserData: UserData?      // User Data of to address account   (if exists)
    public var isUserFromUser: Bool?      // true if user owns 'from' account address
    public var isUserToUser: Bool?        // true if user owns 'to' account address
    public var conversionValue: Double?   // USD value   
}


// Ethereum Transaction extends Transaction class
public class EthereumTransaction: Transaction {
    public var gas: Int?
    public var gasPrice: Int?
    public var gasUsed: String?    (moved)
    public var input: String?
	
    public var tokenValue: Double?
    public var smartContractAddress: String?
    public var smartContractType: String?   
    public var logIndex: Int?              
}

// Bitcoin Transaction extends Transaction class
public class BitcoinTransaction: Transaction {
    public var fromAddresses: [String]?     // Array of 'from' address. Inclusive of 'from'
    public var txId: String?
    public var voutIndex: Int?
    public var scriptPubKey: ScriptPubKey?
    public var toAddresses: [String]?      // Array of 'to' address. Inclusive of 'from'
    public var locktime: Int?           
    public var coinbase: String?           // If this was a mining transaction, coinbase is the 'from' address. 
    public var spent: Bool?
}

// Bitcoin MetaData
public struct ScriptPubKey {
    public var asm: String?
    public var hex: String?
    public var regSigns: Int64?
    public var type: String?
    public var addresses: [String]?
}


// Market Data
public class MarketValue: NSObject {
    public var closePrice: String?
    public var openPrice: String?
    public var symbol: String?
    public var timestamp: Date?
    public var blockchainNetwork: BlockchainNetwork?
}

//User Data
public class UserData: NSObject {
    public var userId: String = ""
    public var name: String = ""
    public var avatar: String = ""
}

//Account
public class Account: NSObject {
    public var address: String?
    public var blockchainNetwork: BlockchainNetwork?        
    public var nickname: String?
    public var autoShare: Bool?
    public var userId: String?
    public var isMyAccount: Bool
    public var hasMnemonic: Bool
    public var hasPrivateKey: Bool
}

//User Connection
public class UserConnection: NSObject {
    public var otherUserId: UserData?
    public var otherUserSharedAccounts: [Account]!
    public var mySharedAccounts: [Account]!
}

//Pending Connection
public class PendingConnectionRequest: NSObject {
    public var sender: UserData?
    public var receiver: UserData?
}

//Searched Contact
public class SearchedContact: NSObject {
    public var userId: String?
    public var name: String?
    public var avatar: String?
}