Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: support for testnet5 #121

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions public/resource/chains.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[
{
"name": "Testnet 4",
"chainId": "test4",
"apiUrl": "https://test4.api.onbloc.xyz/v1",
"rpcUrl": "https://rpc.test4.gno.land:443",
"indexerUrl": "https://test4.indexer.onbloc.xyz"
"name": "Testnet 5",
"chainId": "test5",
"apiUrl": "https://test5.api.onbloc.xyz/v1",
"rpcUrl": "https://rpc.test5.gno.land:443",
jinoosss marked this conversation as resolved.
Show resolved Hide resolved
"indexerUrl": "https://test5.indexer.onbloc.xyz"
},
{
"name": "Portal Loop",
Expand Down
10 changes: 10 additions & 0 deletions src/common/values/constant-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,13 @@ export const RPC_URI = process.env.NEXT_PUBLIC_RPC_URI ?? '';
export const GA_TRACKING_ID = process.env.NEXT_PUBLIC_GA_TRACKING_ID ?? '';

export const DAY_TIME = 86_400_000 as const; // Day time: 24 * 60 * 60 * 1000

export enum ChainType {
TESTNET5 = 'test5',
TESTNET4 = 'test4',
jinoosss marked this conversation as resolved.
Show resolved Hide resolved
PORTAL_LOOP = 'portal-loop',
}

export const TESTNET5_CHAIN_ID = 'test5';
export const TESTNET4_CHAIN_ID = 'test4';
export const PORTAL_LOOP_CHAIN_ID = 'portal-loop';
9 changes: 5 additions & 4 deletions src/repositories/chain-repository/chain-repository.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {NodeRPCClient} from '@/common/clients/node-client';
import {IChainRepository, TokenSupplyInfo, ValidatorInfo} from './types';

import {ChainType} from '@/common/values/constant-value';
import ValidatorPortalLoopData from '../../assets/meta/portal-loop/validators.json';
import ValidatorTest4Data from '../../assets/meta/test4/validators.json';
import ValidatorTest5Data from '../../assets/meta/test5/validators.json';

export class ChainRepository implements IChainRepository {
constructor(private nodeRPCClient: NodeRPCClient | null) {}
Expand All @@ -26,11 +27,11 @@ export class ChainRepository implements IChainRepository {
}

async getValidatorInfos(chainId: string): Promise<ValidatorInfo[]> {
if (chainId === 'portal-loop') {
if (chainId === ChainType.PORTAL_LOOP) {
return ValidatorPortalLoopData;
}
if (chainId === 'test4') {
return ValidatorTest4Data;
if (chainId === ChainType.TESTNET5) {
return ValidatorTest5Data;
}
return [];
}
Expand Down