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(off-ramp): add off-ramp feature #7037

Merged
merged 61 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
25add46
refactor(ramp): add `common`, `buy`, `sell` folders (#7014)
wachunei Aug 21, 2023
2f4cc0b
refactor(ramp): rename routes and SDK variables. (#7016)
wachunei Aug 21, 2023
de0ea95
Merge branch 'main' into feat/off-ramp
wachunei Aug 22, 2023
c27876d
chore(ramp): remove duplicate key
wachunei Aug 22, 2023
0c13444
Merge branch 'main' into feat/off-ramp
wachunei Aug 23, 2023
1cb9450
Merge branch 'main' into feat/off-ramp
wachunei Aug 25, 2023
5802645
Merge branch 'main' into feat/off-ramp
wachunei Aug 30, 2023
5d964f6
Merge branch 'main' into feat/off-ramp
wachunei Sep 1, 2023
23af827
Merge branch 'main' into feat/off-ramp
wachunei Sep 4, 2023
6b898b2
Merge branch 'main' into feat/off-ramp
wachunei Sep 6, 2023
caec87e
Merge branch 'main' into feat/off-ramp
wachunei Sep 14, 2023
afdec53
Merge branch 'main' into feat/off-ramp
wachunei Sep 25, 2023
6d1eec1
Merge branch 'main' into feat/off-ramp
wachunei Sep 26, 2023
e2c0c39
Merge branch 'main' into feat/off-ramp
wachunei Sep 28, 2023
b3ecf2c
Merge branch 'main' into feat/off-ramp
wachunei Sep 28, 2023
3ddefb7
feat(ramp): add NetworkSwitcher view (#7169)
wachunei Oct 3, 2023
6f56b2d
refactor(ramp): amount to buy rename to build quote + hooks (#7227)
georgeweiler Oct 3, 2023
7cf4172
Merge branch 'main' into feat/off-ramp
wachunei Oct 3, 2023
a16dac5
feat(ramp): use ServicesSignatures in useSDKMethod (#7378)
wachunei Oct 4, 2023
9e00de8
Merge branch 'main' into feat/off-ramp
wachunei Oct 5, 2023
9d66eb7
Merge branch 'main' into feat/off-ramp
wachunei Oct 10, 2023
2f13203
feat(ramp): add initial sell navigation (#7325)
wachunei Oct 12, 2023
af282f8
Merge branch 'main' into feat/off-ramp
wachunei Oct 16, 2023
39248ed
feat(ramp): add getStarted flag for sell (#7401)
wachunei Oct 16, 2023
c2539f1
feat(ramp): build quote ui sell version (#7477)
wachunei Oct 16, 2023
5819315
Merge branch 'main' into feat/off-ramp
wachunei Oct 16, 2023
e0dcb17
refactor(ramp): use isBuy, isSell instead of rampType compare (#7495)
wachunei Oct 17, 2023
33ee217
Merge branch 'main' into feat/off-ramp
wachunei Oct 17, 2023
db41926
Merge branch 'main' into feat/off-ramp
wachunei Oct 18, 2023
d3c1982
Merge branch 'main' into feat/off-ramp
wachunei Oct 25, 2023
4b23e79
feat(ramp): redirect to details after adding sell order (#7522)
wachunei Oct 25, 2023
23c3ad0
refactor(ramp): refactor screen layout props (#7539)
wachunei Oct 25, 2023
9fc758f
feat(ramp): add orders list and list items (#7498)
wachunei Oct 25, 2023
50ee51a
Merge branch 'main' into feat/off-ramp
wachunei Oct 26, 2023
8ece3d4
Merge branch 'main' into feat/off-ramp
wachunei Nov 3, 2023
8e76ade
Merge branch 'main' into feat/off-ramp
wachunei Nov 6, 2023
547f075
Merge branch 'main' into feat/off-ramp
wachunei Nov 7, 2023
df7a01f
Merge branch 'main' into feat/off-ramp
wachunei Nov 8, 2023
1f50638
feat(ramp): add initial send transaction view (#7556)
wachunei Nov 9, 2023
3224b42
feat(ramp): add sell tx hash type and redux actions (#7625)
wachunei Nov 9, 2023
438803c
feat(ramp): add sell tx hash to state when sending sell tx (#7715)
wachunei Nov 9, 2023
024fa8c
Merge branch 'main' into feat/off-ramp
wachunei Nov 9, 2023
fa6cb0a
fix(ramp): update AvatarVariants to AvatarVariant (#7748)
wachunei Nov 9, 2023
3ce1f31
Merge branch 'main' into feat/off-ramp
wachunei Nov 10, 2023
e1b7601
feat(ramp): offramp welcome screen copy updates (#7576)
georgeweiler Nov 10, 2023
db763e3
feat(ramp): offramp unsupported region copy update (#7577)
georgeweiler Nov 10, 2023
3ec9781
Merge branch 'main' into feat/off-ramp
wachunei Nov 13, 2023
2d28d2f
Merge branch 'main' into feat/off-ramp
wachunei Nov 15, 2023
dcd0f64
chore(ramp): upgrade sdk to 1.25.4 (#7800)
wachunei Nov 15, 2023
b4a91b5
feat(ramp): offramp analytics (#7637)
georgeweiler Nov 15, 2023
61934be
refactor(ramp): order list button labels (#7830)
wachunei Nov 15, 2023
3d22aef
Merge branch 'main' into feat/off-ramp
wachunei Nov 16, 2023
dbc7519
feat(ramp): add sell fields to order details view (#7742)
georgeweiler Nov 16, 2023
46ae0f5
feat(ramp): offramp transaction analytics (#7850)
georgeweiler Nov 16, 2023
900a4e4
feat(ramp): use sell get order from callback (#7852)
wachunei Nov 16, 2023
599d187
Merge branch 'main' into feat/off-ramp
wachunei Nov 17, 2023
5dc76e5
Merge branch 'main' into feat/off-ramp
wachunei Nov 17, 2023
04c9dbf
refactor(ramp): update copy for sell (#7854)
wachunei Nov 17, 2023
3ab6eb3
feat(ramp): updates copy on order details page for pre-transacted ord…
georgeweiler Nov 17, 2023
828e350
Merge branch 'main' into feat/off-ramp
wachunei Nov 17, 2023
49e031d
fix(ramp): fix sell copy for unsupported region in build quote (#7872)
wachunei Nov 17, 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
21 changes: 21 additions & 0 deletions app/components/Base/Keypad/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,26 @@ function KeypadComponent({
style={digitButtonStyle}
textStyle={digitTextStyle}
onPress={handleKeypadPress1}
accessibilityRole="button"
accessible
>
1
</Keypad.Button>
<Keypad.Button
style={digitButtonStyle}
textStyle={digitTextStyle}
onPress={handleKeypadPress2}
accessibilityRole="button"
accessible
>
2
</Keypad.Button>
<Keypad.Button
style={digitButtonStyle}
textStyle={digitTextStyle}
onPress={handleKeypadPress3}
accessibilityRole="button"
accessible
>
3
</Keypad.Button>
Expand All @@ -114,20 +120,26 @@ function KeypadComponent({
style={digitButtonStyle}
textStyle={digitTextStyle}
onPress={handleKeypadPress4}
accessibilityRole="button"
accessible
>
4
</Keypad.Button>
<Keypad.Button
style={digitButtonStyle}
textStyle={digitTextStyle}
onPress={handleKeypadPress5}
accessibilityRole="button"
accessible
>
5
</Keypad.Button>
<Keypad.Button
style={digitButtonStyle}
textStyle={digitTextStyle}
onPress={handleKeypadPress6}
accessibilityRole="button"
accessible
>
6
</Keypad.Button>
Expand All @@ -137,20 +149,26 @@ function KeypadComponent({
style={digitButtonStyle}
textStyle={digitTextStyle}
onPress={handleKeypadPress7}
accessibilityRole="button"
accessible
>
7
</Keypad.Button>
<Keypad.Button
style={digitButtonStyle}
textStyle={digitTextStyle}
onPress={handleKeypadPress8}
accessibilityRole="button"
accessible
>
8
</Keypad.Button>
<Keypad.Button
style={digitButtonStyle}
textStyle={digitTextStyle}
onPress={handleKeypadPress9}
accessibilityRole="button"
accessible
>
9
</Keypad.Button>
Expand All @@ -167,10 +185,13 @@ function KeypadComponent({
style={digitButtonStyle}
textStyle={digitTextStyle}
onPress={handleKeypadPress0}
accessibilityRole="button"
accessible
>
0
</Keypad.Button>
<Keypad.DeleteButton
testID="keypad-delete-button"
style={deleteButtonStyle}
icon={deleteIcon}
onPress={handleKeypadPressBack}
Expand Down
95 changes: 46 additions & 49 deletions app/components/Nav/Main/MainNavigator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useRef, useState, useEffect } from 'react';
import { Image, StyleSheet, Keyboard, Platform } from 'react-native';
import PropTypes from 'prop-types';
import { createStackNavigator } from '@react-navigation/stack';
import { useSelector } from 'react-redux';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
Expand Down Expand Up @@ -45,17 +46,21 @@ import SwapsQuotesView from '../../UI/Swaps/QuotesView';
import CollectiblesDetails from '../../UI/CollectibleModal';
import OptinMetrics from '../../UI/OptinMetrics';
import Drawer from '../../UI/Drawer';
import { FiatOnRampSDKProvider } from '../../UI/Ramp/sdk';
import GetStarted from '../../UI/Ramp/Views/GetStarted';
import PaymentMethods from '../../UI/Ramp/Views/PaymentMethods/PaymentMethods';
import AmountToBuy from '../../UI/Ramp/Views/AmountToBuy';
import Quotes from '../../UI/Ramp/Views/Quotes';
import CheckoutWebView from '../../UI/Ramp/Views/Checkout';
import OnRampSettings from '../../UI/Ramp/Views/Settings';
import OnrampAddActivationKey from '../../UI/Ramp/Views/Settings/AddActivationKey';
import Regions from '../../UI/Ramp/Views/Regions';

import { RampSDKProvider } from '../../UI/Ramp/common/sdk';
import { RampType } from '../../UI/Ramp/common/types';
import GetStarted from '../../UI/Ramp/buy/Views/GetStarted';
import PaymentMethods from '../../UI/Ramp/buy/Views/PaymentMethods/PaymentMethods';
import BuildQuote from '../../UI/Ramp/buy/Views/BuildQuote/BuildQuote';
import Quotes from '../../UI/Ramp/buy/Views/Quotes';
import CheckoutWebView from '../../UI/Ramp/buy/Views/Checkout';
import RampSettings from '../../UI/Ramp/common/Views/Settings';
import NetworkSwitcher from '../../UI/Ramp/common/Views/NetworkSwitcher';
import RampAddActivationKey from '../../UI/Ramp/common/Views/Settings/AddActivationKey';
import Regions from '../../UI/Ramp/buy/Views/Regions';
import { colors as importedColors } from '../../../styles/common';
import OrderDetails from '../../UI/Ramp/Views/OrderDetails';
import OrderDetails from '../../UI/Ramp/common/Views/OrderDetails';
import SendTransaction from '../../UI/Ramp/common/Views/SendTransaction';
import TabBar from '../../../component-library/components/Navigation/TabBar';
import BrowserUrlModal from '../../Views/BrowserUrlModal';
import Routes from '../../../constants/navigation/Routes';
Expand Down Expand Up @@ -172,9 +177,10 @@ const WalletTabModalFlow = () => (
const TransactionsHome = () => (
<Stack.Navigator>
<Stack.Screen name={Routes.TRANSACTIONS_VIEW} component={ActivityView} />
<Stack.Screen name={Routes.RAMP.ORDER_DETAILS} component={OrderDetails} />
<Stack.Screen
name={Routes.FIAT_ON_RAMP_AGGREGATOR.ORDER_DETAILS}
component={OrderDetails}
name={Routes.RAMP.SEND_TRANSACTION}
component={SendTransaction}
/>
</Stack.Navigator>
);
Expand Down Expand Up @@ -221,13 +227,10 @@ const SettingsFlow = () => (
component={SecuritySettings}
options={SecuritySettings.navigationOptions}
/>
<Stack.Screen name={Routes.RAMP.SETTINGS} component={RampSettings} />
<Stack.Screen
name={Routes.FIAT_ON_RAMP_AGGREGATOR.SETTINGS}
component={OnRampSettings}
/>
<Stack.Screen
name={Routes.FIAT_ON_RAMP_AGGREGATOR.ADD_ACTIVATION_KEY}
component={OnrampAddActivationKey}
name={Routes.RAMP.ADD_ACTIVATION_KEY}
component={RampAddActivationKey}
/>
<Stack.Screen
name="ExperimentalSettings"
Expand Down Expand Up @@ -519,49 +522,41 @@ const PaymentRequestView = () => (
</Stack.Navigator>
);

const FiatOnRampAggregator = () => (
<FiatOnRampSDKProvider>
<Stack.Navigator
initialRouteName={Routes.FIAT_ON_RAMP_AGGREGATOR.GET_STARTED}
>
const Ramps = ({ rampType }) => (
<RampSDKProvider rampType={rampType}>
<Stack.Navigator initialRouteName={Routes.RAMP.GET_STARTED}>
<Stack.Screen name={Routes.RAMP.GET_STARTED} component={GetStarted} />
<Stack.Screen
name={Routes.FIAT_ON_RAMP_AGGREGATOR.GET_STARTED}
component={GetStarted}
name={Routes.RAMP.NETWORK_SWITCHER}
component={NetworkSwitcher}
options={{ animationEnabled: false }}
/>
<Stack.Screen
name={Routes.FIAT_ON_RAMP_AGGREGATOR.PAYMENT_METHOD}
name={Routes.RAMP.PAYMENT_METHOD}
component={PaymentMethods}
/>
<Stack.Screen
name={Routes.FIAT_ON_RAMP_AGGREGATOR.PAYMENT_METHOD_HAS_STARTED}
name={Routes.RAMP.PAYMENT_METHOD_HAS_STARTED}
component={PaymentMethods}
options={{ animationEnabled: false }}
/>
<Stack.Screen name={Routes.RAMP.BUILD_QUOTE} component={BuildQuote} />
<Stack.Screen name={Routes.RAMP.QUOTES} component={Quotes} />
<Stack.Screen name={Routes.RAMP.CHECKOUT} component={CheckoutWebView} />
<Stack.Screen name={Routes.RAMP.REGION} component={Regions} />
<Stack.Screen
name={Routes.FIAT_ON_RAMP_AGGREGATOR.AMOUNT_TO_BUY}
component={AmountToBuy}
/>
<Stack.Screen
name={Routes.FIAT_ON_RAMP_AGGREGATOR.QUOTES}
component={Quotes}
/>
<Stack.Screen
name={Routes.FIAT_ON_RAMP_AGGREGATOR.CHECKOUT}
component={CheckoutWebView}
/>
<Stack.Screen
name={Routes.FIAT_ON_RAMP_AGGREGATOR.REGION}
component={Regions}
/>
<Stack.Screen
name={Routes.FIAT_ON_RAMP_AGGREGATOR.REGION_HAS_STARTED}
name={Routes.RAMP.REGION_HAS_STARTED}
component={Regions}
options={{ animationEnabled: false }}
/>
</Stack.Navigator>
</FiatOnRampSDKProvider>
</RampSDKProvider>
);

Ramps.propTypes = {
rampType: PropTypes.string,
};

const Swaps = () => (
<Stack.Navigator>
<Stack.Screen
Expand Down Expand Up @@ -652,10 +647,12 @@ const MainNavigator = () => (
<Stack.Screen name="OfflineModeView" component={OfflineModeView} />
<Stack.Screen name={Routes.QR_SCANNER} component={QrScanner} />
<Stack.Screen name="PaymentRequestView" component={PaymentRequestView} />
<Stack.Screen
name={Routes.FIAT_ON_RAMP_AGGREGATOR.ID}
component={FiatOnRampAggregator}
/>
<Stack.Screen name={Routes.RAMP.BUY}>
{() => <Ramps rampType={RampType.BUY} />}
</Stack.Screen>
<Stack.Screen name={Routes.RAMP.SELL}>
{() => <Ramps rampType={RampType.SELL} />}
</Stack.Screen>
<Stack.Screen name="Swaps" component={Swaps} />
<Stack.Screen
name="SetPasswordFlow"
Expand Down
8 changes: 4 additions & 4 deletions app/components/UI/ApproveTransactionReview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ import Text, {
import ApproveTransactionHeader from '../ApproveTransactionHeader';
import VerifyContractDetails from './VerifyContractDetails/VerifyContractDetails';
import ShowBlockExplorer from './ShowBlockExplorer';
import { isNetworkBuyNativeTokenSupported } from '../Ramp/utils';
import { isNetworkRampNativeTokenSupported } from '../Ramp/common/utils';
import { getRampNetworks } from '../../../reducers/fiatOrders';
import SkeletonText from '../Ramp/components/SkeletonText';
import SkeletonText from '../Ramp/common/components/SkeletonText';
import InfoModal from '../../../components/UI/Swaps/components/InfoModal';
import TransactionBlockaidBanner from '../TransactionBlockaidBanner/TransactionBlockaidBanner';
import { regex } from '../../../../app/util/regex';
Expand Down Expand Up @@ -1133,7 +1133,7 @@ class ApproveTransactionReview extends PureComponent {
/* this is kinda weird, we have to reject the transaction to collapse the modal */
this.onCancelPress();
try {
navigation.navigate('FiatOnRampAggregator');
navigation.navigate(Routes.RAMP.BUY);
} catch (error) {
Logger.error(error, 'Navigation: Error when navigating to buy ETH.');
}
Expand Down Expand Up @@ -1240,7 +1240,7 @@ const mapStateToProps = (state) => ({
activeTabUrl: getActiveTabUrl(state),
chainId: selectChainId(state),
tokenList: selectTokenList(state),
isNativeTokenBuySupported: isNetworkBuyNativeTokenSupported(
isNativeTokenBuySupported: isNetworkRampNativeTokenSupported(
selectChainId(state),
getRampNetworks(state),
),
Expand Down
2 changes: 1 addition & 1 deletion app/components/UI/AssetElement/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { TouchableOpacity, StyleSheet, Platform } from 'react-native';
import Text, {
TextVariant,
} from '../../../component-library/components/Texts/Text';
import SkeletonText from '../Ramp/components/SkeletonText';
import SkeletonText from '../Ramp/common/components/SkeletonText';
import { TokenI } from '../Tokens/types';
import generateTestId from '../../../../wdio/utils/generateTestId';
import { getAssetTestId } from '../../../../wdio/screen-objects/testIDs/Screens/WalletView.testIds';
Expand Down
33 changes: 19 additions & 14 deletions app/components/UI/Navbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ export function getSwapsQuotesNavbar(navigation, route, themeColors) {

export function getFiatOnRampAggNavbar(
navigation,
{ title, showBack = true } = {},
{ title, showBack = true, showCancel = true } = {},
themeColors,
onCancel,
) {
Expand Down Expand Up @@ -1519,19 +1519,24 @@ export function getFiatOnRampAggNavbar(
</TouchableOpacity>
);
},
headerRight: () => (
<TouchableOpacity
onPress={() => {
navigation.dangerouslyGetParent()?.pop();
onCancel?.();
}}
style={styles.closeButton}
accessibilityRole="button"
accessible
>
<Text style={innerStyles.headerButtonText}>{navigationCancelText}</Text>
</TouchableOpacity>
),
headerRight: () => {
if (!showCancel) return <View />;
return (
<TouchableOpacity
onPress={() => {
navigation.dangerouslyGetParent()?.pop();
onCancel?.();
}}
style={styles.closeButton}
accessibilityRole="button"
accessible
>
<Text style={innerStyles.headerButtonText}>
{navigationCancelText}
</Text>
</TouchableOpacity>
);
},
headerStyle: innerStyles.headerStyle,
headerTitleStyle: innerStyles.headerTitleStyle,
};
Expand Down
Loading