Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Mixin/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@
"or" = "or";
"order_details" = "Order Details";
"order_id" = "Order ID";
"order_status" = "Status";
"order_type" = "Order Type";
"order_type_limit" = "Limit";
"order_type_swap" = "Swap";
Expand Down Expand Up @@ -1409,6 +1410,7 @@
"sticker_add_requirements" = "Requires stickers file size larger than %@KB and less than %@KB, width and height between %@ and %@ pixels.";
"sticker_store" = "Sticker Store";
"stickers_count" = "%d stickers";
"stocks" = "Stocks";
"stop" = "Stop";
"stop_playing" = "Stop Playing";
"stop_playing_this_list" = "Stop playing this list?";
Expand Down
2 changes: 2 additions & 0 deletions Mixin/Resources/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@
"or" = "or";
"order_details" = "Order Details";
"order_id" = "Order ID";
"order_status" = "Status";
"order_type" = "Order Type";
"order_type_limit" = "Limit";
"order_type_swap" = "Swap";
Expand Down Expand Up @@ -1409,6 +1410,7 @@
"sticker_add_requirements" = "Requiere un tamaño de archivo de pegatinas superior a %@KB e inferior a %@KB, ancho y alto entre %@ y %@ píxeles.";
"sticker_store" = "Tienda de pegatinas";
"stickers_count" = "%d pegatinas";
"stocks" = "Stocks";
"stop" = "Stop";
"stop_playing" = "Dejar de reproducir";
"stop_playing_this_list" = "¿Dejar de reproducir esta lista?";
Expand Down
2 changes: 2 additions & 0 deletions Mixin/Resources/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@
"or" = "or";
"order_details" = "Order Details";
"order_id" = "Order ID";
"order_status" = "Status";
"order_type" = "Order Type";
"order_type_limit" = "Limit";
"order_type_swap" = "Swap";
Expand Down Expand Up @@ -1409,6 +1410,7 @@
"sticker_add_requirements" = "スタンプのサイズは%@KB以上%@KB未満、 幅と高さは%@ピクセルから%@ピクセルである必要があります";
"sticker_store" = "スタンプストア";
"stickers_count" = "%d個のスタンプ";
"stocks" = "Stocks";
"stop" = "Stop";
"stop_playing" = "再生を止める";
"stop_playing_this_list" = "再生を止めて、プレイリストを閉じますか?";
Expand Down
2 changes: 2 additions & 0 deletions Mixin/Resources/ru.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@
"or" = "or";
"order_details" = "Order Details";
"order_id" = "Order ID";
"order_status" = "Status";
"order_type" = "Order Type";
"order_type_limit" = "Limit";
"order_type_swap" = "Swap";
Expand Down Expand Up @@ -1409,6 +1410,7 @@
"sticker_add_requirements" = "Требуется размер файла наклеек больше %@KB и меньше %@KB, ширина и высота от %@ до %@ пикселей.";
"sticker_store" = "Магазин наклеек";
"stickers_count" = "%d стикеров";
"stocks" = "Stocks";
"stop" = "Stop";
"stop_playing" = "Хватит играть";
"stop_playing_this_list" = "Прекратить воспроизведение этого списка?";
Expand Down
2 changes: 2 additions & 0 deletions Mixin/Resources/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@
"or" = "或者";
"order_details" = "订单详情";
"order_id" = "订单 ID";
"order_status" = "状态";
"order_type" = "订单类型";
"order_type_limit" = "限价";
"order_type_swap" = "闪兑";
Expand Down Expand Up @@ -1409,6 +1410,7 @@
"sticker_add_requirements" = "贴纸要求大于 %@KB 且小于 %@KB,宽高大于 %@ 像素且小于 %@ 像素。";
"sticker_store" = "表情商店";
"stickers_count" = "%d 个表情";
"stocks" = "股票";
"stop" = "暂停";
"stop_playing" = "停止播放";
"stop_playing_this_list" = "确定要停止并关闭播放列表?";
Expand Down
2 changes: 2 additions & 0 deletions Mixin/Resources/zh-Hant.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@
"or" = "或者";
"order_details" = "訂單詳情";
"order_id" = "訂單 ID";
"order_status" = "狀態";
"order_type" = "訂單型別";
"order_type_limit" = "限價";
"order_type_swap" = "閃兌";
Expand Down Expand Up @@ -1409,6 +1410,7 @@
"sticker_add_requirements" = "貼紙要求大於 %@KB 且小於 %@KB,寬高大於 %@ 畫素且小於 %@ 畫素。";
"sticker_store" = "表情商店";
"stickers_count" = "%d 個表情";
"stocks" = "股票";
"stop" = "暫停";
"stop_playing" = "停止播放";
"stop_playing_this_list" = "確定要停止並關閉播放列表?";
Expand Down
2 changes: 2 additions & 0 deletions Mixin/Service/API/Model/BalancedSwapToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ final class BalancedSwapToken: SwapToken, ValuableToken {
name: token.name,
symbol: token.symbol,
iconURL: token.iconURL,
category: token.category,
chain: token.chain
)
}
Expand All @@ -39,6 +40,7 @@ final class BalancedSwapToken: SwapToken, ValuableToken {
name: i.name,
symbol: i.symbol,
iconURL: i.iconURL,
category: nil,
chain: Chain(
chainID: chain.chainId,
name: chain.name,
Expand Down
22 changes: 20 additions & 2 deletions Mixin/Service/API/Model/SwapToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class SwapToken: Token {
let name: String
let symbol: String
let iconURL: String
let category: Category?
let chain: Chain

var codable: Codable {
Expand All @@ -19,21 +20,23 @@ class SwapToken: Token {
name: name,
symbol: symbol,
iconURL: iconURL,
category: category,
chain: chain
)
}

init(
address: String, assetID: String, decimals: Int16,
name: String, symbol: String, iconURL: String,
chain: SwapToken.Chain
category: Category?, chain: SwapToken.Chain,
) {
self.address = address
self.assetID = assetID
self.decimals = decimals
self.name = name
self.symbol = symbol
self.iconURL = iconURL
self.category = category
self.chain = chain
}

Expand Down Expand Up @@ -91,6 +94,10 @@ extension SwapToken {

extension SwapToken {

enum Category: String {
case stock = "stock"
}

struct Chain: Swift.Codable {

enum CodingKeys: String, CodingKey {
Expand Down Expand Up @@ -139,12 +146,14 @@ extension SwapToken {
case name
case symbol
case iconURL = "icon"
case category
case chain
}

override init(
address: String, assetID: String, decimals: Int16, name: String,
symbol: String, iconURL: String, chain: SwapToken.Chain
symbol: String, iconURL: String, category: Category?,
chain: SwapToken.Chain,
) {
super.init(
address: address,
Expand All @@ -153,19 +162,27 @@ extension SwapToken {
name: name,
symbol: symbol,
iconURL: iconURL,
category: category,
chain: chain
)
}

init(from decoder: any Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let categoryValue = try container.decodeIfPresent(String.self, forKey: .category)
let category: Category? = if let categoryValue {
Category(rawValue: categoryValue)
} else {
nil
}
super.init(
address: try container.decode(String.self, forKey: .address),
assetID: try container.decode(String.self, forKey: .assetID),
decimals: try container.decode(Int16.self, forKey: .decimals),
name: try container.decode(String.self, forKey: .name),
symbol: try container.decode(String.self, forKey: .symbol),
iconURL: try container.decode(String.self, forKey: .iconURL),
category: category,
chain: try container.decode(Chain.self, forKey: .chain)
)
}
Expand All @@ -178,6 +195,7 @@ extension SwapToken {
try container.encode(name, forKey: .name)
try container.encode(symbol, forKey: .symbol)
try container.encode(iconURL, forKey: .iconURL)
try container.encode(category?.rawValue, forKey: .category)
try container.encode(chain, forKey: .chain)
}

Expand Down
9 changes: 9 additions & 0 deletions Mixin/Service/API/RouteAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ extension RouteAPI {
request(method: .get, path: path, completion: completion)
}

static func stockTokens(
source: RouteTokenSource,
queue: DispatchQueue,
completion: @escaping (MixinAPI.Result<[SwapToken.Codable]>) -> Void
) {
let path = "/web3/tokens?version=\(Bundle.main.shortVersionString)&source=\(source.rawValue)&category=stock"
request(method: .get, path: path, queue: queue, completion: completion)
}

static func search(
keyword: String,
source: RouteTokenSource,
Expand Down
Loading