Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

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 schemos

Quick 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)
 
// Executemessage names autocomplete, fields are type-checked
await token.execute(
  senderAddress,
  'transfer',
  { recipient: 'osmo1...', amount: '1000' },
  'auto',
)
 
// Queryreturn type inferred from response schema
const { 
const balance: string
balance
} = await token.query('balance', { address: 'osmo1...' })
// Compile-time validations await token.query('balance', { addres: 'osmo1...' })
Object literal may only specify known properties, but 'addres' does not exist in type '{ address: string; }'. Did you mean to write 'address'?
await token.query('balance', { address: 123 })
Type 'number' is not assignable to type 'string'.

Entrypoints

ImportDescription
schemoscreateTypedContract, createMsgBuilder, createMsgValidator, Json, types
schemos/schemasBundled cw20, cw721 schemas
schemos/telescopeAdapter for telescope-generated SDKs

Next Steps