Skip to content

Commit

Permalink
Merge pull request #7659 from LedgerHQ/support/hotfix-merge-conflicts
Browse files Browse the repository at this point in the history
🚨 Hotfix merge conflicts
  • Loading branch information
ofreyssinet-ledger authored Aug 26, 2024
2 parents 2659506 + 943dc4e commit 1989f7a
Show file tree
Hide file tree
Showing 25 changed files with 192 additions and 162 deletions.
15 changes: 15 additions & 0 deletions apps/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# @ledgerhq/live-cli

## 24.5.1

### Patch Changes

- Updated dependencies [[`22ff55b`](https://github.com/LedgerHQ/ledger-live/commit/22ff55bf74a27fa22701c8b20424732a189ca017)]:
- @ledgerhq/live-common@34.7.1
- @ledgerhq/coin-bitcoin@0.7.3

## 24.5.1-hotfix.0

### Patch Changes

- Updated dependencies [[`22ff55b`](https://github.com/LedgerHQ/ledger-live/commit/22ff55bf74a27fa22701c8b20424732a189ca017)]:
- @ledgerhq/live-common@34.7.1-hotfix.0

## 24.5.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ledgerhq/live-cli",
"version": "24.5.0",
"version": "24.5.1",
"description": "ledger-live CLI version",
"repository": {
"type": "git",
Expand Down
17 changes: 17 additions & 0 deletions apps/ledger-live-desktop/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# ledger-live-desktop

## 2.85.1

### Patch Changes

- [#7642](https://github.com/LedgerHQ/ledger-live/pull/7642) [`22ff55b`](https://github.com/LedgerHQ/ledger-live/commit/22ff55bf74a27fa22701c8b20424732a189ca017) Thanks [@ofreyssinet-ledger](https://github.com/ofreyssinet-ledger)! - Sentry: disable capture of "performance spans", which were not actually in use, but still causing a stop of the internal process on LLD Windows

- Updated dependencies [[`22ff55b`](https://github.com/LedgerHQ/ledger-live/commit/22ff55bf74a27fa22701c8b20424732a189ca017)]:
- @ledgerhq/[email protected]
- @ledgerhq/[email protected]

## 2.85.1-hotfix.0

### Patch Changes

- Updated dependencies [[`22ff55b`](https://github.com/LedgerHQ/ledger-live/commit/22ff55bf74a27fa22701c8b20424732a189ca017)]:
- @ledgerhq/[email protected]

## 2.85.0

### Minor Changes
Expand Down
4 changes: 4 additions & 0 deletions apps/ledger-live-desktop/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.85.1

Some Windows users reported issues with device interactions. This has been fixed.

# 2.85.0

This release includes minor bug fixes and security improvements.
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger-live-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"license": "MIT",
"private": true,
"main": "./.webpack/main.bundle.js",
"version": "2.85.0",
"version": "2.85.1",
"scripts": {
"start:prod": "electron ./.webpack/main.bundle.js",
"start": "cross-env NODE_ENV=development node ./tools/main.js",
Expand Down
4 changes: 0 additions & 4 deletions apps/ledger-live-desktop/src/sentry/internal.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import * as Sentry from "@sentry/node";
import { Primitive } from "@sentry/types";
import { connectLogsToSentry } from "@ledgerhq/live-common/performance";
import { init, setShouldSendCallback } from "./install";
// @ts-expect-error The right type would be typeof SentryMainModule from "@sentry/electron/main"…
// …but we should avoid importing the whole module here
const available = init(Sentry, {
integrations: [Sentry.httpIntegration()],
});
if (available) {
connectLogsToSentry(Sentry);
}
export default (shouldSendCallback: () => boolean, userId: string) => {
if (!available) return;
setShouldSendCallback(shouldSendCallback);
Expand Down
14 changes: 14 additions & 0 deletions apps/ledger-live-mobile/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# live-mobile

## 3.48.1

### Patch Changes

- Updated dependencies [[`22ff55b`](https://github.com/LedgerHQ/ledger-live/commit/22ff55bf74a27fa22701c8b20424732a189ca017)]:
- @ledgerhq/[email protected]

## 3.48.1-hotfix.0

### Patch Changes

- Updated dependencies [[`22ff55b`](https://github.com/LedgerHQ/ledger-live/commit/22ff55bf74a27fa22701c8b20424732a189ca017)]:
- @ledgerhq/[email protected]

## 3.48.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger-live-mobile/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "live-mobile",
"version": "3.48.0",
"version": "3.48.1",
"private": true,
"scripts": {
"postinstall": "zx ./scripts/post.mjs",
Expand Down
14 changes: 14 additions & 0 deletions apps/web-tools/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# web-tools

## 0.8.1

### Patch Changes

- Updated dependencies [[`22ff55b`](https://github.com/LedgerHQ/ledger-live/commit/22ff55bf74a27fa22701c8b20424732a189ca017)]:
- @ledgerhq/live-common@34.7.1

## 0.8.1-hotfix.0

### Patch Changes

- Updated dependencies [[`22ff55b`](https://github.com/LedgerHQ/ledger-live/commit/22ff55bf74a27fa22701c8b20424732a189ca017)]:
- @ledgerhq/live-common@34.7.1-hotfix.0

## 0.8.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/web-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ledgerhq/web-tools",
"version": "0.8.0",
"version": "0.8.1",
"private": true,
"browser": {
"fs": false,
Expand Down
6 changes: 6 additions & 0 deletions libs/coin-modules/coin-bitcoin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @ledgerhq/coin-bitcoin

## 0.7.3

### Patch Changes

- [#7642](https://github.com/LedgerHQ/ledger-live/pull/7642) [`22ff55b`](https://github.com/LedgerHQ/ledger-live/commit/22ff55bf74a27fa22701c8b20424732a189ca017) Thanks [@ofreyssinet-ledger](https://github.com/ofreyssinet-ledger)! - Sentry: disable capture of "performance spans", which were not actually in use, but still causing a stop of the internal process on LLD Windows

## 0.7.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/coin-modules/coin-bitcoin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ledgerhq/coin-bitcoin",
"version": "0.7.2",
"version": "0.7.3",
"description": "Ledger Bitcoin Coin integration",
"keywords": [
"Ledger",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ import { makeGetAccountShape } from "../../synchronisation";

import { createFixtureAccount, mockSignerContext } from "../fixtures/common.fixtures";

const mockStartSpan = jest.fn().mockReturnValue({
finish: jest.fn(),
});
describe("synchronisation", () => {
it("should return a function", () => {
const result = makeGetAccountShape(mockSignerContext, mockStartSpan);
const result = makeGetAccountShape(mockSignerContext);
expect(typeof result).toBe("function");
});

it("should return an account shape with the correct properties", async () => {
const getAccountShape = makeGetAccountShape(mockSignerContext, mockStartSpan);
const getAccountShape = makeGetAccountShape(mockSignerContext);
const mockAccount = createFixtureAccount();
mockAccount.id =
"js:2:bitcoin:xpub6DM4oxVnZiePFvQMu1RJLQwWUzZQP3UNaLqrGcbJQkAJZYdiRoRivHULWoYN3zBYU4mJRpM3WrGaqo1kS8Q2XFfd9E3QEc9P3MKHwbHz9LB:native_segwit";
Expand Down
24 changes: 8 additions & 16 deletions libs/coin-modules/coin-bitcoin/src/bridge/js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
makeSync,
} from "@ledgerhq/coin-framework/bridge/jsHelpers";
import getAddressWrapper from "@ledgerhq/coin-framework/bridge/getAddressWrapper";
import { StartSpan, makeGetAccountShape, postSync } from "../synchronisation";
import { makeGetAccountShape, postSync } from "../synchronisation";
import { assignFromAccountRaw, assignToAccountRaw } from "../serialization";
import { BitcoinAccount, Transaction, TransactionStatus } from "../types";
import { getTransactionStatus } from "../getTransactionStatus";
Expand All @@ -21,10 +21,10 @@ import { broadcast } from "../broadcast";
import { perCoinLogic } from "../logic";
import resolver from "../hw-getAddress";

function buildCurrencyBridge(signerContext: SignerContext, perfLogger: PerfLogger) {
function buildCurrencyBridge(signerContext: SignerContext) {
const getAddress = resolver(signerContext);
const scanAccounts = makeScanAccounts<BitcoinAccount>({
getAccountShape: makeGetAccountShape(signerContext, perfLogger.startSpan),
getAccountShape: makeGetAccountShape(signerContext),
getAddressFn: getAddressWrapper(getAddress),
});

Expand All @@ -35,9 +35,9 @@ function buildCurrencyBridge(signerContext: SignerContext, perfLogger: PerfLogge
};
}

function buildAccountBridge(signerContext: SignerContext, perfLogger: PerfLogger) {
function buildAccountBridge(signerContext: SignerContext) {
const sync = makeSync<Transaction, BitcoinAccount, TransactionStatus>({
getAccountShape: makeGetAccountShape(signerContext, perfLogger.startSpan),
getAccountShape: makeGetAccountShape(signerContext),
postSync,
});

Expand Down Expand Up @@ -79,19 +79,11 @@ function buildAccountBridge(signerContext: SignerContext, perfLogger: PerfLogger
};
}

export type PerfLogger = {
startSpan: StartSpan;
};

export function createBridges(
signerContext: SignerContext,
perfLogger: PerfLogger,
coinConfig: CoinConfig,
) {
export function createBridges(signerContext: SignerContext, coinConfig: CoinConfig) {
setCoinConfig(coinConfig);

return {
currencyBridge: buildCurrencyBridge(signerContext, perfLogger),
accountBridge: buildAccountBridge(signerContext, perfLogger),
currencyBridge: buildCurrencyBridge(signerContext),
accountBridge: buildAccountBridge(signerContext),
};
}
31 changes: 1 addition & 30 deletions libs/coin-modules/coin-bitcoin/src/synchronisation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,8 @@ const deduplicateOperations = (operations: (Operation | undefined)[]): Operation
return out;
};

// For performance monitoring
export type StartSpan = (
op: string,
description?: string,
rest?: {
tags?: any;
data?: any;
},
) => {
finish: () => void;
};
export function makeGetAccountShape(
signerContext: SignerContext,
startSpan: StartSpan,
): GetAccountShape<BitcoinAccount> {
export function makeGetAccountShape(signerContext: SignerContext): GetAccountShape<BitcoinAccount> {
return async info => {
let span;
const { currency, index, derivationPath, derivationMode, initialAccount, deviceId } = info;
// In case we get a full derivation path, extract the seed identification part
// 44'/0'/0'/0/0 --> 44'/0'
Expand Down Expand Up @@ -115,7 +100,6 @@ export function makeGetAccountShape(
const walletNetwork = toWalletNetwork(currency.id);
const walletDerivationMode = toWalletDerivationMode(derivationMode);

span = startSpan("sync", "generateAccount");
const walletAccount =
initialAccount?.bitcoinResources?.walletAccount ||
(await wallet.generateAccount(
Expand All @@ -129,7 +113,6 @@ export function makeGetAccountShape(
},
currency,
));
span.finish();

const oldOperations = initialAccount?.operations || [];
const currentBlock = await walletAccount.xpub.explorer.getCurrentBlock();
Expand All @@ -138,39 +121,27 @@ export function makeGetAccountShape(
await wallet.syncAccount(walletAccount, blockHeight);

const balance = await wallet.getAccountBalance(walletAccount);
span = startSpan("sync", "getAccountTransactions");
const { txs: transactions } = await wallet.getAccountTransactions(walletAccount);
span.finish();

span = startSpan("sync", "getXpubAddresses");
const accountAddresses: Set<string> = new Set<string>();
const accountAddressesWithInfo = await walletAccount.xpub.getXpubAddresses();
accountAddressesWithInfo.forEach(a => accountAddresses.add(a.address));
span.finish();

span = startSpan("sync", "getUniquesAddresses");
const changeAddresses: Set<string> = new Set<string>();
const changeAddressesWithInfo = await walletAccount.xpub.storage.getUniquesAddresses({
account: 1,
});
changeAddressesWithInfo.forEach(a => changeAddresses.add(a.address));
span.finish();

span = startSpan("sync", "mapTxToOperations");
const newOperations = transactions
?.map(tx => mapTxToOperations(tx, currency.id, accountId, accountAddresses, changeAddresses))
.flat();
span.finish();

span = startSpan("sync", "unify operations");
const newUniqueOperations = deduplicateOperations(newOperations);
const operations = mergeOps(oldOperations, newUniqueOperations);
span.finish();

span = startSpan("sync", "gather utxos");
const rawUtxos = await wallet.getAccountUnspentUtxos(walletAccount);
const utxos = rawUtxos.map(utxo => fromWalletUtxo(utxo, changeAddresses));
span.finish();

return {
id: accountId,
Expand Down
15 changes: 15 additions & 0 deletions libs/ledger-live-common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
## 34.5.0-next.4

## 34.7.1

### Patch Changes

- [#7642](https://github.com/LedgerHQ/ledger-live/pull/7642) [`22ff55b`](https://github.com/LedgerHQ/ledger-live/commit/22ff55bf74a27fa22701c8b20424732a189ca017) Thanks [@ofreyssinet-ledger](https://github.com/ofreyssinet-ledger)! - Sentry: disable capture of "performance spans", which were not actually in use, but still causing a stop of the internal process on LLD Windows

- Updated dependencies [[`22ff55b`](https://github.com/LedgerHQ/ledger-live/commit/22ff55bf74a27fa22701c8b20424732a189ca017)]:
- @ledgerhq/[email protected]

## 34.7.1-hotfix.0

### Patch Changes

- [#7642](https://github.com/LedgerHQ/ledger-live/pull/7642) [`22ff55b`](https://github.com/LedgerHQ/ledger-live/commit/22ff55bf74a27fa22701c8b20424732a189ca017) Thanks [@ofreyssinet-ledger](https://github.com/ofreyssinet-ledger)! - Sentry: disable capture of "performance spans", which were not actually in use, but still causing a stop of the internal process on LLD Windows

## 34.7.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/ledger-live-common/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ledgerhq/live-common",
"description": "Common ground for the Ledger Live apps",
"version": "34.7.0",
"version": "34.7.1",
"repository": {
"type": "git",
"url": "https://github.com/LedgerHQ/ledger-live.git"
Expand Down
Loading

0 comments on commit 1989f7a

Please sign in to comment.