Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
@@ -0,0 +1,48 @@
diff --git a/dist/TokenBalancesController.cjs b/dist/TokenBalancesController.cjs
index 4918812dde60b8d0e24a7bded27d88f233968858..4e8018bce92b9e5d47fc40784409e16db22be615 100644
--- a/dist/TokenBalancesController.cjs
+++ b/dist/TokenBalancesController.cjs
@@ -535,14 +535,16 @@ class TokenBalancesController extends (0, polling_controller_1.StaticIntervalPol
}
// Update with actual fetched balances only if the value has changed
aggregated.forEach(({ success, value, account, token, chainId }) => {
- var _a, _b, _c;
+ var _a, _b;
if (success && value !== undefined) {
+ // Ensure all accounts we add/update are in lower-case
+ const lowerCaseAccount = account.toLowerCase();
const newBalance = (0, controller_utils_1.toHex)(value);
const tokenAddress = checksum(token);
- const currentBalance = d.tokenBalances[account]?.[chainId]?.[tokenAddress];
+ const currentBalance = d.tokenBalances[lowerCaseAccount]?.[chainId]?.[tokenAddress];
// Only update if the balance has actually changed
if (currentBalance !== newBalance) {
- ((_c = ((_a = d.tokenBalances)[_b = account] ?? (_a[_b] = {})))[chainId] ?? (_c[chainId] = {}))[tokenAddress] = newBalance;
+ ((_b = ((_a = d.tokenBalances)[lowerCaseAccount] ?? (_a[lowerCaseAccount] = {})))[chainId] ?? (_b[chainId] = {}))[tokenAddress] = newBalance;
}
}
});
diff --git a/dist/TokenBalancesController.mjs b/dist/TokenBalancesController.mjs
index f64d13f8de56631345a44e6ebb025e62e03f51bc..99aa7f27c574c94b26daa56091ac50d15281dd30 100644
--- a/dist/TokenBalancesController.mjs
+++ b/dist/TokenBalancesController.mjs
@@ -531,14 +531,16 @@ export class TokenBalancesController extends StaticIntervalPollingController() {
}
// Update with actual fetched balances only if the value has changed
aggregated.forEach(({ success, value, account, token, chainId }) => {
- var _a, _b, _c;
+ var _a, _b;
if (success && value !== undefined) {
+ // Ensure all accounts we add/update are in lower-case
+ const lowerCaseAccount = account.toLowerCase();
const newBalance = toHex(value);
const tokenAddress = checksum(token);
- const currentBalance = d.tokenBalances[account]?.[chainId]?.[tokenAddress];
+ const currentBalance = d.tokenBalances[lowerCaseAccount]?.[chainId]?.[tokenAddress];
// Only update if the balance has actually changed
if (currentBalance !== newBalance) {
- ((_c = ((_a = d.tokenBalances)[_b = account] ?? (_a[_b] = {})))[chainId] ?? (_c[chainId] = {}))[tokenAddress] = newBalance;
+ ((_b = ((_a = d.tokenBalances)[lowerCaseAccount] ?? (_a[lowerCaseAccount] = {})))[chainId] ?? (_b[chainId] = {}))[tokenAddress] = newBalance;
}
}
});
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![MetaMask logo](logo.png?raw=true)
<img alt="MetaMask logo" src="logo.png?raw=true" width="50" />

# MetaMask
# MetaMask Mobile

