Quickstart

Get started building with the Klever JavaScript SDK — a unified interface for sending transactions, reading blockchain state, and integrating Klever Wallet into your applications.

Installation

npm install @klever/connect

Node.js

For backend services, CLI tools, scripts, and server-side signing. Uses a private key or PEM file directly — no browser extension required.

import { KleverProvider, NodeWallet, parseKLV } from '@klever/connect'

const provider = new KleverProvider('mainnet')
const wallet = new NodeWallet(provider, process.env.PRIVATE_KEY)

await wallet.connect()

const result = await wallet.transfer({
  receiver: 'klv1receiver...',
  amount: parseKLV('10'),
})
console.log('Transaction hash:', result.hash)

Node.js guide


Web App

For React dApps and browser-based integrations. Connects to the Klever Extension wallet or mobile wallet, with ready-to-use React hooks.

import { KleverProvider, useKlever, useTransaction } from '@klever/connect'
import { parseKLV } from '@klever/connect-core'

function App() {
  const { connect, isConnected, address } = useKlever()
  const { sendKLV, isLoading } = useTransaction()

  const handleSend = async () => {
    const result = await sendKLV('klv1receiver...', String(parseKLV('10')))
    console.log('Transaction hash:', result.hash)
  }

  return isConnected
    ? <button onClick={handleSend} disabled={isLoading}>Send 10 KLV</button>
    : <button onClick={connect}>Connect Wallet</button>
}

Web App guide


What's next?

Was this page helpful?