Skip to content

Commit

Permalink
Merge pull request #2412 from DistributedCollective/development
Browse files Browse the repository at this point in the history
* Fix/migration deployment fix (#2382)

* Revert "Fix/release reversions (#2364)"

This reverts commit 1db51a0.

* [Margin, Spot] - fix PairNavbar selector after migration

* [Margin, Spot] - update PairNavbarInfo data

* Revert changes to sovrynProtocol.json (merged from #2368)

Co-authored-by: soulBit <[email protected]>

* Adjust warning (#2408)

* Update PT-BR (#2410)

* Update PT-BR

Changes from:
#2408

* Change

* Update src/locales/pt_br/translation.json

* fix: json format failing builds

* FE: Use totals properties from the Graph on the rewards page (#2409)

* [Reward] - replace reward endpoint

* [Reward] - rm console.log

* [Reward] - fix loading error

* [Reward] - add number formatting to amount in history table

* [Reward] - add addAmounts function

* chore: update readme

* [Reward] - fixes from review

* [Reward] - add arrow-button in pagination, that redirect to first page

* [Reward] - replace sumAmounts -> sumRewards

* [Lending] - replace legacy backend endpoint usage for Lending APY his… (#2303)

* [Lending] - replace legacy backend endpoint usage for Lending APY history charts

* [Lending] - replace func with React.FC

* fix: lend charts not loading when wallet is disconnected

* [Lending] - change from 6 days to 7 days

Co-authored-by: soulBit <[email protected]>

* 2753851238 lend history endpoint migration (#2290)

* chore: add Apollo poll interval constant

* feat: replace lend history endpoint

* [Reward] - update reward endpoint part 2 (#2327)

* [Reward] - update reward endpoint part 2

* force rebuild

* [Reward] - update useMemo hooks

* [Reward] - replace toNumberFormat -> AssetValue

* [Reward] - add fixes from commetns

* [Reward] - add weiTo18 to feesEarnedTab

Co-authored-by: soulBit <[email protected]>
Co-authored-by: tiltom <[email protected]>

* Feat/landing endpoint migration (#2286)

* feat: migrate liquidity history endpoint

* fix: remove un used useUserPoolData hook usage

* fix: remove unused amm api

* fix: update AmmHistory endpoint

* fix: amm history amounts

* chore: sort liquidity history items by timestamp

* fix: uniq by date pool chart history

* fix: sort pool chart data

* fix: update default page size

Co-authored-by: soulBit <[email protected]>
Co-authored-by: Pietro Maximoff <[email protected]>

* [Margin] - Replace legacy backend endpoint usage on Margin trade page… (#2275)

* [Margin] - Replace legacy backend endpoint usage on Margin trade page for the Open and Closed Position history table data.

* [Margin] - added adjustments

* [Margin] - replaced values with <AssetValue>

* [Margin] - update graphql with codegen

* [Margin] - update types

* [Margin] - add pollInterval + change closewithDeposits -> closeWithDeposits

* chore: add +/- symbol support to AssetValue

* feat: use AssetValue positive/negative symbols, use positionSize property from Loan entity (instead of trade entity)

* feat: use AssetValue positive/negative symbols, use positionSize property from Loan entity (instead of trade entity)

* feat: use positionSize from getLoan call

* [Margin] - added fixes form review

* [Margin] - fix casting issues

* [Margin] - cleanups

* [Margin] - create default values

* [Margin] - fix from comments

Co-authored-by: soulBit <[email protected]>
Co-authored-by: tiltom <[email protected]>

* feat: migrate trading endpoints (#2298)

* feat: migrate trading endpoints

* fix: checkMaintenances hook

* feat: show maintenance message when margin limit locked

* fix: PR comments

* feat: sort landing crypto prices based on market cap

* fix: resolve PR comments

Co-authored-by: soulBit <[email protected]>

* feat: migrate swap/spot history (#2310)

* feat: migrate swap/spot history

* force rebuild

* fix: resolve pr comments

* fix: resolve pr comments

* fix: if statement cleanup

* fix: show 8 decimals in swap history

Co-authored-by: soulBit <[email protected]>

* [Portfolio] - replace endpoint (#2329)

* [Portfolio] - replace endpoint

* [Portfolio] - remove toWei

* [Portfolio] - fixes from comments

* [Portfolio] - update contract views

* [Portfolio] - cleanups

* [Portfolio] - update asset image

* [Portfolio] - fix dollar value

* [Portfolio] - remove unnecessary imports

* [Portfolio] - remove unnecessary 'return'

* [Portfolio] - add date/time to contract row, remove duplicated type column in sub-table, add columns align to the contract level column

* fix: add missing Reward event types/labels

* chore: filter 0 amount items in reward history

* chore: use default page size from classifiers

* fix: total Fees Earned display formatting

* fix: available Liquid rewards amount formatting

* fix: total Lending rewards amount formatting

* fix: available Liquid rewards amount formatting

* fix: available Trading rewards formatting/display

* [Reward] - fix an issues with available trading rewards that not counted in claimable amount

* [Reward] - add filtering History Table by active tab

* [Reward] - add fix for SOV-443

* [Rewards] - updated with current graph data format + update var. names

* [Reward] - update from PR comments

* [Rewards] - add fix for asset

* [Reward] - remove tooltip

Co-authored-by: Victor Creed <[email protected]>
Co-authored-by: soulBit <[email protected]>
Co-authored-by: tiltom <[email protected]>
Co-authored-by: Peiman <[email protected]>

* fix: bump sovryn wallet version (#2399)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: soulBit <[email protected]>
Co-authored-by: tiltom <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pietro Maximoff <[email protected]>

* [Spot, Margin] - Replace RPC usage for events spot & margin pages (#2294)

* [Spot, Margin] - Replace RPC usage for events spot & margin pages

* [Margin, Spot] - add isMainnet check

* Merge branch 'development' into feat/2731931003-orders

* force rebuild

* [Spot] - update gpaph functions

* [Spot] - fix from comment

* [Spot] - build to the stage

* [Spot] - replace transactionHash with hash

* [Spot] - update filed price view

* [Spot] - update generated graph

* [Spot] - added min and max decimal values in filled price row

* [Spot] - fix price for rbtc

* [Spot] - update dependencies

* [Spot] - fix rbtc issue

* chore: remove extraneous comments

Co-authored-by: soulBit <[email protected]>

* SOV-427: closing limit orders with hw (#2403)

* SOV-427 fix hw limit order closing

* Update sovryn-network.ts

force branch to redeploy

* Hide perps banner on homepage (#2413)

* chore: force consistent 8 decimals on Spot Limit order histort (Filled Amount)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Pietro Maximoff <[email protected]>
Co-authored-by: soulBit <[email protected]>
Co-authored-by: tiltom <[email protected]>
Co-authored-by: bitcoinuser <[email protected]>
Co-authored-by: tiltom <[email protected]>
Co-authored-by: Peiman <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
7 people authored Sep 27, 2022
2 parents b83af86 + 21ae99a commit c53cc53
Show file tree
Hide file tree
Showing 55 changed files with 6,723 additions and 1,846 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@reduxjs/toolkit": "1.5.1",
"@rsksmart/rsk3": "0.3.4",
"@sovryn/charting-library": "1.0.0",
"@sovryn/react-wallet": "2.2.14",
"@sovryn/react-wallet": "2.2.15",
"@sovryn/perpetual-swap": "3.0.14",
"@svgr/webpack": "4.3.3",
"@testing-library/jest-dom": "5.1.1",
Expand Down
1 change: 1 addition & 0 deletions src/app/components/Icon/iconNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ export const CHEVRON_DOWN = 'chevron-down';
export const ARROW_DOWN_WIDE = 'arrow-down-wide';
export const ARROWS_SWAP = 'arrows-swap';
export const ARROW_RIGHT_LONG = 'arrow-right-long';
export const CHEVRON_DOUBLE_LEFT = 'chevron-double-left';
4 changes: 4 additions & 0 deletions src/app/components/Icon/iconSvgPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export const IconSvgPaths: Record<IconName, string[]> = {
'chevron-left': [
'M 22.199219 5.136719 L 19.867188 2.773438 L 6.796875 16 L 19.867188 29.230469 L 22.199219 26.863281 L 11.472656 16 Z M 22.199219 5.136719',
],
'chevron-double-left': [
'm19.01,5.74l-2.27,-2.24l-12.73,12.52l12.73,12.52l2.27,-2.24l-10.46,-10.28l10.46,-10.28z',
'm28,5.74l-2.27,-2.24l-12.73,12.52l12.73,12.52l2.27,-2.24l-10.46,-10.28l10.46,-10.28z',
],
'chevron-right': [
'M 7.578125 26.578125 L 18.429688 16 L 7.578125 5.421875 L 10.5 2.578125 L 24.269531 16 L 10.5 29.425781 Z M 7.578125 26.578125',
],
Expand Down
157 changes: 104 additions & 53 deletions src/app/components/PairNavbar/PairCryptocurrency.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { usePairList } from 'app/hooks/trading/usePairList';
import { Asset } from 'types';
import { getLastPrice } from './utils';
import { RenderPercentageColumn } from './RenderPercentageColumn';
import { assetByTokenAddress } from 'utils/blockchain/contract-helpers';

const FAVORITE = 'FAVORITE';

Expand Down Expand Up @@ -88,10 +89,18 @@ export const PairCryptocurrency: React.FC<IPairCryptocurrencyProps> = ({
} else {
if (
tradingPairs.includes(
TradingPairType[`${pair[0].base_symbol}_${pair[1].quote_symbol}`],
TradingPairType[
`${assetByTokenAddress(pair[0].base_id)}_${assetByTokenAddress(
pair[1].quote_id,
)}`
],
) ||
tradingPairs.includes(
TradingPairType[`${pair[0].quote_symbol}_${pair[1].base_symbol}`],
TradingPairType[
`${assetByTokenAddress(pair[0].quote_id)}_${assetByTokenAddress(
pair[1].base_id,
)}`
],
)
) {
return pair;
Expand All @@ -110,58 +119,64 @@ export const PairCryptocurrency: React.FC<IPairCryptocurrencyProps> = ({
searchAsset = Asset.BNB;
}

const baseSymbol0 = assetByTokenAddress(item[0].base_id);
const baseSymbol1 = assetByTokenAddress(item[1].base_id);
const quoteSymbol0 = assetByTokenAddress(item[0].quote_id);
const quoteSymbol1 = assetByTokenAddress(item[1].quote_id);

if (!baseSymbol0 || !baseSymbol1 || !quoteSymbol0 || !quoteSymbol1) {
return false;
}

if (search.length && category && category !== Asset.RBTC) {
return (
(item[0].base_symbol.includes(searchAsset.toUpperCase()) &&
item[0].base_symbol.includes(category)) ||
(item[1].base_symbol.includes(searchAsset.toUpperCase()) &&
item[1].base_symbol.includes(category)) ||
(item[0].quote_symbol.includes(searchAsset.toUpperCase()) &&
item[0].quote_symbol.includes(category)) ||
(item[1].quote_symbol.includes(searchAsset.toUpperCase()) &&
item[1].quote_symbol.includes(category)) ||
(item[0].base_symbol.includes(searchAsset.toUpperCase()) &&
item[1].base_symbol.includes(category)) ||
(item[1].base_symbol.includes(searchAsset.toUpperCase()) &&
item[0].base_symbol.includes(category)) ||
(item[0].quote_symbol.includes(searchAsset.toUpperCase()) &&
item[1].quote_symbol.includes(category)) ||
(item[1].quote_symbol.includes(searchAsset.toUpperCase()) &&
item[0].quote_symbol.includes(category)) ||
(item[0].quote_symbol.includes(searchAsset.toUpperCase()) &&
item[0].base_symbol.includes(category) &&
item[0].base_symbol === item[1].base_symbol)
(baseSymbol0.includes(searchAsset.toUpperCase()) &&
baseSymbol0.includes(category)) ||
(baseSymbol1.includes(searchAsset.toUpperCase()) &&
baseSymbol1.includes(category)) ||
(quoteSymbol0.includes(searchAsset.toUpperCase()) &&
quoteSymbol0.includes(category)) ||
(quoteSymbol1.includes(searchAsset.toUpperCase()) &&
quoteSymbol1.includes(category)) ||
(baseSymbol0.includes(searchAsset.toUpperCase()) &&
baseSymbol1.includes(category)) ||
(baseSymbol1.includes(searchAsset.toUpperCase()) &&
baseSymbol0.includes(category)) ||
(quoteSymbol0.includes(searchAsset.toUpperCase()) &&
quoteSymbol1.includes(category)) ||
(quoteSymbol1.includes(searchAsset.toUpperCase()) &&
quoteSymbol0.includes(category)) ||
(quoteSymbol0.includes(searchAsset.toUpperCase()) &&
baseSymbol0.includes(category) &&
baseSymbol0 === baseSymbol1)
);
}
if (
category === Asset.RBTC &&
item[0].base_symbol === item[1].base_symbol
) {
if (category === Asset.RBTC && baseSymbol0 === baseSymbol1) {
return (
(item[0].base_symbol.includes(searchAsset.toUpperCase()) &&
item[0].quote_symbol.includes(category)) ||
(item[0].quote_symbol.includes(searchAsset.toUpperCase()) &&
item[0].base_symbol.includes(category)) ||
(item[0].quote_symbol.includes(searchAsset.toUpperCase()) &&
item[0].quote_symbol.includes(category))
(baseSymbol0.includes(searchAsset.toUpperCase()) &&
quoteSymbol0.includes(category)) ||
(quoteSymbol0.includes(searchAsset.toUpperCase()) &&
baseSymbol0.includes(category)) ||
(quoteSymbol0.includes(searchAsset.toUpperCase()) &&
quoteSymbol0.includes(category))
);
}
if (item[0].base_symbol !== item[1].base_symbol) {
if (baseSymbol0 !== baseSymbol1) {
//filtering pairs without RBTC as a source pair
return (
(item[0].base_symbol.includes(searchAsset.toUpperCase()) &&
item[0].base_symbol.includes(category)) ||
(item[1].base_symbol.includes(searchAsset.toUpperCase()) &&
item[1].base_symbol.includes(category))
(baseSymbol0.includes(searchAsset.toUpperCase()) &&
baseSymbol0.includes(category)) ||
(baseSymbol1.includes(searchAsset.toUpperCase()) &&
baseSymbol1.includes(category))
);
}
if (item[0].base_symbol === item[1].base_symbol) {
if (baseSymbol0 === baseSymbol1) {
//filtering pairs only for RBTC as target
return (
(item[0].base_symbol.includes(searchAsset.toUpperCase()) &&
item[0].base_symbol.includes(category)) ||
(item[0].quote_symbol.includes(searchAsset.toUpperCase()) &&
item[0].quote_symbol.includes(category))
(baseSymbol0.includes(searchAsset.toUpperCase()) &&
baseSymbol0.includes(category)) ||
(quoteSymbol0.includes(searchAsset.toUpperCase()) &&
quoteSymbol0.includes(category))
);
}
return false;
Expand Down Expand Up @@ -195,21 +210,33 @@ export const PairCryptocurrency: React.FC<IPairCryptocurrencyProps> = ({
) => {
let isValidPair = false; // checking tradingPair, if the pair exists
if (
pair0.base_symbol === pair1.base_symbol &&
pair0.base_id === pair1.base_id &&
!RBTC_source &&
tradingType[`${pair0.base_symbol}_${pair0.quote_symbol}`]
tradingType[
`${assetByTokenAddress(pair0.base_id)}_${assetByTokenAddress(
pair0.quote_id,
)}`
]
) {
isValidPair = true;
}
if (
pair0.base_symbol === pair1.base_symbol &&
pair0.base_id === pair1.base_id &&
RBTC_source &&
tradingType[`${pair0.quote_symbol}_${pair0.base_symbol}`]
tradingType[
`${assetByTokenAddress(pair0.quote_id)}_${assetByTokenAddress(
pair0.base_id,
)}`
]
) {
isValidPair = true;
}
if (
tradingType[`${pair0.base_symbol}_${pair1.base_symbol}`] &&
tradingType[
`${assetByTokenAddress(pair0.base_id)}_${assetByTokenAddress(
pair1.base_id,
)}`
] &&
!RBTC_source
) {
isValidPair = true;
Expand All @@ -223,24 +250,48 @@ export const PairCryptocurrency: React.FC<IPairCryptocurrencyProps> = ({
if (
pair[0].base_symbol === pair[1].base_symbol &&
!pair[2] &&
tradingType[`${pair[0].base_symbol}_${pair[0].quote_symbol}`]
tradingType[
`${assetByTokenAddress(pair[0].base_id)}_${assetByTokenAddress(
pair[0].quote_id,
)}`
]
) {
return tradingType[`${pair[0].base_symbol}_${pair[0].quote_symbol}`];
return tradingType[
`${assetByTokenAddress(pair[0].base_id)}_${assetByTokenAddress(
pair[0].quote_id,
)}`
];
}
/* pairs with RBTC as source*/
/* pairs with RBTC as source */
if (
pair[0].base_symbol === pair[1].base_symbol &&
pair[2] &&
tradingType[`${pair[0].quote_symbol}_${pair[0].base_symbol}`]
tradingType[
`${assetByTokenAddress(pair[0].quote_id)}_${assetByTokenAddress(
pair[0].base_id,
)}`
]
) {
return tradingType[`${pair[0].quote_symbol}_${pair[0].base_symbol}`];
return tradingType[
`${assetByTokenAddress(pair[0].quote_id)}_${assetByTokenAddress(
pair[0].base_id,
)}`
];
}
/* pairs without RBTC*/
if (
tradingType[`${pair[0].base_symbol}_${pair[1].base_symbol}`] &&
tradingType[
`${assetByTokenAddress(pair[0].base_id)}_${assetByTokenAddress(
pair[1].base_id,
)}`
] &&
!pair[2]
) {
return tradingType[`${pair[0].base_symbol}_${pair[1].base_symbol}`];
return tradingType[
`${assetByTokenAddress(pair[0].base_id)}_${assetByTokenAddress(
pair[1].base_id,
)}`
];
}
},
[tradingType],
Expand Down
9 changes: 5 additions & 4 deletions src/app/components/PairNavbar/PairLabels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Asset } from 'types';
import { Button, ButtonSize, ButtonStyle } from 'app/components/Button';
import { pairList, pairs } from 'app/pages/SpotTradingPage/types';
import { AssetSymbolRenderer } from '../AssetSymbolRenderer';
import { assetByTokenAddress } from 'utils/blockchain/contract-helpers';

interface IPairLabelsProps {
onChangeCategory: (value: string) => void;
Expand All @@ -30,7 +31,7 @@ export const PairLabels: React.FC<IPairLabelsProps> = ({
return [];
}
return Object.keys(spotPairs)
.map(key => spotPairs[key].base_symbol)
.map(key => assetByTokenAddress(spotPairs[key].base_id))
.filter(pair => pair);
}, [spotPairs]);

Expand All @@ -50,9 +51,9 @@ export const PairLabels: React.FC<IPairLabelsProps> = ({
if (spotPairsList.includes(item)) {
return item;
}
return null;
return undefined;
})
.filter(item => item !== null);
.filter(item => item !== undefined);

const categories =
type === TradingType.SPOT ? [Asset.RBTC, ...labelsList] : null;
Expand Down Expand Up @@ -81,7 +82,7 @@ export const PairLabels: React.FC<IPairLabelsProps> = ({
size={ButtonSize.sm}
style={ButtonStyle.link}
key={currency}
onClick={() => onChangeCategory(currency)}
onClick={() => onChangeCategory(currency || '')}
/>
);
})}
Expand Down
Loading

0 comments on commit c53cc53

Please sign in to comment.