Skip to content

Commit

Permalink
Merge pull request #175 from HathorNetwork/master
Browse files Browse the repository at this point in the history
Release candidate v1.6.2
  • Loading branch information
andreabadesso authored Jun 13, 2024
2 parents 875ec36 + 6ac186c commit 96d8167
Show file tree
Hide file tree
Showing 63 changed files with 3,270 additions and 3,966 deletions.
3 changes: 2 additions & 1 deletion .codebuild/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:
CONFIRM_FIRST_ADDRESS: true
VOIDED_TX_OFFSET: 20
TX_HISTORY_MAX_COUNT: 50
CREATE_NFT_MAX_RETRIES: 3
dev_DEFAULT_SERVER: "https://wallet-service.private-nodes.testnet.hathor.network/v1a/"
dev_WS_DOMAIN: "ws.dev.wallet-service.testnet.hathor.network"
dev_NETWORK: "testnet"
Expand Down Expand Up @@ -173,7 +174,7 @@ phases:
commands:
- npm install -g yarn
- corepack enable
- yarn set version stable
- yarn set version 4.1.0
- yarn install
pre_build:
commands:
Expand Down
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
dist/
node_modules/
__tests__/
.git/
.github/
Expand All @@ -8,4 +7,5 @@ flake.*
node_modules/
packages/daemon/dist/
packages/daemon/node_modules/
packages/common/node_modules/
packages/wallet-service
6 changes: 5 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
experimental-features = nix-command flakes
- name: Cache Nix
uses: DeterminateSystems/magic-nix-cache-action@v2

Expand All @@ -59,6 +59,10 @@ jobs:
CI_DB_HOST: 127.0.0.1
CI_DB_PORT: 3306

- name: Run tests on the common modules project
run: |
nix develop . -c yarn workspace @wallet-service/common run test
- name: Run tests on the daemon
run: |
nix develop . -c yarn workspace sync-daemon run test
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ dist
coverage/
packages/daemon/dist
packages/daemon/node_modules
packages/common/node_modules
packages/wallet-service/node_modules
packages/wallet-service/.serverless
packages/wallet-service/.webpack
packages/wallet-service/.env*
packages/wallet-service/.warmup
.yarn/
.env.*
3 changes: 2 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ compressionLevel: mixed

enableGlobalCache: false

nmHoistingLimits: dependencies
# Without this setting, the common package is hoisted in the root node_modules, causing the serverless-monorepo plugin to fail
nmHoistingLimits: workspaces

nodeLinker: node-modules
31 changes: 18 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,37 @@
# arising from the use of this software.
# This software cannot be redistributed unless explicitly agreed in writing with the authors.


# Build phase
FROM node:20-alpine AS builder

WORKDIR /app

RUN apk update && apk add python3 g++ make
RUN apk update && apk add python3 g++ make py3-setuptools

COPY . .

# Use the last stable berry version:
RUN yarn set version stable
RUN corepack enable

# Use the same version as flake's
RUN yarn set version 4.1.0

# This will install dependencies for the sync-daemon, devDependencies included:
RUN yarn workspaces focus sync-daemon
# This will install dependencies for all packages, except for the lambdas since
# they are ignored in .dockerignore
RUN yarn install

RUN yarn workspace sync-daemon build
RUN yarn workspace sync-daemon run build

# This will remove all dependencies and install production deps only:
RUN yarn workspaces focus sync-daemon --production
# This will remove all dev dependencies and install production deps only
RUN yarn workspaces focus -A --production

FROM node:20-alpine
# Run phase
FROM node:20-alpine AS runner

WORKDIR /app

COPY --from=builder /app/packages/daemon/dist .
COPY --from=builder /app/packages/daemon/node_modules ./node_modules
# Copy only the necessary files from the build phase
COPY --from=builder /app .

WORKDIR /app/packages/daemon/

CMD ["node", "index.js"]
CMD ["node", "dist/index.js"]
35 changes: 28 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "hathor-wallet-service",
"version": "1.5.0",
"version": "1.6.2",
"workspaces": [
"packages/common",
"packages/daemon",
"packages/wallet-service"
],
Expand All @@ -11,14 +12,34 @@
"nohoist": [
"**"
],
"repository": "[email protected]:HathorNetwork/hathor-wallet-service-sync_daemon.git",
"repository": "[email protected]:HathorNetwork/hathor-wallet-service.git",
"author": "André Abadesso <[email protected]>",
"private": true,
"devDependencies": {
"dotenv": "^16.3.1",
"mysql2": "^3.6.1",
"sequelize": "^6.33.0",
"sequelize-cli": "^6.6.1"
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.9.0",
"mysql2": "^3.9.3",
"sequelize": "^6.37.2",
"sequelize-cli": "^6.6.2"
},
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"dependencies": {
"@aws-sdk/client-apigatewaymanagementapi": "3.540.0",
"@aws-sdk/client-lambda": "3.540.0",
"@aws-sdk/client-sqs": "3.540.0",
"@hathor/wallet-lib": "0.39.0",
"@wallet-service/common": "1.5.0",
"bip32": "^4.0.0",
"bitcoinjs-lib": "^6.1.5",
"bitcoinjs-message": "^2.2.0",
"jest": "^29.7.0",
"tiny-secp256k1": "^2.2.3",
"winston": "3.13.0"
}
}
1 change: 1 addition & 0 deletions packages/common/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Common utils for the wallet-service
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/* eslint-disable @typescript-eslint/no-empty-function */

import { Context } from 'aws-lambda';
import { Transaction } from '@src/types';
import { Transaction, TxOutput } from '../../src/types';

/**
* A sample transaction for a NFT creation, as obtained by a wallet's history methods
Expand Down Expand Up @@ -149,11 +149,12 @@ export function getTransaction(): Transaction {
spent_by: o.spent_by,
token_data: o.token_data,
locked: false,
})),
})) as TxOutput[],
height: 8,
token_name: nftCreationTx.token_name,
token_symbol: nftCreationTx.token_symbol,
};

return result;
}

Expand Down
9 changes: 9 additions & 0 deletions packages/common/__tests__/utils/alerting.utils.mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const mockedAddAlert = jest.fn();
export default jest.mock('@src/utils/alerting.utils', () => {
const originalModule = jest.requireActual('@src/utils/alerting.utils');

return {
...originalModule,
addAlert: mockedAddAlert.mockReturnValue(Promise.resolve()),
};
});
Loading

0 comments on commit 96d8167

Please sign in to comment.