-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtest-mega.js
More file actions
31 lines (26 loc) · 1022 Bytes
/
Copy pathtest-mega.js
File metadata and controls
31 lines (26 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { EthersService } from './build/src/services/ethersService.js';
async function testMegaProvider() {
const ethersService = new EthersService();
try {
console.log('Testing with provider name "MEGA Testnet"');
const blockNumber1 = await ethersService.getBlockNumber("MEGA Testnet");
console.log(`Block number: ${blockNumber1}`);
} catch (error) {
console.error('Error with provider name:', error);
}
try {
console.log('\nTesting with provider alias "mega"');
const blockNumber2 = await ethersService.getBlockNumber("mega");
console.log(`Block number: ${blockNumber2}`);
} catch (error) {
console.error('Error with provider alias:', error);
}
try {
console.log('\nTesting with direct RPC URL');
const blockNumber3 = await ethersService.getBlockNumber("https://carrot.megaeth.com/rpc");
console.log(`Block number: ${blockNumber3}`);
} catch (error) {
console.error('Error with RPC URL:', error);
}
}
testMegaProvider().catch(console.error);