Skip to content

Commit

Permalink
fix: order the display of solana validators (#8617)
Browse files Browse the repository at this point in the history
  • Loading branch information
Canestin authored Dec 5, 2024
1 parent ad18613 commit 56fcd2a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/cyan-rabbits-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/coin-solana": minor
---

fix: order the display of solana validators
15 changes: 12 additions & 3 deletions libs/coin-modules/coin-solana/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 56fcd2a

Please sign in to comment.