Skip to content

Commit

Permalink
fix multicall tx ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
santteegt committed Apr 3, 2024
1 parent b62d0e9 commit 0cd370b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libs/tx-builder/src/utils/multicall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,13 @@ const handleMulticallFormActions = ({
if (!validTxs.length) {
throw new Error('No actions found');
}
// TODO: sort by tx.actionId.index
return validTxs.map((actionId: string) => {
const sortedTxs = validTxs.sort((actionA: string, actionB: string) =>
Number(appState.formValues.tx[actionA].index) >
Number(appState.formValues.tx[actionB].index)
? 1
: -1
);
return sortedTxs.map((actionId: string) => {
const action = appState.formValues.tx[actionId];
const { to, data, value, operation } = action;
return {
Expand Down

0 comments on commit 0cd370b

Please sign in to comment.