Skip to content

Commit

Permalink
Merge branch 'main' into swaps/token-details-feedback-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
nikoferro authored Jun 8, 2023
2 parents 139c136 + 1309c21 commit 8443d8e
Show file tree
Hide file tree
Showing 43 changed files with 2,032 additions and 214 deletions.
7 changes: 7 additions & 0 deletions .js.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ export MM_TEST_ACCOUNT_PRIVATE_KEY=""

# address is the address of the first account generated from the previous SRP
export MM_TEST_ACCOUNT_ADDRESS=""


# Wallet connect project id -- should be v2 compatible
export WALLET_CONNECT_PROJECT_ID=""

# Optional: SDK Remote Communication url (for testing with your local socket server)
# export SDK_COMMLAYER_URL="http://{YOUR_LOCAL_IP}
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0
3.0.2
72 changes: 72 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,78 @@
# Changelog

## Current Main Branch
- [#6344](https://github.com/MetaMask/metamask-mobile/pull/6344): 6.6.0
- [#6440](https://github.com/MetaMask/metamask-mobile/pull/6440): ci(GH Action): validate PR title validator against conventional commit format
- [#6454](https://github.com/MetaMask/metamask-mobile/pull/6454): Send ERC20 token from test-dapp
- [#6334](https://github.com/MetaMask/metamask-mobile/pull/6334): Add Aurora Token Detection
- [#6351](https://github.com/MetaMask/metamask-mobile/pull/6351): On-ramp: use thunk to handle processed order side effects
- [#5829](https://github.com/MetaMask/metamask-mobile/pull/5829): Update order of browser page load events
- [#6230](https://github.com/MetaMask/metamask-mobile/pull/6230): Asset Overview / Token Detail view redesign
- [#6347](https://github.com/MetaMask/metamask-mobile/pull/6347): New Crowdin translations by Github Action
- [#6381](https://github.com/MetaMask/metamask-mobile/pull/6381): On-ramp: add params validation to useSDKMethod hook
- [#6461](https://github.com/MetaMask/metamask-mobile/pull/6461): commented outCI sonar steps until access has been resovled
- [#6365](https://github.com/MetaMask/metamask-mobile/pull/6365): On-ramp: remove hardcoded selected network name
- [#6421](https://github.com/MetaMask/metamask-mobile/pull/6421): exclude legacy types from rate limiting
- [#6354](https://github.com/MetaMask/metamask-mobile/pull/6354): Trigger signing modals from approval requests
- [#6450](https://github.com/MetaMask/metamask-mobile/pull/6450): [Translations]
- [#6449](https://github.com/MetaMask/metamask-mobile/pull/6449): Bump socket.io-parser from 4.2.2 to 4.2.3
- [#6432](https://github.com/MetaMask/metamask-mobile/pull/6432): ci(sonar): Configure SonarCloud Analysis on CI
- [#6441](https://github.com/MetaMask/metamask-mobile/pull/6441): On-ramp: use screen in on-ramp views tests
- [#6442](https://github.com/MetaMask/metamask-mobile/pull/6442): fix(ci): Remove `restore-build` steps
- [#6416](https://github.com/MetaMask/metamask-mobile/pull/6416): Bump vm2 from 3.9.17 to 3.9.19
- [#6447](https://github.com/MetaMask/metamask-mobile/pull/6447): Removed smoke tag from test due to bs failures
- [#6217](https://github.com/MetaMask/metamask-mobile/pull/6217): [e2e] Add Ganache seeder for deploying contracts and add simple Send ETH test to Multisig contract
- [#6040](https://github.com/MetaMask/metamask-mobile/pull/6040): Add validation to send amount input box.
- [#6311](https://github.com/MetaMask/metamask-mobile/pull/6311): Fix token balance displayed in approval pages
- [#6406](https://github.com/MetaMask/metamask-mobile/pull/6406): Use core signature controller
- [#6439](https://github.com/MetaMask/metamask-mobile/pull/6439): fix: remove invalid accessibilityRole value
- [#6427](https://github.com/MetaMask/metamask-mobile/pull/6427): refactor: Refactor unit tests for React Native 0.71.6 upgrade
- [#6289](https://github.com/MetaMask/metamask-mobile/pull/6289): feat(ci): Sonar Action to work with SonarCloud
- [#6366](https://github.com/MetaMask/metamask-mobile/pull/6366): feat(CI): Convert Bitrise Workflows to Pipelines
- [#6350](https://github.com/MetaMask/metamask-mobile/pull/6350): Fix ENS name displayed on confirm send page
- [#6192](https://github.com/MetaMask/metamask-mobile/pull/6192): Show account balance in signature screen
- [#6394](https://github.com/MetaMask/metamask-mobile/pull/6394): feat(ci): removed the matrix option from unit testing
- [#6227](https://github.com/MetaMask/metamask-mobile/pull/6227): [MC 0.5] Modal network selector replace by network selector sheet
- [#6393](https://github.com/MetaMask/metamask-mobile/pull/6393): feat(ci): upgrade ruby to 3.0.0
- [#6274](https://github.com/MetaMask/metamask-mobile/pull/6274): Confirmations: Empty SiteURL and Null TagURL in modal
- [#6137](https://github.com/MetaMask/metamask-mobile/pull/6137): Clicking toAddress to add it to address book
- [#6079](https://github.com/MetaMask/metamask-mobile/pull/6079): Refactor sanitization middleware
- [#6234](https://github.com/MetaMask/metamask-mobile/pull/6234): [REFACTOR] Clear Privacy section
- [#6391](https://github.com/MetaMask/metamask-mobile/pull/6391): Revert "Use core signature controller (#6214)"
- [#6342](https://github.com/MetaMask/metamask-mobile/pull/6342): Improve processing of redirection URL
- [#6374](https://github.com/MetaMask/metamask-mobile/pull/6374): Update en.json with eth_sign
- [#6375](https://github.com/MetaMask/metamask-mobile/pull/6375): Force Bitrise to build with intel medium stack machine
- [#6214](https://github.com/MetaMask/metamask-mobile/pull/6214): Use core signature controller
- [#6170](https://github.com/MetaMask/metamask-mobile/pull/6170): Upgrade to Jest 27 for improved performance and RN upgrade compatibility
- [#6370](https://github.com/MetaMask/metamask-mobile/pull/6370): configure smoke test for bitrise
- [#6328](https://github.com/MetaMask/metamask-mobile/pull/6328): chore(devDeps): bump webdriverio packages
- [#6362](https://github.com/MetaMask/metamask-mobile/pull/6362): Added retries
- [#6125](https://github.com/MetaMask/metamask-mobile/pull/6125): Update controller packages to match core v42
- [#6124](https://github.com/MetaMask/metamask-mobile/pull/6124): Update controller packages to match core v40
- [#6345](https://github.com/MetaMask/metamask-mobile/pull/6345): Update es.js file
- [#6339](https://github.com/MetaMask/metamask-mobile/pull/6339): Fix yarn watch clean
- [#6215](https://github.com/MetaMask/metamask-mobile/pull/6215): [e2e] Send ETH to an EOA using Ganache network on Android

## 6.6.0 - May 25, 2023
- [#5866](https://github.com/MetaMask/metamask-mobile/pull/5866): [FIX] sturdier check
- [#6340](https://github.com/MetaMask/metamask-mobile/pull/6340): [FIX] Missing network name onramp
- [#6325](https://github.com/MetaMask/metamask-mobile/pull/6325): [FEATURE] Add development environment to onramp-sdk
- [#6309](https://github.com/MetaMask/metamask-mobile/pull/6309): [FIX] Missing handler on mandatory modal
- [#6165](https://github.com/MetaMask/metamask-mobile/pull/6165): [FEATURE] Edit account name view
- [#5876](https://github.com/MetaMask/metamask-mobile/pull/5876): [FIX] Gas is not re-calculated when updating a transaction
- [#6093](https://github.com/MetaMask/metamask-mobile/pull/6093): [FEATURE] Account actions on wallet view
- [#6253](https://github.com/MetaMask/metamask-mobile/pull/6253): [FIX] Confirm button should be disabled if account has no balance
- [#6097](https://github.com/MetaMask/metamask-mobile/pull/6097): [UPDATE] Extracting out signature request related code from RootRPCMethodsUI conponent
- [#6246](https://github.com/MetaMask/metamask-mobile/pull/6246): [FIX] Wrong to account information on confirmation page
- [#6085](https://github.com/MetaMask/metamask-mobile/pull/6085): [FEATURE] Update account section with card
- [#6255](https://github.com/MetaMask/metamask-mobile/pull/6255): [UPDATE] Onboarding translation updated
- [#6210](https://github.com/MetaMask/metamask-mobile/pull/6210): [UPDATE] Extend the readme documentation to cover E2E testing in more detail.
- [#6249](https://github.com/MetaMask/metamask-mobile/pull/6249): [FIX] Terms of Use checkbox test id
- [#6228](https://github.com/MetaMask/metamask-mobile/pull/6228): [UPDATE] Checkbox component
- [#6226](https://github.com/MetaMask/metamask-mobile/pull/6226): [UPDATE] Button's icon props and button org

## 7.0.0 - Jun 6, 2023
- [#6536](https://github.com/MetaMask/metamask-mobile/pull/6380): [FEATURE] WalletConnect v2 Integration (#6380)

## 6.6.0 - May 25, 2023
- [#5866](https://github.com/MetaMask/metamask-mobile/pull/5866): [FIX] sturdier check
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ cd metamask-mobile

- _MetaMask Only:_ Rename the `.*.env.example` files (remove the `.example`) in the root of the project and fill in the appropriate values for each key. Get the values from another MetaMask Mobile developer.
- _Non-MetaMask Only:_ In the project root folder run
- If you intend to use WalletConnect v2 during your development, you should register to get a projectId from WalletConnect website and set the `WALLET_CONNECT_PROJECT_ID` value accordingly in .js.env file.
```
cp .ios.env.example .ios.env && \
cp .android.env.example .android.env && \
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ android {
applicationId "io.metamask"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1114
versionName "6.6.0"
versionCode 1116
versionName "7.1.0"
multiDexEnabled true
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy "minReactNative", "minReactNative46"
Expand Down
18 changes: 10 additions & 8 deletions app/components/Nav/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import AccountActions from '../../../components/Views/AccountActions';
import WalletActions from '../../Views/WalletActions';
import NetworkSelector from '../../../components/Views/NetworkSelector';
import EditAccountName from '../../Views/EditAccountName/EditAccountName';
import WC2Manager from '../../../../app/core/WalletConnect/WalletConnectV2';

const clearStackNavigatorOptions = {
headerShown: false,
Expand Down Expand Up @@ -346,21 +347,22 @@ const App = ({ userLoggedIn }) => {

useEffect(() => {
if (navigator) {
SDKConnect.getInstance().init({ navigation: navigator });
SDKConnect.getInstance()
.init({ navigation: navigator })
.catch((err) => {
console.error(`Cannot initialize SDKConnect`, err);
});
}
return () => {
SDKConnect.getInstance().unmount();
};
}, [navigator]);

useEffect(() => {
if (navigator) {
SDKConnect.getInstance().init({ navigation: navigator });
}
return () => {
SDKConnect.getInstance().unmount();
};
}, [navigator]);
WC2Manager.init().catch((err) => {
console.error(`Cannot initialize WalletConnect Manager.`, err);
});
}, []);

useEffect(() => {
async function checkExisting() {
Expand Down
13 changes: 7 additions & 6 deletions app/components/Nav/Main/RootRPCMethodsUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
setTransactionObject,
} from '../../../actions/transaction';
import Modal from 'react-native-modal';
import WalletConnect from '../../../core/WalletConnect';
import WalletConnect from '../../../core/WalletConnect/WalletConnect';
import {
getMethodData,
TOKEN_METHOD_TRANSFER,
Expand Down Expand Up @@ -417,6 +417,11 @@ const RootRPCMethodsUI = (props) => {

const renderWalletConnectSessionRequestModal = () => {
const meta = walletConnectRequestInfo?.data?.peerMeta || null;
const currentPageInformation = {
title: meta?.name || meta?.title,
url: meta?.url,
icon: meta?.icons?.[0],
};
return (
<Modal
isVisible={showPendingApproval?.type === ApprovalTypes.WALLET_CONNECT}
Expand All @@ -434,11 +439,7 @@ const RootRPCMethodsUI = (props) => {
<AccountApproval
onCancel={onWalletConnectSessionRejected}
onConfirm={onWalletConnectSessionApproval}
currentPageInformation={{
title: meta?.name,
url: meta?.url,
icon: meta?.icons?.[0],
}}
currentPageInformation={currentPageInformation}
walletConnectRequest
/>
</Modal>
Expand Down
4 changes: 3 additions & 1 deletion app/components/UI/AccountInfoCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class AccountInfoCard extends PureComponent {
ticker: PropTypes.string,
transaction: PropTypes.object,
activeTabUrl: PropTypes.string,
origin: PropTypes.string,
};

state = {
Expand Down Expand Up @@ -156,6 +157,7 @@ class AccountInfoCard extends PureComponent {
fromAddress: rawFromAddress,
transaction,
activeTabUrl,
origin,
} = this.props;

const fromAddress = safeToChecksumAddress(rawFromAddress);
Expand All @@ -176,7 +178,7 @@ class AccountInfoCard extends PureComponent {
)?.toUpperCase();
return operation === 'signing' && transaction !== undefined ? (
<ApproveTransactionHeader
origin={transaction.origin}
origin={transaction.origin || origin}
url={activeTabUrl}
from={rawFromAddress}
/>
Expand Down
9 changes: 9 additions & 0 deletions app/components/UI/AccountInfoCard/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,13 @@ describe('AccountInfoCard', () => {
);
expect(getByText('Balance')).toBeDefined();
});

it('should show origin header in signing page', async () => {
const { getByText } = renderWithProvider(
<AccountInfoCard fromAddress="0x0" operation="signing" />,
{ state: initialState },
);

expect(getByText('https://metamask.io')).toBeDefined();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ exports[`ApproveTransactionHeader should return origin to be null when not prese
}
}
>
0
&lt; 0.00001 ETH
</Text>
</View>
</View>
Expand Down
6 changes: 5 additions & 1 deletion app/components/UI/SignatureRequest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,11 @@ class SignatureRequest extends PureComponent {
return (
<View style={styles.actionViewChild}>
<View style={styles.accountInfoCardWrapper}>
<AccountInfoCard operation="signing" fromAddress={fromAddress} />
<AccountInfoCard
operation="signing"
fromAddress={fromAddress}
origin={title}
/>
</View>
<TouchableOpacity
style={styles.children}
Expand Down
14 changes: 14 additions & 0 deletions app/components/Views/Approval/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { resetTransaction } from '../../../actions/transaction';
import { connect } from 'react-redux';
import NotificationManager from '../../../core/NotificationManager';
import Analytics from '../../../core/Analytics/Analytics';
import AppConstants from '../../../core/AppConstants';
import { MetaMetricsEvents } from '../../../core/Analytics';
import {
getTransactionReviewActionKey,
Expand Down Expand Up @@ -109,6 +110,14 @@ class Approval extends PureComponent {
transactionConfirmed: false,
};

originIsWalletConnect = this.props.transaction.origin?.startsWith(
WALLET_CONNECT_ORIGIN,
);

originIsMMSDKRemoteConn = this.props.transaction.origin?.startsWith(
AppConstants.MM_SDK.SDK_REMOTE_ORIGIN,
);

updateNavBar = () => {
const colors = this.context.colors || mockTheme.colors;
const { navigation } = this.props;
Expand Down Expand Up @@ -264,6 +273,11 @@ class Approval extends PureComponent {
gas_estimate_type: gasEstimateType,
gas_mode: gasSelected ? 'Basic' : 'Advanced',
speed_set: gasSelected || undefined,
request_source: this.originIsMMSDKRemoteConn
? AppConstants.REQUEST_SOURCES.SDK_REMOTE_CONN
: this.originIsWalletConnect
? AppConstants.REQUEST_SOURCES.WC
: AppConstants.REQUEST_SOURCES.IN_APP_BROWSER,
};
} catch (error) {
return {};
Expand Down
20 changes: 13 additions & 7 deletions app/components/Views/Asset/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,15 @@ class Asset extends PureComponent {
});
};

const displaySwapsButton =
isSwapsFeatureLive &&
isNetworkAllowed &&
isAssetAllowed &&
AppConstants.SWAPS.ACTIVE;

const displayBuyButton =
asset.isETH && this.props.isNetworkBuyNativeTokenSupported;

return (
<View style={styles.wrapper}>
{loading ? (
Expand All @@ -504,9 +513,9 @@ class Asset extends PureComponent {
onScrollThroughContent={this.onScrollThroughContent}
/>
)}
{!asset.balanceError && (
<View style={{ ...styles.footer, ...styles.footerBorder }}>
{asset.isETH && this.props.isNetworkBuyNativeTokenSupported && (
{!asset.balanceError && (displayBuyButton || displaySwapsButton) && (
<View style={styles.footer}>
{displayBuyButton && (
<Button
variant={ButtonVariants.Secondary}
size={ButtonSize.Lg}
Expand All @@ -519,11 +528,8 @@ class Asset extends PureComponent {
onPress={onBuy}
/>
)}
{AppConstants.SWAPS.ACTIVE && (
{displaySwapsButton && (
<Button
disabled={
!isSwapsFeatureLive || !isNetworkAllowed || !isAssetAllowed
}
variant={ButtonVariants.Primary}
size={ButtonSize.Lg}
label={strings('asset_overview.swap')}
Expand Down
3 changes: 2 additions & 1 deletion app/components/Views/SDKSessionsManager/SDKSessionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const createStyles = (
} as TextStyle,
dappName: {
flexShrink: 1,
flexGrow: 1,
marginLeft: 5,
marginRight: 5,
flexWrap: 'wrap',
Expand Down Expand Up @@ -69,7 +70,7 @@ export const SDKSessionItem = ({
const _sessionName =
connection.originatorInfo?.url ||
connection.originatorInfo?.title ||
strings('sdk.unkown_dapp');
connection.id;
setIcon(connection.originatorInfo?.icon);
setSessionName(_sessionName);
}, [connection]);
Expand Down
14 changes: 14 additions & 0 deletions app/components/Views/SendFlow/Confirm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
import { getGasLimit } from '../../../../util/custom-gas';
import Engine from '../../../../core/Engine';
import Logger from '../../../../util/Logger';
import { WALLET_CONNECT_ORIGIN } from '../../../../util/walletconnect';
import CustomNonceModal from '../../../UI/CustomNonceModal';
import NotificationManager from '../../../../core/NotificationManager';
import { strings } from '../../../../../locales/i18n';
Expand Down Expand Up @@ -238,6 +239,14 @@ class Confirm extends PureComponent {
multiLayerL1FeeTotal: '0x0',
};

originIsWalletConnect = this.props.transaction.origin?.startsWith(
WALLET_CONNECT_ORIGIN,
);

originIsMMSDKRemoteConn = this.props.transaction.origin?.startsWith(
AppConstants.MM_SDK.SDK_REMOTE_ORIGIN,
);

setNetworkNonce = async () => {
const { setNonce, setProposedNonce, transaction } = this.props;
const proposedNonce = await getNetworkNonce(transaction);
Expand All @@ -257,6 +266,11 @@ class Confirm extends PureComponent {
gas_estimate_type: gasEstimateType,
gas_mode: gasSelected ? 'Basic' : 'Advanced',
speed_set: gasSelected || undefined,
request_source: this.originIsMMSDKRemoteConn
? AppConstants.REQUEST_SOURCES.SDK_REMOTE_CONN
: this.originIsWalletConnect
? AppConstants.REQUEST_SOURCES.WC
: AppConstants.REQUEST_SOURCES.IN_APP_BROWSER,
};
} catch (error) {
return {};
Expand Down
Loading

0 comments on commit 8443d8e

Please sign in to comment.