Skip to content

Commit

Permalink
some basic sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
nope-finance committed Oct 2, 2022
1 parent ae6229b commit 6edb5ac
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/Multisig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ export function MultisigInstance({ multisig }: { multisig: PublicKey }) {
}, [multisig, multisigClient.account]);
useEffect(() => {
multisigClient.account.transaction.all(multisig.toBuffer()).then((txs) => {
txs.sort((a,b)=>{
// old owner sets too the bottom since not even executable
if (a.account.ownerSetSeqno != b.account.ownerSetSeqno){
return b.account.ownerSetSeqno - a.account.ownerSetSeqno;
}
// unexecuted to the top since more relevant
if (a.account.didExecute != b.account.didExecute) {
return a.account.didExecute - b.account.didExecute;
}
return 0;
});
setTransactions(txs);
});
}, [multisigClient.account.transaction, multisig, forceRefresh]);
Expand Down

0 comments on commit 6edb5ac

Please sign in to comment.