Wallet Integration

Connect wallets to Elysium with viem and EIP-1193.

ELYVORA discovers wallets via EIP-6963 and falls back to window.ethereum. All chain parameters live in src/config/chains.js.

typescript
import { defineChain, createWalletClient, custom } from "viem";

export const elysium = defineChain({
  id: 99901,
  name: "Elysium",
  nativeCurrency: { name: "HYPE", symbol: "HYPE", decimals: 18 },
  rpcUrls: { default: { http: ["https://rpc.elysium.kinetiq.xyz/"] } },
  blockExplorers: { default: { name: "Elyscan", url: "https://elyscan.live" } },
});

const [account] = await window.ethereum.request({ method: "eth_requestAccounts" });
const wallet = createWalletClient({ account, chain: elysium, transport: custom(window.ethereum) });

Switching / adding the network

typescript
try {
  await provider.request({ method: "wallet_switchEthereumChain", params: [{ chainId: "0x1863d" }] });
} catch (err: any) {
  if (err.code === 4902) {
    await provider.request({
      method: "wallet_addEthereumChain",
      params: [{
        chainId: "0x1863d",
        chainName: "Elysium",
        nativeCurrency: { name: "HYPE", symbol: "HYPE", decimals: 18 },
        rpcUrls: ["https://rpc.elysium.kinetiq.xyz/"],
        blockExplorerUrls: ["https://elyscan.live"],
      }],
    });
  }
}

Wallet sessions

POST /api/auth/nonce returns a message; sign it with personal_sign and POST the signature to /api/auth/verify to receive a bearer token valid for 7 days. Error code 4001 means the user rejected the request.