diff --git a/.changelog/1539.bugfix.md b/.changelog/1539.bugfix.md new file mode 100644 index 000000000..4e9c2680d --- /dev/null +++ b/.changelog/1539.bugfix.md @@ -0,0 +1 @@ +Fix non-native event denominations diff --git a/src/oasis-nexus/api.ts b/src/oasis-nexus/api.ts index be7991161..8a29cb0b4 100644 --- a/src/oasis-nexus/api.ts +++ b/src/oasis-nexus/api.ts @@ -845,20 +845,14 @@ export const useGetRuntimeEvents: typeof generated.useGetRuntimeEvents = ( eth_tx_hash: adjustedHash, body: { ...event.body, - amount: - // If there's no denomination then use runtime's native. Otherwise unknown (would have to get by token name?). - event.body.amount.Denomination === '' - ? { - ...event.body.amount, - Amount: fromBaseUnits( - event.body.amount.Amount, - paraTimesConfig[runtime].decimals, - ), - Denomination: - event.body?.Denomination ?? - getTokensForScope({ network, layer: runtime })[0].ticker, - } - : event.body.amount, + amount: { + // If denomination="" or missing then use runtime's native. Otherwise unknown (would have to get by token name?). + ...event.body.amount, + Amount: fromBaseUnits(event.body.amount.Amount, paraTimesConfig[runtime].decimals), + Denomination: + event.body.amount.Denomination || + getTokensForScope({ network, layer: runtime })[0].ticker, + }, }, layer: runtime, network,