fix(margin trading): response parsing (#354)
This commit is contained in:
parent
be671efd64
commit
85bdb4b267
@ -2,6 +2,7 @@ export default function getTokenOutFromSwapResponse(
|
|||||||
response: BroadcastResult,
|
response: BroadcastResult,
|
||||||
denom: string,
|
denom: string,
|
||||||
): Coin {
|
): Coin {
|
||||||
|
try {
|
||||||
if (response.result) {
|
if (response.result) {
|
||||||
const rawLogs = JSON.parse(response.result.rawLogs)
|
const rawLogs = JSON.parse(response.result.rawLogs)
|
||||||
const events = rawLogs[0].events
|
const events = rawLogs[0].events
|
||||||
@ -13,6 +14,9 @@ export default function getTokenOutFromSwapResponse(
|
|||||||
|
|
||||||
return { denom, amount }
|
return { denom, amount }
|
||||||
}
|
}
|
||||||
|
} catch (ex) {
|
||||||
|
console.error(ex)
|
||||||
|
}
|
||||||
|
|
||||||
return { denom: '', amount: '' }
|
return { denom: '', amount: '' }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user