Skip to content

Commit

Permalink
Merge pull request #3386 from superhero-com/feature/show-assets-for-s…
Browse files Browse the repository at this point in the history
…ell-transactions-correctly

fix: show assets for sell transactions correctly
  • Loading branch information
CedrikNikita authored Nov 5, 2024
2 parents f0a96b3 + e90d260 commit eda49a9
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,9 @@ const sell: TransactionResolver = (transaction, tokens = null, tokenAddressMappe
const tokenAddress: string = isConfirm && tokenAddressMapper
? tokenAddressMapper(transaction.tx.contractId)
: transaction.tx.log?.slice(-1)[0]?.address;
const [amount] = transaction.tx.arguments!;
const aeAmount = transaction.tx.return?.value;

const amount = isConfirm ? transaction.tx.arguments?.[0]?.value : transaction.tx.arguments?.[0]!;
const aeAmount = isConfirm ? transaction.tx.arguments?.[1]?.value : transaction.tx.return?.value;
const token = {
amount: amount?.value,
...defaultToken,
Expand All @@ -416,7 +417,7 @@ const sell: TransactionResolver = (transaction, tokens = null, tokenAddressMappe
isReceived: true,
};
return {
tokens: [token, aeToken],
tokens: [aeToken, token],
};
};

Expand Down

0 comments on commit eda49a9

Please sign in to comment.