[![CI](https://github.com/MetaMask/metamask-mobile/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/MetaMask/metamask-mobile/actions/workflows/ci.yml) [![CLA](https://github.com/MetaMask/metamask-mobile/actions/workflows/cla.yml/badge.svg?branch=main)](https://github.com/MetaMask/metamask-mobile/actions/workflows/cla.yml)

Expand Down
24 changes: 20 additions & 4 deletions app/components/UI/AccountRightButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import React, { useCallback, useEffect, useRef, useState } from 'react';
import React, {
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import { useSelector } from 'react-redux';
import {
TouchableOpacity,
Expand All @@ -9,15 +15,17 @@ import {
EmitterSubscription,
} from 'react-native';
import { useNavigation, useRoute, RouteProp } from '@react-navigation/native';
import images from 'images/image-icons';
import Device from '../../../util/device';
import AvatarAccount from '../../../component-library/components/Avatars/Avatar/variants/AvatarAccount';
import { AccountRightButtonProps } from './AccountRightButton.types';
import Avatar, {
AvatarVariant,
AvatarSize,
} from '../../../component-library/components/Avatars/Avatar';
import { getDecimalChainId } from '../../../util/networks';
import {
getDecimalChainId,
getNetworkImageSource,
} from '../../../util/networks';
import Routes from '../../../constants/navigation/Routes';
import { MetaMetricsEvents } from '../../../core/Analytics';
import { AccountOverviewSelectorsIDs } from '../../../../e2e/selectors/Browser/AccountOverview.selectors';
Expand Down Expand Up @@ -156,6 +164,12 @@ const AccountRightButton = ({

const { networkName, networkImageSource } = useNetworkInfo(hostname);

const nonEvmNetworkImageSource = useMemo(() => {
if (!isEvmSelected && selectedNonEvmNetworkChainId) {
return getNetworkImageSource({ chainId: selectedNonEvmNetworkChainId });
}
}, [isEvmSelected, selectedNonEvmNetworkChainId]);

const renderAvatarAccount = () => (
<AvatarAccount type={avatarAccountType} accountAddress={selectedAddress} />
);
Expand All @@ -179,7 +193,9 @@ const AccountRightButton = ({
: nonEvmNetworkConfigurations?.[selectedNonEvmNetworkChainId]
?.name
}
imageSource={isEvmSelected ? networkImageSource : images.SOLANA}
imageSource={
isEvmSelected ? networkImageSource : nonEvmNetworkImageSource
}
/>
)}
</TouchableOpacity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ const styleSheet = (params: { theme: Theme }) => {

return StyleSheet.create({
tradeInfoContainer: {
paddingBottom: 12,
paddingBottom: 30,
},
emptyStateContainer: {
paddingBottom: 30,
},
wrapper: {
flex: 1,
Expand Down
12 changes: 7 additions & 5 deletions app/components/UI/Perps/Views/PerpsTabView/PerpsTabView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,13 @@ const PerpsTabView: React.FC<PerpsTabViewProps> = () => {
}}
>
{!isInitialLoading && hasNoPositionsOrOrders ? (
<PerpsEmptyState
onAction={handleNewTrade}
testID="perps-empty-state"
twClassName="mx-auto"
/>
<View style={styles.emptyStateContainer}>
<PerpsEmptyState
onAction={handleNewTrade}
testID="perps-empty-state"
twClassName="mx-auto"
/>
</View>
) : (
<View style={styles.tradeInfoContainer}>
<View>{renderPositionsSection()}</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,15 +343,7 @@ const PerpsTransactionsView: React.FC<PerpsTransactionsViewProps> = () => {
</View>
);

const filterTabs: FilterTab[] = useMemo(
() => [
strings('perps.transactions.tabs.trades'),
strings('perps.transactions.tabs.orders'),
strings('perps.transactions.tabs.funding'),
strings('perps.transactions.tabs.deposits'),
],
[],
);
const filterTabs: FilterTab[] = ['Trades', 'Orders', 'Funding', 'Deposits'];

const filterTabDescription = useMemo(() => {
if (activeFilter === 'Funding') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2166,6 +2166,7 @@ describe('PerpsController', () => {
networkClientId: mockNetworkClientId,
origin: 'metamask',
type: 'perpsDeposit',
skipInitialGasEstimate: true,
});
});

Expand Down
1 change: 1 addition & 0 deletions app/components/UI/Perps/controllers/PerpsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,7 @@ export class PerpsController extends BaseController<
networkClientId,
origin: 'metamask',
type: TransactionType.perpsDeposit,
skipInitialGasEstimate: true,
});

// Store the transaction ID and try to get amount from transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2605,6 +2605,8 @@ describe('PredictController', () => {
networkClientId: 'mainnet',
disableHook: true,
disableSequential: true,
disableUpgrade: true,
skipInitialGasEstimate: true,
transactions: mockTransactions,
});
});
Expand Down
2 changes: 2 additions & 0 deletions app/components/UI/Predict/controllers/PredictController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1760,6 +1760,8 @@ export class PredictController extends BaseController<
networkClientId,
disableHook: true,
disableSequential: true,
disableUpgrade: true,
skipInitialGasEstimate: true,
transactions,
});

Expand Down
2 changes: 2 additions & 0 deletions app/components/UI/Predict/providers/polymarket/safe/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ export const getDeployProxyWalletTransaction = async ({
to: SAFE_FACTORY_ADDRESS as Hex,
data: calldata,
},
type: TransactionType.contractInteraction,
};
} catch (error) {
console.error('Error creating proxy wallet', error);
Expand Down Expand Up @@ -580,6 +581,7 @@ export const getProxyWalletAllowancesTransaction = async ({
to: safeAddress as Hex,
data: callData as Hex,
},
type: TransactionType.contractInteraction,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ exports[`BuildQuote View Balance display displays balance from useBalance for no
}
}
>
Amount to buy
Buy
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -3090,7 +3090,7 @@ exports[`BuildQuote View Crypto Currency Data renders a special error page if cr
}
}
>
Amount to buy
Buy
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -3753,7 +3753,7 @@ exports[`BuildQuote View Crypto Currency Data renders a special error page if cr
}
}
>
Amount to sell
Sell
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -4513,7 +4513,7 @@ exports[`BuildQuote View Crypto Currency Data renders an error page when there i
}
}
>
Amount to buy
Buy
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -5273,7 +5273,7 @@ exports[`BuildQuote View Crypto Currency Data renders the loading page when cryp
}
}
>
Amount to buy
Buy
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -7836,7 +7836,7 @@ exports[`BuildQuote View Fiat Currency Data renders an error page when there is
}
}
>
Amount to buy
Buy
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -8596,7 +8596,7 @@ exports[`BuildQuote View Fiat Currency Data renders the loading page when fiats
}
}
>
Amount to buy
Buy
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -11068,7 +11068,7 @@ exports[`BuildQuote View Payment Method Data renders an error page when there is
}
}
>
Amount to buy
Buy
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -11828,7 +11828,7 @@ exports[`BuildQuote View Payment Method Data renders no icons if there are no pa
}
}
>
Amount to buy
Buy
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -14644,7 +14644,7 @@ exports[`BuildQuote View Payment Method Data renders the loading page when payme
}
}
>
Amount to buy
Buy
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -17382,7 +17382,7 @@ exports[`BuildQuote View Regions data renders an error page when there is a regi
}
}
>
Amount to buy
Buy
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -18142,7 +18142,7 @@ exports[`BuildQuote View Regions data renders the loading page when regions are
}
}
>
Amount to buy
Buy
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -20578,7 +20578,7 @@ exports[`BuildQuote View renders correctly 1`] = `
}
}
>
Amount to buy
Buy
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -23340,7 +23340,7 @@ exports[`BuildQuote View renders correctly 2`] = `
}
}
>
Amount to sell
Sell
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -26179,7 +26179,7 @@ exports[`BuildQuote View renders correctly when sdkError is present 1`] = `
}
}
>
Amount to buy
Buy
</Text>
</TouchableOpacity>
</View>
Expand Down Expand Up @@ -26842,7 +26842,7 @@ exports[`BuildQuote View renders correctly when sdkError is present 2`] = `
}
}
>
Amount to sell
Sell
</Text>
</TouchableOpacity>
</View>
Expand Down
Loading
Loading