Skip to content

Commit

Permalink
Merge pull request #394 from cosmostation/main_yong_dev
Browse files Browse the repository at this point in the history
Release V1.10.4
  • Loading branch information
wannabit-yongjoo committed Mar 2, 2024
2 parents 6c68f58 + 61fc570 commit e943b86
Show file tree
Hide file tree
Showing 62 changed files with 415 additions and 196 deletions.
54 changes: 39 additions & 15 deletions Cosmostation.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cosmostation/Base/BaseConstant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ public enum AutoPass: Int {
}


let BASE_BG_IMG = ["basebg00", "basebg01", "basebg02", "basebg03", "basebg04", "basebg05", "basebg06"]
let BASE_BG_IMG = ["basebg00", "basebg01", "basebg02", "basebg03", "basebg04", "basebg05", "basebg06", "basebg07", "basebg08"]

let QUOTES = ["quotes_01", "quotes_02", "quotes_03", "quotes_04", "quotes_05", "quotes_06", "quotes_07", "quotes_08", "quotes_09", "quotes_10",
"quotes_11", "quotes_12", "quotes_13", "quotes_14", "quotes_15", "quotes_16", "quotes_17", "quotes_18", "quotes_19", "quotes_20",
Expand Down
3 changes: 2 additions & 1 deletion Cosmostation/Chains/ClassCosmos/CosmosClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ extension CosmosClass {

func fetchChainParam2(_ group: DispatchGroup) {
group.enter()
// print("fetchChainParam2 ", BaseNetWork.msChainParam(self))
AF.request(BaseNetWork.msChainParam(self), method: .get)
.responseDecodable(of: JSON.self) { response in
switch response.result {
Expand Down Expand Up @@ -776,8 +777,8 @@ func ALLCOSMOSCLASS() -> [CosmosClass] {
result.append(ChainStargaze())
// result.append(ChainStarname())
result.append(ChainStride())
result.append(ChainTerra())
result.append(ChainTeritori())
result.append(ChainTerra())
result.append(ChainUmee())
result.append(ChainXpla())

Expand Down
2 changes: 1 addition & 1 deletion Cosmostation/Chains/ClassEVM/ChainAltheaEVM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ChainAltheaEVM: EvmClass {

name = "Althea"
tag = "althea60"
logo1 = "chainAlthea"
logo1 = "chainAltheaEvm"
logo2 = "chainAlthea2"
apiName = "althea"
stakeDenom = "ualtg"
Expand Down
2 changes: 1 addition & 1 deletion Cosmostation/Chains/ClassEVM/ChainCantoEVM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ChainCantoEVM: EvmClass {

name = "Canto"
tag = "canto60"
logo1 = "chainCanto"
logo1 = "chainCantoEvm"
logo2 = "chainCanto2"
apiName = "canto"
stakeDenom = "acanto"
Expand Down
2 changes: 1 addition & 1 deletion Cosmostation/Chains/ClassEVM/ChainDymensionEVM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ChainDymensionEVM: EvmClass {

name = "Dymension"
tag = "dymension60"
logo1 = "chainDymension"
logo1 = "chainDymensionEvm"
logo2 = "chainDymension2"
apiName = "dymension"
stakeDenom = "adym"
Expand Down
2 changes: 1 addition & 1 deletion Cosmostation/Chains/ClassEVM/ChainEvmosEVM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ChainEvmosEVM: EvmClass {

name = "Evmos"
tag = "evmos60"
logo1 = "chainEvmos"
logo1 = "chainEvmosEvm"
logo2 = "chainEvmos2"
apiName = "evmos"
stakeDenom = "aevmos"
Expand Down
2 changes: 1 addition & 1 deletion Cosmostation/Chains/ClassEVM/ChainHumansEVM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ChainHumansEVM: EvmClass {

name = "Humans"
tag = "humans60"
logo1 = "chainHumans"
logo1 = "chainHumansEvm"
logo2 = "chainHumans2"
apiName = "humans"
stakeDenom = "aheart"
Expand Down
2 changes: 1 addition & 1 deletion Cosmostation/Chains/ClassEVM/ChainKavaEVM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ChainKavaEVM: EvmClass {

name = "Kava"
tag = "kava60"
logo1 = "chainKava"
logo1 = "chainKavaEvm"
logo2 = "chainKava2"
apiName = "kava"
stakeDenom = "ukava"
Expand Down
5 changes: 3 additions & 2 deletions Cosmostation/Chains/ClassEVM/ChainOktEVM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
import Alamofire
import SwiftyJSON

class ChainOktEVM: EvmClass {
class ChainOktEVM: EvmClass {

//For Legacy Lcd chains
lazy var lcdNodeInfo = JSON()
Expand All @@ -27,7 +27,7 @@ class ChainOktEVM: EvmClass {

name = "OKT"
tag = "okt60_Keccak"
logo1 = "chainOkt"
logo1 = "chainOktEvm"
logo2 = "chainOkt2"
apiName = "okc"
stakeDenom = "okt"
Expand All @@ -50,6 +50,7 @@ class ChainOktEVM: EvmClass {
let group = DispatchGroup()
fetchChainParam2(group)
fetchErc20Info2(group)
fetchEvmBalance(group)

fetchNodeInfo(group)
fetchAccountInfo(group, bechAddress)
Expand Down
35 changes: 35 additions & 0 deletions Cosmostation/Chains/ClassEVM/ChainOptimism.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// ChainOptimism.swift
// Cosmostation
//
// Created by yongjoo jung on 2024/02/27.
// Copyright © 2024 wannabit. All rights reserved.
//

import Foundation

class ChainOptimism: EvmClass {

override init() {
super.init()

name = "Optimism"
tag = "optimism60"
logo1 = "chainOptimism"
logo2 = "chainOptimism2"
apiName = "optimism"

coinSymbol = "ETH"
coinGeckoId = "ethereum"
coinLogo = "tokenEth_Op"

accountKeyType = AccountKeyType(.ETH_Keccak256, "m/44'/60'/0'/0/X")

evmRpcURL = "https://mainnet.optimism.io"
explorerURL = "https://optimistic.etherscan.io/"
addressURL = explorerURL + "address/%@"
txURL = explorerURL + "tx/%@"

}

}
35 changes: 35 additions & 0 deletions Cosmostation/Chains/ClassEVM/ChainPolygon.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// ChainPolygon.swift
// Cosmostation
//
// Created by yongjoo jung on 2024/02/27.
// Copyright © 2024 wannabit. All rights reserved.
//

import Foundation

class ChainPolygon: EvmClass {

override init() {
super.init()

name = "Polygon"
tag = "polygon60"
logo1 = "chainPolygon"
logo2 = "chainPolygon2"
apiName = "polygon"

coinSymbol = "MATIC"
coinGeckoId = "matic-network"
coinLogo = "tokenMatic"

accountKeyType = AccountKeyType(.ETH_Keccak256, "m/44'/60'/0'/0/X")

evmRpcURL = "https://polygon-rpc.com"
explorerURL = "https://polygonscan.com/"
addressURL = explorerURL + "address/%@"
txURL = explorerURL + "tx/%@"

}

}
2 changes: 1 addition & 1 deletion Cosmostation/Chains/ClassEVM/ChainXplaEVM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ChainXplaEVM: EvmClass {

name = "Xpla"
tag = "xplaKeccak256"
logo1 = "chainXpla"
logo1 = "chainXplaEvm"
logo2 = "chainXpla2"
apiName = "xpla"
stakeDenom = "axpla"
Expand Down
19 changes: 9 additions & 10 deletions Cosmostation/Chains/ClassEVM/EvmClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class EvmClass: CosmosClass {
if (supportCosmos) {
let channel = getConnection()
fetchAuth(group, channel)

group.notify(queue: .main) {
try? channel.close()
WUtils.onParseVestingAccount(self)
Expand Down Expand Up @@ -99,7 +98,7 @@ class EvmClass: CosmosClass {
//Do not using Task, only DispatchQueue : make slow
DispatchQueue.global().async {
if let balance = try? self.getWeb3Connection()?.eth.getBalance(address: EthereumAddress.init(self.evmAddress)!) {
self.evmBalances = NSDecimalNumber(string: String(balance!))
self.evmBalances = NSDecimalNumber(string: String(balance ?? "0"))
}
DispatchQueue.main.async(execute: {
self.fetched = true
Expand Down Expand Up @@ -161,10 +160,12 @@ class EvmClass: CosmosClass {
extension EvmClass {

func fetchErc20Info() async throws -> [MintscanToken] {
// print("fetchErc20Info ", BaseNetWork.msErc20InfoUrl(self))
return try await AF.request(BaseNetWork.msErc20InfoUrl(self), method: .get).serializingDecodable([MintscanToken].self).value
}

func fetchErc20Info2(_ group: DispatchGroup) {
// print("fetchErc20Info2 ", BaseNetWork.msErc20InfoUrl(self))
group.enter()
AF.request(BaseNetWork.msErc20InfoUrl(self), method: .get)
.responseDecodable(of: [MintscanToken].self) { response in
Expand All @@ -179,14 +180,10 @@ extension EvmClass {
}

func fetchEvmBalance(_ group: DispatchGroup) {
print("fetchEvmBalance START", self.tag)
group.enter()
Task.detached(priority: .high) {
DispatchQueue(label: "evmBalance", attributes: .concurrent).async(group: group) {
if let balance = try? self.getWeb3Connection()?.eth.getBalance(address: EthereumAddress.init(self.evmAddress)!) {
self.evmBalances = NSDecimalNumber(string: String(balance!))
print("fetchEvmBalance DONE", self.tag)
self.evmBalances = NSDecimalNumber(string: String(balance ?? "0"))
}
group.leave()
}
}
}
Expand All @@ -195,7 +192,7 @@ extension EvmClass {
func fetchAllErc20Balance(_ id: Int64) {
let group = DispatchGroup()
mintscanErc20Tokens.forEach { token in
if (tag != "ethereum60" || token.isdefault == true) {
if (supportCosmos || token.isdefault == true) {
fetchErc20Balance(group, EthereumAddress.init(evmAddress)!, token)
}
}
Expand Down Expand Up @@ -237,6 +234,8 @@ func ALLEVMCLASS() -> [EvmClass] {
result.append(ChainHumansEVM())
result.append(ChainKavaEVM())
result.append(ChainOktEVM())
result.append(ChainOptimism())
result.append(ChainPolygon())
result.append(ChainXplaEVM())

//Add cosmos chain id for ibc
Expand All @@ -248,6 +247,6 @@ func ALLEVMCLASS() -> [EvmClass] {
return result
}

let DEFUAL_DISPALY_EVM = ["ethereum60", "Dymension60", "kava60"]
let DEFUAL_DISPALY_EVM = ["ethereum60", "dymension60", "kava60"]

let EVM_BASE_FEE = NSDecimalNumber.init(string: "588000000000000")
9 changes: 9 additions & 0 deletions Cosmostation/Controller/Main/CosmosClass/CosmosClassVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,15 @@ class CosmosClassVC: BaseVC {
transfer.modalTransitionStyle = .coverVertical
self.present(transfer, animated: true)

} else if (selectedChain is ChainOktEVM) {
let transfer = CommonTransfer(nibName: "CommonTransfer", bundle: nil)
transfer.sendType = .Only_EVM_Coin
transfer.fromChain = selectedChain
transfer.toSendDenom = selectedChain.stakeDenom
transfer.toSendMsAsset = BaseData.instance.getAsset(selectedChain.apiName, selectedChain.stakeDenom)
transfer.modalTransitionStyle = .coverVertical
self.present(transfer, animated: true)

} else {
let transfer = CommonTransfer(nibName: "CommonTransfer", bundle: nil)
transfer.sendType = (selectedChain is EvmClass) ? .CosmosEVM_Coin : .Only_Cosmos_Coin
Expand Down
3 changes: 2 additions & 1 deletion Cosmostation/Controller/Main/CosmosClass/CosmosCoinVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ extension CosmosCoinVC: UITableViewDelegate, UITableViewDataSource {
} else if (selectedChain is ChainOktEVM) {
if (indexPath.section == 0) {
if (indexPath.row == 0) {
onStartTransferVC(.CosmosEVM_Coin, lcdBalances[indexPath.row]["denom"].stringValue)
//OKT EVM only support Ox style
onStartTransferVC(.Only_EVM_Coin, lcdBalances[indexPath.row]["denom"].stringValue)
} else {
onStartLegacyTransferVC(lcdBalances[indexPath.row]["denom"].stringValue)
}
Expand Down
Loading

0 comments on commit e943b86

Please sign in to comment.