Skip to content

Commit

Permalink
fix(stellar): update sorting for rotate signers with amplifier verifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
ahramy committed Jan 9, 2025
1 parent f18d4d2 commit 6b41b04
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion stellar/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,15 @@ const getAmplifierVerifiers = async (config, chainAxelarId) => {
);
const signers = Object.values(verifierSet.signers);

// Include pubKey for sorting, sort based on pubKey, then remove pubKey after sorting.
const weightedSigners = signers
.map((signer) => ({
signer: Address.account(Buffer.from(arrayify(`0x${signer.pub_key.ed25519}`))).toString(),
weight: Number(signer.weight),
pubKey: signer.pub_key.ed25519,
}))
.sort((a, b) => a.signer.localeCompare(b.signer));
.sort((a, b) => a.pubKey.localeCompare(b.pubKey))
.map(({ signer, weight }) => ({ signer, weight }));

return {
signers: weightedSigners,
Expand Down

0 comments on commit 6b41b04

Please sign in to comment.