use of wannabit.io.cosmostaion.model.type.Fee in project cosmostation-android by cosmostation.
the class HtlcSendActivity method onInitClaimFee.
public Fee onInitClaimFee() {
if (mRecipientChain.equals(BaseChain.BNB_MAIN)) {
Coin gasCoin = new Coin();
gasCoin.denom = BaseConstant.TOKEN_BNB;
gasCoin.amount = FEE_BNB_SEND;
ArrayList<Coin> gasCoins = new ArrayList<>();
gasCoins.add(gasCoin);
mClaimFee = new Fee("", gasCoins);
} else if (mRecipientChain.equals(BaseChain.KAVA_MAIN)) {
Coin gasCoin = new Coin();
gasCoin.denom = BaseConstant.TOKEN_KAVA;
gasCoin.amount = "12500";
ArrayList<Coin> gasCoins = new ArrayList<>();
gasCoins.add(gasCoin);
mClaimFee = new Fee(KAVA_GAS_AMOUNT_BEP3, gasCoins);
}
return mClaimFee;
}
use of wannabit.io.cosmostaion.model.type.Fee in project cosmostation-android by cosmostation.
the class HtlcSendActivity method onInitSendFee.
public Fee onInitSendFee() {
if (mBaseChain.equals(BaseChain.BNB_MAIN)) {
Coin gasCoin = new Coin();
gasCoin.denom = BaseConstant.TOKEN_BNB;
gasCoin.amount = FEE_BNB_SEND;
ArrayList<Coin> gasCoins = new ArrayList<>();
gasCoins.add(gasCoin);
mSendFee = new Fee("", gasCoins);
} else if (mBaseChain.equals(BaseChain.KAVA_MAIN)) {
Coin gasCoin = new Coin();
gasCoin.denom = BaseConstant.TOKEN_KAVA;
gasCoin.amount = "12500";
ArrayList<Coin> gasCoins = new ArrayList<>();
gasCoins.add(gasCoin);
mSendFee = new Fee(KAVA_GAS_AMOUNT_BEP3, gasCoins);
}
return mSendFee;
}
use of wannabit.io.cosmostaion.model.type.Fee in project cosmostation-android by cosmostation.
the class HtlcSendStep3Fragment method onRefreshTab.
@Override
public void onRefreshTab() {
mToSwapDenom = getSActivity().mToSwapDenom;
Fee sendFee = getSActivity().onInitSendFee();
Fee claimFee = getSActivity().onInitClaimFee();
BigDecimal toSendAmount = new BigDecimal(getSActivity().mToSendCoins.get(0).amount);
BigDecimal sendFeeAmount = new BigDecimal(sendFee.amount.get(0).amount);
BigDecimal claimFeeAmount = new BigDecimal(claimFee.amount.get(0).amount);
// set send card view
mSendIcon.setColorFilter(WDp.getChainColor(getContext(), getSActivity().mBaseChain), android.graphics.PorterDuff.Mode.SRC_IN);
if (getSActivity().mBaseChain.equals(BaseChain.BNB_MAIN)) {
if (mToSwapDenom.equals(TOKEN_HTLC_BINANCE_BNB) || mToSwapDenom.equals(TOKEN_HTLC_BINANCE_TEST_BNB)) {
mSendDenomTv.setText(getString(R.string.str_bnb_c));
mSendDenomTv.setTextColor(getResources().getColor(R.color.colorBnb));
} else if (mToSwapDenom.equals(TOKEN_HTLC_BINANCE_BTCB) || mToSwapDenom.equals(TOKEN_HTLC_BINANCE_TEST_BTC)) {
mSendDenomTv.setText(getString(R.string.str_btc_c));
mSendDenomTv.setTextColor(getResources().getColor(R.color.colorWhite));
} else if (mToSwapDenom.equals(TOKEN_HTLC_BINANCE_XRPB)) {
mSendDenomTv.setText("XRP");
mSendDenomTv.setTextColor(getResources().getColor(R.color.colorWhite));
} else if (mToSwapDenom.equals(TOKEN_HTLC_BINANCE_BUSD)) {
mSendDenomTv.setText("BUSD");
mSendDenomTv.setTextColor(getResources().getColor(R.color.colorWhite));
}
WDp.DpMainDenom(getContext(), getSActivity().mBaseChain.getChain(), mSendFeeDenomTv);
mSendAmountTv.setText(WDp.getDpAmount2(getContext(), toSendAmount, 0, 8));
mSendFeeAmountTv.setText(WDp.getDpAmount2(getContext(), sendFeeAmount, 0, 8));
mReceiveChainTv.setText(WDp.getDpChainName(getContext(), getSActivity().mRecipientChain));
mReceiveAddressTv.setText(getSActivity().mRecipientAccount.address);
} else if (getSActivity().mBaseChain.equals(BaseChain.KAVA_MAIN)) {
mDecimal = WUtil.getKavaCoinDecimal(getBaseDao(), getSActivity().mToSwapDenom);
mSendDenomTv.setText(getSActivity().mToSwapDenom.toUpperCase());
WDp.DpMainDenom(getContext(), getSActivity().mBaseChain.getChain(), mSendFeeDenomTv);
mSendAmountTv.setText(WDp.getDpAmount2(getContext(), toSendAmount, mDecimal, mDecimal));
mSendFeeAmountTv.setText(WDp.getDpAmount2(getContext(), sendFeeAmount, 6, 6));
mReceiveChainTv.setText(WDp.getDpChainName(getContext(), getSActivity().mRecipientChain));
mReceiveAddressTv.setText(getSActivity().mRecipientAccount.address);
}
// set claim card view
mClaimIcon.setColorFilter(WDp.getChainColor(getContext(), getSActivity().mRecipientChain), android.graphics.PorterDuff.Mode.SRC_IN);
if (getSActivity().mRecipientChain.equals(BaseChain.BNB_MAIN)) {
mReceiveAmountDenomTv.setText(getSActivity().mToSwapDenom.toUpperCase());
mRelayFeeAmountDenomTv.setText(getSActivity().mToSwapDenom.toUpperCase());
if (mToSwapDenom.equals(TOKEN_HTLC_KAVA_BNB) || mToSwapDenom.equals(TOKEN_HTLC_KAVA_TEST_BNB)) {
mReceiveAmountDenomTv.setTextColor(getResources().getColor(R.color.colorBnb));
mRelayFeeAmountDenomTv.setTextColor(getResources().getColor(R.color.colorBnb));
} else if (mToSwapDenom.equals(TOKEN_HTLC_KAVA_BTCB) || mToSwapDenom.equals(TOKEN_HTLC_KAVA_TEST_BTC)) {
mReceiveAmountDenomTv.setTextColor(getResources().getColor(R.color.colorWhite));
mRelayFeeAmountDenomTv.setTextColor(getResources().getColor(R.color.colorWhite));
} else if (mToSwapDenom.equals(TOKEN_HTLC_KAVA_XRPB)) {
mReceiveAmountDenomTv.setTextColor(getResources().getColor(R.color.colorWhite));
mRelayFeeAmountDenomTv.setTextColor(getResources().getColor(R.color.colorWhite));
} else if (mToSwapDenom.equals(TOKEN_HTLC_KAVA_BUSD)) {
mReceiveAmountDenomTv.setTextColor(getResources().getColor(R.color.colorWhite));
mRelayFeeAmountDenomTv.setTextColor(getResources().getColor(R.color.colorWhite));
}
WDp.DpMainDenom(getContext(), getSActivity().mRecipientChain.getChain(), mClaimFeeDenomTv);
BigDecimal relayFee = getSActivity().mKavaBep3Param2.getSupportedSwapAssetFee(getSActivity().mToSwapDenom);
mReceiveAmountTv.setText(WDp.getDpAmount2(getContext(), toSendAmount.subtract(relayFee), mDecimal, mDecimal));
mRelayFeeAmountTv.setText(WDp.getDpAmount2(getContext(), relayFee, mDecimal, mDecimal));
mClaimFeeAmountTv.setText(WDp.getDpAmount2(getContext(), claimFeeAmount, 0, mDecimal));
mClaimAddressTv.setText(getSActivity().mRecipientAccount.address);
} else if (getSActivity().mRecipientChain.equals(BaseChain.KAVA_MAIN)) {
if (mToSwapDenom.equals(TOKEN_HTLC_BINANCE_BNB) || mToSwapDenom.equals(TOKEN_HTLC_BINANCE_TEST_BNB)) {
mReceiveAmountDenomTv.setText(getString(R.string.str_bnb_c));
mRelayFeeAmountDenomTv.setText(getString(R.string.str_bnb_c));
} else if (mToSwapDenom.equals(TOKEN_HTLC_BINANCE_BTCB) || mToSwapDenom.equals(TOKEN_HTLC_BINANCE_TEST_BTC)) {
mReceiveAmountDenomTv.setText(getString(R.string.str_btc_c));
mRelayFeeAmountDenomTv.setText(getString(R.string.str_btc_c));
} else if (mToSwapDenom.equals(TOKEN_HTLC_BINANCE_XRPB)) {
mReceiveAmountDenomTv.setText("XRP");
mRelayFeeAmountDenomTv.setText("XRP");
} else if (mToSwapDenom.equals(TOKEN_HTLC_BINANCE_BUSD)) {
mReceiveAmountDenomTv.setText("BUSD");
mRelayFeeAmountDenomTv.setText("BUSD");
}
WDp.DpMainDenom(getContext(), getSActivity().mRecipientChain.getChain(), mClaimFeeDenomTv);
BigDecimal relayFee = getSActivity().mKavaBep3Param2.getSupportedSwapAssetFee(getSActivity().mToSwapDenom).movePointLeft(8);
mReceiveAmountTv.setText(WDp.getDpAmount2(getContext(), toSendAmount.subtract(relayFee), 0, 8));
mRelayFeeAmountTv.setText(WDp.getDpAmount2(getContext(), relayFee, 0, 8));
mClaimFeeAmountTv.setText(WDp.getDpAmount2(getContext(), claimFeeAmount, 6, 6));
mClaimAddressTv.setText(getSActivity().mRecipientAccount.address);
}
}
use of wannabit.io.cosmostaion.model.type.Fee in project cosmostation-android by cosmostation.
the class StepFeeSetFragment method onSetFee.
private void onSetFee(int gasDenomPosition) {
Fee fee = new Fee();
Coin gasCoin = new Coin();
gasCoin.denom = WDp.getGasDenomList(getSActivity().mBaseChain).get(gasDenomPosition);
gasCoin.amount = mFee.toPlainString();
ArrayList<Coin> amount = new ArrayList<>();
amount.add(gasCoin);
fee.amount = amount;
fee.gas = mEstimateGasAmount.toPlainString();
getSActivity().mTxFee = fee;
}
use of wannabit.io.cosmostaion.model.type.Fee in project cosmostation-android by cosmostation.
the class StepFeeSetOldFragment method onSetFee.
private void onSetFee() {
Fee fee = new Fee();
Coin gasCoin = new Coin();
gasCoin.denom = WDp.mainDenom(getSActivity().mBaseChain);
gasCoin.amount = mFee.toPlainString();
ArrayList<Coin> amount = new ArrayList<>();
amount.add(gasCoin);
fee.amount = amount;
fee.gas = mEstimateGasAmount.toPlainString();
getSActivity().mTxFee = fee;
}
Aggregations