Skip to content

Commit

Permalink
Revert "[SUPPORT] remove unnecessary check on tx networkInfo (#4020)"
Browse files Browse the repository at this point in the history
This reverts commit 37c4e84.
  • Loading branch information
chabroA authored Jul 17, 2023
1 parent 37c4e84 commit 364cfaf
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
7 changes: 0 additions & 7 deletions .changeset/thirty-pumas-sleep.md

This file was deleted.

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 && mainAccount && (
{transaction && "networkInfo" in transaction && transaction.networkInfo && mainAccount && (
<SendAmountFields
account={mainAccount as Account}
parentAccount={parentAccount}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,14 @@ const SectionFees = ({
const family = mainFromAccount?.currency.family;
const sendAmountSpecific = account && family && getLLDCoinFamily(family)?.sendAmountFields;
const canEdit =
hasRates && showSummaryValue && transaction && account && family && sendAmountSpecific;
hasRates &&
showSummaryValue &&
transaction &&
"networkInfo" in transaction &&
transaction.networkInfo &&
account &&
family &&
sendAmountSpecific;
const swapDefaultTrack = useGetSwapTrackingProperties();
const StrategyIcon = useMemo(
() =>
Expand Down
6 changes: 4 additions & 2 deletions apps/ledger-live-mobile/src/components/SendRowsFee.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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 @@ -39,7 +40,8 @@ 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];
return (
// FIXME: looks like a hack, need to find how to handle networkInfo properly
return (transaction as BitcoinTransaction)?.networkInfo ? (
<C
{...props}
setTransaction={setTransaction}
Expand All @@ -49,7 +51,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,6 +110,9 @@ 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 364cfaf

Please sign in to comment.