Skip to content

Commit

Permalink
build: patch @ledgerhq/hw-app-eth
Browse files Browse the repository at this point in the history
  • Loading branch information
richardo2016x committed Dec 2, 2024
1 parent 6bf59d2 commit 08e448e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
4 changes: 4 additions & 0 deletions apps/mobile/scripts/create-patch.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh

## at apps/mobile
# ./node_modules/.bin/patch-package @isudaji/react-native-install-apk --exclude 'build|xcodeproj|package.json'
./node_modules/.bin/patch-package react-native-webview --exclude 'build|xcodeproj|package.json' --include 'lib\/.*\.d\.ts|android\/src\/.*\/.*(\.java|\.kt)|apple\/.*(\.mm?|\.h)'
./node_modules/.bin/patch-package @debank/common
Expand All @@ -8,3 +9,6 @@
# ./node_modules/.bin/patch-package @onekeyfe/react-native-ble-plx --exclude 'android\/.cxx|build|xcodeproj|package.json'
# ./node_modules/.bin/patch-package react-native-ble-plx --exclude 'android\/.cxx|build|xcodeproj|package.json'
./node_modules/.bin/patch-package @onekeyfe/hd-transport-react-native --exclude 'android\/.cxx|build|xcodeproj|package.json'

## at monorepo root
./node_modules/.bin/patch-package @ledgerhq/hw-app-eth --include 'lib\/services\/ledger/(erc20|contracts)\.js$'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"build:watch": "yarn run build --watch",
"changelog:validate": "yarn workspaces foreach --parallel --interlaced --verbose run changelog:validate",
"child-workspace-package-names-as-json": "ts-node scripts/child-workspace-package-names-as-json.ts",
"postinstall": "patch-package && yarn build && yarn apps/mobile postinstall",
"postinstall": "./node_modules/.bin/patch-package && yarn build && yarn apps/mobile postinstall",
"install-husky": "husky install",
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn constraints",
"lint:eslint": "eslint . --cache --ext js,ts",
Expand Down
26 changes: 26 additions & 0 deletions patches/@ledgerhq+hw-app-eth+6.40.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/node_modules/@ledgerhq/hw-app-eth/lib/services/ledger/contracts.js b/node_modules/@ledgerhq/hw-app-eth/lib/services/ledger/contracts.js
index 713d3a3..79f8f75 100644
--- a/node_modules/@ledgerhq/hw-app-eth/lib/services/ledger/contracts.js
+++ b/node_modules/@ledgerhq/hw-app-eth/lib/services/ledger/contracts.js
@@ -25,7 +25,7 @@ const loadInfosForContractMethod = (contractAddress, selector, chainId, userLoad
if (pluginBaseURL) {
const url = `${pluginBaseURL}/plugins/ethereum.json`;
data = yield axios_1.default
- .get(`${pluginBaseURL}/plugins/ethereum.json`)
+ .get(`${pluginBaseURL}/plugins/ethereum.json`, { timeout: 5000 })
.then(r => r.data)
.catch(e => {
(0, logs_1.log)("error", "could not fetch from " + url + ": " + String(e));
diff --git a/node_modules/@ledgerhq/hw-app-eth/lib/services/ledger/erc20.js b/node_modules/@ledgerhq/hw-app-eth/lib/services/ledger/erc20.js
index 8fdedf8..201f1ae 100644
--- a/node_modules/@ledgerhq/hw-app-eth/lib/services/ledger/erc20.js
+++ b/node_modules/@ledgerhq/hw-app-eth/lib/services/ledger/erc20.js
@@ -27,7 +27,7 @@ const findERC20SignaturesInfo = (userLoadConfig, chainId) => __awaiter(void 0, v
return null;
const url = `${cryptoassetsBaseURL}/evm/${chainId}/erc20-signatures.json`;
const blob = yield axios_1.default
- .get(url)
+ .get(url, { timeout: 5000 })
.then(({ data }) => {
if (!data || typeof data !== "string") {
throw new Error(`ERC20 signatures for chainId ${chainId} file is malformed ${url}`);

0 comments on commit 08e448e

Please sign in to comment.