schemos
Type-safe CosmWasm contract interactions, zero codegen.
schemos infers TypeScript types from JSON Schema (cargo schema output) at compile time and validates messages at runtime — no generated code, no client lock-in.
Install
pnpm add schemosQuick Start
import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate'
import { createTypedContract } from 'schemos'
import { cw20 } from 'schemos/schemas'
const client = await SigningCosmWasmClient.connectWithSigner(rpcEndpoint, signer)
const token = createTypedContract(client, 'osmo1...', cw20)
// Execute — message names autocomplete, fields are type-checked
await token.execute(
senderAddress,
'transfer',
{ recipient: 'osmo1...', amount: '1000' },
'auto',
)
// Query — return type inferred from response schema
const { const balance: stringbalance } = await token.query('balance', { address: 'osmo1...' })
// Compile-time validations
await token.query('balance', { addres: 'osmo1...' })await token.query('balance', { address: 123 })Entrypoints
| Import | Description |
|---|---|
schemos | createTypedContract, createMsgBuilder, createMsgValidator, Json, types |
schemos/schemas | Bundled cw20, cw721 schemas |
schemos/telescope | Adapter for telescope-generated SDKs |
Next Steps
- Overview — How it works, architecture, comparison
- API Reference — Full API documentation
- Custom Contracts — Use with your own contract schemas
- Integrations — cosmjs, telescope SDKs, wallet kits