file-lockContract

Instantiating contracts and interacting through shielded and transparent namespaces


Instantiation

contract = w3.seismic.contract(address="0x...", abi=ABI)

The ABI works the same as in web3.py. If your contract uses shielded types (suint256, sbool, saddress), the SDK remaps them to their standard counterparts for parameter encoding while keeping the original shielded names for function selector computation.


Namespaces

ShieldedContract gives you five namespaces:

Namespace
What it does
On-chain visibility

.write

Encrypted transaction (TxSeismic type 0x4a)

Calldata encrypted

.read

Encrypted signed eth_call

Calldata + result encrypted

.twrite

Standard eth_sendTransaction

Calldata plaintext

.tread

Standard eth_call

Calldata plaintext

.dwrite

Debug write — like .write but returns plaintext + encrypted views

Calldata encrypted

# Shielded write — encrypted calldata, returns tx hash
tx_hash = contract.write.setNumber(42)

# Shielded read — encrypted signed call, returns raw bytes
result = contract.read.getNumber()

# Transparent write — standard send_transaction
tx_hash = contract.twrite.setNumber(42)

# Transparent read — standard eth_call
result = contract.tread.getNumber()

# Debug write — returns plaintext + encrypted views + tx hash
debug = contract.dwrite.setNumber(42)
debug.plaintext_tx.data  # unencrypted calldata
debug.shielded_tx.data   # encrypted calldata
debug.tx_hash            # transaction hash

Write namespaces accept optional keyword arguments for transaction parameters:


Encoding calldata manually

If you need to encode calldata outside of a contract call — for example, to pass it to the low-level APIarrow-up-right — you can use encode_shielded_calldataarrow-up-right. This computes the function selector using the original shielded type names (like suint256) but encodes the parameters using standard types (like uint256):

Last updated