Getting Started
Get started with ivem in just a few lines of code.
Overview
ivem is a modern TypeScript SDK for IOST that provides lightweight clients, explicit wallet actions, and focused transport primitives.
- Developer experience Type-safe APIs, clear docs, and composable building blocks.
- Stability Targeted test coverage across clients, wallet core, and polling behavior.
- Lightweight Transport and action modules stay small and tree-shakable.
- Performance Minimal request layers and efficient sign/broadcast paths.
Installation
pnpm
pnpm add @ivem/coreQuick Start
1. Set up your Client & Transport
import { createPublicClient, http, mainnet } from '@ivem/core'
const publicClient = createPublicClient({
chain: mainnet,
transport: http(),
})
const chainInfo = await publicClient.getChainInfo()
console.log(chainInfo)http() defaults to chain.rpcUrls[0] (for mainnet, this is https://api.iost.io). You can still pass a custom URL when needed: http('https://your-rpc.example').
2. Create a Wallet Client
import {
accountFromPrivateKey,
createWalletClient,
http,
mainnet,
} from '@ivem/core'
const account = accountFromPrivateKey('your_account', 'your_private_key')
const walletClient = createWalletClient({
account,
chain: mainnet,
transport: http(),
})3. Consume Actions
const result = await walletClient.callContract({
contract: 'token.iost',
action: 'transfer',
args: ['iost', 'from', 'to', '1.00000000', 'memo'],
gasRatio: 1,
gasLimit: 2000000,
})
console.log(result.hash)