An advanced Ethereum/EVM mobile wallet
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
alpha-wallet-ios/Trust/Models/Token.swift

22 lines
678 B

// Copyright SIX DAY LLC. All rights reserved.
import Foundation
struct Token {
let address: Address
let name: String
let symbol: String
let decimals: Int
}
extension Token {
static func from(address: String, json: [String: AnyObject]) -> Token {
let tokenInfo = json["tokenInfo"] as? [String: AnyObject] ?? [:]
return Token(
address: Address(address: tokenInfo["address"] as? String ?? ""),
name: tokenInfo["name"] as? String ?? "",
symbol: tokenInfo["symbol"] as? String ?? "",
decimals: tokenInfo["decimals"] as? Int ?? Int(tokenInfo["decimals"] as? String ?? "") ?? 0
)
}
}