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

Wallet Kits (React)

schemos works with any React wallet library. Here are patterns for the most popular ones.

interchain-kit

interchain-kit provides useChain with an interchainjs signing client — requires the schemos/telescope adapter.

 
import { useMemo } from 'react'
import { useChain } from '@interchain-kit/react'
import { MsgExecuteContract } from '@xpla/xplajs/cosmwasm/wasm/v1/tx'
import { createGetSmartContractState } from '@xpla/xplajs/cosmwasm/wasm/v1/query.rpc.func'
import { createExecuteAdapter } from 'schemos/telescope'
import { createTypedContract } from 'schemos'
import { cw20 } from 'schemos/schemas'
 
function useCw20(contractAddress: string, rpcEndpoint: string) {
  const { signingClient } = useChain('xpla')
 
  return useMemo(() => {
    if (!signingClient) return null
 
    const smartContractState = createGetSmartContractState(rpcEndpoint)
 
    const adapter = createExecuteAdapter(
      smartContractState,
      (sender, msgs, fee, memo) =>
        signingClient.signAndBroadcast(sender, msgs, fee, memo),
      (p) =>
        MsgExecuteContract.encode(
          MsgExecuteContract.fromPartial({ ...p, funds: [...p.funds] }),
        ).finish(),
    )
 
    return createTypedContract(adapter, contractAddress, cw20)
  }, [signingClient, contractAddress, rpcEndpoint])
}

cosmos-kit

cosmos-kit returns cosmjs clients — no adapter needed.

 
import { useMemo } from 'react'
import { useChain } from '@cosmos-kit/react'
import { createTypedContract } from 'schemos'
import { cw20 } from 'schemos/schemas'
 
function useCw20(contractAddress: string) {
  const { getSigningCosmWasmClient } = useChain('osmosis')
 
  return useMemo(async () => {
    const client = await getSigningCosmWasmClient()
    return createTypedContract(client, contractAddress, cw20)
  }, [getSigningCosmWasmClient, contractAddress])
}

graz

graz provides lightweight cosmjs hooks — no adapter needed.

 
import { useMemo } from 'react'
import { useCosmWasmSigningClient } from 'graz'
import { createTypedContract } from 'schemos'
import { cw20 } from 'schemos/schemas'
 
const CHAIN_ID = 'osmosis-1'
 
function useCw20(contractAddress: string) {
  const { data: clients } = useCosmWasmSigningClient({ chainId: [CHAIN_ID] })
 
  return useMemo(() => {
    const client = clients?.[CHAIN_ID]
    if (!client) return undefined
    return createTypedContract(client, contractAddress, cw20)
  }, [clients, contractAddress])
}

Comparison

interchain-kitcosmos-kitgraz
Signing clientinterchainjscosmjscosmjs
Adapter neededschemos/telescopeNoneNone
Wallet supportKeplr, Cosmostation, WalletConnectKeplr, Leap, Cosmostation, +20Keplr, Leap, Cosmostation, +more
React hooksuseChain()useChain()useCosmWasmSigningClient()
Bundle sizeLargerMediumLightweight

All approaches give you the same schemos DX — type-safe execute/query with autocomplete and runtime validation. The difference is only in how the signing client is obtained and whether an adapter is needed.