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

[LIVE-8890] remove ethereum family code #4336

Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// FIXME: to update when implementing edit transaction on evm

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want to remove the edit tx feature temporarily. you can remove this file completely or just return null.
it is not a major issue. It is up to you to keep it here or not.

import React, { useCallback, memo } from "react";
import { AccountLike, Account, Operation } from "@ledgerhq/types-live";
import { Trans } from "react-i18next";
import Alert from "~/renderer/components/Alert";
import Link from "~/renderer/components/Link";
import { openModal, closeModal } from "~/renderer/actions/modals";
import { closeModal } from "~/renderer/actions/modals";
import { useDispatch } from "react-redux";
import { useFeature } from "@ledgerhq/live-common/featureFlags/index";
import invariant from "invariant";
Expand All @@ -21,14 +23,15 @@ const EditOperationPanel = (props: Props) => {
const handleOpenEditModal = useCallback(() => {
invariant(operation.transactionRaw, "operation.transactionRaw is required");
dispatch(closeModal("MODAL_SEND"));
dispatch(
openModal("MODAL_EDIT_TRANSACTION", {
account,
parentAccount,
transactionRaw: operation.transactionRaw,
transactionHash: operation.hash,
}),
);
// dispatch(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an other draft PR with edit evm transaction right ? If yes we can delete this instead of commenting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is indeed a draft attempt to port this feature to evm here -> #4217

But since the changes commented out as part of this commit b9a7b56 are not necessarily ethereum (or evm) specific (because present in non ethereum / evm family folders) I decided to only comment them as part of this PR.
Because these changes present in non family specific folders might not be present in the draft PR above (that only port the ethereum family logic to evm).

We could decide to remove all of the speed up / cancel tx code for now, until it's added back again in the evm family, but it should be done in it's own dedicated PR to allow easier revert and since it's outside the scope of this one (and also to avoid growing this already massive PR with even more code removal).
But removing all this code might not be strategically wise since the work to integrate speed up / cancel tx to evm should be (will be) done juste after this evm / ethereum family migration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description updated 👍

// openModal("MODAL_EDIT_TRANSACTION", {
// account,
// parentAccount,
// transactionRaw: operation.transactionRaw,
// transactionHash: operation.hash,
// }),
// );
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [parentAccount, account, operation, dispatch]);

if (!editEthTx?.enabled) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// FIXME: to update when implementing edit transaction on evm

import React, { useMemo, Component, useCallback } from "react";
import { connect, useDispatch } from "react-redux";
import { connect } from "react-redux";
import { useHistory, useLocation } from "react-router-dom";
import { Trans, TFunction, useTranslation } from "react-i18next";
import styled from "styled-components";
Expand Down Expand Up @@ -70,7 +72,7 @@ import CryptoCurrencyIcon from "~/renderer/components/CryptoCurrencyIcon";
import AmountDetails from "./AmountDetails";
import NFTOperationDetails from "./NFTOperationDetails";
import { State } from "~/renderer/reducers";
import { openModal } from "~/renderer/actions/modals";
// import { openModal } from "~/renderer/actions/modals";
import { getLLDCoinFamily } from "~/renderer/families";

const mapStateToProps = (
Expand Down Expand Up @@ -244,34 +246,42 @@ const OperationD = (props: Props) => {
: undefined;
const editEthTx = useFeature("editEthTx");
const editable = editEthTx?.enabled && isEditableOperation(mainAccount, operation);
const dispatch = useDispatch();
const handleOpenEditModal = useCallback(
(account, parentAccount, transactionRaw, transactionHash) => {
setDrawer(undefined);
if (subOperations.length > 0 && isToken) {
// if the operation is a token operation,(ERC-20 send), in order to speedup/cancel we need to find the subAccount
const opAccount = findSubAccountById(account, subOperations[0].accountId);
dispatch(
openModal("MODAL_EDIT_TRANSACTION", {
account: opAccount,
parentAccount: account,
transactionRaw,
transactionHash,
}),
);
} else {
dispatch(
openModal("MODAL_EDIT_TRANSACTION", {
account,
parentAccount,
transactionRaw,
transactionHash,
}),
);
}
},
[dispatch, isToken, subOperations],
);
// const dispatch = useDispatch();
// const handleOpenEditModal = useCallback(
// (account, parentAccount, transactionRaw, transactionHash) => {
// setDrawer(undefined);
// if (subOperations.length > 0 && isToken) {
// // if the operation is a token operation,(ERC-20 send), in order to speedup/cancel we need to find the subAccount
// const opAccount = findSubAccountById(account, subOperations[0].accountId);
// dispatch(
// openModal("MODAL_EDIT_TRANSACTION", {
// account: opAccount,
// parentAccount: account,
// transactionRaw,
// transactionHash,
// }),
// );
// } else {
// dispatch(
// openModal("MODAL_EDIT_TRANSACTION", {
// account,
// parentAccount,
// transactionRaw,
// transactionHash,
// }),
// );
// }
// },
// [dispatch, isToken, subOperations],
// );

const handleOpenEditModal = (
_account: unknown,
_parentAccount: unknown,
_transactionRaw: unknown,
_transactionHash: unknown,
) => {};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 402-423 in this file, we should remove the alert message for editable operation since we remove the edit tx feature.

// pending transactions that exceeds 5 minutes are considered as stuck transactions
const isStuck =
new Date().getTime() - operation.date.getTime() > getEnv("ETHEREUM_STUCK_TRANSACTION_TIMEOUT");
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading