Skip to content

Commit

Permalink
[SUPPORT] remove unnecessary check on tx networkInfo (#4020)
Browse files Browse the repository at this point in the history
  • Loading branch information
chabroA authored and hakim-adamik committed Jul 21, 2023
1 parent 7c07c02 commit 75899a6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 16 deletions.
7 changes: 7 additions & 0 deletions .changeset/thirty-pumas-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"ledger-live-desktop": patch
"live-mobile": patch
"@ledgerhq/live-common": patch
---

remove unnecessary check on tx networkInfo
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function FeesDrawer({
/>
<DrawerTitle i18nKey="swap2.form.details.label.fees" />
<Box mt={3} flow={4} mx={3}>
{transaction && "networkInfo" in transaction && transaction.networkInfo && mainAccount && (
{transaction && mainAccount && (
<SendAmountFields
account={mainAccount as Account}
parentAccount={parentAccount}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,7 @@ const SectionFees = ({
const family = mainFromAccount?.currency.family;
const sendAmountSpecific = account && family && getLLDCoinFamily(family)?.sendAmountFields;
const canEdit =
hasRates &&
showSummaryValue &&
transaction &&
"networkInfo" in transaction &&
transaction.networkInfo &&
account &&
family &&
sendAmountSpecific;
hasRates && showSummaryValue && transaction && account && family && sendAmountSpecific;
const swapDefaultTrack = useGetSwapTrackingProperties();
const StrategyIcon = useMemo(
() =>
Expand Down
6 changes: 2 additions & 4 deletions apps/ledger-live-mobile/src/components/SendRowsFee.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from "react";
import type { Account, AccountLike } from "@ledgerhq/types-live";
import { getMainAccount } from "@ledgerhq/live-common/account/index";
import type { Transaction, TransactionStatus } from "@ledgerhq/live-common/generated/types";
import type { Transaction as BitcoinTransaction } from "@ledgerhq/live-common/families/bitcoin/types";
import { CompositeScreenProps } from "@react-navigation/native";

import perFamily from "../generated/SendRowsFee";
Expand Down Expand Up @@ -40,8 +39,7 @@ export default ({
// eslint-disable-next-line no-prototype-builtins
if (perFamily.hasOwnProperty(mainAccount.currency.family)) {
const C = perFamily[mainAccount.currency.family as keyof typeof perFamily];
// FIXME: looks like a hack, need to find how to handle networkInfo properly
return (transaction as BitcoinTransaction)?.networkInfo ? (
return (
<C
{...props}
setTransaction={setTransaction}
Expand All @@ -51,7 +49,7 @@ export default ({
navigation={navigation}
route={route}
/>
) : null;
);
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ const prepareTransaction = async (
model,
};

// LLM requires this field to be truthy to show fees
(patch as any).networkInfo = true;

return defaultUpdateTransaction(tx, patch);
};

Expand Down

0 comments on commit 75899a6

Please sign in to comment.