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: enable ledger hardware wallet implementation. #7757

Merged
merged 114 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
b41b55b
feat: add account type tag label
stanleyyconsensys Oct 30, 2023
62af34e
fix: revert update
stanleyyconsensys Oct 30, 2023
85ab4b3
fix: update account overview
stanleyyconsensys Oct 30, 2023
123a581
fix: style
stanleyyconsensys Oct 30, 2023
dfb16dd
fix: style
stanleyyconsensys Oct 30, 2023
2fab4cc
feat: add error message to retry modal
stanleyyconsensys Oct 30, 2023
fbb6719
feat: add bluetooth library support
stanleyyconsensys Oct 30, 2023
e35a43d
fix: lint style
stanleyyconsensys Oct 30, 2023
717172f
fix: unit test
stanleyyconsensys Oct 30, 2023
ea3ee67
remove not using package
stanleyyconsensys Oct 30, 2023
cdf8dc9
fix: add unit test for address list and account info
stanleyyconsensys Oct 31, 2023
470d351
fix: unit test on component
stanleyyconsensys Oct 31, 2023
9c69e38
fix: lint style
stanleyyconsensys Oct 31, 2023
eae04e9
Merge branch 'main' into feat/add-account-type-tag
dawnseeker8 Oct 31, 2023
7f0a52e
feat: fix all unit tests with more valid address.
dawnseeker8 Oct 31, 2023
0a162b2
feat: make test more valid with real eth address.
dawnseeker8 Oct 31, 2023
4a5169b
feat: unit tests, remove address util mock
dawnseeker8 Oct 31, 2023
4f96842
Merge branch 'main' into feat/add-bluetooth-permission
dawnseeker8 Oct 31, 2023
e4a41a7
Merge branch 'main' into feat/add-bluetooth-permission
dawnseeker8 Nov 1, 2023
871e03c
Merge branch 'main' into feat/add-error-msg-to-retry-modal
dawnseeker8 Nov 1, 2023
973c806
Merge branch 'main' into feat/add-account-type-tag
dawnseeker8 Nov 1, 2023
d50530f
fix: action view btn not able translate
dawnseeker8 Nov 1, 2023
8ed8a22
Merge remote-tracking branch 'origin/feat/add-account-type-tag' into …
dawnseeker8 Nov 1, 2023
351ec14
Merge remote-tracking branch 'origin/feat/add-error-msg-to-retry-moda…
dawnseeker8 Nov 1, 2023
7618f8b
Merge remote-tracking branch 'origin/feat/add-bluetooth-permission' i…
dawnseeker8 Nov 1, 2023
c855635
feat: Working version with ledger enable
dawnseeker8 Nov 2, 2023
6cef3df
feat: Fix some missing changed files
dawnseeker8 Nov 2, 2023
cd32d1a
feat: fix all unit tests and lint errors
dawnseeker8 Nov 2, 2023
56ab5da
feat: add `account_type` in some metric metric,
dawnseeker8 Nov 6, 2023
8d45c82
feat: add missing constant
dawnseeker8 Nov 8, 2023
8f114fc
feat: move to use ExtendedKeyringTypes
dawnseeker8 Nov 9, 2023
85cb892
feat: use varient attribute to use theme variable
dawnseeker8 Nov 9, 2023
3f94a7c
Merge remote-tracking branch 'origin/main' into feat/ledger-enable
dawnseeker8 Nov 9, 2023
ded0618
feat: fix some conflict files.
dawnseeker8 Nov 9, 2023
b84af5f
Merge remote-tracking branch 'origin/main' into feat/ledger-enable
dawnseeker8 Nov 10, 2023
09fb42e
feat: commit to missing format of file
dawnseeker8 Nov 10, 2023
a8aa132
feat: ios Podfile.lock commit
dawnseeker8 Nov 10, 2023
5176dab
feat: Make all account label style consistance
dawnseeker8 Nov 10, 2023
5d8471c
feat: Fix the unit test failure
dawnseeker8 Nov 10, 2023
6b82de2
feat: fix lint error
dawnseeker8 Nov 10, 2023
161d5af
feat: refactory to reduce the change log in git.
dawnseeker8 Nov 10, 2023
3aba6c4
feat: fix lint issue and revert change
dawnseeker8 Nov 10, 2023
dc4b8c8
feat: Revert two android setting to main version
dawnseeker8 Nov 10, 2023
e7faf55
fix: reorder import sequence
stanleyyconsensys Nov 10, 2023
0f7f32b
fix: remove un necessary change
stanleyyconsensys Nov 10, 2023
6772762
feat: revert .project to main version.
dawnseeker8 Nov 10, 2023
ed04e63
update address utils method sequence
stanleyyconsensys Nov 10, 2023
ce5dd85
Merge branch 'feat/ledger-enable' of https://github.com/MetaMask/meta…
stanleyyconsensys Nov 10, 2023
beab782
feat: Fix dedupe pipeline failure
dawnseeker8 Nov 10, 2023
e1067dd
Merge branch 'main' into feat/ledger-enable
dawnseeker8 Nov 10, 2023
10a095f
feat: fix ltsc issue due to enum use another value
dawnseeker8 Nov 10, 2023
75accb9
Revert "feat: fix ltsc issue due to enum use another value"
dawnseeker8 Nov 10, 2023
f914a8d
feat: fix lint:tsc issue
dawnseeker8 Nov 10, 2023
fba40a5
Merge branch 'main' into feat/ledger-enable
dawnseeker8 Nov 13, 2023
5760ebf
feat: Fix dedupe error and one unit test.
dawnseeker8 Nov 13, 2023
83a4e32
feat: Fix dedupe ci broken.
dawnseeker8 Nov 13, 2023
f9f5722
feat: upgrade react-native-ble-plx library
dawnseeker8 Nov 14, 2023
421a2bd
Merge remote-tracking branch 'origin/main' into feat/ledger-enable
dawnseeker8 Nov 14, 2023
914d0df
feat: change code based on Brian's comments,
dawnseeker8 Nov 14, 2023
eb74574
feat:update podfile.lock with react-native-ble-plx
dawnseeker8 Nov 14, 2023
938ffc1
feat: Fix `ledger` tag label, `g` has been cut off
dawnseeker8 Nov 14, 2023
ac33031
feat: make account tag label bold
dawnseeker8 Nov 14, 2023
b6ef0ed
feat: revert the tag style to `main` version.
dawnseeker8 Nov 15, 2023
906d3ea
Merge remote-tracking branch 'origin/main' into feat/ledger-enable
dawnseeker8 Nov 15, 2023
2f42b34
feat: fix lint issue from rebase.
dawnseeker8 Nov 15, 2023
0540212
feat: remove unused images.
dawnseeker8 Nov 15, 2023
9f95dc6
feat: fix the ios build issue in britise
dawnseeker8 Nov 15, 2023
7c1bf89
feat: Manually remove the source map diff in patch
dawnseeker8 Nov 15, 2023
f325463
Merge remote-tracking branch 'origin/main' into feat/ledger-enable
dawnseeker8 Nov 16, 2023
70439d0
feat: Revert javascriptEnabled to true in webview
dawnseeker8 Nov 16, 2023
c61fbe2
feat: revert cocapods version to `main` version.
dawnseeker8 Nov 16, 2023
4dbc4b2
feat: fix lint issue from rebase code.
dawnseeker8 Nov 16, 2023
50dff1a
feat:add comment description into patch file
dawnseeker8 Nov 16, 2023
ec13b8d
feat: Fix the syntax error in Podfile.lock
dawnseeker8 Nov 16, 2023
3c3ae68
Merge remote-tracking branch 'origin/main' into feat/ledger-enable
dawnseeker8 Nov 17, 2023
f3b2717
feat: commit the missing file from last commit
dawnseeker8 Nov 17, 2023
6e71408
fix: update ledger.ts
stanleyyconsensys Nov 20, 2023
a1c79ad
Apply suggestions from code review
dawnseeker8 Nov 20, 2023
5896c37
feat: refactory code based on Custova's comment
dawnseeker8 Nov 20, 2023
c3e1e8e
feat: revert remove line.
dawnseeker8 Nov 20, 2023
85932df
feat: Revert the files was commited by mistaken.
dawnseeker8 Nov 20, 2023
8778e77
Merge remote-tracking branch 'origin/main' into feat/ledger-enable
dawnseeker8 Nov 20, 2023
9d2bff4
Merge remote-tracking branch 'origin/main' into feat/ledger-enable
dawnseeker8 Nov 21, 2023
e3e53db
feat: change based on Mike comments
dawnseeker8 Nov 21, 2023
1d2ef0f
feat: Revert all javascript disabled code
dawnseeker8 Nov 21, 2023
bbdee57
Merge remote-tracking branch 'origin/main' into feat/ledger-enable
dawnseeker8 Nov 22, 2023
8543fbd
Merge remote-tracking branch 'origin/main' into feat/ledger-enable
dawnseeker8 Nov 22, 2023
8eb3d9e
feat: change QR connect to account drawdown list screen
dawnseeker8 Nov 22, 2023
0885747
Merge branch 'main' into feat/ledger-enable
dawnseeker8 Nov 23, 2023
d0feb9e
feat: remove duplicate permission.
dawnseeker8 Nov 23, 2023
d97bf07
feat: fix the typo error in text attribute.
dawnseeker8 Nov 23, 2023
58af547
feat: Try to fix the ios e2e tests
dawnseeker8 Nov 23, 2023
10ade1f
feat: After few testing, confirm AccountView is fine.
dawnseeker8 Nov 23, 2023
0cc0f72
feat: refactory to remove unuse outdating code.
dawnseeker8 Nov 24, 2023
3359f74
Merge remote-tracking branch 'origin/main' into feat/ledger-enable
dawnseeker8 Nov 24, 2023
7463abb
feat: add retry to prevent user immediately see error screen with eth…
dawnseeker8 Nov 24, 2023
c884b94
feat: Commit based on Stanley feedback.
dawnseeker8 Nov 27, 2023
98aeb9b
Merge remote-tracking branch 'origin/main' into feat/ledger-enable
dawnseeker8 Nov 27, 2023
3c91fa6
feat: Dont store rpcEvents and accounts state in localStorage.
dawnseeker8 Nov 27, 2023
078da45
feat: try to fix regression e2e tests signing model not popup.
dawnseeker8 Nov 27, 2023
002bb3b
feat: check whether fix ios gem install error in ios e2e tests.
dawnseeker8 Nov 28, 2023
df8a91d
feat: Check whether e2e ios build can pass in bitrise or not.
dawnseeker8 Nov 28, 2023
a53517c
feat: Revert previous two ios change to `main` version.
dawnseeker8 Nov 28, 2023
43936e3
feat: Revert the suspect line which may break ios e2e build.
dawnseeker8 Nov 28, 2023
e5229f4
feat: revert the change to match main
dawnseeker8 Nov 28, 2023
c11b1fa
fea: hide ledger (#7940)
gantunesr Nov 28, 2023
417907a
Merge remote-tracking branch 'origin/main' into feat/ledger-enable
dawnseeker8 Nov 28, 2023
fb5d4e0
feat: to test e2e test pass or not.
dawnseeker8 Nov 29, 2023
311f2d6
feat: Implement option 1 to turn off ledger feature..
dawnseeker8 Nov 29, 2023
9662cfc
Merge remote-tracking branch 'origin/main' into feat/ledger-enable
dawnseeker8 Nov 29, 2023
446a113
feat: revert the code to disable the ledger feature.
dawnseeker8 Nov 29, 2023
bfb34ab
feat: revert file to main version
dawnseeker8 Nov 29, 2023
7d2a071
feat: revert again to remove the change from main
dawnseeker8 Nov 29, 2023
2807dfc
feat: Remove the duplicate lines in `Podfile.lock` after rebase which…
dawnseeker8 Nov 29, 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
19 changes: 19 additions & 0 deletions app/actions/accounts/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { setReloadAccounts } from '.';

describe('accounts, reloadAccounts', () => {
describe('setReloadAccounts', () => {
it('should create an action to set reloadAccounts to true', () => {
expect(setReloadAccounts(true)).toEqual({
type: 'SET_RELOAD_ACCOUNTS',
reloadAccounts: true,
});
});

it('should create an action to set reloadAccounts to false', () => {
expect(setReloadAccounts(false)).toEqual({
type: 'SET_RELOAD_ACCOUNTS',
reloadAccounts: false,
});
});
});
});
27 changes: 27 additions & 0 deletions app/actions/accounts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Action } from 'redux';

