For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

Parameter
Type
Required
Description

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

Action
Return Type
Description

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

Action
Return Type
Description

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

Action
Return Type
Description

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

Action
Return Type
Description

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

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

Helper
Tab type
Values

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

Last updated