Skip to Content
On this page

This guide shows you how to choose the networks your app offers and how to move a connected wallet between them. Without a chains setting, the SDK offers its own default networks, which don’t include DogeOS Chikyū; About Wallet Connections explains chain families.

Connect to DogeOS Chikyū Testnet#

  1. Save the network definition in chains.ts:

    import type { Chain } from "@dogeos/dogeos-sdk" export const dogeOSChikyuTestnet = { id: 6281971, name: "DogeOS Chikyū Testnet", nativeCurrency: { name: "DOGE", symbol: "DOGE", decimals: 18 }, rpcUrls: { default: { http: ["https://rpc.testnet.dogeos.com/"] } }, blockExplorers: { default: { name: "DogeOS L2Scan", url: "https://dogeos-testnet.l2scan.co", }, }, testnet: true, } satisfies Chain
  2. Pass it under chains.evm, and make EVM the default chain family:

    import { ChainTypeEnum, type WalletConnectKitConfig } from "@dogeos/dogeos-sdk" import { dogeOSChikyuTestnet } from "./chains" export const dogeConfig: WalletConnectKitConfig = { clientId: "YOUR_DOGEOS_CLIENT_ID", defaultConnectChain: ChainTypeEnum.EVM, chains: { evm: [dogeOSChikyuTestnet] }, }

The SDK now offers only the networks you list. If you also use Wagmi, configure the same chain there; see Use the SDK With Wagmi.

Add Solana and Dogecoin#

If your app also supports Solana or Dogecoin wallets, get their network entries from getChains() instead of writing them yourself, so they match what those wallets expect. Load them before you mount the provider:

import { ChainTypeEnum, getChains, type WalletConnectKitConfig } from "@dogeos/dogeos-sdk" import { dogeOSChikyuTestnet } from "./chains" export async function createDogeConfig(): Promise<WalletConnectKitConfig> { const { solana, dogecoin } = await getChains() if (!solana?.length || !dogecoin?.length) { throw new Error("Required wallet networks are unavailable") } return { clientId: "YOUR_DOGEOS_CLIENT_ID", defaultConnectChain: ChainTypeEnum.EVM, chains: { evm: [dogeOSChikyuTestnet], solana, dogecoin }, } }

getChains() fetches the list over the network, so it can fail. If it rejects, show a retry option instead of mounting the provider.

Switch the Connected Wallet to Chikyū#

Call switchChain() from useAccount() with the same network definition:

"use client" import { ChainTypeEnum, isWalletError, useAccount, WalletErrorCode } from "@dogeos/dogeos-sdk" import { dogeOSChikyuTestnet } from "./chains" export function SwitchNetworkButton() { const { switchChain } = useAccount() async function onSwitch() { try { await switchChain({ chainType: ChainTypeEnum.EVM, chainInfo: dogeOSChikyuTestnet, }) } catch (error) { // 4001 in a browser, -1 inside MyDoge: the user cancelled. if (isWalletError(error, WalletErrorCode.UserRejected) || (isWalletError(error) && error.code === -1)) return throw error } } return ( <button type="button" onClick={onSwitch}> Switch to DogeOS Chikyū </button> ) }

If the wallet doesn’t know the network yet, the SDK asks it to add the network. The user can reject either request; see Handle Wallet Errors.