Skip to content

Testing ​

ContractingClient is the standard local test runtime for Xian contracts.

It lets you submit contracts, call exported functions, inspect state, and exercise contract interactions without running a full node.

The local harness executes through Python. Validators execute canonical IR through the native Xian VM. Use the harness for fast logic tests, then exercise deployment and representative calls on a local node before release. Local metering results are regression signals, not exact network fee quotes.

What It Gives You ​

ContractingClient includes:

  • the contract linter
  • the local execution runtime
  • storage behavior close to the real chain model
  • support for multi-contract tests, events, and return-value inspection
python
from contracting.local import ContractingClient

client = ContractingClient()
client.flush()

client.submit(my_contract_func, name="con_example")
contract = client.get_contract_proxy("con_example")
result = contract.some_function()

What It Is Best For ​

Use it for:

  • unit tests of contract logic
  • storage and event assertions
  • cross-contract integration tests
  • checking source and artifacts before submitting source to a live network

Installation ​

bash
uv add xian-tech-contracting

This installs the local contract runtime, linter, and testing client.