Skip to content

Commit

Permalink
[LIVE-13715] Support - Update axios everywhere (#7593)
Browse files Browse the repository at this point in the history
* Update `axios` everywhere to fixed version `1.7.3`

* changeset

* Update `live-network` for axios version `1.7.3`

* changeset

* Update test in `coin-tezos` for axios 1.7.3 update

* changeset

* Update trustchain test for new axios headers

* Remove axios complete mock and replace w/ nock

* Update coin-framework unimportedrc
  • Loading branch information
lambertkevin committed Sep 3, 2024
1 parent 93128e3 commit 187293c
Show file tree
Hide file tree
Showing 43 changed files with 860 additions and 490 deletions.
21 changes: 21 additions & 0 deletions .changeset/cuddly-tomatoes-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
"@ledgerhq/hw-transport-node-speculos-http": patch
"@ledgerhq/hw-transport-http": patch
"@ledgerhq/context-module": patch
"@ledgerhq/hw-app-helium": patch
"@ledgerhq/hw-app-solana": patch
"@ledgerhq/cryptoassets": patch
"@ledgerhq/hw-app-btc": patch
"@ledgerhq/hw-app-eth": patch
"@ledgerhq/coin-bitcoin": patch
"@ledgerhq/coin-evm": patch
"ledger-live-desktop": patch
"@ledgerhq/live-common": patch
"@ledgerhq/domain-service": patch
"@ledgerhq/live-network": patch
"@ledgerhq/coin-tester": patch
"@ledgerhq/evm-tools": patch
"@ledgerhq/ledger-libs": patch
---

Update `axios` to fixed version `1.7.3`
5 changes: 5 additions & 0 deletions .changeset/eleven-taxis-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/live-network": major
---

Migrate to axios version 1.7.3
5 changes: 5 additions & 0 deletions .changeset/pink-wolves-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/coin-tezos": patch
---

Update some test for types regarding the upgrade to axios version 1.7.3
5 changes: 3 additions & 2 deletions apps/ledger-live-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
"@types/write-file-atomic": "^4.0.0",
"@vitejs/plugin-react": "^3.1.0",
"allure-playwright": "2.15.1",
"axios": "1.3.4",
"axios": "1.7.3",
"chalk": "^4.1.2",
"cross-env": "^7.0.3",
"debug": "^4.3.4",
Expand All @@ -218,6 +218,7 @@
"jest-environment-jsdom": "^29.7.0",
"listr": "^0.14.3",
"listr-verbose-renderer": "^0.6.0",
"nock": "^13.0.5",
"prebuild-install": "^7.1.1",
"react-refresh": "^0.14.0",
"react-test-renderer": "^18.2.0",
Expand All @@ -229,4 +230,4 @@
"vite-plugin-electron": "0.4.9",
"yargs": "^17.0.0"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import nock from "nock";
import React from "react";
import axios from "axios";
import { TFunction } from "i18next";
import BigNumber from "bignumber.js";
import { render, screen, waitFor } from "tests/testUtils";

import {
getCryptoCurrencyById,
setSupportedCurrencies,
Expand All @@ -13,16 +14,13 @@ import { useFeature } from "@ledgerhq/live-common/featureFlags/index";
import { DomainServiceProvider } from "@ledgerhq/domain-service/hooks/index";
import { Transaction, TransactionStatus } from "@ledgerhq/live-common/generated/types";
import RecipientField from "./RecipientField";
import { TFunction } from "i18next";

// Temp mock to prevent error on sentry init
jest.mock("../../../../sentry/install", () => ({
init: () => null,
}));

jest.mock("axios");

const mockedAxios = jest.mocked(axios);
nock.disableNetConnect();

jest.mock("@ledgerhq/live-common/featureFlags/index", () => ({
useFeature: jest.fn(),
Expand Down Expand Up @@ -340,6 +338,7 @@ describe("RecipientField", () => {
});

it("should not change domain because currency not supported", async () => {
const spy = jest.spyOn(axios, "request");
const { user } = setup(null, null, polygonMockAccount);
const input = screen.getByRole("textbox");
await user.type(input, "0x16bb635bc5c398b63a0fbb38dac84da709eb3e86");
Expand All @@ -350,7 +349,7 @@ describe("RecipientField", () => {
recipientDomain: undefined,
}),
);
expect(mockedAxios).not.toHaveBeenCalled();
expect(spy).not.toHaveBeenCalled();
});
});

Expand Down
8 changes: 6 additions & 2 deletions libs/coin-framework/.unimportedrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,9 @@
"src/test-helpers/bridge-integration-suite.ts",
"src/config.ts"
],
"ignoreUnresolved": ["follow-redirects"]
}
"ignoreUnresolved": [
"follow-redirects",
"form-data",
"proxy-from-env"
]
}
2 changes: 1 addition & 1 deletion libs/coin-modules/coin-bitcoin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@types/ripemd160": "^2.0.3",
"@types/secp256k1": "^4.0.3",
"@types/sha.js": "^2.4.4",
"axios": "0.26.1",
"axios": "1.7.3",
"bip32": "^2.0.6",
"bip39": "^3.0.4",
"jest": "^29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion libs/coin-modules/coin-evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"@ledgerhq/live-network": "workspace:^",
"@ledgerhq/live-promise": "workspace:^",
"@ledgerhq/logs": "workspace:^",
"axios": "0.26.1",
"axios": "1.7.3",
"bignumber.js": "^9.1.2",
"eip55": "^2.1.1",
"ethers": "5.7.2",
Expand Down
6 changes: 4 additions & 2 deletions libs/coin-modules/coin-tezos/src/network/bakers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@ describe("Tezos Baker", () => {
const response = {
data,
status: 200,
headers: {},
headers: {} as any,
statusText: "",
config: {},
config: {
headers: {} as any,
},
};

mockedNetwork.mockReturnValue(Promise.resolve(response));
Expand Down
2 changes: 1 addition & 1 deletion libs/coin-tester/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@ledgerhq/hw-transport-node-speculos-http": "workspace:^",
"axios": "^1.5.0",
"axios": "1.7.3",
"chalk": "^4.1.2",
"docker-compose": "^0.24.2",
"lodash": "^4.17.21",
Expand Down
4 changes: 2 additions & 2 deletions libs/domain-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@ledgerhq/errors": "workspace:^",
"@ledgerhq/logs": "workspace:^",
"@ledgerhq/types-live": "workspace:^",
"axios": "^1.3.4",
"axios": "1.7.3",
"eip55": "^2.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand All @@ -86,4 +86,4 @@
"react-test-renderer": "^18.2.0",
"ts-jest": "^29.1.1"
}
}
}
4 changes: 2 additions & 2 deletions libs/evm-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"dependencies": {
"@ledgerhq/cryptoassets": "workspace:^",
"@ledgerhq/live-env": "workspace:^",
"axios": "^1.6.5",
"axios": "1.7.3",
"crypto-js": "4.2.0",
"ethers": "5.7.2"
},
Expand All @@ -71,4 +71,4 @@
"test": "jest",
"unimported": "unimported"
}
}
}
2 changes: 1 addition & 1 deletion libs/ledger-live-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
"@zondax/ledger-icp": "^0.7.0",
"@zondax/ledger-stacks": "^1.0.2",
"async": "^3.2.3",
"axios": "0.26.1",
"axios": "1.7.3",
"bech32": "^1.1.3",
"big-integer": "^1.6.51",
"bignumber.js": "^9.1.2",
Expand Down
4 changes: 2 additions & 2 deletions libs/ledgerjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.3",
"scripts": {},
"dependencies": {
"axios": "^0.27.2",
"axios": "1.7.3",
"invariant": "^2.2.4",
"lodash": "^4.17.21"
},
Expand All @@ -15,4 +15,4 @@
"jest": "^29.7.0",
"ts-jest": "^29.1.1"
}
}
}
4 changes: 2 additions & 2 deletions libs/ledgerjs/packages/context-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"typescript": "^5.4.5"
},
"dependencies": {
"axios": "^1.6.8",
"axios": "1.7.3",
"ethers": "^5.7.2"
}
}
}
4 changes: 2 additions & 2 deletions libs/ledgerjs/packages/cryptoassets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"import:cal-tokens": "ts-node ./src/crypto-assets-importer/index.ts"
},
"dependencies": {
"axios": "^1.6.0",
"axios": "1.7.3",
"bs58check": "^2.1.2",
"invariant": "2"
},
Expand Down Expand Up @@ -86,4 +86,4 @@
},
"license": "Apache-2.0",
"gitHead": "dd0dea64b58e5a9125c8a422dcffd29e5ef6abec"
}
}
4 changes: 2 additions & 2 deletions libs/ledgerjs/packages/hw-app-btc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@ledgerhq/hw-transport-node-speculos": "workspace:^",
"@types/jest": "^29.5.10",
"@types/node": "^20.8.10",
"axios": "^0.25.0",
"axios": "1.7.3",
"documentation": "14.0.2",
"jest": "^29.7.0",
"rimraf": "^4.4.1",
Expand All @@ -98,4 +98,4 @@
"unimported": "unimported"
},
"gitHead": "dd0dea64b58e5a9125c8a422dcffd29e5ef6abec"
}
}
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-app-eth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@ledgerhq/hw-transport-mocker": "workspace:^",
"@ledgerhq/logs": "workspace:^",
"@ledgerhq/types-live": "workspace:^",
"axios": "^1.3.4",
"axios": "1.7.3",
"bignumber.js": "^9.1.2",
"semver": "^7.3.5"
},
Expand Down
4 changes: 2 additions & 2 deletions libs/ledgerjs/packages/hw-app-helium/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@ledgerhq/hw-transport-node-speculos": "workspace:^",
"@types/jest": "^29.5.10",
"@types/node": "^20.8.10",
"axios": "^0.26.1",
"axios": "1.7.3",
"documentation": "14.0.2",
"jest": "^29.7.0",
"rimraf": "^4.4.1",
Expand All @@ -60,4 +60,4 @@
"test": "jest",
"unimported": "unimported"
}
}
}
4 changes: 2 additions & 2 deletions libs/ledgerjs/packages/hw-app-solana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@ledgerhq/hw-transport-node-speculos": "workspace:^",
"@types/jest": "^29.5.10",
"@types/node": "^20.8.10",
"axios": "^0.26.1",
"axios": "1.7.3",
"documentation": "14.0.2",
"jest": "^29.7.0",
"rimraf": "^4.4.1",
Expand All @@ -55,4 +55,4 @@
"test": "jest",
"unimported": "unimported"
}
}
}
4 changes: 2 additions & 2 deletions libs/ledgerjs/packages/hw-transport-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@ledgerhq/errors": "workspace:^",
"@ledgerhq/hw-transport": "workspace:^",
"@ledgerhq/logs": "workspace:^",
"axios": "^0.26.1",
"axios": "1.7.3",
"ws": "^7.5.2"
},
"scripts": {
Expand All @@ -54,4 +54,4 @@
"ts-jest": "^29.1.1",
"ts-node": "^10.4.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@ledgerhq/errors": "workspace:^",
"@ledgerhq/hw-transport": "workspace:^",
"@ledgerhq/logs": "workspace:^",
"axios": "^0.26.1",
"axios": "1.7.3",
"rxjs": "^7.8.1"
},
"scripts": {
Expand All @@ -56,4 +56,4 @@
"ts-jest": "^29.1.1",
"ts-node": "^10.4.0"
}
}
}
4 changes: 2 additions & 2 deletions libs/live-network/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@ledgerhq/live-env": "workspace:^",
"@ledgerhq/live-promise": "workspace:^",
"@ledgerhq/logs": "workspace:^",
"axios": "0.26.1",
"axios": "1.7.3",
"lru-cache": "^7.14.1"
},
"devDependencies": {
Expand All @@ -86,4 +86,4 @@
"test": "jest",
"unimported": "unimported"
}
}
}
Loading

0 comments on commit 187293c

Please sign in to comment.