From 56fcd2a295c003eaeff74b31c1ae2ed9e8bac1bb Mon Sep 17 00:00:00 2001 From: Canestin Ndong <100531716+Canestin@users.noreply.github.com> Date: Thu, 5 Dec 2024 21:39:39 +0100 Subject: [PATCH] fix: order the display of solana validators (#8617) --- .changeset/cyan-rabbits-return.md | 5 +++++ libs/coin-modules/coin-solana/src/utils.ts | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 .changeset/cyan-rabbits-return.md diff --git a/.changeset/cyan-rabbits-return.md b/.changeset/cyan-rabbits-return.md new file mode 100644 index 000000000000..f25538d616a1 --- /dev/null +++ b/.changeset/cyan-rabbits-return.md @@ -0,0 +1,5 @@ +--- +"@ledgerhq/coin-solana": minor +--- + +fix: order the display of solana validators diff --git a/libs/coin-modules/coin-solana/src/utils.ts b/libs/coin-modules/coin-solana/src/utils.ts index d46bd7a61840..83d889bf0704 100644 --- a/libs/coin-modules/coin-solana/src/utils.ts +++ b/libs/coin-modules/coin-solana/src/utils.ts @@ -23,9 +23,9 @@ export const LEDGER_VALIDATOR_BY_CHORUS_ONE: ValidatorsAppValidator = { avatarUrl: "https://s3.amazonaws.com/keybase_processed_uploads/3c47b62f3d28ecfd821536f69be82905_360_360.jpg", wwwUrl: "https://www.ledger.com/staking", - activeStake: 0, + activeStake: 10001001000098, commission: 7, - totalScore: 6, + totalScore: 7, }; export const LEDGER_VALIDATOR_LIST: ValidatorsAppValidator[] = [ @@ -175,8 +175,17 @@ export function ledgerFirstValidators( v => LEDGER_VALIDATORS_VOTE_ACCOUNTS.includes(v.voteAccount), validators, ); + + const LEDGER_FIRST_VALIDATOR = + ledgerValidators.find(v => v.voteAccount === LEDGER_VALIDATOR_BY_CHORUS_ONE.voteAccount) || + LEDGER_VALIDATOR_BY_CHORUS_ONE; + + const ledgerValidatorsFiltered = ledgerValidators.filter( + v => v.voteAccount !== LEDGER_FIRST_VALIDATOR.voteAccount, + ); + return ledgerValidators.length === 2 - ? ledgerValidators.concat(restValidators) + ? [LEDGER_FIRST_VALIDATOR, ...ledgerValidatorsFiltered].concat(restValidators) : LEDGER_VALIDATOR_LIST.concat(restValidators); }