fix(swap response): parsing token out (#377)
This commit is contained in:
parent
13d153de69
commit
d63c7f100a
@ -8,7 +8,8 @@ export default function getTokenOutFromSwapResponse(
|
|||||||
const events = rawLogs[0].events
|
const events = rawLogs[0].events
|
||||||
const tokenSwappedEvent = events.find((e: { type: string }) => e.type === 'token_swapped')
|
const tokenSwappedEvent = events.find((e: { type: string }) => e.type === 'token_swapped')
|
||||||
const tokensOutValue = tokenSwappedEvent.attributes.find(
|
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
|
).value
|
||||||
const amount = tokensOutValue.split(denom)[0]
|
const amount = tokensOutValue.split(denom)[0]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user