Skip to content

Commit

Permalink
[APP] init testnet evm ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwonhyukjoon committed Dec 13, 2024
1 parent 58ea748 commit 3073fca
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import androidx.recyclerview.widget.RecyclerView
import wannabit.io.cosmostaion.R
import wannabit.io.cosmostaion.chain.BaseChain
import wannabit.io.cosmostaion.chain.FetchState
import wannabit.io.cosmostaion.chain.fetcher.OktFetcher
import wannabit.io.cosmostaion.chain.PubKeyType
import wannabit.io.cosmostaion.chain.evmClass.ChainOktEvm
import wannabit.io.cosmostaion.chain.fetcher.OktFetcher
import wannabit.io.cosmostaion.chain.majorClass.ChainBitCoin84
import wannabit.io.cosmostaion.chain.majorClass.ChainSui
import wannabit.io.cosmostaion.chain.majorClass.SUI_MAIN_DENOM
Expand Down Expand Up @@ -236,12 +236,7 @@ class WalletSelectViewHolder(
chainName.text = chain.name.uppercase()
chainTypeBadge.visibility = View.GONE

if (chain is ChainBitCoin84) {
chainAddress.text = chain.mainAddress
chainAddress.visibility = View.VISIBLE
chainEvmAddress.visibility = View.GONE

} else if (chain.isEvmCosmos()) {
if (chain.isEvmCosmos()) {
chainAddress.text = chain.address
chainEvmAddress.text = chain.evmAddress
chainAddress.visibility = View.INVISIBLE
Expand All @@ -251,7 +246,13 @@ class WalletSelectViewHolder(
handler.postDelayed(starEvmAddressAnimation, 5000)

} else {
chainAddress.text = chain.address
chainAddress.text = if (chain is ChainBitCoin84) {
chain.mainAddress
} else if (chain.isSupportErc20()) {
chain.evmAddress
} else {
chain.address
}
chainAddress.visibility = View.VISIBLE
chainEvmAddress.visibility = View.GONE

Expand Down Expand Up @@ -319,7 +320,7 @@ class WalletSelectViewHolder(
chainDenom.text = chain.coinSymbol
}

} else {
} else if (chain.supportCosmos()) {
BaseData.getAsset(chain.apiName, chain.stakeDenom)?.let { asset ->
val availableAmount =
chain.cosmosFetcher?.balanceAmount(chain.stakeDenom)
Expand All @@ -329,6 +330,15 @@ class WalletSelectViewHolder(
chainDenom.text = asset.symbol
chainDenom.setTextColor(asset.assetColor())
}

} else {
val availableAmount = chain.evmRpcFetcher?.evmBalance?.movePointLeft(18)
?.setScale(18, RoundingMode.DOWN)
chainBalance.text = formatAmount(availableAmount.toString(), 18)
chainDenom.text = chain.coinSymbol
BaseData.getAsset(chain.apiName, chain.stakeDenom)?.let { asset ->
chainDenom.setTextColor(asset.assetColor())
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ class ChainEditViewHolder(
} else {
chainAddress.text = if (chain is ChainBitCoin84) {
chain.mainAddress
} else if (chain.isSupportErc20()) {
chain.evmAddress
} else {
chain.address
}
Expand Down

0 comments on commit 3073fca

Please sign in to comment.