/**
* Deference action types available for different RPC event flow
*/
export enum AccountsActionType {
SET_RELOAD_ACCOUNTS = 'SET_RELOAD_ACCOUNTS',
}

/**
* Extend redux Action interface to add rpcName, eventStage and error properties
*/
export interface iAccountActions extends Action {
reloadAccounts: boolean;
}

/**
* setReloadAccounts action creator
* @param {boolean} reloadAccounts: true to reload accounts, false otherwise
* @returns {iAccountActions} - the action object to set reloadAccounts
*/
export function setReloadAccounts(reloadAccounts: boolean): iAccountActions {
return {
type: AccountsActionType.SET_RELOAD_ACCOUNTS,
reloadAccounts,
};
}
7 changes: 7 additions & 0 deletions app/actions/modals/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ export function toggleInfoNetworkModal(show) {
show,
};
}

export function toggleSignModal(show) {
return {
type: 'TOGGLE_SIGN_MODAL',
show,
};
}
53 changes: 53 additions & 0 deletions app/actions/rpcEvents/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { RPCStageTypes } from '../../reducers/rpcEvents';
import {
ActionType,
resetEventStage,
setEventStage,
setEventStageError,
} from '.';

describe('action, rpcEvents', () => {
describe('setEventStage', () => {
const createExpectedAction = (eventStage: RPCStageTypes) => ({
type: ActionType.SET_EVENT_STAGE,
rpcName: 'eth_sign',
eventStage,
});

it('should create an action to set event stage to REQUEST_SENT', () => {
expect(setEventStage('eth_sign', RPCStageTypes.REQUEST_SEND)).toEqual(
createExpectedAction(RPCStageTypes.REQUEST_SEND),
);
});

it('should create an action to set event stage to COMPLETE', () => {
expect(setEventStage('eth_sign', RPCStageTypes.COMPLETE)).toEqual(
createExpectedAction(RPCStageTypes.COMPLETE),
);
});
});

describe('resetEventStage', () => {
it('should create an action to reset the event stage', () => {
const expectedAction = {
type: ActionType.RESET_EVENT_STATE,
rpcName: 'eth_sign',
};
expect(resetEventStage('eth_sign')).toEqual(expectedAction);
});
});

describe('setEventStageError', () => {
it('should create an action to set the event stage error', () => {
const expectedAction = {
type: ActionType.SET_EVENT_ERROR,
rpcName: 'eth_sign',
eventStage: RPCStageTypes.ERROR,
error: new Error('test error'),
};
expect(setEventStageError('eth_sign', new Error('test error'))).toEqual(
expectedAction,
);
});
});
});
68 changes: 68 additions & 0 deletions app/actions/rpcEvents/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { RPCStageTypes } from '../../reducers/rpcEvents';
import { Action } from 'redux';

