Skip to content

Commit 897efd1

Browse files
committed
Merge branch 'develop' into feat/staking-requirement
2 parents 7f3ba72 + 2460c29 commit 897efd1

39 files changed

Lines changed: 231 additions & 157 deletions

File tree

‎.changeset/eleven-clubs-itch.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@human-protocol/sdk": patch
3+
---
4+
5+
Change contract visibility from private to public in EscrowClient and KVStoreClient

‎.changeset/hot-animals-trade.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@human-protocol/sdk": patch
3+
---
4+
5+
Update LEADER_FRAGMENT to include address field in reputationNetworks

‎.changeset/swift-impalas-scream.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@human-protocol/logger": patch
3+
---
4+
5+
Fixed nest/common peer dep version range

‎packages/apps/dashboard/client/src/features/searchResults/api/useKvStoreData.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const useKvstoreData = (chainId: number, address: string) => {
1212
queryFn: async () => {
1313
const { data } = await httpClient.get(
1414
`${apiPaths.kvstore.path}/${address}`,
15-
{ params: { chain_id: chainId || -1 } }
15+
{ params: { chainId: chainId || -1 } }
1616
);
1717

1818
const validResponse = validateResponse(data, kvstoreDataSchema);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ S3_BUCKET=dashboard-hcaptcha-historical-stats
2222
S3_USE_SSL=false
2323

2424
# Web3
25-
WEB3_ENV=testnet
2625
RPC_URL_POLYGON=https://rpc-amoy.polygon.technology
2726
RPC_URL_BSC_TESTNET=https://bsc-testnet.drpc.org
2827
RPC_URL_SEPOLIA=https://rpc.sepolia.org

‎packages/apps/dashboard/server/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"test": "jest",
1818
"test:watch": "jest --watch",
1919
"test:cov": "jest --coverage",
20-
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand"
20+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
21+
"typecheck": "tsc --noEmit"
2122
},
2223
"dependencies": {
2324
"@human-protocol/core": "workspace:*",

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

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import { ChainId } from '@human-protocol/sdk';
21
import { Injectable } from '@nestjs/common';
32
import { ConfigService } from '@nestjs/config';
4-
import { Web3Env } from '../enums/web3';
3+
54
import {
6-
LOCALHOST_CHAIN_IDS,
7-
MAINNET_CHAIN_IDS,
8-
TESTNET_CHAIN_IDS,
9-
} from '../utils/constants';
5+
DevelopmentChainId,
6+
ProductionChainId,
7+
ChainIds,
8+
type ChainId,
9+
} from '../constants';
1010

1111
export interface TokensList {
1212
[key: string]: string | undefined;
1313
}
1414
export interface NetworkDto {
15-
chainId: number;
15+
chainId: ChainId;
1616
rpcUrl?: string;
1717
}
1818

@@ -28,65 +28,53 @@ export class NetworkConfigService {
2828
this.networkMap = {
2929
...(this.configService.get<string>('RPC_URL_ETHEREUM') && {
3030
ethereum: {
31-
chainId: ChainId.MAINNET,
31+
chainId: ProductionChainId.ETHEREUM,
3232
rpcUrl: this.configService.get<string>('RPC_URL_ETHEREUM'),
3333
},
3434
}),
3535
...(this.configService.get<string>('RPC_URL_SEPOLIA') && {
3636
sepolia: {
37-
chainId: ChainId.SEPOLIA,
37+
chainId: DevelopmentChainId.SEPOLIA,
3838
rpcUrl: this.configService.get<string>('RPC_URL_SEPOLIA'),
3939
},
4040
}),
4141
...(this.configService.get<string>('RPC_URL_POLYGON') && {
4242
polygon: {
43-
chainId: ChainId.POLYGON,
43+
chainId: ProductionChainId.POLYGON_MAINNET,
4444
rpcUrl: this.configService.get<string>('RPC_URL_POLYGON'),
4545
},
4646
}),
4747
...(this.configService.get<string>('RPC_URL_POLYGON_AMOY') && {
4848
amoy: {
49-
chainId: ChainId.POLYGON_AMOY,
49+
chainId: DevelopmentChainId.POLYGON_AMOY,
5050
rpcUrl: this.configService.get<string>('RPC_URL_POLYGON_AMOY'),
5151
},
5252
}),
5353
...(this.configService.get<string>('RPC_URL_BSC_MAINNET') && {
5454
bsc: {
55-
chainId: ChainId.BSC_MAINNET,
55+
chainId: ProductionChainId.BSC_MAINNET,
5656
rpcUrl: this.configService.get<string>('RPC_URL_BSC_MAINNET'),
5757
},
5858
}),
5959
...(this.configService.get<string>('RPC_URL_BSC_TESTNET') && {
6060
bsctest: {
61-
chainId: ChainId.BSC_TESTNET,
61+
chainId: DevelopmentChainId.BSC_TESTNET,
6262
rpcUrl: this.configService.get<string>('RPC_URL_BSC_TESTNET'),
6363
},
6464
}),
6565
...(this.configService.get<string>('RPC_URL_LOCALHOST') && {
6666
localhost: {
67-
chainId: ChainId.LOCALHOST,
67+
chainId: DevelopmentChainId.LOCALHOST,
6868
rpcUrl: this.configService.get<string>('RPC_URL_LOCALHOST'),
6969
},
7070
}),
7171
};
72-
const validChainIds = (() => {
73-
switch (this.configService.get<string>('WEB3_ENV')) {
74-
case Web3Env.MAINNET:
75-
return MAINNET_CHAIN_IDS;
76-
case Web3Env.LOCALHOST:
77-
return LOCALHOST_CHAIN_IDS;
78-
default:
79-
return TESTNET_CHAIN_IDS;
80-
}
81-
})();
8272

8373
// Remove networks without RPC URLs
8474
this.networkMap = Object.keys(this.networkMap)
8575
.filter((network) => {
8676
const networkConfig = this.networkMap[network];
87-
return (
88-
networkConfig.rpcUrl && validChainIds.includes(networkConfig.chainId)
89-
);
77+
return networkConfig.rpcUrl && ChainIds.includes(networkConfig.chainId);
9078
})
9179
.reduce((newNetworkMap: NetworkMapDto, network) => {
9280
newNetworkMap[network] = this.networkMap[network];
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { ChainId as SdkChainId } from '@human-protocol/sdk';
2+
3+
import Environment from '../utils/environment';
4+
5+
export const ProductionChainId = {
6+
POLYGON_MAINNET: SdkChainId.POLYGON,
7+
BSC_MAINNET: SdkChainId.BSC_MAINNET,
8+
ETHEREUM: SdkChainId.MAINNET,
9+
} as const satisfies Record<string, SdkChainId>;
10+
11+
type ProductionChainId =
12+
(typeof ProductionChainId)[keyof typeof ProductionChainId];
13+
14+
export const DevelopmentChainId = {
15+
POLYGON_AMOY: SdkChainId.POLYGON_AMOY,
16+
BSC_TESTNET: SdkChainId.BSC_TESTNET,
17+
SEPOLIA: SdkChainId.SEPOLIA,
18+
LOCALHOST: SdkChainId.LOCALHOST,
19+
} as const satisfies Record<string, SdkChainId>;
20+
21+
type DevelopmentChainId =
22+
(typeof DevelopmentChainId)[keyof typeof DevelopmentChainId];
23+
24+
export const ChainIds = Object.values(
25+
Environment.isProduction() ? ProductionChainId : DevelopmentChainId,
26+
).filter((value): value is ChainId => typeof value === 'number');
27+
28+
export type ChainId = ProductionChainId | DevelopmentChainId;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './chains';
2+
export * from './operator';

‎packages/apps/dashboard/server/src/common/enums/web3.ts‎

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

0 commit comments

Comments
 (0)