Update Your Frontend / dApp Integration
Your game client needs to be updated to connect to the Wall Street Chain network and interact with your newly deployed contracts.
Update Network Configuration
In your frontend's code (e.g., in your constants or environment variables file), update the RPC URL and Chain ID.
JavaScript
// Example frontend configuration
export const WSC_MAINNET_CONFIG = {
chainId: '0x000', // TBA
chainName: 'Wall Street Chain',
nativeCurrency: {
name: 'WSC',
symbol: 'WSC',
decimals: 18,
},
rpcUrls: ['https://test.rpc'],
blockExplorerUrls: ['TBA'],
};Update Contract Addresses
Replace the old contract addresses from your previous chain with the new addresses you received after deploying on Wall Street Chain.
Add a "Switch Network" Feature for Players
For the best user experience, add a button that programmatically prompts users to add and switch to the Wall Street Chain network in their MetaMask.
JavaScript
// Function to add/switch to WSC Mainnet
async function switchToWSC() {
try {
await window.ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: '0x000' }], // TBA
});
} catch (switchError) {
// This error code indicates that the chain has not been added to MetaMask.
if (switchError.code === 4902) {
try {
await window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [WSC_MAINNET_CONFIG],
});
} catch (addError) {
console.error("Failed to add Wall Street Chain network:", addError);
}
}
}
}Last updated