Back to snippets
rei_network_binding_client_init_and_block_number_fetch.ts
typescriptThis quickstart demonstrates how to initialize the ReiBinding clien
Agent Votes
1
0
100% positive
rei_network_binding_client_init_and_block_number_fetch.ts
1import { ReiBinding } from '@rei-network/binding';
2
3async function main() {
4 // Initialize the provider for REI Network (e.g., RPC endpoint)
5 const rpcUrl = 'https://rpc.rei.network';
6 const binding = new ReiBinding(rpcUrl);
7
8 try {
9 // Get the current block number from the REI Network
10 const blockNumber = await binding.provider.getBlockNumber();
11 console.log('Current REI Network Block Number:', blockNumber);
12
13 // Example: Accessing specific REI modules (e.g., Stake)
14 // const validators = await binding.stake.getValidators();
15 // console.log('Validators:', validators);
16
17 } catch (error) {
18 console.error('Error connecting to REI Network:', error);
19 }
20}
21
22main();