get_viewing_key
Fetch your viewing key from the Directory contract
Fetch your viewing key from the Directory genesis contract using signed read authentication.
Signatures
def get_viewing_key(
w3: Web3,
encryption: EncryptionState,
private_key: PrivateKey,
) -> Bytes32
async def async_get_viewing_key(
w3: AsyncWeb3,
encryption: EncryptionState,
private_key: PrivateKey,
) -> Bytes32Parameters
Parameter
Type
Description
w3
Web3 / AsyncWeb3
Web3 instance with Seismic support
Returns
Bytes32 — 32-byte AES-256 viewing key.
Raises ValueError if no viewing key is registered for the caller's address.
Example
Notes
Uses a signed read (
getKey()) so thatmsg.senderis authenticated — only the key owner can retrieve itTypically called internally by
watch_src20_events()to fetch the key before polling
See Also
register_viewing_key — Register a viewing key
check_has_key — Check if an address has a key (public, no auth)
watch_src20_events — Calls this internally
Last updated

