Skip to content

Commit 5b67015

Browse files
isra67martintatum
andauthored
ALL-9118 - Upgrade Node, NPM and other libraries (#110)
* ALL-9118 - Upgrade Node, NPM and other libraries * ALL-9118 - Upgrade Node, NPM and other libraries Reverting back to Node 18 * ALL-9118 - Upgrade Node, NPM and other libraries yarn upgrade * ALL-9118 - Upgrade Node, NPM and other libraries minimatch dep fix attempt * ALL-9118 - Upgrade Node, NPM and other libraries minimatch dep fix attempt 2 * ALL-9118 - Upgrade Node, NPM and other libraries minimatch in resolutions * ALL-9118 - Upgrade Node, NPM and other libraries fixing linter * ALL-9118 - Upgrade Node, NPM and other libraries introducing tsup * ALL-9118 - Upgrade Node, NPM and other libraries Dockerfile optimizations Docker image build in Actions * ALL-9118 - Upgrade Node, NPM and other libraries Docket smoke test in Actions * ALL-9118 - Upgrade Node, NPM and other libraries Actions upgrade * ALL-9118 - Upgrade Node, NPM and other libraries Actions upgrade - fixing typo * ALL-9118 - Upgrade Node, NPM and other libraries uuid package upgrade * ALL-9118 - Upgrade Node, NPM and other libraries GitHub actions update + fixing runs-on image version * ALL-9118 - Upgrade Node, NPM and other libraries Adding skeleton for Jest tests + first parametrized tests as an example * ALL-9118 - Upgrade Node, NPM and other libraries Adding CTRF reporter * ALL-9118 - Upgrade Node, NPM and other libraries Fixing CTRF reporter * ALL-9118 - Upgrade Node, NPM and other libraries Fixing CTRF reporter yml > json * ALL-9118 - Upgrade Node, NPM and other libraries CTRF reporter summary, PR * ALL-9118 - Upgrade Node, NPM and other libraries CTRF reporter adding GITHUB_TOKEN * ALL-9118 - Upgrade Node, NPM and other libraries tests sonar refactoring * ALL-9118 - Upgrade Node, NPM and other libraries dockerfile sonar fix * ALL-9118 - Upgrade Node, NPM and other libraries dockerfile sonar alpine fix * ALL-9118 - Upgrade Node, NPM and other libraries adding one more test (for generatemanagedwallet command) * ALL-9118 - Upgrade Node, NPM and other libraries updating packages to latest version * ALL-9118 - Upgrade Node, NPM and other libraries adding changelog with breaking changes moving version to 8.0.0 * ALL-9118 - Upgrade Node, NPM and other libraries utilizing node user in dockerfile * ALL-9118 - Upgrade Node, NPM and other libraries adding changelog for last year --------- Co-authored-by: martintatum <martin.kyselak@tatum.io>
1 parent 1d14a97 commit 5b67015

File tree

14 files changed

+7084
-4352
lines changed

14 files changed

+7084
-4352
lines changed

.eslintrc

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/pull-request.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,36 @@ on:
55
- master
66
jobs:
77
build:
8-
name: 🏗️ Install and build
9-
runs-on: ubuntu-latest
8+
name: Build and Test
9+
runs-on: ubuntu-24.04
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v4
1212

13-
- uses: actions/setup-node@v2
13+
- uses: actions/setup-node@v4
1414
with:
15-
node-version: '18'
15+
node-version: '18.20.5'
1616

1717
- run: yarn install
1818

1919
- run: yarn lint
2020

2121
- run: yarn build
22+
23+
- run: yarn test
24+
25+
- run: npx github-actions-ctrf summary ctrf/ctrf-report.json --pull-request
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
29+
docker-build:
30+
name: Build Docker Image
31+
runs-on: ubuntu-24.04
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: build image
36+
run: docker build . --file Dockerfile -t ${{secrets.DOCKER_USER}}/tatum-kms:latest -t "${{secrets.DOCKER_USER}}/tatum-kms:$(cat ./package.json | jq -r ".version")"
37+
38+
- name: smoke test image
39+
run: docker run -i ${{secrets.DOCKER_USER}}/tatum-kms:latest --help
40+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ lerna-debug.log*
1919
# Tests
2020
/coverage
2121
/.nyc_output
22+
/ctrf
2223

2324
# IDEs and editors
2425
/.idea

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## [8.0.0] - January 2025
2+
3+
### Updated
4+
5+
- Dependency libraries updated to the latest versions
6+
7+
### Changed
8+
9+
- parameter `env-file` renamed to `envFile`
10+
- parameter `api-key` renamed to `apiKey`
11+
12+
### Added
13+
14+
- GitHub Actions pipeline revisited
15+
- basic smoke tests added
16+
17+
## [7.0.7] - December 2024
18+
19+
### Added
20+
21+
- Reporting feature
22+
23+
## [7.0.6] - May 2024
24+
25+
### Updated
26+
27+
- Dependency libraries updated to the latest versions
28+
- Fixed documentation links and dependencies
29+
30+
## [7.0.3] - April 2024
31+
32+
### Changed
33+
34+
- Fix Solana transaction not confirmed - fix for docker image
35+
- Print result as json for generateManagedPrivateKeyBatch (#100)
36+
- export wallets always export default path (#79)

Dockerfile

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
1-
FROM node:18-alpine3.16 AS builder
1+
FROM node:18.20.5-alpine3.20 AS builder
22

33
# Create app directory
4-
5-
WORKDIR /usr/src/app
4+
WORKDIR /opt/app
65

76
RUN apk --virtual build-dependencies add \
8-
git libtool curl jq py3-configobj py3-pip py3-setuptools python3 python3-dev g++ make libusb-dev eudev-dev linux-headers && ln -sf python3 /usr/bin/python
9-
10-
RUN ln -s /lib/arm-linux-gnueabihf/libusb-1.0.so.0 libusb-1.0.dll
7+
git libtool curl jq py3-configobj py3-pip py3-setuptools python3 python3-dev \
8+
g++ make libusb-dev eudev-dev linux-headers \
9+
&& ln -sf python3 /usr/bin/python \
10+
&& ln -s /lib/arm-linux-gnueabihf/libusb-1.0.so.0 libusb-1.0.dll
1111

1212
COPY package*.json ./
1313
COPY yarn.lock ./
1414

1515
# Installing dependencies
16-
RUN yarn cache clean
17-
RUN yarn install --frozen-lockfile --unsafe-perm
18-
RUN yarn add usb
16+
RUN yarn cache clean \
17+
&& yarn install --frozen-lockfile --unsafe-perm --ignore-scripts \
18+
&& yarn add usb
1919
# Copying files from current directory
2020

2121
COPY . .
2222

2323
# Create build and link
24-
2524
RUN yarn build
2625

27-
ENTRYPOINT ["node", "/usr/src/app/dist/index.js"]
26+
# Switch to the non-root user
27+
USER node
28+
29+
ENTRYPOINT ["node", "/opt/app/dist/index.js"]
2830

2931
CMD ["daemon"]

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ TATUM_KMS_DEBUG_MODE=true/false/1/0
150150
yarn global add @tatumio/tatum-kms
151151
```
152152
1. Use ```.env``` file to configure Tatum KMS
153-
1. via ```--env-file=/path/to/.env```
153+
1. via ```--envFile=/path/to/.env```
154154
```
155-
tatum-kms --env-file=/path/to/.env getaddress 11111111-1111-1111-1111-111111111111 0
155+
tatum-kms --envFile=/path/to/.env getaddress 11111111-1111-1111-1111-111111111111 0
156156
```
157157
1. via environment variables directly
158158
```
@@ -164,7 +164,7 @@ TATUM_KMS_DEBUG_MODE=true/false/1/0
164164
tatum-kms --help
165165
```
166166
167-
>**IMPORTANT!** NodeJS >=14 and npm@6 are required. KMS does **not** work on npm@7.
167+
>**IMPORTANT!** NodeJS >=18.0 are required. KMS does **not** work on older versions.
168168
169169
### Install KMS via Docker
170170
1. Pull the `tatum-kms` image:
@@ -175,7 +175,7 @@ TATUM_KMS_DEBUG_MODE=true/false/1/0
175175
```
176176
cd $HOME
177177
```
178-
1. Use pre-created ```.env``` file to configure Tatum KMS via ```--env-file .env```:
178+
1. Use pre-created ```.env``` file to configure Tatum KMS via ```--envFile .env```:
179179
1. Map the Docker volume to the local storage (your home folder).
180180
181181
For more details, refer to the [Docker user documentation](https://docs.docker.com/storage/volumes/).
@@ -184,9 +184,9 @@ TATUM_KMS_DEBUG_MODE=true/false/1/0
184184
185185
To interactively communicate with KMS and run various [KMS commands](#kms-commands), use the `docker run` command:
186186
```
187-
docker run -it --env-file .env -v $HOME:/root/.tatumrc tatumio/tatum-kms --help
188-
docker run -it --env-file .env -v $HOME:/root/.tatumrc tatumio/tatum-kms generatemanagedwallet BTC
189-
docker run -it --env-file .env -v $HOME:/root/.tatumrc tatumio/tatum-kms storemanagedprivatekey BTC
187+
docker run -it --envFile .env -v $HOME:/root/.tatumrc tatumio/tatum-kms --help
188+
docker run -it --envFile .env -v $HOME:/root/.tatumrc tatumio/tatum-kms generatemanagedwallet BTC
189+
docker run -it --envFile .env -v $HOME:/root/.tatumrc tatumio/tatum-kms storemanagedprivatekey BTC
190190
```
191191
192192
>**NOTE:** You can shorten the command syntax and use it as follows:
@@ -223,7 +223,7 @@ tatum-kms daemon
223223
```
224224
or
225225
```
226-
docker run -d --env-file .env -v $HOME:/root/.tatumrc tatumio/tatum-kms daemon
226+
docker run -d --envFile .env -v $HOME:/root/.tatumrc tatumio/tatum-kms daemon
227227
```
228228
When KMS runs as a daemon, it periodically checks for any new pending transactions to sign.
229229

eslint.config.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// @ts-check
2+
3+
import eslint from '@eslint/js';
4+
import tseslint from 'typescript-eslint';
5+
6+
export default tseslint.config(
7+
eslint.configs.recommended,
8+
tseslint.configs.recommended,
9+
{
10+
rules: {
11+
'@typescript-eslint/no-explicit-any': 'off'
12+
}
13+
}
14+
);

jest.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export default {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
moduleFileExtensions: ['ts', 'js'],
5+
transform: {
6+
'^.+\\.ts$': 'ts-jest',
7+
},
8+
testMatch: ['**/tests/**/*.test.ts'],
9+
reporters: [
10+
'default',
11+
['jest-ctrf-json-reporter', {}],
12+
],
13+
};

package.json

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
11
{
22
"name": "@tatumio/tatum-kms",
3-
"version": "7.0.8",
3+
"version": "8.0.0",
44
"description": "Tatum KMS - Key Management System for Tatum-powered apps.",
55
"main": "dist/index.js",
66
"types": "./dist/index.d.ts",
7+
"type": "module",
78
"engines": {
89
"node": ">=18.x"
910
},
11+
"tsup": {
12+
"entry": [
13+
"src/index.ts"
14+
],
15+
"sourcemap": false,
16+
"clean": true,
17+
"format": [
18+
"esm"
19+
]
20+
},
1021
"scripts": {
11-
"build": "tsc",
12-
"lint": "eslint . --ext .ts",
13-
"run-daemon-testnet": "node dist/index.js daemon --testnet --api-key=YOUR_API_KEY --chain=ADA",
14-
"start": "yarn build && node dist/index.js"
22+
"build": "tsup",
23+
"lint": "eslint .",
24+
"test": "jest",
25+
"run-daemon-testnet": "yarn start daemon --testnet --apiKey=YOUR_API_KEY --chain=ADA",
26+
"start": "node --experimental-modules dist/index.js"
1527
},
1628
"files": [
1729
"dist/"
@@ -38,33 +50,42 @@
3850
"url": "https://github.com/tatumio/tatum-kms/issues"
3951
},
4052
"homepage": "https://github.com/tatumio/tatum-kms#readme",
53+
"resolutions": {
54+
"minimatch@*": "^9.0.5"
55+
},
4156
"dependencies": {
42-
"@aws-sdk/client-secrets-manager": "^3.445.0",
43-
"@tatumio/cardano": "^2.2.72",
44-
"@tatumio/celo": "^2.2.72",
45-
"@tatumio/solana": "^2.2.72",
57+
"@aws-sdk/client-secrets-manager": "^3.669.0",
58+
"@tatumio/cardano": "^2.2.86",
59+
"@tatumio/celo": "^2.2.86",
60+
"@tatumio/solana": "^2.2.86",
4661
"@tatumio/tatum": "^1.37.50",
4762
"@tatumio/tatum-kcs": "^2.0.0-alpha.113",
48-
"@tatumio/tron": "^2.2.72",
49-
"@tatumio/xlm": "^2.2.72",
50-
"@tatumio/xrp": "^2.2.72",
63+
"@tatumio/tron": "^2.2.86",
64+
"@tatumio/xlm": "^2.2.86",
65+
"@tatumio/xrp": "^2.2.86",
5166
"agentkeepalive": "^4.5.0",
67+
"axios": "^1.7.9",
5268
"crypto-js": "^4.2.0",
53-
"dotenv": "^16.3.1",
69+
"dotenv": "^16.4.7",
5470
"lodash": "^4.17.21",
55-
"meow": "^7.0.1",
71+
"meow": "^13.2.0",
5672
"readline-sync": "^1.4.10",
57-
"reflect-metadata": "^0.1.13",
58-
"semver": "^7.5.4",
59-
"uuid": "^9.0.1"
73+
"semver": "^7.6.3",
74+
"uuid": "^11.0.4"
6075
},
6176
"devDependencies": {
77+
"@types/jest": "^29.5.14",
78+
"@types/node": "^22.7.5",
6279
"@types/readline-sync": "^1.4.7",
63-
"@types/semver": "^7.5.5",
64-
"@typescript-eslint/eslint-plugin": "^6.10.0",
65-
"@typescript-eslint/parser": "^6.10.0",
66-
"eslint": "^8.53.0",
67-
"rimraf": "^5.0.5",
68-
"typescript": "^5.2.2"
80+
"@types/semver": "^7.5.8",
81+
"@typescript-eslint/eslint-plugin": "8.19.0",
82+
"@typescript-eslint/parser": "8.19.0",
83+
"eslint": "^9.12.0",
84+
"jest": "^29.7.0",
85+
"jest-ctrf-json-reporter": "^0.0.9",
86+
"ts-jest": "^29.2.5",
87+
"tsup": "^8.3.5",
88+
"typescript": "^5.6.3",
89+
"typescript-eslint": "^8.15.0"
6990
}
7091
}

0 commit comments

Comments
 (0)