Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/hungry-poets-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": minor
---

feat(LWD): call to addAddress to RecentAddressStore from Recipient to Broadcast
14 changes: 12 additions & 2 deletions apps/ledger-live-desktop/src/renderer/modals/Send/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import { TFunction } from "i18next";
import { Trans, withTranslation } from "react-i18next";
import { createStructuredSelector } from "reselect";
import { UserRefusedOnDevice } from "@ledgerhq/errors";
import { addPendingOperation, getMainAccount } from "@ledgerhq/live-common/account/index";
import {
addPendingOperation,
getMainAccount,
getRecentAddressesStore,
} from "@ledgerhq/live-common/account/index";
import { getAccountCurrency } from "@ledgerhq/live-common/account/helpers";
import { getAccountBridge } from "@ledgerhq/live-common/bridge/index";
import useBridgeTransaction from "@ledgerhq/live-common/bridge/useBridgeTransaction";
Expand Down Expand Up @@ -249,8 +253,14 @@ const Body = ({
);
setOptimisticOperation(optimisticOperation);
setTransactionError(null);
// Add address to recent addresses store after successful broadcast
if (transaction && mainAccount) {
const store = getRecentAddressesStore();
const ensName = transaction.recipientDomain?.domain;
store.addAddress(mainAccount.currency.id, transaction.recipient, ensName);
}
},
[account, parentAccount, updateAccountWithUpdater],
[account, parentAccount, updateAccountWithUpdater, transaction],
);
const handleStepChange = useCallback(
(e: { id: StepId }) => onChangeStepId(e.id),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useMemo } from "react";
import { getStuckAccountAndOperation } from "@ledgerhq/live-common/operation";
import { Trans } from "react-i18next";
import { getMainAccount, getRecentAddressesStore } from "@ledgerhq/live-common/account/index";
import { getMainAccount } from "@ledgerhq/live-common/account/index";
import TrackPage from "~/renderer/analytics/TrackPage";
import Box from "~/renderer/components/Box";
import Button from "~/renderer/components/Button";
Expand Down Expand Up @@ -177,11 +177,6 @@ export const StepRecipientFooter = ({
const alwaysShowMemoTagInfo = useSelector(alwaysShowMemoTagInfoSelector);

const handleOnNext = async () => {
if (mainAccount && transaction) {
const store = getRecentAddressesStore();
const ensName = transaction.recipientDomain?.domain;
store.addAddress(mainAccount.currency.id, transaction.recipient, ensName);
}
if (
transaction &&
lldMemoTag?.enabled &&
Expand Down
Loading