Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import type {
TransactionMetricsBuilderRequest,
} from '../types';
import type { RootState } from '../../../../../reducers';
import { selectAccountsByChainId } from '../../../../../selectors/accountTrackerController';
import { toChecksumAddress } from '../../../../../util/address';

export function getGasMetricsProperties({
transactionMeta,
Expand Down Expand Up @@ -88,10 +90,9 @@ function getNativeBalance(
chainId: string,
address: string,
): BigNumber {
const accountsByChainId =
state.engine?.backgroundState?.AccountTrackerController?.accountsByChainId;
const accountsByChainId = selectAccountsByChainId(state);
Comment thread
cursor[bot] marked this conversation as resolved.

const account = accountsByChainId?.[chainId]?.[address?.toLowerCase()];
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was broken. In the current state, the addresses in accountsByChainId are stored in checksum format.

const account = accountsByChainId?.[chainId]?.[toChecksumAddress(address)];
Comment thread
bergarces marked this conversation as resolved.
Outdated

return new BigNumber((account?.balance as Hex) ?? '0x0');
}
Loading