How to Add a Chain
This guide shows you how to add or change blockchain networks in your BetSwirl casino app.
Supported Networks
BetSwirl SDK supports multiple EVM-compatible networks. To see the current list of supported networks, check the casinoChainById object in the SDK source code.
How to Add a Chain
React
1. Import the chain from wagmi
In src/main.tsx:
import { base, polygon, arbitrum, bsc } from 'wagmi/chains'2. Add the chain to your config
// Add RPC env variable at the top
const baseRpc = import.meta.env.VITE_BASE_RPC_URL
const polygonRpc = import.meta.env.VITE_POLYGON_RPC_URL
const arbitrumRpc = import.meta.env.VITE_ARBITRUM_RPC_URL
const bscRpc = import.meta.env.VITE_BSC_RPC_URL
const config = createConfig({
chains: [base, polygon, arbitrum, bsc],
transports: {
[base.id]: baseRpc ? http(baseRpc) : http(),
[polygon.id]: polygonRpc ? http(polygonRpc) : http(),
[arbitrum.id]: arbitrumRpc ? http(arbitrumRpc) : http(),
[bsc.id]: bscRpc ? http(bscRpc) : http(),
},
})3. Update BetSwirlSDKProvider
<BetSwirlSDKProvider
initialChainId={base.id}
supportedChains={[base.id, polygon.id, arbitrum.id, bsc.id]}
// ...
>4. (Optional) Add custom RPC URL to .env
VITE_BSC_RPC_URL=https://bsc-mainnet.g.alchemy.com/v2/your-api-keyLast updated on