Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.

Commit 2bd9481

Browse files
authored
Merge pull request #152 from glethuillier/main
Fix Default Provider for Bitcoin
2 parents eef61f8 + b87638c commit 2bd9481

15 files changed

+1999
-1575
lines changed

Diff for: .github/workflows/regression_tests/check.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,13 @@ def run_negative_test(data: dict, provider: str) -> bool:
182182
def run_tests(product_under_test=None, currency=None, provider=None):
183183

184184
if provider is None:
185-
run_tests(product_under_test, currency, "custom")
185+
run_tests(
186+
product_under_test,
187+
currency,
188+
"default"
189+
if os.environ.get("XPUB_SCAN_CUSTOM_API_KEY_V2") is None
190+
else "custom",
191+
)
186192
return
187193

188194
with open(f"{base_path}/datasets.json", "r") as f:
@@ -234,7 +240,10 @@ def run_tests(product_under_test=None, currency=None, provider=None):
234240
provider = sys.argv[3].lower()
235241

236242
# when testing the default provider, remove the API KEY env var
237-
if provider == "default" and os.environ.get("XPUB_SCAN_CUSTOM_API_KEY_V2") is not None:
243+
if (
244+
provider == "default"
245+
and os.environ.get("XPUB_SCAN_CUSTOM_API_KEY_V2") is not None
246+
):
238247
del os.environ["XPUB_SCAN_CUSTOM_API_KEY_V2"]
239248

240249
run_tests(product_under_test, currency, provider)

Diff for: .github/workflows/regression_tests_custom.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
3232
- name: Install Xpub Scan dependencies and build it
3333
run: |
34-
yarn && yarn build
34+
npm i && npm run build
3535
3636
- name: ${{ matrix.product }} x ${{ matrix.currency }}
3737
run: |

Diff for: .github/workflows/regression_tests_default.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
2727
- name: Install Xpub Scan dependencies and build it
2828
run: |
29-
yarn && yarn build
29+
npm i && npm run build
3030
3131
- name: ${{ matrix.product }} x ${{ matrix.currency }}
3232
run: |

Diff for: .github/workflows/static_analysis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
- uses: actions/checkout@v2
1616

1717
- name: Install dependencies
18-
run: yarn
18+
run: npm i
1919

2020
- name: Generate code coverage
21-
run: yarn sonarqube
21+
run: npm run sonarqube
2222

2323
- name: SonarCloud Scan
2424
uses: sonarsource/sonarcloud-github-action@master

Diff for: .github/workflows/unit_tests.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ jobs:
1919
- name: Check dependencies
2020
run: |
2121
npm i
22-
yarn check --verify-tree
2322
check-outdated --ignore-packages chalk,jest,bitcoinjs-lib
2423
npm audit --audit-level=low --json
2524
@@ -33,13 +32,13 @@ jobs:
3332
- uses: actions/cache@v2
3433
with:
3534
path: "**/node_modules"
36-
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
35+
key: ${{ runner.os }}-modules-${{ hashFiles('**/npm-shrinkwrap.json') }}
3736

3837
- name: Install dependencies
39-
run: yarn
38+
run: npm i
4039

4140
- name: Prettify
42-
run: yarn prettier
41+
run: npm run prettier
4342

4443
- name: Run checks
45-
run: yarn ci
44+
run: npm run ci

Diff for: .gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.env
22
node_modules
33
lib
4-
yarn.lock
54
package-lock.json
65
coverage/

Diff for: .npmignore

-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ doc
1111
node_modules
1212
src
1313
tsconfig.json
14-
yarn.lock

Diff for: CONTRIBUTING.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ XPUB_SCAN_CUSTOM_API_KEY_V2=<your key>
6262
Your code has to be correctly formatted. To this effect, a set of rules are defined in `.prettierrc.json` and automatically enforced with this command:
6363

6464
```
65-
$ yarn prettier
65+
$ npm run prettier
6666
```
6767