/**
* Deference action types available for different RPC event flow
*/
export enum ActionType {
SET_EVENT_STAGE = 'SET_EVENT_STAGE',
RESET_EVENT_STATE = 'RESET_EVENT_STATE',
SET_EVENT_ERROR = 'SET_EVENT_ERROR',
}

/**
* Extend redux Action interface to add rpcName, eventStage and error properties
*/
export interface iEventAction extends Action {
rpcName: string;
eventStage?: string;
error?: Error | unknown;
}

/**
* Set the new RPC event stage.
* @param {string} rpcName - the rpc mehtod name which fires the event
* @param {string} eventStage - the crrent stage of the eventflow
* @returns {iEventAction} - Action object with type and payload to be passed to reducer
*/
export function setEventStage(
rpcName: string,
eventStage: string,
): iEventAction {
return {
rpcName,
type: ActionType.SET_EVENT_STAGE,
eventStage,
};
}

/**
* Reset the RPC event stage in store to default IDLE stage.
* @param {string} rpcName - the rpc method name which fires the event
* @returns {iEventAction} - Action object with type and payload to be passed to reducer
*/
export function resetEventStage(rpcName: string): iEventAction {
return {
type: ActionType.RESET_EVENT_STATE,
rpcName,
};
}

/**
* Set the error stage if any error occurs in the event flow.
* This method will change the event group stage to ERROR.
* @param {string} rpcName - the rpc method name which fires the event
* @param {Error | unknown} e - Error object to be set in store
* @returns {iEventAction} - Action object to be passed to reducer
*/
export function setEventStageError(
rpcName: string,
e: Error | unknown,
): iEventAction {
return {
type: ActionType.SET_EVENT_ERROR,
rpcName,
eventStage: RPCStageTypes.ERROR,
error: e,
};
}
7 changes: 7 additions & 0 deletions app/actions/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ export function setUseBlockieIcon(useBlockieIcon) {
useBlockieIcon,
};
}

