Skip to content

Commit 6ff24f2

Browse files
authored
Merge pull request #3125 from humanprotocol/develop
Release 2025-03-07
2 parents ce7bb09 + fe3962e commit 6ff24f2

318 files changed

Lines changed: 6408 additions & 5839 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci-test-job-launcher.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@ on:
1212
workflow_dispatch:
1313

1414
jobs:
15-
job-launcher-client-test:
16-
name: Job Launcher Client Test
17-
runs-on: ubuntu-latest
18-
steps:
19-
- uses: actions/checkout@v4
20-
- uses: actions/setup-node@v4
21-
with:
22-
node-version-file: .nvmrc
23-
- run: npm install --global yarn && yarn
24-
name: Install dependencies
25-
- run: yarn workspace @human-protocol/job-launcher-client test
26-
name: Run Job Launcher Client test
2715
job-launcher-server-test:
2816
name: Job Launcher Server Test
2917
runs-on: ubuntu-latest

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"repository": "https://github.com/humanprotocol/human-protocol",
77
"license": "MIT",
88
"scripts": {
9-
"test": "concurrently \"yarn workspace @human-protocol/core test\" \"yarn workspace @human-protocol/sdk test\" \"yarn workspace @human-protocol/subgraph test\" \"yarn workspace @human-protocol/faucet-server test\" \"yarn workspace @human-protocol/job-launcher-server test\" \"yarn workspace @human-protocol/job-launcher-client test\" \"yarn workspace @human-protocol/human-app-frontend test\" \"yarn workspace @human-protocol/human-app-server test\" \"yarn workspace @human-protocol/reputation-oracle test\" \"yarn workspace @human-protocol/fortune-exchange-oracle-server test\" \"yarn workspace @human-protocol/fortune-recording-oracle test\"",
10-
"lint": "concurrently \"yarn workspace @human-protocol/core lint\" \"yarn workspace @human-protocol/sdk lint\" \"yarn workspace @human-protocol/subgraph lint\" \"yarn workspace @human-protocol/faucet-client lint\" \"yarn workspace @human-protocol/faucet-server lint\" \"yarn workspace @human-protocol/job-launcher-server lint\" \"yarn workspace @human-protocol/job-launcher-client lint\" \"yarn workspace @human-protocol/human-app-frontend lint\" \"yarn workspace @human-protocol/human-app-server lint\" \"yarn workspace @human-protocol/reputation-oracle lint\" \"yarn workspace @human-protocol/fortune-exchange-oracle-server lint\" \"yarn workspace @human-protocol/fortune-recording-oracle lint\" \"yarn workspace @human-protocol/dashboard-client lint\"",
9+
"test": "concurrently \"yarn workspace @human-protocol/core test\" \"yarn workspace @human-protocol/sdk test\" \"yarn workspace @human-protocol/subgraph test\" \"yarn workspace @human-protocol/faucet-server test\" \"yarn workspace @human-protocol/job-launcher-server test\" \"yarn workspace @human-protocol/human-app-frontend test\" \"yarn workspace @human-protocol/human-app-server test\" \"yarn workspace @human-protocol/reputation-oracle test\" \"yarn workspace @human-protocol/fortune-exchange-oracle-server test\" \"yarn workspace @human-protocol/fortune-recording-oracle test\"",
10+
"lint": "concurrently \"yarn workspace @human-protocol/core lint\" \"yarn workspace @human-protocol/sdk lint\" \"yarn workspace @human-protocol/subgraph lint\" \"yarn workspace @human-protocol/faucet-client lint\" \"yarn workspace @human-protocol/faucet-server lint\" \"yarn workspace @human-protocol/job-launcher-server lint\" \"yarn workspace @human-protocol/job-launcher-client lint\" \"yarn workspace @human-protocol/human-app-frontend lint\" \"yarn workspace @human-protocol/human-app-server lint\" \"yarn workspace @human-protocol/reputation-oracle lint\" \"yarn workspace @human-protocol/fortune-exchange-oracle-server lint\" \"yarn workspace @human-protocol/fortune-recording-oracle lint\" \"yarn workspace @human-protocol/dashboard-client lint\" \"yarn workspace @human-protocol/staking-dashboard-client lint\"",
1111
"prepare": "husky",
1212
"postinstall": "yarn workspace @human-protocol/sdk build"
1313
},

packages/apps/dashboard/client/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"type": "module",
88
"scripts": {
99
"start": "vite",
10-
"test": "vitest -u",
1110
"build": "tsc && vite build",
1211
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
1312
"preview": "vite preview",
@@ -17,7 +16,7 @@
1716
"@emotion/react": "^11.11.4",
1817
"@emotion/styled": "^11.11.5",
1918
"@human-protocol/sdk": "*",
20-
"@mui/icons-material": "^6.2.0",
19+
"@mui/icons-material": "^6.4.6",
2120
"@mui/material": "^5.15.18",
2221
"@mui/styled-engine-sc": "6.4.0",
2322
"@mui/x-data-grid": "^7.23.2",
@@ -54,7 +53,7 @@
5453
"sass": "^1.85.0",
5554
"stylelint-prettier": "^5.0.0",
5655
"typescript": "^5.6.3",
57-
"vite": "^5.4.7",
56+
"vite": "^6.2.0",
5857
"vite-plugin-svgr": "^4.2.0"
5958
}
6059
}

