forked from polkadot-cloud/polkadot-staking-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolve errors update dev hasura uri and loosen filters for active validators fix apollo error and console issues with accounts update compare BN test remove account sorting fix lint update filters; remove parachain validators from nominations; update BN comparison add missig filters update icons, remove console statements and commented out code
- Loading branch information
Showing
29 changed files
with
264 additions
and
391 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ export const ValidatorsProvider = ({ | |
const { poolNominations } = useActivePools(); | ||
const { units } = network; | ||
const { maxNominatorRewardedPerValidator } = consts; | ||
const { activeEra, earliestStoredSession } = metrics; | ||
const { activeEra } = metrics; | ||
|
||
// stores the total validator entries | ||
const [validators, setValidators] = useState<Array<Validator>>([]); | ||
|
@@ -138,10 +138,10 @@ export const ValidatorsProvider = ({ | |
|
||
// fetch parachain session validators when earliestStoredSession ready | ||
useEffect(() => { | ||
if (isReady && earliestStoredSession.gt(new BN(0))) { | ||
This comment has been minimized.
Sorry, something went wrong.
MRamanenkau
|
||
if (isReady) { | ||
subscribeParachainValidators(api); | ||
} | ||
}, [isReady, earliestStoredSession]); | ||
}, [isReady]); | ||
|
||
// pre-populating validator meta batches. Needed for generating nominations | ||
useEffect(() => { | ||
|
@@ -161,13 +161,17 @@ export const ValidatorsProvider = ({ | |
if (!activeAccount) { | ||
return; | ||
} | ||
|
||
console.log(`Active account: ${activeAccount}`); | ||
// get raw targets list | ||
const targets = getAccountNominations(activeAccount); | ||
|
||
// format to list format | ||
const targetsFormatted = targets.map((item: any) => { | ||
return { address: item }; | ||
}); | ||
console.log(`Fetching validators from nominated list:`); | ||
console.log(targetsFormatted); | ||
// fetch preferences | ||
const nominationsWithPrefs = await fetchValidatorPrefs(targetsFormatted); | ||
|
||
|
@@ -188,11 +192,14 @@ export const ValidatorsProvider = ({ | |
const fetchPoolNominatedList = async () => { | ||
// get raw nominations list | ||
let n = poolNominations.targets; | ||
console.log(`Raw nominations list:`); | ||
console.log(n); | ||
// format to list format | ||
n = n.map((item: string) => { | ||
return { address: item }; | ||
}); | ||
// fetch preferences | ||
console.log(`Fetching validators from pool nominated list: ${n}`); | ||
const nominationsWithPrefs = await fetchValidatorPrefs(n); | ||
if (nominationsWithPrefs) { | ||
setPoolNominated(nominationsWithPrefs); | ||
|
@@ -218,6 +225,8 @@ export const ValidatorsProvider = ({ | |
const _favorites = [...favorites].map((item: string) => { | ||
return { address: item }; | ||
}); | ||
console.log(`Favourite validators:`); | ||
console.log(_favorites); | ||
This comment has been minimized.
Sorry, something went wrong.
MRamanenkau
|
||
// // fetch preferences | ||
const favoritesWithPrefs = await fetchValidatorPrefs(_favorites); | ||
if (favoritesWithPrefs) { | ||
|
@@ -305,8 +314,8 @@ export const ValidatorsProvider = ({ | |
*/ | ||
const subscribeParachainValidators = async (_api: AnyApi) => { | ||
if (isReady) { | ||
const unsub = await _api.query.paraSessionInfo.accountKeys( | ||
earliestStoredSession.toString(), | ||
const unsub = await _api.query.session.validators( | ||
// earliestStoredSession.toString(), | ||
(_validators: AnyApi) => { | ||
setSessionParachainValidators({ | ||
...sessionParachainValidators, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,13 @@ export const getEligibleControllers = (): Array<InputItem> => { | |
_accountsAsInput = _accountsAsInput.sort((a: InputItem, b: InputItem) => { | ||
const aFree = a?.balance?.free ?? new BN(0); | ||
const bFree = b?.balance?.free ?? new BN(0); | ||
return bFree.sub(aFree).toNumber(); | ||
|
||
if (bFree.lt(aFree)) { | ||
return -1; | ||
// eslint-disable-next-line no-else-return | ||
} else { | ||
return bFree.sub(aFree).toNumber(); | ||
} | ||
This comment has been minimized.
Sorry, something went wrong.
MRamanenkau
|
||
}); | ||
|
||
return _accountsAsInput; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Where is it used?