Skip to content
starskiff

wasmd

CosmWasm + IBC

Instance.wasmd() boots a wasmd node: Cosmos SDK + IBC + CosmWasm. It's a superset of simd — the right pick when your tests touch contracts or IBC.

Container-first on the official CosmWasm image (cosmwasm/wasmd:v0.61.14, exact version tags) — just Docker, no build. Pass binary to run a local executable, or image to bind your own.

Usage

import { Instance } from 'starskiff';
 
const instance = Instance.wasmd({
  chainId: 'wasm-test-1',
  prefix: 'wasm',
  accounts: [{ mnemonic: '...', coins: '1000000000stake', name: 'alice' }],
});
await instance.start();

CosmWasm contract testing

import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate';
import { GasPrice } from '@cosmjs/stargate';
 
const client = await SigningCosmWasmClient.connectWithSigner(instance.rpcUrl, wallet, {
  gasPrice: GasPrice.fromString('0stake'),
});
 
// Upload, instantiate, execute
const { codeId } = await client.upload(address, wasmBytecode, 'auto');
const { contractAddress } = await client.instantiate(address, codeId, initMsg, 'label', 'auto');
const result = await client.execute(address, contractAddress, executeMsg, 'auto');

Parameters

WasmdParameters extends CosmosChainParameters with:

ParameterTypeDefaultDescription
imagestringWASMD_DEFAULT_IMAGE (cosmwasm/wasmd:v0.61.14)Container image
binarystring"wasmd"Local binary (opts out of the container)

IBC

wasmd ships IBC, so a pair of wasmd instances plus Instance.hermes() gives you a full local IBC setup — see the IBC guide.