Before interacting with contracts, your frontend must establish a connection with the user’s wallet (MetaMask, Xeta AI Wallet, etc.) and point to the VSC Mainnet RPC.
VSC Mainnet RPC Details:
https://rpc.vscblockchain.org420042VSGUsers can be prompted to add VSC to their wallet automatically via JavaScript.
async function addVSCNetwork() {
if (window.ethereum) {
try {
await window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [{
chainId: '0x668ca', // Hex value of chainId (example: 12345 -> 0x3039)
chainName: 'Vector Smart Chain',
nativeCurrency: {
name: 'Vector Smart Gas',
symbol: 'VSG',
decimals: 18,
},
rpcUrls: ['<https://rpc.vscblockchain.org>'],
blockExplorerUrls: ['<https://explorer.vscblockchain.org>'],
}],
});
} catch (error) {
console.error("Failed to add VSC:", error);
}
}
}