blockchainethereumblockchain-walleterc20erc721walletxdaidappdecentralizederc1155erc875iosswifttokens
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.
25 lines
692 B
25 lines
692 B
7 years ago
|
// Copyright SIX DAY LLC, Inc. All rights reserved.
|
||
|
|
||
|
import Foundation
|
||
|
|
||
|
struct Token {
|
||
|
let address: Address
|
||
|
let name: String
|
||
|
let symbol: String
|
||
|
let totalSupply: String
|
||
|
let balance: Int64
|
||
|
}
|
||
|
|
||
|
extension Token {
|
||
|
static func from(address: String, json: [String: AnyObject]) -> Token {
|
||
|
let tokenInfo = json["tokenInfo"] as? [String: AnyObject] ?? [:]
|
||
|
return Token(
|
||
|
address: Address(address: address),
|
||
|
name: tokenInfo["name"] as? String ?? "",
|
||
|
symbol: tokenInfo["symbol"] as? String ?? "",
|
||
|
totalSupply: tokenInfo["symbol"] as? String ?? "",
|
||
|
balance: json["balance"] as? Int64 ?? 0
|
||
|
)
|
||
|
}
|
||
|
}
|