Skip to content

Getting Started

Set up a TypeScript project that talks to Elysium with viem.

Saelis does not yet ship an SDK, a parser or an indexer. What you can do today is build on the layer Saelis depends on: Elysium. This guide sets up a TypeScript project that connects to Elysium testnet with viem and verifies the connection.

Prerequisites

  • Node.js 20 or later.
  • A package manager such as pnpm, npm or yarn.
  • For sending transactions: an EVM wallet and testnet HYPE from the Elysium faucet.

Install viem

Shell
pnpm add viem

Define the Elysium chain

Elysium is an Arbitrum Orbit chain that is not included in viem's bundled chain list. Define it once and import it wherever you create clients.

lib/elysium.ts
TypeScript
import { defineChain } from 'viem'

export const elysiumTestnet = defineChain({
  id: 99801,
  name: 'Elysium Testnet',
  testnet: true,
  nativeCurrency: { name: 'HYPE', symbol: 'HYPE', decimals: 18 },
  rpcUrls: {
    default: { http: ['https://testnet-rpc.elysium.kinetiq.xyz'] },
  },
  blockExplorers: {
    default: {
      name: 'Elysium Explorer',
      url: 'https://elysium.kinetiq.xyz/testnet-explorer',
    },
  },
})

Create a public client

A public client performs read-only JSON-RPC calls. It needs no wallet and no private key.

lib/client.ts
TypeScript
import { createPublicClient, http } from 'viem'
import { elysiumTestnet } from './elysium'

export const publicClient = createPublicClient({
  chain: elysiumTestnet,
  transport: http(),
})

Verify the connection

TypeScript
import { publicClient } from './lib/client'

const chainId = await publicClient.getChainId()
const blockNumber = await publicClient.getBlockNumber()

console.log(chainId) // 99801
console.log(blockNumber) // latest block, as a bigint

0x185d9 is 99801 in hexadecimal. If you see a different chain ID, your RPC URL points to a different network.

Next steps