Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥 Hotfix 2024-06-20 #7153

Merged
merged 6 commits into from
Jun 24, 2024
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
14 changes: 14 additions & 0 deletions apps/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @ledgerhq/live-cli

## 24.3.1

### Patch Changes

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

## 24.3.1-hotfix.0

### Patch Changes

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

## 24.3.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.3.0",
"version": "24.3.1",
"description": "ledger-live CLI version",
"repository": {
"type": "git",
Expand Down
14 changes: 14 additions & 0 deletions apps/ledger-live-desktop/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# ledger-live-desktop

## 2.82.1

### Patch Changes

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

## 2.82.1-hotfix.0

### Patch Changes

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

## 2.82.0

### Minor Changes
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.82.0",
"version": "2.82.1",
"scripts": {
"start:prod": "electron ./.webpack/main.bundle.js",
"start": "cross-env NODE_ENV=development node ./tools/main.js",
Expand Down
22 changes: 22 additions & 0 deletions apps/ledger-live-mobile/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# live-mobile

## 3.45.1

### Patch Changes

- [#7153](https://github.com/LedgerHQ/ledger-live/pull/7153) [`33d26a9`](https://github.com/LedgerHQ/ledger-live/commit/33d26a9847d15571cce19f8159e29958398bb3a0) Thanks [@live-github-bot](https://github.com/apps/live-github-bot)! - bugfix crash case in ReceiveFunds/02-SelectAccount

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

## 3.45.1-hotfix.1

### Patch Changes

- [#7153](https://github.com/LedgerHQ/ledger-live/pull/7153) [`33d26a9`](https://github.com/LedgerHQ/ledger-live/commit/33d26a9847d15571cce19f8159e29958398bb3a0) Thanks [@live-github-bot](https://github.com/apps/live-github-bot)! - bugfix crash case in ReceiveFunds/02-SelectAccount

## 3.45.1-hotfix.0

### Patch Changes

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

## 3.45.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.45.0",
"version": "3.45.1",
"private": true,
"scripts": {
"postinstall": "zx ./scripts/post.mjs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useSelector } from "react-redux";

import { Button, Flex, Text } from "@ledgerhq/native-ui";
import { useTranslation } from "react-i18next";
import { Account, AccountLike, SubAccount, TokenAccount } from "@ledgerhq/types-live";
import { Account, SubAccount, TokenAccount } from "@ledgerhq/types-live";
import { makeEmptyTokenAccount } from "@ledgerhq/live-common/account/index";
import { flattenAccountsByCryptoCurrencyScreenSelector } from "~/reducers/accounts";
import { NavigatorName, ScreenName } from "~/const";
Expand All @@ -25,6 +25,8 @@ type SubAccountEnhanced = SubAccount & {
triggerCreateAccount: boolean;
};

type AccountLikeEnhanced = SubAccountEnhanced | Account | TokenAccount;

type NavigationProps = BaseComposite<
StackNavigatorProps<AccountsNavigatorParamList, ScreenName.ReceiveSelectAccount>
>;
Expand Down Expand Up @@ -54,21 +56,22 @@ function ReceiveSelectAccount({
const aggregatedAccounts = useMemo(
() =>
currency && currency.type === "TokenCurrency"
? parentAccounts!.reduce<AccountLike[]>((accs, pa) => {
const tokenAccounts = (pa as Account).subAccounts
? (pa as Account).subAccounts?.filter(
acc => acc.type === "TokenAccount" && acc.token.id === currency.id,
)
: [];
? parentAccounts!.reduce<AccountLikeEnhanced[]>((accs, pa) => {
const tokenAccounts =
pa.type === "Account" && pa.subAccounts
? pa.subAccounts?.filter(
acc => acc.type === "TokenAccount" && acc.token.id === currency.id,
)
: [];

if (tokenAccounts && tokenAccounts.length > 0) {
accs.push(...tokenAccounts);
} else {
const tokenAcc = makeEmptyTokenAccount(pa as Account, currency);
} else if (pa.type === "Account") {
const tokenAcc = makeEmptyTokenAccount(pa, currency);

const tokenA: SubAccountEnhanced = {
...tokenAcc,
parentAccount: pa as Account,
parentAccount: pa,
triggerCreateAccount: true,
};

Expand All @@ -82,16 +85,16 @@ function ReceiveSelectAccount({
);

const selectAccount = useCallback(
(account: AccountLike) => {
(account: AccountLikeEnhanced) => {
if (currency) {
track("account_clicked", {
asset: currency.name,
page: "Select account to deposit to",
});
navigation.navigate(ScreenName.ReceiveConfirmation, {
...route.params,
accountId: (account as SubAccountEnhanced)?.parentId || account.id,
createTokenAccount: (account as SubAccountEnhanced)?.triggerCreateAccount,
accountId: (account.type !== "Account" && account?.parentId) || account.id,
createTokenAccount: "triggerCreateAccount" in account && account?.triggerCreateAccount,
});
}
},
Expand All @@ -101,21 +104,12 @@ function ReceiveSelectAccount({
const walletState = useSelector(walletSelector);

const renderItem = useCallback(
({ item }: ListRenderItemInfo<AccountLike>) => (
({ item }: ListRenderItemInfo<AccountLikeEnhanced>) => (
<Flex px={6}>
<AccountCard
account={item}
AccountSubTitle={
(item as SubAccountEnhanced).parentAccount ||
(item as TokenAccount).token?.parentCurrency ? (
<Text color="neutral.c80">
{accountNameWithDefaultSelector(
walletState,
((item as SubAccountEnhanced).parentAccount as Account) ||
(item as TokenAccount).token.parentCurrency,
)}
</Text>
) : null
<Text color="neutral.c80">{accountNameWithDefaultSelector(walletState, item)}</Text>
}
onPress={() => selectAccount(item)}
/>
Expand Down Expand Up @@ -144,7 +138,7 @@ function ReceiveSelectAccount({
}
}, [currency, navigationAccount]);

const keyExtractor = useCallback((item: AccountLike) => item?.id, []);
const keyExtractor = useCallback((item: AccountLikeEnhanced) => item?.id, []);

return currency && aggregatedAccounts && aggregatedAccounts.length > 0 ? (
<>
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.6.1

### Patch Changes

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

## 0.6.1-hotfix.0

### Patch Changes

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

## 0.6.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.6.0",
"version": "0.6.1",
"private": true,
"browser": {
"fs": false,
Expand Down
12 changes: 12 additions & 0 deletions libs/coin-modules/coin-polkadot/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @ledgerhq/coin-polkadot

## 0.8.0

### Minor Changes

- [#7153](https://github.com/LedgerHQ/ledger-live/pull/7153) [`b0c7b8d`](https://github.com/LedgerHQ/ledger-live/commit/b0c7b8dcc7088853ad73518cb470e8b5b05be4de) Thanks [@live-github-bot](https://github.com/apps/live-github-bot)! - polkadot generic nano app support

## 0.8.0-hotfix.0

### Minor Changes

- [#7153](https://github.com/LedgerHQ/ledger-live/pull/7153) [`b0c7b8d`](https://github.com/LedgerHQ/ledger-live/commit/b0c7b8dcc7088853ad73518cb470e8b5b05be4de) Thanks [@live-github-bot](https://github.com/apps/live-github-bot)! - polkadot generic nano app support

## 0.7.0

### Minor Changes
Expand Down
10 changes: 5 additions & 5 deletions libs/coin-modules/coin-polkadot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ledgerhq/coin-polkadot",
"version": "0.7.0",
"version": "0.8.0",
"description": "Ledger Polkadot Coin integration",
"keywords": [
"Ledger",
Expand Down Expand Up @@ -108,10 +108,10 @@
"@ledgerhq/logs": "workspace:^",
"@ledgerhq/types-cryptoassets": "workspace:^",
"@ledgerhq/types-live": "workspace:^",
"@polkadot/types": "10.9.1",
"@polkadot/types-known": "10.9.1",
"@polkadot/util": "12.5.1",
"@polkadot/util-crypto": "12.5.1",
"@polkadot/types": "11.2.1",
"@polkadot/types-known": "11.2.1",
"@polkadot/util": "12.6.2",
"@polkadot/util-crypto": "12.6.2",
"bignumber.js": "^9.1.2",
"expect": "^27.4.6",
"invariant": "^2.2.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { TypeRegistry } from "@polkadot/types";
import { buildTransaction } from "./buildTransaction";
import { createFixtureAccount, createFixtureTransaction } from "../types/bridge.fixture";
import { faker } from "@faker-js/faker";
import { getCoinConfig } from "../config";

const registry = new TypeRegistry();

Expand All @@ -25,8 +26,34 @@ jest.mock("../network", () => {
};
});

jest.mock("../config");
const mockGetConfig = jest.mocked(getCoinConfig);

describe("buildTransaction", () => {
let spyRegistry: jest.SpyInstance | undefined;
beforeAll(() => {
mockGetConfig.mockImplementation((): any => {
return {
status: {
type: "active",
},
sidecar: {
url: "https://polkadot-sidecar.coin.ledger.com",
credentials: "",
},
staking: {
electionStatusThreshold: 25,
},
metadataShortener: {
url: "https://api.zondax.ch/polkadot/transaction/metadata",
},
metadataHash: {
url: "https://api.zondax.ch/polkadot/node/metadata/hash",
},
runtimeUpgraded: false,
};
});
});

afterEach(() => {
mockExtrinsics.mockClear();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { PolkadotAccount, Transaction } from "../types";
import { craftTransaction, type CreateExtrinsicArg } from "../logic";
import { isFirstBond, getNonce } from "./utils";
import { getCoinConfig } from "../config";

export const extractExtrinsicArg = (
account: PolkadotAccount,
Expand Down Expand Up @@ -28,10 +29,12 @@ export const buildTransaction = async (
transaction: Transaction,
forceLatestParams = false,
) => {
const runtimeUpgraded = getCoinConfig().runtimeUpgraded;
return craftTransaction(
account.freshAddress,
getNonce(account),
extractExtrinsicArg(account, transaction),
forceLatestParams,
runtimeUpgraded,
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from "../network/sidecar.fixture";
import { createFixtureAccount, createFixtureTransaction } from "../types/bridge.fixture";
import { createRegistryAndExtrinsics } from "../network/common";
import { getCoinConfig } from "../config";

const mockPaymentInfo = jest.fn();
const mockRegistry = jest
Expand All @@ -19,8 +20,34 @@ jest.mock("../network/sidecar", () => ({
getTransactionParams: () => mockTransactionParams(),
}));

jest.mock("../config");
const mockGetConfig = jest.mocked(getCoinConfig);

describe("getEstimatedFees", () => {
const transaction = createFixtureTransaction();
beforeAll(() => {
mockGetConfig.mockImplementation((): any => {
return {
status: {
type: "active",
},
sidecar: {
url: "https://polkadot-sidecar.coin.ledger.com",
credentials: "",
},
staking: {
electionStatusThreshold: 25,
},
metadataShortener: {
url: "https://api.zondax.ch/polkadot/transaction/metadata",
},
metadataHash: {
url: "https://api.zondax.ch/polkadot/node/metadata/hash",
},
runtimeUpgraded: false,
};
});
});

beforeEach(() => {
mockPaymentInfo.mockClear();
Expand Down
Loading
Loading