export function setLedgerBetaEnabled(ledgerBetaEnabled) {
return {
type: 'SET_LEDGER_BETA_ENABLED',
ledgerBetaEnabled,
};
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Third party dependencies.
import { fontStyles } from '../../../../../app/styles/common';
import { StyleSheet } from 'react-native';

/**
Expand Down Expand Up @@ -32,10 +31,8 @@ const styleSheet = StyleSheet.create({
accountNameLabelText: {
marginLeft: 4,
paddingHorizontal: 8,
...fontStyles.bold,
borderWidth: 1,
borderRadius: 8,
fontSize: 10,
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ const AccountBase = ({
<View style={styles.accountNameLabel}>
<Text variant={TextVariant.BodyMDBold}>{accountName}</Text>
{accountTypeLabel && (
<Text style={styles.accountNameLabelText}>
<Text
variant={TextVariant.BodySM}
style={styles.accountNameLabelText}
>
{strings(accountTypeLabel)}
</Text>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ const TransactionApprovalInternal = (props: TransactionApprovalProps) => {
}

if (props.transactionType === TransactionModalType.Transaction) {
return <Approve modalVisible hideModal={onComplete} />;
return (
<Approve
modalVisible
hideModal={onComplete}
navigation={props.navigation}
/>
);
}

if (props.isSigningQRObject && !props.transactionType) {
Expand Down
56 changes: 56 additions & 0 deletions app/components/Nav/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ import AssetOptions from '../../Views/AssetOptions';
import ImportPrivateKey from '../../Views/ImportPrivateKey';
import ImportPrivateKeySuccess from '../../Views/ImportPrivateKeySuccess';
import ConnectQRHardware from '../../Views/ConnectQRHardware';
import SelectHardwareWallet from '../../Views/ConnectHardware/SelectHardware';
import LedgerAccountInfo from '../../Views/LedgerAccountInfo';
import LedgerConnect from '../../Views/LedgerConnect';
import { AUTHENTICATION_APP_TRIGGERED_AUTH_NO_CREDENTIALS } from '../../../constants/error';
import { UpdateNeeded } from '../../../components/UI/UpdateNeeded';
import { EnableAutomaticSecurityChecksModal } from '../../../components/UI/EnableAutomaticSecurityChecksModal';
Expand All @@ -78,6 +81,8 @@ import WalletRestored from '../../Views/RestoreWallet/WalletRestored';
import WalletResetNeeded from '../../Views/RestoreWallet/WalletResetNeeded';
import SDKLoadingModal from '../../Views/SDKLoadingModal/SDKLoadingModal';
import SDKFeedbackModal from '../../Views/SDKFeedbackModal/SDKFeedbackModal';
import LedgerMessageSignModal from '../../UI/LedgerModals/LedgerMessageSignModal';
import LedgerTransactionModal from '../../UI/LedgerModals/LedgerTransactionModal';
import AccountActions from '../../../components/Views/AccountActions';
import EthSignFriction from '../../../components/Views/Settings/AdvancedSettings/EthSignFriction';
import WalletActions from '../../Views/WalletActions';
Expand Down Expand Up @@ -618,6 +623,23 @@ const App = ({ userLoggedIn }) => {
</Stack.Navigator>
);

const LedgerConnectFlow = () => (
<Stack.Navigator initialRouteName={Routes.HW.LEDGER_CONNECT}>
<Stack.Screen name={Routes.HW.LEDGER_CONNECT} component={LedgerConnect} />
</Stack.Navigator>
);

const ConnectHardwareWalletFlow = () => (
<Stack.Navigator name="ConnectHardwareWallet">
<Stack.Screen
name={Routes.HW.SELECT_DEVICE}
component={SelectHardwareWallet}
options={SelectHardwareWallet.navigationOptions}
/>
<Stack.Screen name="LedgerAccountInfo" component={LedgerAccountInfo} />
</Stack.Navigator>
);

const EditAccountNameFlow = () => (
<Stack.Navigator>
<Stack.Screen name="EditAccountName" component={EditAccountName} />
Expand Down Expand Up @@ -699,6 +721,40 @@ const App = ({ userLoggedIn }) => {
component={ConnectQRHardwareFlow}
options={{ animationEnabled: true }}
/>
<Stack.Screen
name={Routes.HW.CONNECT_LEDGER}
component={LedgerConnectFlow}
/>
<Stack.Screen
name={Routes.HW.CONNECT}
component={ConnectHardwareWalletFlow}
/>
<Stack.Screen
options={{
//Refer to - https://reactnavigation.org/docs/stack-navigator/#animations
cardStyle: { backgroundColor: importedColors.transparent },
cardStyleInterpolator: () => ({
overlayStyle: {
opacity: 0,
},
}),
}}
name={Routes.LEDGER_TRANSACTION_MODAL}
component={LedgerTransactionModal}
/>
<Stack.Screen
options={{
//Refer to - https://reactnavigation.org/docs/stack-navigator/#animations
cardStyle: { backgroundColor: importedColors.transparent },
cardStyleInterpolator: () => ({
overlayStyle: {
opacity: 0,
},
}),
}}
name={Routes.LEDGER_MESSAGE_SIGN_MODAL}
component={LedgerMessageSignModal}
/>
<Stack.Screen
name="EditAccountName"
component={EditAccountNameFlow}
Expand Down
39 changes: 35 additions & 4 deletions app/components/Nav/Main/RootRPCMethodsUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ import { toLowerCaseEquals } from '../../../util/general';
import { KEYSTONE_TX_CANCELED } from '../../../constants/error';
import { MetaMetricsEvents } from '../../../core/Analytics';
import AnalyticsV2 from '../../../util/analyticsV2';

import {
getAddressAccountType,
isHardwareAccount,
} from '../../../util/address';
import {
selectChainId,
selectProviderType,
Expand All @@ -57,6 +60,9 @@ import TemplateConfirmationModal from '../../Approvals/TemplateConfirmationModal
import { selectTokenList } from '../../../selectors/tokenListController';
import { selectTokens } from '../../../selectors/tokensController';
import { selectSelectedAddress } from '../../../selectors/preferencesController';
import { getLedgerKeyring } from '../../../core/Ledger/Ledger';
import { createLedgerTransactionModalNavDetails } from '../../UI/LedgerModals/LedgerTransactionModal';
import ExtendedKeyringTypes from '../../../constants/keyringTypes';

const hstInterface = new ethers.utils.Interface(abi);

Expand Down Expand Up @@ -147,7 +153,11 @@ const RootRPCMethodsUI = (props) => {
tokensReceived,
swapTransaction.destinationToken.decimals,
);
const analyticsParams = { ...swapTransaction.analytics };

const analyticsParams = {
...swapTransaction.analytics,
account_type: getAddressAccountType(transactionMeta.transaction.from),
};
delete newSwapsTransactions[transactionMeta.id].analytics;
delete newSwapsTransactions[transactionMeta.id].paramsForAnalytics;

Expand Down Expand Up @@ -203,7 +213,28 @@ const RootRPCMethodsUI = (props) => {
},
);
await KeyringController.resetQRKeyringState();
Engine.acceptPendingApproval(transactionMeta.id);

const isLedgerAccount = isHardwareAccount(
transactionMeta.transaction.from,
[ExtendedKeyringTypes.ledger],
);

// For Ledger Accounts we handover the signing to the confirmation flow
if (isLedgerAccount) {
const ledgerKeyring = await getLedgerKeyring();

props.navigation.navigate(
...createLedgerTransactionModalNavDetails({
transactionId: transactionMeta.id,
deviceId: ledgerKeyring.deviceId,
// eslint-disable-next-line no-empty-function
onConfirmationComplete: () => {},
type: 'signTransaction',
}),
);
} else {
Engine.acceptPendingApproval(transactionMeta.id);
}
} catch (error) {
if (!error?.message.startsWith(KEYSTONE_TX_CANCELED)) {
Alert.alert(
Expand All @@ -219,7 +250,7 @@ const RootRPCMethodsUI = (props) => {
}
}
},
[props.swapsTransactions, trackSwaps],
[props.navigation, props.swapsTransactions, trackSwaps],
);

const onUnapprovedTransaction = useCallback(
Expand Down
Loading
Loading