Hello Im a bit confused about this error and what im doing wrong, here is my code
const { Connection, clusterApiUrl } = require('@solana/web3.js');
const connection = new Connection(clusterApiUrl('mainnet-beta'), 'confirmed');
//below is for getblock
GetBlockConfig: {
commitment: 'finalized';
rewards: false;
transactionDetails: "full";
}
//below is for get transactions
GetVersionedBlockConfig: {
commitment: 'finalized';
maxSupportedTransactionVersion: 0;
rewards: false;
transactionDetails: "full";
}
async function fetchCurrentSlot() {
const currentSlot = await connection.getSlot();
console.log('Current slot:', currentSlot);
return currentSlot;
}
async function fetchBlock() {
try {
const currentSlot = await fetchCurrentSlot();
const block = await connection.getBlock(currentSlot, GetBlockConfig);
console.log(block);
} catch (error) {
console.error("Error fetching block:", error);
}
}
fetchBlock();
and this is the error im getting
Current slot: 265806271
Error fetching block: ReferenceError: GetBlockConfig is not defined
at fetchBlock (C:\Users\user\OneDrive\Desktop\Solana sniper\solana.js:30:60)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Im confused as to why its not defined, the formatting seems to be right comparing it to the docs so im not sure. I would appreciate some help on this.
Thanks and have a nice day!