commit
5bd7d1d863
14 changed files with 42 additions and 212 deletions
|
|
@ -7,6 +7,7 @@
|
|||
"airbnb-base",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"next/core-web-vitals",
|
||||
"plugin:prettier/recommended",
|
||||
"prettier"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
/** @type {import('sequelize-cli').Migration} */
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
queryInterface.addColumn('Currencies', 'asset_info', {
|
||||
type: Sequelize.JSONB,
|
||||
allowNull: true,
|
||||
});
|
||||
},
|
||||
|
||||
async down(queryInterface, Sequelize) {
|
||||
queryInterface.removeColumn('Currencies', 'asset_info');
|
||||
},
|
||||
};
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
async function updateColumnType(queryInterface, table, column, type, transaction) {
|
||||
await queryInterface.changeColumn(
|
||||
table,
|
||||
column,
|
||||
{
|
||||
type: `${type} USING CAST("${column}" as ${type})`,
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
}
|
||||
|
||||
/** @type {import('sequelize-cli').Migration} */
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
await queryInterface.sequelize.transaction(async (transaction) => {
|
||||
await updateColumnType(queryInterface, 'Orders', 'price', 'VARCHAR', transaction);
|
||||
await updateColumnType(queryInterface, 'Orders', 'amount', 'VARCHAR', transaction);
|
||||
await updateColumnType(queryInterface, 'Orders', 'total', 'VARCHAR', transaction);
|
||||
await updateColumnType(queryInterface, 'Orders', 'left', 'VARCHAR', transaction);
|
||||
|
||||
await updateColumnType(
|
||||
queryInterface,
|
||||
'Transactions',
|
||||
'amount',
|
||||
'VARCHAR',
|
||||
transaction,
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
async down(queryInterface, Sequelize) {
|
||||
queryInterface.sequelize.transaction(async (transaction) => {
|
||||
await updateColumnType(
|
||||
queryInterface,
|
||||
'Orders',
|
||||
'price',
|
||||
'DOUBLE PRECISION',
|
||||
transaction,
|
||||
);
|
||||
await updateColumnType(
|
||||
queryInterface,
|
||||
'Orders',
|
||||
'amount',
|
||||
'DOUBLE PRECISION',
|
||||
transaction,
|
||||
);
|
||||
await updateColumnType(
|
||||
queryInterface,
|
||||
'Orders',
|
||||
'total',
|
||||
'DOUBLE PRECISION',
|
||||
transaction,
|
||||
);
|
||||
await updateColumnType(
|
||||
queryInterface,
|
||||
'Orders',
|
||||
'left',
|
||||
'DOUBLE PRECISION',
|
||||
transaction,
|
||||
);
|
||||
|
||||
await updateColumnType(
|
||||
queryInterface,
|
||||
'Transactions',
|
||||
'amount',
|
||||
'DOUBLE PRECISION',
|
||||
transaction,
|
||||
);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
/** @type {import('sequelize-cli').Migration} */
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
queryInterface.addColumn('Users', 'exchange_notifications_amount', {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
});
|
||||
},
|
||||
|
||||
async down(queryInterface) {
|
||||
queryInterface.removeColumn('Users', 'exchange_notifications_amount');
|
||||
},
|
||||
};
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
/** @type {import('sequelize-cli').Migration} */
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
queryInterface.addColumn('Currencies', 'whitelisted', {
|
||||
type: Sequelize.BOOLEAN,
|
||||
defaultValue: false,
|
||||
allowNull: false,
|
||||
});
|
||||
},
|
||||
|
||||
async down(queryInterface, Sequelize) {
|
||||
queryInterface.removeColumn('Currencies', 'whitelisted');
|
||||
},
|
||||
};
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
/** @type {import('sequelize-cli').Migration} */
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
queryInterface.addColumn('Orders', 'hasNotification', {
|
||||
type: Sequelize.BOOLEAN,
|
||||
defaultValue: false,
|
||||
allowNull: false,
|
||||
});
|
||||
},
|
||||
|
||||
async down(queryInterface, Sequelize) {
|
||||
queryInterface.removeColumn('Users', 'exchange_notifications_amount');
|
||||
},
|
||||
};
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
/** @type {import('sequelize-cli').Migration} */
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
await queryInterface.addColumn('Users', 'isAdmin', {
|
||||
type: Sequelize.BOOLEAN,
|
||||
allowNull: false,
|
||||
defaultValue: false,
|
||||
});
|
||||
},
|
||||
|
||||
async down(queryInterface, Sequelize) {
|
||||
await queryInterface.removeColumn('Users', 'isAdmin');
|
||||
},
|
||||
};
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
/** @type {import('sequelize-cli').Migration} */
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.addColumn('Pairs', 'featured', {
|
||||
type: Sequelize.BOOLEAN,
|
||||
defaultValue: false,
|
||||
allowNull: false,
|
||||
});
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.removeColumn('Pairs', 'featured');
|
||||
},
|
||||
};
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
"build": "next build",
|
||||
"start": "next start -p 30289",
|
||||
"lint": "next lint",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"eslint": "eslint . --ext .js,.ts,.tsx,.jsx --fix",
|
||||
"format": "prettier --write .",
|
||||
"format:check": "prettier --check .",
|
||||
"prepare": "husky"
|
||||
|
|
|
|||
|
|
@ -97,10 +97,10 @@ function CurrencyDropdown(props: CurrencyDropdownProps) {
|
|||
body={
|
||||
!props.noStars
|
||||
? separateArray(e.data, (curr) =>
|
||||
(state?.user?.favourite_currencies || []).includes(
|
||||
curr.id,
|
||||
),
|
||||
)
|
||||
(state?.user?.favourite_currencies || []).includes(
|
||||
curr.id,
|
||||
),
|
||||
)
|
||||
: e.data
|
||||
}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -475,13 +475,13 @@ function Offers(props) {
|
|||
)}
|
||||
{props.categoryState !== 'finished' &&
|
||||
props.categoryState !== 'active' && (
|
||||
<Button
|
||||
className={rowStyles.row__button__iconed}
|
||||
onClick={removeOffer}
|
||||
>
|
||||
<img src={deleteIcon} alt="delete" />
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
className={rowStyles.row__button__iconed}
|
||||
onClick={removeOffer}
|
||||
>
|
||||
<img src={deleteIcon} alt="delete" />
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
|
|
|||
|
|
@ -255,6 +255,7 @@ function Trading() {
|
|||
: undefined;
|
||||
|
||||
const secondAssetUsdPrice = state.assetsRates.get(secondAssetId || '');
|
||||
const secondCurrencyDP = pairData?.second_currency.asset_info?.decimal_point || 12;
|
||||
|
||||
useEffect(() => {
|
||||
async function fetchPairStats() {
|
||||
|
|
@ -379,8 +380,6 @@ function Trading() {
|
|||
const valueDecimal = new Decimal(inputValue || NaN);
|
||||
const amountDecimal = new Decimal(amountState || NaN);
|
||||
|
||||
const secondCurrencyDP = pairData?.second_currency.asset_info?.decimal_point || 12;
|
||||
|
||||
const validationResult = validateTokensInput(inputValue, secondCurrencyDP);
|
||||
|
||||
if (!validationResult.valid) {
|
||||
|
|
@ -393,8 +392,9 @@ function Trading() {
|
|||
setPriceValid(true);
|
||||
|
||||
if (!valueDecimal.isNaN() && !amountDecimal.isNaN() && amountState !== '') {
|
||||
const total = valueDecimal.mul(amountDecimal).toFixed();
|
||||
setTotalState(total);
|
||||
const totalDecimal = valueDecimal.mul(amountDecimal);
|
||||
setTotalState(totalDecimal.toString());
|
||||
const total = totalDecimal.toFixed(secondCurrencyDP);
|
||||
|
||||
const totalValidationResult = validateTokensInput(total, secondCurrencyDP);
|
||||
|
||||
|
|
@ -455,13 +455,10 @@ function Trading() {
|
|||
if (balance) setRangeInputValue(value.div(balance).mul(100).toFixed());
|
||||
|
||||
if (!price.isNaN() && !value.isNaN() && priceState !== '') {
|
||||
const total = value.mul(price).toFixed();
|
||||
setTotalState(total);
|
||||
|
||||
const totalValidationResult = validateTokensInput(
|
||||
total,
|
||||
pairData?.second_currency.asset_info?.decimal_point || 12,
|
||||
);
|
||||
const totalDecimal = value.mul(price);
|
||||
setTotalState(totalDecimal.toString());
|
||||
const total = totalDecimal.toFixed(secondCurrencyDP);
|
||||
const totalValidationResult = validateTokensInput(total, secondCurrencyDP);
|
||||
|
||||
setTotalValid(totalValidationResult.valid);
|
||||
} else {
|
||||
|
|
@ -486,7 +483,7 @@ function Trading() {
|
|||
setRangeInputValue(percentageDecimal.toFixed() || '');
|
||||
}
|
||||
|
||||
const total = priceDecimal.mul(amountDecimal).toFixed();
|
||||
const total = priceDecimal.mul(amountDecimal).toFixed(secondCurrencyDP);
|
||||
|
||||
const totalValidationResult = validateTokensInput(
|
||||
total,
|
||||
|
|
@ -1038,8 +1035,8 @@ function Trading() {
|
|||
const pairRateUsd =
|
||||
pairStats?.rate !== undefined && secondAssetUsdPrice !== undefined
|
||||
? new Decimal(pairStats.rate)
|
||||
.mul(secondAssetUsdPrice)
|
||||
.toFixed(pairStats.rate < 0.1 ? 6 : 2)
|
||||
.mul(secondAssetUsdPrice)
|
||||
.toFixed(pairStats.rate < 0.1 ? 6 : 2)
|
||||
: undefined;
|
||||
|
||||
const scrollToOrderList = () => {
|
||||
|
|
@ -1071,13 +1068,13 @@ function Trading() {
|
|||
pairData.first_currency?.name &&
|
||||
pairData.second_currency?.name
|
||||
) ? (
|
||||
'...'
|
||||
) : (
|
||||
<>
|
||||
{firstCurrencyName}
|
||||
<span>/{secondCurrencyName}</span>
|
||||
</>
|
||||
)}
|
||||
'...'
|
||||
) : (
|
||||
<>
|
||||
{firstCurrencyName}
|
||||
<span>/{secondCurrencyName}</span>
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
<div className={styles.trading__currency__rate}>
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ function Home(props: HomeProps) {
|
|||
|
||||
const offersNotifications = state.user?.chats
|
||||
? state.user.chats?.filter(
|
||||
(e) => state.user?.id && !(e.view_list || [])?.includes(state.user?.id),
|
||||
).length || 0
|
||||
(e) => state.user?.id && !(e.view_list || [])?.includes(state.user?.id),
|
||||
).length || 0
|
||||
: 0;
|
||||
|
||||
function Card(props: { title: string; value: string }) {
|
||||
|
|
|
|||
|
|
@ -334,19 +334,19 @@ function ProcessContent() {
|
|||
)}
|
||||
{!finishState &&
|
||||
(myState === 'deposit' || myState === 'canceled') && (
|
||||
<Button onClick={() => changeDepositState('confirmed')}>
|
||||
<Button onClick={() => changeDepositState('confirmed')}>
|
||||
Confirm funds received
|
||||
</Button>
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
{!finishState &&
|
||||
(myState === 'deposit' || myState === 'confirmed') && (
|
||||
<Button
|
||||
onClick={() => changeDepositState('canceled')}
|
||||
className={styles.deposit__cancel__btn}
|
||||
>
|
||||
<Button
|
||||
onClick={() => changeDepositState('canceled')}
|
||||
className={styles.deposit__cancel__btn}
|
||||
>
|
||||
Cancel funds and return deposit
|
||||
</Button>
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
{finishState === 'confirmed' && (
|
||||
<p style={{ color: '#16D1D6' }}>
|
||||
The offer finished successfully.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue