fix(swap response): parsing token out (#377)

This commit is contained in:
Yusuf Seyrek
2023-08-17 12:56:42 +03:00
committed by GitHub
parent 13d153de69
commit d63c7f100a
+2 -1
View File
@@ -8,7 +8,8 @@ export default function getTokenOutFromSwapResponse(
const events = rawLogs[0].events
const tokenSwappedEvent = events.find((e: { type: string }) => e.type === 'token_swapped')
const tokensOutValue = tokenSwappedEvent.attributes.find(
(a: { key: string }) => a.key === 'tokens_out',
(a: { key: string; value: string }) =>
a.key === 'tokens_out' && a.value.toLowerCase().includes(denom.toLowerCase()),
).value
const amount = tokensOutValue.split(denom)[0]