Skip to content

Commit

Permalink
Merge branch 'salim/bump-network-controller-21.0.0-migration' into sa…
Browse files Browse the repository at this point in the history
…lim/default-rpc-feature
  • Loading branch information
salimtb committed Oct 11, 2024
1 parent 3924dd6 commit 963f438
Show file tree
Hide file tree
Showing 29 changed files with 811 additions and 285 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@ exports[`CellSelectWithMenu should render with default settings correctly 1`] =
"alignItems": "center",
"backgroundColor": "#ffffff",
"flexDirection": "row",
"paddingRight": 20,
"width": "100%",
}
}
>
<TouchableOpacity
disabled={false}
style={
{
"flex": 1,
"opacity": 1,
"padding": 16,
"position": "relative",
"width": "90%",
"zIndex": 1,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ListItemMultiSelectButtonProps } from './ListItemMultiSelectButton.type
// Defaults
export const DEFAULT_LISTITEMMULTISELECT_GAP = 16;
export const BUTTON_TEST_ID = 'button-menu-select-test-id';
export const BUTTON_TEXT_TEST_ID = 'button-text-select-test-id';

// Sample consts
export const SAMPLE_LISTITEMMULTISELECT_PROPS: ListItemMultiSelectButtonProps =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ const styleSheet = (params: {
return StyleSheet.create({
base: Object.assign(
{
flex: 1,
position: 'relative',
opacity: isDisabled ? 0.5 : 1,
padding: 16,
width: '90%',
zIndex: 1,
} as ViewStyle,
style,
Expand Down Expand Up @@ -71,10 +71,8 @@ const styleSheet = (params: {
backgroundColor: isSelected
? colors.primary.muted
: colors.background.default,
paddingRight: 20,
flexDirection: 'row',
alignItems: 'center',
width: '100%',
},
itemColumn: {
display: 'flex',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@ exports[`ListItemMultiSelectButton should render correctly with default props 1`
"alignItems": "center",
"backgroundColor": "#ffffff",
"flexDirection": "row",
"paddingRight": 20,
"width": "100%",
}
}
>
<TouchableOpacity
disabled={false}
style={
{
"flex": 1,
"opacity": 1,
"padding": 16,
"position": "relative",
"width": "90%",
"zIndex": 1,
}
}
Expand Down
1 change: 0 additions & 1 deletion app/components/Nav/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,6 @@ const App = (props) => {
component={MultiRpcModal}
/>
) : null}

<Stack.Screen
name={Routes.SHEET.SHOW_TOKEN_ID}
component={ShowTokenIdSheet}
Expand Down
1 change: 0 additions & 1 deletion app/components/Nav/Main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ const Main = (props) => {
networkImageSource: networkImage,
});
}

previousNetworkConfigurations.current = networkConfigurations;
}, [networkConfigurations, networkName, networkImage, toastRef]);

Expand Down
5 changes: 4 additions & 1 deletion app/components/UI/NetworkModal/NetworkAdded/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const createStyles = (colors: any) =>
flexDirection: 'row',
paddingVertical: 16,
},
base: {
padding: 16,
},
button: {
flex: 1,
},
Expand Down Expand Up @@ -41,7 +44,7 @@ const NetworkAdded = (props: NetworkAddedProps) => {
const styles = createStyles(colors);

return (
<View>
<View style={styles.base}>
<Text centered bold black big>
{strings('networks.new_network')}
</Text>
Expand Down
19 changes: 10 additions & 9 deletions app/components/UI/NetworkModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ const NetworkModals = (props: NetworkProps) => {
!isPrivateConnection(url.hostname) && url.set('protocol', 'https:');

const existingNetwork = networkConfigurationByChainId[chainId];
let networkClientId;

if (existingNetwork) {
const updatedNetwork = await NetworkController.updateNetwork(
Expand All @@ -218,12 +219,9 @@ const NetworkModals = (props: NetworkProps) => {
: undefined,
);

const { networkClientId } =
updatedNetwork?.rpcEndpoints?.[
updatedNetwork.defaultRpcEndpointIndex
] ?? {};

await NetworkController.setActiveNetwork(networkClientId);
networkClientId =
updatedNetwork?.rpcEndpoints?.[updatedNetwork.defaultRpcEndpointIndex]
?.networkClientId;
} else {
const addedNetwork = await NetworkController.addNetwork({
chainId,
Expand All @@ -241,12 +239,15 @@ const NetworkModals = (props: NetworkProps) => {
],
});

const { networkClientId } =
addedNetwork?.rpcEndpoints?.[addedNetwork.defaultRpcEndpointIndex] ??
{};
networkClientId =
addedNetwork?.rpcEndpoints?.[addedNetwork.defaultRpcEndpointIndex]
?.networkClientId;
}

if (networkClientId) {
await NetworkController.setActiveNetwork(networkClientId);
}

onClose();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ exports[`NetworkSwitcher View renders and dismisses network modal when pressing
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -703,7 +703,7 @@ exports[`NetworkSwitcher View renders and dismisses network modal when pressing
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -1444,7 +1444,7 @@ exports[`NetworkSwitcher View renders and dismisses network modal when pressing
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -1492,10 +1492,7 @@ exports[`NetworkSwitcher View renders and dismisses network modal when pressing
},
undefined,
undefined,
{
"fontFamily": "EuclidCircularB-Bold",
"fontWeight": "600",
},
false,
undefined,
undefined,
undefined,
Expand Down Expand Up @@ -1598,7 +1595,7 @@ exports[`NetworkSwitcher View renders and dismisses network modal when pressing
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -1648,10 +1645,7 @@ exports[`NetworkSwitcher View renders and dismisses network modal when pressing
},
undefined,
undefined,
{
"fontFamily": "EuclidCircularB-Bold",
"fontWeight": "600",
},
false,
undefined,
undefined,
undefined,
Expand Down Expand Up @@ -2297,7 +2291,7 @@ exports[`NetworkSwitcher View renders and dismisses network modal when pressing
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -2451,7 +2445,7 @@ exports[`NetworkSwitcher View renders and dismisses network modal when pressing
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -2605,7 +2599,7 @@ exports[`NetworkSwitcher View renders and dismisses network modal when pressing
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -2653,10 +2647,7 @@ exports[`NetworkSwitcher View renders and dismisses network modal when pressing
},
undefined,
undefined,
{
"fontFamily": "EuclidCircularB-Bold",
"fontWeight": "600",
},
false,
undefined,
undefined,
undefined,
Expand Down Expand Up @@ -2759,7 +2750,7 @@ exports[`NetworkSwitcher View renders and dismisses network modal when pressing
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -2809,10 +2800,7 @@ exports[`NetworkSwitcher View renders and dismisses network modal when pressing
},
undefined,
undefined,
{
"fontFamily": "EuclidCircularB-Bold",
"fontWeight": "600",
},
false,
undefined,
undefined,
undefined,
Expand Down Expand Up @@ -3458,7 +3446,7 @@ exports[`NetworkSwitcher View renders correctly 1`] = `
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -3612,7 +3600,7 @@ exports[`NetworkSwitcher View renders correctly 1`] = `
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -3766,7 +3754,7 @@ exports[`NetworkSwitcher View renders correctly 1`] = `
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -3814,10 +3802,7 @@ exports[`NetworkSwitcher View renders correctly 1`] = `
},
undefined,
undefined,
{
"fontFamily": "EuclidCircularB-Bold",
"fontWeight": "600",
},
false,
undefined,
undefined,
undefined,
Expand Down Expand Up @@ -3920,7 +3905,7 @@ exports[`NetworkSwitcher View renders correctly 1`] = `
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -3970,10 +3955,7 @@ exports[`NetworkSwitcher View renders correctly 1`] = `
},
undefined,
undefined,
{
"fontFamily": "EuclidCircularB-Bold",
"fontWeight": "600",
},
false,
undefined,
undefined,
undefined,
Expand Down Expand Up @@ -4619,7 +4601,7 @@ exports[`NetworkSwitcher View renders correctly 2`] = `
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -4773,7 +4755,7 @@ exports[`NetworkSwitcher View renders correctly 2`] = `
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -4927,7 +4909,7 @@ exports[`NetworkSwitcher View renders correctly 2`] = `
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -4975,10 +4957,7 @@ exports[`NetworkSwitcher View renders correctly 2`] = `
},
undefined,
undefined,
{
"fontFamily": "EuclidCircularB-Bold",
"fontWeight": "600",
},
false,
undefined,
undefined,
undefined,
Expand Down Expand Up @@ -5081,7 +5060,7 @@ exports[`NetworkSwitcher View renders correctly 2`] = `
{
"borderRadius": 10,
"height": 20,
"marginRight": 10,
"marginRight": 20,
"width": 20,
}
}
Expand Down Expand Up @@ -5131,10 +5110,7 @@ exports[`NetworkSwitcher View renders correctly 2`] = `
},
undefined,
undefined,
{
"fontFamily": "EuclidCircularB-Bold",
"fontWeight": "600",
},
false,
undefined,
undefined,
undefined,
Expand Down
Loading

0 comments on commit 963f438

Please sign in to comment.