Skip to content

Commit

Permalink
chore: support for testnet5 (#121)
Browse files Browse the repository at this point in the history
* chore: support for testnet5

* chore: update testnet5 rpc url

* chore: remove testnet4 chain type
  • Loading branch information
jinoosss authored Nov 19, 2024
1 parent 939f108 commit 39dca4e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
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://test5.onbloc.xyz:443",
"indexerUrl": "https://test5.indexer.onbloc.xyz"
},
{
"name": "Portal Loop",
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions src/common/values/constant-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@ 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',
PORTAL_LOOP = 'portal-loop',
}

export const TESTNET5_CHAIN_ID = 'test5';
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

0 comments on commit 39dca4e

Please sign in to comment.