Skip to content

Commit

Permalink
chore: remove unused Account#freshAddresses
Browse files Browse the repository at this point in the history
  • Loading branch information
gre committed Mar 22, 2024
1 parent 5e939e0 commit 090b145
Show file tree
Hide file tree
Showing 96 changed files with 25,235 additions and 82,319 deletions.
1 change: 0 additions & 1 deletion apps/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ Usage: ledger-live receive # Receive crypto-assets (verify on device)
-l, --length <Number> : set the number of accounts after the index. Defaults to 1 if index was provided, Infinity otherwise.
--paginateOperations <Number>: if defined, will paginate operations
--qr : also display a QR Code
--freshAddressIndex <Number>: Change fresh address index
Usage: ledger-live repl # Low level exchange with the device. Send APDUs from stdin.
-d, --device <String> : provide a specific HID path of a device
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ ${apdus.map(a => " " + a).join("\n")}
toAccountRaw({
...account,
operations: [],
freshAddresses: [],
}),
)},
transactions: [
Expand Down
21 changes: 2 additions & 19 deletions apps/cli/src/commands/blockchain/receive.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { of, concat, EMPTY } from "rxjs";
import { ignoreElements, concatMap, map } from "rxjs/operators";
import { ignoreElements, concatMap } from "rxjs/operators";
import { getAccountBridge } from "@ledgerhq/live-common/bridge/index";
import { scan, scanCommonOpts } from "../../scan";
import type { ScanCommonOpts } from "../../scan";
import { asQR } from "../../qr";
import { FreshAddressIndexInvalid } from "@ledgerhq/live-common/errors";
export default {
description: "Receive crypto-assets (verify on device)",
args: [
Expand All @@ -14,37 +13,21 @@ export default {
type: Boolean,
desc: "also display a QR Code",
},
{
name: "freshAddressIndex",
type: Number,
desc: "Change fresh address index",
},
],
job: (
opts: ScanCommonOpts & {
qr: boolean;
freshAddressIndex: number | null | undefined;
},
) =>
scan(opts).pipe(
concatMap(account =>
concat(
of(
opts.freshAddressIndex !== undefined && opts.freshAddressIndex !== null
? account.freshAddresses[opts.freshAddressIndex]?.address
: account.freshAddress,
).pipe(
map(address => {
if (!address) throw new FreshAddressIndexInvalid();
return address;
}),
),
of(account.freshAddress),
opts.qr ? asQR(account.freshAddress) : EMPTY,
getAccountBridge(account)
.receive(account, {
deviceId: opts.device || "",
verify: true,
freshAddressIndex: opts.freshAddressIndex as number,
})
.pipe(ignoreElements()),
),
Expand Down
1 change: 0 additions & 1 deletion apps/cli/src/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ export function scan(arg: ScanCommonOpts): Observable<Account> {
index,
freshAddress: xpubOrAddress,
freshAddressPath,
freshAddresses: [],
creationDate: new Date(),
lastSyncDate: new Date(0),
blockHeight: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ const ethMockAccount: Account = {
index: 0,
freshAddress: "0x66c4371aE8FFeD2ec1c2EBbbcCfb7E494181E1E3",
freshAddressPath: "44'/60'/0'/0/0",
freshAddresses: [
{
address: "0x66c4371aE8FFeD2ec1c2EBbbcCfb7E494181E1E3",
derivationPath: "44'/60'/0'/0/0",
},
],
name: "Ethereum 1",
blockHeight: 16626551,
creationDate: new Date("2021-03-23T14:17:07.001Z"),
Expand Down Expand Up @@ -88,12 +82,6 @@ const polygonMockAccount: Account = {
index: 0,
freshAddress: "0x66c4371aE8FFeD2ec1c2EBbbcCfb7E494181E1E3",
freshAddressPath: "44'/60'/0'/0/0",
freshAddresses: [
{
address: "0x66c4371aE8FFeD2ec1c2EBbbcCfb7E494181E1E3",
derivationPath: "44'/60'/0'/0/0",
},
],
name: "Polygon 1",
blockHeight: 16626551,
creationDate: new Date("2021-03-23T14:17:07.001Z"),
Expand Down
Loading

0 comments on commit 090b145

Please sign in to comment.