6868
## Add Unit Tests
@@ -77,7 +77,7 @@ The general idea is to progressively reach near 100% coverage.
7777

7878
Once your fix or feature has been implemented, you can locally ensure that the project will pass the tests in the CI.
7979

80-
(Note: you can run all tests at once: `$ yarn dev:test:all`).
80+
(Note: you can run all tests at once: `$ npm run dev:test:all`).
8181

8282
## Up-to-date Requirements
8383

@@ -86,7 +86,7 @@ For security reasons, the dependencies have to be up-to-date and strictly pinpoi
8686
To this effect, a dedicated command verifies the dependencies:
8787

8888
```
89-
$ yarn check:dep
89+
$ npm run check:dep
9090
```
9191

9292
If this command reveals that dependencies are outdated, update them in `package.json` **using strict versioning**:
@@ -102,7 +102,7 @@ Run `check:dep` again and, if the check passes, run the subsequent tests to ensu
102102
To run the unit tests, do:
103103

104104
```
105-
$ yarn ci
105+
$ npm run ci
106106
```
107107

108108
To generate the coverage (prerequisites: `jest` and `ts-node`, run:
@@ -120,7 +120,7 @@ Regression tests are essential to ensure that the core logic of Xpub Scan is not
120120
To run the regression tests locally, use the following command:
121121

122122
```
123-
$ yarn regression
123+
$ npm run regression
124124
```
125125

126126
(Important: the tests will fail if no CryptoAPIs API v2 key is provided).

Diff for: Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ WORKDIR /app
1010

1111
COPY package.json npm-shrinkwrap.json ./
1212

13-
RUN npm i && npm ci
13+
RUN npm i && npm run ci
1414

1515
COPY . .
1616

Diff for: README.md

+4-12
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ Given an extended public key (xpub, Ltub, _etc._), get the balances of its deriv
2323

2424
## Install
2525

26-
With yarn:
27-
28-
```
29-
$ yarn global add @ledgerhq/xpub-scan
30-
```
31-
32-
With npm:
33-
3426
```
3527
$ npm i -g @ledgerhq/xpub-scan
3628
```
@@ -66,7 +58,7 @@ scanResult("your_xpub");
6658
Install dependencies:
6759

6860
```
69-
$ npm ci
61+
$ npm run ci
7062
```
7163

7264
Build the project
@@ -84,7 +76,7 @@ $ node ./lib/scan.js [options] <xpub>
8476
_Alternatively, if you want to use the locally-built version of xpub-scan with just `xpub-scan` command, you can:_
8577

8678
```
87-
$ yarn link
79+
$ npm link
8880
```
8981

9082
### Currencies
@@ -207,7 +199,7 @@ The derived addresses are displayed during the analysis. Perfect matches are dis
207199
### Change Settings
208200

209201
1. Modify `./src/settings.ts`
210-
2. rebuild the tool: `$ yarn build`
202+
2. rebuild the tool: `$ npm run build`
211203
3. Re-run it: `$ node ./lib/scan.js <xpub> …`
212204

213205
### Change External Provider
@@ -218,6 +210,6 @@ The derived addresses are displayed during the analysis. Perfect matches are dis
218210

219211
1. At the root of the project, rename `.env.template` to `.env`
220212
2. In `.env`, set the `XPUB_SCAN_CUSTOM_API_KEY_V2` (corresponding to your Crypto APIs v2 API key—e.g.: `XPUB_SCAN_CUSTOM_API_KEY_V2=abcd6eacca264f7530eb2f7025a84f8`)
221-
3. rebuild the tool: `$ yarn build`
213+
3. rebuild the tool: `$ npm run build`
222214
4. Re-run it: `$ node ./lib/scan.js <xpub> …`
223215
5. Ensure that, when running the tool, it shows that the _custom_ provider is being used

0 commit comments

Comments
 (0)