fix(explorer): check linking type when summing stake (#4585)
This commit is contained in:
parent
d2854b6e90
commit
3e627ff849
@ -29,37 +29,6 @@ fragment ExplorerPartyAssetsAccounts on AccountBalance {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment ExplorerPartyLinks on AccountBalance {
|
|
||||||
asset {
|
|
||||||
name
|
|
||||||
id
|
|
||||||
decimals
|
|
||||||
symbol
|
|
||||||
source {
|
|
||||||
__typename
|
|
||||||
... on ERC20 {
|
|
||||||
contractAddress
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
type
|
|
||||||
balance
|
|
||||||
market {
|
|
||||||
id
|
|
||||||
decimalPlaces
|
|
||||||
tradableInstrument {
|
|
||||||
instrument {
|
|
||||||
name
|
|
||||||
product {
|
|
||||||
... on Future {
|
|
||||||
quoteName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
query ExplorerPartyAssets($partyId: ID!) {
|
query ExplorerPartyAssets($partyId: ID!) {
|
||||||
partiesConnection(id: $partyId) {
|
partiesConnection(id: $partyId) {
|
||||||
edges {
|
edges {
|
||||||
|
@ -64,7 +64,7 @@ export const ExplorerPartyAssetsDocument = gql`
|
|||||||
}
|
}
|
||||||
stakingSummary {
|
stakingSummary {
|
||||||
currentStakeAvailable
|
currentStakeAvailable
|
||||||
linkings(pagination: {first: 100}) {
|
linkings(pagination: {last: 100}) {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
type
|
type
|
||||||
@ -113,4 +113,4 @@ export function useExplorerPartyAssetsLazyQuery(baseOptions?: Apollo.LazyQueryHo
|
|||||||
}
|
}
|
||||||
export type ExplorerPartyAssetsQueryHookResult = ReturnType<typeof useExplorerPartyAssetsQuery>;
|
export type ExplorerPartyAssetsQueryHookResult = ReturnType<typeof useExplorerPartyAssetsQuery>;
|
||||||
export type ExplorerPartyAssetsLazyQueryHookResult = ReturnType<typeof useExplorerPartyAssetsLazyQuery>;
|
export type ExplorerPartyAssetsLazyQueryHookResult = ReturnType<typeof useExplorerPartyAssetsLazyQuery>;
|
||||||
export type ExplorerPartyAssetsQueryResult = Apollo.QueryResult<ExplorerPartyAssetsQuery, ExplorerPartyAssetsQueryVariables>;
|
export type ExplorerPartyAssetsQueryResult = Apollo.QueryResult<ExplorerPartyAssetsQuery, ExplorerPartyAssetsQueryVariables>;
|
@ -42,14 +42,14 @@ export const PartyBlockStake = ({
|
|||||||
linkedLength && linkedLength > 0
|
linkedLength && linkedLength > 0
|
||||||
? p?.stakingSummary?.linkings?.edges
|
? p?.stakingSummary?.linkings?.edges
|
||||||
?.reduce((total, e) => {
|
?.reduce((total, e) => {
|
||||||
const accumulator = new BigNumber(total)
|
const accumulator = new BigNumber(total);
|
||||||
const diff = new BigNumber(e?.node.amount || 0)
|
const diff = new BigNumber(e?.node.amount || 0);
|
||||||
if (e?.node.type === 'TYPE_LINK') {
|
if (e?.node.type === 'TYPE_LINK') {
|
||||||
return accumulator.plus(diff);
|
return accumulator.plus(diff);
|
||||||
} else if (e?.node.type === 'TYPE_UNLINK') {
|
} else if (e?.node.type === 'TYPE_UNLINK') {
|
||||||
return accumulator.minus(diff);
|
return accumulator.minus(diff);
|
||||||
} else {
|
} else {
|
||||||
return accumulator
|
return accumulator;
|
||||||
}
|
}
|
||||||
}, new BigNumber(0))
|
}, new BigNumber(0))
|
||||||
.toString()
|
.toString()
|
||||||
|
Loading…
Reference in New Issue
Block a user