Shielded Public Client
Read-only client with TEE key access and precompile support
Read-only client for interacting with a Seismic node. Extends viem's PublicClient with TEE public key retrieval, precompile access, block explorer URL helpers, SRC20 event watching, and deposit contract queries. Does not require a private key.
Import
import { createShieldedPublicClient } from "seismic-viem";Constructor
const publicClient = createShieldedPublicClient({
chain: seismicTestnet,
transport: http(),
});Parameters
chain
Chain
Yes
Chain configuration (e.g., seismicTestnet)
transport
Transport
Yes
viem transport (e.g., http())
Return Type
ShieldedPublicClient
A viem PublicClient extended with ShieldedPublicActions, DepositContractPublicActions, and SRC20PublicActions.
Usage
Actions
Shielded Public Actions
getTeePublicKey()
Promise<Hex>
Fetch the TEE's secp256k1 public key via seismic_getTeePublicKey RPC
getStorageAt()
--
Throws error (not supported on Seismic)
publicRequest()
Promise<any>
Raw RPC request to the node
explorerUrl(opts)
string | null
Generate a block explorer URL
addressExplorerUrl(address)
string | null
Explorer URL for an address
blockExplorerUrl(block)
string | null
Explorer URL for a block
txExplorerUrl(hash)
string | null
Explorer URL for a transaction
tokenExplorerUrl(address)
string | null
Explorer URL for a token
Precompile Actions
rng(params)
Promise<bigint>
Generate random numbers via the RNG precompile
ecdh(params)
Promise<Hex>
ECDH key exchange via precompile
aesGcmEncryption(params)
Promise<Hex>
AES-GCM encrypt via precompile
aesGcmDecryption(params)
Promise<string>
AES-GCM decrypt via precompile
hdfk(ikm)
Promise<Hex>
HKDF key derivation via precompile
secp256k1Signature(params)
Promise<Signature>
secp256k1 signing via precompile
SRC20 Actions
watchSRC20EventsWithKey()
Promise<() => void>
Watch for SRC20 events with a decryption key
See SRC20 Event Watching for the full flow, log types, and example usage.
Deposit Contract Actions
getDepositRoot()
Promise<Hex>
Query the deposit merkle root
getDepositCount()
Promise<Hex>
Query the deposit count
See Deposit Contract for parameters and validator registration via deposit().
Standard viem Public Actions
All standard viem PublicActions are available directly on the client:
getBlockNumber(),getBlock(),getTransaction()getBalance(),getCode(),call()estimateGas(),waitForTransactionReceipt()All other viem public client methods
getStorageAt Disabled
Seismic does not support eth_getStorageAt. Calling publicClient.getStorageAt() will throw an error. This is by design -- storage slots on Seismic may contain shielded data and cannot be read directly via RPC.
Examples
Fetching the TEE Public Key
Using Precompiles
Explorer URL Helpers
Each helper accepts an optional tab argument to deep-link into a specific view. The helpers return string | null -- null when the chain has no configured block explorer.
Tab values by item type
txExplorerUrl
TxExplorerTab
'index', 'token_transfers', 'internal', 'logs', 'state', 'raw_trace'
addressExplorerUrl
AddressExplorerTab
'txs', 'token_transfers', 'tokens', 'internal_txns', 'coin_balance_history', 'logs', 'contract'
tokenExplorerUrl
TokenExplorerTab
'token_transfers', 'holders', 'contract'
blockExplorerUrl
BlockExplorerTab
'index', 'txs'
Standalone functions
The same helpers are exported as standalone functions that take an explicit chain and can be used without a client:
See Also
Shielded Wallet Client -- Full-featured client with encryption and shielded writes
Deposit Contract -- Validator staking read/write actions
SRC20 Event Watching -- Watch and decrypt SRC20 token events
Chains -- Chain configurations for Seismic networks
Precompiles -- Precompile details and parameters
Encryption -- Encryption utilities and
getEncryption()
Last updated