packages/apps/dashboard/server/.env.example

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,3 @@ S3_BUCKET=
3434
#Web3
3535
WEB3_ENV=
3636
RPC_URL_POLYGON=
37-
38-
# e2e testing
39-
E2E_TESTING_EMAIL_ADDRESS=

packages/apps/dashboard/server/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ $ yarn run start:prod
5151
# unit tests
5252
$ yarn run test
5353

54-
# e2e tests
55-
$ yarn run test:e2e
56-
5754
# test coverage
5855
$ yarn run test:cov
5956
```

packages/apps/dashboard/server/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
"test": "jest",
1717
"test:watch": "jest --watch",
1818
"test:cov": "jest --coverage",
19-
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
20-
"test:e2e": "jest --config ./test/jest-e2e.json"
19+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand"
2120
},
2221
"dependencies": {
2322
"@human-protocol/sdk": "*",

packages/apps/dashboard/server/src/common/config/env-config.service.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const DEFAULT_CORS_ALLOWED_ORIGIN = 'http://localhost:3001';
55
const DEFAULT_CORS_ALLOWED_HEADERS = 'Content-Type, Accept';
66

77
const DEFAULT_HMT_PRICE_SOURCE =
8-
'https://api.coingecko.com/api/v3/simple/price?ids=human-protocol&vs_currencies=usd';
8+
'https://api.coinlore.net/api/ticker/?id=53887';
99
const DEFAULT_HMT_PRICE_FROM = 'human-protocol';
1010
const DEFAULT_HMT_PRICE_TO = 'usd';
1111
const DEFAULT_HCAPTCHA_STATS_SOURCE =
@@ -53,8 +53,10 @@ export class EnvironmentConfigService {
5353
DEFAULT_HMT_PRICE_SOURCE,
5454
);
5555
}
56-
get hmtPriceSourceApiKey(): string {
57-
return this.configService.getOrThrow<string>('HMT_PRICE_SOURCE_API_KEY');
56+
get hmtPriceSourceApiKey(): string | undefined {
57+
return this.configService.get<string | undefined>(
58+
'HMT_PRICE_SOURCE_API_KEY',
59+
);
5860
}
5961
get hmtPriceFromKey(): string {
6062
return this.configService.get<string>(

packages/apps/dashboard/server/src/common/config/test-environment-config.service.ts

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

packages/apps/dashboard/server/src/modules/stats/stats.service.ts

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -321,22 +321,46 @@ export class StatsService implements OnModuleInit {
321321
return cachedHmtPrice;
322322
}
323323

324+
const headers = this.envConfigService.hmtPriceSourceApiKey
325+
? { 'x-cg-demo-api-key': this.envConfigService.hmtPriceSourceApiKey }
326+
: {};
327+
324328
const { data } = await lastValueFrom(
325-
this.httpService.get(this.envConfigService.hmtPriceSource, {
326-
headers: {
327-
'x-cg-demo-api-key': this.envConfigService.hmtPriceSourceApiKey,
328-
},
329-
}),
329+
this.httpService.get(this.envConfigService.hmtPriceSource, { headers }),
330330
);
331-
const hmtPrice =
332-
data[this.envConfigService.hmtPriceFromKey][
333-
this.envConfigService.hmtPriceToKey
334-
];
331+
332+
let hmtPrice: number;
333+
334+
if (this.envConfigService.hmtPriceSource.includes('coingecko')) {
335+
if (
336+
!data ||
337+
!data[this.envConfigService.hmtPriceFromKey] ||
338+
!data[this.envConfigService.hmtPriceFromKey][
339+
this.envConfigService.hmtPriceToKey
340+
]
341+
) {
342+
throw new Error('Failed to fetch HMT price from CoinGecko API');
343+
}
344+
hmtPrice = parseFloat(
345+
data[this.envConfigService.hmtPriceFromKey][
346+
this.envConfigService.hmtPriceToKey
347+
],
348+
);
349+
} else if (this.envConfigService.hmtPriceSource.includes('coinlore')) {
350+
if (!data || !data[0] || !data[0].price_usd || data[0].symbol !== 'HMT') {
351+
throw new Error('Failed to fetch HMT price from Coinlore API');
352+
}
353+
hmtPrice = parseFloat(data[0].price_usd);
354+
} else {
355+
throw new Error('Unsupported HMT price source');
356+
}
357+
335358
await this.cacheManager.set(
336359
this.redisConfigService.hmtPriceCacheKey,
337360
hmtPrice,
338361
this.redisConfigService.cacheHmtPriceTTL,
339362
);
363+
340364
return hmtPrice;
341365
}
342366

packages/apps/dashboard/server/test/app.e2e-spec.ts

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

0 commit comments

Comments
 (0)