Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(release): 7.0.0 #6465

Merged
merged 26 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fa6f915
6.6.0
metamaskbot May 5, 2023
64a9d5c
notify appium server test is done (#6349)
chrisleewilcox May 9, 2023
cd052af
add tags and simplify feature description (#6353)
chrisleewilcox May 9, 2023
e10440f
[FIX] Appium: remove duplicate step onboarding (#6356)
chrisleewilcox May 10, 2023
3911d7c
[FEAT] wallet connect v2 (#6355)
abretonc7s May 12, 2023
6755cdd
Revert "[FEAT] wallet connect v2 (#6355)" (#6379)
andreahaku May 12, 2023
f8bd95d
User can not longer edit account name to be an empty string (#6389)
tommasini May 15, 2023
4465304
[FIX] [6.6.0] Block explorer name on Account Actions (#6390)
tommasini May 16, 2023
8153140
Force Bitrise to build with intel medium stack machine (#6412)
Cal-L May 16, 2023
66f7b1d
[FIX] - Fix input display when editing account name (#6413)
tommasini May 16, 2023
b42e80e
[FIX] [6.6.0] - Onboarding wizard misaligned (#6395)
tommasini May 19, 2023
72c9b8b
[FIX] [6.6.0] - Import tokens and NFTs button now visible (#6431)
tommasini May 20, 2023
1aa710c
[FIX] Send ETH displays Collectible as predefault value in the Amount…
blackdevelopa May 23, 2023
47fa598
RC2 build 1113 (#6448)
chrisleewilcox May 23, 2023
9a946ed
Fix ENS name displayed on confirm send page (#6350) (#6456)
jpuri May 24, 2023
e5ebba6
build version bump to 1114 (#6460)
chrisleewilcox May 24, 2023
2a1b3d1
7.0.0
metamaskbot May 25, 2023
684f7ca
[FEATURE] WalletConnect v2 Integration (#6380)
andreahaku May 26, 2023
bd44e9a
[FEAT] wc2 (#6492)
abretonc7s May 31, 2023
405cc77
build 1117 RC3 (#6501)
chrisleewilcox May 31, 2023
5e9f1b6
[FIX] wc2 integration with eth_sendTransaction (#6528)
abretonc7s Jun 5, 2023
4715ad0
build version bump to 1119 (#6531)
chrisleewilcox Jun 5, 2023
8245f5f
adds try/catch to catch error in case of missing WCv2 missing ID (#6536)
andreahaku Jun 6, 2023
b9217ab
update changelog
sethkfman Jun 6, 2023
2fca340
sync 7.1.0 branch
sethkfman Jun 6, 2023
2da467f
removed conflict tags
sethkfman Jun 6, 2023
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
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}
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,27 @@
- [#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
- [#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

## 6.5.0 - May 4, 2023
- [#5743](https://github.com/MetaMask/metamask-mobile/pull/5743): [FEATURE] On-ramp: Add buy-crypto deeplink
- [#6201](https://github.com/MetaMask/metamask-mobile/pull/6201): [FIX] [SDK] Missing redirect breaking backward compatibility
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
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 @@ -347,21 +348,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 @@ -418,6 +418,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 @@ -435,11 +440,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
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
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
66 changes: 57 additions & 9 deletions app/components/Views/WalletConnectSessions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import { getNavigationOptionsTitle } from '../../UI/Navbar';
import WebsiteIcon from '../../UI/WebsiteIcon';
import AsyncStorage from '@react-native-async-storage/async-storage';
import ActionSheet from 'react-native-actionsheet';
import WalletConnect from '../../../core/WalletConnect';
import WalletConnect from '../../../core/WalletConnect/WalletConnect';
import Logger from '../../../util/Logger';
import { WALLETCONNECT_SESSIONS } from '../../../constants/storage';
import { ThemeContext, mockTheme } from '../../../util/theme';
import PropTypes from 'prop-types';
import WC2Manager from '../../../../app/core/WalletConnect/WalletConnectV2';

const createStyles = (colors) =>
StyleSheet.create({
Expand Down Expand Up @@ -80,6 +81,7 @@ const createStyles = (colors) =>
export default class WalletConnectSessions extends PureComponent {
state = {
sessions: [],
sessionsV2: [],
};

actionSheet = null;
Expand Down Expand Up @@ -114,7 +116,11 @@ export default class WalletConnectSessions extends PureComponent {
if (sessionData) {
sessions = JSON.parse(sessionData);
}
this.setState({ ready: true, sessions });

// Add wallet connect v2 sessions to the list
const sessionsV2 = (await WC2Manager.getInstance())?.getSessions() || [];

this.setState({ ready: true, sessions, sessionsV2 });
};

renderDesc = (meta) => {
Expand All @@ -140,8 +146,16 @@ export default class WalletConnectSessions extends PureComponent {
onActionSheetPress = (index) => (index === 0 ? this.killSession() : null);

killSession = async () => {
const isV2 = this.sessionToRemove.peerId === undefined;
try {
await WalletConnect.killSession(this.sessionToRemove.peerId);
if (isV2) {
await (
await WC2Manager.getInstance()
)?.removeSession(this.sessionToRemove);
} else {
await WalletConnect.killSession(this.sessionToRemove.peerId);
}

Alert.alert(
strings('walletconnect_sessions.session_ended_title'),
strings('walletconnect_sessions.session_ended_desc'),
Expand All @@ -153,11 +167,20 @@ export default class WalletConnectSessions extends PureComponent {
};

renderSessions = () => {
const { sessions } = this.state;
const { sessions, sessionsV2 } = this.state;

return (
<>
{sessions.map((session) => this.renderV1(session))}
{sessionsV2.map((session, index) => this.renderV2(session, index))}
</>
);
};

renderV1 = (session) => {
const colors = this.context.colors || mockTheme.colors;
const styles = createStyles(colors);

return sessions.map((session) => (
return (
<TouchableOpacity
// eslint-disable-next-line react/jsx-no-bind
onLongPress={() => this.onLongPress(session)}
Expand All @@ -172,7 +195,31 @@ export default class WalletConnectSessions extends PureComponent {
{this.renderDesc(session.peerMeta)}
</View>
</TouchableOpacity>
));
);
};

renderV2 = (session, index) => {
const colors = this.context.colors || mockTheme.colors;
const styles = createStyles(colors);
return (
<TouchableOpacity
// eslint-disable-next-line react/jsx-no-bind
onLongPress={() => this.onLongPress(session)}
key={`session_${session.id}_${index}`}
style={styles.row}
>
<WebsiteIcon
url={session.peer.metadata.url}
style={styles.websiteIcon}
/>
<View style={styles.info}>
<Text style={styles.name}>{session.peer.metadata.name}</Text>
<Text style={styles.url}>{session.topic}</Text>
<Text style={styles.url}>{session.peer.metadata.url}</Text>
{this.renderDesc(session.peer.metadata)}
</View>
</TouchableOpacity>
);
};

renderEmpty = () => {
Expand All @@ -189,12 +236,13 @@ export default class WalletConnectSessions extends PureComponent {
};

render = () => {
const { ready, sessions } = this.state;
const { ready, sessions, sessionsV2 } = this.state;
if (!ready) return null;
const colors = this.context.colors || mockTheme.colors;
const themeAppearance = this.context.themeAppearance;
const styles = createStyles(colors);

const sessionsLength = sessions.length + sessionsV2.length;
return (
<SafeAreaView
style={styles.wrapper}
Expand All @@ -204,7 +252,7 @@ export default class WalletConnectSessions extends PureComponent {
style={styles.wrapper}
contentContainerStyle={styles.scrollviewContent}
>
{sessions.length ? this.renderSessions() : this.renderEmpty()}
{sessionsLength > 0 ? this.renderSessions() : this.renderEmpty()}
</ScrollView>
<ActionSheet
ref={this.createActionSheetRef}
Expand Down
15 changes: 12 additions & 3 deletions app/core/AppConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ export default {
//One day in hours
SESSION_LIFETIME: 24,
LIMIT_SESSIONS: 20,
DEEPLINK_SESSIONS: 'wc2sessions_deeplink',
PROJECT_ID: process.env.WALLET_CONNECT_PROJECT_ID,
METADATA: {
name: 'MetaMask Wallet',
description: 'MetaMask Wallet Integration',
url: 'https://metamask.io/',
icons: [],
},
},
SWAPS: {
ACTIVE: true,
Expand Down Expand Up @@ -120,14 +128,15 @@ export default {
REQUEST_SOURCES: {
SDK_REMOTE_CONN: 'MetaMask-SDK-Remote-Conn',
WC: 'WalletConnect',
WC2: 'WalletConnectV2',
IN_APP_BROWSER: 'In-App-Browser',
},
MM_SDK: {
SDK_CONNECTIONS: 'sdkConnections',
SDK_APPROVEDHOSTS: 'sdkApprovedHosts',
// Adjust the serverUrl during local dev if need to debug the communication protocol.
// SERVER_URL: 'http://192.168.50.114:4000',
SERVER_URL: 'https://metamask-sdk-socket.metafi.codefi.network/',
SERVER_URL:
process.env.SDK_COMMLAYER_URL ??
'https://metamask-sdk-socket.metafi.codefi.network/',
PLATFORM: 'metamask-mobile',
SDK_REMOTE_ORIGIN: 'MMSDKREMOTE::',
UNKNOWN_PARAM: 'UNKNOWN',
Expand Down
Loading