StaticgetGet a cached signature if it exists and hasn't expired
Platform cache adapter instance
Wallet address that created the signature
Hash of the message that was signed
The cached signature if valid, null if expired or not found
StaticsetStore a signature in the cache with configurable TTL
Platform cache adapter instance
Wallet address that created the signature
Hash of the message that was signed
The signature to cache
Time to live in hours (default: 2)
const signature = await wallet.signTypedData(typedData);
const messageHash = SignatureCache.hashMessage(typedData);
// Cache for default 2 hours
SignatureCache.set(cache, walletAddress, messageHash, signature);
// Cache for 24 hours
SignatureCache.set(cache, walletAddress, messageHash, signature, 24);
StaticclearClear all cached signatures (useful for testing or explicit cleanup)
Platform cache adapter instance
StatichashGenerate a deterministic hash of a message object for cache key generation
The message object to hash (typically EIP-712 typed data)
A hex string hash (SHA-256) suitable for cache keys
Simple signature cache using platform cache adapter to avoid repeated signing of identical messages.
Remarks
This cache significantly improves UX by avoiding repeated wallet signature prompts for identical operations. It's particularly useful for operations that may be retried or called multiple times with the same parameters.
Features:
Example