Skip to content

Commit

Permalink
Merge pull request #1233 from bitholla/testnet
Browse files Browse the repository at this point in the history
Testnet
  • Loading branch information
abeikverdi committed Mar 2, 2022
2 parents 0388421 + ba282ae commit 108684c
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ steps:
from_secret: hollaex_email
HOLLAEX_PASSWORD:
from_secret: hollaex_password
HOLLAEX_LOGIN_KEY:
from_secret: hollaex_network_testnet_login_key
settings:
exchange_id: 176
exchange_name: "Sandbox HollaEx"
Expand Down Expand Up @@ -172,6 +174,8 @@ steps:
from_secret: next_email
HOLLAEX_PASSWORD:
from_secret: next_password
HOLLAEX_LOGIN_KEY:
from_secret: hollaex_network_testnet_login_key
settings:
exchange_id: 539
exchange_name: "Next"
Expand Down
2 changes: 1 addition & 1 deletion server/api/swagger/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
swagger: "2.0"
info:
version: "2.2.9"
version: "2.2.10"
title: HollaEx Kit
host: api.hollaex.com
basePath: /v2
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.2.9",
"version": "2.2.10",
"private": false,
"description": "HollaEx Kit",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.9
2.2.10
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hollaex-kit",
"version": "2.2.9",
"version": "2.2.10",
"private": true,
"dependencies": {
"@ant-design/compatible": "1.0.5",
Expand Down
44 changes: 37 additions & 7 deletions web/src/containers/Withdraw/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
setWithdrawEmailConfirmation,
setWithdrawNotificationError,
} from './notifications';
import { BASE_CURRENCY } from 'config/constants';
import { BASE_CURRENCY, DEFAULT_COIN_DATA } from 'config/constants';
import { calculateBaseFee } from './utils';
import Fiat from 'containers/Deposit/Fiat';
import Image from 'components/Image';
Expand All @@ -31,17 +31,46 @@ const selector = formValueSelector(FORM_NAME);
let errorTimeOut = null;

const validate = (values, props) => {
const { currency, coins, balance } = props;
const { withdrawal_fees } = coins[currency] || DEFAULT_COIN_DATA;
const { network } = values;

const errors = {};
const amount = math.fraction(values.amount || 0);
const fee = math.fraction(values.fee || 0);
const balance = math.fraction(props.balanceAvailable || 0);
const balanceAvailable = math.fraction(props.balanceAvailable || 0);
let fee_coin;

const totalTransaction = math.add(fee, amount);
if (math.larger(totalTransaction, balance)) {
errors.amount = STRINGS.formatString(
STRINGS['WITHDRAWALS_LOWER_BALANCE'],
math.number(totalTransaction)
if (withdrawal_fees && network && withdrawal_fees[network]) {
fee_coin = withdrawal_fees[network].symbol;
const fullFeeCoinName = coins[fee_coin].fullname;
const availableFeeBalance = math.fraction(
balance[`${fee_coin}_available`] || 0
);
const totalTransaction = amount;
const totalFee = fee;

if (math.larger(totalTransaction, balanceAvailable)) {
errors.amount = STRINGS.formatString(
STRINGS['WITHDRAWALS_LOWER_BALANCE'],
math.number(totalTransaction)
);
}

if (math.larger(totalFee, availableFeeBalance)) {
errors.amount = STRINGS.formatString(
STRINGS['WITHDRAWALS_LOWER_BALANCE'],
`${math.number(totalFee)} ${fullFeeCoinName}`
);
}
} else {
const totalTransaction = math.add(fee, amount);
if (math.larger(totalTransaction, balanceAvailable)) {
errors.fee = STRINGS.formatString(
STRINGS['WITHDRAWALS_LOWER_BALANCE'],
math.number(totalTransaction)
);
}
}

return errors;
Expand Down Expand Up @@ -306,6 +335,7 @@ const mapStateToForm = (state) => ({
activeTheme: state.app.theme,
coins: state.app.coins,
targets: state.app.targets,
balance: state.user.balance,
});

const WithdrawFormWithValues = connect(mapStateToForm)(WithdrawForm);
Expand Down

0 comments on commit 108684c

Please sign in to comment.