Skip to content

Commit c5dacae

Browse files
authored
feat(entropy-tester): accept custom endpoint (#2814)
* feat(entropy-tester): accept custom endpoint
1 parent c0666aa commit c5dacae

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

apps/entropy-tester/config.sample.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
},
1010
{
1111
"chain-id": "blast",
12-
"interval": "10m"
12+
"interval": "10m",
13+
"rpc-endpoint": "https://rpc.blast.io"
1314
}
1415
]

apps/entropy-tester/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/entropy-tester",
3-
"version": "1.0.2",
3+
"version": "1.1.0",
44
"description": "Utility to test entropy provider callbacks",
55
"private": true,
66
"type": "module",

apps/entropy-tester/src/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import fs from "node:fs/promises";
22

33
import type { PrivateKey } from "@pythnetwork/contract-manager/core/base";
44
import { toPrivateKey } from "@pythnetwork/contract-manager/core/base";
5+
import { EvmChain } from "@pythnetwork/contract-manager/core/chains";
56
import { EvmEntropyContract } from "@pythnetwork/contract-manager/core/contracts/evm";
67
import { DefaultStore } from "@pythnetwork/contract-manager/node/store";
78
import type { Logger } from "pino";
@@ -44,6 +45,7 @@ async function loadConfig(configPath: string): Promise<LoadedConfig[]> {
4445
z.strictObject({
4546
"chain-id": z.string(),
4647
interval: z.string(),
48+
"rpc-endpoint": z.string().optional(),
4749
}),
4850
);
4951
const configContent = (await import(configPath, {
@@ -66,6 +68,16 @@ async function loadConfig(configPath: string): Promise<LoadedConfig[]> {
6668
`Multiple contracts found for chain ${config["chain-id"]}, check contract manager store.`,
6769
);
6870
}
71+
if (config["rpc-endpoint"]) {
72+
const evmChain = firstContract.chain;
73+
firstContract.chain = new EvmChain(
74+
evmChain.getId(),
75+
evmChain.isMainnet(),
76+
evmChain.getNativeToken(),
77+
config["rpc-endpoint"],
78+
evmChain.networkId,
79+
);
80+
}
6981
return { contract: firstContract, interval };
7082
});
7183
return loadedConfigs;

contract_manager/src/core/chains.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,8 @@ export class EvmChain extends Chain {
429429
id: string,
430430
mainnet: boolean,
431431
nativeToken: TokenId | undefined,
432-
private rpcUrl: string,
433-
private networkId: number,
432+
public rpcUrl: string,
433+
public networkId: number,
434434
) {
435435
// On EVM networks we use the chain id as the wormhole chain name
436436
super(id, mainnet, id, nativeToken);

0 commit comments

Comments
 (0)